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

Checkpoint: File edits

rUvf709381f6f70
diff --git a/v3/@claude-flow/cli/src/commands/init.ts b/v3/@claude-flow/cli/src/commands/init.ts
index bdea09a235..bdb1628357 100644
--- a/v3/@claude-flow/cli/src/commands/init.ts
+++ b/v3/@claude-flow/cli/src/commands/init.ts
@@ -36,8 +36,48 @@ async function initCodexAction(
spinner.start();
try {
- // Dynamic import of the Codex initializer
- const { CodexInitializer } = await import('@claude-flow/codex');
+ // Dynamic import of the Codex initializer with lazy loading fallback
+ let CodexInitializer: any;
+
+ // Try multiple resolution strategies for the @claude-flow/codex package
+ const resolutionStrategies = [
+ // Strategy 1: Direct import (works if installed as CLI dependency)
+ async () => (await import('@claude-flow/codex')).CodexInitializer,
+ // Strategy 2: Project node_modules (works if installed in user's project)
+ async () => {
+ const projectPath = path.join(ctx.cwd, 'node_modules', '@claude-flow', 'codex', 'dist', 'index.js');
+ if (fs.existsSync(projectPath)) {
+ const mod = await import(`file://${projectPath}`);
+ return mod.CodexInitializer;
+ }
+ throw new Error('Not found in project');
+ },
+ // Strategy 3: Global node_modules
+ async () => {
+ const { execSync } = await import('child_process');
+ const globalPath = execSync('npm root -g', { encoding: 'utf-8' }).trim();
+ const codexPath = path.join(globalPath, '@claude-flow', 'codex', 'dist', 'index.js');
+ if (fs.existsSync(codexPath)) {
+ const mod = await import(`file://${codexPath}`);
+ return mod.CodexInitializer;
+ }
+ throw new Error('Not found globally');
+ },
+ ];
+
+ for (const strategy of resolutionStrategies) {
+ try {
+ CodexInitializer = await strategy();
+ if (CodexInitializer) break;
+ } catch {
+ // Try next strategy
+ }
+ }
+
+ if (!CodexInitializer) {
+ throw new Error('Cannot find module @claude-flow/codex');
+ }
+
const initializer = new CodexInitializer();
const result = await initializer.initialize({
diff --git a/v3/@claude-flow/codex/package.json b/v3/@claude-flow/codex/package.json
index 733ab215ef..e04d1d32b2 100644
--- a/v3/@claude-flow/codex/package.json
+++ b/v3/@claude-flow/codex/package.json
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/codex",
- "version": "3.0.0-alpha.5",
+ "version": "3.0.0-alpha.6",
"description": "Codex CLI integration for Claude Flow - OpenAI Codex platform adapter",
"type": "module",
"main": "./dist/index.js",
diff --git a/v3/package-lock.json b/v3/package-lock.json
index 2890df3047..c0ef50ecc2 100644
--- a/v3/package-lock.json
+++ b/v3/package-lock.json
@@ -1818,7 +1818,7 @@
}
},
"@claude-flow/codex": {
- "version": "3.0.0-alpha.5",
+ "version": "3.0.0-alpha.6",
"license": "MIT",
"dependencies": {
"@iarna/toml": "^2.2.5",