machinaos 0.0.1
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/.env.template +71 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/bin/cli.js +159 -0
- package/client/.dockerignore +45 -0
- package/client/Dockerfile +68 -0
- package/client/eslint.config.js +29 -0
- package/client/index.html +13 -0
- package/client/nginx.conf +66 -0
- package/client/package.json +48 -0
- package/client/src/App.tsx +27 -0
- package/client/src/Dashboard.tsx +1173 -0
- package/client/src/ParameterPanel.tsx +301 -0
- package/client/src/components/AIAgentNode.tsx +321 -0
- package/client/src/components/APIKeyValidator.tsx +118 -0
- package/client/src/components/ClaudeChatModelNode.tsx +18 -0
- package/client/src/components/ConditionalEdge.tsx +189 -0
- package/client/src/components/CredentialsModal.tsx +306 -0
- package/client/src/components/EdgeConditionEditor.tsx +443 -0
- package/client/src/components/GeminiChatModelNode.tsx +18 -0
- package/client/src/components/GenericNode.tsx +357 -0
- package/client/src/components/LocationParameterPanel.tsx +154 -0
- package/client/src/components/ModelNode.tsx +286 -0
- package/client/src/components/OpenAIChatModelNode.tsx +18 -0
- package/client/src/components/OutputPanel.tsx +471 -0
- package/client/src/components/ParameterRenderer.tsx +1874 -0
- package/client/src/components/SkillEditorModal.tsx +417 -0
- package/client/src/components/SquareNode.tsx +797 -0
- package/client/src/components/StartNode.tsx +250 -0
- package/client/src/components/ToolkitNode.tsx +365 -0
- package/client/src/components/TriggerNode.tsx +463 -0
- package/client/src/components/auth/LoginPage.tsx +247 -0
- package/client/src/components/auth/ProtectedRoute.tsx +59 -0
- package/client/src/components/base/BaseChatModelNode.tsx +271 -0
- package/client/src/components/icons/AIProviderIcons.tsx +50 -0
- package/client/src/components/maps/GoogleMapsPicker.tsx +137 -0
- package/client/src/components/maps/MapsPreviewPanel.tsx +110 -0
- package/client/src/components/maps/index.ts +26 -0
- package/client/src/components/parameterPanel/InputSection.tsx +1094 -0
- package/client/src/components/parameterPanel/LocationPanelLayout.tsx +65 -0
- package/client/src/components/parameterPanel/MapsSection.tsx +92 -0
- package/client/src/components/parameterPanel/MiddleSection.tsx +571 -0
- package/client/src/components/parameterPanel/OutputSection.tsx +81 -0
- package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +82 -0
- package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -0
- package/client/src/components/parameterPanel/index.ts +42 -0
- package/client/src/components/shared/DataPanel.tsx +142 -0
- package/client/src/components/shared/JSONTreeRenderer.tsx +106 -0
- package/client/src/components/ui/AIResultModal.tsx +204 -0
- package/client/src/components/ui/AndroidSettingsPanel.tsx +401 -0
- package/client/src/components/ui/CodeEditor.tsx +81 -0
- package/client/src/components/ui/CollapsibleSection.tsx +88 -0
- package/client/src/components/ui/ComponentItem.tsx +154 -0
- package/client/src/components/ui/ComponentPalette.tsx +321 -0
- package/client/src/components/ui/ConsolePanel.tsx +1074 -0
- package/client/src/components/ui/ErrorBoundary.tsx +196 -0
- package/client/src/components/ui/InputNodesPanel.tsx +204 -0
- package/client/src/components/ui/MapSelector.tsx +314 -0
- package/client/src/components/ui/Modal.tsx +149 -0
- package/client/src/components/ui/NodeContextMenu.tsx +192 -0
- package/client/src/components/ui/NodeOutputPanel.tsx +1150 -0
- package/client/src/components/ui/OutputDisplayPanel.tsx +381 -0
- package/client/src/components/ui/SettingsPanel.tsx +243 -0
- package/client/src/components/ui/TopToolbar.tsx +736 -0
- package/client/src/components/ui/WhatsAppSettingsPanel.tsx +345 -0
- package/client/src/components/ui/WorkflowSidebar.tsx +294 -0
- package/client/src/config/antdTheme.ts +186 -0
- package/client/src/config/api.ts +54 -0
- package/client/src/contexts/AuthContext.tsx +221 -0
- package/client/src/contexts/ThemeContext.tsx +42 -0
- package/client/src/contexts/WebSocketContext.tsx +1971 -0
- package/client/src/factories/baseChatModelFactory.ts +256 -0
- package/client/src/hooks/useAndroidOperations.ts +164 -0
- package/client/src/hooks/useApiKeyValidation.ts +107 -0
- package/client/src/hooks/useApiKeys.ts +238 -0
- package/client/src/hooks/useAppTheme.ts +17 -0
- package/client/src/hooks/useComponentPalette.ts +51 -0
- package/client/src/hooks/useCopyPaste.ts +155 -0
- package/client/src/hooks/useDragAndDrop.ts +124 -0
- package/client/src/hooks/useDragVariable.ts +88 -0
- package/client/src/hooks/useExecution.ts +313 -0
- package/client/src/hooks/useParameterPanel.ts +176 -0
- package/client/src/hooks/useReactFlowNodes.ts +189 -0
- package/client/src/hooks/useToolSchema.ts +209 -0
- package/client/src/hooks/useWhatsApp.ts +196 -0
- package/client/src/hooks/useWorkflowManagement.ts +46 -0
- package/client/src/index.css +315 -0
- package/client/src/main.tsx +19 -0
- package/client/src/nodeDefinitions/aiAgentNodes.ts +336 -0
- package/client/src/nodeDefinitions/aiModelNodes.ts +340 -0
- package/client/src/nodeDefinitions/androidDeviceNodes.ts +140 -0
- package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -0
- package/client/src/nodeDefinitions/chatNodes.ts +135 -0
- package/client/src/nodeDefinitions/codeNodes.ts +54 -0
- package/client/src/nodeDefinitions/documentNodes.ts +379 -0
- package/client/src/nodeDefinitions/index.ts +15 -0
- package/client/src/nodeDefinitions/locationNodes.ts +463 -0
- package/client/src/nodeDefinitions/schedulerNodes.ts +220 -0
- package/client/src/nodeDefinitions/skillNodes.ts +211 -0
- package/client/src/nodeDefinitions/toolNodes.ts +198 -0
- package/client/src/nodeDefinitions/utilityNodes.ts +284 -0
- package/client/src/nodeDefinitions/whatsappNodes.ts +865 -0
- package/client/src/nodeDefinitions/workflowNodes.ts +41 -0
- package/client/src/nodeDefinitions.ts +104 -0
- package/client/src/schemas/workflowSchema.ts +264 -0
- package/client/src/services/dynamicParameterService.ts +96 -0
- package/client/src/services/execution/aiAgentExecutionService.ts +35 -0
- package/client/src/services/executionService.ts +232 -0
- package/client/src/services/workflowApi.ts +91 -0
- package/client/src/store/useAppStore.ts +582 -0
- package/client/src/styles/theme.ts +508 -0
- package/client/src/styles/zIndex.ts +17 -0
- package/client/src/types/ComponentTypes.ts +39 -0
- package/client/src/types/EdgeCondition.ts +231 -0
- package/client/src/types/INodeProperties.ts +288 -0
- package/client/src/types/NodeTypes.ts +28 -0
- package/client/src/utils/formatters.ts +33 -0
- package/client/src/utils/googleMapsLoader.ts +140 -0
- package/client/src/utils/locationUtils.ts +85 -0
- package/client/src/utils/nodeUtils.ts +31 -0
- package/client/src/utils/workflow.ts +30 -0
- package/client/src/utils/workflowExport.ts +120 -0
- package/client/src/vite-env.d.ts +12 -0
- package/client/tailwind.config.js +60 -0
- package/client/tsconfig.json +25 -0
- package/client/tsconfig.node.json +11 -0
- package/client/vite.config.js +35 -0
- package/docker-compose.prod.yml +107 -0
- package/docker-compose.yml +104 -0
- package/docs-MachinaOs/README.md +85 -0
- package/docs-MachinaOs/deployment/docker.mdx +228 -0
- package/docs-MachinaOs/deployment/production.mdx +345 -0
- package/docs-MachinaOs/docs.json +75 -0
- package/docs-MachinaOs/faq.mdx +309 -0
- package/docs-MachinaOs/favicon.svg +5 -0
- package/docs-MachinaOs/installation.mdx +160 -0
- package/docs-MachinaOs/introduction.mdx +114 -0
- package/docs-MachinaOs/logo/dark.svg +6 -0
- package/docs-MachinaOs/logo/light.svg +6 -0
- package/docs-MachinaOs/nodes/ai-agent.mdx +216 -0
- package/docs-MachinaOs/nodes/ai-models.mdx +240 -0
- package/docs-MachinaOs/nodes/android.mdx +411 -0
- package/docs-MachinaOs/nodes/overview.mdx +181 -0
- package/docs-MachinaOs/nodes/schedulers.mdx +316 -0
- package/docs-MachinaOs/nodes/webhooks.mdx +330 -0
- package/docs-MachinaOs/nodes/whatsapp.mdx +305 -0
- package/docs-MachinaOs/quickstart.mdx +119 -0
- package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +177 -0
- package/docs-MachinaOs/tutorials/android-automation.mdx +242 -0
- package/docs-MachinaOs/tutorials/first-workflow.mdx +134 -0
- package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +185 -0
- package/nul +0 -0
- package/package.json +70 -0
- package/scripts/build.js +158 -0
- package/scripts/check-ports.ps1 +33 -0
- package/scripts/clean.js +40 -0
- package/scripts/docker.js +93 -0
- package/scripts/kill-port.ps1 +154 -0
- package/scripts/start.js +210 -0
- package/scripts/stop.js +325 -0
- package/server/.dockerignore +44 -0
- package/server/Dockerfile +45 -0
- package/server/constants.py +249 -0
- package/server/core/__init__.py +1 -0
- package/server/core/cache.py +461 -0
- package/server/core/config.py +128 -0
- package/server/core/container.py +99 -0
- package/server/core/database.py +1211 -0
- package/server/core/logging.py +314 -0
- package/server/main.py +289 -0
- package/server/middleware/__init__.py +5 -0
- package/server/middleware/auth.py +89 -0
- package/server/models/__init__.py +1 -0
- package/server/models/auth.py +52 -0
- package/server/models/cache.py +24 -0
- package/server/models/database.py +211 -0
- package/server/models/nodes.py +455 -0
- package/server/package.json +9 -0
- package/server/pyproject.toml +72 -0
- package/server/requirements.txt +83 -0
- package/server/routers/__init__.py +1 -0
- package/server/routers/android.py +294 -0
- package/server/routers/auth.py +203 -0
- package/server/routers/database.py +151 -0
- package/server/routers/maps.py +142 -0
- package/server/routers/nodejs_compat.py +289 -0
- package/server/routers/webhook.py +90 -0
- package/server/routers/websocket.py +2127 -0
- package/server/routers/whatsapp.py +761 -0
- package/server/routers/workflow.py +200 -0
- package/server/services/__init__.py +1 -0
- package/server/services/ai.py +2415 -0
- package/server/services/android/__init__.py +27 -0
- package/server/services/android/broadcaster.py +114 -0
- package/server/services/android/client.py +608 -0
- package/server/services/android/manager.py +78 -0
- package/server/services/android/protocol.py +165 -0
- package/server/services/android_service.py +588 -0
- package/server/services/auth.py +131 -0
- package/server/services/chat_client.py +160 -0
- package/server/services/deployment/__init__.py +12 -0
- package/server/services/deployment/manager.py +706 -0
- package/server/services/deployment/state.py +47 -0
- package/server/services/deployment/triggers.py +275 -0
- package/server/services/event_waiter.py +785 -0
- package/server/services/execution/__init__.py +77 -0
- package/server/services/execution/cache.py +769 -0
- package/server/services/execution/conditions.py +373 -0
- package/server/services/execution/dlq.py +132 -0
- package/server/services/execution/executor.py +1351 -0
- package/server/services/execution/models.py +531 -0
- package/server/services/execution/recovery.py +235 -0
- package/server/services/handlers/__init__.py +126 -0
- package/server/services/handlers/ai.py +355 -0
- package/server/services/handlers/android.py +260 -0
- package/server/services/handlers/code.py +278 -0
- package/server/services/handlers/document.py +598 -0
- package/server/services/handlers/http.py +193 -0
- package/server/services/handlers/polyglot.py +105 -0
- package/server/services/handlers/tools.py +845 -0
- package/server/services/handlers/triggers.py +107 -0
- package/server/services/handlers/utility.py +822 -0
- package/server/services/handlers/whatsapp.py +476 -0
- package/server/services/maps.py +289 -0
- package/server/services/memory_store.py +103 -0
- package/server/services/node_executor.py +375 -0
- package/server/services/parameter_resolver.py +218 -0
- package/server/services/polyglot_client.py +169 -0
- package/server/services/scheduler.py +155 -0
- package/server/services/skill_loader.py +417 -0
- package/server/services/status_broadcaster.py +826 -0
- package/server/services/temporal/__init__.py +23 -0
- package/server/services/temporal/activities.py +344 -0
- package/server/services/temporal/client.py +76 -0
- package/server/services/temporal/executor.py +147 -0
- package/server/services/temporal/worker.py +251 -0
- package/server/services/temporal/workflow.py +355 -0
- package/server/services/temporal/ws_client.py +236 -0
- package/server/services/text.py +111 -0
- package/server/services/user_auth.py +172 -0
- package/server/services/websocket_client.py +29 -0
- package/server/services/workflow.py +597 -0
- package/server/skills/android-skill/SKILL.md +82 -0
- package/server/skills/assistant-personality/SKILL.md +45 -0
- package/server/skills/code-skill/SKILL.md +140 -0
- package/server/skills/http-skill/SKILL.md +161 -0
- package/server/skills/maps-skill/SKILL.md +170 -0
- package/server/skills/memory-skill/SKILL.md +154 -0
- package/server/skills/scheduler-skill/SKILL.md +84 -0
- package/server/skills/whatsapp-skill/SKILL.md +283 -0
- package/server/uv.lock +2916 -0
- package/server/whatsapp-rpc/.dockerignore +30 -0
- package/server/whatsapp-rpc/Dockerfile +44 -0
- package/server/whatsapp-rpc/Dockerfile.web +17 -0
- package/server/whatsapp-rpc/README.md +139 -0
- package/server/whatsapp-rpc/cli.js +95 -0
- package/server/whatsapp-rpc/configs/config.yaml +7 -0
- package/server/whatsapp-rpc/docker-compose.yml +35 -0
- package/server/whatsapp-rpc/docs/API.md +410 -0
- package/server/whatsapp-rpc/go.mod +67 -0
- package/server/whatsapp-rpc/go.sum +203 -0
- package/server/whatsapp-rpc/package.json +30 -0
- package/server/whatsapp-rpc/schema.json +1294 -0
- package/server/whatsapp-rpc/scripts/clean.cjs +66 -0
- package/server/whatsapp-rpc/scripts/cli.js +162 -0
- package/server/whatsapp-rpc/src/go/cmd/server/main.go +91 -0
- package/server/whatsapp-rpc/src/go/config/config.go +49 -0
- package/server/whatsapp-rpc/src/go/rpc/rpc.go +446 -0
- package/server/whatsapp-rpc/src/go/rpc/server.go +112 -0
- package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -0
- package/server/whatsapp-rpc/src/go/whatsapp/messages.go +390 -0
- package/server/whatsapp-rpc/src/go/whatsapp/service.go +2130 -0
- package/server/whatsapp-rpc/src/go/whatsapp/types.go +261 -0
- package/server/whatsapp-rpc/src/python/pyproject.toml +15 -0
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -0
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -0
- package/server/whatsapp-rpc/web/app.py +609 -0
- package/server/whatsapp-rpc/web/requirements.txt +6 -0
- package/server/whatsapp-rpc/web/rpc_client.py +427 -0
- package/server/whatsapp-rpc/web/static/openapi.yaml +59 -0
- package/server/whatsapp-rpc/web/templates/base.html +150 -0
- package/server/whatsapp-rpc/web/templates/contacts.html +240 -0
- package/server/whatsapp-rpc/web/templates/dashboard.html +320 -0
- package/server/whatsapp-rpc/web/templates/groups.html +328 -0
- package/server/whatsapp-rpc/web/templates/messages.html +465 -0
- package/server/whatsapp-rpc/web/templates/messaging.html +681 -0
- package/server/whatsapp-rpc/web/templates/send.html +259 -0
- package/server/whatsapp-rpc/web/templates/settings.html +459 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Workflow Control Nodes - Start, triggers, and flow control
|
|
2
|
+
import {
|
|
3
|
+
INodeTypeDescription,
|
|
4
|
+
NodeConnectionType
|
|
5
|
+
} from '../types/INodeProperties';
|
|
6
|
+
|
|
7
|
+
export const workflowNodes: Record<string, INodeTypeDescription> = {
|
|
8
|
+
// Start Node - Entry point for workflows
|
|
9
|
+
start: {
|
|
10
|
+
displayName: 'Start',
|
|
11
|
+
name: 'start',
|
|
12
|
+
icon: '▶',
|
|
13
|
+
group: ['workflow'],
|
|
14
|
+
version: 1,
|
|
15
|
+
subtitle: 'Workflow Entry',
|
|
16
|
+
description: 'Starting point for workflow execution. Provides initial data to connected nodes.',
|
|
17
|
+
defaults: { name: 'Start', color: '#8be9fd' },
|
|
18
|
+
inputs: [],
|
|
19
|
+
outputs: [{
|
|
20
|
+
name: 'main',
|
|
21
|
+
displayName: 'Output',
|
|
22
|
+
type: 'main' as NodeConnectionType,
|
|
23
|
+
description: 'Workflow start output'
|
|
24
|
+
}],
|
|
25
|
+
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Initial Data',
|
|
28
|
+
name: 'initialData',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '{}',
|
|
31
|
+
typeOptions: {
|
|
32
|
+
rows: 6
|
|
33
|
+
},
|
|
34
|
+
description: 'JSON data to pass to connected nodes',
|
|
35
|
+
placeholder: '{\n "message": "Hello World",\n "value": 123\n}'
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const WORKFLOW_NODE_TYPES = ['start'];
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Main Node Definitions - Central registry importing from modular files
|
|
2
|
+
import { INodeTypeDescription } from './types/INodeProperties';
|
|
3
|
+
|
|
4
|
+
// Import modular node definitions
|
|
5
|
+
import { aiModelNodes } from './nodeDefinitions/aiModelNodes';
|
|
6
|
+
import { aiAgentNodes, AI_NODE_TYPES } from './nodeDefinitions/aiAgentNodes';
|
|
7
|
+
import { toolNodes, TOOL_NODE_TYPES } from './nodeDefinitions/toolNodes';
|
|
8
|
+
import { locationNodes, LOCATION_NODE_TYPES } from './nodeDefinitions/locationNodes';
|
|
9
|
+
import { whatsappNodes, WHATSAPP_NODE_TYPES } from './nodeDefinitions/whatsappNodes';
|
|
10
|
+
import { workflowNodes } from './nodeDefinitions/workflowNodes';
|
|
11
|
+
import { schedulerNodes, SCHEDULER_NODE_TYPES } from './nodeDefinitions/schedulerNodes';
|
|
12
|
+
import { androidServiceNodes, ANDROID_SERVICE_NODE_TYPES } from './nodeDefinitions/androidServiceNodes';
|
|
13
|
+
import { androidDeviceNodes } from './nodeDefinitions/androidDeviceNodes';
|
|
14
|
+
import { chatNodes, CHAT_NODE_TYPES } from './nodeDefinitions/chatNodes';
|
|
15
|
+
import { codeNodes, CODE_NODE_TYPES } from './nodeDefinitions/codeNodes';
|
|
16
|
+
import { utilityNodes, UTILITY_NODE_TYPES } from './nodeDefinitions/utilityNodes';
|
|
17
|
+
import { skillNodes, SKILL_NODE_TYPES } from './nodeDefinitions/skillNodes';
|
|
18
|
+
import { documentNodes, DOCUMENT_NODE_TYPES } from './nodeDefinitions/documentNodes';
|
|
19
|
+
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// MAIN NODE REGISTRY - Combining all modular definitions
|
|
22
|
+
// ============================================================================
|
|
23
|
+
|
|
24
|
+
// Merge all node definitions from modular files
|
|
25
|
+
export const nodeDefinitions: Record<string, INodeTypeDescription> = {
|
|
26
|
+
...workflowNodes,
|
|
27
|
+
...schedulerNodes,
|
|
28
|
+
...aiModelNodes,
|
|
29
|
+
...aiAgentNodes,
|
|
30
|
+
...toolNodes,
|
|
31
|
+
...locationNodes,
|
|
32
|
+
...whatsappNodes,
|
|
33
|
+
...androidServiceNodes,
|
|
34
|
+
...androidDeviceNodes,
|
|
35
|
+
...chatNodes,
|
|
36
|
+
...codeNodes,
|
|
37
|
+
...utilityNodes,
|
|
38
|
+
...skillNodes,
|
|
39
|
+
...documentNodes
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// HELPER FUNCTIONS AND EXPORTS
|
|
44
|
+
// ============================================================================
|
|
45
|
+
|
|
46
|
+
// Export helper function to get all node types
|
|
47
|
+
export const getNodeTypes = (): string[] => {
|
|
48
|
+
return Object.keys(nodeDefinitions);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Export helper function to get nodes by group
|
|
52
|
+
export const getNodesByGroup = (group: string): INodeTypeDescription[] => {
|
|
53
|
+
return Object.values(nodeDefinitions).filter(node =>
|
|
54
|
+
node.group?.includes(group)
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Export AI and Location node lists for easy reference (updated with new nodes)
|
|
59
|
+
export const AI_NODES = [
|
|
60
|
+
...AI_NODE_TYPES
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export const LOCATION_NODES = [
|
|
64
|
+
...LOCATION_NODE_TYPES
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
export const WHATSAPP_NODES = [
|
|
68
|
+
...WHATSAPP_NODE_TYPES
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
export const ANDROID_SERVICE_NODES = [
|
|
72
|
+
...ANDROID_SERVICE_NODE_TYPES
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
export const SCHEDULER_NODES = [
|
|
76
|
+
...SCHEDULER_NODE_TYPES
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
export const CHAT_NODES = [
|
|
80
|
+
...CHAT_NODE_TYPES
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
export const CODE_NODES = [
|
|
84
|
+
...CODE_NODE_TYPES
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
export const UTILITY_NODES = [
|
|
88
|
+
...UTILITY_NODE_TYPES
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
export const TOOL_NODES = [
|
|
92
|
+
...TOOL_NODE_TYPES
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
export const SKILL_NODES = [
|
|
96
|
+
...SKILL_NODE_TYPES
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
export const DOCUMENT_NODES = [
|
|
100
|
+
...DOCUMENT_NODE_TYPES
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
// Re-export types and utilities from modular files for external access
|
|
104
|
+
export { createBaseChatModel } from './nodeDefinitions/aiModelNodes';
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema for Workflow Definition
|
|
3
|
+
* Defines the structure and validation rules for workflow data
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const WorkflowJSONSchema = {
|
|
7
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
8
|
+
title: "Workflow",
|
|
9
|
+
description: "A workflow automation definition containing nodes and connections",
|
|
10
|
+
type: "object",
|
|
11
|
+
required: ["id", "name", "nodes", "edges", "createdAt", "lastModified"],
|
|
12
|
+
properties: {
|
|
13
|
+
id: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Unique identifier for the workflow",
|
|
16
|
+
pattern: "^workflow_[0-9]+$"
|
|
17
|
+
},
|
|
18
|
+
name: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Human-readable workflow name",
|
|
21
|
+
minLength: 1,
|
|
22
|
+
maxLength: 100
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Optional workflow description"
|
|
27
|
+
},
|
|
28
|
+
nodes: {
|
|
29
|
+
type: "array",
|
|
30
|
+
description: "Array of workflow nodes",
|
|
31
|
+
items: {
|
|
32
|
+
$ref: "#/definitions/node"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
edges: {
|
|
36
|
+
type: "array",
|
|
37
|
+
description: "Array of connections between nodes",
|
|
38
|
+
items: {
|
|
39
|
+
$ref: "#/definitions/edge"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
createdAt: {
|
|
43
|
+
type: "string",
|
|
44
|
+
format: "date-time",
|
|
45
|
+
description: "ISO 8601 timestamp of workflow creation"
|
|
46
|
+
},
|
|
47
|
+
lastModified: {
|
|
48
|
+
type: "string",
|
|
49
|
+
format: "date-time",
|
|
50
|
+
description: "ISO 8601 timestamp of last modification"
|
|
51
|
+
},
|
|
52
|
+
version: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Workflow schema version",
|
|
55
|
+
default: "1.0.0"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
definitions: {
|
|
59
|
+
node: {
|
|
60
|
+
type: "object",
|
|
61
|
+
required: ["id", "type", "position"],
|
|
62
|
+
properties: {
|
|
63
|
+
id: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Unique node identifier"
|
|
66
|
+
},
|
|
67
|
+
type: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Node type identifier",
|
|
70
|
+
enum: [
|
|
71
|
+
"start",
|
|
72
|
+
"aiAgent",
|
|
73
|
+
"openaiChatModel",
|
|
74
|
+
"anthropicChatModel",
|
|
75
|
+
"googleChatModel",
|
|
76
|
+
"createMap",
|
|
77
|
+
"addLocations",
|
|
78
|
+
"showNearbyPlaces",
|
|
79
|
+
"whatsappSendMessage",
|
|
80
|
+
"whatsappReceiveMessage"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
position: {
|
|
84
|
+
type: "object",
|
|
85
|
+
required: ["x", "y"],
|
|
86
|
+
properties: {
|
|
87
|
+
x: {
|
|
88
|
+
type: "number",
|
|
89
|
+
description: "X coordinate on canvas"
|
|
90
|
+
},
|
|
91
|
+
y: {
|
|
92
|
+
type: "number",
|
|
93
|
+
description: "Y coordinate on canvas"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
data: {
|
|
98
|
+
type: "object",
|
|
99
|
+
description: "Node-specific parameters and configuration",
|
|
100
|
+
properties: {
|
|
101
|
+
label: {
|
|
102
|
+
type: "string",
|
|
103
|
+
description: "Display label for the node"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
additionalProperties: true
|
|
107
|
+
},
|
|
108
|
+
selected: {
|
|
109
|
+
type: "boolean",
|
|
110
|
+
description: "Whether node is currently selected"
|
|
111
|
+
},
|
|
112
|
+
dragging: {
|
|
113
|
+
type: "boolean",
|
|
114
|
+
description: "Whether node is being dragged"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
additionalProperties: true
|
|
118
|
+
},
|
|
119
|
+
edge: {
|
|
120
|
+
type: "object",
|
|
121
|
+
required: ["id", "source", "target"],
|
|
122
|
+
properties: {
|
|
123
|
+
id: {
|
|
124
|
+
type: "string",
|
|
125
|
+
description: "Unique edge identifier"
|
|
126
|
+
},
|
|
127
|
+
source: {
|
|
128
|
+
type: "string",
|
|
129
|
+
description: "Source node ID"
|
|
130
|
+
},
|
|
131
|
+
target: {
|
|
132
|
+
type: "string",
|
|
133
|
+
description: "Target node ID"
|
|
134
|
+
},
|
|
135
|
+
sourceHandle: {
|
|
136
|
+
type: "string",
|
|
137
|
+
description: "Source handle identifier",
|
|
138
|
+
default: "output-main"
|
|
139
|
+
},
|
|
140
|
+
targetHandle: {
|
|
141
|
+
type: "string",
|
|
142
|
+
description: "Target handle identifier",
|
|
143
|
+
default: "input-main"
|
|
144
|
+
},
|
|
145
|
+
type: {
|
|
146
|
+
type: "string",
|
|
147
|
+
description: "Edge rendering type",
|
|
148
|
+
enum: ["default", "straight", "step", "smoothstep", "simplebezier"],
|
|
149
|
+
default: "default"
|
|
150
|
+
},
|
|
151
|
+
animated: {
|
|
152
|
+
type: "boolean",
|
|
153
|
+
description: "Whether edge is animated"
|
|
154
|
+
},
|
|
155
|
+
style: {
|
|
156
|
+
type: "object",
|
|
157
|
+
description: "Custom edge styling"
|
|
158
|
+
},
|
|
159
|
+
label: {
|
|
160
|
+
type: "string",
|
|
161
|
+
description: "Edge label text"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
additionalProperties: true
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Validates a workflow object against the JSON schema
|
|
171
|
+
*/
|
|
172
|
+
export function validateWorkflow(workflow: any): { valid: boolean; errors: string[] } {
|
|
173
|
+
const errors: string[] = [];
|
|
174
|
+
|
|
175
|
+
if (!workflow.id || typeof workflow.id !== 'string') {
|
|
176
|
+
errors.push('Workflow must have a valid id');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!workflow.name || typeof workflow.name !== 'string') {
|
|
180
|
+
errors.push('Workflow must have a valid name');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (!Array.isArray(workflow.nodes)) {
|
|
184
|
+
errors.push('Workflow must have a nodes array');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (!Array.isArray(workflow.edges)) {
|
|
188
|
+
errors.push('Workflow must have an edges array');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!workflow.createdAt) {
|
|
192
|
+
errors.push('Workflow must have a createdAt timestamp');
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!workflow.lastModified) {
|
|
196
|
+
errors.push('Workflow must have a lastModified timestamp');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
workflow.nodes?.forEach((node: any, index: number) => {
|
|
200
|
+
if (!node.id) {
|
|
201
|
+
errors.push(`Node at index ${index} must have an id`);
|
|
202
|
+
}
|
|
203
|
+
if (!node.type) {
|
|
204
|
+
errors.push(`Node at index ${index} must have a type`);
|
|
205
|
+
}
|
|
206
|
+
if (!node.position || typeof node.position.x !== 'number' || typeof node.position.y !== 'number') {
|
|
207
|
+
errors.push(`Node at index ${index} must have a valid position with x and y coordinates`);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
workflow.edges?.forEach((edge: any, index: number) => {
|
|
212
|
+
if (!edge.id) {
|
|
213
|
+
errors.push(`Edge at index ${index} must have an id`);
|
|
214
|
+
}
|
|
215
|
+
if (!edge.source) {
|
|
216
|
+
errors.push(`Edge at index ${index} must have a source node`);
|
|
217
|
+
}
|
|
218
|
+
if (!edge.target) {
|
|
219
|
+
errors.push(`Edge at index ${index} must have a target node`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const sourceExists = workflow.nodes?.some((n: any) => n.id === edge.source);
|
|
223
|
+
const targetExists = workflow.nodes?.some((n: any) => n.id === edge.target);
|
|
224
|
+
|
|
225
|
+
if (!sourceExists) {
|
|
226
|
+
errors.push(`Edge ${edge.id} references non-existent source node: ${edge.source}`);
|
|
227
|
+
}
|
|
228
|
+
if (!targetExists) {
|
|
229
|
+
errors.push(`Edge ${edge.id} references non-existent target node: ${edge.target}`);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
return {
|
|
234
|
+
valid: errors.length === 0,
|
|
235
|
+
errors
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Serializes a workflow to JSON format
|
|
241
|
+
*/
|
|
242
|
+
export function serializeWorkflow(workflow: any): string {
|
|
243
|
+
return JSON.stringify(workflow, null, 2);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Deserializes a JSON string to workflow object
|
|
248
|
+
*/
|
|
249
|
+
export function deserializeWorkflow(json: string): any {
|
|
250
|
+
try {
|
|
251
|
+
const workflow = JSON.parse(json);
|
|
252
|
+
|
|
253
|
+
if (workflow.createdAt) {
|
|
254
|
+
workflow.createdAt = new Date(workflow.createdAt);
|
|
255
|
+
}
|
|
256
|
+
if (workflow.lastModified) {
|
|
257
|
+
workflow.lastModified = new Date(workflow.lastModified);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return workflow;
|
|
261
|
+
} catch (error) {
|
|
262
|
+
throw new Error(`Failed to parse workflow JSON: ${error}`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Dynamic Parameter Service - Manages runtime parameter option updates
|
|
2
|
+
import { INodePropertyOption } from '../types/INodeProperties';
|
|
3
|
+
|
|
4
|
+
interface DynamicParameterOptions {
|
|
5
|
+
[nodeId: string]: {
|
|
6
|
+
[parameterName: string]: INodePropertyOption[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class DynamicParameterService {
|
|
11
|
+
private static dynamicOptions: DynamicParameterOptions = {};
|
|
12
|
+
private static listeners: ((nodeId: string, parameterName: string, options: INodePropertyOption[]) => void)[] = [];
|
|
13
|
+
|
|
14
|
+
// Subscribe to dynamic option updates
|
|
15
|
+
static subscribe(callback: (nodeId: string, parameterName: string, options: INodePropertyOption[]) => void) {
|
|
16
|
+
this.listeners.push(callback);
|
|
17
|
+
return () => {
|
|
18
|
+
this.listeners = this.listeners.filter(listener => listener !== callback);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Update options for a specific parameter
|
|
23
|
+
static updateParameterOptions(nodeId: string, parameterName: string, options: INodePropertyOption[]) {
|
|
24
|
+
if (!this.dynamicOptions[nodeId]) {
|
|
25
|
+
this.dynamicOptions[nodeId] = {};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
this.dynamicOptions[nodeId][parameterName] = options;
|
|
29
|
+
|
|
30
|
+
// Notify all listeners
|
|
31
|
+
this.listeners.forEach((listener) => {
|
|
32
|
+
listener(nodeId, parameterName, options);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Get options for a specific parameter
|
|
37
|
+
static getParameterOptions(nodeId: string, parameterName: string): INodePropertyOption[] | null {
|
|
38
|
+
return this.dynamicOptions[nodeId]?.[parameterName] || null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Clear options for a specific parameter
|
|
42
|
+
static clearParameterOptions(nodeId: string, parameterName: string) {
|
|
43
|
+
if (this.dynamicOptions[nodeId]) {
|
|
44
|
+
delete this.dynamicOptions[nodeId][parameterName];
|
|
45
|
+
|
|
46
|
+
// Notify listeners with empty array
|
|
47
|
+
this.listeners.forEach(listener => {
|
|
48
|
+
listener(nodeId, parameterName, []);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Clear all options for a node
|
|
54
|
+
static clearNodeOptions(nodeId: string) {
|
|
55
|
+
if (this.dynamicOptions[nodeId]) {
|
|
56
|
+
const parameterNames = Object.keys(this.dynamicOptions[nodeId]);
|
|
57
|
+
delete this.dynamicOptions[nodeId];
|
|
58
|
+
|
|
59
|
+
// Notify listeners for each parameter
|
|
60
|
+
parameterNames.forEach(parameterName => {
|
|
61
|
+
this.listeners.forEach(listener => {
|
|
62
|
+
listener(nodeId, parameterName, []);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Convert model strings to INodePropertyOption format
|
|
69
|
+
static createModelOptions(models: string[]): INodePropertyOption[] {
|
|
70
|
+
return models.map(model => ({
|
|
71
|
+
name: this.formatModelName(model),
|
|
72
|
+
value: model,
|
|
73
|
+
label: this.formatModelName(model),
|
|
74
|
+
description: `Model: ${model}`
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Format model name for display
|
|
79
|
+
private static formatModelName(modelId: string): string {
|
|
80
|
+
// Preserve [FREE] prefix if present
|
|
81
|
+
const hasFreePrefix = modelId.startsWith('[FREE] ');
|
|
82
|
+
const cleanId = hasFreePrefix ? modelId.slice(7) : modelId;
|
|
83
|
+
|
|
84
|
+
const formatted = cleanId
|
|
85
|
+
.replace(/^gpt-/, 'GPT-')
|
|
86
|
+
.replace(/^claude-/, 'Claude ')
|
|
87
|
+
.replace(/^gemini-/, 'Gemini ')
|
|
88
|
+
.replace(/turbo/i, 'Turbo')
|
|
89
|
+
.replace(/^o1-/, 'O1-');
|
|
90
|
+
|
|
91
|
+
// Return with [FREE] prefix preserved if it was there
|
|
92
|
+
return hasFreePrefix ? `[FREE] ${formatted}` : formatted;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default DynamicParameterService;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ExecutionResult } from '../executionService';
|
|
2
|
+
|
|
3
|
+
// AI Agent execution result (simplified)
|
|
4
|
+
export interface AIAgentExecutionResult extends ExecutionResult {
|
|
5
|
+
aiResponse?: string;
|
|
6
|
+
toolCalls?: any[];
|
|
7
|
+
iterations?: number;
|
|
8
|
+
tokens?: {
|
|
9
|
+
prompt: number;
|
|
10
|
+
completion: number;
|
|
11
|
+
total: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class AIAgentExecutionService {
|
|
16
|
+
/**
|
|
17
|
+
* Basic validation for UI feedback - backend handles full validation
|
|
18
|
+
*/
|
|
19
|
+
static validateConfiguration(nodeData: any): { valid: boolean; errors: string[] } {
|
|
20
|
+
const errors: string[] = [];
|
|
21
|
+
|
|
22
|
+
// Basic required field checks for immediate UI feedback
|
|
23
|
+
if (!nodeData.prompt || nodeData.prompt.trim() === '') {
|
|
24
|
+
errors.push('Prompt is required');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Backend handles all complex validation, API keys, etc.
|
|
28
|
+
return {
|
|
29
|
+
valid: errors.length === 0,
|
|
30
|
+
errors
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default AIAgentExecutionService;
|