@fluidgrids/workflows 0.0.0-stage → 2026.1027.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.
Files changed (60) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +187 -2
  3. package/dist/assemble-BJo9TECS.d.cts +569 -0
  4. package/dist/assemble-DMOuaxRI.d.ts +569 -0
  5. package/dist/chunk-265J2FCH.cjs +33 -0
  6. package/dist/chunk-27HASETB.cjs +250 -0
  7. package/dist/chunk-4DPEGDPW.js +74 -0
  8. package/dist/chunk-5LUIDMF4.js +42 -0
  9. package/dist/chunk-AU3YW7FZ.cjs +279 -0
  10. package/dist/chunk-BWSLWF2E.js +722 -0
  11. package/dist/chunk-BYJ7QTLY.cjs +76 -0
  12. package/dist/chunk-G4UEPUGO.cjs +46 -0
  13. package/dist/chunk-GO34UHSY.js +95 -0
  14. package/dist/chunk-IZQNUNSU.cjs +931 -0
  15. package/dist/chunk-KUTMY2IO.cjs +745 -0
  16. package/dist/chunk-LMX35GNQ.js +893 -0
  17. package/dist/chunk-LRM6JXJA.cjs +181 -0
  18. package/dist/chunk-LSKSBVL4.cjs +102 -0
  19. package/dist/chunk-LUXCXFOE.cjs +269 -0
  20. package/dist/chunk-PL73GJR4.js +174 -0
  21. package/dist/chunk-REV7ZOA4.js +170 -0
  22. package/dist/chunk-RRQ5HOBF.cjs +185 -0
  23. package/dist/chunk-S34NJE3A.js +262 -0
  24. package/dist/chunk-SRQRLWOS.js +31 -0
  25. package/dist/chunk-SS4LT2IP.js +268 -0
  26. package/dist/chunk-X4HKU3MX.js +244 -0
  27. package/dist/codegen/index.cjs +18 -0
  28. package/dist/codegen/index.d.cts +15 -0
  29. package/dist/codegen/index.d.ts +15 -0
  30. package/dist/codegen/index.js +5 -0
  31. package/dist/expressions-DhHaqyar.d.cts +62 -0
  32. package/dist/expressions-DhHaqyar.d.ts +62 -0
  33. package/dist/hash-CZkTXPCX.d.cts +15 -0
  34. package/dist/hash-CZkTXPCX.d.ts +15 -0
  35. package/dist/index.cjs +117 -0
  36. package/dist/index.d.cts +27 -0
  37. package/dist/index.d.ts +27 -0
  38. package/dist/index.js +4 -0
  39. package/dist/ir/index.cjs +1244 -0
  40. package/dist/ir/index.d.cts +828 -0
  41. package/dist/ir/index.d.ts +828 -0
  42. package/dist/ir/index.js +1120 -0
  43. package/dist/lower-DcOY8ux0.d.cts +49 -0
  44. package/dist/lower-Dw5grNrI.d.ts +49 -0
  45. package/dist/manifest-Bp9ZJlav.d.ts +60 -0
  46. package/dist/manifest-Duf-gHdO.d.cts +60 -0
  47. package/dist/node-evaluator-2GTUZVPK.cjs +17 -0
  48. package/dist/node-evaluator-RMYEWCXZ.js +8 -0
  49. package/dist/quickjs/index.cjs +92 -0
  50. package/dist/quickjs/index.d.cts +18 -0
  51. package/dist/quickjs/index.d.ts +18 -0
  52. package/dist/quickjs/index.js +90 -0
  53. package/dist/roundtrip/index.cjs +1375 -0
  54. package/dist/roundtrip/index.d.cts +287 -0
  55. package/dist/roundtrip/index.d.ts +287 -0
  56. package/dist/roundtrip/index.js +1328 -0
  57. package/dist/types-Dr2Fn1Ax.d.cts +225 -0
  58. package/dist/types-Dr2Fn1Ax.d.ts +225 -0
  59. package/package.json +117 -4
  60. package/schema/ir-v2.schema.json +655 -0
@@ -0,0 +1,287 @@
1
+ import { W as WorkflowDefinition, a as JsonObject } from '../types-Dr2Fn1Ax.cjs';
2
+ import { m as LayoutSidecar } from '../assemble-BJo9TECS.cjs';
3
+ import { N as NodeManifest } from '../manifest-Duf-gHdO.cjs';
4
+ import { P as PathSegment } from '../expressions-DhHaqyar.cjs';
5
+ import { E as Evaluator, a as EsbuildApi } from '../lower-DcOY8ux0.cjs';
6
+ export { b as ESBUILD_VERSION, c as EVALUATION_GLOBAL, L as LowerError, d as LowerOptions, e as LowerResult, f as LoweredWorkflow, g as bundleProject, h as defaultEntries, l as lower } from '../lower-DcOY8ux0.cjs';
7
+ import 'esbuild';
8
+ import '../hash-CZkTXPCX.cjs';
9
+
10
+ /**
11
+ * The language-neutral lift plan: a definition expressed as tier-1 builder
12
+ * calls. The TypeScript and Python renderers print the same plan, and
13
+ * {@link interpretPlan} runs it through the real builder so the lifter can
14
+ * prove, node by node, that the code it is about to print lowers back to the
15
+ * same IR.
16
+ */
17
+
18
+ /** What a reference points at. */
19
+ type PlanRefTarget = {
20
+ kind: 'node';
21
+ nodeId: string;
22
+ } | {
23
+ kind: 'json' | 'vars' | 'now' | 'execution';
24
+ };
25
+ interface PlanRef {
26
+ target: PlanRefTarget;
27
+ path: PathSegment[];
28
+ }
29
+ /** A comparison method on a reference (`gte`, `isEmpty`, …) or the generic `is`. */
30
+ interface PlanRule {
31
+ k: 'rule';
32
+ ref: PlanRef;
33
+ /** Builder method name; `is` takes the operator explicitly. */
34
+ method: string;
35
+ operator: string;
36
+ value?: string | number | boolean | null;
37
+ hasValue: boolean;
38
+ }
39
+ interface PlanGroup {
40
+ k: 'group';
41
+ combinator: 'and' | 'or';
42
+ children: Array<PlanRule | PlanGroup>;
43
+ }
44
+ /** The typed handle accessors of builder refs. */
45
+ type HandleAccessor = {
46
+ kind: 'property';
47
+ name: string;
48
+ } | {
49
+ kind: 'case';
50
+ } | {
51
+ kind: 'generic';
52
+ };
53
+ type PlanExpr = {
54
+ k: 'literal';
55
+ value: string | number | boolean | null;
56
+ } | {
57
+ k: 'object';
58
+ entries: Array<[string, PlanExpr]>;
59
+ } | {
60
+ k: 'array';
61
+ items: PlanExpr[];
62
+ } | {
63
+ k: 'ref';
64
+ ref: PlanRef;
65
+ } | {
66
+ k: 'template';
67
+ parts: Array<{
68
+ text: string;
69
+ } | {
70
+ ref: PlanRef;
71
+ }>;
72
+ } | PlanRule | PlanGroup | {
73
+ k: 'node';
74
+ nodeId: string;
75
+ } | {
76
+ k: 'handle';
77
+ nodeId: string;
78
+ handle: string;
79
+ accessor: HandleAccessor;
80
+ } | {
81
+ k: 'edge';
82
+ from: PlanExpr;
83
+ options: Array<[string, PlanExpr]>;
84
+ };
85
+ /** How a node's operation descriptor is written. */
86
+ type PlanOperation = {
87
+ kind: 'trigger';
88
+ name: string;
89
+ nodeType: string;
90
+ } | {
91
+ kind: 'internal';
92
+ name: string;
93
+ nodeType: string;
94
+ } | {
95
+ kind: 'client';
96
+ group: string;
97
+ operationKey: string;
98
+ nodeType: string;
99
+ operation: string;
100
+ version?: string;
101
+ role?: 'trigger';
102
+ } | {
103
+ kind: 'custom';
104
+ nodeType: string;
105
+ operation?: string;
106
+ version?: string;
107
+ };
108
+ interface PlanNodeStatement {
109
+ kind: 'node';
110
+ nodeId: string;
111
+ /** Builder method (`trigger`, `step`, `if`, `loop`, …). */
112
+ method: string;
113
+ /** Present for `trigger` and `step`. */
114
+ operation?: PlanOperation;
115
+ options: Array<[string, PlanExpr]>;
116
+ }
117
+ interface PlanConnectStatement {
118
+ kind: 'connect';
119
+ from: PlanExpr;
120
+ to: string;
121
+ options: Array<[string, PlanExpr]>;
122
+ }
123
+ interface PlanEdgeOrderStatement {
124
+ kind: 'edgeOrder';
125
+ /** Edge ids, or declaration positions for edges without an id. */
126
+ ids: Array<string | number>;
127
+ }
128
+ type PlanStatement = PlanNodeStatement | PlanConnectStatement | PlanEdgeOrderStatement;
129
+ interface LiftPlan {
130
+ key: string;
131
+ workflowOptions: Array<[string, PlanExpr]>;
132
+ statements: PlanStatement[];
133
+ }
134
+
135
+ /** Fidelity report types (spec 07 §2). */
136
+ /**
137
+ * The documented item kinds:
138
+ * - `expression-verbatim`: a `{{ … }}` expression kept as a string, not typed;
139
+ * - `legacy-syntax`: a `${…}` template, an edge mapping or legacy credentials kept verbatim;
140
+ * - `unknown-node`: a node type or operation the registry snapshot does not know, written as `nodes.custom()`;
141
+ * - `connection-id-only`: a connection with no name, kept as its id;
142
+ * - `raw-node`: a node written in its exact form (`nodes.custom()` plus `extra`);
143
+ * - `layout-omitted`, `pinned-data-omitted`: left out by the export options (lossy);
144
+ * - `key-added`: the definition had no `key`; the workflow key was written;
145
+ * - `roundtrip-mismatch` / `lowering-failed`: lowering the code did not reproduce the IR (lossy).
146
+ */
147
+ type FidelityItemKind = 'expression-verbatim' | 'legacy-syntax' | 'unknown-node' | 'connection-id-only' | 'raw-node' | 'layout-omitted' | 'pinned-data-omitted' | 'key-added' | 'roundtrip-mismatch' | 'lowering-failed';
148
+ interface FidelityItem {
149
+ nodeId?: string;
150
+ path?: string;
151
+ kind: FidelityItemKind;
152
+ detail: string;
153
+ }
154
+ interface FidelityReport {
155
+ level: 'lossless' | 'lossy';
156
+ items: FidelityItem[];
157
+ }
158
+
159
+ declare class LiftError extends Error {
160
+ constructor(message: string);
161
+ }
162
+ interface PlanOptions {
163
+ /** Workflow key when the definition has none. */
164
+ workflowKey?: string;
165
+ /** Registry snapshot for typed node clients. */
166
+ registry?: readonly NodeManifest[];
167
+ /** connectionId → connection name. */
168
+ connectionNames?: Readonly<Record<string, string>>;
169
+ }
170
+
171
+ /** One file of an export. */
172
+ interface ExportedFile {
173
+ path: string;
174
+ contentType: string;
175
+ content: string;
176
+ }
177
+ interface LiftHeader {
178
+ workflowKey?: string;
179
+ version?: string;
180
+ irHash?: string;
181
+ exportedAt?: string;
182
+ registrySnapshot?: string;
183
+ }
184
+ interface LiftOptions extends PlanOptions {
185
+ /** Write the layout sidecar. Default true; without it positions are lost (lossy). */
186
+ includeLayout?: boolean;
187
+ /** Write pinned data to `workflows/<key>.pinned.json` (TEST only). Default false. */
188
+ includePinnedData?: boolean;
189
+ /** Header comment fields. */
190
+ header?: LiftHeader;
191
+ }
192
+ /** A definition prepared for printing. */
193
+ interface PreparedLift {
194
+ /** What lowering the code must reproduce: the normalised definition (with its key). */
195
+ reference: WorkflowDefinition;
196
+ plan: LiftPlan;
197
+ items: FidelityItem[];
198
+ layout?: LayoutSidecar;
199
+ pinnedData?: JsonObject;
200
+ registry: readonly NodeManifest[];
201
+ clientPy: (nodeType: string, operation: string) => string;
202
+ usesClients: boolean;
203
+ }
204
+ interface LiftResult {
205
+ files: ExportedFile[];
206
+ items: FidelityItem[];
207
+ /** The definition the code lowers to when fidelity is lossless. */
208
+ reference: WorkflowDefinition;
209
+ }
210
+ /** Normalise, plan and verify a definition for lifting. */
211
+ declare function prepareLift(definition: unknown, options?: LiftOptions): PreparedLift;
212
+ /** Lift to a tier-1 TypeScript project fragment. */
213
+ declare function liftToTypeScript(definition: unknown, options?: LiftOptions): Promise<LiftResult>;
214
+ /** Lift to a tier-1 Python project fragment. */
215
+ declare function liftToPython(definition: unknown, options?: LiftOptions): Promise<LiftResult>;
216
+
217
+ interface NodeVmEvaluatorOptions {
218
+ /** Wall-clock budget for evaluating the bundle. Default 5000 ms. */
219
+ timeoutMs?: number;
220
+ }
221
+ declare function createNodeVmEvaluator(options?: NodeVmEvaluatorOptions): Evaluator;
222
+
223
+ interface ExportCodeOptions extends LiftOptions {
224
+ format: 'TYPESCRIPT' | 'PYTHON';
225
+ esbuild?: EsbuildApi;
226
+ evaluator?: Evaluator;
227
+ }
228
+ interface ExportCodeResult {
229
+ format: 'TYPESCRIPT' | 'PYTHON';
230
+ files: ExportedFile[];
231
+ fidelity: FidelityReport;
232
+ /** `irHash` of the exported definition. */
233
+ irHash: string;
234
+ }
235
+ /** Lower lifted TypeScript files and compare with the reference IR. */
236
+ declare function checkFidelity(files: readonly ExportedFile[], reference: unknown, items: readonly FidelityItem[], options?: {
237
+ esbuild?: EsbuildApi;
238
+ evaluator?: Evaluator;
239
+ connectionNames?: Readonly<Record<string, string>>;
240
+ }): Promise<FidelityReport>;
241
+ /** Export a definition as TypeScript or Python files with a computed fidelity report. */
242
+ declare function exportWorkflowCode(definition: unknown, options: ExportCodeOptions): Promise<ExportCodeResult>;
243
+
244
+ /** Prettier options for lifted TypeScript. Part of the output contract: changing them changes every export. */
245
+ declare const TS_FORMAT_OPTIONS: {
246
+ readonly parser: "typescript";
247
+ readonly printWidth: 100;
248
+ readonly singleQuote: true;
249
+ readonly trailingComma: "all";
250
+ readonly semi: true;
251
+ readonly tabWidth: 2;
252
+ readonly useTabs: false;
253
+ readonly bracketSpacing: true;
254
+ readonly arrowParens: "always";
255
+ };
256
+ /** Import path of the generated clients, relative to `workflows/<key>.ts`. */
257
+ declare const TS_NODES_IMPORT = "../.fluidgrids/nodes";
258
+
259
+ declare const PY_SDK_MODULE = "fluidgrids_workflows";
260
+ declare const PY_PROJECT_MODULE = "fluidgrids_workflows.project";
261
+
262
+ /**
263
+ * A small Python printer whose output `ruff format` (Black style, line length
264
+ * 88) leaves unchanged, so the service can emit Python without running Ruff
265
+ * (decision D1).
266
+ *
267
+ * The rules are Black's for the expression shapes the lifter produces (calls,
268
+ * keyword arguments, dicts, lists, subscripts, comparisons, attribute chains,
269
+ * string and number literals):
270
+ *
271
+ * 1. A line that fits in 88 columns stays on one line, without a trailing comma.
272
+ * 2. Otherwise the last bracket pair on the line is split. If the bracket's
273
+ * contents fit on one line at the next indent, they go there with no
274
+ * trailing comma ("hugging" the brackets).
275
+ * 3. Otherwise, with two or more elements, every element goes on its own line
276
+ * with a trailing comma, and each element line is formatted recursively.
277
+ * A single element is formatted recursively on its own line, without a
278
+ * trailing comma.
279
+ * 4. Import lists always split one name per line with a trailing comma.
280
+ * 5. A too-long `name = <atom>` gets its right-hand side wrapped in
281
+ * parentheses when the atom then fits.
282
+ *
283
+ * The fixture suite runs `ruff format --check` over every generated file.
284
+ */
285
+ declare const PY_LINE_LENGTH = 88;
286
+
287
+ export { EsbuildApi, Evaluator, type ExportCodeOptions, type ExportCodeResult, type ExportedFile, type FidelityItem, type FidelityItemKind, type FidelityReport, LiftError, type LiftHeader, type LiftOptions, type LiftResult, type NodeVmEvaluatorOptions, PY_LINE_LENGTH, PY_PROJECT_MODULE, PY_SDK_MODULE, type PlanOptions, type PreparedLift, TS_FORMAT_OPTIONS, TS_NODES_IMPORT, checkFidelity, createNodeVmEvaluator, exportWorkflowCode, liftToPython, liftToTypeScript, prepareLift };
@@ -0,0 +1,287 @@
1
+ import { W as WorkflowDefinition, a as JsonObject } from '../types-Dr2Fn1Ax.js';
2
+ import { m as LayoutSidecar } from '../assemble-DMOuaxRI.js';
3
+ import { N as NodeManifest } from '../manifest-Bp9ZJlav.js';
4
+ import { P as PathSegment } from '../expressions-DhHaqyar.js';
5
+ import { E as Evaluator, a as EsbuildApi } from '../lower-Dw5grNrI.js';
6
+ export { b as ESBUILD_VERSION, c as EVALUATION_GLOBAL, L as LowerError, d as LowerOptions, e as LowerResult, f as LoweredWorkflow, g as bundleProject, h as defaultEntries, l as lower } from '../lower-Dw5grNrI.js';
7
+ import 'esbuild';
8
+ import '../hash-CZkTXPCX.js';
9
+
10
+ /**
11
+ * The language-neutral lift plan: a definition expressed as tier-1 builder
12
+ * calls. The TypeScript and Python renderers print the same plan, and
13
+ * {@link interpretPlan} runs it through the real builder so the lifter can
14
+ * prove, node by node, that the code it is about to print lowers back to the
15
+ * same IR.
16
+ */
17
+
18
+ /** What a reference points at. */
19
+ type PlanRefTarget = {
20
+ kind: 'node';
21
+ nodeId: string;
22
+ } | {
23
+ kind: 'json' | 'vars' | 'now' | 'execution';
24
+ };
25
+ interface PlanRef {
26
+ target: PlanRefTarget;
27
+ path: PathSegment[];
28
+ }
29
+ /** A comparison method on a reference (`gte`, `isEmpty`, …) or the generic `is`. */
30
+ interface PlanRule {
31
+ k: 'rule';
32
+ ref: PlanRef;
33
+ /** Builder method name; `is` takes the operator explicitly. */
34
+ method: string;
35
+ operator: string;
36
+ value?: string | number | boolean | null;
37
+ hasValue: boolean;
38
+ }
39
+ interface PlanGroup {
40
+ k: 'group';
41
+ combinator: 'and' | 'or';
42
+ children: Array<PlanRule | PlanGroup>;
43
+ }
44
+ /** The typed handle accessors of builder refs. */
45
+ type HandleAccessor = {
46
+ kind: 'property';
47
+ name: string;
48
+ } | {
49
+ kind: 'case';
50
+ } | {
51
+ kind: 'generic';
52
+ };
53
+ type PlanExpr = {
54
+ k: 'literal';
55
+ value: string | number | boolean | null;
56
+ } | {
57
+ k: 'object';
58
+ entries: Array<[string, PlanExpr]>;
59
+ } | {
60
+ k: 'array';
61
+ items: PlanExpr[];
62
+ } | {
63
+ k: 'ref';
64
+ ref: PlanRef;
65
+ } | {
66
+ k: 'template';
67
+ parts: Array<{
68
+ text: string;
69
+ } | {
70
+ ref: PlanRef;
71
+ }>;
72
+ } | PlanRule | PlanGroup | {
73
+ k: 'node';
74
+ nodeId: string;
75
+ } | {
76
+ k: 'handle';
77
+ nodeId: string;
78
+ handle: string;
79
+ accessor: HandleAccessor;
80
+ } | {
81
+ k: 'edge';
82
+ from: PlanExpr;
83
+ options: Array<[string, PlanExpr]>;
84
+ };
85
+ /** How a node's operation descriptor is written. */
86
+ type PlanOperation = {
87
+ kind: 'trigger';
88
+ name: string;
89
+ nodeType: string;
90
+ } | {
91
+ kind: 'internal';
92
+ name: string;
93
+ nodeType: string;
94
+ } | {
95
+ kind: 'client';
96
+ group: string;
97
+ operationKey: string;
98
+ nodeType: string;
99
+ operation: string;
100
+ version?: string;
101
+ role?: 'trigger';
102
+ } | {
103
+ kind: 'custom';
104
+ nodeType: string;
105
+ operation?: string;
106
+ version?: string;
107
+ };
108
+ interface PlanNodeStatement {
109
+ kind: 'node';
110
+ nodeId: string;
111
+ /** Builder method (`trigger`, `step`, `if`, `loop`, …). */
112
+ method: string;
113
+ /** Present for `trigger` and `step`. */
114
+ operation?: PlanOperation;
115
+ options: Array<[string, PlanExpr]>;
116
+ }
117
+ interface PlanConnectStatement {
118
+ kind: 'connect';
119
+ from: PlanExpr;
120
+ to: string;
121
+ options: Array<[string, PlanExpr]>;
122
+ }
123
+ interface PlanEdgeOrderStatement {
124
+ kind: 'edgeOrder';
125
+ /** Edge ids, or declaration positions for edges without an id. */
126
+ ids: Array<string | number>;
127
+ }
128
+ type PlanStatement = PlanNodeStatement | PlanConnectStatement | PlanEdgeOrderStatement;
129
+ interface LiftPlan {
130
+ key: string;
131
+ workflowOptions: Array<[string, PlanExpr]>;
132
+ statements: PlanStatement[];
133
+ }
134
+
135
+ /** Fidelity report types (spec 07 §2). */
136
+ /**
137
+ * The documented item kinds:
138
+ * - `expression-verbatim`: a `{{ … }}` expression kept as a string, not typed;
139
+ * - `legacy-syntax`: a `${…}` template, an edge mapping or legacy credentials kept verbatim;
140
+ * - `unknown-node`: a node type or operation the registry snapshot does not know, written as `nodes.custom()`;
141
+ * - `connection-id-only`: a connection with no name, kept as its id;
142
+ * - `raw-node`: a node written in its exact form (`nodes.custom()` plus `extra`);
143
+ * - `layout-omitted`, `pinned-data-omitted`: left out by the export options (lossy);
144
+ * - `key-added`: the definition had no `key`; the workflow key was written;
145
+ * - `roundtrip-mismatch` / `lowering-failed`: lowering the code did not reproduce the IR (lossy).
146
+ */
147
+ type FidelityItemKind = 'expression-verbatim' | 'legacy-syntax' | 'unknown-node' | 'connection-id-only' | 'raw-node' | 'layout-omitted' | 'pinned-data-omitted' | 'key-added' | 'roundtrip-mismatch' | 'lowering-failed';
148
+ interface FidelityItem {
149
+ nodeId?: string;
150
+ path?: string;
151
+ kind: FidelityItemKind;
152
+ detail: string;
153
+ }
154
+ interface FidelityReport {
155
+ level: 'lossless' | 'lossy';
156
+ items: FidelityItem[];
157
+ }
158
+
159
+ declare class LiftError extends Error {
160
+ constructor(message: string);
161
+ }
162
+ interface PlanOptions {
163
+ /** Workflow key when the definition has none. */
164
+ workflowKey?: string;
165
+ /** Registry snapshot for typed node clients. */
166
+ registry?: readonly NodeManifest[];
167
+ /** connectionId → connection name. */
168
+ connectionNames?: Readonly<Record<string, string>>;
169
+ }
170
+
171
+ /** One file of an export. */
172
+ interface ExportedFile {
173
+ path: string;
174
+ contentType: string;
175
+ content: string;
176
+ }
177
+ interface LiftHeader {
178
+ workflowKey?: string;
179
+ version?: string;
180
+ irHash?: string;
181
+ exportedAt?: string;
182
+ registrySnapshot?: string;
183
+ }
184
+ interface LiftOptions extends PlanOptions {
185
+ /** Write the layout sidecar. Default true; without it positions are lost (lossy). */
186
+ includeLayout?: boolean;
187
+ /** Write pinned data to `workflows/<key>.pinned.json` (TEST only). Default false. */
188
+ includePinnedData?: boolean;
189
+ /** Header comment fields. */
190
+ header?: LiftHeader;
191
+ }
192
+ /** A definition prepared for printing. */
193
+ interface PreparedLift {
194
+ /** What lowering the code must reproduce: the normalised definition (with its key). */
195
+ reference: WorkflowDefinition;
196
+ plan: LiftPlan;
197
+ items: FidelityItem[];
198
+ layout?: LayoutSidecar;
199
+ pinnedData?: JsonObject;
200
+ registry: readonly NodeManifest[];
201
+ clientPy: (nodeType: string, operation: string) => string;
202
+ usesClients: boolean;
203
+ }
204
+ interface LiftResult {
205
+ files: ExportedFile[];
206
+ items: FidelityItem[];
207
+ /** The definition the code lowers to when fidelity is lossless. */
208
+ reference: WorkflowDefinition;
209
+ }
210
+ /** Normalise, plan and verify a definition for lifting. */
211
+ declare function prepareLift(definition: unknown, options?: LiftOptions): PreparedLift;
212
+ /** Lift to a tier-1 TypeScript project fragment. */
213
+ declare function liftToTypeScript(definition: unknown, options?: LiftOptions): Promise<LiftResult>;
214
+ /** Lift to a tier-1 Python project fragment. */
215
+ declare function liftToPython(definition: unknown, options?: LiftOptions): Promise<LiftResult>;
216
+
217
+ interface NodeVmEvaluatorOptions {
218
+ /** Wall-clock budget for evaluating the bundle. Default 5000 ms. */
219
+ timeoutMs?: number;
220
+ }
221
+ declare function createNodeVmEvaluator(options?: NodeVmEvaluatorOptions): Evaluator;
222
+
223
+ interface ExportCodeOptions extends LiftOptions {
224
+ format: 'TYPESCRIPT' | 'PYTHON';
225
+ esbuild?: EsbuildApi;
226
+ evaluator?: Evaluator;
227
+ }
228
+ interface ExportCodeResult {
229
+ format: 'TYPESCRIPT' | 'PYTHON';
230
+ files: ExportedFile[];
231
+ fidelity: FidelityReport;
232
+ /** `irHash` of the exported definition. */
233
+ irHash: string;
234
+ }
235
+ /** Lower lifted TypeScript files and compare with the reference IR. */
236
+ declare function checkFidelity(files: readonly ExportedFile[], reference: unknown, items: readonly FidelityItem[], options?: {
237
+ esbuild?: EsbuildApi;
238
+ evaluator?: Evaluator;
239
+ connectionNames?: Readonly<Record<string, string>>;
240
+ }): Promise<FidelityReport>;
241
+ /** Export a definition as TypeScript or Python files with a computed fidelity report. */
242
+ declare function exportWorkflowCode(definition: unknown, options: ExportCodeOptions): Promise<ExportCodeResult>;
243
+
244
+ /** Prettier options for lifted TypeScript. Part of the output contract: changing them changes every export. */
245
+ declare const TS_FORMAT_OPTIONS: {
246
+ readonly parser: "typescript";
247
+ readonly printWidth: 100;
248
+ readonly singleQuote: true;
249
+ readonly trailingComma: "all";
250
+ readonly semi: true;
251
+ readonly tabWidth: 2;
252
+ readonly useTabs: false;
253
+ readonly bracketSpacing: true;
254
+ readonly arrowParens: "always";
255
+ };
256
+ /** Import path of the generated clients, relative to `workflows/<key>.ts`. */
257
+ declare const TS_NODES_IMPORT = "../.fluidgrids/nodes";
258
+
259
+ declare const PY_SDK_MODULE = "fluidgrids_workflows";
260
+ declare const PY_PROJECT_MODULE = "fluidgrids_workflows.project";
261
+
262
+ /**
263
+ * A small Python printer whose output `ruff format` (Black style, line length
264
+ * 88) leaves unchanged, so the service can emit Python without running Ruff
265
+ * (decision D1).
266
+ *
267
+ * The rules are Black's for the expression shapes the lifter produces (calls,
268
+ * keyword arguments, dicts, lists, subscripts, comparisons, attribute chains,
269
+ * string and number literals):
270
+ *
271
+ * 1. A line that fits in 88 columns stays on one line, without a trailing comma.
272
+ * 2. Otherwise the last bracket pair on the line is split. If the bracket's
273
+ * contents fit on one line at the next indent, they go there with no
274
+ * trailing comma ("hugging" the brackets).
275
+ * 3. Otherwise, with two or more elements, every element goes on its own line
276
+ * with a trailing comma, and each element line is formatted recursively.
277
+ * A single element is formatted recursively on its own line, without a
278
+ * trailing comma.
279
+ * 4. Import lists always split one name per line with a trailing comma.
280
+ * 5. A too-long `name = <atom>` gets its right-hand side wrapped in
281
+ * parentheses when the atom then fits.
282
+ *
283
+ * The fixture suite runs `ruff format --check` over every generated file.
284
+ */
285
+ declare const PY_LINE_LENGTH = 88;
286
+
287
+ export { EsbuildApi, Evaluator, type ExportCodeOptions, type ExportCodeResult, type ExportedFile, type FidelityItem, type FidelityItemKind, type FidelityReport, LiftError, type LiftHeader, type LiftOptions, type LiftResult, type NodeVmEvaluatorOptions, PY_LINE_LENGTH, PY_PROJECT_MODULE, PY_SDK_MODULE, type PlanOptions, type PreparedLift, TS_FORMAT_OPTIONS, TS_NODES_IMPORT, checkFidelity, createNodeVmEvaluator, exportWorkflowCode, liftToPython, liftToTypeScript, prepareLift };