@soat/sdk 0.13.20 → 0.14.1

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
@@ -107,7 +107,8 @@ function createSseClient({ onRequest, onSseError, onSseEvent, responseTransforme
107
107
  } catch (error) {
108
108
  onSseError?.(error);
109
109
  if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
110
- await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
110
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
111
+ await sleep(backoff);
111
112
  }
112
113
  }
113
114
  };
@@ -1221,6 +1222,109 @@ var Conversations = class {
1221
1222
  });
1222
1223
  }
1223
1224
  };
1225
+ var Discussions = class {
1226
+ /**
1227
+ * List discussions
1228
+ *
1229
+ * Returns all discussions the caller has access to. If project_id is provided, returns only discussions in that project.
1230
+ */
1231
+ static listDiscussions(options) {
1232
+ return (options?.client ?? client).get({
1233
+ url: "/api/v1/discussions",
1234
+ ...options
1235
+ });
1236
+ }
1237
+ /**
1238
+ * Create a discussion
1239
+ *
1240
+ * Creates a new discussion config. project keys infer the project from the key's scope; JWT callers must supply project_id.
1241
+ */
1242
+ static createDiscussion(options) {
1243
+ return (options.client ?? client).post({
1244
+ url: "/api/v1/discussions",
1245
+ ...options,
1246
+ headers: {
1247
+ "Content-Type": "application/json",
1248
+ ...options.headers
1249
+ }
1250
+ });
1251
+ }
1252
+ /**
1253
+ * Get a discussion run by ID
1254
+ *
1255
+ * Returns a single discussion run, including its outcome, transcript conversation, and outcome document.
1256
+ */
1257
+ static getDiscussionRun(options) {
1258
+ return (options.client ?? client).get({
1259
+ url: "/api/v1/discussions/runs/{run_id}",
1260
+ ...options
1261
+ });
1262
+ }
1263
+ /**
1264
+ * Delete a discussion
1265
+ *
1266
+ * Deletes a discussion config and its participants.
1267
+ */
1268
+ static deleteDiscussion(options) {
1269
+ return (options.client ?? client).delete({
1270
+ url: "/api/v1/discussions/{discussion_id}",
1271
+ ...options
1272
+ });
1273
+ }
1274
+ /**
1275
+ * Get a discussion by ID
1276
+ *
1277
+ * Returns a discussion config with its participants.
1278
+ */
1279
+ static getDiscussion(options) {
1280
+ return (options.client ?? client).get({
1281
+ url: "/api/v1/discussions/{discussion_id}",
1282
+ ...options
1283
+ });
1284
+ }
1285
+ /**
1286
+ * Update a discussion
1287
+ *
1288
+ * Updates a discussion. Providing participants replaces the full set (not merged).
1289
+ */
1290
+ static updateDiscussion(options) {
1291
+ return (options.client ?? client).patch({
1292
+ url: "/api/v1/discussions/{discussion_id}",
1293
+ ...options,
1294
+ headers: {
1295
+ "Content-Type": "application/json",
1296
+ ...options.headers
1297
+ }
1298
+ });
1299
+ }
1300
+ /**
1301
+ * List a discussion's runs
1302
+ *
1303
+ * Returns the run history of a discussion, most recent first.
1304
+ */
1305
+ static listDiscussionRuns(options) {
1306
+ return (options.client ?? client).get({
1307
+ url: "/api/v1/discussions/{discussion_id}/runs",
1308
+ ...options
1309
+ });
1310
+ }
1311
+ /**
1312
+ * Invoke a discussion
1313
+ *
1314
+ * Runs the discussion synchronously over the given topic and returns the completed run, whose outcome inlines the synthesized text. The run's transcript is persisted as a conversation and the outcome as a document.
1315
+ *
1316
+ */
1317
+ static createDiscussionRun(options) {
1318
+ return (options.client ?? client).post({
1319
+ url: "/api/v1/discussions/{discussion_id}/runs",
1320
+ ...options,
1321
+ headers: {
1322
+ "Content-Type": "application/json",
1323
+ ...options.headers
1324
+ }
1325
+ });
1326
+ }
1327
+ };
1224
1328
  var Documents = class {
1225
1329
  /**
1226
1330
  * List documents
@@ -2062,7 +2166,7 @@ var Orchestrations = class {
2062
2166
  /**
2063
2167
  * Start an orchestration run
2064
2168
  *
2065
- * Creates a new run for the orchestration named by orchestration_id. By default the run executes durably in the background: the response returns immediately with status "running" and progress is observed via get-orchestration-run or run lifecycle webhook events (orchestration_runs.started/paused/completed/failed). Delay and poll waits are offloaded to a background scheduler and survive restarts. Pass wait=true to block until the run reaches a terminal or paused state (the legacy synchronous behaviour).
2169
+ * Creates a new run for the orchestration named by orchestration_id. By default the run executes durably in the background: the response returns immediately with status "running" and progress is observed via get-orchestration-run or run lifecycle webhook events (orchestration_runs.started/awaiting_input/succeeded/failed). Delay and poll waits park the run as "sleeping" and are woken by a background scheduler, surviving restarts. Pass wait=true to block until the run reaches a terminal or awaiting_input state (the legacy synchronous behaviour).
2066
2170
  */
2067
2171
  static startOrchestrationRun(options) {
2068
2172
  return (options.client ?? client).post({
@@ -2077,7 +2181,7 @@ var Orchestrations = class {
2077
2181
  /**
2078
2182
  * Cancel an orchestration run
2079
2183
  *
2080
- * Cancels a running or paused orchestration run.
2184
+ * Cancels a run that has not yet reached a terminal state.
2081
2185
  */
2082
2186
  static cancelOrchestrationRun(options) {
2083
2187
  return (options.client ?? client).post({
@@ -2088,7 +2192,7 @@ var Orchestrations = class {
2088
2192
  /**
2089
2193
  * Submit human input
2090
2194
  *
2091
- * Provides human input to a paused orchestration run waiting at a human node.
2195
+ * Provides human input to a run that is awaiting_input at a human node.
2092
2196
  */
2093
2197
  static submitHumanInput(options) {
2094
2198
  return (options.client ?? client).post({
@@ -2103,7 +2207,7 @@ var Orchestrations = class {
2103
2207
  /**
2104
2208
  * Resume an orchestration run
2105
2209
  *
2106
- * Resumes a paused orchestration run from its last checkpoint.
2210
+ * Resumes an awaiting_input orchestration run from its last checkpoint.
2107
2211
  */
2108
2212
  static resumeOrchestrationRun(options) {
2109
2213
  return (options.client ?? client).post({
@@ -2356,7 +2460,8 @@ var Sessions = class {
2356
2460
  /**
2357
2461
  * Delete a session
2358
2462
  *
2359
- * Deletes the session and its underlying conversation and actors.
2463
+ * Deletes the session and its underlying conversation and messages. The session's actor is not deleted. Generations and traces produced by the session are not deleted either, since they are not linked to the session or conversation.
2464
+ *
2360
2465
  */
2361
2466
  static deleteSession(options) {
2362
2467
  return (options.client ?? client).delete({
@@ -2599,6 +2704,130 @@ var Traces = class {
2599
2704
  });
2600
2705
  }
2601
2706
  };
2707
+ var Triggers = class {
2708
+ /**
2709
+ * List triggers
2710
+ *
2711
+ * Lists triggers. Filter by project, starter type, or target type.
2712
+ */
2713
+ static listTriggers(options) {
2714
+ return (options?.client ?? client).get({
2715
+ url: "/api/v1/triggers",
2716
+ ...options
2717
+ });
2718
+ }
2719
+ /**
2720
+ * Create a trigger
2721
+ *
2722
+ * Creates a new trigger for a project
2723
+ */
2724
+ static createTrigger(options) {
2725
+ return (options.client ?? client).post({
2726
+ url: "/api/v1/triggers",
2727
+ ...options,
2728
+ headers: {
2729
+ "Content-Type": "application/json",
2730
+ ...options.headers
2731
+ }
2732
+ });
2733
+ }
2734
+ /**
2735
+ * Delete a trigger
2736
+ *
2737
+ * Deletes a trigger
2738
+ */
2739
+ static deleteTrigger(options) {
2740
+ return (options.client ?? client).delete({
2741
+ url: "/api/v1/triggers/{trigger_id}",
2742
+ ...options
2743
+ });
2744
+ }
2745
+ /**
2746
+ * Get a trigger
2747
+ *
2748
+ * Retrieves the details of a specific trigger
2749
+ */
2750
+ static getTrigger(options) {
2751
+ return (options.client ?? client).get({
2752
+ url: "/api/v1/triggers/{trigger_id}",
2753
+ ...options
2754
+ });
2755
+ }
2756
+ /**
2757
+ * Update a trigger
2758
+ *
2759
+ * Updates an existing trigger's configuration. The type is immutable.
2760
+ */
2761
+ static updateTrigger(options) {
2762
+ return (options.client ?? client).patch({
2763
+ url: "/api/v1/triggers/{trigger_id}",
2764
+ ...options,
2765
+ headers: {
2766
+ "Content-Type": "application/json",
2767
+ ...options.headers
2768
+ }
2769
+ });
2770
+ }
2771
+ /**
2772
+ * Fire a trigger
2773
+ *
2774
+ * Fires a trigger synchronously and returns the terminal firing record.
2775
+ */
2776
+ static fireTrigger(options) {
2777
+ return (options.client ?? client).post({
2778
+ url: "/api/v1/triggers/{trigger_id}/fire",
2779
+ ...options,
2780
+ headers: {
2781
+ "Content-Type": "application/json",
2782
+ ...options.headers
2783
+ }
2784
+ });
2785
+ }
2786
+ /**
2787
+ * Get trigger secret
2788
+ *
2789
+ * Retrieves the signing secret for a webhook trigger
2790
+ */
2791
+ static getTriggerSecret(options) {
2792
+ return (options.client ?? client).get({
2793
+ url: "/api/v1/triggers/{trigger_id}/secret",
2794
+ ...options
2795
+ });
2796
+ }
2797
+ /**
2798
+ * Rotate trigger secret
2799
+ *
2800
+ * Rotates the signing secret for a webhook trigger
2801
+ */
2802
+ static rotateTriggerSecret(options) {
2803
+ return (options.client ?? client).post({
2804
+ url: "/api/v1/triggers/{trigger_id}/rotate-secret",
2805
+ ...options
2806
+ });
2807
+ }
2808
+ /**
2809
+ * List trigger firings
2810
+ *
2811
+ * Lists firings for a trigger (trigger_id is required).
2812
+ */
2813
+ static listTriggerFirings(options) {
2814
+ return (options.client ?? client).get({
2815
+ url: "/api/v1/trigger-firings",
2816
+ ...options
2817
+ });
2818
+ }
2819
+ /**
2820
+ * Get a trigger firing
2821
+ *
2822
+ * Retrieves the details of a specific trigger firing
2823
+ */
2824
+ static getTriggerFiring(options) {
2825
+ return (options.client ?? client).get({
2826
+ url: "/api/v1/trigger-firings/{firing_id}",
2827
+ ...options
2828
+ });
2829
+ }
2830
+ };
2602
2831
  var Users = class {
2603
2832
  /**
2604
2833
  * Get the current authenticated user
@@ -2877,6 +3106,7 @@ var SoatClient = class {
2877
3106
  sessions;
2878
3107
  tools;
2879
3108
  traces;
3109
+ triggers;
2880
3110
  users;
2881
3111
  webhooks;
2882
3112
  constructor({ baseUrl, token, headers } = {}) {
@@ -2907,6 +3137,7 @@ var SoatClient = class {
2907
3137
  this.sessions = bindResource(Sessions, httpClient);
2908
3138
  this.tools = bindResource(Tools, httpClient);
2909
3139
  this.traces = bindResource(Traces, httpClient);
3140
+ this.triggers = bindResource(Triggers, httpClient);
2910
3141
  this.users = bindResource(Users, httpClient);
2911
3142
  this.webhooks = bindResource(Webhooks, httpClient);
2912
3143
  }
@@ -2918,6 +3149,7 @@ exports.AiProviders = AiProviders;
2918
3149
  exports.ApiKeys = ApiKeys;
2919
3150
  exports.Chats = Chats;
2920
3151
  exports.Conversations = Conversations;
3152
+ exports.Discussions = Discussions;
2921
3153
  exports.Documents = Documents;
2922
3154
  exports.Embeddings = Embeddings;
2923
3155
  exports.Files = Files;
@@ -2935,6 +3167,7 @@ exports.Sessions = Sessions;
2935
3167
  exports.SoatClient = SoatClient;
2936
3168
  exports.Tools = Tools;
2937
3169
  exports.Traces = Traces;
3170
+ exports.Triggers = Triggers;
2938
3171
  exports.Users = Users;
2939
3172
  exports.Webhooks = Webhooks;
2940
3173
  exports.createClient = createClient;