feat(workspaces): quick-chat AI-config injection for loginless runtimes (opencode/pi)#367
Merged
Merged
Conversation
…imes (opencode/pi) claude/codex run on their own CLI login, so quick-chat could launch them directly. opencode/pi are provider-agnostic — no login of their own — and the chat template injects no credentials, so picking them in the composer spawned an agent that instantly ENOENT-died on a missing key: a dead-end front door. Quick-chat now seeds a loginless runtime from the credential vault before spawn, reusing the existing injection primitives: - /quick-chat accepts an optional `credentialSlug`; for opencode/pi it picks the user's choice, else the cred the day's workspace already uses (detected by apiKey→slug), else the first wire-compatible one. No compatible credential at all → 400 no_ai_credential, which the composer turns into a "Configure an AI provider" bounce to Settings instead of a silent failure. - Credentials gain an optional `lastModel` — a cred carries no model of its own, so quick-chat (and the per-workspace config save) remember the last pick to spare re-typing; absent ⇒ the vendor's catalog flagship. No migration (optional field). DEFAULT_MODEL_BY_VENDOR added to the preset catalog. - New pure helpers in credential-injection.ts (compatibleCredentials, matchCredentialByApiKey, resolveInjectionModel) + a detection route (GET /:id/agent-config/:agent/credential) and `?agent=` filter on /credentials. - Composer: a credential dropdown for opencode/pi only (claude/codex unchanged), defaulting to the workspace's current cred; an overwrite notice when the pick differs; the zero-cred bounce. i18n en/zh/zh-Hant/ja + demo handler synced. Tests: 14 new (helper units + quick-chat route branches — no-cred bounce, inject-default-flagship, explicit-slug-lastModel, claude-never-injected). tsc (Alice + UI) clean; pnpm test 2026 passing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…aterfall The credential dropdown's fetch was gated on [needsCred, effectiveAgent], so it only started after the agents list resolved and the user landed on opencode/pi — a second, late-starting request whose data visibly lagged behind the agent button (which comes from the already-loaded agents context). The backend wasn't slow: /agents does a cheap per-call PATH probe (by design), and /credentials is a plain config read — the lag was purely the frontend request waterfall. Fetch the loginless credential set once on mount instead, in parallel with the agents load, so the picker is ready the instant opencode/pi is chosen. opencode and pi share one compatibility set (provider-agnostic → any wire), so a single fetch serves both; claude/codex never show the picker. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3 tasks
yodaliu
pushed a commit
to yodaliu/OpenAlice
that referenced
this pull request
Jun 22, 2026
Since beta.3: - feat(workspaces): auto-detect installed agent runtimes + install guidance (TraderAlice#366) - feat(workspaces): quick-chat AI-config injection for loginless runtimes opencode/pi (TraderAlice#367) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastModelon credentials — a cred carries no model of its own, so quick-chat and the per-workspace config save remember the last pick (absent ⇒ vendor catalog flagship). Optional field, no migration.compatibleCredentials/matchCredentialByApiKey/resolveInjectionModel), a detection route (GET /:id/agent-config/:agent/credential), and an?agent=compatibility filter on/credentials. i18n en/zh/zh-Hant/ja + demo handler synced.Test plan
npx tsc --noEmitclean (Alice src/)cd ui && npx tsc -bclean (UI strict)pnpm test— 2026 passing (14 new: injection-helper units + quick-chat route branches: no-cred bounce, inject-default-flagship, explicit-slug→lastModel, claude-never-injected)Boundary touch
Touches the credential vault (
core/config.tscredentialSchema+ asetCredentialLastModelwriter) and AI-config injection. No trading / auth / broker-credential / migration paths; the schema change is an additive optional field (no migration by design).🤖 Generated with Claude Code