@naturali/cli 0.154.0 → 0.156.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.
Files changed (2) hide show
  1. package/dist/index.mjs +835 -97
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ var __exportAll = (all, no_symbols) => {
17
17
  };
18
18
  //#endregion
19
19
  //#region package.json
20
- var version = "0.154.0";
20
+ var version = "0.156.0";
21
21
  //#endregion
22
22
  //#region ../sdk/src/generated/core/bodySerializer.gen.ts
23
23
  const serializeFormDataPair = (data, key, value) => {
@@ -1175,6 +1175,18 @@ var Admin = class {
1175
1175
  ...options
1176
1176
  });
1177
1177
  }
1178
+ /**
1179
+ * List a user's monthly statements
1180
+ *
1181
+ * The same statements the account reads at `GET /v1/users/me/statements`, for an operator to bill from. Needs the `admin` role.
1182
+ *
1183
+ */
1184
+ static listUserStatements(options) {
1185
+ return (options.client ?? client).get({
1186
+ url: "/v1/admin/users/{user_id}/statements",
1187
+ ...options
1188
+ });
1189
+ }
1178
1190
  };
1179
1191
  var Agents = class {
1180
1192
  /**
@@ -2004,6 +2016,151 @@ var Conversations = class {
2004
2016
  });
2005
2017
  }
2006
2018
  };
2019
+ var Deciders = class {
2020
+ /**
2021
+ * List deciders
2022
+ *
2023
+ * Returns the deciders defined in a project, newest first.
2024
+ */
2025
+ static listDeciders(options) {
2026
+ return (options.client ?? client).get({
2027
+ url: "/v1/projects/{project_id}/deciders",
2028
+ ...options
2029
+ });
2030
+ }
2031
+ /**
2032
+ * Create a decider
2033
+ *
2034
+ * Creates a decider at version 1: a named question set and the backend that answers it, exactly one of `agent_id` and `tool_id`. Every question declares a finite answer space, validated here. The backend must be in the decider's project. An agent must carry no tool surface — no tool binding left active by `active_tool_ids` and no `knowledge_config.write_memory_store_id` — or the create is refused with `400 DECIDER_AGENT_NOT_TOOL_LESS`. A tool must be `http` or `pipeline` and must not pin `state` or `questions` in its `preset_parameters`, or the create is refused with `400 DECIDER_TOOL_NOT_CALLABLE`. A duplicate `name` in the project is `409 NAME_CONFLICT`.
2035
+ */
2036
+ static createDecider(options) {
2037
+ return (options.client ?? client).post({
2038
+ url: "/v1/projects/{project_id}/deciders",
2039
+ ...options,
2040
+ headers: {
2041
+ "Content-Type": "application/json",
2042
+ ...options.headers
2043
+ }
2044
+ });
2045
+ }
2046
+ /**
2047
+ * Delete a decider
2048
+ *
2049
+ * Deletes a decider and its version archive. Its decisions remain and keep naming the decider's ID.
2050
+ */
2051
+ static deleteDecider(options) {
2052
+ return (options.client ?? client).delete({
2053
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2054
+ ...options
2055
+ });
2056
+ }
2057
+ /**
2058
+ * Get a decider
2059
+ *
2060
+ * Returns a decider with its current question set and version.
2061
+ */
2062
+ static getDecider(options) {
2063
+ return (options.client ?? client).get({
2064
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2065
+ ...options
2066
+ });
2067
+ }
2068
+ /**
2069
+ * Update a decider
2070
+ *
2071
+ * Updates any of `name`, `description`, the backend and `questions`. Naming `agent_id` or `tool_id` replaces the current backend; naming both is `400`. Only a change to `questions` archives a new version; a rename, a new backend or a rewrite of the questions the decider already holds leaves `version` where it is. A new backend is held to the same rules as on create.
2072
+ */
2073
+ static updateDecider(options) {
2074
+ return (options.client ?? client).patch({
2075
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2076
+ ...options,
2077
+ headers: {
2078
+ "Content-Type": "application/json",
2079
+ ...options.headers
2080
+ }
2081
+ });
2082
+ }
2083
+ /**
2084
+ * List a decider's versions
2085
+ *
2086
+ * Returns the decider's archived question sets, newest first. A version is written on create and on every write that changes `questions`.
2087
+ */
2088
+ static listDeciderVersions(options) {
2089
+ return (options.client ?? client).get({
2090
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions",
2091
+ ...options
2092
+ });
2093
+ }
2094
+ /**
2095
+ * Fetch an archived decider version
2096
+ *
2097
+ * Returns the question set a version held. A decision names the `decider_version` it was answered under, so this is how its criteria are read after the decider has changed.
2098
+ */
2099
+ static getDeciderVersion(options) {
2100
+ return (options.client ?? client).get({
2101
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}",
2102
+ ...options
2103
+ });
2104
+ }
2105
+ /**
2106
+ * Restore an archived decider version
2107
+ *
2108
+ * Writes an archived question set back as the decider's live one, which archives it again as a new version rather than rewinding the counter. Restoring the question set the decider already holds is a no-op.
2109
+ */
2110
+ static restoreDeciderVersion(options) {
2111
+ return (options.client ?? client).post({
2112
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}/restore",
2113
+ ...options,
2114
+ headers: {
2115
+ "Content-Type": "application/json",
2116
+ ...options.headers
2117
+ }
2118
+ });
2119
+ }
2120
+ /**
2121
+ * Request a decision
2122
+ *
2123
+ * Evaluates the decider against `state` and records the decision. The questions come from the decider, never from the request, so a call site can only supply what is judged.
2124
+ *
2125
+ * Everything that can refuse the request is checked before the decision is written, so a refusal is a `4xx` and never a polled failure: the agent's tool surface (`400 DECIDER_AGENT_NOT_TOOL_LESS`), a tool that cannot answer (`400 DECIDER_TOOL_NOT_CALLABLE`), a paused project (`409 PROJECT_PAUSED`) and, for an agent, quota admission (`429 QUOTA_EXCEEDED`).
2126
+ *
2127
+ * A tool backend is called with `{ state, questions }` and must answer `{ answers: { <question id>: { choice | score | value, probabilities? } } }`; an answer outside that contract fails the decision with `DECISION_ANSWER_INVALID`.
2128
+ *
2129
+ * With `wait: false`, the default, the answer is `201` with the decision `queued`; poll `GET /v1/projects/{project_id}/decisions/{decision_id}` or subscribe to `decisions.completed` and `decisions.failed`. With `wait: true` it is `201` with the decision settled.
2130
+ */
2131
+ static createDecision(options) {
2132
+ return (options.client ?? client).post({
2133
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/decisions",
2134
+ ...options,
2135
+ headers: {
2136
+ "Content-Type": "application/json",
2137
+ ...options.headers
2138
+ }
2139
+ });
2140
+ }
2141
+ /**
2142
+ * List decisions
2143
+ *
2144
+ * Returns the decisions in a project, newest first.
2145
+ */
2146
+ static listDecisions(options) {
2147
+ return (options.client ?? client).get({
2148
+ url: "/v1/projects/{project_id}/decisions",
2149
+ ...options
2150
+ });
2151
+ }
2152
+ /**
2153
+ * Get a decision
2154
+ *
2155
+ * Returns a decision. Poll it after a `wait: false` request until `status` is `completed` or `failed`.
2156
+ */
2157
+ static getDecision(options) {
2158
+ return (options.client ?? client).get({
2159
+ url: "/v1/projects/{project_id}/decisions/{decision_id}",
2160
+ ...options
2161
+ });
2162
+ }
2163
+ };
2007
2164
  var Documents = class {
2008
2165
  /**
2009
2166
  * List documents
@@ -4689,7 +4846,7 @@ var Tools = class {
4689
4846
  /**
4690
4847
  * Delete a tool
4691
4848
  *
4692
- * Deletes a tool by ID.
4849
+ * Deletes a tool by ID. A tool that is a decider's backend is refused with `409 TOOL_HAS_DEPENDENTS`.
4693
4850
  */
4694
4851
  static deleteTool(options) {
4695
4852
  return (options.client ?? client).delete({
@@ -5030,6 +5187,32 @@ var Users = class {
5030
5187
  ...options
5031
5188
  });
5032
5189
  }
5190
+ /**
5191
+ * List the account's monthly statements
5192
+ *
5193
+ * What the account owes for each closed billing month, newest first: the subscription fee, prorated by the share of the month each plan was held, and runs past the allowance at the plan's overage rate. Overage is measured against the highest plan held that month.
5194
+ *
5195
+ * A statement is written within an hour of the month closing, once, and never changes. It is a record to bill from, not a charge and not a tax invoice. Months on the Free plan alone, contract plans and storage are not stated.
5196
+ *
5197
+ */
5198
+ static listCurrentUserStatements(options) {
5199
+ return (options?.client ?? client).get({
5200
+ url: "/v1/users/me/statements",
5201
+ ...options
5202
+ });
5203
+ }
5204
+ /**
5205
+ * Get a monthly statement
5206
+ *
5207
+ * One of this account's monthly statements, with its lines and total. Another account's statement answers `404`.
5208
+ *
5209
+ */
5210
+ static getCurrentUserStatement(options) {
5211
+ return (options.client ?? client).get({
5212
+ url: "/v1/users/me/statements/{statement_id}",
5213
+ ...options
5214
+ });
5215
+ }
5033
5216
  };
5034
5217
  var Webhooks = class {
5035
5218
  /**
@@ -5324,6 +5507,7 @@ var NaturaliClient = class {
5324
5507
  channels;
5325
5508
  auth;
5326
5509
  conversations;
5510
+ deciders;
5327
5511
  documents;
5328
5512
  embeddings;
5329
5513
  evaluations;
@@ -5376,6 +5560,7 @@ var NaturaliClient = class {
5376
5560
  this.channels = bindResource(Channels, this.http);
5377
5561
  this.auth = bindResource(Auth, this.http);
5378
5562
  this.conversations = bindResource(Conversations, this.http);
5563
+ this.deciders = bindResource(Deciders, this.http);
5379
5564
  this.documents = bindResource(Documents, this.http);
5380
5565
  this.embeddings = bindResource(Embeddings, this.http);
5381
5566
  this.evaluations = bindResource(Evaluations, this.http);
@@ -5423,6 +5608,7 @@ var src_exports = /* @__PURE__ */ __exportAll({
5423
5608
  Chains: () => Chains,
5424
5609
  Channels: () => Channels,
5425
5610
  Conversations: () => Conversations,
5611
+ Deciders: () => Deciders,
5426
5612
  Documents: () => Documents,
5427
5613
  Embeddings: () => Embeddings,
5428
5614
  Evaluations: () => Evaluations,
@@ -6935,6 +7121,40 @@ const routes = {
6935
7121
  cookieParams: [],
6936
7122
  flags: []
6937
7123
  },
7124
+ "list-user-statements": {
7125
+ serviceClass: "Admin",
7126
+ operationId: "listUserStatements",
7127
+ description: "The same statements the account reads at `GET /v1/users/me/statements`, for an operator to bill from. Needs the `admin` role.",
7128
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/admin",
7129
+ httpMethod: "get",
7130
+ pathParams: ["user_id"],
7131
+ queryParams: ["limit", "cursor"],
7132
+ headerParams: [],
7133
+ cookieParams: [],
7134
+ flags: [
7135
+ {
7136
+ "name": "user_id",
7137
+ "description": "",
7138
+ "required": true,
7139
+ "type": "string",
7140
+ "in": "path"
7141
+ },
7142
+ {
7143
+ "name": "limit",
7144
+ "description": "Maximum items per page — an integer from 1 to 100 (default 20).",
7145
+ "required": false,
7146
+ "type": "integer",
7147
+ "in": "query"
7148
+ },
7149
+ {
7150
+ "name": "cursor",
7151
+ "description": "The `next_cursor` of the previous page.",
7152
+ "required": false,
7153
+ "type": "string",
7154
+ "in": "query"
7155
+ }
7156
+ ]
7157
+ },
6938
7158
  "list-agents": {
6939
7159
  serviceClass: "Agents",
6940
7160
  operationId: "listAgents",
@@ -10355,22 +10575,14 @@ const routes = {
10355
10575
  "in": "path"
10356
10576
  }]
10357
10577
  },
10358
- "list-documents": {
10359
- serviceClass: "Documents",
10360
- operationId: "listDocuments",
10361
- description: "Returns all documents in the project named in the path.",
10362
- moduleDocsUrl: "https://docs.naturali.ai/docs/modules/documents",
10578
+ "list-deciders": {
10579
+ serviceClass: "Deciders",
10580
+ operationId: "listDeciders",
10581
+ description: "Returns the deciders defined in a project, newest first.",
10582
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10363
10583
  httpMethod: "get",
10364
10584
  pathParams: ["project_id"],
10365
- queryParams: [
10366
- "path_prefix",
10367
- "include_withdrawn",
10368
- "related_to",
10369
- "tags",
10370
- "metadata",
10371
- "limit",
10372
- "offset"
10373
- ],
10585
+ queryParams: ["limit", "offset"],
10374
10586
  headerParams: [],
10375
10587
  cookieParams: [],
10376
10588
  flags: [
@@ -10381,41 +10593,6 @@ const routes = {
10381
10593
  "type": "string",
10382
10594
  "in": "path"
10383
10595
  },
10384
- {
10385
- "name": "path_prefix",
10386
- "description": "Only documents filed under this directory. The prefix is a path boundary, not a substring: `/reports` returns `/reports/q1.txt` and never `/reports-archive/q1.txt`, and `/` selects the whole project. A leading slash is optional and a trailing one is ignored, so `reports`, `/reports` and `/reports/` are the same filter. `%` and `_` are literal characters, not wildcards.",
10387
- "required": false,
10388
- "type": "string",
10389
- "in": "query"
10390
- },
10391
- {
10392
- "name": "include_withdrawn",
10393
- "description": "Include withdrawn documents. A withdrawn document leaves every default read and is not in the knowledge index at all — its chunks are dropped when it is withdrawn — so this shows it in the listing but never in a search.",
10394
- "required": false,
10395
- "type": "boolean",
10396
- "in": "query"
10397
- },
10398
- {
10399
- "name": "related_to",
10400
- "description": "Only documents related to this one, on either side of the edge: what it points at, and what points at it. An id with no relations narrows the listing to nothing.",
10401
- "required": false,
10402
- "type": "string",
10403
- "in": "query"
10404
- },
10405
- {
10406
- "name": "tags",
10407
- "description": "Filter by tag pairs, written `key:value` (split on the first colon, so a value may contain colons). Repeat the parameter for several pairs; **all** must be present with exactly that value.\n",
10408
- "required": false,
10409
- "type": "array",
10410
- "in": "query"
10411
- },
10412
- {
10413
- "name": "metadata",
10414
- "description": "A `MetadataFilter` as JSON, url-encoded. It travels as JSON rather than as `key:value` pairs because the match is exact and a query string cannot otherwise say whether `3` is the number or the string.",
10415
- "required": false,
10416
- "type": "string",
10417
- "in": "query"
10418
- },
10419
10596
  {
10420
10597
  "name": "limit",
10421
10598
  "description": "Maximum number of results to return",
@@ -10432,11 +10609,11 @@ const routes = {
10432
10609
  }
10433
10610
  ]
10434
10611
  },
10435
- "create-document": {
10436
- serviceClass: "Documents",
10437
- operationId: "createDocument",
10438
- description: "Creates a new text document and generates an embedding vector for semantic search, in the project named in the path.",
10439
- moduleDocsUrl: "https://docs.naturali.ai/docs/modules/documents",
10612
+ "create-decider": {
10613
+ serviceClass: "Deciders",
10614
+ operationId: "createDecider",
10615
+ description: "Creates a decider at version 1: a named question set and the backend that answers it, exactly one of `agent_id` and `tool_id`. Every question declares a finite answer space, validated here. The backend must be in the decider's project. An agent must carry no tool surface — no tool binding left active by `active_tool_ids` and no `knowledge_config.write_memory_store_id` — or the create is refused with `400 DECIDER_AGENT_NOT_TOOL_LESS`. A tool must be `http` or `pipeline` and must not pin `state` or `questions` in its `preset_parameters`, or the create is refused with `400 DECIDER_TOOL_NOT_CALLABLE`. A duplicate `name` in the project is `409 NAME_CONFLICT`.",
10616
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10440
10617
  httpMethod: "post",
10441
10618
  pathParams: ["project_id"],
10442
10619
  queryParams: [],
@@ -10451,76 +10628,595 @@ const routes = {
10451
10628
  "in": "path"
10452
10629
  },
10453
10630
  {
10454
- "name": "content",
10455
- "description": "",
10631
+ "name": "name",
10632
+ "description": "Human-readable name, unique per project",
10456
10633
  "required": true,
10457
10634
  "type": "string",
10458
10635
  "in": "body"
10459
10636
  },
10460
10637
  {
10461
- "name": "path",
10462
- "description": "Logical path within the project (e.g. /reports/q1.txt). Defaults to `/<filename>`, or to `/<document_id>.txt` when neither is given — a document with no path is reachable only by its id, since a prefix filter never matches null.",
10463
- "required": false,
10464
- "type": "string",
10465
- "in": "body"
10466
- },
10467
- {
10468
- "name": "filename",
10638
+ "name": "description",
10469
10639
  "description": "",
10470
10640
  "required": false,
10471
10641
  "type": "string",
10472
10642
  "in": "body"
10473
10643
  },
10474
10644
  {
10475
- "name": "title",
10476
- "description": "Document title",
10645
+ "name": "agent_id",
10646
+ "description": "A tool-less agent that answers",
10477
10647
  "required": false,
10478
10648
  "type": "string",
10479
10649
  "in": "body"
10480
10650
  },
10481
10651
  {
10482
- "name": "metadata",
10483
- "description": "Arbitrary metadata object. Unlike other body fields, keys are stored and returned verbatim in the casing supplied — they are not converted between snake_case and camelCase.",
10652
+ "name": "tool_id",
10653
+ "description": "An http or pipeline tool that answers",
10484
10654
  "required": false,
10485
- "type": "object",
10655
+ "type": "string",
10486
10656
  "in": "body"
10487
10657
  },
10488
10658
  {
10489
- "name": "tags",
10490
- "description": "Key-value labels on a resource. A flat object of string values — an array, a nested object or a number is rejected with `400 VALIDATION_FAILED`, never coerced. Keys are opaque and stored verbatim, so `cost_center` and `costCenter` are two different tags. Matched by JSONB containment wherever tags are read: the `?tags=` filter and knowledge search.\n\nKeys beginning `system.` are reserved: the platform writes them to record which conversation, actor, agent and role a row came from, and a write naming one is refused with `400 RESERVED_TAG_KEY`. They are read and filtered like any other tag.\n\nThe bag is bounded, because every pair reaches the IAM context of every access check on the resource: at most 50 keys, each key at most 128 characters and each value at most 256. A write past a bound — including a merge that would grow the stored bag past the key count — is `400 VALIDATION_FAILED` with `meta.limit` naming the bound it crossed. `system.*` keys are the platform's and do not count against the 50.",
10491
- "required": false,
10659
+ "name": "questions",
10660
+ "description": "Question id → question, 1 to 20 of them. A question id starts with a letter or underscore and holds only letters, digits and underscores (at most 64), since it keys the answer object.",
10661
+ "required": true,
10492
10662
  "type": "object",
10493
10663
  "in": "body"
10494
10664
  },
10495
10665
  {
10496
- "name": "chunk_strategy",
10497
- "description": "How to split the content into embeddable chunks. `whole` (default) stores the content as a single chunk; `size` splits into fixed-size character windows with overlap. `page` is equivalent to `whole` for plain text.",
10666
+ "name": "version_label",
10667
+ "description": "Optional tag for version 1, e.g. `initial`",
10498
10668
  "required": false,
10499
10669
  "type": "string",
10500
10670
  "in": "body"
10501
- },
10502
- {
10503
- "name": "chunk_size",
10504
- "description": "Window size in characters when `chunk_strategy=size`. Defaults to 1000.",
10505
- "required": false,
10506
- "type": "integer",
10507
- "in": "body"
10508
- },
10509
- {
10510
- "name": "chunk_overlap",
10511
- "description": "Overlap in characters between consecutive windows when `chunk_strategy=size`. Defaults to 200.",
10512
- "required": false,
10513
- "type": "integer",
10514
- "in": "body"
10515
10671
  }
10516
10672
  ]
10517
10673
  },
10518
- "ingest-document": {
10519
- serviceClass: "Documents",
10520
- operationId: "ingestDocument",
10521
- description: "Parses an already-uploaded file and creates one Document split into one or more embedded chunks. The source format is detected from the file's content type: PDFs are parsed page-by-page; `text/plain` and `text/markdown` files are read as a single source. How the source is chunked is controlled by `chunk_strategy`. A file can only back one Document — a second call with the same `file_id` returns `409 FILE_ALREADY_INGESTED`. To re-process an already-ingested file (e.g. with a different `chunk_strategy`), use `POST /documents/{document_id}/ingest`; to ingest the same source under a different path, upload a new copy of the file first.",
10522
- moduleDocsUrl: "https://docs.naturali.ai/docs/modules/documents",
10523
- httpMethod: "post",
10674
+ "get-decider": {
10675
+ serviceClass: "Deciders",
10676
+ operationId: "getDecider",
10677
+ description: "Returns a decider with its current question set and version.",
10678
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10679
+ httpMethod: "get",
10680
+ pathParams: ["project_id", "decider_id"],
10681
+ queryParams: [],
10682
+ headerParams: [],
10683
+ cookieParams: [],
10684
+ flags: [{
10685
+ "name": "project_id",
10686
+ "description": "Project public ID (proj_ prefix).",
10687
+ "required": true,
10688
+ "type": "string",
10689
+ "in": "path"
10690
+ }, {
10691
+ "name": "decider_id",
10692
+ "description": "The decider ID",
10693
+ "required": true,
10694
+ "type": "string",
10695
+ "in": "path"
10696
+ }]
10697
+ },
10698
+ "update-decider": {
10699
+ serviceClass: "Deciders",
10700
+ operationId: "updateDecider",
10701
+ description: "Updates any of `name`, `description`, the backend and `questions`. Naming `agent_id` or `tool_id` replaces the current backend; naming both is `400`. Only a change to `questions` archives a new version; a rename, a new backend or a rewrite of the questions the decider already holds leaves `version` where it is. A new backend is held to the same rules as on create.",
10702
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10703
+ httpMethod: "patch",
10704
+ pathParams: ["project_id", "decider_id"],
10705
+ queryParams: [],
10706
+ headerParams: ["If-Match"],
10707
+ cookieParams: [],
10708
+ flags: [
10709
+ {
10710
+ "name": "project_id",
10711
+ "description": "Project public ID (proj_ prefix).",
10712
+ "required": true,
10713
+ "type": "string",
10714
+ "in": "path"
10715
+ },
10716
+ {
10717
+ "name": "decider_id",
10718
+ "description": "The decider ID",
10719
+ "required": true,
10720
+ "type": "string",
10721
+ "in": "path"
10722
+ },
10723
+ {
10724
+ "name": "If-Match",
10725
+ "description": "The version the caller believes the resource holds, as an entity tag (`3` or `\"3\"`). Equivalent to `expected_version` in the request body; `*` states no precondition beyond the resource existing. A mismatch is `409 VERSION_CONFLICT`.",
10726
+ "required": false,
10727
+ "type": "string",
10728
+ "in": "header"
10729
+ },
10730
+ {
10731
+ "name": "name",
10732
+ "description": "",
10733
+ "required": false,
10734
+ "type": "string",
10735
+ "in": "body"
10736
+ },
10737
+ {
10738
+ "name": "description",
10739
+ "description": "",
10740
+ "required": false,
10741
+ "type": "string",
10742
+ "in": "body"
10743
+ },
10744
+ {
10745
+ "name": "agent_id",
10746
+ "description": "Replaces the backend with this agent",
10747
+ "required": false,
10748
+ "type": "string",
10749
+ "in": "body"
10750
+ },
10751
+ {
10752
+ "name": "tool_id",
10753
+ "description": "Replaces the backend with this tool",
10754
+ "required": false,
10755
+ "type": "string",
10756
+ "in": "body"
10757
+ },
10758
+ {
10759
+ "name": "questions",
10760
+ "description": "Question id → question, 1 to 20 of them. A question id starts with a letter or underscore and holds only letters, digits and underscores (at most 64), since it keys the answer object.",
10761
+ "required": false,
10762
+ "type": "object",
10763
+ "in": "body"
10764
+ },
10765
+ {
10766
+ "name": "version_label",
10767
+ "description": "Optional tag for the version this write archives. Ignored when the write changes no question, since no version is archived.",
10768
+ "required": false,
10769
+ "type": "string",
10770
+ "in": "body"
10771
+ },
10772
+ {
10773
+ "name": "expected_version",
10774
+ "description": "Refuses the write unless the decider is at this version.",
10775
+ "required": false,
10776
+ "type": "integer",
10777
+ "in": "body"
10778
+ }
10779
+ ]
10780
+ },
10781
+ "delete-decider": {
10782
+ serviceClass: "Deciders",
10783
+ operationId: "deleteDecider",
10784
+ description: "Deletes a decider and its version archive. Its decisions remain and keep naming the decider's ID.",
10785
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10786
+ httpMethod: "delete",
10787
+ pathParams: ["project_id", "decider_id"],
10788
+ queryParams: [],
10789
+ headerParams: [],
10790
+ cookieParams: [],
10791
+ flags: [{
10792
+ "name": "project_id",
10793
+ "description": "Project public ID (proj_ prefix).",
10794
+ "required": true,
10795
+ "type": "string",
10796
+ "in": "path"
10797
+ }, {
10798
+ "name": "decider_id",
10799
+ "description": "The decider ID",
10800
+ "required": true,
10801
+ "type": "string",
10802
+ "in": "path"
10803
+ }]
10804
+ },
10805
+ "list-decider-versions": {
10806
+ serviceClass: "Deciders",
10807
+ operationId: "listDeciderVersions",
10808
+ description: "Returns the decider's archived question sets, newest first. A version is written on create and on every write that changes `questions`.",
10809
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10810
+ httpMethod: "get",
10811
+ pathParams: ["project_id", "decider_id"],
10812
+ queryParams: ["limit", "offset"],
10813
+ headerParams: [],
10814
+ cookieParams: [],
10815
+ flags: [
10816
+ {
10817
+ "name": "project_id",
10818
+ "description": "Project public ID (proj_ prefix).",
10819
+ "required": true,
10820
+ "type": "string",
10821
+ "in": "path"
10822
+ },
10823
+ {
10824
+ "name": "decider_id",
10825
+ "description": "The decider ID",
10826
+ "required": true,
10827
+ "type": "string",
10828
+ "in": "path"
10829
+ },
10830
+ {
10831
+ "name": "limit",
10832
+ "description": "Maximum number of results to return",
10833
+ "required": false,
10834
+ "type": "integer",
10835
+ "in": "query"
10836
+ },
10837
+ {
10838
+ "name": "offset",
10839
+ "description": "Number of results to skip",
10840
+ "required": false,
10841
+ "type": "integer",
10842
+ "in": "query"
10843
+ }
10844
+ ]
10845
+ },
10846
+ "get-decider-version": {
10847
+ serviceClass: "Deciders",
10848
+ operationId: "getDeciderVersion",
10849
+ description: "Returns the question set a version held. A decision names the `decider_version` it was answered under, so this is how its criteria are read after the decider has changed.",
10850
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10851
+ httpMethod: "get",
10852
+ pathParams: [
10853
+ "project_id",
10854
+ "decider_id",
10855
+ "version"
10856
+ ],
10857
+ queryParams: [],
10858
+ headerParams: [],
10859
+ cookieParams: [],
10860
+ flags: [
10861
+ {
10862
+ "name": "project_id",
10863
+ "description": "Project public ID (proj_ prefix).",
10864
+ "required": true,
10865
+ "type": "string",
10866
+ "in": "path"
10867
+ },
10868
+ {
10869
+ "name": "decider_id",
10870
+ "description": "The decider ID",
10871
+ "required": true,
10872
+ "type": "string",
10873
+ "in": "path"
10874
+ },
10875
+ {
10876
+ "name": "version",
10877
+ "description": "The archived version number",
10878
+ "required": true,
10879
+ "type": "integer",
10880
+ "in": "path"
10881
+ }
10882
+ ]
10883
+ },
10884
+ "restore-decider-version": {
10885
+ serviceClass: "Deciders",
10886
+ operationId: "restoreDeciderVersion",
10887
+ description: "Writes an archived question set back as the decider's live one, which archives it again as a new version rather than rewinding the counter. Restoring the question set the decider already holds is a no-op.",
10888
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10889
+ httpMethod: "post",
10890
+ pathParams: [
10891
+ "project_id",
10892
+ "decider_id",
10893
+ "version"
10894
+ ],
10895
+ queryParams: [],
10896
+ headerParams: [],
10897
+ cookieParams: [],
10898
+ flags: [
10899
+ {
10900
+ "name": "project_id",
10901
+ "description": "Project public ID (proj_ prefix).",
10902
+ "required": true,
10903
+ "type": "string",
10904
+ "in": "path"
10905
+ },
10906
+ {
10907
+ "name": "decider_id",
10908
+ "description": "The decider ID",
10909
+ "required": true,
10910
+ "type": "string",
10911
+ "in": "path"
10912
+ },
10913
+ {
10914
+ "name": "version",
10915
+ "description": "The archived version number",
10916
+ "required": true,
10917
+ "type": "integer",
10918
+ "in": "path"
10919
+ },
10920
+ {
10921
+ "name": "label",
10922
+ "description": "Optional tag for the new version. Defaults to `restored from vN`.",
10923
+ "required": false,
10924
+ "type": "string",
10925
+ "in": "body"
10926
+ }
10927
+ ]
10928
+ },
10929
+ "create-decision": {
10930
+ serviceClass: "Deciders",
10931
+ operationId: "createDecision",
10932
+ description: "Evaluates the decider against `state` and records the decision. The questions come from the decider, never from the request, so a call site can only supply what is judged. Everything that can refuse the request is checked before the decision is written, so a refusal is a `4xx` and never a polled failure: the agent's tool surface (`400 DECIDER_AGENT_NOT_TOOL_LESS`), a tool that cannot answer (`400 DECIDER_TOOL_NOT_CALLABLE`), a paused project (`409 PROJECT_PAUSED`) and, for an agent, quota admission (`429 QUOTA_EXCEEDED`). A tool backend is called with `{ state, questions }` and must answer `{ answers: { <question id>: { choice | score | value, probabilities? } } }`; an answer outside that contract fails the decision with `DECISION_ANSWER_INVALID`. With `wait: false`, the default, the answer is `201` with the decision `queued`; poll `GET /v1/projects/{project_id}/decisions/{decision_id}` or subscribe to `decisions.completed` and `decisions.failed`. With `wait: true` it is `201` with the decision settled.",
10933
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10934
+ httpMethod: "post",
10935
+ pathParams: ["project_id", "decider_id"],
10936
+ queryParams: [],
10937
+ headerParams: [],
10938
+ cookieParams: [],
10939
+ flags: [
10940
+ {
10941
+ "name": "project_id",
10942
+ "description": "Project public ID (proj_ prefix).",
10943
+ "required": true,
10944
+ "type": "string",
10945
+ "in": "path"
10946
+ },
10947
+ {
10948
+ "name": "decider_id",
10949
+ "description": "The decider ID",
10950
+ "required": true,
10951
+ "type": "string",
10952
+ "in": "path"
10953
+ },
10954
+ {
10955
+ "name": "state",
10956
+ "description": "What is judged: any JSON value. A string reaches the agent verbatim; anything else is serialized as JSON. Not stored.",
10957
+ "required": true,
10958
+ "type": "string",
10959
+ "in": "body"
10960
+ },
10961
+ {
10962
+ "name": "metadata",
10963
+ "description": "Caller-owned annotations stored on the decision and returned on every read — typically the id of what was judged, since the state itself is not stored. Written once, with the decision. A non-object is rejected with `400 VALIDATION_FAILED` and no decision is written.",
10964
+ "required": false,
10965
+ "type": "object",
10966
+ "in": "body"
10967
+ },
10968
+ {
10969
+ "name": "wait",
10970
+ "description": "True evaluates before answering and returns the settled decision. False — the default — returns the `queued` decision at once.",
10971
+ "required": false,
10972
+ "type": "boolean",
10973
+ "in": "body"
10974
+ }
10975
+ ]
10976
+ },
10977
+ "list-decisions": {
10978
+ serviceClass: "Deciders",
10979
+ operationId: "listDecisions",
10980
+ description: "Returns the decisions in a project, newest first.",
10981
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
10982
+ httpMethod: "get",
10983
+ pathParams: ["project_id"],
10984
+ queryParams: [
10985
+ "decider_id",
10986
+ "status",
10987
+ "limit",
10988
+ "offset"
10989
+ ],
10990
+ headerParams: [],
10991
+ cookieParams: [],
10992
+ flags: [
10993
+ {
10994
+ "name": "project_id",
10995
+ "description": "Project public ID (proj_ prefix).",
10996
+ "required": true,
10997
+ "type": "string",
10998
+ "in": "path"
10999
+ },
11000
+ {
11001
+ "name": "decider_id",
11002
+ "description": "Only decisions requested from this decider",
11003
+ "required": false,
11004
+ "type": "string",
11005
+ "in": "query"
11006
+ },
11007
+ {
11008
+ "name": "status",
11009
+ "description": "Only decisions in this status",
11010
+ "required": false,
11011
+ "type": "string",
11012
+ "in": "query"
11013
+ },
11014
+ {
11015
+ "name": "limit",
11016
+ "description": "Maximum number of results to return",
11017
+ "required": false,
11018
+ "type": "integer",
11019
+ "in": "query"
11020
+ },
11021
+ {
11022
+ "name": "offset",
11023
+ "description": "Number of results to skip",
11024
+ "required": false,
11025
+ "type": "integer",
11026
+ "in": "query"
11027
+ }
11028
+ ]
11029
+ },
11030
+ "get-decision": {
11031
+ serviceClass: "Deciders",
11032
+ operationId: "getDecision",
11033
+ description: "Returns a decision. Poll it after a `wait: false` request until `status` is `completed` or `failed`.",
11034
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/deciders",
11035
+ httpMethod: "get",
11036
+ pathParams: ["project_id", "decision_id"],
11037
+ queryParams: [],
11038
+ headerParams: [],
11039
+ cookieParams: [],
11040
+ flags: [{
11041
+ "name": "project_id",
11042
+ "description": "Project public ID (proj_ prefix).",
11043
+ "required": true,
11044
+ "type": "string",
11045
+ "in": "path"
11046
+ }, {
11047
+ "name": "decision_id",
11048
+ "description": "The decision ID",
11049
+ "required": true,
11050
+ "type": "string",
11051
+ "in": "path"
11052
+ }]
11053
+ },
11054
+ "list-documents": {
11055
+ serviceClass: "Documents",
11056
+ operationId: "listDocuments",
11057
+ description: "Returns all documents in the project named in the path.",
11058
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/documents",
11059
+ httpMethod: "get",
11060
+ pathParams: ["project_id"],
11061
+ queryParams: [
11062
+ "path_prefix",
11063
+ "include_withdrawn",
11064
+ "related_to",
11065
+ "tags",
11066
+ "metadata",
11067
+ "limit",
11068
+ "offset"
11069
+ ],
11070
+ headerParams: [],
11071
+ cookieParams: [],
11072
+ flags: [
11073
+ {
11074
+ "name": "project_id",
11075
+ "description": "Project public ID (proj_ prefix).",
11076
+ "required": true,
11077
+ "type": "string",
11078
+ "in": "path"
11079
+ },
11080
+ {
11081
+ "name": "path_prefix",
11082
+ "description": "Only documents filed under this directory. The prefix is a path boundary, not a substring: `/reports` returns `/reports/q1.txt` and never `/reports-archive/q1.txt`, and `/` selects the whole project. A leading slash is optional and a trailing one is ignored, so `reports`, `/reports` and `/reports/` are the same filter. `%` and `_` are literal characters, not wildcards.",
11083
+ "required": false,
11084
+ "type": "string",
11085
+ "in": "query"
11086
+ },
11087
+ {
11088
+ "name": "include_withdrawn",
11089
+ "description": "Include withdrawn documents. A withdrawn document leaves every default read and is not in the knowledge index at all — its chunks are dropped when it is withdrawn — so this shows it in the listing but never in a search.",
11090
+ "required": false,
11091
+ "type": "boolean",
11092
+ "in": "query"
11093
+ },
11094
+ {
11095
+ "name": "related_to",
11096
+ "description": "Only documents related to this one, on either side of the edge: what it points at, and what points at it. An id with no relations narrows the listing to nothing.",
11097
+ "required": false,
11098
+ "type": "string",
11099
+ "in": "query"
11100
+ },
11101
+ {
11102
+ "name": "tags",
11103
+ "description": "Filter by tag pairs, written `key:value` (split on the first colon, so a value may contain colons). Repeat the parameter for several pairs; **all** must be present with exactly that value.\n",
11104
+ "required": false,
11105
+ "type": "array",
11106
+ "in": "query"
11107
+ },
11108
+ {
11109
+ "name": "metadata",
11110
+ "description": "A `MetadataFilter` as JSON, url-encoded. It travels as JSON rather than as `key:value` pairs because the match is exact and a query string cannot otherwise say whether `3` is the number or the string.",
11111
+ "required": false,
11112
+ "type": "string",
11113
+ "in": "query"
11114
+ },
11115
+ {
11116
+ "name": "limit",
11117
+ "description": "Maximum number of results to return",
11118
+ "required": false,
11119
+ "type": "integer",
11120
+ "in": "query"
11121
+ },
11122
+ {
11123
+ "name": "offset",
11124
+ "description": "Number of results to skip",
11125
+ "required": false,
11126
+ "type": "integer",
11127
+ "in": "query"
11128
+ }
11129
+ ]
11130
+ },
11131
+ "create-document": {
11132
+ serviceClass: "Documents",
11133
+ operationId: "createDocument",
11134
+ description: "Creates a new text document and generates an embedding vector for semantic search, in the project named in the path.",
11135
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/documents",
11136
+ httpMethod: "post",
11137
+ pathParams: ["project_id"],
11138
+ queryParams: [],
11139
+ headerParams: [],
11140
+ cookieParams: [],
11141
+ flags: [
11142
+ {
11143
+ "name": "project_id",
11144
+ "description": "Project public ID (proj_ prefix).",
11145
+ "required": true,
11146
+ "type": "string",
11147
+ "in": "path"
11148
+ },
11149
+ {
11150
+ "name": "content",
11151
+ "description": "",
11152
+ "required": true,
11153
+ "type": "string",
11154
+ "in": "body"
11155
+ },
11156
+ {
11157
+ "name": "path",
11158
+ "description": "Logical path within the project (e.g. /reports/q1.txt). Defaults to `/<filename>`, or to `/<document_id>.txt` when neither is given — a document with no path is reachable only by its id, since a prefix filter never matches null.",
11159
+ "required": false,
11160
+ "type": "string",
11161
+ "in": "body"
11162
+ },
11163
+ {
11164
+ "name": "filename",
11165
+ "description": "",
11166
+ "required": false,
11167
+ "type": "string",
11168
+ "in": "body"
11169
+ },
11170
+ {
11171
+ "name": "title",
11172
+ "description": "Document title",
11173
+ "required": false,
11174
+ "type": "string",
11175
+ "in": "body"
11176
+ },
11177
+ {
11178
+ "name": "metadata",
11179
+ "description": "Arbitrary metadata object. Unlike other body fields, keys are stored and returned verbatim in the casing supplied — they are not converted between snake_case and camelCase.",
11180
+ "required": false,
11181
+ "type": "object",
11182
+ "in": "body"
11183
+ },
11184
+ {
11185
+ "name": "tags",
11186
+ "description": "Key-value labels on a resource. A flat object of string values — an array, a nested object or a number is rejected with `400 VALIDATION_FAILED`, never coerced. Keys are opaque and stored verbatim, so `cost_center` and `costCenter` are two different tags. Matched by JSONB containment wherever tags are read: the `?tags=` filter and knowledge search.\n\nKeys beginning `system.` are reserved: the platform writes them to record which conversation, actor, agent and role a row came from, and a write naming one is refused with `400 RESERVED_TAG_KEY`. They are read and filtered like any other tag.\n\nThe bag is bounded, because every pair reaches the IAM context of every access check on the resource: at most 50 keys, each key at most 128 characters and each value at most 256. A write past a bound — including a merge that would grow the stored bag past the key count — is `400 VALIDATION_FAILED` with `meta.limit` naming the bound it crossed. `system.*` keys are the platform's and do not count against the 50.",
11187
+ "required": false,
11188
+ "type": "object",
11189
+ "in": "body"
11190
+ },
11191
+ {
11192
+ "name": "chunk_strategy",
11193
+ "description": "How to split the content into embeddable chunks. `whole` (default) stores the content as a single chunk; `size` splits into fixed-size character windows with overlap. `page` is equivalent to `whole` for plain text.",
11194
+ "required": false,
11195
+ "type": "string",
11196
+ "in": "body"
11197
+ },
11198
+ {
11199
+ "name": "chunk_size",
11200
+ "description": "Window size in characters when `chunk_strategy=size`. Defaults to 1000.",
11201
+ "required": false,
11202
+ "type": "integer",
11203
+ "in": "body"
11204
+ },
11205
+ {
11206
+ "name": "chunk_overlap",
11207
+ "description": "Overlap in characters between consecutive windows when `chunk_strategy=size`. Defaults to 200.",
11208
+ "required": false,
11209
+ "type": "integer",
11210
+ "in": "body"
11211
+ }
11212
+ ]
11213
+ },
11214
+ "ingest-document": {
11215
+ serviceClass: "Documents",
11216
+ operationId: "ingestDocument",
11217
+ description: "Parses an already-uploaded file and creates one Document split into one or more embedded chunks. The source format is detected from the file's content type: PDFs are parsed page-by-page; `text/plain` and `text/markdown` files are read as a single source. How the source is chunked is controlled by `chunk_strategy`. A file can only back one Document — a second call with the same `file_id` returns `409 FILE_ALREADY_INGESTED`. To re-process an already-ingested file (e.g. with a different `chunk_strategy`), use `POST /documents/{document_id}/ingest`; to ingest the same source under a different path, upload a new copy of the file first.",
11218
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/documents",
11219
+ httpMethod: "post",
10524
11220
  pathParams: ["project_id"],
10525
11221
  queryParams: ["wait"],
10526
11222
  headerParams: [],
@@ -18516,7 +19212,7 @@ const routes = {
18516
19212
  "delete-tool": {
18517
19213
  serviceClass: "Tools",
18518
19214
  operationId: "deleteTool",
18519
- description: "Deletes a tool by ID.",
19215
+ description: "Deletes a tool by ID. A tool that is a decider's backend is refused with `409 TOOL_HAS_DEPENDENTS`.",
18520
19216
  moduleDocsUrl: "https://docs.naturali.ai/docs/modules/tools",
18521
19217
  httpMethod: "delete",
18522
19218
  pathParams: ["project_id", "tool_id"],
@@ -19288,6 +19984,48 @@ const routes = {
19288
19984
  "in": "path"
19289
19985
  }]
19290
19986
  },
19987
+ "list-current-user-statements": {
19988
+ serviceClass: "Users",
19989
+ operationId: "listCurrentUserStatements",
19990
+ description: "What the account owes for each closed billing month, newest first: the subscription fee, prorated by the share of the month each plan was held, and runs past the allowance at the plan's overage rate. Overage is measured against the highest plan held that month. A statement is written within an hour of the month closing, once, and never changes. It is a record to bill from, not a charge and not a tax invoice. Months on the Free plan alone, contract plans and storage are not stated.",
19991
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/users",
19992
+ httpMethod: "get",
19993
+ pathParams: [],
19994
+ queryParams: ["limit", "cursor"],
19995
+ headerParams: [],
19996
+ cookieParams: [],
19997
+ flags: [{
19998
+ "name": "limit",
19999
+ "description": "Maximum items per page — an integer from 1 to 100 (default 20).",
20000
+ "required": false,
20001
+ "type": "integer",
20002
+ "in": "query"
20003
+ }, {
20004
+ "name": "cursor",
20005
+ "description": "The `next_cursor` of the previous page.",
20006
+ "required": false,
20007
+ "type": "string",
20008
+ "in": "query"
20009
+ }]
20010
+ },
20011
+ "get-current-user-statement": {
20012
+ serviceClass: "Users",
20013
+ operationId: "getCurrentUserStatement",
20014
+ description: "One of this account's monthly statements, with its lines and total. Another account's statement answers `404`.",
20015
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/users",
20016
+ httpMethod: "get",
20017
+ pathParams: ["statement_id"],
20018
+ queryParams: [],
20019
+ headerParams: [],
20020
+ cookieParams: [],
20021
+ flags: [{
20022
+ "name": "statement_id",
20023
+ "description": "The statement's ID (stm_ prefix).",
20024
+ "required": true,
20025
+ "type": "string",
20026
+ "in": "path"
20027
+ }]
20028
+ },
19291
20029
  "list-webhooks": {
19292
20030
  serviceClass: "Webhooks",
19293
20031
  operationId: "listWebhooks",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/cli",
3
- "version": "0.154.0",
3
+ "version": "0.156.0",
4
4
  "description": "Command-line interface for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,7 @@
25
25
  "yaml": "^2.9.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@naturali/sdk": "0.154.0",
28
+ "@naturali/sdk": "0.156.0",
29
29
  "@ttoss/openapi-codegen": "^0.3.1",
30
30
  "@types/node": "^26.5.1",
31
31
  "tsdown": "^0.23.0",