ai-ctrl-workflow-logic 0.1.3 → 0.1.4

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 +9 -8
  2. package/src/filesystem.ts +10 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-ctrl-workflow-logic",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "WorkCtrlFlow-backed AI Ctrl Workflow adapter logic",
6
6
  "type": "module",
@@ -11,13 +11,14 @@
11
11
  "./filesystem": "./src/filesystem.ts"
12
12
  },
13
13
  "dependencies": {
14
- "ai-ctrl-workflow-contract": "0.1.1",
15
- "ai-workflow-contract": "0.1.4",
16
- "ai-workflow-logic": "0.1.4",
17
- "instant-ctrl-flow-contract": "0.1.0",
18
- "instant-ctrl-flow-logic": "0.1.2",
19
- "work-ctrl-flow-contract": "0.1.1",
20
- "work-ctrl-flow-logic": "0.1.1"
14
+ "ai-ctrl-workflow-contract": "0.1.2",
15
+ "ai-workflow-contract": "0.1.5",
16
+ "ai-workflow-logic": "0.1.5",
17
+ "flow-step-space-logic": "0.1.0",
18
+ "instant-ctrl-flow-contract": "0.1.1",
19
+ "instant-ctrl-flow-logic": "0.1.3",
20
+ "work-ctrl-flow-contract": "0.1.2",
21
+ "work-ctrl-flow-logic": "0.1.2"
21
22
  },
22
23
  "files": [
23
24
  "src"
package/src/filesystem.ts CHANGED
@@ -9,6 +9,7 @@ import type {
9
9
  } from 'ai-workflow-contract';
10
10
  import { FilesystemFlowRunCheckpointStore } from 'ai-workflow-logic/checkpoint-filesystem';
11
11
  import { createFilesystemFlowCodeResolver, type FlowModuleImporter } from 'instant-ctrl-flow-logic/filesystem';
12
+ import { assembleDefinitionStepProfileDirectory } from 'flow-step-space-logic/filesystem';
12
13
  import {
13
14
  loadMaterializedFlowInstance,
14
15
  materializeFlowInstance,
@@ -128,15 +129,17 @@ export function createMaterializedAICtrlWorkflowControllerFromDirectory(
128
129
  }
129
130
 
130
131
  function loadAICtrlBinding(definitionDir: string) {
131
- const sources = Object.fromEntries(
132
- fs.readdirSync(definitionDir, { withFileTypes: true })
133
- .filter((entry) => entry.isFile() && entry.name.endsWith('.xnl'))
134
- .sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0)
135
- .map((entry) => [entry.name, fs.readFileSync(path.join(definitionDir, entry.name), 'utf8')]),
136
- );
132
+ const assembled = assembleDefinitionStepProfileDirectory(definitionDir, 'AICtrlWorkflow');
133
+ if (assembled.diagnostics.length > 0) {
134
+ throw new Error(`AICtrlWorkflow StepSpace is invalid: ${assembled.diagnostics.map((item) => item.code).join(', ')}`);
135
+ }
136
+ const sources = Object.fromEntries((assembled.sources as readonly ({ readonly ref: string; readonly content: string } | { readonly name: string; readonly content: string })[])
137
+ .map((source) => ['name' in source ? source.name : source.ref, source.content]));
137
138
  const loaded = loadAICtrlWorkflowSources(sources, { baseUri: definitionDir });
138
139
  if (!loaded.binding || loaded.diagnostics.length > 0) {
139
140
  throw new Error(`AICtrlWorkflow definition is invalid: ${loaded.diagnostics.map((item) => item.code).join(', ')}`);
140
141
  }
141
- return loaded.binding;
142
+ return assembled.forest
143
+ ? { ...loaded.binding, definition: { ...loaded.binding.definition, definitionStepForest: assembled.forest } }
144
+ : loaded.binding;
142
145
  }