UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

16 lines (15 loc) • 1.3 kB
import { type TaskRegistry } from "../core/task-registry.js"; import type { ToolExecuteContext } from "../core/types.js"; /** * The ONE reading of the registry a delegation call's background children live in, taken at the call's entry beside the inherited * seat: the run's seat inside a Runner task (`ToolExecuteContext.taskRegistry` — the registry its leg end, TaskStop, ListAgents and * teardown read), the bag's option outside one, else the engine's one registry — the reading the bag's other members already have * (the owner `ctx.taskId ?? owner`, the checkpoint store `ctx.checkpointStoreForChildren`). An option naming a DIFFERENT registry inside * a task is refused here, before any allocation (`config.invalid_task_registry`, the sibling of the bag's checkpoint-store refusal): * children registered where no reader of the run looks would owe deliveries its leg end never sees and outlive its teardown. The bag * itself is never copied — its other members (callbacks a host may define on a class, with their receiver) stay read off the host's * object; `undefined` exactly when there is no bag. */ export declare function delegationRegistryOf(ctx: Pick<ToolExecuteContext, "taskRegistry">, bag: { readonly registry?: TaskRegistry; } | undefined): TaskRegistry | undefined;