/** * Stable JSON output contract + exit-code table for the `h2a` CLI surface. * * This module is the **machine-readable counterpart** of `docs/cli-contract.md` * (DEC-034). Every verb exposed by `runCli` appears here with: * * - `outputShape`: one of three canonical envelopes (see below). * - `exitCodes`: the subset of {0,1,2,3} the verb can return. * - `requiredFlags` / `optionalFlags`: documented flag surface. * * Envelope shapes * --------------- * * - `resource` — single entity persisted/loaded by the verb. Stdout is the * bare JSON of that entity (no `{ok}` wrapper). Examples: a negotiation * record, a journal entry, an envelope, the MCP config snippet for a host. * - `list` — bare JSON array. Examples: `discover`, `inbox read`, * `negotiate journal`. * - `action` — confirmation envelope `{ ok: true, ...details }` for verbs * that perform side effects but do not return a natural entity (`init`, * `register`, `inbox put`, `outbox put`, `negotiate stabilize`, * `host setup --write`). * - `text` — non-JSON human output (currently only `--help`). * - `stream` — long-running framed transport (`mcp-serve`, JSON-RPC 2.0 * over stdio); no single stdout payload. * * Exit-code table * --------------- * * - `0` success. * - `1` user error — bad flag, missing required flag, invalid JSON, * validation failure on user input, unknown verb/subverb/host. * - `2` runtime/state error — store conflict or business-rule failure * (negotiation not found, already open, already stabilized, signature * fails verification, quorum incomplete, broken journal, divergent * pre-existing config file). * - `3` I/O / OS error — file unreadable, permission denied, write * refused by the filesystem. * * DEC-034 freezes this contract. Future breaking changes require a new DEC * and a major version bump on `@sentropic/h2a`. */ export type H2ACliOutputShape = "resource" | "list" | "action" | "text" | "stream"; export type H2ACliExitCode = 0 | 1 | 2 | 3; export interface H2ACliVerbContract { /** Full verb path, space-separated (`"negotiate open"`, `"host setup"`). */ readonly verb: string; /** Canonical envelope of the stdout payload on success. */ readonly outputShape: H2ACliOutputShape; /** Exit codes this verb can produce. Always includes `0` for success. */ readonly exitCodes: readonly H2ACliExitCode[]; /** Flags required for a happy-path invocation. */ readonly requiredFlags: readonly string[]; /** Flags accepted but optional. */ readonly optionalFlags: readonly string[]; /** One-line human description. */ readonly description: string; } export declare const H2A_CLI_VERB_CONTRACTS: readonly H2ACliVerbContract[]; /** Map of verb-path → contract for O(1) lookups in tests and tooling. */ export declare const H2A_CLI_VERB_CONTRACT_BY_VERB: ReadonlyMap; //# sourceMappingURL=cli-contract.d.ts.map