DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
feat(desktop): 依赖下载被环境禁用时展示禁用页
hairyff0baf4a06cd4
diff --git a/src-tauri/src/config/runtime.rs b/src-tauri/src/config/runtime.rsindex 5b143946..e5f97cc3 100644--- a/src-tauri/src/config/runtime.rs+++ b/src-tauri/src/config/runtime.rs@@ -604,6 +604,9 @@ pub struct RuntimeInfo {pub log_path: String,pub platform: String,pub arch: String,+ /// 依赖自动下载是否被环境禁用(E2E)。前端据此把「装配失败」渲染成+ /// 「下载已被环境禁用」,而不是当成真实故障。+ pub auto_download_disabled: bool,}pub fn runtime_info<R: Runtime>(app: &AppHandle<R>, port: u16) -> RuntimeInfo {@@ -618,6 +621,7 @@ pub fn runtime_info<R: Runtime>(app: &AppHandle<R>, port: u16) -> RuntimeInfo {log_path: get_service_log_path(app).to_string_lossy().into_owned(),platform: env::consts::OS.to_string(),arch: env::consts::ARCH.to_string(),+ auto_download_disabled: crate::config::setting::auto_download_disabled(),}}diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.jsonindex 1325957a..dcf38baa 100644--- a/src/i18n/locales/en-US.json+++ b/src/i18n/locales/en-US.json@@ -10,6 +10,8 @@"status.installing": "Installing dependencies...","status.updating": "Updating DeepSeek Harness...","status.error": "Startup failed",+ "status.download_disabled": "Downloads disabled by environment",+ "status.download_disabled_detail": "The DSH_E2E_DISABLE_DOWNLOAD=1 environment variable disables automatic dependency downloads, so this launch installs neither the Node nor the dsh runtime and assembly stops at \"dsh CLI missing\". This is the expected shape of a test environment, not a startup failure.","status.loading": "Loading plugins…","status.loading_plugins": "Loading plugins…","status.loading_internal": "Loading internal plugins…",diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.jsonindex 0597a29f..7d52bd09 100644--- a/src/i18n/locales/zh-CN.json+++ b/src/i18n/locales/zh-CN.json@@ -10,6 +10,8 @@"status.installing": "正在安装依赖...","status.updating": "正在更新 DeepSeek Harness...","status.error": "启动失败",+ "status.download_disabled": "下载已被环境禁用",+ "status.download_disabled_detail": "环境变量 DSH_E2E_DISABLE_DOWNLOAD=1 已禁用依赖自动下载,本次启动不会安装 Node / dsh 运行时,装配因此停在「找不到 dsh CLI」。这是测试环境的预期形态,不是启动故障。","status.loading": "Loading plugins…","status.loading_plugins": "Loading plugins…","status.loading_internal": "Loading internal plugins…",diff --git a/src/layout/components/loadable.tsx b/src/layout/components/loadable.tsxindex 6c1433f9..6a19f2f4 100644--- a/src/layout/components/loadable.tsx+++ b/src/layout/components/loadable.tsx@@ -34,6 +34,8 @@ export interface LoadableProps {errorMsg?: string/** 失败态时的重试按钮回调 */onRetry?: () => void+ /** 根节点 `data-testid`(E2E 定位用;不传则不渲染该属性) */+ testId?: string/** 附加内容,渲染在提示文字之后 */children?: ReactNode}@@ -46,6 +48,7 @@ export function Loadable({logs,errorMsg,onRetry,+ testId,children,}: LoadableProps) {const { t } = useTranslation()@@ -56,7 +59,7 @@ export function Loadable({const showPanel = hasLogs || percentage != nullreturn (- <div className="flex h-full items-center justify-center bg-load-bg w-full">+ <div className="flex h-full items-center justify-center bg-load-bg w-full" data-testid={testId}><div className="flex w-[min(460px,88vw)] flex-col items-center gap-4 text-center -mt-[1px]">{/* 加载态显示 spinner 时隐藏图标(官方 boot 页即无图标),避免与 spinner 重复突兀;仅失败态显示 */}{/* 加载态显示 spinner 时隐藏图标(官方 boot 页即无图标),避免与 spinner 重复突兀;仅失败态显示 */}diff --git a/src/layout/components/setup.tsx b/src/layout/components/setup.tsxindex 73d1ab3c..12eefedc 100644--- a/src/layout/components/setup.tsx+++ b/src/layout/components/setup.tsx@@ -54,37 +54,64 @@ export function Setup() {pluginConflictHint,inotifyLimitHint,patchLayerHint,+ downloadDisabled,} = useStore(store.harness)const error = status === 'error'+ // 环境禁用了依赖下载(E2E 的 `DSH_E2E_DISABLE_DOWNLOAD=1`):装配必然停在+ // 「找不到 dsh CLI」,但那是被刻意截断的结果而非故障。按「禁用页」渲染,+ // 版式与错误页完全一致(同一个 Loadable 的失败版式:图标 + 静态说明 + 动作行),+ // 只是文案与动作不同。+ const disabled = error && downloadDisabledconst installing = status === 'installing'- const heading = error ? t('status.error') : installer.title || t('status.installing')- const description = error ? '' : installer.detail || t('status.installing')- const StatusIcon = STATUS_ICONS[status]- // 安装中展示安装日志;错误态展示启动失败时从 dsh 服务日志读取的真实错误行- const logs = installing- ? installer.logs- : (error && errorLogs.length > 0 ? errorLogs : undefined)+ const heading = disabled+ ? t('status.download_disabled')+ : (error ? t('status.error') : installer.title || t('status.installing'))+ // Loadable 的失败版式由 `errorMsg != null` 触发:禁用页必须把说明当失败信息传进去,+ // 否则会落进加载版式(没有图标、标题下面挂一个 spinner)。+ const failureMsg = disabled ? t('status.download_disabled_detail') : errorMsg+ const StatusIcon = disabled ? ArrowDownToLine : STATUS_ICONS[status]+ // 安装中展示安装日志;错误态展示启动失败时从 dsh 服务日志读取的真实错误行。+ // 禁用页不给日志面板:装配根本没跑,日志只会误导。+ const logs = disabled+ ? undefined+ : (installing ? installer.logs : (error && errorLogs.length > 0 ? errorLogs : undefined))// 错误态的针对性提示:插件路由冲突 / Linux inotify 文件监视上限 / 补丁层问题,// 三者互斥(由各自的失败特征识别),优先展示最具体的一条。- const hint = error ? (patchLayerHint || pluginConflictHint || inotifyLimitHint) : undefined+ const hint = error && !disabled ? (patchLayerHint || pluginConflictHint || inotifyLimitHint) : undefined// 补丁层问题分两种,恢复动作不同:语法错误整层隔离(改名备份),悬空 insert 只// 剥离解析不到的条目。两者的提示共用 patchLayerHint,入口按错误特征二选一。- const patchEntriesUnresolved = error && containsPatchEntryUnresolved(errorMsg)- const patchLayerBroken = error && patchLayerHint !== '' && !patchEntriesUnresolved+ const patchEntriesUnresolved = !disabled && error && containsPatchEntryUnresolved(errorMsg)+ const patchLayerBroken = !disabled && error && patchLayerHint !== '' && !patchEntriesUnresolvedreturn (<Loadableicon={StatusIcon}title={heading}- subtitle={error ? undefined : description}+ subtitle={error ? undefined : installer.detail || t('status.installing')}percentage={installing ? installer.percentage : undefined}logs={logs}- errorMsg={error ? errorMsg : undefined}+ errorMsg={error ? failureMsg : undefined}+ testId={disabled ? 'dsh-setup-disabled' : error ? 'dsh-setup-error' : undefined}>{hint && (<p className="m-0 text-xs leading-[18px] break-all text-load-muted">{hint}</p>)}- <If cond={error}>+ <If cond={disabled}>+ <Then>+ {/* 禁用态操作区:与错误页同一行布局,但只保留「复制日志」——重试与安全模式+ 在下载被环境禁用的前提下都没有意义。 */}+ <div className="flex flex-wrap items-center justify-center gap-2">+ <button+ className={button({ tone: 'ghost', size: 'sm' })}+ onClick={() => copyLogsHandler(t)}+ >+ <Copy className="size-4" />+ {t('buttons.copy_logs')}+ </button>+ </div>+ </Then>+ </If>+ <If cond={error && !disabled}><Then>{/* 错误态操作区:重试 / 复制日志 / 安全模式 三按钮放同一行,避免叠罗汉 */}<div className="flex flex-wrap items-center justify-center gap-2">diff --git a/src/store/modules/harness/store.ts b/src/store/modules/harness/store.tsindex a1b3ef9e..c87e09fc 100644--- a/src/store/modules/harness/store.ts+++ b/src/store/modules/harness/store.ts@@ -84,6 +84,13 @@ export const harness = defineStore({status: 'ready' as SetupStatus,installer: initialInstaller,errorMsg: '',+ /**+ * 依赖自动下载被环境禁用(E2E 的 `DSH_E2E_DISABLE_DOWNLOAD=1`)。+ *+ * 此时装配必然失败在「找不到 dsh CLI」,但那不是真实故障——Setup 页据此把+ * 错误态渲染成「下载已被环境禁用」,而不是让 E2E 看起来像启动崩溃。+ */+ downloadDisabled: false,/** 启动失败时从 dsh 服务日志中读取的真实错误行(Loadable 错误态日志面板) */errorLogs: [] as string[],/** 识别到插件路由冲突时的针对性提示(Loadable children 展示) */@@ -504,8 +511,9 @@ export const harness = defineStore({catch (err) {console.error('[Harness] failed to listen install-progress:', err)}- const runtimeInfo = await invoke<{ service_url: string }>('get_runtime_info')+ const runtimeInfo = await invoke<{ service_url: string, auto_download_disabled?: boolean }>('get_runtime_info')this.serviceUrl = runtimeInfo.service_url+ this.downloadDisabled = runtimeInfo.auto_download_disabled === truethis.iframeSrc = generateTimestampedUrl(runtimeInfo.service_url)// 已安装过则跳过安装界面,避免每次启动都闪现"正在安装依赖..."