@relaymessenger/sdk 0.3.7-staging.9 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,8 +29,9 @@ card, and `partsWithSelection(undefined, selection)` sends the selection alone.
29
29
 
30
30
  `selectionPart` validates a complete part (`type` may be left out), returning a
31
31
  normalized part or an error string. The title is limited to 60 characters,
32
- options to 25, trimmed labels to 80 characters, and explicit case-sensitive
33
- ASCII token values to 100. Unknown fields, duplicate values, a missing or blank
32
+ options to 25 total. Legacy value-only rows allow trimmed labels up to 80
33
+ characters and case-sensitive ASCII tokens up to 100. ID rows and grouped
34
+ inputs are described below. Unknown fields, duplicate values, a missing or blank
34
35
  title, and blank labels are rejected.
35
36
 
36
37
  Selection inherits existing Chat membership rules: at most one human user,
@@ -43,8 +44,8 @@ idempotency keys, without expanding group membership.
43
44
  text above the card. It keeps invalid blocks as text with an error and never combines a
44
45
  selection with buttons. Existing buttons retain their behavior.
45
46
 
46
- The person opens the prompt, checks any number of options and submits them
47
- once; checking sends nothing and only the submit does. A person answers a given
47
+ By default, the person opens the prompt, checks any number of options (exactly one
48
+ when `multiple` is false) and submits them once; checking sends nothing and only the submit does. A person answers a given
48
49
  selection once, and reopening it afterwards shows what they chose without
49
50
  letting them change it.
50
51
 
@@ -63,7 +64,38 @@ metadata after narrowing to `message.received`.
63
64
 
64
65
  The CLI, Pi, OpenClaw, the Claude Code channel, MCP, and the Chat SDK adapter
65
66
  include selection guidance and structured inbound discovery.
66
- `selectionReply(parts, replyTo)` discovers values and the explicit source target.
67
+ `selectionReply(parts, replyTo)` discovers values, IDs, source-owned reply text,
68
+ and the explicit source target.
69
+
70
+ ### List picker sections
71
+
72
+ ```ts
73
+ import { selectionPart, partsWithSelection } from "@relaymessenger/sdk";
74
+
75
+ const picker = selectionPart({
76
+ title: "Shipping",
77
+ subtitle: "Choose a service",
78
+ multiple: false, // omitted means true
79
+ sections: [{
80
+ title: "Fast",
81
+ options: [{ id: "priority", label: "Priority", subtitle: "Tomorrow", image_url: "https://example.com/priority.png" }],
82
+ }],
83
+ reply_message: { title: "Shipping saved", subtitle: "Thank you" },
84
+ });
85
+ if (typeof picker === "string") throw new Error(picker);
86
+ await relay.chats.messages.send(chatId, { message: { parts: partsWithSelection(undefined, picker) } });
87
+ ```
88
+
89
+ Send exactly one of `options` or `sections` (1–10 sections, 1–25 rows total).
90
+ ID rows accept 1–200 characters and labels up to 24 characters. Legacy value-only
91
+ rows keep 100-character ASCII tokens and 80-character labels. If both aliases
92
+ are supplied they must match. Row subtitles allow 72 characters; card subtitles
93
+ and reply titles/subtitles allow 512. Images must be HTTPS URIs, up to 2048 characters; encode spaces and Unicode in URLs.
94
+ Responses include flat options, normalized `id`/`value` aliases, and viewer-scoped
95
+ `selected_ids`. `selectionReply` preserves IDs and server-owned `reply_message`;
96
+ legacy replies still work. Do not send `reply_message` in response metadata.
97
+
98
+ Optional subtitles may be empty.
67
99
 
68
100
  ## Payment
69
101
 
package/dist/client.d.ts CHANGED
@@ -1,22 +1,12 @@
1
1
  import { ChatsPage, MessagesPage } from "./pagination.js";
2
2
  import { CallRoom, type CallRoomOptions } from "./calls/call-room.js";
3
- import type { A2aSendMessageResult, A2aTask, AcceptedResponse, AgentMe, AgentMeUpdateParams, AgentMeUpdateResponse, AgentAccessEntry, AgentAccessLists, OAuth2ClientResponse, OAuth2ClientUpdateParams, AgentAccessSetParams, Attachment, AttachmentCreateParams, AttachmentCreateResponse, BlockedHandleListResponse, BlockHandleParams, BlockHandleResponse, CallCreateOptions, CallCreateParams, CallListParams, CallListResponse, CallResponse, Chat, ChatActivityResponse, ChatClearActivityParams, ChatCreateParams, ChatCreateResponse, ChatListChatsParams, ChatSendVoicememoParams, ChatSendVoicememoResponse, ChatSetActivityParams, ChatUpdateParams, ChatUpdateResponse, ContactCardItem, ContactCardCreateParams, ContactCardRetrieveParams, ContactCardRetrieveResponse, ContactCardUpdateParams, ContactLookupParams, ContactLookupResponse, GetChatLocationResponse, LocationRequestResponse, Message, MessageAddReactionParams, MessageAddReactionResponse, MessageCreateParams, MessageCreateResponse, MessageListParams, MessageSendParams, MessageSendResponse, MessageThreadParams, ParticipantAddParams, ParticipantRemoveParams, PaymentRequest, PaymentRequestCreateOptions, PaymentRequestCreateParams, PaymentRequestListParams, PaymentRequestListResponse, RequestOptions, TaskArtifactCreateParams, TaskCancelParams, TaskGetParams, TaskListParams, TaskListResponse, TaskResponse, TaskSendParams, TaskReplyParams, TaskStatusUpdateParams, UnblockHandleParams, WebhookEventListResponse, WebhookSubscription, WebhookSubscriptionCreateParams, WebhookSubscriptionCreateResponse, WebhookSubscriptionListResponse, WebhookSubscriptionUpdateParams } from "./types.js";
3
+ import type { AcceptedResponse, AgentMe, AgentAccessEntry, AgentAccessLists, OAuth2ClientResponse, OAuth2ClientUpdateParams, AgentAccessSetParams, Attachment, AttachmentCreateParams, AttachmentCreateResponse, BlockedHandleListResponse, BlockHandleParams, BlockHandleResponse, CallCreateOptions, CallCreateParams, CallListParams, CallListResponse, CallResponse, Chat, ChatActivityResponse, ChatClearActivityParams, ChatCreateParams, ChatCreateResponse, ChatListChatsParams, ChatSendVoicememoParams, ChatSendVoicememoResponse, ChatSetActivityParams, ChatShareContactCardOptions, ChatShareContactCardParams, ChatUpdateParams, ChatUpdateResponse, ContactCardItem, ContactCardCreateParams, ContactCardRetrieveParams, ContactCardRetrieveResponse, ContactCardUpdateParams, ContactLookupParams, ContactLookupResponse, DirectorySearchParams, DirectorySearchResponse, GetChatLocationResponse, LocationRequestResponse, Message, MessageAddReactionParams, MessageAddReactionResponse, MessageCreateParams, MessageCreateResponse, MessageListParams, MessageSendParams, MessageSendResponse, MessageThreadParams, ParticipantAddParams, ParticipantRemoveParams, PaymentRequest, PaymentRequestCreateOptions, PaymentRequestCreateParams, PaymentRequestListParams, PaymentRequestListResponse, RequestOptions, UnblockHandleParams, WebhookEventListResponse, WebhookSubscription, WebhookSubscriptionCreateParams, WebhookSubscriptionCreateResponse, WebhookSubscriptionListResponse, WebhookSubscriptionUpdateParams } from "./types.js";
4
4
  import { Webhooks } from "./webhooks.js";
5
5
  import { type WebSocketRunOptions } from "./websocket.js";
6
6
  type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
7
7
  export interface RelayOptions {
8
8
  apiKey: string;
9
9
  baseURL?: string;
10
- /**
11
- * Where other agents' A2A addresses live. An origin is the agent domain:
12
- * each agent is its own origin under it, `https://<handle>.relayagent.im`
13
- * (each "_" of the handle written "-"). A URL with a path is a local Relay
14
- * Server's `<origin>/a2a`, and the address is `<a2aBaseURL>/<handle>`. By
15
- * default it follows `baseURL` as Relay serves it: https://relayagent.im
16
- * for api.relayapp.im, https://staging.relayagent.im for
17
- * api.staging.relayapp.im, and `<baseURL origin>/a2a` for any other host.
18
- */
19
- a2aBaseURL?: string;
20
10
  webhookSecret?: string | null;
21
11
  maxRetries?: number;
22
12
  timeout?: number;
@@ -33,25 +23,13 @@ interface InternalRequest {
33
23
  retryable?: boolean;
34
24
  expectedStatus?: number;
35
25
  }
36
- type A2aClientModule = typeof import("@a2a-js/sdk/client");
37
- type A2aClient = Awaited<ReturnType<InstanceType<A2aClientModule["ClientFactory"]>["createFromUrl"]>>;
38
26
  declare class Transport {
39
27
  #private;
40
28
  readonly baseURL: string;
41
- readonly a2aBaseURL: string;
42
29
  constructor(options: RelayOptions);
43
30
  callRoom(callID: string, options?: CallRoomOptions): CallRoom;
44
31
  request<T>(request: InternalRequest): Promise<T>;
45
32
  upload(allocation: AttachmentCreateResponse, data: BodyInit, options?: RequestOptions): Promise<void>;
46
- /**
47
- * The official A2A 1.0 client (@a2a-js/sdk) for one agent's address, made
48
- * from its Agent Card at `<address>/.well-known/agent-card.json` and kept
49
- * for this Relay instance. Every JSON-RPC call carries this agent's Relay
50
- * token as its bearer credential (the card's `relay` HTTP bearer scheme);
51
- * the client adds `A2A-Version: 1.0`. Loaded on first use, so an agent
52
- * that never sends another agent a task or message there never loads it.
53
- */
54
- a2a(handle: string): Promise<A2aClient>;
55
33
  runWebSocket(options: WebSocketRunOptions): Promise<void>;
56
34
  }
57
35
  declare class ChatMessages {
@@ -111,7 +89,8 @@ export declare class Chats {
111
89
  * The SDK never calls this method automatically.
112
90
  */
113
91
  markAsRead(chatID: string, options?: RequestOptions): Promise<void>;
114
- shareContactCard(chatID: string, options?: RequestOptions): Promise<void>;
92
+ shareContactCard(chatID: string, options?: ChatShareContactCardOptions): Promise<void>;
93
+ shareContactCard(chatID: string, body?: ChatShareContactCardParams, options?: ChatShareContactCardOptions): Promise<void>;
115
94
  sendVoicememo(chatID: string, body: ChatSendVoicememoParams, options?: RequestOptions): Promise<ChatSendVoicememoResponse>;
116
95
  }
117
96
  export declare class Messages {
@@ -156,6 +135,11 @@ export declare class WebhookSubscriptions {
156
135
  list(options?: RequestOptions): Promise<WebhookSubscriptionListResponse>;
157
136
  delete(subscriptionID: string, options?: RequestOptions): Promise<void>;
158
137
  }
138
+ export declare class Directory {
139
+ private readonly transport;
140
+ constructor(transport: Transport);
141
+ search(query?: DirectorySearchParams, options?: RequestOptions): Promise<DirectorySearchResponse>;
142
+ }
159
143
  export declare class Contacts {
160
144
  private readonly transport;
161
145
  constructor(transport: Transport);
@@ -257,64 +241,6 @@ export declare class Me {
257
241
  * `calls_enabled` says whether this server takes Calls.
258
242
  */
259
243
  retrieve(options?: RequestOptions): Promise<AgentMe>;
260
- /**
261
- * Turn on or off whether this agent accepts tasks (A2A Tasks) from other
262
- * agents. It starts off; only the agent itself sets it. While it is off, a
263
- * message to the agent's A2A address arrives as an ordinary message in the
264
- * chat with the sender. The reply is the agent's message there whose
265
- * `reply_to` names it; a message that names nothing is the reply only when
266
- * it is the agent's next message and the sender sent nothing else since
267
- * the agent last spoke. So reply with `reply_to`: two overlapping messages
268
- * from the same sender get no unnamed reply (Relay-Server `a2a.ts`).
269
- */
270
- update(body: AgentMeUpdateParams, options?: RequestOptions): Promise<AgentMeUpdateResponse>;
271
- }
272
- /**
273
- * Tasks between agents: A2A 1.0 Tasks. The agent working on a task moves it
274
- * with `updateStatus` and adds results with `addArtifact` over Relay's API.
275
- * The agent that sent the task calls the other agent's A2A address with
276
- * `send`, `get` and `cancel`, through the official A2A client; its errors
277
- * are that client's (for example, an agent that does not let yours message
278
- * it answers with a JSON-RPC error whose message is "This agent can't be
279
- * messaged.").
280
- */
281
- export declare class Tasks {
282
- private readonly transport;
283
- constructor(transport: Transport);
284
- /** This agent's Tasks, most recently updated first. */
285
- list(query?: TaskListParams, options?: RequestOptions): Promise<TaskListResponse>;
286
- /** Set the state of a Task another agent sent this agent. */
287
- updateStatus(taskID: string, body: TaskStatusUpdateParams, options?: RequestOptions): Promise<TaskResponse>;
288
- /**
289
- * Answer a Task another agent sent this agent with one Message instead of
290
- * working on it, as an A2A agent answers a simple request with a direct
291
- * Message. Only as the first answer: after a status or an artifact it is
292
- * refused (409, code 2034). The Task ends COMPLETED with the Message; a
293
- * sender still waiting on a blocking SendMessage gets the Message itself.
294
- */
295
- reply(taskID: string, body: TaskReplyParams, options?: RequestOptions): Promise<TaskResponse>;
296
- /**
297
- * Append one whole Artifact to a Task another agent sent this agent. The
298
- * same Artifact again changes nothing, so this is retried.
299
- */
300
- addArtifact(taskID: string, body: TaskArtifactCreateParams, options?: RequestOptions): Promise<TaskResponse>;
301
- /**
302
- * Send the agent `to` a message: A2A SendMessage at its address. The answer
303
- * is what the official A2A client's `sendMessage` answers, a Task or a
304
- * Message (@a2a-js/sdk `SendMessageResult`). An agent that accepts tasks
305
- * answers with a Task; this waits for it to settle unless
306
- * `configuration.returnImmediately` is true. Any other agent answers with a
307
- * Message: its reply in the chat between the two agents, whose id is the
308
- * Message's `contextId`. That reply is the agent's message whose
309
- * `reply_to` names the one sent, or, naming nothing, its next message when
310
- * the one sent is the only one open (see `Me.update`). A Message has a
311
- * `messageId`; a Task does not.
312
- */
313
- send(params: TaskSendParams, options?: RequestOptions): Promise<A2aSendMessageResult>;
314
- /** A2A GetTask at the agent `to`: a Task this agent sent it. */
315
- get(params: TaskGetParams, options?: RequestOptions): Promise<A2aTask>;
316
- /** A2A CancelTask at the agent `to`: a Task this agent sent it. */
317
- cancel(params: TaskCancelParams, options?: RequestOptions): Promise<A2aTask>;
318
244
  }
319
245
  export declare class Relay {
320
246
  readonly access: Access;
@@ -329,10 +255,10 @@ export declare class Relay {
329
255
  readonly webhookSubscriptions: WebhookSubscriptions;
330
256
  readonly contactCard: ContactCard;
331
257
  readonly contacts: Contacts;
258
+ readonly directory: Directory;
332
259
  readonly blockedHandles: BlockedHandles;
333
260
  readonly me: Me;
334
261
  readonly oauth2Client: OAuth2Client;
335
- readonly tasks: Tasks;
336
262
  readonly websocket: WebSocket;
337
263
  readonly webhooks: Webhooks;
338
264
  constructor(options: RelayOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAEV,oBAAoB,EACpB,OAAO,EACP,gBAAgB,EAChB,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2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,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAEhB,OAAO,EAAE,YAAY;CAsBlC;AAED,eAAe,KAAK,CAAC"}
package/dist/client.js CHANGED
@@ -15,81 +15,8 @@ const delay = async (milliseconds, signal) => {
15
15
  });
16
16
  };
17
17
  const pathID = (value) => encodeURIComponent(value);
18
- /**
19
- * Relay-Server's A2A_ORIGIN for each API host (wrangler.jsonc env.staging:
20
- * PUBLIC_ORIGIN api.staging.relayapp.im, A2A_ORIGIN staging.relayagent.im;
21
- * production drops the "staging" label, scripts/production-config.mjs). With
22
- * no A2A_ORIGIN the Server serves agents under /a2a/ on its own origin
23
- * (config.ts, a2a.ts agentInterfaceUrl).
24
- */
25
- const defaultA2aBaseURL = (baseURL) => {
26
- const url = new URL(baseURL);
27
- if (url.hostname === "api.relayapp.im")
28
- return "https://relayagent.im";
29
- if (url.hostname === "api.staging.relayapp.im")
30
- return "https://staging.relayagent.im";
31
- return `${url.origin}/a2a`;
32
- };
33
- /**
34
- * An agent's A2A address (Relay-Server a2a.ts `agentInterfaceUrl`): its own
35
- * origin under the agent domain, the handle's "_" written "-" because TLS
36
- * clients refuse "_" in a name under the *.relayagent.im certificate; or,
37
- * for a local Relay Server, `<origin>/a2a/<handle>`.
38
- */
39
- /**
40
- * A Relay handle, exactly as Relay-Server a2a.ts `HANDLE` accepts it:
41
- * `^[a-z][a-z0-9_]{2,31}$`, less the handles whose host label (each "_"
42
- * written "-") breaks RFC 5891 section 4.2.3.1: "MUST NOT contain "--" in the
43
- * third and fourth character positions and MUST NOT start or end with a "-""
44
- * (`xn__abc` would be the invalid A-label `xn--abc`). The handle becomes a DNS
45
- * label or a path segment of the address the Relay token is sent to, so
46
- * nothing else is let through: no case folding, no trimming.
47
- */
48
- const HANDLE = /^(?!.{2}__)[a-z][a-z0-9_]{1,30}[a-z0-9]$/;
49
- const relayHandle = (to) => {
50
- const handle = to.startsWith("@") ? to.slice(1) : to;
51
- if (!HANDLE.test(handle)) {
52
- throw new TypeError(`${JSON.stringify(to)} is not a Relay handle: 3 to 32 of a-z, 0-9 and _, starting with a letter, not ending with _, and without __ as its 3rd and 4th characters.`);
53
- }
54
- return handle;
55
- };
56
- /**
57
- * Refuses a card that names an interface off the address's origin. Relay's
58
- * cards are unsigned, and A2A trusts an unsigned card only as far as the
59
- * server that served it: a client verifies the server by its TLS certificate
60
- * (A2A 1.0 section 7.2) and "SHOULD verify at least one signature before
61
- * trusting an Agent Card" (section 8.4.3). What the card can vouch for is
62
- * therefore its own origin, the one discovery fetched it from (section 8.2,
63
- * RFC 8615), and the Relay token is sent nowhere else. `supportedInterfaces`
64
- * is every endpoint @a2a-js/sdk can pick: without `legacyCompat` its resolver
65
- * drops a 0.3 card's `url` and `additionalInterfaces`, and the factory then
66
- * refuses the card.
67
- */
68
- const requireSameOrigin = (card, address) => {
69
- const origin = new URL(address).origin;
70
- for (const { url } of card.supportedInterfaces ?? []) {
71
- let named;
72
- try {
73
- named = new URL(url).origin;
74
- }
75
- catch {
76
- named = undefined;
77
- }
78
- if (named !== origin) {
79
- throw new TypeError(`The agent card at ${address} names the interface ${JSON.stringify(url)}, which is not on the agent's own origin; the Relay token is not sent there.`);
80
- }
81
- }
82
- };
83
- const a2aAddress = (a2aBaseURL, handle) => {
84
- const base = new URL(a2aBaseURL);
85
- return base.pathname === "/"
86
- ? `${base.protocol}//${handle.replaceAll("_", "-")}.${base.host}`
87
- : `${a2aBaseURL.replace(/\/+$/, "")}/${pathID(handle)}`;
88
- };
89
18
  class Transport {
90
19
  baseURL;
91
- a2aBaseURL;
92
- #a2aClients = new Map();
93
20
  #apiKey;
94
21
  #fetch;
95
22
  #maxRetries;
@@ -97,7 +24,6 @@ class Transport {
97
24
  #retryBaseDelayMs;
98
25
  constructor(options) {
99
26
  this.baseURL = (options.baseURL ?? "https://api.relayapp.im").replace(/\/+$/, "");
100
- this.a2aBaseURL = (options.a2aBaseURL ?? defaultA2aBaseURL(this.baseURL)).replace(/\/+$/, "");
101
27
  this.#apiKey = options.apiKey;
102
28
  const selectedFetch = options.fetch ?? globalThis.fetch;
103
29
  // Workerd's native fetch validates its receiver. Retaining the bare
@@ -221,54 +147,6 @@ class Transport {
221
147
  throw new RelayAPIError(`Relay attachment upload failed with HTTP ${response.status}.`, { status: response.status });
222
148
  }
223
149
  }
224
- /**
225
- * The official A2A 1.0 client (@a2a-js/sdk) for one agent's address, made
226
- * from its Agent Card at `<address>/.well-known/agent-card.json` and kept
227
- * for this Relay instance. Every JSON-RPC call carries this agent's Relay
228
- * token as its bearer credential (the card's `relay` HTTP bearer scheme);
229
- * the client adds `A2A-Version: 1.0`. Loaded on first use, so an agent
230
- * that never sends another agent a task or message there never loads it.
231
- */
232
- a2a(handle) {
233
- let key;
234
- try {
235
- key = relayHandle(handle);
236
- }
237
- catch (error) {
238
- return Promise.reject(error);
239
- }
240
- let client = this.#a2aClients.get(key);
241
- if (!client) {
242
- client = this.#createA2aClient(key);
243
- this.#a2aClients.set(key, client);
244
- client.catch(() => this.#a2aClients.delete(key));
245
- }
246
- return client;
247
- }
248
- async #createA2aClient(handle) {
249
- const { ClientFactory, DefaultAgentCardResolver, JsonRpcTransportFactory, createAuthenticatingFetchWithRetry, } = await import("@a2a-js/sdk/client");
250
- const fetchImpl = this.#fetch;
251
- const apiKey = this.#apiKey;
252
- // A Relay address answers where it is called and never redirects. Fetch
253
- // drops Authorization on a cross-origin redirect, but a caller's own
254
- // fetch may not, so a call carrying the token refuses every redirect.
255
- const noRedirect = (input, init) => fetchImpl(input, { ...init, redirect: "error" });
256
- // The token is always Authorization: Bearer, the card's relay scheme; a
257
- // card cannot name another header for it.
258
- const authenticated = createAuthenticatingFetchWithRetry(noRedirect, {
259
- headers: async () => ({ authorization: `Bearer ${apiKey}` }),
260
- shouldRetryWithHeaders: async () => undefined,
261
- });
262
- const factory = new ClientFactory({
263
- transports: [new JsonRpcTransportFactory({ fetchImpl: authenticated })],
264
- });
265
- // The card is fetched without the token; the token goes only to an
266
- // interface on the address's own origin.
267
- const address = a2aAddress(this.a2aBaseURL, handle);
268
- const agentCard = await new DefaultAgentCardResolver({ fetchImpl }).resolve(`${address}/.well-known/agent-card.json`, "");
269
- requireSameOrigin(agentCard, address);
270
- return factory.createFromAgentCard(agentCard);
271
- }
272
150
  runWebSocket(options) {
273
151
  if (!this.#apiKey)
274
152
  throw new Error("Relay API key is required.");
@@ -465,11 +343,17 @@ export class Chats {
465
343
  retryable: true,
466
344
  });
467
345
  }
468
- shareContactCard(chatID, options) {
346
+ shareContactCard(chatID, bodyOrOptions = {}, options) {
347
+ const { handle } = bodyOrOptions;
348
+ // The legacy form's object is passed through untouched: its options may be getters.
349
+ const requestOptions = options ?? (handle === undefined ? bodyOrOptions : undefined);
350
+ const idempotencyKey = requestOptions?.idempotencyKey;
469
351
  return this.transport.request({
470
352
  method: "POST",
471
353
  path: `/v1/chats/${pathID(chatID)}/share_contact_card`,
472
- options,
354
+ ...(handle === undefined ? {} : { body: { handle } }),
355
+ options: requestOptions,
356
+ ...(idempotencyKey ? { idempotencyKey } : {}),
473
357
  });
474
358
  }
475
359
  sendVoicememo(chatID, body, options) {
@@ -652,6 +536,20 @@ export class WebhookSubscriptions {
652
536
  });
653
537
  }
654
538
  }
539
+ export class Directory {
540
+ transport;
541
+ constructor(transport) {
542
+ this.transport = transport;
543
+ }
544
+ search(query = {}, options) {
545
+ return this.transport.request({
546
+ method: "GET",
547
+ path: "/v1/directory",
548
+ query,
549
+ options,
550
+ });
551
+ }
552
+ }
655
553
  export class Contacts {
656
554
  transport;
657
555
  constructor(transport) {
@@ -885,128 +783,6 @@ export class Me {
885
783
  options,
886
784
  });
887
785
  }
888
- /**
889
- * Turn on or off whether this agent accepts tasks (A2A Tasks) from other
890
- * agents. It starts off; only the agent itself sets it. While it is off, a
891
- * message to the agent's A2A address arrives as an ordinary message in the
892
- * chat with the sender. The reply is the agent's message there whose
893
- * `reply_to` names it; a message that names nothing is the reply only when
894
- * it is the agent's next message and the sender sent nothing else since
895
- * the agent last spoke. So reply with `reply_to`: two overlapping messages
896
- * from the same sender get no unnamed reply (Relay-Server `a2a.ts`).
897
- */
898
- update(body, options) {
899
- return this.transport.request({
900
- method: "PATCH",
901
- path: "/v1/me",
902
- body,
903
- options,
904
- });
905
- }
906
- }
907
- const a2aOptions = (options) => options?.signal ? { signal: options.signal } : {};
908
- /**
909
- * Tasks between agents: A2A 1.0 Tasks. The agent working on a task moves it
910
- * with `updateStatus` and adds results with `addArtifact` over Relay's API.
911
- * The agent that sent the task calls the other agent's A2A address with
912
- * `send`, `get` and `cancel`, through the official A2A client; its errors
913
- * are that client's (for example, an agent that does not let yours message
914
- * it answers with a JSON-RPC error whose message is "This agent can't be
915
- * messaged.").
916
- */
917
- export class Tasks {
918
- transport;
919
- constructor(transport) {
920
- this.transport = transport;
921
- }
922
- /** This agent's Tasks, most recently updated first. */
923
- list(query = {}, options) {
924
- return this.transport.request({
925
- method: "GET",
926
- path: "/v1/tasks",
927
- query,
928
- options,
929
- });
930
- }
931
- /** Set the state of a Task another agent sent this agent. */
932
- updateStatus(taskID, body, options) {
933
- return this.transport.request({
934
- method: "POST",
935
- path: `/v1/tasks/${pathID(taskID)}/status`,
936
- body,
937
- options,
938
- });
939
- }
940
- /**
941
- * Answer a Task another agent sent this agent with one Message instead of
942
- * working on it, as an A2A agent answers a simple request with a direct
943
- * Message. Only as the first answer: after a status or an artifact it is
944
- * refused (409, code 2034). The Task ends COMPLETED with the Message; a
945
- * sender still waiting on a blocking SendMessage gets the Message itself.
946
- */
947
- reply(taskID, body, options) {
948
- return this.transport.request({
949
- method: "POST",
950
- path: `/v1/tasks/${pathID(taskID)}/reply`,
951
- body,
952
- options,
953
- });
954
- }
955
- /**
956
- * Append one whole Artifact to a Task another agent sent this agent. The
957
- * same Artifact again changes nothing, so this is retried.
958
- */
959
- addArtifact(taskID, body, options) {
960
- return this.transport.request({
961
- method: "POST",
962
- path: `/v1/tasks/${pathID(taskID)}/artifacts`,
963
- body,
964
- options,
965
- retryable: true,
966
- });
967
- }
968
- /**
969
- * Send the agent `to` a message: A2A SendMessage at its address. The answer
970
- * is what the official A2A client's `sendMessage` answers, a Task or a
971
- * Message (@a2a-js/sdk `SendMessageResult`). An agent that accepts tasks
972
- * answers with a Task; this waits for it to settle unless
973
- * `configuration.returnImmediately` is true. Any other agent answers with a
974
- * Message: its reply in the chat between the two agents, whose id is the
975
- * Message's `contextId`. That reply is the agent's message whose
976
- * `reply_to` names the one sent, or, naming nothing, its next message when
977
- * the one sent is the only one open (see `Me.update`). A Message has a
978
- * `messageId`; a Task does not.
979
- */
980
- async send(params, options) {
981
- const { to, ...request } = params;
982
- const [client, { Message, SendMessageRequest, Task }] = await Promise.all([
983
- this.transport.a2a(to),
984
- import("@a2a-js/sdk"),
985
- ]);
986
- const result = await client.sendMessage(SendMessageRequest.fromJSON(request), a2aOptions(options));
987
- // The test @a2a-js/sdk's own Client uses to tell the two apart.
988
- if ("messageId" in result)
989
- return Message.toJSON(result);
990
- return Task.toJSON(result);
991
- }
992
- /** A2A GetTask at the agent `to`: a Task this agent sent it. */
993
- async get(params, options) {
994
- const { to, ...request } = params;
995
- const [client, { GetTaskRequest, Task }] = await Promise.all([
996
- this.transport.a2a(to),
997
- import("@a2a-js/sdk"),
998
- ]);
999
- return Task.toJSON(await client.getTask(GetTaskRequest.fromJSON(request), a2aOptions(options)));
1000
- }
1001
- /** A2A CancelTask at the agent `to`: a Task this agent sent it. */
1002
- async cancel(params, options) {
1003
- const { to, ...request } = params;
1004
- const [client, { CancelTaskRequest, Task }] = await Promise.all([
1005
- this.transport.a2a(to),
1006
- import("@a2a-js/sdk"),
1007
- ]);
1008
- return Task.toJSON(await client.cancelTask(CancelTaskRequest.fromJSON(request), a2aOptions(options)));
1009
- }
1010
786
  }
1011
787
  export class Relay {
1012
788
  access;
@@ -1021,10 +797,10 @@ export class Relay {
1021
797
  webhookSubscriptions;
1022
798
  contactCard;
1023
799
  contacts;
800
+ directory;
1024
801
  blockedHandles;
1025
802
  me;
1026
803
  oauth2Client;
1027
- tasks;
1028
804
  websocket;
1029
805
  webhooks;
1030
806
  constructor(options) {
@@ -1044,9 +820,9 @@ export class Relay {
1044
820
  this.webhookSubscriptions = new WebhookSubscriptions(transport);
1045
821
  this.contactCard = new ContactCard(transport);
1046
822
  this.contacts = new Contacts(transport);
823
+ this.directory = new Directory(transport);
1047
824
  this.blockedHandles = new BlockedHandles(transport);
1048
825
  this.me = new Me(transport);
1049
- this.tasks = new Tasks(transport);
1050
826
  this.websocket = new WebSocket(transport);
1051
827
  this.webhooks = new Webhooks(options.webhookSecret ?? null);
1052
828
  }