Skip to content

feat(command): 支持按游标重读会话输出与断线后恢复 - #167

Closed
porschepo31-lang wants to merge 1 commit into
uvwt:mainfrom
porschepo31-lang:feat/replayable-session-output
Closed

porschepo31-lang wants to merge 1 commit into
uvwt:mainfrom
porschepo31-lang:feat/replayable-session-output

Conversation

@porschepo31-lang

@porschepo31-lang porschepo31-lang commented Sep 27, 2026 •

Copy link
Copy Markdown

远程 session_observe action=status 在返回响应前推进共享输出游标,完成后还会删除会话。响应在网络中丢失时,客户端重试无法重读该段输出;小输出上限也会使未返回的部分无法继续分页获取。

本 PR 新增 action=read,使用客户端独立保存的 stdout_offset / stderr_offset,返回各流的 *_next_offset。重试同一偏移可重读仍在缓冲中的输出,多观察者互不推进游标,完成后的结果也不会被 read 删除。分页保持 UTF-8 边界,运行中的尾部不完整字符等待后续字节;缓冲淘汰或偏移处于字符中间时,用 *_missed_bytes 明确报告缺口。

保留原有 status/write/kill 行为;它们仍可能消费或删除会话。仍使用既有 4 MiB/流、完成后一小时及会话数量上限,不承诺跨 Core 重启保留结果。无需修改共享协议或 NexusDock;变更由 command capability 的工具 Schema 自己拥有。

验证:

  • make check:完整 Go 测试、脚本检查、vet、构建通过。
  • go test -race ./internal/tool/command/... -count=1 -timeout=3m 通过。
  • 回归覆盖丢失响应重试、多观察者、分页、独立 stdout/stderr、UTF-8、缓冲淘汰、非法偏移、完成结果保留,以及真实 Runtime 输入输出 Schema。
  • macOS arm64 原生执行 Session 和 Command 的新回归测试通过;使用隔离临时目录。
  • macOS arm64、Windows amd64 Core 交叉构建通过。Windows 物理节点离线,未宣称完成 Windows 实机测试;仓库既有三平台 CI 可继续验证。

仓库内的 docs/session-output-replay.md 说明调用顺序、兼容性和边界;官方中英文文档将在关联的 agentdock-docs PR 中同步。

官方文档同步:uvwt/agentdock-docs#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant