@cjhyy/code-shell 0.1.0-alpha.3 → 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.
- package/CHANGELOG.md +77 -0
- package/dist/anthropic-IBTI4WL2.cjs +10 -0
- package/dist/anthropic-PRZZKHEZ.js +10 -0
- package/dist/arena/index.cjs +7 -6
- package/dist/arena/index.js +6 -5
- package/dist/arena/model-presets.d.ts +10 -1
- package/dist/{arena-HHDYYVHJ.cjs → arena-KBQOPLFV.cjs} +25 -23
- package/dist/{arena-ENHBHB2W.js → arena-O2L4TN6A.js} +9 -7
- package/dist/{chunk-SW3L7HIM.js → chunk-2EP3CLEN.js} +2 -2
- package/dist/{chunk-EL2RL5DG.cjs → chunk-2YW4FPFG.cjs} +2 -2
- package/dist/chunk-3OA5G4TM.js +47 -0
- package/dist/chunk-52LGZKT3.cjs +47 -0
- package/dist/{chunk-KOGV6PDQ.cjs → chunk-55XGPMAP.cjs} +44 -9
- package/dist/chunk-5ECBT4YA.js +450 -0
- package/dist/{chunk-YD7XTI7T.cjs → chunk-6QVAYW7C.cjs} +116 -28
- package/dist/{chunk-SCDKLTN3.js → chunk-6S4BJ65N.js} +5 -4
- package/dist/{chunk-ZLPJJZUW.js → chunk-76HYEPDM.js} +2 -2
- package/dist/{chunk-TDXBHD24.js → chunk-76W334S4.js} +2 -2
- package/dist/{chunk-GZBD6QRS.cjs → chunk-7EG3V4JY.cjs} +13 -12
- package/dist/{chunk-LMEKCQX4.js → chunk-7JVTYEEC.js} +6 -6
- package/dist/{chunk-ID6EJUHP.js → chunk-7K6SDRRF.js} +1262 -212
- package/dist/{chunk-5C5HIOML.js → chunk-7Y6S3OCX.js} +109 -21
- package/dist/{chunk-VIPLU4RY.cjs → chunk-A5LCRPDP.cjs} +4 -4
- package/dist/{chunk-F5BS3GUC.js → chunk-BSW22MPA.js} +39 -4
- package/dist/{chunk-VWFET3MG.cjs → chunk-BUU5PZK2.cjs} +1474 -423
- package/dist/{chunk-HOXQLX5R.cjs → chunk-BWTOS5BH.cjs} +444 -103
- package/dist/{chunk-ZRVPCXI7.js → chunk-BXCY2FSE.js} +2 -1
- package/dist/{chunk-Y7TSCDF6.js → chunk-C5YQBIRK.js} +347 -6
- package/dist/{chunk-C7C7ZZY4.cjs → chunk-HEKQCI7B.cjs} +10 -10
- package/dist/{chunk-JHXNOB5G.cjs → chunk-HS2MFNUC.cjs} +6 -6
- package/dist/{chunk-JHNCK7JP.cjs → chunk-IK4EWJBP.cjs} +4 -3
- package/dist/{chunk-M2QI5X3X.cjs → chunk-JMR33QVF.cjs} +2 -2
- package/dist/{chunk-YAFCN7ZW.cjs → chunk-KOVYSDHZ.cjs} +15 -15
- package/dist/{chunk-IJSHQGMP.cjs → chunk-KS3RYAYL.cjs} +4 -4
- package/dist/{chunk-DI7RDLOS.js → chunk-MD32R22I.js} +7 -4
- package/dist/chunk-MY5XHADU.cjs +216 -0
- package/dist/{chunk-OP57WUWQ.cjs → chunk-NUNC3VFB.cjs} +6 -6
- package/dist/{chunk-BF4LXLQV.cjs → chunk-QRM7IF2S.cjs} +133 -175
- package/dist/chunk-R47ROHGL.cjs +298 -0
- package/dist/{chunk-OUC2DFA7.js → chunk-RMYKO74M.js} +3 -3
- package/dist/{chunk-FUOKLKR2.js → chunk-SFXHZSRF.js} +1 -1
- package/dist/{chunk-2EUAE7AY.js → chunk-SIHHIQLO.js} +2 -2
- package/dist/{chunk-3CAZIWUA.cjs → chunk-SNT563K3.cjs} +9 -9
- package/dist/{chunk-SK62UVS6.js → chunk-T6VYG46N.js} +1 -1
- package/dist/{chunk-3QR52LL5.cjs → chunk-TUY2T5KP.cjs} +2 -2
- package/dist/{chunk-I57ZD5IQ.js → chunk-VIAGTYYW.js} +1 -1
- package/dist/{chunk-X2DNIMPC.cjs → chunk-VYL4EFRC.cjs} +32 -32
- package/dist/chunk-W22P377T.js +299 -0
- package/dist/chunk-WASS5YWB.js +215 -0
- package/dist/{chunk-FPFTIKEJ.js → chunk-XDIQWQJ4.js} +132 -174
- package/dist/{chunk-BUJ5KYCI.cjs → chunk-YIQBXAYU.cjs} +13 -13
- package/dist/{chunk-REFCCVDM.js → chunk-YJ77GQK5.js} +2 -2
- package/dist/chunk-YUI524OE.cjs +450 -0
- package/dist/{chunk-M2SVOKC6.js → chunk-ZBPSQCPU.js} +6 -6
- package/dist/cli/commands/builtin/export-md.d.ts +19 -0
- package/dist/cli/commands/builtin/init/detect.d.ts +25 -0
- package/dist/cli/commands/builtin/init/index.d.ts +19 -0
- package/dist/cli/main.cjs +2343 -1447
- package/dist/cli/main.js +2476 -1580
- package/dist/cli/migrate-models.d.ts +45 -0
- package/dist/cli/onboarding.d.ts +110 -5
- package/dist/cli/updater.d.ts +51 -4
- package/dist/client-base-HTF236ZD.cjs +9 -0
- package/dist/client-base-QKRKCOWB.js +9 -0
- package/dist/{compaction-YNWCEF7B.js → compaction-6VU2T643.js} +4 -2
- package/dist/compaction-OKUNTCA7.cjs +33 -0
- package/dist/context/compaction.d.ts +35 -3
- package/dist/context/manager.d.ts +40 -3
- package/dist/context/tool-result-storage.d.ts +96 -0
- package/dist/devtools-T2NIZBJK.cjs +6 -0
- package/dist/{devtools-IRQQPIRY.js → devtools-YXWHOVKR.js} +1 -1
- package/dist/engine/engine.d.ts +40 -0
- package/dist/engine/turn-loop.d.ts +6 -0
- package/dist/export-md-RXDW6F5W.cjs +135 -0
- package/dist/export-md-XXKZANW5.js +135 -0
- package/dist/file-history-KYPE3ECT.cjs +7 -0
- package/dist/file-history-LF4F7X26.js +7 -0
- package/dist/index.cjs +42 -22
- package/dist/index.d.ts +5 -2
- package/dist/index.js +40 -20
- package/dist/llm/client-base.d.ts +1 -1
- package/dist/llm/model-cache.d.ts +21 -0
- package/dist/llm/model-fetcher.d.ts +29 -0
- package/dist/llm/model-pool.d.ts +13 -0
- package/dist/llm/provider-catalog.d.ts +30 -0
- package/dist/llm/provider-kinds.d.ts +21 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/session-recorder.d.ts +77 -0
- package/dist/manager-C2IUXKRC.js +7 -0
- package/dist/manager-YYKWYTRM.cjs +7 -0
- package/dist/mcp-manager-QMKWPBZ4.js +8 -0
- package/dist/mcp-manager-Z3OKI74O.cjs +8 -0
- package/dist/memory-5LWZ6FI2.cjs +9 -0
- package/dist/{memory-EPFDBPII.js → memory-VIJLBAMQ.js} +2 -2
- package/dist/model-cache-5KIYL5SL.js +13 -0
- package/dist/model-cache-OED3IM4R.cjs +13 -0
- package/dist/model-fetcher-HKGICACL.js +8 -0
- package/dist/model-fetcher-UR6WJOQP.cjs +8 -0
- package/dist/openai-JR2WEKOF.js +10 -0
- package/dist/openai-YBTOET4O.cjs +10 -0
- package/dist/openrouter-models-OU4GRZQY.cjs +15 -0
- package/dist/{openrouter-models-2FM3H4SQ.js → openrouter-models-TGKDKY52.js} +2 -2
- package/dist/openrouter-sync-BBHUM3R6.cjs +11 -0
- package/dist/{openrouter-sync-SO3AWEAM.js → openrouter-sync-UXUSJCIR.js} +3 -3
- package/dist/product/index.cjs +17 -15
- package/dist/product/index.js +16 -14
- package/dist/protocol/server.d.ts +3 -1
- package/dist/protocol/types.d.ts +36 -2
- package/dist/run/index.cjs +17 -15
- package/dist/run/index.js +16 -14
- package/dist/services/index.d.ts +0 -1
- package/dist/session-manager-Q22BBMD3.js +8 -0
- package/dist/session-manager-XODQVL3C.cjs +8 -0
- package/dist/settings/schema.d.ts +267 -42
- package/dist/{tool-summary-RYNR4DDB.cjs → tool-summary-63DPIS7G.cjs} +4 -4
- package/dist/{tool-summary-2RUFL5QK.js → tool-summary-NP5CDBKG.js} +2 -2
- package/dist/tool-system/builtin/ask-user.d.ts +9 -1
- package/dist/tool-system/context.d.ts +31 -2
- package/dist/tool-system/executor.d.ts +4 -0
- package/dist/tool-system/investigation-guard.d.ts +37 -0
- package/dist/types.d.ts +13 -2
- package/dist/ui/components/AskUserPrompt.d.ts +8 -1
- package/dist/ui/components/DiffLine.d.ts +33 -0
- package/dist/ui/components/ModelManager.d.ts +34 -1
- package/dist/ui/components/OnboardingPrompt.d.ts +10 -1
- package/dist/ui/components/ProviderModelFlow.d.ts +58 -0
- package/dist/ui/components/UpdateBanner.d.ts +1 -0
- package/dist/updater-QW473OF4.cjs +17 -0
- package/dist/updater-VFUAHCVY.js +17 -0
- package/dist/utils/semver.d.ts +1 -0
- package/dist/utils/task-sanitizer.d.ts +6 -0
- package/package.json +1 -1
- package/dist/anthropic-P5VETAFI.cjs +0 -10
- package/dist/anthropic-W2GU3D76.js +0 -10
- package/dist/chunk-75E4BBFC.js +0 -224
- package/dist/chunk-FV2ARONZ.cjs +0 -224
- package/dist/client-base-TOVE25FA.js +0 -9
- package/dist/client-base-VDDIADAC.cjs +0 -9
- package/dist/compaction-D3KV2NWY.cjs +0 -31
- package/dist/devtools-WTC3NFNE.cjs +0 -6
- package/dist/file-history-HZWO2WQ5.js +0 -7
- package/dist/file-history-UQQILIY7.cjs +0 -7
- package/dist/manager-FWLOVEEK.cjs +0 -7
- package/dist/manager-GEXJLOIS.js +0 -7
- package/dist/mcp-manager-37GQLFGX.js +0 -8
- package/dist/mcp-manager-U77NEXBY.cjs +0 -8
- package/dist/memory-ADGOWADP.cjs +0 -9
- package/dist/openai-RXU5URYI.js +0 -10
- package/dist/openai-SQW4H2K4.cjs +0 -10
- package/dist/openrouter-models-PLCWZZYE.cjs +0 -15
- package/dist/openrouter-sync-K2WK3A2A.cjs +0 -11
- package/dist/services/compact.d.ts +0 -56
- package/dist/session-manager-HRSKENKB.cjs +0 -8
- package/dist/session-manager-NEKFEHF3.js +0 -8
- package/dist/updater-J7L7R6BY.cjs +0 -185
- package/dist/updater-LDBNYCAO.js +0 -185
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,83 @@ breaking.
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.1.5] - 2026-05-13
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **Auto-installing updater.** Background update check probes `npm config get
|
|
15
|
+
prefix` for write permission; if writable, registers a detached `npm i -g`
|
|
16
|
+
on process exit so the next launch picks up the new version. File lock at
|
|
17
|
+
`~/.code-shell/.update.lock` (5min stale-takeover) prevents concurrent
|
|
18
|
+
installs from corrupting each other. Disable with `DISABLE_AUTOUPDATER=1`,
|
|
19
|
+
`settings.autoUpdates: false`, or dev mode. New `UpdateBanner` UI
|
|
20
|
+
surfaces "will install on exit" or the manual `sudo` command.
|
|
21
|
+
- **Provider/model two-layer redesign.** `providers[]` is now the source of
|
|
22
|
+
credentials/baseUrl; `models[]` references a provider by key. Legacy
|
|
23
|
+
flat `models[]` config auto-migrates on startup (with `.bak` snapshot).
|
|
24
|
+
New `ProviderModelFlow` unifies `/login` onboarding and the
|
|
25
|
+
ModelManager's add/refresh flows.
|
|
26
|
+
- **Per-provider model fetcher + cache.** `model-fetcher.ts` queries each
|
|
27
|
+
provider's models endpoint with a 20s timeout; `model-cache.ts` persists
|
|
28
|
+
results with a 7-day TTL under `~/.code-shell/cache/`.
|
|
29
|
+
- **/init redesign.** New per-scenario templates (create / improve /
|
|
30
|
+
migrate / empty / rules-scaffold) driven by a repo-state detector.
|
|
31
|
+
- **Tool-result-storage.** Content-addressed store keeps large tool outputs
|
|
32
|
+
out of in-memory history while remaining retrievable.
|
|
33
|
+
- **AskUser options.** The `__ask_user__` tool now supports header /
|
|
34
|
+
multi-choice options / multiSelect, rendered as an option picker.
|
|
35
|
+
- **Investigation guard.** Runtime enforcement of the "investigation has a
|
|
36
|
+
budget" rule from `coding.md`: re-reading the same target prepends a
|
|
37
|
+
reminder; a third re-read is hard-blocked. Four+ consecutive read-only
|
|
38
|
+
calls (or three+ silent turns) inject a strategy-change reminder.
|
|
39
|
+
- **Per-session verbose recorder.** Dev-only JSONL trace under `log/<date>/
|
|
40
|
+
session-<sid>.jsonl` capturing every LLM request/response, tool call, and
|
|
41
|
+
engine event. Gated on `CODE_SHELL_DEV=1` / `--debug` / running from src.
|
|
42
|
+
7-day retention, argv secrets redacted, per-record output clipped to 256 KB.
|
|
43
|
+
- **Pasted-noise sanitizer.** Engine rejects tasks that are >70% ANSI/box
|
|
44
|
+
characters (typical pasted terminal output) instead of running on them.
|
|
45
|
+
- **Slimmer `/export markdown`.** Reasoning blocks are collapsible, tool_use
|
|
46
|
+
shows tool name + formatted args, tool_result over 2 KB spills to a
|
|
47
|
+
sidecar file alongside the markdown.
|
|
48
|
+
- **Live session heartbeat.** `state.json` is now flushed every turn with
|
|
49
|
+
current `turnCount` and token usage, so external observers see live
|
|
50
|
+
progress instead of a stale snapshot from the last completed run.
|
|
51
|
+
|
|
52
|
+
### Changed (breaking)
|
|
53
|
+
- `SessionStatus` is now `"active" | "paused" | TerminalReason` instead of
|
|
54
|
+
`"active" | "paused" | "completed" | "errored"`. `state.json` records the
|
|
55
|
+
raw terminal reason (e.g. `aborted_streaming`, `model_error`,
|
|
56
|
+
`prompt_too_long`) so callers can distinguish user cancellation from real
|
|
57
|
+
failures. Downstream code that narrows the old four-value union will
|
|
58
|
+
need to widen its match.
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
- API key resolution centralized into `resolveApiKey()` (one canonical
|
|
62
|
+
fallback chain: option → settings → all provider env vars). Replaces five
|
|
63
|
+
drifting copies in `repl.ts`, `run.ts`, `runs.ts`, `main.ts`,
|
|
64
|
+
`core-commands.ts`. Side effect: `runs` and `/doctor` now also pick up
|
|
65
|
+
provider env vars they previously ignored (e.g. `OPENROUTER_API_KEY`).
|
|
66
|
+
- Refreshed `openrouter-models.json` (367 → 365; dropped retired Claude 3.7
|
|
67
|
+
Sonnet variants; corrected Kimi K2.5 / Pareto Code / MiniMax M2.5 context
|
|
68
|
+
windows).
|
|
69
|
+
|
|
70
|
+
## [0.1.4] - 2026-05-09
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
- **Multi-model `apiKey` ignored on startup.** When `settings.json` defined
|
|
74
|
+
a model in `models[]` (with its own `apiKey`/`baseUrl`) and the top-level
|
|
75
|
+
`model.apiKey` was empty, the runtime fell through to
|
|
76
|
+
`OPENROUTER_API_KEY` env, producing 401s against non-OpenRouter
|
|
77
|
+
endpoints (e.g. DeepSeek direct). Engine constructor now merges the
|
|
78
|
+
active pool entry's `apiKey`/`baseUrl` back into `config.llm` —
|
|
79
|
+
matching the existing `/model` switch path.
|
|
80
|
+
- **Banner version hardcoded.** `Banner.tsx`, `printBanner`, and
|
|
81
|
+
`commander.version()` all displayed `v0.1.0` regardless of
|
|
82
|
+
`package.json`. Now read dynamically via `getCurrentVersion()`.
|
|
83
|
+
- **`updater.ts` ESM crash.** `require("../../package.json")` is unavailable
|
|
84
|
+
in ESM builds. Replaced with a walk-up + `createRequire` fallback that
|
|
85
|
+
works in both ESM and CJS bundles. Also corrected the npm package name
|
|
86
|
+
used by the update check (`@cjhyy/code-shell`, not `code-shell`).
|
|
87
|
+
|
|
11
88
|
## [0.1.0-alpha.1] - 2026-04-30
|
|
12
89
|
|
|
13
90
|
### 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;
|
package/dist/arena/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkVYL4EFRCcjs = require('../chunk-VYL4EFRC.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
|
|
52
|
-
require('../chunk-
|
|
53
|
-
require('../chunk-
|
|
54
|
-
require('../chunk-
|
|
51
|
+
var _chunkBWTOS5BHcjs = require('../chunk-BWTOS5BH.cjs');
|
|
52
|
+
require('../chunk-QRM7IF2S.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 =
|
|
104
|
+
exports.Arena = _chunkBWTOS5BHcjs.Arena; exports.ArenaLedger = _chunkBWTOS5BHcjs.ArenaLedger; exports.DiscussionStrategy = _chunkBWTOS5BHcjs.DiscussionStrategy; exports.IterativeArena = _chunkVYL4EFRCcjs.IterativeArena; exports.LENS_NAMES = _chunkBWTOS5BHcjs.LENS_NAMES; exports.MODEL_PRESETS = _chunkBWTOS5BHcjs.MODEL_PRESETS; exports.PlanningStrategy = _chunkBWTOS5BHcjs.PlanningStrategy; exports.ReviewStrategy = _chunkBWTOS5BHcjs.ReviewStrategy; exports.applyReviewResult = _chunkBWTOS5BHcjs.applyReviewResult; exports.buildConsensus = _chunkBWTOS5BHcjs.buildConsensus; exports.buildDigest = _chunkBWTOS5BHcjs.buildDigest; exports.buildLensPrompt = _chunkBWTOS5BHcjs.buildLensPrompt; exports.collectEvidence = _chunkBWTOS5BHcjs.collectEvidence; exports.createProgressRenderer = _chunkBWTOS5BHcjs.createProgressRenderer; exports.defaultIterateConvergence = _chunkVYL4EFRCcjs.defaultConvergence; exports.formatArenaResult = _chunkBWTOS5BHcjs.formatArenaResult; exports.formatArenaResultForSession = _chunkBWTOS5BHcjs.formatArenaResultForSession; exports.formatDigest = _chunkBWTOS5BHcjs.formatDigest; exports.getIterateFormat = _chunkVYL4EFRCcjs.getFormat; exports.getLens = _chunkBWTOS5BHcjs.getLens; exports.getMaxOutputTokens = _chunkBWTOS5BHcjs.getMaxOutputTokens; exports.getStrategy = _chunkBWTOS5BHcjs.getStrategy; exports.getStrategyForPlan = _chunkBWTOS5BHcjs.getStrategyForPlan; exports.hasTools = _chunkBWTOS5BHcjs.hasTools; exports.isStrategyV2 = _chunkBWTOS5BHcjs.isStrategyV2; exports.isTerminal = _chunkBWTOS5BHcjs.isTerminal; exports.iterateCodeFormat = _chunkVYL4EFRCcjs.codeFormat; exports.iterateDiffRatio = _chunkVYL4EFRCcjs.diffRatio; exports.iterateDocumentFormat = _chunkVYL4EFRCcjs.documentFormat; exports.markUnderReview = _chunkBWTOS5BHcjs.markUnderReview; exports.markUnresolved = _chunkBWTOS5BHcjs.markUnresolved; exports.planArena = _chunkBWTOS5BHcjs.planArena; exports.printArenaResult = _chunkBWTOS5BHcjs.printArenaResult; exports.registerClaims = _chunkBWTOS5BHcjs.registerClaims; exports.renderProgress = _chunkBWTOS5BHcjs.renderProgress; exports.resolveClaimStatus = _chunkBWTOS5BHcjs.resolveClaimStatus; exports.resolveLenses = _chunkBWTOS5BHcjs.resolveLenses; exports.runAdjudication = _chunkBWTOS5BHcjs.runAdjudication; exports.runCrossReview = _chunkBWTOS5BHcjs.runCrossReview; exports.runDebateRounds = _chunkBWTOS5BHcjs.runDebateRounds; exports.runParticipantResearch = _chunkBWTOS5BHcjs.runParticipantResearch; exports.runParticipantResearchWithDossiers = _chunkBWTOS5BHcjs.runParticipantResearchWithDossiers; exports.runVerificationReview = _chunkBWTOS5BHcjs.runVerificationReview; exports.selectClaimsForReview = _chunkBWTOS5BHcjs.selectClaimsForReview; exports.selectTools = _chunkBWTOS5BHcjs.selectTools; exports.transitionClaim = _chunkBWTOS5BHcjs.transitionClaim; exports.validTransitions = _chunkBWTOS5BHcjs.validTransitions;
|
package/dist/arena/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
diffRatio,
|
|
6
6
|
documentFormat,
|
|
7
7
|
getFormat
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-RMYKO74M.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-
|
|
52
|
-
import "../chunk-
|
|
53
|
-
import "../chunk-
|
|
54
|
-
import "../chunk-
|
|
51
|
+
} from "../chunk-C5YQBIRK.js";
|
|
52
|
+
import "../chunk-XDIQWQJ4.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
|
-
/**
|
|
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
|
"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
|
|
3
|
+
var _chunk55XGPMAPcjs = require('./chunk-55XGPMAP.cjs');
|
|
4
|
+
require('./chunk-52LGZKT3.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
var
|
|
7
|
+
var _chunkYUI524OEcjs = require('./chunk-YUI524OE.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
|
|
16
|
-
require('./chunk-
|
|
17
|
-
require('./chunk-
|
|
16
|
+
var _chunkBWTOS5BHcjs = require('./chunk-BWTOS5BH.cjs');
|
|
17
|
+
require('./chunk-QRM7IF2S.cjs');
|
|
18
|
+
require('./chunk-2YW4FPFG.cjs');
|
|
19
|
+
require('./chunk-IK4EWJBP.cjs');
|
|
18
20
|
|
|
19
21
|
|
|
20
|
-
var
|
|
22
|
+
var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
|
|
21
23
|
|
|
22
24
|
// src/cli/commands/arena.ts
|
|
23
|
-
|
|
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]) ?
|
|
42
|
-
const arena = new (0,
|
|
43
|
+
const progressRenderer = _optionalChain([opts, 'optionalAccess', _2 => _2.output]) ? _chunkBWTOS5BHcjs.createProgressRenderer.call(void 0, opts.output) : _chunkBWTOS5BHcjs.renderProgress;
|
|
44
|
+
const arena = new (0, _chunkBWTOS5BHcjs.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(
|
|
58
|
+
resultSink(_chunkBWTOS5BHcjs.formatArenaResultForSession.call(void 0, result));
|
|
57
59
|
} else {
|
|
58
|
-
|
|
60
|
+
_chunkBWTOS5BHcjs.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,
|
|
69
|
+
const pool = new (0, _chunk55XGPMAPcjs.ModelPool)();
|
|
68
70
|
try {
|
|
69
|
-
const settings = new (0,
|
|
71
|
+
const settings = new (0, _chunkYUI524OEcjs.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, () => (
|
|
101
|
+
maxTokens: _nullishCoalesce(m.maxOutputTokens, () => ( _chunkBWTOS5BHcjs.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:
|
|
114
|
+
maxTokens: _chunkBWTOS5BHcjs.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, () => (
|
|
134
|
+
maxTokens: _nullishCoalesce(fromPool.maxOutputTokens, () => ( _chunkBWTOS5BHcjs.getMaxOutputTokens.call(void 0, fromPool.model))),
|
|
133
135
|
enableStreaming: false
|
|
134
136
|
}
|
|
135
137
|
};
|
|
136
138
|
}
|
|
137
|
-
const preset =
|
|
139
|
+
const preset = _chunkBWTOS5BHcjs.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,
|
|
160
|
+
const settings = new (0, _chunkYUI524OEcjs.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:
|
|
170
|
+
maxTokens: _chunkBWTOS5BHcjs.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:
|
|
183
|
+
maxTokens: _chunkBWTOS5BHcjs.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(
|
|
237
|
+
`${_chalk2.default.dim("Available model presets:")} ${Object.keys(_chunkBWTOS5BHcjs.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 =
|
|
261
|
+
exports.formatArenaResultForSession = _chunkBWTOS5BHcjs.formatArenaResultForSession; exports.runArenaReview = runArenaReview;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ModelPool
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BSW22MPA.js";
|
|
4
|
+
import "./chunk-3OA5G4TM.js";
|
|
4
5
|
import {
|
|
5
6
|
SettingsManager
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5ECBT4YA.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-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-C5YQBIRK.js";
|
|
17
|
+
import "./chunk-XDIQWQJ4.js";
|
|
18
|
+
import "./chunk-SFXHZSRF.js";
|
|
19
|
+
import "./chunk-BXCY2FSE.js";
|
|
18
20
|
import {
|
|
19
21
|
init_esm_shims
|
|
20
|
-
} from "./chunk-
|
|
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,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
|
|
4
4
|
|
|
5
5
|
// src/exceptions.ts
|
|
6
|
-
|
|
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
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
|
|
4
|
+
|
|
5
|
+
// src/llm/model-cache.ts
|
|
6
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
7
|
+
var _fs = require('fs');
|
|
8
|
+
var _os = require('os');
|
|
9
|
+
var _path = require('path');
|
|
10
|
+
var TTL_MS = 7 * 24 * 3600 * 1e3;
|
|
11
|
+
function readCache(cacheDir, providerKey) {
|
|
12
|
+
const path = _path.join.call(void 0, cacheDir, `${providerKey}.json`);
|
|
13
|
+
if (!_fs.existsSync.call(void 0, path)) return void 0;
|
|
14
|
+
try {
|
|
15
|
+
const raw = _fs.readFileSync.call(void 0, path, "utf-8");
|
|
16
|
+
const parsed = JSON.parse(raw);
|
|
17
|
+
if (!parsed || !Array.isArray(parsed.models)) return void 0;
|
|
18
|
+
return parsed;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function writeCache(cacheDir, providerKey, models) {
|
|
24
|
+
if (!_fs.existsSync.call(void 0, cacheDir)) _fs.mkdirSync.call(void 0, cacheDir, { recursive: true });
|
|
25
|
+
const payload = {
|
|
26
|
+
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
27
|
+
providerKey,
|
|
28
|
+
models
|
|
29
|
+
};
|
|
30
|
+
_fs.writeFileSync.call(void 0, _path.join.call(void 0, 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 _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "cache", "models");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
exports.readCache = readCache; exports.writeCache = writeCache; exports.isStale = isStale; exports.defaultCacheDir = defaultCacheDir;
|
|
@@ -1,9 +1,12 @@
|
|
|
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; } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk52LGZKT3cjs = require('./chunk-52LGZKT3.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
|
|
4
7
|
|
|
5
8
|
// src/llm/model-pool.ts
|
|
6
|
-
|
|
9
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
7
10
|
var BUILTIN_CONTEXT_WINDOWS = [
|
|
8
11
|
// DeepSeek V4 family — 1M context (api-docs.deepseek.com)
|
|
9
12
|
[/^deepseek-v4(?:-|$)/i, 1e6],
|
|
@@ -18,6 +21,32 @@ function lookupBuiltinContextWindow(model) {
|
|
|
18
21
|
var ModelPool = (_class = class {
|
|
19
22
|
__init() {this.models = /* @__PURE__ */ new Map()}
|
|
20
23
|
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
setProviderCatalog(cat) {
|
|
27
|
+
this.providerCatalog = cat;
|
|
28
|
+
}
|
|
29
|
+
setCacheDir(dir) {
|
|
30
|
+
this.cacheDir = dir;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* For each entry in the pool that lacks an explicit maxContextTokens
|
|
34
|
+
* but has a providerKey, look up the contextLength from the cached
|
|
35
|
+
* model list and patch it in.
|
|
36
|
+
*/
|
|
37
|
+
reloadCachedContextWindows() {
|
|
38
|
+
if (!this.cacheDir) return;
|
|
39
|
+
for (const [key, entry] of this.models) {
|
|
40
|
+
if (entry.maxContextTokens != null) continue;
|
|
41
|
+
if (!entry.providerKey) continue;
|
|
42
|
+
const file = _chunk52LGZKT3cjs.readCache.call(void 0, this.cacheDir, entry.providerKey);
|
|
43
|
+
if (!file) continue;
|
|
44
|
+
const match = file.models.find((m) => m.id === entry.model);
|
|
45
|
+
if (_optionalChain([match, 'optionalAccess', _ => _.contextLength])) {
|
|
46
|
+
this.models.set(key, { ...entry, maxContextTokens: match.contextLength });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
21
50
|
/**
|
|
22
51
|
* Build a pool from an array of model entries.
|
|
23
52
|
* The first entry (or the one matching `defaultKey`) becomes active.
|
|
@@ -30,7 +59,7 @@ var ModelPool = (_class = class {
|
|
|
30
59
|
}
|
|
31
60
|
if (defaultKey && this.models.has(defaultKey)) {
|
|
32
61
|
this.activeKey = defaultKey;
|
|
33
|
-
} else if (_optionalChain([entries, 'optionalAccess',
|
|
62
|
+
} else if (_optionalChain([entries, 'optionalAccess', _2 => _2.length])) {
|
|
34
63
|
this.activeKey = entries[0].key;
|
|
35
64
|
}
|
|
36
65
|
}
|
|
@@ -85,14 +114,20 @@ var ModelPool = (_class = class {
|
|
|
85
114
|
* (inherits apiKey, baseUrl, etc. from the base if not set on the entry).
|
|
86
115
|
*/
|
|
87
116
|
toLLMConfig(entry, base) {
|
|
117
|
+
const fromCat = entry.providerKey && this.providerCatalog ? this.providerCatalog.get(entry.providerKey) : void 0;
|
|
118
|
+
const kindToClientProvider = (kind) => {
|
|
119
|
+
if (!kind) return "openai";
|
|
120
|
+
if (kind === "anthropic") return "anthropic";
|
|
121
|
+
return "openai";
|
|
122
|
+
};
|
|
88
123
|
return {
|
|
89
|
-
provider: entry.provider,
|
|
124
|
+
provider: entry.provider || kindToClientProvider(_optionalChain([fromCat, 'optionalAccess', _3 => _3.kind])) || "openai",
|
|
90
125
|
model: entry.model,
|
|
91
|
-
apiKey: _nullishCoalesce(entry.apiKey, () => ( _optionalChain([base, 'optionalAccess',
|
|
92
|
-
baseUrl: _nullishCoalesce(entry.baseUrl, () => ( _optionalChain([base, 'optionalAccess',
|
|
93
|
-
temperature: _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
94
|
-
maxTokens: _nullishCoalesce(_nullishCoalesce(entry.maxOutputTokens, () => ( _optionalChain([base, 'optionalAccess',
|
|
95
|
-
enableStreaming: _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
126
|
+
apiKey: _nullishCoalesce(_nullishCoalesce(entry.apiKey, () => ( _optionalChain([fromCat, 'optionalAccess', _4 => _4.apiKey]))), () => ( _optionalChain([base, 'optionalAccess', _5 => _5.apiKey]))),
|
|
127
|
+
baseUrl: _nullishCoalesce(_nullishCoalesce(entry.baseUrl, () => ( _optionalChain([fromCat, 'optionalAccess', _6 => _6.baseUrl]))), () => ( _optionalChain([base, 'optionalAccess', _7 => _7.baseUrl]))),
|
|
128
|
+
temperature: _nullishCoalesce(_optionalChain([base, 'optionalAccess', _8 => _8.temperature]), () => ( 0.3)),
|
|
129
|
+
maxTokens: _nullishCoalesce(_nullishCoalesce(entry.maxOutputTokens, () => ( _optionalChain([base, 'optionalAccess', _9 => _9.maxTokens]))), () => ( 8192)),
|
|
130
|
+
enableStreaming: _nullishCoalesce(_optionalChain([base, 'optionalAccess', _10 => _10.enableStreaming]), () => ( true))
|
|
96
131
|
};
|
|
97
132
|
}
|
|
98
133
|
/**
|