diff options
| author | Dillon Mulroy <dillon.mulroy@gmail.com> | 2026-07-08 18:55:14 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-09 01:55:14 +0300 |
| commit | adbaae68daee7577b2dc93bd12507bfb67a2ca84 (patch) | |
| tree | 5a1d2e2e1a29bfa85d46f794f17eb87759ff8324 /src/integration/assets/pi | |
| parent | b03f033d0930ff64f94a09edea16b89af189e632 (diff) | |
fix: reanchor pi status after session replacement (#1189)
* fix: reanchor pi status after session replacement
refs #943
* fix: guard active pi sessions from nested startup
refs #943
* fix: serialize pi session replacement reports
refs #943
Diffstat (limited to 'src/integration/assets/pi')
| -rw-r--r-- | src/integration/assets/pi/herdr-agent-state.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/integration/assets/pi/herdr-agent-state.ts b/src/integration/assets/pi/herdr-agent-state.ts index 9048911f..52340ebb 100644 --- a/src/integration/assets/pi/herdr-agent-state.ts +++ b/src/integration/assets/pi/herdr-agent-state.ts @@ -2,7 +2,7 @@ // managed by herdr; reinstalling or updating the integration overwrites this file. // add custom hooks/plugins beside this file instead of editing it. // HERDR_INTEGRATION_ID=pi -// HERDR_INTEGRATION_VERSION=4 +// HERDR_INTEGRATION_VERSION=5 // @ts-nocheck import { createConnection } from "node:net"; @@ -121,7 +121,7 @@ function currentSessionRef(): Record<string, unknown> | undefined { return undefined; } -function reportSession(): Promise<void> { +function reportSession(sessionStartSource?: string): Promise<void> { const sessionRef = currentSessionRef(); if (!sessionRef) { return Promise.resolve(); @@ -135,6 +135,7 @@ function reportSession(): Promise<void> { source, agent: "pi", seq: nextReportSeq(), + session_start_source: sessionStartSource, ...sessionRef, }, }); @@ -336,13 +337,13 @@ export default function (pi) { publishState(); }); - pi.on("session_start", (_event, ctx) => { + pi.on("session_start", async (event, ctx) => { if (ctx?.hasUI !== true) { return; } rootSession = true; updateSessionRef(ctx); - void reportSession(); + await reportSession(event?.reason); // A reload can replace this extension mid-run without emitting another agent_start. agentActive = ctx?.isIdle?.() === false; publishState(true); |
