programmatic subagents
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(drivers): validate model arg mapping and raw stream output across drivers

+22 -11
+7 -2
packages/driver-claude/src/public/index.api.test.ts
··· 6 6 const runtime = Runtime.defaultRuntime; 7 7 8 8 const CLAUDE_JSON_FIXTURE_SCRIPT = 9 + "const args=process.argv.slice(1);" + 10 + "const modelIndex=args.indexOf('--model');" + 11 + "const selectedModel=modelIndex>=0?args[modelIndex+1]:'missing-model';" + 9 12 "console.log(JSON.stringify({type:'system',session_id:'claude-session'}));" + 10 13 "console.log(JSON.stringify({type:'assistant',message:{content:[{type:'tool_use',name:'Bash'},{type:'text',text:'Working...'}]}}));" + 11 - "console.log(JSON.stringify({type:'result',subtype:'success',is_error:false,result:'done',stop_reason:'stop',session_id:'claude-session'}));"; 14 + "console.log(JSON.stringify({type:'result',subtype:'success',is_error:false,result:'model:'+selectedModel,stop_reason:'stop',session_id:'claude-session'}));"; 12 15 13 16 describe("createClaudeDriverRegistration", () => { 14 17 it("supports explicit model catalogs", async () => { ··· 34 37 const driver = createClaudeDriverRegistration({ 35 38 process: { 36 39 command: "bun", 37 - args: ["-e", CLAUDE_JSON_FIXTURE_SCRIPT], 40 + args: ["-e", CLAUDE_JSON_FIXTURE_SCRIPT, "--"], 38 41 }, 39 42 models: ["anthropic/claude-sonnet-4-6"], 40 43 }); ··· 60 63 61 64 expect(output.result.driver).toBe("claude"); 62 65 expect(output.result.sessionRef).toBe("claude-session"); 66 + expect(output.result.text).toBe("model:claude-sonnet-4-6"); 63 67 expect(output.events.some((event) => event.type === "tool_call")).toBe(true); 68 + expect(output.raw?.length ?? 0).toBeGreaterThan(0); 64 69 }); 65 70 });
+7 -3
packages/driver-codex/src/public/index.api.test.ts
··· 6 6 const runtime = Runtime.defaultRuntime; 7 7 8 8 const CODEX_JSON_FIXTURE_SCRIPT = 9 + "const args=process.argv.slice(1);" + 10 + "const modelIndex=args.indexOf('--model');" + 11 + "const selectedModel=modelIndex>=0?args[modelIndex+1]:'missing-model';" + 9 12 "console.log(JSON.stringify({type:'thread.started',thread_id:'codex-thread'}));" + 10 13 "console.log(JSON.stringify({type:'item.completed',item:{type:'command_execution',command:'ls -la'}}));" + 11 - "console.log(JSON.stringify({type:'item.completed',item:{type:'agent_message',text:'done'}}));" + 14 + "console.log(JSON.stringify({type:'item.completed',item:{type:'agent_message',text:'model:'+selectedModel}}));" + 12 15 "console.log(JSON.stringify({type:'turn.completed'}));"; 13 16 14 17 describe("createCodexDriverRegistration", () => { ··· 33 36 const driver = createCodexDriverRegistration({ 34 37 process: { 35 38 command: "bun", 36 - args: ["-e", CODEX_JSON_FIXTURE_SCRIPT], 39 + args: ["-e", CODEX_JSON_FIXTURE_SCRIPT, "--"], 37 40 }, 38 41 models: ["openai/gpt-5.3-codex"], 39 42 }); ··· 59 62 60 63 expect(output.result.driver).toBe("codex"); 61 64 expect(output.result.sessionRef).toBe("codex-thread"); 62 - expect(output.result.text).toBe("done"); 65 + expect(output.result.text).toBe("model:gpt-5.3-codex"); 63 66 expect(output.events.some((event) => event.type === "tool_call")).toBe(true); 67 + expect(output.raw?.length ?? 0).toBeGreaterThan(0); 64 68 }); 65 69 });
+8 -6
packages/driver-pi/src/public/index.api.test.ts
··· 13 13 "const modelIndex=args.indexOf('--model');" + 14 14 "const model=modelIndex>=0?args[modelIndex+1]:'openai/gpt-5.3-codex';" + 15 15 "const prompt=args[args.length-1]??'';" + 16 + "const text='fixture:'+model+':'+prompt;" + 16 17 "console.log(JSON.stringify({type:'session',id:'session-test'}));" + 17 18 "console.log(JSON.stringify({type:'agent_start'}));" + 18 19 "console.log(JSON.stringify({type:'tool_execution_start',toolName:'bash'}));" + 19 - "console.log(JSON.stringify({type:'message_end',message:{role:'assistant',content:[{type:'text',text:'fixture:'+prompt}],model,stopReason:'stop'}}));" + 20 - "console.log(JSON.stringify({type:'agent_end',messages:[{role:'assistant',content:[{type:'text',text:'fixture:'+prompt}],model,stopReason:'stop'}]}));"; 20 + "console.log(JSON.stringify({type:'message_end',message:{role:'assistant',content:[{type:'text',text}],model,stopReason:'stop'}}));" + 21 + "console.log(JSON.stringify({type:'agent_end',messages:[{role:'assistant',content:[{type:'text',text}],model,stopReason:'stop'}]}));"; 21 22 22 23 const DUPLICATE_TERMINAL_SCRIPT = 23 24 "console.log(JSON.stringify({type:'agent_end',messages:[{role:'assistant',content:[{type:'text',text:'first'}]}]}));" + ··· 87 88 const driver = createPiDriverRegistration({ 88 89 process: { 89 90 command: "bun", 90 - args: ["-e", PI_JSON_FIXTURE_SCRIPT], 91 + args: ["-e", PI_JSON_FIXTURE_SCRIPT, "--"], 91 92 }, 92 93 models: ["openai/gpt-5.3-codex"], 93 94 }); ··· 117 118 expect(output.result.sessionRef).toBe("/tmp/run_driver_test/sessions/spawn_driver_test.jsonl"); 118 119 expect(output.result.agent).toBe("scout"); 119 120 expect(output.result.model).toBe("openai/gpt-5.3-codex"); 120 - expect(output.result.text).toBe("fixture:Say hello"); 121 + expect(output.result.text).toBe("fixture:openai/gpt-5.3-codex:Say hello"); 121 122 expect(output.result.exitCode).toBe(0); 123 + expect(output.raw?.length ?? 0).toBeGreaterThan(0); 122 124 }); 123 125 124 126 it("resolves session pointers for inspect --session bridge", async () => { ··· 154 156 const driver = createPiDriverRegistration({ 155 157 process: { 156 158 command: "bun", 157 - args: ["-e", DUPLICATE_TERMINAL_SCRIPT], 159 + args: ["-e", DUPLICATE_TERMINAL_SCRIPT, "--"], 158 160 }, 159 161 models: ["openai/gpt-5.3-codex"], 160 162 }); ··· 187 189 const driver = createPiDriverRegistration({ 188 190 process: { 189 191 command: "bun", 190 - args: ["-e", ERROR_TERMINAL_SCRIPT], 192 + args: ["-e", ERROR_TERMINAL_SCRIPT, "--"], 191 193 }, 192 194 models: ["openai/gpt-5.3-codex"], 193 195 });