fix(tool-execute-before): resolve subagent_type for TUI display
OpenCode TUI reads input.subagent_type to display task type. When subagent_type was missing (e.g., category-only or session continuation), TUI showed 'Unknown Task'. Fix: - category provided: always set subagent_type to 'sisyphus-junior' (previously only when subagent_type was absent) - session_id continuation: resolve agent from session's first message - fallback to 'continue' if session has no agent info
This commit is contained in:
@@ -3,6 +3,7 @@ import type { PluginContext } from "./types"
|
||||
import { getMainSessionID } from "../features/claude-code-session-state"
|
||||
import { clearBoulderState } from "../features/boulder-state"
|
||||
import { log } from "../shared"
|
||||
import { resolveSessionAgent } from "./session-agent-resolver"
|
||||
|
||||
import type { CreatedHooks } from "../create-hooks"
|
||||
|
||||
@@ -34,8 +35,13 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
const argsObject = output.args
|
||||
const category = typeof argsObject.category === "string" ? argsObject.category : undefined
|
||||
const subagentType = typeof argsObject.subagent_type === "string" ? argsObject.subagent_type : undefined
|
||||
if (category && !subagentType) {
|
||||
const sessionId = typeof argsObject.session_id === "string" ? argsObject.session_id : undefined
|
||||
|
||||
if (category) {
|
||||
argsObject.subagent_type = "sisyphus-junior"
|
||||
} else if (!subagentType && sessionId) {
|
||||
const resolvedAgent = await resolveSessionAgent(ctx.client, sessionId)
|
||||
argsObject.subagent_type = resolvedAgent ?? "continue"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user