@sema-agent/core
Version:
Stateless, task-oriented AI agent core
46 lines (45 loc) • 2.41 kB
TypeScript
import type { RunnerDeps, ToolSpec } from "../types.js";
import type { RunnerSelfSeat } from "./contracts.js";
import type { SubagentTranscriptTier } from "../wiring-manifest.js";
/**
* The tier-3 revival spawner of the SendMessage mount: re-enters the
* MOUNTED delegation tool (identified by object, never by wire name) through the raw ToolSpec execute +
* the leg's ctx enricher, with a fresh toolCallId and the trusted `ctx.reviveClaim`, so a revival is the
* complete spawn chain. `undefined` when no delegation tool is mounted. Module-level: closes over
* nothing of the leg but the two values it is handed.
*/
declare function buildTier3ReviveSpawn(delegationForRevive: ToolSpec | undefined, enrichSpecToolCtx: (ctx: import("../types.js").ToolExecuteContext) => import("../types.js").ToolExecuteContext): ((req: {
row: import("../background-agent-store.js").BackgroundAgentRecord;
rev: number;
prompt: string;
peerSeed?: {
hopChain: string[];
};
}) => Promise<{
isError?: boolean;
content: string;
details?: unknown;
}>) | undefined;
/**
* The tier-3 revival spawner: identify the mounted delegation
* tool by OBJECT via its `agentListing` marker (filled only by createSubagentTool; a caller's
* same-named shadow tool never carries it, so the trusted ctx.reviveClaim can never reach
* one). The call goes through the RAW ToolSpec execute + `enrichSpecToolCtx` (the same
* enrichment the injection map applies — the AgentTool adapter face forwards only
* {toolCallId, signal} and would strip the claim), so the revival is the complete spawn
* chain: notify lane, observer sink, roster, durable store. The request is built by
* SendMessage AT EXECUTE TIME (ctx-first identity); this closure holds only the tool object
* reference. Fresh toolCallId per revival (F-11③ — never SendMessage's own call id).
* `tier` is {@link sendMessageContinuationTier} over the same seats the mount receives.
*/
export declare function sendMessageContinuationSeats(seats: {
specTools: readonly ToolSpec[];
agentStore: RunnerDeps["backgroundAgentStore"];
mailbox: RunnerDeps["mailboxStore"];
runner: RunnerSelfSeat;
enrichSpecToolCtx: (ctx: import("../types.js").ToolExecuteContext) => import("../types.js").ToolExecuteContext;
}): {
reviveSpawn: ReturnType<typeof buildTier3ReviveSpawn>;
tier: SubagentTranscriptTier;
};
export {};