/** * Phase 3 of agent-namespace — side-effect-free contract helpers. * * Tests and the `edit_agent` tool import these helpers without * pulling in the MCP server module (`./index.ts`) — that module * registers tools and connects a stdio transport at module load, * so importing it just to grab a small helper would attach a * server transport in test processes and could emit log lines on * the test stdout. This file is import-only: no top-level * statements with side effects. */ import { z } from "zod"; /** * load_agent's input schema. Defining `ref` with a custom * `required_error` makes the zod failure message tell the AI to * pass `{ref: "/"}` instead of the generic * "Required" string — important because the AI's fallback heuristic * on a generic error is to retry with the same (broken) call shape. */ export declare const loadAgentSchema: { ref: z.ZodString; confirm_large: z.ZodOptional; }; /** * Shared validation step for any load_agent-style entry point. * Returns `{ok: true, ref}` on success (canonicalized ref) OR an * MCP-shaped error response that the caller returns verbatim. */ export declare function validateLoadAgentRef(ref: string): { ok: true; ref: string; } | { ok: false; response: { content: { type: "text"; text: string; }[]; isError: true; }; }; /** * Format a `RequiresUsernameError` (translated from a 403 + * `requires_username` registry response by the api-client) into an * MCP content block for the load_agent handler. The DoD requires * the response to (a) name the claim URL, (b) instruct the AI to * surface it, and (c) NEVER write to stdout — that would corrupt * the JSON-RPC stream. */ export declare function formatLoadAgentRequiresUsername(ref: string, claimUrl: string): { content: { type: "text"; text: string; }[]; isError: true; }; /** * Identity cross-check for a registry response. Returns `null` on * success or an MCP-shaped error response when `agent.canonicalRef` * is missing or doesn't match the requested ref. Mirrors the * cursell-add / cursell-install / cursell-verify defenses; T3 * (case-fold parity) requires the canonical ref to be stable * end-to-end. */ export declare function checkRegistryRefMatch(requestedRef: string, agent: { canonicalRef?: string | null; }, toolLabel: "load" | "edit"): { content: { type: "text"; text: string; }[]; isError: true; } | null;