aboutsummaryrefslogtreecommitdiff
path: root/src/integration/assets/codex/herdr-agent-state.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'src/integration/assets/codex/herdr-agent-state.ps1')
-rw-r--r--src/integration/assets/codex/herdr-agent-state.ps122
1 files changed, 20 insertions, 2 deletions
diff --git a/src/integration/assets/codex/herdr-agent-state.ps1 b/src/integration/assets/codex/herdr-agent-state.ps1
index e56948f5..d837b78a 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=5
+# HERDR_INTEGRATION_VERSION=6
param([string]$Action = "")
@@ -17,11 +17,29 @@ try {
exit 0
}
+if ($payload.hook_event_name -and $payload.hook_event_name -ne "SessionStart") { exit 0 }
+
$sessionId = $payload.session_id
if ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 }
$seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()
try {
- & herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:codex --agent codex --seq $seq --agent-session-id $sessionId 2>$null | Out-Null
+ $args = @(
+ "pane",
+ "report-agent-session",
+ $env:HERDR_PANE_ID,
+ "--source",
+ "herdr:codex",
+ "--agent",
+ "codex",
+ "--seq",
+ "$seq",
+ "--agent-session-id",
+ "$sessionId"
+ )
+ 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
} catch {
}