@soat/sdk 0.22.1 → 0.23.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/dist/index.cjs CHANGED
@@ -1276,25 +1276,15 @@ var Chats = class {
1276
1276
  });
1277
1277
  }
1278
1278
  /**
1279
- * Create a chat completion for a stored chat
1279
+ * Create a chat completion
1280
1280
  *
1281
- * Runs a completion using the AI provider and settings stored in the chat. Pass `stream: true` for SSE streaming. A system message in `messages` overrides the chat's stored system message for this call only. Messages may use `documentId` instead of `content`.
1281
+ * OpenAI Chat Completions-compatible endpoint. Mirrors OpenAI's `POST /v1/chat/completions` path so an OpenAI SDK can target it by base URL alone.
1282
1282
  *
1283
- */
1284
- static createChatCompletionForChat(options) {
1285
- return (options.client ?? client).post({
1286
- url: "/api/v1/chats/{chat_id}/completions",
1287
- ...options,
1288
- headers: {
1289
- "Content-Type": "application/json",
1290
- ...options.headers
1291
- }
1292
- });
1293
- }
1294
- /**
1295
- * Create a chat completion (stateless)
1283
+ * Names exactly one target. With `ai_provider_id` the completion is stateless: the provider's secret is decrypted and the appropriate Vercel AI SDK provider is called, with no server-side model fallback. With `chat_id` the stored chat supplies the provider (or the project's `default_model_route_id`), model and instructions.
1284
+ *
1285
+ * System content travels only in `instructions` — a `role: "system"` entry in `messages` is refused with `400 SYSTEM_MESSAGE_NOT_ALLOWED`. With `chat_id`, a request `instructions` replaces the chat's stored one for this call only; the stored value applies when the request carries none, and the two are never merged.
1296
1286
  *
1297
- * OpenAI Chat Completions-compatible endpoint. Mirrors OpenAI's `POST /v1/chat/completions` path so an OpenAI SDK can target it by base URL alone. Resolves the AI provider from `ai_provider_id`, decrypts its secret, and calls the appropriate Vercel AI SDK provider. `ai_provider_id` is required — there is no server-side model fallback.
1287
+ * Messages may use `document_id` instead of `content` with either target. Chats hold no message history send the full `messages` array every time.
1298
1288
  *
1299
1289
  */
1300
1290
  static createChatCompletion(options) {
@@ -1782,6 +1772,27 @@ var Evaluations = class {
1782
1772
  });
1783
1773
  }
1784
1774
  /**
1775
+ * Curate a dataset item from a generation
1776
+ *
1777
+ * Promotes a real, completed generation into a test case: its input messages become the item's `input`, and its own answer becomes `expected_output` unless you supply one. Use it to build an evaluation set out of production traffic rather than hand-authoring fixtures.
1778
+ *
1779
+ * The item is a **copy**, not a view. It keeps working after the source generation's content is purged, and `source_generation_id` goes null if that generation is deleted — a purge can never quietly stop a suite from being runnable.
1780
+ *
1781
+ * Requires both `evaluations:CreateDataset` and `generations:GetGeneration`: the call copies content out of a generation, so a principal that may not read that generation may not curate it either.
1782
+ *
1783
+ * Only a **completed** generation can be promoted (`409 GENERATION_NOT_COMPLETED`), and only while its content is still available: an agent or project running with `trace_content_mode: none` never stored the input, and a purged or expired generation no longer has it (`409 GENERATION_CONTENT_UNAVAILABLE`). Generations that predate input recording answer the same way.
1784
+ */
1785
+ static createDatasetItemFromGeneration(options) {
1786
+ return (options.client ?? client).post({
1787
+ url: "/api/v1/datasets/{dataset_id}/items/from-generation",
1788
+ ...options,
1789
+ headers: {
1790
+ "Content-Type": "application/json",
1791
+ ...options.headers
1792
+ }
1793
+ });
1794
+ }
1795
+ /**
1785
1796
  * Delete a dataset item
1786
1797
  *
1787
1798
  * Deletes a test case. Results of runs that already scored it stay readable; their `dataset_item_id` becomes null.
@@ -2248,6 +2259,10 @@ var Formations = class {
2248
2259
  *
2249
2260
  * Deletes the formation stack and all its managed resources in reverse dependency order.
2250
2261
  *
2262
+ * A resource the platform refuses to delete on its own — most often an agent that has generation or trace history — fails the teardown with `409 FORMATION_DELETE_FAILED`, naming every blocking resource in `error.meta.failures`. Resolve the blockers (for an agent, `DELETE /api/v1/agents/{agent_id}?force=true` also removes its generations and traces, and `deletion_policy: retain` exempts it from teardown entirely) and delete the formation again.
2263
+ *
2264
+ * A refusal the platform can foresee is found by a pre-flight, before the first delete: nothing is removed, and the formation stays `active` and intact for the retry. An unforeseeable error surfaces mid-teardown instead, where resources deleted before the blocker stay deleted and the formation is left in `delete_failed`. The error message states which happened.
2265
+ *
2251
2266
  */
2252
2267
  static deleteFormation(options) {
2253
2268
  return (options.client ?? client).delete({
@@ -2909,7 +2924,7 @@ var Orchestrations = class {
2909
2924
  /**
2910
2925
  * Start an orchestration run
2911
2926
  *
2912
- * Creates a new run for the orchestration named by orchestration_id. By default the run executes durably in the background: the response returns immediately with status "queued" (a worker then claims it and moves it to "running") and progress is observed via get-orchestration-run or run lifecycle webhook events (orchestration_runs.started/awaiting_input/succeeded/failed). Delay and poll waits park the run as "sleeping" and are woken by a background scheduler, surviving restarts. Pass wait=true to block until the run reaches a terminal or awaiting_input state (the legacy synchronous behaviour).
2927
+ * Creates a new run for the orchestration named by orchestration_id. By default the run executes durably in the background: the response returns immediately with status "queued" (a worker then claims it and moves it to "running") and progress is observed via get-orchestration-run or run lifecycle webhook events (orchestration_runs.started/awaiting_input/succeeded/failed). Delay and poll waits park the run as "sleeping" and are woken by a background scheduler, surviving restarts. Pass wait=true to block until the run reaches a terminal or awaiting_input state.
2913
2928
  */
2914
2929
  static startOrchestrationRun(options) {
2915
2930
  return (options.client ?? client).post({
@@ -3775,7 +3790,7 @@ var Usage = class {
3775
3790
  /**
3776
3791
  * List usage meters
3777
3792
  *
3778
- * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent, generation, trace, actor, or session. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
3793
+ * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent, generation, trace, actor, session, or `source`. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
3779
3794
  *
3780
3795
  */
3781
3796
  static listUsageMeters(options) {