claude-flow 3.77.2 → 3.78.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.
- package/.claude/helpers/learning-loop.cjs +21 -5
- package/README.md +1 -1
- package/node_modules/@claude-flow/mcp/dist/transport/http.d.ts +7 -0
- package/node_modules/@claude-flow/mcp/dist/transport/http.d.ts.map +1 -1
- package/node_modules/@claude-flow/mcp/dist/transport/http.js +33 -29
- package/node_modules/@claude-flow/mcp/dist/transport/http.js.map +1 -1
- package/node_modules/@claude-flow/mcp/package.json +1 -1
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +4 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -1
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +5 -1
- package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -1
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +2 -2
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -1
- package/node_modules/@claude-flow/security/dist/input-validator.js +4 -2
- package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -1
- package/node_modules/@claude-flow/security/package.json +1 -1
- package/package.json +7 -7
- package/v3/@claude-flow/cli/README.md +202 -81
- package/v3/@claude-flow/cli/catalog-manifest.json +6 -6
- package/v3/@claude-flow/cli/dist/src/init/executor.js +10 -4
- package/v3/@claude-flow/cli/dist/src/init/helper-companions.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/helper-companions.js +25 -3
- package/v3/@claude-flow/cli/dist/src/init/helper-refresh.js +7 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.d.ts +5 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.js +36 -5
- package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.js +9 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +37 -1
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +4 -2
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +239 -26
- package/v3/@claude-flow/cli/dist/src/memory/verified-outcomes.d.ts +10 -1
- package/v3/@claude-flow/cli/dist/src/memory/verified-outcomes.js +37 -3
- package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +105 -561
- package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +168 -729
- package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.js +1 -1
- package/v3/@claude-flow/cli/package.json +9 -9
- package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +10 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/http.js +44 -6
- package/v3/@claude-flow/shared/package.json +1 -1
|
@@ -1,22 +1,111 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<a href="https://cognitum.one/ruPro"><img src="ruflo/assets/ruflo-neon-flicker.gif" alt="Ruflo animated neon sign" width="100%"></a>
|
|
4
|
+
|
|
5
|
+
<a href="https://cognitum.one/ruPro"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/65194a54b575b4f487a96250e80b1bb9a4cf335d/docs/assets/readme/rupro-workspace.svg" alt="ruPro workspace tour showing project agents, provider terminals, evidence review and business dashboards" width="100%"></a>
|
|
6
|
+
|
|
7
|
+
**[Explore ruPro interactive demo](https://cognitum.one/ruPro)** · Manage agents and projects across desktop, mobile, and cloud.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
**An agent meta-harness for Claude Code and Codex.**
|
|
4
11
|
|
|
5
12
|
<!-- Try Ruflo — the 3 badges first-time visitors actually act on -->
|
|
6
13
|
[](https://www.npmjs.com/package/ruflo)
|
|
7
14
|
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
[](https://github.com/ruvnet/ruflo)
|
|
16
|
+
[](https://x.com/rUv)
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="docs/harness-origins.md"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/e69e4b95aa08d65ea0f7715489bbf8e62a83a0d2/docs/assets/readme/badges/first-commit.svg" width="300" height="76" alt="Claude Flow lineage: first commit June 2, 2025 by rUv; inspect the evidence"></a>
|
|
20
|
+
<a href="https://github.com/ruvnet/ruvnet/blob/main/data/ecosystem-running-totals.json"><img src="docs/assets/readme/badges/downloads.svg" width="300" height="76" alt="120.95 million observed npm download events since October 1, 2025, across 429 packages. Verified November 16, 2026. Lower bound; not unique users or lifetime downloads."></a>
|
|
21
|
+
<br>
|
|
22
|
+
<a href="https://github.com/ruvnet/claude-flow"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/d1e80400bdefe01d3b13e70395f88fffab76bb18/docs/assets/readme/badges/claude.svg" width="300" height="76" alt="Claude Code plugin"></a>
|
|
23
|
+
<a href="https://claude.ai/customize/plugins/id/e74b8927-3c53-4082-b0d9-fe82bf1235ce%40anthropic-plugin-directory"><img src="docs/assets/readme/badges/claude-directory.svg" width="300" height="76" alt="View Claude plugin listing in the Claude plugin directory"></a>
|
|
24
|
+
<a href="https://www.npmjs.com/package/@claude-flow/codex"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/d1e80400bdefe01d3b13e70395f88fffab76bb18/docs/assets/readme/badges/codex.svg" width="300" height="76" alt="Codex plugin"></a>
|
|
25
|
+
<a href="https://chatgpt.com/plugins/plugin_asdk_app_6ab674ff53c48191bb37040c343e31f3"><img src="docs/assets/readme/badges/chatgpt.svg" width="300" height="76" alt="ChatGPT plugin: RuFlo Federation"></a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<a id="start-here"></a>
|
|
31
|
+
|
|
32
|
+
## <img src="docs/assets/readme/icons/terminal.svg" width="32" height="32" alt=""> Get started in one command
|
|
33
|
+
|
|
34
|
+
Run this in your project folder:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx ruflo@latest init
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then open Claude Code in the same folder and give it a real task, for example:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
Use a ruflo swarm to review this repo: find the riskiest module, write tests for it, and summarise what you changed.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`init` adds ruflo's agents, hooks, memory and MCP server to the project, and Claude Code picks them up on its next start. Codex and other MCP clients work too: point them at `npx -y ruflo@latest mcp start`.
|
|
47
|
+
|
|
48
|
+
<p align="center"><img src="docs/assets/ruflo-console-tour.gif" width="720" alt="Looping recording of the ruflo console: overview, swarm view and missions in a sample project"></p>
|
|
49
|
+
|
|
50
|
+
[First useful task, step by step](docs/ruflo-explained.md) · [User guide](docs/USERGUIDE.md) · [Compare install paths](#quick-start)
|
|
51
|
+
|
|
52
|
+
<a href="https://github.com/ruvnet/ruflo/blob/main/docs/recipes/rvf-mcp-search.md"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/readme/rvf-mcp-search.svg" width="720" alt="Search a local RVF index from a Ruflo project using the stdio RVF MCP server and a read-only handle"></a>
|
|
53
|
+
|
|
54
|
+
[Optional recipe: local vector search with RVF and MCP](https://github.com/ruvnet/ruflo/blob/main/docs/recipes/rvf-mcp-search.md) · [Ruvnet ecosystem](https://ruv.io)
|
|
55
|
+
|
|
56
|
+
<details>
|
|
57
|
+
<summary><b>Other ways to install</b> (Claude Code plugins only, MCP-only clients, terminal UI)</summary>
|
|
58
|
+
|
|
59
|
+
**Claude Code plugins only.** This route installs core tools, the visual console and runtime mods, with no files added to your project. It needs Claude Code **2.1.287 or later**. Run inside Claude Code:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
/plugin marketplace add ruvnet/ruflo
|
|
63
|
+
/plugin install ruflo-core@ruflo
|
|
64
|
+
/plugin install ruflo-console@ruflo
|
|
65
|
+
/plugin install ruflo-mods@ruflo
|
|
66
|
+
/reload-plugins
|
|
67
|
+
/ruflo
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
From a terminal, on Claude Code 2.1.292 or later: `claude plugin install ruflo-core@ruflo --marketplace ruvnet/ruflo`. Mods run with your account's permissions, so review their code before installing.
|
|
71
|
+
|
|
72
|
+
**Codex or another MCP client, without project setup.** Configure the **command** `npx` with the **arguments** `["-y", "ruflo@latest", "mcp", "start"]`. To set up a project interactively, run `npx ruflo@latest init wizard`.
|
|
73
|
+
|
|
74
|
+
**Plain terminal.** The console also runs on its own, without Claude Code: `npx ruflo tui`. Add `--plain` to print one frame for scripts. See the [terminal UI guide](docs/USERGUIDE.md#terminal-ui-optional).
|
|
75
|
+
|
|
76
|
+
<p align="center"><img src="docs/assets/ruflo-tui-compact.svg" width="640" alt="Looping recording of the optional ruflo terminal UI with its pictures: Overview in the Classic BBS look, the Orbital look with its moving globe, and the Swarm graph, in a sample project"></p>
|
|
77
|
+
|
|
78
|
+
</details>
|
|
79
|
+
|
|
80
|
+
<div align="center">
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Optional: ruOS Desktop
|
|
84
|
+
|
|
85
|
+
<a href="https://ruos.cognitum.one"><img src="ruflo/assets/ruos-animated.svg" alt="ruOS — A desktop that runs itself" width="100%"></a>
|
|
86
|
+
|
|
87
|
+
**Connect ruOS to ChatGPT or Claude via MCP:**
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
https://ruos.cognitum.one/mcp
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
<!-- RuVector promo -->
|
|
96
|
+
<a href="https://github.com/ruvnet/ruvector"><img src="docs/assets/readme/ruvector-promo-depth.svg" width="100%" alt="RuVector: Give your agents memory. Local vector search, persistent context, graph relationships and feedback learning. Explore RuVector."></a>
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npx ruvector
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
|
|
9
103
|
|
|
10
|
-
<!-- Ecosystem strip (collapsed visually with flat-square) -->
|
|
11
|
-
[](https://github.com/ruvnet/ruvector)
|
|
12
|
-
[](https://github.com/ruvnet/ruflo/blob/main/data/clone-data.proof.json)
|
|
13
|
-
[](https://github.com/ruvnet/ruflo/blob/main/data/clone-data.ledger.json)
|
|
14
|
-
[](https://github.com/ruvnet/claude-flow)
|
|
15
|
-
[](https://www.npmjs.com/package/@claude-flow/codex)
|
|
16
104
|
|
|
17
105
|
# Ruflo
|
|
18
106
|
|
|
19
|
-
|
|
107
|
+
[English](README.md) · [简体中文](README.zh-CN.md)
|
|
108
|
+
|
|
20
109
|
|
|
21
110
|
[](docs/ruflo-explained.md)
|
|
22
111
|
|
|
@@ -29,16 +118,29 @@ A 14-chapter guide: from the basic idea to a first useful task, then memory, age
|
|
|
29
118
|
|
|
30
119
|
One `npx ruflo init` gives Claude Code a nervous system: agents self-organize into swarms, learn from every task, remember across sessions, and — with federation — securely talk to agents on other machines without leaking data. You keep writing code. Ruflo handles the coordination.
|
|
31
120
|
|
|
32
|
-
|
|
33
|
-
Self-Learning / Self-Optimizing Agent Architecture
|
|
121
|
+
<p align="center"><img src="docs/assets/readme/learning-cinematic-compact.svg" width="100%" alt="Ruflo trajectory learning: branching memory paths, outcome feedback, contrastive AI and local learning. No LLM required for local vector retrieval and contrastive updates; agent execution may still use an LLM."></p>
|
|
34
122
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
123
|
+
<sub>Conceptual learning loop. Local vector retrieval and contrastive updates can run without an LLM; embeddings and configured learning modules are still required. See the <a href="v3/@claude-flow/cli/src/services/ruvector-training.ts">RuVector training integration</a> and <a href="v3/@claude-flow/neural/src/modes/balanced.ts">trajectory contrastive learning</a>.</sub>
|
|
124
|
+
|
|
125
|
+
<details>
|
|
126
|
+
<summary>Architecture in text</summary>
|
|
127
|
+
|
|
128
|
+
User → Ruflo (CLI/MCP) → Router → Swarm → Agents → Memory → LLM providers. Memory feeds useful experience back into routing. This is a conceptual flow, not a live execution trace.
|
|
129
|
+
|
|
130
|
+
</details>
|
|
39
131
|
|
|
40
132
|
> **New to Ruflo?** You don't need to learn 406 MCP tools or 61 CLI commands. After `init`, just use Claude Code normally — the hooks system automatically routes tasks, learns from successful patterns, and coordinates agents in the background.
|
|
41
133
|
|
|
134
|
+
### An origin you can inspect
|
|
135
|
+
|
|
136
|
+
[](docs/harness-origins.md)
|
|
137
|
+
|
|
138
|
+
**Built by [Reuven Cohen (rUv)](https://github.com/ruvnet), originally as Claude Flow.** The [first commit, June 2, 2025](https://github.com/ruvnet/ruflo/commit/7c1f9402d70e7af56c01a879073cbac92564dc4e), describes a code orchestration layer for recursive agent cycles: Claude writes, edits, tests and improves. The [June 10 source snapshot](https://github.com/ruvnet/ruflo/tree/dba545f012ea92a2375a26332bbf3797495e93c9) adds orchestration, task scheduling, memory and terminal modules.
|
|
139
|
+
|
|
140
|
+
A harness is the workbench around the model: it organizes tasks, carries context between steps and helps check results. **This establishes Ruflo's lineage, not a universal first across every Claude Code tool.** [See the illustrated explainer, exact commits and earlier ecosystem context](docs/harness-origins.md).
|
|
141
|
+
|
|
142
|
+
**Grok Build:** `npx ruflo init --grok` writes the project host surface (`.grok/`, the team bus, and the operator guide) and nothing outside the project; add `--dry-run` to preview. Setup, the `spawn_subagent` contract, the optional status row, and what to re-check when Grok updates: [the Grok operator guide](v3/@claude-flow/cli/templates/grok/docs/README.md).
|
|
143
|
+
|
|
42
144
|
<details>
|
|
43
145
|
<summary><strong>📖 Background — where the name comes from</strong></summary>
|
|
44
146
|
|
|
@@ -48,14 +150,51 @@ User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Prov
|
|
|
48
150
|
|
|
49
151
|
---
|
|
50
152
|
|
|
51
|
-
|
|
153
|
+
<p align="center"><img src="docs/assets/readme/console.svg" alt="Mission control: inspect agent work" width="100%"></p>
|
|
52
154
|
|
|
53
|
-
|
|
155
|
+
<p align="center"><a href="https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/ruflo-console-theme-compact.svg"><img src="docs/assets/ruflo-console-theme-compact.svg" width="100%" alt="Ruflo Orbital theme: animated boot checks, block logo, menu icons, rotating globe, swarm routing, six color palettes and responsive Theme Studio"></a></p>
|
|
54
156
|
|
|
157
|
+
[Open animated demo](https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/ruflo-console-theme-compact.svg) · [Theme Studio guide](plugins/ruflo-console/README.md) · [Workflow demo](docs/assets/ruflo-console-workflows.svg)
|
|
55
158
|
|
|
56
|
-
<
|
|
159
|
+
<img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> **Your agent cockpit.** Track workflows, agents, models, tokens and cost beside Claude Code. The 38 second animation shows **Orbital and Theme Studio** through actual renderer frames, including boot checks, six palettes, customization, saved themes, JSON import and resizing. This compact 3.84 MB SVG retains all 456 frames. Native host and AI provider execution are not demonstrated.
|
|
57
160
|
|
|
58
|
-
|
|
161
|
+
<img src="docs/assets/readme/console-icon-inspect.svg" width="28" height="28" alt=""> **Inspect any run.** Open agent logs and results, search, triage failures, replay and compare. Start with `npx ruflo init`, restart Claude Code, then `/ruflo`. [Full console tour](docs/assets/ruflo-console-walkthrough-wide.gif).
|
|
162
|
+
|
|
163
|
+
<img src="docs/assets/readme/console-icon-control.svg" width="28" height="28" alt=""> **Let Claude drive. You set the limits.** Enable **Settings → Claude control** to navigate and run console actions. Choose `read`, `write`, `manage` or `full`, with `ask` or `auto` approval. The current default is **read + ask**; raising the level is your choice. Actions above your permission level are refused, and network, spending and destructive actions require confirmation even in `auto`. Review the live action log or press **Take back control** to stop Claude control. [Details](v3/docs/adr/ADR-444-claude-controls-the-console.md).
|
|
164
|
+
|
|
165
|
+
<a id="console-walkthrough"></a>
|
|
166
|
+
|
|
167
|
+
### One task: create a mission with Claude
|
|
168
|
+
|
|
169
|
+
<img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> **Watch the recorded console session below.** Claude creates a mission, opens the Learning and Security pages, and reports its actions in Overview.
|
|
170
|
+
|
|
171
|
+
1. **Set the boundary.** Install the console using the commands below, open `/ruflo`, then choose **Settings → Claude control → write + ask**.
|
|
172
|
+
2. **Give a concrete request.** Try: “Create a mission to add a dark mode toggle. Show me the mission and its status.”
|
|
173
|
+
3. **Approve creation.** Claude opens Missions and sets the goal. Confirm the pending create action in the console.
|
|
174
|
+
4. **Verify the result.** Check that Missions contains the goal and Overview records the action. Creating a mission does not mean the feature has been implemented.
|
|
175
|
+
5. **Keep control.** **Take back control** pauses Claude's console tools. A later call should be refused until you restore control.
|
|
176
|
+
|
|
177
|
+
**What the recording demonstrates:** a real Claude Haiku session with `write + auto`, mission creation, page navigation, a refused swarm stop, and control being taken back. The steps above use `ask` so you approve creation yourself. The linked workflow animation uses sample data, while the theme demo replays renderer frames. Neither is evidence of completed swarm work or memory recall.
|
|
178
|
+
|
|
179
|
+
[Implementation and recorded test findings](v3/docs/adr/ADR-444-claude-controls-the-console.md) · [Reproduction script](plugins/ruflo-console/scripts/e2e-control.sh)
|
|
180
|
+
|
|
181
|
+
<p align="center"><img src="docs/assets/ruflo-console-claude-control.gif" alt="Claude Code with the ruflo console beside it: Claude sets a mission goal, creates the mission and opens the Learning, Security and Overview pages through the console tools; the Claude control dashboard logs each action; swarm-stop is refused because it needs the full level; the person clicks Take back control and the next request is refused"></p>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
**Install the mods from the ruflo marketplace** (Claude Code 2.1.287 or later; mods run with your account's permissions and are not sandboxed, so read the code first):
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
/plugin marketplace add ruvnet/ruflo
|
|
188
|
+
/plugin install ruflo-console@ruflo
|
|
189
|
+
/plugin install ruflo-mods@ruflo
|
|
190
|
+
/reload-plugins
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`ruflo-console` is the cockpit above, `ruflo-mods` routes prompts and enforces policy in-process, `ruflo-swarm` shows the swarm in a pane, and `ruflo-ruos` adds the ruOS status segment. Open `/plugin` to confirm they appear in the active mods line. Inside the console, `/ruflo market` is the Plugin Catalog: every ruflo plugin, mod and skill with what it ships, and buttons to install, enable, disable and update (each asks first).
|
|
194
|
+
|
|
195
|
+
## Quick Start
|
|
196
|
+
|
|
197
|
+
<p align="center"><img src="docs/assets/readme/quick-start.svg" alt="Start building with Ruflo" width="100%"></p>
|
|
59
198
|
|
|
60
199
|
There are **two different install paths** with very different surface areas. Pick based on what you need (#1744):
|
|
61
200
|
|
|
@@ -83,7 +222,7 @@ There are **two different install paths** with very different surface areas. Pic
|
|
|
83
222
|
This adds slash commands and agent definitions. `ruflo-core` (installed above) does register its own MCP server on install — its tools are callable as `mcp__plugin_ruflo-core_ruflo__*` (e.g. `mcp__plugin_ruflo-core_ruflo__memory_store`), not the bare `memory_store`/`swarm_init`/`agent_spawn` names the CLI-track scaffold uses. Other plugins generally don't ship their own MCP server. For the full loop with the CLI-track tool names, use Path B below.
|
|
84
223
|
|
|
85
224
|
<details>
|
|
86
|
-
<summary><strong>🔌 All 48 plugins</strong
|
|
225
|
+
<summary><strong>🔌 All 48 plugins</strong> (plus 3 external)</summary>
|
|
87
226
|
|
|
88
227
|
#### Core & Orchestration
|
|
89
228
|
|
|
@@ -134,6 +273,9 @@ This adds slash commands and agent definitions. `ruflo-core` (installed above) d
|
|
|
134
273
|
| [**ruflo-jujutsu**](plugins/ruflo-jujutsu/README.md) | Analyze git diffs, score risk, suggest reviewers |
|
|
135
274
|
| [**ruflo-rure**](plugins/ruflo-rure/) | Static analysis of a local JS/Electron app you are authorized to study, with file and line evidence |
|
|
136
275
|
| [**ruflo-docs**](plugins/ruflo-docs/README.md) | Generate and maintain documentation automatically |
|
|
276
|
+
| [**agentic-qe-fleet**](https://github.com/proffesor-for-testing/agentic-qe/tree/v3.15.17/plugins/agentic-qe-fleet) | External, maintained by [Agentic QE](https://github.com/proffesor-for-testing/agentic-qe): 11 QE agents, test generation, coverage, chaos and TDD skills, the `agentic-qe` MCP server, and a guard for AQE learning data (`/plugin install agentic-qe-fleet@ruflo`). Install it from one marketplace only, `agentic-qe` or `ruflo`: enabled from both, its mod and commands load twice |
|
|
277
|
+
| [**agentdb**](https://github.com/ruvnet/agentdb/tree/plugin-v3.2.0/plugins/agentdb) | External, maintained in [ruvnet/agentdb](https://github.com/ruvnet/agentdb): agentdb's own MCP server (pinned `agentdb@3.2.0`: hybrid keyword + vector search, opt-in cross-encoder rerank), a memory-specialist agent, vector-memory / learning / diagnostics skills, `/agentdb-status`, and a guard that keeps secrets out of memory and refuses delete/reset unless allowed (`/plugin install agentdb@ruflo`). Use `ruflo-agentdb` instead if you want AgentDB through ruflo's server; the two can coexist. Install it from one marketplace only, `agentdb` or `ruflo` |
|
|
278
|
+
| [**agentic-flow**](https://github.com/ruvnet/agentic-flow/tree/plugin-v3.1.0/plugins/agentic-flow) | External, maintained in [ruvnet/agentic-flow](https://github.com/ruvnet/agentic-flow): the agentic-flow MCP server (pinned `agentic-flow@3.1.0`, `readonly` profile by default, nothing pre-approved), ReasoningBank and model-router agents, routing / learning / autopilot skills, `/agentic-flow-status`, and a guard on `agentic_flow_agent` (`/plugin install agentic-flow@ruflo`). Install it from one marketplace only, `agentic-flow` or `ruflo` |
|
|
137
279
|
|
|
138
280
|
#### Security & Compliance
|
|
139
281
|
|
|
@@ -166,7 +308,7 @@ This adds slash commands and agent definitions. `ruflo-core` (installed above) d
|
|
|
166
308
|
|
|
167
309
|
| Plugin | What it does |
|
|
168
310
|
|--------|-------------|
|
|
169
|
-
| [**ruflo-agent**](plugins/ruflo-agent/README.md) | Run agents — local WASM sandbox (rvagent) + Anthropic Claude Managed Agents (cloud) |
|
|
311
|
+
| [**ruflo-agent**](plugins/ruflo-agent/README.md) | Run agents — local WASM sandbox (rvagent) + Anthropic Claude Managed Agents (cloud), with opt-in bounded dynamic workflows, gated session controls and verified advisory learning |
|
|
170
312
|
| [**ruflo-plugin-creator**](plugins/ruflo-plugin-creator/README.md) | Scaffold, validate, and publish your own plugins |
|
|
171
313
|
|
|
172
314
|
#### Domain-Specific
|
|
@@ -180,7 +322,7 @@ This adds slash commands and agent definitions. `ruflo-core` (installed above) d
|
|
|
180
322
|
|
|
181
323
|
</details>
|
|
182
324
|
|
|
183
|
-
### CLI Install
|
|
325
|
+
### <img src="docs/assets/readme/icons/terminal.svg" width="28" height="28" alt=""> CLI Install
|
|
184
326
|
|
|
185
327
|
**macOS / Linux / WSL / Git-Bash:**
|
|
186
328
|
|
|
@@ -204,82 +346,52 @@ npm install -g ruflo@latest
|
|
|
204
346
|
|
|
205
347
|
> 💡 **Windows users:** the `curl ... | bash` form needs a POSIX shell (Git-Bash, WSL, MSYS). The `npx ruflo@latest init wizard` line works natively in PowerShell and cmd. If you hit an `'bash' is not recognized` error, use the `npx` line instead — both end up running the same init flow.
|
|
206
348
|
|
|
207
|
-
### MCP Server
|
|
349
|
+
### <img src="docs/assets/readme/icons/network.svg" width="28" height="28" alt=""> MCP Server
|
|
208
350
|
|
|
209
351
|
```bash
|
|
210
352
|
# Add Ruflo as an MCP server in Claude Code
|
|
211
353
|
claude mcp add claude-flow -- npx ruflo@latest mcp start
|
|
212
354
|
```
|
|
213
355
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
`ruflo mcp start -t http` exposes every registered tool over HTTP (`/rpc`, `/mcp`, `/ws`). The default `stdio` transport is not affected.
|
|
217
|
-
|
|
218
|
-
| Setting | Effect |
|
|
219
|
-
|---|---|
|
|
220
|
-
| `RUFLO_MCP_HTTP_TOKEN=<token>` | Require `Authorization: Bearer <token>` on every request. Failure is a bare `401`. The token is compared in constant time and is never logged. Prefer this over `--auth-token`, which is visible in `ps`. |
|
|
221
|
-
| `--auth-token-file <path>` | Read the token from a file (one line). Takes precedence over the env var. |
|
|
222
|
-
| `--auth-token <token>` | Same, on the command line (visible in argv; highest precedence). |
|
|
223
|
-
| `RUFLO_MCP_ALLOW_UNAUTHENTICATED_HTTP=1` | Allow an unauthenticated bind to a non-loopback `--host`. Only for a trusted network boundary or an authenticating reverse proxy. |
|
|
224
|
-
|
|
225
|
-
A token must be 16-512 printable ASCII characters (no spaces). `GET /health` stays public and returns only `{"status":"ok"}` when a token is set. Tokens are supported for `-t http` only; `-t websocket` rejects one.
|
|
226
|
-
|
|
227
|
-
| `--host` | no token | token set |
|
|
228
|
-
|---|---|---|
|
|
229
|
-
| `localhost`, `127.0.0.1`, `::1` | starts, **unauthenticated** | starts, token required |
|
|
230
|
-
| anything else (`0.0.0.0`, `::`, a LAN IP, `127.0.0.2`, `[::1]`, `LOCALHOST`) | **refuses to start** unless `RUFLO_MCP_ALLOW_UNAUTHENTICATED_HTTP=1` | starts, token required |
|
|
231
|
-
|
|
232
|
-
Without a token, a loopback server is still unauthenticated: any process on the machine, and any web page that can reach it via DNS rebinding, can call tools. Set `RUFLO_MCP_HTTP_TOKEN` whenever the HTTP transport is used.
|
|
233
|
-
|
|
234
|
-
**Upgrading:** binding off loopback (for example `--host 0.0.0.0` in Docker) now needs a token or the opt-out above; otherwise the server exits with an error.
|
|
356
|
+
For static inspection of local applications and binaries, see the [ruRE plugin guide](plugins/ruflo-rure/README.md).
|
|
235
357
|
|
|
236
358
|
---
|
|
237
359
|
|
|
238
|
-
Startup checks report available updates without installing them. To opt in to
|
|
239
|
-
automatic patch installation, set `RUFLO_AUTO_UPDATE=true` (`1`, `yes` and `on`
|
|
240
|
-
also work). Minor and major updates remain manual; critical package priority
|
|
241
|
-
does not bypass an opt-out. CI detection and `CLAUDE_FLOW_AUTO_UPDATE=false`
|
|
242
|
-
still disable the update check.
|
|
243
|
-
|
|
244
360
|
## What You Get
|
|
245
361
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
362
|
+
<p align="center"><img src="docs/assets/readme/capabilities.svg" alt="Your agent toolkit" width="100%"></p>
|
|
363
|
+
|
|
364
|
+
<table>
|
|
365
|
+
<tr><td width="50%"><a href="plugins/ruflo-swarm/README.md"><img src="docs/assets/readme/card-swarm.svg" width="100%" alt="Agent teams"></a></td><td width="50%"><a href="plugins/ruflo-rag-memory/README.md"><img src="docs/assets/readme/card-memory.svg" width="100%" alt="Persistent memory"></a></td></tr>
|
|
366
|
+
<tr><td width="50%"><a href="plugins/ruflo-intelligence/README.md"><img src="docs/assets/readme/card-learning.svg" width="100%" alt="Learning loops"></a></td><td width="50%"><a href="plugins/ruflo-security-audit/README.md"><img src="docs/assets/readme/card-security.svg" width="100%" alt="Security controls"></a></td></tr>
|
|
367
|
+
<tr><td width="50%"><a href="https://ruvnet.github.io/ruflo"><img src="docs/assets/readme/card-plugins.svg" width="100%" alt="Plugin marketplace"></a></td><td width="50%"><a href="plugins/ruflo-ruvllm/README.md"><img src="docs/assets/readme/card-routing.svg" width="100%" alt="Models and routing"></a></td></tr>
|
|
368
|
+
</table>
|
|
253
369
|
|
|
254
370
|
| Capability | Description |
|
|
255
371
|
|------------|-------------|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
260
|
-
|
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
|
|
|
265
|
-
|
|
|
266
|
-
|
|
|
372
|
+
| <img src="docs/assets/readme/icons/agents.svg" width="28" height="28" alt=""> **100+ Agents** | Specialized agents for coding, testing, security, docs, architecture |
|
|
373
|
+
| <img src="docs/assets/readme/icons/network.svg" width="28" height="28" alt=""> **Comms Layer** | Zero-trust federation — agents across machines/orgs discover, authenticate, and exchange work securely |
|
|
374
|
+
| <img src="docs/assets/readme/icons/swarm.svg" width="28" height="28" alt=""> **Swarm Coordination** | Hierarchical, mesh, and adaptive topologies with consensus |
|
|
375
|
+
| <img src="docs/assets/readme/icons/learning.svg" width="28" height="28" alt=""> **Self-Learning** | SONA neural patterns, ReasoningBank, trajectory learning |
|
|
376
|
+
| <img src="docs/assets/readme/icons/memory.svg" width="28" height="28" alt=""> **Vector Memory** | HNSW-indexed AgentDB — measured ~1.9x faster at N=20k, ~3.2x–4.7x at N=5k vs brute force (recall@10 ~0.99); ANN wins above the crossover, ties/loses at small N. See [audit](docs/reviews/intelligence-system-audit-2026-05-29.md) + [`scripts/benchmark-intelligence.mjs`](scripts/benchmark-intelligence.mjs) |
|
|
377
|
+
| <img src="docs/assets/readme/icons/workers.svg" width="28" height="28" alt=""> **Background Workers** | 12 auto-triggered workers (audit, optimize, testgaps, etc.) |
|
|
378
|
+
| <img src="docs/assets/readme/icons/plugins.svg" width="28" height="28" alt=""> **Plugin Marketplace** | 48 native Claude Code plugins + 14 in-tree npm plugins |
|
|
379
|
+
| <img src="docs/assets/readme/icons/routing.svg" width="28" height="28" alt=""> **Multi-Provider** | Claude, GPT, Gemini, Cohere, Ollama with smart routing |
|
|
380
|
+
| <img src="docs/assets/readme/icons/security.svg" width="28" height="28" alt=""> **Security** | AIDefence, input validation, CVE remediation, path traversal prevention |
|
|
381
|
+
| <img src="docs/assets/readme/icons/federation.svg" width="28" height="28" alt=""> **Agent Federation** | Cross-installation agent collaboration with zero-trust security |
|
|
382
|
+
| <img src="docs/assets/readme/icons/audit.svg" width="28" height="28" alt=""> **[MetaHarness](docs/metaharness-user-guide.md)** | Audit your AI agent setup before you ship. Grade readiness (1-100), scan tool configs for security issues, snapshot the whole project to catch regressions over time, and find templates that match your repo. `ruflo eject` turns a ruflo project into a standalone agent toolkit with its own name. [Full guide](docs/metaharness-user-guide.md). |
|
|
383
|
+
|
|
384
|
+
### <img src="docs/assets/readme/icons/learning.svg" width="28" height="28" alt=""> Learning from experience
|
|
385
|
+
|
|
386
|
+
<p align="center"><img src="docs/assets/readme/learning-flow.svg" width="100%" alt="Recall, execute, evaluate, store, adapt and reuse: an illustrative agent learning cycle."></p>
|
|
387
|
+
|
|
388
|
+
Useful trajectories and task feedback can inform future work. Results depend on the configured memory, learning components and quality of feedback. [Learning plugin](plugins/ruflo-intelligence/README.md).
|
|
267
389
|
|
|
268
390
|
### Agent Federation — Slack for Agents
|
|
269
391
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
keys stripped from you in transit
|
|
274
|
-
|
|
|
275
|
-
v
|
|
276
|
-
Their Agent <-- [ Block attacks ] <-- [ Check identity ] <------+
|
|
277
|
-
Stops prompt Rejects forgeries
|
|
278
|
-
injection
|
|
279
|
-
|
|
280
|
-
Audit trail on both sides.
|
|
281
|
-
Trust builds over time. Bad behavior = instant downgrade.
|
|
282
|
-
```
|
|
392
|
+
<p align="center"><img src="docs/assets/readme/federation.svg" alt="Connected intelligence across machines" width="100%"></p>
|
|
393
|
+
|
|
394
|
+
<p align="center"><img src="docs/assets/readme/federation-flow.svg" width="100%" alt="Outbound agent, data filtering, signing and encryption, identity verification, input checks and receiving agent."></p>
|
|
283
395
|
|
|
284
396
|
Slack gave teams channels. Federation gives agents the same thing — **shared workspaces across trust boundaries**, where agents on different machines, orgs, or cloud regions can discover each other, prove who they are, and collaborate on tasks.
|
|
285
397
|
|
|
@@ -381,12 +493,15 @@ User --> Claude Code / CLI
|
|
|
381
493
|
|
|
382
494
|
## Documentation
|
|
383
495
|
|
|
496
|
+
<p align="center"><img src="docs/assets/readme/documentation.svg" alt="Guides, architecture and verification" width="100%"></p>
|
|
497
|
+
|
|
384
498
|
Four docs for four audiences:
|
|
385
499
|
|
|
386
500
|
| Doc | When to read it |
|
|
387
501
|
|-----|-----------------|
|
|
388
502
|
| **[Status](docs/STATUS.md)** | See what currently works — capability counts, test baselines, recent fixes, what's next. The *is-it-ready* doc. |
|
|
389
503
|
| **[User Guide](docs/USERGUIDE.md)** | Daily reference — every command, every config flag, every plugin. The *how-do-I* doc. |
|
|
504
|
+
| **[Compare frameworks](docs/compare.md)** | Deciding between Ruflo, Claude Code built-in agents, CrewAI, LangGraph, or AutoGen. The *which-one-for-me* doc. |
|
|
390
505
|
| **[MetaHarness Guide](docs/metaharness-user-guide.md)** | How to grade your agent setup, scan tool configs for security, detect changes between runs, and eject a project into a standalone agent toolkit. The *audit-my-setup* doc. |
|
|
391
506
|
| **[Benchmarks](https://gist.github.com/ruvnet/298f8c668c8859b369f91734a0e9cbbe)** | v3.8.0 SOTA matrix vs LangGraph / AutoGen / CrewAI on darwin-arm64 + linux-x64. ruflo wins cold start, single turn, RSS by 1.3×–1953×. The *is-it-fast* doc. |
|
|
392
507
|
| **[Verification](verification.md)** | Cryptographically prove your installed bytes match the signed witness — `ruflo verify`. The *trust-but-verify* doc. |
|
|
@@ -411,6 +526,8 @@ User Guide section index:
|
|
|
411
526
|
|
|
412
527
|
## Support
|
|
413
528
|
|
|
529
|
+
<p align="center"><img src="docs/assets/readme/support.svg" alt="Build with the Ruflo community" width="100%"></p>
|
|
530
|
+
|
|
414
531
|
| Resource | Link |
|
|
415
532
|
|----------|------|
|
|
416
533
|
| Documentation | [User Guide](docs/USERGUIDE.md) |
|
|
@@ -419,6 +536,10 @@ User Guide section index:
|
|
|
419
536
|
| Community | [Agentics Foundation Discord](https://discord.com/invite/dfxmpwkG2D) |
|
|
420
537
|
| Powered by | [Cognitum.one](https://cognitum.one) |
|
|
421
538
|
|
|
539
|
+
<p align="center"><img src="docs/assets/readme/signal-divider.svg" alt="Ruflo" width="100%"></p>
|
|
540
|
+
|
|
422
541
|
## License
|
|
423
542
|
|
|
424
543
|
MIT - [RuvNet](https://github.com/ruvnet)
|
|
544
|
+
|
|
545
|
+
<a href="https://cognitum.one"><img src="docs/assets/readme/cognitum-banner-v2.svg" width="100%" alt="Cognitum One: Ambient Intelligence at the edge of the Physical World. Explore cognitum.one."></a>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generation":
|
|
4
|
-
"generatedAt": "2026-
|
|
5
|
-
"gitSha": "
|
|
3
|
+
"generation": 7,
|
|
4
|
+
"generatedAt": "2026-11-19T16:54:24.977Z",
|
|
5
|
+
"gitSha": "9c25e5a3",
|
|
6
6
|
"catalog": {
|
|
7
|
-
"agents":
|
|
8
|
-
"tools":
|
|
9
|
-
"skills":
|
|
7
|
+
"agents": 177,
|
|
8
|
+
"tools": 458,
|
|
9
|
+
"skills": 40
|
|
10
10
|
},
|
|
11
11
|
"benchmark": null
|
|
12
12
|
}
|
|
@@ -15,7 +15,7 @@ import { generateSettingsJson, generateSettings } from './settings-generator.js'
|
|
|
15
15
|
import { generateMCPJson } from './mcp-generator.js';
|
|
16
16
|
import { generateStatuslineScript } from './statusline-generator.js';
|
|
17
17
|
import { generatePreCommitHook, generatePostCommitHook, generateSessionManager, generateAgentRouter, generateMemoryHelper, generateHookHandler, generateIntelligenceStub, generateAutoMemoryHook, generateRufloHookCjs, } from './helpers-generator.js';
|
|
18
|
-
import { getInstalledCliVersion, HELPERS_STAMP_FILE } from './helper-refresh.js';
|
|
18
|
+
import { findPackageHelpersDir, getInstalledCliVersion, HELPERS_STAMP_FILE } from './helper-refresh.js';
|
|
19
19
|
import { generateClaudeMd } from './claudemd-generator.js';
|
|
20
20
|
import { writeDualClaudeMd } from './dual-instructions.js';
|
|
21
21
|
import { detectRufloPlugins, emptyDedupReport } from './plugin-dedup.js';
|
|
@@ -569,7 +569,9 @@ export async function executeUpgrade(targetDir, upgradeSettings = false, riskySe
|
|
|
569
569
|
// 0. ALWAYS update critical helpers (force overwrite)
|
|
570
570
|
const sourceHelpersForUpgrade = findSourceHelpersDir();
|
|
571
571
|
if (sourceHelpersForUpgrade) {
|
|
572
|
-
// Keep in sync with helper-refresh.ts:CRITICAL_HELPERS
|
|
572
|
+
// Keep in sync with helper-refresh.ts:CRITICAL_HELPERS, except the
|
|
573
|
+
// companions: ensureCommonJsCompanions(force=true) below owns them
|
|
574
|
+
// (#4198) and copies the package's signed bytes when it has them.
|
|
573
575
|
const criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.cjs', 'learning-loop.cjs'];
|
|
574
576
|
for (const helperName of criticalHelpers) {
|
|
575
577
|
const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
|
|
@@ -613,10 +615,14 @@ export async function executeUpgrade(targetDir, upgradeSettings = false, riskySe
|
|
|
613
615
|
}
|
|
614
616
|
}
|
|
615
617
|
// #4198: refresh existing companions too, so upgraded hook handlers never
|
|
616
|
-
// keep obsolete session/memory logic.
|
|
618
|
+
// keep obsolete session/memory logic. #4746: the companions are signed
|
|
619
|
+
// critical helpers now, so copy the package's signed bytes (the source the
|
|
620
|
+
// startup refresh verifies against); a generated copy would differ from
|
|
621
|
+
// the manifest and read as tampered on every later run. The generators
|
|
622
|
+
// are the fallback only when the package ships no copy.
|
|
617
623
|
const helpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
618
624
|
const existingCompanions = new Set(COMMONJS_COMPANION_HELPERS.filter((name) => fs.existsSync(path.join(helpersDir, name))));
|
|
619
|
-
for (const name of await ensureCommonJsCompanions(helpersDir, true)) {
|
|
625
|
+
for (const name of await ensureCommonJsCompanions(helpersDir, true, findPackageHelpersDir())) {
|
|
620
626
|
const changes = existingCompanions.has(name)
|
|
621
627
|
? result.updated : result.created;
|
|
622
628
|
changes.push(`.claude/helpers/${name}`);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const COMMONJS_COMPANION_HELPERS: readonly ["session.cjs", "memory.cjs"];
|
|
2
|
-
export declare function ensureCommonJsCompanions(helpersDir: string, force?: boolean): Promise<string[]>;
|
|
2
|
+
export declare function ensureCommonJsCompanions(helpersDir: string, force?: boolean, sourceDir?: string | null): Promise<string[]>;
|
|
3
3
|
//# sourceMappingURL=helper-companions.d.ts.map
|
|
@@ -8,7 +8,14 @@
|
|
|
8
8
|
* refresh writes any missing `.cjs` companion from the CLI's own compiled
|
|
9
9
|
* generators (the trust root; no external file to verify). Stale `.js` copies
|
|
10
10
|
* are left in place and ignored. Existing `.cjs` files are preserved during
|
|
11
|
-
* startup refresh; an explicit init upgrade replaces them
|
|
11
|
+
* startup refresh; an explicit init upgrade replaces them.
|
|
12
|
+
*
|
|
13
|
+
* Since #4746 both companions are also in the signed critical set, so the
|
|
14
|
+
* startup integrity check compares them with the package's signed copies. A
|
|
15
|
+
* caller that has the package's `.claude/helpers` passes it as `sourceDir`:
|
|
16
|
+
* a companion present there is copied byte-for-byte (what the manifest
|
|
17
|
+
* signs), and only a companion missing from it comes from the generators,
|
|
18
|
+
* whose output is not byte-identical to the signed copy.
|
|
12
19
|
*/
|
|
13
20
|
import * as fs from 'fs';
|
|
14
21
|
import * as path from 'path';
|
|
@@ -38,7 +45,22 @@ function safeHelpersDirectory(helpersDir) {
|
|
|
38
45
|
return false;
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
|
-
|
|
48
|
+
/** The package's own copy of a companion, or null when it has none (missing, a link, unreadable). */
|
|
49
|
+
function packagedCompanion(sourceDir, name) {
|
|
50
|
+
if (!sourceDir)
|
|
51
|
+
return null;
|
|
52
|
+
const source = path.join(sourceDir, name);
|
|
53
|
+
try {
|
|
54
|
+
const stat = fs.lstatSync(source);
|
|
55
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
56
|
+
return null;
|
|
57
|
+
return fs.readFileSync(source, 'utf-8');
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export async function ensureCommonJsCompanions(helpersDir, force = false, sourceDir) {
|
|
42
64
|
helpersDir = path.resolve(helpersDir);
|
|
43
65
|
if (!safeHelpersDirectory(helpersDir))
|
|
44
66
|
return [];
|
|
@@ -68,7 +90,7 @@ export async function ensureCommonJsCompanions(helpersDir, force = false) {
|
|
|
68
90
|
const descriptor = fs.openSync(temporary, 'wx', 0o755);
|
|
69
91
|
created = true;
|
|
70
92
|
try {
|
|
71
|
-
fs.writeFileSync(descriptor, content[name](), { encoding: 'utf-8' });
|
|
93
|
+
fs.writeFileSync(descriptor, packagedCompanion(sourceDir, name) ?? content[name](), { encoding: 'utf-8' });
|
|
72
94
|
fs.fchmodSync(descriptor, 0o755);
|
|
73
95
|
}
|
|
74
96
|
finally {
|
|
@@ -82,6 +82,13 @@ export const CRITICAL_HELPERS = [
|
|
|
82
82
|
// bundled from the ruflo-mods loop source; here so every install records verified turns
|
|
83
83
|
// and sees lessons on its next `ruflo` command, not only with the mod.
|
|
84
84
|
'learning-loop.cjs',
|
|
85
|
+
// session.cjs and memory.cjs are required by hook-handler.cjs on every hook,
|
|
86
|
+
// so they carry the same trust as the rest of this list (#4746): the refresh
|
|
87
|
+
// verifies them against the signed manifest and heals a tampered copy.
|
|
88
|
+
// `ruflo init` still generates them from the CLI's own generators; the
|
|
89
|
+
// signed copy wins on the next refresh.
|
|
90
|
+
'session.cjs',
|
|
91
|
+
'memory.cjs',
|
|
85
92
|
];
|
|
86
93
|
function errorCode(error) {
|
|
87
94
|
return typeof error === 'object' && error !== null && 'code' in error
|
|
@@ -169,6 +169,11 @@ export interface OriginKeys {
|
|
|
169
169
|
* is never trusted for anything else.
|
|
170
170
|
*/
|
|
171
171
|
export declare function mergeEnvelopes(basePath: string, roomId: string, incoming: SignedEnvelope[], peerPublicKey: string, origins?: OriginKeys): Promise<MergeResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Read a response body, giving up as soon as it passes `cap` bytes, so an
|
|
174
|
+
* oversized peer reply is never buffered whole before the size check.
|
|
175
|
+
*/
|
|
176
|
+
export declare function readCappedText(res: Response, cap: number, peerNodeId: string): Promise<string>;
|
|
172
177
|
/** Pull one room from one peer and merge what verifies. */
|
|
173
178
|
export declare function syncRoomFromPeer(basePath: string, peer: FederationPeer, roomId: string, fetchImpl?: typeof fetch): Promise<MergeResult & {
|
|
174
179
|
peerNodeId: string;
|
|
@@ -372,6 +372,39 @@ export async function mergeEnvelopes(basePath, roomId, incoming, peerPublicKey,
|
|
|
372
372
|
}
|
|
373
373
|
return result;
|
|
374
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Read a response body, giving up as soon as it passes `cap` bytes, so an
|
|
377
|
+
* oversized peer reply is never buffered whole before the size check.
|
|
378
|
+
*/
|
|
379
|
+
export async function readCappedText(res, cap, peerNodeId) {
|
|
380
|
+
const tooBig = () => new Error(`peer ${peerNodeId} response exceeds size cap`);
|
|
381
|
+
const declared = Number(res.headers?.get?.('content-length'));
|
|
382
|
+
if (Number.isFinite(declared) && declared > cap) {
|
|
383
|
+
await res.body?.cancel().catch(() => undefined);
|
|
384
|
+
throw tooBig();
|
|
385
|
+
}
|
|
386
|
+
if (!res.body) {
|
|
387
|
+
const text = await res.text();
|
|
388
|
+
if (Buffer.byteLength(text, 'utf8') > cap)
|
|
389
|
+
throw tooBig();
|
|
390
|
+
return text;
|
|
391
|
+
}
|
|
392
|
+
const reader = res.body.getReader();
|
|
393
|
+
const chunks = [];
|
|
394
|
+
let total = 0;
|
|
395
|
+
for (;;) {
|
|
396
|
+
const { done, value } = await reader.read();
|
|
397
|
+
if (done)
|
|
398
|
+
break;
|
|
399
|
+
total += value.byteLength;
|
|
400
|
+
if (total > cap) {
|
|
401
|
+
await reader.cancel().catch(() => undefined);
|
|
402
|
+
throw tooBig();
|
|
403
|
+
}
|
|
404
|
+
chunks.push(value);
|
|
405
|
+
}
|
|
406
|
+
return Buffer.concat(chunks, total).toString('utf8');
|
|
407
|
+
}
|
|
375
408
|
/** Pull one room from one peer and merge what verifies. */
|
|
376
409
|
export async function syncRoomFromPeer(basePath, peer, roomId, fetchImpl = fetch) {
|
|
377
410
|
validateRoomId(roomId);
|
|
@@ -381,13 +414,11 @@ export async function syncRoomFromPeer(basePath, peer, roomId, fetchImpl = fetch
|
|
|
381
414
|
const timer = setTimeout(() => controller.abort(), SYNC_TIMEOUT_MS);
|
|
382
415
|
let body;
|
|
383
416
|
try {
|
|
384
|
-
|
|
417
|
+
// A peer URL is pinned by the operator; a redirect would send the pull somewhere they never approved.
|
|
418
|
+
const res = await fetchImpl(url, { signal: controller.signal, headers: { accept: 'application/json' }, redirect: 'error' });
|
|
385
419
|
if (!res.ok)
|
|
386
420
|
throw new Error(`peer ${peer.nodeId} returned ${res.status}`);
|
|
387
|
-
|
|
388
|
-
if (text.length > MAX_SYNC_RESPONSE_BYTES)
|
|
389
|
-
throw new Error(`peer ${peer.nodeId} response exceeds size cap`);
|
|
390
|
-
body = JSON.parse(text);
|
|
421
|
+
body = JSON.parse(await readCappedText(res, MAX_SYNC_RESPONSE_BYTES, peer.nodeId));
|
|
391
422
|
}
|
|
392
423
|
finally {
|
|
393
424
|
clearTimeout(timer);
|