Skip to content

feat(antigravity-ide): 支持 Antigravity IDE 的完整会话记录 - #52

Open
iroha3 wants to merge 1 commit into
iAmCorey:mainfrom
iroha3:feat/antigravity-ide
Open

iroha3 wants to merge 1 commit into
iAmCorey:mainfrom
iroha3:feat/antigravity-ide

Conversation

@iroha3

@iroha3 iroha3 commented Sep 25, 2026

Copy link
Copy Markdown

声明

本 PR 由 AI 编码 Agent (agy-ide, Gemini 3.8 Flash & Pi, DeepSeek V4.1 Flash) 在 @iroha3 的协作与审阅下完成。

背景与问题

目前 Wake 对 Antigravity 的集成仅实现了对 CLI 摘要数据库的读取,缺失了对 IDE 环境完整会话日志的解析:

存储路径 内容 当前 (0.8.3) 读取状态
~/.gemini/antigravity-cli/conversation_summaries.db 会话摘要,正文加密 是(仅元数据/摘要)
~/.gemini/antigravity-ide/brain/*/.system_generated/logs/transcript.jsonl IDE 完整会话记录 否

缺少对 IDE 会话记录的解析,导致仅在 IDE 环境中使用 Antigravity 的用户无法在 Wake 中检索和查看完整的会话历史(包括消息正文、思考过程、工具调用和检查点等)。

本 PR 旨在补全对 Antigravity IDE 数据源的支持。(注:桌面端路径 ~/.gemini/antigravity/ 本次修改暂不覆盖。)

变更说明

1. 新增 Adapter adapters/antigravity_ide.rs 与 AgentId::AntigravityIde

  • 新增独立 Adapter 与 AgentId::AntigravityIde(命名为 "Antigravity IDE"),与 CLI 版本("Antigravity CLI")区分,以明确指示当前未覆盖桌面端。CLI Adapter 保持不动(代码无变动)。
  • 会话记录映射逻辑:
    • USER_INPUT → 用户消息(解析 <USER_REQUEST> 正文)
    • PLANNER_RESPONSE → 助手消息(提取 thinking 与 tool_calls)
    • RUN_COMMAND → 工具输出
    • CHECKPOINT → CompactSummary
    • 模型信息取自 USER_SETTINGS_CHANGE,项目路径结合 Active Document 与工具 cwd 并由 ~/.gemini/projects.json 归一化。

2. 支持文件形式的图片附件解析

  • IDE 的图片以本地文件形式存储于 <session>/.user_uploaded/media_<ms>.<ext>。
  • 实现了基于时间戳匹配的挂载逻辑:比对毫秒时间戳将图片挂载至 30 分钟内的最近用户轮次,设置 text_offset = text.len()。仅在启用 decode_images 时触发。

3. Roster 与配置契约更新

  • 更新 AgentId::ALL 数量为 22,调整 DEFAULT_INSTANCES 计数。
  • 配置远程 Layout、Open In 命令(agy --conversation=<id>)及 Insights 配色,图标复用 antigravity.png。

4. 文档同步

  • 在 README.md 与 PRODUCT.md 中更新 Antigravity CLI 与 IDE 的分项说明。

验证情况

  • 测试用例:添加合成 Fixture tests/fixtures/antigravity/brain/ag-ide-0001/,并通过 antigravity_ide_parse_contract 验证角色映射、标题提取、项目识别、思考过程提取、工具调用解析及图片挂载契约。
  • 本地及 CI 检查:
    • cargo fmt --all --check
    • cargo test -p wake-core
    • cargo test -p wake
    • cargo build --workspace
  • 实际环境验证:在真实环境下对 IDE 会话的列表加载、消息渲染、工具调用及图片解析进行了验证,运行正常。

已知边界

  • 暂不覆盖桌面端:~/.gemini/antigravity/brain/ 格式与 IDE 类似,但本次改动明确界定在 IDE Adapter,桌面端支持可后续另开 PR 处理。
  • 图片挂载启发式策略:图片基于时间戳向最近的用户轮次对齐(时间窗口上限 30 分钟)。极端长跨度会话可能会存在轮次偏移,但不会丢失图片数据。
  • 实时监听支持:data_roots 指向 brain/ 目录,可直接复用现有文件监听机制实时捕获新会话。

设计权衡探讨

我们在此处选择了两个独立的 AgentId(Antigravity 对应 CLI,AntigravityIde 对应 IDE),而非像 Cursor 那样多源共用同一个 AgentId。

主要考虑在于:目前桌面端的日志格式虽相同但未做覆盖,使用独立的 Agent ID 能更加准确地向用户传达当前支持的范围。如果我们希望保持全局 Agent ID 命名的简洁性、向 Cursor 的多源模式对齐,我们也可以将其调整为共用 AgentId::Antigravity 的实现。

Antigravity IDE is a separate tool from the Antigravity CLI (and the
desktop app): it writes full plaintext transcripts under
~/.gemini/antigravity-ide/brain/<id>/.system_generated/logs/transcript.jsonl,
while the CLI keeps only an encrypted body plus a summaries DB.

Read the IDE transcripts from a dedicated adapter, mirroring the Cursor
CLI/IDE split: two adapters, one shared AgentId::Antigravity, two roster
instances. The existing CLI adapter is left untouched. Parses user
requests, thinking, tool calls and outputs, and checkpoints. User-uploaded
images live under the session's .user_uploaded/ and are re-attached to the
nearest user turn by the media filename timestamp (28/36 within 60s on
real data).
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