codex-linux 1.0.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/.claude/settings.local.json +10 -0
- package/.eslintrc.json +27 -0
- package/.github/workflows/ci.yml +156 -0
- package/.huskyrc +7 -0
- package/.lintstagedrc +13 -0
- package/.prettierrc +12 -0
- package/CLAUDE.md +163 -0
- package/DESIGN_SUPERIOR.md +73 -0
- package/Dockerfile +64 -0
- package/INSTALLATION.md +152 -0
- package/LICENSE +21 -0
- package/README.md +245 -0
- package/assets/skills/code-review/instructions.md +102 -0
- package/assets/skills/code-review/skill.yaml +15 -0
- package/assets/skills/refactoring/instructions.md +149 -0
- package/assets/skills/refactoring/skill.yaml +15 -0
- package/assets/skills/testing/skill.yaml +15 -0
- package/commitlint.config.js +23 -0
- package/dist/main/DatabaseManager.js +763 -0
- package/dist/main/DatabaseManager.js.map +1 -0
- package/dist/main/SettingsManager.js +61 -0
- package/dist/main/SettingsManager.js.map +1 -0
- package/dist/main/agents/AgentOrchestrator.js +787 -0
- package/dist/main/agents/AgentOrchestrator.js.map +1 -0
- package/dist/main/agents/AgentSDK.js +219 -0
- package/dist/main/agents/AgentSDK.js.map +1 -0
- package/dist/main/agents/AgentTools.js +348 -0
- package/dist/main/agents/AgentTools.js.map +1 -0
- package/dist/main/agents/CodeIndex.js +233 -0
- package/dist/main/agents/CodeIndex.js.map +1 -0
- package/dist/main/agents/EmbeddingService.js +80 -0
- package/dist/main/agents/EmbeddingService.js.map +1 -0
- package/dist/main/agents/NativeToolCalling.js +206 -0
- package/dist/main/agents/NativeToolCalling.js.map +1 -0
- package/dist/main/api/APIServer.js +278 -0
- package/dist/main/api/APIServer.js.map +1 -0
- package/dist/main/api/RateLimiter.js +138 -0
- package/dist/main/api/RateLimiter.js.map +1 -0
- package/dist/main/api/WebSocketManager.js +300 -0
- package/dist/main/api/WebSocketManager.js.map +1 -0
- package/dist/main/assistant/ContextOptimizer.js +192 -0
- package/dist/main/assistant/ContextOptimizer.js.map +1 -0
- package/dist/main/assistant/PredictedOutputManager.js +172 -0
- package/dist/main/assistant/PredictedOutputManager.js.map +1 -0
- package/dist/main/assistant/PromptCacheManager.js +193 -0
- package/dist/main/assistant/PromptCacheManager.js.map +1 -0
- package/dist/main/assistant/PromptOptimizer.js +626 -0
- package/dist/main/assistant/PromptOptimizer.js.map +1 -0
- package/dist/main/assistant/SmartCodeAssistant.js +224 -0
- package/dist/main/assistant/SmartCodeAssistant.js.map +1 -0
- package/dist/main/auth/SessionManager.js +300 -0
- package/dist/main/auth/SessionManager.js.map +1 -0
- package/dist/main/automations/AdvancedWebhookSystem.js +212 -0
- package/dist/main/automations/AdvancedWebhookSystem.js.map +1 -0
- package/dist/main/automations/AutomationScheduler.js +269 -0
- package/dist/main/automations/AutomationScheduler.js.map +1 -0
- package/dist/main/automations/BatchProcessingSystem.js +159 -0
- package/dist/main/automations/BatchProcessingSystem.js.map +1 -0
- package/dist/main/automations/BrowserAutomationManager.js +195 -0
- package/dist/main/automations/BrowserAutomationManager.js.map +1 -0
- package/dist/main/automations/GitHubActionsManager.js +129 -0
- package/dist/main/automations/GitHubActionsManager.js.map +1 -0
- package/dist/main/automations/GitLabCIManager.js +122 -0
- package/dist/main/automations/GitLabCIManager.js.map +1 -0
- package/dist/main/automations/PriorityQueueManager.js +240 -0
- package/dist/main/automations/PriorityQueueManager.js.map +1 -0
- package/dist/main/background/BackgroundModeManager.js +117 -0
- package/dist/main/background/BackgroundModeManager.js.map +1 -0
- package/dist/main/backup/BackupManager.js +254 -0
- package/dist/main/backup/BackupManager.js.map +1 -0
- package/dist/main/backup/MigrationManager.js +114 -0
- package/dist/main/backup/MigrationManager.js.map +1 -0
- package/dist/main/commands/SlashCommandManager.js +399 -0
- package/dist/main/commands/SlashCommandManager.js.map +1 -0
- package/dist/main/config/ClaudeMdParser.js +519 -0
- package/dist/main/config/ClaudeMdParser.js.map +1 -0
- package/dist/main/config/CustomizationManager.js +381 -0
- package/dist/main/config/CustomizationManager.js.map +1 -0
- package/dist/main/config/LaunchConfigManager.js +211 -0
- package/dist/main/config/LaunchConfigManager.js.map +1 -0
- package/dist/main/config/SettingsManager.js +166 -0
- package/dist/main/config/SettingsManager.js.map +1 -0
- package/dist/main/connectors/ConnectorManager.js +151 -0
- package/dist/main/connectors/ConnectorManager.js.map +1 -0
- package/dist/main/connectors/DatabaseConnector.js +222 -0
- package/dist/main/connectors/DatabaseConnector.js.map +1 -0
- package/dist/main/cowork/CoworkManager.js +324 -0
- package/dist/main/cowork/CoworkManager.js.map +1 -0
- package/dist/main/evals/AgentEvalFramework.js +538 -0
- package/dist/main/evals/AgentEvalFramework.js.map +1 -0
- package/dist/main/evals/GraderManager.js +285 -0
- package/dist/main/evals/GraderManager.js.map +1 -0
- package/dist/main/git/GitWorktreeManager.js +214 -0
- package/dist/main/git/GitWorktreeManager.js.map +1 -0
- package/dist/main/github/GitHubPRMonitor.js +244 -0
- package/dist/main/github/GitHubPRMonitor.js.map +1 -0
- package/dist/main/ide/ContinueInManager.js +181 -0
- package/dist/main/ide/ContinueInManager.js.map +1 -0
- package/dist/main/ide/IDEIntegration.js +277 -0
- package/dist/main/ide/IDEIntegration.js.map +1 -0
- package/dist/main/integrations/LinearManager.js +252 -0
- package/dist/main/integrations/LinearManager.js.map +1 -0
- package/dist/main/integrations/SlackBotManager.js +247 -0
- package/dist/main/integrations/SlackBotManager.js.map +1 -0
- package/dist/main/lsp/LSPManager.js +394 -0
- package/dist/main/lsp/LSPManager.js.map +1 -0
- package/dist/main/main.js +1087 -0
- package/dist/main/main.js.map +1 -0
- package/dist/main/mcp/MCPConfigurationManager.js +281 -0
- package/dist/main/mcp/MCPConfigurationManager.js.map +1 -0
- package/dist/main/mcp/MCPManager.js +710 -0
- package/dist/main/mcp/MCPManager.js.map +1 -0
- package/dist/main/mcp/MCPRegistry.js +272 -0
- package/dist/main/mcp/MCPRegistry.js.map +1 -0
- package/dist/main/monitoring/ErrorRecoveryManager.js +268 -0
- package/dist/main/monitoring/ErrorRecoveryManager.js.map +1 -0
- package/dist/main/monitoring/ErrorTracker.js +57 -0
- package/dist/main/monitoring/ErrorTracker.js.map +1 -0
- package/dist/main/monitoring/MetricsCollector.js +155 -0
- package/dist/main/monitoring/MetricsCollector.js.map +1 -0
- package/dist/main/monitoring/TraceGradingSystem.js +148 -0
- package/dist/main/monitoring/TraceGradingSystem.js.map +1 -0
- package/dist/main/notifications/NotificationManager.js +67 -0
- package/dist/main/notifications/NotificationManager.js.map +1 -0
- package/dist/main/pair/AIPairProgramming.js +200 -0
- package/dist/main/pair/AIPairProgramming.js.map +1 -0
- package/dist/main/plugins/PluginManager.js +222 -0
- package/dist/main/plugins/PluginManager.js.map +1 -0
- package/dist/main/plugins/PluginMarketplace.js +237 -0
- package/dist/main/plugins/PluginMarketplace.js.map +1 -0
- package/dist/main/preload.js +189 -0
- package/dist/main/preload.js.map +1 -0
- package/dist/main/preview/PreviewSessionManager.js +170 -0
- package/dist/main/preview/PreviewSessionManager.js.map +1 -0
- package/dist/main/providers/AIProviderManager.js +327 -0
- package/dist/main/providers/AIProviderManager.js.map +1 -0
- package/dist/main/providers/FineTuningManager.js +276 -0
- package/dist/main/providers/FineTuningManager.js.map +1 -0
- package/dist/main/providers/FreeModelsProvider.js +1104 -0
- package/dist/main/providers/FreeModelsProvider.js.map +1 -0
- package/dist/main/realtime/RealtimeManager.js +116 -0
- package/dist/main/realtime/RealtimeManager.js.map +1 -0
- package/dist/main/remote/CloudEnvironmentManager.js +232 -0
- package/dist/main/remote/CloudEnvironmentManager.js.map +1 -0
- package/dist/main/remote/RemoteSessionManager.js +255 -0
- package/dist/main/remote/RemoteSessionManager.js.map +1 -0
- package/dist/main/search/DeepResearchManager.js +335 -0
- package/dist/main/search/DeepResearchManager.js.map +1 -0
- package/dist/main/search/WebSearchIntegration.js +147 -0
- package/dist/main/search/WebSearchIntegration.js.map +1 -0
- package/dist/main/security/AdminConsoleManager.js +223 -0
- package/dist/main/security/AdminConsoleManager.js.map +1 -0
- package/dist/main/security/AuditLogger.js +136 -0
- package/dist/main/security/AuditLogger.js.map +1 -0
- package/dist/main/security/PermissionManager.js +144 -0
- package/dist/main/security/PermissionManager.js.map +1 -0
- package/dist/main/security/SSOManager.js +173 -0
- package/dist/main/security/SSOManager.js.map +1 -0
- package/dist/main/security/SecurityManager.js +152 -0
- package/dist/main/security/SecurityManager.js.map +1 -0
- package/dist/main/skills/SkillsManager.js +223 -0
- package/dist/main/skills/SkillsManager.js.map +1 -0
- package/dist/main/ssh/SSHManager.js +65 -0
- package/dist/main/ssh/SSHManager.js.map +1 -0
- package/dist/main/streaming/StreamingManager.js +225 -0
- package/dist/main/streaming/StreamingManager.js.map +1 -0
- package/dist/main/sync/CloudSyncManager.js +422 -0
- package/dist/main/sync/CloudSyncManager.js.map +1 -0
- package/dist/main/types.js +28 -0
- package/dist/main/types.js.map +1 -0
- package/dist/main/verification/AutoVerifyManager.js +235 -0
- package/dist/main/verification/AutoVerifyManager.js.map +1 -0
- package/dist/main/vision/ComputerUseManager.js +376 -0
- package/dist/main/vision/ComputerUseManager.js.map +1 -0
- package/dist/main/vision/ImageVideoGenerationManager.js +401 -0
- package/dist/main/vision/ImageVideoGenerationManager.js.map +1 -0
- package/dist/main/vision/VisionManager.js +172 -0
- package/dist/main/vision/VisionManager.js.map +1 -0
- package/dist/renderer/assets/main-DJlZQBCA.js +304 -0
- package/dist/renderer/assets/main-N33ZXEr8.css +1 -0
- package/dist/renderer/index.html +21 -0
- package/dist/renderer/manifest.json +42 -0
- package/dist/renderer/sw.ts +109 -0
- package/dist/shared/types.js +35 -0
- package/dist/shared/types.js.map +1 -0
- package/docker-compose.yml +65 -0
- package/docs/API.md +307 -0
- package/docs/USER_GUIDE.md +476 -0
- package/examples/plugins/sample-plugin/package.json +41 -0
- package/examples/plugins/sample-plugin/src/index.ts +75 -0
- package/index.html +20 -0
- package/jest.config.js +39 -0
- package/package.json +180 -0
- package/packages/cli/package.json +29 -0
- package/packages/cli/src/commands/agents.ts +199 -0
- package/packages/cli/src/commands/tasks.ts +61 -0
- package/packages/cli/src/index.ts +91 -0
- package/packages/cli/src/utils/api.ts +45 -0
- package/packages/cli/src/utils/config.ts +61 -0
- package/packages/npm-installer/bin/codex-linux +126 -0
- package/packages/npm-installer/lib/download.js +273 -0
- package/packages/npm-installer/package.json +42 -0
- package/packages/vscode-extension/package.json +167 -0
- package/packages/vscode-extension/src/api.ts +68 -0
- package/packages/vscode-extension/src/extension.ts +161 -0
- package/packages/vscode-extension/src/panels/chatPanel.ts +265 -0
- package/packages/vscode-extension/src/panels/createAgentPanel.ts +227 -0
- package/packages/vscode-extension/src/providers/agentsProvider.ts +80 -0
- package/postcss.config.js +6 -0
- package/public/manifest.json +42 -0
- package/public/sw.ts +109 -0
- package/scripts/install-dev.sh +103 -0
- package/scripts/install.sh +275 -0
- package/src/main/DatabaseManager.ts +950 -0
- package/src/main/SettingsManager.ts +63 -0
- package/src/main/agents/AgentOrchestrator.ts +930 -0
- package/src/main/agents/AgentSDK.ts +269 -0
- package/src/main/agents/AgentTools.ts +380 -0
- package/src/main/agents/CodeIndex.ts +240 -0
- package/src/main/agents/EmbeddingService.ts +88 -0
- package/src/main/agents/NativeToolCalling.ts +245 -0
- package/src/main/api/APIServer.ts +316 -0
- package/src/main/api/RateLimiter.ts +165 -0
- package/src/main/api/WebSocketManager.ts +398 -0
- package/src/main/assistant/ContextOptimizer.ts +214 -0
- package/src/main/assistant/PredictedOutputManager.ts +265 -0
- package/src/main/assistant/PromptCacheManager.ts +280 -0
- package/src/main/assistant/PromptOptimizer.ts +746 -0
- package/src/main/assistant/SmartCodeAssistant.ts +234 -0
- package/src/main/auth/SessionManager.ts +415 -0
- package/src/main/automations/AdvancedWebhookSystem.ts +281 -0
- package/src/main/automations/AutomationScheduler.ts +272 -0
- package/src/main/automations/BatchProcessingSystem.ts +207 -0
- package/src/main/automations/BrowserAutomationManager.ts +203 -0
- package/src/main/automations/GitHubActionsManager.ts +151 -0
- package/src/main/automations/GitLabCIManager.ts +206 -0
- package/src/main/automations/PriorityQueueManager.ts +328 -0
- package/src/main/background/BackgroundModeManager.ts +130 -0
- package/src/main/backup/BackupManager.ts +287 -0
- package/src/main/backup/MigrationManager.ts +132 -0
- package/src/main/commands/SlashCommandManager.ts +407 -0
- package/src/main/config/ClaudeMdParser.ts +539 -0
- package/src/main/config/CustomizationManager.ts +493 -0
- package/src/main/config/LaunchConfigManager.ts +212 -0
- package/src/main/config/SettingsManager.ts +163 -0
- package/src/main/connectors/ConnectorManager.ts +175 -0
- package/src/main/connectors/DatabaseConnector.ts +212 -0
- package/src/main/cowork/CoworkManager.ts +431 -0
- package/src/main/evals/AgentEvalFramework.ts +665 -0
- package/src/main/evals/GraderManager.ts +417 -0
- package/src/main/git/GitWorktreeManager.ts +211 -0
- package/src/main/github/GitHubPRMonitor.ts +317 -0
- package/src/main/ide/ContinueInManager.ts +180 -0
- package/src/main/ide/IDEIntegration.ts +288 -0
- package/src/main/integrations/LinearManager.ts +327 -0
- package/src/main/integrations/SlackBotManager.ts +312 -0
- package/src/main/lsp/LSPManager.ts +445 -0
- package/src/main/main.ts +1221 -0
- package/src/main/mcp/MCPConfigurationManager.ts +281 -0
- package/src/main/mcp/MCPManager.ts +799 -0
- package/src/main/mcp/MCPRegistry.ts +273 -0
- package/src/main/monitoring/ErrorRecoveryManager.ts +359 -0
- package/src/main/monitoring/ErrorTracker.ts +60 -0
- package/src/main/monitoring/MetricsCollector.ts +196 -0
- package/src/main/monitoring/TraceGradingSystem.ts +196 -0
- package/src/main/notifications/NotificationManager.ts +96 -0
- package/src/main/pair/AIPairProgramming.ts +290 -0
- package/src/main/plugins/PluginManager.ts +266 -0
- package/src/main/plugins/PluginMarketplace.ts +318 -0
- package/src/main/preload.ts +215 -0
- package/src/main/preview/PreviewSessionManager.ts +186 -0
- package/src/main/providers/AIProviderManager.ts +394 -0
- package/src/main/providers/FineTuningManager.ts +390 -0
- package/src/main/providers/FreeModelsProvider.ts +1156 -0
- package/src/main/realtime/RealtimeManager.ts +147 -0
- package/src/main/remote/CloudEnvironmentManager.ts +253 -0
- package/src/main/remote/RemoteSessionManager.ts +323 -0
- package/src/main/search/DeepResearchManager.ts +458 -0
- package/src/main/search/WebSearchIntegration.ts +203 -0
- package/src/main/security/AdminConsoleManager.ts +244 -0
- package/src/main/security/AuditLogger.ts +143 -0
- package/src/main/security/PermissionManager.ts +184 -0
- package/src/main/security/SSOManager.ts +241 -0
- package/src/main/security/SecurityManager.ts +139 -0
- package/src/main/skills/SkillsManager.ts +218 -0
- package/src/main/ssh/SSHManager.ts +86 -0
- package/src/main/streaming/StreamingManager.ts +306 -0
- package/src/main/sync/CloudSyncManager.ts +532 -0
- package/src/main/verification/AutoVerifyManager.ts +285 -0
- package/src/main/vision/ComputerUseManager.ts +475 -0
- package/src/main/vision/ImageVideoGenerationManager.ts +526 -0
- package/src/main/vision/VisionManager.ts +186 -0
- package/src/renderer/App.tsx +314 -0
- package/src/renderer/components/AdvancedSettingsPanel.tsx +225 -0
- package/src/renderer/components/AgentPanel.tsx +760 -0
- package/src/renderer/components/AppPreview.tsx +220 -0
- package/src/renderer/components/AuditTrailPanel.tsx +148 -0
- package/src/renderer/components/AutomationPanel.tsx +220 -0
- package/src/renderer/components/ChatInterface.tsx +595 -0
- package/src/renderer/components/ChatTab.tsx +296 -0
- package/src/renderer/components/CodeEditor.tsx +257 -0
- package/src/renderer/components/CodeReviewPanel.tsx +256 -0
- package/src/renderer/components/CodeWorkspace.tsx +192 -0
- package/src/renderer/components/CodebaseDashboard.tsx +295 -0
- package/src/renderer/components/ComputerUsePanel.tsx +262 -0
- package/src/renderer/components/ConnectorsPanel.tsx +471 -0
- package/src/renderer/components/ContextMenu.tsx +155 -0
- package/src/renderer/components/ContextUsageDisplay.tsx +248 -0
- package/src/renderer/components/CoworkPanel.tsx +415 -0
- package/src/renderer/components/DiffViewer.tsx +452 -0
- package/src/renderer/components/ErrorBoundary.tsx +273 -0
- package/src/renderer/components/ExtendedThinkingToggle.tsx +244 -0
- package/src/renderer/components/FileAttachments.tsx +247 -0
- package/src/renderer/components/FileExplorer.tsx +242 -0
- package/src/renderer/components/FileExplorerPanel.tsx +302 -0
- package/src/renderer/components/GitPanel.tsx +154 -0
- package/src/renderer/components/Header.tsx +113 -0
- package/src/renderer/components/MCPPanel.tsx +326 -0
- package/src/renderer/components/MentionAutocomplete.tsx +239 -0
- package/src/renderer/components/PermissionPanel.tsx +159 -0
- package/src/renderer/components/PermissionSelector.tsx +203 -0
- package/src/renderer/components/PluginMarketplace.tsx +325 -0
- package/src/renderer/components/PromptOptimizerPanel.tsx +399 -0
- package/src/renderer/components/SearchPanel.tsx +173 -0
- package/src/renderer/components/SearchReplace.tsx +284 -0
- package/src/renderer/components/SessionSidebar.tsx +367 -0
- package/src/renderer/components/SettingsPanel.tsx +426 -0
- package/src/renderer/components/Sidebar.tsx +100 -0
- package/src/renderer/components/SkillsPanel.tsx +245 -0
- package/src/renderer/components/SplitPane.tsx +173 -0
- package/src/renderer/components/Terminal.tsx +190 -0
- package/src/renderer/components/VoiceCommand.tsx +129 -0
- package/src/renderer/components/WorktreePanel.tsx +163 -0
- package/src/renderer/components/ui/AriaComponents.tsx +193 -0
- package/src/renderer/components/ui/Button.tsx +68 -0
- package/src/renderer/components/ui/Card.tsx +102 -0
- package/src/renderer/components/ui/Input.tsx +44 -0
- package/src/renderer/components/ui/Skeleton.tsx +55 -0
- package/src/renderer/components/ui/VirtualList.tsx +196 -0
- package/src/renderer/i18n/I18nProvider.tsx +101 -0
- package/src/renderer/i18n/de.ts +161 -0
- package/src/renderer/i18n/en.ts +163 -0
- package/src/renderer/i18n/es.ts +161 -0
- package/src/renderer/i18n/fr.ts +161 -0
- package/src/renderer/i18n/index.ts +44 -0
- package/src/renderer/index.css +129 -0
- package/src/renderer/lib/accessibility.tsx +287 -0
- package/src/renderer/lib/hooks.ts +304 -0
- package/src/renderer/lib/utils.ts +6 -0
- package/src/renderer/main.tsx +25 -0
- package/src/renderer/styles/minimalist.css +539 -0
- package/src/renderer/sw.ts +180 -0
- package/src/renderer/types.d.ts +138 -0
- package/src/shared/types.ts +813 -0
- package/supabase/schema.sql +234 -0
- package/tailwind.config.js +78 -0
- package/tests/e2e/package.json +15 -0
- package/tests/e2e/playwright.config.ts +31 -0
- package/tests/e2e/specs/app.spec.ts +194 -0
- package/tests/setup.ts +99 -0
- package/tests/unit/AgentOrchestrator.test.ts +274 -0
- package/tests/unit/DatabaseManager.test.ts +262 -0
- package/tests/unit/GitWorktreeManager.test.ts +150 -0
- package/tests/unit/SecurityManager.test.ts +110 -0
- package/tsconfig.main.json +22 -0
- package/tsconfig.renderer.json +27 -0
- package/vite.config.ts +28 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import log from 'electron-log';
|
|
4
|
+
|
|
5
|
+
interface WebhookTemplate {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
method: 'POST' | 'PUT' | 'PATCH';
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
payloadTemplate: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface OutgoingWebhook {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
url: string;
|
|
18
|
+
templateId: string;
|
|
19
|
+
events: string[];
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
secret?: string;
|
|
22
|
+
retryCount: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface WebhookPayload {
|
|
26
|
+
event: string;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
data: any;
|
|
29
|
+
signature?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class AdvancedWebhookSystem extends EventEmitter {
|
|
33
|
+
private templates: Map<string, WebhookTemplate> = new Map();
|
|
34
|
+
private webhooks: Map<string, OutgoingWebhook> = new Map();
|
|
35
|
+
private retryAttempts: Map<string, number> = new Map();
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
super();
|
|
39
|
+
this.initializeDefaultTemplates();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private initializeDefaultTemplates(): void {
|
|
43
|
+
// Agent Event Template
|
|
44
|
+
this.templates.set('agent-event', {
|
|
45
|
+
id: 'agent-event',
|
|
46
|
+
name: 'Agent Event',
|
|
47
|
+
description: 'Standard template for agent events',
|
|
48
|
+
method: 'POST',
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
'User-Agent': 'Codex-Linux/1.0'
|
|
52
|
+
},
|
|
53
|
+
payloadTemplate: JSON.stringify({
|
|
54
|
+
event: '{{event}}',
|
|
55
|
+
timestamp: '{{timestamp}}',
|
|
56
|
+
agentId: '{{agentId}}',
|
|
57
|
+
data: '{{data}}'
|
|
58
|
+
}, null, 2)
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Task Completion Template
|
|
62
|
+
this.templates.set('task-completed', {
|
|
63
|
+
id: 'task-completed',
|
|
64
|
+
name: 'Task Completed',
|
|
65
|
+
description: 'Notifies when a task is completed',
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: {
|
|
68
|
+
'Content-Type': 'application/json'
|
|
69
|
+
},
|
|
70
|
+
payloadTemplate: JSON.stringify({
|
|
71
|
+
event: 'task.completed',
|
|
72
|
+
timestamp: '{{timestamp}}',
|
|
73
|
+
agentId: '{{agentId}}',
|
|
74
|
+
taskId: '{{taskId}}',
|
|
75
|
+
result: '{{result}}',
|
|
76
|
+
duration: '{{duration}}'
|
|
77
|
+
}, null, 2)
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Error Notification Template
|
|
81
|
+
this.templates.set('error-alert', {
|
|
82
|
+
id: 'error-alert',
|
|
83
|
+
name: 'Error Alert',
|
|
84
|
+
description: 'Critical error notifications',
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json',
|
|
88
|
+
'X-Priority': 'high'
|
|
89
|
+
},
|
|
90
|
+
payloadTemplate: JSON.stringify({
|
|
91
|
+
event: 'error',
|
|
92
|
+
timestamp: '{{timestamp}}',
|
|
93
|
+
severity: '{{severity}}',
|
|
94
|
+
component: '{{component}}',
|
|
95
|
+
message: '{{message}}',
|
|
96
|
+
stack: '{{stack}}'
|
|
97
|
+
}, null, 2)
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Automation Trigger Template
|
|
101
|
+
this.templates.set('automation-trigger', {
|
|
102
|
+
id: 'automation-trigger',
|
|
103
|
+
name: 'Automation Trigger',
|
|
104
|
+
description: 'Triggered when automation runs',
|
|
105
|
+
method: 'POST',
|
|
106
|
+
headers: {
|
|
107
|
+
'Content-Type': 'application/json'
|
|
108
|
+
},
|
|
109
|
+
payloadTemplate: JSON.stringify({
|
|
110
|
+
event: 'automation.executed',
|
|
111
|
+
timestamp: '{{timestamp}}',
|
|
112
|
+
automationId: '{{automationId}}',
|
|
113
|
+
automationName: '{{automationName}}',
|
|
114
|
+
trigger: '{{trigger}}',
|
|
115
|
+
status: '{{status}}'
|
|
116
|
+
}, null, 2)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
createWebhook(
|
|
121
|
+
name: string,
|
|
122
|
+
url: string,
|
|
123
|
+
templateId: string,
|
|
124
|
+
events: string[],
|
|
125
|
+
options: {
|
|
126
|
+
secret?: string;
|
|
127
|
+
enabled?: boolean;
|
|
128
|
+
} = {}
|
|
129
|
+
): string {
|
|
130
|
+
const webhookId = `webhook-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
131
|
+
|
|
132
|
+
const webhook: OutgoingWebhook = {
|
|
133
|
+
id: webhookId,
|
|
134
|
+
name,
|
|
135
|
+
url,
|
|
136
|
+
templateId,
|
|
137
|
+
events,
|
|
138
|
+
enabled: options.enabled !== false,
|
|
139
|
+
secret: options.secret,
|
|
140
|
+
retryCount: 3
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
this.webhooks.set(webhookId, webhook);
|
|
144
|
+
log.info(`Created webhook: ${webhookId}`);
|
|
145
|
+
|
|
146
|
+
this.emit('webhook:created', webhook);
|
|
147
|
+
return webhookId;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async triggerEvent(event: string, data: any): Promise<void> {
|
|
151
|
+
const webhooks = Array.from(this.webhooks.values()).filter(
|
|
152
|
+
w => w.enabled && w.events.includes(event)
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
await Promise.all(
|
|
156
|
+
webhooks.map(webhook => this.sendWebhook(webhook, event, data))
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private async sendWebhook(
|
|
161
|
+
webhook: OutgoingWebhook,
|
|
162
|
+
event: string,
|
|
163
|
+
data: any
|
|
164
|
+
): Promise<void> {
|
|
165
|
+
const template = this.templates.get(webhook.templateId);
|
|
166
|
+
if (!template) {
|
|
167
|
+
log.error(`Webhook template not found: ${webhook.templateId}`);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const payload = this.buildPayload(template, event, data, webhook.secret);
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
const response = await axios({
|
|
175
|
+
method: template.method,
|
|
176
|
+
url: webhook.url,
|
|
177
|
+
headers: template.headers,
|
|
178
|
+
data: payload,
|
|
179
|
+
timeout: 30000
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
log.debug(`Webhook sent: ${webhook.id}, Status: ${response.status}`);
|
|
183
|
+
this.emit('webhook:sent', { webhookId: webhook.id, event, status: response.status });
|
|
184
|
+
|
|
185
|
+
// Clear retry count on success
|
|
186
|
+
this.retryAttempts.delete(webhook.id);
|
|
187
|
+
} catch (error) {
|
|
188
|
+
log.error(`Webhook failed: ${webhook.id}`, error);
|
|
189
|
+
|
|
190
|
+
// Retry logic
|
|
191
|
+
const attempts = this.retryAttempts.get(webhook.id) || 0;
|
|
192
|
+
if (attempts < webhook.retryCount) {
|
|
193
|
+
this.retryAttempts.set(webhook.id, attempts + 1);
|
|
194
|
+
setTimeout(() => this.sendWebhook(webhook, event, data), 1000 * (attempts + 1));
|
|
195
|
+
} else {
|
|
196
|
+
this.emit('webhook:failed', { webhookId: webhook.id, event, error });
|
|
197
|
+
this.retryAttempts.delete(webhook.id);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private buildPayload(
|
|
203
|
+
template: WebhookTemplate,
|
|
204
|
+
event: string,
|
|
205
|
+
data: any,
|
|
206
|
+
secret?: string
|
|
207
|
+
): any {
|
|
208
|
+
let payloadStr = template.payloadTemplate;
|
|
209
|
+
|
|
210
|
+
// Replace template variables
|
|
211
|
+
payloadStr = payloadStr.replace(/\{\{(\w+)\}\}/g, (match, key) => {
|
|
212
|
+
if (key === 'event') return event;
|
|
213
|
+
if (key === 'timestamp') return Date.now().toString();
|
|
214
|
+
if (data[key] !== undefined) return JSON.stringify(data[key]);
|
|
215
|
+
return match;
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const payload = JSON.parse(payloadStr);
|
|
219
|
+
|
|
220
|
+
// Add signature if secret is provided
|
|
221
|
+
if (secret) {
|
|
222
|
+
payload.signature = this.generateSignature(payload, secret);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return payload;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private generateSignature(payload: any, secret: string): string {
|
|
229
|
+
// Simple HMAC-like signature (in production, use crypto library)
|
|
230
|
+
const crypto = require('crypto');
|
|
231
|
+
const data = JSON.stringify(payload);
|
|
232
|
+
return crypto
|
|
233
|
+
.createHmac('sha256', secret)
|
|
234
|
+
.update(data)
|
|
235
|
+
.digest('hex');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
getTemplates(): WebhookTemplate[] {
|
|
239
|
+
return Array.from(this.templates.values());
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
getTemplate(templateId: string): WebhookTemplate | undefined {
|
|
243
|
+
return this.templates.get(templateId);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
getWebhooks(): OutgoingWebhook[] {
|
|
247
|
+
return Array.from(this.webhooks.values());
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
getWebhook(webhookId: string): OutgoingWebhook | undefined {
|
|
251
|
+
return this.webhooks.get(webhookId);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
updateWebhook(webhookId: string, updates: Partial<OutgoingWebhook>): void {
|
|
255
|
+
const webhook = this.webhooks.get(webhookId);
|
|
256
|
+
if (!webhook) throw new Error(`Webhook ${webhookId} not found`);
|
|
257
|
+
|
|
258
|
+
Object.assign(webhook, updates);
|
|
259
|
+
this.emit('webhook:updated', webhook);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
deleteWebhook(webhookId: string): void {
|
|
263
|
+
this.webhooks.delete(webhookId);
|
|
264
|
+
this.emit('webhook:deleted', { webhookId });
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
createCustomTemplate(template: Omit<WebhookTemplate, 'id'>): string {
|
|
268
|
+
const id = `custom-${Date.now()}`;
|
|
269
|
+
this.templates.set(id, { ...template, id });
|
|
270
|
+
return id;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
cleanup(): void {
|
|
274
|
+
this.webhooks.clear();
|
|
275
|
+
this.templates.clear();
|
|
276
|
+
this.retryAttempts.clear();
|
|
277
|
+
this.removeAllListeners();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export default AdvancedWebhookSystem;
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
+
import * as cron from 'node-cron';
|
|
4
|
+
import * as fs from 'fs/promises';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import { app } from 'electron';
|
|
7
|
+
import log from 'electron-log';
|
|
8
|
+
import { exec } from 'child_process';
|
|
9
|
+
import { promisify } from 'util';
|
|
10
|
+
import { Automation, AutomationTrigger, AutomationAction, Agent } from '../../shared/types';
|
|
11
|
+
import { NotificationManager } from '../notifications/NotificationManager';
|
|
12
|
+
|
|
13
|
+
const execAsync = promisify(exec);
|
|
14
|
+
|
|
15
|
+
const AUTOMATIONS_FILE = 'automations.json';
|
|
16
|
+
|
|
17
|
+
export class AutomationScheduler extends EventEmitter {
|
|
18
|
+
private automations: Map<string, Automation> = new Map();
|
|
19
|
+
private scheduledTasks: Map<string, cron.ScheduledTask> = new Map();
|
|
20
|
+
private notificationManager?: NotificationManager;
|
|
21
|
+
private dataDir: string;
|
|
22
|
+
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.dataDir = path.join(app.getPath('userData'), 'data');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setNotificationManager(notificationManager: NotificationManager): void {
|
|
29
|
+
this.notificationManager = notificationManager;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async initialize(): Promise<void> {
|
|
33
|
+
await this.loadAutomations();
|
|
34
|
+
log.info('Automation scheduler initialized');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private async loadAutomations(): Promise<void> {
|
|
38
|
+
try {
|
|
39
|
+
await fs.mkdir(this.dataDir, { recursive: true });
|
|
40
|
+
const filePath = path.join(this.dataDir, AUTOMATIONS_FILE);
|
|
41
|
+
const data = await fs.readFile(filePath, 'utf-8');
|
|
42
|
+
const automations: Automation[] = JSON.parse(data);
|
|
43
|
+
|
|
44
|
+
for (const automation of automations) {
|
|
45
|
+
automation.createdAt = new Date(automation.createdAt);
|
|
46
|
+
automation.updatedAt = new Date(automation.updatedAt);
|
|
47
|
+
if (automation.lastRunAt) {
|
|
48
|
+
automation.lastRunAt = new Date(automation.lastRunAt);
|
|
49
|
+
}
|
|
50
|
+
this.automations.set(automation.id, automation);
|
|
51
|
+
|
|
52
|
+
if (automation.enabled) {
|
|
53
|
+
await this.scheduleAutomation(automation);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
log.info(`Loaded ${automations.length} automations`);
|
|
57
|
+
} catch (error: any) {
|
|
58
|
+
if (error.code !== 'ENOENT') {
|
|
59
|
+
log.error('Failed to load automations:', error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private async saveAutomations(): Promise<void> {
|
|
65
|
+
try {
|
|
66
|
+
await fs.mkdir(this.dataDir, { recursive: true });
|
|
67
|
+
const filePath = path.join(this.dataDir, AUTOMATIONS_FILE);
|
|
68
|
+
const automations = Array.from(this.automations.values());
|
|
69
|
+
await fs.writeFile(filePath, JSON.stringify(automations, null, 2), 'utf-8');
|
|
70
|
+
} catch (error) {
|
|
71
|
+
log.error('Failed to save automations:', error);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async cleanup(): Promise<void> {
|
|
76
|
+
// Stop all scheduled tasks
|
|
77
|
+
for (const [id, task] of this.scheduledTasks) {
|
|
78
|
+
task.stop();
|
|
79
|
+
}
|
|
80
|
+
this.scheduledTasks.clear();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async listAutomations(): Promise<Automation[]> {
|
|
84
|
+
return Array.from(this.automations.values()).sort((a, b) =>
|
|
85
|
+
b.createdAt.getTime() - a.createdAt.getTime()
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async createAutomation(config: Partial<Automation>): Promise<Automation> {
|
|
90
|
+
const automation: Automation = {
|
|
91
|
+
id: uuidv4(),
|
|
92
|
+
name: config.name || 'New Automation',
|
|
93
|
+
description: config.description || '',
|
|
94
|
+
enabled: config.enabled ?? false,
|
|
95
|
+
trigger: config.trigger || { type: 'manual', config: {} },
|
|
96
|
+
actions: config.actions || [],
|
|
97
|
+
createdAt: new Date(),
|
|
98
|
+
updatedAt: new Date(),
|
|
99
|
+
runCount: 0
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
this.automations.set(automation.id, automation);
|
|
103
|
+
|
|
104
|
+
if (automation.enabled) {
|
|
105
|
+
await this.scheduleAutomation(automation);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
await this.saveAutomations();
|
|
109
|
+
this.emit('automation:created', automation);
|
|
110
|
+
log.info(`Created automation ${automation.id} (${automation.name})`);
|
|
111
|
+
|
|
112
|
+
return automation;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async updateAutomation(automationId: string, updates: Partial<Automation>): Promise<Automation> {
|
|
116
|
+
const automation = this.automations.get(automationId);
|
|
117
|
+
if (!automation) {
|
|
118
|
+
throw new Error(`Automation ${automationId} not found`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Stop existing schedule if any
|
|
122
|
+
await this.unscheduleAutomation(automationId);
|
|
123
|
+
|
|
124
|
+
Object.assign(automation, updates, { updatedAt: new Date() });
|
|
125
|
+
|
|
126
|
+
// Reschedule if enabled
|
|
127
|
+
if (automation.enabled) {
|
|
128
|
+
await this.scheduleAutomation(automation);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
await this.saveAutomations();
|
|
132
|
+
this.emit('automation:updated', automation);
|
|
133
|
+
return automation;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async deleteAutomation(automationId: string): Promise<void> {
|
|
137
|
+
const automation = this.automations.get(automationId);
|
|
138
|
+
if (!automation) {
|
|
139
|
+
throw new Error(`Automation ${automationId} not found`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
await this.unscheduleAutomation(automationId);
|
|
143
|
+
this.automations.delete(automationId);
|
|
144
|
+
|
|
145
|
+
await this.saveAutomations();
|
|
146
|
+
this.emit('automation:deleted', { automationId });
|
|
147
|
+
log.info(`Deleted automation ${automationId}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async toggleAutomation(automationId: string, enabled: boolean): Promise<void> {
|
|
151
|
+
const automation = this.automations.get(automationId);
|
|
152
|
+
if (!automation) {
|
|
153
|
+
throw new Error(`Automation ${automationId} not found`);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
automation.enabled = enabled;
|
|
157
|
+
automation.updatedAt = new Date();
|
|
158
|
+
|
|
159
|
+
if (enabled) {
|
|
160
|
+
await this.scheduleAutomation(automation);
|
|
161
|
+
} else {
|
|
162
|
+
await this.unscheduleAutomation(automationId);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
this.emit('automation:toggled', { automationId, enabled });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async runAutomation(automationId: string): Promise<void> {
|
|
169
|
+
const automation = this.automations.get(automationId);
|
|
170
|
+
if (!automation) {
|
|
171
|
+
throw new Error(`Automation ${automationId} not found`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
log.info(`Running automation ${automationId} (${automation.name})`);
|
|
175
|
+
|
|
176
|
+
automation.lastRunAt = new Date();
|
|
177
|
+
automation.runCount++;
|
|
178
|
+
automation.updatedAt = new Date();
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
for (const action of automation.actions) {
|
|
182
|
+
await this.executeAction(action);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.emit('automation:completed', { automationId, success: true });
|
|
186
|
+
} catch (error) {
|
|
187
|
+
log.error(`Automation ${automationId} failed:`, error);
|
|
188
|
+
this.emit('automation:completed', { automationId, success: false, error });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private async scheduleAutomation(automation: Automation): Promise<void> {
|
|
193
|
+
if (automation.trigger.type === 'schedule') {
|
|
194
|
+
const cronExpression = automation.trigger.config.cron;
|
|
195
|
+
|
|
196
|
+
if (!cronExpression || !cron.validate(cronExpression)) {
|
|
197
|
+
log.error(`Invalid cron expression for automation ${automation.id}`);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const task = cron.schedule(cronExpression, () => {
|
|
202
|
+
this.runAutomation(automation.id);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
this.scheduledTasks.set(automation.id, task);
|
|
206
|
+
log.info(`Scheduled automation ${automation.id} with cron: ${cronExpression}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private async unscheduleAutomation(automationId: string): Promise<void> {
|
|
211
|
+
const task = this.scheduledTasks.get(automationId);
|
|
212
|
+
if (task) {
|
|
213
|
+
task.stop();
|
|
214
|
+
this.scheduledTasks.delete(automationId);
|
|
215
|
+
log.info(`Unscheduled automation ${automationId}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private async executeAction(action: AutomationAction): Promise<void> {
|
|
220
|
+
log.info(`Executing action: ${action.type}`, action.config);
|
|
221
|
+
|
|
222
|
+
switch (action.type) {
|
|
223
|
+
case 'createAgent':
|
|
224
|
+
this.emit('action:createAgent', action.config);
|
|
225
|
+
log.info(`Emitted createAgent event with config:`, action.config);
|
|
226
|
+
break;
|
|
227
|
+
|
|
228
|
+
case 'sendMessage':
|
|
229
|
+
this.emit('action:sendMessage', action.config);
|
|
230
|
+
log.info(`Emitted sendMessage event with config:`, action.config);
|
|
231
|
+
break;
|
|
232
|
+
|
|
233
|
+
case 'executeCommand': {
|
|
234
|
+
const { command, cwd = process.cwd() } = action.config;
|
|
235
|
+
if (!command) {
|
|
236
|
+
throw new Error('Command is required for executeCommand action');
|
|
237
|
+
}
|
|
238
|
+
try {
|
|
239
|
+
const { stdout, stderr } = await execAsync(command, { cwd });
|
|
240
|
+
log.info(`Command executed successfully: ${command}`, { stdout, stderr });
|
|
241
|
+
this.emit('action:executeCommand:result', { success: true, stdout, stderr });
|
|
242
|
+
} catch (error: any) {
|
|
243
|
+
log.error(`Command execution failed: ${command}`, error.message);
|
|
244
|
+
this.emit('action:executeCommand:result', { success: false, error: error.message });
|
|
245
|
+
}
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
case 'runSkill':
|
|
250
|
+
this.emit('action:runSkill', action.config);
|
|
251
|
+
log.info(`Emitted runSkill event with config:`, action.config);
|
|
252
|
+
break;
|
|
253
|
+
|
|
254
|
+
case 'notify': {
|
|
255
|
+
const { title, body } = action.config;
|
|
256
|
+
if (!title || !body) {
|
|
257
|
+
throw new Error('Title and body are required for notify action');
|
|
258
|
+
}
|
|
259
|
+
if (this.notificationManager) {
|
|
260
|
+
this.notificationManager.show({ title, body });
|
|
261
|
+
} else {
|
|
262
|
+
this.emit('action:notify', { title, body });
|
|
263
|
+
}
|
|
264
|
+
log.info(`Notification shown: ${title}`);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
default:
|
|
269
|
+
log.warn(`Unknown action type: ${action.type}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|