@ranker/raxflow 0.2.2 → 0.2.3
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/dist/benchmark.d.ts +10 -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 +3 -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 +8 -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 +4 -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 +7 -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 +4 -0
- package/dist/dashboard.d.ts.map +1 -0
- package/{src/dashboard.ts → dist/dashboard.js} +8 -10
- package/dist/dashboard.js.map +1 -0
- package/dist/doctor.d.ts +6 -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 +7 -0
- package/dist/evolve.d.ts.map +1 -0
- package/{src/evolve.ts → dist/evolve.js} +7 -33
- package/dist/evolve.js.map +1 -0
- package/dist/host-init-templates.d.ts +16 -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 +2 -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 +2 -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 +2 -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/commands/agents.d.ts +3 -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 +4 -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 +3 -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 +3 -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 +3 -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 +3 -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 +3 -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 +3 -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 +3 -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 +4 -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 +13 -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 +4 -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 +4 -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 +23 -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 +63 -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 +34 -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/types.d.ts +27 -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 +11 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +1 -0
- package/dist/index.js.map +1 -0
- package/dist/init-host.d.ts +10 -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 +8 -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 +16 -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/{src/setup/components/AsciiBanner.tsx → dist/setup/components/AsciiBanner.js} +24 -94
- 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 +98 -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/{src/setup/index.ts → dist/setup/index.js} +14 -19
- 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 +12 -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 +136 -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 +17 -0
- package/dist/tui/components/ChatPanel.d.ts.map +1 -0
- package/dist/tui/components/ChatPanel.js +51 -0
- package/dist/tui/components/ChatPanel.js.map +1 -0
- package/dist/tui/components/DAGPanel.d.ts +37 -0
- package/dist/tui/components/DAGPanel.d.ts.map +1 -0
- package/dist/tui/components/DAGPanel.js +52 -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 +10 -0
- package/dist/tui/components/MemoryPanel.d.ts +22 -0
- package/dist/tui/components/MetricsPanel.d.ts +19 -0
- package/dist/tui/components/StatusPanel.d.ts +24 -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/{src/tui/components/animations/index.ts → dist/tui/components/animations/index.d.ts} +2 -10
- 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/{src/tui/index.ts → dist/tui/index.js} +2 -3
- 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 +22 -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/{src/ws-relay.ts → dist/ws-relay.js} +39 -47
- package/dist/ws-relay.js.map +1 -0
- package/package.json +5 -1
- package/dashboard/index.html +0 -420
- package/src/benchmark.ts +0 -156
- package/src/bin.ts +0 -156
- package/src/bootstrap.ts +0 -36
- package/src/bridge-adapter-templates.ts +0 -181
- package/src/bridge-test.ts +0 -107
- package/src/doctor.ts +0 -92
- package/src/host-init-templates.ts +0 -134
- package/src/hub/__tests__/commands.test.ts +0 -84
- package/src/hub/__tests__/history.test.ts +0 -137
- package/src/hub/__tests__/parser.test.ts +0 -105
- package/src/hub/commands/agents.ts +0 -53
- package/src/hub/commands/index.ts +0 -140
- package/src/hub/commands/logs.ts +0 -70
- package/src/hub/commands/memory.ts +0 -47
- package/src/hub/commands/metrics.ts +0 -49
- package/src/hub/commands/providers.ts +0 -39
- package/src/hub/commands/run.ts +0 -37
- package/src/hub/commands/status.ts +0 -69
- package/src/hub/commands/workflows.ts +0 -64
- package/src/hub/config-loader.ts +0 -37
- package/src/hub/event-listener.ts +0 -17
- package/src/hub/history.ts +0 -66
- package/src/hub/index.ts +0 -132
- package/src/hub/parser.ts +0 -107
- package/src/hub/styles/borders.ts +0 -74
- package/src/hub/styles/colors.ts +0 -129
- package/src/hub/styles/typography.ts +0 -68
- package/src/hub/types.ts +0 -31
- package/src/init-host.ts +0 -285
- package/src/install.ts +0 -118
- package/src/run.ts +0 -317
- package/src/setup/components/ApiKeyInput.tsx +0 -158
- package/src/setup/components/CliDetector.tsx +0 -230
- package/src/setup/components/ModeSelector.tsx +0 -137
- package/src/setup/components/ProviderSelector.tsx +0 -175
- package/src/setup/components/SetupWizard.tsx +0 -368
- package/src/setup/components/StepIndicator.tsx +0 -74
- package/src/setup/components/SuccessScreen.tsx +0 -229
- package/src/setup/utils/cli-detection.ts +0 -99
- package/src/setup/utils/config-writer.ts +0 -249
- package/src/styles.ts +0 -12
- package/src/tui/App.tsx +0 -183
- package/src/tui/components/AgentStateIcon.tsx +0 -84
- package/src/tui/components/AnimatedBranch.tsx +0 -134
- package/src/tui/components/ChatPanel.tsx +0 -128
- package/src/tui/components/DAGPanel.tsx +0 -212
- package/src/tui/components/ExecutionTimeline.tsx +0 -225
- package/src/tui/components/Header.tsx +0 -109
- package/src/tui/components/HelpOverlay.tsx +0 -140
- package/src/tui/components/InputBar.tsx +0 -69
- package/src/tui/components/LogsPanel.tsx +0 -132
- package/src/tui/components/MemoryPanel.tsx +0 -166
- package/src/tui/components/MetricsPanel.tsx +0 -152
- package/src/tui/components/StatusPanel.tsx +0 -140
- package/src/tui/components/TaskTree.tsx +0 -159
- package/src/tui/components/animations/ProgressBar.tsx +0 -160
- package/src/tui/components/animations/Pulse.tsx +0 -73
- package/src/tui/components/animations/Spinner.tsx +0 -54
- package/src/tui/components/animations/StatusAnimator.tsx +0 -153
- package/src/tui/components/animations/TypingEffect.tsx +0 -119
- package/src/tui/hooks/useAnimation.ts +0 -290
- package/src/tui/hooks/useAppState.ts +0 -403
- package/src/tui/services/orchestrator.ts +0 -195
- package/src/tui/styles/borders.ts +0 -51
- package/src/tui/styles/colors.ts +0 -19
- package/src/tui/styles/index.ts +0 -20
- package/src/tui/styles/indicators.ts +0 -54
- package/src/tui/styles/layout.ts +0 -44
- package/src/tui/styles/providers.ts +0 -32
- package/src/tui/utils/animation.ts +0 -124
- package/src/vendor-manifests.ts +0 -113
- package/tsconfig.json +0 -28
|
@@ -1,403 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
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 };
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
}
|
package/src/tui/styles/colors.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
};
|
package/src/tui/styles/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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";
|