@seclai/sdk 1.6.0 → 1.6.1
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/CHANGELOG.md +18 -0
- package/README.md +45 -27
- package/dist/index.cjs +223 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -28
- package/dist/index.d.ts +40 -28
- package/dist/index.js +223 -124
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -372,11 +372,46 @@ function buildURL(baseUrl, path, query) {
|
|
|
372
372
|
}
|
|
373
373
|
function listItems(res) {
|
|
374
374
|
if (Array.isArray(res)) return res;
|
|
375
|
-
|
|
375
|
+
if (res !== null && typeof res === "object" && "data" in res) {
|
|
376
|
+
const data = res.data;
|
|
377
|
+
if (Array.isArray(data)) return data;
|
|
378
|
+
if (data === null) return [];
|
|
379
|
+
}
|
|
380
|
+
throw notAList();
|
|
381
|
+
}
|
|
382
|
+
function notAList() {
|
|
383
|
+
return new SeclaiError(
|
|
384
|
+
"Expected a list response: an array, or an object carrying the items under `data` or the endpoint's own key."
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
function keyedList(res, key, flat = []) {
|
|
388
|
+
if (Array.isArray(res)) return { [key]: res };
|
|
389
|
+
if (res === null || typeof res !== "object") throw notAList();
|
|
390
|
+
const body = { ...res };
|
|
391
|
+
if (Array.isArray(body.data)) body[key] = body.data;
|
|
392
|
+
else if ("data" in body && body.data === null) body[key] = [];
|
|
393
|
+
else if (!Array.isArray(body[key])) throw notAList();
|
|
394
|
+
const pagination = body.pagination;
|
|
395
|
+
for (const field of flat) {
|
|
396
|
+
if (body[field] === void 0 && pagination?.[field] !== void 0) body[field] = pagination[field];
|
|
397
|
+
}
|
|
398
|
+
return body;
|
|
399
|
+
}
|
|
400
|
+
var PAGE_COUNTERS = ["total", "page", "limit"];
|
|
401
|
+
function mergeHeaders(...layers) {
|
|
402
|
+
const byName = /* @__PURE__ */ new Map();
|
|
403
|
+
for (const layer of layers) {
|
|
404
|
+
for (const [name, value] of Object.entries(layer ?? {})) {
|
|
405
|
+
if (value === void 0 || value === null) continue;
|
|
406
|
+
const lower = name.toLowerCase();
|
|
407
|
+
byName.delete(lower);
|
|
408
|
+
byName.set(lower, [name, value]);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return Object.fromEntries(byName.values());
|
|
376
412
|
}
|
|
377
|
-
function
|
|
378
|
-
|
|
379
|
-
return Array.isArray(body.models) || !Array.isArray(body.data) ? body : { ...body, models: body.data };
|
|
413
|
+
function headerKey(headers, name) {
|
|
414
|
+
return Object.keys(headers ?? {}).filter((key) => key.toLowerCase() === name).pop();
|
|
380
415
|
}
|
|
381
416
|
async function safeText(response) {
|
|
382
417
|
try {
|
|
@@ -493,6 +528,7 @@ function inferMimeType(fileName) {
|
|
|
493
528
|
var Seclai = class {
|
|
494
529
|
baseUrl;
|
|
495
530
|
defaultHeaders;
|
|
531
|
+
allowUnknownApiVersion;
|
|
496
532
|
fetcher;
|
|
497
533
|
_authState = null;
|
|
498
534
|
_authInitPromise = null;
|
|
@@ -523,22 +559,13 @@ var Seclai = class {
|
|
|
523
559
|
);
|
|
524
560
|
}
|
|
525
561
|
this.baseUrl = opts.baseUrl ?? getEnv2("SECLAI_API_URL") ?? SECLAI_API_URL;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
if (key.toLowerCase() === "seclai-version") versionKey = key;
|
|
534
|
-
}
|
|
535
|
-
const effectiveVersion = versionKey ? merged[versionKey] : void 0;
|
|
536
|
-
if (effectiveVersion && !opts.allowUnknownApiVersion && !KNOWN_API_VERSIONS.includes(effectiveVersion)) {
|
|
537
|
-
const via = versionKey === "Seclai-Version" && merged[versionKey] === opts.apiVersion ? "apiVersion" : `defaultHeaders['${versionKey}']`;
|
|
538
|
-
throw new SeclaiConfigurationError(
|
|
539
|
-
`Unknown API version '${effectiveVersion}' (via ${via}). This release was built against ${KNOWN_API_VERSIONS.join(", ")}. A newer API version can change response shapes, which this client would decode incorrectly rather than reject. Upgrade the package, or set allowUnknownApiVersion to proceed anyway.`
|
|
540
|
-
);
|
|
541
|
-
}
|
|
562
|
+
this.allowUnknownApiVersion = opts.allowUnknownApiVersion ?? false;
|
|
563
|
+
const merged = mergeHeaders(
|
|
564
|
+
opts.apiVersion ? { "Seclai-Version": opts.apiVersion } : void 0,
|
|
565
|
+
opts.defaultHeaders
|
|
566
|
+
);
|
|
567
|
+
const defaultKey = headerKey(opts.defaultHeaders, "seclai-version");
|
|
568
|
+
this.assertKnownApiVersion(merged, defaultKey ? `defaultHeaders['${defaultKey}']` : "apiVersion");
|
|
542
569
|
this.defaultHeaders = merged;
|
|
543
570
|
this.fetcher = fetcher;
|
|
544
571
|
const accessTokenProvider = typeof opts.accessToken === "function" ? opts.accessToken : void 0;
|
|
@@ -577,6 +604,26 @@ var Seclai = class {
|
|
|
577
604
|
}
|
|
578
605
|
return this._authState;
|
|
579
606
|
}
|
|
607
|
+
/** Throw unless the `Seclai-Version` in `headers` is one this release was built against. */
|
|
608
|
+
assertKnownApiVersion(headers, via) {
|
|
609
|
+
const key = headerKey(headers, "seclai-version");
|
|
610
|
+
if (key === void 0 || this.allowUnknownApiVersion) return;
|
|
611
|
+
const version = headers[key] ?? "";
|
|
612
|
+
if (KNOWN_API_VERSIONS.includes(version)) return;
|
|
613
|
+
throw new SeclaiConfigurationError(
|
|
614
|
+
`Unknown API version '${version}' (via ${via}). This release was built against ${KNOWN_API_VERSIONS.join(", ")}. A newer API version can change response shapes, which this client would decode incorrectly rather than reject. Upgrade the package, or set allowUnknownApiVersion to proceed anyway.`
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* The headers one request sends: `layers` merged in order, later winning,
|
|
619
|
+
* with the resulting `Seclai-Version` checked against the known versions.
|
|
620
|
+
*/
|
|
621
|
+
requestHeaders(layers, perRequest) {
|
|
622
|
+
const headers = mergeHeaders(...layers);
|
|
623
|
+
const requestKey = headerKey(perRequest, "seclai-version");
|
|
624
|
+
this.assertKnownApiVersion(headers, requestKey ? `headers['${requestKey}']` : "defaultHeaders");
|
|
625
|
+
return headers;
|
|
626
|
+
}
|
|
580
627
|
/** Resolve auth headers for the current request. */
|
|
581
628
|
async authHeaders() {
|
|
582
629
|
const state = await this.ensureAuth();
|
|
@@ -600,16 +647,17 @@ var Seclai = class {
|
|
|
600
647
|
async request(method, path, opts) {
|
|
601
648
|
const url = buildURL(this.baseUrl, path, opts?.query);
|
|
602
649
|
const authHeaders = await this.authHeaders();
|
|
603
|
-
const headers = {
|
|
604
|
-
...this.defaultHeaders,
|
|
605
|
-
...opts?.headers ?? {},
|
|
606
|
-
...authHeaders
|
|
607
|
-
};
|
|
608
650
|
let body;
|
|
609
|
-
if (opts?.json !== void 0)
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
651
|
+
if (opts?.json !== void 0) body = JSON.stringify(opts.json);
|
|
652
|
+
const headers = this.requestHeaders(
|
|
653
|
+
[
|
|
654
|
+
body === void 0 ? void 0 : { "content-type": "application/json" },
|
|
655
|
+
this.defaultHeaders,
|
|
656
|
+
opts?.headers,
|
|
657
|
+
authHeaders
|
|
658
|
+
],
|
|
659
|
+
opts?.headers
|
|
660
|
+
);
|
|
613
661
|
const init = { method, headers };
|
|
614
662
|
if (body !== void 0) {
|
|
615
663
|
init.body = body;
|
|
@@ -661,16 +709,17 @@ var Seclai = class {
|
|
|
661
709
|
async requestRaw(method, path, opts) {
|
|
662
710
|
const url = buildURL(this.baseUrl, path, opts?.query);
|
|
663
711
|
const authHeaders = await this.authHeaders();
|
|
664
|
-
const headers = {
|
|
665
|
-
...this.defaultHeaders,
|
|
666
|
-
...opts?.headers ?? {},
|
|
667
|
-
...authHeaders
|
|
668
|
-
};
|
|
669
712
|
let body;
|
|
670
|
-
if (opts?.json !== void 0)
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
713
|
+
if (opts?.json !== void 0) body = JSON.stringify(opts.json);
|
|
714
|
+
const headers = this.requestHeaders(
|
|
715
|
+
[
|
|
716
|
+
body === void 0 ? void 0 : { "content-type": "application/json" },
|
|
717
|
+
this.defaultHeaders,
|
|
718
|
+
opts?.headers,
|
|
719
|
+
authHeaders
|
|
720
|
+
],
|
|
721
|
+
opts?.headers
|
|
722
|
+
);
|
|
674
723
|
const init = { method, headers };
|
|
675
724
|
if (body !== void 0) init.body = body;
|
|
676
725
|
if (opts?.signal) init.signal = opts.signal;
|
|
@@ -702,12 +751,9 @@ var Seclai = class {
|
|
|
702
751
|
async uploadFile(path, opts) {
|
|
703
752
|
const url = buildURL(this.baseUrl, path);
|
|
704
753
|
const authHeaders = await this.authHeaders();
|
|
705
|
-
const headers =
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
};
|
|
709
|
-
delete headers["content-type"];
|
|
710
|
-
delete headers["Content-Type"];
|
|
754
|
+
const headers = this.requestHeaders([this.defaultHeaders, authHeaders]);
|
|
755
|
+
const contentType = headerKey(headers, "content-type");
|
|
756
|
+
if (contentType !== void 0) delete headers[contentType];
|
|
711
757
|
const form = new FormData();
|
|
712
758
|
const mimeType = opts.mimeType ?? inferMimeType(opts.fileName);
|
|
713
759
|
const blob = toBlob(opts.file, mimeType);
|
|
@@ -874,7 +920,7 @@ var Seclai = class {
|
|
|
874
920
|
* @returns The calling agents.
|
|
875
921
|
*/
|
|
876
922
|
async getAgentCallers(agentId) {
|
|
877
|
-
return await this.request("GET", `/agents/${agentId}/callers`);
|
|
923
|
+
return listItems(await this.request("GET", `/agents/${agentId}/callers`));
|
|
878
924
|
}
|
|
879
925
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
880
926
|
// Agent Export / Import
|
|
@@ -1023,12 +1069,11 @@ var Seclai = class {
|
|
|
1023
1069
|
async runStreamingAgentAndWait(agentId, body, opts) {
|
|
1024
1070
|
const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
|
|
1025
1071
|
const authHdrs = await this.authHeaders();
|
|
1026
|
-
const headers =
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
accept: "text/event-stream",
|
|
1030
|
-
|
|
1031
|
-
};
|
|
1072
|
+
const headers = this.requestHeaders([
|
|
1073
|
+
this.defaultHeaders,
|
|
1074
|
+
authHdrs,
|
|
1075
|
+
{ accept: "text/event-stream", "content-type": "application/json" }
|
|
1076
|
+
]);
|
|
1032
1077
|
const timeoutMs = opts?.timeoutMs ?? 6e4;
|
|
1033
1078
|
const timeoutController = new AbortController();
|
|
1034
1079
|
let timedOut = false;
|
|
@@ -1133,12 +1178,11 @@ var Seclai = class {
|
|
|
1133
1178
|
async *runStreamingAgent(agentId, body, opts) {
|
|
1134
1179
|
const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
|
|
1135
1180
|
const authHdrs = await this.authHeaders();
|
|
1136
|
-
const headers =
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
accept: "text/event-stream",
|
|
1140
|
-
|
|
1141
|
-
};
|
|
1181
|
+
const headers = this.requestHeaders([
|
|
1182
|
+
this.defaultHeaders,
|
|
1183
|
+
authHdrs,
|
|
1184
|
+
{ accept: "text/event-stream", "content-type": "application/json" }
|
|
1185
|
+
]);
|
|
1142
1186
|
const timeoutMs = opts?.timeoutMs ?? 6e4;
|
|
1143
1187
|
const timeoutController = new AbortController();
|
|
1144
1188
|
let timedOut = false;
|
|
@@ -1269,10 +1313,13 @@ var Seclai = class {
|
|
|
1269
1313
|
* @returns Paginated list of evaluation results.
|
|
1270
1314
|
*/
|
|
1271
1315
|
async listRunEvaluationResults(agentId, runId, opts = {}) {
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1316
|
+
return keyedList(
|
|
1317
|
+
await this.request("GET", `/agents/${agentId}/runs/${runId}/evaluation-results`, {
|
|
1318
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1319
|
+
}),
|
|
1320
|
+
"data",
|
|
1321
|
+
PAGE_COUNTERS
|
|
1322
|
+
);
|
|
1276
1323
|
}
|
|
1277
1324
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1278
1325
|
// Agent Input Uploads
|
|
@@ -1400,20 +1447,21 @@ var Seclai = class {
|
|
|
1400
1447
|
/**
|
|
1401
1448
|
* List evaluation criteria for an agent, with pagination metadata.
|
|
1402
1449
|
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
* when the endpoint answers with a bare array.
|
|
1450
|
+
* The endpoint answers with a bare array by default and with `{data,
|
|
1451
|
+
* pagination}` once `apiVersion` is 2026-07-27 or later; `pagination` is
|
|
1452
|
+
* absent on the bare array.
|
|
1407
1453
|
*
|
|
1408
1454
|
* @param agentId - Agent identifier.
|
|
1409
1455
|
* @param opts - Pagination options.
|
|
1410
1456
|
* @returns The criteria under `data`, plus the page metadata when present.
|
|
1411
1457
|
*/
|
|
1412
1458
|
async listEvaluationCriteriaPage(agentId, opts = {}) {
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1459
|
+
return keyedList(
|
|
1460
|
+
await this.request("GET", `/agents/${agentId}/evaluation-criteria`, {
|
|
1461
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1462
|
+
}),
|
|
1463
|
+
"data"
|
|
1464
|
+
);
|
|
1417
1465
|
}
|
|
1418
1466
|
/**
|
|
1419
1467
|
* Create evaluation criteria for an agent.
|
|
@@ -1468,9 +1516,13 @@ var Seclai = class {
|
|
|
1468
1516
|
* @param opts - Pagination options.
|
|
1469
1517
|
*/
|
|
1470
1518
|
async listEvaluationResults(criteriaId, opts = {}) {
|
|
1471
|
-
return
|
|
1472
|
-
|
|
1473
|
-
|
|
1519
|
+
return keyedList(
|
|
1520
|
+
await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/results`, {
|
|
1521
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1522
|
+
}),
|
|
1523
|
+
"data",
|
|
1524
|
+
PAGE_COUNTERS
|
|
1525
|
+
);
|
|
1474
1526
|
}
|
|
1475
1527
|
/**
|
|
1476
1528
|
* Create a manual evaluation result for a criteria.
|
|
@@ -1489,9 +1541,13 @@ var Seclai = class {
|
|
|
1489
1541
|
* @param opts - Pagination options.
|
|
1490
1542
|
*/
|
|
1491
1543
|
async listCompatibleRuns(criteriaId, opts = {}) {
|
|
1492
|
-
return
|
|
1493
|
-
|
|
1494
|
-
|
|
1544
|
+
return keyedList(
|
|
1545
|
+
await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/compatible-runs`, {
|
|
1546
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1547
|
+
}),
|
|
1548
|
+
"data",
|
|
1549
|
+
PAGE_COUNTERS
|
|
1550
|
+
);
|
|
1495
1551
|
}
|
|
1496
1552
|
/**
|
|
1497
1553
|
* Test a draft evaluation criteria without persisting it.
|
|
@@ -1510,9 +1566,13 @@ var Seclai = class {
|
|
|
1510
1566
|
* @param opts - Pagination options.
|
|
1511
1567
|
*/
|
|
1512
1568
|
async listAgentEvaluationResults(agentId, opts = {}) {
|
|
1513
|
-
return
|
|
1514
|
-
|
|
1515
|
-
|
|
1569
|
+
return keyedList(
|
|
1570
|
+
await this.request("GET", `/agents/${agentId}/evaluation-results`, {
|
|
1571
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1572
|
+
}),
|
|
1573
|
+
"data",
|
|
1574
|
+
PAGE_COUNTERS
|
|
1575
|
+
);
|
|
1516
1576
|
}
|
|
1517
1577
|
/**
|
|
1518
1578
|
* List evaluation run summaries for an agent.
|
|
@@ -1521,9 +1581,13 @@ var Seclai = class {
|
|
|
1521
1581
|
* @param opts - Pagination options.
|
|
1522
1582
|
*/
|
|
1523
1583
|
async listEvaluationRuns(agentId, opts = {}) {
|
|
1524
|
-
return
|
|
1525
|
-
|
|
1526
|
-
|
|
1584
|
+
return keyedList(
|
|
1585
|
+
await this.request("GET", `/agents/${agentId}/evaluation-runs`, {
|
|
1586
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1587
|
+
}),
|
|
1588
|
+
"data",
|
|
1589
|
+
PAGE_COUNTERS
|
|
1590
|
+
);
|
|
1527
1591
|
}
|
|
1528
1592
|
/**
|
|
1529
1593
|
* Get a summary of non-manual evaluations across an agent's runs.
|
|
@@ -1569,9 +1633,13 @@ var Seclai = class {
|
|
|
1569
1633
|
* @returns The page of opt-outs plus the total count.
|
|
1570
1634
|
*/
|
|
1571
1635
|
async listAgentEmailOptOuts(opts = {}) {
|
|
1572
|
-
return
|
|
1573
|
-
|
|
1574
|
-
|
|
1636
|
+
return keyedList(
|
|
1637
|
+
await this.request("GET", "/agents/agent-email-optouts", {
|
|
1638
|
+
query: { agent_id: opts.agentId, limit: opts.limit, offset: opts.offset }
|
|
1639
|
+
}),
|
|
1640
|
+
"items",
|
|
1641
|
+
["total"]
|
|
1642
|
+
);
|
|
1575
1643
|
}
|
|
1576
1644
|
/**
|
|
1577
1645
|
* Revoke an opt-out, opting the recipient back in to agent emails.
|
|
@@ -1590,9 +1658,13 @@ var Seclai = class {
|
|
|
1590
1658
|
* @param opts.offset - Rows to skip (default 0).
|
|
1591
1659
|
*/
|
|
1592
1660
|
async listBlockedEmailSenders(opts = {}) {
|
|
1593
|
-
return
|
|
1594
|
-
|
|
1595
|
-
|
|
1661
|
+
return keyedList(
|
|
1662
|
+
await this.request("GET", "/agents/blocked-email-senders", {
|
|
1663
|
+
query: { limit: opts.limit, offset: opts.offset }
|
|
1664
|
+
}),
|
|
1665
|
+
"items",
|
|
1666
|
+
["total"]
|
|
1667
|
+
);
|
|
1596
1668
|
}
|
|
1597
1669
|
/**
|
|
1598
1670
|
* Add a sender address or a whole domain to the account blocklist.
|
|
@@ -1627,9 +1699,11 @@ var Seclai = class {
|
|
|
1627
1699
|
* @returns The updated blocked-sender list.
|
|
1628
1700
|
*/
|
|
1629
1701
|
async setAutoBlockMode(body) {
|
|
1630
|
-
return
|
|
1631
|
-
json: body
|
|
1632
|
-
|
|
1702
|
+
return keyedList(
|
|
1703
|
+
await this.request("PUT", "/agents/blocked-email-senders/mode", { json: body }),
|
|
1704
|
+
"items",
|
|
1705
|
+
["total"]
|
|
1706
|
+
);
|
|
1633
1707
|
}
|
|
1634
1708
|
/**
|
|
1635
1709
|
* List recent inbound emails that were quietly discarded before running an
|
|
@@ -1640,9 +1714,11 @@ var Seclai = class {
|
|
|
1640
1714
|
* @param opts.limit - Maximum results (1-200, default 50).
|
|
1641
1715
|
*/
|
|
1642
1716
|
async listInboundEmailRejections(opts = {}) {
|
|
1643
|
-
return
|
|
1644
|
-
|
|
1645
|
-
|
|
1717
|
+
return listItems(
|
|
1718
|
+
await this.request("GET", "/agents/inbound-email-rejections", {
|
|
1719
|
+
query: { agent_id: opts.agentId, limit: opts.limit }
|
|
1720
|
+
})
|
|
1721
|
+
);
|
|
1646
1722
|
}
|
|
1647
1723
|
/**
|
|
1648
1724
|
* Get the account's inbound-email overload status — whether the circuit
|
|
@@ -1684,9 +1760,13 @@ var Seclai = class {
|
|
|
1684
1760
|
* @returns Paginated list of knowledge bases.
|
|
1685
1761
|
*/
|
|
1686
1762
|
async listKnowledgeBases(opts = {}) {
|
|
1687
|
-
return
|
|
1688
|
-
|
|
1689
|
-
|
|
1763
|
+
return keyedList(
|
|
1764
|
+
await this.request("GET", "/knowledge_bases", {
|
|
1765
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1766
|
+
}),
|
|
1767
|
+
"knowledge_bases",
|
|
1768
|
+
PAGE_COUNTERS
|
|
1769
|
+
);
|
|
1690
1770
|
}
|
|
1691
1771
|
/**
|
|
1692
1772
|
* Create a new knowledge base.
|
|
@@ -1734,9 +1814,13 @@ var Seclai = class {
|
|
|
1734
1814
|
* @returns Paginated list of memory banks.
|
|
1735
1815
|
*/
|
|
1736
1816
|
async listMemoryBanks(opts = {}) {
|
|
1737
|
-
return
|
|
1738
|
-
|
|
1739
|
-
|
|
1817
|
+
return keyedList(
|
|
1818
|
+
await this.request("GET", "/memory_banks", {
|
|
1819
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1820
|
+
}),
|
|
1821
|
+
"memory_banks",
|
|
1822
|
+
PAGE_COUNTERS
|
|
1823
|
+
);
|
|
1740
1824
|
}
|
|
1741
1825
|
/**
|
|
1742
1826
|
* Create a new memory bank.
|
|
@@ -1783,7 +1867,7 @@ var Seclai = class {
|
|
|
1783
1867
|
* @param memoryBankId - Memory bank identifier.
|
|
1784
1868
|
*/
|
|
1785
1869
|
async getAgentsUsingMemoryBank(memoryBankId) {
|
|
1786
|
-
return await this.request("GET", `/memory_banks/${memoryBankId}/agents`);
|
|
1870
|
+
return listItems(await this.request("GET", `/memory_banks/${memoryBankId}/agents`));
|
|
1787
1871
|
}
|
|
1788
1872
|
/**
|
|
1789
1873
|
* Get stats for a memory bank.
|
|
@@ -1830,7 +1914,7 @@ var Seclai = class {
|
|
|
1830
1914
|
* List available memory bank templates.
|
|
1831
1915
|
*/
|
|
1832
1916
|
async listMemoryBankTemplates() {
|
|
1833
|
-
return await this.request("GET", "/memory_banks/templates");
|
|
1917
|
+
return listItems(await this.request("GET", "/memory_banks/templates"));
|
|
1834
1918
|
}
|
|
1835
1919
|
// ─── Memory Bank AI Assistant ──────────────────────────────────────────────
|
|
1836
1920
|
/**
|
|
@@ -2260,7 +2344,9 @@ var Seclai = class {
|
|
|
2260
2344
|
* @returns List of conversations.
|
|
2261
2345
|
*/
|
|
2262
2346
|
async listSolutionConversations(solutionId) {
|
|
2263
|
-
return
|
|
2347
|
+
return listItems(
|
|
2348
|
+
await this.request("GET", `/solutions/${solutionId}/conversations`)
|
|
2349
|
+
);
|
|
2264
2350
|
}
|
|
2265
2351
|
/**
|
|
2266
2352
|
* Add a conversation turn to a solution.
|
|
@@ -2349,7 +2435,9 @@ var Seclai = class {
|
|
|
2349
2435
|
* List governance AI conversations.
|
|
2350
2436
|
*/
|
|
2351
2437
|
async listGovernanceAiConversations() {
|
|
2352
|
-
return
|
|
2438
|
+
return listItems(
|
|
2439
|
+
await this.request("GET", "/governance/ai-assistant/conversations")
|
|
2440
|
+
);
|
|
2353
2441
|
}
|
|
2354
2442
|
/**
|
|
2355
2443
|
* Accept a governance AI plan.
|
|
@@ -2433,15 +2521,15 @@ var Seclai = class {
|
|
|
2433
2521
|
* @returns Paginated list of alert configs.
|
|
2434
2522
|
*/
|
|
2435
2523
|
/**
|
|
2436
|
-
*
|
|
2437
|
-
*
|
|
2438
|
-
* returns the canonical `{data, pagination}` envelope instead, so the
|
|
2439
|
-
* top-level key changes.
|
|
2524
|
+
* `configs` and `total` are populated on every API version; `data` and
|
|
2525
|
+
* `pagination` are also present once `apiVersion` is 2026-07-27 or later.
|
|
2440
2526
|
*/
|
|
2441
2527
|
async listAlertConfigs(opts = {}) {
|
|
2442
|
-
return
|
|
2443
|
-
query: { page: opts.page, limit: opts.limit }
|
|
2444
|
-
|
|
2528
|
+
return keyedList(
|
|
2529
|
+
await this.request("GET", "/alerts/configs", { query: { page: opts.page, limit: opts.limit } }),
|
|
2530
|
+
"configs",
|
|
2531
|
+
["total"]
|
|
2532
|
+
);
|
|
2445
2533
|
}
|
|
2446
2534
|
/**
|
|
2447
2535
|
* Create an alert configuration.
|
|
@@ -2484,7 +2572,11 @@ var Seclai = class {
|
|
|
2484
2572
|
* List organization alert preferences.
|
|
2485
2573
|
*/
|
|
2486
2574
|
async listOrganizationAlertPreferences() {
|
|
2487
|
-
return
|
|
2575
|
+
return keyedList(
|
|
2576
|
+
await this.request("GET", "/alerts/organization-preferences/list"),
|
|
2577
|
+
"preferences",
|
|
2578
|
+
["total"]
|
|
2579
|
+
);
|
|
2488
2580
|
}
|
|
2489
2581
|
/**
|
|
2490
2582
|
* Update an organization alert preference.
|
|
@@ -2511,9 +2603,11 @@ var Seclai = class {
|
|
|
2511
2603
|
async listModelAlerts(opts = {}) {
|
|
2512
2604
|
const limit = opts.limit ?? 50;
|
|
2513
2605
|
const offset = opts.page && opts.page > 1 ? (opts.page - 1) * limit : void 0;
|
|
2514
|
-
return
|
|
2515
|
-
query: { offset, limit: opts.limit }
|
|
2516
|
-
|
|
2606
|
+
return keyedList(
|
|
2607
|
+
await this.request("GET", "/models/alerts", { query: { offset, limit: opts.limit } }),
|
|
2608
|
+
"alerts",
|
|
2609
|
+
["total"]
|
|
2610
|
+
);
|
|
2517
2611
|
}
|
|
2518
2612
|
/**
|
|
2519
2613
|
* Mark all model alerts as read.
|
|
@@ -2549,7 +2643,7 @@ var Seclai = class {
|
|
|
2549
2643
|
* @param opts - Optional filters.
|
|
2550
2644
|
*/
|
|
2551
2645
|
async listModels(opts = {}) {
|
|
2552
|
-
return await this.request("GET", "/models", {
|
|
2646
|
+
return listItems(await this.request("GET", "/models", {
|
|
2553
2647
|
query: {
|
|
2554
2648
|
provider: opts.provider,
|
|
2555
2649
|
supports_tool_use: opts.supportsToolUse,
|
|
@@ -2557,7 +2651,7 @@ var Seclai = class {
|
|
|
2557
2651
|
supports_input_media: opts.supportsInputMedia,
|
|
2558
2652
|
supports_output_media: opts.supportsOutputMedia
|
|
2559
2653
|
}
|
|
2560
|
-
});
|
|
2654
|
+
}));
|
|
2561
2655
|
}
|
|
2562
2656
|
/**
|
|
2563
2657
|
* Get full details for a specific model.
|
|
@@ -2579,7 +2673,7 @@ var Seclai = class {
|
|
|
2579
2673
|
* Global routing/pricing (the same for every account); read-only.
|
|
2580
2674
|
*/
|
|
2581
2675
|
async getGenerationTiers() {
|
|
2582
|
-
return await this.request("GET", "/models/generation-tiers");
|
|
2676
|
+
return keyedList(await this.request("GET", "/models/generation-tiers"), "tiers");
|
|
2583
2677
|
}
|
|
2584
2678
|
/**
|
|
2585
2679
|
* List the embedding models a source can index with, and their pricing.
|
|
@@ -2592,10 +2686,11 @@ var Seclai = class {
|
|
|
2592
2686
|
* input modality — a coarse kind (text, image, video, audio) or a full MIME.
|
|
2593
2687
|
*/
|
|
2594
2688
|
async listEmbeddingModels(opts = {}) {
|
|
2595
|
-
return
|
|
2689
|
+
return keyedList(
|
|
2596
2690
|
await this.request("GET", "/models/embedders", {
|
|
2597
2691
|
query: { supports_input_media: opts.supportsInputMedia }
|
|
2598
|
-
})
|
|
2692
|
+
}),
|
|
2693
|
+
"models"
|
|
2599
2694
|
);
|
|
2600
2695
|
}
|
|
2601
2696
|
/**
|
|
@@ -2604,7 +2699,7 @@ var Seclai = class {
|
|
|
2604
2699
|
* `models` is populated on either wire shape, as for {@link Seclai.listEmbeddingModels}.
|
|
2605
2700
|
*/
|
|
2606
2701
|
async listRerankerModels() {
|
|
2607
|
-
return
|
|
2702
|
+
return keyedList(await this.request("GET", "/models/rerankers"), "models");
|
|
2608
2703
|
}
|
|
2609
2704
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2610
2705
|
// Model Playground Experiments
|
|
@@ -2615,9 +2710,13 @@ var Seclai = class {
|
|
|
2615
2710
|
* @param opts - Optional filters and pagination.
|
|
2616
2711
|
*/
|
|
2617
2712
|
async listExperiments(opts = {}) {
|
|
2618
|
-
return
|
|
2619
|
-
|
|
2620
|
-
|
|
2713
|
+
return keyedList(
|
|
2714
|
+
await this.request("GET", "/models/playground/experiments", {
|
|
2715
|
+
query: { days: opts.days, start_date: opts.startDate, end_date: opts.endDate, limit: opts.limit, offset: opts.offset }
|
|
2716
|
+
}),
|
|
2717
|
+
"experiments",
|
|
2718
|
+
["total"]
|
|
2719
|
+
);
|
|
2621
2720
|
}
|
|
2622
2721
|
/**
|
|
2623
2722
|
* Create a model playground experiment.
|
|
@@ -2794,7 +2893,7 @@ var Seclai = class {
|
|
|
2794
2893
|
* Requires a user-bound credential; an account-only API key is refused with 403.
|
|
2795
2894
|
*/
|
|
2796
2895
|
async listEmailDomains() {
|
|
2797
|
-
return await this.request("GET", "/email-domains");
|
|
2896
|
+
return keyedList(await this.request("GET", "/email-domains"), "domains");
|
|
2798
2897
|
}
|
|
2799
2898
|
/**
|
|
2800
2899
|
* Add and provision a new agent-email domain.
|