From 4da199697b73d29d9704628de4f3b46a89a69596 Mon Sep 17 00:00:00 2001 From: Dax Date: Thu, 5 Mar 2026 10:02:30 -0500 Subject: [PATCH] feat(tui): add onClick handler to InlineTool and Task components (#16187) --- .../src/cli/cmd/tui/routes/session/index.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index 11d30ff78..d3a4ff81e 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -1625,11 +1625,14 @@ function InlineTool(props: { spinner?: boolean children: JSX.Element part: ToolPart + onClick?: () => void }) { const [margin, setMargin] = createSignal(0) const { theme } = useTheme() const ctx = use() const sync = useSync() + const renderer = useRenderer() + const [hover, setHover] = createSignal(false) const permission = createMemo(() => { const callID = sync.data.permission[ctx.sessionID]?.at(0)?.tool?.callID @@ -1639,6 +1642,7 @@ function InlineTool(props: { const fg = createMemo(() => { if (permission()) return theme.warning + if (hover() && props.onClick) return theme.text if (props.complete) return theme.textMuted return theme.text }) @@ -1656,6 +1660,12 @@ function InlineTool(props: { props.onClick && setHover(true)} + onMouseOut={() => setHover(false)} + onMouseUp={() => { + if (renderer.getSelection()?.getSelectedText()) return + props.onClick?.() + }} renderBefore={function () { const el = this as BoxRenderable const parent = el.parent @@ -1999,6 +2009,11 @@ function Task(props: ToolProps) { complete={props.input.description} pending="Delegating..." part={props.part} + onClick={() => { + if (props.metadata.sessionId) { + navigate({ type: "session", sessionID: props.metadata.sessionId }) + } + }} > {content()}