|
| 1 | +# Delta for CLI Runtime |
| 2 | + |
| 3 | +## ADDED Requirements |
| 4 | + |
| 5 | +### Requirement: CLI concurrency limits are enforced |
| 6 | + |
| 7 | +The executor MUST enforce `maxConcurrentExecutions` when the configured value is greater than zero. |
| 8 | + |
| 9 | +#### Scenario: Limit reached |
| 10 | + |
| 11 | +- GIVEN the concurrency limit is N |
| 12 | +- AND N executions are active |
| 13 | +- WHEN another execution is submitted |
| 14 | +- THEN it MUST wait for capacity or fail according to the selected admission policy |
| 15 | +- AND MUST NOT spawn an additional child process before capacity is available |
| 16 | + |
| 17 | +### Requirement: CLI output retention is bounded |
| 18 | + |
| 19 | +The executor MUST bound retained stdout and stderr independently. |
| 20 | + |
| 21 | +#### Scenario: Child output exceeds configured capture limit |
| 22 | + |
| 23 | +- GIVEN a configured output capture limit |
| 24 | +- WHEN a child emits more bytes than the limit |
| 25 | +- THEN retained output MUST remain within the configured bound |
| 26 | +- AND the result MUST indicate truncation |
| 27 | + |
| 28 | +### Requirement: CLI execution supports per-invocation environment isolation |
| 29 | + |
| 30 | +The executor MUST allow a caller to control environment inheritance and provide environment overrides without mutating the JVM process environment. |
| 31 | + |
| 32 | +#### Scenario: Override one variable |
| 33 | + |
| 34 | +- GIVEN parent environment inheritance is enabled |
| 35 | +- AND an execution override defines a variable |
| 36 | +- WHEN the child process starts |
| 37 | +- THEN the child MUST see the override value |
| 38 | +- AND subsequent unrelated executions MUST NOT inherit that override unless configured |
| 39 | + |
| 40 | +### Requirement: Streaming execution delivers data before process exit |
| 41 | + |
| 42 | +The SDK MUST provide an execution mode that exposes stdout and stderr incrementally while the process is running. |
| 43 | + |
| 44 | +#### Scenario: Long running JSON output |
| 45 | + |
| 46 | +- GIVEN an OpenCode process emits multiple JSON event lines over time |
| 47 | +- WHEN the caller uses streaming execution |
| 48 | +- THEN each complete event line MUST be observable before process termination |
| 49 | +- AND process completion MUST be available through a separate completion result |
| 50 | + |
| 51 | +### Requirement: Process outcomes are classified |
| 52 | + |
| 53 | +The SDK MUST distinguish success, non-zero exit, spawn failure, timeout, and cancellation. |
| 54 | + |
| 55 | +#### Scenario: Spawn failure |
| 56 | + |
| 57 | +- GIVEN the configured executable does not exist |
| 58 | +- WHEN execution is attempted |
| 59 | +- THEN the result or completion failure MUST identify spawn failure |
| 60 | +- AND MUST NOT report it as a normal non-zero OpenCode exit |
0 commit comments