@seclai/sdk 1.9.0 → 1.10.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.d.cts CHANGED
@@ -25,10 +25,14 @@ declare const SeclaiApiVersion: {
25
25
  readonly V2026_10_28: "2026-10-28";
26
26
  readonly V2026_11_02: "2026-11-02";
27
27
  readonly V2026_11_04: "2026-11-04";
28
+ readonly V2026_11_08: "2026-11-08";
29
+ readonly V2026_11_09: "2026-11-09";
30
+ readonly V2026_11_14: "2026-11-14";
31
+ readonly V2026_11_19: "2026-11-19";
28
32
  /** Baseline applied to an unpinned, header-less caller. */
29
33
  readonly Default: "2026-07-01";
30
34
  /** Newest version known to this SDK release. May lag the server. */
31
- readonly Latest: "2026-11-04";
35
+ readonly Latest: "2026-11-19";
32
36
  };
33
37
  /**
34
38
  * A dated API version. Known values autocomplete; any `YYYY-MM-DD` string still
@@ -192,7 +196,7 @@ interface components {
192
196
  change_id: string;
193
197
  /**
194
198
  * Definition
195
- * @description The agent definition containing name, description, tags, and step workflow tree. Step types include prompt_call, retrieval, regex_replace, evaluate_step, extract_data, extract_content, add_chat_turn, load_chat_history, add_memory, search_memory, load_memory, streaming_result, send_email, webhook_call, call_agent, write_metadata, write_content_attachment, load_content_attachment, load_content, display_result, merge, for_each, if_else, switch, and others.
199
+ * @description The agent definition containing name, description, tags, and step workflow tree. Step types include prompt_call, retrieval, regex_replace, evaluate_step, extract_data, extract_content, add_chat_turn, load_chat_history, add_memory, search_memory, load_memory, send_email, webhook_call, call_agent, write_metadata, write_content_attachment, load_content_attachment, load_content, text, for_each, if_else, switch, parallel, and others.
196
200
  */
197
201
  definition: {
198
202
  [key: string]: unknown;
@@ -204,7 +208,7 @@ interface components {
204
208
  schema_version: string;
205
209
  /**
206
210
  * Warnings
207
- * @description Validation warnings, if any.
211
+ * @description Validation warnings, if any. Each has `step_path`, `message` and `severity` (`info` or `warning`).
208
212
  */
209
213
  warnings?: {
210
214
  [key: string]: string;
@@ -267,7 +271,7 @@ interface components {
267
271
  AgentExportResponse: {
268
272
  /**
269
273
  * Agent
270
- * @description Agent metadata and full definition. Keys: name, description, schema_version, definition, default_evaluation_tier, evaluation_mode, sampling_config, max_retries, retry_on_failure, prompt_model_auto_upgrade_strategy, prompt_model_auto_rollback_enabled, prompt_model_auto_rollback_triggers, max_credits_per_run, max_credits_per_period, max_runs_per_hour, max_runs_per_day, max_runs_total, created_at, updated_at.
274
+ * @description Agent metadata and full definition. Keys: name, description, schema_version, definition, default_evaluation_tier, evaluation_mode, sampling_config, max_retries, retry_on_failure, prompt_model_auto_upgrade_strategy, prompt_model_auto_rollback_enabled, prompt_model_auto_rollback_triggers, max_credits_per_run, max_credits_per_period, max_runs_per_hour, max_runs_per_day, max_runs_total, gallery_example (a copy of a gallery example's setup guidance, or null), created_at, updated_at.
271
275
  */
272
276
  agent: {
273
277
  [key: string]: unknown;
@@ -295,7 +299,7 @@ interface components {
295
299
  }[] | null;
296
300
  /**
297
301
  * Export Version
298
- * @description Schema version of the export format (currently "6").
302
+ * @description Schema version of the export format (currently "7").
299
303
  */
300
304
  export_version: string;
301
305
  /**
@@ -494,7 +498,7 @@ interface components {
494
498
  priority: boolean;
495
499
  /**
496
500
  * Result Reported At
497
- * @description When the run reported success: for an agent whose `report_success` is `on_result`, once its result step published, or once its run started if it has no result step; else when the run completed. From then on `output` is the run's answer and never changes; stop polling here if you only need the answer. `status` still follows every step, so a run can report success and later fail. Null until the run reports, for a run that failed before reporting, and for runs that ended before this field existed.
501
+ * @description When the run reported success: for an agent whose `report_success` is `on_result`, once the step carrying `run_result` published, or once its run started if no step carries it; else when the run completed. From then on `output` is the run's answer and never changes; stop polling here if you only need the answer. `status` still follows every step, so a run can report success and later fail. Null until the run reports, for a run that failed before reporting, and for runs that ended before this field existed.
498
502
  */
499
503
  result_reported_at?: string | null;
500
504
  /**
@@ -597,9 +601,15 @@ interface components {
597
601
  };
598
602
  /** AgentRunStreamRequest */
599
603
  AgentRunStreamRequest: {
604
+ /**
605
+ * Include Commentary
606
+ * @description Receive `stream_commentary` events carrying the text a model on OpenAI's Responses API writes outside its final answer, with its `phase` and `message` number. They are sent only for a `prompt_call` whose `run_result` enables `show_commentary`, and never when a governance policy redacts that step.
607
+ * @default false
608
+ */
609
+ include_commentary: boolean;
600
610
  /**
601
611
  * Include Reasoning
602
- * @description Receive `stream_reasoning` events carrying the model's reasoning while it thinks. They are sent only for a `streaming_result` step whose author enabled `show_reasoning`, and never when a governance policy redacts that step.
612
+ * @description Receive `stream_reasoning` events carrying the model's reasoning while it thinks. They are sent only for a `prompt_call` whose `run_result` enables `show_reasoning`, and never when a governance policy redacts that step.
603
613
  * @default false
604
614
  */
605
615
  include_reasoning: boolean;
@@ -1725,7 +1735,7 @@ interface components {
1725
1735
  alert_type: string;
1726
1736
  /**
1727
1737
  * Cooldown Minutes
1728
- * @description Cooldown period in minutes. Omit to use the per-alert-type default (1440 for credit alerts, 60 otherwise).
1738
+ * @description Cooldown period in minutes. Omit to use the alert type's default.
1729
1739
  */
1730
1740
  cooldown_minutes?: number | null;
1731
1741
  /**
@@ -1762,7 +1772,7 @@ interface components {
1762
1772
  * CreateEvaluationCriteriaRequest
1763
1773
  * @description Request body for creating an evaluation criteria.
1764
1774
  *
1765
- * step_id names the display_result or streaming_result step to score. The
1775
+ * step_id names the step carrying run_result, the run's answer, to score. The
1766
1776
  * evaluation mode and sample frequency are set at the
1767
1777
  * agent level, not per-criteria.
1768
1778
  */
@@ -3117,6 +3127,11 @@ interface components {
3117
3127
  };
3118
3128
  /** GenerationTierResponse */
3119
3129
  GenerationTierResponse: {
3130
+ /**
3131
+ * Aspect Ratios
3132
+ * @description The aspect ratios the tier's model can be asked for, and so the values a media_generation image generator's aspect_ratio pin may take. Empty for audio and video tiers and for an image model that takes no ratio.
3133
+ */
3134
+ aspect_ratios?: string[];
3120
3135
  /** Credits Per Unit */
3121
3136
  credits_per_unit: number | null;
3122
3137
  /** Modality */
@@ -3903,7 +3918,7 @@ interface components {
3903
3918
  * PendingProcessingCompletedFailedStatus
3904
3919
  * @enum {string}
3905
3920
  */
3906
- PendingProcessingCompletedFailedStatus: "pending" | "processing" | "completed" | "failed" | "queued" | "waiting_human" | "waiting_scheduled";
3921
+ PendingProcessingCompletedFailedStatus: "pending" | "processing" | "completed" | "failed" | "queued" | "waiting_human" | "waiting_scheduled" | "cancelled";
3907
3922
  /**
3908
3923
  * PlaygroundCreateRequest
3909
3924
  * @description Create a model playground experiment via the public API.
@@ -5542,7 +5557,7 @@ interface components {
5542
5557
  } | null;
5543
5558
  /**
5544
5559
  * Agent Template
5545
- * @description Agent gallery entry to start from: a `key` from GET /agents/examples, or `blank`. The keys retrieval_example and simple_qa remain accepted for their gallery entries.
5560
+ * @description Agent gallery entry to start from: a `key` from GET /agents/examples, or `blank`. The keys retrieval_example and simple_qa remain accepted for their gallery entries. An entry's safety policies, which its summary may describe, are not created on an agent created here.
5546
5561
  */
5547
5562
  agent_template?: string | null;
5548
5563
  /**
@@ -6901,12 +6916,12 @@ interface components {
6901
6916
  family_generation?: number | null;
6902
6917
  /**
6903
6918
  * Generation Credits Per Unit
6904
- * @description Per-unit credit cost for a dedicated media-generation model, in the unit named by ``generation_params.pricing_unit`` (per image / per second / per character / per output token). Multiply by the produced unit count (images, seconds, characters) for the run cost. None for models with no generation descriptor. This rate applies when the model is used in a generate_image/audio/video step; a model that also serves the chat path is billed per token there instead, using the input/output token rates on this same record. When `generation_params.price_varies_by` is set the model has one rate per value of that option and this is the **highest** of them — read `generation_credits_per_variant` for the real spread rather than presenting this as the price.
6919
+ * @description Per-unit credit cost for a dedicated media-generation model, in the unit named by ``generation_params.pricing_unit`` (per image / per second / per character / per output token). Multiply by the produced unit count (images, seconds, characters) for the run cost. None for models with no generation descriptor. This rate applies when the model is used in a generate_image/audio/video step; a model that also serves the chat path is billed per token there instead, using the input/output token rates on this same record. When `generation_params.price_varies_by` is set the model has one rate per value (or combination) and this is the **highest** of them — read `generation_credits_per_variant` for the real spread rather than presenting this as the price.
6905
6920
  */
6906
6921
  generation_credits_per_unit?: number | null;
6907
6922
  /**
6908
6923
  * Generation Credits Per Variant
6909
- * @description Per-unit credit cost keyed by the value of the option named in `generation_params.price_varies_by` (e.g. `{'720p': 1330, '1080p': 1995}`). None for a model with a single rate, where `generation_credits_per_unit` already describes it exactly.
6924
+ * @description Per-unit credit cost keyed by the value of the option named in `generation_params.price_varies_by` (e.g. `{'720p': 1330, '1080p': 1995}`); when it names several options (a list), the key joins their values with ':' in that order (`'1080p:audio'`). None for a model with a single rate, where `generation_credits_per_unit` already describes it exactly.
6910
6925
  */
6911
6926
  generation_credits_per_variant?: {
6912
6927
  [key: string]: number;
@@ -7391,8 +7406,11 @@ type CancelQueuedRunsResponse = components["schemas"]["CancelQueuedRunsResponse"
7391
7406
  type ResumeInboundResponse = components["schemas"]["ResumeInboundResponse"];
7392
7407
  /** Request body for starting an agent run. */
7393
7408
  type AgentRunRequest = WithServerDefaults<components["schemas"]["AgentRunRequest"], "priority">;
7394
- /** Request body for starting an agent run in streaming mode (SSE). `include_reasoning` defaults to `false`. */
7395
- type AgentRunStreamRequest = WithServerDefaults<components["schemas"]["AgentRunStreamRequest"], "include_reasoning">;
7409
+ /**
7410
+ * Request body for starting an agent run in streaming mode (SSE).
7411
+ * `include_reasoning` and `include_commentary` default to `false`.
7412
+ */
7413
+ type AgentRunStreamRequest = WithServerDefaults<components["schemas"]["AgentRunStreamRequest"], "include_reasoning" | "include_commentary">;
7396
7414
  /** Response body describing an agent run. */
7397
7415
  type AgentRunResponse = components["schemas"]["AgentRunResponse"];
7398
7416
  /** Paginated list of agent runs. */
@@ -7853,7 +7871,12 @@ type InsufficientCreditsResponse = components["schemas"]["InsufficientCreditsRes
7853
7871
  type InsufficientCreditsDetail = components["schemas"]["InsufficientCreditsDetail"];
7854
7872
  /** Source index mode: fast_and_cheap, balanced, slow_and_thorough, or custom. */
7855
7873
  type SourceIndexMode = components["schemas"]["SourceIndexMode"];
7856
- /** Processing status: pending, processing, completed, or failed. */
7874
+ /**
7875
+ * Status of an agent run, run attempt or run step: pending, queued,
7876
+ * processing, waiting_human, waiting_scheduled, completed, failed or
7877
+ * cancelled. An agent run cancelled under `apiVersion` `2026-11-08` or later
7878
+ * ends `cancelled`; on earlier versions it ends `failed`.
7879
+ */
7857
7880
  type PendingProcessingCompletedFailedStatus = components["schemas"]["PendingProcessingCompletedFailedStatus"];
7858
7881
  /** An SSE event emitted during a streaming agent run. */
7859
7882
  interface AgentRunEvent {
@@ -7878,7 +7901,13 @@ interface SortableListOptions extends ListOptions {
7878
7901
  }
7879
7902
  /** Filters for {@link Seclai.listAgentExamples}. */
7880
7903
  interface ListAgentExamplesOptions extends ListOptions {
7881
- /** Words every matching example must contain. */
7904
+ /**
7905
+ * What the agent should do. From `apiVersion` `2026-11-09`, entries are
7906
+ * ranked by how well they match it, in words and meaning, best first, and a
7907
+ * query of several words that are all filler ("create an agent") counts as
7908
+ * no query. Before
7909
+ * it, only entries containing every word match.
7910
+ */
7882
7911
  query?: string;
7883
7912
  /** Only examples for this use case. */
7884
7913
  useCase?: string;
@@ -8219,6 +8248,10 @@ declare class Seclai {
8219
8248
  /**
8220
8249
  * List the agent gallery: example agents to start from.
8221
8250
  *
8251
+ * From `apiVersion` `2026-11-09`, `query` describes what the agent should do
8252
+ * and entries come back ranked by how well they match it, best first. Before
8253
+ * it, only entries containing every word of `query` are returned.
8254
+ *
8222
8255
  * Pass an entry's `key` as `agent_template` to {@link createAgent}, with
8223
8256
  * `resource_bindings` for the resources it needs.
8224
8257
  *
@@ -8332,6 +8365,11 @@ declare class Seclai {
8332
8365
  /**
8333
8366
  * Start an agent run.
8334
8367
  *
8368
+ * From `apiVersion` `2026-11-14`, an agent whose definition fails to validate
8369
+ * is refused with HTTP 409 ({@link SeclaiAPIStatusError}) and no run is
8370
+ * created; earlier versions return the run, already failed with the
8371
+ * validation error as its cause.
8372
+ *
8335
8373
  * @param agentId - Agent identifier.
8336
8374
  * @param body - Run request payload (`input`, `metadata`, `priority`, etc.).
8337
8375
  * @returns The created agent run.
@@ -8375,14 +8413,17 @@ declare class Seclai {
8375
8413
  */
8376
8414
  deleteAgentRun(runId: string): Promise<void>;
8377
8415
  /**
8378
- * Cancel a running agent run.
8416
+ * Cancel an agent run that has not ended: `queued`, `pending`, `processing`,
8417
+ * `waiting_human` or `waiting_scheduled`.
8379
8418
  *
8380
8419
  * Cancellation is `DELETE` on the run resource — the API exposes no
8381
8420
  * `POST .../cancel` route, and no operation that deletes a run. Rejected when
8382
- * the run has already reached a terminal state.
8421
+ * the run has already ended (`completed`, `failed` or `cancelled`). From
8422
+ * `apiVersion` `2026-11-08` the cancelled run ends with status `cancelled`;
8423
+ * on earlier versions it ends `failed`.
8383
8424
  *
8384
8425
  * @param runId - Run identifier.
8385
- * @returns Updated run (with cancelled status).
8426
+ * @returns The updated run.
8386
8427
  */
8387
8428
  cancelAgentRun(runId: string): Promise<AgentRunResponse>;
8388
8429
  /**
@@ -8390,8 +8431,9 @@ declare class Seclai {
8390
8431
  *
8391
8432
  * Consumes the entire SSE stream and returns only the terminal `done` payload.
8392
8433
  * For real-time event access, use {@link runStreamingAgent} instead. The body
8393
- * takes no `include_reasoning`, and one passed anyway is not sent: this method
8394
- * returns no `stream_reasoning` events.
8434
+ * takes no `include_reasoning` or `include_commentary`, and one passed anyway
8435
+ * is not sent: this method returns no `stream_reasoning` or
8436
+ * `stream_commentary` events.
8395
8437
  *
8396
8438
  * A `result` event carries the run's answer in `output` once
8397
8439
  * `result_reported_at` is set, and can arrive while later steps still run.
@@ -8413,7 +8455,8 @@ declare class Seclai {
8413
8455
  * version.
8414
8456
  *
8415
8457
  * @param agentId - Agent identifier.
8416
- * @param body - Streaming run request payload, without `include_reasoning`.
8458
+ * @param body - Streaming run request payload, without `include_reasoning`
8459
+ * or `include_commentary`.
8417
8460
  * @param opts - Timeout, abort signal and `returnOnResult` options.
8418
8461
  * @returns The run from the `done` event; with `returnOnResult`, the
8419
8462
  * `result` snapshot; without `throwOnIncomplete`, possibly an unfinished
@@ -8434,7 +8477,7 @@ declare class Seclai {
8434
8477
  * }
8435
8478
  * ```
8436
8479
  */
8437
- runStreamingAgentAndWait(agentId: string, body: Omit<AgentRunStreamRequest, "include_reasoning">, opts?: {
8480
+ runStreamingAgentAndWait(agentId: string, body: Omit<AgentRunStreamRequest, "include_reasoning" | "include_commentary">, opts?: {
8438
8481
  timeoutMs?: number;
8439
8482
  signal?: AbortSignal;
8440
8483
  /**
@@ -8455,7 +8498,13 @@ declare class Seclai {
8455
8498
  * Run an agent in streaming mode and yield each SSE event as it arrives.
8456
8499
  *
8457
8500
  * This is an `AsyncGenerator` suitable for real-time UIs that want to render
8458
- * step progress as it happens.
8501
+ * step progress as it happens. Set `include_reasoning` or
8502
+ * `include_commentary` in `body` to also receive `stream_reasoning` or
8503
+ * `stream_commentary` events.
8504
+ *
8505
+ * From `apiVersion` `2026-11-14`, an agent whose definition fails to validate
8506
+ * is refused with HTTP 409 ({@link SeclaiAPIStatusError}) before any event,
8507
+ * and no run is created.
8459
8508
  *
8460
8509
  * @param agentId - Agent identifier.
8461
8510
  * @param body - Streaming run request payload.
@@ -8582,21 +8631,50 @@ declare class Seclai {
8582
8631
  */
8583
8632
  getAgentAttachmentReferences(agentId: string): Promise<AgentAttachmentRefsApiResponse>;
8584
8633
  /**
8585
- * Download a file attachment emitted by a step in an agent run.
8634
+ * Download a file of an agent run (one a step emitted or one the run started
8635
+ * with), or one byte range of it.
8586
8636
  *
8587
8637
  * Returns the raw `Response` so you can stream or save the binary data.
8588
8638
  *
8639
+ * To fetch part of the file, set a byte range. Offsets are zero-based and
8640
+ * `rangeEnd` is inclusive:
8641
+ *
8642
+ * - `rangeStart` alone sends `Range: bytes=<rangeStart>-`, from that byte to the end.
8643
+ * - `rangeStart` and `rangeEnd` send `Range: bytes=<rangeStart>-<rangeEnd>`.
8644
+ * - `rangeSuffix` alone sends `Range: bytes=-<rangeSuffix>`, the last that many bytes.
8645
+ *
8646
+ * With none of them set, the SDK adds no `Range` header. The server answers a range
8647
+ * with status 206 and a `Content-Range` header, so check `resp.status` before
8648
+ * treating the body as the whole file. A range of an empty file is answered with
8649
+ * 200 and the whole (empty) file. A range that starts at or past the end of a
8650
+ * non-empty file throws {@link SeclaiAPIStatusError} with `statusCode` 416,
8651
+ * and its `headers.get("content-range")` ends in `/<size>`, the file's size in
8652
+ * bytes.
8653
+ *
8589
8654
  * @param runId - Run identifier.
8590
- * @param attachmentId - URL-safe-base64-encoded `storage_key` of the attachment
8591
- * (as surfaced in run output manifests and webhook/email payloads).
8655
+ * @param attachmentId - The `id` of an entry in the run's or a step's
8656
+ * `attachments`, or the URL-safe-base64-encoded storage key that webhook and
8657
+ * email links carry.
8592
8658
  * @param opts - Optional `downloadName` filename hint for the download
8593
- * disposition, and `signal`, which cancels the request; with a standard `fetch` this
8659
+ * disposition; `rangeStart`, `rangeEnd` and `rangeSuffix`, the byte range
8660
+ * described above; and `signal`, which cancels the request; with a standard `fetch` this
8594
8661
  * includes reading the body, so `AbortSignal.timeout(ms)` bounds the whole
8595
8662
  * transfer.
8596
- * @returns Raw response with the attachment bytes.
8663
+ * @returns Raw response with the attachment bytes: status 200 with the whole
8664
+ * file, or 206 with the requested range.
8665
+ * @throws {@link SeclaiConfigurationError} Before any request, when the range
8666
+ * options are not one of the three forms above: `rangeEnd` without
8667
+ * `rangeStart`, `rangeSuffix` with either of them, `rangeEnd` less than
8668
+ * `rangeStart`, a negative `rangeStart` or `rangeEnd`, a `rangeSuffix` below
8669
+ * 1, or a value that is not a safe integer (`Number.isSafeInteger`).
8670
+ * @throws {@link SeclaiAPIStatusError} On a non-2xx response, including 416
8671
+ * when the range cannot be satisfied.
8597
8672
  */
8598
8673
  downloadAgentRunAttachment(runId: string, attachmentId: string, opts?: {
8599
8674
  downloadName?: string;
8675
+ rangeStart?: number;
8676
+ rangeEnd?: number;
8677
+ rangeSuffix?: number;
8600
8678
  signal?: AbortSignal;
8601
8679
  }): Promise<Response>;
8602
8680
  /**
@@ -8885,11 +8963,12 @@ declare class Seclai {
8885
8963
  */
8886
8964
  getInboundEmailStatus(): Promise<InboundEmailStatusResponse>;
8887
8965
  /**
8888
- * Fail all of the account's QUEUED (over-quota parked) inbound-email runs at
8889
- * once.
8966
+ * Cancel all of the account's QUEUED (over-quota parked) inbound-email runs
8967
+ * at once.
8890
8968
  *
8891
- * A queued run consumed no quota or credits at queue time, so this merely
8892
- * fails them. Requires an account owner/admin.
8969
+ * A queued run consumed no quota or credits at queue time. Each ends
8970
+ * `cancelled`, or `failed` with an `apiVersion` before `2026-11-08`.
8971
+ * Requires an account owner/admin.
8893
8972
  *
8894
8973
  * @returns The count cancelled.
8895
8974
  */
@@ -10135,6 +10214,14 @@ declare class SeclaiAPIStatusError extends SeclaiError {
10135
10214
  readonly url: string;
10136
10215
  /** Best-effort response body text (if available). */
10137
10216
  readonly responseText: string | undefined;
10217
+ /**
10218
+ * Headers of the error response, such as `Retry-After` on a 503, or
10219
+ * `Content-Range` on a 416 from a ranged `downloadAgentRunAttachment()`, whose
10220
+ * value ends in `/<size>`, the file's size in bytes. Empty when the response
10221
+ * headers are unknown. In a browser, only the headers the server's CORS policy
10222
+ * exposes are present.
10223
+ */
10224
+ readonly headers: Headers;
10138
10225
  constructor(opts: {
10139
10226
  /** Human-readable error message. */
10140
10227
  message: string;
@@ -10142,6 +10229,8 @@ declare class SeclaiAPIStatusError extends SeclaiError {
10142
10229
  method: string;
10143
10230
  url: string;
10144
10231
  responseText: string | undefined;
10232
+ /** Response headers; defaults to an empty `Headers`. */
10233
+ headers?: Headers;
10145
10234
  });
10146
10235
  }
10147
10236
  /**
@@ -10158,6 +10247,7 @@ declare class SeclaiAPIValidationError extends SeclaiAPIStatusError {
10158
10247
  method: string;
10159
10248
  url: string;
10160
10249
  responseText: string | undefined;
10250
+ headers?: Headers;
10161
10251
  validationError: unknown;
10162
10252
  });
10163
10253
  }