mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-30 16:23:35 +08:00
Follow-up to PR #12. User asked: can the handoff use even more context? Defaulting all clicks to a huge tail has real costs (provider context-window limits, signal dilution, prompt-cache invalidation timing), so instead expose a per-user opt-in toggle on the welcome card's Continue-from-here group. When the toggle is on, the next handoff: - Reuses the cached LLM-generated main+recent (no extra LLM cost) - Re-derives the verbatim recentRaw from the live JSONL with hard-coded enlarged sizing: 60 turns × 800 chars/turn / 50k total cap (~12.5k tokens) - Ships via the same set_handoff_summary WS message + system-prompt path Toggle state persists in localStorage (cc-haha-handoff-deep-mode) so a user who opted in once doesn't have to re-click every session. Why hard-coded sizing (vs env-tunable)? Predictable UX. A user enabling 'deep' should get a known enlarged tail regardless of any CLAUDE_CODE_HANDOFF_RAW_* env override they might have set. Env knobs still affect the default-mode generation. Surface area: - Server: extract readTurnsFromTranscript helper, refactor buildRecentRawSlice into a thin wrapper over a pure buildRecentRawSliceWithSizes(turns, sizes). New rebuildRecentRawForHandoff(sessionId) public helper used by the WS handler when message.deep === true. - WS protocol: add optional 'deep' boolean to set_handoff_summary message (server events.ts + desktop chat.ts). - WS handler: when deep, swap summary.recentRaw with the deep-rebuilt slice before calling formatHandoffSystemPrompt. - Frontend: RecentActivityCard adds a toggle pill (history_edu icon) before the existing button group; threads { deep } through onAutoHandoff. - EmptySession + ActiveSession: forward options.deep into the WS message. - 5 locales each get 3 new keys: deepHandoffLabel + on/off tooltip variants. Tested: sessionSummaryService.test.ts 11/11 pass, including 2 new tests that lock the deep-mode 60-turn/800-char/50k sizing and prove env overrides don't bleed into deep mode. Desktop tsc --noEmit clean. Confidence: high. Scope-risk: narrow (additive optional flag throughout). Co-authored-by: 你的姓名 <you@example.com>
Claude Code Haha Desktop
基于 Tauri 2 + React 的桌面客户端。
开发
bun install
bun run tauri dev
构建
# macOS (Apple Silicon)
./scripts/build-macos-arm64.sh
# Windows (x64, MSI only)
.\scripts\build-windows-x64.ps1
构建产物位于 build-artifacts/ 目录,文件名会显式包含平台、架构和包类型。
常见问题
macOS 提示"已损坏,无法打开"
xattr -cr /Applications/Claude\ Code\ Haha.app