feat(cli): relay Stop, PostToolUse and PreToolUse to Antigravity (agy), not only SessionStart

未关闭
#1,194 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
44/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
cli

调研方向

Start with cli/src/contexts/tools/domain/profiles/antigravity/antigravity-hooks.ts and its MAPPED_EVENTS, then read tool-paths.md and the prior hook work in #890, #511, and #978. Verify how the profile maps event names, matchers, and hook outputs against the observed agy contracts, including PostInvocation context injection. Done means the acceptance criteria pass, including a guarded Stop continuation and an allow response for empty PreToolUse output.

由索引模型根据 Issue 内容生成。

描述

Problem

On next, the Antigravity profile relays only SessionStart (cli/src/contexts/tools/domain/profiles/antigravity/antigravity-hooks.ts, MAPPED_EVENTS), with the reason "Claude and agy name their tools differently". tool-paths.md lists PreToolUse, PostToolUse and Stop as supported by the host. A hook on any of those three does nothing on agy.

Measured on 2026-11-11 with agy -p (1.5.x, the binary auto-updated from 1.5.1 to 1.5.5 during the test), project file .agents/hooks.json, disposable folder:

  • SessionStart, PreToolUse, PostToolUse, Stop all fire. agy also has PreInvocation and PostInvocation. It has no UserPromptSubmit, SubagentStop or SessionEnd.
  • Tool names differ: write_file (args Path, Content) and run_command (args CommandLine), not Write and Bash.
  • Output contract differs from the framework's scripts: a Stop hook continues the agent with {"decision":"continue","reason":...}. An empty output from a PreToolUse hook is a denial, so a script that prints nothing blocks every tool call. {"decision":"allow"} is required.
  • PostToolUse could not inject context (documented as {} only). PostInvocation injected it with {"injectSteps":[{"systemMessage":{"systemMessage":"..."}}]}.
  • In -p, tools are refused unless permissions are skipped, which matters for CI.
  • Not tested: --settings, subagent hooks. One run per test, small model.
Scope
  • Relay Stop and PostToolUse (and PreToolUse once its output contract is handled) to agy, with matchers translated (Bash to run_command, Write and Edit to write_file).
  • Translate the hook output (block to continue, an empty PreToolUse output to allow), or document that scripts must handle it.
  • Decide how PostToolUse context injection works on agy (PostInvocation).
Acceptance criteria
  • A Stop script that blocks once continues the turn on agy, with a guard that stops the loop.
  • A PostToolUse script runs after write_file and run_command.
  • A PreToolUse script that prints nothing does not deny every tool call.
  • Events the profile does not relay produce a warning at build time (today: the unmapped event message already exists for the profile).
Prior art in this repo
  • antigravity-hooks.ts (MAPPED_EVENTS = {"SessionStart"}), #890 (hooks are read from hooks.json, not settings.json), #511 (Antigravity as a flat host), #978 (verified tool compatibility).
Out of scope

Telling agy to relay UserPromptSubmit or SessionEnd (they do not exist). The Antigravity IDE.

主要语言
TypeScript
星标
481
派生
45
平均合并
1 天 13 小时
30 天内合并 PR
91

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ai-driven-dev/framework 的其他 Issue

查看 ai-driven-dev/framework 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。