summaryrefslogtreecommitdiff
path: root/src/integration/mod.rs
diff options
context:
space:
mode:
authorLudovico Magnocavallo <ludo@qix.it>2026-08-01 18:32:47 +0200
committerGitHub <noreply@github.com>2026-08-01 19:32:47 +0300
commit679584fdd49f9dee5ad95755af65eedc7d0f455c (patch)
treeb21359553af294c2a2d57726e99029d86534cda0 /src/integration/mod.rs
parent219e0be351436b5bf1ccf5b7c13dbf6c2cdb0986 (diff)
feat: add antigravity-cli integration (#2087)
* feat: add antigravity_cli integration harness Register the `antigravity_cli` target, resolve its configuration directory to `~/.gemini/antigravity-cli/`, wire target actions, and add lifecycle hook scripts for Unix and Windows. * feat: support session resume for antigravity-cli * fix: correct antigravity-cli hook config path, shape, and agent label Antigravity CLI reads global customizations from ~/.gemini/config, keys hooks.json by hook name, and only accepts the matcher/hooks wrapper for the tool events. The previous install wrote event arrays at the top level of ~/.gemini/antigravity-cli/hooks.json, which agy never reads and would reject anyway, so no Herdr hook ever ran. Session reports were dropped for a third reason: the hooks reported the agent as antigravity-cli, but the server normalizes that to the canonical label agy before matching, so is_official_agent_source never matched and agy --conversation resume was unreachable. - Resolve the config dir to ~/.gemini/config - Nest Herdr entries under a Herdr-owned "herdr" block that install rewrites and uninstall removes, leaving other named hooks untouched - Emit grouped entries for PreToolUse/PostToolUse and flat handler lists for PreInvocation/PostInvocation/Stop - Report the canonical agy label from both hook assets and match it in agent_resume - Compile-gate the hook asset constants and stop shadowing $args in the PowerShell hook - Document the real directory, that it must already exist, and the named-block behavior refs #1011 refs #1571 * fix: make antigravity-cli integration session-only antigravity cli cannot express lifecycle safely: there is no blocked event, postinvocation is skipped on interruption, and stop fires at the end of a turn rather than on process exit, which left stale state and released authority at the wrong time. report only the conversation on preinvocation and let screen detection own agent state. resume via `agy --conversation <id>` is unchanged. * fix: update antigravity session after conversation switch --------- Co-authored-by: Can Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/integration/mod.rs')
-rw-r--r--src/integration/mod.rs27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/integration/mod.rs b/src/integration/mod.rs
index b691dce9..045d1bce 100644
--- a/src/integration/mod.rs
+++ b/src/integration/mod.rs
@@ -196,6 +196,32 @@ const QODERCLI_REMOVED_LIFECYCLE_HOOK_EVENTS: [(&str, &str); 12] = [
const CURSOR_HOOK_INSTALL_NAME: &str = "herdr-agent-state.sh";
const CURSOR_HOOK_ASSET: &str = include_str!("assets/cursor/herdr-agent-state.sh");
const CURSOR_INTEGRATION_VERSION: u32 = 1;
+#[cfg(windows)]
+const ANTIGRAVITY_CLI_HOOK_INSTALL_NAME: &str = "herdr-agent-state.ps1";
+#[cfg(not(windows))]
+const ANTIGRAVITY_CLI_HOOK_INSTALL_NAME: &str = "herdr-agent-state.sh";
+#[cfg(windows)]
+const ANTIGRAVITY_CLI_HOOK_ASSET: &str =
+ include_str!("assets/antigravity_cli/herdr-agent-state.ps1");
+#[cfg(not(windows))]
+const ANTIGRAVITY_CLI_HOOK_ASSET: &str =
+ include_str!("assets/antigravity_cli/herdr-agent-state.sh");
+const ANTIGRAVITY_CLI_INTEGRATION_VERSION: u32 = 1;
+/// Antigravity CLI keys `hooks.json` by hook name, so every Herdr entry lives
+/// under one Herdr-owned block that install rewrites and uninstall removes.
+const ANTIGRAVITY_CLI_HOOK_BLOCK_NAME: &str = "herdr";
+const ANTIGRAVITY_CLI_HOOK_TIMEOUT_SEC: u64 = 10;
+/// `(event, reported action)`. Session-only: `PreInvocation` is the only event
+/// we need because it carries `conversationId`. The others cannot express
+/// lifecycle safely — Antigravity CLI has no blocked event, `PostInvocation` is
+/// skipped on interruption, and `Stop` is end-of-turn rather than process exit.
+/// Screen detection owns agent state instead.
+///
+/// `PreInvocation` takes a flat handler list; only the `PreToolUse`/`PostToolUse`
+/// events accept a `matcher`/`hooks` wrapper, and sending one here would
+/// invalidate the whole file.
+const ANTIGRAVITY_CLI_HOOK_EVENTS: [(&str, &str); 1] = [("PreInvocation", "session")];
+const INTEGRATION_VERSION_MARKER: &str = "HERDR_INTEGRATION_VERSION=";
const MASTRACODE_HOOK_INSTALL_NAME: &str = "herdr-agent-state.sh";
const MASTRACODE_HOOK_ASSET: &str = include_str!("assets/mastracode/herdr-agent-state.sh");
const MASTRACODE_INTEGRATION_VERSION: u32 = 2;
@@ -219,7 +245,6 @@ const GROK_HOOK_INSTALL_NAME: &str = "herdr-agent-state.sh";
const GROK_HOOK_CONFIG_INSTALL_NAME: &str = "herdr.json";
const GROK_HOOK_ASSET: &str = include_str!("assets/grok/herdr-agent-state.sh");
const GROK_INTEGRATION_VERSION: u32 = 1;
-const INTEGRATION_VERSION_MARKER: &str = "HERDR_INTEGRATION_VERSION=";
pub(crate) const INSTALL_WARNING_PREFIX: &str = "warning:";