@flopod/compiler 0.1.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/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync, writeFileSync, mkdirSync } from 'fs';
3
+ import { join, dirname, resolve } from 'path';
4
+ import { fileURLToPath, pathToFileURL } from 'url';
5
+ import { spawn } from 'child_process';
6
+ import { transpileSource } from './transpile.js';
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const [cmd, ...rest] = process.argv.slice(2);
9
+ if (cmd === 'dev') {
10
+ // flopod dev <entry.ts> [--port 3847]
11
+ const portIdx = rest.indexOf('--port');
12
+ const port = portIdx !== -1 ? parseInt(rest[portIdx + 1], 10) : 3847;
13
+ const skipIdx = new Set(portIdx !== -1 ? [portIdx, portIdx + 1] : []);
14
+ const inputFile = rest.find((a, i) => !a.startsWith('--') && !skipIdx.has(i));
15
+ if (!inputFile) {
16
+ console.error('Usage: flopod dev <entry.ts> [--port <port>]');
17
+ process.exit(1);
18
+ }
19
+ // Resolve runtime package paths from the transpiler's own location
20
+ const runtimeDist = resolve(__dirname, '../../flopod-runtime/dist');
21
+ const runtimeUrl = pathToFileURL(join(runtimeDist, 'index.js')).href;
22
+ const devUrl = pathToFileURL(join(runtimeDist, 'dev/index.js')).href;
23
+ const source = readFileSync(inputFile, 'utf8');
24
+ const result = transpileSource(source, inputFile, { runtimeUrl, devUrl, port });
25
+ const outDir = join(process.cwd(), '.flopod-dev');
26
+ const outFile = join(outDir, 'main.ts');
27
+ mkdirSync(outDir, { recursive: true });
28
+ writeFileSync(outFile, result.code, 'utf8');
29
+ // Find tsx in node_modules up the tree
30
+ const tsxBin = findTsx();
31
+ if (!tsxBin) {
32
+ console.error('[flopod dev] error: tsx not found — run: npm install -D tsx');
33
+ process.exit(1);
34
+ }
35
+ console.log(`[flopod dev] transpiled ${inputFile}`);
36
+ const proc = spawn(process.execPath, [tsxBin, outFile], {
37
+ stdio: 'inherit',
38
+ cwd: process.cwd(),
39
+ });
40
+ proc.on('exit', code => process.exit(code ?? 0));
41
+ }
42
+ else if (cmd === undefined || cmd === '--help' || cmd === 'help') {
43
+ console.log('Usage:');
44
+ console.log(' flopod dev <entry.ts> Run workflow with live dev UI');
45
+ console.log(' flopod-transpile <in> <out> Transpile only');
46
+ }
47
+ else {
48
+ // Legacy: flopod-transpile <input> <output>
49
+ const [inputFile, outputFile] = [cmd, ...rest];
50
+ if (!inputFile || !outputFile) {
51
+ console.error('Usage: flopod-transpile <input.ts> <output.ts>');
52
+ process.exit(1);
53
+ }
54
+ const source = readFileSync(inputFile, 'utf8');
55
+ const result = transpileSource(source, inputFile);
56
+ mkdirSync(dirname(outputFile), { recursive: true });
57
+ writeFileSync(outputFile, result.code, 'utf8');
58
+ console.log(`Transpiled ${inputFile} → ${outputFile}`);
59
+ console.log(`Activities: ${result.activities.join(', ')}`);
60
+ }
61
+ function findTsx() {
62
+ // Walk up from cwd looking for node_modules/.bin/tsx or node_modules/tsx/dist/cli.mjs
63
+ let dir = process.cwd();
64
+ for (let i = 0; i < 6; i++) {
65
+ const candidate = join(dir, 'node_modules', 'tsx', 'dist', 'cli.mjs');
66
+ try {
67
+ readFileSync(candidate);
68
+ return candidate;
69
+ }
70
+ catch { /* */ }
71
+ const parent = dirname(dir);
72
+ if (parent === dir)
73
+ break;
74
+ dir = parent;
75
+ }
76
+ return null;
77
+ }
78
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,aA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AAC,GAAG,EAAE,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACtE,IAAI,CAAC;YAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAAC,OAAO,SAAS,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,27 @@
1
+ import ts from 'typescript';
2
+ export interface Diagnostic {
3
+ message: string;
4
+ line: number;
5
+ column: number;
6
+ }
7
+ export declare class TranspileError extends Error {
8
+ readonly diagnostics: Diagnostic[];
9
+ constructor(diagnostics: Diagnostic[], fileName: string);
10
+ }
11
+ /**
12
+ * Diagnose all workflow functions in the file.
13
+ *
14
+ * Convention: every non-default top-level function is an activity.
15
+ * The default export is the workflow root.
16
+ *
17
+ * Rules for activities:
18
+ * - Cannot call other activities
19
+ * - Cannot use wf.*
20
+ *
21
+ * Rules for the workflow root:
22
+ * - No try/catch — move into an activity
23
+ * - No setTimeout/setInterval — move into an activity
24
+ * - No await on non-top-level functions — must be top-level to be recorded in the event log
25
+ */
26
+ export declare function diagnoseWorkflowFile(sourceFile: ts.SourceFile, activities: Set<string>): Diagnostic[];
27
+ //# sourceMappingURL=diagnose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnose.d.ts","sourceRoot":"","sources":["../src/diagnose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,cAAe,SAAQ,KAAK;aAErB,WAAW,EAAE,UAAU,EAAE;gBAAzB,WAAW,EAAE,UAAU,EAAE,EACzC,QAAQ,EAAE,MAAM;CAQnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GACtB,UAAU,EAAE,CA2Pd"}
@@ -0,0 +1,253 @@
1
+ import ts from 'typescript';
2
+ export class TranspileError extends Error {
3
+ diagnostics;
4
+ constructor(diagnostics, fileName) {
5
+ const lines = diagnostics
6
+ .map(d => ` ${fileName}:${d.line}:${d.column} ${d.message}`)
7
+ .join('\n');
8
+ super(`Workflow has ${diagnostics.length} error(s):\n\n${lines}\n`);
9
+ this.diagnostics = diagnostics;
10
+ this.name = 'TranspileError';
11
+ }
12
+ }
13
+ /**
14
+ * Diagnose all workflow functions in the file.
15
+ *
16
+ * Convention: every non-default top-level function is an activity.
17
+ * The default export is the workflow root.
18
+ *
19
+ * Rules for activities:
20
+ * - Cannot call other activities
21
+ * - Cannot use wf.*
22
+ *
23
+ * Rules for the workflow root:
24
+ * - No try/catch — move into an activity
25
+ * - No setTimeout/setInterval — move into an activity
26
+ * - No await on non-top-level functions — must be top-level to be recorded in the event log
27
+ */
28
+ export function diagnoseWorkflowFile(sourceFile, activities) {
29
+ const diagnostics = [];
30
+ for (const node of sourceFile.statements) {
31
+ if (!ts.isFunctionDeclaration(node) || !node.body)
32
+ continue;
33
+ const isDefault = !!node.modifiers?.some(m => m.kind === ts.SyntaxKind.DefaultKeyword);
34
+ if (!isDefault) {
35
+ // Leaves: check for cross-activity calls and wf.* access
36
+ ts.forEachChild(node.body, function walkLeaf(child) {
37
+ if (ts.isCallExpression(child)) {
38
+ const callee = child.expression;
39
+ if (ts.isIdentifier(callee) && activities.has(callee.text)) {
40
+ report(child, `${callee.text}() is an activity — activities cannot call other activities. ` +
41
+ `Move this call to the workflow body.`);
42
+ }
43
+ }
44
+ if (ts.isPropertyAccessExpression(child)) {
45
+ const obj = child.expression;
46
+ if (ts.isIdentifier(obj) && obj.text === 'wf') {
47
+ report(child, `wf.${child.name.text}() is not allowed inside an activity — activities are leaves with no access to workflow primitives. ` +
48
+ `Move this call to the workflow body.`);
49
+ }
50
+ }
51
+ ts.forEachChild(child, walkLeaf);
52
+ });
53
+ }
54
+ else {
55
+ // Branch: full workflow rules
56
+ walkBlock(node.body);
57
+ }
58
+ }
59
+ return diagnostics;
60
+ function report(node, message) {
61
+ const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
62
+ diagnostics.push({ message, line: line + 1, column: character + 1 });
63
+ }
64
+ function walkBlock(block, nested = false) {
65
+ for (const stmt of block.statements) {
66
+ walkStatement(stmt, nested);
67
+ }
68
+ }
69
+ function walkStatement(stmt, nested = false) {
70
+ if (ts.isTryStatement(stmt)) {
71
+ report(stmt, 'try/catch is not allowed in the workflow root — move the try/catch into an activity function');
72
+ return;
73
+ }
74
+ // C-style for and for-in are not auto-convertible — keep as errors
75
+ if (ts.isForStatement(stmt) || ts.isForInStatement(stmt)) {
76
+ report(stmt, 'C-style for and for-in loops are not supported in the workflow root — use for...of instead');
77
+ return;
78
+ }
79
+ // for-of, if/else, while — transpiler converts these; recurse to check bodies for real violations
80
+ if (ts.isForOfStatement(stmt)) {
81
+ const body = stmt.statement;
82
+ if (ts.isBlock(body))
83
+ walkBlock(body, true);
84
+ else
85
+ walkStatement(body, true);
86
+ return;
87
+ }
88
+ if (ts.isIfStatement(stmt)) {
89
+ walkIfBranches(stmt);
90
+ return;
91
+ }
92
+ if (ts.isWhileStatement(stmt) || ts.isDoStatement(stmt)) {
93
+ const body = stmt.statement;
94
+ if (ts.isBlock(body))
95
+ walkBlock(body, true);
96
+ else
97
+ walkStatement(body, true);
98
+ return;
99
+ }
100
+ if (ts.isBlock(stmt)) {
101
+ walkBlock(stmt, nested);
102
+ return;
103
+ }
104
+ // Direct (non-awaited) leaf call as a bare statement — result won't be recorded, skipped on replay
105
+ if (ts.isExpressionStatement(stmt) && ts.isCallExpression(stmt.expression)) {
106
+ const callee = stmt.expression.expression;
107
+ if (ts.isIdentifier(callee) && activities.has(callee.text)) {
108
+ report(stmt.expression, `${callee.text}() is an activity — call it with: await wf.activity('${callee.text}', () => ${callee.text}(...))`);
109
+ return;
110
+ }
111
+ }
112
+ ts.forEachChild(stmt, function walk(node) {
113
+ // wf.* callback arrows are safe — the runtime wraps them
114
+ if (ts.isArrowFunction(node) && isInsideWfCall(node))
115
+ return;
116
+ // Non-wf arrow functions or function expressions may contain illegal activity calls
117
+ if (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {
118
+ walkInsideNonWfFn(node);
119
+ return;
120
+ }
121
+ checkNode(node);
122
+ ts.forEachChild(node, walk);
123
+ });
124
+ }
125
+ function walkIfBranches(stmt) {
126
+ const then = stmt.thenStatement;
127
+ if (ts.isBlock(then))
128
+ walkBlock(then, true);
129
+ else
130
+ walkStatement(then, true);
131
+ if (stmt.elseStatement) {
132
+ if (ts.isIfStatement(stmt.elseStatement))
133
+ walkIfBranches(stmt.elseStatement);
134
+ else if (ts.isBlock(stmt.elseStatement))
135
+ walkBlock(stmt.elseStatement, true);
136
+ else
137
+ walkStatement(stmt.elseStatement, true);
138
+ }
139
+ }
140
+ function isInsideWfCall(arrow) {
141
+ const parent = arrow.parent;
142
+ if (!parent || !ts.isCallExpression(parent))
143
+ return false;
144
+ const callee = parent.expression;
145
+ return ts.isPropertyAccessExpression(callee) &&
146
+ ts.isIdentifier(callee.expression) &&
147
+ callee.expression.text === 'wf';
148
+ }
149
+ // Walk inside a non-wf arrow/function-expression and flag any activity calls found there.
150
+ // Activity calls in this context are not durable — the transpiler cannot checkpoint them.
151
+ function walkInsideNonWfFn(fnNode) {
152
+ ts.forEachChild(fnNode, function walk(node) {
153
+ if ((ts.isArrowFunction(node) || ts.isFunctionExpression(node)) && isInsideWfCall(node))
154
+ return;
155
+ if (ts.isAwaitExpression(node)) {
156
+ const inner = node.expression;
157
+ if (ts.isCallExpression(inner) && ts.isIdentifier(inner.expression) && activities.has(inner.expression.text)) {
158
+ report(node, `${inner.expression.text}() is an activity — activity calls inside inline functions are not durable. ` +
159
+ `Move this call to the workflow body directly.`);
160
+ return;
161
+ }
162
+ }
163
+ ts.forEachChild(node, walk);
164
+ });
165
+ }
166
+ function checkNode(node) {
167
+ if (ts.isCallExpression(node)) {
168
+ const expr = node.expression;
169
+ // Activity call used as an argument — nested activities produce invisible intermediate values
170
+ // Exception: parallel(act1(), act2()) is the intended pattern; the transpiler handles it
171
+ const isParallelCall = ts.isIdentifier(expr) && expr.text === 'parallel';
172
+ if (!isParallelCall) {
173
+ for (const arg of node.arguments) {
174
+ const inner = ts.isAwaitExpression(arg) ? arg.expression : arg;
175
+ if (ts.isCallExpression(inner)) {
176
+ const callee = inner.expression;
177
+ if (ts.isIdentifier(callee) && activities.has(callee.text)) {
178
+ report(arg, `${callee.text}() is an activity — nested activity calls are not allowed. ` +
179
+ `Assign to a variable first: const x = await ${callee.text}(...)`);
180
+ }
181
+ }
182
+ }
183
+ }
184
+ // Promise.all([activityFn(), ...]) — activities inside Promise.all are not recorded in the event log
185
+ if (ts.isPropertyAccessExpression(expr) &&
186
+ ts.isIdentifier(expr.expression) &&
187
+ expr.expression.text === 'Promise' &&
188
+ expr.name.text === 'all') {
189
+ const arg = node.arguments[0];
190
+ if (arg && ts.isArrayLiteralExpression(arg)) {
191
+ for (const element of arg.elements) {
192
+ const call = ts.isAwaitExpression(element) ? element.expression : element;
193
+ if (ts.isCallExpression(call)) {
194
+ const callee = call.expression;
195
+ if (ts.isIdentifier(callee) && activities.has(callee.text)) {
196
+ report(element, `${callee.text}() is an activity — Promise.all() does not record activities in the event log. ` +
197
+ `Use parallel() for concurrent activity calls: const [a, b] = await parallel(${callee.text}(...), otherActivity(...))`);
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }
203
+ // Direct identifier calls
204
+ if (ts.isIdentifier(expr)) {
205
+ if (expr.text === 'setTimeout') {
206
+ report(node, 'setTimeout() is not allowed in the workflow root — move it into an activity function');
207
+ }
208
+ if (expr.text === 'setInterval') {
209
+ report(node, 'setInterval() is not allowed in the workflow root — move it into an activity function');
210
+ }
211
+ }
212
+ // console.* calls — side effect that re-runs on every replay
213
+ if (ts.isPropertyAccessExpression(expr) && ts.isIdentifier(expr.expression)) {
214
+ const obj = expr.expression.text;
215
+ const method = expr.name.text;
216
+ if (obj === 'console') {
217
+ report(node, `console.${method}() is a side effect — wrap it in a leaf function: async function log(...) { console.${method}(...) }`);
218
+ }
219
+ // fetch() as property access (e.g. globalThis.fetch)
220
+ if (obj === 'globalThis' && method === 'fetch') {
221
+ report(node, `fetch() is a side effect — move it into a leaf function`);
222
+ }
223
+ }
224
+ // Top-level fetch() call
225
+ if (ts.isIdentifier(expr) && expr.text === 'fetch') {
226
+ report(node, `fetch() is a side effect — move it into a leaf function`);
227
+ }
228
+ }
229
+ // Math.random() — non-deterministic, breaks replay
230
+ if (ts.isCallExpression(node) &&
231
+ ts.isPropertyAccessExpression(node.expression) &&
232
+ ts.isIdentifier(node.expression.expression) &&
233
+ node.expression.expression.text === 'Math' &&
234
+ node.expression.name.text === 'random') {
235
+ report(node, 'Math.random() is non-deterministic — move it into a leaf function');
236
+ }
237
+ if (ts.isAwaitExpression(node)) {
238
+ const inner = node.expression;
239
+ if (ts.isCallExpression(inner)) {
240
+ const callee = inner.expression;
241
+ // await on a non-top-level function — not durable
242
+ if (ts.isIdentifier(callee) && !activities.has(callee.text)) {
243
+ // Allow the compiler-recognized durable builtins: parallel() (fan-out), sleep()
244
+ // (timer), and waitForSignal() (block for an external event).
245
+ if (callee.text === 'parallel' || callee.text === 'sleep' || callee.text === 'waitForSignal')
246
+ return;
247
+ report(node, `await ${callee.text}() — ${callee.text} must be a top-level function to be used in the workflow root`);
248
+ }
249
+ }
250
+ }
251
+ }
252
+ }
253
+ //# sourceMappingURL=diagnose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnose.js","sourceRoot":"","sources":["../src/diagnose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAQ3B,MAAM,OAAO,cAAe,SAAQ,KAAK;IAErB;IADlB,YACkB,WAAyB,EACzC,QAAgB;QAEhB,MAAM,KAAK,GAAG,WAAW;aACtB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;aAC7D,IAAI,CAAC,IAAI,CAAC,CAAA;QACb,KAAK,CAAC,gBAAgB,WAAW,CAAC,MAAM,iBAAiB,KAAK,IAAI,CAAC,CAAA;QANnD,gBAAW,GAAX,WAAW,CAAc;QAOzC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAyB,EACzB,UAAuB;IAEvB,MAAM,WAAW,GAAiB,EAAE,CAAA;IAEpC,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;QACzC,IAAI,CAAC,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,SAAQ;QAC3D,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;QACtF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,yDAAyD;YACzD,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,QAAQ,CAA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AI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,EACtC,CAAC;YACD,MAAM,CAAC,IAAI,EAAE,mEAAmE,CAAC,CAAA;QACnF,CAAC;QAED,IAAI,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAA;YAC7B,IAAI,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAA;gBAC/B,kDAAkD;gBAClD,IAAI,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5D,gFAAgF;oBAChF,8DAA8D;oBAC9D,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe;wBAAE,OAAM;oBACpG,MAAM,CACJ,IAAI,EACJ,SAAS,MAAM,CAAC,IAAI,QAAQ,MAAM,CAAC,IAAI,+DAA+D,CACvG,CAAA;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { transpileSource, transpileViaIR, assembleFromBody, compileToResult, createIRTransformer, getWorkflowMeta } from './transpile.js';
2
+ export type { TranspileResult, CompileResult, Rejection, DevModeOptions, WorkflowMeta } from './transpile.js';
3
+ export { TranspileError } from './diagnose.js';
4
+ export type { Diagnostic } from './diagnose.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC1I,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { transpileSource, transpileViaIR, assembleFromBody, compileToResult, createIRTransformer, getWorkflowMeta } from './transpile.js';
2
+ export { TranspileError } from './diagnose.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE1I,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,109 @@
1
+ import ts from 'typescript';
2
+ import type { LowerErrorCode } from '@flopod/ir';
3
+ export interface TranspileResult {
4
+ code: string;
5
+ activities: string[];
6
+ }
7
+ /**
8
+ * A compile rejection as DATA (never thrown). Unifies the two error sources:
9
+ * - `diagnoseWorkflowFile`'s `Diagnostic` (leaf/branch pre-check — message + loc only), and
10
+ * - the IR's `LowerError` (rich: `code` / `found` / `fix`).
11
+ *
12
+ * Preserving `code`/`found`/`fix` structurally (rather than the flattened string that
13
+ * `TranspileError` carries) is the whole point: it is the agent's tightest feedback loop.
14
+ */
15
+ export interface Rejection {
16
+ code?: LowerErrorCode;
17
+ message: string;
18
+ loc?: {
19
+ line: number;
20
+ column: number;
21
+ };
22
+ found?: string;
23
+ fix?: string;
24
+ }
25
+ export type CompileResult = {
26
+ ok: true;
27
+ code: string;
28
+ activities: string[];
29
+ } | {
30
+ ok: false;
31
+ rejections: Rejection[];
32
+ };
33
+ /**
34
+ * The compile path that **returns data and never throws** — the core function behind
35
+ * `flopod compile` (CLI, for the agent) and the dev server's compile route (HTTP, for the
36
+ * UI). Mirrors `transpileViaIR`'s pipeline (`diagnose → lower → emit → assemble`) but
37
+ * surfaces failures as structured `Rejection[]` with `code`/`found`/`fix` intact, instead
38
+ * of throwing a `TranspileError` that stringifies them.
39
+ */
40
+ export declare function compileToResult(source: string, fileName?: string): CompileResult;
41
+ export interface DevModeOptions {
42
+ runtimeUrl: string;
43
+ devUrl: string;
44
+ port?: number;
45
+ /** True when the operator passed --port explicitly; an occupied port then fails loud instead of roaming. */
46
+ explicitPort?: boolean;
47
+ activityDelayMs?: number;
48
+ /**
49
+ * Production control-plane (`flopod serve`) instead of the local dev tool:
50
+ * headless (no browser), no artificial activity delays, and it does NOT
51
+ * auto-run a default run — it boots the persistent control plane and waits for
52
+ * runs triggered over HTTP. Same durable FileBackend + run-list hydration.
53
+ */
54
+ serve?: boolean;
55
+ }
56
+ /**
57
+ * The default compile path. Routes the supported language through the IR
58
+ * (`transpileViaIR` — `diagnose → lower → emit`), making the IR the execution center.
59
+ *
60
+ * The IR enforces the strict branch-expression algebra (Expr = result-capture only,
61
+ * §5): ternaries, `??`, method chains and spread in the branch are rejected — they belong
62
+ * in leaves (optional chaining `?.` is admitted as a null-safe member read). This is
63
+ * *stricter* than the legacy transpiler (§19#6, decided: adopt strict).
64
+ *
65
+ * Dev mode ([5] Part 2b) also routes through the IR: the runtime runs the IR-emitted
66
+ * durable calls (derived ids) and the static graph is built from `toGraph(IR)` — the same
67
+ * derived ids on both sides, so live status overlays the static nodes by path. Deferred
68
+ * constructs (durable `let`, `while` — §19#2) surface as a `TranspileError`; there is no
69
+ * legacy fallback (§21/§23: legacy deleted, the IR is the only path).
70
+ */
71
+ export declare function transpileSource(source: string, fileName?: string, devMode?: DevModeOptions): TranspileResult;
72
+ /**
73
+ * The IR-routed compile path: `diagnose → lower → emit → assemble`. Produces the same
74
+ * module as `transpileSource`, but the branch is lowered to the IR and emitted from it
75
+ * (the §13 [4] convergence). `diagnose` runs first as the friendly multi-error pre-check
76
+ * (leaf rules + branch hints it owns); `lower`'s structured `LowerError` is mapped into
77
+ * the same `TranspileError` surface so consumers see ONE error type (§19#3 decision).
78
+ */
79
+ export declare function transpileViaIR(source: string, fileName?: string): TranspileResult;
80
+ /**
81
+ * Assemble a full module using a pre-emitted branch body (e.g. from `@flopod/ir`'s
82
+ * `emit`) instead of the AST-rewrite path. Reuses every other part of the module
83
+ * frame (imports, leaf passthrough, runtime setup, input handling, invocation) so
84
+ * the IR path differs from `transpileSource` only in how `main`'s body is produced.
85
+ * This is the seam for routing the transpiler through the IR (docs/flopod-ir.md [4]).
86
+ */
87
+ export declare function assembleFromBody(mainBody: string, source: string, fileName?: string): TranspileResult;
88
+ export interface WorkflowMeta {
89
+ defaultFnName: string | null;
90
+ hasParams: boolean;
91
+ }
92
+ export declare function getWorkflowMeta(source: string, fileName?: string): WorkflowMeta;
93
+ /**
94
+ * Build-path transformer driven by the IR (§23 stage 3). Like `createFlopodTransformer`
95
+ * it returns a `ts.TransformerFactory` that `ts.transpileModule` runs to produce JS +
96
+ * source maps — but the default export's body is no longer rewritten by AST surgery.
97
+ * Instead the branch is lowered to the IR, emitted as durable `wf.*` calls (`emitBranch`),
98
+ * and the emitted statements are spliced in as **synthetic** nodes (positions cleared so
99
+ * the printer emits them structurally, not by slicing the original text). Each top-level
100
+ * emitted statement is given a `setSourceMapRange` back to its original statement position
101
+ * (from `lowerWithProvenance`), and `NoNestedSourceMaps` so its sub-nodes (which carry
102
+ * temp-parse positions) do not emit bogus mappings. TS then generates an accurate
103
+ * JS→original map in one pass — no map composition needed.
104
+ *
105
+ * A `LowerError` (deferred `let`/`while`, §19#2) surfaces as a `TranspileError`, the same
106
+ * single error contract the rest of the compiler uses.
107
+ */
108
+ export declare function createIRTransformer(): ts.TransformerFactory<ts.SourceFile>;
109
+ //# sourceMappingURL=transpile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transpile.d.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IjB;AAgFD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAgB,GAAG,eAAe,CAoBxF;AAaD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,SAAgB,GACvB,eAAe,CASjB;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAgB,GAAG,YAAY,CAMtF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,IAAI,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAAU,CAAC,CA0E1E"}
@@ -0,0 +1,631 @@
1
+ import ts from 'typescript';
2
+ import { createHash } from 'node:crypto';
3
+ import { lowerSource, lowerWithProvenance, emitBranch, toGraph, toBoxTree, LowerError } from '@flopod/ir';
4
+ import { diagnoseWorkflowFile, TranspileError } from './diagnose.js';
5
+ /**
6
+ * Fingerprint of the workflow source. Stamped into the event log so a run can
7
+ * only be resumed by the same code that produced it (see WorkflowCodeChangedError).
8
+ */
9
+ function codeVersionOf(source) {
10
+ return createHash('sha256').update(source).digest('hex').slice(0, 16);
11
+ }
12
+ /**
13
+ * The compile path that **returns data and never throws** — the core function behind
14
+ * `flopod compile` (CLI, for the agent) and the dev server's compile route (HTTP, for the
15
+ * UI). Mirrors `transpileViaIR`'s pipeline (`diagnose → lower → emit → assemble`) but
16
+ * surfaces failures as structured `Rejection[]` with `code`/`found`/`fix` intact, instead
17
+ * of throwing a `TranspileError` that stringifies them.
18
+ */
19
+ export function compileToResult(source, fileName = 'workflow.ts') {
20
+ const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.ES2022, true);
21
+ const activities = collectActivities(sourceFile);
22
+ // 1. friendly pre-check (leaf validation + branch hints) — message + loc, no code/fix
23
+ const diagnostics = diagnoseWorkflowFile(sourceFile, activities);
24
+ if (diagnostics.length > 0) {
25
+ return {
26
+ ok: false,
27
+ rejections: diagnostics.map(d => ({ message: d.message, loc: { line: d.line, column: d.column } })),
28
+ };
29
+ }
30
+ // 2. lower + emit — a LowerError here keeps its structured fields
31
+ let body;
32
+ try {
33
+ body = emitBranch(lowerSource(source, fileName));
34
+ }
35
+ catch (e) {
36
+ if (e instanceof LowerError) {
37
+ return {
38
+ ok: false,
39
+ rejections: [{ code: e.code, message: e.message, loc: e.loc, found: e.found, fix: e.fix }],
40
+ };
41
+ }
42
+ throw e; // not a compile rejection — a real bug; let it surface
43
+ }
44
+ // 3. assemble the full module around the IR-emitted body
45
+ const code = emit(source, sourceFile, activities, undefined, body);
46
+ return { ok: true, code, activities: [...activities] };
47
+ }
48
+ // ── Public API ────────────────────────────────────────────────────────────────
49
+ /**
50
+ * The default compile path. Routes the supported language through the IR
51
+ * (`transpileViaIR` — `diagnose → lower → emit`), making the IR the execution center.
52
+ *
53
+ * The IR enforces the strict branch-expression algebra (Expr = result-capture only,
54
+ * §5): ternaries, `??`, method chains and spread in the branch are rejected — they belong
55
+ * in leaves (optional chaining `?.` is admitted as a null-safe member read). This is
56
+ * *stricter* than the legacy transpiler (§19#6, decided: adopt strict).
57
+ *
58
+ * Dev mode ([5] Part 2b) also routes through the IR: the runtime runs the IR-emitted
59
+ * durable calls (derived ids) and the static graph is built from `toGraph(IR)` — the same
60
+ * derived ids on both sides, so live status overlays the static nodes by path. Deferred
61
+ * constructs (durable `let`, `while` — §19#2) surface as a `TranspileError`; there is no
62
+ * legacy fallback (§21/§23: legacy deleted, the IR is the only path).
63
+ */
64
+ export function transpileSource(source, fileName = 'workflow.ts', devMode) {
65
+ return devMode
66
+ ? transpileDevViaIR(source, fileName, devMode)
67
+ : transpileViaIR(source, fileName);
68
+ }
69
+ /**
70
+ * Dev compile path routed through the IR ([5] Part 2b). Lowers the branch, emits the
71
+ * durable body from the IR (derived ids), and builds the static graph from `toGraph(IR)`
72
+ * — no dry run. A `LowerError` (durable `let`/`while` — §19#2/§21) is mapped to the single
73
+ * `TranspileError` surface so it reaches the operator as a clean "unsupported" message; the
74
+ * legacy fallback is gone (the IR is the only path — §21 decision).
75
+ */
76
+ function transpileDevViaIR(source, fileName, devMode) {
77
+ const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.ES2022, true);
78
+ const activities = collectActivities(sourceFile);
79
+ const diagnostics = diagnoseWorkflowFile(sourceFile, activities);
80
+ if (diagnostics.length > 0)
81
+ throw new TranspileError(diagnostics, fileName);
82
+ let body;
83
+ let staticNodes;
84
+ let boxTree;
85
+ try {
86
+ const ir = lowerSource(source, fileName);
87
+ body = emitBranch(ir);
88
+ staticNodes = buildStaticNodes(ir, sourceFile, source);
89
+ boxTree = buildBoxTree(ir, sourceFile);
90
+ }
91
+ catch (e) {
92
+ if (e instanceof LowerError)
93
+ throw new TranspileError([lowerErrorToDiagnostic(e)], fileName);
94
+ throw e;
95
+ }
96
+ const code = emit(source, sourceFile, activities, devMode, body, staticNodes, boxTree);
97
+ return { code, activities: [...activities] };
98
+ }
99
+ /**
100
+ * Build the dev control-plane's static graph nodes from the IR (the [5] reconciliation:
101
+ * `toGraph` node paths are the runtime template paths, so live events overlay them). JSDoc
102
+ * activity titles/descriptions are merged in by label. Control-flow JSDoc metadata (titles
103
+ * on branch/loop nodes) is not merged — `toGraph` supplies control-node labels directly.
104
+ */
105
+ function buildStaticNodes(ir, sourceFile, source) {
106
+ const activityMeta = extractActivityMeta(sourceFile);
107
+ return toGraph(ir).nodes.map(n => ({
108
+ path: n.path,
109
+ kind: n.kind,
110
+ label: n.label,
111
+ ...(n.varName ? { varName: n.varName } : {}),
112
+ ...(activityMeta.get(n.label) ?? {}),
113
+ }));
114
+ }
115
+ /**
116
+ * Build the dev control-plane's NESTED box tree from the IR (the new designer's structure
117
+ * source — `toBoxTree`). Same template-path ids as `buildStaticNodes`, so live status
118
+ * overlays by path. Activity boxes are decorated with the leaf's JSDoc summary (`title`)
119
+ * and `@description` prose (`doc`) — the "what it's doing" a hover surfaces — which the
120
+ * pure IR arrow can't know (JSDoc lives in the source, not the IR).
121
+ */
122
+ function buildBoxTree(ir, sourceFile) {
123
+ const activityMeta = extractActivityMeta(sourceFile);
124
+ const decorate = (box) => {
125
+ if (box.kind === 'activity') {
126
+ const m = activityMeta.get(box.label);
127
+ if (m?.title)
128
+ box.title = m.title;
129
+ if (m?.description)
130
+ box.doc = m.description;
131
+ }
132
+ box.children.forEach(decorate);
133
+ };
134
+ const tree = toBoxTree(ir);
135
+ tree.body.forEach(decorate);
136
+ return tree;
137
+ }
138
+ /**
139
+ * The IR-routed compile path: `diagnose → lower → emit → assemble`. Produces the same
140
+ * module as `transpileSource`, but the branch is lowered to the IR and emitted from it
141
+ * (the §13 [4] convergence). `diagnose` runs first as the friendly multi-error pre-check
142
+ * (leaf rules + branch hints it owns); `lower`'s structured `LowerError` is mapped into
143
+ * the same `TranspileError` surface so consumers see ONE error type (§19#3 decision).
144
+ */
145
+ export function transpileViaIR(source, fileName = 'workflow.ts') {
146
+ const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.ES2022, true);
147
+ const activities = collectActivities(sourceFile);
148
+ // 1. friendly pre-check (leaf validation + branch hints, all errors at once)
149
+ const diagnostics = diagnoseWorkflowFile(sourceFile, activities);
150
+ if (diagnostics.length > 0)
151
+ throw new TranspileError(diagnostics, fileName);
152
+ // 2. lower the branch to IR and emit durable calls; unify the rejection contract
153
+ let body;
154
+ try {
155
+ body = emitBranch(lowerSource(source, fileName));
156
+ }
157
+ catch (e) {
158
+ if (e instanceof LowerError)
159
+ throw new TranspileError([lowerErrorToDiagnostic(e)], fileName);
160
+ throw e;
161
+ }
162
+ // 3. assemble the full module around the IR-emitted body
163
+ const code = emit(source, sourceFile, activities, undefined, body);
164
+ return { code, activities: [...activities] };
165
+ }
166
+ // Map a structured LowerError into the transpiler's Diagnostic shape so a single
167
+ // error surface (TranspileError) reaches consumers.
168
+ function lowerErrorToDiagnostic(e) {
169
+ const why = e.message.replace(/^\[[A-Z_]+\][^—]*—\s*/, '').split('\n')[0].trim();
170
+ return {
171
+ message: `[${e.code}] ${why}${e.fix ? ` — fix: ${e.fix}` : ''}`,
172
+ line: e.loc?.line ?? 1,
173
+ column: e.loc?.column ?? 1,
174
+ };
175
+ }
176
+ /**
177
+ * Assemble a full module using a pre-emitted branch body (e.g. from `@flopod/ir`'s
178
+ * `emit`) instead of the AST-rewrite path. Reuses every other part of the module
179
+ * frame (imports, leaf passthrough, runtime setup, input handling, invocation) so
180
+ * the IR path differs from `transpileSource` only in how `main`'s body is produced.
181
+ * This is the seam for routing the transpiler through the IR (docs/flopod-ir.md [4]).
182
+ */
183
+ export function assembleFromBody(mainBody, source, fileName = 'workflow.ts') {
184
+ const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.ES2022, true);
185
+ const activities = collectActivities(sourceFile);
186
+ const diagnostics = diagnoseWorkflowFile(sourceFile, activities);
187
+ if (diagnostics.length > 0)
188
+ throw new TranspileError(diagnostics, fileName);
189
+ const code = emit(source, sourceFile, activities, undefined, mainBody);
190
+ return { code, activities: [...activities] };
191
+ }
192
+ export function getWorkflowMeta(source, fileName = 'workflow.ts') {
193
+ const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.ES2022, true);
194
+ return {
195
+ defaultFnName: findDefaultExportName(sourceFile),
196
+ hasParams: defaultExportHasParams(sourceFile),
197
+ };
198
+ }
199
+ /**
200
+ * Build-path transformer driven by the IR (§23 stage 3). Like `createFlopodTransformer`
201
+ * it returns a `ts.TransformerFactory` that `ts.transpileModule` runs to produce JS +
202
+ * source maps — but the default export's body is no longer rewritten by AST surgery.
203
+ * Instead the branch is lowered to the IR, emitted as durable `wf.*` calls (`emitBranch`),
204
+ * and the emitted statements are spliced in as **synthetic** nodes (positions cleared so
205
+ * the printer emits them structurally, not by slicing the original text). Each top-level
206
+ * emitted statement is given a `setSourceMapRange` back to its original statement position
207
+ * (from `lowerWithProvenance`), and `NoNestedSourceMaps` so its sub-nodes (which carry
208
+ * temp-parse positions) do not emit bogus mappings. TS then generates an accurate
209
+ * JS→original map in one pass — no map composition needed.
210
+ *
211
+ * A `LowerError` (deferred `let`/`while`, §19#2) surfaces as a `TranspileError`, the same
212
+ * single error contract the rest of the compiler uses.
213
+ */
214
+ export function createIRTransformer() {
215
+ return (context) => (sourceFile) => {
216
+ const activities = collectActivities(sourceFile);
217
+ const factory = context.factory;
218
+ const diagnostics = diagnoseWorkflowFile(sourceFile, activities);
219
+ if (diagnostics.length > 0)
220
+ throw new TranspileError(diagnostics, sourceFile.fileName);
221
+ let lowered;
222
+ try {
223
+ lowered = lowerWithProvenance(sourceFile.text, sourceFile.fileName);
224
+ }
225
+ catch (e) {
226
+ if (e instanceof LowerError)
227
+ throw new TranspileError([lowerErrorToDiagnostic(e)], sourceFile.fileName);
228
+ throw e;
229
+ }
230
+ const { workflow, prov } = lowered;
231
+ // Parse the emitted durable body into statements (wrapped in a throwaway fn so it is
232
+ // a valid parse), then make every node synthetic so the printer emits structurally.
233
+ const bodyText = emitBranch(workflow);
234
+ const tmp = ts.createSourceFile('body.ts', `async function __m(){\n${bodyText}\n}`, ts.ScriptTarget.ES2022, true);
235
+ const emittedFn = tmp.statements[0];
236
+ const emittedStmts = emittedFn.body ? [...emittedFn.body.statements] : [];
237
+ for (const s of emittedStmts)
238
+ makeSynthetic(s);
239
+ // Map each top-level emitted statement to its source position. emit produces exactly
240
+ // one top-level statement per top-level IR step, in order — so they zip 1:1.
241
+ emittedStmts.forEach((stmt, idx) => {
242
+ const step = workflow.body[idx];
243
+ const sp = step ? prov.get(step) : undefined;
244
+ if (sp)
245
+ ts.setSourceMapRange(stmt, sourceRange(sourceFile, sp));
246
+ ts.setEmitFlags(stmt, ts.EmitFlags.NoNestedSourceMaps);
247
+ });
248
+ // Runtime setup (backend / runId / wf) — never mapped to source.
249
+ const setupStmts = buildSetupStatements(undefined, codeVersionOf(sourceFile.text));
250
+ for (const s of setupStmts)
251
+ ts.setEmitFlags(s, ts.EmitFlags.NoSourceMap);
252
+ const newStatements = [];
253
+ for (const stmt of sourceFile.statements) {
254
+ if (ts.isImportDeclaration(stmt)) {
255
+ const mod = stmt.moduleSpecifier.text;
256
+ if (mod === 'flopod')
257
+ continue;
258
+ newStatements.push(stmt);
259
+ continue;
260
+ }
261
+ if (ts.isFunctionDeclaration(stmt) &&
262
+ stmt.name &&
263
+ stmt.modifiers?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword)) {
264
+ const newBody = factory.createBlock([...setupStmts, ...emittedStmts], true);
265
+ ts.setSourceMapRange(newBody, stmt.body);
266
+ const newFn = factory.createFunctionDeclaration([factory.createToken(ts.SyntaxKind.AsyncKeyword)], undefined, stmt.name, stmt.typeParameters, stmt.parameters, stmt.type, newBody);
267
+ ts.setSourceMapRange(newFn, stmt);
268
+ newStatements.push(newFn);
269
+ continue;
270
+ }
271
+ newStatements.push(stmt);
272
+ }
273
+ return factory.updateSourceFile(sourceFile, newStatements);
274
+ };
275
+ }
276
+ // Recursively clear text positions so the printer treats a parsed node (and its whole
277
+ // subtree) as synthesized — i.e. emits from structure, not by slicing the source text.
278
+ function makeSynthetic(node) {
279
+ ts.setTextRange(node, { pos: -1, end: -1 });
280
+ node.forEachChild(makeSynthetic);
281
+ }
282
+ // A source-map range covering the original statement's line (start → end of that line).
283
+ function sourceRange(sf, sp) {
284
+ const pos = sf.getPositionOfLineAndCharacter(sp.line, sp.column);
285
+ let end = pos;
286
+ try {
287
+ end = sf.getPositionOfLineAndCharacter(sp.line + 1, 0) - 1;
288
+ }
289
+ catch {
290
+ end = sf.text.length;
291
+ }
292
+ return { pos, end };
293
+ }
294
+ function getJsDocText(comment) {
295
+ if (!comment)
296
+ return '';
297
+ if (typeof comment === 'string')
298
+ return comment;
299
+ return comment.map(c => ('text' in c ? c.text : '')).join('');
300
+ }
301
+ function extractActivityMeta(sourceFile) {
302
+ const meta = new Map();
303
+ for (const node of sourceFile.statements) {
304
+ if (!ts.isFunctionDeclaration(node) || !node.name)
305
+ continue;
306
+ if (node.modifiers?.some(m => m.kind === ts.SyntaxKind.DefaultKeyword))
307
+ continue;
308
+ const name = node.name.text;
309
+ const jsdocs = ts.getJSDocCommentsAndTags(node).filter(ts.isJSDoc);
310
+ if (!jsdocs.length)
311
+ continue;
312
+ const jsdoc = jsdocs[jsdocs.length - 1];
313
+ const summaryText = getJsDocText(jsdoc.comment);
314
+ const firstLine = summaryText.split('\n')[0].trim();
315
+ const title = firstLine || undefined;
316
+ const descTag = ts.getJSDocTags(node).find(t => t.tagName.text === 'description');
317
+ const description = descTag ? getJsDocText(descTag.comment).trim() || undefined : undefined;
318
+ if (title || description)
319
+ meta.set(name, { title, description });
320
+ }
321
+ return meta;
322
+ }
323
+ // ── Collect activities (every non-default top-level function) ─────────────────
324
+ function collectActivities(sourceFile) {
325
+ const names = new Set();
326
+ for (const node of sourceFile.statements) {
327
+ if (ts.isFunctionDeclaration(node) &&
328
+ node.name &&
329
+ !node.modifiers?.some(m => m.kind === ts.SyntaxKind.DefaultKeyword)) {
330
+ names.add(node.name.text);
331
+ }
332
+ }
333
+ return names;
334
+ }
335
+ // ── Setup statement builders ──────────────────────────────────────────────────
336
+ function buildSetupStatements(devMode, codeVersion) {
337
+ const factory = ts.factory;
338
+ const runtimeProps = () => {
339
+ const props = [
340
+ factory.createShorthandPropertyAssignment('runId'),
341
+ factory.createShorthandPropertyAssignment('backend'),
342
+ ];
343
+ if (codeVersion) {
344
+ props.push(factory.createPropertyAssignment('codeVersion', factory.createStringLiteral(codeVersion)));
345
+ }
346
+ return props;
347
+ };
348
+ if (devMode) {
349
+ return [
350
+ makeConst('backend', factory.createNewExpression(factory.createIdentifier('NullBackend'), undefined, [])),
351
+ makeConst('runId', factory.createStringLiteral('dev-run')),
352
+ makeConst('wf', factory.createAwaitExpression(factory.createCallExpression(factory.createIdentifier('createRuntime'), undefined, [
353
+ factory.createObjectLiteralExpression(runtimeProps()),
354
+ ]))),
355
+ ];
356
+ }
357
+ // Backend is resolved from the environment so one compiled artifact runs
358
+ // anywhere: no env → SQLite ./workflow.db (local default, unchanged); a
359
+ // DATABASE_URL → managed Postgres (e.g. a DigitalOcean Droplet/App Platform
360
+ // deploy). FLOPOD_BACKEND can force the choice explicitly — e.g. `file` for a
361
+ // dependency-free JSONL log under FLOPOD_DATA_DIR (mount a volume to persist).
362
+ const procEnv = (name) => factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier('process'), 'env'), name);
363
+ const backendSpec = factory.createBinaryExpression(procEnv('FLOPOD_BACKEND'), ts.SyntaxKind.QuestionQuestionToken, factory.createParenthesizedExpression(factory.createConditionalExpression(procEnv('DATABASE_URL'), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createStringLiteral('postgres'), factory.createToken(ts.SyntaxKind.ColonToken), factory.createStringLiteral('sqlite'))));
364
+ const backendOpts = factory.createObjectLiteralExpression([
365
+ factory.createPropertyAssignment('dbPath', factory.createBinaryExpression(procEnv('FLOPOD_DB_PATH'), ts.SyntaxKind.QuestionQuestionToken, factory.createStringLiteral('./workflow.db'))),
366
+ factory.createPropertyAssignment('connectionString', procEnv('DATABASE_URL')),
367
+ factory.createPropertyAssignment('dataDir', procEnv('FLOPOD_DATA_DIR')),
368
+ ], false);
369
+ return [
370
+ makeConst('backend', factory.createAwaitExpression(factory.createCallExpression(factory.createIdentifier('resolveBackend'), undefined, [
371
+ backendSpec,
372
+ backendOpts,
373
+ ]))),
374
+ makeConst('runId', factory.createBinaryExpression(factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier('process'), 'env'), 'FLOPOD_RUN_ID'), ts.SyntaxKind.QuestionQuestionToken, factory.createStringLiteral('main-run'))),
375
+ makeConst('wf', factory.createAwaitExpression(factory.createCallExpression(factory.createIdentifier('createRuntime'), undefined, [
376
+ factory.createObjectLiteralExpression(runtimeProps()),
377
+ ]))),
378
+ ];
379
+ }
380
+ // ── Module assembly (frames the IR-emitted branch body) ───────────────────────
381
+ // Builds the full output module around a pre-emitted `main` body (`mainBodyOverride`,
382
+ // always supplied now that every path routes through the IR). Dev mode embeds the
383
+ // IR-built static graph (`staticNodes`) as a compile-time literal — no dry run.
384
+ function emit(source, sourceFile, activities, devMode, mainBodyOverride, staticNodes, boxTree) {
385
+ const parts = [];
386
+ if (devMode) {
387
+ parts.push(`import { createRuntime, FileBackend, OTelPlugin, STOP } from '${devMode.runtimeUrl}';\n`);
388
+ parts.push(`import { FlopodDevServer } from '${devMode.devUrl}';\n`);
389
+ parts.push(`import { readFileSync } from 'fs';\n`);
390
+ const port = devMode.port ?? 3847;
391
+ // Serve mode is headless with no artificial pacing; dev keeps the animation delay.
392
+ // serve always uses an explicit, deliberate port (containerized) → fail loud, never roam.
393
+ const explicitPort = devMode.serve || devMode.explicitPort;
394
+ const optsParts = devMode.serve
395
+ ? `, openBrowser: false, activityDelayMs: 0, explicitPort: true`
396
+ : `${explicitPort ? `, explicitPort: true` : ''}${devMode.activityDelayMs !== undefined ? `, activityDelayMs: ${devMode.activityDelayMs}` : ''}`;
397
+ // One durable backend shared by every run (keyed internally by runId), so the
398
+ // control plane survives restarts: events persist, and the run list hydrates
399
+ // from backend.listRuns() on startup. FLOPOD_DATA_DIR overrides the location.
400
+ parts.push(`const _backend = new FileBackend();\n`);
401
+ parts.push(`const _devServer = new FlopodDevServer({ port: ${port}${optsParts}, backend: _backend });\n`);
402
+ parts.push(`let _flopodWfFactory;\n`);
403
+ parts.push(`await _devServer.start();\n`);
404
+ }
405
+ else {
406
+ parts.push(`import { createRuntime, SqliteBackend, STOP } from '@flopod/runtime';\n`);
407
+ parts.push(`import { readFileSync } from 'fs';\n`);
408
+ }
409
+ for (const node of sourceFile.statements) {
410
+ if (ts.isImportDeclaration(node)) {
411
+ const mod = node.moduleSpecifier.text;
412
+ if (mod === 'flopod')
413
+ continue;
414
+ parts.push(source.slice(node.getStart(sourceFile), node.getEnd()) + '\n');
415
+ continue;
416
+ }
417
+ if (ts.isFunctionDeclaration(node) && node.name) {
418
+ const isDefault = !!node.modifiers?.some(m => m.kind === ts.SyntaxKind.DefaultKeyword);
419
+ if (isDefault) {
420
+ parts.push(emitMain(source, sourceFile, node, activities, devMode, mainBodyOverride));
421
+ }
422
+ else {
423
+ parts.push(source.slice(node.getStart(sourceFile), node.getEnd()) + '\n');
424
+ }
425
+ continue;
426
+ }
427
+ parts.push(source.slice(node.getStart(sourceFile), node.getEnd()) + '\n');
428
+ }
429
+ const defaultFn = findDefaultExportName(sourceFile);
430
+ if (defaultFn) {
431
+ const hasParams = defaultExportHasParams(sourceFile);
432
+ const port = devMode?.port ?? 3847;
433
+ if (!devMode) {
434
+ parts.push(`\nconsole.log('[flopod] starting run:', process.env.FLOPOD_RUN_ID ?? 'main-run');\n`);
435
+ }
436
+ if (hasParams) {
437
+ // In dev mode a missing input is not fatal — the daemon stays up and the
438
+ // operator starts runs from the control plane instead.
439
+ const noInputLine = devMode
440
+ ? `if (args.length === 0) { return undefined; }`
441
+ : `if (args.length === 0) { console.error('[flopod] error: workflow requires input — pass --input input.json or --key value flags'); process.exit(1); }`;
442
+ parts.push(`const _input = (() => {
443
+ const args = process.argv.slice(2);
444
+ if (args.length === 0 && process.env.FLOPOD_INPUT) return JSON.parse(process.env.FLOPOD_INPUT);
445
+ ${noInputLine}
446
+ const inputIdx = args.indexOf('--input');
447
+ if (inputIdx !== -1) return JSON.parse(readFileSync(args[inputIdx + 1], 'utf8'));
448
+ const obj: Record<string, unknown> = {};
449
+ for (let i = 0; i < args.length; i += 2) {
450
+ const key = args[i].replace(/^--/, '');
451
+ const raw = args[i + 1] ?? 'true';
452
+ try { obj[key] = JSON.parse(raw); } catch { obj[key] = raw; }
453
+ }
454
+ return obj;
455
+ })();\n`);
456
+ }
457
+ if (devMode) {
458
+ const wfName = workflowDisplayName(sourceFile, defaultFn);
459
+ const paramsSpec = hasParams ? extractParamsSpec(sourceFile) : null;
460
+ // Static graph built from the IR at compile time ([5] Part 2b) — `toGraph`'s node
461
+ // paths are the runtime template paths, so live events overlay them by path.
462
+ parts.push(`\n// Static graph from the IR (toGraph) — no dry run needed`);
463
+ parts.push(`const _runId = process.env.FLOPOD_RUN_ID ?? 'dev-run';`);
464
+ parts.push(`const _staticNodes = ${JSON.stringify(staticNodes)};`);
465
+ // Nested box tree (toBoxTree) — the new designer's structure source; same paths as
466
+ // the static nodes, so live status overlays it too.
467
+ parts.push(`const _boxTree = ${JSON.stringify(boxTree)};`);
468
+ parts.push(`\n// Run starter — used for the initial CLI run and for runs started from the control plane`);
469
+ parts.push(`function _flopodStart(runId: string, input: unknown): Promise<void> {`);
470
+ parts.push(` _flopodWfFactory = async () => createRuntime({ runId, backend: _backend, codeVersion: ${JSON.stringify(codeVersionOf(source))}, plugins: [new OTelPlugin({ processors: [_devServer] }), _devServer] });`);
471
+ parts.push(` _devServer.pushStaticGraph(runId, _staticNodes);`);
472
+ parts.push(` _devServer.pushBoxTree(runId, _boxTree);`);
473
+ parts.push(` return _devServer.run(runId, () => ${hasParams ? `${defaultFn}(input as any)` : `${defaultFn}()`}, { input: input ?? null });`);
474
+ parts.push(`}`);
475
+ parts.push(`_devServer.registerWorkflow({ name: ${JSON.stringify(wfName)}, params: ${JSON.stringify(paramsSpec)}, start: _flopodStart });`);
476
+ if (devMode.serve) {
477
+ // A persistent control plane: never auto-run a default run — boot, hydrate
478
+ // the run list, and wait for runs triggered over HTTP (POST /runs). The
479
+ // HTTP server keeps the process alive.
480
+ parts.push(`console.log('[flopod serve] control plane ready → http://localhost:${port}/__flopod (POST /runs to start a run)');\n`);
481
+ }
482
+ else if (hasParams) {
483
+ parts.push(`if (_input === undefined) {`);
484
+ parts.push(` console.log('[flopod dev] no input provided — start a run from the control plane: http://localhost:${port}/__flopod');`);
485
+ parts.push(`} else {`);
486
+ parts.push(` await _flopodStart(_runId, _input);`);
487
+ parts.push(`}\n`);
488
+ }
489
+ else {
490
+ parts.push(`await _flopodStart(_runId, undefined);\n`);
491
+ }
492
+ }
493
+ else {
494
+ if (hasParams) {
495
+ parts.push(`${defaultFn}(_input as any).catch(err => { console.error(err); process.exit(1); });\n`);
496
+ }
497
+ else {
498
+ parts.push(`${defaultFn}().catch(err => { console.error(err); process.exit(1); });\n`);
499
+ }
500
+ }
501
+ }
502
+ return parts.join('\n');
503
+ }
504
+ function emitMain(source, sourceFile, node, activities, devMode, mainBodyOverride) {
505
+ if (!node.body || mainBodyOverride === undefined)
506
+ return '';
507
+ const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
508
+ // Assemble main from the runtime setup + the pre-emitted IR body, then reparse/reprint
509
+ // so the body's formatting is canonical.
510
+ const params = node.parameters.map(p => p.getText(sourceFile)).join(', ');
511
+ const ret = node.type ? `: ${node.type.getText(sourceFile)}` : '';
512
+ const setup = devMode
513
+ ? `const wf = await _flopodWfFactory();\n`
514
+ : `const backend = new SqliteBackend("./workflow.db");\n` +
515
+ `const runId = process.env.FLOPOD_RUN_ID ?? "main-run";\n` +
516
+ `const wf = await createRuntime({ runId, backend, codeVersion: ${JSON.stringify(codeVersionOf(source))} });\n`;
517
+ const mainText = `async function ${node.name.text}(${params})${ret} {\n${setup}${mainBodyOverride}\n}`;
518
+ const tmp = ts.createSourceFile('main.ts', mainText, ts.ScriptTarget.ES2022, true);
519
+ return printer.printNode(ts.EmitHint.Unspecified, tmp.statements[0], tmp) + '\n';
520
+ }
521
+ // ── AST utilities ─────────────────────────────────────────────────────────────
522
+ function findDefaultExportName(sourceFile) {
523
+ for (const node of sourceFile.statements) {
524
+ if (ts.isFunctionDeclaration(node) &&
525
+ node.modifiers?.some(m => m.kind === ts.SyntaxKind.DefaultKeyword) &&
526
+ node.name) {
527
+ return node.name.text;
528
+ }
529
+ }
530
+ return null;
531
+ }
532
+ function defaultExportHasParams(sourceFile) {
533
+ for (const node of sourceFile.statements) {
534
+ if (ts.isFunctionDeclaration(node) &&
535
+ node.modifiers?.some(m => m.kind === ts.SyntaxKind.DefaultKeyword)) {
536
+ return node.parameters.length > 0;
537
+ }
538
+ }
539
+ return false;
540
+ }
541
+ /**
542
+ * Human-facing workflow name for the control plane header. Uses the source file
543
+ * basename; for generic names (main/index) falls back to the project directory
544
+ * (the segment before /src/), then to the default function name.
545
+ */
546
+ function workflowDisplayName(sourceFile, defaultFn) {
547
+ const normalized = sourceFile.fileName.replace(/\\/g, '/');
548
+ const base = (normalized.split('/').pop() ?? '').replace(/\.[^.]+$/, '');
549
+ if (base && base !== 'main' && base !== 'index')
550
+ return base;
551
+ const segments = normalized.split('/');
552
+ const srcIdx = segments.lastIndexOf('src');
553
+ if (srcIdx > 0)
554
+ return segments[srcIdx - 1];
555
+ return base || defaultFn;
556
+ }
557
+ /**
558
+ * Derive a form schema from the default export's first parameter type so the
559
+ * control plane can render a typed start-run form. Supports inline type
560
+ * literals and same-file interfaces/type aliases with primitive members;
561
+ * anything more complex degrades to a single JSON field.
562
+ */
563
+ function extractParamsSpec(sourceFile) {
564
+ let fn;
565
+ for (const node of sourceFile.statements) {
566
+ if (ts.isFunctionDeclaration(node) && node.modifiers?.some(m => m.kind === ts.SyntaxKind.DefaultKeyword)) {
567
+ fn = node;
568
+ break;
569
+ }
570
+ }
571
+ if (!fn || fn.parameters.length === 0)
572
+ return null;
573
+ const param = fn.parameters[0];
574
+ const fallbackName = ts.isIdentifier(param.name) ? param.name.text : 'input';
575
+ const fallback = [{ name: fallbackName, type: 'json', required: !param.questionToken }];
576
+ let members = null;
577
+ const typeNode = param.type;
578
+ if (!typeNode)
579
+ return fallback;
580
+ if (ts.isTypeLiteralNode(typeNode)) {
581
+ members = typeNode.members;
582
+ }
583
+ else if (ts.isTypeReferenceNode(typeNode) && ts.isIdentifier(typeNode.typeName)) {
584
+ const refName = typeNode.typeName.text;
585
+ for (const st of sourceFile.statements) {
586
+ if (ts.isInterfaceDeclaration(st) && st.name.text === refName) {
587
+ members = st.members;
588
+ break;
589
+ }
590
+ if (ts.isTypeAliasDeclaration(st) && st.name.text === refName && ts.isTypeLiteralNode(st.type)) {
591
+ members = st.type.members;
592
+ break;
593
+ }
594
+ }
595
+ }
596
+ if (!members)
597
+ return fallback;
598
+ const specs = [];
599
+ for (const m of members) {
600
+ if (!ts.isPropertySignature(m) || !m.name || !m.type)
601
+ continue;
602
+ const name = ts.isIdentifier(m.name) || ts.isStringLiteral(m.name) ? m.name.text : m.name.getText(sourceFile);
603
+ specs.push({ name, required: !m.questionToken, ...mapParamType(m.type) });
604
+ }
605
+ return specs.length > 0 ? specs : fallback;
606
+ }
607
+ function mapParamType(t) {
608
+ switch (t.kind) {
609
+ case ts.SyntaxKind.StringKeyword: return { type: 'string' };
610
+ case ts.SyntaxKind.NumberKeyword: return { type: 'number' };
611
+ case ts.SyntaxKind.BooleanKeyword: return { type: 'boolean' };
612
+ }
613
+ if (ts.isUnionTypeNode(t)) {
614
+ const options = [];
615
+ for (const member of t.types) {
616
+ if (ts.isLiteralTypeNode(member) && ts.isStringLiteral(member.literal)) {
617
+ options.push(member.literal.text);
618
+ }
619
+ else {
620
+ return { type: 'json' };
621
+ }
622
+ }
623
+ if (options.length > 0)
624
+ return { type: 'enum', options };
625
+ }
626
+ return { type: 'json' };
627
+ }
628
+ function makeConst(name, init) {
629
+ return ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([ts.factory.createVariableDeclaration(name, undefined, undefined, init)], ts.NodeFlags.Const));
630
+ }
631
+ //# sourceMappingURL=transpile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transpile.js","sourceRoot":"","sources":["../src/transpile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1G,OAAO,EAAE,oBAAoB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;gBACvE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,IAAmB;IAClD,OAAO,EAAE,CAAC,OAAO,CAAC,uBAAuB,CACvC,SAAS,EACT,EAAE,CAAC,OAAO,CAAC,6BAA6B,CACtC,CAAC,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,EACxE,EAAE,CAAC,SAAS,CAAC,KAAK,CACnB,CACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@flopod/compiler",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "bin": {
18
+ "flopod-compile": "./dist/cli.js"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "test": "vitest run"
23
+ },
24
+ "dependencies": {
25
+ "@flopod/ir": "^0.1.0",
26
+ "typescript": "^5.5.0"
27
+ },
28
+ "devDependencies": {
29
+ "@flopod/runtime": "^0.1.0",
30
+ "@types/node": "^22.0.0"
31
+ }
32
+ }