feat: 添加 Windows Terminal swarm 后端及 swarm 增强

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
unraid
2026-04-22 22:38:09 +08:00
parent c4775fff58
commit 59f8675fa3
17 changed files with 1298 additions and 86 deletions

View File

@@ -145,6 +145,42 @@ export class TmuxBackend implements PaneBackend {
}
}
/**
* Creates a separate tmux window for a teammate in the swarm session.
* Used by the legacy `use_splitpane: false` path.
*/
async createTeammateWindowInSwarmView(
name: string,
color: AgentColorName,
): Promise<CreatePaneResult & { windowName: string }> {
const windowName = `teammate-${name.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase()}`
const { windowTarget } = await this.createExternalSwarmSession()
void windowTarget
const result = await runTmuxInSwarm([
'new-window',
'-t',
SWARM_SESSION_NAME,
'-n',
windowName,
'-P',
'-F',
'#{pane_id}',
])
if (result.code !== 0) {
throw new Error(
`Failed to create tmux window: ${result.stderr || 'Unknown error'}`,
)
}
const paneId = result.stdout.trim()
await this.setPaneTitle(paneId, name, color, true)
await this.setPaneBorderColor(paneId, color, true)
return { paneId, isFirstTeammate: false, windowName }
}
/**
* Sends a command to a specific pane.
*/