debug(tmux-panes): strip trailing slash, always hold pane open 30s

This commit is contained in:
alex
2026-03-11 12:28:19 +00:00
parent 1145ce2be4
commit 00335c86ae

View File

@@ -30,7 +30,7 @@ const plugin: Plugin = async (ctx) => {
const sessions = new Map<string, string>() // sessionId → tmux paneId
const sourcePaneId = getCurrentPaneId()
const serverUrl = ctx.serverUrl?.toString() ?? ""
const serverUrl = (ctx.serverUrl?.toString() ?? "").replace(/\/$/, "")
log(`plugin init — serverUrl=${serverUrl} sourcePaneId=${sourcePaneId}`)
// Ordered list of pane IDs in the right column.
@@ -50,7 +50,7 @@ const plugin: Plugin = async (ctx) => {
// Wrap the attach command: on failure, show the error and keep the
// pane open for 30 s so we can read it before it disappears.
const attachCmd = `opencode attach ${serverUrl} --session ${sessionId}`
const cmd = `bash -c '${attachCmd}; _exit=$?; echo "--- exit: $_exit ---" >> ${DEBUG_LOG}; [ $_exit -ne 0 ] && sleep 30'`
const cmd = `bash -c '${attachCmd}; echo "--- exit: $? ---" >> ${DEBUG_LOG}; sleep 30'`
log(`spawning pane — cmd: ${attachCmd}`)
let args: string[]