Fix delayed agent launches such as sleep 30 && claude (#28205)

* fix(terminal): preserve preparation and discovery for delayed agent launches

* refactor(agents): centralize launch intent recognition

* refactor(agents): keep launch intent in one module apart from process recognition

Move recognizeAgentLaunchCommand next to the sleep-prefix scanner so the strict
process-table matcher is untouched, name the module away from the agent-launch
funnel files, share one executable-name normalizer, and colocate the
preparation tests with their modules.
This commit is contained in:
Neil
2026-10-13 01:55:18 -07:00
committed by GitHub
parent acea005ed8
commit 7246a0e269
32 changed files with 746 additions and 187 deletions
@@ -29,3 +29,14 @@ describe('OpenCode hook selection', () => {
).toBe('opencode2')
})
})
describe('selectOpenCodeHookAgent after a sleep prefix', () => {
it('selects OpenCode 2 hooks instead of the v1 fallback', () => {
expect(selectOpenCodeHookAgent(undefined, 'sleep 30 && opencode2', () => true)).toBe(
'opencode2'
)
expect(
selectOpenCodeHookAgent(undefined, 'sleep 30 && opencode2', (agent) => agent === 'opencode')
).toBeNull()
})
})