Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

fix(codex): lazy-load stable adapter during init

ruvnet942de65de781
diff --git a/v3/@claude-flow/cli/package-lock.json b/v3/@claude-flow/cli/package-lock.json
index 8a08f4b709..101ae2a202 100644
--- a/v3/@claude-flow/cli/package-lock.json
+++ b/v3/@claude-flow/cli/package-lock.json
@@ -30,7 +30,6 @@
"vitest": "^4.1.0"
},
"optionalDependencies": {
- "@claude-flow/codex": "^3.0.0",
"@claude-flow/memory": "^3.0.0-alpha.21",
"@claude-flow/security": "^3.0.0-alpha.10",
"agentdb": "^3.0.0-alpha.17",
@@ -160,36 +159,6 @@
"claude-flow-core": "dist/src/index.js"
}
},
- "node_modules/@claude-flow/codex": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/@claude-flow/codex/-/codex-3.0.1.tgz",
- "integrity": "sha512-9Xk9YhG/2wcMDHpudoVdjP07Yc8mT3ziHVLJAKLa3d2ObqA9/4NC1IJIteW16W6e29rqEiEzZWyWTGtISQZXOA==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "@iarna/toml": "^2.2.5",
- "chalk": "^5.3.0",
- "commander": "^12.0.0",
- "fs-extra": "^11.2.0",
- "inquirer": "^9.2.0",
- "toml": "^3.0.0",
- "yaml": "^2.4.0"
- },
- "bin": {
- "claude-flow-codex": "dist/cli.js"
- },
- "engines": {
- "node": ">=18"
- },
- "peerDependencies": {
- "@claude-flow/cli": "^3.0.0"
- },
- "peerDependenciesMeta": {
- "@claude-flow/cli": {
- "optional": true
- }
- }
- },
"node_modules/@claude-flow/mcp": {
"version": "3.0.0-alpha.8",
"resolved": "https://registry.npmjs.org/@claude-flow/mcp/-/mcp-3.0.0-alpha.8.tgz",
@@ -376,13 +345,6 @@
"node": ">=18"
}
},
- "node_modules/@iarna/toml": {
- "version": "2.2.5",
- "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz",
- "integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==",
- "license": "ISC",
- "optional": true
- },
"node_modules/@img/sharp-darwin-arm64": {
"version": "0.33.5",
"resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz",
@@ -3646,16 +3608,6 @@
"url": "https://github.com/sponsors/colinhacks"
}
},
- "node_modules/agentic-flow/node_modules/jose": {
- "version": "5.10.0",
- "resolved": "https://registry.npmjs.org/jose/-/jose-5.10.0.tgz",
- "integrity": "sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==",
- "extraneous": true,
- "license": "MIT",
- "funding": {
- "url": "https://github.com/sponsors/panva"
- }
- },
"node_modules/agentic-flow/node_modules/string-width": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
@@ -5265,21 +5217,6 @@
"license": "MIT",
"optional": true
},
- "node_modules/fs-extra": {
- "version": "11.3.6",
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.6.tgz",
- "integrity": "sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "graceful-fs": "^4.2.0",
- "jsonfile": "^6.0.1",
- "universalify": "^2.0.0"
- },
- "engines": {
- "node": ">=14.14"
- }
- },
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
@@ -5518,13 +5455,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/graceful-fs": {
- "version": "4.2.11",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
- "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
- "license": "ISC",
- "optional": true
- },
"node_modules/guid-typescript": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/guid-typescript/-/guid-typescript-1.0.9.tgz",
@@ -6085,19 +6015,6 @@
"integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==",
"license": "BSD-2-Clause"
},
- "node_modules/jsonfile": {
- "version": "6.2.1",
- "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",
- "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "universalify": "^2.0.0"
- },
- "optionalDependencies": {
- "graceful-fs": "^4.1.6"
- }
- },
"node_modules/jsonwebtoken": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz",
@@ -8601,13 +8518,6 @@
"url": "https://github.com/sponsors/Borewit"
}
},
- "node_modules/toml": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz",
- "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==",
- "license": "MIT",
- "optional": true
- },
"node_modules/ts-algebra": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-2.0.0.tgz",
@@ -8763,16 +8673,6 @@
"license": "ISC",
"optional": true
},
- "node_modules/universalify": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
- "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">= 10.0.0"
- }
- },
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index 79ce74c6ec..d33e12187e 100644
--- a/v3/@claude-flow/cli/package.json
+++ b/v3/@claude-flow/cli/package.json
@@ -111,7 +111,6 @@
"yaml": "^2.8.0"
},
"optionalDependencies": {
- "@claude-flow/codex": "^3.0.0",
"@claude-flow/memory": "^3.0.0-alpha.21",
"@claude-flow/security": "^3.0.0-alpha.10",
"agentdb": "^3.0.0-alpha.17",
diff --git a/v3/@claude-flow/cli/src/commands/init.ts b/v3/@claude-flow/cli/src/commands/init.ts
index 7519afe85a..bd337b6c69 100644
--- a/v3/@claude-flow/cli/src/commands/init.ts
+++ b/v3/@claude-flow/cli/src/commands/init.ts
@@ -8,6 +8,7 @@ import { output } from '../output.js';
import { confirm, select, multiSelect, input } from '../prompt.js';
import * as fs from 'fs';
import * as path from 'path';
+import { spawnSync } from 'node:child_process';
import {
executeInit,
executeUpgrade,
@@ -107,6 +108,36 @@ async function resolveCodexInitializer(cwd: string): Promise<CodexInitializerCto
return undefined;
}
+// Keep Codex out of the CLI dependency graph so cold `npx ruflo --version`
+// remains fast (#2561). An explicit `init --codex` may fetch the small,
+// stable adapter on demand when it is not already installed by an umbrella
+// package, the current project, or the global npm prefix.
+export function runCodexInitializerCli(
+ cwd: string,
+ options: { template: string; force: boolean; dual: boolean },
+): boolean {
+ const npxArgs = [
+ '-y',
+ '@claude-flow/codex@latest',
+ 'init',
+ '--template',
+ options.template,
+ ...(options.force ? ['--force'] : []),
+ ...(options.dual ? ['--dual'] : []),
+ ];
+
+ const result = process.platform === 'win32'
+ ? spawnSync(
+ process.env.ComSpec || 'cmd.exe',
+ ['/d', '/s', '/c', ['npx', ...npxArgs].join(' ')],
+ { cwd, stdio: 'inherit', windowsHide: true },
+ )
+ : spawnSync('npx', npxArgs, { cwd, stdio: 'inherit' });
+
+ if (result.error) throw result.error;
+ return result.status === 0;
+}
+
// #2666-adjacent — quietly wire up Codex too when a plain `ruflo init` (no
// --codex/--dual) runs on a machine that also has the OpenAI Codex CLI on
// PATH: registers its MCP server and installs skills alongside the Claude
@@ -237,7 +268,14 @@ async function initCodexAction(
const CodexInitializer = await resolveCodexInitializer(ctx.cwd);
if (!CodexInitializer) {
- throw new Error('Cannot find module @claude-flow/codex');
+ spinner.stop();
+ output.printInfo('Fetching the stable Codex adapter for this initialization...');
+ const success = runCodexInitializerCli(ctx.cwd, { template, force, dual: dualMode });
+ if (!success) {
+ output.printError('Codex initialization failed while running @claude-flow/codex@latest.');
+ return { success: false, exitCode: 1 };
+ }
+ return { success: true, data: { adapter: '@claude-flow/codex@latest' } };
}
const initializer = new CodexInitializer();
diff --git a/v3/package-lock.json b/v3/package-lock.json
index ce7b937985..5abbee3b66 100644
--- a/v3/package-lock.json
+++ b/v3/package-lock.json
@@ -1859,7 +1859,6 @@
},
"optionalDependencies": {
"@claude-flow/aidefence": "^3.0.2",
- "@claude-flow/codex": "^3.0.0",
"@claude-flow/embeddings": "^3.0.0-alpha.18",
"@claude-flow/guidance": "^3.0.0-alpha.1",
"@claude-flow/memory": "^3.0.0-alpha.21",
diff --git a/v3/pnpm-lock.yaml b/v3/pnpm-lock.yaml
index b0407b2c92..a167707abc 100644
--- a/v3/pnpm-lock.yaml
+++ b/v3/pnpm-lock.yaml
@@ -141,9 +141,6 @@ importers:
specifier: ^2.8.0
version: 2.8.2
optionalDependencies:
- '@claude-flow/codex':
- specifier: ^3.0.0
- version: link:../codex
'@claude-flow/memory':
specifier: ^3.0.0-alpha.21
version: link:../memory