π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(embeddings): #2018 β drop @huggingface/transformers from optionalDependencies (npx Invalid Version)
Reuven1430b4c76e32
diff --git a/.github/workflows/v3-ci.yml b/.github/workflows/v3-ci.ymlindex 660f12cd14..8f418c6717 100644--- a/.github/workflows/v3-ci.yml+++ b/.github/workflows/v3-ci.yml@@ -524,6 +524,61 @@ jobs:shell: bashrun: node scripts/audit-plugin-packages.mjs+ - name: Run package dep-overlap audit (#1147 / #2018)+ # Static guard for the "Invalid Version: " npm 11.x crash. Any package+ # declaring the same dep name in both optionalDependencies AND+ # peerDependencies trips arborist's dedupe pass when a transitive+ # carries a "-dev." prerelease tag. Fail CI on the overlap.+ shell: bash+ run: node scripts/audit-package-dep-overlap.mjs++ cli-npx-install-smoke:+ # Regression guard for ruvnet/ruflo#1147 and #2018 β both report:+ # $ npx @claude-flow/cli@latest β¦+ # npm error Invalid Version:+ # Caused by an optionalDependencies/peerDependencies overlap deep in the+ # dep tree (see scripts/audit-package-dep-overlap.mjs for the static+ # guard). This is the BEHAVIOURAL guard: pack the locally-built CLI,+ # install the tarball into a scratch project, fail if `npm install`+ # prints "Invalid Version" or exits non-zero. Runs on Node 22 + 24 so+ # the newer npm shipped with Node 24 (where the bug surfaces) is+ # actually exercised.+ name: CLI npx-install smoke (#1147 / #2018) / Node ${{ matrix.node }}+ runs-on: ubuntu-latest+ strategy:+ fail-fast: false+ matrix:+ node: ['22', '24']++ steps:+ - name: Checkout code+ uses: actions/checkout@v4++ - name: Setup pnpm+ uses: pnpm/action-setup@v2+ with:+ version: ${{ env.PNPM_VERSION }}++ - name: Setup Node.js ${{ matrix.node }}+ uses: actions/setup-node@v4+ with:+ node-version: ${{ matrix.node }}+ cache: 'pnpm'+ cache-dependency-path: v3/pnpm-lock.yaml++ - name: Build cli (smoke packs from its dist/)+ working-directory: v3+ shell: bash+ run: |+ pnpm install --frozen-lockfile+ pnpm --recursive --no-bail run build || true+ test -f @claude-flow/cli/bin/cli.js \+ || (echo "cli build did not produce bin/cli.js"; exit 1)++ - name: Pack, install, and run cli (asserts no 'Invalid Version' crash)+ shell: bash+ run: node scripts/smoke-cli-npx-install.mjs+hook-command-audit:# Regression guard for #1921 (and #1147) β plugin hooks.json must not# invoke a bare `npx <pkg>@alpha hooks β¦` per fire. The fix is@@ -618,7 +673,7 @@ jobs:fail-fast: falsematrix:os: [ubuntu-latest, macos-latest, windows-latest]- needs: [smoke-install-no-bsqlite, plugin-hooks-smoke, mcp-protocol-smoke, memory-import-smoke, tool-descriptions-audit, mcp-roundtrip-smoke, plugin-package-audit, hook-command-audit, vector-dim-audit]+ needs: [smoke-install-no-bsqlite, plugin-hooks-smoke, mcp-protocol-smoke, memory-import-smoke, tool-descriptions-audit, mcp-roundtrip-smoke, plugin-package-audit, cli-npx-install-smoke, hook-command-audit, vector-dim-audit]steps:- name: Checkout codediff --git a/package.json b/package.jsonindex 15d069e75e..800ded8d2a 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "claude-flow",- "version": "3.7.0-alpha.38",+ "version": "3.7.0-alpha.39","description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration","main": "dist/index.js","type": "module",diff --git a/ruflo/package.json b/ruflo/package.jsonindex bb8d21efd5..121168d59e 100644--- a/ruflo/package.json+++ b/ruflo/package.json@@ -1,6 +1,6 @@{"name": "ruflo",- "version": "3.7.0-alpha.38",+ "version": "3.7.0-alpha.39","description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration","main": "bin/ruflo.js","type": "module",diff --git a/scripts/audit-package-dep-overlap.mjs b/scripts/audit-package-dep-overlap.mjsnew file mode 100755index 0000000000..c8c1f71dfe--- /dev/null+++ b/scripts/audit-package-dep-overlap.mjs@@ -0,0 +1,94 @@+#!/usr/bin/env node+/**+ * Package dependency overlap audit (regression guard for ruvnet/ruflo#1147 and #2018).+ *+ * Both issues are the same failure shape:+ * `npm error Invalid Version: ` (empty) thrown by `new SemVer('')` inside+ * `@npmcli/arborist`'s `PlaceDep.pruneDedupable β Node.canDedupe β semver.eq`.+ *+ * Root cause: a package declares the SAME dependency name in both+ * `optionalDependencies` and `peerDependencies` (typically with+ * `peerDependenciesMeta[name].optional: true`). Newer npm (>=11) trips on+ * this overlap during the dedupe pass when the dep itself has a "-dev." /+ * prerelease tagged transitive (`[email protected].β¦`), producing+ * the user-facing empty-version crash.+ *+ * Fix: any name should appear in EITHER `optionalDependencies` OR as an+ * optional peer β never both. This script scans every package.json under+ * `v3/@claude-flow/*` and `v3/plugins/*` and fails on the overlap.+ *+ * Usage:+ * node scripts/audit-package-dep-overlap.mjs # exit 1 on any overlap+ * node scripts/audit-package-dep-overlap.mjs --json # machine-readable+ */++import { readFileSync, readdirSync, existsSync, statSync } from 'node:fs';+import { join } from 'node:path';++const REPO_ROOT = process.cwd();+const SCAN_DIRS = [+ join(REPO_ROOT, 'v3', '@claude-flow'),+ join(REPO_ROOT, 'v3', 'plugins'),+];+const JSON_OUT = process.argv.includes('--json');++const issues = [];+const note = (pkg, code, message) => issues.push({ pkg, code, message });++function listPackages(root) {+ if (!existsSync(root)) return [];+ return readdirSync(root)+ .map((name) => join(root, name))+ .filter((p) => {+ try { return statSync(p).isDirectory() && existsSync(join(p, 'package.json')); }+ catch { return false; }+ });+}++let scanned = 0;+for (const root of SCAN_DIRS) {+ for (const dir of listPackages(root)) {+ const pkgPath = join(dir, 'package.json');+ let pkg;+ try { pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')); }+ catch (e) { note(dir, 'PARSE', `invalid JSON: ${e.message}`); continue; }+ scanned++;+ const label = pkg.name || dir;+ const opt = pkg.optionalDependencies || {};+ const peers = pkg.peerDependencies || {};++ // --- Overlap check: same name in optionalDependencies AND peerDependencies.+ // npm 11.x arborist dedupe pass crashes with "Invalid Version: " on this+ // pattern when any transitive carries a prerelease tag β that's #1147 / #2018.+ for (const name of Object.keys(opt)) {+ if (peers[name] !== undefined) {+ note(label, 'OVERLAP',+ `"${name}" is in BOTH optionalDependencies and peerDependencies β ` ++ `npm 11.x arborist crashes with "Invalid Version: " on dedupe. ` ++ `Remove it from optionalDependencies and keep only the optional peer.`);+ }+ }+ }+}++const report = {+ scanned,+ issueCount: issues.length,+ issues,+};++if (JSON_OUT) {+ console.log(JSON.stringify(report, null, 2));+} else {+ console.log(`package dep-overlap audit β scanned ${scanned} package(s)`);+ if (issues.length === 0) {+ console.log(' ok: no optionalDependencies/peerDependencies overlaps');+ } else {+ for (const i of issues) {+ console.log(` fail [${i.code}] ${i.pkg}: ${i.message}`);+ }+ console.log(`\n${issues.length} issue(s) β see ruvnet/ruflo#1147 and #2018 for context`);+ }+}++process.exit(issues.length > 0 ? 1 : 0);diff --git a/scripts/smoke-cli-npx-install.mjs b/scripts/smoke-cli-npx-install.mjsnew file mode 100644index 0000000000..bcca1dfde7--- /dev/null+++ b/scripts/smoke-cli-npx-install.mjs@@ -0,0 +1,115 @@+#!/usr/bin/env node+/**+ * Smoke: `npx`-style install of the CLI tarball (regression guard for #1147 and #2018).+ *+ * Both issues report the same user-visible failure:+ * $ npx @claude-flow/cli@latest β¦+ * npm error Invalid Version:+ *+ * Caused by an `optionalDependencies` β `peerDependencies` overlap deep in+ * the dep tree (see audit-package-dep-overlap.mjs for the static guard).+ * This script is the BEHAVIOURAL guard β it packs the locally-built CLI,+ * installs the tarball into a scratch project, and asserts `node bin/cli.js+ * --version` runs without an `Invalid Version` crash from npm/arborist.+ *+ * Strategy:+ * 1. `pnpm pack` the CLI (rewrites workspace:* protocol to resolved versions)+ * 2. `npm init -y` in $RUNNER_TEMP/cli-npx-smoke+ * 3. `npm install <tarball>` β captures full npm output+ * 4. Fail if stdout/stderr contains "Invalid Version" OR install exits non-zero+ * 5. Run the installed `cli --version` and assert it prints+ *+ * Runs in CI under Node 22 + 24 to catch the npm 11.x dedupe regression+ * (#2018 hit users on Node 25 / npm 11.12).+ */++import { execFileSync, spawnSync } from 'node:child_process';+import { mkdtempSync, mkdirSync, writeFileSync, readdirSync, existsSync, statSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join, resolve } from 'node:path';++const REPO_ROOT = process.cwd();+const CLI_DIR = join(REPO_ROOT, 'v3', '@claude-flow', 'cli');++function run(cmd, args, opts = {}) {+ const r = spawnSync(cmd, args, { encoding: 'utf-8', ...opts });+ return { code: r.status ?? -1, stdout: r.stdout || '', stderr: r.stderr || '' };+}++function fail(msg) {+ console.error(`\n::error::smoke-cli-npx-install: ${msg}`);+ process.exit(1);+}++if (!existsSync(join(CLI_DIR, 'package.json'))) fail(`cli package not found at ${CLI_DIR}`);+if (!existsSync(join(CLI_DIR, 'bin', 'cli.js'))) fail(`cli not built β run \`pnpm --filter @claude-flow/cli build\` first`);++// 1. Pack the CLI. Prefer pnpm pack (rewrites workspace:*); fall back to npm pack.+const packDest = mkdtempSync(join(tmpdir(), 'cli-pack-'));+let tarball;+{+ console.log(`[1/5] packing CLI to ${packDest}`);+ const pnpm = run('pnpm', ['pack', '--pack-destination', packDest], { cwd: CLI_DIR });+ if (pnpm.code === 0) {+ const tgz = readdirSync(packDest).find((f) => f.endsWith('.tgz'));+ if (tgz) tarball = join(packDest, tgz);+ }+ if (!tarball) {+ // Fallback to npm pack β works when run with pnpm-resolved workspace already installed+ const npmPack = run('npm', ['pack', '--pack-destination', packDest], { cwd: CLI_DIR });+ if (npmPack.code !== 0) fail(`pnpm pack AND npm pack failed:\n${pnpm.stderr}\n---\n${npmPack.stderr}`);+ const tgz = readdirSync(packDest).find((f) => f.endsWith('.tgz'));+ if (!tgz) fail(`pack produced no .tgz in ${packDest}`);+ tarball = join(packDest, tgz);+ }+ console.log(` tarball: ${tarball}`);+}++// 2. Scratch project (mirrors what `npx <pkg>` does β temp dir, fresh install)+const scratch = mkdtempSync(join(tmpdir(), 'cli-npx-smoke-'));+console.log(`[2/5] scratch project: ${scratch}`);+writeFileSync(join(scratch, 'package.json'), JSON.stringify({+ name: 'cli-npx-smoke', private: true, type: 'module', version: '0.0.0',+}, null, 2));++// 3. Install β this is where #1147 / #2018 reproduce.+// Mirror what `npx <pkg>` does: install with optionals enabled (the bug is+// triggered when arborist places `@huggingface/transformers` via the+// embeddings package's optional chain). We capture the full npm output and+// grep for "Invalid Version:" regardless of exit code β some installs+// reported the crash mid-tree but completed enough other work to exit 0.+console.log(`[3/5] npm install ${tarball}`);+const install = run('npm', ['install', tarball, '--no-audit', '--no-fund'], { cwd: scratch });+const out = install.stdout + '\n' + install.stderr;+if (/Invalid Version:/i.test(out)) {+ console.error(out);+ fail('npm install printed "Invalid Version:" β regression of #1147 / #2018');+}+if (install.code !== 0) {+ console.error(out);+ fail(`npm install exited ${install.code}`);+}++// 4. Resolve installed bin (handle pkg.bin shape β string or object)+const installedPkgPath = join(scratch, 'node_modules', '@claude-flow', 'cli', 'package.json');+if (!existsSync(installedPkgPath)) fail(`installed cli package.json missing: ${installedPkgPath}`);+const installedPkg = JSON.parse(execFileSync('node', ['-e', `console.log(JSON.stringify(require(${JSON.stringify(installedPkgPath)})))`], { encoding: 'utf-8' }));+let binRel;+if (typeof installedPkg.bin === 'string') binRel = installedPkg.bin;+else if (installedPkg.bin && typeof installedPkg.bin === 'object') {+ binRel = installedPkg.bin['claude-flow'] || installedPkg.bin.cli || Object.values(installedPkg.bin)[0];+}+if (!binRel) fail('installed cli package.json has no usable "bin"');+const binAbs = resolve(join(scratch, 'node_modules', '@claude-flow', 'cli'), binRel);+if (!existsSync(binAbs)) fail(`installed cli bin missing on disk: ${binAbs}`);++console.log(`[4/5] running ${binAbs} --version`);+const ver = run('node', [binAbs, '--version'], { cwd: scratch });+if (ver.code !== 0 || !ver.stdout.trim()) {+ console.error(ver.stdout);+ console.error(ver.stderr);+ fail(`cli --version failed (exit ${ver.code})`);+}+console.log(` ${ver.stdout.trim()}`);++console.log(`[5/5] ok β installed cleanly, no "Invalid Version" regression`);diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.jsonindex 666594d56e..426e556101 100644--- a/v3/@claude-flow/cli/package.json+++ b/v3/@claude-flow/cli/package.json@@ -1,6 +1,6 @@{"name": "@claude-flow/cli",- "version": "3.7.0-alpha.38",+ "version": "3.7.0-alpha.39","type": "module","description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code","main": "dist/src/index.js",@@ -107,7 +107,7 @@"optionalDependencies": {"@claude-flow/aidefence": "^3.0.2","@claude-flow/codex": "^3.0.0-alpha.8",- "@claude-flow/embeddings": "^3.0.0-alpha.12",+ "@claude-flow/embeddings": "^3.0.0-alpha.17","@claude-flow/guidance": "^3.0.0-alpha.1","@claude-flow/memory": "^3.0.0-alpha.14","@claude-flow/plugin-gastown-bridge": "^0.1.3",diff --git a/v3/@claude-flow/embeddings/package.json b/v3/@claude-flow/embeddings/package.jsonindex 8ce0866e0d..4e02efd4b1 100644--- a/v3/@claude-flow/embeddings/package.json+++ b/v3/@claude-flow/embeddings/package.json@@ -1,6 +1,6 @@{"name": "@claude-flow/embeddings",- "version": "3.0.0-alpha.16",+ "version": "3.0.0-alpha.17","description": "V3 Embedding Service - OpenAI, Transformers.js, Agentic-Flow (ONNX), Mock providers with hyperbolic embeddings, normalization, and chunking","type": "module","main": "./dist/index.js",@@ -60,9 +60,6 @@"optional": true}},- "optionalDependencies": {- "@huggingface/transformers": "^4.2.0"- },"engines": {"node": ">=20.0.0"},