@soat/sdk 0.3.3 → 0.4.3

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