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