@seclai/sdk 1.1.4 → 1.2.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 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.1.4/
107
+ https://seclai.github.io/seclai-javascript/1.2.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
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
  // ═══════════════════════════════════════════════════════════════════════════
@@ -2174,6 +2195,61 @@ var Seclai = class {
2174
2195
  async getModelRecommendations(modelId) {
2175
2196
  return await this.request("GET", `/models/${modelId}/recommendations`);
2176
2197
  }
2198
+ /**
2199
+ * List all enabled LLM models grouped by provider.
2200
+ *
2201
+ * @param opts - Optional filters.
2202
+ */
2203
+ async listModels(opts = {}) {
2204
+ return await this.request("GET", "/models", {
2205
+ query: { provider: opts.provider, supports_tool_use: opts.supportsToolUse, supports_thinking: opts.supportsThinking }
2206
+ });
2207
+ }
2208
+ /**
2209
+ * Get full details for a specific model.
2210
+ *
2211
+ * @param modelId - Model identifier.
2212
+ */
2213
+ async getModel(modelId) {
2214
+ return await this.request("GET", `/models/${modelId}/details`);
2215
+ }
2216
+ // ═══════════════════════════════════════════════════════════════════════════
2217
+ // Model Playground Experiments
2218
+ // ═══════════════════════════════════════════════════════════════════════════
2219
+ /**
2220
+ * List model playground experiments.
2221
+ *
2222
+ * @param opts - Optional filters and pagination.
2223
+ */
2224
+ async listExperiments(opts = {}) {
2225
+ return await this.request("GET", "/models/playground/experiments", {
2226
+ query: { days: opts.days, start_date: opts.startDate, end_date: opts.endDate, limit: opts.limit, offset: opts.offset }
2227
+ });
2228
+ }
2229
+ /**
2230
+ * Create a model playground experiment.
2231
+ *
2232
+ * @param body - Experiment configuration.
2233
+ */
2234
+ async createExperiment(body) {
2235
+ return await this.request("POST", "/models/playground/experiments", { json: body });
2236
+ }
2237
+ /**
2238
+ * Get a model playground experiment by ID.
2239
+ *
2240
+ * @param experimentId - Experiment identifier.
2241
+ */
2242
+ async getExperiment(experimentId) {
2243
+ return await this.request("GET", `/models/playground/experiments/${experimentId}`);
2244
+ }
2245
+ /**
2246
+ * Cancel a running model playground experiment.
2247
+ *
2248
+ * @param experimentId - Experiment identifier.
2249
+ */
2250
+ async cancelExperiment(experimentId) {
2251
+ return await this.request("POST", `/models/playground/experiments/${experimentId}/cancel`);
2252
+ }
2177
2253
  // ═══════════════════════════════════════════════════════════════════════════
2178
2254
  // Search
2179
2255
  // ═══════════════════════════════════════════════════════════════════════════