@knowledge-stack/ksapi 1.90.0 → 1.91.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.0
1
+ # @knowledge-stack/ksapi@1.91.0
2
2
 
3
3
  A TypeScript SDK client for the localhost API.
4
4
 
@@ -213,6 +213,7 @@ All URIs are relative to *http://localhost:8000*
213
213
  *WorkflowRunsApi* | [**getWorkflowRun**](docs/WorkflowRunsApi.md#getworkflowrun) | **GET** /v1/workflow-runs/{run_id} | Get Workflow Run Handler
214
214
  *WorkflowRunsApi* | [**setWorkflowRunApproval**](docs/WorkflowRunsApi.md#setworkflowrunapprovaloperation) | **POST** /v1/workflow-runs/{run_id}/approval | Set Workflow Run Approval Handler
215
215
  *WorkflowRunsApi* | [**startWorkflowRun**](docs/WorkflowRunsApi.md#startworkflowrun) | **POST** /v1/workflow-runs/{run_id}/start | Start Workflow Run Handler
216
+ *WorkflowRunsApi* | [**stopWorkflowRun**](docs/WorkflowRunsApi.md#stopworkflowrun) | **POST** /v1/workflow-runs/{run_id}/stop | Stop Workflow Run Handler
216
217
  *WorkflowRunsApi* | [**updateWorkflowRun**](docs/WorkflowRunsApi.md#updateworkflowrunoperation) | **PATCH** /v1/workflow-runs/{run_id} | Update Workflow Run Handler
217
218
  *WorkflowRunsApi* | [**workflowRunCallback**](docs/WorkflowRunsApi.md#workflowruncallbackoperation) | **POST** /v1/workflow-runs/{run_id}/callback | Workflow Run Callback Handler
218
219
  *WorkflowsApi* | [**cancelTemporalWorkflow**](docs/WorkflowsApi.md#canceltemporalworkflow) | **DELETE** /v1/workflows/{workflow_id} | Cancel Temporal Workflow Handler
@@ -465,7 +466,7 @@ and is automatically generated by the
465
466
  [OpenAPI Generator](https://openapi-generator.tech) project:
466
467
 
467
468
  - API version: `0.1.0`
468
- - Package version: `1.90.0`
469
+ - Package version: `1.91.0`
469
470
  - Generator version: `7.21.0`
470
471
  - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
471
472
 
@@ -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) {
@@ -38,6 +38,11 @@ export interface StartWorkflowRunRequest {
38
38
  authorization?: string | null;
39
39
  ksUat?: string | null;
40
40
  }
41
+ export interface StopWorkflowRunRequest {
42
+ runId: string;
43
+ authorization?: string | null;
44
+ ksUat?: string | null;
45
+ }
41
46
  export interface UpdateWorkflowRunOperationRequest {
42
47
  runId: string;
43
48
  updateWorkflowRunRequest: UpdateWorkflowRunRequest;
@@ -184,6 +189,31 @@ export interface WorkflowRunsApiInterface {
184
189
  * Start Workflow Run Handler
185
190
  */
186
191
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
192
+ /**
193
+ * Creates request options for stopWorkflowRun without sending the request
194
+ * @param {string} runId
195
+ * @param {string} [authorization]
196
+ * @param {string} [ksUat]
197
+ * @throws {RequiredError}
198
+ * @memberof WorkflowRunsApiInterface
199
+ */
200
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
201
+ /**
202
+ * 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).
203
+ * @summary Stop Workflow Run Handler
204
+ * @param {string} runId
205
+ * @param {string} [authorization]
206
+ * @param {string} [ksUat]
207
+ * @param {*} [options] Override http request option.
208
+ * @throws {RequiredError}
209
+ * @memberof WorkflowRunsApiInterface
210
+ */
211
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
212
+ /**
213
+ * 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).
214
+ * Stop Workflow Run Handler
215
+ */
216
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
187
217
  /**
188
218
  * Creates request options for updateWorkflowRun without sending the request
189
219
  * @param {string} runId
@@ -309,6 +339,20 @@ export declare class WorkflowRunsApi extends runtime.BaseAPI implements Workflow
309
339
  * Start Workflow Run Handler
310
340
  */
311
341
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
342
+ /**
343
+ * Creates request options for stopWorkflowRun without sending the request
344
+ */
345
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
346
+ /**
347
+ * 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).
348
+ * Stop Workflow Run Handler
349
+ */
350
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
351
+ /**
352
+ * 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).
353
+ * Stop Workflow Run Handler
354
+ */
355
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
312
356
  /**
313
357
  * Creates request options for updateWorkflowRun without sending the request
314
358
  */
@@ -287,6 +287,50 @@ class WorkflowRunsApi extends runtime.BaseAPI {
287
287
  return yield response.value();
288
288
  });
289
289
  }
290
+ /**
291
+ * Creates request options for stopWorkflowRun without sending the request
292
+ */
293
+ stopWorkflowRunRequestOpts(requestParameters) {
294
+ return __awaiter(this, void 0, void 0, function* () {
295
+ if (requestParameters['runId'] == null) {
296
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling stopWorkflowRun().');
297
+ }
298
+ const queryParameters = {};
299
+ const headerParameters = {};
300
+ if (requestParameters['authorization'] != null) {
301
+ headerParameters['authorization'] = String(requestParameters['authorization']);
302
+ }
303
+ let urlPath = `/v1/workflow-runs/{run_id}/stop`;
304
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
305
+ return {
306
+ path: urlPath,
307
+ method: 'POST',
308
+ headers: headerParameters,
309
+ query: queryParameters,
310
+ };
311
+ });
312
+ }
313
+ /**
314
+ * 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).
315
+ * Stop Workflow Run Handler
316
+ */
317
+ stopWorkflowRunRaw(requestParameters, initOverrides) {
318
+ return __awaiter(this, void 0, void 0, function* () {
319
+ const requestOptions = yield this.stopWorkflowRunRequestOpts(requestParameters);
320
+ const response = yield this.request(requestOptions, initOverrides);
321
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WorkflowRunResponseFromJSON)(jsonValue));
322
+ });
323
+ }
324
+ /**
325
+ * 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).
326
+ * Stop Workflow Run Handler
327
+ */
328
+ stopWorkflowRun(requestParameters, initOverrides) {
329
+ return __awaiter(this, void 0, void 0, function* () {
330
+ const response = yield this.stopWorkflowRunRaw(requestParameters, initOverrides);
331
+ return yield response.value();
332
+ });
333
+ }
290
334
  /**
291
335
  * Creates request options for updateWorkflowRun without sending the request
292
336
  */
@@ -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) {
@@ -38,6 +38,11 @@ export interface StartWorkflowRunRequest {
38
38
  authorization?: string | null;
39
39
  ksUat?: string | null;
40
40
  }
41
+ export interface StopWorkflowRunRequest {
42
+ runId: string;
43
+ authorization?: string | null;
44
+ ksUat?: string | null;
45
+ }
41
46
  export interface UpdateWorkflowRunOperationRequest {
42
47
  runId: string;
43
48
  updateWorkflowRunRequest: UpdateWorkflowRunRequest;
@@ -184,6 +189,31 @@ export interface WorkflowRunsApiInterface {
184
189
  * Start Workflow Run Handler
185
190
  */
186
191
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
192
+ /**
193
+ * Creates request options for stopWorkflowRun without sending the request
194
+ * @param {string} runId
195
+ * @param {string} [authorization]
196
+ * @param {string} [ksUat]
197
+ * @throws {RequiredError}
198
+ * @memberof WorkflowRunsApiInterface
199
+ */
200
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
201
+ /**
202
+ * 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).
203
+ * @summary Stop Workflow Run Handler
204
+ * @param {string} runId
205
+ * @param {string} [authorization]
206
+ * @param {string} [ksUat]
207
+ * @param {*} [options] Override http request option.
208
+ * @throws {RequiredError}
209
+ * @memberof WorkflowRunsApiInterface
210
+ */
211
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
212
+ /**
213
+ * 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).
214
+ * Stop Workflow Run Handler
215
+ */
216
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
187
217
  /**
188
218
  * Creates request options for updateWorkflowRun without sending the request
189
219
  * @param {string} runId
@@ -309,6 +339,20 @@ export declare class WorkflowRunsApi extends runtime.BaseAPI implements Workflow
309
339
  * Start Workflow Run Handler
310
340
  */
311
341
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
342
+ /**
343
+ * Creates request options for stopWorkflowRun without sending the request
344
+ */
345
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
346
+ /**
347
+ * 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).
348
+ * Stop Workflow Run Handler
349
+ */
350
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
351
+ /**
352
+ * 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).
353
+ * Stop Workflow Run Handler
354
+ */
355
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
312
356
  /**
313
357
  * Creates request options for updateWorkflowRun without sending the request
314
358
  */
@@ -251,6 +251,50 @@ export class WorkflowRunsApi extends runtime.BaseAPI {
251
251
  return yield response.value();
252
252
  });
253
253
  }
254
+ /**
255
+ * Creates request options for stopWorkflowRun without sending the request
256
+ */
257
+ stopWorkflowRunRequestOpts(requestParameters) {
258
+ return __awaiter(this, void 0, void 0, function* () {
259
+ if (requestParameters['runId'] == null) {
260
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling stopWorkflowRun().');
261
+ }
262
+ const queryParameters = {};
263
+ const headerParameters = {};
264
+ if (requestParameters['authorization'] != null) {
265
+ headerParameters['authorization'] = String(requestParameters['authorization']);
266
+ }
267
+ let urlPath = `/v1/workflow-runs/{run_id}/stop`;
268
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
269
+ return {
270
+ path: urlPath,
271
+ method: 'POST',
272
+ headers: headerParameters,
273
+ query: queryParameters,
274
+ };
275
+ });
276
+ }
277
+ /**
278
+ * 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).
279
+ * Stop Workflow Run Handler
280
+ */
281
+ stopWorkflowRunRaw(requestParameters, initOverrides) {
282
+ return __awaiter(this, void 0, void 0, function* () {
283
+ const requestOptions = yield this.stopWorkflowRunRequestOpts(requestParameters);
284
+ const response = yield this.request(requestOptions, initOverrides);
285
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowRunResponseFromJSON(jsonValue));
286
+ });
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
+ * Stop Workflow Run Handler
291
+ */
292
+ stopWorkflowRun(requestParameters, initOverrides) {
293
+ return __awaiter(this, void 0, void 0, function* () {
294
+ const response = yield this.stopWorkflowRunRaw(requestParameters, initOverrides);
295
+ return yield response.value();
296
+ });
297
+ }
254
298
  /**
255
299
  * Creates request options for updateWorkflowRun without sending the request
256
300
  */
@@ -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
@@ -9,6 +9,7 @@ All URIs are relative to *http://localhost:8000*
9
9
  | [**getWorkflowRun**](WorkflowRunsApi.md#getworkflowrun) | **GET** /v1/workflow-runs/{run_id} | Get Workflow Run Handler |
10
10
  | [**setWorkflowRunApproval**](WorkflowRunsApi.md#setworkflowrunapprovaloperation) | **POST** /v1/workflow-runs/{run_id}/approval | Set Workflow Run Approval Handler |
11
11
  | [**startWorkflowRun**](WorkflowRunsApi.md#startworkflowrun) | **POST** /v1/workflow-runs/{run_id}/start | Start Workflow Run Handler |
12
+ | [**stopWorkflowRun**](WorkflowRunsApi.md#stopworkflowrun) | **POST** /v1/workflow-runs/{run_id}/stop | Stop Workflow Run Handler |
12
13
  | [**updateWorkflowRun**](WorkflowRunsApi.md#updateworkflowrunoperation) | **PATCH** /v1/workflow-runs/{run_id} | Update Workflow Run Handler |
13
14
  | [**workflowRunCallback**](WorkflowRunsApi.md#workflowruncallbackoperation) | **POST** /v1/workflow-runs/{run_id}/callback | Workflow Run Callback Handler |
14
15
 
@@ -386,6 +387,80 @@ No authorization required
386
387
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
387
388
 
388
389
 
390
+ ## stopWorkflowRun
391
+
392
+ > WorkflowRunResponse stopWorkflowRun(runId, authorization, ksUat)
393
+
394
+ Stop Workflow Run Handler
395
+
396
+ 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).
397
+
398
+ ### Example
399
+
400
+ ```ts
401
+ import {
402
+ Configuration,
403
+ WorkflowRunsApi,
404
+ } from '@knowledge-stack/ksapi';
405
+ import type { StopWorkflowRunRequest } from '@knowledge-stack/ksapi';
406
+
407
+ async function example() {
408
+ console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
409
+ const api = new WorkflowRunsApi();
410
+
411
+ const body = {
412
+ // string
413
+ runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
414
+ // string (optional)
415
+ authorization: authorization_example,
416
+ // string (optional)
417
+ ksUat: ksUat_example,
418
+ } satisfies StopWorkflowRunRequest;
419
+
420
+ try {
421
+ const data = await api.stopWorkflowRun(body);
422
+ console.log(data);
423
+ } catch (error) {
424
+ console.error(error);
425
+ }
426
+ }
427
+
428
+ // Run the test
429
+ example().catch(console.error);
430
+ ```
431
+
432
+ ### Parameters
433
+
434
+
435
+ | Name | Type | Description | Notes |
436
+ |------------- | ------------- | ------------- | -------------|
437
+ | **runId** | `string` | | [Defaults to `undefined`] |
438
+ | **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
439
+ | **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
440
+
441
+ ### Return type
442
+
443
+ [**WorkflowRunResponse**](WorkflowRunResponse.md)
444
+
445
+ ### Authorization
446
+
447
+ No authorization required
448
+
449
+ ### HTTP request headers
450
+
451
+ - **Content-Type**: Not defined
452
+ - **Accept**: `application/json`
453
+
454
+
455
+ ### HTTP response details
456
+ | Status code | Description | Response headers |
457
+ |-------------|-------------|------------------|
458
+ | **200** | Successful Response | - |
459
+ | **422** | Validation Error | - |
460
+
461
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
462
+
463
+
389
464
  ## updateWorkflowRun
390
465
 
391
466
  > 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.0",
3
+ "version": "1.91.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> {
@@ -72,6 +72,12 @@ export interface StartWorkflowRunRequest {
72
72
  ksUat?: string | null;
73
73
  }
74
74
 
75
+ export interface StopWorkflowRunRequest {
76
+ runId: string;
77
+ authorization?: string | null;
78
+ ksUat?: string | null;
79
+ }
80
+
75
81
  export interface UpdateWorkflowRunOperationRequest {
76
82
  runId: string;
77
83
  updateWorkflowRunRequest: UpdateWorkflowRunRequest;
@@ -235,6 +241,34 @@ export interface WorkflowRunsApiInterface {
235
241
  */
236
242
  startWorkflowRun(requestParameters: StartWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
237
243
 
244
+ /**
245
+ * Creates request options for stopWorkflowRun without sending the request
246
+ * @param {string} runId
247
+ * @param {string} [authorization]
248
+ * @param {string} [ksUat]
249
+ * @throws {RequiredError}
250
+ * @memberof WorkflowRunsApiInterface
251
+ */
252
+ stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts>;
253
+
254
+ /**
255
+ * 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).
256
+ * @summary Stop Workflow Run Handler
257
+ * @param {string} runId
258
+ * @param {string} [authorization]
259
+ * @param {string} [ksUat]
260
+ * @param {*} [options] Override http request option.
261
+ * @throws {RequiredError}
262
+ * @memberof WorkflowRunsApiInterface
263
+ */
264
+ stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
265
+
266
+ /**
267
+ * 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).
268
+ * Stop Workflow Run Handler
269
+ */
270
+ stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
271
+
238
272
  /**
239
273
  * Creates request options for updateWorkflowRun without sending the request
240
274
  * @param {string} runId
@@ -572,6 +606,57 @@ export class WorkflowRunsApi extends runtime.BaseAPI implements WorkflowRunsApiI
572
606
  return await response.value();
573
607
  }
574
608
 
609
+ /**
610
+ * Creates request options for stopWorkflowRun without sending the request
611
+ */
612
+ async stopWorkflowRunRequestOpts(requestParameters: StopWorkflowRunRequest): Promise<runtime.RequestOpts> {
613
+ if (requestParameters['runId'] == null) {
614
+ throw new runtime.RequiredError(
615
+ 'runId',
616
+ 'Required parameter "runId" was null or undefined when calling stopWorkflowRun().'
617
+ );
618
+ }
619
+
620
+ const queryParameters: any = {};
621
+
622
+ const headerParameters: runtime.HTTPHeaders = {};
623
+
624
+ if (requestParameters['authorization'] != null) {
625
+ headerParameters['authorization'] = String(requestParameters['authorization']);
626
+ }
627
+
628
+
629
+ let urlPath = `/v1/workflow-runs/{run_id}/stop`;
630
+ urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
631
+
632
+ return {
633
+ path: urlPath,
634
+ method: 'POST',
635
+ headers: headerParameters,
636
+ query: queryParameters,
637
+ };
638
+ }
639
+
640
+ /**
641
+ * 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).
642
+ * Stop Workflow Run Handler
643
+ */
644
+ async stopWorkflowRunRaw(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>> {
645
+ const requestOptions = await this.stopWorkflowRunRequestOpts(requestParameters);
646
+ const response = await this.request(requestOptions, initOverrides);
647
+
648
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowRunResponseFromJSON(jsonValue));
649
+ }
650
+
651
+ /**
652
+ * 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).
653
+ * Stop Workflow Run Handler
654
+ */
655
+ async stopWorkflowRun(requestParameters: StopWorkflowRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse> {
656
+ const response = await this.stopWorkflowRunRaw(requestParameters, initOverrides);
657
+ return await response.value();
658
+ }
659
+
575
660
  /**
576
661
  * Creates request options for updateWorkflowRun without sending the request
577
662
  */