mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Add Windows remote terminal support (#642)
This commit is contained in:
@@ -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…',
|
||||
|
||||
@@ -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': '在此粘贴终端输入…',
|
||||
|
||||
@@ -34,6 +34,9 @@ export type SessionMetadataSummary = {
|
||||
machineId?: string
|
||||
tools?: string[]
|
||||
flavor?: string | null
|
||||
capabilities?: {
|
||||
terminal?: boolean
|
||||
}
|
||||
worktree?: WorktreeMetadata
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user