@seclai/sdk 1.4.0 → 1.6.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 +54 -0
- package/README.md +112 -3
- package/dist/index.cjs +313 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1678 -107
- package/dist/index.d.ts +1678 -107
- package/dist/index.js +312 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.0] - 2026-10-04
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Sync the bundled OpenAPI spec and regenerate the types. Existing responses gain properties, among them `attachments` on `AgentRunResponse` and `AgentRunStepResponse`, `trace_purged_at` on a run, `warnings` on a step, `strip_quoted_reply_chains` on memory banks, `effort` on playground experiments, `effort_options` and `chat_capable` on `PromptModelResponse`, and `embedder_warning` on `ContentFileUploadResponse`
|
|
8
|
+
- Move `SeclaiApiVersion.Latest` to `2026-10-03`. Nothing is sent unless `apiVersion` is set, so a client that passes `SeclaiApiVersion.Latest` now opts into the five versions added below
|
|
9
|
+
- Send an array passed in the `query` of `request()` or `requestRaw()` as a repeated parameter, one pair per element. It was joined with commas into a single value
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Add the cloud-drive methods `listCloudDriveProviders()`, `listCloudDrives()`, `getCloudDrive()`, `updateCloudDrive()`, `disconnectCloudDrive()`, `deleteCloudDrive()`, `getAgentsUsingCloudDrive()` and `listCloudDriveRejections()`. The four listings return the items as an array whether the endpoint answers with a bare array or, from `apiVersion` `2026-07-27`, the `{data, pagination}` envelope
|
|
14
|
+
- Add `listSourceContents()` and `getSourceContentStatus()` for the indexing status of a source's content. `contentVersionIds` polls a batch of uploads in one request, and an empty array returns an empty page without calling the API
|
|
15
|
+
- Add `listEmbeddingModels()` and `listRerankerModels()`. The list is under `models` on every API version, with the defaults and pricing beside it
|
|
16
|
+
- Add the `SeclaiApiVersion` constants `V2026_08_03`, `V2026_08_21`, `V2026_09_28`, `V2026_09_30` and `V2026_10_03`, so those versions are accepted as `apiVersion`. The README lists what each one changes
|
|
17
|
+
- Add the type exports for those endpoints, including `CloudDriveResponse`, `CloudDriveProviderResponse`, `CloudDriveRejectionResponse`, `CloudDriveUpdateRequest`, `AgentUsingCloudDriveResponse`, `SourceContentStatusResponse`, `SourceContentStatusListResponse`, `ListSourceContentsOptions`, `EmbeddingModelListResponse` and `RerankerModelListResponse`, plus `AgentRunFileResponse` and `EffortOptionsResponse`
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Make `paginate()` work with the list methods. It read `items` and `pagination.total_pages`, while they return `data` and `pagination.pages`, so `client.paginate((opts) => client.listSources(opts))` threw `TypeError: result.items is not iterable`. It now reads the `{data, pagination}` envelope and stops on `has_next`, walks the flat `{data, total, page, limit}` shape of the evaluation listings by `total`, yields a bare array once, still accepts a custom fetcher's `{items, pagination: {total_pages}}`, and throws `SeclaiError` on anything else. The fetcher's page type is exported as `PaginatedPage`
|
|
22
|
+
- Correct the `Seclai` class example, which destructured an `items` property `listAgents()` does not return
|
|
23
|
+
|
|
24
|
+
## [1.5.0] - 2026-07-27
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- Return typed results from the 20 methods that previously declared `unknown` — alerts, alert configs, model alerts and recommendations, playground experiments, search and the AI assistant acknowledgements. Narrowing `unknown` to a concrete type is source compatible, so no façade is needed here
|
|
29
|
+
- Stop sending `severity` from `listAlerts()`. `GET /alerts` declares no such filter, so it never filtered, and it becomes a 422 once `apiVersion` is `2026-07-27` or later. The option is still accepted and ignored
|
|
30
|
+
- Accept either wire shape from `listEvaluationCriteria()`. The endpoint is moving from a bare array to a paginated envelope, so the client now reads both and keeps returning `EvaluationCriteriaResponse[]`
|
|
31
|
+
- Sync the bundled OpenAPI spec with the API fixes found while updating the SDKs: `agent_id` is now declared on the non-manual evaluation summary, and `page`/`limit` on the evaluation and alert-config listings
|
|
32
|
+
- Deprecate `deleteAgentRun()`. It never deleted anything — the endpoint it calls is documented as "Cancel an agent run", and the API has no delete-a-run operation. Use `cancelAgentRun()`
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- Add the `SeclaiApiVersion` constants and the `ApiVersion` type. An `apiVersion` this release was not built against throws at construction, since a newer version can reshape responses this client would mis-decode; set `allowUnknownApiVersion` to override
|
|
37
|
+
- Add 20 response type exports covering those endpoints, including `AlertResponse`, `AlertDetailResponse`, `AlertConfigResponse`, `ModelAlertResponse`, `ExperimentDetailResponse`, `SearchResponse` and `OkResponse`
|
|
38
|
+
- Add `listEvaluationCriteriaPage()` for the canonical `{data, pagination}` envelope, which the endpoint emits once `apiVersion` is `2026-07-27` or later
|
|
39
|
+
- Add an `apiVersion` client option, sent as the `Seclai-Version` header, opting into dated API changes released on or before that date. Omitted by default, so upgrading the SDK alone never changes response shapes
|
|
40
|
+
- Add `getApiVersion()` and `updateApiVersion()` to read the version a request resolves to and to pin or clear the account's version
|
|
41
|
+
- Add the `ApiVersionResponse` type export
|
|
42
|
+
- Add the `EvaluationCriteriaListResponse` type export
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Validate the merged `Seclai-Version` rather than the first match in `defaultHeaders`. The merge lets the last entry win, so two spellings of the header meant the guard could approve one value and the client send another
|
|
47
|
+
- Validate a `Seclai-Version` supplied through `defaultHeaders`, not just the `apiVersion` option. `defaultHeaders` is applied last so it wins, which left the unknown-version guard one header away from being bypassed; a differently-cased key also emitted two wire headers
|
|
48
|
+
- Throw from `getAgentAiConversationHistory()` when `opts.stepType` is missing. It was optional and dropped by `buildURL`, so a call without it still 422'd — the failure this method was changed to prevent
|
|
49
|
+
- Decode either wire shape in `listRunEvaluationResults()`. The endpoint answers with a bare array, which the declared envelope type could not read, so the method returned nothing; it now also reads the canonical `{data, pagination}` envelope. `listAgentEvaluationResults()` is genuinely flat and is unaffected
|
|
50
|
+
- Paginate `listModelAlerts()` with the `offset` the endpoint declares instead of `page`, which it does not accept — every page after the first returned page 1
|
|
51
|
+
- Send `step_type` from `getAgentAiConversationHistory()`, along with `stepId`, `limit` and `offset`. The API marks `step_type` required and the method had no way to supply it, so every call answered 422
|
|
52
|
+
- Request `GET /sources` rather than `GET /sources/`. The trailing-slash form is no longer declared by the API
|
|
53
|
+
- Point `cancelAgentRun()` at `DELETE /agents/runs/{run_id}`. It posted to `/agents/runs/{run_id}/cancel`, a path the API has never exposed, so cancelling a run always failed
|
|
54
|
+
|
|
3
55
|
## [1.4.0] - 2026-07-25
|
|
4
56
|
|
|
5
57
|
### Changed
|
|
@@ -154,6 +206,8 @@ _Stable release. No functional changes since 0.0.1._
|
|
|
154
206
|
|
|
155
207
|
_Initial release._
|
|
156
208
|
|
|
209
|
+
[1.6.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.6.0
|
|
210
|
+
[1.5.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.5.0
|
|
157
211
|
[1.4.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.4.0
|
|
158
212
|
[1.3.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.3.0
|
|
159
213
|
[1.2.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.2.0
|
package/README.md
CHANGED
|
@@ -104,10 +104,75 @@ 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.6.0/
|
|
108
108
|
|
|
109
109
|
Release history is in [`CHANGELOG.md`](CHANGELOG.md).
|
|
110
110
|
|
|
111
|
+
## API versioning
|
|
112
|
+
|
|
113
|
+
The API dates its backward-incompatible changes. Nothing changes for you until
|
|
114
|
+
you opt in, either per client or by pinning the account:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
const client = new Seclai({
|
|
118
|
+
apiKey: "...",
|
|
119
|
+
apiVersion: SeclaiApiVersion.V2026_07_27, // sent as the Seclai-Version header
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const state = await client.getApiVersion(); // what this request resolved to
|
|
123
|
+
await client.updateApiVersion(SeclaiApiVersion.V2026_07_27); // pin the whole account
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Leave `apiVersion` unset and the header is omitted, so the account's pinned
|
|
127
|
+
baseline applies and responses keep their current shapes. Upgrading this package
|
|
128
|
+
alone never changes the wire contract.
|
|
129
|
+
|
|
130
|
+
Known versions are on `SeclaiApiVersion` (`V2026_07_01` through `V2026_10_03`,
|
|
131
|
+
plus `Default` and `Latest`), imported from `@seclai/sdk`. A version this release was
|
|
132
|
+
**not** built against throws at construction: a newer version can reshape
|
|
133
|
+
responses, and this client would decode them incorrectly rather than reject them.
|
|
134
|
+
Upgrade the package to adopt a new version, or set `allowUnknownApiVersion` if
|
|
135
|
+
you have to move first and accept that risk.
|
|
136
|
+
|
|
137
|
+
The guard only covers the header. An account pinned server-side can still be
|
|
138
|
+
newer than this release — `getApiVersion()` reports the `effective_version` the
|
|
139
|
+
request resolved to, and comparing it against `SeclaiApiVersion.Latest` is how
|
|
140
|
+
you detect the gap.
|
|
141
|
+
|
|
142
|
+
**What `2026-07-27` changes.** Undeclared query parameters become a 422 instead
|
|
143
|
+
of being ignored, and list endpoints move to the canonical `{data, pagination}`
|
|
144
|
+
envelope. The affected methods read both shapes, so they keep working either way
|
|
145
|
+
— but the metadata moves:
|
|
146
|
+
|
|
147
|
+
| Method | Before | From 2026-07-27 |
|
|
148
|
+
| --- | --- | --- |
|
|
149
|
+
| `listEvaluationCriteriaPage()` | bare array | `data` + `pagination` |
|
|
150
|
+
| `listRunEvaluationResults()` | bare array | `data` + `pagination` |
|
|
151
|
+
| `listAlertConfigs()` | `configs` + `total` | `data` + `pagination` |
|
|
152
|
+
| `listModelAlerts()` | `alerts` + `total` | `data` + `pagination` |
|
|
153
|
+
|
|
154
|
+
Prefer `pagination` over the flat `total`/`page`/`limit` properties, and read the
|
|
155
|
+
last two with `res.data ?? res.configs` / `res.data ?? res.alerts`. The legacy
|
|
156
|
+
keys will be deprecated and then removed once the canonical envelope is the
|
|
157
|
+
default.
|
|
158
|
+
|
|
159
|
+
The cloud-drive listings (`listCloudDriveProviders()`, `listCloudDrives()`,
|
|
160
|
+
`getAgentsUsingCloudDrive()`, `listCloudDriveRejections()`) follow the same rule
|
|
161
|
+
and return the items as an array on either shape. `listEmbeddingModels()` and
|
|
162
|
+
`listRerankerModels()` move their list from `models` to `data`; both methods
|
|
163
|
+
populate `models` on either shape, with the defaults and pricing beside it.
|
|
164
|
+
|
|
165
|
+
**Later versions.** Each is cumulative, and none changes a response shape this
|
|
166
|
+
client decodes:
|
|
167
|
+
|
|
168
|
+
| Version | What it changes |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `2026-08-03` | `createMemoryBank()` rejects `max_age_days` with a 400, and an omitted `retention_days` resolves per bank type instead of to 30 |
|
|
171
|
+
| `2026-08-21` | `createSource()` rejects an embedding dimension its embedder does not support with a 400 — `listEmbeddingModels()` reports the supported ones |
|
|
172
|
+
| `2026-09-28` | Agent-definition writes use the current file-list grammar: an omitted `attachments` keeps the stored list and `[]` means no files |
|
|
173
|
+
| `2026-09-30` | A run's and a step's `output`, and a step's `input`, are the text rather than a JSON manifest; files are in `attachments` on every version |
|
|
174
|
+
| `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 |
|
|
175
|
+
|
|
111
176
|
## Resources
|
|
112
177
|
|
|
113
178
|
### Identity
|
|
@@ -302,7 +367,10 @@ await client.markAgentAiSuggestion("agent_id", "conversation_id", { accepted: tr
|
|
|
302
367
|
### Agent evaluations
|
|
303
368
|
|
|
304
369
|
```ts
|
|
305
|
-
const criteria = await client.listEvaluationCriteria("agent_id");
|
|
370
|
+
const criteria = await client.listEvaluationCriteria("agent_id", { page: 1, limit: 50 });
|
|
371
|
+
// page/limit only take effect with apiVersion "2026-07-27" or later; the legacy
|
|
372
|
+
// response is unpaginated. listEvaluationCriteriaPage() returns the same items
|
|
373
|
+
// plus a `pagination` object when opted in.
|
|
306
374
|
const created = await client.createEvaluationCriteria("agent_id", { name: "Accuracy", ... });
|
|
307
375
|
const detail = await client.getEvaluationCriteria("criteria_id");
|
|
308
376
|
await client.updateEvaluationCriteria("criteria_id", { ... });
|
|
@@ -376,6 +444,40 @@ await client.updateSource("source_id", { name: "Renamed" });
|
|
|
376
444
|
await client.deleteSource("source_id");
|
|
377
445
|
```
|
|
378
446
|
|
|
447
|
+
Indexing status of a source's content, keyed by the `content_version_id` the
|
|
448
|
+
upload methods return:
|
|
449
|
+
|
|
450
|
+
<!-- sdksync:check -->
|
|
451
|
+
```ts
|
|
452
|
+
const failed = await client.listSourceContents("source_id", { status: "failed" });
|
|
453
|
+
const batch = await client.listSourceContents("source_id", {
|
|
454
|
+
contentVersionIds: ["cv_1", "cv_2"],
|
|
455
|
+
});
|
|
456
|
+
console.log(batch.pagination.total, failed.data.map((item) => item.error));
|
|
457
|
+
|
|
458
|
+
const one = await client.getSourceContentStatus("source_id", "cv_1");
|
|
459
|
+
console.log(one.content_status);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Cloud drives
|
|
463
|
+
|
|
464
|
+
<!-- sdksync:check -->
|
|
465
|
+
```ts
|
|
466
|
+
const providers = await client.listCloudDriveProviders();
|
|
467
|
+
const drives = await client.listCloudDrives();
|
|
468
|
+
const drive = await client.getCloudDrive(drives[0].id);
|
|
469
|
+
await client.updateCloudDrive(drive.id, { name: "Contracts" });
|
|
470
|
+
|
|
471
|
+
// Which agents depend on it, and which files it skipped and why
|
|
472
|
+
const agents = await client.getAgentsUsingCloudDrive(drive.id);
|
|
473
|
+
const skipped = await client.listCloudDriveRejections(drive.id, { limit: 20 });
|
|
474
|
+
console.log(providers.length, agents.length, skipped.map((r) => r.reason));
|
|
475
|
+
|
|
476
|
+
const disconnected = await client.disconnectCloudDrive(drive.id); // keeps the connection
|
|
477
|
+
console.log(disconnected.connected);
|
|
478
|
+
await client.deleteCloudDrive(drive.id);
|
|
479
|
+
```
|
|
480
|
+
|
|
379
481
|
### File uploads
|
|
380
482
|
|
|
381
483
|
Upload a file to a source (max 200 MiB). The SDK infers MIME type from the file extension when `mimeType` is not provided.
|
|
@@ -524,6 +626,11 @@ const model = await client.getModel("model_id");
|
|
|
524
626
|
// Media-generation quality tiers (fast/balanced/thorough) and what each resolves to
|
|
525
627
|
const tiers = await client.getGenerationTiers();
|
|
526
628
|
|
|
629
|
+
// Embedding and reranker models, with their pricing
|
|
630
|
+
const embedders = await client.listEmbeddingModels({ supportsInputMedia: "image" });
|
|
631
|
+
const rerankers = await client.listRerankerModels();
|
|
632
|
+
console.log(embedders.models, embedders.default_model_type, rerankers.models);
|
|
633
|
+
|
|
527
634
|
const alerts = await client.listModelAlerts();
|
|
528
635
|
await client.markModelAlertRead("alert_id");
|
|
529
636
|
await client.markAllModelAlertsRead();
|
|
@@ -569,6 +676,7 @@ Send and receive agent email on your own domain instead of the shared
|
|
|
569
676
|
`agent.seclai.com`. These endpoints require a user-bound credential (an
|
|
570
677
|
account-only API key is refused with 403) and, for mutations, an account owner/admin.
|
|
571
678
|
|
|
679
|
+
<!-- sdksync:check -->
|
|
572
680
|
```ts
|
|
573
681
|
// Current domains, their DNS records, and what your plan allows
|
|
574
682
|
const { domains, can_add_custom, has_custom } = await client.listEmailDomains();
|
|
@@ -622,8 +730,9 @@ await client.submitAiFeedback({ ... });
|
|
|
622
730
|
|
|
623
731
|
## Pagination helper
|
|
624
732
|
|
|
625
|
-
Automatically iterate through all pages:
|
|
733
|
+
Automatically iterate through all pages of a list method:
|
|
626
734
|
|
|
735
|
+
<!-- sdksync:check -->
|
|
627
736
|
```ts
|
|
628
737
|
for await (const source of client.paginate(
|
|
629
738
|
(opts) => client.listSources(opts),
|