ai-data-workflow-contract 0.1.6 → 0.1.7
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/package.json +3 -3
- package/src/index.ts +183 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-data-workflow-contract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "AI Data Workflow RunGraph contracts backed by EagerDataFlow authoring plans",
|
|
6
6
|
"type": "module",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
".": "./src/index.ts"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"ai-workflow-contract": "0.1.
|
|
13
|
-
"eager-data-flow-contract": "0.1.
|
|
12
|
+
"ai-workflow-contract": "0.1.9",
|
|
13
|
+
"eager-data-flow-contract": "0.1.4"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"src"
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
AIWorkflowRunRef,
|
|
10
10
|
AIWorkflowRunStatus,
|
|
11
11
|
AIWorkflowSemanticFingerprint,
|
|
12
|
+
FlowClosedObject,
|
|
12
13
|
FlowRunCheckpoint,
|
|
13
14
|
} from 'ai-workflow-contract';
|
|
14
15
|
import type {
|
|
@@ -44,6 +45,136 @@ export interface AIDataWorkflowInvalidation {
|
|
|
44
45
|
readonly atMs?: number;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
export interface AIDataWorkflowDeclaredSubFlowBinding {
|
|
49
|
+
readonly kind: 'declared';
|
|
50
|
+
readonly flowRef: `eager-data-flow://${string}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface AIDataWorkflowAutonomousSubFlowBinding {
|
|
54
|
+
readonly kind: 'autonomous';
|
|
55
|
+
readonly schemaVersion: 'depa.ai-data-subflow-binding/v1';
|
|
56
|
+
readonly capabilityId: string;
|
|
57
|
+
readonly catalogDigest: string;
|
|
58
|
+
readonly definitionRef: `resource://${string}`;
|
|
59
|
+
readonly flowRef: `eager-data-flow://${string}`;
|
|
60
|
+
readonly contractDigest: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type AIDataWorkflowSubFlowBinding =
|
|
64
|
+
| AIDataWorkflowDeclaredSubFlowBinding
|
|
65
|
+
| AIDataWorkflowAutonomousSubFlowBinding;
|
|
66
|
+
|
|
67
|
+
export const AI_DATA_CHILD_INVOCATION_SCHEMA_VERSION = 'depa.ai-data-child-invocation/v1' as const;
|
|
68
|
+
|
|
69
|
+
export interface AIDataWorkflowChildInvocationIdentity {
|
|
70
|
+
readonly schemaVersion: typeof AI_DATA_CHILD_INVOCATION_SCHEMA_VERSION;
|
|
71
|
+
readonly invocationKey: string;
|
|
72
|
+
readonly parentInstanceId: string;
|
|
73
|
+
readonly parentRunId: string;
|
|
74
|
+
readonly parentNodeId: string;
|
|
75
|
+
readonly parentGeneration: number;
|
|
76
|
+
readonly childInstanceId: string;
|
|
77
|
+
readonly childRunId: string;
|
|
78
|
+
readonly subflow: AIDataWorkflowAutonomousSubFlowBinding;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Immutable proof that the exact child resource closure was resolved before dispatch. */
|
|
82
|
+
export interface AIDataWorkflowChildFreezeReceipt {
|
|
83
|
+
readonly schemaVersion: typeof AI_DATA_CHILD_INVOCATION_SCHEMA_VERSION;
|
|
84
|
+
readonly invocationKey: string;
|
|
85
|
+
readonly childInstanceId: string;
|
|
86
|
+
readonly childRunId: string;
|
|
87
|
+
readonly definitionRef: `resource://${string}`;
|
|
88
|
+
readonly flowRef: `eager-data-flow://${string}`;
|
|
89
|
+
readonly contractDigest: string;
|
|
90
|
+
readonly definitionRevision: string;
|
|
91
|
+
readonly definitionDigest: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type AIDataWorkflowChildInvocationStatus =
|
|
95
|
+
| 'Reserved'
|
|
96
|
+
| 'Running'
|
|
97
|
+
| 'Succeeded'
|
|
98
|
+
| 'Failed';
|
|
99
|
+
|
|
100
|
+
/** Read-only child-owner projection. The parent never writes child lifecycle state. */
|
|
101
|
+
export interface AIDataWorkflowChildInvocationObservation {
|
|
102
|
+
readonly schemaVersion: typeof AI_DATA_CHILD_INVOCATION_SCHEMA_VERSION;
|
|
103
|
+
readonly invocationKey: string;
|
|
104
|
+
readonly childInstanceId: string;
|
|
105
|
+
readonly childRunId: string;
|
|
106
|
+
readonly status: AIDataWorkflowChildInvocationStatus;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface AIDataWorkflowChildSucceededReceipt {
|
|
110
|
+
readonly schemaVersion: typeof AI_DATA_CHILD_INVOCATION_SCHEMA_VERSION;
|
|
111
|
+
readonly invocationKey: string;
|
|
112
|
+
readonly childInstanceId: string;
|
|
113
|
+
readonly childRunId: string;
|
|
114
|
+
readonly definitionRef: `resource://${string}`;
|
|
115
|
+
readonly flowRef: `eager-data-flow://${string}`;
|
|
116
|
+
readonly contractDigest: string;
|
|
117
|
+
readonly status: 'Succeeded';
|
|
118
|
+
readonly output: FlowClosedObject;
|
|
119
|
+
readonly receiptDigest: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface AIDataWorkflowChildFailedReceipt {
|
|
123
|
+
readonly schemaVersion: typeof AI_DATA_CHILD_INVOCATION_SCHEMA_VERSION;
|
|
124
|
+
readonly invocationKey: string;
|
|
125
|
+
readonly childInstanceId: string;
|
|
126
|
+
readonly childRunId: string;
|
|
127
|
+
readonly definitionRef: `resource://${string}`;
|
|
128
|
+
readonly flowRef: `eager-data-flow://${string}`;
|
|
129
|
+
readonly contractDigest: string;
|
|
130
|
+
readonly status: 'Failed';
|
|
131
|
+
readonly failureCode: string;
|
|
132
|
+
readonly failureMessage: string;
|
|
133
|
+
readonly receiptDigest: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type AIDataWorkflowChildTerminalReceipt =
|
|
137
|
+
| AIDataWorkflowChildSucceededReceipt
|
|
138
|
+
| AIDataWorkflowChildFailedReceipt;
|
|
139
|
+
|
|
140
|
+
export interface AIDataWorkflowResolveAndFreezeChildRequest {
|
|
141
|
+
readonly identity: AIDataWorkflowChildInvocationIdentity;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface AIDataWorkflowStartOrContinueChildRequest {
|
|
145
|
+
readonly identity: AIDataWorkflowChildInvocationIdentity;
|
|
146
|
+
readonly freeze: AIDataWorkflowChildFreezeReceipt;
|
|
147
|
+
readonly input: FlowClosedObject;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface AIDataWorkflowLoadChildRequest {
|
|
151
|
+
readonly identity: AIDataWorkflowChildInvocationIdentity;
|
|
152
|
+
readonly freeze: AIDataWorkflowChildFreezeReceipt;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface AIDataWorkflowSettleChildRequest extends AIDataWorkflowLoadChildRequest {
|
|
156
|
+
readonly terminalStatus: 'Succeeded' | 'Failed';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Narrow child-owner port. Every operation is idempotent for one deterministic identity;
|
|
161
|
+
* startOrContinue must continue an existing child rather than create a successor.
|
|
162
|
+
*/
|
|
163
|
+
export interface AIDataWorkflowChildInvocationRuntimePort {
|
|
164
|
+
resolveAndFreeze(
|
|
165
|
+
request: AIDataWorkflowResolveAndFreezeChildRequest,
|
|
166
|
+
): Promise<AIDataWorkflowChildFreezeReceipt>;
|
|
167
|
+
startOrContinue(
|
|
168
|
+
request: AIDataWorkflowStartOrContinueChildRequest,
|
|
169
|
+
): Promise<AIDataWorkflowChildInvocationObservation>;
|
|
170
|
+
load(
|
|
171
|
+
request: AIDataWorkflowLoadChildRequest,
|
|
172
|
+
): Promise<AIDataWorkflowChildInvocationObservation>;
|
|
173
|
+
settle(
|
|
174
|
+
request: AIDataWorkflowSettleChildRequest,
|
|
175
|
+
): Promise<AIDataWorkflowChildTerminalReceipt>;
|
|
176
|
+
}
|
|
177
|
+
|
|
47
178
|
export interface AIDataWorkflowRunNode {
|
|
48
179
|
readonly id: string;
|
|
49
180
|
readonly tag: AIDataWorkflowNodeTag;
|
|
@@ -54,6 +185,10 @@ export interface AIDataWorkflowRunNode {
|
|
|
54
185
|
readonly inputs: AIDataWorkflowNodeInputs;
|
|
55
186
|
readonly outputs: readonly string[];
|
|
56
187
|
readonly config: AIDataWorkflowNodeConfig;
|
|
188
|
+
readonly subflow?: AIDataWorkflowSubFlowBinding;
|
|
189
|
+
readonly childInvocation?: AIDataWorkflowChildInvocationIdentity;
|
|
190
|
+
readonly childFreezeReceipt?: AIDataWorkflowChildFreezeReceipt;
|
|
191
|
+
readonly childTerminalReceipt?: AIDataWorkflowChildTerminalReceipt;
|
|
57
192
|
readonly dependsOn: readonly string[];
|
|
58
193
|
readonly dependents: readonly string[];
|
|
59
194
|
readonly reusePolicy: AIWorkflowEffectiveReusePolicy;
|
|
@@ -70,6 +205,7 @@ export interface AIDataWorkflowGraphPatchNodeSpec {
|
|
|
70
205
|
readonly inputs?: AIDataWorkflowNodeInputs;
|
|
71
206
|
readonly outputs?: readonly string[];
|
|
72
207
|
readonly config?: AIDataWorkflowNodeConfig;
|
|
208
|
+
readonly subflow?: AIDataWorkflowSubFlowBinding;
|
|
73
209
|
readonly dependsOn?: readonly string[];
|
|
74
210
|
readonly reusePolicy?: AIWorkflowEffectiveReusePolicy;
|
|
75
211
|
}
|
|
@@ -80,6 +216,7 @@ export interface AIDataWorkflowGraphPatchNodeChanges {
|
|
|
80
216
|
readonly inputs?: AIDataWorkflowNodeInputs;
|
|
81
217
|
readonly outputs?: readonly string[];
|
|
82
218
|
readonly config?: AIDataWorkflowNodeConfig;
|
|
219
|
+
readonly subflow?: AIDataWorkflowSubFlowBinding | null;
|
|
83
220
|
readonly dependsOn?: readonly string[];
|
|
84
221
|
readonly reusePolicy?: AIWorkflowEffectiveReusePolicy;
|
|
85
222
|
}
|
|
@@ -230,20 +367,42 @@ export interface AIDataControlAgentCapabilityImplementation {
|
|
|
230
367
|
readonly taskProofRef: `resource://${string}`;
|
|
231
368
|
}
|
|
232
369
|
|
|
233
|
-
export
|
|
370
|
+
export interface AIDataControlSubFlowCapabilityImplementation {
|
|
371
|
+
readonly kind: 'subflow';
|
|
372
|
+
readonly definitionRef: `resource://${string}`;
|
|
373
|
+
readonly flowRef: `eager-data-flow://${string}`;
|
|
374
|
+
readonly contractDigest: string;
|
|
375
|
+
readonly callGraphDigest: string;
|
|
376
|
+
readonly transitiveChildFlowRefs: readonly `eager-data-flow://${string}`[];
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export type AIDataControlExecutableCapabilityImplementation =
|
|
234
380
|
| AIDataControlCodeCapabilityImplementation
|
|
235
381
|
| AIDataControlAgentCapabilityImplementation;
|
|
236
382
|
|
|
237
|
-
export interface
|
|
383
|
+
export interface AIDataControlCapabilityBase {
|
|
238
384
|
readonly capabilityId: string;
|
|
239
|
-
readonly tag: 'TransformNode' | 'SinkNode';
|
|
240
|
-
readonly nodeType: AIWorkflowNodeType;
|
|
241
385
|
readonly inputSchemaRefs: Readonly<Record<string, string>>;
|
|
242
386
|
readonly outputSchemaRefs: Readonly<Record<string, string>>;
|
|
243
387
|
readonly fixedConfig: AIDataWorkflowNodeConfig;
|
|
244
|
-
readonly implementation: AIDataControlCapabilityImplementation;
|
|
245
388
|
}
|
|
246
389
|
|
|
390
|
+
export interface AIDataControlExecutableCapability extends AIDataControlCapabilityBase {
|
|
391
|
+
readonly tag: 'TransformNode' | 'SinkNode';
|
|
392
|
+
readonly nodeType: AIWorkflowNodeType;
|
|
393
|
+
readonly implementation: AIDataControlExecutableCapabilityImplementation;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface AIDataControlSubFlowCapability extends AIDataControlCapabilityBase {
|
|
397
|
+
readonly tag: 'SubFlowNode';
|
|
398
|
+
readonly nodeType: 'subflow';
|
|
399
|
+
readonly implementation: AIDataControlSubFlowCapabilityImplementation;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export type AIDataControlCapability =
|
|
403
|
+
| AIDataControlExecutableCapability
|
|
404
|
+
| AIDataControlSubFlowCapability;
|
|
405
|
+
|
|
247
406
|
export interface AIDataControlCapabilityCatalog {
|
|
248
407
|
readonly schemaVersion: AIDataControlSchemaVersion;
|
|
249
408
|
readonly catalogId: string;
|
|
@@ -303,6 +462,7 @@ export type AIDataControlFeedbackCode =
|
|
|
303
462
|
| 'UNKNOWN_NODE'
|
|
304
463
|
| 'INPUT_CONTRACT_MISMATCH'
|
|
305
464
|
| 'OUTPUT_CONTRACT_MISMATCH'
|
|
465
|
+
| 'RECURSIVE_SUBFLOW'
|
|
306
466
|
| 'NO_PROGRESS'
|
|
307
467
|
| 'VERIFIER_REQUIRED'
|
|
308
468
|
| 'VERIFIER_MISMATCH'
|
|
@@ -361,6 +521,22 @@ export interface AIDataControlRewireCapabilityOperation {
|
|
|
361
521
|
readonly dependsOn?: readonly string[];
|
|
362
522
|
}
|
|
363
523
|
|
|
524
|
+
export interface AIDataControlAddSubFlowOperation {
|
|
525
|
+
readonly op: 'add-subflow';
|
|
526
|
+
readonly nodeId: string;
|
|
527
|
+
readonly subflowCapabilityId: string;
|
|
528
|
+
readonly inputs: Readonly<Record<string, AIDataControlInputBinding>>;
|
|
529
|
+
readonly dependsOn?: readonly string[];
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface AIDataControlRewireSubFlowOperation {
|
|
533
|
+
readonly op: 'rewire-subflow';
|
|
534
|
+
readonly nodeId: string;
|
|
535
|
+
readonly subflowCapabilityId: string;
|
|
536
|
+
readonly inputs: Readonly<Record<string, AIDataControlInputBinding>>;
|
|
537
|
+
readonly dependsOn?: readonly string[];
|
|
538
|
+
}
|
|
539
|
+
|
|
364
540
|
export interface AIDataControlRemoveNodeOperation {
|
|
365
541
|
readonly op: 'remove-node';
|
|
366
542
|
readonly nodeId: string;
|
|
@@ -369,6 +545,8 @@ export interface AIDataControlRemoveNodeOperation {
|
|
|
369
545
|
export type AIDataControlRevisionOperation =
|
|
370
546
|
| AIDataControlAddCapabilityOperation
|
|
371
547
|
| AIDataControlRewireCapabilityOperation
|
|
548
|
+
| AIDataControlAddSubFlowOperation
|
|
549
|
+
| AIDataControlRewireSubFlowOperation
|
|
372
550
|
| AIDataControlRemoveNodeOperation;
|
|
373
551
|
|
|
374
552
|
interface AIDataControlDecisionBase {
|