/** * Typed `registerA2A` helper. Paired with QAR's outbound A2A bridge. * * ## Locked architectural calls * * 1. **Outbound only initially.** Consumer registers an external A2A * endpoint as a spawnable agent. Inbound (QAR-as-A2A-server) is a * near-term commitment but NOT in this surface. * 2. **Bridge lives runtime-side (QAR); SDK exposes typed registration * only.** This helper mirrors the {@link QarRegistryClient.registerMcp} * pattern — `registerA2A` stashes the endpoint locally and returns a * branded ref; QAR's A2A bridge handles wire dispatch end to end. * 3. **NO A2A protocol library on the SDK side.** No `a2a-sdk-js` or * equivalent. The SDK doesn't fetch `/.well-known/agent.json` and * doesn't speak A2A wire — QAR does. The {@link AgentCard} type * here is a loose structural mirror so consumers can pass an inline * card without committing to a specific A2A SDK version. * 4. **`TaskState.input_required` → `input` HITL by default.** The only * SDK-side override is {@link A2ARegistrationConfig.hitlKind}; * other dimensions (sensitivity, deadline, deny-behavior) are * hardcoded on the QAR bridge side. */ import type { RegisterOptions } from '../QarRegistryClient.js'; /** * TypeScript mirror of the A2A protocol's AgentCard. Loose / open shape * by design — the SDK doesn't validate the card structurally; QAR's * bridge does that (it speaks the A2A protocol). Authors can pass an * inline card (test fixtures, static configs) or let QAR resolve it * from the endpoint's `/.well-known/agent.json`. */ export interface AgentCard { /** Agent name as advertised by the A2A endpoint. */ readonly name?: string; /** Human-readable agent description. */ readonly description?: string; /** RPC URL — where A2A `message/send` calls are dispatched. */ readonly url?: string; /** A2A protocol version the endpoint claims to speak. */ readonly version?: string; /** Supported capabilities (streaming, push notifications, …). */ readonly capabilities?: { readonly [key: string]: unknown; }; /** Declared skills the agent surface advertises. */ readonly skills?: ReadonlyArray<{ readonly [key: string]: unknown; }>; /** * Open metadata bag — A2A endpoints carry arbitrary fields per the * evolving spec. Forward-compatible without SDK version bumps. */ readonly [key: string]: unknown; } /** * HITL kind override raised when the remote A2A agent emits * `TaskState.input_required`. Maps to QAR's HITL bubble shapes: * * - `'input'` — free-form text input. **Default.** Mirrors the A2A * wire intent ("the remote agent needs more text from the user"). * - `'choice'` — closed-set picker. Use when the remote A2A agent * consistently surfaces enumerated options that aren't structured * enough for `'input'`. * - `'approval'` — approve/reject prompt. Use when the remote agent * pauses for confirmation rather than information. * * Only the HITL kind is consumer-controllable from the SDK side. * Sensitivity, deadlines, and deny-behavior remain hardcoded on QAR's * bridge (`sensitivity=low`, no deadline, send-empty-on-deny). */ export type A2AHitlKind = 'approval' | 'choice' | 'input'; /** * Registration config for {@link QarRegistryClient.registerA2A}. */ export interface A2ARegistrationConfig { /** * A2A endpoint URL — base of the remote agent's HTTP surface. QAR's * bridge resolves `/.well-known/agent.json` against this base; pass * an explicit {@link agentCard} to skip the resolution round-trip. */ readonly endpoint: string; /** * Outbound headers applied to A2A requests for this endpoint. * Typical use: `Authorization: Bearer ...`, tenant headers, the * `Accept` content negotiation. QAR's bridge forwards them on every * outbound call. */ readonly headers?: { readonly [key: string]: string; }; /** * Override the HITL kind raised when the remote A2A agent emits * `TaskState.input_required`. Default {@link A2AHitlKind | 'input'}. */ readonly hitlKind?: A2AHitlKind; /** * Inline AgentCard. When provided, the registration carries the card * verbatim and QAR can skip the `/.well-known/agent.json` fetch on * first dispatch. Useful for test fixtures, air-gapped deployments, * and consumers who already hold the card from a prior resolution. */ readonly agentCard?: AgentCard; } /** * Branded handle returned by {@link QarRegistryClient.registerA2A}. The * `kind: 'a2a'` discriminator distinguishes the ref from * {@link RegisteredAgentRef} (`'agent'`) and {@link RegisteredMcpRef} * (`'mcp'`) in mixed-shape lists. Consumers reference it by `.name` * when wiring the registered endpoint into a graph spec or * spawnable_agents list — the wire-side projection (Q1) translates the * ref into the appropriate A2A dispatch envelope. */ export interface RegisteredA2ARef { readonly kind: 'a2a'; readonly name: string; } /** * Resolved registration snapshot. Returned by `registerA2A` and stored * locally for the SDK lifetime. `hitlKind` is always populated (default * `'input'` is materialized at registration time so downstream readers * don't have to default-pick). */ export interface A2ARegistration { /** Registered name — matches {@link RegisteredA2ARef.name}. */ readonly name: string; /** Mirrored from {@link A2ARegistrationConfig.endpoint}. */ readonly endpoint: string; /** Mirrored from {@link A2ARegistrationConfig.headers}, when supplied. */ readonly headers?: { readonly [key: string]: string; }; /** Resolved HITL kind. `'input'` when not overridden at registration time. */ readonly hitlKind: A2AHitlKind; /** Mirrored from {@link A2ARegistrationConfig.agentCard}, when supplied. */ readonly agentCard?: AgentCard; } /** * SDK-process-scoped A2A endpoint registry. In-memory, no persistence. * Mirrors {@link QarRegistryClient}'s shape for agents and MCPs — same * register / unregister / lookup / list surface, same {@link * QodoRegistryConflictError} on duplicate-name conflicts. * * The class is internal — consumers reach the surface through * `client.qar.registerA2A(...)`. Composing a separate class keeps * {@link QarRegistryClient} from sprouting yet-another-Map field and * lets the A2A logic stay co-located with its types. */ export declare class A2ARegistry { private readonly entries; /** * Register an A2A endpoint. Validates name + endpoint synchronously; * stores the registration locally and returns a branded ref. * * @throws {QodoRegistryConflictError} on empty name, empty endpoint, * or duplicate name without `{ replace: true }`. */ register(name: string, config: A2ARegistrationConfig, opts?: RegisterOptions): RegisteredA2ARef; /** Lookup — undefined when no A2A is registered under that name. */ get(name: string): A2ARegistration | undefined; /** Presence check. */ has(name: string): boolean; /** Snapshot of registered A2A endpoints. Stable order = registration order. */ list(): readonly A2ARegistration[]; /** * Remove a previously-registered A2A endpoint. Returns `true` if the * entry was present, `false` otherwise. Idempotent — same shape as * `unregisterAgent` / `unregisterMcp` on {@link QarRegistryClient}. */ unregister(name: string): boolean; } //# sourceMappingURL=registerA2A.d.ts.map