import { type ReceiptFault } from "./mods/kernel/receive.js";
import type { CredentialRef } from "@sema-agent/primitives";
import type { ToolContentOrigin, ToolEffect } from "./tool-spec.js";
import type { ToolFamily, ToolHostTarget, ToolPathTarget, ToolRenderHints, ToolRuleFace } from "./tool-face.js";
/** Definition of an MCP server to connect to for the duration of one task, then discard. */
export interface McpServerSpec {
    /** Stable name; tool names are namespaced as `mcp__<server>__<tool>` (the protocol prefix, then this name as the peer segment) to avoid collisions. */
    name: string;
    /**
     * Where this declaration CAME FROM, in the declaring side's own words (a shell's `plugin` / `user` /
     * `project` / `local` config tiers, or anything else the deployment finds useful). Core reads
     * nothing off it: it is echoed verbatim (single-line, length-bounded) onto the wiring manifest's
     * per-server read face (`WiringManifest.mcp[].source`) so a consumer can group servers by their
     * declaring tier without keeping a side table keyed on names. Optional; absent stays absent.
     */
    source?: string;
    /**
     * Who the server is: the whole start command (stdio) or endpoint (http), and at most one opaque credential reference
     * (`credentials`, read by the one reader `readCredentialRef` at every entrance — an unknown kind refuses the entry with
     * `config.credential_ref_invalid`; the engine resolves nothing). A declaration carries no value: the pieces a request
     * carries — an http request's credential headers, a stdio child's environment — are answered per send by the deployment's
     * peer seat ({@link RunnerDeps.peerSeat}). A `credentials` reference with no seat wired refuses the entry
     * (`config.peer_seat_missing`); a declaration carrying the retired value members `headers` / `env` is refused at every
     * entrance (`config.credential_in_declaration`). `host`: the host supplies the pipe itself — the leg's host seat of this
     * declaration's `name` (`RunInternals.mcpHostSeats`, mcp-host-seat.ts) hands one MCP transport per dial, and the server behind
     * it answers the whole protocol (its handshake, instructions and resources included); the transport has no member beyond
     * its kind (a host seat carries its own pieces, so a reference or a principal header has nothing to ride), and a server mounted
     * this way cannot opt in to {@link elicitation} — both refused at every entrance (`config.invalid_argument`). It never enters
     * the run tree's connection pool: its pipe is the leg's own.
     */
    transport: {
        kind: "stdio";
        command: string;
        args?: string[];
        credentials?: CredentialRef;
    } | {
        kind: "host";
    } | {
        kind: "http";
        /** The server's endpoint. A request that carries pieces the peer seat answers or the principal header goes only to this
         *  url, over `https:` or plain `http:` to this machine (`config.protocol_plaintext_credentials` otherwise, refused at the
         *  request that would carry them — the dial's own requests first). */
        url: string;
        credentials?: CredentialRef;
        /**
         * Per-task **end-user principal** header (design/62). When set, the Runner injects the running task's
         * authenticated {@link TaskSpec.principal} as this header (e.g. `"X-Agent-Principal"`) on every call to
         * this server's tools, so the MCP server can enforce per-user RBAC. Absent {@link TaskSpec.principal}
         * ⇒ the header is **not** sent (the MCP server must default to deny/public, never admin). A header the
         * peer seat answers under the same name in any case is the seat's fault, and that request is not sent
         * (`config.protocol_header_collision`, header names being case-insensitive). The principal is Runner-held and the
         * model/worker can neither read nor set it (it is not a tool argument) — see {@link TaskSpec.principal}. The name is
         * neither the engine's own `MCP_ASSERTION_HEADER` nor a name the MCP transport writes itself (any case): naming one
         * refuses this server at its dial.
         */
        principalHeader?: string;
    };
    /** Optional allowlist of tool names to expose (others are dropped). ORTHOGONAL to
     *  {@link contentOrigin} and usefully paired with it (design/378 §2): the class declaration follows
     *  the server's roster, so a high-assurance deployment that wants a CLOSED tool set writes both —
     *  a tool a later refresh adds then lands outside this list and is simply not mounted. Existing
     *  semantics, no new mechanism; the refresh receipt still names every added tool either way. */
    allowTools?: string[];
    /**
     * design/99 §E23 — opt in to INBOUND elicitation for THIS server: when `true` AND a {@link RunnerDeps.onElicit}
     * seam is wired, core advertises the `elicitation` capability to this server and registers a handler, so the
     * server may send an `elicitation/create` request to ask the END USER for input mid-tool-call. **Default OFF
     * (fail-closed)**: never advertise unless explicitly wired, so a untrusted/over-eager server cannot pull a human
     * into the loop. v1 is LIVE-ONLY — `onElicit` answers synchronously on the open connection (no durable
     * suspend; a durable/cross-replica elicitation needs the deferred E22 longer-lived connection).
     */
    elicitation?: boolean;
    /**
     * Caller-side per-tool safety-axis overrides, keyed by the server's REMOTE (un-namespaced) tool name. The
     * CALLER is the trust root: unlike a server's self-declared annotations (which may only TIGHTEN), a caller
     * override is AUTHORITATIVE and may LOWER an effect (vouch a tool is `read`/`idempotent`) as well as raise it
     * (`egress` / irreversible). This is the ONLY trusted way to drop an MCP tool below the fail-closed `write`
     * default (design F). Folds over the server hints in prepare-task (caller > server hint > fail-closed write).
     * `boundaryFlow: "engine"` vouches that a call's effect stays inside the engine: the tool's roster row states no boundary legs
     * (`boundaryLegs: []`) instead of the legs its effect implies — it needs `egress: false` beside it (refused otherwise).
     *
     * A DIFFERENT AXIS from {@link contentOrigin}: this one is about what a call DOES (repeat-safety,
     * blast radius, reversibility — it feeds the approval gate); the content class is about what a call
     * BRINGS BACK (memory-write governance, no gate/policy/roster effect). Neither implies the other —
     * a read-only tool can return third-party text, and a deployment's own writer brings back nothing
     * external — so vouching on one axis never quietly vouches on the other.
     *
     * THE SHAPE IS JUDGED, NOT TRUSTED: {@link readToolAxes} is the one reader of this declaration (an A2A peer's `toolAxes` is read by it too). The
     * preparation door runs it on every entry, and a declaration it cannot read refuses the whole prepare
     * (`config.invalid_argument`) — one bad tool refuses the entry, a bad key is never dropped and a bad word
     * never defaults, because a caller's safety axis that silently reads as absent is a trust root that is not
     * in force. The materialization entrance (`materializeMcpTools`, which the no-run probe dials through) asks
     * it again per server: a declaration it cannot read fails THAT server's dial. A host that assembles this
     * field from JSON (a console, a deployment intake) asks the same reader at its own door, so both sides
     * answer one question one way.
     */
    toolAxes?: Record<string, {
        effect?: ToolEffect;
        egress?: boolean;
        irreversibility?: "always" | "never";
        boundaryFlow?: "engine";
    }>;
    /**
     * design/388 §1.1 / §2.7 — the OPTIONAL per-tool FACE overlay for this server's tools (keyed by the server's
     * RAW tool name, like {@link allowTools} / {@link toolAxes}): a deployment lets an MCP tool enter a specialised
     * approval card, be confirmed by path, carry a display name / summary, or narrow its rule vocabulary (a `hostTarget` is
     * refused here: host rules are written for the engine's fetch tool name only, which no MCP tool answers to). TRUSTED
     * (the deployment writes it). It is read once by `readToolFaces` at the preparation door and at `materializeMcpTools`: a
     * declaration that does not fit on its own (a member the types do not have, a member of the wrong kind, a word outside a
     * closed table, a reserved approval card, an empty tool name) refuses the entry under `config.tool_face_invalid` — the whole
     * prepare at the door. What only the schema can say is judged at every listing (first mount and every refresh): a
     * `pathTarget.param` that is not a top-level property, an `approvalCard` whose keys the schema lacks, a `ruleFace` naming a
     * non-scalar key ⇒ that tool is NOT mounted and the leg announces `config.tool_face_invalid` once; a key naming a tool the
     * listing does not carry announces `config.tool_face_undeclared` once. Applied whole or not at all.
     */
    toolFaces?: Record<string, {
        family?: ToolFamily;
        pathTarget?: ToolPathTarget;
        hostTarget?: ToolHostTarget;
        renderHints?: ToolRenderHints;
        ruleFace?: ToolRuleFace;
    }>;
    /**
     * design/378 — declare {@link ToolSpec.contentOrigin} on behalf of THIS SERVER'S ENTIRE TOOL SET
     * (tools a mid-task refresh adds included), with the same authority and the same responsibility a
     * directly-mounted host tool's own declaration carries.
     *
     * WHY THE SEAT EXISTS. Without it the class keys on the MOUNT SHAPE rather than on lineage: a tool
     * the deployment wrote and runs itself is structurally `"external"` the moment it arrives over the
     * MCP protocol namespace, so every call marks the session's memory externally exposed. The
     * per-name channels cannot express the fact either — {@link import("./memory.js").MemorySpecInput.trustedTools}
     * is a per-REQUEST allowlist keyed on the MINTED name (the host would have to predict the charset
     * normalization) whose own definition is "the exception channel for UNDECLARED tools", and it says
     * nothing about tools the server adds later.
     *
     * THIS IS A TRUST DECLARATION, not a routing hint. Use it only for servers inside the deployment's
     * trust boundary — a process, socket or service the deployment itself runs. Declaring a THIRD-PARTY
     * server means treating its output as content the deployment wrote: the class names are
     * BOUNDARY-relative, never topological, so neither the transport kind nor the address is evidence
     * of lineage (a stdio child can be an untrusted package; a loopback URL can be your own service) and
     * core deliberately does not gate on either. The declaration covers THE PEER THIS ENTRY CONNECTS TO
     * — authenticating that peer (socket permissions, credentials) is the host's mounting duty.
     *
     * SEMANTICS. `"local"` ⇒ invocations no longer mark this session's memory; `"execution"` ⇒ the same,
     * except that {@link import("./memory.js").MemorySpecInput.execIsExternalContent} can still upgrade
     * the class for a strict deployment (which is why this seat takes the three-value vocabulary and not
     * a single "mine" flag — an execution-shaped tool mounted over MCP must stay inside that knob's
     * reach); `"external"` is an explicit PIN, and pins are not no-ops — a declaration beats the
     * `trustedTools` allowlist, so writing it forecloses the per-name exemption for this server's tools.
     * ABSENT ⇒ the pre-378 behavior byte for byte: the protocol namespace classifies the tools
     * `"external"` (fail-closed). A value outside the vocabulary is refused at the preparation door
     * (`config.mcp_content_class`), never folded to a class.
     *
     * COVERAGE, stated honestly: the class rides this server's own mounted tools. The cross-server
     * resource faces (ListMcpResourcesTool / ReadMcpResourceTool / ReadMcpResourceDirTool) aggregate
     * over every connected server in one call, so they stay `"external"` and still mark — over-marking,
     * the safe direction. A delegated child's pool is a separate static declaration surface
     * ({@link ToolSpec.agentToolPool} entries carry their own `contentOrigin`): a deployment handing
     * this server's tools to children mirrors the value there, and not mirroring it over-marks.
     *
     * TRUST SOURCE — a DEPLOYMENT-plane key. It redefines where the trust boundary runs, which puts it
     * on the same authority plane as {@link RunnerDeps} wiring, not on the request plane. Core sees one
     * `TaskSpec` and cannot tell a deployment-baseline entry from one a request supplied, so any
     * assembly layer that accepts REQUEST-side MCP entries must reject or strip this key from them:
     * "allowed to mount a server" is not "allowed to redefine the deployment's trust boundary", and a
     * caller-supplied `"local"` would otherwise be self-authorization around the session mark. A
     * single-tenant superuser surface (a host reading its own `--mcp-config` file) IS the deployment
     * plane and needs no such gate.
     */
    contentOrigin?: ToolContentOrigin;
    /**
     * The host's identity of THIS MOUNT of the server — a non-empty string (≤ 128 characters) the host
     * minted from the declaration; the engine computes nothing from it and reads nothing off it. When present
     * it rides the revocation question (`ProtocolRevocationTarget.fingerprint` of `RunnerDeps.protocolRevocations`),
     * so the host can tell one mount generation of a server from a re-declared one under the same name. Absent ⇒
     * the question carries the name alone. Any other value refuses this server at its dial
     * (`config.mcp_fingerprint_invalid`).
     */
    fingerprint?: string;
    /**
     * THIS server's startup bound, in whole milliseconds: the handshake (connect + initialize) and the initial tool listing each carry it
     * (the listing as one walk, however many pages). One knob, three seats, read by one function in this order — this member, else the
     * process-level `MCP_TIMEOUT`, else 30 000 ms — so a server that hangs at startup is cut on its own clock while its siblings keep the
     * deployment's. A server cut at startup is remembered by the session as a failed attempt and not dialed again by its later messages. It bounds only that startup phase: a call's own timeout (`MCP_TOOL_TIMEOUT`) is untouched.
     *
     * The range is the one every MCP millisecond bound keeps, 1 000 to 2 147 483 647 (a larger delay is silently rewritten to 1 ms by the
     * timer, a smaller one is a unit slip). Unlike the environment seat — a string a process may clamp and announce — a declaration is typed
     * data, so anything else (a string, a fraction, zero, a negative, NaN, `null`, a number outside the range) refuses THIS server at its
     * dial (`config.mcp_startup_timeout_invalid`; siblings mount) rather than being clamped or read as the default.
     *
     * The bound a dial runs under (this member, else the environment seat, else the default) is part of a pooled connection's identity: mounts under one
     * bound lease ONE connection, mounts under different bounds dial their own — so a mount is never held by another mount's clock.
     * The no-run probe has no clock of its own: each startup phase carries this same bound (a caller's `timeoutMs` is an overall ceiling beside it).
     */
    startupTimeoutMs?: number;
    /**
     * Opt in to the sending leg's OWN session id on this server's requests: with a key declared, every `tools/call` and `resources/read` the
     * engine sends this server carries `params._meta[key]` = that leg's `sessionId` (the id its events carry), over stdio and Streamable
     * HTTP alike, so a connector can keep state per (principal, session). Absent ⇒ nothing is sent (a session id leaving the process is a
     * correlation the deployment chooses). A delegated child is another session: its own calls carry its own id, and the engine does not
     * guess a root — the principal ({@link TaskSpec.principal}) is shared by every session of one user, so it is not a tree key either.
     *
     * The key is judged once by {@link import("./mcp-call-meta.js").judgeSessionMetaKey} where the declaration is judged (the preparation door
     * and `materializeMcpTools`): a non-string, an empty or over-long one, one outside the MCP `_meta` key-name format, one in a prefix MCP
     * reserves (a prefix whose second label is `modelcontextprotocol` or `mcp`), `progressToken` (the SDK's own) or a key in the engine's
     * `sema/` namespace refuses the entry with
     * `config.invalid_argument` naming the key — never dropped, never defaulted. A dial with no leg (the library entrance, the no-run probe)
     * has no session, so nothing rides.
     */
    sessionMetaKey?: string;
    /**
     * Opt in to WHO IS CALLING on this server's requests: with `true`, every `tools/call`, `resources/read` and `prompts/get` the engine
     * sends this server for a leg carries `params._meta["sema/caller"]` = `{ taskId, runId, rootSessionId, parentTaskId? }`
     * ({@link import("./mcp-call-meta.js").McpCaller}) — the leg's task id (the value `TaskResult.taskId` and `task_progress.taskId` carry
     * on that run), this run's id (new on every run), the delegation tree's root session (the leg's own on a top-level leg) and, on a leg
     * spawned under a known task, the spawner's task id (`task_progress.parentTaskId`). One record per leg and run, built at its prepare, so
     * every call and fetch of the run — every attempt of one call included — carries the same; two legs on one pooled connection each send
     * their own. No principal, path or model rides it. Session ids do, with or without {@link sessionMetaKey}: `taskId` is the leg's own
     * session id wherever that is its task id (a foreground child, a workflow member or a top-level leg handed no `taskId` that keeps no
     * member ledger — one that keeps one runs as the task id the engine minted for it, `rl-…`), and
     * `rootSessionId` is the tree root's session (a top-level leg's own) — a deployment that must not let a server learn any session id does
     * not declare this for it. Absent or `false` ⇒ nothing is sent.
     *
     * Judged once by {@link import("./mcp-call-meta.js").judgeCallerMeta} where the declaration is judged (the preparation door and
     * `materializeMcpTools`): any value other than `true` / `false` (a string, a number, `null`, an object) refuses the entry with
     * `config.invalid_argument` — never read as either. A dial with no leg (the library entrance, the no-run probe) has no caller, so
     * nothing rides there.
     */
    callerMeta?: boolean;
}
/** The transport kinds a declaration names, one list: the dial reads a kind against it, so a word outside it is no kind at all. */
export declare const MCP_TRANSPORT_KINDS: readonly ["stdio", "http", "host"];
export type McpTransportKind = McpServerSpec["transport"]["kind"];
/** The one reading of a declaration's transport kind: a word of {@link MCP_TRANSPORT_KINDS}, or `undefined` for anything else (no transport,
 *  not a record, a word outside the list, a member that throws) — total, so a reader never fails on a declaration the dial would refuse. */
export declare function transportKindOf(spec: McpServerSpec): McpTransportKind | undefined;
/**
 * The surfaces that declare `toolAxes`, which {@link readToolAxes} names its reading by: an MCP server's keys are the server's
 * remote TOOL names, an A2A peer's keys are the peer's remote SKILL ids.
 */
export type ToolAxesSurface = "mcp" | "a2a";
/**
 * Per surface, the declaration's type there — the A2A peer's is the MCP server's less its lowering values. {@link readToolAxes} answers
 * in the type of the surface it read for ({@link ToolAxesRead}, indexed by the surface: a surface without a row here does not compile),
 * so what it judged on `"a2a"` is an `A2aServerSpec.toolAxes` as it stands.
 */
type ToolAxesOn = {
    mcp: NonNullable<McpServerSpec["toolAxes"]>;
    a2a: NonNullable<A2aServerSpec["toolAxes"]>;
};
/**
 * {@link readToolAxes}'s answer for the surface `At`. `ok: true` carries the declaration as a PLAIN COPY the reader built from
 * what it judged (never the caller's own object), in that surface's type — read for `"a2a"`, it is an `A2aServerSpec.toolAxes`;
 * `toolAxes` is absent when the entry declares nothing — no key at all, or only empty per-tool objects (which the engine reads the
 * same as no declaration). `ok: false` carries one sentence naming the tool (or skill) and the member that did not fit, never a
 * value. Without an argument it is the MCP server's answer, the widest: an A2A peer's answer is assignable to it.
 */
export type ToolAxesRead<At extends ToolAxesSurface = "mcp"> = {
    ok: true;
    toolAxes?: ToolAxesOn[At];
} | {
    ok: false;
    problem: string;
};
/**
 * Where in a declaration a sentence points, from `base`: a list index in brackets, a member name after a dot — the declaration's own
 * member names (`words`, the engine's words) as written, any other key in the caller's-text shape ({@link callerText}). Bounded: no key is
 * added once the path runs past 120 characters, and a path cut short ends in the truncation mark, so a deep declaration never makes a long
 * sentence. Every judge of a declaration renders its paths here.
 */
export declare function declarationPath(path: readonly (string | number)[], words: ReadonlySet<string>, base?: string): string;
export declare const DECLARATION_ENTRY_WORDS: ReadonlySet<string>;
/**
 * Where a declaration stops being one: the path from the declaration's root — a list index as a number, a member name as a string — and
 * the clause that says what is there ("it contains itself; …"): a kind and a remedy, never a value the declarer wrote.
 */
export interface DeclarationFault {
    readonly path: readonly (string | number)[];
    readonly problem: string;
}
/** {@link receiveDeclaration}'s answer: the engine's own frozen copy, or where and why the declaration could not be received. */
export type DeclarationRead = {
    readonly ok: true;
    readonly value: unknown;
} | {
    readonly ok: false;
    readonly fault: DeclarationFault;
};
/**
 * A receipt's refusal of a declaration (or of the list that carries declarations), said as a declaration refusal says it. The receipt's
 * path does not say which kind of container each name came from, so a segment of digits alone is read as a list index.
 */
export declare function declarationFaultOf(fault: ReceiptFault): DeclarationFault;
/** What a declaration's own type fixes at one path, beyond being plain data: a string there. */
export interface DeclarationPathRule {
    readonly path: readonly string[];
    readonly holds: "a string";
    /** The member must be there (a declaration with no value at the path is refused, as one with a value of another kind is). */
    readonly required?: true;
}
/**
 * Per surface, every path its declaration's type fixes beyond plain data — the declarer's `name` (a string, always there). A declaration
 * carries no record of values (its credential reference is judged by its own reader, the retired value members are refused by name —
 * both after this receipt, src/core/peer-seat.ts). A path that is not its surface's (an A2A peer's `transport`) is not judged by another
 * surface's row: it is a member the surface does not read.
 */
export declare const DECLARATION_PATH_RULES: Readonly<Record<ToolAxesSurface, readonly DeclarationPathRule[]>>;
/** The rules of a declaration that fixes no path beyond plain data and lists of names (a `toolAxes` record, a lock declaration): the one
 *  empty table, passed on purpose — {@link receiveDeclaration} takes its rules as an argument and refuses an absent one. */
export declare const NO_DECLARATION_PATH_RULES: readonly DeclarationPathRule[];
/**
 * The one reading of a declaration a caller hands the engine — an MCP server's or an A2A peer's entry (the snapshot), a `toolAxes`
 * record ({@link readToolAxes}), a lock declaration: the engine's one receipt of a caller's object in its declaration mode, so the
 * value is plain data held to the engine's one depth ({@link MODS_VALUE_DEPTH} levels below it) and every own member is read once, then, when the copy is a record, the declaration's own
 * vocabulary over the copy (a list holds names; no member is named `__proto__`; each path `rules` names holds what its rule says — an
 * entry's rules are its surface's {@link DECLARATION_PATH_RULES}). The copy is the answer — the caller's object is never handed on and
 * never read again. A copy that is not a record is answered as it is, for the reader that expected a record to word.
 *
 * `rules` is required: a surface's {@link DECLARATION_PATH_RULES} row, or an empty list ({@link NO_DECLARATION_PATH_RULES} is the engine's
 * own) for a declaration that fixes no path. A value that is not a list (an absent one — what an `at` outside the surfaces indexes to — `null`, a string, an inherited
 * member of the table) is a caller's mistake about which declaration it holds, refused loudly (`config.invalid_argument`) rather than
 * read as "no path rule", which would judge the declaration by less than its surface fixes.
 */
export declare function receiveDeclaration(declared: unknown, rules: readonly DeclarationPathRule[]): DeclarationRead;
/**
 * The per-tool declarations a spec carries as ONE record keyed by the remote tool (or skill) name — what each is called in a
 * sentence about it. Every reader of such a record ({@link readToolAxes}, `readToolFaces`) opens it through
 * {@link receivePerToolDeclaration} and words a refusal through the two sentence functions below, so the one receipt, the one
 * fault vocabulary and the one sentence shape are not written twice.
 */
declare const PER_TOOL_DECLARATIONS: {
    readonly toolAxes: {
        readonly plural: "axes";
        readonly singular: "axis";
    };
    readonly toolFaces: {
        readonly plural: "faces";
        readonly singular: "face";
    };
};
type PerToolDeclaration = keyof typeof PER_TOOL_DECLARATIONS;
/** {@link receivePerToolDeclaration}'s answer: the receipt's copy as a record keyed by name, or the one sentence that says why not. */
type PerToolDeclarationRead = {
    readonly ok: true;
    readonly perTool: Readonly<Record<string, unknown>>;
} | {
    readonly ok: false;
    readonly problem: string;
};
/**
 * A per-tool declaration's receipt: {@link receiveDeclaration} (plain data held to the engine's one depth, every own member read once,
 * lists of names, no `__proto__`), then the copy must be a record of names. A refusal points at the tool (or skill) and the member where
 * reading stopped in the engine's words — the declaration's member names (`words`), a list index — and shows the caller's own keys and
 * values in the one caller's-text shape ({@link callerText}). `unit` is what the keys are called (`tool` / `skill`).
 */
export declare function receivePerToolDeclaration(declared: unknown, field: PerToolDeclaration, unit: string, words: ReadonlySet<string>): PerToolDeclarationRead;
/** The sentence for one tool's (or skill's) declaration that does not fit: `detail` says which member and why. The tool's name is the
 *  caller's text ({@link callerText}) — its mark and length, never the text — so two names of one length are told apart by `at`, the
 *  entry's place among the declaration's names (no text of the caller's in it): `index` counts from 0 in the order the engine reads
 *  the names, `of` is how many the declaration holds. The readers that hold the record say it, and it leads the sentence, ahead of the
 *  bound that cuts a refusal's tail. `at` is absent only where the engine holds no record to count in — a declaration the receipt itself
 *  refused ({@link receivePerToolDeclaration}'s refusal). */
export declare function perToolEntryRefusal(field: PerToolDeclaration, unit: string, key: string, detail: string, at?: {
    readonly index: number;
    readonly of: number;
}): string;
/** The member names of one tool's axes ({@link TOOL_AXIS_MEMBERS}): the words a `toolAxes` refusal's member path spells. */
export declare const TOOL_AXIS_WORDS: ReadonlySet<string>;
/** The sentence for a per-tool declaration that names a tool (or skill) with an empty name. */
export declare function perToolEmptyName(field: PerToolDeclaration, unit: string): string;
/**
 * The one reader of a raw `toolAxes` declaration — {@link McpServerSpec.toolAxes} and {@link A2aServerSpec.toolAxes} are the same
 * declaration, and the engine's preparation door, its materialization of an MCP server and of an A2A peer, and every host that
 * assembles the field from JSON ask this same function. `at` names the surface the declaration sits on, because that decides what its
 * keys are called in the sentence: `"mcp"` — the server's remote tools; `"a2a"` — the peer's remote skills. Absent ⇒ `{ ok: true }`
 * (nothing declared). Anything else must be an object of per-tool objects whose members are exactly `effect` /
 * `egress` / `irreversibility` / `boundaryFlow` with legal values; a declaration of any other shape, an empty tool name, an
 * unknown member, a word outside the vocabulary or a non-boolean `egress` on ANY one tool refuses the whole
 * declaration (`ok: false`) — the good tools are not kept and nothing is defaulted, since a caller axis is
 * two-way (it can vouch a tool down as well as mark it up) and a silently lost half is a trust root that is
 * not in force. The refusal names the entry in the caller's-text shape (its mark and length) and by its place among the declaration's
 * entries (`entry 2 of 3`, in the order the engine reads them), so two names of one length are told apart without showing any text.
 * `boundaryFlow: "engine"` (the call's effect stays inside the engine — the tool's roster row states no
 * boundary legs) needs `egress: false` in the same entry — `egress: true` contradicts it and an absent one leaves a server hint
 * marking it an external write — refused here; whether the other axes contradict each other (`egress`
 * over a non-write effect) is the ingestion's own arithmetic. On `"a2a"` a skill's axes only raise: an entry holding anything but
 * `effect: "write"`, `egress: true`, `irreversibility: "always"` — a lowering value (`egress: false`, another `effect`,
 * `irreversibility: "never"`, any `boundaryFlow`) or a word outside every vocabulary — is refused naming each such member, the sentence
 * leading with dropping it and listing only what an A2A skill takes, since a peer is lowered whole, by the deployment (its registration
 * of the peer, `boundary`, and its isolation switch), never skill by skill; the same declaration on `"mcp"` is read as before. The answer is typed by `at`: read for
 * `"a2a"`, an `ok: true` copy is an `A2aServerSpec.toolAxes` as it stands. The declaration is read once, as plain data, by {@link receiveDeclaration} — a
 * Proxy, a map, a class instance, a record built on a prototype or in another realm, a getter that throws, a structure that contains
 * itself, a tool named `__proto__` are refusals that say where they sit (never the thrown text), not a throw — and judged on that copy.
 * `at` is the caller's own word, not the declarer's: one outside {@link ToolAxesSurface} throws `config.invalid_argument` naming the
 * surfaces, whatever is declared.
 */
export declare function readToolAxes<At extends ToolAxesSurface>(declared: unknown, at: At): ToolAxesRead<At>;
/** {@link readToolAxes} for an MCP server's declaration — the entry a host that mounts MCP servers asks. */
export declare function readMcpToolAxes(declared: unknown): ToolAxesRead;
/**
 * The word a sentence about one declaration of the surface `at` names the declarer by — `MCP server`, `A2A peer`. The same row the
 * `toolAxes` refusal below reads, so every sentence the engine writes about a declaration it cannot read calls the declarer one thing.
 */
export declare function declarerWord(at: ToolAxesSurface): string;
/**
 * The refusal an entry's `toolAxes` that {@link readToolAxes} refused becomes (`config.invalid_argument`), ONE sentence shape for every
 * surface that declares them, in its surface's words ({@link TOOL_AXES_SURFACES}): the subject is the surface's declarer word and `name`
 * (quoted and bounded by the caller: `MCP server "db"`, `A2A peer "agent"`; on a surface that sets a `nameMax` cut again to it, so a long
 * name never pushes what follows it past a reader's cut — a surface without one prints the name as it was handed), `problem` is
 * {@link readToolAxes}'s own sentence. Where the surface says whose a lowering is (an A2A peer: the deployment's), that is a sentence of
 * its own after a problem that says a lowering was declared ({@link A2A_REFUSAL_ENDINGS}) — never after a misspelt word or an unknown
 * member — and not said to a declarer already registered inside (`loweredWhole`). It is true whether or not the deployment isolates its
 * peers (`RunnerDeps.a2a.isolatePeers`, which a sentence built here cannot read): it says who decides, not what a registration does.
 */
export declare function toolAxesRefusal(at: ToolAxesSurface, name: string, problem: string, loweredWhole?: boolean): Error & {
    code: "config.invalid_argument";
};
/**
 * Definition of one A2A (agent-to-agent protocol) PEER to talk to for the duration of one task.
 *
 * The peer is a remote AGENT, not a data source: it acts on its own side. That single fact sets the
 * defaults — every skill this peer advertises mounts with `egress: true` and `effect: "write"` (ruled
 * 2026-08-03), so it registers the approval gate and is never auto-allowed on a no-policy deployment,
 * and its replies reach the model inside an untrusted-data fence. The one way down from those defaults is the whole peer's
 * registration ({@link boundary} `"inside"`: its skills carry no egress mark, unless the deployment isolates its peers —
 * `RunnerDeps.a2a.isolatePeers` — which keeps an inside peer's skills under the operator's egress mandate too); {@link toolAxes} only
 * raises a skill.
 *
 * Skills mount as `a2a__<peer>__<skill>` (the protocol table's second namespace).
 */
export interface A2aServerSpec {
    /** Stable local name for this peer; it becomes the namespace segment of every mounted tool name. */
    name: string;
    /** The peer's service URL. Doubles as the origin the well-known agent-card paths resolve against, and
     *  as the JSON-RPC endpoint when the card does not name a different one. */
    url: string;
    /** Explicit agent-card location, when the peer does not publish at a well-known path. Set ⇒ it is used
     *  ALONE (no well-known probing behind the operator's back). */
    cardUrl?: string;
    /** At most one opaque credential reference, as on an MCP server's transport: the headers a send to this peer carries are
     *  answered per send by the deployment's peer seat ({@link RunnerDeps.peerSeat}), never declared (`headers` is retired and
     *  refused, `config.credential_in_declaration`). Pieces the seat answers (and the principal header) travel only over `https:`,
     *  or plain `http:` to this machine (`config.protocol_plaintext_credentials` otherwise), and only to the declared origins
     *  (`url`, `cardUrl`): a send carrying them to an endpoint on another origin is refused (`config.protocol_endpoint_unbound`),
     *  and it follows no redirect. */
    credentials?: CredentialRef;
    /**
     * Per-task **end-user principal** header (design/62), same contract as the MCP side: when set, the
     * Runner injects the running task's authenticated {@link TaskSpec.principal} under this header name on
     * every call to this peer, so the peer can enforce per-user authorization. Absent principal ⇒ the
     * header is not sent (the peer must then default to deny/public, never admin). A header the peer seat
     * answers under the same name in any case is the seat's fault, and that send is not made (`config.protocol_header_collision`).
     * The principal is Runner-held: the model can neither read nor set it.
     */
    principalHeader?: string;
    /** Optional allowlist of skill ids to expose (others are not mounted). */
    allowSkills?: string[];
    /**
     * Caller-side per-skill safety-axis declarations, keyed by the peer's REMOTE skill id. They only RAISE: `egress: true` marks a
     * skill of an inside peer as leaving the organization, `irreversibility: "always"` makes every call to it a mandated question;
     * `effect: "write"` restates the default every reader applies. A peer is lowered whole, never skill by skill: what its calls ask is
     * the deployment's to set, by how it registers the peer ({@link boundary}) and whether it isolates its peers. The lowering values an
     * MCP server's entry takes — `egress: false`, an `effect` other than `write`, `irreversibility: "never"` (the declarer's own
     * "reversible" on the card's risk row, which the engine cannot check), `boundaryFlow` — are refused here naming the member
     * (`config.invalid_argument`, the sentence leading with "drop" and listing only what a skill takes; for a peer not registered
     * inside, a sentence of its own follows: the deployment sets what calls to a peer ask — not after a misspelt word, a value of
     * another kind or an unknown member), at the same doors and with the same disposition as a declaration of another shape (below);
     * the type does not carry them.
     *
     * THE SHAPE IS JUDGED, NOT TRUSTED, by the same reader as {@link McpServerSpec.toolAxes} ({@link readToolAxes} with `at: "a2a"`) and
     * with the same disposition: a task's preparation door runs it on every peer of `TaskSpec.a2a`, and a declaration it cannot read
     * refuses the whole prepare (`config.invalid_argument`, subject `A2A peer "<name>"`) before any peer is dialed — one bad skill refuses
     * the task, a bad key is never dropped and a bad word never defaults. The materialization entrance (`materializeA2aTools`, the library
     * entrance) asks it once per peer, when it reads that peer's declaration: there a declaration it cannot read fails THAT peer's dial
     * (never dialed, a warning whose cause is the same refusal), its siblings unaffected; a refresh does not ask again, it dials the copy
     * that was judged (a peer refused at the entrance is refused again by every refresh, from the stored refusal). A task re-supplied
     * to `resume` with such a declaration is refused before the claim (`checkpoint.config_refused`, `detail.code` `config.invalid_argument`),
     * the checkpoint left pending: a host that stored a request body carrying one migrates it and resumes the same token.
     */
    toolAxes?: Record<string, {
        effect?: "write";
        egress?: true;
        irreversibility?: "always";
    }>;
    /**
     * Whether this peer stands inside the organization's registered trust boundary: `"inside"` or `"outside"`. Absent ⇒ outside — a
     * reader never takes a missing word for inside. A DEPLOYMENT-plane fact, like {@link McpServerSpec.contentOrigin}: only the side that
     * owns the registration may write it, so an assembly layer that accepts request-side peers must reject or strip this key from them
     * (and `fingerprint`, `displayName` and `ownerTeam` with it); the model, the peer's card and a request body never say it.
     *
     * What `"inside"` asks of the declaration, each refused for that peer at its dial (the peer is not mounted, its siblings are):
     * a {@link fingerprint}, an explicit non-empty {@link allowSkills} (the skills that were reviewed — a skill the card adds later is
     * not mounted), and a {@link principalHeader} (without one every user of the calling deployment is one person to the peer) —
     * `config.a2a_inside_incomplete`, naming the member to add; a `url`, `cardUrl` or card-advertised endpoint that would be reached in
     * the clear across a network (`config.protocol_plaintext_credentials`); a card-advertised endpoint on an origin the declaration does
     * not name (`config.protocol_endpoint_unbound`) — both judged whether or not a send carries anything; never mounted as an outside peer
     * instead. A request to an inside peer follows no redirect, and is not sent when the revocation ledger cannot be read (`a2a.revocation_unreadable`; an outside peer's request goes out as before).
     * An inside peer's reply is fenced as untrusted data exactly as an outside peer's: inside says where a call may go, not that what
     * comes back is an instruction.
     */
    boundary?: "inside" | "outside";
    /**
     * The registration's identity stamp — the same member, with the same meaning, as {@link McpServerSpec.fingerprint}: an opaque,
     * non-empty string of at most 128 characters that the writing side minted with the registration and stored beside it; the engine
     * computes nothing from it and compares it only. Present ⇒ it rides the revocation question (`ProtocolRevocationTarget.fingerprint`)
     * and the run's wiring manifest. Required when {@link boundary} is `"inside"`. Any other value refuses the declaration
     * (`config.invalid_argument`).
     */
    fingerprint?: string;
    /** The registration's name for people ("Billing reconciliation"), at most 160 characters: carried on an ask about this peer's skills
     *  (`AskRequest.destination`). Absent ⇒ the ask carries none (the peer's `name` is not put in its place). Never taken from the card. */
    displayName?: string;
    /** The team that owns this peer, as the registration states it, at most 160 characters: carried on an ask about this peer's skills
     *  (`AskRequest.destination`). Absent ⇒ the ask carries none. Never taken from the card. */
    ownerTeam?: string;
    /**
     * The terms a call to this peer is held to, in milliseconds, each fixed when the call is dispatched (a call is a peer task row):
     * `shortWaitMs` — how long the call itself asks the peer before it hands back a receipt (default 20 000; `0` = a receipt at once);
     * `ackWithinMs` — the acknowledgement deadline (default 120 000 inside, 600 000 outside); `finalWithinMs` — the final deadline, past
     * which a row with no ending settles failed (default 600 000); `approvalWaitMs` — how long past the final deadline the peer's answer
     * is still watched (default 86 400 000). Each a whole number of milliseconds, at most 2 147 483 647, `finalWithinMs` at least 1;
     * `shortWaitMs` and `ackWithinMs` not past the final deadline in force (the declared one, else its default); no other member. A value
     * that does not fit refuses the declaration (`config.invalid_argument`, read by `a2aRespondProblem`, peer-task-lane.ts), never read as
     * the default.
     */
    respond?: {
        shortWaitMs?: number;
        ackWithinMs?: number;
        finalWithinMs?: number;
        approvalWaitMs?: number;
    };
}
/**
 * Where a call to a protocol peer goes, as the ask about it says — the A2A peer the tool belongs to, read off the peer's declaration,
 * never off its card or the model. `boundary` is always present and is one of two words; a reader takes an ask that carries no
 * destination as one that says nothing about where the call goes, never as an inside one.
 */
export interface AskDestination {
    readonly kind: "a2a_peer";
    /** The peer's declared name (the namespace segment of its tools). */
    readonly peer: string;
    readonly displayName?: string;
    readonly ownerTeam?: string;
    readonly boundary: "inside" | "outside";
}
/**
 * design/99 §E23 — an INBOUND MCP elicitation request (a connected server asking the END USER for input
 * mid-tool-call). Handed to the deployment's {@link RunnerDeps.onElicit} seam. **UNTRUSTED**: `message` /
 * `requestedSchema` / `url` are SERVER-controlled — core never interprets `requestedSchema`; a consumer that
 * shows `message` to a human MUST fence it (`delimitUntrusted`).
 */
export interface McpElicitRequest {
    /** The {@link McpServerSpec.name} of the server that issued the request. */
    server: string;
    /** The server's human-facing prompt (UNTRUSTED — fence before display). */
    message: string;
    /** Form mode: the server's requested input schema (a flat object of scalars). OPAQUE to core. */
    requestedSchema?: unknown;
    /**
     * URL mode: a server-controlled URL the user is asked to visit (UNTRUSTED — a phishing/social-engineering
     * surface; a consumer MUST scrutinize/fence it before showing it). **Inactive**: core advertises FORM mode
     * only, so the SDK rejects url-mode requests before this seam — the field is never populated today.
     *
     * Where url mode is heading (MCP revision `2026-07-28`), because the earlier note here ("reserved for a
     * future url-mode opt-in") pointed at machinery that no longer exists: the revision REMOVES the
     * `2025-11-25` url-mode correlator (`elicitationId`) and the `notifications/elicitation/complete`
     * notification that went with it. A url interaction is instead carried by the revision's multi-round-trip
     * request flow — the server answers with an input-required result, the client RETRIES the original
     * request, and the server correlates across retries through its OWN opaque request state rather than a
     * client-visible id. The one thing both shapes agree on is the server-supplied URL itself, which is what
     * this field holds. So the field stays; anything that would have hung off the removed correlator must not
     * be added here without re-reading the protocol revision core actually speaks.
     */
    url?: string;
    /** The running task's authenticated end-user (design/62), if any — for routing the prompt to the right human. */
    principal?: string;
}
/** design/99 §E23 — the deployment's answer to an {@link McpElicitRequest} (returned to the MCP server). */
export interface McpElicitResponse {
    action: "accept" | "decline" | "cancel";
    /** Submitted values (accept only); core passes them through opaquely, never validated against the schema. */
    content?: Record<string, string | number | boolean | string[]>;
}
/**
 * design/99 §E23 — the LIVE-ONLY inbound-elicitation seam. A deployment provides it (e.g. the sema shell
 * prompts the user at the terminal) and returns the answer SYNCHRONOUSLY; core replies to the server on the
 * still-open connection. Absent ⇒ no server is advertised the elicitation capability (fail-closed). Not a
 * durable suspend — a crash/replica-change loses an in-flight elicitation (acceptable for an interactive shell).
 *
 * 🔴 THROTTLING IS THE DEPLOYMENT'S JOB: once a server is opted in, it may issue elicitations at any frequency
 * (one per tool call, or many) — core imposes NO rate/count limit (an elicitation is not a tool call and does
 * not ride the policy gate). `onElicit` is the choke point: throttle, aggregate, or `decline`/`cancel` an
 * over-eager or untrusted server here (the request's `AbortSignal` is forwarded so a deadline can cancel it).
 */
export type OnElicit = (req: McpElicitRequest, signal?: AbortSignal) => Promise<McpElicitResponse>;
export {};
