@naturali/sdk 0.154.0 → 0.155.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
@@ -1984,6 +1984,151 @@ var Conversations = class {
1984
1984
  });
1985
1985
  }
1986
1986
  };
1987
+ var Deciders = class {
1988
+ /**
1989
+ * List deciders
1990
+ *
1991
+ * Returns the deciders defined in a project, newest first.
1992
+ */
1993
+ static listDeciders(options) {
1994
+ return (options.client ?? client).get({
1995
+ url: "/v1/projects/{project_id}/deciders",
1996
+ ...options
1997
+ });
1998
+ }
1999
+ /**
2000
+ * Create a decider
2001
+ *
2002
+ * 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`.
2003
+ */
2004
+ static createDecider(options) {
2005
+ return (options.client ?? client).post({
2006
+ url: "/v1/projects/{project_id}/deciders",
2007
+ ...options,
2008
+ headers: {
2009
+ "Content-Type": "application/json",
2010
+ ...options.headers
2011
+ }
2012
+ });
2013
+ }
2014
+ /**
2015
+ * Delete a decider
2016
+ *
2017
+ * Deletes a decider and its version archive. Its decisions remain and keep naming the decider's ID.
2018
+ */
2019
+ static deleteDecider(options) {
2020
+ return (options.client ?? client).delete({
2021
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2022
+ ...options
2023
+ });
2024
+ }
2025
+ /**
2026
+ * Get a decider
2027
+ *
2028
+ * Returns a decider with its current question set and version.
2029
+ */
2030
+ static getDecider(options) {
2031
+ return (options.client ?? client).get({
2032
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2033
+ ...options
2034
+ });
2035
+ }
2036
+ /**
2037
+ * Update a decider
2038
+ *
2039
+ * 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.
2040
+ */
2041
+ static updateDecider(options) {
2042
+ return (options.client ?? client).patch({
2043
+ url: "/v1/projects/{project_id}/deciders/{decider_id}",
2044
+ ...options,
2045
+ headers: {
2046
+ "Content-Type": "application/json",
2047
+ ...options.headers
2048
+ }
2049
+ });
2050
+ }
2051
+ /**
2052
+ * List a decider's versions
2053
+ *
2054
+ * Returns the decider's archived question sets, newest first. A version is written on create and on every write that changes `questions`.
2055
+ */
2056
+ static listDeciderVersions(options) {
2057
+ return (options.client ?? client).get({
2058
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions",
2059
+ ...options
2060
+ });
2061
+ }
2062
+ /**
2063
+ * Fetch an archived decider version
2064
+ *
2065
+ * 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.
2066
+ */
2067
+ static getDeciderVersion(options) {
2068
+ return (options.client ?? client).get({
2069
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}",
2070
+ ...options
2071
+ });
2072
+ }
2073
+ /**
2074
+ * Restore an archived decider version
2075
+ *
2076
+ * 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.
2077
+ */
2078
+ static restoreDeciderVersion(options) {
2079
+ return (options.client ?? client).post({
2080
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/versions/{version}/restore",
2081
+ ...options,
2082
+ headers: {
2083
+ "Content-Type": "application/json",
2084
+ ...options.headers
2085
+ }
2086
+ });
2087
+ }
2088
+ /**
2089
+ * Request a decision
2090
+ *
2091
+ * 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.
2092
+ *
2093
+ * 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`).
2094
+ *
2095
+ * 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`.
2096
+ *
2097
+ * 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.
2098
+ */
2099
+ static createDecision(options) {
2100
+ return (options.client ?? client).post({
2101
+ url: "/v1/projects/{project_id}/deciders/{decider_id}/decisions",
2102
+ ...options,
2103
+ headers: {
2104
+ "Content-Type": "application/json",
2105
+ ...options.headers
2106
+ }
2107
+ });
2108
+ }
2109
+ /**
2110
+ * List decisions
2111
+ *
2112
+ * Returns the decisions in a project, newest first.
2113
+ */
2114
+ static listDecisions(options) {
2115
+ return (options.client ?? client).get({
2116
+ url: "/v1/projects/{project_id}/decisions",
2117
+ ...options
2118
+ });
2119
+ }
2120
+ /**
2121
+ * Get a decision
2122
+ *
2123
+ * Returns a decision. Poll it after a `wait: false` request until `status` is `completed` or `failed`.
2124
+ */
2125
+ static getDecision(options) {
2126
+ return (options.client ?? client).get({
2127
+ url: "/v1/projects/{project_id}/decisions/{decision_id}",
2128
+ ...options
2129
+ });
2130
+ }
2131
+ };
1987
2132
  var Documents = class {
1988
2133
  /**
1989
2134
  * List documents
@@ -4669,7 +4814,7 @@ var Tools = class {
4669
4814
  /**
4670
4815
  * Delete a tool
4671
4816
  *
4672
- * Deletes a tool by ID.
4817
+ * Deletes a tool by ID. A tool that is a decider's backend is refused with `409 TOOL_HAS_DEPENDENTS`.
4673
4818
  */
4674
4819
  static deleteTool(options) {
4675
4820
  return (options.client ?? client).delete({
@@ -5304,6 +5449,7 @@ var NaturaliClient = class {
5304
5449
  channels;
5305
5450
  auth;
5306
5451
  conversations;
5452
+ deciders;
5307
5453
  documents;
5308
5454
  embeddings;
5309
5455
  evaluations;
@@ -5356,6 +5502,7 @@ var NaturaliClient = class {
5356
5502
  this.channels = bindResource(Channels, this.http);
5357
5503
  this.auth = bindResource(Auth, this.http);
5358
5504
  this.conversations = bindResource(Conversations, this.http);
5505
+ this.deciders = bindResource(Deciders, this.http);
5359
5506
  this.documents = bindResource(Documents, this.http);
5360
5507
  this.embeddings = bindResource(Embeddings, this.http);
5361
5508
  this.evaluations = bindResource(Evaluations, this.http);
@@ -5401,6 +5548,7 @@ exports.Auth = Auth;
5401
5548
  exports.Chains = Chains;
5402
5549
  exports.Channels = Channels;
5403
5550
  exports.Conversations = Conversations;
5551
+ exports.Deciders = Deciders;
5404
5552
  exports.Documents = Documents;
5405
5553
  exports.Embeddings = Embeddings;
5406
5554
  exports.Evaluations = Evaluations;