@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.cjs
CHANGED
|
@@ -423,11 +423,46 @@ function buildURL(baseUrl, path, query) {
|
|
|
423
423
|
}
|
|
424
424
|
function listItems(res) {
|
|
425
425
|
if (Array.isArray(res)) return res;
|
|
426
|
-
|
|
426
|
+
if (res !== null && typeof res === "object" && "data" in res) {
|
|
427
|
+
const data = res.data;
|
|
428
|
+
if (Array.isArray(data)) return data;
|
|
429
|
+
if (data === null) return [];
|
|
430
|
+
}
|
|
431
|
+
throw notAList();
|
|
432
|
+
}
|
|
433
|
+
function notAList() {
|
|
434
|
+
return new SeclaiError(
|
|
435
|
+
"Expected a list response: an array, or an object carrying the items under `data` or the endpoint's own key."
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
function keyedList(res, key, flat = []) {
|
|
439
|
+
if (Array.isArray(res)) return { [key]: res };
|
|
440
|
+
if (res === null || typeof res !== "object") throw notAList();
|
|
441
|
+
const body = { ...res };
|
|
442
|
+
if (Array.isArray(body.data)) body[key] = body.data;
|
|
443
|
+
else if ("data" in body && body.data === null) body[key] = [];
|
|
444
|
+
else if (!Array.isArray(body[key])) throw notAList();
|
|
445
|
+
const pagination = body.pagination;
|
|
446
|
+
for (const field of flat) {
|
|
447
|
+
if (body[field] === void 0 && pagination?.[field] !== void 0) body[field] = pagination[field];
|
|
448
|
+
}
|
|
449
|
+
return body;
|
|
450
|
+
}
|
|
451
|
+
var PAGE_COUNTERS = ["total", "page", "limit"];
|
|
452
|
+
function mergeHeaders(...layers) {
|
|
453
|
+
const byName = /* @__PURE__ */ new Map();
|
|
454
|
+
for (const layer of layers) {
|
|
455
|
+
for (const [name, value] of Object.entries(layer ?? {})) {
|
|
456
|
+
if (value === void 0 || value === null) continue;
|
|
457
|
+
const lower = name.toLowerCase();
|
|
458
|
+
byName.delete(lower);
|
|
459
|
+
byName.set(lower, [name, value]);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return Object.fromEntries(byName.values());
|
|
427
463
|
}
|
|
428
|
-
function
|
|
429
|
-
|
|
430
|
-
return Array.isArray(body.models) || !Array.isArray(body.data) ? body : { ...body, models: body.data };
|
|
464
|
+
function headerKey(headers, name) {
|
|
465
|
+
return Object.keys(headers ?? {}).filter((key) => key.toLowerCase() === name).pop();
|
|
431
466
|
}
|
|
432
467
|
async function safeText(response) {
|
|
433
468
|
try {
|
|
@@ -544,6 +579,7 @@ function inferMimeType(fileName) {
|
|
|
544
579
|
var Seclai = class {
|
|
545
580
|
baseUrl;
|
|
546
581
|
defaultHeaders;
|
|
582
|
+
allowUnknownApiVersion;
|
|
547
583
|
fetcher;
|
|
548
584
|
_authState = null;
|
|
549
585
|
_authInitPromise = null;
|
|
@@ -574,22 +610,13 @@ var Seclai = class {
|
|
|
574
610
|
);
|
|
575
611
|
}
|
|
576
612
|
this.baseUrl = opts.baseUrl ?? getEnv2("SECLAI_API_URL") ?? SECLAI_API_URL;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (key.toLowerCase() === "seclai-version") versionKey = key;
|
|
585
|
-
}
|
|
586
|
-
const effectiveVersion = versionKey ? merged[versionKey] : void 0;
|
|
587
|
-
if (effectiveVersion && !opts.allowUnknownApiVersion && !KNOWN_API_VERSIONS.includes(effectiveVersion)) {
|
|
588
|
-
const via = versionKey === "Seclai-Version" && merged[versionKey] === opts.apiVersion ? "apiVersion" : `defaultHeaders['${versionKey}']`;
|
|
589
|
-
throw new SeclaiConfigurationError(
|
|
590
|
-
`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.`
|
|
591
|
-
);
|
|
592
|
-
}
|
|
613
|
+
this.allowUnknownApiVersion = opts.allowUnknownApiVersion ?? false;
|
|
614
|
+
const merged = mergeHeaders(
|
|
615
|
+
opts.apiVersion ? { "Seclai-Version": opts.apiVersion } : void 0,
|
|
616
|
+
opts.defaultHeaders
|
|
617
|
+
);
|
|
618
|
+
const defaultKey = headerKey(opts.defaultHeaders, "seclai-version");
|
|
619
|
+
this.assertKnownApiVersion(merged, defaultKey ? `defaultHeaders['${defaultKey}']` : "apiVersion");
|
|
593
620
|
this.defaultHeaders = merged;
|
|
594
621
|
this.fetcher = fetcher;
|
|
595
622
|
const accessTokenProvider = typeof opts.accessToken === "function" ? opts.accessToken : void 0;
|
|
@@ -628,6 +655,26 @@ var Seclai = class {
|
|
|
628
655
|
}
|
|
629
656
|
return this._authState;
|
|
630
657
|
}
|
|
658
|
+
/** Throw unless the `Seclai-Version` in `headers` is one this release was built against. */
|
|
659
|
+
assertKnownApiVersion(headers, via) {
|
|
660
|
+
const key = headerKey(headers, "seclai-version");
|
|
661
|
+
if (key === void 0 || this.allowUnknownApiVersion) return;
|
|
662
|
+
const version = headers[key] ?? "";
|
|
663
|
+
if (KNOWN_API_VERSIONS.includes(version)) return;
|
|
664
|
+
throw new SeclaiConfigurationError(
|
|
665
|
+
`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.`
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* The headers one request sends: `layers` merged in order, later winning,
|
|
670
|
+
* with the resulting `Seclai-Version` checked against the known versions.
|
|
671
|
+
*/
|
|
672
|
+
requestHeaders(layers, perRequest) {
|
|
673
|
+
const headers = mergeHeaders(...layers);
|
|
674
|
+
const requestKey = headerKey(perRequest, "seclai-version");
|
|
675
|
+
this.assertKnownApiVersion(headers, requestKey ? `headers['${requestKey}']` : "defaultHeaders");
|
|
676
|
+
return headers;
|
|
677
|
+
}
|
|
631
678
|
/** Resolve auth headers for the current request. */
|
|
632
679
|
async authHeaders() {
|
|
633
680
|
const state = await this.ensureAuth();
|
|
@@ -651,16 +698,17 @@ var Seclai = class {
|
|
|
651
698
|
async request(method, path, opts) {
|
|
652
699
|
const url = buildURL(this.baseUrl, path, opts?.query);
|
|
653
700
|
const authHeaders = await this.authHeaders();
|
|
654
|
-
const headers = {
|
|
655
|
-
...this.defaultHeaders,
|
|
656
|
-
...opts?.headers ?? {},
|
|
657
|
-
...authHeaders
|
|
658
|
-
};
|
|
659
701
|
let body;
|
|
660
|
-
if (opts?.json !== void 0)
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
702
|
+
if (opts?.json !== void 0) body = JSON.stringify(opts.json);
|
|
703
|
+
const headers = this.requestHeaders(
|
|
704
|
+
[
|
|
705
|
+
body === void 0 ? void 0 : { "content-type": "application/json" },
|
|
706
|
+
this.defaultHeaders,
|
|
707
|
+
opts?.headers,
|
|
708
|
+
authHeaders
|
|
709
|
+
],
|
|
710
|
+
opts?.headers
|
|
711
|
+
);
|
|
664
712
|
const init = { method, headers };
|
|
665
713
|
if (body !== void 0) {
|
|
666
714
|
init.body = body;
|
|
@@ -712,16 +760,17 @@ var Seclai = class {
|
|
|
712
760
|
async requestRaw(method, path, opts) {
|
|
713
761
|
const url = buildURL(this.baseUrl, path, opts?.query);
|
|
714
762
|
const authHeaders = await this.authHeaders();
|
|
715
|
-
const headers = {
|
|
716
|
-
...this.defaultHeaders,
|
|
717
|
-
...opts?.headers ?? {},
|
|
718
|
-
...authHeaders
|
|
719
|
-
};
|
|
720
763
|
let body;
|
|
721
|
-
if (opts?.json !== void 0)
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
764
|
+
if (opts?.json !== void 0) body = JSON.stringify(opts.json);
|
|
765
|
+
const headers = this.requestHeaders(
|
|
766
|
+
[
|
|
767
|
+
body === void 0 ? void 0 : { "content-type": "application/json" },
|
|
768
|
+
this.defaultHeaders,
|
|
769
|
+
opts?.headers,
|
|
770
|
+
authHeaders
|
|
771
|
+
],
|
|
772
|
+
opts?.headers
|
|
773
|
+
);
|
|
725
774
|
const init = { method, headers };
|
|
726
775
|
if (body !== void 0) init.body = body;
|
|
727
776
|
if (opts?.signal) init.signal = opts.signal;
|
|
@@ -753,12 +802,9 @@ var Seclai = class {
|
|
|
753
802
|
async uploadFile(path, opts) {
|
|
754
803
|
const url = buildURL(this.baseUrl, path);
|
|
755
804
|
const authHeaders = await this.authHeaders();
|
|
756
|
-
const headers =
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
};
|
|
760
|
-
delete headers["content-type"];
|
|
761
|
-
delete headers["Content-Type"];
|
|
805
|
+
const headers = this.requestHeaders([this.defaultHeaders, authHeaders]);
|
|
806
|
+
const contentType = headerKey(headers, "content-type");
|
|
807
|
+
if (contentType !== void 0) delete headers[contentType];
|
|
762
808
|
const form = new FormData();
|
|
763
809
|
const mimeType = opts.mimeType ?? inferMimeType(opts.fileName);
|
|
764
810
|
const blob = toBlob(opts.file, mimeType);
|
|
@@ -925,7 +971,7 @@ var Seclai = class {
|
|
|
925
971
|
* @returns The calling agents.
|
|
926
972
|
*/
|
|
927
973
|
async getAgentCallers(agentId) {
|
|
928
|
-
return await this.request("GET", `/agents/${agentId}/callers`);
|
|
974
|
+
return listItems(await this.request("GET", `/agents/${agentId}/callers`));
|
|
929
975
|
}
|
|
930
976
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
931
977
|
// Agent Export / Import
|
|
@@ -1074,12 +1120,11 @@ var Seclai = class {
|
|
|
1074
1120
|
async runStreamingAgentAndWait(agentId, body, opts) {
|
|
1075
1121
|
const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
|
|
1076
1122
|
const authHdrs = await this.authHeaders();
|
|
1077
|
-
const headers =
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
accept: "text/event-stream",
|
|
1081
|
-
|
|
1082
|
-
};
|
|
1123
|
+
const headers = this.requestHeaders([
|
|
1124
|
+
this.defaultHeaders,
|
|
1125
|
+
authHdrs,
|
|
1126
|
+
{ accept: "text/event-stream", "content-type": "application/json" }
|
|
1127
|
+
]);
|
|
1083
1128
|
const timeoutMs = opts?.timeoutMs ?? 6e4;
|
|
1084
1129
|
const timeoutController = new AbortController();
|
|
1085
1130
|
let timedOut = false;
|
|
@@ -1184,12 +1229,11 @@ var Seclai = class {
|
|
|
1184
1229
|
async *runStreamingAgent(agentId, body, opts) {
|
|
1185
1230
|
const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
|
|
1186
1231
|
const authHdrs = await this.authHeaders();
|
|
1187
|
-
const headers =
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
accept: "text/event-stream",
|
|
1191
|
-
|
|
1192
|
-
};
|
|
1232
|
+
const headers = this.requestHeaders([
|
|
1233
|
+
this.defaultHeaders,
|
|
1234
|
+
authHdrs,
|
|
1235
|
+
{ accept: "text/event-stream", "content-type": "application/json" }
|
|
1236
|
+
]);
|
|
1193
1237
|
const timeoutMs = opts?.timeoutMs ?? 6e4;
|
|
1194
1238
|
const timeoutController = new AbortController();
|
|
1195
1239
|
let timedOut = false;
|
|
@@ -1320,10 +1364,13 @@ var Seclai = class {
|
|
|
1320
1364
|
* @returns Paginated list of evaluation results.
|
|
1321
1365
|
*/
|
|
1322
1366
|
async listRunEvaluationResults(agentId, runId, opts = {}) {
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1367
|
+
return keyedList(
|
|
1368
|
+
await this.request("GET", `/agents/${agentId}/runs/${runId}/evaluation-results`, {
|
|
1369
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1370
|
+
}),
|
|
1371
|
+
"data",
|
|
1372
|
+
PAGE_COUNTERS
|
|
1373
|
+
);
|
|
1327
1374
|
}
|
|
1328
1375
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1329
1376
|
// Agent Input Uploads
|
|
@@ -1451,20 +1498,21 @@ var Seclai = class {
|
|
|
1451
1498
|
/**
|
|
1452
1499
|
* List evaluation criteria for an agent, with pagination metadata.
|
|
1453
1500
|
*
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1457
|
-
* when the endpoint answers with a bare array.
|
|
1501
|
+
* The endpoint answers with a bare array by default and with `{data,
|
|
1502
|
+
* pagination}` once `apiVersion` is 2026-07-27 or later; `pagination` is
|
|
1503
|
+
* absent on the bare array.
|
|
1458
1504
|
*
|
|
1459
1505
|
* @param agentId - Agent identifier.
|
|
1460
1506
|
* @param opts - Pagination options.
|
|
1461
1507
|
* @returns The criteria under `data`, plus the page metadata when present.
|
|
1462
1508
|
*/
|
|
1463
1509
|
async listEvaluationCriteriaPage(agentId, opts = {}) {
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1510
|
+
return keyedList(
|
|
1511
|
+
await this.request("GET", `/agents/${agentId}/evaluation-criteria`, {
|
|
1512
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1513
|
+
}),
|
|
1514
|
+
"data"
|
|
1515
|
+
);
|
|
1468
1516
|
}
|
|
1469
1517
|
/**
|
|
1470
1518
|
* Create evaluation criteria for an agent.
|
|
@@ -1519,9 +1567,13 @@ var Seclai = class {
|
|
|
1519
1567
|
* @param opts - Pagination options.
|
|
1520
1568
|
*/
|
|
1521
1569
|
async listEvaluationResults(criteriaId, opts = {}) {
|
|
1522
|
-
return
|
|
1523
|
-
|
|
1524
|
-
|
|
1570
|
+
return keyedList(
|
|
1571
|
+
await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/results`, {
|
|
1572
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1573
|
+
}),
|
|
1574
|
+
"data",
|
|
1575
|
+
PAGE_COUNTERS
|
|
1576
|
+
);
|
|
1525
1577
|
}
|
|
1526
1578
|
/**
|
|
1527
1579
|
* Create a manual evaluation result for a criteria.
|
|
@@ -1540,9 +1592,13 @@ var Seclai = class {
|
|
|
1540
1592
|
* @param opts - Pagination options.
|
|
1541
1593
|
*/
|
|
1542
1594
|
async listCompatibleRuns(criteriaId, opts = {}) {
|
|
1543
|
-
return
|
|
1544
|
-
|
|
1545
|
-
|
|
1595
|
+
return keyedList(
|
|
1596
|
+
await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/compatible-runs`, {
|
|
1597
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1598
|
+
}),
|
|
1599
|
+
"data",
|
|
1600
|
+
PAGE_COUNTERS
|
|
1601
|
+
);
|
|
1546
1602
|
}
|
|
1547
1603
|
/**
|
|
1548
1604
|
* Test a draft evaluation criteria without persisting it.
|
|
@@ -1561,9 +1617,13 @@ var Seclai = class {
|
|
|
1561
1617
|
* @param opts - Pagination options.
|
|
1562
1618
|
*/
|
|
1563
1619
|
async listAgentEvaluationResults(agentId, opts = {}) {
|
|
1564
|
-
return
|
|
1565
|
-
|
|
1566
|
-
|
|
1620
|
+
return keyedList(
|
|
1621
|
+
await this.request("GET", `/agents/${agentId}/evaluation-results`, {
|
|
1622
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1623
|
+
}),
|
|
1624
|
+
"data",
|
|
1625
|
+
PAGE_COUNTERS
|
|
1626
|
+
);
|
|
1567
1627
|
}
|
|
1568
1628
|
/**
|
|
1569
1629
|
* List evaluation run summaries for an agent.
|
|
@@ -1572,9 +1632,13 @@ var Seclai = class {
|
|
|
1572
1632
|
* @param opts - Pagination options.
|
|
1573
1633
|
*/
|
|
1574
1634
|
async listEvaluationRuns(agentId, opts = {}) {
|
|
1575
|
-
return
|
|
1576
|
-
|
|
1577
|
-
|
|
1635
|
+
return keyedList(
|
|
1636
|
+
await this.request("GET", `/agents/${agentId}/evaluation-runs`, {
|
|
1637
|
+
query: { page: opts.page, limit: opts.limit }
|
|
1638
|
+
}),
|
|
1639
|
+
"data",
|
|
1640
|
+
PAGE_COUNTERS
|
|
1641
|
+
);
|
|
1578
1642
|
}
|
|
1579
1643
|
/**
|
|
1580
1644
|
* Get a summary of non-manual evaluations across an agent's runs.
|
|
@@ -1620,9 +1684,13 @@ var Seclai = class {
|
|
|
1620
1684
|
* @returns The page of opt-outs plus the total count.
|
|
1621
1685
|
*/
|
|
1622
1686
|
async listAgentEmailOptOuts(opts = {}) {
|
|
1623
|
-
return
|
|
1624
|
-
|
|
1625
|
-
|
|
1687
|
+
return keyedList(
|
|
1688
|
+
await this.request("GET", "/agents/agent-email-optouts", {
|
|
1689
|
+
query: { agent_id: opts.agentId, limit: opts.limit, offset: opts.offset }
|
|
1690
|
+
}),
|
|
1691
|
+
"items",
|
|
1692
|
+
["total"]
|
|
1693
|
+
);
|
|
1626
1694
|
}
|
|
1627
1695
|
/**
|
|
1628
1696
|
* Revoke an opt-out, opting the recipient back in to agent emails.
|
|
@@ -1641,9 +1709,13 @@ var Seclai = class {
|
|
|
1641
1709
|
* @param opts.offset - Rows to skip (default 0).
|
|
1642
1710
|
*/
|
|
1643
1711
|
async listBlockedEmailSenders(opts = {}) {
|
|
1644
|
-
return
|
|
1645
|
-
|
|
1646
|
-
|
|
1712
|
+
return keyedList(
|
|
1713
|
+
await this.request("GET", "/agents/blocked-email-senders", {
|
|
1714
|
+
query: { limit: opts.limit, offset: opts.offset }
|
|
1715
|
+
}),
|
|
1716
|
+
"items",
|
|
1717
|
+
["total"]
|
|
1718
|
+
);
|
|
1647
1719
|
}
|
|
1648
1720
|
/**
|
|
1649
1721
|
* Add a sender address or a whole domain to the account blocklist.
|
|
@@ -1678,9 +1750,11 @@ var Seclai = class {
|
|
|
1678
1750
|
* @returns The updated blocked-sender list.
|
|
1679
1751
|
*/
|
|
1680
1752
|
async setAutoBlockMode(body) {
|
|
1681
|
-
return
|
|
1682
|
-
json: body
|
|
1683
|
-
|
|
1753
|
+
return keyedList(
|
|
1754
|
+
await this.request("PUT", "/agents/blocked-email-senders/mode", { json: body }),
|
|
1755
|
+
"items",
|
|
1756
|
+
["total"]
|
|
1757
|
+
);
|
|
1684
1758
|
}
|
|
1685
1759
|
/**
|
|
1686
1760
|
* List recent inbound emails that were quietly discarded before running an
|
|
@@ -1691,9 +1765,11 @@ var Seclai = class {
|
|
|
1691
1765
|
* @param opts.limit - Maximum results (1-200, default 50).
|
|
1692
1766
|
*/
|
|
1693
1767
|
async listInboundEmailRejections(opts = {}) {
|
|
1694
|
-
return
|
|
1695
|
-
|
|
1696
|
-
|
|
1768
|
+
return listItems(
|
|
1769
|
+
await this.request("GET", "/agents/inbound-email-rejections", {
|
|
1770
|
+
query: { agent_id: opts.agentId, limit: opts.limit }
|
|
1771
|
+
})
|
|
1772
|
+
);
|
|
1697
1773
|
}
|
|
1698
1774
|
/**
|
|
1699
1775
|
* Get the account's inbound-email overload status — whether the circuit
|
|
@@ -1735,9 +1811,13 @@ var Seclai = class {
|
|
|
1735
1811
|
* @returns Paginated list of knowledge bases.
|
|
1736
1812
|
*/
|
|
1737
1813
|
async listKnowledgeBases(opts = {}) {
|
|
1738
|
-
return
|
|
1739
|
-
|
|
1740
|
-
|
|
1814
|
+
return keyedList(
|
|
1815
|
+
await this.request("GET", "/knowledge_bases", {
|
|
1816
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1817
|
+
}),
|
|
1818
|
+
"knowledge_bases",
|
|
1819
|
+
PAGE_COUNTERS
|
|
1820
|
+
);
|
|
1741
1821
|
}
|
|
1742
1822
|
/**
|
|
1743
1823
|
* Create a new knowledge base.
|
|
@@ -1785,9 +1865,13 @@ var Seclai = class {
|
|
|
1785
1865
|
* @returns Paginated list of memory banks.
|
|
1786
1866
|
*/
|
|
1787
1867
|
async listMemoryBanks(opts = {}) {
|
|
1788
|
-
return
|
|
1789
|
-
|
|
1790
|
-
|
|
1868
|
+
return keyedList(
|
|
1869
|
+
await this.request("GET", "/memory_banks", {
|
|
1870
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1871
|
+
}),
|
|
1872
|
+
"memory_banks",
|
|
1873
|
+
PAGE_COUNTERS
|
|
1874
|
+
);
|
|
1791
1875
|
}
|
|
1792
1876
|
/**
|
|
1793
1877
|
* Create a new memory bank.
|
|
@@ -1834,7 +1918,7 @@ var Seclai = class {
|
|
|
1834
1918
|
* @param memoryBankId - Memory bank identifier.
|
|
1835
1919
|
*/
|
|
1836
1920
|
async getAgentsUsingMemoryBank(memoryBankId) {
|
|
1837
|
-
return await this.request("GET", `/memory_banks/${memoryBankId}/agents`);
|
|
1921
|
+
return listItems(await this.request("GET", `/memory_banks/${memoryBankId}/agents`));
|
|
1838
1922
|
}
|
|
1839
1923
|
/**
|
|
1840
1924
|
* Get stats for a memory bank.
|
|
@@ -1881,7 +1965,7 @@ var Seclai = class {
|
|
|
1881
1965
|
* List available memory bank templates.
|
|
1882
1966
|
*/
|
|
1883
1967
|
async listMemoryBankTemplates() {
|
|
1884
|
-
return await this.request("GET", "/memory_banks/templates");
|
|
1968
|
+
return listItems(await this.request("GET", "/memory_banks/templates"));
|
|
1885
1969
|
}
|
|
1886
1970
|
// ─── Memory Bank AI Assistant ──────────────────────────────────────────────
|
|
1887
1971
|
/**
|
|
@@ -2311,7 +2395,9 @@ var Seclai = class {
|
|
|
2311
2395
|
* @returns List of conversations.
|
|
2312
2396
|
*/
|
|
2313
2397
|
async listSolutionConversations(solutionId) {
|
|
2314
|
-
return
|
|
2398
|
+
return listItems(
|
|
2399
|
+
await this.request("GET", `/solutions/${solutionId}/conversations`)
|
|
2400
|
+
);
|
|
2315
2401
|
}
|
|
2316
2402
|
/**
|
|
2317
2403
|
* Add a conversation turn to a solution.
|
|
@@ -2400,7 +2486,9 @@ var Seclai = class {
|
|
|
2400
2486
|
* List governance AI conversations.
|
|
2401
2487
|
*/
|
|
2402
2488
|
async listGovernanceAiConversations() {
|
|
2403
|
-
return
|
|
2489
|
+
return listItems(
|
|
2490
|
+
await this.request("GET", "/governance/ai-assistant/conversations")
|
|
2491
|
+
);
|
|
2404
2492
|
}
|
|
2405
2493
|
/**
|
|
2406
2494
|
* Accept a governance AI plan.
|
|
@@ -2484,15 +2572,15 @@ var Seclai = class {
|
|
|
2484
2572
|
* @returns Paginated list of alert configs.
|
|
2485
2573
|
*/
|
|
2486
2574
|
/**
|
|
2487
|
-
*
|
|
2488
|
-
*
|
|
2489
|
-
* returns the canonical `{data, pagination}` envelope instead, so the
|
|
2490
|
-
* top-level key changes.
|
|
2575
|
+
* `configs` and `total` are populated on every API version; `data` and
|
|
2576
|
+
* `pagination` are also present once `apiVersion` is 2026-07-27 or later.
|
|
2491
2577
|
*/
|
|
2492
2578
|
async listAlertConfigs(opts = {}) {
|
|
2493
|
-
return
|
|
2494
|
-
query: { page: opts.page, limit: opts.limit }
|
|
2495
|
-
|
|
2579
|
+
return keyedList(
|
|
2580
|
+
await this.request("GET", "/alerts/configs", { query: { page: opts.page, limit: opts.limit } }),
|
|
2581
|
+
"configs",
|
|
2582
|
+
["total"]
|
|
2583
|
+
);
|
|
2496
2584
|
}
|
|
2497
2585
|
/**
|
|
2498
2586
|
* Create an alert configuration.
|
|
@@ -2535,7 +2623,11 @@ var Seclai = class {
|
|
|
2535
2623
|
* List organization alert preferences.
|
|
2536
2624
|
*/
|
|
2537
2625
|
async listOrganizationAlertPreferences() {
|
|
2538
|
-
return
|
|
2626
|
+
return keyedList(
|
|
2627
|
+
await this.request("GET", "/alerts/organization-preferences/list"),
|
|
2628
|
+
"preferences",
|
|
2629
|
+
["total"]
|
|
2630
|
+
);
|
|
2539
2631
|
}
|
|
2540
2632
|
/**
|
|
2541
2633
|
* Update an organization alert preference.
|
|
@@ -2562,9 +2654,11 @@ var Seclai = class {
|
|
|
2562
2654
|
async listModelAlerts(opts = {}) {
|
|
2563
2655
|
const limit = opts.limit ?? 50;
|
|
2564
2656
|
const offset = opts.page && opts.page > 1 ? (opts.page - 1) * limit : void 0;
|
|
2565
|
-
return
|
|
2566
|
-
query: { offset, limit: opts.limit }
|
|
2567
|
-
|
|
2657
|
+
return keyedList(
|
|
2658
|
+
await this.request("GET", "/models/alerts", { query: { offset, limit: opts.limit } }),
|
|
2659
|
+
"alerts",
|
|
2660
|
+
["total"]
|
|
2661
|
+
);
|
|
2568
2662
|
}
|
|
2569
2663
|
/**
|
|
2570
2664
|
* Mark all model alerts as read.
|
|
@@ -2600,7 +2694,7 @@ var Seclai = class {
|
|
|
2600
2694
|
* @param opts - Optional filters.
|
|
2601
2695
|
*/
|
|
2602
2696
|
async listModels(opts = {}) {
|
|
2603
|
-
return await this.request("GET", "/models", {
|
|
2697
|
+
return listItems(await this.request("GET", "/models", {
|
|
2604
2698
|
query: {
|
|
2605
2699
|
provider: opts.provider,
|
|
2606
2700
|
supports_tool_use: opts.supportsToolUse,
|
|
@@ -2608,7 +2702,7 @@ var Seclai = class {
|
|
|
2608
2702
|
supports_input_media: opts.supportsInputMedia,
|
|
2609
2703
|
supports_output_media: opts.supportsOutputMedia
|
|
2610
2704
|
}
|
|
2611
|
-
});
|
|
2705
|
+
}));
|
|
2612
2706
|
}
|
|
2613
2707
|
/**
|
|
2614
2708
|
* Get full details for a specific model.
|
|
@@ -2630,7 +2724,7 @@ var Seclai = class {
|
|
|
2630
2724
|
* Global routing/pricing (the same for every account); read-only.
|
|
2631
2725
|
*/
|
|
2632
2726
|
async getGenerationTiers() {
|
|
2633
|
-
return await this.request("GET", "/models/generation-tiers");
|
|
2727
|
+
return keyedList(await this.request("GET", "/models/generation-tiers"), "tiers");
|
|
2634
2728
|
}
|
|
2635
2729
|
/**
|
|
2636
2730
|
* List the embedding models a source can index with, and their pricing.
|
|
@@ -2643,10 +2737,11 @@ var Seclai = class {
|
|
|
2643
2737
|
* input modality — a coarse kind (text, image, video, audio) or a full MIME.
|
|
2644
2738
|
*/
|
|
2645
2739
|
async listEmbeddingModels(opts = {}) {
|
|
2646
|
-
return
|
|
2740
|
+
return keyedList(
|
|
2647
2741
|
await this.request("GET", "/models/embedders", {
|
|
2648
2742
|
query: { supports_input_media: opts.supportsInputMedia }
|
|
2649
|
-
})
|
|
2743
|
+
}),
|
|
2744
|
+
"models"
|
|
2650
2745
|
);
|
|
2651
2746
|
}
|
|
2652
2747
|
/**
|
|
@@ -2655,7 +2750,7 @@ var Seclai = class {
|
|
|
2655
2750
|
* `models` is populated on either wire shape, as for {@link Seclai.listEmbeddingModels}.
|
|
2656
2751
|
*/
|
|
2657
2752
|
async listRerankerModels() {
|
|
2658
|
-
return
|
|
2753
|
+
return keyedList(await this.request("GET", "/models/rerankers"), "models");
|
|
2659
2754
|
}
|
|
2660
2755
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2661
2756
|
// Model Playground Experiments
|
|
@@ -2666,9 +2761,13 @@ var Seclai = class {
|
|
|
2666
2761
|
* @param opts - Optional filters and pagination.
|
|
2667
2762
|
*/
|
|
2668
2763
|
async listExperiments(opts = {}) {
|
|
2669
|
-
return
|
|
2670
|
-
|
|
2671
|
-
|
|
2764
|
+
return keyedList(
|
|
2765
|
+
await this.request("GET", "/models/playground/experiments", {
|
|
2766
|
+
query: { days: opts.days, start_date: opts.startDate, end_date: opts.endDate, limit: opts.limit, offset: opts.offset }
|
|
2767
|
+
}),
|
|
2768
|
+
"experiments",
|
|
2769
|
+
["total"]
|
|
2770
|
+
);
|
|
2672
2771
|
}
|
|
2673
2772
|
/**
|
|
2674
2773
|
* Create a model playground experiment.
|
|
@@ -2845,7 +2944,7 @@ var Seclai = class {
|
|
|
2845
2944
|
* Requires a user-bound credential; an account-only API key is refused with 403.
|
|
2846
2945
|
*/
|
|
2847
2946
|
async listEmailDomains() {
|
|
2848
|
-
return await this.request("GET", "/email-domains");
|
|
2947
|
+
return keyedList(await this.request("GET", "/email-domains"), "domains");
|
|
2849
2948
|
}
|
|
2850
2949
|
/**
|
|
2851
2950
|
* Add and provision a new agent-email domain.
|