@knowledge-stack/ksapi 1.81.0 → 1.83.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/.openapi-generator/FILES +10 -0
- package/README.md +12 -2
- package/dist/apis/WorkflowDefinitionsApi.d.ts +4 -1
- package/dist/apis/WorkflowDefinitionsApi.js +2 -0
- package/dist/apis/WorkflowRunsApi.d.ts +233 -1
- package/dist/apis/WorkflowRunsApi.js +236 -0
- package/dist/esm/apis/WorkflowDefinitionsApi.d.ts +4 -1
- package/dist/esm/apis/WorkflowDefinitionsApi.js +2 -0
- package/dist/esm/apis/WorkflowRunsApi.d.ts +233 -1
- package/dist/esm/apis/WorkflowRunsApi.js +237 -1
- package/dist/esm/models/CreateWorkflowDefinitionRequest.d.ts +14 -1
- package/dist/esm/models/CreateWorkflowDefinitionRequest.js +3 -4
- package/dist/esm/models/InstructionSnapshot.d.ts +71 -0
- package/dist/esm/models/InstructionSnapshot.js +57 -0
- package/dist/esm/models/InvokeWorkflowRequest.d.ts +6 -0
- package/dist/esm/models/InvokeWorkflowRequest.js +6 -0
- package/dist/esm/models/PathPartApprovalDecision.d.ts +30 -0
- package/dist/esm/models/PathPartApprovalDecision.js +48 -0
- package/dist/esm/models/PathPartApprovalResponse.d.ts +111 -0
- package/dist/esm/models/PathPartApprovalResponse.js +85 -0
- package/dist/esm/models/RejectFileRequest.d.ts +47 -0
- package/dist/esm/models/RejectFileRequest.js +49 -0
- package/dist/esm/models/RunLockResponse.d.ts +59 -0
- package/dist/esm/models/RunLockResponse.js +52 -0
- package/dist/esm/models/UpdateWorkflowDefinitionRequest.d.ts +12 -1
- package/dist/esm/models/UpdateWorkflowDefinitionRequest.js +2 -0
- package/dist/esm/models/WorkflowDefinitionResponse.d.ts +6 -0
- package/dist/esm/models/WorkflowDefinitionResponse.js +4 -0
- package/dist/esm/models/WorkflowRunResponse.d.ts +17 -0
- package/dist/esm/models/WorkflowRunResponse.js +8 -0
- package/dist/esm/models/WorkflowRunSnapshot.d.ts +3 -2
- package/dist/esm/models/WorkflowRunSnapshot.js +3 -2
- package/dist/esm/models/WorkflowRunStatus.d.ts +20 -2
- package/dist/esm/models/WorkflowRunStatus.js +20 -2
- package/dist/esm/models/WorkflowRunnerType.d.ts +1 -0
- package/dist/esm/models/WorkflowRunnerType.js +2 -1
- package/dist/esm/models/index.d.ts +5 -0
- package/dist/esm/models/index.js +5 -0
- package/dist/models/CreateWorkflowDefinitionRequest.d.ts +14 -1
- package/dist/models/CreateWorkflowDefinitionRequest.js +3 -4
- package/dist/models/InstructionSnapshot.d.ts +71 -0
- package/dist/models/InstructionSnapshot.js +65 -0
- package/dist/models/InvokeWorkflowRequest.d.ts +6 -0
- package/dist/models/InvokeWorkflowRequest.js +6 -0
- package/dist/models/PathPartApprovalDecision.d.ts +30 -0
- package/dist/models/PathPartApprovalDecision.js +56 -0
- package/dist/models/PathPartApprovalResponse.d.ts +111 -0
- package/dist/models/PathPartApprovalResponse.js +93 -0
- package/dist/models/RejectFileRequest.d.ts +47 -0
- package/dist/models/RejectFileRequest.js +57 -0
- package/dist/models/RunLockResponse.d.ts +59 -0
- package/dist/models/RunLockResponse.js +60 -0
- package/dist/models/UpdateWorkflowDefinitionRequest.d.ts +12 -1
- package/dist/models/UpdateWorkflowDefinitionRequest.js +2 -0
- package/dist/models/WorkflowDefinitionResponse.d.ts +6 -0
- package/dist/models/WorkflowDefinitionResponse.js +4 -0
- package/dist/models/WorkflowRunResponse.d.ts +17 -0
- package/dist/models/WorkflowRunResponse.js +8 -0
- package/dist/models/WorkflowRunSnapshot.d.ts +3 -2
- package/dist/models/WorkflowRunSnapshot.js +3 -2
- package/dist/models/WorkflowRunStatus.d.ts +20 -2
- package/dist/models/WorkflowRunStatus.js +20 -2
- package/dist/models/WorkflowRunnerType.d.ts +1 -0
- package/dist/models/WorkflowRunnerType.js +2 -1
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.js +5 -0
- package/docs/CreateWorkflowDefinitionRequest.md +3 -1
- package/docs/InstructionSnapshot.md +41 -0
- package/docs/InvokeWorkflowRequest.md +2 -0
- package/docs/PathPartApprovalDecision.md +33 -0
- package/docs/PathPartApprovalResponse.md +55 -0
- package/docs/RejectFileRequest.md +35 -0
- package/docs/RunLockResponse.md +39 -0
- package/docs/UpdateWorkflowDefinitionRequest.md +3 -1
- package/docs/WorkflowDefinitionResponse.md +2 -0
- package/docs/WorkflowDefinitionsApi.md +2 -0
- package/docs/WorkflowRunResponse.md +5 -1
- package/docs/WorkflowRunSnapshot.md +1 -1
- package/docs/WorkflowRunStatus.md +1 -1
- package/docs/WorkflowRunsApi.md +387 -0
- package/package.json +1 -1
- package/src/apis/WorkflowDefinitionsApi.ts +4 -1
- package/src/apis/WorkflowRunsApi.ts +479 -0
- package/src/models/CreateWorkflowDefinitionRequest.ts +17 -4
- package/src/models/InstructionSnapshot.ts +125 -0
- package/src/models/InvokeWorkflowRequest.ts +12 -0
- package/src/models/PathPartApprovalDecision.ts +58 -0
- package/src/models/PathPartApprovalResponse.ts +186 -0
- package/src/models/RejectFileRequest.ts +87 -0
- package/src/models/RunLockResponse.ts +101 -0
- package/src/models/UpdateWorkflowDefinitionRequest.ts +14 -1
- package/src/models/WorkflowDefinitionResponse.ts +9 -0
- package/src/models/WorkflowRunResponse.ts +23 -0
- package/src/models/WorkflowRunSnapshot.ts +11 -4
- package/src/models/WorkflowRunStatus.ts +20 -2
- package/src/models/WorkflowRunnerType.ts +2 -1
- package/src/models/index.ts +5 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
# PathPartApprovalResponse
|
|
3
|
+
|
|
4
|
+
Approval audit-history row over any path_part (file or folder). ``run_id`` is optional — None when the path_part was approved directly without a workflow-run context.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`id` | string
|
|
11
|
+
`runId` | string
|
|
12
|
+
`pathPartId` | string
|
|
13
|
+
`status` | [PathPartApprovalDecision](PathPartApprovalDecision.md)
|
|
14
|
+
`reviewerId` | string
|
|
15
|
+
`reviewedAt` | Date
|
|
16
|
+
`rejectionReason` | string
|
|
17
|
+
`unapprovedBy` | string
|
|
18
|
+
`unapprovedAt` | Date
|
|
19
|
+
`createdAt` | Date
|
|
20
|
+
`updatedAt` | Date
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import type { PathPartApprovalResponse } from '@knowledge-stack/ksapi'
|
|
26
|
+
|
|
27
|
+
// TODO: Update the object below with actual values
|
|
28
|
+
const example = {
|
|
29
|
+
"id": null,
|
|
30
|
+
"runId": null,
|
|
31
|
+
"pathPartId": null,
|
|
32
|
+
"status": null,
|
|
33
|
+
"reviewerId": null,
|
|
34
|
+
"reviewedAt": null,
|
|
35
|
+
"rejectionReason": null,
|
|
36
|
+
"unapprovedBy": null,
|
|
37
|
+
"unapprovedAt": null,
|
|
38
|
+
"createdAt": null,
|
|
39
|
+
"updatedAt": null,
|
|
40
|
+
} satisfies PathPartApprovalResponse
|
|
41
|
+
|
|
42
|
+
console.log(example)
|
|
43
|
+
|
|
44
|
+
// Convert the instance to a JSON string
|
|
45
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
46
|
+
console.log(exampleJSON)
|
|
47
|
+
|
|
48
|
+
// Parse the JSON string back to an object
|
|
49
|
+
const exampleParsed = JSON.parse(exampleJSON) as PathPartApprovalResponse
|
|
50
|
+
console.log(exampleParsed)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
54
|
+
|
|
55
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
# RejectFileRequest
|
|
3
|
+
|
|
4
|
+
Body for ``POST /workflow-runs/{run}/files/{file}/reject``.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`reason` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { RejectFileRequest } from '@knowledge-stack/ksapi'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"reason": null,
|
|
20
|
+
} satisfies RejectFileRequest
|
|
21
|
+
|
|
22
|
+
console.log(example)
|
|
23
|
+
|
|
24
|
+
// Convert the instance to a JSON string
|
|
25
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
26
|
+
console.log(exampleJSON)
|
|
27
|
+
|
|
28
|
+
// Parse the JSON string back to an object
|
|
29
|
+
const exampleParsed = JSON.parse(exampleJSON) as RejectFileRequest
|
|
30
|
+
console.log(exampleParsed)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
34
|
+
|
|
35
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# RunLockResponse
|
|
3
|
+
|
|
4
|
+
Reviewer-lock state on a workflow run.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`runId` | string
|
|
11
|
+
`lockUserId` | string
|
|
12
|
+
`lockAcquiredAt` | Date
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { RunLockResponse } from '@knowledge-stack/ksapi'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"runId": null,
|
|
22
|
+
"lockUserId": null,
|
|
23
|
+
"lockAcquiredAt": null,
|
|
24
|
+
} satisfies RunLockResponse
|
|
25
|
+
|
|
26
|
+
console.log(example)
|
|
27
|
+
|
|
28
|
+
// Convert the instance to a JSON string
|
|
29
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
30
|
+
console.log(exampleJSON)
|
|
31
|
+
|
|
32
|
+
// Parse the JSON string back to an object
|
|
33
|
+
const exampleParsed = JSON.parse(exampleJSON) as RunLockResponse
|
|
34
|
+
console.log(exampleParsed)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
38
|
+
|
|
39
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# UpdateWorkflowDefinitionRequest
|
|
3
3
|
|
|
4
|
-
Full replacement (PUT semantics).
|
|
4
|
+
Full replacement (PUT semantics). ``instruction_path_part_ids``: - ``KS_INTERNAL``: must remain ``len == 1`` (the auto-provisioned doc). - ``SELF_HOSTED``: ``len ≥ 1``; callers may swap or add documents.
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
|
@@ -17,6 +17,7 @@ Name | Type
|
|
|
17
17
|
`outputPathPartIds` | Array<string>
|
|
18
18
|
`templatePathPartId` | string
|
|
19
19
|
`isActive` | boolean
|
|
20
|
+
`approvalRequired` | boolean
|
|
20
21
|
|
|
21
22
|
## Example
|
|
22
23
|
|
|
@@ -35,6 +36,7 @@ const example = {
|
|
|
35
36
|
"outputPathPartIds": null,
|
|
36
37
|
"templatePathPartId": null,
|
|
37
38
|
"isActive": null,
|
|
39
|
+
"approvalRequired": null,
|
|
38
40
|
} satisfies UpdateWorkflowDefinitionRequest
|
|
39
41
|
|
|
40
42
|
console.log(example)
|
|
@@ -18,6 +18,7 @@ Name | Type
|
|
|
18
18
|
`outputPathPartIds` | Array<string>
|
|
19
19
|
`templatePathPartId` | string
|
|
20
20
|
`isActive` | boolean
|
|
21
|
+
`approvalRequired` | boolean
|
|
21
22
|
`createdAt` | Date
|
|
22
23
|
`updatedAt` | Date
|
|
23
24
|
|
|
@@ -39,6 +40,7 @@ const example = {
|
|
|
39
40
|
"outputPathPartIds": null,
|
|
40
41
|
"templatePathPartId": null,
|
|
41
42
|
"isActive": null,
|
|
43
|
+
"approvalRequired": null,
|
|
42
44
|
"createdAt": null,
|
|
43
45
|
"updatedAt": null,
|
|
44
46
|
} satisfies WorkflowDefinitionResponse
|
|
@@ -236,6 +236,8 @@ No authorization required
|
|
|
236
236
|
|
|
237
237
|
Invoke Workflow Handler
|
|
238
238
|
|
|
239
|
+
Trigger a workflow run. All business logic lives in ``WorkflowInvocationService``. This handler only orchestrates the two phases: 1. **Phase 1 (in-session):** validate, build snapshot, persist run row, mint JWT. Wrapped in a single DB session so the run insert and the idempotency-race resolution share a transaction. 2. **Phase 2 (out-of-session):** dispatch HTTP call to the SELF_HOSTED runner. Best-effort — the run is already persisted, so failures here transition the run to ``FAILED`` rather than rejecting the request.
|
|
240
|
+
|
|
239
241
|
### Example
|
|
240
242
|
|
|
241
243
|
```ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# WorkflowRunResponse
|
|
3
3
|
|
|
4
|
-
Workflow run response.
|
|
4
|
+
Workflow run response. Note: ``run_token_jti`` is intentionally NOT exposed. It\'s an internal token identifier persisted on the run row for callback auth — clients should treat run dispatch state as observable via ``status`` (RUNNING => dispatched), not via JTI presence.
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
|
@@ -16,6 +16,8 @@ Name | Type
|
|
|
16
16
|
`completedAt` | Date
|
|
17
17
|
`runSnapshot` | [WorkflowRunSnapshot](WorkflowRunSnapshot.md)
|
|
18
18
|
`error` | string
|
|
19
|
+
`inputPathPartIds` | Array<string>
|
|
20
|
+
`inputVersionIds` | Array<string>
|
|
19
21
|
`createdAt` | Date
|
|
20
22
|
`updatedAt` | Date
|
|
21
23
|
|
|
@@ -35,6 +37,8 @@ const example = {
|
|
|
35
37
|
"completedAt": null,
|
|
36
38
|
"runSnapshot": null,
|
|
37
39
|
"error": null,
|
|
40
|
+
"inputPathPartIds": null,
|
|
41
|
+
"inputVersionIds": null,
|
|
38
42
|
"createdAt": null,
|
|
39
43
|
"updatedAt": null,
|
|
40
44
|
} satisfies WorkflowRunResponse
|
|
@@ -13,7 +13,7 @@ Name | Type
|
|
|
13
13
|
`userId` | string
|
|
14
14
|
`maxRunDurationSeconds` | number
|
|
15
15
|
`sources` | [Array<ABCDPathSnapshot>](ABCDPathSnapshot.md)
|
|
16
|
-
`instructions` | [Array<
|
|
16
|
+
`instructions` | [Array<InstructionSnapshot>](InstructionSnapshot.md)
|
|
17
17
|
`outputs` | [Array<ABCDPathSnapshot>](ABCDPathSnapshot.md)
|
|
18
18
|
`template` | [ABCDPathSnapshot](ABCDPathSnapshot.md)
|
|
19
19
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# WorkflowRunStatus
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Combined lifecycle + approval-rollup status of a workflow run. Absorbs the prior split between ``status`` (PENDING/RUNNING/COMPLETED/ FAILED) and ``approval_state`` (in_progress/awaiting_review/approved/ rejected/failed). One state field per run. Allowed transitions:: PENDING -> IN_PROGRESS (agent dispatched) IN_PROGRESS -> COMPLETED (workflow.approval_required=FALSE) IN_PROGRESS -> NEEDS_APPROVAL (workflow.approval_required=TRUE, agent done) NEEDS_APPROVAL -> APPROVED (run folder approved by reviewer) NEEDS_APPROVAL -> REJECTED (run folder or any child rejected) APPROVED -> NEEDS_APPROVAL (run folder unapproved) REJECTED -> NEEDS_APPROVAL (rejection reversed; mutable) any non-terminal -> FAILED (agent error)
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
package/docs/WorkflowRunsApi.md
CHANGED
|
@@ -4,12 +4,168 @@ All URIs are relative to *http://localhost:8000*
|
|
|
4
4
|
|
|
5
5
|
| Method | HTTP request | Description |
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
|
+
| [**acquireWorkflowRunLock**](WorkflowRunsApi.md#acquireworkflowrunlock) | **POST** /v1/workflow-runs/{run_id}/lock | Acquire Workflow Run Lock Handler |
|
|
8
|
+
| [**approveWorkflowRunFile**](WorkflowRunsApi.md#approveworkflowrunfile) | **POST** /v1/workflow-runs/{run_id}/files/{path_part_id}/approve | Approve Workflow Run File Handler |
|
|
7
9
|
| [**deleteWorkflowRun**](WorkflowRunsApi.md#deleteworkflowrun) | **DELETE** /v1/workflow-runs/{run_id} | Delete Workflow Run Handler |
|
|
8
10
|
| [**getWorkflowRun**](WorkflowRunsApi.md#getworkflowrun) | **GET** /v1/workflow-runs/{run_id} | Get Workflow Run Handler |
|
|
11
|
+
| [**rejectWorkflowRunFile**](WorkflowRunsApi.md#rejectworkflowrunfile) | **POST** /v1/workflow-runs/{run_id}/files/{path_part_id}/reject | Reject Workflow Run File Handler |
|
|
12
|
+
| [**releaseWorkflowRunLock**](WorkflowRunsApi.md#releaseworkflowrunlock) | **DELETE** /v1/workflow-runs/{run_id}/lock | Release Workflow Run Lock Handler |
|
|
13
|
+
| [**unapproveWorkflowRunFile**](WorkflowRunsApi.md#unapproveworkflowrunfile) | **POST** /v1/workflow-runs/{run_id}/files/{path_part_id}/unapprove | Unapprove Workflow Run File Handler |
|
|
9
14
|
| [**workflowRunCallback**](WorkflowRunsApi.md#workflowruncallbackoperation) | **POST** /v1/workflow-runs/{run_id}/callback | Workflow Run Callback Handler |
|
|
10
15
|
|
|
11
16
|
|
|
12
17
|
|
|
18
|
+
## acquireWorkflowRunLock
|
|
19
|
+
|
|
20
|
+
> RunLockResponse acquireWorkflowRunLock(runId, authorization, ksUat)
|
|
21
|
+
|
|
22
|
+
Acquire Workflow Run Lock Handler
|
|
23
|
+
|
|
24
|
+
Acquire (or renew) the reviewer lock on ``run_id``. The current holder may re-POST to refresh ``lock_acquired_at``. A different user receives 409 until the lock is released or auto-swept.
|
|
25
|
+
|
|
26
|
+
### Example
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import {
|
|
30
|
+
Configuration,
|
|
31
|
+
WorkflowRunsApi,
|
|
32
|
+
} from '@knowledge-stack/ksapi';
|
|
33
|
+
import type { AcquireWorkflowRunLockRequest } from '@knowledge-stack/ksapi';
|
|
34
|
+
|
|
35
|
+
async function example() {
|
|
36
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
37
|
+
const api = new WorkflowRunsApi();
|
|
38
|
+
|
|
39
|
+
const body = {
|
|
40
|
+
// string
|
|
41
|
+
runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
42
|
+
// string (optional)
|
|
43
|
+
authorization: authorization_example,
|
|
44
|
+
// string (optional)
|
|
45
|
+
ksUat: ksUat_example,
|
|
46
|
+
} satisfies AcquireWorkflowRunLockRequest;
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const data = await api.acquireWorkflowRunLock(body);
|
|
50
|
+
console.log(data);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error(error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Run the test
|
|
57
|
+
example().catch(console.error);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Parameters
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
| Name | Type | Description | Notes |
|
|
64
|
+
|------------- | ------------- | ------------- | -------------|
|
|
65
|
+
| **runId** | `string` | | [Defaults to `undefined`] |
|
|
66
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
67
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
68
|
+
|
|
69
|
+
### Return type
|
|
70
|
+
|
|
71
|
+
[**RunLockResponse**](RunLockResponse.md)
|
|
72
|
+
|
|
73
|
+
### Authorization
|
|
74
|
+
|
|
75
|
+
No authorization required
|
|
76
|
+
|
|
77
|
+
### HTTP request headers
|
|
78
|
+
|
|
79
|
+
- **Content-Type**: Not defined
|
|
80
|
+
- **Accept**: `application/json`
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### HTTP response details
|
|
84
|
+
| Status code | Description | Response headers |
|
|
85
|
+
|-------------|-------------|------------------|
|
|
86
|
+
| **200** | Successful Response | - |
|
|
87
|
+
| **422** | Validation Error | - |
|
|
88
|
+
|
|
89
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## approveWorkflowRunFile
|
|
93
|
+
|
|
94
|
+
> PathPartApprovalResponse approveWorkflowRunFile(runId, pathPartId, authorization, ksUat)
|
|
95
|
+
|
|
96
|
+
Approve Workflow Run File Handler
|
|
97
|
+
|
|
98
|
+
Approve a single generated file. Caller must hold the run lock.
|
|
99
|
+
|
|
100
|
+
### Example
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import {
|
|
104
|
+
Configuration,
|
|
105
|
+
WorkflowRunsApi,
|
|
106
|
+
} from '@knowledge-stack/ksapi';
|
|
107
|
+
import type { ApproveWorkflowRunFileRequest } from '@knowledge-stack/ksapi';
|
|
108
|
+
|
|
109
|
+
async function example() {
|
|
110
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
111
|
+
const api = new WorkflowRunsApi();
|
|
112
|
+
|
|
113
|
+
const body = {
|
|
114
|
+
// string
|
|
115
|
+
runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
116
|
+
// string
|
|
117
|
+
pathPartId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
118
|
+
// string (optional)
|
|
119
|
+
authorization: authorization_example,
|
|
120
|
+
// string (optional)
|
|
121
|
+
ksUat: ksUat_example,
|
|
122
|
+
} satisfies ApproveWorkflowRunFileRequest;
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
const data = await api.approveWorkflowRunFile(body);
|
|
126
|
+
console.log(data);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error(error);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Run the test
|
|
133
|
+
example().catch(console.error);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Parameters
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
| Name | Type | Description | Notes |
|
|
140
|
+
|------------- | ------------- | ------------- | -------------|
|
|
141
|
+
| **runId** | `string` | | [Defaults to `undefined`] |
|
|
142
|
+
| **pathPartId** | `string` | | [Defaults to `undefined`] |
|
|
143
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
144
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
145
|
+
|
|
146
|
+
### Return type
|
|
147
|
+
|
|
148
|
+
[**PathPartApprovalResponse**](PathPartApprovalResponse.md)
|
|
149
|
+
|
|
150
|
+
### Authorization
|
|
151
|
+
|
|
152
|
+
No authorization required
|
|
153
|
+
|
|
154
|
+
### HTTP request headers
|
|
155
|
+
|
|
156
|
+
- **Content-Type**: Not defined
|
|
157
|
+
- **Accept**: `application/json`
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### HTTP response details
|
|
161
|
+
| Status code | Description | Response headers |
|
|
162
|
+
|-------------|-------------|------------------|
|
|
163
|
+
| **200** | Successful Response | - |
|
|
164
|
+
| **422** | Validation Error | - |
|
|
165
|
+
|
|
166
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
167
|
+
|
|
168
|
+
|
|
13
169
|
## deleteWorkflowRun
|
|
14
170
|
|
|
15
171
|
> deleteWorkflowRun(runId, authorization, ksUat)
|
|
@@ -154,6 +310,237 @@ No authorization required
|
|
|
154
310
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
155
311
|
|
|
156
312
|
|
|
313
|
+
## rejectWorkflowRunFile
|
|
314
|
+
|
|
315
|
+
> PathPartApprovalResponse rejectWorkflowRunFile(runId, pathPartId, rejectFileRequest, authorization, ksUat)
|
|
316
|
+
|
|
317
|
+
Reject Workflow Run File Handler
|
|
318
|
+
|
|
319
|
+
Reject a single generated file with a reason. Caller must hold the run lock.
|
|
320
|
+
|
|
321
|
+
### Example
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
import {
|
|
325
|
+
Configuration,
|
|
326
|
+
WorkflowRunsApi,
|
|
327
|
+
} from '@knowledge-stack/ksapi';
|
|
328
|
+
import type { RejectWorkflowRunFileRequest } from '@knowledge-stack/ksapi';
|
|
329
|
+
|
|
330
|
+
async function example() {
|
|
331
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
332
|
+
const api = new WorkflowRunsApi();
|
|
333
|
+
|
|
334
|
+
const body = {
|
|
335
|
+
// string
|
|
336
|
+
runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
337
|
+
// string
|
|
338
|
+
pathPartId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
339
|
+
// RejectFileRequest
|
|
340
|
+
rejectFileRequest: ...,
|
|
341
|
+
// string (optional)
|
|
342
|
+
authorization: authorization_example,
|
|
343
|
+
// string (optional)
|
|
344
|
+
ksUat: ksUat_example,
|
|
345
|
+
} satisfies RejectWorkflowRunFileRequest;
|
|
346
|
+
|
|
347
|
+
try {
|
|
348
|
+
const data = await api.rejectWorkflowRunFile(body);
|
|
349
|
+
console.log(data);
|
|
350
|
+
} catch (error) {
|
|
351
|
+
console.error(error);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Run the test
|
|
356
|
+
example().catch(console.error);
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Parameters
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
| Name | Type | Description | Notes |
|
|
363
|
+
|------------- | ------------- | ------------- | -------------|
|
|
364
|
+
| **runId** | `string` | | [Defaults to `undefined`] |
|
|
365
|
+
| **pathPartId** | `string` | | [Defaults to `undefined`] |
|
|
366
|
+
| **rejectFileRequest** | [RejectFileRequest](RejectFileRequest.md) | | |
|
|
367
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
368
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
369
|
+
|
|
370
|
+
### Return type
|
|
371
|
+
|
|
372
|
+
[**PathPartApprovalResponse**](PathPartApprovalResponse.md)
|
|
373
|
+
|
|
374
|
+
### Authorization
|
|
375
|
+
|
|
376
|
+
No authorization required
|
|
377
|
+
|
|
378
|
+
### HTTP request headers
|
|
379
|
+
|
|
380
|
+
- **Content-Type**: `application/json`
|
|
381
|
+
- **Accept**: `application/json`
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
### HTTP response details
|
|
385
|
+
| Status code | Description | Response headers |
|
|
386
|
+
|-------------|-------------|------------------|
|
|
387
|
+
| **200** | Successful Response | - |
|
|
388
|
+
| **422** | Validation Error | - |
|
|
389
|
+
|
|
390
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
## releaseWorkflowRunLock
|
|
394
|
+
|
|
395
|
+
> releaseWorkflowRunLock(runId, authorization, ksUat)
|
|
396
|
+
|
|
397
|
+
Release Workflow Run Lock Handler
|
|
398
|
+
|
|
399
|
+
Release the reviewer lock; only the holder may call this. DELETE /lock is idempotent: returns 204 even if no lock is held.
|
|
400
|
+
|
|
401
|
+
### Example
|
|
402
|
+
|
|
403
|
+
```ts
|
|
404
|
+
import {
|
|
405
|
+
Configuration,
|
|
406
|
+
WorkflowRunsApi,
|
|
407
|
+
} from '@knowledge-stack/ksapi';
|
|
408
|
+
import type { ReleaseWorkflowRunLockRequest } from '@knowledge-stack/ksapi';
|
|
409
|
+
|
|
410
|
+
async function example() {
|
|
411
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
412
|
+
const api = new WorkflowRunsApi();
|
|
413
|
+
|
|
414
|
+
const body = {
|
|
415
|
+
// string
|
|
416
|
+
runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
417
|
+
// string (optional)
|
|
418
|
+
authorization: authorization_example,
|
|
419
|
+
// string (optional)
|
|
420
|
+
ksUat: ksUat_example,
|
|
421
|
+
} satisfies ReleaseWorkflowRunLockRequest;
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
const data = await api.releaseWorkflowRunLock(body);
|
|
425
|
+
console.log(data);
|
|
426
|
+
} catch (error) {
|
|
427
|
+
console.error(error);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Run the test
|
|
432
|
+
example().catch(console.error);
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Parameters
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
| Name | Type | Description | Notes |
|
|
439
|
+
|------------- | ------------- | ------------- | -------------|
|
|
440
|
+
| **runId** | `string` | | [Defaults to `undefined`] |
|
|
441
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
442
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
443
|
+
|
|
444
|
+
### Return type
|
|
445
|
+
|
|
446
|
+
`void` (Empty response body)
|
|
447
|
+
|
|
448
|
+
### Authorization
|
|
449
|
+
|
|
450
|
+
No authorization required
|
|
451
|
+
|
|
452
|
+
### HTTP request headers
|
|
453
|
+
|
|
454
|
+
- **Content-Type**: Not defined
|
|
455
|
+
- **Accept**: `application/json`
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
### HTTP response details
|
|
459
|
+
| Status code | Description | Response headers |
|
|
460
|
+
|-------------|-------------|------------------|
|
|
461
|
+
| **204** | Successful Response | - |
|
|
462
|
+
| **422** | Validation Error | - |
|
|
463
|
+
|
|
464
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
## unapproveWorkflowRunFile
|
|
468
|
+
|
|
469
|
+
> PathPartApprovalResponse unapproveWorkflowRunFile(runId, pathPartId, authorization, ksUat)
|
|
470
|
+
|
|
471
|
+
Unapprove Workflow Run File Handler
|
|
472
|
+
|
|
473
|
+
Revert an approved file to ``pending``. Does NOT require the reviewer lock — anyone with ``can_write`` on the run path may unapprove (pilot plan §11.7).
|
|
474
|
+
|
|
475
|
+
### Example
|
|
476
|
+
|
|
477
|
+
```ts
|
|
478
|
+
import {
|
|
479
|
+
Configuration,
|
|
480
|
+
WorkflowRunsApi,
|
|
481
|
+
} from '@knowledge-stack/ksapi';
|
|
482
|
+
import type { UnapproveWorkflowRunFileRequest } from '@knowledge-stack/ksapi';
|
|
483
|
+
|
|
484
|
+
async function example() {
|
|
485
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
486
|
+
const api = new WorkflowRunsApi();
|
|
487
|
+
|
|
488
|
+
const body = {
|
|
489
|
+
// string
|
|
490
|
+
runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
491
|
+
// string
|
|
492
|
+
pathPartId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
493
|
+
// string (optional)
|
|
494
|
+
authorization: authorization_example,
|
|
495
|
+
// string (optional)
|
|
496
|
+
ksUat: ksUat_example,
|
|
497
|
+
} satisfies UnapproveWorkflowRunFileRequest;
|
|
498
|
+
|
|
499
|
+
try {
|
|
500
|
+
const data = await api.unapproveWorkflowRunFile(body);
|
|
501
|
+
console.log(data);
|
|
502
|
+
} catch (error) {
|
|
503
|
+
console.error(error);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// Run the test
|
|
508
|
+
example().catch(console.error);
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### Parameters
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
| Name | Type | Description | Notes |
|
|
515
|
+
|------------- | ------------- | ------------- | -------------|
|
|
516
|
+
| **runId** | `string` | | [Defaults to `undefined`] |
|
|
517
|
+
| **pathPartId** | `string` | | [Defaults to `undefined`] |
|
|
518
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
519
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
520
|
+
|
|
521
|
+
### Return type
|
|
522
|
+
|
|
523
|
+
[**PathPartApprovalResponse**](PathPartApprovalResponse.md)
|
|
524
|
+
|
|
525
|
+
### Authorization
|
|
526
|
+
|
|
527
|
+
No authorization required
|
|
528
|
+
|
|
529
|
+
### HTTP request headers
|
|
530
|
+
|
|
531
|
+
- **Content-Type**: Not defined
|
|
532
|
+
- **Accept**: `application/json`
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
### HTTP response details
|
|
536
|
+
| Status code | Description | Response headers |
|
|
537
|
+
|-------------|-------------|------------------|
|
|
538
|
+
| **200** | Successful Response | - |
|
|
539
|
+
| **422** | Validation Error | - |
|
|
540
|
+
|
|
541
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
542
|
+
|
|
543
|
+
|
|
157
544
|
## workflowRunCallback
|
|
158
545
|
|
|
159
546
|
> WorkflowCallbackResponse workflowRunCallback(runId, workflowRunCallbackRequest)
|
package/package.json
CHANGED
|
@@ -190,7 +190,7 @@ export interface WorkflowDefinitionsApiInterface {
|
|
|
190
190
|
invokeWorkflowRequestOpts(requestParameters: InvokeWorkflowOperationRequest): Promise<runtime.RequestOpts>;
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
|
-
*
|
|
193
|
+
* Trigger a workflow run. All business logic lives in ``WorkflowInvocationService``. This handler only orchestrates the two phases: 1. **Phase 1 (in-session):** validate, build snapshot, persist run row, mint JWT. Wrapped in a single DB session so the run insert and the idempotency-race resolution share a transaction. 2. **Phase 2 (out-of-session):** dispatch HTTP call to the SELF_HOSTED runner. Best-effort — the run is already persisted, so failures here transition the run to ``FAILED`` rather than rejecting the request.
|
|
194
194
|
* @summary Invoke Workflow Handler
|
|
195
195
|
* @param {string} definitionId
|
|
196
196
|
* @param {InvokeWorkflowRequest} invokeWorkflowRequest
|
|
@@ -203,6 +203,7 @@ export interface WorkflowDefinitionsApiInterface {
|
|
|
203
203
|
invokeWorkflowRaw(requestParameters: InvokeWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>>;
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
|
+
* Trigger a workflow run. All business logic lives in ``WorkflowInvocationService``. This handler only orchestrates the two phases: 1. **Phase 1 (in-session):** validate, build snapshot, persist run row, mint JWT. Wrapped in a single DB session so the run insert and the idempotency-race resolution share a transaction. 2. **Phase 2 (out-of-session):** dispatch HTTP call to the SELF_HOSTED runner. Best-effort — the run is already persisted, so failures here transition the run to ``FAILED`` rather than rejecting the request.
|
|
206
207
|
* Invoke Workflow Handler
|
|
207
208
|
*/
|
|
208
209
|
invokeWorkflow(requestParameters: InvokeWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse>;
|
|
@@ -493,6 +494,7 @@ export class WorkflowDefinitionsApi extends runtime.BaseAPI implements WorkflowD
|
|
|
493
494
|
}
|
|
494
495
|
|
|
495
496
|
/**
|
|
497
|
+
* Trigger a workflow run. All business logic lives in ``WorkflowInvocationService``. This handler only orchestrates the two phases: 1. **Phase 1 (in-session):** validate, build snapshot, persist run row, mint JWT. Wrapped in a single DB session so the run insert and the idempotency-race resolution share a transaction. 2. **Phase 2 (out-of-session):** dispatch HTTP call to the SELF_HOSTED runner. Best-effort — the run is already persisted, so failures here transition the run to ``FAILED`` rather than rejecting the request.
|
|
496
498
|
* Invoke Workflow Handler
|
|
497
499
|
*/
|
|
498
500
|
async invokeWorkflowRaw(requestParameters: InvokeWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunResponse>> {
|
|
@@ -503,6 +505,7 @@ export class WorkflowDefinitionsApi extends runtime.BaseAPI implements WorkflowD
|
|
|
503
505
|
}
|
|
504
506
|
|
|
505
507
|
/**
|
|
508
|
+
* Trigger a workflow run. All business logic lives in ``WorkflowInvocationService``. This handler only orchestrates the two phases: 1. **Phase 1 (in-session):** validate, build snapshot, persist run row, mint JWT. Wrapped in a single DB session so the run insert and the idempotency-race resolution share a transaction. 2. **Phase 2 (out-of-session):** dispatch HTTP call to the SELF_HOSTED runner. Best-effort — the run is already persisted, so failures here transition the run to ``FAILED`` rather than rejecting the request.
|
|
506
509
|
* Invoke Workflow Handler
|
|
507
510
|
*/
|
|
508
511
|
async invokeWorkflow(requestParameters: InvokeWorkflowOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunResponse> {
|