aboutsummaryrefslogtreecommitdiff
path: root/src/integration/assets/claude
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-08-28 18:03:07 +0300
committerGitHub <noreply@github.com>2026-08-28 18:03:07 +0300
commitc5051933f812a07e8014cd11dde2e2caac3af84c (patch)
treed079d040ea59d98fdb0e5e8bc48be33eeda3b7b0 /src/integration/assets/claude
parentf457cff4f2648eee85d176f8a41861241d4e8428 (diff)
fix: ignore cursor events in claude hooks (#3342)
refs #2832
Diffstat (limited to 'src/integration/assets/claude')
-rw-r--r--src/integration/assets/claude/herdr-agent-state.ps16
-rw-r--r--src/integration/assets/claude/herdr-agent-state.sh11
2 files changed, 9 insertions, 8 deletions
diff --git a/src/integration/assets/claude/herdr-agent-state.ps1 b/src/integration/assets/claude/herdr-agent-state.ps1
index d82a6fe3..fc596865 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=8
+# HERDR_INTEGRATION_VERSION=9
param([string]$Action = "")
@@ -17,8 +17,10 @@ try {
exit 0
}
+$propertyNames = @($payload.PSObject.Properties.Name)
+if ((Test-Path Env:CURSOR_VERSION) -or $propertyNames -ccontains "cursor_version") { exit 0 }
+if (-not ($propertyNames -ccontains "hook_event_name") -or $payload.hook_event_name -isnot [string] -or $payload.hook_event_name -cne "SessionStart") { exit 0 }
if (-not [string]::IsNullOrWhiteSpace($payload.agent_id)) { exit 0 }
-if ($payload.hook_event_name -eq "SubagentStop") { exit 0 }
$sessionId = $payload.session_id
if ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 }
diff --git a/src/integration/assets/claude/herdr-agent-state.sh b/src/integration/assets/claude/herdr-agent-state.sh
index 9b9a7dfd..5d11a80c 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=8
+# HERDR_INTEGRATION_VERSION=9
set -eu
@@ -48,15 +48,14 @@ if hook_input_file:
except Exception:
hook_input = {}
+if "CURSOR_VERSION" in os.environ or "cursor_version" in hook_input:
+ raise SystemExit(0)
hook_event_name = str(hook_input.get("hook_event_name") or "")
+if hook_event_name != "SessionStart":
+ raise SystemExit(0)
is_subagent = bool(hook_input.get("agent_id"))
if is_subagent:
raise SystemExit(0)
-if hook_event_name == "SubagentStop":
- # SubagentStop is a completion event. Older Herdr integrations mapped it
- # to durable working, but Claude recap/away-summary can emit it after the
- # main turn has already stopped. Never let it revive an idle pane.
- raise SystemExit(0)
request_id = f"{source}:{int(time.time() * 1000)}:{random.randrange(1_000_000):06d}"
report_seq = time.time_ns()
session_id = hook_input.get("session_id")