@bubblelab/bubble-runtime 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/LICENSE.txt +202 -0
- package/dist/extraction/BubbleParser.d.ts +80 -0
- package/dist/extraction/BubbleParser.d.ts.map +1 -0
- package/dist/extraction/BubbleParser.js +926 -0
- package/dist/extraction/BubbleParser.js.map +1 -0
- package/dist/extraction/index.d.ts +2 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +4 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/injection/BubbleInjector.d.ts +71 -0
- package/dist/injection/BubbleInjector.d.ts.map +1 -0
- package/dist/injection/BubbleInjector.js +326 -0
- package/dist/injection/BubbleInjector.js.map +1 -0
- package/dist/injection/LoggerInjector.d.ts +33 -0
- package/dist/injection/LoggerInjector.d.ts.map +1 -0
- package/dist/injection/LoggerInjector.js +154 -0
- package/dist/injection/LoggerInjector.js.map +1 -0
- package/dist/injection/index.d.ts +3 -0
- package/dist/injection/index.d.ts.map +1 -0
- package/dist/injection/index.js +3 -0
- package/dist/injection/index.js.map +1 -0
- package/dist/parse/BubbleScript.d.ts +141 -0
- package/dist/parse/BubbleScript.d.ts.map +1 -0
- package/dist/parse/BubbleScript.js +513 -0
- package/dist/parse/BubbleScript.js.map +1 -0
- package/dist/parse/index.d.ts +3 -0
- package/dist/parse/index.d.ts.map +1 -0
- package/dist/parse/index.js +3 -0
- package/dist/parse/index.js.map +1 -0
- package/dist/parse/traceDependencies.d.ts +18 -0
- package/dist/parse/traceDependencies.d.ts.map +1 -0
- package/dist/parse/traceDependencies.js +181 -0
- package/dist/parse/traceDependencies.js.map +1 -0
- package/dist/runtime/BubbleRunner.d.ts +91 -0
- package/dist/runtime/BubbleRunner.d.ts.map +1 -0
- package/dist/runtime/BubbleRunner.js +586 -0
- package/dist/runtime/BubbleRunner.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/types.d.ts +29 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/bubble-helper.d.ts +11 -0
- package/dist/utils/bubble-helper.d.ts.map +1 -0
- package/dist/utils/bubble-helper.js +15 -0
- package/dist/utils/bubble-helper.js.map +1 -0
- package/dist/utils/parameter-formatter.d.ts +22 -0
- package/dist/utils/parameter-formatter.d.ts.map +1 -0
- package/dist/utils/parameter-formatter.js +219 -0
- package/dist/utils/parameter-formatter.js.map +1 -0
- package/dist/validation/BubbleValidator.d.ts +43 -0
- package/dist/validation/BubbleValidator.d.ts.map +1 -0
- package/dist/validation/BubbleValidator.js +172 -0
- package/dist/validation/BubbleValidator.js.map +1 -0
- package/dist/validation/index.d.ts +27 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +126 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import { BubbleLogger, LogLevel, } from '@bubblelab/bubble-core';
|
|
2
|
+
import { StreamingBubbleLogger } from '@bubblelab/bubble-core';
|
|
3
|
+
import { BubbleValidationError, BubbleExecutionError, BubbleError, } from '@bubblelab/bubble-core';
|
|
4
|
+
import { BubbleScript } from 'src/parse/BubbleScript';
|
|
5
|
+
import { BubbleInjector } from 'src/injection/BubbleInjector';
|
|
6
|
+
import { pathToFileURL } from 'url';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import fs from 'fs/promises';
|
|
9
|
+
import { existsSync } from 'fs';
|
|
10
|
+
export class BubbleRunner {
|
|
11
|
+
// Bubble script
|
|
12
|
+
// Bubble factory
|
|
13
|
+
// @ts-expect-error - Not implemented
|
|
14
|
+
bubbleFactory;
|
|
15
|
+
bubbleScript;
|
|
16
|
+
// @ts-expect-error - Not implemented
|
|
17
|
+
currentStep;
|
|
18
|
+
// @ts-expect-error - Not implemented
|
|
19
|
+
savedStates; // Callback function and logger for execution context
|
|
20
|
+
plan = null;
|
|
21
|
+
logger;
|
|
22
|
+
injector;
|
|
23
|
+
options;
|
|
24
|
+
constructor(bubbleScript, bubbleFactory, options = {}) {
|
|
25
|
+
this.bubbleScript =
|
|
26
|
+
typeof bubbleScript === 'string'
|
|
27
|
+
? new BubbleScript(bubbleScript, bubbleFactory)
|
|
28
|
+
: bubbleScript;
|
|
29
|
+
this.currentStep = 0;
|
|
30
|
+
this.savedStates = null;
|
|
31
|
+
this.bubbleFactory = bubbleFactory;
|
|
32
|
+
this.injector = new BubbleInjector(this.bubbleScript);
|
|
33
|
+
this.options = {
|
|
34
|
+
enableLogging: true,
|
|
35
|
+
logLevel: LogLevel.DEBUG, // Changed to DEBUG to see debug logs
|
|
36
|
+
enableLineByLineLogging: true,
|
|
37
|
+
enableBubbleLogging: true,
|
|
38
|
+
...options,
|
|
39
|
+
};
|
|
40
|
+
// Initialize logger if enabled
|
|
41
|
+
if (this.options.streamCallback) {
|
|
42
|
+
// Use streaming logger when stream callback is provided
|
|
43
|
+
this.logger = new StreamingBubbleLogger('BubbleFlow', {
|
|
44
|
+
minLevel: this.options.logLevel || LogLevel.INFO,
|
|
45
|
+
enableTiming: true,
|
|
46
|
+
enableMemoryTracking: true,
|
|
47
|
+
streamCallback: this.options.streamCallback,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Use regular logger
|
|
52
|
+
this.logger = new BubbleLogger('BubbleFlow', {
|
|
53
|
+
minLevel: this.options.logLevel || LogLevel.INFO,
|
|
54
|
+
enableTiming: true,
|
|
55
|
+
enableMemoryTracking: true,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
this.plan = this.buildExecutionPlan();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a list of steps where length = number of parsed bubbles
|
|
62
|
+
* Contains the bubble and parameters to run
|
|
63
|
+
* Each step represents a continuous line range (e.g., line 1-20, 21-xxx)
|
|
64
|
+
*/
|
|
65
|
+
buildExecutionPlan() {
|
|
66
|
+
const steps = [];
|
|
67
|
+
const parsedBubbles = this.bubbleScript.getParsedBubbles();
|
|
68
|
+
const scopeManager = this.bubbleScript.getScopeManager();
|
|
69
|
+
// Get all bubbles sorted by line start
|
|
70
|
+
const bubbleEntries = Object.entries(parsedBubbles)
|
|
71
|
+
.map(([varName, bubble]) => ({ varName, ...bubble }))
|
|
72
|
+
.sort((a, b) => a.location.startLine - b.location.startLine);
|
|
73
|
+
if (bubbleEntries.length === 0) {
|
|
74
|
+
return { steps: [] };
|
|
75
|
+
}
|
|
76
|
+
// Find script boundaries
|
|
77
|
+
const firstBubbleLine = bubbleEntries[0].location.startLine;
|
|
78
|
+
const lastBubbleLine = bubbleEntries[bubbleEntries.length - 1].location.endLine;
|
|
79
|
+
const ast = this.bubbleScript.getAST();
|
|
80
|
+
const fileEndLine = ast.loc?.end.line || lastBubbleLine;
|
|
81
|
+
// Find control flow structures from scope manager
|
|
82
|
+
const controlScopes = scopeManager.scopes.filter((scope) => ['for', 'while', 'if', 'block'].includes(scope.type) &&
|
|
83
|
+
scope.block.loc?.start.line &&
|
|
84
|
+
scope.block.loc?.end.line);
|
|
85
|
+
// 1. Setup step (before first bubble)
|
|
86
|
+
if (firstBubbleLine > 1) {
|
|
87
|
+
steps.push({
|
|
88
|
+
id: 'setup',
|
|
89
|
+
type: 'setup',
|
|
90
|
+
startLine: 1,
|
|
91
|
+
endLine: firstBubbleLine - 1,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// 2. Process bubbles - group by containing control structures
|
|
95
|
+
const processedBubbles = new Set();
|
|
96
|
+
for (const controlScope of controlScopes) {
|
|
97
|
+
const scopeStart = controlScope.block.loc.start.line;
|
|
98
|
+
const scopeEnd = controlScope.block.loc.end.line;
|
|
99
|
+
// Find bubbles within this control structure
|
|
100
|
+
const bubblesInScope = bubbleEntries.filter((bubble) => bubble.location.startLine >= scopeStart &&
|
|
101
|
+
bubble.location.endLine <= scopeEnd &&
|
|
102
|
+
!processedBubbles.has(bubble.varName));
|
|
103
|
+
if (bubblesInScope.length > 0) {
|
|
104
|
+
// Create control flow step with mini-steps for each bubble
|
|
105
|
+
const miniSteps = [];
|
|
106
|
+
for (const bubble of bubblesInScope) {
|
|
107
|
+
// Bubble instantiation mini-step
|
|
108
|
+
miniSteps.push({
|
|
109
|
+
id: `${bubble.className}_new_${bubble.location.startLine}_${bubble.location.endLine}`,
|
|
110
|
+
type: 'bubble_instantiation',
|
|
111
|
+
startLine: bubble.location.startLine,
|
|
112
|
+
endLine: bubble.location.endLine,
|
|
113
|
+
operation: {
|
|
114
|
+
type: 'new_bubble',
|
|
115
|
+
bubbleName: bubble.className,
|
|
116
|
+
variableName: bubble.varName,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
// Bubble execution mini-step (find .action() call)
|
|
120
|
+
const actionLine = this.findActionCallLine({
|
|
121
|
+
varName: bubble.varName,
|
|
122
|
+
lineEnd: bubble.location.endLine,
|
|
123
|
+
});
|
|
124
|
+
miniSteps.push({
|
|
125
|
+
id: `${bubble.className}_action_${actionLine}_${actionLine}`,
|
|
126
|
+
type: 'bubble_execution',
|
|
127
|
+
startLine: actionLine,
|
|
128
|
+
endLine: actionLine,
|
|
129
|
+
operation: {
|
|
130
|
+
type: 'await_action',
|
|
131
|
+
variableName: bubble.varName,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
processedBubbles.add(bubble.varName);
|
|
135
|
+
}
|
|
136
|
+
steps.push({
|
|
137
|
+
id: `${controlScope.type}_${scopeStart}_${scopeEnd}`,
|
|
138
|
+
type: 'control_flow',
|
|
139
|
+
startLine: scopeStart,
|
|
140
|
+
endLine: scopeEnd,
|
|
141
|
+
controlType: controlScope.type,
|
|
142
|
+
miniSteps,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// 3. Individual steps for bubbles outside control structures
|
|
147
|
+
for (const bubble of bubbleEntries) {
|
|
148
|
+
if (!processedBubbles.has(bubble.varName)) {
|
|
149
|
+
const actionLine = this.findActionCallLine({
|
|
150
|
+
varName: bubble.varName,
|
|
151
|
+
lineEnd: bubble.location.endLine,
|
|
152
|
+
});
|
|
153
|
+
steps.push({
|
|
154
|
+
id: `${bubble.varName}_${bubble.location.startLine}_${bubble.location.endLine}`,
|
|
155
|
+
type: 'bubble_block',
|
|
156
|
+
startLine: bubble.location.startLine,
|
|
157
|
+
endLine: Math.max(bubble.location.endLine, actionLine),
|
|
158
|
+
miniSteps: [
|
|
159
|
+
{
|
|
160
|
+
id: `${bubble.className}_new_${bubble.location.startLine}_${bubble.location.endLine}`,
|
|
161
|
+
type: 'bubble_instantiation',
|
|
162
|
+
startLine: bubble.location.startLine,
|
|
163
|
+
endLine: bubble.location.endLine,
|
|
164
|
+
operation: {
|
|
165
|
+
type: 'new_bubble',
|
|
166
|
+
bubbleName: bubble.className,
|
|
167
|
+
variableName: bubble.varName,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: `${bubble.className}_action_${actionLine}_${actionLine}`,
|
|
172
|
+
type: 'bubble_execution',
|
|
173
|
+
startLine: actionLine,
|
|
174
|
+
endLine: actionLine,
|
|
175
|
+
operation: {
|
|
176
|
+
type: 'await_action',
|
|
177
|
+
variableName: bubble.varName,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// 4. Finalization step (after last bubble)
|
|
185
|
+
if (lastBubbleLine < fileEndLine) {
|
|
186
|
+
steps.push({
|
|
187
|
+
id: 'finalization',
|
|
188
|
+
type: 'finalization',
|
|
189
|
+
startLine: lastBubbleLine + 1,
|
|
190
|
+
endLine: fileEndLine,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
// Sort steps by start line
|
|
194
|
+
steps.sort((a, b) => a.startLine - b.startLine);
|
|
195
|
+
return { steps };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Find the line where .action() is called for a bubble
|
|
199
|
+
* Uses AST to locate the method call
|
|
200
|
+
*/
|
|
201
|
+
findActionCallLine(bubble) {
|
|
202
|
+
const ast = this.bubbleScript.getAST();
|
|
203
|
+
// Traverse AST to find .action() calls for this variable
|
|
204
|
+
const actionLine = this.findActionCallInAST(ast, bubble.varName);
|
|
205
|
+
// Fallback to estimation if not found
|
|
206
|
+
return actionLine || bubble.lineEnd + 2;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Recursively search AST for .action() calls on a specific variable
|
|
210
|
+
*/
|
|
211
|
+
findActionCallInAST(node, variableName) {
|
|
212
|
+
// Check if this is a call expression with property access
|
|
213
|
+
if (node.type === 'CallExpression' &&
|
|
214
|
+
node.callee?.type === 'MemberExpression') {
|
|
215
|
+
const memberExpr = node.callee;
|
|
216
|
+
// Check if it's variableName.action()
|
|
217
|
+
if (memberExpr.object?.type === 'Identifier' &&
|
|
218
|
+
memberExpr.object.name === variableName &&
|
|
219
|
+
memberExpr.property?.type === 'Identifier' &&
|
|
220
|
+
memberExpr.property.name === 'action') {
|
|
221
|
+
return node.loc?.start.line || null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Check if this is an await expression wrapping an action call
|
|
225
|
+
if (node.type === 'AwaitExpression' && node.argument) {
|
|
226
|
+
const actionLine = this.findActionCallInAST(node.argument, variableName);
|
|
227
|
+
if (actionLine)
|
|
228
|
+
return actionLine;
|
|
229
|
+
}
|
|
230
|
+
// Recursively search child nodes
|
|
231
|
+
if (node.body) {
|
|
232
|
+
for (const child of Array.isArray(node.body) ? node.body : [node.body]) {
|
|
233
|
+
const result = this.findActionCallInAST(child, variableName);
|
|
234
|
+
if (result)
|
|
235
|
+
return result;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
// Handle other node types that might contain children
|
|
239
|
+
const childKeys = [
|
|
240
|
+
'body',
|
|
241
|
+
'statements',
|
|
242
|
+
'expression',
|
|
243
|
+
'consequent',
|
|
244
|
+
'alternate',
|
|
245
|
+
'init',
|
|
246
|
+
'test',
|
|
247
|
+
'update',
|
|
248
|
+
];
|
|
249
|
+
for (const key of childKeys) {
|
|
250
|
+
if (node[key]) {
|
|
251
|
+
const child = node[key];
|
|
252
|
+
if (Array.isArray(child)) {
|
|
253
|
+
for (const item of child) {
|
|
254
|
+
const result = this.findActionCallInAST(item, variableName);
|
|
255
|
+
if (result)
|
|
256
|
+
return result;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
const result = this.findActionCallInAST(child, variableName);
|
|
261
|
+
if (result)
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
getParsedBubbles() {
|
|
269
|
+
return this.bubbleScript.getParsedBubbles();
|
|
270
|
+
}
|
|
271
|
+
getVariables() {
|
|
272
|
+
return this.bubbleScript.getAllUserVariables();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Finds step ID, calls memorizes results on previous bubbles, and runs the script from 1 to line end
|
|
276
|
+
*/
|
|
277
|
+
// @ts-expect-error - Not implemented
|
|
278
|
+
runStep(stepId) {
|
|
279
|
+
// No implementation
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Run from step 1 to end
|
|
283
|
+
*/
|
|
284
|
+
async runAll(payload) {
|
|
285
|
+
let tempFilePath = null;
|
|
286
|
+
console.log('Running all');
|
|
287
|
+
try {
|
|
288
|
+
this.logger?.info('Starting BubbleFlow execution');
|
|
289
|
+
// Inject logging into the script if enabled
|
|
290
|
+
let scriptToExecute = this.bubbleScript.bubblescript;
|
|
291
|
+
if (this.options.enableLogging && this.logger) {
|
|
292
|
+
this.injector.injectBubbleLoggingAndReinitializeBubbleParameters();
|
|
293
|
+
scriptToExecute = this.bubbleScript.bubblescript;
|
|
294
|
+
console.log('[BubbleRunner] scriptToExecute:', scriptToExecute);
|
|
295
|
+
}
|
|
296
|
+
// Create a temporary file with the bubble script code in the project directory
|
|
297
|
+
// This ensures proper module resolution for @nodex packages
|
|
298
|
+
const projectRoot = this.findProjectRoot();
|
|
299
|
+
const tempDir = path.join(projectRoot, '.tmp');
|
|
300
|
+
console.log('[BubbleRunner] projectRoot:', projectRoot);
|
|
301
|
+
console.log('[BubbleRunner] tempDir:', tempDir);
|
|
302
|
+
// Ensure temp directory exists
|
|
303
|
+
try {
|
|
304
|
+
await fs.mkdir(tempDir, { recursive: true });
|
|
305
|
+
console.log('[BubbleRunner] Ensured tempDir exists');
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
// Directory might already exist, that's okay
|
|
309
|
+
console.warn('[BubbleRunner] mkdir tempDir warning:', error);
|
|
310
|
+
}
|
|
311
|
+
const tempFileName = `bubble-script-${Date.now()}-${Math.random().toString(36).substring(7)}.ts`;
|
|
312
|
+
tempFilePath = path.join(tempDir, tempFileName);
|
|
313
|
+
console.log('[BubbleRunner] tempFilePath:', tempFilePath);
|
|
314
|
+
// Write the script code to the temporary file
|
|
315
|
+
try {
|
|
316
|
+
console.log('[BubbleRunner] About to write script to temp file. Script length:', scriptToExecute?.length);
|
|
317
|
+
await fs.writeFile(tempFilePath, scriptToExecute);
|
|
318
|
+
const stat = await fs.stat(tempFilePath);
|
|
319
|
+
console.log('[BubbleRunner] Wrote temp file. Size:', stat.size);
|
|
320
|
+
}
|
|
321
|
+
catch (writeErr) {
|
|
322
|
+
console.error('[BubbleRunner] Failed to write temp file:', writeErr);
|
|
323
|
+
throw writeErr;
|
|
324
|
+
}
|
|
325
|
+
// Convert to file URL for dynamic import
|
|
326
|
+
const moduleUrl = pathToFileURL(tempFilePath).href;
|
|
327
|
+
console.log('[BubbleRunner] moduleUrl:', moduleUrl);
|
|
328
|
+
try {
|
|
329
|
+
const exists = await fs
|
|
330
|
+
.access(tempFilePath)
|
|
331
|
+
.then(() => true)
|
|
332
|
+
.catch(() => false);
|
|
333
|
+
console.log('[BubbleRunner] temp file exists before import:', exists);
|
|
334
|
+
}
|
|
335
|
+
catch (accessErr) {
|
|
336
|
+
console.warn('[BubbleRunner] access check failed:', accessErr);
|
|
337
|
+
}
|
|
338
|
+
// Dynamically import the module
|
|
339
|
+
console.log('[BubbleRunner] Importing module', moduleUrl);
|
|
340
|
+
let module;
|
|
341
|
+
try {
|
|
342
|
+
module = await import(moduleUrl);
|
|
343
|
+
}
|
|
344
|
+
catch (importErr) {
|
|
345
|
+
console.error('[BubbleRunner] Dynamic import failed:', importErr);
|
|
346
|
+
// Optionally dump first 300 chars of script to help debug syntax errors
|
|
347
|
+
const preview = (scriptToExecute ?? '').slice(0, 300);
|
|
348
|
+
console.error('[BubbleRunner] Script preview (first 300 chars):', preview);
|
|
349
|
+
throw importErr;
|
|
350
|
+
}
|
|
351
|
+
console.log('[BubbleRunner] Done importing module');
|
|
352
|
+
// Find the BubbleFlow class in the module exports
|
|
353
|
+
const FlowClass = this.findBubbleFlowClass(module);
|
|
354
|
+
if (!FlowClass) {
|
|
355
|
+
throw new Error('No BubbleFlow class found in the module exports');
|
|
356
|
+
}
|
|
357
|
+
// Create default webhook payload if none provided
|
|
358
|
+
const webhookPayload = {
|
|
359
|
+
type: 'webhook/http',
|
|
360
|
+
timestamp: new Date().toISOString(),
|
|
361
|
+
path: '/webhook',
|
|
362
|
+
body: {},
|
|
363
|
+
...payload,
|
|
364
|
+
};
|
|
365
|
+
// Instantiate the flow class with logger
|
|
366
|
+
// Note: We need to determine the constructor parameters from the class
|
|
367
|
+
const flowInstance = this.instantiateFlowClass(FlowClass);
|
|
368
|
+
// Ensure the logger is set on the flow instance
|
|
369
|
+
if (this.logger) {
|
|
370
|
+
if (typeof flowInstance.setLogger === 'function') {
|
|
371
|
+
flowInstance.setLogger(this.logger);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
// Fallback: directly set the logger property if setLogger method doesn't exist
|
|
375
|
+
flowInstance.logger = this.logger;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// Execute the handle method
|
|
379
|
+
const startTime = Date.now();
|
|
380
|
+
const result = await flowInstance.handle(webhookPayload);
|
|
381
|
+
const executionTime = Date.now() - startTime;
|
|
382
|
+
this.logger?.info(`BubbleFlow execution completed in ${executionTime}ms`, {
|
|
383
|
+
additionalData: { executionTime, result },
|
|
384
|
+
});
|
|
385
|
+
// Log execution completion for streaming
|
|
386
|
+
if (this.logger instanceof StreamingBubbleLogger) {
|
|
387
|
+
this.logger.logExecutionComplete(true, result);
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
executionId: 0,
|
|
391
|
+
success: true,
|
|
392
|
+
error: '',
|
|
393
|
+
summary: this.logger.getExecutionSummary(),
|
|
394
|
+
data: result,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
catch (error) {
|
|
398
|
+
// Enhanced error handling for bubble-specific errors
|
|
399
|
+
if (error instanceof BubbleValidationError) {
|
|
400
|
+
this.logger?.fatal(`Bubble validation failed: ${error.message}`, error, {
|
|
401
|
+
variableId: error.variableId,
|
|
402
|
+
bubbleName: error.bubbleName,
|
|
403
|
+
additionalData: {
|
|
404
|
+
validationErrors: error.validationErrors,
|
|
405
|
+
variableId: error.variableId,
|
|
406
|
+
bubbleName: error.bubbleName,
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
// Log execution failure for streaming
|
|
410
|
+
if (this.logger instanceof StreamingBubbleLogger) {
|
|
411
|
+
this.logger.logExecutionComplete(false, undefined, `Bubble validation failed at ${error.bubbleName} (variableId: ${error.variableId}): ${error.message}`);
|
|
412
|
+
}
|
|
413
|
+
return {
|
|
414
|
+
executionId: 0,
|
|
415
|
+
success: false,
|
|
416
|
+
summary: this.logger.getExecutionSummary(),
|
|
417
|
+
error: `Bubble validation failed at ${error.bubbleName} (variableId: ${error.variableId}): ${error.message}`,
|
|
418
|
+
data: undefined,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
else if (error instanceof BubbleExecutionError) {
|
|
422
|
+
this.logger?.fatal(`Bubble execution failed: ${error.message}`, error, {
|
|
423
|
+
variableId: error.variableId,
|
|
424
|
+
bubbleName: error.bubbleName,
|
|
425
|
+
additionalData: {
|
|
426
|
+
executionPhase: error.executionPhase,
|
|
427
|
+
variableId: error.variableId,
|
|
428
|
+
bubbleName: error.bubbleName,
|
|
429
|
+
},
|
|
430
|
+
});
|
|
431
|
+
// Log execution failure for streaming
|
|
432
|
+
if (this.logger instanceof StreamingBubbleLogger) {
|
|
433
|
+
this.logger.logExecutionComplete(false, undefined, `Bubble execution failed at ${error.bubbleName} (variableId: ${error.variableId}): ${error.message}`);
|
|
434
|
+
}
|
|
435
|
+
return {
|
|
436
|
+
executionId: 0,
|
|
437
|
+
success: false,
|
|
438
|
+
summary: this.logger.getExecutionSummary(),
|
|
439
|
+
error: `Bubble execution failed at ${error.bubbleName} (variableId: ${error.variableId}): ${error.message}`,
|
|
440
|
+
data: undefined,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
else if (error instanceof BubbleError) {
|
|
444
|
+
// Generic bubble error
|
|
445
|
+
this.logger?.fatal(`Bubble error: ${error.message}`, error, {
|
|
446
|
+
variableId: error.variableId,
|
|
447
|
+
bubbleName: error.bubbleName,
|
|
448
|
+
additionalData: {
|
|
449
|
+
variableId: error.variableId,
|
|
450
|
+
bubbleName: error.bubbleName,
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
// Log execution failure for streaming
|
|
454
|
+
if (this.logger instanceof StreamingBubbleLogger) {
|
|
455
|
+
this.logger.logExecutionComplete(false, undefined, `Bubble error at ${error.bubbleName} (variableId: ${error.variableId}): ${error.message}`);
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
executionId: 0,
|
|
459
|
+
summary: this.logger.getExecutionSummary(),
|
|
460
|
+
success: false,
|
|
461
|
+
error: `Bubble error at ${error.bubbleName} (variableId: ${error.variableId}): ${error.message}`,
|
|
462
|
+
data: undefined,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
// Generic error fallback
|
|
467
|
+
this.logger?.fatal('BubbleFlow execution failed', error instanceof Error ? error : undefined);
|
|
468
|
+
// Log execution failure for streaming
|
|
469
|
+
if (this.logger instanceof StreamingBubbleLogger) {
|
|
470
|
+
this.logger.logExecutionComplete(false, undefined, error.message);
|
|
471
|
+
}
|
|
472
|
+
return {
|
|
473
|
+
executionId: 0,
|
|
474
|
+
summary: this.logger.getExecutionSummary(),
|
|
475
|
+
success: false,
|
|
476
|
+
error: error.message,
|
|
477
|
+
data: undefined,
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
finally {
|
|
482
|
+
// Clean up temporary file
|
|
483
|
+
if (tempFilePath) {
|
|
484
|
+
try {
|
|
485
|
+
await fs.unlink(tempFilePath);
|
|
486
|
+
}
|
|
487
|
+
catch (cleanupError) {
|
|
488
|
+
// Ignore cleanup errors to avoid masking the original error
|
|
489
|
+
console.warn(`Failed to cleanup temporary file ${tempFilePath}:`, cleanupError);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Find the BubbleFlow class in module exports
|
|
496
|
+
*/
|
|
497
|
+
findBubbleFlowClass(module) {
|
|
498
|
+
// Check all exports for a class that extends BubbleFlow
|
|
499
|
+
for (const [, value] of Object.entries(module)) {
|
|
500
|
+
if (typeof value === 'function' &&
|
|
501
|
+
this.isBubbleFlowClass(value)) {
|
|
502
|
+
return value;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Check if a function is a BubbleFlow class
|
|
509
|
+
*/
|
|
510
|
+
isBubbleFlowClass(func) {
|
|
511
|
+
// Check if it's a class constructor
|
|
512
|
+
if (typeof func !== 'function')
|
|
513
|
+
return false;
|
|
514
|
+
// Check prototype chain for BubbleFlow methods
|
|
515
|
+
const prototype = func.prototype;
|
|
516
|
+
if (!prototype)
|
|
517
|
+
return false;
|
|
518
|
+
// Look for the handle method which is required by BubbleFlow
|
|
519
|
+
return typeof prototype.handle === 'function';
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Instantiate the flow class with appropriate constructor parameters
|
|
523
|
+
*/
|
|
524
|
+
instantiateFlowClass(FlowClass) {
|
|
525
|
+
return new FlowClass('Generated Flow', 'Automatically generated flow execution', this.logger);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Resume execution from a specific step
|
|
529
|
+
*/
|
|
530
|
+
// @ts-expect-error - Not implemented
|
|
531
|
+
resumeFromStep(stepId) {
|
|
532
|
+
// No implementation
|
|
533
|
+
}
|
|
534
|
+
getPlan() {
|
|
535
|
+
if (!this.plan) {
|
|
536
|
+
throw new Error('Plan not found');
|
|
537
|
+
}
|
|
538
|
+
return this.plan;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Get the logger instance
|
|
542
|
+
*/
|
|
543
|
+
getLogger() {
|
|
544
|
+
return this.logger;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Get execution summary with detailed analytics
|
|
548
|
+
*/
|
|
549
|
+
getExecutionSummary() {
|
|
550
|
+
return this.logger?.getExecutionSummary() || null;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Export execution logs in various formats
|
|
554
|
+
*/
|
|
555
|
+
exportLogs(format = 'json') {
|
|
556
|
+
return this.logger?.exportLogs(format) || null;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Find the project root directory by looking for package.json
|
|
560
|
+
*/
|
|
561
|
+
findProjectRoot() {
|
|
562
|
+
console.log('Finding project root');
|
|
563
|
+
let currentDir = process.cwd();
|
|
564
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
565
|
+
try {
|
|
566
|
+
const packageJsonPath = path.join(currentDir, 'package.json');
|
|
567
|
+
if (existsSync(packageJsonPath)) {
|
|
568
|
+
return currentDir;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
// Continue searching
|
|
573
|
+
}
|
|
574
|
+
currentDir = path.dirname(currentDir);
|
|
575
|
+
}
|
|
576
|
+
// Fallback to current working directory
|
|
577
|
+
return process.cwd();
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Dispose of resources (logger, etc.)
|
|
581
|
+
*/
|
|
582
|
+
dispose() {
|
|
583
|
+
this.logger?.dispose();
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
//# sourceMappingURL=BubbleRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BubbleRunner.js","sourceRoot":"","sources":["../../src/runtime/BubbleRunner.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,YAAY,EACZ,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAchC,M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H,mBAAmB;QAGjB,OAAO,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,IAAI,IAAI,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,SAAmC,MAAM;QAClD,OAAO,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IACjD,CAAC;IAED;;OAEG;IACK,eAAe;QACrB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACpC,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAE/B,OAAO,UAAU,KAAK,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC;gBACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;gBAC9D,IAAI,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;oBAChC,OAAO,UAAU,CAAC;gBACpB,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,qBAAqB;YACvB,CAAC;YACD,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QAED,wCAAwC;QACxC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ScopeType } from '@typescript-eslint/scope-manager';
|
|
2
|
+
export type StepType = 'control_flow' | 'bubble_block' | 'setup' | 'finalization';
|
|
3
|
+
export type ControlType = 'for_loop' | 'while_loop' | 'if_statement' | 'try_catch';
|
|
4
|
+
export interface Operation {
|
|
5
|
+
type: 'new_bubble' | 'await_action' | 'assign' | 'if_condition' | 'for_iteration' | 'try_catch';
|
|
6
|
+
bubbleName?: string;
|
|
7
|
+
variableName?: string;
|
|
8
|
+
expression?: string;
|
|
9
|
+
condition?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MiniStep {
|
|
12
|
+
id: string;
|
|
13
|
+
type: 'bubble_instantiation' | 'bubble_execution' | 'variable_assignment' | 'condition' | 'loop_iteration' | 'script';
|
|
14
|
+
startLine: number;
|
|
15
|
+
endLine: number;
|
|
16
|
+
operation: Operation;
|
|
17
|
+
}
|
|
18
|
+
export interface ExecutionStep {
|
|
19
|
+
id: string;
|
|
20
|
+
type: StepType;
|
|
21
|
+
startLine: number;
|
|
22
|
+
endLine: number;
|
|
23
|
+
controlType?: ScopeType;
|
|
24
|
+
miniSteps?: MiniStep[];
|
|
25
|
+
}
|
|
26
|
+
export interface ExecutionPlan {
|
|
27
|
+
steps: ExecutionStep[];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAM,MAAM,QAAQ,GAChB,cAAc,GACd,cAAc,GACd,OAAO,GACP,cAAc,CAAC;AAEnB,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,YAAY,GACZ,cAAc,GACd,WAAW,CAAC;AAEhB,MAAM,WAAW,SAAS;IACxB,IAAI,EACA,YAAY,GACZ,cAAc,GACd,QAAQ,GACR,cAAc,GACd,eAAe,GACf,WAAW,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EACA,sBAAsB,GACtB,kBAAkB,GAClB,qBAAqB,GACrB,WAAW,GACX,gBAAgB,GAChB,QAAQ,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB"}
|