diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 19:45:16 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 19:45:16 +0300 |
| commit | c01b947d0bde1663980a15727938ac666ce31f61 (patch) | |
| tree | 009ad30854d0112f75a0a5ae964b9a6c72ff41ee /src/integration/assets/qodercli | |
| parent | 9c101b71d83941ee59d2b68f32f624afd7e2d78e (diff) | |
fix: support windows agent hooks and input paths
Diffstat (limited to 'src/integration/assets/qodercli')
| -rw-r--r-- | src/integration/assets/qodercli/herdr-agent-state.ps1 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/integration/assets/qodercli/herdr-agent-state.ps1 b/src/integration/assets/qodercli/herdr-agent-state.ps1 new file mode 100644 index 00000000..f7102817 --- /dev/null +++ b/src/integration/assets/qodercli/herdr-agent-state.ps1 @@ -0,0 +1,35 @@ +# 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=qodercli +# HERDR_INTEGRATION_VERSION=1 + +param([string]$Action = "") + +if ($Action -notin @("working", "idle", "blocked", "release")) { 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 +} + +if ($payload.hook_event_name -eq "SubagentStop") { exit 0 } +if ($payload.agent_id -and $Action -in @("idle", "release")) { exit 0 } + +$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() +try { + if ($Action -eq "release") { + & herdr pane release-agent $env:HERDR_PANE_ID --source herdr:qodercli --agent qodercli --seq $seq 2>$null | Out-Null + } else { + $args = @("pane", "report-agent", $env:HERDR_PANE_ID, "--source", "herdr:qodercli", "--agent", "qodercli", "--state", $Action, "--seq", "$seq") + if (-not [string]::IsNullOrWhiteSpace($payload.session_id)) { + $args += @("--agent-session-id", $payload.session_id) + } + & herdr @args 2>$null | Out-Null + } +} catch { +} |
