aboutsummaryrefslogtreecommitdiff
path: root/src/integration/assets/pi/herdr-agent-state.ts
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-24 02:49:33 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-24 02:50:58 +0300
commite608a75159fc5cca70485d83ffb8ee681c9da385 (patch)
tree5ffdec62d0bee9a798418d6414ecbddae7ff8ae5 /src/integration/assets/pi/herdr-agent-state.ts
parent169a4fd90c20a00aec77d684ecec98b9f0f996cc (diff)
fix: make known-agent exit process-owned
refs #1792 refs #1648
Diffstat (limited to 'src/integration/assets/pi/herdr-agent-state.ts')
-rw-r--r--src/integration/assets/pi/herdr-agent-state.ts34
1 files changed, 1 insertions, 33 deletions
diff --git a/src/integration/assets/pi/herdr-agent-state.ts b/src/integration/assets/pi/herdr-agent-state.ts
index caa50ed9..2e79c7c6 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=6
+// HERDR_INTEGRATION_VERSION=7
// @ts-nocheck
import net from "node:net";
@@ -142,29 +142,6 @@ function sendState(state: AgentState, message?: string, seq = nextReportSeq()):
});
}
-function releaseAgent(): Promise<void> {
- return sendRequest({
- id: `${source}:release:${Date.now()}:${Math.random().toString(36).slice(2)}`,
- method: "pane.release_agent",
- params: {
- pane_id: paneId,
- source,
- agent: "pi",
- seq: nextReportSeq(),
- },
- });
-}
-
-function shouldReleaseOnSessionShutdown(event: any): boolean {
- // Pi tears down and rebinds extension runtimes for internal lifecycle actions
- // such as /reload, /new, /resume, and /fork. Those do not mean the pane's
- // agent process has exited, and releasing hook authority there can suppress
- // legitimate reports from the replacement runtime. Only a user/process quit
- // should release Herdr's full-lifecycle authority.
- const reason = event?.reason;
- return reason === "quit";
-}
-
let sendInFlight = false;
let queuedState: QueuedState | undefined;
@@ -275,13 +252,4 @@ export default function (pi) {
agentActive = false;
publishState();
});
-
- pi.on("session_shutdown", async (event) => {
- if (!rootSession) {
- return;
- }
- if (shouldReleaseOnSessionShutdown(event)) {
- await releaseAgent();
- }
- });
}