Add Windows remote terminal support (#642)

This commit is contained in:
leko
2026-05-19 07:54:12 +08:00
committed by GitHub
parent bb04247127
commit ce2e76a42e
17 changed files with 240 additions and 29 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ export default {
'terminal.commandArgs': 'Command args',
'terminal.stdout': 'Stdout',
'terminal.stderr': 'Stderr',
'terminal.unsupportedWindows': 'Remote terminal is unavailable on Windows hosts.',
'terminal.unsupportedWindows': 'Remote terminal is unavailable on this host.',
'terminal.paste.fallbackTitle': 'Paste input',
'terminal.paste.fallbackDescription': 'Clipboard read is unavailable. Paste your text below.',
'terminal.paste.placeholder': 'Paste terminal input here…',
+1 -1
View File
@@ -181,7 +181,7 @@ export default {
'terminal.commandArgs': '命令参数',
'terminal.stdout': '标准输出',
'terminal.stderr': '标准错误',
'terminal.unsupportedWindows': 'Windows 主机暂不支持远程终端。',
'terminal.unsupportedWindows': '主机暂不支持远程终端。',
'terminal.paste.fallbackTitle': '粘贴输入',
'terminal.paste.fallbackDescription': '无法读取剪贴板,请在下方粘贴文本。',
'terminal.paste.placeholder': '在此粘贴终端输入…',
+3
View File
@@ -34,6 +34,9 @@ export type SessionMetadataSummary = {
machineId?: string
tools?: string[]
flavor?: string | null
capabilities?: {
terminal?: boolean
}
worktree?: WorktreeMetadata
}
+18 -3
View File
@@ -2,14 +2,29 @@ import { describe, expect, it } from 'vitest'
import { isRemoteTerminalSupported, isWindowsHostOs } from './terminalSupport'
describe('terminal support helpers', () => {
it('detects Windows session hosts as unsupported', () => {
it('does not disable remote terminal only because the session host is Windows', () => {
expect(isWindowsHostOs('win32')).toBe(true)
expect(isRemoteTerminalSupported({ os: 'win32', path: '', host: '' })).toBe(false)
expect(isRemoteTerminalSupported({ os: 'win32', path: '', host: '' })).toBe(true)
})
it('keeps remote terminal enabled for non-Windows or unknown hosts', () => {
it('keeps remote terminal enabled for non-Windows or unknown hosts by default', () => {
expect(isWindowsHostOs('linux')).toBe(false)
expect(isRemoteTerminalSupported({ os: 'linux', path: '', host: '' })).toBe(true)
expect(isRemoteTerminalSupported(null)).toBe(true)
})
it('respects explicit terminal capability metadata when present', () => {
expect(isRemoteTerminalSupported({
os: 'win32',
path: '',
host: '',
capabilities: { terminal: false }
})).toBe(false)
expect(isRemoteTerminalSupported({
os: 'win32',
path: '',
host: '',
capabilities: { terminal: true }
})).toBe(true)
})
})
+1 -1
View File
@@ -5,5 +5,5 @@ export function isWindowsHostOs(os: string | null | undefined): boolean {
}
export function isRemoteTerminalSupported(metadata: SessionMetadataSummary | null | undefined): boolean {
return !isWindowsHostOs(metadata?.os)
return metadata?.capabilities?.terminal ?? true
}