import type { WorkspaceSource } from '../compiler.js'; import type { ToolWorkspace } from './workspace.js'; import { type Branding } from '../branding.js'; /** * The tool surface, once (ADR 0156). The stdio adapter and a hosted server * publish these rows; `runTool` answers a call over a store, and both * dispatch to it, so an agent connected over stdio and one connected over * the network read the same names, the same schemas, the same sentences, * and get the same text back. */ export declare const TOOL_VERBS: readonly ['ask', 'design', 'apply', 'check', 'reconcile', 'export']; export type ToolVerb = (typeof TOOL_VERBS)[number]; /** * A published name: the prefix a host chose, an underscore, the verb. The * prefix is branding (#546, ADR 0158); the verb is the contract, and * `runTool` dispatches on it alone. */ export type ToolNameFor

= `${P}_${ToolVerb}`; export type ToolName = ToolNameFor; declare const YARRAMATE_PREFIX = "yarramate"; /** The verb behind a name of any prefix; `undefined` for a name that is not a tool's. */ export declare const toolVerbOf: (name: string) => ToolVerb | undefined; /** * One row per tool. Generic over the name so a host that adds tools of its * own builds `[...TOOL_CATALOGUE, own]` as `ToolDefinition[]` with * no cast; `runTool` serves `ToolName` only. */ export interface ToolDefinition { readonly name: N; /** Ends with LOOP. Says nothing about `workspace` or `out`: those sentences are the stdio adapter's. */ readonly description: string; /** JSON Schema for the arguments, without the stdio-only properties. */ readonly inputSchema: Record; readonly access: 'read' | 'write'; /** * Whether `runTool` can serve it. `reconcile` compares the record with * evidence it evaluates against a repository, so it is `stdio-only`; * `unavailable` is the one line a hosted tool list shows for it. */ readonly served: 'everywhere' | 'stdio-only'; readonly unavailable?: string; } /** * The loop, in two sentences, on every tool. A desktop-app agent connecting * for the first time has never seen the skill file; the tool list is the * only place it learns that design asks, apply lands, and design asks again. */ export declare const loopFor: (branding?: Branding) => string; export declare const LOOP: string; /** * The `initialize` instructions a server publishes, without the stdio * adapter's sentence about `workspace`: the record, the one write, the loop. */ export declare const instructionsFor: (branding?: Branding) => string; /** * The two argument properties that exist only where a filesystem does: * `workspace` (which manifest) and `out` (where export writes). The stdio * adapter spreads these into the rows it publishes; a hosted server never * sees them. Kept beside the catalogue so the two adapters agree on the * words. */ export declare const STDIO_PROPERTIES: Readonly>>; /** * The rows for a host's branding: the prefix in every name, in the loop * sentence and wherever a description names a sibling tool. Unbranded, or * branded without a `toolPrefix`, this is `TOOL_CATALOGUE` row for row. */ export declare const toolCatalogueFor: (branding?: Branding) => readonly ToolDefinition[]; export declare const TOOL_CATALOGUE: readonly ToolDefinition[]; export interface ToolFile { /** Relative, `/`-separated, as the CLI would write it under `out`. */ readonly path: string; readonly contentType: string; /** Exactly one of the two. */ readonly text?: string; readonly bytes?: Uint8Array; } /** * What a tool call returns to an agent. `text` is the answer for every tool * but the binary and multi-file exports (xlsx, likec4): those answer * `files`, and an MCP reply has nowhere to put bytes, so the host stores * them and answers with an address; the stdio adapter writes them where * `out` says. `text` is still set on a files outcome: one line naming the * files, for a caller that can do nothing else with them. */ export type ToolOutcome = { readonly kind: 'text'; readonly ok: boolean; /** The JSON document for ask, design, apply and check; the deliverable for export. */ readonly text: string; /** The typed result behind `text`, for a caller that wants it. */ readonly result?: unknown; } | { readonly kind: 'files'; readonly ok: true; readonly text: string; readonly files: readonly ToolFile[]; readonly result?: unknown; }; /** * A tool call over a store: parses `input` against the row's schema, calls * the function the row names, renders exactly the text the stdio adapter * returns for the same call. `yarramate_reconcile` answers `ok: false` * with the row's `unavailable` line. * * `name` may carry any prefix (#546): the verb after the last underscore is * what dispatches, and a refusal names the tool by the name it was called * by, so an agent reading `acme_export` in its tool list reads `acme_export` * in the refusal. A name with no tool verb is refused, never thrown. */ export declare const runTool: (name: string, input: Record, workspace: ToolWorkspace) => ToolOutcome; /** The files a text kind would write under `out`, for a caller with a filesystem. */ export declare const filesOf: (outcome: ToolOutcome) => readonly ToolFile[]; export type { WorkspaceSource };