Skip to content

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

feat(core): 适配 dsh 0.1.7-rc.2(模型页账号路由 / 弹层蒙版 / 侧栏 logo)

hairyf2dbd335073f3
diff --git a/README.en.md b/README.en.md
index 0c901b01..3e64ad27 100644
--- a/README.en.md
+++ b/README.en.md
@@ -19,7 +19,7 @@
<img src="https://img.shields.io/github/stars/dsh-tauri/deepseek-harness-desktop?style=flat-square&label=stars&color=4D6BFE" alt="Stars" />
<img src="https://img.shields.io/github/license/dsh-tauri/deepseek-harness-desktop?style=flat-square&label=license&color=4D6BFE" alt="MIT License" />
<img src="https://img.shields.io/badge/Windows%20%7C%20macOS%20%7C%20Linux-black?style=flat-square" alt="Windows | macOS | Linux" />
- <img src="https://img.shields.io/badge/dsh-0.1.7--alpha.1-4D6BFE?style=flat-square" alt="dsh 0.1.7-alpha.1" />
+ <img src="https://img.shields.io/badge/dsh-0.1.7--rc.2-4D6BFE?style=flat-square" alt="dsh 0.1.7-rc.2" />
</p>
<p align="center">
diff --git a/README.es.md b/README.es.md
index a0580c4e..bbf98a57 100644
--- a/README.es.md
+++ b/README.es.md
@@ -19,7 +19,7 @@
<img src="https://img.shields.io/github/stars/dsh-tauri/deepseek-harness-desktop?style=flat-square&label=stars&color=4D6BFE" alt="Stars" />
<img src="https://img.shields.io/github/license/dsh-tauri/deepseek-harness-desktop?style=flat-square&label=license&color=4D6BFE" alt="MIT License" />
<img src="https://img.shields.io/badge/Windows%20%7C%20macOS%20%7C%20Linux-black?style=flat-square" alt="Windows | macOS | Linux" />
- <img src="https://img.shields.io/badge/dsh-0.1.7--alpha.1-4D6BFE?style=flat-square" alt="dsh 0.1.7-alpha.1" />
+ <img src="https://img.shields.io/badge/dsh-0.1.7--rc.2-4D6BFE?style=flat-square" alt="dsh 0.1.7-rc.2" />
</p>
<p align="center">
diff --git a/README.md b/README.md
index 3b48f331..4cea00a9 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
<img src="https://img.shields.io/github/stars/dsh-tauri/deepseek-harness-desktop?style=flat-square&label=stars&color=4D6BFE" alt="Stars" />
<img src="https://img.shields.io/github/license/dsh-tauri/deepseek-harness-desktop?style=flat-square&label=license&color=4D6BFE" alt="MIT License" />
<img src="https://img.shields.io/badge/Windows%20%7C%20macOS%20%7C%20Linux-black?style=flat-square" alt="Windows | macOS | Linux" />
- <img src="https://img.shields.io/badge/dsh-0.1.7--alpha.1-4D6BFE?style=flat-square" alt="dsh 0.1.7-alpha.1" />
+ <img src="https://img.shields.io/badge/dsh-0.1.7--rc.2-4D6BFE?style=flat-square" alt="dsh 0.1.7-rc.2" />
</p>
<p align="center">
diff --git a/packages/dsh-tauri-model-config/THIRD_PARTY_NOTICES.md b/packages/dsh-tauri-model-config/THIRD_PARTY_NOTICES.md
index 3f8a9349..e6bd6191 100644
--- a/packages/dsh-tauri-model-config/THIRD_PARTY_NOTICES.md
+++ b/packages/dsh-tauri-model-config/THIRD_PARTY_NOTICES.md
@@ -6,9 +6,43 @@ This package is a Tauri-flavoured derivation of the upstream Models settings /
DeepSeek credential-onboarding plugin. Upstream sources are MIT-licensed:
- Repository: <https://github.com/deepseek-ai/deepseek-harness>
-- Cross-checked revision: `46a7f68b0922371ce7144b668b90e377d8e799f4`
+- Cross-checked revision: `477b4f420553e8a52c2fbccc464d7561b239c443` (`dsh-v0.1.7-rc.2`,
+ the revision vendored at `source/deepseek-harness`)
- License: MIT — Copyright (c) 2026 DeepSeek
+Synced from upstream `0.1.7-alpha.1` → `0.1.7-rc.2`:
+
+- `store.ts`: the account route (`deepseek-account`) is joined out of the credential
+ space — no `apiKeyEnv`, no credential read, and its availability comes from
+ `session/modelCatalog()` (the account group has models); the row is hidden while
+ signed out, and `providerUsable` answers through `accountAvailable`.
+- `store.ts`: account and official routes sort first, in that order.
+- `ModelsSection.tsx`: `needsSetup` never renders the account row as a setup card;
+ the account row shows the localized `deepSeekAccount` name; the delete dialog's
+ initial focus moves to `data-modal-autofocus` (kept alongside React's `autoFocus`
+ so older cores keep their focus placement).
+- `ProviderEditor.tsx` / `CustomProviderCard.tsx`: the account route edits only its
+ model catalog (no key field, no credential describe) and every key input uses
+ `autoComplete="new-password"`.
+- `ModelListEditor.tsx`: candidate ids carry `title={name ?? id}`.
+- `register/models.ts` + `client/index.ts`: `remote.session` joins the inject list,
+ `credentials/record-updated` refreshes the page, and the internal-testing notice
+ step is no longer registered on the desktop carrier.
+- `styles.ts`: the upstream CSS token migration (radius scale, settings-card fill and
+ stroke, focus-ring token, business-state ink) plus the candidate-id ellipsis.
+
+Kept deliberately from upstream:
+
+- The slot and remote contracts are unchanged: `settings.section`,
+ `settings.onboarding`, `settings.models.sign-in`, the `llm-deepseek` settings
+ namespace, and the `credentialOnboarding` gate published through the
+ `webserver/index-inject` global (`src/onboarding-config.ts` upstream).
+- The `'dshDesktop' in globalThis` precondition of the official credential
+ onboarding is preserved, so the local API-key flow never competes with the
+ official account flow.
+- The DeepSeek credential-onboarding step stays registered on the desktop carrier
+ (upstream registers it there too); only its automatic posture is gated.
+
Derived files (upstream `packages/client/ui-settings-models/` → this package):
| Upstream | This package (`src/`) |
diff --git a/packages/dsh-tauri-model-config/src/client/index.ts b/packages/dsh-tauri-model-config/src/client/index.ts
index 9cfce08f..da851832 100644
--- a/packages/dsh-tauri-model-config/src/client/index.ts
+++ b/packages/dsh-tauri-model-config/src/client/index.ts
@@ -19,6 +19,7 @@ export const inject = [
'remote',
'remote.credentials',
'remote.llm',
+ 'remote.session',
'remote.settings',
'settingsSchema',
]
diff --git a/packages/dsh-tauri-model-config/src/client/models/CustomProviderCard.tsx b/packages/dsh-tauri-model-config/src/client/models/CustomProviderCard.tsx
index a6d65db0..e2bb555a 100644
--- a/packages/dsh-tauri-model-config/src/client/models/CustomProviderCard.tsx
+++ b/packages/dsh-tauri-model-config/src/client/models/CustomProviderCard.tsx
@@ -196,7 +196,7 @@ export function CustomProviderCard(props: CustomProviderCardProps): ReactNode {
<input
className={styles.input}
type="password"
- autoComplete="off"
+ autoComplete="new-password"
value={keyDraft}
placeholder={t('keyPlaceholder')}
aria-label={t('keyInput')}
diff --git a/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx b/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx
index 15064cc6..202f9f39 100644
--- a/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx
+++ b/packages/dsh-tauri-model-config/src/client/models/ModelListEditor.tsx
@@ -403,7 +403,7 @@ export function ModelListEditor(props: ModelListEditorProps): ReactNode {
onChange={() => { toggle(candidate.id) }}
/>
- <span className={styles.candidateId}>{candidate.id}</span>
+ <span className={styles.candidateId} title={candidate.name ?? candidate.id}>{candidate.id}</span>
</label>
</li>
))}
diff --git a/packages/dsh-tauri-model-config/src/client/models/ModelsSection.tsx b/packages/dsh-tauri-model-config/src/client/models/ModelsSection.tsx
index 1f39f4e8..9ed3309c 100644
--- a/packages/dsh-tauri-model-config/src/client/models/ModelsSection.tsx
+++ b/packages/dsh-tauri-model-config/src/client/models/ModelsSection.tsx
@@ -110,7 +110,7 @@ export async function removeProviderProfile(
}
export function needsSetup(row: ProviderRow, anyUsable: boolean): boolean {
- if (anyUsable)
+ if (anyUsable || row.entry.provider === 'deepseek-account')
return false
if (row.entry.settingsPath.length > 0)
return false
@@ -164,7 +164,13 @@ export function ModelsSection(props: ModelsSectionProps): ReactNode {
function Loaded({ injected, renderSlot }: { injected: ModelsSectionFace, renderSlot: ModelsRenderSlot }): ReactNode {
const { controller, operations, schema, t } = injected
- const state = injected.useSnapshot(snapshot => snapshot)
+ const snapshot = injected.useSnapshot(value => value)
+ const state = {
+ ...snapshot,
+ rows: snapshot.rows.map(row => row.entry.provider === 'deepseek-account'
+ ? { ...row, entry: { ...row.entry, displayName: t('deepSeekAccount') } }
+ : row),
+ }
const [editing, setEditing] = useState<EditorTarget | undefined>(undefined)
const [addOpen, setAddOpen] = useState(false)
const [addMode, setAddMode] = useState<AddMode>('catalog')
@@ -602,7 +608,9 @@ function Loaded({ injected, renderSlot }: { injected: ModelsSectionFace, renderS
className={styles.deleteDialog as string}
footer={(
<>
- <Button variant="outline" autoFocus disabled={deleting} onClick={closeDelete}>
+ {/* rc.2 的 Modal 由 `useModalLayer` 认 `data-modal-autofocus` 决定初始焦点;
+ 更早的核心没有这层管理,React 的 `autoFocus` 仍是唯一落点,两者并存。 */}
+ <Button variant="outline" autoFocus data-modal-autofocus disabled={deleting} onClick={closeDelete}>
{t('cancel')}
</Button>
<Button
diff --git a/packages/dsh-tauri-model-config/src/client/models/ProviderEditor.tsx b/packages/dsh-tauri-model-config/src/client/models/ProviderEditor.tsx
index 13aacf8d..0ac1724f 100644
--- a/packages/dsh-tauri-model-config/src/client/models/ProviderEditor.tsx
+++ b/packages/dsh-tauri-model-config/src/client/models/ProviderEditor.tsx
@@ -118,7 +118,8 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
const node = useMemo(() => schema.nodeAtPath(root, settingsPath), [root, schema, settingsPath])
const fallback = schema.getPath(namespace.value, settingsPath)
const disabled = props.readOnly || busy
- const layout = layoutOf(namespace.ns)
+ const accountProvider = props.provider === 'deepseek-account'
+ const layout = accountProvider ? 'deepseek' : layoutOf(namespace.ns)
const keyRef = refFor(schema, namespace, settingsPath, props.provider)
const protocols = useMemo(
@@ -127,6 +128,8 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
)
useEffect(() => {
+ if (accountProvider)
+ return
let stale = false
setKeyState(undefined)
@@ -138,7 +141,7 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
return () => {
stale = true
}
- }, [operations, keyRef])
+ }, [operations, keyRef, accountProvider])
const stringAt = (source: unknown, key: string): string | undefined => {
const value = schema.getPath(source, [key])
@@ -276,6 +279,15 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
},
onReset: () => { setDraft(current => schema.deletePath(current, ['models'])) },
}
+ if (accountProvider) {
+ return (
+ <DeepSeekModelsEditor
+ {...catalogProps}
+ defaultContextWindow={typeof defaultContextWindow === 'number' ? defaultContextWindow : undefined}
+ defaultMaxTokens={typeof defaultMaxTokens === 'number' ? defaultMaxTokens : undefined}
+ />
+ )
+ }
return (
<>
<div className={styles.field}>
@@ -283,7 +295,7 @@ export function ProviderEditor(props: ProviderEditorProps): ReactNode {
<input
className={styles.input}
type="password"
- autoComplete="off"
+ autoComplete="new-password"
value={keyDraft}
placeholder={keyPlaceholder}
aria-label={t('keyInput')}
diff --git a/packages/dsh-tauri-model-config/src/client/models/locales.ts b/packages/dsh-tauri-model-config/src/client/models/locales.ts
index fb7b1b4e..417939b1 100644
--- a/packages/dsh-tauri-model-config/src/client/models/locales.ts
+++ b/packages/dsh-tauri-model-config/src/client/models/locales.ts
@@ -1,5 +1,6 @@
export const en = {
nav: 'Models',
+ deepSeekAccount: 'DeepSeek Account',
title: 'Models',
intro: 'Enter your API keys to use models from the following providers.',
edit: 'Edit',
@@ -117,6 +118,7 @@ export type ModelsKey = keyof typeof en
export const zh: { [Key in keyof typeof en]: string } = {
nav: '模型',
+ deepSeekAccount: 'DeepSeek 账号',
title: '模型',
intro: '填入各提供商的 API 密钥即可使用其模型。',
edit: '编辑',
diff --git a/packages/dsh-tauri-model-config/src/client/models/store.account.test.ts b/packages/dsh-tauri-model-config/src/client/models/store.account.test.ts
new file mode 100644
index 00000000..5abbccd9
--- /dev/null
+++ b/packages/dsh-tauri-model-config/src/client/models/store.account.test.ts
@@ -0,0 +1,191 @@
+import type { SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client'
+import type { ClientRemote, CredentialInfo, RemoteResult, SettingsNamespaceView } from '../types/remotes.ts'
+import type { SettingsSchemaOperations } from './schema-operations.ts'
+import { describe, expect, it, vi } from 'vitest'
+
+// 快照 store 是页面订阅面(依赖 zustand);本用例只需要读写快照,替换成最小实现,
+// 让用例只覆盖 store 自身的账号路由投影,不把 UI 运行时依赖拖进单测。
+vi.mock('@deepseek-ai/dsh-client-store', () => ({
+ createSnapshotStore: <T>(initial: T) => {
+ const snapshot = initial
+ return {
+ getSnapshot: () => snapshot,
+ update: (mutate: (draft: T) => void) => {
+ mutate(snapshot)
+ return snapshot
+ },
+ subscribe: () => () => {},
+ }
+ },
+}))
+
+const { joinProviderDirectory, ModelsSettingsStore, onboardingReadiness, providerUsable } = await import('./store.ts')
+
+/**
+ * 账号路由(`deepseek-account`)的跨代契约:0.1.7-rc.2 起官方把账号接入做成独立路由,
+ * 页面对它的处理与 API-key 路由不同——不读 `apiKeyEnv`、不参与凭据读取、登录态由
+ * 模型目录(账号分组是否有模型)表达。这里锁住这三条,以及「未登录时账号行隐去」。
+ */
+
+const ACCOUNT: SettingsNamespaceView = {
+ ns: 'llm-deepseek-account',
+ schema: {},
+ value: {},
+ applies: 'live',
+ secrets: [],
+ revision: 1,
+}
+
+const OFFICIAL: SettingsNamespaceView = {
+ ns: 'llm-deepseek',
+ schema: {},
+ value: { apiKeyEnv: 'DEEPSEEK_API_KEY' },
+ applies: 'live',
+ secrets: [],
+ revision: 2,
+}
+
+function schema(): SettingsSchemaOperations {
+ const readPath = (value: unknown, path: readonly string[]): unknown =>
+ path.reduce<unknown>((current, key) => (typeof current === 'object' && current !== null ? Reflect.get(current, key) : undefined), value)
+ return {
+ rehydrate: (value: unknown) => value,
+ validate: () => undefined,
+ nodeAtPath: (value: unknown) => value,
+ getPath: readPath,
+ hasPath: (value: unknown, path: readonly string[]) => readPath(value, path) !== undefined,
+ setPath: (value: unknown) => value,
+ deletePath: (value: unknown) => value,
+ } as unknown as SettingsSchemaOperations
+}
+
+function describeFace(namespaces: SettingsNamespaceView[]): SettingsDescribeFace {
+ return {
+ getSnapshot: () => ({
+ status: 'ready',
+ view: { namespaces, writable: true, hasDocument: true },
+ error: null,
+ }),
+ subscribe: () => () => {},
+ ensure: async () => {},
+ acceptView: () => {},
+ } as unknown as SettingsDescribeFace
+}
+
+interface RemoteOptions {
+ credentials?: Record<string, CredentialInfo>
+ accountModels?: number
+ withoutCatalog?: boolean
+ describeCalls?: string[][]
+}
+
+function remote(options: RemoteOptions = {}): ClientRemote {
+ const credentials = options.credentials ?? {}
+ return {
+ settings: {
+ mutate: async () => ok(OFFICIAL),
+ },
+ llm: {
+ listProviders: async () => ok([{ id: 'deepseek-official', name: 'DeepSeek' }, { id: 'deepseek-account', name: 'DeepSeek Account' }]),
+ listConfigurableProviders: async () => ok([
+ { provider: 'deepseek-official', displayName: 'DeepSeek', settingsNs: 'llm-deepseek', settingsPath: [] },
+ { provider: 'deepseek-account', displayName: 'DeepSeek Account', settingsNs: 'llm-deepseek-account', settingsPath: [] },
+ ]),
+ discoverModels: async () => ok([]),
+ },
+ credentials: {
+ describe: async (refs) => {
+ options.describeCalls?.push([...refs])
+ return ok(Object.fromEntries(refs.map(ref => [ref, credentials[ref] ?? { configured: false, writable: true }])))
+ },
+ set: async () => ok(undefined),
+ unset: async () => ok(undefined),
+ },
+ session: options.withoutCatalog === true
+ ? {} as ClientRemote['session']
+ : {
+ modelCatalog: async () => ok({
+ default: { provider: 'deepseek-official', model: 'deepseek-flash' },
+ routableProviders: [],
+ groups: options.accountModels === undefined || options.accountModels === 0
+ ? []
+ : [{ id: 'deepseek-account', name: 'DeepSeek Account', models: Array.from({ length: options.accountModels }, (_, index) => ({ id: `m${index}`, name: `M${index}` })) }],
+ }),
+ },
+ $on: () => () => {},
+ } as ClientRemote
+}
+
+function ok<T>(value: T): RemoteResult<T> {
+ return { ok: true, value }
+}
+
+async function load(options: RemoteOptions, namespaces: SettingsNamespaceView[] = [OFFICIAL, ACCOUNT]) {
+ const store = new ModelsSettingsStore(remote(options), schema(), describeFace(namespaces))
+ await store.load()
+ return store.store.getSnapshot()
+}
+
+describe('joinProviderDirectory', () => {
+ it('账号与官方置顶,其余保持声明顺序', () => {
+ const rows = joinProviderDirectory(
+ [{ id: 'zeta', name: 'Zeta' }],
+ [
+ { provider: 'alpha', displayName: 'Alpha', settingsNs: 'llm-pi-ai', settingsPath: ['providers', 'alpha'] },
+ { provider: 'deepseek-official', displayName: 'DeepSeek', settingsNs: 'llm-deepseek', settingsPath: [] },
+ { provider: 'deepseek-account', displayName: 'DeepSeek Account', settingsNs: 'llm-deepseek-account', settingsPath: [] },
+ ],
+ )
+
+ expect(rows.map(row => row.provider)).toEqual(['deepseek-account', 'deepseek-official', 'alpha', 'zeta'])
+ })
+})
+
+describe('账号路由的行投影', () => {
+ it('不读账号的 apiKeyEnv,也不为它取派生凭据', async () => {
+ const describeCalls: string[][] = []
+ const state = await load({ credentials: { DEEPSEEK_API_KEY: { configured: true, writable: true } }, accountModels: 2, describeCalls })
+
+ const account = state.rows.find(row => row.entry.provider === 'deepseek-account')
+ expect(account?.apiKeyEnv).toBeUndefined()
+ expect(account?.credential).toBeUndefined()
+ expect(describeCalls.flat()).not.toContain('DEEPSEEK_ACCOUNT_API_KEY')
+ expect(describeCalls.flat()).toContain('DEEPSEEK_API_KEY')
+ })
+
+ it('已登录(账号分组有模型)时账号行可用且置顶', async () => {
+ const state = await load({ accountModels: 2 })
+
+ expect(state.rows[0]?.entry.provider).toBe('deepseek-account')
+ expect(providerUsable(state.rows[0]!)).toBe(true)
+ expect(onboardingReadiness(state).kind).toBe('provider-ready')
+ })
+
+ it('未登录(账号分组为空)时账号行隐去,官方路由转入 setup', async () => {
+ const state = await load({ accountModels: 0 })
+
+ expect(state.rows.map(row => row.entry.provider)).toEqual(['deepseek-official'])
+ expect(onboardingReadiness(state).kind).toBe('credential-missing')
+ })
+
+ it('老核心没有 session.modelCatalog 时按未登录处理,不中断页面', async () => {
+ const state = await load({ withoutCatalog: true })
+
+ expect(state.status).toBe('ready')
+ expect(state.rows.map(row => row.entry.provider)).toEqual(['deepseek-official'])
+ })
+})
+
+describe('失败降级', () => {
+ it('模型目录读取抛错时仍发布快照', async () => {
+ const broken = remote({ accountModels: 1 })
+ broken.session.modelCatalog = vi.fn(async () => {
+ throw new Error('disconnected')
+ })
+ const store = new ModelsSettingsStore(broken, schema(), describeFace([OFFICIAL, ACCOUNT]))
+
+ await store.load()
+
+ expect(store.store.getSnapshot().status).toBe('ready')
+ })
+})
diff --git a/packages/dsh-tauri-model-config/src/client/models/store.ts b/packages/dsh-tauri-model-config/src/client/models/store.ts
index 8b6dbd05..c4e35ede 100644
--- a/packages/dsh-tauri-model-config/src/client/models/store.ts
+++ b/packages/dsh-tauri-model-config/src/client/models/store.ts
@@ -4,7 +4,9 @@ import type {
ClientRemote,
CredentialInfo,
LlmConfigurableProvider,
+ LlmModelCatalog,
LlmProviderInfo,
+ RemoteResult,
SettingsNamespaceView,
} from '../types/remotes.ts'
import type { SettingsSchemaOperations } from './schema-operations.ts'
@@ -48,7 +50,14 @@ export function joinProviderDirectory(
active: true,
})
}
- return rows
+ return [...rows].sort((left, right) => routeRank(left.provider) - routeRank(right.provider))
+}
+
+/** 账号与官方两条 DeepSeek 路由置顶(账号优先),其余保持声明顺序。 */
+function routeRank(provider: string): number {
+ if (provider === 'deepseek-account')
+ return 0
+ return provider === 'deepseek-official' ? 1 : 2
}
export interface ProviderRow {
@@ -58,8 +67,12 @@ export interface ProviderRow {
apiKeyEnv: string | undefined
credential: CredentialInfo | undefined
derivedCredential?: CredentialInfo
+ accountAvailable?: boolean
}
+/** 账号路由:凭据走官方账号登录,不读 API-key 环境变量引用。 */
+const ACCOUNT_PROVIDER = 'deepseek-account'
+
export interface ModelsSettingsState {
status: 'idle' | 'loading' | 'ready' | 'error'
error: string | null
@@ -73,6 +86,20 @@ export function deriveKeyRef(provider: string): string {
return `${provider.toUpperCase().replace(/[^A-Z0-9]+/g, '_')}_API_KEY`
}
+/** 模型目录读取:`session/modelCatalog` 只在带账号路由的核心上存在,老核心按「不可用」处理。 */
+async function modelCatalogOf(remote: ClientRemote): Promise<RemoteResult<LlmModelCatalog> | undefined> {
+ try {
+ const session = remote.session
+ const call = session?.modelCatalog
+ if (typeof call !== 'function')
+ return undefined
+ return await call.call(session)
+ }
+ catch {
+ return undefined
+ }
+}
+
export function protocolChoices(
namespace: SettingsNamespaceView | undefined,
schema: SettingsSchemaOperations,
@@ -158,11 +185,15 @@ export class ModelsSettingsStore {
entry,
configured,
removable,
- apiKeyEnv: apiKeyEnvOf(namespace, entry.settingsPath, this.schema),
+ apiKeyEnv: entry.provider === ACCOUNT_PROVIDER
+ ? undefined
+ : apiKeyEnvOf(namespace, entry.settingsPath, this.schema),
credential: undefined,
}
})
- const refs = [...new Set(rows.map(row => row.apiKeyEnv ?? deriveKeyRef(row.entry.provider)))]
+ if (rows.some(row => row.entry.provider === ACCOUNT_PROVIDER))
+ await this.joinAccountAvailability(rows)
+ const refs = [...new Set(rows.filter(row => row.entry.provider !== ACCOUNT_PROVIDER).map(row => row.apiKeyEnv ?? deriveKeyRef(row.entry.provider)))]
let credentials: Record<string, CredentialInfo> = {}
let credentialError: string | null = null
if (refs.length > 0) {
@@ -179,19 +210,37 @@ export class ModelsSettingsStore {
s.error = null
s.credentialError = credentialError
s.writable = writable
- s.rows = rows.map((row) => {
- const named = row.apiKeyEnv === undefined ? undefined : credentials[row.apiKeyEnv]
- const derived = row.apiKeyEnv !== undefined ? undefined : credentials[deriveKeyRef(row.entry.provider)]
- return {
- ...row,
- ...named === undefined ? {} : { credential: named },
- ...derived === undefined ? {} : { derivedCredential: derived },
- }
- })
+ s.rows = rows
+ .filter(row => row.entry.provider !== ACCOUNT_PROVIDER || row.accountAvailable === true)
+ .map((row) => {
+ if (row.entry.provider === ACCOUNT_PROVIDER)
+ return row
+ const named = row.apiKeyEnv === undefined ? undefined : credentials[row.apiKeyEnv]
+ const derived = row.apiKeyEnv !== undefined ? undefined : credentials[deriveKeyRef(row.entry.provider)]
+ return {
+ ...row,
+ ...named === undefined ? {} : { credential: named },
+ ...derived === undefined ? {} : { derivedCredential: derived },
+ }
+ })
s.namespaces = namespaces
})
}
+ /**
+ * 账号路由是否可用:登录状态本身不暴露给页面,用模型目录里「该分组有模型」表达——
+ * 未登录时账号分组为空,此时该行应从列表隐去(rc.2 起官方语义),只留可填 API-key 的官方路由。
+ */
+ private async joinAccountAvailability(rows: ProviderRow[]): Promise<void> {
+ const catalog = await modelCatalogOf(this.remote)
+ const available = catalog?.ok === true
+ && catalog.value.groups.some(group => group.id === ACCOUNT_PROVIDER && group.models.length > 0)
+ for (const row of rows) {
+ if (row.entry.provider === ACCOUNT_PROVIDER)
+ row.accountAvailable = available
+ }
+ }
+
private failLoad(generation: number, message: string): void {
if (generation !== this.generation)
return
@@ -205,6 +254,8 @@ export class ModelsSettingsStore {
export function providerUsable(row: ProviderRow): boolean {
if (!row.entry.active)
return false
+ if (row.entry.provider === ACCOUNT_PROVIDER)
+ return row.accountAvailable === true
if (row.apiKeyEnv === undefined)
return true
return row.credential?.configured === true
diff --git a/packages/dsh-tauri-model-config/src/client/models/styles.ts b/packages/dsh-tauri-model-config/src/client/models/styles.ts
index d832e171..28d9d055 100644
--- a/packages/dsh-tauri-model-config/src/client/models/styles.ts
+++ b/packages/dsh-tauri-model-config/src/client/models/styles.ts
@@ -50,8 +50,9 @@ const MODELS_CSS = `.zGbnIq_section {
}
.zGbnIq_rowCard {
- border: 0.5px solid var(--dsw-alias-border-l4);
- border-radius: 16px;
+ border: 0.5px solid var(--dsw-alias-settings-card-stroke);
+ background: var(--dsw-alias-settings-card-fill);
+ border-radius: var(--dsw-radius-xl);
padding: 12px 14px;
display: flex;
flex-direction: column;
@@ -82,7 +83,7 @@ const MODELS_CSS = `.zGbnIq_section {
flex: none;
padding: 1px 6px;
border: 0.5px solid var(--dsw-alias-border-l3);
- border-radius: 4px;
+ border-radius: var(--dsw-radius-xs);
font-size: 11px;
line-height: 16px;
color: var(--dsw-alias-label-secondary);
@@ -124,7 +125,7 @@ const MODELS_CSS = `.zGbnIq_section {
height: 36px;
padding: 0 14px;
border: none;
- border-radius: 18px;
+ border-radius: var(--dsw-radius-md);
font: inherit;
font-size: 14px;
line-height: 22px;
@@ -164,7 +165,7 @@ const MODELS_CSS = `.zGbnIq_section {
height: 36px;
padding: 0 14px;
border: none;
- border-radius: 18px;
+ border-radius: var(--dsw-radius-md);
background: transparent;
color: var(--dsw-alias-state-error-primary);
font: inherit;
@@ -181,7 +182,7 @@ const MODELS_CSS = `.zGbnIq_section {
.zGbnIq_rowActions .zGbnIq_dangerButton {
height: 28px;
padding: 0 10px;
- border-radius: 14px;
+ border-radius: var(--dsw-radius-sm);
font-size: 12px;
line-height: 18px;
}
@@ -205,11 +206,11 @@ const MODELS_CSS = `.zGbnIq_section {
.zGbnIq_iconButton:focus-visible,
.zGbnIq_customizedSummary:focus-visible {
outline: none;
- box-shadow: 0 0 0 2px var(--dsw-alias-border-l3);
+ box-shadow: 0 0 0 2px var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
}
.zGbnIq_editor {
- border-radius: 12px;
+ border-radius: var(--dsw-radius-lg);
background: var(--dsw-alias-bg-module-platform);
padding: 14px 16px;
display: flex;
@@ -259,7 +260,7 @@ const MODELS_CSS = `.zGbnIq_section {
height: 28px;
padding: 0 10px;
border: none;
- border-radius: 14px;
+ border-radius: var(--dsw-radius-sm);
background: transparent;
color: var(--dsw-alias-label-tertiary);
font: inherit;
@@ -303,7 +304,7 @@ const MODELS_CSS = `.zGbnIq_section {
gap: 6px;
height: 44px;
border: 1px dashed var(--dsw-alias-border-l3);
- border-radius: 16px;
+ border-radius: var(--dsw-radius-lg);
}
.zGbnIq_addModes {
@@ -325,7 +326,7 @@ const MODELS_CSS = `.zGbnIq_section {
.zGbnIq_addCard,
.zGbnIq_setupCard {
- border-radius: 12px;
+ border-radius: var(--dsw-radius-lg);
background: var(--dsw-alias-bg-module-platform);
padding: 14px 16px;
display: flex;
@@ -352,7 +353,7 @@ const MODELS_CSS = `.zGbnIq_section {
width: fit-content;
padding: 2px 4px;
margin-left: -4px;
- border-radius: 6px;
+ border-radius: var(--dsw-radius-sm);
cursor: pointer;
font-size: 12px;
line-height: 18px;
@@ -434,7 +435,7 @@ const MODELS_CSS = `.zGbnIq_section {
.zGbnIq_modelEntry {
border: 0.5px solid var(--dsw-alias-border-l4);
- border-radius: 10px;
+ border-radius: var(--dsw-radius-lg);
padding: 6px;
}
@@ -453,7 +454,7 @@ const MODELS_CSS = `.zGbnIq_section {
width: 28px;
height: 28px;
border: none;
- border-radius: 6px;
+ border-radius: var(--dsw-radius-sm);
background: transparent;
color: var(--dsw-alias-label-tertiary);
cursor: pointer;
@@ -518,7 +519,7 @@ const MODELS_CSS = `.zGbnIq_section {
.zGbnIq_modelEmpty {
padding: 12px;
border: 1px dashed var(--dsw-alias-border-l3);
- border-radius: 8px;
+ border-radius: var(--dsw-radius-lg);
text-align: center;
}
@@ -531,7 +532,7 @@ const MODELS_CSS = `.zGbnIq_section {
height: 28px;
padding: 0 10px;
border: 0.5px solid var(--dsw-alias-border-l3);
- border-radius: 14px;
+ border-radius: var(--dsw-radius-sm);
background: transparent;
color: var(--dsw-alias-label-primary);
font: inherit;
@@ -550,7 +551,7 @@ const MODELS_CSS = `.zGbnIq_section {
height: 32px;
padding: 0 10px;
border: 0.5px solid var(--dsw-alias-border-l4);
- border-radius: 8px;
+ border-radius: var(--dsw-radius-md);
font: inherit;
font-size: 14px;
line-height: 22px;
@@ -565,7 +566,7 @@ select.zGbnIq_input {
.zGbnIq_input:focus {
outline: none;
- border-color: var(--dsw-alias-brand-primary);
+ border-color: var(--dsw-alias-state-business-primary);
}
.zGbnIq_input::placeholder {
@@ -581,7 +582,7 @@ select.zGbnIq_input {
appearance: none;
padding-right: 32px;
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.zGbnIq_w3.zGbnIq_org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 12px center;
background-size: 12px 12px;
@@ -654,7 +655,7 @@ select.zGbnIq_input {
}
.zGbnIq_candidate {
- border-radius: 6px;
+ border-radius: var(--dsw-radius-md);
}
.zGbnIq_candidateLabel {
@@ -667,9 +668,12 @@ select.zGbnIq_input {
.zGbnIq_candidateId {
flex: 1 1 auto;
+ min-width: 0;
font-family: var(--ds-font-family-code);
font-size: 13px;
- overflow-wrap: anywhere;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ overflow: hidden;
}
.zGbnIq_candidateEmpty {
diff --git a/packages/dsh-tauri-model-config/src/client/register/models.ts b/packages/dsh-tauri-model-config/src/client/register/models.ts
index 6297120d..8613d18f 100644
--- a/packages/dsh-tauri-model-config/src/client/register/models.ts
+++ b/packages/dsh-tauri-model-config/src/client/register/models.ts
@@ -26,13 +26,18 @@ function refreshIfLoaded(controller: ModelsSettingsStore): void {
void controller.load()
}
+/** 桌面载体凭据:壳层给 iframe 注入 `dshDesktop`(浏览器直开没有该标记)。 */
+function isDesktopCarrier(): boolean {
+ return 'dshDesktop' in globalThis
+}
+
function credentialOnboardingOf(): boolean {
const page = globalThis as Partial<Record<typeof ONBOARDING_CONFIG_GLOBAL, unknown>>
const payload = page[ONBOARDING_CONFIG_GLOBAL]
const value = typeof payload === 'object' && payload !== null
? (payload as { credentialOnboarding?: unknown }).credentialOnboarding
: undefined
- return (value ?? true) === true && !('dshDesktop' in globalThis)
+ return (value ?? true) === true && !isDesktopCarrier()
}
export const registerModelsPage = defineRegister<ClientContext>((controller, ctx) => {
@@ -73,6 +78,7 @@ export const registerModelsPage = defineRegister<ClientContext>((controller, ctx
remote.$on('settings/document-updated', () => {
refreshModels()
}),
+ remote.$on('credentials/record-updated', refreshModels),
remote.$on('credentials/reference-updated', refreshModels),
remote.$on('llm/adapters-updated', refreshModels),
ctx.on('connection/reset', refreshModels),
@@ -93,12 +99,16 @@ export const registerModelsPage = defineRegister<ClientContext>((controller, ctx
'settings.models.footer': { kind: 'list', scope: 'root' },
},
}, ModelsSection)))
- controller.add(ctx.slots.inject('settings.onboarding', () => ctx.slots.register({
- name: 'settings.onboarding',
- id: 'welcome-notice',
- order: -100,
- inject: welcomeInjected,
- }, WelcomeNotice)))
+ // 内测声明步骤在桌面载体上不再注册(0.1.7-rc.2 起官方语义):壳层的引导座位由账号/密钥
+ // 那条入口独占,声明弹层不与它争同一个座位。
+ if (!isDesktopCarrier()) {
+ controller.add(ctx.slots.inject('settings.onboarding', () => ctx.slots.register({
+ name: 'settings.onboarding',
+ id: 'welcome-notice',
+ order: -100,
+ inject: welcomeInjected,
+ }, WelcomeNotice)))
+ }
controller.add(ctx.slots.inject('settings.onboarding', () => ctx.slots.register({
name: 'settings.onboarding',
id: 'deepseek-official',
diff --git a/packages/dsh-tauri-model-config/src/client/types/remotes.ts b/packages/dsh-tauri-model-config/src/client/types/remotes.ts
index 211dec39..87122856 100644
--- a/packages/dsh-tauri-model-config/src/client/types/remotes.ts
+++ b/packages/dsh-tauri-model-config/src/client/types/remotes.ts
@@ -56,6 +56,24 @@ export interface LlmModelDiscoveryRequest {
apiKey?: string
}
+export interface LlmCatalogModel {
+ id: string
+ name: string
+ description?: string
+}
+
+export interface LlmCatalogGroup {
+ id: string
+ name: string
+ models: readonly LlmCatalogModel[]
+}
+
+export interface LlmModelCatalog {
+ default: { provider: string, model: string, reasoningEffort?: string }
+ routableProviders: readonly string[]
+ groups: readonly LlmCatalogGroup[]
+}
+
export interface LlmDiscoveredModel {
id: string
name?: string
@@ -80,11 +98,16 @@ export interface LlmRemote {
discoverModels: (settingsNs: string, request: LlmModelDiscoveryRequest) => Promise<RemoteResult<LlmDiscoveredModel[]>>
}
-export type RemoteEventName = 'settings/document-updated' | 'credentials/reference-updated' | 'llm/adapters-updated'
+export interface SessionRemote {
+ modelCatalog: () => Promise<RemoteResult<LlmModelCatalog>>
+}
+
+export type RemoteEventName = 'settings/document-updated' | 'credentials/reference-updated' | 'credentials/record-updated' | 'llm/adapters-updated'
export interface ClientRemote {
settings: SettingsRemote
credentials: CredentialsRemote
llm: LlmRemote
+ session: SessionRemote
$on: (event: RemoteEventName, listener: () => void) => () => void
}
diff --git a/packages/dsh-tauri-ui/THIRD_PARTY_NOTICES.md b/packages/dsh-tauri-ui/THIRD_PARTY_NOTICES.md
new file mode 100644
index 00000000..09c05257
--- /dev/null
+++ b/packages/dsh-tauri-ui/THIRD_PARTY_NOTICES.md
@@ -0,0 +1,73 @@
+# Third-party notices
+
+## deepseek-ai/deepseek-harness
+
+This package re-forks individual UI components and their styles from the upstream
+client UI packages. Upstream sources are MIT-licensed:
+
+- Repository: <https://github.com/deepseek-ai/deepseek-harness>
+- Cross-checked revision: `477b4f420553e8a52c2fbccc464d7561b239c443` (`dsh-v0.1.7-rc.2`,
+ the revision vendored at `source/deepseek-harness`)
+- License: MIT — Copyright (c) 2026 DeepSeek
+
+Derived components (upstream class → this package), with the upstream source
+tracked per file in the `引用源` header and in `src/client/components/registry.ts`:
+
+| Upstream | This package (`src/client/`) | What was taken |
+| --- | --- | --- |
+| `ui-primitives` — `Button`, `Switch`, `Tag`, `Pill`, `Menu`, `Input`, `Tooltip`, `Toast`, `Modal`, `HoverCard`, `DisclosureRow`, `StateDot`, `ConnectionIndicator`, `BrandWordmark`, `FishLogo` | `components/official.tsx` (re-export) | The official components are re-exported unchanged where the locked primitives already ship them in both supported cores. |
+| `ui-primitives` — `Checkbox.tsx`, `StateDot.module.css` (dot), `settings-form/fields.module.css` (helpButton) | `components/checkbox.tsx`, `dot.tsx`, `icon-button.tsx` + `.cssr.ts` | Geometry, ink, and focus ring, re-implemented on this repo's `css-render` stack. |
+| `ui-sidebar` — `SidebarRoot.module.css` (`newSession`, `iconButton`) | `components/button.tsx`, `icon-button.tsx` + `.cssr.ts` | The New Session capsule and the rail/toolbar icon buttons. |
+| `ui-plugin-manager` — `PluginManagerPage.module.css` (`addButton`, `danger`, `iconButton`, `versionTag`, `statusTag`) | `components/button.tsx`, `icon-button.tsx`, `tag.tsx` + `.cssr.ts` | The card actions, the destructive action's token rebinding, and the version/status tags. |
+| `ui-workspace` — `rows/WorkspaceBrowser.module.css` (`searchButton`, `iconButton`), `rows/Rows.module.css` (`iconButton`) | `components/icon-button.tsx` + `.cssr.ts` | Browser and row icon buttons. |
+| `ui-settings-models` — `ModelsSection.module.css` (`iconButton`) | `components/icon-button.tsx` + `.cssr.ts` | The models-page icon action. |
+| `ui-chat` — `chat/MessageIconActions.module.css` (`action`) | `components/icon-button.tsx` + `.cssr.ts` | The message action strip button. |
+| `ui-agent-preset` — `AgentPresetSeat.module.css` (`seat`) | `components/chip.tsx` + `.cssr.ts` | The agent-preset seat chip. |
+| `ui-permission-presets` — `PermissionSelect.module.css` (`trigger`), `PermissionRow.module.css` (`selector`) | `components/chip.tsx` + `.cssr.ts` | The permission picker's trigger and row selector. |
+| `ui-goal` — `GoalBar.module.css` (`bar`, `iconBtn`) | `components/goal-bar.tsx` + `.cssr.ts` | The goal bar and its icon action. |
+| `ui-theme` — `base.css` radius scale, `focus.css` focus ring | `client/constants/theme.ts` | Token names only: the components consume `--dsw-radius-*` and the focus-ring tokens, with literal fallbacks for cores that predate them. |
+
+Not derived (this repo's own glue): `client/ui/` (settings sidebar, trigger,
+segmented control, hero workspace, nav icon, panel page), `client/styles/`,
+`client/register/`, `client/service/`, `client/store/`, `client/apis/`,
+`client/types/`, `client/host/`, and the model-configuration extras under
+`client/ui/model-extras/`.
+
+Synced from upstream `0.1.7-alpha.1` → `0.1.7-rc.2`:
+
+- The radius scale replaces the previous fixed capsules (`50%`, `28px`, `24px`,
+ `18px`, `16px`, `14px`, `12px`, `6px`, `4px`) on every reforked class listed
+ above; the focus ring moves from the border token to
+ `--dsw-focus-ring-color` with `--dsw-alias-state-business-primary` as fallback.
+- `Checkbox` adopts the upstream metrics (`gap: 6px`, `line-height: 20px`).
+- The sidebar rail's logo lives inside the collapse toggle
+ (`SidebarRoot.module.css` — `railMark`), so `styles/global.cssr.ts` keeps that
+ toggle visible while collapsed and hides it only in the expanded layout.
+- The settings launcher passes the new `settingsOpen` owner prop the official
+ account menu uses to refresh on open.
+
+## License
+
+```text
+MIT License
+
+Copyright (c) 2026 DeepSeek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+```
diff --git a/packages/dsh-tauri-ui/src/client/components/button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/button.cssr.ts
index b80aacce..59fbb248 100644
--- a/packages/dsh-tauri-ui/src/client/components/button.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/components/button.cssr.ts
@@ -13,7 +13,7 @@ const addCapsule = {
height: '32px',
padding: '0 12px',
border: 'none',
- borderRadius: '16px',
+ borderRadius: 'var(--dsw-radius-md)',
fontSize: '13px',
lineHeight: '20px',
cursor: 'pointer',
@@ -37,7 +37,7 @@ export default b('button', {}, [
color: primary,
background: 'var(--dsw-alias-button-elevated-fill)',
border: `0.5px solid ${borderL3}`,
- borderRadius: '12px',
+ borderRadius: 'var(--dsw-radius-md)',
cursor: 'pointer',
overflow: 'hidden',
}, [
@@ -72,7 +72,7 @@ export default b('button', {}, [
'height': '36px',
'padding': '0 14px',
'border': `0.5px solid color-mix(in srgb, ${error} 30%, transparent)`,
- 'borderRadius': '18px',
+ 'borderRadius': 'var(--dsw-radius-md)',
'background': 'transparent',
'color': error,
'fontSize': '14px',
@@ -90,7 +90,7 @@ export default b('button', {}, [
padding: '0 10px',
fontSize: '12px',
lineHeight: '18px',
- borderRadius: '14px',
+ borderRadius: 'var(--dsw-radius-sm)',
}),
]),
])
diff --git a/packages/dsh-tauri-ui/src/client/components/button.tsx b/packages/dsh-tauri-ui/src/client/components/button.tsx
index ceca2f56..39a0d46b 100644
--- a/packages/dsh-tauri-ui/src/client/components/button.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/button.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/Button.tsx ; @deepseek-ai/dsh-client-ui-sidebar · packages/client/ui-sidebar/src/client/SidebarRoot.module.css ; @deepseek-ai/dsh-client-ui-plugin-manager · packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css · 版本 0.1.7-alpha.1(≥0.1.5-rc.1)· hash elevated=hHd-Xa_newSession add=X_2TxG_addButton addGhost=X_2TxG_addButton danger=X_2TxG_danger
+// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/Button.tsx ; @deepseek-ai/dsh-client-ui-sidebar · packages/client/ui-sidebar/src/client/SidebarRoot.module.css ; @deepseek-ai/dsh-client-ui-plugin-manager · packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css · 版本 0.1.7-rc.2(≥0.1.5-rc.1)· hash elevated=hHd-Xa_newSession add=X_2TxG_addButton addGhost=X_2TxG_addButton danger=X_2TxG_danger
import type { ButtonHTMLAttributes, ReactElement, ReactNode } from 'react'
import { Button as PrimitiveButton } from '@deepseek-ai/dsh-client-ui-primitives'
import { compact } from 'dsh-tauri/client'
diff --git a/packages/dsh-tauri-ui/src/client/components/checkbox.cssr.ts b/packages/dsh-tauri-ui/src/client/components/checkbox.cssr.ts
index 2b2bb189..db86af0b 100644
--- a/packages/dsh-tauri-ui/src/client/components/checkbox.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/components/checkbox.cssr.ts
@@ -2,17 +2,17 @@ import { styles as sharedStyles } from '../constants/theme'
import { cssr } from '../utils/cssr'
const { c, bem: { b, e } } = cssr
-const { primary, secondary, borderL3 } = sharedStyles
+const { primary, secondary } = sharedStyles
export default b('checkbox', {
display: 'inline-flex',
alignItems: 'center',
- gap: '8px',
+ gap: '6px',
color: primary,
cursor: 'pointer',
font: 'inherit',
fontSize: '14px',
- lineHeight: '22px',
+ lineHeight: '20px',
}, [
e('input', {
boxSizing: 'border-box',
@@ -39,7 +39,7 @@ export default b('checkbox', {
color: secondary,
}),
c('.dshp-checkbox__input:focus-visible', {
- outline: `2px solid ${borderL3}`,
+ outline: 'var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))',
outlineOffset: '1px',
}),
])
diff --git a/packages/dsh-tauri-ui/src/client/components/checkbox.tsx b/packages/dsh-tauri-ui/src/client/components/checkbox.tsx
index 33562dd9..35d41f09 100644
--- a/packages/dsh-tauri-ui/src/client/components/checkbox.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/checkbox.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/Checkbox.tsx · 版本 0.1.7-alpha.1(≥0.1.7-alpha.1)· hash default=_checkbox_1jl6j_1
+// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/Checkbox.tsx · 版本 0.1.7-rc.2(≥0.1.7-alpha.1)· hash default=_checkbox_1wz3s_1
import type { ReactElement, ReactNode } from 'react'
import { useMountStyle } from '../hooks/use-mount-style'
import checkboxStyle from './checkbox.cssr'
diff --git a/packages/dsh-tauri-ui/src/client/components/chip.cssr.ts b/packages/dsh-tauri-ui/src/client/components/chip.cssr.ts
index 48ecaaf5..a49227f6 100644
--- a/packages/dsh-tauri-ui/src/client/components/chip.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/components/chip.cssr.ts
@@ -36,7 +36,7 @@ export default c([
minHeight: '28px',
padding: '0 8px',
border: 'none',
- borderRadius: '16px',
+ borderRadius: 'var(--dsw-radius-sm)',
background: 'transparent',
color: primary,
fontSize: '13px',
@@ -71,7 +71,7 @@ export default c([
height: '28px',
padding: '0 4px 0 8px',
border: 'none',
- borderRadius: '24px',
+ borderRadius: 'var(--dsw-radius-sm)',
outline: 'none',
background: 'transparent',
color: secondary,
@@ -110,7 +110,7 @@ export default c([
height: '36px',
padding: '0 14px',
border: 'none',
- borderRadius: '18px',
+ borderRadius: 'var(--dsw-radius-md)',
background: modulePlatform,
font: 'inherit',
fontSize: '14px',
diff --git a/packages/dsh-tauri-ui/src/client/components/chip.tsx b/packages/dsh-tauri-ui/src/client/components/chip.tsx
index f0509add..df89f6f9 100644
--- a/packages/dsh-tauri-ui/src/client/components/chip.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/chip.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-agent-preset · packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css ; @deepseek-ai/dsh-client-ui-permission-presets · packages/client/ui-permission-presets/src/client/PermissionSelect.module.css ; @deepseek-ai/dsh-client-ui-permission-presets · packages/client/ui-permission-presets/src/client/PermissionRow.module.css · 版本 0.1.7-alpha.1(≥0.1.5-rc.1)· hash seat=cubgiG_seat composerTrigger=iWlSmW_trigger selector=oY77xG_selector
+// 引用源 @deepseek-ai/dsh-client-ui-agent-preset · packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css ; @deepseek-ai/dsh-client-ui-permission-presets · packages/client/ui-permission-presets/src/client/PermissionSelect.module.css ; @deepseek-ai/dsh-client-ui-permission-presets · packages/client/ui-permission-presets/src/client/PermissionRow.module.css · 版本 0.1.7-rc.2(≥0.1.5-rc.1)· hash seat=cubgiG_seat composerTrigger=iWlSmW_trigger selector=oY77xG_selector
import type { ButtonHTMLAttributes, ReactElement, ReactNode } from 'react'
import { compact } from 'dsh-tauri/client'
import { useMountStyle } from '../hooks/use-mount-style'
diff --git a/packages/dsh-tauri-ui/src/client/components/dot.tsx b/packages/dsh-tauri-ui/src/client/components/dot.tsx
index d5d66c45..e27f4cf1 100644
--- a/packages/dsh-tauri-ui/src/client/components/dot.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/dot.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/StateDot.module.css · 版本 0.1.7-alpha.1(≥0.1.7-alpha.1)· hash dot=_dot_1i3xo_2
+// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/StateDot.module.css · 版本 0.1.7-rc.2(≥0.1.7-alpha.1)· hash dot=_dot_1i3xo_2
import type { ReactElement } from 'react'
import { compact } from 'dsh-tauri/client'
import { useMountStyle } from '../hooks/use-mount-style'
diff --git a/packages/dsh-tauri-ui/src/client/components/goal-bar.tsx b/packages/dsh-tauri-ui/src/client/components/goal-bar.tsx
index 2a4ed92e..3c185b6d 100644
--- a/packages/dsh-tauri-ui/src/client/components/goal-bar.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/goal-bar.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-goal · packages/client/ui-goal/src/client/GoalBar.module.css · 版本 0.1.7-alpha.1(≥0.1.5-rc.1)· hash bar=nLMEza_bar action=nLMEza_iconBtn
+// 引用源 @deepseek-ai/dsh-client-ui-goal · packages/client/ui-goal/src/client/GoalBar.module.css · 版本 0.1.7-rc.2(≥0.1.5-rc.1)· hash bar=nLMEza_bar action=nLMEza_iconBtn
import type { ButtonHTMLAttributes, HTMLAttributes, ReactElement, ReactNode } from 'react'
import { compact } from 'dsh-tauri/client'
import { useMountStyle } from '../hooks/use-mount-style'
diff --git a/packages/dsh-tauri-ui/src/client/components/icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/icon-button.cssr.ts
index 2eeff093..2bda046b 100644
--- a/packages/dsh-tauri-ui/src/client/components/icon-button.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/components/icon-button.cssr.ts
@@ -2,7 +2,7 @@ import { styles as sharedStyles } from '../constants/theme'
import { cssr } from '../utils/cssr'
const { c, bem: { b, m } } = cssr
-const { brand, focusRing, hover, primary, secondary, tertiary } = sharedStyles
+const { focusRing, hover, primary, secondary, tertiary } = sharedStyles
export default b('icon-button', {}, [
m('search', {
@@ -29,7 +29,7 @@ export default b('icon-button', {}, [
width: '28px',
height: '28px',
border: '0',
- borderRadius: '28px',
+ borderRadius: 'var(--dsw-radius-sm)',
background: 'transparent',
color: 'var(--dsw-alias-label-caption)',
cursor: 'pointer',
@@ -43,7 +43,7 @@ export default b('icon-button', {}, [
cursor: 'default',
}),
c('&:focus-visible', {
- outline: `2px solid ${brand}`,
+ outline: 'var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))',
outlineOffset: '1px',
}),
]),
@@ -55,7 +55,7 @@ export default b('icon-button', {}, [
width: '28px',
height: '28px',
border: 'none',
- borderRadius: '6px',
+ borderRadius: 'var(--dsw-radius-sm)',
background: 'transparent',
color: tertiary,
cursor: 'pointer',
@@ -79,8 +79,7 @@ export default b('icon-button', {}, [
width: '28px',
height: '28px',
border: 'none',
- borderRadius: '50%',
- cornerShape: 'round',
+ borderRadius: 'var(--dsw-radius-sm)',
padding: '0',
background: 'transparent',
cursor: 'pointer',
@@ -100,7 +99,7 @@ export default b('icon-button', {}, [
width: '16px',
height: '16px',
border: 'none',
- borderRadius: '4px',
+ borderRadius: 'var(--dsw-radius-xs)',
padding: '0',
background: 'transparent',
cursor: 'pointer',
@@ -121,7 +120,7 @@ export default b('icon-button', {}, [
height: '24px',
padding: '0',
border: '0',
- borderRadius: '6px',
+ borderRadius: 'var(--dsw-radius-sm)',
background: 'none',
color: tertiary,
cursor: 'pointer',
@@ -131,7 +130,7 @@ export default b('icon-button', {}, [
color: secondary,
}),
c('&:focus-visible', {
- outline: `2px solid ${brand}`,
+ outline: 'var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))',
outlineOffset: '1px',
}),
]),
@@ -143,7 +142,7 @@ export default b('icon-button', {}, [
height: 'calc(28px + var(--dsh-content-font-delta, 0px))',
padding: '6px',
border: 'none',
- borderRadius: '28px',
+ borderRadius: 'var(--dsw-radius-sm)',
background: 'transparent',
color: tertiary,
cursor: 'pointer',
diff --git a/packages/dsh-tauri-ui/src/client/components/icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/icon-button.tsx
index acf8da1f..a77767f2 100644
--- a/packages/dsh-tauri-ui/src/client/components/icon-button.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/icon-button.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-workspace · packages/client/ui-workspace/src/client/rows/WorkspaceBrowser.module.css ; @deepseek-ai/dsh-client-ui-plugin-manager · packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css ; @deepseek-ai/dsh-client-ui-settings-models · packages/client/ui-settings-models/src/client/ModelsSection.module.css ; @deepseek-ai/dsh-client-ui-sidebar · packages/client/ui-sidebar/src/client/SidebarRoot.module.css ; @deepseek-ai/dsh-client-ui-workspace · packages/client/ui-workspace/src/client/rows/Rows.module.css ; @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/settings-form/fields.module.css ; @deepseek-ai/dsh-client-ui-chat · packages/client/ui-chat/src/client/chat/MessageIconActions.module.css · 版本 0.1.7-alpha.1(≥0.1.5-rc.1)· hash search=bhn1Oq_searchButton toolbar=X_2TxG_iconButton model=zGbnIq_iconButton round=IW6AQa_iconButton(同包另有 hHd-Xa_iconButton) row=YDXeBa_iconButton(同包另有 bhn1Oq_iconButton) help=helpButton action=xzv4MW_action
+// 引用源 @deepseek-ai/dsh-client-ui-workspace · packages/client/ui-workspace/src/client/rows/WorkspaceBrowser.module.css ; @deepseek-ai/dsh-client-ui-plugin-manager · packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css ; @deepseek-ai/dsh-client-ui-settings-models · packages/client/ui-settings-models/src/client/ModelsSection.module.css ; @deepseek-ai/dsh-client-ui-sidebar · packages/client/ui-sidebar/src/client/SidebarRoot.module.css ; @deepseek-ai/dsh-client-ui-workspace · packages/client/ui-workspace/src/client/rows/Rows.module.css ; @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/settings-form/fields.module.css ; @deepseek-ai/dsh-client-ui-chat · packages/client/ui-chat/src/client/chat/MessageIconActions.module.css · 版本 0.1.7-rc.2(≥0.1.5-rc.1)· hash search=bhn1Oq_searchButton toolbar=X_2TxG_iconButton model=zGbnIq_iconButton round=IW6AQa_iconButton(同包另有 hHd-Xa_iconButton) row=YDXeBa_iconButton(同包另有 bhn1Oq_iconButton) help=_helpButton_bjqpo_41 action=xzv4MW_action
import type { ButtonHTMLAttributes, ReactElement, ReactNode } from 'react'
import { compact } from 'dsh-tauri/client'
diff --git a/packages/dsh-tauri-ui/src/client/components/official.tsx b/packages/dsh-tauri-ui/src/client/components/official.tsx
index 532ad71d..4bcdb785 100644
--- a/packages/dsh-tauri-ui/src/client/components/official.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/official.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/ · 版本 0.1.7-alpha.1(≥0.1.5-rc.1)· hash 官方原样(无 refork 类)
+// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/ · 版本 0.1.7-rc.2(≥0.1.5-rc.1)· hash 官方原样(无 refork 类)
/**
* 官方 `@deepseek-ai/dsh-client-ui-primitives` 的直通转发层。
*
diff --git a/packages/dsh-tauri-ui/src/client/components/registry.ts b/packages/dsh-tauri-ui/src/client/components/registry.ts
index 427d90dd..6974c38c 100644
--- a/packages/dsh-tauri-ui/src/client/components/registry.ts
+++ b/packages/dsh-tauri-ui/src/client/components/registry.ts
@@ -16,9 +16,9 @@ export interface UiComponentEntry {
}
const PRIMITIVES = '@deepseek-ai/dsh-client-ui-primitives'
-const VERSION = '0.1.7-alpha.1'
-const AVAILABLE_BOTH = ['0.1.5-rc.1', '0.1.7-alpha.1']
-const AVAILABLE_LATEST = ['0.1.7-alpha.1']
+const VERSION = '0.1.7-rc.2'
+const AVAILABLE_BOTH = ['0.1.5-rc.1', '0.1.7-rc.2']
+const AVAILABLE_LATEST = ['0.1.7-rc.2']
function slug(name: string): string {
return name.replaceAll('_', '-').replaceAll(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
diff --git a/packages/dsh-tauri-ui/src/client/components/tag.tsx b/packages/dsh-tauri-ui/src/client/components/tag.tsx
index 0da1f307..3c6d5964 100644
--- a/packages/dsh-tauri-ui/src/client/components/tag.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/tag.tsx
@@ -1,4 +1,4 @@
-// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/Tag.tsx ; @deepseek-ai/dsh-client-ui-plugin-manager · packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css · 版本 0.1.7-alpha.1(≥0.1.5-rc.1)· hash version=X_2TxG_versionTag status=X_2TxG_statusTag
+// 引用源 @deepseek-ai/dsh-client-ui-primitives · packages/client/ui-primitives/src/Tag.tsx ; @deepseek-ai/dsh-client-ui-plugin-manager · packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css · 版本 0.1.7-rc.2(≥0.1.5-rc.1)· hash version=X_2TxG_versionTag status=X_2TxG_statusTag
import type { HTMLAttributes, ReactElement, ReactNode } from 'react'
import { Tag as PrimitiveTag } from '@deepseek-ai/dsh-client-ui-primitives'
import { compact } from 'dsh-tauri/client'
diff --git a/packages/dsh-tauri-ui/src/client/styles/global.cssr.test.ts b/packages/dsh-tauri-ui/src/client/styles/global.cssr.test.ts
new file mode 100644
index 00000000..4dce4cc2
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/styles/global.cssr.test.ts
@@ -0,0 +1,27 @@
+import { describe, expect, it } from 'vitest'
+import globalStyle from './global.cssr'
+
+/**
+ * 侧边栏 rail 的 logo 契约。
+ *
+ * 官方侧边栏折叠后,logo 不再来自 `logoRow` 上的品牌块(它只在展开态渲染),
+ * 而是画在 logo 行里那枚 toggle 内(`railMark` 鲸鱼,悬停互换为展开图标)。
+ * 本仓为去掉重复入口在展开态隐藏该 toggle —— 该规则不得在折叠态继续命中,
+ * 否则 rail 上的 logo 整块消失。这里按生成 CSS 断言这条恢复规则存在且特异性更高。
+ */
+describe('sidebar rail logo', () => {
+ const css = globalStyle.render()
+
+ it('展开态隐藏重复的折叠 toggle', () => {
+ expect(css).toMatch(/\[class\$="logoRow"\][^{]*\[class\$="toggle"\][^{]*\{[^}]*display:\s*none\s*!important/)
+ })
+
+ it('折叠态把承载 logo 的 toggle 恢复显示(特异性高于隐藏规则)', () => {
+ const recovery = /\[class\*="collapsed"\]\s*\[class\$="logoRow"\]\s*\[class\$="toggle"\][^{]*\{[^}]*display:\s*inline-flex\s*!important/.exec(css)
+ expect(recovery, '缺少折叠轨道的 logo 恢复规则').not.toBeNull()
+
+ const hide = css.indexOf('[class$="logoRow"] [class$="toggle"]')
+ const show = css.indexOf('[class*="collapsed"] [class$="logoRow"] [class$="toggle"]')
+ expect(show, '恢复规则必须排在隐藏规则之后').toBeGreaterThan(hide)
+ })
+})
diff --git a/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts b/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts
index e3ae23bc..973f1174 100644
--- a/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts
@@ -56,9 +56,9 @@ export default c([
color: 'var(--dsw-alias-label-primary) !important',
justifyContent: 'center !important',
}, [
- // 「右侧按钮」= 官方侧边栏自带的折叠 toggle。桌面壳 navbar 已有自己的
+ // 官方侧边栏自带的折叠 toggle。桌面壳 navbar 已有自己的
// `dsh-navbar-sidebar-toggle`(`dsh://sidebar:toggle` → `ctx.layout.toggleSidebar`),
- // 官方这枚是重复入口;隐藏后 logo 独占整行。
+ // 官方这枚在**展开态**是重复入口;折叠态不能隐藏它(见下一条)。
c('[class$="toggle"], [class*="toggle "]', {
display: 'none !important',
}),
@@ -69,6 +69,11 @@ export default c([
justifyContent: 'center !important',
}),
]),
+ // 折叠轨道(rail)的 logo 就画在这枚 toggle 里(官方 `railMark` 鲸鱼,悬停换成展开图标):
+ // 上一条隐藏规则若在折叠态也命中,rail 上的 logo 会整块消失。这里按更高特异性把它恢复回来。
+ c('[class*="collapsed"] [class$="logoRow"] [class$="toggle"]', {
+ display: 'inline-flex !important',
+ }),
// 折叠轨道回到官方左对齐:上一条 `!important` 会盖掉官方 `.collapsed .logoRow`。
c('[class*="collapsed"] [class$="logoRow"]', {
justifyContent: 'flex-start !important',
diff --git a/packages/dsh-tauri-ui/src/client/ui/trigger.tsx b/packages/dsh-tauri-ui/src/client/ui/trigger.tsx
index 356b26f0..f21c190a 100644
--- a/packages/dsh-tauri-ui/src/client/ui/trigger.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/trigger.tsx
@@ -93,6 +93,8 @@ export function SettingsTrigger({ wide, useSessions }: SettingsTriggerProps): Re
slotKey={SETTINGS_LAUNCHER_SLOT}
ownerProps={{
wide,
+ // 0.1.7-rc.2 起官方账号菜单把「设置面板刚打开」当作一次刷新时机。
+ settingsOpen: open,
openSettings: () => store.settings.openAt(),
openOnboarding: (id: string) => store.settings.openAt(id),
}}
diff --git a/packages/dsh-tauri/THIRD_PARTY_NOTICES.md b/packages/dsh-tauri/THIRD_PARTY_NOTICES.md
index 39836558..8fd42eee 100644
--- a/packages/dsh-tauri/THIRD_PARTY_NOTICES.md
+++ b/packages/dsh-tauri/THIRD_PARTY_NOTICES.md
@@ -7,7 +7,10 @@ from the upstream Electron desktop implementation of the same features.
Upstream sources are MIT-licensed:
- Repository: <https://github.com/deepseek-ai/deepseek-harness>
-- Cross-checked revision: `46a7f68b0922371ce7144b668b90e377d8e799f4`
+- Cross-checked revision: `477b4f420553e8a52c2fbccc464d7561b239c443` (`dsh-v0.1.7-rc.2`,
+ the revision vendored at `source/deepseek-harness`); the account-stream carrier
+ gate and the sidebar/DOM contracts this package mirrors are unchanged from
+ `0.1.7-alpha.1`
- License: MIT — Copyright (c) 2026 DeepSeek
Derived behaviour (upstream → this package):
diff --git a/packages/dsh-tauri/src/client/register/account.test.ts b/packages/dsh-tauri/src/client/register/account.test.ts
index 3ac48061..58748d80 100644
--- a/packages/dsh-tauri/src/client/register/account.test.ts
+++ b/packages/dsh-tauri/src/client/register/account.test.ts
@@ -20,11 +20,12 @@ const AUTHORIZE_A = 'https://platform.deepseek.com/dsh/authorize?state=a'
const AUTHORIZE_B = 'https://platform.deepseek.com/dsh/authorize?state=b'
interface AttemptView {
+ status?: string
attempt?: { phase?: string, authorizeUrl?: string } | null
}
/** 账号远程面:`watch()` 给原始值,`$stream()` 与官方一样把值包成 `{ value, accept }` 帧。 */
-function makeRemote(views: AttemptView[]) {
+function makeRemote(views: AttemptView[], session?: { initializeDefaultModel?: () => Promise<unknown> }) {
const account = {
watch: () => (async function* () {
for (const view of views)
@@ -33,6 +34,7 @@ function makeRemote(views: AttemptView[]) {
}
return {
account,
+ ...session === undefined ? {} : { session },
$stream: (options: { open: (signal: AbortSignal) => AsyncIterable<AttemptView> }) => ({
async* [Symbol.asyncIterator]() {
for await (const value of options.open(new AbortController().signal))
@@ -136,3 +138,71 @@ describe('accountSignInFeature', () => {
dispose()
})
})
+
+/**
+ * 登录成功 → 默认模型初始化:官方账号 UI 在 `credential-stored` + `succeeded` 的那一帧
+ * 请求 `session/initializeDefaultModel`,把默认模型从需要 API Key 的 `deepseek-official`
+ * 换到账号路由。桌面载体在客户端挂载前就完成签名时官方那侧不会触发,因此这里必须补上。
+ */
+describe('accountSignInFeature — post sign-in default model', () => {
+ const signedIn: AttemptView = { status: 'credential-stored', attempt: { phase: 'succeeded' } }
+
+ it('initializes the default model once on the sign-in edge', async () => {
+ const initializeDefaultModel = vi.fn(async () => undefined)
+ const ctx = ctxWithRemote(() => makeRemote([
+ { status: 'signed-out' },
+ { status: 'waiting', attempt: { phase: 'waiting-browser', authorizeUrl: AUTHORIZE_A } },
+ signedIn,
+ signedIn,
+ ], { initializeDefaultModel }))
+
+ const dispose = accountSignInFeature.call(ctx)
+
+ await vi.waitFor(() => expect(initializeDefaultModel).toHaveBeenCalledTimes(1))
+ dispose()
+ })
+
+ it('re-arms after the account leaves the succeeded state', async () => {
+ const initializeDefaultModel = vi.fn(async () => undefined)
+ const ctx = ctxWithRemote(() => makeRemote([
+ signedIn,
+ { status: 'signed-out' },
+ signedIn,
+ ], { initializeDefaultModel }))
+
+ const dispose = accountSignInFeature.call(ctx)
+
+ await vi.waitFor(() => expect(initializeDefaultModel).toHaveBeenCalledTimes(2))
+ dispose()
+ })
+
+ it('survives a core whose session remote has no initializeDefaultModel', async () => {
+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
+ const ctx = ctxWithRemote(() => makeRemote([signedIn], {}))
+
+ const dispose = accountSignInFeature.call(ctx)
+ await Promise.resolve()
+ await Promise.resolve()
+
+ expect(warn).not.toHaveBeenCalled()
+ warn.mockRestore()
+ dispose()
+ })
+
+ /** 初始化失败只告警:登录本身已经成功,不得让账号流崩掉。 */
+ it('reports a failed initialization without throwing', async () => {
+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
+ const ctx = ctxWithRemote(() => makeRemote([signedIn], {
+ initializeDefaultModel: async () => {
+ throw new Error('session/provider-models-unavailable')
+ },
+ }))
+
+ const dispose = accountSignInFeature.call(ctx)
+
+ await vi.waitFor(() => expect(warn).toHaveBeenCalled())
+ expect(warn.mock.calls[0]?.[0]).toContain('initializing the account default model failed')
+ warn.mockRestore()
+ dispose()
+ })
+})
diff --git a/packages/dsh-tauri/src/client/register/account.ts b/packages/dsh-tauri/src/client/register/account.ts
index 88b133a9..0b0f13f2 100644
--- a/packages/dsh-tauri/src/client/register/account.ts
+++ b/packages/dsh-tauri/src/client/register/account.ts
@@ -8,10 +8,10 @@ interface AccountAttemptView {
}
interface AccountViewLike {
+ status?: string
attempt?: AccountAttemptView | null
}
-/** `$stream` 的帧:官方 `RemoteStream.read()` 把 open() 的每个原始值包成 `{ value, accept }`。 */
interface AccountStreamFrame {
value?: AccountViewLike
accept?: () => void
@@ -21,10 +21,16 @@ interface AccountStreamLike extends AsyncIterable<AccountStreamFrame> {
dispose?: () => Promise<void> | void
}
+/** 登录成功后把默认模型落到账号路由所需的宿主方法(`session/initializeDefaultModel`)。 */
+interface AccountSessionLike {
+ initializeDefaultModel?: () => Promise<unknown>
+}
+
interface AccountRemoteLike {
account?: {
watch?: (signal: AbortSignal) => AsyncIterable<AccountViewLike>
}
+ session?: AccountSessionLike
$stream?: (options: {
name: string
open: (signal: AbortSignal) => AsyncIterable<AccountViewLike>
@@ -50,14 +56,22 @@ interface InjectedScope {
* `ui-settings-account` 的消费方式逐字一致。
*
* 只在桌面载体生效:浏览器直开没有 `dshDesktop` 标记,也不该替用户开浏览器。
+ *
+ * 同一处订阅还承担官方账号 UI 的第二个职责:登录成功的那一帧把默认模型落到账号路由
+ * (`session/initializeDefaultModel` —— 官方在 `ui-settings-account` 里做同一件事)。
+ * 桌面载体比官方多一道风险:签名可能在客户端挂载前就完成(欢迎/账号页先登录),
+ * 此时官方那侧的「状态迁移」判定不会触发,默认模型会停在需要 API Key 的
+ * `deepseek-official` 路由上,第一条消息即以 MISSING_CREDENTIAL 失败;
+ * 这里按官方同一条件补一次(宿主方法自身在「已有任一 provider 密钥」时不改默认,幂等)。
*/
export const accountSignInFeature = defineRegister((controller, ctx) => {
if (!('dshDesktop' in globalThis))
return
let opened: string | undefined
+ let wasSignedIn = false
- ctx.inject(['remote', 'remote.account'], (scoped) => {
+ ctx.inject(['remote', 'remote.account', 'remote.session'], (scoped) => {
const remote = (scoped as unknown as InjectedScope).remote
const account = remote?.account
const watch = account?.watch
@@ -80,12 +94,16 @@ export const accountSignInFeature = defineRegister((controller, ctx) => {
const attempt = frame.value?.attempt
frame.accept?.()
const url = attempt?.authorizeUrl
- if (attempt?.phase !== 'waiting-browser' || !isBrowserUrl(url) || url === opened)
- continue
- opened = url
- await invoke('open_external_url', { url }).catch((error: unknown) => {
- console.warn('[dsh-tauri] opening the account authorize url failed:', error)
- })
+ if (attempt?.phase === 'waiting-browser' && isBrowserUrl(url) && url !== opened) {
+ opened = url
+ await invoke('open_external_url', { url }).catch((error: unknown) => {
+ console.warn('[dsh-tauri] opening the account authorize url failed:', error)
+ })
+ }
+ const signedIn = frame.value?.status === 'credential-stored' && attempt?.phase === 'succeeded'
+ if (signedIn && !wasSignedIn)
+ void initializeDefaultModel(remote)
+ wasSignedIn = signedIn
}
})().catch(() => undefined)
})
@@ -93,6 +111,26 @@ export const accountSignInFeature = defineRegister((controller, ctx) => {
// --- internal ---
+/** 登录成功后按官方条件请求一次默认模型初始化;能力缺席或失败只告警。 */
+async function initializeDefaultModel(remote: AccountRemoteLike | undefined): Promise<void> {
+ let call: AccountSessionLike['initializeDefaultModel']
+ try {
+ call = remote?.session?.initializeDefaultModel
+ }
+ catch (error) {
+ console.warn('[dsh-tauri] reading the session remote failed:', error)
+ return
+ }
+ if (typeof call !== 'function')
+ return
+ try {
+ await call.call(remote?.session)
+ }
+ catch (error) {
+ console.warn('[dsh-tauri] initializing the account default model failed:', error)
+ }
+}
+
/** 只放行宿主 `open_external_url` 能处理的 http(s) 浏览器地址。 */
function isBrowserUrl(value: unknown): value is string {
if (typeof value !== 'string')
diff --git a/packages/dsh-tauri/src/client/register/style.utils.test.ts b/packages/dsh-tauri/src/client/register/style.utils.test.ts
new file mode 100644
index 00000000..1e8c6899
--- /dev/null
+++ b/packages/dsh-tauri/src/client/register/style.utils.test.ts
@@ -0,0 +1,161 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { getFrameStyle, getOverlayMarkedStyle, getSidebarStyle } from './style.utils'
+
+/**
+ * `style.utils` 的跨代契约:0.1.7-rc.2 把弹层蒙版的底色从元素搬到了 `::after`
+ * (并在那里做入场动画),只读元素自身会镜像出全透明——这里用最小 DOM 假实现
+ * 锁住两代都能读出底色,且入场动效被镜像成同参数过渡。仓库未装 jsdom,
+ * DOM 与 getComputedStyle 由 vi.stubGlobal 提供。
+ */
+
+interface LayerSpec {
+ backgroundColor: string
+ background?: string
+ backdropFilter?: string
+ animationDuration?: string
+ animationTimingFunction?: string
+ inset?: string
+ position?: string
+}
+
+interface ElementSpec {
+ own: LayerSpec
+ after?: LayerSpec
+ detached?: boolean
+ inSlot?: boolean
+}
+
+function computed(spec: LayerSpec): CSSStyleDeclaration {
+ return {
+ backgroundColor: spec.backgroundColor,
+ background: spec.background ?? spec.backgroundColor,
+ backdropFilter: spec.backdropFilter ?? 'none',
+ animationDuration: spec.animationDuration ?? '0s',
+ animationTimingFunction: spec.animationTimingFunction ?? 'ease',
+ inset: spec.inset ?? '0px',
+ position: spec.position ?? 'absolute',
+ } as unknown as CSSStyleDeclaration
+}
+
+function element(spec: ElementSpec): Record<string, unknown> {
+ return {
+ __spec: spec,
+ parentElement: spec.detached === true ? null : { __position: 'fixed' },
+ closest: (selector: string) => (selector === '[data-slot]' && spec.inSlot === true ? {} : null),
+ }
+}
+
+function install(overlays: Record<string, unknown>[], frames: Record<string, unknown>[] = []): void {
+ vi.stubGlobal('document', {
+ querySelectorAll: (selector: string) => (selector.includes('_frame') ? frames : overlays),
+ querySelector: () => null,
+ })
+ vi.stubGlobal('getComputedStyle', (target: Record<string, unknown>, pseudo?: string) => {
+ if (target.__position !== undefined)
+ return computed({ backgroundColor: 'rgba(0, 0, 0, 0)', position: String(target.__position) })
+ const spec = target.__spec as ElementSpec
+ if (pseudo === '::after')
+ return computed(spec.after ?? { backgroundColor: 'rgba(0, 0, 0, 0)', background: 'none' })
+ return computed(spec.own)
+ })
+}
+
+afterEach(() => {
+ vi.unstubAllGlobals()
+})
+
+describe('getOverlayMarkedStyle', () => {
+ it('≤0.1.7-alpha.1:底色在蒙版元素自身', () => {
+ install([element({
+ own: {
+ backgroundColor: 'rgba(0, 0, 0, 0.24)',
+ background: 'rgba(0, 0, 0, 0.24) none repeat scroll 0% 0% / auto padding-box border-box',
+ backdropFilter: 'blur(2px)',
+ },
+ })])
+
+ const style = getOverlayMarkedStyle()
+
+ expect(style?.background).toContain('rgba(0, 0, 0, 0.24)')
+ expect(style?.backdropFilter).toBe('blur(2px)')
+ expect(style?.bottom).toBe('-1px')
+ expect(style?.inset).toBe('0px')
+ expect(style?.transitionDuration).toBe('0s')
+ })
+
+ it('≥0.1.7-rc.2:底色在 ::after,入场动效镜像成同参数过渡', () => {
+ install([element({
+ own: {
+ backgroundColor: 'rgba(0, 0, 0, 0)',
+ background: 'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box',
+ backdropFilter: 'blur(2px)',
+ },
+ after: {
+ backgroundColor: 'rgba(0, 0, 0, 0.24)',
+ background: 'rgba(0, 0, 0, 0.24) none repeat scroll 0% 0% / auto padding-box border-box',
+ animationDuration: '0.2s',
+ animationTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
+ },
+ })])
+
+ const style = getOverlayMarkedStyle()
+
+ expect(style?.background).toContain('rgba(0, 0, 0, 0.24)')
+ expect(style?.backdropFilter).toBe('blur(2px)')
+ expect(style?.transitionProperty).toBe('background, backdrop-filter')
+ expect(style?.transitionDuration).toBe('0.2s')
+ expect(style?.transitionTimingFunction).toBe('cubic-bezier(0.4, 0, 0.2, 1)')
+ })
+
+ it('同时存在多个蒙版时选弹层那个(父级 fixed 且底色可见)', () => {
+ install([
+ element({ own: { backgroundColor: 'rgba(0, 0, 0, 0)', background: 'none' }, detached: true }),
+ element({
+ own: { backgroundColor: 'rgba(0, 0, 0, 0)', background: 'none' },
+ after: { backgroundColor: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)', animationDuration: '120ms' },
+ }),
+ ])
+
+ const style = getOverlayMarkedStyle()
+
+ expect(style?.background).toContain('rgba(0, 0, 0, 0.5)')
+ expect(style?.transitionDuration).toBe('120ms')
+ })
+
+ it('减弱动效(animation: none)时不镜像过渡时长', () => {
+ install([element({
+ own: { backgroundColor: 'rgba(0, 0, 0, 0)', background: 'none' },
+ after: { backgroundColor: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)', animationDuration: '0s' },
+ })])
+
+ expect(getOverlayMarkedStyle()?.transitionDuration).toBe('0s')
+ })
+
+ it('无蒙版时不产出镜像样式', () => {
+ install([])
+ expect(getOverlayMarkedStyle()).toBeNull()
+ })
+})
+
+describe('getFrameStyle', () => {
+ it('只认布局帧,跳过组件区域内的同名 frame', () => {
+ install([], [
+ element({ own: { backgroundColor: '', background: 'rgb(1, 1, 1)' }, inSlot: true }),
+ element({ own: { backgroundColor: '', background: 'rgb(9, 9, 9)' } }),
+ ])
+
+ expect(getFrameStyle()?.background).toBe('rgb(9, 9, 9)')
+ })
+
+ it('只有组件区域内的 frame 时不产出镜像样式', () => {
+ install([], [element({ own: { backgroundColor: '', background: 'rgb(1, 1, 1)' }, inSlot: true })])
+ expect(getFrameStyle()).toBeNull()
+ })
+})
+
+describe('getSidebarStyle', () => {
+ it('侧栏缺席时返回 null', () => {
+ install([])
+ expect(getSidebarStyle()).toBeNull()
+ })
+})
diff --git a/packages/dsh-tauri/src/client/register/style.utils.ts b/packages/dsh-tauri/src/client/register/style.utils.ts
index 02e4334d..2e2468b3 100644
--- a/packages/dsh-tauri/src/client/register/style.utils.ts
+++ b/packages/dsh-tauri/src/client/register/style.utils.ts
@@ -1,3 +1,52 @@
+const OVERLAY_SELECTORS = '[class^="_mask_"], [class*=" _mask_"]'
+
+const FRAME_SELECTOR = 'div[class$="_frame"]'
+
+const COMPONENT_REGION_SELECTOR = '[data-slot]'
+
+/** 全透明底色的判定:`transparent` 与 `rgba(…, 0)`(含现代浏览器的空格/斜杠分隔)。 */
+function isTransparent(color: string): boolean {
+ const value = color.trim().toLowerCase()
+ if (value === '' || value === 'transparent')
+ return true
+ const match = /^rgba?\(([^)]+)\)$/.exec(value)
+ if (match === null)
+ return false
+ const channels = match[1].split(/[\s,/]+/).filter(Boolean)
+ return channels.length >= 4 && Number.parseFloat(channels[3]) === 0
+}
+
+function isInsideFixed(element: Element): boolean {
+ const parent = element.parentElement
+ return parent !== null && getComputedStyle(parent).position === 'fixed'
+}
+
+/**
+ * 底色实际落在的那一层。
+ *
+ * 0.1.7-rc.2 起官方把 Modal 蒙版的底色从元素搬到 `::after`(同时在那里做入场动画),
+ * 只读元素自身会拿到全透明的 background——这正是「navbar 同步蒙版失效」的成因。
+ */
+function paintedLayer(own: CSSStyleDeclaration, after: CSSStyleDeclaration): CSSStyleDeclaration {
+ return isTransparent(own.backgroundColor) ? after : own
+}
+
+/** 同一页面可能并存多个 `_mask_`(Modal、图片预览、PDF 预览):优先父子层级与底色都成立的弹层蒙版。 */
+function overlayElement(): Element | null {
+ const candidates = [...document.querySelectorAll(OVERLAY_SELECTORS)]
+ const fixed = candidates.filter(isInsideFixed)
+ const pool = fixed.length > 0 ? fixed : candidates
+ return pool.find((element) => {
+ const own = getComputedStyle(element)
+ return !isTransparent(own.backgroundColor) || !isTransparent(getComputedStyle(element, '::after').backgroundColor)
+ }) ?? pool[0] ?? null
+}
+
+function transitionDuration(animationDuration: string): string {
+ const first = animationDuration.split(',')[0]?.trim() ?? ''
+ return first === '' ? '0s' : first
+}
+
export function getSidebarStyle() {
const sidebar = document.querySelector('[data-slot="sidebar"] > div')
if (!sidebar)
@@ -8,22 +57,34 @@ export function getSidebarStyle() {
}
}
+/**
+ * 弹层蒙版的镜像样式。
+ *
+ * 入场动效按官方 `modalEnter` 的时长/缓动镜像成 `background`、`backdrop-filter` 过渡:
+ * 壳层在自己的文档里,拿不到包内 CSS 的 keyframes 名,过渡是等价且不跨文档的实现
+ * (进场淡入、出场瞬时,与官方一致);无动画的代次(≤0.1.7-alpha.1)时长解析为 `0s`。
+ */
export function getOverlayMarkedStyle() {
- const overlay = document.querySelector('div[class^="_mask_"]')
+ const overlay = overlayElement()
if (!overlay)
return null
- const computedStyle = getComputedStyle(overlay)
+ const own = getComputedStyle(overlay)
+ const painted = paintedLayer(own, getComputedStyle(overlay, '::after'))
return {
- inset: computedStyle.inset,
- background: computedStyle.background,
- backdropFilter: computedStyle.backdropFilter,
+ inset: own.inset,
+ background: painted.background,
+ backdropFilter: own.backdropFilter,
bottom: '-1px',
+ transitionProperty: 'background, backdrop-filter',
+ transitionDuration: transitionDuration(painted.animationDuration),
+ transitionTimingFunction: painted.animationTimingFunction || 'ease',
}
}
export function getFrameStyle() {
- const frame = document.querySelector('div[class$="_frame"]')
+ const frames = [...document.querySelectorAll(FRAME_SELECTOR)]
+ const frame = frames.find(candidate => candidate.closest(COMPONENT_REGION_SELECTOR) === null)
if (!frame)
return null
const computedStyle = getComputedStyle(frame)
diff --git a/source/deepseek-harness b/source/deepseek-harness
index c36a83ff..477b4f42 160000
--- a/source/deepseek-harness
+++ b/source/deepseek-harness
@@ -1 +1 @@
-Subproject commit c36a83ff6bb95e3f82cf79f9be7c724270a8aa61
+Subproject commit 477b4f420553e8a52c2fbccc464d7561b239c443
diff --git a/src/layout/components/navbar.tsx b/src/layout/components/navbar.tsx
index 115fd11c..d610b576 100644
--- a/src/layout/components/navbar.tsx
+++ b/src/layout/components/navbar.tsx
@@ -623,7 +623,9 @@ export function Navbar({ sidebarCollapsed = false, onToggleSidebar, onNewChat, o
{/* 纯装饰:把 dsh 页面遮罩(`_mask_`)的底色/毛玻璃镜像到导航栏下沿,让两段观感连续。
dsh 弹模态(如首次进入的 apiKey 对话框)时遮罩铺满,这一层就该盖住导航栏——
- 壳层在 dsh 有模态期间不应可点,不要给它加 `pointer-events-none`。 */}
+ 壳层在 dsh 有模态期间不应可点,不要给它加 `pointer-events-none`。
+ 0.1.7-rc.2 起官方遮罩的底色落在 `::after` 并带入场淡入,镜像层随样式一起带上
+ 同参数的 `background` / `backdrop-filter` 过渡(见 `getOverlayMarkedStyle`)。 */}
<div className="absolute" style={dshStyle.marked || {}} />
{/* 「更新可用」chip:紧跟「帮助」右侧。检测到新版本即出现(安装包此时已在静默下载),
diff --git a/test/navbar-mask-mirror.test.ts b/test/navbar-mask-mirror.test.ts
new file mode 100644
index 00000000..972bc1fe
--- /dev/null
+++ b/test/navbar-mask-mirror.test.ts
@@ -0,0 +1,28 @@
+/**
+ * navbar-mask-mirror.test.ts — 导航栏下沿的「dsh 弹层蒙版镜像」契约。
+ *
+ * 壳层把 iframe 里 dsh 页面的遮罩(`_mask_`)底色/毛玻璃镜像到导航栏下沿,让两段观感
+ * 连续;0.1.7-rc.2 把该底色搬到 `::after`,镜像读取的跨代实现与过渡镜像由
+ * `packages/dsh-tauri` 的 `style.utils.test.ts` 锁住,这里只锁壳层这一半:
+ * 该层必须始终带 iframe 上报的样式、且不得被写成穿透点击(dsh 有模态期间壳层不该可点)。
+ * 与 `menu-restart.test.ts` 同一姿势——node 环境无渲染器,用源码关系断言。
+ */
+import { readFileSync } from 'node:fs'
+import { describe, expect, it } from 'vitest'
+
+const navbarSource = readFileSync(
+ new URL('../src/layout/components/navbar.tsx', import.meta.url),
+ 'utf8',
+)
+
+const markedLayer = navbarSource.match(/<div className="absolute"[^>]*\/>/)?.[0] ?? ''
+
+describe('navbar mask mirror layer', () => {
+ it('镜像层把 iframe 上报的 marked 样式铺在导航栏上', () => {
+ expect(markedLayer).toContain('style={dshStyle.marked || {}}')
+ })
+
+ it('镜像层不在 dsh 弹模态期间放行点击', () => {
+ expect(markedLayer).not.toContain('pointer-events-none')
+ })
+})