/** * Script phase — zero-token shell command execution. * Isolated from runtime.ts so S5 strangler can flip kinds without growing the monolith. * * Trusted Effects (0.3): when a phase declares `fs.write` effects, the runtime * (imperative path + event-kernel step) pre-snapshots declared finals, runs the * script (content via stdout only — **must not** write those finals), then * promotes through the phase-level resource transaction owned by runtime.ts. * Mid-phase writes to declared finals fail closed (`declared-path-bypass`). */ import type { Phase } from "../../schema.ts"; import type { PhaseState } from "../../store.ts"; import { type DirectoryIdentity } from "../../cwd-bridge.ts"; /** Resolve a script phase cwd without changing any existing explicit cwd or * workspace-isolation semantics. Flow-relative mode is opt-in and requires * trusted loader provenance; it never guesses a directory from flow data. */ export declare function resolveScriptCwd(opts: { executionCwd: string; hasExplicitCwd: boolean; scriptCwd?: "invocation" | "flow"; flowSourceFile?: string; flowSourceDirIdentity?: DirectoryIdentity; }): string; export interface ScriptRunResult { stdout: string; stderr: string; code: number | null; stdoutOversize: boolean; timedOut: boolean; } /** * Spawn the script command and capture stdout/stderr with timeout + size caps. */ export declare function runScriptCommand(opts: { /** Interpolated argv (array form) or single shell string as [cmd]. */ interpRunText: string[]; /** Original `run` shape: array → no shell; string → shell true. */ arrayForm: boolean; cwd: string; /** When present, revalidated synchronously inside the spawn closure. */ cwdIdentity?: DirectoryIdentity; signal?: AbortSignal; stdinInput?: string; timeoutMs: number; }): Promise; /** Map a successful/failed script process result to PhaseState. */ export declare function scriptResultToPhaseState(phase: Phase, result: ScriptRunResult, opts: { inputHash: string; timeoutMs: number; reads?: PhaseState["reads"]; }): PhaseState; /** Spawn error → failed phase (not cacheable — transient). */ export declare function scriptSpawnErrorToPhaseState(phaseId: string, err: unknown, opts: { inputHash: string; reads?: PhaseState["reads"]; }): PhaseState; //# sourceMappingURL=script.d.ts.map