fix(tmux): defer subagent attach until pane focus

This commit is contained in:
Disaster-Terminator
2026-04-18 13:19:14 +08:00
committed by YeonGyu-Kim
parent 6e5a127f88
commit 688bb551b2
11 changed files with 245 additions and 15 deletions
@@ -0,0 +1,15 @@
import { shellEscapeForDoubleQuotedCommand } from "../../shell-env"
const TMUX_COMMAND_SHELL = "/bin/sh"
export function buildTmuxAttachCommand(serverUrl: string, sessionId: string, directory: string): string {
const escapedUrl = shellEscapeForDoubleQuotedCommand(serverUrl)
const escapedSessionId = shellEscapeForDoubleQuotedCommand(sessionId)
const escapedDirectory = shellEscapeForDoubleQuotedCommand(directory || process.cwd())
return `${TMUX_COMMAND_SHELL} -c "opencode attach ${escapedUrl} --session ${escapedSessionId} --dir ${escapedDirectory}"`
}
export function buildTmuxPlaceholderCommand(description: string): string {
const escapedDescription = shellEscapeForDoubleQuotedCommand(description)
return `${TMUX_COMMAND_SHELL} -c "printf '%s\\n%s\\n' \"OMO subagent pane ready: ${escapedDescription}\" \"Focus this pane to attach.\"; exec tail -f /dev/null"`
}