@seclai/sdk 1.0.6 → 1.1.0
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/README.md +424 -64
- package/dist/index.cjs +1573 -165
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4707 -428
- package/dist/index.d.ts +4707 -428
- package/dist/index.js +1571 -164
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,7 +25,8 @@ __export(index_exports, {
|
|
|
25
25
|
SeclaiAPIStatusError: () => SeclaiAPIStatusError,
|
|
26
26
|
SeclaiAPIValidationError: () => SeclaiAPIValidationError,
|
|
27
27
|
SeclaiConfigurationError: () => SeclaiConfigurationError,
|
|
28
|
-
SeclaiError: () => SeclaiError
|
|
28
|
+
SeclaiError: () => SeclaiError,
|
|
29
|
+
SeclaiStreamingError: () => SeclaiStreamingError
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(index_exports);
|
|
31
32
|
|
|
@@ -69,6 +70,15 @@ var SeclaiAPIValidationError = class extends SeclaiAPIStatusError {
|
|
|
69
70
|
this.validationError = opts.validationError;
|
|
70
71
|
}
|
|
71
72
|
};
|
|
73
|
+
var SeclaiStreamingError = class extends SeclaiError {
|
|
74
|
+
/** The run ID associated with the failed stream, when available. */
|
|
75
|
+
runId;
|
|
76
|
+
constructor(message, runId) {
|
|
77
|
+
super(message);
|
|
78
|
+
this.name = "SeclaiStreamingError";
|
|
79
|
+
this.runId = runId;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
72
82
|
|
|
73
83
|
// src/client.ts
|
|
74
84
|
var SECLAI_API_URL = "https://api.seclai.com";
|
|
@@ -153,6 +163,51 @@ function anySignal(signals) {
|
|
|
153
163
|
}
|
|
154
164
|
return controller.signal;
|
|
155
165
|
}
|
|
166
|
+
function toBlob(file, mimeType) {
|
|
167
|
+
if (file instanceof Blob) return file;
|
|
168
|
+
const opts = mimeType ? { type: mimeType } : void 0;
|
|
169
|
+
if (file instanceof ArrayBuffer) return new Blob([new Uint8Array(file)], opts);
|
|
170
|
+
return new Blob([file], opts);
|
|
171
|
+
}
|
|
172
|
+
var MIME_TYPES = {
|
|
173
|
+
txt: "text/plain",
|
|
174
|
+
html: "text/html",
|
|
175
|
+
htm: "text/html",
|
|
176
|
+
md: "text/markdown",
|
|
177
|
+
csv: "text/csv",
|
|
178
|
+
xml: "text/xml",
|
|
179
|
+
json: "application/json",
|
|
180
|
+
pdf: "application/pdf",
|
|
181
|
+
doc: "application/msword",
|
|
182
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
183
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
184
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
185
|
+
xls: "application/vnd.ms-excel",
|
|
186
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
187
|
+
msg: "application/vnd.ms-outlook",
|
|
188
|
+
zip: "application/zip",
|
|
189
|
+
epub: "application/epub+zip",
|
|
190
|
+
png: "image/png",
|
|
191
|
+
jpg: "image/jpeg",
|
|
192
|
+
jpeg: "image/jpeg",
|
|
193
|
+
gif: "image/gif",
|
|
194
|
+
bmp: "image/bmp",
|
|
195
|
+
tiff: "image/tiff",
|
|
196
|
+
webp: "image/webp",
|
|
197
|
+
mp3: "audio/mpeg",
|
|
198
|
+
wav: "audio/wav",
|
|
199
|
+
m4a: "audio/mp4",
|
|
200
|
+
flac: "audio/flac",
|
|
201
|
+
ogg: "audio/ogg",
|
|
202
|
+
mp4: "video/mp4",
|
|
203
|
+
mov: "video/quicktime",
|
|
204
|
+
avi: "video/x-msvideo"
|
|
205
|
+
};
|
|
206
|
+
function inferMimeType(fileName) {
|
|
207
|
+
if (!fileName) return void 0;
|
|
208
|
+
const ext = fileName.split(".").pop()?.toLowerCase();
|
|
209
|
+
return ext ? MIME_TYPES[ext] : void 0;
|
|
210
|
+
}
|
|
156
211
|
var Seclai = class {
|
|
157
212
|
apiKey;
|
|
158
213
|
baseUrl;
|
|
@@ -185,14 +240,17 @@ var Seclai = class {
|
|
|
185
240
|
this.defaultHeaders = { ...opts.defaultHeaders ?? {} };
|
|
186
241
|
this.fetcher = fetcher;
|
|
187
242
|
}
|
|
243
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
244
|
+
// Low-level request
|
|
245
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
188
246
|
/**
|
|
189
247
|
* Make a raw HTTP request to the Seclai API.
|
|
190
248
|
*
|
|
191
249
|
* This is a low-level escape hatch. For most operations, prefer the typed convenience methods.
|
|
192
250
|
*
|
|
193
251
|
* @param method - HTTP method (e.g. `"GET"`, `"POST"`).
|
|
194
|
-
|
|
195
|
-
* @param opts - Query params, JSON body,
|
|
252
|
+
* @param path - Request path relative to `baseUrl` (e.g. `"/sources/"`).
|
|
253
|
+
* @param opts - Query params, JSON body, per-request headers, and optional AbortSignal.
|
|
196
254
|
* @returns Parsed JSON for JSON responses, raw text for non-JSON responses, or `null` for empty bodies.
|
|
197
255
|
* @throws {@link SeclaiAPIValidationError} For validation errors (typically HTTP 422).
|
|
198
256
|
* @throws {@link SeclaiAPIStatusError} For other non-success HTTP status codes.
|
|
@@ -213,6 +271,9 @@ var Seclai = class {
|
|
|
213
271
|
if (body !== void 0) {
|
|
214
272
|
init.body = body;
|
|
215
273
|
}
|
|
274
|
+
if (opts?.signal) {
|
|
275
|
+
init.signal = opts.signal;
|
|
276
|
+
}
|
|
216
277
|
const response = await this.fetcher(url, init);
|
|
217
278
|
if (response.status === 204) return null;
|
|
218
279
|
const contentType = response.headers.get("content-type") ?? "";
|
|
@@ -245,23 +306,242 @@ var Seclai = class {
|
|
|
245
306
|
return await response.text();
|
|
246
307
|
}
|
|
247
308
|
/**
|
|
248
|
-
*
|
|
309
|
+
* Make a raw HTTP request and return the raw `Response` object (for binary downloads, etc.).
|
|
310
|
+
*
|
|
311
|
+
* @param method - HTTP method.
|
|
312
|
+
* @param path - Request path relative to `baseUrl`.
|
|
313
|
+
* @param opts - Query params, JSON body, per-request headers, and optional AbortSignal.
|
|
314
|
+
* @returns The raw `Response` object.
|
|
315
|
+
*/
|
|
316
|
+
async requestRaw(method, path, opts) {
|
|
317
|
+
const url = buildURL(this.baseUrl, path, opts?.query);
|
|
318
|
+
const headers = {
|
|
319
|
+
...this.defaultHeaders,
|
|
320
|
+
...opts?.headers ?? {},
|
|
321
|
+
[this.apiKeyHeader]: this.apiKey
|
|
322
|
+
};
|
|
323
|
+
let body;
|
|
324
|
+
if (opts?.json !== void 0) {
|
|
325
|
+
headers["content-type"] = headers["content-type"] ?? "application/json";
|
|
326
|
+
body = JSON.stringify(opts.json);
|
|
327
|
+
}
|
|
328
|
+
const init = { method, headers };
|
|
329
|
+
if (body !== void 0) init.body = body;
|
|
330
|
+
if (opts?.signal) init.signal = opts.signal;
|
|
331
|
+
const response = await this.fetcher(url, init);
|
|
332
|
+
if (!response.ok) {
|
|
333
|
+
const responseText = await safeText(response);
|
|
334
|
+
if (response.status === 422) {
|
|
335
|
+
const validation = await safeJson(response);
|
|
336
|
+
throw new SeclaiAPIValidationError({
|
|
337
|
+
message: "Validation error",
|
|
338
|
+
statusCode: response.status,
|
|
339
|
+
method,
|
|
340
|
+
url: url.toString(),
|
|
341
|
+
responseText,
|
|
342
|
+
validationError: validation
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
throw new SeclaiAPIStatusError({
|
|
346
|
+
message: `Request failed with status ${response.status}`,
|
|
347
|
+
statusCode: response.status,
|
|
348
|
+
method,
|
|
349
|
+
url: url.toString(),
|
|
350
|
+
responseText
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
return response;
|
|
354
|
+
}
|
|
355
|
+
/** Shared multipart upload helper. */
|
|
356
|
+
async uploadFile(path, opts) {
|
|
357
|
+
const url = buildURL(this.baseUrl, path);
|
|
358
|
+
const headers = {
|
|
359
|
+
...this.defaultHeaders,
|
|
360
|
+
[this.apiKeyHeader]: this.apiKey
|
|
361
|
+
};
|
|
362
|
+
delete headers["content-type"];
|
|
363
|
+
delete headers["Content-Type"];
|
|
364
|
+
const form = new FormData();
|
|
365
|
+
const mimeType = opts.mimeType ?? inferMimeType(opts.fileName);
|
|
366
|
+
const blob = toBlob(opts.file, mimeType);
|
|
367
|
+
form.set("file", blob, opts.fileName ?? "upload");
|
|
368
|
+
if (opts.title !== void 0) form.set("title", opts.title);
|
|
369
|
+
if (opts.metadata !== void 0) form.set("metadata", JSON.stringify(opts.metadata));
|
|
370
|
+
const init = { method: "POST", headers, body: form };
|
|
371
|
+
if (opts.signal) init.signal = opts.signal;
|
|
372
|
+
const response = await this.fetcher(url, init);
|
|
373
|
+
if (!response.ok) {
|
|
374
|
+
const responseText = await safeText(response);
|
|
375
|
+
if (response.status === 422) {
|
|
376
|
+
const validation = await safeJson(response);
|
|
377
|
+
throw new SeclaiAPIValidationError({
|
|
378
|
+
message: "Validation error",
|
|
379
|
+
statusCode: response.status,
|
|
380
|
+
method: "POST",
|
|
381
|
+
url: url.toString(),
|
|
382
|
+
responseText,
|
|
383
|
+
validationError: validation
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
throw new SeclaiAPIStatusError({
|
|
387
|
+
message: `Request failed with status ${response.status}`,
|
|
388
|
+
statusCode: response.status,
|
|
389
|
+
method: "POST",
|
|
390
|
+
url: url.toString(),
|
|
391
|
+
responseText
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return await response.json();
|
|
395
|
+
}
|
|
396
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
397
|
+
// Agents — CRUD
|
|
398
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
399
|
+
/**
|
|
400
|
+
* List agents.
|
|
401
|
+
*
|
|
402
|
+
* @param opts - Pagination options.
|
|
403
|
+
* @returns Paginated list of agents.
|
|
404
|
+
*/
|
|
405
|
+
async listAgents(opts = {}) {
|
|
406
|
+
return await this.request("GET", "/agents", {
|
|
407
|
+
query: { page: opts.page, limit: opts.limit }
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Create a new agent.
|
|
412
|
+
*
|
|
413
|
+
* @param body - Agent creation payload (name, trigger type, template, etc.).
|
|
414
|
+
* @returns Summary of the created agent.
|
|
415
|
+
*/
|
|
416
|
+
async createAgent(body) {
|
|
417
|
+
return await this.request("POST", "/agents", { json: body });
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Get agent details including its definition.
|
|
421
|
+
*
|
|
422
|
+
* @param agentId - Agent identifier.
|
|
423
|
+
* @returns Full agent metadata.
|
|
424
|
+
*/
|
|
425
|
+
async getAgent(agentId) {
|
|
426
|
+
return await this.request("GET", `/agents/${agentId}`);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Update an agent.
|
|
430
|
+
*
|
|
431
|
+
* @param agentId - Agent identifier.
|
|
432
|
+
* @param body - Fields to update.
|
|
433
|
+
* @returns Updated agent summary.
|
|
434
|
+
*/
|
|
435
|
+
async updateAgent(agentId, body) {
|
|
436
|
+
return await this.request("PUT", `/agents/${agentId}`, { json: body });
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Delete an agent.
|
|
440
|
+
*
|
|
441
|
+
* @param agentId - Agent identifier.
|
|
442
|
+
*/
|
|
443
|
+
async deleteAgent(agentId) {
|
|
444
|
+
await this.request("DELETE", `/agents/${agentId}`);
|
|
445
|
+
}
|
|
446
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
447
|
+
// Agent Definitions
|
|
448
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
449
|
+
/**
|
|
450
|
+
* Get an agent's full definition (steps, model config, etc.).
|
|
451
|
+
*
|
|
452
|
+
* @param agentId - Agent identifier.
|
|
453
|
+
* @returns The agent definition.
|
|
454
|
+
*/
|
|
455
|
+
async getAgentDefinition(agentId) {
|
|
456
|
+
return await this.request("GET", `/agents/${agentId}/definition`);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Update an agent's definition.
|
|
249
460
|
*
|
|
250
461
|
* @param agentId - Agent identifier.
|
|
251
|
-
* @param body -
|
|
462
|
+
* @param body - Updated definition payload.
|
|
463
|
+
* @returns Updated agent definition.
|
|
464
|
+
*/
|
|
465
|
+
async updateAgentDefinition(agentId, body) {
|
|
466
|
+
return await this.request("PUT", `/agents/${agentId}/definition`, { json: body });
|
|
467
|
+
}
|
|
468
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
469
|
+
// Agent Runs
|
|
470
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
471
|
+
/**
|
|
472
|
+
* Start an agent run.
|
|
473
|
+
*
|
|
474
|
+
* @param agentId - Agent identifier.
|
|
475
|
+
* @param body - Run request payload (`input`, `metadata`, `priority`, etc.).
|
|
252
476
|
* @returns The created agent run.
|
|
253
477
|
*/
|
|
254
478
|
async runAgent(agentId, body) {
|
|
255
|
-
|
|
256
|
-
|
|
479
|
+
return await this.request("POST", `/agents/${agentId}/runs`, { json: body });
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* List runs for a specific agent.
|
|
483
|
+
*
|
|
484
|
+
* @param agentId - Agent identifier.
|
|
485
|
+
* @param opts - Pagination and filter options.
|
|
486
|
+
* @returns Paginated list of runs.
|
|
487
|
+
*/
|
|
488
|
+
async listAgentRuns(agentId, opts = {}) {
|
|
489
|
+
return await this.request("GET", `/agents/${agentId}/runs`, {
|
|
490
|
+
query: { page: opts.page, limit: opts.limit, status: opts.status }
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Search agent runs (traces) across all agents.
|
|
495
|
+
*
|
|
496
|
+
* @param body - Search query and filters.
|
|
497
|
+
* @returns Search results with matching runs.
|
|
498
|
+
*/
|
|
499
|
+
async searchAgentRuns(body) {
|
|
500
|
+
return await this.request("POST", "/agents/runs/search", { json: body });
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Get details of a specific agent run.
|
|
504
|
+
*
|
|
505
|
+
* @param runId - Run identifier.
|
|
506
|
+
* @param opts - Optional flags.
|
|
507
|
+
* @returns Agent run details.
|
|
508
|
+
*/
|
|
509
|
+
async getAgentRun(runId, opts) {
|
|
510
|
+
return await this.request("GET", `/agents/runs/${runId}`, opts?.includeStepOutputs ? {
|
|
511
|
+
query: { include_step_outputs: true }
|
|
512
|
+
} : void 0);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Delete an agent run.
|
|
516
|
+
*
|
|
517
|
+
* @param runId - Run identifier.
|
|
518
|
+
*/
|
|
519
|
+
async deleteAgentRun(runId) {
|
|
520
|
+
await this.request("DELETE", `/agents/runs/${runId}`);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Cancel a running agent run.
|
|
524
|
+
*
|
|
525
|
+
* @param runId - Run identifier.
|
|
526
|
+
* @returns Updated run (with cancelled status).
|
|
527
|
+
*/
|
|
528
|
+
async cancelAgentRun(runId) {
|
|
529
|
+
return await this.request("POST", `/agents/runs/${runId}/cancel`);
|
|
257
530
|
}
|
|
531
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
532
|
+
// Agent Runs — Streaming
|
|
533
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
258
534
|
/**
|
|
259
|
-
* Run an agent in streaming mode (SSE) and
|
|
535
|
+
* Run an agent in streaming mode (SSE) and wait for the final result.
|
|
536
|
+
*
|
|
537
|
+
* Consumes the entire SSE stream and returns only the terminal `done` payload.
|
|
538
|
+
* For real-time event access, use {@link runStreamingAgent} instead.
|
|
260
539
|
*
|
|
261
540
|
* @param agentId - Agent identifier.
|
|
262
|
-
* @param body - Streaming
|
|
263
|
-
* @param opts -
|
|
541
|
+
* @param body - Streaming run request payload.
|
|
542
|
+
* @param opts - Timeout and abort signal options.
|
|
264
543
|
* @returns Final agent run payload from the `done` event.
|
|
544
|
+
* @throws {@link SeclaiStreamingError} If the stream ends before a `done` event.
|
|
265
545
|
*/
|
|
266
546
|
async runStreamingAgentAndWait(agentId, body, opts) {
|
|
267
547
|
const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
|
|
@@ -279,12 +559,9 @@ var Seclai = class {
|
|
|
279
559
|
timeoutController.abort();
|
|
280
560
|
}, timeoutMs);
|
|
281
561
|
const signal = anySignal([opts?.signal, timeoutController.signal]);
|
|
562
|
+
let lastSeen;
|
|
282
563
|
try {
|
|
283
|
-
const init = {
|
|
284
|
-
method: "POST",
|
|
285
|
-
headers,
|
|
286
|
-
body: JSON.stringify(body)
|
|
287
|
-
};
|
|
564
|
+
const init = { method: "POST", headers, body: JSON.stringify(body) };
|
|
288
565
|
if (signal) init.signal = signal;
|
|
289
566
|
const response = await this.fetcher(url, init);
|
|
290
567
|
const contentType = response.headers.get("content-type") ?? "";
|
|
@@ -321,16 +598,13 @@ var Seclai = class {
|
|
|
321
598
|
const reader = response.body.getReader();
|
|
322
599
|
const decoder = new TextDecoder();
|
|
323
600
|
let final;
|
|
324
|
-
let lastSeen;
|
|
325
601
|
const parser = createSseParser((msg) => {
|
|
326
602
|
if (!msg.data) return;
|
|
327
603
|
if (msg.event === "init" || msg.event === "done") {
|
|
328
604
|
try {
|
|
329
605
|
const parsed = JSON.parse(msg.data);
|
|
330
606
|
lastSeen = parsed;
|
|
331
|
-
if (msg.event === "done")
|
|
332
|
-
final = parsed;
|
|
333
|
-
}
|
|
607
|
+
if (msg.event === "done") final = parsed;
|
|
334
608
|
} catch {
|
|
335
609
|
}
|
|
336
610
|
}
|
|
@@ -345,188 +619,1321 @@ var Seclai = class {
|
|
|
345
619
|
if (lastSeen && lastSeen.status && lastSeen.status !== "pending") {
|
|
346
620
|
return lastSeen;
|
|
347
621
|
}
|
|
348
|
-
throw new
|
|
622
|
+
throw new SeclaiStreamingError("Stream ended before receiving a 'done' event.", lastSeen?.run_id);
|
|
623
|
+
} catch (err) {
|
|
624
|
+
if (timedOut) {
|
|
625
|
+
throw new SeclaiStreamingError(
|
|
626
|
+
`Timed out after ${timeoutMs}ms waiting for streaming agent run to complete.`,
|
|
627
|
+
lastSeen?.run_id
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
throw err;
|
|
631
|
+
} finally {
|
|
632
|
+
clearTimeout(timeoutId);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Run an agent in streaming mode and yield each SSE event as it arrives.
|
|
637
|
+
*
|
|
638
|
+
* This is an `AsyncGenerator` suitable for real-time UIs that want to render
|
|
639
|
+
* step progress as it happens.
|
|
640
|
+
*
|
|
641
|
+
* @param agentId - Agent identifier.
|
|
642
|
+
* @param body - Streaming run request payload.
|
|
643
|
+
* @param opts - Timeout and abort signal options.
|
|
644
|
+
* @yields {@link AgentRunEvent} for each SSE message.
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
* ```ts
|
|
648
|
+
* for await (const event of client.runStreamingAgent("agent-id", { input: "Hello!" })) {
|
|
649
|
+
* if (event.event === "done") {
|
|
650
|
+
* console.log("Final:", event.data);
|
|
651
|
+
* }
|
|
652
|
+
* }
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
async *runStreamingAgent(agentId, body, opts) {
|
|
656
|
+
const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
|
|
657
|
+
const headers = {
|
|
658
|
+
...this.defaultHeaders,
|
|
659
|
+
[this.apiKeyHeader]: this.apiKey,
|
|
660
|
+
accept: "text/event-stream",
|
|
661
|
+
"content-type": "application/json"
|
|
662
|
+
};
|
|
663
|
+
const timeoutMs = opts?.timeoutMs ?? 6e4;
|
|
664
|
+
const timeoutController = new AbortController();
|
|
665
|
+
let timedOut = false;
|
|
666
|
+
const timeoutId = setTimeout(() => {
|
|
667
|
+
timedOut = true;
|
|
668
|
+
timeoutController.abort();
|
|
669
|
+
}, timeoutMs);
|
|
670
|
+
const signal = anySignal([opts?.signal, timeoutController.signal]);
|
|
671
|
+
try {
|
|
672
|
+
const init = { method: "POST", headers, body: JSON.stringify(body) };
|
|
673
|
+
if (signal) init.signal = signal;
|
|
674
|
+
const response = await this.fetcher(url, init);
|
|
675
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
676
|
+
const isJson = contentType.includes("application/json");
|
|
677
|
+
if (!response.ok) {
|
|
678
|
+
const responseText = await safeText(response);
|
|
679
|
+
if (response.status === 422) {
|
|
680
|
+
const validation = await safeJson(response);
|
|
681
|
+
throw new SeclaiAPIValidationError({
|
|
682
|
+
message: "Validation error",
|
|
683
|
+
statusCode: response.status,
|
|
684
|
+
method: "POST",
|
|
685
|
+
url: url.toString(),
|
|
686
|
+
responseText,
|
|
687
|
+
validationError: validation
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
throw new SeclaiAPIStatusError({
|
|
691
|
+
message: `Request failed with status ${response.status}`,
|
|
692
|
+
statusCode: response.status,
|
|
693
|
+
method: "POST",
|
|
694
|
+
url: url.toString(),
|
|
695
|
+
responseText
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
if (isJson) {
|
|
699
|
+
const data = await response.json();
|
|
700
|
+
yield { event: "done", data };
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
if (!response.body) {
|
|
704
|
+
throw new SeclaiConfigurationError(
|
|
705
|
+
"Streaming response body is not available in this environment."
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
const reader = response.body.getReader();
|
|
709
|
+
const decoder = new TextDecoder();
|
|
710
|
+
const events = [];
|
|
711
|
+
const parser = createSseParser((msg) => {
|
|
712
|
+
if (!msg.data) return;
|
|
713
|
+
let data;
|
|
714
|
+
try {
|
|
715
|
+
data = JSON.parse(msg.data);
|
|
716
|
+
} catch {
|
|
717
|
+
data = msg.data;
|
|
718
|
+
}
|
|
719
|
+
events.push({ event: msg.event ?? "message", data });
|
|
720
|
+
});
|
|
721
|
+
while (true) {
|
|
722
|
+
const { value, done } = await reader.read();
|
|
723
|
+
if (value) parser.feed(decoder.decode(value, { stream: true }));
|
|
724
|
+
while (events.length > 0) {
|
|
725
|
+
yield events.shift();
|
|
726
|
+
}
|
|
727
|
+
if (done) break;
|
|
728
|
+
}
|
|
729
|
+
parser.end();
|
|
730
|
+
while (events.length > 0) {
|
|
731
|
+
yield events.shift();
|
|
732
|
+
}
|
|
349
733
|
} catch (err) {
|
|
350
734
|
if (timedOut) {
|
|
351
|
-
throw new
|
|
735
|
+
throw new SeclaiStreamingError(
|
|
736
|
+
`Timed out after ${timeoutMs}ms waiting for streaming agent run to complete.`
|
|
737
|
+
);
|
|
352
738
|
}
|
|
353
739
|
throw err;
|
|
354
740
|
} finally {
|
|
355
741
|
clearTimeout(timeoutId);
|
|
356
742
|
}
|
|
357
743
|
}
|
|
744
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
745
|
+
// Agent Runs — Polling
|
|
746
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
747
|
+
/**
|
|
748
|
+
* Run an agent and poll until it reaches a terminal status.
|
|
749
|
+
*
|
|
750
|
+
* This is useful in environments where SSE streaming is unavailable.
|
|
751
|
+
*
|
|
752
|
+
* @param agentId - Agent identifier.
|
|
753
|
+
* @param body - Run request payload.
|
|
754
|
+
* @param opts - Polling configuration and abort signal.
|
|
755
|
+
* @returns The terminal agent run.
|
|
756
|
+
* @throws {@link SeclaiStreamingError} On timeout.
|
|
757
|
+
*/
|
|
758
|
+
async runAgentAndPoll(agentId, body, opts) {
|
|
759
|
+
const pollInterval = opts?.pollIntervalMs ?? 2e3;
|
|
760
|
+
const timeout = opts?.timeoutMs ?? 3e5;
|
|
761
|
+
const startTime = Date.now();
|
|
762
|
+
const run = await this.runAgent(agentId, body);
|
|
763
|
+
const runId = run.id ?? run.run_id;
|
|
764
|
+
if (!runId) throw new SeclaiError("Agent run response did not contain an id.");
|
|
765
|
+
while (true) {
|
|
766
|
+
if (opts?.signal?.aborted) throw new SeclaiError("Polling aborted.");
|
|
767
|
+
if (Date.now() - startTime > timeout) {
|
|
768
|
+
throw new SeclaiStreamingError(`Polling timed out after ${timeout}ms.`, runId);
|
|
769
|
+
}
|
|
770
|
+
await new Promise((r) => setTimeout(r, pollInterval));
|
|
771
|
+
const current = await this.getAgentRun(
|
|
772
|
+
runId,
|
|
773
|
+
opts?.includeStepOutputs ? { includeStepOutputs: true } : void 0
|
|
774
|
+
);
|
|
775
|
+
const status = current.status;
|
|
776
|
+
if (status === "completed" || status === "failed" || status === "cancelled") {
|
|
777
|
+
return current;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
782
|
+
// Agent Run Evaluation Results
|
|
783
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
358
784
|
/**
|
|
359
|
-
* List
|
|
785
|
+
* List evaluation results for a specific agent run.
|
|
360
786
|
*
|
|
361
787
|
* @param agentId - Agent identifier.
|
|
788
|
+
* @param runId - Run identifier.
|
|
362
789
|
* @param opts - Pagination options.
|
|
363
|
-
* @returns
|
|
790
|
+
* @returns Paginated list of evaluation results.
|
|
364
791
|
*/
|
|
365
|
-
async
|
|
366
|
-
|
|
367
|
-
query: { page: opts.page
|
|
792
|
+
async listRunEvaluationResults(agentId, runId, opts = {}) {
|
|
793
|
+
return await this.request("GET", `/agents/${agentId}/runs/${runId}/evaluation-results`, {
|
|
794
|
+
query: { page: opts.page, limit: opts.limit }
|
|
368
795
|
});
|
|
369
|
-
return data;
|
|
370
796
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
797
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
798
|
+
// Agent Input Uploads
|
|
799
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
800
|
+
/**
|
|
801
|
+
* Upload a file to use as input for a `dynamic_input` agent run.
|
|
802
|
+
*
|
|
803
|
+
* After uploading, poll {@link getAgentInputUploadStatus} until `status` is `ready`,
|
|
804
|
+
* then pass `input_upload_id` to {@link runAgent}.
|
|
805
|
+
*
|
|
806
|
+
* @param agentId - Agent identifier.
|
|
807
|
+
* @param opts - File payload and optional metadata.
|
|
808
|
+
* @returns Upload response with the upload ID and status.
|
|
809
|
+
*/
|
|
810
|
+
async uploadAgentInput(agentId, opts) {
|
|
811
|
+
return await this.uploadFile(`/agents/${agentId}/upload-input`, opts);
|
|
381
812
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
813
|
+
/**
|
|
814
|
+
* Get the status of an agent input upload.
|
|
815
|
+
*
|
|
816
|
+
* @param agentId - Agent identifier.
|
|
817
|
+
* @param uploadId - Upload identifier.
|
|
818
|
+
* @returns Upload status and metadata.
|
|
819
|
+
*/
|
|
820
|
+
async getAgentInputUploadStatus(agentId, uploadId) {
|
|
821
|
+
return await this.request("GET", `/agents/${agentId}/input-uploads/${uploadId}`);
|
|
386
822
|
}
|
|
823
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
824
|
+
// Agent AI Assistant (Steps Generation)
|
|
825
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
387
826
|
/**
|
|
388
|
-
*
|
|
827
|
+
* Generate agent workflow steps from natural language using AI.
|
|
389
828
|
*
|
|
390
|
-
*
|
|
829
|
+
* @param agentId - Agent identifier.
|
|
830
|
+
* @param body - Generation request with user instructions.
|
|
831
|
+
* @returns AI-generated step configuration.
|
|
832
|
+
*/
|
|
833
|
+
async generateAgentSteps(agentId, body) {
|
|
834
|
+
return await this.request("POST", `/agents/${agentId}/ai-assistant/generate-steps`, { json: body });
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Generate a single step configuration using AI.
|
|
391
838
|
*
|
|
392
|
-
* @param
|
|
393
|
-
* @param
|
|
394
|
-
* @returns
|
|
839
|
+
* @param agentId - Agent identifier.
|
|
840
|
+
* @param body - Step config generation request.
|
|
841
|
+
* @returns AI-generated step config.
|
|
395
842
|
*/
|
|
396
|
-
async
|
|
397
|
-
|
|
398
|
-
"GET",
|
|
399
|
-
`/contents/${sourceConnectionContentVersion}`,
|
|
400
|
-
{ query: { start: opts.start ?? 0, end: opts.end ?? 5e3 } }
|
|
401
|
-
);
|
|
402
|
-
return data;
|
|
843
|
+
async generateStepConfig(agentId, body) {
|
|
844
|
+
return await this.request("POST", `/agents/${agentId}/ai-assistant/step-config`, { json: body });
|
|
403
845
|
}
|
|
404
846
|
/**
|
|
405
|
-
*
|
|
847
|
+
* Get AI conversation history for an agent.
|
|
406
848
|
*
|
|
407
|
-
* @param
|
|
849
|
+
* @param agentId - Agent identifier.
|
|
850
|
+
* @returns Conversation history.
|
|
408
851
|
*/
|
|
409
|
-
async
|
|
410
|
-
await this.request("
|
|
852
|
+
async getAgentAiConversationHistory(agentId) {
|
|
853
|
+
return await this.request("GET", `/agents/${agentId}/ai-assistant/conversations`);
|
|
411
854
|
}
|
|
412
855
|
/**
|
|
413
|
-
*
|
|
856
|
+
* Mark an AI suggestion as accepted or rejected.
|
|
414
857
|
*
|
|
415
|
-
* @param
|
|
416
|
-
* @param
|
|
417
|
-
* @
|
|
858
|
+
* @param agentId - Agent identifier.
|
|
859
|
+
* @param conversationId - Conversation turn identifier.
|
|
860
|
+
* @param body - Mark request payload.
|
|
418
861
|
*/
|
|
419
|
-
async
|
|
420
|
-
|
|
421
|
-
"GET",
|
|
422
|
-
`/contents/${sourceConnectionContentVersion}/embeddings`,
|
|
423
|
-
{ query: { page: opts.page ?? 1, limit: opts.limit ?? 20 } }
|
|
424
|
-
);
|
|
425
|
-
return data;
|
|
862
|
+
async markAgentAiSuggestion(agentId, conversationId, body) {
|
|
863
|
+
await this.request("PATCH", `/agents/${agentId}/ai-assistant/${conversationId}`, { json: body });
|
|
426
864
|
}
|
|
865
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
866
|
+
// Agent Evaluation Criteria
|
|
867
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
427
868
|
/**
|
|
428
|
-
* List
|
|
869
|
+
* List evaluation criteria for an agent.
|
|
429
870
|
*
|
|
430
|
-
* @param
|
|
431
|
-
* @
|
|
871
|
+
* @param agentId - Agent identifier.
|
|
872
|
+
* @param opts - Pagination options.
|
|
432
873
|
*/
|
|
433
|
-
async
|
|
434
|
-
|
|
435
|
-
query: {
|
|
436
|
-
page: opts.page ?? 1,
|
|
437
|
-
limit: opts.limit ?? 20,
|
|
438
|
-
sort: opts.sort ?? "created_at",
|
|
439
|
-
order: opts.order ?? "desc",
|
|
440
|
-
account_id: opts.accountId ?? void 0
|
|
441
|
-
}
|
|
874
|
+
async listEvaluationCriteria(agentId, opts = {}) {
|
|
875
|
+
return await this.request("GET", `/agents/${agentId}/evaluation-criteria`, {
|
|
876
|
+
query: { page: opts.page, limit: opts.limit }
|
|
442
877
|
});
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
*
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
* @param
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
form.set("file", blob, fileName);
|
|
500
|
-
if (opts.title !== void 0) {
|
|
501
|
-
form.set("title", opts.title);
|
|
502
|
-
}
|
|
503
|
-
const response = await this.fetcher(url, {
|
|
504
|
-
method: "POST",
|
|
505
|
-
headers,
|
|
506
|
-
body: form
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Create evaluation criteria for an agent.
|
|
881
|
+
*
|
|
882
|
+
* @param agentId - Agent identifier.
|
|
883
|
+
* @param body - Criteria definition.
|
|
884
|
+
* @returns Created evaluation criteria.
|
|
885
|
+
*/
|
|
886
|
+
async createEvaluationCriteria(agentId, body) {
|
|
887
|
+
return await this.request("POST", `/agents/${agentId}/evaluation-criteria`, { json: body });
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Get a single evaluation criteria by ID.
|
|
891
|
+
*
|
|
892
|
+
* @param criteriaId - Criteria identifier.
|
|
893
|
+
* @returns Evaluation criteria details.
|
|
894
|
+
*/
|
|
895
|
+
async getEvaluationCriteria(criteriaId) {
|
|
896
|
+
return await this.request("GET", `/agents/evaluation-criteria/${criteriaId}`);
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Update an evaluation criteria.
|
|
900
|
+
*
|
|
901
|
+
* @param criteriaId - Criteria identifier.
|
|
902
|
+
* @param body - Fields to update.
|
|
903
|
+
* @returns Updated evaluation criteria.
|
|
904
|
+
*/
|
|
905
|
+
async updateEvaluationCriteria(criteriaId, body) {
|
|
906
|
+
return await this.request("PATCH", `/agents/evaluation-criteria/${criteriaId}`, { json: body });
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Delete an evaluation criteria and all associated results.
|
|
910
|
+
*
|
|
911
|
+
* @param criteriaId - Criteria identifier.
|
|
912
|
+
*/
|
|
913
|
+
async deleteEvaluationCriteria(criteriaId) {
|
|
914
|
+
await this.request("DELETE", `/agents/evaluation-criteria/${criteriaId}`);
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Get the evaluation summary for a specific criteria.
|
|
918
|
+
*
|
|
919
|
+
* @param criteriaId - Criteria identifier.
|
|
920
|
+
* @returns Evaluation result summary.
|
|
921
|
+
*/
|
|
922
|
+
async getEvaluationCriteriaSummary(criteriaId) {
|
|
923
|
+
return await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/summary`);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* List evaluation results for a specific criteria.
|
|
927
|
+
*
|
|
928
|
+
* @param criteriaId - Criteria identifier.
|
|
929
|
+
* @param opts - Pagination options.
|
|
930
|
+
*/
|
|
931
|
+
async listEvaluationResults(criteriaId, opts = {}) {
|
|
932
|
+
return await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/results`, {
|
|
933
|
+
query: { page: opts.page, limit: opts.limit }
|
|
507
934
|
});
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Create a manual evaluation result for a criteria.
|
|
938
|
+
*
|
|
939
|
+
* @param criteriaId - Criteria identifier.
|
|
940
|
+
* @param body - Evaluation result payload.
|
|
941
|
+
* @returns Created evaluation result.
|
|
942
|
+
*/
|
|
943
|
+
async createEvaluationResult(criteriaId, body) {
|
|
944
|
+
return await this.request("POST", `/agents/evaluation-criteria/${criteriaId}/results`, { json: body });
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* List runs compatible with a specific evaluation criteria.
|
|
948
|
+
*
|
|
949
|
+
* @param criteriaId - Criteria identifier.
|
|
950
|
+
* @param opts - Pagination options.
|
|
951
|
+
*/
|
|
952
|
+
async listCompatibleRuns(criteriaId, opts = {}) {
|
|
953
|
+
return await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/compatible-runs`, {
|
|
954
|
+
query: { page: opts.page, limit: opts.limit }
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Test a draft evaluation criteria without persisting it.
|
|
959
|
+
*
|
|
960
|
+
* @param agentId - Agent identifier.
|
|
961
|
+
* @param body - Draft evaluation to test.
|
|
962
|
+
* @returns Test evaluation response.
|
|
963
|
+
*/
|
|
964
|
+
async testDraftEvaluation(agentId, body) {
|
|
965
|
+
return await this.request("POST", `/agents/${agentId}/evaluation-criteria/test-draft`, { json: body });
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* List all evaluation results for an agent.
|
|
969
|
+
*
|
|
970
|
+
* @param agentId - Agent identifier.
|
|
971
|
+
* @param opts - Pagination options.
|
|
972
|
+
*/
|
|
973
|
+
async listAgentEvaluationResults(agentId, opts = {}) {
|
|
974
|
+
return await this.request("GET", `/agents/${agentId}/evaluation-results`, {
|
|
975
|
+
query: { page: opts.page, limit: opts.limit }
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* List evaluation run summaries for an agent.
|
|
980
|
+
*
|
|
981
|
+
* @param agentId - Agent identifier.
|
|
982
|
+
* @param opts - Pagination options.
|
|
983
|
+
*/
|
|
984
|
+
async listEvaluationRuns(agentId, opts = {}) {
|
|
985
|
+
return await this.request("GET", `/agents/${agentId}/evaluation-runs`, {
|
|
986
|
+
query: { page: opts.page, limit: opts.limit }
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Get a summary of non-manual evaluations across an agent's runs.
|
|
991
|
+
*
|
|
992
|
+
* @param agentId - Agent identifier.
|
|
993
|
+
*/
|
|
994
|
+
async getNonManualEvaluationSummary(agentId) {
|
|
995
|
+
return await this.request("GET", "/agents/evaluation-results/non-manual-summary", {
|
|
996
|
+
query: { agent_id: agentId }
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1000
|
+
// Knowledge Bases
|
|
1001
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1002
|
+
/**
|
|
1003
|
+
* List knowledge bases.
|
|
1004
|
+
*
|
|
1005
|
+
* @param opts - Pagination and sorting options.
|
|
1006
|
+
* @returns Paginated list of knowledge bases.
|
|
1007
|
+
*/
|
|
1008
|
+
async listKnowledgeBases(opts = {}) {
|
|
1009
|
+
return await this.request("GET", "/knowledge_bases", {
|
|
1010
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Create a new knowledge base.
|
|
1015
|
+
*
|
|
1016
|
+
* @param body - Knowledge base configuration.
|
|
1017
|
+
* @returns The created knowledge base.
|
|
1018
|
+
*/
|
|
1019
|
+
async createKnowledgeBase(body) {
|
|
1020
|
+
return await this.request("POST", "/knowledge_bases", { json: body });
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Get a knowledge base by ID.
|
|
1024
|
+
*
|
|
1025
|
+
* @param knowledgeBaseId - Knowledge base identifier.
|
|
1026
|
+
* @returns Knowledge base details.
|
|
1027
|
+
*/
|
|
1028
|
+
async getKnowledgeBase(knowledgeBaseId) {
|
|
1029
|
+
return await this.request("GET", `/knowledge_bases/${knowledgeBaseId}`);
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Update a knowledge base.
|
|
1033
|
+
*
|
|
1034
|
+
* @param knowledgeBaseId - Knowledge base identifier.
|
|
1035
|
+
* @param body - Fields to update.
|
|
1036
|
+
* @returns Updated knowledge base.
|
|
1037
|
+
*/
|
|
1038
|
+
async updateKnowledgeBase(knowledgeBaseId, body) {
|
|
1039
|
+
return await this.request("PUT", `/knowledge_bases/${knowledgeBaseId}`, { json: body });
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Delete a knowledge base.
|
|
1043
|
+
*
|
|
1044
|
+
* @param knowledgeBaseId - Knowledge base identifier.
|
|
1045
|
+
*/
|
|
1046
|
+
async deleteKnowledgeBase(knowledgeBaseId) {
|
|
1047
|
+
await this.request("DELETE", `/knowledge_bases/${knowledgeBaseId}`);
|
|
1048
|
+
}
|
|
1049
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1050
|
+
// Memory Banks
|
|
1051
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1052
|
+
/**
|
|
1053
|
+
* List memory banks.
|
|
1054
|
+
*
|
|
1055
|
+
* @param opts - Pagination and sorting options.
|
|
1056
|
+
* @returns Paginated list of memory banks.
|
|
1057
|
+
*/
|
|
1058
|
+
async listMemoryBanks(opts = {}) {
|
|
1059
|
+
return await this.request("GET", "/memory_banks", {
|
|
1060
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Create a new memory bank.
|
|
1065
|
+
*
|
|
1066
|
+
* Memory banks give agents persistent memory across conversations.
|
|
1067
|
+
* Types: `conversation` (chat-style history) or `general` (flat factual entries).
|
|
1068
|
+
*
|
|
1069
|
+
* @param body - Memory bank configuration.
|
|
1070
|
+
* @returns The created memory bank.
|
|
1071
|
+
*/
|
|
1072
|
+
async createMemoryBank(body) {
|
|
1073
|
+
return await this.request("POST", "/memory_banks", { json: body });
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Get a memory bank by ID.
|
|
1077
|
+
*
|
|
1078
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1079
|
+
* @returns Memory bank details.
|
|
1080
|
+
*/
|
|
1081
|
+
async getMemoryBank(memoryBankId) {
|
|
1082
|
+
return await this.request("GET", `/memory_banks/${memoryBankId}`);
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Update a memory bank.
|
|
1086
|
+
*
|
|
1087
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1088
|
+
* @param body - Fields to update.
|
|
1089
|
+
* @returns Updated memory bank.
|
|
1090
|
+
*/
|
|
1091
|
+
async updateMemoryBank(memoryBankId, body) {
|
|
1092
|
+
return await this.request("PUT", `/memory_banks/${memoryBankId}`, { json: body });
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Delete a memory bank.
|
|
1096
|
+
*
|
|
1097
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1098
|
+
*/
|
|
1099
|
+
async deleteMemoryBank(memoryBankId) {
|
|
1100
|
+
await this.request("DELETE", `/memory_banks/${memoryBankId}`);
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Get agents that are using a specific memory bank.
|
|
1104
|
+
*
|
|
1105
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1106
|
+
*/
|
|
1107
|
+
async getAgentsUsingMemoryBank(memoryBankId) {
|
|
1108
|
+
return await this.request("GET", `/memory_banks/${memoryBankId}/agents`);
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Get stats for a memory bank.
|
|
1112
|
+
*
|
|
1113
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1114
|
+
*/
|
|
1115
|
+
async getMemoryBankStats(memoryBankId) {
|
|
1116
|
+
return await this.request("GET", `/memory_banks/${memoryBankId}/stats`);
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Compact a memory bank (trigger compaction).
|
|
1120
|
+
*
|
|
1121
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1122
|
+
*/
|
|
1123
|
+
async compactMemoryBank(memoryBankId) {
|
|
1124
|
+
await this.request("POST", `/memory_banks/${memoryBankId}/compact`);
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Delete a memory bank source.
|
|
1128
|
+
*
|
|
1129
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1130
|
+
*/
|
|
1131
|
+
async deleteMemoryBankSource(memoryBankId) {
|
|
1132
|
+
await this.request("DELETE", `/memory_banks/${memoryBankId}/source`);
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Test compaction for a specific memory bank.
|
|
1136
|
+
*
|
|
1137
|
+
* @param memoryBankId - Memory bank identifier.
|
|
1138
|
+
* @param body - Test compaction request.
|
|
1139
|
+
*/
|
|
1140
|
+
async testMemoryBankCompaction(memoryBankId, body) {
|
|
1141
|
+
return await this.request("POST", `/memory_banks/${memoryBankId}/test-compaction`, { json: body });
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Test compaction prompt standalone (not tied to a specific memory bank).
|
|
1145
|
+
*
|
|
1146
|
+
* @param body - Standalone compaction test request.
|
|
1147
|
+
*/
|
|
1148
|
+
async testCompactionPromptStandalone(body) {
|
|
1149
|
+
return await this.request("POST", "/memory_banks/test-compaction", { json: body });
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* List available memory bank templates.
|
|
1153
|
+
*/
|
|
1154
|
+
async listMemoryBankTemplates() {
|
|
1155
|
+
return await this.request("GET", "/memory_banks/templates");
|
|
1156
|
+
}
|
|
1157
|
+
// ─── Memory Bank AI Assistant ──────────────────────────────────────────────
|
|
1158
|
+
/**
|
|
1159
|
+
* Generate memory bank configuration using AI.
|
|
1160
|
+
*
|
|
1161
|
+
* @param body - AI assistant request with user instructions.
|
|
1162
|
+
* @returns AI-generated memory bank config.
|
|
1163
|
+
*/
|
|
1164
|
+
async generateMemoryBankConfig(body) {
|
|
1165
|
+
return await this.request("POST", "/memory_banks/ai-assistant", { json: body });
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Get the last AI conversation for memory banks.
|
|
1169
|
+
*/
|
|
1170
|
+
async getMemoryBankAiLastConversation() {
|
|
1171
|
+
return await this.request("GET", "/memory_banks/ai-assistant/last-conversation");
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Accept a memory bank AI suggestion.
|
|
1175
|
+
*
|
|
1176
|
+
* @param conversationId - Conversation identifier.
|
|
1177
|
+
* @param body - Accept request payload.
|
|
1178
|
+
*/
|
|
1179
|
+
async acceptMemoryBankAiSuggestion(conversationId, body) {
|
|
1180
|
+
return await this.request("PATCH", `/memory_banks/ai-assistant/${conversationId}`, { json: body });
|
|
1181
|
+
}
|
|
1182
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1183
|
+
// Sources
|
|
1184
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1185
|
+
/**
|
|
1186
|
+
* List sources.
|
|
1187
|
+
*
|
|
1188
|
+
* @param opts - Pagination, sorting, and filter options.
|
|
1189
|
+
* @returns Paginated list of sources.
|
|
1190
|
+
*/
|
|
1191
|
+
async listSources(opts = {}) {
|
|
1192
|
+
return await this.request("GET", "/sources/", {
|
|
1193
|
+
query: {
|
|
1194
|
+
page: opts.page,
|
|
1195
|
+
limit: opts.limit,
|
|
1196
|
+
sort: opts.sort,
|
|
1197
|
+
order: opts.order,
|
|
1198
|
+
account_id: opts.accountId
|
|
520
1199
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
/**
|
|
1203
|
+
* Create a new content source.
|
|
1204
|
+
*
|
|
1205
|
+
* @param body - Source configuration (type, name, knowledge base link, etc.).
|
|
1206
|
+
* @returns The created source.
|
|
1207
|
+
*/
|
|
1208
|
+
async createSource(body) {
|
|
1209
|
+
return await this.request("POST", "/sources", { json: body });
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Get a source by ID.
|
|
1213
|
+
*
|
|
1214
|
+
* @param sourceId - Source connection identifier.
|
|
1215
|
+
* @returns Source details.
|
|
1216
|
+
*/
|
|
1217
|
+
async getSource(sourceId) {
|
|
1218
|
+
return await this.request("GET", `/sources/${sourceId}`);
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Update a source.
|
|
1222
|
+
*
|
|
1223
|
+
* @param sourceId - Source connection identifier.
|
|
1224
|
+
* @param body - Fields to update.
|
|
1225
|
+
* @returns Updated source.
|
|
1226
|
+
*/
|
|
1227
|
+
async updateSource(sourceId, body) {
|
|
1228
|
+
return await this.request("PUT", `/sources/${sourceId}`, { json: body });
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Delete a source.
|
|
1232
|
+
*
|
|
1233
|
+
* @param sourceId - Source connection identifier.
|
|
1234
|
+
*/
|
|
1235
|
+
async deleteSource(sourceId) {
|
|
1236
|
+
await this.request("DELETE", `/sources/${sourceId}`);
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Upload a file to a source.
|
|
1240
|
+
*
|
|
1241
|
+
* Maximum file size: 200 MiB. Supports text, PDF, DOCX, audio, video, images, and more.
|
|
1242
|
+
* If `mimeType` is omitted, it will be inferred from the `fileName` extension when possible.
|
|
1243
|
+
*
|
|
1244
|
+
* @param sourceId - Source connection identifier.
|
|
1245
|
+
* @param opts - File payload and optional metadata.
|
|
1246
|
+
* @returns Upload response details.
|
|
1247
|
+
*/
|
|
1248
|
+
async uploadFileToSource(sourceId, opts) {
|
|
1249
|
+
return await this.uploadFile(`/sources/${sourceId}/upload`, opts);
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Upload inline text to a source.
|
|
1253
|
+
*
|
|
1254
|
+
* @param sourceId - Source connection identifier.
|
|
1255
|
+
* @param body - Inline text upload payload.
|
|
1256
|
+
* @returns Upload response.
|
|
1257
|
+
*/
|
|
1258
|
+
async uploadInlineTextToSource(sourceId, body) {
|
|
1259
|
+
return await this.request("POST", `/sources/${sourceId}`, { json: body });
|
|
1260
|
+
}
|
|
1261
|
+
// ─── Source Exports ────────────────────────────────────────────────────────
|
|
1262
|
+
/**
|
|
1263
|
+
* List exports for a source.
|
|
1264
|
+
*
|
|
1265
|
+
* @param sourceId - Source connection identifier.
|
|
1266
|
+
* @param opts - Pagination options.
|
|
1267
|
+
* @returns Paginated list of exports.
|
|
1268
|
+
*/
|
|
1269
|
+
async listSourceExports(sourceId, opts = {}) {
|
|
1270
|
+
return await this.request("GET", `/sources/${sourceId}/exports`, {
|
|
1271
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Create a source data export.
|
|
1276
|
+
*
|
|
1277
|
+
* @param sourceId - Source connection identifier.
|
|
1278
|
+
* @param body - Export configuration (format, etc.).
|
|
1279
|
+
* @returns Export response with job status.
|
|
1280
|
+
*/
|
|
1281
|
+
async createSourceExport(sourceId, body) {
|
|
1282
|
+
return await this.request("POST", `/sources/${sourceId}/exports`, { json: body });
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Get a specific source export.
|
|
1286
|
+
*
|
|
1287
|
+
* @param sourceId - Source connection identifier.
|
|
1288
|
+
* @param exportId - Export identifier.
|
|
1289
|
+
* @returns Export details.
|
|
1290
|
+
*/
|
|
1291
|
+
async getSourceExport(sourceId, exportId) {
|
|
1292
|
+
return await this.request("GET", `/sources/${sourceId}/exports/${exportId}`);
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Cancel a source export.
|
|
1296
|
+
*
|
|
1297
|
+
* @param sourceId - Source connection identifier.
|
|
1298
|
+
* @param exportId - Export identifier.
|
|
1299
|
+
*/
|
|
1300
|
+
async cancelSourceExport(sourceId, exportId) {
|
|
1301
|
+
return await this.request("POST", `/sources/${sourceId}/exports/${exportId}/cancel`);
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Download a source export file.
|
|
1305
|
+
*
|
|
1306
|
+
* Returns the raw `Response` so you can stream or save the binary data.
|
|
1307
|
+
*
|
|
1308
|
+
* @param sourceId - Source connection identifier.
|
|
1309
|
+
* @param exportId - Export identifier.
|
|
1310
|
+
* @returns Raw response with the export file.
|
|
1311
|
+
*/
|
|
1312
|
+
async downloadSourceExport(sourceId, exportId) {
|
|
1313
|
+
return await this.requestRaw("GET", `/sources/${sourceId}/exports/${exportId}/download`);
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Estimate a source export.
|
|
1317
|
+
*
|
|
1318
|
+
* @param sourceId - Source connection identifier.
|
|
1319
|
+
* @param body - Estimate request.
|
|
1320
|
+
* @returns Export estimate.
|
|
1321
|
+
*/
|
|
1322
|
+
async estimateSourceExport(sourceId, body) {
|
|
1323
|
+
return await this.request("POST", `/sources/${sourceId}/exports/estimate`, { json: body });
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Delete a source export.
|
|
1327
|
+
*
|
|
1328
|
+
* @param sourceId - Source connection identifier.
|
|
1329
|
+
* @param exportId - Export identifier.
|
|
1330
|
+
*/
|
|
1331
|
+
async deleteSourceExport(sourceId, exportId) {
|
|
1332
|
+
await this.request("DELETE", `/sources/${sourceId}/exports/${exportId}`);
|
|
1333
|
+
}
|
|
1334
|
+
// ─── Source Embedding Migrations ───────────────────────────────────────────
|
|
1335
|
+
/**
|
|
1336
|
+
* Get the status of a source embedding migration.
|
|
1337
|
+
*
|
|
1338
|
+
* @param sourceId - Source connection identifier.
|
|
1339
|
+
* @returns Migration status.
|
|
1340
|
+
*/
|
|
1341
|
+
async getSourceEmbeddingMigration(sourceId) {
|
|
1342
|
+
return await this.request("GET", `/sources/${sourceId}/embedding-migration`);
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Start a source embedding migration.
|
|
1346
|
+
*
|
|
1347
|
+
* @param sourceId - Source connection identifier.
|
|
1348
|
+
* @param body - Migration configuration (target embedding model, etc.).
|
|
1349
|
+
* @returns Migration status.
|
|
1350
|
+
*/
|
|
1351
|
+
async startSourceEmbeddingMigration(sourceId, body) {
|
|
1352
|
+
return await this.request("POST", `/sources/${sourceId}/embedding-migration`, { json: body });
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Cancel a source embedding migration.
|
|
1356
|
+
*
|
|
1357
|
+
* @param sourceId - Source connection identifier.
|
|
1358
|
+
* @returns Updated migration status.
|
|
1359
|
+
*/
|
|
1360
|
+
async cancelSourceEmbeddingMigration(sourceId) {
|
|
1361
|
+
return await this.request("POST", `/sources/${sourceId}/embedding-migration/cancel`);
|
|
1362
|
+
}
|
|
1363
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1364
|
+
// Content
|
|
1365
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1366
|
+
/**
|
|
1367
|
+
* Get content detail for a specific content version.
|
|
1368
|
+
*
|
|
1369
|
+
* @param contentVersionId - Content version identifier.
|
|
1370
|
+
* @param opts - Range options for slicing large content.
|
|
1371
|
+
* @returns Content details for the requested range.
|
|
1372
|
+
*/
|
|
1373
|
+
async getContentDetail(contentVersionId, opts = {}) {
|
|
1374
|
+
return await this.request("GET", `/contents/${contentVersionId}`, {
|
|
1375
|
+
query: { start: opts.start ?? 0, end: opts.end ?? 5e3 }
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Replace content with inline text.
|
|
1380
|
+
*
|
|
1381
|
+
* @param contentVersionId - Content version identifier.
|
|
1382
|
+
* @param body - Inline text replacement payload.
|
|
1383
|
+
*/
|
|
1384
|
+
async replaceContentWithInlineText(contentVersionId, body) {
|
|
1385
|
+
return await this.request("PUT", `/contents/${contentVersionId}`, { json: body });
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Delete a specific content version.
|
|
1389
|
+
*
|
|
1390
|
+
* @param contentVersionId - Content version identifier.
|
|
1391
|
+
*/
|
|
1392
|
+
async deleteContent(contentVersionId) {
|
|
1393
|
+
await this.request("DELETE", `/contents/${contentVersionId}`);
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* List embeddings for a content version.
|
|
1397
|
+
*
|
|
1398
|
+
* @param contentVersionId - Content version identifier.
|
|
1399
|
+
* @param opts - Pagination options.
|
|
1400
|
+
* @returns Paginated list of embeddings.
|
|
1401
|
+
*/
|
|
1402
|
+
async listContentEmbeddings(contentVersionId, opts = {}) {
|
|
1403
|
+
return await this.request("GET", `/contents/${contentVersionId}/embeddings`, {
|
|
1404
|
+
query: { page: opts.page ?? 1, limit: opts.limit ?? 20 }
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Upload a file to replace content for an existing content version.
|
|
1409
|
+
*
|
|
1410
|
+
* @param contentVersionId - Content version identifier.
|
|
1411
|
+
* @param opts - File payload and optional metadata.
|
|
1412
|
+
* @returns Upload response.
|
|
1413
|
+
*/
|
|
1414
|
+
async uploadFileToContent(contentVersionId, opts) {
|
|
1415
|
+
return await this.uploadFile(`/contents/${contentVersionId}/upload`, opts);
|
|
1416
|
+
}
|
|
1417
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1418
|
+
// Solutions
|
|
1419
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1420
|
+
/**
|
|
1421
|
+
* List solutions.
|
|
1422
|
+
*
|
|
1423
|
+
* @param opts - Pagination and sorting options.
|
|
1424
|
+
* @returns Paginated list of solutions.
|
|
1425
|
+
*/
|
|
1426
|
+
async listSolutions(opts = {}) {
|
|
1427
|
+
return await this.request("GET", "/solutions", {
|
|
1428
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Create a new solution.
|
|
1433
|
+
*
|
|
1434
|
+
* @param body - Solution configuration.
|
|
1435
|
+
* @returns The created solution.
|
|
1436
|
+
*/
|
|
1437
|
+
async createSolution(body) {
|
|
1438
|
+
return await this.request("POST", "/solutions", { json: body });
|
|
1439
|
+
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Get a solution by ID.
|
|
1442
|
+
*
|
|
1443
|
+
* @param solutionId - Solution identifier.
|
|
1444
|
+
* @returns Solution details.
|
|
1445
|
+
*/
|
|
1446
|
+
async getSolution(solutionId) {
|
|
1447
|
+
return await this.request("GET", `/solutions/${solutionId}`);
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Update a solution.
|
|
1451
|
+
*
|
|
1452
|
+
* @param solutionId - Solution identifier.
|
|
1453
|
+
* @param body - Fields to update.
|
|
1454
|
+
* @returns Updated solution.
|
|
1455
|
+
*/
|
|
1456
|
+
async updateSolution(solutionId, body) {
|
|
1457
|
+
return await this.request("PATCH", `/solutions/${solutionId}`, { json: body });
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Delete a solution.
|
|
1461
|
+
*
|
|
1462
|
+
* @param solutionId - Solution identifier.
|
|
1463
|
+
*/
|
|
1464
|
+
async deleteSolution(solutionId) {
|
|
1465
|
+
await this.request("DELETE", `/solutions/${solutionId}`);
|
|
1466
|
+
}
|
|
1467
|
+
// ─── Solution Resource Linking ─────────────────────────────────────────────
|
|
1468
|
+
/**
|
|
1469
|
+
* Link agents to a solution.
|
|
1470
|
+
*
|
|
1471
|
+
* @param solutionId - Solution identifier.
|
|
1472
|
+
* @param body - Resource IDs to link.
|
|
1473
|
+
* @returns Updated solution.
|
|
1474
|
+
*/
|
|
1475
|
+
async linkAgentsToSolution(solutionId, body) {
|
|
1476
|
+
return await this.request("POST", `/solutions/${solutionId}/agents`, { json: body });
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Unlink agents from a solution.
|
|
1480
|
+
*
|
|
1481
|
+
* @param solutionId - Solution identifier.
|
|
1482
|
+
* @param body - Resource IDs to unlink.
|
|
1483
|
+
* @returns Updated solution.
|
|
1484
|
+
*/
|
|
1485
|
+
async unlinkAgentsFromSolution(solutionId, body) {
|
|
1486
|
+
return await this.request("DELETE", `/solutions/${solutionId}/agents`, { json: body });
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Link knowledge bases to a solution.
|
|
1490
|
+
*
|
|
1491
|
+
* @param solutionId - Solution identifier.
|
|
1492
|
+
* @param body - Resource IDs to link.
|
|
1493
|
+
* @returns Updated solution.
|
|
1494
|
+
*/
|
|
1495
|
+
async linkKnowledgeBasesToSolution(solutionId, body) {
|
|
1496
|
+
return await this.request("POST", `/solutions/${solutionId}/knowledge-bases`, { json: body });
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Unlink knowledge bases from a solution.
|
|
1500
|
+
*
|
|
1501
|
+
* @param solutionId - Solution identifier.
|
|
1502
|
+
* @param body - Resource IDs to unlink.
|
|
1503
|
+
* @returns Updated solution.
|
|
1504
|
+
*/
|
|
1505
|
+
async unlinkKnowledgeBasesFromSolution(solutionId, body) {
|
|
1506
|
+
return await this.request("DELETE", `/solutions/${solutionId}/knowledge-bases`, { json: body });
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Link source connections to a solution.
|
|
1510
|
+
*
|
|
1511
|
+
* @param solutionId - Solution identifier.
|
|
1512
|
+
* @param body - Resource IDs to link.
|
|
1513
|
+
* @returns Updated solution.
|
|
1514
|
+
*/
|
|
1515
|
+
async linkSourceConnectionsToSolution(solutionId, body) {
|
|
1516
|
+
return await this.request("POST", `/solutions/${solutionId}/source-connections`, { json: body });
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Unlink source connections from a solution.
|
|
1520
|
+
*
|
|
1521
|
+
* @param solutionId - Solution identifier.
|
|
1522
|
+
* @param body - Resource IDs to unlink.
|
|
1523
|
+
* @returns Updated solution.
|
|
1524
|
+
*/
|
|
1525
|
+
async unlinkSourceConnectionsFromSolution(solutionId, body) {
|
|
1526
|
+
return await this.request("DELETE", `/solutions/${solutionId}/source-connections`, { json: body });
|
|
1527
|
+
}
|
|
1528
|
+
// ─── Solution Conversations ────────────────────────────────────────────────
|
|
1529
|
+
/**
|
|
1530
|
+
* List conversations for a solution.
|
|
1531
|
+
*
|
|
1532
|
+
* @param solutionId - Solution identifier.
|
|
1533
|
+
* @returns List of conversations.
|
|
1534
|
+
*/
|
|
1535
|
+
async listSolutionConversations(solutionId) {
|
|
1536
|
+
return await this.request("GET", `/solutions/${solutionId}/conversations`);
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Add a conversation turn to a solution.
|
|
1540
|
+
*
|
|
1541
|
+
* @param solutionId - Solution identifier.
|
|
1542
|
+
* @param body - Conversation turn payload.
|
|
1543
|
+
* @returns Updated conversation.
|
|
1544
|
+
*/
|
|
1545
|
+
async addSolutionConversationTurn(solutionId, body) {
|
|
1546
|
+
return await this.request("POST", `/solutions/${solutionId}/conversations`, { json: body });
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Mark a conversation turn (e.g. accepted/rejected).
|
|
1550
|
+
*
|
|
1551
|
+
* @param solutionId - Solution identifier.
|
|
1552
|
+
* @param conversationId - Conversation identifier.
|
|
1553
|
+
* @param body - Mark payload.
|
|
1554
|
+
*/
|
|
1555
|
+
async markSolutionConversationTurn(solutionId, conversationId, body) {
|
|
1556
|
+
await this.request("PATCH", `/solutions/${solutionId}/conversations/${conversationId}`, { json: body });
|
|
1557
|
+
}
|
|
1558
|
+
// ─── Solution AI Assistant ─────────────────────────────────────────────────
|
|
1559
|
+
/**
|
|
1560
|
+
* Generate a solution AI plan.
|
|
1561
|
+
*
|
|
1562
|
+
* @param solutionId - Solution identifier.
|
|
1563
|
+
* @param body - Generation request.
|
|
1564
|
+
* @returns AI-generated plan.
|
|
1565
|
+
*/
|
|
1566
|
+
async generateSolutionAiPlan(solutionId, body) {
|
|
1567
|
+
return await this.request("POST", `/solutions/${solutionId}/ai-assistant/generate`, { json: body });
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Generate a knowledge base configuration via solution AI.
|
|
1571
|
+
*
|
|
1572
|
+
* @param solutionId - Solution identifier.
|
|
1573
|
+
* @param body - Generation request.
|
|
1574
|
+
* @returns AI-generated knowledge base config.
|
|
1575
|
+
*/
|
|
1576
|
+
async generateSolutionAiKnowledgeBase(solutionId, body) {
|
|
1577
|
+
return await this.request("POST", `/solutions/${solutionId}/ai-assistant/knowledge-base`, { json: body });
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Generate a source configuration via solution AI.
|
|
1581
|
+
*
|
|
1582
|
+
* @param solutionId - Solution identifier.
|
|
1583
|
+
* @param body - Generation request.
|
|
1584
|
+
* @returns AI-generated source config.
|
|
1585
|
+
*/
|
|
1586
|
+
async generateSolutionAiSource(solutionId, body) {
|
|
1587
|
+
return await this.request("POST", `/solutions/${solutionId}/ai-assistant/source`, { json: body });
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Accept a solution AI plan.
|
|
1591
|
+
*
|
|
1592
|
+
* @param solutionId - Solution identifier.
|
|
1593
|
+
* @param conversationId - Conversation identifier.
|
|
1594
|
+
* @param body - Accept request.
|
|
1595
|
+
* @returns Acceptance result with executed actions.
|
|
1596
|
+
*/
|
|
1597
|
+
async acceptSolutionAiPlan(solutionId, conversationId, body) {
|
|
1598
|
+
return await this.request("POST", `/solutions/${solutionId}/ai-assistant/${conversationId}/accept`, { json: body });
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Decline a solution AI plan.
|
|
1602
|
+
*
|
|
1603
|
+
* @param solutionId - Solution identifier.
|
|
1604
|
+
* @param conversationId - Conversation identifier.
|
|
1605
|
+
*/
|
|
1606
|
+
async declineSolutionAiPlan(solutionId, conversationId) {
|
|
1607
|
+
await this.request("POST", `/solutions/${solutionId}/ai-assistant/${conversationId}/decline`);
|
|
1608
|
+
}
|
|
1609
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1610
|
+
// Governance — AI Assistant
|
|
1611
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1612
|
+
/**
|
|
1613
|
+
* Generate governance policy suggestions using AI.
|
|
1614
|
+
*
|
|
1615
|
+
* @param body - AI governance request.
|
|
1616
|
+
* @returns AI-generated governance suggestions.
|
|
1617
|
+
*/
|
|
1618
|
+
async generateGovernanceAiPlan(body) {
|
|
1619
|
+
return await this.request("POST", "/governance/ai-assistant", { json: body });
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* List governance AI conversations.
|
|
1623
|
+
*/
|
|
1624
|
+
async listGovernanceAiConversations() {
|
|
1625
|
+
return await this.request("GET", "/governance/ai-assistant/conversations");
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Accept a governance AI plan.
|
|
1629
|
+
*
|
|
1630
|
+
* @param conversationId - Conversation identifier.
|
|
1631
|
+
* @returns Acceptance result.
|
|
1632
|
+
*/
|
|
1633
|
+
async acceptGovernanceAiPlan(conversationId) {
|
|
1634
|
+
return await this.request("POST", `/governance/ai-assistant/${conversationId}/accept`);
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Decline a governance AI plan.
|
|
1638
|
+
*
|
|
1639
|
+
* @param conversationId - Conversation identifier.
|
|
1640
|
+
*/
|
|
1641
|
+
async declineGovernanceAiPlan(conversationId) {
|
|
1642
|
+
await this.request("POST", `/governance/ai-assistant/${conversationId}/decline`);
|
|
1643
|
+
}
|
|
1644
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1645
|
+
// Alerts
|
|
1646
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1647
|
+
/**
|
|
1648
|
+
* List alerts.
|
|
1649
|
+
*
|
|
1650
|
+
* @param opts - Pagination and filter options.
|
|
1651
|
+
* @returns Paginated list of alerts.
|
|
1652
|
+
*/
|
|
1653
|
+
async listAlerts(opts = {}) {
|
|
1654
|
+
return await this.request("GET", "/alerts", {
|
|
1655
|
+
query: { page: opts.page, limit: opts.limit, status: opts.status, severity: opts.severity }
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Get alert details by ID.
|
|
1660
|
+
*
|
|
1661
|
+
* @param alertId - Alert identifier.
|
|
1662
|
+
* @returns Alert details.
|
|
1663
|
+
*/
|
|
1664
|
+
async getAlert(alertId) {
|
|
1665
|
+
return await this.request("GET", `/alerts/${alertId}`);
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Change the status of an alert.
|
|
1669
|
+
*
|
|
1670
|
+
* @param alertId - Alert identifier.
|
|
1671
|
+
* @param body - Status change request.
|
|
1672
|
+
*/
|
|
1673
|
+
async changeAlertStatus(alertId, body) {
|
|
1674
|
+
return await this.request("POST", `/alerts/${alertId}/status`, { json: body });
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Add a comment to an alert.
|
|
1678
|
+
*
|
|
1679
|
+
* @param alertId - Alert identifier.
|
|
1680
|
+
* @param body - Comment payload.
|
|
1681
|
+
*/
|
|
1682
|
+
async addAlertComment(alertId, body) {
|
|
1683
|
+
return await this.request("POST", `/alerts/${alertId}/comments`, { json: body });
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Subscribe to an alert.
|
|
1687
|
+
*
|
|
1688
|
+
* @param alertId - Alert identifier.
|
|
1689
|
+
*/
|
|
1690
|
+
async subscribeToAlert(alertId) {
|
|
1691
|
+
return await this.request("POST", `/alerts/${alertId}/subscribe`);
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* Unsubscribe from an alert.
|
|
1695
|
+
*
|
|
1696
|
+
* @param alertId - Alert identifier.
|
|
1697
|
+
*/
|
|
1698
|
+
async unsubscribeFromAlert(alertId) {
|
|
1699
|
+
return await this.request("POST", `/alerts/${alertId}/unsubscribe`);
|
|
1700
|
+
}
|
|
1701
|
+
// ─── Alert Configs ─────────────────────────────────────────────────────────
|
|
1702
|
+
/**
|
|
1703
|
+
* List alert configurations.
|
|
1704
|
+
*
|
|
1705
|
+
* @param opts - Pagination options.
|
|
1706
|
+
* @returns Paginated list of alert configs.
|
|
1707
|
+
*/
|
|
1708
|
+
async listAlertConfigs(opts = {}) {
|
|
1709
|
+
return await this.request("GET", "/alerts/configs", {
|
|
1710
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Create an alert configuration.
|
|
1715
|
+
*
|
|
1716
|
+
* @param body - Alert config definition.
|
|
1717
|
+
* @returns Created alert config.
|
|
1718
|
+
*/
|
|
1719
|
+
async createAlertConfig(body) {
|
|
1720
|
+
return await this.request("POST", "/alerts/configs", { json: body });
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Get an alert configuration by ID.
|
|
1724
|
+
*
|
|
1725
|
+
* @param configId - Alert config identifier.
|
|
1726
|
+
* @returns Alert config details.
|
|
1727
|
+
*/
|
|
1728
|
+
async getAlertConfig(configId) {
|
|
1729
|
+
return await this.request("GET", `/alerts/configs/${configId}`);
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Update an alert configuration.
|
|
1733
|
+
*
|
|
1734
|
+
* @param configId - Alert config identifier.
|
|
1735
|
+
* @param body - Fields to update.
|
|
1736
|
+
* @returns Updated alert config.
|
|
1737
|
+
*/
|
|
1738
|
+
async updateAlertConfig(configId, body) {
|
|
1739
|
+
return await this.request("PATCH", `/alerts/configs/${configId}`, { json: body });
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Delete an alert configuration.
|
|
1743
|
+
*
|
|
1744
|
+
* @param configId - Alert config identifier.
|
|
1745
|
+
*/
|
|
1746
|
+
async deleteAlertConfig(configId) {
|
|
1747
|
+
await this.request("DELETE", `/alerts/configs/${configId}`);
|
|
1748
|
+
}
|
|
1749
|
+
// ─── Organization Alert Preferences ────────────────────────────────────────
|
|
1750
|
+
/**
|
|
1751
|
+
* List organization alert preferences.
|
|
1752
|
+
*/
|
|
1753
|
+
async listOrganizationAlertPreferences() {
|
|
1754
|
+
return await this.request("GET", "/alerts/organization-preferences/list");
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Update an organization alert preference.
|
|
1758
|
+
*
|
|
1759
|
+
* @param organizationId - Organization identifier.
|
|
1760
|
+
* @param alertType - Alert type.
|
|
1761
|
+
* @param body - Preference update.
|
|
1762
|
+
*/
|
|
1763
|
+
async updateOrganizationAlertPreference(organizationId, alertType, body) {
|
|
1764
|
+
return await this.request("PATCH", `/alerts/organization-preferences/${organizationId}/${alertType}`, { json: body });
|
|
1765
|
+
}
|
|
1766
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1767
|
+
// Models & Model Alerts
|
|
1768
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1769
|
+
/**
|
|
1770
|
+
* List model alerts.
|
|
1771
|
+
*
|
|
1772
|
+
* @param opts - Pagination options.
|
|
1773
|
+
*/
|
|
1774
|
+
async listModelAlerts(opts = {}) {
|
|
1775
|
+
return await this.request("GET", "/models/alerts", {
|
|
1776
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* Mark all model alerts as read.
|
|
1781
|
+
*/
|
|
1782
|
+
async markAllModelAlertsRead() {
|
|
1783
|
+
await this.request("POST", "/models/alerts/mark-all-read");
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Get unread model alert count.
|
|
1787
|
+
*/
|
|
1788
|
+
async getUnreadModelAlertCount() {
|
|
1789
|
+
return await this.request("GET", "/models/alerts/unread-count");
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Mark a specific model alert as read.
|
|
1793
|
+
*
|
|
1794
|
+
* @param alertId - Model alert identifier.
|
|
1795
|
+
*/
|
|
1796
|
+
async markModelAlertRead(alertId) {
|
|
1797
|
+
await this.request("PATCH", `/models/alerts/${alertId}/read`);
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Get model recommendations.
|
|
1801
|
+
*
|
|
1802
|
+
* @param modelId - Model identifier.
|
|
1803
|
+
*/
|
|
1804
|
+
async getModelRecommendations(modelId) {
|
|
1805
|
+
return await this.request("GET", `/models/${modelId}/recommendations`);
|
|
1806
|
+
}
|
|
1807
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1808
|
+
// Search
|
|
1809
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1810
|
+
/**
|
|
1811
|
+
* Search across all resource types in your account.
|
|
1812
|
+
*
|
|
1813
|
+
* Accepts a free-text keyword query or a UUID. Results are ranked:
|
|
1814
|
+
* name-prefix > name-substring > description-substring.
|
|
1815
|
+
*
|
|
1816
|
+
* @param opts - Search options.
|
|
1817
|
+
* @param opts.query - Search query string (required, 1-200 chars).
|
|
1818
|
+
* @param opts.limit - Maximum results (1-50, default 10).
|
|
1819
|
+
* @param opts.entityType - Optional entity type filter (e.g. "agent", "knowledge_base").
|
|
1820
|
+
* @returns Search results.
|
|
1821
|
+
*/
|
|
1822
|
+
async search(opts) {
|
|
1823
|
+
return await this.request("GET", "/search", {
|
|
1824
|
+
query: { q: opts.query, limit: opts.limit, entity_type: opts.entityType }
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1828
|
+
// Top-Level AI Assistant
|
|
1829
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1830
|
+
/**
|
|
1831
|
+
* Submit feedback on an AI assistant interaction.
|
|
1832
|
+
*
|
|
1833
|
+
* @param body - Feedback payload (thumbs up/down, optional comment).
|
|
1834
|
+
* @returns Feedback response.
|
|
1835
|
+
*/
|
|
1836
|
+
async submitAiFeedback(body) {
|
|
1837
|
+
return await this.request("POST", "/ai-assistant/feedback", { json: body });
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Generate a knowledge base configuration via AI assistant.
|
|
1841
|
+
*
|
|
1842
|
+
* @param body - Generation request.
|
|
1843
|
+
*/
|
|
1844
|
+
async aiAssistantKnowledgeBase(body) {
|
|
1845
|
+
return await this.request("POST", "/ai-assistant/knowledge-base", { json: body });
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Generate a source configuration via AI assistant.
|
|
1849
|
+
*
|
|
1850
|
+
* @param body - Generation request.
|
|
1851
|
+
*/
|
|
1852
|
+
async aiAssistantSource(body) {
|
|
1853
|
+
return await this.request("POST", "/ai-assistant/source", { json: body });
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Generate a solution via AI assistant.
|
|
1857
|
+
*
|
|
1858
|
+
* @param body - Generation request.
|
|
1859
|
+
*/
|
|
1860
|
+
async aiAssistantSolution(body) {
|
|
1861
|
+
return await this.request("POST", "/ai-assistant/solution", { json: body });
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Generate a memory bank configuration via AI assistant.
|
|
1865
|
+
*
|
|
1866
|
+
* @param body - Generation request.
|
|
1867
|
+
*/
|
|
1868
|
+
async aiAssistantMemoryBank(body) {
|
|
1869
|
+
return await this.request("POST", "/ai-assistant/memory-bank", { json: body });
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* Get AI assistant memory bank conversation history.
|
|
1873
|
+
*/
|
|
1874
|
+
async getAiAssistantMemoryBankHistory() {
|
|
1875
|
+
return await this.request("GET", "/ai-assistant/memory-bank/last-conversation");
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Accept an AI assistant suggestion.
|
|
1879
|
+
*
|
|
1880
|
+
* @param conversationId - Conversation identifier.
|
|
1881
|
+
* @param body - Acceptance request payload.
|
|
1882
|
+
*/
|
|
1883
|
+
async acceptAiAssistantPlan(conversationId, body) {
|
|
1884
|
+
return await this.request("POST", `/ai-assistant/${conversationId}/accept`, { json: body });
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Decline an AI assistant suggestion.
|
|
1888
|
+
*
|
|
1889
|
+
* @param conversationId - Conversation identifier.
|
|
1890
|
+
*/
|
|
1891
|
+
async declineAiAssistantPlan(conversationId) {
|
|
1892
|
+
await this.request("POST", `/ai-assistant/${conversationId}/decline`);
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Accept/mark an AI memory bank suggestion.
|
|
1896
|
+
*
|
|
1897
|
+
* @param conversationId - Conversation identifier.
|
|
1898
|
+
* @param body - Acceptance payload for the memory bank suggestion.
|
|
1899
|
+
*/
|
|
1900
|
+
async acceptAiMemoryBankSuggestion(conversationId, body) {
|
|
1901
|
+
return await this.request("PATCH", `/ai-assistant/memory-bank/${conversationId}`, { json: body });
|
|
1902
|
+
}
|
|
1903
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1904
|
+
// Pagination Helpers
|
|
1905
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1906
|
+
/**
|
|
1907
|
+
* Auto-paginate through a list endpoint.
|
|
1908
|
+
*
|
|
1909
|
+
* Yields individual items from each page, automatically fetching the next page
|
|
1910
|
+
* until all items have been returned.
|
|
1911
|
+
*
|
|
1912
|
+
* @param fetchPage - A function that fetches a single page given `{ page, limit }`.
|
|
1913
|
+
* @param opts - Page size (default: 50).
|
|
1914
|
+
*
|
|
1915
|
+
* @example
|
|
1916
|
+
* ```ts
|
|
1917
|
+
* for await (const agent of client.paginate(
|
|
1918
|
+
* (opts) => client.listAgents(opts),
|
|
1919
|
+
* )) {
|
|
1920
|
+
* console.log(agent);
|
|
1921
|
+
* }
|
|
1922
|
+
* ```
|
|
1923
|
+
*/
|
|
1924
|
+
async *paginate(fetchPage, opts) {
|
|
1925
|
+
const limit = opts?.limit ?? 50;
|
|
1926
|
+
let page = 1;
|
|
1927
|
+
while (true) {
|
|
1928
|
+
const result = await fetchPage({ page, limit });
|
|
1929
|
+
for (const item of result.items) {
|
|
1930
|
+
yield item;
|
|
1931
|
+
}
|
|
1932
|
+
if (!result.pagination || result.items.length < limit || page >= result.pagination.total_pages) {
|
|
1933
|
+
break;
|
|
1934
|
+
}
|
|
1935
|
+
page++;
|
|
528
1936
|
}
|
|
529
|
-
return await response.json();
|
|
530
1937
|
}
|
|
531
1938
|
};
|
|
532
1939
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -536,6 +1943,7 @@ var Seclai = class {
|
|
|
536
1943
|
SeclaiAPIStatusError,
|
|
537
1944
|
SeclaiAPIValidationError,
|
|
538
1945
|
SeclaiConfigurationError,
|
|
539
|
-
SeclaiError
|
|
1946
|
+
SeclaiError,
|
|
1947
|
+
SeclaiStreamingError
|
|
540
1948
|
});
|
|
541
1949
|
//# sourceMappingURL=index.cjs.map
|