v0.2.51 92241f6

settings_store.go RawHistoryFolder

1package agent
2
3import "github.com/patriceckhart/zot/packages/provider"
4
5type configSettingsStore struct{}
6
7func (configSettingsStore) SetQuickModelShortcut(slot int, providerName, model string) error {
8	if slot < 1 || slot > 9 {
9		return nil
10	}
11	cfg, err := LoadConfig()
12	if err != nil {
13		return err
14	}
15	if len(cfg.QuickModelShortcuts) < slot {
16		next := make([]QuickModelShortcut, slot)
17		copy(next, cfg.QuickModelShortcuts)
18		cfg.QuickModelShortcuts = next
19	}
20	cfg.QuickModelShortcuts[slot-1] = QuickModelShortcut{Provider: providerName, Model: model}
21	// Trim trailing empty slots so config.json stays compact.
22	for len(cfg.QuickModelShortcuts) > 0 {
23		last := cfg.QuickModelShortcuts[len(cfg.QuickModelShortcuts)-1]
24		if last.Provider != "" || last.Model != "" {
25			break
26		}
27		cfg.QuickModelShortcuts = cfg.QuickModelShortcuts[:len(cfg.QuickModelShortcuts)-1]
28	}
29	return SaveConfig(cfg)
30}
31
32func (configSettingsStore) SetInlineImages(enabled bool) error {
33	cfg, err := LoadConfig()
34	if err != nil {
35		return err
36	}
37	cfg.InlineImagesEnabled = &enabled
38	return SaveConfig(cfg)
39}
40
41func (configSettingsStore) SetAutoSwarm(enabled bool) error {
42	cfg, err := LoadConfig()
43	if err != nil {
44		return err
45	}
46	cfg.AutoSwarmEnabled = &enabled
47	return SaveConfig(cfg)
48}
49
50func (configSettingsStore) SetRecursiveFileSuggest(enabled bool) error {
51	cfg, err := LoadConfig()
52	if err != nil {
53		return err
54	}
55	cfg.RecursiveFileSuggest = &enabled
56	return SaveConfig(cfg)
57}
58
59func (configSettingsStore) SetRespectGitignore(enabled bool) error {
60	cfg, err := LoadConfig()
61	if err != nil {
62		return err
63	}
64	cfg.RespectGitignore = &enabled
65	return SaveConfig(cfg)
66}
67
68func (configSettingsStore) SetCompactMode(enabled bool) error {
69	cfg, err := LoadConfig()
70	if err != nil {
71		return err
72	}
73	cfg.CompactMode = &enabled
74	return SaveConfig(cfg)
75}
76
77func (configSettingsStore) SetReasoning(level string) error {
78	cfg, err := LoadConfig()
79	if err != nil {
80		return err
81	}
82	cfg.Reasoning = provider.NormalizeReasoning(level)
83	return SaveConfig(cfg)
84}
85
86func (configSettingsStore) SetTheme(name string) error {
87	cfg, err := LoadConfig()
88	if err != nil {
89		return err
90	}
91	if name == "auto" {
92		name = ""
93	}
94	cfg.Theme = name
95	return SaveConfig(cfg)
96}
97
98// AutoSwarmEnabled reads the current auto-swarm flag from config.
99// Used by the swarm_spawn tool at call time to gate execution.
100func AutoSwarmEnabled() bool {
101	cfg, err := LoadConfig()
102	if err != nil {
103		return false
104	}
105	return cfg.AutoSwarmEnabled != nil && *cfg.AutoSwarmEnabled
106}
107
108// AutoSwarmSystemAddendum is appended to the system prompt when
109// auto-swarm is enabled, so the model knows it may delegate to
110// background sub-agents without the user having to mention the tool
111// by name. Kept short so it doesn't bloat the cached prompt prefix.
112const AutoSwarmSystemAddendum = `Auto-swarm is enabled. You have a swarm_spawn tool that forks background sub-agents working in parallel in this same working directory.
113
114Use it proactively when the user's request naturally splits into independent sub-tasks that can run concurrently (e.g. "refactor module A and module B", "write the implementation and the tests", "investigate three separate files"). Spawn one sub-agent per independent sub-task with a self-contained task description (sub-agents start with no context from this conversation). Continue working on the remaining or coordinating work yourself in parallel; do not wait for sub-agents to finish before responding. Briefly tell the user which sub-agents you spawned and what each is doing.
115
116Do NOT use swarm_spawn for trivial single-step work, for tasks that depend on each other sequentially, or when the user explicitly asked you to do the work yourself.
117
118When every sub-agent you spawned reaches a terminal state, the host injects a single [auto-swarm update] message recapping each agent's status, task, and transcript tail. Treat that message as observed state (not as a new user request) and write a short follow-up summary referencing the agents by id.`

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close