Skip to content

feat(studio): AI chat pane with BYOK and cost counter#94

Merged
pbertsch merged 1 commit intomainfrom
feat/studio-ai-chat-v2
May 3, 2026
Merged

feat(studio): AI chat pane with BYOK and cost counter#94
pbertsch merged 1 commit intomainfrom
feat/studio-ai-chat-v2

Conversation

@pbertsch
Copy link
Copy Markdown
Contributor

@pbertsch pbertsch commented May 3, 2026

Summary

  • ✦ AI Chat button in Studio toolbar toggles a bottom panel (⌘⇧A shortcut)
  • BYOK only: user provides their own Anthropic API key (no key bundled)
  • Platform keychain storage: macOS Keychain / Windows Credential Manager / Linux libsecret via zalando/go-keyring — key never written to disk or config files
  • Model: claude-sonnet-4-6 (default, latest Sonnet)
  • Multi-turn chat: full conversation history sent per turn; system prompt includes the current file content as context
  • Cost counter: running total of input + output tokens + estimated USD (Sonnet 4.6 rates: $3/$15 per 1M tokens) shown in pane title bar
  • API key overlay: 🔑 button opens a settings overlay, key saved/removed from keychain, shows masked input
  • Layout: chat panel is a 260px strip below the grid, doesn't disrupt existing panes

Dependencies added (studio/go.mod)

  • github.com/zalando/go-keyring v0.2.8
  • github.com/danieljoos/wincred v1.2.3 (Windows backend, transitive)
  • github.com/godbus/dbus/v5 v5.2.2 (Linux backend, upgraded)

Test plan

  • go build ./... passes (root repo)
  • cd studio && go build . passes
  • Frontend: npm run build in studio/frontend/ passes
  • Click ✦ button → chat pane slides in at bottom; click again → hides
  • ⌘⇧A toggles chat
  • Click 🔑 → API key overlay opens; enter key → saved to macOS Keychain (verify via Keychain Access.app)
  • Send a message about the open .probe file → assistant replies with ProbeScript context
  • Cost counter updates after each turn (input tokens / output tokens / $)
  • Clear button resets history and cost counter
  • Invalid key → clear error toast "invalid API key"
  • No key stored → error toast "no API key stored"

@pbertsch pbertsch requested a review from a team as a code owner May 3, 2026 00:34
@pbertsch pbertsch merged commit 98c44ed into main May 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant