diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-21 02:38:14 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-21 02:42:39 +0300 |
| commit | 92a10fc044d42b216317696a4e8e6f70d7cc7a7d (patch) | |
| tree | a45fb881c85e66ff8641fa84bb2a1bf0ead584ed /src/integration/assets/kimi | |
| parent | 73b137a4ae75cb1465e8d4ddfc293ff7366d8133 (diff) | |
fix: protect root agent restore sessions
refs #712
Diffstat (limited to 'src/integration/assets/kimi')
| -rw-r--r-- | src/integration/assets/kimi/herdr-agent-state.ps1 | 8 | ||||
| -rw-r--r-- | src/integration/assets/kimi/herdr-agent-state.sh | 17 |
2 files changed, 6 insertions, 19 deletions
diff --git a/src/integration/assets/kimi/herdr-agent-state.ps1 b/src/integration/assets/kimi/herdr-agent-state.ps1 index d9924acc..ff6bcefe 100644 --- a/src/integration/assets/kimi/herdr-agent-state.ps1 +++ b/src/integration/assets/kimi/herdr-agent-state.ps1 @@ -2,11 +2,11 @@ # managed by herdr; reinstalling or updating the integration overwrites this file. # add custom hooks beside this file instead of editing it. # HERDR_INTEGRATION_ID=kimi -# HERDR_INTEGRATION_VERSION=3 +# HERDR_INTEGRATION_VERSION=4 param([string]$Action = "") -if (@("session", "working", "blocked", "idle", "release") -notcontains $Action) { exit 0 } +if (@("session", "working", "blocked", "idle") -notcontains $Action) { exit 0 } if ($env:HERDR_ENV -ne "1") { exit 0 } if ([string]::IsNullOrWhiteSpace($env:HERDR_PANE_ID)) { exit 0 } @@ -21,9 +21,7 @@ $seq = [DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds() $sessionId = if ($null -ne $payload -and -not [string]::IsNullOrWhiteSpace($payload.session_id)) { $payload.session_id } else { $null } try { - if ($Action -eq "release") { - & herdr pane release-agent $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --seq $seq 2>$null | Out-Null - } elseif ($Action -eq "session") { + if ($Action -eq "session") { if ([string]::IsNullOrWhiteSpace($sessionId)) { exit 0 } & herdr pane report-agent-session $env:HERDR_PANE_ID --source herdr:kimi --agent kimi --agent-session-id $sessionId --seq $seq 2>$null | Out-Null } else { diff --git a/src/integration/assets/kimi/herdr-agent-state.sh b/src/integration/assets/kimi/herdr-agent-state.sh index 2c8d8567..b5b6cc4b 100644 --- a/src/integration/assets/kimi/herdr-agent-state.sh +++ b/src/integration/assets/kimi/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=kimi -# HERDR_INTEGRATION_VERSION=3 +# HERDR_INTEGRATION_VERSION=4 set -eu @@ -13,7 +13,7 @@ trap 'rm -f "$hook_input_file"' EXIT HUP INT TERM cat >"$hook_input_file" 2>/dev/null || true case "$action" in - session|working|blocked|idle|release) ;; + session|working|blocked|idle) ;; *) exit 0 ;; esac @@ -54,18 +54,7 @@ agent_session_id = session_id if isinstance(session_id, str) and session_id else request_id = f"{source}:{int(time.time() * 1000)}:{random.randrange(1_000_000):06d}" report_seq = time.time_ns() -if action == "release": - request = { - "id": request_id, - "method": "pane.release_agent", - "params": { - "pane_id": pane_id, - "source": source, - "agent": agent, - "seq": report_seq, - }, - } -elif action == "session": +if action == "session": if not agent_session_id: raise SystemExit(0) request = { |
