@sema-agent/core
Version:
Stateless, task-oriented AI agent core
50 lines (49 loc) • 3.42 kB
TypeScript
/**
* The STATIC TOOL CATALOG (design/388 §2.1 "静态目录"): one row per built-in / synthetic tool DEFINITION
* core owns — its wire name, the conditions core (or a host scenario factory) mounts it under, the
* `details.type` cards it mints, and its declared FACE (family / axes / contract / path target / rule
* vocabulary / render hints / policy bits).
*
* SINGLE SOURCE, TWO READERS. Each definition module spreads its row's `face` into the `ToolSpec` it
* hands `defineTool` (`...TOOL_FACES.read`), so the face a tool declares at mount time IS the face
* listed here — there is no second declaration to drift. The effect roster (tool-roster.ts) reads every
* axis off the MOUNTED INSTANCE; the static catalog (`describeToolCatalog()`) reads this table without
* an env or a deps object. The conformance gate (test/tool-catalog-conformance.test.ts) proves the two
* agree for every definition it can instantiate; the catalog completeness gate
* (scripts/verify-tool-catalog.mjs) proves every `defineTool` site in src/ that mints a core-owned name
* has a row here that declares a `family` — a missing declaration is a RED gate naming the file, never a
* silent `"other"`.
*
* LEAF MODULE by design: it imports vocabulary types and one leaf constant module only. Every definition
* module and every policy module that derives a name set from the catalog imports THIS file, so a
* dependency from here back into a tool module would be a load-order cycle with a `const` table in it.
*
* Keyed by DEFINITION identity (`id`), not by name — the full and the read-only shell both answer to
* `Bash`; a catalog predicate counts a name as a member when ANY row under that name matches.
*/
import type { ToolCatalogEntry, ToolFaceDeclaration } from "./tool-face.js";
/** The full shell's contract id — declared here (the leaf) and re-exported by fs-bash.ts. */
export declare const FULL_SHELL_CONTRACT_ID = "core.bash@1";
export declare const READONLY_SHELL_CONTRACT_ID = "core.bash_readonly@1";
/** Wire-name constants for definitions that had none (design/388 A-21: literals become references). */
export declare const TASK_CREATE_TOOL_NAME = "TaskCreate";
export declare const TASK_GET_TOOL_NAME = "TaskGet";
export declare const TASK_UPDATE_TOOL_NAME = "TaskUpdate";
export declare const TASK_LIST_TOOL_NAME = "TaskList";
export declare const TODO_WRITE_TOOL_NAME = "TodoWrite";
export declare const REFRESH_MCP_TOOLS_TOOL_NAME = "RefreshMcpTools";
export declare const ARTIFACT_TOOL_NAME = "Artifact";
/**
* Every row. Order is documentation order (hands → delegation → scaffolds → memory → scheduler → host
* scenarios); nothing reads the order.
*/
export declare const TOOL_CATALOG_ENTRIES: readonly ToolCatalogEntry[];
/**
* `details.type` cards the ENGINE mints outside any tool definition — the protocol channels' result
* cards and the fs boundary refusals (minted by the shared safety module on behalf of every fs tool).
*/
export declare const ENGINE_CARDS: Readonly<Record<string, string>>;
/** The declared face of one definition, by definition id — what a definition module spreads into its spec. */
export declare function toolFace(id: string): ToolFaceDeclaration;
/** Definition-id → face, for the modules that spread one (`...TOOL_FACES.read`). Frozen: a face is data. */
export declare const TOOL_FACES: Readonly<Record<string, ToolFaceDeclaration>>;