@knowledge-stack/ksapi 1.81.0 → 1.82.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.
Files changed (53) hide show
  1. package/.openapi-generator/FILES +2 -0
  2. package/README.md +3 -2
  3. package/dist/apis/WorkflowDefinitionsApi.d.ts +4 -1
  4. package/dist/apis/WorkflowDefinitionsApi.js +2 -0
  5. package/dist/esm/apis/WorkflowDefinitionsApi.d.ts +4 -1
  6. package/dist/esm/apis/WorkflowDefinitionsApi.js +2 -0
  7. package/dist/esm/models/CreateWorkflowDefinitionRequest.d.ts +8 -1
  8. package/dist/esm/models/CreateWorkflowDefinitionRequest.js +1 -4
  9. package/dist/esm/models/InstructionSnapshot.d.ts +71 -0
  10. package/dist/esm/models/InstructionSnapshot.js +57 -0
  11. package/dist/esm/models/InvokeWorkflowRequest.d.ts +6 -0
  12. package/dist/esm/models/InvokeWorkflowRequest.js +6 -0
  13. package/dist/esm/models/UpdateWorkflowDefinitionRequest.d.ts +6 -1
  14. package/dist/esm/models/WorkflowRunResponse.d.ts +17 -0
  15. package/dist/esm/models/WorkflowRunResponse.js +8 -0
  16. package/dist/esm/models/WorkflowRunSnapshot.d.ts +3 -2
  17. package/dist/esm/models/WorkflowRunSnapshot.js +3 -2
  18. package/dist/esm/models/WorkflowRunnerType.d.ts +1 -0
  19. package/dist/esm/models/WorkflowRunnerType.js +2 -1
  20. package/dist/esm/models/index.d.ts +1 -0
  21. package/dist/esm/models/index.js +1 -0
  22. package/dist/models/CreateWorkflowDefinitionRequest.d.ts +8 -1
  23. package/dist/models/CreateWorkflowDefinitionRequest.js +1 -4
  24. package/dist/models/InstructionSnapshot.d.ts +71 -0
  25. package/dist/models/InstructionSnapshot.js +65 -0
  26. package/dist/models/InvokeWorkflowRequest.d.ts +6 -0
  27. package/dist/models/InvokeWorkflowRequest.js +6 -0
  28. package/dist/models/UpdateWorkflowDefinitionRequest.d.ts +6 -1
  29. package/dist/models/WorkflowRunResponse.d.ts +17 -0
  30. package/dist/models/WorkflowRunResponse.js +8 -0
  31. package/dist/models/WorkflowRunSnapshot.d.ts +3 -2
  32. package/dist/models/WorkflowRunSnapshot.js +3 -2
  33. package/dist/models/WorkflowRunnerType.d.ts +1 -0
  34. package/dist/models/WorkflowRunnerType.js +2 -1
  35. package/dist/models/index.d.ts +1 -0
  36. package/dist/models/index.js +1 -0
  37. package/docs/CreateWorkflowDefinitionRequest.md +1 -1
  38. package/docs/InstructionSnapshot.md +41 -0
  39. package/docs/InvokeWorkflowRequest.md +2 -0
  40. package/docs/UpdateWorkflowDefinitionRequest.md +1 -1
  41. package/docs/WorkflowDefinitionsApi.md +2 -0
  42. package/docs/WorkflowRunResponse.md +5 -1
  43. package/docs/WorkflowRunSnapshot.md +1 -1
  44. package/package.json +1 -1
  45. package/src/apis/WorkflowDefinitionsApi.ts +4 -1
  46. package/src/models/CreateWorkflowDefinitionRequest.ts +9 -4
  47. package/src/models/InstructionSnapshot.ts +125 -0
  48. package/src/models/InvokeWorkflowRequest.ts +12 -0
  49. package/src/models/UpdateWorkflowDefinitionRequest.ts +6 -1
  50. package/src/models/WorkflowRunResponse.ts +23 -0
  51. package/src/models/WorkflowRunSnapshot.ts +11 -4
  52. package/src/models/WorkflowRunnerType.ts +2 -1
  53. package/src/models/index.ts +1 -0
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Knowledge Stack API
6
+ * Knowledge Stack backend API for authentication and knowledge management
7
+ *
8
+ * The version of the OpenAPI document: 0.1.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.InstructionSnapshotPropertyValidationAttributesMap = void 0;
17
+ exports.instanceOfInstructionSnapshot = instanceOfInstructionSnapshot;
18
+ exports.InstructionSnapshotFromJSON = InstructionSnapshotFromJSON;
19
+ exports.InstructionSnapshotFromJSONTyped = InstructionSnapshotFromJSONTyped;
20
+ exports.InstructionSnapshotToJSON = InstructionSnapshotToJSON;
21
+ exports.InstructionSnapshotToJSONTyped = InstructionSnapshotToJSONTyped;
22
+ const PartType_1 = require("./PartType");
23
+ exports.InstructionSnapshotPropertyValidationAttributesMap = {};
24
+ /**
25
+ * Check if a given object implements the InstructionSnapshot interface.
26
+ */
27
+ function instanceOfInstructionSnapshot(value) {
28
+ if (!('pathPartId' in value) || value['pathPartId'] === undefined)
29
+ return false;
30
+ if (!('materializedPath' in value) || value['materializedPath'] === undefined)
31
+ return false;
32
+ if (!('partType' in value) || value['partType'] === undefined)
33
+ return false;
34
+ if (!('documentVersionId' in value) || value['documentVersionId'] === undefined)
35
+ return false;
36
+ return true;
37
+ }
38
+ function InstructionSnapshotFromJSON(json) {
39
+ return InstructionSnapshotFromJSONTyped(json, false);
40
+ }
41
+ function InstructionSnapshotFromJSONTyped(json, ignoreDiscriminator) {
42
+ if (json == null) {
43
+ return json;
44
+ }
45
+ return {
46
+ 'pathPartId': json['path_part_id'],
47
+ 'materializedPath': json['materialized_path'],
48
+ 'partType': (0, PartType_1.PartTypeFromJSON)(json['part_type']),
49
+ 'documentVersionId': json['document_version_id'],
50
+ };
51
+ }
52
+ function InstructionSnapshotToJSON(json) {
53
+ return InstructionSnapshotToJSONTyped(json, false);
54
+ }
55
+ function InstructionSnapshotToJSONTyped(value, ignoreDiscriminator = false) {
56
+ if (value == null) {
57
+ return value;
58
+ }
59
+ return {
60
+ 'path_part_id': value['pathPartId'],
61
+ 'materialized_path': value['materializedPath'],
62
+ 'part_type': (0, PartType_1.PartTypeToJSON)(value['partType']),
63
+ 'document_version_id': value['documentVersionId'],
64
+ };
65
+ }
@@ -21,6 +21,12 @@ export interface InvokeWorkflowRequest {
21
21
  * @memberof InvokeWorkflowRequest
22
22
  */
23
23
  idempotencyKey?: string | null;
24
+ /**
25
+ * Path part IDs of input documents to pin to this run. Each path_part must be a DOCUMENT readable by the caller. Active document_version_id is captured at trigger time.
26
+ * @type {Array<string>}
27
+ * @memberof InvokeWorkflowRequest
28
+ */
29
+ inputPathPartIds?: Array<string>;
24
30
  }
25
31
  export declare const InvokeWorkflowRequestPropertyValidationAttributesMap: {
26
32
  [property: string]: {
@@ -23,6 +23,10 @@ exports.InvokeWorkflowRequestPropertyValidationAttributesMap = {
23
23
  idempotencyKey: {
24
24
  maxLength: 255,
25
25
  },
26
+ inputPathPartIds: {
27
+ maxItems: 50,
28
+ uniqueItems: false,
29
+ },
26
30
  };
27
31
  /**
28
32
  * Check if a given object implements the InvokeWorkflowRequest interface.
@@ -39,6 +43,7 @@ function InvokeWorkflowRequestFromJSONTyped(json, ignoreDiscriminator) {
39
43
  }
40
44
  return {
41
45
  'idempotencyKey': json['idempotency_key'] == null ? undefined : json['idempotency_key'],
46
+ 'inputPathPartIds': json['input_path_part_ids'] == null ? undefined : json['input_path_part_ids'],
42
47
  };
43
48
  }
44
49
  function InvokeWorkflowRequestToJSON(json) {
@@ -50,5 +55,6 @@ function InvokeWorkflowRequestToJSONTyped(value, ignoreDiscriminator = false) {
50
55
  }
51
56
  return {
52
57
  'idempotency_key': value['idempotencyKey'],
58
+ 'input_path_part_ids': value['inputPathPartIds'],
53
59
  };
54
60
  }
@@ -12,7 +12,12 @@
12
12
  import type { SelfHostedRunnerConfig } from './SelfHostedRunnerConfig';
13
13
  import type { WorkflowRunnerType } from './WorkflowRunnerType';
14
14
  /**
15
- * Full replacement (PUT semantics). All fields are required.
15
+ * Full replacement (PUT semantics).
16
+ *
17
+ * ``instruction_path_part_ids``:
18
+ *
19
+ * - ``KS_INTERNAL``: must remain ``len == 1`` (the auto-provisioned doc).
20
+ * - ``SELF_HOSTED``: ``len ≥ 1``; callers may swap or add documents.
16
21
  * @export
17
22
  * @interface UpdateWorkflowDefinitionRequest
18
23
  */
@@ -14,6 +14,11 @@ import type { WorkflowRunStatus } from './WorkflowRunStatus';
14
14
  import type { WorkflowRunnerType } from './WorkflowRunnerType';
15
15
  /**
16
16
  * Workflow run response.
17
+ *
18
+ * Note: ``run_token_jti`` is intentionally NOT exposed. It's an
19
+ * internal token identifier persisted on the run row for callback
20
+ * auth — clients should treat run dispatch state as observable via
21
+ * ``status`` (RUNNING => dispatched), not via JTI presence.
17
22
  * @export
18
23
  * @interface WorkflowRunResponse
19
24
  */
@@ -72,6 +77,18 @@ export interface WorkflowRunResponse {
72
77
  * @memberof WorkflowRunResponse
73
78
  */
74
79
  error: string | null;
80
+ /**
81
+ *
82
+ * @type {Array<string>}
83
+ * @memberof WorkflowRunResponse
84
+ */
85
+ inputPathPartIds: Array<string>;
86
+ /**
87
+ *
88
+ * @type {Array<string>}
89
+ * @memberof WorkflowRunResponse
90
+ */
91
+ inputVersionIds: Array<string>;
75
92
  /**
76
93
  *
77
94
  * @type {Date}
@@ -45,6 +45,10 @@ function instanceOfWorkflowRunResponse(value) {
45
45
  return false;
46
46
  if (!('error' in value) || value['error'] === undefined)
47
47
  return false;
48
+ if (!('inputPathPartIds' in value) || value['inputPathPartIds'] === undefined)
49
+ return false;
50
+ if (!('inputVersionIds' in value) || value['inputVersionIds'] === undefined)
51
+ return false;
48
52
  if (!('createdAt' in value) || value['createdAt'] === undefined)
49
53
  return false;
50
54
  if (!('updatedAt' in value) || value['updatedAt'] === undefined)
@@ -68,6 +72,8 @@ function WorkflowRunResponseFromJSONTyped(json, ignoreDiscriminator) {
68
72
  'completedAt': (json['completed_at'] == null ? null : new Date(json['completed_at'])),
69
73
  'runSnapshot': (0, WorkflowRunSnapshot_1.WorkflowRunSnapshotFromJSON)(json['run_snapshot']),
70
74
  'error': json['error'],
75
+ 'inputPathPartIds': json['input_path_part_ids'],
76
+ 'inputVersionIds': json['input_version_ids'],
71
77
  'createdAt': (new Date(json['created_at'])),
72
78
  'updatedAt': (new Date(json['updated_at'])),
73
79
  };
@@ -89,6 +95,8 @@ function WorkflowRunResponseToJSONTyped(value, ignoreDiscriminator = false) {
89
95
  'completed_at': value['completedAt'] == null ? value['completedAt'] : value['completedAt'].toISOString(),
90
96
  'run_snapshot': (0, WorkflowRunSnapshot_1.WorkflowRunSnapshotToJSON)(value['runSnapshot']),
91
97
  'error': value['error'],
98
+ 'input_path_part_ids': value['inputPathPartIds'],
99
+ 'input_version_ids': value['inputVersionIds'],
92
100
  'created_at': value['createdAt'].toISOString(),
93
101
  'updated_at': value['updatedAt'].toISOString(),
94
102
  };
@@ -10,6 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import type { ABCDPathSnapshot } from './ABCDPathSnapshot';
13
+ import type { InstructionSnapshot } from './InstructionSnapshot';
13
14
  import type { WorkflowRunnerType } from './WorkflowRunnerType';
14
15
  /**
15
16
  * Frozen ABCD configuration captured at workflow trigger time.
@@ -55,10 +56,10 @@ export interface WorkflowRunSnapshot {
55
56
  sources: Array<ABCDPathSnapshot>;
56
57
  /**
57
58
  *
58
- * @type {Array<ABCDPathSnapshot>}
59
+ * @type {Array<InstructionSnapshot>}
59
60
  * @memberof WorkflowRunSnapshot
60
61
  */
61
- instructions: Array<ABCDPathSnapshot>;
62
+ instructions: Array<InstructionSnapshot>;
62
63
  /**
63
64
  *
64
65
  * @type {Array<ABCDPathSnapshot>}
@@ -20,6 +20,7 @@ exports.WorkflowRunSnapshotFromJSONTyped = WorkflowRunSnapshotFromJSONTyped;
20
20
  exports.WorkflowRunSnapshotToJSON = WorkflowRunSnapshotToJSON;
21
21
  exports.WorkflowRunSnapshotToJSONTyped = WorkflowRunSnapshotToJSONTyped;
22
22
  const ABCDPathSnapshot_1 = require("./ABCDPathSnapshot");
23
+ const InstructionSnapshot_1 = require("./InstructionSnapshot");
23
24
  const WorkflowRunnerType_1 = require("./WorkflowRunnerType");
24
25
  exports.WorkflowRunSnapshotPropertyValidationAttributesMap = {};
25
26
  /**
@@ -60,7 +61,7 @@ function WorkflowRunSnapshotFromJSONTyped(json, ignoreDiscriminator) {
60
61
  'userId': json['user_id'],
61
62
  'maxRunDurationSeconds': json['max_run_duration_seconds'],
62
63
  'sources': (json['sources'].map(ABCDPathSnapshot_1.ABCDPathSnapshotFromJSON)),
63
- 'instructions': (json['instructions'].map(ABCDPathSnapshot_1.ABCDPathSnapshotFromJSON)),
64
+ 'instructions': (json['instructions'].map(InstructionSnapshot_1.InstructionSnapshotFromJSON)),
64
65
  'outputs': (json['outputs'].map(ABCDPathSnapshot_1.ABCDPathSnapshotFromJSON)),
65
66
  'template': (0, ABCDPathSnapshot_1.ABCDPathSnapshotFromJSON)(json['template']),
66
67
  };
@@ -79,7 +80,7 @@ function WorkflowRunSnapshotToJSONTyped(value, ignoreDiscriminator = false) {
79
80
  'user_id': value['userId'],
80
81
  'max_run_duration_seconds': value['maxRunDurationSeconds'],
81
82
  'sources': (value['sources'].map(ABCDPathSnapshot_1.ABCDPathSnapshotToJSON)),
82
- 'instructions': (value['instructions'].map(ABCDPathSnapshot_1.ABCDPathSnapshotToJSON)),
83
+ 'instructions': (value['instructions'].map(InstructionSnapshot_1.InstructionSnapshotToJSON)),
83
84
  'outputs': (value['outputs'].map(ABCDPathSnapshot_1.ABCDPathSnapshotToJSON)),
84
85
  'template': (0, ABCDPathSnapshot_1.ABCDPathSnapshotToJSON)(value['template']),
85
86
  };
@@ -15,6 +15,7 @@
15
15
  */
16
16
  export declare const WorkflowRunnerType: {
17
17
  readonly SelfHosted: "SELF_HOSTED";
18
+ readonly KsInternal: "KS_INTERNAL";
18
19
  };
19
20
  export type WorkflowRunnerType = typeof WorkflowRunnerType[keyof typeof WorkflowRunnerType];
20
21
  export declare function instanceOfWorkflowRunnerType(value: any): boolean;
@@ -24,7 +24,8 @@ exports.WorkflowRunnerTypeToJSONTyped = WorkflowRunnerTypeToJSONTyped;
24
24
  * @export
25
25
  */
26
26
  exports.WorkflowRunnerType = {
27
- SelfHosted: 'SELF_HOSTED'
27
+ SelfHosted: 'SELF_HOSTED',
28
+ KsInternal: 'KS_INTERNAL'
28
29
  };
29
30
  function instanceOfWorkflowRunnerType(value) {
30
31
  for (const key in exports.WorkflowRunnerType) {
@@ -74,6 +74,7 @@ export * from './ImageTaxonomy';
74
74
  export * from './InformationStatistics';
75
75
  export * from './IngestDocumentResponse';
76
76
  export * from './IngestionMode';
77
+ export * from './InstructionSnapshot';
77
78
  export * from './InviteLinkSettingsRequest';
78
79
  export * from './InviteLinkSettingsResponse';
79
80
  export * from './InviteResponse';
@@ -92,6 +92,7 @@ __exportStar(require("./ImageTaxonomy"), exports);
92
92
  __exportStar(require("./InformationStatistics"), exports);
93
93
  __exportStar(require("./IngestDocumentResponse"), exports);
94
94
  __exportStar(require("./IngestionMode"), exports);
95
+ __exportStar(require("./InstructionSnapshot"), exports);
95
96
  __exportStar(require("./InviteLinkSettingsRequest"), exports);
96
97
  __exportStar(require("./InviteLinkSettingsResponse"), exports);
97
98
  __exportStar(require("./InviteResponse"), exports);
@@ -1,7 +1,7 @@
1
1
 
2
2
  # CreateWorkflowDefinitionRequest
3
3
 
4
- Create a new workflow definition.
4
+ Create a new workflow definition. ``instruction_path_part_ids`` semantics depend on ``runner_type``: - ``KS_INTERNAL``: must be empty (``[]``); the server auto-provisions a single ``instruction.md`` and stores ``[doc.path_part_id]``. - ``SELF_HOSTED``: caller-supplied list of one-or-more document PathPart IDs. Must contain at least one entry.
5
5
 
6
6
  ## Properties
7
7
 
@@ -0,0 +1,41 @@
1
+
2
+ # InstructionSnapshot
3
+
4
+ Snapshot of one instruction document, pinned at trigger time. The instruction file is the workflow\'s **contract**: the agent reads this exact ``document_version_id`` for the duration of the run, even if the document is edited mid-flight or after the run completes. Reproducibility and audit replay depend on this pinning.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `pathPartId` | string
11
+ `materializedPath` | string
12
+ `partType` | [PartType](PartType.md)
13
+ `documentVersionId` | string
14
+
15
+ ## Example
16
+
17
+ ```typescript
18
+ import type { InstructionSnapshot } from '@knowledge-stack/ksapi'
19
+
20
+ // TODO: Update the object below with actual values
21
+ const example = {
22
+ "pathPartId": null,
23
+ "materializedPath": null,
24
+ "partType": null,
25
+ "documentVersionId": null,
26
+ } satisfies InstructionSnapshot
27
+
28
+ console.log(example)
29
+
30
+ // Convert the instance to a JSON string
31
+ const exampleJSON: string = JSON.stringify(example)
32
+ console.log(exampleJSON)
33
+
34
+ // Parse the JSON string back to an object
35
+ const exampleParsed = JSON.parse(exampleJSON) as InstructionSnapshot
36
+ console.log(exampleParsed)
37
+ ```
38
+
39
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
40
+
41
+
@@ -8,6 +8,7 @@ Request body for invoking a workflow definition.
8
8
  Name | Type
9
9
  ------------ | -------------
10
10
  `idempotencyKey` | string
11
+ `inputPathPartIds` | Array&lt;string&gt;
11
12
 
12
13
  ## Example
13
14
 
@@ -17,6 +18,7 @@ import type { InvokeWorkflowRequest } from '@knowledge-stack/ksapi'
17
18
  // TODO: Update the object below with actual values
18
19
  const example = {
19
20
  "idempotencyKey": null,
21
+ "inputPathPartIds": null,
20
22
  } satisfies InvokeWorkflowRequest
21
23
 
22
24
  console.log(example)
@@ -1,7 +1,7 @@
1
1
 
2
2
  # UpdateWorkflowDefinitionRequest
3
3
 
4
- Full replacement (PUT semantics). All fields are required.
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
 
@@ -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 &#x60;&#x60;WorkflowInvocationService&#x60;&#x60;. 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 &#x60;&#x60;FAILED&#x60;&#x60; 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&lt;string&gt;
20
+ `inputVersionIds` | Array&lt;string&gt;
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&lt;ABCDPathSnapshot&gt;](ABCDPathSnapshot.md)
16
- `instructions` | [Array&lt;ABCDPathSnapshot&gt;](ABCDPathSnapshot.md)
16
+ `instructions` | [Array&lt;InstructionSnapshot&gt;](InstructionSnapshot.md)
17
17
  `outputs` | [Array&lt;ABCDPathSnapshot&gt;](ABCDPathSnapshot.md)
18
18
  `template` | [ABCDPathSnapshot](ABCDPathSnapshot.md)
19
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowledge-stack/ksapi",
3
- "version": "1.81.0",
3
+ "version": "1.82.0",
4
4
  "description": "OpenAPI client for @knowledge-stack/ksapi",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -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> {
@@ -30,6 +30,13 @@ import {
30
30
 
31
31
  /**
32
32
  * Create a new workflow definition.
33
+ *
34
+ * ``instruction_path_part_ids`` semantics depend on ``runner_type``:
35
+ *
36
+ * - ``KS_INTERNAL``: must be empty (``[]``); the server auto-provisions a
37
+ * single ``instruction.md`` and stores ``[doc.path_part_id]``.
38
+ * - ``SELF_HOSTED``: caller-supplied list of one-or-more document
39
+ * PathPart IDs. Must contain at least one entry.
33
40
  * @export
34
41
  * @interface CreateWorkflowDefinitionRequest
35
42
  */
@@ -75,7 +82,7 @@ export interface CreateWorkflowDefinitionRequest {
75
82
  * @type {Array<string>}
76
83
  * @memberof CreateWorkflowDefinitionRequest
77
84
  */
78
- instructionPathPartIds: Array<string>;
85
+ instructionPathPartIds?: Array<string>;
79
86
  /**
80
87
  *
81
88
  * @type {Array<string>}
@@ -122,7 +129,6 @@ export const CreateWorkflowDefinitionRequestPropertyValidationAttributesMap: {
122
129
  },
123
130
  instructionPathPartIds: {
124
131
  maxItems: 20,
125
- minItems: 1,
126
132
  uniqueItems: false,
127
133
  },
128
134
  outputPathPartIds: {
@@ -140,7 +146,6 @@ export function instanceOfCreateWorkflowDefinitionRequest(value: object): value
140
146
  if (!('name' in value) || value['name'] === undefined) return false;
141
147
  if (!('runnerType' in value) || value['runnerType'] === undefined) return false;
142
148
  if (!('sourcePathPartIds' in value) || value['sourcePathPartIds'] === undefined) return false;
143
- if (!('instructionPathPartIds' in value) || value['instructionPathPartIds'] === undefined) return false;
144
149
  if (!('outputPathPartIds' in value) || value['outputPathPartIds'] === undefined) return false;
145
150
  return true;
146
151
  }
@@ -161,7 +166,7 @@ export function CreateWorkflowDefinitionRequestFromJSONTyped(json: any, ignoreDi
161
166
  'runnerConfig': json['runner_config'] == null ? undefined : SelfHostedRunnerConfigFromJSON(json['runner_config']),
162
167
  'maxRunDurationSeconds': json['max_run_duration_seconds'] == null ? undefined : json['max_run_duration_seconds'],
163
168
  'sourcePathPartIds': json['source_path_part_ids'],
164
- 'instructionPathPartIds': json['instruction_path_part_ids'],
169
+ 'instructionPathPartIds': json['instruction_path_part_ids'] == null ? undefined : json['instruction_path_part_ids'],
165
170
  'outputPathPartIds': json['output_path_part_ids'],
166
171
  'templatePathPartId': json['template_path_part_id'] == null ? undefined : json['template_path_part_id'],
167
172
  };
@@ -0,0 +1,125 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { PartType } from './PartType';
17
+ import {
18
+ PartTypeFromJSON,
19
+ PartTypeFromJSONTyped,
20
+ PartTypeToJSON,
21
+ PartTypeToJSONTyped,
22
+ } from './PartType';
23
+
24
+ /**
25
+ * Snapshot of one instruction document, pinned at trigger time.
26
+ *
27
+ * The instruction file is the workflow's **contract**: the agent reads
28
+ * this exact ``document_version_id`` for the duration of the run, even
29
+ * if the document is edited mid-flight or after the run completes.
30
+ * Reproducibility and audit replay depend on this pinning.
31
+ * @export
32
+ * @interface InstructionSnapshot
33
+ */
34
+ export interface InstructionSnapshot {
35
+ /**
36
+ *
37
+ * @type {string}
38
+ * @memberof InstructionSnapshot
39
+ */
40
+ pathPartId: string;
41
+ /**
42
+ *
43
+ * @type {string}
44
+ * @memberof InstructionSnapshot
45
+ */
46
+ materializedPath: string;
47
+ /**
48
+ *
49
+ * @type {PartType}
50
+ * @memberof InstructionSnapshot
51
+ */
52
+ partType: PartType;
53
+ /**
54
+ *
55
+ * @type {string}
56
+ * @memberof InstructionSnapshot
57
+ */
58
+ documentVersionId: string;
59
+ }
60
+
61
+
62
+ export const InstructionSnapshotPropertyValidationAttributesMap: {
63
+ [property: string]: {
64
+ maxLength?: number,
65
+ minLength?: number,
66
+ pattern?: string,
67
+ maximum?: number,
68
+ exclusiveMaximum?: boolean,
69
+ minimum?: number,
70
+ exclusiveMinimum?: boolean,
71
+ multipleOf?: number,
72
+ maxItems?: number,
73
+ minItems?: number,
74
+ uniqueItems?: boolean
75
+ }
76
+ } = {
77
+ }
78
+
79
+
80
+ /**
81
+ * Check if a given object implements the InstructionSnapshot interface.
82
+ */
83
+ export function instanceOfInstructionSnapshot(value: object): value is InstructionSnapshot {
84
+ if (!('pathPartId' in value) || value['pathPartId'] === undefined) return false;
85
+ if (!('materializedPath' in value) || value['materializedPath'] === undefined) return false;
86
+ if (!('partType' in value) || value['partType'] === undefined) return false;
87
+ if (!('documentVersionId' in value) || value['documentVersionId'] === undefined) return false;
88
+ return true;
89
+ }
90
+
91
+ export function InstructionSnapshotFromJSON(json: any): InstructionSnapshot {
92
+ return InstructionSnapshotFromJSONTyped(json, false);
93
+ }
94
+
95
+ export function InstructionSnapshotFromJSONTyped(json: any, ignoreDiscriminator: boolean): InstructionSnapshot {
96
+ if (json == null) {
97
+ return json;
98
+ }
99
+ return {
100
+
101
+ 'pathPartId': json['path_part_id'],
102
+ 'materializedPath': json['materialized_path'],
103
+ 'partType': PartTypeFromJSON(json['part_type']),
104
+ 'documentVersionId': json['document_version_id'],
105
+ };
106
+ }
107
+
108
+ export function InstructionSnapshotToJSON(json: any): InstructionSnapshot {
109
+ return InstructionSnapshotToJSONTyped(json, false);
110
+ }
111
+
112
+ export function InstructionSnapshotToJSONTyped(value?: InstructionSnapshot | null, ignoreDiscriminator: boolean = false): any {
113
+ if (value == null) {
114
+ return value;
115
+ }
116
+
117
+ return {
118
+
119
+ 'path_part_id': value['pathPartId'],
120
+ 'materialized_path': value['materializedPath'],
121
+ 'part_type': PartTypeToJSON(value['partType']),
122
+ 'document_version_id': value['documentVersionId'],
123
+ };
124
+ }
125
+
@@ -25,6 +25,12 @@ export interface InvokeWorkflowRequest {
25
25
  * @memberof InvokeWorkflowRequest
26
26
  */
27
27
  idempotencyKey?: string | null;
28
+ /**
29
+ * Path part IDs of input documents to pin to this run. Each path_part must be a DOCUMENT readable by the caller. Active document_version_id is captured at trigger time.
30
+ * @type {Array<string>}
31
+ * @memberof InvokeWorkflowRequest
32
+ */
33
+ inputPathPartIds?: Array<string>;
28
34
  }
29
35
  export const InvokeWorkflowRequestPropertyValidationAttributesMap: {
30
36
  [property: string]: {
@@ -44,6 +50,10 @@ export const InvokeWorkflowRequestPropertyValidationAttributesMap: {
44
50
  idempotencyKey: {
45
51
  maxLength: 255,
46
52
  },
53
+ inputPathPartIds: {
54
+ maxItems: 50,
55
+ uniqueItems: false,
56
+ },
47
57
  }
48
58
 
49
59
 
@@ -65,6 +75,7 @@ export function InvokeWorkflowRequestFromJSONTyped(json: any, ignoreDiscriminato
65
75
  return {
66
76
 
67
77
  'idempotencyKey': json['idempotency_key'] == null ? undefined : json['idempotency_key'],
78
+ 'inputPathPartIds': json['input_path_part_ids'] == null ? undefined : json['input_path_part_ids'],
68
79
  };
69
80
  }
70
81
 
@@ -80,6 +91,7 @@ export function InvokeWorkflowRequestToJSONTyped(value?: InvokeWorkflowRequest |
80
91
  return {
81
92
 
82
93
  'idempotency_key': value['idempotencyKey'],
94
+ 'input_path_part_ids': value['inputPathPartIds'],
83
95
  };
84
96
  }
85
97