@knowledge-stack/ksapi 1.90.1 → 1.92.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @knowledge-stack/ksapi@1.90.1
1
+ # @knowledge-stack/ksapi@1.92.0
2
2
 
3
3
  A TypeScript SDK client for the localhost API.
4
4
 
@@ -211,8 +211,10 @@ All URIs are relative to *http://localhost:8000*
211
211
  *WorkflowRunsApi* | [**cloneWorkflowRun**](docs/WorkflowRunsApi.md#cloneworkflowrunoperation) | **POST** /v1/workflow-runs/{run_id}/clone | Clone Workflow Run Handler
212
212
  *WorkflowRunsApi* | [**deleteWorkflowRun**](docs/WorkflowRunsApi.md#deleteworkflowrun) | **DELETE** /v1/workflow-runs/{run_id} | Delete Workflow Run Handler
213
213
  *WorkflowRunsApi* | [**getWorkflowRun**](docs/WorkflowRunsApi.md#getworkflowrun) | **GET** /v1/workflow-runs/{run_id} | Get Workflow Run Handler
214
+ *WorkflowRunsApi* | [**retryWorkflowRun**](docs/WorkflowRunsApi.md#retryworkflowrun) | **POST** /v1/workflow-runs/{run_id}/retry | Retry Workflow Run Handler
214
215
  *WorkflowRunsApi* | [**setWorkflowRunApproval**](docs/WorkflowRunsApi.md#setworkflowrunapprovaloperation) | **POST** /v1/workflow-runs/{run_id}/approval | Set Workflow Run Approval Handler
215
216
  *WorkflowRunsApi* | [**startWorkflowRun**](docs/WorkflowRunsApi.md#startworkflowrun) | **POST** /v1/workflow-runs/{run_id}/start | Start Workflow Run Handler
217
+ *WorkflowRunsApi* | [**stopWorkflowRun**](docs/WorkflowRunsApi.md#stopworkflowrun) | **POST** /v1/workflow-runs/{run_id}/stop | Stop Workflow Run Handler
216
218
  *WorkflowRunsApi* | [**updateWorkflowRun**](docs/WorkflowRunsApi.md#updateworkflowrunoperation) | **PATCH** /v1/workflow-runs/{run_id} | Update Workflow Run Handler
217
219
  *WorkflowRunsApi* | [**workflowRunCallback**](docs/WorkflowRunsApi.md#workflowruncallbackoperation) | **POST** /v1/workflow-runs/{run_id}/callback | Workflow Run Callback Handler
218
220
  *WorkflowsApi* | [**cancelTemporalWorkflow**](docs/WorkflowsApi.md#canceltemporalworkflow) | **DELETE** /v1/workflows/{workflow_id} | Cancel Temporal Workflow Handler
@@ -465,7 +467,7 @@ and is automatically generated by the
465
467
  [OpenAPI Generator](https://openapi-generator.tech) project:
466
468
 
467
469
  - API version: `0.1.0`
468
- - Package version: `1.90.1`
470
+ - Package version: `1.92.0`
469
471
  - Generator version: `7.21.0`
470
472
  - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
471
473
 
@@ -89,21 +89,21 @@ export interface WorkflowDefinitionsApiInterface {
89
89
  * @param {string} definitionId
90
90
  * @param {string} [authorization]
91
91
  * @param {string} [ksUat]
92
- * @param {Array<Blob>} [files] Files to ingest under the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder. Each filename may include POSIX-style &#x60;&#x60;/&#x60;&#x60; separators to reconstruct a folder structure under &#x60;&#x60;inputs/&#x60;&#x60;.
93
- * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base. Combined with &#x60;&#x60;files&#x60;&#x60; in a single request to form the run\\\&#39;s input scope.
92
+ * @param {Array<Blob>} [files] DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\&#39;Create run\\\&#39; wait). Instead create an empty draft (omit this field), then upload each file to the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder via &#x60;&#x60;POST /v1/documents/ingest&#x60;&#x60; with &#x60;&#x60;path_part_id&#x60;&#x60; set to the run\\\&#39;s &#x60;&#x60;inputs_path_part_id&#x60;&#x60;; that path ingests asynchronously and auto-syncs the run\\\&#39;s state. This field will be removed once the FE has migrated.
93
+ * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\&#39;s input scope. Optional omit for an empty draft and add references later via PATCH.
94
94
  * @param {string} [idempotencyKey] Optional key to prevent duplicate runs from retries.
95
95
  * @throws {RequiredError}
96
96
  * @memberof WorkflowDefinitionsApiInterface
97
97
  */
98
98
  createWorkflowRunRequestOpts(requestParameters: CreateWorkflowRunRequest): Promise<runtime.RequestOpts>;
99
99
  /**
100
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
100
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
101
101
  * @summary Create Workflow Run Handler
102
102
  * @param {string} definitionId
103
103
  * @param {string} [authorization]
104
104
  * @param {string} [ksUat]
105
- * @param {Array<Blob>} [files] Files to ingest under the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder. Each filename may include POSIX-style &#x60;&#x60;/&#x60;&#x60; separators to reconstruct a folder structure under &#x60;&#x60;inputs/&#x60;&#x60;.
106
- * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base. Combined with &#x60;&#x60;files&#x60;&#x60; in a single request to form the run\\\&#39;s input scope.
105
+ * @param {Array<Blob>} [files] DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\&#39;Create run\\\&#39; wait). Instead create an empty draft (omit this field), then upload each file to the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder via &#x60;&#x60;POST /v1/documents/ingest&#x60;&#x60; with &#x60;&#x60;path_part_id&#x60;&#x60; set to the run\\\&#39;s &#x60;&#x60;inputs_path_part_id&#x60;&#x60;; that path ingests asynchronously and auto-syncs the run\\\&#39;s state. This field will be removed once the FE has migrated.
106
+ * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\&#39;s input scope. Optional omit for an empty draft and add references later via PATCH.
107
107
  * @param {string} [idempotencyKey] Optional key to prevent duplicate runs from retries.
108
108
  * @param {*} [options] Override http request option.
109
109
  * @throws {RequiredError}
@@ -111,7 +111,7 @@ export interface WorkflowDefinitionsApiInterface {
111
111
  */
112
112
  createWorkflowRunRaw(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
113
113
  /**
114
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
114
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
115
115
  * Create Workflow Run Handler
116
116
  */
117
117
  createWorkflowRun(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
@@ -265,12 +265,12 @@ export declare class WorkflowDefinitionsApi extends runtime.BaseAPI implements W
265
265
  */
266
266
  createWorkflowRunRequestOpts(requestParameters: CreateWorkflowRunRequest): Promise<runtime.RequestOpts>;
267
267
  /**
268
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
268
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
269
269
  * Create Workflow Run Handler
270
270
  */
271
271
  createWorkflowRunRaw(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
272
272
  /**
273
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
273
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
274
274
  * Create Workflow Run Handler
275
275
  */
276
276
  createWorkflowRun(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
@@ -156,7 +156,7 @@ class WorkflowDefinitionsApi extends runtime.BaseAPI {
156
156
  });
157
157
  }
158
158
  /**
159
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
159
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
160
160
  * Create Workflow Run Handler
161
161
  */
162
162
  createWorkflowRunRaw(requestParameters, initOverrides) {
@@ -167,7 +167,7 @@ class WorkflowDefinitionsApi extends runtime.BaseAPI {
167
167
  });
168
168
  }
169
169
  /**
170
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
170
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
171
171
  * Create Workflow Run Handler
172
172
  */
173
173
  createWorkflowRun(requestParameters, initOverrides) {
@@ -27,6 +27,11 @@ export interface GetWorkflowRunRequest {
27
27
  authorization?: string | null;
28
28
  ksUat?: string | null;
29
29
  }
30
+ export interface RetryWorkflowRunRequest {
31
+ runId: string;
32
+ authorization?: string | null;
33
+ ksUat?: string | null;
34
+ }
30
35
  export interface SetWorkflowRunApprovalOperationRequest {
31
36
  runId: string;
32
37
  setWorkflowRunApprovalRequest: SetWorkflowRunApprovalRequest;
@@ -38,6 +43,11 @@ export interface StartWorkflowRunRequest {
38
43
  authorization?: string | null;
39
44
  ksUat?: string | null;
40
45
  }
46
+ export interface StopWorkflowRunRequest {
47
+ runId: string;
48
+ authorization?: string | null;
49
+ ksUat?: string | null;
50
+ }
41
51
  export interface UpdateWorkflowRunOperationRequest {
42
52
  runId: string;
43
53
  updateWorkflowRunRequest: UpdateWorkflowRunRequest;
@@ -132,6 +142,31 @@ export interface WorkflowRunsApiInterface {
132
142
  * Get Workflow Run Handler
133
143
  */
134
144
  getWorkflowRun(requestParameters: GetWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
145
+ /**
146
+ * Creates request options for retryWorkflowRun without sending the request
147
+ * @param {string} runId
148
+ * @param {string} [authorization]
149
+ * @param {string} [ksUat]
150
+ * @throws {RequiredError}
151
+ * @memberof WorkflowRunsApiInterface
152
+ */
153
+ retryWorkflowRunRequestOpts(requestParameters: RetryWorkflowRunRequest): Promise<runtime.RequestOpts>;
154
+ /**
155
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
156
+ * @summary Retry Workflow Run Handler
157
+ * @param {string} runId
158
+ * @param {string} [authorization]
159
+ * @param {string} [ksUat]
160
+ * @param {*} [options] Override http request option.
161
+ * @throws {RequiredError}
162
+ * @memberof WorkflowRunsApiInterface
163
+ */
164
+ retryWorkflowRunRaw(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
165
+ /**
166
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
167
+ * Retry Workflow Run Handler
168
+ */
169
+ retryWorkflowRun(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
135
170
  /**
136
171
  * Creates request options for setWorkflowRunApproval without sending the request
137
172
  * @param {string} runId
@@ -184,6 +219,31 @@ export interface WorkflowRunsApiInterface {
184
219
  * Start Workflow Run Handler
185
220
  */
186
221
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
222
+ /**
223
+ * Creates request options for stopWorkflowRun without sending the request
224
+ * @param {string} runId
225
+ * @param {string} [authorization]
226
+ * @param {string} [ksUat]
227
+ * @throws {RequiredError}
228
+ * @memberof WorkflowRunsApiInterface
229
+ */
230
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
231
+ /**
232
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
233
+ * @summary Stop Workflow Run Handler
234
+ * @param {string} runId
235
+ * @param {string} [authorization]
236
+ * @param {string} [ksUat]
237
+ * @param {*} [options] Override http request option.
238
+ * @throws {RequiredError}
239
+ * @memberof WorkflowRunsApiInterface
240
+ */
241
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
242
+ /**
243
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
244
+ * Stop Workflow Run Handler
245
+ */
246
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
187
247
  /**
188
248
  * Creates request options for updateWorkflowRun without sending the request
189
249
  * @param {string} runId
@@ -281,6 +341,20 @@ export declare class WorkflowRunsApi extends runtime.BaseAPI implements Workflow
281
341
  * Get Workflow Run Handler
282
342
  */
283
343
  getWorkflowRun(requestParameters: GetWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
344
+ /**
345
+ * Creates request options for retryWorkflowRun without sending the request
346
+ */
347
+ retryWorkflowRunRequestOpts(requestParameters: RetryWorkflowRunRequest): Promise<runtime.RequestOpts>;
348
+ /**
349
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
350
+ * Retry Workflow Run Handler
351
+ */
352
+ retryWorkflowRunRaw(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
353
+ /**
354
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
355
+ * Retry Workflow Run Handler
356
+ */
357
+ retryWorkflowRun(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
284
358
  /**
285
359
  * Creates request options for setWorkflowRunApproval without sending the request
286
360
  */
@@ -309,6 +383,20 @@ export declare class WorkflowRunsApi extends runtime.BaseAPI implements Workflow
309
383
  * Start Workflow Run Handler
310
384
  */
311
385
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
386
+ /**
387
+ * Creates request options for stopWorkflowRun without sending the request
388
+ */
389
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
390
+ /**
391
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
392
+ * Stop Workflow Run Handler
393
+ */
394
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
395
+ /**
396
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
397
+ * Stop Workflow Run Handler
398
+ */
399
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
312
400
  /**
313
401
  * Creates request options for updateWorkflowRun without sending the request
314
402
  */
@@ -194,6 +194,50 @@ class WorkflowRunsApi extends runtime.BaseAPI {
194
194
  return yield response.value();
195
195
  });
196
196
  }
197
+ /**
198
+ * Creates request options for retryWorkflowRun without sending the request
199
+ */
200
+ retryWorkflowRunRequestOpts(requestParameters) {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ if (requestParameters['runId'] == null) {
203
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling retryWorkflowRun().');
204
+ }
205
+ const queryParameters = {};
206
+ const headerParameters = {};
207
+ if (requestParameters['authorization'] != null) {
208
+ headerParameters['authorization'] = String(requestParameters['authorization']);
209
+ }
210
+ let urlPath = `/v1/workflow-runs/{run_id}/retry`;
211
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
212
+ return {
213
+ path: urlPath,
214
+ method: 'POST',
215
+ headers: headerParameters,
216
+ query: queryParameters,
217
+ };
218
+ });
219
+ }
220
+ /**
221
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
222
+ * Retry Workflow Run Handler
223
+ */
224
+ retryWorkflowRunRaw(requestParameters, initOverrides) {
225
+ return __awaiter(this, void 0, void 0, function* () {
226
+ const requestOptions = yield this.retryWorkflowRunRequestOpts(requestParameters);
227
+ const response = yield this.request(requestOptions, initOverrides);
228
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WorkflowRunResponseFromJSON)(jsonValue));
229
+ });
230
+ }
231
+ /**
232
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
233
+ * Retry Workflow Run Handler
234
+ */
235
+ retryWorkflowRun(requestParameters, initOverrides) {
236
+ return __awaiter(this, void 0, void 0, function* () {
237
+ const response = yield this.retryWorkflowRunRaw(requestParameters, initOverrides);
238
+ return yield response.value();
239
+ });
240
+ }
197
241
  /**
198
242
  * Creates request options for setWorkflowRunApproval without sending the request
199
243
  */
@@ -287,6 +331,50 @@ class WorkflowRunsApi extends runtime.BaseAPI {
287
331
  return yield response.value();
288
332
  });
289
333
  }
334
+ /**
335
+ * Creates request options for stopWorkflowRun without sending the request
336
+ */
337
+ stopWorkflowRunRequestOpts(requestParameters) {
338
+ return __awaiter(this, void 0, void 0, function* () {
339
+ if (requestParameters['runId'] == null) {
340
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling stopWorkflowRun().');
341
+ }
342
+ const queryParameters = {};
343
+ const headerParameters = {};
344
+ if (requestParameters['authorization'] != null) {
345
+ headerParameters['authorization'] = String(requestParameters['authorization']);
346
+ }
347
+ let urlPath = `/v1/workflow-runs/{run_id}/stop`;
348
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
349
+ return {
350
+ path: urlPath,
351
+ method: 'POST',
352
+ headers: headerParameters,
353
+ query: queryParameters,
354
+ };
355
+ });
356
+ }
357
+ /**
358
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
359
+ * Stop Workflow Run Handler
360
+ */
361
+ stopWorkflowRunRaw(requestParameters, initOverrides) {
362
+ return __awaiter(this, void 0, void 0, function* () {
363
+ const requestOptions = yield this.stopWorkflowRunRequestOpts(requestParameters);
364
+ const response = yield this.request(requestOptions, initOverrides);
365
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WorkflowRunResponseFromJSON)(jsonValue));
366
+ });
367
+ }
368
+ /**
369
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
370
+ * Stop Workflow Run Handler
371
+ */
372
+ stopWorkflowRun(requestParameters, initOverrides) {
373
+ return __awaiter(this, void 0, void 0, function* () {
374
+ const response = yield this.stopWorkflowRunRaw(requestParameters, initOverrides);
375
+ return yield response.value();
376
+ });
377
+ }
290
378
  /**
291
379
  * Creates request options for updateWorkflowRun without sending the request
292
380
  */
@@ -89,21 +89,21 @@ export interface WorkflowDefinitionsApiInterface {
89
89
  * @param {string} definitionId
90
90
  * @param {string} [authorization]
91
91
  * @param {string} [ksUat]
92
- * @param {Array<Blob>} [files] Files to ingest under the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder. Each filename may include POSIX-style &#x60;&#x60;/&#x60;&#x60; separators to reconstruct a folder structure under &#x60;&#x60;inputs/&#x60;&#x60;.
93
- * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base. Combined with &#x60;&#x60;files&#x60;&#x60; in a single request to form the run\\\&#39;s input scope.
92
+ * @param {Array<Blob>} [files] DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\&#39;Create run\\\&#39; wait). Instead create an empty draft (omit this field), then upload each file to the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder via &#x60;&#x60;POST /v1/documents/ingest&#x60;&#x60; with &#x60;&#x60;path_part_id&#x60;&#x60; set to the run\\\&#39;s &#x60;&#x60;inputs_path_part_id&#x60;&#x60;; that path ingests asynchronously and auto-syncs the run\\\&#39;s state. This field will be removed once the FE has migrated.
93
+ * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\&#39;s input scope. Optional omit for an empty draft and add references later via PATCH.
94
94
  * @param {string} [idempotencyKey] Optional key to prevent duplicate runs from retries.
95
95
  * @throws {RequiredError}
96
96
  * @memberof WorkflowDefinitionsApiInterface
97
97
  */
98
98
  createWorkflowRunRequestOpts(requestParameters: CreateWorkflowRunRequest): Promise<runtime.RequestOpts>;
99
99
  /**
100
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
100
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
101
101
  * @summary Create Workflow Run Handler
102
102
  * @param {string} definitionId
103
103
  * @param {string} [authorization]
104
104
  * @param {string} [ksUat]
105
- * @param {Array<Blob>} [files] Files to ingest under the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder. Each filename may include POSIX-style &#x60;&#x60;/&#x60;&#x60; separators to reconstruct a folder structure under &#x60;&#x60;inputs/&#x60;&#x60;.
106
- * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base. Combined with &#x60;&#x60;files&#x60;&#x60; in a single request to form the run\\\&#39;s input scope.
105
+ * @param {Array<Blob>} [files] DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\&#39;Create run\\\&#39; wait). Instead create an empty draft (omit this field), then upload each file to the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder via &#x60;&#x60;POST /v1/documents/ingest&#x60;&#x60; with &#x60;&#x60;path_part_id&#x60;&#x60; set to the run\\\&#39;s &#x60;&#x60;inputs_path_part_id&#x60;&#x60;; that path ingests asynchronously and auto-syncs the run\\\&#39;s state. This field will be removed once the FE has migrated.
106
+ * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\&#39;s input scope. Optional omit for an empty draft and add references later via PATCH.
107
107
  * @param {string} [idempotencyKey] Optional key to prevent duplicate runs from retries.
108
108
  * @param {*} [options] Override http request option.
109
109
  * @throws {RequiredError}
@@ -111,7 +111,7 @@ export interface WorkflowDefinitionsApiInterface {
111
111
  */
112
112
  createWorkflowRunRaw(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
113
113
  /**
114
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
114
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
115
115
  * Create Workflow Run Handler
116
116
  */
117
117
  createWorkflowRun(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
@@ -265,12 +265,12 @@ export declare class WorkflowDefinitionsApi extends runtime.BaseAPI implements W
265
265
  */
266
266
  createWorkflowRunRequestOpts(requestParameters: CreateWorkflowRunRequest): Promise<runtime.RequestOpts>;
267
267
  /**
268
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
268
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
269
269
  * Create Workflow Run Handler
270
270
  */
271
271
  createWorkflowRunRaw(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
272
272
  /**
273
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
273
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
274
274
  * Create Workflow Run Handler
275
275
  */
276
276
  createWorkflowRun(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
@@ -120,7 +120,7 @@ export class WorkflowDefinitionsApi extends runtime.BaseAPI {
120
120
  });
121
121
  }
122
122
  /**
123
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
123
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
124
124
  * Create Workflow Run Handler
125
125
  */
126
126
  createWorkflowRunRaw(requestParameters, initOverrides) {
@@ -131,7 +131,7 @@ export class WorkflowDefinitionsApi extends runtime.BaseAPI {
131
131
  });
132
132
  }
133
133
  /**
134
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
134
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
135
135
  * Create Workflow Run Handler
136
136
  */
137
137
  createWorkflowRun(requestParameters, initOverrides) {
@@ -27,6 +27,11 @@ export interface GetWorkflowRunRequest {
27
27
  authorization?: string | null;
28
28
  ksUat?: string | null;
29
29
  }
30
+ export interface RetryWorkflowRunRequest {
31
+ runId: string;
32
+ authorization?: string | null;
33
+ ksUat?: string | null;
34
+ }
30
35
  export interface SetWorkflowRunApprovalOperationRequest {
31
36
  runId: string;
32
37
  setWorkflowRunApprovalRequest: SetWorkflowRunApprovalRequest;
@@ -38,6 +43,11 @@ export interface StartWorkflowRunRequest {
38
43
  authorization?: string | null;
39
44
  ksUat?: string | null;
40
45
  }
46
+ export interface StopWorkflowRunRequest {
47
+ runId: string;
48
+ authorization?: string | null;
49
+ ksUat?: string | null;
50
+ }
41
51
  export interface UpdateWorkflowRunOperationRequest {
42
52
  runId: string;
43
53
  updateWorkflowRunRequest: UpdateWorkflowRunRequest;
@@ -132,6 +142,31 @@ export interface WorkflowRunsApiInterface {
132
142
  * Get Workflow Run Handler
133
143
  */
134
144
  getWorkflowRun(requestParameters: GetWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
145
+ /**
146
+ * Creates request options for retryWorkflowRun without sending the request
147
+ * @param {string} runId
148
+ * @param {string} [authorization]
149
+ * @param {string} [ksUat]
150
+ * @throws {RequiredError}
151
+ * @memberof WorkflowRunsApiInterface
152
+ */
153
+ retryWorkflowRunRequestOpts(requestParameters: RetryWorkflowRunRequest): Promise<runtime.RequestOpts>;
154
+ /**
155
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
156
+ * @summary Retry Workflow Run Handler
157
+ * @param {string} runId
158
+ * @param {string} [authorization]
159
+ * @param {string} [ksUat]
160
+ * @param {*} [options] Override http request option.
161
+ * @throws {RequiredError}
162
+ * @memberof WorkflowRunsApiInterface
163
+ */
164
+ retryWorkflowRunRaw(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
165
+ /**
166
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
167
+ * Retry Workflow Run Handler
168
+ */
169
+ retryWorkflowRun(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
135
170
  /**
136
171
  * Creates request options for setWorkflowRunApproval without sending the request
137
172
  * @param {string} runId
@@ -184,6 +219,31 @@ export interface WorkflowRunsApiInterface {
184
219
  * Start Workflow Run Handler
185
220
  */
186
221
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
222
+ /**
223
+ * Creates request options for stopWorkflowRun without sending the request
224
+ * @param {string} runId
225
+ * @param {string} [authorization]
226
+ * @param {string} [ksUat]
227
+ * @throws {RequiredError}
228
+ * @memberof WorkflowRunsApiInterface
229
+ */
230
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
231
+ /**
232
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
233
+ * @summary Stop Workflow Run Handler
234
+ * @param {string} runId
235
+ * @param {string} [authorization]
236
+ * @param {string} [ksUat]
237
+ * @param {*} [options] Override http request option.
238
+ * @throws {RequiredError}
239
+ * @memberof WorkflowRunsApiInterface
240
+ */
241
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
242
+ /**
243
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
244
+ * Stop Workflow Run Handler
245
+ */
246
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
187
247
  /**
188
248
  * Creates request options for updateWorkflowRun without sending the request
189
249
  * @param {string} runId
@@ -281,6 +341,20 @@ export declare class WorkflowRunsApi extends runtime.BaseAPI implements Workflow
281
341
  * Get Workflow Run Handler
282
342
  */
283
343
  getWorkflowRun(requestParameters: GetWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
344
+ /**
345
+ * Creates request options for retryWorkflowRun without sending the request
346
+ */
347
+ retryWorkflowRunRequestOpts(requestParameters: RetryWorkflowRunRequest): Promise<runtime.RequestOpts>;
348
+ /**
349
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
350
+ * Retry Workflow Run Handler
351
+ */
352
+ retryWorkflowRunRaw(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
353
+ /**
354
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
355
+ * Retry Workflow Run Handler
356
+ */
357
+ retryWorkflowRun(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
284
358
  /**
285
359
  * Creates request options for setWorkflowRunApproval without sending the request
286
360
  */
@@ -309,6 +383,20 @@ export declare class WorkflowRunsApi extends runtime.BaseAPI implements Workflow
309
383
  * Start Workflow Run Handler
310
384
  */
311
385
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
386
+ /**
387
+ * Creates request options for stopWorkflowRun without sending the request
388
+ */
389
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
390
+ /**
391
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
392
+ * Stop Workflow Run Handler
393
+ */
394
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
395
+ /**
396
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
397
+ * Stop Workflow Run Handler
398
+ */
399
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
312
400
  /**
313
401
  * Creates request options for updateWorkflowRun without sending the request
314
402
  */
@@ -158,6 +158,50 @@ export class WorkflowRunsApi extends runtime.BaseAPI {
158
158
  return yield response.value();
159
159
  });
160
160
  }
161
+ /**
162
+ * Creates request options for retryWorkflowRun without sending the request
163
+ */
164
+ retryWorkflowRunRequestOpts(requestParameters) {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ if (requestParameters['runId'] == null) {
167
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling retryWorkflowRun().');
168
+ }
169
+ const queryParameters = {};
170
+ const headerParameters = {};
171
+ if (requestParameters['authorization'] != null) {
172
+ headerParameters['authorization'] = String(requestParameters['authorization']);
173
+ }
174
+ let urlPath = `/v1/workflow-runs/{run_id}/retry`;
175
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
176
+ return {
177
+ path: urlPath,
178
+ method: 'POST',
179
+ headers: headerParameters,
180
+ query: queryParameters,
181
+ };
182
+ });
183
+ }
184
+ /**
185
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
186
+ * Retry Workflow Run Handler
187
+ */
188
+ retryWorkflowRunRaw(requestParameters, initOverrides) {
189
+ return __awaiter(this, void 0, void 0, function* () {
190
+ const requestOptions = yield this.retryWorkflowRunRequestOpts(requestParameters);
191
+ const response = yield this.request(requestOptions, initOverrides);
192
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowRunResponseFromJSON(jsonValue));
193
+ });
194
+ }
195
+ /**
196
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
197
+ * Retry Workflow Run Handler
198
+ */
199
+ retryWorkflowRun(requestParameters, initOverrides) {
200
+ return __awaiter(this, void 0, void 0, function* () {
201
+ const response = yield this.retryWorkflowRunRaw(requestParameters, initOverrides);
202
+ return yield response.value();
203
+ });
204
+ }
161
205
  /**
162
206
  * Creates request options for setWorkflowRunApproval without sending the request
163
207
  */
@@ -251,6 +295,50 @@ export class WorkflowRunsApi extends runtime.BaseAPI {
251
295
  return yield response.value();
252
296
  });
253
297
  }
298
+ /**
299
+ * Creates request options for stopWorkflowRun without sending the request
300
+ */
301
+ stopWorkflowRunRequestOpts(requestParameters) {
302
+ return __awaiter(this, void 0, void 0, function* () {
303
+ if (requestParameters['runId'] == null) {
304
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling stopWorkflowRun().');
305
+ }
306
+ const queryParameters = {};
307
+ const headerParameters = {};
308
+ if (requestParameters['authorization'] != null) {
309
+ headerParameters['authorization'] = String(requestParameters['authorization']);
310
+ }
311
+ let urlPath = `/v1/workflow-runs/{run_id}/stop`;
312
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
313
+ return {
314
+ path: urlPath,
315
+ method: 'POST',
316
+ headers: headerParameters,
317
+ query: queryParameters,
318
+ };
319
+ });
320
+ }
321
+ /**
322
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
323
+ * Stop Workflow Run Handler
324
+ */
325
+ stopWorkflowRunRaw(requestParameters, initOverrides) {
326
+ return __awaiter(this, void 0, void 0, function* () {
327
+ const requestOptions = yield this.stopWorkflowRunRequestOpts(requestParameters);
328
+ const response = yield this.request(requestOptions, initOverrides);
329
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowRunResponseFromJSON(jsonValue));
330
+ });
331
+ }
332
+ /**
333
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
334
+ * Stop Workflow Run Handler
335
+ */
336
+ stopWorkflowRun(requestParameters, initOverrides) {
337
+ return __awaiter(this, void 0, void 0, function* () {
338
+ const response = yield this.stopWorkflowRunRaw(requestParameters, initOverrides);
339
+ return yield response.value();
340
+ });
341
+ }
254
342
  /**
255
343
  * Creates request options for updateWorkflowRun without sending the request
256
344
  */
@@ -92,7 +92,7 @@ No authorization required
92
92
 
93
93
  Create Workflow Run Handler
94
94
 
95
- Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under &#x60;&#x60;runs/&lt;id&gt;/inputs/&#x60;&#x60; (S3 + DB rows only; no Temporal pipeline). Each &#x60;&#x60;input_scope&#x60;&#x60; entry is resolved per its part_type: a DOCUMENT is pinned to its active &#x60;&#x60;DOCUMENT_VERSION&#x60;&#x60;; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
95
+ Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder and/or PATCHes &#x60;&#x60;input_scope&#x60;&#x60; before Start). Each &#x60;&#x60;input_scope&#x60;&#x60; entry is resolved per its part_type: a DOCUMENT is pinned to its active &#x60;&#x60;DOCUMENT_VERSION&#x60;&#x60;; a FOLDER is pinned by reference only and read live by the runner. &#x60;&#x60;files&#x60;&#x60; is DEPRECATED see the field description. When supplied, uploads are still ingested under &#x60;&#x60;runs/&lt;id&gt;/inputs/&#x60;&#x60; so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
96
96
 
97
97
  ### Example
98
98
 
@@ -114,9 +114,9 @@ async function example() {
114
114
  authorization: authorization_example,
115
115
  // string (optional)
116
116
  ksUat: ksUat_example,
117
- // Array<Blob> | Files to ingest under the run\\\'s ``inputs/`` folder. Each filename may include POSIX-style ``/`` separators to reconstruct a folder structure under ``inputs/``. (optional)
117
+ // Array<Blob> | DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\'Create run\\\' wait). Instead create an empty draft (omit this field), then upload each file to the run\\\'s ``inputs/`` folder via ``POST /v1/documents/ingest`` with ``path_part_id`` set to the run\\\'s ``inputs_path_part_id``; that path ingests asynchronously and auto-syncs the run\\\'s state. This field will be removed once the FE has migrated. (optional)
118
118
  files: /path/to/file.txt,
119
- // string | JSON array of ``DOCUMENT`` or ``FOLDER`` path_part UUIDs referenced from the existing knowledge base. Combined with ``files`` in a single request to form the run\\\'s input scope. (optional)
119
+ // string | JSON array of ``DOCUMENT`` or ``FOLDER`` path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\'s input scope. Optional omit for an empty draft and add references later via PATCH. (optional)
120
120
  inputScope: inputScope_example,
121
121
  // string | Optional key to prevent duplicate runs from retries. (optional)
122
122
  idempotencyKey: idempotencyKey_example,
@@ -142,8 +142,8 @@ example().catch(console.error);
142
142
  | **definitionId** | `string` | | [Defaults to `undefined`] |
143
143
  | **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
144
144
  | **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
145
- | **files** | `Array<Blob>` | Files to ingest under the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder. Each filename may include POSIX-style &#x60;&#x60;/&#x60;&#x60; separators to reconstruct a folder structure under &#x60;&#x60;inputs/&#x60;&#x60;. | [Optional] |
146
- | **inputScope** | `string` | JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base. Combined with &#x60;&#x60;files&#x60;&#x60; in a single request to form the run\\\&#39;s input scope. | [Optional] [Defaults to `undefined`] |
145
+ | **files** | `Array<Blob>` | DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\&#39;Create run\\\&#39; wait). Instead create an empty draft (omit this field), then upload each file to the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder via &#x60;&#x60;POST /v1/documents/ingest&#x60;&#x60; with &#x60;&#x60;path_part_id&#x60;&#x60; set to the run\\\&#39;s &#x60;&#x60;inputs_path_part_id&#x60;&#x60;; that path ingests asynchronously and auto-syncs the run\\\&#39;s state. This field will be removed once the FE has migrated. | [Optional] |
146
+ | **inputScope** | `string` | JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\&#39;s input scope. Optional omit for an empty draft and add references later via PATCH. | [Optional] [Defaults to `undefined`] |
147
147
  | **idempotencyKey** | `string` | Optional key to prevent duplicate runs from retries. | [Optional] [Defaults to `undefined`] |
148
148
 
149
149
  ### Return type
@@ -7,8 +7,10 @@ All URIs are relative to *http://localhost:8000*
7
7
  | [**cloneWorkflowRun**](WorkflowRunsApi.md#cloneworkflowrunoperation) | **POST** /v1/workflow-runs/{run_id}/clone | Clone Workflow Run Handler |
8
8
  | [**deleteWorkflowRun**](WorkflowRunsApi.md#deleteworkflowrun) | **DELETE** /v1/workflow-runs/{run_id} | Delete Workflow Run Handler |
9
9
  | [**getWorkflowRun**](WorkflowRunsApi.md#getworkflowrun) | **GET** /v1/workflow-runs/{run_id} | Get Workflow Run Handler |
10
+ | [**retryWorkflowRun**](WorkflowRunsApi.md#retryworkflowrun) | **POST** /v1/workflow-runs/{run_id}/retry | Retry Workflow Run Handler |
10
11
  | [**setWorkflowRunApproval**](WorkflowRunsApi.md#setworkflowrunapprovaloperation) | **POST** /v1/workflow-runs/{run_id}/approval | Set Workflow Run Approval Handler |
11
12
  | [**startWorkflowRun**](WorkflowRunsApi.md#startworkflowrun) | **POST** /v1/workflow-runs/{run_id}/start | Start Workflow Run Handler |
13
+ | [**stopWorkflowRun**](WorkflowRunsApi.md#stopworkflowrun) | **POST** /v1/workflow-runs/{run_id}/stop | Stop Workflow Run Handler |
12
14
  | [**updateWorkflowRun**](WorkflowRunsApi.md#updateworkflowrunoperation) | **PATCH** /v1/workflow-runs/{run_id} | Update Workflow Run Handler |
13
15
  | [**workflowRunCallback**](WorkflowRunsApi.md#workflowruncallbackoperation) | **POST** /v1/workflow-runs/{run_id}/callback | Workflow Run Callback Handler |
14
16
 
@@ -235,6 +237,80 @@ No authorization required
235
237
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
236
238
 
237
239
 
240
+ ## retryWorkflowRun
241
+
242
+ > WorkflowRunResponse retryWorkflowRun(runId, authorization, ksUat)
243
+
244
+ Retry Workflow Run Handler
245
+
246
+ Re-run a FAILED run (including a user-stopped one) in place. Flips &#x60;&#x60;FAILED -&gt; IN_PROGRESS&#x60;&#x60; against the run\&#39;s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
247
+
248
+ ### Example
249
+
250
+ ```ts
251
+ import {
252
+ Configuration,
253
+ WorkflowRunsApi,
254
+ } from '@knowledge-stack/ksapi';
255
+ import type { RetryWorkflowRunRequest } from '@knowledge-stack/ksapi';
256
+
257
+ async function example() {
258
+ console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
259
+ const api = new WorkflowRunsApi();
260
+
261
+ const body = {
262
+ // string
263
+ runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
264
+ // string (optional)
265
+ authorization: authorization_example,
266
+ // string (optional)
267
+ ksUat: ksUat_example,
268
+ } satisfies RetryWorkflowRunRequest;
269
+
270
+ try {
271
+ const data = await api.retryWorkflowRun(body);
272
+ console.log(data);
273
+ } catch (error) {
274
+ console.error(error);
275
+ }
276
+ }
277
+
278
+ // Run the test
279
+ example().catch(console.error);
280
+ ```
281
+
282
+ ### Parameters
283
+
284
+
285
+ | Name | Type | Description | Notes |
286
+ |------------- | ------------- | ------------- | -------------|
287
+ | **runId** | `string` | | [Defaults to `undefined`] |
288
+ | **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
289
+ | **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
290
+
291
+ ### Return type
292
+
293
+ [**WorkflowRunResponse**](WorkflowRunResponse.md)
294
+
295
+ ### Authorization
296
+
297
+ No authorization required
298
+
299
+ ### HTTP request headers
300
+
301
+ - **Content-Type**: Not defined
302
+ - **Accept**: `application/json`
303
+
304
+
305
+ ### HTTP response details
306
+ | Status code | Description | Response headers |
307
+ |-------------|-------------|------------------|
308
+ | **202** | Successful Response | - |
309
+ | **422** | Validation Error | - |
310
+
311
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
312
+
313
+
238
314
  ## setWorkflowRunApproval
239
315
 
240
316
  > WorkflowRunResponse setWorkflowRunApproval(runId, setWorkflowRunApprovalRequest, authorization, ksUat)
@@ -386,6 +462,80 @@ No authorization required
386
462
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
387
463
 
388
464
 
465
+ ## stopWorkflowRun
466
+
467
+ > WorkflowRunResponse stopWorkflowRun(runId, authorization, ksUat)
468
+
469
+ Stop Workflow Run Handler
470
+
471
+ Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits &#x60;&#x60;IN_PROGRESS&#x60;&#x60; its run thread is read-only: every new USER message 409s (&#x60;&#x60;run_in_progress&#x60;&#x60;). A user \&quot;stop\&quot; must therefore move the run out of &#x60;&#x60;IN_PROGRESS&#x60;&#x60;. We mark it &#x60;&#x60;FAILED&#x60;&#x60; (\&quot;Stopped by user\&quot;) with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded &#x60;&#x60;IN_PROGRESS&#x60;&#x60; by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in &#x60;&#x60;mark_run_failed&#x60;&#x60; plus the callback handler\&#39;s &#x60;&#x60;already_terminal&#x60;&#x60; no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
472
+
473
+ ### Example
474
+
475
+ ```ts
476
+ import {
477
+ Configuration,
478
+ WorkflowRunsApi,
479
+ } from '@knowledge-stack/ksapi';
480
+ import type { StopWorkflowRunRequest } from '@knowledge-stack/ksapi';
481
+
482
+ async function example() {
483
+ console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
484
+ const api = new WorkflowRunsApi();
485
+
486
+ const body = {
487
+ // string
488
+ runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
489
+ // string (optional)
490
+ authorization: authorization_example,
491
+ // string (optional)
492
+ ksUat: ksUat_example,
493
+ } satisfies StopWorkflowRunRequest;
494
+
495
+ try {
496
+ const data = await api.stopWorkflowRun(body);
497
+ console.log(data);
498
+ } catch (error) {
499
+ console.error(error);
500
+ }
501
+ }
502
+
503
+ // Run the test
504
+ example().catch(console.error);
505
+ ```
506
+
507
+ ### Parameters
508
+
509
+
510
+ | Name | Type | Description | Notes |
511
+ |------------- | ------------- | ------------- | -------------|
512
+ | **runId** | `string` | | [Defaults to `undefined`] |
513
+ | **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
514
+ | **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
515
+
516
+ ### Return type
517
+
518
+ [**WorkflowRunResponse**](WorkflowRunResponse.md)
519
+
520
+ ### Authorization
521
+
522
+ No authorization required
523
+
524
+ ### HTTP request headers
525
+
526
+ - **Content-Type**: Not defined
527
+ - **Accept**: `application/json`
528
+
529
+
530
+ ### HTTP response details
531
+ | Status code | Description | Response headers |
532
+ |-------------|-------------|------------------|
533
+ | **200** | Successful Response | - |
534
+ | **422** | Validation Error | - |
535
+
536
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
537
+
538
+
389
539
  ## updateWorkflowRun
390
540
 
391
541
  > WorkflowRunResponse updateWorkflowRun(runId, updateWorkflowRunRequest, authorization, ksUat)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowledge-stack/ksapi",
3
- "version": "1.90.1",
3
+ "version": "1.92.0",
4
4
  "description": "OpenAPI client for @knowledge-stack/ksapi",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -128,8 +128,8 @@ export interface WorkflowDefinitionsApiInterface {
128
128
  * @param {string} definitionId
129
129
  * @param {string} [authorization]
130
130
  * @param {string} [ksUat]
131
- * @param {Array<Blob>} [files] Files to ingest under the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder. Each filename may include POSIX-style &#x60;&#x60;/&#x60;&#x60; separators to reconstruct a folder structure under &#x60;&#x60;inputs/&#x60;&#x60;.
132
- * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base. Combined with &#x60;&#x60;files&#x60;&#x60; in a single request to form the run\\\&#39;s input scope.
131
+ * @param {Array<Blob>} [files] DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\&#39;Create run\\\&#39; wait). Instead create an empty draft (omit this field), then upload each file to the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder via &#x60;&#x60;POST /v1/documents/ingest&#x60;&#x60; with &#x60;&#x60;path_part_id&#x60;&#x60; set to the run\\\&#39;s &#x60;&#x60;inputs_path_part_id&#x60;&#x60;; that path ingests asynchronously and auto-syncs the run\\\&#39;s state. This field will be removed once the FE has migrated.
132
+ * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\&#39;s input scope. Optional omit for an empty draft and add references later via PATCH.
133
133
  * @param {string} [idempotencyKey] Optional key to prevent duplicate runs from retries.
134
134
  * @throws {RequiredError}
135
135
  * @memberof WorkflowDefinitionsApiInterface
@@ -137,13 +137,13 @@ export interface WorkflowDefinitionsApiInterface {
137
137
  createWorkflowRunRequestOpts(requestParameters: CreateWorkflowRunRequest): Promise<runtime.RequestOpts>;
138
138
 
139
139
  /**
140
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
140
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
141
141
  * @summary Create Workflow Run Handler
142
142
  * @param {string} definitionId
143
143
  * @param {string} [authorization]
144
144
  * @param {string} [ksUat]
145
- * @param {Array<Blob>} [files] Files to ingest under the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder. Each filename may include POSIX-style &#x60;&#x60;/&#x60;&#x60; separators to reconstruct a folder structure under &#x60;&#x60;inputs/&#x60;&#x60;.
146
- * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base. Combined with &#x60;&#x60;files&#x60;&#x60; in a single request to form the run\\\&#39;s input scope.
145
+ * @param {Array<Blob>} [files] DEPRECATED do not send files here. Carrying file bytes on run creation makes the call block on synchronous S3 upload (the ~30s \\\&#39;Create run\\\&#39; wait). Instead create an empty draft (omit this field), then upload each file to the run\\\&#39;s &#x60;&#x60;inputs/&#x60;&#x60; folder via &#x60;&#x60;POST /v1/documents/ingest&#x60;&#x60; with &#x60;&#x60;path_part_id&#x60;&#x60; set to the run\\\&#39;s &#x60;&#x60;inputs_path_part_id&#x60;&#x60;; that path ingests asynchronously and auto-syncs the run\\\&#39;s state. This field will be removed once the FE has migrated.
146
+ * @param {string} [inputScope] JSON array of &#x60;&#x60;DOCUMENT&#x60;&#x60; or &#x60;&#x60;FOLDER&#x60;&#x60; path_part UUIDs referenced from the existing knowledge base, pinned onto the new draft\\\&#39;s input scope. Optional omit for an empty draft and add references later via PATCH.
147
147
  * @param {string} [idempotencyKey] Optional key to prevent duplicate runs from retries.
148
148
  * @param {*} [options] Override http request option.
149
149
  * @throws {RequiredError}
@@ -152,7 +152,7 @@ export interface WorkflowDefinitionsApiInterface {
152
152
  createWorkflowRunRaw(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
153
153
 
154
154
  /**
155
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
155
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
156
156
  * Create Workflow Run Handler
157
157
  */
158
158
  createWorkflowRun(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
@@ -421,7 +421,7 @@ export class WorkflowDefinitionsApi extends runtime.BaseAPI implements WorkflowD
421
421
  }
422
422
 
423
423
  /**
424
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
424
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
425
425
  * Create Workflow Run Handler
426
426
  */
427
427
  async createWorkflowRunRaw(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>> {
@@ -432,7 +432,7 @@ export class WorkflowDefinitionsApi extends runtime.BaseAPI implements WorkflowD
432
432
  }
433
433
 
434
434
  /**
435
- * Trigger a workflow run from uploaded files and/or KB references. The merged endpoint accepts both kinds of input in one multipart request. Each uploaded file is ingested under ``runs/<id>/inputs/`` (S3 + DB rows only; no Temporal pipeline). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. A request that supplies neither is rejected.
435
+ * Create a NOT_STARTED run draft, optionally seeded with KB references. All three fields are optional: an empty request creates an empty draft instantly (the two-step flow the FE then uploads files into the run\'s ``inputs/`` folder and/or PATCHes ``input_scope`` before Start). Each ``input_scope`` entry is resolved per its part_type: a DOCUMENT is pinned to its active ``DOCUMENT_VERSION``; a FOLDER is pinned by reference only and read live by the runner. ``files`` is DEPRECATED see the field description. When supplied, uploads are still ingested under ``runs/<id>/inputs/`` so callers mid-migration keep working, but the call blocks on synchronous S3 upload.
436
436
  * Create Workflow Run Handler
437
437
  */
438
438
  async createWorkflowRun(requestParameters: CreateWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse> {
@@ -59,6 +59,12 @@ export interface GetWorkflowRunRequest {
59
59
  ksUat?: string | null;
60
60
  }
61
61
 
62
+ export interface RetryWorkflowRunRequest {
63
+ runId: string;
64
+ authorization?: string | null;
65
+ ksUat?: string | null;
66
+ }
67
+
62
68
  export interface SetWorkflowRunApprovalOperationRequest {
63
69
  runId: string;
64
70
  setWorkflowRunApprovalRequest: SetWorkflowRunApprovalRequest;
@@ -72,6 +78,12 @@ export interface StartWorkflowRunRequest {
72
78
  ksUat?: string | null;
73
79
  }
74
80
 
81
+ export interface StopWorkflowRunRequest {
82
+ runId: string;
83
+ authorization?: string | null;
84
+ ksUat?: string | null;
85
+ }
86
+
75
87
  export interface UpdateWorkflowRunOperationRequest {
76
88
  runId: string;
77
89
  updateWorkflowRunRequest: UpdateWorkflowRunRequest;
@@ -177,6 +189,34 @@ export interface WorkflowRunsApiInterface {
177
189
  */
178
190
  getWorkflowRun(requestParameters: GetWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
179
191
 
192
+ /**
193
+ * Creates request options for retryWorkflowRun without sending the request
194
+ * @param {string} runId
195
+ * @param {string} [authorization]
196
+ * @param {string} [ksUat]
197
+ * @throws {RequiredError}
198
+ * @memberof WorkflowRunsApiInterface
199
+ */
200
+ retryWorkflowRunRequestOpts(requestParameters: RetryWorkflowRunRequest): Promise<runtime.RequestOpts>;
201
+
202
+ /**
203
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
204
+ * @summary Retry Workflow Run Handler
205
+ * @param {string} runId
206
+ * @param {string} [authorization]
207
+ * @param {string} [ksUat]
208
+ * @param {*} [options] Override http request option.
209
+ * @throws {RequiredError}
210
+ * @memberof WorkflowRunsApiInterface
211
+ */
212
+ retryWorkflowRunRaw(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
213
+
214
+ /**
215
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
216
+ * Retry Workflow Run Handler
217
+ */
218
+ retryWorkflowRun(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
219
+
180
220
  /**
181
221
  * Creates request options for setWorkflowRunApproval without sending the request
182
222
  * @param {string} runId
@@ -235,6 +275,34 @@ export interface WorkflowRunsApiInterface {
235
275
  */
236
276
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
237
277
 
278
+ /**
279
+ * Creates request options for stopWorkflowRun without sending the request
280
+ * @param {string} runId
281
+ * @param {string} [authorization]
282
+ * @param {string} [ksUat]
283
+ * @throws {RequiredError}
284
+ * @memberof WorkflowRunsApiInterface
285
+ */
286
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
287
+
288
+ /**
289
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
290
+ * @summary Stop Workflow Run Handler
291
+ * @param {string} runId
292
+ * @param {string} [authorization]
293
+ * @param {string} [ksUat]
294
+ * @param {*} [options] Override http request option.
295
+ * @throws {RequiredError}
296
+ * @memberof WorkflowRunsApiInterface
297
+ */
298
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
299
+
300
+ /**
301
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
302
+ * Stop Workflow Run Handler
303
+ */
304
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
305
+
238
306
  /**
239
307
  * Creates request options for updateWorkflowRun without sending the request
240
308
  * @param {string} runId
@@ -460,6 +528,57 @@ export class WorkflowRunsApi extends runtime.BaseAPI implements WorkflowRunsApiI
460
528
  return await response.value();
461
529
  }
462
530
 
531
+ /**
532
+ * Creates request options for retryWorkflowRun without sending the request
533
+ */
534
+ async retryWorkflowRunRequestOpts(requestParameters: RetryWorkflowRunRequest): Promise<runtime.RequestOpts> {
535
+ if (requestParameters['runId'] == null) {
536
+ throw new runtime.RequiredError(
537
+ 'runId',
538
+ 'Required parameter "runId" was null or undefined when calling retryWorkflowRun().'
539
+ );
540
+ }
541
+
542
+ const queryParameters: any = {};
543
+
544
+ const headerParameters: runtime.HTTPHeaders = {};
545
+
546
+ if (requestParameters['authorization'] != null) {
547
+ headerParameters['authorization'] = String(requestParameters['authorization']);
548
+ }
549
+
550
+
551
+ let urlPath = `/v1/workflow-runs/{run_id}/retry`;
552
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
553
+
554
+ return {
555
+ path: urlPath,
556
+ method: 'POST',
557
+ headers: headerParameters,
558
+ query: queryParameters,
559
+ };
560
+ }
561
+
562
+ /**
563
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
564
+ * Retry Workflow Run Handler
565
+ */
566
+ async retryWorkflowRunRaw(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>> {
567
+ const requestOptions = await this.retryWorkflowRunRequestOpts(requestParameters);
568
+ const response = await this.request(requestOptions, initOverrides);
569
+
570
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowRunResponseFromJSON(jsonValue));
571
+ }
572
+
573
+ /**
574
+ * Re-run a FAILED run (including a user-stopped one) in place. Flips ``FAILED -> IN_PROGRESS`` against the run\'s existing snapshot and re-dispatches the agent. 409 if the run is not FAILED (NOT_STARTED/PENDING use Start; COMPLETED is cloned) or was never started. Triggerer or OWNER/ADMIN only.
575
+ * Retry Workflow Run Handler
576
+ */
577
+ async retryWorkflowRun(requestParameters: RetryWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse> {
578
+ const response = await this.retryWorkflowRunRaw(requestParameters, initOverrides);
579
+ return await response.value();
580
+ }
581
+
463
582
  /**
464
583
  * Creates request options for setWorkflowRunApproval without sending the request
465
584
  */
@@ -572,6 +691,57 @@ export class WorkflowRunsApi extends runtime.BaseAPI implements WorkflowRunsApiI
572
691
  return await response.value();
573
692
  }
574
693
 
694
+ /**
695
+ * Creates request options for stopWorkflowRun without sending the request
696
+ */
697
+ async stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts> {
698
+ if (requestParameters['runId'] == null) {
699
+ throw new runtime.RequiredError(
700
+ 'runId',
701
+ 'Required parameter "runId" was null or undefined when calling stopWorkflowRun().'
702
+ );
703
+ }
704
+
705
+ const queryParameters: any = {};
706
+
707
+ const headerParameters: runtime.HTTPHeaders = {};
708
+
709
+ if (requestParameters['authorization'] != null) {
710
+ headerParameters['authorization'] = String(requestParameters['authorization']);
711
+ }
712
+
713
+
714
+ let urlPath = `/v1/workflow-runs/{run_id}/stop`;
715
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
716
+
717
+ return {
718
+ path: urlPath,
719
+ method: 'POST',
720
+ headers: headerParameters,
721
+ query: queryParameters,
722
+ };
723
+ }
724
+
725
+ /**
726
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
727
+ * Stop Workflow Run Handler
728
+ */
729
+ async stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>> {
730
+ const requestOptions = await this.stopWorkflowRunRequestOpts(requestParameters);
731
+ const response = await this.request(requestOptions, initOverrides);
732
+
733
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowRunResponseFromJSON(jsonValue));
734
+ }
735
+
736
+ /**
737
+ * Stop a running workflow run, terminalizing it so its thread un-bricks. While a run sits ``IN_PROGRESS`` its run thread is read-only: every new USER message 409s (``run_in_progress``). A user \"stop\" must therefore move the run out of ``IN_PROGRESS``. We mark it ``FAILED`` (\"Stopped by user\") with a pure DB write that does **not** depend on Temporal — so this same call also recovers a run already stranded ``IN_PROGRESS`` by a cancel whose terminal callback never landed (the permanent-brick case) — then best-effort cancel its Temporal workflow. Idempotent: a run already in a terminal state (or not yet started) is returned unchanged. The terminal-state guard in ``mark_run_failed`` plus the callback handler\'s ``already_terminal`` no-op make a real completion landing concurrently safe (last writer is ignored, never an error).
738
+ * Stop Workflow Run Handler
739
+ */
740
+ async stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse> {
741
+ const response = await this.stopWorkflowRunRaw(requestParameters, initOverrides);
742
+ return await response.value();
743
+ }
744
+
575
745
  /**
576
746
  * Creates request options for updateWorkflowRun without sending the request
577
747
  */