diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-07 23:10:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-07 23:10:28 +0300 |
| commit | 50ddc06f00ec69ede35fd5488a260dec2b74e98a (patch) | |
| tree | 2a01f30600ccfea600040476703cf7de50087156 /src/integration/assets/grok | |
| parent | 7d77e927eba265ea864485bf99411abcf62d977d (diff) | |
feat: support all agent integrations on windows (#2496)
Diffstat (limited to 'src/integration/assets/grok')
| -rw-r--r-- | src/integration/assets/grok/herdr-agent-state.ps1 | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/integration/assets/grok/herdr-agent-state.ps1 b/src/integration/assets/grok/herdr-agent-state.ps1 new file mode 100644 index 00000000..69c4f515 --- /dev/null +++ b/src/integration/assets/grok/herdr-agent-state.ps1 @@ -0,0 +1,41 @@ +# installed by herdr +# managed by herdr; reinstalling or updating the integration overwrites this file. +# add custom hooks beside this file instead of editing it. +# HERDR_INTEGRATION_ID=grok +# HERDR_INTEGRATION_VERSION=1 + +param([string]$Action = "") + +if ($Action -ne "session") { exit 0 } +if ($env:HERDR_ENV -ne "1") { exit 0 } +if ([string]::IsNullOrWhiteSpace($env:HERDR_PANE_ID)) { exit 0 } + +$inputText = [Console]::In.ReadToEnd() +try { + $payload = if ([string]::IsNullOrWhiteSpace($inputText)) { $null } else { $inputText | ConvertFrom-Json } +} catch { + $payload = $null +} + +$event = if ($null -ne $payload -and $payload.hook_event_name -is [string]) { + $payload.hook_event_name +} elseif ($null -ne $payload -and $payload.hookEventName -is [string]) { + $payload.hookEventName +} else { + $null +} +if ($null -ne $event -and $event -notin @("session_start", "SessionStart", "sessionStart")) { exit 0 } + +$sessionId = $env:GROK_SESSION_ID +if ([string]::IsNullOrWhiteSpace($sessionId) -and $null -ne $payload) { + if ($payload.session_id -is [string]) { $sessionId = $payload.session_id } + elseif ($payload.sessionId -is [string]) { $sessionId = $payload.sessionId } +} +if ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 } + +$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:grok --agent grok --seq $seq --agent-session-id $sessionId 2>$null | Out-Null +} catch { +} |
