rax-flow 0.1.5 → 0.1.7
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/LICENSE +21 -0
- package/dist/bin.js +27 -3
- package/dist/bin.js.map +1 -1
- 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 +120 -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.map +1 -0
- package/dist/hub/event-listener.js +8 -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 +102 -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/tui/App.d.ts +2 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +31 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/components/ChatPanel.d.ts +14 -0
- package/dist/tui/components/ChatPanel.d.ts.map +1 -0
- package/dist/tui/components/ChatPanel.js +30 -0
- package/dist/tui/components/ChatPanel.js.map +1 -0
- package/dist/tui/components/Header.d.ts +9 -0
- package/dist/tui/components/Header.d.ts.map +1 -0
- package/dist/tui/components/Header.js +17 -0
- package/dist/tui/components/Header.js.map +1 -0
- package/dist/tui/components/InputBar.d.ts +8 -0
- package/dist/tui/components/InputBar.d.ts.map +1 -0
- package/dist/tui/components/InputBar.js +16 -0
- package/dist/tui/components/InputBar.js.map +1 -0
- package/dist/tui/components/StatusPanel.d.ts +20 -0
- package/dist/tui/components/StatusPanel.d.ts.map +1 -0
- package/dist/tui/components/StatusPanel.js +20 -0
- package/dist/tui/components/StatusPanel.js.map +1 -0
- package/dist/tui/hooks/useAppState.d.ts +38 -0
- package/dist/tui/hooks/useAppState.d.ts.map +1 -0
- package/dist/tui/hooks/useAppState.js +127 -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/package.json +17 -11
- package/src/bin.ts +29 -3
- 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 +137 -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 +13 -0
- package/src/hub/history.ts +66 -0
- package/src/hub/index.ts +120 -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/tui/App.tsx +61 -0
- package/src/tui/components/ChatPanel.tsx +79 -0
- package/src/tui/components/Header.tsx +53 -0
- package/src/tui/components/InputBar.tsx +55 -0
- package/src/tui/components/StatusPanel.tsx +85 -0
- package/src/tui/hooks/useAppState.ts +168 -0
- package/src/tui/index.ts +9 -0
- package/tsconfig.json +19 -3
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/benchmark.d.ts +0 -10
- package/dist/bin.d.ts +0 -3
- package/dist/bootstrap.d.ts +0 -8
- package/dist/bridge-adapter-templates.d.ts +0 -4
- package/dist/bridge-test.d.ts +0 -7
- package/dist/dashboard.d.ts +0 -4
- package/dist/doctor.d.ts +0 -6
- package/dist/evolve.d.ts +0 -7
- package/dist/host-init-templates.d.ts +0 -16
- package/dist/index.d.ts +0 -11
- package/dist/init-host.d.ts +0 -10
- package/dist/install.d.ts +0 -8
- package/dist/run.d.ts +0 -16
- package/dist/styles.d.ts +0 -12
- package/dist/vendor-manifests.d.ts +0 -22
- package/package/dashboard/index.html +0 -420
- package/package/package.json +0 -28
- package/package/src/benchmark.ts +0 -156
- package/package/src/bin.ts +0 -127
- package/package/src/bootstrap.ts +0 -36
- package/package/src/bridge-adapter-templates.ts +0 -181
- package/package/src/bridge-test.ts +0 -107
- package/package/src/dashboard.ts +0 -51
- package/package/src/doctor.ts +0 -92
- package/package/src/evolve.ts +0 -74
- package/package/src/host-init-templates.ts +0 -134
- package/package/src/index.ts +0 -10
- package/package/src/init-host.ts +0 -285
- package/package/src/install.ts +0 -118
- package/package/src/run.ts +0 -317
- package/package/src/styles.ts +0 -12
- package/package/src/vendor-manifests.ts +0 -113
- package/package/src/ws-relay.ts +0 -156
- package/package/tsconfig.json +0 -12
- package/rax-flow-0.1.1.tgz +0 -0
package/package/src/ws-relay.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { WebSocketServer, WebSocket } from "ws";
|
|
2
|
-
import { RuntimeEventBus } from "rax-flow-core";
|
|
3
|
-
import { readdir, readFile, mkdir, writeFile } from "node:fs/promises";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
|
|
6
|
-
export class WebSocketRelay {
|
|
7
|
-
private wss: WebSocketServer | null = null;
|
|
8
|
-
private clients = new Set<WebSocket>();
|
|
9
|
-
private bus: RuntimeEventBus | null = null;
|
|
10
|
-
|
|
11
|
-
constructor(private port: number = 3002) { }
|
|
12
|
-
|
|
13
|
-
public start(eventBus: RuntimeEventBus): void {
|
|
14
|
-
this.bus = eventBus;
|
|
15
|
-
try {
|
|
16
|
-
this.wss = new WebSocketServer({ port: this.port });
|
|
17
|
-
console.log(`\n[UI] 📡 WebSocket relay started on ws://localhost:${this.port}`);
|
|
18
|
-
|
|
19
|
-
this.wss.on("connection", (ws) => {
|
|
20
|
-
this.clients.add(ws);
|
|
21
|
-
ws.send(JSON.stringify({ type: "HELLO", timestamp: Date.now() }));
|
|
22
|
-
|
|
23
|
-
ws.on("close", () => {
|
|
24
|
-
this.clients.delete(ws);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
ws.on("message", async (data) => {
|
|
28
|
-
try {
|
|
29
|
-
const message = JSON.parse(data.toString());
|
|
30
|
-
const historyDir = path.join(process.cwd(), ".rax-flow", "history");
|
|
31
|
-
|
|
32
|
-
if (message.type === "GET_HISTORY") {
|
|
33
|
-
try {
|
|
34
|
-
const files = await readdir(historyDir);
|
|
35
|
-
const runs = await Promise.all(
|
|
36
|
-
files.filter(f => f.endsWith(".json")).map(async f => {
|
|
37
|
-
const content = await readFile(path.join(historyDir, f), "utf8");
|
|
38
|
-
const parsed = JSON.parse(content);
|
|
39
|
-
return {
|
|
40
|
-
taskId: parsed.taskId,
|
|
41
|
-
timestamp: parsed.timestamp,
|
|
42
|
-
prompt: parsed.prompt,
|
|
43
|
-
success: parsed.result.success,
|
|
44
|
-
costUsd: parsed.metrics.totalCostUsd
|
|
45
|
-
};
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
ws.send(JSON.stringify({ type: "HISTORY_LIST", runs: runs.sort((a, b) => b.timestamp - a.timestamp) }));
|
|
49
|
-
} catch {
|
|
50
|
-
ws.send(JSON.stringify({ type: "HISTORY_LIST", runs: [] }));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
else if (message.type === "LOAD_RUN") {
|
|
55
|
-
try {
|
|
56
|
-
const file = path.join(historyDir, `${message.taskId}.json`);
|
|
57
|
-
const content = await readFile(file, "utf8");
|
|
58
|
-
ws.send(JSON.stringify({ type: "RUN_DATA", data: JSON.parse(content) }));
|
|
59
|
-
} catch (err) {
|
|
60
|
-
ws.send(JSON.stringify({ type: "ERROR", message: "Run not found" }));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
else if (message.type === "LIST_WORKFLOWS") {
|
|
65
|
-
const workflowsDir = path.join(process.cwd(), ".rax-flow", "workflows");
|
|
66
|
-
try {
|
|
67
|
-
const files = await readdir(workflowsDir);
|
|
68
|
-
const list = files.filter(f => f.endsWith(".json")).map(f => ({
|
|
69
|
-
id: f.replace(".json", ""),
|
|
70
|
-
filename: f
|
|
71
|
-
}));
|
|
72
|
-
ws.send(JSON.stringify({ type: "WORKFLOW_LIST", workflows: list }));
|
|
73
|
-
} catch {
|
|
74
|
-
ws.send(JSON.stringify({ type: "WORKFLOW_LIST", workflows: [] }));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
else if (message.type === "RESOLVE_APPROVAL") {
|
|
79
|
-
this.bus?.emit({
|
|
80
|
-
type: "INTERNAL_RESOLVE_APPROVAL",
|
|
81
|
-
taskId: message.taskId,
|
|
82
|
-
nodeId: message.nodeId,
|
|
83
|
-
approved: message.approved,
|
|
84
|
-
feedback: message.feedback
|
|
85
|
-
} as any);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
else if (message.type === "SAVE_WORKFLOW") {
|
|
89
|
-
try {
|
|
90
|
-
const workflowsDir = path.join(process.cwd(), ".rax-flow", "workflows");
|
|
91
|
-
await mkdir(workflowsDir, { recursive: true });
|
|
92
|
-
const file = path.join(workflowsDir, `${message.id}.json`);
|
|
93
|
-
const data = {
|
|
94
|
-
id: message.id,
|
|
95
|
-
nodes: message.nodes,
|
|
96
|
-
edges: message.edges
|
|
97
|
-
};
|
|
98
|
-
await writeFile(file, JSON.stringify(data, null, 2));
|
|
99
|
-
ws.send(JSON.stringify({ type: "INFO", message: `Workflow ${message.id} saved.` }));
|
|
100
|
-
this.broadcast({ type: "REFRESH_WORKFLOWS" });
|
|
101
|
-
} catch (err) {
|
|
102
|
-
ws.send(JSON.stringify({ type: "ERROR", message: "Failed to save workflow" }));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
else if (message.type === "DELETE_WORKFLOW") {
|
|
107
|
-
try {
|
|
108
|
-
const url = path.join(process.cwd(), ".rax-flow", "workflows", `${message.id}.json`);
|
|
109
|
-
const { unlink } = await import("node:fs/promises");
|
|
110
|
-
await unlink(url);
|
|
111
|
-
this.broadcast({ type: "REFRESH_WORKFLOWS" });
|
|
112
|
-
} catch (err) {
|
|
113
|
-
ws.send(JSON.stringify({ type: "ERROR", message: "Failed to delete workflow" }));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
} catch (e) {
|
|
117
|
-
console.error("[WS] Message parse error:", e);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
ws.on("error", () => {
|
|
122
|
-
this.clients.delete(ws);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
this.wss.on("error", (err) => {
|
|
127
|
-
console.error(`[UI] WebSocket server error: ${err.message}`);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
eventBus.onEvent((event) => {
|
|
131
|
-
this.broadcast(event);
|
|
132
|
-
});
|
|
133
|
-
} catch (err) {
|
|
134
|
-
console.error(`[UI] Failed to start WebSocket server: ${err}`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private broadcast(event: unknown): void {
|
|
139
|
-
if (!this.wss) return;
|
|
140
|
-
const payload = JSON.stringify(event);
|
|
141
|
-
for (const client of this.clients) {
|
|
142
|
-
if (client.readyState === WebSocket.OPEN) {
|
|
143
|
-
client.send(payload);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
public stop(): void {
|
|
149
|
-
if (this.wss) {
|
|
150
|
-
this.wss.close();
|
|
151
|
-
this.wss = null;
|
|
152
|
-
this.clients.clear();
|
|
153
|
-
console.log("[UI] 📡 WebSocket relay stopped.");
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
package/package/tsconfig.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "src",
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"composite": true,
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true
|
|
9
|
-
},
|
|
10
|
-
"include": ["src/**/*.ts"],
|
|
11
|
-
"references": [{ "path": "../core" }, { "path": "../agents" }, { "path": "../providers" }]
|
|
12
|
-
}
|
package/rax-flow-0.1.1.tgz
DELETED
|
Binary file
|