@seclai/sdk 1.7.0 → 1.9.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/dist/index.js CHANGED
@@ -13,10 +13,13 @@ var SeclaiApiVersion = {
13
13
  V2026_10_18: "2026-10-18",
14
14
  V2026_10_19: "2026-10-19",
15
15
  V2026_10_21: "2026-10-21",
16
+ V2026_10_28: "2026-10-28",
17
+ V2026_11_02: "2026-11-02",
18
+ V2026_11_04: "2026-11-04",
16
19
  /** Baseline applied to an unpinned, header-less caller. */
17
20
  Default: "2026-07-01",
18
21
  /** Newest version known to this SDK release. May lag the server. */
19
- Latest: "2026-10-21"
22
+ Latest: "2026-11-04"
20
23
  };
21
24
  var KNOWN_API_VERSIONS = Object.entries(SeclaiApiVersion).filter(([k]) => k.startsWith("V")).map(([, v]) => v);
22
25
 
@@ -63,10 +66,17 @@ var SeclaiAPIValidationError = class extends SeclaiAPIStatusError {
63
66
  var SeclaiStreamingError = class extends SeclaiError {
64
67
  /** The run ID associated with the failed stream, when available. */
65
68
  runId;
66
- constructor(message, runId) {
69
+ /**
70
+ * Set by `runStreamingAgentAndWait()` and `runAgentAndPoll()` to the latest
71
+ * run they had, if any (when it has `result_reported_at` set, its `output`
72
+ * is the answer). The run may still be in progress, and can still fail.
73
+ */
74
+ run;
75
+ constructor(message, runId, run) {
67
76
  super(message);
68
77
  this.name = "SeclaiStreamingError";
69
78
  this.runId = runId;
79
+ this.run = run;
70
80
  }
71
81
  };
72
82
 
@@ -850,6 +860,20 @@ var Seclai = class {
850
860
  query: { page: opts.page, limit: opts.limit }
851
861
  });
852
862
  }
863
+ /**
864
+ * List the agent gallery: example agents to start from.
865
+ *
866
+ * Pass an entry's `key` as `agent_template` to {@link createAgent}, with
867
+ * `resource_bindings` for the resources it needs.
868
+ *
869
+ * @param opts - Text search, use-case filter and pagination.
870
+ * @returns A page of gallery entries.
871
+ */
872
+ async listAgentExamples(opts = {}) {
873
+ return await this.request("GET", "/agents/examples", {
874
+ query: { query: opts.query, use_case: opts.useCase, page: opts.page, limit: opts.limit }
875
+ });
876
+ }
853
877
  /**
854
878
  * Create a new agent.
855
879
  *
@@ -1068,11 +1092,46 @@ var Seclai = class {
1068
1092
  * takes no `include_reasoning`, and one passed anyway is not sent: this method
1069
1093
  * returns no `stream_reasoning` events.
1070
1094
  *
1095
+ * A `result` event carries the run's answer in `output` once
1096
+ * `result_reported_at` is set, and can arrive while later steps still run.
1097
+ * Pass `returnOnResult: true` to return that `result` snapshot as soon as it
1098
+ * arrives, without waiting for `done`. Such a run may still be in progress:
1099
+ * its `status` is not terminal and the run can still fail, so check
1100
+ * `result_reported_at`, not `status`.
1101
+ *
1102
+ * If `timeoutMs` elapses, this throws {@link SeclaiStreamingError} with the
1103
+ * latest snapshot in `run`: the `result` snapshot if one arrived, else the
1104
+ * `init` snapshot. An abort from `signal` rethrows the abort error.
1105
+ *
1106
+ * By default, a stream that ends before `done` returns the latest snapshot
1107
+ * when its status is not `pending`, so the run returned may not have
1108
+ * finished: check `status` and `result_reported_at`. A stream that breaks
1109
+ * throws the fetch error. Pass `throwOnIncomplete: true` to throw
1110
+ * {@link SeclaiStreamingError} with the snapshot in `run` in both cases
1111
+ * instead; it is recommended, and becomes the default in the next major
1112
+ * version.
1113
+ *
1071
1114
  * @param agentId - Agent identifier.
1072
1115
  * @param body - Streaming run request payload, without `include_reasoning`.
1073
- * @param opts - Timeout and abort signal options.
1074
- * @returns Final agent run payload from the `done` event.
1075
- * @throws {@link SeclaiStreamingError} If the stream ends before a `done` event.
1116
+ * @param opts - Timeout, abort signal and `returnOnResult` options.
1117
+ * @returns The run from the `done` event; with `returnOnResult`, the
1118
+ * `result` snapshot; without `throwOnIncomplete`, possibly an unfinished
1119
+ * snapshot (see above).
1120
+ * @throws {@link SeclaiStreamingError} If `timeoutMs` elapses, or, with
1121
+ * `throwOnIncomplete`, the stream ends or breaks, before the run finished.
1122
+ * Its `run` holds the latest snapshot.
1123
+ *
1124
+ * @example
1125
+ * ```ts
1126
+ * try {
1127
+ * const run = await client.runStreamingAgentAndWait("agent-id", { input: "Hello" }, { throwOnIncomplete: true });
1128
+ * console.log(run.output);
1129
+ * } catch (err) {
1130
+ * if (err instanceof SeclaiStreamingError && err.run?.result_reported_at) {
1131
+ * console.log("Answer (run not finished):", err.run.output);
1132
+ * } else throw err;
1133
+ * }
1134
+ * ```
1076
1135
  */
1077
1136
  async runStreamingAgentAndWait(agentId, body, opts) {
1078
1137
  const { include_reasoning: _ignored, ...runBody } = body;
@@ -1092,6 +1151,7 @@ var Seclai = class {
1092
1151
  }, timeoutMs);
1093
1152
  const signal = anySignal([opts?.signal, timeoutController.signal]);
1094
1153
  let lastSeen;
1154
+ let reported;
1095
1155
  try {
1096
1156
  const init = { method: "POST", headers, body: JSON.stringify(runBody) };
1097
1157
  if (signal) init.signal = signal;
@@ -1120,7 +1180,14 @@ var Seclai = class {
1120
1180
  });
1121
1181
  }
1122
1182
  if (isJson) {
1123
- return await response.json();
1183
+ const run2 = await response.json();
1184
+ const status = run2.status;
1185
+ const finished = status === "completed" || status === "failed" || status === "cancelled" || Boolean(opts?.returnOnResult && run2.result_reported_at);
1186
+ if (opts?.throwOnIncomplete && !finished) {
1187
+ const state2 = run2.result_reported_at ? "A result had been reported; see `run`." : "No result had been reported.";
1188
+ throw new SeclaiStreamingError(`The server answered with JSON for a run that has not finished. ${state2}`, run2.run_id, run2);
1189
+ }
1190
+ return run2;
1124
1191
  }
1125
1192
  if (!response.body) {
1126
1193
  throw new SeclaiConfigurationError(
@@ -1132,31 +1199,48 @@ var Seclai = class {
1132
1199
  let final;
1133
1200
  const parser = createSseParser((msg) => {
1134
1201
  if (!msg.data) return;
1135
- if (msg.event === "init" || msg.event === "done") {
1202
+ if (msg.event === "init" || msg.event === "result" || msg.event === "done") {
1136
1203
  try {
1137
1204
  const parsed = JSON.parse(msg.data);
1138
1205
  lastSeen = parsed;
1206
+ if (msg.event === "result") reported = parsed;
1139
1207
  if (msg.event === "done") final = parsed;
1140
1208
  } catch {
1141
1209
  }
1142
1210
  }
1143
1211
  });
1144
- while (!final) {
1145
- const { value, done } = await reader.read();
1146
- if (done) break;
1147
- if (value) parser.feed(decoder.decode(value, { stream: true }));
1212
+ let readFailure;
1213
+ try {
1214
+ while (!final && !(opts?.returnOnResult && reported)) {
1215
+ const { value, done } = await reader.read();
1216
+ if (done) break;
1217
+ if (value) parser.feed(decoder.decode(value, { stream: true }));
1218
+ }
1219
+ } catch (err) {
1220
+ if (opts?.signal?.aborted || !opts?.throwOnIncomplete && !timedOut) throw err;
1221
+ readFailure = err instanceof Error ? err.message : String(err);
1148
1222
  }
1223
+ parser.feed(decoder.decode());
1149
1224
  parser.end();
1150
1225
  if (final) return final;
1151
- if (lastSeen && lastSeen.status && lastSeen.status !== "pending") {
1226
+ if (opts?.returnOnResult && reported) {
1227
+ reader.cancel().catch(() => {
1228
+ });
1229
+ return reported;
1230
+ }
1231
+ if (!opts?.throwOnIncomplete && !timedOut && lastSeen?.status && lastSeen.status !== "pending") {
1152
1232
  return lastSeen;
1153
1233
  }
1154
- throw new SeclaiStreamingError("Stream ended before receiving a 'done' event.", lastSeen?.run_id);
1234
+ const run = reported ?? lastSeen;
1235
+ const state = reported ? "A result had been reported; see `run`." : "No result had been reported.";
1236
+ const reason = timedOut ? `Timed out after ${timeoutMs}ms before the streaming agent run finished.` : readFailure !== void 0 ? `Stream failed before the run finished: ${readFailure}.` : "Stream ended before receiving a 'done' event.";
1237
+ throw new SeclaiStreamingError(`${reason} ${state}`, run?.run_id, run);
1155
1238
  } catch (err) {
1156
- if (timedOut) {
1239
+ if (timedOut && !opts?.signal?.aborted && !(err instanceof SeclaiStreamingError)) {
1157
1240
  throw new SeclaiStreamingError(
1158
1241
  `Timed out after ${timeoutMs}ms waiting for streaming agent run to complete.`,
1159
- lastSeen?.run_id
1242
+ lastSeen?.run_id,
1243
+ reported ?? lastSeen
1160
1244
  );
1161
1245
  }
1162
1246
  throw err;
@@ -1178,6 +1262,10 @@ var Seclai = class {
1178
1262
  * @example
1179
1263
  * ```ts
1180
1264
  * for await (const event of client.runStreamingAgent("agent-id", { input: "Hello!" })) {
1265
+ * // `result` carries the answer in `output`, possibly before later steps finish.
1266
+ * if (event.event === "result") {
1267
+ * console.log("Answer:", (event.data as AgentRunResponse).output);
1268
+ * }
1181
1269
  * if (event.event === "done") {
1182
1270
  * console.log("Final:", event.data);
1183
1271
  * }
@@ -1281,11 +1369,38 @@ var Seclai = class {
1281
1369
  *
1282
1370
  * This is useful in environments where SSE streaming is unavailable.
1283
1371
  *
1372
+ * A run's answer can be ready before its last step finishes: once
1373
+ * `result_reported_at` is set, `output` holds the answer. Pass
1374
+ * `returnOnResult: true` to return as soon as a run has it set, the run
1375
+ * `runAgent()` returns included. With `includeStepOutputs`, when that run
1376
+ * would end the poll and `signal` is not aborted, it is fetched again at
1377
+ * once for its step outputs.
1378
+ * Such a run may still be in progress: its `status` is not terminal and the
1379
+ * run can still fail, so check `result_reported_at`, not `status`.
1380
+ *
1381
+ * When `timeoutMs` elapses first, this throws {@link SeclaiStreamingError}
1382
+ * with the latest run it has (the `runAgent()` response if no poll ran) in
1383
+ * `run`. If that run has `result_reported_at`
1384
+ * set, its `output` is the answer.
1385
+ *
1386
+ * `signal` is checked at the top of each poll, after the check for a run
1387
+ * that ends the poll. A run that has ended the poll by then, whether the
1388
+ * start run or a polled one, is returned even after an abort; the start run
1389
+ * then comes back without step outputs, even when `includeStepOutputs` is
1390
+ * set. Otherwise an abort throws `SeclaiError("Polling aborted.")`, which is
1391
+ * not an `AbortError` and does not carry `signal.reason`.
1392
+ *
1284
1393
  * @param agentId - Agent identifier.
1285
1394
  * @param body - Run request payload.
1286
1395
  * @param opts - Polling configuration and abort signal.
1287
- * @returns The terminal agent run.
1288
- * @throws {@link SeclaiStreamingError} On timeout.
1396
+ * @returns The terminal agent run, or, with `returnOnResult`, the first run
1397
+ * with `result_reported_at` set.
1398
+ * @throws {@link SeclaiStreamingError} If `timeoutMs` elapses before the run
1399
+ * finished. Its `run` holds the latest run it has (the `runAgent()`
1400
+ * response if no poll ran).
1401
+ * @throws {@link SeclaiError} `"Polling aborted."` If `signal` is aborted and,
1402
+ * at the next poll's check, the run has not ended the poll. It is not an
1403
+ * `AbortError` and does not carry `signal.reason`.
1289
1404
  */
1290
1405
  async runAgentAndPoll(agentId, body, opts) {
1291
1406
  const pollInterval = opts?.pollIntervalMs ?? 2e3;
@@ -1294,20 +1409,29 @@ var Seclai = class {
1294
1409
  const run = await this.runAgent(agentId, body);
1295
1410
  const runId = run.id ?? run.run_id;
1296
1411
  if (!runId) throw new SeclaiError("Agent run response did not contain an id.");
1412
+ let current = run;
1413
+ if (opts?.includeStepOutputs) {
1414
+ const status = run.status;
1415
+ if (status === "completed" || status === "failed" || status === "cancelled" || opts.returnOnResult && run.result_reported_at) {
1416
+ if (!opts.signal?.aborted) current = await this.getAgentRun(runId, { includeStepOutputs: true });
1417
+ }
1418
+ }
1297
1419
  while (true) {
1420
+ const status = current.status;
1421
+ if (status === "completed" || status === "failed" || status === "cancelled") {
1422
+ return current;
1423
+ }
1424
+ if (opts?.returnOnResult && current.result_reported_at) return current;
1298
1425
  if (opts?.signal?.aborted) throw new SeclaiError("Polling aborted.");
1299
1426
  if (Date.now() - startTime > timeout) {
1300
- throw new SeclaiStreamingError(`Polling timed out after ${timeout}ms.`, runId);
1427
+ const state = current.result_reported_at ? "A result had been reported; see `run`." : "No result had been reported.";
1428
+ throw new SeclaiStreamingError(`Polling timed out after ${timeout}ms. ${state}`, runId, current);
1301
1429
  }
1302
1430
  await new Promise((r) => setTimeout(r, pollInterval));
1303
- const current = await this.getAgentRun(
1431
+ current = await this.getAgentRun(
1304
1432
  runId,
1305
1433
  opts?.includeStepOutputs ? { includeStepOutputs: true } : void 0
1306
1434
  );
1307
- const status = current.status;
1308
- if (status === "completed" || status === "failed" || status === "cancelled") {
1309
- return current;
1310
- }
1311
1435
  }
1312
1436
  }
1313
1437
  // ═══════════════════════════════════════════════════════════════════════════
@@ -1530,12 +1654,19 @@ var Seclai = class {
1530
1654
  * List evaluation results for a specific criteria.
1531
1655
  *
1532
1656
  * @param criteriaId - Criteria identifier.
1533
- * @param opts - Pagination options.
1657
+ * @param opts - Pagination, status, flag and time-range filters.
1534
1658
  */
1535
1659
  async listEvaluationResults(criteriaId, opts = {}) {
1536
1660
  return keyedList(
1537
1661
  await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/results`, {
1538
- query: { page: opts.page, limit: opts.limit }
1662
+ query: {
1663
+ page: opts.page,
1664
+ limit: opts.limit,
1665
+ status: opts.status,
1666
+ flagged_only: opts.flaggedOnly,
1667
+ time_from: opts.timeFrom,
1668
+ time_to: opts.timeTo
1669
+ }
1539
1670
  }),
1540
1671
  "data",
1541
1672
  PAGE_COUNTERS
@@ -1555,12 +1686,12 @@ var Seclai = class {
1555
1686
  * List runs compatible with a specific evaluation criteria.
1556
1687
  *
1557
1688
  * @param criteriaId - Criteria identifier.
1558
- * @param opts - Pagination options.
1689
+ * @param opts - Pagination and a `startedAfter` filter.
1559
1690
  */
1560
1691
  async listCompatibleRuns(criteriaId, opts = {}) {
1561
1692
  return keyedList(
1562
1693
  await this.request("GET", `/agents/evaluation-criteria/${criteriaId}/compatible-runs`, {
1563
- query: { page: opts.page, limit: opts.limit }
1694
+ query: { page: opts.page, limit: opts.limit, started_after: opts.startedAfter }
1564
1695
  }),
1565
1696
  "data",
1566
1697
  PAGE_COUNTERS
@@ -1580,12 +1711,20 @@ var Seclai = class {
1580
1711
  * List all evaluation results for an agent.
1581
1712
  *
1582
1713
  * @param agentId - Agent identifier.
1583
- * @param opts - Pagination options.
1714
+ * @param opts - Pagination, status, step, flag and time-range filters.
1584
1715
  */
1585
1716
  async listAgentEvaluationResults(agentId, opts = {}) {
1586
1717
  return keyedList(
1587
1718
  await this.request("GET", `/agents/${agentId}/evaluation-results`, {
1588
- query: { page: opts.page, limit: opts.limit }
1719
+ query: {
1720
+ page: opts.page,
1721
+ limit: opts.limit,
1722
+ status: opts.status,
1723
+ step: opts.step,
1724
+ flagged_only: opts.flaggedOnly,
1725
+ time_from: opts.timeFrom,
1726
+ time_to: opts.timeTo
1727
+ }
1589
1728
  }),
1590
1729
  "data",
1591
1730
  PAGE_COUNTERS
@@ -1595,25 +1734,35 @@ var Seclai = class {
1595
1734
  * List evaluation run summaries for an agent.
1596
1735
  *
1597
1736
  * @param agentId - Agent identifier.
1598
- * @param opts - Pagination options.
1737
+ * @param opts - Pagination, status, step and time-range filters.
1599
1738
  */
1600
1739
  async listEvaluationRuns(agentId, opts = {}) {
1601
1740
  return keyedList(
1602
1741
  await this.request("GET", `/agents/${agentId}/evaluation-runs`, {
1603
- query: { page: opts.page, limit: opts.limit }
1742
+ query: {
1743
+ page: opts.page,
1744
+ limit: opts.limit,
1745
+ status: opts.status,
1746
+ step: opts.step,
1747
+ time_from: opts.timeFrom,
1748
+ time_to: opts.timeTo
1749
+ }
1604
1750
  }),
1605
1751
  "data",
1606
1752
  PAGE_COUNTERS
1607
1753
  );
1608
1754
  }
1609
1755
  /**
1610
- * Get a summary of non-manual evaluations across an agent's runs.
1756
+ * Get a summary of non-manual evaluations, for one agent or the whole account.
1611
1757
  *
1612
- * @param agentId - Agent identifier.
1758
+ * @param agentId - Agent identifier. Omit (pass `undefined`) for the account-wide summary.
1759
+ * @param opts - Date range. `startDate` and `endDate` together set the range;
1760
+ * `startDate` alone runs from it through today; otherwise the last `days`
1761
+ * days apply (server default 30), and an `endDate` without `startDate` is ignored.
1613
1762
  */
1614
- async getNonManualEvaluationSummary(agentId) {
1763
+ async getNonManualEvaluationSummary(agentId, opts = {}) {
1615
1764
  return await this.request("GET", "/agents/evaluation-results/non-manual-summary", {
1616
- query: { agent_id: agentId }
1765
+ query: { agent_id: agentId, days: opts.days, start_date: opts.startDate, end_date: opts.endDate }
1617
1766
  });
1618
1767
  }
1619
1768
  // ═══════════════════════════════════════════════════════════════════════════
@@ -1637,6 +1786,27 @@ var Seclai = class {
1637
1786
  json: body
1638
1787
  });
1639
1788
  }
1789
+ // ═══════════════════════════════════════════════════════════════════════════
1790
+ // Agent Slack Triggers
1791
+ // ═══════════════════════════════════════════════════════════════════════════
1792
+ /**
1793
+ * Configure an agent's `SLACK_COMMAND` trigger, which people run from Slack
1794
+ * with `/seclai` or the message shortcut.
1795
+ *
1796
+ * Sets the Slack connection, `alias` (the name people type after `/seclai`),
1797
+ * form, channels, reply visibility and conversation settings. Omitted fields
1798
+ * are left unchanged. `input` is deprecated and ignored by the API.
1799
+ *
1800
+ * @param agentId - Agent identifier.
1801
+ * @param triggerId - Trigger identifier.
1802
+ * @param body - The fields to set.
1803
+ * @returns The trigger's full Slack config, including any `missing_scopes`.
1804
+ */
1805
+ async setSlackTriggerConfig(agentId, triggerId, body) {
1806
+ return await this.request("PUT", `/agents/${agentId}/triggers/${triggerId}/slack-config`, {
1807
+ json: body
1808
+ });
1809
+ }
1640
1810
  /**
1641
1811
  * Replace the input attachments a trigger accepts.
1642
1812
  *
@@ -1655,6 +1825,40 @@ var Seclai = class {
1655
1825
  json: body
1656
1826
  });
1657
1827
  }
1828
+ /**
1829
+ * Get the run metadata keys a trigger declares.
1830
+ *
1831
+ * Steps may reference a declared key as `{{metadata.<key>}}`. The response
1832
+ * also lists the system and source keys the trigger's type can declare.
1833
+ *
1834
+ * @param agentId - Agent identifier.
1835
+ * @param triggerId - Trigger identifier, as `getAgent()` returns it.
1836
+ * @returns The trigger's declared and declarable metadata keys.
1837
+ */
1838
+ async getMetadataKeys(agentId, triggerId) {
1839
+ return await this.request(
1840
+ "GET",
1841
+ `/agents/${agentId}/triggers/${triggerId}/metadata-keys`
1842
+ );
1843
+ }
1844
+ /**
1845
+ * Replace the run metadata keys a trigger declares.
1846
+ *
1847
+ * The body is the whole declaration and replaces the current one. The API
1848
+ * answers 400 when the agent references a key that no trigger of its branch
1849
+ * declares.
1850
+ *
1851
+ * @param agentId - Agent identifier.
1852
+ * @param triggerId - Trigger identifier, as `getAgent()` returns it.
1853
+ * @param body - The full declaration; each key's `required` defaults to `false`.
1854
+ * @returns The trigger's metadata keys, with `warnings` naming agents whose
1855
+ * `call_agent` mapping no longer fits.
1856
+ */
1857
+ async setMetadataKeys(agentId, triggerId, body) {
1858
+ return await this.request("PUT", `/agents/${agentId}/triggers/${triggerId}/metadata-keys`, {
1859
+ json: body
1860
+ });
1861
+ }
1658
1862
  // ═══════════════════════════════════════════════════════════════════════════
1659
1863
  // Agent Email Governance
1660
1864
  // ═══════════════════════════════════════════════════════════════════════════
@@ -1821,6 +2025,21 @@ var Seclai = class {
1821
2025
  async getKnowledgeBase(knowledgeBaseId) {
1822
2026
  return await this.request("GET", `/knowledge_bases/${knowledgeBaseId}`);
1823
2027
  }
2028
+ /**
2029
+ * Get the item-metadata keys seen in a knowledge base's content.
2030
+ *
2031
+ * Reports, for all time and the last 30 and 7 days, each key's item count,
2032
+ * number of distinct values and five most frequent values.
2033
+ *
2034
+ * @param knowledgeBaseId - Knowledge base identifier.
2035
+ * @returns The key statistics per window.
2036
+ */
2037
+ async getKnowledgeBaseMetadataKeyStats(knowledgeBaseId) {
2038
+ return await this.request(
2039
+ "GET",
2040
+ `/knowledge_bases/${knowledgeBaseId}/metadata-key-stats`
2041
+ );
2042
+ }
1824
2043
  /**
1825
2044
  * Update a knowledge base.
1826
2045
  *
@@ -1845,13 +2064,13 @@ var Seclai = class {
1845
2064
  /**
1846
2065
  * List memory banks.
1847
2066
  *
1848
- * @param opts - Pagination and sorting options.
2067
+ * @param opts - Pagination, sorting and a `type` filter.
1849
2068
  * @returns Paginated list of memory banks.
1850
2069
  */
1851
2070
  async listMemoryBanks(opts = {}) {
1852
2071
  return keyedList(
1853
2072
  await this.request("GET", "/memory_banks", {
1854
- query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
2073
+ query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order, type: opts.type }
1855
2074
  }),
1856
2075
  "memory_banks",
1857
2076
  PAGE_COUNTERS
@@ -1908,9 +2127,13 @@ var Seclai = class {
1908
2127
  * Get stats for a memory bank.
1909
2128
  *
1910
2129
  * @param memoryBankId - Memory bank identifier.
2130
+ * @param opts - Date range. Only `startDate` and `endDate` together replace
2131
+ * `days`; either one alone is ignored and the last `days` days apply (server default 30).
1911
2132
  */
1912
- async getMemoryBankStats(memoryBankId) {
1913
- return await this.request("GET", `/memory_banks/${memoryBankId}/stats`);
2133
+ async getMemoryBankStats(memoryBankId, opts = {}) {
2134
+ return await this.request("GET", `/memory_banks/${memoryBankId}/stats`, {
2135
+ query: { days: opts.days, start_date: opts.startDate, end_date: opts.endDate }
2136
+ });
1914
2137
  }
1915
2138
  /**
1916
2139
  * Compact a memory bank (trigger compaction).
@@ -1963,9 +2186,13 @@ var Seclai = class {
1963
2186
  }
1964
2187
  /**
1965
2188
  * Get the last AI conversation for memory banks.
2189
+ *
2190
+ * @param opts - Turns to return (server default 5) and most-recent turns to skip (default 0).
1966
2191
  */
1967
- async getMemoryBankAiLastConversation() {
1968
- return await this.request("GET", "/memory_banks/ai-assistant/last-conversation");
2192
+ async getMemoryBankAiLastConversation(opts = {}) {
2193
+ return await this.request("GET", "/memory_banks/ai-assistant/last-conversation", {
2194
+ query: { limit: opts.limit, offset: opts.offset }
2195
+ });
1969
2196
  }
1970
2197
  /**
1971
2198
  * Accept a memory bank AI suggestion.
@@ -2362,12 +2589,12 @@ var Seclai = class {
2362
2589
  /**
2363
2590
  * List solutions.
2364
2591
  *
2365
- * @param opts - Pagination and sorting options.
2592
+ * @param opts - Pagination, sorting and a name `search`.
2366
2593
  * @returns Paginated list of solutions.
2367
2594
  */
2368
2595
  async listSolutions(opts = {}) {
2369
2596
  return await this.request("GET", "/solutions", {
2370
- query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order }
2597
+ query: { page: opts.page, limit: opts.limit, sort: opts.sort, order: opts.order, search: opts.search }
2371
2598
  });
2372
2599
  }
2373
2600
  /**
@@ -2564,10 +2791,12 @@ var Seclai = class {
2564
2791
  }
2565
2792
  /**
2566
2793
  * List governance AI conversations.
2794
+ *
2795
+ * @param opts - `limit`: how many conversations (the server defaults to 20).
2567
2796
  */
2568
- async listGovernanceAiConversations() {
2797
+ async listGovernanceAiConversations(opts = {}) {
2569
2798
  return listItems(
2570
- await this.request("GET", "/governance/ai-assistant/conversations")
2799
+ await this.request("GET", "/governance/ai-assistant/conversations", { query: { limit: opts.limit } })
2571
2800
  );
2572
2801
  }
2573
2802
  /**
@@ -2598,7 +2827,15 @@ var Seclai = class {
2598
2827
  */
2599
2828
  async listAlerts(opts = {}) {
2600
2829
  return await this.request("GET", "/alerts", {
2601
- query: { page: opts.page, limit: opts.limit, status: opts.status }
2830
+ query: {
2831
+ page: opts.page,
2832
+ limit: opts.limit,
2833
+ status: opts.status,
2834
+ agent_id: opts.agentId,
2835
+ source_connection_id: opts.sourceConnectionId,
2836
+ time_from: opts.timeFrom,
2837
+ time_to: opts.timeTo
2838
+ }
2602
2839
  });
2603
2840
  }
2604
2841
  /**
@@ -2657,7 +2894,15 @@ var Seclai = class {
2657
2894
  */
2658
2895
  async listAlertConfigs(opts = {}) {
2659
2896
  return keyedList(
2660
- await this.request("GET", "/alerts/configs", { query: { page: opts.page, limit: opts.limit } }),
2897
+ await this.request("GET", "/alerts/configs", {
2898
+ query: {
2899
+ page: opts.page,
2900
+ limit: opts.limit,
2901
+ agent_id: opts.agentId,
2902
+ source_connection_id: opts.sourceConnectionId,
2903
+ scope: opts.scope
2904
+ }
2905
+ }),
2661
2906
  "configs",
2662
2907
  ["total"]
2663
2908
  );
@@ -2701,10 +2946,14 @@ var Seclai = class {
2701
2946
  // ─── Organization Alert Preferences ────────────────────────────────────────
2702
2947
  /**
2703
2948
  * List organization alert preferences.
2949
+ *
2950
+ * @param opts - Organization filter, and whether to include default subscriptions.
2704
2951
  */
2705
- async listOrganizationAlertPreferences() {
2952
+ async listOrganizationAlertPreferences(opts = {}) {
2706
2953
  return keyedList(
2707
- await this.request("GET", "/alerts/organization-preferences/list"),
2954
+ await this.request("GET", "/alerts/organization-preferences/list", {
2955
+ query: { organization_id: opts.organizationId, include_defaults: opts.includeDefaults }
2956
+ }),
2708
2957
  "preferences",
2709
2958
  ["total"]
2710
2959
  );
@@ -2729,13 +2978,15 @@ var Seclai = class {
2729
2978
  /**
2730
2979
  * List model alerts.
2731
2980
  *
2732
- * @param opts - Pagination options.
2981
+ * @param opts - Pagination, an agent filter and `unreadOnly`.
2733
2982
  */
2734
2983
  async listModelAlerts(opts = {}) {
2735
2984
  const limit = opts.limit ?? 50;
2736
2985
  const offset = opts.page && opts.page > 1 ? (opts.page - 1) * limit : void 0;
2737
2986
  return keyedList(
2738
- await this.request("GET", "/models/alerts", { query: { offset, limit: opts.limit } }),
2987
+ await this.request("GET", "/models/alerts", {
2988
+ query: { offset, limit: opts.limit, agent_id: opts.agentId, unread_only: opts.unreadOnly }
2989
+ }),
2739
2990
  "alerts",
2740
2991
  ["total"]
2741
2992
  );
@@ -2764,9 +3015,18 @@ var Seclai = class {
2764
3015
  * Get model recommendations.
2765
3016
  *
2766
3017
  * @param modelId - Model identifier.
3018
+ * @param opts - Capabilities and limits a recommended model must have.
2767
3019
  */
2768
- async getModelRecommendations(modelId) {
2769
- return await this.request("GET", `/models/${modelId}/recommendations`);
3020
+ async getModelRecommendations(modelId, opts = {}) {
3021
+ return await this.request("GET", `/models/${modelId}/recommendations`, {
3022
+ query: {
3023
+ require_tool_use: opts.requireToolUse,
3024
+ require_structured_output: opts.requireStructuredOutput,
3025
+ require_thinking: opts.requireThinking,
3026
+ min_context_tokens: opts.minContextTokens,
3027
+ min_output_tokens: opts.minOutputTokens
3028
+ }
3029
+ });
2770
3030
  }
2771
3031
  /**
2772
3032
  * List all enabled LLM models grouped by provider.
@@ -2838,7 +3098,9 @@ var Seclai = class {
2838
3098
  /**
2839
3099
  * List model playground experiments.
2840
3100
  *
2841
- * @param opts - Optional filters and pagination.
3101
+ * @param opts - Date range and offset paging. Only `startDate` and `endDate`
3102
+ * together replace `days`; either one alone is ignored and the last `days`
3103
+ * days apply (server default 30).
2842
3104
  */
2843
3105
  async listExperiments(opts = {}) {
2844
3106
  return keyedList(
@@ -3169,9 +3431,13 @@ var Seclai = class {
3169
3431
  }
3170
3432
  /**
3171
3433
  * Get AI assistant memory bank conversation history.
3434
+ *
3435
+ * @param opts - Turns to return (server default 5) and most-recent turns to skip (default 0).
3172
3436
  */
3173
- async getAiAssistantMemoryBankHistory() {
3174
- return await this.request("GET", "/ai-assistant/memory-bank/last-conversation");
3437
+ async getAiAssistantMemoryBankHistory(opts = {}) {
3438
+ return await this.request("GET", "/ai-assistant/memory-bank/last-conversation", {
3439
+ query: { limit: opts.limit, offset: opts.offset }
3440
+ });
3175
3441
  }
3176
3442
  /**
3177
3443
  * Accept an AI assistant suggestion.