diff --git a/packages/agents/devhub/judge/JudgeAgent.ts b/packages/agents/devhub/judge/JudgeAgent.ts index 99fcb8c..aa49ece 100644 --- a/packages/agents/devhub/judge/JudgeAgent.ts +++ b/packages/agents/devhub/judge/JudgeAgent.ts @@ -32,8 +32,20 @@ export class JudgeAgent extends PromptAgent implements RunnableAgent { private systemPrompt?: string; async initialize() { + // In production (dist/), agent files are in dist/agents/devhub/judge/ + // In development, they're alongside this file const agentDir = path.dirname(fileURLToPath(import.meta.url)); - const systemPromptPath = path.join(agentDir, 'judge.agent.md'); + let systemPromptPath = path.join(agentDir, 'judge.agent.md'); + + // Check if running from dist/cli (bundled), need to go to dist/agents + try { + await fs.access(systemPromptPath); + } catch { + // Fallback: look in dist/agents/devhub/judge/ + const distRoot = path.resolve(agentDir, '../../'); + systemPromptPath = path.join(distRoot, 'agents/devhub/judge/judge.agent.md'); + } + this.systemPrompt = await fs.readFile(systemPromptPath, 'utf-8'); addLog(`[JudgeAgent] Initialized with prompt length: ${this.systemPrompt.length}`); diff --git a/scripts/test-pack.js b/scripts/test-pack.js index e803b8d..7d4c2b7 100644 --- a/scripts/test-pack.js +++ b/scripts/test-pack.js @@ -42,7 +42,7 @@ run(`npm install --ignore-scripts`, { }); // Run the extracted package binary (what users will actually run) -run(`node dist/cli/main.js --workspace /tmp --start -p 'list files'`, { +run(`node dist/cli/main.js --workspace /tmp --start -p 'list files' --auto-exit`, { cwd: `${testDir}/package`, env: cleanEnv, });