palbase 0.27.0 → 0.28.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 +12 -1
- package/dist/ai/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +3 -3
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{UJATFHC4.js → 2XAUD7E5.js} +2 -2
- package/dist/chunks/{O5LG6IFL.js → 36Q4EJBD.js} +1 -1
- package/dist/chunks/{ZN4ELT45.js → 3G43SAQ7.js} +1 -1
- package/dist/chunks/{QL42CXIT.js → 53VJSMGY.js} +1 -1
- package/dist/chunks/5SSYP4TM.js +2 -0
- package/dist/chunks/{JCS5FSY6.js → 7M5HEXJC.js} +2 -2
- package/dist/chunks/{HHQ5RAYH.js → CQ2AKEKI.js} +2 -2
- package/dist/chunks/{5ETIB37E.js → D5YY344U.js} +2 -2
- package/dist/chunks/{LXS4IDDQ.js → DJE7B7X4.js} +2 -2
- package/dist/chunks/{AVQ7DQA4.js → DJIO7ZRV.js} +1 -1
- package/dist/chunks/{7CVC2UYK.js → EL7LGFXD.js} +2 -2
- package/dist/chunks/EXT5BO4H.js +22 -0
- package/dist/chunks/{CTKJ7E5R.js → FJWAFNAZ.js} +2 -2
- package/dist/chunks/{5PLOENVJ.js → FXV6V457.js} +1 -1
- package/dist/chunks/{2VZXMKE4.js → GP56VUVJ.js} +2 -2
- package/dist/chunks/{HKLIKCYR.js → LIB2AHJU.js} +2 -2
- package/dist/chunks/{NGAXCQJ4.js → LTS573ZP.js} +2 -2
- package/dist/chunks/{UWZP4YV6.js → MVXEPZPI.js} +2 -2
- package/dist/chunks/{R2KG2E4H.js → QUBQS6S5.js} +2 -2
- package/dist/chunks/{YS5GF7JB.js → RUQZFFRU.js} +2 -2
- package/dist/chunks/UYPJY7TK.js +2 -0
- package/dist/chunks/{XUZ532UW.js → YZCJVWWC.js} +1 -1
- package/dist/chunks/{Y2RBMBJB.js → ZVQZVVBH.js} +1 -1
- package/dist/cli.js +134 -134
- package/dist/cloud/index.js +2 -2
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/cloud.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/calls-ui.js +46 -0
- package/dist/web/index.js +2 -2
- package/dist/web/message.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/push-sw.js +2 -2
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +7 -2
- package/types/cloud/src/generated/project.d.ts +1 -0
- package/types/internal/src/modules/calls.d.ts +810 -0
- package/types/internal/src/modules/events.d.ts +4 -3
- package/types/internal/src/modules/index.d.ts +1 -0
- package/types/internal/src/modules/messaging.d.ts +53 -3
- package/types/internal/src/modules/realtime.d.ts +1 -1
- package/types/server/src/server.d.ts +7 -0
- package/types/web/src/calls-ui/index.d.ts +71 -0
- package/types/web/src/calls.d.ts +274 -0
- package/types/web/src/client.d.ts +5 -0
- package/types/web/src/index.d.ts +1 -0
- package/dist/chunks/BRK5A42K.js +0 -22
- package/dist/chunks/BXJGHBB5.js +0 -2
- package/dist/chunks/ZBY3Q6Q2.js +0 -2
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
import { type Reply, type Transport } from '../transport.js';
|
|
2
|
+
/**
|
|
3
|
+
* A call
|
|
4
|
+
*/
|
|
5
|
+
export type Call = {
|
|
6
|
+
/**
|
|
7
|
+
* When a direct call was answered
|
|
8
|
+
*/
|
|
9
|
+
answered_at: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Who called
|
|
12
|
+
*/
|
|
13
|
+
caller_id: string;
|
|
14
|
+
/**
|
|
15
|
+
* The conversation it was made from (kept there as a call message)
|
|
16
|
+
*/
|
|
17
|
+
conversation_id: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* When it was made
|
|
20
|
+
*/
|
|
21
|
+
created_at: string;
|
|
22
|
+
/**
|
|
23
|
+
* Why it ended
|
|
24
|
+
*/
|
|
25
|
+
end_reason: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* When it ended
|
|
28
|
+
*/
|
|
29
|
+
ended_at: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Who ended it (hung up, canceled, declined; whose device went silent)
|
|
32
|
+
*/
|
|
33
|
+
ended_by: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* The call's id
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Two people, or a group
|
|
40
|
+
*/
|
|
41
|
+
kind: "direct" | "group";
|
|
42
|
+
/**
|
|
43
|
+
* How many it holds
|
|
44
|
+
*/
|
|
45
|
+
max_participants: number;
|
|
46
|
+
/**
|
|
47
|
+
* The caller's app's own words about the call (shown to the people rung)
|
|
48
|
+
*/
|
|
49
|
+
metadata: {
|
|
50
|
+
[key: string]: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Between two devices, or through the media server
|
|
54
|
+
*/
|
|
55
|
+
mode: "p2p" | "sfu";
|
|
56
|
+
/**
|
|
57
|
+
* Its people and bots
|
|
58
|
+
*/
|
|
59
|
+
participants: Participant[];
|
|
60
|
+
/**
|
|
61
|
+
* Whether it rings the people asked (false: a huddle they join)
|
|
62
|
+
*/
|
|
63
|
+
ring: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* When a direct call's ring ends, unanswered
|
|
66
|
+
*/
|
|
67
|
+
ring_until: string | null;
|
|
68
|
+
/**
|
|
69
|
+
* Ringing (a direct call not answered yet), going on, or over
|
|
70
|
+
*/
|
|
71
|
+
state: "ringing" | "active" | "ended";
|
|
72
|
+
/**
|
|
73
|
+
* Grows with every change: keep the highest seen
|
|
74
|
+
*/
|
|
75
|
+
version: number;
|
|
76
|
+
/**
|
|
77
|
+
* A video call (else voice)
|
|
78
|
+
*/
|
|
79
|
+
video: boolean;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* What a calls webhook says of a call
|
|
83
|
+
*/
|
|
84
|
+
export type CallEvent = {
|
|
85
|
+
/**
|
|
86
|
+
* The call
|
|
87
|
+
*/
|
|
88
|
+
call_id: string;
|
|
89
|
+
/**
|
|
90
|
+
* Who called
|
|
91
|
+
*/
|
|
92
|
+
caller_id: string;
|
|
93
|
+
/**
|
|
94
|
+
* The conversation it was made from
|
|
95
|
+
*/
|
|
96
|
+
conversation_id: string | null;
|
|
97
|
+
/**
|
|
98
|
+
* Why it ended (ended)
|
|
99
|
+
*/
|
|
100
|
+
end_reason?: string;
|
|
101
|
+
/**
|
|
102
|
+
* direct or group
|
|
103
|
+
*/
|
|
104
|
+
kind: string;
|
|
105
|
+
/**
|
|
106
|
+
* p2p or sfu
|
|
107
|
+
*/
|
|
108
|
+
mode: string;
|
|
109
|
+
/**
|
|
110
|
+
* user or bot
|
|
111
|
+
*/
|
|
112
|
+
participant_kind?: string;
|
|
113
|
+
/**
|
|
114
|
+
* The call's room on the media server
|
|
115
|
+
*/
|
|
116
|
+
room?: string | null;
|
|
117
|
+
/**
|
|
118
|
+
* The call's state
|
|
119
|
+
*/
|
|
120
|
+
state: string;
|
|
121
|
+
/**
|
|
122
|
+
* The participant (joined, left)
|
|
123
|
+
*/
|
|
124
|
+
user_id?: string;
|
|
125
|
+
/**
|
|
126
|
+
* A video call
|
|
127
|
+
*/
|
|
128
|
+
video: boolean;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* A page of calls
|
|
132
|
+
*/
|
|
133
|
+
export type CallPage = {
|
|
134
|
+
/**
|
|
135
|
+
* The calls
|
|
136
|
+
*/
|
|
137
|
+
calls: Call[];
|
|
138
|
+
/**
|
|
139
|
+
* The next page's cursor; absent on the last
|
|
140
|
+
*/
|
|
141
|
+
next_cursor?: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* A refusal, with the call as it is
|
|
145
|
+
*/
|
|
146
|
+
export type CallRefused = {
|
|
147
|
+
call: Call;
|
|
148
|
+
/**
|
|
149
|
+
* The refusal's name
|
|
150
|
+
*/
|
|
151
|
+
error: string;
|
|
152
|
+
/**
|
|
153
|
+
* What it means
|
|
154
|
+
*/
|
|
155
|
+
error_description: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* How the project runs its calls
|
|
159
|
+
*/
|
|
160
|
+
export type CallSettings = {
|
|
161
|
+
/**
|
|
162
|
+
* How many calls one person may start in an hour
|
|
163
|
+
*/
|
|
164
|
+
calls_per_hour: number;
|
|
165
|
+
/**
|
|
166
|
+
* The hook asked whom one may call; null: anyone may call anyone (blocks aside)
|
|
167
|
+
*/
|
|
168
|
+
hook: HookSettings | null;
|
|
169
|
+
/**
|
|
170
|
+
* The hook's signing secret: here once, as it is made
|
|
171
|
+
*/
|
|
172
|
+
hook_secret?: string;
|
|
173
|
+
/**
|
|
174
|
+
* How many people (and bots) a call holds
|
|
175
|
+
*/
|
|
176
|
+
max_participants: number;
|
|
177
|
+
/**
|
|
178
|
+
* Every direct call's media goes through the relay
|
|
179
|
+
*/
|
|
180
|
+
relay_all: boolean;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* What to change (null hook: none)
|
|
184
|
+
*/
|
|
185
|
+
export type CallSettingsRequest = {
|
|
186
|
+
/**
|
|
187
|
+
* 1 to 1,000
|
|
188
|
+
*/
|
|
189
|
+
calls_per_hour?: number;
|
|
190
|
+
/**
|
|
191
|
+
* The hook to ask; null removes it
|
|
192
|
+
*/
|
|
193
|
+
hook?: HookSettings | null;
|
|
194
|
+
/**
|
|
195
|
+
* 2 to 100
|
|
196
|
+
*/
|
|
197
|
+
max_participants?: number;
|
|
198
|
+
/**
|
|
199
|
+
* Relay every direct call
|
|
200
|
+
*/
|
|
201
|
+
relay_all?: boolean;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* The device
|
|
205
|
+
*/
|
|
206
|
+
export type DeviceRequest = {
|
|
207
|
+
/**
|
|
208
|
+
* The device (the app's install) it is done on
|
|
209
|
+
*/
|
|
210
|
+
device_id: string;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* An error
|
|
214
|
+
*/
|
|
215
|
+
export type ErrorResponse = {
|
|
216
|
+
/**
|
|
217
|
+
* The error's name
|
|
218
|
+
*/
|
|
219
|
+
error: string;
|
|
220
|
+
/**
|
|
221
|
+
* What it means
|
|
222
|
+
*/
|
|
223
|
+
error_description: string;
|
|
224
|
+
/**
|
|
225
|
+
* The request's id
|
|
226
|
+
*/
|
|
227
|
+
request_id?: string;
|
|
228
|
+
[key: string]: unknown;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* A call's state, as a heartbeat finds it
|
|
232
|
+
*/
|
|
233
|
+
export type Heartbeat = {
|
|
234
|
+
/**
|
|
235
|
+
* Why it ended
|
|
236
|
+
*/
|
|
237
|
+
end_reason: string | null;
|
|
238
|
+
/**
|
|
239
|
+
* The reader is in it on this device
|
|
240
|
+
*/
|
|
241
|
+
in_call: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* The call's state
|
|
244
|
+
*/
|
|
245
|
+
state: "ringing" | "active" | "ended";
|
|
246
|
+
/**
|
|
247
|
+
* The call's version
|
|
248
|
+
*/
|
|
249
|
+
version: number;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* The hook
|
|
253
|
+
*/
|
|
254
|
+
export type HookSettings = {
|
|
255
|
+
/**
|
|
256
|
+
* A hook that does not answer: refuse the call, or let it
|
|
257
|
+
*/
|
|
258
|
+
on_error?: "deny" | "allow";
|
|
259
|
+
/**
|
|
260
|
+
* How long it is waited for (100 to 5,000; 2,000)
|
|
261
|
+
*/
|
|
262
|
+
timeout_ms?: number;
|
|
263
|
+
/**
|
|
264
|
+
* The project's endpoint, asked whom one may call
|
|
265
|
+
*/
|
|
266
|
+
url: string;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* An ICE candidate
|
|
270
|
+
*/
|
|
271
|
+
export type IceCandidate = {
|
|
272
|
+
/**
|
|
273
|
+
* The candidate line
|
|
274
|
+
*/
|
|
275
|
+
candidate: string;
|
|
276
|
+
/**
|
|
277
|
+
* Its media section's index
|
|
278
|
+
*/
|
|
279
|
+
sdp_m_line_index?: number | null;
|
|
280
|
+
/**
|
|
281
|
+
* Its media section's id
|
|
282
|
+
*/
|
|
283
|
+
sdp_mid?: string | null;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* A STUN or TURN server
|
|
287
|
+
*/
|
|
288
|
+
export type IceServer = {
|
|
289
|
+
/**
|
|
290
|
+
* The relay credential
|
|
291
|
+
*/
|
|
292
|
+
credential?: string;
|
|
293
|
+
/**
|
|
294
|
+
* The server's URLs (stun:, turn:, turns:)
|
|
295
|
+
*/
|
|
296
|
+
urls: string[];
|
|
297
|
+
/**
|
|
298
|
+
* The relay credential's name
|
|
299
|
+
*/
|
|
300
|
+
username?: string;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* People to ask in
|
|
304
|
+
*/
|
|
305
|
+
export type InviteRequest = {
|
|
306
|
+
/**
|
|
307
|
+
* Ring them (true, by default)
|
|
308
|
+
*/
|
|
309
|
+
ring?: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Who to ask in
|
|
312
|
+
*/
|
|
313
|
+
user_ids: string[];
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* How a device's media flows
|
|
317
|
+
*/
|
|
318
|
+
export type Media = {
|
|
319
|
+
/**
|
|
320
|
+
* A direct call's ICE servers
|
|
321
|
+
*/
|
|
322
|
+
ice_servers: IceServer[];
|
|
323
|
+
/**
|
|
324
|
+
* relay: every packet through the relay
|
|
325
|
+
*/
|
|
326
|
+
ice_transport_policy: "all" | "relay";
|
|
327
|
+
/**
|
|
328
|
+
* Between the two devices, or through the media server
|
|
329
|
+
*/
|
|
330
|
+
mode: "p2p" | "sfu";
|
|
331
|
+
/**
|
|
332
|
+
* This device makes the offer (the caller's); the other answers it
|
|
333
|
+
*/
|
|
334
|
+
offerer: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Their device
|
|
337
|
+
*/
|
|
338
|
+
peer_device_id: string | null;
|
|
339
|
+
/**
|
|
340
|
+
* The other person of a direct call
|
|
341
|
+
*/
|
|
342
|
+
peer_user_id: string | null;
|
|
343
|
+
/**
|
|
344
|
+
* The call's room
|
|
345
|
+
*/
|
|
346
|
+
room: string | null;
|
|
347
|
+
/**
|
|
348
|
+
* The ticket into the call's room
|
|
349
|
+
*/
|
|
350
|
+
token: string | null;
|
|
351
|
+
/**
|
|
352
|
+
* The media server's url (wss://)
|
|
353
|
+
*/
|
|
354
|
+
url: string | null;
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* A person, or a bot, in a call
|
|
358
|
+
*/
|
|
359
|
+
export type Participant = {
|
|
360
|
+
/**
|
|
361
|
+
* The device they are in it on (answered on)
|
|
362
|
+
*/
|
|
363
|
+
device_id: string | null;
|
|
364
|
+
/**
|
|
365
|
+
* Their picture
|
|
366
|
+
*/
|
|
367
|
+
image_url: string | null;
|
|
368
|
+
/**
|
|
369
|
+
* When they were rung or asked
|
|
370
|
+
*/
|
|
371
|
+
invited_at: string;
|
|
372
|
+
/**
|
|
373
|
+
* When their present stretch in the call began
|
|
374
|
+
*/
|
|
375
|
+
joined_at: string | null;
|
|
376
|
+
/**
|
|
377
|
+
* A person, or the project's agent
|
|
378
|
+
*/
|
|
379
|
+
kind: "user" | "bot";
|
|
380
|
+
/**
|
|
381
|
+
* When they last left
|
|
382
|
+
*/
|
|
383
|
+
left_at: string | null;
|
|
384
|
+
/**
|
|
385
|
+
* Their name, as their profile shows it
|
|
386
|
+
*/
|
|
387
|
+
name: string | null;
|
|
388
|
+
/**
|
|
389
|
+
* The one who called, the one called (a direct call), or a member
|
|
390
|
+
*/
|
|
391
|
+
role: "caller" | "callee" | "member";
|
|
392
|
+
/**
|
|
393
|
+
* How long they have been in it, their stretches before the present one summed
|
|
394
|
+
*/
|
|
395
|
+
seconds: number;
|
|
396
|
+
/**
|
|
397
|
+
* Where they are in the call: rung, asked (a call that does not ring), in it, left, turned it down, missed it, busy
|
|
398
|
+
*/
|
|
399
|
+
state: "ringing" | "invited" | "joined" | "left" | "declined" | "missed" | "busy";
|
|
400
|
+
/**
|
|
401
|
+
* The person's id — or a bot's identity (bot:<identity>)
|
|
402
|
+
*/
|
|
403
|
+
user_id: string;
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* A signal between a direct call's two devices: an offer or an answer carries its sdp, a candidate its candidate
|
|
407
|
+
*/
|
|
408
|
+
export type Signal = {
|
|
409
|
+
/**
|
|
410
|
+
* The call
|
|
411
|
+
*/
|
|
412
|
+
call_id: string;
|
|
413
|
+
candidate?: IceCandidate;
|
|
414
|
+
/**
|
|
415
|
+
* When it was sent
|
|
416
|
+
*/
|
|
417
|
+
created_at: string;
|
|
418
|
+
/**
|
|
419
|
+
* From which device
|
|
420
|
+
*/
|
|
421
|
+
from_device_id: string;
|
|
422
|
+
/**
|
|
423
|
+
* Who sent it
|
|
424
|
+
*/
|
|
425
|
+
from_user_id: string;
|
|
426
|
+
/**
|
|
427
|
+
* An offer's or an answer's SDP (absent on a candidate or a bye)
|
|
428
|
+
*/
|
|
429
|
+
sdp?: string;
|
|
430
|
+
/**
|
|
431
|
+
* Its place in the call's order
|
|
432
|
+
*/
|
|
433
|
+
seq: number;
|
|
434
|
+
/**
|
|
435
|
+
* For which device
|
|
436
|
+
*/
|
|
437
|
+
to_device_id: string;
|
|
438
|
+
/**
|
|
439
|
+
* What it is
|
|
440
|
+
*/
|
|
441
|
+
type: "offer" | "answer" | "candidate" | "bye";
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* Signals
|
|
445
|
+
*/
|
|
446
|
+
export type SignalList = {
|
|
447
|
+
/**
|
|
448
|
+
* The signals, in order
|
|
449
|
+
*/
|
|
450
|
+
signals: Signal[];
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* A signal to the other device
|
|
454
|
+
*/
|
|
455
|
+
export type SignalRequest = {
|
|
456
|
+
candidate?: IceCandidate;
|
|
457
|
+
/**
|
|
458
|
+
* The device sending it
|
|
459
|
+
*/
|
|
460
|
+
device_id: string;
|
|
461
|
+
/**
|
|
462
|
+
* An offer's or an answer's SDP (32 KiB at most)
|
|
463
|
+
*/
|
|
464
|
+
sdp?: string | null;
|
|
465
|
+
/**
|
|
466
|
+
* What it is
|
|
467
|
+
*/
|
|
468
|
+
type: "offer" | "answer" | "candidate" | "bye";
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* A signal kept
|
|
472
|
+
*/
|
|
473
|
+
export type SignalSent = {
|
|
474
|
+
/**
|
|
475
|
+
* Its place in the call's order
|
|
476
|
+
*/
|
|
477
|
+
seq: number;
|
|
478
|
+
};
|
|
479
|
+
/**
|
|
480
|
+
* A call to make
|
|
481
|
+
*/
|
|
482
|
+
export type StartCallRequest = {
|
|
483
|
+
/**
|
|
484
|
+
* The caller's picture to show those rung
|
|
485
|
+
*/
|
|
486
|
+
caller_image_url?: string | null;
|
|
487
|
+
/**
|
|
488
|
+
* The caller's name to show those rung (else their messaging profile's)
|
|
489
|
+
*/
|
|
490
|
+
caller_name?: string | null;
|
|
491
|
+
/**
|
|
492
|
+
* The conversation it is made from: its members alone may be called, and it keeps the call
|
|
493
|
+
*/
|
|
494
|
+
conversation_id?: string | null;
|
|
495
|
+
/**
|
|
496
|
+
* The device the call is made on
|
|
497
|
+
*/
|
|
498
|
+
device_id: string;
|
|
499
|
+
/**
|
|
500
|
+
* A group call even with one person asked (others may be asked later): on the media server
|
|
501
|
+
*/
|
|
502
|
+
group?: boolean;
|
|
503
|
+
/**
|
|
504
|
+
* The app's own words about the call (32 strings, 2 KiB at most)
|
|
505
|
+
*/
|
|
506
|
+
metadata?: {
|
|
507
|
+
[key: string]: string;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* Ring them (true, by default); false: a group call they join (a huddle)
|
|
511
|
+
*/
|
|
512
|
+
ring?: boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Who to call: one person (a direct call), or several (a group)
|
|
515
|
+
*/
|
|
516
|
+
user_ids: string[];
|
|
517
|
+
/**
|
|
518
|
+
* A video call (else voice)
|
|
519
|
+
*/
|
|
520
|
+
video?: boolean;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* A way in for an agent
|
|
524
|
+
*/
|
|
525
|
+
export type Ticket = {
|
|
526
|
+
call: Call;
|
|
527
|
+
/**
|
|
528
|
+
* When the token ends
|
|
529
|
+
*/
|
|
530
|
+
expires_at: string;
|
|
531
|
+
/**
|
|
532
|
+
* The agent's identity in the call
|
|
533
|
+
*/
|
|
534
|
+
identity: string;
|
|
535
|
+
/**
|
|
536
|
+
* The call's room
|
|
537
|
+
*/
|
|
538
|
+
room: string;
|
|
539
|
+
/**
|
|
540
|
+
* The access token the agent connects with
|
|
541
|
+
*/
|
|
542
|
+
token: string;
|
|
543
|
+
/**
|
|
544
|
+
* The media server's url (wss://)
|
|
545
|
+
*/
|
|
546
|
+
url: string;
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* An agent to let in
|
|
550
|
+
*/
|
|
551
|
+
export type TicketRequest = {
|
|
552
|
+
/**
|
|
553
|
+
* It speaks (and shows) too (true, by default); false: it listens only
|
|
554
|
+
*/
|
|
555
|
+
can_publish?: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* The agent's identity in the call (bot:<identity>): 1 to 64 letters, digits, _ . -
|
|
558
|
+
*/
|
|
559
|
+
identity: string;
|
|
560
|
+
/**
|
|
561
|
+
* Its own words (32 strings, 2 KiB at most)
|
|
562
|
+
*/
|
|
563
|
+
metadata?: {
|
|
564
|
+
[key: string]: string;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Its name, as the call lists it
|
|
568
|
+
*/
|
|
569
|
+
name?: string | null;
|
|
570
|
+
};
|
|
571
|
+
/** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
|
|
572
|
+
export interface Events {
|
|
573
|
+
/**
|
|
574
|
+
* calls.call.ended: a call ended (end_reason says why).
|
|
575
|
+
*/
|
|
576
|
+
"calls.call.ended": CallEvent;
|
|
577
|
+
/**
|
|
578
|
+
* calls.call.started: a call was made — ringing, or a group going on.
|
|
579
|
+
*/
|
|
580
|
+
"calls.call.started": CallEvent;
|
|
581
|
+
/**
|
|
582
|
+
* calls.participant.joined: a person answered or joined, or a bot came into the room.
|
|
583
|
+
*/
|
|
584
|
+
"calls.participant.joined": CallEvent;
|
|
585
|
+
/**
|
|
586
|
+
* calls.participant.left: a person or a bot left the call.
|
|
587
|
+
*/
|
|
588
|
+
"calls.participant.left": CallEvent;
|
|
589
|
+
}
|
|
590
|
+
/** Palbase Calls */
|
|
591
|
+
export declare function client(t: Transport): {
|
|
592
|
+
/**
|
|
593
|
+
* My calls
|
|
594
|
+
*
|
|
595
|
+
* The reader's calls, newest first: their history, with how each went for them (their participant's state — `missed` among them).
|
|
596
|
+
*/
|
|
597
|
+
listCalls(input?: {
|
|
598
|
+
query?: {
|
|
599
|
+
limit?: number; /** The previous page's next_cursor */
|
|
600
|
+
cursor?: string; /** Only the calls the person missed (or was busy for) */
|
|
601
|
+
missed?: boolean; /** Only the calls in this state */
|
|
602
|
+
state?: "ringing" | "active" | "ended";
|
|
603
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
604
|
+
signal?: AbortSignal;
|
|
605
|
+
}): Promise<Reply<200, CallPage>>;
|
|
606
|
+
/**
|
|
607
|
+
* Call people
|
|
608
|
+
*
|
|
609
|
+
* Rings one person (a direct call, between the two devices) or asks several into a group call (on the media server), from the caller's device. `ring: false` makes a group call that rings no one: the people asked join it when they like (a huddle). A call to someone who is calling the caller this moment is that call, answered (200). A call to someone in another call — or being rung by one — ends at once, `busy`, and they hear they missed it. Who may be called is the project's: no one who blocked the caller or whom they blocked, no deleted account, a conversation's members alone when it names one (`conversation_id`), and whom the project's hook allows (`calls.can_call`). A call from a conversation is kept in it, as a `call` message.
|
|
610
|
+
*/
|
|
611
|
+
startCall(input: {
|
|
612
|
+
body: StartCallRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
613
|
+
signal?: AbortSignal;
|
|
614
|
+
}): Promise<Reply<200, Call> | Reply<201, Call>>;
|
|
615
|
+
/**
|
|
616
|
+
* The project's calls
|
|
617
|
+
*
|
|
618
|
+
* The project's calls, newest first; `user_id`, a person's (`missed` with it, the ones they missed); `state`, those in it.
|
|
619
|
+
*/
|
|
620
|
+
adminListCalls(input?: {
|
|
621
|
+
query?: {
|
|
622
|
+
limit?: number; /** The previous page's next_cursor */
|
|
623
|
+
cursor?: string; /** A person's calls */
|
|
624
|
+
user_id?: string; /** Only the calls the person missed (or was busy for) */
|
|
625
|
+
missed?: boolean; /** Only the calls in this state */
|
|
626
|
+
state?: "ringing" | "active" | "ended";
|
|
627
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
628
|
+
signal?: AbortSignal;
|
|
629
|
+
}): Promise<Reply<200, CallPage>>;
|
|
630
|
+
/**
|
|
631
|
+
* A call
|
|
632
|
+
*
|
|
633
|
+
* A call of the project's, as it is now.
|
|
634
|
+
*/
|
|
635
|
+
adminGetCall(input: {
|
|
636
|
+
path: {
|
|
637
|
+
call_id: string;
|
|
638
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
639
|
+
signal?: AbortSignal;
|
|
640
|
+
}): Promise<Reply<200, Call>>;
|
|
641
|
+
/**
|
|
642
|
+
* End a call
|
|
643
|
+
*
|
|
644
|
+
* Ends the call for everyone in it (`ended`): their apps are told, its room closes.
|
|
645
|
+
*/
|
|
646
|
+
adminEndCall(input: {
|
|
647
|
+
path: {
|
|
648
|
+
call_id: string;
|
|
649
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
650
|
+
signal?: AbortSignal;
|
|
651
|
+
}): Promise<Reply<200, Call>>;
|
|
652
|
+
/**
|
|
653
|
+
* Let an agent in
|
|
654
|
+
*
|
|
655
|
+
* Lets the project's agent into the call as a bot: a participant everyone in it hears (and sees), listed as a bot (`kind` bot; on the media server, an agent). The ticket is the media server's url and an access token its open-source client and agent libraries connect with as they are — LiveKit's: the agent receives each person's audio as a track of its own, named by their user id, and publishes its own. A direct call between two devices moves to the media server for it, going on. Palbase runs no agent: transcribing, answering, taking notes are the agent's. The `calls.call.started` and `calls.participant.joined` webhooks are when to send one in.
|
|
656
|
+
*/
|
|
657
|
+
createCallTicket(input: {
|
|
658
|
+
path: {
|
|
659
|
+
call_id: string;
|
|
660
|
+
};
|
|
661
|
+
body: TicketRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
662
|
+
signal?: AbortSignal;
|
|
663
|
+
}): Promise<Reply<201, Ticket>>;
|
|
664
|
+
/**
|
|
665
|
+
* Call settings
|
|
666
|
+
*
|
|
667
|
+
* How the project runs its calls. The hook's secret is never read back.
|
|
668
|
+
*/
|
|
669
|
+
getCallSettings(input?: {
|
|
670
|
+
signal?: AbortSignal;
|
|
671
|
+
}): Promise<Reply<200, CallSettings>>;
|
|
672
|
+
/**
|
|
673
|
+
* Set call settings
|
|
674
|
+
*
|
|
675
|
+
* What it names changes: how many people (and bots) a call holds (2 to 100), whether every direct call's media goes through the relay (no one learns another's address, at the price of a hop), how many calls a person may start in an hour, and the hook asked whom one may call (`calls.can_call`; null: none). A hook set for the first time is given its signing secret, here, once.
|
|
676
|
+
*/
|
|
677
|
+
putCallSettings(input: {
|
|
678
|
+
body: CallSettingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
679
|
+
signal?: AbortSignal;
|
|
680
|
+
}): Promise<Reply<200, CallSettings>>;
|
|
681
|
+
/**
|
|
682
|
+
* A new hook secret
|
|
683
|
+
*
|
|
684
|
+
* The hook's signing secret made anew, given here once; the old one signs nothing more.
|
|
685
|
+
*/
|
|
686
|
+
rotateCallHookSecret(input?: {
|
|
687
|
+
signal?: AbortSignal;
|
|
688
|
+
}): Promise<Reply<200, CallSettings>>;
|
|
689
|
+
/**
|
|
690
|
+
* A call
|
|
691
|
+
*
|
|
692
|
+
* A call of the reader's, as it is now. An app that missed a word on its channel reads the call here.
|
|
693
|
+
*/
|
|
694
|
+
getCall(input: {
|
|
695
|
+
path: {
|
|
696
|
+
call_id: string;
|
|
697
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
698
|
+
signal?: AbortSignal;
|
|
699
|
+
}): Promise<Reply<200, Call>>;
|
|
700
|
+
/**
|
|
701
|
+
* Answer a call
|
|
702
|
+
*
|
|
703
|
+
* Answers the call on the device: the first of the person's devices to answer has it, and their others stop ringing (the call's snapshot on their channel; a silent push to an Android device woken by the ring). A device that lost its last call (its app killed) answers on: that call ends.
|
|
704
|
+
*/
|
|
705
|
+
acceptCall(input: {
|
|
706
|
+
path: {
|
|
707
|
+
call_id: string;
|
|
708
|
+
};
|
|
709
|
+
body: DeviceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
710
|
+
signal?: AbortSignal;
|
|
711
|
+
}): Promise<Reply<200, Call>>;
|
|
712
|
+
/**
|
|
713
|
+
* Turn a call down
|
|
714
|
+
*
|
|
715
|
+
* Turns the call down on every device of the reader's: a direct call ends (`declined`); in a group, the reader is not rung any more and may still join.
|
|
716
|
+
*/
|
|
717
|
+
declineCall(input: {
|
|
718
|
+
path: {
|
|
719
|
+
call_id: string;
|
|
720
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
721
|
+
signal?: AbortSignal;
|
|
722
|
+
}): Promise<Reply<200, Call>>;
|
|
723
|
+
/**
|
|
724
|
+
* Still in the call
|
|
725
|
+
*
|
|
726
|
+
* The device saying it is still in the call — every 15 seconds while it is; a device silent 45 seconds is taken for gone (a direct call ends, `failed`). It answers the call's state and version: an app whose snapshot is older reads the call.
|
|
727
|
+
*/
|
|
728
|
+
callHeartbeat(input: {
|
|
729
|
+
path: {
|
|
730
|
+
call_id: string;
|
|
731
|
+
};
|
|
732
|
+
body: DeviceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
733
|
+
signal?: AbortSignal;
|
|
734
|
+
}): Promise<Reply<200, Heartbeat>>;
|
|
735
|
+
/**
|
|
736
|
+
* Join a group call
|
|
737
|
+
*
|
|
738
|
+
* Comes into a group call the reader was asked to — rung, missed, declined, or in before — on the device.
|
|
739
|
+
*/
|
|
740
|
+
joinCall(input: {
|
|
741
|
+
path: {
|
|
742
|
+
call_id: string;
|
|
743
|
+
};
|
|
744
|
+
body: DeviceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
745
|
+
signal?: AbortSignal;
|
|
746
|
+
}): Promise<Reply<200, Call>>;
|
|
747
|
+
/**
|
|
748
|
+
* Hang up
|
|
749
|
+
*
|
|
750
|
+
* Takes the reader out of the call. A direct call ends for both — `canceled` while it rings (the person called missed it), `hung_up` once answered; a group goes on while a person is in it or being rung. Leaving a call that is over is done.
|
|
751
|
+
*/
|
|
752
|
+
leaveCall(input: {
|
|
753
|
+
path: {
|
|
754
|
+
call_id: string;
|
|
755
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
756
|
+
signal?: AbortSignal;
|
|
757
|
+
}): Promise<Reply<200, Call>>;
|
|
758
|
+
/**
|
|
759
|
+
* How the media flows
|
|
760
|
+
*
|
|
761
|
+
* How the device's media flows in the call it is in. A direct call (`p2p`): the ICE servers its connection uses — STUN, and the relay with a credential of the device's own, revoked as it leaves — whether every packet goes through the relay (`ice_transport_policy` relay, the project's `relay_all`), and whether this device makes the offer. A group (`sfu`): the media server's url and a ticket into the call's room.
|
|
762
|
+
*/
|
|
763
|
+
getCallMedia(input: {
|
|
764
|
+
path: {
|
|
765
|
+
call_id: string;
|
|
766
|
+
};
|
|
767
|
+
body: DeviceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
768
|
+
signal?: AbortSignal;
|
|
769
|
+
}): Promise<Reply<200, Media>>;
|
|
770
|
+
/**
|
|
771
|
+
* Ask more people in
|
|
772
|
+
*
|
|
773
|
+
* Asks more people into a call the reader is in, ringing them (or not: `ring: false`). A direct call becomes a group on the media server: its devices are told (`mode` sfu on their channel) and move there, the call going on.
|
|
774
|
+
*/
|
|
775
|
+
inviteToCall(input: {
|
|
776
|
+
path: {
|
|
777
|
+
call_id: string;
|
|
778
|
+
};
|
|
779
|
+
body: InviteRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
780
|
+
signal?: AbortSignal;
|
|
781
|
+
}): Promise<Reply<200, Call>>;
|
|
782
|
+
/**
|
|
783
|
+
* Signals missed
|
|
784
|
+
*
|
|
785
|
+
* The signals for the device after `after` (the last seq it has), in order: what it missed of what was told.
|
|
786
|
+
*/
|
|
787
|
+
listCallSignals(input: {
|
|
788
|
+
path: {
|
|
789
|
+
call_id: string;
|
|
790
|
+
};
|
|
791
|
+
query: {
|
|
792
|
+
device_id: string; /** The last seq the device has (0: from the first) */
|
|
793
|
+
after?: number;
|
|
794
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
795
|
+
signal?: AbortSignal;
|
|
796
|
+
}): Promise<Reply<200, SignalList>>;
|
|
797
|
+
/**
|
|
798
|
+
* Signal the other device
|
|
799
|
+
*
|
|
800
|
+
* An offer, an answer, a candidate or a goodbye for the other device of a direct call — kept for it, and told to it on its channel (`signal`) as it is sent. Nothing goes before the call is answered: no address leaves a device for someone who did not pick up.
|
|
801
|
+
*/
|
|
802
|
+
sendCallSignal(input: {
|
|
803
|
+
path: {
|
|
804
|
+
call_id: string;
|
|
805
|
+
};
|
|
806
|
+
body: SignalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
807
|
+
signal?: AbortSignal;
|
|
808
|
+
}): Promise<Reply<202, SignalSent>>;
|
|
809
|
+
};
|
|
810
|
+
export type Client = ReturnType<typeof client>;
|