Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

feat(core): 核心列表把低于 0.1.5-rc.1 的旧版本收进「不兼容版本」分组

hairyf62e8e8b0f43c
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index df293663..6c12d8bc 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -293,10 +293,10 @@
"core.uninstalled_toast": "Uninstalled {{version}}",
"core.remove_confirm_title": "Uninstall version",
"core.remove_confirm_desc": "Uninstall {{version}}? The engine copy will be removed from this device (other copies are unaffected).",
- "core.app": "Bundled",
"core.orphaned_title": "Local packages no longer in the repository",
"core.orphaned": "Orphaned",
"core.preview": "Preview",
+ "core.incompatible_title": "Incompatible versions ({{count}})",
"core.update_local": "Update Local Core",
"core.updated_toast": "Local core updated: {{version}}",
"core.update_failed": "Failed to update the local core",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index bada91fe..be86aec0 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -293,10 +293,10 @@
"core.uninstalled_toast": "已卸载 {{version}}",
"core.remove_confirm_title": "卸载版本",
"core.remove_confirm_desc": "确定卸载 {{version}} 吗?将移除本机的该引擎副本(其余副本不受影响)。",
- "core.app": "预打包",
"core.orphaned_title": "本地已废弃的 pkg",
"core.orphaned": "已废弃",
"core.preview": "预览版",
+ "core.incompatible_title": "不兼容版本({{count}})",
"core.update_local": "更新本地核心",
"core.updated_toast": "本地核心已更新:{{version}}",
"core.update_failed": "本地核心更新失败",
diff --git a/src/ui/config/core.tsx b/src/ui/config/core.tsx
index a8c41bbd..ac7fd644 100644
--- a/src/ui/config/core.tsx
+++ b/src/ui/config/core.tsx
@@ -1,5 +1,5 @@
import type { HarnessCore } from '@/types'
-import { ArrowRotateRight, CircleArrowDown as DownloadIcon, FolderOpen } from '@gravity-ui/icons'
+import { ArrowRotateRight, ChevronRight, CircleArrowDown as DownloadIcon, FolderOpen } from '@gravity-ui/icons'
import { Button, Checkbox, Chip, Description, Label, Spinner } from '@heroui/react'
import { useOverlay } from '@overlastic/react'
import { useToggle } from '@reause/core'
@@ -17,7 +17,7 @@ import { useInvalidateOnSettingUpdated } from '@/hooks/use-invalidate-on-setting
import { store } from '@/store'
import { useCoreBreakingConfirm } from '@/ui/config/hooks/use-core-breaking-confirm'
import { DownloadCoreDialog } from '@/ui/dialog/update-core'
-import { compareVersions, isCoreBelowBaseline } from '@/utils/core-version'
+import { compareVersions, isCoreBelowBaseline, isCoreUnsupported } from '@/utils/core-version'
import { silence } from '@/utils/silence'
import { toast } from '@/utils/toast'
@@ -84,6 +84,8 @@ export function ConfigCore() {
/** 行内操作进行中的核心 id(该行的下载/卸载按钮显示 Spinner 并禁用重复点击) */
const [busyId, setBusyId] = useState<string | null>(null)
+ /** 「不兼容版本」分组是否展开:默认折叠,旧版本不参与首选 */
+ const [showIncompatible, setShowIncompatible] = useState(false)
const [refreshing, toggleRefreshing] = useToggle()
// 本地核心未检测到时不渲染 local 行(保留 local_missing_hint 提示)
@@ -103,7 +105,13 @@ export function ConfigCore() {
const localCore = cores.find(c => c.source === 'local')
const currentRows = rows.filter(core => !core.orphaned)
const orphanRows = rows.filter(core => core.orphaned)
- const displayRows = [...currentRows, ...orphanRows]
+ // 低于最低支持基线的旧版本统一排到最后,收进默认折叠的「不兼容版本」分组:它们无法
+ // 加载随包内置插件(issue #596),与可用版本并列只会让用户误选。
+ const orderedRows = [...currentRows, ...orphanRows]
+ const incompatibleRows = orderedRows.filter(core => isUnsupportedCore(core))
+ const displayRows = [...orderedRows.filter(core => !isUnsupportedCore(core)), ...incompatibleRows]
+ /** 「已废弃」分组头锚点:取重排后的首个已废弃行,避免分组头落进折叠区里 */
+ const firstOrphanRow = displayRows.find(core => core.orphaned)
// 本地核心是否有新版可更新:仅当存在更新的预打包发布时才显示「更新本地核心」。
// 版本行按 releases 最新在前,取第一个**非预览版** app 版本作为"当前最新可用
@@ -318,12 +326,25 @@ export function ConfigCore() {
<div className="flex flex-col gap-4">
{displayRows.map(core => (
<Fragment key={core.id}>
- <If cond={core.orphaned && (core === orphanRows[0])}>
+ {/* 「不兼容版本」分组头:默认折叠,点标题展开/收起 */}
+ <If cond={core === incompatibleRows[0]}>
+ <button
+ type="button"
+ className="flex items-center gap-1 px-1 pt-2 text-left text-xs font-medium text-muted"
+ aria-expanded={showIncompatible}
+ onClick={() => setShowIncompatible(value => !value)}
+ >
+ <ChevronRight className={showIncompatible ? 'size-3.5 rotate-90' : 'size-3.5'} />
+ {t('core.incompatible_title', { count: incompatibleRows.length })}
+ </button>
+ </If>
+ <If cond={core.orphaned && (core === firstOrphanRow)}>
<div className="px-1 pt-2 text-xs font-medium text-muted">
{t('core.orphaned_title')}
</div>
</If>
<Item
+ className={!showIncompatible && isUnsupportedCore(core) ? 'hidden' : undefined}
onClick={core.present && !core.active ? () => onActivate(core) : undefined}
left={(
<>
@@ -335,11 +356,6 @@ export function ConfigCore() {
{t('core.local')}
</Chip>
</If>
- <If cond={core.source === 'app'}>
- <Chip size="sm" variant="soft" color="default" className="shrink-0 font-medium">
- {t('core.app')}
- </Chip>
- </If>
<If cond={core.orphaned}>
<Chip size="sm" variant="soft" color="warning" className="shrink-0 font-medium">
{t('core.orphaned')}
@@ -477,3 +493,11 @@ function displayVersion(version: HarnessCore): string {
function isUnsupportedLocal(core: HarnessCore): boolean {
return core.source === 'local' && core.present && isCoreBelowBaseline(core.version, core.recommendedVersion)
}
+
+/**
+ * 核心是否低于最低支持基线(按版本判定,与来源无关)。低于基线的旧版本无法加载随包
+ * 内置插件(issue #596),核心列表把它们收进默认折叠的「不兼容版本」分组。
+ */
+function isUnsupportedCore(core: HarnessCore): boolean {
+ return isCoreUnsupported(core.version || core.tag)
+}
diff --git a/src/utils/core-version.ts b/src/utils/core-version.ts
index dbf44e3f..ee0ba237 100644
--- a/src/utils/core-version.ts
+++ b/src/utils/core-version.ts
@@ -40,3 +40,19 @@ export function isCoreBreakingVersion(version: string): boolean {
export function isCoreBelowBaseline(version: string, baseline: string | null | undefined): boolean {
return !!version && !!baseline && compareVersions(version, baseline) < 0
}
+
+/**
+ * 最低支持的核心版本(与 Rust `MIN_SUPPORTED_CORE_VERSION` 对齐)。低于它的核心缺少
+ * 内置插件依赖的平台种子词,随包插件必然加载失败并把应用卡在启动阶段(issue #596)。
+ */
+export const MIN_SUPPORTED_CORE_VERSION = '0.1.5-rc.1'
+
+/**
+ * 核心版本是否低于最低支持基线(按版本判定,与来源无关)。
+ *
+ * 版本缺失或不可解析时返回 false(`compareVersions` 对不可解析值返回 0)——漏放行只是
+ * 回到修复前的行为,误判会把可用的核心归进「不兼容」分组。
+ */
+export function isCoreUnsupported(version: string): boolean {
+ return compareVersions(version, MIN_SUPPORTED_CORE_VERSION) < 0
+}
diff --git a/test/core-version.test.ts b/test/core-version.test.ts
index 4bb4ad92..26fa1c76 100644
--- a/test/core-version.test.ts
+++ b/test/core-version.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { compareVersions, isCoreBelowBaseline } from '@/utils/core-version'
+import { compareVersions, isCoreBelowBaseline, isCoreUnsupported, MIN_SUPPORTED_CORE_VERSION } from '@/utils/core-version'
/**
* issue #596:随包内置插件按推荐核心版本(`version-recommend.json`)编译,本地核心
@@ -32,3 +32,32 @@ describe('isCoreBelowBaseline', () => {
expect(isCoreBelowBaseline('not-a-version', '0.1.5-rc.2')).toBe(false)
})
})
+
+/**
+ * 核心列表「不兼容版本」分组的分组判据:低于最低支持基线(0.1.5-rc.1)的旧版本默认折叠,
+ * 可展开显示;基线与更新版本、以及不可解析的版本都留在可用列表里。
+ */
+describe('isCoreUnsupported', () => {
+ it('把低于 0.1.5-rc.1 的旧版本判为不兼容', () => {
+ expect(isCoreUnsupported('0.1.0-rc.7')).toBe(true)
+ expect(isCoreUnsupported('0.1.2-rc.1')).toBe(true)
+ expect(isCoreUnsupported('0.1.5-alpha.2')).toBe(true)
+ })
+
+ it('基线本身与更新的版本都算兼容', () => {
+ expect(isCoreUnsupported(MIN_SUPPORTED_CORE_VERSION)).toBe(false)
+ expect(isCoreUnsupported('0.1.5-rc.2')).toBe(false)
+ expect(isCoreUnsupported('0.1.6-alpha.2')).toBe(false)
+ expect(isCoreUnsupported('0.1.7-alpha.1')).toBe(false)
+ })
+
+ it('版本缺失或不可解析时不误判为不兼容', () => {
+ expect(isCoreUnsupported('')).toBe(false)
+ expect(isCoreUnsupported('not-a-version')).toBe(false)
+ })
+
+ it('带 dsh-/src- 前缀的 release tag 按同一基线判定', () => {
+ expect(isCoreUnsupported('dsh-0.1.2-rc.1')).toBe(true)
+ expect(isCoreUnsupported('src-0.1.5-rc.1')).toBe(false)
+ })
+})