@seclai/sdk 1.3.0 → 1.5.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 ADDED
@@ -0,0 +1,206 @@
1
+ # Changelog
2
+
3
+ ## [1.5.0] - 2026-07-27
4
+
5
+ ### Changed
6
+
7
+ - 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
8
+ - 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
9
+ - 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[]`
10
+ - 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
11
+ - 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()`
12
+
13
+ ### Added
14
+
15
+ - 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
16
+ - Add 20 response type exports covering those endpoints, including `AlertResponse`, `AlertDetailResponse`, `AlertConfigResponse`, `ModelAlertResponse`, `ExperimentDetailResponse`, `SearchResponse` and `OkResponse`
17
+ - Add `listEvaluationCriteriaPage()` for the canonical `{data, pagination}` envelope, which the endpoint emits once `apiVersion` is `2026-07-27` or later
18
+ - 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
19
+ - Add `getApiVersion()` and `updateApiVersion()` to read the version a request resolves to and to pin or clear the account's version
20
+ - Add the `ApiVersionResponse` type export
21
+ - Add the `EvaluationCriteriaListResponse` type export
22
+
23
+ ### Fixed
24
+
25
+ - 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
26
+ - 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
27
+ - 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
28
+ - 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
29
+ - Paginate `listModelAlerts()` with the `offset` the endpoint declares instead of `page`, which it does not accept — every page after the first returned page 1
30
+ - 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
31
+ - Request `GET /sources` rather than `GET /sources/`. The trailing-slash form is no longer declared by the API
32
+ - 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
33
+
34
+ ## [1.4.0] - 2026-07-25
35
+
36
+ ### Changed
37
+
38
+ - Sync the bundled OpenAPI spec, adding 22 paths and 22 schemas
39
+ - Extend `listModels()` with `supportsInputMedia` and `supportsOutputMedia` capability filters
40
+
41
+ ### Added
42
+
43
+ - Add `getMe()` returning the authenticated user's account id and organization memberships
44
+ - Add `disableAgent()`, `enableAgent()`, and `getAgentCallers()` to pause and resume an agent across every trigger path
45
+ - Add `setEmailTriggerConfig()` to set the alias, sender allowlist, and inbound-handling flags on an `EMAIL_RECEIVED` trigger
46
+ - Add agent-email opt-out methods `listAgentEmailOptOuts()` and `removeAgentEmailOptOut()`
47
+ - Add inbound sender blocklist methods `listBlockedEmailSenders()`, `blockEmailSender()`, `unblockEmailSender()`, and `setAutoBlockMode()`
48
+ - Add inbound-email observability methods `listInboundEmailRejections()`, `getInboundEmailStatus()`, `cancelQueuedEmailRuns()`, and `resumeInboundEmail()`
49
+ - Add email domain management: `listEmailDomains()`, `addEmailDomain()`, `removeEmailDomain()`, `verifyEmailDomain()`, `setPrimaryEmailDomain()`, `useSharedEmailDomain()`, `sendEmailDomainTestEmail()`, and `getDmarcSummary()`
50
+ - Add `getGenerationTiers()` mapping each media-generation modality and tier to its model and cost
51
+ - Add `searchDocs()` for keyword or semantic search over the Seclai documentation
52
+
53
+ ### Fixed
54
+
55
+ - Return `OrganizationAlertPreferenceResponse` from `updateOrganizationAlertPreference()` instead of `unknown`, so the response fields are reachable without a cast
56
+
57
+ ## [1.3.0] - 2026-06-05
58
+
59
+ ### Changed
60
+
61
+ - Accept `MemoryBankAiAssistantRequest` in `aiAssistantMemoryBank()` instead of the solutions request type ([#9](https://github.com/seclai/seclai-javascript/pull/9))
62
+
63
+ ### Added
64
+
65
+ - Add `getAgentAttachmentReferences()` to read an agent's static attachment-reference contract before staging uploads ([#9](https://github.com/seclai/seclai-javascript/pull/9))
66
+ - Add `downloadAgentRunAttachment()` returning the raw `Response` for a file emitted by a run step ([#9](https://github.com/seclai/seclai-javascript/pull/9))
67
+ - Add `deleteExperiment()` to soft-delete a model playground experiment ([#9](https://github.com/seclai/seclai-javascript/pull/9))
68
+ - Add `InsufficientCreditsResponse` and `InsufficientCreditsDetail` types for HTTP 402 responses ([#9](https://github.com/seclai/seclai-javascript/pull/9))
69
+ - Add `AgentRunToolCallResponse` and `ModalityRateResponse` types ([#9](https://github.com/seclai/seclai-javascript/pull/9))
70
+
71
+ ## [1.2.0] - 2026-05-22
72
+
73
+ ### Added
74
+
75
+ - Add `previewImportAgent()` to dry-run an agent definition import and surface unresolved entity refs ([#8](https://github.com/seclai/seclai-javascript/pull/8))
76
+ - Add agent import types, including `AgentDefinitionImportErrorResponse` with line and column positions into the canonical source echo ([#8](https://github.com/seclai/seclai-javascript/pull/8))
77
+
78
+ ## [1.1.5] - 2026-04-24
79
+
80
+ ### Added
81
+
82
+ - Add `listModels()` and `getModel()` for the model catalog ([#7](https://github.com/seclai/seclai-javascript/pull/7))
83
+ - Add model playground methods `listExperiments()`, `createExperiment()`, `getExperiment()`, and `cancelExperiment()` ([#7](https://github.com/seclai/seclai-javascript/pull/7))
84
+ - Add `SourceIndexMode` and model pricing types ([#7](https://github.com/seclai/seclai-javascript/pull/7))
85
+
86
+ ## [1.1.4] - 2026-04-02
87
+
88
+ ### Added
89
+
90
+ - Add `exportAgent()` returning a portable JSON snapshot of an agent definition ([#6](https://github.com/seclai/seclai-javascript/pull/6))
91
+
92
+ ## [1.1.3] - 2026-03-27
93
+
94
+ ### Changed
95
+
96
+ - Default the SSO domain, client id, and region so a profile only needs `sso_account_id`, and allow overriding each via `SECLAI_SSO_DOMAIN`, `SECLAI_SSO_CLIENT_ID`, and `SECLAI_SSO_REGION` ([#5](https://github.com/seclai/seclai-javascript/pull/5))
97
+ - Make `sso_account_id` optional when loading an SSO profile ([#5](https://github.com/seclai/seclai-javascript/pull/5))
98
+
99
+ ### Added
100
+
101
+ - Export the SSO helpers `loadSsoProfile()`, `readSsoCache()`, `writeSsoCache()`, `deleteSsoCache()`, and `isTokenValid()`, plus the `DEFAULT_SSO_*` constants ([#5](https://github.com/seclai/seclai-javascript/pull/5))
102
+ - Add `GET /me` to the bundled OpenAPI spec; the corresponding `getMe()` client method arrived in 1.4.0 ([#5](https://github.com/seclai/seclai-javascript/pull/5))
103
+
104
+ ## [1.1.2] - 2026-03-26
105
+
106
+ ### Changed
107
+
108
+ - Update the bundled OpenAPI spec's auth descriptions to match the supported auth options ([`6d534c4`](https://github.com/seclai/seclai-javascript/commit/6d534c4))
109
+
110
+ ## [1.1.1] - 2026-03-26
111
+
112
+ ### Added
113
+
114
+ - Add OAuth SSO authentication with `~/.seclai/config` profiles, an on-disk token cache, and automatic refresh ([#4](https://github.com/seclai/seclai-javascript/pull/4))
115
+ - Add an `accountId` option, sent as the `X-Account-Id` header, to switch organization account context ([#4](https://github.com/seclai/seclai-javascript/pull/4))
116
+ - Add an `accessToken` option accepting either a static bearer token or a provider function called per request ([#4](https://github.com/seclai/seclai-javascript/pull/4))
117
+
118
+ ## [1.1.0] - 2026-03-23
119
+
120
+ ### Added
121
+
122
+ - Expand endpoint coverage to knowledge bases, memory banks, sources, source exports, embedding migrations, content, solutions, alerts, governance, evaluations, and the AI assistants ([#3](https://github.com/seclai/seclai-javascript/pull/3))
123
+ - Add `runStreamingAgent()`, an async iterator yielding every SSE event of a run ([#3](https://github.com/seclai/seclai-javascript/pull/3))
124
+ - Add `runAgentAndPoll()` for environments where SSE is impractical ([#3](https://github.com/seclai/seclai-javascript/pull/3))
125
+ - Add `requestRaw()` as a low-level escape hatch returning the raw `Response` ([#3](https://github.com/seclai/seclai-javascript/pull/3))
126
+ - Add `search()` across all resource types in an account ([#3](https://github.com/seclai/seclai-javascript/pull/3))
127
+
128
+ ## [1.0.7] - 2026-01-30
129
+
130
+ ### Added
131
+
132
+ - Add `uploadFileToContent()` to replace existing content with a file upload ([`729298f`](https://github.com/seclai/seclai-javascript/commit/729298f))
133
+ - Add a `metadata` option to the upload methods, sent as a JSON string form field ([`729298f`](https://github.com/seclai/seclai-javascript/commit/729298f))
134
+
135
+ ### Fixed
136
+
137
+ - Export the `SourceFileUploadResponse` and `ContentFileUploadResponse` types ([`36bff73`](https://github.com/seclai/seclai-javascript/commit/36bff73))
138
+
139
+ ## [1.0.6] - 2026-01-27
140
+
141
+ ### Changed
142
+
143
+ - Accept a run id alone in `getAgentRun()` and `deleteAgentRun()`; the leading agent id is now an optional overload ([`fcf6ff9`](https://github.com/seclai/seclai-javascript/commit/fcf6ff9))
144
+
145
+ ## [1.0.5] - 2026-01-27
146
+
147
+ ### Added
148
+
149
+ - Add an `includeStepOutputs` option to `getAgentRun()` ([`795fd21`](https://github.com/seclai/seclai-javascript/commit/795fd21))
150
+
151
+ ## [1.0.4] - 2026-01-27
152
+
153
+ ### Changed
154
+
155
+ - Document the 200 MiB upload limit and the supported MIME types on the upload methods ([`bece917`](https://github.com/seclai/seclai-javascript/commit/bece917))
156
+
157
+ ### Fixed
158
+
159
+ - Point the default base URL at `https://api.seclai.com` instead of `https://seclai.com` ([`bece917`](https://github.com/seclai/seclai-javascript/commit/bece917))
160
+
161
+ ## [1.0.3] - 2026-01-13
162
+
163
+ ### Fixed
164
+
165
+ - Drop the `/api` prefix from request paths so they match the deployed API ([`3d72194`](https://github.com/seclai/seclai-javascript/commit/3d72194))
166
+
167
+ ## [1.0.2] - 2026-01-13
168
+
169
+ ### Added
170
+
171
+ - Add `runStreamingAgentAndWait()` to block until a streaming run completes ([`b55503d`](https://github.com/seclai/seclai-javascript/commit/b55503d))
172
+
173
+ ## [1.0.1] - 2026-01-12
174
+
175
+ ### Added
176
+
177
+ - Add a documentation homepage link to the package metadata ([`3786d9d`](https://github.com/seclai/seclai-javascript/commit/3786d9d))
178
+ - Add a release script that stamps the version into the README ([`3786d9d`](https://github.com/seclai/seclai-javascript/commit/3786d9d))
179
+
180
+ ## [1.0.0] - 2026-01-12
181
+
182
+ _Stable release. No functional changes since 0.0.1._
183
+
184
+ ## [0.0.1] - 2026-01-12
185
+
186
+ _Initial release._
187
+
188
+ [1.5.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.5.0
189
+ [1.4.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.4.0
190
+ [1.3.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.3.0
191
+ [1.2.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.2.0
192
+ [1.1.5]: https://github.com/seclai/seclai-javascript/releases/tag/1.1.5
193
+ [1.1.4]: https://github.com/seclai/seclai-javascript/releases/tag/1.1.4
194
+ [1.1.3]: https://github.com/seclai/seclai-javascript/releases/tag/1.1.3
195
+ [1.1.2]: https://github.com/seclai/seclai-javascript/releases/tag/1.1.2
196
+ [1.1.1]: https://github.com/seclai/seclai-javascript/releases/tag/1.1.1
197
+ [1.1.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.1.0
198
+ [1.0.7]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.7
199
+ [1.0.6]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.6
200
+ [1.0.5]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.5
201
+ [1.0.4]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.4
202
+ [1.0.3]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.3
203
+ [1.0.2]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.2
204
+ [1.0.1]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.1
205
+ [1.0.0]: https://github.com/seclai/seclai-javascript/releases/tag/1.0.0
206
+ [0.0.1]: https://github.com/seclai/seclai-javascript/releases/tag/0.0.1
package/README.md CHANGED
@@ -104,10 +104,77 @@ or set environment variables:
104
104
 
105
105
  Online API documentation (latest):
106
106
 
107
- https://seclai.github.io/seclai-javascript/1.3.0/
107
+ https://seclai.github.io/seclai-javascript/1.5.0/
108
+
109
+ Release history is in [`CHANGELOG.md`](CHANGELOG.md).
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`, `V2026_07_27`, plus
131
+ `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.
108
158
 
109
159
  ## Resources
110
160
 
161
+ ### Identity
162
+
163
+ Discover who the credential belongs to and which organizations it can act for.
164
+ Each organization's `account_id` is what you pass as the client's `accountId`
165
+ option (sent as the `X-Account-Id` header) to target that org context.
166
+
167
+ ```ts
168
+ const me = await client.getMe();
169
+ console.log(me.account_id); // the user's personal account
170
+ for (const org of me.organizations) {
171
+ console.log(org.name, org.account_id);
172
+ }
173
+
174
+ // Act as an organization
175
+ const orgClient = new Seclai({ accountId: me.organizations[0].account_id });
176
+ ```
177
+
111
178
  ### Agents
112
179
 
113
180
  ```ts
@@ -118,6 +185,11 @@ const fetched = await client.getAgent("agent_id");
118
185
  const updated = await client.updateAgent("agent_id", { name: "Renamed" });
119
186
  await client.deleteAgent("agent_id");
120
187
 
188
+ // Pause / resume — a disabled agent stops firing from every trigger path
189
+ const callers = await client.getAgentCallers("agent_id"); // live agents calling this one
190
+ await client.disableAgent("agent_id"); // 409 if any caller above is still live
191
+ await client.enableAgent("agent_id");
192
+
121
193
  // Definition (step workflow)
122
194
  const def = await client.getAgentDefinition("agent_id");
123
195
  await client.updateAgentDefinition("agent_id", { steps: [...], change_id: def.change_id });
@@ -224,6 +296,46 @@ const resp = await client.downloadAgentRunAttachment("run_id", "attachment_id");
224
296
  const blob = await resp.blob(); // raw Response — stream or save the bytes
225
297
  ```
226
298
 
299
+ ### Agent email triggers
300
+
301
+ Configure the inbound address and handling rules on an agent's `EMAIL_RECEIVED`
302
+ trigger. Omitted fields are left unchanged; `null` (or `""` for `alias`) clears them.
303
+
304
+ ```ts
305
+ const config = await client.setEmailTriggerConfig("agent_id", "trigger_id", {
306
+ alias: "support",
307
+ allowed_senders: ["example.com", "ops@partner.com"], // empty/null accepts any sender
308
+ ignore_auto_generated: true, // drop auto-replies/bulk mail to prevent loops
309
+ require_sender_auth: true, // require SPF or DMARC even on an open inbox
310
+ queue_on_quota: false, // park over-rate mail instead of failing it
311
+ });
312
+ console.log(config.email_addresses); // ["support.<accountID>@agent.seclai.com", ...]
313
+ ```
314
+
315
+ ### Agent email governance
316
+
317
+ ```ts
318
+ // Recipients who opted out of this account's agent emails
319
+ const optOuts = await client.listAgentEmailOptOuts({ agentId: "agent_id", limit: 50 });
320
+ await client.removeAgentEmailOptOut("optout_id"); // opt them back in
321
+
322
+ // Blocked inbound senders (owner/admin only)
323
+ const blocked = await client.listBlockedEmailSenders({ limit: 50, offset: 0 });
324
+ await client.blockEmailSender({ sender_email: "spam.example.com", match_type: "domain" });
325
+ await client.unblockEmailSender("blocked_id");
326
+
327
+ // Auto-block on a governance BLOCK: "disabled" | "input" | "input_and_output"
328
+ await client.setAutoBlockMode({ mode: "input_and_output" });
329
+
330
+ // Inbound emails discarded before running an agent
331
+ const rejections = await client.listInboundEmailRejections({ agentId: "agent_id" });
332
+
333
+ // Account-wide overload circuit breaker
334
+ const status = await client.getInboundEmailStatus(); // { paused, queued_backlog }
335
+ await client.cancelQueuedEmailRuns(); // fail all QUEUED (over-quota parked) runs
336
+ await client.resumeInboundEmail(); // one-shot override; re-arms if still overloaded
337
+ ```
338
+
227
339
  ### Agent AI assistant
228
340
 
229
341
  ```ts
@@ -238,7 +350,10 @@ await client.markAgentAiSuggestion("agent_id", "conversation_id", { accepted: tr
238
350
  ### Agent evaluations
239
351
 
240
352
  ```ts
241
- const criteria = await client.listEvaluationCriteria("agent_id");
353
+ const criteria = await client.listEvaluationCriteria("agent_id", { page: 1, limit: 50 });
354
+ // page/limit only take effect with apiVersion "2026-07-27" or later; the legacy
355
+ // response is unpaginated. listEvaluationCriteriaPage() returns the same items
356
+ // plus a `pagination` object when opted in.
242
357
  const created = await client.createEvaluationCriteria("agent_id", { name: "Accuracy", ... });
243
358
  const detail = await client.getEvaluationCriteria("criteria_id");
244
359
  await client.updateEvaluationCriteria("criteria_id", { ... });
@@ -451,6 +566,15 @@ await client.updateOrganizationAlertPreference("org_id", "alert_type", { ... });
451
566
  ### Models
452
567
 
453
568
  ```ts
569
+ // List models, optionally filtered by capability
570
+ const providers = await client.listModels({ supportsToolUse: true });
571
+ const imageModels = await client.listModels({ supportsOutputMedia: "image" });
572
+ const pdfModels = await client.listModels({ supportsInputMedia: "pdf" });
573
+ const model = await client.getModel("model_id");
574
+
575
+ // Media-generation quality tiers (fast/balanced/thorough) and what each resolves to
576
+ const tiers = await client.getGenerationTiers();
577
+
454
578
  const alerts = await client.listModelAlerts();
455
579
  await client.markModelAlertRead("alert_id");
456
580
  await client.markAllModelAlertsRead();
@@ -472,6 +596,61 @@ const results = await client.search({ query: "quarterly report" });
472
596
  const filtered = await client.search({ query: "my agent", entityType: "agent", limit: 5 });
473
597
  ```
474
598
 
599
+ ### Documentation search
600
+
601
+ Search the Seclai docs. Results are global (not account-scoped) and each carries a
602
+ `doc_slug` plus an optional `anchor` for building a
603
+ `https://seclai.com/docs/<doc_slug>[#<anchor>]` link.
604
+
605
+ ```ts
606
+ // Fast title/summary match, no AI cost
607
+ const hits = await client.searchDocs({ query: "email triggers" });
608
+
609
+ // Semantic body match — adds a `highlight` with the best matching sentence
610
+ const semantic = await client.searchDocs({
611
+ query: "how do I stop auto-reply loops",
612
+ mode: "semantic",
613
+ limit: 5,
614
+ });
615
+ ```
616
+
617
+ ### Email domains
618
+
619
+ Send and receive agent email on your own domain instead of the shared
620
+ `agent.seclai.com`. These endpoints require a user-bound credential (an
621
+ account-only API key is refused with 403) and, for mutations, an account owner/admin.
622
+
623
+ <!-- sdksync:check -->
624
+ ```ts
625
+ // Current domains, their DNS records, and what your plan allows
626
+ const { domains, can_add_custom, has_custom } = await client.listEmailDomains();
627
+
628
+ // Add a vanity subdomain (<slug>.seclai.com) or your own custom domain
629
+ const vanity = await client.addEmailDomain({ kind: "vanity", value: "acme" });
630
+ const custom = await client.addEmailDomain({
631
+ kind: "custom",
632
+ value: "agent.mycompany.com",
633
+ delegated: true, // let Seclai manage a dedicated Route53 zone
634
+ });
635
+
636
+ // Publish custom.dns_records at your DNS provider, then check without waiting
637
+ // for the background sweep
638
+ const checked = await client.verifyEmailDomain(custom.id);
639
+
640
+ // Promote a verified domain, or fall back to the shared domain
641
+ await client.setPrimaryEmailDomain(custom.id);
642
+ await client.useSharedEmailDomain(); // keeps the domain configured & verified
643
+
644
+ // Confirm delivery end-to-end (always sends to the account owner only)
645
+ await client.sendEmailDomainTestEmail(custom.id);
646
+
647
+ // DMARC aggregate-report summary
648
+ const dmarc = await client.getDmarcSummary(custom.id, { days: 30, topSources: 10 });
649
+
650
+ // Removing a delegated domain returns a cleanup_note about the registrar NS record
651
+ const { cleanup_note } = await client.removeEmailDomain(custom.id);
652
+ ```
653
+
475
654
  ### Top-level AI assistant
476
655
 
477
656
  ```ts