@sema-agent/core
Version:
Stateless, task-oriented AI agent core
29 lines (28 loc) • 2.41 kB
TypeScript
import type { ToolSpec } from "../core/types.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. The mint of the parent bound ({@link callerToolMembership}) and both
* reads live here, so the law has one home.
*/
/** The team task-list family: the pool-borne members of the upstream teammate exception set (the rest of that set,
* SendMessage and the Cron trio, is mounted by a child's own prepare and never rides a delegation pool). */
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 (a copy of the
* array taken now; nothing is read off the entries, so no entry can make the mint throw). */
export declare function callerToolMembership(tools: readonly ToolSpec[] | 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 task-list members of a named child's INHERITED pool that stand past its allowlist (upstream: a teammate built from a
* custom agent type gets `[...type.tools, SendMessage, ...the four when the root has them]` — the root's own first-party
* tools). Only what the child inherited is widened: a pool the host composed (`tools`, `extraTools`) is judged by the
* allowlist as written, since a model-chosen name must not lift a host's restriction. A deny still wins.
*/
export declare function teammateInheritedFamily(inherited: readonly ToolSpec[], denyTools: ReadonlyArray<string> | undefined): ToolSpec[];