@seclai/sdk 1.5.0 → 1.6.1
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 +40 -0
- package/README.md +94 -19
- package/dist/index.cjs +417 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1035 -95
- package/dist/index.d.ts +1035 -95
- package/dist/index.js +417 -125
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.1] - 2026-10-05
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Throw `SeclaiError` from the list methods of version-gated endpoints when a successful response is not a list — an error-shaped object, text, or an empty body. Most of them handed that body back as if it were the list; the cloud-drive listings returned `[]`, which reads as "no results". An explicit `data: null` is still an empty list
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Return the declared type from every list method once `apiVersion` is `2026-07-27` or later. The API then answers list endpoints with `{data, pagination}`, and the methods that cast the body handed that object back as their array or keyed type: `getAgentCallers()`, `listModels()`, `listInboundEmailRejections()`, `listGovernanceAiConversations()` and `listSolutionConversations()` returned an object instead of an array, and `listAgentEmailOptOuts()`, `listBlockedEmailSenders()`, `setAutoBlockMode()`, `listAlertConfigs()`, `listOrganizationAlertPreferences()`, `listEmailDomains()`, `listKnowledgeBases()`, `listMemoryBanks()`, `getGenerationTiers()`, `listModelAlerts()` and `listExperiments()` lost their `items`, `configs`, `preferences`, `domains`, `knowledge_bases`, `memory_banks`, `tiers`, `alerts` or `experiments` key. The items are now where each type declares them on both shapes, and `data` and `pagination` stay on the object types, which declare them as optional fields ([#14](https://github.com/seclai/seclai-javascript/issues/14))
|
|
12
|
+
- Fill the flat `total`, `page` and `limit` from `pagination` when `apiVersion` is `2026-07-27` or later, on `listEvaluationResults()`, `listAgentEvaluationResults()`, `listRunEvaluationResults()`, `listEvaluationRuns()`, `listCompatibleRuns()`, `listKnowledgeBases()`, `listMemoryBanks()` and the `total` of the keyed listings above. They were `undefined` although several of those types declare them required ([#14](https://github.com/seclai/seclai-javascript/issues/14))
|
|
13
|
+
- Return an array from `listMemoryBankTemplates()` and `getAgentsUsingMemoryBank()` when `apiVersion` is `2026-07-27` or later, as they do by default. Both are typed `unknown` and returned the `{data, pagination}` object; code that worked around it by reading `.data` must now read the array itself ([#14](https://github.com/seclai/seclai-javascript/issues/14))
|
|
14
|
+
- Reject an unknown `Seclai-Version` passed in the per-request `headers` of `request()` or `requestRaw()` with `SeclaiConfigurationError`, in any letter case. It was sent unchecked, bypassing the guard on `apiVersion`; a caller who relied on that to send a version this release does not know must now set `allowUnknownApiVersion` ([#15](https://github.com/seclai/seclai-javascript/issues/15))
|
|
15
|
+
- Reject an empty `Seclai-Version` in `defaultHeaders` or per-request `headers`. It passed the guard and replaced the configured version with an empty header ([#15](https://github.com/seclai/seclai-javascript/issues/15))
|
|
16
|
+
- Send exactly one value per header on the plain, download, upload and streaming paths. A default or per-request header that differed only in case from another layer's was sent beside it and joined by `fetch`: a default `X-API-Key` went out as `other, real`, a default `Authorization` beside the bearer token, and a per-request `Content-Type` could not replace the JSON one. Which layer wins is unchanged ([#15](https://github.com/seclai/seclai-javascript/issues/15))
|
|
17
|
+
- Keep the multipart boundary on uploads when `defaultHeaders` sets a content type in any case other than `content-type` or `Content-Type` ([#15](https://github.com/seclai/seclai-javascript/issues/15))
|
|
18
|
+
- Correct the README's API-versioning section: `2026-08-03` also rejects a non-zero `max_age_days` on `updateMemoryBank()`; `2026-09-30` breaks code that parses a run's or step's `output` as a JSON manifest; and `SeclaiApiVersion.Latest` moves with each SDK release — `1.6.0` moved it across that `2026-09-30` change — so pin a dated constant to keep behaviour fixed
|
|
19
|
+
|
|
20
|
+
## [1.6.0] - 2026-10-04
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- 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`
|
|
25
|
+
- 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
|
|
26
|
+
- 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
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- 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
|
|
31
|
+
- 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
|
|
32
|
+
- Add `listEmbeddingModels()` and `listRerankerModels()`. The list is under `models` on every API version, with the defaults and pricing beside it
|
|
33
|
+
- 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
|
|
34
|
+
- Add the type exports for those endpoints, including `CloudDriveResponse`, `CloudDriveProviderResponse`, `CloudDriveRejectionResponse`, `CloudDriveUpdateRequest`, `AgentUsingCloudDriveResponse`, `SourceContentStatusResponse`, `SourceContentStatusListResponse`, `ListSourceContentsOptions`, `EmbeddingModelListResponse` and `RerankerModelListResponse`, plus `AgentRunFileResponse` and `EffortOptionsResponse`
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- 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`
|
|
39
|
+
- Correct the `Seclai` class example, which destructured an `items` property `listAgents()` does not return
|
|
40
|
+
|
|
3
41
|
## [1.5.0] - 2026-07-27
|
|
4
42
|
|
|
5
43
|
### Changed
|
|
@@ -185,6 +223,8 @@ _Stable release. No functional changes since 0.0.1._
|
|
|
185
223
|
|
|
186
224
|
_Initial release._
|
|
187
225
|
|
|
226
|
+
[1.6.1]: https://github.com/seclai/seclai-javascript/releases/tag/1.6.1
|
|
227
|
+
[1.6.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.6.0
|
|
188
228
|
[1.5.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.5.0
|
|
189
229
|
[1.4.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.4.0
|
|
190
230
|
[1.3.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.3.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.6.1/
|
|
108
108
|
|
|
109
109
|
Release history is in [`CHANGELOG.md`](CHANGELOG.md).
|
|
110
110
|
|
|
@@ -127,12 +127,14 @@ 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
|
|
131
|
-
`Default` and `Latest`), imported from `@seclai/sdk`. A version this release was
|
|
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
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.
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
The same check applies to a `Seclai-Version` set through `defaultHeaders` or the
|
|
135
|
+
per-request `headers` of `request()` / `requestRaw()`, in any letter case, and an
|
|
136
|
+
empty value is rejected. Upgrade the package to adopt a new version, or set
|
|
137
|
+
`allowUnknownApiVersion` if you have to move first and accept that risk.
|
|
136
138
|
|
|
137
139
|
The guard only covers the header. An account pinned server-side can still be
|
|
138
140
|
newer than this release — `getApiVersion()` reports the `effective_version` the
|
|
@@ -140,21 +142,54 @@ request resolved to, and comparing it against `SeclaiApiVersion.Latest` is how
|
|
|
140
142
|
you detect the gap.
|
|
141
143
|
|
|
142
144
|
**What `2026-07-27` changes.** Undeclared query parameters become a 422 instead
|
|
143
|
-
of being ignored, and list
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
of being ignored, and every list endpoint that answered with a bare array or
|
|
146
|
+
under a per-resource key moves to the canonical `{data, pagination}` envelope.
|
|
147
|
+
The methods for those endpoints return their declared type on either shape, so
|
|
148
|
+
code written against the default still reads the result after you opt in. Four
|
|
149
|
+
of them return fewer rows once you do, covered below the table:
|
|
146
150
|
|
|
147
|
-
|
|
|
151
|
+
| Declared return | Methods | From 2026-07-27 |
|
|
148
152
|
| --- | --- | --- |
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
| An array | `listEvaluationCriteria()`, `getAgentCallers()`, `listInboundEmailRejections()`, `listGovernanceAiConversations()`, `listSolutionConversations()`, `listModels()`, `listMemoryBankTemplates()`, `getAgentsUsingMemoryBank()`, `listCloudDriveProviders()`, `listCloudDrives()`, `getAgentsUsingCloudDrive()`, `listCloudDriveRejections()` | Still the array of items; the page metadata is not returned |
|
|
154
|
+
| `data`, bare array by default | `listEvaluationCriteriaPage()`, `listRunEvaluationResults()` | `data`, plus `pagination` |
|
|
155
|
+
| `data` with flat `total`/`page`/`limit` | `listEvaluationResults()`, `listAgentEvaluationResults()`, `listEvaluationRuns()`, `listCompatibleRuns()` | Unchanged, plus `pagination` |
|
|
156
|
+
| A per-resource key | `listAgentEmailOptOuts()` and `listBlockedEmailSenders()` / `setAutoBlockMode()` (`items`), `listAlertConfigs()` (`configs`), `listOrganizationAlertPreferences()` (`preferences`), `listEmailDomains()` (`domains`), `listKnowledgeBases()` (`knowledge_bases`), `listMemoryBanks()` (`memory_banks`), `getGenerationTiers()` (`tiers`), `listModelAlerts()` (`alerts`), `listExperiments()` (`experiments`), `listEmbeddingModels()` and `listRerankerModels()` (`models`) | The same key and any flat `total`/`page`/`limit`, plus `data` and `pagination` |
|
|
157
|
+
|
|
158
|
+
Where a type declares flat `total`, `page` or `limit`, the client fills them
|
|
159
|
+
from `pagination` after you opt in. `listRunEvaluationResults()` has no counters
|
|
160
|
+
on its default bare array, and gains them with `pagination`. Fields that sit
|
|
161
|
+
beside a list, such as `auto_block_mode` or the email-domain plan capabilities,
|
|
162
|
+
are present on both shapes.
|
|
163
|
+
|
|
164
|
+
Opting in also turns paging on for endpoints that returned everything by
|
|
165
|
+
default, so the same call can return fewer rows:
|
|
166
|
+
|
|
167
|
+
- `listEvaluationCriteria()` and `listRunEvaluationResults()` return every item
|
|
168
|
+
by default and one page (20 unless you pass `limit`) after you opt in. The
|
|
169
|
+
array from `listEvaluationCriteria()` carries no sign of that; use
|
|
170
|
+
`listEvaluationCriteriaPage()` to see `pagination`.
|
|
171
|
+
- `listAlertConfigs()` ignores `page` and `limit` by default and returns every
|
|
172
|
+
config; after you opt in it returns one page.
|
|
173
|
+
- `setAutoBlockMode()` reports the account's full `total` by default, and the
|
|
174
|
+
number of rows it returned after you opt in.
|
|
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:
|
|
179
|
+
|
|
180
|
+
| Version | What it changes |
|
|
181
|
+
| --- | --- |
|
|
182
|
+
| `2026-08-03` | `createMemoryBank()` and `updateMemoryBank()` reject a non-zero `max_age_days` with a 400, and a memory bank's `max_age_days` reads as `null`. On create, an omitted `retention_days` resolves per bank type instead of to 30 |
|
|
183
|
+
| `2026-08-21` | `createSource()` rejects an embedding dimension its embedder does not support with a 400 — `listEmbeddingModels()` reports the supported ones |
|
|
184
|
+
| `2026-09-28` | Agent-definition writes use the current file-list grammar: an omitted `attachments` keeps the stored list and `[]` means no files |
|
|
185
|
+
| `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
|
+
| `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 |
|
|
187
|
+
|
|
188
|
+
**`Latest` moves with the SDK.** `SeclaiApiVersion.Latest` is the newest version
|
|
189
|
+
the installed release knows, so upgrading the package can opt a client that
|
|
190
|
+
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.
|
|
158
193
|
|
|
159
194
|
## Resources
|
|
160
195
|
|
|
@@ -427,6 +462,40 @@ await client.updateSource("source_id", { name: "Renamed" });
|
|
|
427
462
|
await client.deleteSource("source_id");
|
|
428
463
|
```
|
|
429
464
|
|
|
465
|
+
Indexing status of a source's content, keyed by the `content_version_id` the
|
|
466
|
+
upload methods return:
|
|
467
|
+
|
|
468
|
+
<!-- sdksync:check -->
|
|
469
|
+
```ts
|
|
470
|
+
const failed = await client.listSourceContents("source_id", { status: "failed" });
|
|
471
|
+
const batch = await client.listSourceContents("source_id", {
|
|
472
|
+
contentVersionIds: ["cv_1", "cv_2"],
|
|
473
|
+
});
|
|
474
|
+
console.log(batch.pagination.total, failed.data.map((item) => item.error));
|
|
475
|
+
|
|
476
|
+
const one = await client.getSourceContentStatus("source_id", "cv_1");
|
|
477
|
+
console.log(one.content_status);
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Cloud drives
|
|
481
|
+
|
|
482
|
+
<!-- sdksync:check -->
|
|
483
|
+
```ts
|
|
484
|
+
const providers = await client.listCloudDriveProviders();
|
|
485
|
+
const drives = await client.listCloudDrives();
|
|
486
|
+
const drive = await client.getCloudDrive(drives[0].id);
|
|
487
|
+
await client.updateCloudDrive(drive.id, { name: "Contracts" });
|
|
488
|
+
|
|
489
|
+
// Which agents depend on it, and which files it skipped and why
|
|
490
|
+
const agents = await client.getAgentsUsingCloudDrive(drive.id);
|
|
491
|
+
const skipped = await client.listCloudDriveRejections(drive.id, { limit: 20 });
|
|
492
|
+
console.log(providers.length, agents.length, skipped.map((r) => r.reason));
|
|
493
|
+
|
|
494
|
+
const disconnected = await client.disconnectCloudDrive(drive.id); // keeps the connection
|
|
495
|
+
console.log(disconnected.connected);
|
|
496
|
+
await client.deleteCloudDrive(drive.id);
|
|
497
|
+
```
|
|
498
|
+
|
|
430
499
|
### File uploads
|
|
431
500
|
|
|
432
501
|
Upload a file to a source (max 200 MiB). The SDK infers MIME type from the file extension when `mimeType` is not provided.
|
|
@@ -575,6 +644,11 @@ const model = await client.getModel("model_id");
|
|
|
575
644
|
// Media-generation quality tiers (fast/balanced/thorough) and what each resolves to
|
|
576
645
|
const tiers = await client.getGenerationTiers();
|
|
577
646
|
|
|
647
|
+
// Embedding and reranker models, with their pricing
|
|
648
|
+
const embedders = await client.listEmbeddingModels({ supportsInputMedia: "image" });
|
|
649
|
+
const rerankers = await client.listRerankerModels();
|
|
650
|
+
console.log(embedders.models, embedders.default_model_type, rerankers.models);
|
|
651
|
+
|
|
578
652
|
const alerts = await client.listModelAlerts();
|
|
579
653
|
await client.markModelAlertRead("alert_id");
|
|
580
654
|
await client.markAllModelAlertsRead();
|
|
@@ -674,8 +748,9 @@ await client.submitAiFeedback({ ... });
|
|
|
674
748
|
|
|
675
749
|
## Pagination helper
|
|
676
750
|
|
|
677
|
-
Automatically iterate through all pages:
|
|
751
|
+
Automatically iterate through all pages of a list method:
|
|
678
752
|
|
|
753
|
+
<!-- sdksync:check -->
|
|
679
754
|
```ts
|
|
680
755
|
for await (const source of client.paginate(
|
|
681
756
|
(opts) => client.listSources(opts),
|