AIFeed

DevTape:用于录制开发/AI 会话的开放协议与 3.9MB Rust CLI(.tape)

Translation(model translation, not the source's own text)

仓库文件导航

题图
题图

DevTape 与 DTP v0.1

DevTape 是 DevTape 协议的本地优先 Rust 实现,用于在可移植的 .tape 归档中录制、拖动、检查和回放开发会话。协议规范位于 spec/RFC-0001-dtp-v0.1.md 和 spec/dtp_v1.proto。

录制使用 PTY,带边界缓冲和流式脱敏;归档包含事件、清单和完整性哈希。会话可存储在 SQLite 中,按隐私配置导出,通过只读 MCP 工具检查,或在本地查看。Git 快照使用私有索引,回退前会先创建安全快照。

Crates

  • dtp-codec:tape 编码、校验、HLC、事件类型和回放 ANSI 过滤。
  • devtape-scrub:流式敏感信息脱敏。
  • devtape-pty:PTY 捕获和背压。
  • devtape-git:影子快照、回退和撤销。
  • devtape-core:SQLite 会话存储和导出配置。
  • devtape-mcp:只读 MCP stdio 工具。
  • devtape-net:可选的环回 HTTP 捕获代理。
  • devtape-ui:环回只读时间线服务器。
  • dtp-wasm:Rust 解码和查看器净化辅助工具。
  • devtape-cli:命令行界面。

用法

使用 cargo run -p devtape-cli -- 运行,或构建并使用 devtape 二进制文件。以下示例假设该二进制文件已在 PATH 中。


        devtape doctor
devtape demo-tape --out sample.tape
devtape inspect sample.tape
devtape record --out session.tape --qos zero-stall --db sessions.db -- sh -c 'echo hello'
devtape record --net --out network.tape -- curl http://example.com/
devtape snapshot --repo . --label before-change
devtape rewind --repo . --to SNAPSHOT_ID
devtape undo-rewind --repo .
devtape sessions --db sessions.db
devtape export SESSION_ID --db sessions.db --profile full --review --out exported.tape
devtape export SESSION_ID --db sessions.db --profile diff-only --review --out diff.tape
devtape export SESSION_ID --db sessions.db --profile trace-only --review --out trace.tape
devtape view session.tape --port 0
devtape mcp --tape session.tape
printf 'Bearer example-token\n' | devtape scrub-check
      

view 会打印一个环回 URL,并运行到中断为止。它在显示时会净化危险的终端控制序列;其显示的完整性哈希是原始归档的哈希。归档在分享前应已完成脱敏。web/viewer/index.html 可在本地显示 JSON,并在浏览器支持 Zstandard 或提供兼容的 decode_and_sanitize_tape_json JavaScript 钩子时解码 .tape 文件。浏览器原生解码不会校验 tape 完整性哈希。dtp-wasm crate 目前只提供 Rust 函数;未包含浏览器绑定或编译好的 WASM 产物。

--net 捕获明文 HTTP;目前不支持 HTTPS CONNECT 和分块请求体。该代理仅配置子进程环境,不安装系统 CA。

工作区声明使用 Rust 1.80,但当前锁定的 time 依赖需要 Rust 1.88;在该不匹配问题解决前,请使用兼容的工具链。

验证


        CARGO_INCREMENTAL=0 cargo test --workspace
CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets -- -D warnings
      

部分集成测试需要绑定环回套接字的权限。

许可证

Apache-2.0。协议规范是开放且供应商中立的。

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗