@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.0] - 2026-10-31
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Sync the bundled OpenAPI spec and regenerate the types. Existing responses gain properties: `decision` on `AgentRunStepResponse`, `created_resources`, `solution_id` and the run and credit limits `max_runs_total`, `max_runs_per_day`, `max_runs_per_hour`, `max_credits_per_run` and `max_credits_per_period` on `AgentSummaryResponse`, `max_credits_per_period`, `spend_cap_action`, `spend_cap_delete_order` and `spend_cap_reached` on `SourceResponse`, and `release_waiting_reason` on `SourceContentStatusResponse`
|
|
8
|
+
- Move `SeclaiApiVersion.Latest` to `2026-10-28`. Nothing is sent unless `apiVersion` is set, so a client that passes `SeclaiApiVersion.Latest` now opts into `2026-10-28`: an `if_else` or `switch` step's `output` is the result of the arm it took, where it was a `{"branch": ...}` marker naming the arm. Read the arm from the step's new `decision`, which is set on every version
|
|
9
|
+
- Mark `severity` on `listAlerts()` deprecated. It has never been sent, because `GET /alerts` has no severity filter
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Add `listAgentExamples()` for the agent gallery, searchable with `query` and filterable by `useCase`, returning typed `AgentExample` entries with the `resources` each needs, and accept `agent_template` entries from it on `createAgent()` with `resource_bindings` and `create_missing_resources`
|
|
14
|
+
- Add `setSlackTriggerConfig()` to configure an agent's `SLACK_COMMAND` trigger: its Slack connection, form, channels, activation, reply visibility and conversation settings
|
|
15
|
+
- Accept the run and credit limits on `updateAgent()`: `max_runs_total`, `max_runs_per_day`, `max_runs_per_hour`, `max_credits_per_run` and `max_credits_per_period`, a `set_max_*` flag for each to remove it, and `apply_import_run_limits`
|
|
16
|
+
- Accept a spend limit on `updateSource()`: `max_credits_per_period`, `spend_cap_action` and `spend_cap_delete_order`
|
|
17
|
+
- Accept the query filters the API declares and no method sent: `status`, `flaggedOnly`, `timeFrom` and `timeTo` on `listEvaluationResults()` and `listAgentEvaluationResults()`, which also takes `step`; `status`, `step`, `timeFrom` and `timeTo` on `listEvaluationRuns()`; `startedAfter` on `listCompatibleRuns()`; `days`, `startDate` and `endDate` on `getNonManualEvaluationSummary()` and `getMemoryBankStats()` (each method documents how the dates combine with `days`); `limit` and `offset` on `getMemoryBankAiLastConversation()` and `getAiAssistantMemoryBankHistory()`; `agentId`, `sourceConnectionId`, `timeFrom` and `timeTo` on `listAlerts()`; `agentId`, `sourceConnectionId` and `scope` on `listAlertConfigs()`; `organizationId` and `includeDefaults` on `listOrganizationAlertPreferences()`; `limit` on `listGovernanceAiConversations()`; `type` on `listMemoryBanks()`; `agentId` and `unreadOnly` on `listModelAlerts()`; `requireToolUse`, `requireStructuredOutput`, `requireThinking`, `minContextTokens` and `minOutputTokens` on `getModelRecommendations()`; and `search` on `listSolutions()`
|
|
18
|
+
- Let `getNonManualEvaluationSummary()` omit `agentId` for the account-wide summary
|
|
19
|
+
- Add the `SeclaiApiVersion.V2026_10_28` constant, so that version is accepted as `apiVersion`
|
|
20
|
+
- Add the type exports `AgentExampleListResponse`, `AgentExample`, `AgentExampleResource`, `SetSlackTriggerConfigRequest`, `SlackTriggerConfigResponse`, `SlackTriggerActivation`, `SlackTriggerScope`, `SlackReplyVisibility`, `SpendCapAction` and `SpendCapDeleteOrder`, and the option types `ListAgentExamplesOptions`, `ListEvaluationResultsOptions`, `ListAgentEvaluationResultsOptions`, `ListEvaluationRunsOptions`, `ListCompatibleRunsOptions`, `DateRangeOptions`, `OffsetPageOptions`, `ListAlertsOptions`, `ListAlertConfigsOptions`, `ListOrganizationAlertPreferencesOptions`, `ListMemoryBanksOptions`, `ListModelAlertsOptions`, `ModelRecommendationsOptions` and `ListSolutionsOptions`
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Make every field of `UpdateAgentRequest` optional. `updateAgent()` required `set_default_evaluation_tier`, `set_prompt_model_auto_rollback_triggers` and `set_sampling_config`, which the server defaults to `false`, so `updateAgent(id, { name })` did not compile
|
|
25
|
+
- Make server-defaulted fields optional on the request types that required them, so a call can leave them to the server: `description` on `CreateSolutionRequest` (`createSolution({ name })` did not compile), `priority` on `AgentRunRequest`, `enabled` and `distribution_type` on `CreateAlertConfigRequest`, `mode`, `type` and `strip_quoted_reply_chains` on `CreateMemoryBankBody`, `enabled` and `pass_threshold` on `CreateEvaluationCriteriaRequest`, `flagged`, `retry_count` and `retry_triggered` on `CreateEvaluationResultRequest`, `content_type` on `InlineTextUploadRequest` and `InlineTextReplaceRequest`, `entry_count` on `TestCompactionRequest`, `entry_count` and `bank_type` on `StandaloneTestCompactionRequest`, `match_type` on `BlockEmailSenderRequest`, `delegated` on `AddEmailDomainRequest`, `mode` on `GenerateAgentStepsRequest`, `pass_threshold` on `TestDraftEvaluationRequest`, `top_n` on `AgentTraceSearchRequest`, `confirm_deletions` on `AiAssistantAcceptRequest`, and the playground settings on `PlaygroundCreateRequest`. Response types are unchanged
|
|
26
|
+
|
|
27
|
+
## [1.7.0] - 2026-10-21
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **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)
|
|
32
|
+
- 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`
|
|
33
|
+
- 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`
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- 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`
|
|
38
|
+
- 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`
|
|
39
|
+
- Add `listEmailSourceRejections()` for the mail an email source refused
|
|
40
|
+
- 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
|
|
41
|
+
- 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()`
|
|
42
|
+
- 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
|
|
43
|
+
- Accept a `signal` on `downloadSourceExport()` and `downloadAgentRunAttachment()`
|
|
44
|
+
- Add the type exports `AcceptedAttachmentSlot`, `AcceptedAttachmentSlotInput`, `AcceptedAttachmentsResponse`, `SetAcceptedAttachmentsRequest`, `SetAcceptedAttachmentsInput`, `ContentAttachmentResponse`, `ContentAttachmentsListResponse`, `ContentAttachmentDetailResponse`, `SkippedAttachmentResponse`, `SkippedAttachmentReason`, `EmailSourceRejectionResponse` and `EmailSourceRejectionListResponse`
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- 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
|
|
49
|
+
|
|
3
50
|
## [1.6.1] - 2026-10-05
|
|
4
51
|
|
|
5
52
|
### Changed
|
|
@@ -223,6 +270,8 @@ _Stable release. No functional changes since 0.0.1._
|
|
|
223
270
|
|
|
224
271
|
_Initial release._
|
|
225
272
|
|
|
273
|
+
[1.8.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.8.0
|
|
274
|
+
[1.7.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.7.0
|
|
226
275
|
[1.6.1]: https://github.com/seclai/seclai-javascript/releases/tag/1.6.1
|
|
227
276
|
[1.6.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.6.0
|
|
228
277
|
[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.
|
|
107
|
+
https://seclai.github.io/seclai-javascript/1.8.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 `
|
|
130
|
+
Known versions are on `SeclaiApiVersion` (`V2026_07_01` through `V2026_10_28`,
|
|
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,23 @@ 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.
|
|
177
|
-
|
|
178
|
-
|
|
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.
|
|
191
|
+
- `2026-10-28` changes what an `if_else` or `switch` step's `output` contains.
|
|
192
|
+
Read the arm it took from the step's `decision`, which is set on every version.
|
|
179
193
|
|
|
180
194
|
| Version | What it changes |
|
|
181
195
|
| --- | --- |
|
|
@@ -184,12 +198,52 @@ contains:
|
|
|
184
198
|
| `2026-09-28` | Agent-definition writes use the current file-list grammar: an omitted `attachments` keeps the stored list and `[]` means no files |
|
|
185
199
|
| `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
200
|
| `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 |
|
|
201
|
+
| `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` |
|
|
202
|
+
| `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 |
|
|
203
|
+
| `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 |
|
|
204
|
+
| `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 |
|
|
205
|
+
| `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 |
|
|
206
|
+
| `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 |
|
|
207
|
+
| `2026-10-28` | An `if_else` or `switch` step's `output` is the result of the arm it took, or its input when that arm is empty or it took none. Below it the `output` is a `{"branch": ...}` marker naming the arm, with no `attachments`. The step's `decision` names the arm on every version |
|
|
187
208
|
|
|
188
209
|
**`Latest` moves with the SDK.** `SeclaiApiVersion.Latest` is the newest version
|
|
189
210
|
the installed release knows, so upgrading the package can opt a client that
|
|
190
211
|
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
|
|
192
|
-
|
|
212
|
+
`2026-10-03`, across the `2026-09-30` output change, and `1.7.0` moves it to
|
|
213
|
+
`2026-10-21`, across the `2026-10-05` status change, the `2026-10-13` and
|
|
214
|
+
`2026-10-19` source-setting rejections, the `2026-10-16` input change and the
|
|
215
|
+
`2026-10-21` evaluation change, and `1.8.0` moves it to `2026-10-28`,
|
|
216
|
+
across the `if_else` / `switch` step-output change. Pass a
|
|
217
|
+
dated constant such as `SeclaiApiVersion.V2026_07_27` to keep behaviour fixed
|
|
218
|
+
across upgrades.
|
|
219
|
+
|
|
220
|
+
## Upgrading to 1.7
|
|
221
|
+
|
|
222
|
+
Two type changes can stop existing code compiling. If you pass
|
|
223
|
+
`SeclaiApiVersion.Latest`, it now sends `2026-10-21`; the table above lists
|
|
224
|
+
what each version changes.
|
|
225
|
+
|
|
226
|
+
**`testDraftEvaluation()` can return `null` scores.** When the evaluator
|
|
227
|
+
returns no verdict, `status` is `error`. From API version `2026-10-21`, `score`
|
|
228
|
+
and `passed` are then `null`. An account created after `2026-10-21` ships gets
|
|
229
|
+
that version even without setting `apiVersion`. Check `status` before reading
|
|
230
|
+
them, in JavaScript too; under `strictNullChecks` the type enforces it:
|
|
231
|
+
|
|
232
|
+
<!-- sdksync:check -->
|
|
233
|
+
```ts
|
|
234
|
+
const result = await client.testDraftEvaluation("agent_id", { step_output: "...", pass_threshold: 0.7 });
|
|
235
|
+
|
|
236
|
+
// 1.6 and earlier: console.log(result.score.toFixed(2), result.passed);
|
|
237
|
+
if (result.status === "error") {
|
|
238
|
+
console.log("No verdict:", result.explanation);
|
|
239
|
+
} else {
|
|
240
|
+
console.log(result.score.toFixed(2), result.passed); // number and boolean here
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**`InsufficientCreditsResponse` matches the 402 body.** Read the code at
|
|
245
|
+
`error.code`, not `detail.error`. Code that cast a 402 body to this type threw
|
|
246
|
+
on every real 402 before, so this only fixes it.
|
|
193
247
|
|
|
194
248
|
## Resources
|
|
195
249
|
|
|
@@ -220,6 +274,10 @@ const fetched = await client.getAgent("agent_id");
|
|
|
220
274
|
const updated = await client.updateAgent("agent_id", { name: "Renamed" });
|
|
221
275
|
await client.deleteAgent("agent_id");
|
|
222
276
|
|
|
277
|
+
// Run and credit limits. To remove one, send its set_max_* flag and omit the value.
|
|
278
|
+
await client.updateAgent("agent_id", { max_runs_per_hour: 60, max_credits_per_period: 500 });
|
|
279
|
+
await client.updateAgent("agent_id", { set_max_runs_per_hour: true });
|
|
280
|
+
|
|
223
281
|
// Pause / resume — a disabled agent stops firing from every trigger path
|
|
224
282
|
const callers = await client.getAgentCallers("agent_id"); // live agents calling this one
|
|
225
283
|
await client.disableAgent("agent_id"); // 409 if any caller above is still live
|
|
@@ -249,6 +307,31 @@ const imported = await client.createAgent({
|
|
|
249
307
|
// `imported.import_warnings` lists any items that couldn't be applied.
|
|
250
308
|
```
|
|
251
309
|
|
|
310
|
+
### Agent examples
|
|
311
|
+
|
|
312
|
+
The agent gallery lists example agents to start from. Pass an entry's `key` as
|
|
313
|
+
`agent_template` to `createAgent()`. Bind each resource the template needs with
|
|
314
|
+
`resource_bindings`, or set `create_missing_resources` to have the API create the
|
|
315
|
+
ones you leave out; `created_resources` reports what it made.
|
|
316
|
+
|
|
317
|
+
<!-- sdksync:check -->
|
|
318
|
+
```ts
|
|
319
|
+
const examples = await client.listAgentExamples({ query: "support", useCase: "customer_support", limit: 10 });
|
|
320
|
+
const example = examples.data[0];
|
|
321
|
+
console.log(example.key, example.title, examples.pagination.total);
|
|
322
|
+
for (const slot of example.resources) {
|
|
323
|
+
console.log(slot.slot, slot.kind, slot.creatable); // what resource_bindings can bind
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const agent = await client.createAgent({
|
|
327
|
+
name: "Support triage",
|
|
328
|
+
agent_template: example.key,
|
|
329
|
+
resource_bindings: { [example.resources[0].slot]: "kb_id" },
|
|
330
|
+
create_missing_resources: true,
|
|
331
|
+
});
|
|
332
|
+
console.log(agent.created_resources); // { slot: resource_id } for each resource it created
|
|
333
|
+
```
|
|
334
|
+
|
|
252
335
|
### Agent runs
|
|
253
336
|
|
|
254
337
|
```ts
|
|
@@ -294,6 +377,21 @@ for await (const event of client.runStreamingAgent(
|
|
|
294
377
|
}
|
|
295
378
|
```
|
|
296
379
|
|
|
380
|
+
Pass `include_reasoning: true` to also receive `stream_reasoning` events carrying
|
|
381
|
+
the model's reasoning while it thinks. They are sent only for a
|
|
382
|
+
`streaming_result` step whose author enabled `show_reasoning`, and reasoning is
|
|
383
|
+
never part of `output`:
|
|
384
|
+
|
|
385
|
+
<!-- sdksync:check -->
|
|
386
|
+
```ts
|
|
387
|
+
for await (const event of client.runStreamingAgent("agent_id", {
|
|
388
|
+
input: "Hello",
|
|
389
|
+
include_reasoning: true,
|
|
390
|
+
})) {
|
|
391
|
+
if (event.event === "stream_reasoning") console.log(event.data);
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
297
395
|
### Polling
|
|
298
396
|
|
|
299
397
|
For environments where SSE is not practical, poll for a completed run:
|
|
@@ -308,6 +406,7 @@ const result = await client.runAgentAndPoll(
|
|
|
308
406
|
|
|
309
407
|
### Agent input uploads
|
|
310
408
|
|
|
409
|
+
<!-- sdksync:check -->
|
|
311
410
|
```ts
|
|
312
411
|
// Discover which files (if any) the agent expects before staging uploads
|
|
313
412
|
const refs = await client.getAgentAttachmentReferences("agent_id");
|
|
@@ -316,14 +415,26 @@ if (refs.requires_uploads) {
|
|
|
316
415
|
}
|
|
317
416
|
|
|
318
417
|
const upload = await client.uploadAgentInput("agent_id", {
|
|
319
|
-
file: new Uint8Array([
|
|
418
|
+
file: new Uint8Array([/* file bytes */]),
|
|
320
419
|
fileName: "input.pdf",
|
|
321
420
|
});
|
|
322
|
-
|
|
421
|
+
// From API version 2026-10-16 the upload is `ready` at once. Below it, poll
|
|
422
|
+
// until `status` is `ready` before running.
|
|
423
|
+
let status = await client.getAgentInputUploadStatus("agent_id", upload.id);
|
|
424
|
+
while (status.status !== "ready") {
|
|
425
|
+
if (status.status === "failed") throw new Error(`Upload failed: ${status.error}`);
|
|
426
|
+
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
427
|
+
status = await client.getAgentInputUploadStatus("agent_id", upload.id);
|
|
428
|
+
}
|
|
429
|
+
const run = await client.runAgent("agent_id", { input_upload_id: upload.id, priority: false });
|
|
323
430
|
```
|
|
324
431
|
|
|
432
|
+
Only a `dynamic_input` agent takes uploads; any other agent rejects one with a
|
|
433
|
+
400.
|
|
434
|
+
|
|
325
435
|
### Agent run attachments
|
|
326
436
|
|
|
437
|
+
<!-- sdksync:check -->
|
|
327
438
|
```ts
|
|
328
439
|
// Download a file emitted by a step in an agent run. The attachment_id is the
|
|
329
440
|
// URL-safe-base64 storage_key surfaced in run output manifests / webhooks.
|
|
@@ -347,6 +458,53 @@ const config = await client.setEmailTriggerConfig("agent_id", "trigger_id", {
|
|
|
347
458
|
console.log(config.email_addresses); // ["support.<accountID>@agent.seclai.com", ...]
|
|
348
459
|
```
|
|
349
460
|
|
|
461
|
+
Set `run_on_attachment_mismatch: true` to run an email whose attachments do not
|
|
462
|
+
fit what the agent accepts: files it cannot take are left out and the problems
|
|
463
|
+
are listed in the run's `email_attachment_issues` metadata. By default the run fails.
|
|
464
|
+
|
|
465
|
+
### Agent Slack triggers
|
|
466
|
+
|
|
467
|
+
Configure an agent's `SLACK_COMMAND` trigger, which people run from Slack with
|
|
468
|
+
`/seclai` or the message shortcut. Omitted fields are left unchanged.
|
|
469
|
+
|
|
470
|
+
<!-- sdksync:check -->
|
|
471
|
+
```ts
|
|
472
|
+
const slack = await client.setSlackTriggerConfig("agent_id", "trigger_id", {
|
|
473
|
+
scope: "selected_channels", // or "bot_channels"
|
|
474
|
+
channel_ids: ["C0123456789"],
|
|
475
|
+
activation: "everywhere", // or "channel_opt_in"
|
|
476
|
+
visibility: "private", // or "channel"
|
|
477
|
+
allow_dms: true,
|
|
478
|
+
turns_enabled: true, // let people keep the conversation going
|
|
479
|
+
max_turns: 5,
|
|
480
|
+
form: [{ key: "ticket", label: "Ticket ID", type: "short_text", required: true }],
|
|
481
|
+
});
|
|
482
|
+
console.log(slack.missing_scopes); // Slack scopes the connection lacks for optional features
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
Each form value reaches the run as `{{metadata.<key>}}`.
|
|
486
|
+
|
|
487
|
+
### Accepted attachments
|
|
488
|
+
|
|
489
|
+
Declare the input attachments a trigger accepts. A run's files are each assigned
|
|
490
|
+
to one named slot before any step runs, and steps reference a slot as
|
|
491
|
+
`{{agent.attachments.<name>}}`. The call replaces the whole declaration, and is
|
|
492
|
+
refused with a 400 when the agent references a slot it leaves out. `min` defaults
|
|
493
|
+
to 0. The same slots can be set as `accepted_attachments` on `createAgent()` and
|
|
494
|
+
`updateAgentDefinition()`.
|
|
495
|
+
|
|
496
|
+
<!-- sdksync:check -->
|
|
497
|
+
```ts
|
|
498
|
+
const agent = await client.getAgent("agent_id");
|
|
499
|
+
const { accepted_attachments } = await client.setAcceptedAttachments("agent_id", agent.trigger_id!, {
|
|
500
|
+
accepted_attachments: [
|
|
501
|
+
{ name: "invoice", content_types: ["application/pdf"], min: 1, max: 1 },
|
|
502
|
+
{ name: "photos", content_types: ["image/*"], label: "Photos of the damage" },
|
|
503
|
+
],
|
|
504
|
+
});
|
|
505
|
+
console.log(accepted_attachments.map((slot) => `${slot.name}: ${slot.min}..${slot.max ?? "any"}`));
|
|
506
|
+
```
|
|
507
|
+
|
|
350
508
|
### Agent email governance
|
|
351
509
|
|
|
352
510
|
```ts
|
|
@@ -394,22 +552,27 @@ const detail = await client.getEvaluationCriteria("criteria_id");
|
|
|
394
552
|
await client.updateEvaluationCriteria("criteria_id", { ... });
|
|
395
553
|
await client.deleteEvaluationCriteria("criteria_id");
|
|
396
554
|
|
|
397
|
-
// Test a draft
|
|
398
|
-
|
|
555
|
+
// Test a draft. Check status first: an "error" result has no verdict, and its
|
|
556
|
+
// score and passed can be null.
|
|
557
|
+
const draft = await client.testDraftEvaluation("agent_id", { step_output: "...", pass_threshold: 0.7 });
|
|
558
|
+
if (draft.status !== "error") console.log(draft.score, draft.passed);
|
|
399
559
|
|
|
400
560
|
// Results by criteria
|
|
401
|
-
const results = await client.listEvaluationResults("criteria_id");
|
|
561
|
+
const results = await client.listEvaluationResults("criteria_id", { flaggedOnly: true, timeFrom: "2026-10-01T00:00:00Z" });
|
|
402
562
|
const summary = await client.getEvaluationCriteriaSummary("criteria_id");
|
|
403
563
|
await client.createEvaluationResult("criteria_id", { ... });
|
|
404
564
|
|
|
405
565
|
// Results by run
|
|
406
566
|
const runResults = await client.listRunEvaluationResults("agent_id", "run_id");
|
|
567
|
+
const agentResults = await client.listAgentEvaluationResults("agent_id", { status: "failed", step: "step_id" });
|
|
568
|
+
const evalRuns = await client.listEvaluationRuns("agent_id", { timeFrom: "2026-10-01T00:00:00Z" });
|
|
407
569
|
|
|
408
|
-
// Non-manual evaluation summary
|
|
409
|
-
const nonManual = await client.getNonManualEvaluationSummary("agent_id");
|
|
570
|
+
// Non-manual evaluation summary, for one agent or the whole account
|
|
571
|
+
const nonManual = await client.getNonManualEvaluationSummary("agent_id", { days: 7 });
|
|
572
|
+
const accountWide = await client.getNonManualEvaluationSummary(undefined, { startDate: "2026-10-01", endDate: "2026-10-31" });
|
|
410
573
|
|
|
411
574
|
// Compatible runs for a criteria
|
|
412
|
-
const compatible = await client.listCompatibleRuns("criteria_id");
|
|
575
|
+
const compatible = await client.listCompatibleRuns("criteria_id", { startedAfter: "2026-10-01T00:00:00Z" });
|
|
413
576
|
```
|
|
414
577
|
|
|
415
578
|
### Knowledge bases
|
|
@@ -425,14 +588,14 @@ await client.deleteKnowledgeBase("kb_id");
|
|
|
425
588
|
### Memory banks
|
|
426
589
|
|
|
427
590
|
```ts
|
|
428
|
-
const banks = await client.listMemoryBanks();
|
|
591
|
+
const banks = await client.listMemoryBanks({ type: "conversation" });
|
|
429
592
|
const bank = await client.createMemoryBank({ name: "Chat Memory", type: "conversation" });
|
|
430
593
|
const fetched = await client.getMemoryBank("mb_id");
|
|
431
594
|
await client.updateMemoryBank("mb_id", { name: "Renamed" });
|
|
432
595
|
await client.deleteMemoryBank("mb_id");
|
|
433
596
|
|
|
434
597
|
// Stats & compaction
|
|
435
|
-
const stats = await client.getMemoryBankStats("mb_id");
|
|
598
|
+
const stats = await client.getMemoryBankStats("mb_id", { startDate: "2026-10-01", endDate: "2026-10-31" });
|
|
436
599
|
await client.compactMemoryBank("mb_id");
|
|
437
600
|
|
|
438
601
|
// Test compaction
|
|
@@ -445,7 +608,7 @@ const agents = await client.getAgentsUsingMemoryBank("mb_id");
|
|
|
445
608
|
|
|
446
609
|
// AI assistant
|
|
447
610
|
const suggestion = await client.generateMemoryBankConfig({ user_input: "..." });
|
|
448
|
-
const history = await client.getMemoryBankAiLastConversation();
|
|
611
|
+
const history = await client.getMemoryBankAiLastConversation({ limit: 5 });
|
|
449
612
|
await client.acceptMemoryBankAiSuggestion("conv_id", { ... });
|
|
450
613
|
|
|
451
614
|
// Source management
|
|
@@ -462,6 +625,21 @@ await client.updateSource("source_id", { name: "Renamed" });
|
|
|
462
625
|
await client.deleteSource("source_id");
|
|
463
626
|
```
|
|
464
627
|
|
|
628
|
+
A spend limit caps the credits a source may commit per billing period. When it is
|
|
629
|
+
reached, `stop` refuses new uploads and email, and `delete` removes entries in
|
|
630
|
+
`spend_cap_delete_order` to make room. Send `null` to remove the limit.
|
|
631
|
+
|
|
632
|
+
<!-- sdksync:check -->
|
|
633
|
+
```ts
|
|
634
|
+
const capped = await client.updateSource("source_id", {
|
|
635
|
+
max_credits_per_period: 1000,
|
|
636
|
+
spend_cap_action: "delete",
|
|
637
|
+
spend_cap_delete_order: "oldest_published",
|
|
638
|
+
});
|
|
639
|
+
console.log(capped.spend_cap_reached);
|
|
640
|
+
await client.updateSource("source_id", { max_credits_per_period: null });
|
|
641
|
+
```
|
|
642
|
+
|
|
465
643
|
Indexing status of a source's content, keyed by the `content_version_id` the
|
|
466
644
|
upload methods return:
|
|
467
645
|
|
|
@@ -474,9 +652,40 @@ const batch = await client.listSourceContents("source_id", {
|
|
|
474
652
|
console.log(batch.pagination.total, failed.data.map((item) => item.error));
|
|
475
653
|
|
|
476
654
|
const one = await client.getSourceContentStatus("source_id", "cv_1");
|
|
477
|
-
console.log(one.content_status);
|
|
655
|
+
console.log(one.content_status, one.held_for_review);
|
|
478
656
|
```
|
|
479
657
|
|
|
658
|
+
An item an Enforce governance policy blocked at import is held for review:
|
|
659
|
+
`held_for_review` is `true` until a reviewer releases it. Its `content_status` is
|
|
660
|
+
`completed` from API version `2026-10-05`, and `failed` with the hold as the
|
|
661
|
+
`error` below it.
|
|
662
|
+
|
|
663
|
+
An email source stores mail from `email_allowed_senders` only, and lists what it
|
|
664
|
+
refused. Each entry names the sender and the reason, never the subject or body;
|
|
665
|
+
adding a refused sender to `email_allowed_senders` helps only when `authenticated`
|
|
666
|
+
is `true`. Listing rejections requires an account owner or administrator.
|
|
667
|
+
|
|
668
|
+
<!-- sdksync:check -->
|
|
669
|
+
```ts
|
|
670
|
+
const inbox = await client.createSource({
|
|
671
|
+
name: "Newsletters",
|
|
672
|
+
source_type: "email",
|
|
673
|
+
email_allowed_senders: ["news@example.com", "example.org"],
|
|
674
|
+
});
|
|
675
|
+
console.log(inbox.email_address); // send mail here
|
|
676
|
+
|
|
677
|
+
const rejections = await client.listEmailSourceRejections(inbox.id, { page: 1, limit: 50 });
|
|
678
|
+
for (const r of rejections.data) console.log(r.from_address, r.reason, r.authenticated);
|
|
679
|
+
|
|
680
|
+
// Index the images inside documents, and an RSS feed's enclosures
|
|
681
|
+
await client.updateSource("source_id", { document_images: true, feed_attachments: ["enclosures"] });
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
A `cloud_drive` source takes `cloud_drive_connection_id` (from `listCloudDrives()`)
|
|
685
|
+
on create, and `cloud_drive_folder_path`, `cloud_drive_path_pattern`,
|
|
686
|
+
`cloud_drive_content_types` and `cloud_drive_max_file_mb` to choose which files
|
|
687
|
+
it indexes.
|
|
688
|
+
|
|
480
689
|
### Cloud drives
|
|
481
690
|
|
|
482
691
|
<!-- sdksync:check -->
|
|
@@ -567,10 +776,32 @@ await client.uploadFileToContent("content_id", {
|
|
|
567
776
|
});
|
|
568
777
|
```
|
|
569
778
|
|
|
779
|
+
A content item's attachments are the files an agent step, an email, a feed, a
|
|
780
|
+
web page's media or a document's images added to it. Each says whether it is
|
|
781
|
+
indexed for search and, if indexing failed, why. An email item's
|
|
782
|
+
`skipped_attachments` (on `getContentDetail()`) lists the parts that were not
|
|
783
|
+
stored, with the reason.
|
|
784
|
+
|
|
785
|
+
<!-- sdksync:check -->
|
|
786
|
+
```ts
|
|
787
|
+
const attachments = await client.listContentAttachments("content_id", { limit: 50 });
|
|
788
|
+
for (const att of attachments.data) {
|
|
789
|
+
console.log(att.id, att.content_type, att.indexed, att.indexing_error);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
const att = await client.getContentAttachment("content_id", "attachment_id", { start: 0, end: 2000 });
|
|
793
|
+
console.log(att.text_content, att.file_withheld);
|
|
794
|
+
const vectors = await client.listContentAttachmentEmbeddings("content_id", "attachment_id");
|
|
795
|
+
|
|
796
|
+
// Raw Response; 403 while the file is withheld (see `file_withheld`).
|
|
797
|
+
const file = await client.downloadContentAttachment("content_id", "attachment_id");
|
|
798
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
799
|
+
```
|
|
800
|
+
|
|
570
801
|
### Solutions
|
|
571
802
|
|
|
572
803
|
```ts
|
|
573
|
-
const solutions = await client.listSolutions();
|
|
804
|
+
const solutions = await client.listSolutions({ search: "billing" });
|
|
574
805
|
const sol = await client.createSolution({ name: "My Solution" });
|
|
575
806
|
const fetched = await client.getSolution("solution_id");
|
|
576
807
|
await client.updateSolution("solution_id", { name: "Renamed" });
|
|
@@ -603,7 +834,7 @@ await client.markSolutionConversationTurn("solution_id", "conversation_id", { ..
|
|
|
603
834
|
|
|
604
835
|
```ts
|
|
605
836
|
const plan = await client.generateGovernanceAiPlan({ user_input: "Add a toxicity policy" });
|
|
606
|
-
const convs = await client.listGovernanceAiConversations();
|
|
837
|
+
const convs = await client.listGovernanceAiConversations({ limit: 10 });
|
|
607
838
|
await client.acceptGovernanceAiPlan("conversation_id");
|
|
608
839
|
await client.declineGovernanceAiPlan("conversation_id");
|
|
609
840
|
```
|
|
@@ -611,7 +842,7 @@ await client.declineGovernanceAiPlan("conversation_id");
|
|
|
611
842
|
### Alerts
|
|
612
843
|
|
|
613
844
|
```ts
|
|
614
|
-
const alerts = await client.listAlerts({ status: "active" });
|
|
845
|
+
const alerts = await client.listAlerts({ status: "active", agentId: "agent_id", timeFrom: "2026-10-01T00:00:00Z" });
|
|
615
846
|
const alert = await client.getAlert("alert_id");
|
|
616
847
|
await client.changeAlertStatus("alert_id", { status: "resolved" });
|
|
617
848
|
await client.addAlertComment("alert_id", { text: "Investigating" });
|
|
@@ -621,14 +852,14 @@ await client.subscribeToAlert("alert_id");
|
|
|
621
852
|
await client.unsubscribeFromAlert("alert_id");
|
|
622
853
|
|
|
623
854
|
// Alert configs
|
|
624
|
-
const configs = await client.listAlertConfigs();
|
|
855
|
+
const configs = await client.listAlertConfigs({ agentId: "agent_id" });
|
|
625
856
|
await client.createAlertConfig({ ... });
|
|
626
857
|
await client.getAlertConfig("config_id");
|
|
627
858
|
await client.updateAlertConfig("config_id", { ... });
|
|
628
859
|
await client.deleteAlertConfig("config_id");
|
|
629
860
|
|
|
630
861
|
// Organization preferences
|
|
631
|
-
const prefs = await client.listOrganizationAlertPreferences();
|
|
862
|
+
const prefs = await client.listOrganizationAlertPreferences({ includeDefaults: true });
|
|
632
863
|
await client.updateOrganizationAlertPreference("org_id", "alert_type", { ... });
|
|
633
864
|
```
|
|
634
865
|
|
|
@@ -649,11 +880,11 @@ const embedders = await client.listEmbeddingModels({ supportsInputMedia: "image"
|
|
|
649
880
|
const rerankers = await client.listRerankerModels();
|
|
650
881
|
console.log(embedders.models, embedders.default_model_type, rerankers.models);
|
|
651
882
|
|
|
652
|
-
const alerts = await client.listModelAlerts();
|
|
883
|
+
const alerts = await client.listModelAlerts({ unreadOnly: true });
|
|
653
884
|
await client.markModelAlertRead("alert_id");
|
|
654
885
|
await client.markAllModelAlertsRead();
|
|
655
886
|
const unread = await client.getUnreadModelAlertCount();
|
|
656
|
-
const recs = await client.getModelRecommendations("model_id");
|
|
887
|
+
const recs = await client.getModelRecommendations("model_id", { requireToolUse: true, minContextTokens: 100_000 });
|
|
657
888
|
|
|
658
889
|
// Model playground experiments
|
|
659
890
|
const experiment = await client.createExperiment({ model_ids: ["model_id"], prompt: "..." });
|