/** * OpenRPC 1.3.2 document generator driven from the transport-neutral * `OperationRegistry`. Produces a JSON-serializable OpenRPC document * listing every operation whose transport availability intersects * `OpenRpcOptions.transports`. * * - `transports: ['http']` → WebSocket-only methods are omitted * (calling `weft.workflows.subscribe` over HTTP would return * `UnsupportedTransport`, so the method should not appear in the * HTTP-only document). * - Every listed method carries `paramStructure: 'by-name'`, per-field * `ContentDescriptor`s for human-readable surface, AND an * `x-weft-paramsSchema` extension whose `additionalProperties` is * computed from `unknownKeyPolicy.jsonRpc` (`'reject'` → false; * `'strip'` / `'passthrough'` → true). The extension is the * authoritative top-level object schema used by runtime enforcement * and generator tooling; the per-field descriptors cannot drift * from it by the "names match" invariant enforced in tests. * - Every operation-catalog method carries the canonical `x-weft-access` * metadata and, when applicable, `x-weft-parameterizedAccess`. The * synthetic `rpc.discover` method is not an operation-catalog entry, * but advertises its dispatcher-enforced public access posture explicitly. * - `rpc.discover` is itself emitted as a method so clients can * locate the document via JSON-RPC. * * @module server/openrpc */ import type { McpToolDefinition } from '../mcp/tools.ts'; import { type DiscoveryInfo } from './discovery-info.ts'; import { type OperationRegistry } from './operation-catalog.ts'; /** Transports that MAY be listed in `OpenRpcOptions.transports`. */ export type OpenRpcTransport = 'http' | 'websocket' | 'stdio'; export type OpenRpcOptions = { /** Live operation registry. Only operations from this registry can be listed. */ readonly registry: OperationRegistry; /** JSON-RPC transports whose methods should be included in the document. */ readonly transports: ReadonlyArray; /** Document title. Defaults to `'Weft Workflow Engine'`. */ readonly title?: string; /** Document version. Defaults to the current Weft package version. */ readonly version?: string; /** Operator-supplied discovery metadata applied to the `info` object. */ readonly discoveryInfo?: DiscoveryInfo; /** Optional server URL; emitted as a single-entry `servers` array. */ readonly serverUrl?: string; /** * Live MCP `tools/list` output. Required when any listed operation is * `mcpExposable`, because live MCP tool naming owns workflow-name collision * handling. */ readonly mcpTools?: ReadonlyArray>; }; /** * Generate an OpenRPC 1.3.2 document. See module doc-comment for the * runtime-filtering contract. */ export declare function generateOpenRpcDocument(options: OpenRpcOptions): Record;