@cjhyy/code-shell 0.1.0-alpha.3 → 0.1.6

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.
Files changed (157) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/dist/anthropic-IBTI4WL2.cjs +10 -0
  3. package/dist/anthropic-PRZZKHEZ.js +10 -0
  4. package/dist/arena/index.cjs +7 -6
  5. package/dist/arena/index.js +6 -5
  6. package/dist/arena/model-presets.d.ts +10 -1
  7. package/dist/{arena-ENHBHB2W.js → arena-2LTLIXOL.js} +9 -7
  8. package/dist/{arena-HHDYYVHJ.cjs → arena-ADB7DRFI.cjs} +25 -23
  9. package/dist/{chunk-EL2RL5DG.cjs → chunk-2YW4FPFG.cjs} +2 -2
  10. package/dist/chunk-3OA5G4TM.js +47 -0
  11. package/dist/{chunk-FPFTIKEJ.js → chunk-3QO25N6E.js} +131 -173
  12. package/dist/chunk-3SBSUOWZ.js +447 -0
  13. package/dist/chunk-52LGZKT3.cjs +47 -0
  14. package/dist/{chunk-KOGV6PDQ.cjs → chunk-55XGPMAP.cjs} +44 -9
  15. package/dist/{chunk-YD7XTI7T.cjs → chunk-6QVAYW7C.cjs} +116 -28
  16. package/dist/{chunk-SCDKLTN3.js → chunk-6S4BJ65N.js} +5 -4
  17. package/dist/{chunk-ZLPJJZUW.js → chunk-76HYEPDM.js} +2 -2
  18. package/dist/chunk-7BI3V74Y.cjs +447 -0
  19. package/dist/{chunk-GZBD6QRS.cjs → chunk-7EG3V4JY.cjs} +13 -12
  20. package/dist/{chunk-LMEKCQX4.js → chunk-7JVTYEEC.js} +6 -6
  21. package/dist/{chunk-SW3L7HIM.js → chunk-7QIM3BKD.js} +2 -2
  22. package/dist/{chunk-5C5HIOML.js → chunk-7Y6S3OCX.js} +109 -21
  23. package/dist/{chunk-REFCCVDM.js → chunk-ABRRONJ7.js} +2 -2
  24. package/dist/{chunk-F5BS3GUC.js → chunk-BSW22MPA.js} +39 -4
  25. package/dist/{chunk-ZRVPCXI7.js → chunk-BXCY2FSE.js} +2 -1
  26. package/dist/{chunk-Y7TSCDF6.js → chunk-BZ5TNE7L.js} +347 -6
  27. package/dist/{chunk-X2DNIMPC.cjs → chunk-DDB6QOKJ.cjs} +32 -32
  28. package/dist/{chunk-C7C7ZZY4.cjs → chunk-HEKQCI7B.cjs} +10 -10
  29. package/dist/{chunk-JHNCK7JP.cjs → chunk-IK4EWJBP.cjs} +4 -3
  30. package/dist/{chunk-3CAZIWUA.cjs → chunk-ILHE7XLT.cjs} +9 -9
  31. package/dist/{chunk-M2QI5X3X.cjs → chunk-JMR33QVF.cjs} +2 -2
  32. package/dist/{chunk-TDXBHD24.js → chunk-KAQHULYN.js} +2 -2
  33. package/dist/chunk-KE4EQOWA.js +294 -0
  34. package/dist/{chunk-YAFCN7ZW.cjs → chunk-KOVYSDHZ.cjs} +15 -15
  35. package/dist/{chunk-IJSHQGMP.cjs → chunk-KS3RYAYL.cjs} +4 -4
  36. package/dist/{chunk-DI7RDLOS.js → chunk-MD32R22I.js} +7 -4
  37. package/dist/chunk-MV7YI4WO.cjs +293 -0
  38. package/dist/chunk-MY5XHADU.cjs +216 -0
  39. package/dist/{chunk-OP57WUWQ.cjs → chunk-NUNC3VFB.cjs} +6 -6
  40. package/dist/{chunk-ID6EJUHP.js → chunk-PKGRTCCY.js} +1307 -212
  41. package/dist/{chunk-OUC2DFA7.js → chunk-QARL3IDQ.js} +3 -3
  42. package/dist/{chunk-VIPLU4RY.cjs → chunk-S754JHLR.cjs} +4 -4
  43. package/dist/{chunk-FUOKLKR2.js → chunk-SFXHZSRF.js} +1 -1
  44. package/dist/{chunk-2EUAE7AY.js → chunk-SIHHIQLO.js} +2 -2
  45. package/dist/{chunk-SK62UVS6.js → chunk-T6VYG46N.js} +1 -1
  46. package/dist/{chunk-JHXNOB5G.cjs → chunk-TNLGBJYS.cjs} +6 -6
  47. package/dist/{chunk-3QR52LL5.cjs → chunk-TUY2T5KP.cjs} +2 -2
  48. package/dist/{chunk-VWFET3MG.cjs → chunk-UXOCVJJ6.cjs} +1519 -424
  49. package/dist/{chunk-I57ZD5IQ.js → chunk-VIAGTYYW.js} +1 -1
  50. package/dist/chunk-WASS5YWB.js +215 -0
  51. package/dist/{chunk-HOXQLX5R.cjs → chunk-WZJV6DJC.cjs} +444 -103
  52. package/dist/{chunk-BUJ5KYCI.cjs → chunk-YIQBXAYU.cjs} +13 -13
  53. package/dist/{chunk-BF4LXLQV.cjs → chunk-YKIAELDZ.cjs} +132 -174
  54. package/dist/{chunk-M2SVOKC6.js → chunk-ZBPSQCPU.js} +6 -6
  55. package/dist/cli/commands/builtin/export-md.d.ts +19 -0
  56. package/dist/cli/commands/builtin/init/detect.d.ts +25 -0
  57. package/dist/cli/commands/builtin/init/index.d.ts +19 -0
  58. package/dist/cli/main.cjs +2372 -1453
  59. package/dist/cli/main.js +2502 -1583
  60. package/dist/cli/migrate-models.d.ts +45 -0
  61. package/dist/cli/onboarding.d.ts +110 -5
  62. package/dist/cli/updater.d.ts +59 -4
  63. package/dist/client-base-HTF236ZD.cjs +9 -0
  64. package/dist/client-base-QKRKCOWB.js +9 -0
  65. package/dist/{compaction-YNWCEF7B.js → compaction-6VU2T643.js} +4 -2
  66. package/dist/compaction-OKUNTCA7.cjs +33 -0
  67. package/dist/context/compaction.d.ts +35 -3
  68. package/dist/context/manager.d.ts +40 -3
  69. package/dist/context/tool-result-storage.d.ts +96 -0
  70. package/dist/devtools-T2NIZBJK.cjs +6 -0
  71. package/dist/{devtools-IRQQPIRY.js → devtools-YXWHOVKR.js} +1 -1
  72. package/dist/engine/engine.d.ts +47 -0
  73. package/dist/engine/turn-loop.d.ts +6 -0
  74. package/dist/export-md-RXDW6F5W.cjs +135 -0
  75. package/dist/export-md-XXKZANW5.js +135 -0
  76. package/dist/file-history-KYPE3ECT.cjs +7 -0
  77. package/dist/file-history-LF4F7X26.js +7 -0
  78. package/dist/index.cjs +42 -22
  79. package/dist/index.d.ts +5 -2
  80. package/dist/index.js +38 -18
  81. package/dist/llm/client-base.d.ts +1 -1
  82. package/dist/llm/model-cache.d.ts +21 -0
  83. package/dist/llm/model-fetcher.d.ts +29 -0
  84. package/dist/llm/model-pool.d.ts +13 -0
  85. package/dist/llm/provider-catalog.d.ts +30 -0
  86. package/dist/llm/provider-kinds.d.ts +21 -0
  87. package/dist/llm/types.d.ts +8 -0
  88. package/dist/logging/session-recorder.d.ts +77 -0
  89. package/dist/manager-D65VFAPX.js +7 -0
  90. package/dist/manager-TTF5VHJC.cjs +7 -0
  91. package/dist/mcp-manager-QMKWPBZ4.js +8 -0
  92. package/dist/mcp-manager-Z3OKI74O.cjs +8 -0
  93. package/dist/memory-5LWZ6FI2.cjs +9 -0
  94. package/dist/{memory-EPFDBPII.js → memory-VIJLBAMQ.js} +2 -2
  95. package/dist/model-cache-5KIYL5SL.js +13 -0
  96. package/dist/model-cache-OED3IM4R.cjs +13 -0
  97. package/dist/model-fetcher-HKGICACL.js +8 -0
  98. package/dist/model-fetcher-UR6WJOQP.cjs +8 -0
  99. package/dist/openai-JR2WEKOF.js +10 -0
  100. package/dist/openai-YBTOET4O.cjs +10 -0
  101. package/dist/{openrouter-models-2FM3H4SQ.js → openrouter-models-H56GHBHN.js} +2 -2
  102. package/dist/openrouter-models-TWUFWZ5T.cjs +15 -0
  103. package/dist/openrouter-sync-5VMGN6C2.cjs +11 -0
  104. package/dist/{openrouter-sync-SO3AWEAM.js → openrouter-sync-ALEMF5IU.js} +3 -3
  105. package/dist/product/index.cjs +17 -15
  106. package/dist/product/index.js +16 -14
  107. package/dist/protocol/server.d.ts +3 -1
  108. package/dist/protocol/types.d.ts +36 -2
  109. package/dist/run/index.cjs +17 -15
  110. package/dist/run/index.js +16 -14
  111. package/dist/services/index.d.ts +0 -1
  112. package/dist/session-manager-Q22BBMD3.js +8 -0
  113. package/dist/session-manager-XODQVL3C.cjs +8 -0
  114. package/dist/settings/schema.d.ts +267 -42
  115. package/dist/{tool-summary-RYNR4DDB.cjs → tool-summary-63DPIS7G.cjs} +4 -4
  116. package/dist/{tool-summary-2RUFL5QK.js → tool-summary-NP5CDBKG.js} +2 -2
  117. package/dist/tool-system/builtin/ask-user.d.ts +9 -1
  118. package/dist/tool-system/context.d.ts +31 -2
  119. package/dist/tool-system/executor.d.ts +4 -0
  120. package/dist/tool-system/investigation-guard.d.ts +46 -0
  121. package/dist/types.d.ts +13 -2
  122. package/dist/ui/components/AskUserPrompt.d.ts +8 -1
  123. package/dist/ui/components/DiffLine.d.ts +33 -0
  124. package/dist/ui/components/ModelManager.d.ts +34 -1
  125. package/dist/ui/components/OnboardingPrompt.d.ts +10 -1
  126. package/dist/ui/components/ProviderModelFlow.d.ts +58 -0
  127. package/dist/ui/components/UpdateBanner.d.ts +1 -0
  128. package/dist/updater-I7QBW4DP.cjs +17 -0
  129. package/dist/updater-NVME5S3Z.js +17 -0
  130. package/dist/utils/semver.d.ts +1 -0
  131. package/dist/utils/task-sanitizer.d.ts +6 -0
  132. package/package.json +2 -1
  133. package/skills-builtin/codeshell-help.md +135 -0
  134. package/dist/anthropic-P5VETAFI.cjs +0 -10
  135. package/dist/anthropic-W2GU3D76.js +0 -10
  136. package/dist/chunk-75E4BBFC.js +0 -224
  137. package/dist/chunk-FV2ARONZ.cjs +0 -224
  138. package/dist/client-base-TOVE25FA.js +0 -9
  139. package/dist/client-base-VDDIADAC.cjs +0 -9
  140. package/dist/compaction-D3KV2NWY.cjs +0 -31
  141. package/dist/devtools-WTC3NFNE.cjs +0 -6
  142. package/dist/file-history-HZWO2WQ5.js +0 -7
  143. package/dist/file-history-UQQILIY7.cjs +0 -7
  144. package/dist/manager-FWLOVEEK.cjs +0 -7
  145. package/dist/manager-GEXJLOIS.js +0 -7
  146. package/dist/mcp-manager-37GQLFGX.js +0 -8
  147. package/dist/mcp-manager-U77NEXBY.cjs +0 -8
  148. package/dist/memory-ADGOWADP.cjs +0 -9
  149. package/dist/openai-RXU5URYI.js +0 -10
  150. package/dist/openai-SQW4H2K4.cjs +0 -10
  151. package/dist/openrouter-models-PLCWZZYE.cjs +0 -15
  152. package/dist/openrouter-sync-K2WK3A2A.cjs +0 -11
  153. package/dist/services/compact.d.ts +0 -56
  154. package/dist/session-manager-HRSKENKB.cjs +0 -8
  155. package/dist/session-manager-NEKFEHF3.js +0 -8
  156. package/dist/updater-J7L7R6BY.cjs +0 -185
  157. package/dist/updater-LDBNYCAO.js +0 -185
@@ -1,224 +0,0 @@
1
- import {
2
- init_esm_shims
3
- } from "./chunk-DI7RDLOS.js";
4
-
5
- // src/settings/manager.ts
6
- init_esm_shims();
7
- import { readFileSync, existsSync, mkdirSync, writeFileSync, renameSync } from "fs";
8
- import { join, dirname } from "path";
9
- import { homedir } from "os";
10
-
11
- // src/settings/schema.ts
12
- init_esm_shims();
13
- import { z } from "zod";
14
- var SettingsSchema = z.object({
15
- agent: z.object({
16
- // Use z.string() instead of z.enum() to allow custom presets registered via registerPreset()
17
- preset: z.string().default("terminal-coding"),
18
- enabledBuiltinTools: z.array(z.string()).default([]),
19
- disabledBuiltinTools: z.array(z.string()).default([]),
20
- customSystemPrompt: z.string().optional(),
21
- appendSystemPrompt: z.string().optional()
22
- }).default({}),
23
- model: z.object({
24
- provider: z.string().default("openai"),
25
- name: z.string().default("anthropic/claude-opus-4-6"),
26
- apiKey: z.string().optional(),
27
- baseUrl: z.string().default("https://openrouter.ai/api/v1"),
28
- temperature: z.number().min(0).max(2).default(0.3),
29
- maxTokens: z.number().default(8192)
30
- }).default({}),
31
- models: z.array(
32
- z.object({
33
- key: z.string(),
34
- label: z.string().optional(),
35
- provider: z.string(),
36
- model: z.string(),
37
- baseUrl: z.string().optional(),
38
- apiKey: z.string().optional(),
39
- maxOutputTokens: z.number().optional(),
40
- maxContextTokens: z.number().optional()
41
- })
42
- ).default([]),
43
- permissions: z.object({
44
- defaultMode: z.enum(["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]).default("default"),
45
- rules: z.array(
46
- z.object({
47
- tool: z.string(),
48
- argsPattern: z.record(z.string()).optional(),
49
- decision: z.enum(["allow", "deny", "ask"]),
50
- reason: z.string().optional()
51
- })
52
- ).default([])
53
- }).default({}),
54
- context: z.object({
55
- maxTokens: z.number().default(2e5),
56
- compactAtRatio: z.number().default(0.6),
57
- summarizeAtRatio: z.number().default(0.8)
58
- }).default({}),
59
- session: z.object({
60
- storageDir: z.string().optional(),
61
- maxHistory: z.number().default(100)
62
- }).default({}),
63
- mcpServers: z.record(
64
- z.object({
65
- name: z.string(),
66
- command: z.string().optional(),
67
- args: z.array(z.string()).optional(),
68
- env: z.record(z.string()).optional(),
69
- url: z.string().optional(),
70
- transport: z.enum(["stdio", "sse", "streamable-http", "inprocess"]).optional(),
71
- headers: z.record(z.string()).optional()
72
- })
73
- ).default({}),
74
- instructions: z.object({
75
- fileName: z.string().default("CODESHELL.md"),
76
- scanDirs: z.array(z.string()).default([]),
77
- compatFileNames: z.array(z.string()).default(["CLAUDE.md", "AGENTS.md"]),
78
- ignoreGitBoundary: z.boolean().default(false)
79
- }).default({}),
80
- arena: z.object({
81
- participants: z.array(
82
- z.union([
83
- // Short form: just a model pool key
84
- z.string(),
85
- // Full form: explicit config (backward compat)
86
- z.object({
87
- name: z.string(),
88
- model: z.string(),
89
- provider: z.string().optional(),
90
- apiKey: z.string().optional(),
91
- baseUrl: z.string().optional()
92
- })
93
- ])
94
- ).default([])
95
- }).default({}),
96
- search: z.object({
97
- provider: z.enum(["serper", "tavily", "searxng"]).default("serper"),
98
- apiKey: z.string().optional(),
99
- baseUrl: z.string().optional()
100
- }).default({}),
101
- output: z.object({
102
- format: z.enum(["text", "json", "jsonl", "stream-json"]).default("text")
103
- }).default({})
104
- }).passthrough();
105
- function validateSettings(raw) {
106
- return SettingsSchema.parse(raw);
107
- }
108
-
109
- // src/settings/manager.ts
110
- var SettingsManager = class {
111
- constructor(cwd = process.cwd()) {
112
- this.cwd = cwd;
113
- }
114
- sources = [];
115
- merged = null;
116
- /**
117
- * Load settings from all sources.
118
- */
119
- load(flagOverrides) {
120
- this.sources = [];
121
- this.loadJsonFile(join(homedir(), ".code-shell", "settings.managed.json"), "managed", 0);
122
- this.loadJsonFile(join(homedir(), ".code-shell", "settings.json"), "user", 1);
123
- this.loadJsonFile(join(homedir(), ".claude", "settings.json"), "user", 1);
124
- this.loadJsonFile(join(this.cwd, ".code-shell", "settings.json"), "project", 2);
125
- this.loadJsonFile(join(this.cwd, ".claude", "settings.json"), "project", 2);
126
- this.loadJsonFile(join(this.cwd, ".code-shell", "settings.local.json"), "local", 3);
127
- this.loadJsonFile(join(this.cwd, ".claude", "settings.local.json"), "local", 3);
128
- if (flagOverrides && Object.keys(flagOverrides).length > 0) {
129
- this.sources.push({ name: "flag", priority: 4, data: flagOverrides });
130
- }
131
- this.sources.sort((a, b) => a.priority - b.priority);
132
- const raw = this.deepMerge();
133
- this.merged = validateSettings(raw);
134
- return this.merged;
135
- }
136
- /**
137
- * Get current effective settings.
138
- */
139
- get() {
140
- if (!this.merged) return this.load();
141
- return this.merged;
142
- }
143
- /**
144
- * Invalidate cached merge.
145
- */
146
- invalidate() {
147
- this.merged = null;
148
- }
149
- /**
150
- * Persist a single setting (dotted key path) to the user-level config file
151
- * at ~/.code-shell/settings.json. Other sources (project / local /
152
- * managed) are intentionally untouched: writing back to project/local
153
- * would surprise version control, and managed is read-only.
154
- *
155
- * The merged cache is invalidated so the next get() picks up the change.
156
- */
157
- saveUserSetting(key, value) {
158
- const path = join(homedir(), ".code-shell", "settings.json");
159
- let current = {};
160
- if (existsSync(path)) {
161
- try {
162
- const raw = readFileSync(path, "utf-8");
163
- const parsed = JSON.parse(raw);
164
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
165
- current = parsed;
166
- }
167
- } catch {
168
- }
169
- }
170
- const parts = key.split(".");
171
- let target = current;
172
- for (let i = 0; i < parts.length - 1; i++) {
173
- const seg = parts[i];
174
- const next = target[seg];
175
- if (!next || typeof next !== "object" || Array.isArray(next)) {
176
- target[seg] = {};
177
- }
178
- target = target[seg];
179
- }
180
- target[parts[parts.length - 1]] = value;
181
- mkdirSync(dirname(path), { recursive: true });
182
- const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
183
- writeFileSync(tmp, JSON.stringify(current, null, 2), "utf-8");
184
- renameSync(tmp, path);
185
- this.invalidate();
186
- }
187
- loadJsonFile(path, name, priority) {
188
- if (!existsSync(path)) return;
189
- try {
190
- const content = readFileSync(path, "utf-8");
191
- const data = JSON.parse(content);
192
- if (typeof data === "object" && data !== null) {
193
- this.sources.push({ name, priority, data });
194
- }
195
- } catch {
196
- }
197
- }
198
- deepMerge() {
199
- let result = {};
200
- for (const source of this.sources) {
201
- result = merge(result, source.data);
202
- }
203
- return result;
204
- }
205
- };
206
- function merge(base, override) {
207
- const result = { ...base };
208
- for (const [key, value] of Object.entries(override)) {
209
- if (value === null) {
210
- delete result[key];
211
- } else if (typeof value === "object" && !Array.isArray(value) && typeof result[key] === "object" && !Array.isArray(result[key]) && result[key] !== null) {
212
- result[key] = merge(result[key], value);
213
- } else {
214
- result[key] = value;
215
- }
216
- }
217
- return result;
218
- }
219
-
220
- export {
221
- SettingsSchema,
222
- validateSettings,
223
- SettingsManager
224
- };
@@ -1,224 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
-
3
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
4
-
5
- // src/settings/manager.ts
6
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
7
- var _fs = require('fs');
8
- var _path = require('path');
9
- var _os = require('os');
10
-
11
- // src/settings/schema.ts
12
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
13
- var _zod = require('zod');
14
- var SettingsSchema = _zod.z.object({
15
- agent: _zod.z.object({
16
- // Use z.string() instead of z.enum() to allow custom presets registered via registerPreset()
17
- preset: _zod.z.string().default("terminal-coding"),
18
- enabledBuiltinTools: _zod.z.array(_zod.z.string()).default([]),
19
- disabledBuiltinTools: _zod.z.array(_zod.z.string()).default([]),
20
- customSystemPrompt: _zod.z.string().optional(),
21
- appendSystemPrompt: _zod.z.string().optional()
22
- }).default({}),
23
- model: _zod.z.object({
24
- provider: _zod.z.string().default("openai"),
25
- name: _zod.z.string().default("anthropic/claude-opus-4-6"),
26
- apiKey: _zod.z.string().optional(),
27
- baseUrl: _zod.z.string().default("https://openrouter.ai/api/v1"),
28
- temperature: _zod.z.number().min(0).max(2).default(0.3),
29
- maxTokens: _zod.z.number().default(8192)
30
- }).default({}),
31
- models: _zod.z.array(
32
- _zod.z.object({
33
- key: _zod.z.string(),
34
- label: _zod.z.string().optional(),
35
- provider: _zod.z.string(),
36
- model: _zod.z.string(),
37
- baseUrl: _zod.z.string().optional(),
38
- apiKey: _zod.z.string().optional(),
39
- maxOutputTokens: _zod.z.number().optional(),
40
- maxContextTokens: _zod.z.number().optional()
41
- })
42
- ).default([]),
43
- permissions: _zod.z.object({
44
- defaultMode: _zod.z.enum(["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]).default("default"),
45
- rules: _zod.z.array(
46
- _zod.z.object({
47
- tool: _zod.z.string(),
48
- argsPattern: _zod.z.record(_zod.z.string()).optional(),
49
- decision: _zod.z.enum(["allow", "deny", "ask"]),
50
- reason: _zod.z.string().optional()
51
- })
52
- ).default([])
53
- }).default({}),
54
- context: _zod.z.object({
55
- maxTokens: _zod.z.number().default(2e5),
56
- compactAtRatio: _zod.z.number().default(0.6),
57
- summarizeAtRatio: _zod.z.number().default(0.8)
58
- }).default({}),
59
- session: _zod.z.object({
60
- storageDir: _zod.z.string().optional(),
61
- maxHistory: _zod.z.number().default(100)
62
- }).default({}),
63
- mcpServers: _zod.z.record(
64
- _zod.z.object({
65
- name: _zod.z.string(),
66
- command: _zod.z.string().optional(),
67
- args: _zod.z.array(_zod.z.string()).optional(),
68
- env: _zod.z.record(_zod.z.string()).optional(),
69
- url: _zod.z.string().optional(),
70
- transport: _zod.z.enum(["stdio", "sse", "streamable-http", "inprocess"]).optional(),
71
- headers: _zod.z.record(_zod.z.string()).optional()
72
- })
73
- ).default({}),
74
- instructions: _zod.z.object({
75
- fileName: _zod.z.string().default("CODESHELL.md"),
76
- scanDirs: _zod.z.array(_zod.z.string()).default([]),
77
- compatFileNames: _zod.z.array(_zod.z.string()).default(["CLAUDE.md", "AGENTS.md"]),
78
- ignoreGitBoundary: _zod.z.boolean().default(false)
79
- }).default({}),
80
- arena: _zod.z.object({
81
- participants: _zod.z.array(
82
- _zod.z.union([
83
- // Short form: just a model pool key
84
- _zod.z.string(),
85
- // Full form: explicit config (backward compat)
86
- _zod.z.object({
87
- name: _zod.z.string(),
88
- model: _zod.z.string(),
89
- provider: _zod.z.string().optional(),
90
- apiKey: _zod.z.string().optional(),
91
- baseUrl: _zod.z.string().optional()
92
- })
93
- ])
94
- ).default([])
95
- }).default({}),
96
- search: _zod.z.object({
97
- provider: _zod.z.enum(["serper", "tavily", "searxng"]).default("serper"),
98
- apiKey: _zod.z.string().optional(),
99
- baseUrl: _zod.z.string().optional()
100
- }).default({}),
101
- output: _zod.z.object({
102
- format: _zod.z.enum(["text", "json", "jsonl", "stream-json"]).default("text")
103
- }).default({})
104
- }).passthrough();
105
- function validateSettings(raw) {
106
- return SettingsSchema.parse(raw);
107
- }
108
-
109
- // src/settings/manager.ts
110
- var SettingsManager = (_class = class {
111
- constructor(cwd = process.cwd()) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
112
- this.cwd = cwd;
113
- }
114
- __init() {this.sources = []}
115
- __init2() {this.merged = null}
116
- /**
117
- * Load settings from all sources.
118
- */
119
- load(flagOverrides) {
120
- this.sources = [];
121
- this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.managed.json"), "managed", 0);
122
- this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.json"), "user", 1);
123
- this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".claude", "settings.json"), "user", 1);
124
- this.loadJsonFile(_path.join.call(void 0, this.cwd, ".code-shell", "settings.json"), "project", 2);
125
- this.loadJsonFile(_path.join.call(void 0, this.cwd, ".claude", "settings.json"), "project", 2);
126
- this.loadJsonFile(_path.join.call(void 0, this.cwd, ".code-shell", "settings.local.json"), "local", 3);
127
- this.loadJsonFile(_path.join.call(void 0, this.cwd, ".claude", "settings.local.json"), "local", 3);
128
- if (flagOverrides && Object.keys(flagOverrides).length > 0) {
129
- this.sources.push({ name: "flag", priority: 4, data: flagOverrides });
130
- }
131
- this.sources.sort((a, b) => a.priority - b.priority);
132
- const raw = this.deepMerge();
133
- this.merged = validateSettings(raw);
134
- return this.merged;
135
- }
136
- /**
137
- * Get current effective settings.
138
- */
139
- get() {
140
- if (!this.merged) return this.load();
141
- return this.merged;
142
- }
143
- /**
144
- * Invalidate cached merge.
145
- */
146
- invalidate() {
147
- this.merged = null;
148
- }
149
- /**
150
- * Persist a single setting (dotted key path) to the user-level config file
151
- * at ~/.code-shell/settings.json. Other sources (project / local /
152
- * managed) are intentionally untouched: writing back to project/local
153
- * would surprise version control, and managed is read-only.
154
- *
155
- * The merged cache is invalidated so the next get() picks up the change.
156
- */
157
- saveUserSetting(key, value) {
158
- const path = _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.json");
159
- let current = {};
160
- if (_fs.existsSync.call(void 0, path)) {
161
- try {
162
- const raw = _fs.readFileSync.call(void 0, path, "utf-8");
163
- const parsed = JSON.parse(raw);
164
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
165
- current = parsed;
166
- }
167
- } catch (e) {
168
- }
169
- }
170
- const parts = key.split(".");
171
- let target = current;
172
- for (let i = 0; i < parts.length - 1; i++) {
173
- const seg = parts[i];
174
- const next = target[seg];
175
- if (!next || typeof next !== "object" || Array.isArray(next)) {
176
- target[seg] = {};
177
- }
178
- target = target[seg];
179
- }
180
- target[parts[parts.length - 1]] = value;
181
- _fs.mkdirSync.call(void 0, _path.dirname.call(void 0, path), { recursive: true });
182
- const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
183
- _fs.writeFileSync.call(void 0, tmp, JSON.stringify(current, null, 2), "utf-8");
184
- _fs.renameSync.call(void 0, tmp, path);
185
- this.invalidate();
186
- }
187
- loadJsonFile(path, name, priority) {
188
- if (!_fs.existsSync.call(void 0, path)) return;
189
- try {
190
- const content = _fs.readFileSync.call(void 0, path, "utf-8");
191
- const data = JSON.parse(content);
192
- if (typeof data === "object" && data !== null) {
193
- this.sources.push({ name, priority, data });
194
- }
195
- } catch (e2) {
196
- }
197
- }
198
- deepMerge() {
199
- let result = {};
200
- for (const source of this.sources) {
201
- result = merge(result, source.data);
202
- }
203
- return result;
204
- }
205
- }, _class);
206
- function merge(base, override) {
207
- const result = { ...base };
208
- for (const [key, value] of Object.entries(override)) {
209
- if (value === null) {
210
- delete result[key];
211
- } else if (typeof value === "object" && !Array.isArray(value) && typeof result[key] === "object" && !Array.isArray(result[key]) && result[key] !== null) {
212
- result[key] = merge(result[key], value);
213
- } else {
214
- result[key] = value;
215
- }
216
- }
217
- return result;
218
- }
219
-
220
-
221
-
222
-
223
-
224
- exports.SettingsSchema = SettingsSchema; exports.validateSettings = validateSettings; exports.SettingsManager = SettingsManager;
@@ -1,9 +0,0 @@
1
- import {
2
- LLMClientBase
3
- } from "./chunk-SCDKLTN3.js";
4
- import "./chunk-FUOKLKR2.js";
5
- import "./chunk-ZRVPCXI7.js";
6
- import "./chunk-DI7RDLOS.js";
7
- export {
8
- LLMClientBase
9
- };
@@ -1,9 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkGZBD6QRScjs = require('./chunk-GZBD6QRS.cjs');
4
- require('./chunk-EL2RL5DG.cjs');
5
- require('./chunk-JHNCK7JP.cjs');
6
- require('./chunk-IJSHQGMP.cjs');
7
-
8
-
9
- exports.LLMClientBase = _chunkGZBD6QRScjs.LLMClientBase;
@@ -1,31 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
- var _chunkYD7XTI7Tcjs = require('./chunk-YD7XTI7T.cjs');
16
- require('./chunk-IJSHQGMP.cjs');
17
- _chunkYD7XTI7Tcjs.init_compaction.call(void 0, );
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
- exports.adjustIndexToPreserveAPIInvariants = _chunkYD7XTI7Tcjs.adjustIndexToPreserveAPIInvariants; exports.applySummaryCompaction = _chunkYD7XTI7Tcjs.applySummaryCompaction; exports.applyToolResultBudget = _chunkYD7XTI7Tcjs.applyToolResultBudget; exports.buildSummarizationPrompt = _chunkYD7XTI7Tcjs.buildSummarizationPrompt; exports.dropOldestRounds = _chunkYD7XTI7Tcjs.dropOldestRounds; exports.estimateTokens = _chunkYD7XTI7Tcjs.estimateTokens; exports.extractReferencedFilePaths = _chunkYD7XTI7Tcjs.extractReferencedFilePaths; exports.groupMessagesByApiRound = _chunkYD7XTI7Tcjs.groupMessagesByApiRound; exports.microcompact = _chunkYD7XTI7Tcjs.microcompact; exports.snipCompact = _chunkYD7XTI7Tcjs.snipCompact; exports.truncateToolResult = _chunkYD7XTI7Tcjs.truncateToolResult; exports.windowCompact = _chunkYD7XTI7Tcjs.windowCompact;
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
4
-
5
- // src/render/devtools.ts
6
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
@@ -1,7 +0,0 @@
1
- import {
2
- FileHistory
3
- } from "./chunk-SK62UVS6.js";
4
- import "./chunk-DI7RDLOS.js";
5
- export {
6
- FileHistory
7
- };
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk3QR52LL5cjs = require('./chunk-3QR52LL5.cjs');
4
- require('./chunk-IJSHQGMP.cjs');
5
-
6
-
7
- exports.FileHistory = _chunk3QR52LL5cjs.FileHistory;
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkFV2ARONZcjs = require('./chunk-FV2ARONZ.cjs');
4
- require('./chunk-IJSHQGMP.cjs');
5
-
6
-
7
- exports.SettingsManager = _chunkFV2ARONZcjs.SettingsManager;
@@ -1,7 +0,0 @@
1
- import {
2
- SettingsManager
3
- } from "./chunk-75E4BBFC.js";
4
- import "./chunk-DI7RDLOS.js";
5
- export {
6
- SettingsManager
7
- };
@@ -1,8 +0,0 @@
1
- import {
2
- MCPManager
3
- } from "./chunk-2EUAE7AY.js";
4
- import "./chunk-ZRVPCXI7.js";
5
- import "./chunk-DI7RDLOS.js";
6
- export {
7
- MCPManager
8
- };
@@ -1,8 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkC7C7ZZY4cjs = require('./chunk-C7C7ZZY4.cjs');
4
- require('./chunk-JHNCK7JP.cjs');
5
- require('./chunk-IJSHQGMP.cjs');
6
-
7
-
8
- exports.MCPManager = _chunkC7C7ZZY4cjs.MCPManager;
@@ -1,9 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkM2QI5X3Xcjs = require('./chunk-M2QI5X3X.cjs');
5
- require('./chunk-IJSHQGMP.cjs');
6
-
7
-
8
-
9
- exports.MemoryManager = _chunkM2QI5X3Xcjs.MemoryManager; exports.resolveMemoryBaseDir = _chunkM2QI5X3Xcjs.resolveMemoryBaseDir;
@@ -1,10 +0,0 @@
1
- import {
2
- OpenAIClient
3
- } from "./chunk-LMEKCQX4.js";
4
- import "./chunk-SCDKLTN3.js";
5
- import "./chunk-FUOKLKR2.js";
6
- import "./chunk-ZRVPCXI7.js";
7
- import "./chunk-DI7RDLOS.js";
8
- export {
9
- OpenAIClient
10
- };
@@ -1,10 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkYAFCN7ZWcjs = require('./chunk-YAFCN7ZW.cjs');
4
- require('./chunk-GZBD6QRS.cjs');
5
- require('./chunk-EL2RL5DG.cjs');
6
- require('./chunk-JHNCK7JP.cjs');
7
- require('./chunk-IJSHQGMP.cjs');
8
-
9
-
10
- exports.OpenAIClient = _chunkYAFCN7ZWcjs.OpenAIClient;
@@ -1,15 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
- var _chunkBF4LXLQVcjs = require('./chunk-BF4LXLQV.cjs');
8
- require('./chunk-IJSHQGMP.cjs');
9
-
10
-
11
-
12
-
13
-
14
-
15
- exports.findOpenRouterModel = _chunkBF4LXLQVcjs.findOpenRouterModel; exports.getOpenRouterModels = _chunkBF4LXLQVcjs.getOpenRouterModels; exports.getOpenRouterSnapshot = _chunkBF4LXLQVcjs.getOpenRouterSnapshot; exports.listOpenRouterModelsByVendor = _chunkBF4LXLQVcjs.listOpenRouterModelsByVendor; exports.setOpenRouterSnapshot = _chunkBF4LXLQVcjs.setOpenRouterSnapshot;
@@ -1,11 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkVIPLU4RYcjs = require('./chunk-VIPLU4RY.cjs');
4
-
5
-
6
- var _chunkBF4LXLQVcjs = require('./chunk-BF4LXLQV.cjs');
7
- require('./chunk-IJSHQGMP.cjs');
8
-
9
-
10
-
11
- exports.getOpenRouterSnapshot = _chunkBF4LXLQVcjs.getOpenRouterSnapshot; exports.syncOpenRouterCatalog = _chunkVIPLU4RYcjs.syncOpenRouterCatalog;
@@ -1,56 +0,0 @@
1
- /**
2
- * Compaction service — context window management and auto-compaction.
3
- *
4
- * Provides microcompact (inline trimming), autocompact (threshold-based),
5
- * and full compaction (LLM-based summarization) strategies.
6
- */
7
- export interface CompactionConfig {
8
- /** Max context tokens before triggering auto-compaction */
9
- autoCompactThreshold: number;
10
- /** Percentage of context to retain after compaction (0-1) */
11
- retentionRatio: number;
12
- /** Whether to preserve system messages during compaction */
13
- preserveSystemMessages: boolean;
14
- /** Whether auto-compaction is enabled */
15
- autoCompactEnabled: boolean;
16
- }
17
- export interface CompactionResult {
18
- /** Summary text that replaces the compacted content */
19
- summary: string;
20
- /** Number of messages removed */
21
- messagesRemoved: number;
22
- /** Tokens freed */
23
- tokensFreed: number;
24
- /** Strategy used */
25
- strategy: "micro" | "auto" | "full";
26
- }
27
- export interface Message {
28
- role: string;
29
- content: string | unknown[];
30
- tokenEstimate?: number;
31
- }
32
- /**
33
- * Micro-compaction: trim tool results and long messages inline.
34
- */
35
- export declare function microCompact(messages: Message[], maxTokensPerMessage?: number): Message[];
36
- /**
37
- * Check if auto-compaction should be triggered.
38
- */
39
- export declare function shouldAutoCompact(currentTokens: number, config?: CompactionConfig): boolean;
40
- /**
41
- * Build a compaction prompt for LLM-based summarization.
42
- */
43
- export declare function buildCompactionPrompt(messages: Message[], customInstructions?: string): string;
44
- /**
45
- * Apply compaction by removing old messages and inserting a summary.
46
- */
47
- export declare function applyCompaction(messages: Message[], summary: string, config?: CompactionConfig): {
48
- messages: Message[];
49
- result: CompactionResult;
50
- };
51
- export declare const compactionService: {
52
- microCompact: typeof microCompact;
53
- shouldAutoCompact: typeof shouldAutoCompact;
54
- buildCompactionPrompt: typeof buildCompactionPrompt;
55
- applyCompaction: typeof applyCompaction;
56
- };