/** * Agent Exec engine — one-shot exposure of the AgentRunner surface over the * public subprocess protocol in doc/agent-exec-protocol.md (§3). * * Process model: the CALLER (e.g. monoagentcli) spawns `monomind agent exec`; * monomind resolves the requested runtime's AgentRunner and drives ONE agent * turn, adapting the `--prompt` string into the single-message async stream * the runner interface expects (`AgentRunArgs.prompt`). With * `--tools stdio` (+ `--tools-file` / `--tool-names`), tool handler * invocations are bridged to the caller as `tool_call` frames on stdout and * satisfied by `tool_result` frames on stdin — identically for native * runners (ClaudeAgentRunner registers them as real SDK tools) and fence * runners (subprocess CLIs render + parse the fence protocol in-process). * * stdout purity (§3): the ONLY thing this engine writes to stdout is NDJSON * events via the injected `emit` sink. Everything else goes to stderr. * * Cancellation semantics: `--timeout`, budget breach, and caller `cancel` * frames all funnel through `terminate()` — a fire-and-forget * `stream.return()` (the runner's finally-blocks SIGTERM/SIGKILL its child) * raced against a grace window, after which the engine resolves regardless. * A runner wedged mid-await cannot have its return() propagate until it * reaches a yield; the grace bound keeps the exec from hanging forever, and * the runner's own 2h/45s ladders remain the backstop for orphaned children. */ import { type AgentExecOptions } from './agent-exec-options.js'; import { type AttemptContext } from './agent-exec-retry.js'; import type { AgentMessage } from './agent-runner.js'; export type { ExecErrorCode } from './agent-exec-errors.js'; export type { AgentExecOptions, ToolSpec } from './agent-exec-options.js'; export { jsonSchemaToZodShape } from './agent-exec-options.js'; /** * Run one agent exec turn. Emits protocol events via opts.emit and returns * the process exit code (§3.2): 0 success · 1 error · 124 timeout · * 130 cancelled. `done` is emitted exactly once before returning. A turn * that fails on a transient rate limit is retried (agent-exec-retry.ts). */ export declare function runAgentExec(opts: AgentExecOptions): Promise; /** One attempt; a later one skips `start` + startup notices (see AttemptContext). */ export declare function runAgentExecOnce(opts: AgentExecOptions, ctx?: AttemptContext): Promise; /** #655: what the request actually ran on, beside what was selected. `model_usage` * is per model served (child agents included); `unexpected_models` lists those * that are not the selected model, so an escalation is visible, not inferred. */ export declare function resultVisibility(m: AgentMessage, selected: string | undefined): Record; //# sourceMappingURL=agent-exec.d.ts.map