Skip to content

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

Merge remote-tracking branch 'origin/main' into feat/pet-bubble-delegation

hairyfd72c615c3ee0
diff --cc src/pet/app.tsx
index 144de178,0c61decb..12efe0b6
--- a/src/pet/app.tsx
+++ b/src/pet/app.tsx
@@@ -11,7 -12,7 +11,8 @@@ import { useBubbleTracker } from './hoo
import { usePetSource } from './hooks/use-pet-source'
import { normalizeSizePercent, usePetStatus } from './hooks/use-pet-status'
import { usePetWindowSize } from './hooks/use-pet-window'
+import { useWakelockRelease } from './hooks/use-wakelock-release'
+ import { reportPetIssue } from './utils/log'
/**
* 桌宠窗口的唯一组合入口。
@@@ -39,41 -45,51 +40,51 @@@ export function App()
const visible = status === null || (status.enabled !== false && status.visible !== false)
const width = (source?.width ?? PET_BASE_WIDTH) * normalizeSizePercent(status?.pet_size) / 100
+
+ useBubbleTracker(pet, source)
usePetWindowSize(width, source?.aspect ?? PET_DSH_ASPECT, visible)
useOmitIgnoreCursorEvents(hitboxRef)
- // 桌宠窗口是装饰性的透明置顶小窗:右键不应弹出 WebView 默认 context menu。
- useEventListener('contextmenu', (event: Event) => event.preventDefault())
+ useEventListener('contextmenu', event => event.preventDefault())
+ useWakelockRelease()
// 手势优先于会话档位:拖动期间按方向播走路动画(dsh-pet 渲染器内部强制走 drag 池,
- // 会忽略这里的方向,由组件保证);拖动结束或方向停摆后自动回落到会话档位。
- const motion: PetRenderMotion | undefined = dragging
- ? (direction === undefined ? undefined : `moving-${direction}`)
- : bubble.motion
+ // 会忽略这里的方向,由组件保证);拖动结束即回落 `undefined`,交给气泡聚合出的档位。
+ const motion: PetRenderMotion | undefined = draggable.dragging
+ ? (draggable.direction === undefined ? undefined : `moving-${draggable.direction}`)
+ : undefined
return (
- <ToastProvider custom>
- {/* 外层只负责铺满透明窗口并让宠物锚定底部居中;窗口内可交互面只有命中箱,
- 其余区域由 useOmitIgnoreCursorEvents 按命中箱矩形整体穿透。 */}
- <main className={`pointer-events-none fixed inset-0 flex items-end justify-center ${visible ? '' : 'invisible'}`}>
- {source && (
- <Pet
- ref={petRef}
- kind={source.kind}
- config={source.config}
- uri={source.uri}
- ext={source.ext}
- motion={motion}
- size={width}
- dragging={dragging}
- cache={true}
- hidden={!visible}
- hitboxRef={hitboxRef}
- onError={reportPetAssetError}
- />
- )}
- {/* 选中了宠物但资源解析不出来(导入的宠物被删除、清单里没有该 id):必须给出
- 可见提示 —— 透明窗口里「空」与「在加载」观感相同,静默留空等于让用户以为坏了。 */}
- <If cond={error !== null} then={<Hint petId={activePet} />} />
- </main>
- </ToastProvider>
+ // 外层只负责铺满透明窗口并让宠物锚定底部居中;窗口内可交互面只有命中箱,
+ // 其余区域由 useOmitIgnoreCursorEvents 按命中箱矩形整体穿透。
+ <main className={`pointer-events-none fixed inset-0 flex items-end justify-center ${visible ? '' : 'invisible'}`}>
+ {source && (
+ <Pet
+ ref={petRef}
+ kind={source.kind}
+ config={source.config}
+ uri={source.uri}
+ ext={source.ext}
+ motion={motion}
+ size={width}
+ dragging={draggable.dragging}
+ cache={true}
+ hidden={!visible}
+ hitboxRef={hitboxRef}
++ onError={reportPetAssetError}
+ />
+ )}
+ {/* 选中了宠物但资源解析不出来(导入的宠物被删除、清单里没有该 id):必须给出
+ 可见提示 —— 透明窗口里「空」与「在加载」观感相同,静默留空等于让用户以为坏了。 */}
+ <If cond={error !== null} then={<Hint petId={activedPet} />} />
+ </main>
)
}
+
+ /**
+ * 资源加载/播放失败的出口:组件内部抓取失败会静默降级为「直接播远端地址」
+ * (`useCachedMediaUrl` 的 catch 只调 `onError`),而桌宠窗口的 console 要手动
+ * F12 才看得见 —— 不接这个回调,「IndexedDB 一次都没写进去」就无从察觉。
+ */
+ function reportPetAssetError(error: unknown): void {
+ reportPetIssue('asset', error)
+ }
diff --cc vitest.config.ts
index 74548401,6e784ada..3a4085c7
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@@ -32,8 -32,9 +32,11 @@@ export default defineConfig(
'test/patch-layer.test.ts',
// issue #539:旧版 WebKit 缺全局 Iterator 导致插件加载失败,壳层兼容垫片回归。
'test/compat-iterator.test.ts',
+ // v0.2.0:气泡托管给 dsh-pet-component,宿主侧只剩「会话快照 → pet.bubble」的映射。
+ 'src/pet/hooks/use-bubble-tracker.test.ts',
+ // 桌宠素材响应头:GitHub 对中文动画名回 `content-disposition`,插件版 fetch 会因
+ // 非 ISO-8859-1 抛错并静默不落 IndexedDB(pnpm patch 过滤该头,这里锁住契约)。
+ 'test/pet-asset-headers.test.ts',
],
maxWorkers: 4,
testTimeout: 30_000,