jim800121chen 06ff2fe987 feat(local-tool): M9-4 — Frontend FW badge + 升級 modal + WS hot-fix
A 階段第四個 milestone、完整 Frontend FW UI(badge / modal / 8 種 reason 復原)+ backend WS hot-fix(補對稱於 flash 的 firmware WS endpoint)。

Frontend(13 修改 / 7 新檔):
- 新 firmware/ component group (badge / upgrade-button / upgrade-dialog 4-phase / progress-view / error-view 8-reason / index)
- Zustand store (firmware-store.ts) + WS hook (use-firmware-progress.ts) 對齊既有 useFlashProgress pattern
- DeviceCard 整合 FirmwareBadge + FirmwareUpgradeButton
- i18n: settings.firmware.* namespace (對齊 Design Spec §9 SoT) + devices.card.fwBadge.* (zh-TW + en, 57 leaf keys × 2 lang = 114 strings)
- toast.ts ToastOptions interface (duration param)
- types/device.ts: FW 衍生欄位 + FirmwareStage/Reason/ProgressEvent/ActiveTask types

Backend WS hot-fix (3 檔):
- ws/firmware_ws.go (50 行、純對稱 flash_ws.go)
- ws/firmware_ws_test.go (165 行、2 smoke tests: broadcast + room isolation)
- router.go: GET /ws/devices/:id/firmware-progress

關鍵設計:
- R-FW-11 緩解: upgrading phase modal 不可關 (onInteractOutside/onEscapeKeyDown preventDefault + 隱藏 X)
- 多裝置隔離 defense in depth: store handleEvent activeDeviceId mismatch 直接 return
- 8 種 reason → 4 種 UX (recoverable/destructive/brick 警告/contactSupport)
- ContactSupport mailto handler (RFC 6068 + encodeURIComponent)

Reviewer 兩輪審查:
- Round 1: 0 Critical / 3 Major / 8 Minor / 5 Suggestion
- Round 2: 0 Critical / 0 Major / 0 Minor / 2 Suggestion(接受方案 A、不需 frontend 第 3 輪)
- MJ1 i18n namespace 採方案 A (settings.firmware.*)、Design SoT 優先、Reviewer 同意

測試:
- pnpm test --run: 60 tests pass (32 firmware: 22 store + 10 badge + 新 9 error-view + 19 既有)
- npx tsc --noEmit: 0 error
- pnpm build: production build 成功
- go test ./internal/api/ws/... -race: 1.964s 全綠
- pnpm lint firmware/: 0 hit (17 既有 lint 問題不屬 M9-4、follow-up)

未做(範圍外):
- Settings 韌體面板 (M9-12 B 階段)
- 手動降版 UI (M9-12)
- 版本切換 dropdown (B 階段)
- Wails 控制台 force-quit modal (M9-4.5)

A 階段 MVP 後端 + 前端開發全部完成、剩 M9-4.5 (SIGTERM + Wails OnBeforeClose) + M9-5 (三平台實機驗證)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 12:57:21 +08:00

visionA

Innovedus visionA monorepo — Edge AI 開發平台(離線版 + 雲端版)。

開發環境快速啟動

make dev-up         # 起 backend + Member CenterOIDC+ Postgres
make frontend-dev   # 另開 terminal起 frontend dev serverpnpm dev
# 開瀏覽器 http://localhost:3000

完整流程(含 OAuth client 手動註冊、port 對照、疑難排解)見 docs/DEV-SETUP.md。 其他 targetmake help

子專案

專案 角色 狀態
local-tool/ 離線版 桌面工具Wails + Go + Next.js 穩定維護
visionA-frontend/ 雲端版 web 前端Next.js Phase 0 雛形
visionA-backend/ 雲端版後端Go雙 binaryapi-server + remote-proxy Phase 0 雛形
local-agent/ visionA Agent — 雲端版 local 端代理Wails + Go + Next.js Phase 0.5 雛形

架構關係

離線模式local-tool 單獨)
  使用者瀏覽器 → localhost:3721 (local-tool server) → Kneron 裝置

雲端模式visionA 雲端版 + visionA Agent
  使用者瀏覽器 → visionA-frontend (CDN) → visionA-backend (api-server)
                                                ↓ internal HTTP
                                       visionA-backend (remote-proxy)
                                                ↓ WebSocket + yamux tunnel
                                       使用者電腦上的 visionA Agent
                                                ↓ 本機 HTTP
                                       Agent 的內部 server → Kneron 裝置

兩種模式可在同一台電腦共存local-tool 和 visionA Agent 獨立安裝、不衝突)。

產品線原則

  1. local-tool 不動,需要時 fork
  2. 雲端 vs 本機差異只在前端部署位置
  3. 雲端 agent 的 server ≈ local-tool 的 server(差別在沒本機操作 UI
  4. 雲端 web UI 先抄 local-tool,之後再加新功能

文件

完整產品文件見 .autoflow/

License

TBD內部使用

Description
No description provided
Readme 120 MiB
Languages
Go 54.6%
TypeScript 33.4%
Python 3.8%
Makefile 1.8%
JavaScript 1.8%
Other 4.6%