Merge origin/main into weaver/ruflo-shared-zod4; regenerate lockfiles

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
randclaude-flow committed 2026-11-09 03:37:42 -05:00
commit 824b38a75f
115 files changed
+6874 -6753

No files matched your search

+3
View File
@@ -71,6 +71,9 @@ jobs:
console.log('cost-health: ' + r.checks.length + ' subchecks, all OK on empty fixture');
"
- name: compact.mjs exits with a live optimizer timer (agentic-flow >= 2.0.14)
run: node plugins/ruflo-cost-tracker/scripts/smoke-compact-exit.mjs
- name: cost-health CLI failure + warm-up test (#4711)
run: node plugins/ruflo-cost-tracker/scripts/test-cli-failure-4711.mjs
+75 -14
View File
@@ -13788,7 +13788,7 @@
}
},
"v3/@claude-flow/codex": {
"version": "3.0.6",
"version": "3.0.7",
"license": "MIT",
"dependencies": {
"@claude-flow/security": "^3.0.0",
@@ -13797,7 +13797,7 @@
"commander": "^12.0.0",
"fs-extra": "^11.2.0",
"inquirer": "^9.2.0",
"yaml": "^2.4.0"
"yaml": "^2.8.3"
},
"bin": {
"claude-flow-codex": "dist/cli.js"
@@ -14069,14 +14069,14 @@
}
},
"v3/@claude-flow/mcp": {
"version": "3.1.6",
"version": "3.1.7",
"dependencies": {
"ajv": "^8.12.0",
"ajv": "^8.20.0",
"cors": "^2.8.5",
"express": "^4.18.2",
"express": "^4.22.3",
"express-rate-limit": "^8.4.1",
"helmet": "^7.1.0",
"ws": "^8.14.2"
"ws": "^8.21.0"
},
"devDependencies": {
"@types/cors": "^2.8.17",
@@ -14286,9 +14286,9 @@
"license": "MIT"
},
"v3/@claude-flow/mcp/node_modules/express": {
"version": "4.22.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz",
"integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
"version": "4.22.3",
"resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz",
"integrity": "sha512-Bdcs4+3qlpVlx2NRn6fgX2Ue2/gGRaPeawebgclM0ERSCqDpA+owF1fdPwjJUTAJWMTuAaxjDf+hzb0/4eKvvw==",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.8",
@@ -14310,9 +14310,9 @@
"methods": "~1.1.2",
"on-finished": "~2.4.1",
"parseurl": "~1.3.3",
"path-to-regexp": "~0.1.12",
"path-to-regexp": "~0.1.13",
"proxy-addr": "~2.0.7",
"qs": "~6.15.1",
"qs": "~6.16.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.2.1",
"send": "~0.19.0",
@@ -14331,6 +14331,22 @@
"url": "https://opencollective.com/express"
}
},
"v3/@claude-flow/mcp/node_modules/express/node_modules/qs": {
"version": "6.16.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.2.tgz",
"integrity": "sha512-VYdnB5S7/0IeXzBacUtwNAaM6d7Y/PgYnNC7bJCI6meqA/OgnsQbZMtVW8Dt2D1PHgbHGtYmhSoEIgvt7xZ2ZA==",
"license": "BSD-3-Clause",
"dependencies": {
"es-define-property": "^1.0.1",
"side-channel": "^1.1.1"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"v3/@claude-flow/mcp/node_modules/finalhandler": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
@@ -14478,6 +14494,41 @@
"node": ">= 0.8.0"
}
},
"v3/@claude-flow/mcp/node_modules/side-channel": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.4",
"side-channel-list": "^1.0.1",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"v3/@claude-flow/mcp/node_modules/side-channel-list": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.4"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"v3/@claude-flow/mcp/node_modules/std-env": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz",
@@ -15601,16 +15652,16 @@
}
},
"v3/@claude-flow/shared": {
"version": "3.0.7",
"version": "3.0.8",
"dev": true,
"dependencies": {
"@types/ws": "^8.5.10",
"cors": "^2.8.5",
"express": "^4.22.2 || ^5.0.0",
"express": "^4.22.3 || ^5.1.0",
"helmet": "^7.2.0",
"sql.js": "^1.10.3",
"ws": "^8.21.0",
"zod": "^3.22.4"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/cors": "^2.8.17",
@@ -16162,6 +16213,16 @@
"optional": true
}
}
},
"v3/@claude-flow/shared/node_modules/zod": {
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
}
}
}
@@ -1,7 +1,7 @@
{
"name": "ruflo-ai-team",
"description": "Give Claude a tenant-isolated AI team that divides work, coordinates progress, recalls approved context, and returns evidence-backed results.",
"version": "0.4.0",
"version": "0.4.1",
"author": {
"name": "ruvnet",
"url": "https://github.com/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-ai-team`.
## 0.4.1 — 2026-11-09
- fix(deps): zod ^4.6.7 (GHSA-mrhx-c7xc-m3w5: zod < 4.6.6 can exhaust memory validating oversized constrained collections).
## 0.4.0 — 2026-10-26
- feat: `memory_search` ranks by meaning through Cognitum's managed `/v1/embeddings` (`cognitum-embed`, 384-dim) when `RUFLO_AI_TEAM_EMBEDDINGS_KEY` is set; vectors are stored with each memory (only if the text is unchanged), never returned to callers, and an outage or a missing key falls back to the labelled lexical index, so a search never fails because embeddings did
- feat: memory listing reads newest first, so a team with more than 1000 memories keeps the latest; needs the composite index in `deploy/firestore.indexes.json`, and without it the read falls back to the old unordered query rather than erroring
+6 -6
View File
@@ -1,19 +1,19 @@
{
"name": "@ruflo/ai-team-service",
"version": "0.4.0",
"version": "0.4.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@ruflo/ai-team-service",
"version": "0.1.6",
"version": "0.4.1",
"license": "MIT",
"dependencies": {
"@google-cloud/firestore": "^9.2.0",
"@modelcontextprotocol/sdk": "^1.0.0",
"@ruvector/core": "^0.1.32",
"jose": "^6.2.12",
"zod": "^3.23.0"
"zod": "^4.6.7"
},
"engines": {
"node": ">=22"
@@ -2511,9 +2511,9 @@
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@ruflo/ai-team-service",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"type": "module",
"description": "Multi-tenant MCP control plane and Claude plugin for coordinated AI teams.",
@@ -15,7 +15,7 @@
"@modelcontextprotocol/sdk": "^1.0.0",
"@ruvector/core": "^0.1.32",
"jose": "^6.2.12",
"zod": "^3.23.0"
"zod": "^4.6.7"
},
"engines": { "node": ">=22" },
"license": "MIT"
@@ -1,6 +1,6 @@
{
"name": "ruflo-arena",
"version": "0.2.6",
"version": "0.2.7",
"description": "Competitive ruliology for Ruflo swarms — arenas, tournaments, and adaptive co-evolution of program strategies (ADR-147/148). Strategies-as-programs compete under payoff games; tournaments produce Wolfram-style competitive arrays; hill-climb and mutual co-evolution discover winners empirically.",
"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; this is the whole history.
## 0.2.7 — 2026-11-09
- fix(deps): zod ^4.6.7 (GHSA-mrhx-c7xc-m3w5: zod < 4.6.6 can exhaust memory validating oversized constrained collections).
## 0.2.6 — 2026-10-12
- fix: the shared text screen now catches `.env` and e-mailed credentials, no longer flags a model's token talk (`--max-tokens`, `/oauth/token`, "token usage"), and no longer flags values that only name where a secret lives (`./service-account.json`, `--set-secrets=NAME=NAME:latest`); every rule stays linear (#4094, thanks @proffesor-for-testing)
+1 -1
View File
@@ -23,7 +23,7 @@
"demo": "node --experimental-strip-types src/cli.ts demo"
},
"dependencies": {
"zod": "^3.22.4"
"zod": "^4.6.7"
},
"devDependencies": {
"@eslint/js": "^9.10.0",
+2 -2
View File
@@ -8,9 +8,9 @@ step() { printf "→ %s ... " "$1"; }
ok() { printf "PASS\n"; PASS=$((PASS+1)); }
bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
step "0. plugin.json declares 0.2.6"
step "0. plugin.json declares 0.2.7"
v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
[[ "$v" == "0.2.6" ]] && ok || bad "expected 0.2.6, got '$v'"
[[ "$v" == "0.2.7" ]] && ok || bad "expected 0.2.7, got '$v'"
# M1. The mod (ADR-445 pattern): hooks module registered, files within the 500-line rule
step "M1. mod: hooks.json names register.ts, every hook file is present and under 500 lines"
@@ -1,7 +1,7 @@
{
"name": "ruflo-chatgpt-federation",
"description": "Dedicated ChatGPT Federation MCP publisher with isolated Nostr signing-key custody, OAuth-scoped publishing, and signed public-channel coordination over the Ruflo relay. As a mod (ADR-445 pattern): a tighten-only tool guard, a local slash command, and a status file the console shows.",
"version": "0.2.5",
"version": "0.2.6",
"repository": "https://github.com/ruvnet/ruflo",
"author": {
"name": "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.2.6 — 2026-11-09
- fix(deps): zod ^4.6.7 (GHSA-mrhx-c7xc-m3w5: zod < 4.6.6 can exhaust memory validating oversized constrained collections).
## 0.2.4 — 2026-10-12
- fix: the shared text screen now catches `.env` and e-mailed credentials, no longer flags a model's token talk (`--max-tokens`, `/oauth/token`, "token usage"), and no longer flags values that only name where a secret lives (`./service-account.json`, `--set-secrets=NAME=NAME:latest`); every rule stays linear (#4094, thanks @proffesor-for-testing)
+4 -4
View File
@@ -13,7 +13,7 @@
"jose": "^6.2.12",
"nostr-tools": "^2.7.0",
"ws": "^8.18.0",
"zod": "^3.23.0"
"zod": "^4.6.7"
},
"engines": {
"node": ">=20"
@@ -1310,9 +1310,9 @@
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
@@ -14,7 +14,7 @@
"jose": "^6.2.12",
"nostr-tools": "^2.7.0",
"ws": "^8.18.0",
"zod": "^3.23.0"
"zod": "^4.6.7"
},
"engines": {
"node": ">=20"
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Structural smoke test for ruflo-chatgpt-federation v0.2.5: the plugin manifest and the mod (ADR-445 pattern).
# Structural smoke test for ruflo-chatgpt-federation v0.2.6: the plugin manifest and the mod (ADR-445 pattern).
set -u
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PASS=0
@@ -8,10 +8,10 @@ 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 version 0.2.5 and the mod keywords"
step "1. plugin.json declares version 0.2.6 and the mod keywords"
v=$(grep -E '"version"[[:space:]]*:' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
if [[ "$v" != "0.2.5" ]]; then
bad "expected 0.2.5, got '$v'"
if [[ "$v" != "0.2.6" ]]; then
bad "expected 0.2.6, got '$v'"
else
miss=""
for k in mod function-hooks guard; do grep -q "\"$k\"" "$ROOT/.claude-plugin/plugin.json" || miss="$miss $k"; done
@@ -140,7 +140,7 @@ export function createPublisherService({ relay, keyPath, port } = {}) {
'Sign a message with this connector\'s own key and publish it to a public swarm channel over its own NIP-42 authenticated relay connection. Use when this connector has something the federation needs — a status, a finding, a result. Requires the caller token; public (pub:) channels only, because publishing to a private channel needs a channel key this connector deliberately does not hold.',
{ channel: z.string().describe('Public channel id, e.g. "pub:announce".'),
msgType: z.string().describe('Message type, e.g. "Status", "Result", "Question".'),
payload: z.record(z.any()).describe('Message body. Never put secrets or credentials here — channel content is readable by every relay member.') },
payload: z.record(z.string(), z.any()).describe('Message body. Never put secrets or credentials here — channel content is readable by every relay member.') },
async ({ channel, msgType, payload }) => {
// OAuth scope is the real gate. The caller token remains a transitional
// fallback and only while OAuth is not yet mandatory.
@@ -1,7 +1,7 @@
{
"name": "ruflo-cost-tracker",
"description": "Token usage tracking, model cost attribution per agent, budget alerts, and optimization recommendations — uses memory_* (namespace-routed) for cost-tracking and cost-patterns; pairs with federation budget circuit breaker (ADR-097)",
"version": "0.31.2",
"version": "0.31.3",
"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-cost-tracker`.
## 0.31.3 — 2026-11-09
- fix: `scripts/compact.mjs` exits once its output has been flushed. With a patched agentic-flow (>= 2.0.14, GHSA-vcv2-r9jh-99m5) the ReasoningBank backend leaves a timer alive, so the script printed its result and then never exited. `scripts/smoke-compact-exit.mjs` guards it.
## 0.31.2 — 2026-11-05
- fix: `cost-health` resolves an npx CLI once before starting its four subchecks in parallel. With a cold npm cache, four concurrent first installs raced in one `~/.npm/_npx` directory and left a broken install (#4711). Skip with `HEALTH_SKIP_WARMUP=1`.
- fix: budget, burn, anomaly and projection report a failed `memory list` as an error (exit 2, with the CLI's stderr) instead of treating it as no data, which showed "no budget set" (#4711).
+16 -1
View File
@@ -23,6 +23,9 @@
// Optional env:
// COMPACT_QUIET=1 emit JSON only (no markdown banner)
// HEALTH_PORT=<n> override agentic-flow's health-server port (default 0)
//
// The script always exits when it is done, even if agentic-flow leaves a
// timer or server handle open.
import { createRequire } from 'node:module';
import { pathToFileURL, fileURLToPath } from 'node:url';
@@ -149,4 +152,16 @@ async function main() {
}
}
main().catch((e) => { console.error('compact.mjs failed:', e.message || e); process.exit(1); });
// Exit explicitly once stdout has drained. A patched agentic-flow (>= 2.0.14)
// leaves a ReasoningBank timer alive after getTokenOptimizer(), so the event
// loop never empties and the script would print its result and then hang. The
// empty write's callback runs after every earlier console.log chunk has been
// flushed, so piped output is not truncated.
function exitAfterFlush(code) {
process.stdout.write('', () => process.exit(code));
}
main().then(
() => exitAfterFlush(0),
(e) => { console.error('compact.mjs failed:', e.message || e); exitAfterFlush(1); },
);
@@ -0,0 +1,66 @@
#!/usr/bin/env node
// smoke-compact-exit — compact.mjs must exit once it has printed its result,
// even when the token optimizer leaves a timer alive (a patched agentic-flow
// >= 2.0.14 does exactly that through agentic-flow/reasoningbank).
//
// Builds a throwaway marketplace layout whose integration package keeps a
// setInterval running, runs compact.mjs against it, and fails if the process
// is still alive after the deadline or if stdout lost the JSON result.
//
// Usage: node plugins/ruflo-cost-tracker/scripts/smoke-compact-exit.mjs [path/to/compact.mjs]
import { spawnSync } from 'node:child_process';
import { copyFileSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const here = dirname(fileURLToPath(import.meta.url));
const source = resolve(process.argv[2] || join(here, 'compact.mjs'));
const root = mkdtempSync(join(tmpdir(), 'compact-exit-'));
const DEADLINE_MS = 15_000;
try {
const scripts = join(root, 'plugins', 'ruflo-cost-tracker', 'scripts');
const dist = join(root, 'v3', '@claude-flow', 'integration', 'dist');
mkdirSync(scripts, { recursive: true });
mkdirSync(dist, { recursive: true });
copyFileSync(source, join(scripts, 'compact.mjs'));
writeFileSync(
join(dist, 'token-optimizer.js'),
[
'// Stand-in for a token optimizer whose backend keeps a timer alive.',
'export async function getTokenOptimizer() {',
' setInterval(() => {}, 1000);',
' return {',
' async getCompactContext() { return { memories: [{}, {}], tokensSaved: 42 }; },',
" getStats() { return { agenticFlowAvailable: true, cacheHitRate: '50%' }; },",
' };',
'}',
'',
].join('\n'),
);
const run = spawnSync(process.execPath, [join(scripts, 'compact.mjs'), 'auth patterns'], {
env: { ...process.env, COMPACT_QUIET: '1' },
encoding: 'utf8',
timeout: DEADLINE_MS,
});
if (run.error?.code === 'ETIMEDOUT' || run.signal) {
console.error(`FAIL: compact.mjs was still running after ${DEADLINE_MS} ms`);
process.exit(1);
}
if (run.status !== 0) {
console.error(`FAIL: compact.mjs exited ${run.status}\n${run.stderr}`);
process.exit(1);
}
const out = JSON.parse(run.stdout.trim());
if (out.memoriesRetrieved !== 2 || out.tokensSaved !== 42 || out.agenticFlowAvailable !== true) {
console.error(`FAIL: unexpected result ${run.stdout}`);
process.exit(1);
}
console.log('ok: compact.mjs printed its result and exited with a live timer');
} finally {
rmSync(root, { recursive: true, force: true });
}
+4 -4
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Structural smoke test for ruflo-cost-tracker v0.31.2.
# Structural smoke test for ruflo-cost-tracker v0.31.3.
set -u
# `pwd -W` (Git Bash on Windows) gives C:/Users/...; plain pwd gives /c/Users/..., which a Windows node cannot open. Elsewhere -W fails and pwd answers.
ROOT="$(cd "$(dirname "$0")/.." && { pwd -W 2>/dev/null || pwd; })"
@@ -9,10 +9,10 @@ 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 0.31.2 with new keywords"
step "1. plugin.json declares 0.31.3 with new keywords"
v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
if [[ "$v" != "0.31.2" ]]; then
bad "expected 0.31.2, got '$v'"
if [[ "$v" != "0.31.3" ]]; then
bad "expected 0.31.3, got '$v'"
else
miss=""
for k in namespace-routing mcp agentic-flow agent-booster tier1-routing model-routing benchmarking verified telemetry budget projection forecast counterfactual drift-detection trend-alert anomaly-detection outlier-detection health-check composite-gate auto-track stop-hook snapshot-diff pr-regression git-context traceability drill-down per-message; do
@@ -1,7 +1,7 @@
{
"name": "ruflo-x-gateway",
"description": "Coordinate AI-agent swarms through signed federation messages, channels, and work claims. The remote Claude connector exposes a directory-safe Streamable HTTP MCP surface with OAuth-protected publishing and five ruv:// reference resources.",
"version": "0.10.3",
"version": "0.10.4",
"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-x-gateway`.
## 0.10.4 — 2026-11-09
- fix(deps): zod ^4.6.7 (GHSA-mrhx-c7xc-m3w5: zod < 4.6.6 can exhaust memory validating oversized constrained collections).
## 0.10.3 — 2026-11-04
- fix: every per-IP limit (MCP rate limit, Seraphina hourly allowance, GitHub hourly allowance) now keys on the trusted end of the forwarding chain, the same address registration uses, instead of the caller-supplied leftmost `X-Forwarded-For` entry. `RUFLO_PROXY_HOPS` (falling back to `RUFLO_REGISTRATION_PROXY_HOPS`) sets the trusted hop count (gateway 0.9.2)
+4 -4
View File
@@ -14,7 +14,7 @@
"jose": "^6.2.12",
"nostr-tools": "^2.7.0",
"ws": "^8.18.0",
"zod": "^3.23.0"
"zod": "^4.6.7"
},
"engines": {
"node": ">=22"
@@ -2541,9 +2541,9 @@
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
+1 -1
View File
@@ -14,7 +14,7 @@
"jose": "^6.2.12",
"nostr-tools": "^2.7.0",
"ws": "^8.18.0",
"zod": "^3.23.0",
"zod": "^4.6.7",
"@google-cloud/firestore": "^9.2.0"
},
"engines": {
+2 -2
View File
@@ -238,7 +238,7 @@ export function createGateway({ relay, keyFile, port, registration, github: gith
WRITE('Announce gateway peer', { destructive: true, openWorld: true }),
gate(async ({ name, platform, note }) => text({ ok: true, eventId: await publish(RELAY, sk, 'PeerHello', { from: name, platform, note }) })));
mcp.tool('federation_publish', 'Publish a signed coordination message AS THE GATEWAY (Status/Task/Result…). Authorised by OAuth swarm:publish or the service-side admin token.',
{ msgType: z.string(), payload: z.record(z.any()), ...adminSchema },
{ msgType: z.string(), payload: z.record(z.string(), z.any()), ...adminSchema },
// A signed relay message is an irreversible external send: it cannot be
// edited or retracted after publication.
WRITE('Publish coordination message', { destructive: true, openWorld: true }),
@@ -298,7 +298,7 @@ export function createGateway({ relay, keyFile, port, registration, github: gith
);
});
mcp.tool('channel_publish', 'Publishes a signed gateway message to a public channel. Requires OAuth swarm:publish or the service-side admin token. Private channels are rejected because their encryption keys remain client-held.',
{ channel: z.string(), msgType: z.string(), payload: z.record(z.any()), ...adminSchema },
{ channel: z.string(), msgType: z.string(), payload: z.record(z.string(), z.any()), ...adminSchema },
// Public-channel events are append-only and cannot be deleted or
// retracted, so publication is destructive for review purposes.
WRITE('Publish to public channel', { destructive: true, openWorld: true }),
+32
View File
@@ -1,5 +1,31 @@
# @claude-flow/claims
<!-- adr-356:quickstart:start -->
**@claude-flow/claims** — Lets humans and agents claim issues, hand work off and steal stalled work without conflicts, and exposes those operations as MCP tools.
**Supported environments:** Node.js 18+ · ESM · Linux, macOS, Windows (pure JavaScript)
## Quickstart
```bash
npm install @claude-flow/claims
```
```js
import { claimsTools, getClaimsToolByName } from '@claude-flow/claims';
console.log(claimsTools.length, getClaimsToolByName('claims/issue_claim')?.name);
```
Expected output:
```text
17 claims/issue_claim
```
Optional peer: [`@claude-flow/shared`](https://www.npmjs.com/package/@claude-flow/shared) for the shared event types.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/claims.svg)](https://www.npmjs.com/package/@claude-flow/claims)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/claims.svg)](https://www.npmjs.com/package/@claude-flow/claims)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -263,3 +289,9 @@ claims:
## License
MIT
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/@claude-flow/claims)
<!-- adr-356:footer:end -->
@@ -0,0 +1,68 @@
/**
* Regression guard: the published dependency ranges must not admit versions
* with known advisories. Each row is (field, package, versions that must be
* rejected, versions that must be admitted).
*
* Ranges are restricted to `^X.Y.Z` alternatives joined by `||`, so the check
* below is exact without pulling semver into the package.
*/
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, it, expect } from 'vitest';
const here = dirname(fileURLToPath(import.meta.url));
const manifest = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8')) as Record<
string,
Record<string, string> | undefined
>;
type Version = { major: number; minor: number; patch: number; pre: boolean };
function parse(v: string): Version {
const m = /^(\d+)\.(\d+)\.(\d+)(-.+)?$/.exec(v);
if (!m) throw new Error(`not a version: ${v}`);
return { major: +m[1], minor: +m[2], patch: +m[3], pre: m[4] !== undefined };
}
function cmp(a: Version, b: Version): number {
return a.major - b.major || a.minor - b.minor || a.patch - b.patch;
}
/** Caret semantics for X >= 1: same major, >= floor, no prereleases. */
function satisfies(version: string, range: string): boolean {
const v = parse(version);
return range.split('||').some((part) => {
const m = /^\s*\^(\d+\.\d+\.\d+)\s*$/.exec(part);
if (!m) throw new Error(`unsupported range form: ${part.trim()}`);
const floor = parse(m[1]);
return !v.pre && v.major === floor.major && floor.major >= 1 && cmp(v, floor) >= 0;
});
}
const rows: Array<[field: string, name: string, advisory: string, rejected: string[], admitted: string[]]> = [
['dependencies', 'zod', 'GHSA-mrhx-c7xc-m3w5', ['3.22.4', '3.25.76', '4.6.5'], ['4.6.7']],
];
describe('advisory-free dependency ranges', () => {
for (const [field, name, advisory, rejected, admitted] of rows) {
const range = manifest[field]?.[name];
it(`${field}.${name} is declared`, () => {
expect(range).toBeTypeOf('string');
});
for (const v of rejected) {
it(`${field}.${name} rejects ${v} (${advisory})`, () => {
expect(satisfies(v, range!)).toBe(false);
});
}
for (const v of admitted) {
it(`${field}.${name} admits ${v}`, () => {
expect(satisfies(v, range!)).toBe(true);
});
}
}
});
+8 -6
View File
@@ -1,7 +1,7 @@
{
"name": "@claude-flow/claims",
"version": "3.0.0",
"description": "Issue claiming and work coordination module for Claude Flow V3",
"version": "3.0.1",
"description": "Issue claiming, handoff and work-stealing coordination for multi-agent swarms in Ruflo (claude-flow) V3, with MCP tools.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
@@ -37,10 +37,12 @@
"typecheck": "tsc --noEmit"
},
"keywords": [
"ruflo",
"claude-flow",
"claims",
"issue-tracking",
"work-coordination",
"work-stealing",
"multi-agent",
"swarm",
"mcp"
@@ -49,15 +51,15 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/@claude-flow/claims"
},
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues"
"url": "https://github.com/ruvnet/ruflo/issues"
},
"homepage": "https://github.com/ruvnet/claude-flow#readme",
"homepage": "https://ruv.io",
"dependencies": {
"zod": "^3.22.4"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.10.0",
+38
View File
@@ -1,5 +1,37 @@
# @claude-flow/codex
<!-- adr-356:quickstart:start -->
![Animated diagram: CLAUDE.md and settings are migrated into AGENTS.md, config.toml and skills for the Codex CLI](https://raw.githubusercontent.com/ruvnet/ruflo/main/v3/@claude-flow/codex/assets/codex-flow.svg)
**@claude-flow/codex** — Generates and validates the files the OpenAI Codex CLI reads (AGENTS.md, config.toml, skills) and migrates a Claude Code project to them.
**Supported environments:** Node.js 18+ · ESM
## Quickstart
```bash
npm install @claude-flow/codex
```
```js
import { generateAgentsMd, validateAgentsMd } from '@claude-flow/codex';
const md = await generateAgentsMd({ projectName: 'demo', template: 'default' });
const result = await validateAgentsMd(md);
console.log(md.split('\n')[0]);
console.log('valid:', result.valid);
```
Expected output:
```text
# demo
valid: true
```
Used by [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli) for `init --codex`.
<!-- adr-356:quickstart:end -->
<p align="center">
<strong>OpenAI Codex CLI Adapter for Claude Flow V3</strong><br/>
<em>Self-learning multi-agent orchestration following the <a href="https://agentics.org">Agentics Foundation</a> standard</em>
@@ -1137,3 +1169,9 @@ MIT
- Documentation: https://github.com/ruvnet/ruflo
- Issues: https://github.com/ruvnet/ruflo/issues
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/@claude-flow/codex)
<!-- adr-356:footer:end -->
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 170" width="760" height="170" role="img" aria-labelledby="t d">
<title id="t">@claude-flow/codex: Claude Code project to Codex project</title>
<desc id="d">CLAUDE.md and settings are analysed and migrated into AGENTS.md, config.toml and skills that the OpenAI Codex CLI reads.</desc>
<style>
.bg{fill:#1e293b}
.cap{fill:#e2e8f0;font:600 15px system-ui,-apple-system,Segoe UI,sans-serif}
.s rect{fill:#334155;stroke:#64748b;stroke-width:1.5}
.s{animation:pulse 4.8s infinite}
.h{fill:#f8fafc;font:600 13px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.t{fill:#cbd5e1;font:11px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.a{fill:none;stroke:#94a3b8;stroke-width:2}
.dot{fill:#38bdf8;animation:move 4.8s linear infinite}
@keyframes pulse{0%,25.0%{opacity:1}33.0%,100%{opacity:.62}}
@keyframes move{from{transform:translateX(0)}to{transform:translateX(561px)}}
@media (prefers-reduced-motion:reduce){.s,.dot{animation:none}}
</style>
<rect class="bg" width="760" height="170" rx="14"/>
<text class="cap" x="20" y="34">@claude-flow/codex: Claude Code project to Codex project</text>
<path class="a" d="M184 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M371 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M558 90h14m-5 -4l5 4l-5 4"/>
<g class="s" style="animation-delay:0.0s"><rect x="16" y="58" width="165" height="64" rx="10"/><text class="h" x="98.5" y="85">CLAUDE.md</text><text class="t" x="98.5" y="104">settings.json</text></g><g class="s" style="animation-delay:1.2s"><rect x="203" y="58" width="165" height="64" rx="10"/><text class="h" x="285.5" y="85">Migrate</text><text class="t" x="285.5" y="104">analyze + convert</text></g><g class="s" style="animation-delay:2.4s"><rect x="390" y="58" width="165" height="64" rx="10"/><text class="h" x="472.5" y="85">AGENTS.md</text><text class="t" x="472.5" y="104">config.toml, skills</text></g><g class="s" style="animation-delay:3.6s"><rect x="577" y="58" width="165" height="64" rx="10"/><text class="h" x="659.5" y="85">Codex CLI</text><text class="t" x="659.5" y="104">runs the agents</text></g>
<circle class="dot" cx="98.5" cy="140" r="5"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+8 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/codex",
"version": "3.0.6",
"version": "3.0.7",
"description": "Codex CLI integration for Ruflo (claude-flow) - OpenAI Codex platform adapter",
"type": "module",
"main": "./dist/index.js",
@@ -63,14 +63,16 @@
"prepublishOnly": "npm run build"
},
"keywords": [
"ruflo",
"claude-flow",
"codex",
"openai",
"claude-flow",
"coflow",
"codex-cli",
"agents",
"skills",
"AGENTS.md",
"agentic-ai"
"agentic-ai",
"mcp"
],
"author": "rUv",
"license": "MIT",
@@ -79,7 +81,7 @@
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/@claude-flow/codex"
},
"homepage": "https://github.com/ruvnet/ruflo#readme",
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
},
@@ -99,7 +101,7 @@
"fs-extra": "^11.2.0",
"chalk": "^5.3.0",
"inquirer": "^9.2.0",
"yaml": "^2.4.0",
"yaml": "^2.8.3",
"@iarna/toml": "^2.2.5",
"@claude-flow/security": "^3.0.0"
},
+1 -1
View File
@@ -93,7 +93,7 @@ export {
/**
* Package version
*/
export const VERSION = '3.0.6';
export const VERSION = '3.0.7';
/**
* Package metadata
@@ -0,0 +1,68 @@
/**
* Regression guard: the published dependency ranges must not admit versions
* with known advisories. Each row is (field, package, versions that must be
* rejected, versions that must be admitted).
*
* Ranges are restricted to `^X.Y.Z` alternatives joined by `||`, so the check
* below is exact without pulling semver into the package.
*/
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, it, expect } from 'vitest';
const here = dirname(fileURLToPath(import.meta.url));
const manifest = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8')) as Record<
string,
Record<string, string> | undefined
>;
type Version = { major: number; minor: number; patch: number; pre: boolean };
function parse(v: string): Version {
const m = /^(\d+)\.(\d+)\.(\d+)(-.+)?$/.exec(v);
if (!m) throw new Error(`not a version: ${v}`);
return { major: +m[1], minor: +m[2], patch: +m[3], pre: m[4] !== undefined };
}
function cmp(a: Version, b: Version): number {
return a.major - b.major || a.minor - b.minor || a.patch - b.patch;
}
/** Caret semantics for X >= 1: same major, >= floor, no prereleases. */
function satisfies(version: string, range: string): boolean {
const v = parse(version);
return range.split('||').some((part) => {
const m = /^\s*\^(\d+\.\d+\.\d+)\s*$/.exec(part);
if (!m) throw new Error(`unsupported range form: ${part.trim()}`);
const floor = parse(m[1]);
return !v.pre && v.major === floor.major && floor.major >= 1 && cmp(v, floor) >= 0;
});
}
const rows: Array<[field: string, name: string, advisory: string, rejected: string[], admitted: string[]]> = [
['dependencies', 'yaml', 'GHSA-48c2-rrv3-qjmp', ['2.4.0', '2.8.2'], ['2.8.3', '2.9.1']],
];
describe('advisory-free dependency ranges', () => {
for (const [field, name, advisory, rejected, admitted] of rows) {
const range = manifest[field]?.[name];
it(`${field}.${name} is declared`, () => {
expect(range).toBeTypeOf('string');
});
for (const v of rejected) {
it(`${field}.${name} rejects ${v} (${advisory})`, () => {
expect(satisfies(v, range!)).toBe(false);
});
}
for (const v of admitted) {
it(`${field}.${name} admits ${v}`, () => {
expect(satisfies(v, range!)).toBe(true);
});
}
}
});
+36
View File
@@ -1,5 +1,35 @@
# @claude-flow/hooks
<!-- adr-356:quickstart:start -->
![Animated diagram: a lifecycle event reaches the HookRegistry, the HookExecutor runs hooks in priority order, and ReasoningBank learns from the outcome](https://raw.githubusercontent.com/ruvnet/ruflo/main/v3/@claude-flow/hooks/assets/hooks-flow.svg)
**@claude-flow/hooks** — Registers and runs lifecycle hooks (PreEdit, PostTask, session start and end, and more) in priority order, and feeds their outcomes to ReasoningBank pattern learning.
**Supported environments:** Node.js 20+ · ESM
## Quickstart
```bash
npm install @claude-flow/hooks
```
```js
import { HookRegistry, HookEvent, HookPriority } from '@claude-flow/hooks';
const registry = new HookRegistry();
registry.register(HookEvent.PreEdit, async () => ({ success: true }), HookPriority.Normal, { name: 'log-edit' });
console.log(registry.getForEvent(HookEvent.PreEdit).map((h) => h.name));
```
Expected output:
```text
[ 'log-edit' ]
```
Built on [`@claude-flow/shared`](https://www.npmjs.com/package/@claude-flow/shared); used by [`@claude-flow/plugins`](https://www.npmjs.com/package/@claude-flow/plugins).
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/hooks.svg)](https://www.npmjs.com/package/@claude-flow/hooks)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/hooks.svg)](https://www.npmjs.com/package/@claude-flow/hooks)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -438,3 +468,9 @@ Add to your Claude settings (`~/.claude/settings.json`):
## License
MIT © [Claude Flow Team](https://github.com/ruvnet/claude-flow)
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/@claude-flow/hooks)
<!-- adr-356:footer:end -->
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 170" width="760" height="170" role="img" aria-labelledby="t d">
<title id="t">@claude-flow/hooks: lifecycle event to learned pattern</title>
<desc id="d">A lifecycle event such as PreEdit reaches the HookRegistry, the HookExecutor runs matching hooks in priority order, and outcomes feed the ReasoningBank.</desc>
<style>
.bg{fill:#1e293b}
.cap{fill:#e2e8f0;font:600 15px system-ui,-apple-system,Segoe UI,sans-serif}
.s rect{fill:#334155;stroke:#64748b;stroke-width:1.5}
.s{animation:pulse 4.8s infinite}
.h{fill:#f8fafc;font:600 13px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.t{fill:#cbd5e1;font:11px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.a{fill:none;stroke:#94a3b8;stroke-width:2}
.dot{fill:#38bdf8;animation:move 4.8s linear infinite}
@keyframes pulse{0%,25.0%{opacity:1}33.0%,100%{opacity:.62}}
@keyframes move{from{transform:translateX(0)}to{transform:translateX(561px)}}
@media (prefers-reduced-motion:reduce){.s,.dot{animation:none}}
</style>
<rect class="bg" width="760" height="170" rx="14"/>
<text class="cap" x="20" y="34">@claude-flow/hooks: lifecycle event to learned pattern</text>
<path class="a" d="M184 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M371 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M558 90h14m-5 -4l5 4l-5 4"/>
<g class="s" style="animation-delay:0.0s"><rect x="16" y="58" width="165" height="64" rx="10"/><text class="h" x="98.5" y="85">Lifecycle event</text><text class="t" x="98.5" y="104">PreEdit, PostTask</text></g><g class="s" style="animation-delay:1.2s"><rect x="203" y="58" width="165" height="64" rx="10"/><text class="h" x="285.5" y="85">HookRegistry</text><text class="t" x="285.5" y="104">match by event</text></g><g class="s" style="animation-delay:2.4s"><rect x="390" y="58" width="165" height="64" rx="10"/><text class="h" x="472.5" y="85">HookExecutor</text><text class="t" x="472.5" y="104">priority order</text></g><g class="s" style="animation-delay:3.6s"><rect x="577" y="58" width="165" height="64" rx="10"/><text class="h" x="659.5" y="85">ReasoningBank</text><text class="t" x="659.5" y="104">learn patterns</text></g>
<circle class="dot" cx="98.5" cy="140" r="5"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+11 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/hooks",
"version": "3.0.2",
"version": "3.0.3",
"description": "V3 Hooks System - Event-driven lifecycle hooks with ReasoningBank learning integration",
"type": "module",
"main": "./dist/index.js",
@@ -63,8 +63,7 @@
"@claude-flow/memory": "^3.0.0",
"@claude-flow/neural": "^3.0.0",
"@claude-flow/security": "^3.0.0",
"@claude-flow/shared": "^3.0.0",
"zod": "^3.23.0"
"@claude-flow/shared": "^3.0.0"
},
"optionalDependencies": {
"better-sqlite3": "^11.0.0"
@@ -82,22 +81,29 @@
"node": ">=20.0.0"
},
"keywords": [
"ruflo",
"claude-flow",
"hooks",
"lifecycle-hooks",
"daemons",
"statusline",
"reasoningbank",
"mcp",
"agents"
"agents",
"claude-code"
],
"author": "Claude Flow Team",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/@claude-flow/hooks"
},
"publishConfig": {
"access": "public"
},
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/integration
<!-- adr-356:quickstart:start -->
**@claude-flow/integration** — Connects Ruflo (claude-flow) V3 to [`agentic-flow`](https://www.npmjs.com/package/agentic-flow): the TokenOptimizer (ReasoningBank compact context, Agent Booster edits), feature flags, worker pools and swarm adapters.
**Supported environments:** Node.js 20+ · ESM · peer dependency `agentic-flow` `^2.0.14 || ^3.0.0`
## Quickstart
```bash
npm install @claude-flow/integration
```
```js
import { createFeatureFlagManager } from '@claude-flow/integration';
const flags = await createFeatureFlagManager();
console.log('flags:', Object.keys(flags.getAllFlags()).length);
console.log('enableSONA:', flags.isEnabled('enableSONA'));
```
Expected output:
```text
flags: 9
enableSONA: true
```
Peer: [`agentic-flow`](https://www.npmjs.com/package/agentic-flow) supplies ReasoningBank and Agent Booster.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/integration.svg)](https://www.npmjs.com/package/@claude-flow/integration)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/integration.svg)](https://www.npmjs.com/package/@claude-flow/integration)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -268,3 +297,9 @@ import type {
## License
MIT
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/@claude-flow/integration)
<!-- adr-356:footer:end -->
@@ -0,0 +1,68 @@
/**
* Regression guard: the published dependency ranges must not admit versions
* with known advisories. Each row is (field, package, versions that must be
* rejected, versions that must be admitted).
*
* Ranges are restricted to `^X.Y.Z` alternatives joined by `||`, so the check
* below is exact without pulling semver into the package.
*/
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, it, expect } from 'vitest';
const here = dirname(fileURLToPath(import.meta.url));
const manifest = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8')) as Record<
string,
Record<string, string> | undefined
>;
type Version = { major: number; minor: number; patch: number; pre: boolean };
function parse(v: string): Version {
const m = /^(\d+)\.(\d+)\.(\d+)(-.+)?$/.exec(v);
if (!m) throw new Error(`not a version: ${v}`);
return { major: +m[1], minor: +m[2], patch: +m[3], pre: m[4] !== undefined };
}
function cmp(a: Version, b: Version): number {
return a.major - b.major || a.minor - b.minor || a.patch - b.patch;
}
/** Caret semantics for X >= 1: same major, >= floor, no prereleases. */
function satisfies(version: string, range: string): boolean {
const v = parse(version);
return range.split('||').some((part) => {
const m = /^\s*\^(\d+\.\d+\.\d+)\s*$/.exec(part);
if (!m) throw new Error(`unsupported range form: ${part.trim()}`);
const floor = parse(m[1]);
return !v.pre && v.major === floor.major && floor.major >= 1 && cmp(v, floor) >= 0;
});
}
const rows: Array<[field: string, name: string, advisory: string, rejected: string[], admitted: string[]]> = [
['peerDependencies', 'agentic-flow', 'GHSA-vcv2-r9jh-99m5', ['2.0.0', '2.0.12', '2.0.13'], ['2.0.14', '2.1.5', '3.0.0', '3.5.1']],
];
describe('advisory-free dependency ranges', () => {
for (const [field, name, advisory, rejected, admitted] of rows) {
const range = manifest[field]?.[name];
it(`${field}.${name} is declared`, () => {
expect(range).toBeTypeOf('string');
});
for (const v of rejected) {
it(`${field}.${name} rejects ${v} (${advisory})`, () => {
expect(satisfies(v, range!)).toBe(false);
});
}
for (const v of admitted) {
it(`${field}.${name} admits ${v}`, () => {
expect(satisfies(v, range!)).toBe(true);
});
}
}
});
+15 -4
View File
@@ -1,8 +1,8 @@
{
"name": "@claude-flow/integration",
"version": "3.0.1",
"version": "3.0.3",
"type": "module",
"description": "Integration module - agentic-flow@alpha deep integration, ADR-001 compliance, TokenOptimizer",
"description": "agentic-flow integration for Ruflo (claude-flow) V3: TokenOptimizer (ReasoningBank compact context, Agent Booster edits), worker pools and swarm adapters.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
@@ -15,16 +15,18 @@
"build": "tsc"
},
"keywords": [
"ruflo",
"claude-flow",
"agentic-flow",
"token-optimizer",
"agent-booster",
"reasoningbank",
"anti-drift",
"swarm"
"swarm",
"multi-agent"
],
"peerDependencies": {
"agentic-flow": "^2.0.0-alpha"
"agentic-flow": "^2.0.14 || ^3.0.0"
},
"devDependencies": {
"vitest": "^4.1.0"
@@ -50,5 +52,14 @@
]
}
}
},
"homepage": "https://ruv.io",
"repository": {
"type": "git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/@claude-flow/integration"
},
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
+44
View File
@@ -1,5 +1,43 @@
# @claude-flow/mcp
<!-- adr-356:quickstart:start -->
![Animated diagram: an MCP client request travels through a transport and the MCPServer to the ToolRegistry and the tool handler](https://raw.githubusercontent.com/ruvnet/ruflo/main/v3/@claude-flow/mcp/assets/mcp-flow.svg)
**@claude-flow/mcp** — A standalone Model Context Protocol server: stdio, HTTP and WebSocket transports, a schema-checked tool registry, resources, prompts and tasks.
**Supported environments:** Node.js 20+ · ESM · Linux, macOS, Windows (pure JavaScript)
## Quickstart
```bash
npm install @claude-flow/mcp
```
```js
import { createToolRegistry, defineTool } from '@claude-flow/mcp';
const logger = { debug() {}, info() {}, warn: console.warn, error: console.error };
const registry = createToolRegistry(logger);
registry.register(defineTool('echo', 'Echo the input text', {
type: 'object', properties: { text: { type: 'string' } }, required: ['text'],
}, async ({ text }) => ({ echoed: text })));
console.log(registry.getToolNames());
const result = await registry.execute('echo', { text: 'hi' });
console.log(result.isError ?? false, result.content[0].text);
```
Expected output:
```text
[ 'echo' ]
false {
"echoed": "hi"
}
```
Used by [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli), which serves the Ruflo tools over this server.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/mcp.svg)](https://www.npmjs.com/package/@claude-flow/mcp)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/mcp.svg)](https://www.npmjs.com/package/@claude-flow/mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -427,3 +465,9 @@ const ErrorCodes = {
## License
MIT
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/@claude-flow/mcp)
<!-- adr-356:footer:end -->
@@ -0,0 +1,70 @@
/**
* Regression guard: the published dependency ranges must not admit versions
* with known advisories. Each row is (field, package, versions that must be
* rejected, versions that must be admitted).
*
* Ranges are restricted to `^X.Y.Z` alternatives joined by `||`, so the check
* below is exact without pulling semver into the package.
*/
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, it, expect } from 'vitest';
const here = dirname(fileURLToPath(import.meta.url));
const manifest = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8')) as Record<
string,
Record<string, string> | undefined
>;
type Version = { major: number; minor: number; patch: number; pre: boolean };
function parse(v: string): Version {
const m = /^(\d+)\.(\d+)\.(\d+)(-.+)?$/.exec(v);
if (!m) throw new Error(`not a version: ${v}`);
return { major: +m[1], minor: +m[2], patch: +m[3], pre: m[4] !== undefined };
}
function cmp(a: Version, b: Version): number {
return a.major - b.major || a.minor - b.minor || a.patch - b.patch;
}
/** Caret semantics for X >= 1: same major, >= floor, no prereleases. */
function satisfies(version: string, range: string): boolean {
const v = parse(version);
return range.split('||').some((part) => {
const m = /^\s*\^(\d+\.\d+\.\d+)\s*$/.exec(part);
if (!m) throw new Error(`unsupported range form: ${part.trim()}`);
const floor = parse(m[1]);
return !v.pre && v.major === floor.major && floor.major >= 1 && cmp(v, floor) >= 0;
});
}
const rows: Array<[field: string, name: string, advisory: string, rejected: string[], admitted: string[]]> = [
['dependencies', 'ws', 'GHSA-96hv-2xvq-fx4p', ['8.14.2', '8.20.1'], ['8.21.0', '8.22.2']],
['dependencies', 'express', 'GHSA-qw6h-vgh9-j6wx', ['4.18.2', '4.22.2'], ['4.22.3']],
['dependencies', 'ajv', 'GHSA-2g4f-4pwh-qvx6', ['8.12.0', '8.17.1'], ['8.20.0']],
];
describe('advisory-free dependency ranges', () => {
for (const [field, name, advisory, rejected, admitted] of rows) {
const range = manifest[field]?.[name];
it(`${field}.${name} is declared`, () => {
expect(range).toBeTypeOf('string');
});
for (const v of rejected) {
it(`${field}.${name} rejects ${v} (${advisory})`, () => {
expect(satisfies(v, range!)).toBe(false);
});
}
for (const v of admitted) {
it(`${field}.${name} admits ${v}`, () => {
expect(satisfies(v, range!)).toBe(true);
});
}
}
});
+22
View File
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 170" width="760" height="170" role="img" aria-labelledby="t d">
<title id="t">@claude-flow/mcp: request path through the server</title>
<desc id="d">An MCP client sends JSON-RPC over stdio, HTTP or WebSocket; the MCPServer validates the call and the ToolRegistry dispatches it to the tool handler.</desc>
<style>
.bg{fill:#1e293b}
.cap{fill:#e2e8f0;font:600 15px system-ui,-apple-system,Segoe UI,sans-serif}
.s rect{fill:#334155;stroke:#64748b;stroke-width:1.5}
.s{animation:pulse 6s infinite}
.h{fill:#f8fafc;font:600 13px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.t{fill:#cbd5e1;font:11px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.a{fill:none;stroke:#94a3b8;stroke-width:2}
.dot{fill:#38bdf8;animation:move 6s linear infinite}
@keyframes pulse{0%,20.0%{opacity:1}28.0%,100%{opacity:.62}}
@keyframes move{from{transform:translateX(0)}to{transform:translateX(600px)}}
@media (prefers-reduced-motion:reduce){.s,.dot{animation:none}}
</style>
<rect class="bg" width="760" height="170" rx="14"/>
<text class="cap" x="20" y="34">@claude-flow/mcp: request path through the server</text>
<path class="a" d="M147 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M297 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M447 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M597 90h14m-5 -4l5 4l-5 4"/>
<g class="s" style="animation-delay:0.0s"><rect x="16" y="58" width="128" height="64" rx="10"/><text class="h" x="80" y="85">MCP client</text><text class="t" x="80" y="104">JSON-RPC</text></g><g class="s" style="animation-delay:1.2s"><rect x="166" y="58" width="128" height="64" rx="10"/><text class="h" x="230" y="85">Transport</text><text class="t" x="230" y="104">stdio / http / ws</text></g><g class="s" style="animation-delay:2.4s"><rect x="316" y="58" width="128" height="64" rx="10"/><text class="h" x="380" y="85">MCPServer</text><text class="t" x="380" y="104">session, auth</text></g><g class="s" style="animation-delay:3.6s"><rect x="466" y="58" width="128" height="64" rx="10"/><text class="h" x="530" y="85">ToolRegistry</text><text class="t" x="530" y="104">schema check</text></g><g class="s" style="animation-delay:4.8s"><rect x="616" y="58" width="128" height="64" rx="10"/><text class="h" x="680" y="85">Tool handler</text><text class="t" x="680" y="104">result</text></g>
<circle class="dot" cx="80" cy="140" r="5"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

+16 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/mcp",
"version": "3.1.6",
"version": "3.1.7",
"type": "module",
"description": "Standalone MCP (Model Context Protocol) server - stdio/http/websocket transports, connection pooling, tool registry",
"main": "dist/index.js",
@@ -19,12 +19,12 @@
"build": "tsc"
},
"dependencies": {
"ajv": "^8.12.0",
"ajv": "^8.20.0",
"cors": "^2.8.5",
"express": "^4.18.2",
"express": "^4.22.3",
"express-rate-limit": "^8.4.1",
"helmet": "^7.1.0",
"ws": "^8.14.2"
"ws": "^8.21.0"
},
"devDependencies": {
"@types/cors": "^2.8.17",
@@ -33,8 +33,11 @@
"vitest": "^4.1.0"
},
"keywords": [
"ruflo",
"claude-flow",
"mcp",
"model-context-protocol",
"mcp-server",
"claude",
"ai-agents",
"json-rpc",
@@ -44,5 +47,14 @@
],
"publishConfig": {
"access": "public"
},
"homepage": "https://ruv.io",
"repository": {
"type": "git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/@claude-flow/mcp"
},
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
+11 -678
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -68,7 +68,7 @@
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^0.9.9",
"zod": "^3.25.76"
"zod": "^4.6.7"
},
"devDependencies": {
"@eslint/js": "^9.32.0",
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/plugin-code-intelligence
<!-- adr-356:quickstart:start -->
**@claude-flow/plugin-code-intelligence** — A Ruflo plugin that gives agents MCP tools for semantic code search, architecture analysis, refactoring impact, module splitting and pattern learning.
**Supported environments:** Node.js 20+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-code-intelligence
```
```js
import { codeIntelligenceTools, SemanticSearchInputSchema } from '@claude-flow/plugin-code-intelligence';
console.log('tools:', codeIntelligenceTools.map((t) => t.name).join(', '));
const check = SemanticSearchInputSchema.safeParse({ query: 'where is the auth middleware?' });
console.log('valid input:', check.success);
```
Expected output:
```text
tools: code/semantic-search, code/architecture-analyze, code/refactor-impact, code/split-suggest, code/learn-patterns
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-code-intelligence`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-code-intelligence.svg)](https://www.npmjs.com/package/@claude-flow/plugin-code-intelligence)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-code-intelligence.svg)](https://www.npmjs.com/package/@claude-flow/plugin-code-intelligence)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -379,3 +408,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/code-intelligence)
<!-- adr-356:footer:end -->
+8 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-code-intelligence",
"version": "3.0.0-alpha.3",
"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",
"type": "module",
"main": "./dist/index.js",
@@ -44,6 +44,7 @@
"tag": "v3alpha"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"code-intelligence",
@@ -57,11 +58,11 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/code-intelligence"
},
"dependencies": {
"zod": "^3.23.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
@@ -73,5 +74,9 @@
},
"engines": {
"node": ">=20.0.0"
},
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
@@ -56,8 +56,10 @@ export interface MCPTool<TInput = unknown, TOutput = unknown> {
description: string;
category: string;
version: string;
// zod 3 reads these params as <Output, Def, Input> and zod 4 as <Output, Input, Internals>;
// `any` in the last two keeps the type valid under both majors.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputSchema: z.ZodType<TInput, z.ZodTypeDef, any>;
inputSchema: z.ZodType<TInput, any, any>;
handler: (input: TInput, context: ToolContext) => Promise<MCPToolResult<TOutput>>;
}
@@ -0,0 +1,58 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* Below 4.6.6, zod validates every element of an oversized constrained
* collection before it reports the size violation, so a single request with a
* huge array allocates one issue per element. From 4.6.6 the size check short-
* circuits: the same input yields exactly one `too_big` issue on the
* collection itself. These run against this plugin's real input schema.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { SemanticSearchInputSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports one too_big issue for an oversized scope.paths list of invalid paths', () => {
const path = ['scope', 'paths'];
const result = SemanticSearchInputSchema.safeParse({ query: 'auth', scope: { paths: Array(5000).fill('x'.repeat(600)) } });
expect(result.success).toBe(false);
const issues = result.error!.issues.filter((i) =>
path.every((p, k) => i.path[k] === p),
);
expect(issues).toHaveLength(1);
expect(issues[0].code).toBe('too_big');
expect(issues[0].path).toEqual(path);
});
});
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/plugin-cognitive-kernel
<!-- adr-356:quickstart:start -->
**@claude-flow/plugin-cognitive-kernel** — A Ruflo plugin that gives agents MCP tools for working memory, attention control, meta-cognitive monitoring, task scaffolding and cognitive-load management.
**Supported environments:** Node.js 18+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-cognitive-kernel
```
```js
import { cognitiveKernelTools, AttentionFiltersSchema } from '@claude-flow/plugin-cognitive-kernel';
console.log('tools:', cognitiveKernelTools.map((t) => t.name).join(', '));
const check = AttentionFiltersSchema.safeParse({ includePatterns: ['src/**'] });
console.log('valid input:', check.success);
```
Expected output:
```text
tools: cognition/working-memory, cognition/attention-control, cognition/meta-monitor, cognition/scaffold, cognition/cognitive-load
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-cognitive-kernel`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-cognitive-kernel.svg)](https://www.npmjs.com/package/@claude-flow/plugin-cognitive-kernel)
[![license](https://img.shields.io/npm/l/@claude-flow/plugin-cognitive-kernel.svg)](https://github.com/ruvnet/claude-flow/blob/main/LICENSE)
[![downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-cognitive-kernel.svg)](https://www.npmjs.com/package/@claude-flow/plugin-cognitive-kernel)
@@ -313,3 +342,9 @@ interface CognitiveKernelConfig {
## License
MIT
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/cognitive-kernel)
<!-- adr-356:footer:end -->
File diff suppressed because it is too large. Load diff
+10 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-cognitive-kernel",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"description": "Cognitive kernel plugin for LLM augmentation with working memory, attention control, meta-cognition, and scaffolding",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -40,24 +40,26 @@
"prepublishOnly": "npm run clean && npm run build && npm run typecheck"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"cognitive-kernel",
"working-memory",
"attention",
"meta-cognition",
"scaffolding",
"sona",
"cognitum"
"mcp"
],
"author": "Claude Flow Team",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/cognitive-kernel"
},
"dependencies": {
"zod": "^3.22.4"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.10.0",
@@ -71,5 +73,9 @@
"publishConfig": {
"access": "public",
"tag": "v3alpha"
},
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
@@ -0,0 +1,58 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* Below 4.6.6, zod validates every element of an oversized constrained
* collection before it reports the size violation, so a single request with a
* huge array allocates one issue per element. From 4.6.6 the size check short-
* circuits: the same input yields exactly one `too_big` issue on the
* collection itself. These run against this plugin's real input schema.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { AttentionFiltersSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports one too_big issue for an oversized includePatterns list', () => {
const path = ['includePatterns'];
const result = AttentionFiltersSchema.safeParse({ includePatterns: Array(5000).fill('x'.repeat(300)) });
expect(result.success).toBe(false);
const issues = result.error!.issues.filter((i) =>
path.every((p, k) => i.path[k] === p),
);
expect(issues).toHaveLength(1);
expect(issues[0].code).toBe('too_big');
expect(issues[0].path).toEqual(path);
});
});
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/plugin-financial-risk
<!-- adr-356:quickstart:start -->
**@claude-flow/plugin-financial-risk** — A Ruflo plugin that gives agents MCP tools for portfolio risk (VaR, CVaR), transaction anomaly detection, market regime classification, compliance checks and stress tests.
**Supported environments:** Node.js 20+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-financial-risk
```
```js
import { financialTools, MarketRegimeInputSchema } from '@claude-flow/plugin-financial-risk';
console.log('tools:', financialTools.map((t) => t.name).join(', '));
const check = MarketRegimeInputSchema.safeParse({ marketData: { prices: Array.from({ length: 30 }, (_, i) => 100 + i) } });
console.log('valid input:', check.success);
```
Expected output:
```text
tools: finance/portfolio-risk, finance/anomaly-detect, finance/market-regime, finance/compliance-check, finance/stress-test
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-financial-risk`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-financial-risk.svg)](https://www.npmjs.com/package/@claude-flow/plugin-financial-risk)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-financial-risk.svg)](https://www.npmjs.com/package/@claude-flow/plugin-financial-risk)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -341,3 +370,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/financial-risk)
<!-- adr-356:footer:end -->
+6 -14
View File
@@ -1,15 +1,15 @@
{
"name": "@claude-flow/plugin-financial-risk",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@claude-flow/plugin-financial-risk",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"license": "MIT",
"dependencies": {
"zod": "^3.22.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
@@ -21,14 +21,6 @@
},
"optionalDependencies": {
"ruvector-gnn-wasm": "^0.1.0"
},
"peerDependencies": {
"@claude-flow/ruvector-upstream": ">=3.0.0-alpha.1"
},
"peerDependenciesMeta": {
"@claude-flow/ruvector-upstream": {
"optional": true
}
}
},
"node_modules/@esbuild/aix-ppc64": {
@@ -1859,9 +1851,9 @@
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
+6 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-financial-risk",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"description": "High-performance financial risk analysis plugin with portfolio risk scoring, anomaly detection, market regime classification, and compliance reporting using RuVector WASM packages.",
"type": "module",
"main": "./dist/index.js",
@@ -51,6 +51,7 @@
"tag": "v3alpha"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"financial-risk",
@@ -69,18 +70,18 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/financial-risk"
},
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues"
"url": "https://github.com/ruvnet/ruflo/issues"
},
"homepage": "https://github.com/ruvnet/claude-flow/tree/main/v3/plugins/financial-risk#readme",
"homepage": "https://ruv.io",
"engines": {
"node": ">=20.0.0"
},
"dependencies": {
"zod": "^3.22.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
@@ -0,0 +1,58 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* Below 4.6.6, zod validates every element of an oversized constrained
* collection before it reports the size violation, so a single request with a
* huge array allocates one issue per element. From 4.6.6 the size check short-
* circuits: the same input yields exactly one `too_big` issue on the
* collection itself. These run against this plugin's real input schema.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { AnomalyDetectInputSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports one too_big issue for an oversized parties list', () => {
const path = ['transactions', 0, 'parties'];
const result = AnomalyDetectInputSchema.safeParse({ transactions: [{ id: crypto.randomUUID(), amount: 1, timestamp: new Date().toISOString(), parties: Array(5000).fill('x'.repeat(300)) }] });
expect(result.success).toBe(false);
const issues = result.error!.issues.filter((i) =>
path.every((p, k) => i.path[k] === p),
);
expect(issues).toHaveLength(1);
expect(issues[0].code).toBe('too_big');
expect(issues[0].path).toEqual(path);
});
});
+43
View File
@@ -1,5 +1,42 @@
# @claude-flow/plugin-gastown-bridge
<!-- adr-356:quickstart:start -->
![Animated diagram: an agent calls a gt_ MCP tool, inputs are validated, and the bridge runs the gt or bd CLI against Gas Town](https://raw.githubusercontent.com/ruvnet/ruflo/main/v3/plugins/gastown-bridge/assets/gastown-flow.svg)
**@claude-flow/plugin-gastown-bridge** — A Ruflo plugin that lets agents drive the [Gas Town](https://github.com/steveyegge/gastown) orchestrator (beads, convoys, formulas) through validated MCP tools that call the `gt` and `bd` CLIs.
**Supported environments:** Node.js 20+ · ESM and CommonJS · the `gt`/`bd` CLIs for live calls
## Quickstart
```bash
npm install @claude-flow/plugin-gastown-bridge
```
```js
import { GasTownBridgePlugin, validateBeadId } from '@claude-flow/plugin-gastown-bridge';
const plugin = new GasTownBridgePlugin();
console.log('tools:', plugin.getMCPTools().length);
console.log('bead id:', validateBeadId('gt-abc12'));
try {
validateBeadId('gt-abc; echo injected');
} catch (err) {
console.log('rejected:', err.code);
}
```
Expected output:
```text
tools: 20
bead id: gt-abc12
rejected: GT_INVALID_BEAD_ID
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-gastown-bridge`.
<!-- adr-356:quickstart:end -->
> **WASM-Accelerated Bridge to Steve Yegge's Gas Town Multi-Agent Orchestrator**
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-gastown-bridge.svg)](https://www.npmjs.com/package/@claude-flow/plugin-gastown-bridge)
@@ -647,3 +684,9 @@ MIT License - see [LICENSE](./LICENSE) for details.
---
**Built with ❤️ by the Claude Flow Team**
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/gastown-bridge)
<!-- adr-356:footer:end -->
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 170" width="760" height="170" role="img" aria-labelledby="t d">
<title id="t">gastown-bridge: agent call to Gas Town CLI</title>
<desc id="d">A Claude Flow agent calls a gt_ MCP tool; inputs pass validators and sanitizers before the bridge runs the gt or bd CLI against Gas Town beads and convoys.</desc>
<style>
.bg{fill:#1e293b}
.cap{fill:#e2e8f0;font:600 15px system-ui,-apple-system,Segoe UI,sans-serif}
.s rect{fill:#334155;stroke:#64748b;stroke-width:1.5}
.s{animation:pulse 6s infinite}
.h{fill:#f8fafc;font:600 13px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.t{fill:#cbd5e1;font:11px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.a{fill:none;stroke:#94a3b8;stroke-width:2}
.dot{fill:#38bdf8;animation:move 6s linear infinite}
@keyframes pulse{0%,20.0%{opacity:1}28.0%,100%{opacity:.62}}
@keyframes move{from{transform:translateX(0)}to{transform:translateX(600px)}}
@media (prefers-reduced-motion:reduce){.s,.dot{animation:none}}
</style>
<rect class="bg" width="760" height="170" rx="14"/>
<text class="cap" x="20" y="34">gastown-bridge: agent call to Gas Town CLI</text>
<path class="a" d="M147 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M297 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M447 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M597 90h14m-5 -4l5 4l-5 4"/>
<g class="s" style="animation-delay:0.0s"><rect x="16" y="58" width="128" height="64" rx="10"/><text class="h" x="80" y="85">Agent</text><text class="t" x="80" y="104">Claude Flow</text></g><g class="s" style="animation-delay:1.2s"><rect x="166" y="58" width="128" height="64" rx="10"/><text class="h" x="230" y="85">MCP tools</text><text class="t" x="230" y="104">gt_* (20)</text></g><g class="s" style="animation-delay:2.4s"><rect x="316" y="58" width="128" height="64" rx="10"/><text class="h" x="380" y="85">Validate</text><text class="t" x="380" y="104">IDs, args, output</text></g><g class="s" style="animation-delay:3.6s"><rect x="466" y="58" width="128" height="64" rx="10"/><text class="h" x="530" y="85">gt / bd CLI</text><text class="t" x="530" y="104">safe argv</text></g><g class="s" style="animation-delay:4.8s"><rect x="616" y="58" width="128" height="64" rx="10"/><text class="h" x="680" y="85">Gas Town</text><text class="t" x="680" y="104">beads, convoys</text></g>
<circle class="dot" cx="80" cy="140" r="5"/>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+2078 -141
View File
File diff suppressed because it is too large. Load diff
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-gastown-bridge",
"version": "0.1.5",
"version": "0.1.6",
"description": "Gas Town orchestrator integration for Claude Flow V3 with WASM-accelerated formula parsing and graph analysis",
"type": "module",
"main": "./dist/index.cjs",
@@ -54,6 +54,7 @@
"prepublishOnly": "npm run build"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"gastown",
@@ -62,19 +63,20 @@
"workflows",
"formulas",
"wasm",
"multi-agent"
"multi-agent",
"mcp"
],
"author": "rUv",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/gastown-bridge"
},
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues"
"url": "https://github.com/ruvnet/ruflo/issues"
},
"homepage": "https://github.com/ruvnet/claude-flow/tree/main/v3/plugins/gastown-bridge#readme",
"homepage": "https://ruv.io",
"engines": {
"node": ">=20.0.0"
},
@@ -88,13 +90,11 @@
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"uuid": "^9.0.0",
"zod": "^3.22.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@size-limit/preset-small-lib": "^11.0.0",
"@types/node": "^20.0.0",
"@types/uuid": "^9.0.0",
"esbuild": "^0.20.0",
"size-limit": "^11.0.0",
"tsup": "^8.0.0",
@@ -127,7 +127,7 @@ export const BeadSchema = z.object({
type: BeadTypeSchema,
content: z.string(),
timestamp: z.string().datetime().optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
parentId: BeadIdSchema.optional(),
threadId: z.string().optional(),
agentId: z.string().optional(),
@@ -99,7 +99,7 @@ const AgentDBEntrySchema = z.object({
key: z.string(),
value: z.unknown(),
namespace: z.string().optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
embedding: z.array(z.number()).optional(),
createdAt: z.string().datetime().optional(),
updatedAt: z.string().datetime().optional(),
@@ -17,7 +17,7 @@
import { EventEmitter } from 'events';
import { z } from 'zod';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'node:crypto';
import type {
Convoy,
ConvoyStatus,
@@ -221,7 +221,7 @@ export class ConvoyTracker extends EventEmitter {
const progress = await this.calculateProgress(verifiedIssues);
// Create convoy
const convoyId = uuidv4();
const convoyId = randomUUID();
const now = new Date();
const convoy: Convoy = {
+4 -4
View File
@@ -153,7 +153,7 @@ const HookedWorkItemSchema = z.object({
formula: z.string().optional(),
progress: z.number().min(0).max(100),
error: z.string().optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
});
/**
@@ -189,7 +189,7 @@ const StepSchema = z.object({
needs: z.array(z.string()).optional(),
duration: z.number().optional(),
requires: z.array(z.string()).optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
});
/**
@@ -216,9 +216,9 @@ const FormulaStateSchema = z.object({
version: z.number(),
legs: z.array(LegSchema).optional(),
steps: z.array(StepSchema).optional(),
vars: z.record(VarSchema).optional(),
vars: z.record(z.string(), VarSchema).optional(),
}),
vars: z.record(z.string()),
vars: z.record(z.string(), z.string()),
startedAt: z.coerce.date(),
status: z.enum(['cooking', 'cooked', 'executing', 'completed', 'failed']),
});
+15 -9
View File
@@ -1214,27 +1214,33 @@ export class GasTownBridgePlugin extends EventEmitter implements IPlugin {
private zodToJsonSchema(zodSchema: unknown): { type: 'object'; properties: Record<string, unknown>; required?: string[] } {
// Simplified conversion - in production use zod-to-json-schema
try {
const schema = zodSchema as { _def?: { shape?: () => Record<string, unknown> } };
// zod 3 keeps the object shape behind a function and names types as
// `_def.typeName` ('ZodNumber'); zod 4 stores the shape itself and names
// types as `_def.type` ('number'). Read both, then match case-insensitively.
const schema = zodSchema as {
_def?: { shape?: Record<string, unknown> | (() => Record<string, unknown>) };
};
if (schema._def?.shape) {
const shape = schema._def.shape();
const rawShape = schema._def.shape;
const shape = typeof rawShape === 'function' ? rawShape() : rawShape;
const properties: Record<string, unknown> = {};
const required: string[] = [];
for (const [key, value] of Object.entries(shape)) {
const fieldSchema = value as { _def?: { typeName?: string; innerType?: unknown } };
const typeName = fieldSchema._def?.typeName ?? 'ZodString';
const fieldSchema = value as { _def?: { typeName?: string; type?: string; innerType?: unknown } };
const typeName = (fieldSchema._def?.typeName ?? fieldSchema._def?.type ?? 'string').toLowerCase();
// Map Zod types to JSON Schema types
let jsonType = 'string';
if (typeName.includes('Number')) jsonType = 'number';
else if (typeName.includes('Boolean')) jsonType = 'boolean';
else if (typeName.includes('Array')) jsonType = 'array';
else if (typeName.includes('Object')) jsonType = 'object';
if (typeName.includes('number')) jsonType = 'number';
else if (typeName.includes('boolean')) jsonType = 'boolean';
else if (typeName.includes('array')) jsonType = 'array';
else if (typeName.includes('object')) jsonType = 'object';
properties[key] = { type: jsonType };
// Check if required (not optional)
if (!typeName.includes('Optional') && !typeName.includes('Default')) {
if (!typeName.includes('optional') && !typeName.includes('default')) {
required.push(key);
}
}
+4 -2
View File
@@ -86,8 +86,10 @@ export interface MCPTool<TInput = unknown, TOutput = unknown> {
version: string;
/** Execution layer (cli, wasm, hybrid) */
layer: 'cli' | 'wasm' | 'hybrid';
/** Input schema */
inputSchema: z.ZodType<TInput, z.ZodTypeDef, unknown>;
/** Input schema. zod 3 reads the params as <Output, Def, Input> and zod 4 as
* <Output, Input, Internals>; `any` in the last two keeps it valid under both. */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputSchema: z.ZodType<TInput, any, any>;
/** Handler function */
handler: (input: TInput, context: ToolContext) => Promise<MCPToolResult<TOutput>>;
}
+6 -6
View File
@@ -125,9 +125,9 @@ const RawFormulaSchema = z.object({
needs: z.array(z.string()).optional(),
duration: z.number().optional(),
requires: z.array(z.string()).optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
})).optional(),
vars: z.record(z.object({
vars: z.record(z.string(), z.object({
name: z.string().default(''),
description: z.string().optional(),
default: z.string().optional(),
@@ -151,7 +151,7 @@ const RawFormulaSchema = z.object({
advice: z.string().default(''),
type: z.enum(['before', 'after', 'around']).default('after'),
})).optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
}).passthrough();
/**
@@ -225,7 +225,7 @@ export function sanitizeBeadOutput(raw: string): Bead {
if (!result.success) {
throw BeadsError.parseFailed(
raw,
new Error(result.error.errors.map(e => e.message).join('; '))
new Error(result.error.issues.map(e => e.message).join('; '))
);
}
@@ -298,7 +298,7 @@ export function sanitizeFormulaOutput(raw: string): Formula {
if (!result.success) {
throw FormulaError.parseFailed(
'output',
result.error.errors.map(e => e.message).join('; ')
result.error.issues.map(e => e.message).join('; ')
);
}
@@ -385,7 +385,7 @@ export function sanitizeConvoyOutput(raw: string): Convoy {
const result = RawConvoySchema.safeParse(parsed);
if (!result.success) {
throw ConvoyError.createFailed(
result.error.errors.map(e => e.message).join('; ')
result.error.issues.map(e => e.message).join('; ')
);
}
+3 -3
View File
@@ -532,7 +532,7 @@ export const StepSchema = z.object({
needs: z.array(z.string()).optional(),
duration: z.number().optional(),
requires: z.array(z.string()).optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
});
/**
@@ -598,10 +598,10 @@ export const FormulaSchema = z.object({
legs: z.array(LegSchema).optional(),
synthesis: SynthesisSchema.optional(),
steps: z.array(StepSchema).optional(),
vars: z.record(VarSchema).optional(),
vars: z.record(z.string(), VarSchema).optional(),
templates: z.array(TemplateSchema).optional(),
aspects: z.array(AspectSchema).optional(),
metadata: z.record(z.unknown()).optional(),
metadata: z.record(z.string(), z.unknown()).optional(),
});
/**
-14
View File
@@ -1,14 +0,0 @@
/**
* Type declarations for uuid module
*/
declare module 'uuid' {
export function v4(): string;
export function v1(): string;
export function v3(name: string, namespace: string): string;
export function v5(name: string, namespace: string): string;
export function validate(uuid: string): boolean;
export function version(uuid: string): number;
export function parse(uuid: string): Uint8Array;
export function stringify(arr: Uint8Array): string;
export const NIL: string;
}
+6 -6
View File
@@ -267,7 +267,7 @@ export const LabelsSchema = z.array(
export function validateBeadId(id: string): string {
const result = BeadIdSchema.safeParse(id);
if (!result.success) {
const errors = result.error.errors.map(e => e.message).join('; ');
const errors = result.error.issues.map(e => e.message).join('; ');
throw ValidationError.invalidBeadId(id);
}
return result.data;
@@ -364,9 +364,9 @@ export function validateGtArgs(args: string[]): string[] {
const result = GtArgsSchema.safeParse(args);
if (!result.success) {
const errors = result.error.errors;
const errors = result.error.issues;
const constraints = errors.map((e, idx) => ({
field: `args[${e.path[0] ?? idx}]`,
field: `args[${String(e.path[0] ?? idx)}]`,
constraint: 'safe CLI argument',
actual: args[Number(e.path[0])]?.slice(0, 20) + '...',
}));
@@ -447,7 +447,7 @@ export const SlingOptionsSchema = z.object({
export function validateCreateBeadOptions(options: unknown): z.infer<typeof CreateBeadOptionsSchema> {
const result = CreateBeadOptionsSchema.safeParse(options);
if (!result.success) {
const errors = result.error.errors;
const errors = result.error.issues;
const constraints = errors.map(e => ({
field: e.path.join('.'),
constraint: e.message,
@@ -467,7 +467,7 @@ export function validateCreateBeadOptions(options: unknown): z.infer<typeof Crea
export function validateCreateConvoyOptions(options: unknown): z.infer<typeof CreateConvoyOptionsSchema> {
const result = CreateConvoyOptionsSchema.safeParse(options);
if (!result.success) {
const errors = result.error.errors;
const errors = result.error.issues;
const constraints = errors.map(e => ({
field: e.path.join('.'),
constraint: e.message,
@@ -487,7 +487,7 @@ export function validateCreateConvoyOptions(options: unknown): z.infer<typeof Cr
export function validateSlingOptions(options: unknown): z.infer<typeof SlingOptionsSchema> {
const result = SlingOptionsSchema.safeParse(options);
if (!result.success) {
const errors = result.error.errors;
const errors = result.error.issues;
const constraints = errors.map(e => ({
field: e.path.join('.'),
constraint: e.message,
@@ -70,7 +70,7 @@ const VarSchema = z.object({
// Synthesis schema
const SynthesisSchema = z.object({
template: z.string(),
vars: z.record(z.string()).optional(),
vars: z.record(z.string(), z.string()).optional(),
});
// Template schema (for expansion formulas)
@@ -99,7 +99,7 @@ const FormulaSchema = z.object({
synthesis: SynthesisSchema.optional(),
// Workflow-specific
steps: z.array(StepSchema).optional(),
vars: z.record(VarSchema).optional(),
vars: z.record(z.string(), VarSchema).optional(),
// Expansion-specific
template: z.array(TemplateSchema).optional(),
// Aspect-specific
@@ -151,7 +151,7 @@ const AgentSchema = z.object({
// Cooked formula schema (after variable substitution)
const CookedFormulaSchema = FormulaSchema.extend({
cooked_at: z.string().datetime().or(z.date()),
vars_applied: z.record(z.string()),
vars_applied: z.record(z.string(), z.string()),
});
// ============================================================================
@@ -0,0 +1,50 @@
/**
* zod 3/4 compatibility
*
* These run against the real schemas. Under zod 4, `ZodError.errors` is gone
* (only `.issues` remains) and an object's `_def.shape` is a plain object
* rather than a function, which broke error reporting and MCP tool schemas.
*/
import { describe, it, expect } from 'vitest';
import { GasTownBridgePlugin } from '../src/index.js';
import { BeadsError, GasTownErrorCode } from '../src/errors.js';
import { sanitizeBeadOutput } from '../src/sanitizers.js';
import { validateBeadId } from '../src/validators.js';
describe('validation errors', () => {
it('reports a schema failure as BeadsError with the zod message', () => {
let thrown: unknown;
try {
sanitizeBeadOutput('{"title":"no id"}');
} catch (err) {
thrown = err;
}
expect(thrown).toBeInstanceOf(BeadsError);
expect((thrown as BeadsError).code).toBe(GasTownErrorCode.BEAD_PARSE_FAILED);
expect((thrown as BeadsError).cause?.message).toMatch(/\S/);
});
it('rejects an invalid bead ID with a ValidationError, not a TypeError', () => {
expect(() => validateBeadId('gt-abc; rm -rf /')).toThrow(/bead/i);
expect(() => validateBeadId('gt-abc; rm -rf /')).not.toThrow(TypeError);
});
});
describe('MCP tool input schemas', () => {
it('converts a zod object schema into JSON Schema properties', () => {
const plugin = new GasTownBridgePlugin();
const tool = plugin.getMCPTools().find((t) => t.name === 'gt_beads_create');
expect(tool).toBeDefined();
const schema = tool!.inputSchema as {
properties: Record<string, { type: string }>;
required?: string[];
};
expect(schema.properties.title).toEqual({ type: 'string' });
expect(Object.keys(schema.properties)).toContain('priority');
expect(schema.required).toContain('title');
expect(schema.required).not.toContain('priority');
});
});
@@ -0,0 +1,43 @@
/**
* Dependency floor: zod >= 4.6.6 (GHSA-mrhx-c7xc-m3w5) and no `uuid` package
* (GHSA-w5hq-g745-h8pq). Convoy IDs now come from `crypto.randomUUID()`, which
* emits RFC 9562 v4 IDs, so they must still pass zod 4's stricter `.uuid()`.
*/
import { randomUUID } from 'node:crypto';
import { readFileSync } from 'node:fs';
import { describe, it, expect } from 'vitest';
import { validateConvoyId } from '../src/validators.js';
const pkg = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as Record<string, Record<string, string> | undefined>;
describe('dependency floor', () => {
it('declares zod ^4.6.6 or later', () => {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(String(pkg.dependencies?.zod));
expect(m).not.toBeNull();
const [major, minor, patch] = m!.slice(1).map(Number);
expect(major).toBe(4);
expect(minor * 1000 + patch).toBeGreaterThanOrEqual(6 * 1000 + 6);
});
it('does not depend on the uuid package', () => {
for (const field of ['dependencies', 'peerDependencies', 'optionalDependencies']) {
expect(pkg[field]?.uuid).toBeUndefined();
}
});
});
describe('convoy IDs', () => {
it('accepts IDs from crypto.randomUUID()', () => {
for (let i = 0; i < 50; i++) {
const id = randomUUID();
expect(validateConvoyId(id)).toBe(id);
}
});
it('rejects an ID that is not a UUID', () => {
expect(() => validateConvoyId('convoy-1; rm -rf /')).toThrow(/convoy/i);
});
});
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/plugin-healthcare-clinical
<!-- adr-356:quickstart:start -->
**@claude-flow/plugin-healthcare-clinical** — A Ruflo plugin that gives agents MCP tools for patient similarity search, drug interaction checks, clinical pathways, literature search and medical ontology navigation.
**Supported environments:** Node.js 20+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-healthcare-clinical
```
```js
import { healthcareTools, PatientSimilarityInputSchema } from '@claude-flow/plugin-healthcare-clinical';
console.log('tools:', healthcareTools.map((t) => t.name).join(', '));
const check = PatientSimilarityInputSchema.safeParse({ patientFeatures: { diagnoses: ['E11.9', 'I10'] } });
console.log('valid input:', check.success);
```
Expected output:
```text
tools: healthcare/patient-similarity, healthcare/drug-interactions, healthcare/clinical-pathways, healthcare/literature-search, healthcare/ontology-navigate
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-healthcare-clinical`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-healthcare-clinical.svg)](https://www.npmjs.com/package/@claude-flow/plugin-healthcare-clinical)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-healthcare-clinical.svg)](https://www.npmjs.com/package/@claude-flow/plugin-healthcare-clinical)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -278,3 +307,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/healthcare-clinical)
<!-- adr-356:footer:end -->
+6 -14
View File
@@ -1,15 +1,15 @@
{
"name": "@claude-flow/plugin-healthcare-clinical",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@claude-flow/plugin-healthcare-clinical",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"license": "MIT",
"dependencies": {
"zod": "^3.22.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
@@ -21,14 +21,6 @@
},
"optionalDependencies": {
"ruvector-gnn-wasm": "^0.1.0"
},
"peerDependencies": {
"@claude-flow/ruvector-upstream": ">=3.0.0-alpha.1"
},
"peerDependenciesMeta": {
"@claude-flow/ruvector-upstream": {
"optional": true
}
}
},
"node_modules/@esbuild/aix-ppc64": {
@@ -1859,9 +1851,9 @@
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
+6 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-healthcare-clinical",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"description": "HIPAA-compliant clinical decision support plugin with patient similarity search, drug interaction detection, and clinical pathway recommendations using RuVector WASM packages.",
"type": "module",
"main": "./dist/index.js",
@@ -51,6 +51,7 @@
"tag": "v3alpha"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"healthcare",
@@ -68,18 +69,18 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/healthcare-clinical"
},
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues"
"url": "https://github.com/ruvnet/ruflo/issues"
},
"homepage": "https://github.com/ruvnet/claude-flow/tree/main/v3/plugins/healthcare-clinical#readme",
"homepage": "https://ruv.io",
"engines": {
"node": ">=20.0.0"
},
"dependencies": {
"zod": "^3.22.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
@@ -0,0 +1,58 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* Below 4.6.6, zod validates every element of an oversized constrained
* collection before it reports the size violation, so a single request with a
* huge array allocates one issue per element. From 4.6.6 the size check short-
* circuits: the same input yields exactly one `too_big` issue on the
* collection itself. These run against this plugin's real input schema.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { PatientSimilarityInputSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports one too_big issue for an oversized diagnoses list of malformed codes', () => {
const path = ['patientFeatures', 'diagnoses'];
const result = PatientSimilarityInputSchema.safeParse({ patientFeatures: { diagnoses: Array(5000).fill('not-icd10') } });
expect(result.success).toBe(false);
const issues = result.error!.issues.filter((i) =>
path.every((p, k) => i.path[k] === p),
);
expect(issues).toHaveLength(1);
expect(issues[0].code).toBe('too_big');
expect(issues[0].path).toEqual(path);
});
});
+41
View File
@@ -1,5 +1,40 @@
# @claude-flow/plugin-hyperbolic-reasoning
<!-- adr-356:quickstart:start -->
![Animated diagram: a hierarchy is embedded in the Poincare ball and distances answer search, taxonomy and entailment queries](https://raw.githubusercontent.com/ruvnet/ruflo/main/v3/plugins/hyperbolic-reasoning/assets/hyperbolic-flow.svg)
**@claude-flow/plugin-hyperbolic-reasoning** — A Ruflo plugin that embeds hierarchies in the Poincaré ball and gives agents MCP tools for hierarchical search, taxonomic reasoning, hierarchy comparison and entailment graphs.
**Supported environments:** Node.js 20+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-hyperbolic-reasoning
```
```js
import { hyperbolicReasoningTools, poincareDistance } from '@claude-flow/plugin-hyperbolic-reasoning';
console.log('tools:', hyperbolicReasoningTools.map((t) => t.name).join(', '));
// Distance in the Poincare ball (curvature 1) grows fast near the boundary,
// which is what lets deep hierarchies fit in few dimensions.
const origin = new Float32Array([0, 0]);
console.log('d(origin, 0.5):', poincareDistance(origin, new Float32Array([0.5, 0]), 1).toFixed(4));
console.log('d(origin, 0.9):', poincareDistance(origin, new Float32Array([0.9, 0]), 1).toFixed(4));
```
Expected output:
```text
tools: hyperbolic_embed_hierarchy, hyperbolic_taxonomic_reason, hyperbolic_semantic_search, hyperbolic_hierarchy_compare, hyperbolic_entailment_graph
d(origin, 0.5): 1.0986
d(origin, 0.9): 2.9444
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-hyperbolic-reasoning`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-hyperbolic-reasoning.svg)](https://www.npmjs.com/package/@claude-flow/plugin-hyperbolic-reasoning)
[![license](https://img.shields.io/npm/l/@claude-flow/plugin-hyperbolic-reasoning.svg)](https://github.com/ruvnet/claude-flow/blob/main/LICENSE)
[![downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-hyperbolic-reasoning.svg)](https://www.npmjs.com/package/@claude-flow/plugin-hyperbolic-reasoning)
@@ -316,3 +351,9 @@ The plugin supports learning optimal curvature per hierarchy:
## License
MIT
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/hyperbolic-reasoning)
<!-- adr-356:footer:end -->
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 170" width="760" height="170" role="img" aria-labelledby="t d">
<title id="t">hyperbolic-reasoning: hierarchy to answers</title>
<desc id="d">A hierarchy of nodes and edges is embedded in the Poincare ball, where distances drive search, taxonomy and entailment queries.</desc>
<style>
.bg{fill:#1e293b}
.cap{fill:#e2e8f0;font:600 15px system-ui,-apple-system,Segoe UI,sans-serif}
.s rect{fill:#334155;stroke:#64748b;stroke-width:1.5}
.s{animation:pulse 4.8s infinite}
.h{fill:#f8fafc;font:600 13px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.t{fill:#cbd5e1;font:11px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.a{fill:none;stroke:#94a3b8;stroke-width:2}
.dot{fill:#38bdf8;animation:move 4.8s linear infinite}
@keyframes pulse{0%,25.0%{opacity:1}33.0%,100%{opacity:.62}}
@keyframes move{from{transform:translateX(0)}to{transform:translateX(561px)}}
@media (prefers-reduced-motion:reduce){.s,.dot{animation:none}}
</style>
<rect class="bg" width="760" height="170" rx="14"/>
<text class="cap" x="20" y="34">hyperbolic-reasoning: hierarchy to answers</text>
<path class="a" d="M184 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M371 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M558 90h14m-5 -4l5 4l-5 4"/>
<g class="s" style="animation-delay:0.0s"><rect x="16" y="58" width="165" height="64" rx="10"/><text class="h" x="98.5" y="85">Hierarchy</text><text class="t" x="98.5" y="104">nodes + edges</text></g><g class="s" style="animation-delay:1.2s"><rect x="203" y="58" width="165" height="64" rx="10"/><text class="h" x="285.5" y="85">Poincare ball</text><text class="t" x="285.5" y="104">embedding</text></g><g class="s" style="animation-delay:2.4s"><rect x="390" y="58" width="165" height="64" rx="10"/><text class="h" x="472.5" y="85">Distance</text><text class="t" x="472.5" y="104">search, compare</text></g><g class="s" style="animation-delay:3.6s"><rect x="577" y="58" width="165" height="64" rx="10"/><text class="h" x="659.5" y="85">Answers</text><text class="t" x="659.5" y="104">taxonomy, entailment</text></g>
<circle class="dot" cx="98.5" cy="140" r="5"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+6 -14
View File
@@ -1,15 +1,15 @@
{
"name": "@claude-flow/plugin-hyperbolic-reasoning",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@claude-flow/plugin-hyperbolic-reasoning",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"license": "MIT",
"dependencies": {
"zod": "^3.22.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
@@ -24,14 +24,6 @@
"@ruvector/gnn-wasm": "^0.1.0",
"@ruvector/hyperbolic-hnsw-wasm": "^0.1.0",
"@ruvector/sona": "^0.1.0"
},
"peerDependencies": {
"@claude-flow/ruvector-upstream": ">=3.0.0"
},
"peerDependenciesMeta": {
"@claude-flow/ruvector-upstream": {
"optional": true
}
}
},
"node_modules/@esbuild/aix-ppc64": {
@@ -1986,9 +1978,9 @@
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
+6 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-hyperbolic-reasoning",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"description": "Hyperbolic reasoning plugin providing Poincare ball embeddings, taxonomic reasoning, hierarchical search, and entailment graphs for superior hierarchical understanding.",
"type": "module",
"main": "./dist/index.js",
@@ -51,6 +51,7 @@
"tag": "v3alpha"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"hyperbolic",
@@ -66,18 +67,18 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/hyperbolic-reasoning"
},
"bugs": {
"url": "https://github.com/ruvnet/claude-flow/issues"
"url": "https://github.com/ruvnet/ruflo/issues"
},
"homepage": "https://github.com/ruvnet/claude-flow/tree/main/v3/plugins/hyperbolic-reasoning#readme",
"homepage": "https://ruv.io",
"engines": {
"node": ">=20.0.0"
},
"dependencies": {
"zod": "^3.22.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
+1 -1
View File
@@ -350,7 +350,7 @@ export interface EntailmentQueryResult {
export const HierarchyNodeSchema = z.object({
id: z.string().max(200),
parent: z.string().max(200).nullable(),
features: z.record(z.unknown()).optional(),
features: z.record(z.string(), z.unknown()).optional(),
label: z.string().max(500).optional(),
depth: z.number().int().min(0).optional(),
});
@@ -0,0 +1,58 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* Below 4.6.6, zod validates every element of an oversized constrained
* collection before it reports the size violation, so a single request with a
* huge array allocates one issue per element. From 4.6.6 the size check short-
* circuits: the same input yields exactly one `too_big` issue on the
* collection itself. These run against this plugin's real input schema.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { EntailmentGraphInputSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports one too_big issue for an oversized concepts list of malformed concepts', () => {
const path = ['concepts'];
const result = EntailmentGraphInputSchema.safeParse({ action: 'build', concepts: Array(100100).fill({ id: 1 }) });
expect(result.success).toBe(false);
const issues = result.error!.issues.filter((i) =>
path.every((p, k) => i.path[k] === p),
);
expect(issues).toHaveLength(1);
expect(issues[0].code).toBe('too_big');
expect(issues[0].path).toEqual(path);
});
});
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/plugin-legal-contracts
<!-- adr-356:quickstart:start -->
**@claude-flow/plugin-legal-contracts** — A Ruflo plugin that gives agents MCP tools for clause extraction, contract risk assessment, contract comparison, obligation tracking and playbook matching.
**Supported environments:** Node.js 20+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-legal-contracts
```
```js
import { legalContractsTools, ClauseExtractInputSchema } from '@claude-flow/plugin-legal-contracts';
console.log('tools:', legalContractsTools.map((t) => t.name).join(', '));
const check = ClauseExtractInputSchema.safeParse({ document: 'This Agreement may be terminated by either party.', clauseTypes: ['termination'] });
console.log('valid input:', check.success);
```
Expected output:
```text
tools: legal/clause-extract, legal/risk-assess, legal/contract-compare, legal/obligation-track, legal/playbook-match
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-legal-contracts`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-legal-contracts.svg)](https://www.npmjs.com/package/@claude-flow/plugin-legal-contracts)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-legal-contracts.svg)](https://www.npmjs.com/package/@claude-flow/plugin-legal-contracts)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -389,3 +418,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/legal-contracts)
<!-- adr-356:footer:end -->
+8 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-legal-contracts",
"version": "3.0.0-alpha.2",
"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",
"type": "module",
"main": "./dist/index.js",
@@ -44,6 +44,7 @@
"tag": "v3alpha"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"legal",
@@ -58,11 +59,11 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/legal-contracts"
},
"dependencies": {
"zod": "^3.23.0"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.0.0",
@@ -74,5 +75,9 @@
},
"engines": {
"node": ">=20.0.0"
},
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
+3 -1
View File
@@ -53,8 +53,10 @@ export interface MCPTool<TInput = unknown, TOutput = unknown> {
description: string;
category: string;
version: string;
// zod 3 reads these params as <Output, Def, Input> and zod 4 as <Output, Input, Internals>;
// `any` in the last two keeps the type valid under both majors.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
inputSchema: z.ZodType<TInput, z.ZodTypeDef, any>;
inputSchema: z.ZodType<TInput, any, any>;
handler: (input: TInput, context: ToolContext) => Promise<MCPToolResult<TOutput>>;
}
@@ -0,0 +1,54 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* This plugin's schemas have no size-bounded collection of constrained
* elements, so the floor is checked directly, along with the zod 4 issue shape
* this plugin's tool handlers now report: an unknown enum member is
* `invalid_value` (zod 3 called it `invalid_enum_value`) and lists the
* accepted values.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { ClauseExtractInputSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports an unknown clause type as invalid_value', () => {
const result = ClauseExtractInputSchema.safeParse({ document: 'x', clauseTypes: ['not_a_clause'] });
expect(result.success).toBe(false);
const issue = result.error!.issues.find((i) => i.path.join('.') === 'clauseTypes.0');
expect(issue?.code).toBe('invalid_value');
expect((issue as { values?: unknown[] }).values).not.toContain('not_a_clause');
});
});
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/plugin-neural-coordination
<!-- adr-356:quickstart:start -->
**@claude-flow/plugin-neural-coordination** — A Ruflo plugin that gives agent swarms MCP tools for neural consensus, topology optimization, collective memory, emergent protocols and swarm behaviour.
**Supported environments:** Node.js 18+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-neural-coordination
```
```js
import { neuralCoordinationTools, ProposalSchema } from '@claude-flow/plugin-neural-coordination';
console.log('tools:', neuralCoordinationTools.map((t) => t.name).join(', '));
const check = ProposalSchema.safeParse({ topic: 'swarm topology', options: [{ id: 'mesh', value: 'mesh' }, { id: 'star', value: 'star' }] });
console.log('valid input:', check.success);
```
Expected output:
```text
tools: coordination/neural-consensus, coordination/topology-optimize, coordination/collective-memory, coordination/emergent-protocol, coordination/swarm-behavior
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-neural-coordination`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-neural-coordination.svg)](https://www.npmjs.com/package/@claude-flow/plugin-neural-coordination)
[![license](https://img.shields.io/npm/l/@claude-flow/plugin-neural-coordination.svg)](https://github.com/ruvnet/claude-flow/blob/main/LICENSE)
[![downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-neural-coordination.svg)](https://www.npmjs.com/package/@claude-flow/plugin-neural-coordination)
@@ -263,3 +292,9 @@ interface NeuralCoordinationConfig {
## License
MIT
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/neural-coordination)
<!-- adr-356:footer:end -->
File diff suppressed because it is too large. Load diff
+11 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-neural-coordination",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"description": "Neural coordination plugin for multi-agent swarm intelligence using SONA, GNN, and attention mechanisms",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -40,7 +40,9 @@
"prepublishOnly": "npm run clean && npm run build && npm run typecheck"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"neural-coordination",
"multi-agent",
"swarm",
@@ -48,17 +50,18 @@
"topology",
"sona",
"gnn",
"attention"
"attention",
"mcp"
],
"author": "Claude Flow Team",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/neural-coordination"
},
"dependencies": {
"zod": "^3.22.4"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.10.0",
@@ -72,5 +75,9 @@
"publishConfig": {
"access": "public",
"tag": "v3alpha"
},
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
@@ -0,0 +1,58 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* Below 4.6.6, zod validates every element of an oversized constrained
* collection before it reports the size violation, so a single request with a
* huge array allocates one issue per element. From 4.6.6 the size check short-
* circuits: the same input yields exactly one `too_big` issue on the
* collection itself. These run against this plugin's real input schema.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { NeuralConsensusInputSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports one too_big issue for an oversized agents list', () => {
const path = ['agents'];
const result = NeuralConsensusInputSchema.safeParse({ agents: Array(5000).fill({ id: 'x'.repeat(200) }) });
expect(result.success).toBe(false);
const issues = result.error!.issues.filter((i) =>
path.every((p, k) => i.path[k] === p),
);
expect(issues).toHaveLength(1);
expect(issues[0].code).toBe('too_big');
expect(issues[0].path).toEqual(path);
});
});
+43 -6
View File
@@ -1,7 +1,38 @@
# @claude-flow/plugin-performance-optimizer
# @claude-flow/plugin-perf-optimizer
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-performance-optimizer.svg)](https://www.npmjs.com/package/@claude-flow/plugin-performance-optimizer)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-performance-optimizer.svg)](https://www.npmjs.com/package/@claude-flow/plugin-performance-optimizer)
<!-- adr-356:quickstart:start -->
![Animated diagram: telemetry is checked by input schemas, analysed, and returned as findings with recommendations](https://raw.githubusercontent.com/ruvnet/ruflo/main/v3/plugins/perf-optimizer/assets/perf-flow.svg)
**@claude-flow/plugin-perf-optimizer** — A Ruflo plugin that gives agents MCP tools to find bottlenecks in traces, analyse memory, optimise queries and bundles, and tune configuration.
**Supported environments:** Node.js 18+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-perf-optimizer
```
```js
import { perfOptimizerTools, MemoryAnalyzeInputSchema } from '@claude-flow/plugin-perf-optimizer';
console.log('tools:', perfOptimizerTools.map((t) => t.name).join(', '));
const check = MemoryAnalyzeInputSchema.safeParse({ analysis: ['leak_detection'] });
console.log('valid input:', check.success);
```
Expected output:
```text
tools: perf/bottleneck-detect, perf/memory-analyze, perf/query-optimize, perf/bundle-optimize, perf/config-optimize
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-perf-optimizer`.
<!-- adr-356:quickstart:end -->
[![npm version](https://img.shields.io/npm/v/@claude-flow/plugin-perf-optimizer.svg)](https://www.npmjs.com/package/@claude-flow/plugin-perf-optimizer)
[![npm downloads](https://img.shields.io/npm/dm/@claude-flow/plugin-perf-optimizer.svg)](https://www.npmjs.com/package/@claude-flow/plugin-perf-optimizer)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
A comprehensive performance optimization plugin combining sparse inference for efficient trace analysis with graph neural networks for dependency chain optimization. The plugin enables intelligent bottleneck detection, memory leak identification, N+1 query detection, and bundle size optimization while providing explainable recommendations based on historical performance patterns.
@@ -19,19 +50,19 @@ A comprehensive performance optimization plugin combining sparse inference for e
### npm
```bash
npm install @claude-flow/plugin-performance-optimizer
npm install @claude-flow/plugin-perf-optimizer
```
### CLI
```bash
npx claude-flow plugins install --name @claude-flow/plugin-performance-optimizer
npx claude-flow plugins install --name @claude-flow/plugin-perf-optimizer
```
## Quick Start
```typescript
import { PerfOptimizerPlugin } from '@claude-flow/plugin-performance-optimizer';
import { PerfOptimizerPlugin } from '@claude-flow/plugin-perf-optimizer';
// Initialize the plugin
const plugin = new PerfOptimizerPlugin();
@@ -274,3 +305,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/perf-optimizer)
<!-- adr-356:footer:end -->
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 170" width="760" height="170" role="img" aria-labelledby="t d">
<title id="t">perf-optimizer: telemetry to recommendations</title>
<desc id="d">Traces, heap timelines, queries or bundle stats are checked by the tool input schemas, analysed by the plugin, and returned as findings with recommendations.</desc>
<style>
.bg{fill:#1e293b}
.cap{fill:#e2e8f0;font:600 15px system-ui,-apple-system,Segoe UI,sans-serif}
.s rect{fill:#334155;stroke:#64748b;stroke-width:1.5}
.s{animation:pulse 4.8s infinite}
.h{fill:#f8fafc;font:600 13px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.t{fill:#cbd5e1;font:11px system-ui,-apple-system,Segoe UI,sans-serif;text-anchor:middle}
.a{fill:none;stroke:#94a3b8;stroke-width:2}
.dot{fill:#38bdf8;animation:move 4.8s linear infinite}
@keyframes pulse{0%,25.0%{opacity:1}33.0%,100%{opacity:.62}}
@keyframes move{from{transform:translateX(0)}to{transform:translateX(561px)}}
@media (prefers-reduced-motion:reduce){.s,.dot{animation:none}}
</style>
<rect class="bg" width="760" height="170" rx="14"/>
<text class="cap" x="20" y="34">perf-optimizer: telemetry to recommendations</text>
<path class="a" d="M184 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M371 90h14m-5 -4l5 4l-5 4"/><path class="a" d="M558 90h14m-5 -4l5 4l-5 4"/>
<g class="s" style="animation-delay:0.0s"><rect x="16" y="58" width="165" height="64" rx="10"/><text class="h" x="98.5" y="85">Telemetry</text><text class="t" x="98.5" y="104">traces, heap, SQL</text></g><g class="s" style="animation-delay:1.2s"><rect x="203" y="58" width="165" height="64" rx="10"/><text class="h" x="285.5" y="85">Input schemas</text><text class="t" x="285.5" y="104">bounded, typed</text></g><g class="s" style="animation-delay:2.4s"><rect x="390" y="58" width="165" height="64" rx="10"/><text class="h" x="472.5" y="85">Analyzers</text><text class="t" x="472.5" y="104">sparse + GNN bridges</text></g><g class="s" style="animation-delay:3.6s"><rect x="577" y="58" width="165" height="64" rx="10"/><text class="h" x="659.5" y="85">Findings</text><text class="t" x="659.5" y="104">recommendations</text></g>
<circle class="dot" cx="98.5" cy="140" r="5"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because it is too large. Load diff
+11 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/plugin-perf-optimizer",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"description": "AI-powered performance optimization plugin for bottleneck detection, memory analysis, and configuration tuning",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -40,23 +40,26 @@
"prepublishOnly": "npm run clean && npm run build && npm run typecheck"
},
"keywords": [
"ruflo",
"claude-flow",
"plugin",
"performance",
"optimization",
"bottleneck-detection",
"memory-analysis",
"query-optimization"
"query-optimization",
"bundle-optimization",
"mcp"
],
"author": "Claude Flow Team",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/claude-flow.git",
"url": "git+https://github.com/ruvnet/ruflo.git",
"directory": "v3/plugins/perf-optimizer"
},
"dependencies": {
"zod": "^3.22.4"
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^20.10.0",
@@ -70,5 +73,9 @@
"publishConfig": {
"access": "public",
"tag": "v3alpha"
},
"homepage": "https://ruv.io",
"bugs": {
"url": "https://github.com/ruvnet/ruflo/issues"
}
}
@@ -0,0 +1,54 @@
/**
* zod >= 4.6.6 floor (GHSA-mrhx-c7xc-m3w5).
*
* This plugin's schemas have no size-bounded collection of constrained
* elements, so the floor is checked directly, along with the zod 4 issue shape
* this plugin's tool handlers now report: an unknown enum member is
* `invalid_value` (zod 3 called it `invalid_enum_value`) and lists the
* accepted values.
*/
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { describe, it, expect } from 'vitest';
import { MemoryAnalyzeInputSchema } from '../src/types.js';
const require = createRequire(import.meta.url);
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
/** "^4.6.7" or "4.6.7" -> [4, 6, 7] */
function floorOf(range: string): number[] {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(range.trim());
if (!m) throw new Error(`unsupported zod range: ${range}`);
return [+m[1], +m[2], +m[3]];
}
function atLeast(v: number[], floor: number[]): boolean {
return v[0] === floor[0] && (v[1] - floor[1] || v[2] - floor[2]) >= 0;
}
const declared = floorOf(manifest.dependencies?.zod ?? '0.0.0');
const resolved = (require('zod/package.json') as { version: string }).version
.split('.')
.map(Number);
// The runtime checks below need the zod this package declares. A workspace
// run that hoists another zod (the repo-root test ratchet resolves zod 3 from
// the root install) skips them instead of testing the wrong library.
const ownZod = atLeast(resolved, declared);
describe('zod floor', () => {
it('declares zod ^4.6.6 or later', () => {
expect(declared[0]).toBe(4);
expect(atLeast(declared, [4, 6, 6])).toBe(true);
});
it.runIf(ownZod)('reports an unknown analysis kind as invalid_value', () => {
const result = MemoryAnalyzeInputSchema.safeParse({ analysis: ['not_an_analysis'] });
expect(result.success).toBe(false);
const issue = result.error!.issues.find((i) => i.path.join('.') === 'analysis.0');
expect(issue?.code).toBe('invalid_value');
expect((issue as { values?: unknown[] }).values).not.toContain('not_an_analysis');
});
});
+35
View File
@@ -1,5 +1,34 @@
# @claude-flow/plugin-prime-radiant
<!-- adr-356:quickstart:start -->
**@claude-flow/plugin-prime-radiant** — A Ruflo plugin that gives agents MCP tools to check coherence, verify consensus, gate memory writes and run spectral, causal and topological analysis, to catch contradictions and hallucinations.
**Supported environments:** Node.js 20+ · ESM
## Quickstart
```bash
npm install @claude-flow/plugin-prime-radiant
```
```js
import { primeRadiantTools, PrimeRadiantConfigSchema } from '@claude-flow/plugin-prime-radiant';
console.log('tools:', primeRadiantTools.map((t) => t.name).join(', '));
const check = PrimeRadiantConfigSchema.safeParse({});
console.log('valid input:', check.success);
```
Expected output:
```text
tools: pr_coherence_check, pr_spectral_analyze, pr_causal_infer, pr_consensus_verify, pr_quantum_topology, pr_memory_gate
valid input: true
```
Install it into a Ruflo project with [`@claude-flow/cli`](https://www.npmjs.com/package/@claude-flow/cli): `npx @claude-flow/cli@latest plugins install -n @claude-flow/plugin-prime-radiant`.
<!-- adr-356:quickstart:end -->
**Mathematical AI that catches contradictions, verifies consensus, and prevents hallucinations before they cause problems.**
## What is this?
@@ -359,3 +388,9 @@ plugins:
## License
MIT
<!-- adr-356:footer:start -->
---
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/plugins/prime-radiant)
<!-- adr-356:footer:end -->
@@ -0,0 +1,47 @@
/**
* Config defaults under zod 4
*
* zod 4 returns a `.default()` value without parsing it, so the old
* `CoherenceConfigSchema.default({})` produced `{}` and dropped every nested
* field default. These run against the real schema, not a mock.
*/
import { readFileSync } from 'node:fs';
import { describe, it, expect } from 'vitest';
import { validateConfig } from '../src/schemas.js';
const manifest = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
) as { dependencies?: Record<string, string> };
describe('zod floor', () => {
it('declares zod ^4.6.6 or later (GHSA-mrhx-c7xc-m3w5)', () => {
const m = /^\^?(\d+)\.(\d+)\.(\d+)$/.exec(String(manifest.dependencies?.zod));
expect(m).not.toBeNull();
const [major, minor, patch] = m!.slice(1).map(Number);
expect(major).toBe(4);
expect(minor * 1000 + patch).toBeGreaterThanOrEqual(6 * 1000 + 6);
});
});
describe('PrimeRadiantConfigSchema defaults', () => {
it('fills nested field defaults when a section is omitted', () => {
const config = validateConfig({});
expect(config.coherence).toEqual({
warnThreshold: 0.3,
rejectThreshold: 0.7,
cacheEnabled: true,
cacheTTL: 60000,
});
expect(config.spectral.stabilityThreshold).toBe(0.1);
expect(config.spectral.maxMatrixSize).toBe(1000);
expect(config.causal).toEqual({ maxBackdoorPaths: 10, confidenceThreshold: 0.8 });
});
it('keeps a provided value and fills the rest of its section', () => {
const config = validateConfig({ causal: { maxBackdoorPaths: 3 } });
expect(config.causal).toEqual({ maxBackdoorPaths: 3, confidenceThreshold: 0.8 });
});
});
Loaded 100 of 115 files, more files were not shown because too many files have changed in this diff. Show more