ai-ctrl-workflow-contract 0.1.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/package.json +22 -0
- package/src/index.ts +53 -0
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-ctrl-workflow-contract",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "AI Ctrl Workflow contracts backed by WorkCtrlFlow runtime state",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"ai-workflow-contract": "0.1.0",
|
|
13
|
+
"work-ctrl-flow-contract": "0.1.0"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"registry": "https://registry.npmjs.com"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AICtrlWorkflowDefinitionBinding,
|
|
3
|
+
AIWorkflowRuntimeContext,
|
|
4
|
+
} from 'ai-workflow-contract';
|
|
5
|
+
import type {
|
|
6
|
+
ResumeSignal,
|
|
7
|
+
TickOutcome,
|
|
8
|
+
WaitHandle,
|
|
9
|
+
WorkCtrlFlowSnapshot,
|
|
10
|
+
WorkCtrlFlowStartOptions,
|
|
11
|
+
WorkCtrlFlowStore,
|
|
12
|
+
} from 'work-ctrl-flow-contract';
|
|
13
|
+
|
|
14
|
+
export type AICtrlWorkflowRunStatus = 'Waiting' | 'Completed' | 'Failed';
|
|
15
|
+
|
|
16
|
+
export type AICtrlWorkflowNodeStatus = 'Succeeded' | 'Failed' | 'Waiting';
|
|
17
|
+
|
|
18
|
+
export interface AICtrlWorkflowDefinition {
|
|
19
|
+
readonly binding: AICtrlWorkflowDefinitionBinding;
|
|
20
|
+
readonly resourceRef?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AICtrlWorkflowNodeRecord {
|
|
24
|
+
readonly nodeId: string;
|
|
25
|
+
readonly invocationKey: string;
|
|
26
|
+
readonly status: AICtrlWorkflowNodeStatus;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AICtrlWorkflowRunRecord {
|
|
30
|
+
readonly treeId: string;
|
|
31
|
+
readonly fqn: string;
|
|
32
|
+
readonly status: AICtrlWorkflowRunStatus;
|
|
33
|
+
readonly tickNo: number;
|
|
34
|
+
readonly openWaitHandles: readonly WaitHandle[];
|
|
35
|
+
readonly nodes: readonly AICtrlWorkflowNodeRecord[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface AICtrlWorkflowController {
|
|
39
|
+
readonly store: WorkCtrlFlowStore;
|
|
40
|
+
start(treeId: string, options?: WorkCtrlFlowStartOptions): Promise<TickOutcome>;
|
|
41
|
+
resume(treeId: string, signal: ResumeSignal): Promise<TickOutcome>;
|
|
42
|
+
refresh(treeId: string): Promise<TickOutcome>;
|
|
43
|
+
getOutcome(treeId: string): Promise<TickOutcome | undefined>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface AICtrlWorkflowRuntimeContextBinding {
|
|
47
|
+
readonly ai: AIWorkflowRuntimeContext;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface AICtrlWorkflowSnapshotProjectionInput {
|
|
51
|
+
readonly snapshot: WorkCtrlFlowSnapshot;
|
|
52
|
+
readonly outcome?: TickOutcome;
|
|
53
|
+
}
|