π 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(helpers): ship router as .cjs so it loads in ESM projects (#3555)
ruv9d026a894730
diff --git a/.claude/helpers/hook-handler.cjs b/.claude/helpers/hook-handler.cjsindex 004f1845e6..8536355063 100755--- a/.claude/helpers/hook-handler.cjs+++ b/.claude/helpers/hook-handler.cjs@@ -232,7 +232,7 @@ function safeRequire(modulePath) {return null;}-const router = safeRequire(path.join(helpersDir, 'router.js'));+const router = safeRequire(path.join(helpersDir, 'router.cjs'));const session = safeRequire(path.join(helpersDir, 'session.js'));const memory = safeRequire(path.join(helpersDir, 'memory.js'));const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));diff --git a/.claude/helpers/router.cjs b/.claude/helpers/router.cjsindex 6f19e3756f..0695e192e5 100644--- a/.claude/helpers/router.cjs+++ b/.claude/helpers/router.cjs@@ -97,7 +97,7 @@ if (require.main === module) {const result = routeTask(task);console.log(JSON.stringify(result, null, 2));} else {- console.log('Usage: router.js <task description>');+ console.log('Usage: router.cjs <task description>');console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));}}diff --git a/scripts/smoke-helper-signing-security.mjs b/scripts/smoke-helper-signing-security.mjsindex be3ce98163..008bd7a475 100644--- a/scripts/smoke-helper-signing-security.mjs+++ b/scripts/smoke-helper-signing-security.mjs@@ -35,7 +35,7 @@ try {mkdirSync(join(fixture, 'scripts'), { recursive: true });mkdirSync(join(fixture, '.claude', 'helpers'), { recursive: true });cpSync(signer, join(fixture, 'scripts', 'sign-helpers.mjs'));- for (const name of ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.js']) {+ for (const name of ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.cjs']) {cpSync(join(cli, '.claude', 'helpers', name), join(fixture, '.claude', 'helpers', name));}writeFileSync(join(fixture, 'package.json'), JSON.stringify({ version: '0.0.0-security-test' }));diff --git a/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.json b/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.jsonindex a2cbbc0381..260d7751f4 100644--- a/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.json+++ b/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.json@@ -3,12 +3,12 @@"version": "3.48.0","files": {"auto-memory-hook.mjs": "c8d218526a3c34034c2a69de23f507f0eb0f70d59c16426a8edc849e6ac22529",- "hook-handler.cjs": "209d9fafe10e17d1be0866727f6f9cf9ac66f9a0793f1c793a4f58319e8e4583",+ "hook-handler.cjs": "e758881c9aed5bc07ee18c3d98f6a32025fdf62f75f153cd3ec80e284b6e88c3","intelligence.cjs": "30e42ed7ec4ca5a94ac54fdb1330d2d47ac5f3fdeeef207753574723a9e77b5c","statusline.cjs": "4a48353b4f1566fa4379b00fd0321b6676a22b6cc91fbbd8380ac5183d619468",- "router.js": "b6998397e7883191b62229ccdc66fb87f1ccca1d5b2039ecb8c1e686d1ad81f8"+ "router.cjs": "16648b3c0d73b6681ac2d8d13def6a68286c57f5a11004de5b19a0fa088c833d"}},- "signature": "Y5fY+vJvnledNFp6edS2V1gxJ9P7llOQuq860/gCMvxr9DAzrlDuuKMuGgVP/Tb/25FStYm9+WyBVuOTDos0BQ==",+ "signature": "E+bAF8yyhdWgZ63QoW32z0zdJ7Tq5n5sFrXUk6EDLynp+vzckYh3ZLfyQ1DNHTlXHbYQKszWjmHk7SnXoQjZDQ==","algorithm": "ed25519"}diff --git a/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs b/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjsindex 004f1845e6..8536355063 100755--- a/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs+++ b/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs@@ -232,7 +232,7 @@ function safeRequire(modulePath) {return null;}-const router = safeRequire(path.join(helpersDir, 'router.js'));+const router = safeRequire(path.join(helpersDir, 'router.cjs'));const session = safeRequire(path.join(helpersDir, 'session.js'));const memory = safeRequire(path.join(helpersDir, 'memory.js'));const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));diff --git a/v3/@claude-flow/cli/.claude/helpers/router.js b/v3/@claude-flow/cli/.claude/helpers/router.cjssimilarity index 98%rename from v3/@claude-flow/cli/.claude/helpers/router.jsrename to v3/@claude-flow/cli/.claude/helpers/router.cjsindex 6f19e3756f..0695e192e5 100644--- a/v3/@claude-flow/cli/.claude/helpers/router.js+++ b/v3/@claude-flow/cli/.claude/helpers/router.cjs@@ -97,7 +97,7 @@ if (require.main === module) {const result = routeTask(task);console.log(JSON.stringify(result, null, 2));} else {- console.log('Usage: router.js <task description>');+ console.log('Usage: router.cjs <task description>');console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));}}diff --git a/v3/@claude-flow/cli/__tests__/adr-389-router-helper-refresh.test.ts b/v3/@claude-flow/cli/__tests__/adr-389-router-helper-refresh.test.tsindex 99698165c9..5f2066c9df 100644--- a/v3/@claude-flow/cli/__tests__/adr-389-router-helper-refresh.test.ts+++ b/v3/@claude-flow/cli/__tests__/adr-389-router-helper-refresh.test.ts@@ -1,15 +1,15 @@/*** ADR-389 / #3401 β the keyword router helper must be refreshed on upgrade.*- * `hook-handler.cjs` loads `router.js` from the same helpers dir to label each+ * `hook-handler.cjs` loads `router.cjs` from the same helpers dir to label each* prompt with a suggested agent. The April-era router matched keywords as* SUBSTRINGS ("la*test*" β tester). The word-boundary fix shipped in the- * package (PR #3402) but never reached existing installs, because `router.js`+ * package (PR #3402) but never reached existing installs, because `router.cjs`* was not in CRITICAL_HELPERS and `init` skips files that already exist.** Like helper-refresh.test.ts, the copy path is exercised against a* throwaway-keypair-signed fixture so this suite does not depend on the real- * manifest being re-signed. The fixture's router.js IS the real package copy,+ * manifest being re-signed. The fixture's router.cjs IS the real package copy,* so the test also proves the package ships the fixed router.*/import { describe, it, expect } from 'vitest';@@ -58,18 +58,18 @@ function routeTask(task) {module.exports = { routeTask, TASK_PATTERNS };`;-/** Load a CommonJS router.js fresh (no require cache reuse between loads). */+/** Load a CommonJS router.cjs fresh (no require cache reuse between loads). */function loadRouter(file: string): { routeTask: (t: string) => { agent: string; confidence: number } } {const req = createRequire(file);delete req.cache[req.resolve(file)];return req(file);}-/** Signed source fixture: the real package hook-handler.cjs + router.js. */+/** Signed source fixture: the real package hook-handler.cjs + router.cjs. */function makeSignedSource(version: string): { sourceDir: string; pubkeyPem: string } {const sourceDir = mkdtempSync(join(tmpdir(), 'adr389-source-'));const files: Record<string, string> = {};- for (const name of ['hook-handler.cjs', 'router.js']) {+ for (const name of ['hook-handler.cjs', 'router.cjs']) {const content = readFileSync(join(PKG_HELPERS_DIR, name));writeFileSync(join(sourceDir, name), content);files[name] = sha256Hex(content);@@ -84,26 +84,26 @@ function makeSignedSource(version: string): { sourceDir: string; pubkeyPem: strireturn { sourceDir, pubkeyPem: publicKey.export({ type: 'spki', format: 'pem' }).toString() };}-describe('ADR-389 β router.js is a refreshed critical helper', () => {- it('CRITICAL_HELPERS includes router.js', () => {- expect(CRITICAL_HELPERS).toContain('router.js');+describe('ADR-389 β router.cjs is a refreshed critical helper', () => {+ it('CRITICAL_HELPERS includes router.cjs', () => {+ expect(CRITICAL_HELPERS).toContain('router.cjs');});it('the stale April router really does misroute the prompt (fixture sanity)', () => {const dir = mkdtempSync(join(tmpdir(), 'adr389-stale-'));- writeFileSync(join(dir, 'router.js'), STALE_APRIL_ROUTER);- const r = loadRouter(join(dir, 'router.js')).routeTask(PROMPT);+ writeFileSync(join(dir, 'router.cjs'), STALE_APRIL_ROUTER);+ const r = loadRouter(join(dir, 'router.cjs')).routeTask(PROMPT);expect(r.agent).toBe('tester');expect(r.confidence).toBe(0.8);});- it('refresh replaces a stale substring router.js with the package copy', async () => {+ it('refresh replaces a stale substring router.cjs with the package copy', async () => {const version = getInstalledCliVersion();const cwd = mkdtempSync(join(tmpdir(), 'adr389-project-'));const helpersDir = join(cwd, '.claude', 'helpers');mkdirSync(helpersDir, { recursive: true });writeFileSync(join(helpersDir, 'hook-handler.cjs'), '// old hook-handler\n');- writeFileSync(join(helpersDir, 'router.js'), STALE_APRIL_ROUTER);+ writeFileSync(join(helpersDir, 'router.cjs'), STALE_APRIL_ROUTER);writeFileSync(join(helpersDir, HELPERS_STAMP_FILE), '0.0.1-old');const { sourceDir, pubkeyPem } = makeSignedSource(version);@@ -111,17 +111,17 @@ describe('ADR-389 β router.js is a refreshed critical helper', () => {expect(res.blocked).toBeUndefined();expect(res.refreshed).toBe(true);- const installed = readFileSync(join(helpersDir, 'router.js'));- expect(sha256Hex(installed)).toBe(sha256Hex(readFileSync(join(PKG_HELPERS_DIR, 'router.js'))));+ const installed = readFileSync(join(helpersDir, 'router.cjs'));+ expect(sha256Hex(installed)).toBe(sha256Hex(readFileSync(join(PKG_HELPERS_DIR, 'router.cjs'))));- const r = loadRouter(join(helpersDir, 'router.js')).routeTask(PROMPT);+ const r = loadRouter(join(helpersDir, 'router.cjs')).routeTask(PROMPT);expect(r.agent).not.toBe('tester');expect(r.agent).toBe('reviewer');});it('the generator fallback router (unresolvable package source) is also word-boundary', () => {const dir = mkdtempSync(join(tmpdir(), 'adr389-gen-'));- writeFileSync(join(dir, 'router.js'), generateAgentRouter());- expect(loadRouter(join(dir, 'router.js')).routeTask(PROMPT).agent).not.toBe('tester');+ writeFileSync(join(dir, 'router.cjs'), generateAgentRouter());+ expect(loadRouter(join(dir, 'router.cjs')).routeTask(PROMPT).agent).not.toBe('tester');});});diff --git a/v3/@claude-flow/cli/__tests__/router-cjs-esm-3555.test.ts b/v3/@claude-flow/cli/__tests__/router-cjs-esm-3555.test.tsnew file mode 100644index 0000000000..84c0f7ac93--- /dev/null+++ b/v3/@claude-flow/cli/__tests__/router-cjs-esm-3555.test.ts@@ -0,0 +1,83 @@+/**+ * #3555 β the keyword router helper is CommonJS, so it must ship as `.cjs`.+ *+ * Shipped as `router.js`, Node treats it as ESM in any project whose+ * package.json declares `"type":"module"`. `require` is then undefined, the+ * helper throws on load, and `hook-handler.cjs` silently prints+ * "Router not available, using default routing" β disabling ADR-389's fix in+ * exactly the projects most new Node code uses.+ */+import { describe, it, expect } from 'vitest';+import { mkdtempSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';+import { join, dirname } from 'node:path';+import { tmpdir } from 'node:os';+import { fileURLToPath } from 'node:url';+import { spawnSync } from 'node:child_process';++import { CRITICAL_HELPERS } from '../src/init/helper-refresh.js';+import { generateHelpers, generateHookHandler } from '../src/init/helpers-generator.js';++const PKG_HELPERS_DIR = join(dirname(fileURLToPath(import.meta.url)), '..', '.claude', 'helpers');+const PROMPT = 'sync and review latest issues';++/** A throwaway project whose package.json makes every `.js` file ESM. */+function esmProject(): { cwd: string; helpersDir: string } {+ const cwd = mkdtempSync(join(tmpdir(), 'router-esm-3555-'));+ writeFileSync(join(cwd, 'package.json'), JSON.stringify({ name: 'esm-probe', type: 'module' }));+ const helpersDir = join(cwd, '.claude', 'helpers');+ mkdirSync(helpersDir, { recursive: true });+ return { cwd, helpersDir };+}++function node(cwd: string, args: string[], env: Record<string, string> = {}) {+ return spawnSync(process.execPath, args, {+ cwd,+ input: '',+ encoding: 'utf-8',+ timeout: 20_000,+ env: { ...process.env, ...env },+ });+}++describe('#3555 β router helper loads in "type":"module" projects', () => {+ it('the package ships router.cjs and lists it as a critical helper', () => {+ expect(CRITICAL_HELPERS).toContain('router.cjs');+ expect(CRITICAL_HELPERS).not.toContain('router.js');+ expect(() => readFileSync(join(PKG_HELPERS_DIR, 'router.cjs'))).not.toThrow();+ });++ it('the generators emit router.cjs and a hook-handler that requires it', () => {+ const helpers = generateHelpers({ components: { helpers: true } } as never);+ expect(Object.keys(helpers)).toContain('router.cjs');+ expect(Object.keys(helpers)).not.toContain('router.js');+ expect(generateHookHandler()).toContain("path.join(helpersDir, 'router.cjs')");+ expect(generateHookHandler()).not.toContain("path.join(helpersDir, 'router.js')");+ });++ it('control: a .js copy of the same router throws in an ESM project (the reported failure)', () => {+ const { cwd, helpersDir } = esmProject();+ writeFileSync(join(helpersDir, 'router.js'), readFileSync(join(PKG_HELPERS_DIR, 'router.cjs')));+ const r = node(cwd, ['.claude/helpers/router.js', PROMPT]);+ expect(r.status).not.toBe(0);+ expect(r.stderr).toMatch(/require is not defined/);+ });++ it('router.cjs routes the prompt to reviewer when run directly in an ESM project', () => {+ const { cwd, helpersDir } = esmProject();+ writeFileSync(join(helpersDir, 'router.cjs'), readFileSync(join(PKG_HELPERS_DIR, 'router.cjs')));+ const r = node(cwd, ['.claude/helpers/router.cjs', PROMPT]);+ expect(r.status).toBe(0);+ expect(JSON.parse(r.stdout).agent).toBe('reviewer');+ });++ it('the packaged hook-handler routes through router.cjs in an ESM project', () => {+ const { cwd, helpersDir } = esmProject();+ for (const name of ['hook-handler.cjs', 'router.cjs']) {+ writeFileSync(join(helpersDir, name), readFileSync(join(PKG_HELPERS_DIR, name)));+ }+ const r = node(cwd, ['.claude/helpers/hook-handler.cjs', 'route'], { PROMPT });+ expect(r.stdout).not.toContain('Router not available');+ expect(r.stdout).toContain('Primary Recommendation');+ expect(r.stdout).toMatch(/Agent: reviewer/);+ });+});diff --git a/v3/@claude-flow/cli/__tests__/router-wordboundary.test.ts b/v3/@claude-flow/cli/__tests__/router-wordboundary.test.tsindex 9b62488017..510adaf617 100644--- a/v3/@claude-flow/cli/__tests__/router-wordboundary.test.ts+++ b/v3/@claude-flow/cli/__tests__/router-wordboundary.test.ts@@ -55,7 +55,7 @@ function loadRouterSource(source: string): Router {const ROUTERS: Array<[string, () => Router]> = [['generated (helpers-generator.ts)', () => loadRouterSource(generateAgentRouter())],['repo-root .claude/helpers/router.cjs', () => loadRouterSource(readFileSync(join(here, '../../../../.claude/helpers/router.cjs'), 'utf8'))],- ['cli .claude/helpers/router.js', () => loadRouterSource(readFileSync(join(here, '../.claude/helpers/router.js'), 'utf8'))],+ ['cli .claude/helpers/router.cjs', () => loadRouterSource(readFileSync(join(here, '../.claude/helpers/router.cjs'), 'utf8'))],['mcp .claude/helpers/router.js', () => loadRouterSource(readFileSync(join(here, '../../mcp/.claude/helpers/router.js'), 'utf8'))],];diff --git a/v3/@claude-flow/cli/scripts/sign-helpers.mjs b/v3/@claude-flow/cli/scripts/sign-helpers.mjsindex 88421b9985..4c52eb46b3 100644--- a/v3/@claude-flow/cli/scripts/sign-helpers.mjs+++ b/v3/@claude-flow/cli/scripts/sign-helpers.mjs@@ -31,7 +31,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));const PKG_ROOT = join(__dirname, '..');const HELPERS_DIR = join(PKG_ROOT, '.claude', 'helpers');// Keep in sync with src/init/helper-refresh.ts:CRITICAL_HELPERS.-const CRITICAL = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.js'];+const CRITICAL = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.cjs'];function loadPrivateKey() {if (process.argv.includes('--stdin-key')) {diff --git a/v3/@claude-flow/cli/scripts/verify-helpers.mjs b/v3/@claude-flow/cli/scripts/verify-helpers.mjsindex 60dbd6d3d4..821db8c768 100644--- a/v3/@claude-flow/cli/scripts/verify-helpers.mjs+++ b/v3/@claude-flow/cli/scripts/verify-helpers.mjs@@ -22,7 +22,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));const PKG_ROOT = join(__dirname, '..');const HELPERS_DIR = resolve(process.argv[2] || join(PKG_ROOT, '.claude', 'helpers'));// Keep in sync with sign-helpers.mjs:CRITICAL and src/init/helper-refresh.ts:CRITICAL_HELPERS.-const CRITICAL = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.js'];+const CRITICAL = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.cjs'];function die(msg) { console.error(`[verify-helpers] ${msg}`); process.exit(1); }diff --git a/v3/@claude-flow/cli/src/init/executor.ts b/v3/@claude-flow/cli/src/init/executor.tsindex 41dc8d8255..a6d6242b34 100644--- a/v3/@claude-flow/cli/src/init/executor.ts+++ b/v3/@claude-flow/cli/src/init/executor.ts@@ -575,7 +575,7 @@ export async function executeUpgrade(targetDir: string, upgradeSettings = false)const sourceHelpersForUpgrade = findSourceHelpersDir();if (sourceHelpersForUpgrade) {// Keep in sync with helper-refresh.ts:CRITICAL_HELPERS.- const criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.js'];+ const criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'router.cjs'];for (const helperName of criticalHelpers) {const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);const sourcePath = path.join(sourceHelpersForUpgrade, helperName);@@ -595,7 +595,7 @@ export async function executeUpgrade(targetDir: string, upgradeSettings = false)'hook-handler.cjs': generateHookHandler(),'intelligence.cjs': generateIntelligenceStub(),'auto-memory-hook.mjs': generateAutoMemoryHook(),- 'router.js': generateAgentRouter(), // ADR-389+ 'router.cjs': generateAgentRouter(), // ADR-389 / #3555};for (const [helperName, content] of Object.entries(generatedCritical)) {const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);@@ -1417,7 +1417,7 @@ async function writeHelpers('pre-commit': generatePreCommitHook(),'post-commit': generatePostCommitHook(),'session.js': generateSessionManager(),- 'router.js': generateAgentRouter(),+ 'router.cjs': generateAgentRouter(),'memory.js': generateMemoryHelper(),'hook-handler.cjs': generateHookHandler(),'intelligence.cjs': generateIntelligenceStub(),diff --git a/v3/@claude-flow/cli/src/init/helper-refresh.ts b/v3/@claude-flow/cli/src/init/helper-refresh.tsindex 1f00b33aaf..8d8a64a45a 100644--- a/v3/@claude-flow/cli/src/init/helper-refresh.ts+++ b/v3/@claude-flow/cli/src/init/helper-refresh.ts@@ -84,10 +84,11 @@ export const CRITICAL_HELPERS = [// statusline.cjs is here so the funnel disclosure row (ADR-301) reaches// existing installs on the next `ruflo` command, not only fresh `ruflo init`.'statusline.cjs',- // router.js is loaded by hook-handler.cjs to label each prompt with an agent.+ // router.cjs is loaded by hook-handler.cjs to label each prompt with an agent.// Without it here, installs kept the pre-#2257 substring router forever- // ("latest" -> tester). ADR-389 / #3401.- 'router.js',+ // ("latest" -> tester). ADR-389 / #3401. It is CommonJS, so it ships as+ // `.cjs`: a `.js` copy cannot load in a `"type":"module"` project (#3555).+ 'router.cjs',];function errorCode(error: unknown): string | undefined {@@ -305,7 +306,7 @@ async function writeCriticalHelpers('hook-handler.cjs': gen.generateHookHandler(),'intelligence.cjs': gen.generateIntelligenceStub(),'auto-memory-hook.mjs': gen.generateAutoMemoryHook(),- 'router.js': gen.generateAgentRouter(), // ADR-389+ 'router.cjs': gen.generateAgentRouter(), // ADR-389 / #3555// Fallback needs the same generator inputs `ruflo init` uses. We match the// hardcoded default (maxAgents 15) because the fallback fires when the// installed package is unresolvable β no way to read the user's projectdiff --git a/v3/@claude-flow/cli/src/init/helpers-generator.ts b/v3/@claude-flow/cli/src/init/helpers-generator.tsindex c399102b37..80077fae81 100644--- a/v3/@claude-flow/cli/src/init/helpers-generator.ts+++ b/v3/@claude-flow/cli/src/init/helpers-generator.ts@@ -342,7 +342,7 @@ if (require.main === module) {const result = routeTask(task);console.log(JSON.stringify(result, null, 2));} else {- console.log('Usage: router.js <task description>');+ console.log('Usage: router.cjs <task description>');console.log('\\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));}}@@ -512,7 +512,7 @@ export function generateHookHandler(): string {' return null;','}','',- "const router = safeRequire(path.join(helpersDir, 'router.js'));",+ "const router = safeRequire(path.join(helpersDir, 'router.cjs'));","const session = safeRequire(path.join(helpersDir, 'session.js'));","const memory = safeRequire(path.join(helpersDir, 'memory.js'));","const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));",@@ -1393,7 +1393,7 @@ export function generateHelpers(options: InitOptions): Record<string, string> {// Cross-platform Node.js scriptshelpers['session.js'] = generateCrossPlatformSessionManager();- helpers['router.js'] = generateAgentRouter();+ helpers['router.cjs'] = generateAgentRouter();helpers['memory.js'] = generateMemoryHelper();// Windows-specific scripts