import { Repo } from "../api/repo.ts"; import type { Actor } from "../objects/types.ts"; /** Result of an MCP elicitation prompt (subset of the SDK's ElicitResult). */ export interface ElicitOutcome { action: string; content?: Record; } /** Per-call context handed to a handler: the channel to ask the human (elicitation). */ export interface ToolCtx { /** Ask the human to confirm/provide input via MCP elicitation. */ elicit?: (message: string, requestedSchema: Record) => Promise; } export interface ToolDef { name: string; description: string; inputSchema: Record; handler: (repo: Repo, input: Record, ctx?: ToolCtx) => Promise; } export declare function actorOf(input: Record): Actor; /** * Watch for the installed package version drifting away from the one this process booted * with, and report it ONCE when no call is in flight. Dependencies are injected so the * decision is testable without mutating a real package.json. * * Returns null when watching is disabled (no boot version, or a non-positive/NaN interval). */ /** * Append the stale-server notice to an error message. A server running older code fails in * ways that point at the wrong culprit — it cannot read a newer on-disk layout and says * "not an AVCS repo" about a directory the upgraded CLI reads fine. Naming the real cause * on the error itself is what turns that from an hour of debugging into a reconnect. */ export declare function appendStaleNote(message: string, notice: string | null): string; export declare function watchVersionDrift(opts: { bootVersion: string | null; readVersion: () => string | null; intervalMs: number; isBusy: () => boolean; onDrift: (from: string, to: string) => void; }): { stop: () => void; } | null; /** * The `core` profile (Phase 16 M5, docs/18 §M5): the tools the canonical loop actually * uses. A tool schema is a toll every agent pays every session, and the full surface is * mostly noise for an agent doing the standard loop. * * What is deliberately ABSENT: checkpoint.create, sync.push and integration.submit, because * `sync.land` performs all three internally. Advertising them in the small profile would * re-teach the checkpoint dance M2 exists to remove. A test asserts the whole canonical * loop fits inside this list, so "small" can never mean "cannot finish the work". */ export declare const CORE_PROFILE: string[]; /** * Tools to advertise for a profile name. The DEFAULT is everything — a profile is opt-in, * because silently hiding tools from an existing client would break it. An unrecognized * name degrades to the full set rather than to an empty one: a typo should cost tokens, * not capability. */ export declare function toolsForProfile(profile: string | undefined): ToolDef[]; /** The schema advertised to clients: the tool's own inputs plus the universal `cwd` and * `verbose`. Returns a fresh object — the ToolDef's own schema is never mutated. */ export declare function advertisedSchema(t: ToolDef): Record; /** * Run one tool call and render it for the transport (Phase 16 M1.1, docs/18 §1.1). * Exported so the layer is testable without booting the SDK, the same way the handlers are. * * Success keeps its raw shape — only the serialization changes (§2 principle 1). Failure * becomes `{ error, hint?, nextActions? }` so the agent recovers from a list instead of * parsing prose; it is returned with `isError`, not thrown, because a thrown error reaches * the agent as an opaque transport failure and loses the recovery hints entirely. */ export declare function runTool(tool: ToolDef, repo: Repo, args: Record, ctx?: ToolCtx): Promise<{ content: { type: "text"; text: string; }[]; isError?: boolean; }>; /** * Resolve which AVCS repo a tool call targets, returning its `.avcs` root dir. * * Precedence (each candidate is resolved upward via {@link ObjectStore.findRepoRoot}, so a * subdirectory of a repo resolves to the repo): * 1. `AVCS_REPO` — an explicit pin; if set, ONLY this is tried (a pin means a pin). * 2. `callCwd` — the per-call `cwd` argument (one server, many repos). * 3. client workspace roots — what the MCP client advertises via `roots` (the * protocol-blessed way to learn the agent's working dirs; absent for clients that * don't support it). * 4. the server's own `process.cwd()` — last resort. * * Throws with the list of places searched when nothing resolves, so the failure is * actionable rather than a bare "not an AVCS repo". `listRoots` is a callback (not the SDK * server) so this is unit-testable and only invoked when earlier candidates miss. */ export declare function resolveRepoDir(callCwd: string | undefined, listRoots: () => Promise): Promise; export declare const TOOLS: ToolDef[]; /** * Boot the AVCS MCP server on stdio. This is the function the CLI's `avcs mcp` * subcommand and the direct entrypoint below both call. It loads the optional * `@modelcontextprotocol/sdk` lazily so importing this module (e.g. from tests, to * exercise the tool handlers) — and the rest of the CLI — never depends on the SDK. */ export declare function startMcpServer(opts?: { profile?: string; }): Promise; //# sourceMappingURL=server.d.ts.map