import type { RouteContext } from './router.js'; import { type InputSource, type OutputFile } from './artifacts.js'; export declare const A2A_MAX_DEPTH_DEFAULT = 8; export declare const A2A_TIMEOUT_MS_DEFAULT: number; /** Hard upper bound — refuse caller-supplied `timeoutMs` larger than this so * an agent can't accidentally write `timeoutMs: 86400000` and block A2A * forever. Override with AGIM_A2A_MAX_TIMEOUT_MS. */ export declare const A2A_TIMEOUT_MS_MAX: number; export declare function isA2AEnabled(): boolean; export declare function getA2AMaxDepth(): number; export declare const A2A_MAX_RESULT_CHARS_DEFAULT = 8000; /** File the over-long result is spilled to, under the callee's _agim-output/. */ export declare const A2A_FULL_RESULT_FILE = "__a2a_result_full.md"; /** Caller-visible result cap in chars. `AGIM_A2A_MAX_RESULT_CHARS=0` disables * truncation (return the full text); unset → default. */ export declare function getA2AMaxResultChars(): number; /** Cap `result` for the caller's context; spill the full text to _agim-output/ * when truncated. Returns the (possibly shortened) string. Spill failure falls * back to the full result rather than losing content. */ export declare function compressA2AResult(jobId: number, result: string): Promise; export declare function getA2ATimeoutMs(ctx?: { platform?: string; channelId?: string; threadId?: string; }): number; export declare function getA2AMaxTimeoutMs(): number; export interface CallAgentOpts { /** Parent inline-job id (caller). NULL for top-level user calls. */ parentJobId?: number | null; /** Caller's call_depth. New row will be set to caller + 1. */ callerDepth?: number; /** Caller agent name (for self-call check). RouteContext doesn't carry * this in its type today; bus.callAgent looks it up from RunContext * + the audit log's per-run state. Optional — when unset we skip the * self-call check; the depth ceiling still prevents runaway chains. */ callerAgent?: string; /** Override timeout. Falls back to env / default. */ timeoutMs?: number; /** Parent tool/turn cancellation. Aborting it terminates the callee in * addition to A2A's own timeout controller. */ signal?: AbortSignal; /** L2: files to drop in the callee's _agim-input/ before it runs. * Each input has a target filename plus exactly one of: * - fromAbsolutePath: copy/hard-link from a path on disk * - fromCallerOutput: pull from caller's own _agim-output/ * (requires parentJobId so artifacts knows which job to read) * - content: inline string content */ inputs?: InputSource[]; /** L2: filenames the callee is expected to produce under _agim-output/. * Missing files at return time become entries in `warnings`, not a * hard failure — the callee is still allowed to do what it deems * best. */ expectOutputs?: string[]; /** v1.2.139 — when the caller is currently in Plan Mode, propagate * the flag to the callee so the sub-agent also runs read-only. Without * this, a parent that hit /plan on would happily delegate write tasks * to e.g. claude-code, which would launch with full write access and * bypass the user's intent. */ planMode?: boolean; /** Inherit parent's Step Reflect so same-family Agim workers run the beat. */ stepReflect?: boolean; /** Web chat activity accordion — live "Waiting for subagent" steps. * Prefer this over RouteContext.onToolActivity when both are set. */ onToolActivity?: import('./types.js').AgentSendOpts['onToolActivity']; /** Allow same-agent nested Subagent (isolated context). Vacuous self-call * without isolate/model is still rejected. See docs/architecture/subagent.md. */ isolate?: boolean; /** Agim Agent backend name → `AgentSendOpts.model` (role already resolved). */ model?: string; /** Activity accordion label override (e.g. `agim/cheap`). */ activityLabel?: string; /** * Stable activity step id (usually the parent toolCallId). When set, the * Subagent card updates in place from pending → running → done instead of * opening a second `a2a-${jobId}` row. */ activityStepId?: string; /** * Absolute subtree depth ceiling for this spawn (and descendants via * AgentSendOpts.a2aMaxDepth). Cannot exceed AGIM_A2A_MAX_DEPTH. */ maxDepth?: number; /** * Same-family Agim only: restrict the child's advertised / dispatchable * tools. Cross-adapter CLI agents cannot honor this — spawn is refused. */ allowedTools?: readonly string[]; } export type CallAgentResult = { ok: true; result: string; jobId: number; agent: string; durationMs: number; /** L2: absolute path of the artifacts directory for this run. */ artifactsDir: string; /** L2: files the callee left under _agim-output/. */ outputs: OutputFile[]; /** L2: non-fatal advisories — e.g. expectOutputs that didn't show up. */ warnings?: string[]; /** True when the user (or parent) stopped the Subagent mid-run. */ cancelled?: true; } | { ok: false; error: string; jobId?: number; agent?: string; }; /** Tool-result text handed back to the parent after a user Stop. */ export declare function formatSubagentStoppedResult(partial: string): string; /** True when an AbortSignal reason looks like a wall-clock / turn timeout * (as opposed to an explicit user Stop). */ export declare function isAbortReasonTimeout(reason: unknown): boolean; /** Programmatic A2A entry. Invokes `agentName` with `prompt` under the * given RouteContext. Does NOT touch session history, does NOT deliver * to IM. Result is returned to the caller verbatim. */ export declare function callAgentByName(agentName: string, prompt: string, ctx: RouteContext, rawOpts?: CallAgentOpts): Promise; //# sourceMappingURL=a2a.d.ts.map