From 22db2918c004159ed4fe816e7dd0043912d2f4db Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Thu, 20 Nov 2025 10:04:33 -0500 Subject: [PATCH] sync --- .../cli/cmd/tui/component/dialog-model.tsx | 22 ++++++++++++++++--- .../cli/cmd/tui/component/dialog-provider.tsx | 13 +++++++---- .../cli/cmd/tui/component/prompt/index.tsx | 22 +++++++++---------- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx index 13aaa6fb6..349230b11 100644 --- a/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx @@ -3,7 +3,7 @@ import { useLocal } from "@tui/context/local" import { useSync } from "@tui/context/sync" import { map, pipe, flatMap, entries, filter, isDeepEqual, sortBy } from "remeda" import { DialogSelect, type DialogSelectOption, type DialogSelectRef } from "@tui/ui/dialog-select" -import { useDialog } from "@tui/ui/dialog" +import { DialogProvider, useDialog } from "@tui/ui/dialog" import { useTheme } from "../context/theme" import { DialogPrompt } from "../ui/dialog-prompt" import { useSDK } from "../context/sdk" @@ -108,7 +108,7 @@ export function DialogModel() { sync.data.provider_next.all, map((provider) => ({ title: provider.name, - category: "Connect a provider", + category: "Popular providers", value: provider.id, footer: { opencode: "Recommended", @@ -137,5 +137,21 @@ export function DialogModel() { ] }) - return + return ( + ) + }, + }, + ]} + ref={setRef} + title="Select model" + current={local.model.current()} + options={options()} + /> + ) } diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx index cf1d0631f..51ae14749 100644 --- a/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx @@ -33,7 +33,12 @@ export function createDialogProviderOptions() { anthropic: "Claude Max or API key", }[provider.id], async onSelect() { - const methods = sync.data.provider_auth[provider.id] + const methods = sync.data.provider_auth[provider.id] ?? [ + { + type: "api", + label: "API key", + }, + ] let index: number | null = 0 if (methods.length > 1) { index = await new Promise((resolve) => { @@ -55,7 +60,6 @@ export function createDialogProviderOptions() { } if (index == null) return const method = methods[index] - if (method.type === "oauth") { const result = await sdk.client.provider.oauth.authorize({ path: { @@ -65,9 +69,10 @@ export function createDialogProviderOptions() { method: index, }, }) - if (result.data?.method === "code") { + if (result.data?.method === "code") + await DialogPrompt.show(dialog, result.data.url + " " + result.data.instructions) + if (result.data?.method === "auto") await DialogPrompt.show(dialog, result.data.url + " " + result.data.instructions) - } } }, })), diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 624cb511f..285616b03 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -534,7 +534,7 @@ export function Prompt(props: PromptProps) { } const highlight = createMemo(() => { - if (keybind.leader) return theme.accent + if (keybind.leader) return theme.border if (store.mode === "shell") return theme.primary return local.agent.color(local.agent.current().name) }) @@ -759,18 +759,16 @@ export function Prompt(props: PromptProps) { /> - {keybind.leader - ? "Leader" - : store.mode === "shell" - ? "Shell" - : Locale.titlecase(local.agent.current().name)}{" "} + {store.mode === "shell" ? "Shell" : Locale.titlecase(local.agent.current().name)}{" "} - - {local.model.parsed().provider} - - {local.model.parsed().model} - - + + + {local.model.parsed().provider} + + {local.model.parsed().model} + + +