Rate limits: - Add PoolRPS/PoolTPM/PoolTokensMonth/PoolCostMonth pool kinds - Provider defaults for Mistral/Anthropic/OpenAI/Google (tier-aware) - Config override via [rate_limits.<provider>] TOML section - Pools auto-attached to arms on registration Elf tree view (CC-style): - Structured elf.Progress type replaces flat string channel - Tree with ├─/└─ branches, per-elf stats (tool uses, tokens) - Live activity updates: tool calls, "generating… (N chars)" - Completed elfs stay in tree with "Done (duration)" until turn ends - Suppress raw elf output from chat (tree + LLM summary instead) - Remove background elf mode (wait: false) — always wait - Truncate elf results to 2000 chars for parent context - Parallel hint in system prompt and tool description Permission prompts: - Show actual command in prompt: "bash wants to execute: find . -name '*.go'" - Compact hint in separator bar: "⚠ bash: find . | wc -l [y/n]" - PermReqMsg carries tool name + args Other: - Fix /model not updating status bar (session.Local.SetModel) - Add make targets: run, check, install - Update deps: BurntSushi/toml v1.6.0, chroma v2.23.1, x/text v0.35.0, cloud.google.com/go v0.123.0
121 lines
2.7 KiB
Go
121 lines
2.7 KiB
Go
package tui
|
|
|
|
import (
|
|
"image/color"
|
|
|
|
"charm.land/lipgloss/v2"
|
|
"somegit.dev/Owlibou/gnoma/internal/permission"
|
|
)
|
|
|
|
// Color palette — catppuccin mocha inspired
|
|
var (
|
|
cPurple = lipgloss.Color("#CBA6F7") // mauve
|
|
cBlue = lipgloss.Color("#89B4FA") // blue
|
|
cGreen = lipgloss.Color("#A6E3A1") // green
|
|
cRed = lipgloss.Color("#F38BA8") // red
|
|
cYellow = lipgloss.Color("#F9E2AF") // yellow
|
|
cPeach = lipgloss.Color("#FAB387") // peach
|
|
cTeal = lipgloss.Color("#94E2D5") // teal
|
|
cText = lipgloss.Color("#CDD6F4") // text
|
|
cSubtext = lipgloss.Color("#A6ADC8") // subtext0
|
|
cOverlay = lipgloss.Color("#6C7086") // overlay0
|
|
cSurface = lipgloss.Color("#313244") // surface0
|
|
cBase = lipgloss.Color("#1E1E2E") // base
|
|
cMantle = lipgloss.Color("#181825") // mantle
|
|
)
|
|
|
|
// Permission mode colors — each mode has a distinct color
|
|
var modeColors = map[permission.Mode]color.Color{
|
|
permission.ModeBypass: cGreen, // green = all allowed
|
|
permission.ModeDefault: cBlue, // blue = prompting
|
|
permission.ModePlan: cTeal, // teal = read-only
|
|
permission.ModeAcceptEdits: cPurple, // purple = edits ok
|
|
permission.ModeAuto: cPeach, // peach = smart
|
|
permission.ModeDeny: cRed, // red = locked down
|
|
}
|
|
|
|
// ModeColor returns the color for a permission mode.
|
|
func ModeColor(mode permission.Mode) color.Color {
|
|
if c, ok := modeColors[mode]; ok {
|
|
return c
|
|
}
|
|
return cOverlay
|
|
}
|
|
|
|
// Header
|
|
var (
|
|
sHeaderBrand = lipgloss.NewStyle().
|
|
Background(cPurple).
|
|
Foreground(cMantle).
|
|
Bold(true).
|
|
Padding(0, 1)
|
|
|
|
sHeaderModel = lipgloss.NewStyle().
|
|
Foreground(cGreen).
|
|
Bold(true)
|
|
|
|
sHeaderDim = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
)
|
|
|
|
// Chat
|
|
var (
|
|
sUserLabel = lipgloss.NewStyle().
|
|
Foreground(cBlue).
|
|
Bold(true)
|
|
|
|
styleAssistantLabel = lipgloss.NewStyle().
|
|
Foreground(cPurple).
|
|
Bold(true)
|
|
|
|
sToolOutput = lipgloss.NewStyle().
|
|
Foreground(cGreen)
|
|
|
|
sToolResult = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
|
|
sSystem = lipgloss.NewStyle().
|
|
Foreground(cYellow)
|
|
|
|
sError = lipgloss.NewStyle().
|
|
Foreground(cRed)
|
|
|
|
sHint = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
|
|
sCursor = lipgloss.NewStyle().
|
|
Foreground(cPurple)
|
|
|
|
sDiffAdd = lipgloss.NewStyle().
|
|
Foreground(cGreen)
|
|
|
|
sDiffRemove = lipgloss.NewStyle().
|
|
Foreground(cRed)
|
|
|
|
sText = lipgloss.NewStyle().
|
|
Foreground(cText)
|
|
)
|
|
|
|
// Status bar
|
|
var (
|
|
sStatusBar = lipgloss.NewStyle().
|
|
Foreground(cSubtext)
|
|
|
|
sStatusHighlight = lipgloss.NewStyle().
|
|
Foreground(cPurple).
|
|
Bold(true)
|
|
|
|
sStatusDim = lipgloss.NewStyle().
|
|
Foreground(cOverlay)
|
|
|
|
sStatusStreaming = lipgloss.NewStyle().
|
|
Foreground(cYellow).
|
|
Bold(true)
|
|
|
|
sStatusBranch = lipgloss.NewStyle().
|
|
Foreground(cGreen)
|
|
|
|
sStatusIncognito = lipgloss.NewStyle().
|
|
Foreground(cYellow)
|
|
)
|