Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ tests/root_admission/fixtures/

# Generated from the persisted types by `cargo test -p vault-core --test persisted_schema`.
src-tauri/crates/vault-core/tests/persisted_schema/revision-*.json

# The landing site's generated types and the painting lab's renders.
site/.astro/
site/hero-lab/out/
site/hero-lab/screens-in/
# The demo's build and its recording (site/demo/record.ts writes it).
site/public/app/
site/demo/public/
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Tech: Tauri 2 + Rust + React 19 + TypeScript + Vite + Bun。

**模塊小、職責清**:組件單一職責,大數據必虛擬化,業務邏輯不洩漏進 UI。檔案行數硬門檻與巨型檔案清單見 `repo-baseline.md`;重構 > 1000 行的檔案先做「審查階段」(架構地圖 / 拆分方案 / E2E 覆蓋確認)再動代碼。

**受保護的入口**:`src/main.tsx` 與 `src/lib/ipc/bridge.ts` 是 desktop contract / IPC 入口,改動需對齊既有 contract。前端只透過 `src/lib/backend-client/` 的 typed client 呼叫後端;沒有 browser-preview 假後端。
**受保護的入口**:`src/main.tsx` 與 `src/lib/ipc/bridge.ts` 是 desktop contract / IPC 入口,改動需對齊既有 contract。前端只透過 `src/lib/backend-client/` 的 typed client 呼叫後端;測試與開發不用 browser-preview 假後端。官網 demo(`site/demo/`)是例外:獨立建置,重播從真後端錄下的回答,只給訪客試玩,不拿來驗證任何東西。demo 凍結在錄製時的版本,不隨每次發版重錄,只在畫面明顯改變或有值得展示的新功能時重錄(步驟見 `site/README.md`)。

**測試是契約**:權威 gate 是 `bun run check`,具體規則見 `quality-matrix.md`。不跑 mutation test,也不強制 100% 覆蓋率;測試以 E2E 為主:

Expand Down
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bun run build

## Surface Boundaries

There is no browser-preview backend. The frontend reaches Rust either through Tauri or through the dev IPC bridge; with neither, every command fails with "PathKeep cannot reach its backend". `bun run dev` on its own only serves the Vite bundle.
There is no browser-preview backend. The frontend reaches Rust either through Tauri or through the dev IPC bridge; with neither, every command fails with "PathKeep cannot reach its backend". `bun run dev` on its own only serves the Vite bundle. The landing page's demo (`site/demo/`) is a separate build that swaps the transport for answers recorded from the real backend; it is there for visitors to try, never for testing (see `site/README.md`).

- `bun run desktop:dev` is the real Tauri desktop surface. Use it for anything native: the overlay title bar, the menu bar / tray icon and its `pathkeep://` events, open at login, keychain prompts, Finder reveal, the updater, window sizing.
- `bun run dev:demo` (`scripts/dev-demo.mjs`) writes synthetic Chrome ×2 and Firefox profiles under `var/demo/`, starts the debug backend with the dev bridge, initializes the archive and runs a first backup, then serves the frontend at http://127.0.0.1:1420. It keeps the archive, keychain and scheduler inside `var/demo/` (`CHB_PROJECT_ROOT`, `CHB_TEST_KEYRING_DIR`, `PATHKEEP_PLATFORM_TEST_SANDBOX_DIR`, its own schedule label), so it never touches your real history, keychain or LaunchAgents. `--fresh` wipes `var/demo/`; `--first-run` stops before initialization so the app opens on onboarding. This is the default way to look at UI changes.
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/module-boundary-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## 前端(2026-10 redesign 之後)

前端只透過 typed client 跟 Rust 說話,沒有 browser-preview 假後端:不在 Tauri 裡、也沒有 dev IPC bridge 時,`src/lib/backend-client/shared.ts` 的 `call()` 直接丟錯。瀏覽器裡要看真資料用 `bun run dev:demo`(真後端 + 合成瀏覽器資料)。
前端只透過 typed client 跟 Rust 說話,沒有 browser-preview 假後端:不在 Tauri 裡、也沒有 dev IPC bridge 時,`src/lib/backend-client/shared.ts` 的 `call()` 直接丟錯。瀏覽器裡要看真資料用 `bun run dev:demo`(真後端 + 合成瀏覽器資料)。官網的 demo 不改這條:`site/demo/` 在自己的 Vite 建置裡,把 `src/lib/ipc/` 的三個傳輸模組換成重播真後端錄音的版本,`src/` 不知道它存在,也不拿它驗證任何東西(做法見 `site/README.md`)。

| 目錄 / 檔案 | 負責 | 不負責 |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/tech-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ rig 啟用 `serde_json/preserve_order`;visit / schema fingerprint 與 native /

- `devtools-bridge` 是 **開發期 feature-gated surface**,只在 `bun run desktop:dev:bridge` 或 `tauri dev --features devtools-bridge` 時啟用。
- 這條 bridge 只把 typed desktop command facade 鏡射到 localhost,方便 Chrome / Playwright / CDP 調試;它不是 shipping API,也不應被當成 plugin sandbox 或 remote control surface。
- 2026-10 起沒有 browser-preview 假後端。瀏覽器裡驗證 UI 用 `bun run dev:demo`(debug 後端 + dev bridge + 合成 Chrome×2 / Firefox 歷史,`--first-run --fresh` 從 onboarding 開始);E2E 用 `bun run test:e2e`,同樣跑在真後端上,產物在 `artifacts/e2e/`。dev bridge 下沒有選單列圖示;`pathkeep://` 桌面事件由 bridge 的 `/events`(server-sent events)送到瀏覽器,前端用 `listenDesktopEvent` 在 Tauri 與 bridge 下聽同一個事件(2026-10-09 起;之前收不到,Ask 在 E2E 裡永遠停在「處理中」)。
- 2026-10 起沒有 browser-preview 假後端(官網 demo 例外,2026-11:`site/demo/` 的獨立建置重播從真後端錄下的回答,只給訪客試玩,見 `site/README.md`)。瀏覽器裡驗證 UI 用 `bun run dev:demo`(debug 後端 + dev bridge + 合成 Chrome×2 / Firefox 歷史,`--first-run --fresh` 從 onboarding 開始);E2E 用 `bun run test:e2e`,同樣跑在真後端上,產物在 `artifacts/e2e/`。dev bridge 下沒有選單列圖示;`pathkeep://` 桌面事件由 bridge 的 `/events`(server-sent events)送到瀏覽器,前端用 `listenDesktopEvent` 在 Tauri 與 bridge 下聽同一個事件(2026-10-09 起;之前收不到,Ask 在 E2E 裡永遠停在「處理中」)。

2026-10 desktop integration note:開機時啟動、選單列 / 系統匣圖示與 `pathkeep://open-command-palette`、`pathkeep://backup-finished` 兩個事件見 [desktop-command-surface.md](desktop-command-surface.md)「Open at login 與選單列圖示(2026-10)」。

Expand Down
9 changes: 9 additions & 0 deletions docs/plan/BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@
- 契約:憑證/私鑰只進加密 secrets,永不入 repo;reproducible build 原則不破;release rehearsal(`bun run verify`)通過。
- 驗收:CI 產出 signed + notarized + stapled 的 `.app`/`.dmg`;裝在乾淨機器上 Gatekeeper 不擋;授一次 FDA 後,安裝下一個版本仍保有 FDA(備份不再靜默失效)。

- [ ] **WORK-SITE-DEMO-V060** — 官網的 demo 從 v0.6.0 正式版重錄一次,加上 Agent 空間(發布 v0.6.0 時做;接在 `WORK-AH-SCREENS` 之後)
- 讀先:`site/README.md`「The demo」。
- 用戶 2026-11-15 選了「demo 固定在一個版本」:建好的 app 和錄音一起放在 git 的 `site/public/app/`,平常發版不碰它;只在畫面明顯改了、或有值得展示的新功能時才重錄。現在那份是 `feat/agent-history-product` 的 6a67d6f8 錄的,About 顯示 `0.5.0-dev · 6a67d6f8 (modified)`,只有瀏覽紀錄。
- 要做:合成的 Agent 對話(Claude Code、Codex、Pi、DeepSeek Harness 各自的原生格式;`WORK-AH-SCREENS` 給 `dev:demo` 和 E2E 做的那一套直接拿來用)在 `demo/record.ts` 裡走真的備份;`demo/walk.ts` 和 `demo/check.ts` 的導覽加上 Agent 空間每個畫面;從 v0.6.0 tag 的乾淨 checkout 編帶 dev bridge 的 debug 後端,重錄,`check:demo` 三語都過,再 commit `site/public/app/`。
- 官網上設計原型拍的截圖:hero 的兩張「紀錄」頁、demo 窗載入前的首頁、功能牆的「Agent 洞察」。Agent 畫面進了 `src/` 之後全部改從 demo 拍(`hero-lab/capture-screens.ts`、`hero-lab/capture-features.ts`;功能牆瀏覽紀錄那三張已經是從 demo 拍的),`hero-lab/screens-text.ts` 那張翻譯表大半可以拿掉。
- 一起處理:設定 › AI 打開「語意搜尋」後,demo 一直停在「正在下載語言模型…」,沒有錯誤。demo 對 `download_static_embedding_model` 回的是「demo 做不到」,畫面沒顯示出來;先查真的 app 下載失敗時是不是也這樣停住,再決定改 demo 的回答還是修 app。
- 驗收:demo 的 About 顯示 v0.6.0 與它的 commit;兩個空間都能逛;`check:demo` 三語、`page-check.ts`(Chrome 與 `--webkit`)全過。

---

## 維護規則
Expand All @@ -378,6 +386,7 @@
- 毛玻璃視窗下,視窗那一層沒有變淡:`src/index.css` 裡毛玻璃的 `--window`/`--panel` 寫在 `@layer base` 裡,而 `:root` 的值不在任何 layer,沒有 layer 的規則贏過有 layer 的。做外框時在瀏覽器裡量到毛玻璃下 `--window` 仍是不透明時的值(`rgb(250 250 252 / 0.62)`);用戶 2026-11-14 說 macOS 上選了毛玻璃確實有變透明,但「非常,非常不明顯」,跟量到的一致:桌布那一層有拿掉,視窗那一層沒有照設計降到 14%。修的時候把那兩條規則移出 layer,並在桌面視窗上看過深淺兩種主題。
- 新手引導的排程預覽只在每個間隔第一次被選時寫入設定;選過別的再選回來、然後關掉,下次可能從錯的間隔開始。
- `vault-crypto/tests/search_index.rs` 的 `the_block_cache_bounds_memory` 在機器記憶體吃緊時會假失敗:它比較兩個子行程的常駐記憶體成長量,而系統在壓力下會把記憶體壓縮或換出,量到的成長變成負數(2026-11-14 同時有別的編譯在跑時看到「2 MiB 的快取 -0.5 MiB、不設上限的 -3.9 MiB」,單獨重跑通過)。快取大小本身的斷言(`max_cache_mib`)是可靠的;常駐記憶體那一條要換成不受系統壓力影響的量法。
- 首頁「近 30 天瀏覽」在繁中、簡中時,第一個 x 軸標籤的頭被圖表左緣切掉:「10月17日」只剩「0月17日」(2026-11-15 做官網 demo 時看到,量過:中文標籤超出圖表左緣 5 px,英文的「Oct 17」放得下)。`features/home/home-cards.tsx` 的 `XAxis` 左右各只留 14 px,標籤以第一個點為中心,標籤寬度的一半超過 14 px 就出界。月份是兩位數時才會發生。

- [ ] **WORK-VAULT-FOLLOWUPS-2026-11** — 規劃 `WORK-VAULT-STORE-ROLES` 時讀程式找到、跟 Agent 對話無關的現有行為(2026-11-14;兩份獨立的盤點都指出,但都只讀了程式,動手前先重現)
- 搬到另一台電腦會丟掉使用者改過的網站分類與搜尋引擎規則:它們存在 `derived/intelligence.db`(`site_dictionary_overrides`、`search_engine_rules`),而搬移檔把這個資料庫當成可以重算、不帶走,匯入預覽還寫「洞察會重建」。同一個原因,已存的網頁文字檔會被帶過去,但記錄「哪個網址對應哪個檔」的那幾列(`page_content_enrichments`)不會,所以在新電腦上這些文字找不到(`vault_lifecycle` 的搬家測試重現了這兩件事)。修法要改 `data-model.md` 已接受的那一句,需要用戶同意。
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export default defineConfig([
'tests/fixtures',
// Design prototype on invented data; type-checked by its own tsconfig.
'docs/design/prototype-2026-11-agent-history',
// The landing site is its own package: `astro check` types its pages, and
// the painting lab's Bun scripts are checked by running them (site/README.md).
'site',
]),
{
files: ['**/*.{ts,tsx}'],
Expand Down
5 changes: 5 additions & 0 deletions site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
# A recording before it is built into public/app/ (see README, The demo).
demo/public/
.astro/
Loading
Loading