@ranker/raxflow 0.2.1 → 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/bin.d.ts +3 -0
- package/dist/bootstrap.d.ts +8 -0
- package/dist/bridge-adapter-templates.d.ts +4 -0
- package/dist/bridge-test.d.ts +7 -0
- package/dist/dashboard.d.ts +4 -0
- package/dist/doctor.d.ts +6 -0
- package/dist/evolve.d.ts +7 -0
- package/dist/host-init-templates.d.ts +16 -0
- package/dist/hub/__tests__/commands.test.d.ts +2 -0
- package/dist/hub/__tests__/history.test.d.ts +2 -0
- package/dist/hub/__tests__/parser.test.d.ts +2 -0
- package/dist/hub/commands/agents.d.ts +3 -0
- package/dist/hub/commands/index.d.ts +4 -0
- package/dist/hub/commands/logs.d.ts +3 -0
- package/dist/hub/commands/memory.d.ts +3 -0
- package/dist/hub/commands/metrics.d.ts +3 -0
- package/dist/hub/commands/providers.d.ts +3 -0
- package/dist/hub/commands/run.d.ts +3 -0
- package/dist/hub/commands/status.d.ts +3 -0
- package/dist/hub/commands/workflows.d.ts +3 -0
- package/dist/hub/config-loader.d.ts +4 -0
- package/dist/hub/history.d.ts +13 -0
- package/dist/hub/index.d.ts +4 -0
- package/dist/hub/parser.d.ts +4 -0
- package/dist/hub/styles/borders.d.ts +23 -0
- package/dist/hub/styles/colors.d.ts +63 -0
- package/dist/hub/styles/typography.d.ts +34 -0
- package/dist/hub/types.d.ts +27 -0
- package/{src/index.ts → dist/index.d.ts} +1 -0
- package/dist/init-host.d.ts +10 -0
- package/dist/install.d.ts +8 -0
- package/dist/run.d.ts +16 -0
- package/dist/setup/components/ProviderSelector.d.ts.map +1 -1
- package/dist/setup/components/ProviderSelector.js +8 -7
- package/dist/setup/components/ProviderSelector.js.map +1 -1
- package/dist/styles.d.ts +12 -0
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +7 -2
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/components/ChatPanel.d.ts +1 -0
- package/dist/tui/components/ChatPanel.d.ts.map +1 -1
- package/dist/tui/components/ChatPanel.js +4 -3
- package/dist/tui/components/ChatPanel.js.map +1 -1
- package/dist/tui/components/DAGPanel.d.ts +1 -0
- package/dist/tui/components/DAGPanel.d.ts.map +1 -1
- package/dist/tui/components/DAGPanel.js +4 -3
- package/dist/tui/components/DAGPanel.js.map +1 -1
- package/dist/tui/components/Header.d.ts.map +1 -1
- package/dist/tui/components/Header.js +1 -1
- package/dist/tui/components/Header.js.map +1 -1
- package/dist/tui/components/InputBar.d.ts.map +1 -1
- package/dist/tui/components/InputBar.js +1 -1
- package/dist/tui/components/InputBar.js.map +1 -1
- package/dist/tui/components/LogsPanel.d.ts +1 -0
- package/dist/tui/components/LogsPanel.d.ts.map +1 -1
- package/dist/tui/components/LogsPanel.js +4 -3
- package/dist/tui/components/LogsPanel.js.map +1 -1
- package/dist/tui/components/MemoryPanel.d.ts +1 -0
- package/dist/tui/components/MemoryPanel.d.ts.map +1 -1
- package/dist/tui/components/MemoryPanel.js +2 -2
- package/dist/tui/components/MemoryPanel.js.map +1 -1
- package/dist/tui/components/MetricsPanel.d.ts +1 -0
- package/dist/tui/components/MetricsPanel.d.ts.map +1 -1
- package/dist/tui/components/MetricsPanel.js +2 -2
- package/dist/tui/components/MetricsPanel.js.map +1 -1
- package/dist/tui/components/StatusPanel.d.ts +1 -0
- package/dist/tui/components/StatusPanel.d.ts.map +1 -1
- package/dist/tui/components/StatusPanel.js +4 -3
- package/dist/tui/components/StatusPanel.js.map +1 -1
- package/dist/vendor-manifests.d.ts +22 -0
- package/package.json +5 -1
- package/dashboard/index.html +0 -420
- package/dist/hub/chat/ChatApp.d.ts +0 -2
- package/dist/hub/chat/ChatApp.d.ts.map +0 -1
- package/dist/hub/chat/ChatApp.js +0 -146
- package/dist/hub/chat/ChatApp.js.map +0 -1
- package/dist/hub/chat/components/ChatInput.d.ts +0 -9
- package/dist/hub/chat/components/ChatInput.d.ts.map +0 -1
- package/dist/hub/chat/components/ChatInput.js +0 -19
- package/dist/hub/chat/components/ChatInput.js.map +0 -1
- package/dist/hub/chat/components/MessageList.d.ts +0 -7
- package/dist/hub/chat/components/MessageList.d.ts.map +0 -1
- package/dist/hub/chat/components/MessageList.js +0 -6
- package/dist/hub/chat/components/MessageList.js.map +0 -1
- package/dist/hub/chat/context.d.ts.map +0 -1
- package/dist/hub/chat/context.js +0 -42
- package/dist/hub/chat/context.js.map +0 -1
- package/dist/hub/chat/hooks/useChatHistory.d.ts +0 -7
- package/dist/hub/chat/hooks/useChatHistory.d.ts.map +0 -1
- package/dist/hub/chat/hooks/useChatHistory.js +0 -31
- package/dist/hub/chat/hooks/useChatHistory.js.map +0 -1
- package/dist/hub/chat/index.d.ts.map +0 -1
- package/dist/hub/chat/index.js +0 -7
- package/dist/hub/chat/index.js.map +0 -1
- package/dist/hub/chat/intent-parser.d.ts.map +0 -1
- package/dist/hub/chat/intent-parser.js +0 -48
- package/dist/hub/chat/intent-parser.js.map +0 -1
- package/dist/hub/chat/types.d.ts.map +0 -1
- package/dist/hub/chat/types.js +0 -2
- package/dist/hub/chat/types.js.map +0 -1
- package/dist/hub/tui/App.d.ts +0 -2
- package/dist/hub/tui/App.d.ts.map +0 -1
- package/dist/hub/tui/App.js +0 -53
- package/dist/hub/tui/App.js.map +0 -1
- package/dist/hub/tui/components/AgentQueue.d.ts +0 -6
- package/dist/hub/tui/components/AgentQueue.d.ts.map +0 -1
- package/dist/hub/tui/components/AgentQueue.js +0 -20
- package/dist/hub/tui/components/AgentQueue.js.map +0 -1
- package/dist/hub/tui/components/DAGPanel.d.ts +0 -16
- package/dist/hub/tui/components/DAGPanel.d.ts.map +0 -1
- package/dist/hub/tui/components/DAGPanel.js +0 -51
- package/dist/hub/tui/components/DAGPanel.js.map +0 -1
- package/dist/hub/tui/components/Header.d.ts +0 -7
- package/dist/hub/tui/components/Header.d.ts.map +0 -1
- package/dist/hub/tui/components/Header.js +0 -17
- package/dist/hub/tui/components/Header.js.map +0 -1
- package/dist/hub/tui/components/LogsPanel.d.ts +0 -6
- package/dist/hub/tui/components/LogsPanel.d.ts.map +0 -1
- package/dist/hub/tui/components/LogsPanel.js +0 -26
- package/dist/hub/tui/components/LogsPanel.js.map +0 -1
- package/dist/hub/tui/components/StatusBar.d.ts +0 -8
- package/dist/hub/tui/components/StatusBar.d.ts.map +0 -1
- package/dist/hub/tui/components/StatusBar.js +0 -7
- package/dist/hub/tui/components/StatusBar.js.map +0 -1
- package/dist/hub/tui/hooks/useEvents.d.ts +0 -2
- package/dist/hub/tui/hooks/useEvents.d.ts.map +0 -1
- package/dist/hub/tui/hooks/useEvents.js +0 -13
- package/dist/hub/tui/hooks/useEvents.js.map +0 -1
- package/dist/hub/tui/index.d.ts.map +0 -1
- package/dist/hub/tui/index.js +0 -7
- package/dist/hub/tui/index.js.map +0 -1
- package/dist/hub/tui/types.d.ts.map +0 -1
- package/dist/hub/tui/types.js +0 -2
- package/dist/hub/tui/types.js.map +0 -1
- 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/dashboard.ts +0 -51
- package/src/doctor.ts +0 -92
- package/src/evolve.ts +0 -74
- 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/AsciiBanner.tsx +0 -125
- package/src/setup/components/CliDetector.tsx +0 -230
- package/src/setup/components/ModeSelector.tsx +0 -137
- package/src/setup/components/ProviderSelector.tsx +0 -174
- 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/index.ts +0 -34
- 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 -177
- package/src/tui/components/AgentStateIcon.tsx +0 -84
- package/src/tui/components/AnimatedBranch.tsx +0 -134
- package/src/tui/components/ChatPanel.tsx +0 -125
- package/src/tui/components/DAGPanel.tsx +0 -208
- 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 -129
- package/src/tui/components/MemoryPanel.tsx +0 -163
- package/src/tui/components/MetricsPanel.tsx +0 -149
- package/src/tui/components/StatusPanel.tsx +0 -137
- 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/components/animations/index.ts +0 -16
- package/src/tui/hooks/useAnimation.ts +0 -290
- package/src/tui/hooks/useAppState.ts +0 -403
- package/src/tui/index.ts +0 -9
- 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/src/ws-relay.ts +0 -156
- package/tsconfig.json +0 -28
package/src/benchmark.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { performance } from "node:perf_hooks";
|
|
4
|
-
import { CoreOrchestrator } from "rax-flow-core";
|
|
5
|
-
import { buildOfficialAgentsRuntime } from "rax-flow-agents";
|
|
6
|
-
import { ClaudeAdapter, GenericRestAdapter, HostBridgeAdapter, OpenAIAdapter } from "rax-flow-providers";
|
|
7
|
-
import { c } from "./styles.js";
|
|
8
|
-
import { readFile } from "node:fs/promises";
|
|
9
|
-
|
|
10
|
-
interface BenchOptions {
|
|
11
|
-
cwd: string;
|
|
12
|
-
prompt: string;
|
|
13
|
-
output?: string;
|
|
14
|
-
providerOverride?: string;
|
|
15
|
-
bridgeCommandOverride?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface RaxConfig {
|
|
19
|
-
defaultProvider?: string;
|
|
20
|
-
strongProvider?: string;
|
|
21
|
-
providers?: {
|
|
22
|
-
host?: { model?: string; mode?: "auto" | "bridge-only" | "mock"; bridgeCommandEnv?: string; timeoutMs?: number };
|
|
23
|
-
openai?: { model?: string; apiKeyEnv?: string; baseUrl?: string };
|
|
24
|
-
claude?: { model?: string; apiKeyEnv?: string; baseUrl?: string };
|
|
25
|
-
rest?: { endpoint?: string; tokenEnv?: string; model?: string };
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function loadConfig(cwd: string): Promise<RaxConfig> {
|
|
30
|
-
const file = path.join(cwd, ".raxrc");
|
|
31
|
-
const raw = await readFile(file, "utf8");
|
|
32
|
-
return JSON.parse(raw) as RaxConfig;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function createProviders(config: RaxConfig, bridgeCommandOverride?: string) {
|
|
36
|
-
const providers: Record<string, OpenAIAdapter | ClaudeAdapter | GenericRestAdapter | HostBridgeAdapter> = {};
|
|
37
|
-
|
|
38
|
-
const hostCfg = config.providers?.host;
|
|
39
|
-
const bridgeCommand = bridgeCommandOverride ?? process.env[hostCfg?.bridgeCommandEnv ?? "RAX_HOST_BRIDGE_COMMAND"];
|
|
40
|
-
providers.host = new HostBridgeAdapter({
|
|
41
|
-
model: hostCfg?.model ?? "host-managed",
|
|
42
|
-
mode: hostCfg?.mode ?? "auto",
|
|
43
|
-
command: bridgeCommand,
|
|
44
|
-
timeoutMs: hostCfg?.timeoutMs ?? 20000
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const openaiKey = process.env[config.providers?.openai?.apiKeyEnv ?? "OPENAI_API_KEY"];
|
|
48
|
-
if (openaiKey) {
|
|
49
|
-
providers.openai = new OpenAIAdapter(openaiKey, config.providers?.openai?.baseUrl);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const claudeKey = process.env[config.providers?.claude?.apiKeyEnv ?? "ANTHROPIC_API_KEY"];
|
|
53
|
-
if (claudeKey) {
|
|
54
|
-
providers.claude = new ClaudeAdapter(claudeKey, config.providers?.claude?.baseUrl);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const restEndpoint = config.providers?.rest?.endpoint;
|
|
58
|
-
if (restEndpoint) {
|
|
59
|
-
const restToken = process.env[config.providers?.rest?.tokenEnv ?? "RAX_REST_TOKEN"];
|
|
60
|
-
providers.rest = new GenericRestAdapter(restEndpoint, restToken);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return providers;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function pseudoScore(text: string): number {
|
|
67
|
-
const clean = text.trim();
|
|
68
|
-
if (!clean) return 0;
|
|
69
|
-
const lengthScore = Math.min(clean.length / 1200, 1);
|
|
70
|
-
const structureScore = ["{", "}", "-", "1.", "2."].reduce((acc, token) => acc + (clean.includes(token) ? 0.08 : 0), 0);
|
|
71
|
-
return Math.min(1, 0.45 + lengthScore * 0.35 + structureScore);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export async function runBenchmark(options: BenchOptions): Promise<number> {
|
|
75
|
-
let config: RaxConfig;
|
|
76
|
-
try {
|
|
77
|
-
config = await loadConfig(options.cwd);
|
|
78
|
-
} catch {
|
|
79
|
-
console.error(c.red("Missing .raxrc. Run `raxflow install` first."));
|
|
80
|
-
return 1;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const providers = createProviders(config, options.bridgeCommandOverride);
|
|
84
|
-
const selectedProvider = options.providerOverride ?? config.defaultProvider ?? "host";
|
|
85
|
-
const provider = providers[selectedProvider] ?? Object.values(providers)[0];
|
|
86
|
-
if (!provider) {
|
|
87
|
-
console.error(c.red("No provider configured for benchmark."));
|
|
88
|
-
return 1;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const baselineStart = performance.now();
|
|
92
|
-
const baselineRaw = await provider.callModel(options.prompt, { temperature: 0.2, maxTokens: 1200 });
|
|
93
|
-
const baselineLatency = performance.now() - baselineStart;
|
|
94
|
-
|
|
95
|
-
const agents = buildOfficialAgentsRuntime({
|
|
96
|
-
providers,
|
|
97
|
-
defaultProvider: selectedProvider,
|
|
98
|
-
strongProvider: config.strongProvider ?? "host",
|
|
99
|
-
providerModels: {
|
|
100
|
-
host: config.providers?.host?.model ?? "host-managed",
|
|
101
|
-
openai: config.providers?.openai?.model ?? "gpt-4.1-mini",
|
|
102
|
-
claude: config.providers?.claude?.model ?? "claude-3-5-sonnet-latest",
|
|
103
|
-
rest: config.providers?.rest?.model ?? "generic-llm"
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const orchestrator = new CoreOrchestrator(providers, agents, {}, { maxParallel: 4, cacheTtlMs: 0 });
|
|
108
|
-
const raxStart = performance.now();
|
|
109
|
-
const rax = await orchestrator.run({
|
|
110
|
-
taskId: `bench_${Date.now()}`,
|
|
111
|
-
userPrompt: options.prompt,
|
|
112
|
-
context: { benchmark: true }
|
|
113
|
-
});
|
|
114
|
-
const raxLatency = performance.now() - raxStart;
|
|
115
|
-
|
|
116
|
-
const baselineCorrectness = pseudoScore(baselineRaw.output);
|
|
117
|
-
const report = {
|
|
118
|
-
generatedAt: new Date().toISOString(),
|
|
119
|
-
prompt: options.prompt,
|
|
120
|
-
baseline: {
|
|
121
|
-
correctness: baselineCorrectness,
|
|
122
|
-
cost: 0,
|
|
123
|
-
latencyMs: Math.round(baselineLatency),
|
|
124
|
-
stability: baselineCorrectness * 0.9,
|
|
125
|
-
humanIntervention: baselineCorrectness < 0.7 ? 0.6 : 0.3
|
|
126
|
-
},
|
|
127
|
-
orchestrated: {
|
|
128
|
-
correctness: rax.result.confidence,
|
|
129
|
-
cost: rax.metrics.totalCostUsd,
|
|
130
|
-
latencyMs: Math.round(raxLatency),
|
|
131
|
-
stability: rax.result.success ? 0.9 : 0.5,
|
|
132
|
-
humanIntervention: rax.metrics.humanInterventionRequired ? 0.6 : 0.1
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const delta = {
|
|
137
|
-
correctness: +(report.orchestrated.correctness - report.baseline.correctness).toFixed(3),
|
|
138
|
-
cost: +(report.orchestrated.cost - report.baseline.cost).toFixed(3),
|
|
139
|
-
latencyMs: report.orchestrated.latencyMs - report.baseline.latencyMs,
|
|
140
|
-
stability: +(report.orchestrated.stability - report.baseline.stability).toFixed(3),
|
|
141
|
-
humanIntervention: +(report.orchestrated.humanIntervention - report.baseline.humanIntervention).toFixed(3)
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const full = { ...report, delta };
|
|
145
|
-
const outputFile = path.resolve(options.cwd, options.output ?? "benchmarks/reports/latest.json");
|
|
146
|
-
await mkdir(path.dirname(outputFile), { recursive: true });
|
|
147
|
-
await writeFile(outputFile, `${JSON.stringify(full, null, 2)}\n`, "utf8");
|
|
148
|
-
|
|
149
|
-
console.log(c.blue("RAXFLOW Benchmark"));
|
|
150
|
-
console.log(`report: ${outputFile}`);
|
|
151
|
-
console.log(`delta correctness: ${delta.correctness}`);
|
|
152
|
-
console.log(`delta latency(ms): ${delta.latencyMs}`);
|
|
153
|
-
console.log(`delta stability: ${delta.stability}`);
|
|
154
|
-
console.log(`delta humanIntervention: ${delta.humanIntervention}`);
|
|
155
|
-
return 0;
|
|
156
|
-
}
|
package/src/bin.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { runInstall } from "./install.js";
|
|
3
|
-
import { runBenchmark } from "./benchmark.js";
|
|
4
|
-
import { runBootstrap } from "./bootstrap.js";
|
|
5
|
-
import { runBridgeTest } from "./bridge-test.js";
|
|
6
|
-
import { runDoctor } from "./doctor.js";
|
|
7
|
-
import { runInitHost } from "./init-host.js";
|
|
8
|
-
import { runWorkflow } from "./run.js";
|
|
9
|
-
import { runDashboard } from "./dashboard.js";
|
|
10
|
-
import { startHubOneShot } from "./hub/index.js";
|
|
11
|
-
import { runSetup } from "./setup/index.js";
|
|
12
|
-
|
|
13
|
-
function getFlag(args: string[], flag: string): string | undefined {
|
|
14
|
-
const index = args.indexOf(flag);
|
|
15
|
-
if (index === -1) return undefined;
|
|
16
|
-
return args[index + 1];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function main() {
|
|
20
|
-
const args = process.argv.slice(2);
|
|
21
|
-
const command = args[0];
|
|
22
|
-
|
|
23
|
-
// Mode hub interactif (défaut) - sans arguments ou avec 'hub'
|
|
24
|
-
if (!command || command === "hub") {
|
|
25
|
-
const { startTUI } = await import("./tui/index.js");
|
|
26
|
-
startTUI();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Mode one-shot
|
|
31
|
-
if (command === "--run") {
|
|
32
|
-
const prompt = getFlag(args, "--run");
|
|
33
|
-
if (!prompt) {
|
|
34
|
-
console.error("Missing --run <prompt>");
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
await startHubOneShot("run", [prompt, ...args.slice(1)]);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Help pour le hub
|
|
42
|
-
if (command === "--help" || command === "-h") {
|
|
43
|
-
console.log("Usage: raxflow [command]");
|
|
44
|
-
console.log("");
|
|
45
|
-
console.log("Modes:");
|
|
46
|
-
console.log(" (no args) Launch interactive hub (default)");
|
|
47
|
-
console.log(" hub Launch interactive hub");
|
|
48
|
-
console.log(" --run <prompt> One-shot mode (execute and exit)");
|
|
49
|
-
console.log("");
|
|
50
|
-
console.log("Setup:");
|
|
51
|
-
console.log(" setup Interactive setup wizard (TUI)");
|
|
52
|
-
console.log(" install [--ui] Legacy setup (alias for setup)");
|
|
53
|
-
console.log("");
|
|
54
|
-
console.log("Commands:");
|
|
55
|
-
console.log(" run --prompt <text> [--workflow path] [--json] [--stream] [--max-parallel N] [--no-cache-persist]");
|
|
56
|
-
console.log(" Execute workflow");
|
|
57
|
-
console.log(" Optional: [--provider host|openai|claude|rest] [--bridge-command \"node bridge.mjs\"]");
|
|
58
|
-
console.log(" benchmark --prompt <text> [--output path] Compare baseline vs orchestrated");
|
|
59
|
-
console.log(" Optional: [--provider host|openai|claude|rest] [--bridge-command \"node bridge.mjs\"]");
|
|
60
|
-
console.log(" doctor Validate host-native bridge setup");
|
|
61
|
-
console.log(" bridge-test [--target claude-code|codex|opencode|kilo|generic] Run bridge smoke payload");
|
|
62
|
-
console.log(" bootstrap [--target claude-code|codex|opencode|kilo|generic] [--task \"...\"] [--json]");
|
|
63
|
-
console.log(" Print chat bootstrap prompt");
|
|
64
|
-
console.log(" dashboard [--port N] Start the visual insights dashboard");
|
|
65
|
-
process.exit(0);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (command === "install" || command === "setup") {
|
|
69
|
-
const code = await runSetup();
|
|
70
|
-
process.exit(code);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (command === "run") {
|
|
74
|
-
const prompt = getFlag(args, "--prompt");
|
|
75
|
-
if (!prompt) {
|
|
76
|
-
console.error("Missing --prompt");
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
const workflowPath = getFlag(args, "--workflow");
|
|
80
|
-
const provider = getFlag(args, "--provider");
|
|
81
|
-
const bridgeCommand = getFlag(args, "--bridge-command");
|
|
82
|
-
const maxParallelRaw = getFlag(args, "--max-parallel");
|
|
83
|
-
const maxParallel = maxParallelRaw ? Number(maxParallelRaw) : undefined;
|
|
84
|
-
const code = await runWorkflow({
|
|
85
|
-
cwd: process.cwd(),
|
|
86
|
-
prompt,
|
|
87
|
-
workflowPath,
|
|
88
|
-
asJson: args.includes("--json"),
|
|
89
|
-
stream: args.includes("--stream"),
|
|
90
|
-
maxParallel: Number.isFinite(maxParallel) ? maxParallel : undefined,
|
|
91
|
-
noCachePersist: args.includes("--no-cache-persist"),
|
|
92
|
-
providerOverride: provider,
|
|
93
|
-
bridgeCommandOverride: bridgeCommand,
|
|
94
|
-
ui: args.includes("--ui")
|
|
95
|
-
});
|
|
96
|
-
process.exit(code);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (command === "benchmark") {
|
|
100
|
-
const prompt = getFlag(args, "--prompt");
|
|
101
|
-
if (!prompt) {
|
|
102
|
-
console.error("Missing --prompt");
|
|
103
|
-
process.exit(1);
|
|
104
|
-
}
|
|
105
|
-
const output = getFlag(args, "--output");
|
|
106
|
-
const provider = getFlag(args, "--provider");
|
|
107
|
-
const bridgeCommand = getFlag(args, "--bridge-command");
|
|
108
|
-
const code = await runBenchmark({ cwd: process.cwd(), prompt, output, providerOverride: provider, bridgeCommandOverride: bridgeCommand });
|
|
109
|
-
process.exit(code);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (command === "doctor") {
|
|
113
|
-
const code = await runDoctor({ cwd: process.cwd() });
|
|
114
|
-
process.exit(code);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (command === "bridge-test") {
|
|
118
|
-
const target = getFlag(args, "--target");
|
|
119
|
-
const code = await runBridgeTest({ cwd: process.cwd(), target });
|
|
120
|
-
process.exit(code);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (command === "init-host") {
|
|
124
|
-
const target = getFlag(args, "--target");
|
|
125
|
-
const task = getFlag(args, "--task");
|
|
126
|
-
const code = await runInitHost({ cwd: process.cwd(), target, printOnly: args.includes("--print"), all: args.includes("--all"), task });
|
|
127
|
-
process.exit(code);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (command === "bootstrap") {
|
|
131
|
-
const target = getFlag(args, "--target");
|
|
132
|
-
const task = getFlag(args, "--task");
|
|
133
|
-
const code = await runBootstrap({ target, task, asJson: args.includes("--json") });
|
|
134
|
-
process.exit(code);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (command === "dashboard") {
|
|
138
|
-
const port = getFlag(args, "--port");
|
|
139
|
-
const code = await runDashboard({ port: port ? Number(port) : 3003 });
|
|
140
|
-
process.exit(code);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (command === "evolve") {
|
|
144
|
-
const { showEvolution } = await import("./evolve.js");
|
|
145
|
-
const code = await showEvolution({ cwd: process.cwd(), history: args.includes("--history") });
|
|
146
|
-
process.exit(code);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
console.error(`Unknown command: ${command}`);
|
|
150
|
-
process.exit(1);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
main().catch((error) => {
|
|
154
|
-
console.error(error);
|
|
155
|
-
process.exit(1);
|
|
156
|
-
});
|
package/src/bootstrap.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { c } from "./styles.js";
|
|
2
|
-
import { HOST_TEMPLATES, buildBootstrapPrompt, parseHostTarget } from "./host-init-templates.js";
|
|
3
|
-
|
|
4
|
-
interface BootstrapOptions {
|
|
5
|
-
target?: string;
|
|
6
|
-
asJson?: boolean;
|
|
7
|
-
task?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export async function runBootstrap(options: BootstrapOptions): Promise<number> {
|
|
11
|
-
const target = parseHostTarget(options.target);
|
|
12
|
-
const template = HOST_TEMPLATES[target];
|
|
13
|
-
const prompt = buildBootstrapPrompt(target, options.task);
|
|
14
|
-
|
|
15
|
-
if (options.asJson) {
|
|
16
|
-
console.log(
|
|
17
|
-
JSON.stringify(
|
|
18
|
-
{
|
|
19
|
-
target,
|
|
20
|
-
title: template.title,
|
|
21
|
-
autoInjectMode: template.autoInjectMode,
|
|
22
|
-
prompt,
|
|
23
|
-
quickCommands: template.quickCommands,
|
|
24
|
-
sessionEntryExamples: template.sessionEntryExamples
|
|
25
|
-
},
|
|
26
|
-
null,
|
|
27
|
-
2
|
|
28
|
-
)
|
|
29
|
-
);
|
|
30
|
-
return 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
console.log(c.blue(`RAX-FLOW Bootstrap Prompt (${target})`));
|
|
34
|
-
console.log(prompt);
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { HostTarget } from "./host-init-templates.js";
|
|
2
|
-
|
|
3
|
-
function vendorCallFunction(target: HostTarget): string {
|
|
4
|
-
if (target === "claude-code") return "callClaudeCodeRuntime";
|
|
5
|
-
if (target === "codex") return "callCodexRuntime";
|
|
6
|
-
if (target === "opencode") return "callOpenCodeRuntime";
|
|
7
|
-
if (target === "kilo") return "callKiloRuntime";
|
|
8
|
-
return "callGenericHostRuntime";
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function vendorNotes(target: HostTarget): string {
|
|
12
|
-
if (target === "claude-code") {
|
|
13
|
-
return [
|
|
14
|
-
"// Claude Code integration notes:",
|
|
15
|
-
"// - Map `payload.action` to Claude Code message/runtime API.",
|
|
16
|
-
"// - Ensure structured mode returns strict JSON object, not markdown.",
|
|
17
|
-
""
|
|
18
|
-
].join("\n");
|
|
19
|
-
}
|
|
20
|
-
if (target === "codex") {
|
|
21
|
-
return [
|
|
22
|
-
"// Codex integration notes:",
|
|
23
|
-
"// - Map payload.options.model to your Codex runtime model selector.",
|
|
24
|
-
"// - For callStructured, return parsed JSON object only.",
|
|
25
|
-
""
|
|
26
|
-
].join("\n");
|
|
27
|
-
}
|
|
28
|
-
if (target === "opencode") {
|
|
29
|
-
return [
|
|
30
|
-
"// OpenCode integration notes:",
|
|
31
|
-
"// - Connect to OpenCode model invocation API/SDK.",
|
|
32
|
-
"// - Preserve latency and model name in response when possible.",
|
|
33
|
-
""
|
|
34
|
-
].join("\n");
|
|
35
|
-
}
|
|
36
|
-
if (target === "kilo") {
|
|
37
|
-
return [
|
|
38
|
-
"// Kilo integration notes:",
|
|
39
|
-
"// - Route both actions through Kilo's model runtime.",
|
|
40
|
-
"// - Handle model fallback inside runtime wrapper if supported.",
|
|
41
|
-
""
|
|
42
|
-
].join("\n");
|
|
43
|
-
}
|
|
44
|
-
return [
|
|
45
|
-
"// Generic host integration notes:",
|
|
46
|
-
"// - Replace runtime call with your environment-specific function.",
|
|
47
|
-
"// - Keep response aligned with HostBridgeResponse schema.",
|
|
48
|
-
""
|
|
49
|
-
].join("\n");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function renderBridgeAdapter(target: HostTarget): string {
|
|
53
|
-
const runtimeFn = vendorCallFunction(target);
|
|
54
|
-
return [
|
|
55
|
-
"#!/usr/bin/env node",
|
|
56
|
-
"",
|
|
57
|
-
"/**",
|
|
58
|
-
` * RAX-FLOW bridge adapter scaffold for ${target}.`,
|
|
59
|
-
" *",
|
|
60
|
-
" * Input : HostBridgeRequest JSON on stdin",
|
|
61
|
-
" * Output: HostBridgeResponse JSON on stdout",
|
|
62
|
-
" */",
|
|
63
|
-
"",
|
|
64
|
-
"import { readFileSync } from \"node:fs\";",
|
|
65
|
-
"import path from \"node:path\";",
|
|
66
|
-
"",
|
|
67
|
-
"function readStdin() {",
|
|
68
|
-
" return new Promise((resolve) => {",
|
|
69
|
-
" let data = \"\";",
|
|
70
|
-
" process.stdin.setEncoding(\"utf8\");",
|
|
71
|
-
" process.stdin.on(\"data\", (chunk) => { data += chunk; });",
|
|
72
|
-
" process.stdin.on(\"end\", () => resolve(data));",
|
|
73
|
-
" });",
|
|
74
|
-
"}",
|
|
75
|
-
"",
|
|
76
|
-
"function safeJsonParse(text) {",
|
|
77
|
-
" try { return JSON.parse(text); } catch { return null; }",
|
|
78
|
-
"}",
|
|
79
|
-
"",
|
|
80
|
-
"function normalizeError(error) {",
|
|
81
|
-
" if (!error) return \"unknown_error\";",
|
|
82
|
-
" if (typeof error === \"string\") return error;",
|
|
83
|
-
" return error.message || String(error);",
|
|
84
|
-
"}",
|
|
85
|
-
"",
|
|
86
|
-
"function isStructuredPayload(obj) {",
|
|
87
|
-
" return obj && typeof obj === \"object\" &&",
|
|
88
|
-
" typeof obj.agent === \"string\" &&",
|
|
89
|
-
" typeof obj.success === \"boolean\" &&",
|
|
90
|
-
" typeof obj.confidence === \"number\" &&",
|
|
91
|
-
" Array.isArray(obj.risks) &&",
|
|
92
|
-
" Array.isArray(obj.logs) &&",
|
|
93
|
-
" obj.data && typeof obj.data === \"object\";",
|
|
94
|
-
"}",
|
|
95
|
-
"",
|
|
96
|
-
"function loadRuntimeConfig() {",
|
|
97
|
-
" const file = path.join(process.cwd(), '.rax-flow', 'host-init', '" + target + "', 'bridge-runtime-config.json');",
|
|
98
|
-
" try {",
|
|
99
|
-
" return JSON.parse(readFileSync(file, 'utf8'));",
|
|
100
|
-
" } catch {",
|
|
101
|
-
" return {",
|
|
102
|
-
" vendor: '" + target + "',",
|
|
103
|
-
" model: 'host-managed',",
|
|
104
|
-
" endpoint: null,",
|
|
105
|
-
" authEnv: null,",
|
|
106
|
-
" structuredMode: 'json',",
|
|
107
|
-
" responseStrict: true,",
|
|
108
|
-
" timeoutMs: 20000",
|
|
109
|
-
" };",
|
|
110
|
-
" }",
|
|
111
|
-
"}",
|
|
112
|
-
"",
|
|
113
|
-
vendorNotes(target),
|
|
114
|
-
"// callHostModel is the bridge interface for runtime calls",
|
|
115
|
-
`async function ${runtimeFn}(payload, runtimeConfig) {`,
|
|
116
|
-
" // TODO: implement real runtime call for this vendor.",
|
|
117
|
-
" // payload.action = callModel | callStructured",
|
|
118
|
-
" // runtimeConfig can provide endpoint/auth/model/runtime settings.",
|
|
119
|
-
" if (payload.action === 'callStructured') {",
|
|
120
|
-
" return {",
|
|
121
|
-
" ok: true,",
|
|
122
|
-
" model: runtimeConfig.model || payload.options?.model || 'host-managed',",
|
|
123
|
-
" latencyMs: 8,",
|
|
124
|
-
" output: {",
|
|
125
|
-
" agent: 'VendorBridgeTemplate',",
|
|
126
|
-
" success: true,",
|
|
127
|
-
" confidence: 0.73,",
|
|
128
|
-
" risks: [],",
|
|
129
|
-
" logs: ['replace with real vendor runtime response'],",
|
|
130
|
-
" data: { summary: 'template structured output', nextAction: 'continue' }",
|
|
131
|
-
" }",
|
|
132
|
-
" };",
|
|
133
|
-
" }",
|
|
134
|
-
" return {",
|
|
135
|
-
" ok: true,",
|
|
136
|
-
" model: runtimeConfig.model || payload.options?.model || 'host-managed',",
|
|
137
|
-
" latencyMs: 8,",
|
|
138
|
-
" output: `template-text:${String(payload.prompt || '').slice(0, 220)}`",
|
|
139
|
-
" };",
|
|
140
|
-
"}",
|
|
141
|
-
"",
|
|
142
|
-
"async function main() {",
|
|
143
|
-
" const input = await readStdin();",
|
|
144
|
-
" const payload = safeJsonParse(input);",
|
|
145
|
-
" if (!payload || payload.version !== 1 || !payload.action) {",
|
|
146
|
-
" process.stdout.write(JSON.stringify({ ok: false, error: 'invalid_payload' }));",
|
|
147
|
-
" return;",
|
|
148
|
-
" }",
|
|
149
|
-
"",
|
|
150
|
-
" const runtimeConfig = loadRuntimeConfig();",
|
|
151
|
-
"",
|
|
152
|
-
" try {",
|
|
153
|
-
` const response = await ${runtimeFn}(payload, runtimeConfig);`,
|
|
154
|
-
" if (payload.action === 'callStructured' && runtimeConfig.responseStrict) {",
|
|
155
|
-
" if (!response || !isStructuredPayload(response.output)) {",
|
|
156
|
-
" process.stdout.write(JSON.stringify({",
|
|
157
|
-
" ok: false,",
|
|
158
|
-
" error: 'structured_output_invalid',",
|
|
159
|
-
" details: 'Ensure output contains agent/success/confidence/risks/logs/data',",
|
|
160
|
-
" }));",
|
|
161
|
-
" return;",
|
|
162
|
-
" }",
|
|
163
|
-
" }",
|
|
164
|
-
" process.stdout.write(JSON.stringify(response));",
|
|
165
|
-
" } catch (error) {",
|
|
166
|
-
" process.stdout.write(JSON.stringify({ ok: false, error: `bridge_exception:${normalizeError(error)}` }));",
|
|
167
|
-
" }",
|
|
168
|
-
"}",
|
|
169
|
-
"",
|
|
170
|
-
"main();",
|
|
171
|
-
""
|
|
172
|
-
].join("\n");
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export function bridgeAdapterFilename(target: HostTarget): string {
|
|
176
|
-
if (target === "claude-code") return "bridge-adapter-claude-code.mjs";
|
|
177
|
-
if (target === "codex") return "bridge-adapter-codex.mjs";
|
|
178
|
-
if (target === "opencode") return "bridge-adapter-opencode.mjs";
|
|
179
|
-
if (target === "kilo") return "bridge-adapter-kilo.mjs";
|
|
180
|
-
return "bridge-adapter-generic.mjs";
|
|
181
|
-
}
|
package/src/bridge-test.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { spawn } from "node:child_process";
|
|
4
|
-
import { c } from "./styles.js";
|
|
5
|
-
import { parseHostTarget } from "./host-init-templates.js";
|
|
6
|
-
|
|
7
|
-
interface BridgeTestOptions {
|
|
8
|
-
cwd: string;
|
|
9
|
-
target?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function parseShellCommand(input: string): { command: string; args: string[] } {
|
|
13
|
-
const parts = input.match(/(?:[^\s"]+|"[^"]*")+/g) ?? [];
|
|
14
|
-
if (parts.length === 0) {
|
|
15
|
-
throw new Error("invalid_bridge_command");
|
|
16
|
-
}
|
|
17
|
-
const [command, ...rawArgs] = parts;
|
|
18
|
-
const args = rawArgs.map((arg) => arg.replace(/^"|"$/g, ""));
|
|
19
|
-
return { command: command!, args };
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function runCommand(commandSpec: string, payload: unknown): Promise<{ code: number; stdout: string; stderr: string }> {
|
|
23
|
-
const { command, args } = parseShellCommand(commandSpec);
|
|
24
|
-
return await new Promise((resolve, reject) => {
|
|
25
|
-
const child = spawn(command, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
26
|
-
let stdout = "";
|
|
27
|
-
let stderr = "";
|
|
28
|
-
|
|
29
|
-
child.stdout.on("data", (chunk) => {
|
|
30
|
-
stdout += String(chunk);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
child.stderr.on("data", (chunk) => {
|
|
34
|
-
stderr += String(chunk);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
child.on("error", (error) => reject(error));
|
|
38
|
-
child.on("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
|
|
39
|
-
|
|
40
|
-
child.stdin.write(JSON.stringify(payload));
|
|
41
|
-
child.stdin.end();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export async function runBridgeTest(options: BridgeTestOptions): Promise<number> {
|
|
46
|
-
const target = parseHostTarget(options.target);
|
|
47
|
-
const baseDir = path.join(options.cwd, ".rax-flow", "host-init", target);
|
|
48
|
-
const manifestFile = path.join(baseDir, "host-manifest.json");
|
|
49
|
-
const smokeFile = path.join(baseDir, "bridge-smoke-test.json");
|
|
50
|
-
|
|
51
|
-
let manifest: { bridgeCommand?: string };
|
|
52
|
-
let smokePayload: unknown;
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
manifest = JSON.parse(await readFile(manifestFile, "utf8")) as { bridgeCommand?: string };
|
|
56
|
-
} catch {
|
|
57
|
-
console.error(c.red(`Missing host manifest: ${manifestFile}`));
|
|
58
|
-
return 1;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
smokePayload = JSON.parse(await readFile(smokeFile, "utf8"));
|
|
63
|
-
} catch {
|
|
64
|
-
console.error(c.red(`Missing bridge smoke test payload: ${smokeFile}`));
|
|
65
|
-
return 1;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!manifest.bridgeCommand) {
|
|
69
|
-
console.error(c.red("host-manifest.json missing bridgeCommand"));
|
|
70
|
-
return 1;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const result = await runCommand(manifest.bridgeCommand, smokePayload);
|
|
74
|
-
console.log(c.blue(`RAX-FLOW Bridge Test (${target})`));
|
|
75
|
-
console.log(`command: ${manifest.bridgeCommand}`);
|
|
76
|
-
console.log(`exitCode: ${result.code}`);
|
|
77
|
-
|
|
78
|
-
if (result.stdout.trim()) {
|
|
79
|
-
console.log("stdout:");
|
|
80
|
-
console.log(result.stdout.trim());
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (result.stderr.trim()) {
|
|
84
|
-
console.log("stderr:");
|
|
85
|
-
console.log(result.stderr.trim());
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (result.code !== 0) {
|
|
89
|
-
console.log(c.red("Bridge smoke test failed."));
|
|
90
|
-
return 1;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
const parsed = JSON.parse(result.stdout);
|
|
95
|
-
const ok = Boolean(parsed?.ok);
|
|
96
|
-
if (!ok) {
|
|
97
|
-
console.log(c.red(`Bridge responded with ok=false: ${parsed?.error ?? "unknown"}`));
|
|
98
|
-
return 1;
|
|
99
|
-
}
|
|
100
|
-
} catch {
|
|
101
|
-
console.log(c.red("Bridge output is not valid JSON."));
|
|
102
|
-
return 1;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
console.log(c.green("Bridge smoke test passed."));
|
|
106
|
-
return 0;
|
|
107
|
-
}
|
package/src/dashboard.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import http from "node:http";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
|
|
8
|
-
export async function runDashboard({ port = 3003 }: { port?: number } = {}): Promise<number> {
|
|
9
|
-
const server = http.createServer(async (req, res) => {
|
|
10
|
-
// Simple static server for the dashboard
|
|
11
|
-
if (req.url === "/" || req.url === "/index.html") {
|
|
12
|
-
try {
|
|
13
|
-
// Try to find the dashboard file
|
|
14
|
-
// In the monorepo, it's in packages/cli/dashboard/index.html
|
|
15
|
-
// When installed as a package, it will be relative to this file
|
|
16
|
-
let htmlPath = path.join(process.cwd(), "packages/cli/dashboard/index.html");
|
|
17
|
-
|
|
18
|
-
// Fallback for when running from dist or installed package
|
|
19
|
-
try {
|
|
20
|
-
await readFile(htmlPath);
|
|
21
|
-
} catch {
|
|
22
|
-
htmlPath = path.join(__dirname, "..", "dashboard", "index.html");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const content = await readFile(htmlPath, "utf8");
|
|
26
|
-
res.writeHead(200, { "Content-Type": "text/html" });
|
|
27
|
-
res.end(content);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
console.error("[UI] Error loading dashboard:", err);
|
|
30
|
-
res.writeHead(500);
|
|
31
|
-
res.end("Error loading dashboard. Please ensure you are running from the project root.");
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
res.writeHead(404);
|
|
35
|
-
res.end("Not Found");
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return new Promise((resolve) => {
|
|
40
|
-
server.listen(port, () => {
|
|
41
|
-
console.log(`\n[UI] 🚀 RAX Dashboard started on http://localhost:${port}`);
|
|
42
|
-
console.log(`[UI] Monitoring kernel evolution and workflow health.`);
|
|
43
|
-
console.log(`[UI] Press Ctrl+C to stop.`);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
process.on("SIGINT", () => {
|
|
47
|
-
server.close();
|
|
48
|
-
resolve(0);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|