@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,382 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
|
|
3
|
+
import { SlackBubble } from '../service-bubble/slack.js';
|
|
4
|
+
import { AIAgentBubble } from '../service-bubble/ai-agent.js';
|
|
5
|
+
import { AvailableModels } from '../../types/ai-models.js';
|
|
6
|
+
import { CredentialType, } from '@bubblelab/shared-schemas';
|
|
7
|
+
// Parameter schema with user-friendly names and clear descriptions
|
|
8
|
+
const SlackNotifierParamsSchema = z.object({
|
|
9
|
+
/**
|
|
10
|
+
* The raw data or content to be formatted for Slack notification
|
|
11
|
+
*/
|
|
12
|
+
contentToFormat: z
|
|
13
|
+
.string()
|
|
14
|
+
.describe('Raw content or data to format for Slack'),
|
|
15
|
+
/**
|
|
16
|
+
* The original user query or context that generated this content
|
|
17
|
+
*/
|
|
18
|
+
originalUserQuery: z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Original user question or context'),
|
|
22
|
+
/**
|
|
23
|
+
* Target Slack channel name (without #) or channel ID
|
|
24
|
+
*/
|
|
25
|
+
targetChannel: z
|
|
26
|
+
.string()
|
|
27
|
+
.describe('Slack channel name (without #) or channel ID'),
|
|
28
|
+
/**
|
|
29
|
+
* Optional custom message title/header for the notification
|
|
30
|
+
*/
|
|
31
|
+
messageTitle: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Custom title for the Slack message'),
|
|
35
|
+
/**
|
|
36
|
+
* Tone and style for the AI formatting (professional, casual, technical, etc.)
|
|
37
|
+
*/
|
|
38
|
+
messageStyle: z
|
|
39
|
+
.enum(['professional', 'casual', 'technical', 'concise', 'detailed'])
|
|
40
|
+
.default('professional')
|
|
41
|
+
.describe('Style and tone for message formatting'),
|
|
42
|
+
/**
|
|
43
|
+
* Whether to include emojis and rich formatting in the message
|
|
44
|
+
*/
|
|
45
|
+
includeFormatting: z
|
|
46
|
+
.boolean()
|
|
47
|
+
.default(true)
|
|
48
|
+
.describe('Include emojis and rich Slack formatting'),
|
|
49
|
+
/**
|
|
50
|
+
* Maximum message length (Slack has limits)
|
|
51
|
+
*/
|
|
52
|
+
maxMessageLength: z
|
|
53
|
+
.number()
|
|
54
|
+
.default(3000)
|
|
55
|
+
.describe('Maximum message length for Slack'),
|
|
56
|
+
/**
|
|
57
|
+
* AI model configuration for content formatting
|
|
58
|
+
*/
|
|
59
|
+
aiModel: z
|
|
60
|
+
.object({
|
|
61
|
+
model: AvailableModels.default('google/gemini-2.5-flash'),
|
|
62
|
+
temperature: z.number().min(0).max(1).default(0.3),
|
|
63
|
+
maxTokens: z.number().default(50000),
|
|
64
|
+
})
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('AI model settings for content formatting'),
|
|
67
|
+
/**
|
|
68
|
+
* Injected credentials from the system
|
|
69
|
+
*/
|
|
70
|
+
credentials: z
|
|
71
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
74
|
+
});
|
|
75
|
+
// Result schema with notification delivery information
|
|
76
|
+
const SlackNotifierResultSchema = z.object({
|
|
77
|
+
success: z.boolean(),
|
|
78
|
+
error: z.string(),
|
|
79
|
+
/**
|
|
80
|
+
* Information about the sent Slack message
|
|
81
|
+
*/
|
|
82
|
+
messageInfo: z
|
|
83
|
+
.object({
|
|
84
|
+
/**
|
|
85
|
+
* Slack message timestamp (unique identifier)
|
|
86
|
+
*/
|
|
87
|
+
messageTimestamp: z.string().optional(),
|
|
88
|
+
/**
|
|
89
|
+
* Channel ID where message was sent
|
|
90
|
+
*/
|
|
91
|
+
channelId: z.string().optional(),
|
|
92
|
+
/**
|
|
93
|
+
* Channel name where message was sent
|
|
94
|
+
*/
|
|
95
|
+
channelName: z.string().optional(),
|
|
96
|
+
/**
|
|
97
|
+
* The formatted message that was sent
|
|
98
|
+
*/
|
|
99
|
+
formattedMessage: z.string().optional(),
|
|
100
|
+
/**
|
|
101
|
+
* Message length in characters
|
|
102
|
+
*/
|
|
103
|
+
messageLength: z.number().optional(),
|
|
104
|
+
})
|
|
105
|
+
.optional(),
|
|
106
|
+
/**
|
|
107
|
+
* AI formatting process information
|
|
108
|
+
*/
|
|
109
|
+
formattingInfo: z
|
|
110
|
+
.object({
|
|
111
|
+
/**
|
|
112
|
+
* AI model used for formatting
|
|
113
|
+
*/
|
|
114
|
+
modelUsed: z.string().optional(),
|
|
115
|
+
/**
|
|
116
|
+
* Whether content was truncated due to length limits
|
|
117
|
+
*/
|
|
118
|
+
wasTruncated: z.boolean().default(false),
|
|
119
|
+
/**
|
|
120
|
+
* Original content length before formatting
|
|
121
|
+
*/
|
|
122
|
+
originalLength: z.number().optional(),
|
|
123
|
+
})
|
|
124
|
+
.optional(),
|
|
125
|
+
});
|
|
126
|
+
/**
|
|
127
|
+
* SlackNotifierWorkflowBubble - Your personal data analyst for Slack communications
|
|
128
|
+
*
|
|
129
|
+
* This workflow bubble acts like a seasoned data analyst who transforms raw information
|
|
130
|
+
* into compelling, actionable Slack messages that your team will actually want to read:
|
|
131
|
+
*
|
|
132
|
+
* 1. **Analyzes content** - Spots patterns, key insights, and business implications
|
|
133
|
+
* 2. **Tells the story** - Converts dry data into engaging narratives with context
|
|
134
|
+
* 3. **Makes it actionable** - Provides recommendations and next steps
|
|
135
|
+
* 4. **Delivers naturally** - Uses conversational, human-like communication style
|
|
136
|
+
* 5. **Handles logistics** - Finds channels and manages message delivery
|
|
137
|
+
*
|
|
138
|
+
* Perfect for:
|
|
139
|
+
* - Sharing analysis results that drive decisions
|
|
140
|
+
* - Automated insights that feel personally crafted
|
|
141
|
+
* - Business intelligence updates with personality
|
|
142
|
+
* - Data discoveries that need immediate attention
|
|
143
|
+
* - Reports that people actually read and act on
|
|
144
|
+
*/
|
|
145
|
+
export class SlackNotifierWorkflowBubble extends WorkflowBubble {
|
|
146
|
+
static bubbleName = 'slack-notifier';
|
|
147
|
+
static schema = SlackNotifierParamsSchema;
|
|
148
|
+
static resultSchema = SlackNotifierResultSchema;
|
|
149
|
+
static shortDescription = 'Data analyst-powered Slack notifications that tell compelling stories';
|
|
150
|
+
static longDescription = 'Transforms raw data and insights into engaging, conversational Slack messages that colleagues actually want to read. Uses AI with a data analyst personality to spot patterns, provide context, and make information actionable. Perfect for sharing analysis results, automated reports, and business intelligence updates with natural, human-like communication.';
|
|
151
|
+
static alias = 'notify-slack';
|
|
152
|
+
static type = 'workflow';
|
|
153
|
+
constructor(params, context) {
|
|
154
|
+
super(params, context);
|
|
155
|
+
}
|
|
156
|
+
async performAction() {
|
|
157
|
+
const { contentToFormat, originalUserQuery, targetChannel, messageTitle, messageStyle, includeFormatting, maxMessageLength, aiModel, credentials, } = this.params;
|
|
158
|
+
try {
|
|
159
|
+
console.log(`[SlackNotifier] Starting notification workflow for channel: ${targetChannel}`);
|
|
160
|
+
// Step 1: Find the target Slack channel
|
|
161
|
+
console.log('[SlackNotifier] Finding target Slack channel...');
|
|
162
|
+
const channelResult = await this.findSlackChannel(targetChannel, credentials);
|
|
163
|
+
if (!channelResult.success) {
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
error: channelResult.error,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// Step 2: Format the content using AI
|
|
170
|
+
console.log('[SlackNotifier] Formatting content with AI...');
|
|
171
|
+
const formattingResult = await this.formatContentWithAI(contentToFormat, originalUserQuery, messageTitle, messageStyle, includeFormatting, maxMessageLength, aiModel, credentials);
|
|
172
|
+
if (!formattingResult.success) {
|
|
173
|
+
return {
|
|
174
|
+
success: false,
|
|
175
|
+
error: formattingResult.error,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
// Step 3: Send the formatted message to Slack
|
|
179
|
+
console.log('[SlackNotifier] Sending message to Slack...');
|
|
180
|
+
const sendResult = await this.sendToSlack(channelResult.channelId, formattingResult.formattedMessage, credentials);
|
|
181
|
+
if (!sendResult.success) {
|
|
182
|
+
return {
|
|
183
|
+
success: false,
|
|
184
|
+
error: sendResult.error,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
console.log('[SlackNotifier] Notification workflow completed successfully');
|
|
188
|
+
return {
|
|
189
|
+
success: true,
|
|
190
|
+
error: '',
|
|
191
|
+
messageInfo: {
|
|
192
|
+
messageTimestamp: sendResult.messageTimestamp,
|
|
193
|
+
channelId: channelResult.channelId,
|
|
194
|
+
channelName: channelResult.channelName,
|
|
195
|
+
formattedMessage: formattingResult.formattedMessage,
|
|
196
|
+
messageLength: formattingResult.formattedMessage?.length || 0,
|
|
197
|
+
},
|
|
198
|
+
formattingInfo: {
|
|
199
|
+
modelUsed: aiModel?.model || 'google/gemini-2.5-flash',
|
|
200
|
+
wasTruncated: formattingResult.wasTruncated ?? false,
|
|
201
|
+
originalLength: contentToFormat.length,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
console.error('[SlackNotifier] Workflow execution failed:', error);
|
|
207
|
+
return {
|
|
208
|
+
success: false,
|
|
209
|
+
error: `Slack notification workflow failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Find the target Slack channel by name or ID
|
|
215
|
+
*/
|
|
216
|
+
async findSlackChannel(targetChannel, credentials) {
|
|
217
|
+
try {
|
|
218
|
+
const slackBubble = new SlackBubble({
|
|
219
|
+
operation: 'list_channels',
|
|
220
|
+
...(credentials && { credentials }),
|
|
221
|
+
}, this.context);
|
|
222
|
+
const channelsResult = await slackBubble.action();
|
|
223
|
+
if (!channelsResult.success) {
|
|
224
|
+
return {
|
|
225
|
+
success: false,
|
|
226
|
+
error: `Failed to list Slack channels: ${channelsResult.error}`,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
const channels = channelsResult.data?.channels;
|
|
230
|
+
if (!channels) {
|
|
231
|
+
return {
|
|
232
|
+
success: false,
|
|
233
|
+
error: 'No channels data received from Slack',
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
// Try to find channel by name first, then by ID
|
|
237
|
+
let targetChannelObj = channels.find((channel) => channel.name === targetChannel);
|
|
238
|
+
if (!targetChannelObj) {
|
|
239
|
+
targetChannelObj = channels.find((channel) => channel.id === targetChannel);
|
|
240
|
+
}
|
|
241
|
+
if (!targetChannelObj) {
|
|
242
|
+
const availableChannels = channels.map((c) => c.name).join(', ');
|
|
243
|
+
return {
|
|
244
|
+
success: false,
|
|
245
|
+
error: `Channel '${targetChannel}' not found. Available channels: ${availableChannels}`,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
success: true,
|
|
250
|
+
channelId: targetChannelObj.id,
|
|
251
|
+
channelName: targetChannelObj.name,
|
|
252
|
+
error: '',
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
return {
|
|
257
|
+
success: false,
|
|
258
|
+
error: `Channel discovery failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Format content using AI for better Slack presentation
|
|
264
|
+
*/
|
|
265
|
+
async formatContentWithAI(content, userQuery, title, style = 'professional', includeFormatting = true, maxLength = 3000, aiModel, credentials) {
|
|
266
|
+
try {
|
|
267
|
+
// Build the formatting prompt based on style and requirements
|
|
268
|
+
const formatPrompt = this.buildFormattingPrompt(content, userQuery, title, style, includeFormatting, maxLength);
|
|
269
|
+
const aiAgentBubble = new AIAgentBubble({
|
|
270
|
+
message: formatPrompt,
|
|
271
|
+
systemPrompt: `You're a seasoned data analyst who loves turning complex information into clear, actionable insights for your team. You have a knack for:
|
|
272
|
+
|
|
273
|
+
• **Spotting the story in data** - You don't just present numbers, you explain what they mean and why they matter
|
|
274
|
+
• **Making complex simple** - You break down technical findings into business language that anyone can understand
|
|
275
|
+
• **Being genuinely helpful** - You anticipate questions and provide context that helps people make informed decisions
|
|
276
|
+
• **Communicating with personality** - You're professional but approachable, using a conversational tone that feels human
|
|
277
|
+
|
|
278
|
+
When formatting for Slack:
|
|
279
|
+
${includeFormatting ? '• Use Slack formatting thoughtfully (**, *, `code`, bullet points) to highlight key insights' : '• Keep formatting clean and readable with plain text'}
|
|
280
|
+
• Stay under ${maxLength} characters but make every word count
|
|
281
|
+
• Match the ${style} tone while keeping your helpful analyst personality
|
|
282
|
+
• ${title ? `Lead with "${title}" but make it feel natural` : 'Start with a compelling headline that captures attention'}
|
|
283
|
+
• Tell the story: What happened? Why does it matter? What should we do about it?
|
|
284
|
+
• Add your analytical perspective - don't just report, interpret and advise
|
|
285
|
+
• End naturally without formal signatures or closings - this is Slack, not email
|
|
286
|
+
|
|
287
|
+
Remember: Your goal is to help your colleagues understand and act on information, not just consume it.`,
|
|
288
|
+
...(aiModel && { model: { ...aiModel } }),
|
|
289
|
+
...(credentials && { credentials }),
|
|
290
|
+
}, this.context);
|
|
291
|
+
const aiResult = await aiAgentBubble.action();
|
|
292
|
+
if (!aiResult.success) {
|
|
293
|
+
return {
|
|
294
|
+
success: false,
|
|
295
|
+
error: `AI formatting failed: ${aiResult.error}`,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
const formattedMessage = aiResult.data?.response;
|
|
299
|
+
if (!formattedMessage) {
|
|
300
|
+
return {
|
|
301
|
+
success: false,
|
|
302
|
+
error: 'AI formatting produced no output',
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
// Check if message was truncated
|
|
306
|
+
const wasTruncated = formattedMessage.length >= maxLength;
|
|
307
|
+
return {
|
|
308
|
+
success: true,
|
|
309
|
+
formattedMessage: formattedMessage.substring(0, maxLength),
|
|
310
|
+
wasTruncated,
|
|
311
|
+
error: '',
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
return {
|
|
316
|
+
success: false,
|
|
317
|
+
error: `Content formatting failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Send the formatted message to Slack
|
|
323
|
+
*/
|
|
324
|
+
async sendToSlack(channelId, message, credentials) {
|
|
325
|
+
try {
|
|
326
|
+
const slackBubble = new SlackBubble({
|
|
327
|
+
operation: 'send_message',
|
|
328
|
+
channel: channelId,
|
|
329
|
+
text: message,
|
|
330
|
+
...(credentials && { credentials }),
|
|
331
|
+
}, this.context);
|
|
332
|
+
const sendResult = await slackBubble.action();
|
|
333
|
+
if (!sendResult.success) {
|
|
334
|
+
return {
|
|
335
|
+
success: false,
|
|
336
|
+
error: `Failed to send Slack message: ${sendResult.error}`,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
success: true,
|
|
341
|
+
messageTimestamp: sendResult.data?.ts,
|
|
342
|
+
error: '',
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
return {
|
|
347
|
+
success: false,
|
|
348
|
+
error: `Slack message sending failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Build the AI formatting prompt based on parameters
|
|
354
|
+
*/
|
|
355
|
+
buildFormattingPrompt(content, userQuery, title, style = 'professional', includeFormatting = true, maxLength = 3000) {
|
|
356
|
+
const contextSection = userQuery
|
|
357
|
+
? `**Context**: Someone asked "${userQuery}" and here's what we found.\n\n`
|
|
358
|
+
: '';
|
|
359
|
+
const titleSection = title ? `**Focus**: ${title}\n\n` : '';
|
|
360
|
+
return `${contextSection}${titleSection}**Here's the data/information to work with:**
|
|
361
|
+
|
|
362
|
+
${content}
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
Time to work your analyst magic! Transform this into a compelling ${style} Slack message that your colleagues will actually want to read and act on.
|
|
367
|
+
|
|
368
|
+
Your mission:
|
|
369
|
+
• **Tell the story** - What's the key insight? What pattern or trend jumps out?
|
|
370
|
+
• **Make it human** - Use conversational language that feels natural, not robotic
|
|
371
|
+
• **Add your perspective** - What does this mean for the business? Why should they care?
|
|
372
|
+
• **Be actionable** - What should someone do with this information?
|
|
373
|
+
• **Stay focused** - Under ${maxLength} characters, but make every word matter
|
|
374
|
+
${includeFormatting ? '• **Format smart** - Use Slack formatting (**, *, `code`, bullets) to highlight what matters most' : '• **Keep it clean** - Plain text that flows naturally'}
|
|
375
|
+
${title ? `• **Lead strong** - Open with "${title}" but make it feel conversational` : '• **Hook them** - Start with a headline that makes people want to keep reading'}
|
|
376
|
+
|
|
377
|
+
Think of this as briefing a colleague over coffee - insightful, helpful, and genuinely engaging.
|
|
378
|
+
|
|
379
|
+
Just give me the message, ready to send!`;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
//# sourceMappingURL=slack-notifier.workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack-notifier.workflow.js","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/slack-notifier.workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAEL,cAAc,GACf,MAAM,2BAA2B,CAAC;AAEnC,mEAAmE;AACnE,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC;;OAEG;IACH,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,QAAQ,CAAC,yCAAyC,CAAC;IAEtD;;OAEG;IACH,iBAAiB,EAAE,CAAC;SACjB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,mCAAmC,CAAC;IAEhD;;OAEG;IACH,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,CAAC,8CAA8C,CAAC;IAE3D;;OAEG;IACH,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oCAAoC,CAAC;IAEjD;;OAEG;IACH,YAAY,EAAE,CAAC;SACZ,IAAI,CAAC,CAAC,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;SACpE,OAAO,CAAC,cAAc,C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EAC9B,oBAA6B,IAAI,EACjC,YAAoB,IAAI;QAExB,MAAM,cAAc,GAAG,SAAS;YAC9B,CAAC,CAAC,+BAA+B,SAAS,iCAAiC;YAC3E,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,cAAc,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAE5D,OAAO,GAAG,cAAc,GAAG,YAAY;;EAEzC,OAAO;;;;oEAI2D,KAAK;;;;;;;6BAO5C,SAAS;EACpC,iBAAiB,CAAC,CAAC,CAAC,mGAAmG,CAAC,CAAC,CAAC,uDAAuD;EACjL,KAAK,CAAC,CAAC,CAAC,kCAAkC,KAAK,mCAAmC,CAAC,CAAC,CAAC,gFAAgF;;;;yCAI9H,CAAC;IACxC,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
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 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-template.d.ts","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,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,sBAAsB,CAAC;CAenC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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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