Files
arcrun-collector/cmd/arcrun-tray
Leo 7ecd740f82 品牌 icon 落地:托盤/app/msix/landing favicon 用 leo 的 CIS
用戶從 rag.arcrun.dev → install.arcrun.dev → 自己的 portal → 托盤,
四個地方應該看到同一個 icon。此前最不一致的就是托盤(Fyne 內建的通用
「儲存」圖示,main.go:1016 留著 TODO)。

素材真身=InkStoneCo/arcrun-cis/(leo 用 Claude Design 做的 CIS)。

托盤(trayicon.go,新檔)
- macOS:template 單色(純黑+alpha),系統依選單列深淺自動反色。
  ⚠️ fyne v2.5.3 只有 *theme.ThemedResource 才會走 systray.SetTemplateIcon
  (driver_desktop.go:169);傳一般 StaticResource 會走 SetIcon=不反色。
- Windows:完整墨底 icon(template 是 mac 專有)。
- 兩份都用 go:embed 內嵌,不讀外部路徑——打包後工作目錄不是原始碼目錄。
- 選單列用雙 chevron 而非完整方形字符:CIS 規定 26px 以下降級成 chevron,
  方塊裡的字符只佔高度 ~28%,22pt 下只剩 ~4px 會糊掉。

app 圖示
- icon.png 換成 CIS 1024 原生;icns 重產含 16→1024 全套 Retina 階梯。

msix(Store)
- 圖示改成預先產好、隨 repo 版控的 assets/store/(含 gen-store-assets.py 可重跑)。
- 修掉一個實際的變形 bug:舊版 `sips -z 150 310 icon.png` 會把方形 icon
  **橫向拉扁**成寬磚(實測產出的字符明顯變形),違反 CIS「never skew or stretch」。
  寬磚改用橫式 lockup 等比置中於墨底。
- 補 71x71/310x310/targetsize-16/24/32/48/256,manifest 一併宣告;
  BackgroundColor 從 transparent 改成品牌 Ink #17181A。

landing favicon(rag.arcrun.dev)
- LOGO_SVG 從琥珀金圓圈暫代圖換成 CIS 正式 mark(單色,CIS:彩色 chevron
  在產品裡代表「這條關係是活的」,用在 logo 會是謊話)。
- 修掉名實不符:`/favicon.ico` 過去回的是 SVG 位元組卻標 image/svg+xml
  (線上實測 200 但 type=image/svg+xml),老瀏覽器與抓圖服務畫不出來。
  現在 .ico 回真 ICO(16/32/48 三尺寸)、apple-touch-icon.png 回真 PNG(180)。
- 三個頁面(首頁/privacy/support)補上 icon link 宣告(此前完全沒有)。

⚠️ installer 這次沒動:`install.arcrun.dev` 的真身是
`installer/oauth-prototype/worker.js`(不在本分支,見 wiki decisions-summary
「installer 有兩個 worker,改錯=白做」),另立一筆處理。

實測證據
- mac .app 執行檔內 grep 到 tray-template.png 位元組(sha f6af940d,位移 14001472);
  Windows exe 內 grep 到 tray-windows.png(sha 59f4f1ac);各自平台只嵌自己那份
  (另一份被 linker 消掉=runtime.GOOS 編譯期常數,正確)。
- msix 重打包過 makemsix unpack 回讀驗證,包內 11 張圖示齊全。
- 已部署 arcrun-landing(版本 b79d19df)。繞快取實測 rag.arcrun.dev:
  favicon.ico→image/x-icon 1573B(3 icons,sha 151e645b=與本機產出同一顆)、
  apple-touch-icon.png→image/png 180x180、首頁 head 三個 link 宣告都在。
  ⚠️ 舊版 max-age=86400 的邊緣快取未 purge(無 zone token),24h 內自然過期。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 20:43:55 +08:00
..

Arcrun RAG 托盤殼(arcrun-tray)— 建置/簽章/TCC 交接

CP-1 第 6 關 daemon 產品化。leo 2026-07-21 定框架=fyne(窮舉七案後推薦,見頂層 journeys/daemon-tray-shell-options.md)。建置/簽章/公證/TCC 授權=leo/地端在真機做(紅線②③)。

這顆殼做什麼

一個選單列(Mac/系統匣(Windowsicon,讓不開 terminal 的人也能用:

  • 狀態一眼看(看守中 · 上次同步 HH:MM/啟動中/出錯自動重試/已暫停)
  • 選單:選擇知識資料夾(系統原生對話框)/打開資料夾/暫停·繼續看守
  • 關掉視窗=縮回背景續看守(不是結束)

看守 arcrun-collector direct(同綑執行檔),把它當背景常駐;崩了自動重起。

哪些已驗、哪些待真機驗(誠實界定,mindset §7)

部分 狀態 驗法
看守核心 collector/supervisor(子行程管理/狀態解析/崩潰重起/停止) sandbox go test 驗過(純 stdlib,5 測全綠,含重起/停止/狀態解析) cd collector && go test ./supervisor/
collector 引擎(未動) 既有測試無回歸 cd collector && go test ./...
fyne GUI 本體(本 main.gotray icon/選單/原生選資料夾) 待真機 build——fyne 需 CGoGL/webview,無螢幕 sandbox 編不了 真機 go mod tidy && fyne package
macOS TCC 同意流 待真 Mac 驗(沙箱測不到真 TCC 語意=假綠,故不盲寫) 見下「TCC」

⚠️ fyne API 細節(fyne.DoSetSystemTrayMenu 刷新/Lifecycle)以首次真機 build 為準—— 本檔按 fyne v2.5 API 寫,但未經編譯器。第一次 go mod tidy && go build 若有 API 出入,就地修。

建置(leo/地端,真機)

cd collector/cmd/arcrun-tray
go mod tidy                       # 拉 fyne 依賴(首次需網路)
# 把 collector 執行檔一起放進 bundle(托盤靠同層 arcrun-collector
cd ../.. && GOOS=darwin GOARCH=arm64 go build -o cmd/arcrun-tray/arcrun-collector .
# 打包 .appMac)/.exeWin
go run fyne.io/fyne/v2/cmd/fyne@latest package -os darwin -icon icon.png -name "Arcrun RAG"
# Windows-os windows

icon.png 待放(leo logo 進行中);Mac 選單列建議 template 單色 icon(自動深淺色)。

簽章/公證(Macleo/地端)

未簽章的 .app 會被 Gatekeeper 擋(右鍵開可繞,但非產品體驗)。正式版:

codesign --deep --force --options runtime --sign "Developer ID Application: <你>" "Arcrun RAG.app"
xcrun notarytool submit "Arcrun RAG.zip" --apple-id … --team-id … --wait
xcrun stapler staple "Arcrun RAG.app"

TCCmacOS,只有真 Mac 驗得到)

預設 watch_folder ~/ArcrunRAG(本殼已這樣設)——刻意避開 ~/Documentslaunchd/背景程序碰 ~/Documents 會被 TCC 擋(2026-07-19 實撞)。預設在非 TCC 禁區=零授權即可用

用戶若堅持把資料夾設在 ~/Documents/~/Desktop/~/Downloads

  1. 首次讀取被拒 → 本殼應偵測並引導:系統設定 → 隱私權與安全性 → 檔案與資料夾(或完整磁碟取用權)勾選 Arcrun RAG。
  2. 這一步必須在真 Mac 上驗(跳不跳授權框、launchd 背景 vs GUI 前景差異)。sandbox 只能測到 os.Open 成不成,測不到真 TCC=假綠,故本輪不寫死。

安裝(用戶視角,最終形態)

下載 → 拖進「應用程式」→ 開啟 → 選一個資料夾 → 完成。cypher_url/namespace/api_key 由安裝器寫進 ~/.arcrun-rag/config.json(用戶不碰)。現行 docs/manual/product-install-guide.md 是廢棄的 Docker 六步,產品化時要重寫成這段。