the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix: use the running binary in agent hooks (#2722)
JJ Liebig1079fff412ca
diff --git a/src/integration/assets/antigravity_cli/herdr-agent-state.ps1 b/src/integration/assets/antigravity_cli/herdr-agent-state.ps1index aecb42a9e..047177570 100644--- a/src/integration/assets/antigravity_cli/herdr-agent-state.ps1+++ b/src/integration/assets/antigravity_cli/herdr-agent-state.ps1@@ -2,7 +2,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=antigravity_cli-# HERDR_INTEGRATION_VERSION=1+# HERDR_INTEGRATION_VERSION=2# Session-only: this hook reports the Antigravity conversation so Herdr can# resume the pane. Lifecycle state comes from Herdr's screen detection.@@ -33,6 +33,7 @@ $conversationId = if ($payload.conversationId -is [string]) { $payload.conversatif ([string]::IsNullOrWhiteSpace($conversationId)) { Exit-Hook }$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()+$herdr = if ([string]::IsNullOrWhiteSpace($env:HERDR_BIN_PATH)) { "herdr" } else { $env:HERDR_BIN_PATH }try {$sessionArgs = @("pane",@@ -50,7 +51,7 @@ try {if ($payload.transcriptPath -is [string] -and -not [string]::IsNullOrWhiteSpace($payload.transcriptPath)) {$sessionArgs += @("--agent-session-path", "$($payload.transcriptPath)")}- & herdr @sessionArgs 2>$null | Out-Null+ & $herdr @sessionArgs 2>$null | Out-Null} catch {}diff --git a/src/integration/assets/antigravity_cli/herdr-agent-state.sh b/src/integration/assets/antigravity_cli/herdr-agent-state.shindex dd3db028b..859ec3780 100644--- a/src/integration/assets/antigravity_cli/herdr-agent-state.sh+++ b/src/integration/assets/antigravity_cli/herdr-agent-state.sh@@ -3,7 +3,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=antigravity_cli-# HERDR_INTEGRATION_VERSION=1+# HERDR_INTEGRATION_VERSION=2# Session-only: this hook reports the Antigravity conversation so Herdr can# resume the pane. Lifecycle state comes from Herdr's screen detection.diff --git a/src/integration/assets/claude/herdr-agent-state.ps1 b/src/integration/assets/claude/herdr-agent-state.ps1index dcc9d4df3..d82a6fe3a 100644--- a/src/integration/assets/claude/herdr-agent-state.ps1+++ b/src/integration/assets/claude/herdr-agent-state.ps1@@ -2,7 +2,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=claude-# HERDR_INTEGRATION_VERSION=7+# HERDR_INTEGRATION_VERSION=8param([string]$Action = "")@@ -24,6 +24,7 @@ $sessionId = $payload.session_idif ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 }$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()+$herdr = if ([string]::IsNullOrWhiteSpace($env:HERDR_BIN_PATH)) { "herdr" } else { $env:HERDR_BIN_PATH }try {$args = @("pane",@@ -44,6 +45,6 @@ try {if ($payload.hook_event_name -eq "SessionStart" -and $payload.source -is [string] -and -not [string]::IsNullOrWhiteSpace($payload.source)) {$args += @("--session-start-source", "$($payload.source)")}- & herdr @args 2>$null | Out-Null+ & $herdr @args 2>$null | Out-Null} catch {}diff --git a/src/integration/assets/claude/herdr-agent-state.sh b/src/integration/assets/claude/herdr-agent-state.shindex cb5e840d5..9b9a7dfdc 100644--- a/src/integration/assets/claude/herdr-agent-state.sh+++ b/src/integration/assets/claude/herdr-agent-state.sh@@ -3,7 +3,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=claude-# HERDR_INTEGRATION_VERSION=7+# HERDR_INTEGRATION_VERSION=8set -eudiff --git a/src/integration/assets/codex/herdr-agent-state.ps1 b/src/integration/assets/codex/herdr-agent-state.ps1index b578e7b9b..81ed381b9 100644--- a/src/integration/assets/codex/herdr-agent-state.ps1+++ b/src/integration/assets/codex/herdr-agent-state.ps1@@ -2,7 +2,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=codex-# HERDR_INTEGRATION_VERSION=7+# HERDR_INTEGRATION_VERSION=8param([string]$Action = "")@@ -25,6 +25,7 @@ if ([string]::IsNullOrWhiteSpace($payload.transcript_path)) { exit 0 }if (-not [string]::IsNullOrWhiteSpace($env:CODEX_THREAD_ID) -and $env:CODEX_THREAD_ID -ne $sessionId) { exit 0 }$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()+$herdr = if ([string]::IsNullOrWhiteSpace($env:HERDR_BIN_PATH)) { "herdr" } else { $env:HERDR_BIN_PATH }try {$args = @("pane",@@ -42,6 +43,6 @@ try {if ($payload.hook_event_name -eq "SessionStart" -and $payload.source -is [string] -and -not [string]::IsNullOrWhiteSpace($payload.source)) {$args += @("--session-start-source", "$($payload.source)")}- & herdr @args 2>$null | Out-Null+ & $herdr @args 2>$null | Out-Null} catch {}diff --git a/src/integration/assets/codex/herdr-agent-state.sh b/src/integration/assets/codex/herdr-agent-state.shindex 687a8181e..2931936a1 100644--- a/src/integration/assets/codex/herdr-agent-state.sh+++ b/src/integration/assets/codex/herdr-agent-state.sh@@ -3,7 +3,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=codex-# HERDR_INTEGRATION_VERSION=7+# HERDR_INTEGRATION_VERSION=8set -eudiff --git a/src/integration/assets/copilot/herdr-agent-state.ps1 b/src/integration/assets/copilot/herdr-agent-state.ps1index 8951eacb9..f424f122c 100644--- a/src/integration/assets/copilot/herdr-agent-state.ps1+++ b/src/integration/assets/copilot/herdr-agent-state.ps1@@ -2,7 +2,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=copilot-# HERDR_INTEGRATION_VERSION=2+# HERDR_INTEGRATION_VERSION=3if ($env:HERDR_ENV -ne "1") { exit 0 }if ([string]::IsNullOrWhiteSpace($env:HERDR_PANE_ID)) { exit 0 }@@ -49,4 +49,5 @@ if ([string]::IsNullOrWhiteSpace($sessionId)) {if ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 }$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()-& herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:copilot --agent copilot --agent-session-id $sessionId --seq $seq 2>$null | Out-Null+$herdr = if ([string]::IsNullOrWhiteSpace($env:HERDR_BIN_PATH)) { "herdr" } else { $env:HERDR_BIN_PATH }+& $herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:copilot --agent copilot --agent-session-id $sessionId --seq $seq 2>$null | Out-Nulldiff --git a/src/integration/assets/copilot/herdr-agent-state.sh b/src/integration/assets/copilot/herdr-agent-state.shindex 1ae0362b4..82522ac1b 100644--- a/src/integration/assets/copilot/herdr-agent-state.sh+++ b/src/integration/assets/copilot/herdr-agent-state.sh@@ -3,7 +3,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=copilot-# HERDR_INTEGRATION_VERSION=2+# HERDR_INTEGRATION_VERSION=3set -eudiff --git a/src/integration/assets/droid/herdr-agent-state.ps1 b/src/integration/assets/droid/herdr-agent-state.ps1index f3bb0f688..fa6a4e259 100644--- a/src/integration/assets/droid/herdr-agent-state.ps1+++ b/src/integration/assets/droid/herdr-agent-state.ps1@@ -2,7 +2,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=droid-# HERDR_INTEGRATION_VERSION=2+# HERDR_INTEGRATION_VERSION=3param([string]$Action = "")@@ -20,7 +20,8 @@ try {if ($null -eq $payload -or [string]::IsNullOrWhiteSpace($payload.session_id)) { exit 0 }$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()+$herdr = if ([string]::IsNullOrWhiteSpace($env:HERDR_BIN_PATH)) { "herdr" } else { $env:HERDR_BIN_PATH }try {- & herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:droid --agent droid --agent-session-id $payload.session_id --seq $seq 2>$null | Out-Null+ & $herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:droid --agent droid --agent-session-id $payload.session_id --seq $seq 2>$null | Out-Null} catch {}diff --git a/src/integration/assets/droid/herdr-agent-state.sh b/src/integration/assets/droid/herdr-agent-state.shindex ddab463e8..d777b2c11 100644--- a/src/integration/assets/droid/herdr-agent-state.sh+++ b/src/integration/assets/droid/herdr-agent-state.sh@@ -3,7 +3,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=droid-# HERDR_INTEGRATION_VERSION=2+# HERDR_INTEGRATION_VERSION=3set -eudiff --git a/src/integration/assets/kimi/herdr-agent-state.ps1 b/src/integration/assets/kimi/herdr-agent-state.ps1index c298dda4a..3141326d1 100644--- a/src/integration/assets/kimi/herdr-agent-state.ps1+++ b/src/integration/assets/kimi/herdr-agent-state.ps1@@ -2,7 +2,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=kimi-# HERDR_INTEGRATION_VERSION=6+# HERDR_INTEGRATION_VERSION=7param([string]$Action = "")@@ -19,16 +19,17 @@ try {$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()$sessionId = if ($null -ne $payload -and -not [string]::IsNullOrWhiteSpace($payload.session_id)) { $payload.session_id } else { $null }+$herdr = if ([string]::IsNullOrWhiteSpace($env:HERDR_BIN_PATH)) { "herdr" } else { $env:HERDR_BIN_PATH }try {if ($Action -eq "session") {if ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 }- & herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --agent-session-id $sessionId --session-start-source startup --seq $seq 2>$null | Out-Null+ & $herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --agent-session-id $sessionId --session-start-source startup --seq $seq 2>$null | Out-Null} else {if ([string]::IsNullOrWhiteSpace($sessionId)) {- & herdr pane report-agent $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --state $Action --seq $seq 2>$null | Out-Null+ & $herdr pane report-agent $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --state $Action --seq $seq 2>$null | Out-Null} else {- & herdr pane report-agent $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --state $Action --agent-session-id $sessionId --seq $seq 2>$null | Out-Null+ & $herdr pane report-agent $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --state $Action --agent-session-id $sessionId --seq $seq 2>$null | Out-Null}}} catch {diff --git a/src/integration/assets/kimi/herdr-agent-state.sh b/src/integration/assets/kimi/herdr-agent-state.shindex e919300f3..c8ed8e239 100644--- a/src/integration/assets/kimi/herdr-agent-state.sh+++ b/src/integration/assets/kimi/herdr-agent-state.sh@@ -1,7 +1,7 @@#!/bin/sh# managed by herdr; reinstalling the integration replaces this file.# HERDR_INTEGRATION_ID=kimi-# HERDR_INTEGRATION_VERSION=6+# HERDR_INTEGRATION_VERSION=7action="${1:-}"case "$action" indiff --git a/src/integration/assets/qodercli/herdr-agent-state.ps1 b/src/integration/assets/qodercli/herdr-agent-state.ps1index df527f6df..6d0e037b6 100644--- a/src/integration/assets/qodercli/herdr-agent-state.ps1+++ b/src/integration/assets/qodercli/herdr-agent-state.ps1@@ -2,7 +2,7 @@# managed by herdr; reinstalling or updating the integration overwrites this file.# add custom hooks beside this file instead of editing it.# HERDR_INTEGRATION_ID=qodercli-# HERDR_INTEGRATION_VERSION=2+# HERDR_INTEGRATION_VERSION=3param([string]$Action = "")@@ -20,7 +20,8 @@ try {if ($null -eq $payload -or [string]::IsNullOrWhiteSpace($payload.session_id)) { exit 0 }$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()+$herdr = if ([string]::IsNullOrWhiteSpace($env:HERDR_BIN_PATH)) { "herdr" } else { $env:HERDR_BIN_PATH }try {- & herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:qodercli --agent qodercli --agent-session-id $payload.session_id --seq $seq 2>$null | Out-Null+ & $herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:qodercli --agent qodercli --agent-session-id $payload.session_id --seq $seq 2>$null | Out-Null} catch {}diff --git a/src/integration/assets/qodercli/herdr-agent-state.sh b/src/integration/assets/qodercli/herdr-agent-state.shindex 871549e6b..8f03389a1 100644--- a/src/integration/assets/qodercli/herdr-agent-state.sh+++ b/src/integration/assets/qodercli/herdr-agent-state.sh@@ -1,13 +1,12 @@#!/bin/sh# managed by herdr; reinstalling the integration replaces this file.# HERDR_INTEGRATION_ID=qodercli-# HERDR_INTEGRATION_VERSION=2+# HERDR_INTEGRATION_VERSION=3[ "${1:-}" = "session" ] || exit 0[ "${HERDR_ENV:-}" = "1" ] || exit 0[ -n "${HERDR_SOCKET_PATH:-}" ] || exit 0[ -n "${HERDR_PANE_ID:-}" ] || exit 0-command -v herdr >/dev/null 2>&1 || exit 0command -v python3 >/dev/null 2>&1 || exit 0python3 -c '@@ -24,7 +23,8 @@ try:raise ValueErrorsubprocess.run([- "herdr", "pane", "report-agent-session", os.environ["HERDR_PANE_ID"],+ os.environ.get("HERDR_BIN_PATH") or "herdr",+ "pane", "report-agent-session", os.environ["HERDR_PANE_ID"],"--source", "herdr:qodercli", "--agent", "qodercli","--agent-session-id", session_id, "--seq", str(time.time_ns()),],diff --git a/src/integration/mod.rs b/src/integration/mod.rsindex 9630b578a..597aabc5f 100644--- a/src/integration/mod.rs+++ b/src/integration/mod.rs@@ -38,7 +38,7 @@ const CLAUDE_HOOK_ASSET: &str = if cfg!(windows) {} else {include_str!("assets/claude/herdr-agent-state.sh")};-const CLAUDE_INTEGRATION_VERSION: u32 = 7;+const CLAUDE_INTEGRATION_VERSION: u32 = 8;const CODEX_HOOK_INSTALL_NAME: &str = if cfg!(windows) {"herdr-agent-state.ps1"} else {@@ -49,7 +49,7 @@ const CODEX_HOOK_ASSET: &str = if cfg!(windows) {} else {include_str!("assets/codex/herdr-agent-state.sh")};-const CODEX_INTEGRATION_VERSION: u32 = 7;+const CODEX_INTEGRATION_VERSION: u32 = 8;const KIMI_HOOK_INSTALL_NAME: &str = if cfg!(windows) {"herdr-agent-state.ps1"} else {@@ -60,7 +60,7 @@ const KIMI_HOOK_ASSET: &str = if cfg!(windows) {} else {include_str!("assets/kimi/herdr-agent-state.sh")};-const KIMI_INTEGRATION_VERSION: u32 = 6;+const KIMI_INTEGRATION_VERSION: u32 = 7;const KIMI_CONFIG_BLOCK_BEGIN: &str = "# >>> herdr kimi integration";const KIMI_CONFIG_BLOCK_END: &str = "# <<< herdr kimi integration";const KIMI_MIN_VERSION: &str = "0.14.0";@@ -102,7 +102,7 @@ const COPILOT_HOOK_ASSET: &str = if cfg!(windows) {} else {include_str!("assets/copilot/herdr-agent-state.sh")};-const COPILOT_INTEGRATION_VERSION: u32 = 2;+const COPILOT_INTEGRATION_VERSION: u32 = 3;const COPILOT_HOOK_EVENTS: [&str; 1] = ["SessionStart"];const COPILOT_REMOVED_LIFECYCLE_HOOK_EVENTS: [&str; 9] = ["UserPromptSubmit",@@ -152,7 +152,7 @@ const DROID_HOOK_ASSET: &str = if cfg!(windows) {} else {include_str!("assets/droid/herdr-agent-state.sh")};-const DROID_INTEGRATION_VERSION: u32 = 2;+const DROID_INTEGRATION_VERSION: u32 = 3;const DROID_HOOK_EVENTS: [(&str, &str); 1] = [("SessionStart", "session")];const DROID_REMOVED_LIFECYCLE_HOOK_EVENTS: [(&str, &str); 9] = [("SessionStart", "idle"),@@ -190,7 +190,7 @@ const QODERCLI_HOOK_ASSET: &str = if cfg!(windows) {} else {include_str!("assets/qodercli/herdr-agent-state.sh")};-const QODERCLI_INTEGRATION_VERSION: u32 = 2;+const QODERCLI_INTEGRATION_VERSION: u32 = 3;const QODERCLI_HOOK_EVENTS: [(&str, &str); 1] = [("SessionStart", "session")];const QODERCLI_REMOVED_LIFECYCLE_HOOK_EVENTS: [(&str, &str); 12] = [("SessionStart", "idle"),@@ -227,7 +227,7 @@ const ANTIGRAVITY_CLI_HOOK_ASSET: &str =#[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;+const ANTIGRAVITY_CLI_INTEGRATION_VERSION: u32 = 2;/// 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";diff --git a/src/integration/tests.rs b/src/integration/tests.rsindex 6eaf7a393..324ae6ce9 100644--- a/src/integration/tests.rs+++ b/src/integration/tests.rs@@ -1058,7 +1058,7 @@ fn claude_v1_integration_status_is_outdated() {assert_eq!(claude.path, hook_path);assert_eq!(claude.installed_version, Some(1));- assert_eq!(claude.expected_version, 7);+ assert_eq!(claude.expected_version, 8);assert_eq!(claude.state, IntegrationStatusKind::Outdated);std::env::remove_var("HOME");@@ -1088,7 +1088,7 @@ fn claude_v2_integration_status_is_outdated() {assert_eq!(claude.path, hook_path);assert_eq!(claude.installed_version, Some(2));- assert_eq!(claude.expected_version, 7);+ assert_eq!(claude.expected_version, 8);assert_eq!(claude.state, IntegrationStatusKind::Outdated);std::env::remove_var("HOME");@@ -1221,7 +1221,7 @@ fn codex_v2_integration_status_is_outdated() {assert_eq!(codex.path, hook_path);assert_eq!(codex.installed_version, Some(2));- assert_eq!(codex.expected_version, 7);+ assert_eq!(codex.expected_version, 8);assert_eq!(codex.state, IntegrationStatusKind::Outdated);std::env::remove_var("HOME");@@ -2724,6 +2724,11 @@ fn bundled_integration_asset_versions_match_expected_versions() {QODERCLI_INTEGRATION_VERSION,),("cursor", CURSOR_HOOK_ASSET, CURSOR_INTEGRATION_VERSION),+ (+ "antigravity_cli",+ ANTIGRAVITY_CLI_HOOK_ASSET,+ ANTIGRAVITY_CLI_INTEGRATION_VERSION,+ ),("mastracode",MASTRACODE_HOOK_ASSET,