Skip to content

Feat: Add Antigravity agent adapter - #161

Open
shyinlim wants to merge 1 commit into
nexu-io:mainfrom
shyinlim:feat/antigravity-support
Open

shyinlim wants to merge 1 commit into
nexu-io:mainfrom
shyinlim:feat/antigravity-support

Conversation

@shyinlim

@shyinlim shyinlim commented Oct 3, 2026

Copy link
Copy Markdown

Summary

Add support for Google's Antigravity CLI (agy) as a supported coding agent adapter across the web application and CLI.

Changes

  • Agent Detection (detect.ts, agents-detect.ts):
  • Registered antigravity definition (bin: "agy", vendor: "Google", protocol: "argv").
  • Added ANTIGRAVITY_BIN environment override support.
  • Invocation & CLI Arguments (argv.ts, agents-invoke.ts):
  • Configured buildArgv() with --output-format stream-json --dangerously-skip-permissions --disable-slash-commands --effort medium -p.
  • Kept -p trailing so the prompt is appended as the positional argument.
  • Forwarded --model when specified.
  • Stream-JSON Parsing & Tool Rescue:
  • Handled stream-json event envelopes (init, step_update, result).
  • Extracted session (conversation_id), cwd, thinking_delta, and execution duration/status.
  • Mapped agy usage tokens (cache_read_tokens) to Claude-compatible usage metrics.
  • Rescued generated HTML from write_to_file tool call parameters (TargetFile, CodeContent).
  • Added de-duplication so result.response is only emitted as a fallback if no streamed text deltas were observed.
  • Tests & Documentation:
  • Added comprehensive unit tests in argv.test.ts and agents-invoke.test.ts.
  • Updated CLI tables and badges in README.md and README.zh-CN.md.

Verification

  • pnpm -F @html-anything/next test passed.
image
  • pnpm -F @html-anything/cli test passed.
image
  • pnpm -F @html-anything/next typecheck passed.
image
  • pnpm -F @html-anything/next dev E2E test passed.
    session = 61a496f0-67d3-434e-9aee-8557c52fb928
Settings Preview Terminal Logs
image image image

概述

在 Web 应用与 CLI 中新增对 Google Antigravity CLI (agy) 的适配支持,作为可用的代码生成 Agent。

变更内容

Agent 检测 (detect.ts, agents-detect.ts)

  • 注册 antigravity 定义(bin: "agy", vendor: "Google", protocol: "argv")。
  • 新增 ANTIGRAVITY_BIN 环境变量覆盖支持。

调用与命令行参数 (argv.ts, agents-invoke.ts)

  • 在 buildArgv() 中配置参数:--output-format stream-json --dangerously-skip-permissions --disable-slash-commands --effort medium - p。
  • 将 -p 保持在末尾,以便将 prompt 作为位置参数追加在其后。
  • 允许在指定时透传 --model。

Stream-JSON 解析与 Tool Rescue

  • 处理 stream-json 事件信封(init, step_update, result)。
  • 提取 session (conversation_id)、cwd、thinking_delta 以及执行耗时与状态。
  • 将 agy 的使用量指标(cache_read_tokens)映射为兼容 Claude 格式的 usage 字段。
  • 支持从 write_to_file 工具调用参数(TargetFile, CodeContent)中挽救并提取生成的 HTML。
  • 增加防重复机制:仅在未接收到流式 text delta 时,才将 result.response 作为兜底内容输出。

@shyinlim
shyinlim marked this pull request as ready for review October 3, 2026 10:06
@lefarcen
lefarcen requested a review from PerishCode October 3, 2026 10:07
@lefarcen lefarcen added size/L Large change: 300-699 changed lines risk/medium Medium risk change type/feature Feature or new user-facing capability labels Oct 3, 2026

@PerishCode PerishCode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shyinlim I reviewed the Antigravity adapter across the web and CLI paths, including detection, argv construction, NDJSON parsing, streamed-response de-duplication, usage metadata, HTML recovery from write_to_file, documentation, and the added fixtures. The implementation aligns with the documented agy headless event contract and the changed ranges are internally consistent. Nice work carrying the adapter through both product surfaces and covering the important parser boundaries.

🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.

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

Labels

risk/medium Medium risk change size/L Large change: 300-699 changed lines type/feature Feature or new user-facing capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants