@naturali/sdk 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.
package/dist/index.mjs CHANGED
@@ -1154,6 +1154,18 @@ var Admin = class {
1154
1154
  ...options
1155
1155
  });
1156
1156
  }
1157
+ /**
1158
+ * List a user's monthly statements
1159
+ *
1160
+ * The same statements the account reads at `GET /v1/users/me/statements`, for an operator to bill from. Needs the `admin` role.
1161
+ *
1162
+ */
1163
+ static listUserStatements(options) {
1164
+ return (options.client ?? client).get({
1165
+ url: "/v1/admin/users/{user_id}/statements",
1166
+ ...options
1167
+ });
1168
+ }
1157
1169
  };
1158
1170
  var Agents = class {
1159
1171
  /**
@@ -1983,6 +1995,151 @@ var Conversations = class {
1983
1995
  });
1984
1996
  }
1985
1997
  };
1998
+ var Deciders = class {
1999
+ /**
2000
+ * List deciders
2001
+ *
2002
+ * Returns the deciders defined in a project, newest first.
2003
+ */
2004
+ static listDeciders(options) {
2005
+ return (options.client ?? client).get({
2006
+ url: "/v1/projects/{project_id}/deciders",
2007
+ ...options
2008
+ });
2009
+ }
2010
+ /**
2011
+ * Create a decider
2012
+ *
2013
+ * 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`.
2014
+ */
2015
+ static createDecider(options) {
2016
+ return (options.client ?? client).post({
2017
+ url: "/v1/projects/{project_id}/deciders",
2018
+ ...options,
2019
+ headers: {
2020
+ "Content-Type": "application/json",
2021
+ ...options.headers
2022
+ }
2023
+ });
2024
+ }
2025
+ /**
2026
+ * Delete a decider
2027
+ *
2028
+ * Deletes a decider and its version archive. Its decisions remain and keep naming the decider's ID.
2029
+ */
2030
+ static deleteDecider(options) {
2031
+ return (options.client ?? client).delete({
2032
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2033
+ ...options
2034
+ });
2035
+ }
2036
+ /**
2037
+ * Get a decider
2038
+ *
2039
+ * Returns a decider with its current question set and version.
2040
+ */
2041
+ static getDecider(options) {
2042
+ return (options.client ?? client).get({
2043
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2044
+ ...options
2045
+ });
2046
+ }
2047
+ /**
2048
+ * Update a decider
2049
+ *
2050
+ * 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.
2051
+ */
2052
+ static updateDecider(options) {
2053
+ return (options.client ?? client).patch({
2054
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2055
+ ...options,
2056
+ headers: {
2057
+ "Content-Type": "application/json",
2058
+ ...options.headers
2059
+ }
2060
+ });
2061
+ }
2062
+ /**
2063
+ * List a decider's versions
2064
+ *
2065
+ * Returns the decider's archived question sets, newest first. A version is written on create and on every write that changes `questions`.
2066
+ */
2067
+ static listDeciderVersions(options) {
2068
+ return (options.client ?? client).get({
2069
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions",
2070
+ ...options
2071
+ });
2072
+ }
2073
+ /**
2074
+ * Fetch an archived decider version
2075
+ *
2076
+ * 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.
2077
+ */
2078
+ static getDeciderVersion(options) {
2079
+ return (options.client ?? client).get({
2080
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}",
2081
+ ...options
2082
+ });
2083
+ }
2084
+ /**
2085
+ * Restore an archived decider version
2086
+ *
2087
+ * 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.
2088
+ */
2089
+ static restoreDeciderVersion(options) {
2090
+ return (options.client ?? client).post({
2091
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}/restore",
2092
+ ...options,
2093
+ headers: {
2094
+ "Content-Type": "application/json",
2095
+ ...options.headers
2096
+ }
2097
+ });
2098
+ }
2099
+ /**
2100
+ * Request a decision
2101
+ *
2102
+ * 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.
2103
+ *
2104
+ * 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`).
2105
+ *
2106
+ * 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`.
2107
+ *
2108
+ * 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.
2109
+ */
2110
+ static createDecision(options) {
2111
+ return (options.client ?? client).post({
2112
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/decisions",
2113
+ ...options,
2114
+ headers: {
2115
+ "Content-Type": "application/json",
2116
+ ...options.headers
2117
+ }
2118
+ });
2119
+ }
2120
+ /**
2121
+ * List decisions
2122
+ *
2123
+ * Returns the decisions in a project, newest first.
2124
+ */
2125
+ static listDecisions(options) {
2126
+ return (options.client ?? client).get({
2127
+ url: "/v1/projects/{project_id}/decisions",
2128
+ ...options
2129
+ });
2130
+ }
2131
+ /**
2132
+ * Get a decision
2133
+ *
2134
+ * Returns a decision. Poll it after a `wait: false` request until `status` is `completed` or `failed`.
2135
+ */
2136
+ static getDecision(options) {
2137
+ return (options.client ?? client).get({
2138
+ url: "/v1/projects/{project_id}/decisions/{decision_id}",
2139
+ ...options
2140
+ });
2141
+ }
2142
+ };
1986
2143
  var Documents = class {
1987
2144
  /**
1988
2145
  * List documents
@@ -4668,7 +4825,7 @@ var Tools = class {
4668
4825
  /**
4669
4826
  * Delete a tool
4670
4827
  *
4671
- * Deletes a tool by ID.
4828
+ * Deletes a tool by ID. A tool that is a decider's backend is refused with `409 TOOL_HAS_DEPENDENTS`.
4672
4829
  */
4673
4830
  static deleteTool(options) {
4674
4831
  return (options.client ?? client).delete({
@@ -5009,6 +5166,32 @@ var Users = class {
5009
5166
  ...options
5010
5167
  });
5011
5168
  }
5169
+ /**
5170
+ * List the account's monthly statements
5171
+ *
5172
+ * 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.
5173
+ *
5174
+ * 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.
5175
+ *
5176
+ */
5177
+ static listCurrentUserStatements(options) {
5178
+ return (options?.client ?? client).get({
5179
+ url: "/v1/users/me/statements",
5180
+ ...options
5181
+ });
5182
+ }
5183
+ /**
5184
+ * Get a monthly statement
5185
+ *
5186
+ * One of this account's monthly statements, with its lines and total. Another account's statement answers `404`.
5187
+ *
5188
+ */
5189
+ static getCurrentUserStatement(options) {
5190
+ return (options.client ?? client).get({
5191
+ url: "/v1/users/me/statements/{statement_id}",
5192
+ ...options
5193
+ });
5194
+ }
5012
5195
  };
5013
5196
  var Webhooks = class {
5014
5197
  /**
@@ -5303,6 +5486,7 @@ var NaturaliClient = class {
5303
5486
  channels;
5304
5487
  auth;
5305
5488
  conversations;
5489
+ deciders;
5306
5490
  documents;
5307
5491
  embeddings;
5308
5492
  evaluations;
@@ -5355,6 +5539,7 @@ var NaturaliClient = class {
5355
5539
  this.channels = bindResource(Channels, this.http);
5356
5540
  this.auth = bindResource(Auth, this.http);
5357
5541
  this.conversations = bindResource(Conversations, this.http);
5542
+ this.deciders = bindResource(Deciders, this.http);
5358
5543
  this.documents = bindResource(Documents, this.http);
5359
5544
  this.embeddings = bindResource(Embeddings, this.http);
5360
5545
  this.evaluations = bindResource(Evaluations, this.http);
@@ -5386,4 +5571,4 @@ var NaturaliClient = class {
5386
5571
  }
5387
5572
  };
5388
5573
  //#endregion
5389
- export { Activity, Actors, Admin, AgentVersions, Agents, AiProviders, ApiKeys, Approvals, Assistant, AuditLog, Auth, Chains, Channels, Conversations, Documents, Embeddings, Evaluations, Exceptions, Files, Formations, Generations, Guardrails, IngestionRules, Knowledge, Memories, MemoryRules, MemoryStores, MetadataSchemas, ModelRoutes, Models, NaturaliClient, Orchestrations, Projects, Quotas, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
5574
+ export { Activity, Actors, Admin, AgentVersions, Agents, AiProviders, ApiKeys, Approvals, Assistant, AuditLog, Auth, Chains, Channels, Conversations, Deciders, Documents, Embeddings, Evaluations, Exceptions, Files, Formations, Generations, Guardrails, IngestionRules, Knowledge, Memories, MemoryRules, MemoryStores, MetadataSchemas, ModelRoutes, Models, NaturaliClient, Orchestrations, Projects, Quotas, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.154.0",
3
+ "version": "0.156.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hey-api/openapi-ts": "^0.99.0",
34
- "@naturali/api": "0.154.0",
34
+ "@naturali/api": "0.156.0",
35
35
  "@ttoss/openapi-codegen": "^0.3.1",
36
36
  "@types/node": "^26.5.1",
37
37
  "tsdown": "^0.23.0",