palbase 0.7.0 → 0.8.1

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.
Files changed (78) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/backend/engine.js +2 -2
  3. package/dist/backend/env.js +1 -1
  4. package/dist/backend/index.js +9 -9
  5. package/dist/backend/stack.js +1 -1
  6. package/dist/backend/test.js +2 -2
  7. package/dist/chunks/5M3HV3X4.js +2 -0
  8. package/dist/chunks/5RTSNQ4X.js +13 -0
  9. package/dist/chunks/{PJVWGUIT.js → 6RXVXPHC.js} +1 -1
  10. package/dist/chunks/{SU7BP6VF.js → 73R33XMD.js} +1 -1
  11. package/dist/chunks/{BKVU4I5R.js → 7XVI5JLP.js} +2 -2
  12. package/dist/chunks/{KDSWK3XW.js → CA4VJGGG.js} +1 -1
  13. package/dist/chunks/{X3MTLJRV.js → KHHJRNAO.js} +1 -1
  14. package/dist/chunks/KJWHR5BP.js +20 -0
  15. package/dist/chunks/KYJJJUEU.js +2 -0
  16. package/dist/chunks/M4XLAPDF.js +4 -0
  17. package/dist/chunks/{G3BK7L3J.js → MAYLG7WE.js} +2 -2
  18. package/dist/chunks/NSQAN2ME.js +6 -0
  19. package/dist/chunks/{5ZJCEQV5.js → Q4XTWEAW.js} +3 -3
  20. package/dist/chunks/{ZBOJEH7K.js → RYI2OB52.js} +2 -2
  21. package/dist/chunks/RZ525VLP.js +2 -0
  22. package/dist/chunks/T2Q5CKLL.js +18 -0
  23. package/dist/chunks/Y6AQWQBE.js +2 -0
  24. package/dist/chunks/ZSKMWUIQ.js +2 -0
  25. package/dist/cli.js +124 -123
  26. package/dist/refuse/ai.js +1 -1
  27. package/dist/refuse/backend.js +1 -1
  28. package/dist/refuse/server.js +1 -1
  29. package/dist/server/index.js +2 -2
  30. package/dist/server/testing.js +2 -2
  31. package/dist/web/index.js +2 -2
  32. package/dist/web/palbe.js +2 -2
  33. package/dist/web/paywall.js +2 -2
  34. package/dist/web/ssr.js +2 -2
  35. package/dist/web/vite.js +2 -2
  36. package/package.json +4 -2
  37. package/types/ai/src/ai.d.ts +44 -15
  38. package/types/ai/src/chats.d.ts +442 -12
  39. package/types/ai/src/index.d.ts +4 -4
  40. package/types/ai/src/tools.d.ts +158 -21
  41. package/types/backend/src/bootstrap.d.ts +8 -0
  42. package/types/backend/src/container.d.ts +9 -0
  43. package/types/backend/src/database.d.ts +17 -2
  44. package/types/backend/src/engine.d.ts +2 -0
  45. package/types/backend/src/gateways.d.ts +19 -0
  46. package/types/backend/src/index.d.ts +1 -0
  47. package/types/backend/src/runtime.d.ts +12 -0
  48. package/types/backend/src/testing/unit.d.ts +3 -1
  49. package/types/internal/src/chat.d.ts +168 -3
  50. package/types/internal/src/modules/ai.d.ts +1305 -57
  51. package/types/internal/src/modules/auth.d.ts +14 -2
  52. package/types/internal/src/modules/events.d.ts +2 -2
  53. package/types/internal/src/modules/machines.d.ts +57 -1
  54. package/types/internal/src/modules/notify.d.ts +6 -6
  55. package/types/internal/src/modules/purchases.d.ts +466 -14
  56. package/types/internal/src/modules/realtime.d.ts +36 -0
  57. package/types/internal/src/modules/stores.d.ts +259 -22
  58. package/types/internal/src/transport.d.ts +5 -0
  59. package/types/server/src/auth/jwt.d.ts +1 -6
  60. package/types/web/src/auth.d.ts +15 -4
  61. package/types/web/src/backends.d.ts +1 -1
  62. package/types/web/src/chat.d.ts +215 -4
  63. package/types/web/src/client.d.ts +28 -0
  64. package/types/web/src/gateways.d.ts +4 -3
  65. package/types/web/src/index.d.ts +4 -3
  66. package/types/web/src/purchases.d.ts +48 -5
  67. package/types/web/src/session.d.ts +11 -1
  68. package/types/web/src/voice.d.ts +36 -0
  69. package/dist/chunks/3ALGILOX.js +0 -2
  70. package/dist/chunks/AIIKXCWN.js +0 -2
  71. package/dist/chunks/ELEE7XO2.js +0 -18
  72. package/dist/chunks/G7E26S3Y.js +0 -13
  73. package/dist/chunks/H2EPK74V.js +0 -20
  74. package/dist/chunks/HEXIIGWS.js +0 -6
  75. package/dist/chunks/JS3TTUHS.js +0 -2
  76. package/dist/chunks/L3NTI4AZ.js +0 -2
  77. package/dist/chunks/LEBVOSG6.js +0 -4
  78. package/dist/chunks/OIA7KLRW.js +0 -2
@@ -21,12 +21,24 @@ export type AgentDefinition = {
21
21
  * The project's machine that defines the agent at each turn.
22
22
  */
23
23
  backend?: string;
24
+ /**
25
+ * The window, in tokens, the turn works in (the model's standard one unless said; more is billed as its provider bills it — GET /ai/models, context_window and max_input_tokens).
26
+ */
27
+ context_window?: number;
28
+ /**
29
+ * How hard the model thinks: none, minimal, low, medium, high, xhigh, max — which rungs a model takes is its catalogue entry's (GET /ai/models, efforts). Left out: the platform's.
30
+ */
31
+ effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
24
32
  /**
25
33
  * Its instructions.
26
34
  */
27
35
  instructions?: string;
28
36
  /**
29
- * How many tool calls a turn makes at most: past it the agent is told it has no tools left and answers.
37
+ * The language of the person the turn works for, as a BCP 47 tag (tr, en-GB): the model writes to them in it on every step, and so do its subagents.
38
+ */
39
+ language?: string;
40
+ /**
41
+ * How many tool calls a turn makes at most (10000: the engine's own bound): past it the agent is told it has no tools left and answers. What a turn spends is its budget's to bound.
30
42
  */
31
43
  max_tool_calls?: number;
32
44
  /**
@@ -37,6 +49,10 @@ export type AgentDefinition = {
37
49
  * Its subagents (16 at most).
38
50
  */
39
51
  subagents?: Subagent[];
52
+ /**
53
+ * Whether the model's reasoning is shown in the chat's stream (visible: thinking parts) or not asked for at all (hidden). Left out: the platform's.
54
+ */
55
+ thinking?: "visible" | "hidden";
40
56
  /**
41
57
  * Its tools (64 at most, with its MCP servers').
42
58
  */
@@ -67,6 +83,7 @@ export type Chat = {
67
83
  * Null: the project's server started it, as it starts every chat (a user's id: a chat a user started before chats were the server's alone).
68
84
  */
69
85
  created_by: string | null;
86
+ forked_from?: ChatFork;
70
87
  /**
71
88
  * What it keeps of the project's history.
72
89
  */
@@ -89,21 +106,43 @@ export type Chat = {
89
106
  * Its title.
90
107
  */
91
108
  title: string;
109
+ voice?: VoiceSession;
92
110
  workspace?: ChatWorkspace;
93
111
  };
94
112
  /**
95
- * Chats, the newest first (100 at most).
113
+ * Where a forked chat came from.
114
+ */
115
+ export type ChatFork = {
116
+ /**
117
+ * The message it was cut before.
118
+ */
119
+ before_message: string;
120
+ /**
121
+ * The chat it was forked from (it may be deleted since).
122
+ */
123
+ chat_id: string;
124
+ };
125
+ /**
126
+ * Chats, the newest first, a page at a time.
96
127
  */
97
128
  export type ChatList = {
98
129
  /**
99
130
  * The chats.
100
131
  */
101
132
  chats: Chat[];
133
+ /**
134
+ * The next page's cursor; absent on the last page.
135
+ */
136
+ next_cursor?: string;
102
137
  };
103
138
  /**
104
139
  * A member's (or the server's) message.
105
140
  */
106
141
  export type ChatMessage = {
142
+ /**
143
+ * The pictures and the files it carries, its images first ([] for none).
144
+ */
145
+ attachments: MessageAttachment[];
107
146
  /**
108
147
  * The member who wrote it; null: the server.
109
148
  */
@@ -136,6 +175,16 @@ export type ChatMessage = {
136
175
  * Its id.
137
176
  */
138
177
  id: string;
178
+ /**
179
+ * text — a message written to the chat — or voice: a line said out loud in its voice, the person's (author, the member) or the voice's own (author null); voice says which.
180
+ */
181
+ kind: "text" | "voice";
182
+ /**
183
+ * Its writer's labels for it ({} for none).
184
+ */
185
+ metadata: {
186
+ [key: string]: string;
187
+ };
139
188
  /**
140
189
  * The turn it started or reached.
141
190
  */
@@ -148,6 +197,115 @@ export type ChatMessage = {
148
197
  * What they wrote.
149
198
  */
150
199
  text: string;
200
+ voice?: MessageVoice;
201
+ };
202
+ /**
203
+ * A text model a turn may name.
204
+ */
205
+ export type ChatModel = {
206
+ /**
207
+ * The window a turn works in unless its definition asks for more — the largest billed at the standard rate where the price steps with the prompt (0: nobody says).
208
+ */
209
+ context_window: number;
210
+ /**
211
+ * Whether it is the model a turn that names none runs on.
212
+ */
213
+ default: boolean;
214
+ /**
215
+ * What it is for.
216
+ */
217
+ description: string;
218
+ /**
219
+ * Whether anyone says which rungs it takes: false offers none but the provider's own.
220
+ */
221
+ effort_known: boolean;
222
+ /**
223
+ * The rungs it takes (a definition's effort); empty when nobody says.
224
+ */
225
+ efforts: string[];
226
+ /**
227
+ * What a definition names it by (provider:model).
228
+ */
229
+ id: string;
230
+ /**
231
+ * The most it reads (0: nobody says).
232
+ */
233
+ max_input_tokens: number;
234
+ /**
235
+ * The most it writes (0: nobody says).
236
+ */
237
+ max_output_tokens: number;
238
+ /**
239
+ * Its name as people read it.
240
+ */
241
+ name: string;
242
+ price: ChatModelPrice;
243
+ /**
244
+ * The provider connection that serves it.
245
+ */
246
+ provider: string;
247
+ /**
248
+ * The roles it carries: fast, default, strong.
249
+ */
250
+ roles: string[];
251
+ };
252
+ /**
253
+ * A text model's list price per million tokens.
254
+ */
255
+ export type ChatModelPrice = {
256
+ /**
257
+ * A cache read.
258
+ */
259
+ cache_read_usd_per_mtok: number;
260
+ /**
261
+ * A cache write (five minutes).
262
+ */
263
+ cache_write_usd_per_mtok: number;
264
+ /**
265
+ * Input.
266
+ */
267
+ input_usd_per_mtok: number;
268
+ long_context?: LongContextPrice;
269
+ /**
270
+ * Output.
271
+ */
272
+ output_usd_per_mtok: number;
273
+ };
274
+ /**
275
+ * One part of a chat's stream, as its channel carries it.
276
+ */
277
+ export type ChatPart = {
278
+ /**
279
+ * What the part says, as the stream says it.
280
+ */
281
+ data: {
282
+ [key: string]: unknown;
283
+ };
284
+ /**
285
+ * The journal's sequence it was told at; absent for an answer's text, placed by its offset.
286
+ */
287
+ id?: number;
288
+ /**
289
+ * The id the channel told it under: the journal's sequence, or an answer's response and offset.
290
+ */
291
+ part_id: string;
292
+ /**
293
+ * message, turn, text, reset, thinking, tool, agent, goal, voice, transcript — as the stream says them.
294
+ */
295
+ type: string;
296
+ };
297
+ /**
298
+ * A page of a chat's past, in the order its stream told it.
299
+ */
300
+ export type ChatPartPage = {
301
+ /**
302
+ * Reads the page before this one; absent once the chat's start is in this one.
303
+ */
304
+ next_cursor?: string;
305
+ /**
306
+ * The parts.
307
+ */
308
+ parts: ChatPart[];
151
309
  };
152
310
  /**
153
311
  * Where a chat's stream is written.
@@ -209,6 +367,60 @@ export type ChatRequest = {
209
367
  title?: string;
210
368
  workspace?: ChatWorkspace;
211
369
  };
370
+ /**
371
+ * Stops the chat's turn.
372
+ */
373
+ export type ChatStop = {
374
+ /**
375
+ * The member the server stops it as (the server's alone): a member of the chat (403 not_a_member).
376
+ */
377
+ as?: string;
378
+ };
379
+ /**
380
+ * One tool call of a chat, its whole answer: what the chat's stream showed by its end (output, omitted_bytes), read whole — its secret shapes masked, as the stream masks them.
381
+ */
382
+ export type ChatToolCall = {
383
+ /**
384
+ * The call.
385
+ */
386
+ call_id: string;
387
+ /**
388
+ * How many pictures it returned.
389
+ */
390
+ image_count: number;
391
+ /**
392
+ * What the agent called it with; null when its arguments, masked, are no JSON.
393
+ */
394
+ input: unknown;
395
+ /**
396
+ * The tool failed.
397
+ */
398
+ is_error: boolean;
399
+ /**
400
+ * The tool.
401
+ */
402
+ name: string;
403
+ /**
404
+ * Its answer's text, whole; null: none yet.
405
+ */
406
+ output: string | null;
407
+ /**
408
+ * How long the answer is.
409
+ */
410
+ output_bytes: number;
411
+ /**
412
+ * The turn — or the subagent's work in it — that made it.
413
+ */
414
+ response_id: string;
415
+ /**
416
+ * The run that made it: the turn's, or a subagent's.
417
+ */
418
+ run_id: string;
419
+ /**
420
+ * Where it is, as the engine says it: pending, executing, completed, failed…
421
+ */
422
+ status: string;
423
+ };
212
424
  /**
213
425
  * The project's repositories a chat works in, each at a branch: its turns run on a machine of the platform's with them checked out, and what its agent commits is pushed to that branch.
214
426
  */
@@ -221,6 +433,23 @@ export type ChatWorkspace = {
221
433
  * 1 to 8 of the project's repositories, each once.
222
434
  */
223
435
  repos: ChatRepo[];
436
+ /**
437
+ * What each of its commits carries at its message's end (16 at most): a task, a link back to the conversation, a co-author. The engine writes each commit as the member its turn is for — their name and address — with these trailers; a turn of no member's commits as the platform.
438
+ */
439
+ trailers?: CommitTrailer[];
440
+ };
441
+ /**
442
+ * A git trailer each of the chat's commits carries at its message's end.
443
+ */
444
+ export type CommitTrailer = {
445
+ /**
446
+ * Its token, as git takes one: letters, digits and -, at most 64 (Co-authored-by, PalCore-Task).
447
+ */
448
+ key: string;
449
+ /**
450
+ * One line of at most 512 bytes.
451
+ */
452
+ value: string;
224
453
  };
225
454
  /**
226
455
  * A decision made.
@@ -412,6 +641,207 @@ export type ErrorResponse = {
412
641
  */
413
642
  status: number;
414
643
  };
644
+ /**
645
+ * Where to fork a chat.
646
+ */
647
+ export type ForkRequest = {
648
+ /**
649
+ * The message the fork is cut before (a message's id): it, and all that came after it, are not the fork's.
650
+ */
651
+ before_message: string;
652
+ /**
653
+ * Who is in the fork (64 at most; left out or null: the chat's members, as they are).
654
+ */
655
+ members?: NewMember[] | null;
656
+ /**
657
+ * The fork's title (256 bytes at most; left out: the chat's).
658
+ */
659
+ title?: string;
660
+ };
661
+ /**
662
+ * A chat's goal.
663
+ */
664
+ export type Goal = {
665
+ /**
666
+ * When it was met; null: not yet.
667
+ */
668
+ achieved_at: string | null;
669
+ budget: GoalBudget;
670
+ /**
671
+ * The chat.
672
+ */
673
+ chat_id: string;
674
+ /**
675
+ * When it was set.
676
+ */
677
+ created_at: string;
678
+ /**
679
+ * The goal's id (a new goal, a new id).
680
+ */
681
+ id: string;
682
+ /**
683
+ * The most turns it opens; null: no limit.
684
+ */
685
+ max_turns: number | null;
686
+ /**
687
+ * What the chat works toward.
688
+ */
689
+ objective: string;
690
+ /**
691
+ * What its next turn is: work, or verify (the check of a completion its agent claimed).
692
+ */
693
+ phase: string;
694
+ /**
695
+ * What a claimed completion is checked against.
696
+ */
697
+ rubric: string;
698
+ /**
699
+ * The member it was set as; null: the server.
700
+ */
701
+ set_by: string | null;
702
+ /**
703
+ * active, paused, blocked (it cannot go on without a person), budget_limited, or achieved.
704
+ */
705
+ status: string;
706
+ /**
707
+ * Why it last left active, as a stable code (empty while active): paused_by_person, paused_by_client, turn_stopped, turns_failed, no_progress, judge_unreadable, check_unreadable, needs_person, credit_hold, not_admitted, budget_spent, turns_used, time_used, achieved.
708
+ */
709
+ stop_code: string;
710
+ /**
711
+ * Why, in a sentence.
712
+ */
713
+ stop_reason: string;
714
+ /**
715
+ * When it last changed.
716
+ */
717
+ updated_at: string;
718
+ usage: GoalUsage;
719
+ };
720
+ /**
721
+ * What a goal may cost at most, all its turns and their subagents together; null: no limit.
722
+ */
723
+ export type GoalBudget = ({
724
+ /**
725
+ * In dollars.
726
+ */
727
+ max_cost_usd: number;
728
+ }) | null;
729
+ /**
730
+ * A chat's goal set, its status changed, or cleared.
731
+ */
732
+ export type GoalEvent = {
733
+ /**
734
+ * The chat.
735
+ */
736
+ chat_id: string;
737
+ /**
738
+ * The goal.
739
+ */
740
+ goal_id: string;
741
+ /**
742
+ * The chat's labels.
743
+ */
744
+ metadata: {
745
+ [key: string]: string;
746
+ };
747
+ /**
748
+ * What it was; null: no goal.
749
+ */
750
+ previous_status: string | null;
751
+ /**
752
+ * The member it was set as; null: the server.
753
+ */
754
+ set_by: string | null;
755
+ /**
756
+ * What it is now: active, paused, blocked, budget_limited, achieved — or cleared.
757
+ */
758
+ status: string;
759
+ /**
760
+ * Why it left active, as a stable code (empty while active).
761
+ */
762
+ stop_code: string;
763
+ /**
764
+ * Why, in a sentence.
765
+ */
766
+ stop_reason: string;
767
+ };
768
+ /**
769
+ * What changes of a chat's goal: a field left out is left as it is.
770
+ */
771
+ export type GoalPatch = {
772
+ /**
773
+ * The member the server changes it as: the one it was set as (403 not_your_turn otherwise).
774
+ */
775
+ as?: string;
776
+ budget?: GoalBudget;
777
+ /**
778
+ * The most turns it opens; null: no limit.
779
+ */
780
+ max_turns?: number | null;
781
+ /**
782
+ * Its objective, edited.
783
+ */
784
+ objective?: string;
785
+ /**
786
+ * Why it is paused, with status paused (500 characters at most): said in its stop_reason and its event.
787
+ */
788
+ reason?: string;
789
+ /**
790
+ * Its rubric, edited.
791
+ */
792
+ rubric?: string;
793
+ /**
794
+ * paused (the goal waits) or active (it goes on).
795
+ */
796
+ status?: "paused" | "active";
797
+ };
798
+ /**
799
+ * A chat's goal to set.
800
+ */
801
+ export type GoalRequest = {
802
+ /**
803
+ * The member the server sets it as: the goal and its turns are theirs (the server's alone: a user sending it is answered 403 server_only; one who is not a member of the chat, 403 not_a_member). Left out, the server's.
804
+ */
805
+ as?: string;
806
+ budget?: TurnBudget;
807
+ /**
808
+ * The most turns it opens (1 to 10000; left out: no limit).
809
+ */
810
+ max_turns?: number;
811
+ /**
812
+ * What the chat works toward, in words (4000 characters at most).
813
+ */
814
+ objective: string;
815
+ /**
816
+ * What a claimed completion is checked against (8000 characters at most; left out: the objective itself).
817
+ */
818
+ rubric?: string;
819
+ };
820
+ /**
821
+ * What a goal has used so far.
822
+ */
823
+ export type GoalUsage = {
824
+ /**
825
+ * How long it has been at work since it was set or last resumed.
826
+ */
827
+ active_seconds: number;
828
+ /**
829
+ * Some of its use has no price yet: it cost at least this.
830
+ */
831
+ cost_is_lower_bound: boolean;
832
+ /**
833
+ * What its turns cost so far, in dollars.
834
+ */
835
+ cost_usd: number;
836
+ /**
837
+ * Work turns it opened.
838
+ */
839
+ turns: number;
840
+ /**
841
+ * Checks of a claimed completion.
842
+ */
843
+ verifications: number;
844
+ };
415
845
  /**
416
846
  * A picture job.
417
847
  */
@@ -575,7 +1005,7 @@ export type ImageUsage = ({
575
1005
  output_tokens: number;
576
1006
  }) | null;
577
1007
  /**
578
- * A picture a question is about: a file of the project's storage (bucket and path), read by the model through a URL signed for the while it is answered, or an https address the model reads it from. Nothing of it is kept by the module.
1008
+ * A picture the question is about: a file of the project's storage (bucket and path), an https address the model reads it from (url), or its bytes (data, base64, of media_type) — a screenshot the caller holds, kept in the project's storage for the while the question is answered. One of the three.
579
1009
  */
580
1010
  export type InputImage = {
581
1011
  /**
@@ -583,7 +1013,15 @@ export type InputImage = {
583
1013
  */
584
1014
  bucket?: string;
585
1015
  /**
586
- * The picture's path in the bucket.
1016
+ * The picture's bytes, base64: 5 MiB at most, 6 MiB with the question's other pictures given so.
1017
+ */
1018
+ data?: string;
1019
+ /**
1020
+ * The picture's type, with its bytes: image/png, image/jpeg, image/webp or image/gif.
1021
+ */
1022
+ media_type?: string;
1023
+ /**
1024
+ * The picture's path in the bucket.
587
1025
  */
588
1026
  path?: string;
589
1027
  /**
@@ -591,6 +1029,23 @@ export type InputImage = {
591
1029
  */
592
1030
  url?: string;
593
1031
  };
1032
+ /**
1033
+ * A model's price past its prompt's step: the whole request pays it.
1034
+ */
1035
+ export type LongContextPrice = {
1036
+ /**
1037
+ * The step: a prompt of more tokens.
1038
+ */
1039
+ above_prompt_tokens: number;
1040
+ /**
1041
+ * Input.
1042
+ */
1043
+ input_usd_per_mtok: number;
1044
+ /**
1045
+ * Output.
1046
+ */
1047
+ output_usd_per_mtok: number;
1048
+ };
594
1049
  /**
595
1050
  * A user in a chat.
596
1051
  */
@@ -612,6 +1067,10 @@ export type Member = {
612
1067
  * A user to put in a chat.
613
1068
  */
614
1069
  export type MemberRequest = {
1070
+ /**
1071
+ * Their address (none: the one kept, if any): what their turns' commits are written as. Never served.
1072
+ */
1073
+ email?: string;
615
1074
  /**
616
1075
  * Their name in it.
617
1076
  */
@@ -634,6 +1093,77 @@ export type Message = {
634
1093
  */
635
1094
  role: "user" | "assistant";
636
1095
  };
1096
+ /**
1097
+ * A picture or a file a message carries, its images first. Its bytes are read at GET /ai/chats/{chat_id}/messages/{message_id}/attachments/{position}, by the chat's members and its server.
1098
+ */
1099
+ export type MessageAttachment = {
1100
+ /**
1101
+ * The bucket of the project's storage it was copied from.
1102
+ */
1103
+ bucket: string;
1104
+ /**
1105
+ * What it is: a picture's type by its bytes (whatever it was labelled), a file's as its message or the project's storage said.
1106
+ */
1107
+ content_type: string;
1108
+ /**
1109
+ * image: a picture the model is shown with the message; file: a file put in the chat's workspace.
1110
+ */
1111
+ kind: "image" | "file";
1112
+ /**
1113
+ * What the message calls it: a file's name in the workspace.
1114
+ */
1115
+ name: string;
1116
+ /**
1117
+ * Its path in that bucket.
1118
+ */
1119
+ path: string;
1120
+ /**
1121
+ * Its bytes' sha256, hex.
1122
+ */
1123
+ sha256: string;
1124
+ /**
1125
+ * Its size in bytes.
1126
+ */
1127
+ size: number;
1128
+ /**
1129
+ * Where a file is in the chat's workspace: .palbase/attachments/<message id>/<name>.
1130
+ */
1131
+ workspace_path?: string;
1132
+ };
1133
+ /**
1134
+ * A file of the project's storage a message puts in its chat's workspace.
1135
+ */
1136
+ export type MessageFileRequest = {
1137
+ /**
1138
+ * The bucket it is in: one of the project's own.
1139
+ */
1140
+ bucket: string;
1141
+ /**
1142
+ * What it is, as the agent is told (a media type: application/pdf; its parameters dropped). None: what the project's storage says.
1143
+ */
1144
+ content_type?: string;
1145
+ /**
1146
+ * Its name in the workspace, and what the message calls it (its path's last segment when none; a second of a name in one message is numbered, rapor-2.pdf).
1147
+ */
1148
+ filename?: string;
1149
+ /**
1150
+ * Its path in the bucket.
1151
+ */
1152
+ path: string;
1153
+ };
1154
+ /**
1155
+ * A picture of the project's storage a message shows the model.
1156
+ */
1157
+ export type MessageImageRequest = {
1158
+ /**
1159
+ * The bucket it is in: one of the project's own.
1160
+ */
1161
+ bucket: string;
1162
+ /**
1163
+ * Its path in the bucket.
1164
+ */
1165
+ path: string;
1166
+ };
637
1167
  /**
638
1168
  * A page of a chat's messages, the newest first.
639
1169
  */
@@ -660,19 +1190,54 @@ export type MessageRequest = {
660
1190
  * The writer's own id for it: sent again — a retry, a second tab — it is the same message, delivered once.
661
1191
  */
662
1192
  client_id: string;
1193
+ /**
1194
+ * What the model reads with the message and no member does (the server's alone: a user sending it is answered 400; 64 KiB at most): a document the agent needs, how to open a file the message names. The agent is told it as the project's own words, apart from the writer's; the chat's stream and its list never show it.
1195
+ */
1196
+ context?: string;
663
1197
  /**
664
1198
  * While the agent works on a turn: next gives it the message at its next step (the default), now cuts the step it is in. When no turn runs, a message starts one.
665
1199
  */
666
1200
  delivery?: "next" | "now";
1201
+ /**
1202
+ * Files of the project's storage put in the chat's workspace before the agent reads the message, at .palbase/attachments/<message id>/<filename>, and the agent is told where (8 at most, 15 MiB each at most). A chat that works in no workspace takes none (409 no_workspace). Copied for the chat, and who may attach which, as images; an object the message names twice — a picture of it and a file of it too — is read once.
1203
+ */
1204
+ files?: MessageFileRequest[];
1205
+ /**
1206
+ * Pictures of the project's storage the model is shown with the message (4 at most, as many as the model is shown at once; png, jpeg, webp or gif by their bytes, whatever they are labelled — another is 415 unsupported_image; 5 MiB each at most). Each is copied for the chat as the message is written: what it carried is what the agent reads, whatever becomes of the file, and the copy goes with the chat. The server attaches any file of its storage, writing as a member or not: its decision. A member with their own session attaches a public bucket's files alone — a private bucket's file, their own (owner_id) too, is the server's to attach. Any other is not found (404 attachment_not_found), as one that is not there is. Past the bounds: 413 attachment_too_large; changed while it was attached: 409 attachment_changed.
1207
+ */
1208
+ images?: MessageImageRequest[];
1209
+ /**
1210
+ * Its writer's own labels for the message (16 at most, snake_case keys, values of 512 bytes at most) — what an app draws it by: the files it names, the kind of row it is, the model its writer chose. Kept with it, shown with it in the chat's stream and its list, and given to the backend that defines the agent of the turn it opens (the agent context's message). Sent again with the same client_id, the first message's stand.
1211
+ */
1212
+ metadata?: {
1213
+ [key: string]: string;
1214
+ };
667
1215
  /**
668
1216
  * The message (64 KiB at most).
669
1217
  */
670
1218
  text: string;
671
1219
  };
1220
+ /**
1221
+ * The voice a line of kind voice was said in, and by whom.
1222
+ */
1223
+ export type MessageVoice = {
1224
+ /**
1225
+ * The voice.
1226
+ */
1227
+ id: string;
1228
+ /**
1229
+ * user (the person) or assistant (the voice).
1230
+ */
1231
+ role: string;
1232
+ };
672
1233
  /**
673
1234
  * What a project may name.
674
1235
  */
675
1236
  export type Models = {
1237
+ /**
1238
+ * Every text model a turn may name — a chat's agent, a response — on the project's own provider connections or the platform's, as the engine's catalogue says it: what a model picker offers a person.
1239
+ */
1240
+ chat: ChatModel[];
676
1241
  /**
677
1242
  * Embedding models, with their list prices.
678
1243
  */
@@ -685,11 +1250,19 @@ export type Models = {
685
1250
  * The roles a text model is chosen by.
686
1251
  */
687
1252
  text: TextModel[];
1253
+ /**
1254
+ * The providers whose models could not be listed just now: their models are missing from chat until they answer.
1255
+ */
1256
+ unavailable: string[];
688
1257
  };
689
1258
  /**
690
1259
  * A user to put in a chat as it starts.
691
1260
  */
692
1261
  export type NewMember = {
1262
+ /**
1263
+ * Their address: what the commits their turns' agent makes in the chat's workspace are written as (with their name). Kept, never served; a member's own session says it again, verified, as they write. None: an address of the platform's that names them and reaches no one.
1264
+ */
1265
+ email?: string;
693
1266
  /**
694
1267
  * How the agent and the others are told who wrote.
695
1268
  */
@@ -734,6 +1307,27 @@ export type ProviderList = {
734
1307
  */
735
1308
  providers: Provider[];
736
1309
  };
1310
+ /**
1311
+ * A commit a push brought to its branch.
1312
+ */
1313
+ export type PushedCommit = {
1314
+ /**
1315
+ * Its author's address.
1316
+ */
1317
+ author_email: string;
1318
+ /**
1319
+ * Its author: the member the turn was for, when the server said who they are.
1320
+ */
1321
+ author_name: string;
1322
+ /**
1323
+ * The commit.
1324
+ */
1325
+ sha: string;
1326
+ /**
1327
+ * Its message's first line.
1328
+ */
1329
+ subject: string;
1330
+ };
737
1331
  /**
738
1332
  * A GitHub repository the project's chats work in, by the project's name for it; the project's backend gives its tokens (the framework's ai.repo), asked at each clone and each push.
739
1333
  */
@@ -760,9 +1354,13 @@ export type Repo = {
760
1354
  repository: string;
761
1355
  };
762
1356
  /**
763
- * The project's repositories.
1357
+ * The project's repositories, by name, a page at a time.
764
1358
  */
765
1359
  export type RepoPage = {
1360
+ /**
1361
+ * The next page's cursor; absent on the last page.
1362
+ */
1363
+ next_cursor?: string;
766
1364
  repos: Repo[];
767
1365
  };
768
1366
  /**
@@ -833,15 +1431,34 @@ export type ResponseError = ({
833
1431
  message: string;
834
1432
  }) | null;
835
1433
  /**
836
- * A background response ended.
1434
+ * A response started in the background ended, or a chat's turn began or ended: a chat's turn carries the chat's fields besides (chat_id, user_id, message_metadata, goal_id, goal_turn).
837
1435
  */
838
1436
  export type ResponseEvent = {
1437
+ /**
1438
+ * A chat's turn: the chat.
1439
+ */
1440
+ chat_id?: string;
839
1441
  /**
840
1442
  * What it cost, in billionths of a dollar.
841
1443
  */
842
1444
  cost_nano_usd: number;
1445
+ error?: ResponseEventError;
843
1446
  /**
844
- * The caller's own labels (16 at most, snake_case keys): returned with the response and its event.
1447
+ * A chat's turn: the goal it is a turn of; null: none.
1448
+ */
1449
+ goal_id?: string | null;
1450
+ /**
1451
+ * A chat's turn: whether it is a turn of the chat's goal.
1452
+ */
1453
+ goal_turn?: boolean;
1454
+ /**
1455
+ * A chat's turn: the labels of the message that opened it ({}: none, or a turn no message opened).
1456
+ */
1457
+ message_metadata?: {
1458
+ [key: string]: string;
1459
+ };
1460
+ /**
1461
+ * A background response's: the caller's own labels (16 at most, snake_case keys). A chat's turn's: the chat's labels.
845
1462
  */
846
1463
  metadata: {
847
1464
  [key: string]: string;
@@ -855,9 +1472,30 @@ export type ResponseEvent = {
855
1472
  */
856
1473
  response_id: string;
857
1474
  /**
858
- * How it ended.
1475
+ * How it ended — a background response's as the engine says it (completed, failed, canceled, timed_out, budget_exceeded); a chat's turn's in the chat's words: running (ai.response.started), completed, failed, stopped (a member or the server stopped it, or the chat went), budget_exceeded.
859
1476
  */
860
1477
  status: string;
1478
+ /**
1479
+ * A chat's turn: the member it ran for — whose message opened it, or whose goal it is; null: the server's.
1480
+ */
1481
+ user_id?: string | null;
1482
+ };
1483
+ /**
1484
+ * How a response ended when it did not complete, and was not stopped.
1485
+ */
1486
+ export type ResponseEventError = {
1487
+ /**
1488
+ * A stable code: internal_error, timed_out, budget_exceeded, or the engine's own.
1489
+ */
1490
+ code: string;
1491
+ /**
1492
+ * Why, in a sentence.
1493
+ */
1494
+ message: string;
1495
+ /**
1496
+ * Whether asking again may go otherwise.
1497
+ */
1498
+ retryable: boolean;
861
1499
  };
862
1500
  /**
863
1501
  * A question for a model: input, or messages.
@@ -880,7 +1518,7 @@ export type ResponseRequest = {
880
1518
  */
881
1519
  instructions?: string;
882
1520
  /**
883
- * How many tool calls the answer makes at most: past it the model is told it has no tools left and answers.
1521
+ * How many tool calls the answer makes at most (10000: the engine's own bound): past it the model is told it has no tools left and answers.
884
1522
  */
885
1523
  max_tool_calls?: number;
886
1524
  /**
@@ -920,6 +1558,14 @@ export type ResponseRequest = {
920
1558
  * What a response used.
921
1559
  */
922
1560
  export type ResponseUsage = {
1561
+ /**
1562
+ * Nothing more of its cost can be settled: what it cost is the whole.
1563
+ */
1564
+ cost_final: boolean;
1565
+ /**
1566
+ * What it cost, in billionths of a dollar, once it ended (0 before).
1567
+ */
1568
+ cost_nano_usd: number;
923
1569
  /**
924
1570
  * Tokens read.
925
1571
  */
@@ -928,6 +1574,10 @@ export type ResponseUsage = {
928
1574
  * Tokens written.
929
1575
  */
930
1576
  output_tokens: number;
1577
+ /**
1578
+ * cost_nano_usd in dollars.
1579
+ */
1580
+ usd: number;
931
1581
  };
932
1582
  /**
933
1583
  * A message a subagent was given.
@@ -959,6 +1609,24 @@ export type RunMessageRequest = {
959
1609
  */
960
1610
  text: string;
961
1611
  };
1612
+ /**
1613
+ * Who stops a subagent.
1614
+ */
1615
+ export type RunStopRequest = {
1616
+ /**
1617
+ * The member the project's server stops it as: a member of the chat (the server's alone: a user sending it is answered 400; one who is not a member, 403 not_a_member). Left out, the server stops it as itself.
1618
+ */
1619
+ as?: string;
1620
+ };
1621
+ /**
1622
+ * A subagent a stop ended.
1623
+ */
1624
+ export type RunStopped = {
1625
+ /**
1626
+ * Its run.
1627
+ */
1628
+ run_id: string;
1629
+ };
962
1630
  /**
963
1631
  * What the project allows its chats.
964
1632
  */
@@ -972,9 +1640,9 @@ export type Settings = {
972
1640
  */
973
1641
  history_bytes: number;
974
1642
  /**
975
- * How much chat history the project keeps; a message past it is refused (history_full) until chats are deleted.
1643
+ * How much chat history the project keeps; a message past it is refused (history_full) until chats are deleted. A free project keeps 500 MiB at most; null: no fixed limit — a project with paid rights keeps all of it, paid by use, unless it says a limit of its own.
976
1644
  */
977
- history_limit_bytes: number;
1645
+ history_limit_bytes: number | null;
978
1646
  /**
979
1647
  * How many messages one user sends a minute (default 20).
980
1648
  */
@@ -989,9 +1657,9 @@ export type SettingsRequest = {
989
1657
  */
990
1658
  clients?: boolean;
991
1659
  /**
992
- * At most the plan's (500 MiB): a project may keep less, not more.
1660
+ * A limit of the project's own: a free project at most the plan's 500 MiB (it may keep less, not more), a project with paid rights at most 1 TiB. null clears it: the plan's is kept (free: 500 MiB; with paid rights: none).
993
1661
  */
994
- history_limit_bytes?: number;
1662
+ history_limit_bytes?: number | null;
995
1663
  /**
996
1664
  * 1 to 600.
997
1665
  */
@@ -1010,10 +1678,18 @@ export type StopResult = {
1010
1678
  * An agent the agent may hand part of a turn to.
1011
1679
  */
1012
1680
  export type Subagent = {
1681
+ /**
1682
+ * The window, in tokens, it works in. Left out: the agent's, when it runs on the agent's model.
1683
+ */
1684
+ context_window?: number;
1013
1685
  /**
1014
1686
  * What it is for: the agent reads it to choose.
1015
1687
  */
1016
1688
  description: string;
1689
+ /**
1690
+ * How hard its model thinks. Left out: the agent's, when it runs on the agent's model.
1691
+ */
1692
+ effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
1017
1693
  /**
1018
1694
  * Its instructions.
1019
1695
  */
@@ -1030,6 +1706,10 @@ export type Subagent = {
1030
1706
  * The turn fails if this subagent's part fails.
1031
1707
  */
1032
1708
  required?: boolean;
1709
+ /**
1710
+ * Whether its model's reasoning is asked for to show (visible) or not at all (hidden). Left out: the agent's.
1711
+ */
1712
+ thinking?: "visible" | "hidden";
1033
1713
  /**
1034
1714
  * Its tools.
1035
1715
  */
@@ -1096,7 +1776,7 @@ export type ToolOutputAccepted = {
1096
1776
  call_id: string;
1097
1777
  };
1098
1778
  /**
1099
- * A tool an agent is given, by where it runs: backend (a function of the project's backend, the framework's ai.tool, on its machine), https (an endpoint the project put), mcp (an MCP server the project put: its tools, or the ones named in only), or client (code of the app the chat is open in: the turn waits for its answer).
1779
+ * A tool an agent is given, by where it runs: backend (a function of the project's backend, the framework's ai.tool, on its machine), https (an endpoint the project put), mcp (an MCP server the project put: its tools, or the ones named in only), client (code of the app the chat is open in: the turn waits for its answer), or platform (one of the platform's own, by name: web.search, web.fetch, workspace.fetch_archive — the agent's alone; its subagents work with the agent's).
1100
1780
  */
1101
1781
  export type ToolRef = {
1102
1782
  /**
@@ -1112,7 +1792,7 @@ export type ToolRef = {
1112
1792
  */
1113
1793
  machine?: string;
1114
1794
  /**
1115
- * The tool (backend, client), or the endpoint's name (https, mcp).
1795
+ * The tool (backend, client), the endpoint's name (https, mcp), or the platform's tool: web.search (the web searched), web.fetch (a page of it read), workspace.fetch_archive (an archive at a URL unpacked into the chat's workspace).
1116
1796
  */
1117
1797
  name: string;
1118
1798
  /**
@@ -1126,9 +1806,9 @@ export type ToolRef = {
1126
1806
  [key: string]: unknown;
1127
1807
  };
1128
1808
  /**
1129
- * backend, https, mcp or client.
1809
+ * backend, https, mcp, client or platform.
1130
1810
  */
1131
- source: "backend" | "https" | "mcp" | "client";
1811
+ source: "backend" | "https" | "mcp" | "client" | "platform";
1132
1812
  };
1133
1813
  /**
1134
1814
  * One artifact a turn's agent published.
@@ -1202,10 +1882,121 @@ export type TurnCost = {
1202
1882
  * The turn.
1203
1883
  */
1204
1884
  response_id: string;
1885
+ /**
1886
+ * The cost run by run — the turn's own and each subagent's, by its name and model — so far: a turn at work is read as it spends.
1887
+ */
1888
+ runs: TurnRunCost[];
1205
1889
  /**
1206
1890
  * A model of the turn has no price: the cost is a lower bound.
1207
1891
  */
1208
1892
  unpriced: boolean;
1893
+ /**
1894
+ * cost_nano_usd in dollars.
1895
+ */
1896
+ usd: number;
1897
+ };
1898
+ /**
1899
+ * What one run of a turn — its own, or a subagent's — cost so far.
1900
+ */
1901
+ export type TurnRunCost = {
1902
+ /**
1903
+ * Tokens read from the provider's cache.
1904
+ */
1905
+ cache_read_tokens: number;
1906
+ /**
1907
+ * Tokens written to it.
1908
+ */
1909
+ cache_write_tokens: number;
1910
+ /**
1911
+ * Its cost, in billionths of a dollar.
1912
+ */
1913
+ cost_nano_usd: number;
1914
+ /**
1915
+ * Tokens read.
1916
+ */
1917
+ input_tokens: number;
1918
+ /**
1919
+ * The model it ran on, as provider:model.
1920
+ */
1921
+ model: string;
1922
+ /**
1923
+ * Tokens written.
1924
+ */
1925
+ output_tokens: number;
1926
+ /**
1927
+ * The run that started it; absent for the turn's own.
1928
+ */
1929
+ parent_run_id?: string;
1930
+ /**
1931
+ * Its response: the turn's, or the subagent's (an agent part's response_id).
1932
+ */
1933
+ response_id: string;
1934
+ /**
1935
+ * The run.
1936
+ */
1937
+ run_id: string;
1938
+ /**
1939
+ * Where it is: running, completed, failed…
1940
+ */
1941
+ state: string;
1942
+ /**
1943
+ * The subagent it is; empty for the turn's own run.
1944
+ */
1945
+ subagent: string;
1946
+ /**
1947
+ * Some of its use had no rate: the cost is a floor.
1948
+ */
1949
+ unpriced: boolean;
1950
+ /**
1951
+ * Its cost in dollars.
1952
+ */
1953
+ usd: number;
1954
+ };
1955
+ /**
1956
+ * A tool call of a turn as the engine committed it.
1957
+ */
1958
+ export type TurnToolCall = {
1959
+ /**
1960
+ * What the agent called it with, as JSON.
1961
+ */
1962
+ arguments: unknown;
1963
+ /**
1964
+ * The call.
1965
+ */
1966
+ call_id: string;
1967
+ /**
1968
+ * When it was made.
1969
+ */
1970
+ created_at: string;
1971
+ /**
1972
+ * The tool.
1973
+ */
1974
+ name: string;
1975
+ /**
1976
+ * What it returned, as the engine committed it: an app's, a backend's or an endpoint's answer as {output: [...], is_error}; a platform tool's own JSON. Absent: nothing yet.
1977
+ */
1978
+ result?: unknown;
1979
+ /**
1980
+ * Where it is, as the engine says it.
1981
+ */
1982
+ state: string;
1983
+ /**
1984
+ * When it last changed.
1985
+ */
1986
+ updated_at: string;
1987
+ };
1988
+ /**
1989
+ * A page of a turn's tool calls, in the order the engine committed them.
1990
+ */
1991
+ export type TurnToolCallPage = {
1992
+ /**
1993
+ * Pages on (cursor=); absent on the last page.
1994
+ */
1995
+ next_cursor?: string;
1996
+ /**
1997
+ * The calls.
1998
+ */
1999
+ tool_calls: TurnToolCall[];
1209
2000
  };
1210
2001
  /**
1211
2002
  * A page of uses.
@@ -1256,6 +2047,12 @@ export type Use = {
1256
2047
  * text, embedding or image.
1257
2048
  */
1258
2049
  kind: "text" | "embedding" | "image";
2050
+ /**
2051
+ * What the use is labelled by: its response's caller's labels — a chat's turn's, its chat's, and the chat (chat). {} for none.
2052
+ */
2053
+ metadata: {
2054
+ [key: string]: string;
2055
+ };
1259
2056
  /**
1260
2057
  * The model.
1261
2058
  */
@@ -1273,67 +2070,330 @@ export type Use = {
1273
2070
  * Text for the voice.
1274
2071
  */
1275
2072
  export type VoiceCommand = {
2073
+ /**
2074
+ * The voice's member the server tells it as (the server's alone).
2075
+ */
2076
+ as?: string;
1276
2077
  /**
1277
2078
  * The delegated voice part this answers (speak).
1278
2079
  */
1279
2080
  delegation_id?: string;
2081
+ /**
2082
+ * speak only: cut what the voice is saying and say the text at once.
2083
+ */
2084
+ interrupt?: boolean;
1280
2085
  /**
1281
2086
  * What it is given (16 KiB at most).
1282
2087
  */
1283
2088
  text: string;
1284
2089
  /**
1285
- * speak (say this), know (keep it in mind) or instruct (behave so).
2090
+ * speak (say this exactly and nothing else, once what the voice is saying ends; speaks in the order they came), tell (say it in your own words), know (keep it in mind) or instruct (behave so).
1286
2091
  */
1287
- type: "speak" | "know" | "instruct";
2092
+ type: "speak" | "tell" | "know" | "instruct";
1288
2093
  };
1289
2094
  /**
1290
- * Starts the chat's live voice.
2095
+ * What a person asked for out loud of a voice of delegation events: for the project's backend to have done, and answer with the voice's speak, naming the delegation.
1291
2096
  */
1292
- export type VoiceRequest = {
2097
+ export type VoiceDelegatedEvent = {
1293
2098
  /**
1294
- * The app's WebRTC offer (an SDP).
2099
+ * The chat.
1295
2100
  */
1296
- sdp: string;
2101
+ chat_id: string;
1297
2102
  /**
1298
- * The voice (the provider's default unless said).
2103
+ * The request: a speak naming it answers it.
1299
2104
  */
1300
- voice?: string;
1301
- };
1302
- /**
1303
- * A chat's live voice.
1304
- */
1305
- export type VoiceSession = {
2105
+ delegation_id: string;
1306
2106
  /**
1307
- * The chat.
2107
+ * What was said before it that the voice answered itself, in order.
1308
2108
  */
1309
- chat_id: string;
2109
+ earlier: VoiceLine[];
1310
2110
  /**
1311
- * The voice session.
2111
+ * The chat's labels.
1312
2112
  */
1313
- id: string;
2113
+ metadata: {
2114
+ [key: string]: string;
2115
+ };
1314
2116
  /**
1315
- * The provider's WebRTC answer, for the app's peer connection (on start).
2117
+ * What they asked, as the voice heard it.
1316
2118
  */
1317
- sdp?: string;
2119
+ text: string;
1318
2120
  /**
1319
- * How long it lasted (on close).
2121
+ * The voice's member (null: the server's own).
1320
2122
  */
1321
- seconds: number;
2123
+ user_id: string | null;
2124
+ /**
2125
+ * The voice.
2126
+ */
2127
+ voice_id: string;
2128
+ };
2129
+ /**
2130
+ * A chat's voice began, or ended.
2131
+ */
2132
+ export type VoiceEvent = {
2133
+ /**
2134
+ * The chat.
2135
+ */
2136
+ chat_id: string;
2137
+ /**
2138
+ * Why it ended (empty while live).
2139
+ */
2140
+ close_reason: string;
2141
+ /**
2142
+ * chat or events.
2143
+ */
2144
+ delegation: string;
2145
+ /**
2146
+ * The chat's labels.
2147
+ */
2148
+ metadata: {
2149
+ [key: string]: string;
2150
+ };
2151
+ /**
2152
+ * How long it lasted.
2153
+ */
2154
+ seconds: number;
1322
2155
  /**
1323
2156
  * active, or closed.
1324
2157
  */
1325
- status?: string;
2158
+ status: string;
2159
+ /**
2160
+ * Its member (null: the server's own).
2161
+ */
2162
+ user_id: string | null;
2163
+ /**
2164
+ * The voice.
2165
+ */
2166
+ voice_id: string;
2167
+ };
2168
+ /**
2169
+ * A line said in a voice conversation: the person's (user) or the voice's (assistant).
2170
+ */
2171
+ export type VoiceLine = {
2172
+ /**
2173
+ * user or assistant.
2174
+ */
2175
+ role: string;
2176
+ /**
2177
+ * The line.
2178
+ */
2179
+ text: string;
2180
+ };
2181
+ /**
2182
+ * Starts the chat's live voice.
2183
+ */
2184
+ export type VoiceRequest = {
2185
+ /**
2186
+ * The member the server starts it for (the server's alone): the voice is theirs, and counts toward their starts.
2187
+ */
2188
+ as?: string;
2189
+ /**
2190
+ * What becomes of what the person asks for out loud: chat (the default) — a message of the voice's member to the chat's agent, a turn of the chat, whose answer the voice says back; events — the event ai.voice.delegated, for the project's backend to have done and answer with speak (its delegation_id).
2191
+ */
2192
+ delegation?: "chat" | "events";
2193
+ /**
2194
+ * The app's WebRTC offer (an SDP).
2195
+ */
2196
+ sdp: string;
2197
+ /**
2198
+ * The voice (the provider's default unless said).
2199
+ */
2200
+ voice?: string;
2201
+ };
2202
+ /**
2203
+ * A chat's voice.
2204
+ */
2205
+ export type VoiceSession = {
2206
+ /**
2207
+ * The chat.
2208
+ */
2209
+ chat_id: string;
2210
+ /**
2211
+ * Why it ended: close_requested, member_removed, chat_deleted, replaced (its member started another), lost (the engine no longer holds it), or the provider's word.
2212
+ */
2213
+ close_reason?: string;
2214
+ /**
2215
+ * When it ended (null: live).
2216
+ */
2217
+ closed_at: string | null;
2218
+ /**
2219
+ * chat or events: what becomes of what the person asks for.
2220
+ */
2221
+ delegation: string;
2222
+ /**
2223
+ * The voice session.
2224
+ */
2225
+ id: string;
2226
+ /**
2227
+ * The provider's WebRTC answer, for the app's peer connection (on start).
2228
+ */
2229
+ sdp?: string;
2230
+ /**
2231
+ * How long it has lasted.
2232
+ */
2233
+ seconds: number;
2234
+ /**
2235
+ * When it began.
2236
+ */
2237
+ started_at: string;
2238
+ /**
2239
+ * active, or closed.
2240
+ */
2241
+ status: string;
2242
+ /**
2243
+ * The member it is (null: the server's own).
2244
+ */
2245
+ user_id: string | null;
2246
+ };
2247
+ /**
2248
+ * A file a published tree changed against the tree it replaced.
2249
+ */
2250
+ export type WorkspaceChange = {
2251
+ /**
2252
+ * added, modified (its bytes or its mode) or removed.
2253
+ */
2254
+ change: string;
2255
+ /**
2256
+ * The file, as the tree names it (repo/output/app/App.zip).
2257
+ */
2258
+ path: string;
2259
+ /**
2260
+ * Its size in the tree; 0 for one removed.
2261
+ */
2262
+ size_bytes: number;
2263
+ };
2264
+ /**
2265
+ * A tree the chat's workspace published: its machine publishes whenever the files are quiet for a moment — mid-turn, as a build writes its product — and once more as it lets the workspace go.
2266
+ */
2267
+ export type WorkspacePublishedEvent = {
2268
+ /**
2269
+ * What changed against the tree it replaced, sorted by path: 1000 at most (changed_truncated).
2270
+ */
2271
+ changed: WorkspaceChange[];
2272
+ /**
2273
+ * How many files changed.
2274
+ */
2275
+ changed_count: number;
2276
+ /**
2277
+ * More changed than changed names.
2278
+ */
2279
+ changed_truncated: boolean;
2280
+ /**
2281
+ * The chat.
2282
+ */
2283
+ chat_id: string;
2284
+ /**
2285
+ * The tree: a file of it is read by it (GET /ai/chats/{chat_id}/workspace/files?manifest=), whatever the workspace published after it.
2286
+ */
2287
+ manifest_id: string;
2288
+ /**
2289
+ * The chat's labels.
2290
+ */
2291
+ metadata: {
2292
+ [key: string]: string;
2293
+ };
2294
+ /**
2295
+ * The tree it replaced; absent for none.
2296
+ */
2297
+ previous_manifest_id?: string;
2298
+ };
2299
+ /**
2300
+ * A push the chat's agent made: to the chat's branch, the only one a turn's work is pushed to.
2301
+ */
2302
+ export type WorkspacePushedEvent = {
2303
+ /**
2304
+ * The branch it was pushed to.
2305
+ */
2306
+ branch: string;
2307
+ /**
2308
+ * The chat.
2309
+ */
2310
+ chat_id: string;
2311
+ /**
2312
+ * What the push brought to the branch, the oldest first: 100 at most (commits_truncated); none when the branch was there already.
2313
+ */
2314
+ commits: PushedCommit[];
2315
+ /**
2316
+ * It brought more than commits names.
2317
+ */
2318
+ commits_truncated: boolean;
2319
+ /**
2320
+ * The commit the branch is at now.
2321
+ */
2322
+ head_sha: string;
2323
+ /**
2324
+ * The chat's labels.
2325
+ */
2326
+ metadata: {
2327
+ [key: string]: string;
2328
+ };
2329
+ /**
2330
+ * The project's name of the repository (PUT /ai/repos/{name}).
2331
+ */
2332
+ repo: string;
2333
+ /**
2334
+ * The GitHub repository, owner/name.
2335
+ */
2336
+ repository: string;
2337
+ /**
2338
+ * The turn — or a subagent's work in it — that pushed.
2339
+ */
2340
+ response_id: string;
2341
+ /**
2342
+ * The member the turn was for; null: the server's.
2343
+ */
2344
+ user_id: string | null;
2345
+ };
2346
+ /**
2347
+ * A repository put in an open chat's workspace.
2348
+ */
2349
+ export type WorkspaceRepoRequest = {
2350
+ /**
2351
+ * The branch it is checked out at and pushed to (the repository's default unless said).
2352
+ */
2353
+ branch?: string;
2354
+ /**
2355
+ * The project's name for the repository (PUT /ai/repos/{name}): one put at work's moment too.
2356
+ */
2357
+ repo: string;
1326
2358
  };
1327
2359
  /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
1328
2360
  export interface Events {
1329
2361
  /**
1330
- * ai.response.completed: a response started with background: true completed; read its answer by its id.
2362
+ * ai.goal.updated: a chat's goal was set, its status changed (paused, resumed, blocked, out of budget or turns, achieved), or it was cleared.
2363
+ */
2364
+ "ai.goal.updated": GoalEvent;
2365
+ /**
2366
+ * ai.response.completed: a response started with background: true completed — read its answer by its id — or a chat's turn completed.
1331
2367
  */
1332
2368
  "ai.response.completed": ResponseEvent;
1333
2369
  /**
1334
- * ai.response.failed: a response started with background: true ended without completing (failed, canceled, timed out, over its budget).
2370
+ * ai.response.failed: a response started with background: true ended without completing (failed, canceled, timed out, over its budget), or a chat's turn did (failed, stopped, budget_exceeded).
1335
2371
  */
1336
2372
  "ai.response.failed": ResponseEvent;
2373
+ /**
2374
+ * ai.response.started: a chat's turn began — a member's message, the server's, the chat's goal, or the late messages of the turn before opened it.
2375
+ */
2376
+ "ai.response.started": ResponseEvent;
2377
+ /**
2378
+ * ai.voice.closed: a chat's voice ended — closed, replaced, its member taken out, its chat deleted, lost — with how long it lasted.
2379
+ */
2380
+ "ai.voice.closed": VoiceEvent;
2381
+ /**
2382
+ * ai.voice.delegated: a person asked a voice of delegation events for something out loud; the backend answers with the voice's speak, naming the delegation.
2383
+ */
2384
+ "ai.voice.delegated": VoiceDelegatedEvent;
2385
+ /**
2386
+ * ai.voice.started: a chat's voice began.
2387
+ */
2388
+ "ai.voice.started": VoiceEvent;
2389
+ /**
2390
+ * ai.workspace.published: a chat's workspace published a tree — what its files are now, with the files it changed; read one of them by the tree (GET /ai/chats/{chat_id}/workspace/files?manifest=).
2391
+ */
2392
+ "ai.workspace.published": WorkspacePublishedEvent;
2393
+ /**
2394
+ * ai.workspace.pushed: a chat's agent pushed its work to the chat's branch, with the commits it brought.
2395
+ */
2396
+ "ai.workspace.pushed": WorkspacePushedEvent;
1337
2397
  }
1338
2398
  /** Palbase ai */
1339
2399
  export declare function client(t: Transport): {
@@ -1371,11 +2431,14 @@ export declare function client(t: Transport): {
1371
2431
  /**
1372
2432
  * The chats
1373
2433
  *
1374
- * The server's: every chat, or a member's (member=); a user's: the chats they are in. The newest first, 100 at most.
2434
+ * The server's: every chat, or a member's (member=); a user's: the chats they are in. The newest first, a page at a time (limit, cursor), and only those labelled so when metadata= names labels.
1375
2435
  */
1376
2436
  listChats(input?: {
1377
2437
  query?: {
1378
- member?: string;
2438
+ member?: string; /** How many (1 to 100, default 100). */
2439
+ limit?: number; /** next_cursor of the page before. */
2440
+ cursor?: string; /** A label the chats have, key:value (its metadata); given again, every label named: metadata=project_id:p_123. */
2441
+ metadata?: string[];
1379
2442
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1380
2443
  signal?: AbortSignal;
1381
2444
  }): Promise<Reply<200, ChatList>>;
@@ -1423,10 +2486,74 @@ export declare function client(t: Transport): {
1423
2486
  body: DecisionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1424
2487
  signal?: AbortSignal;
1425
2488
  }): Promise<Reply<200, Decision>>;
2489
+ /**
2490
+ * Fork a chat before a message
2491
+ *
2492
+ * Forks the chat before one of its messages — what a person's "edit this message" makes: a new chat that begins where this one was, without that message and what came after it, for the edited message to be sent into. The project's server's alone, as starting a chat is. The fork talks to the same agent, carries the chat's labels and — unless members says otherwise — its members. What it begins with is the chat's messages and its agent's answers before that message, in the journal's order — its subagents' work left out, a member's message with the context the model read with it: the engine is given them with the fork's first turn, and its pipe writes them first (history parts). A fork of a chat that works in a workspace works in the same one, the files as they are now, on a session of its own; the workspace goes once no chat that works in it is left. A chat whose agent is at work is not forked (409 turn_running); a message that is not one of the chat's, or that its agent was not given, is 400; what came before past 512 KiB is 409 fork_too_large; past the history the project keeps, 409 history_full.
2493
+ */
2494
+ forkChat(input: {
2495
+ path: {
2496
+ chat_id: string;
2497
+ };
2498
+ body: ForkRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2499
+ signal?: AbortSignal;
2500
+ }): Promise<Reply<201, Chat>>;
2501
+ /**
2502
+ * Read the chat's goal
2503
+ *
2504
+ * The chat's goal: its status, why it stopped, what its next turn is (phase), its limits and what it has used so far. The project's server's.
2505
+ */
2506
+ getChatGoal(input: {
2507
+ path: {
2508
+ chat_id: string;
2509
+ };
2510
+ query?: {
2511
+ as?: string;
2512
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2513
+ signal?: AbortSignal;
2514
+ }): Promise<Reply<200, Goal>>;
2515
+ /**
2516
+ * Set the chat's goal
2517
+ *
2518
+ * Sets the chat's goal — replacing any it had: the engine works the chat toward the objective by itself, a turn at a time — each turn the chat's agent as it is defined now (a backend's agent is asked, told of the goal), judged when it ends, a claimed completion checked against the rubric — until it is met, or max_turns, the budget or a brake (turns that fail, that do nothing) stops it; its first turn opens at once when no turn of the chat is at work. The project's server's alone — as itself, or as a member (as: the goal is then theirs, as their message's turn is: they decide and answer its turns' approvals and app tools, and change and clear it — while they stand where they stood when it was set: in the chat, and, its agent defined for them alone, the chat theirs alone; taken out, or the chat given another member, the goal is paused with a reason saying why and its turn at work stopped). Each of its turns is the chat's: in its stream (a turn part that says the goal's, its role and number), billed, its tools served, stopped by a stop; a member's message goes before its next turn. Its status, each time it changes, is the event ai.goal.updated, and its words are goal parts of the chat's stream.
2519
+ */
2520
+ setChatGoal(input: {
2521
+ path: {
2522
+ chat_id: string;
2523
+ };
2524
+ body: GoalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2525
+ signal?: AbortSignal;
2526
+ }): Promise<Reply<200, Goal>>;
2527
+ /**
2528
+ * Clear the chat's goal
2529
+ *
2530
+ * Clears the chat's goal: no turn of it opens again, and one at work finishes as an ordinary turn. As the server, or as the member it was set as (as); the event ai.goal.updated says it cleared.
2531
+ */
2532
+ clearChatGoal(input: {
2533
+ path: {
2534
+ chat_id: string;
2535
+ };
2536
+ query?: {
2537
+ as?: string;
2538
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2539
+ signal?: AbortSignal;
2540
+ }): Promise<Reply<204, undefined>>;
2541
+ /**
2542
+ * Change the chat's goal
2543
+ *
2544
+ * Pauses the goal (with a reason, said in its event) or resumes it — a resumed goal opens its next turn at once when no turn of the chat is at work — edits its objective or rubric, or changes a limit (null: none). As the server, or as the member it was set as (as); another member changes nothing of it (403 not_your_turn). An achieved goal is changed by setting a new one (409 goal_achieved); one set as a member who no longer stands where they stood when it was set — out of the chat, or the chat no longer theirs alone — is not resumed (409 goal_lapsed): it is cleared, or another set for the chat as it is now.
2545
+ */
2546
+ updateChatGoal(input: {
2547
+ path: {
2548
+ chat_id: string;
2549
+ };
2550
+ body: GoalPatch; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2551
+ signal?: AbortSignal;
2552
+ }): Promise<Reply<200, Goal>>;
1426
2553
  /**
1427
2554
  * Put a user in a chat
1428
2555
  *
1429
- * Who is in a chat is the server's to say.
2556
+ * Who is in a chat is the server's to say. A goal set as the chat's one member, its agent defined for them alone, is paused when another is put in it.
1430
2557
  */
1431
2558
  putChatMember(input: {
1432
2559
  path: {
@@ -1439,7 +2566,7 @@ export declare function client(t: Transport): {
1439
2566
  /**
1440
2567
  * Take a user out of a chat
1441
2568
  *
1442
- * The server takes anyone out; a user takes themselves out.
2569
+ * The server takes anyone out; a user takes themselves out. A goal set as the member taken out is paused, and its turn at work stopped.
1443
2570
  */
1444
2571
  deleteChatMember(input: {
1445
2572
  path: {
@@ -1466,7 +2593,7 @@ export declare function client(t: Transport): {
1466
2593
  /**
1467
2594
  * Write to a chat
1468
2595
  *
1469
- * A message for the agent: a turn of its own when none runs; while one does, at its next step (next) or cutting the step it is in (now). The same client_id again is the same message. A user sends user_messages_per_minute a minute — and so does the server writing as them (429 too_many_messages); past the history the project keeps a message is refused (409 history_full).
2596
+ * A message for the agent: a turn of its own when none runs; while one does, at its next step (next) or cutting the step it is in (now). The same client_id again is the same message. A user sends user_messages_per_minute a minute — and so does the server writing as them (429 too_many_messages); past the history the project keeps a message is refused (409 history_full). It carries pictures of the project's storage the model is shown (images) and, in a chat that works in a workspace, files put in it before the agent reads the message (files), each copied for the chat.
1470
2597
  */
1471
2598
  sendChatMessage(input: {
1472
2599
  path: {
@@ -1475,10 +2602,39 @@ export declare function client(t: Transport): {
1475
2602
  body: MessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1476
2603
  signal?: AbortSignal;
1477
2604
  }): Promise<Reply<200, ChatMessage> | Reply<202, ChatMessage>>;
2605
+ /**
2606
+ * A picture or a file a message carries
2607
+ *
2608
+ * The bytes of a picture or a file a message of the chat carries, as it was sent (a download by its name, never a page): to the chat's members and its server. A position the message has nothing at is not found (404 attachment_not_found).
2609
+ */
2610
+ getChatMessageAttachment(input: {
2611
+ path: {
2612
+ chat_id: string; /** The message. */
2613
+ message_id: string; /** Its place among the message's attachments (its images, then its files), from 0. */
2614
+ position: number;
2615
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2616
+ signal?: AbortSignal;
2617
+ }): Promise<Reply<200, Response>>;
2618
+ /**
2619
+ * The chat's past
2620
+ *
2621
+ * The chat's past as its stream told it, a page at a time from its newest end back: the members' messages, the turns, the answers as text at their offsets, the tools and the subagents, the goal's and the voice's words — each page in the order it was told, each part under the id its channel told it (part_id), so an app holding the channel's parts and a page of these keeps each once. A page reads limit of the chat's events before the cursor, or before the oldest part the app holds of the chat's channel (before: that part's id), so the first page does not read again the day the channel told; with neither, from its newest end. Given both, the call is refused (400). The page that reaches the chat's start begins with where a fork began. A voice's end is under the id its channel told it (vclosed:<voice>); a voice the engine lost, its end said by no journal, has it right after its last part. Reading a page records nothing. A call's answer is by its end, as the stream shows it. Read by the chat's members and the project's server.
2622
+ */
2623
+ listChatParts(input: {
2624
+ path: {
2625
+ chat_id: string;
2626
+ };
2627
+ query?: {
2628
+ limit?: number; /** A next_cursor: the page before it. Not with before. */
2629
+ cursor?: string; /** The id of the oldest part the app holds of the chat's channel (a part's id: its journal sequence): the first page is the parts told before it. Not with cursor. */
2630
+ before?: number;
2631
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2632
+ signal?: AbortSignal;
2633
+ }): Promise<Reply<200, ChatPartPage>>;
1478
2634
  /**
1479
2635
  * Pipe the chat into a channel
1480
2636
  *
1481
- * Writes the chat's stream into a channel of the project's realtime from now on — a gateway's, durable — as the platform: the members' messages, the turns, the answer as it is written (gathered into a few writes a second), the tools and subagents, each the channel's event `chat` {type, id?, data}, under an id of its own so a retry is kept once. The types: `message` (a ChatMessage, as the agent got it), `turn` ({response_id, status: running|waiting|completed|failed|canceled|timed_out|budget_exceeded, user_id, solo, waiting: {reason: approval|tool_output|subagents|message, text_offset, approval_id, tool_call_id, tool_name, input}, error}), `text` ({response_id, offset, text}: the agent's answer as it is written, at its byte offset), `reset` ({response_id, offset}: discard the answer past offset), `tool` ({response_id, run_id, call_id, name, status: running|awaiting_output|awaiting_approval|approved|denied|expired|completed|failed|canceled, text_offset, input, output, image_count, is_error, approval_id, agent_response_id, …}), `agent` ({run_id, response_id, parent_response_id, name, required, status, text_offset}: a subagent at work), `voice` ({voice_session_id, kind: transcript|started|closed|delegated, role: user|assistant, text, delegation_id, task}: the chat's live voice — what was said either way), and `seen` (the journal moved past what was handed already). Every type but text and reset has the journal's sequence as its id; text_offset says where in the answer a tool or subagent part happened. The project's backend is not in the stream: the gateway's members hear the chat from realtime, and one that was away is given what it missed there. Put again with the same channel it goes on where it is — one realtime refused is tried again; with another, from the chat's start, and nothing more is written into the one before. The project's server's alone.
2637
+ * Writes the chat's stream into a channel of the project's realtime from now on — a gateway's, durable — as the platform: the members' messages, the turns, the answer as it is written (gathered into a few writes a second), the tools and subagents, each the channel's event `chat` {type, id?, data}, under an id of its own so a retry is kept once. The types: `message` (a ChatMessage, as the agent got it), `turn` ({response_id, status: running|waiting|completed|failed|canceled|timed_out|budget_exceeded, user_id, solo, goal: {goal_id, role: work|verify, seq} — a turn of the chat's goal, waiting: {reason: approval|tool_output|subagents|message, text_offset, approval_id, tool_call_id, tool_name, input, publication}, end: completed|failed|stopped|budget_exceeded — as the turn's event says it, error: {code, message, retryable}}), `text` ({response_id, offset, text}: the agent's answer as it is written, at its byte offset), `reset` ({response_id, offset}: discard the answer past offset), `thinking` ({response_id, run_id, step_id, text}: the model's reasoning as it thinks, when the agent shows it — thinking: visible), `tool` ({response_id, run_id, call_id, name, status: running|awaiting_output|awaiting_approval|approved|denied|expired|completed|failed|canceled, text_offset, input, output, image_count, is_error, approval_id, agent_response_id, …}), `agent` ({run_id, response_id, parent_response_id, name, required, status, text_offset}: a subagent at work), `goal` ({goal_id, kind: set|updated|turn_started|judged|verified|status_changed|cleared, goal: {objective, rubric, status, stop_code, stop_reason, phase, max_turns, max_cost_usd}, role, seq, response_id, run_id, verdict, reason, missing, from, to, code}: the chat's goal's words), `voice` ({voice_id, user_id, delegation, status: started|closed, seconds, close_reason}: the chat's live voice began or ended), `transcript` ({id, voice_id, role: user|assistant, user_id, author_name, text, final, created_at}: a line it said either way — the chat's history's message of kind voice, by its id), `seen` (the journal moved past what was handed already), and — first, in a fork's channel — `history` ({forked_from: {chat_id, before_message}, part, parts, items: [{role: user|assistant, message_id, client_id, author, author_name, text, metadata, created_at, response_id, text_truncated, attachments}]}: what the fork began with, a few items a part, a long text cut in its part, its id h and the part's place). Every type but text and reset has the journal's sequence as its id; text_offset says where in the answer a tool or subagent part happened. The project's backend is not in the stream: the gateway's members hear the chat from realtime, and one that was away is given what it missed there. Put again with the same channel it goes on where it is — one realtime refused is tried again; with another, from the chat's start, and nothing more is written into the one before. The project's server's alone.
1482
2638
  */
1483
2639
  putChatPipe(input: {
1484
2640
  path: {
@@ -1511,21 +2667,63 @@ export declare function client(t: Transport): {
1511
2667
  body: RunMessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1512
2668
  signal?: AbortSignal;
1513
2669
  }): Promise<Reply<202, RunMessageAccepted>>;
2670
+ /**
2671
+ * Stop a subagent at work
2672
+ *
2673
+ * Stops one subagent at work — with the subagents it started and its background work: the agent that started it is told a person stopped it, and not to start that work again unless asked, and the rest of the turn goes on. Any member stops it, as any member stops the turn, and the server — as itself, or as a member (as: the server's alone; a user sending it is answered 400; one who is not a member of the chat, 403 not_a_member). Asked again, the same stop answers as it did. A run that is not a subagent at work in this chat — ended, the agent itself, another chat's — is 404.
2674
+ */
2675
+ stopSubagent(input: {
2676
+ path: {
2677
+ chat_id: string; /** The subagent's run (an agent event's run_id). */
2678
+ run_id: string;
2679
+ };
2680
+ body?: RunStopRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2681
+ signal?: AbortSignal;
2682
+ }): Promise<Reply<200, RunStopped>>;
1514
2683
  /**
1515
2684
  * Stop the agent
1516
2685
  *
1517
- * Stops the turn it is working on: what it wrote stays; a message after starts the next turn.
2686
+ * Stops the turn it is working on: what it wrote stays; a message after starts the next turn. Any member's; the server's as itself, or as a member (as).
1518
2687
  */
1519
2688
  stopChat(input: {
1520
2689
  path: {
1521
2690
  chat_id: string;
1522
- }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2691
+ };
2692
+ body?: ChatStop; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1523
2693
  signal?: AbortSignal;
1524
2694
  }): Promise<Reply<200, StopResult>>;
2695
+ /**
2696
+ * A turn's tool calls
2697
+ *
2698
+ * A turn's tool calls as the engine committed them — their arguments and results as they were (what a diff of the files the turn wrote is made of), in their order, a page at a time. The project's server's alone; a subagent's work is read by its response (an agent part's response_id).
2699
+ */
2700
+ listTurnToolCalls(input: {
2701
+ path: {
2702
+ chat_id: string;
2703
+ };
2704
+ query: {
2705
+ turn: string; /** How many calls a page holds (1 to 500; 100). */
2706
+ limit?: number; /** A next_cursor: the page after it. */
2707
+ cursor?: string;
2708
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2709
+ signal?: AbortSignal;
2710
+ }): Promise<Reply<200, TurnToolCallPage>>;
2711
+ /**
2712
+ * A tool call of the chat, whole
2713
+ *
2714
+ * One tool call of the chat, its whole answer: the chat's stream shows a call's answer by its end (its last 16 KiB, omitted_bytes what it left out) — read here whole, its secret shapes masked as the stream masks them. Read by the chat's members and the project's server; another chat's call is not found.
2715
+ */
2716
+ getChatToolCall(input: {
2717
+ path: {
2718
+ chat_id: string; /** The call: a tool part's call_id. */
2719
+ call_id: string;
2720
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2721
+ signal?: AbortSignal;
2722
+ }): Promise<Reply<200, ChatToolCall>>;
1525
2723
  /**
1526
2724
  * Answer an app's tool call
1527
2725
  *
1528
- * The answer of a client tool's call, made by the app's code: the turn waiting for it goes on. The first answer is the one. Given by the app of the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as).
2726
+ * The answer of a client tool's call, made by the app's code: the turn waiting for it goes on. The first answer is the one. Given by the app of the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as). A call of the project's backend (or an HTTPS tool of its) that answered {"deferred": true} — its work outlasts a call — is answered here too, by the project's server as itself, within the while it named (a minute to a day; an hour), and by no member.
1529
2727
  */
1530
2728
  answerChatToolCall(input: {
1531
2729
  path: {
@@ -1575,7 +2773,7 @@ export declare function client(t: Transport): {
1575
2773
  /**
1576
2774
  * Start a chat's voice
1577
2775
  *
1578
- * Starts the chat's live voice: the app's WebRTC offer in, the answer out — the audio then goes between the app and the platform's voice provider. What is said either way is in the chat's stream as voice parts (transcripts); a task the voice hands over is a voice part of kind delegated. One voice a chat at a time (409 voice_active). A user starts at most 5 voices an hour in the project's chats (429 too_many_voices, with Retry-After) — each is the project's spend while it lasts; the server's starts are not counted.
2776
+ * Starts the chat's live voice: the app's WebRTC offer in, the answer out — the audio then goes between the app and the platform's voice provider. The voice is its member's — the user who starts it, or the member the server starts it for (as): they or the server read, tell and close it, no other member. What the person asks for out loud becomes, by delegation, a turn of the chat as that member whose answer the voice says back (chat, the default), or the event ai.voice.delegated (events). What is said either way is the chat's: transcript parts of its stream and lines of its history (messages of kind voice). One voice talks in a chat at a time: a member's new voice ends the one they left open (closed replaced); another member's live voice is refused (409 voice_active). A user starts at most 5 voices an hour in the project's chats, the server's for them counted as theirs (429 too_many_voices, with Retry-After) — each is the project's spend while it lasts. Its start is the event ai.voice.started.
1579
2777
  */
1580
2778
  startChatVoice(input: {
1581
2779
  path: {
@@ -1584,22 +2782,40 @@ export declare function client(t: Transport): {
1584
2782
  body: VoiceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1585
2783
  signal?: AbortSignal;
1586
2784
  }): Promise<Reply<201, VoiceSession>>;
2785
+ /**
2786
+ * Read a chat's voice
2787
+ *
2788
+ * The chat's voice: whose it is, whether it is live, how long it has lasted and why it ended — read from the engine while it is live. Its member's, or the server's (403 not_your_voice).
2789
+ */
2790
+ getChatVoice(input: {
2791
+ path: {
2792
+ chat_id: string; /** The voice session. */
2793
+ voice_id: string;
2794
+ };
2795
+ query?: {
2796
+ as?: string;
2797
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2798
+ signal?: AbortSignal;
2799
+ }): Promise<Reply<200, VoiceSession>>;
1587
2800
  /**
1588
2801
  * Close a chat's voice
1589
2802
  *
1590
- * Ends the chat's voice; the answer says how long it lasted.
2803
+ * Ends the chat's voice; the answer says how long it lasted and why it ended. Its member's, or the server's (403 not_your_voice). Its end is the event ai.voice.closed — once.
1591
2804
  */
1592
2805
  closeChatVoice(input: {
1593
2806
  path: {
1594
2807
  chat_id: string; /** The voice session. */
1595
2808
  voice_id: string;
2809
+ };
2810
+ query?: {
2811
+ as?: string;
1596
2812
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1597
2813
  signal?: AbortSignal;
1598
2814
  }): Promise<Reply<200, VoiceSession>>;
1599
2815
  /**
1600
2816
  * Tell a chat's voice
1601
2817
  *
1602
- * The server's alone (a member is answered 403 server_only): a member's words would be the agent's own to every other member of the chat. Gives the chat's voice text: speak says it, know keeps it in mind, instruct changes how it behaves — speak with a delegation_id answers a task it handed over.
2818
+ * The server's alone (a member is answered 403 server_only), as itself or as the voice's member (as; another member 403 not_your_voice): a member's words would be the agent's own to every other member of the chat. Gives the chat's voice text: speak says it, know keeps it in mind, instruct changes how it behaves — speak with a delegation_id answers a request it handed over (ai.voice.delegated). A voice that has ended is 409 voice_closed.
1603
2819
  */
1604
2820
  commandChatVoice(input: {
1605
2821
  path: {
@@ -1609,6 +2825,33 @@ export declare function client(t: Transport): {
1609
2825
  body: VoiceCommand; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1610
2826
  signal?: AbortSignal;
1611
2827
  }): Promise<Reply<202, VoiceSession>>;
2828
+ /**
2829
+ * A file of the chat's workspace
2830
+ *
2831
+ * A file of the chat's workspace, its bytes (an attachment, never a page): from the tree the workspace is at now, or from the one an ai.workspace.published event named (manifest) — a build's product as that publish left it. Read by the chat's members and the project's server, as they read the chat. Served up to 64 MiB (413 file_too_large past it: publish a larger one as the turn's artifact); its digest is Content-Digest. A project reads 4 files at once (429 too_many_reads, Retry-After), and a file is written for no longer than its bytes take at 256 KiB/s and a minute more. A chat that works in no workspace yet, a tree of another workspace, a path its tree does not name: 404 file_not_found.
2832
+ */
2833
+ getChatWorkspaceFile(input: {
2834
+ path: {
2835
+ chat_id: string;
2836
+ };
2837
+ query: {
2838
+ path: string; /** The tree to read it from: an ai.workspace.published event's manifest_id (none: the tree the workspace is at now). */
2839
+ manifest?: string;
2840
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2841
+ signal?: AbortSignal;
2842
+ }): Promise<Reply<200, Response>>;
2843
+ /**
2844
+ * Put a repository in the chat's workspace
2845
+ *
2846
+ * Puts one more of the project's repositories in the chat's workspace, at a branch, under its name beside the others: the engine clones it and merges it into the workspace's tree before the chat's next turn takes a machine; a chat whose first turn has not opened its workspace has it from that turn. Every chat working in the workspace (a fork works in its chat's) has it. Put again, the same. The project's server's alone; a chat that works in no workspace is refused (409 no_workspace).
2847
+ */
2848
+ addChatWorkspaceRepo(input: {
2849
+ path: {
2850
+ chat_id: string;
2851
+ };
2852
+ body: WorkspaceRepoRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2853
+ signal?: AbortSignal;
2854
+ }): Promise<Reply<200, Chat>>;
1612
2855
  /**
1613
2856
  * Turn texts into vectors
1614
2857
  *
@@ -1629,7 +2872,7 @@ export declare function client(t: Transport): {
1629
2872
  /**
1630
2873
  * Put a tool endpoint
1631
2874
  *
1632
- * A tool at an HTTPS address of the project's — called with a signed POST {tool, call_id, input, context} and answered {output, is_error} or plain text — or an MCP server, whose tools an agent may use. The answer says an https tool's signing secret, once.
2875
+ * A tool at an HTTPS address of the project's — called with a signed POST {tool, call_id, input, context: {chat_id, agent, user, metadata, turn_id, run_id, subagent} — the turn, and the run that called: the agent's own, or a subagent's at work (subagent names which, null for the agent)} and answered {output, is_error} or plain text — or an MCP server, whose tools an agent may use. The answer says an https tool's signing secret, once.
1633
2876
  */
1634
2877
  putEndpoint(input: {
1635
2878
  path: {
@@ -1726,9 +2969,13 @@ export declare function client(t: Transport): {
1726
2969
  /**
1727
2970
  * The project's repositories
1728
2971
  *
1729
- * The repositories the project's chats work in.
2972
+ * The repositories the project's chats work in, by name, a page at a time (a project puts 10000 at most).
1730
2973
  */
1731
2974
  listRepos(input?: {
2975
+ query?: {
2976
+ limit?: number; /** next_cursor of the page before. */
2977
+ cursor?: string;
2978
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1732
2979
  signal?: AbortSignal;
1733
2980
  }): Promise<Reply<200, RepoPage>>;
1734
2981
  /**
@@ -1757,7 +3004,7 @@ export declare function client(t: Transport): {
1757
3004
  /**
1758
3005
  * Ask a model
1759
3006
  *
1760
- * Admits a response: an answer to the input, as text or — with a schema — as a JSON document of that shape, validated before it is returned. With stream: true the answer is the response's live view (text/event-stream). With background: true it answers at once and the response's end is the event ai.response.completed (or ai.response.failed). Otherwise it answers at once with the response queued; read it by its id.
3007
+ * Admits a response: an answer to the input, as text or — with a schema — as a JSON document of that shape, validated before it is returned. With stream: true the answer is the response's live view (text/event-stream). With background: true it answers at once and the response's end is the event ai.response.completed (or ai.response.failed). Otherwise it answers at once with the response queued; read it by its id. What the agent is given — its instructions, the conversation, the schema and the tools together — is at most 1 MiB as JSON, what the model service reads (413 request_too_large).
1761
3008
  */
1762
3009
  createResponse(input: {
1763
3010
  headers: {
@@ -1828,7 +3075,8 @@ export declare function client(t: Transport): {
1828
3075
  query?: {
1829
3076
  limit?: number; /** The next_cursor of the previous page. */
1830
3077
  cursor?: string; /** Only uses of this kind: text, embedding or image. */
1831
- kind?: "text" | "embedding" | "image";
3078
+ kind?: "text" | "embedding" | "image"; /** Labels each use listed carries, as a JSON object ({"product":"p1"}): a product's spend, a task's. */
3079
+ metadata?: string;
1832
3080
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1833
3081
  signal?: AbortSignal;
1834
3082
  }): Promise<Reply<200, UsagePage>>;