@soat/sdk 0.3.4 → 0.4.4

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