visionA/local-agent
jim800121chen b9ee184586 feat(device): WP-0 序號串通 + serial 路由(ADR-018 走向 A' 第一階段)
- local-agent/server:detector 保留 kn_number(parseScanDevices 可測化、
  合成 ID 語意不動)+ DeviceInfo.SerialNumber + Manager serialToLocalID
  反查表 + GetDevice 雙查(sessions 先、serial 後,純加法)
- visiona-agent:pairing exchange 帶本地裝置清單(DeviceLister 失敗不中斷
  配對、timeout 2s、omitempty 舊版相容)
- visionA-backend:exchange 收 devices —— R1 取第一顆可用序號、R2 假序號
  0x00000000 寫 NULL、R4 同 owner 同序號復用既有 device_id(防 23505)、
  pg+mem 兩實作對齊
- 五個 proxy 操作(flash/inference/camera/connect/disconnect)收斂於
  GetDevice 單一入口,serial 路由一處涵蓋
- docs:api-spec.md §2 增補 POST /api/pairing/exchange(schema + R1/R2/R4)
- 測試:行為級四環節鏈 + dbtest 130 實跑 6/6 + DBOn 回歸 4/4;
  三 module build/vet/test 全綠
- review:通過 0C/0M/6Mi/5Sug(.autoflow/05-implementation/review/
  wp0-serial-routing-review.md);Minor #1 Rescan stale session 掛 WP-C 前置

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:31:51 +08:00
..

visionA Agent

Phase 0 雛形 — 正在建置中

此專案於 2026-04-22 從 local-tool/ forkbaseline commitb71ff4cd3c72e879435f773ae15b23bf8b70841e

fork 後獨立演進,不主動與 local-tool 同步。 需要時手動 cherry-pick bug fix。

產品定位

visionA Agent 是 visionA 雲端版的 local 端代理程式:

它是什麼

  • 一個完整的 local server沿用 local-tool 的 KneronPLUS / camera / inference / device / model / Python runtime / ffmpeg 邏輯)
  • 加上 tunnel client,把自己 reverse-tunnel 到雲端 visionA-backend,讓雲端 web UI 可以透過 tunnel 操作使用者桌機上的 Kneron 裝置
  • 加上 3 頁極簡配置 UI(狀態 / 配對 / 設定給使用者看「Agent 是否在線」和「配對雲端帳號」用

它不是什麼

  • 不是 local-tool 的修改版local-tool 不動visionA Agent fork 後獨立演進)
  • 不保留 local-tool 原本的裝置 / 模型 / 推論 UI這些由雲端 web UI 負責;本機 UI 只管配對/設定)

目前進度Phase 0 雛形)

任務 狀態 說明
AB1 fork + 改名visiona-local → visiona-agent / bundle ID / Makefile 變數 78 處替換)
AB2+AB3 裁剪 Wails 業務 UI binding、刪除舊資料目錄遷移新增 pairing / connection / settings 的 stub binding回 ErrNotImplemented為 AB4-AB10 預留擴點
AB4 複製 tunnel client從 POCinternal/tunnel/
AB5 Agent config (YAML) 讀寫
AB6 Internal HTTP serverwrapper 綁 127.0.0.1:0
AB7 Pairing Exchanger呼叫雲端 /api/pairing/exchange
AB8 connstate broadcaster + Wails event 推送
AB9 autostart 三平台實作
AB10 logexport壓縮最近 7 天 log
AB11-12 Wails 整合 + 整合測試

架構圖(簡版)

[ Browser ] ── HTTPS ──► [ visionA-backend ]
                                │ (內部 HTTP forward
                                ▼
                         [ remote-proxy ]
                                │ WSS + yamux 出站長連線)
                                ▼
┌───────────────────────────────────────────────────────┐
│  visionA Agent使用者桌機Wails app                │
│                                                       │
│   [Tunnel client]            [3 頁配置 UI]             │
│         │                         │ Wails bindings    │
│         ▼                         ▼                   │
│   [Internal HTTP server 127.0.0.1:<random port>]      │
│   (沿用 local-tool 的 Gin handler裝置/模型/推論/... │
│                         │                             │
│                         ▼                             │
│   [Python runtime + KneronPLUS SDK + ffmpeg]          │
└───────────────────────────────────────────────────────┘
                                │
                                ▼
                       Kneron USB 裝置

文件

fork baseline

本專案於 2026-04-22 從 local-tool/commit b71ff4cd3c72e879435f773ae15b23bf8b70841e)一次性 fork 後獨立演進,不主動 syncADR-007

local-tool 原始 README 已封存於 docs/legacy-local-tool-readme.md,僅作 cherry-pick bug fix 時的歷史對照,不再代表 visionA Agent 的產品定位。

開發指令

# 下載第三方依賴到 vendor/
make vendor-sync

# 本機 build + 產出 macOS DMG
make dmg

# 列出所有 targets
make help

主要 targets沿用 local-tool 結構,但所有產物名稱已替換為 visiona-agent

Target 作用
vendor-sync 下載 python-build-standalone / wheels / ffmpeg
build-frontend pnpm build Next.js 靜態產物 → frontend/out/
wails-sync-frontend 同步 frontend/out/visiona-agent/frontend/Wails embed
wails-macos / wails-windows / wails-linux Wails build + ad-hoc codesignmacOS
dmg 產出 dist/visiona-agent.dmg(缺 create-dmg 時 fallback hdiutil
exe Inno Setup → dist/visiona-agent-*-windows-x64.exe(需 Windows runner
appimage dist/visiona-agent-*-x86_64.AppImage(需 Linux runner
dev-agent Wails dev mode
test-tunnel tunnel client 整合測試

三平台 build 細節與 local-tool 共存對照表:docs/BUILD-VERIFICATION.md