rufloui 0.3.1

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.
Files changed (56) hide show
  1. package/'1' +0 -0
  2. package/.env.example +46 -0
  3. package/CHANGELOG.md +87 -0
  4. package/CLAUDE.md +287 -0
  5. package/LICENSE +21 -0
  6. package/README.md +316 -0
  7. package/Webhooks) +0 -0
  8. package/docs/plans/2026-03-11-github-webhooks.md +957 -0
  9. package/docs/screenshot-swarm-monitor.png +0 -0
  10. package/frontend +0 -0
  11. package/index.html +13 -0
  12. package/package.json +56 -0
  13. package/public/vite.svg +4 -0
  14. package/src/backend/__tests__/webhook-github.test.ts +934 -0
  15. package/src/backend/jsonl-monitor.ts +430 -0
  16. package/src/backend/server.ts +2972 -0
  17. package/src/backend/telegram-bot.ts +511 -0
  18. package/src/backend/webhook-github.ts +350 -0
  19. package/src/frontend/App.tsx +461 -0
  20. package/src/frontend/api.ts +281 -0
  21. package/src/frontend/components/ErrorBoundary.tsx +98 -0
  22. package/src/frontend/components/Layout.tsx +431 -0
  23. package/src/frontend/components/ui/Button.tsx +111 -0
  24. package/src/frontend/components/ui/Card.tsx +51 -0
  25. package/src/frontend/components/ui/StatusBadge.tsx +60 -0
  26. package/src/frontend/main.tsx +63 -0
  27. package/src/frontend/pages/AgentVizPanel.tsx +428 -0
  28. package/src/frontend/pages/AgentsPanel.tsx +445 -0
  29. package/src/frontend/pages/ConfigPanel.tsx +661 -0
  30. package/src/frontend/pages/Dashboard.tsx +482 -0
  31. package/src/frontend/pages/HiveMindPanel.tsx +355 -0
  32. package/src/frontend/pages/HooksPanel.tsx +240 -0
  33. package/src/frontend/pages/LogsPanel.tsx +261 -0
  34. package/src/frontend/pages/MemoryPanel.tsx +444 -0
  35. package/src/frontend/pages/NeuralPanel.tsx +301 -0
  36. package/src/frontend/pages/PerformancePanel.tsx +198 -0
  37. package/src/frontend/pages/SessionsPanel.tsx +428 -0
  38. package/src/frontend/pages/SetupWizard.tsx +181 -0
  39. package/src/frontend/pages/SwarmMonitorPanel.tsx +634 -0
  40. package/src/frontend/pages/SwarmPanel.tsx +322 -0
  41. package/src/frontend/pages/TasksPanel.tsx +535 -0
  42. package/src/frontend/pages/WebhooksPanel.tsx +335 -0
  43. package/src/frontend/pages/WorkflowsPanel.tsx +448 -0
  44. package/src/frontend/store.ts +185 -0
  45. package/src/frontend/styles/global.css +113 -0
  46. package/src/frontend/test-setup.ts +1 -0
  47. package/src/frontend/tour/TourContext.tsx +161 -0
  48. package/src/frontend/tour/tourSteps.ts +181 -0
  49. package/src/frontend/tour/tourStyles.css +116 -0
  50. package/src/frontend/types.ts +239 -0
  51. package/src/frontend/utils/formatTime.test.ts +83 -0
  52. package/src/frontend/utils/formatTime.ts +23 -0
  53. package/tsconfig.json +23 -0
  54. package/vite.config.ts +26 -0
  55. package/vitest.config.ts +17 -0
  56. package/{,+ +0 -0
package/README.md ADDED
@@ -0,0 +1,316 @@
1
+ # RuFloUI
2
+
3
+ ![RuFloUI Swarm Monitor](docs/screenshot-swarm-monitor.png)
4
+
5
+ A React 19 web dashboard for [claude-flow v3](https://github.com/ruvnet/claude-flow) multi-agent orchestration. RuFloUI wraps the claude-flow CLI behind an Express + WebSocket backend and presents a full visual interface for managing swarms, agents, tasks, and workflows.
6
+
7
+ ## Features
8
+
9
+ - **Swarm Management** — Initialize, configure, and shut down multi-agent swarms with visual topology controls
10
+ - **Agent Monitoring** — Real-time agent status cards with live output streaming, status-colored indicators, and working animations
11
+ - **Agent Visualization** — Tree view of agent hierarchies built from JSONL session logs in real-time
12
+ - **Task Board** — Kanban-style task management with create, assign, execute, and continue workflows
13
+ - **Task Continuation** — Follow-up on completed/failed tasks with automatic context injection from previous results
14
+ - **Output History** — All task output persisted to disk and viewable across page reloads and server restarts
15
+ - **Multi-Agent Pipeline** — Coordinator plans subtasks, workers execute in dependency waves, results synthesized
16
+ - **Hive Mind** — Consensus protocols, broadcast messaging, and shared memory across agents
17
+ - **Workflows** — Create and manage multi-step execution workflows
18
+ - **Performance** — Benchmarking, latency/throughput charts, bottleneck analysis
19
+ - **Memory Store** — Key-value memory with namespace support and semantic search
20
+ - **Neural Network** — Training, optimization, and pattern monitoring
21
+ - **Sessions** — Save and restore orchestration state
22
+ - **Hooks** — Event-driven hook configuration
23
+ - **Configuration** — Runtime config editor with import/export
24
+ - **State Persistence** — Full backend state persisted to `.ruflo/` with debounced writes and crash recovery
25
+
26
+ ## Tech Stack
27
+
28
+ | Layer | Technology |
29
+ |-------|-----------|
30
+ | Frontend | React 19, Vite 6, TypeScript, Zustand, Recharts, Lucide Icons |
31
+ | Backend | Express, WebSocket (ws), Node.js |
32
+ | CLI | [claude-flow v3](https://github.com/ruvnet/claude-flow) (`npx @claude-flow/cli@latest`) |
33
+ | AI | [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) for multi-agent execution |
34
+
35
+ ## Quick Start
36
+
37
+ ```bash
38
+ # Clone the repository
39
+ git clone https://github.com/Mario-PB/rufloui.git
40
+ cd rufloui
41
+
42
+ # Install dependencies
43
+ npm install
44
+
45
+ # Start both frontend and backend
46
+ npm run dev
47
+ ```
48
+
49
+ This starts:
50
+ - **Frontend** (Vite) on `http://localhost:5173`
51
+ - **Backend** (Express + WebSocket) on `http://localhost:3001`
52
+
53
+ The frontend proxies `/api/*` and `/ws` to the backend automatically.
54
+
55
+ ### Install via GitHub Packages
56
+
57
+ RuFloUI is also available as an npm package on GitHub Packages:
58
+
59
+ ```bash
60
+ # Configure npm to use GitHub Packages for the @mario-pb scope
61
+ echo "@mario-pb:registry=https://npm.pkg.github.com" >> .npmrc
62
+
63
+ # Install the package
64
+ npm install @mario-pb/rufloui
65
+ ```
66
+
67
+ > **Note:** You need a GitHub personal access token with `read:packages` scope.
68
+ > Add it to your `~/.npmrc`: `//npm.pkg.github.com/:_authToken=YOUR_TOKEN`
69
+
70
+ ### Individual Services
71
+
72
+ ```bash
73
+ npm run dev:frontend # Vite dev server on port 5173
74
+ npm run dev:backend # Express API on port 3001 (auto-reloads)
75
+ ```
76
+
77
+ ### Production Build
78
+
79
+ ```bash
80
+ npm run build # TypeScript check + Vite production build -> dist/
81
+ npm run preview # Preview the production build
82
+ ```
83
+
84
+ ## Project Structure
85
+
86
+ ```
87
+ src/
88
+ ├── backend/
89
+ │ ├── server.ts # Express API + WebSocket + multi-agent pipeline
90
+ │ └── jsonl-monitor.ts # Real-time JSONL session file monitoring
91
+ └── frontend/
92
+ ├── main.tsx # Entry point
93
+ ├── App.tsx # Router, WebSocket handler, data fetching
94
+ ├── api.ts # API client (typed fetch wrapper)
95
+ ├── store.ts # Zustand global state with sessionStorage persistence
96
+ ├── types.ts # TypeScript interfaces
97
+ ├── styles/
98
+ │ └── global.css # CSS variables, dark theme, animations
99
+ ├── components/
100
+ │ ├── Layout.tsx # App shell with sidebar navigation
101
+ │ ├── ErrorBoundary.tsx
102
+ │ └── ui/ # Button, Card, StatusBadge
103
+ └── pages/
104
+ ├── Dashboard.tsx # System health, agent overview
105
+ ├── SwarmPanel.tsx # Swarm init/shutdown/config
106
+ ├── SwarmMonitorPanel.tsx # Real-time agent cards with output
107
+ ├── AgentsPanel.tsx # Agent lifecycle management
108
+ ├── AgentVizPanel.tsx # JSONL-based agent tree visualization
109
+ ├── TasksPanel.tsx # Kanban task board with continuation
110
+ ├── WorkflowsPanel.tsx # Workflow management
111
+ ├── HiveMindPanel.tsx # Consensus and broadcast
112
+ ├── MemoryPanel.tsx # Key-value memory store
113
+ ├── NeuralPanel.tsx # Neural network status
114
+ ├── PerformancePanel.tsx # Benchmarks and charts
115
+ ├── SessionsPanel.tsx # Save/restore sessions
116
+ ├── HooksPanel.tsx # Hook configuration
117
+ ├── ConfigPanel.tsx # Configuration editor
118
+ └── LogsPanel.tsx # Live activity logs
119
+ ```
120
+
121
+ ## Architecture
122
+
123
+ ```
124
+ Browser (React 19) Express Backend
125
+ ┌────────────────────┐ ┌────────────────────────┐
126
+ │ Vite :5173 │───REST /api──>│ Express :3001 │
127
+ │ Zustand Store │<──WebSocket──>│ WebSocket Server │
128
+ │ sessionStorage │ │ │
129
+ └────────────────────┘ │ ┌──────────────────┐ │
130
+ │ │ claude-flow CLI │ │
131
+ │ │ (npx @claude-flow │ │
132
+ │ │ /cli@latest) │ │
133
+ │ └──────────────────┘ │
134
+ │ ┌──────────────────┐ │
135
+ │ │ Claude Code CLI │ │
136
+ │ │ (claude -p) │ │
137
+ │ │ Multi-agent pipe │ │
138
+ │ └──────────────────┘ │
139
+ │ ┌──────────────────┐ │
140
+ │ │ .ruflo/ │ │
141
+ │ │ state.json │ │
142
+ │ │ outputs/*.jsonl │ │
143
+ │ └──────────────────┘ │
144
+ └────────────────────────┘
145
+ ```
146
+
147
+ ## Multi-Agent Pipeline
148
+
149
+ When a task is assigned to the swarm:
150
+
151
+ 1. **Planning Phase** — Coordinator agent receives the task with `--max-turns 1` (no tool access), outputs a JSON plan breaking work into subtasks
152
+ 2. **Execution Phase** — Each subtask dispatched to the matching specialist agent (researcher, coder, tester, reviewer) with full tool access, respecting dependency order
153
+ 3. **Parallel Waves** — Independent subtasks run in parallel; dependent ones wait for prerequisites
154
+ 4. **Completion** — Results synthesized, task marked complete, output persisted to disk
155
+
156
+ ## Getting Started: Your First Swarm Task
157
+
158
+ Once the app is running, here's how to go from zero to a working multi-agent swarm in under a minute:
159
+
160
+ 1. **Initialize a swarm** — Go to **Swarm** in the sidebar, pick a topology (e.g. `mesh`), and click **Initialize Swarm**.
161
+ 2. **Spawn agents** — Go to **Agents**, select a type (e.g. `coder`), give it a name, and click **Spawn**. Repeat for other roles you need (`researcher`, `tester`, etc.).
162
+ 3. **Create a task** — Go to **Tasks**, click **Create Task**, fill in a title and description (e.g. "Write a fibonacci function in Python with tests").
163
+ 4. **Assign to swarm** — On the task card, click **Assign to Swarm**. The multi-agent pipeline kicks in: a coordinator plans subtasks, specialist agents execute them in parallel waves.
164
+ 5. **Watch it live** — Switch to **Swarm Monitor** to see agent cards light up with real-time output and the orange working glow animation. Or open **Agent Viz** to see the full agent tree built from session logs.
165
+ 6. **Continue if needed** — When a task completes, click **Continue Task** to send a follow-up instruction with full context from the previous run.
166
+
167
+ ## Prerequisites
168
+
169
+ - **Node.js** >= 18
170
+ - **claude-flow CLI** — installed automatically via `npx @claude-flow/cli@latest`
171
+ - **Claude Code CLI** (optional) — required for multi-agent pipeline execution. [Install guide](https://docs.anthropic.com/en/docs/claude-code)
172
+
173
+ ## Telegram Bot (Optional)
174
+
175
+ Monitor and control RuFloUI from Telegram.
176
+
177
+ ### Setup
178
+
179
+ **Option A: Via the Dashboard (recommended)**
180
+
181
+ 1. Message [@BotFather](https://t.me/BotFather) on Telegram, send `/newbot`, and follow the prompts to get a bot token.
182
+ 2. Message your new bot with `/start` to get your chat ID.
183
+ 3. Open the RuFloUI dashboard, go to **Config > Telegram Bot**.
184
+ 4. Paste the bot token and chat ID, click **Save & Connect**.
185
+ 5. Click **Send Test** to verify.
186
+
187
+ **Option B: Via environment variables**
188
+
189
+ ```bash
190
+ TELEGRAM_ENABLED=true
191
+ TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
192
+ TELEGRAM_CHAT_ID=123456789
193
+ ```
194
+
195
+ Restart the backend. You should see `[telegram] Bot connected as @YourBotName` in logs.
196
+
197
+ ### Commands
198
+
199
+ | Command | Description |
200
+ |---------|-------------|
201
+ | `/start` | Shows your chat ID (works for any user) |
202
+ | `/status` | System health + swarm status + agent/task counts |
203
+ | `/agents` | List active agents with type and status |
204
+ | `/tasks` | Tasks grouped by status (with inline refresh) |
205
+ | `/task <id>` | Detailed info for one task (with cancel button) |
206
+ | `/workflows` | List workflows with status and step count |
207
+ | `/swarm` | Swarm topology and status |
208
+ | `/run <description>` | Create and assign a task to the swarm |
209
+ | `/cancel <id>` | Cancel a running or pending task |
210
+ | `/help` | List available commands |
211
+
212
+ ### Notifications
213
+
214
+ Configurable per-type via the dashboard (Config > Telegram Bot > Notifications):
215
+
216
+ | Notification | Default | Description |
217
+ |-------------|---------|-------------|
218
+ | Task Completed | On | Task finishes successfully |
219
+ | Task Failed | On | Task fails with error |
220
+ | Swarm Initialized | On | Swarm starts up |
221
+ | Swarm Shutdown | On | Swarm stops |
222
+ | Agent Error | On | Agent encounters an error |
223
+ | Task Progress | Off | Progress updates (throttled to 1 per 30s per task) |
224
+
225
+ ### Security
226
+
227
+ - Only the configured chat ID can execute commands. Other users see their chat ID via `/start` but cannot issue commands.
228
+ - Bot token is stored in `.ruflo/telegram.json` with restricted file permissions (0600).
229
+ - The dashboard masks the token, showing only the last 4 characters.
230
+
231
+ ### Disabling
232
+
233
+ Set `TELEGRAM_ENABLED=false` (or remove it) and restart. The bot is completely inert when disabled.
234
+
235
+ ## GitHub Webhooks (Optional)
236
+
237
+ Automatically create swarm tasks when GitHub issues are opened.
238
+
239
+ ### Setup
240
+
241
+ 1. Open the RuFloUI dashboard, go to **Webhooks** in the sidebar.
242
+ 2. Click **Edit**, enable GitHub Webhooks, paste your GitHub token (needs `repo` scope).
243
+ 3. Optionally add a webhook secret and list repos to monitor.
244
+ 4. Copy the **Webhook URL** shown on the page.
245
+ 5. In your GitHub repo, go to **Settings > Webhooks > Add webhook**.
246
+ 6. Paste the URL, set content type to `application/json`, select **Issues** events.
247
+
248
+ ### How It Works
249
+
250
+ When a new issue is opened in a monitored repo:
251
+
252
+ 1. GitHub sends a POST to RuFloUI's webhook endpoint
253
+ 2. RuFloUI validates the HMAC signature (if secret configured)
254
+ 3. A high-priority task is created with the issue title and body
255
+ 4. If a swarm is active, the task is auto-assigned to the multi-agent pipeline
256
+ 5. Agents investigate, code, test, and produce a result
257
+ 6. Event status updates in the Webhooks page as the task progresses
258
+
259
+ ### Environment Variables (alternative to dashboard)
260
+
261
+ | Variable | Default | Description |
262
+ |----------|---------|-------------|
263
+ | `GITHUB_WEBHOOK_ENABLED` | `false` | Enable webhook receiver |
264
+ | `GITHUB_TOKEN` | — | GitHub PAT with `repo` scope |
265
+ | `GITHUB_WEBHOOK_SECRET` | — | HMAC secret for signature validation |
266
+ | `GITHUB_WEBHOOK_REPOS` | — | Comma-separated `owner/repo` list |
267
+
268
+ ## Contributing
269
+
270
+ Contributions are welcome! Here's how you can help:
271
+
272
+ 1. **Fork** the repository
273
+ 2. **Create a branch** for your feature or fix: `git checkout -b feat/my-feature`
274
+ 3. **Make your changes** — follow the existing code style (TypeScript, inline CSS, Zustand for state)
275
+ 4. **Test** — run `npm run build` to make sure everything compiles
276
+ 5. **Submit a PR** — describe what you changed and why
277
+
278
+ ### Other ways to contribute
279
+
280
+ - **Give us a star** — It helps others discover the project and motivates us to keep improving it
281
+ - **Spread the word** — Share RuFloUI with your team, on social media, or in developer communities
282
+ - **Report bugs** — Open an issue with steps to reproduce
283
+ - **Suggest features** — We'd love to hear your ideas
284
+
285
+ ## Support the Project
286
+
287
+ If RuFloUI is useful to you, consider buying us a coffee:
288
+
289
+ <a href="https://buymeacoffee.com/rufloui" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="48"></a>
290
+
291
+ ## Security Considerations
292
+
293
+ ### Autonomous Agent Execution
294
+
295
+ By default, RuFloUI runs Claude Code agents with `--dangerously-skip-permissions`, which allows agents to read, write, and execute commands without asking for confirmation. This is required for autonomous multi-agent orchestration — without it, every agent would block waiting for human approval on each action.
296
+
297
+ **To disable autonomous mode**, set the environment variable:
298
+
299
+ ```bash
300
+ RUFLOUI_SKIP_PERMISSIONS=false
301
+ ```
302
+
303
+ With this disabled, agents will require manual approval for each tool use, which effectively prevents autonomous swarm execution.
304
+
305
+ ### Local-Only by Default
306
+
307
+ RuFloUI is designed for local development use. The API server binds to `localhost` and restricts CORS to the frontend origin. Do not expose the API to untrusted networks without adding authentication.
308
+
309
+ ## Related Projects
310
+
311
+ - [claude-flow](https://github.com/ruvnet/claude-flow) — The CLI orchestration engine that powers RuFloUI
312
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) — Anthropic's CLI for Claude AI
313
+
314
+ ## License
315
+
316
+ MIT
package/Webhooks) ADDED
File without changes