/** * The three agent-facing canvas tools. * * Design: `docs/canvas-extensions-design.md` §11.5. Copilot names its own shape in * the SDK types — `list_canvas_capabilities` to discover, `invoke_canvas_action` to * invoke — and hoocode mirrors it, for its own reason as well as fidelity: * `AGENTS.md` budgets the prompt at ~4,140 tokens with ~2,710 of it tool schemas, * and every active tool's schema is re-sent on every request. One tool per open * action would make that surface grow with how many canvases are open. Fixed tools * keep it flat. * * `reload_canvas` is hoocode's, not Copilot's, and it is what makes a canvas * something the agent can *iterate on* rather than only drive: an edit to * `extension.mjs` is invisible until the child forked from the old bytes is * replaced. See {@link createReloadTool} for why reloading is the agent's to do * while opening is not. * * **There is deliberately no "open a canvas" tool.** Opening forks a process and * binds a listening socket; that is a person's decision, gated by workspace trust * (§5). The agent drives a surface a human has already opened. This also keeps the * injection surface flat: a poisoned issue title rendered into a canvas can at most * cause an action on an instance the person chose to open. * * These are optional tools, created only when canvas support is available and at * least one canvas is open — so a repository without canvases pays nothing. */ import type { CanvasRegistry } from "../canvas/registry.js"; import { type ToolDefinition } from "../extensions/types.js"; /** Tool name for capability discovery, matching Copilot's. */ export declare const LIST_CANVAS_CAPABILITIES_TOOL_NAME = "list_canvas_capabilities"; /** Tool name for action invocation, matching Copilot's. */ export declare const INVOKE_CANVAS_ACTION_TOOL_NAME = "invoke_canvas_action"; /** * Tool name for re-forking an edited extension. hoocode's own — Copilot has no * equivalent because its `/create-canvas` flow reloads the panel itself. */ export declare const RELOAD_CANVAS_TOOL_NAME = "reload_canvas"; /** * Ceiling on a serialized action result, in characters. * * Whatever an action returns lands in the model's context window. * `pr-artifact-explorer` truncates its own payloads (`entries.slice(0, 200)`), but * nothing in the contract obliges a canvas to, so the host caps it too. */ export declare const CANVAS_RESULT_MAX_CHARS = 8000; /** What `list_canvas_capabilities` reports. */ export interface CanvasCapabilitiesDetails { instances: number; actions: number; } /** What `reload_canvas` reports. */ export interface CanvasReloadDetails { extensionId: string; reopened: number; dropped: number; actionsAdded: number; actionsRemoved: number; actionsChanged: number; } /** What `invoke_canvas_action` reports. */ export interface CanvasInvokeDetails { instanceId: string; action: string; truncated: boolean; } /** * The canvas tools, or none. * * Returns an empty array while nothing is open, so the two schemas are absent from * the prompt in the overwhelmingly common case of a repository with no canvases — * the same reason `registry.activeActions()` is empty until an instance exists * (§7). Callers re-derive this when the open set changes. */ export declare function createCanvasToolDefinitions(registry: CanvasRegistry): ToolDefinition[]; //# sourceMappingURL=canvas.d.ts.map