把 visionA-backend 6 個 in-memory store 接到資料庫持久化,範圍=完整 (PG 全接 + session 接 Redis + 交易韌性)。interface / handler 不動, 只加 DB 實作 + 換 wiring,config 未設 DB 時保留 in-memory fallback。 - 塊 0 基礎建設:pgx/v5 連線池 + DatabaseConfig/RedisConfig + golang-migrate runner(embed)+ cmd/migrate + testcontainers 測試基礎建設 - 塊 1 model → Postgres:array 映射、upsert 保留 CreatedAt、faa_object_key、 三維 filter(owner/chip/source)、soft-delete partial index - 塊 2 device → Postgres:partial unique(已刪 serial 可重註冊)、雙狀態欄位 - 塊 3 token → Postgres:pairing_tokens + session_tokens 分表、token_hash 當 PK - 塊 4 userSession → Redis:idle + absolute 雙 TTL 取代 cleanup goroutine (tunnel session 維持 in-memory,yamux handle 不可序列化) - 塊 5 交易/韌性:WithTx helper + 刪 device cascade 撤銷 token(同 tx 原子) + /healthz ping PG/Redis(fail-fast 503)+ pgx error 統一映射(不洩漏 raw error) 降級策略(fail-fast):PG 掉 → 持久資料 API 回 503;Redis 掉 → session 失敗 不自動 fallback in-memory(避免多機 session 不同步)。 DB:PostgreSQL 14.23(gen_random_uuid 內建、無 citext → email 用 lower() unique index)。每塊經 Reviewer 審查 + 真 PG/Redis testcontainers 全量 dbtest 綠燈, in-memory fallback 未受影響。 docs: 同步更新 database.md(schema/config/migration 清單)+ api-spec.md (409/503 錯誤碼、/healthz 新行為、device unpair cascade)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
visionA
Innovedus visionA monorepo — Edge AI 開發平台(離線版 + 雲端版)。
開發環境快速啟動
make dev-up # 起 backend + Member Center(OIDC)+ Postgres
make frontend-dev # 另開 terminal:起 frontend dev server(pnpm dev)
# 開瀏覽器 http://localhost:3000
完整流程(含 OAuth client 手動註冊、port 對照、疑難排解)見 docs/DEV-SETUP.md。
其他 target:make help。
子專案
| 專案 | 角色 | 狀態 |
|---|---|---|
local-tool/ |
離線版 桌面工具(Wails + Go + Next.js) | 穩定維護 |
visionA-frontend/ |
雲端版 web 前端(Next.js) | ✅ Phase 0 雛形 |
visionA-backend/ |
雲端版後端(Go,雙 binary:api-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 獨立安裝、不衝突)。
產品線原則
- local-tool 不動,需要時 fork
- 雲端 vs 本機差異只在前端部署位置
- 雲端 agent 的 server ≈ local-tool 的 server(差別在沒本機操作 UI)
- 雲端 web UI 先抄 local-tool,之後再加新功能
文件
完整產品文件見 .autoflow/:
- 產品需求:
.autoflow/02-prd/PRD.md - 設計規格:
.autoflow/03-design/design-spec.md - 架構總覽:
.autoflow/04-architecture/design-doc.md - 交付總結:
.autoflow/07-delivery/project-summary.md
License
TBD(內部使用)
Description
Languages
Go
54.6%
TypeScript
33.4%
Python
3.8%
Makefile
1.8%
JavaScript
1.8%
Other
4.6%