Merge origin/main into integrate/2026-11-17

Resolve workflow-tools.ts imports: keep locked-json-store (#4981) and
path-containment/import-limits (#4878); drop fs helpers neither side uses.

Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
randRuFlo committed 2026-11-17 11:49:19 -05:00
commit e346ef6cdf
46 files changed
+909 -150

No files matched your search

+2 -1
View File
@@ -113,7 +113,8 @@ jobs:
pnpm --dir @claude-flow/cli exec vitest run \
__tests__/guidance-brain.test.ts \
__tests__/mcp-client-guardrail.test.ts \
__tests__/x-federation-join.test.ts
__tests__/x-federation-join.test.ts \
__tests__/watermark-canonical-source-4959.test.ts
pnpm --dir @claude-flow/codex exec vitest run
pnpm --dir @claude-flow/security exec vitest run
pnpm --dir @claude-flow/plugin-agent-federation exec vitest run
+4
View File
@@ -49,6 +49,10 @@ Use a ruflo swarm to review this repo: find the riskiest module, write tests for
[First useful task, step by step](docs/ruflo-explained.md) · [User guide](docs/USERGUIDE.md) · [Compare install paths](#quick-start)
<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>
[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)
<details>
<summary><b>Other ways to install</b> (Claude Code plugins only, MCP-only clients, terminal UI)</summary>
+27
View File
@@ -0,0 +1,27 @@
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="180" viewBox="0 0 900 180" role="img" aria-labelledby="title desc">
<title id="title">Ruflo recipe: search a local portable RVF index</title>
<desc id="desc">A Ruflo project sends a vector query through a local stdio MCP server. The server searches a trusted RVF copy using a read-only handle.</desc>
<style>
.trace { stroke-dasharray: 10 16; animation: move 3s linear 4; }
@keyframes move { to { stroke-dashoffset: -52; } }
@media (prefers-reduced-motion: reduce) { .trace { animation: none; } }
</style>
<rect x="1" y="1" width="898" height="178" rx="17" fill="#101827" stroke="#405575" stroke-width="2"/>
<text x="26" y="36" fill="#edf4ff" font-family="system-ui,sans-serif" font-size="24" font-weight="700">Search a local RVF index</text>
<g fill="#182640" stroke="#5b769d" stroke-width="2">
<rect x="26" y="64" width="245" height="81" rx="12"/>
<rect x="327" y="64" width="246" height="81" rx="12"/>
<rect x="629" y="64" width="245" height="81" rx="12"/>
</g>
<g fill="#edf4ff" text-anchor="middle" font-family="system-ui,sans-serif" font-size="19" font-weight="700">
<text x="149" y="97">Ruflo project</text>
<text x="450" y="97">RVF MCP server</text>
<text x="751" y="97">Trusted RVF copy</text>
</g>
<g fill="#b4cae6" text-anchor="middle" font-family="system-ui,sans-serif" font-size="15">
<text x="149" y="123">Supply a query vector</text>
<text x="450" y="123">Local stdio transport</text>
<text x="751" y="123">Read-only search handle</text>
</g>
<path class="trace" d="M272 104h54m248 0h54" stroke="#61dfcc" stroke-width="4" fill="none"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

+52
View File
@@ -0,0 +1,52 @@
# Search a portable RVF index from a Ruflo project
Use the [RuVector RVF MCP server](https://www.npmjs.com/package/@ruvector/rvf-mcp-server) beside Ruflo to look up nearest vectors in a local `.rvf` file. The recipe keeps the index on your machine and leaves the default Ruflo install unchanged.
## Quickstart: check the local search path
Use Node.js 20 or later and a native RVF build for your platform. The smoke test below was run on Linux x64. The [RVF platform table](https://github.com/ruvnet/ruvector/tree/main/npm/packages/rvf#platform-support) lists other targets; this stdio server uses the Node backend, not browser WASM.
From this repository's root, run:
```sh
demo_dir="$(mktemp -d)"
cp docs/recipes/rvf-mcp-search.mjs "$demo_dir/"
cd "$demo_dir"
npm init -y
npm install --ignore-scripts --no-audit --no-fund --save-exact @ruvector/rvf-mcp-server@0.2.2 @ruvector/rvf@0.4.8 @modelcontextprotocol/sdk@1.32.2
node rvf-mcp-search.mjs
```
Expected final line:
```text
Nearest vector: 1; read-only write rejected; traversal rejected; RVF unchanged.
```
The script creates a temporary three-vector fixture, connects over stdio, opens the index read-only, checks the nearest match, verifies that an attempted write and path traversal are rejected, and checks that the original bytes did not change. It removes the fixture on exit. No model, API key, remote endpoint, or telemetry is needed.
## Use it next to Ruflo
1. In the directory where you explicitly installed the packages above, make a dedicated `rvf-search-data` directory. Put only a **copy of a trusted index** in it. If the index came from the RVF MCP server and uses metadata filters, copy its matching `.mcp-meta.jsonl` sidecar too.
2. In your MCP client for the Ruflo project, add a separate `rvf-search` server alongside the existing Ruflo server. For Claude Code, merge the entry below into the project's `.mcp.json`, replacing both absolute paths. Review the project MCP configuration before enabling it.
```json
{
"mcpServers": {
"rvf-search": {
"command": "node",
"args": [
"/absolute/recipe/node_modules/@ruvector/rvf-mcp-server/dist/cli.js",
"--transport", "stdio",
"--data-dir", "/absolute/recipe/rvf-search-data"
]
}
}
}
```
3. Ask the client to use `rvf_open_store` with a relative `path` and **`readOnly: true`**. Then call `rvf_query` with the returned `storeId`, a vector of the same dimensions and embedding space as the index, and `k`. Call `rvf_close_store` when finished. The server searches supplied vectors; it does not automatically embed a text query in this recipe.
Keep transport on stdio. Read-only applies to the opened handle; the server still advertises write tools and can open other handles. Keep the data directory isolated, keep automatic tool approval off, and permit only open/query/close calls for this workflow. If the client cannot constrain calls, use the deterministic script with a disposable fixture instead of exposing a sensitive index to an agent.
Continue with the [RVF SDK quickstart](https://github.com/ruvnet/ruvector/tree/main/npm/packages/rvf#quick-start) to create your own index, or explore the [Ruvnet ecosystem](https://ruv.io).
+61
View File
@@ -0,0 +1,61 @@
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { mkdtemp, readFile, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { RvfDatabase } from '@ruvector/rvf';
const dir = await mkdtemp(join(tmpdir(), 'ruflo-rvf-search-'));
const file = join(dir, 'demo.rvf');
const sha256 = async () => createHash('sha256').update(await readFile(file)).digest('hex');
const client = new Client({ name: 'ruflo-rvf-search-recipe', version: '1.0.0' });
const server = fileURLToPath(new URL('./node_modules/@ruvector/rvf-mcp-server/dist/cli.js', import.meta.url));
const transport = new StdioClientTransport({
command: process.execPath, args: [server, '--transport', 'stdio', '--data-dir', dir],
stderr: 'ignore',
});
const call = (name, args) => client.callTool({ name, arguments: args }, undefined, { timeout: 5000 });
function data(result) {
assert.notEqual(result.isError, true, JSON.stringify(result.content));
return result.structuredContent ?? JSON.parse(result.content[0].text);
}
try {
const db = await RvfDatabase.create(file, { dimensions: 3, metric: 'l2' }, 'node');
try {
await db.ingestBatch([
{ id: '1', vector: new Float32Array([1, 0, 0]) },
{ id: '2', vector: new Float32Array([0, 1, 0]) },
{ id: '3', vector: new Float32Array([0, 0, 1]) },
]);
} finally {
await db.close();
}
const before = await sha256();
await client.connect(transport, { timeout: 5000 });
const opened = data(await call('rvf_open_store', { path: 'demo.rvf', readOnly: true }));
assert.equal(opened.readOnly, true);
const { storeId } = opened;
const search = data(await call('rvf_query', { storeId, vector: [1, 0, 0], k: 1 }));
assert.equal(search.results.length, 1);
assert.equal(String(search.results[0].id), '1');
const write = await call('rvf_ingest', { storeId, entries: [{ id: '4', vector: [1, 0, 0] }] });
assert.match(write.content[0]?.text ?? '', /^Error: store is read-only$/);
const escaped = await call('rvf_open_store', { path: '../outside.rvf', readOnly: true });
assert.match(escaped.content[0]?.text ?? '', /^Error: store path must not contain/);
data(await call('rvf_close_store', { storeId }));
assert.equal(await sha256(), before, 'read-only queries must not change the RVF');
console.log('Nearest vector: 1; read-only write rejected; traversal rejected; RVF unchanged.');
} finally {
try {
await client.close();
} finally {
await rm(dir, { recursive: true, force: true });
}
}
+7 -4
View File
@@ -13,9 +13,9 @@
"bin": {
"claude-flow": "bin/cli.js"
},
"homepage": "https://github.com/ruvnet/claude-flow#readme",
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues",
"url": "https://github.com/ruvnet/ruflo/issues",
"email": "support@ruv.io"
},
"funding": {
@@ -175,7 +175,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/ruvnet/claude-flow.git"
"url": "git+https://github.com/ruvnet/ruflo.git"
},
"keywords": [
"ruvflow",
@@ -210,7 +210,10 @@
"hive-mind",
"distributed-systems",
"consensus",
"self-learning"
"self-learning",
"local-vector-search",
"rvf",
"mcp-server"
],
"author": "RuvNet <ruv@ruv.io> (https://ruv.io)",
"license": "MIT",
@@ -1,7 +1,7 @@
{
"name": "ruflo-console",
"description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings \u2192 Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.",
"version": "0.50.1",
"version": "0.50.2",
"repository": "https://github.com/ruvnet/ruflo",
"author": {
"name": "ruvnet",
+3
View File
@@ -2,6 +2,9 @@
Newest first. One `## <version> — <date>` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; older versions: `git log -- plugins/ruflo-console`.
## 0.50.2 — 2026-11-17
- fix: the POSIX append script (`dd … >> "$1"`) now passes `conv=notrunc`. uutils dd, the default coreutils on Ubuntu 26.04, truncates its stdout to its own offset after writing (`lseek` then `ftruncate`), so concurrent appenders lost whole batches; with the flag, eight writers keep all 2400 lines. Linux still runs the GNU argv; this script is the macOS/BSD path, and `conv=notrunc` is POSIX dd (#4978)
## 0.50.1 — 2026-11-09
- chore: the command catalog (`catalog/command-catalog.json`) is regenerated from the CLI's `catalog.generated.json`. It picks up the three init commands renamed so they no longer collide with plugin commands (`/memory-neural`, `/stream-chain-run`, `/swarm-orchestrate`, #2640) and the mod registrations and plugins added since the last regeneration
@@ -95,9 +95,11 @@ const MKDIR = 'mkdir -p -- "$(dirname -- "$1")" || exit 1;'
/**
* The whole set of POSIX write scripts. umask 022 makes a created file 0644 (as `install -m 0644`); the touch uses 077 and chmod 600.
* `set -C` (noclobber) makes the shell open with O_CREAT|O_EXCL, so an exclusive create fails on a file that is already there.
* The append needs `conv=notrunc`: uutils dd (the default coreutils on Ubuntu 26.04) truncates its stdout to its own offset after
* writing (`lseek(1, 0, SEEK_CUR)` then `ftruncate`), which cuts off every batch another writer appended in between (#4978).
*/
export const POSIX_SCRIPTS = Object.freeze({
append: `umask 022; ${GUARD} exec dd bs=1M iflag=fullblock status=none >> "$1"`,
append: `umask 022; ${GUARD} exec dd bs=1M iflag=fullblock conv=notrunc status=none >> "$1"`,
createExclusive: `umask 022; ${GUARD} set -C; exec cat > "$1"`,
createExclusiveWithDirs: `umask 022; ${MKDIR} ${GUARD} set -C; exec cat > "$1"`,
replace: `umask 022; ${GUARD} exec cat > "$1"`,
+1 -1
View File
@@ -2,4 +2,4 @@
* The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest
* (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift.
*/
export const CONSOLE_VERSION = '0.50.1'
export const CONSOLE_VERSION = '0.50.2'
+2 -2
View File
@@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; }
ok() { printf "PASS\n"; PASS=$((PASS+1)); }
bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
step "1. plugin.json declares ruflo-console 0.50.1"
step "1. plugin.json declares ruflo-console 0.50.2"
grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \
&& grep -q '"version": "0.50.1"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
&& grep -q '"version": "0.50.2"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
step "2. hooks.json names exactly one module and no classic hook commands"
grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \
@@ -74,7 +74,8 @@ describe('the argv that shipped before is unchanged', () => {
it('whole-set digests of the GNU and the BSD argv (taken before this change)', () => {
expect(digest('gnu')).toBe('cfd9124d0ee8208f81f0c8dc87ccdc9505b17d632267f9b8a942a6ae987094ad')
expect(digest('posix')).toBe('4c60ee6b0510418188772bc443afc9b8744a46d18e6b07c82837f8960a4e1160')
// Re-pinned on purpose for #4978: the POSIX append gained `conv=notrunc` (uutils dd truncates its stdout after writing). GNU is unchanged.
expect(digest('posix')).toBe('fe9db855288c1dfa7fa87d443bb42062c75b9e82cc7c53a9ab55ea3aec8784d1')
})
it('writeVia on gnu and posix is the same host.run call as before (argv, timeout, stdin)', async () => {
@@ -1,7 +1,7 @@
{
"name": "ruflo-graph-intelligence",
"description": "RuFlo Graph Intelligence Engine — real-time relationship intelligence with complexity-aware execution. Single-entry personalized PageRank, streaming delta updates, witness-signed reasoning artifacts, federation-distributable PR vectors. Declares the zero-dependency @ruvnet/sublinear-core as its solver; ships a sublinear-core skill for PPR, local push and sparse solves.",
"version": "0.3.1",
"version": "0.3.2",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
@@ -2,6 +2,9 @@
Newest first. One `## <version> — <date>` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; this is the whole history.
## 0.3.2 — 2026-11-17
- chore: `@ruvnet/sublinear-core` 1.0.0 → 1.0.1 (#5006)
## 0.3.1 — 2026-11-10
- chore: first stable version. The npm manifest gains a canonical repository, homepage and bug-tracker link, and a shorter description. No code changes
+4 -4
View File
@@ -9,7 +9,7 @@
"version": "0.1.0-alpha.1",
"license": "MIT",
"dependencies": {
"@ruvnet/sublinear-core": "^1.0.0",
"@ruvnet/sublinear-core": "^1.0.1",
"zod": "^4.6.7"
},
"devDependencies": {
@@ -304,9 +304,9 @@
"license": "MIT"
},
"node_modules/@ruvnet/sublinear-core": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@ruvnet/sublinear-core/-/sublinear-core-1.0.0.tgz",
"integrity": "sha512-AfcOehcQe7GXc7wRMUAMqp7DgKXTjAUl7Gj9tmRpmMuvOHo/tap/2RP0OjpjZXsr5jMNySEFHn0yFpxGq47B6w==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@ruvnet/sublinear-core/-/sublinear-core-1.0.1.tgz",
"integrity": "sha512-3QkspuVBijsNA+F2ZY+Z8Goq5uNfd26MW0QHpRx1LdOAMvyq7SZja1Jw6SdAohwve/9OcaXiou2x9vw2R+dY6Q==",
"license": "MIT OR Apache-2.0",
"engines": {
"node": ">=16"
@@ -28,7 +28,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@ruvnet/sublinear-core": "^1.0.0",
"@ruvnet/sublinear-core": "^1.0.1",
"zod": "^4.6.7"
},
"overrides": {
+5
View File
@@ -52,6 +52,11 @@ User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Prov
## Quick Start
<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 portable RVF index locally through stdio MCP"></a>
[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)
There are **two different install paths** with very different surface areas. Pick based on what you need (#1744):
| | **Claude Code Plugin** | **CLI install (`npx ruflo init`)** |
+8 -4
View File
@@ -8,9 +8,9 @@
"bin": {
"ruflo": "bin/ruflo.js"
},
"homepage": "https://github.com/ruvnet/claude-flow#readme",
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues",
"url": "https://github.com/ruvnet/ruflo/issues",
"email": "support@ruv.io"
},
"funding": {
@@ -83,7 +83,8 @@
},
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git"
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "ruflo"
},
"keywords": [
"ruflo",
@@ -102,7 +103,10 @@
"cli",
"developer-tools",
"enterprise",
"self-learning"
"self-learning",
"local-vector-search",
"rvf",
"mcp-server"
],
"author": {
"name": "RuvNet",
+118 -6
View File
@@ -10,7 +10,7 @@
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"agent-browser": "^0.41.0",
"agent-browser": "^0.43.0",
"agentic-flow": "^2.0.14",
"zod": "^4.6.7"
},
@@ -26,6 +26,110 @@
"@claude-flow/cli": ">=3.5.0"
}
},
"node_modules/@agent-browser/cli-darwin-arm64": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/@agent-browser/cli-darwin-arm64/-/cli-darwin-arm64-0.43.0.tgz",
"integrity": "sha512-HV6GP59IjNnowlrXR/5rVM8msPWwQDEONt/tWC8STzUfKZQHKZI/Iv9sf2h2ZhwK8xwoqLhxpf+KxcFgJ0sExQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@agent-browser/cli-darwin-x64": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/@agent-browser/cli-darwin-x64/-/cli-darwin-x64-0.43.0.tgz",
"integrity": "sha512-3NKnKFOWLYDYTz4bJxo4jt+GwjM4VtcW5FDrQY35eUrytig65FEDdXmXKuRbZGq9jEEWxh6rmpS4R6xS53XCaw==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@agent-browser/cli-linux-arm64-gnu": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-0.43.0.tgz",
"integrity": "sha512-8DC234LGlXCn8A2YXGk6woy1uTjyexvtHd/TOQHLrV2sfUMZD647HTHEJyF+2z1J1oR34LaB5jqHJ9d0REC+Cw==",
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@agent-browser/cli-linux-arm64-musl": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-arm64-musl/-/cli-linux-arm64-musl-0.43.0.tgz",
"integrity": "sha512-/dYeGX2E1lWZ25q1IZSVs6PaPmr0GmhHU8z/LtCh0anHN4ND50i5fOPbysRBaE8iQCBY74h+1R2kePfEqD7X4Q==",
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@agent-browser/cli-linux-x64-gnu": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-x64-gnu/-/cli-linux-x64-gnu-0.43.0.tgz",
"integrity": "sha512-WY8vy2Saa3oRt6XEmz4Sae1W5qS9TjYcbX6IE+dxb8s2APfL9XyQjMHC6jBZrhwqDBIvUeTMCT/P2cq3XLPSBw==",
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@agent-browser/cli-linux-x64-musl": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-x64-musl/-/cli-linux-x64-musl-0.43.0.tgz",
"integrity": "sha512-WpCI0cIaVIVj4trdduDmW90h51BAP5Nhx6lALOqHjUhOOae/TkLL4bK8gJfjPb/nOp2FRjsF1l77f6rVwkpsug==",
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@agent-browser/cli-win32-x64-msvc": {
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/@agent-browser/cli-win32-x64-msvc/-/cli-win32-x64-msvc-0.43.0.tgz",
"integrity": "sha512-xhk8wnHk3aiBFSR0pd1Ye3ay2jKjgRardgBJLiB9nXJv0ZkbeP/wh3X7jMiKUfUGE1qqJrKdaM5szQ6iz8/8+w==",
"cpu": [
"x64",
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@ai-sdk/google": {
"version": "3.0.82",
"resolved": "https://registry.npmjs.org/@ai-sdk/google/-/google-3.0.82.tgz",
@@ -5337,17 +5441,25 @@
}
},
"node_modules/agent-browser": {
"version": "0.41.2",
"resolved": "https://registry.npmjs.org/agent-browser/-/agent-browser-0.41.2.tgz",
"integrity": "sha512-/agCKB5rw1EEK8SKWo4zid7a5kOwlclqALC0P3c69buJvKdhrl/dJkKdfLqGGaiNIbWzRdqqT0PxZVkwVEf2fg==",
"version": "0.43.0",
"resolved": "https://registry.npmjs.org/agent-browser/-/agent-browser-0.43.0.tgz",
"integrity": "sha512-TExwnZAW39fUBDJhUPrw8KKGmcjzBo7FxNqoP2/usHG1ODsjGI2jAWq3+Q6I5JYyBMjePFEsj8KGB68mALtglA==",
"hasInstallScript": true,
"license": "Apache-2.0",
"bin": {
"agent-browser": "bin/agent-browser.js"
},
"engines": {
"node": ">=24.0.0",
"pnpm": ">=11.0.0"
"node": ">=22.0.0"
},
"optionalDependencies": {
"@agent-browser/cli-darwin-arm64": "0.43.0",
"@agent-browser/cli-darwin-x64": "0.43.0",
"@agent-browser/cli-linux-arm64-gnu": "0.43.0",
"@agent-browser/cli-linux-arm64-musl": "0.43.0",
"@agent-browser/cli-linux-x64-gnu": "0.43.0",
"@agent-browser/cli-linux-x64-musl": "0.43.0",
"@agent-browser/cli-win32-x64-msvc": "0.43.0"
}
},
"node_modules/agentic-flow": {
+2 -1
View File
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/browser",
"version": "3.0.1",
"description": "Browser automation for AI agents - integrates agent-browser with claude-flow swarms",
@@ -26,7 +27,7 @@
"postinstall": "node -e \"const{execSync}=require('child_process');const v=require('./package.json').dependencies['agent-browser'];try{execSync('agent-browser --version',{stdio:'ignore'});}catch{console.log('\\n📦 Installing agent-browser globally...');try{execSync('npm install -g agent-browser@'+v,{stdio:'inherit'});console.log('✅ agent-browser installed successfully!');}catch(e){console.log('⚠️ Could not install agent-browser globally. Run manually:\\n npm install -g agent-browser@'+v);}}\""
},
"dependencies": {
"agent-browser": "^0.41.0",
"agent-browser": "^0.43.0",
"agentic-flow": "^2.0.14",
"zod": "^4.6.7"
},
+5
View File
@@ -52,6 +52,11 @@ User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Prov
## Quick Start
<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 portable RVF index locally through stdio MCP"></a>
[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)
There are **two different install paths** with very different surface areas. Pick based on what you need (#1744):
| | **Claude Code Plugin** | **CLI install (`npx ruflo init`)** |
@@ -0,0 +1,119 @@
/** #4739: metadata writes must publish a complete image and report failures. */
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import * as fs from 'node:fs';
import { tmpdir } from 'node:os';
import { basename, join } from 'node:path';
const state = vi.hoisted(() => ({
failure: undefined as unknown,
swaps: [] as Array<{ previous: string; next: string }>,
}));
// Only the vector engine is stubbed; persistence uses the real atomic helper
// and filesystem, with a failure injected at the final publication boundary.
// vitest.config.ts externalizes @ruvector/*; Vite exposes its dynamic imports
// under /@id/, so mock that external module ID rather than a native addon.
vi.mock('/@id/@ruvector/core', () => ({
default: {
VectorDb: class {
async len() { return 0; }
async insert() {}
},
},
}));
vi.mock('node:fs', async (importOriginal) => {
const actual = await importOriginal<typeof import('node:fs')>();
return {
...actual,
renameSync: vi.fn((from: string, to: string) => {
if (basename(to) === 'hnsw.metadata.json') {
state.swaps.push({
previous: actual.readFileSync(to, 'utf8'),
next: actual.readFileSync(from, 'utf8'),
});
if (state.failure !== undefined) throw state.failure;
}
actual.renameSync(from, to);
}),
};
});
import * as memory from '../src/memory/memory-initializer.js';
describe('HNSW metadata persistence (#4739)', () => {
let root: string;
let metadataPath: string;
const entry = { id: 'vector-1', key: 'policy', namespace: 'patterns', content: 'memory 世界 🌱' };
const previous = '[]\n' + ' '.repeat(64);
beforeEach(() => {
root = fs.mkdtempSync(join(tmpdir(), 'ruflo-hnsw-4739-'));
metadataPath = join(root, 'hnsw.metadata.json');
fs.writeFileSync(metadataPath, previous);
vi.stubEnv('CLAUDE_FLOW_MEMORY_PATH', root);
vi.stubEnv('CLAUDE_FLOW_DISABLE_BRIDGE', '1');
vi.spyOn(console, 'warn').mockImplementation(() => {});
memory.clearHNSWIndex();
memory._resetMemoryRootCache();
state.failure = undefined;
state.swaps = [];
});
afterEach(() => {
memory.clearHNSWIndex();
memory._resetMemoryRootCache();
vi.restoreAllMocks();
vi.unstubAllEnvs();
fs.rmSync(root, { recursive: true, force: true });
});
it('atomically replaces the old image with complete UTF-8 metadata that reloads', async () => {
expect(await memory.addToHNSWIndex(entry.id, [1, 0, 0], entry)).toBe(true);
const serialized = JSON.stringify([[entry.id, entry]]);
expect(fs.readFileSync(metadataPath, 'utf8')).toBe(serialized);
// Before rename, readers still see the old complete image while the new
// complete image is in a separate sibling file.
expect(state.swaps).toEqual([{ previous, next: serialized }]);
expect(fs.readdirSync(root)).toEqual(['hnsw.metadata.json']);
if (process.platform !== 'win32') {
expect(fs.statSync(metadataPath).mode & 0o777).toBe(0o600);
}
expect(console.warn).not.toHaveBeenCalled();
memory.clearHNSWIndex();
const reloaded = await memory.getHNSWIndex({ dimensions: 3 });
expect(reloaded?.entries.get(entry.id)).toEqual(entry);
});
it.each([
new Error('ENOSPC: no space left on device'),
'EACCES: permission denied',
])('reports a failed atomic swap and preserves the previous image (%s)', async (failure) => {
state.failure = failure;
// Metadata is best-effort: the vector insertion still succeeds in memory.
expect(await memory.addToHNSWIndex(entry.id, [1, 0, 0], entry)).toBe(true);
expect(console.warn).toHaveBeenCalledWith(
'[memory] Failed to save hnsw.metadata.json:',
failure instanceof Error ? failure.message : String(failure),
);
expect(state.swaps).toHaveLength(1);
expect(fs.readFileSync(metadataPath, 'utf8')).toBe(previous);
expect(fs.readdirSync(root)).toEqual(['hnsw.metadata.json']);
expect((await memory.getHNSWIndex())?.entries.get(entry.id)).toEqual(entry);
});
it('reports a missing parent directory without throwing or recreating it', async () => {
expect(await memory.getHNSWIndex({ dimensions: 3 })).not.toBeNull();
fs.rmSync(root, { recursive: true });
expect(await memory.addToHNSWIndex(entry.id, [1, 0, 0], entry)).toBe(true);
expect(console.warn).toHaveBeenCalledWith(
'[memory] Failed to save hnsw.metadata.json:',
expect.stringContaining('ENOENT'),
);
expect(fs.existsSync(root)).toBe(false);
});
});
@@ -0,0 +1,91 @@
/**
* session_import and workflow_validate read a caller-named file. Over MCP the
* path must stay inside the project (as memory_import already does), and a
* parse failure must not echo the file's contents back to the caller.
*/
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
const state = vi.hoisted(() => ({ cwd: '' }));
vi.mock('../src/mcp-tools/types.js', () => ({ getProjectCwd: () => state.cwd }));
vi.mock('../src/mcp-tools/agent-execute-core.js', () => ({ executeAgentTask: vi.fn() }));
import { sessionTools } from '../src/mcp-tools/session-tools.js';
import { workflowTools } from '../src/mcp-tools/workflow-tools.js';
import { localCliContext } from '../src/mcp-tools/path-containment.js';
const CANARY = 'CANARY-7f3a-outside-project';
const tool = (name: string) => [...sessionTools, ...workflowTools].find(t => t.name === name)!;
const run = (name: string, input: Record<string, unknown>, context?: unknown) =>
(tool(name).handler as (i: unknown, c?: unknown) => Promise<any>)(input, context);
const importSession = (inputPath: string, context?: unknown) => run('session_import', { inputPath }, context);
const validateWorkflow = (file: string, context?: unknown) => run('workflow_validate', { file }, context);
let base: string;
let outside: string;
beforeEach(() => {
base = mkdtempSync(join(tmpdir(), 'ruflo-read-containment-'));
state.cwd = join(base, 'project');
mkdirSync(state.cwd);
outside = join(base, 'outside');
mkdirSync(outside);
writeFileSync(join(outside, 'secret.txt'), `${CANARY}\nsecond line`);
writeFileSync(join(outside, 'session.json'), JSON.stringify({ name: 'external' }));
writeFileSync(join(outside, 'workflow.json'), JSON.stringify({ steps: [{ name: CANARY, agent: CANARY }] }));
});
afterEach(() => rmSync(base, { recursive: true, force: true }));
describe('MCP callers cannot read files outside the project', () => {
it.each([
['absolute path', () => join(outside, 'secret.txt')],
['relative traversal', () => '../outside/secret.txt'],
])('session_import refuses an %s without echoing contents', async (_label, path) => {
const result = await importSession(path());
expect(result.error).toMatch(/inside the project directory/);
expect(JSON.stringify(result)).not.toContain('CANARY');
});
it.each(['secret.txt', 'workflow.json'])('workflow_validate refuses outside file %s without echoing contents', async name => {
const result = await validateWorkflow(join(outside, name));
expect(result.valid).toBe(false);
expect(result.errors[0].message).toMatch(/inside the project directory/);
expect(JSON.stringify(result)).not.toContain('CANARY');
});
it('refuses a symlink inside the project that points outside', async () => {
symlinkSync(join(outside, 'secret.txt'), join(state.cwd, 'link.json'));
expect(JSON.stringify(await importSession('link.json'))).not.toContain('CANARY');
expect(JSON.stringify(await validateWorkflow('link.json'))).not.toContain('CANARY');
expect((await importSession('link.json')).error).toMatch(/not a symlink/);
});
it('does not quote file contents in parse errors for files inside the project', async () => {
writeFileSync(join(state.cwd, 'bad.json'), `${CANARY} is not json`);
const imported = await importSession(join(state.cwd, 'bad.json'));
expect(imported.error).toMatch(/invalid session json/i);
expect(JSON.stringify(imported)).not.toContain('CANARY');
const validated = await validateWorkflow(join(state.cwd, 'bad.json'));
expect(validated.errors[0].message).toMatch(/not valid JSON/);
expect(JSON.stringify(validated)).not.toContain('CANARY');
});
it('still reads valid files inside the project', async () => {
writeFileSync(join(state.cwd, 'session.json'), JSON.stringify({ name: 'inside' }));
expect(await importSession('session.json')).toMatchObject({ name: 'inside' });
writeFileSync(join(state.cwd, 'workflow.json'), JSON.stringify({ steps: [{ name: 's', agent: 'coder' }] }));
expect(await validateWorkflow('workflow.json')).toMatchObject({ valid: true, stats: { stages: 1, agents: 1 } });
});
});
describe('the local CLI may still name files outside the project', () => {
it('session import and workflow validate accept an operator-chosen path', async () => {
expect(await importSession(join(outside, 'session.json'), localCliContext())).toMatchObject({ name: 'external' });
expect(await validateWorkflow(join(outside, 'workflow.json'), localCliContext())).toMatchObject({ valid: true });
});
it('reports a missing file plainly', async () => {
expect((await importSession(join(outside, 'nope.json'), localCliContext())).error).toMatch(/File not found/);
});
});
@@ -0,0 +1,27 @@
/**
* #4994: `init --dry-run` used to be honoured only by --grok; every other mode
* ignored it and ran a real init (project scaffold, $HOME/.codex, mods enable).
* It must now write nothing and say so.
*/
import { describe, it, expect } from 'vitest';
import { mkdtempSync, readdirSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { initCommand } from '../src/commands/init.js';
describe('init --dry-run (#4994)', () => {
for (const flags of [{}, { codex: true }, { dual: true }]) {
it(`writes nothing with ${JSON.stringify(flags)}`, async () => {
const cwd = mkdtempSync(join(tmpdir(), 'ruflo-dry-'));
try {
const result = await initCommand.action!({
args: [], cwd, interactive: false, flags: { ...flags, 'dry-run': true, dryRun: true },
} as never);
expect(result?.success).toBe(true);
expect(readdirSync(cwd)).toEqual([]);
} finally {
rmSync(cwd, { recursive: true, force: true });
}
});
}
});
@@ -0,0 +1,161 @@
/**
* Regression coverage for issue #2909: `hooks statusline --json` interleaved
* diagnostics with its payload on **stdout**, so callers doing
* `JSON.parse(stdout)` failed with `Unexpected token 'W', "[WARN] Fail"...`.
* ruflo's own V3 statusline helper parses this command's stdout and calls it
* the single source of truth, so a polluted line silently demoted it to the
* local file probes that #2195 existed to remove.
*
* Current source routes every diagnostic to stderr (`OutputFormatter.printInfo`
* / `printWarning` → `writeErrorln`), so this is a regression guard, not a
* reproduction. `output.test.ts` already asserts that routing at the unit level
* by spying on the streams; the gap this closes is end-to-end, on a real
* process, where anything else writing to stdout also counts.
*
* Two conditions have to be forced, and both are easy to get wrong:
*
* 1. **A daemon must actually start.** `daemon-autostart.ts` gates on
* `isRufloProject()`, so a bare `mkdtemp` directory yields
* `{ started: false, reason: 'not a ruflo project' }` and never emits the
* `[INFO] Started Ruflo background daemon` line at all. Each case plants a
* `.claude-flow/config.json` marker so autostart is genuinely exercised.
* 2. **The directory must be cold.** Autostart is single-instance per cwd, so
* a reused directory returns clean JSON regardless of routing. Each case
* gets its own directory.
*
* The notice is also a race against daemon readiness rather than a
* deterministic "first call only" event, so the cold case asserts across three
* sequential invocations; correct routing passes all three every time.
*
* The CLI is spawned as a real subprocess because the routing under test is a
* property of the process's streams, not of any exported function.
*/
import { describe, it, expect, afterAll } from 'vitest';
import { execFileSync } from 'node:child_process';
import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const CLI = path.resolve(HERE, '..', 'bin', 'cli.js');
// `bin/cli.js` is tracked, so its presence proves nothing; the build artifact it
// imports is the gitignored one. Standard flow is `npm run build && npm test`.
const CLI_BUILT = fs.existsSync(path.resolve(HERE, '..', 'dist', 'src', 'index.js'));
/** Any OutputFormatter level prefix. None of them belongs on stdout. */
const DIAGNOSTIC_MARKER = /\[(?:WARN|INFO|ERROR|DEBUG|TRACE)\]/;
const tempDirs: string[] = [];
/**
* A directory that (a) no daemon has claimed yet and (b) autostart recognises
* as a ruflo project, so the run is genuinely cold rather than skipped.
*
* `realpathSync` matters: on macOS `os.tmpdir()` reports `/var/folders/...`, a
* symlink to `/private/var/folders/...`, and the daemon keys its lock on the
* resolved cwd. Resolving up front keeps "fresh directory" and "cold daemon"
* the same statement on every platform.
*/
function freshRufloCwd(): string {
const dir = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'ruflo-2909-'));
tempDirs.push(dir);
fs.mkdirSync(path.join(dir, '.claude-flow'), { recursive: true });
fs.writeFileSync(path.join(dir, '.claude-flow', 'config.json'), '{}', 'utf8');
return dir;
}
function statuslineStdout(cwd: string): string {
return execFileSync('node', [CLI, 'hooks', 'statusline', '--json'], {
cwd,
input: JSON.stringify({ model: { display_name: 'Sonnet 4.6 (1M context)' } }),
encoding: 'utf8',
// stderr is piped, not inherited: diagnostics legitimately belong there, so
// capturing them keeps a passing run quiet while still failing this test on
// anything that reaches stdout.
stdio: ['pipe', 'pipe', 'pipe'],
env: {
...process.env,
// Keep the run off the developer's real install: helper auto-refresh
// writes to ~/.claude/helpers and funnel state to ~/.ruflo.
HOME: cwd,
USERPROFILE: cwd,
RUFLO_STATE_DIR: path.join(cwd, '.ruflo-state'),
// `checkForUpdatesOnStartup` is fire-and-forget, network-bound, and writes
// to stdout via `writeln` with no level prefix — a genuine flake source
// that the regex would miss and the raw parse would catch at random.
CLAUDE_FLOW_AUTO_UPDATE: 'false',
CI: 'true',
},
timeout: 60_000,
});
}
function assertStdoutIsOnlyJson(raw: string, label: string): void {
// Parsed whole, deliberately without an `indexOf('{')` slice: the contract is
// that stdout *is* the JSON document, not that a JSON document can be
// recovered from somewhere inside it. Slicing — as a sibling statusline test
// does — passes on the build that prompted this issue.
expect(() => JSON.parse(raw), `${label}: stdout was not JSON: ${raw.slice(0, 160)}`).not.toThrow();
expect(raw, `${label}: stdout carried a diagnostic`).not.toMatch(DIAGNOSTIC_MARKER);
}
// Explicit hook timeout: every case leaves a real detached daemon behind, and
// stopping them exceeds vitest's 10s hook default.
afterAll(() => {
for (const dir of tempDirs) {
// Stop before removing: the daemon holds its cwd, so on Windows `rmSync`
// first can fail outright. Defaults are a 12h hard TTL / 30m idle, so
// leaving them would hold one process per case for that window.
try {
execFileSync('node', [CLI, 'daemon', 'stop'], {
cwd: dir,
stdio: 'ignore',
timeout: 20_000,
});
} catch {
/* already gone, or never started */
}
try {
// Retries because a stopping daemon can still hold the directory for a
// moment on Windows (EPERM/EBUSY). Swallowed entirely: a leftover temp
// directory is inconsequential, and cleanup must never turn a suite whose
// assertions passed into a red one.
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
} catch {
/* the OS temp sweeper can have it */
}
}
}, 120_000);
describe.skipIf(!CLI_BUILT)('hooks statusline --json keeps stdout parseable — issue #2909', () => {
it(
'emits only JSON on stdout while the daemon autostarts',
() => {
const dir = freshRufloCwd();
for (let call = 1; call <= 3; call++) {
assertStdoutIsOnlyJson(statuslineStdout(dir), `call ${call}`);
}
},
120_000
);
it(
'emits only JSON on stdout when the config in cwd is malformed',
() => {
const dir = freshRufloCwd();
// Triggers the `Failed to load config from ...` warning pushed in
// shared/src/core/config/loader.ts — the diagnostic the reporter actually
// saw on stdout. A malformed config does not disable autostart: the
// parse error is caught and autostart fails open.
fs.writeFileSync(
path.join(dir, 'claude-flow.config.json'),
'{ "features": [ this is not valid json',
'utf8'
);
assertStdoutIsOnlyJson(statuslineStdout(dir), 'malformed config');
},
120_000
);
});
@@ -0,0 +1,46 @@
/**
* #4959: v3/@claude-flow/watermark is a stale 0.2.0 duplicate. The published
* npm package (0.4.x) and crate (0.3.x) are built from ruvnet/ai-text-watermark.
*
* A recursive publish from ruflo would otherwise ship the stale copy on top of
* the canonical release. Keep every publish path closed and keep the README
* pointing at the canonical source.
*/
import { describe, it, expect } from 'vitest'
import { readFileSync } from 'node:fs'
import { join, resolve } from 'node:path'
const REPO = resolve(__dirname, '../../../..')
const PACKAGE_JSON = 'v3/@claude-flow/watermark/package.json'
const CARGO_TOML = 'v3/crates/ruflo-watermark/Cargo.toml'
const README = 'v3/@claude-flow/watermark/README.md'
const CANONICAL =
'https://github.com/ruvnet/ai-text-watermark/tree/main/packages/watermark'
const read = (relativePath: string) => readFileSync(join(REPO, relativePath), 'utf8')
describe('@claude-flow/watermark non-canonical mirror (#4959)', () => {
it('keeps the npm package private and free of publishConfig', () => {
const pkg = JSON.parse(read(PACKAGE_JSON))
expect(pkg.name).toBe('@claude-flow/watermark')
expect(pkg.private).toBe(true)
expect(pkg.publishConfig).toBeUndefined()
})
it('keeps the Rust crate out of cargo publish', () => {
const lines = read(CARGO_TOML).split(/\r?\n/)
const start = lines.findIndex((line) => line.trim() === '[package]')
expect(start).toBeGreaterThanOrEqual(0)
const nextTable = lines.findIndex(
(line, index) => index > start && /^\s*\[/.test(line),
)
const packageTable = lines.slice(start + 1, nextTable === -1 ? undefined : nextTable)
expect(packageTable.some((line) => /^\s*publish\s*=\s*false\s*(?:#.*)?$/.test(line))).toBe(true)
})
it('points readers at the canonical source instead of documenting the stale API', () => {
const readme = read(README)
expect(readme).toContain(CANONICAL)
expect(readme).toMatch(/not\s+the\s+source|non-canonical|stale/i)
})
})
+7 -4
View File
@@ -11,13 +11,13 @@
"claude-flow": "bin/cli.js",
"claude-flow-mcp": "bin/mcp-server.js"
},
"homepage": "https://github.com/ruvnet/claude-flow#readme",
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues"
"url": "https://github.com/ruvnet/ruflo/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/@claude-flow/cli"
},
"keywords": [
@@ -38,7 +38,10 @@
"vector-database",
"embeddings",
"self-learning",
"enterprise"
"enterprise",
"local-vector-search",
"rvf",
"mcp-server"
],
"author": "RuvNet <ruv@ruv.io> (https://ruv.io)",
"license": "MIT",
+9 -1
View File
@@ -1163,6 +1163,14 @@ const initAction = async (ctx: CommandContext): Promise<CommandResult> => {
});
}
// #4994 — only the Grok path implements a preview. For every other mode
// --dry-run used to be silently ignored and a real init ran (project scaffold,
// $HOME/.codex, mods enable). Refuse to write anything instead.
if (ctx.flags.dryRun === true || ctx.flags['dry-run'] === true) {
output.printWarning('--dry-run: nothing was written. A file preview is only available with --grok; remove --dry-run to run init.');
return { success: true, data: { dryRun: true, written: [] } };
}
if (codexMode && !dualMode) {
return initCodexAction(ctx, { codexMode, dualMode: false, force, minimal, full });
}
@@ -2054,7 +2062,7 @@ export const initCommand: Command = {
},
{
name: 'dry-run',
description: 'With --grok: list the files init would write, write nothing',
description: 'List the files init would write (--grok); for other modes write nothing and exit',
type: 'boolean',
default: false,
},
+2 -1
View File
@@ -7,6 +7,7 @@ import type { Command, CommandContext, CommandResult } from '../types.js';
import { output } from '../output.js';
import { confirm, input, select } from '../prompt.js';
import { callMCPTool, MCPClientError } from '../mcp-client.js';
import { localCliContext } from '../mcp-tools/path-containment.js';
import * as fs from 'fs';
import * as path from 'path';
import { stringify as stringifyYaml } from 'yaml';
@@ -809,7 +810,7 @@ const importCommand: Command = {
inputPath: absolutePath,
name: sessionName,
activate
});
}, localCliContext());
const failure = toolError(result);
if (failure) {
+2 -1
View File
@@ -7,6 +7,7 @@ import type { Command, CommandContext, CommandResult } from '../types.js';
import { output } from '../output.js';
import { select, confirm, input } from '../prompt.js';
import { callMCPTool, MCPClientError } from '../mcp-client.js';
import { localCliContext } from '../mcp-tools/path-containment.js';
// Workflow templates
const WORKFLOW_TEMPLATES = [
@@ -250,7 +251,7 @@ const validateCommand: Command = {
}>('workflow_validate', {
file,
strict,
});
}, localCliContext());
if (ctx.flags.format === 'json') {
output.printJson(result);
@@ -9,7 +9,7 @@ import { randomUUID } from 'node:crypto';
import { gunzipSync } from 'node:zlib';
import { join } from 'node:path';
import { type MCPTool, getProjectCwd } from './types.js';
import { containedWritePath } from './path-containment.js';
import { containedReadPath, containedWritePath, isLocalCliCall } from './path-containment.js';
import { MAX_IMPORT_BYTES, readImportFile } from './import-limits.js';
import {
mkdirRestricted,
@@ -806,21 +806,31 @@ export const sessionTools: MCPTool[] = [
activate: { type: 'boolean', description: 'Restore the imported session into the active stores' },
},
},
handler: async (input) => {
handler: async (input, context) => {
let parsed: unknown;
if (input.data !== undefined && input.data !== null) {
parsed = input.data;
} else {
const inputPath = String(input.inputPath ?? '');
if (!inputPath) return { error: 'Provide inputPath (a session JSON file) or data (a session record)' };
if (!existsSync(inputPath)) return { error: `File not found: ${inputPath}` };
const requestedPath = String(input.inputPath ?? '');
if (!requestedPath) return { error: 'Provide inputPath (a session JSON file) or data (a session record)' };
// MCP callers may only read regular files inside the project, matching
// memory_import; the local CLI may name any file the operator chooses.
const local = isLocalCliCall(context);
const inputPath = local ? (existsSync(requestedPath) ? requestedPath : null) : containedReadPath(requestedPath);
if (!inputPath) {
return { error: local ? `File not found: ${requestedPath}`
: 'inputPath must be an existing regular file inside the project directory (not a symlink)' };
}
try {
const bytes = readImportFile(inputPath);
const content = bytes[0] === 0x1f && bytes[1] === 0x8b
? gunzipSync(bytes, { maxOutputLength: MAX_IMPORT_BYTES }) : bytes;
parsed = JSON.parse(content.toString('utf-8'));
}
catch (e) { return { error: `Invalid session JSON: ${(e as Error).message}` }; }
catch (e) {
// Never echo parser text: a SyntaxError message quotes the file's contents.
return { error: e instanceof SyntaxError ? 'Invalid session JSON (parse failed)' : `Invalid session JSON: ${(e as Error).message}` };
}
}
const validationError = validateImportedSession(parsed);
if (validationError) return { error: validationError };
@@ -4,13 +4,15 @@
* Tool definitions for workflow automation and orchestration.
*/
import { existsSync, readFileSync } from 'node:fs';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { type MCPTool, getProjectCwd } from './types.js';
import { validateIdentifier, validatePath, validateText } from './validate-input.js';
import { executeAgentTask } from './agent-execute-core.js';
import { readPreservedJsonStore } from './record-store.js';
import { type StoreUpdate, saved, unchanged, updateJsonStore } from './locked-json-store.js';
import { containedReadPath, isLocalCliCall } from './path-containment.js';
import { readImportFile } from './import-limits.js';
// Storage paths
const STORAGE_DIR = '.claude-flow';
@@ -1059,17 +1061,22 @@ export const workflowTools: MCPTool[] = [
},
required: ['file'],
},
handler: async (input) => {
handler: async (input, context) => {
const file = String(input.file ?? '');
const errors: Array<{ line: number; message: string; severity: string }> = [];
const warnings: Array<{ line: number; message: string }> = [];
let stages = 0;
let agents = 0;
try {
if (!file || !existsSync(file)) {
errors.push({ line: 0, message: `File not found: ${file || '(empty)'}`, severity: 'error' });
// MCP callers may only read regular files inside the project, matching
// memory_import; the local CLI may name any file the operator chooses.
const local = isLocalCliCall(context);
const resolved = !file ? null : local ? (existsSync(file) ? file : null) : containedReadPath(file);
if (!resolved) {
errors.push({ line: 0, message: !file || local ? `File not found: ${file || '(empty)'}`
: 'file must be an existing regular file inside the project directory (not a symlink)', severity: 'error' });
} else {
const raw = readFileSync(file, 'utf-8');
const raw = readImportFile(resolved).toString('utf-8');
let doc: unknown = null;
if (/\.ya?ml$/i.test(file)) {
warnings.push({ line: 0, message: 'YAML workflow files are not schema-validated yet — only JSON is fully checked (#1916 follow-up)' });
@@ -1107,7 +1114,8 @@ export const workflowTools: MCPTool[] = [
}
}
} catch (e) {
errors.push({ line: 0, message: `Parse error: ${(e as Error).message}`, severity: 'error' });
// Never echo parser text: a SyntaxError message quotes the file's contents.
errors.push({ line: 0, message: e instanceof SyntaxError ? 'Parse error: file is not valid JSON' : `Parse error: ${(e as Error).message}`, severity: 'error' });
}
const valid = errors.length === 0 && (!input.strict || warnings.length === 0);
return {
@@ -795,9 +795,13 @@ function saveHNSWMetadata(): void {
const swarmDir = getMemoryRoot();
const metadataPath = path.join(swarmDir, 'hnsw.metadata.json');
const metadata = Array.from(hnswIndex.entries.entries());
fs.writeFileSync(metadataPath, JSON.stringify(metadata));
} catch {
// Silently fail - metadata save is best-effort
writeFileAtomic(metadataPath, Buffer.from(JSON.stringify(metadata), 'utf-8'));
} catch (error) {
// Metadata is best-effort, but persistence failures must be visible.
console.warn(
'[memory] Failed to save hnsw.metadata.json:',
error instanceof Error ? error.message : String(error),
);
}
}
+1
View File
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/guidance",
"version": "3.0.1",
"description": "Guidance Control Plane - Compiles, retrieves, enforces, and evolves guidance rules for Claude Code sessions",
+1
View File
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/hooks",
"version": "3.0.3",
"description": "V3 Hooks System - Event-driven lifecycle hooks with ReasoningBank learning integration",
+14 -91
View File
@@ -1,97 +1,20 @@
# @claude-flow/watermark
# @claude-flow/watermark (non-canonical mirror)
SynthID-Text-style **LLM text watermarking** (generation + detection) as a
WebAssembly module — no native addon, runs in Node. A watermark rides the
tie-break randomness among *already-plausible* tokens: it never injects an
out-of-distribution word, costs no extra tokens, and is detectable only by a
holder of the secret key. Built for EU AI Act AI-content marking and for
measuring watermark robustness.
This directory is **not** the source of the published
[`@claude-flow/watermark`](https://www.npmjs.com/package/@claude-flow/watermark)
package or the `ruflo-watermark` crate. It is a stale 0.2.0 snapshot kept only
as a workspace reference.
Backed by the Rust crate [`ruflo-watermark`](https://github.com/ruvnet/ruflo/tree/main/v3/crates/ruflo-watermark).
> This package intentionally ships **no watermark-removal / laundering tool**.
> The legitimate way to produce un-marked output of your own model is not to
> apply the mark (or to regenerate) — see the crate's `unmarked.rs`.
## Install
The canonical source, current API, issue tracker and releases live in
[`ruvnet/ai-text-watermark`](https://github.com/ruvnet/ai-text-watermark/tree/main/packages/watermark).
The Rust crate is
[`ai-text-watermark/crates/ruflo-watermark`](https://github.com/ruvnet/ai-text-watermark/tree/main/crates/ruflo-watermark).
```bash
npm install @claude-flow/watermark
npm install @claude-flow/watermark # resolves the canonical 0.4.x package
```
## Use
The module is model-agnostic: at each step you pass the model's candidate token
ids and their probabilities (typically a top-k slice); the watermarker picks
which candidate to emit.
```js
const { Watermarker, detect } = require('@claude-flow/watermark');
const key = '8F3A91C7'; // secret key material (carries no user info)
// Generate a watermarked sequence.
const wm = new Watermarker({ key, scheme: 'gumbel' });
const tokens = Uint32Array.from({ length: 128 }, (_, i) => i);
const probs = new Float32Array(128).fill(1 / 128);
const out = new Uint32Array(600);
for (let i = 0; i < out.length; i++) out[i] = tokens[wm.step(tokens, probs)];
wm.free();
// Detect it.
const r = detect(out, { key, scheme: 'gumbel' });
console.log(r.zScore, r.log10P, r.isWatermarked(1e-6)); // strong, true
```
## Schemes
| `scheme` | Property |
|---|---|
| `gumbel` (default) | Aaronson/Kuditipudi exponential-min — **per-instance distortion-free** (marginal token distribution unchanged). |
| `tournament` | SynthID-Text tournament (Nature 2024) — strong, mildly distortionary; strength grows with `layers`. |
| `tournament_nd` | Tournament with continuous g + masking — **key-averaged non-distortionary** (measured < 0.3% drift). |
## API
- `new Watermarker({ key, scheme?, contextWidth?, layers? })` → `.step(tokens, probs)`, `.free()`
- `detect(tokens, { key, scheme?, contextWidth?, layers? })` → `Detection`
- `detectSelfSync(tokens, { key, contextWidth? })` — indel-robust (stronger on edited / repetitive text)
- `detectExact(tokens, { key, contextWidth? })` — exact Gamma-tail p-values for short texts
`Detection` = `{ zScore, pValue, log10P, scoredPositions, isWatermarked(alpha = 1e-6) }`.
`key` may be a string (UTF-8) or `Uint8Array`. Detection is key-specific: a wrong
key sees nothing. Confidence grows with the number of low-stakes token choices,
so short or low-entropy (factual/code) text carries little to no mark.
## Browser / Deno / bundler
The `@claude-flow/watermark/web` entry is an ESM build. Instantiate the WASM once
with `await init()`, then use the same API. In a browser, `init()` with no
argument fetches the sibling `.wasm`; pass a `URL` / `Response` / bytes to
override.
```js
import { init, Watermarker, detect } from '@claude-flow/watermark/web';
await init(); // browser: auto-fetches the wasm
const wm = new Watermarker({ key: '8F3A91C7', scheme: 'gumbel' });
const tokens = Uint32Array.from({ length: 128 }, (_, i) => i);
const probs = new Float32Array(128).fill(1 / 128);
const out = new Uint32Array(600);
for (let i = 0; i < out.length; i++) out[i] = tokens[wm.step(tokens, probs)];
wm.free();
console.log(detect(out, { key: '8F3A91C7', scheme: 'gumbel' }).isWatermarked(1e-6));
```
The `.` entry is the Node (CommonJS) build shown earlier; the `/web` entry is for
browser / Deno / bundlers.
## Scope
Bindings are generated from the Rust crate with `npm run build:wasm`
(`wasm-pack`, both `nodejs` and `web` targets). The crate exposes more than this
WASM surface — the Bayesian/Higher-Criticism detectors, the robustness-evaluation
harness, the Darwin/flywheel detector tuner, and the authorized un-marked-
generation governance path are Rust-only for now.
Do not publish from this directory. Both
`v3/@claude-flow/watermark/package.json` (`"private": true`) and
`v3/crates/ruflo-watermark/Cargo.toml` (`publish = false`) are pinned shut;
see [#4959](https://github.com/ruvnet/ruflo/issues/4959).
-3
View File
@@ -56,9 +56,6 @@
"engines": {
"node": ">=18"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build:wasm": "bash scripts/build-wasm.sh",
"test": "node test/smoke.cjs && node test/smoke-web.mjs",
+4
View File
@@ -9,6 +9,10 @@
[package]
name = "ruflo-watermark"
version = "0.1.0"
# This crate is a stale, non-canonical snapshot. The published crate (0.3.x)
# and npm package (0.4.x) are built from ruvnet/ai-text-watermark; see #4959.
# Keep every publish path closed so a release here cannot overwrite them.
publish = false
edition = "2021"
rust-version = "1.74"
license = "MIT"
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/plugin-code-intelligence",
"version": "3.0.0-alpha.4",
"description": "Advanced code intelligence plugin for Claude Flow V3 - semantic search, architecture analysis, refactoring impact, module splitting, and pattern learning",
+1
View File
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/plugin-cognitive-kernel",
"version": "3.0.0-alpha.3",
"description": "Cognitive kernel plugin for LLM augmentation with working memory, attention control, meta-cognition, and scaffolding",
+1
View File
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/plugin-legal-contracts",
"version": "3.0.0-alpha.3",
"description": "Legal contract analysis plugin for Claude Flow V3 - clause extraction, risk assessment, contract comparison, obligation tracking, and playbook matching",
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/plugin-neural-coordination",
"version": "3.0.0-alpha.3",
"description": "Neural coordination plugin for multi-agent swarm intelligence using SONA, GNN, and attention mechanisms",
+1
View File
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/plugin-perf-optimizer",
"version": "3.0.0-alpha.3",
"description": "AI-powered performance optimization plugin for bottleneck detection, memory analysis, and configuration tuning",
+1 -1
View File
@@ -60,7 +60,7 @@
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues"
},
"homepage": "https://github.com/ruvnet/claude-flow#readme",
"homepage": "https://ruv.io",
"engines": {
"node": ">=18.0.0"
},
@@ -1,4 +1,5 @@
{
"homepage": "https://ruv.io",
"name": "@claude-flow/plugin-test-intelligence",
"version": "3.0.0-alpha.3",
"description": "AI-powered test intelligence plugin for predictive test selection, flaky detection, and coverage optimization",
+69 -5
View File
@@ -71,8 +71,8 @@ importers:
specifier: '>=3.5.0'
version: link:../cli
agent-browser:
specifier: ^0.41.0
version: 0.41.2
specifier: ^0.43.0
version: 0.43.0
agentic-flow:
specifier: ^2.0.14
version: 2.0.14(@types/node@20.19.27)
@@ -731,6 +731,62 @@ packages:
/@actions/io@2.0.0:
resolution: {integrity: sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==}
/@agent-browser/cli-darwin-arm64@0.43.0:
resolution: {integrity: sha512-HV6GP59IjNnowlrXR/5rVM8msPWwQDEONt/tWC8STzUfKZQHKZI/Iv9sf2h2ZhwK8xwoqLhxpf+KxcFgJ0sExQ==}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@agent-browser/cli-darwin-x64@0.43.0:
resolution: {integrity: sha512-3NKnKFOWLYDYTz4bJxo4jt+GwjM4VtcW5FDrQY35eUrytig65FEDdXmXKuRbZGq9jEEWxh6rmpS4R6xS53XCaw==}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@agent-browser/cli-linux-arm64-gnu@0.43.0:
resolution: {integrity: sha512-8DC234LGlXCn8A2YXGk6woy1uTjyexvtHd/TOQHLrV2sfUMZD647HTHEJyF+2z1J1oR34LaB5jqHJ9d0REC+Cw==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@agent-browser/cli-linux-arm64-musl@0.43.0:
resolution: {integrity: sha512-/dYeGX2E1lWZ25q1IZSVs6PaPmr0GmhHU8z/LtCh0anHN4ND50i5fOPbysRBaE8iQCBY74h+1R2kePfEqD7X4Q==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@agent-browser/cli-linux-x64-gnu@0.43.0:
resolution: {integrity: sha512-WY8vy2Saa3oRt6XEmz4Sae1W5qS9TjYcbX6IE+dxb8s2APfL9XyQjMHC6jBZrhwqDBIvUeTMCT/P2cq3XLPSBw==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@agent-browser/cli-linux-x64-musl@0.43.0:
resolution: {integrity: sha512-WpCI0cIaVIVj4trdduDmW90h51BAP5Nhx6lALOqHjUhOOae/TkLL4bK8gJfjPb/nOp2FRjsF1l77f6rVwkpsug==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@agent-browser/cli-win32-x64-msvc@0.43.0:
resolution: {integrity: sha512-xhk8wnHk3aiBFSR0pd1Ye3ay2jKjgRardgBJLiB9nXJv0ZkbeP/wh3X7jMiKUfUGE1qqJrKdaM5szQ6iz8/8+w==}
cpu: [x64, arm64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@agntcy/slim-bindings-darwin-arm64@2.1.1:
resolution: {integrity: sha512-YbUsO1bWdgxHIQP/I7L+1NG27+mnpW/WueT/1n68NC8n5KedQPAV3TuUU5NAQlUN4uxpbGaZQ6Yi8Yk0qVn88g==}
engines: {node: '>=18.0.0'}
@@ -4812,11 +4868,19 @@ packages:
dev: false
optional: true
/agent-browser@0.41.2:
resolution: {integrity: sha512-/agCKB5rw1EEK8SKWo4zid7a5kOwlclqALC0P3c69buJvKdhrl/dJkKdfLqGGaiNIbWzRdqqT0PxZVkwVEf2fg==}
engines: {node: '>=24.0.0', pnpm: '>=11.0.0'}
/agent-browser@0.43.0:
resolution: {integrity: sha512-TExwnZAW39fUBDJhUPrw8KKGmcjzBo7FxNqoP2/usHG1ODsjGI2jAWq3+Q6I5JYyBMjePFEsj8KGB68mALtglA==}
engines: {node: '>=22.0.0'}
hasBin: true
requiresBuild: true
optionalDependencies:
'@agent-browser/cli-darwin-arm64': 0.43.0
'@agent-browser/cli-darwin-x64': 0.43.0
'@agent-browser/cli-linux-arm64-gnu': 0.43.0
'@agent-browser/cli-linux-arm64-musl': 0.43.0
'@agent-browser/cli-linux-x64-gnu': 0.43.0
'@agent-browser/cli-linux-x64-musl': 0.43.0
'@agent-browser/cli-win32-x64-msvc': 0.43.0
dev: false
/agentdb@3.10.0(@types/node@20.19.27)(zod@3.25.76):