From 67b64ab249cdde82353c9ad2e92e29c7806e5d6b Mon Sep 17 00:00:00 2001 From: default-cybe <201046277+default-cybe@users.noreply.github.com> Date: Thu, 12 Nov 2026 22:13:36 -0800 Subject: [PATCH] Fix redesign review findings (#350, #351, #352) - Setup: Continue on Connect a model replaces a default or small model that cannot run with the first working key's provider's smart and fast models (keyDefaults), so a key-only owner gets a usable default. - Set up later: Defaults counts done only when the default model can run (or its page was finished); hubs that finished the old thirteen step setup do not get the Home list. - Android picker: a pinned model that became unavailable stays in Pinned, marked, with its unpin button. - Directions that named the old Settings > Models group now name Settings > AI connections or Settings > Advanced. Committed-by: Conclave (cliproxy/claude-opus-5-5) --- CHANGELOG.md | 8 +++ docs/EXTENSIONS.md | 2 +- docs/INSTALL.md | 28 ++++---- .../dev/conclave/app/ui/common/Pickers.kt | 3 +- .../dev/conclave/client/logic/PickerTabs.kt | 12 ++-- .../dev/conclave/client/logic/StarterWords.kt | 2 +- .../dev/conclave/client/PickerTabsTest.kt | 15 +++++ packages/core/src/assistant/recap.ts | 2 +- packages/core/src/config/hidden.ts | 2 +- packages/core/src/engine/engine.ts | 2 +- packages/core/src/images/generate.ts | 6 +- packages/core/src/machine/private.ts | 2 +- packages/core/src/people/plans.ts | 2 +- packages/core/src/platform/card.ts | 2 +- .../core/test/engine/platform-card.test.ts | 4 +- packages/core/test/platform/card.test.ts | 8 ++- packages/daemon-rs/src/private.rs | 2 +- packages/server/src/cliproxy/config.ts | 2 +- packages/server/src/routes-people.ts | 2 +- .../src/features/onboarding/SetupLater.tsx | 6 +- .../web/src/features/onboarding/progress.ts | 26 ++++++-- .../features/onboarding/steps/ModelStep.tsx | 27 ++++---- packages/web/src/lib/providers.ts | 34 ++++++++++ packages/web/src/lib/subscriptions.ts | 3 +- packages/web/test/onboarding-branch.test.ts | 64 ++++++++++++++++++- 25 files changed, 204 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76650dbf0..a68f8bda1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,14 @@ like `## [0.4.16] - 2026-10-24`. - Desktop: questions from the agent show each option with its description, like on phones +### Fixed + +- Setup: an owner who connects only an API key no longer finishes with a default model that cannot run. On Continue, a default or small model whose provider does not work is replaced with that key's provider's models (its smart and fast tiers) +- Home's "Set up later" list shows Defaults again while the default model cannot run. Before, it counted as done on every hub, because the hub always returns a default model +- Hubs that finished the old thirteen step setup no longer get a "Set up later" list on Home after upgrading: their owner already chose. Settings, About still lists every item +- Android: a pinned model your plan stops offering stays under Pinned, marked as not available, and keeps its pin so you can unpin it. Before, it vanished from Pinned and still took one of the 50 places +- Directions that still named the old Settings > Models group (an Android account starter line, the assistant's map of Settings, the Refusal fallback, hidden model, image model and private folder messages, and docs/INSTALL.md) now name Settings > AI connections or Settings > Advanced + ## [0.4.97] - 2026-11-13 ### Changed diff --git a/docs/EXTENSIONS.md b/docs/EXTENSIONS.md index 1e7cabed2..7699caee3 100644 --- a/docs/EXTENSIONS.md +++ b/docs/EXTENSIONS.md @@ -405,7 +405,7 @@ Set the tiers once with `conclave config set models.tiers '{"deep": "anthropic/c `group: security` marks a subagent as a Security-mode role. Task offers it only when the session has `chat.security: true`, off by default. `fallback:` in the role profile lists model refs tried after its default when the default is unusable or has answered 404; the parent model comes last. A named Task model or Same model pin wins over the role's list. See `docs/agents/sec-*.md`. This is not an authorization boundary: the scope guard and the egress gateway are separate. -`refusalFallback:` gives sessions with this agent their own Refusal fallback list (what the owner calls "safety priority", docs/DESIGN.md 47): each entry is a model, or `model@account` with an account id from Settings > Models > Accounts. A list replaces the owner's and turns it on for this agent; `refusalFallback: off` turns it off. Without the field the owner's setting applies. +`refusalFallback:` gives sessions with this agent their own Refusal fallback list (what the owner calls "safety priority", docs/DESIGN.md 47): each entry is a model, or `model@account` with an account id from Settings > Advanced > Accounts. A list replaces the owner's and turns it on for this agent; `refusalFallback: off` turns it off. Without the field the owner's setting applies. ```yaml refusalFallback: diff --git a/docs/INSTALL.md b/docs/INSTALL.md index aa5216ce6..e9ee6ead5 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -681,7 +681,7 @@ and never sent back to an app. The environment variables still work: ## 4. Subscriptions: sign in to Claude, ChatGPT and more The hub can use the plans you already pay for instead of API keys. Setup -step 2 ("Sign in to your AI subscriptions") and **Settings > Models > +step 3 ("Connect a model") and **Settings > AI connections > Subscriptions** show one row each for Claude, ChatGPT, Google, Grok, Kimi and Muse. Sign in, and every model those accounts give shows up in the model picker, as `cliproxy/`. It is off until you sign in or pick a mode, @@ -740,7 +740,7 @@ matched. You can sign in to more than one account of the same plan. They are used in your order (below), one at a time. An account with a short name (set in -Settings > Models > Accounts) also shows its models as +Settings > Advanced > Accounts) also shows its models as `neu/claude-opus-5-5` and so on, under "Second account" in Settings. **Remove** signs an account out; **Refresh** asks the provider for a new token now. @@ -772,14 +772,14 @@ is not available), the model picker greys that model out with the reason instead of sending every turn to it. **Refresh models** asks the plan again; otherwise the mark goes after a day. The lists are read again every 10 minutes and on every coding agent turn. To -read them now, press **Refresh models** in **Settings > Models > +read them now, press **Refresh models** in **Settings > AI connections > Subscriptions** (Models). It also starts each coding agent that is on, once, to ask for its list. One that cannot be asked keeps its last list, then the built-in one, and the message says which. ### Accounts and their order -**Settings > Models > Accounts** lists every signed in plan and every API +**Settings > Advanced > Accounts** lists every signed in plan and every API key, per vendor, in the order the hub uses them. The first takes the call; the next takes over when it is at a limit, resting after errors, or paused. Plans come before API keys unless you move them. So with Account 1, then @@ -819,9 +819,9 @@ and spend by account. **A second Claude account.** Two ways, and a refusal fallback step can be kept on either: -- **Another plan.** Sign in again under **Settings > Models > +- **Another plan.** Sign in again under **Settings > AI connections > Subscriptions** (Claude) with the other login. To keep a step on exactly - that plan, give it a short name in **Settings > Models > Accounts** (for + that plan, give it a short name in **Settings > Advanced > Accounts** (for example `neu`). Its models then also show as `neu/claude-opus-5-5`. Without a short name CLIProxyAPI picks which plan answers a model both have. - **Another API key.** Add a second Anthropic provider and its key: @@ -832,15 +832,15 @@ kept on either: ### Refusal fallback ("safety priority") When a model refuses, Conclave can ask again elsewhere with the same -messages. The simple way: in **Settings > Models > Accounts**, turn on **Use +messages. The simple way: in **Settings > Advanced > Accounts**, turn on **Use when a model refuses** for the plans or keys you trust with such requests. A refused reply then goes to the same model on each of them (of that model's maker), in your account order, skipping the one that refused and -any that is paused or at a limit. The line at the top of **Settings > Models +any that is paused or at a limit. The line at the top of **Settings > Advanced > Refusal fallback** names them ("Tried first: personal-claude on Claude."). After those, Conclave can ask the next model on your list. -**Settings > Models > Refusal fallback** holds the list: add +**Settings > Advanced > Refusal fallback** holds the list: add a model, pick an account for it if that step should stay on one plan or key ("Your order" follows Accounts), and drag rows or use the arrows. For example: Opus 5.5 on neu, Opus 5.5 on personal, GLM-5.3, then a ChatGPT @@ -878,7 +878,7 @@ the account that answered. An agent can have its own list A marked account is `"refusal": true` on it in `models.accounts`. **Members have their own lists.** A member of your hub sees Settings > -Models > Refusal fallback and Usage fallback too, with their own lists: +Advanced > Refusal fallback and Limit fallback too, with their own lists: models only, and only models they can call (their own keys and plans, or a hub key you granted them). The hub refuses a model they cannot call when they save, and skips one at run time when a grant or plan is gone. Their @@ -894,7 +894,7 @@ reset, so the next window starts at once. The idea comes from [Lamplighter](https://github.com/PosvdM/cpa-plugin-lamplighter), a plugin for CLIProxyAPI. -Turn it on per account under **Settings > Models > Accounts**: each signed in +Turn it on per account under **Settings > Advanced > Accounts**: each signed in plan has a **Window starter** switch, off by default. Some providers limit automated use of subscription accounts. This sends one tiny request per window. Use at your own risk. @@ -908,7 +908,7 @@ window. Use at your own risk. page lists these requests as **Window starter**. - **Which account.** The request must reach that account alone. With one account per vendor that is automatic. With two or more, give each one a - short name in **Settings > Models > Accounts** (for example `neu`); + short name in **Settings > Advanced > Accounts** (for example `neu`); without one the row says it cannot reach the account alone. - **When it stops.** A 429, a failed sign-in, a model the plan refuses, or a window that does not start stop it for that account until the next day, @@ -1879,12 +1879,12 @@ their own computer with their own login, so they need nothing from you. ### Their own plans A person can sign in their own Claude, ChatGPT or other plan: **Settings > -Models > Subscriptions** on their account, the same page as yours (section 4) +AI connections > Subscriptions** on their account, the same page as yours (section 4) without the program, its version, its path or how the hub reaches it. If their CLIProxyAPI stopped with an error, they can retry it there. The first sign-in starts a CLIProxyAPI for them alone, run by the hub like yours, on `127.0.0.1`, in `~/.conclave/accounts//cliproxy`. Its keys are in their own `secrets.json` -there. **Settings > Models > Accounts** shows their plans, their order and +there. **Settings > Advanced > Accounts** shows their plans, their order and their limits. Their `cliproxy/` calls use their own plan when it has the model, and your plans only if you let them use CLIProxyAPI (above). A call that started on their plan stays on it and never moves to yours. The window diff --git a/packages/android/app/src/main/kotlin/dev/conclave/app/ui/common/Pickers.kt b/packages/android/app/src/main/kotlin/dev/conclave/app/ui/common/Pickers.kt index b41d0ca67..ba0b915b7 100644 --- a/packages/android/app/src/main/kotlin/dev/conclave/app/ui/common/Pickers.kt +++ b/packages/android/app/src/main/kotlin/dev/conclave/app/ui/common/Pickers.kt @@ -298,7 +298,8 @@ private fun ModelRow( selected = selected, vision = peeked && r.model.vision, pinned = pinned, - onPin = onPin?.takeIf { why == null && (peeked || pinned) }, + // a pinned model the plan now refuses keeps its pin, so it can be unpinned + onPin = onPin?.takeIf { pinned || (why == null && peeked) }, enabled = why == null, warn = why != null, onLongClick = onPeek?.takeIf { why == null }, diff --git a/packages/android/client/src/main/kotlin/dev/conclave/client/logic/PickerTabs.kt b/packages/android/client/src/main/kotlin/dev/conclave/client/logic/PickerTabs.kt index a9179c5da..ac626893b 100644 --- a/packages/android/client/src/main/kotlin/dev/conclave/client/logic/PickerTabs.kt +++ b/packages/android/client/src/main/kotlin/dev/conclave/client/logic/PickerTabs.kt @@ -152,10 +152,11 @@ object PickerTabs { /** * What the list shows under the search and the tabs: Pinned (the pins in - * this tab, most capable first), Recent (the last three in this tab, pins - * left out), then the tab's models by maker (in [entries]' order) and - * family, strongest family first, newest first inside. A search lists the - * matches of every tab, most capable first, with no Pinned or Recent. + * this tab, most capable first, a model not available too), Recent (the + * last three in this tab, pins left out), then the tab's models by maker + * (in [entries]' order) and family, strongest family first, newest first + * inside. A search lists the matches of every tab, most capable first, + * with no Pinned or Recent. * [recent] holds refs the picker already mapped to their rows. */ fun items(entries: List, query: String, tab: Tab, pinned: List = emptyList(), recent: List = emptyList(), unavailable: Boolean = false): List { @@ -171,7 +172,8 @@ object PickerTabs { val inTab = entries.filter { tab == Tab.ALL || it.tab == tab }.sortedWith(byRank) if (inTab.isEmpty()) return emptyList() val (off, ranked) = inTab.partition { it.row.model.unavailable != null } - val pins = ranked.filter { it.row.ref in pinned } + // a pin the plan now refuses stays in Pinned, marked, so it can be unpinned (as on the web) + val pins = inTab.filter { it.row.ref in pinned } val recents = recent.distinct().mapNotNull { ref -> ranked.firstOrNull { it.row.ref == ref } }.filter { it.row.ref !in pinned }.take(3) val out = mutableListOf() if (pins.isNotEmpty()) { diff --git a/packages/android/client/src/main/kotlin/dev/conclave/client/logic/StarterWords.kt b/packages/android/client/src/main/kotlin/dev/conclave/client/logic/StarterWords.kt index 571b88324..faf29dc0e 100644 --- a/packages/android/client/src/main/kotlin/dev/conclave/client/logic/StarterWords.kt +++ b/packages/android/client/src/main/kotlin/dev/conclave/client/logic/StarterWords.kt @@ -62,7 +62,7 @@ object StarterWords { "stopped" -> "Stopped until ${s.until?.let { until(it, now, zone) } ?: "tomorrow"}: ${s.reason ?: "error"}." "paused" -> "Paused: weekly limit used up${s.until?.let { " until ${at(it, now, zone)}" } ?: ""}." "never" -> "This plan has no 5-hour window, so there is nothing to start." - "setup" -> if (s.reason == "Cannot pin a request to it") "Cannot reach this account alone. Give it a short name in Settings > Models > Accounts." else "${s.reason ?: "Cannot run as set"}." + "setup" -> if (s.reason == "Cannot pin a request to it") "Cannot reach this account alone. Give it a short name in Settings > Advanced > Accounts." else "${s.reason ?: "Cannot run as set"}." "waiting" -> when (s.reason) { "No usage read yet" -> "Waiting for the first usage read." "Account paused" -> "Waits while the account is paused." diff --git a/packages/android/client/src/test/kotlin/dev/conclave/client/PickerTabsTest.kt b/packages/android/client/src/test/kotlin/dev/conclave/client/PickerTabsTest.kt index c05bccae2..e29a9440c 100644 --- a/packages/android/client/src/test/kotlin/dev/conclave/client/PickerTabsTest.kt +++ b/packages/android/client/src/test/kotlin/dev/conclave/client/PickerTabsTest.kt @@ -174,6 +174,21 @@ class PickerTabsTest { assertEquals(listOf("ollama/gemma-3"), refs(local, Section.RECENT)) } + @Test + fun aPinnedModelThePlanRefusesStaysInPinned() { + val refused = ModelInfo(id = "claude-mythos-5-1", ref = "anthropic/claude-mythos-5-1", provider = "anthropic", name = "Claude Mythos 5.1", unavailable = "Your plan refused it (HTTP 404)") + val withRefused = PickerTabs.entries(ModelPicks.groups(listOf(g("anthropic", refused, m("anthropic", "claude-opus-5-5", "Claude Opus 5.5"))))) + val items = PickerTabs.items(withRefused, "", Tab.ALL, pinned = listOf("anthropic/claude-mythos-5-1")) + // still under Pinned, marked unavailable, so its pin can be removed; the fold still counts it + assertEquals("Pinned", heads(items).first()) + assertEquals(listOf("anthropic/claude-mythos-5-1"), refs(items, Section.PIN)) + val pin = items.filterIsInstance().first { it.section == Section.PIN } + assertEquals("Your plan refused it (HTTP 404)", pin.entry.row.model.unavailable) + assertEquals(Item.Fold(PickerTabs.NOT_AVAILABLE, 1, open = false), items.last()) + // unpinning it frees its place + assertEquals(emptyList(), PickerTabs.togglePin(listOf("anthropic/claude-mythos-5-1"), "anthropic/claude-mythos-5-1")) + } + @Test fun aSearchSpansEveryTabWithNoPinnedOrRecent() { val found = PickerTabs.items(entries, "claude", Tab.LOCAL, pinned = listOf("anthropic/claude-haiku-5"), recent = listOf("anthropic/claude-opus-5-5")) diff --git a/packages/core/src/assistant/recap.ts b/packages/core/src/assistant/recap.ts index 6b7d25c70..fc31e3ac9 100644 --- a/packages/core/src/assistant/recap.ts +++ b/packages/core/src/assistant/recap.ts @@ -419,7 +419,7 @@ function basicSuggestions(d: { repeat?: SessionRow[]; unprojected: number; lateN if (d.repeat) out.push({ text: 'Turn this repeated request into a routine or a skill.', why: `You opened ${d.repeat.length} sessions the same way, like "${d.repeat[0]!.title}".` }); if (d.unprojected >= 6) out.push({ text: 'Start a project for the topic you keep coming back to, so the context carries over.', why: `${d.unprojected} chats had no project.` }); if (d.corrections >= 5) out.push({ text: 'Save the corrections you repeat as notes, so you stop giving them.', why: `You corrected the agent ${d.corrections} times.` }); - if (d.fallbacks >= 10) out.push({ text: 'Add a second account or change the model order in Settings, Accounts.', why: `${d.fallbacks} turns fell back to another model when a plan hit its limit.` }); + if (d.fallbacks >= 10) out.push({ text: 'Add a second account or change the model order in Settings > Advanced > Accounts.', why: `${d.fallbacks} turns fell back to another model when a plan hit its limit.` }); if (d.lateNightShare >= 0.2 && d.messages >= 20) out.push({ text: 'Set quiet hours so nothing pulls you back late.', why: `${Math.round(d.lateNightShare * 100)}% of your messages came between 23:00 and 05:00.` }); return out.slice(0, 4); } diff --git a/packages/core/src/config/hidden.ts b/packages/core/src/config/hidden.ts index 77246bc6e..e5bd6b48b 100644 --- a/packages/core/src/config/hidden.ts +++ b/packages/core/src/config/hidden.ts @@ -19,5 +19,5 @@ export function isHiddenModel(cfg: Pick, ref: string): /** What a caller says when it meets a hidden model. */ export function hiddenWords(ref: string): string { - return `Model ${ref} is hidden by models.hidden (Settings > Models > Hidden models). Pick another model, or remove it from that list.`; + return `Model ${ref} is hidden by models.hidden (Settings > AI connections > Defaults, Hidden models). Pick another model, or remove it from that list.`; } diff --git a/packages/core/src/engine/engine.ts b/packages/core/src/engine/engine.ts index 2e1e3aa90..31c280bec 100644 --- a/packages/core/src/engine/engine.ts +++ b/packages/core/src/engine/engine.ts @@ -1310,7 +1310,7 @@ export class Engine implements EngineApi { const { refusalPlanFor } = await import('../session/member-fallbacks'); // a member's session walks the member's own list, never the owner's const plan = refusalPlanFor(this, s.accountId, this.agentFor(s)); - if (!plan) throw new EngineError(409, isMember(s.accountId) ? 'Your Refusal fallback has no models you can use. Add them in Settings, Models.' : 'Refusal fallback has no models, and no plan is marked to use when a model refuses. Add them in Settings, Models.'); + if (!plan) throw new EngineError(409, isMember(s.accountId) ? 'Your Refusal fallback has no models you can use. Add them in Settings > Advanced > Refusal fallback.' : 'Refusal fallback has no models, and no plan is marked to use when a model refuses. Add them in Settings > Advanced > Refusal fallback.'); const served = servedOf(reply); if (!served) throw new EngineError(409, 'Conclave does not know which model refused this reply.'); const next = new RefusalWalk(this, s, plan, refusalStepOf(reply)).next(served); diff --git a/packages/core/src/images/generate.ts b/packages/core/src/images/generate.ts index a6705805f..ac1ca5bd7 100644 --- a/packages/core/src/images/generate.ts +++ b/packages/core/src/images/generate.ts @@ -47,14 +47,14 @@ export async function generateImageFor(deps: ImageDeps, call: ImageCall): Promis const ref = imageModelOf(cfg, call.model); const { provider: pid, model } = parseModelRef(ref); if (!pid || !model) throw new ImageRefusal(`"${ref}" is not a provider/model reference.`); - if (!IMAGE_MODEL.test(model)) throw new ImageRefusal(`${ref} is not an image model. Pick one in Settings > Models > Image model.`); + if (!IMAGE_MODEL.test(model)) throw new ImageRefusal(`${ref} is not an image model. Pick one in Settings > AI connections > Defaults, Image model.`); const member = isMember(call.accountId); if (member && deps.access.source(call.accountId, pid, model) !== 'own') { - throw new ImageRefusal(`You have no plan or API key of your own for ${ref}. Images are made only on your own plans or keys, never the hub owner's. Sign in a ChatGPT plan in Settings > Accounts or add your own key for ${pid}.`); + throw new ImageRefusal(`You have no plan or API key of your own for ${ref}. Images are made only on your own plans or keys, never the hub owner's. Sign in a ChatGPT plan in Settings > AI connections > Subscriptions or add your own key for ${pid}.`); } const provider = deps.providersFor(call.accountId).get(pid); if (!provider) throw new ImageRefusal(`Provider "${pid}" is not set up. Add it in Settings > Providers.`); - if (!provider.generateImage) throw new ImageRefusal(`Provider "${pid}" cannot make images. Pick an OpenAI-compatible image model in Settings > Models > Image model.`); + if (!provider.generateImage) throw new ImageRefusal(`Provider "${pid}" cannot make images. Pick an OpenAI-compatible image model in Settings > AI connections > Defaults, Image model.`); const started = Date.now(); const { accountId, sessionId, model: _m, ...req } = call; const result = await provider.generateImage({ ...req, model }); diff --git a/packages/core/src/machine/private.ts b/packages/core/src/machine/private.ts index c2256c3fe..ac4693571 100644 --- a/packages/core/src/machine/private.ts +++ b/packages/core/src/machine/private.ts @@ -111,7 +111,7 @@ export function isHubPrivatePath(path: string): boolean { return r !== p && (within(r, dirs.map((d) => clean(real(d)))) || inAccountPrivate(r)); } -export const PRIVATE_REFUSAL = 'Refused: that folder holds the hub\'s subscription sign-ins (CLIProxyAPI). Sessions cannot read or change it. Settings > Models > Subscriptions shows the accounts.'; +export const PRIVATE_REFUSAL = 'Refused: that folder holds the hub\'s subscription sign-ins (CLIProxyAPI). Sessions cannot read or change it. Settings > AI connections > Subscriptions shows the accounts.'; export const SECRETS_REFUSAL = 'Refused: that file holds the hub\'s keys and tokens. Sessions cannot read or change it. Settings shows which keys are set.'; /** The refusal for a path or a command: the secrets file has its own words. */ diff --git a/packages/core/src/people/plans.ts b/packages/core/src/people/plans.ts index acd476e56..c5d59899f 100644 --- a/packages/core/src/people/plans.ts +++ b/packages/core/src/people/plans.ts @@ -96,7 +96,7 @@ export class MemberPlanProvider implements Provider { /** Only the member's own plans make images: a grant to the hub's plans covers chat, never the owner's image quota. */ generateImage(req: ImageRequest): Promise { if (!this.opts.serves(req.model) || !this.own.generateImage) { - return Promise.reject(new ProviderError('auth', `None of your own signed in plans offers ${req.model}. Images are made only on your own plans or keys; sign in a ChatGPT plan in Settings > Accounts, or add an API key.`, { provider: this.id, code: 'access' })); + return Promise.reject(new ProviderError('auth', `None of your own signed in plans offers ${req.model}. Images are made only on your own plans or keys; sign in a ChatGPT plan in Settings > AI connections > Subscriptions, or add an API key.`, { provider: this.id, code: 'access' })); } return this.own.generateImage(req); } diff --git a/packages/core/src/platform/card.ts b/packages/core/src/platform/card.ts index 61b6c6b50..efc9f5a39 100644 --- a/packages/core/src/platform/card.ts +++ b/packages/core/src/platform/card.ts @@ -100,7 +100,7 @@ export function cardText(f: Pick & { const settings = f.member ? '- Settings: your account and your own provider keys. The hub, its browser and its accounts are the owner\'s.' : [ - '- Settings > Models: Providers, Subscriptions (Claude, ChatGPT, Google plans), Accounts (order, budgets, the Window starter), Refusal fallback, Defaults.', + '- Settings > AI connections: Subscriptions (Claude, ChatGPT, Google plans), Providers, Defaults (models, Hidden models, Image model). Settings > Advanced: Accounts (order, budgets, the Window starter), Refusal fallback, Limit fallback.', '- Settings > Browser (profiles, saved logins, CloakBrowser, a proxy retried once when a site blocks the hub, in the hub\'s country), GitHub (repo sessions that end in a pull request), Remote access, Notifications, Permissions, People.', ].join('\n'); // a Code session works in a repo: the app's pages and settings cost every request and ConclaveHelp has them diff --git a/packages/core/test/engine/platform-card.test.ts b/packages/core/test/engine/platform-card.test.ts index eea341271..3b7f7ce22 100644 --- a/packages/core/test/engine/platform-card.test.ts +++ b/packages/core/test/engine/platform-card.test.ts @@ -125,7 +125,7 @@ describe('the platform card in requests', () => { for (const n of ['Delegate', 'ShareFile', 'ConclaveHelp']) expect(coderTools).toContain(n); expect(sys).toContain('# Files you deliver'); expect(sys).toContain('Delegate'); - expect(sys).not.toContain('Settings > Models'); + expect(sys).not.toContain('Settings > AI connections'); // 14,476 chars before the cut (v0.4.41), about 13.5k after // +350 for the identity lines at the top of BASE.md (who Conclave is and who made it) expect(sys.length).toBeLessThan(14_250); @@ -133,7 +133,7 @@ describe('the platform card in requests', () => { const assistant = await t.engine.createSession({ title: 't', cwd: t.cwd, agent: 'assistant' }); await t.run(assistant.id, 'my day'); expect(toolsOf(1)).toEqual(expect.arrayContaining(LIFE)); - expect(systemOf(t.requests[1])).toContain('Settings > Models'); + expect(systemOf(t.requests[1])).toContain('Settings > AI connections'); const chat = await t.engine.createSession({ kind: 'chat' }); await t.run(chat.id, 'cafes near me'); expect(toolsOf(2)).toEqual(expect.arrayContaining(['Directions', 'PlaceSearch', 'PlaceDetails', 'MapImage'])); diff --git a/packages/core/test/platform/card.test.ts b/packages/core/test/platform/card.test.ts index 2072179ea..4dc312648 100644 --- a/packages/core/test/platform/card.test.ts +++ b/packages/core/test/platform/card.test.ts @@ -32,7 +32,7 @@ describe('the platform card', () => { expect(card).toContain("the owner's self-hosted agent hub"); expect(card).toContain('This hub: madx, Conclave 0.4.14, on Linux x64 in an LXC container (CT 100).'); for (const word of ['Chat is a plain conversation', 'Assistant runs on the hub', 'Code works in a folder', 'Delegate sends a job', 'Task runs a subagent', 'Workflow runs a script']) expect(card).toContain(word); - for (const page of ['Settings > Models', 'Refusal fallback', 'Settings > Browser', 'GitHub', 'Inbox', 'Usage', 'Routines', 'Extensions', 'Friends', 'Import']) expect(card).toContain(page); + for (const page of ['Settings > AI connections', 'Settings > Advanced: Accounts', 'Refusal fallback', 'Settings > Browser', 'GitHub', 'Inbox', 'Usage', 'Routines', 'Extensions', 'Friends', 'Import']) expect(card).toContain(page); expect(card).toContain('You cannot change settings, keys, sign-ins or device pairing'); expect(card).toContain('"can you do X"'); expect(card).toContain('call ConclaveHelp first'); @@ -45,7 +45,9 @@ describe('the platform card', () => { const code = platformCard(busy({ surface: 'code', agent: 'coder' })).card; console.log(`card chars: assistant ${full.length}, code ${code.length}`); expect(code).not.toContain('Where things are in the app'); - expect(code).not.toContain('Settings > Models'); + expect(code).not.toContain('Settings > AI connections'); + // the regroup (v0.4.97) has no Models group + expect(full).not.toContain('Settings > Models'); for (const word of ['Code works in a folder', 'Delegate sends a job', 'Workflow runs a script', 'call ConclaveHelp first', 'You cannot change settings']) expect(code).toContain(word); expect(code.length).toBeLessThan(full.length - 600); const live = platformCard(busy({ surface: 'code', agent: 'coder' })).live; @@ -120,7 +122,7 @@ describe('the platform card', () => { test('a member sees their own devices, not the hub owner\'s settings or accounts', () => { const c = platformCard(busy({ member: true, accounts: [], engines: [] })); expect(c.card).toContain('The hub, its browser and its accounts are the owner\'s.'); - expect(c.card).not.toContain('Settings > Models'); + expect(c.card).not.toContain('Settings > AI connections'); expect(c.live).not.toContain('Models:'); }); diff --git a/packages/daemon-rs/src/private.rs b/packages/daemon-rs/src/private.rs index 9045910a9..f5d6f6863 100644 --- a/packages/daemon-rs/src/private.rs +++ b/packages/daemon-rs/src/private.rs @@ -7,7 +7,7 @@ use crate::errors::WireError; use crate::paths::{native, SEP}; -pub const REFUSAL: &str = "Refused: that folder holds the hub's subscription sign-ins (CLIProxyAPI). Sessions cannot read or change it. Settings > Models > Subscriptions shows the accounts."; +pub const REFUSAL: &str = "Refused: that folder holds the hub's subscription sign-ins (CLIProxyAPI). Sessions cannot read or change it. Settings > AI connections > Subscriptions shows the accounts."; #[cfg(test)] thread_local! { diff --git a/packages/server/src/cliproxy/config.ts b/packages/server/src/cliproxy/config.ts index 36b9b811f..437b3b24c 100644 --- a/packages/server/src/cliproxy/config.ts +++ b/packages/server/src/cliproxy/config.ts @@ -57,7 +57,7 @@ export interface ConfigInput { export function renderConfig(c: ConfigInput): string { return [ '# Written by the Conclave hub each time it starts CLIProxyAPI. Edits here are replaced.', - '# Settings > Models > Subscriptions on the hub changes what matters.', + '# Settings > AI connections > Subscriptions on the hub changes what matters.', 'config-version: 8', 'server:', ' host: "127.0.0.1"', diff --git a/packages/server/src/routes-people.ts b/packages/server/src/routes-people.ts index 250a7f75b..c52584d1a 100644 --- a/packages/server/src/routes-people.ts +++ b/packages/server/src/routes-people.ts @@ -306,7 +306,7 @@ export function registerPeopleRoutes(app: Hono, ctx: ServerContext): vo } if (body.usageFallback !== undefined || body.refusalFallback !== undefined) { // the owner's lists are the hub's (models.limitFallback, models.refusalFallback in /api/config) - if (!isMember(acct)) throw badRequest('Your fallback lists are in Settings, Models.'); + if (!isMember(acct)) throw badRequest('Your fallback lists are in Settings > Advanced (Refusal fallback, Limit fallback).'); try { const { usageFallback: usage, refusalFallback: refusal } = engine.checkMemberFallbacks(acct, body); if (usage) settings.usageFallback = usage; diff --git a/packages/web/src/features/onboarding/SetupLater.tsx b/packages/web/src/features/onboarding/SetupLater.tsx index 6cc24d5a9..406de6e32 100644 --- a/packages/web/src/features/onboarding/SetupLater.tsx +++ b/packages/web/src/features/onboarding/SetupLater.tsx @@ -13,15 +13,15 @@ import { Button, type ButtonSize } from '@/components/ui/Button'; import { HOVER_ROW } from '@/features/home/sections'; import { Group, SettingRow } from '@/features/settings/parts'; import { LATER, stepHref, type LaterId } from './steps'; -import { laterDone, laterLeft, useProgress, useSetupFacts } from './progress'; +import { finishedOldSetup, laterDone, laterLeft, useProgress, useSetupFacts } from './progress'; import { errText } from './parts'; -/** The items Home shows: none for a member, before setup is done, or once hidden. */ +/** The items Home shows: none for a member, before setup is done, once hidden, or on a hub that finished the old setup. */ export function useSetupLater() { const facts = useSetupFacts(); const { done } = useProgress(); const owner = useHub((s) => s.me?.role === 'owner'); - const hidden = useHub((s) => !!s.config?.setup?.laterHidden); + const hidden = useHub((s) => !!s.config?.setup?.laterHidden || finishedOldSetup(s.config)); const onboarded = useOnboarded(); return owner && onboarded && !hidden ? laterLeft(facts, done) : []; } diff --git a/packages/web/src/features/onboarding/progress.ts b/packages/web/src/features/onboarding/progress.ts index a1a33e41a..7b88313e0 100644 --- a/packages/web/src/features/onboarding/progress.ts +++ b/packages/web/src/features/onboarding/progress.ts @@ -6,9 +6,9 @@ import { useMemo } from 'react'; import type { Device } from '@conclave/core/types'; import { toast, updateConfig, useHub, type HubConfig } from '@/store/store'; -import { HARNESS_LOGINS, PROVIDERS } from '@/lib/providers'; +import { HARNESS_LOGINS, modelUsable, PROVIDERS, providerReady } from '@/lib/providers'; import { deviceName, desktopNotifyOn, useNotifyDevices } from '@/lib/notify'; -import { isStepId, LATER, pageFor, type LaterId, type PageId, type StepId } from './steps'; +import { FOLDED, isStepId, LATER, pageFor, type LaterId, type PageId, type StepId } from './steps'; export interface SetupProgress { step?: StepId; @@ -40,6 +40,17 @@ export function useProgress(): SetupProgress & { done: PageId[]; completed: bool return useMemo(() => ({ ...readProgress(config), done: pages(config?.ui?.onboardingSteps ?? []), completed: !!config?.setup?.completedAt }), [config]); } +/** + * A hub that finished the thirteen step setup: setup.completedAt is set and its + * saved steps still hold ids only that setup wrote (subscriptions, memory, done ...). + * Its owner already chose, so Home does not list "Set up later". + */ +export function finishedOldSetup(config: HubConfig | undefined): boolean { + const skipped = config?.setup?.progress?.skipped; + const raw: unknown[] = [...(config?.ui?.onboardingSteps ?? []), ...(Array.isArray(skipped) ? skipped : [])]; + return !!config?.setup?.completedAt && raw.some((x) => typeof x === 'string' && Object.hasOwn(FOLDED, x)); +} + /** Save that a step was finished or skipped, and where to resume (a "Set up later" page leaves that as it is). Never blocks the flow. */ export async function recordStep(id: PageId, how: 'done' | 'skipped', resumeAt?: StepId) { const config = useHub.getState().config; @@ -50,7 +61,8 @@ export async function recordStep(id: PageId, how: 'done' | 'skipped', resumeAt?: skipped.delete(id); } else if (!done.has(id)) skipped.add(id); try { - await updateConfig({ ui: { onboardingSteps: [...done] }, setup: { progress: { ...(resumeAt ? { step: resumeAt } : {}), skipped: [...skipped], updatedAt: Date.now() } } }); + // saving rewrites old step ids, so keep a hub that finished the old setup hiding the list + await updateConfig({ ui: { onboardingSteps: [...done] }, setup: { ...(finishedOldSetup(config) ? { laterHidden: true } : {}), progress: { ...(resumeAt ? { step: resumeAt } : {}), skipped: [...skipped], updatedAt: Date.now() } } }); } catch (e) { toast({ title: `Could not save setup progress. ${e instanceof Error ? e.message : String(e)}`, level: 'error' }); } @@ -81,6 +93,8 @@ export interface SetupFacts { /** Harness ids found on any device, and where. */ harnesses: Array<{ id: string; devices: string[] }>; defaultModel?: string; + /** The default model's provider can run it (lib/providers.ts modelUsable). The hub always returns a default model, the schema's when none was chosen. */ + defaultUsable: boolean; smallModel?: string; defaultAgent?: string; memoryOn: boolean; @@ -148,6 +162,8 @@ export function useSetupFacts(): SetupFacts { logins: progress.logins ?? [], harnesses, defaultModel: config?.defaultModel as string | undefined, + // no model list yet (loading, or the request failed): do not show Defaults as missing + defaultUsable: !models.length || modelUsable(config?.defaultModel, providerReady(models), models), smallModel: config?.smallModel as string | undefined, defaultAgent: config?.defaultAgent as string | undefined, memoryOn: mem.enabled !== false, @@ -168,13 +184,13 @@ export function loginPlans(ids: string[]): string[] { } /** True when a "Set up later" item is done: its page was finished, or the hub already shows it set up. */ -export function laterDone(id: LaterId, f: Pick, done: readonly PageId[]): boolean { +export function laterDone(id: LaterId, f: Pick, done: readonly PageId[]): boolean { if (done.includes(id)) return true; switch (id) { case 'agents': return f.logins.length > 0; case 'defaults': - return !!f.defaultModel; + return f.defaultUsable; case 'import': return f.imported > 0; case 'devices': diff --git a/packages/web/src/features/onboarding/steps/ModelStep.tsx b/packages/web/src/features/onboarding/steps/ModelStep.tsx index ad8d68dee..adc73be9f 100644 --- a/packages/web/src/features/onboarding/steps/ModelStep.tsx +++ b/packages/web/src/features/onboarding/steps/ModelStep.tsx @@ -4,14 +4,16 @@ * in starts CLIProxyAPI on the hub the first time; every model from those * accounts then shows up under CLIProxyAPI in the model picker. "Use an * existing CLIProxyAPI" connects the one the owner runs elsewhere instead. - * A signed-in plan becomes the default model on Continue; with keys only, the - * hub uses the first model that works. Coding CLIs are found in the + * On Continue, a default or small model that cannot run is replaced: by a + * model from a signed-in plan, or else from the first provider whose key + * works (lib/providers.ts keyDefaults). Coding CLIs are found in the * background and wait on the "Set up later" Coding agents page. Skippable. */ import { useCallback, useState, type ReactNode } from 'react'; import { api } from '@/lib/api'; import { subscriptionDefaults, useSubscriptions } from '@/lib/subscriptions'; -import { updateConfig, useHub } from '@/store/store'; +import { keyDefaults, providerReady } from '@/lib/providers'; +import { reloadModels, updateConfig, useHub } from '@/store/store'; import { SectionHeading } from '@/components/ui/Section'; import { LoadingRows } from '@/components/ui/EmptyState'; import { AccountRows, ExternalForm, SubscriptionRows, SubscriptionsStatusLine } from '@/components/subscriptions/Subscriptions'; @@ -50,11 +52,21 @@ export function ModelStep() { ); + // with no working default model, a model these accounts give, or else the first working key's, becomes the default + const adopt = async () => { + // a key saved a moment ago: its provider's models may not be listed yet + await reloadModels(); + const { config, models } = useHub.getState(); + const ready = providerReady(models); + const next = (status && subscriptionDefaults(status, config, ready)) ?? keyDefaults(models, config, ready); + if (next) await updateConfig(next).catch(() => undefined); + }; + // a hub from before subscription sign-in: say so instead of an error const older = !!hub?.features?.length && !hub.features.includes('subscriptions'); if (!status) return ( - + {older ? (

This hub does not support subscription sign-in. Paste an API key below, or update the hub and run setup again from Settings, About.

) : error ? ( @@ -70,13 +82,6 @@ export function ModelStep() { const summary = <>{summaryOf(n, ...keys)}; const showForm = external || status.mode === 'external'; - // with no working default model, a model these accounts give becomes the default - const adopt = async () => { - const { config, models } = useHub.getState(); - const next = subscriptionDefaults(status, config, (p) => !!models.find((g) => g.provider === p && g.configured && g.enabled && !g.error)); - if (next) await updateConfig(next).catch(() => undefined); - }; - return ( {status.mode !== 'off' && ( diff --git a/packages/web/src/lib/providers.ts b/packages/web/src/lib/providers.ts index 922a03f1b..35667871b 100644 --- a/packages/web/src/lib/providers.ts +++ b/packages/web/src/lib/providers.ts @@ -82,6 +82,40 @@ export function keyPlaceholder(p: ProviderInfo | undefined): string { return p.keyPrefix ? `Paste a key that starts with ${p.keyPrefix}` : 'Paste a key'; } +/** A provider can run calls: it has a key (or needs none), is on, and its model listing did not fail. */ +export function providerReady(groups: readonly ModelGroup[]): (provider: string) => boolean { + return (p) => groups.some((g) => g.provider === p && g.configured && g.enabled && !g.error); +} + +const providerOf = (ref: string) => ref.slice(0, ref.indexOf('/')); + +/** A "provider/model" ref whose provider is ready, or that runs as the same model on a ready route (a plan; ModelEntry.sameAs in [groups]). */ +export function modelUsable(ref: unknown, ready: (provider: string) => boolean, groups: readonly ModelGroup[] = []): boolean { + if (typeof ref !== 'string' || !ref.includes('/')) return false; + if (ready(providerOf(ref))) return true; + const same = groups.flatMap((g) => g.models).find((m) => m.ref === ref)?.sameAs; + return !!same && same.includes('/') && ready(providerOf(same)); +} + +/** + * Defaults from the first provider in PROVIDERS order that works (a tested key + * or a local runtime), for the default or small model that cannot run. Its + * models' catalog tier picks them: smart for the default, fast for the small + * one. Undefined when nothing needs to change or no provider works. + */ +export function keyDefaults(groups: readonly ModelGroup[], config: Record | undefined, ready: (provider: string) => boolean): { defaultModel?: string; smallModel?: string } | undefined { + const g = PROVIDERS.map((p) => groups.find((x) => x.provider === p.id)).find((x) => x && ready(x.provider) && x.models.some((m) => !m.unavailable)); + if (!g) return undefined; + const ok = g.models.filter((m) => !m.unavailable); + const pick = (...tiers: string[]) => (tiers.map((t) => ok.find((m) => m.tier === t)).find(Boolean) ?? ok[0]).ref; + // a provider with a key whose listing failed keeps its model: the failure may pass, and Defaults shows it meanwhile + const keep = (ref: unknown) => modelUsable(ref, ready, groups) || (typeof ref === 'string' && groups.some((x) => x.provider === providerOf(ref) && x.configured && x.enabled && !!x.error)); + const out: { defaultModel?: string; smallModel?: string } = {}; + if (!keep(config?.defaultModel)) out.defaultModel = pick('smart', 'deep'); + if (!keep(config?.smallModel)) out.smallModel = pick('fast', 'smart'); + return Object.keys(out).length ? out : undefined; +} + /** * The hub's providers the owner can let a person use (People, docs/design/ACCOUNTS.md 6): * the ones that are on and that the hub has a key for, or need none (a local server, diff --git a/packages/web/src/lib/subscriptions.ts b/packages/web/src/lib/subscriptions.ts index d2210c0b5..02e0abafc 100644 --- a/packages/web/src/lib/subscriptions.ts +++ b/packages/web/src/lib/subscriptions.ts @@ -7,6 +7,7 @@ import { useEffect, useState } from 'react'; import type { SubscriptionAccountDto, SubscriptionsStatus } from '@conclave/core/client'; import type { LogoId } from '@/components/logo'; import { api } from './api'; +import { modelUsable } from './providers'; import { useHub } from '@/store/store'; /** Company mark per sign-in id. Muse signs in with Meta. */ @@ -86,7 +87,7 @@ export function subscriptionDefaults(status: SubscriptionsStatus, config: Record const ids = status.models.flatMap((g) => g.models.map((m) => m.id)); if (!ids.length) return undefined; const pick = (order: string[]) => order.find((id) => ids.includes(id)) ?? ids[0]; - const usable = (ref: unknown) => typeof ref === 'string' && ref.includes('/') && configured(ref.slice(0, ref.indexOf('/'))); + const usable = (ref: unknown) => modelUsable(ref, configured); const out: { defaultModel?: string; smallModel?: string } = {}; if (!usable(config?.defaultModel)) out.defaultModel = `${status.provider}/${pick(['claude-sonnet-5-5', 'claude-opus-5-5', 'gpt-6.1-sol', 'gpt-6-astra', 'gemini-4-argon'])}`; if (!usable(config?.smallModel)) out.smallModel = `${status.provider}/${pick(['claude-haiku-5-5', 'gpt-6-luna', 'gemini-3.8-flash', 'claude-sonnet-5-5'])}`; diff --git a/packages/web/test/onboarding-branch.test.ts b/packages/web/test/onboarding-branch.test.ts index 48c0b2a02..946bcccc5 100644 --- a/packages/web/test/onboarding-branch.test.ts +++ b/packages/web/test/onboarding-branch.test.ts @@ -9,7 +9,21 @@ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; import { branchChoices, branchTarget, hubIsHere, startingName } from '../src/features/onboarding/branch'; import { LATER, STEPS, pageFor, stepHref } from '../src/features/onboarding/steps'; -import { laterLeft } from '../src/features/onboarding/progress'; +import { finishedOldSetup, laterLeft } from '../src/features/onboarding/progress'; +import { keyDefaults, modelUsable, providerReady } from '../src/lib/providers'; +import type { ModelGroup } from '@conclave/core/client'; +import type { HubConfig } from '../src/store/store'; + +// what GET /api/config returns on a new hub: the schema's defaults, whatever is connected +const SCHEMA = { defaultModel: 'anthropic/claude-sonnet-5-5', smallModel: 'anthropic/claude-haiku-5-5' }; +const model = (provider: string, id: string, tier?: 'fast' | 'smart' | 'deep', unavailable?: string) => ({ id, ref: `${provider}/${id}`, provider, name: id, tier, unavailable }); +const group = (provider: string, configured: boolean, models: ReturnType[], error?: string) => ({ provider, name: provider, type: provider, configured, enabled: true, models, error }); +// only an OpenAI key, tested OK; Anthropic is listed from the catalog without a key +const KEY_ONLY = [ + group('anthropic', false, [model('anthropic', 'claude-sonnet-5-5', 'smart'), model('anthropic', 'claude-haiku-5-5', 'fast')]), + group('openai', true, [model('openai', 'gpt-5.6', 'deep'), model('openai', 'gpt-5.6-terra', 'smart'), model('openai', 'gpt-5.6-luna', 'fast')]), +] as unknown as ModelGroup[]; +const factsFor = (config: Record, groups: ModelGroup[]) => ({ defaultUsable: modelUsable(config.defaultModel, providerReady(groups)), imported: 0, devices: [], channels: [], routines: 0, logins: [] }); describe('four steps', () => { test('Welcome, Hub, Connect a model, Make it yours', () => { @@ -29,11 +43,55 @@ describe('four steps', () => { }); test('Set up later lists what is not done yet', () => { - const none = { defaultModel: undefined, imported: 0, devices: [], channels: [], routines: 0, logins: [] }; + const none = factsFor(SCHEMA, KEY_ONLY); expect(laterLeft(none, []).map((s) => s.id)).toEqual(LATER.map((s) => s.id)); - const some = { ...none, defaultModel: 'a/b', routines: 2, channels: ['Phone'] }; + const some = { ...factsFor({ defaultModel: 'openai/gpt-5.6-terra' }, KEY_ONLY), routines: 2, channels: ['Phone'] }; expect(laterLeft(some, ['extensions']).map((s) => s.id)).toEqual(['agents', 'import', 'devices']); }); + + test('a default model that cannot run shows the Defaults card; one that can hides it', () => { + expect(laterLeft(factsFor(SCHEMA, KEY_ONLY), []).map((s) => s.id)).toContain('defaults'); + expect(laterLeft(factsFor({ defaultModel: 'openai/gpt-5.6-terra' }, KEY_ONLY), []).map((s) => s.id)).not.toContain('defaults'); + // a key the provider rejected does not count + const rejected = [group('openai', true, [], 'HTTP 401')] as unknown as ModelGroup[]; + expect(laterLeft(factsFor({ defaultModel: 'openai/gpt-5.6-terra' }, rejected), []).map((s) => s.id)).toContain('defaults'); + // finishing the Defaults page counts too + expect(laterLeft(factsFor(SCHEMA, KEY_ONLY), ['defaults']).map((s) => s.id)).not.toContain('defaults'); + }); + + test('with only an API key, Continue sets defaults that can run', () => { + const ready = providerReady(KEY_ONLY); + const next = keyDefaults(KEY_ONLY, SCHEMA, ready); + expect(next).toEqual({ defaultModel: 'openai/gpt-5.6-terra', smallModel: 'openai/gpt-5.6-luna' }); + expect(modelUsable(next?.defaultModel, ready)).toBe(true); + expect(laterLeft(factsFor({ ...SCHEMA, ...next }, KEY_ONLY), []).map((s) => s.id)).not.toContain('defaults'); + // defaults that already run stay; no working provider changes nothing + expect(keyDefaults(KEY_ONLY, { defaultModel: 'openai/gpt-5.6', smallModel: 'openai/gpt-5.6-luna' }, ready)).toBeUndefined(); + expect(keyDefaults([KEY_ONLY[0]], SCHEMA, providerReady([KEY_ONLY[0]]))).toBeUndefined(); + // a default the owner's plan runs (merged entry, sameAs) stays, and counts as usable + const plan = [ + group('anthropic', false, [{ ...model('anthropic', 'claude-sonnet-5-5', 'smart'), sameAs: 'cliproxy/claude-sonnet-5-5' }, { ...model('anthropic', 'claude-haiku-5-5', 'fast'), sameAs: 'cliproxy/claude-haiku-5-5' }]), + group('cliproxy', true, [model('cliproxy', 'claude-sonnet-5-5', 'smart'), model('cliproxy', 'claude-haiku-5-5', 'fast')]), + group('ollama', true, [model('ollama', 'llama-4')]), + ] as unknown as ModelGroup[]; + expect(keyDefaults(plan, SCHEMA, providerReady(plan))).toBeUndefined(); + expect(modelUsable(SCHEMA.defaultModel, providerReady(plan), plan)).toBe(true); + // a key whose listing failed for a moment keeps the owner's choice + const flaky = [group('anthropic', true, [], 'timeout'), ...KEY_ONLY.slice(1)] as unknown as ModelGroup[]; + expect(keyDefaults(flaky, SCHEMA, providerReady(flaky))).toBeUndefined(); + // a model the plan refused is never picked + const refused = [group('openai', true, [model('openai', 'gpt-5.6-terra', 'smart', 'HTTP 404'), model('openai', 'gpt-5.4', 'smart'), model('openai', 'gpt-5.4-mini', 'fast')])] as unknown as ModelGroup[]; + expect(keyDefaults(refused, SCHEMA, providerReady(refused))?.defaultModel).toBe('openai/gpt-5.4'); + }); + + test('a hub that finished the thirteen step setup hides the list', () => { + const old = { ui: { onboarded: true, onboardingSteps: ['hub', 'subscriptions', 'providers', 'defaults', 'memory', 'done'] }, setup: { completedAt: 1 } } as HubConfig; + expect(finishedOldSetup(old)).toBe(true); + // the four step setup writes only new ids + expect(finishedOldSetup({ ui: { onboardingSteps: ['hub', 'model', 'yours'] }, setup: { completedAt: 1 } } as HubConfig)).toBe(false); + // an old setup left halfway is not finished + expect(finishedOldSetup({ ui: { onboardingSteps: ['hub', 'subscriptions'] } } as HubConfig)).toBe(false); + }); }); describe('hub or client', () => {