@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
package/CHANGELOG.md CHANGED
@@ -8,6 +8,113 @@ breaking.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.1.6] - 2026-05-13
12
+
13
+ ### Added
14
+ - **Built-in skills bundled with the package.** The skill scanner now also
15
+ reads `skills-builtin/` shipped inside the installed npm package. First
16
+ built-in is `codeshell-help` — answers questions about code-shell itself
17
+ (slash commands, provider/model setup, settings keys, hooks, MCP,
18
+ debugging flags) so a fresh install can self-document without the user
19
+ having to write their own help skill.
20
+ - **Headless mode in Engine.** New `headless: true` config flag (set by the
21
+ `run` command) puts InvestigationGuard into soft mode: the third re-read
22
+ of the same target turns into a stronger reminder instead of a hard
23
+ block, since unattended automations have no human to retry the task.
24
+
25
+ ### Fixed
26
+ - `code-shell run` now resolves API keys / baseUrl / model from
27
+ `settings.providers[]` and `settings.models[]` in addition to the legacy
28
+ `settings.model.*` mirror — matches what Engine reconciles at startup,
29
+ fixes "no API key found" false negatives for users on the new shape.
30
+ - Read-only filesystem (CI containers) no longer floods the log with
31
+ `tool_result.persist_failed` warnings — demoted to debug.
32
+ - **Boot crash on machines with Claude Code installed.** Settings loader
33
+ previously merged `~/.claude/settings.json` into our own config for
34
+ "zero-migration from Claude Code", but CC's schema diverges (`model` is
35
+ a string there, an object here) and the merge crashed startup before
36
+ the onboarding wizard could even render. Dropped the cross-read in
37
+ `SettingsManager`, `hasApiKey()`, and the updater's autoUpdates probe.
38
+ File-level compat (CLAUDE.md scanning, `.claude/skills/` discovery) is
39
+ unaffected — only the settings.json cross-read is removed.
40
+
41
+ ## [0.1.5] - 2026-05-13
42
+
43
+ ### Added
44
+ - **Auto-installing updater.** Background update check probes `npm config get
45
+ prefix` for write permission; if writable, registers a detached `npm i -g`
46
+ on process exit so the next launch picks up the new version. File lock at
47
+ `~/.code-shell/.update.lock` (5min stale-takeover) prevents concurrent
48
+ installs from corrupting each other. Disable with `DISABLE_AUTOUPDATER=1`,
49
+ `settings.autoUpdates: false`, or dev mode. New `UpdateBanner` UI
50
+ surfaces "will install on exit" or the manual `sudo` command.
51
+ - **Provider/model two-layer redesign.** `providers[]` is now the source of
52
+ credentials/baseUrl; `models[]` references a provider by key. Legacy
53
+ flat `models[]` config auto-migrates on startup (with `.bak` snapshot).
54
+ New `ProviderModelFlow` unifies `/login` onboarding and the
55
+ ModelManager's add/refresh flows.
56
+ - **Per-provider model fetcher + cache.** `model-fetcher.ts` queries each
57
+ provider's models endpoint with a 20s timeout; `model-cache.ts` persists
58
+ results with a 7-day TTL under `~/.code-shell/cache/`.
59
+ - **/init redesign.** New per-scenario templates (create / improve /
60
+ migrate / empty / rules-scaffold) driven by a repo-state detector.
61
+ - **Tool-result-storage.** Content-addressed store keeps large tool outputs
62
+ out of in-memory history while remaining retrievable.
63
+ - **AskUser options.** The `__ask_user__` tool now supports header /
64
+ multi-choice options / multiSelect, rendered as an option picker.
65
+ - **Investigation guard.** Runtime enforcement of the "investigation has a
66
+ budget" rule from `coding.md`: re-reading the same target prepends a
67
+ reminder; a third re-read is hard-blocked. Four+ consecutive read-only
68
+ calls (or three+ silent turns) inject a strategy-change reminder.
69
+ - **Per-session verbose recorder.** Dev-only JSONL trace under `log/<date>/
70
+ session-<sid>.jsonl` capturing every LLM request/response, tool call, and
71
+ engine event. Gated on `CODE_SHELL_DEV=1` / `--debug` / running from src.
72
+ 7-day retention, argv secrets redacted, per-record output clipped to 256 KB.
73
+ - **Pasted-noise sanitizer.** Engine rejects tasks that are >70% ANSI/box
74
+ characters (typical pasted terminal output) instead of running on them.
75
+ - **Slimmer `/export markdown`.** Reasoning blocks are collapsible, tool_use
76
+ shows tool name + formatted args, tool_result over 2 KB spills to a
77
+ sidecar file alongside the markdown.
78
+ - **Live session heartbeat.** `state.json` is now flushed every turn with
79
+ current `turnCount` and token usage, so external observers see live
80
+ progress instead of a stale snapshot from the last completed run.
81
+
82
+ ### Changed (breaking)
83
+ - `SessionStatus` is now `"active" | "paused" | TerminalReason` instead of
84
+ `"active" | "paused" | "completed" | "errored"`. `state.json` records the
85
+ raw terminal reason (e.g. `aborted_streaming`, `model_error`,
86
+ `prompt_too_long`) so callers can distinguish user cancellation from real
87
+ failures. Downstream code that narrows the old four-value union will
88
+ need to widen its match.
89
+
90
+ ### Changed
91
+ - API key resolution centralized into `resolveApiKey()` (one canonical
92
+ fallback chain: option → settings → all provider env vars). Replaces five
93
+ drifting copies in `repl.ts`, `run.ts`, `runs.ts`, `main.ts`,
94
+ `core-commands.ts`. Side effect: `runs` and `/doctor` now also pick up
95
+ provider env vars they previously ignored (e.g. `OPENROUTER_API_KEY`).
96
+ - Refreshed `openrouter-models.json` (367 → 365; dropped retired Claude 3.7
97
+ Sonnet variants; corrected Kimi K2.5 / Pareto Code / MiniMax M2.5 context
98
+ windows).
99
+
100
+ ## [0.1.4] - 2026-05-09
101
+
102
+ ### Fixed
103
+ - **Multi-model `apiKey` ignored on startup.** When `settings.json` defined
104
+ a model in `models[]` (with its own `apiKey`/`baseUrl`) and the top-level
105
+ `model.apiKey` was empty, the runtime fell through to
106
+ `OPENROUTER_API_KEY` env, producing 401s against non-OpenRouter
107
+ endpoints (e.g. DeepSeek direct). Engine constructor now merges the
108
+ active pool entry's `apiKey`/`baseUrl` back into `config.llm` —
109
+ matching the existing `/model` switch path.
110
+ - **Banner version hardcoded.** `Banner.tsx`, `printBanner`, and
111
+ `commander.version()` all displayed `v0.1.0` regardless of
112
+ `package.json`. Now read dynamically via `getCurrentVersion()`.
113
+ - **`updater.ts` ESM crash.** `require("../../package.json")` is unavailable
114
+ in ESM builds. Replaced with a walk-up + `createRequire` fallback that
115
+ works in both ESM and CJS bundles. Also corrected the npm package name
116
+ used by the update check (`@cjhyy/code-shell`, not `code-shell`).
117
+
11
118
  ## [0.1.0-alpha.1] - 2026-04-30
12
119
 
13
120
  ### Changed (breaking)
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkYIQBXAYUcjs = require('./chunk-YIQBXAYU.cjs');
4
+ require('./chunk-7EG3V4JY.cjs');
5
+ require('./chunk-2YW4FPFG.cjs');
6
+ require('./chunk-IK4EWJBP.cjs');
7
+ require('./chunk-KS3RYAYL.cjs');
8
+
9
+
10
+ exports.AnthropicClient = _chunkYIQBXAYUcjs.AnthropicClient;
@@ -0,0 +1,10 @@
1
+ import {
2
+ AnthropicClient
3
+ } from "./chunk-ZBPSQCPU.js";
4
+ import "./chunk-6S4BJ65N.js";
5
+ import "./chunk-SFXHZSRF.js";
6
+ import "./chunk-BXCY2FSE.js";
7
+ import "./chunk-MD32R22I.js";
8
+ export {
9
+ AnthropicClient
10
+ };
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkX2DNIMPCcjs = require('../chunk-X2DNIMPC.cjs');
8
+ var _chunkDDB6QOKJcjs = require('../chunk-DDB6QOKJ.cjs');
9
9
 
10
10
 
11
11
 
@@ -48,10 +48,11 @@ var _chunkX2DNIMPCcjs = require('../chunk-X2DNIMPC.cjs');
48
48
 
49
49
 
50
50
 
51
- var _chunkHOXQLX5Rcjs = require('../chunk-HOXQLX5R.cjs');
52
- require('../chunk-EL2RL5DG.cjs');
53
- require('../chunk-JHNCK7JP.cjs');
54
- require('../chunk-IJSHQGMP.cjs');
51
+ var _chunkWZJV6DJCcjs = require('../chunk-WZJV6DJC.cjs');
52
+ require('../chunk-YKIAELDZ.cjs');
53
+ require('../chunk-2YW4FPFG.cjs');
54
+ require('../chunk-IK4EWJBP.cjs');
55
+ require('../chunk-KS3RYAYL.cjs');
55
56
 
56
57
 
57
58
 
@@ -100,4 +101,4 @@ require('../chunk-IJSHQGMP.cjs');
100
101
 
101
102
 
102
103
 
103
- exports.Arena = _chunkHOXQLX5Rcjs.Arena; exports.ArenaLedger = _chunkHOXQLX5Rcjs.ArenaLedger; exports.DiscussionStrategy = _chunkHOXQLX5Rcjs.DiscussionStrategy; exports.IterativeArena = _chunkX2DNIMPCcjs.IterativeArena; exports.LENS_NAMES = _chunkHOXQLX5Rcjs.LENS_NAMES; exports.MODEL_PRESETS = _chunkHOXQLX5Rcjs.MODEL_PRESETS; exports.PlanningStrategy = _chunkHOXQLX5Rcjs.PlanningStrategy; exports.ReviewStrategy = _chunkHOXQLX5Rcjs.ReviewStrategy; exports.applyReviewResult = _chunkHOXQLX5Rcjs.applyReviewResult; exports.buildConsensus = _chunkHOXQLX5Rcjs.buildConsensus; exports.buildDigest = _chunkHOXQLX5Rcjs.buildDigest; exports.buildLensPrompt = _chunkHOXQLX5Rcjs.buildLensPrompt; exports.collectEvidence = _chunkHOXQLX5Rcjs.collectEvidence; exports.createProgressRenderer = _chunkHOXQLX5Rcjs.createProgressRenderer; exports.defaultIterateConvergence = _chunkX2DNIMPCcjs.defaultConvergence; exports.formatArenaResult = _chunkHOXQLX5Rcjs.formatArenaResult; exports.formatArenaResultForSession = _chunkHOXQLX5Rcjs.formatArenaResultForSession; exports.formatDigest = _chunkHOXQLX5Rcjs.formatDigest; exports.getIterateFormat = _chunkX2DNIMPCcjs.getFormat; exports.getLens = _chunkHOXQLX5Rcjs.getLens; exports.getMaxOutputTokens = _chunkHOXQLX5Rcjs.getMaxOutputTokens; exports.getStrategy = _chunkHOXQLX5Rcjs.getStrategy; exports.getStrategyForPlan = _chunkHOXQLX5Rcjs.getStrategyForPlan; exports.hasTools = _chunkHOXQLX5Rcjs.hasTools; exports.isStrategyV2 = _chunkHOXQLX5Rcjs.isStrategyV2; exports.isTerminal = _chunkHOXQLX5Rcjs.isTerminal; exports.iterateCodeFormat = _chunkX2DNIMPCcjs.codeFormat; exports.iterateDiffRatio = _chunkX2DNIMPCcjs.diffRatio; exports.iterateDocumentFormat = _chunkX2DNIMPCcjs.documentFormat; exports.markUnderReview = _chunkHOXQLX5Rcjs.markUnderReview; exports.markUnresolved = _chunkHOXQLX5Rcjs.markUnresolved; exports.planArena = _chunkHOXQLX5Rcjs.planArena; exports.printArenaResult = _chunkHOXQLX5Rcjs.printArenaResult; exports.registerClaims = _chunkHOXQLX5Rcjs.registerClaims; exports.renderProgress = _chunkHOXQLX5Rcjs.renderProgress; exports.resolveClaimStatus = _chunkHOXQLX5Rcjs.resolveClaimStatus; exports.resolveLenses = _chunkHOXQLX5Rcjs.resolveLenses; exports.runAdjudication = _chunkHOXQLX5Rcjs.runAdjudication; exports.runCrossReview = _chunkHOXQLX5Rcjs.runCrossReview; exports.runDebateRounds = _chunkHOXQLX5Rcjs.runDebateRounds; exports.runParticipantResearch = _chunkHOXQLX5Rcjs.runParticipantResearch; exports.runParticipantResearchWithDossiers = _chunkHOXQLX5Rcjs.runParticipantResearchWithDossiers; exports.runVerificationReview = _chunkHOXQLX5Rcjs.runVerificationReview; exports.selectClaimsForReview = _chunkHOXQLX5Rcjs.selectClaimsForReview; exports.selectTools = _chunkHOXQLX5Rcjs.selectTools; exports.transitionClaim = _chunkHOXQLX5Rcjs.transitionClaim; exports.validTransitions = _chunkHOXQLX5Rcjs.validTransitions;
104
+ exports.Arena = _chunkWZJV6DJCcjs.Arena; exports.ArenaLedger = _chunkWZJV6DJCcjs.ArenaLedger; exports.DiscussionStrategy = _chunkWZJV6DJCcjs.DiscussionStrategy; exports.IterativeArena = _chunkDDB6QOKJcjs.IterativeArena; exports.LENS_NAMES = _chunkWZJV6DJCcjs.LENS_NAMES; exports.MODEL_PRESETS = _chunkWZJV6DJCcjs.MODEL_PRESETS; exports.PlanningStrategy = _chunkWZJV6DJCcjs.PlanningStrategy; exports.ReviewStrategy = _chunkWZJV6DJCcjs.ReviewStrategy; exports.applyReviewResult = _chunkWZJV6DJCcjs.applyReviewResult; exports.buildConsensus = _chunkWZJV6DJCcjs.buildConsensus; exports.buildDigest = _chunkWZJV6DJCcjs.buildDigest; exports.buildLensPrompt = _chunkWZJV6DJCcjs.buildLensPrompt; exports.collectEvidence = _chunkWZJV6DJCcjs.collectEvidence; exports.createProgressRenderer = _chunkWZJV6DJCcjs.createProgressRenderer; exports.defaultIterateConvergence = _chunkDDB6QOKJcjs.defaultConvergence; exports.formatArenaResult = _chunkWZJV6DJCcjs.formatArenaResult; exports.formatArenaResultForSession = _chunkWZJV6DJCcjs.formatArenaResultForSession; exports.formatDigest = _chunkWZJV6DJCcjs.formatDigest; exports.getIterateFormat = _chunkDDB6QOKJcjs.getFormat; exports.getLens = _chunkWZJV6DJCcjs.getLens; exports.getMaxOutputTokens = _chunkWZJV6DJCcjs.getMaxOutputTokens; exports.getStrategy = _chunkWZJV6DJCcjs.getStrategy; exports.getStrategyForPlan = _chunkWZJV6DJCcjs.getStrategyForPlan; exports.hasTools = _chunkWZJV6DJCcjs.hasTools; exports.isStrategyV2 = _chunkWZJV6DJCcjs.isStrategyV2; exports.isTerminal = _chunkWZJV6DJCcjs.isTerminal; exports.iterateCodeFormat = _chunkDDB6QOKJcjs.codeFormat; exports.iterateDiffRatio = _chunkDDB6QOKJcjs.diffRatio; exports.iterateDocumentFormat = _chunkDDB6QOKJcjs.documentFormat; exports.markUnderReview = _chunkWZJV6DJCcjs.markUnderReview; exports.markUnresolved = _chunkWZJV6DJCcjs.markUnresolved; exports.planArena = _chunkWZJV6DJCcjs.planArena; exports.printArenaResult = _chunkWZJV6DJCcjs.printArenaResult; exports.registerClaims = _chunkWZJV6DJCcjs.registerClaims; exports.renderProgress = _chunkWZJV6DJCcjs.renderProgress; exports.resolveClaimStatus = _chunkWZJV6DJCcjs.resolveClaimStatus; exports.resolveLenses = _chunkWZJV6DJCcjs.resolveLenses; exports.runAdjudication = _chunkWZJV6DJCcjs.runAdjudication; exports.runCrossReview = _chunkWZJV6DJCcjs.runCrossReview; exports.runDebateRounds = _chunkWZJV6DJCcjs.runDebateRounds; exports.runParticipantResearch = _chunkWZJV6DJCcjs.runParticipantResearch; exports.runParticipantResearchWithDossiers = _chunkWZJV6DJCcjs.runParticipantResearchWithDossiers; exports.runVerificationReview = _chunkWZJV6DJCcjs.runVerificationReview; exports.selectClaimsForReview = _chunkWZJV6DJCcjs.selectClaimsForReview; exports.selectTools = _chunkWZJV6DJCcjs.selectTools; exports.transitionClaim = _chunkWZJV6DJCcjs.transitionClaim; exports.validTransitions = _chunkWZJV6DJCcjs.validTransitions;
@@ -5,7 +5,7 @@ import {
5
5
  diffRatio,
6
6
  documentFormat,
7
7
  getFormat
8
- } from "../chunk-OUC2DFA7.js";
8
+ } from "../chunk-QARL3IDQ.js";
9
9
  import {
10
10
  Arena,
11
11
  ArenaLedger,
@@ -48,10 +48,11 @@ import {
48
48
  selectTools,
49
49
  transitionClaim,
50
50
  validTransitions
51
- } from "../chunk-Y7TSCDF6.js";
52
- import "../chunk-FUOKLKR2.js";
53
- import "../chunk-ZRVPCXI7.js";
54
- import "../chunk-DI7RDLOS.js";
51
+ } from "../chunk-BZ5TNE7L.js";
52
+ import "../chunk-3QO25N6E.js";
53
+ import "../chunk-SFXHZSRF.js";
54
+ import "../chunk-BXCY2FSE.js";
55
+ import "../chunk-MD32R22I.js";
55
56
  export {
56
57
  Arena,
57
58
  ArenaLedger,
@@ -10,5 +10,14 @@ export interface ModelPreset {
10
10
  maxOutputTokens: number;
11
11
  }
12
12
  export declare const MODEL_PRESETS: Record<string, ModelPreset>;
13
- /** Look up max output tokens for a model string, falling back to a safe default. */
13
+ /**
14
+ * Look up max output tokens for a model string, falling back to a safe default.
15
+ *
16
+ * Lookup order:
17
+ * 1. Arena preset key (e.g. "claude", "gpt") — short aliases used in arena UX
18
+ * 2. Arena preset model path (e.g. "anthropic/claude-opus-4.6")
19
+ * 3. resolveMaxOutput — the canonical table in onboarding.ts that also covers
20
+ * direct-provider IDs (deepseek-v4-pro, …) and OpenRouter snapshot
21
+ * 4. 8192 — final safe fallback
22
+ */
14
23
  export declare function getMaxOutputTokens(model: string): number;
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  ModelPool
3
- } from "./chunk-F5BS3GUC.js";
3
+ } from "./chunk-BSW22MPA.js";
4
+ import "./chunk-3OA5G4TM.js";
4
5
  import {
5
6
  SettingsManager
6
- } from "./chunk-75E4BBFC.js";
7
+ } from "./chunk-3SBSUOWZ.js";
7
8
  import {
8
9
  Arena,
9
10
  MODEL_PRESETS,
@@ -12,12 +13,13 @@ import {
12
13
  getMaxOutputTokens,
13
14
  printArenaResult,
14
15
  renderProgress
15
- } from "./chunk-Y7TSCDF6.js";
16
- import "./chunk-FUOKLKR2.js";
17
- import "./chunk-ZRVPCXI7.js";
16
+ } from "./chunk-BZ5TNE7L.js";
17
+ import "./chunk-3QO25N6E.js";
18
+ import "./chunk-SFXHZSRF.js";
19
+ import "./chunk-BXCY2FSE.js";
18
20
  import {
19
21
  init_esm_shims
20
- } from "./chunk-DI7RDLOS.js";
22
+ } from "./chunk-MD32R22I.js";
21
23
 
22
24
  // src/cli/commands/arena.ts
23
25
  init_esm_shims();
@@ -72,7 +74,7 @@ function buildModelPool(engineConfig) {
72
74
  pool.register({
73
75
  key: m.key,
74
76
  label: m.label,
75
- provider: m.provider,
77
+ provider: m.provider ?? "",
76
78
  model: m.model,
77
79
  baseUrl: m.baseUrl ?? engineConfig.llm.baseUrl,
78
80
  apiKey: m.apiKey ?? engineConfig.llm.apiKey,
@@ -1,9 +1,10 @@
1
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
2
 
3
- var _chunkKOGV6PDQcjs = require('./chunk-KOGV6PDQ.cjs');
3
+ var _chunk55XGPMAPcjs = require('./chunk-55XGPMAP.cjs');
4
+ require('./chunk-52LGZKT3.cjs');
4
5
 
5
6
 
6
- var _chunkFV2ARONZcjs = require('./chunk-FV2ARONZ.cjs');
7
+ var _chunk7BI3V74Ycjs = require('./chunk-7BI3V74Y.cjs');
7
8
 
8
9
 
9
10
 
@@ -12,15 +13,16 @@ var _chunkFV2ARONZcjs = require('./chunk-FV2ARONZ.cjs');
12
13
 
13
14
 
14
15
 
15
- var _chunkHOXQLX5Rcjs = require('./chunk-HOXQLX5R.cjs');
16
- require('./chunk-EL2RL5DG.cjs');
17
- require('./chunk-JHNCK7JP.cjs');
16
+ var _chunkWZJV6DJCcjs = require('./chunk-WZJV6DJC.cjs');
17
+ require('./chunk-YKIAELDZ.cjs');
18
+ require('./chunk-2YW4FPFG.cjs');
19
+ require('./chunk-IK4EWJBP.cjs');
18
20
 
19
21
 
20
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
22
+ var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
21
23
 
22
24
  // src/cli/commands/arena.ts
23
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
25
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
24
26
  var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
25
27
  async function runArenaReview(arg, engineConfig, opts) {
26
28
  const { models: modelsFlag, mode: explicitMode, base, head, topic } = parseFlags(arg);
@@ -38,8 +40,8 @@ async function runArenaReview(arg, engineConfig, opts) {
38
40
  out(_chalk2.default.bold(`\u2550\u2550\u2550 Arena ${modeLabel} \u2550\u2550\u2550`));
39
41
  out(_chalk2.default.dim(`Topic: ${topic}`));
40
42
  out(_chalk2.default.dim(`Models: ${participants.map((p) => p.name).join(" vs ")}`));
41
- const progressRenderer = _optionalChain([opts, 'optionalAccess', _2 => _2.output]) ? _chunkHOXQLX5Rcjs.createProgressRenderer.call(void 0, opts.output) : _chunkHOXQLX5Rcjs.renderProgress;
42
- const arena = new (0, _chunkHOXQLX5Rcjs.Arena)({
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)({
43
45
  participants,
44
46
  mode: explicitMode,
45
47
  enableContextTools: true,
@@ -53,9 +55,9 @@ async function runArenaReview(arg, engineConfig, opts) {
53
55
  });
54
56
  const resultSink = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _3 => _3.outputMessage]), () => ( _optionalChain([opts, 'optionalAccess', _4 => _4.output])));
55
57
  if (resultSink) {
56
- resultSink(_chunkHOXQLX5Rcjs.formatArenaResultForSession.call(void 0, result));
58
+ resultSink(_chunkWZJV6DJCcjs.formatArenaResultForSession.call(void 0, result));
57
59
  } else {
58
- _chunkHOXQLX5Rcjs.printArenaResult.call(void 0, result);
60
+ _chunkWZJV6DJCcjs.printArenaResult.call(void 0, result);
59
61
  }
60
62
  return result;
61
63
  } catch (err) {
@@ -64,15 +66,15 @@ async function runArenaReview(arg, engineConfig, opts) {
64
66
  }
65
67
  }
66
68
  function buildModelPool(engineConfig) {
67
- const pool = new (0, _chunkKOGV6PDQcjs.ModelPool)();
69
+ const pool = new (0, _chunk55XGPMAPcjs.ModelPool)();
68
70
  try {
69
- const settings = new (0, _chunkFV2ARONZcjs.SettingsManager)(process.cwd()).get();
71
+ const settings = new (0, _chunk7BI3V74Ycjs.SettingsManager)(process.cwd()).get();
70
72
  if (_optionalChain([settings, 'access', _5 => _5.models, 'optionalAccess', _6 => _6.length])) {
71
73
  for (const m of settings.models) {
72
74
  pool.register({
73
75
  key: m.key,
74
76
  label: m.label,
75
- provider: m.provider,
77
+ provider: _nullishCoalesce(m.provider, () => ( "")),
76
78
  model: m.model,
77
79
  baseUrl: _nullishCoalesce(m.baseUrl, () => ( engineConfig.llm.baseUrl)),
78
80
  apiKey: _nullishCoalesce(m.apiKey, () => ( engineConfig.llm.apiKey)),
@@ -96,7 +98,7 @@ function resolveOneParticipant(entry, pool, engineConfig) {
96
98
  apiKey: _nullishCoalesce(m.apiKey, () => ( engineConfig.llm.apiKey)),
97
99
  baseUrl: _nullishCoalesce(m.baseUrl, () => ( engineConfig.llm.baseUrl)),
98
100
  temperature: 0.3,
99
- maxTokens: _nullishCoalesce(m.maxOutputTokens, () => ( _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, m.model))),
101
+ maxTokens: _nullishCoalesce(m.maxOutputTokens, () => ( _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, m.model))),
100
102
  enableStreaming: false
101
103
  }
102
104
  };
@@ -109,7 +111,7 @@ function resolveOneParticipant(entry, pool, engineConfig) {
109
111
  apiKey: _nullishCoalesce(entry.apiKey, () => ( engineConfig.llm.apiKey)),
110
112
  baseUrl: _nullishCoalesce(entry.baseUrl, () => ( engineConfig.llm.baseUrl)),
111
113
  temperature: 0.3,
112
- maxTokens: _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, entry.model),
114
+ maxTokens: _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, entry.model),
113
115
  enableStreaming: false
114
116
  }
115
117
  };
@@ -129,12 +131,12 @@ function resolveParticipants(engineConfig, modelsFlag) {
129
131
  apiKey: _nullishCoalesce(fromPool.apiKey, () => ( engineConfig.llm.apiKey)),
130
132
  baseUrl: _nullishCoalesce(fromPool.baseUrl, () => ( engineConfig.llm.baseUrl)),
131
133
  temperature: 0.3,
132
- maxTokens: _nullishCoalesce(fromPool.maxOutputTokens, () => ( _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, fromPool.model))),
134
+ maxTokens: _nullishCoalesce(fromPool.maxOutputTokens, () => ( _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, fromPool.model))),
133
135
  enableStreaming: false
134
136
  }
135
137
  };
136
138
  }
137
- const preset = _chunkHOXQLX5Rcjs.MODEL_PRESETS[name];
139
+ const preset = _chunkWZJV6DJCcjs.MODEL_PRESETS[name];
138
140
  if (preset) {
139
141
  return {
140
142
  name: modelDisplayName(preset.model),
@@ -155,7 +157,7 @@ function resolveParticipants(engineConfig, modelsFlag) {
155
157
  };
156
158
  });
157
159
  }
158
- const settings = new (0, _chunkFV2ARONZcjs.SettingsManager)(process.cwd()).get();
160
+ const settings = new (0, _chunk7BI3V74Ycjs.SettingsManager)(process.cwd()).get();
159
161
  if (_optionalChain([settings, 'access', _7 => _7.arena, 'optionalAccess', _8 => _8.participants, 'optionalAccess', _9 => _9.length]) >= 2) {
160
162
  const resolved = settings.arena.participants.map((p) => resolveOneParticipant(p, pool, engineConfig)).filter((p) => p !== void 0);
161
163
  if (resolved.length >= 2) return resolved;
@@ -165,7 +167,7 @@ function resolveParticipants(engineConfig, modelsFlag) {
165
167
  name: modelDisplayName(engineConfig.llm.model),
166
168
  llm: {
167
169
  ...engineConfig.llm,
168
- maxTokens: _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, engineConfig.llm.model),
170
+ maxTokens: _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, engineConfig.llm.model),
169
171
  enableStreaming: false
170
172
  }
171
173
  }
@@ -178,7 +180,7 @@ function resolveParticipants(engineConfig, modelsFlag) {
178
180
  llm: {
179
181
  ...engineConfig.llm,
180
182
  model: opponent,
181
- maxTokens: _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, opponent),
183
+ maxTokens: _chunkWZJV6DJCcjs.getMaxOutputTokens.call(void 0, opponent),
182
184
  enableStreaming: false
183
185
  }
184
186
  });
@@ -232,7 +234,7 @@ function formatUsage() {
232
234
  " --base <ref> Base branch/ref for comparison",
233
235
  " --head <ref> Head branch/ref (default: HEAD)",
234
236
  "",
235
- `${_chalk2.default.dim("Available model presets:")} ${Object.keys(_chunkHOXQLX5Rcjs.MODEL_PRESETS).join(", ")}`
237
+ `${_chalk2.default.dim("Available model presets:")} ${Object.keys(_chunkWZJV6DJCcjs.MODEL_PRESETS).join(", ")}`
236
238
  ].join("\n");
237
239
  }
238
240
  function formatModelHelp(engineConfig) {
@@ -256,4 +258,4 @@ function modelDisplayName(model) {
256
258
 
257
259
 
258
260
 
259
- exports.formatArenaResultForSession = _chunkHOXQLX5Rcjs.formatArenaResultForSession; exports.runArenaReview = runArenaReview;
261
+ exports.formatArenaResultForSession = _chunkWZJV6DJCcjs.formatArenaResultForSession; exports.runArenaReview = runArenaReview;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
3
+ var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
4
4
 
5
5
  // src/exceptions.ts
6
- _chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
6
+ _chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
7
7
  var FrameworkError = class extends Error {
8
8
  constructor(message, details) {
9
9
  super(message);
@@ -0,0 +1,47 @@
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
+ };