@seclai/sdk 1.6.1 → 1.7.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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.0] - 2026-10-21
4
+
5
+ ### Changed
6
+
7
+ - **Breaking:** Type `score` and `passed` on `TestDraftEvaluationResponse` as `number | null` and `boolean | null` when `status` is `error`. From `apiVersion` `2026-10-21`, which an account created after it ships gets even without setting `apiVersion`, an evaluator that returns no verdict sends them as `null`. Under `strictNullChecks`, code that reads them without first checking `status` no longer compiles: check `result.status !== "error"` before reading them, after which they are `number` and `boolean` again. See [Upgrading to 1.7](https://github.com/seclai/seclai-javascript#upgrading-to-17)
8
+ - Sync the bundled OpenAPI spec and regenerate the types. Existing responses gain properties: `email_address`, `email_allowed_senders`, `feed_attachments`, `document_images` and the `cloud_drive_*` settings on `SourceResponse`, `trigger_id` on `AgentSummaryResponse`, `accepted_attachments` on `AgentAttachmentRefsApiResponse`, `email_run_on_attachment_mismatch` on `EmailTriggerConfigResponse`, `held_for_review` on `SourceContentStatusResponse`, `skipped_attachments` on `ContentDetailResponse`, `error` on `NonManualEvaluationSummaryResponse` and `NonManualEvaluationModeStatResponse`, and `status` on `TestDraftEvaluationResponse`
9
+ - Move `SeclaiApiVersion.Latest` to `2026-10-21`. Nothing is sent unless `apiVersion` is set, so a client that passes `SeclaiApiVersion.Latest` now opts into the six versions added below: `2026-10-05` reports an item held for review by a governance policy as `content_status` `completed` instead of `failed`, so code that looks for holds among failed items must read `held_for_review`; `2026-10-13` rejects a `media_types` value other than `images` or `video`, or any value on a source that is not a website or RSS feed, on `createSource()` and `updateSource()` with a 400 where it was dropped; `2026-10-16` accepts an upload of any type as `ready` at once and stops writing its extracted text into a run's `input`; `2026-10-18` defaults a source's `document_images` to `true` on a text-only embedder; `2026-10-19` rejects `polling_max_items` on `createSource()` for any source but an RSS feed with a 400 where it was stored; and `2026-10-21` leaves an evaluation result whose evaluator returned no verdict (`error`) out of `failed` and the rates in `getNonManualEvaluationSummary()` and out of `average_score` in `getEvaluationCriteriaSummary()`, and returns its `score` and `passed` from `testDraftEvaluation()` as `null` instead of 0.5 and `false`
10
+
11
+ ### Added
12
+
13
+ - Add `setAcceptedAttachments()` to declare the named input attachments a trigger accepts, and `accepted_attachments` on `createAgent()` and `updateAgentDefinition()`. A slot's server-defaulted `min` can be omitted: the slots are typed `AcceptedAttachmentSlotInput`, and the request `SetAcceptedAttachmentsInput`
14
+ - Add `listContentAttachments()`, `getContentAttachment()`, `listContentAttachmentEmbeddings()` and `downloadContentAttachment()` for the files attached to a content item, with their indexing status, text and embeddings. `downloadContentAttachment()` takes a `signal`
15
+ - Add `listEmailSourceRejections()` for the mail an email source refused
16
+ - Add `include_reasoning` to the `runStreamingAgent()` request, to receive `stream_reasoning` events. It stays optional although the schema gives it a default. `runStreamingAgentAndWait()`, which returns no such events, does not take it and does not send one passed anyway
17
+ - Accept the new source settings on `createSource()` and `updateSource()`: `email_allowed_senders`, `feed_attachments`, `document_images` and `cloud_drive_connection_id`, `cloud_drive_folder_path`, `cloud_drive_path_pattern`, `cloud_drive_content_types` and `cloud_drive_max_file_mb`, and `run_on_attachment_mismatch` on `setEmailTriggerConfig()`
18
+ - Add the `SeclaiApiVersion` constants `V2026_10_05`, `V2026_10_13`, `V2026_10_16`, `V2026_10_18`, `V2026_10_19` and `V2026_10_21`, so those versions are accepted as `apiVersion`. The README lists what each one changes
19
+ - Accept a `signal` on `downloadSourceExport()` and `downloadAgentRunAttachment()`
20
+ - Add the type exports `AcceptedAttachmentSlot`, `AcceptedAttachmentSlotInput`, `AcceptedAttachmentsResponse`, `SetAcceptedAttachmentsRequest`, `SetAcceptedAttachmentsInput`, `ContentAttachmentResponse`, `ContentAttachmentsListResponse`, `ContentAttachmentDetailResponse`, `SkippedAttachmentResponse`, `SkippedAttachmentReason`, `EmailSourceRejectionResponse` and `EmailSourceRejectionListResponse`
21
+
22
+ ### Fixed
23
+
24
+ - Correct `InsufficientCreditsResponse` and `InsufficientCreditsDetail` to the 402 body the API sends: the detail is under `error`, not `detail`, and its machine-readable code is `code`, not `error`. Code that cast a 402 body to this type and read `body.detail.error` threw on every real 402; read `body.error.code` instead
25
+
3
26
  ## [1.6.1] - 2026-10-05
4
27
 
5
28
  ### Changed
@@ -223,6 +246,7 @@ _Stable release. No functional changes since 0.0.1._
223
246
 
224
247
  _Initial release._
225
248
 
249
+ [1.7.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.7.0
226
250
  [1.6.1]: https://github.com/seclai/seclai-javascript/releases/tag/1.6.1
227
251
  [1.6.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.6.0
228
252
  [1.5.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.5.0
package/README.md CHANGED
@@ -104,7 +104,7 @@ or set environment variables:
104
104
 
105
105
  Online API documentation (latest):
106
106
 
107
- https://seclai.github.io/seclai-javascript/1.6.1/
107
+ https://seclai.github.io/seclai-javascript/1.7.0/
108
108
 
109
109
  Release history is in [`CHANGELOG.md`](CHANGELOG.md).
110
110
 
@@ -127,7 +127,7 @@ Leave `apiVersion` unset and the header is omitted, so the account's pinned
127
127
  baseline applies and responses keep their current shapes. Upgrading this package
128
128
  alone never changes the wire contract.
129
129
 
130
- Known versions are on `SeclaiApiVersion` (`V2026_07_01` through `V2026_10_03`,
130
+ Known versions are on `SeclaiApiVersion` (`V2026_07_01` through `V2026_10_21`,
131
131
  plus `Default` and `Latest`), imported from `@seclai/sdk`. A version this release was
132
132
  **not** built against throws at construction: a newer version can reshape
133
133
  responses, and this client would decode them incorrectly rather than reject them.
@@ -173,9 +173,21 @@ default, so the same call can return fewer rows:
173
173
  - `setAutoBlockMode()` reports the account's full `total` by default, and the
174
174
  number of rows it returned after you opt in.
175
175
 
176
- **Later versions.** Each is cumulative. None changes a response shape this
177
- client decodes, but `2026-09-30` changes what a string you may be parsing
178
- contains:
176
+ **Later versions.** Each is cumulative. Some change a value you may be reading,
177
+ a request that used to succeed, or (from `2026-10-21`) which fields can be
178
+ `null`:
179
+
180
+ - `2026-09-30` and `2026-10-16` change what a string you may be parsing
181
+ contains — a run's `output`, and a run's `input` when it has uploads.
182
+ - `2026-10-05` changes a value you may branch on: an item held for review
183
+ reports `content_status` `completed` instead of `failed`, so code that looks
184
+ for governance holds among `failed` items stops finding them. Check
185
+ `held_for_review` instead.
186
+ - `2026-10-13` and `2026-10-19` reject with a 400 source settings that were
187
+ accepted before.
188
+ - `2026-10-21` changes evaluation numbers you may be reading: an `error` result
189
+ no longer counts as `failed` or toward the rates, and `testDraftEvaluation()`
190
+ returns `null` `score` and `passed` for one.
179
191
 
180
192
  | Version | What it changes |
181
193
  | --- | --- |
@@ -184,12 +196,50 @@ contains:
184
196
  | `2026-09-28` | Agent-definition writes use the current file-list grammar: an omitted `attachments` keeps the stored list and `[]` means no files |
185
197
  | `2026-09-30` | **Breaks code that parses `output`.** A run's and a step's `output`, and a step's `input`, are the plain text; below this version an output that has files is a JSON manifest string (`{schema, text, attachments}`). Read files from `attachments`, which is populated on every version |
186
198
  | `2026-10-03` | A new LLM step written without `attachments` takes its parent's files, and a new retrieval step's matched media are its files |
199
+ | `2026-10-05` | An item held for review by an Enforce governance policy reports `content_status` `completed` (with `held_for_review: true`) from `listSourceContents()` and `getSourceContentStatus()`. Below it the item reports `failed` with the hold as the `error` |
200
+ | `2026-10-13` | `createSource()` and `updateSource()` reject a `media_types` value other than `images` or `video`, or any value on a source that is not a website or RSS feed, with a 400. Below it an unknown value is dropped |
201
+ | `2026-10-16` | `uploadAgentInput()` accepts a file of any type and it is `ready` at once. Each step receives the file itself when its model reads that type, and its text otherwise; a run's `input` carries only a `# filename` heading per file. Below it only a fixed list of extensions is accepted and each file's extracted text is written into `input`, so poll `getAgentInputUploadStatus()` before running |
202
+ | `2026-10-18` | A source's `document_images` defaults to `true` on every embedder. Below it it defaults to `false` on a text-only embedder |
203
+ | `2026-10-19` | `createSource()` rejects `polling_max_items` on any source type but an RSS feed with a 400. Below it the value is stored |
204
+ | `2026-10-21` | An evaluation result whose evaluator returned no verdict (`error`) is left out of `failed` and of `pass_rate` / `failure_rate` in `getNonManualEvaluationSummary()`, and `getEvaluationCriteriaSummary()` averages `average_score` over passed and failed results only. `testDraftEvaluation()` returns `score` and `passed` as `null` for an `error` result. Below it the summary counts `error` results in `failed` and the rates, `average_score` includes their stored scores, and the test draft returns `score` 0.5 and `passed: false`. The summary's `error` count is returned on every version |
187
205
 
188
206
  **`Latest` moves with the SDK.** `SeclaiApiVersion.Latest` is the newest version
189
207
  the installed release knows, so upgrading the package can opt a client that
190
208
  passes it into every version added since — `1.6.0` moved it from `2026-07-27` to
191
- `2026-10-03`, across the `2026-09-30` output change. Pass a dated constant such
192
- as `SeclaiApiVersion.V2026_07_27` to keep behaviour fixed across upgrades.
209
+ `2026-10-03`, across the `2026-09-30` output change, and `1.7.0` moves it to
210
+ `2026-10-21`, across the `2026-10-05` status change, the `2026-10-13` and
211
+ `2026-10-19` source-setting rejections, the `2026-10-16` input change and the
212
+ `2026-10-21` evaluation change. Pass a
213
+ dated constant such as `SeclaiApiVersion.V2026_07_27` to keep behaviour fixed
214
+ across upgrades.
215
+
216
+ ## Upgrading to 1.7
217
+
218
+ Two type changes can stop existing code compiling. If you pass
219
+ `SeclaiApiVersion.Latest`, it now sends `2026-10-21`; the table above lists
220
+ what each version changes.
221
+
222
+ **`testDraftEvaluation()` can return `null` scores.** When the evaluator
223
+ returns no verdict, `status` is `error`. From API version `2026-10-21`, `score`
224
+ and `passed` are then `null`. An account created after `2026-10-21` ships gets
225
+ that version even without setting `apiVersion`. Check `status` before reading
226
+ them, in JavaScript too; under `strictNullChecks` the type enforces it:
227
+
228
+ <!-- sdksync:check -->
229
+ ```ts
230
+ const result = await client.testDraftEvaluation("agent_id", { step_output: "...", pass_threshold: 0.7 });
231
+
232
+ // 1.6 and earlier: console.log(result.score.toFixed(2), result.passed);
233
+ if (result.status === "error") {
234
+ console.log("No verdict:", result.explanation);
235
+ } else {
236
+ console.log(result.score.toFixed(2), result.passed); // number and boolean here
237
+ }
238
+ ```
239
+
240
+ **`InsufficientCreditsResponse` matches the 402 body.** Read the code at
241
+ `error.code`, not `detail.error`. Code that cast a 402 body to this type threw
242
+ on every real 402 before, so this only fixes it.
193
243
 
194
244
  ## Resources
195
245
 
@@ -294,6 +344,21 @@ for await (const event of client.runStreamingAgent(
294
344
  }
295
345
  ```
296
346
 
347
+ Pass `include_reasoning: true` to also receive `stream_reasoning` events carrying
348
+ the model's reasoning while it thinks. They are sent only for a
349
+ `streaming_result` step whose author enabled `show_reasoning`, and reasoning is
350
+ never part of `output`:
351
+
352
+ <!-- sdksync:check -->
353
+ ```ts
354
+ for await (const event of client.runStreamingAgent("agent_id", {
355
+ input: "Hello",
356
+ include_reasoning: true,
357
+ })) {
358
+ if (event.event === "stream_reasoning") console.log(event.data);
359
+ }
360
+ ```
361
+
297
362
  ### Polling
298
363
 
299
364
  For environments where SSE is not practical, poll for a completed run:
@@ -308,6 +373,7 @@ const result = await client.runAgentAndPoll(
308
373
 
309
374
  ### Agent input uploads
310
375
 
376
+ <!-- sdksync:check -->
311
377
  ```ts
312
378
  // Discover which files (if any) the agent expects before staging uploads
313
379
  const refs = await client.getAgentAttachmentReferences("agent_id");
@@ -316,14 +382,26 @@ if (refs.requires_uploads) {
316
382
  }
317
383
 
318
384
  const upload = await client.uploadAgentInput("agent_id", {
319
- file: new Uint8Array([...]),
385
+ file: new Uint8Array([/* file bytes */]),
320
386
  fileName: "input.pdf",
321
387
  });
322
- const status = await client.getAgentInputUploadStatus("agent_id", upload.upload_id);
388
+ // From API version 2026-10-16 the upload is `ready` at once. Below it, poll
389
+ // until `status` is `ready` before running.
390
+ let status = await client.getAgentInputUploadStatus("agent_id", upload.id);
391
+ while (status.status !== "ready") {
392
+ if (status.status === "failed") throw new Error(`Upload failed: ${status.error}`);
393
+ await new Promise((resolve) => setTimeout(resolve, 1_000));
394
+ status = await client.getAgentInputUploadStatus("agent_id", upload.id);
395
+ }
396
+ const run = await client.runAgent("agent_id", { input_upload_id: upload.id, priority: false });
323
397
  ```
324
398
 
399
+ Only a `dynamic_input` agent takes uploads; any other agent rejects one with a
400
+ 400.
401
+
325
402
  ### Agent run attachments
326
403
 
404
+ <!-- sdksync:check -->
327
405
  ```ts
328
406
  // Download a file emitted by a step in an agent run. The attachment_id is the
329
407
  // URL-safe-base64 storage_key surfaced in run output manifests / webhooks.
@@ -347,6 +425,31 @@ const config = await client.setEmailTriggerConfig("agent_id", "trigger_id", {
347
425
  console.log(config.email_addresses); // ["support.<accountID>@agent.seclai.com", ...]
348
426
  ```
349
427
 
428
+ Set `run_on_attachment_mismatch: true` to run an email whose attachments do not
429
+ fit what the agent accepts: files it cannot take are left out and the problems
430
+ are listed in the run's `email_attachment_issues` metadata. By default the run fails.
431
+
432
+ ### Accepted attachments
433
+
434
+ Declare the input attachments a trigger accepts. A run's files are each assigned
435
+ to one named slot before any step runs, and steps reference a slot as
436
+ `{{agent.attachments.<name>}}`. The call replaces the whole declaration, and is
437
+ refused with a 400 when the agent references a slot it leaves out. `min` defaults
438
+ to 0. The same slots can be set as `accepted_attachments` on `createAgent()` and
439
+ `updateAgentDefinition()`.
440
+
441
+ <!-- sdksync:check -->
442
+ ```ts
443
+ const agent = await client.getAgent("agent_id");
444
+ const { accepted_attachments } = await client.setAcceptedAttachments("agent_id", agent.trigger_id!, {
445
+ accepted_attachments: [
446
+ { name: "invoice", content_types: ["application/pdf"], min: 1, max: 1 },
447
+ { name: "photos", content_types: ["image/*"], label: "Photos of the damage" },
448
+ ],
449
+ });
450
+ console.log(accepted_attachments.map((slot) => `${slot.name}: ${slot.min}..${slot.max ?? "any"}`));
451
+ ```
452
+
350
453
  ### Agent email governance
351
454
 
352
455
  ```ts
@@ -394,8 +497,10 @@ const detail = await client.getEvaluationCriteria("criteria_id");
394
497
  await client.updateEvaluationCriteria("criteria_id", { ... });
395
498
  await client.deleteEvaluationCriteria("criteria_id");
396
499
 
397
- // Test a draft
398
- await client.testDraftEvaluation("agent_id", { criteria: { ... }, run_id: "..." });
500
+ // Test a draft. Check status first: an "error" result has no verdict, and its
501
+ // score and passed can be null.
502
+ const draft = await client.testDraftEvaluation("agent_id", { step_output: "...", pass_threshold: 0.7 });
503
+ if (draft.status !== "error") console.log(draft.score, draft.passed);
399
504
 
400
505
  // Results by criteria
401
506
  const results = await client.listEvaluationResults("criteria_id");
@@ -474,9 +579,40 @@ const batch = await client.listSourceContents("source_id", {
474
579
  console.log(batch.pagination.total, failed.data.map((item) => item.error));
475
580
 
476
581
  const one = await client.getSourceContentStatus("source_id", "cv_1");
477
- console.log(one.content_status);
582
+ console.log(one.content_status, one.held_for_review);
478
583
  ```
479
584
 
585
+ An item an Enforce governance policy blocked at import is held for review:
586
+ `held_for_review` is `true` until a reviewer releases it. Its `content_status` is
587
+ `completed` from API version `2026-10-05`, and `failed` with the hold as the
588
+ `error` below it.
589
+
590
+ An email source stores mail from `email_allowed_senders` only, and lists what it
591
+ refused. Each entry names the sender and the reason, never the subject or body;
592
+ adding a refused sender to `email_allowed_senders` helps only when `authenticated`
593
+ is `true`. Listing rejections requires an account owner or administrator.
594
+
595
+ <!-- sdksync:check -->
596
+ ```ts
597
+ const inbox = await client.createSource({
598
+ name: "Newsletters",
599
+ source_type: "email",
600
+ email_allowed_senders: ["news@example.com", "example.org"],
601
+ });
602
+ console.log(inbox.email_address); // send mail here
603
+
604
+ const rejections = await client.listEmailSourceRejections(inbox.id, { page: 1, limit: 50 });
605
+ for (const r of rejections.data) console.log(r.from_address, r.reason, r.authenticated);
606
+
607
+ // Index the images inside documents, and an RSS feed's enclosures
608
+ await client.updateSource("source_id", { document_images: true, feed_attachments: ["enclosures"] });
609
+ ```
610
+
611
+ A `cloud_drive` source takes `cloud_drive_connection_id` (from `listCloudDrives()`)
612
+ on create, and `cloud_drive_folder_path`, `cloud_drive_path_pattern`,
613
+ `cloud_drive_content_types` and `cloud_drive_max_file_mb` to choose which files
614
+ it indexes.
615
+
480
616
  ### Cloud drives
481
617
 
482
618
  <!-- sdksync:check -->
@@ -567,6 +703,28 @@ await client.uploadFileToContent("content_id", {
567
703
  });
568
704
  ```
569
705
 
706
+ A content item's attachments are the files an agent step, an email, a feed, a
707
+ web page's media or a document's images added to it. Each says whether it is
708
+ indexed for search and, if indexing failed, why. An email item's
709
+ `skipped_attachments` (on `getContentDetail()`) lists the parts that were not
710
+ stored, with the reason.
711
+
712
+ <!-- sdksync:check -->
713
+ ```ts
714
+ const attachments = await client.listContentAttachments("content_id", { limit: 50 });
715
+ for (const att of attachments.data) {
716
+ console.log(att.id, att.content_type, att.indexed, att.indexing_error);
717
+ }
718
+
719
+ const att = await client.getContentAttachment("content_id", "attachment_id", { start: 0, end: 2000 });
720
+ console.log(att.text_content, att.file_withheld);
721
+ const vectors = await client.listContentAttachmentEmbeddings("content_id", "attachment_id");
722
+
723
+ // Raw Response; 403 while the file is withheld (see `file_withheld`).
724
+ const file = await client.downloadContentAttachment("content_id", "attachment_id");
725
+ const bytes = new Uint8Array(await file.arrayBuffer());
726
+ ```
727
+
570
728
  ### Solutions
571
729
 
572
730
  ```ts
package/dist/index.cjs CHANGED
@@ -58,10 +58,16 @@ var SeclaiApiVersion = {
58
58
  V2026_09_28: "2026-09-28",
59
59
  V2026_09_30: "2026-09-30",
60
60
  V2026_10_03: "2026-10-03",
61
+ V2026_10_05: "2026-10-05",
62
+ V2026_10_13: "2026-10-13",
63
+ V2026_10_16: "2026-10-16",
64
+ V2026_10_18: "2026-10-18",
65
+ V2026_10_19: "2026-10-19",
66
+ V2026_10_21: "2026-10-21",
61
67
  /** Baseline applied to an unpinned, header-less caller. */
62
68
  Default: "2026-07-01",
63
69
  /** Newest version known to this SDK release. May lag the server. */
64
- Latest: "2026-10-03"
70
+ Latest: "2026-10-21"
65
71
  };
66
72
  var KNOWN_API_VERSIONS = Object.entries(SeclaiApiVersion).filter(([k]) => k.startsWith("V")).map(([, v]) => v);
67
73
 
@@ -1109,15 +1115,18 @@ var Seclai = class {
1109
1115
  * Run an agent in streaming mode (SSE) and wait for the final result.
1110
1116
  *
1111
1117
  * Consumes the entire SSE stream and returns only the terminal `done` payload.
1112
- * For real-time event access, use {@link runStreamingAgent} instead.
1118
+ * For real-time event access, use {@link runStreamingAgent} instead. The body
1119
+ * takes no `include_reasoning`, and one passed anyway is not sent: this method
1120
+ * returns no `stream_reasoning` events.
1113
1121
  *
1114
1122
  * @param agentId - Agent identifier.
1115
- * @param body - Streaming run request payload.
1123
+ * @param body - Streaming run request payload, without `include_reasoning`.
1116
1124
  * @param opts - Timeout and abort signal options.
1117
1125
  * @returns Final agent run payload from the `done` event.
1118
1126
  * @throws {@link SeclaiStreamingError} If the stream ends before a `done` event.
1119
1127
  */
1120
1128
  async runStreamingAgentAndWait(agentId, body, opts) {
1129
+ const { include_reasoning: _ignored, ...runBody } = body;
1121
1130
  const url = buildURL(this.baseUrl, `/agents/${agentId}/runs/stream`);
1122
1131
  const authHdrs = await this.authHeaders();
1123
1132
  const headers = this.requestHeaders([
@@ -1135,7 +1144,7 @@ var Seclai = class {
1135
1144
  const signal = anySignal([opts?.signal, timeoutController.signal]);
1136
1145
  let lastSeen;
1137
1146
  try {
1138
- const init = { method: "POST", headers, body: JSON.stringify(body) };
1147
+ const init = { method: "POST", headers, body: JSON.stringify(runBody) };
1139
1148
  if (signal) init.signal = signal;
1140
1149
  const response = await this.fetcher(url, init);
1141
1150
  const contentType = response.headers.get("content-type") ?? "";
@@ -1376,10 +1385,14 @@ var Seclai = class {
1376
1385
  // Agent Input Uploads
1377
1386
  // ═══════════════════════════════════════════════════════════════════════════
1378
1387
  /**
1379
- * Upload a file to use as input for a `dynamic_input` agent run.
1388
+ * Upload a file to use as input for a `dynamic_input` agent run. Any other
1389
+ * agent rejects the upload with HTTP 400. Files are limited to 200 MB.
1380
1390
  *
1381
- * After uploading, poll {@link getAgentInputUploadStatus} until `status` is `ready`,
1382
- * then pass `input_upload_id` to {@link runAgent}.
1391
+ * From API version `2026-10-16` a file of any type is accepted and is `ready`
1392
+ * at once: pass its `id` as `input_upload_id` to {@link runAgent}.
1393
+ * Earlier versions accept only a fixed list of extensions and write each
1394
+ * file's extracted text into the run's `input`, so poll
1395
+ * {@link getAgentInputUploadStatus} until `status` is `ready` before running.
1383
1396
  *
1384
1397
  * @param agentId - Agent identifier.
1385
1398
  * @param opts - File payload and optional metadata.
@@ -1421,12 +1434,16 @@ var Seclai = class {
1421
1434
  * @param runId - Run identifier.
1422
1435
  * @param attachmentId - URL-safe-base64-encoded `storage_key` of the attachment
1423
1436
  * (as surfaced in run output manifests and webhook/email payloads).
1424
- * @param opts - Optional `downloadName` filename hint for the download disposition.
1437
+ * @param opts - Optional `downloadName` filename hint for the download
1438
+ * disposition, and `signal`, which cancels the request; with a standard `fetch` this
1439
+ * includes reading the body, so `AbortSignal.timeout(ms)` bounds the whole
1440
+ * transfer.
1425
1441
  * @returns Raw response with the attachment bytes.
1426
1442
  */
1427
1443
  async downloadAgentRunAttachment(runId, attachmentId, opts = {}) {
1428
1444
  return await this.requestRaw("GET", `/v2/agent-runs/${runId}/attachments/${attachmentId}`, {
1429
- query: { download_name: opts.downloadName }
1445
+ query: { download_name: opts.downloadName },
1446
+ signal: opts.signal
1430
1447
  });
1431
1448
  }
1432
1449
  // ═══════════════════════════════════════════════════════════════════════════
@@ -1671,6 +1688,24 @@ var Seclai = class {
1671
1688
  json: body
1672
1689
  });
1673
1690
  }
1691
+ /**
1692
+ * Replace the input attachments a trigger accepts.
1693
+ *
1694
+ * A run's files are each assigned to one declared attachment before any step
1695
+ * runs, and steps reference one as `{{agent.attachments.<name>}}`. The API
1696
+ * answers 400 when the agent references an attachment the new declaration
1697
+ * leaves out.
1698
+ *
1699
+ * @param agentId - Agent identifier.
1700
+ * @param triggerId - Trigger identifier, as `getAgent()` returns it.
1701
+ * @param body - The full list of accepted attachments; a slot's `min` defaults to 0.
1702
+ * @returns The trigger's accepted attachments.
1703
+ */
1704
+ async setAcceptedAttachments(agentId, triggerId, body) {
1705
+ return await this.request("PUT", `/agents/${agentId}/triggers/${triggerId}/accepted-attachments`, {
1706
+ json: body
1707
+ });
1708
+ }
1674
1709
  // ═══════════════════════════════════════════════════════════════════════════
1675
1710
  // Agent Email Governance
1676
1711
  // ═══════════════════════════════════════════════════════════════════════════
@@ -2120,6 +2155,24 @@ var Seclai = class {
2120
2155
  `/sources/${sourceId}/contents/${contentVersionId}`
2121
2156
  );
2122
2157
  }
2158
+ /**
2159
+ * List mail an email content source refused, newest first.
2160
+ *
2161
+ * Each entry says who sent the message and why it was refused, never its
2162
+ * subject or body. To accept a refused sender, add its `from_address` or that
2163
+ * address's domain to the source's `email_allowed_senders` — which only helps
2164
+ * when `authenticated` is true. Requires an account owner or administrator;
2165
+ * the API answers 404 for a source that is not an email source.
2166
+ *
2167
+ * @param sourceId - Source connection identifier.
2168
+ * @param opts - Pagination options (`limit` 1-100).
2169
+ * @returns The rejections under `data` with `pagination`.
2170
+ */
2171
+ async listEmailSourceRejections(sourceId, opts = {}) {
2172
+ return await this.request("GET", `/sources/${sourceId}/email-rejections`, {
2173
+ query: { page: opts.page, limit: opts.limit }
2174
+ });
2175
+ }
2123
2176
  // ─── Source Exports ────────────────────────────────────────────────────────
2124
2177
  /**
2125
2178
  * List exports for a source.
@@ -2169,10 +2222,15 @@ var Seclai = class {
2169
2222
  *
2170
2223
  * @param sourceId - Source connection identifier.
2171
2224
  * @param exportId - Export identifier.
2225
+ * @param opts - Optional `signal`, which cancels the request; with a standard `fetch` this
2226
+ * includes reading the body, so `AbortSignal.timeout(ms)` bounds the whole
2227
+ * transfer.
2172
2228
  * @returns Raw response with the export file.
2173
2229
  */
2174
- async downloadSourceExport(sourceId, exportId) {
2175
- return await this.requestRaw("GET", `/sources/${sourceId}/exports/${exportId}/download`);
2230
+ async downloadSourceExport(sourceId, exportId, opts = {}) {
2231
+ return await this.requestRaw("GET", `/sources/${sourceId}/exports/${exportId}/download`, {
2232
+ signal: opts.signal
2233
+ });
2176
2234
  }
2177
2235
  /**
2178
2236
  * Estimate a source export.
@@ -2266,6 +2324,79 @@ var Seclai = class {
2266
2324
  query: { page: opts.page ?? 1, limit: opts.limit ?? 20 }
2267
2325
  });
2268
2326
  }
2327
+ /**
2328
+ * List the files attached to a content item.
2329
+ *
2330
+ * Files arrive from an agent's `write_content_attachment` step, with an email
2331
+ * message, from an RSS feed's `feed_attachments`, from a web page's media, or
2332
+ * as the images inside a document. Each entry says whether it is indexed for
2333
+ * search and, when indexing failed, why.
2334
+ *
2335
+ * @param contentVersionId - Content version identifier.
2336
+ * @param opts - Pagination options.
2337
+ * @returns The attachments under `data` with `pagination`.
2338
+ */
2339
+ async listContentAttachments(contentVersionId, opts = {}) {
2340
+ return await this.request("GET", `/contents/${contentVersionId}/attachments`, {
2341
+ query: { page: opts.page, limit: opts.limit }
2342
+ });
2343
+ }
2344
+ /**
2345
+ * Get one file attached to a content item: its indexing status and reason,
2346
+ * its metadata, and the text it is indexed by.
2347
+ *
2348
+ * @param contentVersionId - Content version identifier.
2349
+ * @param attachmentId - The `id` of an entry from {@link listContentAttachments}.
2350
+ * @param opts - `start` and `end` character offsets for paging through long text
2351
+ * (server defaults 0 and 5000). Both are sent as given, so `end: 0` asks for
2352
+ * the metadata without any text. A file that was not indexed has no text.
2353
+ * @returns The attachment with the requested range of its text.
2354
+ * @throws {SeclaiAPIStatusError} 402 when the account has no credits left
2355
+ * (`error.code` `insufficient_credits`).
2356
+ */
2357
+ async getContentAttachment(contentVersionId, attachmentId, opts = {}) {
2358
+ return await this.request("GET", `/contents/${contentVersionId}/attachments/${attachmentId}`, {
2359
+ query: { start: opts.start, end: opts.end }
2360
+ });
2361
+ }
2362
+ /**
2363
+ * List the embeddings (chunk vectors) a content attachment is indexed by.
2364
+ * The list is empty for a file that has no completed index.
2365
+ *
2366
+ * @param contentVersionId - Content version identifier.
2367
+ * @param attachmentId - Attachment identifier.
2368
+ * @param opts - Pagination options (`limit` 1-100).
2369
+ * @returns Paginated list of embeddings.
2370
+ * @throws {SeclaiAPIStatusError} 402 when the account has no credits left
2371
+ * (`error.code` `insufficient_credits`).
2372
+ */
2373
+ async listContentAttachmentEmbeddings(contentVersionId, attachmentId, opts = {}) {
2374
+ return await this.request("GET", `/contents/${contentVersionId}/attachments/${attachmentId}/embeddings`, {
2375
+ query: { page: opts.page, limit: opts.limit }
2376
+ });
2377
+ }
2378
+ /**
2379
+ * Download a content attachment's bytes.
2380
+ *
2381
+ * Returns the raw `Response` so you can stream or save the binary data. The
2382
+ * API answers 403 when the file is withheld — blocked or redacted by a
2383
+ * governance policy, or still being indexed after arriving from outside; the
2384
+ * attachment's `file_withheld` field says which before you ask.
2385
+ *
2386
+ * @param contentVersionId - Content version identifier.
2387
+ * @param attachmentId - Attachment identifier.
2388
+ * @param opts - Optional `signal`, which cancels the request; with a standard `fetch` this
2389
+ * includes reading the body, so `AbortSignal.timeout(ms)` bounds the whole
2390
+ * transfer.
2391
+ * @returns Raw response with the attachment bytes.
2392
+ * @throws {SeclaiAPIStatusError} 403 when the file is withheld, and 402 when
2393
+ * the account has no credits left (`error.code` `insufficient_credits`).
2394
+ */
2395
+ async downloadContentAttachment(contentVersionId, attachmentId, opts = {}) {
2396
+ return await this.requestRaw("GET", `/contents/${contentVersionId}/attachments/${attachmentId}/file`, {
2397
+ signal: opts.signal
2398
+ });
2399
+ }
2269
2400
  /**
2270
2401
  * Upload a file to replace content for an existing content version.
2271
2402
  *