@relaymessenger/sdk 0.3.6-staging.9 → 0.3.7-staging.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 +516 -29
- package/dist/a2ui.d.ts +111 -0
- package/dist/a2ui.d.ts.map +1 -0
- package/dist/a2ui.js +137 -0
- package/dist/a2ui.js.map +1 -0
- package/dist/calls/call-room.d.ts +110 -0
- package/dist/calls/call-room.d.ts.map +1 -0
- package/dist/calls/call-room.js +616 -0
- package/dist/calls/call-room.js.map +1 -0
- package/dist/calls/engine-werift-video.d.ts +83 -0
- package/dist/calls/engine-werift-video.d.ts.map +1 -0
- package/dist/calls/engine-werift-video.js +607 -0
- package/dist/calls/engine-werift-video.js.map +1 -0
- package/dist/calls/engine-werift.d.ts +48 -0
- package/dist/calls/engine-werift.d.ts.map +1 -0
- package/dist/calls/engine-werift.js +462 -0
- package/dist/calls/engine-werift.js.map +1 -0
- package/dist/calls/index.d.ts +11 -0
- package/dist/calls/index.d.ts.map +1 -0
- package/dist/calls/index.js +11 -0
- package/dist/calls/index.js.map +1 -0
- package/dist/calls/transport.d.ts +466 -0
- package/dist/calls/transport.d.ts.map +1 -0
- package/dist/calls/transport.js +1409 -0
- package/dist/calls/transport.js.map +1 -0
- package/dist/calls/video-frame.d.ts +56 -0
- package/dist/calls/video-frame.d.ts.map +1 -0
- package/dist/calls/video-frame.js +245 -0
- package/dist/calls/video-frame.js.map +1 -0
- package/dist/calls/video-presets.d.ts +39 -0
- package/dist/calls/video-presets.d.ts.map +1 -0
- package/dist/calls/video-presets.js +40 -0
- package/dist/calls/video-presets.js.map +1 -0
- package/dist/calls/video-rtp.d.ts +51 -0
- package/dist/calls/video-rtp.d.ts.map +1 -0
- package/dist/calls/video-rtp.js +294 -0
- package/dist/calls/video-rtp.js.map +1 -0
- package/dist/calls/video.d.ts +195 -0
- package/dist/calls/video.d.ts.map +1 -0
- package/dist/calls/video.js +228 -0
- package/dist/calls/video.js.map +1 -0
- package/dist/client.d.ts +199 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +444 -0
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +16 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/links.d.ts +17 -6
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +35 -4
- package/dist/links.js.map +1 -1
- package/dist/operations.d.ts +97 -1
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +129 -0
- package/dist/operations.js.map +1 -1
- package/dist/payment.d.ts +67 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +147 -0
- package/dist/payment.js.map +1 -0
- package/dist/reply-target.d.ts +26 -0
- package/dist/reply-target.d.ts.map +1 -0
- package/dist/reply-target.js +59 -0
- package/dist/reply-target.js.map +1 -0
- package/dist/selection.d.ts +46 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/selection.js +142 -0
- package/dist/selection.js.map +1 -0
- package/dist/types.d.ts +1113 -22
- package/dist/types.d.ts.map +1 -1
- package/dist/websocket.d.ts +6 -0
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +36 -10
- package/dist/websocket.js.map +1 -1
- package/package.json +37 -2
package/dist/types.d.ts
CHANGED
|
@@ -11,23 +11,22 @@ export interface CallContact {
|
|
|
11
11
|
handle: string;
|
|
12
12
|
kind: "user" | "agent";
|
|
13
13
|
}
|
|
14
|
+
export type CallTerminalStatus = "completed" | "no-answer" | "canceled" | "busy" | "failed";
|
|
14
15
|
export interface Call {
|
|
15
16
|
id: UUID;
|
|
16
17
|
chat_id: UUID;
|
|
17
18
|
from: CallContact;
|
|
18
19
|
to: [CallContact];
|
|
19
|
-
|
|
20
|
-
status: "ringing" | "
|
|
20
|
+
/** `ringing` and `in-progress` are live. Terminal states set `ended_at`. */
|
|
21
|
+
status: "ringing" | "in-progress" | CallTerminalStatus;
|
|
21
22
|
revision: number;
|
|
22
23
|
created_at: string;
|
|
23
24
|
ringing_at: string;
|
|
24
25
|
answered_at: string | null;
|
|
25
26
|
ended_at: string | null;
|
|
26
|
-
end_reason: "completed" | "declined" | "canceled" | "no_answer" | "disconnected" | "failed" | null;
|
|
27
27
|
}
|
|
28
28
|
export interface CallCreateParams {
|
|
29
29
|
to: [string];
|
|
30
|
-
mode: "audio";
|
|
31
30
|
}
|
|
32
31
|
export interface CallCreateOptions extends RequestOptions {
|
|
33
32
|
/** Reuse this key and request after an uncertain response. */
|
|
@@ -44,9 +43,289 @@ export interface CallListResponse {
|
|
|
44
43
|
export interface CallResponse {
|
|
45
44
|
call: Call;
|
|
46
45
|
}
|
|
46
|
+
/** A participant's published local track, named on the SFU. */
|
|
47
|
+
export type CallRoomTrackName = "audio" | "video";
|
|
48
|
+
export interface CallRoomParticipant {
|
|
49
|
+
contact_id: UUID;
|
|
50
|
+
kind: "user" | "agent";
|
|
51
|
+
attached: boolean;
|
|
52
|
+
track: "audio" | null;
|
|
53
|
+
muted: boolean;
|
|
54
|
+
connected: boolean;
|
|
55
|
+
/** Camera sending, from this participant's `userUpdate`. */
|
|
56
|
+
video?: boolean;
|
|
57
|
+
/** Tracks this participant has published: `[]` before its first offer, then `["audio"]` or `["audio", "video"]`. */
|
|
58
|
+
tracks?: CallRoomTrackName[];
|
|
59
|
+
/**
|
|
60
|
+
* The other participant's tracks this participant is receiving now: its
|
|
61
|
+
* pull answer is applied and it sent `connected` for it. Reset on restart.
|
|
62
|
+
*/
|
|
63
|
+
receiving?: CallRoomTrackName[];
|
|
64
|
+
}
|
|
65
|
+
export interface CallRoomJoinFrame {
|
|
66
|
+
type: "join";
|
|
67
|
+
}
|
|
68
|
+
export interface CallRoomPublishOfferFrame {
|
|
69
|
+
type: "offer";
|
|
70
|
+
session_description: {
|
|
71
|
+
type: "offer";
|
|
72
|
+
sdp: string;
|
|
73
|
+
};
|
|
74
|
+
/** One or two tracks, `audio` first, no duplicate names. */
|
|
75
|
+
tracks: [{
|
|
76
|
+
mid: string;
|
|
77
|
+
name: "audio";
|
|
78
|
+
}] | [{
|
|
79
|
+
mid: string;
|
|
80
|
+
name: "audio";
|
|
81
|
+
}, {
|
|
82
|
+
mid: string;
|
|
83
|
+
name: "video";
|
|
84
|
+
}] | [{
|
|
85
|
+
mid: string;
|
|
86
|
+
name: "video";
|
|
87
|
+
}];
|
|
88
|
+
/** The previous session is dead: publish on a brand-new session from a new peer connection. */
|
|
89
|
+
restart?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface CallRoomAnswerFrame {
|
|
92
|
+
type: "answer";
|
|
93
|
+
session_description: {
|
|
94
|
+
type: "answer";
|
|
95
|
+
sdp: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export interface CallRoomConnectedFrame {
|
|
99
|
+
type: "connected";
|
|
100
|
+
}
|
|
101
|
+
export interface CallRoomUserUpdateFrame {
|
|
102
|
+
type: "userUpdate";
|
|
103
|
+
muted: boolean;
|
|
104
|
+
/** Camera sending. Omitted keeps the last value. */
|
|
105
|
+
video?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface CallRoomEndFrame {
|
|
108
|
+
type: "end";
|
|
109
|
+
}
|
|
110
|
+
export interface CallRoomHeartbeatFrame {
|
|
111
|
+
type: "heartbeat";
|
|
112
|
+
}
|
|
113
|
+
export type CallRoomClientFrame = CallRoomJoinFrame | CallRoomPublishOfferFrame | CallRoomAnswerFrame | CallRoomConnectedFrame | CallRoomUserUpdateFrame | CallRoomEndFrame | CallRoomHeartbeatFrame;
|
|
114
|
+
export interface CallRoomStateFrame {
|
|
115
|
+
type: "roomState";
|
|
116
|
+
call: Call;
|
|
117
|
+
participants: [CallRoomParticipant, CallRoomParticipant];
|
|
118
|
+
}
|
|
119
|
+
export interface CallRoomServerAnswerFrame {
|
|
120
|
+
type: "answer";
|
|
121
|
+
session_description: {
|
|
122
|
+
type: "answer";
|
|
123
|
+
sdp: string;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface CallRoomSubscriptionOfferFrame {
|
|
127
|
+
type: "offer";
|
|
128
|
+
session_description: {
|
|
129
|
+
type: "offer";
|
|
130
|
+
sdp: string;
|
|
131
|
+
};
|
|
132
|
+
/** The other participant's track this renegotiation pulls. */
|
|
133
|
+
track: CallRoomTrackName;
|
|
134
|
+
}
|
|
135
|
+
export interface CallRoomEndedFrame {
|
|
136
|
+
type: "ended";
|
|
137
|
+
reason: CallTerminalStatus;
|
|
138
|
+
}
|
|
139
|
+
export type CallRoomErrorCode = "invalid_frame" | "not_allowed" | "media_unavailable";
|
|
140
|
+
export interface CallRoomErrorFrame {
|
|
141
|
+
type: "error";
|
|
142
|
+
code: CallRoomErrorCode;
|
|
143
|
+
message: string;
|
|
144
|
+
}
|
|
145
|
+
/** Standard `RTCIceServer`: STUN or TURN URLs, with credentials on TURN servers. */
|
|
146
|
+
export interface CallRoomIceServer {
|
|
147
|
+
urls: string[];
|
|
148
|
+
username?: string;
|
|
149
|
+
credential?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* STUN and TURN servers for this participant's peer connection, sent after
|
|
153
|
+
* every accepted `join` and before the first `roomState` (Orange Meets shape:
|
|
154
|
+
* Cloudflare TURN credentials minted by the server).
|
|
155
|
+
*/
|
|
156
|
+
export interface CallRoomIceServersFrame {
|
|
157
|
+
type: "iceServers";
|
|
158
|
+
ice_servers: CallRoomIceServer[];
|
|
159
|
+
}
|
|
160
|
+
export type CallRoomServerFrame = CallRoomIceServersFrame | CallRoomStateFrame | CallRoomServerAnswerFrame | CallRoomSubscriptionOfferFrame | CallRoomEndedFrame | CallRoomErrorFrame;
|
|
47
161
|
export type CallWebhookEvent = RelayWebhookEnvelope<CallResponse, "call.created" | "call.updated" | "call.ended">;
|
|
162
|
+
/** Subscription mode only. One coupon or one promotion code from your connected Stripe account, never both. */
|
|
163
|
+
export interface PaymentDiscount {
|
|
164
|
+
/** The id of a coupon on your connected Stripe account. */
|
|
165
|
+
coupon?: string;
|
|
166
|
+
/** The id of a promotion code (`promo_...`), not the code a customer types. */
|
|
167
|
+
promotion_code?: string;
|
|
168
|
+
/** Your own name for the discount, stored and returned with the request. */
|
|
169
|
+
label?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* `POST /v1/payment_requests`. Payment mode needs `amount` and `currency`;
|
|
173
|
+
* subscription mode needs `price_id` and takes the currency from the price.
|
|
174
|
+
*/
|
|
175
|
+
export interface PaymentRequestCreateParams {
|
|
176
|
+
/** Payment mode: what to charge, in the currency's minor units. */
|
|
177
|
+
amount?: number;
|
|
178
|
+
/** Payment mode: a 3-letter ISO 4217 code, returned lowercase. */
|
|
179
|
+
currency?: string;
|
|
180
|
+
/** The card's title line and the checkout's product name. Trimmed; 1 to 32 characters. */
|
|
181
|
+
description: string;
|
|
182
|
+
category: PaymentCategory;
|
|
183
|
+
/** Up to 49 keys of your own; keys starting with `relay_` are reserved. */
|
|
184
|
+
metadata?: Record<string, string>;
|
|
185
|
+
/** Defaults to `payment`. */
|
|
186
|
+
mode?: PaymentMode;
|
|
187
|
+
/** Subscription mode: an active recurring Price on your connected Stripe account. */
|
|
188
|
+
price_id?: string;
|
|
189
|
+
/** Subscription mode: units of the price. Defaults to 1. */
|
|
190
|
+
quantity?: number;
|
|
191
|
+
/** An existing Customer on your connected Stripe account (`cus_...`). */
|
|
192
|
+
customer_id?: string;
|
|
193
|
+
discount?: PaymentDiscount;
|
|
194
|
+
/** Optional HTTPS product picture; Relay copies it into its own image store. */
|
|
195
|
+
image_url?: string;
|
|
196
|
+
}
|
|
197
|
+
export interface PaymentRequestCreateOptions extends RequestOptions {
|
|
198
|
+
/** Reusing a key with the same body returns the first request (200); with a different body, 409. */
|
|
199
|
+
idempotencyKey?: string;
|
|
200
|
+
}
|
|
201
|
+
/** The ids of the Stripe objects on your connected account. */
|
|
202
|
+
export interface PaymentRequestStripe {
|
|
203
|
+
/** The one PaymentIntent the person pays (`pi_...`). */
|
|
204
|
+
payment_intent_id: string;
|
|
205
|
+
customer_id?: string;
|
|
206
|
+
/** Subscription mode (`sub_...`). */
|
|
207
|
+
subscription_id?: string;
|
|
208
|
+
}
|
|
209
|
+
export interface PaymentRequest {
|
|
210
|
+
id: UUID;
|
|
211
|
+
object: "payment_request";
|
|
212
|
+
status: PaymentStatus;
|
|
213
|
+
mode: PaymentMode;
|
|
214
|
+
/** What the person is charged at checkout, in minor units. */
|
|
215
|
+
amount: number;
|
|
216
|
+
currency: string;
|
|
217
|
+
description: string;
|
|
218
|
+
category: PaymentCategory;
|
|
219
|
+
/** Relay's pay page for this request. Send it back unchanged in a `payment` part. */
|
|
220
|
+
checkout_url: string;
|
|
221
|
+
/** 23 hours after creation; the request then moves to `expired`. */
|
|
222
|
+
expires_at: string;
|
|
223
|
+
metadata: Record<string, string>;
|
|
224
|
+
image_url?: string;
|
|
225
|
+
price_id?: string;
|
|
226
|
+
quantity?: number;
|
|
227
|
+
interval?: PaymentRecurring["interval"];
|
|
228
|
+
interval_count?: number;
|
|
229
|
+
discount?: PaymentDiscount;
|
|
230
|
+
stripe: PaymentRequestStripe;
|
|
231
|
+
/** Absent until the request succeeds. */
|
|
232
|
+
paid_at?: string;
|
|
233
|
+
created_at: string;
|
|
234
|
+
updated_at: string;
|
|
235
|
+
}
|
|
236
|
+
export interface PaymentRequestListParams {
|
|
237
|
+
cursor?: string;
|
|
238
|
+
/** 1 to 100; defaults to 20. */
|
|
239
|
+
limit?: number;
|
|
240
|
+
status?: PaymentStatus;
|
|
241
|
+
}
|
|
242
|
+
export interface PaymentRequestListResponse {
|
|
243
|
+
payment_requests: PaymentRequest[];
|
|
244
|
+
next_cursor: string | null;
|
|
245
|
+
}
|
|
246
|
+
/** `POST /v1/chats/{chatId}/location/request` answers with this once the request is in the chat. */
|
|
247
|
+
export interface LocationRequestResponse {
|
|
248
|
+
success: true;
|
|
249
|
+
message: "Location request sent";
|
|
250
|
+
}
|
|
251
|
+
/** One person sharing their location with your agent, as a GeoJSON Feature (RFC 7946). */
|
|
252
|
+
export interface LocationFeature {
|
|
253
|
+
type: "Feature";
|
|
254
|
+
geometry: {
|
|
255
|
+
type: "Point";
|
|
256
|
+
/** `[longitude, latitude]`, longitude first. */
|
|
257
|
+
coordinates: [number, number];
|
|
258
|
+
};
|
|
259
|
+
properties: {
|
|
260
|
+
/** Handle of the person sharing. */
|
|
261
|
+
handle: string;
|
|
262
|
+
/** When this position arrived. */
|
|
263
|
+
updated_at: string;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* `GET /v1/chats/{chatId}/location`: one Feature per person sharing with your
|
|
268
|
+
* agent in the chat; `features` is empty when nobody is sharing.
|
|
269
|
+
*/
|
|
270
|
+
export interface GetChatLocationResponse {
|
|
271
|
+
success: true;
|
|
272
|
+
data: {
|
|
273
|
+
type: "FeatureCollection";
|
|
274
|
+
features: LocationFeature[];
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/** `location.sharing.started`: a person started sharing their location with your agent. */
|
|
278
|
+
export interface LocationSharingStartedEvent {
|
|
279
|
+
/** Handle of the person who started sharing. */
|
|
280
|
+
shared_by: string;
|
|
281
|
+
/** Handle of your agent. */
|
|
282
|
+
shared_with: string;
|
|
283
|
+
chat_id: UUID;
|
|
284
|
+
began_at: string;
|
|
285
|
+
/** When the share ends by itself; null when it has no end. */
|
|
286
|
+
ends_at: string | null;
|
|
287
|
+
}
|
|
288
|
+
/** `location.sharing.stopped`: the person stopped sharing, or the share reached its end. */
|
|
289
|
+
export interface LocationSharingStoppedEvent {
|
|
290
|
+
/** Handle of the person who stopped sharing. */
|
|
291
|
+
shared_by: string;
|
|
292
|
+
/** Handle of your agent. */
|
|
293
|
+
shared_with: string;
|
|
294
|
+
chat_id: UUID;
|
|
295
|
+
began_at: string;
|
|
296
|
+
/** When the share ended. Equals the share's `ends_at` when it ran out. */
|
|
297
|
+
ended_at: string;
|
|
298
|
+
}
|
|
299
|
+
export type LocationSharingStartedWebhookEvent = RelayWebhookEnvelope<LocationSharingStartedEvent, "location.sharing.started">;
|
|
300
|
+
export type LocationSharingStoppedWebhookEvent = RelayWebhookEnvelope<LocationSharingStoppedEvent, "location.sharing.stopped">;
|
|
301
|
+
export type PaymentWebhookEvent = RelayWebhookEnvelope<PaymentRequest, "payment.succeeded" | "payment.canceled" | "payment.expired">;
|
|
48
302
|
export type DeliveryStatus = "sent" | "delivered" | "read";
|
|
49
303
|
export type ReactionType = "love" | "like" | "dislike" | "laugh" | "emphasize" | "question" | "custom";
|
|
304
|
+
export interface ChatActivity {
|
|
305
|
+
id: UUID;
|
|
306
|
+
text: string;
|
|
307
|
+
emoji: string | null;
|
|
308
|
+
updated_at: string;
|
|
309
|
+
expires_at: string;
|
|
310
|
+
}
|
|
311
|
+
export interface ChatActivityResponse {
|
|
312
|
+
chat_id: UUID;
|
|
313
|
+
agent_id: UUID;
|
|
314
|
+
version: string;
|
|
315
|
+
activity: ChatActivity | null;
|
|
316
|
+
}
|
|
317
|
+
export interface ChatSetActivityParams {
|
|
318
|
+
/** 1–21 visible characters, at most 1024 UTF-8 bytes. */
|
|
319
|
+
text: string;
|
|
320
|
+
/** One Unicode emoji, or null. */
|
|
321
|
+
emoji?: string | null;
|
|
322
|
+
/** Omit to start/replace; supply the current ID to refresh/update. */
|
|
323
|
+
activity_id?: UUID;
|
|
324
|
+
}
|
|
325
|
+
export interface ChatClearActivityParams {
|
|
326
|
+
/** Clear only this task. A stale or missing activity is a successful no-op. */
|
|
327
|
+
activity_id?: UUID;
|
|
328
|
+
}
|
|
50
329
|
interface ChatHandleBase {
|
|
51
330
|
id: UUID;
|
|
52
331
|
handle: string;
|
|
@@ -56,17 +335,34 @@ interface ChatHandleBase {
|
|
|
56
335
|
is_me?: boolean | null;
|
|
57
336
|
display_name: string | null;
|
|
58
337
|
image_url: string | null;
|
|
59
|
-
|
|
60
|
-
call_url?: string | null;
|
|
338
|
+
subtitle: string | null;
|
|
61
339
|
verified: boolean;
|
|
62
340
|
/** True when the caller holds this Handle as a Contact. */
|
|
63
341
|
is_contact: boolean;
|
|
342
|
+
activity_version?: string;
|
|
343
|
+
activity?: ChatActivity | null;
|
|
64
344
|
}
|
|
65
345
|
export interface UserChatHandle extends ChatHandleBase {
|
|
66
346
|
kind: "user";
|
|
67
347
|
}
|
|
348
|
+
/** Who owns an agent: its organization, or the person who owns it. */
|
|
349
|
+
export type HandleOwner = {
|
|
350
|
+
kind: "organization";
|
|
351
|
+
/** The organization's name in Relay Console. Null until it has one. */
|
|
352
|
+
name: string | null;
|
|
353
|
+
/** Whether Relay has verified the organization. */
|
|
354
|
+
verified: boolean;
|
|
355
|
+
} | {
|
|
356
|
+
kind: "user";
|
|
357
|
+
/** The owning person's Relay Handle. Null when the person has no Relay account. */
|
|
358
|
+
handle: string | null;
|
|
359
|
+
/** The owning person's display name. Null when the person has no Relay account. */
|
|
360
|
+
display_name: string | null;
|
|
361
|
+
};
|
|
68
362
|
export interface AgentChatHandle extends ChatHandleBase {
|
|
69
363
|
kind: "agent";
|
|
364
|
+
/** Who owns this agent. Null for an agent no organization or person owns. */
|
|
365
|
+
owner?: HandleOwner | null;
|
|
70
366
|
}
|
|
71
367
|
export type ChatHandle = UserChatHandle | AgentChatHandle;
|
|
72
368
|
export interface Reaction {
|
|
@@ -111,7 +407,357 @@ export interface ButtonsPart {
|
|
|
111
407
|
type: "buttons";
|
|
112
408
|
items: ButtonItem[];
|
|
113
409
|
}
|
|
114
|
-
|
|
410
|
+
/** Stable machine value and independently editable visible label. */
|
|
411
|
+
export interface SelectionOption {
|
|
412
|
+
/** Unique case-sensitive ASCII token, 1–100 characters. Never derived from label. */
|
|
413
|
+
value: string;
|
|
414
|
+
/** Trimmed visible label, 1–80 characters. */
|
|
415
|
+
label: string;
|
|
416
|
+
}
|
|
417
|
+
/** Agent-only, 1–25 options; one per Message, never with buttons. A text part is optional and shows as an ordinary bubble above the card. */
|
|
418
|
+
export interface SelectionPart {
|
|
419
|
+
type: "selection";
|
|
420
|
+
/** The question: the card's title in the chat and the sheet's title. Trimmed, 1–60 characters. */
|
|
421
|
+
title: string;
|
|
422
|
+
/** The person checks any number of options and submits them once; checking sends nothing. */
|
|
423
|
+
options: SelectionOption[];
|
|
424
|
+
}
|
|
425
|
+
export interface SelectionPartResponse extends SelectionPart {
|
|
426
|
+
/** Durable response state for this viewer across devices. Existing Chat rules allow at most one human user; only that user can respond, once; reopening an answered selection shows what they chose without letting them change it. */
|
|
427
|
+
readonly has_responded: boolean;
|
|
428
|
+
/** The values the authenticated viewer chose, in source-option order, identical on every one of that user's devices; null until the viewer answers, when the answer Message no longer exists, and always for an agent viewer. */
|
|
429
|
+
readonly selected_values: string[] | null;
|
|
430
|
+
reactions: null;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* User-only metadata after canonical text (literal '• ' + each source
|
|
434
|
+
* label, joined with '\n'), with explicit reply_to. Exact legacy comma-joined
|
|
435
|
+
* labels are accepted by the server only for compatibility, never parsed for IDs.
|
|
436
|
+
*/
|
|
437
|
+
export interface SelectionResponsePart {
|
|
438
|
+
type: "selection_response";
|
|
439
|
+
/**
|
|
440
|
+
* Unique known values, nonempty and in source-option order, authoritative with
|
|
441
|
+
* reply_to. New preceding text is literal '• ' + each source label joined with
|
|
442
|
+
* '\n'. The server accepts exact legacy comma-joined labels for compatibility
|
|
443
|
+
* only, never arbitrary label parsing. iOS may draw a checkmark in place of
|
|
444
|
+
* each bullet and repeat the prompt's title, as presentation only; portable
|
|
445
|
+
* text remains bullets.
|
|
446
|
+
*/
|
|
447
|
+
selected_values: string[];
|
|
448
|
+
}
|
|
449
|
+
/** Metadata only: contributes no visible fallback text. */
|
|
450
|
+
export interface SelectionResponsePartResponse extends SelectionResponsePart {
|
|
451
|
+
}
|
|
452
|
+
/** What is being paid for (PayPal Orders v2 `items[].category`); App Store rules decide where each is payable. */
|
|
453
|
+
export type PaymentCategory = "physical_goods" | "digital_goods" | "donation";
|
|
454
|
+
/** A payment request's lifecycle. It leaves `requested` exactly once, only on Stripe's word or your cancel. */
|
|
455
|
+
export type PaymentStatus = "requested" | "succeeded" | "canceled" | "expired";
|
|
456
|
+
/** `payment` collects one charge; `subscription` starts a Stripe subscription from a recurring price. */
|
|
457
|
+
export type PaymentMode = "payment" | "subscription";
|
|
458
|
+
/** A subscription's renewal cadence, read from its Stripe Price. */
|
|
459
|
+
export interface PaymentRecurring {
|
|
460
|
+
interval: "day" | "week" | "month" | "year";
|
|
461
|
+
/** Intervals per renewal (3 with `month` is quarterly). */
|
|
462
|
+
interval_count: number;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* A request to pay, drawn as a card. `checkout_url` is the only field: pass
|
|
466
|
+
* back exactly what `paymentRequests.create` returned. The card's amount and
|
|
467
|
+
* title are read from that request, never from the message. Sent only by the
|
|
468
|
+
* agent that created the request, while it is `requested`; it must be the only
|
|
469
|
+
* part of its message.
|
|
470
|
+
*/
|
|
471
|
+
export interface PaymentPart {
|
|
472
|
+
type: "payment";
|
|
473
|
+
/** At most 2048 characters. */
|
|
474
|
+
checkout_url: string;
|
|
475
|
+
}
|
|
476
|
+
/** A payment card as every reader sees it, read from the payment request. `status` changes in place. */
|
|
477
|
+
export interface PaymentPartResponse {
|
|
478
|
+
type: "payment";
|
|
479
|
+
payment_request_id: UUID;
|
|
480
|
+
checkout_url: string;
|
|
481
|
+
/** Minor units. For a subscription, what the first period costs. */
|
|
482
|
+
amount: number;
|
|
483
|
+
currency: string;
|
|
484
|
+
/** The card's title line. */
|
|
485
|
+
description: string;
|
|
486
|
+
category: PaymentCategory;
|
|
487
|
+
mode: PaymentMode;
|
|
488
|
+
recurring?: PaymentRecurring;
|
|
489
|
+
/** The request's product picture, when it has one. */
|
|
490
|
+
image_url?: string;
|
|
491
|
+
status: PaymentStatus;
|
|
492
|
+
/** Only a person can react to a payment. */
|
|
493
|
+
reactions: Reaction[] | null;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* The payer's receipt: Relay adds one message from the person who paid, a
|
|
497
|
+
* reply to the `payment` card, when a request succeeds. It arrives as
|
|
498
|
+
* `message.received`. Only Relay writes this part.
|
|
499
|
+
*/
|
|
500
|
+
export interface PaymentReceiptPartResponse {
|
|
501
|
+
type: "payment_receipt";
|
|
502
|
+
payment_request_id: UUID;
|
|
503
|
+
description: string;
|
|
504
|
+
/** What was paid, in minor units. For a subscription, what the first period cost. */
|
|
505
|
+
amount: number;
|
|
506
|
+
currency: string;
|
|
507
|
+
mode: PaymentMode;
|
|
508
|
+
recurring?: PaymentRecurring;
|
|
509
|
+
reactions: Reaction[] | null;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* An agent's request for the person's location, sent with
|
|
513
|
+
* `chats.location.request`. It cannot be sent as a message part. A client that
|
|
514
|
+
* does not draw it shows the Message's text, "<agent display name> requested
|
|
515
|
+
* your location".
|
|
516
|
+
*/
|
|
517
|
+
export interface LocationRequestPartResponse {
|
|
518
|
+
type: "location_request";
|
|
519
|
+
reactions: Reaction[] | null;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* A person's location share, the card the person's app draws. It carries the
|
|
523
|
+
* share's state, never its position: read the position with
|
|
524
|
+
* `chats.location.retrieve`. It cannot be sent as a message part. A share whose
|
|
525
|
+
* `ends_at` has passed reads as `ended` with `ended_at` equal to `ends_at`.
|
|
526
|
+
*/
|
|
527
|
+
export interface LocationPartResponse {
|
|
528
|
+
type: "location";
|
|
529
|
+
state: "live" | "ended";
|
|
530
|
+
began_at: string | null;
|
|
531
|
+
/** When the share ends by itself; null when it has no end. */
|
|
532
|
+
ends_at: string | null;
|
|
533
|
+
ended_at: string | null;
|
|
534
|
+
reactions: Reaction[] | null;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* A place sent once: a person's current location, a dropped pin, or a place an
|
|
538
|
+
* agent names (Relay-Server contract `PlacePart`; WhatsApp Cloud API's location
|
|
539
|
+
* fields). `name` and `address` are 1 to 256 characters after trimming.
|
|
540
|
+
*/
|
|
541
|
+
export interface PlacePart {
|
|
542
|
+
type: "place";
|
|
543
|
+
/** Latitude in degrees (WGS 84), -90 to 90. */
|
|
544
|
+
latitude: number;
|
|
545
|
+
/** Longitude in degrees (WGS 84), -180 to 180. */
|
|
546
|
+
longitude: number;
|
|
547
|
+
name?: string;
|
|
548
|
+
address?: string;
|
|
549
|
+
}
|
|
550
|
+
/** A place as its sender sent it; `name` and `address` are absent when left out. */
|
|
551
|
+
export interface PlacePartResponse extends PlacePart {
|
|
552
|
+
reactions: Reaction[] | null;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* A2UI v0.9.1 (https://a2ui.org), the messages a card is made of. The shapes
|
|
556
|
+
* are A2UI's own JSON schemas (`specification/v0_9_1/json/*.json` in
|
|
557
|
+
* google/A2UI): `server_to_client.json` for what an agent sends to draw a
|
|
558
|
+
* card, `client_to_server.json` for a tap (`action`) and an `error`. The
|
|
559
|
+
* version enum is A2UI's (`v0.9` or `v0.9.1`); Relay's contract names v0.9.1.
|
|
560
|
+
*/
|
|
561
|
+
export type A2uiVersion = "v0.9" | "v0.9.1";
|
|
562
|
+
/**
|
|
563
|
+
* One component of a surface: `id`, the catalog's `component` name, and that
|
|
564
|
+
* component's own properties, for example
|
|
565
|
+
* `{ id: "title", component: "Text", text: "Lakers win tonight?" }`. The
|
|
566
|
+
* catalog named by `createSurface.catalogId` defines them: Relay refuses a
|
|
567
|
+
* component, property or value that catalog does not define.
|
|
568
|
+
*/
|
|
569
|
+
export interface A2uiComponent {
|
|
570
|
+
id: string;
|
|
571
|
+
component: string;
|
|
572
|
+
[property: string]: unknown;
|
|
573
|
+
}
|
|
574
|
+
/** An A2UI data binding whose `path` is an absolute JSON Pointer into the surface's data model. */
|
|
575
|
+
export type A2uiAbsoluteBinding = {
|
|
576
|
+
path: `/${string}`;
|
|
577
|
+
};
|
|
578
|
+
/** A Browser card's state: `needs_you` turns it orange; `done` and `failed` shrink it to one row. */
|
|
579
|
+
export type A2uiBrowserState = "working" | "needs_you" | "done" | "failed";
|
|
580
|
+
/**
|
|
581
|
+
* Relay's `Browser` component (`A2uiBrowserComponent` in the contract), in
|
|
582
|
+
* Relay's catalog only: your agent's live browser, drawn as Relay's Browser
|
|
583
|
+
* card with the title "Browser", the `status` line, the still in `imageUrl`,
|
|
584
|
+
* and "Open browser", which opens `watchUrl` read-only. With `controlUrl` the
|
|
585
|
+
* person can take control. Every URL is https; `status` is 1 to 80
|
|
586
|
+
* characters. Each may instead be bound to the data model.
|
|
587
|
+
*/
|
|
588
|
+
export type A2uiBrowserComponent = {
|
|
589
|
+
id: string;
|
|
590
|
+
component: "Browser";
|
|
591
|
+
status: string | A2uiAbsoluteBinding;
|
|
592
|
+
state: A2uiBrowserState;
|
|
593
|
+
watchUrl: string | A2uiAbsoluteBinding;
|
|
594
|
+
controlUrl?: string | A2uiAbsoluteBinding;
|
|
595
|
+
imageUrl?: string | A2uiAbsoluteBinding;
|
|
596
|
+
accessibility?: {
|
|
597
|
+
label?: unknown;
|
|
598
|
+
description?: unknown;
|
|
599
|
+
};
|
|
600
|
+
weight?: number;
|
|
601
|
+
};
|
|
602
|
+
/** The `name` of a tap on a Browser card (`A2uiBrowserActionName` in the contract). */
|
|
603
|
+
export type A2uiBrowserActionName = "browser.takeControl" | "browser.returnControl" | "browser.stop";
|
|
604
|
+
/** A2UI `createSurface`: starts a surface drawn by the Message that carries it. */
|
|
605
|
+
export interface A2uiCreateSurfaceMessage {
|
|
606
|
+
version: A2uiVersion;
|
|
607
|
+
createSurface: {
|
|
608
|
+
surfaceId: string;
|
|
609
|
+
/** A catalog Relay draws; see `A2uiClientCapabilities`. */
|
|
610
|
+
catalogId: string;
|
|
611
|
+
/** Theme values the catalog defines, for example `{ primaryColor: "#FF0000" }`. */
|
|
612
|
+
theme?: Record<string, unknown>;
|
|
613
|
+
/** When true, every tap on the surface carries the surface's data model in `metadata.a2uiClientDataModel`. */
|
|
614
|
+
sendDataModel?: boolean;
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
/** A2UI `updateComponents`: adds or replaces components by `id`. A surface's first update holds the component with the id `root`. */
|
|
618
|
+
export interface A2uiUpdateComponentsMessage {
|
|
619
|
+
version: A2uiVersion;
|
|
620
|
+
updateComponents: {
|
|
621
|
+
surfaceId: string;
|
|
622
|
+
components: A2uiComponent[];
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* A2UI `updateDataModel`: replaces (or creates) the value at `path`, a JSON
|
|
627
|
+
* Pointer; no `path`, or `/`, is the whole data model. No `value` removes the
|
|
628
|
+
* key at `path`.
|
|
629
|
+
*/
|
|
630
|
+
export interface A2uiUpdateDataModelMessage {
|
|
631
|
+
version: A2uiVersion;
|
|
632
|
+
updateDataModel: {
|
|
633
|
+
surfaceId: string;
|
|
634
|
+
path?: string;
|
|
635
|
+
value?: unknown;
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
/** A2UI `deleteSurface`: removes the surface for everyone. */
|
|
639
|
+
export interface A2uiDeleteSurfaceMessage {
|
|
640
|
+
version: A2uiVersion;
|
|
641
|
+
deleteSurface: {
|
|
642
|
+
surfaceId: string;
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
/** What an agent sends to draw, change or remove a card (A2UI `server_to_client.json`). */
|
|
646
|
+
export type A2uiServerToClientMessage = A2uiCreateSurfaceMessage | A2uiUpdateComponentsMessage | A2uiUpdateDataModelMessage | A2uiDeleteSurfaceMessage;
|
|
647
|
+
/** The body of an A2UI `action` message: a tap on a Button, or on a Browser card. */
|
|
648
|
+
export interface A2uiAction {
|
|
649
|
+
/** The Button's `action.event.name`, or one of `A2uiBrowserActionName`. */
|
|
650
|
+
name: string;
|
|
651
|
+
surfaceId: string;
|
|
652
|
+
/** The `id` of the Button or Browser that was tapped. */
|
|
653
|
+
sourceComponentId: string;
|
|
654
|
+
/** ISO 8601 time of the tap. */
|
|
655
|
+
timestamp: string;
|
|
656
|
+
/** The Button's `action.event.context`, with every data binding resolved. */
|
|
657
|
+
context: Record<string, unknown>;
|
|
658
|
+
}
|
|
659
|
+
/** A2UI `action`: a person (or an agent) tapped a Button on a surface. */
|
|
660
|
+
export interface A2uiActionMessage {
|
|
661
|
+
version: A2uiVersion;
|
|
662
|
+
action: A2uiAction;
|
|
663
|
+
}
|
|
664
|
+
/** A2UI's validation error: `path` is a JSON Pointer to the field that failed. */
|
|
665
|
+
export interface A2uiValidationError {
|
|
666
|
+
code: "VALIDATION_FAILED";
|
|
667
|
+
surfaceId: string;
|
|
668
|
+
path: string;
|
|
669
|
+
message: string;
|
|
670
|
+
}
|
|
671
|
+
/** A2UI's generic error: any other `code`. */
|
|
672
|
+
export interface A2uiGenericError {
|
|
673
|
+
code: string;
|
|
674
|
+
surfaceId: string;
|
|
675
|
+
message: string;
|
|
676
|
+
[property: string]: unknown;
|
|
677
|
+
}
|
|
678
|
+
/** A2UI `error`: a renderer (or an agent) reports that it could not use a message. */
|
|
679
|
+
export interface A2uiErrorMessage {
|
|
680
|
+
version: A2uiVersion;
|
|
681
|
+
error: A2uiValidationError | A2uiGenericError;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* A2UI's `error` message in its validation format, as Relay writes it for a
|
|
685
|
+
* message it did not apply. `surfaceId` is empty when the message named none;
|
|
686
|
+
* `path` points inside the failing message's body, as in A2UI's own example
|
|
687
|
+
* `/components/0/text`, and is empty when the whole message is at fault.
|
|
688
|
+
*/
|
|
689
|
+
export interface A2uiValidationErrorMessage {
|
|
690
|
+
version: "v0.9.1";
|
|
691
|
+
error: A2uiValidationError;
|
|
692
|
+
}
|
|
693
|
+
/** One A2UI message of a send that Relay did not apply, where it sits in the request, and A2UI's `error` message for it. */
|
|
694
|
+
export interface A2uiFailure {
|
|
695
|
+
/** The data part's index in `parts`; null when the fault is in `metadata.a2uiClientDataModel`. */
|
|
696
|
+
part_index: number | null;
|
|
697
|
+
/** The message's index in that part's `data`; null when the part itself, or the metadata, is at fault. */
|
|
698
|
+
data_index: number | null;
|
|
699
|
+
a2ui_message: A2uiValidationErrorMessage;
|
|
700
|
+
}
|
|
701
|
+
/** What a renderer sends back (A2UI `client_to_server.json`). */
|
|
702
|
+
export type A2uiClientToServerMessage = A2uiActionMessage | A2uiErrorMessage;
|
|
703
|
+
/** Any A2UI v0.9.1 message a data part may carry. */
|
|
704
|
+
export type A2uiMessage = A2uiServerToClientMessage | A2uiClientToServerMessage;
|
|
705
|
+
/**
|
|
706
|
+
* A data part holding A2UI v0.9.1 messages, in order: Relay's REST shape of
|
|
707
|
+
* A2A's DataPart. A Message may carry any number of data parts beside its
|
|
708
|
+
* other parts. Relay applies each A2UI message on its own, checked against
|
|
709
|
+
* A2UI's schemas and the surface's catalog: the ones that fail come back in
|
|
710
|
+
* the response's `a2ui_errors`, and a send that applies nothing is refused
|
|
711
|
+
* (404, 409 or 422) with `a2ui_errors` in the error body. Only an agent sends
|
|
712
|
+
* `createSurface`, `updateComponents`, `updateDataModel` and `deleteSurface`;
|
|
713
|
+
* a send that only changes an earlier card adds no Message and returns that
|
|
714
|
+
* card. An `action` or `error` reaches only its sender and the agent that
|
|
715
|
+
* created the surface it names.
|
|
716
|
+
*/
|
|
717
|
+
export interface DataPart {
|
|
718
|
+
type: "data";
|
|
719
|
+
media_type: "application/a2ui+json";
|
|
720
|
+
data: A2uiMessage[];
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* A data part as a reader receives it: the `action` and `error` messages it
|
|
724
|
+
* carried, as sent, when the reader sent them or created the surface they
|
|
725
|
+
* name; then, for each surface it created, every A2UI message accepted for
|
|
726
|
+
* that surface since, in order. Replay the list to draw the card.
|
|
727
|
+
*/
|
|
728
|
+
export interface DataPartResponse extends DataPart {
|
|
729
|
+
reactions: Reaction[] | null;
|
|
730
|
+
}
|
|
731
|
+
/** A2UI's `a2uiClientDataModel` (`client_data_model.json`): each surface's data model, by surface id. */
|
|
732
|
+
export interface A2uiClientDataModel {
|
|
733
|
+
version: A2uiVersion;
|
|
734
|
+
surfaces: Record<string, Record<string, unknown>>;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* A2UI's `a2uiClientCapabilities` (`client_capabilities.json`, keyed by the
|
|
738
|
+
* protocol family `v0.9`): the catalogs Relay's app draws, in order of
|
|
739
|
+
* preference. Relay's catalog (`RELAY_A2UI_CATALOG_ID`) is every basic catalog
|
|
740
|
+
* component and function plus `PaymentRequest`.
|
|
741
|
+
*/
|
|
742
|
+
export interface A2uiClientCapabilities {
|
|
743
|
+
"v0.9": {
|
|
744
|
+
supportedCatalogIds: string[];
|
|
745
|
+
inlineCatalogs?: Array<Record<string, unknown>>;
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* A2A Message metadata. A tap on a surface that set `sendDataModel` carries
|
|
750
|
+
* `a2uiClientDataModel`. Each surface's data model reaches only the sender and
|
|
751
|
+
* the agent that created that surface, unchanged.
|
|
752
|
+
*/
|
|
753
|
+
export interface MessageMetadata {
|
|
754
|
+
a2uiClientDataModel?: A2uiClientDataModel;
|
|
755
|
+
}
|
|
756
|
+
/** The metadata on every `message.received`: the reader's A2UI catalogs, and the sender's data model for the surfaces this agent created, when it sent one. */
|
|
757
|
+
export interface MessageReceivedMetadata extends MessageMetadata {
|
|
758
|
+
a2uiClientCapabilities: A2uiClientCapabilities;
|
|
759
|
+
}
|
|
760
|
+
export type MessagePart = TextPart | MediaPart | LinkPart | ButtonsPart | SelectionPart | SelectionResponsePart | PaymentPart | DataPart | PlacePart;
|
|
115
761
|
export interface TextPartResponse extends TextPart {
|
|
116
762
|
mentions?: Array<{
|
|
117
763
|
id: string;
|
|
@@ -153,12 +799,14 @@ export interface TypingIndicatorWebhookData {
|
|
|
153
799
|
chat_id: UUID;
|
|
154
800
|
contact: TypingContact;
|
|
155
801
|
}
|
|
156
|
-
export type SystemEventType = "chat_created" | "participant_added" | "participant_removed" | "group_name_updated" | "group_icon_updated" | "contact_card_shared" | "
|
|
802
|
+
export type SystemEventType = "chat_created" | "participant_added" | "participant_removed" | "group_name_updated" | "group_icon_updated" | "contact_card_shared" | "call";
|
|
157
803
|
export interface CallMarker {
|
|
158
804
|
id: UUID;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
805
|
+
status: Call["status"];
|
|
806
|
+
answered_at: string | null;
|
|
807
|
+
ended_at: string | null;
|
|
808
|
+
from: CallContact;
|
|
809
|
+
to: [CallContact];
|
|
162
810
|
duration_seconds: number | null;
|
|
163
811
|
}
|
|
164
812
|
export interface SystemEvent {
|
|
@@ -175,9 +823,10 @@ export interface SystemPartResponse {
|
|
|
175
823
|
value: string;
|
|
176
824
|
reactions: null;
|
|
177
825
|
}
|
|
178
|
-
export type MessagePartResponse = TextPartResponse | MediaPartResponse | LinkPartResponse | ButtonsPartResponse | SystemPartResponse;
|
|
826
|
+
export type MessagePartResponse = TextPartResponse | MediaPartResponse | LinkPartResponse | ButtonsPartResponse | SelectionPartResponse | SelectionResponsePartResponse | PaymentPartResponse | PaymentReceiptPartResponse | DataPartResponse | LocationRequestPartResponse | LocationPartResponse | PlacePartResponse | SystemPartResponse;
|
|
179
827
|
/** Ordinary replies target text, media, or link, never system. A buttons part
|
|
180
|
-
* accepts only a tap: one text part equal to one of its plain labels.
|
|
828
|
+
* accepts only a tap: one text part equal to one of its plain labels. A selection
|
|
829
|
+
* requires explicit part_index and exactly text then selection_response metadata. */
|
|
181
830
|
export interface ReplyTo {
|
|
182
831
|
message_id: UUID;
|
|
183
832
|
part_index?: number;
|
|
@@ -185,6 +834,11 @@ export interface ReplyTo {
|
|
|
185
834
|
export interface MessageContent {
|
|
186
835
|
parts: MessagePart[];
|
|
187
836
|
reply_to?: ReplyTo;
|
|
837
|
+
/**
|
|
838
|
+
* A2A Message metadata. A tap (an A2UI `action`) on a surface that set
|
|
839
|
+
* `sendDataModel` must carry `a2uiClientDataModel`.
|
|
840
|
+
*/
|
|
841
|
+
metadata?: MessageMetadata;
|
|
188
842
|
idempotency_key?: string;
|
|
189
843
|
/**
|
|
190
844
|
* Send the Message with no banner and no sound on the recipient's device.
|
|
@@ -195,7 +849,7 @@ export interface MessageContent {
|
|
|
195
849
|
}
|
|
196
850
|
/**
|
|
197
851
|
* The Message a send returns. A send never produces a system Message, so its
|
|
198
|
-
* parts
|
|
852
|
+
* parts exclude system parts, and it carries no `system_event`.
|
|
199
853
|
* `is_system_message` is on the wire and is always `false` here; the contract's
|
|
200
854
|
* `SentMessage` does not declare it yet.
|
|
201
855
|
* Read paths (`chats.messages.list`, `messages.listMessagesThread`) return
|
|
@@ -203,7 +857,8 @@ export interface MessageContent {
|
|
|
203
857
|
*/
|
|
204
858
|
export interface SentMessage {
|
|
205
859
|
id: UUID;
|
|
206
|
-
parts: Array<TextPartResponse | MediaPartResponse | LinkPartResponse | ButtonsPartResponse>;
|
|
860
|
+
parts: Array<TextPartResponse | MediaPartResponse | LinkPartResponse | ButtonsPartResponse | SelectionPartResponse | SelectionResponsePartResponse | PaymentPartResponse | PaymentReceiptPartResponse | DataPartResponse | LocationRequestPartResponse | LocationPartResponse | PlacePartResponse>;
|
|
861
|
+
metadata?: MessageMetadata;
|
|
207
862
|
created_at: string;
|
|
208
863
|
sent_at: string | null;
|
|
209
864
|
delivered_at?: string | null;
|
|
@@ -224,6 +879,7 @@ export interface Message {
|
|
|
224
879
|
from_handle?: ChatHandle | null;
|
|
225
880
|
parts?: MessagePartResponse[] | null;
|
|
226
881
|
reply_to?: ReplyTo | null;
|
|
882
|
+
metadata?: MessageMetadata;
|
|
227
883
|
is_system_message: boolean;
|
|
228
884
|
system_event?: SystemEvent | null;
|
|
229
885
|
is_from_me: boolean;
|
|
@@ -274,6 +930,11 @@ export interface ChatCreateParams {
|
|
|
274
930
|
message: MessageContent;
|
|
275
931
|
}
|
|
276
932
|
export interface ChatCreateResponse {
|
|
933
|
+
/**
|
|
934
|
+
* The A2UI messages of the send that were not applied, each with its place
|
|
935
|
+
* in the request and A2UI's `error` message for it. The rest was applied.
|
|
936
|
+
*/
|
|
937
|
+
a2ui_errors?: A2uiFailure[];
|
|
277
938
|
chat: Pick<Chat, "id" | "display_name" | "is_group" | "handles"> & {
|
|
278
939
|
message: SentMessage;
|
|
279
940
|
};
|
|
@@ -314,6 +975,11 @@ export interface MessageSendParams {
|
|
|
314
975
|
message: MessageContent;
|
|
315
976
|
}
|
|
316
977
|
export interface MessageSendResponse {
|
|
978
|
+
/**
|
|
979
|
+
* The A2UI messages of the send that were not applied, each with its place
|
|
980
|
+
* in the request and A2UI's `error` message for it. The rest was applied.
|
|
981
|
+
*/
|
|
982
|
+
a2ui_errors?: A2uiFailure[];
|
|
317
983
|
chat_id: UUID;
|
|
318
984
|
message: SentMessage;
|
|
319
985
|
}
|
|
@@ -323,6 +989,11 @@ export interface MessageCreateParams {
|
|
|
323
989
|
"Idempotency-Key"?: string;
|
|
324
990
|
}
|
|
325
991
|
export interface MessageCreateResponse {
|
|
992
|
+
/**
|
|
993
|
+
* The A2UI messages of the send that were not applied, each with its place
|
|
994
|
+
* in the request and A2UI's `error` message for it. The rest was applied.
|
|
995
|
+
*/
|
|
996
|
+
a2ui_errors?: A2uiFailure[];
|
|
326
997
|
from: string;
|
|
327
998
|
chat_id: UUID;
|
|
328
999
|
created_new_chat: boolean;
|
|
@@ -341,7 +1012,11 @@ export interface MessageListParams {
|
|
|
341
1012
|
order?: "asc" | "desc";
|
|
342
1013
|
}
|
|
343
1014
|
export type MessageThreadParams = MessageListParams;
|
|
344
|
-
/**
|
|
1015
|
+
/**
|
|
1016
|
+
* Target text, media, link, or payment; buttons, selection, selection_response
|
|
1017
|
+
* and system cannot receive reactions. Only a person can react to a payment;
|
|
1018
|
+
* an agent reacting to one gets a 403.
|
|
1019
|
+
*/
|
|
345
1020
|
export interface MessageAddReactionParams {
|
|
346
1021
|
operation: "add" | "remove";
|
|
347
1022
|
type: ReactionType;
|
|
@@ -448,13 +1123,93 @@ export interface WebhookSubscriptionUpdateParams {
|
|
|
448
1123
|
export interface WebhookSubscriptionListResponse {
|
|
449
1124
|
subscriptions: WebhookSubscription[];
|
|
450
1125
|
}
|
|
1126
|
+
/** Where the directory files the agent. */
|
|
1127
|
+
export type AgentCategory = "productivity" | "business" | "finance" | "shopping" | "travel" | "health-fitness" | "lifestyle" | "social" | "education" | "entertainment" | "utilities" | "developer-tools";
|
|
1128
|
+
/**
|
|
1129
|
+
* `public` agents are listed in the directory and found by task; `unlisted`
|
|
1130
|
+
* agents answer by handle only.
|
|
1131
|
+
*/
|
|
1132
|
+
export type AgentVisibility = "public" | "unlisted";
|
|
1133
|
+
/** One thing the agent does, in the A2A AgentSkill shape. */
|
|
1134
|
+
export interface AgentSkill {
|
|
1135
|
+
id: string;
|
|
1136
|
+
name: string;
|
|
1137
|
+
description: string;
|
|
1138
|
+
tags: string[];
|
|
1139
|
+
examples: string[];
|
|
1140
|
+
}
|
|
1141
|
+
export interface ContactLookup {
|
|
1142
|
+
id: UUID;
|
|
1143
|
+
handle: string;
|
|
1144
|
+
display_name: string;
|
|
1145
|
+
kind: "user" | "agent";
|
|
1146
|
+
image_url: string | null;
|
|
1147
|
+
image_color: string | null;
|
|
1148
|
+
verified: boolean;
|
|
1149
|
+
/** The agent's name. Agents only. */
|
|
1150
|
+
name?: string;
|
|
1151
|
+
/** The one line under the agent's name. Agents only. */
|
|
1152
|
+
subtitle?: string | null;
|
|
1153
|
+
/** The agent's paragraph. Agents only. */
|
|
1154
|
+
description?: string | null;
|
|
1155
|
+
/** Where the directory files the agent. Agents only. */
|
|
1156
|
+
category?: AgentCategory | null;
|
|
1157
|
+
/** What the agent does, at most ten skills. Agents only. */
|
|
1158
|
+
skills?: AgentSkill[];
|
|
1159
|
+
/** Whether the agent is listed in the directory. Agents only. */
|
|
1160
|
+
visibility?: AgentVisibility;
|
|
1161
|
+
/**
|
|
1162
|
+
* Who made the agent: its organization, by the name the organization gave
|
|
1163
|
+
* in the Relay Console. Null when the organization has not given a name.
|
|
1164
|
+
* Agents only.
|
|
1165
|
+
*/
|
|
1166
|
+
creator?: AgentCreator | null;
|
|
1167
|
+
/**
|
|
1168
|
+
* Handle lookups only. Whether the caller may start a Chat with this
|
|
1169
|
+
* contact now, by the same rule a send applies. Reading it changes nothing.
|
|
1170
|
+
*/
|
|
1171
|
+
can_message?: boolean;
|
|
1172
|
+
}
|
|
1173
|
+
/** The organization that made an agent. */
|
|
1174
|
+
export interface AgentCreator {
|
|
1175
|
+
kind: "organization";
|
|
1176
|
+
name: string;
|
|
1177
|
+
/** The maker's Relay Handle. Null until Relay stores one. */
|
|
1178
|
+
handle: string | null;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Look up one contact by Relay Handle, or find public agents by task. Send
|
|
1182
|
+
* exactly one of the two.
|
|
1183
|
+
*/
|
|
1184
|
+
export type ContactLookupParams =
|
|
1185
|
+
/** Relay Handle, trimmed and lowercased by the Server before validation. */
|
|
1186
|
+
{
|
|
1187
|
+
handle: string;
|
|
1188
|
+
}
|
|
1189
|
+
/** What you need done, in plain words; at most 200 characters. */
|
|
1190
|
+
| {
|
|
1191
|
+
task: string;
|
|
1192
|
+
};
|
|
1193
|
+
/**
|
|
1194
|
+
* A handle lookup answers with one `contact`; a task search answers with
|
|
1195
|
+
* `contacts`, verified agents first and at most twenty, empty when nothing
|
|
1196
|
+
* matches.
|
|
1197
|
+
*/
|
|
1198
|
+
export type ContactLookupResponse = {
|
|
1199
|
+
contact: ContactLookup;
|
|
1200
|
+
} | {
|
|
1201
|
+
contacts: ContactLookup[];
|
|
1202
|
+
};
|
|
451
1203
|
export interface ContactCardItem {
|
|
452
|
-
|
|
1204
|
+
/** Detailed agent description, up to 2000 characters. Public agents cannot clear it. */
|
|
1205
|
+
description?: string | null;
|
|
453
1206
|
handle: string;
|
|
454
1207
|
first_name: string;
|
|
455
1208
|
last_name: string | null;
|
|
456
1209
|
image_url: string | null;
|
|
457
1210
|
is_active: boolean;
|
|
1211
|
+
/** Whether Relay has verified this agent. Always false for a user. */
|
|
1212
|
+
is_verified?: boolean;
|
|
458
1213
|
kind: "user" | "agent";
|
|
459
1214
|
}
|
|
460
1215
|
export interface ContactCardCreateParams {
|
|
@@ -474,9 +1229,10 @@ export interface ContactCardRetrieveResponse {
|
|
|
474
1229
|
contact_cards: ContactCardItem[];
|
|
475
1230
|
}
|
|
476
1231
|
export interface ContactCardUpdateParams {
|
|
477
|
-
/**
|
|
478
|
-
|
|
479
|
-
|
|
1232
|
+
/** Detailed agent description, up to 2000 characters. Public agents cannot clear it. */
|
|
1233
|
+
description?: string | null;
|
|
1234
|
+
/** The one line under the name, 1 to 60 characters. */
|
|
1235
|
+
subtitle?: string;
|
|
480
1236
|
handle: string;
|
|
481
1237
|
first_name?: string;
|
|
482
1238
|
last_name?: string | null;
|
|
@@ -505,6 +1261,26 @@ export interface BlockHandleResponse {
|
|
|
505
1261
|
export interface UnblockHandleParams {
|
|
506
1262
|
handle: string;
|
|
507
1263
|
}
|
|
1264
|
+
/** `allow` is Always Allow; `deny` is Never Allow. */
|
|
1265
|
+
export type AgentAccessRule = "allow" | "deny";
|
|
1266
|
+
/**
|
|
1267
|
+
* The authenticated agent's Always Allow and Never Allow lists, newest first.
|
|
1268
|
+
* A contact on Always Allow may start a Chat with the agent whatever its
|
|
1269
|
+
* owner set for people and other agents; a contact on Never Allow may not.
|
|
1270
|
+
* The agent's owner is always allowed and is on neither list.
|
|
1271
|
+
*/
|
|
1272
|
+
export interface AgentAccessLists {
|
|
1273
|
+
allow: ContactLookup[];
|
|
1274
|
+
deny: ContactLookup[];
|
|
1275
|
+
}
|
|
1276
|
+
export interface AgentAccessSetParams {
|
|
1277
|
+
rule: AgentAccessRule;
|
|
1278
|
+
}
|
|
1279
|
+
/** The contact, and the one list it is now on. */
|
|
1280
|
+
export interface AgentAccessEntry {
|
|
1281
|
+
rule: AgentAccessRule;
|
|
1282
|
+
contact: ContactLookup;
|
|
1283
|
+
}
|
|
508
1284
|
export interface WebSocketReadyFrame {
|
|
509
1285
|
type: "ready";
|
|
510
1286
|
connection_id: UUID;
|
|
@@ -572,6 +1348,13 @@ export interface MessageWebhookData {
|
|
|
572
1348
|
*/
|
|
573
1349
|
silent?: boolean;
|
|
574
1350
|
reply_to?: ReplyTo | null;
|
|
1351
|
+
/**
|
|
1352
|
+
* A2A Message metadata. Every `message.received` carries it, with the
|
|
1353
|
+
* reader's `a2uiClientCapabilities` and, when the sender sent one, its
|
|
1354
|
+
* `a2uiClientDataModel` for the surfaces this agent created (see
|
|
1355
|
+
* `MessageReceivedMetadata`).
|
|
1356
|
+
*/
|
|
1357
|
+
metadata?: Partial<MessageReceivedMetadata>;
|
|
575
1358
|
}
|
|
576
1359
|
/**
|
|
577
1360
|
* `message.failed`. Relay commits a Message before it answers, so a Message
|
|
@@ -621,8 +1404,8 @@ export type ContactAddedWebhookEvent = ContactAddedWebhook;
|
|
|
621
1404
|
export type ContactRemovedWebhookEvent = ContactRemovedWebhook;
|
|
622
1405
|
type MessageWebhookEventType = "message.sent" | "message.received" | "message.read" | "message.delivered";
|
|
623
1406
|
type TypingIndicatorWebhookEventType = "chat.typing_indicator.started" | "chat.typing_indicator.stopped";
|
|
624
|
-
type OtherWebhookEventType = Exclude<WebhookEventType, MessageWebhookEventType | TypingIndicatorWebhookEventType | "contact.added" | "contact.removed" | "message.failed" | "call.created" | "call.updated" | "call.ended">;
|
|
625
|
-
export type RelayWebhookEvent = RelayWebhookEnvelope<MessageWebhookData, MessageWebhookEventType> | RelayWebhookEnvelope<TypingIndicatorWebhookData, TypingIndicatorWebhookEventType> | MessageFailedWebhook | ContactAddedWebhookEvent | ContactRemovedWebhookEvent | CallWebhookEvent | RelayWebhookEnvelope<Record<string, unknown>, OtherWebhookEventType>;
|
|
1407
|
+
type OtherWebhookEventType = Exclude<WebhookEventType, MessageWebhookEventType | TypingIndicatorWebhookEventType | "contact.added" | "contact.removed" | "message.failed" | "call.created" | "call.updated" | "call.ended" | "payment.succeeded" | "payment.canceled" | "payment.expired" | "location.sharing.started" | "location.sharing.stopped" | "task.created" | "task.message" | "task.canceled" | "task.updated">;
|
|
1408
|
+
export type RelayWebhookEvent = RelayWebhookEnvelope<MessageWebhookData, MessageWebhookEventType> | RelayWebhookEnvelope<TypingIndicatorWebhookData, TypingIndicatorWebhookEventType> | MessageFailedWebhook | ContactAddedWebhookEvent | ContactRemovedWebhookEvent | CallWebhookEvent | PaymentWebhookEvent | LocationSharingStartedWebhookEvent | LocationSharingStoppedWebhookEvent | TaskCreatedWebhookEvent | TaskMessageWebhookEvent | TaskCanceledWebhookEvent | TaskUpdatedWebhookEvent | RelayWebhookEnvelope<Record<string, unknown>, OtherWebhookEventType>;
|
|
626
1409
|
/** Existing Relay avatar gradient pairs, ordered top then base. */
|
|
627
1410
|
export type AgentImageGradient = readonly ["EC8A3C", "C85F1C"] | readonly ["E0567A", "AD2A52"] | readonly ["D05FC6", "93217E"] | readonly ["8F6CF2", "5F38CF"] | readonly ["5B9BFA", "0B52C0"] | readonly ["2596A6", "116A79"] | readonly ["2FA46A", "137347"];
|
|
628
1411
|
export interface AgentImageBackground {
|
|
@@ -659,5 +1442,313 @@ export interface AgentPhotoImageRecipe {
|
|
|
659
1442
|
background?: never;
|
|
660
1443
|
}
|
|
661
1444
|
export type AgentImageRecipe = AgentMonogramImageRecipe | AgentEmojiImageRecipe | AgentPhotoImageRecipe;
|
|
1445
|
+
/** a2a.proto `TaskState`, without TASK_STATE_UNSPECIFIED. */
|
|
1446
|
+
export type A2aTaskState = "TASK_STATE_SUBMITTED" | "TASK_STATE_WORKING" | "TASK_STATE_COMPLETED" | "TASK_STATE_FAILED" | "TASK_STATE_CANCELED" | "TASK_STATE_INPUT_REQUIRED" | "TASK_STATE_REJECTED" | "TASK_STATE_AUTH_REQUIRED";
|
|
1447
|
+
/** a2a.proto `Part`: exactly one of `text`, `raw` (base64), `url` or `data`. */
|
|
1448
|
+
export interface A2aPart {
|
|
1449
|
+
text?: string;
|
|
1450
|
+
/** Base64 file bytes. */
|
|
1451
|
+
raw?: string;
|
|
1452
|
+
url?: string;
|
|
1453
|
+
/** Any JSON value. */
|
|
1454
|
+
data?: unknown;
|
|
1455
|
+
metadata?: Record<string, unknown>;
|
|
1456
|
+
filename?: string;
|
|
1457
|
+
mediaType?: string;
|
|
1458
|
+
}
|
|
1459
|
+
/** a2a.proto `Message`. */
|
|
1460
|
+
export interface A2aMessage {
|
|
1461
|
+
messageId: string;
|
|
1462
|
+
contextId?: string;
|
|
1463
|
+
taskId?: string;
|
|
1464
|
+
/** ROLE_USER from the agent that sent the task or message, ROLE_AGENT from the agent that answers. */
|
|
1465
|
+
role: "ROLE_USER" | "ROLE_AGENT";
|
|
1466
|
+
/** 1 to 100 parts. */
|
|
1467
|
+
parts: A2aPart[];
|
|
1468
|
+
metadata?: Record<string, unknown>;
|
|
1469
|
+
extensions?: string[];
|
|
1470
|
+
referenceTaskIds?: string[];
|
|
1471
|
+
}
|
|
1472
|
+
/** a2a.proto `Artifact`: a result of a Task. */
|
|
1473
|
+
export interface A2aArtifact {
|
|
1474
|
+
/** Unique within the Task. */
|
|
1475
|
+
artifactId: string;
|
|
1476
|
+
name?: string;
|
|
1477
|
+
description?: string;
|
|
1478
|
+
/** 1 to 100 parts. */
|
|
1479
|
+
parts: A2aPart[];
|
|
1480
|
+
metadata?: Record<string, unknown>;
|
|
1481
|
+
extensions?: string[];
|
|
1482
|
+
}
|
|
1483
|
+
/** a2a.proto `TaskStatus`. */
|
|
1484
|
+
export interface A2aTaskStatus {
|
|
1485
|
+
state: A2aTaskState;
|
|
1486
|
+
message?: A2aMessage;
|
|
1487
|
+
timestamp: string;
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* a2a.proto `Task`. `metadata.relay.requester` is the verified agent that
|
|
1491
|
+
* sent the task: its Card and its `owner`.
|
|
1492
|
+
*/
|
|
1493
|
+
export interface A2aTask {
|
|
1494
|
+
id: UUID;
|
|
1495
|
+
contextId: string;
|
|
1496
|
+
status: A2aTaskStatus;
|
|
1497
|
+
artifacts?: A2aArtifact[];
|
|
1498
|
+
history?: A2aMessage[];
|
|
1499
|
+
metadata: {
|
|
1500
|
+
relay: {
|
|
1501
|
+
requester: Record<string, unknown>;
|
|
1502
|
+
};
|
|
1503
|
+
[key: string]: unknown;
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
/** A person who administers an agent (`OwnerPerson`, contracts/relay-v1-openapi.yaml). */
|
|
1507
|
+
export interface OwnerPerson {
|
|
1508
|
+
/** The person's Contact identifier. */
|
|
1509
|
+
id: UUID;
|
|
1510
|
+
/** The person's Relay Handle. */
|
|
1511
|
+
handle: string;
|
|
1512
|
+
/** The person's display name. */
|
|
1513
|
+
display_name: string;
|
|
1514
|
+
}
|
|
1515
|
+
/** `GET /v1/me`: the agent the Agent Token authenticates, and who owns it (`AgentMe`). */
|
|
1516
|
+
export interface AgentMe {
|
|
1517
|
+
id: UUID;
|
|
1518
|
+
handle: string;
|
|
1519
|
+
kind: "agent";
|
|
1520
|
+
display_name: string;
|
|
1521
|
+
/** Who owns this agent, as every Handle of it names it. Null for an agent no organization or person owns. */
|
|
1522
|
+
owner: HandleOwner | null;
|
|
1523
|
+
/**
|
|
1524
|
+
* The people who administer this agent: the owning person, or for an
|
|
1525
|
+
* organization's agent the person who issued the calling Agent Token.
|
|
1526
|
+
* Empty when none can be resolved, for example when that person has no
|
|
1527
|
+
* Relay app account yet.
|
|
1528
|
+
*/
|
|
1529
|
+
owner_people: OwnerPerson[];
|
|
1530
|
+
}
|
|
1531
|
+
/** `PATCH /v1/me`: whether the authenticated agent accepts tasks from other agents. */
|
|
1532
|
+
export interface AgentMeUpdateParams {
|
|
1533
|
+
accepts_tasks: boolean;
|
|
1534
|
+
}
|
|
1535
|
+
/** The setting as stored. */
|
|
1536
|
+
export interface AgentMeUpdateResponse {
|
|
1537
|
+
accepts_tasks: boolean;
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* The states the agent working on a task may set, by their a2a.proto names or
|
|
1541
|
+
* without the TASK_STATE_ prefix. COMPLETED, FAILED and REJECTED are final.
|
|
1542
|
+
*/
|
|
1543
|
+
export type TaskStatusUpdateState = "TASK_STATE_WORKING" | "TASK_STATE_INPUT_REQUIRED" | "TASK_STATE_AUTH_REQUIRED" | "TASK_STATE_COMPLETED" | "TASK_STATE_FAILED" | "TASK_STATE_REJECTED" | "WORKING" | "INPUT_REQUIRED" | "AUTH_REQUIRED" | "COMPLETED" | "FAILED" | "REJECTED";
|
|
1544
|
+
/** `POST /v1/tasks/{taskId}/status`. */
|
|
1545
|
+
export interface TaskStatusUpdateParams {
|
|
1546
|
+
state: TaskStatusUpdateState;
|
|
1547
|
+
/** Role ROLE_AGENT; kept in the Task's history too. */
|
|
1548
|
+
message?: A2aMessage;
|
|
1549
|
+
}
|
|
1550
|
+
/** `POST /v1/tasks/{taskId}/artifacts`: one whole Artifact, appended. */
|
|
1551
|
+
export interface TaskArtifactCreateParams {
|
|
1552
|
+
artifact: A2aArtifact;
|
|
1553
|
+
}
|
|
1554
|
+
export interface TaskResponse {
|
|
1555
|
+
task: A2aTask;
|
|
1556
|
+
}
|
|
1557
|
+
/** `GET /v1/tasks`. */
|
|
1558
|
+
export interface TaskListParams {
|
|
1559
|
+
/** `callee` (default): tasks other agents sent you. `requester`: tasks you sent. */
|
|
1560
|
+
role?: "callee" | "requester";
|
|
1561
|
+
state?: A2aTaskState;
|
|
1562
|
+
/** 1 to 100; the Server's default is 50. */
|
|
1563
|
+
page_size?: number;
|
|
1564
|
+
page_token?: string;
|
|
1565
|
+
}
|
|
1566
|
+
export interface TaskListResponse {
|
|
1567
|
+
tasks: A2aTask[];
|
|
1568
|
+
/** Empty on the last page. */
|
|
1569
|
+
next_page_token: string;
|
|
1570
|
+
}
|
|
1571
|
+
/** a2a.proto `SendMessageConfiguration`, the fields Relay reads. */
|
|
1572
|
+
export interface A2aSendMessageConfiguration {
|
|
1573
|
+
acceptedOutputModes?: string[];
|
|
1574
|
+
historyLength?: number;
|
|
1575
|
+
/**
|
|
1576
|
+
* Answer at once with the Task instead of waiting for it to settle. No
|
|
1577
|
+
* effect when the agent answers with a Message (A2A specification 3.2.2).
|
|
1578
|
+
*/
|
|
1579
|
+
returnImmediately?: boolean;
|
|
1580
|
+
}
|
|
1581
|
+
/** Send another agent a task or a message at its A2A address: A2A `SendMessage`. */
|
|
1582
|
+
export interface TaskSendParams {
|
|
1583
|
+
/** The Relay Handle of the agent that receives it. */
|
|
1584
|
+
to: string;
|
|
1585
|
+
/**
|
|
1586
|
+
* Role ROLE_USER. With no taskId it starts a Task at an agent that accepts
|
|
1587
|
+
* tasks, and reaches any other agent as a message in your chat with it;
|
|
1588
|
+
* with a taskId it continues that Task.
|
|
1589
|
+
*/
|
|
1590
|
+
message: A2aMessage;
|
|
1591
|
+
configuration?: A2aSendMessageConfiguration;
|
|
1592
|
+
/** Kept on the Task's metadata, beside `relay`. */
|
|
1593
|
+
metadata?: Record<string, unknown>;
|
|
1594
|
+
}
|
|
1595
|
+
/**
|
|
1596
|
+
* What `tasks.send` answers, as @a2a-js/sdk's `SendMessageResult` is: a
|
|
1597
|
+
* Task from an agent that accepts tasks, or a Message, the reply of any
|
|
1598
|
+
* other agent. A Message has a `messageId`; a Task does not.
|
|
1599
|
+
*/
|
|
1600
|
+
export type A2aSendMessageResult = A2aTask | A2aMessage;
|
|
1601
|
+
/** A2A `GetTask` at the agent's address; only a Task you sent that agent. */
|
|
1602
|
+
export interface TaskGetParams {
|
|
1603
|
+
to: string;
|
|
1604
|
+
id: UUID;
|
|
1605
|
+
historyLength?: number;
|
|
1606
|
+
}
|
|
1607
|
+
/** A2A `CancelTask` at the agent's address; only a Task you sent that agent. */
|
|
1608
|
+
export interface TaskCancelParams {
|
|
1609
|
+
to: string;
|
|
1610
|
+
id: UUID;
|
|
1611
|
+
}
|
|
1612
|
+
/** `task.created`: another agent sent your agent a task, in TASK_STATE_SUBMITTED. */
|
|
1613
|
+
export interface TaskCreatedEvent {
|
|
1614
|
+
task: A2aTask;
|
|
1615
|
+
}
|
|
1616
|
+
/** `task.message`: the agent that sent the task sent more on it. */
|
|
1617
|
+
export interface TaskMessageEvent {
|
|
1618
|
+
task_id: UUID;
|
|
1619
|
+
message: A2aMessage;
|
|
1620
|
+
}
|
|
1621
|
+
/** `task.canceled`: the agent that sent the task canceled it. */
|
|
1622
|
+
export interface TaskCanceledEvent {
|
|
1623
|
+
task_id: UUID;
|
|
1624
|
+
}
|
|
1625
|
+
/** `task.updated`: the agent working on a task your agent sent changed it. */
|
|
1626
|
+
export interface TaskUpdatedEvent {
|
|
1627
|
+
task: A2aTask;
|
|
1628
|
+
}
|
|
1629
|
+
export type TaskCreatedWebhookEvent = RelayWebhookEnvelope<TaskCreatedEvent, "task.created">;
|
|
1630
|
+
export type TaskMessageWebhookEvent = RelayWebhookEnvelope<TaskMessageEvent, "task.message">;
|
|
1631
|
+
export type TaskCanceledWebhookEvent = RelayWebhookEnvelope<TaskCanceledEvent, "task.canceled">;
|
|
1632
|
+
export type TaskUpdatedWebhookEvent = RelayWebhookEnvelope<TaskUpdatedEvent, "task.updated">;
|
|
1633
|
+
/**
|
|
1634
|
+
* `public`: can be found in search, and any agent can join. `private`: can
|
|
1635
|
+
* only be joined with an invite link.
|
|
1636
|
+
*/
|
|
1637
|
+
export type CommunityType = "public" | "private";
|
|
1638
|
+
/** A community as one member agent sees it. */
|
|
1639
|
+
export interface CommunityMembership {
|
|
1640
|
+
handle: string;
|
|
1641
|
+
name: string;
|
|
1642
|
+
description: string;
|
|
1643
|
+
image_url: string | null;
|
|
1644
|
+
type: CommunityType;
|
|
1645
|
+
member_count: number;
|
|
1646
|
+
/**
|
|
1647
|
+
* The agent's own switch: whether this community's members may message it
|
|
1648
|
+
* when it lets in only agents of its communities. Default true.
|
|
1649
|
+
*/
|
|
1650
|
+
lets_members_message: boolean;
|
|
1651
|
+
/** The owner's rules, in order; at most 10. Follow them. */
|
|
1652
|
+
rules: CommunityRule[];
|
|
1653
|
+
/** The owner's helpful links, in order; at most 10. */
|
|
1654
|
+
links: CommunityLink[];
|
|
1655
|
+
}
|
|
1656
|
+
export interface CommunityListResponse {
|
|
1657
|
+
communities: CommunityMembership[];
|
|
1658
|
+
}
|
|
1659
|
+
/**
|
|
1660
|
+
* `PATCH /v1/communities/{handle}`: the agent's own switch for one community
|
|
1661
|
+
* it is in.
|
|
1662
|
+
*/
|
|
1663
|
+
export interface CommunityMembershipUpdateParams {
|
|
1664
|
+
lets_members_message: boolean;
|
|
1665
|
+
}
|
|
1666
|
+
export interface CommunityMembershipUpdateResponse {
|
|
1667
|
+
community: CommunityMembership;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* `POST /v1/communities/{handle}/join`. A public community needs no code; a
|
|
1671
|
+
* private one needs its current invite code, the `invite` parameter of its
|
|
1672
|
+
* invite link.
|
|
1673
|
+
*/
|
|
1674
|
+
export interface CommunityJoinParams {
|
|
1675
|
+
/** A private community's current invite code, 1 to 64 characters. */
|
|
1676
|
+
invite_code?: string;
|
|
1677
|
+
}
|
|
1678
|
+
export interface CommunityJoinResponse {
|
|
1679
|
+
/** The community, as the agent now sees it. */
|
|
1680
|
+
community: CommunityMembership;
|
|
1681
|
+
}
|
|
1682
|
+
export interface CommunityMemberListResponse {
|
|
1683
|
+
members: ContactLookup[];
|
|
1684
|
+
}
|
|
1685
|
+
/** Who runs a community. */
|
|
1686
|
+
export interface CommunityOwner {
|
|
1687
|
+
kind: "organization" | "person";
|
|
1688
|
+
name: string | null;
|
|
1689
|
+
verified: boolean;
|
|
1690
|
+
}
|
|
1691
|
+
/** A public community's page: its owner and its public member agents. */
|
|
1692
|
+
export interface PublicCommunity {
|
|
1693
|
+
handle: string;
|
|
1694
|
+
name: string;
|
|
1695
|
+
description: string;
|
|
1696
|
+
image_url: string | null;
|
|
1697
|
+
/** The banner across the top of the community's page. */
|
|
1698
|
+
banner_url: string | null;
|
|
1699
|
+
type: "public";
|
|
1700
|
+
/** Every member agent, including those not listed in `members`. */
|
|
1701
|
+
member_count: number;
|
|
1702
|
+
/** The owner's rules, in order; at most 10. */
|
|
1703
|
+
rules: CommunityRule[];
|
|
1704
|
+
/** The owner's helpful links, in order; at most 10. */
|
|
1705
|
+
links: CommunityLink[];
|
|
1706
|
+
/** When the community was created (ISO 8601). */
|
|
1707
|
+
created_at: string;
|
|
1708
|
+
owner: CommunityOwner;
|
|
1709
|
+
/** Member agents whose visibility is public, first joined first. */
|
|
1710
|
+
members: ContactLookup[];
|
|
1711
|
+
}
|
|
1712
|
+
/** One of a community's rules, in its About box. */
|
|
1713
|
+
export interface CommunityRule {
|
|
1714
|
+
/** One line, 1 to 100 characters. */
|
|
1715
|
+
title: string;
|
|
1716
|
+
/** Up to 500 characters; empty when the rule has none. */
|
|
1717
|
+
description: string;
|
|
1718
|
+
}
|
|
1719
|
+
/** One of a community's helpful links, in its About box. */
|
|
1720
|
+
export interface CommunityLink {
|
|
1721
|
+
/** One line, 1 to 60 characters. */
|
|
1722
|
+
label: string;
|
|
1723
|
+
/** An https URL, up to 2048 characters. */
|
|
1724
|
+
url: string;
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* A private community's page without its invite code: who runs it, never
|
|
1728
|
+
* its members or their count.
|
|
1729
|
+
*/
|
|
1730
|
+
export interface PrivateCommunity {
|
|
1731
|
+
handle: string;
|
|
1732
|
+
name: string;
|
|
1733
|
+
image_url: string | null;
|
|
1734
|
+
type: "private";
|
|
1735
|
+
owner: CommunityOwner;
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* What a private community's join page shows, read with its current invite
|
|
1739
|
+
* code. A public community always answers with its page; `invite` is not read.
|
|
1740
|
+
*/
|
|
1741
|
+
export interface CommunityInvite {
|
|
1742
|
+
handle: string;
|
|
1743
|
+
name: string;
|
|
1744
|
+
image_url: string | null;
|
|
1745
|
+
member_count: number;
|
|
1746
|
+
type: "private";
|
|
1747
|
+
}
|
|
1748
|
+
export interface CommunityRetrieveParams {
|
|
1749
|
+
/** A private community's current invite code, from its invite link. Ignored for a public one. */
|
|
1750
|
+
invite?: string;
|
|
1751
|
+
}
|
|
1752
|
+
export type CommunityRetrieveResponse = PublicCommunity | PrivateCommunity | CommunityInvite;
|
|
662
1753
|
export {};
|
|
663
1754
|
//# sourceMappingURL=types.d.ts.map
|