@soat/sdk 0.22.0 → 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.mjs CHANGED
@@ -1275,25 +1275,15 @@ var Chats = class {
1275
1275
  });
1276
1276
  }
1277
1277
  /**
1278
- * Create a chat completion for a stored chat
1278
+ * Create a chat completion
1279
1279
  *
1280
- * 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`.
1280
+ * OpenAI Chat Completions-compatible endpoint. Mirrors OpenAI's `POST /v1/chat/completions` path so an OpenAI SDK can target it by base URL alone.
1281
1281
  *
1282
- */
1283
- static createChatCompletionForChat(options) {
1284
- return (options.client ?? client).post({
1285
- url: "/api/v1/chats/{chat_id}/completions",
1286
- ...options,
1287
- headers: {
1288
- "Content-Type": "application/json",
1289
- ...options.headers
1290
- }
1291
- });
1292
- }
1293
- /**
1294
- * Create a chat completion (stateless)
1282
+ * 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.
1283
+ *
1284
+ * 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.
1295
1285
  *
1296
- * 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.
1286
+ * Messages may use `document_id` instead of `content` with either target. Chats hold no message history send the full `messages` array every time.
1297
1287
  *
1298
1288
  */
1299
1289
  static createChatCompletion(options) {
@@ -1781,6 +1771,27 @@ var Evaluations = class {
1781
1771
  });
1782
1772
  }
1783
1773
  /**
1774
+ * Curate a dataset item from a generation
1775
+ *
1776
+ * 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.
1777
+ *
1778
+ * 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.
1779
+ *
1780
+ * 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.
1781
+ *
1782
+ * 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.
1783
+ */
1784
+ static createDatasetItemFromGeneration(options) {
1785
+ return (options.client ?? client).post({
1786
+ url: "/api/v1/datasets/{dataset_id}/items/from-generation",
1787
+ ...options,
1788
+ headers: {
1789
+ "Content-Type": "application/json",
1790
+ ...options.headers
1791
+ }
1792
+ });
1793
+ }
1794
+ /**
1784
1795
  * Delete a dataset item
1785
1796
  *
1786
1797
  * Deletes a test case. Results of runs that already scored it stay readable; their `dataset_item_id` becomes null.
@@ -2247,6 +2258,10 @@ var Formations = class {
2247
2258
  *
2248
2259
  * Deletes the formation stack and all its managed resources in reverse dependency order.
2249
2260
  *
2261
+ * 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.
2262
+ *
2263
+ * 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.
2264
+ *
2250
2265
  */
2251
2266
  static deleteFormation(options) {
2252
2267
  return (options.client ?? client).delete({
@@ -2908,7 +2923,7 @@ var Orchestrations = class {
2908
2923
  /**
2909
2924
  * Start an orchestration run
2910
2925
  *
2911
- * 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).
2926
+ * 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.
2912
2927
  */
2913
2928
  static startOrchestrationRun(options) {
2914
2929
  return (options.client ?? client).post({
@@ -3774,7 +3789,7 @@ var Usage = class {
3774
3789
  /**
3775
3790
  * List usage meters
3776
3791
  *
3777
- * 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.
3792
+ * 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.
3778
3793
  *
3779
3794
  */
3780
3795
  static listUsageMeters(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soat/sdk",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "TypeScript SDK for the SOAT API",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",