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