@bubblelab/bubble-core 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/bubble-bundle.d.ts +2021 -0
- package/dist/bubble-factory.d.ts +161 -0
- package/dist/bubble-factory.d.ts.map +1 -0
- package/dist/bubble-factory.js +426 -0
- package/dist/bubble-factory.js.map +1 -0
- package/dist/bubble-flow/bubble-flow-class.d.ts +19 -0
- package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -0
- package/dist/bubble-flow/bubble-flow-class.js +23 -0
- package/dist/bubble-flow/bubble-flow-class.js.map +1 -0
- package/dist/bubble-flow/sample/data-analyst-flow.d.ts +15 -0
- package/dist/bubble-flow/sample/data-analyst-flow.d.ts.map +1 -0
- package/dist/bubble-flow/sample/data-analyst-flow.js +63 -0
- package/dist/bubble-flow/sample/data-analyst-flow.js.map +1 -0
- package/dist/bubble-flow/sample/error-ts.d.ts +23 -0
- package/dist/bubble-flow/sample/error-ts.d.ts.map +1 -0
- package/dist/bubble-flow/sample/error-ts.js +31 -0
- package/dist/bubble-flow/sample/error-ts.js.map +1 -0
- package/dist/bubble-flow/sample/sanitytest.d.ts +10 -0
- package/dist/bubble-flow/sample/sanitytest.d.ts.map +1 -0
- package/dist/bubble-flow/sample/sanitytest.js +13 -0
- package/dist/bubble-flow/sample/sanitytest.js.map +1 -0
- package/dist/bubble-flow/sample/simple-webhook-2.d.ts +19 -0
- package/dist/bubble-flow/sample/simple-webhook-2.d.ts.map +1 -0
- package/dist/bubble-flow/sample/simple-webhook-2.js +23 -0
- package/dist/bubble-flow/sample/simple-webhook-2.js.map +1 -0
- package/dist/bubble-flow/sample/simple-webhook.d.ts +10 -0
- package/dist/bubble-flow/sample/simple-webhook.d.ts.map +1 -0
- package/dist/bubble-flow/sample/simple-webhook.js +18 -0
- package/dist/bubble-flow/sample/simple-webhook.js.map +1 -0
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts +29 -0
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -0
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.js +150 -0
- package/dist/bubble-flow/sample/simplified-data-analysis.flow.js.map +1 -0
- package/dist/bubble-flow/sample/slack-v0.1.d.ts +10 -0
- package/dist/bubble-flow/sample/slack-v0.1.d.ts.map +1 -0
- package/dist/bubble-flow/sample/slack-v0.1.js +59 -0
- package/dist/bubble-flow/sample/slack-v0.1.js.map +1 -0
- package/dist/bubble-flow/sample/slackagenttest.d.ts +10 -0
- package/dist/bubble-flow/sample/slackagenttest.d.ts.map +1 -0
- package/dist/bubble-flow/sample/slackagenttest.js +59 -0
- package/dist/bubble-flow/sample/slackagenttest.js.map +1 -0
- package/dist/bubble-trigger/index.d.ts +2 -0
- package/dist/bubble-trigger/index.d.ts.map +1 -0
- package/dist/bubble-trigger/index.js +2 -0
- package/dist/bubble-trigger/index.js.map +1 -0
- package/dist/bubble-trigger/types.d.ts +87 -0
- package/dist/bubble-trigger/types.d.ts.map +1 -0
- package/dist/bubble-trigger/types.js +14 -0
- package/dist/bubble-trigger/types.js.map +1 -0
- package/dist/bubbles/service-bubble/ai-agent.d.ts +428 -0
- package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/ai-agent.js +881 -0
- package/dist/bubbles/service-bubble/ai-agent.js.map +1 -0
- package/dist/bubbles/service-bubble/gmail.d.ts +3073 -0
- package/dist/bubbles/service-bubble/gmail.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/gmail.js +908 -0
- package/dist/bubbles/service-bubble/gmail.js.map +1 -0
- package/dist/bubbles/service-bubble/google-calendar.d.ts +3377 -0
- package/dist/bubbles/service-bubble/google-calendar.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-calendar.js +527 -0
- package/dist/bubbles/service-bubble/google-calendar.js.map +1 -0
- package/dist/bubbles/service-bubble/google-drive.d.ts +1152 -0
- package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-drive.js +943 -0
- package/dist/bubbles/service-bubble/google-drive.js.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets.d.ts +1811 -0
- package/dist/bubbles/service-bubble/google-sheets.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/google-sheets.js +904 -0
- package/dist/bubbles/service-bubble/google-sheets.js.map +1 -0
- package/dist/bubbles/service-bubble/hello-world.d.ts +74 -0
- package/dist/bubbles/service-bubble/hello-world.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/hello-world.js +67 -0
- package/dist/bubbles/service-bubble/hello-world.js.map +1 -0
- package/dist/bubbles/service-bubble/http.d.ts +134 -0
- package/dist/bubbles/service-bubble/http.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/http.js +184 -0
- package/dist/bubbles/service-bubble/http.js.map +1 -0
- package/dist/bubbles/service-bubble/postgresql.d.ts +180 -0
- package/dist/bubbles/service-bubble/postgresql.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/postgresql.js +448 -0
- package/dist/bubbles/service-bubble/postgresql.js.map +1 -0
- package/dist/bubbles/service-bubble/resend.d.ts +301 -0
- package/dist/bubbles/service-bubble/resend.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/resend.js +253 -0
- package/dist/bubbles/service-bubble/resend.js.map +1 -0
- package/dist/bubbles/service-bubble/slack.d.ts +5869 -0
- package/dist/bubbles/service-bubble/slack.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/slack.js +1536 -0
- package/dist/bubbles/service-bubble/slack.js.map +1 -0
- package/dist/bubbles/service-bubble/storage.d.ts +571 -0
- package/dist/bubbles/service-bubble/storage.d.ts.map +1 -0
- package/dist/bubbles/service-bubble/storage.js +504 -0
- package/dist/bubbles/service-bubble/storage.js.map +1 -0
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +308 -0
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js +285 -0
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +416 -0
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/chart-js-tool.js +570 -0
- package/dist/bubbles/tool-bubble/chart-js-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +99 -0
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +645 -0
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +112 -0
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/list-bubbles-tool.js +82 -0
- package/dist/bubbles/tool-bubble/list-bubbles-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +413 -0
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.js +327 -0
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +122 -0
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/research-agent-tool.js +343 -0
- package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +131 -0
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/sql-query-tool.js +147 -0
- package/dist/bubbles/tool-bubble/sql-query-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/tool-template.d.ts +257 -0
- package/dist/bubbles/tool-bubble/tool-template.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/tool-template.js +238 -0
- package/dist/bubbles/tool-bubble/tool-template.js.map +1 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts +8 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.js +65 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor-example.js.map +1 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts +125 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js +169 -0
- package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +218 -0
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/web-crawl-tool.js +255 -0
- package/dist/bubbles/tool-bubble/web-crawl-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +134 -0
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/web-extract-tool.js +175 -0
- package/dist/bubbles/tool-bubble/web-extract-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +228 -0
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/web-scrape-tool.js +214 -0
- package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -0
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts +134 -0
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -0
- package/dist/bubbles/tool-bubble/web-search-tool.js +155 -0
- package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -0
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +114 -0
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +777 -0
- package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts +97 -0
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js +327 -0
- package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +303 -0
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.js +297 -0
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts +157 -0
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js +310 -0
- package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +543 -0
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/generate-document.workflow.js +628 -0
- package/dist/bubbles/workflow-bubble/generate-document.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +679 -0
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/parse-document.workflow.js +604 -0
- package/dist/bubbles/workflow-bubble/parse-document.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +1011 -0
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +841 -0
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +883 -0
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +781 -0
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +300 -0
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +508 -0
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +731 -0
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +690 -0
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -0
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +401 -0
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +382 -0
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -0
- package/dist/bubbles/workflow-bubble/workflow-template.d.ts +144 -0
- package/dist/bubbles/workflow-bubble/workflow-template.d.ts.map +1 -0
- package/dist/bubbles/workflow-bubble/workflow-template.js +124 -0
- package/dist/bubbles/workflow-bubble/workflow-template.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/BubbleLogger.d.ts +146 -0
- package/dist/logging/BubbleLogger.d.ts.map +1 -0
- package/dist/logging/BubbleLogger.js +472 -0
- package/dist/logging/BubbleLogger.js.map +1 -0
- package/dist/logging/StreamingBubbleLogger.d.ts +85 -0
- package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -0
- package/dist/logging/StreamingBubbleLogger.js +340 -0
- package/dist/logging/StreamingBubbleLogger.js.map +1 -0
- package/dist/types/ai-models.d.ts +4 -0
- package/dist/types/ai-models.d.ts.map +1 -0
- package/dist/types/ai-models.js +14 -0
- package/dist/types/ai-models.js.map +1 -0
- package/dist/types/available-tools.d.ts +4 -0
- package/dist/types/available-tools.d.ts.map +1 -0
- package/dist/types/available-tools.js +19 -0
- package/dist/types/available-tools.js.map +1 -0
- package/dist/types/base-bubble-class.d.ts +47 -0
- package/dist/types/base-bubble-class.d.ts.map +1 -0
- package/dist/types/base-bubble-class.js +212 -0
- package/dist/types/base-bubble-class.js.map +1 -0
- package/dist/types/bubble-errors.d.ts +44 -0
- package/dist/types/bubble-errors.d.ts.map +1 -0
- package/dist/types/bubble-errors.js +51 -0
- package/dist/types/bubble-errors.js.map +1 -0
- package/dist/types/bubble.d.ts +73 -0
- package/dist/types/bubble.d.ts.map +1 -0
- package/dist/types/bubble.js +2 -0
- package/dist/types/bubble.js.map +1 -0
- package/dist/types/credentials.d.ts +6 -0
- package/dist/types/credentials.d.ts.map +1 -0
- package/dist/types/credentials.js +6 -0
- package/dist/types/credentials.js.map +1 -0
- package/dist/types/service-bubble-class.d.ts +31 -0
- package/dist/types/service-bubble-class.d.ts.map +1 -0
- package/dist/types/service-bubble-class.js +36 -0
- package/dist/types/service-bubble-class.js.map +1 -0
- package/dist/types/streaming-events.d.ts +18 -0
- package/dist/types/streaming-events.d.ts.map +1 -0
- package/dist/types/streaming-events.js +5 -0
- package/dist/types/streaming-events.js.map +1 -0
- package/dist/types/tool-bubble-class.d.ts +19 -0
- package/dist/types/tool-bubble-class.d.ts.map +1 -0
- package/dist/types/tool-bubble-class.js +48 -0
- package/dist/types/tool-bubble-class.js.map +1 -0
- package/dist/types/workflow-bubble-class.d.ts +25 -0
- package/dist/types/workflow-bubble-class.d.ts.map +1 -0
- package/dist/types/workflow-bubble-class.js +30 -0
- package/dist/types/workflow-bubble-class.js.map +1 -0
- package/dist/utils/bubbleflow-parser.d.ts +32 -0
- package/dist/utils/bubbleflow-parser.d.ts.map +1 -0
- package/dist/utils/bubbleflow-parser.js +332 -0
- package/dist/utils/bubbleflow-parser.js.map +1 -0
- package/dist/utils/bubbleflow-validation.d.ts +9 -0
- package/dist/utils/bubbleflow-validation.d.ts.map +1 -0
- package/dist/utils/bubbleflow-validation.js +116 -0
- package/dist/utils/bubbleflow-validation.js.map +1 -0
- package/dist/utils/json-parsing.d.ts +20 -0
- package/dist/utils/json-parsing.d.ts.map +1 -0
- package/dist/utils/json-parsing.js +394 -0
- package/dist/utils/json-parsing.js.map +1 -0
- package/dist/utils/mock-data-generator.d.ts +43 -0
- package/dist/utils/mock-data-generator.d.ts.map +1 -0
- package/dist/utils/mock-data-generator.js +312 -0
- package/dist/utils/mock-data-generator.js.map +1 -0
- package/dist/utils/param-helper.d.ts +2 -0
- package/dist/utils/param-helper.d.ts.map +1 -0
- package/dist/utils/param-helper.js +5 -0
- package/dist/utils/param-helper.js.map +1 -0
- package/dist/utils/source-bubble-parser.d.ts +31 -0
- package/dist/utils/source-bubble-parser.d.ts.map +1 -0
- package/dist/utils/source-bubble-parser.js +231 -0
- package/dist/utils/source-bubble-parser.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BUBBLEFLOW VALIDATION TOOL
|
|
3
|
+
*
|
|
4
|
+
* A tool bubble that validates BubbleFlow TypeScript code for syntax, type errors,
|
|
5
|
+
* and bubble structure. Takes TypeScript bubbleflow code as input and outputs
|
|
6
|
+
* validation results including any errors and information about detected bubbles.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - TypeScript syntax validation
|
|
10
|
+
* - BubbleFlow class structure validation
|
|
11
|
+
* - Bubble instantiation parsing and analysis
|
|
12
|
+
* - Detailed error reporting with line numbers
|
|
13
|
+
* - Bubble count and type information
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { ToolBubble } from '../../types/tool-bubble-class.js';
|
|
17
|
+
import type { BubbleContext } from '../../types/bubble.js';
|
|
18
|
+
/**
|
|
19
|
+
* Define the parameters schema using Zod
|
|
20
|
+
* This schema validates and types the input parameters for the validation tool
|
|
21
|
+
*/
|
|
22
|
+
declare const BubbleFlowValidationToolParamsSchema: z.ZodObject<{
|
|
23
|
+
code: z.ZodString;
|
|
24
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
includeDetails: z.ZodDefault<z.ZodBoolean>;
|
|
26
|
+
strictMode: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
includeDetails: boolean;
|
|
29
|
+
strictMode: boolean;
|
|
30
|
+
}, {
|
|
31
|
+
includeDetails?: boolean | undefined;
|
|
32
|
+
strictMode?: boolean | undefined;
|
|
33
|
+
}>>;
|
|
34
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
35
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
code: string;
|
|
38
|
+
options?: {
|
|
39
|
+
includeDetails: boolean;
|
|
40
|
+
strictMode: boolean;
|
|
41
|
+
} | undefined;
|
|
42
|
+
credentials?: Record<string, string> | undefined;
|
|
43
|
+
config?: Record<string, unknown> | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
code: string;
|
|
46
|
+
options?: {
|
|
47
|
+
includeDetails?: boolean | undefined;
|
|
48
|
+
strictMode?: boolean | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
credentials?: Record<string, string> | undefined;
|
|
51
|
+
config?: Record<string, unknown> | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Type definitions derived from schemas
|
|
55
|
+
*/
|
|
56
|
+
type BubbleFlowValidationToolParamsInput = z.input<typeof BubbleFlowValidationToolParamsSchema>;
|
|
57
|
+
type BubbleFlowValidationToolParams = z.output<typeof BubbleFlowValidationToolParamsSchema>;
|
|
58
|
+
type BubbleFlowValidationToolResult = z.output<typeof BubbleFlowValidationToolResultSchema>;
|
|
59
|
+
/**
|
|
60
|
+
* Define the result schema
|
|
61
|
+
* This schema defines what the validation tool returns
|
|
62
|
+
*/
|
|
63
|
+
declare const BubbleFlowValidationToolResultSchema: z.ZodObject<{
|
|
64
|
+
valid: z.ZodBoolean;
|
|
65
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
66
|
+
bubbleCount: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
bubbles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
68
|
+
variableName: z.ZodString;
|
|
69
|
+
bubbleName: z.ZodString;
|
|
70
|
+
className: z.ZodString;
|
|
71
|
+
hasAwait: z.ZodBoolean;
|
|
72
|
+
hasActionCall: z.ZodBoolean;
|
|
73
|
+
parameterCount: z.ZodNumber;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
bubbleName: string;
|
|
76
|
+
variableName: string;
|
|
77
|
+
className: string;
|
|
78
|
+
hasAwait: boolean;
|
|
79
|
+
hasActionCall: boolean;
|
|
80
|
+
parameterCount: number;
|
|
81
|
+
}, {
|
|
82
|
+
bubbleName: string;
|
|
83
|
+
variableName: string;
|
|
84
|
+
className: string;
|
|
85
|
+
hasAwait: boolean;
|
|
86
|
+
hasActionCall: boolean;
|
|
87
|
+
parameterCount: number;
|
|
88
|
+
}>, "many">>;
|
|
89
|
+
metadata: z.ZodObject<{
|
|
90
|
+
validatedAt: z.ZodString;
|
|
91
|
+
codeLength: z.ZodNumber;
|
|
92
|
+
strictMode: z.ZodBoolean;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
strictMode: boolean;
|
|
95
|
+
validatedAt: string;
|
|
96
|
+
codeLength: number;
|
|
97
|
+
}, {
|
|
98
|
+
strictMode: boolean;
|
|
99
|
+
validatedAt: string;
|
|
100
|
+
codeLength: number;
|
|
101
|
+
}>;
|
|
102
|
+
success: z.ZodBoolean;
|
|
103
|
+
error: z.ZodString;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
valid: boolean;
|
|
106
|
+
success: boolean;
|
|
107
|
+
error: string;
|
|
108
|
+
metadata: {
|
|
109
|
+
strictMode: boolean;
|
|
110
|
+
validatedAt: string;
|
|
111
|
+
codeLength: number;
|
|
112
|
+
};
|
|
113
|
+
bubbles?: {
|
|
114
|
+
bubbleName: string;
|
|
115
|
+
variableName: string;
|
|
116
|
+
className: string;
|
|
117
|
+
hasAwait: boolean;
|
|
118
|
+
hasActionCall: boolean;
|
|
119
|
+
parameterCount: number;
|
|
120
|
+
}[] | undefined;
|
|
121
|
+
errors?: string[] | undefined;
|
|
122
|
+
bubbleCount?: number | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
valid: boolean;
|
|
125
|
+
success: boolean;
|
|
126
|
+
error: string;
|
|
127
|
+
metadata: {
|
|
128
|
+
strictMode: boolean;
|
|
129
|
+
validatedAt: string;
|
|
130
|
+
codeLength: number;
|
|
131
|
+
};
|
|
132
|
+
bubbles?: {
|
|
133
|
+
bubbleName: string;
|
|
134
|
+
variableName: string;
|
|
135
|
+
className: string;
|
|
136
|
+
hasAwait: boolean;
|
|
137
|
+
hasActionCall: boolean;
|
|
138
|
+
parameterCount: number;
|
|
139
|
+
}[] | undefined;
|
|
140
|
+
errors?: string[] | undefined;
|
|
141
|
+
bubbleCount?: number | undefined;
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* BubbleFlow Validation Tool
|
|
145
|
+
* Validates TypeScript BubbleFlow code and provides detailed analysis
|
|
146
|
+
*/
|
|
147
|
+
export declare class BubbleFlowValidationTool extends ToolBubble<BubbleFlowValidationToolParams, BubbleFlowValidationToolResult> {
|
|
148
|
+
/**
|
|
149
|
+
* REQUIRED STATIC METADATA
|
|
150
|
+
*/
|
|
151
|
+
static readonly type: "tool";
|
|
152
|
+
static readonly bubbleName = "bubbleflow-validation-tool";
|
|
153
|
+
static readonly schema: z.ZodObject<{
|
|
154
|
+
code: z.ZodString;
|
|
155
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
includeDetails: z.ZodDefault<z.ZodBoolean>;
|
|
157
|
+
strictMode: z.ZodDefault<z.ZodBoolean>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
includeDetails: boolean;
|
|
160
|
+
strictMode: boolean;
|
|
161
|
+
}, {
|
|
162
|
+
includeDetails?: boolean | undefined;
|
|
163
|
+
strictMode?: boolean | undefined;
|
|
164
|
+
}>>;
|
|
165
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
166
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
167
|
+
}, "strip", z.ZodTypeAny, {
|
|
168
|
+
code: string;
|
|
169
|
+
options?: {
|
|
170
|
+
includeDetails: boolean;
|
|
171
|
+
strictMode: boolean;
|
|
172
|
+
} | undefined;
|
|
173
|
+
credentials?: Record<string, string> | undefined;
|
|
174
|
+
config?: Record<string, unknown> | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
code: string;
|
|
177
|
+
options?: {
|
|
178
|
+
includeDetails?: boolean | undefined;
|
|
179
|
+
strictMode?: boolean | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
credentials?: Record<string, string> | undefined;
|
|
182
|
+
config?: Record<string, unknown> | undefined;
|
|
183
|
+
}>;
|
|
184
|
+
static readonly resultSchema: z.ZodObject<{
|
|
185
|
+
valid: z.ZodBoolean;
|
|
186
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
187
|
+
bubbleCount: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
bubbles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
189
|
+
variableName: z.ZodString;
|
|
190
|
+
bubbleName: z.ZodString;
|
|
191
|
+
className: z.ZodString;
|
|
192
|
+
hasAwait: z.ZodBoolean;
|
|
193
|
+
hasActionCall: z.ZodBoolean;
|
|
194
|
+
parameterCount: z.ZodNumber;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
bubbleName: string;
|
|
197
|
+
variableName: string;
|
|
198
|
+
className: string;
|
|
199
|
+
hasAwait: boolean;
|
|
200
|
+
hasActionCall: boolean;
|
|
201
|
+
parameterCount: number;
|
|
202
|
+
}, {
|
|
203
|
+
bubbleName: string;
|
|
204
|
+
variableName: string;
|
|
205
|
+
className: string;
|
|
206
|
+
hasAwait: boolean;
|
|
207
|
+
hasActionCall: boolean;
|
|
208
|
+
parameterCount: number;
|
|
209
|
+
}>, "many">>;
|
|
210
|
+
metadata: z.ZodObject<{
|
|
211
|
+
validatedAt: z.ZodString;
|
|
212
|
+
codeLength: z.ZodNumber;
|
|
213
|
+
strictMode: z.ZodBoolean;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
strictMode: boolean;
|
|
216
|
+
validatedAt: string;
|
|
217
|
+
codeLength: number;
|
|
218
|
+
}, {
|
|
219
|
+
strictMode: boolean;
|
|
220
|
+
validatedAt: string;
|
|
221
|
+
codeLength: number;
|
|
222
|
+
}>;
|
|
223
|
+
success: z.ZodBoolean;
|
|
224
|
+
error: z.ZodString;
|
|
225
|
+
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
valid: boolean;
|
|
227
|
+
success: boolean;
|
|
228
|
+
error: string;
|
|
229
|
+
metadata: {
|
|
230
|
+
strictMode: boolean;
|
|
231
|
+
validatedAt: string;
|
|
232
|
+
codeLength: number;
|
|
233
|
+
};
|
|
234
|
+
bubbles?: {
|
|
235
|
+
bubbleName: string;
|
|
236
|
+
variableName: string;
|
|
237
|
+
className: string;
|
|
238
|
+
hasAwait: boolean;
|
|
239
|
+
hasActionCall: boolean;
|
|
240
|
+
parameterCount: number;
|
|
241
|
+
}[] | undefined;
|
|
242
|
+
errors?: string[] | undefined;
|
|
243
|
+
bubbleCount?: number | undefined;
|
|
244
|
+
}, {
|
|
245
|
+
valid: boolean;
|
|
246
|
+
success: boolean;
|
|
247
|
+
error: string;
|
|
248
|
+
metadata: {
|
|
249
|
+
strictMode: boolean;
|
|
250
|
+
validatedAt: string;
|
|
251
|
+
codeLength: number;
|
|
252
|
+
};
|
|
253
|
+
bubbles?: {
|
|
254
|
+
bubbleName: string;
|
|
255
|
+
variableName: string;
|
|
256
|
+
className: string;
|
|
257
|
+
hasAwait: boolean;
|
|
258
|
+
hasActionCall: boolean;
|
|
259
|
+
parameterCount: number;
|
|
260
|
+
}[] | undefined;
|
|
261
|
+
errors?: string[] | undefined;
|
|
262
|
+
bubbleCount?: number | undefined;
|
|
263
|
+
}>;
|
|
264
|
+
static readonly shortDescription = "Validates BubbleFlow TypeScript code for syntax and structure";
|
|
265
|
+
static readonly longDescription = "\n A comprehensive validation tool for BubbleFlow TypeScript code.\n \n What it does:\n - Validates TypeScript syntax and compilation\n - Checks BubbleFlow class structure and requirements\n - Parses and analyzes bubble instantiations\n - Provides detailed error reporting with line numbers\n - Returns metadata about detected bubbles\n \n How it works:\n - Uses TypeScript compiler API for syntax validation\n - Validates that code extends BubbleFlow and has handle method\n - Parses bubble instantiations using AST analysis\n - Maps bubble class names to registered bubble types\n \n Use cases:\n - When an AI agent needs to validate user-provided BubbleFlow code\n - When checking code before execution or deployment\n - When providing feedback on BubbleFlow implementation\n - When analyzing bubble usage patterns in code\n ";
|
|
266
|
+
static readonly alias = "validate-bubbleflow";
|
|
267
|
+
private bubbleFactory;
|
|
268
|
+
/**
|
|
269
|
+
* Constructor
|
|
270
|
+
*/
|
|
271
|
+
constructor(params: BubbleFlowValidationToolParamsInput, context?: BubbleContext);
|
|
272
|
+
private initializeBubbleFactory;
|
|
273
|
+
/**
|
|
274
|
+
* Main action method - performs BubbleFlow validation
|
|
275
|
+
*/
|
|
276
|
+
performAction(context?: BubbleContext): Promise<BubbleFlowValidationToolResult>;
|
|
277
|
+
}
|
|
278
|
+
export {};
|
|
279
|
+
/**
|
|
280
|
+
* REGISTRATION AND USAGE
|
|
281
|
+
*
|
|
282
|
+
* 1. Register the tool in the BubbleFactory:
|
|
283
|
+
* ```typescript
|
|
284
|
+
* import { BubbleFlowValidationTool } from './services/bubbleflow-validation-tool.js';
|
|
285
|
+
*
|
|
286
|
+
* // In registerDefaults() method:
|
|
287
|
+
* this.register('bubbleflow-validation', BubbleFlowValidationTool as BubbleClassWithMetadata);
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* 2. Direct usage:
|
|
291
|
+
* ```typescript
|
|
292
|
+
* const tool = new BubbleFlowValidationTool({
|
|
293
|
+
* code: 'export class TestFlow extends BubbleFlow<"webhook/http"> { ... }',
|
|
294
|
+
* options: { includeDetails: true }
|
|
295
|
+
* });
|
|
296
|
+
* const result = await tool.action();
|
|
297
|
+
* ```
|
|
298
|
+
*
|
|
299
|
+
* 3. AI Agent usage:
|
|
300
|
+
* ```typescript
|
|
301
|
+
* // AI agent calls with:
|
|
302
|
+
* {
|
|
303
|
+
* "code": "export class TestFlow extends BubbleFlow<'webhook/http'> { ... }",
|
|
304
|
+
* "options": { "includeDetails": true, "strictMode": true }
|
|
305
|
+
* }
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
//# sourceMappingURL=bubbleflow-validation-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bubbleflow-validation-tool.d.ts","sourceRoot":"","sources":["../../../src/bubbles/tool-bubble/bubbleflow-validation-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAQ3D;;;GAGG;A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AAC;CAgH3C;;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BUBBLEFLOW VALIDATION TOOL
|
|
3
|
+
*
|
|
4
|
+
* A tool bubble that validates BubbleFlow TypeScript code for syntax, type errors,
|
|
5
|
+
* and bubble structure. Takes TypeScript bubbleflow code as input and outputs
|
|
6
|
+
* validation results including any errors and information about detected bubbles.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - TypeScript syntax validation
|
|
10
|
+
* - BubbleFlow class structure validation
|
|
11
|
+
* - Bubble instantiation parsing and analysis
|
|
12
|
+
* - Detailed error reporting with line numbers
|
|
13
|
+
* - Bubble count and type information
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { ToolBubble } from '../../types/tool-bubble-class.js';
|
|
17
|
+
import { BubbleFactory } from '../../bubble-factory.js';
|
|
18
|
+
import { validateBubbleFlow, } from '../../utils/bubbleflow-validation.js';
|
|
19
|
+
import { parseBubbleFlow } from '../../utils/bubbleflow-parser.js';
|
|
20
|
+
/**
|
|
21
|
+
* Define the parameters schema using Zod
|
|
22
|
+
* This schema validates and types the input parameters for the validation tool
|
|
23
|
+
*/
|
|
24
|
+
const BubbleFlowValidationToolParamsSchema = z.object({
|
|
25
|
+
// The TypeScript code to validate
|
|
26
|
+
code: z.string().describe('TypeScript code to validate'),
|
|
27
|
+
// Optional validation options
|
|
28
|
+
options: z
|
|
29
|
+
.object({
|
|
30
|
+
includeDetails: z
|
|
31
|
+
.boolean()
|
|
32
|
+
.default(true)
|
|
33
|
+
.describe('Include detailed bubble analysis'),
|
|
34
|
+
strictMode: z
|
|
35
|
+
.boolean()
|
|
36
|
+
.default(true)
|
|
37
|
+
.describe('Enable strict TypeScript validation'),
|
|
38
|
+
})
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('Validation configuration options'),
|
|
41
|
+
// Credentials (not needed for this tool but following template)
|
|
42
|
+
credentials: z
|
|
43
|
+
.record(z.string(), z.string())
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Credentials (HIDDEN from AI - injected at runtime)'),
|
|
46
|
+
// Optional configuration
|
|
47
|
+
config: z
|
|
48
|
+
.record(z.string(), z.unknown())
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('Configuration for the validation tool (HIDDEN from AI - injected at runtime)'),
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Define the result schema
|
|
54
|
+
* This schema defines what the validation tool returns
|
|
55
|
+
*/
|
|
56
|
+
const BubbleFlowValidationToolResultSchema = z.object({
|
|
57
|
+
// Validation results
|
|
58
|
+
valid: z.boolean().describe('Whether the code is valid'),
|
|
59
|
+
errors: z
|
|
60
|
+
.array(z.string())
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('List of validation errors if any'),
|
|
63
|
+
// Bubble analysis (when validation succeeds)
|
|
64
|
+
bubbleCount: z
|
|
65
|
+
.number()
|
|
66
|
+
.optional()
|
|
67
|
+
.describe('Number of bubbles found in the code'),
|
|
68
|
+
bubbles: z
|
|
69
|
+
.array(z.object({
|
|
70
|
+
variableName: z
|
|
71
|
+
.string()
|
|
72
|
+
.describe('Variable name assigned to the bubble'),
|
|
73
|
+
bubbleName: z
|
|
74
|
+
.string()
|
|
75
|
+
.describe('Type of bubble (e.g., postgresql, slack)'),
|
|
76
|
+
className: z
|
|
77
|
+
.string()
|
|
78
|
+
.describe('Bubble class name (e.g., PostgreSQLBubble)'),
|
|
79
|
+
hasAwait: z.boolean().describe('Whether the bubble call is awaited'),
|
|
80
|
+
hasActionCall: z.boolean().describe('Whether .action() is called'),
|
|
81
|
+
parameterCount: z
|
|
82
|
+
.number()
|
|
83
|
+
.describe('Number of parameters passed to the bubble'),
|
|
84
|
+
}))
|
|
85
|
+
.optional()
|
|
86
|
+
.describe('Details about each bubble found'),
|
|
87
|
+
// Metadata
|
|
88
|
+
metadata: z.object({
|
|
89
|
+
validatedAt: z.string().describe('Timestamp when validation was performed'),
|
|
90
|
+
codeLength: z.number().describe('Length of the code in characters'),
|
|
91
|
+
strictMode: z.boolean().describe('Whether strict mode was used'),
|
|
92
|
+
}),
|
|
93
|
+
// Standard result fields
|
|
94
|
+
success: z
|
|
95
|
+
.boolean()
|
|
96
|
+
.describe('Whether the validation operation was successful'),
|
|
97
|
+
error: z.string().describe('Error message if validation failed'),
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* BubbleFlow Validation Tool
|
|
101
|
+
* Validates TypeScript BubbleFlow code and provides detailed analysis
|
|
102
|
+
*/
|
|
103
|
+
export class BubbleFlowValidationTool extends ToolBubble {
|
|
104
|
+
/**
|
|
105
|
+
* REQUIRED STATIC METADATA
|
|
106
|
+
*/
|
|
107
|
+
// Bubble type - always 'tool' for tool bubbles
|
|
108
|
+
static type = 'tool';
|
|
109
|
+
// Unique identifier for the tool
|
|
110
|
+
static bubbleName = 'bubbleflow-validation-tool';
|
|
111
|
+
// Schemas for validation
|
|
112
|
+
static schema = BubbleFlowValidationToolParamsSchema;
|
|
113
|
+
static resultSchema = BubbleFlowValidationToolResultSchema;
|
|
114
|
+
// Short description
|
|
115
|
+
static shortDescription = 'Validates BubbleFlow TypeScript code for syntax and structure';
|
|
116
|
+
// Long description with detailed information
|
|
117
|
+
static longDescription = `
|
|
118
|
+
A comprehensive validation tool for BubbleFlow TypeScript code.
|
|
119
|
+
|
|
120
|
+
What it does:
|
|
121
|
+
- Validates TypeScript syntax and compilation
|
|
122
|
+
- Checks BubbleFlow class structure and requirements
|
|
123
|
+
- Parses and analyzes bubble instantiations
|
|
124
|
+
- Provides detailed error reporting with line numbers
|
|
125
|
+
- Returns metadata about detected bubbles
|
|
126
|
+
|
|
127
|
+
How it works:
|
|
128
|
+
- Uses TypeScript compiler API for syntax validation
|
|
129
|
+
- Validates that code extends BubbleFlow and has handle method
|
|
130
|
+
- Parses bubble instantiations using AST analysis
|
|
131
|
+
- Maps bubble class names to registered bubble types
|
|
132
|
+
|
|
133
|
+
Use cases:
|
|
134
|
+
- When an AI agent needs to validate user-provided BubbleFlow code
|
|
135
|
+
- When checking code before execution or deployment
|
|
136
|
+
- When providing feedback on BubbleFlow implementation
|
|
137
|
+
- When analyzing bubble usage patterns in code
|
|
138
|
+
`;
|
|
139
|
+
// Short alias for the tool
|
|
140
|
+
static alias = 'validate-bubbleflow';
|
|
141
|
+
bubbleFactory;
|
|
142
|
+
/**
|
|
143
|
+
* Constructor
|
|
144
|
+
*/
|
|
145
|
+
constructor(params, context) {
|
|
146
|
+
super(params, context);
|
|
147
|
+
this.bubbleFactory = new BubbleFactory();
|
|
148
|
+
// Initialize with defaults for bubble class registry - this is async but we need to handle it
|
|
149
|
+
this.initializeBubbleFactory();
|
|
150
|
+
}
|
|
151
|
+
async initializeBubbleFactory() {
|
|
152
|
+
await this.bubbleFactory.registerDefaults();
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Main action method - performs BubbleFlow validation
|
|
156
|
+
*/
|
|
157
|
+
async performAction(context) {
|
|
158
|
+
// Context is available but not used in this tool
|
|
159
|
+
void context;
|
|
160
|
+
try {
|
|
161
|
+
// Ensure BubbleFactory is initialized before validation
|
|
162
|
+
await this.bubbleFactory.registerDefaults();
|
|
163
|
+
// Extract parameters
|
|
164
|
+
const { code, options } = this.params;
|
|
165
|
+
const includeDetails = options?.includeDetails ?? true;
|
|
166
|
+
const strictMode = options?.strictMode ?? true;
|
|
167
|
+
if (!code || code.trim().length === 0) {
|
|
168
|
+
return {
|
|
169
|
+
valid: false,
|
|
170
|
+
errors: ['Code cannot be empty'],
|
|
171
|
+
metadata: {
|
|
172
|
+
validatedAt: new Date().toISOString(),
|
|
173
|
+
codeLength: 0,
|
|
174
|
+
strictMode,
|
|
175
|
+
},
|
|
176
|
+
success: false,
|
|
177
|
+
error: 'Code cannot be empty',
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
// Perform TypeScript validation
|
|
181
|
+
const validationResult = await validateBubbleFlow(code, this.bubbleFactory);
|
|
182
|
+
if (!validationResult.valid) {
|
|
183
|
+
return {
|
|
184
|
+
valid: false,
|
|
185
|
+
errors: validationResult.errors || ['Unknown validation error'],
|
|
186
|
+
metadata: {
|
|
187
|
+
validatedAt: new Date().toISOString(),
|
|
188
|
+
codeLength: code.length,
|
|
189
|
+
strictMode,
|
|
190
|
+
},
|
|
191
|
+
success: false,
|
|
192
|
+
error: `Validation failed: ${validationResult.errors?.[0] || 'Unknown error'}`,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
// If validation passes and details are requested, parse bubbles
|
|
196
|
+
let bubbleDetails;
|
|
197
|
+
let bubbleCount = 0;
|
|
198
|
+
if (includeDetails) {
|
|
199
|
+
const parseResult = parseBubbleFlow(code, this.bubbleFactory);
|
|
200
|
+
if (!parseResult.success) {
|
|
201
|
+
return {
|
|
202
|
+
valid: false,
|
|
203
|
+
errors: parseResult.errors || ['Failed to parse bubble details'],
|
|
204
|
+
metadata: {
|
|
205
|
+
validatedAt: new Date().toISOString(),
|
|
206
|
+
codeLength: code.length,
|
|
207
|
+
strictMode,
|
|
208
|
+
},
|
|
209
|
+
success: false,
|
|
210
|
+
error: `Bubble parsing failed: ${parseResult.errors?.[0] || 'Unknown error'}`,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
bubbleCount = Object.keys(parseResult.bubbles).length;
|
|
214
|
+
// Transform parsed bubbles to result format
|
|
215
|
+
bubbleDetails = Object.values(parseResult.bubbles).map((bubble) => ({
|
|
216
|
+
variableName: bubble.variableName,
|
|
217
|
+
bubbleName: bubble.bubbleName,
|
|
218
|
+
className: bubble.className,
|
|
219
|
+
hasAwait: bubble.hasAwait,
|
|
220
|
+
hasActionCall: bubble.hasActionCall,
|
|
221
|
+
parameterCount: bubble.parameters.length,
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
// Return successful result
|
|
225
|
+
return {
|
|
226
|
+
valid: true,
|
|
227
|
+
bubbleCount,
|
|
228
|
+
bubbles: bubbleDetails,
|
|
229
|
+
metadata: {
|
|
230
|
+
validatedAt: new Date().toISOString(),
|
|
231
|
+
codeLength: code.length,
|
|
232
|
+
strictMode,
|
|
233
|
+
},
|
|
234
|
+
success: true,
|
|
235
|
+
error: '',
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
// Handle unexpected errors gracefully
|
|
240
|
+
return {
|
|
241
|
+
valid: false,
|
|
242
|
+
errors: [
|
|
243
|
+
error instanceof Error ? error.message : 'Unknown validation error',
|
|
244
|
+
],
|
|
245
|
+
metadata: {
|
|
246
|
+
validatedAt: new Date().toISOString(),
|
|
247
|
+
codeLength: this.params.code?.length || 0,
|
|
248
|
+
strictMode: this.params.options?.strictMode ?? true,
|
|
249
|
+
},
|
|
250
|
+
success: false,
|
|
251
|
+
error: error instanceof Error ? error.message : 'Unknown validation error',
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* REGISTRATION AND USAGE
|
|
258
|
+
*
|
|
259
|
+
* 1. Register the tool in the BubbleFactory:
|
|
260
|
+
* ```typescript
|
|
261
|
+
* import { BubbleFlowValidationTool } from './services/bubbleflow-validation-tool.js';
|
|
262
|
+
*
|
|
263
|
+
* // In registerDefaults() method:
|
|
264
|
+
* this.register('bubbleflow-validation', BubbleFlowValidationTool as BubbleClassWithMetadata);
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* 2. Direct usage:
|
|
268
|
+
* ```typescript
|
|
269
|
+
* const tool = new BubbleFlowValidationTool({
|
|
270
|
+
* code: 'export class TestFlow extends BubbleFlow<"webhook/http"> { ... }',
|
|
271
|
+
* options: { includeDetails: true }
|
|
272
|
+
* });
|
|
273
|
+
* const result = await tool.action();
|
|
274
|
+
* ```
|
|
275
|
+
*
|
|
276
|
+
* 3. AI Agent usage:
|
|
277
|
+
* ```typescript
|
|
278
|
+
* // AI agent calls with:
|
|
279
|
+
* {
|
|
280
|
+
* "code": "export class TestFlow extends BubbleFlow<'webhook/http'> { ... }",
|
|
281
|
+
* "options": { "includeDetails": true, "strictMode": true }
|
|
282
|
+
* }
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
//# sourceMappingURL=bubbleflow-validation-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bubbleflow-validation-tool.js","sourceRoot":"","sources":["../../../src/bubbles/tool-bubble/bubbleflow-validation-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,kBAAkB,GAEnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE;;;GAGG;AACH,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,kCAAkC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAExD,8BAA8B;IAC9B,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,cAAc,EAAE,CAAC;aACd,OAAO,EAAE;aACT,OAAO,CAAC,IAAI,CAAC;aACb,QAAQ,CAAC,kCAAkC,CAAC;QAC/C,UAAU,EAAE,CAAC;aACV,OAAO,EAAE;aACT,OAAO,CAAC,IAAI,CAAC;aACb,QAAQ,CAAC,qCAAqC,CAAC;KACnD,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,kCAAkC,CAAC;IAE/C,gEAAgE;IAChE,WAAW,EAAE,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;S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