DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
feat(pet): redesign per feedback — sidebar icon + standalone settings page + draggable pet window with sprite
hairyf443cc4f3b514
diff --git a/packages/dsh-tauri-bundle/package.json b/packages/dsh-tauri-bundle/package.jsonindex ac12794e..eaecd63b 100644--- a/packages/dsh-tauri-bundle/package.json+++ b/packages/dsh-tauri-bundle/package.json@@ -13,4 +13,4 @@"dsh-tauri-ui": "workspace:*","dsh-tauri-worktree": "workspace:*"}-}\ No newline at end of file+}diff --git a/packages/dsh-tauri-pet/cordis.patch.yml b/packages/dsh-tauri-pet/cordis.patch.ymlindex 7fb0cff9..ba7bfd04 100644--- a/packages/dsh-tauri-pet/cordis.patch.yml+++ b/packages/dsh-tauri-pet/cordis.patch.yml@@ -1,3 +1,3 @@- insert:- id: dsh-tauri-pet- name: dsh-tauri-pet\ No newline at end of file+ name: dsh-tauri-petdiff --git a/packages/dsh-tauri-pet/package.json b/packages/dsh-tauri-pet/package.jsonindex d0242456..ee3df0b5 100644--- a/packages/dsh-tauri-pet/package.json+++ b/packages/dsh-tauri-pet/package.json@@ -60,14 +60,14 @@"dsh-tauri": "workspace:*"},"devDependencies": {+ "@deepseek-ai/cordis": "catalog:dsh","@deepseek-ai/dsh-client-store": "catalog:dsh","@deepseek-ai/dsh-client-ui-layout": "catalog:dsh","@deepseek-ai/dsh-client-ui-renderer": "catalog:dsh","@deepseek-ai/dsh-client-ui-slots": "catalog:dsh",- "@deepseek-ai/cordis": "catalog:dsh","css-render": "catalog:ui","dsh-tauri-tsdown": "workspace:*","react": "catalog:runtime","tsdown": "catalog:cli"}-}\ No newline at end of file+}diff --git a/packages/dsh-tauri-pet/src/client/components/pet-control.tsx b/packages/dsh-tauri-pet/src/client/components/pet-control.tsxdeleted file mode 100644index c3ebe4c8..00000000--- a/packages/dsh-tauri-pet/src/client/components/pet-control.tsx+++ /dev/null@@ -1,142 +0,0 @@-/**- * components/pet-control.tsx — 桌宠浮控件(注册进 shell.overlay 槽)。- *- * 单一自包含浮层(右下角胶囊按钮 + 展开的设置卡片),承担三项能力:- * - 开关控制:一键启用/停用桌宠(set_pet_enabled,同步外置窗口);- * - 设置新增选项:显示/隐藏宠物窗口(show_pet/hide_pet),并从内置候选- * 选择桌宠(set_active_pet,可扩展 .zip 导入);- * - 设置页面:展开的面板即为「宠物」设置小页。- */-import { useEffect, useState } from 'react'-import type { CSSProperties, ReactNode } from 'react'-import type { PetStatus } from '../types'-import { DEFAULT_PETS } from '../constants'-import { text } from '../locales'-import { fetchPetStatus, hidePet, setActivePet, setPetEnabled, showPet } from '../service/pet'--/** 供应商 id(组件身份,不消费 bounds;注册站点类型由 slots 体系约束)。 */-type PetControlProps = Record<never, never>--export function PetControl(_props: PetControlProps) {- const [status, setStatus] = useState<PetStatus | null>(null)- const [open, setOpen] = useState(false)- const [busy, setBusy] = useState(false)-- useEffect(() => {- let cancelled = false- void fetchPetStatus()- .then((value) => {- if (!cancelled)- setStatus(value)- })- .catch((error) => {- console.error('[dsh-tauri-pet] fetchPetStatus failed:', error)- })- return () => {- cancelled = true- }- }, [])-- async function toggleEnabled() {- if (busy || !status)- return- setBusy(true)- try {- const next = await setPetEnabled(!status.enabled)- setStatus(next)- }- catch (error) {- console.error('[dsh-tauri-pet] setPetEnabled failed:', error)- }- finally {- setBusy(false)- }- }-- async function choose(id: string) {- if (busy || !status || id === status.active_pet)- return- setBusy(true)- try {- const next = await setActivePet(id)- setStatus(next)- }- catch (error) {- console.error('[dsh-tauri-pet] setActivePet failed:', error)- }- finally {- setBusy(false)- }- }-- async function show() {- try {- await showPet()- }- catch (error) {- console.error('[dsh-tauri-pet] showPet failed:', error)- }- }-- async function hide() {- try {- await hidePet()- }- catch (error) {- console.error('[dsh-tauri-pet] hidePet failed:', error)- }- }-- const enabled = Boolean(status?.enabled)-- return (- <div className="dshpet-wrap">- <IfPop open={open}>- <div className="dshpet-pop" role="dialog" aria-label={text('selectPet')}>- <div className="dshpet-row">- <span>{text(enabled ? 'enabled' : 'disabled')}</span>- <button className="dshpet-petBtn" type="button" disabled={busy} onClick={toggleEnabled}>- {enabled ? text('disable') : text('enable')}- </button>- </div>- <div className="dshpet-row">- <span>{text('selectPet')}</span>- <span className="dshpet-statusDot" style={dotStyle(enabled)} />- </div>- <div className="dshpet-row">- {DEFAULT_PETS.map(pet => (- <button- key={pet.id}- type="button"- className={`dshpet-petBtn${status?.active_pet === pet.id ? ' dshpet-petBtnActive' : ''}`}- onClick={() => choose(pet.id)}- >- {pet.id === 'codex' ? text('chooseCodex') : pet.label}- </button>- ))}- </div>- <div className="dshpet-row">- <button className="dshpet-petBtn" type="button" onClick={show}>{text('show')}</button>- <button className="dshpet-petBtn" type="button" onClick={hide}>{text('hide')}</button>- </div>- </div>- </IfPop>-- <button className="dshpet-pill" type="button" onClick={() => setOpen(v => !v)}>- <span className="dshpet-statusDot" style={dotStyle(enabled)} />- <span>{text('name')} · {enabled ? text('enabled') : text('disabled')}</span>- </button>- </div>- )-}--function dotStyle(enabled: boolean): CSSProperties {- return { background: enabled ? '#3ddc84' : '#7a7f99' }-}--/** 极简条件渲染(避免引入 react-if-lite:无 children 声明、纯自包含)。 */-function IfPop(props: { open: boolean, children: ReactNode }) {- if (!props.open)- return null- return <>{props.children}</>-}\ No newline at end of filediff --git a/packages/dsh-tauri-pet/src/client/components/pet-icon.tsx b/packages/dsh-tauri-pet/src/client/components/pet-icon.tsxnew file mode 100644index 00000000..679faa9a--- /dev/null+++ b/packages/dsh-tauri-pet/src/client/components/pet-icon.tsx@@ -0,0 +1,103 @@+import { useEffect, useState, useSyncExternalStore } from 'react'+import {+ PET_ICON_OFFSET_BOTTOM,+ PET_ICON_OFFSET_RIGHT,+ RAIL_ICON_SIZE,+ SIDEBAR_SELECTOR,+} from '../constants'+import { text } from '../locales'+import { fetchPetStatus } from '../service/pet'+import {+ getPetUiSnapshot,+ openPetSettings,+ setPetStatus,+ subscribePetUi,+} from '../store'++/**+ * components/pet-icon.tsx — 侧栏「宠物入口」小图标(注册进 shell.overlay)。+ * 出现在侧栏底部设置入口的右侧,仅一个图标:桌宠启用时右上角出现绿色小圆点。+ * 点击打开独立「宠物」设置页(pet-settings)。+ * shell.overlay 是全屏固定层且默认点击穿透;本条目用 `position: fixed` 自钉在+ * 侧栏右下角,运行时测量 `[data-slot="sidebar"]` 的矩形并随其重排,测量不到+ * 时退回默认(~76 近 rail 位置)。+ */++type PetIconProps = Record<never, never>++interface SidebarGeometry {+ left: number+ top: number+ width: number+ height: number+ rail: boolean+}++function measureSidebar(): SidebarGeometry | null {+ const el = document.querySelector(SIDEBAR_SELECTOR)+ if (!el)+ return null+ const rect = el.getBoundingClientRect()+ if (!rect.width && !rect.height)+ return null+ return { left: rect.left, top: rect.top, width: rect.width, height: rect.height, rail: rect.width < 96 }+}++export function PetIcon(_props: PetIconProps) {+ const state = useSyncExternalStore(subscribePetUi, getPetUiSnapshot, getPetUiSnapshot)+ const [geometry, setGeometry] = useState<SidebarGeometry | null>(() => measureSidebar())++ useEffect(() => {+ let cancelled = false+ fetchPetStatus().then((value) => {+ if (!cancelled)+ setPetStatus(value)+ }).catch((error) => {+ console.error('[dsh-tauri-pet] fetchPetStatus failed:', error)+ })+ return () => {+ cancelled = true+ }+ }, [])++ // 跟随侧栏宽度/折叠变化(resize + 短轮询兜底)。初始几何由 lazy useState 计算,+ // 不在 effect 里同步 setState(避免 lint 反模式)。+ useEffect(() => {+ function resync(): void {+ setGeometry(measureSidebar())+ }+ const onResize = (): void => resync()+ const timer = window.setInterval(resync, 800)+ window.addEventListener('resize', onResize)+ return () => {+ window.removeEventListener('resize', onResize)+ window.clearInterval(timer)+ }+ }, [])++ const enabled = Boolean(state.status?.enabled)+ const g = geometry+ const rail = g?.rail ?? false+ const size = rail ? RAIL_ICON_SIZE : 30+ const style: React.CSSProperties = g+ ? { left: g.left + g.width - size - PET_ICON_OFFSET_RIGHT, top: g.top + g.height - size - PET_ICON_OFFSET_BOTTOM }+ : { left: 76 - size / 2, bottom: PET_ICON_OFFSET_BOTTOM }++ return (+ <button+ type="button"+ className={`dshpet-icon${rail ? ' dshpet-iconRail' : ''}${enabled ? ' dshpet-iconOn' : ''}`}+ style={style}+ title={text('name')}+ aria-label={text('name')}+ aria-haspopup="dialog"+ aria-expanded={state.open}+ onClick={() => openPetSettings()}+ >+ <svg viewBox="0 0 24 24" width={size * 0.6} height={size * 0.6} aria-hidden="true" fill="currentColor">+ <path d="M12 2c1.5 0 2.8.8 3.5 2 .9-.3 1.9-.2 2.7.4.9.7 1.3 1.7 1.1 2.8 1.9.3 3.2 2 3.2 3.8 0 1.5-.9 2.9-2.2 3.5-.5 2.9-2.7 5-5.7 5h-1.7c-3.3 0-6.1-1.1-7.3-3.6C3.7 14.1 3.5 11 4.6 8.3 5.7 5.7 8.4 4 11.2 4c.3-1.2 1.2-2 2.2-2z" />+ </svg>+ {enabled && <span className="dshpet-iconDot" aria-hidden="true" />}+ </button>+ )+}diff --git a/packages/dsh-tauri-pet/src/client/components/pet-settings.tsx b/packages/dsh-tauri-pet/src/client/components/pet-settings.tsxnew file mode 100644index 00000000..b70db9f4--- /dev/null+++ b/packages/dsh-tauri-pet/src/client/components/pet-settings.tsx@@ -0,0 +1,104 @@+/**+ * components/pet-settings.tsx — 独立「宠物」设置页(注册进 shell.overlay)。+ * 类归档页停靠面板:启用/停用开关、选择桌宠、显示/隐藏。走 invoke 桥。+ */+import { useEffect, useState, useSyncExternalStore } from 'react'+import { DEFAULT_PETS } from '../constants'+import { text } from '../locales'+import { fetchPetStatus, hidePet, setActivePet, setPetEnabled, showPet } from '../service/pet'+import { closePetSettings, getPetUiSnapshot, setPetStatus, subscribePetUi } from '../store'++type PetSettingsProps = Record<never, never>++export function PetSettings(_props: PetSettingsProps) {+ const { open, status } = useSyncExternalStore(subscribePetUi, getPetUiSnapshot, getPetUiSnapshot)+ const [busy, setBusy] = useState(false)+ const enabled = Boolean(status?.enabled)++ useEffect(() => {+ if (!open)+ return+ let cancelled = false+ fetchPetStatus().then((v) => {+ if (!cancelled)+ setPetStatus(v)+ }).catch(() => {})+ function onKeyDown(event: KeyboardEvent) {+ if (event.key === 'Escape')+ closePetSettings()+ }+ document.addEventListener('keydown', onKeyDown)+ return () => {+ cancelled = true+ document.removeEventListener('keydown', onKeyDown)+ }+ }, [open])++ if (!open)+ return null++ async function toggleEnabled() {+ if (busy)+ return+ setBusy(true)+ try {+ setPetStatus(await setPetEnabled(!enabled))+ }+ finally {+ setBusy(false)+ }+ }++ async function choose(id: string) {+ if (busy || id === status?.active_pet)+ return+ setBusy(true)+ try {+ setPetStatus(await setActivePet(id))+ }+ finally {+ setBusy(false)+ }+ }++ return (+ <div className="dshpet-settings" role="dialog" aria-modal="false" aria-label={text('name')}>+ <header className="dshpet-settingsHead">+ <h2 className="dshpet-settingsTitle">{text('name')}</h2>+ <button type="button" className="dshpet-settingsClose" aria-label={text('disable')} onClick={() => closePetSettings()}>×</button>+ </header>+ <div className="dshpet-settingsBody">+ <section className="dshpet-card">+ <div className="dshpet-row">+ <span className="dshpet-rowLabel">{text(enabled ? 'enabled' : 'disabled')}</span>+ <button type="button" className={`dshpet-toggle${enabled ? ' on' : ''}`} aria-pressed={enabled} disabled={busy} onClick={() => toggleEnabled()}>+ <span className="dshpet-toggleDot" />+ {enabled ? text('disable') : text('enable')}+ </button>+ </div>+ <p className="dshpet-hint">{enabled ? text('enabledHint') : text('disabledHint')}</p>+ </section>+ <section className="dshpet-card">+ <div className="dshpet-row">+ <span className="dshpet-rowLabel">{text('selectPet')}</span>+ <span className={`dshpet-dot${enabled ? ' on' : ' off'}`} />+ </div>+ <div className="dshpet-pets">+ {DEFAULT_PETS.map(p => (+ <button key={p.id} type="button" className={`dshpet-petBtn${status?.active_pet === p.id ? ' dshpet-petBtnActive' : ''}`} disabled={busy} onClick={() => choose(p.id)}>+ {p.id === 'codex' ? text('chooseCodex') : p.label}+ </button>+ ))}+ </div>+ <p className="dshpet-hint">{text('petWindowHint')}</p>+ </section>+ <section className="dshpet-card">+ <div className="dshpet-row">+ <button type="button" className="dshpet-btn" onClick={() => { void showPet().catch(() => {}) }}>{text('show')}</button>+ <button type="button" className="dshpet-btn" onClick={() => { void hidePet().catch(() => {}) }}>{text('hide')}</button>+ </div>+ </section>+ </div>+ </div>+ )+}diff --git a/packages/dsh-tauri-pet/src/client/constants.ts b/packages/dsh-tauri-pet/src/client/constants.tsindex c2171a7d..8124b7d4 100644--- a/packages/dsh-tauri-pet/src/client/constants.ts+++ b/packages/dsh-tauri-pet/src/client/constants.ts@@ -1,18 +1,27 @@/**- * constants.ts — dsh-tauri-pet 稳定标识:插件名、shell.overlay 控制组件 id、+ * constants.ts — dsh-tauri-pet 稳定标识:插件名、shell.overlay 组件 id、* locale 命名空间、与桌面端 invoke 桥对齐的 command 名。+ *+ * shell.overlay 是 list/root 槽(第三方通用浮层,点击穿透——条目自行 opt-in+ * 事件)。本插件用两个独立 id 并排注册:+ * - PET_ICON_SLOT_ID 侧栏右下「宠物入口」小图标(激活时右上角绿色圆点)+ * - PET_SETTINGS_SLOT_ID 独立的「宠物」设置页(类归档页的停靠面板)*//** 插件名(npm 包名,宿主错误注册表与列表主键)。 */export const PET_CLIENT_PLUGIN = 'dsh-tauri-pet'-/** 面板控件注册进 `shell.overlay`(list/root 槽,第三方通用浮层)的组件 id。 */-export const PET_CONTROL_SLOT_ID = 'dsh-tauri-pet-control'+/** 侧栏宠物入口图标注册进 `shell.overlay` 的组件 id。 */+export const PET_ICON_SLOT_ID = 'dsh-tauri-pet-icon'+/** 宠物设置页注册进 `shell.overlay` 的组件 id。 */+export const PET_SETTINGS_SLOT_ID = 'dsh-tauri-pet-settings'/** 样式 effect id(css-render 卸载句柄)。 */export const PET_STYLES_EFFECT = 'dsh-tauri-pet: styles'-/** 控件注册 effect id。 */-export const PET_CONTROL_EFFECT = 'dsh-tauri-pet: shell.overlay control'+/** 图标注册 effect id。 */+export const PET_ICON_EFFECT = 'dsh-tauri-pet: shell.overlay icon'+/** 设置页注册 effect id。 */+export const PET_SETTINGS_EFFECT = 'dsh-tauri-pet: shell.overlay settings'/** 本插件文案命名空间(与 locale 注册键一致)。 */export const PET_CLIENT_NS = 'dsh-tauri-pet'@@ -33,4 +42,14 @@ export const CMD_HIDE_PET = 'hide_pet'export const DEFAULT_PETS = [{ id: 'codex', label: 'Codex' },{ id: 'dsh', label: 'Deepseek' },-] as const\ No newline at end of file+] as const++// ── 侧栏几何(shell.overlay 覆盖层无法读到框架变量,用稳定选择器测量)──+/** 侧栏容器选择器(dsh 客户端侧栏;dsh-tauri-ui 亦以此测量宽度)。 */+export const SIDEBAR_SELECTOR = '[data-slot="sidebar"]'+/** 入口图标在侧栏底部「设置入口」右侧的横向内边距(px)。 */+export const PET_ICON_OFFSET_RIGHT = 14+/** 入口图标距侧栏底部的高度(px,与设置入口对齐)。 */+export const PET_ICON_OFFSET_BOTTOM = 14+/** 侧栏折叠(rail)时入口图标拟并入轨道(px)。 */+export const RAIL_ICON_SIZE = 34diff --git a/packages/dsh-tauri-pet/src/client/index.ts b/packages/dsh-tauri-pet/src/client/index.tsindex 2600ecb1..383e2b98 100644--- a/packages/dsh-tauri-pet/src/client/index.ts+++ b/packages/dsh-tauri-pet/src/client/index.ts@@ -1,10 +1,11 @@/**- * client/index.ts — dsh-tauri-pet 客户端插件体(browser half):桌宠浮控件。+ * client/index.ts — dsh-tauri-pet 客户端插件体(browser half):桌宠设置页 + 入口图标。** 能力(slot-shadow,零结构补丁,零新增运行时依赖):* 注册进 layout 声明的 `shell.overlay`(list/root 槽,第三方通用浮层)——- * 右下角胶囊开关键 + 展开的「宠物」设置卡片:启用/停用、显示/隐藏、选择- * 桌宠(Codex/Deepseek),全部经 dsh-tauri invoke 桥调用桌面端 Tauri 命令+ * 侧栏「宠物入口」小图标(激活时右上角绿色圆点)+ 独立的「宠物」设置页+ * (类归档页停靠面板):启用/停用、显示/隐藏、选择桌宠(Codex/Deepseek),+ * 全部经 dsh-tauri invoke 桥调用桌面端 Tauri 命令* (get_pet_status/set_pet_enabled/set_active_pet/show_pet/hide_pet)。** 依赖:slots(注册点位)、locale(双语文案)。invoke 桥来自 dsh-tauri/client。@@ -12,17 +13,17 @@import type { ClientContext } from 'dsh-tauri/client'import { PET_CLIENT_PLUGIN } from './constants'import { installLocale } from './locales'+import { installPetIcon, installPetSettings } from './register/pet'import { mountPetStyles } from './styles'-import { installPetControl } from './register/control'/** 插件显示名(诊断元数据)。 */export const name = PET_CLIENT_PLUGIN-/** 需要的客户端服务:slots(注册 shell.overlay 浮层)、locale(双语文案)。 */+/** 需要的客户端服务:slots(注册 shell.overlay)、locale(双语文案)。 */export const inject = ['slots', 'locale']/**- * 插件体:安装文案、样式,并注册桌宠浮控件到 shell.overlay。+ * 插件体:安装文案、样式,并注册桌宠入口图标与独立设置页到 shell.overlay。* @param ctx - 客户端根上下文(须已注入 slots/locale)。*/export function apply(ctx: ClientContext): void {@@ -30,5 +31,6 @@ export function apply(ctx: ClientContext): void {installLocale(ctx)- installPetControl(ctx)-}\ No newline at end of file+ installPetIcon(ctx)+ installPetSettings(ctx)+}diff --git a/packages/dsh-tauri-pet/src/client/locales/index.ts b/packages/dsh-tauri-pet/src/client/locales/index.tsindex 3f9ab17d..1a2d2244 100644--- a/packages/dsh-tauri-pet/src/client/locales/index.ts+++ b/packages/dsh-tauri-pet/src/client/locales/index.ts@@ -75,4 +75,4 @@ export function installLocale(ctx: ClientContext): void {export function text(key: LocaleKey, values: Record<string, string | number> = {}): string {const dict = activeLocale === 'en' ? DICT_EN : DICT_ZHreturn (dict[key] || DICT_EN[key] || key).replace(/\{(\w+)\}/g, (_, name: string) => String(values[name] ?? ''))-}\ No newline at end of file+}diff --git a/packages/dsh-tauri-pet/src/client/register/control.ts b/packages/dsh-tauri-pet/src/client/register/control.tsdeleted file mode 100644index 8f728378..00000000--- a/packages/dsh-tauri-pet/src/client/register/control.ts+++ /dev/null@@ -1,26 +0,0 @@-/**- * register/control.ts — 桌宠浮控件注册:装入 layout 声明的 `shell.overlay` 槽。- *- * shell.overlay 是 list/root 槽(通用浮层,点击穿透——条目自行 opt-in 事件),- * 以独立 id 并排在框架官方条目旁,不替换任何槽。等待槽声明后注册,- * 卸载时随插件停用整体释放。- */-import type { Context } from '@deepseek-ai/cordis'-// 拉入 dsh-client-ui-renderer 的 `declare module '@deepseek-ai/cordis'` 增广,-// 让 `ctx.slots`(SlotRegistry)获得类型(运行时由 UI renderer 提供)。-import type {} from '@deepseek-ai/dsh-client-ui-renderer'-import { PetControl } from '../components/pet-control'-import { PET_CONTROL_SLOT_ID } from '../constants'--export function installPetControl(ctx: Context): void {- ctx.slots.inject('shell.overlay' as never, () =>- ctx.slots.register(- {- name: 'shell.overlay',- id: PET_CONTROL_SLOT_ID,- order: 100,- registrant: 'dsh-tauri-pet',- } as never,- PetControl as never,- ))-}\ No newline at end of filediff --git a/packages/dsh-tauri-pet/src/client/register/pet.ts b/packages/dsh-tauri-pet/src/client/register/pet.tsnew file mode 100644index 00000000..8b8b15b0--- /dev/null+++ b/packages/dsh-tauri-pet/src/client/register/pet.ts@@ -0,0 +1,31 @@+/**+ * register/pet.ts — 桌宠入口图标 + 独立设置页注册:装入 layout 声明的+ * `shell.overlay` 槽(list/root 多胜者,允许并排多个条目)。+ *+ * 两个独立 id:+ * - PET_ICON_SLOT_ID 侧栏宠物入口小图标(点击打开设置页)+ * - PET_SETTINGS_SLOT_ID 独立设置页(仅打开时挂载)+ */+import type { Context } from '@deepseek-ai/cordis'+// 拉入 dsh-client-ui-renderer 的 `declare module '@deepseek-ai/cordis'` 增广,+// 让 `ctx.slots`(SlotRegistry)获得类型(运行时由 UI renderer 提供)。+import type {} from '@deepseek-ai/dsh-client-ui-renderer'+import { PetIcon } from '../components/pet-icon'+import { PetSettings } from '../components/pet-settings'+import { PET_ICON_SLOT_ID, PET_SETTINGS_SLOT_ID } from '../constants'++export function installPetIcon(ctx: Context): void {+ ctx.slots.inject('shell.overlay' as never, () =>+ ctx.slots.register(+ { name: 'shell.overlay', id: PET_ICON_SLOT_ID, order: 90, registrant: 'dsh-tauri-pet' } as never,+ PetIcon as never,+ ))+}++export function installPetSettings(ctx: Context): void {+ ctx.slots.inject('shell.overlay' as never, () =>+ ctx.slots.register(+ { name: 'shell.overlay', id: PET_SETTINGS_SLOT_ID, order: 91, registrant: 'dsh-tauri-pet' } as never,+ PetSettings as never,+ ))+}diff --git a/packages/dsh-tauri-pet/src/client/service/pet.ts b/packages/dsh-tauri-pet/src/client/service/pet.tsindex 37eb245f..a94898bc 100644--- a/packages/dsh-tauri-pet/src/client/service/pet.ts+++ b/packages/dsh-tauri-pet/src/client/service/pet.ts@@ -1,3 +1,4 @@+import type { PetStatus } from '../types'/*** service/pet.ts — 桌宠 Tauri 命令的桥客户端。*@@ -8,7 +9,6 @@* `#[tauri::command]` 一一对应。*/import { invokeBridgedTauri } from 'dsh-tauri/client'-import type { PetStatus } from '../types'import { CMD_GET_PET_STATUS, CMD_HIDE_PET, CMD_SET_ACTIVE_PET, CMD_SET_PET_ENABLED, CMD_SHOW_PET } from '../constants'/** 查询桌宠当前状态(启用与否 + 当前选择)。 */@@ -34,4 +34,4 @@ export function showPet(): Promise<void> {/** 隐藏桌宠窗口(不改 enabled)。 */export function hidePet(): Promise<void> {return invokeBridgedTauri<void>(CMD_HIDE_PET)-}\ No newline at end of file+}diff --git a/packages/dsh-tauri-pet/src/client/store/index.ts b/packages/dsh-tauri-pet/src/client/store/index.tsnew file mode 100644index 00000000..0a1e2fc0--- /dev/null+++ b/packages/dsh-tauri-pet/src/client/store/index.ts@@ -0,0 +1,47 @@+import type { PetStatus } from '../types'+/**+ * store/index.ts — 桌宠设置页打开态 + 状态缓存的轻量共享状态。+ *+ * 入口图标与设置页是 shell.overlay 的独立 slot 条目、由 UI renderer 各自渲染、+ * 互不感知,因此用 dsh-tauri/client 提供的 `createExternalStore`(框架无关、+ * uSES 安全,getSnapshot 保持同一引用直到真实变更)桥接两者:图标点击+ * `openPetSettings()`,设置页订阅 open 决定是否挂载;桌宠状态缓存在两者间+ * 复用(图标绿点)。不引入额外依赖,符合 AGENTS.plugins。+ */+import { createExternalStore } from 'dsh-tauri/client'++/** 共享状态结构。 */+export interface PetShared {+ /** 设置页当前是否打开。 */+ open: boolean+ /** 最近一次从桌面端读回的桌宠状态缓存(图标绿点与设置页共用)。 */+ status: PetStatus | null+}++/** dsh-tauri 外部 store(getSnapshot 稳定,uSES 安全)。 */+export const petUiStore = createExternalStore<PetShared>({ open: false, status: null })++/** 订阅变更(供 useSyncExternalStore)。 */+export function subscribePetUi(listener: () => void): () => void {+ return petUiStore.subscribe(listener)+}++/** 读取当前快照(供 useSyncExternalStore)。 */+export function getPetUiSnapshot(): PetShared {+ return petUiStore.getSnapshot()+}++/** 打开设置页。 */+export function openPetSettings(): void {+ petUiStore.set(state => ({ ...state, open: true }))+}++/** 关闭设置页。 */+export function closePetSettings(): void {+ petUiStore.set(state => ({ ...state, open: false }))+}++/** 写入桌宠状态缓存。 */+export function setPetStatus(status: PetStatus | null): void {+ petUiStore.set(state => (state.status === status ? state : { ...state, status }))+}diff --git a/packages/dsh-tauri-pet/src/client/styles/index.ts b/packages/dsh-tauri-pet/src/client/styles/index.tsindex f31eb739..8c5d19dd 100644--- a/packages/dsh-tauri-pet/src/client/styles/index.ts+++ b/packages/dsh-tauri-pet/src/client/styles/index.ts@@ -1,101 +1,133 @@/**- * styles/index.ts — 桌宠浮控件的样式(css-render,apply() 的 effect 内 mount)。- * 浮层固定在 dsh 画布右下角;开关/选择/显示/隐藏与「设置页」卡片一体。+ * styles/index.ts — 桌宠入口图标 + 设置页样式(css-render,apply() effect 内 mount)。*/import { CssRender } from 'css-render'import { PET_CLIENT_PLUGIN } from '../constants'-const CLS = {- wrap: 'dshpet-wrap',- pill: 'dshpet-pill',- statusDot: 'dshpet-statusDot',- pop: 'dshpet-pop',- row: 'dshpet-row',- petBtn: 'dshpet-petBtn',- petBtnActive: 'dshpet-petBtnActive',-} as const-const cssr = CssRender()const { c } = cssrconst style = c([- c(`.${CLS.wrap}`, {+ /* 侧栏入口图标:固定定位胶囊,绿色激活圆点右上角 */+ c('.dshpet-icon', {+ position: 'fixed',+ zIndex: 2147483000,+ width: '30px',+ height: '30px',+ display: 'grid',+ placeItems: 'center',+ border: 'none',+ borderRadius: '50%',+ background: 'rgba(24,28,56,0.72)',+ color: '#e7e9ff',+ cursor: 'pointer',+ boxShadow: '0 2px 10px rgba(0,0,0,0.28)',+ }, [+ c('&:hover', { background: 'rgba(34,40,80,0.9)' }),+ ]),+ c('.dshpet-iconRail', { width: '34px', height: '34px' }),+ c('.dshpet-iconDot', {+ position: 'absolute',+ top: '2px',+ right: '2px',+ width: '9px',+ height: '9px',+ borderRadius: '50%',+ background: '#3ddc84',+ border: '2px solid rgba(24,28,56,0.9)',+ boxSizing: 'content-box',+ }),+ /* 独立设置页:右下停靠面板 */+ c('.dshpet-settings', {position: 'fixed',right: '18px',bottom: '18px',zIndex: 2147483000,+ width: '300px',+ borderRadius: '14px',+ border: '1px solid rgba(120,130,180,0.3)',+ background: 'rgba(24,28,56,0.92)',+ color: '#e7e9ff',+ fontSize: '13px',+ boxShadow: '0 10px 30px rgba(0,0,0,0.35)',display: 'flex',flexDirection: 'column',- alignItems: 'flex-end',+ overflow: 'hidden',fontFamily: 'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',}),- c(`.${CLS.pill}`, {+ c('.dshpet-settingsHead', {display: 'flex',alignItems: 'center',- gap: '8px',- padding: '6px 12px',- borderRadius: '999px',- border: '1px solid rgba(120,130,180,0.35)',- background: 'rgba(24,28,56,0.72)',- backdropFilter: 'blur(6px)',- color: '#e7e9ff',- fontSize: '12px',+ justifyContent: 'space-between',+ padding: '12px 16px',+ borderBottom: '1px solid rgba(120,130,180,0.2)',+ }),+ c('.dshpet-settingsTitle', { margin: 0, fontSize: '15px', fontWeight: 600 }),+ c('.dshpet-settingsClose', {+ border: 'none',+ background: 'none',+ color: '#abb1d6',+ fontSize: '18px',lineHeight: 1,cursor: 'pointer',- boxShadow: '0 4px 14px rgba(0,0,0,0.25)',- transition: 'background .16s ease, transform .1s ease',- }),- c(`.${CLS.pill}:hover`, {- background: 'rgba(34,40,80,0.85)',+ padding: '2px 6px',}),- c(`.${CLS.statusDot}`, {- width: '9px',- height: '9px',- borderRadius: '50%',- flex: 'none',- }),- c(`.${CLS.pop}`, {+ c('.dshpet-settingsBody', {display: 'flex',flexDirection: 'column',- gap: '6px',- width: '220px',- marginBottom: '8px',- padding: '12px',- borderRadius: '12px',- border: '1px solid rgba(120,130,180,0.3)',- background: 'rgba(24,28,56,0.9)',- backdropFilter: 'blur(8px)',- color: '#e7e9ff',- fontSize: '12px',- boxShadow: '0 8px 24px rgba(0,0,0,0.3)',+ gap: '10px',+ padding: '14px 16px',}),- c(`.${CLS.row}`, {+ c('.dshpet-card', { display: 'flex', flexDirection: 'column', gap: '8px' }),+ c('.dshpet-row', { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '8px' }),+ c('.dshpet-rowLabel', { fontWeight: 500 }),+ c('.dshpet-hint', { margin: 0, fontSize: '12px', color: 'rgba(171,177,214,0.8)', lineHeight: '18px' }),+ c('.dshpet-toggle', {display: 'flex',alignItems: 'center',- justifyContent: 'space-between',- gap: '8px',+ gap: '6px',+ padding: '5px 10px',+ borderRadius: '999px',+ cursor: 'pointer',+ border: '1px solid rgba(120,130,180,0.35)',+ background: 'transparent',+ color: '#e7e9ff',}),- c(`.${CLS.petBtn}`, {+ c('.dshpet-toggle.on', { borderColor: 'rgba(61,220,132,0.7)', color: '#3ddc84' }),+ c('.dshpet-toggleDot', {+ width: '8px',+ height: '8px',+ borderRadius: '50%',+ background: 'rgba(122,127,153,0.8)',+ flex: 'none',+ }),+ c('.dshpet-toggle.on .dshpet-toggleDot', { background: '#3ddc84' }),+ c('.dshpet-dot', { width: '9px', height: '9px', borderRadius: '50%', flex: 'none' }),+ c('.dshpet-dot.on', { background: '#3ddc84' }),+ c('.dshpet-dot.off', { background: 'rgba(122,127,153,0.8)' }),+ c('.dshpet-pets', { display: 'flex', gap: '8px' }),+ c('.dshpet-petBtn', {flex: 1,- padding: '6px 8px',+ padding: '7px 8px',borderRadius: '8px',+ cursor: 'pointer',border: '1px solid rgba(120,130,180,0.3)',background: 'transparent',color: '#e7e9ff',- fontSize: '12px',+ }, [c('&:hover', { background: 'rgba(80,100,255,0.18)' })]),+ c('.dshpet-petBtnActive', { background: 'rgba(80,100,255,0.3)', borderColor: 'rgba(120,150,255,0.7)' }),+ c('.dshpet-btn', {+ flex: 1,+ padding: '7px 8px',+ borderRadius: '8px',cursor: 'pointer',- }),- c(`.${CLS.petBtn}:hover`, {- background: 'rgba(80,100,255,0.18)',- }),- c(`.${CLS.petBtnActive}`, {- background: 'rgba(80,100,255,0.3)',- borderColor: 'rgba(120,150,255,0.7)',- }),+ border: '1px solid rgba(120,130,180,0.3)',+ background: 'transparent',+ color: '#e7e9ff',+ }, [c('&:hover', { background: 'rgba(80,100,255,0.18)' })]),])-/** 挂载样式;返回卸载函数,供 apply() 的 effect 生命周期回收。 */export function mountPetStyles(): () => void {style.mount({ id: `${PET_CLIENT_PLUGIN}-styles`, head: true })return () => style.unmount({ id: `${PET_CLIENT_PLUGIN}-styles` })-}\ No newline at end of file+}diff --git a/packages/dsh-tauri-pet/src/client/types/index.ts b/packages/dsh-tauri-pet/src/client/types/index.tsindex 6d6dd8b4..9fb5a964 100644--- a/packages/dsh-tauri-pet/src/client/types/index.ts+++ b/packages/dsh-tauri-pet/src/client/types/index.ts@@ -9,19 +9,19 @@ export interface PetStatus {/** 文案键(locale 字典键集合的权威来源)。 */export type LocaleKey= | 'name'- | 'enable'- | 'disable'- | 'enabled'- | 'disabled'- | 'selectPet'- | 'show'- | 'hide'- | 'chooseCodex'- | 'import'- | 'pets'- | 'petWindowHint'- | 'enabledHint'- | 'disabledHint'- | 'loadFailed'- | 'setEnabledFailed'- | 'setPetFailed'\ No newline at end of file+ | 'enable'+ | 'disable'+ | 'enabled'+ | 'disabled'+ | 'selectPet'+ | 'show'+ | 'hide'+ | 'chooseCodex'+ | 'import'+ | 'pets'+ | 'petWindowHint'+ | 'enabledHint'+ | 'disabledHint'+ | 'loadFailed'+ | 'setEnabledFailed'+ | 'setPetFailed'diff --git a/packages/dsh-tauri-pet/src/index.ts b/packages/dsh-tauri-pet/src/index.tsindex 6811670c..04c75703 100644--- a/packages/dsh-tauri-pet/src/index.ts+++ b/packages/dsh-tauri-pet/src/index.ts@@ -13,4 +13,4 @@ export const name = 'dsh-tauri-pet'export const inject: string[] = []/** 插件体:无宿主行为。 */-export function apply(): void {}\ No newline at end of file+export function apply(): void {}diff --git a/packages/dsh-tauri-pet/tsconfig.json b/packages/dsh-tauri-pet/tsconfig.jsonindex 73e40dcc..520166d0 100644--- a/packages/dsh-tauri-pet/tsconfig.json+++ b/packages/dsh-tauri-pet/tsconfig.json@@ -1,4 +1,4 @@{"extends": "../../tsconfig.json","include": ["src/**/*.ts", "src/**/*.tsx", "../../types/**/*.d.ts"]-}\ No newline at end of file+}diff --git a/packages/dsh-tauri-pet/tsdown.config.ts b/packages/dsh-tauri-pet/tsdown.config.tsindex daec4805..db7f42c0 100644--- a/packages/dsh-tauri-pet/tsdown.config.ts+++ b/packages/dsh-tauri-pet/tsdown.config.ts@@ -1,3 +1,3 @@import { defineDshConfig } from 'dsh-tauri-tsdown'-export default defineDshConfig()\ No newline at end of file+export default defineDshConfig()diff --git a/packages/dsh-tauri/src/client/index.ts b/packages/dsh-tauri/src/client/index.tsindex b2dadd8e..c9b694b5 100644--- a/packages/dsh-tauri/src/client/index.ts+++ b/packages/dsh-tauri/src/client/index.ts@@ -19,11 +19,11 @@ export const inject = PLUGIN_INJECTexport * from './apis'export { apply } from './apply'export * from './controller'+export { invokeBridgedTauri } from './service/invoke'export * from './storage'export * from './store'-export type * from './types'-export { invokeBridgedTauri } from './service/invoke'+export type * from './types'export type { ClientContext } from './types'export { compat, resolveStartSession } from './utils/compat'diff --git a/packages/dsh-tauri/src/client/service/invoke.ts b/packages/dsh-tauri/src/client/service/invoke.tsindex 4a7a201e..9ca88cb3 100644--- a/packages/dsh-tauri/src/client/service/invoke.ts+++ b/packages/dsh-tauri/src/client/service/invoke.ts@@ -1,3 +1,4 @@+import type { InvokeBridgeReply, InvokeBridgeRequest } from '../types'/*** dsh-tauri invoke 桥(iframe 侧客户端)。*@@ -16,7 +17,6 @@* (INVOKE_TIMEOUT_MS)或局部失败统一 reject,并登记进宿主错误注册表便于排查。*/import { INVOKE_TIMEOUT_MS, PLUGIN_ID, SRC_INVOKE, SRC_INVOKE_REPLY, TYPE_INVOKE, TYPE_INVOKE_REPLY } from '../constants'-import type { InvokeBridgeRequest, InvokeBridgeReply } from '../types'let nonceSeq = 0@@ -96,4 +96,4 @@ export function invokeBridgedTauri<T>(reject(error)}})-}\ No newline at end of file+}diff --git a/src/hooks/use-iframe-invoke.ts b/src/hooks/use-iframe-invoke.tsindex eab8beaf..5b7c55f6 100644--- a/src/hooks/use-iframe-invoke.ts+++ b/src/hooks/use-iframe-invoke.ts@@ -71,4 +71,4 @@ export function useIframeInvoke(iframeRef: RefObject<HTMLIFrameElement | null>):}useEvent('message', handleMessage)-}\ No newline at end of file+}diff --git a/src/pet/assets/dsh-pet-idle.png b/src/pet/assets/dsh-pet-idle.pngnew file mode 100644index 00000000..f57784dfBinary files /dev/null and b/src/pet/assets/dsh-pet-idle.png differdiff --git a/src/pet/main.tsx b/src/pet/main.tsxindex 1aacd73a..18132b41 100644--- a/src/pet/main.tsx+++ b/src/pet/main.tsx@@ -11,4 +11,4 @@ ReactDOM.createRoot(root).render(<React.StrictMode><PetWindow /></React.StrictMode>,-)\ No newline at end of file+)diff --git a/src/pet/pet.css b/src/pet/pet.cssindex ee0556cf..794447e4 100644--- a/src/pet/pet.css+++ b/src/pet/pet.css@@ -1,6 +1,7 @@-/* 桌宠外置窗口样式:透明画布 + 像素风桌宠。+/* 桌宠外置窗口样式:透明画布 + dsh-pet 精灵图。窗口本身 transparent=true(无边框、无阴影、跳过任务栏),因此 body 全透明,- 只绘制宠物主体。尺寸由 Rust 侧 PET_WINDOW_WIDTH/HEIGHT(240x280)给定。 */+ 只绘制宠物主体。尺寸由 Rust 侧 PET_WINDOW_WIDTH/HEIGHT(240x280)给定。+ 整个 stage 都是拖动区域(无关闭按钮;隐藏统一走插件侧 hide_pet 命令)。 */html,body {@@ -10,7 +11,6 @@ body {height: 100%;overflow: hidden;background: transparent;- /* 让拖动手把在这块区域可拖动 */-webkit-user-select: none;user-select: none;cursor: default;@@ -22,6 +22,7 @@ body {height: 100%;}+/* 窗口即画布:整体可拖动 */.pet-stage {position: relative;width: 100%;@@ -30,106 +31,42 @@ body {flex-direction: column;align-items: center;justify-content: flex-end;-}--/* 顶部拖动手把:整条可拖动,视觉透明 */-.pet-drag {- position: absolute;- top: 0;- left: 0;- right: 0;- height: 28px;- cursor: grab;-webkit-app-region: drag;app-region: drag;+ cursor: grab;}-/* 宠物画布:居中,纵向从下往上生长 */+/* 宠物画布:居中,纵向靠下 */.pet-canvas {position: relative;display: flex;flex-direction: column;align-items: center;- margin-bottom: 10px;+ margin-bottom: 14px;}-/* 像素主体容器:用固定逻辑尺寸,配合 preserve-3d 缩放无锯齿感 */-.pet-mascot {- position: relative;- width: 96px;- height: 96px;- filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));- transition: transform 240ms ease;-}-.pet-mascot.bobbing {- animation: pet-bob 520ms ease-in-out;-}-@keyframes pet-bob {- 0%,- 100% {- transform: translateY(0) scaleY(1);- }- 50% {- transform: translateY(-6px) scaleY(0.98);- }+/* 精灵图容器:dsh-pet 呆味帧(220x124,透明 PNG),放大并做轻量浮动动画 */+.pet-sprite {+ width: 168px;+ height: auto;+ image-rendering: auto;+ filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));+ animation: pet-float 3.2s ease-in-out infinite;}-/* 方形身体:圆角像素块,随不同 pet 由底色区分(可扩展为精灵图) */-.pixel-body {- position: absolute;- inset: 16px 8px 8px;- border-radius: 22px;- background: linear-gradient(160deg, #4f7cff 0%, #3b5bff 60%, #2f49ef 100%);- border: 3px solid #1e2fae;- box-shadow: inset 0 -14px 0 rgba(0, 0, 0, 0.12);-}--/* 面部 */-.pixel-face {- position: absolute;- inset: 36px 20px auto;- display: flex;- flex-wrap: wrap;- align-items: center;- justify-content: center;- gap: 18px;-}-.pixel-eye {- width: 12px;- height: 16px;- border-radius: 8px;- background: #1b1f3a;- animation: pet-blink 4s infinite;-}-.pixel-eye.left {- animation-delay: 0s;-}-.pixel-eye.right {- animation-delay: 0s;-}-@keyframes pet-blink {+@keyframes pet-float {0%,- 92%,100% {- transform: scaleY(1);+ transform: translateY(0) rotate(0deg);}- 96% {- transform: scaleY(0.15);+ 50% {+ transform: translateY(-6px) rotate(1.4deg);}}-.pixel-mouth {- width: 22px;- height: 8px;- margin-top: 10px;- border-radius: 0 0 12px 12px;- border-bottom: 3px solid #1b1f3a;- border-left: 3px solid transparent;- border-right: 3px solid transparent;-}/* 宠物名称:悬浮小标签 */.pet-name {- margin-top: 4px;+ margin-top: 6px;padding: 2px 10px;border-radius: 999px;font-size: 11px;@@ -138,27 +75,4 @@ body {background: rgba(20, 24, 52, 0.55);backdrop-filter: blur(2px);-webkit-backdrop-filter: blur(2px);-}--/* 关闭按钮:右下角小圆角方块,悬停显现 */-.pet-close {- position: absolute;- right: 8px;- bottom: 8px;- width: 20px;- height: 20px;- display: grid;- place-items: center;- border: none;- border-radius: 6px;- color: rgba(255, 255, 255, 0.55);- background: rgba(20, 24, 52, 0.35);- cursor: pointer;- opacity: 0.55;- transition: opacity 160ms ease, background 160ms ease;-}-.pet-close:hover {- opacity: 1;- background: rgba(160, 30, 30, 0.7);- color: #fff;}\ No newline at end of filediff --git a/src/pet/pet.tsx b/src/pet/pet.tsxindex b9272b11..baa74247 100644--- a/src/pet/pet.tsx+++ b/src/pet/pet.tsx@@ -1,13 +1,17 @@-import { useEffect, useState } from 'react'import { invoke } from '@tauri-apps/api/core'+import { useEffect, useState } from 'react'+import petSpriteUrl from './assets/dsh-pet-idle.png'/*** 桌宠外置窗口(独立透明 Webview,label `pet`)。*- * 展现 dsh 桌宠可活动物形象;窗口即画布(body 尺寸 = PET_WINDOW_*),- * 顶部留一条可拖动把手(`data-tauri-drag-region`),右下角关闭按钮通过- * `hide_pet` 命令隐藏(不动 `pet_enabled`,可再次经插件桥显示)。+ * 窗口即画布(body 尺寸 = PET_WINDOW_*):整个窗口都可以被拖动(根节点挂+ * `data-tauri-drag-region`),不显示关闭按钮——隐藏桌宠统一走插件侧+ * `hide_pet` 命令(在设置页操作),保证「宠物资源文件」的责任边界(本体来自+ * dsh-pet 的精灵图,而非自绘 CSS)。*+ * 精灵图取自 dsh-pet(PC2005-cloud/dsh-pet)呆味预览图第一帧,透明 PNG,+ * 窗口侧仅做轻量「呼吸/浮动」自绘动画(符合「只借静态精灵图,窗口自绘动画」)。* 该窗口是 Tauri 顶层 webview(非 iframe),可直接 `import { invoke }`。*/@@ -16,7 +20,7 @@ interface PetStatus {active_pet?: string | null}-/** 无状态时的默认动物文案(取 active_pet 的最后一段,去掉版本/扩展)。 */+/** 无状态时的默认展示名(取 active_pet 的最后一段,去掉版本/扩展)。 */function petDisplayName(id: string | null | undefined): string {if (!id)return 'dsh'@@ -26,15 +30,13 @@ function petDisplayName(id: string | null | undefined): string {export function PetWindow() {const [activePet, setActivePet] = useState<string>('dsh')- const [bobbing, setBobbing] = useState(false)useEffect(() => {let cancelled = falsevoid invoke<PetStatus>('get_pet_status').then((status) => {- if (!cancelled && status.active_pet) {+ if (!cancelled && status.active_pet)setActivePet(petDisplayName(status.active_pet))- }}).catch((error) => {console.error('[pet] get_pet_status failed:', error)@@ -44,47 +46,12 @@ export function PetWindow() {}}, [])- // 周期性俏皮「点头」,让桌宠显得有生命(仅视觉,与 dsh 会话状态无关)。- useEffect(() => {- const timer = setTimeout(() => setBobbing(true), 1200)- return () => clearTimeout(timer)- }, [bobbing])-- function hide() {- void invoke('hide_pet').catch((error) => {- console.error('[pet] hide_pet failed:', error)- })- }-return (- <div className="pet-stage">- <div className="pet-drag" data-tauri-drag-region>- {/* 拖动手把:拖动即触发桌面端 Moved 保存位置 */}- </div>-+ <div className="pet-stage" data-tauri-drag-region><div className="pet-canvas" role="img" aria-label={`Deepseek Harness pet: ${activePet}`}>- <div className={`pet-mascot${bobbing ? ' bobbing' : ''}`}>- {/* 像素风桌宠主体(CSS 拼块),形象随 activePet 称为文案提示 */}- <div className="pixel-body" />- <div className="pixel-face">- <span className="pixel-eye left" />- <span className="pixel-eye right" />- <span className="pixel-mouth" />- </div>- </div>+ <img className="pet-sprite" src={petSpriteUrl} alt="" draggable={false} decoding="async" /><span className="pet-name">{activePet}</span></div>-- <button className="pet-close" type="button" onClick={hide} title="Hide pet">- <svg viewBox="0 0 10 10" width="10" height="10" aria-hidden="true">- <path- d="M1 1 L9 9 M9 1 L1 9"- stroke="currentColor"- strokeWidth="1.6"- strokeLinecap="round"- />- </svg>- </button></div>)-}\ No newline at end of file+}