@seclai/sdk 1.3.0 → 1.5.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/CHANGELOG.md +206 -0
- package/README.md +181 -2
- package/dist/index.cjs +473 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1492 -29
- package/dist/index.d.ts +1492 -29
- package/dist/index.js +472 -13
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
Seclai: () => Seclai,
|
|
38
38
|
SeclaiAPIStatusError: () => SeclaiAPIStatusError,
|
|
39
39
|
SeclaiAPIValidationError: () => SeclaiAPIValidationError,
|
|
40
|
+
SeclaiApiVersion: () => SeclaiApiVersion,
|
|
40
41
|
SeclaiConfigurationError: () => SeclaiConfigurationError,
|
|
41
42
|
SeclaiError: () => SeclaiError,
|
|
42
43
|
SeclaiStreamingError: () => SeclaiStreamingError,
|
|
@@ -48,6 +49,17 @@ __export(index_exports, {
|
|
|
48
49
|
});
|
|
49
50
|
module.exports = __toCommonJS(index_exports);
|
|
50
51
|
|
|
52
|
+
// src/versions.ts
|
|
53
|
+
var SeclaiApiVersion = {
|
|
54
|
+
V2026_07_01: "2026-07-01",
|
|
55
|
+
V2026_07_27: "2026-07-27",
|
|
56
|
+
/** Baseline applied to an unpinned, header-less caller. */
|
|
57
|
+
Default: "2026-07-01",
|
|
58
|
+
/** Newest version known to this SDK release. May lag the server. */
|
|
59
|
+
Latest: "2026-07-27"
|
|
60
|
+
};
|
|
61
|
+
var KNOWN_API_VERSIONS = Object.entries(SeclaiApiVersion).filter(([k]) => k.startsWith("V")).map(([, v]) => v);
|
|
62
|
+
|
|
51
63
|
// src/errors.ts
|
|
52
64
|
var SeclaiError = class extends Error {
|
|
53
65
|
constructor(message) {
|
|
@@ -545,7 +557,23 @@ var Seclai = class {
|
|
|
545
557
|
);
|
|
546
558
|
}
|
|
547
559
|
this.baseUrl = opts.baseUrl ?? getEnv2("SECLAI_API_URL") ?? SECLAI_API_URL;
|
|
548
|
-
|
|
560
|
+
const merged = opts.apiVersion ? { "Seclai-Version": opts.apiVersion } : {};
|
|
561
|
+
let versionKey = opts.apiVersion ? "Seclai-Version" : void 0;
|
|
562
|
+
for (const [key, value] of Object.entries(opts.defaultHeaders ?? {})) {
|
|
563
|
+
for (const existing of Object.keys(merged)) {
|
|
564
|
+
if (existing.toLowerCase() === key.toLowerCase()) delete merged[existing];
|
|
565
|
+
}
|
|
566
|
+
merged[key] = value;
|
|
567
|
+
if (key.toLowerCase() === "seclai-version") versionKey = key;
|
|
568
|
+
}
|
|
569
|
+
const effectiveVersion = versionKey ? merged[versionKey] : void 0;
|
|
570
|
+
if (effectiveVersion && !opts.allowUnknownApiVersion && !KNOWN_API_VERSIONS.includes(effectiveVersion)) {
|
|
571
|
+
const via = versionKey === "Seclai-Version" && merged[versionKey] === opts.apiVersion ? "apiVersion" : `defaultHeaders['${versionKey}']`;
|
|
572
|
+
throw new SeclaiConfigurationError(
|
|
573
|
+
`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.`
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
this.defaultHeaders = merged;
|
|
549
577
|
this.fetcher = fetcher;
|
|
550
578
|
const accessTokenProvider = typeof opts.accessToken === "function" ? opts.accessToken : void 0;
|
|
551
579
|
const accessTokenStatic = typeof opts.accessToken === "string" ? opts.accessToken : void 0;
|
|
@@ -747,6 +775,50 @@ var Seclai = class {
|
|
|
747
775
|
return await response.json();
|
|
748
776
|
}
|
|
749
777
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
778
|
+
// Identity
|
|
779
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
780
|
+
/**
|
|
781
|
+
* Get the authenticated user's identity.
|
|
782
|
+
*
|
|
783
|
+
* Returns the personal `account_id` plus every organization the user belongs
|
|
784
|
+
* to — each with its own `id`, display `name`, and `account_id`. Use it to
|
|
785
|
+
* discover the account IDs that can be passed as the client's `accountId`
|
|
786
|
+
* option (sent as the `X-Account-Id` header) to target an org context.
|
|
787
|
+
*
|
|
788
|
+
* @returns The current user's account ID and organization memberships.
|
|
789
|
+
*/
|
|
790
|
+
async getMe() {
|
|
791
|
+
return await this.request("GET", "/me");
|
|
792
|
+
}
|
|
793
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
794
|
+
// API Version
|
|
795
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
796
|
+
/**
|
|
797
|
+
* Read the API version this request resolved to, and the versions available.
|
|
798
|
+
*
|
|
799
|
+
* Resolution order is the `Seclai-Version` header, then the account pin, then
|
|
800
|
+
* the default — so `effective_version` reflects the client's `apiVersion`
|
|
801
|
+
* option when that is set.
|
|
802
|
+
*
|
|
803
|
+
* @returns The pinned, effective, default and latest versions.
|
|
804
|
+
*/
|
|
805
|
+
async getApiVersion() {
|
|
806
|
+
return await this.request("GET", "/version");
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Pin the account to a dated API version, or clear the pin.
|
|
810
|
+
*
|
|
811
|
+
* Owner/admin only. The pin applies to later header-less requests; a
|
|
812
|
+
* `Seclai-Version` header still overrides it, so `effective_version` in the
|
|
813
|
+
* response describes this request rather than the pin just written.
|
|
814
|
+
*
|
|
815
|
+
* @param version - A `YYYY-MM-DD` date to pin to, or `null` to clear the pin.
|
|
816
|
+
* @returns The updated version state.
|
|
817
|
+
*/
|
|
818
|
+
async updateApiVersion(version) {
|
|
819
|
+
return await this.request("PUT", "/version", { json: { version } });
|
|
820
|
+
}
|
|
821
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
750
822
|
// Agents — CRUD
|
|
751
823
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
752
824
|
/**
|
|
@@ -797,6 +869,48 @@ var Seclai = class {
|
|
|
797
869
|
await this.request("DELETE", `/agents/${agentId}`);
|
|
798
870
|
}
|
|
799
871
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
872
|
+
// Agents — Enable / Disable
|
|
873
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
874
|
+
/**
|
|
875
|
+
* Pause (disable) an agent so it stops firing from every trigger path.
|
|
876
|
+
*
|
|
877
|
+
* API runs return HTTP 409, inbound email is turned away, and scheduled /
|
|
878
|
+
* content triggers are skipped.
|
|
879
|
+
*
|
|
880
|
+
* Fails with HTTP 409 when other live agents still call this one via a
|
|
881
|
+
* `call_agent` step — use {@link getAgentCallers} to list them, and disable
|
|
882
|
+
* those first.
|
|
883
|
+
*
|
|
884
|
+
* @param agentId - Agent identifier.
|
|
885
|
+
* @returns The updated agent summary.
|
|
886
|
+
*/
|
|
887
|
+
async disableAgent(agentId) {
|
|
888
|
+
return await this.request("POST", `/agents/${agentId}/disable`);
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Resume (enable) a paused agent.
|
|
892
|
+
*
|
|
893
|
+
* Clears the disable state whether the agent was paused manually or
|
|
894
|
+
* auto-paused by the inbound-email overload safeguard.
|
|
895
|
+
*
|
|
896
|
+
* @param agentId - Agent identifier.
|
|
897
|
+
* @returns The updated agent summary.
|
|
898
|
+
*/
|
|
899
|
+
async enableAgent(agentId) {
|
|
900
|
+
return await this.request("POST", `/agents/${agentId}/enable`);
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* List the live agents that call this agent via a `call_agent` step.
|
|
904
|
+
*
|
|
905
|
+
* These must be disabled before this agent can be paused.
|
|
906
|
+
*
|
|
907
|
+
* @param agentId - Agent identifier.
|
|
908
|
+
* @returns The calling agents.
|
|
909
|
+
*/
|
|
910
|
+
async getAgentCallers(agentId) {
|
|
911
|
+
return await this.request("GET", `/agents/${agentId}/callers`);
|
|
912
|
+
}
|
|
913
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
800
914
|
// Agent Export / Import
|
|
801
915
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
802
916
|
/**
|
|
@@ -901,21 +1015,29 @@ var Seclai = class {
|
|
|
901
1015
|
} : void 0);
|
|
902
1016
|
}
|
|
903
1017
|
/**
|
|
904
|
-
*
|
|
1018
|
+
* Cancel an agent run.
|
|
1019
|
+
*
|
|
1020
|
+
* @deprecated This never deleted anything — the endpoint it calls is documented
|
|
1021
|
+
* as "Cancel an agent run", and the API has no delete-a-run operation. It also
|
|
1022
|
+
* discards the returned run state. Use {@link cancelAgentRun} instead.
|
|
905
1023
|
*
|
|
906
1024
|
* @param runId - Run identifier.
|
|
907
1025
|
*/
|
|
908
1026
|
async deleteAgentRun(runId) {
|
|
909
|
-
await this.
|
|
1027
|
+
await this.cancelAgentRun(runId);
|
|
910
1028
|
}
|
|
911
1029
|
/**
|
|
912
1030
|
* Cancel a running agent run.
|
|
913
1031
|
*
|
|
1032
|
+
* Cancellation is `DELETE` on the run resource — the API exposes no
|
|
1033
|
+
* `POST .../cancel` route, and no operation that deletes a run. Rejected when
|
|
1034
|
+
* the run has already reached a terminal state.
|
|
1035
|
+
*
|
|
914
1036
|
* @param runId - Run identifier.
|
|
915
1037
|
* @returns Updated run (with cancelled status).
|
|
916
1038
|
*/
|
|
917
1039
|
async cancelAgentRun(runId) {
|
|
918
|
-
return await this.request("
|
|
1040
|
+
return await this.request("DELETE", `/agents/runs/${runId}`);
|
|
919
1041
|
}
|
|
920
1042
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
921
1043
|
// Agent Runs — Streaming
|
|
@@ -1181,9 +1303,10 @@ var Seclai = class {
|
|
|
1181
1303
|
* @returns Paginated list of evaluation results.
|
|
1182
1304
|
*/
|
|
1183
1305
|
async listRunEvaluationResults(agentId, runId, opts = {}) {
|
|
1184
|
-
|
|
1306
|
+
const res = await this.request("GET", `/agents/${agentId}/runs/${runId}/evaluation-results`, {
|
|
1185
1307
|
query: { page: opts.page, limit: opts.limit }
|
|
1186
1308
|
});
|
|
1309
|
+
return Array.isArray(res) ? { data: res } : res;
|
|
1187
1310
|
}
|
|
1188
1311
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1189
1312
|
// Agent Input Uploads
|
|
@@ -1271,8 +1394,20 @@ var Seclai = class {
|
|
|
1271
1394
|
* @param agentId - Agent identifier.
|
|
1272
1395
|
* @returns Conversation history.
|
|
1273
1396
|
*/
|
|
1274
|
-
async getAgentAiConversationHistory(agentId) {
|
|
1275
|
-
|
|
1397
|
+
async getAgentAiConversationHistory(agentId, opts = {}) {
|
|
1398
|
+
if (!opts.stepType) {
|
|
1399
|
+
throw new SeclaiConfigurationError(
|
|
1400
|
+
'getAgentAiConversationHistory requires opts.stepType; the API rejects the request without it. Pass e.g. { stepType: "llm" }.'
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
return await this.request("GET", `/agents/${agentId}/ai-assistant/conversations`, {
|
|
1404
|
+
query: {
|
|
1405
|
+
step_type: opts.stepType,
|
|
1406
|
+
step_id: opts.stepId,
|
|
1407
|
+
limit: opts.limit,
|
|
1408
|
+
offset: opts.offset
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1276
1411
|
}
|
|
1277
1412
|
/**
|
|
1278
1413
|
* Mark an AI suggestion as accepted or rejected.
|
|
@@ -1294,9 +1429,25 @@ var Seclai = class {
|
|
|
1294
1429
|
* @param opts - Pagination options.
|
|
1295
1430
|
*/
|
|
1296
1431
|
async listEvaluationCriteria(agentId, opts = {}) {
|
|
1297
|
-
return await this.
|
|
1432
|
+
return (await this.listEvaluationCriteriaPage(agentId, opts)).data ?? [];
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* List evaluation criteria for an agent, with pagination metadata.
|
|
1436
|
+
*
|
|
1437
|
+
* Accepts either wire shape. The endpoint answered with a bare array before
|
|
1438
|
+
* 2026-07 and with a paginated envelope after, so a client that decodes only
|
|
1439
|
+
* one breaks the day the other ships. `total`, `page` and `limit` are absent
|
|
1440
|
+
* when the endpoint answers with a bare array.
|
|
1441
|
+
*
|
|
1442
|
+
* @param agentId - Agent identifier.
|
|
1443
|
+
* @param opts - Pagination options.
|
|
1444
|
+
* @returns The criteria under `data`, plus the page metadata when present.
|
|
1445
|
+
*/
|
|
1446
|
+
async listEvaluationCriteriaPage(agentId, opts = {}) {
|
|
1447
|
+
const res = await this.request("GET", `/agents/${agentId}/evaluation-criteria`, {
|
|
1298
1448
|
query: { page: opts.page, limit: opts.limit }
|
|
1299
1449
|
});
|
|
1450
|
+
return Array.isArray(res) ? { data: res } : res;
|
|
1300
1451
|
}
|
|
1301
1452
|
/**
|
|
1302
1453
|
* Create evaluation criteria for an agent.
|
|
@@ -1419,6 +1570,145 @@ var Seclai = class {
|
|
|
1419
1570
|
});
|
|
1420
1571
|
}
|
|
1421
1572
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1573
|
+
// Agent Email Triggers
|
|
1574
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1575
|
+
/**
|
|
1576
|
+
* Configure an agent's `EMAIL_RECEIVED` trigger and return its computed
|
|
1577
|
+
* email address(es).
|
|
1578
|
+
*
|
|
1579
|
+
* Sets the custom alias, the sender allowlist, and the inbound-handling flags
|
|
1580
|
+
* (`ignore_auto_generated`, `require_sender_auth`, `queue_on_quota`). Omitted
|
|
1581
|
+
* fields are left unchanged; passing `null` (or `""` for `alias`) clears them.
|
|
1582
|
+
*
|
|
1583
|
+
* @param agentId - Agent identifier.
|
|
1584
|
+
* @param triggerId - Trigger identifier.
|
|
1585
|
+
* @param body - The fields to set.
|
|
1586
|
+
* @returns The trigger's resolved addresses and config.
|
|
1587
|
+
*/
|
|
1588
|
+
async setEmailTriggerConfig(agentId, triggerId, body) {
|
|
1589
|
+
return await this.request("PUT", `/agents/${agentId}/triggers/${triggerId}/email-config`, {
|
|
1590
|
+
json: body
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1594
|
+
// Agent Email Governance
|
|
1595
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1596
|
+
/**
|
|
1597
|
+
* List recipients who have opted out of this account's agent emails.
|
|
1598
|
+
*
|
|
1599
|
+
* @param opts - Optional agent filter and `limit`/`offset` pagination.
|
|
1600
|
+
* @param opts.agentId - Filter to one agent (account-wide opt-outs still apply).
|
|
1601
|
+
* @param opts.limit - Page size (1-200, default 50).
|
|
1602
|
+
* @param opts.offset - Rows to skip (default 0).
|
|
1603
|
+
* @returns The page of opt-outs plus the total count.
|
|
1604
|
+
*/
|
|
1605
|
+
async listAgentEmailOptOuts(opts = {}) {
|
|
1606
|
+
return await this.request("GET", "/agents/agent-email-optouts", {
|
|
1607
|
+
query: { agent_id: opts.agentId, limit: opts.limit, offset: opts.offset }
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Revoke an opt-out, opting the recipient back in to agent emails.
|
|
1612
|
+
*
|
|
1613
|
+
* @param optoutId - Opt-out identifier.
|
|
1614
|
+
*/
|
|
1615
|
+
async removeAgentEmailOptOut(optoutId) {
|
|
1616
|
+
await this.request("DELETE", `/agents/agent-email-optouts/${optoutId}`);
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* List the account's blocked inbound email senders (newest first), plus the
|
|
1620
|
+
* governance `auto_block_mode`.
|
|
1621
|
+
*
|
|
1622
|
+
* @param opts - Optional `limit`/`offset` pagination.
|
|
1623
|
+
* @param opts.limit - Page size (1-200, default 50).
|
|
1624
|
+
* @param opts.offset - Rows to skip (default 0).
|
|
1625
|
+
*/
|
|
1626
|
+
async listBlockedEmailSenders(opts = {}) {
|
|
1627
|
+
return await this.request("GET", "/agents/blocked-email-senders", {
|
|
1628
|
+
query: { limit: opts.limit, offset: opts.offset }
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Add a sender address or a whole domain to the account blocklist.
|
|
1633
|
+
*
|
|
1634
|
+
* Idempotent. `match_type` is `"address"` (default) or `"domain"`.
|
|
1635
|
+
* Requires an account owner/admin.
|
|
1636
|
+
*
|
|
1637
|
+
* @param body - The sender or domain to block.
|
|
1638
|
+
* @returns The blocked-sender entry.
|
|
1639
|
+
*/
|
|
1640
|
+
async blockEmailSender(body) {
|
|
1641
|
+
return await this.request("POST", "/agents/blocked-email-senders", {
|
|
1642
|
+
json: body
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Remove a blocked sender by id. Requires an account owner/admin.
|
|
1647
|
+
*
|
|
1648
|
+
* @param blockedId - Blocked-sender identifier.
|
|
1649
|
+
*/
|
|
1650
|
+
async unblockEmailSender(blockedId) {
|
|
1651
|
+
await this.request("DELETE", `/agents/blocked-email-senders/${blockedId}`);
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Set whether a governance BLOCK on an authenticated inbound sender
|
|
1655
|
+
* auto-adds them to the blocklist.
|
|
1656
|
+
*
|
|
1657
|
+
* `mode` is `"disabled"`, `"input"`, or `"input_and_output"`.
|
|
1658
|
+
* Requires an account owner/admin.
|
|
1659
|
+
*
|
|
1660
|
+
* @param body - The mode to set.
|
|
1661
|
+
* @returns The updated blocked-sender list.
|
|
1662
|
+
*/
|
|
1663
|
+
async setAutoBlockMode(body) {
|
|
1664
|
+
return await this.request("PUT", "/agents/blocked-email-senders/mode", {
|
|
1665
|
+
json: body
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* List recent inbound emails that were quietly discarded before running an
|
|
1670
|
+
* agent (unauthorized sender, unknown alias, spam/virus, flood-shed).
|
|
1671
|
+
*
|
|
1672
|
+
* @param opts - Optional agent filter and result limit.
|
|
1673
|
+
* @param opts.agentId - Filter to a single agent's rejections.
|
|
1674
|
+
* @param opts.limit - Maximum results (1-200, default 50).
|
|
1675
|
+
*/
|
|
1676
|
+
async listInboundEmailRejections(opts = {}) {
|
|
1677
|
+
return await this.request("GET", "/agents/inbound-email-rejections", {
|
|
1678
|
+
query: { agent_id: opts.agentId, limit: opts.limit }
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Get the account's inbound-email overload status — whether the circuit
|
|
1683
|
+
* breaker has paused new inbound email, and the size of the QUEUED
|
|
1684
|
+
* (over-quota parked) run backlog.
|
|
1685
|
+
*/
|
|
1686
|
+
async getInboundEmailStatus() {
|
|
1687
|
+
return await this.request("GET", "/agents/inbound-email-status");
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Fail all of the account's QUEUED (over-quota parked) inbound-email runs at
|
|
1691
|
+
* once.
|
|
1692
|
+
*
|
|
1693
|
+
* A queued run consumed no quota or credits at queue time, so this merely
|
|
1694
|
+
* fails them. Requires an account owner/admin.
|
|
1695
|
+
*
|
|
1696
|
+
* @returns The count cancelled.
|
|
1697
|
+
*/
|
|
1698
|
+
async cancelQueuedEmailRuns() {
|
|
1699
|
+
return await this.request("POST", "/agents/inbound-email-status/cancel-queued");
|
|
1700
|
+
}
|
|
1701
|
+
/**
|
|
1702
|
+
* Manually lift the account-wide inbound-email pause.
|
|
1703
|
+
*
|
|
1704
|
+
* If the queued backlog is still above the ceiling the breaker re-arms on the
|
|
1705
|
+
* next evaluation — this is a one-shot override, not a permanent disable.
|
|
1706
|
+
* Requires an account owner/admin.
|
|
1707
|
+
*/
|
|
1708
|
+
async resumeInboundEmail() {
|
|
1709
|
+
return await this.request("POST", "/agents/inbound-email-status/resume");
|
|
1710
|
+
}
|
|
1711
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1422
1712
|
// Knowledge Bases
|
|
1423
1713
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1424
1714
|
/**
|
|
@@ -1611,7 +1901,7 @@ var Seclai = class {
|
|
|
1611
1901
|
* @returns Paginated list of sources.
|
|
1612
1902
|
*/
|
|
1613
1903
|
async listSources(opts = {}) {
|
|
1614
|
-
return await this.request("GET", "/sources
|
|
1904
|
+
return await this.request("GET", "/sources", {
|
|
1615
1905
|
query: {
|
|
1616
1906
|
page: opts.page,
|
|
1617
1907
|
limit: opts.limit,
|
|
@@ -2074,7 +2364,7 @@ var Seclai = class {
|
|
|
2074
2364
|
*/
|
|
2075
2365
|
async listAlerts(opts = {}) {
|
|
2076
2366
|
return await this.request("GET", "/alerts", {
|
|
2077
|
-
query: { page: opts.page, limit: opts.limit, status: opts.status
|
|
2367
|
+
query: { page: opts.page, limit: opts.limit, status: opts.status }
|
|
2078
2368
|
});
|
|
2079
2369
|
}
|
|
2080
2370
|
/**
|
|
@@ -2127,6 +2417,12 @@ var Seclai = class {
|
|
|
2127
2417
|
* @param opts - Pagination options.
|
|
2128
2418
|
* @returns Paginated list of alert configs.
|
|
2129
2419
|
*/
|
|
2420
|
+
/**
|
|
2421
|
+
* The configurations arrive under `configs` alongside `total` by default.
|
|
2422
|
+
* Once the caller opts in with `apiVersion` 2026-07-27 or later the endpoint
|
|
2423
|
+
* returns the canonical `{data, pagination}` envelope instead, so the
|
|
2424
|
+
* top-level key changes.
|
|
2425
|
+
*/
|
|
2130
2426
|
async listAlertConfigs(opts = {}) {
|
|
2131
2427
|
return await this.request("GET", "/alerts/configs", {
|
|
2132
2428
|
query: { page: opts.page, limit: opts.limit }
|
|
@@ -2183,7 +2479,11 @@ var Seclai = class {
|
|
|
2183
2479
|
* @param body - Preference update.
|
|
2184
2480
|
*/
|
|
2185
2481
|
async updateOrganizationAlertPreference(organizationId, alertType, body) {
|
|
2186
|
-
return await this.request(
|
|
2482
|
+
return await this.request(
|
|
2483
|
+
"PATCH",
|
|
2484
|
+
`/alerts/organization-preferences/${organizationId}/${alertType}`,
|
|
2485
|
+
{ json: body }
|
|
2486
|
+
);
|
|
2187
2487
|
}
|
|
2188
2488
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2189
2489
|
// Models & Model Alerts
|
|
@@ -2194,8 +2494,10 @@ var Seclai = class {
|
|
|
2194
2494
|
* @param opts - Pagination options.
|
|
2195
2495
|
*/
|
|
2196
2496
|
async listModelAlerts(opts = {}) {
|
|
2497
|
+
const limit = opts.limit ?? 50;
|
|
2498
|
+
const offset = opts.page && opts.page > 1 ? (opts.page - 1) * limit : void 0;
|
|
2197
2499
|
return await this.request("GET", "/models/alerts", {
|
|
2198
|
-
query: {
|
|
2500
|
+
query: { offset, limit: opts.limit }
|
|
2199
2501
|
});
|
|
2200
2502
|
}
|
|
2201
2503
|
/**
|
|
@@ -2233,7 +2535,13 @@ var Seclai = class {
|
|
|
2233
2535
|
*/
|
|
2234
2536
|
async listModels(opts = {}) {
|
|
2235
2537
|
return await this.request("GET", "/models", {
|
|
2236
|
-
query: {
|
|
2538
|
+
query: {
|
|
2539
|
+
provider: opts.provider,
|
|
2540
|
+
supports_tool_use: opts.supportsToolUse,
|
|
2541
|
+
supports_thinking: opts.supportsThinking,
|
|
2542
|
+
supports_input_media: opts.supportsInputMedia,
|
|
2543
|
+
supports_output_media: opts.supportsOutputMedia
|
|
2544
|
+
}
|
|
2237
2545
|
});
|
|
2238
2546
|
}
|
|
2239
2547
|
/**
|
|
@@ -2244,6 +2552,20 @@ var Seclai = class {
|
|
|
2244
2552
|
async getModel(modelId) {
|
|
2245
2553
|
return await this.request("GET", `/models/${modelId}/details`);
|
|
2246
2554
|
}
|
|
2555
|
+
/**
|
|
2556
|
+
* List the media-generation quality tiers and the model + cost each resolves to.
|
|
2557
|
+
*
|
|
2558
|
+
* On a `prompt_call`'s `media_generation` tool — and the dedicated
|
|
2559
|
+
* `generate_*` steps via tier routing — the author/LLM picks a *tier*
|
|
2560
|
+
* (fast/balanced/thorough), never a model. This maps each
|
|
2561
|
+
* `(modality, tier)` to its concrete generator, raw `credits_per_unit`,
|
|
2562
|
+
* `unit_label`, and a human-readable scaled `price_label`.
|
|
2563
|
+
*
|
|
2564
|
+
* Global routing/pricing (the same for every account); read-only.
|
|
2565
|
+
*/
|
|
2566
|
+
async getGenerationTiers() {
|
|
2567
|
+
return await this.request("GET", "/models/generation-tiers");
|
|
2568
|
+
}
|
|
2247
2569
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2248
2570
|
// Model Playground Experiments
|
|
2249
2571
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -2312,6 +2634,143 @@ var Seclai = class {
|
|
|
2312
2634
|
query: { q: opts.query, limit: opts.limit, entity_type: opts.entityType }
|
|
2313
2635
|
});
|
|
2314
2636
|
}
|
|
2637
|
+
/**
|
|
2638
|
+
* Search the Seclai documentation by content.
|
|
2639
|
+
*
|
|
2640
|
+
* `mode: "keyword"` matches page titles and summaries (fast, no AI cost);
|
|
2641
|
+
* `mode: "semantic"` matches page body content by meaning (uses an embedding).
|
|
2642
|
+
*
|
|
2643
|
+
* Each result carries a `doc_slug` and an optional section `anchor` for
|
|
2644
|
+
* building a `https://seclai.com/docs/<doc_slug>[#<anchor>]` link, a `score`
|
|
2645
|
+
* (not comparable across modes), and — in semantic mode — a `highlight`
|
|
2646
|
+
* (best matching verbatim sentence; `null` for keyword).
|
|
2647
|
+
*
|
|
2648
|
+
* Documentation is global, so results are not account-scoped.
|
|
2649
|
+
*
|
|
2650
|
+
* @param opts - Search options.
|
|
2651
|
+
* @param opts.query - Search query string (required, 1-200 chars).
|
|
2652
|
+
* @param opts.mode - Search strategy (default `"keyword"`).
|
|
2653
|
+
* @param opts.limit - Maximum results (1-20, default 8).
|
|
2654
|
+
*/
|
|
2655
|
+
async searchDocs(opts) {
|
|
2656
|
+
return await this.request("GET", "/docs-search", {
|
|
2657
|
+
query: { q: opts.query, mode: opts.mode, limit: opts.limit }
|
|
2658
|
+
});
|
|
2659
|
+
}
|
|
2660
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2661
|
+
// Email Domains
|
|
2662
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2663
|
+
/**
|
|
2664
|
+
* List the account's vanity (`<slug>.seclai.com`) and custom
|
|
2665
|
+
* (`agent.mycompany.com`) agent-email domains.
|
|
2666
|
+
*
|
|
2667
|
+
* Includes each domain's verification status and the DNS records the customer
|
|
2668
|
+
* must publish, plus the plan capabilities (`can_add_vanity` /
|
|
2669
|
+
* `can_add_custom`) and whether one of each kind already exists
|
|
2670
|
+
* (`has_vanity` / `has_custom` — the per-kind limit is 1).
|
|
2671
|
+
*
|
|
2672
|
+
* Requires a user-bound credential; an account-only API key is refused with 403.
|
|
2673
|
+
*/
|
|
2674
|
+
async listEmailDomains() {
|
|
2675
|
+
return await this.request("GET", "/email-domains");
|
|
2676
|
+
}
|
|
2677
|
+
/**
|
|
2678
|
+
* Add and provision a new agent-email domain.
|
|
2679
|
+
*
|
|
2680
|
+
* Pass `kind: "vanity"` with `value: "<slug>"`, or `kind: "custom"` with
|
|
2681
|
+
* `value: "agent.mycompany.com"` (optionally `delegated: true` to let Seclai
|
|
2682
|
+
* manage a dedicated Route53 zone). Stands up the SES identity + DNS and
|
|
2683
|
+
* returns the records the customer must publish. Requires an account
|
|
2684
|
+
* owner/admin.
|
|
2685
|
+
*
|
|
2686
|
+
* @param body - The domain to add. `delegated` defaults to `false` server-side.
|
|
2687
|
+
*/
|
|
2688
|
+
async addEmailDomain(body) {
|
|
2689
|
+
return await this.request("POST", "/email-domains", { json: body });
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* Remove a domain and tear down its SES identity + DNS / receipt-rule recipient.
|
|
2693
|
+
*
|
|
2694
|
+
* Returns a `cleanup_note` when the removed domain was Seclai-managed
|
|
2695
|
+
* (delegated), reminding you to delete the registrar NS delegation record
|
|
2696
|
+
* (dangling-delegation / subdomain-takeover guard). Requires an account
|
|
2697
|
+
* owner/admin.
|
|
2698
|
+
*
|
|
2699
|
+
* @param domainId - Domain identifier.
|
|
2700
|
+
*/
|
|
2701
|
+
async removeEmailDomain(domainId) {
|
|
2702
|
+
return await this.request("DELETE", `/email-domains/${domainId}`);
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* Run a verification check immediately ("Check now").
|
|
2706
|
+
*
|
|
2707
|
+
* Re-polls SES + DNS for this domain instead of waiting for the background
|
|
2708
|
+
* verification sweep, and returns its updated status + DNS-record check
|
|
2709
|
+
* results. Useful right after publishing the required records. Requires an
|
|
2710
|
+
* account owner/admin.
|
|
2711
|
+
*
|
|
2712
|
+
* @param domainId - Domain identifier.
|
|
2713
|
+
*/
|
|
2714
|
+
async verifyEmailDomain(domainId) {
|
|
2715
|
+
return await this.request("POST", `/email-domains/${domainId}/verify`);
|
|
2716
|
+
}
|
|
2717
|
+
/**
|
|
2718
|
+
* Promote a verified domain to the account's primary domain.
|
|
2719
|
+
*
|
|
2720
|
+
* Agent email then sends FROM and receives ON this domain
|
|
2721
|
+
* (`<agentID>@<domain>`, `<alias>@<domain>`) instead of the shared
|
|
2722
|
+
* `agent.seclai.com`. The domain must be verified. Requires an account
|
|
2723
|
+
* owner/admin.
|
|
2724
|
+
*
|
|
2725
|
+
* @param domainId - Domain identifier.
|
|
2726
|
+
*/
|
|
2727
|
+
async setPrimaryEmailDomain(domainId) {
|
|
2728
|
+
return await this.request("POST", `/email-domains/${domainId}/primary`);
|
|
2729
|
+
}
|
|
2730
|
+
/**
|
|
2731
|
+
* Revert to the shared `agent.seclai.com` sending/inbound domain.
|
|
2732
|
+
*
|
|
2733
|
+
* Clears the account's primary domain WITHOUT removing the configured
|
|
2734
|
+
* domain(s) — they stay verified and can be promoted again later. Requires an
|
|
2735
|
+
* account owner/admin.
|
|
2736
|
+
*/
|
|
2737
|
+
async useSharedEmailDomain() {
|
|
2738
|
+
await this.request("POST", "/email-domains/use-shared-domain");
|
|
2739
|
+
}
|
|
2740
|
+
/**
|
|
2741
|
+
* Send a test message FROM a verified domain (`noreply@<domain>`) TO the
|
|
2742
|
+
* account owner's email.
|
|
2743
|
+
*
|
|
2744
|
+
* Confirms end-to-end that the domain actually sends (SES verified, DKIM/SPF
|
|
2745
|
+
* aligned). Never sends to any other address, so it can't be used as an open
|
|
2746
|
+
* relay. Requires an account owner/admin.
|
|
2747
|
+
*
|
|
2748
|
+
* @param domainId - Domain identifier.
|
|
2749
|
+
*/
|
|
2750
|
+
async sendEmailDomainTestEmail(domainId) {
|
|
2751
|
+
return await this.request("POST", `/email-domains/${domainId}/test-email`);
|
|
2752
|
+
}
|
|
2753
|
+
/**
|
|
2754
|
+
* Get the DMARC aggregate-report summary for a domain.
|
|
2755
|
+
*
|
|
2756
|
+
* Pass rate, disposition breakdown (`none`/`quarantine`/`reject`), and top
|
|
2757
|
+
* failing source IPs from the DMARC `rua` reports over the last `days`
|
|
2758
|
+
* (clamped by the service).
|
|
2759
|
+
*
|
|
2760
|
+
* Populated for domains whose DNS zone Seclai controls (vanity + delegated
|
|
2761
|
+
* custom); a self-managed custom domain keeps its own DMARC reporting and
|
|
2762
|
+
* returns an all-zero summary.
|
|
2763
|
+
*
|
|
2764
|
+
* @param domainId - Domain identifier.
|
|
2765
|
+
* @param opts - Reporting window options.
|
|
2766
|
+
* @param opts.days - Window length in days (default 30).
|
|
2767
|
+
* @param opts.topSources - Number of top failing sources to return (default 10).
|
|
2768
|
+
*/
|
|
2769
|
+
async getDmarcSummary(domainId, opts = {}) {
|
|
2770
|
+
return await this.request("GET", `/email-domains/${domainId}/dmarc`, {
|
|
2771
|
+
query: { days: opts.days, top_sources: opts.topSources }
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2315
2774
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2316
2775
|
// Top-Level AI Assistant
|
|
2317
2776
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -2433,6 +2892,7 @@ var Seclai = class {
|
|
|
2433
2892
|
Seclai,
|
|
2434
2893
|
SeclaiAPIStatusError,
|
|
2435
2894
|
SeclaiAPIValidationError,
|
|
2895
|
+
SeclaiApiVersion,
|
|
2436
2896
|
SeclaiConfigurationError,
|
|
2437
2897
|
SeclaiError,
|
|
2438
2898
|
SeclaiStreamingError,
|