diff --git a/src/integration/assets/opencode/herdr-agent-state.js b/src/integration/assets/opencode/herdr-agent-state.js index a46d1d88..9a14b3c8 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=7 +// HERDR_INTEGRATION_VERSION=8 import net from "node:net"; @@ -27,10 +27,10 @@ function sessionIDFromProperties(properties) { } function stateFromSessionStatus(status) { - if (typeof status !== "string") { - return undefined; - } - switch (status.toLowerCase()) { + // session.status carries { type: "idle" | "busy" | "retry" }; older builds used a bare string. + const kind = typeof status === "string" ? status : status?.type; + if (typeof kind !== "string") return undefined; + switch (kind.toLowerCase()) { case "idle": return "idle"; case "active": @@ -39,6 +39,7 @@ function stateFromSessionStatus(status) { case "running": case "streaming": case "working": + case "retry": return "working"; default: return undefined; @@ -131,6 +132,23 @@ export const HerdrAgentStatePlugin = async () => { childSessions.add(info.id); } if (sessionID && childSessions.has(sessionID)) { + // Child session events are dropped so they cannot clobber the pane's + // root-agent state, but a subagent waiting on the user must still + // surface as blocked (and clear once answered). Report state only, + // without an agent_session_id, so the pane keeps the root session. + switch (type) { + case "permission.asked": + case "question.asked": + await reportState("blocked"); + break; + case "permission.replied": + case "question.replied": + case "question.rejected": + await reportState("working"); + break; + default: + break; + } return; } diff --git a/src/integration/mod.rs b/src/integration/mod.rs index a0e4b52e..9f3f2bc4 100644 --- a/src/integration/mod.rs +++ b/src/integration/mod.rs @@ -140,7 +140,7 @@ const DROID_REMOVED_LIFECYCLE_HOOK_EVENTS: [(&str, &str); 9] = [ ]; const OPENCODE_PLUGIN_INSTALL_NAME: &str = "herdr-agent-state.js"; const OPENCODE_PLUGIN_ASSET: &str = include_str!("assets/opencode/herdr-agent-state.js"); -const OPENCODE_INTEGRATION_VERSION: u32 = 7; +const OPENCODE_INTEGRATION_VERSION: u32 = 8; const KILO_PLUGIN_INSTALL_NAME: &str = "herdr-agent-state.js"; const KILO_PLUGIN_ASSET: &str = include_str!("assets/kilo/herdr-agent-state.js"); const KILO_INTEGRATION_VERSION: u32 = 2;