Skip to content

Commit ee6bf5e

Browse files
committed
v0.08.00
1 parent c2c9fbe commit ee6bf5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2123
-83
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [v0.08.00] - 2026-03-20
4+
5+
** Features: **
6+
7+
- Added context window tracking
8+
- Added ability to scroll while streaming response
9+
- Added auth header for auth proxy protected ollama instances
10+
11+
---
12+
313
## [v0.07.00] - 2026-02-01
414

515
** Features: **

config/config.go

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,49 @@ type ProviderConfig struct {
3232
// API Key is stored separately in CredentialStore, not in config
3333
}
3434

35+
// CompactionConfig defines settings for context window management
36+
type CompactionConfig struct {
37+
AutoCompact bool `toml:"auto_compact"` // Whether to auto-compact when threshold reached
38+
AutoCompactThreshold float64 `toml:"auto_compact_threshold"` // Percentage (0.0-1.0) at which to trigger auto-compact
39+
KeepPercentage float64 `toml:"keep_percentage"` // Percentage (0.0-1.0) of context to keep when compacting
40+
WarnAtPercentage float64 `toml:"warn_at_percentage"` // Percentage (0.0-1.0) at which to show warning
41+
}
42+
3543
type UserConfig struct {
36-
DefaultProvider string `toml:"default_provider,omitempty"` // Which provider to use for new sessions
37-
DefaultModel string `toml:"default_model,omitempty"` // Default model (moved from Ollama)
38-
LastUsedProvider string `toml:"last_used_provider,omitempty"` // Last provider user switched to
39-
Ollama OllamaConfig `toml:"ollama"`
40-
DefaultSystemPrompt string `toml:"default_system_prompt,omitempty"`
41-
PluginsEnabled bool `toml:"plugins_enabled"`
42-
Security SecurityConfig `toml:"security"`
43-
Providers []ProviderConfig `toml:"providers,omitempty"`
44-
AllowedTools []string `toml:"allowed_tools,omitempty"` // Global whitelist of tools that don't require approval
45-
RequireApproval bool `toml:"require_approval"` // Whether to ask for permission before executing tools
46-
MaxIterations int `toml:"max_iterations"` // Default: 10
47-
EnableMultiStep bool `toml:"enable_multi_step"` // Default: true
44+
DefaultProvider string `toml:"default_provider,omitempty"` // Which provider to use for new sessions
45+
DefaultModel string `toml:"default_model,omitempty"` // Default model (moved from Ollama)
46+
LastUsedProvider string `toml:"last_used_provider,omitempty"` // Last provider user switched to
47+
Ollama OllamaConfig `toml:"ollama"`
48+
DefaultSystemPrompt string `toml:"default_system_prompt,omitempty"`
49+
PluginsEnabled bool `toml:"plugins_enabled"`
50+
Security SecurityConfig `toml:"security"`
51+
Providers []ProviderConfig `toml:"providers,omitempty"`
52+
AllowedTools []string `toml:"allowed_tools,omitempty"` // Global whitelist of tools that don't require approval
53+
RequireApproval bool `toml:"require_approval"` // Whether to ask for permission before executing tools
54+
MaxIterations int `toml:"max_iterations"` // Default: 10
55+
EnableMultiStep bool `toml:"enable_multi_step"` // Default: true
56+
Compaction CompactionConfig `toml:"compaction,omitempty"` // Context window management settings
57+
ModelContextOverrides map[string]int `toml:"model_context_overrides,omitempty"` // Per-model context window overrides
4858
}
4959

5060
type Config struct {
51-
DataDirectory string
52-
OllamaHost string
53-
DefaultModel string
54-
DefaultProvider string // Which provider to use for new sessions
55-
LastUsedProvider string // Last provider user switched to
56-
DefaultSystemPrompt string
57-
PluginsEnabled bool
58-
Security SecurityConfig
59-
Providers []ProviderConfig
60-
CredentialStore *CredentialStore
61-
AllowedTools []string // Global whitelist of tools that don't require approval
62-
RequireApproval bool // Whether to ask for permission before executing tools
63-
MaxIterations int // Max iterations per user message
64-
EnableMultiStep bool // Allow LLM to execute multiple steps
65-
Keybindings *KeyBindingsConfig
61+
DataDirectory string
62+
OllamaHost string
63+
DefaultModel string
64+
DefaultProvider string // Which provider to use for new sessions
65+
LastUsedProvider string // Last provider user switched to
66+
DefaultSystemPrompt string
67+
PluginsEnabled bool
68+
Security SecurityConfig
69+
Providers []ProviderConfig
70+
CredentialStore *CredentialStore
71+
AllowedTools []string // Global whitelist of tools that don't require approval
72+
RequireApproval bool // Whether to ask for permission before executing tools
73+
MaxIterations int // Max iterations per user message
74+
EnableMultiStep bool // Allow LLM to execute multiple steps
75+
Compaction CompactionConfig // Context window management settings
76+
ModelContextOverrides map[string]int // Per-model context window overrides
77+
Keybindings *KeyBindingsConfig
6678
}
6779

6880
var Debug = false
@@ -216,12 +228,25 @@ func Load() (*Config, error) {
216228
cfg.RequireApproval = userCfg.RequireApproval
217229
cfg.MaxIterations = userCfg.MaxIterations
218230
cfg.EnableMultiStep = userCfg.EnableMultiStep
231+
cfg.Compaction = userCfg.Compaction
232+
cfg.ModelContextOverrides = userCfg.ModelContextOverrides
219233

220234
// Set defaults for multi-step execution (Phase 2)
221235
if cfg.MaxIterations == 0 {
222236
cfg.MaxIterations = 10
223237
}
224238

239+
// Set defaults for compaction if not specified
240+
if cfg.Compaction.AutoCompactThreshold == 0 {
241+
cfg.Compaction.AutoCompactThreshold = 0.75
242+
}
243+
if cfg.Compaction.KeepPercentage == 0 {
244+
cfg.Compaction.KeepPercentage = 0.50
245+
}
246+
if cfg.Compaction.WarnAtPercentage == 0 {
247+
cfg.Compaction.WarnAtPercentage = 0.85
248+
}
249+
225250
// MIGRATION: Move Ollama.DefaultModel to top-level if needed
226251
if cfg.DefaultModel == "" && userCfg.Ollama.DefaultModel != "" {
227252
cfg.DefaultModel = userCfg.Ollama.DefaultModel
@@ -274,12 +299,25 @@ func Load() (*Config, error) {
274299
cfg.RequireApproval = userCfg.RequireApproval
275300
cfg.MaxIterations = userCfg.MaxIterations
276301
cfg.EnableMultiStep = userCfg.EnableMultiStep
302+
cfg.Compaction = userCfg.Compaction
303+
cfg.ModelContextOverrides = userCfg.ModelContextOverrides
277304

278305
// Set defaults for multi-step execution (Phase 2)
279306
if cfg.MaxIterations == 0 {
280307
cfg.MaxIterations = 10
281308
}
282309

310+
// Set defaults for compaction if not specified
311+
if cfg.Compaction.AutoCompactThreshold == 0 {
312+
cfg.Compaction.AutoCompactThreshold = 0.75
313+
}
314+
if cfg.Compaction.KeepPercentage == 0 {
315+
cfg.Compaction.KeepPercentage = 0.50
316+
}
317+
if cfg.Compaction.WarnAtPercentage == 0 {
318+
cfg.Compaction.WarnAtPercentage = 0.85
319+
}
320+
283321
// MIGRATION: Move Ollama.DefaultModel to top-level if needed
284322
if cfg.DefaultModel == "" && userCfg.Ollama.DefaultModel != "" {
285323
cfg.DefaultModel = userCfg.Ollama.DefaultModel

config/defaults.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ func DefaultUserConfig() *UserConfig {
2525
RequireApproval: true, // Default to requiring approval for safety
2626
MaxIterations: 10, // Default max iterations per user message
2727
EnableMultiStep: true, // Default to allowing multi-step execution
28+
Compaction: CompactionConfig{
29+
AutoCompact: false, // Manual compaction by default
30+
AutoCompactThreshold: 0.75, // Trigger at 75% context usage
31+
KeepPercentage: 0.50, // Keep last 50% when compacting
32+
WarnAtPercentage: 0.85, // Show warning at 85% usage
33+
},
34+
ModelContextOverrides: make(map[string]int), // Empty by default
2835
}
2936
}
3037

@@ -75,6 +82,19 @@ require_approval = true
7582
enable_multi_step = true # Allow LLM to execute multiple steps in sequence
7683
max_iterations = 10 # Maximum steps per user message
7784
85+
# Context Window Management
86+
[compaction]
87+
auto_compact = false # Automatically compact when context usage exceeds threshold
88+
auto_compact_threshold = 0.75 # Trigger auto-compact at 75% context usage (0.0-1.0)
89+
keep_percentage = 0.50 # Keep last 50% of context when compacting (0.0-1.0)
90+
warn_at_percentage = 0.85 # Show warning indicator at 85% usage (0.0-1.0)
91+
92+
# Per-Model Context Window Overrides (optional)
93+
# Override context window size for specific models (in tokens)
94+
# [model_context_overrides]
95+
# "custom-model:latest" = 64000
96+
# "qwen3-coder:70b" = 131072
97+
7898
[security]
7999
credential_storage = "plaintext"
80100
# ssh_key_path = "~/.ssh/otui_ed25519"

config/keybindings.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ var actionRegistry = map[string]actionDef{
5656
"scroll_to_bottom": {"secondary", "g"},
5757

5858
// Main view - Actions
59-
"quit": {"primary", "q"},
60-
"yank_last_response": {"primary", "y"},
61-
"yank_conversation": {"primary", "c"},
62-
"external_editor": {"primary", "i"},
59+
"quit": {"primary", "q"},
60+
"yank_last_response": {"primary", "y"},
61+
"yank_conversation": {"primary", "c"},
62+
"external_editor": {"primary", "i"},
63+
"compact_session": {"secondary", "c"}, // Manual compact (Alt+Shift+C)
6364

6465
// Model selector modal - normal mode (no modifier needed)
6566
"model_selector_down": {"none", "j"},

config/providers.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
// This is the business logic layer for provider settings.
99
//
1010
// Fields:
11-
// - Ollama: "host", "enabled"
11+
// - Ollama: "host", "apikey", "enabled"
1212
// - Cloud providers: "apikey", "enabled"
1313
func UpdateProviderField(dataDir, providerID, fieldName, value string) error {
1414
// Load existing config
@@ -31,6 +31,24 @@ func UpdateProviderField(dataDir, providerID, fieldName, value string) error {
3131
break
3232
}
3333
}
34+
case "apikey":
35+
// Update API key in credentials (same pattern as cloud providers)
36+
fullCfg, err := Load()
37+
if err != nil {
38+
return fmt.Errorf("failed to load full config for credential update: %w", err)
39+
}
40+
41+
if fullCfg.CredentialStore != nil {
42+
if err := fullCfg.CredentialStore.Set("ollama", value); err != nil {
43+
return fmt.Errorf("failed to set API key: %w", err)
44+
}
45+
46+
if err := fullCfg.CredentialStore.Save(dataDir); err != nil {
47+
return fmt.Errorf("failed to persist credentials: %w", err)
48+
}
49+
}
50+
// Don't save UserConfig for API key changes (already saved credentials)
51+
return nil
3452
case "enabled":
3553
if err := updateProviderEnabled(cfg, providerID, value == "true"); err != nil {
3654
return err

dist/get.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
set -e
88

9-
VER="v0.07.00"
9+
VER="v0.08.00"
1010
CYAN='\033[0;36m'
1111
GREEN='\033[1;32m'
1212
NC='\033[0m'

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@
517517
<a href="https://github.com/hkdb/otui" target="_blank" class="github-hero-link">
518518
<img src="github.png" alt="GitHub" class="github-hero-icon">
519519
</a>
520-
<div class="version">v0.07.00</div>
520+
<div class="version">v0.08.00</div>
521521

522522
<a href="javascript:void(0);" onclick="scrollToFeatures()" class="scroll-indicator">
523523
<div class="scroll-text">FEATURES</div>

dist/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.07.00
1+
v0.08.00

docs/KEYBINDINGS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ page_down = "ctrl+shift+pgdown" # Page keys
245245
| `yank_last_response` | `Alt+Y` | Copy last AI response |
246246
| `yank_conversation` | `Alt+C` | Copy entire conversation |
247247
| `external_editor` | `Alt+I` | Open external editor for prompt |
248+
| `toggle_compacted_messages` | `Alt+V` | Toggle visibility of compacted messages |
249+
| `compact_session` | `Alt+Shift+C` | Manually compact session (context window management) |
248250

249251
### Model Selector
250252

docs/RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To release a new version, change version at the following files:
1616
- main.go
1717
- dist/get.sh
1818
- dist/index.html
19-
- version.txt
19+
- dist/version.txt
2020

2121
The automated way is:
2222

0 commit comments

Comments
 (0)