import type { ProcessJobState } from "@mono-agent/agent-contracts"; import type { PreparedSandboxCommand } from "./sandbox.js"; export interface ProcessJobProcessResult { readonly code: number | null; readonly signal: NodeJS.Signals | null; readonly stdout: string; readonly stderr: string; readonly aborted: boolean; readonly timedOut: boolean; readonly bufferExceeded: boolean; readonly truncated: boolean; readonly bytes: number; readonly storedBytes: number; readonly spawnError: Error | null; /** False only when bounded termination settled without proof that the owned group disappeared. */ readonly groupExitConfirmed?: boolean; readonly durationMs: number; } export interface ProcessJobLaunchOptions { readonly timeoutMs?: number; readonly signal?: AbortSignal; readonly maxBufferBytes?: number; readonly onStdout?: (chunk: Buffer) => void; readonly onStderr?: (chunk: Buffer) => void; } export interface ProcessJobProcessHandle { readonly pid: number | null; readonly pgid: number | null; readonly startedAt: string; readonly completion: Promise; /** Release the gated target only after PID/PGID/incarnation ownership is durable. */ readonly release: () => Promise; /** Send SIGTERM to the owned group and escalate to SIGKILL after one second. */ readonly cancel: () => void; } export interface ProcessJobStartRequest { readonly tool: "Exec" | "Bash"; /** * Exact sandbox-prepared command. The controller takes ownership before * start() can settle and must call cleanup after the owned process group exits * on every success/failure/cancellation path. Commands that deliberately * create a different POSIX session or process group are outside this ownership * contract. Never persist env values or raw argv from this object. */ readonly prepared: PreparedSandboxCommand; /** Kernel-produced summary that contains no argument/command values. */ readonly summary: string; /** Explicit per-call narrowing; omission delegates to compiled host config. */ readonly timeoutMs?: number; /** Explicit per-call preview narrowing; omission delegates to host config. */ readonly maxOutputChars?: number; /** One-shot launcher bound to the exact prepared command and POSIX group wait. */ readonly launch: (options?: ProcessJobLaunchOptions) => ProcessJobProcessHandle; } export interface ProcessJobStartResult { readonly jobId: string; readonly state: Extract; readonly startedAt: string | null; /** * Runtime budget the host actually granted, after its own `maxRuntimeMs` * ceiling was applied to whatever the caller requested. Optional so an older * controller that omits it still satisfies the contract; when present the tool * reports it, so a reduced budget can never be silently mistaken for the * requested one. */ readonly maxRuntimeMs?: number; } /** Host budget a background job is bounded by, independent of any one request. */ export interface ProcessJobControllerLimits { readonly maxRuntimeMs: number; readonly maxOutputBytes: number; } /** Request-scoped host controller injected only into Pi-native Exec/Bash. */ export interface ProcessJobsController { /** * The host's standing ceiling, published so the tool schema can state it * before a job is launched. Optional: a controller that omits it simply * leaves the limit unstated rather than failing the contract. */ readonly limits?: ProcessJobControllerLimits; start(request: ProcessJobStartRequest): Promise; } /** Bridge the typed host controller to agent-runtime's dependency-free seam. */ export declare function bridgeProcessJobsController(controller: ProcessJobsController): ProcessJobsController; //# sourceMappingURL=process-jobs.d.ts.map