@cjhyy/code-shell 0.1.5 → 0.1.7

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 (158) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/anthropic-UBSB5AQH.js +1 -0
  3. package/dist/arena/index.js +1 -104
  4. package/dist/arena-OW55ZCHT.js +3 -0
  5. package/dist/bwrap-PVZMLHZR.js +2 -0
  6. package/dist/chunk-2NS3JMNK.js +1 -0
  7. package/dist/chunk-3QP5BQ3L.js +1 -0
  8. package/dist/chunk-B7K2OWKC.js +2 -0
  9. package/dist/chunk-EWWK56K6.js +2 -0
  10. package/dist/chunk-FU7AHZNN.js +1 -0
  11. package/dist/chunk-HIJ2XXGX.js +1 -0
  12. package/dist/chunk-KCXSARAA.js +1 -0
  13. package/dist/chunk-NFH3UQ3E.js +2 -0
  14. package/dist/chunk-NMBYBGC7.js +250 -0
  15. package/dist/chunk-NVAZJ5XS.js +2 -0
  16. package/dist/chunk-O5HFCH2U.js +1 -0
  17. package/dist/chunk-P6JSTIFM.js +1 -0
  18. package/dist/chunk-PGANL6F2.js +3 -0
  19. package/dist/chunk-Q4O2HGWS.js +251 -0
  20. package/dist/chunk-QTWU7UNA.js +5 -0
  21. package/dist/chunk-RP26WO4R.js +1 -0
  22. package/dist/chunk-SNFAPSLA.js +1 -0
  23. package/dist/chunk-T222K6IV.js +18 -0
  24. package/dist/chunk-TKJA6W36.js +3 -0
  25. package/dist/chunk-UDPUTFQT.js +2 -0
  26. package/dist/chunk-W47Z7MGS.js +33 -0
  27. package/dist/chunk-WI6FSWGU.js +1 -0
  28. package/dist/chunk-WOP6MJKW.js +1 -0
  29. package/dist/chunk-XDOWC7EG.js +4 -0
  30. package/dist/chunk-Y2NS6HPO.js +641 -0
  31. package/dist/cli/main.js +303 -22037
  32. package/dist/cli/updater.d.ts +8 -0
  33. package/dist/client-base-6ZZJJYDY.js +1 -0
  34. package/dist/compaction-ECVQVOCT.js +1 -0
  35. package/dist/devtools-SGDUOOM4.js +1 -0
  36. package/dist/engine/engine.d.ts +15 -0
  37. package/dist/export-md-U72T7NW7.js +22 -0
  38. package/dist/file-history-7FQFEQOL.js +1 -0
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js +1 -347
  41. package/dist/llm/token-counter.d.ts +17 -0
  42. package/dist/manager-C3TDN6MS.js +1 -0
  43. package/dist/mcp-manager-OP4XYV53.js +1 -0
  44. package/dist/memory-BNI4WEWL.js +1 -0
  45. package/dist/model-cache-HEDXI7UJ.js +1 -0
  46. package/dist/model-fetcher-BJ64META.js +1 -0
  47. package/dist/off-7SDVMMXW.js +1 -0
  48. package/dist/openai-KEWQ54TM.js +1 -0
  49. package/dist/openrouter-models-AM6M52D6.js +1 -0
  50. package/dist/openrouter-sync-5JNBL3Z6.js +1 -0
  51. package/dist/product/index.js +1 -21
  52. package/dist/run/index.js +1 -48
  53. package/dist/seatbelt-WBYROQT6.js +37 -0
  54. package/dist/session/session-manager.d.ts +2 -0
  55. package/dist/session-manager-AGWS5SMJ.js +1 -0
  56. package/dist/settings/schema.d.ts +72 -6
  57. package/dist/tool-summary-5UE62VU4.js +2 -0
  58. package/dist/tool-system/builtin/bash.d.ts +7 -1
  59. package/dist/tool-system/context.d.ts +7 -0
  60. package/dist/tool-system/investigation-guard.d.ts +9 -0
  61. package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
  62. package/dist/tool-system/sandbox/index.d.ts +71 -0
  63. package/dist/tool-system/sandbox/off.d.ts +2 -0
  64. package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
  65. package/dist/types.d.ts +4 -0
  66. package/dist/ui/components/SessionPicker.d.ts +2 -0
  67. package/dist/ui/components/SpinnerWithVerb.d.ts +2 -2
  68. package/dist/ui/components/StatusLine.d.ts +2 -2
  69. package/dist/updater-OCNU2K2Z.js +1 -0
  70. package/package.json +8 -10
  71. package/skills-builtin/codeshell-help.md +135 -0
  72. package/dist/anthropic-IBTI4WL2.cjs +0 -10
  73. package/dist/anthropic-PRZZKHEZ.js +0 -10
  74. package/dist/arena/index.cjs +0 -104
  75. package/dist/arena-KBQOPLFV.cjs +0 -261
  76. package/dist/arena-O2L4TN6A.js +0 -261
  77. package/dist/chunk-2EP3CLEN.js +0 -44
  78. package/dist/chunk-2YW4FPFG.cjs +0 -101
  79. package/dist/chunk-3OA5G4TM.js +0 -47
  80. package/dist/chunk-52LGZKT3.cjs +0 -47
  81. package/dist/chunk-55XGPMAP.cjs +0 -146
  82. package/dist/chunk-5ECBT4YA.js +0 -450
  83. package/dist/chunk-6QVAYW7C.cjs +0 -438
  84. package/dist/chunk-6S4BJ65N.js +0 -113
  85. package/dist/chunk-76HYEPDM.js +0 -307
  86. package/dist/chunk-76W334S4.js +0 -54
  87. package/dist/chunk-7EG3V4JY.cjs +0 -113
  88. package/dist/chunk-7JVTYEEC.js +0 -340
  89. package/dist/chunk-7K6SDRRF.js +0 -9047
  90. package/dist/chunk-7Y6S3OCX.js +0 -438
  91. package/dist/chunk-A5LCRPDP.cjs +0 -54
  92. package/dist/chunk-BSW22MPA.js +0 -146
  93. package/dist/chunk-BUU5PZK2.cjs +0 -9048
  94. package/dist/chunk-BWTOS5BH.cjs +0 -5128
  95. package/dist/chunk-BXCY2FSE.js +0 -203
  96. package/dist/chunk-C5YQBIRK.js +0 -5128
  97. package/dist/chunk-HEKQCI7B.cjs +0 -224
  98. package/dist/chunk-HS2MFNUC.cjs +0 -44
  99. package/dist/chunk-IK4EWJBP.cjs +0 -203
  100. package/dist/chunk-JMR33QVF.cjs +0 -169
  101. package/dist/chunk-KOVYSDHZ.cjs +0 -340
  102. package/dist/chunk-KS3RYAYL.cjs +0 -45
  103. package/dist/chunk-MD32R22I.js +0 -50
  104. package/dist/chunk-MY5XHADU.cjs +0 -216
  105. package/dist/chunk-NUNC3VFB.cjs +0 -307
  106. package/dist/chunk-QRM7IF2S.cjs +0 -4711
  107. package/dist/chunk-R47ROHGL.cjs +0 -298
  108. package/dist/chunk-RMYKO74M.js +0 -1252
  109. package/dist/chunk-SFXHZSRF.js +0 -101
  110. package/dist/chunk-SIHHIQLO.js +0 -224
  111. package/dist/chunk-SNT563K3.cjs +0 -107
  112. package/dist/chunk-T6VYG46N.js +0 -105
  113. package/dist/chunk-TUY2T5KP.cjs +0 -105
  114. package/dist/chunk-VIAGTYYW.js +0 -169
  115. package/dist/chunk-VYL4EFRC.cjs +0 -1252
  116. package/dist/chunk-W22P377T.js +0 -299
  117. package/dist/chunk-WASS5YWB.js +0 -215
  118. package/dist/chunk-XDIQWQJ4.js +0 -4711
  119. package/dist/chunk-YIQBXAYU.cjs +0 -264
  120. package/dist/chunk-YJ77GQK5.js +0 -107
  121. package/dist/chunk-YUI524OE.cjs +0 -450
  122. package/dist/chunk-ZBPSQCPU.js +0 -264
  123. package/dist/cli/main.cjs +0 -22133
  124. package/dist/client-base-HTF236ZD.cjs +0 -9
  125. package/dist/client-base-QKRKCOWB.js +0 -9
  126. package/dist/compaction-6VU2T643.js +0 -33
  127. package/dist/compaction-OKUNTCA7.cjs +0 -33
  128. package/dist/devtools-T2NIZBJK.cjs +0 -6
  129. package/dist/devtools-YXWHOVKR.js +0 -6
  130. package/dist/export-md-RXDW6F5W.cjs +0 -135
  131. package/dist/export-md-XXKZANW5.js +0 -135
  132. package/dist/file-history-KYPE3ECT.cjs +0 -7
  133. package/dist/file-history-LF4F7X26.js +0 -7
  134. package/dist/index.cjs +0 -347
  135. package/dist/manager-C2IUXKRC.js +0 -7
  136. package/dist/manager-YYKWYTRM.cjs +0 -7
  137. package/dist/mcp-manager-QMKWPBZ4.js +0 -8
  138. package/dist/mcp-manager-Z3OKI74O.cjs +0 -8
  139. package/dist/memory-5LWZ6FI2.cjs +0 -9
  140. package/dist/memory-VIJLBAMQ.js +0 -9
  141. package/dist/model-cache-5KIYL5SL.js +0 -13
  142. package/dist/model-cache-OED3IM4R.cjs +0 -13
  143. package/dist/model-fetcher-HKGICACL.js +0 -8
  144. package/dist/model-fetcher-UR6WJOQP.cjs +0 -8
  145. package/dist/openai-JR2WEKOF.js +0 -10
  146. package/dist/openai-YBTOET4O.cjs +0 -10
  147. package/dist/openrouter-models-OU4GRZQY.cjs +0 -15
  148. package/dist/openrouter-models-TGKDKY52.js +0 -15
  149. package/dist/openrouter-sync-BBHUM3R6.cjs +0 -11
  150. package/dist/openrouter-sync-UXUSJCIR.js +0 -11
  151. package/dist/product/index.cjs +0 -21
  152. package/dist/run/index.cjs +0 -48
  153. package/dist/session-manager-Q22BBMD3.js +0 -8
  154. package/dist/session-manager-XODQVL3C.cjs +0 -8
  155. package/dist/tool-summary-63DPIS7G.cjs +0 -31
  156. package/dist/tool-summary-NP5CDBKG.js +0 -31
  157. package/dist/updater-QW473OF4.cjs +0 -17
  158. package/dist/updater-VFUAHCVY.js +0 -17
@@ -1,298 +0,0 @@
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;