@seclai/sdk 1.6.1 → 1.8.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 +49 -0
- package/README.md +257 -26
- package/dist/index.cjs +282 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1295 -122
- package/dist/index.d.ts +1295 -122
- package/dist/index.js +282 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,10 +7,17 @@ var SeclaiApiVersion = {
|
|
|
7
7
|
V2026_09_28: "2026-09-28",
|
|
8
8
|
V2026_09_30: "2026-09-30",
|
|
9
9
|
V2026_10_03: "2026-10-03",
|
|
10
|
+
V2026_10_05: "2026-10-05",
|
|
11
|
+
V2026_10_13: "2026-10-13",
|
|
12
|
+
V2026_10_16: "2026-10-16",
|
|
13
|
+
V2026_10_18: "2026-10-18",
|
|
14
|
+
V2026_10_19: "2026-10-19",
|
|
15
|
+
V2026_10_21: "2026-10-21",
|
|
16
|
+
V2026_10_28: "2026-10-28",
|
|
10
17
|
/** Baseline applied to an unpinned, header-less caller. */
|
|
11
18
|
Default: "2026-07-01",
|
|
12
19
|
/** Newest version known to this SDK release. May lag the server. */
|
|
13
|
-
Latest: "2026-10-
|
|
20
|
+
Latest: "2026-10-28"
|
|
14
21
|
};
|
|
15
22
|
var KNOWN_API_VERSIONS = Object.entries(SeclaiApiVersion).filter(([k]) => k.startsWith("V")).map(([, v]) => v);
|
|
16
23
|
|
|
@@ -844,6 +851,20 @@ var Seclai = class {
|
|
|
844
851
|
query: { page: opts.page, limit: opts.limit }
|
|
845
852
|
});
|
|
846
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* List the agent gallery: example agents to start from.
|
|
856
|
+
*
|
|
857
|
+
* Pass an entry's `key` as `agent_template` to {@link createAgent}, with
|
|
858
|
+
* `resource_bindings` for the resources it needs.
|
|
859
|
+
*
|
|
860
|
+
* @param opts - Text search, use-case filter and pagination.
|
|
861
|
+
* @returns A page of gallery entries.
|
|
862
|
+
*/
|
|
863
|
+
async listAgentExamples(opts = {}) {
|
|
864
|
+
return await this.request("GET", "/agents/examples", {
|
|
865
|
+
query: { query: opts.query, use_case: opts.useCase, page: opts.page, limit: opts.limit }
|
|
866
|
+
});
|
|
867
|
+
}
|
|
847
868
|
/**
|
|
848
869
|
* Create a new agent.
|
|
849
870
|
*
|
|
@@ -1058,15 +1079,18 @@ var Seclai = class {
|
|
|
1058
1079
|
* Run an agent in streaming mode (SSE) and wait for the final result.
|
|
1059
1080
|
*
|
|
1060
1081
|
* Consumes the entire SSE stream and returns only the terminal `done` payload.
|
|
1061
|
-
* For real-time event access, use {@link runStreamingAgent} instead.
|
|
1082
|
+
* For real-time event access, use {@link runStreamingAgent} instead. The body
|
|
1083
|
+
* takes no `include_reasoning`, and one passed anyway is not sent: this method
|
|
1084
|
+
* returns no `stream_reasoning` events.
|
|
1062
1085
|
*
|
|
1063
1086
|
* @param agentId - Agent identifier.
|
|
1064
|
-
* @param body - Streaming run request payload
|
|
1087
|
+
* @param body - Streaming run request payload, without `include_reasoning`.
|
|
1065
1088
|
* @param opts - Timeout and abort signal options.
|
|
1066
1089
|
* @returns Final agent run payload from the `done` event.
|
|
1067
1090
|
* @throws {@link SeclaiStreamingError} If the stream ends before a `done` event.
|
|
1068
1091
|
*/
|
|
1069
1092
|
async runStreamingAgentAndWait(agentId, body, opts) {
|
|
1093
|
+
const { include_reasoning: _ignored, ...runBody } = body;
|
|
1070
1094
|
const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
|
|
1071
1095
|
const authHdrs = await this.authHeaders();
|
|
1072
1096
|
const headers = this.requestHeaders([
|
|
@@ -1084,7 +1108,7 @@ var Seclai = class {
|
|
|
1084
1108
|
const signal = anySignal([opts?.signal, timeoutController.signal]);
|
|
1085
1109
|
let lastSeen;
|
|
1086
1110
|
try {
|
|
1087
|
-
const init = { method: "POST", headers, body: JSON.stringify(
|
|
1111
|
+
const init = { method: "POST", headers, body: JSON.stringify(runBody) };
|
|
1088
1112
|
if (signal) init.signal = signal;
|
|
1089
1113
|
const response = await this.fetcher(url, init);
|
|
1090
1114
|
const contentType = response.headers.get("content-type") ?? "";
|
|
@@ -1325,10 +1349,14 @@ var Seclai = class {
|
|
|
1325
1349
|
// Agent Input Uploads
|
|
1326
1350
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1327
1351
|
/**
|
|
1328
|
-
* Upload a file to use as input for a `dynamic_input` agent run.
|
|
1352
|
+
* Upload a file to use as input for a `dynamic_input` agent run. Any other
|
|
1353
|
+
* agent rejects the upload with HTTP 400. Files are limited to 200 MB.
|
|
1329
1354
|
*
|
|
1330
|
-
*
|
|
1331
|
-
*
|
|
1355
|
+
* From API version `2026-10-16` a file of any type is accepted and is `ready`
|
|
1356
|
+
* at once: pass its `id` as `input_upload_id` to {@link runAgent}.
|
|
1357
|
+
* Earlier versions accept only a fixed list of extensions and write each
|
|
1358
|
+
* file's extracted text into the run's `input`, so poll
|
|
1359
|
+
* {@link getAgentInputUploadStatus} until `status` is `ready` before running.
|
|
1332
1360
|
*
|
|
1333
1361
|
* @param agentId - Agent identifier.
|
|
1334
1362
|
* @param opts - File payload and optional metadata.
|
|
@@ -1370,12 +1398,16 @@ var Seclai = class {
|
|
|
1370
1398
|
* @param runId - Run identifier.
|
|
1371
1399
|
* @param attachmentId - URL-safe-base64-encoded `storage_key` of the attachment
|
|
1372
1400
|
* (as surfaced in run output manifests and webhook/email payloads).
|
|
1373
|
-
* @param opts - Optional `downloadName` filename hint for the download
|
|
1401
|
+
* @param opts - Optional `downloadName` filename hint for the download
|
|
1402
|
+
* disposition, and `signal`, which cancels the request; with a standard `fetch` this
|
|
1403
|
+
* includes reading the body, so `AbortSignal.timeout(ms)` bounds the whole
|
|
1404
|
+
* transfer.
|
|
1374
1405
|
* @returns Raw response with the attachment bytes.
|
|
1375
1406
|
*/
|
|
1376
1407
|
async downloadAgentRunAttachment(runId, attachmentId, opts = {}) {
|
|
1377
1408
|
return await this.requestRaw("GET", `/v2/agent-runs/${runId}/attachments/${attachmentId}`, {
|
|
1378
|
-
query: { download_name: opts.downloadName }
|
|
1409
|
+
query: { download_name: opts.downloadName },
|
|
1410
|
+
signal: opts.signal
|
|
1379
1411
|
});
|
|
1380
1412
|
}
|
|
1381
1413
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -1513,12 +1545,19 @@ var Seclai = class {
|
|
|
1513
1545
|
* List evaluation results for a specific criteria.
|
|
1514
1546
|
*
|
|
1515
1547
|
* @param criteriaId - Criteria identifier.
|
|
1516
|
-
* @param opts - Pagination
|
|
1548
|
+
* @param opts - Pagination, status, flag and time-range filters.
|
|
1517
1549
|
*/
|
|
1518
1550
|
async listEvaluationResults(criteriaId, opts = {}) {
|
|
1519
1551
|
return keyedList(
|
|
1520
1552
|
await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/results`, {
|
|
1521
|
-
query: {
|
|
1553
|
+
query: {
|
|
1554
|
+
page: opts.page,
|
|
1555
|
+
limit: opts.limit,
|
|
1556
|
+
status: opts.status,
|
|
1557
|
+
flagged_only: opts.flaggedOnly,
|
|
1558
|
+
time_from: opts.timeFrom,
|
|
1559
|
+
time_to: opts.timeTo
|
|
1560
|
+
}
|
|
1522
1561
|
}),
|
|
1523
1562
|
"data",
|
|
1524
1563
|
PAGE_COUNTERS
|
|
@@ -1538,12 +1577,12 @@ var Seclai = class {
|
|
|
1538
1577
|
* List runs compatible with a specific evaluation criteria.
|
|
1539
1578
|
*
|
|
1540
1579
|
* @param criteriaId - Criteria identifier.
|
|
1541
|
-
* @param opts - Pagination
|
|
1580
|
+
* @param opts - Pagination and a `startedAfter` filter.
|
|
1542
1581
|
*/
|
|
1543
1582
|
async listCompatibleRuns(criteriaId, opts = {}) {
|
|
1544
1583
|
return keyedList(
|
|
1545
1584
|
await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/compatible-runs`, {
|
|
1546
|
-
query: { page: opts.page, limit: opts.limit }
|
|
1585
|
+
query: { page: opts.page, limit: opts.limit, started_after: opts.startedAfter }
|
|
1547
1586
|
}),
|
|
1548
1587
|
"data",
|
|
1549
1588
|
PAGE_COUNTERS
|
|
@@ -1563,12 +1602,20 @@ var Seclai = class {
|
|
|
1563
1602
|
* List all evaluation results for an agent.
|
|
1564
1603
|
*
|
|
1565
1604
|
* @param agentId - Agent identifier.
|
|
1566
|
-
* @param opts - Pagination
|
|
1605
|
+
* @param opts - Pagination, status, step, flag and time-range filters.
|
|
1567
1606
|
*/
|
|
1568
1607
|
async listAgentEvaluationResults(agentId, opts = {}) {
|
|
1569
1608
|
return keyedList(
|
|
1570
1609
|
await this.request("GET", `/agents/${agentId}/evaluation-results`, {
|
|
1571
|
-
query: {
|
|
1610
|
+
query: {
|
|
1611
|
+
page: opts.page,
|
|
1612
|
+
limit: opts.limit,
|
|
1613
|
+
status: opts.status,
|
|
1614
|
+
step: opts.step,
|
|
1615
|
+
flagged_only: opts.flaggedOnly,
|
|
1616
|
+
time_from: opts.timeFrom,
|
|
1617
|
+
time_to: opts.timeTo
|
|
1618
|
+
}
|
|
1572
1619
|
}),
|
|
1573
1620
|
"data",
|
|
1574
1621
|
PAGE_COUNTERS
|
|
@@ -1578,25 +1625,35 @@ var Seclai = class {
|
|
|
1578
1625
|
* List evaluation run summaries for an agent.
|
|
1579
1626
|
*
|
|
1580
1627
|
* @param agentId - Agent identifier.
|
|
1581
|
-
* @param opts - Pagination
|
|
1628
|
+
* @param opts - Pagination, status, step and time-range filters.
|
|
1582
1629
|
*/
|
|
1583
1630
|
async listEvaluationRuns(agentId, opts = {}) {
|
|
1584
1631
|
return keyedList(
|
|
1585
1632
|
await this.request("GET", `/agents/${agentId}/evaluation-runs`, {
|
|
1586
|
-
query: {
|
|
1633
|
+
query: {
|
|
1634
|
+
page: opts.page,
|
|
1635
|
+
limit: opts.limit,
|
|
1636
|
+
status: opts.status,
|
|
1637
|
+
step: opts.step,
|
|
1638
|
+
time_from: opts.timeFrom,
|
|
1639
|
+
time_to: opts.timeTo
|
|
1640
|
+
}
|
|
1587
1641
|
}),
|
|
1588
1642
|
"data",
|
|
1589
1643
|
PAGE_COUNTERS
|
|
1590
1644
|
);
|
|
1591
1645
|
}
|
|
1592
1646
|
/**
|
|
1593
|
-
* Get a summary of non-manual evaluations
|
|
1647
|
+
* Get a summary of non-manual evaluations, for one agent or the whole account.
|
|
1594
1648
|
*
|
|
1595
|
-
* @param agentId - Agent identifier.
|
|
1649
|
+
* @param agentId - Agent identifier. Omit (pass `undefined`) for the account-wide summary.
|
|
1650
|
+
* @param opts - Date range. `startDate` and `endDate` together set the range;
|
|
1651
|
+
* `startDate` alone runs from it through today; otherwise the last `days`
|
|
1652
|
+
* days apply (server default 30), and an `endDate` without `startDate` is ignored.
|
|
1596
1653
|
*/
|
|
1597
|
-
async getNonManualEvaluationSummary(agentId) {
|
|
1654
|
+
async getNonManualEvaluationSummary(agentId, opts = {}) {
|
|
1598
1655
|
return await this.request("GET", "/agents/evaluation-results/non-manual-summary", {
|
|
1599
|
-
query: { agent_id: agentId }
|
|
1656
|
+
query: { agent_id: agentId, days: opts.days, start_date: opts.startDate, end_date: opts.endDate }
|
|
1600
1657
|
});
|
|
1601
1658
|
}
|
|
1602
1659
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -1621,6 +1678,44 @@ var Seclai = class {
|
|
|
1621
1678
|
});
|
|
1622
1679
|
}
|
|
1623
1680
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1681
|
+
// Agent Slack Triggers
|
|
1682
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1683
|
+
/**
|
|
1684
|
+
* Configure an agent's `SLACK_COMMAND` trigger, which people run from Slack
|
|
1685
|
+
* with `/seclai` or the message shortcut.
|
|
1686
|
+
*
|
|
1687
|
+
* Sets the Slack connection, form, channels, reply visibility and conversation
|
|
1688
|
+
* settings. Omitted fields are left unchanged.
|
|
1689
|
+
*
|
|
1690
|
+
* @param agentId - Agent identifier.
|
|
1691
|
+
* @param triggerId - Trigger identifier.
|
|
1692
|
+
* @param body - The fields to set.
|
|
1693
|
+
* @returns The trigger's full Slack config, including any `missing_scopes`.
|
|
1694
|
+
*/
|
|
1695
|
+
async setSlackTriggerConfig(agentId, triggerId, body) {
|
|
1696
|
+
return await this.request("PUT", `/agents/${agentId}/triggers/${triggerId}/slack-config`, {
|
|
1697
|
+
json: body
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Replace the input attachments a trigger accepts.
|
|
1702
|
+
*
|
|
1703
|
+
* A run's files are each assigned to one declared attachment before any step
|
|
1704
|
+
* runs, and steps reference one as `{{agent.attachments.<name>}}`. The API
|
|
1705
|
+
* answers 400 when the agent references an attachment the new declaration
|
|
1706
|
+
* leaves out.
|
|
1707
|
+
*
|
|
1708
|
+
* @param agentId - Agent identifier.
|
|
1709
|
+
* @param triggerId - Trigger identifier, as `getAgent()` returns it.
|
|
1710
|
+
* @param body - The full list of accepted attachments; a slot's `min` defaults to 0.
|
|
1711
|
+
* @returns The trigger's accepted attachments.
|
|
1712
|
+
*/
|
|
1713
|
+
async setAcceptedAttachments(agentId, triggerId, body) {
|
|
1714
|
+
return await this.request("PUT", `/agents/${agentId}/triggers/${triggerId}/accepted-attachments`, {
|
|
1715
|
+
json: body
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1624
1719
|
// Agent Email Governance
|
|
1625
1720
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1626
1721
|
/**
|
|
@@ -1810,13 +1905,13 @@ var Seclai = class {
|
|
|
1810
1905
|
/**
|
|
1811
1906
|
* List memory banks.
|
|
1812
1907
|
*
|
|
1813
|
-
* @param opts - Pagination and
|
|
1908
|
+
* @param opts - Pagination, sorting and a `type` filter.
|
|
1814
1909
|
* @returns Paginated list of memory banks.
|
|
1815
1910
|
*/
|
|
1816
1911
|
async listMemoryBanks(opts = {}) {
|
|
1817
1912
|
return keyedList(
|
|
1818
1913
|
await this.request("GET", "/memory_banks", {
|
|
1819
|
-
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
1914
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order, type: opts.type }
|
|
1820
1915
|
}),
|
|
1821
1916
|
"memory_banks",
|
|
1822
1917
|
PAGE_COUNTERS
|
|
@@ -1873,9 +1968,13 @@ var Seclai = class {
|
|
|
1873
1968
|
* Get stats for a memory bank.
|
|
1874
1969
|
*
|
|
1875
1970
|
* @param memoryBankId - Memory bank identifier.
|
|
1971
|
+
* @param opts - Date range. Only `startDate` and `endDate` together replace
|
|
1972
|
+
* `days`; either one alone is ignored and the last `days` days apply (server default 30).
|
|
1876
1973
|
*/
|
|
1877
|
-
async getMemoryBankStats(memoryBankId) {
|
|
1878
|
-
return await this.request("GET", `/memory_banks/${memoryBankId}/stats
|
|
1974
|
+
async getMemoryBankStats(memoryBankId, opts = {}) {
|
|
1975
|
+
return await this.request("GET", `/memory_banks/${memoryBankId}/stats`, {
|
|
1976
|
+
query: { days: opts.days, start_date: opts.startDate, end_date: opts.endDate }
|
|
1977
|
+
});
|
|
1879
1978
|
}
|
|
1880
1979
|
/**
|
|
1881
1980
|
* Compact a memory bank (trigger compaction).
|
|
@@ -1928,9 +2027,13 @@ var Seclai = class {
|
|
|
1928
2027
|
}
|
|
1929
2028
|
/**
|
|
1930
2029
|
* Get the last AI conversation for memory banks.
|
|
2030
|
+
*
|
|
2031
|
+
* @param opts - Turns to return (server default 5) and most-recent turns to skip (default 0).
|
|
1931
2032
|
*/
|
|
1932
|
-
async getMemoryBankAiLastConversation() {
|
|
1933
|
-
return await this.request("GET", "/memory_banks/ai-assistant/last-conversation"
|
|
2033
|
+
async getMemoryBankAiLastConversation(opts = {}) {
|
|
2034
|
+
return await this.request("GET", "/memory_banks/ai-assistant/last-conversation", {
|
|
2035
|
+
query: { limit: opts.limit, offset: opts.offset }
|
|
2036
|
+
});
|
|
1934
2037
|
}
|
|
1935
2038
|
/**
|
|
1936
2039
|
* Accept a memory bank AI suggestion.
|
|
@@ -2069,6 +2172,24 @@ var Seclai = class {
|
|
|
2069
2172
|
`/sources/${sourceId}/contents/${contentVersionId}`
|
|
2070
2173
|
);
|
|
2071
2174
|
}
|
|
2175
|
+
/**
|
|
2176
|
+
* List mail an email content source refused, newest first.
|
|
2177
|
+
*
|
|
2178
|
+
* Each entry says who sent the message and why it was refused, never its
|
|
2179
|
+
* subject or body. To accept a refused sender, add its `from_address` or that
|
|
2180
|
+
* address's domain to the source's `email_allowed_senders` — which only helps
|
|
2181
|
+
* when `authenticated` is true. Requires an account owner or administrator;
|
|
2182
|
+
* the API answers 404 for a source that is not an email source.
|
|
2183
|
+
*
|
|
2184
|
+
* @param sourceId - Source connection identifier.
|
|
2185
|
+
* @param opts - Pagination options (`limit` 1-100).
|
|
2186
|
+
* @returns The rejections under `data` with `pagination`.
|
|
2187
|
+
*/
|
|
2188
|
+
async listEmailSourceRejections(sourceId, opts = {}) {
|
|
2189
|
+
return await this.request("GET", `/sources/${sourceId}/email-rejections`, {
|
|
2190
|
+
query: { page: opts.page, limit: opts.limit }
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2072
2193
|
// ─── Source Exports ────────────────────────────────────────────────────────
|
|
2073
2194
|
/**
|
|
2074
2195
|
* List exports for a source.
|
|
@@ -2118,10 +2239,15 @@ var Seclai = class {
|
|
|
2118
2239
|
*
|
|
2119
2240
|
* @param sourceId - Source connection identifier.
|
|
2120
2241
|
* @param exportId - Export identifier.
|
|
2242
|
+
* @param opts - Optional `signal`, which cancels the request; with a standard `fetch` this
|
|
2243
|
+
* includes reading the body, so `AbortSignal.timeout(ms)` bounds the whole
|
|
2244
|
+
* transfer.
|
|
2121
2245
|
* @returns Raw response with the export file.
|
|
2122
2246
|
*/
|
|
2123
|
-
async downloadSourceExport(sourceId, exportId) {
|
|
2124
|
-
return await this.requestRaw("GET", `/sources/${sourceId}/exports/${exportId}/download
|
|
2247
|
+
async downloadSourceExport(sourceId, exportId, opts = {}) {
|
|
2248
|
+
return await this.requestRaw("GET", `/sources/${sourceId}/exports/${exportId}/download`, {
|
|
2249
|
+
signal: opts.signal
|
|
2250
|
+
});
|
|
2125
2251
|
}
|
|
2126
2252
|
/**
|
|
2127
2253
|
* Estimate a source export.
|
|
@@ -2215,6 +2341,79 @@ var Seclai = class {
|
|
|
2215
2341
|
query: { page: opts.page ?? 1, limit: opts.limit ?? 20 }
|
|
2216
2342
|
});
|
|
2217
2343
|
}
|
|
2344
|
+
/**
|
|
2345
|
+
* List the files attached to a content item.
|
|
2346
|
+
*
|
|
2347
|
+
* Files arrive from an agent's `write_content_attachment` step, with an email
|
|
2348
|
+
* message, from an RSS feed's `feed_attachments`, from a web page's media, or
|
|
2349
|
+
* as the images inside a document. Each entry says whether it is indexed for
|
|
2350
|
+
* search and, when indexing failed, why.
|
|
2351
|
+
*
|
|
2352
|
+
* @param contentVersionId - Content version identifier.
|
|
2353
|
+
* @param opts - Pagination options.
|
|
2354
|
+
* @returns The attachments under `data` with `pagination`.
|
|
2355
|
+
*/
|
|
2356
|
+
async listContentAttachments(contentVersionId, opts = {}) {
|
|
2357
|
+
return await this.request("GET", `/contents/${contentVersionId}/attachments`, {
|
|
2358
|
+
query: { page: opts.page, limit: opts.limit }
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Get one file attached to a content item: its indexing status and reason,
|
|
2363
|
+
* its metadata, and the text it is indexed by.
|
|
2364
|
+
*
|
|
2365
|
+
* @param contentVersionId - Content version identifier.
|
|
2366
|
+
* @param attachmentId - The `id` of an entry from {@link listContentAttachments}.
|
|
2367
|
+
* @param opts - `start` and `end` character offsets for paging through long text
|
|
2368
|
+
* (server defaults 0 and 5000). Both are sent as given, so `end: 0` asks for
|
|
2369
|
+
* the metadata without any text. A file that was not indexed has no text.
|
|
2370
|
+
* @returns The attachment with the requested range of its text.
|
|
2371
|
+
* @throws {SeclaiAPIStatusError} 402 when the account has no credits left
|
|
2372
|
+
* (`error.code` `insufficient_credits`).
|
|
2373
|
+
*/
|
|
2374
|
+
async getContentAttachment(contentVersionId, attachmentId, opts = {}) {
|
|
2375
|
+
return await this.request("GET", `/contents/${contentVersionId}/attachments/${attachmentId}`, {
|
|
2376
|
+
query: { start: opts.start, end: opts.end }
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* List the embeddings (chunk vectors) a content attachment is indexed by.
|
|
2381
|
+
* The list is empty for a file that has no completed index.
|
|
2382
|
+
*
|
|
2383
|
+
* @param contentVersionId - Content version identifier.
|
|
2384
|
+
* @param attachmentId - Attachment identifier.
|
|
2385
|
+
* @param opts - Pagination options (`limit` 1-100).
|
|
2386
|
+
* @returns Paginated list of embeddings.
|
|
2387
|
+
* @throws {SeclaiAPIStatusError} 402 when the account has no credits left
|
|
2388
|
+
* (`error.code` `insufficient_credits`).
|
|
2389
|
+
*/
|
|
2390
|
+
async listContentAttachmentEmbeddings(contentVersionId, attachmentId, opts = {}) {
|
|
2391
|
+
return await this.request("GET", `/contents/${contentVersionId}/attachments/${attachmentId}/embeddings`, {
|
|
2392
|
+
query: { page: opts.page, limit: opts.limit }
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2395
|
+
/**
|
|
2396
|
+
* Download a content attachment's bytes.
|
|
2397
|
+
*
|
|
2398
|
+
* Returns the raw `Response` so you can stream or save the binary data. The
|
|
2399
|
+
* API answers 403 when the file is withheld — blocked or redacted by a
|
|
2400
|
+
* governance policy, or still being indexed after arriving from outside; the
|
|
2401
|
+
* attachment's `file_withheld` field says which before you ask.
|
|
2402
|
+
*
|
|
2403
|
+
* @param contentVersionId - Content version identifier.
|
|
2404
|
+
* @param attachmentId - Attachment identifier.
|
|
2405
|
+
* @param opts - Optional `signal`, which cancels the request; with a standard `fetch` this
|
|
2406
|
+
* includes reading the body, so `AbortSignal.timeout(ms)` bounds the whole
|
|
2407
|
+
* transfer.
|
|
2408
|
+
* @returns Raw response with the attachment bytes.
|
|
2409
|
+
* @throws {SeclaiAPIStatusError} 403 when the file is withheld, and 402 when
|
|
2410
|
+
* the account has no credits left (`error.code` `insufficient_credits`).
|
|
2411
|
+
*/
|
|
2412
|
+
async downloadContentAttachment(contentVersionId, attachmentId, opts = {}) {
|
|
2413
|
+
return await this.requestRaw("GET", `/contents/${contentVersionId}/attachments/${attachmentId}/file`, {
|
|
2414
|
+
signal: opts.signal
|
|
2415
|
+
});
|
|
2416
|
+
}
|
|
2218
2417
|
/**
|
|
2219
2418
|
* Upload a file to replace content for an existing content version.
|
|
2220
2419
|
*
|
|
@@ -2231,12 +2430,12 @@ var Seclai = class {
|
|
|
2231
2430
|
/**
|
|
2232
2431
|
* List solutions.
|
|
2233
2432
|
*
|
|
2234
|
-
* @param opts - Pagination and
|
|
2433
|
+
* @param opts - Pagination, sorting and a name `search`.
|
|
2235
2434
|
* @returns Paginated list of solutions.
|
|
2236
2435
|
*/
|
|
2237
2436
|
async listSolutions(opts = {}) {
|
|
2238
2437
|
return await this.request("GET", "/solutions", {
|
|
2239
|
-
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
|
|
2438
|
+
query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order, search: opts.search }
|
|
2240
2439
|
});
|
|
2241
2440
|
}
|
|
2242
2441
|
/**
|
|
@@ -2433,10 +2632,12 @@ var Seclai = class {
|
|
|
2433
2632
|
}
|
|
2434
2633
|
/**
|
|
2435
2634
|
* List governance AI conversations.
|
|
2635
|
+
*
|
|
2636
|
+
* @param opts - `limit`: how many conversations (the server defaults to 20).
|
|
2436
2637
|
*/
|
|
2437
|
-
async listGovernanceAiConversations() {
|
|
2638
|
+
async listGovernanceAiConversations(opts = {}) {
|
|
2438
2639
|
return listItems(
|
|
2439
|
-
await this.request("GET", "/governance/ai-assistant/conversations")
|
|
2640
|
+
await this.request("GET", "/governance/ai-assistant/conversations", { query: { limit: opts.limit } })
|
|
2440
2641
|
);
|
|
2441
2642
|
}
|
|
2442
2643
|
/**
|
|
@@ -2467,7 +2668,15 @@ var Seclai = class {
|
|
|
2467
2668
|
*/
|
|
2468
2669
|
async listAlerts(opts = {}) {
|
|
2469
2670
|
return await this.request("GET", "/alerts", {
|
|
2470
|
-
query: {
|
|
2671
|
+
query: {
|
|
2672
|
+
page: opts.page,
|
|
2673
|
+
limit: opts.limit,
|
|
2674
|
+
status: opts.status,
|
|
2675
|
+
agent_id: opts.agentId,
|
|
2676
|
+
source_connection_id: opts.sourceConnectionId,
|
|
2677
|
+
time_from: opts.timeFrom,
|
|
2678
|
+
time_to: opts.timeTo
|
|
2679
|
+
}
|
|
2471
2680
|
});
|
|
2472
2681
|
}
|
|
2473
2682
|
/**
|
|
@@ -2526,7 +2735,15 @@ var Seclai = class {
|
|
|
2526
2735
|
*/
|
|
2527
2736
|
async listAlertConfigs(opts = {}) {
|
|
2528
2737
|
return keyedList(
|
|
2529
|
-
await this.request("GET", "/alerts/configs", {
|
|
2738
|
+
await this.request("GET", "/alerts/configs", {
|
|
2739
|
+
query: {
|
|
2740
|
+
page: opts.page,
|
|
2741
|
+
limit: opts.limit,
|
|
2742
|
+
agent_id: opts.agentId,
|
|
2743
|
+
source_connection_id: opts.sourceConnectionId,
|
|
2744
|
+
scope: opts.scope
|
|
2745
|
+
}
|
|
2746
|
+
}),
|
|
2530
2747
|
"configs",
|
|
2531
2748
|
["total"]
|
|
2532
2749
|
);
|
|
@@ -2570,10 +2787,14 @@ var Seclai = class {
|
|
|
2570
2787
|
// ─── Organization Alert Preferences ────────────────────────────────────────
|
|
2571
2788
|
/**
|
|
2572
2789
|
* List organization alert preferences.
|
|
2790
|
+
*
|
|
2791
|
+
* @param opts - Organization filter, and whether to include default subscriptions.
|
|
2573
2792
|
*/
|
|
2574
|
-
async listOrganizationAlertPreferences() {
|
|
2793
|
+
async listOrganizationAlertPreferences(opts = {}) {
|
|
2575
2794
|
return keyedList(
|
|
2576
|
-
await this.request("GET", "/alerts/organization-preferences/list"
|
|
2795
|
+
await this.request("GET", "/alerts/organization-preferences/list", {
|
|
2796
|
+
query: { organization_id: opts.organizationId, include_defaults: opts.includeDefaults }
|
|
2797
|
+
}),
|
|
2577
2798
|
"preferences",
|
|
2578
2799
|
["total"]
|
|
2579
2800
|
);
|
|
@@ -2598,13 +2819,15 @@ var Seclai = class {
|
|
|
2598
2819
|
/**
|
|
2599
2820
|
* List model alerts.
|
|
2600
2821
|
*
|
|
2601
|
-
* @param opts - Pagination
|
|
2822
|
+
* @param opts - Pagination, an agent filter and `unreadOnly`.
|
|
2602
2823
|
*/
|
|
2603
2824
|
async listModelAlerts(opts = {}) {
|
|
2604
2825
|
const limit = opts.limit ?? 50;
|
|
2605
2826
|
const offset = opts.page && opts.page > 1 ? (opts.page - 1) * limit : void 0;
|
|
2606
2827
|
return keyedList(
|
|
2607
|
-
await this.request("GET", "/models/alerts", {
|
|
2828
|
+
await this.request("GET", "/models/alerts", {
|
|
2829
|
+
query: { offset, limit: opts.limit, agent_id: opts.agentId, unread_only: opts.unreadOnly }
|
|
2830
|
+
}),
|
|
2608
2831
|
"alerts",
|
|
2609
2832
|
["total"]
|
|
2610
2833
|
);
|
|
@@ -2633,9 +2856,18 @@ var Seclai = class {
|
|
|
2633
2856
|
* Get model recommendations.
|
|
2634
2857
|
*
|
|
2635
2858
|
* @param modelId - Model identifier.
|
|
2859
|
+
* @param opts - Capabilities and limits a recommended model must have.
|
|
2636
2860
|
*/
|
|
2637
|
-
async getModelRecommendations(modelId) {
|
|
2638
|
-
return await this.request("GET", `/models/${modelId}/recommendations
|
|
2861
|
+
async getModelRecommendations(modelId, opts = {}) {
|
|
2862
|
+
return await this.request("GET", `/models/${modelId}/recommendations`, {
|
|
2863
|
+
query: {
|
|
2864
|
+
require_tool_use: opts.requireToolUse,
|
|
2865
|
+
require_structured_output: opts.requireStructuredOutput,
|
|
2866
|
+
require_thinking: opts.requireThinking,
|
|
2867
|
+
min_context_tokens: opts.minContextTokens,
|
|
2868
|
+
min_output_tokens: opts.minOutputTokens
|
|
2869
|
+
}
|
|
2870
|
+
});
|
|
2639
2871
|
}
|
|
2640
2872
|
/**
|
|
2641
2873
|
* List all enabled LLM models grouped by provider.
|
|
@@ -2707,7 +2939,9 @@ var Seclai = class {
|
|
|
2707
2939
|
/**
|
|
2708
2940
|
* List model playground experiments.
|
|
2709
2941
|
*
|
|
2710
|
-
* @param opts -
|
|
2942
|
+
* @param opts - Date range and offset paging. Only `startDate` and `endDate`
|
|
2943
|
+
* together replace `days`; either one alone is ignored and the last `days`
|
|
2944
|
+
* days apply (server default 30).
|
|
2711
2945
|
*/
|
|
2712
2946
|
async listExperiments(opts = {}) {
|
|
2713
2947
|
return keyedList(
|
|
@@ -3038,9 +3272,13 @@ var Seclai = class {
|
|
|
3038
3272
|
}
|
|
3039
3273
|
/**
|
|
3040
3274
|
* Get AI assistant memory bank conversation history.
|
|
3275
|
+
*
|
|
3276
|
+
* @param opts - Turns to return (server default 5) and most-recent turns to skip (default 0).
|
|
3041
3277
|
*/
|
|
3042
|
-
async getAiAssistantMemoryBankHistory() {
|
|
3043
|
-
return await this.request("GET", "/ai-assistant/memory-bank/last-conversation"
|
|
3278
|
+
async getAiAssistantMemoryBankHistory(opts = {}) {
|
|
3279
|
+
return await this.request("GET", "/ai-assistant/memory-bank/last-conversation", {
|
|
3280
|
+
query: { limit: opts.limit, offset: opts.offset }
|
|
3281
|
+
});
|
|
3044
3282
|
}
|
|
3045
3283
|
/**
|
|
3046
3284
|
* Accept an AI assistant suggestion.
|