Skip to content

Commit 9c64438

Browse files
suryaiyer95claude
andcommitted
feat: show Altimate in Popular providers with 3-step login flow
- Add `altimate-backend` to `PROVIDER_PRIORITY` so it appears in the Popular category of the "Connect a provider" dialog - Custom `onSelect` launches the login wizard instead of the generic API key prompt - Reorder wizard steps to: Instance Name → API Key → URL (with default) - No model selection after login — auto-selects Altimate AI Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 69fb5f2 commit 9c64438

2 files changed

Lines changed: 38 additions & 32 deletions

File tree

packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,35 @@ export function DialogAltimateLogin() {
1414
const sync = useSync()
1515
const local = useLocal()
1616
const { theme } = useTheme()
17-
const [step, setStep] = createSignal<"url" | "tenant" | "key">("url")
18-
const [url, setUrl] = createSignal("https://api.myaltimate.com")
19-
const [tenant, setTenant] = createSignal("")
17+
const [step, setStep] = createSignal<"instance" | "key" | "url">("instance")
18+
const [instanceName, setInstanceName] = createSignal("")
19+
const [apiKey, setApiKey] = createSignal("")
2020

21-
async function saveAndConnect(apiKey: string) {
21+
async function saveAndConnect(url: string) {
2222
const creds = {
23-
altimateUrl: url(),
24-
altimateInstanceName: tenant(),
25-
altimateApiKey: apiKey,
23+
altimateUrl: url,
24+
altimateInstanceName: instanceName(),
25+
altimateApiKey: apiKey(),
2626
}
2727
await Filesystem.writeJson(AltimateApi.credentialsPath(), creds, 0o600)
28-
// Refresh providers to pick up the new altimate-backend
2928
await sdk.client.instance.dispose()
3029
await sync.bootstrap()
31-
// Auto-select the altimate model
3230
local.model.set({ providerID: "altimate-backend", modelID: "altimate-default" }, { recent: true })
3331
dialog.clear()
3432
}
3533

3634
return (
3735
<>
38-
{step() === "url" && (
39-
<DialogPrompt
40-
title="Altimate URL"
41-
placeholder="https://api.myaltimate.com"
42-
value="https://api.myaltimate.com"
43-
description={() => (
44-
<text fg={theme.textMuted}>Enter your Altimate server URL</text>
45-
)}
46-
onConfirm={(value) => {
47-
if (value) setUrl(value)
48-
setStep("tenant")
49-
}}
50-
/>
51-
)}
52-
{step() === "tenant" && (
36+
{step() === "instance" && (
5337
<DialogPrompt
5438
title="Instance Name"
55-
placeholder="your-tenant"
39+
placeholder="your-instance"
5640
description={() => (
5741
<text fg={theme.textMuted}>Enter your Altimate instance (tenant) name</text>
5842
)}
5943
onConfirm={(value) => {
6044
if (!value) return
61-
setTenant(value)
45+
setInstanceName(value)
6246
setStep("key")
6347
}}
6448
/>
@@ -70,6 +54,21 @@ export function DialogAltimateLogin() {
7054
description={() => (
7155
<text fg={theme.textMuted}>Enter your Altimate API key</text>
7256
)}
57+
onConfirm={(value) => {
58+
if (!value) return
59+
setApiKey(value)
60+
setStep("url")
61+
}}
62+
/>
63+
)}
64+
{step() === "url" && (
65+
<DialogPrompt
66+
title="Altimate URL"
67+
placeholder="https://api.myaltimate.com"
68+
value="https://api.myaltimate.com"
69+
description={() => (
70+
<text fg={theme.textMuted}>Enter your Altimate server URL</text>
71+
)}
7372
onConfirm={async (value) => {
7473
if (!value) return
7574
await saveAndConnect(value)

packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ import { DialogModel } from "./dialog-model"
1313
import { useKeyboard } from "@opentui/solid"
1414
import { Clipboard } from "@tui/util/clipboard"
1515
import { useToast } from "../ui/toast"
16+
import { DialogAltimateLogin } from "./dialog-altimate-login"
1617

1718
const PROVIDER_PRIORITY: Record<string, number> = {
18-
opencode: 0,
19-
"opencode-go": 1,
20-
openai: 2,
21-
"github-copilot": 3,
22-
anthropic: 4,
23-
google: 5,
19+
"altimate-backend": 0,
20+
opencode: 1,
21+
"opencode-go": 2,
22+
openai: 3,
23+
"github-copilot": 4,
24+
anthropic: 5,
25+
google: 6,
2426
}
2527

2628
export function createDialogProviderOptions() {
@@ -35,13 +37,18 @@ export function createDialogProviderOptions() {
3537
title: provider.name,
3638
value: provider.id,
3739
description: {
40+
"altimate-backend": "(Instance + API key)",
3841
opencode: "(Recommended)",
3942
anthropic: "(API key)",
4043
openai: "(ChatGPT Plus/Pro or API key)",
4144
"opencode-go": "Low cost subscription for everyone",
4245
}[provider.id],
4346
category: provider.id in PROVIDER_PRIORITY ? "Popular" : "Other",
4447
async onSelect() {
48+
if (provider.id === "altimate-backend") {
49+
dialog.replace(() => <DialogAltimateLogin />)
50+
return
51+
}
4552
const methods = sync.data.provider_auth[provider.id] ?? [
4653
{
4754
type: "api",

0 commit comments

Comments
 (0)