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
package/scripts/stop.js
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cross-platform stop script for MachinaOS services.
|
|
4
|
+
* Works on: Windows, macOS, Linux, WSL, Git Bash
|
|
5
|
+
*
|
|
6
|
+
* Uses Node.js native APIs where possible, with platform-specific
|
|
7
|
+
* fallbacks for process management (no cross-platform alternative exists).
|
|
8
|
+
*/
|
|
9
|
+
import { execSync } from 'child_process';
|
|
10
|
+
import { readFileSync, existsSync } from 'fs';
|
|
11
|
+
import { resolve, dirname } from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const ROOT = resolve(__dirname, '..');
|
|
16
|
+
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Platform Detection
|
|
19
|
+
// ============================================================================
|
|
20
|
+
const isWindows = process.platform === 'win32';
|
|
21
|
+
const isGitBash = isWindows && (process.env.MSYSTEM || process.env.SHELL?.includes('bash'));
|
|
22
|
+
const isMac = process.platform === 'darwin';
|
|
23
|
+
|
|
24
|
+
// Git Bash on Windows uses Unix commands
|
|
25
|
+
const useUnixCommands = !isWindows || isGitBash;
|
|
26
|
+
|
|
27
|
+
function getPlatformName() {
|
|
28
|
+
if (isGitBash) return 'Git Bash';
|
|
29
|
+
if (isWindows) return 'Windows';
|
|
30
|
+
if (isMac) return 'macOS';
|
|
31
|
+
return 'Linux';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// Utilities
|
|
36
|
+
// ============================================================================
|
|
37
|
+
|
|
38
|
+
/** Execute command silently, return output or empty string */
|
|
39
|
+
function exec(cmd, options = {}) {
|
|
40
|
+
try {
|
|
41
|
+
return execSync(cmd, {
|
|
42
|
+
encoding: 'utf-8',
|
|
43
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
44
|
+
timeout: options.timeout || 10000,
|
|
45
|
+
cwd: ROOT,
|
|
46
|
+
...options
|
|
47
|
+
}).trim();
|
|
48
|
+
} catch {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Cross-platform sleep using Atomics (efficient, no busy wait) */
|
|
54
|
+
function sleep(ms) {
|
|
55
|
+
try {
|
|
56
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
57
|
+
} catch {
|
|
58
|
+
// Fallback for older Node.js
|
|
59
|
+
const end = Date.now() + ms;
|
|
60
|
+
while (Date.now() < end) { /* spin */ }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Load config from .env file */
|
|
65
|
+
function loadConfig() {
|
|
66
|
+
const envPath = existsSync(resolve(ROOT, '.env'))
|
|
67
|
+
? resolve(ROOT, '.env')
|
|
68
|
+
: resolve(ROOT, '.env.template');
|
|
69
|
+
|
|
70
|
+
const env = {};
|
|
71
|
+
if (existsSync(envPath)) {
|
|
72
|
+
for (const line of readFileSync(envPath, 'utf-8').split('\n')) {
|
|
73
|
+
const match = line.match(/^([^#=]+)=(.*)$/);
|
|
74
|
+
if (match) {
|
|
75
|
+
env[match[1].trim()] = match[2].trim().replace(/^["']|["']$/g, '');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
ports: [
|
|
82
|
+
parseInt(env.VITE_CLIENT_PORT) || 3000,
|
|
83
|
+
parseInt(env.PYTHON_BACKEND_PORT) || 3010,
|
|
84
|
+
parseInt(env.WHATSAPP_RPC_PORT) || 9400
|
|
85
|
+
],
|
|
86
|
+
temporalEnabled: env.TEMPORAL_ENABLED?.toLowerCase() === 'true'
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ============================================================================
|
|
91
|
+
// Process Management (platform-specific - no cross-platform alternative)
|
|
92
|
+
// ============================================================================
|
|
93
|
+
|
|
94
|
+
/** Get PIDs listening on a port */
|
|
95
|
+
function getPidsOnPort(port) {
|
|
96
|
+
const pids = new Set();
|
|
97
|
+
|
|
98
|
+
if (useUnixCommands) {
|
|
99
|
+
// lsof (macOS/Linux/Git Bash)
|
|
100
|
+
const lsofOutput = exec(`lsof -ti:${port} -sTCP:LISTEN 2>/dev/null`);
|
|
101
|
+
for (const pid of lsofOutput.split('\n')) {
|
|
102
|
+
if (pid.trim() && /^\d+$/.test(pid.trim())) {
|
|
103
|
+
pids.add(pid.trim());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// ss fallback (Linux)
|
|
107
|
+
if (pids.size === 0 && !isMac && !isGitBash) {
|
|
108
|
+
const ssOutput = exec(`ss -tlnp 2>/dev/null | grep :${port}`);
|
|
109
|
+
for (const match of ssOutput.matchAll(/pid=(\d+)/g)) {
|
|
110
|
+
pids.add(match[1]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
// netstat (Windows native)
|
|
115
|
+
const output = exec(`netstat -ano | findstr :${port} | findstr LISTENING`);
|
|
116
|
+
for (const line of output.split('\n')) {
|
|
117
|
+
const parts = line.trim().split(/\s+/);
|
|
118
|
+
const pid = parts[parts.length - 1];
|
|
119
|
+
if (pid && /^\d+$/.test(pid) && pid !== '0') {
|
|
120
|
+
pids.add(pid);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return Array.from(pids);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Get child PIDs recursively */
|
|
129
|
+
function getChildPids(parentPid) {
|
|
130
|
+
const children = new Set();
|
|
131
|
+
|
|
132
|
+
if (useUnixCommands) {
|
|
133
|
+
const output = exec(`pgrep -P ${parentPid} 2>/dev/null`);
|
|
134
|
+
for (const pid of output.split('\n')) {
|
|
135
|
+
if (pid.trim() && /^\d+$/.test(pid.trim())) {
|
|
136
|
+
children.add(pid.trim());
|
|
137
|
+
for (const grandchild of getChildPids(pid.trim())) {
|
|
138
|
+
children.add(grandchild);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
const output = exec(`wmic process where (ParentProcessId=${parentPid}) get ProcessId 2>nul`);
|
|
144
|
+
for (const line of output.split('\n')) {
|
|
145
|
+
const pid = line.trim();
|
|
146
|
+
if (pid && /^\d+$/.test(pid)) {
|
|
147
|
+
children.add(pid);
|
|
148
|
+
for (const grandchild of getChildPids(pid)) {
|
|
149
|
+
children.add(grandchild);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return Array.from(children);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Check if process is running */
|
|
159
|
+
function isRunning(pid) {
|
|
160
|
+
if (useUnixCommands) {
|
|
161
|
+
return exec(`kill -0 ${pid} 2>&1 && echo running`).includes('running');
|
|
162
|
+
} else {
|
|
163
|
+
return exec(`tasklist /FI "PID eq ${pid}" 2>nul`).includes(pid);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Kill a single process */
|
|
168
|
+
function killPid(pid) {
|
|
169
|
+
if (useUnixCommands) {
|
|
170
|
+
exec(`kill -15 ${pid} 2>/dev/null`);
|
|
171
|
+
sleep(100);
|
|
172
|
+
exec(`kill -9 ${pid} 2>/dev/null`);
|
|
173
|
+
} else {
|
|
174
|
+
exec(`taskkill /PID ${pid} 2>nul`);
|
|
175
|
+
exec(`taskkill /PID ${pid} /F 2>nul`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Kill all processes on a port */
|
|
180
|
+
function killPort(port) {
|
|
181
|
+
const pids = getPidsOnPort(port);
|
|
182
|
+
if (pids.length === 0) {
|
|
183
|
+
return { killed: [], portFree: true };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Collect all PIDs including children
|
|
187
|
+
const allPids = new Set(pids);
|
|
188
|
+
for (const pid of pids) {
|
|
189
|
+
for (const child of getChildPids(pid)) {
|
|
190
|
+
allPids.add(child);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Kill all
|
|
195
|
+
for (const pid of allPids) {
|
|
196
|
+
killPid(pid);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
sleep(500);
|
|
200
|
+
|
|
201
|
+
// Verify
|
|
202
|
+
const killed = [];
|
|
203
|
+
for (const pid of allPids) {
|
|
204
|
+
if (!isRunning(pid)) {
|
|
205
|
+
killed.push(pid);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Retry stubborn ones
|
|
210
|
+
const stillRunning = Array.from(allPids).filter(pid => isRunning(pid));
|
|
211
|
+
if (stillRunning.length > 0) {
|
|
212
|
+
for (const pid of stillRunning) {
|
|
213
|
+
if (useUnixCommands) {
|
|
214
|
+
exec(`kill -9 ${pid} 2>/dev/null`);
|
|
215
|
+
} else {
|
|
216
|
+
exec(`taskkill /PID ${pid} /F 2>nul`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
sleep(500);
|
|
220
|
+
for (const pid of stillRunning) {
|
|
221
|
+
if (!isRunning(pid)) {
|
|
222
|
+
killed.push(pid);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
killed,
|
|
229
|
+
portFree: getPidsOnPort(port).length === 0
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Kill processes by command pattern */
|
|
234
|
+
function killByPattern(pattern, debug = false) {
|
|
235
|
+
const killed = [];
|
|
236
|
+
|
|
237
|
+
if (useUnixCommands) {
|
|
238
|
+
const output = exec(`pgrep -f "${pattern}" 2>/dev/null`);
|
|
239
|
+
if (debug && output) console.log(` [DEBUG] pgrep output: ${output}`);
|
|
240
|
+
for (const pid of output.split('\n')) {
|
|
241
|
+
if (pid.trim() && /^\d+$/.test(pid.trim())) {
|
|
242
|
+
exec(`kill -9 ${pid.trim()} 2>/dev/null`);
|
|
243
|
+
killed.push(pid.trim());
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
// Use tasklist with image name filter first for Python processes
|
|
248
|
+
if (pattern.includes('uvicorn') || pattern.includes('python')) {
|
|
249
|
+
const pythonPids = exec(`wmic process where "name='python.exe'" get ProcessId,CommandLine 2>nul`);
|
|
250
|
+
if (debug && pythonPids) console.log(` [DEBUG] Python processes:\n${pythonPids}`);
|
|
251
|
+
|
|
252
|
+
for (const line of pythonPids.split('\n')) {
|
|
253
|
+
if (line.toLowerCase().includes(pattern.toLowerCase().replace('.*', ''))) {
|
|
254
|
+
const pidMatch = line.match(/(\d+)\s*$/);
|
|
255
|
+
if (pidMatch) {
|
|
256
|
+
const pid = pidMatch[1];
|
|
257
|
+
exec(`taskkill /PID ${pid} /F 2>nul`);
|
|
258
|
+
killed.push(pid);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Also try the original pattern match
|
|
265
|
+
const output = exec(`wmic process where "CommandLine like '%${pattern.replace('.*', '%')}%'" get ProcessId 2>nul`);
|
|
266
|
+
if (debug && output) console.log(` [DEBUG] wmic pattern output: ${output}`);
|
|
267
|
+
for (const line of output.split('\n')) {
|
|
268
|
+
const pid = line.trim();
|
|
269
|
+
if (pid && /^\d+$/.test(pid) && !killed.includes(pid)) {
|
|
270
|
+
exec(`taskkill /PID ${pid} /F 2>nul`);
|
|
271
|
+
killed.push(pid);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return killed;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// ============================================================================
|
|
280
|
+
// Main
|
|
281
|
+
// ============================================================================
|
|
282
|
+
|
|
283
|
+
const config = loadConfig();
|
|
284
|
+
|
|
285
|
+
console.log('Stopping MachinaOS services...\n');
|
|
286
|
+
console.log(`Platform: ${getPlatformName()}`);
|
|
287
|
+
console.log(`Ports: ${config.ports.join(', ')}`);
|
|
288
|
+
console.log(`Temporal: ${config.temporalEnabled ? 'enabled' : 'disabled'}\n`);
|
|
289
|
+
|
|
290
|
+
let allStopped = true;
|
|
291
|
+
|
|
292
|
+
// Stop services on ports
|
|
293
|
+
for (const port of config.ports) {
|
|
294
|
+
const result = killPort(port);
|
|
295
|
+
const status = result.portFree ? '[OK]' : '[!!]';
|
|
296
|
+
const message = result.portFree
|
|
297
|
+
? (result.killed.length > 0 ? `Killed ${result.killed.length} process(es)` : 'Free')
|
|
298
|
+
: 'Warning: Port still in use';
|
|
299
|
+
|
|
300
|
+
console.log(`${status} Port ${port}: ${message}`);
|
|
301
|
+
if (result.killed.length > 0) {
|
|
302
|
+
console.log(` PIDs: ${result.killed.join(', ')}`);
|
|
303
|
+
}
|
|
304
|
+
if (!result.portFree) {
|
|
305
|
+
allStopped = false;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Kill Temporal workers if enabled (must include project path)
|
|
310
|
+
if (config.temporalEnabled) {
|
|
311
|
+
const temporalPids = killByPattern(`${ROOT}.*temporal`);
|
|
312
|
+
if (temporalPids.length > 0) {
|
|
313
|
+
console.log(`[OK] Temporal: Killed ${temporalPids.length} process(es)`);
|
|
314
|
+
console.log(` PIDs: ${temporalPids.join(', ')}`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
console.log('');
|
|
319
|
+
if (allStopped) {
|
|
320
|
+
console.log('All services stopped.');
|
|
321
|
+
} else {
|
|
322
|
+
console.log('Warning: Some ports may still be in use.');
|
|
323
|
+
console.log('Try running the script again or manually kill the processes.');
|
|
324
|
+
process.exit(1);
|
|
325
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
.env
|
|
8
|
+
.env.*
|
|
9
|
+
!.env.template
|
|
10
|
+
venv/
|
|
11
|
+
ENV/
|
|
12
|
+
.venv/
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
.mypy_cache/
|
|
15
|
+
|
|
16
|
+
# IDE
|
|
17
|
+
.vscode/
|
|
18
|
+
.idea/
|
|
19
|
+
*.swp
|
|
20
|
+
*.swo
|
|
21
|
+
|
|
22
|
+
# Data (will be mounted as volume)
|
|
23
|
+
data/
|
|
24
|
+
*.db
|
|
25
|
+
*.sqlite
|
|
26
|
+
|
|
27
|
+
# Logs
|
|
28
|
+
*.log
|
|
29
|
+
logs/
|
|
30
|
+
|
|
31
|
+
# Git
|
|
32
|
+
.git/
|
|
33
|
+
.gitignore
|
|
34
|
+
|
|
35
|
+
# Documentation
|
|
36
|
+
*.md
|
|
37
|
+
!README.md
|
|
38
|
+
|
|
39
|
+
# Tests
|
|
40
|
+
tests/
|
|
41
|
+
test_*.py
|
|
42
|
+
|
|
43
|
+
# WhatsApp RPC (separate build)
|
|
44
|
+
whatsapp-rpc/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Python FastAPI Backend
|
|
2
|
+
FROM python:3.12-slim
|
|
3
|
+
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
|
|
6
|
+
# Install system dependencies
|
|
7
|
+
RUN apt-get update && apt-get install -y \
|
|
8
|
+
curl \
|
|
9
|
+
gcc \
|
|
10
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
11
|
+
|
|
12
|
+
# Copy requirements first for better caching
|
|
13
|
+
COPY requirements.txt .
|
|
14
|
+
|
|
15
|
+
# Install Python dependencies
|
|
16
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
17
|
+
|
|
18
|
+
# Install aiohttp for WebSocket client (Android relay)
|
|
19
|
+
RUN pip install --no-cache-dir aiohttp>=3.9.0
|
|
20
|
+
|
|
21
|
+
# Copy application code
|
|
22
|
+
COPY . .
|
|
23
|
+
|
|
24
|
+
# Create data directory for SQLite database
|
|
25
|
+
RUN mkdir -p /app/data
|
|
26
|
+
|
|
27
|
+
# Compile Python files to optimized bytecode for faster imports
|
|
28
|
+
# Keep .py files since Python imports require them or __pycache__/*.pyc
|
|
29
|
+
# -O: optimize (remove assert statements)
|
|
30
|
+
# -q: quiet mode
|
|
31
|
+
# -f: force rebuild
|
|
32
|
+
RUN python -O -m compileall -q -f .
|
|
33
|
+
|
|
34
|
+
# Default port (overridden by environment)
|
|
35
|
+
ENV PORT=3010
|
|
36
|
+
|
|
37
|
+
# Expose default port (actual port set via environment)
|
|
38
|
+
EXPOSE 3010
|
|
39
|
+
|
|
40
|
+
# Health check using shell for variable expansion
|
|
41
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
42
|
+
CMD sh -c "curl -f http://localhost:\${PORT}/health || exit 1"
|
|
43
|
+
|
|
44
|
+
# Run the application
|
|
45
|
+
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3010"]
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"""Centralized constants for node types and categories.
|
|
2
|
+
|
|
3
|
+
This module provides a single source of truth for all node type definitions,
|
|
4
|
+
eliminating duplicate string arrays across the codebase.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import FrozenSet
|
|
8
|
+
|
|
9
|
+
# =============================================================================
|
|
10
|
+
# AI NODE TYPES
|
|
11
|
+
# =============================================================================
|
|
12
|
+
|
|
13
|
+
AI_CHAT_MODEL_TYPES: FrozenSet[str] = frozenset([
|
|
14
|
+
'openaiChatModel',
|
|
15
|
+
'anthropicChatModel',
|
|
16
|
+
'geminiChatModel',
|
|
17
|
+
'openrouterChatModel',
|
|
18
|
+
'groqChatModel',
|
|
19
|
+
'cerebrasChatModel',
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
AI_AGENT_TYPES: FrozenSet[str] = frozenset([
|
|
23
|
+
'aiAgent',
|
|
24
|
+
'chatAgent',
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
AI_MEMORY_TYPES: FrozenSet[str] = frozenset([
|
|
28
|
+
'simpleMemory',
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
# Tool node types (connect to AI Agent's input-tools handle)
|
|
32
|
+
AI_TOOL_TYPES: FrozenSet[str] = frozenset([
|
|
33
|
+
'calculatorTool',
|
|
34
|
+
'currentTimeTool',
|
|
35
|
+
'webSearchTool',
|
|
36
|
+
'androidTool',
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
# Skill node types (connect to Chat Agent's input-skill handle)
|
|
40
|
+
# Skills provide SKILL.md context/instructions, not executed as workflow nodes
|
|
41
|
+
SKILL_NODE_TYPES: FrozenSet[str] = frozenset([
|
|
42
|
+
'assistantPersonality',
|
|
43
|
+
'whatsappSkill',
|
|
44
|
+
'memorySkill',
|
|
45
|
+
'mapsSkill',
|
|
46
|
+
'httpSkill',
|
|
47
|
+
'schedulerSkill',
|
|
48
|
+
'androidSkill',
|
|
49
|
+
'codeSkill',
|
|
50
|
+
'customSkill',
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
# Toolkit node types (aggregate sub-nodes, n8n Sub-Node pattern)
|
|
54
|
+
# Sub-nodes connected to toolkits should not execute independently -
|
|
55
|
+
# they only execute when called via the toolkit's tool interface
|
|
56
|
+
TOOLKIT_NODE_TYPES: FrozenSet[str] = frozenset([
|
|
57
|
+
'androidTool', # Aggregates Android service nodes (batteryMonitor, location, etc.)
|
|
58
|
+
])
|
|
59
|
+
|
|
60
|
+
# All AI-related node types (for API key injection)
|
|
61
|
+
AI_MODEL_TYPES: FrozenSet[str] = AI_AGENT_TYPES | AI_CHAT_MODEL_TYPES
|
|
62
|
+
|
|
63
|
+
# =============================================================================
|
|
64
|
+
# CONFIG NODE TYPES (excluded from workflow execution)
|
|
65
|
+
# =============================================================================
|
|
66
|
+
|
|
67
|
+
# Config nodes provide configuration to other nodes via special handles
|
|
68
|
+
# (input-memory, input-tools, input-model, input-skill).
|
|
69
|
+
# They don't execute independently - they're used by their parent nodes.
|
|
70
|
+
CONFIG_NODE_TYPES: FrozenSet[str] = (
|
|
71
|
+
AI_MEMORY_TYPES | # Memory nodes (connect to input-memory)
|
|
72
|
+
AI_TOOL_TYPES | # Tool nodes (connect to AI Agent's input-tools)
|
|
73
|
+
AI_CHAT_MODEL_TYPES | # Model config nodes (connect to input-model)
|
|
74
|
+
SKILL_NODE_TYPES # Skill nodes (connect to Chat Agent's input-skill)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# =============================================================================
|
|
78
|
+
# GOOGLE MAPS NODE TYPES
|
|
79
|
+
# =============================================================================
|
|
80
|
+
|
|
81
|
+
GOOGLE_MAPS_TYPES: FrozenSet[str] = frozenset([
|
|
82
|
+
'createMap',
|
|
83
|
+
'addLocations',
|
|
84
|
+
'showNearbyPlaces',
|
|
85
|
+
])
|
|
86
|
+
|
|
87
|
+
# =============================================================================
|
|
88
|
+
# ANDROID NODE TYPES
|
|
89
|
+
# =============================================================================
|
|
90
|
+
|
|
91
|
+
# System monitoring nodes
|
|
92
|
+
ANDROID_MONITORING_TYPES: FrozenSet[str] = frozenset([
|
|
93
|
+
'batteryMonitor',
|
|
94
|
+
'networkMonitor',
|
|
95
|
+
'systemInfo',
|
|
96
|
+
'location',
|
|
97
|
+
])
|
|
98
|
+
|
|
99
|
+
# App management nodes
|
|
100
|
+
ANDROID_APP_TYPES: FrozenSet[str] = frozenset([
|
|
101
|
+
'appLauncher',
|
|
102
|
+
'appList',
|
|
103
|
+
])
|
|
104
|
+
|
|
105
|
+
# Device automation nodes
|
|
106
|
+
ANDROID_AUTOMATION_TYPES: FrozenSet[str] = frozenset([
|
|
107
|
+
'wifiAutomation',
|
|
108
|
+
'bluetoothAutomation',
|
|
109
|
+
'audioAutomation',
|
|
110
|
+
'deviceStateAutomation',
|
|
111
|
+
'screenControlAutomation',
|
|
112
|
+
'airplaneModeControl',
|
|
113
|
+
])
|
|
114
|
+
|
|
115
|
+
# Sensor nodes
|
|
116
|
+
ANDROID_SENSOR_TYPES: FrozenSet[str] = frozenset([
|
|
117
|
+
'motionDetection',
|
|
118
|
+
'environmentalSensors',
|
|
119
|
+
])
|
|
120
|
+
|
|
121
|
+
# Media nodes
|
|
122
|
+
ANDROID_MEDIA_TYPES: FrozenSet[str] = frozenset([
|
|
123
|
+
'cameraControl',
|
|
124
|
+
'mediaControl',
|
|
125
|
+
])
|
|
126
|
+
|
|
127
|
+
# All Android service node types (combined)
|
|
128
|
+
ANDROID_SERVICE_NODE_TYPES: FrozenSet[str] = (
|
|
129
|
+
ANDROID_MONITORING_TYPES |
|
|
130
|
+
ANDROID_APP_TYPES |
|
|
131
|
+
ANDROID_AUTOMATION_TYPES |
|
|
132
|
+
ANDROID_SENSOR_TYPES |
|
|
133
|
+
ANDROID_MEDIA_TYPES
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
# Android device setup (separate from services)
|
|
137
|
+
ANDROID_SETUP_TYPES: FrozenSet[str] = frozenset([
|
|
138
|
+
'androidDeviceSetup',
|
|
139
|
+
])
|
|
140
|
+
|
|
141
|
+
# =============================================================================
|
|
142
|
+
# WHATSAPP NODE TYPES
|
|
143
|
+
# =============================================================================
|
|
144
|
+
|
|
145
|
+
WHATSAPP_TYPES: FrozenSet[str] = frozenset([
|
|
146
|
+
'whatsappSend',
|
|
147
|
+
'whatsappConnect',
|
|
148
|
+
'whatsappReceive',
|
|
149
|
+
])
|
|
150
|
+
|
|
151
|
+
# =============================================================================
|
|
152
|
+
# CHAT NODE TYPES
|
|
153
|
+
# =============================================================================
|
|
154
|
+
|
|
155
|
+
CHAT_TYPES: FrozenSet[str] = frozenset([
|
|
156
|
+
'chatSend',
|
|
157
|
+
'chatHistory',
|
|
158
|
+
])
|
|
159
|
+
|
|
160
|
+
# =============================================================================
|
|
161
|
+
# UTILITY NODE TYPES
|
|
162
|
+
# =============================================================================
|
|
163
|
+
|
|
164
|
+
CODE_EXECUTOR_TYPES: FrozenSet[str] = frozenset([
|
|
165
|
+
'pythonExecutor',
|
|
166
|
+
'javascriptExecutor',
|
|
167
|
+
])
|
|
168
|
+
|
|
169
|
+
HTTP_TYPES: FrozenSet[str] = frozenset([
|
|
170
|
+
'httpRequest',
|
|
171
|
+
'webhookResponse',
|
|
172
|
+
])
|
|
173
|
+
|
|
174
|
+
TEXT_TYPES: FrozenSet[str] = frozenset([
|
|
175
|
+
'textGenerator',
|
|
176
|
+
'fileHandler',
|
|
177
|
+
])
|
|
178
|
+
|
|
179
|
+
# =============================================================================
|
|
180
|
+
# WORKFLOW CONTROL NODE TYPES
|
|
181
|
+
# =============================================================================
|
|
182
|
+
|
|
183
|
+
WORKFLOW_CONTROL_TYPES: FrozenSet[str] = frozenset([
|
|
184
|
+
'start',
|
|
185
|
+
'cronScheduler',
|
|
186
|
+
])
|
|
187
|
+
|
|
188
|
+
# =============================================================================
|
|
189
|
+
# TRIGGER NODE TYPES (handled by event_waiter)
|
|
190
|
+
# =============================================================================
|
|
191
|
+
|
|
192
|
+
# Event-driven triggers that wait for external events
|
|
193
|
+
EVENT_TRIGGER_TYPES: FrozenSet[str] = frozenset([
|
|
194
|
+
'webhookTrigger',
|
|
195
|
+
'whatsappReceive',
|
|
196
|
+
'workflowTrigger',
|
|
197
|
+
'chatTrigger',
|
|
198
|
+
])
|
|
199
|
+
|
|
200
|
+
# Legacy alias for backwards compatibility
|
|
201
|
+
TRIGGER_TYPES: FrozenSet[str] = EVENT_TRIGGER_TYPES
|
|
202
|
+
|
|
203
|
+
# =============================================================================
|
|
204
|
+
# ALL TRIGGER NODE TYPES (starting points for workflow graphs)
|
|
205
|
+
# =============================================================================
|
|
206
|
+
|
|
207
|
+
# Combined set of all trigger node types that can start a workflow
|
|
208
|
+
# These nodes have no input handles and serve as entry points
|
|
209
|
+
WORKFLOW_TRIGGER_TYPES: FrozenSet[str] = frozenset([
|
|
210
|
+
# Manual start
|
|
211
|
+
'start',
|
|
212
|
+
# Scheduled triggers
|
|
213
|
+
'cronScheduler',
|
|
214
|
+
# Event-driven triggers
|
|
215
|
+
'webhookTrigger',
|
|
216
|
+
'whatsappReceive',
|
|
217
|
+
'workflowTrigger',
|
|
218
|
+
'chatTrigger',
|
|
219
|
+
])
|
|
220
|
+
|
|
221
|
+
# =============================================================================
|
|
222
|
+
# AI PROVIDER DETECTION
|
|
223
|
+
# =============================================================================
|
|
224
|
+
|
|
225
|
+
def detect_ai_provider(node_type: str, parameters: dict = None) -> str:
|
|
226
|
+
"""Detect AI provider from node type or parameters.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
node_type: The node type string
|
|
230
|
+
parameters: Optional parameters dict (used for aiAgent/chatAgent)
|
|
231
|
+
|
|
232
|
+
Returns:
|
|
233
|
+
Provider string: 'openai', 'anthropic', 'gemini', 'openrouter', 'groq', or 'cerebras'
|
|
234
|
+
"""
|
|
235
|
+
# AI Agent types get provider from parameters
|
|
236
|
+
if node_type in AI_AGENT_TYPES:
|
|
237
|
+
return (parameters or {}).get('provider', 'openai')
|
|
238
|
+
elif 'cerebras' in node_type.lower():
|
|
239
|
+
return 'cerebras'
|
|
240
|
+
elif 'groq' in node_type.lower():
|
|
241
|
+
return 'groq'
|
|
242
|
+
elif 'openrouter' in node_type.lower():
|
|
243
|
+
return 'openrouter'
|
|
244
|
+
elif 'anthropic' in node_type.lower():
|
|
245
|
+
return 'anthropic'
|
|
246
|
+
elif 'gemini' in node_type.lower():
|
|
247
|
+
return 'gemini'
|
|
248
|
+
else:
|
|
249
|
+
return 'openai'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Core framework components
|