@ranker/raxflow 0.2.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/dashboard/index.html +420 -0
- package/dist/benchmark.d.ts.map +1 -0
- package/dist/benchmark.js +123 -0
- package/dist/benchmark.js.map +1 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +141 -0
- package/dist/bin.js.map +1 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +22 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/bridge-adapter-templates.d.ts.map +1 -0
- package/dist/bridge-adapter-templates.js +185 -0
- package/dist/bridge-adapter-templates.js.map +1 -0
- package/dist/bridge-test.d.ts.map +1 -0
- package/dist/bridge-test.js +89 -0
- package/dist/bridge-test.js.map +1 -0
- package/dist/dashboard.d.ts.map +1 -0
- package/dist/dashboard.js +49 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +70 -0
- package/dist/doctor.js.map +1 -0
- package/dist/evolve.d.ts.map +1 -0
- package/dist/evolve.js +48 -0
- package/dist/evolve.js.map +1 -0
- package/dist/host-init-templates.d.ts.map +1 -0
- package/dist/host-init-templates.js +119 -0
- package/dist/host-init-templates.js.map +1 -0
- package/dist/hub/__tests__/commands.test.d.ts.map +1 -0
- package/dist/hub/__tests__/commands.test.js +72 -0
- package/dist/hub/__tests__/commands.test.js.map +1 -0
- package/dist/hub/__tests__/history.test.d.ts.map +1 -0
- package/dist/hub/__tests__/history.test.js +119 -0
- package/dist/hub/__tests__/history.test.js.map +1 -0
- package/dist/hub/__tests__/parser.test.d.ts.map +1 -0
- package/dist/hub/__tests__/parser.test.js +92 -0
- package/dist/hub/__tests__/parser.test.js.map +1 -0
- package/dist/hub/chat/ChatApp.d.ts +2 -0
- package/dist/hub/chat/ChatApp.d.ts.map +1 -0
- package/dist/hub/chat/ChatApp.js +146 -0
- package/dist/hub/chat/ChatApp.js.map +1 -0
- package/dist/hub/chat/components/ChatInput.d.ts +9 -0
- package/dist/hub/chat/components/ChatInput.d.ts.map +1 -0
- package/dist/hub/chat/components/ChatInput.js +19 -0
- package/dist/hub/chat/components/ChatInput.js.map +1 -0
- package/dist/hub/chat/components/MessageList.d.ts +7 -0
- package/dist/hub/chat/components/MessageList.d.ts.map +1 -0
- package/dist/hub/chat/components/MessageList.js +6 -0
- package/dist/hub/chat/components/MessageList.js.map +1 -0
- package/dist/hub/chat/context.d.ts.map +1 -0
- package/dist/hub/chat/context.js +42 -0
- package/dist/hub/chat/context.js.map +1 -0
- package/dist/hub/chat/hooks/useChatHistory.d.ts +7 -0
- package/dist/hub/chat/hooks/useChatHistory.d.ts.map +1 -0
- package/dist/hub/chat/hooks/useChatHistory.js +31 -0
- package/dist/hub/chat/hooks/useChatHistory.js.map +1 -0
- package/dist/hub/chat/index.d.ts.map +1 -0
- package/dist/hub/chat/index.js +7 -0
- package/dist/hub/chat/index.js.map +1 -0
- package/dist/hub/chat/intent-parser.d.ts.map +1 -0
- package/dist/hub/chat/intent-parser.js +48 -0
- package/dist/hub/chat/intent-parser.js.map +1 -0
- package/dist/hub/chat/types.d.ts.map +1 -0
- package/dist/hub/chat/types.js +2 -0
- package/dist/hub/chat/types.js.map +1 -0
- package/dist/hub/commands/agents.d.ts.map +1 -0
- package/dist/hub/commands/agents.js +36 -0
- package/dist/hub/commands/agents.js.map +1 -0
- package/dist/hub/commands/index.d.ts.map +1 -0
- package/dist/hub/commands/index.js +123 -0
- package/dist/hub/commands/index.js.map +1 -0
- package/dist/hub/commands/logs.d.ts.map +1 -0
- package/dist/hub/commands/logs.js +53 -0
- package/dist/hub/commands/logs.js.map +1 -0
- package/dist/hub/commands/memory.d.ts.map +1 -0
- package/dist/hub/commands/memory.js +40 -0
- package/dist/hub/commands/memory.js.map +1 -0
- package/dist/hub/commands/metrics.d.ts.map +1 -0
- package/dist/hub/commands/metrics.js +35 -0
- package/dist/hub/commands/metrics.js.map +1 -0
- package/dist/hub/commands/providers.d.ts.map +1 -0
- package/dist/hub/commands/providers.js +26 -0
- package/dist/hub/commands/providers.js.map +1 -0
- package/dist/hub/commands/run.d.ts.map +1 -0
- package/dist/hub/commands/run.js +31 -0
- package/dist/hub/commands/run.js.map +1 -0
- package/dist/hub/commands/status.d.ts.map +1 -0
- package/dist/hub/commands/status.js +61 -0
- package/dist/hub/commands/status.js.map +1 -0
- package/dist/hub/commands/workflows.d.ts.map +1 -0
- package/dist/hub/commands/workflows.js +45 -0
- package/dist/hub/commands/workflows.js.map +1 -0
- package/dist/hub/config-loader.d.ts.map +1 -0
- package/dist/hub/config-loader.js +27 -0
- package/dist/hub/config-loader.js.map +1 -0
- package/dist/hub/event-listener.d.ts +6 -0
- package/dist/hub/event-listener.d.ts.map +1 -0
- package/dist/hub/event-listener.js +12 -0
- package/dist/hub/event-listener.js.map +1 -0
- package/dist/hub/history.d.ts.map +1 -0
- package/dist/hub/history.js +59 -0
- package/dist/hub/history.js.map +1 -0
- package/dist/hub/index.d.ts.map +1 -0
- package/dist/hub/index.js +114 -0
- package/dist/hub/index.js.map +1 -0
- package/dist/hub/parser.d.ts.map +1 -0
- package/dist/hub/parser.js +98 -0
- package/dist/hub/parser.js.map +1 -0
- package/dist/hub/styles/borders.d.ts.map +1 -0
- package/dist/hub/styles/borders.js +64 -0
- package/dist/hub/styles/borders.js.map +1 -0
- package/dist/hub/styles/colors.d.ts.map +1 -0
- package/dist/hub/styles/colors.js +115 -0
- package/dist/hub/styles/colors.js.map +1 -0
- package/dist/hub/styles/typography.d.ts.map +1 -0
- package/dist/hub/styles/typography.js +60 -0
- package/dist/hub/styles/typography.js.map +1 -0
- package/dist/hub/tui/App.d.ts +2 -0
- package/dist/hub/tui/App.d.ts.map +1 -0
- package/dist/hub/tui/App.js +53 -0
- package/dist/hub/tui/App.js.map +1 -0
- package/dist/hub/tui/components/AgentQueue.d.ts +6 -0
- package/dist/hub/tui/components/AgentQueue.d.ts.map +1 -0
- package/dist/hub/tui/components/AgentQueue.js +20 -0
- package/dist/hub/tui/components/AgentQueue.js.map +1 -0
- package/dist/hub/tui/components/DAGPanel.d.ts +16 -0
- package/dist/hub/tui/components/DAGPanel.d.ts.map +1 -0
- package/dist/hub/tui/components/DAGPanel.js +51 -0
- package/dist/hub/tui/components/DAGPanel.js.map +1 -0
- package/dist/hub/tui/components/Header.d.ts +7 -0
- package/dist/hub/tui/components/Header.d.ts.map +1 -0
- package/dist/hub/tui/components/Header.js +17 -0
- package/dist/hub/tui/components/Header.js.map +1 -0
- package/dist/hub/tui/components/LogsPanel.d.ts +6 -0
- package/dist/hub/tui/components/LogsPanel.d.ts.map +1 -0
- package/dist/hub/tui/components/LogsPanel.js +26 -0
- package/dist/hub/tui/components/LogsPanel.js.map +1 -0
- package/dist/hub/tui/components/StatusBar.d.ts +8 -0
- package/dist/hub/tui/components/StatusBar.d.ts.map +1 -0
- package/dist/hub/tui/components/StatusBar.js +7 -0
- package/dist/hub/tui/components/StatusBar.js.map +1 -0
- package/dist/hub/tui/hooks/useEvents.d.ts +2 -0
- package/dist/hub/tui/hooks/useEvents.d.ts.map +1 -0
- package/dist/hub/tui/hooks/useEvents.js +13 -0
- package/dist/hub/tui/hooks/useEvents.js.map +1 -0
- package/dist/hub/tui/index.d.ts.map +1 -0
- package/dist/hub/tui/index.js +7 -0
- package/dist/hub/tui/index.js.map +1 -0
- package/dist/hub/tui/types.d.ts.map +1 -0
- package/dist/hub/tui/types.js +2 -0
- package/dist/hub/tui/types.js.map +1 -0
- package/dist/hub/types.d.ts.map +1 -0
- package/dist/hub/types.js +2 -0
- package/dist/hub/types.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/init-host.d.ts.map +1 -0
- package/dist/init-host.js +232 -0
- package/dist/init-host.js.map +1 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +99 -0
- package/dist/install.js.map +1 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +238 -0
- package/dist/run.js.map +1 -0
- package/dist/setup/components/ApiKeyInput.d.ts +25 -0
- package/dist/setup/components/ApiKeyInput.d.ts.map +1 -0
- package/dist/setup/components/ApiKeyInput.js +54 -0
- package/dist/setup/components/ApiKeyInput.js.map +1 -0
- package/dist/setup/components/AsciiBanner.d.ts +22 -0
- package/dist/setup/components/AsciiBanner.d.ts.map +1 -0
- package/dist/setup/components/AsciiBanner.js +55 -0
- package/dist/setup/components/AsciiBanner.js.map +1 -0
- package/dist/setup/components/CliDetector.d.ts +17 -0
- package/dist/setup/components/CliDetector.d.ts.map +1 -0
- package/dist/setup/components/CliDetector.js +79 -0
- package/dist/setup/components/CliDetector.js.map +1 -0
- package/dist/setup/components/ModeSelector.d.ts +8 -0
- package/dist/setup/components/ModeSelector.d.ts.map +1 -0
- package/dist/setup/components/ModeSelector.js +76 -0
- package/dist/setup/components/ModeSelector.js.map +1 -0
- package/dist/setup/components/ProviderSelector.d.ts +18 -0
- package/dist/setup/components/ProviderSelector.d.ts.map +1 -0
- package/dist/setup/components/ProviderSelector.js +97 -0
- package/dist/setup/components/ProviderSelector.js.map +1 -0
- package/dist/setup/components/SetupWizard.d.ts +2 -0
- package/dist/setup/components/SetupWizard.d.ts.map +1 -0
- package/dist/setup/components/SetupWizard.js +212 -0
- package/dist/setup/components/SetupWizard.js.map +1 -0
- package/dist/setup/components/StepIndicator.d.ts +13 -0
- package/dist/setup/components/StepIndicator.d.ts.map +1 -0
- package/dist/setup/components/StepIndicator.js +18 -0
- package/dist/setup/components/StepIndicator.js.map +1 -0
- package/dist/setup/components/SuccessScreen.d.ts +18 -0
- package/dist/setup/components/SuccessScreen.d.ts.map +1 -0
- package/dist/setup/components/SuccessScreen.js +38 -0
- package/dist/setup/components/SuccessScreen.js.map +1 -0
- package/dist/setup/index.d.ts +12 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +29 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/setup/utils/cli-detection.d.ts +12 -0
- package/dist/setup/utils/cli-detection.d.ts.map +1 -0
- package/dist/setup/utils/cli-detection.js +83 -0
- package/dist/setup/utils/cli-detection.js.map +1 -0
- package/dist/setup/utils/config-writer.d.ts +43 -0
- package/dist/setup/utils/config-writer.d.ts.map +1 -0
- package/dist/setup/utils/config-writer.js +180 -0
- package/dist/setup/utils/config-writer.js.map +1 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +12 -0
- package/dist/styles.js.map +1 -0
- package/dist/tui/App.d.ts +3 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +131 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/components/AgentStateIcon.d.ts +18 -0
- package/dist/tui/components/AgentStateIcon.d.ts.map +1 -0
- package/dist/tui/components/AgentStateIcon.js +57 -0
- package/dist/tui/components/AgentStateIcon.js.map +1 -0
- package/dist/tui/components/AnimatedBranch.d.ts +39 -0
- package/dist/tui/components/AnimatedBranch.d.ts.map +1 -0
- package/dist/tui/components/AnimatedBranch.js +64 -0
- package/dist/tui/components/AnimatedBranch.js.map +1 -0
- package/dist/tui/components/ChatPanel.d.ts +16 -0
- package/dist/tui/components/ChatPanel.d.ts.map +1 -0
- package/dist/tui/components/ChatPanel.js +50 -0
- package/dist/tui/components/ChatPanel.js.map +1 -0
- package/dist/tui/components/DAGPanel.d.ts +36 -0
- package/dist/tui/components/DAGPanel.d.ts.map +1 -0
- package/dist/tui/components/DAGPanel.js +51 -0
- package/dist/tui/components/DAGPanel.js.map +1 -0
- package/dist/tui/components/ExecutionTimeline.d.ts +34 -0
- package/dist/tui/components/ExecutionTimeline.d.ts.map +1 -0
- package/dist/tui/components/ExecutionTimeline.js +67 -0
- package/dist/tui/components/ExecutionTimeline.js.map +1 -0
- package/dist/tui/components/Header.d.ts +12 -0
- package/dist/tui/components/Header.d.ts.map +1 -0
- package/dist/tui/components/Header.js +32 -0
- package/dist/tui/components/Header.js.map +1 -0
- package/dist/tui/components/HelpOverlay.d.ts +7 -0
- package/dist/tui/components/HelpOverlay.d.ts.map +1 -0
- package/dist/tui/components/HelpOverlay.js +60 -0
- package/dist/tui/components/HelpOverlay.js.map +1 -0
- package/dist/tui/components/InputBar.d.ts +10 -0
- package/dist/tui/components/InputBar.d.ts.map +1 -0
- package/dist/tui/components/InputBar.js +21 -0
- package/dist/tui/components/InputBar.js.map +1 -0
- package/dist/tui/components/LogsPanel.d.ts +9 -0
- package/dist/tui/components/LogsPanel.d.ts.map +1 -0
- package/dist/tui/components/LogsPanel.js +56 -0
- package/dist/tui/components/LogsPanel.js.map +1 -0
- package/dist/tui/components/MemoryPanel.d.ts +21 -0
- package/dist/tui/components/MemoryPanel.d.ts.map +1 -0
- package/dist/tui/components/MemoryPanel.js +51 -0
- package/dist/tui/components/MemoryPanel.js.map +1 -0
- package/dist/tui/components/MetricsPanel.d.ts +18 -0
- package/dist/tui/components/MetricsPanel.d.ts.map +1 -0
- package/dist/tui/components/MetricsPanel.js +27 -0
- package/dist/tui/components/MetricsPanel.js.map +1 -0
- package/dist/tui/components/StatusPanel.d.ts +23 -0
- package/dist/tui/components/StatusPanel.d.ts.map +1 -0
- package/dist/tui/components/StatusPanel.js +23 -0
- package/dist/tui/components/StatusPanel.js.map +1 -0
- package/dist/tui/components/TaskTree.d.ts +28 -0
- package/dist/tui/components/TaskTree.d.ts.map +1 -0
- package/dist/tui/components/TaskTree.js +29 -0
- package/dist/tui/components/TaskTree.js.map +1 -0
- package/dist/tui/components/animations/ProgressBar.d.ts +39 -0
- package/dist/tui/components/animations/ProgressBar.d.ts.map +1 -0
- package/dist/tui/components/animations/ProgressBar.js +39 -0
- package/dist/tui/components/animations/ProgressBar.js.map +1 -0
- package/dist/tui/components/animations/Pulse.d.ts +17 -0
- package/dist/tui/components/animations/Pulse.d.ts.map +1 -0
- package/dist/tui/components/animations/Pulse.js +47 -0
- package/dist/tui/components/animations/Pulse.js.map +1 -0
- package/dist/tui/components/animations/Spinner.d.ts +13 -0
- package/dist/tui/components/animations/Spinner.d.ts.map +1 -0
- package/dist/tui/components/animations/Spinner.js +36 -0
- package/dist/tui/components/animations/Spinner.js.map +1 -0
- package/dist/tui/components/animations/StatusAnimator.d.ts +27 -0
- package/dist/tui/components/animations/StatusAnimator.d.ts.map +1 -0
- package/dist/tui/components/animations/StatusAnimator.js +85 -0
- package/dist/tui/components/animations/StatusAnimator.js.map +1 -0
- package/dist/tui/components/animations/TypingEffect.d.ts +26 -0
- package/dist/tui/components/animations/TypingEffect.d.ts.map +1 -0
- package/dist/tui/components/animations/TypingEffect.js +59 -0
- package/dist/tui/components/animations/TypingEffect.js.map +1 -0
- package/dist/tui/components/animations/index.d.ts +8 -0
- package/dist/tui/components/animations/index.d.ts.map +1 -0
- package/dist/tui/components/animations/index.js +6 -0
- package/dist/tui/components/animations/index.js.map +1 -0
- package/dist/tui/hooks/useAnimation.d.ts +42 -0
- package/dist/tui/hooks/useAnimation.d.ts.map +1 -0
- package/dist/tui/hooks/useAnimation.js +212 -0
- package/dist/tui/hooks/useAnimation.js.map +1 -0
- package/dist/tui/hooks/useAppState.d.ts +65 -0
- package/dist/tui/hooks/useAppState.d.ts.map +1 -0
- package/dist/tui/hooks/useAppState.js +293 -0
- package/dist/tui/hooks/useAppState.js.map +1 -0
- package/dist/tui/index.d.ts +3 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/services/orchestrator.d.ts +16 -0
- package/dist/tui/services/orchestrator.d.ts.map +1 -0
- package/dist/tui/services/orchestrator.js +152 -0
- package/dist/tui/services/orchestrator.js.map +1 -0
- package/dist/tui/styles/borders.d.ts +31 -0
- package/dist/tui/styles/borders.d.ts.map +1 -0
- package/dist/tui/styles/borders.js +47 -0
- package/dist/tui/styles/borders.js.map +1 -0
- package/dist/tui/styles/colors.d.ts +18 -0
- package/dist/tui/styles/colors.d.ts.map +1 -0
- package/dist/tui/styles/colors.js +18 -0
- package/dist/tui/styles/colors.js.map +1 -0
- package/dist/tui/styles/index.d.ts +6 -0
- package/dist/tui/styles/index.d.ts.map +1 -0
- package/dist/tui/styles/index.js +6 -0
- package/dist/tui/styles/index.js.map +1 -0
- package/dist/tui/styles/indicators.d.ts +67 -0
- package/dist/tui/styles/indicators.d.ts.map +1 -0
- package/dist/tui/styles/indicators.js +42 -0
- package/dist/tui/styles/indicators.js.map +1 -0
- package/dist/tui/styles/layout.d.ts +21 -0
- package/dist/tui/styles/layout.d.ts.map +1 -0
- package/dist/tui/styles/layout.js +42 -0
- package/dist/tui/styles/layout.js.map +1 -0
- package/dist/tui/styles/providers.d.ts +77 -0
- package/dist/tui/styles/providers.d.ts.map +1 -0
- package/dist/tui/styles/providers.js +31 -0
- package/dist/tui/styles/providers.js.map +1 -0
- package/dist/tui/utils/animation.d.ts +44 -0
- package/dist/tui/utils/animation.d.ts.map +1 -0
- package/dist/tui/utils/animation.js +107 -0
- package/dist/tui/utils/animation.js.map +1 -0
- package/dist/vendor-manifests.d.ts.map +1 -0
- package/dist/vendor-manifests.js +94 -0
- package/dist/vendor-manifests.js.map +1 -0
- package/dist/ws-relay.d.ts +12 -0
- package/dist/ws-relay.d.ts.map +1 -0
- package/dist/ws-relay.js +148 -0
- package/dist/ws-relay.js.map +1 -0
- package/package.json +34 -0
- package/src/benchmark.ts +156 -0
- package/src/bin.ts +156 -0
- package/src/bootstrap.ts +36 -0
- package/src/bridge-adapter-templates.ts +181 -0
- package/src/bridge-test.ts +107 -0
- package/src/dashboard.ts +51 -0
- package/src/doctor.ts +92 -0
- package/src/evolve.ts +74 -0
- package/src/host-init-templates.ts +134 -0
- package/src/hub/__tests__/commands.test.ts +84 -0
- package/src/hub/__tests__/history.test.ts +137 -0
- package/src/hub/__tests__/parser.test.ts +105 -0
- package/src/hub/commands/agents.ts +53 -0
- package/src/hub/commands/index.ts +140 -0
- package/src/hub/commands/logs.ts +70 -0
- package/src/hub/commands/memory.ts +47 -0
- package/src/hub/commands/metrics.ts +49 -0
- package/src/hub/commands/providers.ts +39 -0
- package/src/hub/commands/run.ts +37 -0
- package/src/hub/commands/status.ts +69 -0
- package/src/hub/commands/workflows.ts +64 -0
- package/src/hub/config-loader.ts +37 -0
- package/src/hub/event-listener.ts +17 -0
- package/src/hub/history.ts +66 -0
- package/src/hub/index.ts +132 -0
- package/src/hub/parser.ts +107 -0
- package/src/hub/styles/borders.ts +74 -0
- package/src/hub/styles/colors.ts +129 -0
- package/src/hub/styles/typography.ts +68 -0
- package/src/hub/types.ts +31 -0
- package/src/index.ts +10 -0
- package/src/init-host.ts +285 -0
- package/src/install.ts +118 -0
- package/src/run.ts +317 -0
- package/src/setup/components/ApiKeyInput.tsx +158 -0
- package/src/setup/components/AsciiBanner.tsx +125 -0
- package/src/setup/components/CliDetector.tsx +230 -0
- package/src/setup/components/ModeSelector.tsx +137 -0
- package/src/setup/components/ProviderSelector.tsx +174 -0
- package/src/setup/components/SetupWizard.tsx +368 -0
- package/src/setup/components/StepIndicator.tsx +74 -0
- package/src/setup/components/SuccessScreen.tsx +229 -0
- package/src/setup/index.ts +34 -0
- package/src/setup/utils/cli-detection.ts +99 -0
- package/src/setup/utils/config-writer.ts +249 -0
- package/src/styles.ts +12 -0
- package/src/tui/App.tsx +177 -0
- package/src/tui/components/AgentStateIcon.tsx +84 -0
- package/src/tui/components/AnimatedBranch.tsx +134 -0
- package/src/tui/components/ChatPanel.tsx +125 -0
- package/src/tui/components/DAGPanel.tsx +208 -0
- package/src/tui/components/ExecutionTimeline.tsx +225 -0
- package/src/tui/components/Header.tsx +109 -0
- package/src/tui/components/HelpOverlay.tsx +140 -0
- package/src/tui/components/InputBar.tsx +69 -0
- package/src/tui/components/LogsPanel.tsx +129 -0
- package/src/tui/components/MemoryPanel.tsx +163 -0
- package/src/tui/components/MetricsPanel.tsx +149 -0
- package/src/tui/components/StatusPanel.tsx +137 -0
- package/src/tui/components/TaskTree.tsx +159 -0
- package/src/tui/components/animations/ProgressBar.tsx +160 -0
- package/src/tui/components/animations/Pulse.tsx +73 -0
- package/src/tui/components/animations/Spinner.tsx +54 -0
- package/src/tui/components/animations/StatusAnimator.tsx +153 -0
- package/src/tui/components/animations/TypingEffect.tsx +119 -0
- package/src/tui/components/animations/index.ts +16 -0
- package/src/tui/hooks/useAnimation.ts +290 -0
- package/src/tui/hooks/useAppState.ts +403 -0
- package/src/tui/index.ts +9 -0
- package/src/tui/services/orchestrator.ts +195 -0
- package/src/tui/styles/borders.ts +51 -0
- package/src/tui/styles/colors.ts +19 -0
- package/src/tui/styles/index.ts +20 -0
- package/src/tui/styles/indicators.ts +54 -0
- package/src/tui/styles/layout.ts +44 -0
- package/src/tui/styles/providers.ts +32 -0
- package/src/tui/utils/animation.ts +124 -0
- package/src/vendor-manifests.ts +113 -0
- package/src/ws-relay.ts +156 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { useState, useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import { createOrchestrator, RuntimeEvent } from "../services/orchestrator.js";
|
|
3
|
+
|
|
4
|
+
interface Message {
|
|
5
|
+
id: string;
|
|
6
|
+
type: "user" | "system" | "agent" | "error" | "success";
|
|
7
|
+
content: string;
|
|
8
|
+
timestamp: Date;
|
|
9
|
+
agent?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Agent {
|
|
13
|
+
name: string;
|
|
14
|
+
role: string;
|
|
15
|
+
status: "idle" | "running" | "queued" | "done";
|
|
16
|
+
provider: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Provider {
|
|
20
|
+
name: string;
|
|
21
|
+
status: "active" | "idle";
|
|
22
|
+
latency: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface DAGNode {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
status: "pending" | "running" | "done" | "error";
|
|
29
|
+
agent?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface DAGLevel {
|
|
33
|
+
name: string;
|
|
34
|
+
progress: number;
|
|
35
|
+
nodes: DAGNode[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface WorkflowState {
|
|
39
|
+
levels: DAGLevel[];
|
|
40
|
+
currentLevel: number;
|
|
41
|
+
totalProgress: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface MetricsState {
|
|
45
|
+
sessions: number;
|
|
46
|
+
avgDuration: number;
|
|
47
|
+
successRate: number;
|
|
48
|
+
totalCost: number;
|
|
49
|
+
totalRetries: number;
|
|
50
|
+
totalEscalations: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface AppState {
|
|
54
|
+
projectName: string;
|
|
55
|
+
agentCount: number;
|
|
56
|
+
provider: string;
|
|
57
|
+
status: "ready" | "running" | "error";
|
|
58
|
+
messages: Message[];
|
|
59
|
+
agents: Agent[];
|
|
60
|
+
providers: Provider[];
|
|
61
|
+
fitness: number;
|
|
62
|
+
currentWorkflow: string | null;
|
|
63
|
+
suggestions: string[];
|
|
64
|
+
isProcessing: boolean;
|
|
65
|
+
workflowState: WorkflowState;
|
|
66
|
+
logs: string[];
|
|
67
|
+
metrics: MetricsState;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const COMMAND_SUGGESTIONS = [
|
|
71
|
+
"/run", "/status", "/agents", "/providers", "/workflows",
|
|
72
|
+
"/logs", "/metrics", "/memory", "/help", "/exit",
|
|
73
|
+
"/doctor", "/bridge-test", "/evolve", "/config",
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const DEFAULT_AGENTS: Agent[] = [
|
|
77
|
+
{ name: "IntentClassifier", role: "Classify intent", status: "idle", provider: "H" },
|
|
78
|
+
{ name: "TaskPlanner", role: "Decompose tasks", status: "idle", provider: "H" },
|
|
79
|
+
{ name: "SpecAgent", role: "Write specs", status: "idle", provider: "H" },
|
|
80
|
+
{ name: "CodeGenerator", role: "Generate code", status: "idle", provider: "H" },
|
|
81
|
+
{ name: "TestAgent", role: "Run tests", status: "idle", provider: "H" },
|
|
82
|
+
{ name: "FixAgent", role: "Fix issues", status: "idle", provider: "H" },
|
|
83
|
+
{ name: "MutationAgent", role: "Evolve workflow", status: "idle", provider: "H" },
|
|
84
|
+
{ name: "ValidatorAgent", role: "Validate outputs", status: "idle", provider: "H" },
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const DEFAULT_PROVIDERS: Provider[] = [
|
|
88
|
+
{ name: "Host-Native", status: "active", latency: 12 },
|
|
89
|
+
{ name: "Claude Code", status: "active", latency: 8 },
|
|
90
|
+
{ name: "OpenCode", status: "idle", latency: 0 },
|
|
91
|
+
{ name: "Anthropic", status: "idle", latency: 0 },
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const DEFAULT_WORKFLOW_STATE: WorkflowState = {
|
|
95
|
+
levels: [
|
|
96
|
+
{
|
|
97
|
+
name: "L1: SPEC",
|
|
98
|
+
progress: 0,
|
|
99
|
+
nodes: [
|
|
100
|
+
{ id: "intent", name: "IntentClassifier", status: "pending", agent: "H" },
|
|
101
|
+
{ id: "spec", name: "SpecAgent", status: "pending", agent: "H" },
|
|
102
|
+
{ id: "arch", name: "ArchitectureAgent", status: "pending", agent: "H" },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "L2: CODE",
|
|
107
|
+
progress: 0,
|
|
108
|
+
nodes: [
|
|
109
|
+
{ id: "task", name: "TaskPlanner", status: "pending", agent: "H" },
|
|
110
|
+
{ id: "codegen", name: "CodeGenerator", status: "pending", agent: "H" },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "L3: TEST",
|
|
115
|
+
progress: 0,
|
|
116
|
+
nodes: [
|
|
117
|
+
{ id: "test", name: "TestAgent", status: "pending", agent: "H" },
|
|
118
|
+
{ id: "fix", name: "FixAgent", status: "pending", agent: "H" },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
currentLevel: 0,
|
|
123
|
+
totalProgress: 0,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
function generateId(): string {
|
|
127
|
+
return Math.random().toString(36).slice(2, 9);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function useAppState() {
|
|
131
|
+
const orchestratorRef = useRef(createOrchestrator());
|
|
132
|
+
|
|
133
|
+
const [state, setState] = useState<AppState>({
|
|
134
|
+
projectName: process.cwd().split("/").pop() || "project",
|
|
135
|
+
agentCount: 12,
|
|
136
|
+
provider: "HOST-NATIVE",
|
|
137
|
+
status: "ready",
|
|
138
|
+
messages: [
|
|
139
|
+
{
|
|
140
|
+
id: generateId(),
|
|
141
|
+
type: "system",
|
|
142
|
+
content: "■ RAXFLOW HUB prêt. Tapez votre prompt ou /help pour les commandes.",
|
|
143
|
+
timestamp: new Date(),
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
agents: DEFAULT_AGENTS,
|
|
147
|
+
providers: DEFAULT_PROVIDERS,
|
|
148
|
+
fitness: 0.87,
|
|
149
|
+
currentWorkflow: null,
|
|
150
|
+
suggestions: COMMAND_SUGGESTIONS,
|
|
151
|
+
isProcessing: false,
|
|
152
|
+
workflowState: DEFAULT_WORKFLOW_STATE,
|
|
153
|
+
logs: [],
|
|
154
|
+
metrics: {
|
|
155
|
+
sessions: 0,
|
|
156
|
+
avgDuration: 0,
|
|
157
|
+
successRate: 100,
|
|
158
|
+
totalCost: 0,
|
|
159
|
+
totalRetries: 0,
|
|
160
|
+
totalEscalations: 0,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
const unsubscribe = orchestratorRef.current.onEvent((event: RuntimeEvent) => {
|
|
166
|
+
handleOrchestratorEvent(event);
|
|
167
|
+
});
|
|
168
|
+
return unsubscribe;
|
|
169
|
+
}, []);
|
|
170
|
+
|
|
171
|
+
const handleOrchestratorEvent = useCallback((event: RuntimeEvent) => {
|
|
172
|
+
const timestamp = new Date();
|
|
173
|
+
const timeStr = timestamp.toLocaleTimeString("fr-FR", {
|
|
174
|
+
hour: "2-digit",
|
|
175
|
+
minute: "2-digit",
|
|
176
|
+
second: "2-digit",
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
switch (event.type) {
|
|
180
|
+
case "run_start":
|
|
181
|
+
addLog(`[${timeStr}] [START] Task ${event.taskId}`);
|
|
182
|
+
setState((prev) => ({ ...prev, status: "running", isProcessing: true }));
|
|
183
|
+
break;
|
|
184
|
+
|
|
185
|
+
case "graph_ready":
|
|
186
|
+
addLog(`[${timeStr}] [GRAPH] Workflow ready with ${event.workflow.nodes.length} nodes`);
|
|
187
|
+
break;
|
|
188
|
+
|
|
189
|
+
case "node_start":
|
|
190
|
+
addLog(`[${timeStr}] [RUN] ${event.agent} starting... (retry: ${event.retry})`);
|
|
191
|
+
updateAgentStatus(event.agent, "running");
|
|
192
|
+
updateDAGNode(event.nodeId, "running");
|
|
193
|
+
break;
|
|
194
|
+
|
|
195
|
+
case "node_end":
|
|
196
|
+
if (event.success) {
|
|
197
|
+
addLog(`[${timeStr}] [OK] ${event.agent} done (confidence: ${event.confidence.toFixed(2)})`);
|
|
198
|
+
updateAgentStatus(event.agent, "done");
|
|
199
|
+
updateDAGNode(event.nodeId, "done");
|
|
200
|
+
} else {
|
|
201
|
+
addLog(`[${timeStr}] [FAIL] ${event.agent} failed`);
|
|
202
|
+
updateAgentStatus(event.agent, "idle");
|
|
203
|
+
updateDAGNode(event.nodeId, "error");
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
|
|
207
|
+
case "node_error":
|
|
208
|
+
addLog(`[${timeStr}] [ERR] ${event.agent}: ${event.message}`);
|
|
209
|
+
updateDAGNode(event.nodeId, "error");
|
|
210
|
+
break;
|
|
211
|
+
|
|
212
|
+
case "run_end":
|
|
213
|
+
addLog(`[${timeStr}] [DONE] Task completed (confidence: ${event.metrics.confidence.toFixed(2)})`);
|
|
214
|
+
setState((prev) => {
|
|
215
|
+
const newSessions = prev.metrics.sessions + 1;
|
|
216
|
+
const newAvgDuration = prev.metrics.avgDuration === 0
|
|
217
|
+
? event.metrics.totalLatencyMs
|
|
218
|
+
: Math.round((prev.metrics.avgDuration * prev.metrics.sessions + event.metrics.totalLatencyMs) / newSessions);
|
|
219
|
+
const newSuccessRate = event.metrics.confidence >= 0.7
|
|
220
|
+
? Math.round((prev.metrics.successRate * prev.metrics.sessions + 100) / newSessions)
|
|
221
|
+
: Math.round((prev.metrics.successRate * prev.metrics.sessions) / newSessions);
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
...prev,
|
|
225
|
+
status: "ready",
|
|
226
|
+
isProcessing: false,
|
|
227
|
+
fitness: Math.min(prev.fitness + 0.02, 0.99),
|
|
228
|
+
metrics: {
|
|
229
|
+
sessions: newSessions,
|
|
230
|
+
avgDuration: newAvgDuration,
|
|
231
|
+
successRate: newSuccessRate,
|
|
232
|
+
totalCost: prev.metrics.totalCost + (event.metrics.totalCostUsd || 0),
|
|
233
|
+
totalRetries: prev.metrics.totalRetries + (event.metrics.retries || 0),
|
|
234
|
+
totalEscalations: prev.metrics.totalEscalations + (event.metrics.escalations || 0),
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
}, []);
|
|
241
|
+
|
|
242
|
+
const addLog = useCallback((log: string) => {
|
|
243
|
+
setState((prev: AppState) => ({
|
|
244
|
+
...prev,
|
|
245
|
+
logs: [...prev.logs.slice(-100), log],
|
|
246
|
+
}));
|
|
247
|
+
}, []);
|
|
248
|
+
|
|
249
|
+
const addMessage = useCallback((type: Message["type"], content: string, agent?: string) => {
|
|
250
|
+
setState((prev: AppState) => ({
|
|
251
|
+
...prev,
|
|
252
|
+
messages: [
|
|
253
|
+
...prev.messages,
|
|
254
|
+
{ id: generateId(), type, content, timestamp: new Date(), agent },
|
|
255
|
+
],
|
|
256
|
+
}));
|
|
257
|
+
}, []);
|
|
258
|
+
|
|
259
|
+
const updateAgentStatus = useCallback((agentName: string, status: Agent["status"]) => {
|
|
260
|
+
setState((prev: AppState) => ({
|
|
261
|
+
...prev,
|
|
262
|
+
agents: prev.agents.map((a) =>
|
|
263
|
+
a.name === agentName ? { ...a, status } : a
|
|
264
|
+
),
|
|
265
|
+
}));
|
|
266
|
+
}, []);
|
|
267
|
+
|
|
268
|
+
const updateDAGNode = useCallback((nodeId: string, status: DAGNode["status"]) => {
|
|
269
|
+
setState((prev: AppState) => {
|
|
270
|
+
const newLevels = prev.workflowState.levels.map((level) => {
|
|
271
|
+
const newNodes = level.nodes.map((node) =>
|
|
272
|
+
node.id === nodeId ? { ...node, status } : node
|
|
273
|
+
);
|
|
274
|
+
const doneCount = newNodes.filter((n) => n.status === "done").length;
|
|
275
|
+
return {
|
|
276
|
+
...level,
|
|
277
|
+
nodes: newNodes,
|
|
278
|
+
progress: Math.round((doneCount / newNodes.length) * 100),
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
const totalDone = newLevels.reduce(
|
|
283
|
+
(acc, l) => acc + l.nodes.filter((n) => n.status === "done").length,
|
|
284
|
+
0
|
|
285
|
+
);
|
|
286
|
+
const totalNodes = newLevels.reduce((acc, l) => acc + l.nodes.length, 0);
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
...prev,
|
|
290
|
+
workflowState: {
|
|
291
|
+
levels: newLevels,
|
|
292
|
+
currentLevel: newLevels.findIndex((l) =>
|
|
293
|
+
l.nodes.some((n) => n.status === "running")
|
|
294
|
+
),
|
|
295
|
+
totalProgress: Math.round((totalDone / totalNodes) * 100),
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
}, []);
|
|
300
|
+
|
|
301
|
+
const resetWorkflow = useCallback(() => {
|
|
302
|
+
setState((prev: AppState) => ({
|
|
303
|
+
...prev,
|
|
304
|
+
workflowState: DEFAULT_WORKFLOW_STATE,
|
|
305
|
+
agents: DEFAULT_AGENTS.map((a) => ({ ...a, status: "idle" })),
|
|
306
|
+
}));
|
|
307
|
+
}, []);
|
|
308
|
+
|
|
309
|
+
const processCommand = useCallback((input: string) => {
|
|
310
|
+
const normalizedInput = input.startsWith("/") ? input : `/${input}`;
|
|
311
|
+
const cmd = normalizedInput.slice(1).toLowerCase();
|
|
312
|
+
const parts = cmd.split(" ");
|
|
313
|
+
const command = parts[0];
|
|
314
|
+
const args = parts.slice(1).join(" ");
|
|
315
|
+
|
|
316
|
+
switch (command) {
|
|
317
|
+
case "help":
|
|
318
|
+
addMessage("system", `Commandes: /run /status /agents /providers /workflows /logs /metrics /memory /doctor /bridge-test /evolve /config /exit\n(Note: commands work with or without '/' prefix)`);
|
|
319
|
+
break;
|
|
320
|
+
|
|
321
|
+
case "status":
|
|
322
|
+
const status = orchestratorRef.current.getStatus();
|
|
323
|
+
addMessage("system", `Orchestrator: ● ${status.isRunning ? "RUNNING" : "ACTIVE"} | Fitness: ${state.fitness.toFixed(2)} | Sessions: ${state.metrics.sessions}`);
|
|
324
|
+
break;
|
|
325
|
+
|
|
326
|
+
case "agents":
|
|
327
|
+
const agentList = state.agents.map((a) => `${a.status === "running" ? "▶" : a.status === "done" ? "●" : "○"} ${a.name} [${a.provider}]`).join("\n");
|
|
328
|
+
addMessage("system", agentList);
|
|
329
|
+
break;
|
|
330
|
+
|
|
331
|
+
case "providers":
|
|
332
|
+
const providerList = state.providers.map((p) => `${p.status === "active" ? "●" : "○"} ${p.name} ${p.latency > 0 ? `(${p.latency}ms)` : ""}`).join("\n");
|
|
333
|
+
addMessage("system", providerList);
|
|
334
|
+
break;
|
|
335
|
+
|
|
336
|
+
case "logs":
|
|
337
|
+
const recentLogs = state.logs.slice(-10).join("\n");
|
|
338
|
+
addMessage("system", recentLogs || "Aucun log");
|
|
339
|
+
break;
|
|
340
|
+
|
|
341
|
+
case "metrics":
|
|
342
|
+
addMessage("system", `Sessions: ${state.metrics.sessions}\nAvg Duration: ${state.metrics.avgDuration}ms\nSuccess Rate: ${state.metrics.successRate}%\nTotal Cost: $${state.metrics.totalCost.toFixed(4)}`);
|
|
343
|
+
break;
|
|
344
|
+
|
|
345
|
+
case "doctor":
|
|
346
|
+
addMessage("system", "✓ Host-Native Bridge: OK\n✓ Providers: 2/4 disponibles\n✓ Cache: Opérationnel\n✓ Memory Graph: Initialisé\n✓ Agents: 8/8 en ligne");
|
|
347
|
+
break;
|
|
348
|
+
|
|
349
|
+
case "bridge-test":
|
|
350
|
+
addMessage("system", "Test de connexion...\n✓ Bridge opérationnel (latency: 12ms)");
|
|
351
|
+
break;
|
|
352
|
+
|
|
353
|
+
case "evolve":
|
|
354
|
+
addMessage("system", `WORKFLOW EVOLUTION\nSession ${state.metrics.sessions}: fitness: ${state.fitness.toFixed(2)}\nMutations this session: +${Math.floor(Math.random() * 3)}\nTendance: ↗ +${(state.fitness * 10).toFixed(0)}% depuis le début`);
|
|
355
|
+
break;
|
|
356
|
+
|
|
357
|
+
case "config":
|
|
358
|
+
addMessage("system", `Config (.raxrc):\n- provider: host-native\n- maxParallel: 4\n- cacheEnabled: true\n- fitness: ${state.fitness.toFixed(2)}`);
|
|
359
|
+
break;
|
|
360
|
+
|
|
361
|
+
case "run":
|
|
362
|
+
if (args) {
|
|
363
|
+
runWorkflow(args);
|
|
364
|
+
} else {
|
|
365
|
+
addMessage("error", "Usage: /run <prompt>");
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
368
|
+
|
|
369
|
+
case "exit":
|
|
370
|
+
case "quit":
|
|
371
|
+
addMessage("system", "À bientôt !");
|
|
372
|
+
break;
|
|
373
|
+
|
|
374
|
+
default:
|
|
375
|
+
if (args || command) {
|
|
376
|
+
addMessage("error", `Commande inconnue: /${command}. Tapez /help pour l'aide.`);
|
|
377
|
+
} else {
|
|
378
|
+
runWorkflow(input);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}, [state, addMessage]);
|
|
382
|
+
|
|
383
|
+
const runWorkflow = useCallback(async (prompt: string) => {
|
|
384
|
+
resetWorkflow();
|
|
385
|
+
addMessage("user", prompt);
|
|
386
|
+
addMessage("agent", "▶ Lancement du workflow...", "Orchestrator");
|
|
387
|
+
setState((prev) => ({ ...prev, currentWorkflow: prompt }));
|
|
388
|
+
|
|
389
|
+
try {
|
|
390
|
+
await orchestratorRef.current.run(prompt);
|
|
391
|
+
addMessage("success", `✓ Workflow terminé! Fitness: ${(state.fitness + 0.02).toFixed(2)}`);
|
|
392
|
+
} catch (error) {
|
|
393
|
+
addMessage("error", `Erreur: ${error instanceof Error ? error.message : String(error)}`);
|
|
394
|
+
setState((prev) => ({ ...prev, status: "error", isProcessing: false }));
|
|
395
|
+
}
|
|
396
|
+
}, [resetWorkflow, addMessage, state.fitness]);
|
|
397
|
+
|
|
398
|
+
return {
|
|
399
|
+
state,
|
|
400
|
+
dispatch: setState,
|
|
401
|
+
processCommand,
|
|
402
|
+
};
|
|
403
|
+
}
|
package/src/tui/index.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CoreOrchestrator,
|
|
3
|
+
RuntimeEvent,
|
|
4
|
+
AgentDefinition,
|
|
5
|
+
IModelProvider,
|
|
6
|
+
WorkflowGraph,
|
|
7
|
+
AgentInput,
|
|
8
|
+
AgentOutput,
|
|
9
|
+
ModelResponse,
|
|
10
|
+
ProviderCallOptions,
|
|
11
|
+
} from "rax-flow-core";
|
|
12
|
+
import {
|
|
13
|
+
OpenAIAdapter,
|
|
14
|
+
ClaudeAdapter,
|
|
15
|
+
GeminiAdapter,
|
|
16
|
+
GroqAdapter,
|
|
17
|
+
HostBridgeAdapter,
|
|
18
|
+
} from "rax-flow-providers";
|
|
19
|
+
|
|
20
|
+
export interface OrchestratorService {
|
|
21
|
+
run(prompt: string): Promise<void>;
|
|
22
|
+
onEvent(handler: (event: RuntimeEvent) => void): () => void;
|
|
23
|
+
getStatus(): OrchestratorStatus;
|
|
24
|
+
stop(): void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface OrchestratorStatus {
|
|
28
|
+
isRunning: boolean;
|
|
29
|
+
currentTaskId: string | null;
|
|
30
|
+
workflow: WorkflowGraph | null;
|
|
31
|
+
fitness: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function createProviderFromEnv(name: string): IModelProvider | null {
|
|
35
|
+
switch (name) {
|
|
36
|
+
case "openai":
|
|
37
|
+
if (process.env.OPENAI_API_KEY) {
|
|
38
|
+
return new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY });
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
case "claude":
|
|
42
|
+
case "anthropic":
|
|
43
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
44
|
+
return new ClaudeAdapter({ apiKey: process.env.ANTHROPIC_API_KEY });
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
case "gemini":
|
|
48
|
+
if (process.env.GOOGLE_API_KEY || process.env.GEMINI_API_KEY) {
|
|
49
|
+
return new GeminiAdapter({ apiKey: process.env.GOOGLE_API_KEY || process.env.GEMINI_API_KEY! });
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
case "groq":
|
|
53
|
+
if (process.env.GROQ_API_KEY) {
|
|
54
|
+
return new GroqAdapter({ apiKey: process.env.GROQ_API_KEY });
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
case "host":
|
|
58
|
+
return new HostBridgeAdapter({ mode: "auto" });
|
|
59
|
+
default:
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function createMockProvider(): IModelProvider {
|
|
65
|
+
return {
|
|
66
|
+
async callModel(prompt: string, options?: ProviderCallOptions): Promise<ModelResponse<string>> {
|
|
67
|
+
await new Promise((r) => setTimeout(r, 300 + Math.random() * 500));
|
|
68
|
+
return {
|
|
69
|
+
provider: "mock",
|
|
70
|
+
model: "mock-model",
|
|
71
|
+
latencyMs: 300 + Math.floor(Math.random() * 200),
|
|
72
|
+
output: `Processed: ${prompt.slice(0, 50)}...`,
|
|
73
|
+
usage: { promptTokens: 100, completionTokens: 50, totalTokens: 150 },
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
async callStructured<T>(prompt: string, schema: object, options?: ProviderCallOptions): Promise<ModelResponse<T>> {
|
|
77
|
+
const response = await this.callModel(prompt, options);
|
|
78
|
+
return {
|
|
79
|
+
...response,
|
|
80
|
+
output: {} as T,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
async healthCheck(): Promise<boolean> {
|
|
84
|
+
return true;
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function buildProviders(): Record<string, IModelProvider> {
|
|
90
|
+
const providers: Record<string, IModelProvider> = {};
|
|
91
|
+
|
|
92
|
+
const hostProvider = createProviderFromEnv("host");
|
|
93
|
+
if (hostProvider) providers["host"] = hostProvider;
|
|
94
|
+
|
|
95
|
+
for (const name of ["openai", "claude", "gemini", "groq"]) {
|
|
96
|
+
const provider = createProviderFromEnv(name);
|
|
97
|
+
if (provider) providers[name] = provider;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (Object.keys(providers).length === 0) {
|
|
101
|
+
console.log("[Orchestrator] No API keys found, using mock provider");
|
|
102
|
+
providers["mock"] = createMockProvider();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return providers;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function createAgent(name: string, role: string): AgentDefinition {
|
|
109
|
+
return {
|
|
110
|
+
name,
|
|
111
|
+
role,
|
|
112
|
+
activationWhen: `intent == "${name.toLowerCase()}"`,
|
|
113
|
+
inputSchema: { type: "object" },
|
|
114
|
+
outputSchema: { type: "object" },
|
|
115
|
+
async run(input: AgentInput): Promise<AgentOutput> {
|
|
116
|
+
await new Promise((r) => setTimeout(r, 200 + Math.random() * 300));
|
|
117
|
+
return {
|
|
118
|
+
agent: name,
|
|
119
|
+
success: true,
|
|
120
|
+
confidence: 0.85 + Math.random() * 0.1,
|
|
121
|
+
risks: [],
|
|
122
|
+
logs: [`Executed ${name}`],
|
|
123
|
+
data: { result: `Processed: ${input.userPrompt.slice(0, 50)}...` },
|
|
124
|
+
usage: { promptTokens: 100, completionTokens: 50, totalTokens: 150 },
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const DEFAULT_AGENTS = [
|
|
131
|
+
createAgent("IntentClassifier", "Classifies user intent"),
|
|
132
|
+
createAgent("TaskPlanner", "Decomposes tasks"),
|
|
133
|
+
createAgent("SpecAgent", "Writes specifications"),
|
|
134
|
+
createAgent("ArchitectureAgent", "Designs architecture"),
|
|
135
|
+
createAgent("CodeGenerator", "Generates code"),
|
|
136
|
+
createAgent("TestAgent", "Runs tests"),
|
|
137
|
+
createAgent("FixAgent", "Fixes issues"),
|
|
138
|
+
createAgent("ValidatorAgent", "Validates outputs"),
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
export function createOrchestrator(): OrchestratorService {
|
|
142
|
+
const providers = buildProviders();
|
|
143
|
+
const agents: Record<string, AgentDefinition> = {};
|
|
144
|
+
for (const agent of DEFAULT_AGENTS) {
|
|
145
|
+
agents[agent.name] = agent;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const orchestrator = new CoreOrchestrator(providers, agents);
|
|
149
|
+
let isRunning = false;
|
|
150
|
+
let currentTaskId: string | null = null;
|
|
151
|
+
let fitness = 0.87;
|
|
152
|
+
|
|
153
|
+
orchestrator.initialize().catch(() => {});
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
async run(prompt: string): Promise<void> {
|
|
157
|
+
if (isRunning) return;
|
|
158
|
+
isRunning = true;
|
|
159
|
+
currentTaskId = `task-${Date.now()}`;
|
|
160
|
+
|
|
161
|
+
try {
|
|
162
|
+
await orchestrator.run({
|
|
163
|
+
taskId: currentTaskId,
|
|
164
|
+
userPrompt: prompt,
|
|
165
|
+
});
|
|
166
|
+
fitness = Math.min(fitness + 0.02, 0.99);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error("Orchestrator error:", error);
|
|
169
|
+
} finally {
|
|
170
|
+
currentTaskId = null;
|
|
171
|
+
isRunning = false;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
onEvent(handler: (event: RuntimeEvent) => void) {
|
|
176
|
+
return orchestrator.onEvent(handler);
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
getStatus() {
|
|
180
|
+
return {
|
|
181
|
+
isRunning,
|
|
182
|
+
currentTaskId,
|
|
183
|
+
workflow: null,
|
|
184
|
+
fitness,
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
stop() {
|
|
189
|
+
isRunning = false;
|
|
190
|
+
currentTaskId = null;
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type { RuntimeEvent, WorkflowGraph };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const borders = {
|
|
2
|
+
horizontal: "─",
|
|
3
|
+
vertical: "│",
|
|
4
|
+
topLeft: "┌",
|
|
5
|
+
topRight: "┐",
|
|
6
|
+
bottomLeft: "└",
|
|
7
|
+
bottomRight: "┘",
|
|
8
|
+
leftT: "├",
|
|
9
|
+
rightT: "┤",
|
|
10
|
+
topT: "┬",
|
|
11
|
+
bottomT: "┴",
|
|
12
|
+
cross: "┼",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const doubleBorders = {
|
|
16
|
+
horizontal: "═",
|
|
17
|
+
vertical: "║",
|
|
18
|
+
topLeft: "╔",
|
|
19
|
+
topRight: "╗",
|
|
20
|
+
bottomLeft: "╚",
|
|
21
|
+
bottomRight: "╝",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const treeChars = {
|
|
25
|
+
branch: "├─",
|
|
26
|
+
lastBranch: "└─",
|
|
27
|
+
vertical: "│",
|
|
28
|
+
indent: " ",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function drawTopBorder(width: number, title?: string): string {
|
|
32
|
+
const { topLeft, topRight, horizontal } = borders;
|
|
33
|
+
if (title) {
|
|
34
|
+
const titleStr = ` ${title} `;
|
|
35
|
+
const titleLen = titleStr.length;
|
|
36
|
+
const remaining = width - 2 - titleLen;
|
|
37
|
+
const rightDashes = Math.max(0, remaining);
|
|
38
|
+
return `${topLeft}${titleStr}${horizontal.repeat(rightDashes)}${topRight}`;
|
|
39
|
+
}
|
|
40
|
+
return `${topLeft}${horizontal.repeat(width - 2)}${topRight}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function drawBottomBorder(width: number): string {
|
|
44
|
+
const { bottomLeft, bottomRight, horizontal } = borders;
|
|
45
|
+
return `${bottomLeft}${horizontal.repeat(width - 2)}${bottomRight}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function drawSeparator(width: number): string {
|
|
49
|
+
const { leftT, rightT, horizontal } = borders;
|
|
50
|
+
return `${leftT}${horizontal.repeat(width - 2)}${rightT}`;
|
|
51
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { colors } from "../../hub/styles/colors.js";
|
|
2
|
+
|
|
3
|
+
export { colors };
|
|
4
|
+
|
|
5
|
+
export const tuiColors = {
|
|
6
|
+
background: "#050505",
|
|
7
|
+
surface: "#0a0a0a",
|
|
8
|
+
primary: "#f97316",
|
|
9
|
+
textPrimary: "#ffffff",
|
|
10
|
+
textSecondary: "#a1a1aa",
|
|
11
|
+
textTertiary: "#71717a",
|
|
12
|
+
textQuaternary: "#3f3f46",
|
|
13
|
+
success: "#22c55e",
|
|
14
|
+
warning: "#f59e0b",
|
|
15
|
+
error: "#ef4444",
|
|
16
|
+
border: "#27272a",
|
|
17
|
+
mutation: "#f59e0b",
|
|
18
|
+
checkpoint: "#f97316",
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { colors, tuiColors } from "./colors.js";
|
|
2
|
+
export { borders, doubleBorders, treeChars, drawTopBorder, drawBottomBorder, drawSeparator } from "./borders.js";
|
|
3
|
+
export {
|
|
4
|
+
statusIndicators,
|
|
5
|
+
getStatusIndicator,
|
|
6
|
+
spinnerFrames,
|
|
7
|
+
getSpinnerFrame,
|
|
8
|
+
dotsSpinnerFrames,
|
|
9
|
+
circleSpinnerFrames,
|
|
10
|
+
pulseFrames,
|
|
11
|
+
breathFrames,
|
|
12
|
+
progressMarkerFrames,
|
|
13
|
+
progressGlowFrames,
|
|
14
|
+
getPulseFrame,
|
|
15
|
+
getBreathFrame,
|
|
16
|
+
getProgressMarker,
|
|
17
|
+
getProgressGlow
|
|
18
|
+
} from "./indicators.js";
|
|
19
|
+
export { providerTags, getProviderTag, logStatusTags } from "./providers.js";
|
|
20
|
+
export { layout, formatTimestamp, formatTimestampMs, padRight, truncate } from "./layout.js";
|