@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.cjs CHANGED
@@ -1155,6 +1155,18 @@ var Admin = class {
1155
1155
  ...options
1156
1156
  });
1157
1157
  }
1158
+ /**
1159
+ * List a user's monthly statements
1160
+ *
1161
+ * The same statements the account reads at `GET /v1/users/me/statements`, for an operator to bill from. Needs the `admin` role.
1162
+ *
1163
+ */
1164
+ static listUserStatements(options) {
1165
+ return (options.client ?? client).get({
1166
+ url: "/v1/admin/users/{user_id}/statements",
1167
+ ...options
1168
+ });
1169
+ }
1158
1170
  };
1159
1171
  var Agents = class {
1160
1172
  /**
@@ -1984,6 +1996,151 @@ var Conversations = class {
1984
1996
  });
1985
1997
  }
1986
1998
  };
1999
+ var Deciders = class {
2000
+ /**
2001
+ * List deciders
2002
+ *
2003
+ * Returns the deciders defined in a project, newest first.
2004
+ */
2005
+ static listDeciders(options) {
2006
+ return (options.client ?? client).get({
2007
+ url: "/v1/projects/{project_id}/deciders",
2008
+ ...options
2009
+ });
2010
+ }
2011
+ /**
2012
+ * Create a decider
2013
+ *
2014
+ * 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`.
2015
+ */
2016
+ static createDecider(options) {
2017
+ return (options.client ?? client).post({
2018
+ url: "/v1/projects/{project_id}/deciders",
2019
+ ...options,
2020
+ headers: {
2021
+ "Content-Type": "application/json",
2022
+ ...options.headers
2023
+ }
2024
+ });
2025
+ }
2026
+ /**
2027
+ * Delete a decider
2028
+ *
2029
+ * Deletes a decider and its version archive. Its decisions remain and keep naming the decider's ID.
2030
+ */
2031
+ static deleteDecider(options) {
2032
+ return (options.client ?? client).delete({
2033
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2034
+ ...options
2035
+ });
2036
+ }
2037
+ /**
2038
+ * Get a decider
2039
+ *
2040
+ * Returns a decider with its current question set and version.
2041
+ */
2042
+ static getDecider(options) {
2043
+ return (options.client ?? client).get({
2044
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2045
+ ...options
2046
+ });
2047
+ }
2048
+ /**
2049
+ * Update a decider
2050
+ *
2051
+ * 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.
2052
+ */
2053
+ static updateDecider(options) {
2054
+ return (options.client ?? client).patch({
2055
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2056
+ ...options,
2057
+ headers: {
2058
+ "Content-Type": "application/json",
2059
+ ...options.headers
2060
+ }
2061
+ });
2062
+ }
2063
+ /**
2064
+ * List a decider's versions
2065
+ *
2066
+ * Returns the decider's archived question sets, newest first. A version is written on create and on every write that changes `questions`.
2067
+ */
2068
+ static listDeciderVersions(options) {
2069
+ return (options.client ?? client).get({
2070
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions",
2071
+ ...options
2072
+ });
2073
+ }
2074
+ /**
2075
+ * Fetch an archived decider version
2076
+ *
2077
+ * 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.
2078
+ */
2079
+ static getDeciderVersion(options) {
2080
+ return (options.client ?? client).get({
2081
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}",
2082
+ ...options
2083
+ });
2084
+ }
2085
+ /**
2086
+ * Restore an archived decider version
2087
+ *
2088
+ * 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.
2089
+ */
2090
+ static restoreDeciderVersion(options) {
2091
+ return (options.client ?? client).post({
2092
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}/restore",
2093
+ ...options,
2094
+ headers: {
2095
+ "Content-Type": "application/json",
2096
+ ...options.headers
2097
+ }
2098
+ });
2099
+ }
2100
+ /**
2101
+ * Request a decision
2102
+ *
2103
+ * 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.
2104
+ *
2105
+ * 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`).
2106
+ *
2107
+ * 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`.
2108
+ *
2109
+ * 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.
2110
+ */
2111
+ static createDecision(options) {
2112
+ return (options.client ?? client).post({
2113
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/decisions",
2114
+ ...options,
2115
+ headers: {
2116
+ "Content-Type": "application/json",
2117
+ ...options.headers
2118
+ }
2119
+ });
2120
+ }
2121
+ /**
2122
+ * List decisions
2123
+ *
2124
+ * Returns the decisions in a project, newest first.
2125
+ */
2126
+ static listDecisions(options) {
2127
+ return (options.client ?? client).get({
2128
+ url: "/v1/projects/{project_id}/decisions",
2129
+ ...options
2130
+ });
2131
+ }
2132
+ /**
2133
+ * Get a decision
2134
+ *
2135
+ * Returns a decision. Poll it after a `wait: false` request until `status` is `completed` or `failed`.
2136
+ */
2137
+ static getDecision(options) {
2138
+ return (options.client ?? client).get({
2139
+ url: "/v1/projects/{project_id}/decisions/{decision_id}",
2140
+ ...options
2141
+ });
2142
+ }
2143
+ };
1987
2144
  var Documents = class {
1988
2145
  /**
1989
2146
  * List documents
@@ -4669,7 +4826,7 @@ var Tools = class {
4669
4826
  /**
4670
4827
  * Delete a tool
4671
4828
  *
4672
- * Deletes a tool by ID.
4829
+ * Deletes a tool by ID. A tool that is a decider's backend is refused with `409 TOOL_HAS_DEPENDENTS`.
4673
4830
  */
4674
4831
  static deleteTool(options) {
4675
4832
  return (options.client ?? client).delete({
@@ -5010,6 +5167,32 @@ var Users = class {
5010
5167
  ...options
5011
5168
  });
5012
5169
  }
5170
+ /**
5171
+ * List the account's monthly statements
5172
+ *
5173
+ * 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.
5174
+ *
5175
+ * 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.
5176
+ *
5177
+ */
5178
+ static listCurrentUserStatements(options) {
5179
+ return (options?.client ?? client).get({
5180
+ url: "/v1/users/me/statements",
5181
+ ...options
5182
+ });
5183
+ }
5184
+ /**
5185
+ * Get a monthly statement
5186
+ *
5187
+ * One of this account's monthly statements, with its lines and total. Another account's statement answers `404`.
5188
+ *
5189
+ */
5190
+ static getCurrentUserStatement(options) {
5191
+ return (options.client ?? client).get({
5192
+ url: "/v1/users/me/statements/{statement_id}",
5193
+ ...options
5194
+ });
5195
+ }
5013
5196
  };
5014
5197
  var Webhooks = class {
5015
5198
  /**
@@ -5304,6 +5487,7 @@ var NaturaliClient = class {
5304
5487
  channels;
5305
5488
  auth;
5306
5489
  conversations;
5490
+ deciders;
5307
5491
  documents;
5308
5492
  embeddings;
5309
5493
  evaluations;
@@ -5356,6 +5540,7 @@ var NaturaliClient = class {
5356
5540
  this.channels = bindResource(Channels, this.http);
5357
5541
  this.auth = bindResource(Auth, this.http);
5358
5542
  this.conversations = bindResource(Conversations, this.http);
5543
+ this.deciders = bindResource(Deciders, this.http);
5359
5544
  this.documents = bindResource(Documents, this.http);
5360
5545
  this.embeddings = bindResource(Embeddings, this.http);
5361
5546
  this.evaluations = bindResource(Evaluations, this.http);
@@ -5401,6 +5586,7 @@ exports.Auth = Auth;
5401
5586
  exports.Chains = Chains;
5402
5587
  exports.Channels = Channels;
5403
5588
  exports.Conversations = Conversations;
5589
+ exports.Deciders = Deciders;
5404
5590
  exports.Documents = Documents;
5405
5591
  exports.Embeddings = Embeddings;
5406
5592
  exports.Evaluations = Evaluations;