mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 00:05:51 +00:00
feat: 添加 Windows Terminal swarm 后端及 swarm 增强
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,9 @@ let isInsideTmuxCached: boolean | null = null
|
||||
/** Cached result for isInITerm2 */
|
||||
let isInITerm2Cached: boolean | null = null
|
||||
|
||||
/** Cached result for isInWindowsTerminal */
|
||||
let isInWindowsTerminalCached: boolean | null = null
|
||||
|
||||
/**
|
||||
* Checks if we're currently running inside a tmux session (synchronous version).
|
||||
* Uses the original TMUX value captured at module load, not process.env.TMUX,
|
||||
@@ -75,6 +78,20 @@ export async function isTmuxAvailable(): Promise<boolean> {
|
||||
return result.code === 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if wt.exe is available without executing it.
|
||||
* Do NOT run `wt.exe --version` — wt.exe is a UWP app bridge that opens
|
||||
* the Windows Terminal GUI to render version info, producing a phantom
|
||||
* "Windows 终端 1.24.x" window every time availability is checked.
|
||||
*/
|
||||
export async function isWindowsTerminalAvailable(): Promise<boolean> {
|
||||
if (process.env.WT_SESSION) {
|
||||
return true
|
||||
}
|
||||
const result = await execFileNoThrow('where.exe', ['wt.exe'])
|
||||
return result.code === 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if we're currently running inside iTerm2.
|
||||
* Uses multiple detection methods:
|
||||
@@ -103,6 +120,18 @@ export function isInITerm2(): boolean {
|
||||
return isInITerm2Cached
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if we're currently running inside Windows Terminal.
|
||||
* Windows Terminal sets WT_SESSION for child processes.
|
||||
*/
|
||||
export function isInWindowsTerminal(): boolean {
|
||||
if (isInWindowsTerminalCached !== null) {
|
||||
return isInWindowsTerminalCached
|
||||
}
|
||||
isInWindowsTerminalCached = !!process.env.WT_SESSION
|
||||
return isInWindowsTerminalCached
|
||||
}
|
||||
|
||||
/**
|
||||
* The it2 CLI command name.
|
||||
*/
|
||||
@@ -125,4 +154,5 @@ export async function isIt2CliAvailable(): Promise<boolean> {
|
||||
export function resetDetectionCache(): void {
|
||||
isInsideTmuxCached = null
|
||||
isInITerm2Cached = null
|
||||
isInWindowsTerminalCached = null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user