aboutsummaryrefslogtreecommitdiff
path: root/src/integration/assets/opencode/herdr-agent-state.js
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-08-10 14:57:44 +0300
committerGitHub <noreply@github.com>2026-08-10 14:57:44 +0300
commitccccda54c21f6ef1649a44bb098d7c498724404d (patch)
tree86f28b85086ef36fd7ebc0f1d928b7606d76c487 /src/integration/assets/opencode/herdr-agent-state.js
parent2e8cc9060d723a5ac32a2325e695fd8750ff60fe (diff)
fix: track opencode tui session selection (#2455)
refs #2450 Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/integration/assets/opencode/herdr-agent-state.js')
-rw-r--r--src/integration/assets/opencode/herdr-agent-state.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/integration/assets/opencode/herdr-agent-state.js b/src/integration/assets/opencode/herdr-agent-state.js
index 76265050..2840c221 100644
--- a/src/integration/assets/opencode/herdr-agent-state.js
+++ b/src/integration/assets/opencode/herdr-agent-state.js
@@ -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=opencode
-// HERDR_INTEGRATION_VERSION=9
+// HERDR_INTEGRATION_VERSION=10
import net from "node:net";
@@ -102,15 +102,11 @@ function requestOnce(method, params) {
});
}
-function reportSession(sessionID, sessionStartSource) {
+function reportSession(sessionID) {
if (!sessionID) {
return Promise.resolve();
}
- const params = { agent_session_id: sessionID };
- if (sessionStartSource) {
- params.session_start_source = sessionStartSource;
- }
- return request("pane.report_agent_session", params);
+ return request("pane.report_agent_session", { agent_session_id: sessionID });
}
function reportState(state, sessionID) {
@@ -157,10 +153,9 @@ export const HerdrAgentStatePlugin = async () => {
switch (type) {
case "session.created":
- // A root session.created is a genuine new-session start (subagent
- // creates are dropped above). Signal it so herdr replaces the pane's
- // prior session id instead of treating the change as cross-talk.
- await reportSession(sessionID, "new");
+ // Creation is server-global, so an attached client may own it. The
+ // TUI plugin separately reports the root selected in this pane.
+ reportedRootSessionID = sessionID;
break;
case "session.updated":
if (sessionID && sessionID !== reportedRootSessionID) {