@cjhyy/code-shell 0.1.6 → 0.2.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.
Files changed (171) hide show
  1. package/dist/anthropic-OVRWAZRD.js +1 -0
  2. package/dist/arena/index.js +1 -104
  3. package/dist/arena-64T2EQD4.js +3 -0
  4. package/dist/bwrap-PVZMLHZR.js +2 -0
  5. package/dist/chunk-2EUIMKJA.js +1 -0
  6. package/dist/chunk-2GJ7H5NC.js +641 -0
  7. package/dist/chunk-2OD6VR4N.js +2 -0
  8. package/dist/chunk-3QP5BQ3L.js +1 -0
  9. package/dist/chunk-A4M2Y42L.js +2 -0
  10. package/dist/chunk-DEYFK6FP.js +1 -0
  11. package/dist/chunk-DTPABBSV.js +2 -0
  12. package/dist/chunk-EU3J7TBP.js +1 -0
  13. package/dist/chunk-FU7AHZNN.js +1 -0
  14. package/dist/chunk-L7B2ORID.js +4 -0
  15. package/dist/chunk-M7VU4YVY.js +49 -0
  16. package/dist/chunk-MGP35GKD.js +254 -0
  17. package/dist/chunk-MLCTC53I.js +1 -0
  18. package/dist/chunk-O5HFCH2U.js +1 -0
  19. package/dist/chunk-P6JSTIFM.js +1 -0
  20. package/dist/chunk-Q3RSX66I.js +1 -0
  21. package/dist/chunk-QTWU7UNA.js +5 -0
  22. package/dist/chunk-RERBX75D.js +251 -0
  23. package/dist/chunk-SNFAPSLA.js +1 -0
  24. package/dist/chunk-T222K6IV.js +18 -0
  25. package/dist/chunk-TKJA6W36.js +3 -0
  26. package/dist/chunk-VKKU4LOM.js +3 -0
  27. package/dist/chunk-WI6FSWGU.js +1 -0
  28. package/dist/chunk-XXCZE2U2.js +2 -0
  29. package/dist/chunk-ZSAONDT6.js +2 -0
  30. package/dist/cli/main.js +303 -22060
  31. package/dist/cli/onboarding.d.ts +7 -2
  32. package/dist/client-base-F5FCRSB3.js +1 -0
  33. package/dist/compaction-L3Y6NG4N.js +1 -0
  34. package/dist/context/compaction.d.ts +2 -1
  35. package/dist/data/static-catalogs.d.ts +25 -0
  36. package/dist/devtools-SGDUOOM4.js +1 -0
  37. package/dist/engine/engine.d.ts +24 -0
  38. package/dist/engine/turn-loop.d.ts +20 -0
  39. package/dist/export-md-U72T7NW7.js +22 -0
  40. package/dist/file-history-7FQFEQOL.js +1 -0
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +1 -347
  43. package/dist/llm/capabilities/index.d.ts +20 -0
  44. package/dist/llm/capabilities/rules.d.ts +26 -0
  45. package/dist/llm/capabilities/types.d.ts +108 -0
  46. package/dist/llm/model-pool.d.ts +7 -0
  47. package/dist/llm/provider-catalog.d.ts +2 -0
  48. package/dist/llm/provider-kinds.d.ts +1 -1
  49. package/dist/llm/providers/openai.d.ts +22 -0
  50. package/dist/llm/token-counter.d.ts +17 -0
  51. package/dist/llm/types.d.ts +8 -0
  52. package/dist/logging/logger.d.ts +10 -2
  53. package/dist/logging/session-recorder.d.ts +16 -3
  54. package/dist/manager-J6FXEUEK.js +1 -0
  55. package/dist/mcp-manager-27EVBKRT.js +1 -0
  56. package/dist/memory-BNI4WEWL.js +1 -0
  57. package/dist/model-cache-HEDXI7UJ.js +1 -0
  58. package/dist/model-fetcher-X5W5EASG.js +1 -0
  59. package/dist/off-7SDVMMXW.js +1 -0
  60. package/dist/openai-3QEADSYL.js +1 -0
  61. package/dist/openrouter-models-GZVCRWD2.js +1 -0
  62. package/dist/openrouter-sync-WG4AG5NC.js +1 -0
  63. package/dist/product/index.js +1 -21
  64. package/dist/protocol/client.d.ts +1 -1
  65. package/dist/run/index.js +1 -48
  66. package/dist/seatbelt-L54CNI2Y.js +37 -0
  67. package/dist/session/session-manager.d.ts +2 -0
  68. package/dist/session-manager-AGWS5SMJ.js +1 -0
  69. package/dist/settings/schema.d.ts +147 -21
  70. package/dist/tool-summary-V2B3MD5N.js +2 -0
  71. package/dist/tool-system/builtin/bash.d.ts +7 -1
  72. package/dist/tool-system/context.d.ts +7 -0
  73. package/dist/tool-system/executor.d.ts +4 -0
  74. package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
  75. package/dist/tool-system/sandbox/index.d.ts +78 -0
  76. package/dist/tool-system/sandbox/off.d.ts +2 -0
  77. package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
  78. package/dist/tool-system/task-guard.d.ts +30 -0
  79. package/dist/types.d.ts +17 -0
  80. package/dist/ui/components/SessionPicker.d.ts +2 -0
  81. package/dist/ui/components/SpinnerWithVerb.d.ts +7 -2
  82. package/dist/ui/components/StatusLine.d.ts +7 -3
  83. package/dist/updater-OCNU2K2Z.js +1 -0
  84. package/package.json +7 -10
  85. package/dist/anthropic-IBTI4WL2.cjs +0 -10
  86. package/dist/anthropic-PRZZKHEZ.js +0 -10
  87. package/dist/arena/index.cjs +0 -104
  88. package/dist/arena-2LTLIXOL.js +0 -261
  89. package/dist/arena-ADB7DRFI.cjs +0 -261
  90. package/dist/chunk-2YW4FPFG.cjs +0 -101
  91. package/dist/chunk-3OA5G4TM.js +0 -47
  92. package/dist/chunk-3QO25N6E.js +0 -4711
  93. package/dist/chunk-3SBSUOWZ.js +0 -447
  94. package/dist/chunk-52LGZKT3.cjs +0 -47
  95. package/dist/chunk-55XGPMAP.cjs +0 -146
  96. package/dist/chunk-6QVAYW7C.cjs +0 -438
  97. package/dist/chunk-6S4BJ65N.js +0 -113
  98. package/dist/chunk-76HYEPDM.js +0 -307
  99. package/dist/chunk-7BI3V74Y.cjs +0 -447
  100. package/dist/chunk-7EG3V4JY.cjs +0 -113
  101. package/dist/chunk-7JVTYEEC.js +0 -340
  102. package/dist/chunk-7QIM3BKD.js +0 -44
  103. package/dist/chunk-7Y6S3OCX.js +0 -438
  104. package/dist/chunk-ABRRONJ7.js +0 -107
  105. package/dist/chunk-BSW22MPA.js +0 -146
  106. package/dist/chunk-BXCY2FSE.js +0 -203
  107. package/dist/chunk-BZ5TNE7L.js +0 -5128
  108. package/dist/chunk-DDB6QOKJ.cjs +0 -1252
  109. package/dist/chunk-HEKQCI7B.cjs +0 -224
  110. package/dist/chunk-IK4EWJBP.cjs +0 -203
  111. package/dist/chunk-ILHE7XLT.cjs +0 -107
  112. package/dist/chunk-JMR33QVF.cjs +0 -169
  113. package/dist/chunk-KAQHULYN.js +0 -54
  114. package/dist/chunk-KE4EQOWA.js +0 -294
  115. package/dist/chunk-KOVYSDHZ.cjs +0 -340
  116. package/dist/chunk-KS3RYAYL.cjs +0 -45
  117. package/dist/chunk-MD32R22I.js +0 -50
  118. package/dist/chunk-MV7YI4WO.cjs +0 -293
  119. package/dist/chunk-MY5XHADU.cjs +0 -216
  120. package/dist/chunk-NUNC3VFB.cjs +0 -307
  121. package/dist/chunk-PKGRTCCY.js +0 -9092
  122. package/dist/chunk-QARL3IDQ.js +0 -1252
  123. package/dist/chunk-S754JHLR.cjs +0 -54
  124. package/dist/chunk-SFXHZSRF.js +0 -101
  125. package/dist/chunk-SIHHIQLO.js +0 -224
  126. package/dist/chunk-T6VYG46N.js +0 -105
  127. package/dist/chunk-TNLGBJYS.cjs +0 -44
  128. package/dist/chunk-TUY2T5KP.cjs +0 -105
  129. package/dist/chunk-UXOCVJJ6.cjs +0 -9092
  130. package/dist/chunk-VIAGTYYW.js +0 -169
  131. package/dist/chunk-WASS5YWB.js +0 -215
  132. package/dist/chunk-WZJV6DJC.cjs +0 -5128
  133. package/dist/chunk-YIQBXAYU.cjs +0 -264
  134. package/dist/chunk-YKIAELDZ.cjs +0 -4711
  135. package/dist/chunk-ZBPSQCPU.js +0 -264
  136. package/dist/cli/main.cjs +0 -22156
  137. package/dist/client-base-HTF236ZD.cjs +0 -9
  138. package/dist/client-base-QKRKCOWB.js +0 -9
  139. package/dist/compaction-6VU2T643.js +0 -33
  140. package/dist/compaction-OKUNTCA7.cjs +0 -33
  141. package/dist/devtools-T2NIZBJK.cjs +0 -6
  142. package/dist/devtools-YXWHOVKR.js +0 -6
  143. package/dist/export-md-RXDW6F5W.cjs +0 -135
  144. package/dist/export-md-XXKZANW5.js +0 -135
  145. package/dist/file-history-KYPE3ECT.cjs +0 -7
  146. package/dist/file-history-LF4F7X26.js +0 -7
  147. package/dist/index.cjs +0 -347
  148. package/dist/manager-D65VFAPX.js +0 -7
  149. package/dist/manager-TTF5VHJC.cjs +0 -7
  150. package/dist/mcp-manager-QMKWPBZ4.js +0 -8
  151. package/dist/mcp-manager-Z3OKI74O.cjs +0 -8
  152. package/dist/memory-5LWZ6FI2.cjs +0 -9
  153. package/dist/memory-VIJLBAMQ.js +0 -9
  154. package/dist/model-cache-5KIYL5SL.js +0 -13
  155. package/dist/model-cache-OED3IM4R.cjs +0 -13
  156. package/dist/model-fetcher-HKGICACL.js +0 -8
  157. package/dist/model-fetcher-UR6WJOQP.cjs +0 -8
  158. package/dist/openai-JR2WEKOF.js +0 -10
  159. package/dist/openai-YBTOET4O.cjs +0 -10
  160. package/dist/openrouter-models-H56GHBHN.js +0 -15
  161. package/dist/openrouter-models-TWUFWZ5T.cjs +0 -15
  162. package/dist/openrouter-sync-5VMGN6C2.cjs +0 -11
  163. package/dist/openrouter-sync-ALEMF5IU.js +0 -11
  164. package/dist/product/index.cjs +0 -21
  165. package/dist/run/index.cjs +0 -48
  166. package/dist/session-manager-Q22BBMD3.js +0 -8
  167. package/dist/session-manager-XODQVL3C.cjs +0 -8
  168. package/dist/tool-summary-63DPIS7G.cjs +0 -31
  169. package/dist/tool-summary-NP5CDBKG.js +0 -31
  170. package/dist/updater-I7QBW4DP.cjs +0 -17
  171. package/dist/updater-NVME5S3Z.js +0 -17
@@ -1,261 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
- var _chunk55XGPMAPcjs = require('./chunk-55XGPMAP.cjs');
4
- require('./chunk-52LGZKT3.cjs');
5
-
6
-
7
- var _chunk7BI3V74Ycjs = require('./chunk-7BI3V74Y.cjs');
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
- var _chunkWZJV6DJCcjs = require('./chunk-WZJV6DJC.cjs');
17
- require('./chunk-YKIAELDZ.cjs');
18
- require('./chunk-2YW4FPFG.cjs');
19
- require('./chunk-IK4EWJBP.cjs');
20
-
21
-
22
- var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
23
-
24
- // src/cli/commands/arena.ts
25
- _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
26
- var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
27
- async function runArenaReview(arg, engineConfig, opts) {
28
- const { models: modelsFlag, mode: explicitMode, base, head, topic } = parseFlags(arg);
29
- const out = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _ => _.output]), () => ( ((text) => console.log(text))));
30
- if (!topic) {
31
- out(formatUsage());
32
- return void 0;
33
- }
34
- const participants = resolveParticipants(engineConfig, modelsFlag);
35
- if (participants.length < 2) {
36
- out(formatModelHelp(engineConfig));
37
- return void 0;
38
- }
39
- const modeLabel = explicitMode ? explicitMode.charAt(0).toUpperCase() + explicitMode.slice(1) : "Auto";
40
- out(_chalk2.default.bold(`\u2550\u2550\u2550 Arena ${modeLabel} \u2550\u2550\u2550`));
41
- out(_chalk2.default.dim(`Topic: ${topic}`));
42
- out(_chalk2.default.dim(`Models: ${participants.map((p) => p.name).join(" vs ")}`));
43
- const progressRenderer = _optionalChain([opts, 'optionalAccess', _2 => _2.output]) ? _chunkWZJV6DJCcjs.createProgressRenderer.call(void 0, opts.output) : _chunkWZJV6DJCcjs.renderProgress;
44
- const arena = new (0, _chunkWZJV6DJCcjs.Arena)({
45
- participants,
46
- mode: explicitMode,
47
- enableContextTools: true,
48
- onProgress: progressRenderer
49
- });
50
- try {
51
- const result = await arena.run(topic, {
52
- mode: explicitMode,
53
- base,
54
- head
55
- });
56
- const resultSink = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _3 => _3.outputMessage]), () => ( _optionalChain([opts, 'optionalAccess', _4 => _4.output])));
57
- if (resultSink) {
58
- resultSink(_chunkWZJV6DJCcjs.formatArenaResultForSession.call(void 0, result));
59
- } else {
60
- _chunkWZJV6DJCcjs.printArenaResult.call(void 0, result);
61
- }
62
- return result;
63
- } catch (err) {
64
- out(_chalk2.default.red(`Arena failed: ${err.message}`));
65
- return void 0;
66
- }
67
- }
68
- function buildModelPool(engineConfig) {
69
- const pool = new (0, _chunk55XGPMAPcjs.ModelPool)();
70
- try {
71
- const settings = new (0, _chunk7BI3V74Ycjs.SettingsManager)(process.cwd()).get();
72
- if (_optionalChain([settings, 'access', _5 => _5.models, 'optionalAccess', _6 => _6.length])) {
73
- for (const m of settings.models) {
74
- pool.register({
75
- key: m.key,
76
- label: m.label,
77
- provider: _nullishCoalesce(m.provider, () => ( "")),
78
- model: m.model,
79
- baseUrl: _nullishCoalesce(m.baseUrl, () => ( engineConfig.llm.baseUrl)),
80
- apiKey: _nullishCoalesce(m.apiKey, () => ( engineConfig.llm.apiKey)),
81
- maxOutputTokens: m.maxOutputTokens
82
- });
83
- }
84
- }
85
- } catch (e) {
86
- }
87
- return pool;
88
- }
89
- function resolveOneParticipant(entry, pool, engineConfig) {
90
- if (typeof entry === "string") {
91
- const m = pool.get(entry);
92
- if (!m) return void 0;
93
- return {
94
- name: _nullishCoalesce(m.label, () => ( modelDisplayName(m.model))),
95
- llm: {
96
- provider: m.provider,
97
- model: m.model,
98
- apiKey: _nullishCoalesce(m.apiKey, () => ( engineConfig.llm.apiKey)),
99
- baseUrl: _nullishCoalesce(m.baseUrl, () => ( engineConfig.llm.baseUrl)),
100
- temperature: 0.3,
101
- maxTokens: _nullishCoalesce(m.maxOutputTokens, () => ( _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, m.model))),
102
- enableStreaming: false
103
- }
104
- };
105
- }
106
- return {
107
- name: entry.name,
108
- llm: {
109
- provider: _nullishCoalesce(entry.provider, () => ( engineConfig.llm.provider)),
110
- model: entry.model,
111
- apiKey: _nullishCoalesce(entry.apiKey, () => ( engineConfig.llm.apiKey)),
112
- baseUrl: _nullishCoalesce(entry.baseUrl, () => ( engineConfig.llm.baseUrl)),
113
- temperature: 0.3,
114
- maxTokens: _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, entry.model),
115
- enableStreaming: false
116
- }
117
- };
118
- }
119
- function resolveParticipants(engineConfig, modelsFlag) {
120
- const pool = buildModelPool(engineConfig);
121
- if (modelsFlag) {
122
- const names = modelsFlag.split(",").map((n) => n.trim().toLowerCase());
123
- return names.map((name) => {
124
- const fromPool = pool.get(name);
125
- if (fromPool) {
126
- return {
127
- name: _nullishCoalesce(fromPool.label, () => ( modelDisplayName(fromPool.model))),
128
- llm: {
129
- provider: fromPool.provider,
130
- model: fromPool.model,
131
- apiKey: _nullishCoalesce(fromPool.apiKey, () => ( engineConfig.llm.apiKey)),
132
- baseUrl: _nullishCoalesce(fromPool.baseUrl, () => ( engineConfig.llm.baseUrl)),
133
- temperature: 0.3,
134
- maxTokens: _nullishCoalesce(fromPool.maxOutputTokens, () => ( _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, fromPool.model))),
135
- enableStreaming: false
136
- }
137
- };
138
- }
139
- const preset = _chunkWZJV6DJCcjs.MODEL_PRESETS[name];
140
- if (preset) {
141
- return {
142
- name: modelDisplayName(preset.model),
143
- llm: {
144
- provider: preset.provider,
145
- model: preset.model,
146
- apiKey: engineConfig.llm.apiKey,
147
- baseUrl: engineConfig.llm.baseUrl,
148
- temperature: 0.3,
149
- maxTokens: preset.maxOutputTokens,
150
- enableStreaming: false
151
- }
152
- };
153
- }
154
- return {
155
- name: modelDisplayName(name),
156
- llm: { ...engineConfig.llm, model: name, enableStreaming: false }
157
- };
158
- });
159
- }
160
- const settings = new (0, _chunk7BI3V74Ycjs.SettingsManager)(process.cwd()).get();
161
- if (_optionalChain([settings, 'access', _7 => _7.arena, 'optionalAccess', _8 => _8.participants, 'optionalAccess', _9 => _9.length]) >= 2) {
162
- const resolved = settings.arena.participants.map((p) => resolveOneParticipant(p, pool, engineConfig)).filter((p) => p !== void 0);
163
- if (resolved.length >= 2) return resolved;
164
- }
165
- const participants = [
166
- {
167
- name: modelDisplayName(engineConfig.llm.model),
168
- llm: {
169
- ...engineConfig.llm,
170
- maxTokens: _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, engineConfig.llm.model),
171
- enableStreaming: false
172
- }
173
- }
174
- ];
175
- if (_optionalChain([engineConfig, 'access', _10 => _10.llm, 'access', _11 => _11.baseUrl, 'optionalAccess', _12 => _12.includes, 'call', _13 => _13("openrouter")])) {
176
- const current = engineConfig.llm.model;
177
- const opponent = current.includes("claude") ? "openai/gpt-5.4" : "anthropic/claude-opus-4.6";
178
- participants.push({
179
- name: modelDisplayName(opponent),
180
- llm: {
181
- ...engineConfig.llm,
182
- model: opponent,
183
- maxTokens: _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, opponent),
184
- enableStreaming: false
185
- }
186
- });
187
- }
188
- return participants;
189
- }
190
- var VALID_MODES = ["review", "discussion", "planning"];
191
- function parseFlags(arg) {
192
- let models;
193
- let mode;
194
- let base;
195
- let head;
196
- const remaining = [];
197
- const tokens = arg.split(/\s+/);
198
- for (let i = 0; i < tokens.length; i++) {
199
- if (tokens[i] === "--models" && tokens[i + 1]) {
200
- models = tokens[++i];
201
- } else if (tokens[i] === "--mode" && tokens[i + 1]) {
202
- const val = tokens[++i].toLowerCase();
203
- if (VALID_MODES.includes(val)) {
204
- mode = val;
205
- } else {
206
- console.log(_chalk2.default.yellow(` Unknown mode "${val}", valid: ${VALID_MODES.join(", ")}`));
207
- }
208
- } else if (tokens[i] === "--base" && tokens[i + 1]) {
209
- base = tokens[++i];
210
- } else if (tokens[i] === "--head" && tokens[i + 1]) {
211
- head = tokens[++i];
212
- } else {
213
- remaining.push(tokens[i]);
214
- }
215
- }
216
- return { models, mode, base, head, topic: remaining.join(" ").trim() };
217
- }
218
- function formatUsage() {
219
- return [
220
- _chalk2.default.bold("Arena \u2014 Multi-model collaborative analysis"),
221
- "",
222
- _chalk2.default.dim("Usage:"),
223
- " /arena review the authentication module",
224
- " /arena --models claude,gpt4o is the error handling correct?",
225
- " /arena --mode planning design the new auth system",
226
- " /arena --mode discussion should we use REST or GraphQL",
227
- " /arena --base main review changes since main",
228
- ' code-shell arena "review my latest changes"',
229
- "",
230
- `${_chalk2.default.dim("Modes:")} review (default), discussion, planning`,
231
- _chalk2.default.dim("Mode is auto-detected from the topic if --mode is not specified."),
232
- "",
233
- _chalk2.default.dim("Flags:"),
234
- " --base <ref> Base branch/ref for comparison",
235
- " --head <ref> Head branch/ref (default: HEAD)",
236
- "",
237
- `${_chalk2.default.dim("Available model presets:")} ${Object.keys(_chunkWZJV6DJCcjs.MODEL_PRESETS).join(", ")}`
238
- ].join("\n");
239
- }
240
- function formatModelHelp(engineConfig) {
241
- return [
242
- _chalk2.default.red("Arena needs at least 2 models."),
243
- "",
244
- "Use --models to specify:",
245
- " /arena --models claude,gpt4o review the code",
246
- "",
247
- "Or configure in ~/.code-shell/settings.json:",
248
- ' "arena": { "participants": [',
249
- ' { "name": "Claude", "model": "anthropic/claude-sonnet-4-20250514" },',
250
- ' { "name": "GPT-4o", "model": "openai/gpt-4o" }',
251
- " ]}"
252
- ].join("\n");
253
- }
254
- function modelDisplayName(model) {
255
- const last = _nullishCoalesce(model.split("/").pop(), () => ( model));
256
- return last.replace(/-\d.*$/, "").split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
257
- }
258
-
259
-
260
-
261
- exports.formatArenaResultForSession = _chunkWZJV6DJCcjs.formatArenaResultForSession; exports.runArenaReview = runArenaReview;
@@ -1,101 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
4
-
5
- // src/exceptions.ts
6
- _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
7
- var FrameworkError = class extends Error {
8
- constructor(message, details) {
9
- super(message);
10
- this.details = details;
11
- this.name = "FrameworkError";
12
- }
13
- };
14
- var LLMError = class extends FrameworkError {
15
- constructor(message, provider, details) {
16
- super(message, details);
17
- this.provider = provider;
18
- this.name = "LLMError";
19
- }
20
- };
21
- var LLMRateLimitError = class extends LLMError {
22
- constructor(provider, retryAfter) {
23
- super(`Rate limit exceeded for ${provider}`, provider, { retryAfter });
24
- this.retryAfter = retryAfter;
25
- this.name = "LLMRateLimitError";
26
- }
27
- };
28
- var ContextLimitError = class extends LLMError {
29
- constructor(provider) {
30
- super("Context limit exceeded", provider);
31
- this.name = "ContextLimitError";
32
- }
33
- };
34
- var ToolError = class extends FrameworkError {
35
- constructor(message, toolName, details) {
36
- super(message, details);
37
- this.toolName = toolName;
38
- this.name = "ToolError";
39
- }
40
- };
41
- var ToolNotFoundError = class extends ToolError {
42
- constructor(toolName) {
43
- super(`Tool not found: ${toolName}`, toolName);
44
- this.name = "ToolNotFoundError";
45
- }
46
- };
47
- var ToolExecutionError = class extends ToolError {
48
- constructor(toolName, cause) {
49
- super(`Tool execution failed: ${toolName} - ${cause}`, toolName, { cause });
50
- this.name = "ToolExecutionError";
51
- }
52
- };
53
- var ToolTimeoutError = class extends ToolError {
54
- constructor(toolName, timeoutMs) {
55
- super(`Tool timed out after ${timeoutMs}ms: ${toolName}`, toolName, { timeoutMs });
56
- this.timeoutMs = timeoutMs;
57
- this.name = "ToolTimeoutError";
58
- }
59
- };
60
- var PermissionDeniedError = class extends FrameworkError {
61
- constructor(toolName, reason) {
62
- super(`Permission denied for tool: ${toolName}${reason ? ` - ${reason}` : ""}`, {
63
- toolName,
64
- reason
65
- });
66
- this.name = "PermissionDeniedError";
67
- }
68
- };
69
- var SessionError = class extends FrameworkError {
70
- constructor(message, details) {
71
- super(message, details);
72
- this.name = "SessionError";
73
- }
74
- };
75
- var TranscriptError = class extends FrameworkError {
76
- constructor(message, details) {
77
- super(message, details);
78
- this.name = "TranscriptError";
79
- }
80
- };
81
- var ConfigError = class extends FrameworkError {
82
- constructor(message, details) {
83
- super(message, details);
84
- this.name = "ConfigError";
85
- }
86
- };
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
- exports.FrameworkError = FrameworkError; exports.LLMError = LLMError; exports.LLMRateLimitError = LLMRateLimitError; exports.ContextLimitError = ContextLimitError; exports.ToolError = ToolError; exports.ToolNotFoundError = ToolNotFoundError; exports.ToolExecutionError = ToolExecutionError; exports.ToolTimeoutError = ToolTimeoutError; exports.PermissionDeniedError = PermissionDeniedError; exports.SessionError = SessionError; exports.TranscriptError = TranscriptError; exports.ConfigError = ConfigError;
@@ -1,47 +0,0 @@
1
- import {
2
- init_esm_shims
3
- } from "./chunk-MD32R22I.js";
4
-
5
- // src/llm/model-cache.ts
6
- init_esm_shims();
7
- import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
8
- import { homedir } from "os";
9
- import { join } from "path";
10
- var TTL_MS = 7 * 24 * 3600 * 1e3;
11
- function readCache(cacheDir, providerKey) {
12
- const path = join(cacheDir, `${providerKey}.json`);
13
- if (!existsSync(path)) return void 0;
14
- try {
15
- const raw = readFileSync(path, "utf-8");
16
- const parsed = JSON.parse(raw);
17
- if (!parsed || !Array.isArray(parsed.models)) return void 0;
18
- return parsed;
19
- } catch {
20
- return void 0;
21
- }
22
- }
23
- function writeCache(cacheDir, providerKey, models) {
24
- if (!existsSync(cacheDir)) mkdirSync(cacheDir, { recursive: true });
25
- const payload = {
26
- fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
27
- providerKey,
28
- models
29
- };
30
- writeFileSync(join(cacheDir, `${providerKey}.json`), JSON.stringify(payload, null, 2), "utf-8");
31
- return payload;
32
- }
33
- function isStale(file, now = Date.now()) {
34
- const ts = Date.parse(file.fetchedAt);
35
- if (!Number.isFinite(ts)) return true;
36
- return now - ts > TTL_MS;
37
- }
38
- function defaultCacheDir() {
39
- return join(homedir(), ".code-shell", "cache", "models");
40
- }
41
-
42
- export {
43
- readCache,
44
- writeCache,
45
- isStale,
46
- defaultCacheDir
47
- };