@x12i/graphenix-plan-compiler 1.0.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/README.md +192 -0
- package/dist/compile/build-deferred-gates.d.ts +8 -0
- package/dist/compile/build-deferred-gates.d.ts.map +1 -0
- package/dist/compile/build-deferred-gates.js +95 -0
- package/dist/compile/build-deferred-gates.js.map +1 -0
- package/dist/compile/build-finalizer-plans.d.ts +7 -0
- package/dist/compile/build-finalizer-plans.d.ts.map +1 -0
- package/dist/compile/build-finalizer-plans.js +54 -0
- package/dist/compile/build-finalizer-plans.js.map +1 -0
- package/dist/compile/build-node-execution-units-v2.d.ts +6 -0
- package/dist/compile/build-node-execution-units-v2.d.ts.map +1 -0
- package/dist/compile/build-node-execution-units-v2.js +172 -0
- package/dist/compile/build-node-execution-units-v2.js.map +1 -0
- package/dist/compile/build-node-execution-units.d.ts +6 -0
- package/dist/compile/build-node-execution-units.d.ts.map +1 -0
- package/dist/compile/build-node-execution-units.js +112 -0
- package/dist/compile/build-node-execution-units.js.map +1 -0
- package/dist/compile/build-node-invoke-contract.d.ts +5 -0
- package/dist/compile/build-node-invoke-contract.d.ts.map +1 -0
- package/dist/compile/build-node-invoke-contract.js +123 -0
- package/dist/compile/build-node-invoke-contract.js.map +1 -0
- package/dist/compile/build-plan-topology.d.ts +8 -0
- package/dist/compile/build-plan-topology.d.ts.map +1 -0
- package/dist/compile/build-plan-topology.js +84 -0
- package/dist/compile/build-plan-topology.js.map +1 -0
- package/dist/compile/compile-executable-plan-v2.d.ts +5 -0
- package/dist/compile/compile-executable-plan-v2.d.ts.map +1 -0
- package/dist/compile/compile-executable-plan-v2.js +251 -0
- package/dist/compile/compile-executable-plan-v2.js.map +1 -0
- package/dist/compile/compile-executable-plan.d.ts +5 -0
- package/dist/compile/compile-executable-plan.d.ts.map +1 -0
- package/dist/compile/compile-executable-plan.js +139 -0
- package/dist/compile/compile-executable-plan.js.map +1 -0
- package/dist/compile/phase-utility-strategy.d.ts +6 -0
- package/dist/compile/phase-utility-strategy.d.ts.map +1 -0
- package/dist/compile/phase-utility-strategy.js +22 -0
- package/dist/compile/phase-utility-strategy.js.map +1 -0
- package/dist/explain/explain-node-inheritance.d.ts +3 -0
- package/dist/explain/explain-node-inheritance.d.ts.map +1 -0
- package/dist/explain/explain-node-inheritance.js +38 -0
- package/dist/explain/explain-node-inheritance.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/resolution/build-deterministic-case-context.d.ts +9 -0
- package/dist/resolution/build-deterministic-case-context.d.ts.map +1 -0
- package/dist/resolution/build-deterministic-case-context.js +23 -0
- package/dist/resolution/build-deterministic-case-context.js.map +1 -0
- package/dist/resolution/resolve-graph-model-config.d.ts +12 -0
- package/dist/resolution/resolve-graph-model-config.d.ts.map +1 -0
- package/dist/resolution/resolve-graph-model-config.js +24 -0
- package/dist/resolution/resolve-graph-model-config.js.map +1 -0
- package/dist/resolution/resolve-node-ai-plan.d.ts +7 -0
- package/dist/resolution/resolve-node-ai-plan.d.ts.map +1 -0
- package/dist/resolution/resolve-node-ai-plan.js +60 -0
- package/dist/resolution/resolve-node-ai-plan.js.map +1 -0
- package/dist/resolution/resolve-node-model-config.d.ts +15 -0
- package/dist/resolution/resolve-node-model-config.d.ts.map +1 -0
- package/dist/resolution/resolve-node-model-config.js +33 -0
- package/dist/resolution/resolve-node-model-config.js.map +1 -0
- package/dist/resolution/resolve-node-model-slot.d.ts +7 -0
- package/dist/resolution/resolve-node-model-slot.d.ts.map +1 -0
- package/dist/resolution/resolve-node-model-slot.js +62 -0
- package/dist/resolution/resolve-node-model-slot.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# @x12i/graphenix-plan-compiler
|
|
2
|
+
|
|
3
|
+
**Plan compiler** — transforms `AuthoringGraphDocument` + `GraphRuntimeObject` into an immutable `ExecutableGraphPlan`.
|
|
4
|
+
|
|
5
|
+
Handles normalization, deterministic case selection, **phase model profile** resolution, **run-phase execution unit** building, profile registry attachment, and plan hashing.
|
|
6
|
+
|
|
7
|
+
**Canonical vocabulary:** [GLOSSARY.md](../../GLOSSARY.md).
|
|
8
|
+
**Finalization brief:** [COMPILE-FORMAT-FINALIZATION.md](../../docs/COMPILE-FORMAT-FINALIZATION.md).
|
|
9
|
+
When compile output for **task run phases** changes, update this README, [plan-format/README.md](../plan-format/README.md), and [GLOSSARY.md](../../GLOSSARY.md) together.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Who should use this
|
|
14
|
+
|
|
15
|
+
| Role | Use this package? |
|
|
16
|
+
| ---- | ----------------- |
|
|
17
|
+
| Compiler / execution prep service | **Yes** |
|
|
18
|
+
| Backend host | Often via `@x12i/graphenix-execute-envelope` |
|
|
19
|
+
| Engine | **No** — receive the compiled plan, do not compile at runtime |
|
|
20
|
+
| Graph designer / Studio | Only for compile preview |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Design → plan (phase mapping)
|
|
25
|
+
|
|
26
|
+
```txt
|
|
27
|
+
Authoring (task-node-format) Plan (plan-format)
|
|
28
|
+
──────────────────────────── ────────────────────
|
|
29
|
+
prePhase.strategyKey PRE-phase execution units
|
|
30
|
+
aiTaskStrategies.pre externalPreUtility / preAction
|
|
31
|
+
+ preInputStrategy
|
|
32
|
+
|
|
33
|
+
mainPhase.executionStrategies MAIN-phase execution units
|
|
34
|
+
+ aiTaskProfile.inputSynthesis mainSkill, pipelinePhase, localSkill
|
|
35
|
+
|
|
36
|
+
postPhase.strategyKey POST-phase execution units
|
|
37
|
+
aiTaskStrategies.post externalPostUtility / postAction
|
|
38
|
+
|
|
39
|
+
graphenix.executable/v1 model cases Resolved modelSlots on nodePlans
|
|
40
|
+
preActionModel / skillModel / postActionModel
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See [GLOSSARY §5](../../GLOSSARY.md#5-plan-phase-action-lists-design-vs-plan--do-not-confuse): `preActions[]` on design is optional; compiler may expand strategy keys into plan action lists.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Examples (JSON)
|
|
48
|
+
|
|
49
|
+
### Authoring input (design — phase utility strategies)
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"id": "node:audience-insights",
|
|
54
|
+
"kind": "task",
|
|
55
|
+
"layout": { "x": 120, "y": 200 },
|
|
56
|
+
"parameters": {
|
|
57
|
+
"profile": "graphenix.task-node/v1",
|
|
58
|
+
"nodeType": "task",
|
|
59
|
+
"skillKey": "professional-answer",
|
|
60
|
+
"taskConfiguration": {
|
|
61
|
+
"executionStrategies": [],
|
|
62
|
+
"aiTaskStrategies": {
|
|
63
|
+
"pre": "synthesis",
|
|
64
|
+
"preInputStrategy": "execution-memory-only"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Fixture: `createContentPipelineReferenceGraph()` — `graph:content-pipeline`. When authoring declares `aiTaskStrategies.post`, the compiler appends POST-phase units.
|
|
72
|
+
|
|
73
|
+
Graph-level phase model profiles live in `graph.metadata.extensions["graphenix.executable/v1"].modelConfig` (see executable-profile-format README).
|
|
74
|
+
|
|
75
|
+
### Compiled plan output (excerpt — PRE + MAIN only)
|
|
76
|
+
|
|
77
|
+
Content pipeline reference tasks declare PRE synthesis + plain MAIN — no POST unless design sets `aiTaskStrategies.post`:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
"nodePlans": {
|
|
81
|
+
"node:audience-insights": {
|
|
82
|
+
"executionUnits": [
|
|
83
|
+
{
|
|
84
|
+
"unitKind": "externalPreUtility",
|
|
85
|
+
"order": 0,
|
|
86
|
+
"strategyKey": "synthesis",
|
|
87
|
+
"modelSlot": "preActionModel"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"unitKind": "mainSkill",
|
|
91
|
+
"order": 1,
|
|
92
|
+
"skillKey": "professional-answer",
|
|
93
|
+
"modelSlot": "skillModel"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Design `prePhase.strategyKey` → plan PRE-phase execution unit. Not the same JSON field as `preActions[]` on authoring.
|
|
101
|
+
|
|
102
|
+
### Runtime object (compile input)
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"jobId": "job-001",
|
|
107
|
+
"mode": "live",
|
|
108
|
+
"environment": "prod",
|
|
109
|
+
"input": { "riskLevel": "low" }
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Install
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm install @x12i/graphenix-plan-compiler @x12i/graphenix-plan-format
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Example
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { compileExecutablePlan } from "@x12i/graphenix-plan-compiler";
|
|
127
|
+
import { validateExecutablePlan } from "@x12i/graphenix-plan-format";
|
|
128
|
+
|
|
129
|
+
const plan = compileExecutablePlan(authoringGraph, runtime, {
|
|
130
|
+
profileRegistry: { package: "@x12i/ai-profiles", version: "3.2.0" }
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
validateExecutablePlan(plan);
|
|
134
|
+
// → hand { plan, runtime } to the engine
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Compile pipeline
|
|
140
|
+
|
|
141
|
+
```txt
|
|
142
|
+
validateAuthoringExecutableGraph()
|
|
143
|
+
normalizeExecutableGraph()
|
|
144
|
+
assertNormalizedExecutableGraph()
|
|
145
|
+
selectGraphModelCase() → resolveNodeAiPlan() per task node
|
|
146
|
+
buildNodeExecutionUnits() ← PRE / MAIN / POST phase units
|
|
147
|
+
buildFinalizerPlans()
|
|
148
|
+
validateExecutablePlan() ← recommended before handoff
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Key exports
|
|
154
|
+
|
|
155
|
+
| API | Purpose |
|
|
156
|
+
| --- | ------- |
|
|
157
|
+
| `compileExecutablePlan` | Authoring + runtime → plan |
|
|
158
|
+
| `buildNodeExecutionUnits` | Build PRE / MAIN / POST execution units for a node |
|
|
159
|
+
| `resolveGraphModelConfig` / `resolveNodeModelConfig` | Case selection + inheritance |
|
|
160
|
+
| `resolveNodeModelSlot` | Resolve a single phase model profile slot |
|
|
161
|
+
| `resolveNodeAiPlan` / `resolveAllNodeAiPlans` | Full node AI plan |
|
|
162
|
+
| `buildDeterministicCaseContext` | Freeze pre-run context for case selection |
|
|
163
|
+
| `explainNodeInheritance` | Explain graph/node case and slot provenance |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Important rules
|
|
168
|
+
|
|
169
|
+
- Case selection uses **pre-run context only**. In-run node output cannot change model case selection unless explicitly modeled as a separate compile stage.
|
|
170
|
+
- Design-only fields (e.g. `node.layout`) are **stripped** from the embedded normalized graph via `stripDesignOnlyFieldsFromGraph()` at compile time.
|
|
171
|
+
- Do not describe compile output using “Synthesis PRE”; use PRE-phase utility strategy vs skill input synthesis profile per [GLOSSARY.md](../../GLOSSARY.md).
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Dependencies
|
|
176
|
+
|
|
177
|
+
- `@x12i/graphenix-authoring-format` ^1.0.0
|
|
178
|
+
- `@x12i/graphenix-case-format` ^1.0.0
|
|
179
|
+
- `@x12i/graphenix-executable-contracts` ^1.0.0
|
|
180
|
+
- `@x12i/graphenix-core` ^2.0.0 (peer)
|
|
181
|
+
- `@x12i/ai-profiles` ^3.2.0
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Related packages
|
|
186
|
+
|
|
187
|
+
| Package | Role |
|
|
188
|
+
| ------- | ---- |
|
|
189
|
+
| [GLOSSARY.md](../../GLOSSARY.md) | Canonical vocabulary |
|
|
190
|
+
| [`@x12i/graphenix-plan-format`](../plan-format) | Validate compiled plans |
|
|
191
|
+
| [`@x12i/graphenix-execute-envelope`](../execute-envelope) | Host adapter that calls this compiler |
|
|
192
|
+
| [Compiler role guide](../../docs/roles/compiler-service.md) | Client guide |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NormalizedExecutableGraphDocument } from "@x12i/graphenix-executable-contracts";
|
|
2
|
+
import type { DeferredGateSet } from "@x12i/graphenix-executable-contracts";
|
|
3
|
+
export declare function buildDeferredGates(graph: NormalizedExecutableGraphDocument): {
|
|
4
|
+
gates: DeferredGateSet;
|
|
5
|
+
edgeGateIds: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
export declare function hasDeferredGates(gates: DeferredGateSet): boolean;
|
|
8
|
+
//# sourceMappingURL=build-deferred-gates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-deferred-gates.d.ts","sourceRoot":"","sources":["../../src/compile/build-deferred-gates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,KAAK,EAGV,eAAe,EAGhB,MAAM,sCAAsC,CAAC;AAQ9C,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,iCAAiC,GACvC;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAuFjE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAKhE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { isRecord } from "@x12i/graphenix-executable-contracts";
|
|
2
|
+
import { getEdgeSourcePath, getNodeSourcePath } from "./build-plan-topology.js";
|
|
3
|
+
function buildGateId(prefix, id) {
|
|
4
|
+
return `gate:${prefix}:${id}`;
|
|
5
|
+
}
|
|
6
|
+
export function buildDeferredGates(graph) {
|
|
7
|
+
const nodeGates = {};
|
|
8
|
+
const edgeGates = {};
|
|
9
|
+
const entryGates = [];
|
|
10
|
+
const edgeGateIds = {};
|
|
11
|
+
for (const node of graph.graph.nodes) {
|
|
12
|
+
const params = node.parameters;
|
|
13
|
+
if (!isRecord(params))
|
|
14
|
+
continue;
|
|
15
|
+
const conditions = params.conditions;
|
|
16
|
+
if (conditions === undefined)
|
|
17
|
+
continue;
|
|
18
|
+
const gateId = buildGateId("node", node.id);
|
|
19
|
+
const gate = {
|
|
20
|
+
gateId,
|
|
21
|
+
nodeId: node.id,
|
|
22
|
+
sourcePath: `${getNodeSourcePath(graph, node.id)}/parameters/conditions`
|
|
23
|
+
};
|
|
24
|
+
if (Array.isArray(conditions)) {
|
|
25
|
+
gate.runWhen = conditions;
|
|
26
|
+
}
|
|
27
|
+
else if (isRecord(conditions)) {
|
|
28
|
+
if (Array.isArray(conditions.runWhen)) {
|
|
29
|
+
gate.runWhen = conditions.runWhen;
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(conditions.skipWhen)) {
|
|
32
|
+
gate.skipWhen = conditions.skipWhen;
|
|
33
|
+
}
|
|
34
|
+
if (!gate.runWhen && !gate.skipWhen) {
|
|
35
|
+
gate.runWhen = [conditions];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
nodeGates[node.id] = gate;
|
|
39
|
+
}
|
|
40
|
+
for (const edge of graph.graph.edges) {
|
|
41
|
+
const when = edge.when;
|
|
42
|
+
if (when === undefined)
|
|
43
|
+
continue;
|
|
44
|
+
const gateId = buildGateId("edge", edge.id);
|
|
45
|
+
edgeGateIds[edge.id] = gateId;
|
|
46
|
+
edgeGates[edge.id] = {
|
|
47
|
+
gateId,
|
|
48
|
+
edgeId: edge.id,
|
|
49
|
+
fromNodeId: edge.from.nodeId,
|
|
50
|
+
toNodeId: edge.to.nodeId,
|
|
51
|
+
when: when,
|
|
52
|
+
sourcePath: `${getEdgeSourcePath(graph, edge.id)}/when`
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const graphEntry = graph.graph.metadata?.graphEntry;
|
|
56
|
+
const entryFilters = graphEntry
|
|
57
|
+
?.dataFilters;
|
|
58
|
+
if (Array.isArray(entryFilters)) {
|
|
59
|
+
for (const [index, filter] of entryFilters.entries()) {
|
|
60
|
+
entryGates.push({
|
|
61
|
+
gateId: buildGateId("entry", String(index)),
|
|
62
|
+
condition: filter,
|
|
63
|
+
sourcePath: `/graph/metadata/graphEntry/dataFilters/${index}`
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
for (const input of graph.graph.inputs ?? []) {
|
|
68
|
+
const contract = input.contract;
|
|
69
|
+
if (!Array.isArray(contract?.dataFilters))
|
|
70
|
+
continue;
|
|
71
|
+
for (const [index, filter] of contract.dataFilters.entries()) {
|
|
72
|
+
entryGates.push({
|
|
73
|
+
gateId: buildGateId("entry-input", `${input.id}:${index}`),
|
|
74
|
+
inputId: input.id,
|
|
75
|
+
condition: filter,
|
|
76
|
+
sourcePath: `/graph/inputs/${input.id}/contract/dataFilters/${index}`
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
gates: {
|
|
82
|
+
entryGates: entryGates.length > 0 ? entryGates : undefined,
|
|
83
|
+
nodeGates,
|
|
84
|
+
edgeGates
|
|
85
|
+
},
|
|
86
|
+
edgeGateIds
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function hasDeferredGates(gates) {
|
|
90
|
+
const nodeCount = Object.keys(gates.nodeGates).length;
|
|
91
|
+
const edgeCount = Object.keys(gates.edgeGates).length;
|
|
92
|
+
const entryCount = gates.entryGates?.length ?? 0;
|
|
93
|
+
return nodeCount + edgeCount + entryCount > 0;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=build-deferred-gates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-deferred-gates.js","sourceRoot":"","sources":["../../src/compile/build-deferred-gates.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEhF,SAAS,WAAW,CAAC,MAAc,EAAE,EAAU;IAC7C,OAAO,QAAQ,MAAM,IAAI,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAAwC;IAExC,MAAM,SAAS,GAAqC,EAAE,CAAC;IACvD,MAAM,SAAS,GAAqC,EAAE,CAAC;IACvD,MAAM,UAAU,GAAwB,EAAE,CAAC;IAC3C,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,SAAS;QAEhC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,IAAI,UAAU,KAAK,SAAS;YAAE,SAAS;QAEvC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAqB;YAC7B,MAAM;YACN,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,UAAU,EAAE,GAAG,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,wBAAwB;SACzE,CAAC;QAEF,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,GA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AAS;SACV;QACD,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAsB;IACrD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IACtD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IACtD,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC,CAAC;IACjD,OAAO,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NormalizedExecutableGraphDocument } from "@x12i/graphenix-executable-contracts";
|
|
2
|
+
import type { FinalizerExecutionPlan, ResolvedModelSlotEntry } from "@x12i/graphenix-executable-contracts";
|
|
3
|
+
import { getFinalizerType } from "./build-plan-topology.js";
|
|
4
|
+
export declare function buildFinalizerPlans(graph: NormalizedExecutableGraphDocument, resolvedFinalizerSlots?: Record<string, ResolvedModelSlotEntry | undefined>): Record<string, FinalizerExecutionPlan>;
|
|
5
|
+
export declare function isAiFinalizerType(finalizerType: string): boolean;
|
|
6
|
+
export { getFinalizerType };
|
|
7
|
+
//# sourceMappingURL=build-finalizer-plans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-finalizer-plans.d.ts","sourceRoot":"","sources":["../../src/compile/build-finalizer-plans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAAE,gBAAgB,EAAqB,MAAM,0BAA0B,CAAC;AAI/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iCAAiC,EACxC,sBAAsB,CAAC,EAAE,MAAM,CAC7B,MAAM,EACN,sBAAsB,GAAG,SAAS,CACnC,GACA,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAkDxC;AAED,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getFinalizerNodeConfig, isExecutableFinalizerNode } from "@x12i/graphenix-executable-contracts";
|
|
2
|
+
import { getFinalizerType, getNodeSourcePath } from "./build-plan-topology.js";
|
|
3
|
+
const AI_FINALIZER_TYPES = new Set(["synthesize"]);
|
|
4
|
+
export function buildFinalizerPlans(graph, resolvedFinalizerSlots) {
|
|
5
|
+
const plans = {};
|
|
6
|
+
for (const node of graph.graph.nodes.filter(isExecutableFinalizerNode)) {
|
|
7
|
+
const config = getFinalizerNodeConfig(node);
|
|
8
|
+
if (!config)
|
|
9
|
+
continue;
|
|
10
|
+
const finalizerType = config.finalizerType;
|
|
11
|
+
const sourcePath = getNodeSourcePath(graph, node.id);
|
|
12
|
+
const isAiFinalizer = AI_FINALIZER_TYPES.has(finalizerType);
|
|
13
|
+
const executionUnits = [
|
|
14
|
+
{
|
|
15
|
+
unitId: `unit:${node.id}:finalizer`,
|
|
16
|
+
nodeId: node.id,
|
|
17
|
+
unitKind: "finalizer",
|
|
18
|
+
invokeMode: "finalizer",
|
|
19
|
+
order: 0,
|
|
20
|
+
finalizerType,
|
|
21
|
+
modelSlot: isAiFinalizer ? "finalizerModel" : undefined,
|
|
22
|
+
modelSelection: isAiFinalizer
|
|
23
|
+
? resolvedFinalizerSlots?.[node.id]?.selection
|
|
24
|
+
: undefined,
|
|
25
|
+
modelSource: isAiFinalizer
|
|
26
|
+
? resolvedFinalizerSlots?.[node.id]?.source
|
|
27
|
+
: undefined,
|
|
28
|
+
sourcePath: `${sourcePath}/parameters/finalizerType`
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
const graphOutputIds = (graph.graph.outputs ?? []).map((o) => o.id);
|
|
32
|
+
plans[node.id] = {
|
|
33
|
+
nodeId: node.id,
|
|
34
|
+
finalizerType,
|
|
35
|
+
executionClass: "finalizer",
|
|
36
|
+
config: structuredClone(config.config),
|
|
37
|
+
modelSlots: isAiFinalizer
|
|
38
|
+
? resolvedFinalizerSlots?.[node.id]
|
|
39
|
+
? { finalizerModel: resolvedFinalizerSlots[node.id] }
|
|
40
|
+
: null
|
|
41
|
+
: null,
|
|
42
|
+
executionUnits,
|
|
43
|
+
outputContractRef: graphOutputIds[0],
|
|
44
|
+
responseShapePath: "/graph/metadata/graphResponse",
|
|
45
|
+
sourcePath
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return plans;
|
|
49
|
+
}
|
|
50
|
+
export function isAiFinalizerType(finalizerType) {
|
|
51
|
+
return AI_FINALIZER_TYPES.has(finalizerType);
|
|
52
|
+
}
|
|
53
|
+
export { getFinalizerType };
|
|
54
|
+
//# sourceMappingURL=build-finalizer-plans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-finalizer-plans.js","sourceRoot":"","sources":["../../src/compile/build-finalizer-plans.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE/E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AAEnD,MAAM,UAAU,mBAAmB,CACjC,KAAwC,EACxC,sBAGC;IAED,MAAM,KAAK,GAA2C,EAAE,CAAC;IAEzD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,CAAC;QACvE,MAAM,MAAM,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAA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AAC;oBACjC,CAAC,CAAC,EAAE,cAAc,EAAE,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;oBACrD,CAAC,CAAC,IAAI;gBACR,CAAC,CAAC,IAAI;YACR,cAAc;YACd,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;YACpC,iBAAiB,EAAE,+BAA+B;YAClD,UAAU;SACX,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,aAAqB;IACrD,OAAO,kBAAkB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/C,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExecutableTaskNodeParameters } from "@x12i/graphenix-executable-contracts";
|
|
2
|
+
import type { ExecutionUnitPlanV2, ResolvedModelSlotEntry } from "@x12i/graphenix-executable-contracts";
|
|
3
|
+
import type { AiModelSlot } from "@x12i/graphenix-executable-contracts";
|
|
4
|
+
import type { NormalizedExecutableGraphDocument } from "@x12i/graphenix-executable-contracts";
|
|
5
|
+
export declare function buildNodeExecutionUnitsV2(graph: NormalizedExecutableGraphDocument, nodeId: string, params: ExecutableTaskNodeParameters, modelSlots: Record<AiModelSlot, ResolvedModelSlotEntry> | null, executionClass: string): ExecutionUnitPlanV2[];
|
|
6
|
+
//# sourceMappingURL=build-node-execution-units-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-node-execution-units-v2.d.ts","sourceRoot":"","sources":["../../src/compile/build-node-execution-units-v2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,sCAAsC,CAAC;AAG9C,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAuE9F,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iCAAiC,EACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,4BAA4B,EACpC,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE,sBAAsB,CAAC,GAAG,IAAI,EAC9D,cAAc,EAAE,MAAM,GACrB,mBAAmB,EAAE,CAoKvB"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { getNodeSourcePath } from "./build-plan-topology.js";
|
|
2
|
+
import { readPhaseUtilityStrategyKey, shouldExpandPhaseUtilityStrategy } from "./phase-utility-strategy.js";
|
|
3
|
+
function buildUnitId(nodeId, suffix) {
|
|
4
|
+
return `unit:${nodeId}:${suffix}`;
|
|
5
|
+
}
|
|
6
|
+
function slotToModel(slotPlan) {
|
|
7
|
+
return {
|
|
8
|
+
modelSelection: slotPlan.selection,
|
|
9
|
+
modelSource: slotPlan.source
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function plannedModelFromAction(action, slotPlan) {
|
|
13
|
+
if (action.modelSelection) {
|
|
14
|
+
return {
|
|
15
|
+
modelSelection: action.modelSelection,
|
|
16
|
+
modelSource: "actionOverride"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return slotToModel(slotPlan);
|
|
20
|
+
}
|
|
21
|
+
function buildActionUnitV2(graph, nodeId, action, unitKind, invokeMode, order, modelSlot, slotPlan) {
|
|
22
|
+
const model = plannedModelFromAction(action, slotPlan);
|
|
23
|
+
const sourcePath = `${getNodeSourcePath(graph, nodeId)}/parameters/taskConfiguration/${unitKind === "externalPreUtility" ? "preActions" : "postActions"}/${action.id}`;
|
|
24
|
+
return {
|
|
25
|
+
unitId: buildUnitId(nodeId, action.id),
|
|
26
|
+
nodeId,
|
|
27
|
+
unitKind,
|
|
28
|
+
invokeMode,
|
|
29
|
+
order,
|
|
30
|
+
actionKey: action.actionKey,
|
|
31
|
+
modelSlot,
|
|
32
|
+
modelSelection: model.modelSelection,
|
|
33
|
+
modelSource: model.modelSource,
|
|
34
|
+
inputContract: action.inputsConfig
|
|
35
|
+
? structuredClone(action.inputsConfig)
|
|
36
|
+
: undefined,
|
|
37
|
+
outputContract: action.outputMapping
|
|
38
|
+
? structuredClone(action.outputMapping)
|
|
39
|
+
: undefined,
|
|
40
|
+
sourcePath
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function buildNodeExecutionUnitsV2(graph, nodeId, params, modelSlots, executionClass) {
|
|
44
|
+
if (executionClass === "localTask") {
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
unitId: buildUnitId(nodeId, "local"),
|
|
48
|
+
nodeId,
|
|
49
|
+
unitKind: "localSkill",
|
|
50
|
+
invokeMode: "local",
|
|
51
|
+
order: 0,
|
|
52
|
+
skillKey: params.skillKey,
|
|
53
|
+
sourcePath: `${getNodeSourcePath(graph, nodeId)}/parameters/skillKey`
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
const taskConfiguration = params.taskConfiguration;
|
|
58
|
+
const preActions = taskConfiguration?.preActions ?? [];
|
|
59
|
+
const postActions = taskConfiguration?.postActions ?? [];
|
|
60
|
+
const units = [];
|
|
61
|
+
let order = 0;
|
|
62
|
+
const slots = modelSlots ?? {
|
|
63
|
+
preActionModel: { selection: { kind: "profileChoice", key: "cheap/default" }, source: "graphDefault" },
|
|
64
|
+
skillModel: { selection: { kind: "profileChoice", key: "vol/default" }, source: "graphDefault" },
|
|
65
|
+
postActionModel: { selection: { kind: "profileChoice", key: "cheap/default" }, source: "graphDefault" }
|
|
66
|
+
};
|
|
67
|
+
const nodeSourcePath = getNodeSourcePath(graph, nodeId);
|
|
68
|
+
const aiTaskStrategies = taskConfiguration?.aiTaskStrategies;
|
|
69
|
+
if (shouldExpandPhaseUtilityStrategy(preActions)) {
|
|
70
|
+
const preStrategyKey = readPhaseUtilityStrategyKey(aiTaskStrategies, "pre");
|
|
71
|
+
if (preStrategyKey) {
|
|
72
|
+
const preModel = slotToModel(slots.preActionModel);
|
|
73
|
+
units.push({
|
|
74
|
+
unitId: buildUnitId(nodeId, "pre:0"),
|
|
75
|
+
nodeId,
|
|
76
|
+
unitKind: "externalPreUtility",
|
|
77
|
+
invokeMode: "externalRunTask",
|
|
78
|
+
order,
|
|
79
|
+
strategyKey: preStrategyKey,
|
|
80
|
+
actionKey: preStrategyKey,
|
|
81
|
+
modelSlot: "preActionModel",
|
|
82
|
+
modelSelection: preModel.modelSelection,
|
|
83
|
+
modelSource: preModel.modelSource,
|
|
84
|
+
sourcePath: `${nodeSourcePath}/parameters/taskConfiguration/aiTaskStrategies/pre`
|
|
85
|
+
});
|
|
86
|
+
order += 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const action of preActions) {
|
|
90
|
+
units.push(buildActionUnitV2(graph, nodeId, action, "externalPreUtility", "externalRunTask", order, "preActionModel", slots.preActionModel));
|
|
91
|
+
order += 1;
|
|
92
|
+
}
|
|
93
|
+
const aiTaskProfile = taskConfiguration?.aiTaskProfile;
|
|
94
|
+
if (aiTaskProfile?.inputSynthesis !== undefined) {
|
|
95
|
+
units.push({
|
|
96
|
+
unitId: buildUnitId(nodeId, "pipeline:inputSynthesis"),
|
|
97
|
+
nodeId,
|
|
98
|
+
unitKind: "pipelinePhase",
|
|
99
|
+
invokeMode: "pipelinePhase",
|
|
100
|
+
order,
|
|
101
|
+
strategyKey: "inputSynthesis",
|
|
102
|
+
modelSlot: "preActionModel",
|
|
103
|
+
modelSelection: slots.preActionModel.selection,
|
|
104
|
+
modelSource: slots.preActionModel.source,
|
|
105
|
+
sourcePath: `${getNodeSourcePath(graph, nodeId)}/parameters/taskConfiguration/aiTaskProfile/inputSynthesis`
|
|
106
|
+
});
|
|
107
|
+
order += 1;
|
|
108
|
+
}
|
|
109
|
+
const skillModel = slotToModel(slots.skillModel);
|
|
110
|
+
units.push({
|
|
111
|
+
unitId: buildUnitId(nodeId, "main"),
|
|
112
|
+
nodeId,
|
|
113
|
+
unitKind: "mainSkill",
|
|
114
|
+
invokeMode: "mainRunTask",
|
|
115
|
+
order,
|
|
116
|
+
skillKey: params.skillKey,
|
|
117
|
+
modelSlot: "skillModel",
|
|
118
|
+
modelSelection: skillModel.modelSelection,
|
|
119
|
+
modelSource: skillModel.modelSource,
|
|
120
|
+
sourcePath: `${getNodeSourcePath(graph, nodeId)}/parameters/skillKey`
|
|
121
|
+
});
|
|
122
|
+
order += 1;
|
|
123
|
+
if (shouldExpandPhaseUtilityStrategy(postActions)) {
|
|
124
|
+
const postStrategyKey = readPhaseUtilityStrategyKey(aiTaskStrategies, "post");
|
|
125
|
+
if (postStrategyKey) {
|
|
126
|
+
const postModel = slotToModel(slots.postActionModel);
|
|
127
|
+
units.push({
|
|
128
|
+
unitId: buildUnitId(nodeId, "post:0"),
|
|
129
|
+
nodeId,
|
|
130
|
+
unitKind: "externalPostUtility",
|
|
131
|
+
invokeMode: "externalRunTask",
|
|
132
|
+
order,
|
|
133
|
+
strategyKey: postStrategyKey,
|
|
134
|
+
actionKey: postStrategyKey,
|
|
135
|
+
modelSlot: "postActionModel",
|
|
136
|
+
modelSelection: postModel.modelSelection,
|
|
137
|
+
modelSource: postModel.modelSource,
|
|
138
|
+
sourcePath: `${nodeSourcePath}/parameters/taskConfiguration/aiTaskStrategies/post`
|
|
139
|
+
});
|
|
140
|
+
order += 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (const action of postActions) {
|
|
144
|
+
units.push(buildActionUnitV2(graph, nodeId, action, "externalPostUtility", "externalRunTask", order, "postActionModel", slots.postActionModel));
|
|
145
|
+
order += 1;
|
|
146
|
+
}
|
|
147
|
+
if (params.executionMapping !== undefined) {
|
|
148
|
+
units.push({
|
|
149
|
+
unitId: buildUnitId(nodeId, "mapping"),
|
|
150
|
+
nodeId,
|
|
151
|
+
unitKind: "mapping",
|
|
152
|
+
invokeMode: "none",
|
|
153
|
+
order,
|
|
154
|
+
outputContract: structuredClone(params.executionMapping),
|
|
155
|
+
sourcePath: `${getNodeSourcePath(graph, nodeId)}/parameters/executionMapping`
|
|
156
|
+
});
|
|
157
|
+
order += 1;
|
|
158
|
+
}
|
|
159
|
+
const outputValidation = params.outputValidation;
|
|
160
|
+
if (outputValidation !== undefined) {
|
|
161
|
+
units.push({
|
|
162
|
+
unitId: buildUnitId(nodeId, "validation"),
|
|
163
|
+
nodeId,
|
|
164
|
+
unitKind: "validation",
|
|
165
|
+
invokeMode: "none",
|
|
166
|
+
order,
|
|
167
|
+
sourcePath: `${getNodeSourcePath(graph, nodeId)}/parameters/outputValidation`
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return units;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=build-node-execution-units-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-node-execution-units-v2.js","sourceRoot":"","sources":["../../src/compile/build-node-execution-units-v2.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EACjC,MAAM,6BAA6B,CAAC;AAErC,SAAS,WAAW,CAAC,MAAc,EAAE,MAAc;IACjD,OAAO,QAAQ,MAAM,IAAI,MAAM,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,WAAW,CAClB,QAAgC;IAKhC,OAAO;QACL,cAAc,EAAE,QAAQ,CAAC,SAAS;QAClC,WAAW,EAAE,QAAQ,CAAC,MAA8B;KACrD,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAC7B,MAA6B,EAC7B,QAAgC;IAKhC,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,WAAW,EAAE,gBAAgB;SAC9B,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,CAAC,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AC;IACb,CAAC;IAED,IAAI,MAAM,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC;YACtC,MAAM;YACN,QAAQ,EAAE,SAAS;YACnB,UAAU,EAAE,MAAM;YAClB,KAAK;YACL,cAAc,EAAE,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACxD,UAAU,EAAE,GAAG,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,8BAA8B;SAC9E,CAAC,CAAC;QACH,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,MAAM,gBAAgB,GAAI,MAAyC,CAAC,gBAAgB,CAAC;IACrF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;YACzC,MAAM;YACN,QAAQ,EAAE,YAAY;YACtB,UAAU,EAAE,MAAM;YAClB,KAAK;YACL,UAAU,EAAE,GAAG,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,8BAA8B;SAC9E,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExecutableTaskNodeParameters } from "@x12i/graphenix-executable-contracts";
|
|
2
|
+
import type { ExecutionUnitPlan } from "@x12i/graphenix-executable-contracts";
|
|
3
|
+
import type { AiModelSlot } from "@x12i/graphenix-executable-contracts";
|
|
4
|
+
import type { ResolvedModelSlotPlan } from "@x12i/graphenix-executable-contracts";
|
|
5
|
+
export declare function buildNodeExecutionUnits(nodeId: string, params: ExecutableTaskNodeParameters, modelSlots: Record<AiModelSlot, ResolvedModelSlotPlan>): ExecutionUnitPlan[];
|
|
6
|
+
//# sourceMappingURL=build-node-execution-units.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-node-execution-units.d.ts","sourceRoot":"","sources":["../../src/compile/build-node-execution-units.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AA+ElF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,4BAA4B,EACpC,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE,qBAAqB,CAAC,GACrD,iBAAiB,EAAE,CAyFrB"}
|