@bubblelab/shared-schemas 0.1.10 → 0.1.11
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/agent-memory.d.ts +21 -0
- package/dist/agent-memory.d.ts.map +1 -0
- package/dist/agent-memory.js +11 -0
- package/dist/agent-memory.js.map +1 -0
- package/dist/ai-models.d.ts +1 -1
- package/dist/ai-models.d.ts.map +1 -1
- package/dist/ai-models.js +12 -0
- package/dist/ai-models.js.map +1 -1
- package/dist/api-schema.d.ts +2 -2
- package/dist/bubble-definition-schema.d.ts +559 -75
- package/dist/bubble-definition-schema.d.ts.map +1 -1
- package/dist/bubble-definition-schema.js +184 -0
- package/dist/bubble-definition-schema.js.map +1 -1
- package/dist/bubbleflow-execution-schema.d.ts +586 -175
- package/dist/bubbleflow-execution-schema.d.ts.map +1 -1
- package/dist/bubbleflow-execution-schema.js +40 -26
- package/dist/bubbleflow-execution-schema.js.map +1 -1
- package/dist/bubbleflow-generation-prompts.d.ts +13 -7
- package/dist/bubbleflow-generation-prompts.d.ts.map +1 -1
- package/dist/bubbleflow-generation-prompts.js +384 -15
- package/dist/bubbleflow-generation-prompts.js.map +1 -1
- package/dist/bubbleflow-schema.d.ts +1112 -123
- package/dist/bubbleflow-schema.d.ts.map +1 -1
- package/dist/bubbleflow-schema.js +94 -4
- package/dist/bubbleflow-schema.js.map +1 -1
- package/dist/coffee.d.ts +2201 -0
- package/dist/coffee.d.ts.map +1 -0
- package/dist/coffee.js +258 -0
- package/dist/coffee.js.map +1 -0
- package/dist/credential-schema.d.ts +27 -13
- package/dist/credential-schema.d.ts.map +1 -1
- package/dist/credential-schema.js +137 -4
- package/dist/credential-schema.js.map +1 -1
- package/dist/database-definition-schema.d.ts +8 -8
- package/dist/error-enhancer.d.ts +6 -0
- package/dist/error-enhancer.d.ts.map +1 -0
- package/dist/error-enhancer.js +88 -0
- package/dist/error-enhancer.js.map +1 -0
- package/dist/generate-bubbleflow-schema.d.ts +1001 -79
- package/dist/generate-bubbleflow-schema.d.ts.map +1 -1
- package/dist/generate-bubbleflow-schema.js +23 -7
- package/dist/generate-bubbleflow-schema.js.map +1 -1
- package/dist/hash-utils.d.ts +26 -0
- package/dist/hash-utils.d.ts.map +1 -0
- package/dist/hash-utils.js +37 -0
- package/dist/hash-utils.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/milk-tea.d.ts +18 -20
- package/dist/milk-tea.d.ts.map +1 -1
- package/dist/milk-tea.js +1 -4
- package/dist/milk-tea.js.map +1 -1
- package/dist/oauth-schema.d.ts +2 -2
- package/dist/param-utils.d.ts +10 -0
- package/dist/param-utils.d.ts.map +1 -0
- package/dist/param-utils.js +13 -0
- package/dist/param-utils.js.map +1 -0
- package/dist/pearl.d.ts +96 -29
- package/dist/pearl.d.ts.map +1 -1
- package/dist/pearl.js +20 -9
- package/dist/pearl.js.map +1 -1
- package/dist/storage-utils.d.ts +19 -0
- package/dist/storage-utils.d.ts.map +1 -0
- package/dist/storage-utils.js +54 -0
- package/dist/storage-utils.js.map +1 -0
- package/dist/streaming-events.d.ts +28 -2
- package/dist/streaming-events.d.ts.map +1 -1
- package/dist/subscription-status-schema.d.ts +192 -32
- package/dist/subscription-status-schema.d.ts.map +1 -1
- package/dist/subscription-status-schema.js +85 -7
- package/dist/subscription-status-schema.js.map +1 -1
- package/dist/trigger.d.ts +45 -51
- package/dist/trigger.d.ts.map +1 -1
- package/dist/trigger.js +0 -2
- package/dist/trigger.js.map +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/general-chat.d.ts +0 -81
- package/dist/general-chat.d.ts.map +0 -1
- package/dist/general-chat.js +0 -58
- package/dist/general-chat.js.map +0 -1
- package/dist/generation-result-schema.d.ts +0 -73
- package/dist/generation-result-schema.d.ts.map +0 -1
- package/dist/generation-result-schema.js +0 -55
- package/dist/generation-result-schema.js.map +0 -1
- package/dist/mock-data-generator.test.d.ts +0 -2
- package/dist/mock-data-generator.test.d.ts.map +0 -1
- package/dist/mock-data-generator.test.js +0 -176
- package/dist/mock-data-generator.test.js.map +0 -1
|
@@ -6,28 +6,121 @@
|
|
|
6
6
|
* Critical instructions for AI agents generating BubbleFlow code
|
|
7
7
|
* These instructions ensure consistent, correct code generation
|
|
8
8
|
*/
|
|
9
|
+
import { SYSTEM_CREDENTIALS } from './credential-schema.js';
|
|
10
|
+
// Model constants for AI agent instructions
|
|
11
|
+
export const RECOMMENDED_MODELS = {
|
|
12
|
+
BEST: 'google/gemini-3-pro-preview',
|
|
13
|
+
BEST_ALT: 'openai/gpt-5.2',
|
|
14
|
+
PRO: 'google/gemini-3-flash-preview',
|
|
15
|
+
PRO_ALT: 'anthropic/claude-sonnet-4-5',
|
|
16
|
+
FAST: 'google/gemini-3-flash-preview',
|
|
17
|
+
FAST_ALT: 'anthropic/claude-haiku-4-5',
|
|
18
|
+
LITE: 'google/gemini-2.5-flash-lite',
|
|
19
|
+
IMAGE: 'google/gemini-3-pro-image-preview',
|
|
20
|
+
};
|
|
9
21
|
export const CRITICAL_INSTRUCTIONS = `CRITICAL INSTRUCTIONS:
|
|
10
22
|
1. Start with the exact boilerplate template above (it has all the correct imports and class structure), come up with a name for the flow based on the user's request, export class [name] extends BubbleFlow
|
|
11
|
-
2.
|
|
12
|
-
3.
|
|
13
|
-
4.
|
|
23
|
+
2. CRITICAL: Only ONE class extending BubbleFlow is allowed per file. Do NOT create multiple BubbleFlow classes (e.g., a webhook flow and a cron flow).
|
|
24
|
+
3. Properly type the payload import and output interface based on the user's request, create typescript interfaces for them
|
|
25
|
+
4. BEFORE writing any code, identify which bubbles you plan to use from the available list, prioritize choosing tools over services unless the user specifically requests a service.
|
|
26
|
+
5. For EACH bubble you plan to use, ALWAYS call get-bubble-details-tool first to understand:
|
|
14
27
|
- The correct input parameters and their types
|
|
15
28
|
- The expected output structure in result.data
|
|
16
29
|
- How to properly handle success/error cases
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
6. IMPLEMENTATION ARCHITECTURE (CRITICAL):
|
|
31
|
+
- Break the workflow into atomic PRIVATE methods (do NOT call them "steps" or use "step" terminology).
|
|
32
|
+
- Types of methods:
|
|
33
|
+
a) Transformation Methods: Pure functions for data cleaning, validation, or formatting. NO Bubble usage here.
|
|
34
|
+
b) Bubble Methods: Async functions that instantiate and run SINGLE Bubble (or logically grouped Bubbles).
|
|
35
|
+
- The 'handle()' method must be a CLEAN orchestrator:
|
|
36
|
+
- ONLY call private methods sequentially.
|
|
37
|
+
- Use 'if' statements and 'for' loops inside handle() to control execution flow.
|
|
38
|
+
- NO switch statements.
|
|
39
|
+
- NO direct Bubble instantiation inside handle().
|
|
40
|
+
- NO try-catch blocks inside handle() (handle errors inside private methods if needed, otherwise let them bubble up).
|
|
41
|
+
- NO complex logic inside handle() - use Transformation Methods instead.
|
|
42
|
+
- CRITICAL: Each private method MUST have a ONE-LINE comment describing WHAT the method does in specific, concrete terms (not generic phrases like "processes data" or "transforms input").
|
|
43
|
+
ONLY add a second "Condition:" line if the method is CONDITIONALLY executed (e.g., inside an if-statement, only runs when X is true). Do NOT add "Condition: Always runs" - if it always runs, omit the Condition line entirely.
|
|
44
|
+
- Example:
|
|
45
|
+
// Sanitizes raw webhook input by trimming whitespace and converting to uppercase
|
|
46
|
+
private transformData(input: string): string { ... }
|
|
47
|
+
|
|
48
|
+
// Sends cleaned input to AI for natural language processing
|
|
49
|
+
// Only runs when input length is greater than 3 characters
|
|
50
|
+
private async processWithAI(input: string): Promise<string> { ... }
|
|
51
|
+
7. Use the exact parameter structures shown in the bubble details
|
|
52
|
+
8. If deterministic tool calls and branch logic are possible, there is no need to use AI agent.
|
|
53
|
+
9. Access bubble outputs safely using result.data with null checking (e.g., result.data?.someProperty or check if result.data exists first)
|
|
54
|
+
10. Return meaningful data from the handle method, this is the data that will be shown to the user.
|
|
55
|
+
11. DO NOT include credentials in bubble parameters - credentials are handled automatically
|
|
56
|
+
12. CRITICAL: In Bubble methods, always use the pattern: const result = await new SomeBubble({params}).action() - NEVER use runBubble, this.runBubble, or any other method.
|
|
57
|
+
13. When using AI Agent, ensure your prompt includes comprehensive context and explicitly pass in all relevant information needed for the task. Be thorough in providing complete data rather than expecting the AI to infer or assume missing details (unless the information must be retrieved from an online source)
|
|
58
|
+
14. When generating and dealing with images, process them one at a time to ensure proper handling and avoid overwhelming the system
|
|
27
59
|
15. If the location of the output is unknown or not specified by the user, use this.logger?.info(message:string) to print the output to the console.
|
|
28
60
|
16. DO NOT repeat the user's request in your response or thinking process. Do not include "The user says: <user's request>" in your response.
|
|
61
|
+
17. Write short and concise comments throughout the code. Name methods clearly (e.g., 'transformInput', 'performResearch', 'formatOutput'). The variable name for bubble should describe the bubble's purpose and its role in the workflow. NEVER use the word "step" in method names, comments, or variable names.
|
|
62
|
+
18. If user does not specify a communication channel to get the result, use email sending via resend and do not set the 'from' parameter, it will be set automatically and use bubble lab's default email, unless the user has their own resend setup and account domain verified.
|
|
63
|
+
19. When importing JSON workflows from other platforms, focus on capturing the ESSENCE and INTENT of the workflow, not the exact architecture. Convert to appropriate BubbleFlow patterns - use deterministic workflows when the logic is linear and predictable, only use AI agents when dynamic decision-making is truly needed.
|
|
64
|
+
20. NEVER generate placeholder values like "YOUR_API_KEY_HERE", "YOUR_FOLDER_ID", "REPLACE_THIS", etc. in constants. ALL user-specific or environment-specific values MUST be defined in the payload interface and passed as inputs. Constants should only contain truly static values that never change (like MIME types, fixed strings, enum values, etc.). If a value needs to be configured by the user, it belongs in the payload interface, NOT in a constant.
|
|
65
|
+
21. NEVER use the 'any' type. TypeScript's type inference is powerful - let it work for you:
|
|
66
|
+
- For bubble results: DO NOT annotate the type. Just write \`const result = await new GmailBubble({...}).readEmail()\` and TypeScript will infer the correct type automatically.
|
|
67
|
+
- For function return types: Omit return type annotations when the return value is obvious from the implementation. TypeScript infers them correctly.
|
|
68
|
+
- When you MUST annotate: Use the specific type (e.g., \`BubbleResult<GmailReadEmailData>\`), generic parameters, or \`unknown\` if truly unknown.
|
|
69
|
+
- WRONG: \`const result: any = await bubble.action()\` or \`function transform(data: any)\`
|
|
70
|
+
- RIGHT: \`const result = await bubble.action()\` (let TypeScript infer) or \`function transform(data: EmailData)\` (use specific type)
|
|
29
71
|
|
|
30
72
|
CRITICAL: You MUST use get-bubble-details-tool for every bubble before using it in your code!`;
|
|
73
|
+
export const BUBBLE_STUDIO_INSTRUCTIONS = `
|
|
74
|
+
Bubble Studio is the frontend dashboard for Bubble Lab. It is the main UI for users to create, edit, and manage their flows. It has the following pages and UI map and user capabilities:
|
|
75
|
+
|
|
76
|
+
- Pages and navigation (You are located inside the flow screen in Bubble Studio):
|
|
77
|
+
- Home: generate a new flow from a natural-language prompt or import JSON.
|
|
78
|
+
- Flows: list/search flows; select, rename, delete; create new.
|
|
79
|
+
- Flow editor: visualize graph, edit code, validate/run, see Console and History; use AI (Pearl) and Bubble Side Panel to add bubbles.
|
|
80
|
+
- Credentials: add/update API keys required by flows
|
|
81
|
+
|
|
82
|
+
**Important**: There are a set of system credentials that automatically used to run flow if no user credentials are provided, they are handled by bubble studio they are optional to run a flow.
|
|
83
|
+
System credentials are (WARNING: DO NOT use these credentials in the code, they are intended to be used by bubble studio and not accessible in side the workflow code! If a flow needs additional credential keys to run properly (for example calling HTTP endpoints with an integration that bubble lab doesn't yet support), ask user to provide in the payload.):
|
|
84
|
+
${JSON.stringify(Array.from(SYSTEM_CREDENTIALS), null, 2)}
|
|
85
|
+
|
|
86
|
+
- Panels:
|
|
87
|
+
- Sidebar (left): app navigation and account controls.
|
|
88
|
+
- Flow (Monaco Editor): the main editor for the current flow. With a trigger node at the left. And other bubbles nodes that follow the trigger node consisting of the flow graph in the visualizer.
|
|
89
|
+
- Consolidated Panel (right): tabs
|
|
90
|
+
- Pearl: AI assistant for coding and explanations.
|
|
91
|
+
- Code: Monaco editor for the current flow.
|
|
92
|
+
- Console: live execution logs and stats during runs.
|
|
93
|
+
- History: recent executions for this flow.
|
|
94
|
+
|
|
95
|
+
- (Trigger nodes) Input Schema & Cron nodes in the visualizer:
|
|
96
|
+
- Input Schema node (default entry): clearly labeled node that represents the flow's input schema.
|
|
97
|
+
- Shows each input field with name, type, optional/required status, and default/example value if present.
|
|
98
|
+
- Users provide sample values here by typing in the input field or using file upload (via paperclip icon 📎) that are used when clicking Run.
|
|
99
|
+
- File upload supports: text files (.html, .csv, .txt) read as strings, and images (.png, .jpg, .jpeg) compressed client-side and converted to base64 (max 10MB).
|
|
100
|
+
- For string fields: all file types are supported; for array entries: only text files are allowed.
|
|
101
|
+
- After upload, the input shows the filename and becomes disabled; users can delete the uploaded file to edit manually.
|
|
102
|
+
- Visual indication (highlighted in yellow) indicate missing required fields or type mismatches before execution.
|
|
103
|
+
- To change the schema itself, users edit code or ask pearl to update the schema; the node updates to reflect the latest schema after "sync with code" button is clicked.
|
|
104
|
+
- Cron Schedule node (when the flow uses schedule/cron): appears instead of the Input Schema node as the entry.
|
|
105
|
+
- Lets users enable/disable the schedule, edit the cron expression and shows the time in the user's timezone.
|
|
106
|
+
- Shows a preview of the next run times to confirm the schedule.
|
|
107
|
+
- When enabled, the flow runs automatically on schedule; inputs come from the configured scheduled payload.
|
|
108
|
+
To enable http webhook trigger, user can find a webhook toggle on the flow visualizer page and easily copy over the webhook url to their own server or service (triggers on post request to the url).
|
|
109
|
+
|
|
110
|
+
- How users provide inputs to run a flow:
|
|
111
|
+
- Each flow defines an input schema (can be empty if no inputs are required); users set execution inputs in the Flow editor before clicking Run.
|
|
112
|
+
- Any required credentials are surfaced by the flow; users add them on the Credentials page or the popup on each bubble inside flow editor.
|
|
113
|
+
- For webhook/HTTP or cron-triggered flows, inputs can also arrive via the incoming request payload or scheduled payload.
|
|
114
|
+
|
|
115
|
+
- Common actions to guide:
|
|
116
|
+
- Create a flow (Home) or import JSON; open Flows, select/rename/delete flows.
|
|
117
|
+
- In the editor: switch tabs, edit code, validate, run/stop, read Console output, review History.
|
|
118
|
+
- Manage credentials when missing or invalid.
|
|
119
|
+
|
|
120
|
+
- Constraints:
|
|
121
|
+
- Sign-in is required for protected actions; unauthenticated users are redirected to Home with a sign-in modal.
|
|
122
|
+
- Navigation may be temporarily locked while code generation or a run is in progress.
|
|
123
|
+
`;
|
|
31
124
|
/**
|
|
32
125
|
* Validation process instructions for ensuring generated code is valid
|
|
33
126
|
*/
|
|
@@ -49,9 +142,285 @@ export const INPUT_SCHEMA_INSTRUCTIONS = `For input schema, ie. the interface pa
|
|
|
49
142
|
the workflow should typically be ran (if it should be variable or fixed). If all
|
|
50
143
|
inputs are fixed take out the interface and just use handle() without the payload.
|
|
51
144
|
|
|
52
|
-
|
|
145
|
+
CRITICAL: EVERY input field MUST have a helpful, user-friendly comment that explains:
|
|
146
|
+
1. WHAT the field means (what information it represents)
|
|
147
|
+
2. WHERE to find the information (specific location, URL, settings page, etc.)
|
|
148
|
+
3. HOW to provide the input (format, extraction steps)
|
|
149
|
+
|
|
150
|
+
Write comments in plain, conversational language as if explaining to a non-technical user.
|
|
151
|
+
DO NOT include example values in comments - example values should ONLY be provided as default values in the destructuring assignment using the = operator.
|
|
152
|
+
|
|
153
|
+
FILE UPLOAD CONTROL (@canBeFile):
|
|
154
|
+
For each string field, decide if it makes sense to upload file content. Use the @canBeFile JSDoc tag to control whether the file upload icon appears in the UI.
|
|
155
|
+
|
|
156
|
+
ALLOW file uploads (@canBeFile true or omit the tag - default behavior) for:
|
|
157
|
+
- Fields that hold document/media CONTENT (body, text, document, attachment, content, data, fileContent)
|
|
158
|
+
- Fields where pasting large text content would be cumbersome
|
|
159
|
+
- Fields that semantically represent file data to be processed
|
|
160
|
+
|
|
161
|
+
DISABLE file uploads (@canBeFile false) for:
|
|
162
|
+
- Identifiers and references (IDs, names, paths, URLs, emails, usernames)
|
|
163
|
+
- Configuration values (settings, options, formats, modes)
|
|
164
|
+
- Short user inputs (prompts, queries, search terms, titles)
|
|
165
|
+
- Credential-like values (API keys, tokens, secrets)
|
|
166
|
+
|
|
167
|
+
Example usage:
|
|
168
|
+
\`\`\`typescript
|
|
169
|
+
export interface DocumentProcessorPayload extends WebhookEvent {
|
|
170
|
+
/**
|
|
171
|
+
* Email address where the results should be sent.
|
|
172
|
+
* @canBeFile false
|
|
173
|
+
*/
|
|
174
|
+
email: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The document content to process. Paste text or upload a file.
|
|
178
|
+
* @canBeFile true
|
|
179
|
+
*/
|
|
180
|
+
documentContent: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Google Drive folder ID where files will be saved.
|
|
184
|
+
* @canBeFile false
|
|
185
|
+
*/
|
|
186
|
+
folderId: string;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* File to attach to the email. Upload any document, image, or file.
|
|
190
|
+
*/
|
|
191
|
+
attachment?: string; // @canBeFile defaults to true, so no need to specify
|
|
192
|
+
}
|
|
193
|
+
\`\`\`
|
|
194
|
+
|
|
195
|
+
Use your judgment based on what the field semantically represents, not just its name.
|
|
196
|
+
|
|
197
|
+
Examples of EXCELLENT field comments (note: example values go in destructuring, not in comments):
|
|
198
|
+
|
|
199
|
+
// The spreadsheet ID is the long string in the URL right after /d/ and before the next / in the URL.
|
|
200
|
+
spreadsheetId: string;
|
|
201
|
+
|
|
202
|
+
// Slack: Right-click channel → "View channel details" → Copy the "Channel ID" (starts with 'C')
|
|
203
|
+
channelId: string;
|
|
204
|
+
|
|
205
|
+
// Email address where notifications should be sent.
|
|
206
|
+
recipientEmail: string;
|
|
207
|
+
|
|
208
|
+
// Folder path using forward slashes to separate directories.
|
|
209
|
+
outputFolderPath: string;
|
|
210
|
+
|
|
211
|
+
// API key from Dashboard > Settings > API Keys. Generate new key and copy the full string (32-64 chars).
|
|
212
|
+
apiKey: string;
|
|
213
|
+
|
|
214
|
+
// Priority level: 'low' (non-urgent), 'medium' (normal), 'high' (urgent)
|
|
215
|
+
priority?: 'low' | 'medium' | 'high';
|
|
216
|
+
|
|
217
|
+
COMMENT PATTERNS BY TYPE:
|
|
218
|
+
|
|
219
|
+
- URLs/IDs: Explain exact location in URL (after /d/, in query params) - describe the format, not show examples
|
|
220
|
+
- UI IDs: Explain steps to find it (right-click menu, settings page) and format (length, prefix)
|
|
221
|
+
- File paths: Explain format (forward slashes, relative vs absolute) - describe the structure
|
|
222
|
+
- API keys: Explain where to generate (dashboard location) and format (length, appearance)
|
|
223
|
+
- Emails/strings: Explain the format and any validation requirements
|
|
224
|
+
- Enums: List all valid values with brief descriptions
|
|
225
|
+
- Dates: Explain format (ISO 8601, Unix timestamp) and timezone if relevant
|
|
226
|
+
- Arrays: Explain what each item represents and the structure
|
|
227
|
+
|
|
228
|
+
Remember: Example values go in the destructuring default values, NOT in comments!
|
|
229
|
+
|
|
230
|
+
Examples of BAD comments (DO NOT USE):
|
|
231
|
+
// The spreadsheet ID ❌ Too vague
|
|
232
|
+
// User email ❌ No format/explanation
|
|
233
|
+
// API key for authentication ❌ Doesn't tell where to get it
|
|
234
|
+
// Priority level. Defaults to 'medium' ❌ Don't mention defaults in comments
|
|
235
|
+
// Email address. Example: "user@example.com" ❌ Don't include examples in comments - put them in destructuring defaults
|
|
236
|
+
|
|
237
|
+
For example, for a workflow that processes user data and sends notifications:
|
|
238
|
+
|
|
239
|
+
export interface UserNotificationPayload extends WebhookEvent {
|
|
240
|
+
/**
|
|
241
|
+
* Email address where notifications should be sent.
|
|
242
|
+
* @canBeFile false
|
|
243
|
+
*/
|
|
244
|
+
email: string;
|
|
245
|
+
/** Custom message content to include in the notification. */
|
|
246
|
+
message?: string;
|
|
247
|
+
/** Priority level: 'low' (non-urgent), 'medium' (normal), 'high' (urgent) */
|
|
248
|
+
priority?: 'low' | 'medium' | 'high';
|
|
249
|
+
/** Whether to send SMS in addition to email. Set to true to enable SMS notifications, false to only send email. */
|
|
250
|
+
includeSMS?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* The spreadsheet ID is the long string in the URL right after /d/ and before the next / in the URL.
|
|
253
|
+
* @canBeFile false
|
|
254
|
+
*/
|
|
255
|
+
spreadsheetId: string;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const {
|
|
259
|
+
email = 'user@example.com',
|
|
260
|
+
message = 'Welcome to our platform! Thanks for signing up.',
|
|
261
|
+
priority = 'medium',
|
|
262
|
+
spreadsheetId = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms',
|
|
263
|
+
includeSMS = false
|
|
264
|
+
} = payload;
|
|
265
|
+
|
|
266
|
+
CRITICAL: ALWAYS provide example values as default values using the = operator in the destructuring assignment.
|
|
267
|
+
These example values help users understand the expected format. For instance:
|
|
268
|
+
- Google Sheets ID: spreadsheetId = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms'
|
|
269
|
+
- Email: email = 'user@example.com'
|
|
270
|
+
- Channel ID: channelId = 'C01234567AB'
|
|
271
|
+
|
|
272
|
+
REQUIRED vs OPTIONAL FIELD DECISION:
|
|
273
|
+
1. User specified a value in their request → OPTIONAL with that value as default
|
|
274
|
+
(e.g., user says "research AI agents" → topic?: string with default "AI Agents")
|
|
275
|
+
2. Value must change per execution → REQUIRED
|
|
276
|
+
(e.g., recipient email when user says "send me" but doesn't provide one, target URL that varies each run)
|
|
277
|
+
3. Nice-to-have configuration → OPTIONAL
|
|
278
|
+
(e.g., output format preferences, depth settings)
|
|
279
|
+
|
|
280
|
+
The goal is to minimize required fields. If the user already told you what they want, don't make them type it again - use their value as the default.
|
|
281
|
+
When setting schedule, you must take into account of the timezone of the user (don't worry about daylight time, just whatever the current timezone currently) and convert it to UTC offset! The cron expression is in UTC timezone.
|
|
282
|
+
If no particular trigger is specified, use the webhook/http trigger.
|
|
283
|
+
|
|
284
|
+
REMEMBER: Users should be able to fill out inputs without asking questions or looking up documentation. Be thorough and specific!`;
|
|
285
|
+
export const COMMON_DEBUGGING_INSTRUCTIONS = `
|
|
286
|
+
When an error occurs, the issue is most likely with misconfiguration, using the wrong task / model / technique.
|
|
287
|
+
You should carefully observe the data flow and the context to understand what happened.
|
|
288
|
+
|
|
289
|
+
Regarding 404 error for google drive files, remind the user to recreate a new credential and check the "allow all files permission", since by default bubble lab only allows access to files that the user has created on bubble lab.
|
|
290
|
+
Regarding errors reading gmail emails, remind the user to recreate a new credential and check the "allow access to all your email", since by default bubble lab only can only send emails to the user's own email address.
|
|
291
|
+
Regarding JSON parsing for ai-agent, if JSON mode is enabled in ai-agent, the response should be a valid JSON object unless the user's request cannot be fulfilled, then the response should be a text output explaining why it can't perform the task and make it unable to be parsed as JSON.
|
|
292
|
+
Regarding variables not found errors, it is because the system does not yet support complex syntaxes like mapping multiple arrow functions inside loops, etc. Tell the user why and attempt to fix the issue by simplifying the code.
|
|
293
|
+
`;
|
|
53
294
|
export const BUBBLE_SPECIFIC_INSTRUCTIONS = `BUBBLE SPECIFIC INSTRUCTIONS:
|
|
54
295
|
1. When using the storage bubble, always use the bubble-lab-bucket bucket name, unless the user has their own s3/cloudflare bucket setup.
|
|
55
|
-
2. When using the resend bubble,
|
|
296
|
+
2. When using the resend bubble, DO NOT set the 'from' parameter, it will be set automatically and use bubble lab's default email, unless the user has their own resend setup and account domain verified.
|
|
297
|
+
3. When using the ai-agent bubble, always include the model parameter object with the model name and relevant configurations. Set temperature, maxTokens, and other parameters that users might want to adjust for their specific workflow needs.
|
|
298
|
+
4. When using custom apify bubble, always discover the actor and its schema first using the apify bubble, DO NOT use any actor that are not discovered as it could be rented actor and not available to run.
|
|
299
|
+
|
|
300
|
+
BUBBLE COMMENT REQUIREMENTS:
|
|
301
|
+
Place a descriptive comment directly above each bubble instantiation (the \`new BubbleName({...})\` line).
|
|
302
|
+
|
|
303
|
+
CRITICAL: NEVER include step numbers (1., 2., Step 1, etc.) in comments.
|
|
304
|
+
|
|
305
|
+
Write comments as flowing narrative sentences that naturally reveal parameters and their purpose. Describe what the bubble does, weave in how its configuration controls behavior, and when relevant, mention how its output connects to downstream bubbles.
|
|
306
|
+
|
|
307
|
+
The comment should read like documentation that helps users understand both what happens and what they can change to customize behavior.
|
|
308
|
+
|
|
309
|
+
GOOD EXAMPLE:
|
|
310
|
+
\`\`\`typescript
|
|
311
|
+
// Searches for academic papers related to the topic variable and summarizes each one's key findings.
|
|
312
|
+
// The search behavior is controlled by the task prompt - modify it to focus on specific aspects,
|
|
313
|
+
// add date ranges, or filter by publication type. Currently using gemini-3-pro-preview for thorough
|
|
314
|
+
// multi-step research; switch to gemini-2.5-flash if you need faster results with less depth.
|
|
315
|
+
// Returns an array of papers (each with title, url, authors, publicationDate, summary, and
|
|
316
|
+
// relevance explanation) plus an overallSummary that synthesizes all findings for downstream use.
|
|
317
|
+
const researchTool = new ResearchAgentTool({
|
|
318
|
+
task: \`Find research papers about \${topic}...\`,
|
|
319
|
+
model: 'google/gemini-3-pro-preview',
|
|
320
|
+
expectedResultSchema: z.object({...})
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// Takes the papers array and overallSummary from the research results and formats them into
|
|
324
|
+
// a structured report. The template parameter controls the output format - currently set for
|
|
325
|
+
// markdown but can be changed to HTML or plain text. Uses the relevance field from each paper
|
|
326
|
+
// to prioritize which findings appear first in the final document.
|
|
327
|
+
const reportGenerator = new AIAgentBubble({...});
|
|
328
|
+
\`\`\`
|
|
329
|
+
|
|
330
|
+
BAD EXAMPLE:
|
|
331
|
+
\`\`\`typescript
|
|
332
|
+
// 1. Research Agent Tool
|
|
333
|
+
// Performs deep research on the specified topic, finding relevant papers and summarizing them.
|
|
334
|
+
// Using ${RECOMMENDED_MODELS.BEST} for best research capabilities.
|
|
335
|
+
const researchTool = new ResearchAgentTool({...});
|
|
336
|
+
\`\`\`
|
|
337
|
+
❌ Has step number
|
|
338
|
+
❌ Generic description ("performs deep research") - doesn't explain what parameters control
|
|
339
|
+
❌ No mention of output structure or how to customize
|
|
340
|
+
❌ Doesn't connect to how downstream bubbles use the results
|
|
341
|
+
|
|
342
|
+
Comments should enable users to modify behavior without reading external documentation.
|
|
343
|
+
`;
|
|
344
|
+
export const DEBUGGING_INSTRUCTIONS = `
|
|
345
|
+
**WORKFLOW ANALYSIS:**
|
|
346
|
+
- Examine the data flow through each bubble in the workflow
|
|
347
|
+
- Identify bottlenecks where data quality or detail is being lost
|
|
348
|
+
- Trace execution outputs to understand why results are generic vs specific
|
|
349
|
+
- Look for mismatched expectations between data extraction and content generation
|
|
350
|
+
|
|
351
|
+
**QUALITY DETECTION PATTERNS:**
|
|
352
|
+
- Generic language detection: Look for phrases like 'transform', 'leverage', 'paradigm shift' without concrete examples
|
|
353
|
+
- Data density analysis: Check if source material contains sufficient detail for the intended output
|
|
354
|
+
- Schema mismatch: Verify if data extraction schemas are too narrow (e.g., only 'summary' instead of full content)
|
|
355
|
+
- Content specificity: Determine if outputs include concrete examples, technical details, or quantifiable data
|
|
356
|
+
|
|
357
|
+
**ROOT CAUSE ANALYSIS:**
|
|
358
|
+
- When content is generic, trace back to: (1) insufficient source data, (2) poor extraction parameters, or (3) vague prompts
|
|
359
|
+
- Identify if research tools are only pulling URLs/titles/summaries instead of full detailed content
|
|
360
|
+
- Check if AI agent system prompts have enough specificity requirements
|
|
361
|
+
|
|
362
|
+
**PROACTIVE ISSUE IDENTIFICATION:**
|
|
363
|
+
- Before suggesting fixes, analyze: Is the problem in data gathering, processing, or generation?
|
|
364
|
+
- Look for patterns in execution outputs that indicate quality degradation
|
|
365
|
+
- Identify when workflows are producing 'minimum viable content' instead of comprehensive analysis
|
|
366
|
+
|
|
367
|
+
`;
|
|
368
|
+
/**
|
|
369
|
+
* AI Agent behavior and model selection guide
|
|
370
|
+
* Instructions for when to use research-agent-tool and how to select appropriate models
|
|
371
|
+
*/
|
|
372
|
+
export const AI_AGENT_BEHAVIOR_INSTRUCTIONS = `AI AGENT & MODEL SELECTION GUIDE:
|
|
373
|
+
|
|
374
|
+
═══════════════════════════════════════════════════════════════════
|
|
375
|
+
WHEN TO USE RESEARCH-AGENT-TOOL
|
|
376
|
+
═══════════════════════════════════════════════════════════════════
|
|
377
|
+
|
|
378
|
+
USE research-agent-tool when:
|
|
379
|
+
- Task is ambiguous or requires discovering unknown sources
|
|
380
|
+
- Need to explore, compare, or synthesize from multiple websites
|
|
381
|
+
- Market research, competitive analysis, or trend analysis
|
|
382
|
+
- Scraping targets need to be discovered (not explicitly provided)
|
|
383
|
+
|
|
384
|
+
DO NOT use research-agent-tool when:
|
|
385
|
+
- Target URL/website is specific and well-defined
|
|
386
|
+
- Task is deterministic (data transformation, formatting, known API calls)
|
|
387
|
+
- Simple scraping of known pages (use scrape-tool, scrape-site-tool instead)
|
|
388
|
+
|
|
389
|
+
═══════════════════════════════════════════════════════════════════
|
|
390
|
+
MODEL SELECTION
|
|
391
|
+
═══════════════════════════════════════════════════════════════════
|
|
392
|
+
|
|
393
|
+
TIER 1 - BEST (${RECOMMENDED_MODELS.BEST}):
|
|
394
|
+
Use for: Complex reasoning, tool-calling agents, research-agent-tool, code generation,
|
|
395
|
+
high-iteration tasks (50+), critical accuracy requirements
|
|
396
|
+
|
|
397
|
+
TIER 2 - PRO (${RECOMMENDED_MODELS.PRO}, ${RECOMMENDED_MODELS.PRO_ALT}):
|
|
398
|
+
Use for: Multi-step reasoning, strategic planning, complex data analysis
|
|
399
|
+
|
|
400
|
+
TIER 3 - FAST (${RECOMMENDED_MODELS.FAST}, ${RECOMMENDED_MODELS.FAST_ALT}):
|
|
401
|
+
Use for: Summarization, creative writing, document processing, general AI agents,
|
|
402
|
+
data formatting, moderate iterations (10-30), image understanding
|
|
403
|
+
|
|
404
|
+
TIER 4 - LITE (${RECOMMENDED_MODELS.LITE}):
|
|
405
|
+
Use for: Simple text generation, quick formatting, high-volume low-complexity tasks
|
|
406
|
+
|
|
407
|
+
SPECIALIZED:
|
|
408
|
+
- ${RECOMMENDED_MODELS.IMAGE}: Image generation
|
|
409
|
+
- openai/gpt-5, openai/gpt-5-mini: When user explicitly requests OpenAI
|
|
410
|
+
- openrouter models: Experimental/specialized use cases
|
|
411
|
+
|
|
412
|
+
═══════════════════════════════════════════════════════════════════
|
|
413
|
+
DECISION FLOWCHART
|
|
414
|
+
═══════════════════════════════════════════════════════════════════
|
|
415
|
+
|
|
416
|
+
1. User specified model? → Use their choice
|
|
417
|
+
2. Web research needed? → research-agent-tool + ${RECOMMENDED_MODELS.BEST}
|
|
418
|
+
3. AI agent with tools? → ${RECOMMENDED_MODELS.BEST}
|
|
419
|
+
4. Complex reasoning/code gen? → ${RECOMMENDED_MODELS.BEST}
|
|
420
|
+
5. Summary/creative/docs? → ${RECOMMENDED_MODELS.FAST}
|
|
421
|
+
6. Simple text? → ${RECOMMENDED_MODELS.LITE}
|
|
422
|
+
7. Default → ${RECOMMENDED_MODELS.FAST}
|
|
423
|
+
|
|
424
|
+
CRITICAL: User preference ALWAYS overrides these recommendations.
|
|
56
425
|
`;
|
|
57
426
|
//# sourceMappingURL=bubbleflow-generation-prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubbleflow-generation-prompts.js","sourceRoot":"","sources":["../src/bubbleflow-generation-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG
|
|
1
|
+
{"version":3,"file":"bubbleflow-generation-prompts.js","sourceRoot":"","sources":["../src/bubbleflow-generation-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,4CAA4C;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,6BAA6B;IACnC,QAAQ,EAAE,gBAAgB;IAC1B,GAAG,EAAE,+BAA+B;IACpC,OAAO,EAAE,6BAA6B;IACtC,IAAI,EAAE,+BAA+B;IACrC,QAAQ,EAAE,4BAA4B;IACtC,IAAI,EAAE,8BAA8B;IACpC,KAAK,EAAE,mCAAmC;CACT,CAAC;AAEpC,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8FAmDyD,CAAC;AAE/F,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;IAWtC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuC1D,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;sGAUoE,CAAC;AAEvG;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kIA+IyF,CAAC;AAEnI,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;CAQ5C,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAwCjC,kBAAkB,CAAC,IAAI;;;;;;;;;CASjC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBrC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;iBAqB7B,kBAAkB,CAAC,IAAI;;;;gBAIxB,kBAAkB,CAAC,GAAG,KAAK,kBAAkB,CAAC,OAAO;;;iBAGpD,kBAAkB,CAAC,IAAI,KAAK,kBAAkB,CAAC,QAAQ;;;;iBAIvD,kBAAkB,CAAC,IAAI;;;;IAIpC,kBAAkB,CAAC,KAAK;;;;;;;;;kDASsB,kBAAkB,CAAC,IAAI;4BAC7C,kBAAkB,CAAC,IAAI;mCAChB,kBAAkB,CAAC,IAAI;8BAC5B,kBAAkB,CAAC,IAAI;oBACjC,kBAAkB,CAAC,IAAI;eAC5B,kBAAkB,CAAC,IAAI;;;CAGrC,CAAC"}
|