@seclai/sdk 1.1.5 → 1.3.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/README.md +42 -1
- package/dist/index.cjs +64 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +567 -25
- package/dist/index.d.ts +567 -25
- package/dist/index.js +64 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.3.0/
|
|
108
108
|
|
|
109
109
|
## Resources
|
|
110
110
|
|
|
@@ -121,6 +121,25 @@ await client.deleteAgent("agent_id");
|
|
|
121
121
|
// Definition (step workflow)
|
|
122
122
|
const def = await client.getAgentDefinition("agent_id");
|
|
123
123
|
await client.updateAgentDefinition("agent_id", { steps: [...], change_id: def.change_id });
|
|
124
|
+
|
|
125
|
+
// Export / import an agent
|
|
126
|
+
const exported = await client.exportAgent("agent_id");
|
|
127
|
+
|
|
128
|
+
// Validate the payload first to surface unresolved entity refs in this account
|
|
129
|
+
const preview = await client.previewImportAgent({ agent_definition: exported });
|
|
130
|
+
const unresolved = (preview.unresolved_refs ?? []) as Array<{ ref_id: string }>;
|
|
131
|
+
const entity_remap = Object.fromEntries(
|
|
132
|
+
unresolved.map((ref) => [ref.ref_id, /* picked target uuid */ ""]),
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
// Commit — `entity_remap` substitutes workflow refs before save
|
|
136
|
+
const imported = await client.createAgent({
|
|
137
|
+
name: "Imported",
|
|
138
|
+
trigger_type: "dynamic_input",
|
|
139
|
+
agent_definition: exported,
|
|
140
|
+
entity_remap,
|
|
141
|
+
});
|
|
142
|
+
// `imported.import_warnings` lists any items that couldn't be applied.
|
|
124
143
|
```
|
|
125
144
|
|
|
126
145
|
### Agent runs
|
|
@@ -183,6 +202,12 @@ const result = await client.runAgentAndPoll(
|
|
|
183
202
|
### Agent input uploads
|
|
184
203
|
|
|
185
204
|
```ts
|
|
205
|
+
// Discover which files (if any) the agent expects before staging uploads
|
|
206
|
+
const refs = await client.getAgentAttachmentReferences("agent_id");
|
|
207
|
+
if (refs.requires_uploads) {
|
|
208
|
+
// refs.agent lists the exact_names / indexes_max / patterns a run batch must satisfy
|
|
209
|
+
}
|
|
210
|
+
|
|
186
211
|
const upload = await client.uploadAgentInput("agent_id", {
|
|
187
212
|
file: new Uint8Array([...]),
|
|
188
213
|
fileName: "input.pdf",
|
|
@@ -190,6 +215,15 @@ const upload = await client.uploadAgentInput("agent_id", {
|
|
|
190
215
|
const status = await client.getAgentInputUploadStatus("agent_id", upload.upload_id);
|
|
191
216
|
```
|
|
192
217
|
|
|
218
|
+
### Agent run attachments
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
// Download a file emitted by a step in an agent run. The attachment_id is the
|
|
222
|
+
// URL-safe-base64 storage_key surfaced in run output manifests / webhooks.
|
|
223
|
+
const resp = await client.downloadAgentRunAttachment("run_id", "attachment_id");
|
|
224
|
+
const blob = await resp.blob(); // raw Response — stream or save the bytes
|
|
225
|
+
```
|
|
226
|
+
|
|
193
227
|
### Agent AI assistant
|
|
194
228
|
|
|
195
229
|
```ts
|
|
@@ -422,6 +456,13 @@ await client.markModelAlertRead("alert_id");
|
|
|
422
456
|
await client.markAllModelAlertsRead();
|
|
423
457
|
const unread = await client.getUnreadModelAlertCount();
|
|
424
458
|
const recs = await client.getModelRecommendations("model_id");
|
|
459
|
+
|
|
460
|
+
// Model playground experiments
|
|
461
|
+
const experiment = await client.createExperiment({ model_ids: ["model_id"], prompt: "..." });
|
|
462
|
+
const experiments = await client.listExperiments();
|
|
463
|
+
const detail = await client.getExperiment("experiment_id");
|
|
464
|
+
await client.cancelExperiment("experiment_id");
|
|
465
|
+
await client.deleteExperiment("experiment_id"); // soft-delete, preserves audit history
|
|
425
466
|
```
|
|
426
467
|
|
|
427
468
|
### Search
|
package/dist/index.cjs
CHANGED
|
@@ -797,7 +797,7 @@ var Seclai = class {
|
|
|
797
797
|
await this.request("DELETE", `/agents/${agentId}`);
|
|
798
798
|
}
|
|
799
799
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
800
|
-
// Agent Export
|
|
800
|
+
// Agent Export / Import
|
|
801
801
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
802
802
|
/**
|
|
803
803
|
* Export an agent definition as a portable JSON snapshot.
|
|
@@ -811,6 +811,27 @@ var Seclai = class {
|
|
|
811
811
|
query: { download }
|
|
812
812
|
});
|
|
813
813
|
}
|
|
814
|
+
/**
|
|
815
|
+
* Validate an `agent_definition` payload (same shape as {@link exportAgent})
|
|
816
|
+
* without creating or modifying any agent.
|
|
817
|
+
*
|
|
818
|
+
* Use this before {@link createAgent} or {@link updateAgent} with an
|
|
819
|
+
* `agent_definition` to surface `unresolved_refs` — workflow references to
|
|
820
|
+
* knowledge bases, memory banks, source connections, or sub-agents that
|
|
821
|
+
* don't exist in the target account. Pass the returned ids back in
|
|
822
|
+
* `entity_remap` on the commit call to substitute them.
|
|
823
|
+
*
|
|
824
|
+
* @param body - The preview payload (`{ agent_definition: ... }`).
|
|
825
|
+
* @returns Summary of the validated payload (step counts, schedules,
|
|
826
|
+
* alert configs, evaluation criteria, governance policies, and any
|
|
827
|
+
* `unresolved_refs`).
|
|
828
|
+
* @throws {SeclaiAPIValidationError} On HTTP 422 — the body is an
|
|
829
|
+
* {@link AgentDefinitionImportErrorResponse} with 1-indexed
|
|
830
|
+
* line/column-anchored errors against a canonical `source` echo.
|
|
831
|
+
*/
|
|
832
|
+
async previewImportAgent(body) {
|
|
833
|
+
return await this.request("POST", "/agents/preview-import", { json: body });
|
|
834
|
+
}
|
|
814
835
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
815
836
|
// Agent Definitions
|
|
816
837
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -1190,6 +1211,37 @@ var Seclai = class {
|
|
|
1190
1211
|
async getAgentInputUploadStatus(agentId, uploadId) {
|
|
1191
1212
|
return await this.request("GET", `/agents/${agentId}/input-uploads/${uploadId}`);
|
|
1192
1213
|
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Get the static attachment-reference contract for an agent — what files (if
|
|
1216
|
+
* any) its definition expects on a run.
|
|
1217
|
+
*
|
|
1218
|
+
* Call this before staging uploads to learn whether the agent accepts files
|
|
1219
|
+
* at all (`requires_uploads`) and which specific filenames, indexes, or glob
|
|
1220
|
+
* patterns its templates reference. A run-time upload batch that doesn't
|
|
1221
|
+
* satisfy every declared selector is rejected with HTTP 400.
|
|
1222
|
+
*
|
|
1223
|
+
* @param agentId - Agent identifier.
|
|
1224
|
+
* @returns The agent's attachment-reference contract.
|
|
1225
|
+
*/
|
|
1226
|
+
async getAgentAttachmentReferences(agentId) {
|
|
1227
|
+
return await this.request("GET", `/agents/${agentId}/attachment-references`);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Download a file attachment emitted by a step in an agent run.
|
|
1231
|
+
*
|
|
1232
|
+
* Returns the raw `Response` so you can stream or save the binary data.
|
|
1233
|
+
*
|
|
1234
|
+
* @param runId - Run identifier.
|
|
1235
|
+
* @param attachmentId - URL-safe-base64-encoded `storage_key` of the attachment
|
|
1236
|
+
* (as surfaced in run output manifests and webhook/email payloads).
|
|
1237
|
+
* @param opts - Optional `downloadName` filename hint for the download disposition.
|
|
1238
|
+
* @returns Raw response with the attachment bytes.
|
|
1239
|
+
*/
|
|
1240
|
+
async downloadAgentRunAttachment(runId, attachmentId, opts = {}) {
|
|
1241
|
+
return await this.requestRaw("GET", `/v2/agent-runs/${runId}/attachments/${attachmentId}`, {
|
|
1242
|
+
query: { download_name: opts.downloadName }
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1193
1245
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
1194
1246
|
// Agent AI Assistant (Steps Generation)
|
|
1195
1247
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -2229,6 +2281,17 @@ var Seclai = class {
|
|
|
2229
2281
|
async cancelExperiment(experimentId) {
|
|
2230
2282
|
return await this.request("POST", `/models/playground/experiments/${experimentId}/cancel`);
|
|
2231
2283
|
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Soft-delete a model playground experiment.
|
|
2286
|
+
*
|
|
2287
|
+
* Removes the experiment from list/detail views while preserving audit
|
|
2288
|
+
* history. Returns HTTP 204 with no body.
|
|
2289
|
+
*
|
|
2290
|
+
* @param experimentId - Experiment identifier.
|
|
2291
|
+
*/
|
|
2292
|
+
async deleteExperiment(experimentId) {
|
|
2293
|
+
await this.request("DELETE", `/models/playground/experiments/${experimentId}`);
|
|
2294
|
+
}
|
|
2232
2295
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2233
2296
|
// Search
|
|
2234
2297
|
// ═══════════════════════════════════════════════════════════════════════════
|