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; /** Web chat activity accordion — live "Waiting for subagent" steps. * Prefer this over RouteContext.onToolActivity when both are set. */ onToolActivity?: import('./types.js').AgentSendOpts['onToolActivity']; } 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[]; } | { ok: false; error: string; jobId?: number; agent?: string; }; /** 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, opts?: CallAgentOpts): Promise; //# sourceMappingURL=a2a.d.ts.map