|
| 1 | +## MODIFIED Requirements |
| 2 | + |
| 3 | +### Requirement: Unified Sandbox Execution Interface |
| 4 | +The project SHALL provide a stable Node sandbox execution interface, with `NodeRuntime` exposing an `exec` path for running untrusted code and returning structured execution results, and a `run` path that returns module exports. Browser runtime execution support SHALL be disabled for this change phase. |
| 5 | + |
| 6 | +#### Scenario: Execute code in Node runtime |
| 7 | +- **WHEN** a caller creates `NodeRuntime` with a valid driver and invokes `exec` |
| 8 | +- **THEN** the sandbox MUST run the provided code in an isolated execution context and return structured output for the caller |
| 9 | + |
| 10 | +#### Scenario: Browser runtime is disabled for this phase |
| 11 | +- **WHEN** a caller attempts to use browser sandbox runtime entrypoints during this change phase |
| 12 | +- **THEN** browser runtime execution MUST be unavailable under the runtime contract until a follow-up change restores support |
| 13 | + |
| 14 | +#### Scenario: Run CJS module and retrieve exports |
| 15 | +- **WHEN** a caller invokes `run()` with CommonJS code that assigns to `module.exports` |
| 16 | +- **THEN** the result's `exports` field MUST contain the value of `module.exports` |
| 17 | + |
| 18 | +#### Scenario: Run ESM module and retrieve namespace exports |
| 19 | +- **WHEN** a caller invokes `run()` with ESM code that uses `export` declarations |
| 20 | +- **THEN** the result's `exports` field MUST contain the module namespace object with all named exports and the `default` export (if declared) |
| 21 | + |
| 22 | +#### Scenario: Run ESM module with only a default export |
| 23 | +- **WHEN** a caller invokes `run()` with ESM code containing `export default <value>` |
| 24 | +- **THEN** the result's `exports` field MUST be an object with a `default` property holding that value |
| 25 | + |
| 26 | +#### Scenario: Run ESM module with named and default exports |
| 27 | +- **WHEN** a caller invokes `run()` with ESM code containing both `export default` and named `export` declarations |
| 28 | +- **THEN** the result's `exports` field MUST be an object containing both the `default` property and all named export properties |
| 29 | + |
| 30 | +### Requirement: Driver-Based Capability Composition |
| 31 | +Runtime capabilities SHALL be composed through host-provided drivers so filesystem, network, and child-process behavior are controlled by configured adapters rather than hardcoded runtime behavior. `NodeRuntime` construction SHALL require a driver. |
| 32 | + |
| 33 | +#### Scenario: Node process uses configured adapters |
| 34 | +- **WHEN** `NodeRuntime` is created with a driver that defines filesystem, network, and command-execution adapters |
| 35 | +- **THEN** sandboxed operations MUST route through those adapters for capability access |
| 36 | + |
| 37 | +#### Scenario: Missing permissions deny capability access by default |
| 38 | +- **WHEN** a driver is configured without explicit permission allowance for a capability domain |
| 39 | +- **THEN** operations in that capability domain MUST be denied by default |
| 40 | + |
| 41 | +#### Scenario: Omitted capability remains unavailable |
| 42 | +- **WHEN** a capability adapter is omitted from runtime configuration |
| 43 | +- **THEN** corresponding sandbox operations MUST be unavailable or denied by the runtime contract |
0 commit comments