UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

33 lines (32 loc) • 2.73 kB
import type { McpServerSpec, ToolSpec } from "../core/types.js"; import type { ToolSelector } from "../core/tool-face.js"; import type { MountedMcp } from "../core/mounted-mcp.js"; /** * What a delegated child inherits when its delegation tool has no explicit pool (`SubagentToolOptions.inheritedTools`): * the parent surface, narrowed at spawn by two laws, and the parent's MCP declarations. The mint of the parent bound * ({@link callerToolMembership}) and the reads live here, so the law has one home. Which of these tools the child may USE is * not decided here: its own prepare runs its selector over everything it is handed and mounts. */ /** The team task-list family (pool-borne; the catalog marks it a teammate's protocol UNDER the ceiling — a named child holds the ones its * spawner may use). */ export declare const TEAM_TASK_LIST_TOOL_NAMES: readonly string[]; /** The run's `mountsCallerTool` seat: membership BY IDENTITY in `spec.tools` as the caller handed it (the roster snapshot's * copy of the array — the one read of the slot; nothing is read off the entries, so no entry can make the mint throw). */ export declare function callerToolMembership(tools: readonly unknown[] | undefined): (tool: ToolSpec) => boolean; /** * The inherited pool for one spawn. * · ⊆ parent: an entry survives only when the spawning run mounts THAT instance — a same-named replacement (a host's * own tool, a per-spawn injection) never re-admits the surface's original. No seat (the tool is driven outside a * Runner) = no parent bound is known = nothing is inherited; a host driving the tool directly passes the seat itself. * · tier (upstream `filterToolsForAgent`): an anonymous background child gets the async allowlist there — WebFetch / * WebSearch / TodoWrite, not the task-list family. A synchronous child, a named teammate and a fork keep it. */ export declare function inheritedChildPool(surface: readonly ToolSpec[], mountsCallerTool: ((tool: ToolSpec) => boolean) | undefined, anonymousBackground: boolean): ToolSpec[]; /** * The MCP servers a delegated child is declared: each server its spawning run declares, exactly as declared, when the child's * selector can admit a tool of it ({@link ToolSelector.admitsPeer} — read off the lists, never off what the server lists now). * A server the selector can never reach is not declared, so it is never dialled or leased for this child. The child connects * from these (through the run tree's pool) and its own selector decides, at intake and on every refresh and re-dial, which of * the server's tools mount. */ export declare function inheritedMcpDeclarations(mounted: MountedMcp, selector: ToolSelector): McpServerSpec[];