aboutsummaryrefslogtreecommitdiff
path: root/src/integration/assets/cursor
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-08-07 23:10:28 +0300
committerGitHub <noreply@github.com>2026-08-07 23:10:28 +0300
commit50ddc06f00ec69ede35fd5488a260dec2b74e98a (patch)
tree2a01f30600ccfea600040476703cf7de50087156 /src/integration/assets/cursor
parent7d77e927eba265ea864485bf99411abcf62d977d (diff)
feat: support all agent integrations on windows (#2496)
Diffstat (limited to 'src/integration/assets/cursor')
-rw-r--r--src/integration/assets/cursor/herdr-agent-state.ps148
1 files changed, 48 insertions, 0 deletions
diff --git a/src/integration/assets/cursor/herdr-agent-state.ps1 b/src/integration/assets/cursor/herdr-agent-state.ps1
new file mode 100644
index 00000000..ebfdb393
--- /dev/null
+++ b/src/integration/assets/cursor/herdr-agent-state.ps1
@@ -0,0 +1,48 @@
+# managed by herdr; reinstalling the integration replaces this file.
+# HERDR_INTEGRATION_ID=cursor
+# HERDR_INTEGRATION_VERSION=1
+
+param([string]$Action = "")
+
+function Exit-Hook {
+ Write-Output "{}"
+ exit 0
+}
+
+if ($Action -ne "session") { Exit-Hook }
+if ($env:HERDR_ENV -ne "1") { Exit-Hook }
+if ([string]::IsNullOrWhiteSpace($env:HERDR_PANE_ID)) { Exit-Hook }
+
+$inputText = [Console]::In.ReadToEnd()
+$jsonStart = $inputText.IndexOf("{")
+if ($jsonStart -gt 0) {
+ $inputText = $inputText.Substring($jsonStart)
+}
+try {
+ $payload = if ([string]::IsNullOrWhiteSpace($inputText)) { $null } else { $inputText | ConvertFrom-Json }
+} catch {
+ Exit-Hook
+}
+
+if ($null -eq $payload) { Exit-Hook }
+$event = if ($payload.hook_event_name -is [string]) { $payload.hook_event_name } else { $payload.hookEventName }
+if (-not [string]::IsNullOrWhiteSpace($event) -and $event -ne "sessionStart") { Exit-Hook }
+
+$sessionId = $null
+foreach ($name in @("session_id", "sessionId", "conversation_id", "conversationId")) {
+ $value = $payload.$name
+ if ($value -is [string] -and -not [string]::IsNullOrWhiteSpace($value)) {
+ $sessionId = $value
+ break
+ }
+}
+if ([string]::IsNullOrWhiteSpace($sessionId)) { Exit-Hook }
+
+$seq = [DateTime]::UtcNow.Ticks
+$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:cursor --agent cursor --seq $seq --agent-session-id $sessionId 2>$null | Out-Null
+} catch {
+}
+
+Exit-Hook