DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
refactor(shell): 全面接入 reause,桌面桥收敛到插件侧
hairyf4e1945972a0f
diff --git a/docs/AGENTS.desktop.md b/docs/AGENTS.desktop.mdindex 55648a9f..539146d5 100644--- a/docs/AGENTS.desktop.md+++ b/docs/AGENTS.desktop.md@@ -6,7 +6,7 @@ DeepSeek Harness desktop (Tauri 2 + React 19), embeds the Harness UI served at `- **数据隔离(核心共用、数据不共用)**:node/`dependencies/dsh`/`dependencies/pnpm` 为共用核心(AppData);debug 构建的 `$DSH_HOME` 默认为 `~/.dsh.dev`(`config::runtime::get_dsh_data_path` 用 `cfg!(debug_assertions)` 区分)且 store 用独立文件 `.store.dev.dat`(`config::setting::store_dat_file_name`),避免开发版与生产版会话/档案/端口状态互相污染,也防止 dev 版热重启把 release 的服务进程杀掉(`service/workflow::terminate_stale_harness_processes` 在 debug 下为 no-op,改由 `.dsh.dev/.harness.pid` 精确回收)。debug 构建不迁移旧数据(`service/migrate`)、不注册/注销 PATH、不写烘焙 DSH_HOME 的 `dsh` shim(`service/cli`)。- **Windows 极简模式**:预装插件流程(`service/plugin`)对 Windows 用户列出「修复」项(`dsh-win-terminal-inspector`,黄色 chip 默认勾选),确认后 `dsh plugin add github:clearkurt/dsh-win-terminal-inspector` 从 GitHub 安装(桌面端**不内置**插件源码);随后 `service/workflow/win_inspector.rs`(仅 Windows,幂等)写入 profile `cordis.patch.yml` 挂载行并创作 `$DSH_HOME/.agent-presets/minimal-win/` 用户 preset(Git Bash + danger-full-access,因为 agent preset 组成不受 profile patch 管辖)。- **内置插件 host 依赖边界**:`packages/*/src/host/` 运行在独立的 `resources/node_modules` 中,禁止直接静态引用任何 `@deepseek-ai/*` 运行时包(包括 `import`、`export ... from` 和 `require`);必须通过宿主上下文的 `loader.import()` 解析 DSH-owned 模块,并按需处理 `loader.unwrapExports()` 的导出形状。`@deepseek-ai/*` 仅可作为 host 的 type-only import,不能产生运行时依赖。-- **桌宠(`src/pet` + `dsh-tauri-pet`)**:渲染整体交给 `dsh-pet-component` 的 `<Pet>`(外部 npm 包,内部用 `@reause/core`),本仓库只保留设置状态、会话气泡聚合、原生窗口拖拽与命中穿透。预设宠物**不下载不安装**——`src-tauri/resources/preset-pets.json` 只登记远端素材地址与渲染参数(`config` / `uri` / `ext` / `kind` / `size`),pet 窗口直连远端播放并落 IndexedDB 缓存;`src/pet/main.tsx` 把全局 `fetch` 换成 `@tauri-apps/plugin-http` 的实现(其余命令与媒体元素不变),绕开 githubusercontent 的 CORS。macOS 用清单里 `uri.mac` / `ext.mac` 的 HEVC-alpha `.mov`(WKWebView 不认 VP9-alpha)。+- **桌宠(`src/pet` + `dsh-tauri-pet`)**:渲染整体交给 `dsh-pet-component` 的 `<Pet>`(外部 npm 包,内部用 `@reause/core`),本仓库只保留设置状态(`src/pet/hooks`)、会话气泡聚合、原生窗口拖拽(`src/hooks/use-window-draggable`)与命中穿透(`src/hooks/use-omit-ignore-cursor-events`),提示 UI 为 `src/ui/pet/hint.tsx` 的 `<Hint>`。预设宠物**不下载不安装**——`src-tauri/resources/preset-pets.json` 只登记远端素材地址与渲染参数(`config` / `uri` / `ext` / `kind` / `size`),pet 窗口直连远端播放并落 IndexedDB 缓存;`src/pet/main.tsx` 把全局 `fetch` 换成 `@tauri-apps/plugin-http` 的实现(其余命令与媒体元素不变),绕开 githubusercontent 的 CORS。macOS 用清单里 `uri.mac` / `ext.mac` 的 HEVC-alpha `.mov`(WKWebView 不认 VP9-alpha)。- Prioritize using customized components from src/components, hero-ui.- This will help minimize the need for writing custom classes.@@ -41,6 +41,70 @@ cargo check && cargo test # Rust check & unit tests (run in src-tauri)- No `useCallback` / `useMemo` — `react-compiler` 已通过 Vite 接入(`babel-plugin-react-compiler`,target 19)用于自动记忆化;- Component functions use `function` declaration; inline events/callbacks use arrow functions+## Hooks Specification (reause)++壳层的副作用一律交给 [`@reause/core`](https://github.com/hairyf/reause)(VueUse 的 React 1:1 移植)。+`react-use` 与 `@hairy/react-lib` 已从依赖中移除,**不要再引入**;新增依赖前先查+`.agents/skills/reause-functions` 的函数表,能在 reause 里找到的不要自己写。++| 需求 | 用 | 不用 |+| --- | --- | --- |+| 观察值变化后执行 | `useWatch` / `useWhenever`(真值触发一次) | `useEffect(deps)` |+| 仅挂载后执行一次 | `useMount` | `useEffect(…, [])` |+| 卸载时才需要清理 | `useEffect`(返回 cleanup),最后手段 | — |+| Tauri 事件订阅 | `useListen`(`src/hooks/use-listen.ts` = `listen` + 卸载注销 + 竞态防护) | `useEffect` + `listen` |+| DOM 事件 | `useEventListener`(缺省 window,可传 ref/目标) | `addEventListener` |+| 定时轮询 / 延时 | `useIntervalFn` / `useTimeoutFn` | `setInterval` / `setTimeout` |+| 延时 Promise | `promiseTimeout` | `new Promise(r => setTimeout(r, ms))` |+| 系统深浅色 | `usePreferredDark` / `useMediaQuery` | `matchMedia` + 手写监听 |+| 元素溢出判定 | `useElementOverflow` | 手写观测 / `scrollHeight` 比较 |+| 布尔开关 | `useToggle` | `useState(false)` + 手写 toggle |+| 跨组件瞬时事件 | `createEventHook` + `useListener`(键集中在 `src/config/hooks.ts` 的 `hooks`) | 全局 emitter / EventBus key |+| 查询「后端设置变更即失效」 | `useInvalidateOnSettingUpdated(queryKey)` | 各处手写 `useListen('setting_updated', …)` |+| iframe 消息桥(双向) | `useIframePost`(宿主 → iframe:origin 定向 + `source: 'dsh-desktop'`)/ `useIframeMessage`(iframe → 宿主:直接 iframe + origin 校验,按 `type` 分发)/ `useInvokeIframe`(iframe → 宿主 → `invoke`,带命令白名单) | 手写 `postMessage` 与来源校验;逐个桥比对 `data.source` |++- **`useEffect` 是最后手段**:只有「必须注册并注销一个外部资源,且 reause 没有对应 hook」时才写+ (例:Tauri 窗口 `onResized` / `onMoved`、需要取消的在途任务);能拆成+ `useMount` / `useListen` / `useWatch` 的一律拆开。+- 副作用回调里不要自己维护 `disposed` 竞态标志:`useListen` 已处理注册竞态,+ 而 `setState` 在已卸载组件上是 no-op。+- 同一模块的 TypeScript 类型与运行时值一起导入用 `import { type X, y } from '…'`,避免重复 import 语句。++## 目录与组件规划(参考 damn-reports)++```+src/+├── components/ # 通用件:无业务依赖、可跨面板复用的基础 UI+│ ├── ellipsis.tsx empty.tsx item.tsx info.tsx logs.tsx logs.utils.ts+│ ├── modal.tsx # overlastic 确认弹窗的通用载体+│ ├── panel.tsx # 面板三件套:Panel.Header / Panel.Loadable / Panel.Progress+│ ├── primitives.ts # tv 变体+│ └── toast-provider.tsx+├── config/ # 应用级配置(client / storage / hooks 事件总线 / query-keys 查询键)+├── ui/ # 业务件:按领域分目录,一个文件一个组件+│ ├── config/ # 设置面板:backup / core / debug / plugin / profile(components/ 为面板子件:close-action / launch-on-login)+│ ├── dialog/ # 命令式弹窗:config / about / update / update-core+│ ├── pet/ # 桌宠窗口界面:hint+│ └── plugin/ # 插件界面:recovery+├── hooks/ # 可复用 hook(use-iframe-post / use-iframe-message / use-invoke-iframe / use-listen / use-window-draggable …)+│ # use-zoom-factor:reause Electron 同名 hook 的 Tauri 移植,壳层用它把 store 里的缩放真值应用到 WebView;use-zoom-level 同源但未接线+├── layout/ # 壳层结构(index.tsx 根副作用 + components/:webview 选态、iframe 桥、navbar、setup*)+├── pet/ # 桌宠窗口(独立入口 pet.html;hooks/ 为桌宠专属 hook,utils/ 为纯逻辑如 bubble / bubble-tracker)+├── store/modules/<name>/ # valtio store 模块(harness 内聚 readiness / runtime / utils)+├── styles/ # 全局样式(main.css + components/)+├── types/ # 后端契约类型(Rust 序列化形态):core / plugin / profile / theme,barrel 导出+└── utils/ # 纯函数与跨模块单例(toast / clipboard / zoom / logger …)+```++- **命名**:文件名 kebab-case;组件用 `function` 声明、`PascalCase` 导出;props 类型 `<组件名>Props` 就近导出。+- **放哪里**:只依赖 HeroUI / reause / 纯工具 → `components/`;依赖 store、Tauri 命令或某个业务领域 → `ui/<领域>/`;只被某个 store 模块使用的纯函数 → 该模块目录内(如 `store/modules/harness/readiness.ts`)。+- **弹窗**:命令式弹窗(overlastic `useOverlay`)统一放 `ui/dialog/`;`components/modal.tsx` 只保留通用确认载体。+- **面板子件**:只被某个面板消费的子区块放同领域目录的 `components/`(如 debug 面板里的 `ui/config/components/close-action.tsx` / `launch-on-login.tsx`),面板文件只保留主结构。+- **根副作用**:壳层只在 `layout/index.tsx` 挂「启动 + 轮询 + 事件订阅 + holder」这类一次性副作用,不再为单个副作用另建组件文件。+- **iframe 桥**:出/入站只经 `useIframePost` / `useIframeMessage`;iframe 元素、iframe 自身的桥(通知 / 插件异常 / 剪贴板图片 / boot / 可见性 / 缩放 / invoke 转发)内联在 `layout/components/iframe.tsx` 的 `<Iframe>` 组件里(同一个 `switch (type)`),导航桥(侧边栏折叠与切换)留在 `layout/components/webview.tsx` 用同一对 hook 收发,其 iframe 侧实现收敛在 dsh-tauri 插件的 `client/register/sidebar.ts`(`ctx.layout.toggleSidebar` + 折叠状态回报),缩放快捷键同理在 `register/zoom-shortcut.ts`;Rust 侧只注入无法在插件期实现的桥(通知 API 垫片 / 剪贴板图片回退 / boot 探测 / WebKit 兼容;iframe 全局样式由 dsh-tauri-ui 的 `client/styles/global.cssr.ts` 挂载);宿主侧不比对 `data.source`,也不为每个桥建 hook。+- **缩放真值**:`store.setting.zoom_factor` 是唯一真值(persist 插件写入的 `setting` 键与 Rust 共用同一份 `.store.dat`,Rust 在下一个窗口创建时按同一归一化规则应用);快捷键与缩放桥只改真值,落到 WebView 由 `useZoomFactor` 完成;平台能力判定(macOS 10.15 没有 `WKWebView.pageZoom`)在 hook 内用 `@tauri-apps/plugin-os` 的 `type()` / `version()` 完成。+- **拆分**:列表行 / 卡片行等重复 JSX 抽成独立行组件并复用(`components/item.tsx`);单文件过大时按「卡片 / 行 / 表单」拆成同目录下的兄弟文件。+## Function Declaration Specification- **Named functions must use `function` declaration, not arrow functions**@@ -72,7 +136,7 @@ useQuery({```tsxfunction MyPage() {const { data } = useQuery({- queryKey: ['simple-data'],+ queryKey: queryKeys.simpleData, // 查询键统一登记在 src/config/query-keys.tsqueryFn: () => fetchData(),});}@@ -94,6 +158,23 @@ export function useGetExchangeRates(params) {}```+### 面板自己持有查询与变更(`use-dsh-*` 系列的落地方式)++- **`use-dsh-*` 系列已全部内联**:只被一个消费者用到的 DSH 查询/变更(含失效、事件同步)+ 直接内联在该消费者里——「核心」`ui/config/core.tsx`、「档案」`ui/config/profile.tsx`、+ 「插件」`ui/config/plugin.tsx`、外壳主题与插件列表同步 `layout/index.tsx`;不再为单一+ 消费者新建包装 hook,后端契约类型统一从 `src/types` 取。+- **查询键集中在 `src/config/query-keys.ts`**:查询键是「谁在读同一份缓存」的契约(面板查询、store 重启+ 失效、后端事件写入缓存都按同一份字面量),不要在业务文件里散落 `queryKey: ['plugins']` 这类字面量。+- **跨消费者的缓存由一处维护**:多个组件读同一份数据时,只有「写缓存」的逻辑收敛到一处+ (例:`layout/index.tsx` 订阅 `dsh-plugins-updated` 写入 `queryKeys.plugins`,插件面板 / 配置对话框+ 异常角标 / 导航栏的 dsh-tauri 检测都只消费同一份缓存)。++## 类型放置++- Rust 侧结构体的序列化形态(camelCase 契约)统一放 `src/types/<领域>.ts`,经 `src/types/index.ts`+ 以 `import type { HarnessCore } from '@/types'` 引用;组件 props 等纯前端类型仍就近定义在组件文件里。+## Conditional Rendering SpecificationUse `If`, `Then`, `Else` components by `react-if-lite` package instead of ternary operators and `&&` operators@@ -125,18 +206,42 @@ Use `If`, `Then`, `Else` components by `react-if-lite` package instead of ternar## State Management Specification-### Multiple module pages shared data: defineStore+### store 模块组织(参考 damn-reports)++`src/store/modules/<name>/` 是一个自洽模块,`index.ts` 是该模块**唯一**的公共出口+(barrel):外部只从这里导入 store、类型与需要外用的工具函数,不深入模块内部文件。++```+src/store/+├── index.ts # 聚合出口:export const store = { ... }+└── modules/<name>/+ ├── index.ts # barrel:export { x } from './store' / export type ... / utils+ ├── store.ts # defineStore({ state, getters, actions })+ ├── types.ts # 类型 + 对外常量+ ├── utils.ts # 与 store 实例无关的纯函数(工厂、格式化、探测)+ └── constants.ts # 时序/阈值常量(可选)+```++- 小模块(如 `setting`)可以只有一个 `index.ts`,不必强行拆分;+- 派生状态写 `getters`(复杂 getter 必须显式标注返回类型),不要在组件里重复计算;+- store↔store 协作走兄弟模块的 `index.ts`(如 `harness.launchAndWait()`),不直接引用对方的 `store.ts`;+- 模块级副作用(事件监听、初始 sync)放在 store 文件底部;组件一律 `import { store } from '@/store'`。```tsx-// store/modules/user.ts+// store/modules/user/index.ts+export { user } from './store'+export type { User } from './types'++// store/modules/user/store.tsexport const user = defineStore({- state: () => ({ user: null }),+ state: () => ({ user: null as User | null }),+ getters: { hasUser(): boolean { return this.user !== null } },actions: { async fetchUser() { ... } },-});+})// Usage-import { store } from '@/store';-const { user } = useStore(store.user);+import { store } from '@/store'+const { user, hasUser } = useStore(store.user)```## Figma → Code@@ -243,7 +348,8 @@ export function FooComponent(props: FooProps) {## Summary- **API Import**: 直接 `import { invoke } from '@tauri-apps/api/core'`(本仓库没有 `@/apis` 层);类型就近定义在 hooks/组件文件中+- **Hooks**: 副作用一律用 reause(`useWatch`/`useMount`/`useListen`/`useEventListener`/`useIntervalFn`/`promiseTimeout` 等),`useEffect` 只在需要卸载清理且无对应 hook 时使用;`react-use` / `@hairy/react-lib` 已移除- **Function Declaration**: Use `function`, not arrow functions- **Conditional Rendering**: Use `If`, `Then`, `Else` components instead of ternary operators and `&&` operators- **Data Processing**: Simple scenarios use `useQuery`/`useMutation` directly, complex scenarios create service files-- **State Management**: Multi-module shared state uses `defineStore + useStore`(valtio-define);`defineScope`/`useScope` 已弃用(无引用),新代码勿用+- **State Management**: Multi-module shared state uses `defineStore + useStore`(valtio-define);store 按 `src/store/modules/<name>/` 分模块,`index.ts` 是唯一出口;`defineScope`/`useScope` 已弃用(无引用),新代码勿用diff --git a/docs/AGENTS.plugins.md b/docs/AGENTS.plugins.mdindex 4ad4cc2c..db48ff57 100644--- a/docs/AGENTS.plugins.md+++ b/docs/AGENTS.plugins.md@@ -102,7 +102,7 @@ import type { SelectorHook, SettingsSidebarProps } from '../types'仅在为了兼容既有公开 API 时,才允许从原文件 re-export 类型:```ts-export type { NavBridgeHandlers } from '../types'+export type { ClientContext } from '../types'```纯组件内部且绝不跨文件使用的极小类型可以保留在组件文件中,但新增类型默认应先考虑放入 `types/`。@@ -129,6 +129,36 @@ export const PANEL_STYLE_ID = 'dsh-tauri-panel-styles'组件文件只消费常量,不重复写共享字符串或数字。真正只使用一次且不表达协议的局部值可以保留在实现文件中。跨 half 共享的协议常量(插件名 / API 前缀 / 分区顺序)放 `src/shared/constants.ts`,host/constants/ 与 client/constants/ 从那里 re-export,不再各自硬编码。+## 父窗口桥(iframe ↔ 桌面宿主)规则++iframe 内的插件没有 `__TAURI_INTERNALS__`,与桌面宿主只能经 postMessage 通信。+**所有自定义桥必须经 `dsh-tauri/client` 暴露的这一组方法**,禁止自行+`window.parent.postMessage(…)` / `window.addEventListener('message', …)`:++| 方法 | 方向 | 用途 |+| --- | --- | --- |+| `invoke(cmd, args?, options?)` | iframe → 宿主 → Tauri `invoke` | 调宿主侧 command(签名同 `@tauri-apps/api/core`) |+| `listen(event, handler, options?)` | 宿主 → iframe | 订阅宿主转发进来的 Tauri 事件(签名同 `@tauri-apps/api/event`) |+| `invokeParent(message)` | iframe → 宿主 | 自定义协议的裸发送(fire-and-forget;返回值表达是否送达) |+| `listenParent(handler, types?)` | 宿主 → iframe | 自定义协议的裸接收,返回取消函数 |+| `useInvoke(cmd, args?)` | — | `invoke` 的 React「读一次」版本(`{ data, loading, error }`) |+| `useListen(event, handler)` | — | `listen` 的 React 版本(挂载订阅、卸载注销) |+| `useListenParent(types, handler)` | — | `listenParent` 的 React 版本 |++- **来源校验只做一次**:客户端只信 `event.source === window.parent`(`listenParent` 内完成),+ 宿主侧只信 `event.source === iframe.contentWindow` + origin 匹配;两端都**不再比对 `data.source`**,+ 协议分支一律按 `data.type` 分发(`source` 字段可保留兼容,不参与判断)。+- **协议常量集中在 `client/constants/`**(如 `TYPE_INVOKE` / `TYPE_EVENT`),与桌面宿主侧的字面量逐字一致;+ 宿主侧对应实现为 `src/layout/components/iframe.tsx`(`useIframePost` / `useIframeMessage`)。+- **Tauri 事件转发链路**:宿主 `useListenIframe(iframeRef, event, payload => ({ type: TYPE_EVENT, event, payload }))`+ ↔ 客户端 `listen(event, handler)`;新增「宿主事件 → 插件 UI」通道按此配对,不要另写 postMessage。+- **错误上报**:一律经 `reportPluginError`(内部走 `invokeParent`),不要自己拼消息体。+- **桌面集成能力放 `client/register/*`**:侧边栏切换与折叠回报(`dsh://sidebar:toggle` / `dsh://sidebar:collapsed`)、+ 缩放快捷键(`dsh://zoom-shortcut`)都由插件在 iframe 内实现(`register/sidebar.ts`、`register/zoom-shortcut.ts`),+ 桌面端**不再注入**对应的通讯 shim(Rust 侧只保留无法在插件加载前/插件期实现的桥:通知 API 垫片、+ 剪贴板图片回退、boot 探测、WebKit 兼容;iframe 全局样式统一由 `dsh-tauri-ui` 的+ `client/styles/global.cssr.ts` 经 `mountStyle` 挂载)。新增同类能力时同样放 `register/*` 或 `styles/*`,不要回到注入脚本。+## 样式与 css-render 规则所有客户端自定义样式使用 [`css-render`](https://css-render.vercel.app/) + [`@css-render/plugin-bem`](https://www.npmjs.com/package/@css-render/plugin-bem),统一经 `dsh-tauri-ui/client`:diff --git a/docs/SPEC-REVIEW.md b/docs/SPEC-REVIEW.mdnew file mode 100644index 00000000..ef63443c--- /dev/null+++ b/docs/SPEC-REVIEW.md@@ -0,0 +1,231 @@+# 规范评审(SPEC-REVIEW)++> 视角:一次「把整套规范实际执行到底」之后的复盘。+> 覆盖范围:`AGENTS.md` → `docs/AGENTS.desktop.md` + `docs/AGENTS.plugins.md`,+> 以及本轮口头追加的 hooks / 目录 / 命名规则(reause 化、`ui/<领域>/`、`Panel.*` 复合组件、+> `config/hooks` 事件总线、`useWakeLock`、内联根副作用、删除中间层组件等)。+> 结论先行:**这是一套「以"唯一来源 + 声明式副作用"为核心的架构规范」,而不是风格规范。**++---++## 1. 一句话画像++> 风格交给 eslint(antfu preset)和框架(HeroUI / react-compiler),+> 规范只回答三件事:**副作用怎么写**(reause)、**代码放哪里**(components / ui / hooks / store)、+> **一个事实允许存在几份**(一律一份)。++它有三个不太常见的取向:++1. **能用 hook 表达的行为,不允许用命令式 effect 表达**——把「什么时候执行」从时序问题变成依赖问题。+2. **能删的中间层一律删**——只做转发的组件、只做包装的函数、只存在于一个模块的 util,都不配拥有独立文件。+3. **规范与事故记忆绑定**——注释里常驻 `issue #469` / `#437` / `#303` / `#441` 这类编号,+ 写的是「为什么必须这样」,而不是「这样写更优雅」。++---++## 2. 四条主干(含本轮证据)++### 主干一:副作用声明式化(reause 收口)++`useEffect` 被压缩为最后手段,其余全部映射到 reause:++| 需求 | 写法 | 本轮替换量 |+| --- | --- | --- |+| 观察值变化 | `useWatch` / `useWhenever` | plugin-recovery、pet-window、pet-source、harness-updater |+| 仅挂载一次 | `useMount` | layout、setup-preinstall、preinstall store 调用点 |+| 订阅 Tauri 事件 | `useListen`(`hooks/use-listen.ts`) | dsh-plugins / dsh-profiles / dsh-cores / backup / theme / pet-status / macos-menu / update-core |+| DOM 事件 | `useEventListener` | iframe 四个 message 桥、zoom、dev 快捷键 |+| 轮询 / 延时 | `useIntervalFn` / `promiseTimeout` | 桌面端更新轮询、iframe 可见性兜底、备份探测 |+| 系统偏好 / 溢出 | `usePreferredDark` / `useElementOverflow` | theme、ellipsis |+| 布尔开关 | `useToggle` | config-core / config-profile / backup |+| 跨组件瞬时事件 | `createEventHook` + `useListener(hooks[key].on, cb)` | `config/hooks.ts` 两个键 |++结果:`useEffect` 从「十几个文件里到处都是」收敛到 **8 个文件、8 处,且每一处都需要注销外部资源**+(Tauri 窗口 `onResized/onMoved`、`listen` 的注册竞态、在途下载取消、ref 同步)。+同时 `react-use` 与 `@hairy/react-lib` 被彻底摘除(依赖树 + lock 均已无这两个包)。++**评价**:这条主干最大的收益不是"少写代码",而是**消除了 effect 之间的隐式时序**。+`listen → resolve → setState` 这类竞态过去在 12 个地方各写一遍(还各带一个 `disposed` 标志),+现在只有一个实现、一种语义。++### 主干二:唯一来源(single source of truth)++本轮几乎所有指令都可以还原成同一句话:**同一事实只允许存在一份,其余地方要么 import,要么删除。**++- `delay` 本地实现 → `@hairy/utils` 的 `delay`;+- `readiness` / `runtime-exit` / `internal-plugin-phase` 从 `utils/` 搬进 `store/modules/harness/`——+ 它们本来就只服务 harness 状态机,放在全局 utils 里等于宣布"谁都能用";+- `panel-header` + `panel-loadable` + `panel-progress` → 一个 `Panel`(`Panel.Header/Loadable/Progress`);+- `desktop-updater` / `download-toast-trigger` / `harness-updater` 三个组件 → 内联进 `layout/index.tsx`+ (它们只产出副作用或一个 holder,不值得各自占一个文件);+- `use-macos-app-menu` → 内联进 `navbar.tsx`(只有一个消费方);+- `events.ts` 两个 `createEventHook` → 收进 `config/hooks.ts` 的 `hooks` 键表;+- `writeClipboardText` 的 toast 从 4 个调用点收进 helper(避免"同一动作在多处提示");+- `navigator.wakeLock` 猴补丁 → `useWakeLock` + `useWatch(..., release)`。++**评价**:这是整套规范里最"硬"的一条,也最容易被低估。它的真正作用是把**重构成本从 O(引用点) 降到 O(1)**:+删掉一个中间层,编译器立刻告诉你还有谁在依赖它。++### 主干三:目录即架构(components / ui / hooks / store / styles)++| 位置 | 判定标准 | 本轮落点 |+| --- | --- | --- |+| `components/` | 只依赖 HeroUI / reause / 纯工具,无业务语义 | `panel.tsx`、`logs.utils.ts`、`ellipsis/item/info/logs/modal` |+| `ui/<领域>/` | 依赖 store、Tauri 命令或某业务领域 | `ui/config/*`(7)、`ui/dialog/*`(4)、`ui/pet/hint`、`ui/plugin/recovery` |+| `hooks/` | 可复用的 React 行为(含跨窗口的 `useWindowDraggable`) | 14 个 |+| `store/modules/<name>/` | 状态 + 该状态专属的纯函数 | harness 内聚 `readiness/runtime/utils/constants` |+| `layout/index.tsx` | 壳层唯一根副作用挂载点 | 启动、更新轮询、下载提示、更新提示、唤醒锁 |++命名规则同样"随位置走":进 `ui/config/` 就去掉 `config-` 前缀(`backup.tsx`),+进 `ui/dialog/` 就去掉 `-dialog` 后缀(`about.tsx` / `update.tsx` / `update-core.tsx`);+复合组件用点号导出而不是多文件(`Panel.Header`),与 HeroUI 的 `Modal.*` / `Select.*` 一致。++**评价**:`components` vs `ui` 的切分是整个规范里**最容易判断、也最容易自动化检查**的一条+("这个文件 import 了 store 吗?")。它替代了常见的 `features/` `modules/` `shared/` 三件套,+规则少、歧义小。++### 主干四:规范 = 运行手册(不只写"应该",更写"为什么必须")++`docs/AGENTS.desktop.md` 的 Pitfalls 段落里是 pnpm store 绑定、原生模块 ABI、Windows 进程树、+Linux inotify 上限这类**真实的、会让人损失半天时间**的故障;注释里写的是+"为什么必须 `CREATE_NO_WINDOW`"、"为什么 `startDragging()` 的 Promise 不代表拖拽结束"。++**评价**:这使它区别于大多数 AGENTS.md(那些只是风格清单)。+事故记忆被固化下来之后,规范才具备"防止同一个坑踩第二次"的能力——+这也是它特别适合 AI 协作者的原因:agent 读规则会偷懒,读"踩坑史"不会。++---++## 3. 规范里没写、但一直在遵守的隐含原则++1. **能删就删,不留兼容层**:本轮净减 8 个文件(删 10 / 增 2),没有一处 `_legacy` / `_old` 过渡。+2. **一个文件一个存在理由**:说不出"它为什么不能被合并"的文件会被合并。+3. **why > what**:注释只解释原因与平台差异,不解释代码本身在做什么。+4. **平台差异显式化**:Windows / macOS / Linux 的分支必须留下依据(issue 号或上游行为)。+5. **测试锁"接线",不只锁"行为"**:`readFileSync` + 字符串断言,专门防止"改了 A 忘了改 B"。+6. **重构以 `git mv` 进行**:保留 blame 与 diff 可读性(本轮 23 处重命名全部如此)。++---++## 4. 强项(可验证,不是感受)++- **删除率高**:一次深度改造删掉 10 个文件、合并 3 个组件、内联 3 个组件,几乎没有为此付出可读性代价。+- **grep 成本极低**:想知道"谁在订阅事件"只需 `useListen`;想知道"哪些 effect 还活着"只需数 `useEffect`。+- **路径可预测**:看到 `ui/config/plugin.tsx` 就能推断它依赖 `store/modules/plugin`(如存在)与 `@/components/*`。+- **和编译器/新库同向**:`no useCallback/useMemo` + react-compiler、reause 声明式副作用、+ HeroUI 复合组件,三者不互相打架。+- **对 AI 友好**:规则表 + 目录决策 + 事故库,正好是 agent 最容易消费的三类文档形态。++---++## 5. 张力与风险(这一节是评审的重点)++### 5.1 规范靠"最新口头指令"承载,缺少版本与动机索引++现象:本轮十几条规则都是对话里给出的;`AGENTS.desktop.md` 只是被动追认。+影响:新协作者(人或 agent)不知道哪条是硬约束、哪条是偏好,也不知道例外的边界。+建议:把每条规则写成三元组 **规则 / 动机 / 反例**,并在文首标注"必须 / 建议 / 仅供参考"三档;+本次已在 `docs/AGENTS.desktop.md` 的 Hooks 段落先试了表格化的写法,可以推广到全部规则。++### 5.2 源码契约测试与"搬迁型重构"强耦合++现象:本轮 17 个测试文件被改动,其中大多数只是 `new URL('../src/components/config-x.tsx')` 换路径。+影响:重构的摩擦成本被转移到测试上,长期会让人"懒得搬",规范随之腐化。+建议:二选一——+① 路径断言集中到一处(如 `test/contracts/paths.ts` 导出 `SOURCES.pluginPanel`),搬迁只改一行;+② 契约测试改为**行为断言**(导入真实模块、断言导出与调用),仅在需要时读源码。+`test/wake-lock.test.ts`(断言两个入口都释放唤醒锁)已经是"语义断言"的正确形态,可作为模板。++### 5.3 `useEffect` 的例外只有原则、没有白名单++现象:"只在需要卸载清理时使用"依赖判断力;`src/hooks/use-invoke.ts`(本轮新增、目前无人引用)+就写成了 `useEffect(..., [channel, args, options])`。+建议:显式列出合法类别 + 注释标记,例如:++```tsx+// keep:effect 取消在途请求(无法用 reause 表达)+useEffect(() => { ... }, [disposable])+```++再配合 lint 最小检查(禁止 `react-use` / `@hairy/react-lib`、对新增 `useEffect` 给出告警)。++### 5.4 目录树会腐化,决策树不会++现象:`AGENTS.desktop.md` 里的树两轮内已被改写两次(`config-*` → `ui/config/*`、`panel-*` → `panel.tsx`)。+建议:文档只保留"放哪里的判定顺序"(4 条问句即可),具体文件清单交给 `tree`/README,+或用一个脚本生成,避免文档与仓库赛跑。++### 5.5 `src/utils/` 有杂货铺倾向++现象:本轮把 `log` / `readiness` / `runtime-exit` / `events` 四类"其实有明确归属"的东西搬走,方向正确。+建议:把判定写成硬规则——+**只被一个 store 模块使用 → 该模块目录内;跨模块且无状态 → `utils/`;含 React → `hooks/`;+含副作用生命周期 → `hooks/` 或 store 模块。** `utils/` 只留纯函数与全局单例(toast / clipboard / zoom / logger)。++### 5.6 规范假设了"串行重构",并发写同一工作区会互相踩++现象:本轮我与另一个会话同时改同一棵树——一次 `git stash` 误伤了对方未提交的工作,+随后对方又开了一波(`use-invoke.ts`、`bubble-copy` → `pet/utils/bubble.ts`),+目前索引里两方改动被一起 `git add` 了。+建议:在 `AGENTS.md` 增加协作条款:重构前先 `git status` 声明范围;避免对整棵树做+`stash`/`checkout`/`reset` 这类粗粒度操作;并发时改成"新增文件 + 明确点名的编辑"。++### 5.7 "提示只出现一次"尚未成为显式规则++现象:`writeClipboardText` 的 toast 收口之前,成功/失败提示在 4 个调用点各写一份。+建议:补一条 **副作用与用户提示的唯一出处** 规则(谁执行谁提示,调用点只记日志),+并把"重复 toast"列入 review checklist。++### 5.8 reause 优先 ≠ reause 万能++现象:`ellipsis.tsx` 改用 `useElementOverflow`(ResizeObserver + MutationObserver)后,+语义更好,但"打开前同步测量"变成了"依赖观测值",字体切换这类不改变盒子的场景理论上可能过期;+反之 `useListen` / `useWatch` / `useMount` 的替换是纯收益。+建议:规范写成 **"优先 reause;不适用的地方必须留下 `// reause 不适用:<原因>` 注释"**,+把例外显式化,而不是留成"这次没换可能是忘了"。++---++## 6. 成熟度评分(主观,但明确)++| 维度 | 分数 | 依据 |+| --- | --- | --- |+| 一致性 | ★★★★★ | 规则少而正交,冲突时能明确裁决(唯一来源 > 就近放置) |+| 可执行性 | ★★★★☆ | 大部分规则人工可判定;少数(`useEffect` 例外)依赖经验 |+| 可自动验证 | ★★★☆☆ | 目录/依赖方向可脚本化,但尚未落地任何 lint/CI 检查 |+| 重构友好度 | ★★★☆☆ | 代码侧极友好;测试侧(源码路径断言)拖后腿 |+| 新人/AI 上手成本 | ★★★★☆ | AGENTS.* + 事故库很有效;规则仍未分级(必须/建议) |+| 长期抗腐化 | ★★★☆☆ | 文档树与"口头规则"是主要腐蚀点 |++---++## 7. 下一步(按性价比排序)++1. **给规范分级**:`必须 / 建议 / 反例`,先做 Hooks 与目录两部分(成本最低、收益最大)。+2. **落地 3 条 lint 规则**:禁止 `react-use`/`@hairy/react-lib`;`useEffect` 新增加注释标记;import 顺序。+3. **测试路径契约集中化**(5.2),让下一次搬迁只改一处。+4. **`AGENTS.desktop.md` 拆分**:规则(AGENTS.desktop.md)+ 事故库(`docs/PITFALLS.md`),+ 两者现在混在一起,读者目标不同。+5. **目录树改为决策树**,文件清单用脚本生成。+6. **补并发协作条款**(5.6),并把"提示/副作用唯一出处"写进 checklist(5.7)。+7. **清理遗留**:`src/hooks/use-invoke.ts` 目前无引用且用了 `useEffect`,按规范应删除或改写。++---++## 8. 附录:本轮深度改造的量化观察++| 指标 | 数值 |+| --- | --- |+| `git mv` 重命名 | 21 处(另 2 处为并发会话所改) |+| 删除文件 | 10(3 个 panel 件、3 个 layout 组件、`use-macos-app-menu`、`events`、`disable-wake-lock`、`internal-plugin-phase`) |+| 新增文件 | 2(`components/panel.tsx`、`config/hooks.ts`;`hooks/use-listen.ts` 在早前轮次加入) |+| 文件净变化 | −8 |+| `useEffect` 收敛 | 由 15+ 文件 → **8 文件 8 处,且全部需要卸载清理** |+| 依赖摘除 | `react-use`、`@hairy/react-lib`(lock 已无残留) |+| 测试改动 | 17 个文件(含 1 个重命名) |+| i18n 新增键 | 2(`messages.clipboard_copied` / `messages.clipboard_failed`,中英同步) |+| 并发写入事故 | 1 次(`git stash` 误伤;`stash@{0}` 与 `.temp/reause-wip.patch` 留有备份) |++> 一句话收尾:这套规范真正稀缺的地方在于**它敢于删代码,并且要求每次删除都留下理由**;+> 它目前最大的短板不在规则本身,而在**规则的表达形式(分级、可检查、可生成)**和+> **测试对重构的摩擦**。前者是文档问题,后者是工程问题,都不难修。diff --git a/docs/spec/REMOTE.md b/docs/spec/REMOTE.mdindex 2e68fde3..4d6f3d4c 100644--- a/docs/spec/REMOTE.md+++ b/docs/spec/REMOTE.md@@ -135,7 +135,7 @@ flowchart LR- **Tauri 命令注册**:`src-tauri/src/bridge/`(如 `core.rs`)新增 `mobile_*` 命令,并在`src-tauri/src/desktop/builder.rs` 的 `generate_handler!` 注册。- **前端入口**:- - 导航栏/设置:`src/layout/components/navbar.tsx` 与 `src/components/config-*.tsx` 加入口。+ - 导航栏/设置:`src/layout/components/navbar.tsx` 与 `src/ui/config/*.tsx` 加入口。- 若是独立配对窗口,复用现有 `layout/components/webview.tsx`(WebView 加载 `http://127.0.0.1:<桥端口>/desktop`)。- 向 DSH 页面注入按钮:已有 `src-tauri/src/desktop/style.rs`、`desktop/nav.rs` 的先例可复用。- **i18n**:新增键写入 `src/i18n/locales/zh-CN.json` 与 `en-US.json`(扁平点分键,如diff --git a/package.json b/package.jsonindex 0c9fa4b7..e9eea764 100644--- a/package.json+++ b/package.json@@ -24,7 +24,6 @@},"dependencies": {"@gravity-ui/icons": "catalog:runtime",- "@hairy/react-lib": "catalog:runtime","@hairy/utils": "catalog:utils","@heroui/react": "catalog:runtime","@heroui/styles": "catalog:runtime",@@ -33,15 +32,17 @@"@tanstack/react-query": "catalog:runtime","@tauri-apps/api": "catalog:tauri","@tauri-apps/plugin-http": "catalog:tauri",+ "@tauri-apps/plugin-os": "catalog:",+ "@tauri-apps/plugin-store": "catalog:","dsh-pet-component": "catalog:runtime","i18next": "catalog:runtime","react": "catalog:runtime","react-dom": "catalog:runtime","react-i18next": "catalog:runtime","react-if-lite": "catalog:runtime",- "react-use": "catalog:runtime","semver": "catalog:runtime","tailwind-variants": "catalog:runtime",+ "unstorage": "catalog:utils","valtio-define": "catalog:runtime"},"devDependencies": {diff --git a/packages/dsh-tauri-pet/README.md b/packages/dsh-tauri-pet/README.mdindex ae39949f..50dfc125 100644--- a/packages/dsh-tauri-pet/README.md+++ b/packages/dsh-tauri-pet/README.md@@ -61,7 +61,7 @@ skill provider 或默认根目录。| `set_pet_activity` | 更新 `idle`、`turn`、`moving-left`、`moving-right`、`waving`、`waiting`、`running`、`review` 或 `failed` |完整客户端桥实现见 `src/client/service/pet.ts`;它调用-`dsh-tauri/client` 的 `invokeBridgedTauri`。设置卡片直接使用预设清单的浏览图+`dsh-tauri/client` 的 `invoke`(签名与 `@tauri-apps/api/core` 一致)。设置卡片直接使用预设清单的浏览图URL 作为缩略图。> 桌宠窗口渲染全部交给 `dsh-pet-component`(`src/pet`):远端素材经diff --git a/packages/dsh-tauri-pet/src/client/service/pet.ts b/packages/dsh-tauri-pet/src/client/service/pet.tsindex bf499667..faa89ece 100644--- a/packages/dsh-tauri-pet/src/client/service/pet.ts+++ b/packages/dsh-tauri-pet/src/client/service/pet.ts@@ -1,5 +1,5 @@import type { PetAsset, PetListItem, PetSource, PetStatus, PresetPetItem } from '../types'-import { invokeBridgedTauri } from 'dsh-tauri/client'+import { invoke } from 'dsh-tauri/client'import {CMD_GET_PET_ASSET,CMD_GET_PET_STATUS,@@ -12,35 +12,35 @@ import {} from '../constants'export function fetchPetStatus(): Promise<PetStatus> {- return invokeBridgedTauri<PetStatus>(CMD_GET_PET_STATUS)+ return invoke<PetStatus>(CMD_GET_PET_STATUS)}/** 启用/关闭桌宠(持久化:关闭后重启不再自动拉起)。 */export function setPetEnabled(enabled: boolean): Promise<PetStatus> {- return invokeBridgedTauri<PetStatus>(CMD_SET_PET_ENABLED, { enabled })+ return invoke<PetStatus>(CMD_SET_PET_ENABLED, { enabled })}export function setActivePet(id: string): Promise<PetStatus> {- return invokeBridgedTauri<PetStatus>(CMD_SET_ACTIVE_PET, { id })+ return invoke<PetStatus>(CMD_SET_ACTIVE_PET, { id })}export function setPetSize(size: number): Promise<PetStatus> {- return invokeBridgedTauri<PetStatus>(CMD_SET_PET_SIZE, { size })+ return invoke<PetStatus>(CMD_SET_PET_SIZE, { size })}export function fetchPetList(source: PetSource): Promise<PetListItem[]> {- return invokeBridgedTauri<PetListItem[]>(CMD_LIST_PETS, { source })+ return invoke<PetListItem[]>(CMD_LIST_PETS, { source })}export function fetchPetAsset(id: string): Promise<PetAsset> {- return invokeBridgedTauri<PetAsset>(CMD_GET_PET_ASSET, { id })+ return invoke<PetAsset>(CMD_GET_PET_ASSET, { id })}export function importPet(name: string, data: string): Promise<PetListItem> {- return invokeBridgedTauri<PetListItem>(CMD_IMPORT_PET, { name, data })+ return invoke<PetListItem>(CMD_IMPORT_PET, { name, data })}/** 预设宠物清单(`resources/preset-pets.json`;条目直连远端素材,无安装态)。 */export function fetchPresetPets(): Promise<PresetPetItem[]> {- return invokeBridgedTauri<PresetPetItem[]>(CMD_LIST_PRESET_PETS)+ return invoke<PresetPetItem[]>(CMD_LIST_PRESET_PETS)}diff --git a/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts b/packages/dsh-tauri-ui/src/client/styles/global.cssr.tsindex dba4f17d..a64c3d2b 100644--- a/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts+++ b/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts@@ -2,6 +2,14 @@ import { cssr } from '../utils/cssr'const { c } = cssr+/**+ * 全局样式(挂载于 `apply`:`mountStyle(globalStyle, 'dsh-tauri-ui-global-styles')`)。+ *+ * 其中「右侧面板开关簇」一节原先由桌面端注入脚本(Rust `IFRAME_STYLES_JS`)承担,+ * 现统一收敛到本插件:页面里「按 aria-label 隐藏左侧收起按钮」的规则会误伤右侧+ * 面板开关,这里只把面板开关簇恢复回来。`.nArs4W_toggleCluster` 是旧版 dsh 的生成+ * 类名,保留兼容(优先使用插件的稳定标记 `data-dsh-toggle-cluster`)。+ */export default c([c('[data-slot="sidebar.right.tab.guide"]', [c('[class$="guide"]', {@@ -27,4 +35,14 @@ export default c([fontSize: '12px',}),]),+ c('[data-dsh-toggle-cluster], .nArs4W_toggleCluster', {+ top: '6px !important',+ right: '6px !important',+ gap: '2px !important',+ }),+ c('[data-dsh-toggle-cluster] button[aria-label], .nArs4W_toggleCluster button[aria-label]', {+ display: 'flex !important',+ borderRadius: '8px !important',+ flexShrink: 0,+ }),])diff --git a/packages/dsh-tauri/src/client/apply.ts b/packages/dsh-tauri/src/client/apply.tsindex d53c9fb2..1a8634d6 100644--- a/packages/dsh-tauri/src/client/apply.ts+++ b/packages/dsh-tauri/src/client/apply.ts@@ -1,16 +1,18 @@/*** client/apply.ts — dsh-tauri 客户端插件体(browser half):纯消息桥,无 UI、无运行时依赖。*- * 桌面端顶部导航栏(shell-nav-bar.tsx)常驻在 Tauri 宿主,其左侧三个控件- * (侧边栏 / 后退 / 前进)通过 postMessage 操控 iframe 内的 dsh 应用;- * 本插件是 iframe 内的接收端:把命令转发给 dsh(侧边栏切换走- * `ctx.layout.toggleSidebar`,后退/前进走 `window.history`),并把 dsh 状态- * (侧边栏折叠、页面历史边界)回报给宿主。协议详见 `./service/bridge.ts`。+ * 本插件注册三件事:+ * - `registerSidebarToggle`(`./register/sidebar.ts`):宿主导航栏的侧边栏开关经+ * `dsh://sidebar:toggle` 转发给 dsh 布局服务(`ctx.layout.toggleSidebar()`)执行,+ * 并把侧边栏折叠状态回报给宿主;+ * - `registerZoomShortcut`(`./register/zoom-shortcut.ts`):iframe 内的+ * Ctrl/Cmd + `+`/`-`/`0` 经父窗口桥上报宿主(宿主写缩放真值,由 `useZoomFactor` 应用);+ * - 侧边栏 UI 微调:官方侧边栏 logo 行自带的「收起侧边栏」按钮与宿主导航栏的开关重复,+ * 加载时用一条 CSS 规则隐藏(折叠态窄栏的「打开侧边栏」按钮保留);同时把品牌词标+ * 按钮(aria-label「新建会话」,CSS module 类名是生成哈希、不稳定)的内容改为水平居中。*- * 另:官方侧边栏 logo 行自带的「收起侧边栏」按钮与宿主顶部导航栏的侧边栏- * 开关重复,插件加载时用一条 CSS 规则把它隐藏(折叠态窄栏的「打开侧边栏」- * 按钮保留,窄栏恢复仍靠它);同时把品牌词标按钮(aria-label「新建会话」,- * CSS module 类名是生成哈希、不稳定)的内容改为水平居中。+ * 这三件事原先由桌面端注入的 `NAV_SHIM_JS` / `ZOOM_SHORTCUT_BRIDGE_JS` 承担,现在统一+ * 收敛到插件客户端(宿主只保留通知 / 样式 / 剪贴板图片 / boot 探测等无法在插件期实现的桥)。** 服务依赖(inject):layout(侧边栏切换)。locale/slots 均不再需要。*/@@ -18,21 +20,32 @@ import type { ClientContext } from './types'import { CssRender } from 'css-render'import {COLLAPSE_SIDEBAR_SELECTOR,- NAV_BRIDGE_EFFECT_ID,NEW_SESSION_SELECTOR,+ SIDEBAR_TOGGLE_EFFECT_ID,SIDEBAR_TWEAKS_EFFECT_ID,SIDEBAR_TWEAKS_STYLE_ID,+ ZOOM_SHORTCUT_EFFECT_ID,} from './constants'-import { setupNavBridge } from './service/bridge'+import { registerSidebarToggle } from './register/sidebar'+import { registerZoomShortcut } from './register/zoom-shortcut'import { reportPluginError } from './utils/error'/**- * 插件体:接管导航桥(置位接管标记 → 挂命令监听/状态观察/历史跟踪)。+ * 插件体:注册侧边栏(切换 + 折叠回报)、缩放快捷键与侧边栏 UI 微调。* @param ctx - 客户端根上下文。*/export function apply(ctx: ClientContext): void {;(window as Window & { ctx?: ClientContext }).ctx = ctx+ // 侧边栏:宿主命令 → dsh 布局服务;折叠状态 → 宿主导航栏+ ctx.effect(+ () => registerSidebarToggle(() => { ctx.layout.toggleSidebar() }),+ SIDEBAR_TOGGLE_EFFECT_ID,+ )++ // 缩放快捷键:iframe 内捕获 → 父窗口桥 → 宿主缩放真值+ ctx.effect(() => registerZoomShortcut(), ZOOM_SHORTCUT_EFFECT_ID)+ctx.effect(() => {// 侧边栏 UI 微调(一律用稳定的 aria-label 属性选择器,不用生成哈希的// CSS module 类名):@@ -59,19 +72,4 @@ export function apply(ctx: ClientContext): void {}return () => styleCleanup?.()}, SIDEBAR_TWEAKS_EFFECT_ID)-- ctx.effect(() => {- // 导航桥启动:初始化失败也上报(桥内部有各自的 guard/兜底轮询,这里只- // 兜 setupNavBridge 首次同步执行期间的异常)。- let navCleanup: (() => void) | undefined- try {- navCleanup = setupNavBridge({- toggleSidebar: () => { ctx.layout.toggleSidebar() },- })- }- catch (error) {- reportPluginError(error, 'runtime')- }- return () => navCleanup?.()- }, NAV_BRIDGE_EFFECT_ID)}diff --git a/packages/dsh-tauri/src/client/constants/index.ts b/packages/dsh-tauri/src/client/constants/index.tsindex b6415719..d64a2246 100644--- a/packages/dsh-tauri/src/client/constants/index.ts+++ b/packages/dsh-tauri/src/client/constants/index.ts@@ -1,9 +1,3 @@-/** 宿主 → iframe 命令的 source。 */-export const SRC_HOST = 'dsh-desktop'--/** iframe → 宿主事件的 source。 */-export const SRC_BRIDGE = 'dsh-nav-bridge'-// ── dsh-tauri invoke 桥(iframe → 宿主 → invoke() → 回传)─────────────// iframe 内的 dsh 界面 / 插件无法直接访问 `@tauri-apps/api`(`__TAURI_INTERNALS__`// 只在顶层 webview)。本桥让客户端经 postMessage 把 command 上报到宿主(主@@ -19,30 +13,33 @@ export const TYPE_INVOKE_REPLY = 'dsh://tauri:reply'/** 单次 invoke 等待宿主应答的最长毫秒数(超时按失败处理)。 */export const INVOKE_TIMEOUT_MS = 15000-/** 宿主命令类型。 */+/**+ * 宿主 → iframe:Tauri 事件转发的消息类型(`listen()` 消费)。+ *+ * 与桌面端 `useListenIframe` 的 `forward()` 返回的 `type` 必须逐字一致;+ * 配对关系:宿主 `useListenIframe(iframeRef, event, payload => ({ type: TYPE_EVENT, event, payload }))`+ * ↔ 客户端 `listen(event, handler)`。+ */+export const TYPE_EVENT = 'dsh://tauri:event'++/** 宿主 → iframe:侧边栏切换命令(`register/sidebar.ts` 消费)。 */export const CMD_TOGGLE = 'dsh://sidebar:toggle'-export const CMD_PREV = 'dsh://page:prev'-export const CMD_NEXT = 'dsh://page:next'-/** iframe → 宿主状态事件类型。 */+/** iframe → 宿主:侧边栏折叠状态回报(`register/sidebar.ts` 发送)。 */export const EVENT_SIDEBAR_COLLAPSED = 'dsh://sidebar:collapsed'-export const EVENT_PAGE_FIRSTED = 'dsh://page:firsted'-export const EVENT_PAGE_LASTED = 'dsh://page:lasted'-/** 应用晚挂载时的导航桥探测参数。 */-export const TRACK_MAX_TRIES = 30-export const TRACK_INTERVAL_MS = 500+/** iframe → 宿主:缩放快捷键动作(`register/zoom-shortcut.ts` 发送;宿主据此更新缩放真值)。 */+export const TYPE_ZOOM_SHORTCUT = 'dsh://zoom-shortcut'-/** 会话行菜单按钮的 aria-label 模板(zh/en),用于提取标题与按标题找行。 */-export const SESSION_LABEL_PATTERNS = [- /^会话“(.+)”的操作$/,- /^Session actions for (.+)$/,-] as const+/** dsh 应用布局根(AppFrame):`data-shell-overlay` 的父节点,带侧边栏折叠属性。 */+export const SIDEBAR_FRAME_SELECTOR = '[data-shell-overlay]'+export const SIDEBAR_COLLAPSED_ATTRIBUTE = 'data-sidebar-collapsed'-/** 上报消息的 source key(宿主校验:`source === 'dsh-plugin-error-bridge'`)。 */-export const ERROR_SRC = 'dsh-plugin-error-bridge'+/** 应用晚挂载时补报一次侧边栏折叠状态的轮询参数(拿到 AppFrame 即停)。 */+export const SIDEBAR_TRACK_MAX_TRIES = 30+export const SIDEBAR_TRACK_INTERVAL_MS = 500-/** 上报消息的 type key(宿主校验:`type === 'dsh://plugin-error'`)。 */+/** 上报消息的 type key(宿主按 `type` 分发:`dsh://plugin-error`)。 */export const ERROR_TYPE = 'dsh://plugin-error'/** 插件 id(npm 包名):宿主错误注册表与插件列表的主键。 */@@ -52,7 +49,8 @@ export const PLUGIN_ID = 'dsh-tauri'export const PLUGIN_INJECT = ['layout']export const SIDEBAR_TWEAKS_STYLE_ID = 'dsh-tauri:sidebar-tweaks'export const SIDEBAR_TWEAKS_EFFECT_ID = 'dsh-tauri: sidebar tweaks (hide collapse toggle, center brand)'-export const NAV_BRIDGE_EFFECT_ID = 'dsh-tauri: nav bridge'+export const SIDEBAR_TOGGLE_EFFECT_ID = 'dsh-tauri: sidebar (toggle command + collapsed report)'+export const ZOOM_SHORTCUT_EFFECT_ID = 'dsh-tauri: zoom shortcuts (ctrl/cmd +/-/0)'/** 侧边栏稳定 ARIA 选择器。 */export const COLLAPSE_SIDEBAR_SELECTOR = 'button[aria-label="收起侧边栏"],button[aria-label="Collapse sidebar"]'diff --git a/packages/dsh-tauri/src/client/hooks/use-invoke.ts b/packages/dsh-tauri/src/client/hooks/use-invoke.tsnew file mode 100644index 00000000..657e92e9--- /dev/null+++ b/packages/dsh-tauri/src/client/hooks/use-invoke.ts@@ -0,0 +1,71 @@+import type { InvokeArgs, InvokeOptions } from '../types'+import { useEffect, useRef, useState } from 'react'+import { invoke } from '../service/invoke'++export interface UseInvokeResult<T> {+ /** command 成功返回值;未完成/失败时为 null。 */+ data: T | null+ loading: boolean+ /** 失败原因(`NODE_NOT_ANSWERED: …` / command 抛出的字符串);成功时为 null。 */+ error: string | null+}++/**+ * 调用一次宿主侧 Tauri command 并把结果交给组件(`invoke` 的 React 版)。+ *+ * 只做「读一次」:`cmd`(或 `args` 的内容)变化时重新调用,卸载后丢弃结果。+ * 变更类调用(写设置、触发动作)请在事件回调里直接 `invoke`,不要用本 hook。+ *+ * 参数与依赖:+ * - `args` / `options` 经 ref 转发,**不**参与 effect 依赖(对象字面量每次渲染都是新引用,+ * 直接用引用做依赖会每帧重发请求并自我循环);重发条件按 `args` 的 JSON 串判断,+ * 因此 `args` 必须是可结构化克隆的普通数据(桥的既有约束);+ * - 失败不静默:登记到 `error`,调用方决定展示方式(同时 console 一条便于排查)。+ *+ * @example+ * const { data: pets, loading } = useInvoke<PetListItem[]>('list_pets', { source: 'chat' })+ */+export function useInvoke<T>(cmd: string, args?: InvokeArgs, options?: InvokeOptions): UseInvokeResult<T> {+ const [data, setData] = useState<T | null>(null)+ const [loading, setLoading] = useState(true)+ const [error, setError] = useState<string | null>(null)++ const argsRef = useRef(args)+ const optionsRef = useRef(options)+ argsRef.current = args+ optionsRef.current = options++ // 重发键:cmd + args 内容(同一内容的新对象不重发)+ const argsKey = args === undefined ? '' : JSON.stringify(args)++ useEffect(() => {+ let cancelled = false+ setLoading(true)+ setError(null)++ invoke<T>(cmd, argsRef.current, optionsRef.current)+ .then((value) => {+ if (cancelled)+ return+ setData(value)+ })+ .catch((reason: unknown) => {+ if (cancelled)+ return+ const message = reason instanceof Error ? reason.message : String(reason)+ console.error(`[useInvoke] ${cmd} failed:`, reason)+ setError(message)+ })+ .finally(() => {+ if (!cancelled)+ setLoading(false)+ })++ return () => {+ cancelled = true+ }+ // argsKey 是 args 的归一化依赖;args/options 本体经 ref 读取+ }, [cmd, argsKey])++ return { data, loading, error }+}diff --git a/packages/dsh-tauri/src/client/hooks/use-listen-parent.ts b/packages/dsh-tauri/src/client/hooks/use-listen-parent.tsnew file mode 100644index 00000000..ba01a786--- /dev/null+++ b/packages/dsh-tauri/src/client/hooks/use-listen-parent.ts@@ -0,0 +1,32 @@+import type { ParentMessage, ParentMessageTypes } from '../types'+import { useEffect, useRef } from 'react'+import { listenParent } from '../service/listen-parent'++/** 「监听主窗口消息」的过滤条件:省略表示监听全部消息。 */+export type UseListenParentTypes = ParentMessageTypes | undefined++/**+ * React 版的 `listenParent`:组件挂载时监听主窗口(宿主)消息,卸载时自动取消。+ *+ * - 回调经 ref 转发(latest ref),调用方写内联函数不会导致反复重订阅;+ * - `types` 只在「归一化后的 key」变化时重订阅(数组字面量每次渲染都是新引用,+ * 直接用引用做依赖会每帧重订阅);+ * - 与 `service/listen.ts` 的 Tauri 语义不同:这里收的是**桥原始消息**(按 `type`+ * 过滤自己那一档),适合插件自有协议;要订阅宿主转发的 Tauri 事件用 `listen`。+ */+export function useListenParent<T extends ParentMessage>(+ types: UseListenParentTypes,+ handler: (message: T) => void,+): void {+ const handlerRef = useRef(handler)+ handlerRef.current = handler++ const typesKey = types === undefined ? '' : (typeof types === 'string' ? types : types.join('\u0000'))++ useEffect(+ () => listenParent<T>(message => handlerRef.current(message), types),+ // types 的引用不稳定,用归一化 key 作为依赖(语义等价:同一组 type 不重订阅)+ // eslint-disable-next-line react/exhaustive-deps+ [typesKey],+ )+}diff --git a/packages/dsh-tauri/src/client/hooks/use-listen.ts b/packages/dsh-tauri/src/client/hooks/use-listen.tsnew file mode 100644index 00000000..7eae6bcc--- /dev/null+++ b/packages/dsh-tauri/src/client/hooks/use-listen.ts@@ -0,0 +1,42 @@+import type { EventCallback, Options, UnlistenFn } from '../types'+import { useEffect, useRef } from 'react'+import { listen } from '../service/listen'++/**+ * 订阅一个「宿主转发进 iframe 的 Tauri 事件」,卸载时自动注销。+ *+ * - 语义对齐 `service/listen`(签名同 `@tauri-apps/api/event` 的 `listen`),+ * 回调与 options 经 ref 转发(latest ref),调用方写内联函数不会反复重订阅,+ * 只在 `event` 变化时重新订阅;+ * - 竞态防护:`listen` 返回 Promise,若在 resolve 前组件已卸载则立即注销,+ * 避免监听泄漏;+ * - 唯一的 effect 只负责注册/注销(需要清理),无其它副作用。+ *+ * @example+ * useListen<PetStatus>('pet://status', event => setStatus(event.payload))+ */+export function useListen<T>(event: string, handler: EventCallback<T>, options?: Options): void {+ const handlerRef = useRef(handler)+ const optionsRef = useRef(options)+ handlerRef.current = handler+ optionsRef.current = options++ useEffect(() => {+ let unlisten: UnlistenFn | undefined+ let disposed = false++ void listen<T>(event, tauriEvent => handlerRef.current(tauriEvent), optionsRef.current)+ .then((fn) => {+ if (disposed)+ fn()+ else+ unlisten = fn+ })+ .catch(err => console.error(`[useListen] failed to listen ${event}:`, err))++ return () => {+ disposed = true+ unlisten?.()+ }+ }, [event])+}diff --git a/packages/dsh-tauri/src/client/index.ts b/packages/dsh-tauri/src/client/index.tsindex ac3dedff..aebcac0b 100644--- a/packages/dsh-tauri/src/client/index.ts+++ b/packages/dsh-tauri/src/client/index.ts@@ -8,6 +8,12 @@* - storage:unstorage createStorage / localStorageDriver;* - controller:hookable 生命周期控制器(observer/timer/listener 收敛);* - CssRender:css-render 样式树(各插件 mount*Styles 使用)。+ *+ * 父窗口桥(iframe ↔ 桌面宿主)**唯一入口**,自定义桥一律用这几个:+ * - `invoke`:调用宿主侧的 Tauri command(签名同 `@tauri-apps/api/core`);+ * - `listen`:订阅宿主转发进来的 Tauri 事件(签名同 `@tauri-apps/api/event`);+ * - `invokeParent` / `listenParent`:自定义协议的裸收发原语;+ * - `useInvoke` / `useListen` / `useListenParent`:上面三者的 React 版本。*/import { PLUGIN_ID, PLUGIN_INJECT } from './constants'@@ -20,7 +26,15 @@ export const inject = PLUGIN_INJECTexport * from './apis'export { apply } from './apply'export * from './controller'-export { invokeBridgedTauri } from './service/invoke'+export { useInvoke } from './hooks/use-invoke'+export type { UseInvokeResult } from './hooks/use-invoke'+export { useListen } from './hooks/use-listen'+export { useListenParent } from './hooks/use-listen-parent'+export { invoke } from './service/invoke'+export { invokeParent } from './service/invoke-parent'+export type { InvokeParentResult } from './service/invoke-parent'+export { listen } from './service/listen'+export { listenParent } from './service/listen-parent'export * from './storage'export * from './store'diff --git a/packages/dsh-tauri/src/client/register/sidebar.ts b/packages/dsh-tauri/src/client/register/sidebar.tsnew file mode 100644index 00000000..10476d8d--- /dev/null+++ b/packages/dsh-tauri/src/client/register/sidebar.ts@@ -0,0 +1,81 @@+/**+ * register/sidebar.ts — 侧边栏(宿主顶部导航栏 ↔ iframe),两个方向各一件事:+ *+ * - 宿主 → iframe:导航栏开关把 `dsh://sidebar:toggle` 发进来,用 dsh 应用自己的布局+ * 服务(`ctx.layout.toggleSidebar()`)执行切换 —— 不依赖 DOM 结构与界面文案;+ * - iframe → 宿主:观察 AppFrame 的 `data-sidebar-collapsed`,变化即回报+ * `dsh://sidebar:collapsed`,供宿主导航栏同步折叠图标。+ *+ * 桌面端不再注入导航桥脚本(`NAV_SHIM_JS`):切换与折叠回报都由本注册承担,+ * 插件缺席时导航栏本来也不渲染侧边栏控件(宿主按 dsh-tauri 是否已安装判断)。+ */+import {+ CMD_TOGGLE,+ EVENT_SIDEBAR_COLLAPSED,+ SIDEBAR_COLLAPSED_ATTRIBUTE,+ SIDEBAR_FRAME_SELECTOR,+ SIDEBAR_TRACK_INTERVAL_MS,+ SIDEBAR_TRACK_MAX_TRIES,+} from '../constants'+import { createLifecycleController } from '../controller'+import { invokeParent } from '../service/invoke-parent'+import { listenParent } from '../service/listen-parent'+import { reportPluginError } from '../utils/error'++/** AppFrame:dsh 应用布局的根(`data-shell-overlay` 的父节点)。 */+function findFrame(): HTMLElement | null {+ const overlay = document.querySelector<HTMLElement>(SIDEBAR_FRAME_SELECTOR)+ return overlay?.parentElement ?? null+}++/**+ * 注册侧边栏切换(宿主命令 → dsh 布局服务)与折叠状态回报(dsh → 宿主)。+ * @param toggleSidebar 切换动作(插件体注入 `ctx.layout.toggleSidebar`)。+ * @returns 卸载函数(注销命令监听、折叠观察与补报轮询)。+ */+export function registerSidebarToggle(toggleSidebar: () => void): () => void {+ const controller = createLifecycleController()++ /** 折叠状态回报(幂等:宿主只把它写进状态) */+ function reportCollapsed(): void {+ invokeParent({+ type: EVENT_SIDEBAR_COLLAPSED,+ collapsed: !!findFrame()?.hasAttribute(SIDEBAR_COLLAPSED_ATTRIBUTE),+ })+ }++ // 宿主命令:切换侧边栏+ controller.add(listenParent<{ type?: string }>((data) => {+ if (data.type !== CMD_TOGGLE)+ return+ try {+ toggleSidebar()+ }+ catch (error) {+ // 布局服务抛错:上报宿主(插件面板据此显示异常标记),不影响后续命令+ reportPluginError(error, 'runtime')+ }+ }, [CMD_TOGGLE]))++ // 折叠状态:属性翻转即回报(AppFrame 出现后属性变化都会命中)+ controller.observe(document.body, {+ attributes: true,+ attributeFilter: [SIDEBAR_COLLAPSED_ATTRIBUTE],+ subtree: true,+ }, reportCollapsed)++ // 首次回报:应用早于插件挂载时属性不会产生变化事件;+ // 应用晚挂载则轮询到 AppFrame 出现为止(有界,拿到即停)。+ reportCollapsed()+ let tries = 0+ const stopPoll = controller.interval(() => {+ const ready = !!findFrame()+ if (ready || ++tries > SIDEBAR_TRACK_MAX_TRIES) {+ if (ready)+ reportCollapsed()+ stopPoll()+ }+ }, SIDEBAR_TRACK_INTERVAL_MS)++ return () => controller.dispose()+}diff --git a/packages/dsh-tauri/src/client/register/zoom-shortcut.ts b/packages/dsh-tauri/src/client/register/zoom-shortcut.tsnew file mode 100644index 00000000..1e341512--- /dev/null+++ b/packages/dsh-tauri/src/client/register/zoom-shortcut.ts@@ -0,0 +1,31 @@+/**+ * register/zoom-shortcut.ts — iframe 内的缩放快捷键(Ctrl/Cmd + `+` / `-` / `0`)。+ *+ * 跨域 iframe 里的按键不会冒泡到桌面壳层,因此由本注册在 iframe 内以捕获阶段监听,+ * 命中后 `preventDefault` 并经父窗口桥上报动作;宿主(`layout/components/iframe.tsx`+ * 的 `dsh://zoom-shortcut` 分支)把它写进 `store.setting.zoom_factor` 真值,再由+ * `useZoomFactor` 应用到 WebView。+ *+ * 壳层自身获得焦点时的快捷键由宿主自己的监听处理,两端口径一致(见 `utils/zoom.ts`)。+ * 桌面端不再注入 `ZOOM_SHORTCUT_BRIDGE_JS`:插件在场即由本注册承担。+ */+import { TYPE_ZOOM_SHORTCUT } from '../constants'+import { invokeParent } from '../service/invoke-parent'+import { zoomActionFromShortcut } from '../utils/zoom'++/**+ * 注册缩放快捷键:捕获 iframe 内的缩放按键并上报宿主。+ * @returns 卸载函数。+ */+export function registerZoomShortcut(): () => void {+ function onKeyDown(event: KeyboardEvent): void {+ const action = zoomActionFromShortcut(event)+ if (!action)+ return+ event.preventDefault()+ invokeParent({ type: TYPE_ZOOM_SHORTCUT, action })+ }++ window.addEventListener('keydown', onKeyDown, { capture: true })+ return () => window.removeEventListener('keydown', onKeyDown, { capture: true })+}diff --git a/packages/dsh-tauri/src/client/service/bridge.ts b/packages/dsh-tauri/src/client/service/bridge.tsdeleted file mode 100644index 8f74e567..00000000--- a/packages/dsh-tauri/src/client/service/bridge.ts+++ /dev/null@@ -1,263 +0,0 @@-/**- * 导航桥核心(iframe 内):宿主(桌面壳层 ShellNavBar)↔ dsh 应用的消息协议。- *- * 消息(postMessage,双向):- * - 宿主 → iframe(命令):`{ source: 'dsh-desktop', type }`- * - `dsh://sidebar:toggle` 切换侧边栏(转发 ctx.layout.toggleSidebar)- * - `dsh://page:prev` 后退(会话访问栈回退)- * - `dsh://page:next` 前进(会话访问栈前进)- * - iframe → 宿主(事件):`{ source: 'dsh-nav-bridge', type, ... }`- * - `dsh://sidebar:collapsed` `{ collapsed }` 侧边栏折叠状态- * - `dsh://page:firsted` `{ firsted }` 已到访问栈最前(宿主应禁用后退)- * - `dsh://page:lasted` `{ lasted }` 已到访问栈最后(宿主应禁用前进)- *- * 页面模型:dsh 应用不产生浏览器历史(无 pushState/hash 路由),因此「页面」=- * 侧边栏当前选中的会话(`[role="treeitem"][aria-selected="true"]`)。本桥观察- * 选中会话变化维护一个**会话访问栈**(纯内存):用户点击会话 → 截断前进记录后- * 追加新页并上报;后退/前进 → 点击栈内对应会话行让应用切回。- *- * 本桥与桌面端注入脚本(NAV_SHIM_JS)语义完全一致;插件加载后设置- * `window.__dsh_tauri_bridge__`,注入脚本据此让位(避免命令/事件双重执行)。- * 宿主仅接受 iframe 直接发来的消息(event.source === window.parent)。- *- * 桥内代码路径(观测器回调、导航、命令分发)统一经 `error.ts` 上报宿主:- * key 与桌面端 `use-iframe-shim.ts` 校验保持一致,宿主持久化后「插件」面板- * 显示 danger 标记,避免静默失败。- *- * 生命周期(Controller 化):两个 MutationObserver、应用晚挂载轮询 interval、- * message 监听与接管标记全部登记进 createLifecycleController;卸载即一次 dispose。- */-import type { NavBridgeHandlers, Page } from '../types'-import {- CMD_NEXT,- CMD_PREV,- CMD_TOGGLE,- EVENT_PAGE_FIRSTED,- EVENT_PAGE_LASTED,- EVENT_SIDEBAR_COLLAPSED,- SESSION_LABEL_PATTERNS,- SRC_BRIDGE,- SRC_HOST,- TRACK_INTERVAL_MS,- TRACK_MAX_TRIES,-} from '../constants'-import { createLifecycleController } from '../controller'-import { guard, reportPluginError } from '../utils/error'--export type { NavBridgeHandlers } from '../types'--/**- * 安装导航桥:设置接管标记、挂载命令监听、侧边栏状态观察与会话访问栈跟踪。- * @returns 卸载函数(插件重载/停用时清理,桌面端注入脚本随即恢复接管)。- */-export function setupNavBridge(handlers: NavBridgeHandlers): () => void {- const controller = createLifecycleController()-- // 接管标记:置位后桌面端 NAV_SHIM_JS 的命令与事件都让位(卸载时随控制器复位)。- window.__dsh_tauri_bridge__ = true- controller.add(() => delete window.__dsh_tauri_bridge__)-- function post(message: Record<string, unknown>): void {- try {- window.parent.postMessage(Object.assign({ source: SRC_BRIDGE }, message), '*')- }- catch {- // 宿主已销毁等场景静默- }- }-- // ── AppFrame:dsh 应用布局的根(shell.overlay 的父节点)───────- function findFrame(): HTMLElement | null {- const overlay = document.querySelector<HTMLElement>('[data-shell-overlay]')- return overlay ? (overlay.parentElement as HTMLElement | null) : null- }-- // ── 侧边栏折叠状态(观察 AppFrame 的 data-sidebar-collapsed)────- function collapsedOf(): boolean {- const frame = findFrame()- return !!(frame && frame.hasAttribute('data-sidebar-collapsed'))- }-- // 折叠状态观察挂在 body 全树(attributeFilter 限定),AppFrame 出现即生效。- controller.observe(document.body, {- childList: true,- subtree: true,- attributes: true,- attributeFilter: ['data-sidebar-collapsed'],- }, guard(() => {- post({ type: EVENT_SIDEBAR_COLLAPSED, collapsed: collapsedOf() })- }))-- // ── 会话访问栈(页面模型,纯内存)────────────────────────────- let pages: Page[] = []- let position = 0- let lastKey: string | null = null- /** 本桥触发的导航(后退/前进)落位中,观察器不应记录新页面。 */- let suppress = false-- // 当前选中的会话行(AppFrame 侧边栏列内)- function currentSelected(): HTMLElement | null {- const frame = findFrame()- const col = frame ? frame.firstElementChild : null- if (!col)- return null- return col.querySelector<HTMLElement>('[role="treeitem"][aria-selected="true"]')- }-- // 行标题:从行内菜单按钮 aria-label 提取(zh/en),失败回退整行文本- function rowTitle(row: HTMLElement | null): string {- if (!row)- return ''- const btn = row.querySelector<HTMLButtonElement>('button[aria-label]')- const label = btn ? (btn.getAttribute('aria-label') || '') : ''- for (const pattern of SESSION_LABEL_PATTERNS) {- const match = pattern.exec(label)- if (match)- return match[1]!.trim()- }- return label || (row.textContent || '').trim()- }-- // 按标题找会话行(行元素被重建后的兜底)- function findRowByTitle(title: string): HTMLElement | null {- if (!title)- return null- const frame = findFrame()- const col = frame ? frame.firstElementChild : null- if (!col)- return null- const rows = col.querySelectorAll<HTMLElement>('[role="treeitem"]')- for (const row of rows) {- if (rowTitle(row) === title)- return row- }- return null- }-- function reportPage(): void {- post({ type: EVENT_PAGE_FIRSTED, firsted: position <= 0 })- post({ type: EVENT_PAGE_LASTED, lasted: position >= pages.length - 1 })- }-- // 用户导航到新会话:截断前进记录后追加- function pushPage(key: string, el: HTMLElement | null): void {- pages = pages.slice(0, position + 1).concat([{ key, el }])- position = pages.length - 1- reportPage()- }-- // 后退/前进:切到栈内目标页(点击对应会话行让应用落位)- function navigateTo(index: number): void {- try {- if (index < 0 || index >= pages.length)- return- const page = pages[index]!- position = index- const target = page.el && page.el.isConnected ? page.el : findRowByTitle(page.key ?? '')- if (target) {- suppress = true- target.click()- }- reportPage()- }- catch (error) {- // 行元素被重建/点击触发应用异常等:上报宿主,栈内记录保持一致- reportPluginError(error, 'runtime')- }- }-- const onDomChange = guard(() => {- const sel = currentSelected()- const key = rowTitle(sel)- if (key === lastKey)- return- lastKey = key- if (suppress) {- // 本桥导航落位:同步当前页记录(行元素可能被 React 重建)- suppress = false- if (pages[position] !== undefined) {- pages[position] = { key, el: sel }- }- return- }- // 用户主动切换会话(无选中 = 欢迎/归档态,不入栈)- if (key)- pushPage(key, sel)- })-- controller.observe(document.body, {- childList: true,- subtree: true,- attributes: true,- attributeFilter: ['aria-selected'],- }, onDomChange)-- // 初始化:应用挂载前无会话树,轮询补报直到拿到 AppFrame- function startTrack(): boolean {- try {- const frame = findFrame()- if (!frame)- return false- // sidebarObserver 已在 body 上观察(属性过滤在全树生效),无需换挂载点。- post({ type: EVENT_SIDEBAR_COLLAPSED, collapsed: collapsedOf() })-- const sel = currentSelected()- const key = rowTitle(sel)- lastKey = key- // 根页:当前选中的会话(无选中时以「欢迎页」为根,首个会话打开即入栈)- pages = [{ key: key || null, el: sel }]- position = 0- reportPage()- return true- }- catch (error) {- // 布局结构异常等:上报宿主并返回 false,轮询会继续补报直到成功- reportPluginError(error, 'runtime')- return false- }- }-- // ── 宿主命令接收 ──────────────────────────────────────────────- function onMessage(event: MessageEvent<unknown>): void {- // 只接受宿主窗口直发的命令;不兼容多层嵌套 iframe- if (event.source !== window.parent)- return- const data = event.data as { source?: string, type?: string } | null- if (!data || typeof data !== 'object' || data.source !== SRC_HOST)- return- try {- switch (data.type) {- case CMD_TOGGLE:- handlers.toggleSidebar()- break- case CMD_PREV:- navigateTo(position - 1)- break- case CMD_NEXT:- navigateTo(position + 1)- break- }- }- catch (error) {- // 命令处理(layout 切换/导航)抛错:上报宿主,不中断后续命令- reportPluginError(error, 'runtime')- }- }- // message 事件目标为 window(不经 document 冒泡),监听本身按控制器登记清理。- window.addEventListener('message', onMessage)- controller.add(() => {- window.removeEventListener('message', onMessage)- })-- // ── 初始化 + 应用晚挂载的轮询补报(controller 管理 interval)───- if (!startTrack()) {- let tries = 0- const stopPoll = controller.interval(() => {- if (startTrack() || ++tries > TRACK_MAX_TRIES)- stopPoll()- }, TRACK_INTERVAL_MS)- }-- // ── 卸载:控制器一次性清理(观察器 / interval / 监听 / 接管标记)──- return () => controller.dispose()-}diff --git a/packages/dsh-tauri/src/client/service/invoke-parent.ts b/packages/dsh-tauri/src/client/service/invoke-parent.tsnew file mode 100644index 00000000..2a7fe384--- /dev/null+++ b/packages/dsh-tauri/src/client/service/invoke-parent.ts@@ -0,0 +1,33 @@+import type { ParentMessage } from '../types'++/** 发送结果:`ok=false` 表示未送达(没有宿主 / payload 不可结构化克隆)。 */+export interface InvokeParentResult {+ ok: boolean+ /** `ok=false` 时的原因(postMessage 抛出的原始错误)。 */+ error?: unknown+}++/**+ * 向主窗口(宿主)发送一条桥消息 —— iframe 侧**发消息的唯一出口**。+ *+ * 只负责发送(fire-and-forget):需要应答时配合 `listenParent` 按 nonce 匹配,+ * 见 `service/invoke.ts` 的 invoke 桥。+ *+ * 自身**不抛错**,用返回值表达失败:没有宿主(顶层窗口 `window.parent === window`)+ * 或宿主已销毁 / payload 不可克隆时返回 `{ ok: false, error }`。fire-and-forget 的+ * 调用方(导航桥、错误上报)忽略返回值即可;需要知道送达结果的调用方(invoke 桥)+ * 据此立即失败,而不是干等到超时。+ *+ * 所有自定义桥都必须经本函数发消息,不要各自写 `window.parent.postMessage(…)`。+ */+export function invokeParent(message: ParentMessage): InvokeParentResult {+ if (typeof window === 'undefined' || window.parent === window)+ return { ok: false, error: new Error('NO_HOST: parent window is not available') }+ try {+ window.parent.postMessage(message, '*')+ return { ok: true }+ }+ catch (error) {+ return { ok: false, error }+ }+}diff --git a/packages/dsh-tauri/src/client/service/invoke.test.ts b/packages/dsh-tauri/src/client/service/invoke.test.tsindex a16ead03..4727e684 100644--- a/packages/dsh-tauri/src/client/service/invoke.test.ts+++ b/packages/dsh-tauri/src/client/service/invoke.test.ts@@ -6,7 +6,7 @@ import {SRC_INVOKE_REPLY,TYPE_INVOKE_REPLY,} from '../constants'-import { invokeBridgedTauri } from './invoke'+import { invoke } from './invoke'/*** 构造一个最小的 window 替身:parent 作为宿主接收 postMessage,按类型独立收集@@ -37,7 +37,7 @@ function makeWindow() {return { win, parent, dispatchReply: win.dispatchReply }}-describe('dsh-tauri invokeBridgedTauri', () => {+describe('dsh-tauri invoke', () => {let win: ReturnType<typeof makeWindow>['win']let parent: ReturnType<typeof makeWindow>['parent']let dispatchReply: ReturnType<typeof makeWindow>['dispatchReply']@@ -61,7 +61,7 @@ describe('dsh-tauri invokeBridgedTauri', () => {}it('成功应答时 resolve,并立刻清理超时计时器', async () => {- const promise = invokeBridgedTauri<{ enabled: boolean }>('get_pet_status', { a: 1 })+ const promise = invoke<{ enabled: boolean }>('get_pet_status', { a: 1 })// postMessage 发出请求,且只留有这一个超时计时器(正是要清理的目标)expect(vi.getTimerCount()).toBe(1)const request = postedRequest()@@ -79,7 +79,7 @@ describe('dsh-tauri invokeBridgedTauri', () => {})it('错误应答时 reject,并清理超时计时器与监听器', async () => {- const promise = invokeBridgedTauri('set_pet_enabled', { enabled: true })+ const promise = invoke('set_pet_enabled', { enabled: true })const request = postedRequest()expect(vi.getTimerCount()).toBe(1)@@ -93,7 +93,7 @@ describe('dsh-tauri invokeBridgedTauri', () => {})it('宿主 15s 未应答时超时 reject,且无残留计时器', async () => {- const promise = invokeBridgedTauri('get_pet_status')+ const promise = invoke('get_pet_status')postedRequest()expect(vi.getTimerCount()).toBe(1)@@ -107,7 +107,7 @@ describe('dsh-tauri invokeBridgedTauri', () => {parent.postMessage.mockImplementation(() => {throw new Error('DataCloneError: stored value cannot be cloned')})- const promise = invokeBridgedTauri('get_pet_status', { session: { loop: true } })+ const promise = invoke('get_pet_status', { session: { loop: true } })// postMessage 抛错时不应发出任何东西,计时器也必须被清除await expect(promise).rejects.toThrow('DataCloneError')expect(vi.getTimerCount()).toBe(0)diff --git a/packages/dsh-tauri/src/client/service/invoke.ts b/packages/dsh-tauri/src/client/service/invoke.tsindex dde742dc..74520962 100644--- a/packages/dsh-tauri/src/client/service/invoke.ts+++ b/packages/dsh-tauri/src/client/service/invoke.ts@@ -1,11 +1,15 @@-import type { InvokeBridgeReply, InvokeBridgeRequest } from '../types'+import type { InvokeArgs, InvokeBridgeReply, InvokeBridgeRequest, InvokeOptions } from '../types'+import { INVOKE_TIMEOUT_MS, PLUGIN_ID, SRC_INVOKE, TYPE_INVOKE, TYPE_INVOKE_REPLY } from '../constants'+import { invokeParent } from './invoke-parent'+import { listenParent } from './listen-parent'+/*** dsh-tauri invoke 桥(iframe 侧客户端)。** iframe 内的 dsh 界面 / 插件没有 `__TAURI_INTERNALS__`(只有顶层 webview 有),* 因此无法直接 `import { invoke } from '@tauri-apps/api/core'`。本桥把这些调用* 经 postMessage 转发到宿主(主 webview)的监听器(见桌面端- * `src/hooks/use-iframe-invoke.ts`),由宿主调用 Tauri `invoke` 并把结果回传。+ * `src/hooks/use-invoke-iframe.ts`),由宿主调用 Tauri `invoke` 并把结果回传。** 协议(与宿主监听器逐字一致):* iframe → 宿主:{ source: 'dsh-tauri-invoke', type: 'dsh://tauri:invoke',@@ -13,10 +17,9 @@ import type { InvokeBridgeReply, InvokeBridgeRequest } from '../types'* 宿主 → iframe:{ source: 'dsh-desktop-invoke', type: 'dsh://tauri:reply',* nonce, ok, value | error }*- * 可靠性:每条请求带唯一 nonce,应答按 nonce 精确匹配避免串线;等待超时- * (INVOKE_TIMEOUT_MS)或局部失败统一 reject,并登记进宿主错误注册表便于排查。+ * 收发都走父窗口桥原语(`invokeParent` / `listenParent`),本文件只负责+ * nonce 匹配、超时与错误归一。*/-import { INVOKE_TIMEOUT_MS, PLUGIN_ID, SRC_INVOKE, SRC_INVOKE_REPLY, TYPE_INVOKE, TYPE_INVOKE_REPLY } from '../constants'let nonceSeq = 0@@ -29,13 +32,18 @@ function nextNonce(): string {/*** 经宿主桥调用一个 Tauri command,返回其成功值;command 抛错或超时时 reject。*- * @param cmd Tauri command 名(如 `get_pet_status`)- * @param args command 参数对象(可选)+ * 签名与 `@tauri-apps/api/core` 的 `invoke` 保持一致(`cmd` / `args` / `options`),+ * 便于把 `import { invoke } from '@tauri-apps/api/core'` 原地换成此实现;+ * `options.headers` 不被桥转发(宿主直接调用 command),仅为签名一致而保留。+ *+ * @param cmd Tauri command 名(如 `get_pet_status`)+ * @param args command 参数(对象 / 数字数组 / ArrayBuffer / Uint8Array)* @typeParam T command 成功返回值的类型*/-export function invokeBridgedTauri<T>(+export function invoke<T>(cmd: string,- args?: Record<string, unknown>,+ args?: InvokeArgs,+ _options?: InvokeOptions,): Promise<T> {const nonce = nextNonce()@@ -45,17 +53,12 @@ export function invokeBridgedTauri<T>(// 成功调用留下一 15s 的休眠超时闭包(见 issue #396 前端延迟根因之一)。let timer: ReturnType<typeof setTimeout> | undefined- function onMessage(event: MessageEvent<unknown>): void {- // 只接受宿主(顶层)直接发回的应答,且 nonce 必须命中本次请求- if (event.source !== window.parent)- return- const data = event.data as InvokeBridgeReply | null- if (!data || typeof data !== 'object' || data.source !== SRC_INVOKE_REPLY)+ // 只接受宿主回传且 nonce 命中本次请求的应答(来源由 listenParent 校验)+ const unlisten = listenParent<InvokeBridgeReply>((reply) => {+ if (reply.type !== TYPE_INVOKE_REPLY || reply.nonce !== nonce)return- if (data.type !== TYPE_INVOKE_REPLY || data.nonce !== nonce)- return- settle(data)- }+ settle(reply)+ })function settle(reply: InvokeBridgeReply): void {if (settled)@@ -64,7 +67,7 @@ export function invokeBridgedTauri<T>(if (timer !== undefined)clearTimeout(timer)// issue #396 修复:完成路径(成功/失败)都必须清理超时计时器,避免高频成功调用遗留「休眠超时闭包」。- window.removeEventListener('message', onMessage)+ unlisten()if (reply.ok) {resolve(reply.value as T)}@@ -73,12 +76,11 @@ export function invokeBridgedTauri<T>(}}- window.addEventListener('message', onMessage)// 超时保护:宿主未应答(监听器未挂载/iframe 非 dsh 环境等)时按失败处理timer = setTimeout(() => {if (settled)return- window.removeEventListener('message', onMessage)+ unlisten()settled = truereject(new Error(`NODE_NOT_ANSWERED: invoke ${cmd} timed out`))}, INVOKE_TIMEOUT_MS)@@ -90,17 +92,16 @@ export function invokeBridgedTauri<T>(args,nonce,}- try {- window.parent.postMessage(request, '*')- }- catch (error) {+ // 未送达(无宿主 / payload 不可克隆)时立即失败,不等超时+ const sent = invokeParent(request)+ if (!sent.ok) {if (timer !== undefined)clearTimeout(timer)if (settled)returnsettled = true- window.removeEventListener('message', onMessage)- reject(error)+ unlisten()+ reject(sent.error ?? new Error(`NODE_NOT_ANSWERED: invoke ${cmd} not delivered`))}})}diff --git a/packages/dsh-tauri/src/client/service/listen-parent.ts b/packages/dsh-tauri/src/client/service/listen-parent.tsnew file mode 100644index 00000000..3e70a93f--- /dev/null+++ b/packages/dsh-tauri/src/client/service/listen-parent.ts@@ -0,0 +1,40 @@+import type { ParentMessage, ParentMessageContext, ParentMessageTypes, UnlistenFn } from '../types'++function matchesType(type: string | undefined, types: ParentMessageTypes): boolean {+ return typeof types === 'string' ? type === types : types.includes(type ?? '')+}++/**+ * 监听主窗口(宿主)发来的消息 —— iframe 侧**收消息的唯一入口**。+ *+ * 只做安全相关的两道校验:+ * 1. `event.source === window.parent`:宿主是本 iframe 唯一的直接父窗口,兄弟 iframe+ * 或页面内第三方脚本无法伪造该 source;+ * 2. 可选 `types` 过滤:按 `type` 分发(宿主侧已不比对 `source`,客户端同样只认 `type`)。+ *+ * 所有自定义桥(导航、错误上报、插件自有协议)都必须经本函数收消息,+ * 不要各自写 `window.addEventListener('message', …)`。+ *+ * @returns 取消监听的函数(与 `@tauri-apps/api/event` 的 `listen` 返回形态一致)+ */+export function listenParent<T extends ParentMessage>(+ handler: (message: T, context: ParentMessageContext) => void,+ types?: ParentMessageTypes,+): UnlistenFn {+ function onMessage(event: MessageEvent<unknown>): void {+ if (event.source !== window.parent)+ return+ const data = event.data+ if (!data || typeof data !== 'object')+ return+ const message = data as ParentMessage+ if (types !== undefined && !matchesType(message.type, types))+ return+ handler(message as T, { event })+ }++ window.addEventListener('message', onMessage)+ return () => {+ window.removeEventListener('message', onMessage)+ }+}diff --git a/packages/dsh-tauri/src/client/service/listen.ts b/packages/dsh-tauri/src/client/service/listen.tsnew file mode 100644index 00000000..f67c874a--- /dev/null+++ b/packages/dsh-tauri/src/client/service/listen.ts@@ -0,0 +1,36 @@+import type { EventCallback, Options, TauriEvent, TauriEventBridgeMessage, UnlistenFn } from '../types'+import { TYPE_EVENT } from '../constants'+import { listenParent } from './listen-parent'++/**+ * 订阅一个「宿主转发进 iframe 的 Tauri 事件」。+ *+ * iframe 内的插件没有 `__TAURI_INTERNALS__`,无法直接 `import { listen } from+ * '@tauri-apps/api/event'`;由宿主(主 webview)订阅 Tauri 事件后按协议转发进来:+ *+ * 宿主 → iframe:{ source: 'dsh-desktop', type: 'dsh://tauri:event', event, payload }+ *+ * 桌面端的配对写法(`src/layout/components/iframe.tsx` 一类的宿主代码):+ * `useListenIframe(iframeRef, event, payload => ({ type: 'dsh://tauri:event', event, payload }))`+ *+ * 签名与 `@tauri-apps/api/event` 的 `listen` 保持一致(含返回 `Promise<UnlistenFn>`),+ * 便于调用方按同一种写法使用;`options.target` 目前不生效(桥只转发到当前 iframe)。+ */+export function listen<T>(+ event: string,+ handler: EventCallback<T>,+ _options?: Options,+): Promise<UnlistenFn> {+ const unlisten = listenParent<TauriEventBridgeMessage<T>>((message) => {+ if (message.event !== event)+ return+ handler({+ event: message.event,+ // 宿主未提供 id 时回落 0(Tauri 的 Event.id 为数字,此处保持一致形状)+ id: typeof message.id === 'number' ? message.id : 0,+ payload: message.payload,+ } satisfies TauriEvent<T>)+ }, TYPE_EVENT)++ return Promise.resolve(unlisten)+}diff --git a/packages/dsh-tauri/src/client/types/bridge.ts b/packages/dsh-tauri/src/client/types/bridge.tsindex 61c20950..f73af7bb 100644--- a/packages/dsh-tauri/src/client/types/bridge.ts+++ b/packages/dsh-tauri/src/client/types/bridge.ts@@ -1,32 +1,82 @@-/** 宿主命令所需的业务面(由插件体注入 ctx.layout)。 */-export interface NavBridgeHandlers {- toggleSidebar: () => void+/** 记录动作(与宿主 `PluginError.action` 语义一致)。 */+export type ErrorAction = 'runtime' | 'install' | 'update' | 'remove'++// ── 父窗口桥(iframe ↔ 主窗口)共同的信封与形态 ────────────────────+/**+ * 主窗口(宿主)与 iframe 之间传递的桥消息(最小信封,按 `type` 分发)。+ *+ * 宿主侧不再比对 `source`:来源由「`event.source === window.parent` + origin」+ * 保证,协议分支只认 `type`。+ */+export interface ParentMessage {+ type?: string+ [key: string]: unknown}-/** 会话访问栈中的页面。 */-export interface Page {- key: string | null- el: HTMLElement | null+/** 取消监听函数(与 `@tauri-apps/api/event` 的 `UnlistenFn` 同形)。 */+export type UnlistenFn = () => void++/** 父窗口消息的 `type` 过滤器:单个类型或类型列表。 */+export type ParentMessageTypes = string | readonly string[]++/** 已校验的父窗口消息上下文。 */+export interface ParentMessageContext {+ /** 原始 message 事件(需要 `event.origin` 等原始信息时使用)。 */+ event: MessageEvent}-/** 记录动作(与宿主 `PluginError.action` 语义一致)。 */-export type ErrorAction = 'runtime' | 'install' | 'update' | 'remove'+/** Tauri 事件对象(与 `@tauri-apps/api/event` 的 `Event<T>` 同形,改名避免遮蔽 DOM `Event`)。 */+export interface TauriEvent<T> {+ event: string+ id: number+ payload: T+}++/** Tauri `listen` 的回调(与 `@tauri-apps/api/event` 的 `EventCallback<T>` 同形)。 */+export type EventCallback<T> = (event: TauriEvent<T>) => void++/** Tauri `listen` 的可选项;桥只支持主页面的缺省目标,`target` 目前不生效。 */+export interface Options {+ target?: string | EventTarget+}++/** Tauri `invoke` 的参数形态(与 `@tauri-apps/api/core` 的 `InvokeArgs` 同形)。 */+export type InvokeArgs = Record<string, unknown> | number[] | ArrayBuffer | Uint8Array++/** Tauri `invoke` 的可选项;桥不转发 `headers`(宿主直接调用 command),仅为签名一致。 */+export interface InvokeOptions {+ headers: HeadersInit+}++/** 宿主 → iframe 的 Tauri 事件转发信封(`TYPE_EVENT`)。 */+export interface TauriEventBridgeMessage<T = unknown> extends ParentMessage {+ event: string+ /** Tauri 侧的事件 id;宿主未提供时为 0。 */+ id?: number+ payload: T+}// ── dsh-tauri invoke 桥(iframe → 宿主 → invoke())────────────────-/** iframe → 宿主 的 invoke 请求(postMessage)。 */-export interface InvokeBridgeRequest {+/**+ * iframe → 宿主 的 invoke 请求(postMessage)。+ *+ * `extends ParentMessage`:本桥的信封与 `invokeParent` / `listenParent` 的+ * 最小信封同族(`type` 分发 + 允许额外字段),继承其索引签名才能直接作为+ * 这两个原语的参数类型。+ */+export interface InvokeBridgeRequest extends ParentMessage {source: 'dsh-tauri-invoke'type: 'dsh://tauri:invoke'/** Tauri command 名。 */cmd: string/** command 参数对象。 */- args?: Record<string, unknown>+ args?: InvokeArgs/** 一次请求的唯一标识,宿主原样回填用于匹配。 */nonce: string}/** 宿主 → iframe 的 invoke 应答(postMessage)。 */-export interface InvokeBridgeReply {+export interface InvokeBridgeReply extends ParentMessage {source: 'dsh-desktop-invoke'type: 'dsh://tauri:reply'nonce: stringdiff --git a/packages/dsh-tauri/src/client/types/global.ts b/packages/dsh-tauri/src/client/types/global.tsdeleted file mode 100644index f9e000c0..00000000--- a/packages/dsh-tauri/src/client/types/global.ts+++ /dev/null@@ -1,8 +0,0 @@-declare global {- interface Window {- /** 插件接管标记:桌面端 NAV_SHIM_JS 检测到后停止收发,避免双重执行。 */- __dsh_tauri_bridge__?: boolean- }-}--export {}diff --git a/packages/dsh-tauri/src/client/types/index.ts b/packages/dsh-tauri/src/client/types/index.tsindex 3287de25..d5c2ed7b 100644--- a/packages/dsh-tauri/src/client/types/index.ts+++ b/packages/dsh-tauri/src/client/types/index.ts@@ -1,7 +1,6 @@export * from './agent'export * from './bridge'export * from './context'-export * from './global'export * from './inject'export * from './json'export * from './runtime'diff --git a/packages/dsh-tauri/src/client/utils/error.ts b/packages/dsh-tauri/src/client/utils/error.tsindex efb54439..69b76c46 100644--- a/packages/dsh-tauri/src/client/utils/error.ts+++ b/packages/dsh-tauri/src/client/utils/error.ts@@ -1,19 +1,22 @@/*** 错误上报桥(iframe 内 → 桌面宿主)。*- * 与桌面端 `use-iframe-shim.ts` 的协议逐字一致 —— 宿主只接受完全匹配的 key,- * 任何一处不一致都会被静默丢弃:+ * 与桌面端入站桥(`src/layout/components/iframe.tsx`)的协议逐字一致 —— 宿主按+ * `type` 分发,任何一处不一致都会被静默丢弃:*- * { source: 'dsh-plugin-error-bridge', type: 'dsh://plugin-error', id, error, action }+ * { type: 'dsh://plugin-error', id, error, action }** 宿主收到后经 `report_plugin_error` 持久化到插件错误注册表* (plugin-errors.json,按插件 id 幂等覆盖并推送新列表),「插件」面板据此* 给本插件显示 danger 标记与更新/卸载入口。+ *+ * 发送统一走 `invokeParent`(父窗口桥唯一出口),不再自己 `postMessage`。*/import type { ErrorAction } from '../types'-import { ERROR_SRC, ERROR_TYPE, PLUGIN_ID } from '../constants'+import { ERROR_TYPE, PLUGIN_ID } from '../constants'+import { invokeParent } from '../service/invoke-parent'-export { ERROR_SRC, ERROR_TYPE, PLUGIN_ID } from '../constants'+export { ERROR_TYPE, PLUGIN_ID } from '../constants'export type { ErrorAction } from '../types'/**@@ -27,13 +30,7 @@ export function reportPluginError(error: unknown, action: ErrorAction = 'runtime.slice(0, 2000)if (!message)return- const payload = { source: ERROR_SRC, type: ERROR_TYPE, id: PLUGIN_ID, error: message, action }- try {- window.parent.postMessage(payload, '*')- }- catch {- // 宿主已销毁等场景静默(与导航桥 post 的行为一致)- }+ invokeParent({ type: ERROR_TYPE, id: PLUGIN_ID, error: message, action })}/**diff --git a/packages/dsh-tauri/src/client/utils/zoom.test.ts b/packages/dsh-tauri/src/client/utils/zoom.test.tsnew file mode 100644index 00000000..7979cea7--- /dev/null+++ b/packages/dsh-tauri/src/client/utils/zoom.test.ts@@ -0,0 +1,32 @@+import type { ZoomShortcutLike } from './zoom'+import { describe, expect, it } from 'vitest'+import { zoomActionFromShortcut } from './zoom'++function shortcut(+ key: string,+ modifiers: Partial<ZoomShortcutLike> = {},+): ZoomShortcutLike {+ return {+ key,+ ctrlKey: false,+ metaKey: false,+ altKey: false,+ ...modifiers,+ }+}++describe('client zoom shortcuts', () => {+ it('maps Ctrl and Command zoom keys', () => {+ expect(zoomActionFromShortcut(shortcut('+', { ctrlKey: true }))).toBe('increase')+ expect(zoomActionFromShortcut(shortcut('=', { metaKey: true }))).toBe('increase')+ expect(zoomActionFromShortcut(shortcut('-', { ctrlKey: true }))).toBe('decrease')+ expect(zoomActionFromShortcut(shortcut('_', { metaKey: true }))).toBe('decrease')+ expect(zoomActionFromShortcut(shortcut('0', { ctrlKey: true }))).toBe('reset')+ })++ it('rejects unmodified, AltGr-like and unrelated keys', () => {+ expect(zoomActionFromShortcut(shortcut('+'))).toBeNull()+ expect(zoomActionFromShortcut(shortcut('+', { ctrlKey: true, altKey: true }))).toBeNull()+ expect(zoomActionFromShortcut(shortcut('1', { ctrlKey: true }))).toBeNull()+ })+})diff --git a/packages/dsh-tauri/src/client/utils/zoom.ts b/packages/dsh-tauri/src/client/utils/zoom.tsnew file mode 100644index 00000000..e6610cc6--- /dev/null+++ b/packages/dsh-tauri/src/client/utils/zoom.ts@@ -0,0 +1,30 @@+/** 缩放动作(与宿主 `src/utils/zoom.ts` 的 `ZoomAction` 同口径)。 */+export type ZoomAction = 'increase' | 'decrease' | 'reset'++/** 快捷键形态:只取判定所需字段,便于单测直接构造。 */+export interface ZoomShortcutLike {+ key: string+ ctrlKey: boolean+ metaKey: boolean+ altKey: boolean+}++/**+ * 缩放快捷键 → 动作:Ctrl/Cmd + `+` / `=` / `-` / `_` / `0`(Alt 组合不处理)。+ *+ * 与宿主 `src/utils/zoom.ts` 的 `zoomActionFromShortcut` 保持同一口径:两端都会收到+ * 快捷键(壳层自身按键 / iframe 内捕获后经父窗口桥转发),判定必须一致,否则同一组+ * 按键在两个焦点位置的行为不同。+ */+export function zoomActionFromShortcut(shortcut: ZoomShortcutLike): ZoomAction | null {+ if ((!shortcut.ctrlKey && !shortcut.metaKey) || shortcut.altKey)+ return null++ if (shortcut.key === '+' || shortcut.key === '=')+ return 'increase'+ if (shortcut.key === '-' || shortcut.key === '_')+ return 'decrease'+ if (shortcut.key === '0')+ return 'reset'+ return null+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2b73cbdb..52e2954b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -37,6 +37,13 @@ catalogs:typescript:specifier: ~5.8.3version: 5.8.3+ default:+ '@tauri-apps/plugin-os':+ specifier: ^2.3.2+ version: 2.3.2+ '@tauri-apps/plugin-store':+ specifier: ^2.4.4+ version: 2.4.4dsh:'@deepseek-ai/cordis':specifier: ^4.0.1@@ -137,9 +144,6 @@ catalogs:'@gravity-ui/icons':specifier: ^2.21.0version: 2.21.0- '@hairy/react-lib':- specifier: ^1.52.0- version: 1.52.0'@heroui/react':specifier: ^3.2.4version: 3.2.4@@ -173,9 +177,6 @@ catalogs:react-if-lite:specifier: ^0.1.0version: 0.1.0- react-use:- specifier: ^17.6.1- version: 17.6.1semver:specifier: ^7.8.0version: 7.8.5@@ -281,9 +282,6 @@ importers:'@gravity-ui/icons':specifier: catalog:runtimeversion: 2.21.0([email protected])- '@hairy/react-lib':- specifier: catalog:runtime- version: 1.52.0(@types/[email protected])([email protected]([email protected]))([email protected]([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]([email protected]))([email protected]))([email protected])'@hairy/utils':specifier: catalog:utilsversion: 1.52.0@@ -308,6 +306,12 @@ importers:'@tauri-apps/plugin-http':specifier: catalog:tauriversion: 2.6.0+ '@tauri-apps/plugin-os':+ specifier: 'catalog:'+ version: 2.3.2+ '@tauri-apps/plugin-store':+ specifier: 'catalog:'+ version: 2.4.4dsh-pet-component:specifier: catalog:runtimeversion: 0.1.1([email protected])([email protected])@@ -326,15 +330,15 @@ importers:react-if-lite:specifier: catalog:runtimeversion: 0.1.0([email protected])- react-use:- specifier: catalog:runtimesemver:specifier: catalog:runtimeversion: 7.8.5tailwind-variants:specifier: catalog:runtimeversion: 3.3.1([email protected])([email protected])+ unstorage:+ specifier: catalog:utils+ version: 1.17.5([email protected])valtio-define:specifier: catalog:runtimeversion: 1.4.1(@types/[email protected])([email protected])@@ -356,7 +360,7 @@ importers:version: 0.1.0-rc.8(572b530e8e393ff810ca77fa3c062d83)'@deepseek-ai/dsh-api-session-controller':specifier: catalog:dsh- version: 0.1.2-alpha.3(45e3b3f0a1632185e221b73ef4549b22)+ version: 0.1.2-alpha.3(71b33c9e1d8be263f5272acd174883b9)'@deepseek-ai/dsh-api-workspace-controller':specifier: catalog:dshversion: 0.1.2-alpha.3(de13f75832bbd4bdac06799cdb8cdfe2)@@ -507,10 +511,10 @@ importers:devDependencies:'@deepseek-ai/dsh-api-session-controller':specifier: catalog:dsh- version: 0.1.2-alpha.3(5a06b5d7eebd7b09281310c3da0208cc)+ version: 0.1.2-alpha.3(71b33c9e1d8be263f5272acd174883b9)'@deepseek-ai/dsh-api-workspace-controller':specifier: catalog:dsh- version: 0.1.2-alpha.3(e0539897c95f3b014c47be1c4061d343)+ version: 0.1.2-alpha.3(de13f75832bbd4bdac06799cdb8cdfe2)'@deepseek-ai/dsh-client-ui-renderer':specifier: catalog:dshversion: 0.1.2-alpha.3(@deepseek-ai/[email protected])([email protected])@@ -608,7 +612,7 @@ importers:version: 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])'@deepseek-ai/dsh-skill-filesystem':specifier: catalog:dsh- version: 0.1.2-alpha.3(0676f3d7c00ad46fa18854a7554c8b02)+ version: 0.1.2-alpha.3(673fc356525ba72998bdb75e78c3861d)dompurify:specifier: catalog:uiversion: 3.4.14@@ -691,7 +695,7 @@ importers:dependencies:'@deepseek-ai/dsh-skill-filesystem':specifier: catalog:dsh- version: 0.1.2-alpha.3(0676f3d7c00ad46fa18854a7554c8b02)+ version: 0.1.2-alpha.3(673fc356525ba72998bdb75e78c3861d)dsh-tauri:specifier: workspace:*version: link:../dsh-tauri@@ -707,7 +711,7 @@ importers:'@deepseek-ai/dsh-client-ui-layout':specifier: catalog:dsh- version: 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](2253cc4fb86630db0d55811163ceb97a))(@deepseek-ai/[email protected](d767422302b415e54a30ba38089eb869))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))+ version: 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](a0d827c006a5371070775500fe65b8e9))(@deepseek-ai/[email protected](36887757c5f83cabbd8a2c314ec53c0d))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-client-ui-renderer':specifier: catalog:dshversion: 0.1.2-alpha.3(@deepseek-ai/[email protected])([email protected])@@ -2260,17 +2264,6 @@ packages:react:optional: true- '@hairy/[email protected]':- resolution: {integrity: sha512-h/4QZQ0pw9ktz6X2zf37GjVPFTJQhMeQzQEipC2qlT2PQQ46XX85kn5KAPdprDddYxl9sZdm28gdUbnp4Kd1NQ==}- peerDependencies:- react: ^18.2.0- react-dom: ^18.2.0- react-i18next: ^14.1.2- react-use: ^17.0.0- peerDependenciesMeta:- react-i18next:- optional: true-'@hairy/[email protected]':resolution: {integrity: sha512-KF3rVUeYGdjjQ0VBYwhH7BplmUXE4kgq6UpMecYHxL2ujP230iC0nKjA+SiBv25ycpmdCyVRcsYZdRbn+lZ6Gg==}@@ -3391,6 +3384,12 @@ packages:'@tauri-apps/[email protected]':resolution: {integrity: sha512-QYXwbGb4hQ9/8Riv/ejU/kPFFnbBIrBcWwV1LIXv2xBKfoj8lkWfGkd9pkCSsBI/pljPtz+IPqfrE3t3bVl3mg==}+ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-n+nXWeuSeF9wcEsSPmRnBEGrRgOy6jjkSU+UVCOV8YUGKb2erhDOxis7IqRXiRVHhY8XMKks00BJ0OAdkpf6+A==}++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-oxSMaj/QpVfJcBMYX5aOQV94fWvga0MwQMfD6TLlbK2dh+ShPWAzefd8HWXhvOKjPRJdGVAkW7ZGO76JzzjaDA==}+'@tybys/[email protected]':resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}@@ -3424,9 +3423,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==}- '@types/[email protected]':- resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==}-'@types/[email protected]':resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}@@ -3593,9 +3589,6 @@ packages:'@vue/[email protected]':resolution: {integrity: sha512-IOnwSCma8j+9xJT6b8H0dEYidC80NsYmNMlZxRsukYcSoGaDBohog5hDxzeUXdFeGWFA++vWvxqOmrr96VlqMA==}- '@xobotyi/[email protected]':- resolution: {integrity: sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ==}-resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}peerDependencies:@@ -3828,9 +3821,6 @@ packages:resolution: {integrity: sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==}- resolution: {integrity: sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==}-resolution: {integrity: sha512-XGpFGbMLHwSt74YLTKho7Ib242qi6O8MSX+sRokV4oz7iKXvQWGYZthjIhjRGMxjzVkAubBO512dKGYcefmX3Q==}engines: {node: '>=6.4.0'}@@ -3851,16 +3841,9 @@ packages:resolution: {integrity: sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==}- resolution: {integrity: sha512-fJAcud6B3rRu+KHYk+Bwf+WFL2MDCJJ1XG9x137tJQ0xYxor7XziQtuGFbWNdqrvF4Tk26O3H73nfVqXt/fW1A==}-resolution: {integrity: sha512-9nF4PdUle+5ta4W5SyZdLCCmFd37uVimSjg1evcTqKJCyvCEEj12WKzOSBNak6r4im4J4iYXKH1OWpUV5LBYFg==}- resolution: {integrity: sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==}- engines: {node: '>=8.0.0'}-resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==}engines: {node: '>=4'}@@ -3977,9 +3960,6 @@ packages:resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==}engines: {node: '>=0.12'}- resolution: {integrity: sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==}-resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==}@@ -4267,9 +4247,6 @@ packages:resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}- resolution: {integrity: sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw==}-resolution: {integrity: sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==}@@ -4279,9 +4256,6 @@ packages:resolution: {integrity: sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==}- resolution: {integrity: sha512-bijHueCGd0LqqNK9b5oCMHc0MluJAx0cwqASgbWMvkO01lCYgIhacVRLcaDz3QnyYIRNJRDwMb41VuT6pHJ91Q==}-resolution: {integrity: sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==}@@ -4406,18 +4380,12 @@ packages:resolution: {integrity: sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==}- resolution: {integrity: sha512-E0oAXcELOtsXe+BmpJ2EZyedbldPpriV5vICzEuo6xjC/D1lDukOI7KrpfQGF2Qc4wWEy0nk3bFORS2K5ZAhFQ==}-resolution: {integrity: sha512-0zHsZJrK7S3K2aucXWL6ycoYJ/iNtIcFHC/nYQgFklPtrv5LpJctIiSCroWZWeuoXvuyFdzp6KzjJQ+OT5MfFw==}resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}- resolution: {integrity: sha512-WDC/ui2VVRrz3jOVi+XtjqkDjiVjTtFaAGiW37k6b+ohyQ5wYDOGkvCZa8+H0nx3gyvv0+BST9xuOgIyGQ00gw==}-resolution: {integrity: sha512-Bu5Z2nAXgfVyM8xvW3jk9EKRIuX37PudsrBViThNFx7CR7aaYTpP01cxNB/E4c4UUzTDiAZRstEhsRfPOL/8xA==}peerDependencies:@@ -4456,9 +4424,6 @@ packages:resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==}engines: {node: '>=12'}- resolution: {integrity: sha512-lhYo5qNTQp3EvSSp3sRvXMbVQTLrvGV6DycRMJ5dm2BLMiJ30wpXKdDdgX+GmJZ5uQMucwRKHamXSst3Sj/Giw==}-resolution: {integrity: sha512-l3jWwYNvrEa6NTCt7BECfCm48GvwuZzkoeG3gBL2w4CHeOXW3eKFmf9UNYkNfYc3mxMrthMnxjIE07MT0zLBQA==}peerDependencies:@@ -4520,9 +4485,6 @@ packages:resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}hasBin: true- resolution: {integrity: sha512-yeJd4aNAdYZQjaon2bpD/Gb0B/omw7HQOsynXXcOiWVCacbBcPlgn8S/d1X6blFSaHao7ozqtW7NZW19xpCtIw==}-resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}@@ -4734,9 +4696,6 @@ packages:resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==}- resolution: {integrity: sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==}-resolution: {integrity: sha512-pVxQFCcaYUEAH853+v7yoI/qzhxXSq1bTb9obMYGYAN1c3Hen+XDCEvr296XhstrwlSTNgOR7mCSD4JPjbJe5A==}@@ -4854,9 +4813,6 @@ packages:resolution: {integrity: sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==}engines: {node: '>= 18'}- resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==}-resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}engines: {node: '>=10'}@@ -4875,12 +4831,6 @@ packages:resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}- resolution: {integrity: sha512-+6bHaC8dSDGALM1HJjOHVXpuastdu2xFoZlC77Jh4cg+33Zcgm+Gxd+1xsnpZK14eyHObSp82+ll5y3SX75liw==}- peerDependencies:- react: '*'- react-dom: '*'-resolution: {integrity: sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==}engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}@@ -5149,18 +5099,6 @@ packages:react: '>=16.6.0'react-dom: '>=16.6.0'- resolution: {integrity: sha512-dg8yXdcQmvgR13RIlZbTRQOoUrDciFVoSBZILwjE2LFISxZZ8loVJKAkuzswl5js8BHda79bIb2b84ehU8IjXw==}- peerDependencies:- react: '*'- tslib: '*'-- resolution: {integrity: sha512-uibb3pgzV4LFsYPHyXYGu7dD2+pyk/ZJlPH+AizBR3zolqPWyCleKcWWbUQaKSKfydwgnQ3ymGm1Ab3/saGHCA==}- peerDependencies:- react: '*'- react-dom: '*'-resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}engines: {node: '>=0.10.0'}@@ -5202,9 +5140,6 @@ packages:resolution: {integrity: sha512-yE7KUfFvaBFzGPs5H3Ops1RevfUEsDc5Iz65rOwWg4lE8HJSYtle77uul3+573457oHvBKuHYDl/xqUkKpEEdw==}engines: {node: '>=18'}- resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==}-resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}@@ -5242,9 +5177,6 @@ packages:engines: {node: '>=18.0.0', npm: '>=8.0.0'}hasBin: true- resolution: {integrity: sha512-lRQgou1mu19e+Ya0LsTvKrVJ5TYUbqCVPAiImX3UfLTenarvPUl1QFdvu5Z3PYmHT9RCcwIfbjRQBntExyj3Zg==}-resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==}engines: {node: '>=18'}@@ -5259,10 +5191,6 @@ packages:resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==}- resolution: {integrity: sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==}- engines: {node: '>=0.10.0'}-resolution: {integrity: sha512-3A6sD0WYP7+QrjbfNA2FN3FsOaGGFoekCVgTyypy53gPxhbkCIjtO6YWgdrfM+n/8sI8JeXZOIxsHjMTNxQ4nQ==}engines: {node: ^14.0.0 || >=16.0.0}@@ -5279,10 +5207,6 @@ packages:engines: {node: '>=10'}hasBin: true- resolution: {integrity: sha512-AhICkFV84tBP1aWqPwLZqFvAwqEoVA9kxNMniGEUvzOlm4vLmOFLiTT3UZ6bziJTy4bOVpzWGTfSCbmaayGx8g==}- engines: {node: '>=6.9'}-resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}engines: {node: '>=8'}@@ -5312,14 +5236,6 @@ packages:resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}engines: {node: '>=0.10.0'}- resolution: {integrity: sha512-MjZkVp0NHr5+TPihLcadqnlVoGIoWo4IBHptutGh9wI3ttUYvCG26HkSuDi+K6lsZ25syXJXcctwgyVCt//xqA==}- engines: {node: '>=0.10.0'}-- resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}- engines: {node: '>=0.10.0'}-resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}@@ -5332,21 +5248,9 @@ packages:resolution: {integrity: sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==}- resolution: {integrity: sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ==}-resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}- resolution: {integrity: sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==}-- resolution: {integrity: sha512-GcUgbO4Jsqqg6RxfyTHFiPxdPqF+3LFmQhm7MgCuYQOYuWyqxo5pwRPz5d/u6/WYJdEnWfK4r+jGbyD8TSggXQ==}-- resolution: {integrity: sha512-Je5vBeY4S1r/RnLydLl0TBTi3F2qdfWmYsGvtfZgEI+SCprPppaIhQf5nGcal4gI4cGpCV/duLcAzT1np6sQqg==}-resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==}@@ -5370,9 +5274,6 @@ packages:resolution: {integrity: sha512-JXpm4DZLQqcioH+wooEc3jCFRlwu/pJvemuuNUv37gOWTVzdYgw1khGWPYulMxdkK7rlsi0pIc5gDFTw+pF8+A==}- resolution: {integrity: sha512-5Z9ZpRzfuH6l/UAvCPAPUo3665Nk2wLaZU3x+TLHKVzIz33+sbJqbtrYoC3KD4/uVOr2Zp+L0LySezP9OHV9yA==}-resolution: {integrity: sha512-WHkws2ZflZe41zj6AolvvmaTrWds/VuyeYr9iPVv/oQeaIoVxMKaushfFWpOGDT+GuBrM/sVqF8KUCYQlSSTdQ==}engines: {node: '>=18'}@@ -5412,10 +5313,6 @@ packages:resolution: {integrity: sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==}engines: {node: '>=18'}- resolution: {integrity: sha512-dTEWWNu6JmeVXY0ZYoPuH5cRIwc0MeGbJwah9KUNYSJwommQpCzTySTpEe8Gs1J23aeWEuAobe4Ag7EHVt/LOg==}- engines: {node: '>=10'}-resolution: {integrity: sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==}engines: {node: '>=12'}@@ -5446,9 +5343,6 @@ packages:resolution: {integrity: sha512-41wJyvKep3yT2tyPqX/4blcfybknGB4D+oETKLs7Q76UiPqRpUJK3hr1nxelyYO0PHKVzJwlu0aCeEAsGI6rpw==}engines: {node: '>=20'}- resolution: {integrity: sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==}-resolution: {integrity: sha512-A5F0cM6+mDleacLIEUkmfpkBbnHJFV1d2rprHU2MXNk7mlxHq2zGojA+SRvQD1RoMo9gqjZPWEaKG4v1BQ48lw==}engines: {node: ^20.19.0 || ^22.13.0 || >=24}@@ -5466,9 +5360,6 @@ packages:peerDependencies:typescript: '>=4.8.4'- resolution: {integrity: sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ==}-resolution: {integrity: sha512-6s5V71mX8qBUmlgbrfL33xDUwO0fq48rxAu2LBE11WBeGdpCPOsXksQbZJHvHwhrd3QjUusd3mAOM5Gg0mFBLg==}@@ -5776,10 +5667,6 @@ packages:jsdom:optional: true- resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==}- engines: {node: '>=0.10.0'}-resolution: {integrity: sha512-Gk6gRDj0n/fkRa3C3l0bBheoBckUq/Rs0F/TvMWIS6nzzx67amAViMe9CkNgsP2tXyQONvGiHQESHwFtZ3aYDA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}@@ -6135,15 +6022,6 @@ snapshots:'@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2-'@deepseek-ai/[email protected](572b530e8e393ff810ca77fa3c062d83)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6160,22 +6038,6 @@ snapshots:'@deepseek-ai/schemastery': 3.18.2js-yaml: 4.3.2- '@deepseek-ai/[email protected](c1be207a03aac6475634a9f8940d7540)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/cordis-plugin-include': 1.0.7(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/cordis-plugin-loader': 1.0.3(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-atomic-write': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-home-paths': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2- js-yaml: 4.3.2-'@deepseek-ai/[email protected](f669c855fcdbb7b6906bf05aeaf2e5f9)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6196,16 +6058,6 @@ snapshots:'@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))'@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6236,50 +6088,6 @@ snapshots:'@deepseek-ai/dsh-typert-protocol': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-typert-registry': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/[email protected](39ad6857080552d7128c0c99dd1891ec)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(c1be207a03aac6475634a9f8940d7540)- '@deepseek-ai/dsh-api-gateway': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-commands': 0.1.1-rc.2(b7e57b928f95a14f89480f7e3ec29e2a)- '@deepseek-ai/dsh-cordis-host-runner': 0.1.1-rc.2(61c53484088889d63546067b840a17c6)- '@deepseek-ai/dsh-credentials': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-file-reference': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-goal': 0.1.1-rc.2(9c38dd8f6ac5b7404ff7729d8d606df5)- '@deepseek-ai/dsh-host-plugin-inventory': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-message-feedback': 0.1.1-rc.2(e8a9f88fc52cf85af596925ce1d302cb)- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-session-reference': 0.1.1-rc.2(5caf46b529168b3bc89a3fbfce17ca2f)- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-typert-protocol': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-typert-registry': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))-- '@deepseek-ai/[email protected](b4e82b8a5d98d9276676fab344420767)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(c1be207a03aac6475634a9f8940d7540)- '@deepseek-ai/dsh-api-gateway': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-commands': 0.1.1-rc.2(b7e57b928f95a14f89480f7e3ec29e2a)- '@deepseek-ai/dsh-cordis-host-runner': 0.1.1-rc.2(61c53484088889d63546067b840a17c6)- '@deepseek-ai/dsh-credentials': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-file-reference': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-goal': 0.1.1-rc.2(eb890f446744921e146afa65b875858a)- '@deepseek-ai/dsh-host-plugin-inventory': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-message-feedback': 0.1.1-rc.2(e8a9f88fc52cf85af596925ce1d302cb)- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-session-reference': 0.1.1-rc.2(5caf46b529168b3bc89a3fbfce17ca2f)- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-typert-protocol': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-typert-registry': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))-'@deepseek-ai/[email protected](c0f561008e7b1b53c5643df5379e9da3)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6302,7 +6110,7 @@ snapshots:'@deepseek-ai/dsh-typert-protocol': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-typert-registry': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/[email protected](45e3b3f0a1632185e221b73ef4549b22)':+ '@deepseek-ai/[email protected](71b33c9e1d8be263f5272acd174883b9)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])'@deepseek-ai/dsh-agent': 0.1.0-rc.6(f669c855fcdbb7b6906bf05aeaf2e5f9)@@ -6323,7 +6131,7 @@ snapshots:'@deepseek-ai/dsh-session-query': 0.1.1-rc.2(8bd1fa002914593b4d9bcf25c09094cd)'@deepseek-ai/dsh-session-title': 0.1.1-rc.2(a7243e7b5ac650b18f7a232a79adf478)'@deepseek-ai/dsh-skill': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-subagent': 0.1.1-rc.2(809db769ce82e80f8135933f99c74d4b)+ '@deepseek-ai/dsh-subagent': 0.1.1-rc.2(6ab041dd7b8daf9ed8b898f6b6931b25)'@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])'@deepseek-ai/dsh-typert-registry': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-util-time': 0.1.2-alpha.3(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))@@ -6336,40 +6144,6 @@ snapshots:'@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(f3b9c066c9e4ecda580ce88fb615cafc)'@deepseek-ai/dsh-session-projection-cache': 0.1.1-rc.2(6e5fdfb0cb9547f4fe3f0e368392a2f3)- '@deepseek-ai/[email protected](5a06b5d7eebd7b09281310c3da0208cc)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-agent-default-model': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(c1be207a03aac6475634a9f8940d7540)- '@deepseek-ai/dsh-api-gateway': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-client-connection': 0.1.0-rc.8(fe566244b5339ed00ebd3a3983cea02c)- '@deepseek-ai/dsh-deque': 0.1.2-alpha.3(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-file-reference': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-native-command': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-session-query': 0.1.1-rc.2(55692668f62b2388e9645bcdea8e7908)- '@deepseek-ai/dsh-session-title': 0.1.1-rc.2(c16f6194ded65173aa71f34ee4638d26)- '@deepseek-ai/dsh-skill': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-subagent': 0.1.1-rc.2(559b10d6bfc8417016fd2f92e6524e36)- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-typert-registry': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-util-time': 0.1.2-alpha.3(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-util-workspace-path': 0.1.2-alpha.3(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-workspace': 0.1.1-rc.2(7b378f22b9575a9178d2e6bfd36395ac)- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3- optionalDependencies:- '@deepseek-ai/dsh-jobs': 0.1.1-rc.2(81258ad9cd4125d01bd833159e2fb216)- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-session-projection-cache': 0.1.1-rc.2(6e5fdfb0cb9547f4fe3f0e368392a2f3)-'@deepseek-ai/[email protected](de13f75832bbd4bdac06799cdb8cdfe2)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6384,20 +6158,6 @@ snapshots:'@deepseek-ai/dsh-workspace': 0.1.0-rc.8(bc0a36d4d2f3ef830ab0b3875478db22)zod: 4.4.3- '@deepseek-ai/[email protected](e0539897c95f3b014c47be1c4061d343)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-api-gateway': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-client-connection': 0.1.0-rc.8(fe566244b5339ed00ebd3a3983cea02c)- '@deepseek-ai/dsh-deque': 0.1.2-alpha.3(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-host-directory-picker': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-storage-domain': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-workspace': 0.1.1-rc.2(7b378f22b9575a9178d2e6bfd36395ac)- zod: 4.4.3-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6441,23 +6201,6 @@ snapshots:- bufferutil- utf-8-validate- '@deepseek-ai/[email protected](fe566244b5339ed00ebd3a3983cea02c)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-commands': 0.1.1-rc.2(b7e57b928f95a14f89480f7e3ec29e2a)- '@deepseek-ai/dsh-host-apiproxy': 0.1.1-rc.2(f663b617d0e14e08a69c25afab5cd6d7)- '@deepseek-ai/dsh-host-webserver': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-tools': 0.1.1-rc.2(0cb123c81b8f5227e7bdec19646d4771)- '@deepseek-ai/schemastery': 3.18.2- ws: 8.21.3- transitivePeerDependencies:- - bufferutil- - utf-8-validate-'@deepseek-ai/[email protected](600f4b30c364c81b462c1a500b32e837)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6469,41 +6212,6 @@ snapshots:'@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](7e73889cec3cef29597b0fddfac3e258)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-api-remotes': 0.1.1-rc.2(b4e82b8a5d98d9276676fab344420767)- '@deepseek-ai/dsh-client-connection': 0.1.0-rc.8(fe566244b5339ed00ebd3a3983cea02c)- '@deepseek-ai/dsh-client-runtime': 0.1.0-rc.8(2253cc4fb86630db0d55811163ceb97a)- '@deepseek-ai/dsh-client-ui-settings': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](b4e82b8a5d98d9276676fab344420767))(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](2253cc4fb86630db0d55811163ceb97a))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2-- '@deepseek-ai/[email protected](2253cc4fb86630db0d55811163ceb97a)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-api-remotes': 0.1.1-rc.2(b4e82b8a5d98d9276676fab344420767)- '@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-client-connection': 0.1.0-rc.8(fe566244b5339ed00ebd3a3983cea02c)- '@deepseek-ai/dsh-commands': 0.1.1-rc.2(b7e57b928f95a14f89480f7e3ec29e2a)- '@deepseek-ai/dsh-host-apiproxy': 0.1.1-rc.2(f663b617d0e14e08a69c25afab5cd6d7)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-llm-retry': 0.1.0-rc.8(cf8e2ebd9c02e5c91bdf51c2b53cf24b)- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-session-title': 0.1.1-rc.2(c16f6194ded65173aa71f34ee4638d26)- '@deepseek-ai/dsh-tools': 0.1.1-rc.2(0cb123c81b8f5227e7bdec19646d4771)- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-typert-registry': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- immer: 10.2.0- transitivePeerDependencies:- - '@types/react'- - react-'@deepseek-ai/[email protected](a0d827c006a5371070775500fe65b8e9)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6574,13 +6282,6 @@ snapshots:'@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])clsx: 2.1.1- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](2253cc4fb86630db0d55811163ceb97a))(@deepseek-ai/[email protected](d767422302b415e54a30ba38089eb869))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-client-runtime': 0.1.0-rc.8(2253cc4fb86630db0d55811163ceb97a)- '@deepseek-ai/dsh-client-ui-theme': 0.1.0-rc.8(d767422302b415e54a30ba38089eb869)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](a0d827c006a5371070775500fe65b8e9))(@deepseek-ai/[email protected](36887757c5f83cabbd8a2c314ec53c0d))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6632,16 +6333,6 @@ snapshots:'@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](b4e82b8a5d98d9276676fab344420767))(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](2253cc4fb86630db0d55811163ceb97a))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-api-remotes': 0.1.1-rc.2(b4e82b8a5d98d9276676fab344420767)- '@deepseek-ai/dsh-client-connection': 0.1.0-rc.8(fe566244b5339ed00ebd3a3983cea02c)- '@deepseek-ai/dsh-client-runtime': 0.1.0-rc.8(2253cc4fb86630db0d55811163ceb97a)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6660,38 +6351,11 @@ snapshots:'@deepseek-ai/schemastery': 3.18.2clsx: 2.1.1- '@deepseek-ai/[email protected](d767422302b415e54a30ba38089eb869)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-api-remotes': 0.1.1-rc.2(b4e82b8a5d98d9276676fab344420767)- '@deepseek-ai/dsh-client-connection': 0.1.0-rc.8(fe566244b5339ed00ebd3a3983cea02c)- '@deepseek-ai/dsh-client-locale': 0.1.0-rc.8(7e73889cec3cef29597b0fddfac3e258)- '@deepseek-ai/dsh-client-runtime': 0.1.0-rc.8(2253cc4fb86630db0d55811163ceb97a)- '@deepseek-ai/dsh-client-ui-settings': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](b4e82b8a5d98d9276676fab344420767))(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](2253cc4fb86630db0d55811163ceb97a))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-host-webserver': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2- clsx: 2.1.1-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])'@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/[email protected](07d9025b272154dd9360ac12ad2febbf)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- zod: 4.4.3-'@deepseek-ai/[email protected](7fa7ec2e1867bad95bba2fec01170754)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6705,19 +6369,6 @@ snapshots:'@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])zod: 4.4.3- '@deepseek-ai/[email protected](b7e57b928f95a14f89480f7e3ec29e2a)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- zod: 4.4.3-'@deepseek-ai/[email protected](ee998c26bdd5472aa4c03bfee0c1d759)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6740,29 +6391,6 @@ snapshots:'@deepseek-ai/dsh-llm': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-session': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/[email protected](fd6262a440203b516011374f5dc597f8)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-commands': 0.1.1-rc.2(b7e57b928f95a14f89480f7e3ec29e2a)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))-- '@deepseek-ai/[email protected](61c53484088889d63546067b840a17c6)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-tools': 0.1.1-rc.2(0cb123c81b8f5227e7bdec19646d4771)- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](94c0a373bc88016b73cba86b07a7310e)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6802,14 +6430,6 @@ snapshots:'@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])zod: 4.4.3- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- zod: 4.4.3-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](abc2fb5ec32079b87d9fa8e0b43a14fb))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6818,14 +6438,6 @@ snapshots:'@deepseek-ai/dsh-llm': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-sandbox': 0.1.1-rc.2(abc2fb5ec32079b87d9fa8e0b43a14fb)- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](bc8e4318bb93ad66d0ea82c05f587a8f))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-sandbox': 0.1.1-rc.2(bc8e4318bb93ad66d0ea82c05f587a8f)-'@deepseek-ai/[email protected](2a2869e3abd45ad532380c7b24f34040)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6840,20 +6452,6 @@ snapshots:'@deepseek-ai/schemastery': 3.18.2zod: 4.4.3- '@deepseek-ai/[email protected](326aed3c0606a3857749da86bfab98b7)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](9c38dd8f6ac5b7404ff7729d8d606df5)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -6868,92 +6466,27 @@ snapshots:'@deepseek-ai/schemastery': 3.18.2zod: 4.4.3- '@deepseek-ai/[email protected](eb890f446744921e146afa65b875858a)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])'@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/[email protected](f663b617d0e14e08a69c25afab5cd6d7)':+ '@deepseek-ai/[email protected](fbf09533b80524af7e2c3d9701d6ca62)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-agent-default-model': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(c1be207a03aac6475634a9f8940d7540)- '@deepseek-ai/dsh-api-remotes': 0.1.1-rc.2(39ad6857080552d7128c0c99dd1891ec)+ '@deepseek-ai/dsh-agent': 0.1.1-rc.2(0819cc09ee42f2599f32e3f99a9f5d2e)+ '@deepseek-ai/dsh-agent-default-model': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](0819cc09ee42f2599f32e3f99a9f5d2e))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))+ '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(572b530e8e393ff810ca77fa3c062d83)+ '@deepseek-ai/dsh-api-remotes': 0.1.1-rc.2(c0f561008e7b1b53c5643df5379e9da3)'@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-commands': 0.1.1-rc.2(07d9025b272154dd9360ac12ad2febbf)- '@deepseek-ai/dsh-cordis-host-runner': 0.1.1-rc.2(61c53484088889d63546067b840a17c6)+ '@deepseek-ai/dsh-commands': 0.1.1-rc.2(ee998c26bdd5472aa4c03bfee0c1d759)+ '@deepseek-ai/dsh-cordis-host-runner': 0.1.1-rc.2(94c0a373bc88016b73cba86b07a7310e)'@deepseek-ai/dsh-credentials': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-goal': 0.1.1-rc.2(326aed3c0606a3857749da86bfab98b7)+ '@deepseek-ai/dsh-goal': 0.1.1-rc.2(2a2869e3abd45ad532380c7b24f34040)'@deepseek-ai/dsh-host-directory-picker': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-jobs': 0.1.1-rc.2(9a5a1930dd2a91c666334a844059b129)- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-native-command': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(c7c2e51bc54cf8faf7949c7961ca49a6)- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-session-projection-cache': 0.1.1-rc.2(a5b92b5f9fab11c24007e2d9d047a519)- '@deepseek-ai/dsh-session-query': 0.1.1-rc.2(1540eff4c5b2dfeafa7f838ba53817a6)- '@deepseek-ai/dsh-session-title': 0.1.1-rc.2(0c249beafba31fa87c1705223a8bd415)- '@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-skill': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-subagent': 0.1.1-rc.2(3a2a14ceb3a4a90ce12b6ed48b45de4d)- '@deepseek-ai/dsh-tools': 0.1.1-rc.2(0cb123c81b8f5227e7bdec19646d4771)- '@deepseek-ai/dsh-user-approval': 0.1.1-rc.2(48f2c0e63c56a1de7f58f0b57a546723)- '@deepseek-ai/dsh-user-questions': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-workspace': 0.1.1-rc.2(af171be11907466448cd96b3820f964c)- '@deepseek-ai/schemastery': 3.18.2- fflate: 0.8.3- zod: 4.4.3- transitivePeerDependencies:- - '@deepseek-ai/dsh-api-gateway'- - '@deepseek-ai/dsh-code-runtime'- - '@deepseek-ai/dsh-file-reference'- - '@deepseek-ai/dsh-host-plugin-inventory'- - '@deepseek-ai/dsh-message-feedback'- - '@deepseek-ai/dsh-sandbox'- - '@deepseek-ai/dsh-sandbox-policy'- - '@deepseek-ai/dsh-scope'- - '@deepseek-ai/dsh-session-reference'- - '@deepseek-ai/dsh-storage'- - '@deepseek-ai/dsh-storage-domain'- - '@deepseek-ai/dsh-system-prompt'- - '@deepseek-ai/dsh-timeout'- - '@deepseek-ai/dsh-typert-protocol'- - '@deepseek-ai/dsh-typert-registry'-- '@deepseek-ai/[email protected](fbf09533b80524af7e2c3d9701d6ca62)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(0819cc09ee42f2599f32e3f99a9f5d2e)- '@deepseek-ai/dsh-agent-default-model': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](0819cc09ee42f2599f32e3f99a9f5d2e))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(572b530e8e393ff810ca77fa3c062d83)- '@deepseek-ai/dsh-api-remotes': 0.1.1-rc.2(c0f561008e7b1b53c5643df5379e9da3)- '@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-commands': 0.1.1-rc.2(ee998c26bdd5472aa4c03bfee0c1d759)- '@deepseek-ai/dsh-cordis-host-runner': 0.1.1-rc.2(94c0a373bc88016b73cba86b07a7310e)- '@deepseek-ai/dsh-credentials': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-goal': 0.1.1-rc.2(2a2869e3abd45ad532380c7b24f34040)- '@deepseek-ai/dsh-host-directory-picker': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-jobs': 0.1.1-rc.2(81258ad9cd4125d01bd833159e2fb216)+ '@deepseek-ai/dsh-jobs': 0.1.1-rc.2(81258ad9cd4125d01bd833159e2fb216)'@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-native-command': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))@@ -7022,14 +6555,6 @@ snapshots:'@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])'@deepseek-ai/dsh-session': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/[email protected](9a5a1930dd2a91c666334a844059b129)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))-'@deepseek-ai/[email protected](7d69c1551d6fb836606145bd29a39322)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7041,17 +6566,6 @@ snapshots:'@deepseek-ai/dsh-timeout': 0.1.2-alpha.5(@deepseek-ai/[email protected])'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](cf8e2ebd9c02e5c91bdf51c2b53cf24b)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-timeout': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7070,28 +6584,6 @@ snapshots:'@deepseek-ai/dsh-timeout': 0.1.2-alpha.5(@deepseek-ai/[email protected])'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-attachment': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-timeout': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2-- '@deepseek-ai/[email protected](e8a9f88fc52cf85af596925ce1d302cb)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-storage-domain': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](f8531b75696ce0891159f9920cee4416)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7145,17 +6637,6 @@ snapshots:optionalDependencies:'@deepseek-ai/dsh-commands': 0.1.1-rc.2(7fa7ec2e1867bad95bba2fec01170754)- '@deepseek-ai/[email protected](d7631ba9121d96bf3784d8c27a6e18ef)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-sandbox': 0.1.1-rc.2(bc8e4318bb93ad66d0ea82c05f587a8f)- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2- optional: true-'@deepseek-ai/[email protected](eb6814ca881f3d08c51e2c0dda68609c)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7173,26 +6654,11 @@ snapshots:'@deepseek-ai/dsh-llm': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-session': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/[email protected](bc8e4318bb93ad66d0ea82c05f587a8f)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])'@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/[email protected](2b0cab952f4c5141eb79cc078666cdce)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-timeout': 0.1.2-alpha.5(@deepseek-ai/[email protected])-'@deepseek-ai/[email protected](53f946e9d3baa68a4846dda28e6b6fe1)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7201,14 +6667,6 @@ snapshots:'@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-timeout': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/[email protected](c7c2e51bc54cf8faf7949c7961ca49a6)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-timeout': 0.1.2-alpha.5(@deepseek-ai/[email protected])-'@deepseek-ai/[email protected](f3b9c066c9e4ecda580ce88fb615cafc)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7228,17 +6686,6 @@ snapshots:'@deepseek-ai/schemastery': 3.18.2zod: 4.4.3- '@deepseek-ai/[email protected](a5b92b5f9fab11c24007e2d9d047a519)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-storage-domain': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](3184227325382b53b8760a83397b86c4)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7253,35 +6700,6 @@ snapshots:'@deepseek-ai/dsh-session': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))zod: 4.4.3- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- zod: 4.4.3-- '@deepseek-ai/[email protected](1540eff4c5b2dfeafa7f838ba53817a6)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-title': 0.1.1-rc.2(c16f6194ded65173aa71f34ee4638d26)- optionalDependencies:- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)-- '@deepseek-ai/[email protected](55692668f62b2388e9645bcdea8e7908)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-title': 0.1.1-rc.2(c16f6194ded65173aa71f34ee4638d26)- optionalDependencies:- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)-'@deepseek-ai/[email protected](7007f8768db5ccbe32a89bcd40344344)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7304,20 +6722,6 @@ snapshots:optionalDependencies:'@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(f3b9c066c9e4ecda580ce88fb615cafc)- '@deepseek-ai/[email protected](5caf46b529168b3bc89a3fbfce17ca2f)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-compaction': 0.1.1-rc.2(fd6262a440203b516011374f5dc597f8)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-output-retention': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-query': 0.1.1-rc.2(55692668f62b2388e9645bcdea8e7908)- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](ea3fdccb2c920f3daf16f56a97a82593)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7341,17 +6745,6 @@ snapshots:'@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))zod: 4.4.3- '@deepseek-ai/[email protected](0c249beafba31fa87c1705223a8bd415)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](5368ecc54920e233ac5509f261211c9b)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7374,17 +6767,6 @@ snapshots:'@deepseek-ai/schemastery': 3.18.2zod: 4.4.3- '@deepseek-ai/[email protected](c16f6194ded65173aa71f34ee4638d26)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2- zod: 4.4.3-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7403,24 +6785,6 @@ snapshots:'@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])-- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-typert-protocol': 0.1.2-alpha.5(@deepseek-ai/[email protected])-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7443,17 +6807,6 @@ snapshots:'@deepseek-ai/dsh-settings': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected])'@deepseek-ai/dsh-subprocess': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/[email protected](0676f3d7c00ad46fa18854a7554c8b02)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-fs': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](bc8e4318bb93ad66d0ea82c05f587a8f))- '@deepseek-ai/dsh-home-paths': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-skill': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2- chokidar: 5.0.0- yaml: 2.9.0-'@deepseek-ai/[email protected](673fc356525ba72998bdb75e78c3861d)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7481,14 +6834,6 @@ snapshots:'@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/schemastery': 3.18.2-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7523,49 +6868,7 @@ snapshots:'@deepseek-ai/dsh-session-projection-cache': 0.1.1-rc.2(6e5fdfb0cb9547f4fe3f0e368392a2f3)'@deepseek-ai/dsh-user-approval': 0.1.1-rc.2(e7a6e863abd095ee6db7d68296c91430)- '@deepseek-ai/[email protected](3a2a14ceb3a4a90ce12b6ed48b45de4d)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-tools': 0.1.1-rc.2(0cb123c81b8f5227e7bdec19646d4771)- zod: 4.4.3- optionalDependencies:- '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(c1be207a03aac6475634a9f8940d7540)- '@deepseek-ai/dsh-jobs': 0.1.1-rc.2(81258ad9cd4125d01bd833159e2fb216)- '@deepseek-ai/dsh-sandbox': 0.1.1-rc.2(bc8e4318bb93ad66d0ea82c05f587a8f)- '@deepseek-ai/dsh-sandbox-policy': 0.1.1-rc.2(d7631ba9121d96bf3784d8c27a6e18ef)- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-session-projection-cache': 0.1.1-rc.2(6e5fdfb0cb9547f4fe3f0e368392a2f3)- '@deepseek-ai/dsh-user-approval': 0.1.1-rc.2(0730466c13b75331097da70fedb94b30)-- '@deepseek-ai/[email protected](559b10d6bfc8417016fd2f92e6524e36)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-tools': 0.1.1-rc.2(0cb123c81b8f5227e7bdec19646d4771)- zod: 4.4.3- optionalDependencies:- '@deepseek-ai/dsh-agent-presets': 0.1.0-rc.8(c1be207a03aac6475634a9f8940d7540)- '@deepseek-ai/dsh-jobs': 0.1.1-rc.2(81258ad9cd4125d01bd833159e2fb216)- '@deepseek-ai/dsh-sandbox': 0.1.1-rc.2(bc8e4318bb93ad66d0ea82c05f587a8f)- '@deepseek-ai/dsh-sandbox-policy': 0.1.1-rc.2(d7631ba9121d96bf3784d8c27a6e18ef)- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-session-projection': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-session-projection-cache': 0.1.1-rc.2(6e5fdfb0cb9547f4fe3f0e368392a2f3)- '@deepseek-ai/dsh-user-approval': 0.1.1-rc.2(0730466c13b75331097da70fedb94b30)-- '@deepseek-ai/[email protected](809db769ce82e80f8135933f99c74d4b)':+ '@deepseek-ai/[email protected](6ab041dd7b8daf9ed8b898f6b6931b25)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])'@deepseek-ai/dsh-agent': 0.1.0-rc.6(f669c855fcdbb7b6906bf05aeaf2e5f9)@@ -7599,14 +6902,6 @@ snapshots:'@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/schemastery': 3.18.2-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7646,19 +6941,6 @@ snapshots:'@deepseek-ai/dsh-user-approval': 0.1.0-rc.8(a14be7f57e6ee0951b7786209d76bf3f)'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](0cb123c81b8f5227e7bdec19646d4771)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-code-runtime': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/dsh-user-approval': 0.1.1-rc.2(0730466c13b75331097da70fedb94b30)- '@deepseek-ai/schemastery': 3.18.2-'@deepseek-ai/[email protected](485e74897d425400151460af4bef194f)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7700,30 +6982,6 @@ snapshots:'@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))'@deepseek-ai/schemastery': 3.18.2- '@deepseek-ai/[email protected](0730466c13b75331097da70fedb94b30)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2-- '@deepseek-ai/[email protected](48f2c0e63c56a1de7f58f0b57a546723)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-scope': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-system-prompt': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- '@deepseek-ai/schemastery': 3.18.2-'@deepseek-ai/[email protected](e7a6e863abd095ee6db7d68296c91430)':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7750,13 +7008,6 @@ snapshots:'@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])'@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](619c3ece6a07de1dfbc553732222de09))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-agent': 0.1.1-rc.2(619c3ece6a07de1dfbc553732222de09)- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-llm': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))-'@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))':dependencies:'@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])@@ -7789,28 +7040,6 @@ snapshots:'@deepseek-ai/dsh-storage-domain': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))zod: 4.4.3- '@deepseek-ai/[email protected](7b378f22b9575a9178d2e6bfd36395ac)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.2-alpha.5(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-storage': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-storage-domain': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- zod: 4.4.3-- '@deepseek-ai/[email protected](af171be11907466448cd96b3820f964c)':- dependencies:- '@deepseek-ai/cordis': 4.0.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-brand': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-invariants': 0.1.1-rc.2(@deepseek-ai/[email protected])- '@deepseek-ai/dsh-session': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-session-persistence': 0.1.1-rc.2(2b0cab952f4c5141eb79cc078666cdce)- '@deepseek-ai/dsh-storage': 0.1.1-rc.2(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))- '@deepseek-ai/dsh-storage-domain': 0.1.0-rc.8(@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected]))(@deepseek-ai/[email protected](@deepseek-ai/[email protected])(@deepseek-ai/[email protected](@deepseek-ai/[email protected])))- zod: 4.4.3-'@deepseek-ai/[email protected]':dependencies:'@deepseek-ai/cosmokit': 1.8.3@@ -8139,20 +7368,6 @@ snapshots:optionalDependencies:react: 19.2.8- '@hairy/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]([email protected]))([email protected]))([email protected])':- dependencies:- '@hairy/utils': 1.52.0- html-parse-stringify: 3.1.0- mitt: 3.0.1- react: 19.2.8- react-dom: 19.2.8([email protected])- valtio: 2.3.2(@types/[email protected])([email protected])- optionalDependencies:- react-i18next: 17.0.11([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected])- transitivePeerDependencies:- - '@types/react'-'@hairy/[email protected]':dependencies:'@types/lodash-es': 4.17.12@@ -8961,6 +8176,14 @@ snapshots:dependencies:'@tauri-apps/api': 2.11.1+ '@tauri-apps/[email protected]':+ dependencies:+ '@tauri-apps/api': 2.11.1++ '@tauri-apps/[email protected]':+ dependencies:+ '@tauri-apps/api': 2.11.1+'@tybys/[email protected]':dependencies:tslib: 2.8.1@@ -9006,8 +8229,6 @@ snapshots:dependencies:'@types/unist': 3.0.3- '@types/[email protected]': {}-'@types/[email protected]': {}'@types/[email protected]': {}@@ -9233,8 +8454,6 @@ snapshots:'@vue/[email protected]': {}- '@xobotyi/[email protected]': {}-dependencies:acorn: 8.18.0@@ -9465,10 +8684,6 @@ snapshots:- dependencies:- toggle-selection: 1.0.6-dependencies:browserslist: 4.28.8@@ -9489,20 +8704,11 @@ snapshots:dependencies:uncrypto: 0.1.3- dependencies:- hyphenate-style-name: 1.1.0-dependencies:'@emotion/hash': 0.8.0csstype: 3.0.11- dependencies:- mdn-data: 2.0.14- source-map: 0.6.1-@@ -9598,10 +8804,6 @@ snapshots:- dependencies:- stackframe: 1.3.4-@@ -10031,8 +9233,6 @@ snapshots:- [email protected]: {}-@@ -10043,8 +9243,6 @@ snapshots:dependencies:fast-string-width: 3.0.2- [email protected]: {}-dependencies:format: 0.2.2@@ -10172,16 +9370,10 @@ snapshots:- dependencies:- void-elements: 3.1.0-- [email protected]: {}-optionalDependencies:typescript: 5.8.3@@ -10204,10 +9396,6 @@ snapshots:- dependencies:- css-in-js-utils: 3.1.0-dependencies:react: 19.2.8@@ -10259,8 +9447,6 @@ snapshots:- [email protected]: {}-@@ -10546,8 +9732,6 @@ snapshots:dependencies:'@types/mdast': 4.0.4- [email protected]: {}-@@ -10779,8 +9963,6 @@ snapshots:dependencies:minipass: 7.1.3- [email protected]: {}-@@ -10796,19 +9978,6 @@ snapshots:- dependencies:- '@jridgewell/sourcemap-codec': 1.5.5- css-tree: 1.1.3- csstype: 3.2.3- fastest-stable-stringify: 2.0.2- inline-style-prefixer: 7.0.1- react: 19.2.8- react-dom: 19.2.8([email protected])- rtl-css-js: 1.16.1- stacktrace-js: 2.0.2- stylis: 4.4.0-@@ -11119,30 +10288,6 @@ snapshots:react: 19.2.8react-dom: 19.2.8([email protected])- dependencies:- react: 19.2.8- tslib: 2.8.1-- dependencies:- '@types/js-cookie': 3.0.6- '@xobotyi/scrollbar-width': 1.9.5- copy-to-clipboard: 3.3.3- fast-deep-equal: 3.1.3- fast-shallow-equal: 1.0.0- js-cookie: 3.0.8- react: 19.2.8- react-dom: 19.2.8([email protected])- react-universal-interface: 0.6.2([email protected])([email protected])- resize-observer-polyfill: 1.5.1- screenfull: 5.2.0- set-harmonic-interval: 1.0.1- throttle-debounce: 3.0.1- ts-easing: 0.2.0- tslib: 2.8.1-dependencies:loose-envify: 1.4.0@@ -11180,8 +10325,6 @@ snapshots:- [email protected]: {}-[email protected]([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))([email protected]):@@ -11276,10 +10419,6 @@ snapshots:'@rollup/rollup-win32-x64-msvc': 4.62.4fsevents: 2.3.3- dependencies:- '@babel/runtime': 7.29.7-@@ -11292,8 +10431,6 @@ snapshots:- [email protected]: {}-dependencies:'@eslint-community/regexpp': 4.12.2@@ -11306,8 +10443,6 @@ snapshots:- [email protected]: {}-dependencies:shebang-regex: 3.0.0@@ -11343,10 +10478,6 @@ snapshots:- [email protected]: {}-- [email protected]: {}-@@ -11358,25 +10489,8 @@ snapshots:- dependencies:- stackframe: 1.3.4-- [email protected]: {}-- dependencies:- source-map: 0.5.6- stackframe: 1.3.4-- dependencies:- error-stack-parser: 2.1.4- stack-generator: 2.0.10- stacktrace-gps: 3.1.2-@@ -11394,8 +10508,6 @@ snapshots:- [email protected]: {}-dependencies:function-timeout: 1.0.2@@ -11434,8 +10546,6 @@ snapshots:minizlib: 3.1.0yallist: 5.0.0- [email protected]: {}-dependencies:convert-hrtime: 5.0.0@@ -11462,8 +10572,6 @@ snapshots:'@sindresorhus/base62': 1.0.0reserved-identifiers: 1.2.0- [email protected]: {}-dependencies:eslint-visitor-keys: 5.0.1@@ -11476,8 +10584,6 @@ snapshots:dependencies:typescript: 5.8.3- [email protected]: {}-[email protected](@emnapi/[email protected])(@emnapi/[email protected])([email protected])([email protected])([email protected])([email protected]):@@ -11701,8 +10807,6 @@ snapshots:transitivePeerDependencies:- msw- [email protected]: {}-dependencies:debug: 4.4.3diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 23f7feba..58f24209 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -1,26 +1,26 @@+allowBuilds:+ '@tailwindcss/oxide': true+ esbuild: true+catalogMode: prefer+inject-workspace-packages: true+shellEmulator: truetrustPolicy: no-downgrade-# Ignore the trust-level check for packages published more than 1 year ago.-# Older transitive versions (e.g. [email protected], [email protected]) predate the-# package's adoption of trusted publishing and falsely read as a "trust downgrade".-trustPolicyIgnoreAfter: 525600--# 让 pnpm deploy(无 --legacy)产出「注入式」的紧凑生产闭包:把 workspace 包作为依赖-# 注入到产物 node_modules,而不是链接到共享存储,从而只捆绑插件及其真实生产依赖。-inject-workspace-packages: truepackages:- - 'packages/*'+ - packages/*patchedDependencies:bumpp: patches/bumpp.patch-# 命名 catalog 分组:按用途归类依赖,包内通过 `catalog:<分组>` 引用。+catalog:+ '@tauri-apps/plugin-os': ^2.3.2+ '@tauri-apps/plugin-store': ^2.4.4+catalogs:- # 构建工具链(Vite + Tailwind + TS 编译 + React 编译器)build:'@tailwindcss/postcss': 4.1.11'@tailwindcss/vite': 4.1.11@@ -29,14 +29,10 @@ catalogs:tailwindcss: 4.1.11tsx: ^4.23.12vite: ^7.0.4- # CLI 构建工具(插件全部依赖 tsdown / typescript)cli:publint: ^0.3.16tsdown: ^0.17.3typescript: ~5.8.3- # dsh 生态(核心 + 客户端 UI/运行时 + 技能)。版本范围按仓库既有约定:- # 仅发 alpha 线的包(api-*/client-*/skill-*)用 ^0.1.2-alpha.2;- # 存在 0.1.0-rc.x 的扩展包用 '>=0.1.0-rc.5 <0.2.0'(npm 预发布元组匹配规则下可解析)。dsh:'@deepseek-ai/cordis': ^4.0.1'@deepseek-ai/dsh-agent': '>=0.1.0-rc.5 <0.2.0'@@ -62,63 +58,48 @@ catalogs:'@deepseek-ai/dsh-tools': '>=0.1.0-rc.5 <0.2.0''@deepseek-ai/dsh-user-approval': '>=0.1.0-rc.5 <0.2.0''@deepseek-ai/dsh-workspace': '>=0.1.0-rc.5 <0.2.0'- # 代码质量 / lint(eslint stack + knip 死代码检测)lint:'@antfu/eslint-config': ^9.3.0'@eslint-react/eslint-plugin': ^5.18.6eslint: ^10.8.1eslint-plugin-react-refresh: ^0.5.4knip: ^6.32.2- # 发布流程release:bumpp: 12.2.1changelogithub: 15.0.5- # 桌面端运行时与 UI 依赖(React 生态、状态、i18n、UI 组件库)runtime:'@gravity-ui/icons': ^2.21.0- '@hairy/react-lib': ^1.52.0'@heroui/react': ^3.2.4'@heroui/styles': ^3.2.4'@overlastic/react': ^0.9.0'@reause/core': ^0.1.4'@tanstack/react-query': ^5.101.4- # 统一桌宠组件(dsh-pet / Codex 两套协议一个 <Pet>):预设宠物直连远程素材,- # 不再下载到本地,动画池/双视频缓冲/雪碧图/IndexedDB 缓存全部由它接管。dsh-pet-component: ^0.1.1i18next: ^26.3.6react: ^19.2.8react-dom: ^19.2.8react-i18next: ^17.0.11react-if-lite: ^0.1.0- react-use: ^17.6.1semver: ^7.8.0tailwind-variants: ^3.3.1valtio-define: ^1.4.1- # Tauri 相关tauri:'@tauri-apps/api': ^2.11.1'@tauri-apps/cli': ^2.11.4- # 桌宠窗口用插件版 fetch 拉取远程宠物素材:请求走 Rust,绕开 githubusercontent- # 的 CORS 限制(远端不返回 Access-Control-Allow-Origin)。'@tauri-apps/plugin-http': ^2.6.0- # 测试testing:vitest: ^4.1.11yaml: ^2.9.0- # TypeScript 类型定义types:'@types/node': ^22.10.0'@types/react': ^19.2.18'@types/react-dom': ^19.2.4'@types/semver': ^7.8.0- # UI 呈现(插件渲染富文本/样式)ui:'@css-render/plugin-bem': ^0.15.7css-render: ^0.15.14dompurify: ^3.4.13marked: ^18.0.10-- # 工具库(根项目与插件共用)utils:'@hairy/utils': ^1.52.0citty: ^0.2.2@@ -134,6 +115,4 @@ catalogs:tinyexec: ^1.3.0unstorage: ^1.17.5-allowBuilds:- '@tailwindcss/oxide': true- esbuild: true+trustPolicyIgnoreAfter: 525600diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex 65f00170..a0812f4e 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -989,6 +989,7 @@ dependencies = ["tauri-plugin-http","tauri-plugin-notification","tauri-plugin-opener",+ "tauri-plugin-os","tauri-plugin-single-instance","tauri-plugin-store","time",@@ -2772,6 +2773,18 @@ version = "1.0.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"+[[package]]+name = "nix"+version = "0.31.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"+dependencies = [+ "bitflags 2.13.1",+ "cfg-if",+ "cfg_aliases",+ "libc",+]+[[package]]name = "nom"version = "8.0.0"@@ -3123,6 +3136,22 @@ dependencies = ["pin-project-lite",]+[[package]]+name = "os_info"+version = "3.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9cf20a545b305cf1da722b236b5155c9bb35f1d5ceb28c048bd96ca842f41b5b"+dependencies = [+ "android_system_properties",+ "log",+ "nix",+ "objc2",+ "objc2-foundation",+ "objc2-ui-kit",+ "serde",+ "windows-sys 0.61.2",+]+[[package]]name = "os_pipe"version = "1.2.3"@@ -4519,6 +4548,15 @@ dependencies = ["syn 2.0.119",]+[[package]]+name = "sys-locale"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"+dependencies = [+ "libc",+]+[[package]]name = "system-configuration"version = "0.7.0"@@ -4854,6 +4892,24 @@ dependencies = ["zbus",]+[[package]]+name = "tauri-plugin-os"+version = "2.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d8f08346c8deb39e96f86973da0e2d76cbb933d7ac9b750f6dc4daf955a6f997"+dependencies = [+ "gethostname",+ "log",+ "os_info",+ "serde",+ "serde_json",+ "serialize-to-javascript",+ "sys-locale",+ "tauri",+ "tauri-plugin",+ "thiserror 2.0.20",+]+[[package]]name = "tauri-plugin-single-instance"version = "2.4.3"diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 950a26d4..a4266846 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -36,6 +36,10 @@ tauri-plugin-autostart = "2"# 版本须与 package.json 的 @tauri-apps/plugin-http(catalog:tauri,^2.6.0)保持同一 minor:# tauri CLI 会在构建前校验 NPM 包与 Rust crate 的 major/minor 是否一致,不一致直接退出。tauri-plugin-http = "2.6"+# 前端读取系统版本(`@tauri-apps/plugin-os` 的 `type()` / `version()`)用于缩放的平台判定。+# 版本须与 package.json 的 @tauri-apps/plugin-os(catalog:tauri,^2.3.2)保持同一 minor:+# tauri CLI 会在构建前校验 NPM 包与 Rust crate 的 major/minor 是否一致,不一致直接退出。+tauri-plugin-os = "2.3"image = { version = "0.25", default-features = false, features = [ "png" ] }arboard = { version = "3", features = [ "wayland-data-control" ] }base64 = "0.22"diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.jsonindex 49bb98fd..a4c30eb2 100644--- a/src-tauri/capabilities/default.json+++ b/src-tauri/capabilities/default.json@@ -28,6 +28,7 @@"core:window:allow-set-size","core:window:allow-cursor-position","core:window:allow-set-ignore-cursor-events",+ "core:webview:allow-set-webview-zoom","opener:default","opener:allow-open-url","opener:allow-default-urls",diff --git a/src-tauri/src/bridge/config.rs b/src-tauri/src/bridge/config.rsindex bc300ab1..fc795bda 100644--- a/src-tauri/src/bridge/config.rs+++ b/src-tauri/src/bridge/config.rs@@ -5,53 +5,7 @@use crate::config;use crate::service::cli;-use serde::Deserialize;-use std::sync::{Mutex, OnceLock};-use tauri::{AppHandle, Manager};--#[derive(Debug, Clone, Copy, Deserialize)]-#[serde(rename_all = "snake_case")]-pub enum ZoomAction {- Increase,- Decrease,- Reset,-}--/// 获取进程级缩放操作锁,防止并发快捷键交错读写而丢失缩放步进。-fn zoom_operation_lock() -> &'static Mutex<()> {- static LOCK: OnceLock<Mutex<()>> = OnceLock::new();- LOCK.get_or_init(|| Mutex::new(()))-}--/// 在同一锁内执行完整缩放事务,使 WebView 状态与持久化配置始终一致。-fn serialize_zoom_operation<T>(operation: impl FnOnce() -> Result<T, String>) -> Result<T, String> {- let _guard = zoom_operation_lock()- .lock()- .unwrap_or_else(|poisoned| poisoned.into_inner());- operation()-}--fn apply_zoom_factor(app_handle: &AppHandle, zoom_factor: f64) -> Result<(), String> {- let window = app_handle- .get_webview_window("main")- .ok_or_else(|| "ZOOM_WINDOW_MISSING: Main window is not available".to_string())?;- crate::desktop::zoom::apply_native_zoom(&window, zoom_factor)-}--fn next_zoom_factor(current: f64, action: ZoomAction) -> f64 {- match action {- ZoomAction::Increase => config::normalize_zoom_factor(current + config::ZOOM_FACTOR_STEP),- ZoomAction::Decrease => config::normalize_zoom_factor(current - config::ZOOM_FACTOR_STEP),- ZoomAction::Reset => config::default_zoom_factor(),- }-}--fn persist_zoom_factor(app_handle: &AppHandle, zoom_factor: f64) -> Result<f64, String> {- let zoom_factor = config::normalize_zoom_factor(zoom_factor);- apply_zoom_factor(app_handle, zoom_factor)?;- let setting = config::set_store_dat_zoom_factor(app_handle, zoom_factor);- Ok(setting.zoom_factor)-}+use tauri::AppHandle;/// 当前桌面端配置#[tauri::command]@@ -132,22 +86,6 @@ pub fn set_launch_on_login(app_handle: AppHandle, enabled: bool) -> Result<bool,crate::desktop::autostart::set_enabled(&app_handle, enabled)}-/// 把设置面板选择的缩放比例立即应用到主 WebView 并持久化。-#[tauri::command]-pub fn set_webview_zoom(app_handle: AppHandle, zoom_factor: f64) -> Result<f64, String> {- serialize_zoom_operation(|| persist_zoom_factor(&app_handle, zoom_factor))-}--/// 调整主 WebView 缩放并立即持久化,供宿主和内嵌页面的快捷键共用。-#[tauri::command]-pub fn adjust_webview_zoom(app_handle: AppHandle, action: ZoomAction) -> Result<f64, String> {- serialize_zoom_operation(|| {- let setting = config::get_store_dat_setting(&app_handle);- let zoom_factor = next_zoom_factor(setting.zoom_factor, action);- persist_zoom_factor(&app_handle, zoom_factor)- })-}-/// 命令行集成状态(shim 文件与 PATH 注册情况)#[tauri::command]pub fn get_cli_link_status(app_handle: AppHandle) -> Result<cli::CliLinkStatus, String> {@@ -181,24 +119,3 @@ pub async fn toggle_sidebar() -> Result<bool, String> {pub fn get_dsh_theme(app_handle: AppHandle) -> config::DshTheme {config::get_dsh_theme(&app_handle)}--#[cfg(test)]-mod tests {- use super::{next_zoom_factor, ZoomAction};- use crate::config::{ZOOM_FACTOR_MAX, ZOOM_FACTOR_MIN};-- #[test]- fn zoom_actions_step_reset_and_clamp() {- assert!((next_zoom_factor(1.0, ZoomAction::Increase) - 1.1).abs() < f64::EPSILON);- assert!((next_zoom_factor(1.0, ZoomAction::Decrease) - 0.9).abs() < f64::EPSILON);- assert_eq!(next_zoom_factor(1.7, ZoomAction::Reset), 1.0);- assert_eq!(- next_zoom_factor(ZOOM_FACTOR_MAX, ZoomAction::Increase),- ZOOM_FACTOR_MAX- );- assert_eq!(- next_zoom_factor(ZOOM_FACTOR_MIN, ZoomAction::Decrease),- ZOOM_FACTOR_MIN- );- }-}diff --git a/src-tauri/src/bridge/pet.rs b/src-tauri/src/bridge/pet.rsindex 098d060d..7f27179e 100644--- a/src-tauri/src/bridge/pet.rs+++ b/src-tauri/src/bridge/pet.rs@@ -1,7 +1,7 @@//! bridge/pet.rs — 桌宠(外置透明宠物窗口)的 Tauri 命令出口。//!//! 这些命令被 dsh 容器(iframe 内的 dsh 界面 / dsh-tauri-pet 插件)经 invoke-//! 桥调用(壳层桥监听模块 `src/hooks/use-iframe-invoke.ts` 把 iframe 的+//! 桥调用(壳层桥监听模块 `src/hooks/use-invoke-iframe.ts` 把 iframe 的//! postMessage invoke 转发到 `@tauri-apps/api/core` 的 `invoke`)。所有状态//! 读写统一落在 `config::setting`(持久化)与 `desktop::pet`(窗口)。//! 错误遵循仓库约定:`Result<_, String>`,Err 以大写协议前缀开头(如diff --git a/src-tauri/src/bridge/plugin.rs b/src-tauri/src/bridge/plugin.rsindex 4d5862fe..447164a1 100644--- a/src-tauri/src/bridge/plugin.rs+++ b/src-tauri/src/bridge/plugin.rs@@ -120,7 +120,7 @@ pub async fn open_preinstall_repo(app_handle: AppHandle, id: String) -> Result<(.map_err(|e| e.to_string())}-/// 当前 profile 已安装插件列表(含解析后的元信息),`use-dsh-plugins` 首次加载用;+/// 当前 profile 已安装插件列表(含解析后的元信息),插件面板首次加载用;/// 之后 Rust 侧监控插件文件,变化时通过 `dsh-plugins-updated` 事件实时推送。/// 这里会并入 `updates` 模块的已知更新判定缓存(未判定时 `update_available=false`)。#[tauri::command]diff --git a/src-tauri/src/config/setting.rs b/src-tauri/src/config/setting.rsindex 53e9fade..e59039d6 100644--- a/src-tauri/src/config/setting.rs+++ b/src-tauri/src/config/setting.rs@@ -306,12 +306,6 @@ wheresetting}-pub fn set_store_dat_zoom_factor(app_handle: &AppHandle, zoom_factor: f64) -> Setting {- update_store_dat_setting(app_handle, |setting| {- setting.zoom_factor = zoom_factor;- })-}-/// 泛型 `Runtime`:允许从非 Wry 具体化的窗口句柄(如工具函数的/// `WebviewWindow<R>`)读取设置;具体类型调用方不受影响。pub fn get_store_dat_setting<R: Runtime>(app_handle: &AppHandle<R>) -> Setting {diff --git a/src-tauri/src/desktop/builder.rs b/src-tauri/src/desktop/builder.rsindex a94f3f57..95cdb0a6 100644--- a/src-tauri/src/desktop/builder.rs+++ b/src-tauri/src/desktop/builder.rs@@ -434,17 +434,16 @@ pub fn build_main_window(app: &tauri::AppHandle<Wry>) -> tauri::Result<tauri::We});// 非 Windows(macOS/Linux)没有 WebView2 的 FrameCreated/ContentLoading 流程,- // 直接用 Tauri 的 initialization_script_for_all_frames 把兼容桥、通知桥、导航桥、- // 样式桥与缩放快捷键桥注入所有 frame(脚本均带幂等守卫,重复注入安全)。+ // 直接用 Tauri 的 initialization_script_for_all_frames 把兼容桥、通知桥、+ // 剪贴板图片桥与 boot 探测桥注入所有 frame(脚本均带幂等守卫,重复注入安全)。+ // 导航桥(侧边栏)、缩放快捷键与 iframe 全局样式已分别由 dsh-tauri /+ // dsh-tauri-ui 插件在 iframe 内实现,不再注入对应脚本。#[cfg(not(windows))]let webview_builder = webview_builder.initialization_script_for_all_frames(crate::desktop::compat::ABORT_SIGNAL_ANY_SHIM_JS).initialization_script_for_all_frames(crate::desktop::notification::NOTIFICATION_SHIM_JS)- .initialization_script_for_all_frames(crate::desktop::nav::NAV_SHIM_JS)- .initialization_script_for_all_frames(crate::desktop::style::IFRAME_STYLES_JS).initialization_script_for_all_frames(crate::desktop::paste::PASTE_SHIM_JS)- .initialization_script_for_all_frames(crate::desktop::plugin_boot::PLUGIN_BOOT_RELOAD_JS)- .initialization_script_for_all_frames(crate::desktop::zoom::ZOOM_SHORTCUT_BRIDGE_JS);+ .initialization_script_for_all_frames(crate::desktop::plugin_boot::PLUGIN_BOOT_RELOAD_JS);let webview_window = webview_builder.build()?;let zoom_factor = crate::config::get_store_dat_setting(app).zoom_factor;@@ -608,8 +607,6 @@ pub fn handler() -> impl Fn(Invoke<Wry>) -> bool + Send + Sync + 'static {crate::bridge::update_app_config,crate::bridge::get_launch_on_login,crate::bridge::set_launch_on_login,- crate::bridge::set_webview_zoom,- crate::bridge::adjust_webview_zoom,crate::bridge::get_cli_link_status,crate::bridge::open_in_browser,crate::bridge::copy_service_url,@@ -801,4 +798,7 @@ pub fn builder() -> tauri::Builder<tauri::Wry> {.plugin(tauri_plugin_http::init())// Simple Store plugin.plugin(tauri_plugin_store::Builder::new().build())+ // OS plugin:前端据此判断系统版本(macOS 10.15 没有 `WKWebView.pageZoom`,+ // 不能把缩放应用到 WebView),见 `hooks/use-zoom-factor.ts`。+ .plugin(tauri_plugin_os::init())}diff --git a/src-tauri/src/desktop/compat.rs b/src-tauri/src/desktop/compat.rsindex cb0f36a7..c203d154 100644--- a/src-tauri/src/desktop/compat.rs+++ b/src-tauri/src/desktop/compat.rs@@ -7,7 +7,7 @@//! WebKitGTK(Linux)上不存在,导致桌面 WebView 抛出//! `AbortSignal.any is not a function. (In '...', 'AbortSignal.any' is undefined)`。//!-//! 本脚本与 [`crate::desktop::nav::NAV_SHIM_JS`] / [`crate::desktop::style::IFRAME_STYLES_JS`]+//! 本脚本与 [`crate::desktop::notification::NOTIFICATION_SHIM_JS`] / [`crate::desktop::paste::PASTE_SHIM_JS`]//! 走同一套注入通道(Windows 在 FrameCreated → ContentLoading 时 ExecuteScript,//! 其余平台 `initialization_script_for_all_frames`),在 dsh 页面脚本执行之前//! 就位,因此主机框架与 iframe 每次重新加载都会自动重建。diff --git a/src-tauri/src/desktop/mod.rs b/src-tauri/src/desktop/mod.rsindex 463147ed..d6f0c821 100644--- a/src-tauri/src/desktop/mod.rs+++ b/src-tauri/src/desktop/mod.rs@@ -2,14 +2,12 @@ pub mod activation;pub mod autostart;pub mod builder;pub mod compat;-pub mod nav;pub mod notification;pub mod paste;pub mod payload;pub mod pet;pub mod pet_mouse;pub mod plugin_boot;-pub mod style;pub mod window;pub mod zoom;diff --git a/src-tauri/src/desktop/nav.rs b/src-tauri/src/desktop/nav.rsdeleted file mode 100644index fe8f791c..00000000--- a/src-tauri/src/desktop/nav.rs+++ /dev/null@@ -1,233 +0,0 @@-//! 壳层导航桥:宿主(ShellNavBar)→ iframe 的导航控制,以及 iframe → 宿主的-//! dsh 状态回报(侧边栏折叠 / 页面历史边界)。-//!-//! 导航栏左侧三个控件(侧边栏切换 / 后退 / 前进)位于 Tauri 宿主文档(`tauri://`),-//! 而目标页面是跨域的 dsh iframe(`http://127.0.0.1:<port>`),宿主无法直接访问-//! iframe 的应用内部状态,只能靠 postMessage + 注入脚本桥接。-//! 本脚本与 [`crate::desktop::notification::NOTIFICATION_SHIM_JS`] 走同一套注入通道-//! (Windows 在 FrameCreated → ContentLoading 时 ExecuteScript,其余平台-//! `initialization_script_for_all_frames`),因此 iframe 每次重新加载都会自动重建。-//!-//! 协议(与 dsh-tauri 插件完全一致):-//! - 接收 `dsh://sidebar:toggle` / `dsh://page:prev` / `dsh://page:next` 命令;-//! - 回报 `dsh://sidebar:collapsed` / `dsh://page:firsted` / `dsh://page:lasted` 事件。-//! 插件加载后设置 `window.__dsh_tauri_bridge__`,本脚本检测到即让位-//! (命令与事件都停发,避免双重执行);插件卸载后自动恢复接管。-//!-//! 页面模型:dsh 应用不产生浏览器历史,「页面」= 侧边栏当前选中的会话-//! (`[role="treeitem"][aria-selected="true"]`)。观察选中会话变化维护会话-//! 访问栈(纯内存):用户点击会话 → 截断前进记录后追加新页并上报;后退/前进 →-//! 点击栈内对应会话行(行元素失效时按标题匹配兜底)。--/// iframe 内注入的导航桥脚本(dsh-tauri 插件缺席时的兜底实现)。-pub(crate) const NAV_SHIM_JS: &str = r#"(function () {- if (window.__dsh_nav_bridge__) return;- window.__dsh_nav_bridge__ = true;-- var SRC_BRIDGE = 'dsh-nav-bridge';- // 侧边栏开关按钮的已知 aria-label(zh/en 两个内置语言),- // 用于校验按位置命中的按钮确实是开关,避免误点品牌/新建会话按钮。- var TOGGLE_LABELS = ['打开侧边栏', '收起侧边栏', 'Open sidebar', 'Collapse sidebar'];- // 会话行菜单按钮的 aria-label 模板(zh/en),用于提取标题与按标题找行。- var SESSION_LABEL_PATTERNS = [/^会话“(.+)”的操作$/, /^Session actions for (.+)$/];-- // dsh-tauri 插件已接管时让位:命令与事件都停发,避免双重执行- function bridgeActive() {- return !!window.__dsh_tauri_bridge__;- }-- function post(message) {- if (bridgeActive()) return;- try {- window.parent.postMessage(Object.assign({ source: SRC_BRIDGE }, message), '*');- } catch (_) {}- }-- // AppFrame:dsh 应用布局的根(shell.overlay 的父节点),- // 与官方 layout 插件维护的 data-sidebar-collapsed 同源。- function findFrame() {- var overlay = document.querySelector('[data-shell-overlay]');- return overlay && overlay.parentElement;- }-- function isCollapsed() {- var frame = findFrame();- return !!(frame && frame.hasAttribute('data-sidebar-collapsed'));- }-- // 定位侧边栏开关按钮:AppFrame 第一个子节点即侧边栏列。- // 展开态 logoRow = 品牌按钮(新建会话) + 开关;折叠态品牌按钮隐藏,开关是第一个按钮。- // 命中后校验 aria-label 是否属于已知开关文案,不属于则全列扫描兜底(新语言包时)。- function findToggleButton() {- var frame = findFrame();- if (!frame) return null;- var col = frame.firstElementChild;- if (!col) return null;- var buttons = col.querySelectorAll('button');- if (buttons.length === 0) return null;-- var idx = isCollapsed() ? 0 : 1;- var ordered = [];- if (buttons[idx]) ordered.push(buttons[idx]);- for (var i = 0; i < buttons.length; i++) ordered.push(buttons[i]);-- for (var j = 0; j < ordered.length; j++) {- var label = (ordered[j].getAttribute('aria-label') || '').trim();- if (TOGGLE_LABELS.indexOf(label) !== -1) return ordered[j];- }- return null;- }-- // ── 会话访问栈(页面模型,纯内存)─────────────────────────────- // dsh 应用不产生浏览器历史,「页面」= 侧边栏当前选中的会话。观察- // aria-selected 变化维护访问栈:用户点击会话 → 截断前进记录后追加;- // 后退/前进 → 点击栈内对应会话行让应用切回。- var pages = []; // [{ key, el }]- var position = 0;- var lastKey = null;- var suppress = false; // 本桥导航落位中,观察器不应记录新页面-- function sidebarCol() {- var frame = findFrame();- return frame ? frame.firstElementChild : null;- }-- // 当前选中的会话行- function currentSelected() {- var col = sidebarCol();- if (!col) return null;- return col.querySelector('[role="treeitem"][aria-selected="true"]');- }-- // 行标题:从行内菜单按钮 aria-label 提取(zh/en),失败回退整行文本- function rowTitle(row) {- if (!row) return '';- var btn = row.querySelector('button[aria-label]');- var label = btn ? (btn.getAttribute('aria-label') || '') : '';- for (var i = 0; i < SESSION_LABEL_PATTERNS.length; i++) {- var m = SESSION_LABEL_PATTERNS[i].exec(label);- if (m) return m[1].trim();- }- return label || (row.textContent || '').trim();- }-- // 按标题找会话行(行元素被重建后的兜底)- function findRowByTitle(title) {- if (!title) return null;- var col = sidebarCol();- if (!col) return null;- var rows = col.querySelectorAll('[role="treeitem"]');- for (var i = 0; i < rows.length; i++) {- if (rowTitle(rows[i]) === title) return rows[i];- }- return null;- }-- function reportPage() {- if (bridgeActive()) return;- post({ type: 'dsh://page:firsted', firsted: position <= 0 });- post({ type: 'dsh://page:lasted', lasted: position >= pages.length - 1 });- }-- // 用户导航到新会话:截断前进记录后追加- function pushPage(key, el) {- pages = pages.slice(0, position + 1).concat([{ key: key, el: el }]);- position = pages.length - 1;- reportPage();- }-- // 后退/前进:切到栈内目标页(点击对应会话行让应用落位)- function navigateTo(index) {- if (index < 0 || index >= pages.length) return;- var page = pages[index];- position = index;- var target = page.el && page.el.isConnected ? page.el : findRowByTitle(page.key || '');- if (target) {- suppress = true;- target.click();- }- reportPage();- }-- function onDomChange() {- if (bridgeActive()) return;- var sel = currentSelected();- var key = rowTitle(sel);- if (key === lastKey) return;- lastKey = key;- if (suppress) {- // 本桥导航落位:同步当前页记录(行元素可能被 React 重建)- suppress = false;- if (pages[position] !== undefined) {- pages[position] = { key: key, el: sel };- }- return;- }- // 用户主动切换会话(无选中 = 欢迎/归档态,不入栈)- if (key) pushPage(key, sel);- }-- var pageObserver = new MutationObserver(onDomChange);-- // ── 侧边栏折叠观察 + 初始化 ──────────────────────────────────- function reportSidebar() {- if (bridgeActive()) return;- post({ type: 'dsh://sidebar:collapsed', collapsed: isCollapsed() });- }-- // 应用挂载前无会话树:轮询直到拿到 AppFrame 再初始化- function startTrack() {- var frame = findFrame();- if (!frame) return false;-- new MutationObserver(reportSidebar)- .observe(frame, { attributes: true, attributeFilter: ['data-sidebar-collapsed'] });- reportSidebar();-- var sel = currentSelected();- var key = rowTitle(sel);- lastKey = key;- // 根页:当前选中的会话(无选中时以「欢迎页」为根,首个会话打开即入栈)- pages = [{ key: key || null, el: sel }];- position = 0;- pageObserver.observe(document.body, {- childList: true,- subtree: true,- attributes: true,- attributeFilter: ['aria-selected']- });- reportPage();- return true;- }- (function () {- if (startTrack()) return;- var tries = 0;- var timer = setInterval(function () {- if (startTrack()) {- clearInterval(timer);- } else if (++tries > 30) {- clearInterval(timer);- }- }, 500);- })();-- // ── 宿主命令接收 ─────────────────────────────────────────────- window.addEventListener('message', function (event) {- if (bridgeActive()) return;- var data = event.data;- if (!data || typeof data !== 'object' || data.source !== 'dsh-desktop') return;- switch (data.type) {- case 'dsh://sidebar:toggle': {- var btn = findToggleButton();- if (btn) btn.click();- break;- }- case 'dsh://page:prev':- navigateTo(position - 1);- break;- case 'dsh://page:next':- navigateTo(position + 1);- break;- }- });-})();"#;diff --git a/src-tauri/src/desktop/notification.rs b/src-tauri/src/desktop/notification.rsindex e451d724..3cc23b4e 100644--- a/src-tauri/src/desktop/notification.rs+++ b/src-tauri/src/desktop/notification.rs@@ -323,14 +323,12 @@ pub fn enable_notification_permissions(let _ = frame3.add_ContentLoading(&FrameContentLoadingEventHandler::create(Box::new(move |_, _| {- // 通知桥、导航桥、样式桥、剪贴板图片桥与缩放快捷键桥需要 iframe 上下文执行。+ // 通知桥、剪贴板图片桥与 boot 探测桥需要 iframe 上下文执行。+ // (导航桥 / 缩放快捷键 / 全局样式已分别由 dsh-tauri、dsh-tauri-ui 插件承担。)for script in [crate::desktop::notification::NOTIFICATION_SHIM_JS,- crate::desktop::nav::NAV_SHIM_JS,- crate::desktop::style::IFRAME_STYLES_JS,crate::desktop::paste::PASTE_SHIM_JS,crate::desktop::plugin_boot::PLUGIN_BOOT_RELOAD_JS,- crate::desktop::zoom::ZOOM_SHORTCUT_BRIDGE_JS,] {let script = HSTRING::from(script);let _ = frame_for_injection.ExecuteScript(diff --git a/src-tauri/src/desktop/paste.rs b/src-tauri/src/desktop/paste.rsindex fcbb2451..30c5c9ed 100644--- a/src-tauri/src/desktop/paste.rs+++ b/src-tauri/src/desktop/paste.rs@@ -8,7 +8,7 @@//! 构造 File 并重发一次合成 `paste` 事件给当前焦点元素,让 dsh 聊天框按普通//! 贴图路径处理,从而与浏览器行为一致。//!-//! 与 [`crate::desktop::notification::NOTIFICATION_SHIM_JS`] / [`crate::desktop::nav::NAV_SHIM_JS`]+//! 与 [`crate::desktop::notification::NOTIFICATION_SHIM_JS`] / [`crate::desktop::compat::ABORT_SIGNAL_ANY_SHIM_JS`]//! 走同一套注入通道(Windows 在 FrameCreated → ContentLoading 时 ExecuteScript,//! 其余平台 `initialization_script_for_all_frames`)。脚本带 `__dsh_clipboard_image_bridge__`//! 幂等守卫,重复注入安全;只处理「直接 iframe」发来的剪贴板请求,避免多层 iframe 误转发。diff --git a/src-tauri/src/desktop/pet.rs b/src-tauri/src/desktop/pet.rsindex a12c6f32..8297636c 100644--- a/src-tauri/src/desktop/pet.rs+++ b/src-tauri/src/desktop/pet.rs@@ -322,13 +322,10 @@ pub fn ensure_pet_window<R: Runtime>(app: &AppHandle<R>) -> tauri::Result<Webvie.initialization_script_for_all_frames(crate::desktop::notification::NOTIFICATION_SHIM_JS,)- .initialization_script_for_all_frames(crate::desktop::nav::NAV_SHIM_JS)- .initialization_script_for_all_frames(crate::desktop::style::IFRAME_STYLES_JS).initialization_script_for_all_frames(crate::desktop::paste::PASTE_SHIM_JS).initialization_script_for_all_frames(crate::desktop::plugin_boot::PLUGIN_BOOT_RELOAD_JS,- )- .initialization_script_for_all_frames(crate::desktop::zoom::ZOOM_SHORTCUT_BRIDGE_JS);+ );}let window = builder.build()?;diff --git a/src-tauri/src/desktop/style.rs b/src-tauri/src/desktop/style.rsdeleted file mode 100644index cce41e6e..00000000--- a/src-tauri/src/desktop/style.rs+++ /dev/null@@ -1,50 +0,0 @@-//! 注入到内嵌 dsh iframe 的自定义样式桥。-//!-//! 与 [`crate::desktop::nav::NAV_SHIM_JS`] / [`crate::desktop::notification::NOTIFICATION_SHIM_JS`]-//! 走同一套注入通道(Windows 在 FrameCreated → ContentLoading 时 ExecuteScript,-//! 其余平台 `initialization_script_for_all_frames`),因此 iframe 每次重新加载都会重建。-//!-//! 本脚本只负责把一段内置 CSS 以 `<style>` 元素注入 iframe 文档(幂等:按 id 去重)。-//! 具体样式写在下方的 `css` 模板字符串里,兼容内嵌插件的面板控件。--/// 注入 `<style>` 的脚本(带 `__dsh_iframe_styles__` 幂等守卫,重复注入安全)。-/// 样式直接写在 `css` 模板字符串里,改这里即可。-pub(crate) const IFRAME_STYLES_JS: &str = r#"(function () {- if (window.__dsh_iframe_styles__) return;- window.__dsh_iframe_styles__ = true;-- var STYLE_ID = 'dsh-desktop-injected-styles';-- // 优先使用插件的稳定标记,旧版插件保留类名兼容。- // 页面按 aria-label 隐藏左侧收起按钮的规则会误伤右侧面板,这里只恢复面板开关。- var css = `- [data-dsh-toggle-cluster], .nArs4W_toggleCluster {- top: 6px !important;- right: 6px !important;- gap: 2px !important;- }- [data-dsh-toggle-cluster] button[aria-label], .nArs4W_toggleCluster button[aria-label] {- display: flex !important;- border-radius: 8px !important;- flex-shrink: 0;- }- `;-- function apply() {- if (document.getElementById(STYLE_ID)) return;- var root = document.head || document.documentElement;- if (!root) return;- var style = document.createElement('style');- style.id = STYLE_ID;- style.type = 'text/css';- style.textContent = css;- root.appendChild(style);- }-- // 非 Windows 平台在 document-start 注入,head 可能尚未就绪,等 DOM ready 后再挂。- if (document.readyState === 'loading') {- document.addEventListener('DOMContentLoaded', apply);- } else {- apply();- }-})();"#;diff --git a/src-tauri/src/desktop/zoom.rs b/src-tauri/src/desktop/zoom.rsindex b5558b04..9390424e 100644--- a/src-tauri/src/desktop/zoom.rs+++ b/src-tauri/src/desktop/zoom.rs@@ -55,34 +55,9 @@ pub fn apply_native_zoom<R: Runtime>(.map_err(|error| format!("ZOOM_APPLY_FAILED: {error}"))}-pub const ZOOM_SHORTCUT_BRIDGE_JS: &str = r#"-(() => {- if (window.parent === window || window.parent !== window.top) return;- if (window.__dsh_zoom_shortcut_bridge__) return;- window.__dsh_zoom_shortcut_bridge__ = true;-- window.addEventListener('keydown', (event) => {- if ((!event.ctrlKey && !event.metaKey) || event.altKey) return;-- let action = null;- if (event.key === '+' || event.key === '=') action = 'increase';- else if (event.key === '-' || event.key === '_') action = 'decrease';- else if (event.key === '0') action = 'reset';- if (!action) return;-- event.preventDefault();- window.parent.postMessage({- source: 'dsh-zoom-shortcut-bridge',- type: 'dsh://zoom-shortcut',- action,- }, '*');- }, { capture: true });-})();-"#;-#[cfg(test)]mod tests {- use super::{macos_zoom_support_error, MINIMUM_MACOS_ZOOM_MAJOR, ZOOM_SHORTCUT_BRIDGE_JS};+ use super::{macos_zoom_support_error, MINIMUM_MACOS_ZOOM_MAJOR};#[test]fn native_zoom_requires_macos_11_or_newer() {@@ -94,23 +69,4 @@ mod tests {assert!(macos_zoom_support_error(true, 15, 4).is_none());assert!(macos_zoom_support_error(true, 10, 16).is_none());}-- #[test]- fn bridge_is_idempotent_and_limited_to_direct_child_frames() {- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("window.__dsh_zoom_shortcut_bridge__"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("window.parent === window"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("window.parent !== window.top"));- }-- #[test]- fn bridge_filters_modifiers_and_known_zoom_keys() {- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("event.ctrlKey"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("event.metaKey"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("event.altKey"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("event.key === '+'"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("event.key === '-'"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("event.key === '0'"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("event.preventDefault()"));- assert!(ZOOM_SHORTCUT_BRIDGE_JS.contains("dsh://zoom-shortcut"));- }}diff --git a/src-tauri/src/service/plugin/watch.rs b/src-tauri/src/service/plugin/watch.rsindex 58cd16f3..3ff7660a 100644--- a/src-tauri/src/service/plugin/watch.rs+++ b/src-tauri/src/service/plugin/watch.rs@@ -1,6 +1,6 @@//! 已安装插件监控:轮询 profile 插件文件(`package.json` + `node_modules` 下//! 各直接依赖清单),内容变化时解析为结构化列表并通过 `dsh-plugins-updated`-//! 事件实时推送给前端(`use-dsh-plugins` hook 消费)。+//! 事件实时推送给前端(由根布局写入插件列表查询缓存)。//!//! 采用与主题轮询(`config/theme.rs`)一致的「秒级 tick + 指纹比对」方案,//! 不引入 notify 等文件监听依赖:插件数量少(个位数到十几个),每次读取的diff --git a/src/components/ellipsis.tsx b/src/components/ellipsis.tsxindex 574eb76e..3c9df653 100644--- a/src/components/ellipsis.tsx+++ b/src/components/ellipsis.tsx@@ -1,6 +1,7 @@import type { ReactNode } from 'react'import type { VariantProps } from 'tailwind-variants'import { Tooltip } from '@heroui/react'+import { useElementOverflow } from '@reause/core'import { useRef, useState } from 'react'import { cn, tv } from 'tailwind-variants'@@ -20,33 +21,30 @@ const ellipsis = tv({},})+/**+ * 单行/多行截断文本:仅在真的溢出时才弹 Tooltip。+ *+ * 溢出判定交给 reause `useElementOverflow`(ResizeObserver + MutationObserver 观测+ * 容器与子元素的尺寸/内容变化),不再自建 ref + hover 时手量:+ * - 多行(`lineClamp`)看纵向溢出(scrollHeight > offsetHeight);+ * - 单行(truncate)看横向溢出(scrollWidth > offsetWidth)。+ *+ * `forceTooltip` 跳过溢出判定,始终允许弹出(内容异步渲染等观测不到的场合)。+ */export function Ellipsis(props: EllipsisProps & VariantProps<typeof ellipsis>) {const [open, setOpen] = useState(false)const { container, tooltip } = ellipsis(props)const triggerRef = useRef<HTMLDivElement>(null)- const triggerInnerRef = useRef<HTMLSpanElement>(null)+ const { isXOverflowed, isYOverflowed } = useElementOverflow(triggerRef, { observeMutation: true })+ const overflowed = props.lineClamp === undefined ? isXOverflowed : isYOverflowed- function getDisabled() {- if (!triggerRef.current)- return true- let tooltipDisabled = false- const { current: trigger } = triggerRef- const { current: triggerInner } = triggerInnerRef- if (props.lineClamp !== undefined) {- tooltipDisabled = trigger.scrollHeight <= trigger.offsetHeight- }- else if (triggerInner) {- tooltipDisabled = triggerInner.getBoundingClientRect().width <= trigger.getBoundingClientRect().width- }- return tooltipDisabled- }-- function onOpenChange(open: boolean) {- if (getDisabled() && !props.forceTooltip)+ function onOpenChange(next: boolean) {+ if (!overflowed && !props.forceTooltip)return- setOpen(open)+ setOpen(next)}+return (<Tooltip isOpen={open} onOpenChange={onOpenChange}><div@@ -61,7 +59,7 @@ export function Ellipsis(props: EllipsisProps & VariantProps<typeof ellipsis>) {} as React.CSSProperties}>- {props.lineClamp ? props.children : <span ref={triggerInnerRef}>{props.children}</span>}+ {props.lineClamp ? props.children : <span>{props.children}</span>}</div><Tooltip.Content className={cn(tooltip(), props.tooltipClassName)}>{props.tooltip || props.children}diff --git a/src/components/empty.tsx b/src/components/empty.tsxindex 04d50d5d..5ba06824 100644--- a/src/components/empty.tsx+++ b/src/components/empty.tsx@@ -3,7 +3,7 @@ import { cn } from 'tailwind-variants'/*** 空态 / 内联提示:带边框的浅底小字提示条。- * 统一为 config-core「本地核心缺失提示」的样式(p-3、左对齐),+ * 统一为 ui/config/core「本地核心缺失提示」的样式(p-3、左对齐),* 供各配置面板的空列表与补充提示共用。*/export interface EmptyProps {diff --git a/src/components/info.tsx b/src/components/info.tsxindex e3abdacc..2097f9f2 100644--- a/src/components/info.tsx+++ b/src/components/info.tsx@@ -3,7 +3,7 @@ import { cn } from 'tailwind-variants'/*** 信息键值行(term|value):两侧对齐的「项目名 + 值」行。- * 供 config-debug 的运行时信息与「关于 / 检查更新」对话框共用,+ * 供 ui/config/debug 的运行时信息与「关于 / 检查更新」对话框共用,* 值默认用等宽字体(版本号/路径等类代码内容)。*/export interface InfoProps {diff --git a/src/components/item.tsx b/src/components/item.tsxindex 6448d58f..acf9e414 100644--- a/src/components/item.tsx+++ b/src/components/item.tsx@@ -9,7 +9,7 @@ import { cn } from 'tailwind-variants'** - left:行左侧主内容(min-w-0,允许截断)* - right:行右侧操作区(shrink-0,勾选框 / 按钮 / 状态 chip 等)- * - footer:主行之后的附加内容(如 config-core 的「本地核心更新」入口)+ * - footer:主行之后的附加内容(如 ui/config/core 的「本地核心更新」入口)* - onClick:传入则整行可点击并显示手型光标*/export interface ItemProps {diff --git a/src/components/logs.tsx b/src/components/logs.tsxindex cbb28da9..55f90565 100644--- a/src/components/logs.tsx+++ b/src/components/logs.tsx@@ -2,11 +2,11 @@ import type { ReactNode } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'import { cn } from 'tailwind-variants'-import { formatLogLine } from '@/utils/log'+import { formatLogLine } from './logs.utils'/*** 日志面板:带边框的「› + 行」日志容器 + 空日志占位。- * 供 panel-progress 与 preinstall-setup 的日志控制台共用;+ * 供 `Panel.Progress` 与 setup-preinstall 的日志控制台共用;* 顶部可选 header(如复制按钮)。*/export interface LogsProps {diff --git a/src/utils/log.ts b/src/components/logs.utils.tssimilarity index 100%rename from src/utils/log.tsrename to src/components/logs.utils.tsdiff --git a/src/components/panel-header.tsx b/src/components/panel-header.tsxdeleted file mode 100644index c8f631a6..00000000--- a/src/components/panel-header.tsx+++ /dev/null@@ -1,27 +0,0 @@-import type { ReactNode } from 'react'-import { Typography } from '@heroui/react'-import { cn } from 'tailwind-variants'--/**- * 配置面板头部:标题 + 说明。- * 与 config-plugin / core / profile 的「面板头」一致,- * className 用于叠加 sticky / 背景等定位类(如 config-plugin 的 sticky 头部)。- */-export interface PanelHeaderProps {- title: string | ReactNode- description: string- className?: string- action?: ReactNode-}--export function PanelHeader({ title, description, className, action }: PanelHeaderProps) {- return (- <div className={cn('space-y-2', className)}>- <div className="flex items-center justify-between gap-3">- {typeof title === 'string' ? <Typography type="h4">{title}</Typography> : title}- {action}- </div>- <Typography color="muted" type="body-sm">{description}</Typography>- </div>- )-}diff --git a/src/components/panel-progress.tsx b/src/components/panel-progress.tsxdeleted file mode 100644index 1c7a4f2d..00000000--- a/src/components/panel-progress.tsx+++ /dev/null@@ -1,44 +0,0 @@-import { Logs } from './logs'--const LOG_LIMIT = 5--/**- * 安装/下载进度面板:进度条 + 日志面板。- *- * 从 Loadable 中拆出,供首次安装(setup)与核心版本下载对话框共用:- * 两处都要展示 `install-progress` 事件驱动的百分比与日志流。- */-export interface PanelProgressProps {- /** 进度百分比(0-100);不传则不渲染进度条 */- percentage?: number- /** 日志行;不传则不渲染日志面板(空数组渲染"等待日志"占位) */- logs?: readonly string[]-}--export function PanelProgress({ percentage, logs }: PanelProgressProps) {- const hasLogs = logs != null- const showPanel = hasLogs || percentage != null-- if (!showPanel) {- return null- }-- return (- <div className="flex w-full flex-col gap-4">- {percentage != null && (- <div className="flex items-center gap-3">- <div className="h-2 flex-1 overflow-hidden rounded-full bg-panel2" role="progressbar" aria-valuenow={Math.round(percentage)}>- <div className="h-full bg-gradient-to-r from-accent to-accent2 transition-[width] duration-150" style={{ width: `${Math.min(percentage, 100)}%` }} />- </div>- <span className="min-w-[44px] text-right text-[13px] font-semibold tabular-nums text-accent2">- {Math.round(percentage)}- %- </span>- </div>- )}- {hasLogs && (- <Logs logs={logs ?? []} limit={LOG_LIMIT} bodyClassName="max-h-[184px]" />- )}- </div>- )-}diff --git a/src/components/panel-state.tsx b/src/components/panel-state.tsxdeleted file mode 100644index 6d77ff66..00000000--- a/src/components/panel-state.tsx+++ /dev/null@@ -1,43 +0,0 @@-import type { ReactNode } from 'react'-import { Spinner } from '@heroui/react'-import { useTranslation } from 'react-i18next'-import { If } from 'react-if-lite'--/**- * 列表三态(加载中 / 加载失败 / 正常内容)。- * 对齐各配置面板(plugin / core / profile)的展示:加载中带 spinner,- * 失败态复用 plugins.error 文案;error 为空且非 loading 时渲染 children。- */-export interface PanelStateProps {- loading: boolean- error: string- children?: ReactNode-}--export function PanelState({ loading, error, children }: PanelStateProps) {- const { t } = useTranslation()- return (- <If- cond={!loading && error === ''}- else={(- <If- cond={loading}- else={(- <p className="rounded-md border border-danger/30 bg-danger/5 p-3 text-xs text-danger">- {t('plugins.error')}- :- {error}- </p>- )}- >- <div className="flex items-center justify-center gap-2 p-4 text-xs text-muted">- <Spinner size="sm" color="current" />- {t('plugins.loading')}- </div>- </If>- )}- >- {children}- </If>- )-}diff --git a/src/components/panel.tsx b/src/components/panel.tsxnew file mode 100644index 00000000..b45b1267--- /dev/null+++ b/src/components/panel.tsx@@ -0,0 +1,120 @@+/* eslint-disable react-refresh/only-export-components -- 复合组件导出(与 HeroUI 的 Modal.* / Select.* 同款写法) */+import type { ReactNode } from 'react'+import { Spinner, Typography } from '@heroui/react'+import { useTranslation } from 'react-i18next'+import { If } from 'react-if-lite'+import { cn } from 'tailwind-variants'+import { Logs } from './logs'++/** 进度面板最多展示的日志行数 */+const LOG_LIMIT = 5++/**+ * 面板(`Panel`)复合组件:设置面板共用的三块结构。+ *+ * - `Panel.Header` 标题 + 说明(+ 右侧动作位)+ * - `Panel.Loadable` 列表三态(加载中 / 加载失败 / 正常内容)+ * - `Panel.Progress` 进度条 + 日志面板+ *+ * 三者原本是三个独立文件(panel-header / panel-loadable / panel-progress),+ * 统一收敛到本文件并用点号导出,调用方只需 import 一个 `Panel`。+ */+export interface PanelHeaderProps {+ title: string | ReactNode+ description: string+ className?: string+ action?: ReactNode+}++/** 配置面板头部:标题 + 说明;className 用于叠加 sticky / 背景等定位类。 */+function Header({ title, description, className, action }: PanelHeaderProps) {+ return (+ <div className={cn('space-y-2', className)}>+ <div className="flex items-center justify-between gap-3">+ {typeof title === 'string' ? <Typography type="h4">{title}</Typography> : title}+ {action}+ </div>+ <Typography color="muted" type="body-sm">{description}</Typography>+ </div>+ )+}++export interface PanelLoadableProps {+ loading: boolean+ error: string+ children?: ReactNode+}++/**+ * 列表三态(加载中 / 加载失败 / 正常内容)。+ * 加载中带 spinner,失败态复用 plugins.error 文案;error 为空且非 loading 时渲染 children。+ */+function Loadable({ loading, error, children }: PanelLoadableProps) {+ const { t } = useTranslation()+ return (+ <If+ cond={!loading && error === ''}+ else={(+ <If+ cond={loading}+ else={(+ <p className="rounded-md border border-danger/30 bg-danger/5 p-3 text-xs text-danger">+ {t('plugins.error')}+ :+ {error}+ </p>+ )}+ >+ <div className="flex items-center justify-center gap-2 p-4 text-xs text-muted">+ <Spinner size="sm" color="current" />+ {t('plugins.loading')}+ </div>+ </If>+ )}+ >+ {children}+ </If>+ )+}++export interface PanelProgressProps {+ /** 进度百分比(0-100);不传则不渲染进度条 */+ percentage?: number+ /** 日志行;不传则不渲染日志面板(空数组渲染"等待日志"占位) */+ logs?: readonly string[]+}++/**+ * 安装/下载进度面板:进度条 + 日志面板。+ * 供首次安装(setup)与核心版本下载对话框共用:两处都要展示+ * `install-progress` 事件驱动的百分比与日志流。+ */+function Progress({ percentage, logs }: PanelProgressProps) {+ const hasLogs = logs != null+ const showPanel = hasLogs || percentage != null++ if (!showPanel) {+ return null+ }++ return (+ <div className="flex w-full flex-col gap-4">+ {percentage != null && (+ <div className="flex items-center gap-3">+ <div className="h-2 flex-1 overflow-hidden rounded-full bg-panel2" role="progressbar" aria-valuenow={Math.round(percentage)}>+ <div className="h-full bg-gradient-to-r from-accent to-accent2 transition-[width] duration-150" style={{ width: `${Math.min(percentage, 100)}%` }} />+ </div>+ <span className="min-w-[44px] text-right text-[13px] font-semibold tabular-nums text-accent2">+ {Math.round(percentage)}+ %+ </span>+ </div>+ )}+ {hasLogs && (+ <Logs logs={logs ?? []} limit={LOG_LIMIT} bodyClassName="max-h-[184px]" />+ )}+ </div>+ )+}++export const Panel = { Header, Loadable, Progress }diff --git a/src/components/toast-provider.tsx b/src/components/toast-provider.tsxindex 94e386d6..cfee1869 100644--- a/src/components/toast-provider.tsx+++ b/src/components/toast-provider.tsx@@ -1,9 +1,10 @@import type { ReactNode } from 'react'-import type { ToastUpdateEvent } from '@/utils/toast'-import { useEventBus } from '@hairy/react-lib'+import type { ToastUpdateEvent } from '@/config/hooks'import { Spinner, Toast } from '@heroui/react'+import { useListener } from '@reause/core'import { useState } from 'react'import { If } from 'react-if-lite'+import { hooks } from '@/config/hooks'import { activeQueues, placements } from '@/utils/toast'interface ToastProviderProps {@@ -18,7 +19,8 @@ interface ToastProviderProps {export function ToastProvider(props: ToastProviderProps) {const [updates, setUpdates] = useState(() => new Map<string, ToastUpdateEvent['options']>())- useEventBus<ToastUpdateEvent>('toast.update').on((event) => {+ // 订阅 toast 原地更新事件;useListener 负责在卸载时注销+ useListener(hooks['toast.updated'].on, (event) => {if (event === undefined || typeof event.key !== 'string')returnsetUpdates((current) => {diff --git a/src/config/hooks.ts b/src/config/hooks.tsnew file mode 100644index 00000000..5acce4e1--- /dev/null+++ b/src/config/hooks.ts@@ -0,0 +1,27 @@+import type { ToastContentValue } from '@heroui/react/toast'+import { createEventHook } from '@reause/core'++/**+ * 壳层瞬时事件总线(reause `createEventHook`)。+ *+ * 只承载「无状态、可能跨 store 触发」的瞬时通知;跨组件状态一律走 valtio-define+ * store,不要往这里加新的全局状态。+ *+ * 消费端统一用 reause `useListener` 绑定,卸载自动注销:+ * ```tsx+ * useListener(hooks['toast.updated'].on, (event) => { ... })+ * ```+ */++/** toast 内容原地更新(HeroUI ToastQueue 没有 update 方法,由 ToastProvider 消费后重渲染) */+export interface ToastUpdateEvent {+ key: string+ options: Partial<ToastContentValue>+}++export const hooks = {+ /** `toast.update()` 触发,`ToastProvider` 监听后原地更新对应 queue 的 content */+ 'toast.updated': createEventHook<ToastUpdateEvent>(),+ /** 请求关闭设置对话框(harness / preinstall store 在服务重启、退出前收起弹层) */+ 'config.dialog.hidden': createEventHook<void>(),+}diff --git a/src/config/query-keys.ts b/src/config/query-keys.tsnew file mode 100644index 00000000..070018a7--- /dev/null+++ b/src/config/query-keys.ts@@ -0,0 +1,24 @@+/**+ * react-query 查询键集中定义。+ *+ * 查询键是「谁在读写同一份缓存」的契约:面板查询、store 的重启失效、后端事件+ * 写入缓存都按同一份字面量操作,散落各处会出现「失效不生效」的静默 bug。+ */+export const queryKeys = {+ /** 运行时信息(版本 / 端口 / 路径,debug 面板) */+ info: ['info'] as const,+ /** CLI 链接状态(debug 面板) */+ cliStatus: ['cli_status'] as const,+ /** 服务运行日志(debug 面板,2s 轮询) */+ logs: ['logs'] as const,+ /** 开机自启开关 */+ launchOnLogin: ['launch_on_login'] as const,+ /** Harness 核心列表(local / app-<tag>) */+ cores: ['cores'] as const,+ /** 已安装 dsh 插件列表(面板 / 配置对话框角标 / 导航栏共用) */+ plugins: ['plugins'] as const,+ /** dsh 档案列表 */+ profiles: ['profiles'] as const,+ /** 当前档案的备份快照列表 */+ backups: ['backups'] as const,+} as constdiff --git a/src/config/storage.driver.ts b/src/config/storage.driver.tsnew file mode 100644index 00000000..8a54b804--- /dev/null+++ b/src/config/storage.driver.ts@@ -0,0 +1,37 @@+import type { StoreOptions } from '@tauri-apps/plugin-store'+import { Store } from '@tauri-apps/plugin-store'+import { defineDriver } from 'unstorage'++export interface TauriStorageDriverOptions {+ path?: string+ options?: StoreOptions+}++export const tauriStorageDriver = defineDriver<TauriStorageDriverOptions | undefined, never>((options) => {+ const promise = Store.load(options?.path ?? '.store.dat', options?.options)+ return {+ name: 'tauri-storage',+ options,+ async hasItem(key) {+ return promise.then(store => store.has(key))+ },+ async getItem(key) {+ return promise.then(store => store.get(key))+ },+ async setItem(key, value) {+ return promise.then(store => store.set(key, value))+ },+ async removeItem(key) {+ await promise.then(store => store.delete(key))+ },+ async getKeys() {+ return promise.then(store => store.keys())+ },+ async clear() {+ return promise.then(store => store.clear())+ },+ async watch(callback) {+ return promise.then(store => store.onChange((key, value) => callback(value === null ? 'remove' : 'update', key)))+ },+ }+})diff --git a/src/config/storage.ts b/src/config/storage.tsnew file mode 100644index 00000000..c91f0b95--- /dev/null+++ b/src/config/storage.ts@@ -0,0 +1,6 @@+import { createStorage } from 'unstorage'+import { tauriStorageDriver } from './storage.driver'++export const storage = createStorage({+ driver: tauriStorageDriver({ path: '.store.dat' }),+})diff --git a/src/hooks/use-app-config.ts b/src/hooks/use-app-config.tsdeleted file mode 100644index a4c9c60d..00000000--- a/src/hooks/use-app-config.ts+++ /dev/null@@ -1,21 +0,0 @@-import { useQuery } from '@tanstack/react-query'-import { invoke } from '@tauri-apps/api/core'--export interface AppConfig {- port: number- auto_start: boolean- cli_link_enabled: boolean- zoom_factor: number- close_action: string- backup_retention_count: number- backup_include_credentials: boolean-}--/// 共享的 app 配置查询:config-close-action 与 config-debug 共用同一份-/// queryKey/queryFn 定义,避免两处手写 useQuery 漂移(如一方加了 staleTime)。-export function useAppConfig() {- return useQuery({- queryKey: ['config'],- queryFn: () => invoke<AppConfig>('get_app_config'),- })-}diff --git a/src/hooks/use-backup.ts b/src/hooks/use-backup.tsindex e51ee572..917b71bf 100644--- a/src/hooks/use-backup.ts+++ b/src/hooks/use-backup.ts@@ -1,7 +1,7 @@import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { useEffect } from 'react'+import { queryKeys } from '@/config/query-keys'+import { useInvalidateOnSettingUpdated } from '@/hooks/use-invalidate-on-setting-updated'/** Rust 侧 service::backup::BackupInfo 的序列化形态(camelCase) */export interface BackupInfo {@@ -31,38 +31,22 @@ export interface UseBackupsResult {/*** 备份列表与操作(react-query)。*- * 查询键 `['backups']`:备份设置存在桌面端 store,`update_app_config` 会触发- * `setting_updated` 事件,这里监听该事件一并失效重拉,保证列表与后端一致。+ * 备份设置存在桌面端 store,`update_app_config` 会触发 `setting_updated` 事件,+ * 这里监听该事件一并失效重拉,保证列表与后端一致。*/export function useBackups(): UseBackupsResult {const queryClient = useQueryClient()const { data, isLoading, error, refetch } = useQuery({- queryKey: ['backups'],+ queryKey: queryKeys.backups,queryFn: () => invoke<BackupInfo[]>('list_backups'),})// 后端设置变更(配置变化触发备份等)后刷新备份列表- useEffect(() => {- let disposed = false- let unlisten: (() => void) | undefined- listen('setting_updated', () => {- void queryClient.invalidateQueries({ queryKey: ['backups'] })- })- .then((fn) => {- if (disposed)- fn()- else unlisten = fn- })- .catch(() => {})- return () => {- disposed = true- unlisten?.()- }- }, [queryClient])+ useInvalidateOnSettingUpdated(queryKeys.backups)- const invalidate = () => {- void queryClient.invalidateQueries({ queryKey: ['backups'] })+ function invalidate() {+ void queryClient.invalidateQueries({ queryKey: queryKeys.backups })}const create = useMutation({diff --git a/src/hooks/use-const.ts b/src/hooks/use-const.tsnew file mode 100644index 00000000..f769bcd1--- /dev/null+++ b/src/hooks/use-const.ts@@ -0,0 +1,19 @@+import { useRef } from 'react'++/**+ * 在组件整个生命周期中保持值不变+ * 支持直接传值或传入初始化函数+ */+export function useConst<T>(initialValue: T | (() => T)): T {+ const ref = useRef<{ value: T } | null>(null)++ if (ref.current === null) {+ ref.current = {+ value: typeof initialValue === 'function'+ ? (initialValue as () => T)()+ : initialValue,+ }+ }++ return ref.current.value+}diff --git a/src/hooks/use-desktop-zoom.ts b/src/hooks/use-desktop-zoom.tsdeleted file mode 100644index 09f05485..00000000--- a/src/hooks/use-desktop-zoom.ts+++ /dev/null@@ -1,43 +0,0 @@-import type { RefObject } from 'react'-import type { ZoomAction } from '@/utils/zoom'-import { invoke } from '@tauri-apps/api/core'-import { useEffect } from 'react'-import { queryClient } from '@/config/client'-import { getIframeOrigin } from '@/utils/iframe'-import { zoomActionFromBridgeMessage, zoomActionFromShortcut } from '@/utils/zoom'--export function useDesktopZoom(iframeRef: RefObject<HTMLIFrameElement | null>) {- useEffect(() => {- function applyZoom(action: ZoomAction) {- void invoke<number>('adjust_webview_zoom', { action })- .then(() => queryClient.invalidateQueries({ queryKey: ['config'] }))- .catch(error => console.error('[zoom] adjust_webview_zoom failed:', error))- }-- function handleKeyDown(event: KeyboardEvent) {- const action = zoomActionFromShortcut(event)- if (!action)- return- event.preventDefault()- applyZoom(action)- }-- function handleMessage(event: MessageEvent<unknown>) {- if (event.source !== iframeRef.current?.contentWindow)- return- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin || event.origin !== iframeOrigin)- return- const action = zoomActionFromBridgeMessage(event.data)- if (action)- applyZoom(action)- }-- window.addEventListener('keydown', handleKeyDown, { capture: true })- window.addEventListener('message', handleMessage)- return () => {- window.removeEventListener('keydown', handleKeyDown, { capture: true })- window.removeEventListener('message', handleMessage)- }- }, [iframeRef])-}diff --git a/src/hooks/use-dsh-cores.ts b/src/hooks/use-dsh-cores.tsdeleted file mode 100644index 55d7fb1f..00000000--- a/src/hooks/use-dsh-cores.ts+++ /dev/null@@ -1,137 +0,0 @@-import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'-import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { useEffect } from 'react'--/** 核心来源:local = 用户 CLI 安装;app = 桌面端预打包 */-export type CoreSource = 'local' | 'app'--/** Rust 侧 service::core::HarnessCore 的序列化形态(camelCase) */-export interface HarnessCore {- /** `local` | `app`(无 tag 记录的旧激活行)| `app-<tag>` */- id: string- source: CoreSource- /** 版本号(不含 v 前缀;缺失为空串) */- version: string- /** 完整 release tag(如 `dsh-0.1.0-rc.8-32331963388`;local 行为空串) */- tag: string- /** 核心入口(cli path):本地核心为 bin.js,预打包为安装目录 */- path: string- /** 「打开目录」入口:本地核心为包目录,预打包为安装/槽位目录;未下载为空 */- dir: string- /** 本地是否可用(文件在盘/可解析) */- present: boolean- /** 当前是否使用中 */- active: boolean- /** 是否预览版(GitHub Pre-release label 或 tag 命名判定):预览版不参与更新提示,仅列表展示 */- preview: boolean- /** 是否高于 resources/version-recommend.json 中的推荐版本 */- aboveRecommended: boolean- /** 本地存在但 pkg 仓库已不再提供的历史槽位 */- orphaned: boolean- recommendedVersion: string | null- error?: string | null-}--export interface UseDshCoresResult {- cores: HarnessCore[]- loading: boolean- error: string- /** 切换活动核心(id: local | app | app-<tag>;持久化;服务重启由调用方触发) */- setActiveCore: (id: string) => Promise<HarnessCore>- /** 下载指定 tag 的预打包核心到历史槽位(不激活) */- downloadCore: (tag: string) => Promise<HarnessCore>- /** 卸载已下载的历史版本(激活中的版本不可卸载) */- removeCore: (id: string) => Promise<void>- /** 通过用户包管理器 CLI 更新本地核心,返回更新后的版本号 */- updateLocalCore: () => Promise<string>- /** 手动刷新核心列表 */- refreshCores: () => Promise<void>- /** 操作进行中标记 */- busy: boolean-}--/**- * 核心列表与操作(react-query)。- *- * 查询键 `['cores']`:`set_active_core` / `download_core` / `remove_core` 写- * 桌面端 store(触发 `setting_updated` 事件),监听该事件一并失效重拉;本地- * 核心被外部更新后重新打开面板即最新。- */-export function useDshCores(): UseDshCoresResult {- const queryClient = useQueryClient()-- const { data, isLoading, error, refetch } = useQuery({- queryKey: ['cores'],- queryFn: () => invoke<HarnessCore[]>('get_cores'),- })-- useEffect(() => {- let disposed = false- let unlisten: (() => void) | undefined- listen('setting_updated', () => {- void queryClient.invalidateQueries({ queryKey: ['cores'] })- })- .then((fn) => {- // 竞态防护:若组件已卸载而 listen 才 resolve,立即注销防泄漏- if (disposed)- fn()- else unlisten = fn- })- .catch(() => {})- return () => {- disposed = true- unlisten?.()- }- }, [queryClient])-- const invalidate = () => {- void queryClient.invalidateQueries({ queryKey: ['cores'] })- }-- const activate = useMutation({- mutationFn: (id: string) => invoke<HarnessCore>('set_active_core', { id }),- onSuccess: invalidate,- })- const download = useMutation({- mutationFn: (tag: string) => invoke<HarnessCore>('download_core', { tag }),- onSuccess: invalidate,- })- const remove = useMutation({- mutationFn: (id: string) => invoke<void>('remove_core', { id }),- onSuccess: invalidate,- })- const update = useMutation({- mutationFn: () => invoke<string>('update_local_core'),- onSuccess: invalidate,- })-- return {- cores: data ?? [],- loading: isLoading,- error: error ? String(error) : '',- setActiveCore: async (id) => {- // 激活后由 restart 完成时统一失效核心查询;这里不等待联网列表重拉,- // 避免 setting 已切换但旧服务仍运行期间人为扩大竞态窗口。- return activate.mutateAsync(id)- },- downloadCore: async (tag) => {- const core = await download.mutateAsync(tag)- await refetch()- return core- },- removeCore: async (id) => {- await remove.mutateAsync(id)- await refetch()- },- updateLocalCore: async () => {- const version = await update.mutateAsync()- await refetch()- return version- },- refreshCores: async () => {- await refetch()- },- busy: activate.isPending || download.isPending || remove.isPending || update.isPending,- }-}diff --git a/src/hooks/use-dsh-plugins.ts b/src/hooks/use-dsh-plugins.tsdeleted file mode 100644index ecc21374..00000000--- a/src/hooks/use-dsh-plugins.ts+++ /dev/null@@ -1,143 +0,0 @@-/* eslint-disable react/exhaustive-deps */-import type { UnlistenFn } from '@tauri-apps/api/event'-import { useQuery, useQueryClient } from '@tanstack/react-query'-import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { useEffect } from 'react'--/** Rust 侧 service::plugin::watch::DshPlugin 的序列化形态(camelCase) */-export interface PluginErrorInfo {- /** 错误消息(pnpm/运行日志片段) */- message: string- /** 记录动作:install / update / remove / runtime */- action: string- /** 记录时间(unix 秒级时间戳字符串) */- at: string-}--/** Rust 侧 service::plugin::watch::DshPlugin 的序列化形态(camelCase) */-export interface DshPlugin {- /** 依赖键(npm 包名),列表主键 */- id: string- /** 展示名:插件自身 package.json 的 name,缺失时回落预设清单 */- name: string- /** 已安装版本(解析失败时为空字符串) */- version: string- description: string- /** 仓库地址(repository.url / homepage) */- repo_url: string- /** 是否在 dsh.profile.bundles 中(启动时自动加载) */- bundled: boolean- /** 是否在禁用清单(disabled-plugins.json)中,独立于 bundled */- disabled: boolean- /** 是否在 cordis.patch.yml 中被配置覆盖禁用(disabled: true),优先级高于禁用清单 */- patchDisabled: boolean- /** 预设清单中的「推荐」标记 */- recommended: boolean- /** 预设清单中的「修复」标记 */- fix: boolean- /** 预设清单中的「内置」标记(随包分发/本地热更新):隐藏卸载入口并标注 [内置] */- internal: boolean- /** 是否有可用更新(由 `service::plugin::updates` 探测;未判定时为 false) */- updateAvailable: boolean- /** 判定得到的「最新版本」(registry latest / git HEAD SHA);未判定时缺省 */- latestVersion?: string- /** 是否有单插件快照($DSH_HOME/.plugin-backups/<id>.tgz),决定还原/删除快照入口 */- hasSnapshot: boolean- /** 异常信息(安装/升级/卸载失败或页面运行期上报);undefined = 正常 */- error?: PluginErrorInfo | null-}--export interface UseDshPluginsResult {- plugins: DshPlugin[]- loading: boolean- error: string- /** 手动重新拉取(Rust 侧也会在插件文件变化时实时推送) */- refresh: () => Promise<void>- /** 禁用指定插件(从 dsh.profile.bundles 移除,保留包体) */- disablePlugin: (id: string) => Promise<void>- /** 启用指定插件(加回 dsh.profile.bundles);clearConfigOverride 为 true 时同时移除 cordis.patch.yml 中的禁用覆盖 */- enablePlugin: (id: string, clearConfigOverride?: boolean) => Promise<void>-}--/**- * 已安装 dsh 插件列表(react-query 实时同步)。- *- * 后端(`service/plugin/watch`)秒级监控 profile 插件文件(package.json +- * node_modules 下各直接依赖清单),解析出插件元信息;首次加载走- * `get_dsh_plugins` 查询,之后插件安装/卸载/升级/错误记录时通过- * `dsh-plugins-updated` 事件推送完整列表,直接写入查询缓存(无需重新拉取)。- *- * 查询键 `['plugins']`:插件操作(升级/卸载)成功后会失效重拉,确保与后端- * 错误注册表等非文件态数据保持一致。- */-export function useDshPlugins(): UseDshPluginsResult {- const queryClient = useQueryClient()-- const { data, isLoading, error, refetch } = useQuery({- queryKey: ['plugins'],- queryFn: () => invoke<DshPlugin[]>('get_dsh_plugins'),- })-- // 重新探测更新可用性并写回缓存(Rust 侧 30min 缓存;失败静默按「无更新」处理,- // 插件管理器仍可用)。返回的列表会经 `dsh-plugins-updated` 事件写入同一缓存,- // 前端据此在仅有更新(或异常修复)时才显示升级按钮,而不是常驻。- function refreshUpdates() {- void invoke<DshPlugin[]>('refresh_plugin_updates')- .then(list => queryClient.setQueryData(['plugins'], list))- .catch(err => console.error('[useDshPlugins] refresh_plugin_updates failed:', err))- }-- // 首次加载后补齐更新可用性- useEffect(() => {- refreshUpdates()- }, [queryClient])-- // 订阅后端实时推送:事件载荷即完整列表,直接写入缓存避免多余的往返拉取- useEffect(() => {- let unlisten: UnlistenFn | null = null- let disposed = false-- listen<DshPlugin[]>('dsh-plugins-updated', (event) => {- if (disposed)- return- queryClient.setQueryData(['plugins'], event.payload)- // 文件变化(安装/升级/卸载)会改写版本与 spec → 缓存键变化,需重新探测更新- refreshUpdates()- })- .then((fn) => {- if (disposed)- fn()- else- unlisten = fn- })- .catch((err) => {- console.error('[useDshPlugins] failed to listen dsh-plugins-updated:', err)- })-- return () => {- disposed = true- unlisten?.()- }- }, [queryClient])-- function disablePlugin(id: string) {- return invoke<void>('disable_dsh_plugin', { id })- }- function enablePlugin(id: string, clearConfigOverride = false) {- return invoke<void>('enable_dsh_plugin', { id, clearConfigOverride })- }-- async function refresh() {- await refetch()- }-- return {- plugins: data ?? [],- loading: isLoading,- error: error ? String(error) : '',- refresh,- disablePlugin,- enablePlugin,- }-}diff --git a/src/hooks/use-dsh-profiles.ts b/src/hooks/use-dsh-profiles.tsdeleted file mode 100644index 7aa35df4..00000000--- a/src/hooks/use-dsh-profiles.ts+++ /dev/null@@ -1,114 +0,0 @@-import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'-import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { useEffect } from 'react'--/** Rust 侧 service::profile::Profile 的序列化形态(camelCase) */-export interface Profile {- /** 档案 id($DSH_HOME/profiles/<id> 目录名) */- id: string- /** 展示名(manifest name 去 dsh-profile- 前缀,首字母大写) */- name: string- /** 是否桌面端内置默认档案(web) */- default: boolean- /** 是否当前使用中的档案 */- active: boolean-}--export interface UseDshProfilesResult {- profiles: Profile[]- loading: boolean- error: string- /** 新建档案(返回新档案;不自动激活) */- createProfile: (name: string) => Promise<Profile>- /** 切换当前使用中的档案(持久化;重启服务后生效) */- activateProfile: (id: string) => Promise<Profile>- /** 删除档案(默认/使用中的档案会被后端拒绝) */- removeProfile: (id: string) => Promise<void>- /** 克隆档案(全量复制源档案,自动递增或指定名称) */- cloneProfile: (sourceId: string, name: string) => Promise<Profile>- /** 操作进行中标记(新建/切换/删除/克隆任一) */- busy: boolean-}--/**- * 档案列表与操作(react-query)。- *- * 查询键 `['profiles']`:`set_active_profile` 会写桌面端 store(触发- * `setting_updated` 事件),这里监听该事件一并失效重拉,保证与后端设置一致。- */-export function useDshProfiles(): UseDshProfilesResult {- const queryClient = useQueryClient()-- const { data, isLoading, error, refetch } = useQuery({- queryKey: ['profiles'],- queryFn: () => invoke<Profile[]>('get_profiles'),- })-- // 后端设置变更(切换档案等)后刷新档案列表- useEffect(() => {- let disposed = false- let unlisten: (() => void) | undefined- listen('setting_updated', () => {- void queryClient.invalidateQueries({ queryKey: ['profiles'] })- })- .then((fn) => {- // 竞态防护:若组件已卸载而 listen 才 resolve,立即注销防泄漏- if (disposed)- fn()- else unlisten = fn- })- .catch(() => {})- return () => {- disposed = true- unlisten?.()- }- }, [queryClient])-- const invalidate = () => {- void queryClient.invalidateQueries({ queryKey: ['profiles'] })- }-- const create = useMutation({- mutationFn: (name: string) => invoke<Profile>('create_profile', { name }),- onSuccess: invalidate,- })- const activate = useMutation({- mutationFn: (id: string) => invoke<Profile>('set_active_profile', { id }),- onSuccess: invalidate,- })- const remove = useMutation({- mutationFn: (id: string) => invoke<void>('remove_profile', { id }),- onSuccess: invalidate,- })- const clone = useMutation({- mutationFn: (params: { sourceId: string, name: string }) => invoke<Profile>('clone_profile', params),- onSuccess: invalidate,- })-- return {- profiles: data ?? [],- loading: isLoading,- error: error ? String(error) : '',- createProfile: async (name) => {- const created = await create.mutateAsync(name)- await refetch()- return created- },- activateProfile: async (id) => {- const activated = await activate.mutateAsync(id)- await refetch()- return activated- },- removeProfile: async (id) => {- await remove.mutateAsync(id)- await refetch()- },- cloneProfile: async (sourceId, name) => {- const created = await clone.mutateAsync({ sourceId, name })- await refetch()- return created- },- busy: create.isPending || activate.isPending || remove.isPending || clone.isPending,- }-}diff --git a/src/hooks/use-dsh-theme.ts b/src/hooks/use-dsh-theme.tsdeleted file mode 100644index 15d90054..00000000--- a/src/hooks/use-dsh-theme.ts+++ /dev/null@@ -1,75 +0,0 @@-import type { UnlistenFn } from '@tauri-apps/api/event'-import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { useEffect, useRef, useState } from 'react'--export type DshThemePreference = 'dark' | 'light' | 'system'-export type ResolvedTheme = 'dark' | 'light'--const DARK_QUERY = '(prefers-color-scheme: dark)'--function resolveTheme(preference: DshThemePreference): ResolvedTheme {- if (preference === 'system') {- return window.matchMedia(DARK_QUERY).matches ? 'dark' : 'light'- }- return preference-}--/**- * 让桌面外壳(侧边栏、设置页等)跟随内嵌 dsh 页面的主题。- *- * dsh 把主题偏好持久化在 `$DSH_HOME/settings.yaml` 的 `ui-theme.preference`- * (light/dark/system),后端轮询到变化后通过 `dsh-theme-updated` 事件推送,- * 这里解析为最终主题并写到 `<html data-theme="...">`,由 CSS 变量切换配色。- */-export function useDshTheme(): ResolvedTheme {- const [theme, setTheme] = useState<ResolvedTheme>('dark')- const preferenceRef = useRef<DshThemePreference>('dark')-- useEffect(() => {- let unlisten: UnlistenFn | null = null- let disposed = false-- function apply(preference: DshThemePreference) {- preferenceRef.current = preference- if (!disposed) {- setTheme(resolveTheme(preference))- }- }-- invoke<DshThemePreference>('get_dsh_theme')- .then(preference => apply(preference))- .catch(err => console.error('[useDshTheme] failed to load theme:', err))-- listen<DshThemePreference>('dsh-theme-updated', (event) => {- apply(event.payload)- }).then((fn) => {- if (disposed) {- fn()- }- else {- unlisten = fn- }- })-- const mediaQuery = window.matchMedia(DARK_QUERY)- function onSystemThemeChange() {- if (preferenceRef.current === 'system') {- setTheme(resolveTheme('system'))- }- }- mediaQuery.addEventListener('change', onSystemThemeChange)-- return () => {- disposed = true- mediaQuery.removeEventListener('change', onSystemThemeChange)- unlisten?.()- }- }, [])-- useEffect(() => {- document.documentElement.dataset.theme = theme- }, [theme])-- return theme-}diff --git a/src/hooks/use-iframe-message.ts b/src/hooks/use-iframe-message.tsnew file mode 100644index 00000000..ad91ad6b--- /dev/null+++ b/src/hooks/use-iframe-message.ts@@ -0,0 +1,42 @@+import type { RefObject } from 'react'+import { useEventListener } from '@reause/core'+import { getIframeOrigin } from '@/utils/iframe'++/** 已通过校验的消息上下文。 */+export interface IframeMessageContext {+ /** 已校验的 iframe origin,可直接用于 `postMessage` 回发 */+ origin: string+ /** 原始 message 事件 */+ event: MessageEvent+}++/**+ * 订阅 iframe → 宿主 的 `postMessage`(入站方向的唯一入口)。+ *+ * 只做两道与安全有关的校验:+ * 1. `event.source` 必须是**直接** iframe 的 `contentWindow`(不支持多层嵌套);+ * 2. `event.origin` 与 iframe 的 http(s) origin 完全一致。+ *+ * 协议分发交给调用方按 `data.type` 处理——壳层所有入站桥共用同一个监听器与+ * 同一个 `switch (type)`,不再逐个桥比对 `data.source`。+ *+ * 回调经 reause `useEventListener` 的 ref 转发,写内联函数不会反复重订阅。+ */+export function useIframeMessage<T>(+ iframeRef: RefObject<HTMLIFrameElement | null>,+ handler: (message: T, context: IframeMessageContext) => any,+): void {+ useEventListener('message', (event: MessageEvent<unknown>) => {+ const data = event.data+ if (!data || typeof data !== 'object')+ return+ if (event.source !== iframeRef.current?.contentWindow)+ return++ const origin = getIframeOrigin(iframeRef)+ if (!origin || event.origin !== origin)+ return++ handler(data as T, { origin, event })+ })+}diff --git a/src/hooks/use-iframe-post.ts b/src/hooks/use-iframe-post.tsnew file mode 100644index 00000000..8a96282a--- /dev/null+++ b/src/hooks/use-iframe-post.ts@@ -0,0 +1,34 @@+import type { RefObject } from 'react'+import { getIframeOrigin } from '@/utils/iframe'++/** 宿主 → iframe 消息的协议标识(与 `src-tauri/src/desktop/nav.rs` 的 `data.source !== 'dsh-desktop'` 校验一致)。 */+export const IFRAME_HOST_SOURCE = 'dsh-desktop'++/** 宿主 → iframe 的消息体:`type` 必填(如 `dsh://sidebar:toggle`),其余字段按具体协议附带。 */+export interface IframeOutboundMessage {+ type: string+ [key: string]: unknown+}++/**+ * 向 iframe 发消息(宿主 → iframe 方向的唯一出口)。+ *+ * - 每次发送都按 iframe 当前的 http(s) origin 定向投递;iframe 未挂载 / 来源非法+ * (`about:blank`、`file:` 等)时丢弃本次发送,不排队;+ * - 自动补协议标识 `source: 'dsh-desktop'`(`desktop/nav.rs` 按它识别宿主;通知类+ * 注入脚本只看 `type`,多一个字段无副作用);调用方自带 `source` 时以它为准。+ *+ * @example+ * const post = useIframePost(iframeRef)+ * post({ type: 'dsh://sidebar:toggle' })+ */+export function useIframePost(+ iframeRef: RefObject<HTMLIFrameElement | null>,+): (message: IframeOutboundMessage) => void {+ return function post(message: IframeOutboundMessage) {+ const origin = getIframeOrigin(iframeRef)+ if (!origin)+ return+ iframeRef.current?.contentWindow?.postMessage({ source: IFRAME_HOST_SOURCE, ...message }, origin)+ }+}diff --git a/src/hooks/use-iframe-shim.ts b/src/hooks/use-iframe-shim.tsdeleted file mode 100644index 5baee456..00000000--- a/src/hooks/use-iframe-shim.ts+++ /dev/null@@ -1,270 +0,0 @@-import type { RefObject } from 'react'-import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { getCurrentWindow } from '@tauri-apps/api/window'-import { useEffect } from 'react'-import { useEvent, useInterval, useMountedState } from 'react-use'-import { queryClient } from '@/config/client'-import { store } from '@/store'-import { getIframeOrigin } from '@/utils/iframe'--interface NativeNotificationMessage {- source?: 'dsh-notification-bridge'- type?: string- title?: string- body?: string- tag?: string- sessionId?: string- requireInteraction?: boolean-}--/** iframe 插件异常上报消息(dsh-tauri 桥 / 页面脚本 postMessage 通道) */-interface PluginErrorMessage {- source?: 'dsh-plugin-error-bridge'- type?: string- /** 插件 id(npm 包名) */- id?: string- /** 异常消息 */- error?: string- /** 记录动作:runtime / install / update(默认 runtime) */- action?: string-}--/**- * iframe 剪贴板图片回退请求(desktop/paste::PASTE_SHIM_JS 发来)。- * Linux/WebKitGTK 下 dsh iframe 的 paste 事件拿不到图片,宿主侧据此调用- * `read_clipboard_image` 读系统剪贴板,再把 PNG data URL 回传给 iframe 重新贴图。- */-interface ClipboardImageRequest {- source?: 'dsh-clipboard-image-bridge'- type?: 'dsh://clipboard-image:read'- id?: string-}--interface PluginBootMessage {- source?: 'dsh-plugin-boot-bridge'- type?: 'dsh://plugin-boot:stalled' | 'dsh://plugin-boot:ready' | 'dsh://plugin-boot:failed'- /** failed 消息携带官方失败页文本(如 web boot: 1 entry did not activate) */- detail?: string-}--export function useIframeShim(iframeRef: RefObject<HTMLIFrameElement | null>) {- const isMounted = useMountedState()-- // 接收 iframe 的「原生通知」请求,转发给 Tauri 命令弹出系统通知- function handleMessage(event: MessageEvent<NativeNotificationMessage>) {- const data = event.data- if (!data || typeof data !== 'object' || data.source !== 'dsh-notification-bridge') {- return- }- // 只接受 DSH 直接 iframe 发来的消息;不兼容多层嵌套 iframe。- if (event.source !== iframeRef.current?.contentWindow) {- return- }- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin || event.origin !== iframeOrigin) {- return- }- if (data.type !== 'dsh://native-notification') {- return- }- void invoke('show_native_notification', {- payload: {- title: data.title ?? '',- body: data.body ?? '',- tag: data.tag ?? null,- sessionId: data.sessionId ?? null,- requireInteraction: Boolean(data.requireInteraction),- },- }).catch(error => console.error('[notification] show_native_notification failed:', error))- }-- // 接收 iframe 的「插件异常上报」:记录到后端错误注册表并刷新插件列表。- // 内嵌页面(或 dsh-tauri 扩展)捕获插件运行期异常后,以- // `{ source: 'dsh-plugin-error-bridge', type: 'dsh://plugin-error', id, error }`- // postMessage 到宿主,宿主经 `report_plugin_error` 持久化并推送新列表,- // 「插件」面板据此展示 danger 图标与更新/卸载入口。- function handlePluginError(event: MessageEvent<PluginErrorMessage>) {- const data = event.data- if (!data || typeof data !== 'object' || data.source !== 'dsh-plugin-error-bridge') {- return- }- if (event.source !== iframeRef.current?.contentWindow) {- return- }- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin || event.origin !== iframeOrigin) {- return- }- if (data.type !== 'dsh://plugin-error' || !data.id || !data.error) {- return- }- void invoke('report_plugin_error', {- id: data.id,- error: data.error,- action: data.action ?? 'runtime',- })- .then(() => {- void queryClient.invalidateQueries({ queryKey: ['plugins'] })- })- .catch(error => console.error('[plugin-error] report_plugin_error failed:', error))- }-- // 接收 iframe 的「剪贴板图片回退」请求:读取系统剪贴板图片并把 PNG data URL 回传,- // 使 Linux/WebKitGTK 下 dsh iframe 的贴图(paste 事件拿不到图片)能走原生剪贴板通路。- function handleClipboardImage(event: MessageEvent<ClipboardImageRequest>) {- const data = event.data- if (!data || typeof data !== 'object' || data.source !== 'dsh-clipboard-image-bridge') {- return- }- // 只接受 DSH 直接 iframe 发来的消息;不兼容多层嵌套 iframe。- if (event.source !== iframeRef.current?.contentWindow) {- return- }- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin || event.origin !== iframeOrigin) {- return- }- if (data.type !== 'dsh://clipboard-image:read' || !data.id) {- return- }- // 在闭包外把收窄后的值固定到局部常量,避免 TS 在闭包内丢失控制流收窄- const reqId = data.id- const origin = iframeOrigin- function reply(dataUrl: string | null) {- iframeRef.current?.contentWindow?.postMessage(- { source: 'dsh-desktop-clipboard', id: reqId, data_url: dataUrl },- origin,- )- }- void invoke<{ data_url?: string } | null>('read_clipboard_image')- .then(result => reply(result?.data_url ?? null))- .catch((error) => {- console.error('[clipboard-image] read_clipboard_image failed:', error)- reply(null)- })- }-- function handlePluginBoot(event: MessageEvent<PluginBootMessage>) {- const data = event.data- if (!data || typeof data !== 'object' || data.source !== 'dsh-plugin-boot-bridge') {- return- }- if (event.source !== iframeRef.current?.contentWindow) {- return- }- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin || event.origin !== iframeOrigin) {- return- }- if (data.type === 'dsh://plugin-boot:ready') {- store.harness.markIframeBootReady()- return- }- if (data.type === 'dsh://plugin-boot:stalled') {- void store.harness.recoverIframeBoot()- return- }- if (data.type === 'dsh://plugin-boot:failed') {- void store.harness.handleIframeBootFailure(data.detail)- }- }-- useEvent('message', handleMessage)- useEvent('message', handlePluginError)- useEvent('message', handleClipboardImage)- useEvent('message', handlePluginBoot)-- // 系统通知点击 → 通知 iframe 聚焦对应会话- useEffect(() => {- let unlisten: (() => void) | undefined- void listen<{ sessionId?: string | null, title?: string, tag?: string }>(- 'dsh-notification-clicked',- (event) => {- const payload = event.payload- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin)- return- iframeRef.current?.contentWindow?.postMessage(- {- type: 'dsh://focus-session',- sessionId: payload.sessionId || undefined,- title: payload.title || undefined,- tag: payload.tag || undefined,- },- iframeOrigin,- )- },- ).then((unlistener) => {- // 订阅完成前若已卸载则立即释放,避免回调泄漏- if (isMounted()) {- unlisten = unlistener- }- else {- unlistener()- }- })- return () => {- unlisten?.()- }- // eslint-disable-next-line react/exhaustive-deps- }, [])-- // 将窗口可见性(最小化/隐藏/失焦)同步给 iframe,便于其暂停渲染- function syncVisibility() {- void (async () => {- try {- const appWindow = getCurrentWindow()- const [minimized, visible] = await Promise.all([- appWindow.isMinimized(),- appWindow.isVisible(),- ])- const hidden = minimized || !visible- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin)- return- iframeRef.current?.contentWindow?.postMessage(- { type: 'dsh://visibility-state', hidden },- iframeOrigin,- )- }- catch (error) {- console.error('[notification] sync visibility failed:', error)- }- })()- }-- // 窗口焦点/尺寸变化时即时同步可见性- useEffect(() => {- let unlisteners: Array<() => void> = []- void (async () => {- try {- const appWindow = getCurrentWindow()- syncVisibility()- const unFocus = await appWindow.onFocusChanged(() => {- void syncVisibility()- })- const unResized = await appWindow.onResized(() => {- void syncVisibility()- })- if (isMounted()) {- unlisteners = [unFocus, unResized]- }- else {- unFocus()- unResized()- }- }- catch (error) {- console.error('[notification] visibility listeners failed:', error)- }- })()- return () => {- unlisteners.forEach(fn => fn())- }- // eslint-disable-next-line react/exhaustive-deps- }, [])-- // 兜底轮询:覆盖监听不到的状态变化(如任务栏切换);主路径是文档可见性事件,5s 足够- useInterval(syncVisibility, 5000)-}diff --git a/src/hooks/use-iframe-tauri.ts b/src/hooks/use-iframe-tauri.tsdeleted file mode 100644index 2b0469a8..00000000--- a/src/hooks/use-iframe-tauri.ts+++ /dev/null@@ -1,101 +0,0 @@-import type { RefObject } from 'react'-import { useState } from 'react'-import { useEvent } from 'react-use'-import { getIframeOrigin } from '@/utils/iframe'--/**- * 壳层导航桥(宿主侧):ShellNavBar 左侧三个控件的消息通道。- *- * 协议(与 dsh-tauri 插件 / 桌面端 NAV_SHIM_JS 一致):- * - 发送(宿主 → iframe):`{ source: 'dsh-desktop', type }`- * - `dsh://sidebar:toggle` 切换侧边栏- * - `dsh://page:prev` / `dsh://page:next` 后退 / 前进- * - 接收(iframe → 宿主):`{ source: 'dsh-nav-bridge', type, ... }`- * - `dsh://sidebar:collapsed` `{ collapsed }` 侧边栏折叠状态- * - `dsh://page:firsted` / `dsh://page:lasted` `{ firsted/lasted }`- * 历史边界(宿主据此禁用后退/前进按钮)- *- * 只在 iframe 直接发来的消息上生效(event.source 校验),与通知桥一致。- * iframeRef 为空(安装/错误/预装引导页)时只返回默认状态,不发送任何消息。- */--/** 左侧导航控制动作(宿主 → iframe 命令)。 */-export type ShellNavAction = 'sidebar:toggle' | 'page:prev' | 'page:next'--/** 命令类型映射(消息 type 与 action 一一对应)。 */-const COMMAND_TYPES: Record<ShellNavAction, string> = {- 'sidebar:toggle': 'dsh://sidebar:toggle',- 'page:prev': 'dsh://page:prev',- 'page:next': 'dsh://page:next',-}--/** iframe 导航桥回报协议。 */-interface NavBridgeMessage {- source?: 'dsh-nav-bridge'- type?: 'dsh://sidebar:collapsed' | 'dsh://page:firsted' | 'dsh://page:lasted'- collapsed?: boolean- firsted?: boolean- lasted?: boolean-}--export function useIframeTauri(- iframeRef: RefObject<HTMLIFrameElement | null> | undefined,-): {- sidebarCollapsed: boolean- /** 可否后退(!firsted);默认不可,收到桥回报后更新 */- canGoBack: boolean- /** 可否前进(!lasted);默认不可,收到桥回报后更新 */- canGoForward: boolean- sendNav: (action: ShellNavAction) => void-} {- const [sidebarCollapsed, setSidebarCollapsed] = useState(false)- // 历史边界默认置位(按钮禁用),等待 iframe 内导航桥回报后更新- const [pageEdge, setPageEdge] = useState({ firsted: true, lasted: true })-- function handleMessage(event: MessageEvent<NavBridgeMessage>) {- const data = event.data- if (!data || typeof data !== 'object' || data.source !== 'dsh-nav-bridge') {- return- }- // 只接受 DSH 直接 iframe 发来的消息;不兼容多层嵌套 iframe。- if (event.source !== iframeRef?.current?.contentWindow) {- return- }- const iframeOrigin = iframeRef ? getIframeOrigin(iframeRef) : null- if (!iframeOrigin || event.origin !== iframeOrigin) {- return- }- switch (data.type) {- case 'dsh://sidebar:collapsed':- setSidebarCollapsed(Boolean(data.collapsed))- break- case 'dsh://page:firsted':- setPageEdge(prev => ({ ...prev, firsted: Boolean(data.firsted) }))- break- case 'dsh://page:lasted':- setPageEdge(prev => ({ ...prev, lasted: Boolean(data.lasted) }))- break- }- }-- useEvent('message', handleMessage)-- function sendNav(action: ShellNavAction) {- if (!iframeRef)- return- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin)- return- iframeRef?.current?.contentWindow?.postMessage(- { source: 'dsh-desktop', type: COMMAND_TYPES[action] },- iframeOrigin,- )- }-- return {- sidebarCollapsed,- canGoBack: !pageEdge.firsted,- canGoForward: !pageEdge.lasted,- sendNav,- }-}diff --git a/src/hooks/use-invalidate-on-setting-updated.ts b/src/hooks/use-invalidate-on-setting-updated.tsnew file mode 100644index 00000000..7f945d14--- /dev/null+++ b/src/hooks/use-invalidate-on-setting-updated.ts@@ -0,0 +1,20 @@+import type { QueryKey } from '@tanstack/react-query'+import { useQueryClient } from '@tanstack/react-query'+import { useListen } from '@/hooks/use-listen'++/**+ * 订阅后端 `setting_updated` 事件并失效指定查询。+ *+ * cores / profiles / plugins / backups 四个查询都要「后端设置一变就重拉」,+ * 此前各自写一份 `useListen('setting_updated', () => invalidateQueries(...))`;+ * 收敛到这里,事件名与失效语义只有一个出处。+ *+ * `queryKey` 每次渲染传新数组即可(`useListen` 只在事件名变化时重订阅)。+ */+export function useInvalidateOnSettingUpdated(queryKey: QueryKey): void {+ const queryClient = useQueryClient()++ useListen('setting_updated', () => {+ void queryClient.invalidateQueries({ queryKey })+ })+}diff --git a/src/hooks/use-iframe-invoke.ts b/src/hooks/use-invoke-iframe.tssimilarity index 67%rename from src/hooks/use-iframe-invoke.tsrename to src/hooks/use-invoke-iframe.tsindex 9b2d2e2e..042ba842 100644--- a/src/hooks/use-iframe-invoke.ts+++ b/src/hooks/use-invoke-iframe.ts@@ -1,10 +1,9 @@import type { RefObject } from 'react'import { invoke } from '@tauri-apps/api/core'-import { useEvent } from 'react-use'-import { getIframeOrigin } from '@/utils/iframe'+import { useIframeMessage } from '@/hooks/use-iframe-message'/**- * 壳层 invoke 桥监听器(宿主侧):把 iframe 内 dsh 界面/插件的 Tauri 调用+ * 壳层 invoke 桥(宿主侧):把 iframe 内 dsh 界面/插件的 Tauri 调用* 转发到 `@tauri-apps/api/core` 的 `invoke`,再把结果回传给 iframe。** 背景:dsh GUI 运行在 iframe 内,其触发的 Tauri command(如桌宠插件的@@ -18,12 +17,11 @@ import { getIframeOrigin } from '@/utils/iframe'* 宿主 → iframe:{ source: 'dsh-desktop-invoke', type: 'dsh://tauri:reply',* nonce, ok, value | error }*- * 安全:与通知/剪贴板桥一致,只接受 DSH 直接 iframe 发来的消息(event.source- * 与 origin 双重校验),不兼容多层嵌套 iframe。+ * 来源与 origin 校验由 `useIframeMessage` 统一完成(直接 iframe + origin;+ * 宿主侧不比对 `data.source`,按 `type` 分发);这里只负责白名单与转发。*/interface InvokeBridgeRequest {- source?: 'dsh-tauri-invoke'- type?: 'dsh://tauri:invoke'+ type?: stringcmd?: stringargs?: Record<string, unknown>nonce?: string@@ -46,23 +44,10 @@ const ALLOWED_INVOKE_CMDS = new Set(['list_preset_pets',])-export function useIframeInvoke(iframeRef: RefObject<HTMLIFrameElement | null>): void {- function handleMessage(event: MessageEvent<InvokeBridgeRequest>) {- const data = event.data- if (!data || typeof data !== 'object' || data.source !== 'dsh-tauri-invoke') {+export function useInvokeIframe(iframeRef: RefObject<HTMLIFrameElement | null>): void {+ useIframeMessage<InvokeBridgeRequest>(iframeRef, (data, { origin }) => {+ if (data.type !== 'dsh://tauri:invoke' || !data.cmd)return- }- // 只接受 DSH 直接 iframe 发来的消息;不兼容多层嵌套 iframe。- if (event.source !== iframeRef.current?.contentWindow) {- return- }- const iframeOrigin = getIframeOrigin(iframeRef)- if (!iframeOrigin || event.origin !== iframeOrigin) {- return- }- if (data.type !== 'dsh://tauri:invoke' || !data.cmd) {- return- }// 仅在白名单内的 command 允许调用,其余静默忽略(防越权)。if (!ALLOWED_INVOKE_CMDS.has(data.cmd)) {console.warn(`[iframe-invoke] ignored non-allowlisted cmd: ${data.cmd}`)@@ -71,8 +56,6 @@ export function useIframeInvoke(iframeRef: RefObject<HTMLIFrameElement | null>):const cmd = data.cmdconst args = data.argsconst nonce = data.nonce ?? ''- // 闭包外固定收窄后的 origin(TS 在闭包内丢失控制流收窄)。- const origin = iframeOriginfunction reply(payload: { ok: boolean, value?: unknown, error?: string }) {iframeRef.current?.contentWindow?.postMessage(@@ -90,7 +73,5 @@ export function useIframeInvoke(iframeRef: RefObject<HTMLIFrameElement | null>):error: (error instanceof Error ? error.message : String(error)).slice(0, 2000),})})- }-- useEvent('message', handleMessage)+ })}diff --git a/src/hooks/use-invoke.ts b/src/hooks/use-invoke.tsnew file mode 100644index 00000000..55d9b577--- /dev/null+++ b/src/hooks/use-invoke.ts@@ -0,0 +1,22 @@+import type { InvokeArgs, InvokeOptions } from '@tauri-apps/api/core'+import { invoke } from '@tauri-apps/api/core'+import { useEffect, useState } from 'react'++export function useInvoke<T>(channel: string, args?: InvokeArgs | undefined, options?: InvokeOptions): T | null {+ const [result, setResult] = useState<T | null>(null)++ useEffect(() => {+ let cancelled = false++ invoke(channel, args, options).then((response) => {+ if (!cancelled)+ setResult(response as T)+ })++ return () => {+ cancelled = true+ }+ }, [channel, args, options])++ return result+}diff --git a/src/hooks/use-listen-iframe.ts b/src/hooks/use-listen-iframe.tsnew file mode 100644index 00000000..282e4da9--- /dev/null+++ b/src/hooks/use-listen-iframe.ts@@ -0,0 +1,51 @@+import type { Event as TauriEvent } from '@tauri-apps/api/event'+import type { RefObject } from 'react'+import { useIframePost } from '@/hooks/use-iframe-post'+import { useListen } from '@/hooks/use-listen'++/** 转发进 iframe 的消息体:`type` 必填,其余字段按具体协议附带。 */+export interface IframeForwardMessage {+ type: string+ [key: string]: unknown+}++/**+ * 监听一个 Tauri 事件,并把载荷按「宿主 → iframe」协议转发进 iframe。+ *+ * 与 `useInvokeIframe` 是**相反方向**的一对:+ * - `useInvokeIframe`:iframe → 宿主(postMessage 请求 → 执行 Tauri `invoke` → 回传结果);+ * - `useListenIframe`:宿主 → iframe(本 hook,Tauri 事件 → postMessage 推送)。+ *+ * 行为约定:+ * - `useListen` 负责订阅与卸载注销(回调经 ref 转发,写内联函数不会反复重订阅);+ * - 发送经 `useIframePost`(origin 定向 + `source: 'dsh-desktop'` 协议标识);+ * iframe 未挂载 / 来源非法时丢弃本次转发(事件是瞬时通知,过期即无意义);+ * - `forward` 返回 `type` 为空的消息则不发送。+ *+ * 目前尚无调用方(壳层现有的宿主 → iframe 推送仍写在 `layout/components/iframe.tsx`+ * 里),先按协议定义好,新增「Tauri 事件 → iframe」通道时直接复用。+ *+ * @example+ * ```tsx+ * // 系统通知被点击 → 让 iframe 聚焦对应会话+ * useListenIframe<{ sessionId?: string | null }>(+ * iframeRef,+ * 'dsh-notification-clicked',+ * payload => ({ type: 'dsh://focus-session', sessionId: payload.sessionId ?? undefined }),+ * )+ * ```+ */+export function useListenIframe<T>(+ iframeRef: RefObject<HTMLIFrameElement | null>,+ event: string,+ forward: (payload: T, event: TauriEvent<T>) => IframeForwardMessage,+): void {+ const post = useIframePost(iframeRef)++ useListen<T>(event, (tauriEvent) => {+ const message = forward(tauriEvent.payload, tauriEvent)+ if (!message || typeof message.type !== 'string' || message.type === '')+ return+ post(message)+ })+}diff --git a/src/hooks/use-listen.ts b/src/hooks/use-listen.tsnew file mode 100644index 00000000..0e98e5cb--- /dev/null+++ b/src/hooks/use-listen.ts@@ -0,0 +1,40 @@+import type { EventCallback, Options, UnlistenFn } from '@tauri-apps/api/event'+import { listen } from '@tauri-apps/api/event'+import { useEffect, useRef } from 'react'++/**+ * 订阅 Tauri 事件并在卸载时自动注销(`listen` + 卸载清理的壳层统一入口)。+ *+ * 语义对齐 reause 的 `useEventListener`:+ * - 回调与 options 在渲染期写入 ref(与 reause 同款「latest ref」写法),+ * 调用方传内联函数不会反复重订阅,只在 `event` 变化时重新订阅;+ * - 竞态防护:`listen` 是异步的,若在 resolve 前组件已卸载则立即注销,避免监听泄漏。+ *+ * 唯一的 effect 只负责注册/注销监听(需要清理),无其它副作用。+ * `listen` 失败(如非 Tauri 环境)只记录日志,不打断调用方。+ */+export function useListen<T>(event: string, handler: EventCallback<T>, options?: Options): void {+ const handlerRef = useRef(handler)+ const optionsRef = useRef(options)+ handlerRef.current = handler+ optionsRef.current = options++ useEffect(() => {+ let unlisten: UnlistenFn | undefined+ let disposed = false++ void listen<T>(event, payload => handlerRef.current(payload), optionsRef.current)+ .then((fn) => {+ if (disposed)+ fn()+ else+ unlisten = fn+ })+ .catch(err => console.error(`[useListen] failed to listen ${event}:`, err))++ return () => {+ disposed = true+ unlisten?.()+ }+ }, [event])+}diff --git a/src/pet/hooks/use-omit-ignore-cursor-events.ts b/src/hooks/use-omit-ignore-cursor-events.tssimilarity index 100%rename from src/pet/hooks/use-omit-ignore-cursor-events.tsrename to src/hooks/use-omit-ignore-cursor-events.tsdiff --git a/src/pet/hooks/use-drag.ts b/src/hooks/use-window-draggable.tssimilarity index 95%rename from src/pet/hooks/use-drag.tsrename to src/hooks/use-window-draggable.tsindex 2de5d6fa..4e6970ca 100644--- a/src/pet/hooks/use-drag.ts+++ b/src/hooks/use-window-draggable.ts@@ -5,7 +5,7 @@ import { useEffect, useRef, useState } from 'react'/** 拖拽的水平方向。 */type DragDirection = 'left' | 'right'-export interface UseDragResult {+export interface UseWindowDraggableResult {/** 原生拖拽会话进行中(按下后位移超过阈值才算,结束/超时后为 false)。 */dragging: boolean/** 当前拖拽方向;未拖拽、位移不足或拖拽停顿时为 undefined。 */@@ -34,8 +34,8 @@ const DRAG_DIRECTION_IDLE_TIMEOUT = 350const DRAG_SESSION_TIMEOUT = 1500/**- * 桌宠窗口拖拽:用 Tauri 原生窗口拖动移动桌宠,并借用窗口 `Moved` 事件采样位移- * 方向(原生拖拽期间 webview 收不到 pointermove),供上层切换 moving-left/right。+ * Tauri 窗口拖拽(桌宠窗口在用):用原生窗口拖动移动窗口,并借用窗口 `Moved` 事件+ * 采样位移方向(原生拖拽期间 webview 收不到 pointermove),供上层切换 moving-left/right。** # 为什么监听 window 而不是命中箱*@@ -51,7 +51,7 @@ const DRAG_SESSION_TIMEOUT = 1500* 因此「拖拽进行中」= 按下后 Moved 事件持续到来,由两级停歇判断收尾(见上方两个* 超时常量),pointerup / pointercancel 仅作兜底。*/-export function useDrag(): UseDragResult {+export function useWindowDraggable(): UseWindowDraggableResult {const activeRef = useRef(false)const engagedRef = useRef(false)const originRef = useRef<{ x: number, y: number } | undefined>(undefined)diff --git a/src/hooks/use-zoom-factor.ts b/src/hooks/use-zoom-factor.tsnew file mode 100644index 00000000..40894f40--- /dev/null+++ b/src/hooks/use-zoom-factor.ts@@ -0,0 +1,165 @@+import type { Webview } from '@tauri-apps/api/webview'+import type { RefObject } from 'react'+import { useMount, useWatch } from '@reause/core'+import { getCurrentWebview } from '@tauri-apps/api/webview'+import { getCurrentWindow } from '@tauri-apps/api/window'+import { type, version } from '@tauri-apps/plugin-os'+import { useRef, useState } from 'react'++/**+ * Tauri 版 `useZoomFactor`:签名与 `@reause/electron` 的同名 hook 完全一致+ * (响应式 WebView 缩放比例),底层改用 Tauri 的 WebView / Window API。+ *+ * ```ts+ * const [factor, setFactor] = useZoomFactor() // 读当前比例+ * const [factor] = useZoomFactor(2) // 挂载时应用显式比例+ * const [factor] = useZoomFactor(webview, 2) // 指定 WebView 实例 + 显式比例+ * setFactor(2) // webview.setZoom(2)+ * ```+ *+ * 与 Electron 版的平台差异(Tauri 2 JS API 的现状,无法在 hook 内消除):+ * - **写**:只有 `Webview.setZoom(scaleFactor)`(形参在 Tauri 文档里就叫 `scaleFactor`);+ * 没有 `Window.setScaleFactor`——窗口缩放因子由系统决定,JS 无法设置。+ * - **读**:没有 `Webview.getZoom`(无比例回读接口),唯一可读的比例是+ * `Window.scaleFactor()`(显示器 DPI 缩放)。因此**初值**取 `Window.scaleFactor()`,+ * 之后返回值跟随 `setFactor` / 显式来源;外部改动(其它代码直接调 `setZoom`)+ * 无法反映到本 hook,这是平台缺口而非实现取舍。+ * - Electron 的 `setZoomFactor` 同步执行(同步抛错);Tauri 的 `setZoom` 返回 Promise,+ * 所以 setter 仍保持 `(value: number) => void`,失败只记录日志。+ * - Electron 版的 `watch(..., { immediate: true })` 在这里用 reause `useWatch` 表达,+ * 并用 ref 记住「最后一次写入的比例」,重复渲染不会重复写入同一个值。+ * - macOS 10.15 及更早没有 `WKWebView.pageZoom`(wry 直接调用该选择器、没有+ * `#available` 守卫),在旧系统上应用缩放会崩,因此这里用 `@tauri-apps/plugin-os`+ * 读取系统版本,只在 macOS 11+ 才真正调用 `setZoom`(其余平台一律应用)。+ */++/**+ * 与 reause `RefOrValue<T>` 对齐的本地别名(本仓库不直接依赖 `@reause/shared`)。+ */+export type RefOrValue<T> = T | RefObject<T>++/**+ * `useZoomFactor` 返回的 setter:校验比例、写入 `Webview.setZoom`、更新 hook 返回值。+ */+export type ZoomFactorSetter = (value: number) => void++/** 与 reause / VueUse 同款文案:比例为 0 时抛错(负数交由平台判定) */+const ZOOM_FACTOR_ERROR = 'the factor must be greater than 0.0.'++function assertZoomFactor(value: number): void {+ if (value === 0)+ throw new Error(ZOOM_FACTOR_ERROR)+}++/** ref 形态判定(对应 `@reause/shared` 的 `isRefLike`) */+export function isRefLike(value: unknown): value is RefObject<number> {+ return !!value && typeof value === 'object' && 'current' in value+}++/** 取值:ref 取 `current`,否则原样返回(对应 `@reause/shared` 的 `toValue`) */+export function toValue(value: RefOrValue<number>): number {+ return isRefLike(value) ? value.current : value+}++// 与 Electron 版同一套 overload 判别:首参是 number / ref 即「未显式传 WebView」+function isFactorArgument(value: Webview | RefOrValue<number> | undefined): value is RefOrValue<number> {+ return typeof value === 'number' || isRefLike(value)+}++/** macOS 起支持 `WKWebView.pageZoom`(原生 WebView 缩放)的主版本 */+const MIN_MACOS_ZOOM_MAJOR = 11++/**+ * 当前平台能否把缩放应用到 WebView。+ *+ * wry 在 macOS 上直接调用 `WKWebView.pageZoom`(macOS 11+ 才有,且没有 `#available`+ * 守卫),在 10.15 及更早会因未识别选择器崩溃,所以先用 `@tauri-apps/plugin-os`+ * 读取系统版本再决定;其余平台一律支持。+ */+function isNativeZoomSupported(): boolean {+ try {+ if (type() !== 'macos')+ return true+ const major = Number.parseInt(version().split('.')[0] ?? '', 10)+ return Number.isFinite(major) ? major >= MIN_MACOS_ZOOM_MAJOR : true+ }+ catch (error) {+ // OS 插件不可用(未注册/未安装):拿不到系统版本时按支持处理,避免功能整块静默失效+ console.warn('[useZoomFactor] failed to read the OS version, assuming native zoom is supported:', error)+ return true+ }+}++/**+ * 响应式 WebView 缩放比例(Tauri)。+ *+ * @param factor 显式比例(number 或 ref):挂载时应用一次,之后随来源变化重应用+ * @returns `[factor, setFactor]`:当前比例与写入函数+ *+ * @example+ * const [factor, setFactor] = useZoomFactor()+ * setFactor(1.5)+ *+ * @example+ * const [factor] = useZoomFactor(webview, 2) // 指定实例并应用显式比例+ */+export function useZoomFactor(factor?: RefOrValue<number>): [number, ZoomFactorSetter]+export function useZoomFactor(webview: Webview, factor?: RefOrValue<number>): [number, ZoomFactorSetter]+export function useZoomFactor(+ webviewOrFactor?: Webview | RefOrValue<number>,+ factor?: RefOrValue<number>,+): [number, ZoomFactorSetter] {+ const webview = isFactorArgument(webviewOrFactor) ? undefined : webviewOrFactor+ const externalFactor = isFactorArgument(webviewOrFactor) ? webviewOrFactor : factor++ // 未显式传入时作用到当前 WebView(对应 Electron 版从 `window.require('electron')` 解析 webFrame)+ const target = webview ?? getCurrentWebview()++ const resolvedFactor = externalFactor === undefined ? undefined : toValue(externalFactor)+ if (resolvedFactor !== undefined)+ assertZoomFactor(resolvedFactor)++ // 平台能力(macOS < 11 没有 `WKWebView.pageZoom`):不支持时只维护返回值,不触碰 WebView+ const supported = isNativeZoomSupported()++ const [value, setValue] = useState<number>(() => resolvedFactor ?? 1)++ // 读:Tauri 没有比例 getter,`Window.scaleFactor()` 是唯一可读比例;显式传入来源时+ // 它本身就是目标值,不再回读。+ useMount(() => {+ if (resolvedFactor !== undefined)+ return+ getCurrentWindow()+ .scaleFactor()+ .then(setValue)+ .catch(error => console.error('[useZoomFactor] scaleFactor failed:', error))+ })++ // 最后一次真正写入 `setZoom` 的比例(`null` = 尚未写过,保证显式来源在挂载时也会被应用)+ const lastAppliedRef = useRef<number | null>(null)++ // 显式来源:首次运行即 Electron 版的 `immediate: true`(挂载应用一次),+ // 之后仅在来源变化到不同值时重应用。+ useWatch(supported ? resolvedFactor : undefined, (next) => {+ if (next === undefined || next === lastAppliedRef.current)+ return+ assertZoomFactor(next)+ lastAppliedRef.current = next+ setValue(next)+ void target.setZoom(next).catch(error => console.error('[useZoomFactor] setZoom failed:', error))+ }, { immediate: true })++ function setFactor(nextFactor: number) {+ assertZoomFactor(nextFactor)+ // Tauri 没有回读接口:本地状态即「最后一次写入的比例」+ lastAppliedRef.current = nextFactor+ setValue(nextFactor)+ if (!supported) {+ console.warn('[useZoomFactor] native webview zoom is unsupported on this platform; the value is kept without applying')+ return+ }+ void target.setZoom(nextFactor).catch(error => console.error('[useZoomFactor] setZoom failed:', error))+ }++ return [value, setFactor]+}diff --git a/src/hooks/use-zoom-level.ts b/src/hooks/use-zoom-level.tsnew file mode 100644index 00000000..2b468c04--- /dev/null+++ b/src/hooks/use-zoom-level.ts@@ -0,0 +1,74 @@+import type { Webview } from '@tauri-apps/api/webview'+import type { RefOrValue } from '@/hooks/use-zoom-factor'+import { getCurrentWebview } from '@tauri-apps/api/webview'+import { isRefLike, toValue, useZoomFactor } from '@/hooks/use-zoom-factor'+import { zoomFactorFromLevel, zoomLevelFromFactor } from '@/utils/zoom'++/**+ * Tauri 版 `useZoomLevel`:签名与 `@reause/electron` 的同名 hook 完全一致+ * (响应式 WebView 缩放级别),底层改用 Tauri 的 WebView API。+ *+ * ```ts+ * const [level, setLevel] = useZoomLevel() // 读当前级别+ * const [level] = useZoomLevel(2) // 挂载时应用显式级别+ * const [level] = useZoomLevel(webview, 2) // 指定 WebView 实例 + 显式级别+ * setLevel(2) // webview.setZoom(1.2 ** 2)+ * ```+ *+ * 与 Electron 版的平台差异:+ * - Tauri 的 WebView **只有比例没有级别**(`Webview.setZoom`),因此级别一律按 Chromium+ * 的底数 1.2 换算(`factor = 1.2^level`,与 Electron `setZoomLevel` 的内部换算一致),+ * 映射为比例后复用 `useZoomFactor` 的读写通路(含初值读取与显式来源重应用)。+ * - 回报的级别由比例反推,因此**可能是小数**:Tauri 侧比例不限于 1.2 的整数次幂+ * (例如比例 1.4 对应级别 ≈ 1.8407),而 Electron 的 `getZoomLevel()` 同样可能返回小数。+ * - Electron 版对级别没有取值范围校验(`0` 是合法级别),这里保持一致:不额外设限。+ */++/**+ * `useZoomLevel` 返回的 setter:把级别换算为比例后写入(Tauri 只有比例)。+ */+export type ZoomLevelSetter = (value: number) => void++// 与 Electron 版同一套 overload 判别:首参是 number / ref 即「未显式传 WebView」+function isLevelArgument(value: Webview | RefOrValue<number> | undefined): value is RefOrValue<number> {+ return typeof value === 'number' || isRefLike(value)+}++/**+ * 响应式 WebView 缩放级别(Tauri)。+ *+ * @param level 显式级别(number 或 ref):挂载时应用一次,之后随来源变化重应用+ * @returns `[level, setLevel]`:当前级别与写入函数+ *+ * @example+ * const [level, setLevel] = useZoomLevel()+ * setLevel(2) // webview.setZoom(1.44)+ *+ * @example+ * const [level] = useZoomLevel(webview, 0) // 指定实例并应用显式级别+ */+export function useZoomLevel(level?: RefOrValue<number>): [number, ZoomLevelSetter]+export function useZoomLevel(webview: Webview, level?: RefOrValue<number>): [number, ZoomLevelSetter]+export function useZoomLevel(+ webviewOrLevel?: Webview | RefOrValue<number>,+ level?: RefOrValue<number>,+): [number, ZoomLevelSetter] {+ const webview = isLevelArgument(webviewOrLevel) ? undefined : webviewOrLevel+ const externalLevel = isLevelArgument(webviewOrLevel) ? webviewOrLevel : level++ // 级别 → 比例(显式级别才换算;无显式来源时由 useZoomFactor 读当前值)+ const externalFactor = externalLevel === undefined ? undefined : zoomFactorFromLevel(toValue(externalLevel))++ // 恒走「实例 + 比例」这一支 overload:未显式传入时作用到当前 WebView,+ // 避免条件式调用 hook(rules-of-hooks)。+ const [factor, setFactor] = useZoomFactor(webview ?? getCurrentWebview(), externalFactor)++ function setLevel(nextLevel: number) {+ setFactor(zoomFactorFromLevel(nextLevel))+ // 与 Electron 版一致:ref 形态的来源是唯一真值通道,写入后回填调用方的 ref+ if (isRefLike(externalLevel))+ externalLevel.current = nextLevel+ }++ return [zoomLevelFromFactor(factor), setLevel]+}diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.jsonindex 465a0e8c..29d7ac2f 100644--- a/src/i18n/locales/en-US.json+++ b/src/i18n/locales/en-US.json@@ -124,6 +124,8 @@"buttons.copy_logs": "Copy Logs","buttons.safe_mode": "Safe Mode","hints.safe_mode": "Restart with only the core bundles and built-in plugins, uninstalling any other plugin from that profile to isolate the ones that fail to start. Switch back to your profile in the sidebar to exit safe mode.",+ "messages.clipboard_copied": "Copied to clipboard",+ "messages.clipboard_failed": "Copy failed","messages.copy_success": "URL copied to clipboard","messages.log_copied": "Logs copied to clipboard","messages.copy_failed": "Failed to copy URL",diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.jsonindex 329576fa..3f0d8728 100644--- a/src/i18n/locales/zh-CN.json+++ b/src/i18n/locales/zh-CN.json@@ -124,6 +124,8 @@"buttons.copy_logs": "复制日志","buttons.safe_mode": "安全模式","hints.safe_mode": "仅加载核心组件与内置插件重启,并卸载该档案中的其它插件以隔离启动失败。在侧边栏切回原档案即可退出安全模式。",+ "messages.clipboard_copied": "已复制到剪贴板",+ "messages.clipboard_failed": "复制失败","messages.copy_success": "地址已复制到剪贴板","messages.log_copied": "日志已复制到剪贴板","messages.copy_failed": "复制地址失败",diff --git a/src/layout/components/desktop-updater.tsx b/src/layout/components/desktop-updater.tsxdeleted file mode 100644index 0af65879..00000000--- a/src/layout/components/desktop-updater.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { useEffect } from 'react'-import { store } from '@/store'--/** 桌面端自更新轮询间隔:Rust 侧不再缓存,改为低频轮询以免触发 GitHub 未认证限流(60 次/小时/IP) */-const POLL_INTERVAL = 10 * 60_000--/**- * 桌面端更新轮询:后台低频检查新版本(见 POLL_INTERVAL,Rust 侧不缓存、每次实时- * 查询)。发现新版本时由 store 静默下载安装包,**不弹右下角 toast**——- * 更新入口收敛到顶部导航栏的「更新可用」chip 与「帮助 > 检查更新」:- * 二者都打开同一个对话框,里面才是下载进度与「打开安装包」。- */-export function DesktopUpdater() {- useEffect(() => {- // 后台失败静默,不打扰用户- void store.desktopUpdater.check().catch(() => {})- const timer = setInterval(() => {- void store.desktopUpdater.check().catch(() => {})- }, POLL_INTERVAL)- return () => clearInterval(timer)- }, [])-- return null-}diff --git a/src/layout/components/download-toast-trigger.tsx b/src/layout/components/download-toast-trigger.tsxdeleted file mode 100644index 4bef4a1e..00000000--- a/src/layout/components/download-toast-trigger.tsx+++ /dev/null@@ -1,48 +0,0 @@-/* eslint-disable react/naming-convention-ref-name */-import { useWatch } from '@hairy/react-lib'-import { invoke } from '@tauri-apps/api/core'-import { useRef } from 'react'-import { useTranslation } from 'react-i18next'-import { useStore } from 'valtio-define'-import { store } from '@/store'-import { toast } from '@/utils/toast'--export function DownloadToast() {- const { t } = useTranslation()- const { notice } = useStore(store.download)- const toastKey = useRef<string | null>(null)-- useWatch([notice], () => {- if (!notice)- return null- if (toastKey.current)- toast.close(toastKey.current)- const { success, path } = notice- toastKey.current = toast(success ? t('download.saved') : t('download.failed'), {- description: success && path- ? (- <div className="truncate max-w-[300px]">- {`${t('download.saved_to')}: ${path}`}- </div>- )- : undefined,- placement: 'bottom end',- actionProps: success && path- ? {- children: t('download.show_in_folder'),- variant: 'tertiary',- onPress: () => {- if (toastKey.current)- toast.close(toastKey.current)- void invoke('reveal_in_folder', { path }).catch((err) => {- console.error('[Harness] reveal_in_folder failed:', err)- })- },- }- : undefined,- onClose: () => store.download.dismiss(),- })- })-- return null-}diff --git a/src/layout/components/harness-updater.tsx b/src/layout/components/harness-updater.tsxdeleted file mode 100644index b6e90b3c..00000000--- a/src/layout/components/harness-updater.tsx+++ /dev/null@@ -1,27 +0,0 @@-import { useWatch } from '@hairy/react-lib'-import { useStore } from 'valtio-define'-import { useCoreBreakingConfirm } from '@/hooks/use-core-breaking-confirm'-import { store } from '@/store'--/** 右下角“发现新版本”提示条:状态与操作直接来自 updater store */-export function HarnessUpdater() {- const { updateInfo, updating } = useStore(store.harnessUpdater)- const { holder, confirmCoreBreaking } = useCoreBreakingConfirm()-- useWatch([updateInfo, updating], () => {- if (!updateInfo || updating)- return- // 仅提示新版本,不打断用户;破坏性更改确认推迟到点击「立即更新」时(见 handleUpdate)- store.harnessUpdater.showToast(() => handleUpdate())- }, { immediate: true })-- /** 点击「立即更新」:目标版本高于 rc.2 时先弹破坏性更改确认,取消则中止更新 */- async function handleUpdate() {- const info = store.harnessUpdater.updateInfo- if (!info || !(await confirmCoreBreaking(info.tag)))- return- await store.harnessUpdater.handleUpdate()- }-- return holder-}diff --git a/src/layout/components/iframe.tsx b/src/layout/components/iframe.tsxnew file mode 100644index 00000000..76c7409a--- /dev/null+++ b/src/layout/components/iframe.tsx@@ -0,0 +1,277 @@+/* eslint-disable react/dom-no-unsafe-iframe-sandbox */+import type { RefObject } from 'react'+import type { ZoomAction } from '@/utils/zoom'+import { CircleExclamation } from '@gravity-ui/icons'+import { useEventListener, useIntervalFn } from '@reause/core'+import { invoke } from '@tauri-apps/api/core'+import { getCurrentWindow } from '@tauri-apps/api/window'+import { useEffect } from 'react'+import { useTranslation } from 'react-i18next'+import { If } from 'react-if-lite'+import { useStore } from 'valtio-define'+import { queryClient } from '@/config/client'+import { queryKeys } from '@/config/query-keys'+import { useIframeMessage } from '@/hooks/use-iframe-message'+import { useIframePost } from '@/hooks/use-iframe-post'+import { useInvokeIframe } from '@/hooks/use-invoke-iframe'+import { useListen } from '@/hooks/use-listen'+import { useZoomFactor } from '@/hooks/use-zoom-factor'+import { store } from '@/store'+import { nextZoomFactor, zoomActionFromBridgeMessage, zoomActionFromShortcut } from '@/utils/zoom'+import { Loadable } from './loadable'++/** 可见性兜底轮询间隔:主路径是窗口 focus/resize 事件,5s 足以覆盖任务栏切换等场景 */+const VISIBILITY_POLL_INTERVAL = 5000++/**+ * iframe → 宿主 的桥消息(宿主侧按 `type` 分发,不比对 `source`)。+ * 只列 iframe 自身关心的桥:通知 / 插件异常 / 剪贴板图片 / 插件 boot+ * (导航桥的 `dsh://sidebar:collapsed` 由 `webview.tsx` 处理)。+ */+interface IframeBridgeMessage {+ type?: string+ /** 通知桥 */+ title?: string+ body?: string+ tag?: string+ sessionId?: string | null+ requireInteraction?: boolean+ /** 插件异常桥 / 剪贴板图片桥:插件 id 或剪贴板请求 id */+ id?: string+ error?: string+ action?: string+ /** 插件 boot 桥:失败页文本 */+ detail?: string+}++export interface IframeProps {+ /** iframe 元素 ref(由 `webview.tsx` 创建:导航桥也要用同一个 ref 收发) */+ iframeRef: RefObject<HTMLIFrameElement | null>+}++/**+ * 主区域 iframe:元素、加载/失败覆盖层,以及 iframe 自身的一整套桥。+ *+ * - 出站:`useIframePost`(origin 定向 + `source: 'dsh-desktop'` 协议标识);+ * - 入站:`useIframeMessage`(直接 iframe + origin 校验)+ 一个 `switch (type)`+ * (原生通知 / 插件异常上报 / 剪贴板图片回退 / 插件 boot 状态 / 缩放快捷键);+ * - 缩放:真值放在 `store.setting.zoom_factor`(persist 插件写入的 `setting` 键与+ * Rust 共用同一份 `.store.dat`,重启后由 Rust 在窗口创建时按同一规则应用),+ * 壳层快捷键与 iframe 缩放桥只更新该真值,把它落到 WebView 由 `useZoomFactor`+ * 负责(挂载一次 + 值变化时重应用);若平台没有原生缩放能力则跳过应用;+ * - 附加桥:Tauri invoke 转发 `useInvokeIframe`;+ * - 系统通知点击回传、窗口可见性同步(focus/resize + 兜底轮询)。+ *+ * 侧边栏导航桥(`dsh://sidebar:collapsed` / `dsh://sidebar:toggle`)不在这里——+ * 它属于壳层导航栏的状态,由 `webview.tsx` 用同一份 post/message 处理。+ *+ * 加载失败时**保持 iframe 挂载**,用覆盖层提供重试,重试复用同一 iframe 实例。+ */+export function Iframe({ iframeRef }: IframeProps) {+ const { t } = useTranslation()+ const {+ serviceHealthy,+ startupStatusKey,+ showIframeError,+ iframeKey,+ iframeSrc,+ serviceUrl,+ } = useStore(store.harness)+ const { zoom_factor: zoomFactor } = useStore(store.setting)++ const post = useIframePost(iframeRef)+ useInvokeIframe(iframeRef)++ // 缩放真值 → WebView:显式传入真值,挂载时应用一次、之后真值变化才重应用;+ // 平台能力判定(macOS 10.15 没有原生缩放)由 `useZoomFactor` 内部处理+ useZoomFactor(zoomFactor)++ /** 缩放动作只改真值(store 负责落盘),应用交给上面的 `useZoomFactor` */+ function applyZoom(action: ZoomAction) {+ store.setting.zoom_factor = nextZoomFactor(zoomFactor, action)+ }++ /** 壳层快捷键(焦点在导航栏等壳层元素时;iframe 内由注入脚本经缩放桥转发) */+ function handleZoomKeyDown(event: KeyboardEvent) {+ const action = zoomActionFromShortcut(event)+ if (!action)+ return+ event.preventDefault()+ applyZoom(action)+ }++ useEventListener('keydown', handleZoomKeyDown, { capture: true })++ // iframe → 宿主:iframe 自身的桥共用一个监听器,按 `data.type` 分发+ useIframeMessage<IframeBridgeMessage>(iframeRef, (data, { origin }) => {+ switch (data.type) {+ // 原生通知:转发给 Tauri 命令弹出系统通知+ case 'dsh://native-notification':+ void invoke('show_native_notification', {+ payload: {+ title: data.title ?? '',+ body: data.body ?? '',+ tag: data.tag ?? null,+ sessionId: data.sessionId ?? null,+ requireInteraction: Boolean(data.requireInteraction),+ },+ }).catch(error => console.error('[notification] show_native_notification failed:', error))+ break++ // 插件异常上报:写后端错误注册表,并刷新插件列表(「插件」面板据此展示 danger 与修复入口)+ case 'dsh://plugin-error':+ if (!data.id || !data.error)+ break+ void invoke('report_plugin_error', {+ id: data.id,+ error: data.error,+ action: data.action ?? 'runtime',+ })+ .then(() => {+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })+ })+ .catch(error => console.error('[plugin-error] report_plugin_error failed:', error))+ break++ // 剪贴板图片回退:读系统剪贴板并把 PNG data URL 回传+ // (Linux/WebKitGTK 下 dsh iframe 的 paste 事件拿不到图片,走原生剪贴板通路)+ case 'dsh://clipboard-image:read': {+ if (!data.id)+ break+ const reqId = data.id+ function reply(dataUrl: string | null) {+ iframeRef.current?.contentWindow?.postMessage(+ { source: 'dsh-desktop-clipboard', id: reqId, data_url: dataUrl },+ origin,+ )+ }+ void invoke<{ data_url?: string } | null>('read_clipboard_image')+ .then(result => reply(result?.data_url ?? null))+ .catch((error) => {+ console.error('[clipboard-image] read_clipboard_image failed:', error)+ reply(null)+ })+ break+ }++ // 插件 boot 状态:failed 携带官方失败页文本(如 web boot: 1 entry did not activate)+ case 'dsh://plugin-boot:ready':+ store.harness.markIframeBootReady()+ break+ case 'dsh://plugin-boot:stalled':+ void store.harness.recoverIframeBoot()+ break+ case 'dsh://plugin-boot:failed':+ void store.harness.handleIframeBootFailure(data.detail)+ break++ // 缩放快捷键:跨源 iframe 内的 Ctrl/Cmd +/-/0 不会冒泡到壳层,由 dsh-tauri 插件的+ // `client/register/zoom-shortcut.ts` 在 iframe 内捕获后经父窗口桥转发到这里+ case 'dsh://zoom-shortcut': {+ const action = zoomActionFromBridgeMessage(data)+ if (action)+ applyZoom(action)+ break+ }+ }+ })++ // 系统通知点击 → 让 iframe 聚焦对应会话+ useListen<{ sessionId?: string | null, title?: string, tag?: string }>(+ 'dsh-notification-clicked',+ (event) => {+ const payload = event.payload+ post({+ type: 'dsh://focus-session',+ sessionId: payload.sessionId || undefined,+ title: payload.title || undefined,+ tag: payload.tag || undefined,+ })+ },+ )++ // 将窗口可见性(最小化/隐藏/失焦)同步给 iframe,便于其暂停渲染+ function syncVisibility() {+ void (async () => {+ try {+ const appWindow = getCurrentWindow()+ const [minimized, visible] = await Promise.all([+ appWindow.isMinimized(),+ appWindow.isVisible(),+ ])+ post({ type: 'dsh://visibility-state', hidden: minimized || !visible })+ }+ catch (error) {+ console.error('[notification] sync visibility failed:', error)+ }+ })()+ }++ // 窗口焦点/尺寸变化时即时同步可见性(Tauri 窗口事件非 `listen`,保留 effect 承担注销)+ useEffect(() => {+ let disposed = false+ let unlisteners: Array<() => void> = []+ void (async () => {+ try {+ const appWindow = getCurrentWindow()+ syncVisibility()+ const unFocus = await appWindow.onFocusChanged(() => {+ void syncVisibility()+ })+ const unResized = await appWindow.onResized(() => {+ void syncVisibility()+ })+ // 订阅完成前若已卸载则立即释放,避免回调泄漏+ if (disposed) {+ unFocus()+ unResized()+ }+ else {+ unlisteners = [unFocus, unResized]+ }+ }+ catch (error) {+ console.error('[notification] visibility listeners failed:', error)+ }+ })()+ return () => {+ disposed = true+ unlisteners.forEach(fn => fn())+ }+ }, [])++ // 兜底轮询:覆盖监听不到的状态变化(如任务栏切换);主路径是窗口焦点/尺寸事件+ useIntervalFn(syncVisibility, VISIBILITY_POLL_INTERVAL)++ return (+ <div className="relative min-h-0 flex-1">+ <If+ cond={serviceHealthy}+ else={<Loadable subtitle={t(startupStatusKey)} />}+ >+ <iframe+ key={iframeKey}+ ref={iframeRef}+ className="block h-full w-full border-none bg-load-bg"+ src={iframeSrc}+ allow="accelerometer; ambient-light-sensor; autoplay; battery; camera; clipboard-read; clipboard-write; display-capture; document-domain; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; idle-detection; keyboard-map; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; speaker-selection; usb; web-share; xr-spatial-tracking"+ sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-modals allow-downloads allow-storage-access-by-user-activation"+ onLoad={store.harness.markIframeLoaded}+ onError={store.harness.markIframeError}+ title={t('app.open_editor')}+ />+ </If>++ <If cond={showIframeError}>+ <div className="absolute inset-0 z-[1]">+ <Loadable+ icon={CircleExclamation}+ title={t('ui.iframe_error')}+ errorMsg={t('ui.ensure_running', { url: serviceUrl })}+ onRetry={store.harness.refreshIframe}+ />+ </div>+ </If>+ </div>+ )+}diff --git a/src/layout/components/loadable.tsx b/src/layout/components/loadable.tsxindex 36b61245..7cd54d42 100644--- a/src/layout/components/loadable.tsx+++ b/src/layout/components/loadable.tsx@@ -1,7 +1,7 @@import type { ComponentType, ReactNode, SVGProps } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'-import { PanelProgress } from '@/components/panel-progress'+import { Panel } from '@/components/panel'import { button } from '@/components/primitives'/** 图标组件类型(@gravity-ui/icons 均为 SVG 组件) */@@ -90,7 +90,7 @@ export function Loadable({<If cond={showPanel}><div className="flex w-full flex-col gap-4">- <PanelProgress percentage={percentage} logs={logs} />+ <Panel.Progress percentage={percentage} logs={logs} /></div></If>diff --git a/src/layout/components/navbar.tsx b/src/layout/components/navbar.tsxindex 39d2ae39..db5eb7b7 100644--- a/src/layout/components/navbar.tsx+++ b/src/layout/components/navbar.tsx@@ -1,4 +1,4 @@-import type { RefObject } from 'react'+import type { DshPlugin } from '@/types'import {LayoutSideContent,LayoutSideContentLeft,@@ -8,6 +8,7 @@ import {} from '@gravity-ui/icons'import { Button, Chip, Description, Dropdown, Label } from '@heroui/react'import { useOverlay } from '@overlastic/react'+import { useQuery } from '@tanstack/react-query'import { invoke } from '@tauri-apps/api/core'import { getCurrentWindow } from '@tauri-apps/api/window'import { useEffect, useState } from 'react'@@ -15,15 +16,14 @@ import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'import { cn } from 'tailwind-variants'import { useStore } from 'valtio-define'-import { ConfigDialog } from '@/components/config-dialog'-import { DesktopAboutDialog } from '@/components/desktop-about-dialog'-import { DesktopUpdateDialog } from '@/components/desktop-update-dialog'-import { useDshPlugins } from '@/hooks/use-dsh-plugins'-import { useIframeTauri } from '@/hooks/use-iframe-tauri'+import { queryKeys } from '@/config/query-keys'+import { useListen } from '@/hooks/use-listen'import { store } from '@/store'+import { DesktopAboutDialog } from '@/ui/dialog/about'+import { ConfigDialog } from '@/ui/dialog/config'+import { DesktopUpdateDialog } from '@/ui/dialog/update'import { writeClipboardText } from '@/utils/clipboard'import { toast } from '@/utils/toast'-import { useMacOSAppMenu } from './use-macos-app-menu'/*** 壳层窗口顶部导航栏(44px,常驻):@@ -32,8 +32,10 @@ import { useMacOSAppMenu } from './use-macos-app-menu'** - 侧边栏:经 postMessage 操控 iframe 内的 dsh 应用* (`dsh://sidebar:toggle`,由 dsh-tauri 插件或桌面端注入的导航桥脚本- * NAV_SHIM_JS 执行);折叠图标由 iframe 回报的 `dsh://sidebar:collapsed` 同步。- * 左侧控件只在「dsh-tauri 插件已启用(已安装)」且存在 iframe 时渲染:+ * dsh-tauri 插件的 `client/register/sidebar.ts`(`ctx.layout.toggleSidebar`)执行);+ * 折叠图标由 iframe 回报的 `dsh://sidebar:collapsed` 同步。+ * 导航桥(收回报 + 发命令)在 `iframe.tsx`,本组件只接收状态与回调:+ * 左侧控件只在「dsh-tauri 插件已启用(已安装)」且传入 `onToggleSidebar` 时渲染,* 原生桥缺席时控件没有可靠接收方,避免出现点了没反应的死按钮。* - 空白拖拽区:Tauri 原生 `data-tauri-drag-region`(顶层文档直接生效),* Windows/Linux 上双击切换最大化,macOS 上交由系统标题栏偏好。@@ -42,13 +44,14 @@ import { useMacOSAppMenu } from './use-macos-app-menu'* - Windows/Linux:右侧窗口按钮直接调用 Tauri API;* 后台化 = 隐藏到托盘(服务保持运行)。*- * 未传入 iframeRef(安装/错误/预装引导页,无 iframe 可操控)时+ * 未传入 onToggleSidebar(安装/错误/预装引导页,无 iframe 可操控)时* 只渲染窗口控制,不渲染左侧导航控制。*//**- * dsh-tauri 插件 id:安装后 iframe 内提供 `window.__dsh_tauri_bridge__`- * 原生导航桥(`useDshPlugins` 实时同步其安装状态,插件增删即时生效)+ * dsh-tauri 插件 id:安装后 iframe 内提供侧边栏切换与折叠状态回报+ * (`client/register/sidebar.ts`;插件增删即时生效:与「插件」面板共用同一份+ * 查询缓存,缓存由根布局订阅 `dsh-plugins-updated` 写入)*/const TAURI_PLUGIN_ID = 'dsh-tauri'@@ -109,15 +112,21 @@ function useMacOSFullscreen() {}export interface NavbarProps {- /** 就绪态 iframe;传入时启用左侧导航控制 */- iframeRef?: RefObject<HTMLIFrameElement | null>+ /** iframe 回报的 dsh 侧边栏折叠状态(导航桥逻辑在 `iframe.tsx`) */+ sidebarCollapsed?: boolean+ /** 切换 iframe 内 dsh 侧边栏(向 iframe 发 `dsh://sidebar:toggle`);传入时启用左侧导航控制 */+ onToggleSidebar?: () => void}-export function Navbar({ iframeRef }: NavbarProps) {+export function Navbar({ sidebarCollapsed = false, onToggleSidebar }: NavbarProps) {const { t } = useTranslation()const isFullscreen = useMacOSFullscreen()- const { plugins } = useDshPlugins()- const { sidebarCollapsed, sendNav } = useIframeTauri(iframeRef)+ // 只读取「dsh-tauri 插件是否已安装」;查询键与「插件」面板共用(同一份缓存),+ // 挂载时自动拉取,服务重启 / 插件操作后的失效由 store 与该缓存同步共同保证。+ const { data: plugins = [] } = useQuery({+ queryKey: queryKeys.plugins,+ queryFn: () => invoke<DshPlugin[]>('get_dsh_plugins'),+ })const { updateInfo } = useStore(store.desktopUpdater)const openConfigDialog = useOverlay(ConfigDialog)@@ -198,22 +207,36 @@ export function Navbar({ iframeRef }: NavbarProps) {async function copyRunLogs() {try {const logs = await invoke<string>('read_run_logs')- await writeClipboardText(logs)- toast(t('messages.logs_copied'), {})+ // 成功/失败提示由 writeClipboardText 统一给出,这里只记录日志+ await writeClipboardText(logs, t('messages.logs_copied'))}catch (err) {console.error('[Navbar] failed to copy run logs:', err)- toast(t('messages.logs_copy_failed'), { variant: 'danger' })}}- useMacOSAppMenu({- enabled: IS_MACOS,- openConfig: handleOpenConfig,- openAbout: handleOpenAbout,- copyRunLogs: () => { void copyRunLogs() },- checkUpdate: () => { void handleCheckUpdate() },- restartHarness: () => { void store.harness.restart() },+ // macOS 原生菜单 → 复用壳层已有操作;非 macOS 无原生菜单,直接忽略事件。+ // (useListen 内部把回调放在 ref 转发,这里读到的始终是最新的处理函数。)+ useListen<string>('macos-menu-action', (event) => {+ if (!IS_MACOS)+ return+ switch (event.payload) {+ case 'desktop-config':+ handleOpenConfig()+ break+ case 'desktop-about':+ handleOpenAbout()+ break+ case 'desktop-copy-run-logs':+ void copyRunLogs()+ break+ case 'desktop-check-update':+ void handleCheckUpdate()+ break+ case 'desktop-restart':+ void store.harness.restart()+ break+ }})return (@@ -227,14 +250,14 @@ export function Navbar({ iframeRef }: NavbarProps) {},)}>- <If cond={iframeRef != null && tauriEnabled}>+ <If cond={onToggleSidebar != null && tauriEnabled}><ButtonclassName="rounded-lg size-7"isIconOnlysize="sm"variant="ghost"aria-label={t(sidebarCollapsed ? 'nav.sidebar_expand' : 'nav.sidebar_collapse')}- onPress={() => { sendNav('sidebar:toggle') }}+ onPress={() => { onToggleSidebar?.() }}><Ifcond={sidebarCollapsed}diff --git a/src/layout/components/preinstall-setup.tsx b/src/layout/components/setup-preinstall.tsxsimilarity index 95%rename from src/layout/components/preinstall-setup.tsxrename to src/layout/components/setup-preinstall.tsxindex 6b722ad4..4e4f23a8 100644--- a/src/layout/components/preinstall-setup.tsx+++ b/src/layout/components/setup-preinstall.tsx@@ -1,8 +1,9 @@-import type { PreinstallPlugin } from '@/store/modules/harness'+import type { PreinstallPlugin } from '@/store/modules/preinstall'import { CircleInfo, Copy, Xmark } from '@gravity-ui/icons'import { Button, Checkbox, Chip, Label, Spinner, Typography } from '@heroui/react'+import { useMount } from '@reause/core'import { invoke } from '@tauri-apps/api/core'-import { useEffect, useState } from 'react'+import { useState } from 'react'import { useTranslation } from 'react-i18next'import { Else, If, Then } from 'react-if-lite'import { useStore } from 'valtio-define'@@ -11,7 +12,6 @@ import { Item } from '@/components/item'import { Logs } from '@/components/logs'import { store } from '@/store'import { writeClipboardText } from '@/utils/clipboard'-import { toast } from '@/utils/toast'/*** 预装插件引导页:首次安装(或老版本升级)后展示推荐插件列表,@@ -117,12 +117,11 @@ function LogPanel({ logs }: { logs: readonly string[] }) {async function copyLogs() {try {- await writeClipboardText(text || '')- toast(t('messages.log_copied'), {})+ // 成功/失败提示由 writeClipboardText 统一给出,这里只记录日志+ await writeClipboardText(text || '', t('messages.log_copied'))}catch (err) {console.error('[Harness] copy preinstall logs failed:', err)- toast(t('messages.logs_copy_failed'), { variant: 'danger' })}}@@ -149,15 +148,15 @@ function LogPanel({ logs }: { logs: readonly string[] }) {export function PreinstallSetup() {const { t } = useTranslation()- const { preinstall } = useStore(store.harness)+ const preinstall = useStore(store.preinstall)// 用户手动调整后的选择(一旦交互即接管默认勾选)const [selected, setSelected] = useState<Set<string>>(() => new Set())const [touched, setTouched] = useState(false)- // 进入引导页时拉取插件列表- useEffect(() => {- void store.harness.loadPreinstallPlugins()- }, [])+ // 进入引导页时拉取插件列表(仅挂载一次,无需清理)+ useMount(() => {+ void store.preinstall.load()+ })// 默认勾选:已安装 + 未安装的推荐插件 +「修复」类项 + 无 chip 但标记默认勾选的项(如 dsh-notification)。// 派生计算而非在加载回调里 setState,避免与 store 的加载去重守卫竞争,@@ -198,11 +197,11 @@ export function PreinstallSetup() {const toUninstall = preinstall.plugins.filter(p => p.installed && !effectiveSelected.has(p.id)).map(p => p.id)- void store.harness.confirmPreinstall({ installIds: toInstall, uninstallIds: toUninstall })+ void store.preinstall.confirm({ installIds: toInstall, uninstallIds: toUninstall })}function handleSkip() {- void store.harness.skipPreinstall()+ void store.preinstall.skip()}// 是否有变更:存在需安装或需卸载的插件时启用"确定"@@ -242,7 +241,7 @@ export function PreinstallSetup() {className="h-8 rounded-md"size="sm"variant="primary"- onPress={() => void store.harness.loadPreinstallPlugins()}+ onPress={() => void store.preinstall.load()}isDisabled={preinstall.loading}>{t('app.retry')}@@ -356,7 +355,7 @@ export function PreinstallSetup() {className="h-8 rounded-md"size="sm"variant="tertiary"- onPress={store.harness.cancelPreinstall}+ onPress={store.preinstall.cancel}isDisabled={preinstall.cancelling}><Xmark className="size-3.5" />diff --git a/src/layout/components/setup.tsx b/src/layout/components/setup.tsxindex dbbbb3a4..7aa80477 100644--- a/src/layout/components/setup.tsx+++ b/src/layout/components/setup.tsx@@ -8,7 +8,6 @@ import { useStore } from 'valtio-define'import { button } from '@/components/primitives'import { store } from '@/store'import { writeClipboardText } from '@/utils/clipboard'-import { toast } from '@/utils/toast'import { Loadable } from './loadable'// 各阶段对应不同图标,保持与 logo 一致的黑白中性色调@@ -24,12 +23,11 @@ const STATUS_ICONS: Record<SetupStatus, IconComponent> = {async function copyLogsHandler(t: (key: string) => string) {try {const logs = await invoke<string>('read_run_logs')- await writeClipboardText(logs)- toast(t('messages.logs_copied'), {})+ // 成功/失败提示由 writeClipboardText 统一给出,这里只记录日志+ await writeClipboardText(logs, t('messages.logs_copied'))}catch (err) {console.error('[Setup] failed to copy logs:', err)- toast(t('messages.logs_copy_failed'), { variant: 'danger' })}}diff --git a/src/layout/components/use-macos-app-menu.ts b/src/layout/components/use-macos-app-menu.tsdeleted file mode 100644index 8ea09055..00000000--- a/src/layout/components/use-macos-app-menu.ts+++ /dev/null@@ -1,81 +0,0 @@-import { listen } from '@tauri-apps/api/event'-import { useEffect, useRef } from 'react'--interface MacOSAppMenuActions {- openConfig: () => void- openAbout: () => void- copyRunLogs: () => void- checkUpdate: () => void- restartHarness: () => void-}--interface UseMacOSAppMenuOptions extends MacOSAppMenuActions {- enabled: boolean-}--/**- * 接收 macOS 原生菜单事件并复用壳层已有操作。- * 操作经 ref 转发,监听器无需因 React 渲染而反复注册。- */-export function useMacOSAppMenu({- enabled,- openConfig,- openAbout,- copyRunLogs,- checkUpdate,- restartHarness,-}: UseMacOSAppMenuOptions) {- const actionsRef = useRef<MacOSAppMenuActions>({- openConfig,- openAbout,- copyRunLogs,- checkUpdate,- restartHarness,- })- actionsRef.current = { openConfig, openAbout, copyRunLogs, checkUpdate, restartHarness }-- useEffect(() => {- if (!enabled)- return-- let mounted = true- let unlisten: (() => void) | undefined-- async function setupListener() {- try {- const stopListening = await listen<string>('macos-menu-action', (event) => {- switch (event.payload) {- case 'desktop-config':- actionsRef.current.openConfig()- break- case 'desktop-about':- actionsRef.current.openAbout()- break- case 'desktop-copy-run-logs':- actionsRef.current.copyRunLogs()- break- case 'desktop-check-update':- actionsRef.current.checkUpdate()- break- case 'desktop-restart':- actionsRef.current.restartHarness()- break- }- })- if (mounted)- unlisten = stopListening- else- stopListening()- }- catch (error) {- console.error('[Navbar] failed to listen for macOS application menu:', error)- }- }-- void setupListener()- return () => {- mounted = false- unlisten?.()- }- }, [enabled])-}diff --git a/src/layout/components/webview.tsx b/src/layout/components/webview.tsxindex 1d33fbed..fb2974ff 100644--- a/src/layout/components/webview.tsx+++ b/src/layout/components/webview.tsx@@ -1,49 +1,45 @@-/* eslint-disable react/dom-no-unsafe-iframe-sandbox */-import { CircleExclamation } from '@gravity-ui/icons'-import { useRef } from 'react'-import { useTranslation } from 'react-i18next'+import { useRef, useState } from 'react'import { If } from 'react-if-lite'import { useStore } from 'valtio-define'-import { PluginRecovery } from '@/components/plugin-recovery'-import { useDesktopZoom } from '@/hooks/use-desktop-zoom'-import { useIframeInvoke } from '@/hooks/use-iframe-invoke'-import { useIframeShim } from '@/hooks/use-iframe-shim'+import { useIframeMessage } from '@/hooks/use-iframe-message'+import { useIframePost } from '@/hooks/use-iframe-post'import { store } from '@/store'-import { Loadable } from './loadable'+import { Recovery } from '@/ui/plugin/recovery'+import { Iframe } from './iframe'import { Navbar } from './navbar'-import { PreinstallSetup } from './preinstall-setup'import { Setup } from './setup'+import { PreinstallSetup } from './setup-preinstall'-const STARTUP_STATUS_KEYS = {- 'plugin-install': 'status.loading_internal',- 'process-boot': 'status.loading_process',- 'client-modules': 'status.loading_client_modules',-} as const+/** 导航桥回报(iframe → 宿主):侧边栏折叠状态 */+interface NavBridgeMessage {+ type?: string+ collapsed?: boolean+}/**- * 主区域视图:壳层导航栏(Navbar)常驻顶部,- * 安装/错误态渲染 Setup,就绪态渲染 iframe- * (挂载后加载职责交给 dsh 应用内官方 boot 页,避免两套 loading 叠加)。- * 状态与方法全部来自 harness store,不再接收 props。+ * 主区域视图:壳层导航栏(Navbar)常驻顶部,按 harness 状态切换内容——+ * 错误态 Setup / 插件恢复页,预装引导 PreinstallSetup,其余未就绪态 Setup,+ * 就绪态渲染 iframe。+ *+ * 分工:+ * - iframe 元素及 iframe 自身的桥在 `iframe.tsx`(通知 / 插件异常 / 剪贴板图片 / boot / 可见性);+ * - 导航桥属于导航栏的状态,留在这里:用同一份 `useIframeMessage` / `useIframePost`+ * 接收 `dsh://sidebar:collapsed` 回报、发送 `dsh://sidebar:toggle` 命令。*/export function Webview() {- const { t } = useTranslation()- const {- status,- serviceHealthy,- startupPhase,- iframeError,- iframeKey,- iframeSrc,- serviceUrl,- recovery,- } = useStore(store.harness)+ // iframe 内 dsh 侧边栏是否折叠(由导航桥回报)+ const [sidebarCollapsed, setSidebarCollapsed] = useState(false)++ const { status } = useStore(store.harness)+ const { recovery } = useStore(store.recovery)const iframeRef = useRef<HTMLIFrameElement>(null)+ const post = useIframePost(iframeRef)- useDesktopZoom(iframeRef)- useIframeShim(iframeRef)- useIframeInvoke(iframeRef)+ useIframeMessage<NavBridgeMessage>(iframeRef, (data) => {+ if (data.type === 'dsh://sidebar:collapsed')+ setSidebarCollapsed(Boolean(data.collapsed))+ })if (status === 'error') {return (@@ -52,7 +48,7 @@ export function Webview() {<div className="min-h-0 flex-1">{/* 能定位到问题插件时展示全屏恢复页(卸除此插件并继续检测);否则普通错误页 */}<If cond={recovery.required} else={<Setup />}>- <PluginRecovery fullScreen />+ <Recovery fullScreen /></If></div></main>@@ -84,38 +80,11 @@ export function Webview() {return (<main className="relative flex min-h-0 flex-1 flex-col bg-canvas">- <Navbar iframeRef={iframeRef} />-- {/* iframe 区域:加载失败时用覆盖层展示重试(iframe 保持挂载,重试复用) */}- <div className="relative min-h-0 flex-1">- <If- cond={serviceHealthy}- else={<Loadable subtitle={t(STARTUP_STATUS_KEYS[startupPhase])} />}- >- <iframe- key={iframeKey}- ref={iframeRef}- className="block h-full w-full border-none bg-load-bg"- src={iframeSrc}- allow="accelerometer; ambient-light-sensor; autoplay; battery; camera; clipboard-read; clipboard-write; display-capture; document-domain; encrypted-media; fullscreen; gamepad; geolocation; gyroscope; hid; idle-detection; keyboard-map; magnetometer; microphone; midi; payment; picture-in-picture; publickey-credentials-get; screen-wake-lock; serial; speaker-selection; usb; web-share; xr-spatial-tracking"- sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-modals allow-downloads allow-storage-access-by-user-activation"- onLoad={store.harness.markIframeLoaded}- onError={store.harness.markIframeError}- title={t('app.open_editor')}- />- </If>-- <If cond={serviceHealthy && iframeError}>- <div className="absolute inset-0 z-[1]">- <Loadable- icon={CircleExclamation}- title={t('ui.iframe_error')}- errorMsg={t('ui.ensure_running', { url: serviceUrl })}- onRetry={store.harness.refreshIframe}- />- </div>- </If>- </div>+ <Navbar+ sidebarCollapsed={sidebarCollapsed}+ onToggleSidebar={() => post({ type: 'dsh://sidebar:toggle' })}+ />+ <Iframe iframeRef={iframeRef} /></main>)}diff --git a/src/layout/index.tsx b/src/layout/index.tsxindex 94685f3f..bfcc6fb4 100644--- a/src/layout/index.tsx+++ b/src/layout/index.tsx@@ -1,76 +1,194 @@-import { useEffect } from 'react'+import type { DshPlugin, DshThemePreference, ResolvedTheme } from '@/types'+import { useEventListener, useIntervalFn, useMount, usePreferredDark, useWakeLock, useWatch } from '@reause/core'+import { useQueryClient } from '@tanstack/react-query'+import { invoke } from '@tauri-apps/api/core'+import { useRef, useState } from 'react'+import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'import { useStore } from 'valtio-define'-import { PluginRecovery } from '../components/plugin-recovery'-import { useDshTheme } from '../hooks/use-dsh-theme'+import { queryKeys } from '@/config/query-keys'+import { useListen } from '@/hooks/use-listen'+import { useCoreBreakingConfirm } from '@/ui/config/hooks/use-core-breaking-confirm'+import { toast } from '@/utils/toast'import { store } from '../store'-import { DesktopUpdater } from './components/desktop-updater'-import { DownloadToast } from './components/download-toast-trigger'-import { HarnessUpdater } from './components/harness-updater'+import { Recovery } from '../ui/plugin/recovery'import { Webview } from './components/webview'import '../i18n'++/** 桌面端自更新轮询间隔:Rust 侧不缓存,改为低频轮询以免触发 GitHub 未认证限流(60 次/小时/IP) */+const DESKTOP_UPDATE_POLL_INTERVAL = 10 * 60_000++/** Rust 侧 on_download 接管下载后 emit 的完成事件载荷(与 desktop::payload 对齐) */+interface DownloadFinishedPayload {+ url: string+ path: string | null+ success: boolean+}+/**- * 应用根布局:只负责首次启动与整体壳层结构。- * 业务状态与操作方法全部收敛到 valtio-define store,- * 各子组件自行订阅 store,不再通过 props 透传回调与状态。- * 弹出层(关于 / 检查更新 / 应用配置 / 插件异常修复)统一由 overlastic 命令式打开,- * 仅在需要时挂载,不常驻渲染。+ * 应用根布局:只负责首次启动、壳层结构与若干后台副作用。+ *+ * 业务状态与操作方法全部收敛到 valtio-define store,各子组件自行订阅 store,+ * 不再通过 props 透传回调与状态;弹出层(关于 / 检查更新 / 应用配置 / 插件异常修复)+ * 统一由 overlastic 命令式打开,仅在需要时挂载。+ *+ * 原先独立的后台组件已内置到本组件(都只产出副作用或一个 holder,+ * 或需要「无论哪个面板挂载都在跑」的全局性,不值得各占一个文件):+ * - 桌面端更新轮询(低频 `useIntervalFn`,失败静默);+ * - 下载完成提示(订阅 `harness-download-finished`,事件到手即弹 toast);+ * - 核心更新提示(`useWatch` 观察更新状态,返回 `useCoreBreakingConfirm` 的 holder);+ * - 外壳主题同步(订阅 `dsh-theme-updated` + 系统明暗,写 `<html data-theme>`);+ * - 插件列表缓存同步(订阅 `dsh-plugins-updated`,写入 react-query 缓存,+ * 供插件面板 / 配置对话框角标 / 导航栏共用)。*/export function App() {- useDshTheme()+ // —— 外壳主题 ——+ // dsh 把主题偏好持久化在 `$DSH_HOME/settings.yaml` 的 `ui-theme.preference`+ // (light/dark/system),后端轮询到变化后经 `dsh-theme-updated` 推送;这里解析为+ // 最终主题写到 `<html data-theme="...">`,由 CSS 变量切换配色。+ // - 系统明暗由 reause `usePreferredDark` 实时订阅媒体查询;+ // - 首次偏好 `useMount` 拉取,后续变化 `useListen` 订阅;+ // - 主题落盘 `<html data-theme>` 用 `useWatch` 观察最终主题。+ const [themePreference, setThemePreference] = useState<DshThemePreference>('dark')+ const systemDark = usePreferredDark()+ const theme: ResolvedTheme = themePreference === 'system' ? (systemDark ? 'dark' : 'light') : themePreference++ useMount(() => {+ invoke<DshThemePreference>('get_dsh_theme')+ .then(setThemePreference)+ .catch(err => console.error('[App] failed to load theme:', err))+ })++ useListen<DshThemePreference>('dsh-theme-updated', event => setThemePreference(event.payload))++ useWatch(theme, (value) => {+ document.documentElement.dataset.theme = value+ }, { immediate: true })++ // —— 插件列表缓存同步 ——+ // 后端(`service/plugin/watch`)解析出完整插件列表后经 `dsh-plugins-updated` 推送,+ // 这里直接写入查询缓存(事件载荷即完整列表,无需额外往返拉取)。缓存由所有消费者+ // 共用:插件面板(查询 + 操作)、配置对话框的异常角标、导航栏的 dsh-tauri 检测。+ const queryClient = useQueryClient()+ useListen<DshPlugin[]>('dsh-plugins-updated', ({ payload }) => {+ queryClient.setQueryData(queryKeys.plugins, payload)+ })++ const { t } = useTranslation()const { status } = useStore(store.harness)- // 首次挂载自动启动 harness(store 内部对 StrictMode 重复挂载去重)- useEffect(() => {- store.harness.startup()- }, [])+ const { updateInfo, updating } = useStore(store.harnessUpdater)+ const { holder: coreBreakingHolder, confirmCoreBreaking } = useCoreBreakingConfirm()++ // issue #469:本应用没有屏幕常亮的正当需求(常驻播放的 <video> 会让系统无法息屏),+ // 唤醒锁一旦生效就立刻释放。+ const wakelock = useWakeLock()+ useWatch(wakelock.isActive, () => {+ void wakelock.release()+ }, { immediate: true })// 仅开发模式:快捷键预览「插件异常修复界面」,便于快速看到实际 UI(不影响生产构建)。// Ctrl+Shift+1 → 运行期异常对话框(应用仍在运行)// Ctrl+Shift+2 → 启动崩溃全屏恢复页- useEffect(() => {+ // 生产构建下监听仍在(reause `useEventListener` 无法条件订阅),但首个分支即返回。+ useEventListener('keydown', (event: KeyboardEvent) => {if (!import.meta.env.DEV)return- function onKeyDown(e: KeyboardEvent) {- if (!e.ctrlKey || !e.shiftKey)- return- if (e.code === 'Digit1') {- e.preventDefault()- store.harness.setRuntimeRecovery({- plugins: ['dsh-better-sidebar'],- reason: 'slot_conflict',- detail: 'sidebar',- raw_error: 'Preview: dsh-better-sidebar reported a UI slot conflict.',- })- }- else if (e.code === 'Digit2') {- e.preventDefault()- store.harness.fail('Preview: plugin startup failure')- store.harness.setRuntimeRecovery({- plugins: ['dsh-better-sidebar'],- reason: 'duplicate_loader_entry',- detail: 'dshSidebarApi',- raw_error: 'Preview: duplicate loader entry id: dshSidebarApi',- })- }+ if (!event.ctrlKey || !event.shiftKey)+ return+ if (event.code === 'Digit1') {+ event.preventDefault()+ store.recovery.setRuntimeRecovery({+ plugins: ['dsh-better-sidebar'],+ reason: 'slot_conflict',+ detail: 'sidebar',+ raw_error: 'Preview: dsh-better-sidebar reported a UI slot conflict.',+ })}- window.addEventListener('keydown', onKeyDown)- return () => window.removeEventListener('keydown', onKeyDown)- }, [])+ else if (event.code === 'Digit2') {+ event.preventDefault()+ store.harness.fail('Preview: plugin startup failure')+ store.recovery.setRuntimeRecovery({+ plugins: ['dsh-better-sidebar'],+ reason: 'duplicate_loader_entry',+ detail: 'dshSidebarApi',+ raw_error: 'Preview: duplicate loader entry id: dshSidebarApi',+ })+ }+ })++ // 首次挂载自动启动 harness(store 内部对 StrictMode 重复挂载去重)+ useMount(() => store.harness.startup())++ // 桌面端更新轮询:启动即检查一次,之后低频轮询;失败一律静默(不打扰用户)。+ // 发现新版本由 store 静默下载安装包,更新入口收敛到导航栏 chip 与「帮助 > 检查更新」。+ function checkDesktopUpdate() {+ void store.desktopUpdater.check().catch(() => {})+ }+ useMount(checkDesktopUpdate)+ useIntervalFn(checkDesktopUpdate, DESKTOP_UPDATE_POLL_INTERVAL)++ // 下载完成提示:dsh iframe 内的下载在 WebView2 中是静默保存的(用户零感知),+ // 由外壳订阅 Rust 侧完成事件,弹出「已保存 + 打开文件夹」提示。+ const toastKeyRef = useRef<string | null>(null)+ useListen<DownloadFinishedPayload>('harness-download-finished', ({ payload }) => {+ if (status !== 'ready')+ return+ if (toastKeyRef.current)+ toast.close(toastKeyRef.current)+ const { success, path } = payload+ toastKeyRef.current = toast(success ? t('download.saved') : t('download.failed'), {+ description: success && path+ ? (+ <div className="truncate max-w-[300px]">+ {`${t('download.saved_to')}: ${path}`}+ </div>+ )+ : undefined,+ placement: 'bottom end',+ actionProps: success && path+ ? {+ children: t('download.show_in_folder'),+ variant: 'tertiary',+ onPress: () => {+ if (toastKeyRef.current)+ toast.close(toastKeyRef.current)+ void invoke('reveal_in_folder', { path }).catch((err) => {+ console.error('[Harness] reveal_in_folder failed:', err)+ })+ },+ }+ : undefined,+ onClose: () => {+ toastKeyRef.current = null+ },+ })+ })++ // 新版本提示:仅提示不打断用户;破坏性更改确认推迟到点击「立即更新」时+ useWatch([updateInfo, updating], () => {+ if (!updateInfo || updating)+ return+ store.harnessUpdater.showToast(() => handleUpdate())+ }, { immediate: true })++ /** 点击「立即更新」:目标版本高于 rc.2 时先弹破坏性更改确认,取消则中止更新 */+ async function handleUpdate() {+ const info = store.harnessUpdater.updateInfo+ if (!info || !(await confirmCoreBreaking(info.tag)))+ return+ await store.harnessUpdater.handleUpdate()+ }return (<div className="flex h-screen w-screen"><Webview /><If cond={status === 'ready'}>- <HarnessUpdater />- </If>- <If cond={status === 'ready'}>- <DownloadToast />+ {coreBreakingHolder}</If>{/* 运行期插件异常:应用仍在运行,弹醒目对话框(启动崩溃走 webview 的全屏恢复页) */}<If cond={status === 'ready'}>- <PluginRecovery />+ <Recovery /></If>- <DesktopUpdater /></div>)}diff --git a/src/main.tsx b/src/main.tsxindex 04dbcdf1..9380151b 100644--- a/src/main.tsx+++ b/src/main.tsx@@ -5,12 +5,8 @@ import ReactDOM from 'react-dom/client'import { ToastProvider } from './components/toast-provider'import { queryClient } from './config/client'import { App } from './layout'-import { disableWakeLock } from './utils/disable-wake-lock'import '@/utils/logger'-import './style/main.css'--// 渲染前先禁用屏幕唤醒锁:本应用无需屏幕常亮,任何 <video> 播放都会让系统无法息屏(issue #469)。-disableWakeLock()+import './styles/main.css'ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(<React.StrictMode>diff --git a/src/pet/app.tsx b/src/pet/app.tsxindex ea50d1a1..f09f00ea 100644--- a/src/pet/app.tsx+++ b/src/pet/app.tsx@@ -1,14 +1,14 @@import type { PetRef, PetRenderMotion } from 'dsh-pet-component'-import { useEventListener } from '@reause/core'+import { useEventListener, useWakeLock, useWatch } from '@reause/core'import { Pet } from 'dsh-pet-component'import { useRef } from 'react'import { If } from 'react-if-lite'import { ToastProvider } from '@/components/toast-provider'-import { PetHint } from './components/pet-hint'+import { useOmitIgnoreCursorEvents } from '@/hooks/use-omit-ignore-cursor-events'+import { useWindowDraggable } from '@/hooks/use-window-draggable'+import { Hint } from '@/ui/pet/hint'import { PET_BASE_WIDTH, PET_DSH_ASPECT } from './constants'import { useBubble } from './hooks/use-bubble'-import { useDrag } from './hooks/use-drag'-import { useOmitIgnoreCursorEvents } from './hooks/use-omit-ignore-cursor-events'import { usePetSource } from './hooks/use-pet-source'import { normalizeSizePercent, usePetStatus } from './hooks/use-pet-status'import { usePetWindowSize } from './hooks/use-pet-window'@@ -19,7 +19,7 @@ import { usePetWindowSize } from './hooks/use-pet-window'* 三条输入各管一段,互不越界:* - 设置状态(`usePetStatus`)→ 选哪个宠物、多大、是否可见;* - 会话气泡(`useBubble`)→ 聚合出的动作档位;- * - 手势(`useDrag`)→ 拖动期间的方向动作。+ * - 手势(`useWindowDraggable`)→ 拖动期间的方向动作。** 动作全部经 `pet.motion(...)` / `pet.clear()` 下发到 `<Pet>` 的命令面(优先级高于* 声明式 `motion` prop),渲染细节(动画池解析、双视频缓冲、雪碧图、缓存、双击回应)@@ -28,11 +28,19 @@ import { usePetWindowSize } from './hooks/use-pet-window'export function App() {const petRef = useRef<PetRef>(null)const status = usePetStatus()++ // issue #469:桌宠动画是常驻播放的 <video>,Chromium 会因此持有 Video Wake Lock+ // 让系统无法息屏;本窗口没有常亮的正当需求,唤醒锁一旦生效就立刻释放。+ const wakelock = useWakeLock()+ useWatch(wakelock.isActive, () => {+ void wakelock.release()+ }, { immediate: true })+const activePet = status?.active_pet ?? ''const { source, error } = usePetSource(activePet)const hitboxRef = useRef<HTMLDivElement>(null)const bubble = useBubble()- const { dragging, direction } = useDrag()+ const { dragging, direction } = useWindowDraggable()const visible = status === null || (status.enabled !== false && status.visible !== false)const width = (source?.width ?? PET_BASE_WIDTH) * normalizeSizePercent(status?.pet_size) / 100@@ -69,7 +77,7 @@ export function App() {)}{/* 选中了宠物但资源解析不出来(导入的宠物被删除、清单里没有该 id):必须给出可见提示 —— 透明窗口里「空」与「在加载」观感相同,静默留空等于让用户以为坏了。 */}- <If cond={error !== null} then={<PetHint petId={activePet} />} />+ <If cond={error !== null} then={<Hint petId={activePet} />} /></main></ToastProvider>)diff --git a/src/pet/hooks/use-bubble.ts b/src/pet/hooks/use-bubble.tsindex 154227fc..378bb522 100644--- a/src/pet/hooks/use-bubble.ts+++ b/src/pet/hooks/use-bubble.ts@@ -1,14 +1,11 @@-import type { ToastContentValue } from '@heroui/react'import type { Motion } from 'dsh-pet-component'-import { listen } from '@tauri-apps/api/event'-import { useEffect, useState } from 'react'-import { toast } from '@/utils/toast'-import { sessionTitle, statusCopy, taskCopy, toolActivityGroup } from './bubble-copy'+import type { BubbleTracker } from '../utils/bubble-tracker'+import { useUnmount } from '@reause/core'+import { useRef, useState } from 'react'+import { useListen } from '@/hooks/use-listen'+import { createBubbleTracker } from '../utils/bubble-tracker'-export interface BubbleSession {- [key: string]: unknown- id: string-}+export type { BubbleSession } from '../utils/bubble-tracker'export interface BubbleHandle {/**@@ -18,598 +15,25 @@ export interface BubbleHandle {readonly motion: Motion | undefined}-type SessionAction = 'create' | 'remove' | 'update'--const FAILED_BUBBLE_TIMEOUT = 4000-const REVIEW_BUBBLE_TIMEOUT = 2500-const SUCCESS_TOAST_TIMEOUT = 3000-const FAILED_PULSE_TTL = 1800/**- * 终态档(success/error)聚合保持时长:对齐 dsh-pet 的 BUBBLE_DURATION_MS=10000- * (终态动画播一次 + 10s 收气泡)语义。不得复用 SUCCESS_TOAST_TIMEOUT(3s)——成功- * 终态动画(如 雀跃庆祝)实际播放时长超过 3s 时,聚合状态提前回落会让 app.tsx 的- * useWatch 调 pet.clear() 掐断未播完的动画(用户报告:成功动画没播完就换回待机)。- * 动画播完由视频 ended(handleEnded → 清 override)自然回落,toast 收起仍走- * scheduleHide 的独立 3s(SUCCESS_TOAST_TIMEOUT),二者互不影响。+ * 桌宠窗口的会话气泡:只做两件事——+ * 1. 用 `useListen` 订阅 DSH 推来的三个会话事件,把载荷喂给状态机;+ * 2. 卸载时释放状态机里的定时器与 toast。+ *+ * 会话 → toast 映射、聚合优先级、合并窗口、沉淀与脉冲 TTL 等全部逻辑在+ * `pet/utils/bubble-tracker.ts`(不依赖 React,可单独推理)。*/-const TERMINAL_PULSE_TTL = 10000-/** 会话完成/变空闲后保留的时长:超过即从会话表沉淀,防止 durable subagent 等永不发 remove 的会话无界积累。 */-const IDLE_SESSION_RETENTION = 5000-/**- * 聚合状态下发合并窗口(ms):突发到达的多会话状态变更只取窗内「最新」值下发一次。- * 多会话并行时每个 session:update 事件都走 updateAgg,若每档都立即 setStatus,- * app.tsx 的 useWatch 会对逐个差异档位调用 pet.change 重载动画——工作档位- * (thinking 20 / result 25 / working 30)交错抖动会让桌宠动画被频繁切回/重放。- * 统一合并:窗内只刷新 pendingAgg,到期一次性下发最新聚合态,中间档位全部丢弃。- */-const STATUS_COALESCE_MS = 100--/** 桌宠窗口无 i18n 基础设施,就地按窗口语言取单语文案(与 pet.tsx 保留文案一致)。 */-const IS_ZH = (typeof document !== 'undefined' ? document.documentElement.lang || navigator.language : 'zh-CN')- .toLowerCase()- .startsWith('zh')--/** 工具名 → toast 展示标签(沿用既有风格:英文工具名大写 / 中文动词)。 */-const TOOL_LABELS: Record<string, string> = {- pwsh: 'Pwsh',- bash: 'Bash',- grep: 'Grep',- glob: 'Glob',- read: '读取',- read_image: '看图',- write: '写入',- edit: '编辑',- str_replace_editor: '编辑',- web_search: '搜索',- web_fetch: '抓取',- think: '思考',- skill: '技能',-} as const--/** 工具名 → 从 args(JSON 字符串)提取展示明细的键,按优先级取第一个非空值。 */-const TOOL_ARG_KEYS: Record<string, readonly string[]> = {- pwsh: ['command'],- bash: ['command'],- grep: ['pattern'],- glob: ['pattern'],- read: ['file_path', 'path'],- read_image: ['file_path', 'path'],- write: ['file_path', 'path'],- edit: ['file_path', 'path'],- str_replace_editor: ['file_path', 'path'],- web_search: ['queries', 'query'],- web_fetch: ['url'],- think: ['thought'],- skill: ['name'],-} as const--/** 状态优先级映射,数值越大优先级越高(对齐 dsh-dafeiyu statePriority:等待>错误>工作>思考>空闲)。 */-const STATUS_PRIORITY: Record<string, number> = {- 'waiting': 60,- 'error': 50,- 'failed': 45,- 'review': 40,- 'working': 30,- 'result': 25,- 'thinking': 20,- 'running': 12,- 'success': 10,- 'idle': 0,- 'turn': 0,- 'moving-left': 0,- 'moving-right': 0,- 'waving': 0,-} as const--/** 桌宠窗口的会话气泡:DSH 发送原始会话快照,本 hook 私有管理会话→toast key 映射,仅暴露聚合宠物状态。 */export function useBubble(): BubbleHandle {- const [status, setStatus] = useState<Motion | undefined>(undefined)-- useEffect(() => {- // 状态容器定义- const sessions = new Map<string, BubbleSession>()- const toastKeys = new Map<string, string>()- const hideTimers = new Map<string, number>()- const previousStatus = new Map<string, Motion | undefined>()- const failedUntil = new Map<string, number>()- const pulseTimers = new Map<string, number>()- const consumedFailed = new Set<string>()- const dismissed = new Set<string>()- const pruneTimers = new Map<string, number>()-- let lastAgg: Motion | undefined- /** 合并窗口内最新计算出的聚合态(未下发前持续被更新,窗口到期统一下发)。 */- let pendingAgg: Motion | undefined- /** pendingAgg 是否有待下发的变更(区分「待下发 undefined 态」与「无变更」)。 */- let hasPendingAgg = false- let aggFlushTimer: number | undefined- let disposed = false-- /** 合并窗口到期:把窗口内「最新」聚合态下发(中间态已丢弃,只发最终值)。 */- const flushPendingAgg = () => {- aggFlushTimer = undefined- if (disposed || !hasPendingAgg)- return- hasPendingAgg = false- const next = pendingAgg- if (next !== lastAgg) {- lastAgg = next- setStatus(next)- }- }-- const updateAgg = () => {- const next = statusOf(sessions, failedUntil, Date.now())- if (next === lastAgg && !hasPendingAgg)- return- // 始终只处理「最新」的会话状态变更:突发(多会话交错或单会话档位连跳)内- // 每次 updateAgg 都刷新 pendingAgg 并重置合并窗口(trailing 窗口),- // lastAgg 保持已下发的值——窗口只收敛到最终聚合态再一次性下发,- // 中间档位(thinking/result/working 交错)全部丢弃,避免逐个触发- // app.tsx 的 pet.change 让动画被反复切回/重载(多会话频繁切回动画的根因)。- hasPendingAgg = true- pendingAgg = next- if (aggFlushTimer !== undefined)- window.clearTimeout(aggFlushTimer)- aggFlushTimer = window.setTimeout(flushPendingAgg, STATUS_COALESCE_MS)- }-- const clearTimer = (map: Map<string, number>, id: string) => {- const timer = map.get(id)- if (timer !== undefined) {- window.clearTimeout(timer)- map.delete(id)- }- }-- const closeToast = (id: string) => {- clearTimer(hideTimers, id)- const key = toastKeys.get(id)- if (key !== undefined) {- toast.close(key)- toastKeys.delete(id)- }- }-- /** 清除指定会话的所有关联缓存及定时器 */- const removeSessionData = (id: string) => {- sessions.delete(id)- previousStatus.delete(id)- dismissed.delete(id)- failedUntil.delete(id)- consumedFailed.delete(id)- clearTimer(pulseTimers, id)- clearTimer(hideTimers, id)- clearTimer(pruneTimers, id)- closeToast(id)- }-- /** 沉淀清除:超过保留时间后彻底清理空闲会话 */- const pruneSession = (id: string) => {- if (disposed)- return- const session = sessions.get(id)- if (!session)- return- // 活跃档(think/work/result/waiting/running/review)不沉淀;- // 终态档(workStatus success/error)翻开底层:底层空闲(回合完成且无错误残留)才可沉淀。- const status = sessionStatus(session)- const bottom = sessionStatus(session, true)- if (bottom !== undefined)- return- if (status !== undefined && status !== 'success' && status !== 'error')- return-- removeSessionData(id)- updateAgg()- }-- const armPrune = (id: string) => {- clearTimer(pruneTimers, id)- const timer = window.setTimeout(() => {- pruneTimers.delete(id)- pruneSession(id)- }, IDLE_SESSION_RETENTION)- pruneTimers.set(id, timer)- }-- const scheduleHide = (id: string, current: Motion) => {- clearTimer(hideTimers, id)- const timeout = current === 'failed' || current === 'error'- ? FAILED_BUBBLE_TIMEOUT- : current === 'review'- ? REVIEW_BUBBLE_TIMEOUT- : current === 'success'- ? SUCCESS_TOAST_TIMEOUT- : undefined- const key = toastKeys.get(id)- if (timeout === undefined || key === undefined)- return-- const timer = window.setTimeout(() => {- if (toastKeys.get(id) === key) {- dismissed.add(id)- closeToast(id)- }- }, timeout)- hideTimers.set(id, timer)- }-- const trackFailedPulse = (session: BubbleSession) => {- const current = sessionStatus(session)- const previous = previousStatus.get(session.id)-- if (current === 'failed' || current === 'error' || current === 'success') {- if (previous === current || consumedFailed.has(session.id))- return-- // 终态档脉冲窗口:failed 短 TTL 恢复底层状态;success/error 为终态档,- // 保持 TERMINAL_PULSE_TTL(对齐 dsh-pet 10s 收气泡),等动画完整播完再回落空闲。- const ttl = current === 'success' || current === 'error' ? TERMINAL_PULSE_TTL : FAILED_PULSE_TTL- const deadline = Date.now() + ttl- failedUntil.set(session.id, deadline)- clearTimer(pulseTimers, session.id)-- const timer = window.setTimeout(() => {- if (disposed || failedUntil.get(session.id) !== deadline)- return- failedUntil.delete(session.id)- clearTimer(pulseTimers, session.id)- consumedFailed.add(session.id)- updateAgg()- }, ttl)-- pulseTimers.set(session.id, timer)- }- else {- failedUntil.delete(session.id)- clearTimer(pulseTimers, session.id)- consumedFailed.delete(session.id)- }- }-- const syncToast = (session: BubbleSession) => {- const current = sessionStatus(session)- const previous = previousStatus.get(session.id)- previousStatus.set(session.id, current)- const key = toastKeys.get(session.id)-- // 子代理会话整体静默:状态仍参与聚合与沉淀(previousStatus/armPrune 照常),- // 但不创建/更新/关闭任何 toast——子代理任务多且切换频繁,活跃追踪 toast 会- // 不断弹出/更新,属于视觉噪音(此前只抑制了「已完成」toast,活跃 toast 仍会弹)。- if (session.origin === 'subagent') {- if (key !== undefined) {- closeToast(session.id)- }- if (current === undefined && previous !== undefined) {- armPrune(session.id)- }- return- }-- if (current === undefined) {- if (key !== undefined)- closeToast(session.id)-- // 子代理静默关闭:不弹「已完成」成功 toast- if (previous === 'running' && session.origin !== 'subagent') {- toast(sessionTitle(session).trim(), {- description: '已完成',- placement: 'top end',- variant: 'success',- timeout: SUCCESS_TOAST_TIMEOUT,- })- }- if (previous !== undefined)- armPrune(session.id)- return- }-- clearTimer(pruneTimers, session.id)- // 终态档(播完即收):failed/error 失败、review 待审阅、success 完成。- const isTerminal = current === 'failed' || current === 'review' || current === 'error' || current === 'success'- if (!isTerminal) {- dismissed.delete(session.id)- }-- const content = toastContent(session, current)- if (key === undefined) {- if (dismissed.has(session.id) || previous === current)- return-- let createdKey = ''- createdKey = toast(content.title, {- isLoading: content.isLoading,- description: content.description,- placement: 'top end',- variant: content.variant as 'warning' | 'danger' | 'default' | 'success',- timeout: 0,- onClose: () => {- if (toastKeys.get(session.id) === createdKey) {- toastKeys.delete(session.id)- clearTimer(hideTimers, session.id)- }- },- })- toastKeys.set(session.id, createdKey)- }- else {- toast.update(key, content as ToastContentValue)- }-- if (previous !== current && isTerminal) {- scheduleHide(session.id, current)- }- }-- const apply = (payload: unknown, action: SessionAction) => {- const session = rawSession(payload)- if (!session)- return-- if (action === 'remove') {- removeSessionData(session.id)- }- else {- sessions.set(session.id, session)- trackFailedPulse(session)- syncToast(session)- }-- updateAgg()- }-- let unlisteners: Array<() => void> = []- Promise.all([- listen('session:create', e => apply(e.payload, 'create')),- listen('session:update', e => apply(e.payload, 'update')),- listen('session:remove', e => apply(e.payload, 'remove')),- ])- .then((listeners) => {- if (disposed) {- listeners.forEach(u => u())- }- else {- unlisteners = listeners- }- })- .catch(() => { })-- return () => {- disposed = true- unlisteners.forEach(u => u())-- // 统一清理所有 Map 定时器与 Toast- const clearAllTimers = (map: Map<string, number>) => {- map.forEach(t => window.clearTimeout(t))- map.clear()- }- clearAllTimers(hideTimers)- clearAllTimers(pulseTimers)- clearAllTimers(pruneTimers)- if (aggFlushTimer !== undefined)- window.clearTimeout(aggFlushTimer)-- toastKeys.forEach(k => toast.close(k))- toastKeys.clear()- }- }, [])-- return { motion: status }-}--/** 统一解析原始会话对象 */-function rawSession(payload: unknown): BubbleSession | undefined {- if (!payload || typeof payload !== 'object')- return undefined- const value = payload as Record<string, unknown>- const session = (value.session && typeof value.session === 'object' ? value.session : value) as Record<string, unknown>- const id = session.id ?? session.sessionId- return typeof id === 'string' && id.length > 0 ? { ...session, id } : undefined-}--/** 细分工作档位(host reducer workStatus 输出):与 `dsh-pet-component` 的动作名同名。 */-const WORK_STATUSES = ['thinking', 'working', 'result', 'waiting', 'success', 'error'] as const--type WorkStatus = (typeof WORK_STATUSES)[number]--/** 提取单个会话的状态(细分档优先,忽略底层恢复逻辑)。 */-function sessionStatus(session: BubbleSession, ignoreError = false): Motion | undefined {- // 细分工作档位(host reducer 权威):thinking/working/result/waiting/success/error- const work = session.workStatus as unknown- if (WORK_STATUSES.includes(work as WorkStatus)) {- // error/success 是终态档;pulse 过期(ignoreError)后回落底层推导,不残留失败/成功视觉。- if (ignoreError && (work === 'error' || work === 'success'))- return undefined- return work as Motion- }-- const value = session.status ?? session.activity ?? session.phase-- // 终态错误判定只在回合已结束(running !== true)时生效:工具级失败/旧快照的- // lastAgentError 若与 running=true 并存,说明回合仍在跑(agent 捕获错误继续),- // 此时绝不判 failed 收起气泡(用户报告:会话还在跑 toast 却消失了)。- // lastAgentError==='aborted' 是旧版插件宿主(未重新部署 dist 的安装)把手动取消误记为- // 错误的兜底豁免:取消是用户主动中断而非失败,不弹「失败:aborted」。新版宿主已不再下发该值。- const agentError = session.lastAgentError- if (!ignoreError && session.running !== true && (value === 'failed' || value === 'error' || (Boolean(agentError) && agentError !== 'aborted'))) {- return 'failed'- }- if (value === 'review' || value === 'reviewing' || value === 'plan-review') {- return 'review'- }-- const hasInteraction = Boolean(session.pendingInteraction)- const hasPending = Array.isArray(session.pending) ? session.pending.length > 0 : Boolean(session.pending)-- if (value === 'waiting' || value === 'pending' || value === 'blocked' || hasInteraction || hasPending) {- return 'waiting'- }-- if (value === 'running' || value === 'working' || value === 'thinking' || session.running === true) {- return 'running'- }-- return undefined-}--/** 计算聚合最高优先级状态(零额外堆内存分配) */-function statusOf(- sessions: ReadonlyMap<string, BubbleSession>,- failedUntil: ReadonlyMap<string, number>,- now: number,-): Motion | undefined {- let highestStatus: Motion | undefined- let maxPriority = 0-- for (const session of sessions.values()) {- let status = sessionStatus(session)- if (status === 'failed' || status === 'error' || status === 'success') {- const deadline = failedUntil.get(session.id)- if (deadline === undefined || now >= deadline) {- status = sessionStatus(session, true) // 底层恢复状态- }- }-- if (status) {- const priority = STATUS_PRIORITY[status] ?? 0- if (priority > maxPriority) {- maxPriority = priority- highestStatus = status- if (maxPriority === STATUS_PRIORITY.waiting)- break // 'waiting' 为最高优先级,提前终止遍历- }- }- }- return highestStatus-}--/** 格式化空白字符 */-function sanitizeText(str: string): string {- return str.replace(/\s+/g, ' ').trim()-}--/** 从工具 args(JSON 字符串)按优先级提取展示明细;解析失败或无匹配键时返回 undefined。 */-function toolArgDetail(tool: string, args: unknown): string | undefined {- if (typeof args !== 'string' || !args)- return undefined-- let parsed: unknown- try {- parsed = JSON.parse(args)- }- catch {- return undefined- }- if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))- return undefined-- const record = parsed as Record<string, unknown>- for (const key of TOOL_ARG_KEYS[tool] ?? ['file_path', 'path']) {- const value = record[key]- if (typeof value === 'string' && value.trim()) {- return sanitizeText(value)- }- if (Array.isArray(value)) {- const first = value.find(item => typeof item === 'string' && item.trim())- if (typeof first === 'string' && first.trim()) {- return sanitizeText(first)- }- }- }- return undefined-}--/** 生成 Toast 渲染数据(对齐 dsh-dafeiyu:优先失败详情 → 任务文案 → 工具/思考活动 → 档位状态文案)。 */-function toastContent(session: BubbleSession, status: Motion) {- const getFirstString = (...items: unknown[]): string | undefined => {- for (const item of items) {- if (typeof item === 'string' && item.trim().length > 0) {- return item.trim()- }- }- return undefined- }-- const getLiveActivity = (): string | undefined => {- if (status !== 'running' && status !== 'thinking' && status !== 'working' && status !== 'result') {- return undefined- }- if (!session.liveActivity || typeof session.liveActivity !== 'object') {- return undefined- }-- const { kind, text, name, args } = session.liveActivity as Record<string, unknown>-- if (kind === 'reasoning' && typeof text === 'string' && text.trim()) {- return IS_ZH ? `思考 · ${sanitizeText(text)}` : `Thought · ${sanitizeText(text)}`- }-- if (kind === 'tool' && typeof name === 'string' && name) {- const tool = name.toLowerCase()- const label = TOOL_LABELS[tool]- if (!label)- return IS_ZH ? `工具调用 · ${name}` : `Tool · ${name}`-- const detail = toolArgDetail(tool, args)- return detail ? `${label} · ${detail}` : label- }-- return undefined- }-- const isSub = session.origin === 'subagent'- const title = sessionTitle(session)- // 会话稳定 seed(同会话同档位文案恒定,跨档位切换自然换句;对齐 dsh-dafeiyu statusCopy(seed))。- const seed = session.id- const statusTextMap: Record<string, string> = {- 'think': IS_ZH ? '思考中' : 'Thinking',- 'thinking': IS_ZH ? '思考中' : 'Thinking',- 'working': IS_ZH ? '处理中' : 'Working',- 'result': IS_ZH ? '整理中' : 'Organizing',- 'waiting': IS_ZH ? '等待中' : 'Waiting',- 'running': isSub ? (IS_ZH ? '运行中' : 'Running') : (IS_ZH ? '思考中' : 'Thinking'),- 'review': IS_ZH ? '待审阅' : 'Review',- 'failed': IS_ZH ? '失败' : 'Failed',- 'error': IS_ZH ? '出错' : 'Error',- 'success': IS_ZH ? '已完成' : 'Done',- 'idle': IS_ZH ? '空闲' : 'Idle',- 'turn': IS_ZH ? '空闲' : 'Idle',- 'moving-left': IS_ZH ? '空闲' : 'Idle',- 'moving-right': IS_ZH ? '空闲' : 'Idle',- 'waving': IS_ZH ? '空闲' : 'Idle',- }-- const statusText = statusTextMap[status] ?? (IS_ZH ? '空闲' : 'Idle')- // 档位状态文案:waiting 分 approval/user-question 两档,working 按工具活动分类选句。- const fallbackCopy = status === 'waiting'- ? (session.phase === 'approval' ? statusCopy('approval', seed) : statusCopy('waiting', seed))- : status === 'working'- ? statusCopy(toolActivityGroup(String((session.liveActivity as Record<string, unknown> | undefined)?.name ?? '')), seed)- : statusCopy(status, seed)- const description = getFirstString(- session.lastAgentError ? (IS_ZH ? `失败:${String(session.lastAgentError)}` : `Failed: ${String(session.lastAgentError)}`) : undefined,- taskCopy(session.task as string | undefined), // todo 任务文案:正在处理「xxx」- getLiveActivity(), // 工具/思考活动详情(保留既有实用信息)- fallbackCopy, // 档位状态文案(dsh-dafeiyu statusCopy)- session.description,- session.message,- statusText,- ) ?? (IS_ZH ? '会话' : 'Session')-- const variant = status === 'waiting' || status === 'review'- ? 'warning'- : status === 'failed' || status === 'error'- ? 'danger'- : status === 'success'- ? 'success'- : 'default'-- return {- title,- description,- // 工作中平凡态显示 spinner(running/细分工作档位);等待/终态档不显示 loading。- isLoading: status === 'running' || status === 'thinking' || status === 'working' || status === 'result',- variant,- }+ const [motion, setMotion] = useState<Motion | undefined>(undefined)+ // 每个 hook 实例一台状态机:ref 惰性创建,StrictMode 的重复渲染不会重建+ const trackerRef = useRef<BubbleTracker | null>(null)+ trackerRef.current ??= createBubbleTracker(setMotion)+ const tracker = trackerRef.current++ useListen('session:create', event => tracker.apply(event.payload, 'create'))+ useListen('session:update', event => tracker.apply(event.payload, 'update'))+ useListen('session:remove', event => tracker.apply(event.payload, 'remove'))+ useUnmount(() => tracker.dispose())++ return { motion }}diff --git a/src/pet/hooks/use-pet-source.ts b/src/pet/hooks/use-pet-source.tsindex 08e92b21..4c5b951f 100644--- a/src/pet/hooks/use-pet-source.ts+++ b/src/pet/hooks/use-pet-source.ts@@ -1,6 +1,7 @@import type { CodexPetConfig, PetConfig } from 'dsh-pet-component'+import { useWatch } from '@reause/core'import { invoke } from '@tauri-apps/api/core'-import { useEffect, useState } from 'react'+import { useState } from 'react'import { PET_CODEX_ASPECT, PET_DSH_ASPECT } from '../constants'import { reportPetIssue } from '../utils/log'@@ -112,34 +113,28 @@ export function usePetSource(activePet: string): PetSourceState {error: string | null} | null>(null)- useEffect(() => {- if (activePet === '')- return undefined- let disposed = false- const task = activePet.includes(':')- ? invoke<PetAsset>('get_pet_asset', { id: activePet }).then(assetSource)+ // 宠物切换即重新解析来源(`immediate` 覆盖挂载首帧);异步结果晚到不影响新状态+ useWatch(activePet, (id) => {+ if (id === '')+ return+ const task = id.includes(':')+ ? invoke<PetAsset>('get_pet_asset', { id }).then(assetSource): invoke<PresetPetItem[]>('list_preset_pets')- .then(catalog => catalog.find(item => item.id === activePet))+ .then(catalog => catalog.find(item => item.id === id)).then(item => (item === undefined ? null : presetSource(item)))void task.then((value) => {- if (disposed)- returnsetResolved({- id: activePet,+ id,value,- error: value === null ? `PET_NOT_FOUND: ${activePet}` : null,+ error: value === null ? `PET_NOT_FOUND: ${id}` : null,})}).catch((error) => {- reportPetIssue(`resolve ${activePet}`, error)- if (!disposed)- setResolved({ id: activePet, value: null, error: String(error) })+ reportPetIssue(`resolve ${id}`, error)+ setResolved({ id, value: null, error: String(error) })})- return () => {- disposed = true- }- }, [activePet])+ }, { immediate: true })// 尚未拿到当前 id 的结果(加载中)时不报错:避免切换宠物瞬间闪一帧「不可用」。const current = resolved !== null && resolved.id === activePet ? resolved : nulldiff --git a/src/pet/hooks/use-pet-status.ts b/src/pet/hooks/use-pet-status.tsindex a3a63299..e9ad2fd7 100644--- a/src/pet/hooks/use-pet-status.ts+++ b/src/pet/hooks/use-pet-status.ts@@ -1,6 +1,7 @@+import { useMount } from '@reause/core'import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { useEffect, useState } from 'react'+import { useState } from 'react'+import { useListen } from '@/hooks/use-listen'import { PET_SIZE_DEFAULT_PERCENT, PET_SIZE_MAX_PERCENT, PET_SIZE_MIN_PERCENT } from '../constants'/** Rust `PetStatus`(`get_pet_status` 返回值 / `pet://status` 事件载荷)。 */@@ -25,31 +26,16 @@ export interface PetStatus {export function usePetStatus(): PetStatus | null {const [status, setStatus] = useState<PetStatus | null>(null)- useEffect(() => {- let disposed = false- let unlisten: (() => void) | undefined- void listen<PetStatus>('pet://status', (event) => {- if (!disposed)- setStatus(event.payload)- }).then((dispose) => {- if (disposed)- dispose()- else- unlisten = dispose- }).catch(() => {})+ // 挂载时拉一次初值,此后跟随 `pet://status` 推送(订阅随卸载自动注销)+ useMount(() => {void invoke<PetStatus>('get_pet_status')- .then((value) => {- if (!disposed)- setStatus(value)- })+ .then(setStatus).catch((error) => {console.warn('[pet] PET_STATUS_LOAD_FAILED:', error)})- return () => {- disposed = true- unlisten?.()- }- }, [])+ })++ useListen<PetStatus>('pet://status', event => setStatus(event.payload))return status}diff --git a/src/pet/hooks/use-pet-window.ts b/src/pet/hooks/use-pet-window.tsindex 6d457618..6334612c 100644--- a/src/pet/hooks/use-pet-window.ts+++ b/src/pet/hooks/use-pet-window.ts@@ -1,6 +1,6 @@+import { useWatch } from '@reause/core'import { invoke } from '@tauri-apps/api/core'import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window'-import { useEffect } from 'react'import { PET_BUBBLE_MIN_WIDTH, PET_WINDOW_PAD_X, PET_WINDOW_PAD_Y } from '../constants'/**@@ -11,16 +11,18 @@ import { PET_BUBBLE_MIN_WIDTH, PET_WINDOW_PAD_X, PET_WINDOW_PAD_Y } from '../con* 避免两处 set_size 互相打架(issue #308)。加宽窗口只向左扩展透明区,宠物锚定* 右下角,屏幕位置保持不变。*+ * 尺寸/可见性变化即重算(`useWatch` + `immediate` 覆盖挂载首帧),无需卸载清理。+ ** @param width 宠物渲染宽度(px)* @param aspect 画布比例(高 / 宽)* @param visible 窗口当前是否可见;不可见时不折腾几何*/export function usePetWindowSize(width: number, aspect: number, visible: boolean): void {- useEffect(() => {- if (!visible)- return undefined- const windowWidth = Math.max(width + PET_WINDOW_PAD_X, PET_BUBBLE_MIN_WIDTH)- const windowHeight = width * aspect + PET_WINDOW_PAD_Y+ useWatch([width, aspect, visible], ([nextWidth, nextAspect, nextVisible]) => {+ if (!nextVisible)+ return+ const windowWidth = Math.max(nextWidth + PET_WINDOW_PAD_X, PET_BUBBLE_MIN_WIDTH)+ const windowHeight = nextWidth * nextAspect + PET_WINDOW_PAD_Yvoid getCurrentWindow().setSize(new LogicalSize(windowWidth, windowHeight)).then(() => {@@ -30,6 +32,5 @@ export function usePetWindowSize(width: number, aspect: number, visible: boolean.catch((error) => {console.warn('[pet] PET_WINDOW_RESIZE_FAILED:', error)})- return undefined- }, [aspect, visible, width])+ }, { immediate: true })}diff --git a/src/pet/main.tsx b/src/pet/main.tsxindex 44d2e6d8..dd91228a 100644--- a/src/pet/main.tsx+++ b/src/pet/main.tsx@@ -1,7 +1,6 @@import { fetch as tauriFetch } from '@tauri-apps/plugin-http'import React from 'react'import ReactDOM from 'react-dom/client'-import { disableWakeLock } from '@/utils/disable-wake-lock'import { App } from './app'import { reportPetIssue } from './utils/log'import './main.css'@@ -43,10 +42,6 @@ globalThis.addEventListener('unhandledrejection', (event) => {const root = document.getElementById('root') as HTMLElementroot.className = 'h-full w-full'-// 桌宠动画是常驻播放的 <video>:Chromium 会因此持有 Video Wake Lock,让系统无法息屏-// (issue #469)。渲染前禁用屏幕唤醒锁,收起宠物/窗口隐藏时都不会再阻止息屏。-disableWakeLock()-ReactDOM.createRoot(root).render(<React.StrictMode><App />diff --git a/src/pet/utils/bubble-tracker.ts b/src/pet/utils/bubble-tracker.tsnew file mode 100644index 00000000..a34b489f--- /dev/null+++ b/src/pet/utils/bubble-tracker.ts@@ -0,0 +1,603 @@+import type { ToastContentValue } from '@heroui/react'+import type { Motion } from 'dsh-pet-component'+import { toast } from '@/utils/toast'+import { IS_ZH, sessionTitle, statusCopy, taskCopy, toolActivityGroup } from './bubble'++/**+ * 会话气泡状态机(桌宠窗口专用,**不依赖 React**)。+ *+ * DSH 把每个会话的原始快照经 `session:create|update|remove` 事件推给桌宠窗口;+ * 这里把这些快照收敛成:+ * - 一张「会话 → toast」映射(创建/原地更新/定时收起);+ * - 一个多会话聚合出的动作档位(`Motion`),经 `onMotion` 回吐给 React 层。+ *+ * 之所以从 `use-bubble.ts` 里抽出来:原实现把状态容器与三个 `listen` 一起塞进+ * 一个 500 行的 `useEffect`,既无法单测,也让「订阅」这件事被埋没。现在:+ * - React 侧只负责 `useListen` ×3 与 `useUnmount` 释放;+ * - 本文件是纯逻辑(除 `toast` 这一外部副作用),可单独推理/测试。+ */++export interface BubbleSession {+ [key: string]: unknown+ id: string+}++type SessionAction = 'create' | 'remove' | 'update'++export interface BubbleTracker {+ /** 喂入一个会话事件载荷(原始快照或 `{ session }` 包装)。 */+ apply: (payload: unknown, action: SessionAction) => void+ /** 释放所有定时器与 toast;可在 StrictMode 的双挂载间重复调用。 */+ dispose: () => void+}++const FAILED_BUBBLE_TIMEOUT = 4000+const REVIEW_BUBBLE_TIMEOUT = 2500+const SUCCESS_TOAST_TIMEOUT = 3000+const FAILED_PULSE_TTL = 1800+/**+ * 终态档(success/error)聚合保持时长:对齐 dsh-pet 的 BUBBLE_DURATION_MS=10000+ * (终态动画播一次 + 10s 收气泡)语义。不得复用 SUCCESS_TOAST_TIMEOUT(3s)——成功+ * 终态动画(如 雀跃庆祝)实际播放时长超过 3s 时,聚合状态提前回落会让 app.tsx 的+ * useWatch 调 pet.clear() 掐断未播完的动画(用户报告:成功动画没播完就换回待机)。+ * 动画播完由视频 ended(handleEnded → 清 override)自然回落,toast 收起仍走+ * scheduleHide 的独立 3s(SUCCESS_TOAST_TIMEOUT),二者互不影响。+ */+const TERMINAL_PULSE_TTL = 10000+/** 会话完成/变空闲后保留的时长:超过即从会话表沉淀,防止 durable subagent 等永不发 remove 的会话无界积累。 */+const IDLE_SESSION_RETENTION = 5000+/**+ * 聚合状态下发合并窗口(ms):突发到达的多会话状态变更只取窗内「最新」值下发一次。+ * 多会话并行时每个 session:update 事件都走 updateAgg,若每档都立即 setStatus,+ * app.tsx 的 useWatch 会对逐个差异档位调用 pet.change 重载动画——工作档位+ * (thinking 20 / result 25 / working 30)交错抖动会让桌宠动画被频繁切回/重放。+ * 统一合并:窗内只刷新 pendingAgg,到期一次性下发最新聚合态,中间档位全部丢弃。+ */+const STATUS_COALESCE_MS = 100++/** 工具名 → toast 展示标签(沿用既有风格:英文工具名大写 / 中文动词)。 */+const TOOL_LABELS: Record<string, string> = {+ pwsh: 'Pwsh',+ bash: 'Bash',+ grep: 'Grep',+ glob: 'Glob',+ read: '读取',+ read_image: '看图',+ write: '写入',+ edit: '编辑',+ str_replace_editor: '编辑',+ web_search: '搜索',+ web_fetch: '抓取',+ think: '思考',+ skill: '技能',+}++/** 工具名 → 从 args(JSON 字符串)提取展示明细的键,按优先级取第一个非空值。 */+const TOOL_ARG_KEYS: Record<string, readonly string[]> = {+ pwsh: ['command'],+ bash: ['command'],+ grep: ['pattern'],+ glob: ['pattern'],+ read: ['file_path', 'path'],+ read_image: ['file_path', 'path'],+ write: ['file_path', 'path'],+ edit: ['file_path', 'path'],+ str_replace_editor: ['file_path', 'path'],+ web_search: ['queries', 'query'],+ web_fetch: ['url'],+ think: ['thought'],+ skill: ['name'],+}++/** 状态优先级映射,数值越大优先级越高(对齐 dsh-dafeiyu statePriority:等待>错误>工作>思考>空闲)。 */+const STATUS_PRIORITY: Record<string, number> = {+ 'waiting': 60,+ 'error': 50,+ 'failed': 45,+ 'review': 40,+ 'working': 30,+ 'result': 25,+ 'thinking': 20,+ 'running': 12,+ 'success': 10,+ 'idle': 0,+ 'turn': 0,+ 'moving-left': 0,+ 'moving-right': 0,+ 'waving': 0,+}++/** 细分工作档位(host reducer workStatus 输出):与 `dsh-pet-component` 的动作名同名。 */+const WORK_STATUSES = ['thinking', 'working', 'result', 'waiting', 'success', 'error'] as const++type WorkStatus = (typeof WORK_STATUSES)[number]++/** 统一解析原始会话对象 */+function rawSession(payload: unknown): BubbleSession | undefined {+ if (!payload || typeof payload !== 'object')+ return undefined+ const value = payload as Record<string, unknown>+ const session = (value.session && typeof value.session === 'object' ? value.session : value) as Record<string, unknown>+ const id = session.id ?? session.sessionId+ return typeof id === 'string' && id.length > 0 ? { ...session, id } : undefined+}++/** 提取单个会话的状态(细分档优先,忽略底层恢复逻辑)。 */+function sessionStatus(session: BubbleSession, ignoreError = false): Motion | undefined {+ // 细分工作档位(host reducer 权威):thinking/working/result/waiting/success/error+ const work = session.workStatus as unknown+ if (WORK_STATUSES.includes(work as WorkStatus)) {+ // error/success 是终态档;pulse 过期(ignoreError)后回落底层推导,不残留失败/成功视觉。+ if (ignoreError && (work === 'error' || work === 'success'))+ return undefined+ return work as Motion+ }++ const value = session.status ?? session.activity ?? session.phase++ // 终态错误判定只在回合已结束(running !== true)时生效:工具级失败/旧快照的+ // lastAgentError 若与 running=true 并存,说明回合仍在跑(agent 捕获错误继续),+ // 此时绝不判 failed 收起气泡(用户报告:会话还在跑 toast 却消失了)。+ // lastAgentError==='aborted' 是旧版插件宿主(未重新部署 dist 的安装)把手动取消误记为+ // 错误的兜底豁免:取消是用户主动中断而非失败,不弹「失败:aborted」。新版宿主已不再下发该值。+ const agentError = session.lastAgentError+ if (!ignoreError && session.running !== true && (value === 'failed' || value === 'error' || (Boolean(agentError) && agentError !== 'aborted'))) {+ return 'failed'+ }+ if (value === 'review' || value === 'reviewing' || value === 'plan-review') {+ return 'review'+ }++ const hasInteraction = Boolean(session.pendingInteraction)+ const hasPending = Array.isArray(session.pending) ? session.pending.length > 0 : Boolean(session.pending)++ if (value === 'waiting' || value === 'pending' || value === 'blocked' || hasInteraction || hasPending) {+ return 'waiting'+ }++ if (value === 'running' || value === 'working' || value === 'thinking' || session.running === true) {+ return 'running'+ }++ return undefined+}++/** 计算聚合最高优先级状态(零额外堆内存分配) */+function statusOf(+ sessions: ReadonlyMap<string, BubbleSession>,+ failedUntil: ReadonlyMap<string, number>,+ now: number,+): Motion | undefined {+ let highestStatus: Motion | undefined+ let maxPriority = 0++ for (const session of sessions.values()) {+ let status = sessionStatus(session)+ if (status === 'failed' || status === 'error' || status === 'success') {+ const deadline = failedUntil.get(session.id)+ if (deadline === undefined || now >= deadline) {+ status = sessionStatus(session, true) // 底层恢复状态+ }+ }++ if (status) {+ const priority = STATUS_PRIORITY[status] ?? 0+ if (priority > maxPriority) {+ maxPriority = priority+ highestStatus = status+ if (maxPriority === STATUS_PRIORITY.waiting)+ break // 'waiting' 为最高优先级,提前终止遍历+ }+ }+ }+ return highestStatus+}++/** 格式化空白字符 */+function sanitizeText(str: string): string {+ return str.replace(/\s+/g, ' ').trim()+}++/** 从工具 args(JSON 字符串)按优先级提取展示明细;解析失败或无匹配键时返回 undefined。 */+function toolArgDetail(tool: string, args: unknown): string | undefined {+ if (typeof args !== 'string' || !args)+ return undefined++ let parsed: unknown+ try {+ parsed = JSON.parse(args)+ }+ catch {+ return undefined+ }+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))+ return undefined++ const record = parsed as Record<string, unknown>+ for (const key of TOOL_ARG_KEYS[tool] ?? ['file_path', 'path']) {+ const value = record[key]+ if (typeof value === 'string' && value.trim()) {+ return sanitizeText(value)+ }+ if (Array.isArray(value)) {+ const first = value.find(item => typeof item === 'string' && item.trim())+ if (typeof first === 'string' && first.trim()) {+ return sanitizeText(first)+ }+ }+ }+ return undefined+}++/** 生成 Toast 渲染数据(对齐 dsh-dafeiyu:优先失败详情 → 任务文案 → 工具/思考活动 → 档位状态文案)。 */+function toastContent(session: BubbleSession, status: Motion) {+ const getFirstString = (...items: unknown[]): string | undefined => {+ for (const item of items) {+ if (typeof item === 'string' && item.trim().length > 0) {+ return item.trim()+ }+ }+ return undefined+ }++ const getLiveActivity = (): string | undefined => {+ if (status !== 'running' && status !== 'thinking' && status !== 'working' && status !== 'result') {+ return undefined+ }+ if (!session.liveActivity || typeof session.liveActivity !== 'object') {+ return undefined+ }++ const { kind, text, name, args } = session.liveActivity as Record<string, unknown>++ if (kind === 'reasoning' && typeof text === 'string' && text.trim()) {+ return IS_ZH ? `思考 · ${sanitizeText(text)}` : `Thought · ${sanitizeText(text)}`+ }++ if (kind === 'tool' && typeof name === 'string' && name) {+ const tool = name.toLowerCase()+ const label = TOOL_LABELS[tool]+ if (!label)+ return IS_ZH ? `工具调用 · ${name}` : `Tool · ${name}`++ const detail = toolArgDetail(tool, args)+ return detail ? `${label} · ${detail}` : label+ }++ return undefined+ }++ const isSub = session.origin === 'subagent'+ const title = sessionTitle(session)+ // 会话稳定 seed(同会话同档位文案恒定,跨档位切换自然换句;对齐 dsh-dafeiyu statusCopy(seed))。+ const seed = session.id+ const statusTextMap: Record<string, string> = {+ 'think': IS_ZH ? '思考中' : 'Thinking',+ 'thinking': IS_ZH ? '思考中' : 'Thinking',+ 'working': IS_ZH ? '处理中' : 'Working',+ 'result': IS_ZH ? '整理中' : 'Organizing',+ 'waiting': IS_ZH ? '等待中' : 'Waiting',+ 'running': isSub ? (IS_ZH ? '运行中' : 'Running') : (IS_ZH ? '思考中' : 'Thinking'),+ 'review': IS_ZH ? '待审阅' : 'Review',+ 'failed': IS_ZH ? '失败' : 'Failed',+ 'error': IS_ZH ? '出错' : 'Error',+ 'success': IS_ZH ? '已完成' : 'Done',+ 'idle': IS_ZH ? '空闲' : 'Idle',+ 'turn': IS_ZH ? '空闲' : 'Idle',+ 'moving-left': IS_ZH ? '空闲' : 'Idle',+ 'moving-right': IS_ZH ? '空闲' : 'Idle',+ 'waving': IS_ZH ? '空闲' : 'Idle',+ }++ const statusText = statusTextMap[status] ?? (IS_ZH ? '空闲' : 'Idle')+ // 档位状态文案:waiting 分 approval/user-question 两档,working 按工具活动分类选句。+ const fallbackCopy = status === 'waiting'+ ? (session.phase === 'approval' ? statusCopy('approval', seed) : statusCopy('waiting', seed))+ : status === 'working'+ ? statusCopy(toolActivityGroup(String((session.liveActivity as Record<string, unknown> | undefined)?.name ?? '')), seed)+ : statusCopy(status, seed)+ const description = getFirstString(+ session.lastAgentError ? (IS_ZH ? `失败:${String(session.lastAgentError)}` : `Failed: ${String(session.lastAgentError)}`) : undefined,+ taskCopy(session.task as string | undefined), // todo 任务文案:正在处理「xxx」+ getLiveActivity(), // 工具/思考活动详情(保留既有实用信息)+ fallbackCopy, // 档位状态文案(dsh-dafeiyu statusCopy)+ session.description,+ session.message,+ statusText,+ ) ?? (IS_ZH ? '会话' : 'Session')++ const variant = status === 'waiting' || status === 'review'+ ? 'warning'+ : status === 'failed' || status === 'error'+ ? 'danger'+ : status === 'success'+ ? 'success'+ : 'default'++ return {+ title,+ description,+ // 工作中平凡态显示 spinner(running/细分工作档位);等待/终态档不显示 loading。+ isLoading: status === 'running' || status === 'thinking' || status === 'working' || status === 'result',+ variant,+ }+}++/**+ * 创建一台会话气泡状态机。+ *+ * @param onMotion 聚合档位变化时的回调(React 侧传 `setState`)+ */+export function createBubbleTracker(onMotion: (motion: Motion | undefined) => void): BubbleTracker {+ // 状态容器(随实例生灭;React 侧只在卸载时 dispose,StrictMode 双挂载可安全重复调用)+ const sessions = new Map<string, BubbleSession>()+ const toastKeys = new Map<string, string>()+ const hideTimers = new Map<string, number>()+ const previousStatus = new Map<string, Motion | undefined>()+ const failedUntil = new Map<string, number>()+ const pulseTimers = new Map<string, number>()+ const consumedFailed = new Set<string>()+ const dismissed = new Set<string>()+ const pruneTimers = new Map<string, number>()++ let lastAgg: Motion | undefined+ /** 合并窗口内最新计算出的聚合态(未下发前持续被更新,窗口到期统一下发)。 */+ let pendingAgg: Motion | undefined+ /** pendingAgg 是否有待下发的变更(区分「待下发 undefined 态」与「无变更」)。 */+ let hasPendingAgg = false+ let aggFlushTimer: number | undefined++ /** 合并窗口到期:把窗口内「最新」聚合态下发(中间态已丢弃,只发最终值)。 */+ const flushPendingAgg = () => {+ aggFlushTimer = undefined+ if (!hasPendingAgg)+ return+ hasPendingAgg = false+ const next = pendingAgg+ if (next !== lastAgg) {+ lastAgg = next+ onMotion(next)+ }+ }++ const updateAgg = () => {+ const next = statusOf(sessions, failedUntil, Date.now())+ if (next === lastAgg && !hasPendingAgg)+ return+ // 始终只处理「最新」的会话状态变更:突发(多会话交错或单会话档位连跳)内+ // 每次 updateAgg 都刷新 pendingAgg 并重置合并窗口(trailing 窗口),+ // lastAgg 保持已下发的值——窗口只收敛到最终聚合态再一次性下发,+ // 中间档位(thinking/result/working 交错)全部丢弃,避免逐个触发+ // app.tsx 的 pet.change 让动画被反复切回/重载(多会话频繁切回动画的根因)。+ hasPendingAgg = true+ pendingAgg = next+ if (aggFlushTimer !== undefined)+ window.clearTimeout(aggFlushTimer)+ aggFlushTimer = window.setTimeout(flushPendingAgg, STATUS_COALESCE_MS)+ }++ const clearTimer = (map: Map<string, number>, id: string) => {+ const timer = map.get(id)+ if (timer !== undefined) {+ window.clearTimeout(timer)+ map.delete(id)+ }+ }++ const closeToast = (id: string) => {+ clearTimer(hideTimers, id)+ const key = toastKeys.get(id)+ if (key !== undefined) {+ toast.close(key)+ toastKeys.delete(id)+ }+ }++ /** 清除指定会话的所有关联缓存及定时器 */+ const removeSessionData = (id: string) => {+ sessions.delete(id)+ previousStatus.delete(id)+ dismissed.delete(id)+ failedUntil.delete(id)+ consumedFailed.delete(id)+ clearTimer(pulseTimers, id)+ clearTimer(hideTimers, id)+ clearTimer(pruneTimers, id)+ closeToast(id)+ }++ /** 沉淀清除:超过保留时间后彻底清理空闲会话 */+ const pruneSession = (id: string) => {+ const session = sessions.get(id)+ if (!session)+ return+ // 活跃档(think/work/result/waiting/running/review)不沉淀;+ // 终态档(workStatus success/error)翻开底层:底层空闲(回合完成且无错误残留)才可沉淀。+ const status = sessionStatus(session)+ const bottom = sessionStatus(session, true)+ if (bottom !== undefined)+ return+ if (status !== undefined && status !== 'success' && status !== 'error')+ return++ removeSessionData(id)+ updateAgg()+ }++ const armPrune = (id: string) => {+ clearTimer(pruneTimers, id)+ const timer = window.setTimeout(() => {+ pruneTimers.delete(id)+ pruneSession(id)+ }, IDLE_SESSION_RETENTION)+ pruneTimers.set(id, timer)+ }++ const scheduleHide = (id: string, current: Motion) => {+ clearTimer(hideTimers, id)+ const timeout = current === 'failed' || current === 'error'+ ? FAILED_BUBBLE_TIMEOUT+ : current === 'review'+ ? REVIEW_BUBBLE_TIMEOUT+ : current === 'success'+ ? SUCCESS_TOAST_TIMEOUT+ : undefined+ const key = toastKeys.get(id)+ if (timeout === undefined || key === undefined)+ return++ const timer = window.setTimeout(() => {+ if (toastKeys.get(id) === key) {+ dismissed.add(id)+ closeToast(id)+ }+ }, timeout)+ hideTimers.set(id, timer)+ }++ const trackFailedPulse = (session: BubbleSession) => {+ const current = sessionStatus(session)+ const previous = previousStatus.get(session.id)++ if (current === 'failed' || current === 'error' || current === 'success') {+ if (previous === current || consumedFailed.has(session.id))+ return++ // 终态档脉冲窗口:failed 短 TTL 恢复底层状态;success/error 为终态档,+ // 保持 TERMINAL_PULSE_TTL(对齐 dsh-pet 10s 收气泡),等动画完整播完再回落空闲。+ const ttl = current === 'success' || current === 'error' ? TERMINAL_PULSE_TTL : FAILED_PULSE_TTL+ const deadline = Date.now() + ttl+ failedUntil.set(session.id, deadline)+ clearTimer(pulseTimers, session.id)++ const timer = window.setTimeout(() => {+ if (failedUntil.get(session.id) !== deadline)+ return+ failedUntil.delete(session.id)+ clearTimer(pulseTimers, session.id)+ consumedFailed.add(session.id)+ updateAgg()+ }, ttl)++ pulseTimers.set(session.id, timer)+ }+ else {+ failedUntil.delete(session.id)+ clearTimer(pulseTimers, session.id)+ consumedFailed.delete(session.id)+ }+ }++ const syncToast = (session: BubbleSession) => {+ const current = sessionStatus(session)+ const previous = previousStatus.get(session.id)+ previousStatus.set(session.id, current)+ const key = toastKeys.get(session.id)++ // 子代理会话整体静默:状态仍参与聚合与沉淀(previousStatus/armPrune 照常),+ // 但不创建/更新/关闭任何 toast——子代理任务多且切换频繁,活跃追踪 toast 会+ // 不断弹出/更新,属于视觉噪音(此前只抑制了「已完成」toast,活跃 toast 仍会弹)。+ if (session.origin === 'subagent') {+ if (key !== undefined) {+ closeToast(session.id)+ }+ if (current === undefined && previous !== undefined) {+ armPrune(session.id)+ }+ return+ }++ if (current === undefined) {+ if (key !== undefined)+ closeToast(session.id)++ // 子代理静默关闭:不弹「已完成」成功 toast+ if (previous === 'running' && session.origin !== 'subagent') {+ toast(sessionTitle(session).trim(), {+ description: '已完成',+ placement: 'top end',+ variant: 'success',+ timeout: SUCCESS_TOAST_TIMEOUT,+ })+ }+ if (previous !== undefined)+ armPrune(session.id)+ return+ }++ clearTimer(pruneTimers, session.id)+ // 终态档(播完即收):failed/error 失败、review 待审阅、success 完成。+ const isTerminal = current === 'failed' || current === 'review' || current === 'error' || current === 'success'+ if (!isTerminal) {+ dismissed.delete(session.id)+ }++ const content = toastContent(session, current)+ if (key === undefined) {+ if (dismissed.has(session.id) || previous === current)+ return++ let createdKey = ''+ createdKey = toast(content.title, {+ isLoading: content.isLoading,+ description: content.description,+ placement: 'top end',+ variant: content.variant as 'warning' | 'danger' | 'default' | 'success',+ timeout: 0,+ onClose: () => {+ if (toastKeys.get(session.id) === createdKey) {+ toastKeys.delete(session.id)+ clearTimer(hideTimers, session.id)+ }+ },+ })+ toastKeys.set(session.id, createdKey)+ }+ else {+ toast.update(key, content as ToastContentValue)+ }++ if (previous !== current && isTerminal) {+ scheduleHide(session.id, current)+ }+ }++ function apply(payload: unknown, action: SessionAction): void {+ const session = rawSession(payload)+ if (!session)+ return++ if (action === 'remove') {+ removeSessionData(session.id)+ }+ else {+ sessions.set(session.id, session)+ trackFailedPulse(session)+ syncToast(session)+ }++ updateAgg()+ }++ function dispose(): void {+ // 统一清理所有 Map 定时器与 Toast(幂等;StrictMode 的「挂载→释放→再挂载」下+ // 第二次释放是空操作,追踪器本身仍可继续接收事件)。+ const clearAllTimers = (map: Map<string, number>) => {+ map.forEach(timer => window.clearTimeout(timer))+ map.clear()+ }+ clearAllTimers(hideTimers)+ clearAllTimers(pulseTimers)+ clearAllTimers(pruneTimers)+ if (aggFlushTimer !== undefined) {+ window.clearTimeout(aggFlushTimer)+ aggFlushTimer = undefined+ }+ hasPendingAgg = false++ toastKeys.forEach(key => toast.close(key))+ toastKeys.clear()+ }++ return { apply, dispose }+}diff --git a/src/pet/hooks/bubble-copy.test.ts b/src/pet/utils/bubble.test.tssimilarity index 99%rename from src/pet/hooks/bubble-copy.test.tsrename to src/pet/utils/bubble.test.tsindex cc326bbe..2e6cf696 100644--- a/src/pet/hooks/bubble-copy.test.ts+++ b/src/pet/utils/bubble.test.ts@@ -5,7 +5,7 @@* 文案、taskCopy 句式(对齐 dsh-dafeiyu:正在/继续、动作动词、默认处理「…」)。*/import { describe, expect, it } from 'vitest'-import { activityCopy, seedNumber, sessionTitle, statusCopy, taskCopy, toolActivityGroup, UNTITLED_SESSION_TITLE } from './bubble-copy'+import { activityCopy, seedNumber, sessionTitle, statusCopy, taskCopy, toolActivityGroup, UNTITLED_SESSION_TITLE } from './bubble'describe('seedNumber', () => {it('numeric strings resolve to the absolute truncated integer', () => {diff --git a/src/pet/hooks/bubble-copy.ts b/src/pet/utils/bubble.tssimilarity index 98%rename from src/pet/hooks/bubble-copy.tsrename to src/pet/utils/bubble.tsindex 7eb4deb4..ea5b6a42 100644--- a/src/pet/hooks/bubble-copy.ts+++ b/src/pet/utils/bubble.ts@@ -8,7 +8,7 @@*//** 桌宠窗口无 i18n 基础设施,就地按窗口语言取单语文案(与 pet.tsx 保留文案一致)。 */-const IS_ZH = (typeof document !== 'undefined' ? document.documentElement.lang || navigator.language : 'zh-CN')+export const IS_ZH = (typeof document !== 'undefined' ? document.documentElement.lang || navigator.language : 'zh-CN').toLowerCase().startsWith('zh')diff --git a/src/store/index.ts b/src/store/index.tsindex 9139e4a8..792a6476 100644--- a/src/store/index.ts+++ b/src/store/index.ts@@ -1,14 +1,26 @@import { desktopUpdater } from './modules/desktop-updater'-import { download } from './modules/download'import { harness } from './modules/harness'import { harnessUpdater } from './modules/harness-updater'+import { preinstall } from './modules/preinstall'+import { recovery } from './modules/recovery'import { setting } from './modules/setting'-/** 全局 store 聚合(参考 damn-reports 的组织方式:模块各自独立,聚合统一出口) */+/**+ * 全局 store 聚合(参考 damn-reports 的组织方式:模块各自独立,聚合统一出口)。+ *+ * 每个 `modules/<name>/` 都是一个自洽的模块,`index.ts` 是该模块唯一的公共出口+ * (store + 类型 + 需要外用的工具函数),模块内部结构(store/types/utils/constants)+ * 不对其它模块暴露。+ *+ * 跨模块协作统一走本聚合对象或兄弟模块的 `index.ts`:例如 `preinstall` 通过+ * `harness.launchAndWait()` 收尾启动、`recovery` 通过 `harness.restart()`+ * 重启服务。组件一律 `import { store } from '@/store'`。+ */export const store = {harness,harnessUpdater,- download,+ preinstall,+ recovery,setting,desktopUpdater,}diff --git a/src/store/modules/desktop-updater/store.ts b/src/store/modules/desktop-updater/store.tsindex f0a76755..d7f23894 100644--- a/src/store/modules/desktop-updater/store.ts+++ b/src/store/modules/desktop-updater/store.ts@@ -19,7 +19,7 @@ let downloadTask: Promise<void> | null = null* 桌面端自更新模块:检查新版本 → 静默下载安装包 → 打开安装器完成升级。** 与 `updater` 模块(dsh 内核更新)区分:本模块针对桌面应用自身。- * 轮询检查低频触发(见 components/desktop-updater),Rust 侧每次实时查询、+ * 轮询检查低频触发(见 `layout/index.tsx` 的 `useIntervalFn`),Rust 侧每次实时查询、* 不做缓存,由低频轮询避免 GitHub 未认证限流。** 交互约定:diff --git a/src/store/modules/download/index.ts b/src/store/modules/download/index.tsdeleted file mode 100644index e7d8de7a..00000000--- a/src/store/modules/download/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { download } from './store'-export type { DownloadFinishedPayload } from './types'diff --git a/src/store/modules/download/store.ts b/src/store/modules/download/store.tsdeleted file mode 100644index 206f68a0..00000000--- a/src/store/modules/download/store.ts+++ /dev/null@@ -1,25 +0,0 @@-import type { DownloadFinishedPayload } from './types'-import { listen } from '@tauri-apps/api/event'-import { defineStore } from 'valtio-define'--/**- * 下载完成提示模块:dsh iframe 内的下载在 WebView2 中是静默保存的- * (用户零感知),由外壳监听 Rust 侧完成事件,弹出"已保存 + 打开文件夹"提示。- */-export const download = defineStore({- state: () => ({- notice: null as DownloadFinishedPayload | null,- }),- actions: {- dismiss() {- this.notice = null- },- },-})--// 模块级监听 Rust 侧下载完成事件(应用生命周期内常驻,无需手动清理)-listen<DownloadFinishedPayload>('harness-download-finished', (e) => {- download.notice = e.payload-}).catch((err) => {- console.error('[Download] failed to listen harness-download-finished:', err)-})diff --git a/src/store/modules/download/types.ts b/src/store/modules/download/types.tsdeleted file mode 100644index 76a80e76..00000000--- a/src/store/modules/download/types.ts+++ /dev/null@@ -1,6 +0,0 @@-/** Rust 侧 on_download 接管下载后 emit 的完成事件载荷 */-export interface DownloadFinishedPayload {- url: string- path: string | null- success: boolean-}diff --git a/src/store/modules/harness/constants.ts b/src/store/modules/harness/constants.tsnew file mode 100644index 00000000..0f1da246--- /dev/null+++ b/src/store/modules/harness/constants.ts@@ -0,0 +1,31 @@+/**+ * 服务生命周期与健康检查的时序常量(毫秒)。+ *+ * 集中一处:启动/插件安装/页面加载各自有「无活动」与「绝对」双上限,+ * 调参时需要在同一屏内对照,散落在 actions 之间极易改漏。+ */++/** iframe 挂载后等待 dsh 页面完成加载的兜底上限 */+export const IFRAME_LOAD_TIMEOUT = 20000++/** 健康探测退避区间(1s 起、1.5 倍递增、封顶 5s) */+export const HEALTH_PROBE_INITIAL_INTERVAL = 1000+export const HEALTH_PROBE_MAX_INTERVAL = 5000++/** 服务启动阶段:无活动 / 绝对上限 */+export const STARTUP_INACTIVITY_TIMEOUT = 180000+export const STARTUP_ABSOLUTE_TIMEOUT = 300000++/** 内置插件自愈阶段:无活动 / 绝对上限 */+export const PLUGIN_INACTIVITY_TIMEOUT = 30000+export const PLUGIN_ABSOLUTE_TIMEOUT = 600000+export const PLUGIN_ACTIVITY_CHECK_INTERVAL = 1000++/** iframe 内官方 boot 页失败后的恢复探测上限(远小于完整启动) */+export const IFRAME_RECOVERY_ABSOLUTE_TIMEOUT = 60000++/** 启动失败时从服务日志尾部挑选的原始行上限(ANSI 清洗后按行截断) */+export const LOG_TAIL_MAX_BYTES = 16 * 1024++/** 进入 ready 后 iframe 连续重载的容忍次数(防抖 + 防死循环) */+export const IFRAME_RELOAD_MAX_ATTEMPTS = 3diff --git a/src/store/modules/harness/index.ts b/src/store/modules/harness/index.tsindex d12a4514..f1cc2b4a 100644--- a/src/store/modules/harness/index.ts+++ b/src/store/modules/harness/index.ts@@ -1,9 +1,12 @@export { harness } from './store'+export { INTERNAL_PLUGIN_PHASE_DETAILS } from './types'export type {+ HarnessProcessExitedPayload,InstallerState,InstallProgress,- PreinstallLogPayload,- PreinstallPlugin,+ InternalPluginPhaseDetail,+ InternalPluginsPhasePayload,SetupStatus,SidebarBusyAction,+ StartupError,} from './types'diff --git a/src/utils/readiness.ts b/src/store/modules/harness/readiness.tssimilarity index 98%rename from src/utils/readiness.tsrename to src/store/modules/harness/readiness.tsindex de5506e7..86537683 100644--- a/src/utils/readiness.ts+++ b/src/store/modules/harness/readiness.ts@@ -1,3 +1,5 @@+import { delay } from '@hairy/utils'+export type StartupPhase = 'plugin-install' | 'process-boot' | 'client-modules'export type ReadinessTimeout = 'inactivity' | 'absolute'@@ -50,10 +52,6 @@ export interface ActivityTaskResult<T> {reason: string}-function delay(milliseconds: number): Promise<void> {- return new Promise(resolve => setTimeout(resolve, milliseconds))-}-function activityKey(result: ReadinessProbeResult): string {return `${result.phase ?? ''}\0${result.reason ?? ''}`}diff --git a/src/utils/runtime-exit.ts b/src/store/modules/harness/runtime.tssimilarity index 100%rename from src/utils/runtime-exit.tsrename to src/store/modules/harness/runtime.tsdiff --git a/src/store/modules/harness/store.ts b/src/store/modules/harness/store.tsindex c079f088..951b7583 100644--- a/src/store/modules/harness/store.ts+++ b/src/store/modules/harness/store.ts@@ -1,52 +1,50 @@-/* eslint-disable no-control-regex */import type { UnlistenFn } from '@tauri-apps/api/event'+import type { StartupPhase } from './readiness'import type {HarnessProcessExitedPayload,InstallerState,InstallProgress,InternalPluginsPhasePayload,- PluginRecoveryInfo,- PreinstallLogPayload,- PreinstallPlugin,- RecoveryState,SetupStatus,SidebarBusyAction,+ StartupError,} from './types'-import type { ReadinessPollResult, ReadinessProbeResult, StartupPhase } from '@/utils/readiness'-import { emitter } from '@hairy/react-lib'import { invoke } from '@tauri-apps/api/core'import { listen } from '@tauri-apps/api/event'import i18next from 'i18next'import { defineStore } from 'valtio-define'import { queryClient } from '@/config/client'-import { internalPluginReason } from '@/utils/internal-plugin-phase'-import { containsInotifyLimitError, pickErrorLines } from '@/utils/log'-import { BoundedReloadGate, pollReadiness, SingleFlight, waitForActivityTask } from '@/utils/readiness'-import { runtimeExitMessageKey, shouldAcceptRuntimeExit } from '@/utils/runtime-exit'+import { hooks } from '@/config/hooks'+import { queryKeys } from '@/config/query-keys'import { harnessUpdater } from '../harness-updater'--const IFRAME_LOAD_TIMEOUT = 20000-const HEALTH_PROBE_INITIAL_INTERVAL = 1000-const HEALTH_PROBE_MAX_INTERVAL = 5000-const STARTUP_INACTIVITY_TIMEOUT = 180000-const STARTUP_ABSOLUTE_TIMEOUT = 300000-const PLUGIN_INACTIVITY_TIMEOUT = 30000-const PLUGIN_ABSOLUTE_TIMEOUT = 600000-const PLUGIN_ACTIVITY_CHECK_INTERVAL = 1000-const IFRAME_RECOVERY_ABSOLUTE_TIMEOUT = 60000-/** 启动失败时从服务日志尾部挑选的原始行上限(ANSI 清洗后按行截断) */-const LOG_TAIL_MAX_BYTES = 16 * 1024--/** 启动失败错误:附带从 dsh 服务日志中读取的真实错误行与可选的冲突提示 */-interface StartupError extends Error {- logs?: string[]- /** 完整清洗后的日志尾(供插件异常定位使用,非仅错误行) */- logLines?: string[]- pluginConflictHint?: string- /** Linux inotify 文件监视上限(ENOSPC)导致服务启动即崩溃时的针对性提示 */- inotifyLimitHint?: string- phase?: StartupPhase- lastReason?: string+import { preinstall } from '../preinstall'+import { recovery } from '../recovery'+import { setting } from '../setting'+import {+ IFRAME_LOAD_TIMEOUT,+ IFRAME_RECOVERY_ABSOLUTE_TIMEOUT,+ IFRAME_RELOAD_MAX_ATTEMPTS,+ PLUGIN_ABSOLUTE_TIMEOUT,+ PLUGIN_ACTIVITY_CHECK_INTERVAL,+ PLUGIN_INACTIVITY_TIMEOUT,+ STARTUP_ABSOLUTE_TIMEOUT,+} from './constants'+import { BoundedReloadGate, SingleFlight, waitForActivityTask } from './readiness'+import { runtimeExitMessageKey, shouldAcceptRuntimeExit } from './runtime'+import {+ attachStartupDiagnostics,+ checkHealthViaProxy,+ generateTimestampedUrl,+ internalPluginReason,+ pollHarnessReadiness,+ startupError,+} from './utils'++/** 启动阶段 → 加载文案 i18n 键(webview 的 Loadable 副标题) */+const STARTUP_STATUS_KEYS: Record<StartupPhase, string> = {+ 'plugin-install': 'status.loading_internal',+ 'process-boot': 'status.loading_process',+ 'client-modules': 'status.loading_client_modules',}const initialInstaller: InstallerState = {@@ -56,13 +54,6 @@ const initialInstaller: InstallerState = {logs: [],}-const initialRecovery: RecoveryState = {- required: false,- info: null,- attempts: 0,- busy: false,-}-/** 启动流程令牌:boot 并发/重复调用时只采纳最后一次的结果 */let bootToken = 0/** 最终健康复核到 ready 提交之间的启动代;退出事件可使该提交失效。 */@@ -72,160 +63,18 @@ let bootStarted = falselet pluginActivitySequence = 0let pluginActivityReason = ''const restartFlight = new SingleFlight<void>()-const iframeReloadGate = new BoundedReloadGate(3)+const iframeReloadGate = new BoundedReloadGate(IFRAME_RELOAD_MAX_ATTEMPTS)let iframeRefreshTimer: ReturnType<typeof setTimeout> | undefined-/**- * 构建带时间戳的 iframe URL,避免 WebView2 缓存旧页面。- * alpha 鉴权由启动前的桌面端 patch 处理,iframe 永远不携带启动 token;旧核心- * 同样继续使用原有的缓存查询参数。- */-function generateTimestampedUrl(baseUrl: string): string {- const timestamp = Date.now()- const separator = baseUrl.includes('?') ? '&' : '?'- return `${baseUrl}${separator}t=${timestamp}`-}--/** 通过 Rust 代理探测服务健康状态(超时 8s,网络抖动时重试) */-async function checkHealthViaProxy(): Promise<ReadinessProbeResult> {- let timeoutId: ReturnType<typeof setTimeout> | undefined- try {- const timeoutPromise = new Promise<never>((_, reject) => {- timeoutId = setTimeout(() => reject(new Error('health check timeout')), 8000)- })- const resultPromise = invoke<string>('proxy_health_check')- const result = await Promise.race([resultPromise, timeoutPromise])-- const lower = result.toLowerCase()- if (lower.startsWith('healthy')) {- console.warn('[Harness] health check passed:', result.split(' - <!doctype html>')[0])- return {- healthy: true,- notOwned: false,- phase: 'client-modules',- reason: result,- }- }- console.warn('[Harness] health check returned:', result)- return {- healthy: false,- notOwned: false,- phase: 'client-modules',- reason: result,- }- }- catch (err) {- const message = String(err)- if (message.includes('HARNESS_NOT_OWNED')) {- // dsh 进程已退出(典型如插件冲突导致启动即崩溃),继续等只会白白耗完- // 当前阶段 deadline,让调用方立刻结束并展示日志里的真实错误。- console.warn('[Harness] dsh process exited during startup, failing fast')- return {- healthy: false,- notOwned: true,- phase: 'process-boot',- reason: message,- }- }- if (message.includes('502') || message.includes('Bad Gateway')) {- console.warn('[Harness] transient 502 during health check, retrying')- }- else {- // 单次探测失败是启动期的常态:服务尚未就绪、boot page 还是 404 等都会走到- // 这里,而轮询会一直重试到该阶段 deadline;真正的失败由 startupError 以- // errors.startup_* 报出。逐次记 ERROR 只会造成「满屏错误但其实启动正常」。- console.warn('[Harness] health check failed, retrying:', err)- }- return {- healthy: false,- notOwned: false,- phase: message.includes('client modules') || message.includes('client plugins')- ? 'client-modules'- : 'process-boot',- reason: message,- }- }- finally {- if (timeoutId !== undefined) {- clearTimeout(timeoutId)- }- }-}--function startupError(phase: StartupPhase, reason: string, kind: 'failed' | 'inactivity' | 'absolute' | 'exited'): StartupError {- const phaseLabel = i18next.t(`startup.phase.${phase}`)- const message = i18next.t(`errors.startup_${kind}`, {- phase: phaseLabel,- reason,- })- const error: StartupError = new Error(message)- error.phase = phase- error.lastReason = reason- return error-}--function pollHarnessReadiness(- absoluteTimeoutMs: number,- shouldContinue: () => boolean,- onProbe?: (result: ReadinessProbeResult) => void,-): Promise<ReadinessPollResult> {- return pollReadiness({- probe: checkHealthViaProxy,- intervalMs: HEALTH_PROBE_INITIAL_INTERVAL,- maxIntervalMs: HEALTH_PROBE_MAX_INTERVAL,- backoffFactor: 1.5,- inactivityTimeoutMs: STARTUP_INACTIVITY_TIMEOUT,- absoluteTimeoutMs,- shouldContinue,- onProbe,- })-}--/** 读取服务日志尾部(去掉 ANSI 转义与空行),启动失败时展示真实错误 */-async function readServiceLogTail(): Promise<string[]> {- try {- const raw = await invoke<string>('read_service_logs', { maxBytes: LOG_TAIL_MAX_BYTES })- return raw- .split(/\r?\n/)- .map(line => line.replace(/\x1B\[[0-9;]*m/g, '').trim())- .filter(Boolean)- }- catch (err) {- console.error('[Harness] failed to read service logs:', err)- return []- }-}--/** 失败时把服务日志的真实错误行与冲突提示挂到错误对象上 */-async function attachStartupDiagnostics(err: unknown): Promise<StartupError> {- // Tauri `invoke` 对 `Result<_, String>` 命令的 rejection 是裸字符串,- // 必须先归一化为 Error 对象,否则在其上赋属性(ESM 严格模式)会抛- // `TypeError: Cannot create property ... on string`,反而遮蔽真实错误。- const startupError: StartupError = err instanceof Error ? err : new Error(String(err))- if (!startupError.logs) {- const lines = await readServiceLogTail()- startupError.logLines = lines- startupError.logs = pickErrorLines(lines)- // 识别插件路由冲突(如 `duplicate prefix route "/sidebar/api"`),给出可操作的提示- if (lines.join('\n').includes('duplicate prefix route')) {- startupError.pluginConflictHint = i18next.t('errors.plugin_route_conflict')- }- // 识别 Linux inotify 文件监视上限(ENOSPC):harness 服务启动即崩溃且用户无法直接解决,- // 需要系统级调高 fs.inotify.max_user_watches(见 errors.inotify_limit 文案)- if (containsInotifyLimitError(lines)) {- startupError.inotifyLimitHint = i18next.t('errors.inotify_limit')- }- }- return startupError as StartupError-}-/*** 桌面外壳核心业务模块:安装/启动流程、服务生命周期(启动/健康检查/重启/停止)、* iframe 加载状态与挂起兜底。** 拆分说明(参考 damn-reports 的 store 组织方式):- * 版本更新与下载完成提示分别收敛到 updater / download 模块,- * 本模块专注服务生命周期与页面加载状态。+ * - 版本更新 → `harness-updater`,下载完成提示 → `download`;+ * - 预装插件引导 → `preinstall`,插件异常修复 → `recovery`;+ * - 无状态的探测/日志/错误装饰 → `utils`,时序常量 → `constants`。+ * 本模块只保留「服务怎么起来、页面怎么挂上」这一条主线。*/export const harness = defineStore({state: () => ({@@ -238,25 +87,6 @@ export const harness = defineStore({pluginConflictHint: '',/** 识别到 Linux inotify 文件监视上限(ENOSPC)时的针对性提示(Loadable children 展示) */inotifyLimitHint: '',- /** 插件异常修复界面状态(启动崩溃/运行期异常 → 弹出「卸除此插件并继续检测」) */- recovery: initialRecovery,- /** 用户已「暂不处理」的插件 id(避免同一运行期异常反复弹窗) */- dismissedRecoveryIds: [] as string[],- /** 预装插件引导状态:列表/安装进度/日志/错误 */- preinstall: {- plugins: [] as PreinstallPlugin[],- loading: false,- installing: false,- /** 用户触发了“取消”但仍需等后端结束进程树 */- cancelling: false,- logs: [] as string[],- /** 安装失败错误(区别于下面列表加载失败) */- error: '',- /** 拉取预装插件列表失败(区别于空列表;UI 据此展示错误态 + 重试) */- loadError: '',- /** 是否为首次安装引导(决定默认勾选策略):boot 流程进入时为 true,侧边栏手动打开为 false */- isFirstTime: true,- },serviceUrl: 'http://127.0.0.1:3080',/** 带时间戳的 iframe 地址(boot 时生成一次,避免缓存) */iframeSrc: '',@@ -269,6 +99,16 @@ export const harness = defineStore({startupReason: '',busyAction: null as SidebarBusyAction,}),+ getters: {+ /** 当前启动阶段对应的加载文案 i18n 键 */+ startupStatusKey(): string {+ return STARTUP_STATUS_KEYS[this.startupPhase]+ },+ /** 服务健康但 iframe 加载失败:页面覆盖层展示重试入口 */+ showIframeError(): boolean {+ return this.serviceHealthy && this.iframeError+ },+ },actions: {/** 首次挂载时自动启动(StrictMode 重复挂载下保证只执行一次) */startup() {@@ -280,7 +120,7 @@ export const harness = defineStore({async initialize() {await Promise.all([- this.listenPluginRecovery(),+ recovery.listen(),this.listenInternalPhase(),this.listenProcessExit(),])@@ -354,7 +194,10 @@ export const harness = defineStore({const error = await attachStartupDiagnostics(new Error(message))if (exitToken !== bootToken)return- await this.reviewStartupRecovery(error.logLines ?? error.logs ?? [], exitToken)+ await recovery.reviewStartupRecovery(+ error.logLines ?? error.logs ?? [],+ () => exitToken === bootToken,+ )if (exitToken !== bootToken)returnthis.fail(@@ -365,21 +208,6 @@ export const harness = defineStore({)},- /**- * 订阅后端「插件异常」推送:`report_plugin_error`(运行期异常)会推送- * `plugin-recovery-required`,据此弹出「卸除此插件并继续检测」修复界面。- */- async listenPluginRecovery() {- try {- await listen<PluginRecoveryInfo>('plugin-recovery-required', (event) => {- this.setRuntimeRecovery(event.payload)- })- }- catch (err) {- console.error('[Harness] failed to listen plugin-recovery-required:', err)- }- },-/*** 订阅后端「内置插件核对阶段」推送:`internal-plugins-phase` 事件* (loading / progress / done),加载屏据此在「Loading internal plugins…」与@@ -484,7 +312,7 @@ export const harness = defineStore({...(detail ? detail.split(/\n/) : []),...(error.logLines ?? error.logs ?? []),]- await this.reviewStartupRecovery(lines)+ await recovery.reviewStartupRecovery(lines)this.fail(error.message,error.logs,@@ -544,10 +372,9 @@ export const harness = defineStore({this.errorLogs = []this.pluginConflictHint = ''this.inotifyLimitHint = ''- this.preinstall.error = ''+ preinstall.error = ''// 服务(重)启动成功:清空插件异常修复态(若曾进入),并重置已「暂不处理」的插件- this.recovery = { required: false, info: null, attempts: 0, busy: false }- this.dismissedRecoveryIds = []+ recovery.reset()iframeReloadGate.reset()if (iframeRefreshTimer !== undefined) {clearTimeout(iframeRefreshTimer)@@ -556,13 +383,12 @@ export const harness = defineStore({// 服务(重)启动成功后,dsh 版本/端口/CLI 链接状态等运行时信息可能已变化// (典型:Harness 更新后旧版本缓存仍在,调试侧边栏需刷新页面才显示新版本)。// 使侧边栏相关查询缓存失效,重新打开/已挂载时自动拉取最新值。- void queryClient.invalidateQueries({ queryKey: ['info'] })- void queryClient.invalidateQueries({ queryKey: ['config'] })- void queryClient.invalidateQueries({ queryKey: ['cli_status'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.info })+ void queryClient.invalidateQueries({ queryKey: queryKeys.cliStatus })// 档案/核心切换后重启:当前档案的插件列表、核心来源状态一并刷新- void queryClient.invalidateQueries({ queryKey: ['plugins'] })- void queryClient.invalidateQueries({ queryKey: ['profiles'] })- void queryClient.invalidateQueries({ queryKey: ['cores'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })+ void queryClient.invalidateQueries({ queryKey: queryKeys.profiles })+ void queryClient.invalidateQueries({ queryKey: queryKeys.cores })return true},@@ -574,8 +400,7 @@ export const harness = defineStore({this.errorLogs = []this.pluginConflictHint = ''this.inotifyLimitHint = ''- this.recovery = initialRecovery- this.dismissedRecoveryIds = []+ recovery.reset()this.serviceHealthy = falsethis.iframeLoaded = falsethis.iframeError = false@@ -655,7 +480,7 @@ export const harness = defineStore({this.errorLogs = []this.pluginConflictHint = ''this.inotifyLimitHint = ''- this.recovery = { required: false, info: null, attempts: this.recovery.attempts, busy: false }+ recovery.clear()this.status = 'ready'let unlistenInstall: UnlistenFn | null = null@@ -673,9 +498,12 @@ export const harness = defineStore({this.iframeSrc = generateTimestampedUrl(runtimeInfo.service_url)// 已安装过则跳过安装界面,避免每次启动都闪现"正在安装依赖..."- const config = await invoke<{- installed: boolean- }>('get_app_config')+ // 设置由 setting store 持有(与 Rust 共享同一份 .store.dat)。必须先等水合+ // 完成再读,否则会把默认值当成真实安装状态:多跑一次安装,还漏掉更新检查。+ await setting.$persist.rehydrate()+ // 取快照:后面的 `install_dependencies` 会把 installed 置位并广播,+ // 而本次 boot 的判断应当基于「启动开始时是否已安装」+ const config = { ...setting.$state }// 每次启动都做纯本地运行时检查:旧版本升级后 installed 仍为 true,但新版// 可能新增依赖(如 Windows 空白环境需要的 MinGit),必须进入幂等自愈。@@ -735,8 +563,8 @@ export const harness = defineStore({// 由 Rust 侧记录内容指纹到 app-data(.store.dat),启动时比对是否有变更。if (await invoke<boolean>('get_preinstall_pending')) {this.status = 'preinstall'- this.preinstall.isFirstTime = true- await this.loadPreinstallPlugins()+ preinstall.isFirstTime = true+ await preinstall.load()return}@@ -753,14 +581,14 @@ export const harness = defineStore({if (token !== bootToken)returnconsole.error('[Harness] startup failed:', err)- const startupError = await attachStartupDiagnostics(err)+ const error = await attachStartupDiagnostics(err)// 尝试从日志定位问题插件:能定位则弹出修复界面(全屏恢复页)- await this.reviewStartupRecovery(startupError.logLines ?? startupError.logs ?? [])+ await recovery.reviewStartupRecovery(error.logLines ?? error.logs ?? [])this.fail(- startupError.message,- startupError.logs,- startupError.pluginConflictHint,- startupError.inotifyLimitHint,+ error.message,+ error.logs,+ error.pluginConflictHint,+ error.inotifyLimitHint,this.serviceRunning,)}@@ -775,7 +603,7 @@ export const harness = defineStore({this.installer = { ...initialInstaller, title }},- /** 进入错误态(供本模块与 updater 模块共用) */+ /** 进入错误态(供本模块与 harness-updater 模块共用) */fail(message: string, logs?: string[], pluginConflictHint?: string, inotifyLimitHint?: string, keepServiceRunning = false) {this.errorMsg = messagethis.errorLogs = logs ?? []@@ -785,103 +613,6 @@ export const harness = defineStore({this.serviceRunning = keepServiceRunning},- /**- * 启动失败时尝试定位问题插件并弹出修复界面。- * 能定位到具体插件 → 设置 `recovery`;定位不到则保持普通错误态(无插件可卸载)。- */- async reviewStartupRecovery(logs: string[], token?: number) {- if (this.recovery.required || logs.length === 0)- return- try {- const info = await invoke<PluginRecoveryInfo>('detect_plugin_recovery', { logs })- if (token !== undefined && token !== bootToken)- return- if (info.plugins.length > 0) {- this.recovery = {- required: true,- info,- attempts: this.recovery.attempts + 1,- busy: false,- }- }- }- catch (err) {- console.error('[Harness] detect_plugin_recovery failed:', err)- }- },-- /** 运行期插件异常:弹出修复对话框(应用仍在运行)。已「暂不处理」的同插件不再重复弹。 */- setRuntimeRecovery(info: PluginRecoveryInfo) {- if (info.plugins.length === 0)- return- if (info.plugins.some(id => this.dismissedRecoveryIds.includes(id)))- return- this.recovery = {- required: true,- info,- attempts: this.recovery.attempts + 1,- busy: false,- }- },-- /** 「卸除此插件并继续检测」:离线卸载定位到的插件 → 重启并重新检测;仍有问题会再次触发修复界面。 */- async recoverAndRedetect(ids: readonly string[]) {- if (this.recovery.busy || ids.length === 0)- return- this.recovery = { ...this.recovery, busy: true }- try {- for (const id of ids) {- await invoke('recover_plugin', { id })- }- // 卸载成功:清空恢复态回到启动/就绪;若仍失败,boot 的 catch 会再次定位并弹出。- // 保留 attempts:连续失败会累加,达到上限后界面提示「查看日志 / 手动卸载」。- this.dismissedRecoveryIds = this.dismissedRecoveryIds.filter(x => !ids.includes(x))- this.recovery = { required: false, info: null, attempts: this.recovery.attempts, busy: false }- await this.restart()- }- catch (err) {- console.error('[Harness] recover_plugin failed:', err)- this.recovery = { ...this.recovery, busy: false, attempts: this.recovery.attempts + 1 }- }- },-- /**- * 从快照还原并继续检测:优先用单插件快照还原问题插件(优先级高于卸载);- * 仅对传入的(确有快照的)插件还原,单项失败不阻断其它项。还原成功后重启并重新检测。- */- async restoreAndRedetect(ids: readonly string[]) {- if (this.recovery.busy || ids.length === 0)- return- this.recovery = { ...this.recovery, busy: true }- try {- // 逐项还原,单项失败仅记录告警、不中断整体流程(无快照项由调用方过滤)- for (const id of ids) {- try {- await invoke('restore_plugin', { id })- }- catch (err) {- console.error(`[Harness] restore_plugin failed for ${id}:`, err)- }- }- this.recovery = { required: false, info: null, attempts: this.recovery.attempts, busy: false }- await this.restart()- }- catch (err) {- console.error('[Harness] restoreAndRedetect failed:', err)- this.recovery = { ...this.recovery, busy: false, attempts: this.recovery.attempts + 1 }- }- },-- /** 「暂不处理」:关闭修复界面并记住这些插件(运行期场景不阻断使用)。 */- dismissRecovery() {- if (this.recovery.info) {- this.dismissedRecoveryIds = [- ...new Set([...this.dismissedRecoveryIds, ...this.recovery.info.plugins]),- ]- }- this.recovery = { required: false, info: null, attempts: 0, busy: false }- },-/** 重启服务:先强杀再拉起,最终回到就绪/错误态 */restart(): Promise<void> {return restartFlight.run(async () => {@@ -895,9 +626,9 @@ export const harness = defineStore({this.iframeError = false// 手动重启(含修复界面上的「重启 Harness」):先退出恢复态,// 若重启仍失败,boot 的 catch 会重新定位问题插件并再次弹出。- this.recovery = { ...this.recovery, required: false, busy: false }+ recovery.hide()try {- emitter.emit('config:dialog:hidden')+ void hooks['config.dialog.hidden'].trigger()await invoke('shutdown_harness')}catch (err) {@@ -939,7 +670,7 @@ export const harness = defineStore({returnthis.busyAction = 'shutdown'// 停止服务后应用回到「已停止」态,配置弹窗已无意义,与 restart 一致地关闭它- emitter.emit('config:dialog:hidden')+ void hooks['config.dialog.hidden'].trigger()try {await invoke('shutdown_harness')}@@ -955,8 +686,7 @@ export const harness = defineStore({this.errorLogs = []this.pluginConflictHint = ''this.inotifyLimitHint = ''- this.recovery = initialRecovery- this.dismissedRecoveryIds = []+ recovery.reset()},/** 服务未运行时点击"重试":重新拉起服务并等待健康检查 */@@ -987,137 +717,6 @@ export const harness = defineStore({this.busyAction = null}},-- /** 拉取预装插件列表(含已安装检测),供首次启动引导界面渲染 */- async loadPreinstallPlugins(): Promise<PreinstallPlugin[]> {- if (this.preinstall.loading)- return this.preinstall.plugins- this.preinstall.loading = true- try {- this.preinstall.plugins = await invoke<PreinstallPlugin[]>('get_preinstall_plugins')- // 成功加载后清除历史加载错误,避免残留错误态遮蔽新列表- this.preinstall.loadError = ''- }- catch (err) {- console.error('[Harness] failed to load preinstall plugins:', err)- // 记录错误而非伪装空列表:UI 据此展示错误态与重试按钮- this.preinstall.loadError = String(err)- }- finally {- this.preinstall.loading = false- }- return this.preinstall.plugins- },-- /** 预装安装日志流:dsh plugin 进程输出逐行追加 */- async listenPreinstallLog(): Promise<UnlistenFn> {- return listen<PreinstallLogPayload>('preinstall-log', (e) => {- this.preinstall.logs = [...this.preinstall.logs, e.payload.line].slice(-200)- })- },-- /**- * 确认安装/卸载预装插件:流式日志,完成后继续启动服务。- *- * 前端传入 diff 结果(installIds = 新增勾选需安装;uninstallIds = 取消勾选需卸载),- * 无变化时两者均为空,后端直接标记完成。- */- async confirmPreinstall(input: { installIds?: string[], uninstallIds?: string[] } | string[]) {- // 兼容旧调用方(直接传数组)与新调用方(传 {installIds, uninstallIds})- const installIds = Array.isArray(input) ? input : (input.installIds ?? [])- const uninstallIds = Array.isArray(input) ? [] : (input.uninstallIds ?? [])- if (this.preinstall.installing || (installIds.length === 0 && uninstallIds.length === 0))- return- this.preinstall.installing = true- this.preinstall.error = ''- this.preinstall.logs = []- let unlisten: UnlistenFn | null = null- try {- unlisten = await this.listenPreinstallLog()- await invoke('install_preinstall_plugins', { installIds, uninstallIds })- // 后端装完已把服务停掉,这里在日志面板讲清接下来的重启(issue #48),- // 避免用户把"插件安装后的自动重启"误认为崩溃/故障。- this.preinstall.logs = [...this.preinstall.logs, i18next.t('preinstall.restarting_hint')].slice(-200)- await this.continueAfterPreinstall()- }- catch (err) {- console.error('[Harness] preinstall failed:', err)- const error = String(err)- this.preinstall.error = error.startsWith('NETWORK_ERROR:')- ? i18next.t('preinstall.network_error')- : error- }- finally {- unlisten?.()- this.preinstall.installing = false- this.preinstall.cancelling = false- }- },-- /**- * 取消正在进行的预装插件安装:网络抖动/拉包限流(429)时可能长时间卡在- * pnpm 重试;调用后端强杀插件安装进程树,回到可重试的选择态。- */- async cancelPreinstall() {- if (!this.preinstall.installing || this.preinstall.cancelling)- return- // 后端结束进程树导致 `install_preinstall_plugins` 提前返回并进入 catch,- // 通过 installing=false 让其回到列表态而不是报错态。- this.preinstall.cancelling = true- // 一次性监听:先挂事件(拿到注销函数再 invoke),finally 里注销,- // 避免每次取消都永久注册一个 `preinstall-cancelled` 监听(泄漏)。- let unlisten: (() => void) | undefined- try {- unlisten = await listen<unknown>('preinstall-cancelled', () => {- this.preinstall.installing = false- this.preinstall.cancelling = false- })- await invoke('cancel_preinstall_plugins')- }- catch (err) {- console.error('[Harness] cancel preinstall failed:', err)- this.preinstall.cancelling = false- }- finally {- unlisten?.()- }- },-- /** 跳过预装插件引导:记录状态后继续启动服务 */- async skipPreinstall() {- if (this.preinstall.installing)- return- try {- await invoke('skip_preinstall_plugins')- await this.continueAfterPreinstall()- }- catch (err) {- console.error('[Harness] skip preinstall failed:', err)- this.preinstall.error = String(err)- }- },-- /** 预装引导结束后的收尾:拉起服务等待就绪,并静默检查更新 */- async continueAfterPreinstall() {- await this.launchAndWait()- void harnessUpdater.checkForUpdate()- },-- /**- * 从侧边栏重新打开预装插件引导:可重新选择/安装推荐插件。- * 关闭引导(确定/跳过)后回到正常启动流程,服务若在运行则保持原状态。- */- async openPreinstall() {- if (this.preinstall.installing)- return- emitter.emit('config:dialog:hidden')- this.preinstall.error = ''- this.preinstall.logs = []- // 侧边栏手动打开:非首次安装,默认勾选策略为「仅已安装」- this.preinstall.isFirstTime = false- this.status = 'preinstall'- await this.loadPreinstallPlugins()- },},})diff --git a/src/store/modules/harness/types.ts b/src/store/modules/harness/types.tsindex 765391a9..a5f3c145 100644--- a/src/store/modules/harness/types.ts+++ b/src/store/modules/harness/types.ts@@ -1,3 +1,5 @@+import type { StartupPhase } from './readiness'+/** 安装/启动流程阶段状态 */export type SetupStatus = 'checking' | 'installing' | 'starting' | 'preinstall' | 'ready' | 'error'@@ -10,25 +12,6 @@ export interface HarnessProcessExitedPayload {exitCode: number | null}-/** 预装插件列表项(与 Rust service::plugin::PreinstallPlugin 对齐) */-export interface PreinstallPlugin {- id: string- name: string- description: string- repo_url: string- recommended: boolean- /** “修复”类项(Windows 极简模式修复):黄色 chip,默认勾选 */- fix: boolean- /** 无 chip 但默认勾选(首次引导直接勾上,不标「推荐」) */- defaultChecked: boolean- installed: boolean-}--/** Rust 侧 preinstall-log 事件载荷(dsh plugin 进程输出行) */-export interface PreinstallLogPayload {- line: string-}-/** Rust 侧 internal-plugins-phase 事件载荷(内置插件核对/安装进度与 heartbeat) */export const INTERNAL_PLUGIN_PHASE_DETAILS = ['waiting',@@ -67,26 +50,17 @@ export interface InstallProgress {progress: number}-/** Rust 侧 service::plugin::recovery::PluginRecoveryInfo 的序列化形态(camelCase) */-export interface PluginRecoveryInfo {- /** 定位到的问题插件(npm 包名);未定位到时为空 */- plugins: string[]- /** 失败原因判别键:duplicate_route / duplicate_loader_entry / cannot_resolve_bundle / no_dsh_bundle / slot_conflict / load_failed / runtime / unknown */- reason: string- /** 动态详情(冲突路由 / 槽位 / 服务组件 id),用于 I18n 插值 */- detail: string- /** 原始错误信息(技术详情查看) */- raw_error: string-}--/** 插件异常修复界面状态 */-export interface RecoveryState {- /** 是否弹出修复界面 */- required: boolean- /** 定位到的恢复信息 */- info: PluginRecoveryInfo | null- /** 已触发修复的次数(用于防死循环) */- attempts: number- /** 修复动作进行中 */- busy: boolean+/**+ * 启动失败错误:附带从 dsh 服务日志中读取的真实错误行与可选的冲突提示。+ * 由 `utils.startupError` 构造,`utils.attachStartupDiagnostics` 补齐诊断字段。+ */+export interface StartupError extends Error {+ logs?: string[]+ /** 完整清洗后的日志尾(供插件异常定位使用,非仅错误行) */+ logLines?: string[]+ pluginConflictHint?: string+ /** Linux inotify 文件监视上限(ENOSPC)导致服务启动即崩溃时的针对性提示 */+ inotifyLimitHint?: string+ phase?: StartupPhase+ lastReason?: string}diff --git a/src/store/modules/harness/utils.ts b/src/store/modules/harness/utils.tsnew file mode 100644index 00000000..3cc94b42--- /dev/null+++ b/src/store/modules/harness/utils.ts@@ -0,0 +1,203 @@+/* eslint-disable no-control-regex */+import type { ReadinessPollResult, ReadinessProbeResult, StartupPhase } from './readiness'+import type { InternalPluginsPhasePayload, StartupError } from './types'+import { invoke } from '@tauri-apps/api/core'+import i18next from 'i18next'+import { containsInotifyLimitError, pickErrorLines } from '@/components/logs.utils'+import {+ HEALTH_PROBE_INITIAL_INTERVAL,+ HEALTH_PROBE_MAX_INTERVAL,+ LOG_TAIL_MAX_BYTES,+ STARTUP_INACTIVITY_TIMEOUT,+} from './constants'+import { pollReadiness } from './readiness'++/**+ * 服务生命周期的无状态辅助函数:URL 生成、健康探测、日志读取、错误装饰。+ *+ * 全部与 store 实例无关(不读 `this`、不写状态),因此从 store 中抽出,+ * 便于单独推理与复用;store 只保留编排逻辑。+ */++/**+ * 构建带时间戳的 iframe URL,避免 WebView2 缓存旧页面。+ * alpha 鉴权由启动前的桌面端 patch 处理,iframe 永远不携带启动 token;旧核心+ * 同样继续使用原有的缓存查询参数。+ */+export function generateTimestampedUrl(baseUrl: string): string {+ const timestamp = Date.now()+ const separator = baseUrl.includes('?') ? '&' : '?'+ return `${baseUrl}${separator}t=${timestamp}`+}++/** 通过 Rust 代理探测服务健康状态(超时 8s,网络抖动时重试) */+export async function checkHealthViaProxy(): Promise<ReadinessProbeResult> {+ let timeoutId: ReturnType<typeof setTimeout> | undefined+ try {+ const timeoutPromise = new Promise<never>((_, reject) => {+ timeoutId = setTimeout(() => reject(new Error('health check timeout')), 8000)+ })+ const resultPromise = invoke<string>('proxy_health_check')+ const result = await Promise.race([resultPromise, timeoutPromise])++ const lower = result.toLowerCase()+ if (lower.startsWith('healthy')) {+ console.warn('[Harness] health check passed:', result.split(' - <!doctype html>')[0])+ return {+ healthy: true,+ notOwned: false,+ phase: 'client-modules',+ reason: result,+ }+ }+ console.warn('[Harness] health check returned:', result)+ return {+ healthy: false,+ notOwned: false,+ phase: 'client-modules',+ reason: result,+ }+ }+ catch (err) {+ const message = String(err)+ if (message.includes('HARNESS_NOT_OWNED')) {+ // dsh 进程已退出(典型如插件冲突导致启动即崩溃),继续等只会白白耗完+ // 当前阶段 deadline,让调用方立刻结束并展示日志里的真实错误。+ console.warn('[Harness] dsh process exited during startup, failing fast')+ return {+ healthy: false,+ notOwned: true,+ phase: 'process-boot',+ reason: message,+ }+ }+ if (message.includes('502') || message.includes('Bad Gateway')) {+ console.warn('[Harness] transient 502 during health check, retrying')+ }+ else {+ // 单次探测失败是启动期的常态:服务尚未就绪、boot page 还是 404 等都会走到+ // 这里,而轮询会一直重试到该阶段 deadline;真正的失败由 startupError 以+ // errors.startup_* 报出。逐次记 ERROR 只会造成「满屏错误但其实启动正常」。+ console.warn('[Harness] health check failed, retrying:', err)+ }+ return {+ healthy: false,+ notOwned: false,+ phase: message.includes('client modules') || message.includes('client plugins')+ ? 'client-modules'+ : 'process-boot',+ reason: message,+ }+ }+ finally {+ if (timeoutId !== undefined) {+ clearTimeout(timeoutId)+ }+ }+}++/** 按阶段 + 失败类型构造可展示的启动错误 */+export function startupError(+ phase: StartupPhase,+ reason: string,+ kind: 'failed' | 'inactivity' | 'absolute' | 'exited',+): StartupError {+ const phaseLabel = i18next.t(`startup.phase.${phase}`)+ const message = i18next.t(`errors.startup_${kind}`, {+ phase: phaseLabel,+ reason,+ })+ const error: StartupError = new Error(message)+ error.phase = phase+ error.lastReason = reason+ return error+}++/** 带退避的服务就绪轮询(探测实现固定为 Rust 代理健康检查) */+export function pollHarnessReadiness(+ absoluteTimeoutMs: number,+ shouldContinue: () => boolean,+ onProbe?: (result: ReadinessProbeResult) => void,+): Promise<ReadinessPollResult> {+ return pollReadiness({+ probe: checkHealthViaProxy,+ intervalMs: HEALTH_PROBE_INITIAL_INTERVAL,+ maxIntervalMs: HEALTH_PROBE_MAX_INTERVAL,+ backoffFactor: 1.5,+ inactivityTimeoutMs: STARTUP_INACTIVITY_TIMEOUT,+ absoluteTimeoutMs,+ shouldContinue,+ onProbe,+ })+}++/** 读取服务日志尾部(去掉 ANSI 转义与空行),启动失败时展示真实错误 */+export async function readServiceLogTail(): Promise<string[]> {+ try {+ const raw = await invoke<string>('read_service_logs', { maxBytes: LOG_TAIL_MAX_BYTES })+ return raw+ .split(/\r?\n/)+ .map(line => line.replace(/\x1B\[[0-9;]*m/g, '').trim())+ .filter(Boolean)+ }+ catch (err) {+ console.error('[Harness] failed to read service logs:', err)+ return []+ }+}++/** 失败时把服务日志的真实错误行与冲突提示挂到错误对象上 */+export async function attachStartupDiagnostics(err: unknown): Promise<StartupError> {+ // Tauri `invoke` 对 `Result<_, String>` 命令的 rejection 是裸字符串,+ // 必须先归一化为 Error 对象,否则在其上赋属性(ESM 严格模式)会抛+ // `TypeError: Cannot create property ... on string`,反而遮蔽真实错误。+ const diagnosed: StartupError = err instanceof Error ? err : new Error(String(err))+ if (!diagnosed.logs) {+ const lines = await readServiceLogTail()+ diagnosed.logLines = lines+ diagnosed.logs = pickErrorLines(lines)+ // 识别插件路由冲突(如 `duplicate prefix route "/sidebar/api"`),给出可操作的提示+ if (lines.join('\n').includes('duplicate prefix route')) {+ diagnosed.pluginConflictHint = i18next.t('errors.plugin_route_conflict')+ }+ // 识别 Linux inotify 文件监视上限(ENOSPC):harness 服务启动即崩溃且用户无法直接解决,+ // 需要系统级调高 fs.inotify.max_user_watches(见 errors.inotify_limit 文案)+ if (containsInotifyLimitError(lines)) {+ diagnosed.inotifyLimitHint = i18next.t('errors.inotify_limit')+ }+ }+ return diagnosed+}++export type InternalPluginPhaseTranslate = (+ key: string,+ options?: Record<string, number>,+) => string++/**+ * 内部插件装载阶段 → 展示文案(`internal-plugins-phase` 事件驱动)。+ *+ * `heartbeat` 只是「仍在进行」的心跳,不改变文案,原样返回上一句,避免文案反复闪烁。+ */+export function internalPluginReason(+ payload: InternalPluginsPhasePayload,+ previousReason: string,+ translate: InternalPluginPhaseTranslate,+): string {+ switch (payload.detail) {+ case 'waiting':+ return translate('status.internal_waiting')+ case 'checking':+ return translate('status.internal_checking', { total: payload.total })+ case 'installing':+ return translate('status.internal_installing', { total: payload.total })+ case 'heartbeat':+ return previousReason+ case 'done':+ return translate('status.internal_done', { total: payload.total })+ case 'timeout':+ return translate('status.internal_timeout')+ case 'cancelled':+ return translate('status.internal_cancelled')+ }+}diff --git a/src/store/modules/preinstall/index.ts b/src/store/modules/preinstall/index.tsnew file mode 100644index 00000000..a3086578--- /dev/null+++ b/src/store/modules/preinstall/index.ts@@ -0,0 +1,6 @@+export { preinstall } from './store'+export type {+ PreinstallLogPayload,+ PreinstallPlugin,+ PreinstallSelection,+} from './types'diff --git a/src/store/modules/preinstall/store.ts b/src/store/modules/preinstall/store.tsnew file mode 100644index 00000000..f572d8ce--- /dev/null+++ b/src/store/modules/preinstall/store.ts@@ -0,0 +1,169 @@+import type { UnlistenFn } from '@tauri-apps/api/event'+import type { PreinstallLogPayload, PreinstallPlugin, PreinstallSelection } from './types'+import { invoke } from '@tauri-apps/api/core'+import { listen } from '@tauri-apps/api/event'+import i18next from 'i18next'+import { defineStore } from 'valtio-define'+import { hooks } from '@/config/hooks'+import { harness } from '../harness'+import { harnessUpdater } from '../harness-updater'++/** 预装安装日志在界面上的保留行数 */+const LOG_LIMIT = 200++/**+ * 预装插件引导模块:首次安装、老版本升级或 preset-plugins.json 内容变更后,+ * 展示推荐插件列表(可增选/减选),确认或跳过后继续启动服务。+ *+ * 与 harness 模块的分工:本模块只负责「引导页的选择与安装」,+ * 收尾(拉起服务、检查更新)通过 harness / harnessUpdater 完成。+ */+export const preinstall = defineStore({+ state: () => ({+ /** 推荐插件列表(含已安装检测) */+ plugins: [] as PreinstallPlugin[],+ loading: false,+ installing: false,+ /** 用户触发了“取消”但仍需等后端结束进程树 */+ cancelling: false,+ logs: [] as string[],+ /** 安装失败错误(区别于下面列表加载失败) */+ error: '',+ /** 拉取预装插件列表失败(区别于空列表;UI 据此展示错误态 + 重试) */+ loadError: '',+ /** 是否为首次安装引导(决定默认勾选策略):boot 流程进入时为 true,侧边栏手动打开为 false */+ isFirstTime: true,+ }),+ actions: {+ /** 拉取预装插件列表(含已安装检测),供首次启动引导界面渲染 */+ async load(): Promise<PreinstallPlugin[]> {+ if (this.loading)+ return this.plugins+ this.loading = true+ try {+ this.plugins = await invoke<PreinstallPlugin[]>('get_preinstall_plugins')+ // 成功加载后清除历史加载错误,避免残留错误态遮蔽新列表+ this.loadError = ''+ }+ catch (err) {+ console.error('[Harness] failed to load preinstall plugins:', err)+ // 记录错误而非伪装空列表:UI 据此展示错误态与重试按钮+ this.loadError = String(err)+ }+ finally {+ this.loading = false+ }+ return this.plugins+ },++ /** 预装安装日志流:dsh plugin 进程输出逐行追加 */+ async listenLog(): Promise<UnlistenFn> {+ return listen<PreinstallLogPayload>('preinstall-log', (e) => {+ this.logs = [...this.logs, e.payload.line].slice(-LOG_LIMIT)+ })+ },++ /**+ * 确认安装/卸载预装插件:流式日志,完成后继续启动服务。+ *+ * 前端传入 diff 结果(installIds = 新增勾选需安装;uninstallIds = 取消勾选需卸载),+ * 无变化时两者均为空,后端直接标记完成。+ */+ async confirm(input: PreinstallSelection | string[]) {+ // 兼容旧调用方(直接传数组)与新调用方(传 {installIds, uninstallIds})+ const installIds = Array.isArray(input) ? input : (input.installIds ?? [])+ const uninstallIds = Array.isArray(input) ? [] : (input.uninstallIds ?? [])+ if (this.installing || (installIds.length === 0 && uninstallIds.length === 0))+ return+ this.installing = true+ this.error = ''+ this.logs = []+ let unlisten: UnlistenFn | null = null+ try {+ unlisten = await this.listenLog()+ await invoke('install_preinstall_plugins', { installIds, uninstallIds })+ // 后端装完已把服务停掉,这里在日志面板讲清接下来的重启(issue #48),+ // 避免用户把"插件安装后的自动重启"误认为崩溃/故障。+ this.logs = [...this.logs, i18next.t('preinstall.restarting_hint')].slice(-LOG_LIMIT)+ await this.continueStartup()+ }+ catch (err) {+ console.error('[Harness] preinstall failed:', err)+ const error = String(err)+ this.error = error.startsWith('NETWORK_ERROR:')+ ? i18next.t('preinstall.network_error')+ : error+ }+ finally {+ unlisten?.()+ this.installing = false+ this.cancelling = false+ }+ },++ /**+ * 取消正在进行的预装插件安装:网络抖动/拉包限流(429)时可能长时间卡在+ * pnpm 重试;调用后端强杀插件安装进程树,回到可重试的选择态。+ */+ async cancel() {+ if (!this.installing || this.cancelling)+ return+ // 后端结束进程树导致 `install_preinstall_plugins` 提前返回并进入 catch,+ // 通过 installing=false 让其回到列表态而不是报错态。+ this.cancelling = true+ // 一次性监听:先挂事件(拿到注销函数再 invoke),finally 里注销,+ // 避免每次取消都永久注册一个 `preinstall-cancelled` 监听(泄漏)。+ let unlisten: (() => void) | undefined+ try {+ unlisten = await listen<unknown>('preinstall-cancelled', () => {+ this.installing = false+ this.cancelling = false+ })+ await invoke('cancel_preinstall_plugins')+ }+ catch (err) {+ console.error('[Harness] cancel preinstall failed:', err)+ this.cancelling = false+ }+ finally {+ unlisten?.()+ }+ },++ /** 跳过预装插件引导:记录状态后继续启动服务 */+ async skip() {+ if (this.installing)+ return+ try {+ await invoke('skip_preinstall_plugins')+ await this.continueStartup()+ }+ catch (err) {+ console.error('[Harness] skip preinstall failed:', err)+ this.error = String(err)+ }+ },++ /** 预装引导结束后的收尾:拉起服务等待就绪,并静默检查更新 */+ async continueStartup() {+ await harness.launchAndWait()+ void harnessUpdater.checkForUpdate()+ },++ /**+ * 从侧边栏重新打开预装插件引导:可重新选择/安装推荐插件。+ * 关闭引导(确定/跳过)后回到正常启动流程,服务若在运行则保持原状态。+ */+ async open() {+ if (this.installing)+ return+ void hooks['config.dialog.hidden'].trigger()+ this.error = ''+ this.logs = []+ // 侧边栏手动打开:非首次安装,默认勾选策略为「仅已安装」+ this.isFirstTime = false+ harness.status = 'preinstall'+ await this.load()+ },+ },+})diff --git a/src/store/modules/preinstall/types.ts b/src/store/modules/preinstall/types.tsnew file mode 100644index 00000000..5f212e24--- /dev/null+++ b/src/store/modules/preinstall/types.ts@@ -0,0 +1,24 @@+/** 预装插件列表项(与 Rust service::plugin::PreinstallPlugin 对齐) */+export interface PreinstallPlugin {+ id: string+ name: string+ description: string+ repo_url: string+ recommended: boolean+ /** “修复”类项(Windows 极简模式修复):黄色 chip,默认勾选 */+ fix: boolean+ /** 无 chip 但默认勾选(首次引导直接勾上,不标「推荐」) */+ defaultChecked: boolean+ installed: boolean+}++/** Rust 侧 preinstall-log 事件载荷(dsh plugin 进程输出行) */+export interface PreinstallLogPayload {+ line: string+}++/** 预装插件的安装/卸载 diff(前端比对勾选结果得出) */+export interface PreinstallSelection {+ installIds?: string[]+ uninstallIds?: string[]+}diff --git a/src/store/modules/recovery/index.ts b/src/store/modules/recovery/index.tsnew file mode 100644index 00000000..ac2202fe--- /dev/null+++ b/src/store/modules/recovery/index.ts@@ -0,0 +1,3 @@+export { recovery } from './store'+export type { PluginRecoveryInfo, RecoveryState } from './types'+export { MAX_RECOVERY_ATTEMPTS } from './types'diff --git a/src/store/modules/recovery/store.ts b/src/store/modules/recovery/store.tsnew file mode 100644index 00000000..ffb6b318--- /dev/null+++ b/src/store/modules/recovery/store.ts@@ -0,0 +1,159 @@+import type { PluginRecoveryInfo } from './types'+import { invoke } from '@tauri-apps/api/core'+import { listen } from '@tauri-apps/api/event'+import { defineStore } from 'valtio-define'+import { harness } from '../harness'+import { MAX_RECOVERY_ATTEMPTS } from './types'+import { createRecovery } from './utils'++/**+ * 插件异常修复模块:启动崩溃或运行期异常时定位问题插件,并提供+ * 「从快照还原 / 卸除此插件并继续检测 / 重启 / 安全模式 / 暂不处理」。+ *+ * 与 harness 模块的分工:harness 负责服务生命周期,本模块只负责+ * 「哪个插件坏了、怎么修」——修复动作完成后统一回调 harness 重启。+ */+export const recovery = defineStore({+ state: () => ({+ /** 插件异常修复界面状态(启动崩溃/运行期异常 → 弹出「卸除此插件并继续检测」) */+ recovery: createRecovery(),+ /** 用户已「暂不处理」的插件 id(避免同一运行期异常反复弹窗) */+ dismissedRecoveryIds: [] as string[],+ }),+ getters: {+ /** 连续修复失败达到上限:界面转为「查看日志 / 手动卸载」提示 */+ exhausted(): boolean {+ return this.recovery.attempts >= MAX_RECOVERY_ATTEMPTS+ },+ },+ actions: {+ /**+ * 订阅后端「插件异常」推送:`report_plugin_error`(运行期异常)会推送+ * `plugin-recovery-required`,据此弹出「卸除此插件并继续检测」修复界面。+ */+ async listen() {+ try {+ await listen<PluginRecoveryInfo>('plugin-recovery-required', (event) => {+ this.setRuntimeRecovery(event.payload)+ })+ }+ catch (err) {+ console.error('[Harness] failed to listen plugin-recovery-required:', err)+ }+ },++ /** 运行期插件异常:弹出修复对话框(应用仍在运行)。已「暂不处理」的同插件不再重复弹。 */+ setRuntimeRecovery(info: PluginRecoveryInfo) {+ if (info.plugins.length === 0)+ return+ if (info.plugins.some(id => this.dismissedRecoveryIds.includes(id)))+ return+ this.recovery = { required: true, info, attempts: this.recovery.attempts + 1, busy: false }+ },++ /**+ * 启动失败时尝试定位问题插件并弹出修复界面。+ * 能定位到具体插件 → 设置 `recovery`;定位不到则保持普通错误态(无插件可卸载)。+ *+ * `shouldCommit` 由调用方注入(例如「本次启动是否仍是最新一代」的场景守卫):+ * 定位是异步的,期间可能已发生重启/退出,守卫返回 false 时丢弃结果。+ */+ async reviewStartupRecovery(logs: string[], shouldCommit?: () => boolean) {+ if (this.recovery.required || logs.length === 0)+ return+ try {+ const info = await invoke<PluginRecoveryInfo>('detect_plugin_recovery', { logs })+ if (shouldCommit && !shouldCommit())+ return+ if (info.plugins.length > 0) {+ this.recovery = {+ required: true,+ info,+ attempts: this.recovery.attempts + 1,+ busy: false,+ }+ }+ }+ catch (err) {+ console.error('[Harness] detect_plugin_recovery failed:', err)+ }+ },++ /** 「卸除此插件并继续检测」:离线卸载定位到的插件 → 重启并重新检测;仍有问题会再次触发修复界面。 */+ async recoverAndRedetect(ids: readonly string[]) {+ if (this.recovery.busy || ids.length === 0)+ return+ this.recovery = { ...this.recovery, busy: true }+ try {+ for (const id of ids) {+ await invoke('recover_plugin', { id })+ }+ // 卸载成功:清空恢复态回到启动/就绪;若仍失败,boot 的 catch 会再次定位并弹出。+ // 保留 attempts:连续失败会累加,达到上限后界面提示「查看日志 / 手动卸载」。+ this.dismissedRecoveryIds = this.dismissedRecoveryIds.filter(x => !ids.includes(x))+ this.clear()+ await harness.restart()+ }+ catch (err) {+ console.error('[Harness] recover_plugin failed:', err)+ this.recovery = { ...this.recovery, busy: false, attempts: this.recovery.attempts + 1 }+ }+ },++ /**+ * 从快照还原并继续检测:优先用单插件快照还原问题插件(优先级高于卸载);+ * 仅对传入的(确有快照的)插件还原,单项失败不阻断其它项。还原成功后重启并重新检测。+ */+ async restoreAndRedetect(ids: readonly string[]) {+ if (this.recovery.busy || ids.length === 0)+ return+ this.recovery = { ...this.recovery, busy: true }+ try {+ // 逐项还原,单项失败仅记录告警、不中断整体流程(无快照项由调用方过滤)+ for (const id of ids) {+ try {+ await invoke('restore_plugin', { id })+ }+ catch (err) {+ console.error(`[Harness] restore_plugin failed for ${id}:`, err)+ }+ }+ this.clear()+ await harness.restart()+ }+ catch (err) {+ console.error('[Harness] restoreAndRedetect failed:', err)+ this.recovery = { ...this.recovery, busy: false, attempts: this.recovery.attempts + 1 }+ }+ },++ /** 「暂不处理」:关闭修复界面并记住这些插件(运行期场景不阻断使用)。 */+ dismissRecovery() {+ if (this.recovery.info) {+ this.dismissedRecoveryIds = [+ ...new Set([...this.dismissedRecoveryIds, ...this.recovery.info.plugins]),+ ]+ }+ this.recovery = createRecovery()+ },++ /** 完全重置:清空定位信息、失败计数与已忽略列表(服务确认就绪/停止后调用)。 */+ reset() {+ this.recovery = createRecovery()+ this.dismissedRecoveryIds = []+ },++ /** 收起界面并清空定位信息,但保留 attempts(服务重启开始时调用)。 */+ clear() {+ this.recovery = createRecovery(this.recovery.attempts)+ },++ /**+ * 仅收起界面,保留 info 与 attempts(手动重启前调用)。+ * 若重启仍失败,boot 的 catch 会重新定位问题插件并再次弹出。+ */+ hide() {+ this.recovery = { ...this.recovery, required: false, busy: false }+ },+ },+})diff --git a/src/store/modules/recovery/types.ts b/src/store/modules/recovery/types.tsnew file mode 100644index 00000000..a01686e9--- /dev/null+++ b/src/store/modules/recovery/types.ts@@ -0,0 +1,26 @@+/** Rust 侧 service::plugin::recovery::PluginRecoveryInfo 的序列化形态(camelCase) */+export interface PluginRecoveryInfo {+ /** 定位到的问题插件(npm 包名);未定位到时为空 */+ plugins: string[]+ /** 失败原因判别键:duplicate_route / duplicate_loader_entry / cannot_resolve_bundle / no_dsh_bundle / slot_conflict / load_failed / runtime / unknown */+ reason: string+ /** 动态详情(冲突路由 / 槽位 / 服务组件 id),用于 I18n 插值 */+ detail: string+ /** 原始错误信息(技术详情查看) */+ raw_error: string+}++/** 插件异常修复界面状态 */+export interface RecoveryState {+ /** 是否弹出修复界面 */+ required: boolean+ /** 定位到的恢复信息 */+ info: PluginRecoveryInfo | null+ /** 已触发修复的次数(用于防死循环) */+ attempts: number+ /** 修复动作进行中 */+ busy: boolean+}++/** 修复界面的自动提示次数上限:达到后转为「查看日志 / 手动卸载」提示 */+export const MAX_RECOVERY_ATTEMPTS = 3diff --git a/src/store/modules/recovery/utils.ts b/src/store/modules/recovery/utils.tsnew file mode 100644index 00000000..bb8cc441--- /dev/null+++ b/src/store/modules/recovery/utils.ts@@ -0,0 +1,11 @@+import type { RecoveryState } from './types'++/** 修复界面的初始状态;`attempts` 可保留以延续「连续失败」计数 */+export function createRecovery(attempts = 0): RecoveryState {+ return {+ required: false,+ info: null,+ attempts,+ busy: false,+ }+}diff --git a/src/store/modules/setting/index.ts b/src/store/modules/setting/index.tsindex 5bbb734f..113e96be 100644--- a/src/store/modules/setting/index.ts+++ b/src/store/modules/setting/index.ts@@ -1,27 +1,2 @@-import { defineStore } from 'valtio-define'-import { persist } from 'valtio-define/plugins'--/**- * 设置模块:语言偏好(i18n 由 src/i18n 统一管理,组件直接用 react-i18next 的 useTranslation)- * + 侧边栏开关等纯 UI 状态。store 内部如需翻译文案,直接使用 i18next.t(...)(见 updater/harness 模块)。- */-export const setting = defineStore({- state: () => ({- sidebarOpen: false,- language: null as string | null,- }),- actions: {- toggleSidebar() {- this.sidebarOpen = !this.sidebarOpen- },- closeSidebar() {- this.sidebarOpen = false- },- },- persist: {- key: 'setting',- paths: ['sidebarOpen'],- },-})--setting.use(persist({ hydrate: false }))+export { setting } from './store'+export type { AppSetting, AppSettingUpdate } from './types'diff --git a/src/store/modules/setting/store.ts b/src/store/modules/setting/store.tsnew file mode 100644index 00000000..ff32e2a5--- /dev/null+++ b/src/store/modules/setting/store.ts@@ -0,0 +1,30 @@+import { listen } from '@tauri-apps/api/event'+import { defineStore } from 'valtio-define'+import { persist } from 'valtio-define/plugins/persist'+import { storage } from '@/config/storage'++export const setting = defineStore({+ state: () => ({+ installed: false,+ port: 3080,+ auto_start: true,+ cli_link_enabled: true,+ zoom_factor: 1,+ close_action: 'tray',+ backup_retention_count: 10,+ backup_include_credentials: false,+ language: null as string | null,+ }),+ persist: {+ key: 'setting',+ storage,+ },+})++setting.use(persist({ hydrate: false }))++const unlisten = listen<typeof setting.$state>('setting_updated', async (event) => {+ setting.$patch(event.payload)+ await setting.$persist.rehydrate()+ unlisten.then(unlisten => unlisten())+})diff --git a/src/store/modules/setting/types.ts b/src/store/modules/setting/types.tsnew file mode 100644index 00000000..b176ad89--- /dev/null+++ b/src/store/modules/setting/types.ts@@ -0,0 +1,31 @@+/**+ * 桌面端设置中**前端关心**的子集(字段名与 Rust `config::Setting` 一致,snake_case 直通)。+ *+ * 只镜像外壳真正消费的字段:档案、核心、桌宠、迁移标记等各有专用命令与查询,+ * 一并塞进来只会制造第二份真相。+ */+export interface AppSetting {+ /** 依赖是否已安装(boot 流程据此决定是否走安装与更新检查) */+ installed: boolean+ port: number+ auto_start: boolean+ cli_link_enabled: boolean+ zoom_factor: number+ close_action: string+ backup_retention_count: number+ backup_include_credentials: boolean+}++/**+ * `update_app_config` 的可写字段(camelCase,与 Rust 命令参数一一对应)。+ *+ * 语义是「部分更新」:未传的字段由后端保持原值。+ */+export interface AppSettingUpdate {+ port?: number+ autoStart?: boolean+ cliLinkEnabled?: boolean+ closeAction?: string+ backupRetentionCount?: number+ backupIncludeCredentials?: boolean+}diff --git a/src/style/components/scrollbar.css b/src/styles/components/scrollbar.csssimilarity index 100%rename from src/style/components/scrollbar.cssrename to src/styles/components/scrollbar.cssdiff --git a/src/style/main.css b/src/styles/main.csssimilarity index 100%rename from src/style/main.cssrename to src/styles/main.cssdiff --git a/src/types/core.ts b/src/types/core.tsnew file mode 100644index 00000000..cc3566d0--- /dev/null+++ b/src/types/core.ts@@ -0,0 +1,29 @@+/** 核心来源:local = 用户 CLI 安装;app = 桌面端预打包 */+export type CoreSource = 'local' | 'app'++/** Rust 侧 service::core::HarnessCore 的序列化形态(camelCase) */+export interface HarnessCore {+ /** `local` | `app`(无 tag 记录的旧激活行)| `app-<tag>` */+ id: string+ source: CoreSource+ /** 版本号(不含 v 前缀;缺失为空串) */+ version: string+ /** 完整 release tag(如 `dsh-0.1.0-rc.8-32331963388`;local 行为空串) */+ tag: string+ /** 核心入口(cli path):本地核心为 bin.js,预打包为安装目录 */+ path: string+ /** 「打开目录」入口:本地核心为包目录,预打包为安装/槽位目录;未下载为空 */+ dir: string+ /** 本地是否可用(文件在盘/可解析) */+ present: boolean+ /** 当前是否使用中 */+ active: boolean+ /** 是否预览版(GitHub Pre-release label 或 tag 命名判定):预览版不参与更新提示,仅列表展示 */+ preview: boolean+ /** 是否高于 resources/version-recommend.json 中的推荐版本 */+ aboveRecommended: boolean+ /** 本地存在但 pkg 仓库已不再提供的历史槽位 */+ orphaned: boolean+ recommendedVersion: string | null+ error?: string | null+}diff --git a/src/types/index.ts b/src/types/index.tsnew file mode 100644index 00000000..4b96318b--- /dev/null+++ b/src/types/index.ts@@ -0,0 +1,4 @@+export * from './core'+export * from './plugin'+export * from './profile'+export * from './theme'diff --git a/src/types/plugin.ts b/src/types/plugin.tsnew file mode 100644index 00000000..fd113e86--- /dev/null+++ b/src/types/plugin.ts@@ -0,0 +1,42 @@+/** Rust 侧 service::plugin::watch::PluginErrorInfo 的序列化形态(camelCase) */+export interface PluginErrorInfo {+ /** 错误消息(pnpm/运行日志片段) */+ message: string+ /** 记录动作:install / update / remove / runtime */+ action: string+ /** 记录时间(unix 秒级时间戳字符串) */+ at: string+}++/** Rust 侧 service::plugin::watch::DshPlugin 的序列化形态(camelCase) */+export interface DshPlugin {+ /** 依赖键(npm 包名),列表主键 */+ id: string+ /** 展示名:插件自身 package.json 的 name,缺失时回落预设清单 */+ name: string+ /** 已安装版本(解析失败时为空字符串) */+ version: string+ description: string+ /** 仓库地址(repository.url / homepage) */+ repo_url: string+ /** 是否在 dsh.profile.bundles 中(启动时自动加载) */+ bundled: boolean+ /** 是否在禁用清单(disabled-plugins.json)中,独立于 bundled */+ disabled: boolean+ /** 是否在 cordis.patch.yml 中被配置覆盖禁用(disabled: true),优先级高于禁用清单 */+ patchDisabled: boolean+ /** 预设清单中的「推荐」标记 */+ recommended: boolean+ /** 预设清单中的「修复」标记 */+ fix: boolean+ /** 预设清单中的「内置」标记(随包分发/本地热更新):隐藏卸载入口并标注 [内置] */+ internal: boolean+ /** 是否有可用更新(由 `service::plugin::updates` 探测;未判定时为 false) */+ updateAvailable: boolean+ /** 判定得到的「最新版本」(registry latest / git HEAD SHA);未判定时缺省 */+ latestVersion?: string+ /** 是否有单插件快照($DSH_HOME/.plugin-backups/<id>.tgz),决定还原/删除快照入口 */+ hasSnapshot: boolean+ /** 异常信息(安装/升级/卸载失败或页面运行期上报);undefined = 正常 */+ error?: PluginErrorInfo | null+}diff --git a/src/types/profile.ts b/src/types/profile.tsnew file mode 100644index 00000000..61a93f9f--- /dev/null+++ b/src/types/profile.ts@@ -0,0 +1,11 @@+/** Rust 侧 service::profile::Profile 的序列化形态(camelCase) */+export interface Profile {+ /** 档案 id($DSH_HOME/profiles/<id> 目录名) */+ id: string+ /** 展示名(manifest name 去 dsh-profile- 前缀,首字母大写) */+ name: string+ /** 是否桌面端内置默认档案(web) */+ default: boolean+ /** 是否当前使用中的档案 */+ active: boolean+}diff --git a/src/types/theme.ts b/src/types/theme.tsnew file mode 100644index 00000000..ffdc3291--- /dev/null+++ b/src/types/theme.ts@@ -0,0 +1,5 @@+/** dsh 侧持久化的主题偏好(`$DSH_HOME/settings.yaml` 的 `ui-theme.preference`) */+export type DshThemePreference = 'dark' | 'light' | 'system'++/** 解析后的最终主题:落到 `<html data-theme>`,由 CSS 变量切换配色 */+export type ResolvedTheme = 'dark' | 'light'diff --git a/src/components/config-backup.tsx b/src/ui/config/backup.tsxsimilarity index 90%rename from src/components/config-backup.tsxrename to src/ui/config/backup.tsxindex e868b63c..ac17fb3a 100644--- a/src/components/config-backup.tsx+++ b/src/ui/config/backup.tsx@@ -1,18 +1,17 @@import { ArrowLeft, Delete } from '@gravity-ui/icons'import { Button, Checkbox, Chip, Description, Label, Spinner } from '@heroui/react'import { useOverlay } from '@overlastic/react'+import { promiseTimeout, useToggle } from '@reause/core'import { invoke } from '@tauri-apps/api/core'-import { useState } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'+import { Item } from '@/components/item'+import { Modal } from '@/components/modal'+import { Panel } from '@/components/panel'+import { useBackups } from '@/hooks/use-backup'import { store } from '@/store'import { silence } from '@/utils/silence'import { toast } from '@/utils/toast'-import { useBackups } from '../hooks/use-backup'-import { Item } from './item'-import { Modal } from './modal'-import { PanelHeader } from './panel-header'-import { PanelState } from './panel-state'export interface ConfigBackupProps {onBack: () => void@@ -25,7 +24,7 @@ function formatSize(bytes: number): string {/*** 轮询 health check 确认 DSH 服务已真正停止,避免文件锁冲突。- * - 使用剩余 timeout 约束 in-flight 的 probe,防止无限挂起+ * - 使用剩余 timeout 约束 in-flight 的 probe(reause `promiseTimeout`),防止无限挂起* - 仅当 health check 明确失败(非 transient 错误)时才视为已停止* - 超时后继续执行(shutdown 可能仍在进行中)*/@@ -35,9 +34,8 @@ async function waitForHarnessStopped(timeoutMs = 10_000, intervalMs = 500): Promconst remaining = timeoutMs - (Date.now() - start)if (remaining <= 0)break- const timeoutPromise = new Promise<never>((_, reject) => setTimeout(() => reject(new Error('probe timeout')), remaining))try {- await Promise.race([invoke('proxy_health_check'), timeoutPromise])+ await Promise.race([invoke('proxy_health_check'), promiseTimeout(remaining, true, 'probe timeout')])// 服务仍在运行,继续等待}catch (e) {@@ -48,7 +46,7 @@ async function waitForHarnessStopped(timeoutMs = 10_000, intervalMs = 500): Promif (!(e instanceof Error) || !/502|ECONNREFUSED|ETIMEDOUT/i.test(e.message))return}- await new Promise(resolve => setTimeout(resolve, intervalMs))+ await promiseTimeout(intervalMs)}}@@ -57,7 +55,7 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {const { backups, loading, error, createBackup, restoreBackup, deleteBackup, busy, creating, restoring, deleting } = useBackups()const [dialogHolder, openDialog] = useOverlay(Modal, { type: 'holder' })- const [includeCredentials, setIncludeCredentials] = useState(false)+ const [includeCredentials, toggleIncludeCredentials] = useToggle()async function handleCreate() {try {@@ -181,7 +179,7 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {</Button>{/* 手动备份 */}- <PanelHeader title={t('backup.manual_section')} description="" />+ <Panel.Header title={t('backup.manual_section')} description="" /><div className="flex flex-col gap-3"><Buttonvariant="primary"@@ -200,7 +198,7 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {<label className="flex items-center gap-2 cursor-pointer"><CheckboxisSelected={includeCredentials}- onChange={(value: boolean) => setIncludeCredentials(value)}+ onChange={(value: boolean) => toggleIncludeCredentials(value)}aria-label={t('backup.include_credentials')}className="shrink-0">@@ -220,8 +218,8 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {</div>{/* 备份列表 */}- <PanelHeader title={t('backup.list_section')} description="" />- <PanelState loading={loading} error={error}>+ <Panel.Header title={t('backup.list_section')} description="" />+ <Panel.Loadable loading={loading} error={error}><Ifcond={backups.length === 0}else={(@@ -288,7 +286,7 @@ export function ConfigBackup({ onBack }: ConfigBackupProps) {<Description className="text-xs text-muted">{t('backup.empty_desc')}</Description></div></If>- </PanelState>+ </Panel.Loadable>{dialogHolder}</div>diff --git a/src/components/config-close-action.tsx b/src/ui/config/components/close-action.tsxsimilarity index 62%rename from src/components/config-close-action.tsxrename to src/ui/config/components/close-action.tsxindex f850904d..8711ddc9 100644--- a/src/components/config-close-action.tsx+++ b/src/ui/config/components/close-action.tsx@@ -1,31 +1,33 @@-import type { AppConfig } from '@/hooks/use-app-config'+import type { AppSettingUpdate } from '@/store/modules/setting'import { Description, ListBox, Select } from '@heroui/react'-import { useMutation, useQueryClient } from '@tanstack/react-query'+import { useMutation } from '@tanstack/react-query'import { invoke } from '@tauri-apps/api/core'import { useTranslation } from 'react-i18next'-import { useAppConfig } from '@/hooks/use-app-config'+import { useStore } from 'valtio-define'+import { store } from '@/store'+import { CLOSE_ACTION_OPTIONS, normalizeCloseAction } from '@/utils/close-action'import { toast } from '@/utils/toast'-import { CLOSE_ACTION_OPTIONS, normalizeCloseAction } from '../utils/close-action'const CLOSE_ACTION_LABEL_KEYS = {tray: 'ui.close_action_tray',quit: 'ui.close_action_quit',}+/**+ * 关闭按钮行为(隐藏到托盘 / 退出)。+ *+ * 读:`setting` store(与 Rust 共享 `.store.dat`,后端改动经 `setting_updated` 回流)。+ * 写:仍走 `update_app_config`,让后端统一归一化并在锁内落盘——前端直接改 store+ * 会与 Rust 的整对象写入互相覆盖。+ * 因此这里既不需要配置查询,也不需要写入后手动刷新。+ */export function ConfigCloseAction() {const { t } = useTranslation()- const queryClient = useQueryClient()- const { data: config, refetch, isFetching } = useAppConfig()+ const { close_action: closeAction } = useStore(store.setting)const { mutate: setCloseAction, isPending } = useMutation({- mutationFn: async (closeAction: string) => {- const next = normalizeCloseAction(closeAction)- // 先写入成功结果到缓存:即使后续 refetch 失败,UI 仍展示新值,- // 避免回退到更新前的旧 close_action(refetch 默认不抛错,只保留旧数据)。- const result = await invoke<AppConfig>('update_app_config', { closeAction: next })- queryClient.setQueryData(['config'], result)- await invoke<AppConfig>('update_app_config', { closeAction: next })- await refetch()- },+ mutationFn: (next: string) =>+ // `satisfies` 用共享类型守住 camelCase 契约:字段名写错时后端会静默忽略+ invoke('update_app_config', { closeAction: normalizeCloseAction(next) } satisfies AppSettingUpdate),onError: (error: unknown) => {console.error('[ConfigCloseAction] update failed:', error)toast(t('messages.close_action_failed'), { variant: 'danger' })@@ -38,9 +40,9 @@ export function ConfigCloseAction() {<span className="text-xs font-medium text-ink">{t('ui.close_action')}</span><Selectvariant="secondary"- selectedKey={normalizeCloseAction(config?.close_action)}+ selectedKey={normalizeCloseAction(closeAction)}onSelectionChange={key => setCloseAction(String(key))}- isDisabled={isFetching || isPending}+ isDisabled={isPending}className="w-[140px]"aria-label={t('ui.close_action')}>diff --git a/src/components/config-launch-on-login.tsx b/src/ui/config/components/launch-on-login.tsxsimilarity index 94%rename from src/components/config-launch-on-login.tsxrename to src/ui/config/components/launch-on-login.tsxindex 6778642b..5269e43f 100644--- a/src/components/config-launch-on-login.tsx+++ b/src/ui/config/components/launch-on-login.tsx@@ -2,12 +2,13 @@ import { Description, Switch } from '@heroui/react'import { useMutation, useQuery } from '@tanstack/react-query'import { invoke } from '@tauri-apps/api/core'import { useTranslation } from 'react-i18next'+import { queryKeys } from '@/config/query-keys'import { toast } from '@/utils/toast'export function ConfigLaunchOnLogin() {const { t } = useTranslation()const { data: enabled, refetch, isFetching } = useQuery({- queryKey: ['launch_on_login'],+ queryKey: queryKeys.launchOnLogin,queryFn: () => invoke<boolean>('get_launch_on_login'),})const { mutate: setEnabled, isPending } = useMutation({diff --git a/src/components/config-core.tsx b/src/ui/config/core.tsxsimilarity index 83%rename from src/components/config-core.tsxrename to src/ui/config/core.tsxindex ec4b05bc..5a1c48eb 100644--- a/src/components/config-core.tsx+++ b/src/ui/config/core.tsx@@ -1,28 +1,30 @@-import type { HarnessCore } from '../hooks/use-dsh-cores'+import type { HarnessCore } from '@/types'import { ArrowRotateRight, CircleArrowDown as DownloadIcon, FolderOpen } from '@gravity-ui/icons'import { Button, Checkbox, Chip, Description, Label, Spinner } from '@heroui/react'import { useOverlay } from '@overlastic/react'+import { useToggle } from '@reause/core'+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'import { invoke } from '@tauri-apps/api/core'import { Fragment, useState } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'-import { useCoreBreakingConfirm } from '@/hooks/use-core-breaking-confirm'+import { Empty } from '@/components/empty'+import { Item } from '@/components/item'+import { Modal } from '@/components/modal'+import { Panel } from '@/components/panel'+import { queryKeys } from '@/config/query-keys'+import { useInvalidateOnSettingUpdated } from '@/hooks/use-invalidate-on-setting-updated'import { store } from '@/store'+import { useCoreBreakingConfirm } from '@/ui/config/hooks/use-core-breaking-confirm'+import { DownloadCoreDialog } from '@/ui/dialog/update-core'import { compareVersions } from '@/utils/core-version'import { silence } from '@/utils/silence'import { toast } from '@/utils/toast'-import { useDshCores } from '../hooks/use-dsh-cores'-import { DownloadCoreDialog } from './download-core-dialog'-import { Empty } from './empty'-import { Item } from './item'-import { Modal } from './modal'-import { PanelHeader } from './panel-header'-import { PanelState } from './panel-state'/*** 「核心」面板:管理 Harness 引擎来源与多版本。*- * - 列表来自 `useDshCores`(`get_cores` 查询 + `setting_updated` 事件刷新):+ * - 列表来自 `get_cores` 查询(`setting_updated` 事件一并失效刷新):* `local` = 用户通过 CLI 全局安装的本地核心(存在时优先使用,需求 3);* `app-<tag>` = deepseek-harness-pkg 各发布版本(GitHub releases 拉取失败时* 降级为 git tags / 磁盘扫描,仅显示已下载版本)。预览版(Pre-release label@@ -41,11 +43,47 @@ export function ConfigCore() {const { holder: coreBreakingHolder, confirmCoreBreaking } = useCoreBreakingConfirm()const { t } = useTranslation()- const { cores, loading, error, setActiveCore, updateLocalCore, downloadCore, removeCore, refreshCores, busy } = useDshCores()++ // —— 核心列表数据层 ——+ // 写操作(切换/下载/卸载/更新)落盘后后端会触发 `setting_updated`,这里监听该事件+ // 一并失效重拉,保证「核心被外部 CLI 更新后重开面板即最新」。+ const queryClient = useQueryClient()+ const { data: coreList, isLoading, error: coreError, refetch } = useQuery({+ queryKey: queryKeys.cores,+ queryFn: () => invoke<HarnessCore[]>('get_cores'),+ })+ useInvalidateOnSettingUpdated(queryKeys.cores)++ function invalidate() {+ void queryClient.invalidateQueries({ queryKey: queryKeys.cores })+ }++ const activate = useMutation({+ mutationFn: (id: string) => invoke<HarnessCore>('set_active_core', { id }),+ onSuccess: invalidate,+ })+ const download = useMutation({+ mutationFn: (tag: string) => invoke<HarnessCore>('download_core', { tag }),+ onSuccess: invalidate,+ })+ const uninstall = useMutation({+ mutationFn: (id: string) => invoke<void>('remove_core', { id }),+ onSuccess: invalidate,+ })+ const updateLocal = useMutation({+ mutationFn: () => invoke<string>('update_local_core'),+ onSuccess: invalidate,+ })++ const cores = coreList ?? []+ const loading = isLoading+ const error = coreError ? String(coreError) : ''+ /** 操作进行中标记(任一写操作 pending) */+ const busy = activate.isPending || download.isPending || uninstall.isPending || updateLocal.isPending/** 行内操作进行中的核心 id(该行的下载/卸载按钮显示 Spinner 并禁用重复点击) */const [busyId, setBusyId] = useState<string | null>(null)- const [refreshing, setRefreshing] = useState(false)+ const [refreshing, toggleRefreshing] = useToggle()// 本地核心未检测到时不渲染 local 行(保留 local_missing_hint 提示)// 后端列表在部分缓存/旧版本返回路径中可能仍保持远程顺序,前端统一按版本从高到低排序。@@ -112,7 +150,9 @@ export function ConfigCore() {return}try {- await runBusy(core.id, () => setActiveCore(core.id))+ // 激活后由 restart 完成时统一失效核心查询;这里不等待联网列表重拉,+ // 避免 setting 已切换但旧服务仍运行期间人为扩大竞态窗口。+ await runBusy(core.id, () => activate.mutateAsync(core.id))const key = toast(t('core.activate_toast', { version: displayVersion(core) }), {variant: 'accent',description: t('core.switch_restart_hint'),@@ -147,7 +187,11 @@ export function ConfigCore() {await openDownloadDialog({tag: core.tag,version: displayVersion(core),- runDownload: tag => downloadCore(tag),+ runDownload: async (tag) => {+ const downloaded = await download.mutateAsync(tag)+ await refetch()+ return downloaded+ },})toast(t('core.downloaded_toast', { version: displayVersion(core) }), {})}@@ -190,7 +234,10 @@ export function ConfigCore() {return}try {- await runBusy(core.id, () => removeCore(core.id))+ await runBusy(core.id, async () => {+ await uninstall.mutateAsync(core.id)+ await refetch()+ })toast(t('core.uninstalled_toast', { version: displayVersion(core) }), {})}catch (err) {@@ -202,9 +249,9 @@ export function ConfigCore() {async function onRefresh() {if (busy || refreshing)return- setRefreshing(true)+ toggleRefreshing(true)try {- await refreshCores()+ await refetch()toast(t('core.refreshed_toast'), {})}catch (err) {@@ -212,7 +259,7 @@ export function ConfigCore() {toast(t('core.refresh_failed'), {})}finally {- setRefreshing(false)+ toggleRefreshing(false)}}@@ -221,7 +268,8 @@ export function ConfigCore() {returnsetBusyId('local')try {- const version = await updateLocalCore()+ const version = await updateLocal.mutateAsync()+ await refetch()toast(t('core.updated_toast', { version: version || '—' }), {})}catch (err) {@@ -235,7 +283,7 @@ export function ConfigCore() {return (<div className="space-y-3">- <PanelHeader+ <Panel.Headertitle={t('core.title')}description={t('core.tooltip')}action={(@@ -254,7 +302,7 @@ export function ConfigCore() {/>{/* 加载 / 失败 / 列表 */}- <PanelState loading={loading} error={error}>+ <Panel.Loadable loading={loading} error={error}><div className="flex flex-col gap-4">{displayRows.map(core => (<Fragment key={core.id}>@@ -389,7 +437,7 @@ export function ConfigCore() {<Empty>{t('core.local_missing_hint')}</Empty></If></div>- </PanelState>+ </Panel.Loadable>{dialogHolder}{downloadDialogHolder}diff --git a/src/components/config-debug.tsx b/src/ui/config/debug.tsxsimilarity index 88%rename from src/components/config-debug.tsxrename to src/ui/config/debug.tsxindex b778c4d5..e43ddf03 100644--- a/src/components/config-debug.tsx+++ b/src/ui/config/debug.tsx@@ -1,21 +1,21 @@-import type { AppConfig } from '@/hooks/use-app-config'+import type { AppSettingUpdate } from '@/store/modules/setting'import { ArrowRotateRight, ArrowUpRightFromSquare, ChevronRight, Copy, Folder, Power, TrashBin } from '@gravity-ui/icons'import { Button, Chip, Description, Input, Link, ListBox, Select, Spinner, Surface, Switch } from '@heroui/react'import { useMutation, useQuery } from '@tanstack/react-query'import { invoke } from '@tauri-apps/api/core'-import { listen } from '@tauri-apps/api/event'-import { useEffect, useState } from 'react'+import { useState } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'import { useStore } from 'valtio-define'-import { useAppConfig } from '@/hooks/use-app-config'-import { useCoreBreakingConfirm } from '@/hooks/use-core-breaking-confirm'+import { Info } from '@/components/info'+import { queryKeys } from '@/config/query-keys'+import { useListen } from '@/hooks/use-listen'import { store } from '@/store'+import { ConfigCloseAction } from '@/ui/config/components/close-action'+import { ConfigLaunchOnLogin } from '@/ui/config/components/launch-on-login'+import { useCoreBreakingConfirm } from '@/ui/config/hooks/use-core-breaking-confirm'import { writeClipboardText } from '@/utils/clipboard'import { toast } from '@/utils/toast'-import { ConfigCloseAction } from './config-close-action'-import { ConfigLaunchOnLogin } from './config-launch-on-login'-import { Info } from './info'const ZOOM_OPTIONS = Array.from({ length: 16 }, (_, index) => Number((0.5 + index * 0.1).toFixed(1)))@@ -45,55 +45,41 @@ export function ConfigDebug() {const { updateInfo } = useStore(store.harnessUpdater)const { holder: coreBreakingHolder, confirmCoreBreaking } = useCoreBreakingConfirm()- // 端口编辑态:用户尚未输入时为 undefined,由 `data?.port ?? 3080` 提供初值。- // 初值不写入 state(避免 queryFn 副作用 / effect 同步),渲染与保存时统一- // 读取 config 数据;用户一旦输入即以输入值为准。+ // 端口编辑态:用户尚未输入时为 undefined,展示值始终以 store 中已保存的端口为准。+ // 初值不写入 state(避免渲染期副作用),用户一旦输入即以输入值为准。const [portInput, setPortInput] = useState<number>()const { data: info, refetch: refreshInfo } = useQuery({- queryKey: ['info'],+ queryKey: queryKeys.info,queryFn: () => invoke<RuntimeInfo>('get_runtime_info'),})- useEffect(() => {- let disposed = false- let unlisten: (() => void) | undefined- listen('setting_updated', () => {- void refreshInfo()- }).then((fn) => {- if (disposed)- fn()- else- unlisten = fn- }).catch(() => {})- return () => {- disposed = true- unlisten?.()- }- }, [refreshInfo])+ // 设置变更(如端口避让后服务地址变化)会让运行时信息过期,重拉一次+ useListen('setting_updated', () => {+ void refreshInfo()+ })- const { data: config, refetch: refreshConfig } = useAppConfig()- const port = portInput ?? config?.port ?? 3080+ const { port: savedPort, zoom_factor: zoomFactor } = useStore(store.setting)+ const port = portInput ?? savedPortconst { data: cliStatus, refetch: refreshCliStatus } = useQuery({- queryKey: ['cli_status'],+ queryKey: queryKeys.cliStatus,queryFn: () => invoke<CliLinkStatus>('get_cli_link_status'),})const { data: logs, refetch: refreshLogs } = useQuery({- queryKey: ['logs'],+ queryKey: queryKeys.logs,queryFn: () => invoke<string>('read_service_logs'),refetchInterval: 2000,})async function copyLogs() {try {- await writeClipboardText(logs || '')- toast(t('messages.logs_copied'))+ // 成功/失败提示由 writeClipboardText 统一给出,这里只记录日志+ await writeClipboardText(logs || '', t('messages.logs_copied'))}catch (err) {console.error('[ConfigDebug] copy logs failed:', err)- toast(t('messages.logs_copy_failed'), { variant: 'danger' })}}@@ -124,7 +110,8 @@ export function ConfigDebug() {const { mutate: onToggleCliLink } = useMutation({mutationFn: async (enabled: boolean) => {- await invoke<AppConfig>('update_app_config', { cliLinkEnabled: enabled })+ // 命令会先建/删 shim 与 PATH 再落盘,前端只改 store 不会产生这些副作用+ await invoke('update_app_config', { cliLinkEnabled: enabled } satisfies AppSettingUpdate)await refreshCliStatus()},onError: (err: unknown) => {@@ -133,16 +120,13 @@ export function ConfigDebug() {},})- const { mutate: onSetZoom } = useMutation({- mutationFn: async (zoomFactor: number) => {- await invoke<number>('set_webview_zoom', { zoomFactor })- await refreshConfig()- },- onError: (err: unknown) => {- console.error('[ConfigDebug] set zoom failed:', err)- toast(t('messages.zoom_failed'), { variant: 'danger' })- },- })+ /**+ * 缩放真值写进 setting store(persist 写入的 `setting` 键与 Rust 共用同一份 `.store.dat`),+ * WebView 上的应用由 `iframe.tsx` 的 `useZoomFactor` 完成,因此这里没有失败分支。+ */+ function onSetZoom(zoomFactor: number) {+ store.setting.zoom_factor = zoomFactor+ }const { mutate: onCopyServiceUrl } = useMutation({mutationFn: async () => {@@ -161,8 +145,8 @@ export function ConfigDebug() {if (!Number.isInteger(port) || port < 1 || port > 65535) {throw new Error('PORT_INVALID')}- await invoke<AppConfig>('update_app_config', { port })- await refreshConfig()+ // 后端会同时记录 manual_port(端口避让后回落到用户选择,issue #91)+ await invoke('update_app_config', { port } satisfies AppSettingUpdate)const key = toast(t('messages.port_changed'), {variant: 'accent',description: t('messages.port_restart_hint'),@@ -392,7 +376,7 @@ export function ConfigDebug() {<span className="text-xs font-medium text-ink">{t('ui.zoom')}</span><Selectvariant="secondary"- selectedKey={String(config?.zoom_factor ?? 1)}+ selectedKey={String(zoomFactor)}onSelectionChange={key => onSetZoom(Number(key))}className="w-[80px]"aria-label={t('ui.zoom')}diff --git a/src/hooks/use-core-breaking-confirm.tsx b/src/ui/config/hooks/use-core-breaking-confirm.tsxsimilarity index 100%rename from src/hooks/use-core-breaking-confirm.tsxrename to src/ui/config/hooks/use-core-breaking-confirm.tsxdiff --git a/src/components/config-plugin.tsx b/src/ui/config/plugin.tsxsimilarity index 88%rename from src/components/config-plugin.tsxrename to src/ui/config/plugin.tsxindex 4016de2d..f2f23980 100644--- a/src/components/config-plugin.tsx+++ b/src/ui/config/plugin.tsx@@ -1,23 +1,25 @@+import type { DshPlugin } from '@/types'import { CircleExclamation } from '@gravity-ui/icons'import { Button, Chip, Label, Spinner, Tooltip } from '@heroui/react'import { useOverlay } from '@overlastic/react'-import { useMutation, useQueryClient } from '@tanstack/react-query'+import { useMount } from '@reause/core'+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'import { invoke } from '@tauri-apps/api/core'import { useState } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'import { tv } from 'tailwind-variants'import { useStore } from 'valtio-define'+import { Ellipsis as TextEllipsis } from '@/components/ellipsis'+import { Empty } from '@/components/empty'+import { Item } from '@/components/item'+import { Modal } from '@/components/modal'+import { Panel } from '@/components/panel'+import { queryKeys } from '@/config/query-keys'+import { useListen } from '@/hooks/use-listen'import { store } from '@/store'import { silence } from '@/utils/silence'import { toast } from '@/utils/toast'-import { useDshPlugins } from '../hooks/use-dsh-plugins'-import { Ellipsis as TextEllipsis } from './ellipsis'-import { Empty } from './empty'-import { Item } from './item'-import { Modal } from './modal'-import { PanelHeader } from './panel-header'-import { PanelState } from './panel-state'/*** 操作 chip 的样式变体:busy 时禁止点击并降低透明度,否则可点击。@@ -39,8 +41,9 @@ const actionChip = tv({/*** 「插件」面板:展示已安装插件,作为「插件出问题时」的卸载/升级入口。*- * - 数据来自 `useDshPlugins`(`get_dsh_plugins` 查询 + `dsh-plugins-updated`- * 实时事件,react-query 缓存同步)。+ * - 列表来自 `get_dsh_plugins` 查询;后端(`service/plugin/watch`)秒级监控 profile+ * 插件文件,变化时经 `dsh-plugins-updated` 推送完整列表,由根布局统一写入该查询+ * 缓存(面板 / 配置对话框角标 / 导航栏共用同一份缓存,无需重新拉取)。* - 升级 `update_dsh_plugin` / 卸载 `remove_dsh_plugin` 已接入后端* (`dsh plugin --profile <当前档案> update|remove <id>`,进程输出经* `preinstall-log` 事件实时推送)。@@ -50,8 +53,28 @@ const actionChip = tv({export function ConfigPlugin() {const { t } = useTranslation()const queryClient = useQueryClient()- const { plugins, loading, error, disablePlugin, enablePlugin } = useDshPlugins()- const { preinstall } = useStore(store.harness)+ const preinstall = useStore(store.preinstall)++ const { data: pluginList, isLoading, error: pluginError } = useQuery({+ queryKey: queryKeys.plugins,+ queryFn: () => invoke<DshPlugin[]>('get_dsh_plugins'),+ })++ // 重新探测更新可用性并写回缓存(Rust 侧 30min 缓存;失败静默按「无更新」处理,+ // 插件管理器仍可用)。升级入口只在确有更新(或异常修复)时显示,而不是常驻。+ function refreshUpdates() {+ void invoke<DshPlugin[]>('refresh_plugin_updates')+ .then(list => queryClient.setQueryData(queryKeys.plugins, list))+ .catch(err => console.error('[ConfigPlugin] refresh_plugin_updates failed:', err))+ }++ // 打开面板补齐一次;之后插件文件变化(安装/升级/卸载会改写版本与 spec)重新探测+ useMount(refreshUpdates)+ useListen<DshPlugin[]>('dsh-plugins-updated', refreshUpdates)++ const plugins = pluginList ?? []+ const loading = isLoading+ const error = pluginError ? String(pluginError) : ''const [dialogHolder, openDialog] = useOverlay(Modal, { type: 'holder' })@@ -64,7 +87,7 @@ export function ConfigPlugin() {const name = plugins.find(p => p.id === id)?.name ?? id// 失效插件列表查询:dsh-plugins-updated 事件在停服务重启场景下可能丢失// (插件操作会停止运行中的服务),必须显式重拉以确保列表落盘后刷新。- void queryClient.invalidateQueries({ queryKey: ['plugins'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })toast(t('plugins.updated_toast', { name }), {})},onError: (err, id) => {@@ -78,7 +101,7 @@ export function ConfigPlugin() {onSuccess: (_data, id) => {const name = plugins.find(p => p.id === id)?.name ?? id// 同上:卸载成功后显式重拉插件列表,避免事件推送丢失导致列表未更新。- void queryClient.invalidateQueries({ queryKey: ['plugins'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })toast(t('plugins.removed_toast', { name }), {})},onError: (err, id) => {@@ -88,10 +111,10 @@ export function ConfigPlugin() {},})const disable = useMutation({- mutationFn: (id: string) => disablePlugin(id),+ mutationFn: (id: string) => invoke<void>('disable_dsh_plugin', { id }),onSuccess: (_data, id) => {const name = plugins.find(p => p.id === id)?.name ?? id- void queryClient.invalidateQueries({ queryKey: ['plugins'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })toast(t('plugins.disable_toast', { name }), {})},onError: (err, id) => {@@ -102,10 +125,10 @@ export function ConfigPlugin() {})const enable = useMutation({mutationFn: (args: { id: string, clearConfigOverride: boolean }) =>- enablePlugin(args.id, args.clearConfigOverride),+ invoke<void>('enable_dsh_plugin', { id: args.id, clearConfigOverride: args.clearConfigOverride }),onSuccess: (_data, args) => {const name = plugins.find(p => p.id === args.id)?.name ?? args.id- void queryClient.invalidateQueries({ queryKey: ['plugins'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })toast(t('plugins.enable_toast', { name }), {})},onError: (err, args) => {@@ -118,7 +141,7 @@ export function ConfigPlugin() {mutationFn: (id: string) => invoke<void>('snapshot_plugin', { id }),onSuccess: (_data, id) => {const name = plugins.find(p => p.id === id)?.name ?? id- void queryClient.invalidateQueries({ queryKey: ['plugins'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })toast(t('plugins.snapshot_toast', { name }), {})},onError: (err, id) => {@@ -131,7 +154,7 @@ export function ConfigPlugin() {mutationFn: (id: string) => invoke<void>('restore_plugin', { id }),onSuccess: (_data, _id) => {// 还原后快照仍在(覆盖式不删快照),插件版本回到快照态:重拉列表。- void queryClient.invalidateQueries({ queryKey: ['plugins'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })},onError: (err, id) => {const name = plugins.find(p => p.id === id)?.name ?? id@@ -143,7 +166,7 @@ export function ConfigPlugin() {mutationFn: (id: string) => invoke<void>('delete_plugin_backup', { id }),onSuccess: (_data, id) => {const name = plugins.find(p => p.id === id)?.name ?? id- void queryClient.invalidateQueries({ queryKey: ['plugins'] })+ void queryClient.invalidateQueries({ queryKey: queryKeys.plugins })toast(t('plugins.snapshot_deleted_toast', { name }), {})},onError: (err, id) => {@@ -316,7 +339,7 @@ export function ConfigPlugin() {setBusy({ id, action: 'restore' })try {await restore.mutateAsync(id)- // 还原期间后端已停止服务:复用 config-backup 的「重启服务」toast 交互+ // 还原期间后端已停止服务:复用 ui/config/backup 的「重启服务」toast 交互const key = toast(t('plugins.restore_restart_hint', { name }), {variant: 'accent',timeout: 10_000,@@ -370,7 +393,7 @@ export function ConfigPlugin() {return (<div>- <PanelHeader+ <Panel.HeaderclassName="sticky top-0 bg-canvas z-10 pb-3"title={t('plugins.title')}action={(@@ -379,7 +402,7 @@ export function ConfigPlugin() {size="sm"variant="primary"className="rounded-md"- onPress={store.harness.openPreinstall}+ onPress={store.preinstall.open}isDisabled={preinstall.installing}>{t('preinstall.open_preset')}@@ -393,7 +416,7 @@ export function ConfigPlugin() {/>{/* 加载 / 失败 / 空态 */}- <PanelState loading={loading} error={error}>+ <Panel.Loadable loading={loading} error={error}><Ifcond={plugins.length > 0}else={(@@ -577,7 +600,7 @@ export function ConfigPlugin() {))}</div></If>- </PanelState>+ </Panel.Loadable>{dialogHolder}</div>diff --git a/src/components/config-profile.tsx b/src/ui/config/profile.tsxsimilarity index 78%rename from src/components/config-profile.tsxrename to src/ui/config/profile.tsxindex 18588ef5..38c25387 100644--- a/src/components/config-profile.tsx+++ b/src/ui/config/profile.tsx@@ -1,20 +1,24 @@+import type { Profile } from '@/types'import { Plus } from '@gravity-ui/icons'import { AlertDialog, Button, Checkbox, Chip, Description, Input, Label } from '@heroui/react'import { useOverlay } from '@overlastic/react'+import { useToggle } from '@reause/core'+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'+import { invoke } from '@tauri-apps/api/core'import { useState } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'+import { Ellipsis } from '@/components/ellipsis'+import { Item } from '@/components/item'+import { Modal } from '@/components/modal'+import { Panel } from '@/components/panel'+import { queryKeys } from '@/config/query-keys'+import { useInvalidateOnSettingUpdated } from '@/hooks/use-invalidate-on-setting-updated'import { store } from '@/store'+import { ConfigBackup } from '@/ui/config/backup'import { silence } from '@/utils/silence'import { toast } from '@/utils/toast'-import { useDshProfiles } from '../hooks/use-dsh-profiles'-import { ConfigBackup } from './config-backup'-import { Ellipsis } from './ellipsis'-import { Item } from './item'-import { Modal } from './modal'-import { PanelHeader } from './panel-header'-import { PanelState } from './panel-state'type ProfileView = 'list' | { profile: string }@@ -22,17 +26,74 @@ export function ConfigProfile() {/*** 「档案」面板:展示 & 切换 dsh 配置档案,支持新建/删除。*- * 数据来自 `useDshProfiles`(`get_profiles` 查询 + `setting_updated` 事件刷新):* 档案 = `$DSH_HOME/profiles/<id>` 目录,与官方 dsh CLI 的 profile 语义一致;* 桌面端把「当前档案」持久化在 store(`active_profile`),服务启动与插件管理* 都以它为准。切换档案需要重启服务才生效(toast 内提供重启入口)。*/- const { profiles, loading, error, createProfile, activateProfile, removeProfile, cloneProfile, busy } = useDshProfiles()+ const queryClient = useQueryClient()+ const { data: profileList, isLoading, error: profileError, refetch } = useQuery({+ queryKey: queryKeys.profiles,+ queryFn: () => invoke<Profile[]>('get_profiles'),+ })+ // 切换档案会写桌面端 store(触发 `setting_updated`),监听该事件一并失效重拉,+ // 保证面板列表与后端设置始终一致。+ useInvalidateOnSettingUpdated(queryKeys.profiles)++ function invalidate() {+ void queryClient.invalidateQueries({ queryKey: queryKeys.profiles })+ }++ const create = useMutation({+ mutationFn: (name: string) => invoke<Profile>('create_profile', { name }),+ onSuccess: invalidate,+ })+ const activate = useMutation({+ mutationFn: (id: string) => invoke<Profile>('set_active_profile', { id }),+ onSuccess: invalidate,+ })+ const remove = useMutation({+ mutationFn: (id: string) => invoke<void>('remove_profile', { id }),+ onSuccess: invalidate,+ })+ const clone = useMutation({+ mutationFn: (params: { sourceId: string, name: string }) => invoke<Profile>('clone_profile', params),+ onSuccess: invalidate,+ })++ /** 写操作封装:等待列表重拉完成再返回,调用方拿到的列表与后端一致 */+ async function createProfile(name: string): Promise<Profile> {+ const created = await create.mutateAsync(name)+ await refetch()+ return created+ }++ async function activateProfile(id: string): Promise<Profile> {+ const activated = await activate.mutateAsync(id)+ await refetch()+ return activated+ }++ async function removeProfile(id: string) {+ await remove.mutateAsync(id)+ await refetch()+ }++ async function cloneProfile(sourceId: string, name: string): Promise<Profile> {+ const created = await clone.mutateAsync({ sourceId, name })+ await refetch()+ return created+ }++ const profiles = profileList ?? []+ const loading = isLoading+ const error = profileError ? String(profileError) : ''+ /** 操作进行中标记(新建/切换/删除/克隆任一) */+ const busy = create.isPending || activate.isPending || remove.isPending || clone.isPendingconst [dialogHolder, openDialog] = useOverlay(Modal, { type: 'holder' })const { t } = useTranslation()- const [creating, setCreating] = useState(false)+ const [creating, toggleCreating] = useToggle()const [name, setName] = useState('')const [activeView, setActiveView] = useState<ProfileView>('list')@@ -80,7 +141,7 @@ export function ConfigProfile() {}}- async function activate(id: string) {+ async function onActivate(id: string) {const target = profiles.find(p => p.id === id)if (!target || target.active || busy)return@@ -121,12 +182,12 @@ export function ConfigProfile() {}function startCreate() {- setCreating(true)+ toggleCreating(true)setName('')}function cancelCreate() {- setCreating(false)+ toggleCreating(false)setName('')}@@ -137,7 +198,7 @@ export function ConfigProfile() {try {// 创建成功后列表已刷新出新档案,UI 本身就有变化,不再弹成功 toastawait createProfile(trimmed)- setCreating(false)+ toggleCreating(false)setName('')}catch (err) {@@ -146,7 +207,7 @@ export function ConfigProfile() {}}- async function remove(id: string) {+ async function onRemove(id: string) {const target = profiles.find(p => p.id === id)if (!target || busy)return@@ -185,15 +246,15 @@ export function ConfigProfile() {return (<div className="space-y-3">- <PanelHeader title={t('profiles.title')} description={t('profiles.tooltip')} />+ <Panel.Header title={t('profiles.title')} description={t('profiles.tooltip')} />{/* 加载 / 失败 / 列表 */}- <PanelState loading={loading} error={error}>+ <Panel.Loadable loading={loading} error={error}><div className="flex flex-col gap-4">{profiles.map(profile => (<Itemkey={profile.id}- onClick={() => activate(profile.id)}+ onClick={() => onActivate(profile.id)}left={(<><Label className="min-w-0 truncate text-sm font-medium text-ink">@@ -251,7 +312,7 @@ export function ConfigProfile() {onClick={(event) => {event.stopPropagation()if (!busy)- remove(profile.id)+ onRemove(profile.id)}}>{t('profiles.remove')}@@ -304,7 +365,7 @@ export function ConfigProfile() {</Button></If></div>- </PanelState>+ </Panel.Loadable>{dialogHolder}{/* 克隆档案:命名对话框(创建型,accent;可编辑建议名称) */}diff --git a/src/components/desktop-about-dialog.tsx b/src/ui/dialog/about.tsxsimilarity index 92%rename from src/components/desktop-about-dialog.tsxrename to src/ui/dialog/about.tsxindex 7ba3c8f8..356478e7 100644--- a/src/components/desktop-about-dialog.tsx+++ b/src/ui/dialog/about.tsx@@ -2,13 +2,13 @@ import type { PropsWithOverlays } from '@overlastic/react'import { ArrowUpRightFromSquare } from '@gravity-ui/icons'import { Button, Description, Modal } from '@heroui/react'import { useDisclosure } from '@overlastic/react'+import { useWhenever } from '@reause/core'import { invoke } from '@tauri-apps/api/core'-import { useEffect } from 'react'import { useTranslation } from 'react-i18next'import { useStore } from 'valtio-define'+import { Info } from '@/components/info'import { store } from '@/store'import { silence } from '@/utils/silence'-import { Info } from './info'export interface DesktopAboutDialogProps extends PropsWithOverlays {}@@ -23,10 +23,10 @@ export function DesktopAboutDialog(props: DesktopAboutDialogProps) {const { t } = useTranslation()const { about } = useStore(store.desktopUpdater)- useEffect(() => {- if (disclosure.visible)- void store.desktopUpdater.loadAbout()- }, [disclosure.visible])+ // 对话框可见即拉取「关于」信息(overlastic 命令式打开 → visible 由 false 翻 true)+ useWhenever(disclosure.visible, () => {+ void store.desktopUpdater.loadAbout()+ })return (<Modal isOpen={disclosure.visible} onOpenChange={disclosure.cancel}>diff --git a/src/components/config-dialog.tsx b/src/ui/dialog/config.tsxsimilarity index 79%rename from src/components/config-dialog.tsxrename to src/ui/dialog/config.tsxindex cb01435f..0b185644 100644--- a/src/components/config-dialog.tsx+++ b/src/ui/dialog/config.tsx@@ -1,24 +1,32 @@import type { PropsWithOverlays } from '@overlastic/react'+import type { DshPlugin } from '@/types'import { Cpu, LogoWindows, PersonPencil, Puzzle } from '@gravity-ui/icons'-import { useEventBus } from '@hairy/react-lib'import { cn, Modal } from '@heroui/react'import { useDisclosure } from '@overlastic/react'+import { useListener } from '@reause/core'+import { useQuery } from '@tanstack/react-query'+import { invoke } from '@tauri-apps/api/core'import { useState } from 'react'import { useTranslation } from 'react-i18next'import { Case, If, Switch } from 'react-if-lite'-import { useDshPlugins } from '../hooks/use-dsh-plugins'-import { ConfigCore } from './config-core'-import { ConfigDebug } from './config-debug'-import { ConfigPlugin } from './config-plugin'-import { ConfigProfile } from './config-profile'+import { hooks } from '@/config/hooks'+import { queryKeys } from '@/config/query-keys'+import { ConfigCore } from '@/ui/config/core'+import { ConfigDebug } from '@/ui/config/debug'+import { ConfigPlugin } from '@/ui/config/plugin'+import { ConfigProfile } from '@/ui/config/profile'export interface ConfigDialogProps extends PropsWithOverlays {}export function ConfigDialog(props: ConfigDialogProps) {const disclosure = useDisclosure({ props })const { t } = useTranslation()- // 异常插件数:在「插件」Tab 上给出红点/角标,方便用户直接感知出问题的插件- const { plugins } = useDshPlugins()+ // 异常插件数:在「插件」Tab 上给出红点/角标,方便用户直接感知出问题的插件。+ // 与「插件」面板共用同一份查询缓存(根布局订阅后端事件写入)。+ const { data: plugins = [] } = useQuery({+ queryKey: queryKeys.plugins,+ queryFn: () => invoke<DshPlugin[]>('get_dsh_plugins'),+ })const abnormalCount = plugins.filter(p => p.error != null).lengthconst navs = [@@ -30,7 +38,8 @@ export function ConfigDialog(props: ConfigDialogProps) {const [activeTab, setActiveTab] = useState('application')- useEventBus('config:dialog:hidden').on(disclosure.cancel)+ // 服务重启/退出前由 store 触发,命令式收起本对话框(卸载时自动注销)+ useListener(hooks['config.dialog.hidden'].on, disclosure.cancel)return (<Modal isOpen={disclosure.visible} onOpenChange={disclosure.cancel}>diff --git a/src/components/download-core-dialog.tsx b/src/ui/dialog/update-core.tsxsimilarity index 74%rename from src/components/download-core-dialog.tsxrename to src/ui/dialog/update-core.tsxindex ebc9b6cd..0b036a1f 100644--- a/src/components/download-core-dialog.tsx+++ b/src/ui/dialog/update-core.tsx@@ -1,13 +1,13 @@import type { PropsWithOverlays } from '@overlastic/react'-import type { HarnessCore } from '../hooks/use-dsh-cores'-import type { InstallProgress } from '@/store/modules/harness/types'+import type { InstallProgress } from '@/store/modules/harness'+import type { HarnessCore } from '@/types'import { AlertDialog, Button, Spinner } from '@heroui/react'import { useDisclosure } from '@overlastic/react'-import { listen } from '@tauri-apps/api/event'import { useEffect, useState } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'-import { PanelProgress } from './panel-progress'+import { Panel } from '@/components/panel'+import { useListen } from '@/hooks/use-listen'/*** 核心版本下载对话框:复用首次安装(setup)的 `install-progress` 事件流,@@ -16,9 +16,9 @@ import { PanelProgress } from './panel-progress'* 用法(overlastic holder):* ```tsx* const [dialog, openDownload] = useOverlay(DownloadCoreDialog, { type: 'holder' })- * await openDownload({ tag, version, runDownload: (tag) => downloadCore(tag) })+ * await openDownload({ tag, version, runDownload: (tag) => download.mutateAsync(tag) })* ```- * `runDownload` 由调用方注入(通常是 useDshCores 的 downloadCore),对话框负责+ * `runDownload` 由调用方注入(「核心」面板的 download mutation),对话框负责* 监听进度事件并在结束后 resolve/reject。*/export interface DownloadCoreDialogProps extends PropsWithOverlays {@@ -39,32 +39,24 @@ export function DownloadCoreDialog(props: DownloadCoreDialogProps) {const [errorMsg, setErrorMsg] = useState<string | null>(null)const error = errorMsg != null- // 对话框打开后:监听 install-progress 事件驱动进度,同时执行下载;- // 下载成功 → confirm() 关闭并 resolve,失败 → 展示错误 + 关闭按钮。+ // 进度事件:下载/解压阶段由后端 `install-progress` 推送;对话框随 holder 挂载,+ // 仅在打开期存在,因此按组件生命周期订阅即可(卸载自动注销)。+ useListen<InstallProgress>('install-progress', (event) => {+ const payload = event.payload+ // 只前进不后退(下载阶段 0-50,解压阶段 50-100,事件可能乱序到达)+ setPercentage(prev => Math.max(prev, payload.percentage))+ if (payload.log) {+ setLogs(prev => [...prev, payload.log].slice(-5))+ }+ })++ // 打开后执行下载,成功 → confirm() 关闭并 resolve,失败 → 展示错误 + 关闭按钮。+ // 需要在下一次打开/卸载时取消回调,因此保留带清理的 effect。useEffect(() => {if (!disclosure.visible) {return}- let unlisten: (() => void) | undefinedlet cancelled = false- listen<InstallProgress>('install-progress', (e) => {- if (cancelled) {- return- }- const payload = e.payload- // 只前进不后退(下载阶段 0-50,解压阶段 50-100,事件可能乱序到达)- setPercentage(prev => Math.max(prev, payload.percentage))- if (payload.log) {- setLogs(prev => [...prev, payload.log].slice(-5))- }- })- .then((fn) => {- // 竞态防护:组件已卸载而 listen 才 resolve → 立即注销防泄漏- if (cancelled)- fn()- else unlisten = fn- })- .catch(() => {})props.runDownload(props.tag).then(() => {@@ -80,7 +72,6 @@ export function DownloadCoreDialog(props: DownloadCoreDialogProps) {return () => {cancelled = true- unlisten?.()}// eslint-disable-next-line react/exhaustive-deps -- 仅打开时执行一次}, [disclosure.visible])@@ -107,7 +98,7 @@ export function DownloadCoreDialog(props: DownloadCoreDialogProps) {else={(<div className="flex flex-col gap-3"><p className="break-all font-mono text-xs leading-[1.7] text-danger">{errorMsg}</p>- <PanelProgress logs={logs} />+ <Panel.Progress logs={logs} /></div>)}>@@ -116,7 +107,7 @@ export function DownloadCoreDialog(props: DownloadCoreDialogProps) {<Spinner size="sm" color="current" /><span className="text-xs text-muted">{t('core.downloading_hint', { version: props.version })}</span></div>- <PanelProgress percentage={percentage} logs={logs} />+ <Panel.Progress percentage={percentage} logs={logs} /></div></If></AlertDialog.Body>diff --git a/src/components/desktop-update-dialog.tsx b/src/ui/dialog/update.tsxsimilarity index 99%rename from src/components/desktop-update-dialog.tsxrename to src/ui/dialog/update.tsxindex c22be39d..37d111b5 100644--- a/src/components/desktop-update-dialog.tsx+++ b/src/ui/dialog/update.tsx@@ -4,8 +4,8 @@ import { useDisclosure } from '@overlastic/react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'import { useStore } from 'valtio-define'+import { Info } from '@/components/info'import { store } from '@/store'-import { Info } from './info'export interface DesktopUpdateDialogProps extends PropsWithOverlays {}diff --git a/src/pet/components/pet-hint.tsx b/src/ui/pet/hint.tsxsimilarity index 63%rename from src/pet/components/pet-hint.tsxrename to src/ui/pet/hint.tsxindex 75970373..2ecfb638 100644--- a/src/pet/components/pet-hint.tsx+++ b/src/ui/pet/hint.tsx@@ -1,21 +1,20 @@+import { IS_ZH } from '@/pet/utils/bubble'+/**- * pet-hint.tsx — 桌宠窗口里唯一会出现的文字提示。+ * hint.tsx — 桌宠窗口里唯一会出现的文字提示。** 桌宠窗口是透明置顶小窗,**没有任何其它 UI 或 i18n 基础设施**(气泡文案同样就地取- * 单语),所以这里按窗口语言就近给出单句提示。静默留空是不行的:用户看到的是- * 「宠物加载不出来」,既不知道原因也不知道去哪修。+ * 单语),所以这里按窗口语言(`pet/utils/bubble` 的 `IS_ZH`,与气泡文案同源)就近给出+ * 单句提示。静默留空是不行的:用户看到的是「宠物加载不出来」,既不知道原因也不知道去哪修。*/-const IS_ZH = (typeof document !== 'undefined' ? document.documentElement.lang || navigator.language : 'zh-CN')- .toLowerCase()- .startsWith('zh')-export interface PetHintProps {+export interface HintProps {/** 已选中的宠物 id(用于提示里点名,便于用户回设置页找到它)。 */petId: string}/** 选中的宠物解析不出资源时的可见提示(导入的宠物被删除、清单里没有这个 id 等)。 */-export function PetHint(props: PetHintProps) {+export function Hint(props: HintProps) {return (<div className="pointer-events-none absolute inset-x-0 bottom-6 flex justify-center select-none"><div className="max-w-[95%] rounded-lg bg-black/70 px-3 py-1.5 text-center text-xs leading-relaxed text-white">diff --git a/src/components/plugin-recovery.tsx b/src/ui/plugin/recovery.tsxsimilarity index 81%rename from src/components/plugin-recovery.tsxrename to src/ui/plugin/recovery.tsxindex 036a5b67..23e5e39a 100644--- a/src/components/plugin-recovery.tsx+++ b/src/ui/plugin/recovery.tsx@@ -1,16 +1,14 @@import { CircleExclamation, ShieldCheck } from '@gravity-ui/icons'import { Button, Chip, Description, Spinner } from '@heroui/react'+import { useWatch } from '@reause/core'import { invoke } from '@tauri-apps/api/core'-import { useEffect, useState } from 'react'+import { useState } from 'react'import { useTranslation } from 'react-i18next'import { If } from 'react-if-lite'import { useStore } from 'valtio-define'import { store } from '@/store'import { silence } from '@/utils/silence'-/** 插件异常修复界面最多自动提示的次数(与 store 的 MAX_RECOVERY_ATTEMPTS 一致) */-const MAX_RECOVERY_ATTEMPTS = 3-/** 失败原因 → i18n 键映射(title / detail,detail 用 {{detail}} 插值) */const REASON_KEYS: Record<string, { title: string, detail: string }> = {duplicate_route: { title: 'recovery.reason.duplicate_route.title', detail: 'recovery.reason.duplicate_route.detail' },@@ -30,22 +28,24 @@ const REASON_KEYS: Record<string, { title: string, detail: string }> = {* 主按钮「卸除此插件并继续检测」。* - 运行期异常(应用仍在运行):渲染醒目对话框(不阻断使用),可「暂不处理」。*- * 数据全部来自 harness store 的 `recovery` 状态(`plugin-recovery-required`+ * 数据全部来自 recovery store 的 `recovery` 状态(`plugin-recovery-required`* 事件 / 启动失败检测触发),不在组件内自行拉取。*/-export function PluginRecovery({ fullScreen = false }: { fullScreen?: boolean }) {+export function Recovery({ fullScreen = false }: { fullScreen?: boolean }) {const { t } = useTranslation()- const { recovery } = useStore(store.harness)+ const { recovery, exhausted } = useStore(store.recovery)// 检测问题插件哪些已有单插件快照:仅对「确实有快照」的插件提供「从快照还原」入口// (issue #303)。无快照的插件还原会 SNAPSHOT_NOT_FOUND,故必须按 id 过滤,// 避免多插件场景下整体还原失败。const [restorableIds, setRestorableIds] = useState<string[]>([])- useEffect(() => {+ // 检测并列出「确有快照」的插件 id(挂载与 recovery 变化时各查一次)。+ // 用 reause `useWatch` 观察恢复态,不再自建 effect + dispose 标志:+ // 请求完成后的 setState 在已卸载组件上是 no-op,无需手动取消。+ useWatch([recovery.required, recovery.info], () => {if (!recovery.required || !recovery.info) {return}- let disposed = falsePromise.all(recovery.info.plugins.map(async (id) => {try {const r = await invoke<{ exists: boolean }>('get_plugin_backup', { id })@@ -56,19 +56,12 @@ export function PluginRecovery({ fullScreen = false }: { fullScreen?: boolean })return null}}))- .then((results) => {- if (!disposed)- setRestorableIds(results.filter((id): id is string => id !== null))- })+ .then(results => setRestorableIds(results.filter((id): id is string => id !== null))).catch((err) => {- console.error('[PluginRecovery] check snapshot failed:', err)- if (!disposed)- setRestorableIds([])+ console.error('[Recovery] check snapshot failed:', err)+ setRestorableIds([])})- return () => {- disposed = true- }- }, [recovery.required, recovery.info])+ }, { immediate: true })if (!recovery.required || !recovery.info) {return null@@ -76,7 +69,6 @@ export function PluginRecovery({ fullScreen = false }: { fullScreen?: boolean })const info = recovery.infoconst multiple = info.plugins.length > 1- const exhausted = recovery.attempts >= MAX_RECOVERY_ATTEMPTSconst reasonKeys = REASON_KEYS[info.reason] ?? REASON_KEYS.unknownconst heading = multiple? t('recovery.heading_many', { count: info.plugins.length })@@ -98,7 +90,13 @@ export function PluginRecovery({ fullScreen = false }: { fullScreen?: boolean }): 'fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4'}><div className={`w-full ${fullScreen ? 'max-w-[640px]' : 'max-w-[560px]'}`}>- <div className={`rounded-xl border bg-panel2/40 p-6${fullScreen ? '' : ' shadow-sm'}`}>+ {/* 运行期弹窗必须是**不透明**面板:`bg-panel2/40` 只有 40% 不透明度,页面内容会直接+ 透出来(表现为「弹窗透明、与页面内容重叠」);全屏恢复页底下是实心 `bg-canvas`,+ 半透明面板才是想要的层次感,故只在非 fullScreen 分支换成实心 `bg-panel`。 */}+ <div className={fullScreen+ ? 'rounded-xl border border-line bg-panel2/40 p-6'+ : 'rounded-xl border border-line bg-panel p-6 shadow-lg'}+ ><div className="mb-4 flex items-center gap-3"><div className="flex size-12 shrink-0 items-center justify-center rounded-full bg-danger/10 text-danger"><CircleExclamation className="size-6" />@@ -144,7 +142,7 @@ export function PluginRecovery({ fullScreen = false }: { fullScreen?: boolean })<ButtonclassName="rounded-md"variant="primary"- onPress={() => store.harness.restoreAndRedetect(restorableIds)}+ onPress={() => store.recovery.restoreAndRedetect(restorableIds)}><span className="flex items-center gap-1"><If cond={recovery.busy} then={<Spinner size="sm" color="current" />} />@@ -155,7 +153,7 @@ export function PluginRecovery({ fullScreen = false }: { fullScreen?: boolean })<ButtonclassName="rounded-md"variant="danger"- onPress={() => store.harness.recoverAndRedetect(info.plugins)}+ onPress={() => store.recovery.recoverAndRedetect(info.plugins)}><span className="flex items-center gap-1"><If cond={recovery.busy} then={<Spinner size="sm" color="current" />} />@@ -171,7 +169,7 @@ export function PluginRecovery({ fullScreen = false }: { fullScreen?: boolean }){t('buttons.safe_mode')}</span></Button>- <Button className="rounded-md" variant="ghost" onPress={() => store.harness.dismissRecovery()}>+ <Button className="rounded-md" variant="ghost" onPress={() => store.recovery.dismissRecovery()}>{t('recovery.dismiss')}</Button></div>diff --git a/src/utils/clipboard.ts b/src/utils/clipboard.tsindex c4b3d8cc..712be61f 100644--- a/src/utils/clipboard.ts+++ b/src/utils/clipboard.ts@@ -1,14 +1,27 @@import { invoke } from '@tauri-apps/api/core'+import i18next from 'i18next'+import { toast } from './toast'/**- * 把纯文本写入系统剪贴板。+ * 把纯文本写入系统剪贴板,并统一给出成功 / 失败的 toast 提示。** 走原生 `write_clipboard_text` 命令(`bridge::clipboard`),而不再用* `@tauri-apps/plugin-clipboard-manager`:后者在应用启动时于主线程创建并持有单例* `arboard::Clipboard`,在 Linux Wayland 合成器不支持 `ext-data-control`/* `wlr-data-control` 时会导致「复制运行日志」崩溃/挂死。原生命令按次在* `spawn_blocking` 中惰性新建短期剪贴板句柄,用完即弃,规避该崩溃。+ *+ * 提示收敛在这里,调用方不必再各写一份 toast:`message` 覆盖成功文案(默认+ * 「已复制到剪贴板」,可传 `t('messages.logs_copied')` 等更具体的文案);+ * 失败时统一提示并**继续抛出**,调用方只需记录日志。*/-export function writeClipboardText(text: string): Promise<void> {- return invoke<void>('write_clipboard_text', { text })+export async function writeClipboardText(text: string, message?: string): Promise<void> {+ try {+ await invoke<void>('write_clipboard_text', { text })+ toast(message ?? i18next.t('messages.clipboard_copied'))+ }+ catch (error) {+ toast(i18next.t('messages.clipboard_failed'), { variant: 'danger' })+ throw error+ }}diff --git a/src/utils/disable-wake-lock.ts b/src/utils/disable-wake-lock.tsdeleted file mode 100644index 3a58d410..00000000--- a/src/utils/disable-wake-lock.ts+++ /dev/null@@ -1,65 +0,0 @@-/**- * 禁用 Screen Wake Lock(页面可申请的「屏幕唤醒锁」)。- *- * 背景(issue #469):桌宠窗口用 `<video>` 播放 WebM 动画,播放期间系统无法息屏——- * Windows 无视「关闭显示器」超时,屏幕永远不黑,还长时间空占 CPU。- *- * # 这里挡的是哪把锁(两把锁不要混淆)- *- * 1. **Screen Wake Lock(本模块)**:页面经 `navigator.wakeLock.request('screen')`- * 主动申请的锁。任何页面代码(dsh 界面、第三方代码、内置插件)都能申请,本应用- * 没有任何常亮的正当需求,因此整体禁掉。- * 2. **Video Wake Lock(不由本模块负责)**:Chromium/WebView2 内部对「播放中- * (未暂停)的 `<video>`」**无条件**申请的 `kPreventDisplaySleep`,与页面是否调用- * wakeLock API、与 muted / 窗口可见性都无关。禁用本模块的 `navigator.wakeLock`- * **不会**释放它——释放它的唯一办法是让视频停下来:`desktop::pet::set_pet_window_visible(false)`- * 会**销毁**桌宠窗口(而不是 hide),webview 随窗口消失,媒体管线一并停止(见- * issue #469 的第二处修复)。`muted` 也不是解药:muted 只影响音频,不解除该锁。- *- * 之所以仍然保留本模块:它把「页面主动申请常亮」这条路径彻底封死,避免将来某个- * 页面(设置页、插件面板)再加一个与桌宠无关的常亮申请;成本只是一次方法替换。- *- * 幂等:两个入口(src/main.tsx 主窗口 / src/pet/main.tsx 桌宠窗口)都会调用,- * 重复调用保留首次记录的原函数,恢复时不会把替换后的实现存成「原函数」。- */--/** 被替换掉的原生实现;仅用于测试恢复环境,业务代码不应调用。 */-let originalRequest: WakeLock['request'] | undefined--/**- * 标记「当前 request 已是本模块的禁用实现」。存在标记时直接跳过,使替换真正幂等- * (不会把替换实现再包一层),也让 restoreWakeLock 能区分原生实现与自己的补丁。- */-const DISABLED_MARKER: unique symbol = Symbol.for('deepseek-harness.wakeLockDisabled') as typeof DISABLED_MARKER--/** 打过补丁的 request:函数类型本身没有 symbol 键,用交叉类型描述这个运行时标记。 */-type MarkedRequest = WakeLock['request'] & { [DISABLED_MARKER]?: boolean }--/**- * 把 `navigator.wakeLock.request` 替换为必失败的实现(幂等)。- *- * 无 Wake Lock API 的环境(旧 WebView2 / 非浏览器)直接 no-op。- */-export function disableWakeLock(): void {- if (typeof navigator === 'undefined' || !('wakeLock' in navigator) || navigator.wakeLock === undefined)- return- const wakeLock = navigator.wakeLock- if ((wakeLock.request as MarkedRequest)[DISABLED_MARKER] === true)- return- originalRequest ??= wakeLock.request.bind(wakeLock)- const request = function request(): Promise<WakeLockSentinel> {- return Promise.reject(new Error('WAKELOCK_DISABLED: screen wake lock is disabled by DeepSeek Harness Desktop'))- }- // 打标记后重复调用直接返回,替换不会被套娃;restoreWakeLock 也据此区分原生实现。- ;(request as MarkedRequest)[DISABLED_MARKER] = true- wakeLock.request = request-}--/** 恢复原生实现并清理记录;仅供测试,业务代码不需要。 */-export function restoreWakeLock(): void {- if (originalRequest === undefined)- return- if (typeof navigator !== 'undefined' && 'wakeLock' in navigator && navigator.wakeLock !== undefined)- navigator.wakeLock.request = originalRequest- originalRequest = undefined-}diff --git a/src/utils/internal-plugin-phase.ts b/src/utils/internal-plugin-phase.tsdeleted file mode 100644index 60a08d02..00000000--- a/src/utils/internal-plugin-phase.ts+++ /dev/null@@ -1,29 +0,0 @@-import type { InternalPluginsPhasePayload } from '@/store/modules/harness/types'--export type InternalPluginPhaseTranslate = (- key: string,- options?: Record<string, number>,-) => string--export function internalPluginReason(- payload: InternalPluginsPhasePayload,- previousReason: string,- translate: InternalPluginPhaseTranslate,-): string {- switch (payload.detail) {- case 'waiting':- return translate('status.internal_waiting')- case 'checking':- return translate('status.internal_checking', { total: payload.total })- case 'installing':- return translate('status.internal_installing', { total: payload.total })- case 'heartbeat':- return previousReason- case 'done':- return translate('status.internal_done', { total: payload.total })- case 'timeout':- return translate('status.internal_timeout')- case 'cancelled':- return translate('status.internal_cancelled')- }-}diff --git a/src/utils/toast.ts b/src/utils/toast.tsindex 03c9a565..696a7e6f 100644--- a/src/utils/toast.ts+++ b/src/utils/toast.ts@@ -1,18 +1,13 @@import type { ToastContentValue } from '@heroui/react/toast'import type { ToastVariants } from '@heroui/styles'import type { ReactNode } from 'react'-import { emitter } from '@hairy/react-lib'import { ToastQueue } from '@heroui/react'+import { hooks } from '@/config/hooks'/** toast() 可选项:库内未暴露的 HeroUIToastOptions(toast-queue 收敛的 content + 超时回调),这里用公开的 ToastContentValue 组合 */export type ToastOptions = Partial<ToastContentValue & { timeout?: number, onClose?: () => void }> & { placement?: Placement }export type ToastUpdateOptions = Partial<ToastContentValue>-export interface ToastUpdateEvent {- key: string- options: ToastUpdateOptions-}-export type Placement = NonNullable<ToastVariants['placement']>export const placements = ['top start',@@ -69,7 +64,7 @@ function forgetKey(key: string): void {/*** 统一 toast API:直接调用创建,toast.update/close/clear 通过 key 管理。- * update 触发 emitter 'toast.update',由 ToastProvider 经 useEventBus 消费后+ * update 触发 `hooks['toast.updated']` 事件(见 config/hooks),由 ToastProvider 消费后* 原地更新对应 queue 的 content(HeroUI ToastQueue 没有 update 方法)。*/export const toast = Object.assign(@@ -103,7 +98,7 @@ export const toast = Object.assign(if (!placementsKeys.has(key))returntoastContents.set(key, { ...(toastContents.get(key) ?? {}), ...options })- emitter.emit('toast.update', { key, options })+ void hooks['toast.updated'].trigger({ key, options })},close(key: string): void {diff --git a/src/utils/zoom.ts b/src/utils/zoom.tsindex c7adb1c8..b6019726 100644--- a/src/utils/zoom.ts+++ b/src/utils/zoom.ts@@ -7,8 +7,8 @@ export interface ZoomShortcutLike {altKey: boolean}+/** iframe 缩放桥消息:宿主按 `type` 分发(来源由 `useIframeMessage` 的 origin 校验负责)。 */interface ZoomBridgeMessage {- source: 'dsh-zoom-shortcut-bridge'type: 'dsh://zoom-shortcut'action: ZoomAction}@@ -31,9 +31,65 @@ export function zoomActionFromBridgeMessage(value: unknown): ZoomAction | null {return nullconst message = value as Partial<ZoomBridgeMessage>- if (message.source !== 'dsh-zoom-shortcut-bridge' || message.type !== 'dsh://zoom-shortcut')+ // 不再校验 `source`:宿主侧由 `useIframeMessage` 的 origin 校验保证来源,+ // 这里只认协议类型与动作(iframe 侧脚本仍会带 source 字段,多一个字段无影响)。+ if (message.type !== 'dsh://zoom-shortcut')return nullif (message.action === 'increase' || message.action === 'decrease' || message.action === 'reset')return message.actionreturn null}++/**+ * Chromium 缩放级别底数:`factor = 1.2^level`。+ *+ * Electron `WebFrame.setZoomLevel` 内部就是这条换算(Tauri 的 WebView 只有比例、+ * 没有级别概念,级别需要在这里换算后落到 `Webview.setZoom`)。+ */+const ZOOM_LEVEL_BASE = 1.2++/** 缩放级别 → 缩放比例 */+export function zoomFactorFromLevel(level: number): number {+ return ZOOM_LEVEL_BASE ** level+}++/** 缩放比例 → 缩放级别(比例不是 1.2 的整数次幂时返回小数) */+export function zoomLevelFromFactor(factor: number): number {+ return Math.log(factor) / Math.log(ZOOM_LEVEL_BASE)+}++/** 默认缩放比例(100%),与 Rust `default_zoom_factor` 一致 */+export const ZOOM_FACTOR_DEFAULT = 1++/** 缩放步长,与 Rust `ZOOM_FACTOR_STEP` 一致 */+export const ZOOM_FACTOR_STEP = 0.1++/** 缩放下限,与 Rust `ZOOM_FACTOR_MIN` 一致 */+export const ZOOM_FACTOR_MIN = 0.5++/** 缩放上限,与 Rust `ZOOM_FACTOR_MAX` 一致 */+export const ZOOM_FACTOR_MAX = 2++/**+ * 归一化缩放比例:夹取到 [0.5, 2.0] 并对齐 0.1 步长+ * (等价 Rust `normalize_zoom_factor`;非有限值回落默认 100%)。+ *+ * 缩放真值存在 `store.setting.zoom_factor`(与 Rust 共享 `.store.dat`,Rust 读取时+ * 会再做一次同样的归一化),这里保证前端写入前就落在合法档位上,避免出现+ * 「设置面板选项选不中当前值」这类视觉漂移。+ */+export function normalizeZoomFactor(value: number): number {+ if (!Number.isFinite(value))+ return ZOOM_FACTOR_DEFAULT+ const grid = 1 / ZOOM_FACTOR_STEP+ const clamped = Math.min(Math.max(value, ZOOM_FACTOR_MIN), ZOOM_FACTOR_MAX)+ return Math.round(clamped * grid) / grid+}++/** 按缩放动作计算下一档比例(increase/decrease 走 0.1 步长,reset 回 100%) */+export function nextZoomFactor(current: number, action: ZoomAction): number {+ if (action === 'reset')+ return ZOOM_FACTOR_DEFAULT+ const delta = action === 'increase' ? ZOOM_FACTOR_STEP : -ZOOM_FACTOR_STEP+ return normalizeZoomFactor(current + delta)+}diff --git a/tailwind.config.js b/tailwind.config.jsindex a6a1d320..e3b3ba20 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -4,7 +4,7 @@ export default {theme: {extend: {colors: {- // 主题色通过 CSS 变量定义(见 src/style/main.css),+ // 主题色通过 CSS 变量定义(见 src/styles/main.css),// 由 <html data-theme="light"> 在浅色/深色之间切换'canvas': 'var(--color-canvas)','panel': 'var(--color-panel)',diff --git a/test/backup.test.ts b/test/backup.test.tsindex 8cf2dc7f..29776308 100644--- a/test/backup.test.ts+++ b/test/backup.test.ts@@ -65,12 +65,12 @@ describe('backup settings normalization', () => {describe('configBackup component contract', () => {it('exports a named ConfigBackup function', () => {- const source = readFileSync(new URL('../src/components/config-backup.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/backup.tsx', import.meta.url), 'utf8')expect(source).toContain('export function ConfigBackup')})it('invokes all four backup Tauri commands', () => {- // 遵循 useDshProfiles 模式:组件通过 useBackups 钩子调用命令,钩子内部 invoke+ // 遵循档案面板模式:组件通过 useBackups 钩子调用命令,钩子内部 invokeconst source = readFileSync(new URL('../src/hooks/use-backup.ts', import.meta.url), 'utf8')expect(source).toContain('backup_profile')expect(source).toContain('restore_profile')@@ -79,7 +79,7 @@ describe('configBackup component contract', () => {})it('uses useTranslation with no hardcoded English/Chinese strings', () => {- const source = readFileSync(new URL('../src/components/config-backup.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/backup.tsx', import.meta.url), 'utf8')expect(source).toContain('useTranslation')// 不应出现裸中文字符串(i18n key 通过 t() 传入)const cjkRange = '[\\u4e00-\\u9fff]'@@ -87,7 +87,7 @@ describe('configBackup component contract', () => {})it('stays within the shell conventions', () => {- const source = readFileSync(new URL('../src/components/config-backup.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/backup.tsx', import.meta.url), 'utf8')expect(source).not.toContain('useCallback')expect(source).not.toContain('useMemo')})@@ -105,8 +105,12 @@ describe('useBackups hook contract', () => {expect(source).toContain('useMutation')})- it('listens to the setting_updated event', () => {+ it('invalidates on the setting_updated event through the shared hook', () => {const source = readFileSync(new URL('../src/hooks/use-backup.ts', import.meta.url), 'utf8')- expect(source).toContain('setting_updated')+ expect(source).toContain('useInvalidateOnSettingUpdated')++ // 事件名收敛在共享 hook 里,此处断言它仍是 setting_updated+ const shared = readFileSync(new URL('../src/hooks/use-invalidate-on-setting-updated.ts', import.meta.url), 'utf8')+ expect(shared).toContain('setting_updated')})})diff --git a/test/clipboard.test.ts b/test/clipboard.test.tsindex 450a92a0..4286379d 100644--- a/test/clipboard.test.ts+++ b/test/clipboard.test.ts@@ -8,9 +8,9 @@ vi.mock('@tauri-apps/api/core', () => ({}))const CLIPBOARD_CALL_SITES = [- '../src/components/config-debug.tsx',+ '../src/ui/config/debug.tsx','../src/layout/components/navbar.tsx',- '../src/layout/components/preinstall-setup.tsx',+ '../src/layout/components/setup-preinstall.tsx','../src/layout/components/setup.tsx',]@@ -19,20 +19,23 @@ describe('clipboard integration', () => {vi.resetAllMocks()})- it('routes every shell copy action through the native helper and handles failures', () => {+ it('routes every shell copy action through the native helper', () => {for (const path of CLIPBOARD_CALL_SITES) {const source = readFileSync(new URL(path, import.meta.url), 'utf8')expect(source).not.toContain('navigator.clipboard.writeText')-- const nativeWrite = source.indexOf('writeClipboardText(')- expect(nativeWrite).toBeGreaterThan(-1)-- const failurePath = source.slice(nativeWrite, nativeWrite + 500)- expect(failurePath).toContain('catch (err)')- expect(failurePath).toContain('messages.logs_copy_failed')+ expect(source).toContain('writeClipboardText(')+ // 成功/失败提示统一在 helper 内弹出,调用点不再各写一份 danger toast+ expect(source).not.toContain('messages.logs_copy_failed')}})+ it('toasts success and failure inside the helper', () => {+ const source = readFileSync(new URL('../src/utils/clipboard.ts', import.meta.url), 'utf8')+ expect(source).toContain('toast(')+ expect(source).toContain('messages.clipboard_copied')+ expect(source).toContain('messages.clipboard_failed')+ })+it('writes the exact text through the native clipboard command', async () => {vi.mocked(invoke).mockResolvedValue(undefined as never)diff --git a/test/clone-profile.test.ts b/test/clone-profile.test.tsindex e008028a..b4e1b5ef 100644--- a/test/clone-profile.test.ts+++ b/test/clone-profile.test.ts@@ -10,7 +10,7 @@ import { describe, expect, it } from 'vitest'*/describe('cloneProfile mutation shape', () => {it('invokes clone_profile with sourceId + name and invalidates queries', () => {- const source = readFileSync(new URL('../src/hooks/use-dsh-profiles.ts', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).toContain('clone_profile')expect(source).toContain('sourceId')@@ -19,25 +19,24 @@ describe('cloneProfile mutation shape', () => {expect(source).toMatch(/onSuccess:\s*invalidate/)})- it('exposes cloneProfile in the return type and object', () => {- const source = readFileSync(new URL('../src/hooks/use-dsh-profiles.ts', import.meta.url), 'utf8')+ it('wires the cloneProfile helper to the clone mutation', () => {+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')- expect(source).toMatch(/cloneProfile\s*[:(]/)- expect(source).toMatch(/UseDshProfilesResult/)- expect(source).toMatch(/cloneProfile\s*:\s*\(sourceId\s*:\s*string,\s*name\s*:\s*string\)\s*=>\s*Promise\s*<\s*Profile\s*>/)+ expect(source).toMatch(/cloneProfile\s*\(sourceId\s*:\s*string,\s*name\s*:\s*string\)/)+ expect(source).toMatch(/clone\.mutateAsync\(\{\s*sourceId,\s*name\s*\}\)/)})it('extends busy to include clone.isPending', () => {- const source = readFileSync(new URL('../src/hooks/use-dsh-profiles.ts', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).toMatch(/clone\.isPending/)- expect(source).toMatch(/busy:\s*create\.isPending\s*\|\|\s*activate\.isPending\s*\|\|\s*remove\.isPending\s*\|\|\s*clone\.isPending/)+ expect(source).toMatch(/busy\s*=\s*create\.isPending\s*\|\|\s*activate\.isPending\s*\|\|\s*remove\.isPending\s*\|\|\s*clone\.isPending/)})})describe('clone Chip + naming dialog in ConfigProfile', () => {it('renders a Clone Chip on non-default rows with profiles.clone label', () => {- const source = readFileSync(new URL('../src/components/config-profile.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).toMatch(/profiles\.clone['"]/)expect(source).toMatch(/cond=\{!profile\.default\}/)@@ -50,13 +49,13 @@ describe('clone Chip + naming dialog in ConfigProfile', () => {})it('disables the Clone Chip while busy', () => {- const source = readFileSync(new URL('../src/components/config-profile.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).toMatch(/cursor-not-allowed opacity-50/)})it('provides a naming dialog with description, editable Input, and confirm button', () => {- const source = readFileSync(new URL('../src/components/config-profile.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).toMatch(/profiles\.clone_dialog_desc/)expect(source).toMatch(/profiles\.clone_confirm/)@@ -66,7 +65,7 @@ describe('clone Chip + naming dialog in ConfigProfile', () => {})it('shows accent success toast with NO restart action', () => {- const source = readFileSync(new URL('../src/components/config-profile.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).toMatch(/profiles\.clone_success/)expect(source).toMatch(/variant:\s*['"]accent['"]/)@@ -79,7 +78,7 @@ describe('clone Chip + naming dialog in ConfigProfile', () => {})it('keeps dialog open on failure with an error toast', () => {- const source = readFileSync(new URL('../src/components/config-profile.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).toMatch(/profiles\.clone_failed/)})@@ -114,7 +113,7 @@ describe('i18n parity', () => {describe('shell conventions', () => {it('does not use useCallback / useMemo / hardcoded user-facing strings', () => {- const source = readFileSync(new URL('../src/components/config-profile.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/profile.tsx', import.meta.url), 'utf8')expect(source).not.toContain('useCallback')expect(source).not.toContain('useMemo')diff --git a/test/close-action.test.ts b/test/close-action.test.tsindex 2319f2ac..c708c93f 100644--- a/test/close-action.test.ts+++ b/test/close-action.test.ts@@ -31,17 +31,28 @@ describe('close action normalization', () => {})describe('config close action control contract', () => {- it('invokes update_app_config once with a camelCase closeAction payload', () => {- const source = readFileSync(new URL('../src/components/config-close-action.tsx', import.meta.url), 'utf8')+ it('reads closeAction from the setting store and writes it through the backend command', () => {+ const source = readFileSync(new URL('../src/ui/config/components/close-action.tsx', import.meta.url), 'utf8')expect(source).toContain('export function ConfigCloseAction')- expect(source).toContain('invoke<AppConfig>(\'update_app_config\', { closeAction')+ // 读走 setting store(与 Rust 共享 .store.dat,后端改动经 setting_updated 回流)+ expect(source).toContain('useStore(store.setting)')+ // 写仍走命令:后端归一化并在锁内落盘,避免与 Rust 的整对象写入互相覆盖+ expect(source).toContain('invoke(\'update_app_config\', { closeAction')// 受控值始终经归一化,未加载到配置时回落 tray 而不是给 HeroUI 传 undefinedexpect(source).toContain('selectedKey={normalizeCloseAction(')})+ it('no longer carries its own config query cache', () => {+ const source = readFileSync(new URL('../src/ui/config/components/close-action.tsx', import.meta.url), 'utf8')++ expect(source).not.toContain('useQueryClient')+ expect(source).not.toContain('useAppConfig')+ expect(source).not.toContain('setQueryData')+ })+it('surfaces failures as a danger toast without a success toast', () => {- const source = readFileSync(new URL('../src/components/config-close-action.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/components/close-action.tsx', import.meta.url), 'utf8')expect(source).toContain('messages.close_action_failed')expect(source).toContain('variant: \'danger\'')@@ -49,7 +60,7 @@ describe('config close action control contract', () => {})it('stays within the shell conventions', () => {- const source = readFileSync(new URL('../src/components/config-close-action.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/components/close-action.tsx', import.meta.url), 'utf8')expect(source).not.toContain('useCallback')expect(source).not.toContain('useMemo')diff --git a/test/disable-wake-lock.test.ts b/test/disable-wake-lock.test.tsdeleted file mode 100644index aaeb3fe8..00000000--- a/test/disable-wake-lock.test.ts+++ /dev/null@@ -1,105 +0,0 @@-// @vitest-environment node-import type { Mock } from 'vitest'-import { readFileSync } from 'node:fs'-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'-import { disableWakeLock, restoreWakeLock } from '../src/utils/disable-wake-lock'--/**- * 原生 `navigator.wakeLock.request` 的替身:默认放行并返回一个哨兵对象,- * `acquire` 记录调用次数,用来证明「禁用后页面再也拿不到唤醒锁」而不是只看抛不抛错。- */-function createWakeLockStub() {- const request = vi.fn((type: WakeLockType) => Promise.resolve({ type, release: vi.fn() })) as Mock<WakeLock['request']>- Object.defineProperty(navigator, 'wakeLock', {- configurable: true,- // 赋值断言:Node 环境没有原生 WakeLock 实现,这里用替身顶上- value: { request },- writable: true,- })- return request-}--function removeWakeLock() {- Reflect.deleteProperty(navigator, 'wakeLock')-}--describe('disableWakeLock', () => {- beforeEach(() => {- removeWakeLock()- })-- afterEach(() => {- restoreWakeLock()- removeWakeLock()- })-- it('rejects every screen wake lock request so the screen can sleep again', async () => {- const native = createWakeLockStub()- disableWakeLock()-- await expect(navigator.wakeLock.request('screen')).rejects.toThrow('WAKELOCK_DISABLED')- // 关键回归点:不只是抛错,原生的加锁入口必须一次都没被走到。- expect(native).not.toHaveBeenCalled()- })-- it('rejects system wake lock requests as well', async () => {- const native = createWakeLockStub()- disableWakeLock()-- await expect(navigator.wakeLock.request('system')).rejects.toThrow('WAKELOCK_DISABLED')- expect(native).not.toHaveBeenCalled()- })-- it('leaves the sentinel released state unreachable (no lock is ever handed out)', async () => {- createWakeLockStub()- disableWakeLock()-- const acquired = await navigator.wakeLock.request('screen').catch((error: unknown) => error)- expect(acquired).toBeInstanceOf(Error)- // 唤醒锁不该以「返回了对象」的形式静默生效;页面拿到的只能是 Error。- expect(acquired).not.toHaveProperty('release')- })-- it('is idempotent across both entry points and never chains its own override', async () => {- const native = createWakeLockStub()- disableWakeLock()- const patched = navigator.wakeLock.request- disableWakeLock()-- expect(navigator.wakeLock.request).toBe(patched)- restoreWakeLock()- // 恢复后必须能真正加锁:重复调用若把替换实现记成「原函数」,这里就会永远 reject。- await expect(navigator.wakeLock.request('screen')).resolves.toBeDefined()- expect(native).toHaveBeenCalledOnce()- })-- it('is a no-op when the environment has no Wake Lock API', () => {- expect(() => disableWakeLock()).not.toThrow()- expect(() => restoreWakeLock()).not.toThrow()- })-})--describe('pet window wake lock contract', () => {- /**- * 桌宠窗口是常驻播放的 WebView:只要动画 `<video>` 没被禁用唤醒锁,系统就无法息屏- * (issue #469)。这里锁死两个入口都调用了 disableWakeLock,避免将来只改一个入口。- */- it('disables the wake lock in both window entries', () => {- const mainSource = readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8')- const petSource = readFileSync(new URL('../src/pet/main.tsx', import.meta.url), 'utf8')-- expect(mainSource).toContain('disableWakeLock()')- expect(petSource).toContain('disableWakeLock()')- })-- it('keeps every pet animation video muted', () => {- // 视频层已整体交给 dsh-pet-component(src/pet 不再自带 <video>):断言渲染器的- // 双缓冲视频都显式静音 —— 桌宠动画一旦出声就是回归(与 #469 同源的常驻播放契约)。- const bundle = readFileSync(- new URL('../node_modules/dsh-pet-component/dist/index.mjs', import.meta.url),- 'utf8',- )- const muted = bundle.match(/muted:\s*true/g) ?? []- expect(muted.length).toBeGreaterThanOrEqual(2)- })-})diff --git a/test/index.test.ts b/test/index.test.tsindex 1589107d..a43c453f 100644--- a/test/index.test.ts+++ b/test/index.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { containsInotifyLimitError, formatLogLine, pickErrorLines } from '../src/utils/log'+import { containsInotifyLimitError, formatLogLine, pickErrorLines } from '../src/components/logs.utils'describe('formatLogLine', () => {it('strips the official GitHub release download prefix', () => {diff --git a/test/internal-plugin-phase.test.ts b/test/internal-plugin-phase.test.tsindex a03d7d6f..727d3070 100644--- a/test/internal-plugin-phase.test.ts+++ b/test/internal-plugin-phase.test.ts@@ -1,8 +1,8 @@-import type { InternalPluginsPhasePayload } from '../src/store/modules/harness/types'+import type { InternalPluginsPhasePayload } from '../src/store/modules/harness'import { readFileSync } from 'node:fs'import { describe, expect, it } from 'vitest'-import { INTERNAL_PLUGIN_PHASE_DETAILS } from '../src/store/modules/harness/types'-import { internalPluginReason } from '../src/utils/internal-plugin-phase'+import { INTERNAL_PLUGIN_PHASE_DETAILS } from '../src/store/modules/harness'+import { internalPluginReason } from '../src/store/modules/harness/utils'function translate(key: string): string {return keydiff --git a/test/menu-restart.test.ts b/test/menu-restart.test.tsindex f6bab423..2c134ee9 100644--- a/test/menu-restart.test.ts+++ b/test/menu-restart.test.ts@@ -9,10 +9,6 @@ const i18nSource = readFileSync(new URL('../src-tauri/src/config/i18n.rs', import.meta.url),'utf8',)-const hookSource = readFileSync(- new URL('../src/layout/components/use-macos-app-menu.ts', import.meta.url),- 'utf8',-)const navbarSource = readFileSync(new URL('../src/layout/components/navbar.tsx', import.meta.url),'utf8',@@ -38,21 +34,28 @@ describe('menu restart backend contract', () => {})describe('menu restart frontend contract', () => {- it('exposes restartHarness in MacOSAppMenuActions interface', () => {- expect(hookSource).toContain('restartHarness: () => void')+ it('subscribes to the macOS menu event inside the navbar', () => {+ // use-macos-app-menu 已内联进 navbar:断言订阅与事件名都在 navbar 里+ expect(navbarSource).toContain('useListen<string>')+ expect(navbarSource).toContain('\'macos-menu-action\'')})- it('dispatches desktop-restart to actionsRef.current.restartHarness()', () => {- // 断言 menu-event case 到 restartHarness() 的分发关系,而非孤立 token:- // 要求 'desktop-restart' 分支精确调用 actionsRef.current.restartHarness(),- // 避免 token 出现在无关代码中时仍能通过。- expect(hookSource).toMatch(- /case 'desktop-restart':\s*actionsRef\.current\.restartHarness\(\)/,- )+ it('dispatches every native menu action', () => {+ for (const action of [+ 'desktop-config',+ 'desktop-about',+ 'desktop-copy-run-logs',+ 'desktop-check-update',+ 'desktop-restart',+ ]) {+ expect(navbarSource).toContain(`case '${action}':`)+ }})- it('wires restartHarness to store.harness.restart in navbar', () => {- expect(navbarSource).toContain('restartHarness:')- expect(navbarSource).toContain('store.harness.restart')+ it('dispatches desktop-restart to store.harness.restart()', () => {+ // 断言 menu-event case 到 restart 的分发关系,而非孤立 token。+ expect(navbarSource).toMatch(+ /case 'desktop-restart':\s*void store\.harness\.restart\(\)/,+ )})})diff --git a/test/plugin-disable.test.ts b/test/plugin-disable.test.tsindex 38f56f48..d5452cfb 100644--- a/test/plugin-disable.test.ts+++ b/test/plugin-disable.test.ts@@ -3,35 +3,34 @@ import { describe, expect, it } from 'vitest'describe('plugin disable/enable frontend contract', () => {it('config-plugin.tsx defines onDisable and onEnable handlers', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('onDisable')expect(source).toContain('onEnable')})- it('config-plugin.tsx consumes the disable/enable hook helpers', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ it('config-plugin.tsx invokes the disable/enable commands directly', () => {+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')- // 组件通过 hook 暴露的 disablePlugin/enablePlugin 调用(命令名在 hook 文件内),- // 与 upgrade/remove 直接 invoke 的模式一致地封装到可复用 helper。- expect(source).toContain('disablePlugin(')- expect(source).toContain('enablePlugin(')+ // 面板直接持有 enable/disable mutation(与 upgrade/remove 同一层级)+ expect(source).toContain('disable_dsh_plugin')+ expect(source).toContain('enable_dsh_plugin')})it('config-plugin.tsx renders a Disabled badge via plugins.disabled_badge', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('plugins.disabled_badge')})it('config-plugin.tsx extends the busy state union with disable + enable', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('\'update\' | \'remove\' | \'disable\' | \'enable\'')})it('config-plugin.tsx does NOT open a confirmation dialog for disable (reversible action)', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')// onDisable must not call openDialog — the disable handler is a direct action,// unlike onRemove which confirms via openDialog. We assert the onDisable block@@ -41,11 +40,12 @@ describe('plugin disable/enable frontend contract', () => {expect(onDisableMatch![0]).not.toContain('openDialog')})- it('use-dsh-plugins.ts exposes disable_dsh_plugin and enable_dsh_plugin invoke calls', () => {- const source = readFileSync(new URL('../src/hooks/use-dsh-plugins.ts', import.meta.url), 'utf8')+ it('config-plugin.tsx owns the plugin list query and update probe', () => {+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')- expect(source).toContain('disable_dsh_plugin')- expect(source).toContain('enable_dsh_plugin')+ expect(source).toContain('get_dsh_plugins')+ expect(source).toContain('refresh_plugin_updates')+ expect(source).toContain('queryKeys.plugins')})it('en-US.json contains all 7 disable/enable i18n keys', () => {@@ -73,7 +73,7 @@ describe('plugin disable/enable frontend contract', () => {})it('config-plugin.tsx stays within shell conventions (no useCallback/useMemo)', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).not.toContain('useCallback')expect(source).not.toContain('useMemo')diff --git a/test/plugin-uninstall.test.ts b/test/plugin-uninstall.test.tsindex ae460e78..f92ec7b6 100644--- a/test/plugin-uninstall.test.ts+++ b/test/plugin-uninstall.test.ts@@ -33,12 +33,12 @@ describe('plugin preset chip i18n keys', () => {// ── Suite B — component references the preset key + condition ────────────────describe('configPlugin preset chip', () => {it('renders the plugins.preset key', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('plugins.preset')})it('guards the chip on recommended (preset, non-internal)', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('!plugin.internal && plugin.recommended')})})@@ -46,17 +46,17 @@ describe('configPlugin preset chip', () => {// ── Suite C — uninstall flow wires to remove_dsh_plugin + restart ────────────describe('configPlugin uninstall flow', () => {it('calls remove_dsh_plugin', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('remove_dsh_plugin')})it('restarts the service after uninstall', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('store.harness.restart()')})it('shows a confirm dialog before uninstall', () => {- const source = readFileSync(new URL('../src/components/config-plugin.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/ui/config/plugin.tsx', import.meta.url), 'utf8')expect(source).toContain('remove_confirm_title')})})diff --git a/test/preinstall-uncheck.test.ts b/test/preinstall-uncheck.test.tsindex efcdedd9..c7cf00a1 100644--- a/test/preinstall-uncheck.test.ts+++ b/test/preinstall-uncheck.test.ts@@ -22,7 +22,7 @@ describe('preinstall can-uncheck hint i18n keys', () => {// ── Suite B — component references the hint key (source assertion) ───────────describe('preinstallSetup hint text', () => {it('renders the can_uncheck_hint key', () => {- const source = readFileSync(new URL('../src/layout/components/preinstall-setup.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/layout/components/setup-preinstall.tsx', import.meta.url), 'utf8')expect(source).toContain('preinstall.can_uncheck_hint')})})@@ -30,12 +30,12 @@ describe('preinstallSetup hint text', () => {// ── Suite C — component has dynamic button label (source assertion) ──────────describe('preinstallSetup primary button morph', () => {it('guards the label switch on hasChanges', () => {- const source = readFileSync(new URL('../src/layout/components/preinstall-setup.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/layout/components/setup-preinstall.tsx', import.meta.url), 'utf8')expect(source).toContain('hasChanges')})it('can render the Skip label', () => {- const source = readFileSync(new URL('../src/layout/components/preinstall-setup.tsx', import.meta.url), 'utf8')+ const source = readFileSync(new URL('../src/layout/components/setup-preinstall.tsx', import.meta.url), 'utf8')expect(source).toContain('preinstall.skip')})})@@ -55,13 +55,12 @@ vi.mock('@tauri-apps/api/event', () => ({return vi.fn()}),}))-vi.mock('@hairy/react-lib', () => ({ emitter: { emit: vi.fn() } }))vi.mock('@/config/client', () => ({ queryClient: { invalidateQueries: vi.fn() } }))vi.mock('../src/store/modules/harness-updater', () => ({harnessUpdater: { checkForUpdate: vi.fn() },}))-const { harness } = await import('../src/store/modules/harness/store')+const { preinstall } = await import('../src/store/modules/preinstall')beforeEach(() => {eventListeners.clear()@@ -70,7 +69,7 @@ beforeEach(() => {describe('confirmPreinstall empty-selection guard', () => {it('does not invoke the backend when ids is empty', async () => {- await harness.confirmPreinstall([])+ await preinstall.confirm([])expect(invoke).not.toHaveBeenCalled()})})diff --git a/test/readiness.test.ts b/test/readiness.test.tsindex 2a061c13..7849fb9c 100644--- a/test/readiness.test.ts+++ b/test/readiness.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { BoundedReloadGate, pollReadiness, SingleFlight, waitForActivityTask } from '../src/utils/readiness'+import { BoundedReloadGate, pollReadiness, SingleFlight, waitForActivityTask } from '../src/store/modules/harness/readiness'function noWait(): Promise<void> {return Promise.resolve()diff --git a/test/runtime-exit-store.test.ts b/test/runtime-exit-store.test.tsindex 514ec8e9..793a37af 100644--- a/test/runtime-exit-store.test.ts+++ b/test/runtime-exit-store.test.ts@@ -11,13 +11,13 @@ vi.mock('@tauri-apps/api/event', () => ({return vi.fn()}),}))-vi.mock('@hairy/react-lib', () => ({ emitter: { emit: vi.fn() } }))vi.mock('@/config/client', () => ({ queryClient: { invalidateQueries: vi.fn() } }))vi.mock('../src/store/modules/harness-updater', () => ({harnessUpdater: { checkForUpdate: vi.fn() },}))-const { harness } = await import('../src/store/modules/harness/store')+const { harness } = await import('../src/store/modules/harness')+const { recovery } = await import('../src/store/modules/recovery')beforeEach(() => {eventListeners.clear()@@ -33,8 +33,8 @@ beforeEach(() => {iframeLoaded: true,iframeError: true,busyAction: null,- recovery: { required: false, info: null, attempts: 0, busy: false },})+ recovery.reset()})describe('runtime exit store', () => {diff --git a/test/runtime-exit.test.ts b/test/runtime-exit.test.tsindex 9a51c246..18ee96b4 100644--- a/test/runtime-exit.test.ts+++ b/test/runtime-exit.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { runtimeExitMessageKey, shouldAcceptRuntimeExit } from '../src/utils/runtime-exit'+import { runtimeExitMessageKey, shouldAcceptRuntimeExit } from '../src/store/modules/harness/runtime'describe('runtime exit acceptance', () => {const current = {diff --git a/test/setup-copy-logs.test.ts b/test/setup-copy-logs.test.tsindex 538dfddd..ffcfc984 100644--- a/test/setup-copy-logs.test.ts+++ b/test/setup-copy-logs.test.ts@@ -19,14 +19,18 @@ describe('setup error page copy-logs contract (SYST-04)', () => {expect(source).toContain('messages.logs_copied')})- it('surfaces copy failure with the danger logs_copy_failed toast', () => {+ it('delegates copy feedback to the shared clipboard helper', () => {const source = readFileSync(new URL('../src/layout/components/setup.tsx', import.meta.url), 'utf8')const nativeWrite = source.indexOf('writeClipboardText(')expect(nativeWrite).toBeGreaterThan(-1)- const failurePath = source.slice(nativeWrite, nativeWrite + 500)- expect(failurePath).toContain('catch (err)')- expect(failurePath).toContain('messages.logs_copy_failed')- expect(failurePath).toContain('variant: \'danger\'')+ // 调用点只记录日志(失败提示统一由 helper 弹出),成功文案经第二个参数传入+ const callSite = source.slice(nativeWrite, nativeWrite + 500)+ expect(callSite).toContain('catch (err)')+ expect(callSite).toContain('messages.logs_copied')++ const helper = readFileSync(new URL('../src/utils/clipboard.ts', import.meta.url), 'utf8')+ expect(helper).toContain('messages.clipboard_failed')+ expect(helper).toContain('variant: \'danger\'')})it('renders a ghost button labelled with the copy_logs i18n key', () => {diff --git a/test/toast.test.ts b/test/toast.test.tsindex 873b0cf8..9037fd6f 100644--- a/test/toast.test.ts+++ b/test/toast.test.ts@@ -1,10 +1,6 @@import { afterEach, describe, expect, it, vi } from 'vitest'import { activeQueues as queues, toast } from '../src/utils/toast'-// @hairy/react-lib 会经 react-use(CJS)引入 useMount,Node 互操作下无法静态解析命名导出;-// toast 模块只用 emitter.emit,测试统一 mock 掉(与 runtime-exit-store / preinstall-uncheck 一致)。-vi.mock('@hairy/react-lib', () => ({ emitter: { emit: vi.fn() } }))-afterEach(() => {toast.clear()vi.useRealTimers()diff --git a/test/wake-lock.test.ts b/test/wake-lock.test.tsnew file mode 100644index 00000000..50e6e84f--- /dev/null+++ b/test/wake-lock.test.ts@@ -0,0 +1,49 @@+// @vitest-environment node+import { readFileSync } from 'node:fs'+import { describe, expect, it } from 'vitest'++/**+ * 屏幕唤醒锁契约(issue #469)。+ *+ * 主窗口与桌宠窗口都没有「屏幕常亮」的正当需求:桌宠动画是常驻播放的 `<video>`,+ * Chromium 会因此持有 Video Wake Lock 让系统无法息屏。壳层改用 reause+ * `useWakeLock()` 观察唤醒锁状态,一旦有锁生效立刻 `release()`。+ *+ * 原先的 `navigator.wakeLock.request` 猴补丁(`utils/disable-wake-lock.ts`)已删除,+ * 这里把「两个窗口入口都释放唤醒锁」的不变量锁在源码层面:任一入口漏掉即失败。+ */+const WAKE_LOCK_ENTRIES = [+ '../src/layout/index.tsx',+ '../src/pet/app.tsx',+]++describe('wake lock contract', () => {+ it('releases any active wake lock in both window entries', () => {+ for (const path of WAKE_LOCK_ENTRIES) {+ const source = readFileSync(new URL(path, import.meta.url), 'utf8')+ expect(source).toContain('useWakeLock()')+ expect(source).toContain('useWatch(wakelock.isActive')+ expect(source).toContain('wakelock.release()')+ }+ })++ it('no longer patches navigator.wakeLock anywhere in the shell', () => {+ const entries = readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8')+ const petEntry = readFileSync(new URL('../src/pet/main.tsx', import.meta.url), 'utf8')++ for (const source of [entries, petEntry]) {+ expect(source).not.toContain('disableWakeLock')+ }+ })++ it('keeps every pet animation video muted', () => {+ // 视频层已整体交给 dsh-pet-component(src/pet 不再自带 <video>):断言渲染器的+ // 双缓冲视频都显式静音 —— 桌宠动画一旦出声就是回归(与 #469 同源的常驻播放契约)。+ const bundle = readFileSync(+ new URL('../node_modules/dsh-pet-component/dist/index.mjs', import.meta.url),+ 'utf8',+ )+ const muted = bundle.match(/muted:\s*true/g) ?? []+ expect(muted.length).toBeGreaterThanOrEqual(2)+ })+})diff --git a/test/zoom.test.ts b/test/zoom.test.tsindex e7d5ebf1..de70beb6 100644--- a/test/zoom.test.ts+++ b/test/zoom.test.ts@@ -1,5 +1,12 @@import { describe, expect, it } from 'vitest'-import { zoomActionFromBridgeMessage, zoomActionFromShortcut } from '../src/utils/zoom'+import {+ nextZoomFactor,+ normalizeZoomFactor,+ zoomActionFromBridgeMessage,+ zoomActionFromShortcut,+ zoomFactorFromLevel,+ zoomLevelFromFactor,+} from '../src/utils/zoom'function shortcut(key: string,@@ -35,9 +42,10 @@ describe('desktop zoom shortcuts', () => {type: 'dsh://zoom-shortcut',action: 'increase',})).toBe('increase')+ // 来源不再参与判定(宿主侧由 useIframeMessage 校验 origin),但 type 必须完全匹配expect(zoomActionFromBridgeMessage({- source: 'other-frame',- type: 'dsh://zoom-shortcut',+ source: 'dsh-zoom-shortcut-bridge',+ type: 'dsh://other-message',action: 'increase',})).toBeNull()expect(zoomActionFromBridgeMessage({@@ -48,3 +56,47 @@ describe('desktop zoom shortcuts', () => {expect(zoomActionFromBridgeMessage(null)).toBeNull()})})++describe('zoom level ↔ factor mapping (Chromium base 1.2)', () => {+ it('maps levels to factors', () => {+ expect(zoomFactorFromLevel(0)).toBe(1)+ expect(zoomFactorFromLevel(1)).toBeCloseTo(1.2, 10)+ expect(zoomFactorFromLevel(-1)).toBeCloseTo(1 / 1.2, 10)+ expect(zoomFactorFromLevel(3)).toBeCloseTo(1.728, 10)+ })++ it('maps factors back to levels', () => {+ expect(zoomLevelFromFactor(1)).toBe(0)+ expect(zoomLevelFromFactor(1.2)).toBeCloseTo(1, 10)+ expect(zoomLevelFromFactor(1.44)).toBeCloseTo(2, 10)+ // 比例不是 1.2 的整数次幂 → 小数级别(Electron `getZoomLevel()` 同样可能返回小数)+ expect(zoomLevelFromFactor(1.4)).toBeCloseTo(1.8455, 3)+ })++ it('round-trips level → factor → level', () => {+ for (const level of [-2, -1, 0, 1, 2, 5]) {+ expect(zoomLevelFromFactor(zoomFactorFromLevel(level))).toBeCloseTo(level, 10)+ }+ })+})++describe('zoom factor stepping (mirrors Rust normalize_zoom_factor)', () => {+ it('clamps to [0.5, 2.0] and snaps to the 0.1 grid', () => {+ expect(normalizeZoomFactor(0.1)).toBe(0.5)+ expect(normalizeZoomFactor(3)).toBe(2)+ expect(normalizeZoomFactor(1.14)).toBeCloseTo(1.1, 10)+ expect(normalizeZoomFactor(1.16)).toBeCloseTo(1.2, 10)+ // 非有限值回落 100%+ expect(normalizeZoomFactor(Number.NaN)).toBe(1)+ expect(normalizeZoomFactor(Number.POSITIVE_INFINITY)).toBe(1)+ })++ it('steps by 0.1 and resets to 100%', () => {+ expect(nextZoomFactor(1, 'increase')).toBeCloseTo(1.1, 10)+ expect(nextZoomFactor(1, 'decrease')).toBeCloseTo(0.9, 10)+ expect(nextZoomFactor(1.7, 'reset')).toBe(1)+ // 到顶/到底后不再越界+ expect(nextZoomFactor(2, 'increase')).toBe(2)+ expect(nextZoomFactor(0.5, 'decrease')).toBe(0.5)+ })+})diff --git a/vitest.config.ts b/vitest.config.tsindex 1d836eb3..5dde5382 100644--- a/vitest.config.ts+++ b/vitest.config.ts@@ -1,3 +1,4 @@+import { fileURLToPath } from 'node:url'import { defineConfig } from 'vitest/config'/**@@ -13,12 +14,18 @@ import { defineConfig } from 'vitest/config'* 资源,偶发 5s 超时 flake;限制 maxWorkers 后单独复跑稳定通过。*/export default defineConfig({+ // 与 vite.config.ts 保持一致:src 内部统一用 `@/` 别名,测试入口也必须能解析。+ resolve: {+ alias: {+ '@': fileURLToPath(new URL('./src', import.meta.url)),+ },+ },test: {include: ['packages/**/*.{test,spec}.{ts,tsx,js,mjs,cjs}','test/toast.test.ts',- // issue #469:桌面端不得持有屏幕唤醒锁(桌宠 <video> 会间接加锁,导致无法息屏)。- 'test/disable-wake-lock.test.ts',+ // issue #469:桌面端不得持有屏幕唤醒锁(壳层用 reause useWakeLock 释放,桌宠 <video> 会间接加锁)。+ 'test/wake-lock.test.ts',// issue #469:收起桌宠必须是销毁窗口(隐藏窗口里的视频仍在播放并持锁)。'test/pet-window-lifecycle.test.ts',],