palbase 0.1.0 → 0.3.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/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/{3VASGTIN.js → 4A6S7JKW.js} +2 -2
- package/dist/chunks/{JAWWIVZH.js → 4LGRTNOK.js} +2 -2
- package/dist/chunks/6BUQ7N4I.js +2 -0
- package/dist/chunks/7D5J3M3D.js +87 -0
- package/dist/chunks/A4VJFSSX.js +2 -0
- package/dist/chunks/AR6WQDU5.js +2 -0
- package/dist/chunks/{45J7YXRB.js → BPWQDLXP.js} +1 -1
- package/dist/chunks/{DAOLIUNZ.js → IQIXNAI4.js} +1 -1
- package/dist/chunks/{UAY56IQR.js → LLBV62FM.js} +2 -2
- package/dist/chunks/{E5Q4VTW4.js → MJ35SVVY.js} +2 -2
- package/dist/chunks/{QXUMLO7O.js → NDJAXNM6.js} +2 -2
- package/dist/chunks/RK6M2LNY.js +2 -0
- package/dist/chunks/{6FWCNTAM.js → UNOLIHKD.js} +1 -1
- package/dist/chunks/{3OGEBGYZ.js → W2GV6UU3.js} +2 -2
- package/dist/chunks/{LYEFPLJZ.js → YQYMP55L.js} +1 -1
- package/dist/cli.js +90 -90
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.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/index.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -0
- package/dist/web/vite.js +2 -2
- package/package.json +6 -2
- package/types/internal/src/modules/ai.d.ts +811 -0
- package/types/internal/src/modules/events.d.ts +2 -2
- package/types/internal/src/modules/purchases.d.ts +2609 -133
- package/types/internal/src/modules/storage.d.ts +1 -1
- package/types/web/src/client.d.ts +6 -0
- package/types/web/src/index.d.ts +3 -0
- package/types/web/src/paywall/assets.d.ts +51 -0
- package/types/web/src/paywall/attributes.d.ts +13 -0
- package/types/web/src/paywall/icons.d.ts +5 -0
- package/types/web/src/paywall/index.d.ts +7 -0
- package/types/web/src/paywall/placement.d.ts +99 -0
- package/types/web/src/paywall/prices.d.ts +40 -0
- package/types/web/src/paywall/render.d.ts +93 -0
- package/types/web/src/paywall/resolve.d.ts +184 -0
- package/types/web/src/purchases.d.ts +34 -2
- package/dist/chunks/3XT4L2XV.js +0 -2
- package/dist/chunks/HKJU2FKE.js +0 -2
- package/dist/chunks/IKVOXHEE.js +0 -2
|
@@ -1,4 +1,211 @@
|
|
|
1
1
|
import { type Reply, type Transport } from '../transport.js';
|
|
2
|
+
/**
|
|
3
|
+
* A named agent of the project.
|
|
4
|
+
*/
|
|
5
|
+
export type Agent = {
|
|
6
|
+
definition: AgentDefinition;
|
|
7
|
+
/**
|
|
8
|
+
* Its name.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* When it was last put.
|
|
13
|
+
*/
|
|
14
|
+
updated_at: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* What an agent is for a turn: its instructions, model, tools and subagents — or, for one the project's backend defines at every turn's start (the framework's ai.agent), the machine to ask (backend), alone.
|
|
18
|
+
*/
|
|
19
|
+
export type AgentDefinition = {
|
|
20
|
+
/**
|
|
21
|
+
* The project's machine that defines the agent at each turn.
|
|
22
|
+
*/
|
|
23
|
+
backend?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The app's users start chats with this named agent themselves (when the project lets them talk to its agents): an agent the server alone uses is not one they reach.
|
|
26
|
+
*/
|
|
27
|
+
clients?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Its instructions.
|
|
30
|
+
*/
|
|
31
|
+
instructions?: string;
|
|
32
|
+
/**
|
|
33
|
+
* How many tool calls a turn makes at most: past it the agent is told it has no tools left and answers.
|
|
34
|
+
*/
|
|
35
|
+
max_tool_calls?: number;
|
|
36
|
+
/**
|
|
37
|
+
* A role (fast, default, strong) or a catalogue model.
|
|
38
|
+
*/
|
|
39
|
+
model?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Its subagents (16 at most).
|
|
42
|
+
*/
|
|
43
|
+
subagents?: Subagent[];
|
|
44
|
+
/**
|
|
45
|
+
* Its tools (64 at most, with its MCP servers').
|
|
46
|
+
*/
|
|
47
|
+
tools?: ToolRef[];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The project's named agents.
|
|
51
|
+
*/
|
|
52
|
+
export type AgentList = {
|
|
53
|
+
/**
|
|
54
|
+
* By name.
|
|
55
|
+
*/
|
|
56
|
+
agents: Agent[];
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* A conversation of the project's users with one of its agents.
|
|
60
|
+
*/
|
|
61
|
+
export type Chat = {
|
|
62
|
+
/**
|
|
63
|
+
* The agent it talks to.
|
|
64
|
+
*/
|
|
65
|
+
agent: string;
|
|
66
|
+
/**
|
|
67
|
+
* When it was started.
|
|
68
|
+
*/
|
|
69
|
+
created_at: string;
|
|
70
|
+
/**
|
|
71
|
+
* The user who started it; null: the project's server.
|
|
72
|
+
*/
|
|
73
|
+
created_by: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* What it keeps of the project's history.
|
|
76
|
+
*/
|
|
77
|
+
history_bytes: number;
|
|
78
|
+
/**
|
|
79
|
+
* The chat's id.
|
|
80
|
+
*/
|
|
81
|
+
id: string;
|
|
82
|
+
/**
|
|
83
|
+
* Who reads it and writes to it.
|
|
84
|
+
*/
|
|
85
|
+
members: Member[];
|
|
86
|
+
/**
|
|
87
|
+
* The caller's own labels (16 at most, snake_case keys).
|
|
88
|
+
*/
|
|
89
|
+
metadata: {
|
|
90
|
+
[key: string]: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Its title.
|
|
94
|
+
*/
|
|
95
|
+
title: string;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Chats, the newest first (100 at most).
|
|
99
|
+
*/
|
|
100
|
+
export type ChatList = {
|
|
101
|
+
/**
|
|
102
|
+
* The chats.
|
|
103
|
+
*/
|
|
104
|
+
chats: Chat[];
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* A member's (or the server's) message.
|
|
108
|
+
*/
|
|
109
|
+
export type ChatMessage = {
|
|
110
|
+
/**
|
|
111
|
+
* The member who wrote it; null: the server.
|
|
112
|
+
*/
|
|
113
|
+
author: string | null;
|
|
114
|
+
/**
|
|
115
|
+
* Their name.
|
|
116
|
+
*/
|
|
117
|
+
author_name: string;
|
|
118
|
+
/**
|
|
119
|
+
* The chat.
|
|
120
|
+
*/
|
|
121
|
+
chat_id: string;
|
|
122
|
+
/**
|
|
123
|
+
* The writer's id for it.
|
|
124
|
+
*/
|
|
125
|
+
client_id: string;
|
|
126
|
+
/**
|
|
127
|
+
* When it was written.
|
|
128
|
+
*/
|
|
129
|
+
created_at: string;
|
|
130
|
+
/**
|
|
131
|
+
* next or now.
|
|
132
|
+
*/
|
|
133
|
+
delivery: string;
|
|
134
|
+
/**
|
|
135
|
+
* Why it failed.
|
|
136
|
+
*/
|
|
137
|
+
error: string | null;
|
|
138
|
+
/**
|
|
139
|
+
* Its id.
|
|
140
|
+
*/
|
|
141
|
+
id: string;
|
|
142
|
+
/**
|
|
143
|
+
* The turn it started or reached.
|
|
144
|
+
*/
|
|
145
|
+
response_id: string | null;
|
|
146
|
+
/**
|
|
147
|
+
* pending until the agent has it, delivered once it does, failed when it could not be given to it.
|
|
148
|
+
*/
|
|
149
|
+
status: string;
|
|
150
|
+
/**
|
|
151
|
+
* What they wrote.
|
|
152
|
+
*/
|
|
153
|
+
text: string;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* A chat to start.
|
|
157
|
+
*/
|
|
158
|
+
export type ChatRequest = {
|
|
159
|
+
/**
|
|
160
|
+
* The agent it talks to: a named agent of the project's — or, from the server with a definition of the chat's own, its name for it.
|
|
161
|
+
*/
|
|
162
|
+
agent: string;
|
|
163
|
+
definition?: AgentDefinition;
|
|
164
|
+
/**
|
|
165
|
+
* Who is in it (the server's to say; 64 at most).
|
|
166
|
+
*/
|
|
167
|
+
members?: NewMember[];
|
|
168
|
+
/**
|
|
169
|
+
* The caller's own labels (16 at most, snake_case keys).
|
|
170
|
+
*/
|
|
171
|
+
metadata?: {
|
|
172
|
+
[key: string]: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* A user who starts a chat is in it as its owner, under this name.
|
|
176
|
+
*/
|
|
177
|
+
name?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Its title (256 bytes at most).
|
|
180
|
+
*/
|
|
181
|
+
title?: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* A decision made.
|
|
185
|
+
*/
|
|
186
|
+
export type Decision = {
|
|
187
|
+
/**
|
|
188
|
+
* The approval.
|
|
189
|
+
*/
|
|
190
|
+
approval_id: string;
|
|
191
|
+
/**
|
|
192
|
+
* Yes, or no.
|
|
193
|
+
*/
|
|
194
|
+
approved: boolean;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* A decision on a tool call that waits for a person.
|
|
198
|
+
*/
|
|
199
|
+
export type DecisionRequest = {
|
|
200
|
+
/**
|
|
201
|
+
* Yes, or no.
|
|
202
|
+
*/
|
|
203
|
+
approve: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Why (told to the agent; 1024 bytes at most).
|
|
206
|
+
*/
|
|
207
|
+
reason?: string;
|
|
208
|
+
};
|
|
2
209
|
/**
|
|
3
210
|
* An embedding model.
|
|
4
211
|
*/
|
|
@@ -62,6 +269,81 @@ export type EmbeddingsRequest = {
|
|
|
62
269
|
*/
|
|
63
270
|
model?: string;
|
|
64
271
|
};
|
|
272
|
+
/**
|
|
273
|
+
* A tool at an HTTPS address of the project's (any backend's, not only this platform's), or an MCP server.
|
|
274
|
+
*/
|
|
275
|
+
export type Endpoint = {
|
|
276
|
+
/**
|
|
277
|
+
* Every call waits for a person's yes.
|
|
278
|
+
*/
|
|
279
|
+
approval: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* What an https tool does.
|
|
282
|
+
*/
|
|
283
|
+
description: string;
|
|
284
|
+
/**
|
|
285
|
+
* https or mcp.
|
|
286
|
+
*/
|
|
287
|
+
kind: "https" | "mcp";
|
|
288
|
+
/**
|
|
289
|
+
* Its name.
|
|
290
|
+
*/
|
|
291
|
+
name: string;
|
|
292
|
+
/**
|
|
293
|
+
* A JSON Schema of type object: what the tool takes.
|
|
294
|
+
*/
|
|
295
|
+
parameters?: {
|
|
296
|
+
[key: string]: unknown;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* The secret an https tool's calls are signed with (the Palbase-Signature header: t=<unix>,v1=<hex HMAC-SHA256 of "t.body">), said once: when the endpoint is put. Putting it again gives a new one.
|
|
300
|
+
*/
|
|
301
|
+
signing_secret?: string;
|
|
302
|
+
/**
|
|
303
|
+
* When it was last put.
|
|
304
|
+
*/
|
|
305
|
+
updated_at: string;
|
|
306
|
+
/**
|
|
307
|
+
* Its address.
|
|
308
|
+
*/
|
|
309
|
+
url: string;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* The project's endpoints.
|
|
313
|
+
*/
|
|
314
|
+
export type EndpointList = {
|
|
315
|
+
/**
|
|
316
|
+
* By name.
|
|
317
|
+
*/
|
|
318
|
+
endpoints: Endpoint[];
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* An endpoint to put.
|
|
322
|
+
*/
|
|
323
|
+
export type EndpointRequest = {
|
|
324
|
+
/**
|
|
325
|
+
* Every call waits for a person's yes.
|
|
326
|
+
*/
|
|
327
|
+
approval?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* What an https tool does (an MCP server says its own).
|
|
330
|
+
*/
|
|
331
|
+
description?: string;
|
|
332
|
+
/**
|
|
333
|
+
* https (a tool at that address) or mcp (an MCP server: streamable HTTP).
|
|
334
|
+
*/
|
|
335
|
+
kind: "https" | "mcp";
|
|
336
|
+
/**
|
|
337
|
+
* A JSON Schema of type object: what the tool takes.
|
|
338
|
+
*/
|
|
339
|
+
parameters?: {
|
|
340
|
+
[key: string]: unknown;
|
|
341
|
+
};
|
|
342
|
+
/**
|
|
343
|
+
* An https:// address on the public internet.
|
|
344
|
+
*/
|
|
345
|
+
url: string;
|
|
346
|
+
};
|
|
65
347
|
export type ErrorResponse = {
|
|
66
348
|
/**
|
|
67
349
|
* Machine-readable error code (snake_case)
|
|
@@ -246,6 +528,53 @@ export type ImageUsage = ({
|
|
|
246
528
|
*/
|
|
247
529
|
output_tokens: number;
|
|
248
530
|
}) | null;
|
|
531
|
+
/**
|
|
532
|
+
* 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.
|
|
533
|
+
*/
|
|
534
|
+
export type InputImage = {
|
|
535
|
+
/**
|
|
536
|
+
* The project's storage bucket the picture is in (with path).
|
|
537
|
+
*/
|
|
538
|
+
bucket?: string;
|
|
539
|
+
/**
|
|
540
|
+
* The picture's path in the bucket.
|
|
541
|
+
*/
|
|
542
|
+
path?: string;
|
|
543
|
+
/**
|
|
544
|
+
* An https address the model reads the picture from (2048 characters at most), instead of bucket and path.
|
|
545
|
+
*/
|
|
546
|
+
url?: string;
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* A user in a chat.
|
|
550
|
+
*/
|
|
551
|
+
export type Member = {
|
|
552
|
+
/**
|
|
553
|
+
* How the agent and the others are told who wrote.
|
|
554
|
+
*/
|
|
555
|
+
name: string;
|
|
556
|
+
/**
|
|
557
|
+
* The owner deletes the chat.
|
|
558
|
+
*/
|
|
559
|
+
owner: boolean;
|
|
560
|
+
/**
|
|
561
|
+
* The user's id.
|
|
562
|
+
*/
|
|
563
|
+
user_id: string;
|
|
564
|
+
};
|
|
565
|
+
/**
|
|
566
|
+
* A user to put in a chat.
|
|
567
|
+
*/
|
|
568
|
+
export type MemberRequest = {
|
|
569
|
+
/**
|
|
570
|
+
* Their name in it.
|
|
571
|
+
*/
|
|
572
|
+
name?: string;
|
|
573
|
+
/**
|
|
574
|
+
* Whether they own it.
|
|
575
|
+
*/
|
|
576
|
+
owner?: boolean;
|
|
577
|
+
};
|
|
249
578
|
/**
|
|
250
579
|
* One turn of the conversation so far.
|
|
251
580
|
*/
|
|
@@ -259,6 +588,40 @@ export type Message = {
|
|
|
259
588
|
*/
|
|
260
589
|
role: "user" | "assistant";
|
|
261
590
|
};
|
|
591
|
+
/**
|
|
592
|
+
* A page of a chat's messages, the newest first.
|
|
593
|
+
*/
|
|
594
|
+
export type MessagePage = {
|
|
595
|
+
/**
|
|
596
|
+
* The messages.
|
|
597
|
+
*/
|
|
598
|
+
messages: ChatMessage[];
|
|
599
|
+
/**
|
|
600
|
+
* Pages on (cursor=); absent on the last page.
|
|
601
|
+
*/
|
|
602
|
+
next_cursor?: string;
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* A message for a chat.
|
|
606
|
+
*/
|
|
607
|
+
export type MessageRequest = {
|
|
608
|
+
/**
|
|
609
|
+
* The member the server writes as (the server's alone).
|
|
610
|
+
*/
|
|
611
|
+
as?: string;
|
|
612
|
+
/**
|
|
613
|
+
* The writer's own id for it: sent again — a retry, a second tab — it is the same message, delivered once.
|
|
614
|
+
*/
|
|
615
|
+
client_id: string;
|
|
616
|
+
/**
|
|
617
|
+
* 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.
|
|
618
|
+
*/
|
|
619
|
+
delivery?: "next" | "now";
|
|
620
|
+
/**
|
|
621
|
+
* The message (64 KiB at most).
|
|
622
|
+
*/
|
|
623
|
+
text: string;
|
|
624
|
+
};
|
|
262
625
|
/**
|
|
263
626
|
* What a project may name.
|
|
264
627
|
*/
|
|
@@ -276,6 +639,23 @@ export type Models = {
|
|
|
276
639
|
*/
|
|
277
640
|
text: TextModel[];
|
|
278
641
|
};
|
|
642
|
+
/**
|
|
643
|
+
* A user to put in a chat as it starts.
|
|
644
|
+
*/
|
|
645
|
+
export type NewMember = {
|
|
646
|
+
/**
|
|
647
|
+
* How the agent and the others are told who wrote.
|
|
648
|
+
*/
|
|
649
|
+
name?: string;
|
|
650
|
+
/**
|
|
651
|
+
* Whether they own it.
|
|
652
|
+
*/
|
|
653
|
+
owner?: boolean;
|
|
654
|
+
/**
|
|
655
|
+
* The user's id.
|
|
656
|
+
*/
|
|
657
|
+
user_id: string;
|
|
658
|
+
};
|
|
279
659
|
/**
|
|
280
660
|
* A provider the project connected with its own key.
|
|
281
661
|
*/
|
|
@@ -392,6 +772,10 @@ export type ResponseRequest = {
|
|
|
392
772
|
* Answer at once; the response's end is the event ai.response.completed or ai.response.failed.
|
|
393
773
|
*/
|
|
394
774
|
background?: boolean;
|
|
775
|
+
/**
|
|
776
|
+
* Pictures the question is about, shown to the model with it (4 at most).
|
|
777
|
+
*/
|
|
778
|
+
images?: InputImage[];
|
|
395
779
|
/**
|
|
396
780
|
* The question (2 MB at most). Give this, or messages.
|
|
397
781
|
*/
|
|
@@ -400,6 +784,10 @@ export type ResponseRequest = {
|
|
|
400
784
|
* How the model should answer (256 KB at most).
|
|
401
785
|
*/
|
|
402
786
|
instructions?: string;
|
|
787
|
+
/**
|
|
788
|
+
* How many tool calls the answer makes at most: past it the model is told it has no tools left and answers.
|
|
789
|
+
*/
|
|
790
|
+
max_tool_calls?: number;
|
|
403
791
|
/**
|
|
404
792
|
* The conversation so far instead of one question (500 turns at most); its last turn is the user's.
|
|
405
793
|
*/
|
|
@@ -428,6 +816,10 @@ export type ResponseRequest = {
|
|
|
428
816
|
* Answer with the response's live view (text/event-stream).
|
|
429
817
|
*/
|
|
430
818
|
stream?: boolean;
|
|
819
|
+
/**
|
|
820
|
+
* What the model may call to answer: the project's backend's functions, its HTTPS tools and MCP servers (an app's own tools are a chat's).
|
|
821
|
+
*/
|
|
822
|
+
tools?: ToolRef[];
|
|
431
823
|
};
|
|
432
824
|
/**
|
|
433
825
|
* What a response used.
|
|
@@ -442,6 +834,108 @@ export type ResponseUsage = {
|
|
|
442
834
|
*/
|
|
443
835
|
output_tokens: number;
|
|
444
836
|
};
|
|
837
|
+
/**
|
|
838
|
+
* A message a subagent was given.
|
|
839
|
+
*/
|
|
840
|
+
export type RunMessageAccepted = {
|
|
841
|
+
/**
|
|
842
|
+
* The writer's id for it.
|
|
843
|
+
*/
|
|
844
|
+
client_id: string;
|
|
845
|
+
/**
|
|
846
|
+
* The subagent's run.
|
|
847
|
+
*/
|
|
848
|
+
run_id: string;
|
|
849
|
+
};
|
|
850
|
+
/**
|
|
851
|
+
* A message for a subagent at work.
|
|
852
|
+
*/
|
|
853
|
+
export type RunMessageRequest = {
|
|
854
|
+
/**
|
|
855
|
+
* The writer's id for it.
|
|
856
|
+
*/
|
|
857
|
+
client_id: string;
|
|
858
|
+
/**
|
|
859
|
+
* The message.
|
|
860
|
+
*/
|
|
861
|
+
text: string;
|
|
862
|
+
};
|
|
863
|
+
/**
|
|
864
|
+
* What the project allows its chats.
|
|
865
|
+
*/
|
|
866
|
+
export type Settings = {
|
|
867
|
+
/**
|
|
868
|
+
* Whether the app's users talk to the project's agents with their own session: start a chat with a named agent, write to the chats they are in.
|
|
869
|
+
*/
|
|
870
|
+
clients: boolean;
|
|
871
|
+
/**
|
|
872
|
+
* How much it keeps now.
|
|
873
|
+
*/
|
|
874
|
+
history_bytes: number;
|
|
875
|
+
/**
|
|
876
|
+
* How much chat history the project keeps; a message past it is refused (history_full) until chats are deleted.
|
|
877
|
+
*/
|
|
878
|
+
history_limit_bytes: number;
|
|
879
|
+
/**
|
|
880
|
+
* How many messages one user sends a minute (default 20).
|
|
881
|
+
*/
|
|
882
|
+
user_messages_per_minute: number;
|
|
883
|
+
};
|
|
884
|
+
/**
|
|
885
|
+
* A change of what the project allows its chats; a field left out is left as it is.
|
|
886
|
+
*/
|
|
887
|
+
export type SettingsRequest = {
|
|
888
|
+
/**
|
|
889
|
+
* Let the app's users talk to the project's agents themselves.
|
|
890
|
+
*/
|
|
891
|
+
clients?: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* At most the plan's (500 MiB): a project may keep less, not more.
|
|
894
|
+
*/
|
|
895
|
+
history_limit_bytes?: number;
|
|
896
|
+
/**
|
|
897
|
+
* 1 to 600.
|
|
898
|
+
*/
|
|
899
|
+
user_messages_per_minute?: number;
|
|
900
|
+
};
|
|
901
|
+
/**
|
|
902
|
+
* The turn a stop stopped.
|
|
903
|
+
*/
|
|
904
|
+
export type StopResult = {
|
|
905
|
+
/**
|
|
906
|
+
* Its response; null: none was running.
|
|
907
|
+
*/
|
|
908
|
+
stopped: string | null;
|
|
909
|
+
};
|
|
910
|
+
/**
|
|
911
|
+
* An agent the agent may hand part of a turn to.
|
|
912
|
+
*/
|
|
913
|
+
export type Subagent = {
|
|
914
|
+
/**
|
|
915
|
+
* What it is for: the agent reads it to choose.
|
|
916
|
+
*/
|
|
917
|
+
description: string;
|
|
918
|
+
/**
|
|
919
|
+
* Its instructions.
|
|
920
|
+
*/
|
|
921
|
+
instructions?: string;
|
|
922
|
+
/**
|
|
923
|
+
* Its model: a role (fast, default, strong) or a catalogue model.
|
|
924
|
+
*/
|
|
925
|
+
model?: string;
|
|
926
|
+
/**
|
|
927
|
+
* Its name, unique among the subagents.
|
|
928
|
+
*/
|
|
929
|
+
name: string;
|
|
930
|
+
/**
|
|
931
|
+
* The turn fails if this subagent's part fails.
|
|
932
|
+
*/
|
|
933
|
+
required?: boolean;
|
|
934
|
+
/**
|
|
935
|
+
* Its tools.
|
|
936
|
+
*/
|
|
937
|
+
tools?: ToolRef[];
|
|
938
|
+
};
|
|
445
939
|
/**
|
|
446
940
|
* A role a text model is chosen by.
|
|
447
941
|
*/
|
|
@@ -455,6 +949,84 @@ export type TextModel = {
|
|
|
455
949
|
*/
|
|
456
950
|
role: string;
|
|
457
951
|
};
|
|
952
|
+
/**
|
|
953
|
+
* A part of what a tool returned.
|
|
954
|
+
*/
|
|
955
|
+
export type ToolContent = {
|
|
956
|
+
/**
|
|
957
|
+
* An image as base64 (5 MiB at most).
|
|
958
|
+
*/
|
|
959
|
+
data?: string;
|
|
960
|
+
/**
|
|
961
|
+
* An image's type: image/png, image/jpeg, image/webp or image/gif.
|
|
962
|
+
*/
|
|
963
|
+
media_type?: string;
|
|
964
|
+
/**
|
|
965
|
+
* The text.
|
|
966
|
+
*/
|
|
967
|
+
text?: string;
|
|
968
|
+
/**
|
|
969
|
+
* text or image.
|
|
970
|
+
*/
|
|
971
|
+
type: "text" | "image";
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* What an app's tool returned (1 MiB of text and 4 images at most).
|
|
975
|
+
*/
|
|
976
|
+
export type ToolOutput = {
|
|
977
|
+
/**
|
|
978
|
+
* The tool failed; the output says why.
|
|
979
|
+
*/
|
|
980
|
+
is_error?: boolean;
|
|
981
|
+
/**
|
|
982
|
+
* Text and images: the agent is shown both.
|
|
983
|
+
*/
|
|
984
|
+
output: ToolContent[];
|
|
985
|
+
};
|
|
986
|
+
/**
|
|
987
|
+
* An app's answer the turn was given.
|
|
988
|
+
*/
|
|
989
|
+
export type ToolOutputAccepted = {
|
|
990
|
+
/**
|
|
991
|
+
* The tool call.
|
|
992
|
+
*/
|
|
993
|
+
call_id: string;
|
|
994
|
+
};
|
|
995
|
+
/**
|
|
996
|
+
* 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).
|
|
997
|
+
*/
|
|
998
|
+
export type ToolRef = {
|
|
999
|
+
/**
|
|
1000
|
+
* A call waits for a person's yes (a member of the chat, or the server); one denied is told to the agent with the reason.
|
|
1001
|
+
*/
|
|
1002
|
+
approval?: boolean;
|
|
1003
|
+
/**
|
|
1004
|
+
* What it does: the agent reads it to choose (backend and client tools; an endpoint says its own).
|
|
1005
|
+
*/
|
|
1006
|
+
description?: string;
|
|
1007
|
+
/**
|
|
1008
|
+
* The machine a backend tool runs on (default backend).
|
|
1009
|
+
*/
|
|
1010
|
+
machine?: string;
|
|
1011
|
+
/**
|
|
1012
|
+
* The tool (backend, client), or the endpoint's name (https, mcp).
|
|
1013
|
+
*/
|
|
1014
|
+
name: string;
|
|
1015
|
+
/**
|
|
1016
|
+
* The MCP server's tools to offer (none: all).
|
|
1017
|
+
*/
|
|
1018
|
+
only?: string[];
|
|
1019
|
+
/**
|
|
1020
|
+
* A JSON Schema of type object: what the tool takes.
|
|
1021
|
+
*/
|
|
1022
|
+
parameters?: {
|
|
1023
|
+
[key: string]: unknown;
|
|
1024
|
+
};
|
|
1025
|
+
/**
|
|
1026
|
+
* backend, https, mcp or client.
|
|
1027
|
+
*/
|
|
1028
|
+
source: "backend" | "https" | "mcp" | "client";
|
|
1029
|
+
};
|
|
458
1030
|
/**
|
|
459
1031
|
* A page of uses.
|
|
460
1032
|
*/
|
|
@@ -530,6 +1102,197 @@ export interface Events {
|
|
|
530
1102
|
}
|
|
531
1103
|
/** Palbase ai */
|
|
532
1104
|
export declare function client(t: Transport): {
|
|
1105
|
+
/**
|
|
1106
|
+
* The project's named agents
|
|
1107
|
+
*
|
|
1108
|
+
* Every agent the project named, by name.
|
|
1109
|
+
*/
|
|
1110
|
+
listAgents(input?: {
|
|
1111
|
+
signal?: AbortSignal;
|
|
1112
|
+
}): Promise<Reply<200, AgentList>>;
|
|
1113
|
+
/**
|
|
1114
|
+
* Name an agent
|
|
1115
|
+
*
|
|
1116
|
+
* An agent a chat started from the app — or by name from the server — talks to: its definition, or the backend machine that defines it at each turn.
|
|
1117
|
+
*/
|
|
1118
|
+
putAgent(input: {
|
|
1119
|
+
path: {
|
|
1120
|
+
name: string;
|
|
1121
|
+
};
|
|
1122
|
+
body: AgentDefinition; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1123
|
+
signal?: AbortSignal;
|
|
1124
|
+
}): Promise<Reply<200, Agent>>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Forget an agent
|
|
1127
|
+
*
|
|
1128
|
+
* Its chats stay; a message to one of them is refused (agent_not_found) until an agent of that name is put again.
|
|
1129
|
+
*/
|
|
1130
|
+
deleteAgent(input: {
|
|
1131
|
+
path: {
|
|
1132
|
+
name: string;
|
|
1133
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1134
|
+
signal?: AbortSignal;
|
|
1135
|
+
}): Promise<Reply<204, undefined>>;
|
|
1136
|
+
/**
|
|
1137
|
+
* The chats
|
|
1138
|
+
*
|
|
1139
|
+
* The server's: every chat, or a member's (member=); a user's: the chats they are in. The newest first, 100 at most.
|
|
1140
|
+
*/
|
|
1141
|
+
listChats(input?: {
|
|
1142
|
+
query?: {
|
|
1143
|
+
member?: string;
|
|
1144
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1145
|
+
signal?: AbortSignal;
|
|
1146
|
+
}): Promise<Reply<200, ChatList>>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Start a chat
|
|
1149
|
+
*
|
|
1150
|
+
* The server starts a chat with a named agent or a definition of its own, and names its members; a signed-in user (when the project lets them) starts one with a named agent, as its owner.
|
|
1151
|
+
*/
|
|
1152
|
+
createChat(input: {
|
|
1153
|
+
body: ChatRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1154
|
+
signal?: AbortSignal;
|
|
1155
|
+
}): Promise<Reply<201, Chat>>;
|
|
1156
|
+
/**
|
|
1157
|
+
* A chat
|
|
1158
|
+
*
|
|
1159
|
+
* A chat, with its members. A user reads only a chat they are in; any other is not found.
|
|
1160
|
+
*/
|
|
1161
|
+
getChat(input: {
|
|
1162
|
+
path: {
|
|
1163
|
+
chat_id: string;
|
|
1164
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1165
|
+
signal?: AbortSignal;
|
|
1166
|
+
}): Promise<Reply<200, Chat>>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Delete a chat
|
|
1169
|
+
*
|
|
1170
|
+
* Its owner or the server deletes it: a turn still running is stopped, and its history no longer counts.
|
|
1171
|
+
*/
|
|
1172
|
+
deleteChat(input: {
|
|
1173
|
+
path: {
|
|
1174
|
+
chat_id: string;
|
|
1175
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1176
|
+
signal?: AbortSignal;
|
|
1177
|
+
}): Promise<Reply<204, undefined>>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Decide a tool call
|
|
1180
|
+
*
|
|
1181
|
+
* A tool call that waits for a person's yes: approved it is made; denied, the agent is told, with the reason, and goes on.
|
|
1182
|
+
*/
|
|
1183
|
+
decideChatApproval(input: {
|
|
1184
|
+
path: {
|
|
1185
|
+
chat_id: string; /** The approval (a tool event's approval_id). */
|
|
1186
|
+
approval_id: string;
|
|
1187
|
+
};
|
|
1188
|
+
body: DecisionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1189
|
+
signal?: AbortSignal;
|
|
1190
|
+
}): Promise<Reply<200, Decision>>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Put a user in a chat
|
|
1193
|
+
*
|
|
1194
|
+
* Who is in a chat is the server's to say.
|
|
1195
|
+
*/
|
|
1196
|
+
putChatMember(input: {
|
|
1197
|
+
path: {
|
|
1198
|
+
chat_id: string; /** The user's id. */
|
|
1199
|
+
user_id: string;
|
|
1200
|
+
};
|
|
1201
|
+
body: MemberRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1202
|
+
signal?: AbortSignal;
|
|
1203
|
+
}): Promise<Reply<200, Chat>>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Take a user out of a chat
|
|
1206
|
+
*
|
|
1207
|
+
* The server takes anyone out; a user takes themselves out.
|
|
1208
|
+
*/
|
|
1209
|
+
deleteChatMember(input: {
|
|
1210
|
+
path: {
|
|
1211
|
+
chat_id: string; /** The user's id. */
|
|
1212
|
+
user_id: string;
|
|
1213
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1214
|
+
signal?: AbortSignal;
|
|
1215
|
+
}): Promise<Reply<204, undefined>>;
|
|
1216
|
+
/**
|
|
1217
|
+
* A chat's messages
|
|
1218
|
+
*
|
|
1219
|
+
* What its members (and the server) wrote, the newest first.
|
|
1220
|
+
*/
|
|
1221
|
+
listChatMessages(input: {
|
|
1222
|
+
path: {
|
|
1223
|
+
chat_id: string;
|
|
1224
|
+
};
|
|
1225
|
+
query?: {
|
|
1226
|
+
limit?: number; /** next_cursor of the page before. */
|
|
1227
|
+
cursor?: string;
|
|
1228
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1229
|
+
signal?: AbortSignal;
|
|
1230
|
+
}): Promise<Reply<200, MessagePage>>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Write to a chat
|
|
1233
|
+
*
|
|
1234
|
+
* 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 (429 too_many_messages); past the history the project keeps a message is refused (409 history_full).
|
|
1235
|
+
*/
|
|
1236
|
+
sendChatMessage(input: {
|
|
1237
|
+
path: {
|
|
1238
|
+
chat_id: string;
|
|
1239
|
+
};
|
|
1240
|
+
body: MessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1241
|
+
signal?: AbortSignal;
|
|
1242
|
+
}): Promise<Reply<200, ChatMessage> | Reply<202, ChatMessage>>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Write to a subagent at work
|
|
1245
|
+
*
|
|
1246
|
+
* A message for one of the agent's subagents, at its next step.
|
|
1247
|
+
*/
|
|
1248
|
+
sendSubagentMessage(input: {
|
|
1249
|
+
path: {
|
|
1250
|
+
chat_id: string; /** The subagent's run (an agent event's run_id). */
|
|
1251
|
+
run_id: string;
|
|
1252
|
+
};
|
|
1253
|
+
body: RunMessageRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1254
|
+
signal?: AbortSignal;
|
|
1255
|
+
}): Promise<Reply<202, RunMessageAccepted>>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Stop the agent
|
|
1258
|
+
*
|
|
1259
|
+
* Stops the turn it is working on: what it wrote stays; a message after starts the next turn.
|
|
1260
|
+
*/
|
|
1261
|
+
stopChat(input: {
|
|
1262
|
+
path: {
|
|
1263
|
+
chat_id: string;
|
|
1264
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1265
|
+
signal?: AbortSignal;
|
|
1266
|
+
}): Promise<Reply<200, StopResult>>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Follow a chat
|
|
1269
|
+
*
|
|
1270
|
+
* What happens in the chat as typed parts, as it happens.
|
|
1271
|
+
*/
|
|
1272
|
+
followChat(input: {
|
|
1273
|
+
path: {
|
|
1274
|
+
chat_id: string;
|
|
1275
|
+
};
|
|
1276
|
+
query?: {
|
|
1277
|
+
after?: number; /** The response whose answer the reader was reading. */
|
|
1278
|
+
response?: string; /** The bytes of that answer the reader holds. */
|
|
1279
|
+
offset?: number;
|
|
1280
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1281
|
+
signal?: AbortSignal;
|
|
1282
|
+
}): Promise<Reply<200, Response>>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Answer an app's tool call
|
|
1285
|
+
*
|
|
1286
|
+
* 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.
|
|
1287
|
+
*/
|
|
1288
|
+
answerChatToolCall(input: {
|
|
1289
|
+
path: {
|
|
1290
|
+
chat_id: string; /** The tool call (a tool event's call_id). */
|
|
1291
|
+
call_id: string;
|
|
1292
|
+
};
|
|
1293
|
+
body: ToolOutput; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1294
|
+
signal?: AbortSignal;
|
|
1295
|
+
}): Promise<Reply<200, ToolOutputAccepted>>;
|
|
533
1296
|
/**
|
|
534
1297
|
* Turn texts into vectors
|
|
535
1298
|
*
|
|
@@ -539,6 +1302,37 @@ export declare function client(t: Transport): {
|
|
|
539
1302
|
body: EmbeddingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
540
1303
|
signal?: AbortSignal;
|
|
541
1304
|
}): Promise<Reply<200, Embeddings>>;
|
|
1305
|
+
/**
|
|
1306
|
+
* The project's tool endpoints
|
|
1307
|
+
*
|
|
1308
|
+
* Its HTTPS tools and MCP servers, by name (their secrets are not said again).
|
|
1309
|
+
*/
|
|
1310
|
+
listEndpoints(input?: {
|
|
1311
|
+
signal?: AbortSignal;
|
|
1312
|
+
}): Promise<Reply<200, EndpointList>>;
|
|
1313
|
+
/**
|
|
1314
|
+
* Put a tool endpoint
|
|
1315
|
+
*
|
|
1316
|
+
* 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.
|
|
1317
|
+
*/
|
|
1318
|
+
putEndpoint(input: {
|
|
1319
|
+
path: {
|
|
1320
|
+
name: string;
|
|
1321
|
+
};
|
|
1322
|
+
body: EndpointRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1323
|
+
signal?: AbortSignal;
|
|
1324
|
+
}): Promise<Reply<200, Endpoint>>;
|
|
1325
|
+
/**
|
|
1326
|
+
* Forget a tool endpoint
|
|
1327
|
+
*
|
|
1328
|
+
* An agent naming it can no longer start a turn until it is put again.
|
|
1329
|
+
*/
|
|
1330
|
+
deleteEndpoint(input: {
|
|
1331
|
+
path: {
|
|
1332
|
+
name: string;
|
|
1333
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1334
|
+
signal?: AbortSignal;
|
|
1335
|
+
}): Promise<Reply<204, undefined>>;
|
|
542
1336
|
/**
|
|
543
1337
|
* Make pictures
|
|
544
1338
|
*
|
|
@@ -661,6 +1455,23 @@ export declare function client(t: Transport): {
|
|
|
661
1455
|
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
662
1456
|
signal?: AbortSignal;
|
|
663
1457
|
}): Promise<Reply<200, Response>>;
|
|
1458
|
+
/**
|
|
1459
|
+
* What the project allows its chats
|
|
1460
|
+
*
|
|
1461
|
+
* Whether its app's users talk to its agents themselves, how many messages one sends a minute, and how much history it keeps.
|
|
1462
|
+
*/
|
|
1463
|
+
getSettings(input?: {
|
|
1464
|
+
signal?: AbortSignal;
|
|
1465
|
+
}): Promise<Reply<200, Settings>>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Change what the project allows its chats
|
|
1468
|
+
*
|
|
1469
|
+
* A field left out is left as it is. The history kept may be lowered, not raised past the plan's.
|
|
1470
|
+
*/
|
|
1471
|
+
putSettings(input: {
|
|
1472
|
+
body: SettingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1473
|
+
signal?: AbortSignal;
|
|
1474
|
+
}): Promise<Reply<200, Settings>>;
|
|
664
1475
|
/**
|
|
665
1476
|
* What the project's use of models cost
|
|
666
1477
|
*
|