Skip to content

定义 Agent profile 迁移包,支持非技术用户导出/导入 Agent 数据 #126

@luoyuctl

Description

@luoyuctl

背景

很多用户有换电脑、重建 VM、迁移 Agent 工作区的场景。非技术用户不应该需要知道 ~/.hermes~/.openclaw 这些目录,也不应该自己 SSH/终端进 guest 打包复制。

这个 issue 目标是先定义一个可复用的 Agent profile 迁移包格式,并提供最小导出/导入能力。后续自动备份(#127)和恢复入口可以直接复用这套包格式。

当前代码依据

  • Hermes rootfs 明确安装在 /home/tenbox/.hermes,并预创建 sessions、logs、memories、skills、hooks、cache 等目录:scripts/x86_64/make-rootfs-hermes.shscripts/arm64/make-rootfs-hermes.sh
  • OpenClaw rootfs 使用 /home/tenbox/.openclaw 保存配置、workspace 和 gateway 状态:scripts/x86_64/make-rootfs-openclaw.shscripts/arm64/make-rootfs-openclaw.sh
  • QwenPaw rootfs 使用 /home/tenbox/.qwenpaw/home/tenbox/.qwenpaw.secretscripts/x86_64/make-rootfs-qwenpaw.shscripts/arm64/make-rootfs-qwenpaw.sh
  • TenBox 已有 virtiofs 共享目录,guest 自动挂载 /mnt/sharedscripts/rootfs-scripts/virtiofs-automount
  • VM spec 已有 shared_folders,daemon/manager 已支持 shared folder 热更新:src/common/vm_model.hsrc/daemon/rpc_server.cppsrc/daemon/runtime_manager.cpp

MVP 边界

第一版不要做跨 Agent 转换,也不要一开始就做完整 host RPC 编排。

建议 MVP:

  1. 定义标准迁移包格式:
tenbox-agent-profile.tar.zst
├── manifest.json
├── files/
└── checksums.txt
  1. 先支持 Hermes/OpenClaw:
    • Hermes:~/.hermes,默认排除 logs/image_cache/audio_cache
    • OpenClaw:~/.openclaw,默认排除可重建 cache。
  2. QwenPaw 放第二阶段,因为 .qwenpaw.secret 敏感信息边界更复杂。
  3. rootfs 内置 tenbox-agent-profile export|import
    • 导出到 /mnt/shared/...
    • 导入前自动备份现有目录。
    • 导入后恢复 owner/权限。
  4. UI/CLI 对非技术用户展示为:
    • 导出 Agent 数据
    • 导入 Agent 数据
    • 不暴露具体 dotfile 路径

后续阶段

验收标准

  • Hermes/OpenClaw 分别有 profile spec,列明包含目录、排除目录、敏感文件处理策略。
  • 导出包包含 manifest.json,记录 agent 类型、TenBox 版本、创建时间、路径清单、排除项和校验和。
  • Hermes 包只能导入 Hermes,OpenClaw 包只能导入 OpenClaw;不做跨 Agent 转换。
  • 导入前会生成 *.pre-import-* 备份,失败时保留原数据。
  • 非技术用户在 UI/文案里看到的是“Agent 数据”,不是 ~/.hermes~/.openclaw
  • 默认不打包大 cache/log,避免迁移包过大。

风险与注意点

  • Agent 目录结构可能随版本变化,profile spec 要版本化。
  • 导出内容可能包含 API key/token,manifest 和日志必须脱敏。
  • 当前 QGA 没有通用 guest-exec/file API;MVP 通过 guest 内脚本 + /mnt/shared 更稳,host 自动化放后续。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions