@sema-agent/core
Version:
Stateless, task-oriented AI agent core
28 lines (27 loc) • 2.11 kB
TypeScript
import type { ToolSpec } from "./types.js";
/** The first-party plan-review tool's name (design/80 D-B; CC `ExitPlanMode` parity). Reserved when
* `TaskSpec.enablePlanMode` is set. */
export declare const PRESENT_PLAN_TOOL_NAME = "ExitPlanMode";
/** design/108 — the first-party "enter plan mode" tool's name (CC `EnterPlanMode` parity). Mounted (alongside
* `present_plan`) when `TaskSpec.enablePlanMode` is set, so the model can self-impose read-only plan mode. */
export declare const ENTER_PLAN_MODE_TOOL_NAME = "EnterPlanMode";
/**
* design/108 — the first-party `enter_plan_mode` tool (CC `EnterPlanMode` parity). A THIN composition over the
* general `ctx.enterPlanMode()` primitive: the model calls it to self-impose read-only plan mode for the rest of
* THIS run. `effect:"read"` (it grants nothing — it RESTRICTS). `executionMode:"sequential"` so that in a batch
* like `[enter_plan_mode, edit_file]` the whole batch runs sequentially (agent-loop `hasSequentialToolCall`),
* making enter execute (set the flag) BEFORE the sibling edit is prepared+gated — closing the same-batch window.
* Exit is via `present_plan` (→ plan_review → human approve-resume), not by this tool.
*/
export declare function createEnterPlanModeTool(enterPlanMode: () => Promise<void> | void): ToolSpec;
/**
* design/80 D-B — the first-party `present_plan` tool (CC `ExitPlanMode` parity). A THIN composition over the
* general `ctx.requestReview()` primitive: the model calls it with a plan; the tool returns the plan as its
* content (so it reaches the reviewer via the transcript — the plan is NOT stored on the gate, design/76 §9),
* and signals the engine to pause with a `plan_review` checkpoint at the next safe turn boundary. The tool has
* NO side effect (`effect:"read"`); the actual pause/mint is the engine's, gated on a wired `checkpointStore`.
* `requestReview` is the prepare-task closure (the same primitive `ctx.requestReview` exposes to caller tools).
*/
export declare function createPresentPlanTool(requestReview: (opts?: {
reason?: string;
}) => void): ToolSpec;