From e8761ee851f745d602c2c4ad026ec944d45c54f2 Mon Sep 17 00:00:00 2001 From: HuanLinOTO Date: Tue, 8 Sep 2026 21:21:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(terminal):=20=E9=85=8D=E7=BD=AE=20shell=20?= =?UTF-8?q?=E6=9C=AA=E6=89=BE=E5=88=B0=E6=97=B6=E6=98=BE=E7=A4=BA=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=8C=96=E5=8F=AF=E6=93=8D=E4=BD=9C=E6=A8=AA=E5=B9=85?= =?UTF-8?q?=EF=BC=88=E5=85=A8=E8=AF=AD=E8=A8=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/TerminalView.tsx | 13 +++++++++++++ src/client/locales-ar.ts | 1 + src/client/locales-de.ts | 1 + src/client/locales-fr.ts | 1 + src/client/locales-hi.ts | 1 + src/client/locales-id.ts | 1 + src/client/locales-it.ts | 1 + src/client/locales-ja.ts | 1 + src/client/locales-ko.ts | 1 + src/client/locales-nl.ts | 1 + src/client/locales-pl.ts | 1 + src/client/locales-pt.ts | 1 + src/client/locales-ru.ts | 1 + src/client/locales-sv.ts | 1 + src/client/locales-th.ts | 1 + src/client/locales-tr.ts | 1 + src/client/locales-vi.ts | 1 + src/client/locales-zh-HK.ts | 1 + src/client/locales-zh-MO.ts | 1 + src/client/locales-zh-TW.ts | 1 + src/client/locales.ts | 2 ++ 21 files changed, 34 insertions(+) diff --git a/src/client/TerminalView.tsx b/src/client/TerminalView.tsx index 5c47604..ab03083 100644 --- a/src/client/TerminalView.tsx +++ b/src/client/TerminalView.tsx @@ -61,6 +61,13 @@ const FAILURE_LIMIT = 3 */ const PTY_DEPS_MISSING = 'pty-deps-missing' +/** + * The WS close-reason prefix the host sends when the CONFIGURED shell was + * not found (mirror of src/index.ts wsCloseReasonOf; wire contract, keep the + * literal in lockstep). The view renders a localized, actionable banner. + */ +const SHELL_NOT_FOUND_PREFIX = 'shell-not-found:' + /** The degraded-mode payload rendered by {@link TerminalDepsBanner}. */ type TerminalDepsInfo = Extract @@ -242,6 +249,12 @@ export function TerminalView(props: { scope: SessionScope; tabId: string; store: }) return } + // The configured shell could not be found (settings page or yaml): + // a localized banner beats the raw English close reason. + if (event.code === 1011 && event.reason.startsWith(SHELL_NOT_FOUND_PREFIX)) { + setFatal(t('terminalShellNotFound', { name: event.reason.slice(SHELL_NOT_FOUND_PREFIX.length) || '?' })) + return + } // A server-side refusal carries a close code + reason; retrying it // forever would only spin the banner, so surface it with a retry. if (event.code === 1011 && event.reason !== '') { diff --git a/src/client/locales-ar.ts b/src/client/locales-ar.ts index 605f467..cc66eec 100644 --- a/src/client/locales-ar.ts +++ b/src/client/locales-ar.ts @@ -107,6 +107,7 @@ export const ar: Record = { terminalDepsFailed: 'فشل تحميل تبعية الطرفية node-pty', terminalDepsHint: 'شغّل الأمر التالي في طرفية أو cmd على جهاز DSH للإصلاح، ثم أعد المحاولة (يبقى node-pty متزامناً مع إصدار نواة DSH):', terminalDepsProfile: ' (الملف الشخصي المكتشف: {profile})', + terminalShellNotFound: 'لم يتم العثور على الصدفة المُعدَّة: {name} — تحقق من مسار الصدفة في الإعدادات → Side card → Terminal', preview: 'معاينة', toc: 'الفهرس', edit: 'تحرير', diff --git a/src/client/locales-de.ts b/src/client/locales-de.ts index 0a3495c..d34b382 100644 --- a/src/client/locales-de.ts +++ b/src/client/locales-de.ts @@ -92,6 +92,7 @@ export const de: Record = { terminalDepsFailed: 'Die Terminal-Abhängigkeit node-pty konnte nicht geladen werden', terminalDepsHint: 'Führen Sie den folgenden Befehl in einem Terminal oder in cmd auf dem DSH-System aus, um dies zu beheben, und klicken Sie dann auf „Erneut versuchen“ (node-pty bleibt mit der DSH-Core-Version synchron):', terminalDepsProfile: ' (erkanntes Profil: {profile})', + terminalShellNotFound: 'Konfigurierte Shell nicht gefunden: {name} — Shell-Pfad unter Einstellungen → Side card → Terminal prüfen', preview: 'Vorschau', toc: 'Inhaltsverzeichnis', edit: 'Bearbeiten', diff --git a/src/client/locales-fr.ts b/src/client/locales-fr.ts index 9e4c23c..567fffd 100644 --- a/src/client/locales-fr.ts +++ b/src/client/locales-fr.ts @@ -99,6 +99,7 @@ export const fr: Record = { terminalDepsFailed: 'Échec du chargement de la dépendance terminal node-pty', terminalDepsHint: 'Exécutez la commande suivante dans un terminal ou cmd de l’environnement DSH pour réparer, puis cliquez sur Réessayer (node-pty reste à la même version que le cœur DSH) :', terminalDepsProfile: ' (profil détecté : {profile})', + terminalShellNotFound: 'Shell configuré introuvable : {name} — vérifiez le chemin du shell dans Réglages → Side card → Terminal', preview: 'Aperçu', toc: 'Sommaire', edit: 'Modifier', diff --git a/src/client/locales-hi.ts b/src/client/locales-hi.ts index f78e1c7..3c0ee0b 100644 --- a/src/client/locales-hi.ts +++ b/src/client/locales-hi.ts @@ -106,6 +106,7 @@ export const hi: Record = { terminalDepsFailed: 'टर्मिनल निर्भरता node-pty लोड विफल', terminalDepsHint: 'DSH मशीन पर एक टर्मिनल या cmd में नीचे दिया गया कमांड चलाएँ, फिर पुनः प्रयास करें (node-pty DSH कोर संस्करण के साथ सिंक रहता है):', terminalDepsProfile: ' (पहचाना गया प्रोफ़ाइल: {profile})', + terminalShellNotFound: 'कॉन्फ़िगर किया गया shell नहीं मिला: {name} — Settings → Side card → Terminal में shell पथ जाँचें', preview: 'पूर्वावलोकन', toc: 'विषय-सूची', edit: 'संपादित करें', diff --git a/src/client/locales-id.ts b/src/client/locales-id.ts index 33fc653..45a1002 100644 --- a/src/client/locales-id.ts +++ b/src/client/locales-id.ts @@ -104,6 +104,7 @@ export const id: Record = { terminalDepsFailed: 'Dependensi terminal node-pty gagal dimuat', terminalDepsHint: 'Jalankan perintah di bawah ini di terminal atau cmd pada mesin DSH untuk memperbaikinya, lalu coba lagi (node-pty tetap sinkron dengan versi inti DSH):', terminalDepsProfile: ' (profil terdeteksi: {profile})', + terminalShellNotFound: 'Shell yang dikonfigurasi tidak ditemukan: {name} — periksa path shell di Pengaturan → Side card → Terminal', preview: 'Pratinjau', toc: 'Daftar Isi', edit: 'Edit', diff --git a/src/client/locales-it.ts b/src/client/locales-it.ts index f2629ce..a7ab143 100644 --- a/src/client/locales-it.ts +++ b/src/client/locales-it.ts @@ -97,6 +97,7 @@ export const it: Record = { terminalDepsFailed: 'Caricamento della dipendenza del terminale node-pty non riuscito', terminalDepsHint: 'Esegua il comando seguente in un terminale o cmd sul computer DSH per ripristinarlo, poi riprovi (node-pty resta sincronizzato con la versione del core DSH):', terminalDepsProfile: ' (rilevato profilo: {profile})', + terminalShellNotFound: 'Shell configurata non trovata: {name} — verifica il percorso della shell in Impostazioni → Side card → Terminal', preview: 'Anteprima', toc: 'Indice', edit: 'Modifica', diff --git a/src/client/locales-ja.ts b/src/client/locales-ja.ts index 7f91f50..a967059 100644 --- a/src/client/locales-ja.ts +++ b/src/client/locales-ja.ts @@ -106,6 +106,7 @@ export const ja: Record = { terminalDepsFailed: 'ターミナル依存関係 node-pty の読み込みに失敗', terminalDepsHint: 'DSH 環境のターミナルまたは cmd で以下のコマンドを実行して修復し、再試行してください(node-pty は DSH コアと同じバージョンを維持):', terminalDepsProfile: '(検出された profile:{profile})', + terminalShellNotFound: '設定されたシェルが見つかりません:{name}(設定 → サイドカード → ターミナル のシェルパスを確認してください)', preview: 'プレビュー', toc: '目次', edit: '編集', diff --git a/src/client/locales-ko.ts b/src/client/locales-ko.ts index f27bf13..4e8b4f1 100644 --- a/src/client/locales-ko.ts +++ b/src/client/locales-ko.ts @@ -98,6 +98,7 @@ export const ko: Record = { terminalDepsFailed: '터미널 의존성 node-pty 로드 실패', terminalDepsHint: 'DSH가 설치된 환경의 터미널 또는 cmd에서 아래 명령을 실행하여 복구한 후 다시 시도를 클릭하세요(node-pty는 DSH 코어와 동일한 버전을 유지합니다):', terminalDepsProfile: ' (profile 감지됨: {profile})', + terminalShellNotFound: '설정된 셸을 찾을 수 없습니다: {name} — 설정 → 사이드 카드 → 터미널에서 셸 경로를 확인하세요', preview: '미리보기', toc: '목차', edit: '편집', diff --git a/src/client/locales-nl.ts b/src/client/locales-nl.ts index 96d976e..8106e22 100644 --- a/src/client/locales-nl.ts +++ b/src/client/locales-nl.ts @@ -104,6 +104,7 @@ export const nl: Record = { terminalDepsFailed: 'Terminalafhankelijkheid node-pty kon niet worden geladen', terminalDepsHint: 'Voer het onderstaande commando uit in een terminal of cmd op de DSH-machine om het te herstellen en probeer het opnieuw (node-pty blijft in sync met de DSH-coreversie):', terminalDepsProfile: ' (gedetecteerde profile: {profile})', + terminalShellNotFound: 'Geconfigureerde shell niet gevonden: {name} — controleer het shell-pad onder Instellingen → Side card → Terminal', preview: 'Voorbeeld', toc: 'Inhoudsopgave', edit: 'Bewerken', diff --git a/src/client/locales-pl.ts b/src/client/locales-pl.ts index f9d5999..dd62423 100644 --- a/src/client/locales-pl.ts +++ b/src/client/locales-pl.ts @@ -108,6 +108,7 @@ export const pl: Record = { terminalDepsFailed: 'Zależność terminala node-pty nie mogła się załadować', terminalDepsHint: 'Uruchom poniższe polecenie w terminalu lub cmd na maszynie DSH, aby to naprawić, a następnie ponów (node-pty pozostaje w synchronizacji z wersją rdzenia DSH):', terminalDepsProfile: ' (wykryty profil: {profile})', + terminalShellNotFound: 'Nie znaleziono skonfigurowanej powłoki: {name} — sprawdź ścieżkę powłoki w Ustawienia → Side card → Terminal', preview: 'Podgląd', toc: 'Spis treści', edit: 'Edytuj', diff --git a/src/client/locales-pt.ts b/src/client/locales-pt.ts index 03e022a..08c0d25 100644 --- a/src/client/locales-pt.ts +++ b/src/client/locales-pt.ts @@ -89,6 +89,7 @@ export const pt: Record = { terminalDepsFailed: 'A dependência do terminal node-pty falhou ao carregar', terminalDepsHint: 'Execute o comando abaixo em um terminal ou cmd na máquina do DSH para reparar e tente novamente (node-pty permanece em sincronia com a versão do núcleo do DSH):', terminalDepsProfile: ' (perfil detectado: {profile})', + terminalShellNotFound: 'Shell configurado não encontrado: {name} — verifique o caminho do shell em Configurações → Side card → Terminal', preview: 'Pré-visualizar', toc: 'Sumário', edit: 'Editar', diff --git a/src/client/locales-ru.ts b/src/client/locales-ru.ts index c75518c..10711b8 100644 --- a/src/client/locales-ru.ts +++ b/src/client/locales-ru.ts @@ -102,6 +102,7 @@ export const ru: Record = { terminalDepsFailed: 'Не удалось загрузить зависимость терминала node-pty', terminalDepsHint: 'Выполните приведённую ниже команду в терминале или cmd на машине DSH, затем нажмите «Повторить» (node-pty остаётся синхронизированным с версией ядра DSH):', terminalDepsProfile: ' (обнаружен profile: {profile})', + terminalShellNotFound: 'Настроенная оболочка не найдена: {name} — проверьте путь к оболочке в Настройки → Side card → Terminal', preview: 'Предпросмотр', toc: 'Оглавление', edit: 'Изменить', diff --git a/src/client/locales-sv.ts b/src/client/locales-sv.ts index 5b08a7b..8c1262f 100644 --- a/src/client/locales-sv.ts +++ b/src/client/locales-sv.ts @@ -89,6 +89,7 @@ export const sv: Record = { terminalDepsFailed: 'Terminalberoendet node-pty kunde inte laddas', terminalDepsHint: 'Kör kommandot nedan i en terminal eller cmd på DSH-maskinen för att reparera det, försök sedan igen (node-pty hålls synkad med DSH-kärnversionen):', terminalDepsProfile: ' (upptäckt profil: {profile})', + terminalShellNotFound: 'Konfigurerat skal hittades inte: {name} — kontrollera skalsökvägen under Inställningar → Side card → Terminal', preview: 'Förhandsgranska', toc: 'Innehållsförteckning', edit: 'Redigera', diff --git a/src/client/locales-th.ts b/src/client/locales-th.ts index 009ceac..fcdfa5d 100644 --- a/src/client/locales-th.ts +++ b/src/client/locales-th.ts @@ -106,6 +106,7 @@ export const th: Record = { terminalDepsFailed: 'การอ้างอิงเทอร์มินัล node-pty โหลดล้มเหลว', terminalDepsHint: 'เรียกใช้คำสั่งด้านล่างในเทอร์มินัลหรือ cmd บนเครื่อง DSH เพื่อซ่อมแซม แล้วกดลองอีกครั้ง (node-pty ต้องซิงค์กับเวอร์ชันหลักของ DSH):', terminalDepsProfile: ' (ตรวจพบ profile: {profile})', + terminalShellNotFound: 'ไม่พบ shell ที่กำหนดไว้: {name} — ตรวจสอบพาธ shell ใน การตั้งค่า → Side card → Terminal', preview: 'พรีวิว', toc: 'สารบัญ', edit: 'แก้ไข', diff --git a/src/client/locales-tr.ts b/src/client/locales-tr.ts index 633374a..f7d015e 100644 --- a/src/client/locales-tr.ts +++ b/src/client/locales-tr.ts @@ -106,6 +106,7 @@ export const tr: Record = { terminalDepsFailed: 'Terminal bağımlılığı node-pty yüklenemedi', terminalDepsHint: 'Onarmak için DSH makinesindeki bir terminalde veya cmd’de aşağıdaki komutu çalıştırın, sonra yeniden deneyin (node-pty, DSH çekirdek sürümüyle senkron kalır):', terminalDepsProfile: ' (algılanan profil: {profile})', + terminalShellNotFound: 'Yapılandırılan kabuk bulunamadı: {name} — Ayarlar → Side card → Terminal altındaki kabuk yolunu denetleyin', preview: 'Önizleme', toc: 'İçindekiler', edit: 'Düzenle', diff --git a/src/client/locales-vi.ts b/src/client/locales-vi.ts index 03df336..11044a8 100644 --- a/src/client/locales-vi.ts +++ b/src/client/locales-vi.ts @@ -106,6 +106,7 @@ export const vi: Record = { terminalDepsFailed: 'Dependency terminal node-pty tải thất bại', terminalDepsHint: 'Chạy lệnh sau trong terminal hoặc cmd trên máy DSH để sửa, rồi nhấn thử lại (node-pty đồng bộ phiên bản với lõi DSH):', terminalDepsProfile: ' (phát hiện profile: {profile})', + terminalShellNotFound: 'Không tìm thấy shell đã cấu hình: {name} — kiểm tra đường dẫn shell trong Cài đặt → Side card → Terminal', preview: 'Xem trước', toc: 'Mục lục', edit: 'Chỉnh sửa', diff --git a/src/client/locales-zh-HK.ts b/src/client/locales-zh-HK.ts index ba55f2e..b898c5a 100644 --- a/src/client/locales-zh-HK.ts +++ b/src/client/locales-zh-HK.ts @@ -121,6 +121,7 @@ export const zhHK: Record = { terminalDepsFailed: '終端依賴 node-pty 載入失敗', terminalDepsHint: '在 DSH 所在環境的終端或 cmd 中執行以下命令修復,然後點重試(node-pty 與 DSH 核心保持同一版本):', terminalDepsProfile: '(偵測到 profile:{profile})', + terminalShellNotFound: '未找到配置的 Shell:{name},請到 設定 → 側邊卡片 → 終端 檢查 Shell 路徑', preview: '預覽', toc: '目錄', edit: '編輯', diff --git a/src/client/locales-zh-MO.ts b/src/client/locales-zh-MO.ts index 21de407..52d3e8d 100644 --- a/src/client/locales-zh-MO.ts +++ b/src/client/locales-zh-MO.ts @@ -121,6 +121,7 @@ export const zhMO: Record = { terminalDepsFailed: '終端依賴 node-pty 載入失敗', terminalDepsHint: '在 DSH 所在環境的終端或 cmd 中執行以下命令修復,然後點重試(node-pty 與 DSH 核心保持同一版本):', terminalDepsProfile: '(偵測到 profile:{profile})', + terminalShellNotFound: '未找到配置的 Shell:{name},請到 設定 → 側邊卡片 → 終端 檢查 Shell 路徑', preview: '預覽', toc: '目錄', edit: '編輯', diff --git a/src/client/locales-zh-TW.ts b/src/client/locales-zh-TW.ts index a1dfd60..0601580 100644 --- a/src/client/locales-zh-TW.ts +++ b/src/client/locales-zh-TW.ts @@ -121,6 +121,7 @@ export const zhTW: Record = { terminalDepsFailed: '終端依賴 node-pty 載入失敗', terminalDepsHint: '在 DSH 所在環境的終端或 cmd 中執行以下命令修復,然後點重試(node-pty 與 DSH 核心保持同一版本):', terminalDepsProfile: '(偵測到 profile:{profile})', + terminalShellNotFound: '未找到配置的 Shell:{name},請到 設定 → 側邊卡片 → 終端 檢查 Shell 路徑', preview: '預覽', toc: '目錄', edit: '編輯', diff --git a/src/client/locales.ts b/src/client/locales.ts index 07fca34..2c0083e 100644 --- a/src/client/locales.ts +++ b/src/client/locales.ts @@ -118,6 +118,7 @@ export const zh = { terminalDepsFailed: '终端依赖 node-pty 加载失败', terminalDepsHint: '在 DSH 所在环境的终端或 cmd 中执行以下命令修复,然后点重试(node-pty 与 DSH 核心保持同一版本):', terminalDepsProfile: '(检测到 profile:{profile})', + terminalShellNotFound: '未找到配置的 Shell:{name},请到 设置 → 侧边卡片 → 终端 检查 Shell 路径', preview: '预览', toc: '目录', edit: '编辑', @@ -567,6 +568,7 @@ export const en: Record = { terminalDepsFailed: 'Terminal dependency node-pty failed to load', terminalDepsHint: 'Run the command below in a terminal or cmd on the DSH machine to repair it, then retry (node-pty stays in sync with the DSH core version):', terminalDepsProfile: ' (detected profile: {profile})', + terminalShellNotFound: 'Configured shell not found: {name} — check the shell path under Settings → Side card → Terminal', preview: 'Preview', toc: 'Table of contents', edit: 'Edit',