Interface: BinaryInvocation
Defined in: src/batteries/media/contracts.ts:67
A single binary invocation handed to a BinaryExecutor.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
args | string[] | Arguments, exec-style (no shell interpolation). | src/batteries/media/contracts.ts:71 |
cmd | string | The command to run (an absolute path or a name the executor can resolve). | src/batteries/media/contracts.ts:69 |
cwd? | string | Working directory for the process. Omitted means the executor's own default. Remarks Exec-style, like args: the executor passes it to the process launcher and never interprets it as shell text. A sandbox wrapper that rewrites the invocation carries the caller's cwd through unchanged — the profile it generates is what decides whether that directory is reachable at all. | src/batteries/media/contracts.ts:81 |
env? | Record<string, string> | The caller's own EXPLICIT environment values, applied last. Remarks The same semantics as SandboxPolicyEnforcer.run's env: these are the caller's own values — not a host-inheritance control — and a sandbox decides host inheritance separately through its allow-list. They are applied last, so they may add names or override inherited ones, and an adapter must not let them (or anything else) pull host variables beyond its allow-list into the child. They do not replace the executor's environment — unless the invocation clears BinaryInvocation.extendEnv, in which case this object IS the whole environment. | src/batteries/media/contracts.ts:93 |
extendEnv? | boolean | Whether BinaryInvocation.env extends the executor's own environment (true, the default) or replaces it entirely (false). Remarks This field exists for sandboxes. A sandbox decides what a child may inherit from the host (usually an allow-list, on the explicit grounds that anything inherited is readable back into the model's context by running env), so it must be able to say "this is the entire environment". An executor that always merged its own ambient environment back in would silently defeat that allow-list — execa's extendEnv: true default does exactly this — which is why the SRT wrapper sets it to false and the bundled executor maps it to extendEnv: false. Leave it unset for an ordinary, unsandboxed invocation. | src/batteries/media/contracts.ts:107 |
forceKillAfterDelay? | number | false | Milliseconds to wait after BinaryInvocation.killSignal before escalating to SIGKILL; false and Infinity disable escalation and never send SIGKILL. Remarks Settlement follows BinaryInvocation.settleEscalation: 'wait' holds exec() until the escalation completes, 'cancel' stops escalation when exec() returns, and 'poll' may send SIGKILL after return. Omitted means the executor's default. Negative values and NaN reject before spawning. | src/batteries/media/contracts.ts:139 |
killSignal? | string | The signal used to terminate the invocation when BinaryInvocation.signal aborts or BinaryInvocation.timeoutMs elapses. 'SIGTERM' by default. Remarks Typed as string (not NodeJS.Signals) so that this contract stays browser-safe: it is a plain signal NAME, and an executor that runs somewhere without POSIX signals decides what to do with it. With the bundled executor's default detached: true, it signals the whole process group; with detached: false, it signals only the direct child. | src/batteries/media/contracts.ts:128 |
settleEscalation? | "wait" | "cancel" | "poll" | How escalation behaves when an abort or executor-owned timeout fires and the invocation settles while escalation is armed. Defaults to 'wait'. 'wait' delays settlement until the target is empty or SIGKILL is sent (nothing survives, at the cost of latency up to the escalation delay); 'cancel' returns fastest but descendants may survive; 'poll' returns fastest and may kill survivors later, with a narrow process-group reuse risk after return. A normal exit never waits or polls. Applies only with finite escalation and a known pid; detached: false cancels at settlement in every mode. Wait also has a narrow numeric PGID-reuse risk between probes, bounded to before return. The value is a browser-safe string union. | src/batteries/media/contracts.ts:150 |
signal? | AbortSignal | Abort signal to cancel the invocation. | src/batteries/media/contracts.ts:117 |
timeoutMs? | number | Wall-clock timeout in milliseconds. Remarks 0, Infinity, and finite values above 2,147,483,647 disable the deadline. Negative values and NaN reject the invocation before spawning. | src/batteries/media/contracts.ts:115 |