Skip to content

Commit 4e03533

Browse files
committed
fix(tui): the session route hands the composer its plugin tabs
The composer read plugin tabs through usePlugin(), so mounting it without a PluginProvider threw; composer-keymap.test failed 7 of 7. The session route already holds the plugin context and is the composer's only mount, so it now passes plugins.composerTabs() as the pluginTabs prop, and the composer stays free of the plugin registry.
1 parent bdefd9c commit 4e03533

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎packages/tui/src/routes/session/composer/index.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { SubagentsTab } from "./subagents-tab"
88
import { ShellTab } from "./shell-tab"
99
import { TerminalsTab } from "./terminals-tab"
1010
import { PluginTab } from "./plugin-tab"
11-
import { usePlugin } from "../../../plugin/context"
11+
import type { ComposerTab as PluginComposerTab } from "@opencode/plugin/tui/context"
1212
import { ComposerContext, type ComposerTab } from "./context"
1313

1414
export type ComposerProps = {
@@ -18,11 +18,12 @@ export type ComposerProps = {
1818
onClose?: () => void
1919
terminals?: boolean
2020
visibleTerminalID?: string
21+
/** Plugin tabs (`ui.composerTab`), after the host's; the mount site reads them from the plugin registry. */
22+
pluginTabs?: readonly PluginComposerTab[]
2123
}
2224

2325
export function Composer(props: ComposerProps) {
2426
const theme = useTheme()
25-
const plugins = usePlugin()
2627

2728
const [store, setStore] = createStore({
2829
tabs: {} as Record<string, ComposerTab>,
@@ -132,7 +133,7 @@ export function Composer(props: ComposerProps) {
132133
<Show when={props.terminals}>
133134
<TerminalsTab sessionID={props.sessionID} visibleTerminalID={props.visibleTerminalID} />
134135
</Show>
135-
<For each={plugins.composerTabs()}>{(tab) => <PluginTab tab={tab} sessionID={props.sessionID} />}</For>
136+
<For each={props.pluginTabs ?? []}>{(tab) => <PluginTab tab={tab} sessionID={props.sessionID} />}</For>
136137
<box flexDirection="row" gap={2} paddingLeft={1} flexShrink={0}>
137138
<For each={footerHints()}>
138139
{(hint) => (

‎packages/tui/src/routes/session/index.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@ export function Session(props: {
16231623
<Slot path="session.composer.top" input={{ sessionID: route.sessionID }} />
16241624
<Composer
16251625
sessionID={route.sessionID}
1626+
pluginTabs={plugins.composerTabs()}
16261627
open={composer.open || (!!session()?.parentID && forms().length === 0)}
16271628
defaultTab={composer.tab ?? (session()?.parentID ? "subagents" : undefined)}
16281629
onClose={() => {

0 commit comments

Comments
 (0)