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
+2 -4
View File
@@ -1,10 +1,8 @@
import { getCommandTokenPathBasename, getFirstCommandToken } from './command-token-scanner'
import type { TuiAgent } from './tui-agent'
import { getAgentLaunchExecutableName } from './agent-command-line-intent'
function openCodeCommandAgent(launchCommand: string | undefined): 'opencode' | 'opencode2' | null {
const binary = getCommandTokenPathBasename(getFirstCommandToken(launchCommand ?? ''))
.toLowerCase()
.replace(/\.(?:cmd|exe|sh)$/, '')
const binary = getAgentLaunchExecutableName(launchCommand)
return binary === 'opencode' || binary === 'opencode2' ? binary : null
}