ai-workflow-contract 0.1.0 → 0.1.2
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 -2
- package/src/index.ts +144 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-workflow-contract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared AI workflow contracts over WorkCtrlFlow and EagerDataFlow substrates",
|
|
6
6
|
"type": "module",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"eager-data-flow-contract": "0.1.0",
|
|
13
|
+
"halfcode-compiler.xnl": "0.2.2",
|
|
13
14
|
"work-ctrl-flow-contract": "0.1.0"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
@@ -19,4 +20,4 @@
|
|
|
19
20
|
"access": "public",
|
|
20
21
|
"registry": "https://registry.npmjs.com"
|
|
21
22
|
}
|
|
22
|
-
}
|
|
23
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { EagerDataFlowAuthoringPlan, EagerDataFlowValue } from 'eager-data-flow-contract';
|
|
2
|
+
import type {
|
|
3
|
+
ResourceDependencyEdge,
|
|
4
|
+
ResourceDependencySnapshot,
|
|
5
|
+
ResourceRecord,
|
|
6
|
+
ResourceRegistry,
|
|
7
|
+
ResourceTree,
|
|
8
|
+
Sha256Digest,
|
|
9
|
+
} from 'halfcode-compiler.xnl/resource-core';
|
|
2
10
|
import type { FlowBundleSpec, WorkCtrlFlowRuntime } from 'work-ctrl-flow-contract';
|
|
3
11
|
|
|
4
12
|
export type AIWorkflowKind = 'AICtrlWorkflow' | 'AIDataWorkflow';
|
|
@@ -9,8 +17,10 @@ export type AIWorkflowReusePolicy = 'semantic-hash' | 'never';
|
|
|
9
17
|
|
|
10
18
|
export type AIWorkflowReusePolicySource = 'node' | 'node-type-default' | 'platform-default';
|
|
11
19
|
|
|
20
|
+
/** @deprecated Generic resource-reference authority belongs to Halfcode. */
|
|
12
21
|
export type AIWorkflowResourceRefScheme = 'vfs' | 'resource' | 'config' | 'secret';
|
|
13
22
|
|
|
23
|
+
/** @deprecated Retained for 0.1.x compatibility; do not use for resource discovery. */
|
|
14
24
|
export const AI_WORKFLOW_ALLOWED_RESOURCE_REF_SCHEMES = Object.freeze([
|
|
15
25
|
'vfs',
|
|
16
26
|
'resource',
|
|
@@ -18,8 +28,10 @@ export const AI_WORKFLOW_ALLOWED_RESOURCE_REF_SCHEMES = Object.freeze([
|
|
|
18
28
|
'secret',
|
|
19
29
|
] as const satisfies readonly AIWorkflowResourceRefScheme[]);
|
|
20
30
|
|
|
31
|
+
/** @deprecated Use normalized Halfcode ResourceRecord facts and typed domain refs. */
|
|
21
32
|
export type AIWorkflowResourceRef = `${AIWorkflowResourceRefScheme}://${string}`;
|
|
22
33
|
|
|
34
|
+
/** @deprecated This open vocabulary is not a Kind registry. Halfcode owns KindDefinition. */
|
|
23
35
|
export type AIWorkflowResourceKind =
|
|
24
36
|
| 'AIWorkflowAppBundle'
|
|
25
37
|
| 'AIWorkflowCatalog'
|
|
@@ -33,6 +45,7 @@ export type AIWorkflowResourceKind =
|
|
|
33
45
|
| 'SecretHandle'
|
|
34
46
|
| (string & {});
|
|
35
47
|
|
|
48
|
+
/** @deprecated Halfcode ResourceRecord owns generic resource identity and provenance. */
|
|
36
49
|
export interface AIWorkflowResourceIdentity {
|
|
37
50
|
readonly kind: AIWorkflowResourceKind;
|
|
38
51
|
readonly fqn: string;
|
|
@@ -40,6 +53,7 @@ export interface AIWorkflowResourceIdentity {
|
|
|
40
53
|
readonly revision?: string;
|
|
41
54
|
}
|
|
42
55
|
|
|
56
|
+
/** @deprecated Halfcode ResourcePackage/Catalog owns generic resource membership. */
|
|
43
57
|
export interface AIWorkflowCatalogEntry {
|
|
44
58
|
readonly id: string;
|
|
45
59
|
readonly kind: AIWorkflowResourceKind;
|
|
@@ -47,11 +61,16 @@ export interface AIWorkflowCatalogEntry {
|
|
|
47
61
|
readonly fqn?: string;
|
|
48
62
|
}
|
|
49
63
|
|
|
64
|
+
/** @deprecated Halfcode ResourcePackage/Catalog owns generic resource membership. */
|
|
50
65
|
export interface AIWorkflowResourceCatalog {
|
|
51
66
|
readonly id: string;
|
|
52
67
|
readonly entries: readonly AIWorkflowCatalogEntry[];
|
|
53
68
|
}
|
|
54
69
|
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated Compatibility DTO for the pre-Halfcode catalog surface.
|
|
72
|
+
* Use AIWorkflowAppBundleProjection for canonical consumers.
|
|
73
|
+
*/
|
|
55
74
|
export interface AIWorkflowAppBundleManifest {
|
|
56
75
|
readonly kind: 'AIWorkflowAppBundle';
|
|
57
76
|
readonly fqn: string;
|
|
@@ -60,6 +79,131 @@ export interface AIWorkflowAppBundleManifest {
|
|
|
60
79
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
61
80
|
}
|
|
62
81
|
|
|
82
|
+
export type AIWorkflowDefinitionResourceKind = 'AICtrlWorkflow' | 'AIDataWorkflow';
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Minimal public Halfcode read port. ResourceTree.registry and
|
|
86
|
+
* EffectiveResourceRegistry both satisfy this shape without depa-flows owning
|
|
87
|
+
* either registry implementation.
|
|
88
|
+
*/
|
|
89
|
+
export type AIWorkflowResourceRegistryView = Pick<ResourceRegistry, 'byKind'>;
|
|
90
|
+
|
|
91
|
+
export interface AIWorkflowBindingProjection {
|
|
92
|
+
readonly id: string;
|
|
93
|
+
readonly kind: AIWorkflowDefinitionResourceKind;
|
|
94
|
+
readonly ref: `resource://${string}`;
|
|
95
|
+
readonly entrypoint: boolean;
|
|
96
|
+
readonly resource: ResourceRecord;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface AIWorkflowAppBundleProjection {
|
|
100
|
+
readonly kind: 'AIWorkflowAppBundle';
|
|
101
|
+
readonly fqn: string;
|
|
102
|
+
readonly packageResourceId?: string;
|
|
103
|
+
readonly resource: ResourceRecord;
|
|
104
|
+
readonly workflowBindings: readonly AIWorkflowBindingProjection[];
|
|
105
|
+
readonly entrypoints: readonly AIWorkflowBindingProjection[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface AIWorkflowResourceProjectionDiagnostic {
|
|
109
|
+
readonly code: string;
|
|
110
|
+
readonly location: string;
|
|
111
|
+
readonly message: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface ProjectAIWorkflowAppBundlesOptions {
|
|
115
|
+
readonly packageResourceId?: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface LoadedAIWorkflowResourcePackage {
|
|
119
|
+
readonly tree: ResourceTree;
|
|
120
|
+
readonly appBundles: readonly AIWorkflowAppBundleProjection[];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export type AIAgentMessageRole = 'system' | 'developer' | 'user' | 'assistant';
|
|
124
|
+
|
|
125
|
+
export type MaterialCardinality = 'one' | 'many';
|
|
126
|
+
|
|
127
|
+
export type AIWorkflowAgentResourceRelation =
|
|
128
|
+
| 'agent-message-prompt'
|
|
129
|
+
| 'agent-message-schema'
|
|
130
|
+
| 'agent-input-schema'
|
|
131
|
+
| 'agent-output-schema'
|
|
132
|
+
| 'agent-tool'
|
|
133
|
+
| 'agent-effect-policy'
|
|
134
|
+
| 'agent-material-port'
|
|
135
|
+
| 'material-port-schema'
|
|
136
|
+
| 'material-binding-port'
|
|
137
|
+
| 'material-binding-material'
|
|
138
|
+
| 'workflow-agent-task'
|
|
139
|
+
| 'workflow-material-binding';
|
|
140
|
+
|
|
141
|
+
export interface AIWorkflowTypedResourceRef {
|
|
142
|
+
readonly kind: string;
|
|
143
|
+
readonly ref: `resource://${string}`;
|
|
144
|
+
readonly resource: ResourceRecord;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface AIAgentMessageProjection {
|
|
148
|
+
readonly id: string;
|
|
149
|
+
readonly role: AIAgentMessageRole;
|
|
150
|
+
readonly prompt: AIWorkflowTypedResourceRef;
|
|
151
|
+
readonly schema?: AIWorkflowTypedResourceRef;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface MaterialPortProjection {
|
|
155
|
+
readonly kind: 'MaterialPort';
|
|
156
|
+
readonly fqn: string;
|
|
157
|
+
readonly resource: ResourceRecord;
|
|
158
|
+
readonly materialKind: string;
|
|
159
|
+
readonly required: boolean;
|
|
160
|
+
readonly cardinality: MaterialCardinality;
|
|
161
|
+
readonly schema?: AIWorkflowTypedResourceRef;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface AIAgentDefinitionProjection {
|
|
165
|
+
readonly kind: 'AIAgentDefinition';
|
|
166
|
+
readonly fqn: string;
|
|
167
|
+
readonly resource: ResourceRecord;
|
|
168
|
+
readonly messages: readonly AIAgentMessageProjection[];
|
|
169
|
+
readonly inputSchema?: AIWorkflowTypedResourceRef;
|
|
170
|
+
readonly outputSchema?: AIWorkflowTypedResourceRef;
|
|
171
|
+
readonly tools: readonly AIWorkflowTypedResourceRef[];
|
|
172
|
+
readonly effectPolicy?: AIWorkflowTypedResourceRef;
|
|
173
|
+
readonly materialPorts: readonly AIWorkflowTypedResourceRef[];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface AIWorkflowAgentTaskRef {
|
|
177
|
+
readonly workflowKind: AIWorkflowDefinitionResourceKind;
|
|
178
|
+
readonly workflowRef: `resource://${string}`;
|
|
179
|
+
readonly nodeId: string;
|
|
180
|
+
readonly agentDefinitionRef: `resource://${string}`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface MaterialBindingProjection {
|
|
184
|
+
readonly kind: 'MaterialBinding';
|
|
185
|
+
readonly fqn: string;
|
|
186
|
+
readonly resource: ResourceRecord;
|
|
187
|
+
readonly task: AIWorkflowAgentTaskRef;
|
|
188
|
+
readonly port: MaterialPortProjection;
|
|
189
|
+
readonly material: AIWorkflowTypedResourceRef;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface AIWorkflowAgentResourceProjection {
|
|
193
|
+
readonly agentDefinitions: readonly AIAgentDefinitionProjection[];
|
|
194
|
+
readonly materialPorts: readonly MaterialPortProjection[];
|
|
195
|
+
readonly materialBindings: readonly MaterialBindingProjection[];
|
|
196
|
+
readonly dependencyEdges: readonly ResourceDependencyEdge[];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface AIWorkflowRunResourceFreezeReceipt {
|
|
200
|
+
readonly schemaVersion: 'ai-workflow.run-resource-freeze/v1';
|
|
201
|
+
readonly task: AIWorkflowAgentTaskRef;
|
|
202
|
+
readonly bindingResourceIds: readonly string[];
|
|
203
|
+
readonly dependencySnapshot: ResourceDependencySnapshot;
|
|
204
|
+
readonly semanticFingerprint: Sha256Digest;
|
|
205
|
+
}
|
|
206
|
+
|
|
63
207
|
export type AIWorkflowNodeType =
|
|
64
208
|
| 'agent'
|
|
65
209
|
| 'data'
|