ai-workflow-contract 0.1.8 → 0.1.9
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 +149 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-workflow-contract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared AI workflow contracts over WorkCtrlFlow and EagerDataFlow substrates",
|
|
6
6
|
"type": "module",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
".": "./src/index.ts"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"eager-data-flow-contract": "0.1.
|
|
13
|
-
"halfcode-compiler.xnl": "0.2.
|
|
12
|
+
"eager-data-flow-contract": "0.1.4",
|
|
13
|
+
"halfcode-compiler.xnl": "0.2.9",
|
|
14
14
|
"task-manager-contract": "0.1.3",
|
|
15
15
|
"work-ctrl-flow-contract": "0.1.3"
|
|
16
16
|
},
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,9 @@ import type {
|
|
|
8
8
|
ResourceValue,
|
|
9
9
|
Sha256Digest,
|
|
10
10
|
} from 'halfcode-compiler.xnl/resource-core';
|
|
11
|
+
import type {
|
|
12
|
+
ResourceAuthoringProposal,
|
|
13
|
+
} from 'halfcode-compiler.xnl/authoring-runtime';
|
|
11
14
|
import type {
|
|
12
15
|
FlowBundleSpec,
|
|
13
16
|
FlowClosedObject,
|
|
@@ -156,6 +159,8 @@ export type MaterialCardinality = 'one' | 'many';
|
|
|
156
159
|
export type AIWorkflowAgentResourceRelation =
|
|
157
160
|
| 'agent-message-prompt'
|
|
158
161
|
| 'agent-message-schema'
|
|
162
|
+
| 'agent-message-source'
|
|
163
|
+
| 'agent-context-pipeline'
|
|
159
164
|
| 'agent-input-schema'
|
|
160
165
|
| 'agent-output-schema'
|
|
161
166
|
| 'agent-tool'
|
|
@@ -196,6 +201,20 @@ export interface AIAgentMessageProjection {
|
|
|
196
201
|
readonly schema?: AIWorkflowMessageSchemaProjection;
|
|
197
202
|
}
|
|
198
203
|
|
|
204
|
+
export interface AIAgentStaticMessagePrefixProjection extends AIAgentMessageProjection {
|
|
205
|
+
readonly type: 'message';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface AIAgentMessageSourcePrefixProjection {
|
|
209
|
+
readonly type: 'message-source';
|
|
210
|
+
readonly id: string;
|
|
211
|
+
readonly source: AIWorkflowTypedResourceRef;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export type AIAgentMessagePrefixItemProjection =
|
|
215
|
+
| AIAgentStaticMessagePrefixProjection
|
|
216
|
+
| AIAgentMessageSourcePrefixProjection;
|
|
217
|
+
|
|
199
218
|
export interface MaterialPortProjection {
|
|
200
219
|
readonly kind: 'MaterialPort';
|
|
201
220
|
readonly fqn: string;
|
|
@@ -210,7 +229,10 @@ export interface AIAgentDefinitionProjection {
|
|
|
210
229
|
readonly kind: 'AIAgentDefinition';
|
|
211
230
|
readonly fqn: string;
|
|
212
231
|
readonly resource: ResourceRecord;
|
|
232
|
+
readonly messagePrefix: readonly AIAgentMessagePrefixItemProjection[];
|
|
233
|
+
/** Static compatibility view for legacy consumers during MessagePrefix adoption. */
|
|
213
234
|
readonly messages: readonly AIAgentMessageProjection[];
|
|
235
|
+
readonly contextPipeline?: AIWorkflowTypedResourceRef;
|
|
214
236
|
readonly inputSchema?: AIWorkflowMessageSchemaProjection;
|
|
215
237
|
readonly outputSchema?: AIWorkflowMessageSchemaProjection;
|
|
216
238
|
readonly tools: readonly AIWorkflowTypedResourceRef[];
|
|
@@ -258,6 +280,131 @@ export interface FrozenAIAgentTaskBinding {
|
|
|
258
280
|
readonly closureResourceIds: readonly string[];
|
|
259
281
|
}
|
|
260
282
|
|
|
283
|
+
export const AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION =
|
|
284
|
+
'ai-workflow.agent-definition-selection/v1' as const;
|
|
285
|
+
|
|
286
|
+
export interface AIAgentTaskRequirement {
|
|
287
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
288
|
+
readonly requirementId: string;
|
|
289
|
+
/** Audit/model evidence only. It is never a code-level routing input. */
|
|
290
|
+
readonly objective: string;
|
|
291
|
+
readonly inputSchemaRef?: `resource://${string}`;
|
|
292
|
+
readonly outputSchemaRef?: `resource://${string}`;
|
|
293
|
+
readonly requiredToolRefs: readonly `resource://${string}`[];
|
|
294
|
+
readonly requiredEffectPolicyRef?: `resource://${string}`;
|
|
295
|
+
readonly requiredToolMode?: AIWorkflowEffectToolMode;
|
|
296
|
+
readonly requiredMaterialPortRefs: readonly `resource://${string}`[];
|
|
297
|
+
readonly requiredContextPipelineRef?: `resource://${string}`;
|
|
298
|
+
readonly requiredMessageSourceRefs: readonly `resource://${string}`[];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface AIAgentTaskRequirementProjection {
|
|
302
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
303
|
+
readonly requirement: AIAgentTaskRequirement;
|
|
304
|
+
readonly requirementDigest: Sha256Digest;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface AIAgentDefinitionCandidateContract {
|
|
308
|
+
readonly inputSchemaRef?: `resource://${string}`;
|
|
309
|
+
readonly outputSchemaRef?: `resource://${string}`;
|
|
310
|
+
readonly toolRefs: readonly `resource://${string}`[];
|
|
311
|
+
readonly effectPolicyRef?: `resource://${string}`;
|
|
312
|
+
readonly effectToolMode?: AIWorkflowEffectToolMode;
|
|
313
|
+
readonly materialPortRefs: readonly `resource://${string}`[];
|
|
314
|
+
readonly contextPipelineRef?: `resource://${string}`;
|
|
315
|
+
readonly messageSourceRefs: readonly `resource://${string}`[];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface AIAgentDefinitionAuthoringEvidence {
|
|
319
|
+
readonly schemaVersion: 'ai-workflow.agent-definition-authoring-evidence/v1';
|
|
320
|
+
readonly planDigest: Sha256Digest;
|
|
321
|
+
readonly transactionId: string;
|
|
322
|
+
readonly receiptDigest: Sha256Digest;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface AIAgentDefinitionCandidate {
|
|
326
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
327
|
+
readonly agentDefinitionRef: `resource://${string}`;
|
|
328
|
+
readonly contentDigest: Sha256Digest;
|
|
329
|
+
readonly registryRevision: Sha256Digest;
|
|
330
|
+
readonly contract: AIAgentDefinitionCandidateContract;
|
|
331
|
+
readonly candidateDigest: Sha256Digest;
|
|
332
|
+
readonly authoringEvidence?: AIAgentDefinitionAuthoringEvidence;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface AIAgentDefinitionCandidateSet {
|
|
336
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
337
|
+
readonly registryRevision: Sha256Digest;
|
|
338
|
+
readonly candidates: readonly AIAgentDefinitionCandidate[];
|
|
339
|
+
readonly candidateSetDigest: Sha256Digest;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
interface AIAgentDefinitionSelectionDecisionBase {
|
|
343
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
344
|
+
readonly requirementDigest: Sha256Digest;
|
|
345
|
+
readonly candidateSetDigest: Sha256Digest;
|
|
346
|
+
readonly reason: string;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface SelectExistingAIAgentDefinitionDecision
|
|
350
|
+
extends AIAgentDefinitionSelectionDecisionBase {
|
|
351
|
+
readonly mode: 'select-existing';
|
|
352
|
+
readonly candidateRef: `resource://${string}`;
|
|
353
|
+
readonly candidateDigest: Sha256Digest;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface AuthorNewAIAgentDefinitionDecision
|
|
357
|
+
extends AIAgentDefinitionSelectionDecisionBase {
|
|
358
|
+
readonly mode: 'author-new';
|
|
359
|
+
readonly agentDefinitionRef: `resource://${string}`;
|
|
360
|
+
readonly proposal: ResourceAuthoringProposal;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export type AIAgentDefinitionSelectionDecision =
|
|
364
|
+
| SelectExistingAIAgentDefinitionDecision
|
|
365
|
+
| AuthorNewAIAgentDefinitionDecision;
|
|
366
|
+
|
|
367
|
+
export type AIAgentDefinitionSelectionRejectionCode =
|
|
368
|
+
| 'decision-invalid'
|
|
369
|
+
| 'requirement-stale'
|
|
370
|
+
| 'candidate-set-stale'
|
|
371
|
+
| 'candidate-missing'
|
|
372
|
+
| 'candidate-digest-mismatch'
|
|
373
|
+
| 'candidate-incompatible'
|
|
374
|
+
| 'authoring-in-progress'
|
|
375
|
+
| 'authoring-proposal-invalid';
|
|
376
|
+
|
|
377
|
+
export interface SelectedAIAgentDefinitionAdmission {
|
|
378
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
379
|
+
readonly status: 'selected';
|
|
380
|
+
readonly requirementDigest: Sha256Digest;
|
|
381
|
+
readonly candidateSetDigest: Sha256Digest;
|
|
382
|
+
readonly candidate: AIAgentDefinitionCandidate;
|
|
383
|
+
readonly reason: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export interface AuthorNewAIAgentDefinitionAdmission {
|
|
387
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
388
|
+
readonly status: 'authoring-request';
|
|
389
|
+
readonly requirementDigest: Sha256Digest;
|
|
390
|
+
readonly candidateSetDigest: Sha256Digest;
|
|
391
|
+
readonly agentDefinitionRef: `resource://${string}`;
|
|
392
|
+
readonly proposal: ResourceAuthoringProposal;
|
|
393
|
+
readonly reason: string;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export interface RejectedAIAgentDefinitionAdmission {
|
|
397
|
+
readonly schemaVersion: typeof AI_AGENT_DEFINITION_SELECTION_SCHEMA_VERSION;
|
|
398
|
+
readonly status: 'rejected';
|
|
399
|
+
readonly code: AIAgentDefinitionSelectionRejectionCode;
|
|
400
|
+
readonly message: string;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export type AIAgentDefinitionSelectionAdmission =
|
|
404
|
+
| SelectedAIAgentDefinitionAdmission
|
|
405
|
+
| AuthorNewAIAgentDefinitionAdmission
|
|
406
|
+
| RejectedAIAgentDefinitionAdmission;
|
|
407
|
+
|
|
261
408
|
export type AIWorkflowNodeType =
|
|
262
409
|
| 'agent'
|
|
263
410
|
| 'data'
|
|
@@ -410,8 +557,8 @@ export interface AIWorkflowExecutionReceipt {
|
|
|
410
557
|
}
|
|
411
558
|
|
|
412
559
|
export type AIAgentSelector =
|
|
413
|
-
| { readonly
|
|
414
|
-
| { readonly
|
|
560
|
+
| { readonly byId: string; readonly byName?: never }
|
|
561
|
+
| { readonly byName: string; readonly byId?: never };
|
|
415
562
|
|
|
416
563
|
export interface AIAgentInvocation<Input extends FlowClosedValue = FlowClosedValue> {
|
|
417
564
|
readonly kind: 'ai.agent';
|