Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export function DialogStatus() {
esc
</text>
</box>
<Show when={Object.keys(sync.data.mcp).length > 0} fallback={<text fg={theme.text}>No MCP Servers</text>}>
<Show when={Object.keys(sync.data.mcp ?? {}).length > 0} fallback={<text fg={theme.text}>No MCP Servers</text>}>
<box>
<text fg={theme.text}>{Object.keys(sync.data.mcp).length} MCP Servers</text>
<For each={Object.entries(sync.data.mcp)}>
<text fg={theme.text}>{Object.keys(sync.data.mcp ?? {}).length} MCP Servers</text>
<For each={Object.entries(sync.data.mcp ?? {})}>
{([key, item]) => (
<box flexDirection="row" gap={1}>
<text
Expand Down Expand Up @@ -93,10 +93,10 @@ export function DialogStatus() {
</For>
</box>
</Show>
{sync.data.lsp.length > 0 && (
{(sync.data.lsp ?? []).length > 0 && (
<box>
<text fg={theme.text}>{sync.data.lsp.length} LSP Servers</text>
<For each={sync.data.lsp}>
<text fg={theme.text}>{(sync.data.lsp ?? []).length} LSP Servers</text>
<For each={sync.data.lsp ?? []}>
{(item) => (
<box flexDirection="row" gap={1}>
<text
Expand Down
4 changes: 2 additions & 2 deletions packages/opencode/src/cli/cmd/tui/plugin/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ function stateApi(sync: ReturnType<typeof useSync>): TuiPluginApi["state"] {
return sync.data.part[messageID] ?? []
},
lsp() {
return sync.data.lsp.map((item) => ({ id: item.id, root: item.root, status: item.status }))
return (sync.data.lsp ?? []).map((item) => ({ id: item.id, root: item.root, status: item.status }))
},
mcp() {
return Object.entries(sync.data.mcp)
return Object.entries(sync.data.mcp ?? {})
.sort(([a], [b]) => a.localeCompare(b))
.map(([name, item]) => ({
name,
Expand Down
6 changes: 3 additions & 3 deletions packages/opencode/src/cli/cmd/tui/routes/session/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export function Footer() {
const { theme } = useTheme()
const sync = useSync()
const route = useRoute()
const mcp = createMemo(() => Object.values(sync.data.mcp).filter((x) => x.status === "connected").length)
const mcpError = createMemo(() => Object.values(sync.data.mcp).some((x) => x.status === "failed"))
const lsp = createMemo(() => Object.keys(sync.data.lsp))
const mcp = createMemo(() => Object.values(sync.data.mcp ?? {}).filter((x) => x.status === "connected").length)
const mcpError = createMemo(() => Object.values(sync.data.mcp ?? {}).some((x) => x.status === "failed"))
const lsp = createMemo(() => Object.keys(sync.data.lsp ?? []))
const permissions = createMemo(() => {
if (route.data.type !== "session") return []
return sync.data.permission[route.data.sessionID] ?? []
Expand Down
Loading