@cubos/agent-sdk 0.0.1136563
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +446 -0
- package/dist/admin/agents.d.ts +191 -0
- package/dist/admin/ai-providers.d.ts +122 -0
- package/dist/admin/channels.d.ts +261 -0
- package/dist/admin/client-tools.d.ts +74 -0
- package/dist/admin/component-libraries.d.ts +63 -0
- package/dist/admin/conversations.d.ts +434 -0
- package/dist/admin/global.d.ts +137 -0
- package/dist/admin/index.d.ts +67 -0
- package/dist/admin/knowledge-bases.d.ts +142 -0
- package/dist/admin/mcps.d.ts +134 -0
- package/dist/admin/paths.d.ts +9 -0
- package/dist/admin/skills.d.ts +43 -0
- package/dist/admin/task-templates.d.ts +185 -0
- package/dist/admin/users.d.ts +208 -0
- package/dist/cache.d.ts +68 -0
- package/dist/client-tools.d.ts +96 -0
- package/dist/client.d.ts +427 -0
- package/dist/errors.d.ts +52 -0
- package/dist/generated/schema.d.ts +13564 -0
- package/dist/http.d.ts +42 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1826 -0
- package/dist/index.js.map +30 -0
- package/dist/mapping.d.ts +170 -0
- package/dist/schemas.d.ts +2 -0
- package/dist/sse.d.ts +48 -0
- package/dist/sse.js +209 -0
- package/dist/sse.js.map +11 -0
- package/dist/types.d.ts +263 -0
- package/package.json +51 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import type { Transport } from "../http.js";
|
|
2
|
+
import type { Schemas } from "../schemas.js";
|
|
3
|
+
/**
|
|
4
|
+
* The operator's view of conversations: the raw event log, sub-agent trees,
|
|
5
|
+
* workspace files and cost — everything an admin console renders.
|
|
6
|
+
*
|
|
7
|
+
* This is deliberately *not* the curated `Conversation`/`Message` surface an
|
|
8
|
+
* end-user app will get from the browser-safe client. These shapes come
|
|
9
|
+
* straight from the generated schema and move with the server.
|
|
10
|
+
*/
|
|
11
|
+
export declare function conversationsAdminApi(t: Transport, tenantSlug: string): {
|
|
12
|
+
list: (query?: {
|
|
13
|
+
before?: string;
|
|
14
|
+
limit?: number;
|
|
15
|
+
origin?: string;
|
|
16
|
+
user_id?: string;
|
|
17
|
+
}, signal?: AbortSignal) => Promise<{
|
|
18
|
+
agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
|
|
19
|
+
archived_at: string | null;
|
|
20
|
+
channel: null | import("../generated/schema.js").components["schemas"]["ChannelRef"];
|
|
21
|
+
created_at: string;
|
|
22
|
+
generated_title: string | null;
|
|
23
|
+
has_pending_turn: boolean;
|
|
24
|
+
id: string;
|
|
25
|
+
is_processing: boolean;
|
|
26
|
+
last_activity_at: string;
|
|
27
|
+
last_error_at: string | null;
|
|
28
|
+
last_error_message: string | null;
|
|
29
|
+
metadata: Record<string, unknown>;
|
|
30
|
+
next_retry_at: string | null;
|
|
31
|
+
origin: string;
|
|
32
|
+
parent_conversation: null | import("../generated/schema.js").components["schemas"]["ConversationRef"];
|
|
33
|
+
retry_count: number;
|
|
34
|
+
title: string | null;
|
|
35
|
+
total_cost_usd: number;
|
|
36
|
+
updated_at: string;
|
|
37
|
+
user: null | import("../generated/schema.js").components["schemas"]["UserRef"];
|
|
38
|
+
user_identifier: string | null;
|
|
39
|
+
user_identifier_label: string | null;
|
|
40
|
+
}[]>;
|
|
41
|
+
get: (id: string, signal?: AbortSignal) => Promise<{
|
|
42
|
+
agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
|
|
43
|
+
archived_at: string | null;
|
|
44
|
+
channel: null | import("../generated/schema.js").components["schemas"]["ChannelRef"];
|
|
45
|
+
created_at: string;
|
|
46
|
+
generated_title: string | null;
|
|
47
|
+
has_pending_turn: boolean;
|
|
48
|
+
id: string;
|
|
49
|
+
is_processing: boolean;
|
|
50
|
+
last_activity_at: string;
|
|
51
|
+
last_error_at: string | null;
|
|
52
|
+
last_error_message: string | null;
|
|
53
|
+
metadata: Record<string, unknown>;
|
|
54
|
+
next_retry_at: string | null;
|
|
55
|
+
origin: string;
|
|
56
|
+
parent_conversation: null | import("../generated/schema.js").components["schemas"]["ConversationRef"];
|
|
57
|
+
retry_count: number;
|
|
58
|
+
title: string | null;
|
|
59
|
+
total_cost_usd: number;
|
|
60
|
+
updated_at: string;
|
|
61
|
+
user: null | import("../generated/schema.js").components["schemas"]["UserRef"];
|
|
62
|
+
user_identifier: string | null;
|
|
63
|
+
user_identifier_label: string | null;
|
|
64
|
+
}>;
|
|
65
|
+
create: (input: Schemas["CreateConversationInput"]) => Promise<{
|
|
66
|
+
agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
|
|
67
|
+
archived_at: string | null;
|
|
68
|
+
channel: null | import("../generated/schema.js").components["schemas"]["ChannelRef"];
|
|
69
|
+
created_at: string;
|
|
70
|
+
generated_title: string | null;
|
|
71
|
+
has_pending_turn: boolean;
|
|
72
|
+
id: string;
|
|
73
|
+
is_processing: boolean;
|
|
74
|
+
last_activity_at: string;
|
|
75
|
+
last_error_at: string | null;
|
|
76
|
+
last_error_message: string | null;
|
|
77
|
+
metadata: Record<string, unknown>;
|
|
78
|
+
next_retry_at: string | null;
|
|
79
|
+
origin: string;
|
|
80
|
+
parent_conversation: null | import("../generated/schema.js").components["schemas"]["ConversationRef"];
|
|
81
|
+
retry_count: number;
|
|
82
|
+
title: string | null;
|
|
83
|
+
total_cost_usd: number;
|
|
84
|
+
updated_at: string;
|
|
85
|
+
user: null | import("../generated/schema.js").components["schemas"]["UserRef"];
|
|
86
|
+
user_identifier: string | null;
|
|
87
|
+
user_identifier_label: string | null;
|
|
88
|
+
}>;
|
|
89
|
+
update: (id: string, input: Schemas["UpdateConversationInput"]) => Promise<{
|
|
90
|
+
agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
|
|
91
|
+
archived_at: string | null;
|
|
92
|
+
channel: null | import("../generated/schema.js").components["schemas"]["ChannelRef"];
|
|
93
|
+
created_at: string;
|
|
94
|
+
generated_title: string | null;
|
|
95
|
+
has_pending_turn: boolean;
|
|
96
|
+
id: string;
|
|
97
|
+
is_processing: boolean;
|
|
98
|
+
last_activity_at: string;
|
|
99
|
+
last_error_at: string | null;
|
|
100
|
+
last_error_message: string | null;
|
|
101
|
+
metadata: Record<string, unknown>;
|
|
102
|
+
next_retry_at: string | null;
|
|
103
|
+
origin: string;
|
|
104
|
+
parent_conversation: null | import("../generated/schema.js").components["schemas"]["ConversationRef"];
|
|
105
|
+
retry_count: number;
|
|
106
|
+
title: string | null;
|
|
107
|
+
total_cost_usd: number;
|
|
108
|
+
updated_at: string;
|
|
109
|
+
user: null | import("../generated/schema.js").components["schemas"]["UserRef"];
|
|
110
|
+
user_identifier: string | null;
|
|
111
|
+
user_identifier_label: string | null;
|
|
112
|
+
}>;
|
|
113
|
+
archive: (id: string) => Promise<{
|
|
114
|
+
agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
|
|
115
|
+
archived_at: string | null;
|
|
116
|
+
channel: null | import("../generated/schema.js").components["schemas"]["ChannelRef"];
|
|
117
|
+
created_at: string;
|
|
118
|
+
generated_title: string | null;
|
|
119
|
+
has_pending_turn: boolean;
|
|
120
|
+
id: string;
|
|
121
|
+
is_processing: boolean;
|
|
122
|
+
last_activity_at: string;
|
|
123
|
+
last_error_at: string | null;
|
|
124
|
+
last_error_message: string | null;
|
|
125
|
+
metadata: Record<string, unknown>;
|
|
126
|
+
next_retry_at: string | null;
|
|
127
|
+
origin: string;
|
|
128
|
+
parent_conversation: null | import("../generated/schema.js").components["schemas"]["ConversationRef"];
|
|
129
|
+
retry_count: number;
|
|
130
|
+
title: string | null;
|
|
131
|
+
total_cost_usd: number;
|
|
132
|
+
updated_at: string;
|
|
133
|
+
user: null | import("../generated/schema.js").components["schemas"]["UserRef"];
|
|
134
|
+
user_identifier: string | null;
|
|
135
|
+
user_identifier_label: string | null;
|
|
136
|
+
}>;
|
|
137
|
+
/** Clears the backoff and re-dispatches a conversation stuck after failures. */
|
|
138
|
+
retryNow: (id: string) => Promise<{
|
|
139
|
+
agent: null | import("../generated/schema.js").components["schemas"]["AgentRef"];
|
|
140
|
+
archived_at: string | null;
|
|
141
|
+
channel: null | import("../generated/schema.js").components["schemas"]["ChannelRef"];
|
|
142
|
+
created_at: string;
|
|
143
|
+
generated_title: string | null;
|
|
144
|
+
has_pending_turn: boolean;
|
|
145
|
+
id: string;
|
|
146
|
+
is_processing: boolean;
|
|
147
|
+
last_activity_at: string;
|
|
148
|
+
last_error_at: string | null;
|
|
149
|
+
last_error_message: string | null;
|
|
150
|
+
metadata: Record<string, unknown>;
|
|
151
|
+
next_retry_at: string | null;
|
|
152
|
+
origin: string;
|
|
153
|
+
parent_conversation: null | import("../generated/schema.js").components["schemas"]["ConversationRef"];
|
|
154
|
+
retry_count: number;
|
|
155
|
+
title: string | null;
|
|
156
|
+
total_cost_usd: number;
|
|
157
|
+
updated_at: string;
|
|
158
|
+
user: null | import("../generated/schema.js").components["schemas"]["UserRef"];
|
|
159
|
+
user_identifier: string | null;
|
|
160
|
+
user_identifier_label: string | null;
|
|
161
|
+
}>;
|
|
162
|
+
listEvents: (id: string, query?: {
|
|
163
|
+
before?: number;
|
|
164
|
+
limit?: number;
|
|
165
|
+
}, signal?: AbortSignal) => Promise<{
|
|
166
|
+
attachments: import("../generated/schema.js").components["schemas"]["ConversationEventAttachment"][];
|
|
167
|
+
blocks: import("../generated/schema.js").components["schemas"]["Block"][] | null;
|
|
168
|
+
change_seq: number;
|
|
169
|
+
compaction_summary_id: string | null;
|
|
170
|
+
content: string | null;
|
|
171
|
+
conversation_id: string;
|
|
172
|
+
cost_usd: number;
|
|
173
|
+
created_at: string;
|
|
174
|
+
delivered_at: string | null;
|
|
175
|
+
discarded_at: string | null;
|
|
176
|
+
duration_ms: number | null;
|
|
177
|
+
error: string | null;
|
|
178
|
+
id: string;
|
|
179
|
+
injected_by_conversation_id: string | null;
|
|
180
|
+
llm_call_data: null | import("../generated/schema.js").components["schemas"]["LlmCallData"];
|
|
181
|
+
model: string | null;
|
|
182
|
+
parent_tool_call_id: string | null;
|
|
183
|
+
provider: null | import("../generated/schema.js").components["schemas"]["ProviderRef"];
|
|
184
|
+
read_at: string | null;
|
|
185
|
+
result?: unknown;
|
|
186
|
+
seq: number;
|
|
187
|
+
sub_conversation_id: string | null;
|
|
188
|
+
tentative: boolean;
|
|
189
|
+
tool_call_id: string | null;
|
|
190
|
+
tool_name: string | null;
|
|
191
|
+
type: import("../generated/schema.js").components["schemas"]["EventType"];
|
|
192
|
+
}[]>;
|
|
193
|
+
/** Only for channel-less conversations: a channel-backed one receives the
|
|
194
|
+
* user's words through the channel, so injecting here would forge a message
|
|
195
|
+
* they never sent (409). */
|
|
196
|
+
sendUserMessage: (id: string, content: string) => Promise<{
|
|
197
|
+
attachments: import("../generated/schema.js").components["schemas"]["ConversationEventAttachment"][];
|
|
198
|
+
blocks: import("../generated/schema.js").components["schemas"]["Block"][] | null;
|
|
199
|
+
change_seq: number;
|
|
200
|
+
compaction_summary_id: string | null;
|
|
201
|
+
content: string | null;
|
|
202
|
+
conversation_id: string;
|
|
203
|
+
cost_usd: number;
|
|
204
|
+
created_at: string;
|
|
205
|
+
delivered_at: string | null;
|
|
206
|
+
discarded_at: string | null;
|
|
207
|
+
duration_ms: number | null;
|
|
208
|
+
error: string | null;
|
|
209
|
+
id: string;
|
|
210
|
+
injected_by_conversation_id: string | null;
|
|
211
|
+
llm_call_data: null | import("../generated/schema.js").components["schemas"]["LlmCallData"];
|
|
212
|
+
model: string | null;
|
|
213
|
+
parent_tool_call_id: string | null;
|
|
214
|
+
provider: null | import("../generated/schema.js").components["schemas"]["ProviderRef"];
|
|
215
|
+
read_at: string | null;
|
|
216
|
+
result?: unknown;
|
|
217
|
+
seq: number;
|
|
218
|
+
sub_conversation_id: string | null;
|
|
219
|
+
tentative: boolean;
|
|
220
|
+
tool_call_id: string | null;
|
|
221
|
+
tool_name: string | null;
|
|
222
|
+
type: import("../generated/schema.js").components["schemas"]["EventType"];
|
|
223
|
+
}>;
|
|
224
|
+
/** Voice message. Stored content-addressed and transcribed by the agent's
|
|
225
|
+
* STT model before the turn runs; the event itself carries empty content. */
|
|
226
|
+
sendUserAudio: (id: string, audio: Blob, filename?: string) => Promise<{
|
|
227
|
+
attachments: import("../generated/schema.js").components["schemas"]["ConversationEventAttachment"][];
|
|
228
|
+
blocks: import("../generated/schema.js").components["schemas"]["Block"][] | null;
|
|
229
|
+
change_seq: number;
|
|
230
|
+
compaction_summary_id: string | null;
|
|
231
|
+
content: string | null;
|
|
232
|
+
conversation_id: string;
|
|
233
|
+
cost_usd: number;
|
|
234
|
+
created_at: string;
|
|
235
|
+
delivered_at: string | null;
|
|
236
|
+
discarded_at: string | null;
|
|
237
|
+
duration_ms: number | null;
|
|
238
|
+
error: string | null;
|
|
239
|
+
id: string;
|
|
240
|
+
injected_by_conversation_id: string | null;
|
|
241
|
+
llm_call_data: null | import("../generated/schema.js").components["schemas"]["LlmCallData"];
|
|
242
|
+
model: string | null;
|
|
243
|
+
parent_tool_call_id: string | null;
|
|
244
|
+
provider: null | import("../generated/schema.js").components["schemas"]["ProviderRef"];
|
|
245
|
+
read_at: string | null;
|
|
246
|
+
result?: unknown;
|
|
247
|
+
seq: number;
|
|
248
|
+
sub_conversation_id: string | null;
|
|
249
|
+
tentative: boolean;
|
|
250
|
+
tool_call_id: string | null;
|
|
251
|
+
tool_name: string | null;
|
|
252
|
+
type: import("../generated/schema.js").components["schemas"]["EventType"];
|
|
253
|
+
}>;
|
|
254
|
+
/** Image message (png/jpeg/webp/gif). Shown to the model natively when the
|
|
255
|
+
* agent's chat model has vision, otherwise described by the agent's
|
|
256
|
+
* fallback vision model. The optional caption becomes the event content. */
|
|
257
|
+
sendUserImage: (id: string, image: Blob, opts?: {
|
|
258
|
+
filename?: string;
|
|
259
|
+
caption?: string;
|
|
260
|
+
label?: string;
|
|
261
|
+
}) => Promise<{
|
|
262
|
+
attachments: import("../generated/schema.js").components["schemas"]["ConversationEventAttachment"][];
|
|
263
|
+
blocks: import("../generated/schema.js").components["schemas"]["Block"][] | null;
|
|
264
|
+
change_seq: number;
|
|
265
|
+
compaction_summary_id: string | null;
|
|
266
|
+
content: string | null;
|
|
267
|
+
conversation_id: string;
|
|
268
|
+
cost_usd: number;
|
|
269
|
+
created_at: string;
|
|
270
|
+
delivered_at: string | null;
|
|
271
|
+
discarded_at: string | null;
|
|
272
|
+
duration_ms: number | null;
|
|
273
|
+
error: string | null;
|
|
274
|
+
id: string;
|
|
275
|
+
injected_by_conversation_id: string | null;
|
|
276
|
+
llm_call_data: null | import("../generated/schema.js").components["schemas"]["LlmCallData"];
|
|
277
|
+
model: string | null;
|
|
278
|
+
parent_tool_call_id: string | null;
|
|
279
|
+
provider: null | import("../generated/schema.js").components["schemas"]["ProviderRef"];
|
|
280
|
+
read_at: string | null;
|
|
281
|
+
result?: unknown;
|
|
282
|
+
seq: number;
|
|
283
|
+
sub_conversation_id: string | null;
|
|
284
|
+
tentative: boolean;
|
|
285
|
+
tool_call_id: string | null;
|
|
286
|
+
tool_name: string | null;
|
|
287
|
+
type: import("../generated/schema.js").components["schemas"]["EventType"];
|
|
288
|
+
}>;
|
|
289
|
+
/** Up to 10 images in ONE `user_message`, each with an optional label the
|
|
290
|
+
* model sees next to it (so it can refer to them by name), plus one
|
|
291
|
+
* caption shared by the whole set. */
|
|
292
|
+
sendUserImages: (id: string, images: Array<{
|
|
293
|
+
image: Blob;
|
|
294
|
+
filename?: string;
|
|
295
|
+
label?: string;
|
|
296
|
+
}>, opts?: {
|
|
297
|
+
caption?: string;
|
|
298
|
+
}) => Promise<{
|
|
299
|
+
attachments: import("../generated/schema.js").components["schemas"]["ConversationEventAttachment"][];
|
|
300
|
+
blocks: import("../generated/schema.js").components["schemas"]["Block"][] | null;
|
|
301
|
+
change_seq: number;
|
|
302
|
+
compaction_summary_id: string | null;
|
|
303
|
+
content: string | null;
|
|
304
|
+
conversation_id: string;
|
|
305
|
+
cost_usd: number;
|
|
306
|
+
created_at: string;
|
|
307
|
+
delivered_at: string | null;
|
|
308
|
+
discarded_at: string | null;
|
|
309
|
+
duration_ms: number | null;
|
|
310
|
+
error: string | null;
|
|
311
|
+
id: string;
|
|
312
|
+
injected_by_conversation_id: string | null;
|
|
313
|
+
llm_call_data: null | import("../generated/schema.js").components["schemas"]["LlmCallData"];
|
|
314
|
+
model: string | null;
|
|
315
|
+
parent_tool_call_id: string | null;
|
|
316
|
+
provider: null | import("../generated/schema.js").components["schemas"]["ProviderRef"];
|
|
317
|
+
read_at: string | null;
|
|
318
|
+
result?: unknown;
|
|
319
|
+
seq: number;
|
|
320
|
+
sub_conversation_id: string | null;
|
|
321
|
+
tentative: boolean;
|
|
322
|
+
tool_call_id: string | null;
|
|
323
|
+
tool_name: string | null;
|
|
324
|
+
type: import("../generated/schema.js").components["schemas"]["EventType"];
|
|
325
|
+
}>;
|
|
326
|
+
/** Works on any conversation, channel-backed included. */
|
|
327
|
+
steer: (id: string, content: string) => Promise<{
|
|
328
|
+
attachments: import("../generated/schema.js").components["schemas"]["ConversationEventAttachment"][];
|
|
329
|
+
blocks: import("../generated/schema.js").components["schemas"]["Block"][] | null;
|
|
330
|
+
change_seq: number;
|
|
331
|
+
compaction_summary_id: string | null;
|
|
332
|
+
content: string | null;
|
|
333
|
+
conversation_id: string;
|
|
334
|
+
cost_usd: number;
|
|
335
|
+
created_at: string;
|
|
336
|
+
delivered_at: string | null;
|
|
337
|
+
discarded_at: string | null;
|
|
338
|
+
duration_ms: number | null;
|
|
339
|
+
error: string | null;
|
|
340
|
+
id: string;
|
|
341
|
+
injected_by_conversation_id: string | null;
|
|
342
|
+
llm_call_data: null | import("../generated/schema.js").components["schemas"]["LlmCallData"];
|
|
343
|
+
model: string | null;
|
|
344
|
+
parent_tool_call_id: string | null;
|
|
345
|
+
provider: null | import("../generated/schema.js").components["schemas"]["ProviderRef"];
|
|
346
|
+
read_at: string | null;
|
|
347
|
+
result?: unknown;
|
|
348
|
+
seq: number;
|
|
349
|
+
sub_conversation_id: string | null;
|
|
350
|
+
tentative: boolean;
|
|
351
|
+
tool_call_id: string | null;
|
|
352
|
+
tool_name: string | null;
|
|
353
|
+
type: import("../generated/schema.js").components["schemas"]["EventType"];
|
|
354
|
+
}>;
|
|
355
|
+
listSubConversations: (id: string, signal?: AbortSignal) => Promise<{
|
|
356
|
+
agent_display_name: string | null;
|
|
357
|
+
agent_slug: string | null;
|
|
358
|
+
archived_at: string | null;
|
|
359
|
+
created_at: string;
|
|
360
|
+
id: string;
|
|
361
|
+
last_activity_at: string;
|
|
362
|
+
}[]>;
|
|
363
|
+
getSummary: (id: string, summaryId: string, signal?: AbortSignal) => Promise<{
|
|
364
|
+
anchor_event_seq: number;
|
|
365
|
+
conversation_id: string;
|
|
366
|
+
created_at: string;
|
|
367
|
+
id: string;
|
|
368
|
+
input_tokens: number | null;
|
|
369
|
+
output_tokens: number | null;
|
|
370
|
+
summary_text: string;
|
|
371
|
+
}>;
|
|
372
|
+
listKnowledgeBases: (id: string, signal?: AbortSignal) => Promise<{
|
|
373
|
+
created_at: string;
|
|
374
|
+
display_name: string;
|
|
375
|
+
id: string;
|
|
376
|
+
pending_count: number;
|
|
377
|
+
slug: string;
|
|
378
|
+
updated_at: string;
|
|
379
|
+
}[]>;
|
|
380
|
+
attachKnowledgeBase: (id: string, kbSlug: string) => Promise<void>;
|
|
381
|
+
detachKnowledgeBase: (id: string, kbSlug: string) => Promise<void>;
|
|
382
|
+
listSkills: (id: string, signal?: AbortSignal) => Promise<{
|
|
383
|
+
enabled: boolean;
|
|
384
|
+
skill: import("../generated/schema.js").components["schemas"]["SkillRef"];
|
|
385
|
+
}[]>;
|
|
386
|
+
addSkill: (id: string, skillSlug: string) => Promise<void>;
|
|
387
|
+
removeSkill: (id: string, skillSlug: string) => Promise<void>;
|
|
388
|
+
/** One directory, never recursive. `atSeq` browses the workspace as it
|
|
389
|
+
* stood at a given event, reaching history the agent no longer sees;
|
|
390
|
+
* without it you get the live tree, which is what the agent would be shown
|
|
391
|
+
* next turn — empty once the workspace has expired. */
|
|
392
|
+
workspaceDir: (id: string, atSeq?: number, path?: string, signal?: AbortSignal) => Promise<{
|
|
393
|
+
entries: import("../generated/schema.js").components["schemas"]["WorkspaceEntryDto"][];
|
|
394
|
+
path: string;
|
|
395
|
+
root_event_id: string | null;
|
|
396
|
+
root_seq: number | null;
|
|
397
|
+
}>;
|
|
398
|
+
/** Raw `Response`: the file's bytes, with the server's own filename in
|
|
399
|
+
* `Content-Disposition`. */
|
|
400
|
+
workspaceFile: (id: string, query: {
|
|
401
|
+
path: string;
|
|
402
|
+
at_seq?: number;
|
|
403
|
+
}) => Promise<Response>;
|
|
404
|
+
/** Create or replace one file. Starts no turn — the agent is told about it
|
|
405
|
+
* as part of its next request, so send a message if you want an answer. */
|
|
406
|
+
workspaceWrite: (id: string, path: string, file: Blob, filename?: string) => Promise<{
|
|
407
|
+
paths: string[];
|
|
408
|
+
root_event_id: string | null;
|
|
409
|
+
}>;
|
|
410
|
+
/** Write several files as **one** snapshot: the agent sees the upload as a
|
|
411
|
+
* single change rather than as N, and no reader ever observes half of it.
|
|
412
|
+
* Positional `path` parts pair with the files by index. */
|
|
413
|
+
workspaceWriteMany: (id: string, files: Array<{
|
|
414
|
+
path: string;
|
|
415
|
+
file: Blob;
|
|
416
|
+
filename?: string;
|
|
417
|
+
}>) => Promise<{
|
|
418
|
+
paths: string[];
|
|
419
|
+
root_event_id: string | null;
|
|
420
|
+
}>;
|
|
421
|
+
/** Remove a file, or a directory with everything under it. History keeps
|
|
422
|
+
* resolving through `atSeq`. */
|
|
423
|
+
workspaceDelete: (id: string, path: string) => Promise<{
|
|
424
|
+
paths: string[];
|
|
425
|
+
root_event_id: string | null;
|
|
426
|
+
}>;
|
|
427
|
+
workspaceMove: (id: string, from: string, to: string) => Promise<{
|
|
428
|
+
paths: string[];
|
|
429
|
+
root_event_id: string | null;
|
|
430
|
+
}>;
|
|
431
|
+
/** Raw `Response`: the bytes of an event's media attachment (voice note or
|
|
432
|
+
* image), `Content-Type` from the stored mime. */
|
|
433
|
+
eventAttachment: (id: string, eventId: string, attachmentId?: string) => Promise<Response>;
|
|
434
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { Transport } from "../http.js";
|
|
2
|
+
import type { Schemas } from "../schemas.js";
|
|
3
|
+
export declare function tenantsApi(t: Transport): {
|
|
4
|
+
list: (signal?: AbortSignal) => Promise<{
|
|
5
|
+
created_at: string;
|
|
6
|
+
display_name: string;
|
|
7
|
+
id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
create: (input: Schemas["CreateTenantInput"]) => Promise<{
|
|
11
|
+
created_at: string;
|
|
12
|
+
display_name: string;
|
|
13
|
+
id: string;
|
|
14
|
+
slug: string;
|
|
15
|
+
}>;
|
|
16
|
+
update: (currentSlug: string, input: Schemas["UpdateTenantInput"]) => Promise<{
|
|
17
|
+
created_at: string;
|
|
18
|
+
display_name: string;
|
|
19
|
+
id: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
}>;
|
|
22
|
+
delete: (slug: string) => Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
export declare function apiKeysApi(t: Transport): {
|
|
25
|
+
list: (signal?: AbortSignal) => Promise<({
|
|
26
|
+
created_at: string;
|
|
27
|
+
display_name: string;
|
|
28
|
+
id: string;
|
|
29
|
+
key_prefix: string;
|
|
30
|
+
} & {
|
|
31
|
+
visible_grant_count: number;
|
|
32
|
+
})[]>;
|
|
33
|
+
get: (id: string, signal?: AbortSignal) => Promise<{
|
|
34
|
+
created_at: string;
|
|
35
|
+
display_name: string;
|
|
36
|
+
id: string;
|
|
37
|
+
key_prefix: string;
|
|
38
|
+
} & {
|
|
39
|
+
grants: import("../generated/schema.js").components["schemas"]["GrantOut"][];
|
|
40
|
+
}>;
|
|
41
|
+
create: (input: Schemas["CreateApiKeyInput"]) => Promise<{
|
|
42
|
+
created_at: string;
|
|
43
|
+
display_name: string;
|
|
44
|
+
id: string;
|
|
45
|
+
key_prefix: string;
|
|
46
|
+
} & {
|
|
47
|
+
plaintext: string;
|
|
48
|
+
}>;
|
|
49
|
+
update: (id: string, input: Schemas["UpdateApiKeyInput"]) => Promise<{
|
|
50
|
+
created_at: string;
|
|
51
|
+
display_name: string;
|
|
52
|
+
id: string;
|
|
53
|
+
key_prefix: string;
|
|
54
|
+
}>;
|
|
55
|
+
delete: (id: string) => Promise<void>;
|
|
56
|
+
/** Returns a new plaintext secret; the previous one stops working at once. */
|
|
57
|
+
rotate: (id: string) => Promise<{
|
|
58
|
+
created_at: string;
|
|
59
|
+
display_name: string;
|
|
60
|
+
id: string;
|
|
61
|
+
key_prefix: string;
|
|
62
|
+
} & {
|
|
63
|
+
plaintext: string;
|
|
64
|
+
}>;
|
|
65
|
+
addGrant: (id: string, input: Schemas["AddGrantInput"]) => Promise<{
|
|
66
|
+
id: string;
|
|
67
|
+
permission: string;
|
|
68
|
+
tenant_slug: string;
|
|
69
|
+
}>;
|
|
70
|
+
removeGrant: (id: string, grantId: string) => Promise<void>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Providers owned by the reserved `_root` system tenant and shared with every
|
|
74
|
+
* tenant's listing. Root-only, and a separate route family from a tenant's own
|
|
75
|
+
* providers — never reachable through a real tenant's URL.
|
|
76
|
+
*/
|
|
77
|
+
export declare function sharedProvidersApi(t: Transport): {
|
|
78
|
+
create: (input: Schemas["CreateAiProviderInput"]) => Promise<{
|
|
79
|
+
account_id: string | null;
|
|
80
|
+
base_url: string | null;
|
|
81
|
+
created_at: string;
|
|
82
|
+
has_api_key: boolean;
|
|
83
|
+
id: string;
|
|
84
|
+
last_reconcile_error: string | null;
|
|
85
|
+
last_reconciled_at: string | null;
|
|
86
|
+
model_count: number;
|
|
87
|
+
shared: boolean;
|
|
88
|
+
slug: string;
|
|
89
|
+
token_sku_directions: {
|
|
90
|
+
[key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
|
|
91
|
+
};
|
|
92
|
+
type: import("../generated/schema.js").components["schemas"]["ProviderType"];
|
|
93
|
+
}>;
|
|
94
|
+
update: (currentSlug: string, input: Schemas["UpdateAiProviderInput"]) => Promise<{
|
|
95
|
+
account_id: string | null;
|
|
96
|
+
base_url: string | null;
|
|
97
|
+
created_at: string;
|
|
98
|
+
has_api_key: boolean;
|
|
99
|
+
id: string;
|
|
100
|
+
last_reconcile_error: string | null;
|
|
101
|
+
last_reconciled_at: string | null;
|
|
102
|
+
model_count: number;
|
|
103
|
+
shared: boolean;
|
|
104
|
+
slug: string;
|
|
105
|
+
token_sku_directions: {
|
|
106
|
+
[key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
|
|
107
|
+
};
|
|
108
|
+
type: import("../generated/schema.js").components["schemas"]["ProviderType"];
|
|
109
|
+
}>;
|
|
110
|
+
delete: (slug: string) => Promise<void>;
|
|
111
|
+
refreshModels: (slug: string) => Promise<{
|
|
112
|
+
capabilities: import("../generated/schema.js").components["schemas"]["ModelCapabilities"];
|
|
113
|
+
context_window_tokens: number | null;
|
|
114
|
+
context_window_tokens_override: number | null;
|
|
115
|
+
disappeared_at: string | null;
|
|
116
|
+
display_name: string | null;
|
|
117
|
+
embedding_native_dimensions: number | null;
|
|
118
|
+
id: string;
|
|
119
|
+
last_reconciled_at: string;
|
|
120
|
+
max_input_tokens: number | null;
|
|
121
|
+
max_output_tokens: number | null;
|
|
122
|
+
model_id: string;
|
|
123
|
+
model_version: string | null;
|
|
124
|
+
pricing: {
|
|
125
|
+
[key: string]: number;
|
|
126
|
+
};
|
|
127
|
+
pricing_effective: {
|
|
128
|
+
[key: string]: number;
|
|
129
|
+
};
|
|
130
|
+
pricing_override: {
|
|
131
|
+
[key: string]: number;
|
|
132
|
+
};
|
|
133
|
+
pricing_skus: import("../generated/schema.js").components["schemas"]["SkuDisplayDto"][];
|
|
134
|
+
reasoning_options: null | import("../generated/schema.js").components["schemas"]["ReasoningOptions"];
|
|
135
|
+
}[]>;
|
|
136
|
+
updateModel: (slug: string, modelId: string, input: Schemas["UpdateProviderModelInput"]) => Promise<void>;
|
|
137
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Transport } from "../http.js";
|
|
2
|
+
import type { Schemas } from "../schemas.js";
|
|
3
|
+
import type { FetchLike } from "../sse.js";
|
|
4
|
+
import { agentsApi } from "./agents.js";
|
|
5
|
+
import { aiProvidersApi } from "./ai-providers.js";
|
|
6
|
+
import { channelsApi } from "./channels.js";
|
|
7
|
+
import { clientToolsApi } from "./client-tools.js";
|
|
8
|
+
import { componentLibrariesApi } from "./component-libraries.js";
|
|
9
|
+
import { conversationsAdminApi } from "./conversations.js";
|
|
10
|
+
import { apiKeysApi, sharedProvidersApi, tenantsApi } from "./global.js";
|
|
11
|
+
import { knowledgeBasesApi } from "./knowledge-bases.js";
|
|
12
|
+
import { mcpsApi } from "./mcps.js";
|
|
13
|
+
import { skillsApi } from "./skills.js";
|
|
14
|
+
import { backgroundTasksApi, scheduledRunsApi, taskTemplatesApi } from "./task-templates.js";
|
|
15
|
+
import { userRolesApi, usersApi, userTokensApi } from "./users.js";
|
|
16
|
+
export interface AdminClientOptions {
|
|
17
|
+
/** Where the Cubos Agent core is reachable, e.g. `https://agent.acme.com`. */
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
/** A tenant-wide api_key, or the root key. Pass a function when the key lives
|
|
20
|
+
* somewhere mutable and is read per request. Never ship one to a browser. */
|
|
21
|
+
apiKey: string | (() => string | Promise<string>);
|
|
22
|
+
fetch?: FetchLike;
|
|
23
|
+
/** Per-request ceiling in ms; `0` disables it. Defaults to 30s. */
|
|
24
|
+
timeoutMs?: number;
|
|
25
|
+
/** How many times a 429 is retried, honouring the server's `Retry-After`.
|
|
26
|
+
* Defaults to 2. */
|
|
27
|
+
maxRetries?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Everything scoped to one tenant. Held rather than passed per call, so the
|
|
30
|
+
* slug appears once instead of in all ~120 signatures. */
|
|
31
|
+
export interface TenantScope {
|
|
32
|
+
readonly slug: string;
|
|
33
|
+
agents: ReturnType<typeof agentsApi>;
|
|
34
|
+
aiProviders: ReturnType<typeof aiProvidersApi>;
|
|
35
|
+
mcps: ReturnType<typeof mcpsApi>;
|
|
36
|
+
skills: ReturnType<typeof skillsApi>;
|
|
37
|
+
componentLibraries: ReturnType<typeof componentLibrariesApi>;
|
|
38
|
+
channels: ReturnType<typeof channelsApi>;
|
|
39
|
+
users: ReturnType<typeof usersApi>;
|
|
40
|
+
userRoles: ReturnType<typeof userRolesApi>;
|
|
41
|
+
userTokens: ReturnType<typeof userTokensApi>;
|
|
42
|
+
knowledgeBases: ReturnType<typeof knowledgeBasesApi>;
|
|
43
|
+
taskTemplates: ReturnType<typeof taskTemplatesApi>;
|
|
44
|
+
scheduledRuns: ReturnType<typeof scheduledRunsApi>;
|
|
45
|
+
backgroundTasks: ReturnType<typeof backgroundTasksApi>;
|
|
46
|
+
conversations: ReturnType<typeof conversationsAdminApi>;
|
|
47
|
+
clientTools: ReturnType<typeof clientToolsApi>;
|
|
48
|
+
}
|
|
49
|
+
export interface AdminClient {
|
|
50
|
+
health(signal?: AbortSignal): Promise<Schemas["Health"]>;
|
|
51
|
+
me(signal?: AbortSignal): Promise<Schemas["WhoAmI"]>;
|
|
52
|
+
tenants: ReturnType<typeof tenantsApi>;
|
|
53
|
+
apiKeys: ReturnType<typeof apiKeysApi>;
|
|
54
|
+
sharedProviders: ReturnType<typeof sharedProvidersApi>;
|
|
55
|
+
tenant(slug: string): TenantScope;
|
|
56
|
+
/** Escape hatch for a route the SDK hasn't wrapped yet. Paths are absolute
|
|
57
|
+
* (`/api/v1/…`) and auth is applied for you. */
|
|
58
|
+
raw: Transport;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Full-surface client authenticated with an api_key: every route the key's
|
|
62
|
+
* grants allow, across every tenant it can reach.
|
|
63
|
+
*
|
|
64
|
+
* Server-side only: an api_key is tenant-wide, so it must never reach a
|
|
65
|
+
* browser.
|
|
66
|
+
*/
|
|
67
|
+
export declare function createAdminClient(options: AdminClientOptions): AdminClient;
|