@cjhyy/code-shell 0.1.0-alpha.2 → 0.1.5

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 +77 -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-HHDYYVHJ.cjs → arena-KBQOPLFV.cjs} +25 -23
  8. package/dist/{arena-ENHBHB2W.js → arena-O2L4TN6A.js} +9 -7
  9. package/dist/{chunk-SW3L7HIM.js → chunk-2EP3CLEN.js} +2 -2
  10. package/dist/{chunk-EL2RL5DG.cjs → chunk-2YW4FPFG.cjs} +2 -2
  11. package/dist/chunk-3OA5G4TM.js +47 -0
  12. package/dist/chunk-52LGZKT3.cjs +47 -0
  13. package/dist/{chunk-KOGV6PDQ.cjs → chunk-55XGPMAP.cjs} +44 -9
  14. package/dist/chunk-5ECBT4YA.js +450 -0
  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-FA5KD34T.js → chunk-76W334S4.js} +2 -2
  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-ID6EJUHP.js → chunk-7K6SDRRF.js} +1262 -212
  22. package/dist/{chunk-5C5HIOML.js → chunk-7Y6S3OCX.js} +109 -21
  23. package/dist/{chunk-G76E5FOB.cjs → chunk-A5LCRPDP.cjs} +4 -4
  24. package/dist/{chunk-F5BS3GUC.js → chunk-BSW22MPA.js} +39 -4
  25. package/dist/{chunk-VWFET3MG.cjs → chunk-BUU5PZK2.cjs} +1474 -423
  26. package/dist/{chunk-HOXQLX5R.cjs → chunk-BWTOS5BH.cjs} +444 -103
  27. package/dist/{chunk-ZRVPCXI7.js → chunk-BXCY2FSE.js} +2 -1
  28. package/dist/{chunk-Y7TSCDF6.js → chunk-C5YQBIRK.js} +347 -6
  29. package/dist/{chunk-C7C7ZZY4.cjs → chunk-HEKQCI7B.cjs} +10 -10
  30. package/dist/{chunk-JHXNOB5G.cjs → chunk-HS2MFNUC.cjs} +6 -6
  31. package/dist/{chunk-JHNCK7JP.cjs → chunk-IK4EWJBP.cjs} +4 -3
  32. package/dist/{chunk-M2QI5X3X.cjs → chunk-JMR33QVF.cjs} +2 -2
  33. package/dist/{chunk-YAFCN7ZW.cjs → chunk-KOVYSDHZ.cjs} +15 -15
  34. package/dist/{chunk-IJSHQGMP.cjs → chunk-KS3RYAYL.cjs} +4 -4
  35. package/dist/{chunk-DI7RDLOS.js → chunk-MD32R22I.js} +7 -4
  36. package/dist/chunk-MY5XHADU.cjs +216 -0
  37. package/dist/{chunk-OP57WUWQ.cjs → chunk-NUNC3VFB.cjs} +6 -6
  38. package/dist/{chunk-TATCTZSB.cjs → chunk-QRM7IF2S.cjs} +133 -175
  39. package/dist/chunk-R47ROHGL.cjs +298 -0
  40. package/dist/{chunk-OUC2DFA7.js → chunk-RMYKO74M.js} +3 -3
  41. package/dist/{chunk-FUOKLKR2.js → chunk-SFXHZSRF.js} +1 -1
  42. package/dist/{chunk-2EUAE7AY.js → chunk-SIHHIQLO.js} +2 -2
  43. package/dist/{chunk-3CAZIWUA.cjs → chunk-SNT563K3.cjs} +9 -9
  44. package/dist/{chunk-SK62UVS6.js → chunk-T6VYG46N.js} +1 -1
  45. package/dist/{chunk-3QR52LL5.cjs → chunk-TUY2T5KP.cjs} +2 -2
  46. package/dist/{chunk-I57ZD5IQ.js → chunk-VIAGTYYW.js} +1 -1
  47. package/dist/{chunk-X2DNIMPC.cjs → chunk-VYL4EFRC.cjs} +32 -32
  48. package/dist/chunk-W22P377T.js +299 -0
  49. package/dist/chunk-WASS5YWB.js +215 -0
  50. package/dist/{chunk-OMRGA6TI.js → chunk-XDIQWQJ4.js} +132 -174
  51. package/dist/{chunk-BUJ5KYCI.cjs → chunk-YIQBXAYU.cjs} +13 -13
  52. package/dist/{chunk-REFCCVDM.js → chunk-YJ77GQK5.js} +2 -2
  53. package/dist/chunk-YUI524OE.cjs +450 -0
  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 +2374 -1455
  59. package/dist/cli/main.js +2505 -1586
  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 +51 -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 +40 -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 +40 -20
  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-C2IUXKRC.js +7 -0
  90. package/dist/manager-YYKWYTRM.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-OU4GRZQY.cjs +15 -0
  102. package/dist/{openrouter-models-OL725CL6.js → openrouter-models-TGKDKY52.js} +2 -2
  103. package/dist/openrouter-sync-BBHUM3R6.cjs +11 -0
  104. package/dist/{openrouter-sync-CWD5VNW2.js → openrouter-sync-UXUSJCIR.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 +37 -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-QW473OF4.cjs +17 -0
  129. package/dist/updater-VFUAHCVY.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 +4 -2
  133. package/scripts/check-node.cjs +21 -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-UM3AOGZ4.cjs +0 -15
  152. package/dist/openrouter-sync-HYZZC6RX.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-M7L42ASZ.cjs +0 -183
  157. package/dist/updater-ZRTONIR4.js +0 -183
@@ -0,0 +1,298 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+ var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
6
+
7
+ // src/cli/updater.ts
8
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
9
+ var _child_process = require('child_process');
10
+ var _fs = require('fs');
11
+ var _promises = require('fs/promises');
12
+ var _module = require('module');
13
+ var _os = require('os');
14
+ var _path = require('path');
15
+
16
+ var _url = require('url');
17
+ var _util = require('util');
18
+
19
+ // src/utils/semver.ts
20
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
21
+ var _semver = require('semver');
22
+ function gt(a, b) {
23
+ return _semver.gt.call(void 0, a, b);
24
+ }
25
+
26
+ // src/cli/updater.ts
27
+ var execFileAsync = _util.promisify.call(void 0, _child_process.execFile);
28
+ var PACKAGE_NAME = "@cjhyy/code-shell";
29
+ var LOCK_FILE = ".update.lock";
30
+ var LOCK_TIMEOUT_MS = 5 * 60 * 1e3;
31
+ var NPM_VIEW_TIMEOUT_MS = 5e3;
32
+ var _updateInfo;
33
+ var _exitHookInstalled = false;
34
+ var _disabledReason = null;
35
+ function checkForUpdate(packageName = PACKAGE_NAME) {
36
+ void runCheck(packageName);
37
+ }
38
+ function getUpdateAvailable() {
39
+ return _updateInfo;
40
+ }
41
+ function getAutoUpdateDisabledReason() {
42
+ return _disabledReason;
43
+ }
44
+ function scheduleAutoInstallOnExit() {
45
+ if (_exitHookInstalled) return;
46
+ _exitHookInstalled = true;
47
+ const fire = () => {
48
+ const info = _updateInfo;
49
+ if (!info || !info.canAutoInstall) return;
50
+ try {
51
+ launchDetachedInstall(info.latestVersion);
52
+ } catch (e) {
53
+ }
54
+ };
55
+ process.once("exit", fire);
56
+ }
57
+ var _cachedVersion;
58
+ function getCurrentVersion() {
59
+ if (_cachedVersion) return _cachedVersion;
60
+ const found = resolveVersion();
61
+ _cachedVersion = found;
62
+ return found;
63
+ }
64
+ function resolveVersion() {
65
+ try {
66
+ const here = typeof import.meta !== "undefined" && _chunkKS3RYAYLcjs.importMetaUrl ? _path.dirname.call(void 0, _url.fileURLToPath.call(void 0, _chunkKS3RYAYLcjs.importMetaUrl)) : __dirname;
67
+ let dir = here;
68
+ for (let i = 0; i < 6; i++) {
69
+ try {
70
+ const pkg = JSON.parse(_fs.readFileSync.call(void 0, _path.resolve.call(void 0, dir, "package.json"), "utf-8"));
71
+ if (pkg && typeof pkg.version === "string") return pkg.version;
72
+ } catch (e2) {
73
+ }
74
+ const parent = _path.dirname.call(void 0, dir);
75
+ if (parent === dir) break;
76
+ dir = parent;
77
+ }
78
+ } catch (e3) {
79
+ }
80
+ try {
81
+ const req = _module.createRequire.call(void 0, _nullishCoalesce(_chunkKS3RYAYLcjs.importMetaUrl, () => ( __filename)));
82
+ const pkg = req("../../package.json");
83
+ if (_optionalChain([pkg, 'optionalAccess', _ => _.version])) return pkg.version;
84
+ } catch (e4) {
85
+ }
86
+ return "0.0.0";
87
+ }
88
+ async function runCheck(packageName) {
89
+ const disabled = isAutoUpdaterDisabled();
90
+ if (disabled) {
91
+ _disabledReason = disabled;
92
+ return;
93
+ }
94
+ _disabledReason = null;
95
+ try {
96
+ const currentVersion = getCurrentVersion();
97
+ const latestVersion = await getLatestVersion(packageName);
98
+ if (!latestVersion) return;
99
+ let isNewer = false;
100
+ try {
101
+ isNewer = gt(latestVersion, currentVersion);
102
+ } catch (e5) {
103
+ isNewer = latestVersion !== currentVersion;
104
+ }
105
+ if (!isNewer) {
106
+ _updateInfo = void 0;
107
+ return;
108
+ }
109
+ const { hasPermissions, npmPrefix } = await checkGlobalInstallPermissions();
110
+ _updateInfo = { latestVersion, canAutoInstall: hasPermissions, npmPrefix };
111
+ } catch (e6) {
112
+ }
113
+ }
114
+ async function getLatestVersion(packageName) {
115
+ try {
116
+ const { stdout } = await execFileAsync(
117
+ "npm",
118
+ ["view", `${packageName}@latest`, "version", "--prefer-online"],
119
+ { cwd: _os.homedir.call(void 0, ), timeout: NPM_VIEW_TIMEOUT_MS }
120
+ );
121
+ const v = stdout.trim();
122
+ return v.length > 0 ? v : null;
123
+ } catch (e7) {
124
+ return null;
125
+ }
126
+ }
127
+ async function checkGlobalInstallPermissions() {
128
+ let prefix = null;
129
+ try {
130
+ const { stdout } = await execFileAsync(
131
+ "npm",
132
+ ["-g", "config", "get", "prefix"],
133
+ { cwd: _os.homedir.call(void 0, ), timeout: 5e3 }
134
+ );
135
+ prefix = stdout.trim();
136
+ } catch (e8) {
137
+ return { hasPermissions: false, npmPrefix: null };
138
+ }
139
+ if (!prefix) return { hasPermissions: false, npmPrefix: null };
140
+ try {
141
+ await _promises.access.call(void 0, prefix, _fs.constants.W_OK);
142
+ return { hasPermissions: true, npmPrefix: prefix };
143
+ } catch (e9) {
144
+ return { hasPermissions: false, npmPrefix: prefix };
145
+ }
146
+ }
147
+ function userHome() {
148
+ return _nullishCoalesce(process.env.HOME, () => ( _os.homedir.call(void 0, )));
149
+ }
150
+ function configDir() {
151
+ return _path.join.call(void 0, userHome(), ".code-shell");
152
+ }
153
+ function getLockFilePath() {
154
+ return _path.join.call(void 0, configDir(), LOCK_FILE);
155
+ }
156
+ function getUpdateLogPath() {
157
+ return _path.join.call(void 0, configDir(), "update.log");
158
+ }
159
+ async function acquireLock() {
160
+ const lockPath = getLockFilePath();
161
+ try {
162
+ const s = await _promises.stat.call(void 0, lockPath);
163
+ if (Date.now() - s.mtimeMs < LOCK_TIMEOUT_MS) return false;
164
+ try {
165
+ const recheck = await _promises.stat.call(void 0, lockPath);
166
+ if (Date.now() - recheck.mtimeMs < LOCK_TIMEOUT_MS) return false;
167
+ await _promises.unlink.call(void 0, lockPath);
168
+ } catch (err) {
169
+ if (!isENOENT(err)) return false;
170
+ }
171
+ } catch (err) {
172
+ if (!isENOENT(err)) return false;
173
+ }
174
+ try {
175
+ await _promises.writeFile.call(void 0, lockPath, String(process.pid), { encoding: "utf8", flag: "wx" });
176
+ return true;
177
+ } catch (err) {
178
+ const code = errnoCode(err);
179
+ if (code === "EEXIST") return false;
180
+ if (code === "ENOENT") {
181
+ try {
182
+ await _promises.mkdir.call(void 0, configDir(), { recursive: true });
183
+ await _promises.writeFile.call(void 0, lockPath, String(process.pid), { encoding: "utf8", flag: "wx" });
184
+ return true;
185
+ } catch (e10) {
186
+ return false;
187
+ }
188
+ }
189
+ return false;
190
+ }
191
+ }
192
+ async function releaseLock() {
193
+ const lockPath = getLockFilePath();
194
+ try {
195
+ const data = await _promises.readFile.call(void 0, lockPath, "utf8");
196
+ if (data === String(process.pid)) await _promises.unlink.call(void 0, lockPath);
197
+ } catch (e11) {
198
+ }
199
+ }
200
+ function launchDetachedInstall(version) {
201
+ const lockPath = getLockFilePath();
202
+ try {
203
+ try {
204
+ const fs2 = _chunkKS3RYAYLcjs.__require.call(void 0, "fs");
205
+ fs2.mkdirSync(configDir(), { recursive: true });
206
+ fs2.writeFileSync(lockPath, String(process.pid), { encoding: "utf8", flag: "wx" });
207
+ } catch (err) {
208
+ if (errnoCode(err) === "EEXIST") {
209
+ try {
210
+ const fs2 = _chunkKS3RYAYLcjs.__require.call(void 0, "fs");
211
+ const s = fs2.statSync(lockPath);
212
+ if (Date.now() - s.mtimeMs < LOCK_TIMEOUT_MS) return;
213
+ fs2.unlinkSync(lockPath);
214
+ fs2.writeFileSync(lockPath, String(process.pid), { encoding: "utf8", flag: "wx" });
215
+ } catch (e12) {
216
+ return;
217
+ }
218
+ } else {
219
+ return;
220
+ }
221
+ }
222
+ } catch (e13) {
223
+ return;
224
+ }
225
+ const fs = _chunkKS3RYAYLcjs.__require.call(void 0, "fs");
226
+ const logFd = fs.openSync(getUpdateLogPath(), "a");
227
+ try {
228
+ fs.writeSync(
229
+ logFd,
230
+ `
231
+ [${(/* @__PURE__ */ new Date()).toISOString()}] code-shell auto-update: installing ${PACKAGE_NAME}@${version} (pid=${process.pid})
232
+ `
233
+ );
234
+ } catch (e14) {
235
+ }
236
+ const cmd = [
237
+ `npm install -g ${PACKAGE_NAME}@${shellEscape(version)}`,
238
+ `; rm -f ${shellEscape(lockPath)}`
239
+ ].join(" ");
240
+ try {
241
+ const child = _child_process.spawn.call(void 0, "sh", ["-c", cmd], {
242
+ detached: true,
243
+ stdio: ["ignore", logFd, logFd],
244
+ cwd: _os.homedir.call(void 0, )
245
+ });
246
+ child.unref();
247
+ } catch (e15) {
248
+ try {
249
+ fs.unlinkSync(lockPath);
250
+ } catch (e16) {
251
+ }
252
+ }
253
+ }
254
+ function isAutoUpdaterDisabled() {
255
+ if (process.env.NODE_ENV === "development") return "development build";
256
+ if (isEnvTruthy(process.env.DISABLE_AUTOUPDATER)) return "DISABLE_AUTOUPDATER set";
257
+ if (readAutoUpdatesFlagFromDisk() === false) return "settings.autoUpdates = false";
258
+ return null;
259
+ }
260
+ function readAutoUpdatesFlagFromDisk() {
261
+ const candidates = [
262
+ _path.join.call(void 0, userHome(), ".code-shell", "settings.json"),
263
+ _path.join.call(void 0, userHome(), ".claude", "settings.json")
264
+ ];
265
+ for (const path of candidates) {
266
+ try {
267
+ const raw = _fs.readFileSync.call(void 0, path, "utf8");
268
+ const parsed = JSON.parse(raw);
269
+ if (typeof parsed.autoUpdates === "boolean") return parsed.autoUpdates;
270
+ } catch (e17) {
271
+ }
272
+ }
273
+ return void 0;
274
+ }
275
+ function isEnvTruthy(v) {
276
+ if (!v) return false;
277
+ const lower = v.toLowerCase();
278
+ return lower === "1" || lower === "true" || lower === "yes" || lower === "on";
279
+ }
280
+ function errnoCode(err) {
281
+ return typeof err === "object" && err !== null && "code" in err ? String(err.code) : void 0;
282
+ }
283
+ function isENOENT(err) {
284
+ return errnoCode(err) === "ENOENT";
285
+ }
286
+ function shellEscape(s) {
287
+ return `'${s.replace(/'/g, `'\\''`)}'`;
288
+ }
289
+ var __internal = { acquireLock, releaseLock, getLockFilePath };
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+ exports.checkForUpdate = checkForUpdate; exports.getUpdateAvailable = getUpdateAvailable; exports.getAutoUpdateDisabledReason = getAutoUpdateDisabledReason; exports.scheduleAutoInstallOnExit = scheduleAutoInstallOnExit; exports.getCurrentVersion = getCurrentVersion; exports.__internal = __internal;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createLLMClient
3
- } from "./chunk-Y7TSCDF6.js";
3
+ } from "./chunk-C5YQBIRK.js";
4
4
  import {
5
5
  logger
6
- } from "./chunk-ZRVPCXI7.js";
6
+ } from "./chunk-BXCY2FSE.js";
7
7
  import {
8
8
  init_esm_shims
9
- } from "./chunk-DI7RDLOS.js";
9
+ } from "./chunk-MD32R22I.js";
10
10
 
11
11
  // src/arena/index.ts
12
12
  init_esm_shims();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-DI7RDLOS.js";
3
+ } from "./chunk-MD32R22I.js";
4
4
 
5
5
  // src/exceptions.ts
6
6
  init_esm_shims();
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-ZRVPCXI7.js";
3
+ } from "./chunk-BXCY2FSE.js";
4
4
  import {
5
5
  init_esm_shims
6
- } from "./chunk-DI7RDLOS.js";
6
+ } from "./chunk-MD32R22I.js";
7
7
 
8
8
  // src/tool-system/mcp-manager.ts
9
9
  init_esm_shims();
@@ -4,16 +4,16 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkVWFET3MGcjs = require('./chunk-VWFET3MG.cjs');
7
+ var _chunkBUU5PZK2cjs = require('./chunk-BUU5PZK2.cjs');
8
8
 
9
9
 
10
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
10
+ var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
11
11
 
12
12
  // src/product/index.ts
13
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
13
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
14
14
 
15
15
  // src/product/define.ts
16
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
16
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
17
17
  var _path = require('path');
18
18
  var _os = require('os');
19
19
  function defineProduct(definition, runtime) {
@@ -61,12 +61,12 @@ function defineProduct(definition, runtime) {
61
61
  builtinTools: [...enabledSet],
62
62
  defaultPermissionRules: permissionRules
63
63
  };
64
- _chunkVWFET3MGcjs.registerPreset.call(void 0, agentPreset);
64
+ _chunkBUU5PZK2cjs.registerPreset.call(void 0, agentPreset);
65
65
  let evaluator;
66
66
  if (!_optionalChain([contract, 'optionalAccess', _4 => _4.evaluator])) {
67
- evaluator = new (0, _chunkVWFET3MGcjs.NoopEvaluator)();
67
+ evaluator = new (0, _chunkBUU5PZK2cjs.NoopEvaluator)();
68
68
  } else if (Array.isArray(contract.evaluator)) {
69
- evaluator = new (0, _chunkVWFET3MGcjs.CompositeEvaluator)(contract.evaluator);
69
+ evaluator = new (0, _chunkBUU5PZK2cjs.CompositeEvaluator)(contract.evaluator);
70
70
  } else {
71
71
  evaluator = contract.evaluator;
72
72
  }
@@ -76,8 +76,8 @@ function defineProduct(definition, runtime) {
76
76
  execute: ct.execute
77
77
  }));
78
78
  const runsDir = _nullishCoalesce(runtime.runsDir, () => ( _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "runs")));
79
- const store = new (0, _chunkVWFET3MGcjs.FileRunStore)(runsDir);
80
- const manager = new (0, _chunkVWFET3MGcjs.RunManager)({
79
+ const store = new (0, _chunkBUU5PZK2cjs.FileRunStore)(runsDir);
80
+ const manager = new (0, _chunkBUU5PZK2cjs.RunManager)({
81
81
  store,
82
82
  executor: {
83
83
  llm: runtime.llm,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-DI7RDLOS.js";
3
+ } from "./chunk-MD32R22I.js";
4
4
 
5
5
  // src/session/file-history.ts
6
6
  init_esm_shims();
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
3
+ var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
4
4
 
5
5
  // src/session/file-history.ts
6
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
6
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
7
7
  var _fs = require('fs');
8
8
  var _path = require('path');
9
9
  var _crypto = require('crypto');
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-DI7RDLOS.js";
3
+ } from "./chunk-MD32R22I.js";
4
4
 
5
5
  // src/session/memory.ts
6
6
  init_esm_shims();
@@ -1,24 +1,24 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkHOXQLX5Rcjs = require('./chunk-HOXQLX5R.cjs');
3
+ var _chunkBWTOS5BHcjs = require('./chunk-BWTOS5BH.cjs');
4
4
 
5
5
 
6
- var _chunkJHNCK7JPcjs = require('./chunk-JHNCK7JP.cjs');
6
+ var _chunkIK4EWJBPcjs = require('./chunk-IK4EWJBP.cjs');
7
7
 
8
8
 
9
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
9
+ var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
10
10
 
11
11
  // src/arena/index.ts
12
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
12
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
13
13
 
14
14
  // src/arena/iterate/index.ts
15
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
15
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
16
16
 
17
17
  // src/arena/iterate/iterative-arena.ts
18
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
18
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
19
19
 
20
20
  // src/arena/iterate/convergence.ts
21
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
21
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
22
22
  function diffRatio(a, b) {
23
23
  if (a === b) return 0;
24
24
  if (!a || !b) return 1;
@@ -93,7 +93,7 @@ function defaultConvergence(args) {
93
93
  }
94
94
 
95
95
  // src/arena/iterate/formats/index.ts
96
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
96
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
97
97
  var COMMON_DRAFT_RULES = `
98
98
  Hard rules:
99
99
  - Output the FULL artifact, not a sketch or outline.
@@ -368,10 +368,10 @@ function getFormat(format) {
368
368
  }
369
369
 
370
370
  // src/arena/iterate/phases/argue.ts
371
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
371
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
372
372
 
373
373
  // src/arena/iterate/parse.ts
374
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
374
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
375
375
  function extractTag(text, tag) {
376
376
  const closed = new RegExp(`<${tag}>([\\s\\S]*?)<\\/${tag}>`, "i");
377
377
  const closedMatch = text.match(closed);
@@ -454,10 +454,10 @@ function parseCritiquesResponse(text, criticName, idPrefix) {
454
454
  }
455
455
 
456
456
  // src/arena/iterate/tools/web-tools.ts
457
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
457
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
458
458
 
459
459
  // src/tool-system/builtin/web-search.ts
460
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
460
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
461
461
  var webSearchToolDef = {
462
462
  name: "WebSearch",
463
463
  description: "Search the web for information. Returns a list of search results with titles, URLs, and snippets. Use this when you need up-to-date information or facts not in your training data.",
@@ -553,7 +553,7 @@ async function searchSearXNG(query, num, baseUrl) {
553
553
  }
554
554
 
555
555
  // src/tool-system/builtin/web-fetch.ts
556
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
556
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
557
557
  var webFetchToolDef = {
558
558
  name: "WebFetch",
559
559
  description: "Fetch a web page and return its text content. Strips HTML tags to return readable text. Use this to read articles, documentation, or any web page.",
@@ -744,7 +744,7 @@ async function runArgueRound(args) {
744
744
  const wantWeb = Boolean(enableWebSearch);
745
745
  const webAvailable = wantWeb && hasWebSearchProvider();
746
746
  if (wantWeb && !webAvailable) {
747
- _chunkJHNCK7JPcjs.logger.warn("arena.iterate.argue_web_unavailable", {
747
+ _chunkIK4EWJBPcjs.logger.warn("arena.iterate.argue_web_unavailable", {
748
748
  reason: "No SERPER_API_KEY / TAVILY_API_KEY / SEARXNG_URL configured"
749
749
  });
750
750
  }
@@ -765,7 +765,7 @@ async function runArgueRound(args) {
765
765
  }
766
766
  return await argueSingleShot({ critic: c, subject, format, draft, idPrefix, signal });
767
767
  } catch (err) {
768
- _chunkJHNCK7JPcjs.logger.warn("arena.iterate.argue_failed", {
768
+ _chunkIK4EWJBPcjs.logger.warn("arena.iterate.argue_failed", {
769
769
  round,
770
770
  critic: c.name,
771
771
  error: err.message
@@ -784,7 +784,7 @@ async function runArgueRound(args) {
784
784
  }
785
785
  async function argueSingleShot(args) {
786
786
  const { critic, subject, format, draft, idPrefix, signal } = args;
787
- const client = await _chunkHOXQLX5Rcjs.createLLMClient.call(void 0, { ...critic.llm, enableStreaming: false });
787
+ const client = await _chunkBWTOS5BHcjs.createLLMClient.call(void 0, { ...critic.llm, enableStreaming: false });
788
788
  const resp = await client.createMessage({
789
789
  systemPrompt: format.argueSystem(format.format),
790
790
  messages: [{ role: "user", content: format.argueUser(subject, draft) }],
@@ -792,7 +792,7 @@ async function argueSingleShot(args) {
792
792
  signal
793
793
  });
794
794
  const critiques = parseCritiquesResponse(resp.text, critic.name, idPrefix);
795
- _chunkJHNCK7JPcjs.logger.info("arena.iterate.argue_singleshot", {
795
+ _chunkIK4EWJBPcjs.logger.info("arena.iterate.argue_singleshot", {
796
796
  critic: critic.name,
797
797
  critiqueCount: critiques.length
798
798
  });
@@ -800,7 +800,7 @@ async function argueSingleShot(args) {
800
800
  }
801
801
  async function argueWithToolLoop(args) {
802
802
  const { critic, subject, format, draft, idPrefix, maxToolRounds, signal } = args;
803
- const client = await _chunkHOXQLX5Rcjs.createLLMClient.call(void 0, { ...critic.llm, enableStreaming: false });
803
+ const client = await _chunkBWTOS5BHcjs.createLLMClient.call(void 0, { ...critic.llm, enableStreaming: false });
804
804
  const messages = [
805
805
  { role: "user", content: format.argueUser(subject, draft) }
806
806
  ];
@@ -866,7 +866,7 @@ async function argueWithToolLoop(args) {
866
866
  finalText = resp.text;
867
867
  }
868
868
  const critiques = parseCritiquesResponse(finalText, critic.name, idPrefix);
869
- _chunkJHNCK7JPcjs.logger.info("arena.iterate.argue_toolloop", {
869
+ _chunkIK4EWJBPcjs.logger.info("arena.iterate.argue_toolloop", {
870
870
  critic: critic.name,
871
871
  critiqueCount: critiques.length,
872
872
  toolRounds
@@ -875,11 +875,11 @@ async function argueWithToolLoop(args) {
875
875
  }
876
876
 
877
877
  // src/arena/iterate/phases/revise.ts
878
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
878
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
879
879
  async function runRevise(args) {
880
880
  const { subject, format, previous, critiques, author, minDraftLength, signal, onProgress } = args;
881
881
  _optionalChain([onProgress, 'optionalCall', _12 => _12({ type: "revise_start", round: previous.version + 1, participant: author.name })]);
882
- const client = await _chunkHOXQLX5Rcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
882
+ const client = await _chunkBWTOS5BHcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
883
883
  const prompt = format.revisePrompt(subject, previous, critiques, minDraftLength);
884
884
  const resp = await client.createMessage({
885
885
  systemPrompt: prompt,
@@ -892,7 +892,7 @@ async function runRevise(args) {
892
892
  let acceptedContent = content;
893
893
  const shrinkage = previous.content.length > 0 ? 1 - acceptedContent.length / previous.content.length : 0;
894
894
  if (shrinkage > 0.3 && acceptedContent.length < minDraftLength) {
895
- _chunkJHNCK7JPcjs.logger.warn("arena.iterate.revise_too_short", {
895
+ _chunkIK4EWJBPcjs.logger.warn("arena.iterate.revise_too_short", {
896
896
  version: previous.version + 1,
897
897
  previousLength: previous.content.length,
898
898
  newLength: acceptedContent.length,
@@ -917,7 +917,7 @@ async function runRevise(args) {
917
917
  participant: author.name,
918
918
  data: { length: acceptedContent.length, accepted: _nullishCoalesce(_optionalChain([meta, 'access', _14 => _14.acceptedCritiques, 'optionalAccess', _15 => _15.length]), () => ( 0)) }
919
919
  })]);
920
- _chunkJHNCK7JPcjs.logger.info("arena.iterate.revise", {
920
+ _chunkIK4EWJBPcjs.logger.info("arena.iterate.revise", {
921
921
  version: next.version,
922
922
  author: author.name,
923
923
  length: acceptedContent.length,
@@ -928,13 +928,13 @@ async function runRevise(args) {
928
928
  }
929
929
 
930
930
  // src/arena/iterate/phases/tournament.ts
931
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
931
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
932
932
  async function runTournamentCandidates(args) {
933
933
  const { subject, format, participants, minDraftLength, signal, onProgress } = args;
934
934
  _optionalChain([onProgress, 'optionalCall', _20 => _20({ type: "v1_tournament_start", data: { count: participants.length } })]);
935
935
  const tasks = participants.map(async (p, idx) => {
936
936
  _optionalChain([signal, 'optionalAccess', _21 => _21.throwIfAborted, 'call', _22 => _22()]);
937
- const client = await _chunkHOXQLX5Rcjs.createLLMClient.call(void 0, { ...p.llm, enableStreaming: false });
937
+ const client = await _chunkBWTOS5BHcjs.createLLMClient.call(void 0, { ...p.llm, enableStreaming: false });
938
938
  const prompt = format.draftPrompt(subject, minDraftLength);
939
939
  const resp = await client.createMessage({
940
940
  systemPrompt: prompt,
@@ -955,7 +955,7 @@ async function runTournamentCandidates(args) {
955
955
  participant: p.name,
956
956
  data: { length: content.length, anonymousLabel: candidate.anonymousLabel }
957
957
  })]);
958
- _chunkJHNCK7JPcjs.logger.info("arena.iterate.v1_candidate", {
958
+ _chunkIK4EWJBPcjs.logger.info("arena.iterate.v1_candidate", {
959
959
  participant: p.name,
960
960
  anonymousLabel: candidate.anonymousLabel,
961
961
  length: content.length
@@ -966,7 +966,7 @@ async function runTournamentCandidates(args) {
966
966
  const candidates = [];
967
967
  for (const s of settled) {
968
968
  if (s.status === "fulfilled") candidates.push(s.value);
969
- else _chunkJHNCK7JPcjs.logger.warn("arena.iterate.v1_candidate_failed", { error: _optionalChain([s, 'access', _24 => _24.reason, 'optionalAccess', _25 => _25.message]) });
969
+ else _chunkIK4EWJBPcjs.logger.warn("arena.iterate.v1_candidate_failed", { error: _optionalChain([s, 'access', _24 => _24.reason, 'optionalAccess', _25 => _25.message]) });
970
970
  }
971
971
  if (candidates.length === 0) {
972
972
  throw new Error("All v1 tournament candidates failed");
@@ -982,7 +982,7 @@ async function runTournamentCandidates(args) {
982
982
  async function mergeCandidatesToV1(args) {
983
983
  const { subject, format, author, candidates, minDraftLength, signal, onProgress } = args;
984
984
  _optionalChain([onProgress, 'optionalCall', _26 => _26({ type: "v1_merge_start", participant: author.name })]);
985
- const client = await _chunkHOXQLX5Rcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
985
+ const client = await _chunkBWTOS5BHcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
986
986
  const prompt = format.mergePrompt(subject, candidates, minDraftLength);
987
987
  const resp = await client.createMessage({
988
988
  systemPrompt: prompt,
@@ -1001,7 +1001,7 @@ async function mergeCandidatesToV1(args) {
1001
1001
  mergeRationale: rationale
1002
1002
  };
1003
1003
  _optionalChain([onProgress, 'optionalCall', _27 => _27({ type: "v1_merge_done", participant: author.name, data: { length: content.length } })]);
1004
- _chunkJHNCK7JPcjs.logger.info("arena.iterate.v1_merge", {
1004
+ _chunkIK4EWJBPcjs.logger.info("arena.iterate.v1_merge", {
1005
1005
  author: author.name,
1006
1006
  candidateCount: candidates.length,
1007
1007
  length: content.length
@@ -1010,7 +1010,7 @@ async function mergeCandidatesToV1(args) {
1010
1010
  }
1011
1011
  async function singleAuthorV1(args) {
1012
1012
  const { subject, format, author, minDraftLength, signal } = args;
1013
- const client = await _chunkHOXQLX5Rcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
1013
+ const client = await _chunkBWTOS5BHcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
1014
1014
  const prompt = format.draftPrompt(subject, minDraftLength);
1015
1015
  const resp = await client.createMessage({
1016
1016
  systemPrompt: prompt,
@@ -1082,7 +1082,7 @@ var IterativeArena = class {
1082
1082
  });
1083
1083
  }
1084
1084
  } catch (err) {
1085
- _chunkJHNCK7JPcjs.logger.error("arena.iterate.v1_failed", { error: err.message });
1085
+ _chunkIK4EWJBPcjs.logger.error("arena.iterate.v1_failed", { error: err.message });
1086
1086
  throw err;
1087
1087
  }
1088
1088
  let currentAuthor = config.author;
@@ -1228,7 +1228,7 @@ var IterativeArena = class {
1228
1228
  finalLength: finalDraft.content.length
1229
1229
  }
1230
1230
  })]);
1231
- _chunkJHNCK7JPcjs.logger.info("arena.iterate.complete", {
1231
+ _chunkIK4EWJBPcjs.logger.info("arena.iterate.complete", {
1232
1232
  stoppedAt,
1233
1233
  rounds: rounds.length,
1234
1234
  finalVersion: finalDraft.version,