feat(client): add digital employee sync schema

This commit is contained in:
baiyanyun
2026-06-05 16:43:23 +08:00
parent 40151c3902
commit 2373e0b5f3
3 changed files with 416 additions and 4 deletions

View File

@@ -340,8 +340,8 @@ digitalEmployee:getState
当前边界:
- 状态服务仍是轻量版本,先使用 settings 表持久化
- Plan / Task / Run / Event 还没有独立 SQLite 表。
- 状态服务仍保留 settings JSON 作为兼容快照
- Plan / Task / Run / Event 已开始写入独立 SQLite 表。
- 当前事件主要记录服务状态变化,还没有接入 `/computer/chat` 和 ACP token/event stream。
下一步:
@@ -350,6 +350,50 @@ digitalEmployee:getState
- 在 computer server 的 `/computer/chat` 入口创建 Task / Run。
- 在 ACP event forwarder 中写入 Run/Event。
## 管理端联动原则
数字员工状态是本地优先,但不能成为本地孤岛。
本地 SQLite 表设计必须同时满足:
- 离线可用:客户端无网络时仍能展示任务、运行明细和日报。
- 可追溯:本地每个 Plan / Task / Run / Event 都有稳定本地 ID。
- 可同步:预留管理端 ID 和同步状态。
- 可补偿:同步失败后可通过 outbox 重试。
当前已新增/规划的本地表:
```text
digital_plans
digital_tasks
digital_runs
digital_events
digital_artifacts
digital_approvals
digital_sync_outbox
```
同步字段:
```text
remote_id
sync_status
last_synced_at
sync_error
```
同步流建议:
```text
本地写入 Plan/Task/Run/Event
-> digital_sync_outbox pending
-> 管理端 sync API
-> 回填 remote_id
-> sync_status = synced
```
管理端 API 尚未在 qiming-backend 中确认最终路径,因此当前 qimingclaw 先落本地同步契约,不硬编码远端接口。
### 产出
- 数字员工页面可以从源码重新构建。