Refactor `_inputs` in to `_context`, split up input tests.

This replaces the `_inputs` parameter with a more flexible `_context` parameter,
and lays the foundation for providing both global/top-level and
local/context-specific information to script directives.

Note that this doesn't yet change the names or organization of the script
directives' execution context; that'll come in a subsequent patch.