summaryrefslogtreecommitdiff
path: root/internal/appconfig
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-17 21:33:45 +0300
committerPaul Buetow <paul@buetow.org>2025-09-17 21:33:45 +0300
commit88103657fb230bb41217a06aa5602ae23e7acb8b (patch)
tree524c437e4e40ee5d6713b6ea5414ad975654cc52 /internal/appconfig
parent2b6232704ecc90630196b9f829f966533e5cdccd (diff)
feat(stats,tmux): global Σ@window stats across processes with flocked cache; width mitigation (narrow/maxlen); configurable [stats] window_minutes; robust coverage parsing; docs update\n\n- Add internal/stats with windowed event cache + flock + atomic writes\n- Wire stats into LSP/CLI/Tmux Action; tmux shows Σ@window with per-model tail\n- HEXAI_TMUX_STATUS_NARROW and HEXAI_TMUX_STATUS_MAXLEN for width control\n- Add [stats] window_minutes to config and apply on startup\n- Improve Magefile coverage handling; add tests to lift coverage >85%\n- Update docs/tmux.md and config example
Diffstat (limited to 'internal/appconfig')
-rw-r--r--internal/appconfig/config.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/appconfig/config.go b/internal/appconfig/config.go
index c8cf871..2274aee 100644
--- a/internal/appconfig/config.go
+++ b/internal/appconfig/config.go
@@ -89,6 +89,8 @@ type App struct {
// Custom code actions and tmux integration
CustomActions []CustomAction `json:"-" toml:"-"`
TmuxCustomMenuHotkey string `json:"-" toml:"-"`
+ // Stats
+ StatsWindowMinutes int `json:"-" toml:"-"`
}
// CustomAction describes a user-defined code action.
@@ -152,6 +154,9 @@ func newDefaultConfig() App {
PromptCLIDefaultSystem: "You are Hexai CLI. Default to very short, concise answers. If the user asks for commands, output only the commands (one per line) with no commentary or explanation. Only when the word 'explain' appears in the prompt, produce a verbose explanation.",
PromptCLIExplainSystem: "You are Hexai CLI. The user requested an explanation. Provide a clear, verbose explanation with reasoning and details. If commands are needed, include them with brief context.",
+
+ // Stats
+ StatsWindowMinutes: 60,
}
}
@@ -198,6 +203,7 @@ type fileConfig struct {
Ollama sectionOllama `toml:"ollama"`
Prompts sectionPrompts `toml:"prompts"`
Tmux sectionTmux `toml:"tmux"`
+ Stats sectionStats `toml:"stats"`
}
type sectionGeneral struct {
@@ -236,6 +242,10 @@ type sectionProvider struct {
Name string `toml:"name"`
}
+type sectionStats struct {
+ WindowMinutes int `toml:"window_minutes"`
+}
+
type sectionOpenAI struct {
Model string `toml:"model"`
BaseURL string `toml:"base_url"`
@@ -501,6 +511,11 @@ func (fc *fileConfig) toApp() App {
out.TmuxCustomMenuHotkey = strings.TrimSpace(fc.Tmux.CustomMenuHotkey)
}
+ // stats
+ if fc.Stats.WindowMinutes > 0 {
+ out.StatsWindowMinutes = fc.Stats.WindowMinutes
+ }
+
return out
}