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