接續前一段 session(中文字型部署、刪除 bug、storage-config remote_agent、jedi-file-upload 0.0.17 發版)。 本紀錄涵蓋 user 交辦的兩件事:deploy 雙模式 + registry 管理 UI。branch 全在
feature/FR-039-evidence-agent,未 push。
⚠️ 早上追加:file_agent 全面正名為 remote_agent(見文末 §C)。下面 B 段提到的
file_agents表 /file-agent-manage選單 //file-agentsendpoint 都已改名為remote_agents/remote-agent-manage(選單顯示「Agent 管理」)//remote-agents。
背景:agent code 早就支援 local 落地存檔(config.py 預設就是 local),但 deploy/ 只 wire 了 minio,且 file-agent 沒掛 volume → 切 local 會檔案不持久(容器重建即遺失)。
做了:
deploy/docker-compose.yml:STORAGE_TYPE 改 env-driven(${STORAGE_TYPE:-minio});補 BASE_DIR;file-agent 加 ./filedata:/data/upload 持久 volume;MINIO_* 改 :- 預設空(local 模式可不填)。deploy/.env.example:分 minio / local 兩段說明 + STORAGE_TYPE 切換。docker compose config 兩種模式都 parse 過。commit:evidence-agent 3ca2536
怎麼用 local 模式:.env 設 STORAGE_TYPE=local(minio 那幾行可留空)→ docker compose up -d。檔案落在 ./filedata。
讓管理者在 UI 上 CRUD 客戶端檔案 agent(原本只能灌 SQL)。
2840c9d8)POST /api/1.0/file-agents(新增)GET /api/1.0/file-agents/all(管理列表,含停用,完整欄位)GET / PUT / DELETE /api/1.0/file-agents/<uid>(detail / 更新含啟用切換 / 刪除)GET /file-agents 仍是 storage-config 下拉用,只回啟用中 uid+name)FileAgentService:list_all / get / create / update(部分更新)/ delete。domain service 補 create/update/delete。file_agents per-tenant RLS policy(比照 devices)。
2026-06-19-fr039-file-agents-rls.sqlFILE_AGENT_NAME_REQUIRED / BASE_URL_REQUIRED(400)。src/views/file-agent/FileAgentManage.vue:DataTable(client-side,registry 筆數少不分頁)+ 新增/編輯 Dialog + 啟用 InputSwitch 即時切換 + 刪除確認。api.js:加 FILE_AGENTS_ALL。zh-tw/file-agent.json + en/file-agent.json + 註冊進 locales/index.js;menu.json 加 file-agent-manage 標籤。router/index.js:加 /system/file-agent-manage route。2840c9d8 同批,migration)2026-06-19-fr039-file-agent-manage-permission.sql:比照 storage-config 的 RBAC 三層
ui_routes(pid=46 系統設定群組,sort=45,介於 storage-config 與 cloud 之間)capabilities(read/create/update/delete 4 個)route_capabilities(read=ALL 其餘=ANY)role_capabilities(授予 roles 2/3/37/38:Administrator / Billows Admin / IT執行人員 / Billows 系統管理員)前置:BE 要重啟(新增 route 模組 + DI);FE 重新整理(router/i18n/menu 改動)。
.env 設 STORAGE_TYPE=local → docker compose up -d → 上傳檔案 → 重建容器(docker compose up -d --force-recreate)→ 檔案仍在(./filedata 持久)。http://192.168.50.123:8080)→ 儲存 → 列表多一筆。@jwt_required(無額外 role decorator);存取控制走 RBAC 選單層(只有被授權角色看得到頁面)。與既有系統設定頁一致。file-agents-rls / upload-files-add-sha256(前段)/ file-agent-manage-permission)+ 前段 storage-type-remote-agent-menu 都只套了 dev;stg/poc/prod 待。未來多種 agent(以 agent_type 區分)並存,把 file-specific 命名正名為通用 remote_agent (與既有 RemoteAgentAdapter / REMOTE_AGENT storage_type 一致)。選單顯示文字用「Agent 管理」。
| 層 | 改名前 → 改名後 |
|---|---|
| DB table | compliance.file_agents → compliance.remote_agents(+ 序列/索引/RLS policy/grant) |
| BE endpoint | /file-agents* → /remote-agents* |
| BE 模組 | file_agent(api/app/domain/infra/di)→ remote_agent;類名 FileAgent* → RemoteAgent* |
| RBAC 選單 | file-agent-manage → remote-agent-manage(url /system/remote-agent-manage) |
| FE | views/remote-agent/RemoteAgentManage.vue、REMOTE_AGENTS*、i18n remote_agent_manage,選單字串「Agent 管理」 |
| error code | 保留 FILE_AGENT_*(內部碼、非對外標籤) |
2026-06-19-fr039-rename-file-agents-to-remote-agents.sql(已套 dev;冪等 RENAME)。50931d90、FE e6c0ff5。/system/remote-agent-manage。/remote-agents)。__tablename__='remote_agents'),否則舊 code 查 file_agents 會 UndefinedTable。dev 已對齊。remote_agents。