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
+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
}