ai-ctrl-workflow-logic 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.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/src/index.ts +30 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-ctrl-workflow-logic",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "description": "WorkCtrlFlow-backed AI Ctrl Workflow adapter logic",
6
6
  "type": "module",
@@ -11,9 +11,10 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "ai-ctrl-workflow-contract": "0.1.0",
14
- "ai-workflow-logic": "0.1.0",
15
14
  "ai-workflow-contract": "0.1.0",
15
+ "ai-workflow-logic": "0.1.0",
16
16
  "instant-ctrl-flow-contract": "0.1.0",
17
+ "instant-ctrl-flow-logic": "^0.1.1",
17
18
  "work-ctrl-flow-contract": "0.1.0",
18
19
  "work-ctrl-flow-logic": "0.1.0"
19
20
  },
@@ -24,4 +25,4 @@
24
25
  "access": "public",
25
26
  "registry": "https://registry.npmjs.com"
26
27
  }
27
- }
28
+ }
package/src/index.ts CHANGED
@@ -11,7 +11,13 @@ import type {
11
11
  AIWorkflowStateStore,
12
12
  } from 'ai-workflow-contract';
13
13
  import { createAIWorkflowRuntimeContext, defineAICtrlWorkflow } from 'ai-workflow-logic';
14
- import type { FlowCodeResolver } from 'instant-ctrl-flow-contract';
14
+ import type {
15
+ FlowCodeResolver,
16
+ FlowDiagnostic,
17
+ FlowSourceCollection,
18
+ LoadFlowSourcesOptions,
19
+ } from 'instant-ctrl-flow-contract';
20
+ import { loadCtrlFlowProfileFromSources } from 'instant-ctrl-flow-logic';
15
21
  import type {
16
22
  ResumeSignal,
17
23
  TickOutcome,
@@ -80,6 +86,29 @@ export function defineWorkCtrlFlowBackedAICtrlWorkflow(
80
86
  return defineAICtrlWorkflow(definition);
81
87
  }
82
88
 
89
+ export interface AICtrlWorkflowSourceLoadResult {
90
+ readonly binding?: AICtrlWorkflowDefinitionBinding;
91
+ readonly diagnostics: readonly FlowDiagnostic[];
92
+ }
93
+
94
+ export function loadAICtrlWorkflowSources(
95
+ sources: FlowSourceCollection,
96
+ options: LoadFlowSourcesOptions = {},
97
+ ): AICtrlWorkflowSourceLoadResult {
98
+ const loaded = loadCtrlFlowProfileFromSources(sources, {
99
+ ...options,
100
+ profileRoot: 'AICtrlWorkflow',
101
+ substrateForm: 'WorkCtrlFlow',
102
+ });
103
+ if (!loaded.spec || loaded.diagnostics.length > 0) {
104
+ return { diagnostics: loaded.diagnostics };
105
+ }
106
+ return {
107
+ binding: defineWorkCtrlFlowBackedAICtrlWorkflow(loaded.spec),
108
+ diagnostics: loaded.diagnostics,
109
+ };
110
+ }
111
+
83
112
  function nodeIdFromInvocationKey(invocationKey: string): string {
84
113
  const withoutVisit = invocationKey.slice(0, invocationKey.lastIndexOf('#'));
85
114
  return withoutVisit.slice(withoutVisit.lastIndexOf('/') + 1);