@soat/sdk 0.20.5 → 0.22.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
@@ -825,7 +825,7 @@ var Agents = class {
825
825
  /**
826
826
  * Run an agent generation
827
827
  *
828
- * Sends messages to the agent, resolves its tools, and runs the AI model loop. Supports streaming via `stream: true`. Client tools pause the generation and return `requires_action`.
828
+ * Sends messages to the agent, resolves its tools, and runs the AI model loop. Background by default: returns `202 Accepted` with a `generation_id` to poll via `GET /api/v1/generations/{generation_id}`. Pass `?wait=true` to block and receive the result inline, where client tools pause the generation and return `requires_action`. Streaming (`stream: true`) implies waiting.
829
829
  *
830
830
  */
831
831
  static createAgentGeneration(options) {
@@ -923,6 +923,8 @@ var AgentVersions = class {
923
923
  *
924
924
  * Makes the canary version's config the agent's live config and clears the release. The canary is pinned by version, so an edit that landed mid-rollout is not promoted in its place — it stays an unreleased draft in the version history.
925
925
  *
926
+ * When the release carries a `promotion_gate`, the eval it names must have a run that finished `completed` with `passed: true` **and** was pinned to the canary version (`agent_version`); otherwise the call is a `409` and the rollout is left running untouched. The run that cleared the gate is recorded as `eval_run_id` on the version that goes live.
927
+ *
926
928
  */
927
929
  static promoteAgentRelease(options) {
928
930
  return (options.client ?? client).post({
@@ -975,7 +977,7 @@ var AiProviders = class {
975
977
  *
976
978
  * Deletes an AI provider configuration.
977
979
  *
978
- * Live references — chats, agents, discussions, and model routes whose targets name this provider — always block deletion with `409 AI_PROVIDER_HAS_DEPENDENTS`; `force` does not override them, so delete or repoint those resources first. Soft dependents — price overrides, usage/generation records, and discussion participants — also block with `409` unless `force=true`, which deletes the provider's price overrides and unlinks (nulls) its usage and participant history, preserving those rows. The `409` body's `error.meta` reports the counts, a sample of offending IDs, and a `forcible` flag that is `true` when a `force=true` retry would succeed.
980
+ * Live references — chats, agents, and model routes whose targets name this provider — always block deletion with `409 AI_PROVIDER_HAS_DEPENDENTS`; `force` does not override them, so delete or repoint those resources first. Soft dependents — price overrides and usage/generation records — also block with `409` unless `force=true`, which deletes the provider's price overrides and unlinks (nulls) its usage history, preserving those rows. The `409` body's `error.meta` reports the counts, a sample of offending IDs, and a `forcible` flag that is `true` when a `force=true` retry would succeed.
979
981
  *
980
982
  */
981
983
  static deleteAiProvider(options) {
@@ -1400,9 +1402,14 @@ var Conversations = class {
1400
1402
  * Generate the next message in a conversation
1401
1403
  *
1402
1404
  * Generates the next message using the specified actor's linked agent or chat.
1403
- * On `completed`, the reply is persisted as a new ConversationMessage authored
1404
- * by that actor. On `requires_action`, nothing is persisted; the caller must
1405
- * submit tool outputs via the Agents module and re-invoke generate.
1405
+ * Background by default: returns `202 Accepted` immediately and the reply
1406
+ * lands as a new ConversationMessage when it completes poll
1407
+ * `GET /api/v1/conversations/{conversation_id}/messages` for it.
1408
+ * Pass `?wait=true` to block and receive the result inline. On
1409
+ * `completed`, the reply is persisted as a new ConversationMessage
1410
+ * authored by that actor. On `requires_action`, nothing is persisted; the
1411
+ * caller must submit tool outputs via the Agents module and re-invoke
1412
+ * generate — so a flow using client tools should pass `?wait=true`.
1406
1413
  *
1407
1414
  */
1408
1415
  static generateConversationMessage(options) {
@@ -1468,109 +1475,6 @@ var Conversations = class {
1468
1475
  });
1469
1476
  }
1470
1477
  };
1471
- var Discussions = class {
1472
- /**
1473
- * List discussions
1474
- *
1475
- * Returns all discussions the caller has access to. If project_id is provided, returns only discussions in that project.
1476
- */
1477
- static listDiscussions(options) {
1478
- return (options?.client ?? client).get({
1479
- url: "/api/v1/discussions",
1480
- ...options
1481
- });
1482
- }
1483
- /**
1484
- * Create a discussion
1485
- *
1486
- * Creates a new discussion config. project keys infer the project from the key's scope; JWT callers must supply project_id.
1487
- */
1488
- static createDiscussion(options) {
1489
- return (options.client ?? client).post({
1490
- url: "/api/v1/discussions",
1491
- ...options,
1492
- headers: {
1493
- "Content-Type": "application/json",
1494
- ...options.headers
1495
- }
1496
- });
1497
- }
1498
- /**
1499
- * Get a discussion run by ID
1500
- *
1501
- * Returns a single discussion run, including its outcome, transcript conversation, and outcome document.
1502
- */
1503
- static getDiscussionRun(options) {
1504
- return (options.client ?? client).get({
1505
- url: "/api/v1/discussions/runs/{run_id}",
1506
- ...options
1507
- });
1508
- }
1509
- /**
1510
- * Delete a discussion
1511
- *
1512
- * Deletes a discussion config and its participants.
1513
- */
1514
- static deleteDiscussion(options) {
1515
- return (options.client ?? client).delete({
1516
- url: "/api/v1/discussions/{discussion_id}",
1517
- ...options
1518
- });
1519
- }
1520
- /**
1521
- * Get a discussion by ID
1522
- *
1523
- * Returns a discussion config with its participants.
1524
- */
1525
- static getDiscussion(options) {
1526
- return (options.client ?? client).get({
1527
- url: "/api/v1/discussions/{discussion_id}",
1528
- ...options
1529
- });
1530
- }
1531
- /**
1532
- * Update a discussion
1533
- *
1534
- * Updates a discussion. Providing participants replaces the full set (not merged).
1535
- */
1536
- static updateDiscussion(options) {
1537
- return (options.client ?? client).patch({
1538
- url: "/api/v1/discussions/{discussion_id}",
1539
- ...options,
1540
- headers: {
1541
- "Content-Type": "application/json",
1542
- ...options.headers
1543
- }
1544
- });
1545
- }
1546
- /**
1547
- * List a discussion's runs
1548
- *
1549
- * Returns the run history of a discussion, most recent first.
1550
- */
1551
- static listDiscussionRuns(options) {
1552
- return (options.client ?? client).get({
1553
- url: "/api/v1/discussions/{discussion_id}/runs",
1554
- ...options
1555
- });
1556
- }
1557
- /**
1558
- * Invoke a discussion
1559
- *
1560
- * Runs the discussion synchronously over the given topic and returns the completed run, whose outcome inlines the synthesized text. The run's transcript is persisted as a conversation and the outcome as a document.
1561
- *
1562
- */
1563
- static createDiscussionRun(options) {
1564
- return (options.client ?? client).post({
1565
- url: "/api/v1/discussions/{discussion_id}/runs",
1566
- ...options,
1567
- headers: {
1568
- "Content-Type": "application/json",
1569
- ...options.headers
1570
- }
1571
- });
1572
- }
1573
- };
1574
1478
  var Documents = class {
1575
1479
  /**
1576
1480
  * List documents
@@ -1685,8 +1589,8 @@ var Documents = class {
1685
1589
  * source file. Existing chunks are discarded and the document is reset to
1686
1590
  * `status=pending` before re-processing. Use this to recover a document
1687
1591
  * stuck in `processing`/`failed` or to re-chunk with a different strategy
1688
- * without re-uploading the file. Async by default (`202`); pass
1689
- * `?async=false` to run synchronously (`201`).
1592
+ * without re-uploading the file. Background by default (`202`); pass
1593
+ * `?wait=true` to run synchronously (`201`).
1690
1594
  *
1691
1595
  */
1692
1596
  static reingestDocument(options) {
@@ -1785,6 +1689,261 @@ var Embeddings = class {
1785
1689
  });
1786
1690
  }
1787
1691
  };
1692
+ var Evaluations = class {
1693
+ /**
1694
+ * List datasets
1695
+ *
1696
+ * Returns the datasets defined in a project
1697
+ */
1698
+ static listDatasets(options) {
1699
+ return (options?.client ?? client).get({
1700
+ url: "/api/v1/datasets",
1701
+ ...options
1702
+ });
1703
+ }
1704
+ /**
1705
+ * Create a dataset
1706
+ *
1707
+ * Creates a project-scoped dataset — a named collection of test cases an eval runs an agent against. Names are unique per project.
1708
+ *
1709
+ * Datasets are operator-owned **fixtures**. The platform's content purge never deletes or mutates a dataset item, so erasing a generation cannot silently stop a test suite from being runnable.
1710
+ */
1711
+ static createDataset(options) {
1712
+ return (options.client ?? client).post({
1713
+ url: "/api/v1/datasets",
1714
+ ...options,
1715
+ headers: {
1716
+ "Content-Type": "application/json",
1717
+ ...options.headers
1718
+ }
1719
+ });
1720
+ }
1721
+ /**
1722
+ * Delete a dataset
1723
+ *
1724
+ * Deletes a dataset, its items, and every eval bound to it. Results of runs that already scored those items keep their frozen copies of the input and expected output.
1725
+ */
1726
+ static deleteDataset(options) {
1727
+ return (options.client ?? client).delete({
1728
+ url: "/api/v1/datasets/{dataset_id}",
1729
+ ...options
1730
+ });
1731
+ }
1732
+ /**
1733
+ * Get a dataset
1734
+ *
1735
+ * Returns a specific dataset
1736
+ */
1737
+ static getDataset(options) {
1738
+ return (options.client ?? client).get({
1739
+ url: "/api/v1/datasets/{dataset_id}",
1740
+ ...options
1741
+ });
1742
+ }
1743
+ /**
1744
+ * Update a dataset
1745
+ *
1746
+ * Updates a dataset's name and/or description
1747
+ */
1748
+ static updateDataset(options) {
1749
+ return (options.client ?? client).put({
1750
+ url: "/api/v1/datasets/{dataset_id}",
1751
+ ...options,
1752
+ headers: {
1753
+ "Content-Type": "application/json",
1754
+ ...options.headers
1755
+ }
1756
+ });
1757
+ }
1758
+ /**
1759
+ * List dataset items
1760
+ *
1761
+ * Returns the test cases in a dataset, oldest first
1762
+ */
1763
+ static listDatasetItems(options) {
1764
+ return (options.client ?? client).get({
1765
+ url: "/api/v1/datasets/{dataset_id}/items",
1766
+ ...options
1767
+ });
1768
+ }
1769
+ /**
1770
+ * Add a dataset item
1771
+ *
1772
+ * Adds one test case. `input` is replayed verbatim as the generation's messages, so it must be a non-empty array of `{ role, content }`.
1773
+ */
1774
+ static createDatasetItem(options) {
1775
+ return (options.client ?? client).post({
1776
+ url: "/api/v1/datasets/{dataset_id}/items",
1777
+ ...options,
1778
+ headers: {
1779
+ "Content-Type": "application/json",
1780
+ ...options.headers
1781
+ }
1782
+ });
1783
+ }
1784
+ /**
1785
+ * Delete a dataset item
1786
+ *
1787
+ * Deletes a test case. Results of runs that already scored it stay readable; their `dataset_item_id` becomes null.
1788
+ */
1789
+ static deleteDatasetItem(options) {
1790
+ return (options.client ?? client).delete({
1791
+ url: "/api/v1/datasets/{dataset_id}/items/{item_id}",
1792
+ ...options
1793
+ });
1794
+ }
1795
+ /**
1796
+ * Update a dataset item
1797
+ *
1798
+ * Updates a test case. Runs that already scored it are unaffected — each result carries its own frozen copy of the input and expected output.
1799
+ */
1800
+ static updateDatasetItem(options) {
1801
+ return (options.client ?? client).put({
1802
+ url: "/api/v1/datasets/{dataset_id}/items/{item_id}",
1803
+ ...options,
1804
+ headers: {
1805
+ "Content-Type": "application/json",
1806
+ ...options.headers
1807
+ }
1808
+ });
1809
+ }
1810
+ /**
1811
+ * List evals
1812
+ *
1813
+ * Returns the evals defined in a project
1814
+ */
1815
+ static listEvals(options) {
1816
+ return (options?.client ?? client).get({
1817
+ url: "/api/v1/evals",
1818
+ ...options
1819
+ });
1820
+ }
1821
+ /**
1822
+ * Create an eval
1823
+ *
1824
+ * Binds an agent under test to a dataset and a list of scorers. The agent and the dataset must belong to the same project as the eval; a cross-project reference is rejected with 400.
1825
+ *
1826
+ * Scorer config is frozen here rather than read from the agent at run time, so two runs of the same eval are always judged by the same criteria and their comparison measures the agent instead of the config drifting underneath it. Each scorer `type` may appear at most once.
1827
+ */
1828
+ static createEval(options) {
1829
+ return (options.client ?? client).post({
1830
+ url: "/api/v1/evals",
1831
+ ...options,
1832
+ headers: {
1833
+ "Content-Type": "application/json",
1834
+ ...options.headers
1835
+ }
1836
+ });
1837
+ }
1838
+ /**
1839
+ * Delete an eval
1840
+ *
1841
+ * Deletes an eval, its runs, and their results
1842
+ */
1843
+ static deleteEval(options) {
1844
+ return (options.client ?? client).delete({
1845
+ url: "/api/v1/evals/{eval_id}",
1846
+ ...options
1847
+ });
1848
+ }
1849
+ /**
1850
+ * Get an eval
1851
+ *
1852
+ * Returns a specific eval
1853
+ */
1854
+ static getEval(options) {
1855
+ return (options.client ?? client).get({
1856
+ url: "/api/v1/evals/{eval_id}",
1857
+ ...options
1858
+ });
1859
+ }
1860
+ /**
1861
+ * Update an eval
1862
+ *
1863
+ * Updates an eval. Changing `agent_id` re-validates the scorers against the new agent, since an `output_schema` scorer that was legal against the old one may not be.
1864
+ */
1865
+ static updateEval(options) {
1866
+ return (options.client ?? client).put({
1867
+ url: "/api/v1/evals/{eval_id}",
1868
+ ...options,
1869
+ headers: {
1870
+ "Content-Type": "application/json",
1871
+ ...options.headers
1872
+ }
1873
+ });
1874
+ }
1875
+ /**
1876
+ * List eval runs
1877
+ *
1878
+ * Returns an eval's runs, newest first
1879
+ */
1880
+ static listEvalRuns(options) {
1881
+ return (options.client ?? client).get({
1882
+ url: "/api/v1/evals/{eval_id}/runs",
1883
+ ...options
1884
+ });
1885
+ }
1886
+ /**
1887
+ * Start an eval run
1888
+ *
1889
+ * Runs the eval against its dataset, creating one real agent generation per item and scoring the outputs.
1890
+ *
1891
+ * `wait: true` executes the run synchronously and returns it terminal, with its scores. The dataset is capped at 25 items for a synchronous run; a larger one is rejected with 400 rather than partially scored.
1892
+ *
1893
+ * `wait: false` (the default) enqueues one task per item and returns immediately with `status: "queued"`. A worker executes the items and the run settles itself; poll `GET /evals/{eval_id}/runs/{eval_run_id}` for the terminal status, or subscribe to the `eval_run.completed` webhook. There is no item cap on a queued run.
1894
+ *
1895
+ * The whole run is pinned to **one** agent version, stamped on `agent_version`: pass one explicitly to evaluate a canary before promoting it, or omit it to use the active release's stable version (or the live draft when no release is in effect). Without the pin, release assignment would bucket each item independently and blend two configs into a single score.
1896
+ *
1897
+ * With `baseline_run_id`, the finished run's `aggregate_scores.baseline` carries per-scorer deltas against that run, computed over the items present and scorable in **both** runs, with the divergence counted. A delta over a shifted dataset is therefore never presented as a clean comparison.
1898
+ */
1899
+ static startEvalRun(options) {
1900
+ return (options.client ?? client).post({
1901
+ url: "/api/v1/evals/{eval_id}/runs",
1902
+ ...options,
1903
+ headers: {
1904
+ "Content-Type": "application/json",
1905
+ ...options.headers
1906
+ }
1907
+ });
1908
+ }
1909
+ /**
1910
+ * Get an eval run
1911
+ *
1912
+ * Returns a run's status, counts, and aggregate scores
1913
+ */
1914
+ static getEvalRun(options) {
1915
+ return (options.client ?? client).get({
1916
+ url: "/api/v1/evals/{eval_id}/runs/{eval_run_id}",
1917
+ ...options
1918
+ });
1919
+ }
1920
+ /**
1921
+ * List eval run results
1922
+ *
1923
+ * Returns the per-item results of a run, oldest first
1924
+ */
1925
+ static listEvalResults(options) {
1926
+ return (options.client ?? client).get({
1927
+ url: "/api/v1/evals/{eval_id}/runs/{eval_run_id}/results",
1928
+ ...options
1929
+ });
1930
+ }
1931
+ /**
1932
+ * Cancel an eval run
1933
+ *
1934
+ * Cancels a queued or running run: its outstanding item tasks are dropped so it stops consuming provider budget, and the run settles as `canceled`.
1935
+ *
1936
+ * Results already written are kept — they are real measurements of generations that were really paid for — and `completed_count` / `errored_count` report what ran. `aggregate_scores` is deliberately left null: a partial roll-up in the same field a completed run uses would read as a whole-dataset verdict.
1937
+ *
1938
+ * A run that has already finished is rejected with 400.
1939
+ */
1940
+ static cancelEvalRun(options) {
1941
+ return (options.client ?? client).post({
1942
+ url: "/api/v1/evals/{eval_id}/runs/{eval_run_id}/cancel",
1943
+ ...options
1944
+ });
1945
+ }
1946
+ };
1788
1947
  var Exceptions = class {
1789
1948
  /**
1790
1949
  * List exception items
@@ -3191,7 +3350,7 @@ var Sessions = class {
3191
3350
  /**
3192
3351
  * Trigger agent generation
3193
3352
  *
3194
- * Triggers the agent to generate a response based on the current conversation. Returns the assistant reply or a requires_action status if the agent needs client tool outputs. Pass ?async=true for a 202 accepted response when you do not need to wait for the result.
3353
+ * Triggers the agent to generate a response based on the current conversation. Background by default: returns `202 Accepted` immediately while the generation runs. Pass ?wait=true to block and receive the assistant reply (or a requires_action status if the agent needs client tool outputs) in the response.
3195
3354
  *
3196
3355
  */
3197
3356
  static generateSessionResponse(options) {
@@ -3555,7 +3714,7 @@ var Triggers = class {
3555
3714
  /**
3556
3715
  * Fire a trigger
3557
3716
  *
3558
- * Fires a trigger synchronously and returns the terminal firing record.
3717
+ * Fires a trigger synchronously and returns the terminal firing record. The firing itself always settles here; an `eval` target's run is queued rather than executed inline, so the record names a `queued` run to poll.
3559
3718
  */
3560
3719
  static fireTrigger(options) {
3561
3720
  return (options.client ?? client).post({
@@ -4082,31 +4241,49 @@ const bindResource = (SdkClass, client) => {
4082
4241
  * the corresponding static class from the generated SDK, so all method
4083
4242
  * signatures, types, and return values are identical — the only difference
4084
4243
  * is that you never need to supply `client` yourself.
4244
+ *
4245
+ * The list is exhaustive by construction: `NoUnregisteredResource` at the
4246
+ * bottom of this file fails `pnpm typecheck` when a spec adds a resource this
4247
+ * class does not expose.
4085
4248
  */
4086
4249
  var SoatClient = class {
4250
+ activity;
4087
4251
  actors;
4088
4252
  agents;
4253
+ agentVersions;
4089
4254
  aiProviders;
4090
4255
  apiKeys;
4256
+ approvals;
4257
+ auditLog;
4091
4258
  chats;
4092
4259
  conversations;
4093
4260
  documents;
4261
+ embeddings;
4262
+ evaluations;
4263
+ exceptions;
4094
4264
  files;
4095
4265
  formations;
4266
+ generations;
4267
+ guardrails;
4096
4268
  ingestionRules;
4097
4269
  knowledge;
4098
4270
  memories;
4099
4271
  memoryEntries;
4272
+ modelRoutes;
4273
+ orchestrations;
4100
4274
  policies;
4101
4275
  projects;
4276
+ quotas;
4102
4277
  secrets;
4103
4278
  sessions;
4279
+ tasks;
4104
4280
  tools;
4105
4281
  traces;
4106
4282
  triggers;
4107
4283
  usage;
4108
4284
  users;
4109
4285
  webhooks;
4286
+ workflows;
4110
4287
  constructor({ baseUrl, token, headers } = {}) {
4111
4288
  const authHeaders = token ? { Authorization: `Bearer ${token}` } : {};
4112
4289
  const httpClient = createClient(createConfig({
@@ -4116,29 +4293,43 @@ var SoatClient = class {
4116
4293
  ...headers
4117
4294
  }
4118
4295
  }));
4296
+ this.activity = bindResource(Activity, httpClient);
4119
4297
  this.actors = bindResource(Actors, httpClient);
4120
4298
  this.agents = bindResource(Agents, httpClient);
4299
+ this.agentVersions = bindResource(AgentVersions, httpClient);
4121
4300
  this.aiProviders = bindResource(AiProviders, httpClient);
4122
4301
  this.apiKeys = bindResource(ApiKeys, httpClient);
4302
+ this.approvals = bindResource(Approvals, httpClient);
4303
+ this.auditLog = bindResource(AuditLog, httpClient);
4123
4304
  this.chats = bindResource(Chats, httpClient);
4124
4305
  this.conversations = bindResource(Conversations, httpClient);
4125
4306
  this.documents = bindResource(Documents, httpClient);
4307
+ this.embeddings = bindResource(Embeddings, httpClient);
4308
+ this.evaluations = bindResource(Evaluations, httpClient);
4309
+ this.exceptions = bindResource(Exceptions, httpClient);
4126
4310
  this.files = bindResource(Files, httpClient);
4127
4311
  this.formations = bindResource(Formations, httpClient);
4312
+ this.generations = bindResource(Generations, httpClient);
4313
+ this.guardrails = bindResource(Guardrails, httpClient);
4128
4314
  this.ingestionRules = bindResource(IngestionRules, httpClient);
4129
4315
  this.knowledge = bindResource(Knowledge, httpClient);
4130
4316
  this.memories = bindResource(Memories, httpClient);
4131
4317
  this.memoryEntries = bindResource(MemoryEntries, httpClient);
4318
+ this.modelRoutes = bindResource(ModelRoutes, httpClient);
4319
+ this.orchestrations = bindResource(Orchestrations, httpClient);
4132
4320
  this.policies = bindResource(Policies, httpClient);
4133
4321
  this.projects = bindResource(Projects, httpClient);
4322
+ this.quotas = bindResource(Quotas, httpClient);
4134
4323
  this.secrets = bindResource(Secrets, httpClient);
4135
4324
  this.sessions = bindResource(Sessions, httpClient);
4325
+ this.tasks = bindResource(Tasks, httpClient);
4136
4326
  this.tools = bindResource(Tools, httpClient);
4137
4327
  this.traces = bindResource(Traces, httpClient);
4138
4328
  this.triggers = bindResource(Triggers, httpClient);
4139
4329
  this.usage = bindResource(Usage, httpClient);
4140
4330
  this.users = bindResource(Users, httpClient);
4141
4331
  this.webhooks = bindResource(Webhooks, httpClient);
4332
+ this.workflows = bindResource(Workflows, httpClient);
4142
4333
  }
4143
4334
  };
4144
4335
  //#endregion
@@ -4152,9 +4343,9 @@ exports.Approvals = Approvals;
4152
4343
  exports.AuditLog = AuditLog;
4153
4344
  exports.Chats = Chats;
4154
4345
  exports.Conversations = Conversations;
4155
- exports.Discussions = Discussions;
4156
4346
  exports.Documents = Documents;
4157
4347
  exports.Embeddings = Embeddings;
4348
+ exports.Evaluations = Evaluations;
4158
4349
  exports.Exceptions = Exceptions;
4159
4350
  exports.Files = Files;
4160
4351
  exports.Formations = Formations;