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

rUv387a648ca226
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index 4b72bfcf73..df09566147 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.0.0-alpha.97",
+ "version": "3.0.0-alpha.98",
"type": "module",
"description": "CLI module - command parsing, prompts, output formatting",
"main": "dist/src/index.js",
diff --git a/v3/@claude-flow/cli/src/mcp-tools/security-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/security-tools.ts
index ef81aa6e4a..c6c3d4a85d 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/security-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/security-tools.ts
@@ -12,6 +12,10 @@
import type { MCPTool, MCPToolResult } from './types.js';
import { autoInstallPackage } from './auto-install.js';
+import { createRequire } from 'module';
+
+// Create require for resolving module paths
+const require = createRequire(import.meta.url);
// AIDefence instance type
type AIDefenceInstance = ReturnType<typeof import('@claude-flow/aidefence').createAIDefence>;
@@ -64,11 +68,21 @@ async function getAIDefence(): Promise<AIDefenceInstance> {
throw new Error('AIDefence package not available. Install with: npm install @claude-flow/aidefence');
}
- // After install, we need to restart to pick up the new module
- // ESM caches import failures, so we can't retry in the same process
- console.error(`[claude-flow] ${packageName} installed successfully.`);
- console.error(`[claude-flow] Please restart the MCP server to load the new package.`);
- throw new Error('AIDefence installed successfully. Please restart the MCP server to use it.');
+ // Retry with ESM cache busting via file:// URL + timestamp
+ try {
+ const modulePath = require.resolve(packageName);
+ const cacheBust = `?t=${Date.now()}`;
+ const aidefence = await import(`file://${modulePath}${cacheBust}`);
+ const instance = aidefence.createAIDefence({ enableLearning: true });
+ if (!instance) {
+ throw new Error('createAIDefence returned null after install');
+ }
+ aidefenceInstance = instance;
+ console.error(`[claude-flow] ${packageName} loaded successfully after install`);
+ return instance;
+ } catch (retryError) {
+ throw new Error(`AIDefence installed but failed to load: ${retryError}. Try restarting the MCP server.`);
+ }
}
/**
diff --git a/v3/package-lock.json b/v3/package-lock.json
index b901372c93..c75a065446 100644
--- a/v3/package-lock.json
+++ b/v3/package-lock.json
@@ -925,7 +925,7 @@
}
},
"@claude-flow/cli": {
- "version": "3.0.0-alpha.97",
+ "version": "3.0.0-alpha.98",
"dependencies": {
"@claude-flow/aidefence": "^3.0.2",
"@claude-flow/embeddings": "^3.0.0-alpha.12",
@@ -1204,6 +1204,21 @@
"node": ">=18.0.0"
}
},
+ "claude-flow/node_modules/@claude-flow/cli": {
+ "version": "3.0.0-alpha.97",
+ "resolved": "https://registry.npmjs.org/@claude-flow/cli/-/cli-3.0.0-alpha.97.tgz",
+ "integrity": "sha512-GjG0dBcBiw4ALJkxr6cU4uAhVlQgIcuUE5ibATyv3JnOc1zGUY6yyl3xAPlMA7UyxeNhXDYENTQP8gomWI560A==",
+ "dependencies": {
+ "@claude-flow/aidefence": "^3.0.2",
+ "@claude-flow/embeddings": "^3.0.0-alpha.12",
+ "@claude-flow/shared": "^3.0.0-alpha.1"
+ },
+ "bin": {
+ "claude-flow": "bin/cli.js",
+ "claude-flow-mcp": "bin/mcp-server.js",
+ "cli": "bin/cli.js"
+ }
+ },
"node_modules/@actions/core": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-2.0.1.tgz",