@bubblelab/bubble-core 0.1.2 → 0.1.5
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/bubble-bundle.d.ts +28 -28
- package/dist/bubbles/service-bubble/ai-agent.d.ts +24 -24
- package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/ai-agent.js +16 -2
- package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
- package/dist/bubbles/service-bubble/gmail.d.ts +4 -4
- package/dist/bubbles/service-bubble/google-calendar.d.ts +6 -6
- package/dist/bubbles/service-bubble/google-drive.d.ts +4 -4
- package/dist/bubbles/service-bubble/google-sheets.d.ts +20 -20
- package/dist/bubbles/service-bubble/http.d.ts +2 -2
- package/dist/bubbles/service-bubble/postgresql.d.ts +4 -4
- package/dist/bubbles/service-bubble/slack.d.ts +58 -58
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +10 -10
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +14 -14
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +10 -10
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +8 -8
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +66 -66
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +50 -50
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +92 -92
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +36 -36
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +46 -46
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +60 -60
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +14 -14
- package/dist/logging/BubbleLogger.d.ts.map +1 -1
- package/dist/logging/BubbleLogger.js +16 -4
- package/dist/logging/BubbleLogger.js.map +1 -1
- package/dist/types/ai-models.d.ts +1 -1
- package/dist/types/ai-models.d.ts.map +1 -1
- package/dist/types/ai-models.js +2 -0
- package/dist/types/ai-models.js.map +1 -1
- package/dist/types/base-bubble-class.d.ts.map +1 -1
- package/dist/types/base-bubble-class.js +7 -1
- package/dist/types/base-bubble-class.js.map +1 -1
- package/package.json +4 -3
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts +0 -8
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts.map +0 -1
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.js +0 -65
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.js.map +0 -1
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts +0 -125
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts.map +0 -1
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js +0 -169
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js.map +0 -1
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts +0 -97
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts.map +0 -1
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js +0 -327
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js.map +0 -1
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts +0 -157
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts.map +0 -1
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js +0 -310
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js.map +0 -1
- package/dist/bubbles/workflow-bubble/workflow-template.d.ts +0 -144
- package/dist/bubbles/workflow-bubble/workflow-template.d.ts.map +0 -1
- package/dist/bubbles/workflow-bubble/workflow-template.js +0 -124
- package/dist/bubbles/workflow-bubble/workflow-template.js.map +0 -1
- package/dist/types/streaming-events.d.ts +0 -18
- package/dist/types/streaming-events.d.ts.map +0 -1
- package/dist/types/streaming-events.js +0 -5
- package/dist/types/streaming-events.js.map +0 -1
- package/dist/utils/mock-data-generator.d.ts +0 -43
- package/dist/utils/mock-data-generator.d.ts.map +0 -1
- package/dist/utils/mock-data-generator.js +0 -312
- package/dist/utils/mock-data-generator.js.map +0 -1
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FILE EDITOR AGENT WORKFLOW
|
|
3
|
-
*
|
|
4
|
-
* A minimalistic agentic file editor that uses AI with the virtual-file-editor-tool
|
|
5
|
-
* to iteratively edit code files through natural language instructions.
|
|
6
|
-
*
|
|
7
|
-
* The workflow maintains file state across tool calls using the config mechanism,
|
|
8
|
-
* allowing the AI agent to build up complex edits incrementally.
|
|
9
|
-
*/
|
|
10
|
-
import { z } from 'zod';
|
|
11
|
-
import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
|
|
12
|
-
import { CredentialType } from '@bubblelab/shared-schemas';
|
|
13
|
-
import { AvailableModels } from '../../types/ai-models.js';
|
|
14
|
-
import { AIAgentBubble } from '../service-bubble/ai-agent.js';
|
|
15
|
-
import { AvailableTools } from '../../types/available-tools.js';
|
|
16
|
-
/**
|
|
17
|
-
* Schema for file content representation
|
|
18
|
-
* Each file is represented as a JavaScript object where keys are class/function names
|
|
19
|
-
* and values are arrays of lines (indexed by line number)
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Parameters schema for file editor agent
|
|
23
|
-
*/
|
|
24
|
-
const FileEditorAgentParamsSchema = z.object({
|
|
25
|
-
files: z.array(z.string()).describe('File content as array of lines'),
|
|
26
|
-
validationFunction: z
|
|
27
|
-
.function()
|
|
28
|
-
.args(z.array(z.string()), z.number())
|
|
29
|
-
.returns(z.promise(z.object({
|
|
30
|
-
validated: z.boolean(),
|
|
31
|
-
message: z.string(),
|
|
32
|
-
})))
|
|
33
|
-
.optional()
|
|
34
|
-
.describe('Async function to validate the file'),
|
|
35
|
-
tools: z
|
|
36
|
-
.array(AvailableTools)
|
|
37
|
-
.default([])
|
|
38
|
-
.describe('Array of tools the AI agent can use. Start and end lines are inclusive.'),
|
|
39
|
-
instruction: z
|
|
40
|
-
.string()
|
|
41
|
-
.min(1, 'Instruction is required')
|
|
42
|
-
.describe('Natural language instruction for what edits to make'),
|
|
43
|
-
maxIterations: z
|
|
44
|
-
.number()
|
|
45
|
-
.min(1)
|
|
46
|
-
.max(100)
|
|
47
|
-
.default(10)
|
|
48
|
-
.describe('Maximum number of edit iterations'),
|
|
49
|
-
model: AvailableModels.default('google/gemini-2.5-flash').describe('AI model to use for the editing agent'),
|
|
50
|
-
credentials: z
|
|
51
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
52
|
-
.optional()
|
|
53
|
-
.describe('Credentials (injected at runtime)'),
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* Result schema for file editor agent
|
|
57
|
-
*/
|
|
58
|
-
const FileEditorAgentResultSchema = z.object({
|
|
59
|
-
iterationsUsed: z.number().describe('Number of iterations used'),
|
|
60
|
-
success: z.boolean(),
|
|
61
|
-
fileContent: z.array(z.string()).describe('File content as array of lines'),
|
|
62
|
-
message: z.string().describe('Message from the agent'),
|
|
63
|
-
error: z.string(),
|
|
64
|
-
});
|
|
65
|
-
export class FileEditorAgentWorkflow extends WorkflowBubble {
|
|
66
|
-
static type = 'workflow';
|
|
67
|
-
static bubbleName = 'file-editor-agent';
|
|
68
|
-
static schema = FileEditorAgentParamsSchema;
|
|
69
|
-
static resultSchema = FileEditorAgentResultSchema;
|
|
70
|
-
static shortDescription = 'Agentic file editor using AI with virtual-file-editor-tool';
|
|
71
|
-
static longDescription = `
|
|
72
|
-
A minimalistic workflow that uses an AI agent with the virtual-file-editor-tool
|
|
73
|
-
to iteratively edit code files based on natural language instructions.
|
|
74
|
-
|
|
75
|
-
How it works:
|
|
76
|
-
1. Takes file content as a JS object (class/function names → line arrays)
|
|
77
|
-
2. AI agent uses virtual-file-editor-tool to make edits
|
|
78
|
-
3. File state persists across tool calls via config
|
|
79
|
-
4. Returns edited files in the same object format
|
|
80
|
-
|
|
81
|
-
Use cases:
|
|
82
|
-
- Refactoring code based on natural language instructions
|
|
83
|
-
- Making systematic changes across multiple classes/functions
|
|
84
|
-
- Applying code transformations iteratively
|
|
85
|
-
`;
|
|
86
|
-
static alias = 'file-editor';
|
|
87
|
-
constructor(params, context) {
|
|
88
|
-
super(params, context);
|
|
89
|
-
console.log('[file-editor-agent] context is :', context);
|
|
90
|
-
}
|
|
91
|
-
formatFileContent(fileContent) {
|
|
92
|
-
// Add line numbers to the file content
|
|
93
|
-
return fileContent.map((line, index) => `${index + 1}: ${line}`).join('\n');
|
|
94
|
-
}
|
|
95
|
-
async testValidationFunction(_fileContent, iterationsUsed) {
|
|
96
|
-
if (iterationsUsed === 3) {
|
|
97
|
-
return {
|
|
98
|
-
validated: true,
|
|
99
|
-
message: 'File is valid',
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
validated: false,
|
|
104
|
-
message: 'Types annotations are missing',
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
async performAction(_context) {
|
|
108
|
-
// State that will be updated by the hook
|
|
109
|
-
let currentFiles = this.params.files;
|
|
110
|
-
let currentValidation = await (this.params.validationFunction?.(currentFiles, 0) || this.testValidationFunction(currentFiles, 0));
|
|
111
|
-
let iterationCount = 0;
|
|
112
|
-
const buildSystemPrompt = (files, validation) => {
|
|
113
|
-
return `
|
|
114
|
-
═══════════════════════════════════════════════════════════
|
|
115
|
-
CURRENT FILE STATE (with line numbers):
|
|
116
|
-
═══════════════════════════════════════════════════════════
|
|
117
|
-
${this.formatFileContent(files)}
|
|
118
|
-
|
|
119
|
-
═══════════════════════════════════════════════════════════
|
|
120
|
-
VALIDATION FEEDBACK:
|
|
121
|
-
═══════════════════════════════════════════════════════════
|
|
122
|
-
Status: ${validation.validated ? '✅ VALID' : '❌ INVALID'}
|
|
123
|
-
Message: ${validation.message}
|
|
124
|
-
═══════════════════════════════════════════════════════════
|
|
125
|
-
|
|
126
|
-
CRITICAL INSTRUCTIONS:
|
|
127
|
-
- YOU MUST use tools to gather context and complete your task.
|
|
128
|
-
- You then use the virtual-file-editor-tool to fix the validation errors shown above
|
|
129
|
-
- Do NOT respond with text explanations - you MUST call the tool
|
|
130
|
-
- To MODIFY an existing line: { op: "replace", startLine: N, endLine: N, text: "new content" }
|
|
131
|
-
- To ADD a new line before line N: { op: "insert", startLine: N, text: "new line" }
|
|
132
|
-
- To DELETE lines: { op: "delete", startLine: N, endLine: M }
|
|
133
|
-
- Make ONE precise edit per tool call
|
|
134
|
-
- The file has validation ERRORS - you MUST fix them using the tool`;
|
|
135
|
-
};
|
|
136
|
-
// Create a shared config object that will be updated by the hook
|
|
137
|
-
// This ensures the tool always has access to the latest file state
|
|
138
|
-
const sharedToolConfig = {
|
|
139
|
-
codeLines: currentFiles,
|
|
140
|
-
};
|
|
141
|
-
const fileEditingAgent = new AIAgentBubble({
|
|
142
|
-
name: 'File Editing Agent',
|
|
143
|
-
systemPrompt: `You are a code editor AI. Your instructions are: ${this.params.instruction}`,
|
|
144
|
-
message: `${buildSystemPrompt(currentFiles, currentValidation)}
|
|
145
|
-
YOUR TASK: Use tools to gather context and fix the validation error. Call the tool immediately - do not respond with explanations.`,
|
|
146
|
-
model: {
|
|
147
|
-
model: this.params.model,
|
|
148
|
-
temperature: 0.7,
|
|
149
|
-
maxTokens: 40000,
|
|
150
|
-
},
|
|
151
|
-
beforeToolCall: async (hookContext) => {
|
|
152
|
-
if (hookContext.toolName === 'virtual-file-editor-tool') {
|
|
153
|
-
// Preserve the model-planned edit while injecting the latest file state by reference
|
|
154
|
-
const original = hookContext.toolInput;
|
|
155
|
-
const edit = original && typeof original === 'object' && 'edit' in original
|
|
156
|
-
? original.edit
|
|
157
|
-
: original;
|
|
158
|
-
// CRITICAL: Update the shared config's codeLines to the latest state
|
|
159
|
-
// This ensures the tool always gets the most recent file content
|
|
160
|
-
sharedToolConfig.codeLines = currentFiles;
|
|
161
|
-
// Return updated toolInput with the shared config reference
|
|
162
|
-
const toolInputReturn = {
|
|
163
|
-
messages: hookContext.messages,
|
|
164
|
-
toolInput: {
|
|
165
|
-
edit,
|
|
166
|
-
config: sharedToolConfig, // Always pass the same reference
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
// Log formatted info for debugging
|
|
170
|
-
console.log('\n' + '─'.repeat(60));
|
|
171
|
-
console.log('ITERATION:', iterationCount + 1);
|
|
172
|
-
console.log('─'.repeat(60));
|
|
173
|
-
// Display current tool call
|
|
174
|
-
console.log('\n🔧 TOOL CALL:');
|
|
175
|
-
console.log('Tool:', hookContext.toolName);
|
|
176
|
-
console.log('Args:', JSON.stringify(edit, null, 2));
|
|
177
|
-
// Show CURRENT file state (this is the source of truth)
|
|
178
|
-
console.log('\n📄 CURRENT FILE STATE (being passed to tool):');
|
|
179
|
-
console.log(this.formatFileContent(currentFiles));
|
|
180
|
-
// Show current validation status
|
|
181
|
-
console.log('\n📋 CURRENT VALIDATION:');
|
|
182
|
-
console.log('Status:', currentValidation.validated ? '✅ PASSED' : '❌ FAILED');
|
|
183
|
-
console.log('Message:', currentValidation.message);
|
|
184
|
-
console.log('─'.repeat(60) + '\n');
|
|
185
|
-
return toolInputReturn;
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
messages: hookContext.messages,
|
|
189
|
-
toolInput: hookContext.toolInput,
|
|
190
|
-
};
|
|
191
|
-
},
|
|
192
|
-
afterToolCall: async (hookContext) => {
|
|
193
|
-
// Only process virtual-file-editor-tool calls
|
|
194
|
-
if (hookContext.toolName === 'virtual-file-editor-tool') {
|
|
195
|
-
// Step 1: Extract updated file from tool output
|
|
196
|
-
const toolResult = hookContext.toolOutput;
|
|
197
|
-
if (toolResult.success && toolResult.data?.updatedCodeLines) {
|
|
198
|
-
const previousLineCount = currentFiles.length;
|
|
199
|
-
currentFiles = toolResult.data.updatedCodeLines;
|
|
200
|
-
// Update the shared config so next tool call has the latest state
|
|
201
|
-
sharedToolConfig.codeLines = currentFiles;
|
|
202
|
-
console.log('\n✅ TOOL RESULT:');
|
|
203
|
-
console.log('Success: true');
|
|
204
|
-
console.log('Lines: ', previousLineCount, '→', currentFiles.length);
|
|
205
|
-
console.log('\n📄 UPDATED FILE:');
|
|
206
|
-
console.log(this.formatFileContent(currentFiles));
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
console.warn('\n⚠️ TOOL EXECUTION FAILED:', toolResult && 'error' in toolResult
|
|
210
|
-
? toolResult.error
|
|
211
|
-
: 'Unknown error');
|
|
212
|
-
}
|
|
213
|
-
// Step 2: Run validation on updated file
|
|
214
|
-
iterationCount++;
|
|
215
|
-
currentValidation = await (this.params.validationFunction?.(currentFiles, iterationCount) || this.testValidationFunction(currentFiles, iterationCount));
|
|
216
|
-
// Log validation result
|
|
217
|
-
console.log('\n📊 VALIDATION AFTER EDIT:');
|
|
218
|
-
console.log('Status:', currentValidation.validated ? '✅ PASSED' : '❌ FAILED');
|
|
219
|
-
if (!currentValidation.validated) {
|
|
220
|
-
console.log('Errors:', currentValidation.message);
|
|
221
|
-
}
|
|
222
|
-
// Step 3: Simplify tool output message
|
|
223
|
-
const simplifiedToolMessage = currentValidation.validated
|
|
224
|
-
? `✅✅✅ VALIDATION PASSED! ✅✅✅
|
|
225
|
-
|
|
226
|
-
The file is now VALID and all errors are fixed!
|
|
227
|
-
|
|
228
|
-
⛔⛔⛔ CRITICAL: DO NOT MAKE ANY MORE TOOL CALLS ⛔⛔⛔
|
|
229
|
-
⛔⛔⛔ STOP IMMEDIATELY - YOUR TASK IS COMPLETE ⛔⛔⛔
|
|
230
|
-
|
|
231
|
-
Respond with ONLY a text summary (no tools).`
|
|
232
|
-
: `Edit applied. Validation still failing: ${currentValidation.message}
|
|
233
|
-
|
|
234
|
-
You MUST continue using virtual-file-editor-tool to fix the remaining errors.`;
|
|
235
|
-
// Step 4: Update system prompt with new file state + validation
|
|
236
|
-
// If validation passed, tell AI to stop
|
|
237
|
-
const updatedSystemPrompt = currentValidation.validated
|
|
238
|
-
? `⛔⛔⛔ STOP - VALIDATION PASSED ⛔⛔⛔
|
|
239
|
-
|
|
240
|
-
ALL ERRORS ARE FIXED. The file is now valid.
|
|
241
|
-
|
|
242
|
-
FINAL FILE (with line numbers):
|
|
243
|
-
${this.formatFileContent(currentFiles)}
|
|
244
|
-
|
|
245
|
-
If the core implementation is done,
|
|
246
|
-
⛔ DO NOT call any more tools
|
|
247
|
-
⛔ DO NOT make any more edits
|
|
248
|
-
"`
|
|
249
|
-
: buildSystemPrompt(currentFiles, currentValidation);
|
|
250
|
-
// Update the first message (system prompt) and ONLY the LAST tool message
|
|
251
|
-
const updatedMessages = hookContext.messages.map((msg, idx) => {
|
|
252
|
-
if (idx === 0) {
|
|
253
|
-
// Update system prompt
|
|
254
|
-
msg.content = updatedSystemPrompt;
|
|
255
|
-
}
|
|
256
|
-
else if (msg.getType() === 'tool' &&
|
|
257
|
-
idx === hookContext.messages.length - 1 &&
|
|
258
|
-
hookContext.toolName === 'virtual-file-editor-tool') {
|
|
259
|
-
// Only simplify the LATEST tool message (the one we just added)
|
|
260
|
-
msg.content = simplifiedToolMessage;
|
|
261
|
-
}
|
|
262
|
-
else if (msg.getType() === 'ai' && msg.tool_calls) {
|
|
263
|
-
// Strip 'config' from all AI messages' tool_calls to avoid context bloat
|
|
264
|
-
// The system prompt is the source of truth for current file state
|
|
265
|
-
const aiMsg = msg;
|
|
266
|
-
if (aiMsg.tool_calls && Array.isArray(aiMsg.tool_calls)) {
|
|
267
|
-
aiMsg.tool_calls = aiMsg.tool_calls.map((tc) => {
|
|
268
|
-
if (tc.name === 'virtual-file-editor-tool' &&
|
|
269
|
-
tc.args?.config) {
|
|
270
|
-
// Remove config but keep edit
|
|
271
|
-
const { config, ...argsWithoutConfig } = tc.args;
|
|
272
|
-
return { ...tc, args: argsWithoutConfig };
|
|
273
|
-
}
|
|
274
|
-
return tc;
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return msg;
|
|
279
|
-
});
|
|
280
|
-
return updatedMessages;
|
|
281
|
-
}
|
|
282
|
-
// For other tools, pass through unchanged
|
|
283
|
-
return hookContext.messages;
|
|
284
|
-
},
|
|
285
|
-
tools: [
|
|
286
|
-
{
|
|
287
|
-
name: 'virtual-file-editor-tool',
|
|
288
|
-
credentials: this.params.credentials || {},
|
|
289
|
-
config: sharedToolConfig, // Use shared config object
|
|
290
|
-
},
|
|
291
|
-
...this.params.tools.map((tool) => ({
|
|
292
|
-
name: tool,
|
|
293
|
-
credentials: this.params.credentials || {},
|
|
294
|
-
config: {},
|
|
295
|
-
})),
|
|
296
|
-
],
|
|
297
|
-
credentials: this.params.credentials,
|
|
298
|
-
maxIterations: this.params.maxIterations,
|
|
299
|
-
}, this.context);
|
|
300
|
-
const agentResult = await fileEditingAgent.action();
|
|
301
|
-
return {
|
|
302
|
-
iterationsUsed: iterationCount,
|
|
303
|
-
fileContent: currentFiles,
|
|
304
|
-
message: agentResult.data?.response || 'No response from agent',
|
|
305
|
-
success: currentValidation.validated,
|
|
306
|
-
error: currentValidation.validated ? '' : currentValidation.message,
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
//# sourceMappingURL=file-editor-agent.workflow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-editor-agent.workflow.js","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/file-editor-agent.workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC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workflow bubbles orchestrate multiple service bubbles to create complex, multi-step processes.
|
|
6
|
-
*
|
|
7
|
-
* To create a new workflow bubble:
|
|
8
|
-
* 1. Copy this template and rename it (e.g., my-custom-workflow.ts)
|
|
9
|
-
* 2. Replace all instances of "MyCustomWorkflow" with your workflow name
|
|
10
|
-
* 3. Update the schemas to define your input parameters and output structure
|
|
11
|
-
* 4. Implement the performAction method with your workflow logic
|
|
12
|
-
* 5. Update all static metadata (bubbleName, descriptions, etc.)
|
|
13
|
-
* 6. Register your workflow in the BubbleFactory
|
|
14
|
-
*/
|
|
15
|
-
import { z } from 'zod';
|
|
16
|
-
import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
|
|
17
|
-
import type { BubbleContext } from '../../types/bubble.js';
|
|
18
|
-
import { CredentialType } from '@nodex/shared-schemas';
|
|
19
|
-
/**
|
|
20
|
-
* Define the parameters schema using Zod
|
|
21
|
-
* This schema validates and types the input parameters for your workflow
|
|
22
|
-
*/
|
|
23
|
-
declare const MyCustomWorkflowParamsSchema: z.ZodObject<{
|
|
24
|
-
task: z.ZodString;
|
|
25
|
-
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
26
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
27
|
-
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
28
|
-
timeout: z.ZodDefault<z.ZodNumber>;
|
|
29
|
-
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
timeout: number;
|
|
31
|
-
verbose: boolean;
|
|
32
|
-
}, {
|
|
33
|
-
timeout?: number | undefined;
|
|
34
|
-
verbose?: boolean | undefined;
|
|
35
|
-
}>>;
|
|
36
|
-
credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
|
|
37
|
-
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
maxIterations: number;
|
|
39
|
-
task: string;
|
|
40
|
-
options?: {
|
|
41
|
-
timeout: number;
|
|
42
|
-
verbose: boolean;
|
|
43
|
-
} | undefined;
|
|
44
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
task: string;
|
|
47
|
-
options?: {
|
|
48
|
-
timeout?: number | undefined;
|
|
49
|
-
verbose?: boolean | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
52
|
-
maxIterations?: number | undefined;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Define the result schema
|
|
56
|
-
* This schema defines what your workflow returns
|
|
57
|
-
* Always include success and error fields for consistent error handling
|
|
58
|
-
*/
|
|
59
|
-
declare const MyCustomWorkflowResultSchema: z.ZodObject<{
|
|
60
|
-
result: z.ZodString;
|
|
61
|
-
success: z.ZodBoolean;
|
|
62
|
-
error: z.ZodString;
|
|
63
|
-
}, "strip", z.ZodTypeAny, {
|
|
64
|
-
error: string;
|
|
65
|
-
success: boolean;
|
|
66
|
-
result: string;
|
|
67
|
-
}, {
|
|
68
|
-
error: string;
|
|
69
|
-
success: boolean;
|
|
70
|
-
result: string;
|
|
71
|
-
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Type definitions derived from schemas
|
|
74
|
-
* These provide TypeScript types for compile-time type safety
|
|
75
|
-
*/
|
|
76
|
-
type MyCustomWorkflowParams = z.output<typeof MyCustomWorkflowParamsSchema>;
|
|
77
|
-
type MyCustomWorkflowResult = z.output<typeof MyCustomWorkflowResultSchema>;
|
|
78
|
-
/**
|
|
79
|
-
* Main workflow class implementation
|
|
80
|
-
* Extends WorkflowBubble with your parameter and result types
|
|
81
|
-
*/
|
|
82
|
-
export declare class MyCustomWorkflow extends WorkflowBubble<MyCustomWorkflowParams, MyCustomWorkflowResult> {
|
|
83
|
-
/**
|
|
84
|
-
* REQUIRED STATIC METADATA
|
|
85
|
-
* These fields are used by the BubbleFactory and system
|
|
86
|
-
*/
|
|
87
|
-
static readonly type: "workflow";
|
|
88
|
-
static readonly bubbleName = "my-custom-workflow";
|
|
89
|
-
static readonly schema: z.ZodObject<{
|
|
90
|
-
task: z.ZodString;
|
|
91
|
-
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
92
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
93
|
-
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
94
|
-
timeout: z.ZodDefault<z.ZodNumber>;
|
|
95
|
-
}, "strip", z.ZodTypeAny, {
|
|
96
|
-
timeout: number;
|
|
97
|
-
verbose: boolean;
|
|
98
|
-
}, {
|
|
99
|
-
timeout?: number | undefined;
|
|
100
|
-
verbose?: boolean | undefined;
|
|
101
|
-
}>>;
|
|
102
|
-
credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
|
|
103
|
-
}, "strip", z.ZodTypeAny, {
|
|
104
|
-
maxIterations: number;
|
|
105
|
-
task: string;
|
|
106
|
-
options?: {
|
|
107
|
-
timeout: number;
|
|
108
|
-
verbose: boolean;
|
|
109
|
-
} | undefined;
|
|
110
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
111
|
-
}, {
|
|
112
|
-
task: string;
|
|
113
|
-
options?: {
|
|
114
|
-
timeout?: number | undefined;
|
|
115
|
-
verbose?: boolean | undefined;
|
|
116
|
-
} | undefined;
|
|
117
|
-
credentials?: Partial<Record<CredentialType, string>> | undefined;
|
|
118
|
-
maxIterations?: number | undefined;
|
|
119
|
-
}>;
|
|
120
|
-
static readonly resultSchema: z.ZodObject<{
|
|
121
|
-
result: z.ZodString;
|
|
122
|
-
success: z.ZodBoolean;
|
|
123
|
-
error: z.ZodString;
|
|
124
|
-
}, "strip", z.ZodTypeAny, {
|
|
125
|
-
error: string;
|
|
126
|
-
success: boolean;
|
|
127
|
-
result: string;
|
|
128
|
-
}, {
|
|
129
|
-
error: string;
|
|
130
|
-
success: boolean;
|
|
131
|
-
result: string;
|
|
132
|
-
}>;
|
|
133
|
-
static readonly shortDescription = "Brief description of what your workflow does";
|
|
134
|
-
static readonly longDescription = "\n A comprehensive description of your workflow bubble.\n \n What it does:\n - Main functionality point 1\n - Main functionality point 2\n \n How it works:\n 1. Step 1 - Brief description\n 2. Step 2 - Brief description\n 3. Step 3 - Brief description\n \n Use cases:\n - When you need to orchestrate multiple operations\n - When processing requires multiple steps\n - When combining multiple service integrations\n ";
|
|
135
|
-
static readonly alias = "custom-wf";
|
|
136
|
-
constructor(params: z.input<typeof MyCustomWorkflowParamsSchema>, context?: BubbleContext);
|
|
137
|
-
/**
|
|
138
|
-
* Main workflow execution method
|
|
139
|
-
* Implement your workflow logic here
|
|
140
|
-
*/
|
|
141
|
-
protected performAction(_context?: BubbleContext): Promise<MyCustomWorkflowResult>;
|
|
142
|
-
}
|
|
143
|
-
export {};
|
|
144
|
-
//# sourceMappingURL=workflow-template.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-template.d.ts","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/workflow-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMvD;;;GAGG;AACH,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BhC,CAAC;AAEH;;;;GAIG;AACH,QAAA,MAAM,4BAA4B;;;;;;;;;;;;EAOhC,CAAC;AAEH;;;GAGG;AACH,KAAK,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAC5E,KAAK,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAE5E;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,cAAc,CAClD,sBAAsB,EACtB,sBAAsB,CACvB;IACC;;;OAGG;IAGH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IAG3C,MAAM,CAAC,QAAQ,CAAC,UAAU,wBAAwB;IAGlD,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAgC;IACtD,MAAM,CAAC,QAAQ,CAAC,YAAY;;;;;;;;;;;;OAAgC;IAG5D,MAAM,CAAC,QAAQ,CAAC,gBAAgB,kDACiB;IAGjD,MAAM,CAAC,QAAQ,CAAC,eAAe,odAgB7B;IAGF,MAAM,CAAC,QAAQ,CAAC,KAAK,eAAe;gBAGlC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,EACpD,OAAO,CAAC,EAAE,aAAa;IAKzB;;;OAGG;cACa,aAAa,CAC3B,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,sBAAsB,CAAC;CAenC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WORKFLOW BUBBLE TEMPLATE
|
|
3
|
-
*
|
|
4
|
-
* This template provides a starting point for creating new workflow bubbles in the NodeX system.
|
|
5
|
-
* Workflow bubbles orchestrate multiple service bubbles to create complex, multi-step processes.
|
|
6
|
-
*
|
|
7
|
-
* To create a new workflow bubble:
|
|
8
|
-
* 1. Copy this template and rename it (e.g., my-custom-workflow.ts)
|
|
9
|
-
* 2. Replace all instances of "MyCustomWorkflow" with your workflow name
|
|
10
|
-
* 3. Update the schemas to define your input parameters and output structure
|
|
11
|
-
* 4. Implement the performAction method with your workflow logic
|
|
12
|
-
* 5. Update all static metadata (bubbleName, descriptions, etc.)
|
|
13
|
-
* 6. Register your workflow in the BubbleFactory
|
|
14
|
-
*/
|
|
15
|
-
import { z } from 'zod';
|
|
16
|
-
import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
|
|
17
|
-
import { CredentialType } from '@nodex/shared-schemas';
|
|
18
|
-
// Import any bubbles you'll use in your workflow
|
|
19
|
-
// import { AIAgentBubble } from '../service-bubble/ai-agent.js';
|
|
20
|
-
// import { BubbleFactory } from '../../bubble-factory.js';
|
|
21
|
-
/**
|
|
22
|
-
* Define the parameters schema using Zod
|
|
23
|
-
* This schema validates and types the input parameters for your workflow
|
|
24
|
-
*/
|
|
25
|
-
const MyCustomWorkflowParamsSchema = z.object({
|
|
26
|
-
// Example required parameter
|
|
27
|
-
task: z
|
|
28
|
-
.string()
|
|
29
|
-
.min(1, 'Task is required')
|
|
30
|
-
.describe('Description of the task to perform'),
|
|
31
|
-
// Example optional parameter with default
|
|
32
|
-
maxIterations: z
|
|
33
|
-
.number()
|
|
34
|
-
.min(1)
|
|
35
|
-
.max(50)
|
|
36
|
-
.default(10)
|
|
37
|
-
.describe('Maximum number of iterations for the workflow'),
|
|
38
|
-
// Example complex parameter
|
|
39
|
-
options: z
|
|
40
|
-
.object({
|
|
41
|
-
verbose: z.boolean().default(false).describe('Enable verbose logging'),
|
|
42
|
-
timeout: z.number().default(60000).describe('Timeout in milliseconds'),
|
|
43
|
-
})
|
|
44
|
-
.optional()
|
|
45
|
-
.describe('Configuration options for the workflow'),
|
|
46
|
-
// REQUIRED: Credentials field (automatically injected at runtime)
|
|
47
|
-
credentials: z
|
|
48
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
49
|
-
.optional()
|
|
50
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Define the result schema
|
|
54
|
-
* This schema defines what your workflow returns
|
|
55
|
-
* Always include success and error fields for consistent error handling
|
|
56
|
-
*/
|
|
57
|
-
const MyCustomWorkflowResultSchema = z.object({
|
|
58
|
-
// Your custom result fields
|
|
59
|
-
result: z.string().describe('The final result of the workflow'),
|
|
60
|
-
// Standard result fields (always include these)
|
|
61
|
-
success: z.boolean(),
|
|
62
|
-
error: z.string(),
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* Main workflow class implementation
|
|
66
|
-
* Extends WorkflowBubble with your parameter and result types
|
|
67
|
-
*/
|
|
68
|
-
export class MyCustomWorkflow extends WorkflowBubble {
|
|
69
|
-
/**
|
|
70
|
-
* REQUIRED STATIC METADATA
|
|
71
|
-
* These fields are used by the BubbleFactory and system
|
|
72
|
-
*/
|
|
73
|
-
// Bubble type - always 'workflow' for workflow bubbles
|
|
74
|
-
static type = 'workflow';
|
|
75
|
-
// Unique identifier for your workflow (use kebab-case)
|
|
76
|
-
static bubbleName = 'my-custom-workflow';
|
|
77
|
-
// Schemas for validation
|
|
78
|
-
static schema = MyCustomWorkflowParamsSchema;
|
|
79
|
-
static resultSchema = MyCustomWorkflowResultSchema;
|
|
80
|
-
// Short description (one line, used in lists and summaries)
|
|
81
|
-
static shortDescription = 'Brief description of what your workflow does';
|
|
82
|
-
// Long description with detailed information
|
|
83
|
-
static longDescription = `
|
|
84
|
-
A comprehensive description of your workflow bubble.
|
|
85
|
-
|
|
86
|
-
What it does:
|
|
87
|
-
- Main functionality point 1
|
|
88
|
-
- Main functionality point 2
|
|
89
|
-
|
|
90
|
-
How it works:
|
|
91
|
-
1. Step 1 - Brief description
|
|
92
|
-
2. Step 2 - Brief description
|
|
93
|
-
3. Step 3 - Brief description
|
|
94
|
-
|
|
95
|
-
Use cases:
|
|
96
|
-
- When you need to orchestrate multiple operations
|
|
97
|
-
- When processing requires multiple steps
|
|
98
|
-
- When combining multiple service integrations
|
|
99
|
-
`;
|
|
100
|
-
// Optional: Short alias for the workflow (e.g., 'custom' instead of 'my-custom-workflow')
|
|
101
|
-
static alias = 'custom-wf';
|
|
102
|
-
constructor(params, context) {
|
|
103
|
-
super(params, context);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Main workflow execution method
|
|
107
|
-
* Implement your workflow logic here
|
|
108
|
-
*/
|
|
109
|
-
async performAction(_context) {
|
|
110
|
-
// TODO: Implement your workflow logic here
|
|
111
|
-
// Example workflow steps:
|
|
112
|
-
// 1. Validate input parameters
|
|
113
|
-
// 2. Execute workflow operations
|
|
114
|
-
// 3. Return results
|
|
115
|
-
// Placeholder implementation - replace with your actual workflow logic
|
|
116
|
-
return {
|
|
117
|
-
success: true,
|
|
118
|
-
error: '',
|
|
119
|
-
result: 'Workflow completed successfully',
|
|
120
|
-
// Add other result properties as defined in MyCustomWorkflowResultSchema
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=workflow-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-template.js","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/workflow-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,iDAAiD;AACjD,iEAAiE;AACjE,2DAA2D;AAE3D;;;GAGG;AACH,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,6BAA6B;IAC7B,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC;SAC1B,QAAQ,CAAC,oCAAoC,CAAC;IAEjD,0CAA0C;IAC1C,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,+CAA+C,CAAC;IAE5D,4BAA4B;IAC5B,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACtE,O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O,KAAK,CAAC,aAAa,CAC3B,QAAwB;QAExB,2CAA2C;QAC3C,0BAA0B;QAC1B,+BAA+B;QAC/B,iCAAiC;QACjC,oBAAoB;QAEpB,uEAAuE;QACvE,OAAO;YACL,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,iCAAiC;YACzC,yEAAyE;SAC1E,CAAC;IACJ,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared types for streaming log events between backend and frontend
|
|
3
|
-
*/
|
|
4
|
-
export interface StreamingLogEvent {
|
|
5
|
-
type: 'log_line' | 'bubble_instantiation' | 'bubble_execution' | 'bubble_start' | 'bubble_complete' | 'execution_complete' | 'error' | 'stream_complete' | 'info' | 'warn' | 'debug' | 'trace' | 'fatal';
|
|
6
|
-
timestamp: string;
|
|
7
|
-
lineNumber?: number;
|
|
8
|
-
message: string;
|
|
9
|
-
bubbleId?: string;
|
|
10
|
-
bubbleName?: string;
|
|
11
|
-
variableName?: string;
|
|
12
|
-
additionalData?: Record<string, unknown>;
|
|
13
|
-
executionTime?: number;
|
|
14
|
-
memoryUsage?: number;
|
|
15
|
-
logLevel?: string;
|
|
16
|
-
}
|
|
17
|
-
export type StreamCallback = (event: StreamingLogEvent) => void | Promise<void>;
|
|
18
|
-
//# sourceMappingURL=streaming-events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-events.d.ts","sourceRoot":"","sources":["../../src/types/streaming-events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EACA,UAAU,GACV,sBAAsB,GACtB,kBAAkB,GAClB,cAAc,GACd,iBAAiB,GACjB,oBAAoB,GACpB,OAAO,GACP,iBAAiB,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-events.js","sourceRoot":"","sources":["../../src/types/streaming-events.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|