import { listSessions } from '../discovery.js'; import { type RunCommand } from '../runners.js'; import type { SessionSource, SendOptions } from '../types.js'; /** * Phase 3 extension fields for SendOptions. Kept local so we don't touch * src/types.ts (outside the allow-list). cli.ts populates these via type * assertion when it wires the new CLI flags through. */ type SendOptionsX = SendOptions & { dryRun?: boolean; maxNewPerRun?: number; detectTimeoutMs?: number; }; export declare function sendCommand(sessionId: string | undefined, opts: SendOptionsX): Promise; /** * Poll the source's session index for a brand-new session created during this * send. wp/02 + wp/06: anchored to `beforeSendT` so we never return a session * that existed prior to spawn (cross-project leakage). Returns null when no * fresh session is detected after polling — the caller maps that to a * `NEW_SESSION_NOT_DETECTED` partial error. * * ds/03 — the slop tolerance is configurable via `timeoutMs` (default 2000 * ms). Slow filesystems (NFS) or clock skew can push session mtime outside * the default window, so agents can raise the budget per-call. */ export declare function detectNewSession(source: SessionSource, cwd: string, beforeSendT: number, deps?: { listSessions?: typeof listSessions; sleep?: (ms: number) => Promise; timeoutMs?: number; }): Promise; export interface SpawnResult { exitCode: number; stdoutTail: string[]; stderrTail: string[]; } /** * Run a child process to completion, mirroring its stdout+stderr to our stderr * (so JSON callers see live progress without polluting the stdout envelope) * and capturing the trailing 50 lines per stream for inclusion in error * envelopes. wp/03: both pipes are drained continuously to prevent OS buffer * deadlock; remaining buffered text is flushed before the promise settles. */ export declare function spawnAndWait(cmd: RunCommand, cwd: string): Promise; /** * Attach a data listener to a child stream, mirror chunks to stderr, and * keep a rolling buffer of the last 50 complete lines. Exported for unit * tests (wp/03 regression coverage). */ export declare function tapOutput(stream: NodeJS.ReadableStream): { lines: string[]; flush: () => void; }; export {}; //# sourceMappingURL=send.d.ts.map