import type { SpawnOptions } from "../execution/deps.js"; import type { HarnessEvent } from "../execution/events.js"; export declare const OBSERVER_ENV = "HCN_OBSERVER"; export declare const INVOCATION_ID_ENV = "HCN_INVOCATION_ID"; type Env = Readonly>; /** The observer command from the environment, or null when no observer is * enabled. Decided from the string alone: the variable must be non-empty * and absolute. No filesystem work happens here - a path that does not * name a spawnable file fails later, asynchronously, and silently. The * check uses `isAbsolute` so a value like `/tmp/../tmp/observer` keeps * enabling the observer: the previous `resolve(value) === value` form * rejected those (and any value that resolves to itself through `..`), * disabling observation and the invocation-ID export on a string the * caller plainly intended as absolute. */ export declare const observerCommand: (env: Env) => string | null; export interface RunObserver { readonly enabled: boolean; /** The pid of the spawned observer child, or null when there is * none to name: no observer enabled, the spawn failed, or launched * not yet called. The value survives the child's exit (ChildProcess.pid * keeps the last pid), so a caller can still wait on the child after * the stream ends. */ readonly pid: number | null; /** Adds `HCN_INVOCATION_ID` over the caller's env on the launch spawn; * returns the options untouched when no observer is enabled. Call on * the first harness spawn only - later spawns (the approval helper) * carry none of this. */ harnessEnv(opts: SpawnOptions, invocationId: string): SpawnOptions; /** Spawns the observer command and writes the `started` record. Call * in a `finally` so a harness spawn that throws is still covered. * Never throws. */ launched(invocationId: string, at: string): void; /** Streams one run event, unless it is droppable or observation has * ended. A `done` event ends the stream. Fire-and-forget; never * throws. */ event(event: HarnessEvent): void; /** Ends the stream. Idempotent; never throws. */ end(): void; } /** The run observer for one `hcn run` invocation. Inert unless * `HCN_OBSERVER` enables it. */ export declare const createRunObserver: (harness: string, cwd: string | undefined) => RunObserver; export {}; //# sourceMappingURL=observer.d.ts.map