@soat/sdk 0.6.5 → 0.6.10

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/index.js DELETED
@@ -1,3054 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- "use strict";
3
-
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", {
9
- value,
10
- configurable: true
11
- });
12
- var __export = (target, all) => {
13
- for (var name in all) __defProp(target, name, {
14
- get: all[name],
15
- enumerable: true
16
- });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
- get: () => from[key],
22
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
- });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
28
- value: true
29
- }), mod);
30
-
31
- // src/index.ts
32
- var index_exports = {};
33
- __export(index_exports, {
34
- Actors: () => Actors,
35
- Agents: () => Agents,
36
- AiProviders: () => AiProviders,
37
- ApiKeys: () => ApiKeys,
38
- Chats: () => Chats,
39
- Conversations: () => Conversations,
40
- Documents: () => Documents,
41
- Files: () => Files,
42
- Formations: () => Formations,
43
- Knowledge: () => Knowledge,
44
- Memories: () => Memories,
45
- MemoryEntries: () => MemoryEntries,
46
- Orchestrations: () => Orchestrations,
47
- Policies: () => Policies,
48
- Projects: () => Projects,
49
- Secrets: () => Secrets,
50
- Sessions: () => Sessions,
51
- SoatClient: () => SoatClient,
52
- Tools: () => Tools,
53
- Traces: () => Traces,
54
- Users: () => Users,
55
- Webhooks: () => Webhooks,
56
- createClient: () => createClient,
57
- createConfig: () => createConfig
58
- });
59
- module.exports = __toCommonJS(index_exports);
60
-
61
- // src/generated/core/bodySerializer.gen.ts
62
- var serializeFormDataPair = /* @__PURE__ */__name((data, key, value) => {
63
- if (typeof value === "string" || value instanceof Blob) {
64
- data.append(key, value);
65
- } else if (value instanceof Date) {
66
- data.append(key, value.toISOString());
67
- } else {
68
- data.append(key, JSON.stringify(value));
69
- }
70
- }, "serializeFormDataPair");
71
- var formDataBodySerializer = {
72
- bodySerializer: /* @__PURE__ */__name(body => {
73
- const data = new FormData();
74
- Object.entries(body).forEach(([key, value]) => {
75
- if (value === void 0 || value === null) {
76
- return;
77
- }
78
- if (Array.isArray(value)) {
79
- value.forEach(v => serializeFormDataPair(data, key, v));
80
- } else {
81
- serializeFormDataPair(data, key, value);
82
- }
83
- });
84
- return data;
85
- }, "bodySerializer")
86
- };
87
- var jsonBodySerializer = {
88
- bodySerializer: /* @__PURE__ */__name(body => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
89
- };
90
-
91
- // src/generated/core/params.gen.ts
92
- var extraPrefixesMap = {
93
- $body_: "body",
94
- $headers_: "headers",
95
- $path_: "path",
96
- $query_: "query"
97
- };
98
- var extraPrefixes = Object.entries(extraPrefixesMap);
99
-
100
- // src/generated/core/serverSentEvents.gen.ts
101
- function createSseClient({
102
- onRequest,
103
- onSseError,
104
- onSseEvent,
105
- responseTransformer,
106
- responseValidator,
107
- sseDefaultRetryDelay,
108
- sseMaxRetryAttempts,
109
- sseMaxRetryDelay,
110
- sseSleepFn,
111
- url,
112
- ...options
113
- }) {
114
- let lastEventId;
115
- const sleep = sseSleepFn ?? (ms => new Promise(resolve => setTimeout(resolve, ms)));
116
- const createStream = /* @__PURE__ */__name(async function* () {
117
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
118
- let attempt = 0;
119
- const signal = options.signal ?? new AbortController().signal;
120
- while (true) {
121
- if (signal.aborted) break;
122
- attempt++;
123
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
124
- if (lastEventId !== void 0) {
125
- headers.set("Last-Event-ID", lastEventId);
126
- }
127
- try {
128
- const requestInit = {
129
- redirect: "follow",
130
- ...options,
131
- body: options.serializedBody,
132
- headers,
133
- signal
134
- };
135
- let request = new Request(url, requestInit);
136
- if (onRequest) {
137
- request = await onRequest(url, requestInit);
138
- }
139
- const _fetch = options.fetch ?? globalThis.fetch;
140
- const response = await _fetch(request);
141
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
142
- if (!response.body) throw new Error("No body in SSE response");
143
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
144
- let buffer = "";
145
- const abortHandler = /* @__PURE__ */__name(() => {
146
- try {
147
- reader.cancel();
148
- } catch {}
149
- }, "abortHandler");
150
- signal.addEventListener("abort", abortHandler);
151
- try {
152
- while (true) {
153
- const {
154
- done,
155
- value
156
- } = await reader.read();
157
- if (done) break;
158
- buffer += value;
159
- buffer = buffer.replace(/\r\n?/g, "\n");
160
- const chunks = buffer.split("\n\n");
161
- buffer = chunks.pop() ?? "";
162
- for (const chunk of chunks) {
163
- const lines = chunk.split("\n");
164
- const dataLines = [];
165
- let eventName;
166
- for (const line of lines) {
167
- if (line.startsWith("data:")) {
168
- dataLines.push(line.replace(/^data:\s*/, ""));
169
- } else if (line.startsWith("event:")) {
170
- eventName = line.replace(/^event:\s*/, "");
171
- } else if (line.startsWith("id:")) {
172
- lastEventId = line.replace(/^id:\s*/, "");
173
- } else if (line.startsWith("retry:")) {
174
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
175
- if (!Number.isNaN(parsed)) {
176
- retryDelay = parsed;
177
- }
178
- }
179
- }
180
- let data;
181
- let parsedJson = false;
182
- if (dataLines.length) {
183
- const rawData = dataLines.join("\n");
184
- try {
185
- data = JSON.parse(rawData);
186
- parsedJson = true;
187
- } catch {
188
- data = rawData;
189
- }
190
- }
191
- if (parsedJson) {
192
- if (responseValidator) {
193
- await responseValidator(data);
194
- }
195
- if (responseTransformer) {
196
- data = await responseTransformer(data);
197
- }
198
- }
199
- onSseEvent?.({
200
- data,
201
- event: eventName,
202
- id: lastEventId,
203
- retry: retryDelay
204
- });
205
- if (dataLines.length) {
206
- yield data;
207
- }
208
- }
209
- }
210
- } finally {
211
- signal.removeEventListener("abort", abortHandler);
212
- reader.releaseLock();
213
- }
214
- break;
215
- } catch (error) {
216
- onSseError?.(error);
217
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
218
- break;
219
- }
220
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
221
- await sleep(backoff);
222
- }
223
- }
224
- }, "createStream");
225
- const stream = createStream();
226
- return {
227
- stream
228
- };
229
- }
230
- __name(createSseClient, "createSseClient");
231
-
232
- // src/generated/core/pathSerializer.gen.ts
233
- var separatorArrayExplode = /* @__PURE__ */__name(style => {
234
- switch (style) {
235
- case "label":
236
- return ".";
237
- case "matrix":
238
- return ";";
239
- case "simple":
240
- return ",";
241
- default:
242
- return "&";
243
- }
244
- }, "separatorArrayExplode");
245
- var separatorArrayNoExplode = /* @__PURE__ */__name(style => {
246
- switch (style) {
247
- case "form":
248
- return ",";
249
- case "pipeDelimited":
250
- return "|";
251
- case "spaceDelimited":
252
- return "%20";
253
- default:
254
- return ",";
255
- }
256
- }, "separatorArrayNoExplode");
257
- var separatorObjectExplode = /* @__PURE__ */__name(style => {
258
- switch (style) {
259
- case "label":
260
- return ".";
261
- case "matrix":
262
- return ";";
263
- case "simple":
264
- return ",";
265
- default:
266
- return "&";
267
- }
268
- }, "separatorObjectExplode");
269
- var serializeArrayParam = /* @__PURE__ */__name(({
270
- allowReserved,
271
- explode,
272
- name,
273
- style,
274
- value
275
- }) => {
276
- if (!explode) {
277
- const joinedValues2 = (allowReserved ? value : value.map(v => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
278
- switch (style) {
279
- case "label":
280
- return `.${joinedValues2}`;
281
- case "matrix":
282
- return `;${name}=${joinedValues2}`;
283
- case "simple":
284
- return joinedValues2;
285
- default:
286
- return `${name}=${joinedValues2}`;
287
- }
288
- }
289
- const separator = separatorArrayExplode(style);
290
- const joinedValues = value.map(v => {
291
- if (style === "label" || style === "simple") {
292
- return allowReserved ? v : encodeURIComponent(v);
293
- }
294
- return serializePrimitiveParam({
295
- allowReserved,
296
- name,
297
- value: v
298
- });
299
- }).join(separator);
300
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
301
- }, "serializeArrayParam");
302
- var serializePrimitiveParam = /* @__PURE__ */__name(({
303
- allowReserved,
304
- name,
305
- value
306
- }) => {
307
- if (value === void 0 || value === null) {
308
- return "";
309
- }
310
- if (typeof value === "object") {
311
- throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
312
- }
313
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
314
- }, "serializePrimitiveParam");
315
- var serializeObjectParam = /* @__PURE__ */__name(({
316
- allowReserved,
317
- explode,
318
- name,
319
- style,
320
- value,
321
- valueOnly
322
- }) => {
323
- if (value instanceof Date) {
324
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
325
- }
326
- if (style !== "deepObject" && !explode) {
327
- let values = [];
328
- Object.entries(value).forEach(([key, v]) => {
329
- values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
330
- });
331
- const joinedValues2 = values.join(",");
332
- switch (style) {
333
- case "form":
334
- return `${name}=${joinedValues2}`;
335
- case "label":
336
- return `.${joinedValues2}`;
337
- case "matrix":
338
- return `;${name}=${joinedValues2}`;
339
- default:
340
- return joinedValues2;
341
- }
342
- }
343
- const separator = separatorObjectExplode(style);
344
- const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
345
- allowReserved,
346
- name: style === "deepObject" ? `${name}[${key}]` : key,
347
- value: v
348
- })).join(separator);
349
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
350
- }, "serializeObjectParam");
351
-
352
- // src/generated/core/utils.gen.ts
353
- var PATH_PARAM_RE = /\{[^{}]+\}/g;
354
- var defaultPathSerializer = /* @__PURE__ */__name(({
355
- path,
356
- url: _url
357
- }) => {
358
- let url = _url;
359
- const matches = _url.match(PATH_PARAM_RE);
360
- if (matches) {
361
- for (const match of matches) {
362
- let explode = false;
363
- let name = match.substring(1, match.length - 1);
364
- let style = "simple";
365
- if (name.endsWith("*")) {
366
- explode = true;
367
- name = name.substring(0, name.length - 1);
368
- }
369
- if (name.startsWith(".")) {
370
- name = name.substring(1);
371
- style = "label";
372
- } else if (name.startsWith(";")) {
373
- name = name.substring(1);
374
- style = "matrix";
375
- }
376
- const value = path[name];
377
- if (value === void 0 || value === null) {
378
- continue;
379
- }
380
- if (Array.isArray(value)) {
381
- url = url.replace(match, serializeArrayParam({
382
- explode,
383
- name,
384
- style,
385
- value
386
- }));
387
- continue;
388
- }
389
- if (typeof value === "object") {
390
- url = url.replace(match, serializeObjectParam({
391
- explode,
392
- name,
393
- style,
394
- value,
395
- valueOnly: true
396
- }));
397
- continue;
398
- }
399
- if (style === "matrix") {
400
- url = url.replace(match, `;${serializePrimitiveParam({
401
- name,
402
- value
403
- })}`);
404
- continue;
405
- }
406
- const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
407
- url = url.replace(match, replaceValue);
408
- }
409
- }
410
- return url;
411
- }, "defaultPathSerializer");
412
- var getUrl = /* @__PURE__ */__name(({
413
- baseUrl,
414
- path,
415
- query,
416
- querySerializer,
417
- url: _url
418
- }) => {
419
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
420
- let url = (baseUrl ?? "") + pathUrl;
421
- if (path) {
422
- url = defaultPathSerializer({
423
- path,
424
- url
425
- });
426
- }
427
- let search = query ? querySerializer(query) : "";
428
- if (search.startsWith("?")) {
429
- search = search.substring(1);
430
- }
431
- if (search) {
432
- url += `?${search}`;
433
- }
434
- return url;
435
- }, "getUrl");
436
- function getValidRequestBody(options) {
437
- const hasBody = options.body !== void 0;
438
- const isSerializedBody = hasBody && options.bodySerializer;
439
- if (isSerializedBody) {
440
- if ("serializedBody" in options) {
441
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
442
- return hasSerializedBody ? options.serializedBody : null;
443
- }
444
- return options.body !== "" ? options.body : null;
445
- }
446
- if (hasBody) {
447
- return options.body;
448
- }
449
- return void 0;
450
- }
451
- __name(getValidRequestBody, "getValidRequestBody");
452
-
453
- // src/generated/core/auth.gen.ts
454
- var getAuthToken = /* @__PURE__ */__name(async (auth, callback) => {
455
- const token = typeof callback === "function" ? await callback(auth) : callback;
456
- if (!token) {
457
- return;
458
- }
459
- if (auth.scheme === "bearer") {
460
- return `Bearer ${token}`;
461
- }
462
- if (auth.scheme === "basic") {
463
- return `Basic ${btoa(token)}`;
464
- }
465
- return token;
466
- }, "getAuthToken");
467
-
468
- // src/generated/client/utils.gen.ts
469
- var createQuerySerializer = /* @__PURE__ */__name(({
470
- parameters = {},
471
- ...args
472
- } = {}) => {
473
- const querySerializer = /* @__PURE__ */__name(queryParams => {
474
- const search = [];
475
- if (queryParams && typeof queryParams === "object") {
476
- for (const name in queryParams) {
477
- const value = queryParams[name];
478
- if (value === void 0 || value === null) {
479
- continue;
480
- }
481
- const options = parameters[name] || args;
482
- if (Array.isArray(value)) {
483
- const serializedArray = serializeArrayParam({
484
- allowReserved: options.allowReserved,
485
- explode: true,
486
- name,
487
- style: "form",
488
- value,
489
- ...options.array
490
- });
491
- if (serializedArray) search.push(serializedArray);
492
- } else if (typeof value === "object") {
493
- const serializedObject = serializeObjectParam({
494
- allowReserved: options.allowReserved,
495
- explode: true,
496
- name,
497
- style: "deepObject",
498
- value,
499
- ...options.object
500
- });
501
- if (serializedObject) search.push(serializedObject);
502
- } else {
503
- const serializedPrimitive = serializePrimitiveParam({
504
- allowReserved: options.allowReserved,
505
- name,
506
- value
507
- });
508
- if (serializedPrimitive) search.push(serializedPrimitive);
509
- }
510
- }
511
- }
512
- return search.join("&");
513
- }, "querySerializer");
514
- return querySerializer;
515
- }, "createQuerySerializer");
516
- var getParseAs = /* @__PURE__ */__name(contentType => {
517
- if (!contentType) {
518
- return "stream";
519
- }
520
- const cleanContent = contentType.split(";")[0]?.trim();
521
- if (!cleanContent) {
522
- return;
523
- }
524
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
525
- return "json";
526
- }
527
- if (cleanContent === "multipart/form-data") {
528
- return "formData";
529
- }
530
- if (["application/", "audio/", "image/", "video/"].some(type => cleanContent.startsWith(type))) {
531
- return "blob";
532
- }
533
- if (cleanContent.startsWith("text/")) {
534
- return "text";
535
- }
536
- return;
537
- }, "getParseAs");
538
- var checkForExistence = /* @__PURE__ */__name((options, name) => {
539
- if (!name) {
540
- return false;
541
- }
542
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
543
- return true;
544
- }
545
- return false;
546
- }, "checkForExistence");
547
- var setAuthParams = /* @__PURE__ */__name(async ({
548
- security,
549
- ...options
550
- }) => {
551
- for (const auth of security) {
552
- if (checkForExistence(options, auth.name)) {
553
- continue;
554
- }
555
- const token = await getAuthToken(auth, options.auth);
556
- if (!token) {
557
- continue;
558
- }
559
- const name = auth.name ?? "Authorization";
560
- switch (auth.in) {
561
- case "query":
562
- if (!options.query) {
563
- options.query = {};
564
- }
565
- options.query[name] = token;
566
- break;
567
- case "cookie":
568
- options.headers.append("Cookie", `${name}=${token}`);
569
- break;
570
- case "header":
571
- default:
572
- options.headers.set(name, token);
573
- break;
574
- }
575
- }
576
- }, "setAuthParams");
577
- var buildUrl = /* @__PURE__ */__name(options => getUrl({
578
- baseUrl: options.baseUrl,
579
- path: options.path,
580
- query: options.query,
581
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
582
- url: options.url
583
- }), "buildUrl");
584
- var mergeConfigs = /* @__PURE__ */__name((a, b) => {
585
- const config = {
586
- ...a,
587
- ...b
588
- };
589
- if (config.baseUrl?.endsWith("/")) {
590
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
591
- }
592
- config.headers = mergeHeaders(a.headers, b.headers);
593
- return config;
594
- }, "mergeConfigs");
595
- var headersEntries = /* @__PURE__ */__name(headers => {
596
- const entries = [];
597
- headers.forEach((value, key) => {
598
- entries.push([key, value]);
599
- });
600
- return entries;
601
- }, "headersEntries");
602
- var mergeHeaders = /* @__PURE__ */__name((...headers) => {
603
- const mergedHeaders = new Headers();
604
- for (const header of headers) {
605
- if (!header) {
606
- continue;
607
- }
608
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
609
- for (const [key, value] of iterator) {
610
- if (value === null) {
611
- mergedHeaders.delete(key);
612
- } else if (Array.isArray(value)) {
613
- for (const v of value) {
614
- mergedHeaders.append(key, v);
615
- }
616
- } else if (value !== void 0) {
617
- mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
618
- }
619
- }
620
- }
621
- return mergedHeaders;
622
- }, "mergeHeaders");
623
- var Interceptors = class Interceptors2 {
624
- static {
625
- __name(this, "Interceptors");
626
- }
627
- fns = [];
628
- clear() {
629
- this.fns = [];
630
- }
631
- eject(id) {
632
- const index = this.getInterceptorIndex(id);
633
- if (this.fns[index]) {
634
- this.fns[index] = null;
635
- }
636
- }
637
- exists(id) {
638
- const index = this.getInterceptorIndex(id);
639
- return Boolean(this.fns[index]);
640
- }
641
- getInterceptorIndex(id) {
642
- if (typeof id === "number") {
643
- return this.fns[id] ? id : -1;
644
- }
645
- return this.fns.indexOf(id);
646
- }
647
- update(id, fn) {
648
- const index = this.getInterceptorIndex(id);
649
- if (this.fns[index]) {
650
- this.fns[index] = fn;
651
- return id;
652
- }
653
- return false;
654
- }
655
- use(fn) {
656
- this.fns.push(fn);
657
- return this.fns.length - 1;
658
- }
659
- };
660
- var createInterceptors = /* @__PURE__ */__name(() => ({
661
- error: new Interceptors(),
662
- request: new Interceptors(),
663
- response: new Interceptors()
664
- }), "createInterceptors");
665
- var defaultQuerySerializer = createQuerySerializer({
666
- allowReserved: false,
667
- array: {
668
- explode: true,
669
- style: "form"
670
- },
671
- object: {
672
- explode: true,
673
- style: "deepObject"
674
- }
675
- });
676
- var defaultHeaders = {
677
- "Content-Type": "application/json"
678
- };
679
- var createConfig = /* @__PURE__ */__name((override = {}) => ({
680
- ...jsonBodySerializer,
681
- headers: defaultHeaders,
682
- parseAs: "auto",
683
- querySerializer: defaultQuerySerializer,
684
- ...override
685
- }), "createConfig");
686
-
687
- // src/generated/client/client.gen.ts
688
- var createClient = /* @__PURE__ */__name((config = {}) => {
689
- let _config = mergeConfigs(createConfig(), config);
690
- const getConfig = /* @__PURE__ */__name(() => ({
691
- ..._config
692
- }), "getConfig");
693
- const setConfig = /* @__PURE__ */__name(config2 => {
694
- _config = mergeConfigs(_config, config2);
695
- return getConfig();
696
- }, "setConfig");
697
- const interceptors = createInterceptors();
698
- const beforeRequest = /* @__PURE__ */__name(async options => {
699
- const opts = {
700
- ..._config,
701
- ...options,
702
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
703
- headers: mergeHeaders(_config.headers, options.headers),
704
- serializedBody: void 0
705
- };
706
- if (opts.security) {
707
- await setAuthParams({
708
- ...opts,
709
- security: opts.security
710
- });
711
- }
712
- if (opts.requestValidator) {
713
- await opts.requestValidator(opts);
714
- }
715
- if (opts.body !== void 0 && opts.bodySerializer) {
716
- opts.serializedBody = opts.bodySerializer(opts.body);
717
- }
718
- if (opts.body === void 0 || opts.serializedBody === "") {
719
- opts.headers.delete("Content-Type");
720
- }
721
- const resolvedOpts = opts;
722
- const url = buildUrl(resolvedOpts);
723
- return {
724
- opts: resolvedOpts,
725
- url
726
- };
727
- }, "beforeRequest");
728
- const request = /* @__PURE__ */__name(async options => {
729
- const {
730
- opts,
731
- url
732
- } = await beforeRequest(options);
733
- const requestInit = {
734
- redirect: "follow",
735
- ...opts,
736
- body: getValidRequestBody(opts)
737
- };
738
- let request2 = new Request(url, requestInit);
739
- for (const fn of interceptors.request.fns) {
740
- if (fn) {
741
- request2 = await fn(request2, opts);
742
- }
743
- }
744
- const _fetch = opts.fetch;
745
- let response;
746
- try {
747
- response = await _fetch(request2);
748
- } catch (error2) {
749
- let finalError2 = error2;
750
- for (const fn of interceptors.error.fns) {
751
- if (fn) {
752
- finalError2 = await fn(error2, void 0, request2, opts);
753
- }
754
- }
755
- finalError2 = finalError2 || {};
756
- if (opts.throwOnError) {
757
- throw finalError2;
758
- }
759
- return opts.responseStyle === "data" ? void 0 : {
760
- error: finalError2,
761
- request: request2,
762
- response: void 0
763
- };
764
- }
765
- for (const fn of interceptors.response.fns) {
766
- if (fn) {
767
- response = await fn(response, request2, opts);
768
- }
769
- }
770
- const result = {
771
- request: request2,
772
- response
773
- };
774
- if (response.ok) {
775
- const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
776
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
777
- let emptyData;
778
- switch (parseAs) {
779
- case "arrayBuffer":
780
- case "blob":
781
- case "text":
782
- emptyData = await response[parseAs]();
783
- break;
784
- case "formData":
785
- emptyData = new FormData();
786
- break;
787
- case "stream":
788
- emptyData = response.body;
789
- break;
790
- case "json":
791
- default:
792
- emptyData = {};
793
- break;
794
- }
795
- return opts.responseStyle === "data" ? emptyData : {
796
- data: emptyData,
797
- ...result
798
- };
799
- }
800
- let data;
801
- switch (parseAs) {
802
- case "arrayBuffer":
803
- case "blob":
804
- case "formData":
805
- case "text":
806
- data = await response[parseAs]();
807
- break;
808
- case "json":
809
- {
810
- const text = await response.text();
811
- data = text ? JSON.parse(text) : {};
812
- break;
813
- }
814
- case "stream":
815
- return opts.responseStyle === "data" ? response.body : {
816
- data: response.body,
817
- ...result
818
- };
819
- }
820
- if (parseAs === "json") {
821
- if (opts.responseValidator) {
822
- await opts.responseValidator(data);
823
- }
824
- if (opts.responseTransformer) {
825
- data = await opts.responseTransformer(data);
826
- }
827
- }
828
- return opts.responseStyle === "data" ? data : {
829
- data,
830
- ...result
831
- };
832
- }
833
- const textError = await response.text();
834
- let jsonError;
835
- try {
836
- jsonError = JSON.parse(textError);
837
- } catch {}
838
- const error = jsonError ?? textError;
839
- let finalError = error;
840
- for (const fn of interceptors.error.fns) {
841
- if (fn) {
842
- finalError = await fn(error, response, request2, opts);
843
- }
844
- }
845
- finalError = finalError || {};
846
- if (opts.throwOnError) {
847
- throw finalError;
848
- }
849
- return opts.responseStyle === "data" ? void 0 : {
850
- error: finalError,
851
- ...result
852
- };
853
- }, "request");
854
- const makeMethodFn = /* @__PURE__ */__name(method => options => request({
855
- ...options,
856
- method
857
- }), "makeMethodFn");
858
- const makeSseFn = /* @__PURE__ */__name(method => async options => {
859
- const {
860
- opts,
861
- url
862
- } = await beforeRequest(options);
863
- return createSseClient({
864
- ...opts,
865
- body: opts.body,
866
- headers: opts.headers,
867
- method,
868
- onRequest: /* @__PURE__ */__name(async (url2, init) => {
869
- let request2 = new Request(url2, init);
870
- for (const fn of interceptors.request.fns) {
871
- if (fn) {
872
- request2 = await fn(request2, opts);
873
- }
874
- }
875
- return request2;
876
- }, "onRequest"),
877
- serializedBody: getValidRequestBody(opts),
878
- url
879
- });
880
- }, "makeSseFn");
881
- const _buildUrl = /* @__PURE__ */__name(options => buildUrl({
882
- ..._config,
883
- ...options
884
- }), "_buildUrl");
885
- return {
886
- buildUrl: _buildUrl,
887
- connect: makeMethodFn("CONNECT"),
888
- delete: makeMethodFn("DELETE"),
889
- get: makeMethodFn("GET"),
890
- getConfig,
891
- head: makeMethodFn("HEAD"),
892
- interceptors,
893
- options: makeMethodFn("OPTIONS"),
894
- patch: makeMethodFn("PATCH"),
895
- post: makeMethodFn("POST"),
896
- put: makeMethodFn("PUT"),
897
- request,
898
- setConfig,
899
- sse: {
900
- connect: makeSseFn("CONNECT"),
901
- delete: makeSseFn("DELETE"),
902
- get: makeSseFn("GET"),
903
- head: makeSseFn("HEAD"),
904
- options: makeSseFn("OPTIONS"),
905
- patch: makeSseFn("PATCH"),
906
- post: makeSseFn("POST"),
907
- put: makeSseFn("PUT"),
908
- trace: makeSseFn("TRACE")
909
- },
910
- trace: makeMethodFn("TRACE")
911
- };
912
- }, "createClient");
913
-
914
- // src/generated/client.gen.ts
915
- var client = createClient(createConfig());
916
-
917
- // src/generated/sdk.gen.ts
918
- var Actors = class {
919
- static {
920
- __name(this, "Actors");
921
- }
922
- /**
923
- * List actors
924
- *
925
- * Returns all actors the caller has access to. If projectId is provided, returns only actors in that project. project keys are scoped to a single project automatically. JWT users without projectId receive actors across all their accessible projects.
926
- */
927
- static listActors(options) {
928
- return (options?.client ?? client).get({
929
- url: "/api/v1/actors",
930
- ...options
931
- });
932
- }
933
- /**
934
- * Create an actor
935
- *
936
- * Creates a new actor. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
937
- */
938
- static createActor(options) {
939
- return (options.client ?? client).post({
940
- url: "/api/v1/actors",
941
- ...options,
942
- headers: {
943
- "Content-Type": "application/json",
944
- ...options.headers
945
- }
946
- });
947
- }
948
- /**
949
- * Delete an actor
950
- *
951
- * Deletes an actor by its ID
952
- */
953
- static deleteActor(options) {
954
- return (options.client ?? client).delete({
955
- url: "/api/v1/actors/{actor_id}",
956
- ...options
957
- });
958
- }
959
- /**
960
- * Get an actor by ID
961
- *
962
- * Returns an actor by its ID
963
- */
964
- static getActor(options) {
965
- return (options.client ?? client).get({
966
- url: "/api/v1/actors/{actor_id}",
967
- ...options
968
- });
969
- }
970
- /**
971
- * Update an actor
972
- *
973
- * Updates an actor's properties
974
- */
975
- static updateActor(options) {
976
- return (options.client ?? client).patch({
977
- url: "/api/v1/actors/{actor_id}",
978
- ...options,
979
- headers: {
980
- "Content-Type": "application/json",
981
- ...options.headers
982
- }
983
- });
984
- }
985
- /**
986
- * Get actor tags
987
- *
988
- * Returns all tags attached to the actor
989
- */
990
- static getActorTags(options) {
991
- return (options.client ?? client).get({
992
- url: "/api/v1/actors/{actor_id}/tags",
993
- ...options
994
- });
995
- }
996
- /**
997
- * Merge actor tags
998
- *
999
- * Merges provided tags with existing tags (existing tags are preserved unless overridden)
1000
- */
1001
- static mergeActorTags(options) {
1002
- return (options.client ?? client).patch({
1003
- url: "/api/v1/actors/{actor_id}/tags",
1004
- ...options,
1005
- headers: {
1006
- "Content-Type": "application/json",
1007
- ...options.headers
1008
- }
1009
- });
1010
- }
1011
- /**
1012
- * Replace actor tags
1013
- *
1014
- * Replaces all tags on the actor with the provided tags (not merged)
1015
- */
1016
- static replaceActorTags(options) {
1017
- return (options.client ?? client).put({
1018
- url: "/api/v1/actors/{actor_id}/tags",
1019
- ...options,
1020
- headers: {
1021
- "Content-Type": "application/json",
1022
- ...options.headers
1023
- }
1024
- });
1025
- }
1026
- };
1027
- var Agents = class {
1028
- static {
1029
- __name(this, "Agents");
1030
- }
1031
- /**
1032
- * List agents
1033
- *
1034
- * Returns all agents in the project.
1035
- */
1036
- static listAgents(options) {
1037
- return (options?.client ?? client).get({
1038
- url: "/api/v1/agents",
1039
- ...options
1040
- });
1041
- }
1042
- /**
1043
- * Create an agent
1044
- *
1045
- * Creates a new agent bound to an AI provider.
1046
- */
1047
- static createAgent(options) {
1048
- return (options.client ?? client).post({
1049
- url: "/api/v1/agents",
1050
- ...options,
1051
- headers: {
1052
- "Content-Type": "application/json",
1053
- ...options.headers
1054
- }
1055
- });
1056
- }
1057
- /**
1058
- * Delete an agent
1059
- *
1060
- * Deletes an agent by ID.
1061
- */
1062
- static deleteAgent(options) {
1063
- return (options.client ?? client).delete({
1064
- url: "/api/v1/agents/{agent_id}",
1065
- ...options
1066
- });
1067
- }
1068
- /**
1069
- * Get an agent
1070
- *
1071
- * Returns a single agent by ID.
1072
- */
1073
- static getAgent(options) {
1074
- return (options.client ?? client).get({
1075
- url: "/api/v1/agents/{agent_id}",
1076
- ...options
1077
- });
1078
- }
1079
- /**
1080
- * Update an agent
1081
- *
1082
- * Updates an existing agent.
1083
- */
1084
- static updateAgent(options) {
1085
- return (options.client ?? client).put({
1086
- url: "/api/v1/agents/{agent_id}",
1087
- ...options,
1088
- headers: {
1089
- "Content-Type": "application/json",
1090
- ...options.headers
1091
- }
1092
- });
1093
- }
1094
- /**
1095
- * Run an agent generation
1096
- *
1097
- * Sends messages to the agent, resolves its tools, and runs the AI model loop. Supports streaming via `stream: true`. Client tools pause the generation and return `requires_action`.
1098
- *
1099
- */
1100
- static createAgentGeneration(options) {
1101
- return (options.client ?? client).post({
1102
- url: "/api/v1/agents/{agent_id}/generate",
1103
- ...options,
1104
- headers: {
1105
- "Content-Type": "application/json",
1106
- ...options.headers
1107
- }
1108
- });
1109
- }
1110
- /**
1111
- * Submit tool outputs for a paused generation
1112
- *
1113
- * Resumes a generation that was paused due to client tool calls. Provide tool outputs for each pending tool call.
1114
- *
1115
- */
1116
- static submitAgentToolOutputs(options) {
1117
- return (options.client ?? client).post({
1118
- url: "/api/v1/agents/{agent_id}/generate/{generation_id}/tool-outputs",
1119
- ...options,
1120
- headers: {
1121
- "Content-Type": "application/json",
1122
- ...options.headers
1123
- }
1124
- });
1125
- }
1126
- /**
1127
- * Create an actor for an agent
1128
- *
1129
- * Creates a new actor associated with the specified agent
1130
- */
1131
- static createAgentActor(options) {
1132
- return (options.client ?? client).post({
1133
- url: "/api/v1/agents/{agent_id}/actors",
1134
- ...options,
1135
- headers: {
1136
- "Content-Type": "application/json",
1137
- ...options.headers
1138
- }
1139
- });
1140
- }
1141
- };
1142
- var AiProviders = class {
1143
- static {
1144
- __name(this, "AiProviders");
1145
- }
1146
- /**
1147
- * List AI providers
1148
- *
1149
- * Returns a list of AI provider configurations for a project
1150
- */
1151
- static listAiProviders(options) {
1152
- return (options?.client ?? client).get({
1153
- url: "/api/v1/ai-providers",
1154
- ...options
1155
- });
1156
- }
1157
- /**
1158
- * Create an AI provider
1159
- *
1160
- * Creates a new LLM provider configuration
1161
- */
1162
- static createAiProvider(options) {
1163
- return (options.client ?? client).post({
1164
- url: "/api/v1/ai-providers",
1165
- ...options,
1166
- headers: {
1167
- "Content-Type": "application/json",
1168
- ...options.headers
1169
- }
1170
- });
1171
- }
1172
- /**
1173
- * Delete an AI provider
1174
- *
1175
- * Deletes an AI provider configuration
1176
- */
1177
- static deleteAiProvider(options) {
1178
- return (options.client ?? client).delete({
1179
- url: "/api/v1/ai-providers/{ai_provider_id}",
1180
- ...options
1181
- });
1182
- }
1183
- /**
1184
- * Get an AI provider
1185
- *
1186
- * Returns a specific AI provider configuration
1187
- */
1188
- static getAiProvider(options) {
1189
- return (options.client ?? client).get({
1190
- url: "/api/v1/ai-providers/{ai_provider_id}",
1191
- ...options
1192
- });
1193
- }
1194
- /**
1195
- * Update an AI provider
1196
- *
1197
- * Updates an AI provider configuration
1198
- */
1199
- static updateAiProvider(options) {
1200
- return (options.client ?? client).patch({
1201
- url: "/api/v1/ai-providers/{ai_provider_id}",
1202
- ...options,
1203
- headers: {
1204
- "Content-Type": "application/json",
1205
- ...options.headers
1206
- }
1207
- });
1208
- }
1209
- };
1210
- var ApiKeys = class {
1211
- static {
1212
- __name(this, "ApiKeys");
1213
- }
1214
- /**
1215
- * List API keys
1216
- *
1217
- * Lists API keys accessible to the caller. - JWT admin: returns all API keys. - JWT regular user: returns only the user's own API keys. - API key scoped to a project: returns only API keys scoped to that project.
1218
- *
1219
- */
1220
- static listApiKeys(options) {
1221
- return (options?.client ?? client).get({
1222
- security: [{
1223
- scheme: "bearer",
1224
- type: "http"
1225
- }],
1226
- url: "/api/v1/api-keys",
1227
- ...options
1228
- });
1229
- }
1230
- /**
1231
- * Create an API key
1232
- *
1233
- * Creates a new API key for the authenticated user. - If `project_id` is provided, the key is scoped to that project. - If `policy_ids` is provided, the key's effective permissions are the intersection of the user's policies and the key's policies. - If neither is provided, the key inherits the user's full permissions.
1234
- *
1235
- */
1236
- static createApiKey(options) {
1237
- return (options.client ?? client).post({
1238
- url: "/api/v1/api-keys",
1239
- ...options,
1240
- headers: {
1241
- "Content-Type": "application/json",
1242
- ...options.headers
1243
- }
1244
- });
1245
- }
1246
- /**
1247
- * Delete an API key
1248
- *
1249
- * Deletes an API key. Only the owner or an admin can delete it.
1250
- */
1251
- static deleteApiKey(options) {
1252
- return (options.client ?? client).delete({
1253
- url: "/api/v1/api-keys/{api_key_id}",
1254
- ...options
1255
- });
1256
- }
1257
- /**
1258
- * Get an API key
1259
- *
1260
- * Returns details of an API key. Only the owner or an admin can access it.
1261
- */
1262
- static getApiKey(options) {
1263
- return (options.client ?? client).get({
1264
- url: "/api/v1/api-keys/{api_key_id}",
1265
- ...options
1266
- });
1267
- }
1268
- /**
1269
- * Update an API key
1270
- *
1271
- * Updates an API key's name, project scope, or policies. Only the owner or an admin can update it.
1272
- */
1273
- static updateApiKey(options) {
1274
- return (options.client ?? client).put({
1275
- url: "/api/v1/api-keys/{api_key_id}",
1276
- ...options,
1277
- headers: {
1278
- "Content-Type": "application/json",
1279
- ...options.headers
1280
- }
1281
- });
1282
- }
1283
- };
1284
- var Chats = class {
1285
- static {
1286
- __name(this, "Chats");
1287
- }
1288
- /**
1289
- * List chats
1290
- *
1291
- * Returns all chats in the project.
1292
- */
1293
- static listChats(options) {
1294
- return (options?.client ?? client).get({
1295
- url: "/api/v1/chats",
1296
- ...options
1297
- });
1298
- }
1299
- /**
1300
- * Create a chat
1301
- *
1302
- * Creates a new chat resource bound to an AI provider.
1303
- */
1304
- static createChat(options) {
1305
- return (options.client ?? client).post({
1306
- url: "/api/v1/chats",
1307
- ...options,
1308
- headers: {
1309
- "Content-Type": "application/json",
1310
- ...options.headers
1311
- }
1312
- });
1313
- }
1314
- /**
1315
- * Delete a chat
1316
- *
1317
- * Deletes a chat by ID.
1318
- */
1319
- static deleteChat(options) {
1320
- return (options.client ?? client).delete({
1321
- url: "/api/v1/chats/{chat_id}",
1322
- ...options
1323
- });
1324
- }
1325
- /**
1326
- * Get a chat
1327
- *
1328
- * Returns a single chat by ID.
1329
- */
1330
- static getChat(options) {
1331
- return (options.client ?? client).get({
1332
- url: "/api/v1/chats/{chat_id}",
1333
- ...options
1334
- });
1335
- }
1336
- /**
1337
- * Create a chat completion for a stored chat
1338
- *
1339
- * Runs a completion using the AI provider and settings stored in the chat. Pass `stream: true` for SSE streaming. A system message in `messages` overrides the chat's stored system message for this call only. Messages may use `documentId` instead of `content`.
1340
- *
1341
- */
1342
- static createChatCompletionForChat(options) {
1343
- return (options.client ?? client).post({
1344
- url: "/api/v1/chats/{chat_id}/completions",
1345
- ...options,
1346
- headers: {
1347
- "Content-Type": "application/json",
1348
- ...options.headers
1349
- }
1350
- });
1351
- }
1352
- /**
1353
- * Create a chat completion (stateless)
1354
- *
1355
- * OpenAI Chat Completions-compatible endpoint. Resolves the AI provider from `ai_provider_id`, decrypts its secret, and calls the appropriate Vercel AI SDK provider. `ai_provider_id` is required — there is no server-side model fallback.
1356
- *
1357
- */
1358
- static createChatCompletion(options) {
1359
- return (options.client ?? client).post({
1360
- url: "/api/v1/chats/completions",
1361
- ...options,
1362
- headers: {
1363
- "Content-Type": "application/json",
1364
- ...options.headers
1365
- }
1366
- });
1367
- }
1368
- /**
1369
- * Create an actor for a chat
1370
- *
1371
- * Creates a new actor associated with the specified chat
1372
- */
1373
- static createChatActor(options) {
1374
- return (options.client ?? client).post({
1375
- url: "/api/v1/chats/{chat_id}/actors",
1376
- ...options,
1377
- headers: {
1378
- "Content-Type": "application/json",
1379
- ...options.headers
1380
- }
1381
- });
1382
- }
1383
- };
1384
- var Conversations = class {
1385
- static {
1386
- __name(this, "Conversations");
1387
- }
1388
- /**
1389
- * List conversations
1390
- *
1391
- * Returns all conversations the caller has access to. If projectId is provided, returns only conversations in that project. project keys are scoped to a single project automatically.
1392
- */
1393
- static listConversations(options) {
1394
- return (options?.client ?? client).get({
1395
- url: "/api/v1/conversations",
1396
- ...options
1397
- });
1398
- }
1399
- /**
1400
- * Create a conversation
1401
- *
1402
- * Creates a new conversation. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
1403
- */
1404
- static createConversation(options) {
1405
- return (options.client ?? client).post({
1406
- url: "/api/v1/conversations",
1407
- ...options,
1408
- headers: {
1409
- "Content-Type": "application/json",
1410
- ...options.headers
1411
- }
1412
- });
1413
- }
1414
- /**
1415
- * Delete a conversation
1416
- *
1417
- * Deletes a conversation by its ID
1418
- */
1419
- static deleteConversation(options) {
1420
- return (options.client ?? client).delete({
1421
- url: "/api/v1/conversations/{conversation_id}",
1422
- ...options
1423
- });
1424
- }
1425
- /**
1426
- * Get a conversation by ID
1427
- *
1428
- * Returns a conversation by its ID
1429
- */
1430
- static getConversation(options) {
1431
- return (options.client ?? client).get({
1432
- url: "/api/v1/conversations/{conversation_id}",
1433
- ...options
1434
- });
1435
- }
1436
- /**
1437
- * Update a conversation
1438
- *
1439
- * Updates the status of a conversation
1440
- */
1441
- static updateConversation(options) {
1442
- return (options.client ?? client).patch({
1443
- url: "/api/v1/conversations/{conversation_id}",
1444
- ...options,
1445
- headers: {
1446
- "Content-Type": "application/json",
1447
- ...options.headers
1448
- }
1449
- });
1450
- }
1451
- /**
1452
- * List conversation messages
1453
- *
1454
- * Returns all messages (documents) attached to a conversation, ordered by position
1455
- */
1456
- static listConversationMessages(options) {
1457
- return (options.client ?? client).get({
1458
- url: "/api/v1/conversations/{conversation_id}/messages",
1459
- ...options
1460
- });
1461
- }
1462
- /**
1463
- * Add a message to a conversation
1464
- *
1465
- * Creates a document from the message text and attaches it to the conversation at the given position. If position is omitted, it is appended at the end.
1466
- */
1467
- static addConversationMessage(options) {
1468
- return (options.client ?? client).post({
1469
- url: "/api/v1/conversations/{conversation_id}/messages",
1470
- ...options,
1471
- headers: {
1472
- "Content-Type": "application/json",
1473
- ...options.headers
1474
- }
1475
- });
1476
- }
1477
- /**
1478
- * Generate the next message in a conversation
1479
- *
1480
- * Generates the next message using the specified actor's linked agent or chat.
1481
- * On `completed`, the reply is persisted as a new ConversationMessage authored
1482
- * by that actor. On `requires_action`, nothing is persisted; the caller must
1483
- * submit tool outputs via the Agents module and re-invoke generate.
1484
- *
1485
- */
1486
- static generateConversationMessage(options) {
1487
- return (options.client ?? client).post({
1488
- url: "/api/v1/conversations/{conversation_id}/generate",
1489
- ...options,
1490
- headers: {
1491
- "Content-Type": "application/json",
1492
- ...options.headers
1493
- }
1494
- });
1495
- }
1496
- /**
1497
- * List actors in a conversation
1498
- *
1499
- * Returns all distinct actors who have sent at least one message in the conversation
1500
- */
1501
- static listConversationActors(options) {
1502
- return (options.client ?? client).get({
1503
- url: "/api/v1/conversations/{conversation_id}/actors",
1504
- ...options
1505
- });
1506
- }
1507
- /**
1508
- * Remove a message from a conversation
1509
- *
1510
- * Removes a document from a conversation
1511
- */
1512
- static removeConversationMessage(options) {
1513
- return (options.client ?? client).delete({
1514
- url: "/api/v1/conversations/{conversation_id}/messages/{document_id}",
1515
- ...options
1516
- });
1517
- }
1518
- /**
1519
- * Get conversation tags
1520
- *
1521
- * Returns all tags attached to the conversation
1522
- */
1523
- static getConversationTags(options) {
1524
- return (options.client ?? client).get({
1525
- url: "/api/v1/conversations/{conversation_id}/tags",
1526
- ...options
1527
- });
1528
- }
1529
- /**
1530
- * Merge conversation tags
1531
- *
1532
- * Merges provided tags with existing tags
1533
- */
1534
- static mergeConversationTags(options) {
1535
- return (options.client ?? client).patch({
1536
- url: "/api/v1/conversations/{conversation_id}/tags",
1537
- ...options,
1538
- headers: {
1539
- "Content-Type": "application/json",
1540
- ...options.headers
1541
- }
1542
- });
1543
- }
1544
- /**
1545
- * Replace conversation tags
1546
- *
1547
- * Replaces all tags on the conversation with the provided tags
1548
- */
1549
- static replaceConversationTags(options) {
1550
- return (options.client ?? client).put({
1551
- url: "/api/v1/conversations/{conversation_id}/tags",
1552
- ...options,
1553
- headers: {
1554
- "Content-Type": "application/json",
1555
- ...options.headers
1556
- }
1557
- });
1558
- }
1559
- };
1560
- var Documents = class {
1561
- static {
1562
- __name(this, "Documents");
1563
- }
1564
- /**
1565
- * List documents
1566
- *
1567
- * Returns all documents the caller has access to. If projectId is provided, returns only documents in that project. project keys are scoped to a single project automatically. JWT users without projectId receive documents across all their accessible projects.
1568
- */
1569
- static listDocuments(options) {
1570
- return (options?.client ?? client).get({
1571
- url: "/api/v1/documents",
1572
- ...options
1573
- });
1574
- }
1575
- /**
1576
- * Create a document
1577
- *
1578
- * Creates a new text document and generates an embedding vector for semantic search. project keys automatically infer the project from the key's scope; JWT callers must supply projectId.
1579
- */
1580
- static createDocument(options) {
1581
- return (options.client ?? client).post({
1582
- url: "/api/v1/documents",
1583
- ...options,
1584
- headers: {
1585
- "Content-Type": "application/json",
1586
- ...options.headers
1587
- }
1588
- });
1589
- }
1590
- /**
1591
- * Delete a document
1592
- *
1593
- * Deletes a document and its underlying file
1594
- */
1595
- static deleteDocument(options) {
1596
- return (options.client ?? client).delete({
1597
- url: "/api/v1/documents/{document_id}",
1598
- ...options
1599
- });
1600
- }
1601
- /**
1602
- * Get a document by ID
1603
- *
1604
- * Returns a document with its text content
1605
- */
1606
- static getDocument(options) {
1607
- return (options.client ?? client).get({
1608
- url: "/api/v1/documents/{document_id}",
1609
- ...options
1610
- });
1611
- }
1612
- /**
1613
- * Update a document
1614
- *
1615
- * Updates document content, title, path, metadata, or tags. Supplying `path` moves the document to a new logical path within the project.
1616
- */
1617
- static updateDocument(options) {
1618
- return (options.client ?? client).patch({
1619
- url: "/api/v1/documents/{document_id}",
1620
- ...options,
1621
- headers: {
1622
- "Content-Type": "application/json",
1623
- ...options.headers
1624
- }
1625
- });
1626
- }
1627
- /**
1628
- * Get document tags
1629
- *
1630
- * Returns all tags attached to the document
1631
- */
1632
- static getDocumentTags(options) {
1633
- return (options.client ?? client).get({
1634
- url: "/api/v1/documents/{document_id}/tags",
1635
- ...options
1636
- });
1637
- }
1638
- /**
1639
- * Merge document tags
1640
- *
1641
- * Merges provided tags with existing tags (existing tags are preserved unless overridden)
1642
- */
1643
- static mergeDocumentTags(options) {
1644
- return (options.client ?? client).patch({
1645
- url: "/api/v1/documents/{document_id}/tags",
1646
- ...options,
1647
- headers: {
1648
- "Content-Type": "application/json",
1649
- ...options.headers
1650
- }
1651
- });
1652
- }
1653
- /**
1654
- * Replace document tags
1655
- *
1656
- * Replaces all tags on the document with the provided tags (not merged)
1657
- */
1658
- static replaceDocumentTags(options) {
1659
- return (options.client ?? client).put({
1660
- url: "/api/v1/documents/{document_id}/tags",
1661
- ...options,
1662
- headers: {
1663
- "Content-Type": "application/json",
1664
- ...options.headers
1665
- }
1666
- });
1667
- }
1668
- };
1669
- var Files = class {
1670
- static {
1671
- __name(this, "Files");
1672
- }
1673
- /**
1674
- * List all files
1675
- *
1676
- * Returns a list of all stored files
1677
- */
1678
- static listFiles(options) {
1679
- return (options?.client ?? client).get({
1680
- url: "/api/v1/files",
1681
- ...options
1682
- });
1683
- }
1684
- /**
1685
- * Create a file
1686
- *
1687
- * Creates a new file record in the system
1688
- */
1689
- static createFile(options) {
1690
- return (options.client ?? client).post({
1691
- url: "/api/v1/files",
1692
- ...options,
1693
- headers: {
1694
- "Content-Type": "application/json",
1695
- ...options.headers
1696
- }
1697
- });
1698
- }
1699
- /**
1700
- * Upload a file
1701
- *
1702
- * Uploads a file to the server and stores it in the configured storage directory
1703
- */
1704
- static uploadFile(options) {
1705
- return (options.client ?? client).post({
1706
- ...formDataBodySerializer,
1707
- url: "/api/v1/files/upload",
1708
- ...options,
1709
- headers: {
1710
- "Content-Type": null,
1711
- ...options.headers
1712
- }
1713
- });
1714
- }
1715
- /**
1716
- * Upload a file using base64 encoding
1717
- *
1718
- * Uploads a file to the server using base64-encoded content
1719
- */
1720
- static uploadFileBase64(options) {
1721
- return (options.client ?? client).post({
1722
- url: "/api/v1/files/upload/base64",
1723
- ...options,
1724
- headers: {
1725
- "Content-Type": "application/json",
1726
- ...options.headers
1727
- }
1728
- });
1729
- }
1730
- /**
1731
- * Delete a file
1732
- *
1733
- * Removes a file from the system by ID
1734
- */
1735
- static deleteFile(options) {
1736
- return (options.client ?? client).delete({
1737
- url: "/api/v1/files/{file_id}",
1738
- ...options
1739
- });
1740
- }
1741
- /**
1742
- * Get a file by ID
1743
- *
1744
- * Returns the data and metadata of a specific file
1745
- */
1746
- static getFile(options) {
1747
- return (options.client ?? client).get({
1748
- url: "/api/v1/files/{file_id}",
1749
- ...options
1750
- });
1751
- }
1752
- /**
1753
- * Download a file
1754
- *
1755
- * Streams the file content to the client
1756
- */
1757
- static downloadFile(options) {
1758
- return (options.client ?? client).get({
1759
- url: "/api/v1/files/{file_id}/download",
1760
- ...options
1761
- });
1762
- }
1763
- /**
1764
- * Update file metadata
1765
- *
1766
- * Updates the metadata field of a file
1767
- */
1768
- static updateFileMetadata(options) {
1769
- return (options.client ?? client).patch({
1770
- url: "/api/v1/files/{file_id}/metadata",
1771
- ...options,
1772
- headers: {
1773
- "Content-Type": "application/json",
1774
- ...options.headers
1775
- }
1776
- });
1777
- }
1778
- /**
1779
- * Download file as base64
1780
- *
1781
- * Returns the file content encoded as base64
1782
- */
1783
- static downloadFileBase64(options) {
1784
- return (options.client ?? client).get({
1785
- url: "/api/v1/files/{file_id}/download/base64",
1786
- ...options
1787
- });
1788
- }
1789
- /**
1790
- * Get file tags
1791
- *
1792
- * Returns all tags attached to the file
1793
- */
1794
- static getFileTags(options) {
1795
- return (options.client ?? client).get({
1796
- url: "/api/v1/files/{file_id}/tags",
1797
- ...options
1798
- });
1799
- }
1800
- /**
1801
- * Merge file tags
1802
- *
1803
- * Merges provided tags with existing tags
1804
- */
1805
- static mergeFileTags(options) {
1806
- return (options.client ?? client).patch({
1807
- url: "/api/v1/files/{file_id}/tags",
1808
- ...options,
1809
- headers: {
1810
- "Content-Type": "application/json",
1811
- ...options.headers
1812
- }
1813
- });
1814
- }
1815
- /**
1816
- * Replace file tags
1817
- *
1818
- * Replaces all tags on the file with the provided tags
1819
- */
1820
- static replaceFileTags(options) {
1821
- return (options.client ?? client).put({
1822
- url: "/api/v1/files/{file_id}/tags",
1823
- ...options,
1824
- headers: {
1825
- "Content-Type": "application/json",
1826
- ...options.headers
1827
- }
1828
- });
1829
- }
1830
- };
1831
- var Formations = class {
1832
- static {
1833
- __name(this, "Formations");
1834
- }
1835
- /**
1836
- * Validate a formation template
1837
- *
1838
- * Validates a formation template without creating any resources. Returns a list of errors and warnings. Accepts the template as a JSON object or as a YAML/JSON string.
1839
- *
1840
- */
1841
- static validateFormation(options) {
1842
- return (options.client ?? client).post({
1843
- url: "/api/v1/formations/validate",
1844
- ...options,
1845
- headers: {
1846
- "Content-Type": "application/json",
1847
- ...options.headers
1848
- }
1849
- });
1850
- }
1851
- /**
1852
- * Plan a formation deployment
1853
- *
1854
- * Computes a diff between the desired template and the current stack state without making any changes. Returns the list of planned actions.
1855
- *
1856
- */
1857
- static planFormation(options) {
1858
- return (options.client ?? client).post({
1859
- url: "/api/v1/formations/plan",
1860
- ...options,
1861
- headers: {
1862
- "Content-Type": "application/json",
1863
- ...options.headers
1864
- }
1865
- });
1866
- }
1867
- /**
1868
- * List formations
1869
- *
1870
- * Returns all formation stacks for a project
1871
- */
1872
- static listFormations(options) {
1873
- return (options?.client ?? client).get({
1874
- url: "/api/v1/formations",
1875
- ...options
1876
- });
1877
- }
1878
- /**
1879
- * Create a new formation
1880
- *
1881
- * Validates the template, creates the formation record, then provisions all declared resources in dependency order.
1882
- *
1883
- */
1884
- static createFormation(options) {
1885
- return (options.client ?? client).post({
1886
- url: "/api/v1/formations",
1887
- ...options,
1888
- headers: {
1889
- "Content-Type": "application/json",
1890
- ...options.headers
1891
- }
1892
- });
1893
- }
1894
- /**
1895
- * Delete an formation
1896
- *
1897
- * Deletes the formation stack and all its managed resources in reverse dependency order.
1898
- *
1899
- */
1900
- static deleteFormation(options) {
1901
- return (options.client ?? client).delete({
1902
- url: "/api/v1/formations/{formation_id}",
1903
- ...options
1904
- });
1905
- }
1906
- /**
1907
- * Get a specific formation
1908
- *
1909
- * Returns the formation stack including its current resources.
1910
- */
1911
- static getFormation(options) {
1912
- return (options.client ?? client).get({
1913
- url: "/api/v1/formations/{formation_id}",
1914
- ...options
1915
- });
1916
- }
1917
- /**
1918
- * Update an formation
1919
- *
1920
- * Applies a new template to the formation. Resources are created, updated, or deleted to reconcile the current state with the desired state.
1921
- *
1922
- */
1923
- static updateFormation(options) {
1924
- return (options.client ?? client).put({
1925
- url: "/api/v1/formations/{formation_id}",
1926
- ...options,
1927
- headers: {
1928
- "Content-Type": "application/json",
1929
- ...options.headers
1930
- }
1931
- });
1932
- }
1933
- /**
1934
- * List formation operation events
1935
- *
1936
- * Returns all operations (create, update, delete) with their event logs for the formation, ordered chronologically.
1937
- *
1938
- */
1939
- static listFormationEvents(options) {
1940
- return (options.client ?? client).get({
1941
- url: "/api/v1/formations/{formation_id}/events",
1942
- ...options
1943
- });
1944
- }
1945
- };
1946
- var Knowledge = class {
1947
- static {
1948
- __name(this, "Knowledge");
1949
- }
1950
- /**
1951
- * Search knowledge
1952
- *
1953
- * Searches across documents and memory entries using semantic search, file paths, document IDs, or memory IDs/tags. At least one of `query`, `document_paths`, `document_ids`, `memory_ids`, or `memory_tags` must be provided.
1954
- */
1955
- static searchKnowledge(options) {
1956
- return (options.client ?? client).post({
1957
- url: "/api/v1/knowledge/search",
1958
- ...options,
1959
- headers: {
1960
- "Content-Type": "application/json",
1961
- ...options.headers
1962
- }
1963
- });
1964
- }
1965
- };
1966
- var Memories = class {
1967
- static {
1968
- __name(this, "Memories");
1969
- }
1970
- /**
1971
- * List memories
1972
- *
1973
- * Returns a list of memory configurations for a project
1974
- */
1975
- static listMemories(options) {
1976
- return (options?.client ?? client).get({
1977
- url: "/api/v1/memories",
1978
- ...options
1979
- });
1980
- }
1981
- /**
1982
- * Create a memory
1983
- *
1984
- * Creates a new memory configuration in a project
1985
- */
1986
- static createMemory(options) {
1987
- return (options.client ?? client).post({
1988
- url: "/api/v1/memories",
1989
- ...options,
1990
- headers: {
1991
- "Content-Type": "application/json",
1992
- ...options.headers
1993
- }
1994
- });
1995
- }
1996
- /**
1997
- * Delete a memory
1998
- *
1999
- * Deletes a memory configuration
2000
- */
2001
- static deleteMemory(options) {
2002
- return (options.client ?? client).delete({
2003
- url: "/api/v1/memories/{memory_id}",
2004
- ...options
2005
- });
2006
- }
2007
- /**
2008
- * Get a memory
2009
- *
2010
- * Returns a single memory configuration by ID
2011
- */
2012
- static getMemory(options) {
2013
- return (options.client ?? client).get({
2014
- url: "/api/v1/memories/{memory_id}",
2015
- ...options
2016
- });
2017
- }
2018
- /**
2019
- * Update a memory
2020
- *
2021
- * Updates an existing memory configuration
2022
- */
2023
- static updateMemory(options) {
2024
- return (options.client ?? client).put({
2025
- url: "/api/v1/memories/{memory_id}",
2026
- ...options,
2027
- headers: {
2028
- "Content-Type": "application/json",
2029
- ...options.headers
2030
- }
2031
- });
2032
- }
2033
- };
2034
- var MemoryEntries = class {
2035
- static {
2036
- __name(this, "MemoryEntries");
2037
- }
2038
- /**
2039
- * List memory entries
2040
- *
2041
- * Returns all entries in a memory container
2042
- */
2043
- static listMemoryEntries(options) {
2044
- return (options.client ?? client).get({
2045
- url: "/api/v1/memories/{memory_id}/entries",
2046
- ...options
2047
- });
2048
- }
2049
- /**
2050
- * Create a memory entry
2051
- *
2052
- * Creates a new entry in the specified memory container. Automatically generates an embedding for semantic search.
2053
- */
2054
- static createMemoryEntry(options) {
2055
- return (options.client ?? client).post({
2056
- url: "/api/v1/memories/{memory_id}/entries",
2057
- ...options,
2058
- headers: {
2059
- "Content-Type": "application/json",
2060
- ...options.headers
2061
- }
2062
- });
2063
- }
2064
- /**
2065
- * Delete a memory entry
2066
- *
2067
- * Deletes a memory entry
2068
- */
2069
- static deleteMemoryEntry(options) {
2070
- return (options.client ?? client).delete({
2071
- url: "/api/v1/memories/{memory_id}/entries/{entry_id}",
2072
- ...options
2073
- });
2074
- }
2075
- /**
2076
- * Get a memory entry
2077
- *
2078
- * Returns a single memory entry by ID
2079
- */
2080
- static getMemoryEntry(options) {
2081
- return (options.client ?? client).get({
2082
- url: "/api/v1/memories/{memory_id}/entries/{entry_id}",
2083
- ...options
2084
- });
2085
- }
2086
- /**
2087
- * Update a memory entry
2088
- *
2089
- * Updates an existing memory entry. Regenerates the embedding if content changes.
2090
- */
2091
- static updateMemoryEntry(options) {
2092
- return (options.client ?? client).put({
2093
- url: "/api/v1/memories/{memory_id}/entries/{entry_id}",
2094
- ...options,
2095
- headers: {
2096
- "Content-Type": "application/json",
2097
- ...options.headers
2098
- }
2099
- });
2100
- }
2101
- };
2102
- var Orchestrations = class {
2103
- static {
2104
- __name(this, "Orchestrations");
2105
- }
2106
- /**
2107
- * List orchestrations
2108
- *
2109
- * Returns orchestrations accessible to the caller.
2110
- */
2111
- static listOrchestrations(options) {
2112
- return (options?.client ?? client).get({
2113
- url: "/api/v1/orchestrations",
2114
- ...options
2115
- });
2116
- }
2117
- /**
2118
- * Create an orchestration
2119
- *
2120
- * Creates a new orchestration workflow definition in the project.
2121
- */
2122
- static createOrchestration(options) {
2123
- return (options.client ?? client).post({
2124
- url: "/api/v1/orchestrations",
2125
- ...options,
2126
- headers: {
2127
- "Content-Type": "application/json",
2128
- ...options.headers
2129
- }
2130
- });
2131
- }
2132
- /**
2133
- * Delete an orchestration
2134
- *
2135
- * Deletes an orchestration definition and all its runs.
2136
- */
2137
- static deleteOrchestration(options) {
2138
- return (options.client ?? client).delete({
2139
- url: "/api/v1/orchestrations/{orchestration_id}",
2140
- ...options
2141
- });
2142
- }
2143
- /**
2144
- * Get an orchestration
2145
- *
2146
- * Returns the orchestration with nodes and edges.
2147
- */
2148
- static getOrchestration(options) {
2149
- return (options.client ?? client).get({
2150
- url: "/api/v1/orchestrations/{orchestration_id}",
2151
- ...options
2152
- });
2153
- }
2154
- /**
2155
- * Update an orchestration
2156
- *
2157
- * Partially updates an orchestration definition.
2158
- */
2159
- static updateOrchestration(options) {
2160
- return (options.client ?? client).patch({
2161
- url: "/api/v1/orchestrations/{orchestration_id}",
2162
- ...options,
2163
- headers: {
2164
- "Content-Type": "application/json",
2165
- ...options.headers
2166
- }
2167
- });
2168
- }
2169
- /**
2170
- * List orchestration runs
2171
- *
2172
- * Returns all runs for an orchestration.
2173
- */
2174
- static listOrchestrationRuns(options) {
2175
- return (options.client ?? client).get({
2176
- url: "/api/v1/orchestrations/{orchestration_id}/runs",
2177
- ...options
2178
- });
2179
- }
2180
- /**
2181
- * Start an orchestration run
2182
- *
2183
- * Creates and immediately executes a new run for the orchestration.
2184
- */
2185
- static startOrchestrationRun(options) {
2186
- return (options.client ?? client).post({
2187
- url: "/api/v1/orchestrations/{orchestration_id}/runs",
2188
- ...options,
2189
- headers: {
2190
- "Content-Type": "application/json",
2191
- ...options.headers
2192
- }
2193
- });
2194
- }
2195
- /**
2196
- * Cancel an orchestration run
2197
- *
2198
- * Cancels a running or paused orchestration run.
2199
- */
2200
- static cancelOrchestrationRun(options) {
2201
- return (options.client ?? client).post({
2202
- url: "/api/v1/orchestrations/{orchestration_id}/runs/{run_id}/cancel",
2203
- ...options
2204
- });
2205
- }
2206
- /**
2207
- * Submit human input
2208
- *
2209
- * Provides human input to a paused orchestration run waiting at a human node.
2210
- */
2211
- static submitHumanInput(options) {
2212
- return (options.client ?? client).post({
2213
- url: "/api/v1/orchestrations/{orchestration_id}/runs/{run_id}/human-input",
2214
- ...options,
2215
- headers: {
2216
- "Content-Type": "application/json",
2217
- ...options.headers
2218
- }
2219
- });
2220
- }
2221
- /**
2222
- * Resume an orchestration run
2223
- *
2224
- * Resumes a paused orchestration run from its last checkpoint.
2225
- */
2226
- static resumeOrchestrationRun(options) {
2227
- return (options.client ?? client).post({
2228
- url: "/api/v1/orchestrations/{orchestration_id}/runs/{run_id}/resume",
2229
- ...options
2230
- });
2231
- }
2232
- /**
2233
- * Get an orchestration run
2234
- *
2235
- * Returns the status, state, and artifacts of a specific run.
2236
- */
2237
- static getOrchestrationRun(options) {
2238
- return (options.client ?? client).get({
2239
- url: "/api/v1/orchestrations/{orchestration_id}/runs/{run_id}",
2240
- ...options
2241
- });
2242
- }
2243
- };
2244
- var Policies = class {
2245
- static {
2246
- __name(this, "Policies");
2247
- }
2248
- /**
2249
- * List all policies
2250
- *
2251
- * Returns a list of all global policies. Requires admin role.
2252
- */
2253
- static listPolicies(options) {
2254
- return (options?.client ?? client).get({
2255
- url: "/api/v1/policies",
2256
- ...options
2257
- });
2258
- }
2259
- /**
2260
- * Create a policy
2261
- *
2262
- * Creates a new global policy. Requires admin role.
2263
- */
2264
- static createPolicy(options) {
2265
- return (options.client ?? client).post({
2266
- url: "/api/v1/policies",
2267
- ...options,
2268
- headers: {
2269
- "Content-Type": "application/json",
2270
- ...options.headers
2271
- }
2272
- });
2273
- }
2274
- /**
2275
- * Delete a policy
2276
- *
2277
- * Deletes a global policy. Requires admin role.
2278
- */
2279
- static deletePolicy(options) {
2280
- return (options.client ?? client).delete({
2281
- url: "/api/v1/policies/{policy_id}",
2282
- ...options
2283
- });
2284
- }
2285
- /**
2286
- * Get a policy
2287
- *
2288
- * Returns details of a specific policy. Requires admin role.
2289
- */
2290
- static getPolicy(options) {
2291
- return (options.client ?? client).get({
2292
- url: "/api/v1/policies/{policy_id}",
2293
- ...options
2294
- });
2295
- }
2296
- /**
2297
- * Update a policy
2298
- *
2299
- * Updates an existing global policy. Requires admin role.
2300
- */
2301
- static updatePolicy(options) {
2302
- return (options.client ?? client).put({
2303
- url: "/api/v1/policies/{policy_id}",
2304
- ...options,
2305
- headers: {
2306
- "Content-Type": "application/json",
2307
- ...options.headers
2308
- }
2309
- });
2310
- }
2311
- };
2312
- var Projects = class {
2313
- static {
2314
- __name(this, "Projects");
2315
- }
2316
- /**
2317
- * Create a project
2318
- *
2319
- * Creates a new project. Requires admin role.
2320
- */
2321
- static createProject(options) {
2322
- return (options.client ?? client).post({
2323
- url: "/api/v1/projects",
2324
- ...options,
2325
- headers: {
2326
- "Content-Type": "application/json",
2327
- ...options.headers
2328
- }
2329
- });
2330
- }
2331
- /**
2332
- * Delete a project
2333
- *
2334
- * Deletes a project. Requires admin role.
2335
- */
2336
- static deleteProject(options) {
2337
- return (options.client ?? client).delete({
2338
- url: "/api/v1/projects/{project_id}",
2339
- ...options
2340
- });
2341
- }
2342
- /**
2343
- * Get a project
2344
- *
2345
- * Returns details of a specific project.
2346
- */
2347
- static getProject(options) {
2348
- return (options.client ?? client).get({
2349
- url: "/api/v1/projects/{project_id}",
2350
- ...options
2351
- });
2352
- }
2353
- };
2354
- var Secrets = class {
2355
- static {
2356
- __name(this, "Secrets");
2357
- }
2358
- /**
2359
- * List secrets
2360
- *
2361
- * Returns a list of secrets for a project
2362
- */
2363
- static listSecrets(options) {
2364
- return (options?.client ?? client).get({
2365
- url: "/api/v1/secrets",
2366
- ...options
2367
- });
2368
- }
2369
- /**
2370
- * Create a secret
2371
- *
2372
- * Creates a new encrypted secret in a project
2373
- */
2374
- static createSecret(options) {
2375
- return (options.client ?? client).post({
2376
- url: "/api/v1/secrets",
2377
- ...options,
2378
- headers: {
2379
- "Content-Type": "application/json",
2380
- ...options.headers
2381
- }
2382
- });
2383
- }
2384
- /**
2385
- * Delete a secret
2386
- *
2387
- * Deletes a secret
2388
- */
2389
- static deleteSecret(options) {
2390
- return (options.client ?? client).delete({
2391
- url: "/api/v1/secrets/{secret_id}",
2392
- ...options
2393
- });
2394
- }
2395
- /**
2396
- * Get a secret
2397
- *
2398
- * Returns a specific secret
2399
- */
2400
- static getSecret(options) {
2401
- return (options.client ?? client).get({
2402
- url: "/api/v1/secrets/{secret_id}",
2403
- ...options
2404
- });
2405
- }
2406
- /**
2407
- * Update a secret
2408
- *
2409
- * Updates a secret's name and/or value
2410
- */
2411
- static updateSecret(options) {
2412
- return (options.client ?? client).patch({
2413
- url: "/api/v1/secrets/{secret_id}",
2414
- ...options,
2415
- headers: {
2416
- "Content-Type": "application/json",
2417
- ...options.headers
2418
- }
2419
- });
2420
- }
2421
- };
2422
- var Sessions = class {
2423
- static {
2424
- __name(this, "Sessions");
2425
- }
2426
- /**
2427
- * List sessions
2428
- *
2429
- * Returns sessions for the specified agent, optionally filtered by actorId and status.
2430
- */
2431
- static listAgentSessions(options) {
2432
- return (options.client ?? client).get({
2433
- url: "/api/v1/agents/{agent_id}/sessions",
2434
- ...options
2435
- });
2436
- }
2437
- /**
2438
- * Create a session
2439
- *
2440
- * Creates a new session for the specified agent. Internally creates a conversation and two actors (agent + user) so the caller only needs this single call to start interacting with the agent.
2441
- *
2442
- */
2443
- static createAgentSession(options) {
2444
- return (options.client ?? client).post({
2445
- url: "/api/v1/agents/{agent_id}/sessions",
2446
- ...options,
2447
- headers: {
2448
- "Content-Type": "application/json",
2449
- ...options.headers
2450
- }
2451
- });
2452
- }
2453
- /**
2454
- * Delete a session
2455
- *
2456
- * Deletes the session and its underlying conversation and actors.
2457
- */
2458
- static deleteAgentSession(options) {
2459
- return (options.client ?? client).delete({
2460
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}",
2461
- ...options
2462
- });
2463
- }
2464
- /**
2465
- * Get a session
2466
- *
2467
- * Returns details of a single session.
2468
- */
2469
- static getAgentSession(options) {
2470
- return (options.client ?? client).get({
2471
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}",
2472
- ...options
2473
- });
2474
- }
2475
- /**
2476
- * Update a session
2477
- *
2478
- * Updates the session name and/or status.
2479
- */
2480
- static updateSession(options) {
2481
- return (options.client ?? client).patch({
2482
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}",
2483
- ...options,
2484
- headers: {
2485
- "Content-Type": "application/json",
2486
- ...options.headers
2487
- }
2488
- });
2489
- }
2490
- /**
2491
- * List session messages
2492
- *
2493
- * Returns messages in the session with simplified roles (user/assistant) instead of raw actor IDs.
2494
- *
2495
- */
2496
- static listAgentSessionMessages(options) {
2497
- return (options.client ?? client).get({
2498
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}/messages",
2499
- ...options
2500
- });
2501
- }
2502
- /**
2503
- * Add a user message
2504
- *
2505
- * Saves a user message to the session. When autoGenerate is enabled on the session and no generation is currently in progress, generation is triggered automatically and the response mirrors GenerateSessionResponse. Otherwise returns the saved user message.
2506
- *
2507
- */
2508
- static addSessionMessage(options) {
2509
- return (options.client ?? client).post({
2510
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}/messages",
2511
- ...options,
2512
- headers: {
2513
- "Content-Type": "application/json",
2514
- ...options.headers
2515
- }
2516
- });
2517
- }
2518
- /**
2519
- * Trigger agent generation
2520
- *
2521
- * Triggers the agent to generate a response based on the current conversation. Returns the assistant reply or a requires_action status if the agent needs client tool outputs. Pass ?async=true for a 202 accepted response when you do not need to wait for the result.
2522
- *
2523
- */
2524
- static generateSessionResponse(options) {
2525
- return (options.client ?? client).post({
2526
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}/generate",
2527
- ...options,
2528
- headers: {
2529
- "Content-Type": "application/json",
2530
- ...options.headers
2531
- }
2532
- });
2533
- }
2534
- /**
2535
- * Submit tool outputs
2536
- *
2537
- * Submits client tool outputs for a generation that returned requires_action. The agent continues its loop and returns the final or next requires_action result.
2538
- *
2539
- */
2540
- static submitSessionToolOutputs(options) {
2541
- return (options.client ?? client).post({
2542
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}/tool-outputs",
2543
- ...options,
2544
- headers: {
2545
- "Content-Type": "application/json",
2546
- ...options.headers
2547
- }
2548
- });
2549
- }
2550
- /**
2551
- * Get session tags
2552
- *
2553
- * Returns the session's tags object.
2554
- */
2555
- static getSessionTags(options) {
2556
- return (options.client ?? client).get({
2557
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}/tags",
2558
- ...options
2559
- });
2560
- }
2561
- /**
2562
- * Merge session tags
2563
- *
2564
- * Merges the provided tags into the session's existing tags.
2565
- */
2566
- static mergeSessionTags(options) {
2567
- return (options.client ?? client).patch({
2568
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}/tags",
2569
- ...options,
2570
- headers: {
2571
- "Content-Type": "application/json",
2572
- ...options.headers
2573
- }
2574
- });
2575
- }
2576
- /**
2577
- * Replace session tags
2578
- *
2579
- * Replaces all tags on the session.
2580
- */
2581
- static replaceSessionTags(options) {
2582
- return (options.client ?? client).put({
2583
- url: "/api/v1/agents/{agent_id}/sessions/{session_id}/tags",
2584
- ...options,
2585
- headers: {
2586
- "Content-Type": "application/json",
2587
- ...options.headers
2588
- }
2589
- });
2590
- }
2591
- };
2592
- var Tools = class {
2593
- static {
2594
- __name(this, "Tools");
2595
- }
2596
- /**
2597
- * List tools
2598
- *
2599
- * Returns all tools in the project.
2600
- */
2601
- static listTools(options) {
2602
- return (options?.client ?? client).get({
2603
- url: "/api/v1/tools",
2604
- ...options
2605
- });
2606
- }
2607
- /**
2608
- * Create a tool
2609
- *
2610
- * Creates a new tool in the project.
2611
- */
2612
- static createTool(options) {
2613
- return (options.client ?? client).post({
2614
- url: "/api/v1/tools",
2615
- ...options,
2616
- headers: {
2617
- "Content-Type": "application/json",
2618
- ...options.headers
2619
- }
2620
- });
2621
- }
2622
- /**
2623
- * Delete a tool
2624
- *
2625
- * Deletes a tool by ID.
2626
- */
2627
- static deleteTool(options) {
2628
- return (options.client ?? client).delete({
2629
- url: "/api/v1/tools/{tool_id}",
2630
- ...options
2631
- });
2632
- }
2633
- /**
2634
- * Get a tool
2635
- *
2636
- * Returns a single tool by ID.
2637
- */
2638
- static getTool(options) {
2639
- return (options.client ?? client).get({
2640
- url: "/api/v1/tools/{tool_id}",
2641
- ...options
2642
- });
2643
- }
2644
- /**
2645
- * Update a tool
2646
- *
2647
- * Updates an existing tool.
2648
- */
2649
- static updateTool(options) {
2650
- return (options.client ?? client).patch({
2651
- url: "/api/v1/tools/{tool_id}",
2652
- ...options,
2653
- headers: {
2654
- "Content-Type": "application/json",
2655
- ...options.headers
2656
- }
2657
- });
2658
- }
2659
- /**
2660
- * Call a tool
2661
- *
2662
- * Directly invokes a tool and returns its output. Supported for `http`, `soat`, and `mcp` tools. `client` tools cannot be invoked server-side and will return 422.
2663
- * For `soat` and `mcp` tools the `action` field is required and identifies which action (SOAT) or tool name (MCP) to invoke. For `http` tools `action` is ignored.
2664
- * `preset_parameters` stored on the tool are merged with the caller-supplied `input` before execution; preset keys take lower precedence.
2665
- *
2666
- */
2667
- static callTool(options) {
2668
- return (options.client ?? client).post({
2669
- url: "/api/v1/tools/{tool_id}/call",
2670
- ...options,
2671
- headers: {
2672
- "Content-Type": "application/json",
2673
- ...options.headers
2674
- }
2675
- });
2676
- }
2677
- };
2678
- var Traces = class {
2679
- static {
2680
- __name(this, "Traces");
2681
- }
2682
- /**
2683
- * List traces
2684
- *
2685
- * Returns a paginated list of execution traces for the project.
2686
- */
2687
- static listTraces(options) {
2688
- return (options?.client ?? client).get({
2689
- url: "/api/v1/traces",
2690
- ...options
2691
- });
2692
- }
2693
- /**
2694
- * Get a trace
2695
- *
2696
- * Returns a single trace by ID.
2697
- */
2698
- static getTrace(options) {
2699
- return (options.client ?? client).get({
2700
- url: "/api/v1/traces/{trace_id}",
2701
- ...options
2702
- });
2703
- }
2704
- /**
2705
- * Get trace tree
2706
- *
2707
- * Returns the full execution tree rooted at the given trace (or its root if the given trace is a child). Each node represents one agent's execution session. The `children` array contains traces triggered by sub-agent tool calls from that trace.
2708
- *
2709
- */
2710
- static getTraceTree(options) {
2711
- return (options.client ?? client).get({
2712
- url: "/api/v1/traces/{trace_id}/tree",
2713
- ...options
2714
- });
2715
- }
2716
- /**
2717
- * Get generation IDs for a trace
2718
- *
2719
- * Returns all generation IDs associated with the trace.
2720
- */
2721
- static getTraceGenerations(options) {
2722
- return (options.client ?? client).get({
2723
- url: "/api/v1/traces/{trace_id}/generations",
2724
- ...options
2725
- });
2726
- }
2727
- };
2728
- var Users = class {
2729
- static {
2730
- __name(this, "Users");
2731
- }
2732
- /**
2733
- * List all users
2734
- *
2735
- * Returns a list of all users
2736
- */
2737
- static listUsers(options) {
2738
- return (options?.client ?? client).get({
2739
- url: "/api/v1/users",
2740
- ...options
2741
- });
2742
- }
2743
- /**
2744
- * Create a user
2745
- *
2746
- * Creates a new user in the system
2747
- */
2748
- static createUser(options) {
2749
- return (options.client ?? client).post({
2750
- url: "/api/v1/users",
2751
- ...options,
2752
- headers: {
2753
- "Content-Type": "application/json",
2754
- ...options.headers
2755
- }
2756
- });
2757
- }
2758
- /**
2759
- * Delete a user by ID
2760
- *
2761
- * Deletes a specific user
2762
- */
2763
- static deleteUser(options) {
2764
- return (options.client ?? client).delete({
2765
- url: "/api/v1/users/{user_id}",
2766
- ...options
2767
- });
2768
- }
2769
- /**
2770
- * Get a user by ID
2771
- *
2772
- * Returns the data of a specific user
2773
- */
2774
- static getUser(options) {
2775
- return (options.client ?? client).get({
2776
- url: "/api/v1/users/{user_id}",
2777
- ...options
2778
- });
2779
- }
2780
- /**
2781
- * Create the first admin user
2782
- *
2783
- * Creates the first admin user. Returns 409 if any user already exists.
2784
- */
2785
- static bootstrapUser(options) {
2786
- return (options.client ?? client).post({
2787
- url: "/api/v1/users/bootstrap",
2788
- ...options,
2789
- headers: {
2790
- "Content-Type": "application/json",
2791
- ...options.headers
2792
- }
2793
- });
2794
- }
2795
- /**
2796
- * Login user
2797
- *
2798
- * Authenticates a user and returns a JWT token
2799
- */
2800
- static loginUser(options) {
2801
- return (options.client ?? client).post({
2802
- url: "/api/v1/users/login",
2803
- ...options,
2804
- headers: {
2805
- "Content-Type": "application/json",
2806
- ...options.headers
2807
- }
2808
- });
2809
- }
2810
- /**
2811
- * Get policies attached to a user
2812
- *
2813
- * Returns the list of policies attached to a user. Requires admin role.
2814
- */
2815
- static getUserPolicies(options) {
2816
- return (options.client ?? client).get({
2817
- url: "/api/v1/users/{user_id}/policies",
2818
- ...options
2819
- });
2820
- }
2821
- /**
2822
- * Attach policies to a user
2823
- *
2824
- * Replaces the user's policy list with the provided policy IDs. Requires admin role.
2825
- */
2826
- static attachUserPolicies(options) {
2827
- return (options.client ?? client).put({
2828
- url: "/api/v1/users/{user_id}/policies",
2829
- ...options,
2830
- headers: {
2831
- "Content-Type": "application/json",
2832
- ...options.headers
2833
- }
2834
- });
2835
- }
2836
- };
2837
- var Webhooks = class {
2838
- static {
2839
- __name(this, "Webhooks");
2840
- }
2841
- /**
2842
- * List webhooks for a project
2843
- *
2844
- * Lists all webhooks configured for the specified project
2845
- */
2846
- static listWebhooks(options) {
2847
- return (options.client ?? client).get({
2848
- url: "/api/v1/projects/{project_id}/webhooks",
2849
- ...options
2850
- });
2851
- }
2852
- /**
2853
- * Create a webhook
2854
- *
2855
- * Creates a new webhook for the specified project
2856
- */
2857
- static createWebhook(options) {
2858
- return (options.client ?? client).post({
2859
- url: "/api/v1/projects/{project_id}/webhooks",
2860
- ...options,
2861
- headers: {
2862
- "Content-Type": "application/json",
2863
- ...options.headers
2864
- }
2865
- });
2866
- }
2867
- /**
2868
- * Delete a webhook
2869
- *
2870
- * Deletes a webhook and stops all event deliveries
2871
- */
2872
- static deleteWebhook(options) {
2873
- return (options.client ?? client).delete({
2874
- url: "/api/v1/projects/{project_id}/webhooks/{webhook_id}",
2875
- ...options
2876
- });
2877
- }
2878
- /**
2879
- * Get a webhook
2880
- *
2881
- * Retrieves the details of a specific webhook
2882
- */
2883
- static getWebhook(options) {
2884
- return (options.client ?? client).get({
2885
- url: "/api/v1/projects/{project_id}/webhooks/{webhook_id}",
2886
- ...options
2887
- });
2888
- }
2889
- /**
2890
- * Update a webhook
2891
- *
2892
- * Updates an existing webhook's configuration
2893
- */
2894
- static updateWebhook(options) {
2895
- return (options.client ?? client).put({
2896
- url: "/api/v1/projects/{project_id}/webhooks/{webhook_id}",
2897
- ...options,
2898
- headers: {
2899
- "Content-Type": "application/json",
2900
- ...options.headers
2901
- }
2902
- });
2903
- }
2904
- /**
2905
- * List deliveries for a webhook
2906
- *
2907
- * Lists all event deliveries for a specific webhook
2908
- */
2909
- static listWebhookDeliveries(options) {
2910
- return (options.client ?? client).get({
2911
- url: "/api/v1/projects/{project_id}/webhooks/{webhook_id}/deliveries",
2912
- ...options
2913
- });
2914
- }
2915
- /**
2916
- * Get a delivery
2917
- *
2918
- * Retrieves the details of a specific webhook delivery
2919
- */
2920
- static getWebhookDelivery(options) {
2921
- return (options.client ?? client).get({
2922
- url: "/api/v1/projects/{project_id}/webhooks/{webhook_id}/deliveries/{delivery_id}",
2923
- ...options
2924
- });
2925
- }
2926
- /**
2927
- * Get webhook secret
2928
- *
2929
- * Retrieves the signing secret for the specified webhook
2930
- */
2931
- static getWebhookSecret(options) {
2932
- return (options.client ?? client).get({
2933
- url: "/api/v1/projects/{project_id}/webhooks/{webhook_id}/secret",
2934
- ...options
2935
- });
2936
- }
2937
- /**
2938
- * Rotate webhook secret
2939
- *
2940
- * Rotates the secret key for the specified webhook
2941
- */
2942
- static rotateWebhookSecret(options) {
2943
- return (options.client ?? client).post({
2944
- url: "/api/v1/projects/{project_id}/webhooks/{webhook_id}/rotate-secret",
2945
- ...options
2946
- });
2947
- }
2948
- };
2949
-
2950
- // src/soatClient.ts
2951
- var bindResource = /* @__PURE__ */__name((SdkClass, client2) => {
2952
- return new Proxy(SdkClass, {
2953
- get: /* @__PURE__ */__name((target, prop) => {
2954
- const value = target[prop];
2955
- if (typeof value === "function") {
2956
- return options => {
2957
- return value({
2958
- ...options,
2959
- client: client2
2960
- });
2961
- };
2962
- }
2963
- return value;
2964
- }, "get")
2965
- });
2966
- }, "bindResource");
2967
- var SoatClient = class {
2968
- static {
2969
- __name(this, "SoatClient");
2970
- }
2971
- actors;
2972
- agents;
2973
- aiProviders;
2974
- apiKeys;
2975
- chats;
2976
- conversations;
2977
- documents;
2978
- files;
2979
- formations;
2980
- knowledge;
2981
- memories;
2982
- memoryEntries;
2983
- policies;
2984
- projects;
2985
- secrets;
2986
- sessions;
2987
- tools;
2988
- traces;
2989
- users;
2990
- webhooks;
2991
- constructor({
2992
- baseUrl,
2993
- token,
2994
- headers
2995
- } = {}) {
2996
- const authHeaders = token ? {
2997
- Authorization: `Bearer ${token}`
2998
- } : {};
2999
- const httpClient = createClient(createConfig({
3000
- baseUrl: baseUrl ?? "",
3001
- headers: {
3002
- ...authHeaders,
3003
- ...headers
3004
- }
3005
- }));
3006
- this.actors = bindResource(Actors, httpClient);
3007
- this.agents = bindResource(Agents, httpClient);
3008
- this.aiProviders = bindResource(AiProviders, httpClient);
3009
- this.apiKeys = bindResource(ApiKeys, httpClient);
3010
- this.chats = bindResource(Chats, httpClient);
3011
- this.conversations = bindResource(Conversations, httpClient);
3012
- this.documents = bindResource(Documents, httpClient);
3013
- this.files = bindResource(Files, httpClient);
3014
- this.formations = bindResource(Formations, httpClient);
3015
- this.knowledge = bindResource(Knowledge, httpClient);
3016
- this.memories = bindResource(Memories, httpClient);
3017
- this.memoryEntries = bindResource(MemoryEntries, httpClient);
3018
- this.policies = bindResource(Policies, httpClient);
3019
- this.projects = bindResource(Projects, httpClient);
3020
- this.secrets = bindResource(Secrets, httpClient);
3021
- this.sessions = bindResource(Sessions, httpClient);
3022
- this.tools = bindResource(Tools, httpClient);
3023
- this.traces = bindResource(Traces, httpClient);
3024
- this.users = bindResource(Users, httpClient);
3025
- this.webhooks = bindResource(Webhooks, httpClient);
3026
- }
3027
- };
3028
- // Annotate the CommonJS export names for ESM import in node:
3029
- 0 && (module.exports = {
3030
- Actors,
3031
- Agents,
3032
- AiProviders,
3033
- ApiKeys,
3034
- Chats,
3035
- Conversations,
3036
- Documents,
3037
- Files,
3038
- Formations,
3039
- Knowledge,
3040
- Memories,
3041
- MemoryEntries,
3042
- Orchestrations,
3043
- Policies,
3044
- Projects,
3045
- Secrets,
3046
- Sessions,
3047
- SoatClient,
3048
- Tools,
3049
- Traces,
3050
- Users,
3051
- Webhooks,
3052
- createClient,
3053
- createConfig
3054
- });