UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

81 lines 3.71 kB
import type { ProblemDetails } from './types.js'; export interface DeprecationInfo { /** Request path that triggered the deprecation headers (e.g. `/api/v1/sessions/xyz/dispatch`). */ path: string; /** Value of the `Sunset` response header (RFC 8594), if present. */ sunset?: string; /** Value of the `Deprecated` response header, if present. */ deprecated?: string; /** URL extracted from `Link: <…>; rel="successor-version"`, if present. */ successor?: string; } export interface A2ARequestOptions { method?: string; /** Body — serialized as JSON unless `bodyRaw` is set. */ body?: unknown; /** Raw body (skip JSON encoding); content-type is caller's responsibility. */ bodyRaw?: string | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array>; /** Extra request headers (lowercase keys; merged after defaults). */ headers?: Record<string, string>; /** Override the bearer token for this single call. */ bearer?: string; /** When set, inject these extension URIs as the `A2A-Extensions` header. * Mutating methods should always set this; non-mutating may skip. */ extensions?: string[]; /** AbortSignal to cancel the request. */ signal?: AbortSignal; /** Don't parse the body — return the raw Response (used by SSE). */ raw?: boolean; } export interface A2AResponse<T = unknown> { /** HTTP status code. */ status: number; /** Parsed JSON body (or undefined for empty/204). Absent when `raw: true`. */ body: T | undefined; /** Raw Headers, in case the caller needs them. */ headers: Headers; /** True when the executor served this from the idempotency cache. */ idempotentReplayed: boolean; /** Extension URIs the executor echoed (parsed from response `A2A-Extensions`). */ activatedExtensions: string[]; /** Captured deprecation info, if the response carried `Sunset` / `Deprecated`. */ deprecation?: DeprecationInfo; /** Raw response body stream (only set when `raw: true`). Caller owns the * lifecycle — must consume or release. */ rawBody?: ReadableStream<Uint8Array> | null; } export declare class A2AError extends Error { readonly status: number; readonly problem: ProblemDetails; readonly path: string; constructor(status: number, path: string, problem: ProblemDetails); } export interface A2AHttpClientOptions { baseUrl: string; bearer: string; /** Default extensions to inject on mutating calls. Typically the * `required: true` set from the cached AgentCard. */ defaultExtensions?: string[]; /** Fail-fast on any v1 deprecation hit (mirrors AIWG_FAIL_ON_DEPRECATED). */ failOnDeprecated?: boolean; /** Custom fetch implementation (for tests + future runtime polyfills). */ fetch?: typeof fetch; /** Called once per (path, sunset) pair when deprecation headers seen. */ onDeprecation?: (info: DeprecationInfo) => void; /** Called when an expected extension is requested but not echoed in the response. */ onExtensionEchoMissing?: (expected: string[], echoed: string[], path: string) => void; } export declare class A2AHttpClient { private readonly baseUrl; private readonly bearer; private readonly defaultExtensions; private readonly failOnDeprecated; private readonly fetchImpl; private readonly onDeprecation?; private readonly onExtensionEchoMissing?; /** Per-process dedupe set: one log per (path, sunset_date). */ private readonly seenDeprecations; constructor(opts: A2AHttpClientOptions); request<T = unknown>(path: string, options?: A2ARequestOptions): Promise<A2AResponse<T>>; } //# sourceMappingURL=http.d.ts.map