indusagi-coding-agent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2249 -0
- package/README.md +546 -0
- package/dist/cli/args.js +282 -0
- package/dist/cli/config-selector.js +30 -0
- package/dist/cli/file-processor.js +78 -0
- package/dist/cli/list-models.js +91 -0
- package/dist/cli/session-picker.js +31 -0
- package/dist/cli.js +10 -0
- package/dist/config.js +158 -0
- package/dist/core/agent-session.js +2097 -0
- package/dist/core/auth-storage.js +278 -0
- package/dist/core/bash-executor.js +211 -0
- package/dist/core/compaction/branch-summarization.js +241 -0
- package/dist/core/compaction/compaction.js +606 -0
- package/dist/core/compaction/index.js +6 -0
- package/dist/core/compaction/utils.js +137 -0
- package/dist/core/diagnostics.js +1 -0
- package/dist/core/event-bus.js +24 -0
- package/dist/core/exec.js +70 -0
- package/dist/core/export-html/ansi-to-html.js +248 -0
- package/dist/core/export-html/index.js +221 -0
- package/dist/core/export-html/template.css +905 -0
- package/dist/core/export-html/template.html +54 -0
- package/dist/core/export-html/template.js +1549 -0
- package/dist/core/export-html/tool-renderer.js +56 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +6 -0
- package/dist/core/extensions/index.js +8 -0
- package/dist/core/extensions/loader.js +395 -0
- package/dist/core/extensions/runner.js +499 -0
- package/dist/core/extensions/types.js +31 -0
- package/dist/core/extensions/wrapper.js +101 -0
- package/dist/core/footer-data-provider.js +133 -0
- package/dist/core/index.js +8 -0
- package/dist/core/keybindings.js +140 -0
- package/dist/core/messages.js +122 -0
- package/dist/core/model-registry.js +454 -0
- package/dist/core/model-resolver.js +309 -0
- package/dist/core/package-manager.js +1142 -0
- package/dist/core/prompt-templates.js +250 -0
- package/dist/core/resource-loader.js +569 -0
- package/dist/core/sdk.js +225 -0
- package/dist/core/session-manager.js +1078 -0
- package/dist/core/settings-manager.js +430 -0
- package/dist/core/skills.js +339 -0
- package/dist/core/system-prompt.js +136 -0
- package/dist/core/timings.js +24 -0
- package/dist/core/tools/bash.js +226 -0
- package/dist/core/tools/edit-diff.js +242 -0
- package/dist/core/tools/edit.js +145 -0
- package/dist/core/tools/find.js +205 -0
- package/dist/core/tools/grep.js +238 -0
- package/dist/core/tools/index.js +60 -0
- package/dist/core/tools/ls.js +117 -0
- package/dist/core/tools/path-utils.js +52 -0
- package/dist/core/tools/read.js +165 -0
- package/dist/core/tools/truncate.js +204 -0
- package/dist/core/tools/write.js +77 -0
- package/dist/index.js +41 -0
- package/dist/main.js +565 -0
- package/dist/migrations.js +260 -0
- package/dist/modes/index.js +7 -0
- package/dist/modes/interactive/components/armin.js +328 -0
- package/dist/modes/interactive/components/assistant-message.js +86 -0
- package/dist/modes/interactive/components/bash-execution.js +155 -0
- package/dist/modes/interactive/components/bordered-loader.js +47 -0
- package/dist/modes/interactive/components/branch-summary-message.js +41 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +42 -0
- package/dist/modes/interactive/components/config-selector.js +458 -0
- package/dist/modes/interactive/components/countdown-timer.js +27 -0
- package/dist/modes/interactive/components/custom-editor.js +61 -0
- package/dist/modes/interactive/components/custom-message.js +80 -0
- package/dist/modes/interactive/components/diff.js +132 -0
- package/dist/modes/interactive/components/dynamic-border.js +19 -0
- package/dist/modes/interactive/components/extension-editor.js +96 -0
- package/dist/modes/interactive/components/extension-input.js +54 -0
- package/dist/modes/interactive/components/extension-selector.js +70 -0
- package/dist/modes/interactive/components/footer.js +213 -0
- package/dist/modes/interactive/components/index.js +31 -0
- package/dist/modes/interactive/components/keybinding-hints.js +60 -0
- package/dist/modes/interactive/components/login-dialog.js +138 -0
- package/dist/modes/interactive/components/model-selector.js +253 -0
- package/dist/modes/interactive/components/oauth-selector.js +91 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +262 -0
- package/dist/modes/interactive/components/session-selector-search.js +145 -0
- package/dist/modes/interactive/components/session-selector.js +698 -0
- package/dist/modes/interactive/components/settings-selector.js +250 -0
- package/dist/modes/interactive/components/show-images-selector.js +33 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +44 -0
- package/dist/modes/interactive/components/theme-selector.js +43 -0
- package/dist/modes/interactive/components/thinking-selector.js +45 -0
- package/dist/modes/interactive/components/tool-execution.js +608 -0
- package/dist/modes/interactive/components/tree-selector.js +892 -0
- package/dist/modes/interactive/components/user-message-selector.js +109 -0
- package/dist/modes/interactive/components/user-message.js +15 -0
- package/dist/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/modes/interactive/interactive-mode.js +3576 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.js +938 -0
- package/dist/modes/print-mode.js +96 -0
- package/dist/modes/rpc/rpc-client.js +390 -0
- package/dist/modes/rpc/rpc-mode.js +448 -0
- package/dist/modes/rpc/rpc-types.js +7 -0
- package/dist/utils/changelog.js +86 -0
- package/dist/utils/clipboard-image.js +116 -0
- package/dist/utils/clipboard.js +58 -0
- package/dist/utils/frontmatter.js +25 -0
- package/dist/utils/git.js +5 -0
- package/dist/utils/image-convert.js +34 -0
- package/dist/utils/image-resize.js +180 -0
- package/dist/utils/mime.js +25 -0
- package/dist/utils/photon.js +120 -0
- package/dist/utils/shell.js +164 -0
- package/dist/utils/sleep.js +16 -0
- package/dist/utils/tools-manager.js +186 -0
- package/docs/compaction.md +390 -0
- package/docs/custom-provider.md +538 -0
- package/docs/development.md +69 -0
- package/docs/extensions.md +1733 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/json.md +79 -0
- package/docs/keybindings.md +162 -0
- package/docs/models.md +193 -0
- package/docs/packages.md +163 -0
- package/docs/prompt-templates.md +67 -0
- package/docs/providers.md +147 -0
- package/docs/rpc.md +1048 -0
- package/docs/sdk.md +957 -0
- package/docs/session.md +412 -0
- package/docs/settings.md +216 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +226 -0
- package/docs/terminal-setup.md +65 -0
- package/docs/themes.md +295 -0
- package/docs/tree.md +219 -0
- package/docs/tui.md +887 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +192 -0
- package/examples/extensions/antigravity-image-gen.ts +414 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +115 -0
- package/examples/extensions/custom-footer.ts +65 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +605 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +350 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +83 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +133 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +105 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/handoff.ts +151 -0
- package/examples/extensions/hello.ts +25 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +60 -0
- package/examples/extensions/modal-editor.ts +86 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +25 -0
- package/examples/extensions/overlay-qa-tests.ts +882 -0
- package/examples/extensions/overlay-test.ts +151 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +341 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +399 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/qna.ts +120 -0
- package/examples/extensions/question.ts +265 -0
- package/examples/extensions/questionnaire.ts +428 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/sandbox/index.ts +318 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +344 -0
- package/examples/extensions/space-invaders.ts +561 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +40 -0
- package/examples/extensions/subagent/README.md +172 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +127 -0
- package/examples/extensions/subagent/index.ts +964 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +196 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/todo.ts +300 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +147 -0
- package/examples/extensions/trigger-compact.ts +40 -0
- package/examples/extensions/truncated-tool.ts +193 -0
- package/examples/extensions/widget-placement.ts +17 -0
- package/examples/extensions/with-deps/index.ts +36 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/sdk/01-minimal.ts +22 -0
- package/examples/sdk/02-custom-model.ts +50 -0
- package/examples/sdk/03-custom-prompt.ts +55 -0
- package/examples/sdk/04-skills.ts +46 -0
- package/examples/sdk/05-tools.ts +56 -0
- package/examples/sdk/06-extensions.ts +88 -0
- package/examples/sdk/07-context-files.ts +40 -0
- package/examples/sdk/08-prompt-templates.ts +47 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/examples/sdk/10-settings.ts +38 -0
- package/examples/sdk/11-sessions.ts +48 -0
- package/examples/sdk/12-full-control.ts +82 -0
- package/examples/sdk/13-codex-oauth.ts +37 -0
- package/examples/sdk/README.md +144 -0
- package/package.json +85 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { dirname, join } from "path";
|
|
3
|
+
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
|
4
|
+
/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */
|
|
5
|
+
function deepMergeSettings(base, overrides) {
|
|
6
|
+
const result = { ...base };
|
|
7
|
+
for (const key of Object.keys(overrides)) {
|
|
8
|
+
const overrideValue = overrides[key];
|
|
9
|
+
const baseValue = base[key];
|
|
10
|
+
if (overrideValue === undefined) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
// For nested objects, merge recursively
|
|
14
|
+
if (typeof overrideValue === "object" &&
|
|
15
|
+
overrideValue !== null &&
|
|
16
|
+
!Array.isArray(overrideValue) &&
|
|
17
|
+
typeof baseValue === "object" &&
|
|
18
|
+
baseValue !== null &&
|
|
19
|
+
!Array.isArray(baseValue)) {
|
|
20
|
+
result[key] = { ...baseValue, ...overrideValue };
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// For primitives and arrays, override value wins
|
|
24
|
+
result[key] = overrideValue;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
export class SettingsManager {
|
|
30
|
+
constructor(settingsPath, projectSettingsPath, initialSettings, persist) {
|
|
31
|
+
this.settingsPath = settingsPath;
|
|
32
|
+
this.projectSettingsPath = projectSettingsPath;
|
|
33
|
+
this.persist = persist;
|
|
34
|
+
this.globalSettings = initialSettings;
|
|
35
|
+
this.inMemoryProjectSettings = {};
|
|
36
|
+
const projectSettings = this.loadProjectSettings();
|
|
37
|
+
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
38
|
+
}
|
|
39
|
+
/** Create a SettingsManager that loads from files */
|
|
40
|
+
static create(cwd = process.cwd(), agentDir = getAgentDir()) {
|
|
41
|
+
const settingsPath = join(agentDir, "settings.json");
|
|
42
|
+
const projectSettingsPath = join(cwd, CONFIG_DIR_NAME, "settings.json");
|
|
43
|
+
const globalSettings = SettingsManager.loadFromFile(settingsPath);
|
|
44
|
+
return new SettingsManager(settingsPath, projectSettingsPath, globalSettings, true);
|
|
45
|
+
}
|
|
46
|
+
/** Create an in-memory SettingsManager (no file I/O) */
|
|
47
|
+
static inMemory(settings = {}) {
|
|
48
|
+
return new SettingsManager(null, null, settings, false);
|
|
49
|
+
}
|
|
50
|
+
static loadFromFile(path) {
|
|
51
|
+
if (!existsSync(path)) {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const content = readFileSync(path, "utf-8");
|
|
56
|
+
const settings = JSON.parse(content);
|
|
57
|
+
return SettingsManager.migrateSettings(settings);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error(`Warning: Could not read settings file ${path}: ${error}`);
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Migrate old settings format to new format */
|
|
65
|
+
static migrateSettings(settings) {
|
|
66
|
+
// Migrate queueMode -> steeringMode
|
|
67
|
+
if ("queueMode" in settings && !("steeringMode" in settings)) {
|
|
68
|
+
settings.steeringMode = settings.queueMode;
|
|
69
|
+
delete settings.queueMode;
|
|
70
|
+
}
|
|
71
|
+
// Migrate old skills object format to new array format
|
|
72
|
+
if ("skills" in settings &&
|
|
73
|
+
typeof settings.skills === "object" &&
|
|
74
|
+
settings.skills !== null &&
|
|
75
|
+
!Array.isArray(settings.skills)) {
|
|
76
|
+
const skillsSettings = settings.skills;
|
|
77
|
+
if (skillsSettings.enableSkillCommands !== undefined && settings.enableSkillCommands === undefined) {
|
|
78
|
+
settings.enableSkillCommands = skillsSettings.enableSkillCommands;
|
|
79
|
+
}
|
|
80
|
+
if (Array.isArray(skillsSettings.customDirectories) && skillsSettings.customDirectories.length > 0) {
|
|
81
|
+
settings.skills = skillsSettings.customDirectories;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
delete settings.skills;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return settings;
|
|
88
|
+
}
|
|
89
|
+
loadProjectSettings() {
|
|
90
|
+
// In-memory mode: return stored in-memory project settings
|
|
91
|
+
if (!this.persist) {
|
|
92
|
+
return structuredClone(this.inMemoryProjectSettings);
|
|
93
|
+
}
|
|
94
|
+
if (!this.projectSettingsPath || !existsSync(this.projectSettingsPath)) {
|
|
95
|
+
return {};
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const content = readFileSync(this.projectSettingsPath, "utf-8");
|
|
99
|
+
const settings = JSON.parse(content);
|
|
100
|
+
return SettingsManager.migrateSettings(settings);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
console.error(`Warning: Could not read project settings file: ${error}`);
|
|
104
|
+
return {};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
getGlobalSettings() {
|
|
108
|
+
return structuredClone(this.globalSettings);
|
|
109
|
+
}
|
|
110
|
+
getProjectSettings() {
|
|
111
|
+
return this.loadProjectSettings();
|
|
112
|
+
}
|
|
113
|
+
/** Apply additional overrides on top of current settings */
|
|
114
|
+
applyOverrides(overrides) {
|
|
115
|
+
this.settings = deepMergeSettings(this.settings, overrides);
|
|
116
|
+
}
|
|
117
|
+
save() {
|
|
118
|
+
if (this.persist && this.settingsPath) {
|
|
119
|
+
try {
|
|
120
|
+
const dir = dirname(this.settingsPath);
|
|
121
|
+
if (!existsSync(dir)) {
|
|
122
|
+
mkdirSync(dir, { recursive: true });
|
|
123
|
+
}
|
|
124
|
+
// Re-read current file to preserve any settings added externally while running
|
|
125
|
+
const currentFileSettings = SettingsManager.loadFromFile(this.settingsPath);
|
|
126
|
+
// Merge: file settings as base, globalSettings (in-memory changes) as overrides
|
|
127
|
+
const mergedSettings = deepMergeSettings(currentFileSettings, this.globalSettings);
|
|
128
|
+
this.globalSettings = mergedSettings;
|
|
129
|
+
// Save merged settings (project settings are read-only)
|
|
130
|
+
writeFileSync(this.settingsPath, JSON.stringify(this.globalSettings, null, 2), "utf-8");
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error(`Warning: Could not save settings file: ${error}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Always re-merge to update active settings (needed for both file and inMemory modes)
|
|
137
|
+
const projectSettings = this.loadProjectSettings();
|
|
138
|
+
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
139
|
+
}
|
|
140
|
+
saveProjectSettings(settings) {
|
|
141
|
+
// In-memory mode: store in memory
|
|
142
|
+
if (!this.persist) {
|
|
143
|
+
this.inMemoryProjectSettings = structuredClone(settings);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (!this.projectSettingsPath) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const dir = dirname(this.projectSettingsPath);
|
|
151
|
+
if (!existsSync(dir)) {
|
|
152
|
+
mkdirSync(dir, { recursive: true });
|
|
153
|
+
}
|
|
154
|
+
writeFileSync(this.projectSettingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
console.error(`Warning: Could not save project settings file: ${error}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
getLastChangelogVersion() {
|
|
161
|
+
return this.settings.lastChangelogVersion;
|
|
162
|
+
}
|
|
163
|
+
setLastChangelogVersion(version) {
|
|
164
|
+
this.globalSettings.lastChangelogVersion = version;
|
|
165
|
+
this.save();
|
|
166
|
+
}
|
|
167
|
+
getDefaultProvider() {
|
|
168
|
+
return this.settings.defaultProvider;
|
|
169
|
+
}
|
|
170
|
+
getDefaultModel() {
|
|
171
|
+
return this.settings.defaultModel;
|
|
172
|
+
}
|
|
173
|
+
setDefaultProvider(provider) {
|
|
174
|
+
this.globalSettings.defaultProvider = provider;
|
|
175
|
+
this.save();
|
|
176
|
+
}
|
|
177
|
+
setDefaultModel(modelId) {
|
|
178
|
+
this.globalSettings.defaultModel = modelId;
|
|
179
|
+
this.save();
|
|
180
|
+
}
|
|
181
|
+
setDefaultModelAndProvider(provider, modelId) {
|
|
182
|
+
this.globalSettings.defaultProvider = provider;
|
|
183
|
+
this.globalSettings.defaultModel = modelId;
|
|
184
|
+
this.save();
|
|
185
|
+
}
|
|
186
|
+
getSteeringMode() {
|
|
187
|
+
return this.settings.steeringMode || "one-at-a-time";
|
|
188
|
+
}
|
|
189
|
+
setSteeringMode(mode) {
|
|
190
|
+
this.globalSettings.steeringMode = mode;
|
|
191
|
+
this.save();
|
|
192
|
+
}
|
|
193
|
+
getFollowUpMode() {
|
|
194
|
+
return this.settings.followUpMode || "one-at-a-time";
|
|
195
|
+
}
|
|
196
|
+
setFollowUpMode(mode) {
|
|
197
|
+
this.globalSettings.followUpMode = mode;
|
|
198
|
+
this.save();
|
|
199
|
+
}
|
|
200
|
+
getTheme() {
|
|
201
|
+
return this.settings.theme;
|
|
202
|
+
}
|
|
203
|
+
setTheme(theme) {
|
|
204
|
+
this.globalSettings.theme = theme;
|
|
205
|
+
this.save();
|
|
206
|
+
}
|
|
207
|
+
getDefaultThinkingLevel() {
|
|
208
|
+
return this.settings.defaultThinkingLevel;
|
|
209
|
+
}
|
|
210
|
+
setDefaultThinkingLevel(level) {
|
|
211
|
+
this.globalSettings.defaultThinkingLevel = level;
|
|
212
|
+
this.save();
|
|
213
|
+
}
|
|
214
|
+
getCompactionEnabled() {
|
|
215
|
+
return this.settings.compaction?.enabled ?? true;
|
|
216
|
+
}
|
|
217
|
+
setCompactionEnabled(enabled) {
|
|
218
|
+
if (!this.globalSettings.compaction) {
|
|
219
|
+
this.globalSettings.compaction = {};
|
|
220
|
+
}
|
|
221
|
+
this.globalSettings.compaction.enabled = enabled;
|
|
222
|
+
this.save();
|
|
223
|
+
}
|
|
224
|
+
getCompactionReserveTokens() {
|
|
225
|
+
return this.settings.compaction?.reserveTokens ?? 16384;
|
|
226
|
+
}
|
|
227
|
+
getCompactionKeepRecentTokens() {
|
|
228
|
+
return this.settings.compaction?.keepRecentTokens ?? 20000;
|
|
229
|
+
}
|
|
230
|
+
getCompactionSettings() {
|
|
231
|
+
return {
|
|
232
|
+
enabled: this.getCompactionEnabled(),
|
|
233
|
+
reserveTokens: this.getCompactionReserveTokens(),
|
|
234
|
+
keepRecentTokens: this.getCompactionKeepRecentTokens(),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
getBranchSummarySettings() {
|
|
238
|
+
return {
|
|
239
|
+
reserveTokens: this.settings.branchSummary?.reserveTokens ?? 16384,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
getRetryEnabled() {
|
|
243
|
+
return this.settings.retry?.enabled ?? true;
|
|
244
|
+
}
|
|
245
|
+
setRetryEnabled(enabled) {
|
|
246
|
+
if (!this.globalSettings.retry) {
|
|
247
|
+
this.globalSettings.retry = {};
|
|
248
|
+
}
|
|
249
|
+
this.globalSettings.retry.enabled = enabled;
|
|
250
|
+
this.save();
|
|
251
|
+
}
|
|
252
|
+
getRetrySettings() {
|
|
253
|
+
return {
|
|
254
|
+
enabled: this.getRetryEnabled(),
|
|
255
|
+
maxRetries: this.settings.retry?.maxRetries ?? 3,
|
|
256
|
+
baseDelayMs: this.settings.retry?.baseDelayMs ?? 2000,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
getHideThinkingBlock() {
|
|
260
|
+
return this.settings.hideThinkingBlock ?? false;
|
|
261
|
+
}
|
|
262
|
+
setHideThinkingBlock(hide) {
|
|
263
|
+
this.globalSettings.hideThinkingBlock = hide;
|
|
264
|
+
this.save();
|
|
265
|
+
}
|
|
266
|
+
getShellPath() {
|
|
267
|
+
return this.settings.shellPath;
|
|
268
|
+
}
|
|
269
|
+
setShellPath(path) {
|
|
270
|
+
this.globalSettings.shellPath = path;
|
|
271
|
+
this.save();
|
|
272
|
+
}
|
|
273
|
+
getQuietStartup() {
|
|
274
|
+
return this.settings.quietStartup ?? false;
|
|
275
|
+
}
|
|
276
|
+
setQuietStartup(quiet) {
|
|
277
|
+
this.globalSettings.quietStartup = quiet;
|
|
278
|
+
this.save();
|
|
279
|
+
}
|
|
280
|
+
getShellCommandPrefix() {
|
|
281
|
+
return this.settings.shellCommandPrefix;
|
|
282
|
+
}
|
|
283
|
+
setShellCommandPrefix(prefix) {
|
|
284
|
+
this.globalSettings.shellCommandPrefix = prefix;
|
|
285
|
+
this.save();
|
|
286
|
+
}
|
|
287
|
+
getCollapseChangelog() {
|
|
288
|
+
return this.settings.collapseChangelog ?? false;
|
|
289
|
+
}
|
|
290
|
+
setCollapseChangelog(collapse) {
|
|
291
|
+
this.globalSettings.collapseChangelog = collapse;
|
|
292
|
+
this.save();
|
|
293
|
+
}
|
|
294
|
+
getPackages() {
|
|
295
|
+
return [...(this.settings.packages ?? [])];
|
|
296
|
+
}
|
|
297
|
+
setPackages(packages) {
|
|
298
|
+
this.globalSettings.packages = packages;
|
|
299
|
+
this.save();
|
|
300
|
+
}
|
|
301
|
+
setProjectPackages(packages) {
|
|
302
|
+
const projectSettings = this.loadProjectSettings();
|
|
303
|
+
projectSettings.packages = packages;
|
|
304
|
+
this.saveProjectSettings(projectSettings);
|
|
305
|
+
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
306
|
+
}
|
|
307
|
+
getExtensionPaths() {
|
|
308
|
+
return [...(this.settings.extensions ?? [])];
|
|
309
|
+
}
|
|
310
|
+
setExtensionPaths(paths) {
|
|
311
|
+
this.globalSettings.extensions = paths;
|
|
312
|
+
this.save();
|
|
313
|
+
}
|
|
314
|
+
setProjectExtensionPaths(paths) {
|
|
315
|
+
const projectSettings = this.loadProjectSettings();
|
|
316
|
+
projectSettings.extensions = paths;
|
|
317
|
+
this.saveProjectSettings(projectSettings);
|
|
318
|
+
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
319
|
+
}
|
|
320
|
+
getSkillPaths() {
|
|
321
|
+
return [...(this.settings.skills ?? [])];
|
|
322
|
+
}
|
|
323
|
+
setSkillPaths(paths) {
|
|
324
|
+
this.globalSettings.skills = paths;
|
|
325
|
+
this.save();
|
|
326
|
+
}
|
|
327
|
+
setProjectSkillPaths(paths) {
|
|
328
|
+
const projectSettings = this.loadProjectSettings();
|
|
329
|
+
projectSettings.skills = paths;
|
|
330
|
+
this.saveProjectSettings(projectSettings);
|
|
331
|
+
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
332
|
+
}
|
|
333
|
+
getPromptTemplatePaths() {
|
|
334
|
+
return [...(this.settings.prompts ?? [])];
|
|
335
|
+
}
|
|
336
|
+
setPromptTemplatePaths(paths) {
|
|
337
|
+
this.globalSettings.prompts = paths;
|
|
338
|
+
this.save();
|
|
339
|
+
}
|
|
340
|
+
setProjectPromptTemplatePaths(paths) {
|
|
341
|
+
const projectSettings = this.loadProjectSettings();
|
|
342
|
+
projectSettings.prompts = paths;
|
|
343
|
+
this.saveProjectSettings(projectSettings);
|
|
344
|
+
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
345
|
+
}
|
|
346
|
+
getThemePaths() {
|
|
347
|
+
return [...(this.settings.themes ?? [])];
|
|
348
|
+
}
|
|
349
|
+
setThemePaths(paths) {
|
|
350
|
+
this.globalSettings.themes = paths;
|
|
351
|
+
this.save();
|
|
352
|
+
}
|
|
353
|
+
setProjectThemePaths(paths) {
|
|
354
|
+
const projectSettings = this.loadProjectSettings();
|
|
355
|
+
projectSettings.themes = paths;
|
|
356
|
+
this.saveProjectSettings(projectSettings);
|
|
357
|
+
this.settings = deepMergeSettings(this.globalSettings, projectSettings);
|
|
358
|
+
}
|
|
359
|
+
getEnableSkillCommands() {
|
|
360
|
+
return this.settings.enableSkillCommands ?? true;
|
|
361
|
+
}
|
|
362
|
+
setEnableSkillCommands(enabled) {
|
|
363
|
+
this.globalSettings.enableSkillCommands = enabled;
|
|
364
|
+
this.save();
|
|
365
|
+
}
|
|
366
|
+
getThinkingBudgets() {
|
|
367
|
+
return this.settings.thinkingBudgets;
|
|
368
|
+
}
|
|
369
|
+
getShowImages() {
|
|
370
|
+
return this.settings.terminal?.showImages ?? true;
|
|
371
|
+
}
|
|
372
|
+
setShowImages(show) {
|
|
373
|
+
if (!this.globalSettings.terminal) {
|
|
374
|
+
this.globalSettings.terminal = {};
|
|
375
|
+
}
|
|
376
|
+
this.globalSettings.terminal.showImages = show;
|
|
377
|
+
this.save();
|
|
378
|
+
}
|
|
379
|
+
getImageAutoResize() {
|
|
380
|
+
return this.settings.images?.autoResize ?? true;
|
|
381
|
+
}
|
|
382
|
+
setImageAutoResize(enabled) {
|
|
383
|
+
if (!this.globalSettings.images) {
|
|
384
|
+
this.globalSettings.images = {};
|
|
385
|
+
}
|
|
386
|
+
this.globalSettings.images.autoResize = enabled;
|
|
387
|
+
this.save();
|
|
388
|
+
}
|
|
389
|
+
getBlockImages() {
|
|
390
|
+
return this.settings.images?.blockImages ?? false;
|
|
391
|
+
}
|
|
392
|
+
setBlockImages(blocked) {
|
|
393
|
+
if (!this.globalSettings.images) {
|
|
394
|
+
this.globalSettings.images = {};
|
|
395
|
+
}
|
|
396
|
+
this.globalSettings.images.blockImages = blocked;
|
|
397
|
+
this.save();
|
|
398
|
+
}
|
|
399
|
+
getEnabledModels() {
|
|
400
|
+
return this.settings.enabledModels;
|
|
401
|
+
}
|
|
402
|
+
setEnabledModels(patterns) {
|
|
403
|
+
this.globalSettings.enabledModels = patterns;
|
|
404
|
+
this.save();
|
|
405
|
+
}
|
|
406
|
+
getDoubleEscapeAction() {
|
|
407
|
+
return this.settings.doubleEscapeAction ?? "tree";
|
|
408
|
+
}
|
|
409
|
+
setDoubleEscapeAction(action) {
|
|
410
|
+
this.globalSettings.doubleEscapeAction = action;
|
|
411
|
+
this.save();
|
|
412
|
+
}
|
|
413
|
+
getShowHardwareCursor() {
|
|
414
|
+
return this.settings.showHardwareCursor ?? process.env.INDUSAGI_HARDWARE_CURSOR === "1";
|
|
415
|
+
}
|
|
416
|
+
setShowHardwareCursor(enabled) {
|
|
417
|
+
this.globalSettings.showHardwareCursor = enabled;
|
|
418
|
+
this.save();
|
|
419
|
+
}
|
|
420
|
+
getEditorPaddingX() {
|
|
421
|
+
return this.settings.editorPaddingX ?? 0;
|
|
422
|
+
}
|
|
423
|
+
setEditorPaddingX(padding) {
|
|
424
|
+
this.globalSettings.editorPaddingX = Math.max(0, Math.min(3, Math.floor(padding)));
|
|
425
|
+
this.save();
|
|
426
|
+
}
|
|
427
|
+
getCodeBlockIndent() {
|
|
428
|
+
return this.settings.markdown?.codeBlockIndent ?? " ";
|
|
429
|
+
}
|
|
430
|
+
}
|