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

95 lines 4.57 kB
import { type A2AHttpClientOptions } from './http.js'; import type { AgentCard, Message, PushNotificationConfig, StreamEvent, Task } from './types.js'; export declare const A2A_RUNTIME_V1 = "https://agentic-sandbox.aiwg.io/extensions/runtime/v1"; export declare const A2A_IDEMPOTENCY_V1 = "https://agentic-sandbox.aiwg.io/extensions/idempotency/v1"; export declare const A2A_HITL_PROMPT_V1 = "https://agentic-sandbox.aiwg.io/extensions/hitl-prompt/v1"; export declare const A2A_MULTI_TENANT_V1 = "https://agentic-sandbox.aiwg.io/extensions/multi-tenant/v1"; export declare const A2A_PTY_EXTENSIONS_V1 = "https://agentic-sandbox.aiwg.io/extensions/pty-extensions/v1"; /** Required-by-default extension set — the executor's `RequireA2AExtensions` * middleware (sandbox#236) rejects mutating calls without these. */ export declare const DEFAULT_REQUIRED_EXTENSIONS: readonly ["https://agentic-sandbox.aiwg.io/extensions/runtime/v1", "https://agentic-sandbox.aiwg.io/extensions/idempotency/v1"]; export interface A2AClientOptions extends Omit<A2AHttpClientOptions, 'defaultExtensions'> { /** Stable executor-side identifier (UUIDv7 per sandbox docs). */ instanceId: string; /** Required extensions to inject on every mutating call. Defaults to * `runtime/v1` + `idempotency/v1`. Add optional URIs (e.g. hitl-prompt/v1) * via `optionalExtensions`. */ requiredExtensions?: readonly string[]; /** Optional extensions to include in the `A2A-Extensions` header (toggled * by AIWG config flags upstream). */ optionalExtensions?: readonly string[]; } export interface SendMessageOptions { /** Extension URIs to send for this single call; defaults to client config. */ extensions?: readonly string[]; signal?: AbortSignal; } export interface SendMessageResult { task: Task; /** True when the executor served this from the idempotency cache. */ idempotentReplayed: boolean; activatedExtensions: string[]; } export declare class A2AClient { readonly instanceId: string; private readonly http; private readonly extensionSet; constructor(opts: A2AClientOptions); private agentPath; /** * Fetch the well-known unsigned card. Callers that need verification should * use `src/a2a/agent-card.ts` instead, which wraps this with JWS verification. */ getAgentCard(): Promise<AgentCard>; /** Fetch the extended AgentCard (authenticated view). */ getExtendedAgentCard(): Promise<AgentCard>; /** * Send a message; the executor creates a Task in state `submitted` and * returns 202 + Task JSON. Idempotent on `message.messageId` — repeating * with the same id + body returns the cached Task with * `idempotentReplayed: true`. */ sendMessage(message: Message, opts?: SendMessageOptions): Promise<SendMessageResult>; getTask(taskId: string, opts?: { signal?: AbortSignal; }): Promise<Task>; /** List tasks for this instance, optionally filtered by state. */ listTasks(filter?: { state?: string; limit?: number; }): Promise<Task[]>; cancelTask(taskId: string, opts?: SendMessageOptions): Promise<Task>; /** * Subscribe to a task's event stream over SSE. Returns an async iterator * over `StreamEvent` payloads. * * The executor sends `event: <kind>` lines and `data: <json>` lines per * the WHATWG event-stream format. We parse the multi-line frames and yield * one `StreamEvent` per frame. * * Abort the iteration by aborting the supplied signal (or just stop * consuming and call `return()` on the iterator — the underlying response * body will be cancelled). */ subscribeToTask(taskId: string, opts?: { signal?: AbortSignal; replayFromSeq?: number; }): AsyncIterable<StreamEvent> & { close(): void; }; createPushNotificationConfig(taskId: string, config: PushNotificationConfig): Promise<PushNotificationConfig>; getPushNotificationConfig(taskId: string, configId: string): Promise<PushNotificationConfig>; deletePushNotificationConfig(taskId: string, configId: string): Promise<void>; } interface SseFrame { event?: string; data: string; id?: string; } /** * Parse a WHATWG event-stream over a ReadableStream<Uint8Array>. * Yields one SseFrame per complete `event: + data: + blank line` block. */ export declare function parseEventStream(stream: ReadableStream<Uint8Array>): AsyncGenerator<SseFrame, void, void>; export {}; //# sourceMappingURL=client.d.ts.map