@soat/sdk 0.15.9 → 0.15.11

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
@@ -872,7 +872,10 @@ var AiProviders = class {
872
872
  /**
873
873
  * Delete an AI provider
874
874
  *
875
- * Deletes an AI provider configuration
875
+ * Deletes an AI provider configuration.
876
+ *
877
+ * Live references — chats, agents, and discussions that use 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.
878
+ *
876
879
  */
877
880
  static deleteAiProvider(options) {
878
881
  return (options.client ?? client).delete({
@@ -1958,6 +1961,101 @@ var Generations = class {
1958
1961
  });
1959
1962
  }
1960
1963
  };
1964
+ var Guardrails = class {
1965
+ /**
1966
+ * List guardrails
1967
+ *
1968
+ * Returns all guardrails in the project.
1969
+ */
1970
+ static listGuardrails(options) {
1971
+ return (options?.client ?? client).get({
1972
+ url: "/api/v1/guardrails",
1973
+ ...options
1974
+ });
1975
+ }
1976
+ /**
1977
+ * Create a guardrail
1978
+ *
1979
+ * Creates a new guardrail in the project. The `document` is validated on write: `class` must be a literal (A/B/C/D) or a JSON Logic expression, and every variable it (and `guard`) reference must resolve to the `args.*` / `context.*` / `soat.*` namespaces — an out-of-catalog `soat.*` key is rejected with 400.
1980
+ *
1981
+ */
1982
+ static createGuardrail(options) {
1983
+ return (options.client ?? client).post({
1984
+ url: "/api/v1/guardrails",
1985
+ ...options,
1986
+ headers: {
1987
+ "Content-Type": "application/json",
1988
+ ...options.headers
1989
+ }
1990
+ });
1991
+ }
1992
+ /**
1993
+ * Delete a guardrail
1994
+ *
1995
+ * Deletes a guardrail and its archived versions by ID.
1996
+ */
1997
+ static deleteGuardrail(options) {
1998
+ return (options.client ?? client).delete({
1999
+ url: "/api/v1/guardrails/{guardrail_id}",
2000
+ ...options
2001
+ });
2002
+ }
2003
+ /**
2004
+ * Get a guardrail
2005
+ *
2006
+ * Returns a single guardrail by ID.
2007
+ */
2008
+ static getGuardrail(options) {
2009
+ return (options.client ?? client).get({
2010
+ url: "/api/v1/guardrails/{guardrail_id}",
2011
+ ...options
2012
+ });
2013
+ }
2014
+ /**
2015
+ * Update a guardrail
2016
+ *
2017
+ * Updates an existing guardrail. A `document` write increments `version` and archives the prior document as a GuardrailVersion; metadata-only edits (name / description / context) leave the version untouched.
2018
+ *
2019
+ */
2020
+ static updateGuardrail(options) {
2021
+ return (options.client ?? client).patch({
2022
+ url: "/api/v1/guardrails/{guardrail_id}",
2023
+ ...options,
2024
+ headers: {
2025
+ "Content-Type": "application/json",
2026
+ ...options.headers
2027
+ }
2028
+ });
2029
+ }
2030
+ /**
2031
+ * Fetch an archived guardrail version
2032
+ *
2033
+ * Returns the exact `document` that governed at a given version. Approval items, activity entries, and exceptions record the version that governed them, so the audit chain survives edits.
2034
+ *
2035
+ */
2036
+ static getGuardrailVersion(options) {
2037
+ return (options.client ?? client).get({
2038
+ url: "/api/v1/guardrails/{guardrail_id}/versions/{version}",
2039
+ ...options
2040
+ });
2041
+ }
2042
+ /**
2043
+ * Dry-run evaluate a guardrail
2044
+ *
2045
+ * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `soat.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `soat.tool.*`.
2046
+ *
2047
+ */
2048
+ static evaluateGuardrail(options) {
2049
+ return (options.client ?? client).post({
2050
+ url: "/api/v1/guardrails/{guardrail_id}/evaluate",
2051
+ ...options,
2052
+ headers: {
2053
+ "Content-Type": "application/json",
2054
+ ...options.headers
2055
+ }
2056
+ });
2057
+ }
2058
+ };
1961
2059
  var IngestionRules = class {
1962
2060
  /**
1963
2061
  * List ingestion rules
@@ -2447,9 +2545,9 @@ var Projects = class {
2447
2545
  });
2448
2546
  }
2449
2547
  /**
2450
- * Rename a project
2548
+ * Update a project
2451
2549
  *
2452
- * Updates a project's name. Requires admin role.
2550
+ * Updates a project's name and/or its attached guardrails (`guardrail_ids` — the project-scope baseline governing every tool call by every agent in the project). Requires admin role. Detaching a guardrail (removing an id) additionally requires guardrails:DetachGuardrail.
2453
2551
  */
2454
2552
  static updateProject(options) {
2455
2553
  return (options.client ?? client).patch({
@@ -2763,7 +2861,7 @@ var Tasks = class {
2763
2861
  /**
2764
2862
  * Update a task
2765
2863
  *
2766
- * Updates a task's payload, title, or assignee. `state` is never directly writable — move it with a transition. `payload` is shallow-merged over the existing payload (PATCH semantics): keys the request omits are preserved, so setting one field never discards values an on_enter automation wrote (e.g. `last_result`). The merged payload is validated against the workflow's `payload_schema`.
2864
+ * Updates a task's payload, title, or assignee. `state` is never directly writable — move it with a transition; sending a `state` field is rejected as an unknown field (`VALIDATION_FAILED`). `payload` is shallow-merged over the existing payload (PATCH semantics): keys the request omits are preserved, so setting one field never discards values an on_enter automation wrote (e.g. `last_result`). The merged payload is validated against the workflow's `payload_schema`.
2767
2865
  */
2768
2866
  static updateTask(options) {
2769
2867
  return (options.client ?? client).patch({
@@ -2778,7 +2876,7 @@ var Tasks = class {
2778
2876
  /**
2779
2877
  * Transition a task
2780
2878
  *
2781
- * Fires a named transition on a task. The transition must exist in the workflow and be valid from the task's current state; its guard must pass. This is the single path every state change routes through.
2879
+ * Fires a named transition on a task. The transition must exist in the workflow and be valid from the task's current state; its guard must pass. This is the single path every state change routes through. A transition declaring `requires_approval` does not move the task — it parks a pending ApprovalItem and returns the task with `pending_transition` set; the move applies only when the approval is approved.
2782
2880
  */
2783
2881
  static transitionTask(options) {
2784
2882
  return (options.client ?? client).post({
@@ -3546,6 +3644,7 @@ exports.Embeddings = Embeddings;
3546
3644
  exports.Files = Files;
3547
3645
  exports.Formations = Formations;
3548
3646
  exports.Generations = Generations;
3647
+ exports.Guardrails = Guardrails;
3549
3648
  exports.IngestionRules = IngestionRules;
3550
3649
  exports.Knowledge = Knowledge;
3551
3650
  exports.Memories = Memories;