@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.
- package/dist/anthropic-OVRWAZRD.js +1 -0
- package/dist/arena/index.js +1 -104
- package/dist/arena-64T2EQD4.js +3 -0
- package/dist/bwrap-PVZMLHZR.js +2 -0
- package/dist/chunk-2EUIMKJA.js +1 -0
- package/dist/chunk-2GJ7H5NC.js +641 -0
- package/dist/chunk-2OD6VR4N.js +2 -0
- package/dist/chunk-3QP5BQ3L.js +1 -0
- package/dist/chunk-A4M2Y42L.js +2 -0
- package/dist/chunk-DEYFK6FP.js +1 -0
- package/dist/chunk-DTPABBSV.js +2 -0
- package/dist/chunk-EU3J7TBP.js +1 -0
- package/dist/chunk-FU7AHZNN.js +1 -0
- package/dist/chunk-L7B2ORID.js +4 -0
- package/dist/chunk-M7VU4YVY.js +49 -0
- package/dist/chunk-MGP35GKD.js +254 -0
- package/dist/chunk-MLCTC53I.js +1 -0
- package/dist/chunk-O5HFCH2U.js +1 -0
- package/dist/chunk-P6JSTIFM.js +1 -0
- package/dist/chunk-Q3RSX66I.js +1 -0
- package/dist/chunk-QTWU7UNA.js +5 -0
- package/dist/chunk-RERBX75D.js +251 -0
- package/dist/chunk-SNFAPSLA.js +1 -0
- package/dist/chunk-T222K6IV.js +18 -0
- package/dist/chunk-TKJA6W36.js +3 -0
- package/dist/chunk-VKKU4LOM.js +3 -0
- package/dist/chunk-WI6FSWGU.js +1 -0
- package/dist/chunk-XXCZE2U2.js +2 -0
- package/dist/chunk-ZSAONDT6.js +2 -0
- package/dist/cli/main.js +303 -22060
- package/dist/cli/onboarding.d.ts +7 -2
- package/dist/client-base-F5FCRSB3.js +1 -0
- package/dist/compaction-L3Y6NG4N.js +1 -0
- package/dist/context/compaction.d.ts +2 -1
- package/dist/data/static-catalogs.d.ts +25 -0
- package/dist/devtools-SGDUOOM4.js +1 -0
- package/dist/engine/engine.d.ts +24 -0
- package/dist/engine/turn-loop.d.ts +20 -0
- package/dist/export-md-U72T7NW7.js +22 -0
- package/dist/file-history-7FQFEQOL.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -347
- package/dist/llm/capabilities/index.d.ts +20 -0
- package/dist/llm/capabilities/rules.d.ts +26 -0
- package/dist/llm/capabilities/types.d.ts +108 -0
- package/dist/llm/model-pool.d.ts +7 -0
- package/dist/llm/provider-catalog.d.ts +2 -0
- package/dist/llm/provider-kinds.d.ts +1 -1
- package/dist/llm/providers/openai.d.ts +22 -0
- package/dist/llm/token-counter.d.ts +17 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/logger.d.ts +10 -2
- package/dist/logging/session-recorder.d.ts +16 -3
- package/dist/manager-J6FXEUEK.js +1 -0
- package/dist/mcp-manager-27EVBKRT.js +1 -0
- package/dist/memory-BNI4WEWL.js +1 -0
- package/dist/model-cache-HEDXI7UJ.js +1 -0
- package/dist/model-fetcher-X5W5EASG.js +1 -0
- package/dist/off-7SDVMMXW.js +1 -0
- package/dist/openai-3QEADSYL.js +1 -0
- package/dist/openrouter-models-GZVCRWD2.js +1 -0
- package/dist/openrouter-sync-WG4AG5NC.js +1 -0
- package/dist/product/index.js +1 -21
- package/dist/protocol/client.d.ts +1 -1
- package/dist/run/index.js +1 -48
- package/dist/seatbelt-L54CNI2Y.js +37 -0
- package/dist/session/session-manager.d.ts +2 -0
- package/dist/session-manager-AGWS5SMJ.js +1 -0
- package/dist/settings/schema.d.ts +147 -21
- package/dist/tool-summary-V2B3MD5N.js +2 -0
- package/dist/tool-system/builtin/bash.d.ts +7 -1
- package/dist/tool-system/context.d.ts +7 -0
- package/dist/tool-system/executor.d.ts +4 -0
- package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
- package/dist/tool-system/sandbox/index.d.ts +78 -0
- package/dist/tool-system/sandbox/off.d.ts +2 -0
- package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
- package/dist/tool-system/task-guard.d.ts +30 -0
- package/dist/types.d.ts +17 -0
- package/dist/ui/components/SessionPicker.d.ts +2 -0
- package/dist/ui/components/SpinnerWithVerb.d.ts +7 -2
- package/dist/ui/components/StatusLine.d.ts +7 -3
- package/dist/updater-OCNU2K2Z.js +1 -0
- package/package.json +7 -10
- package/dist/anthropic-IBTI4WL2.cjs +0 -10
- package/dist/anthropic-PRZZKHEZ.js +0 -10
- package/dist/arena/index.cjs +0 -104
- package/dist/arena-2LTLIXOL.js +0 -261
- package/dist/arena-ADB7DRFI.cjs +0 -261
- package/dist/chunk-2YW4FPFG.cjs +0 -101
- package/dist/chunk-3OA5G4TM.js +0 -47
- package/dist/chunk-3QO25N6E.js +0 -4711
- package/dist/chunk-3SBSUOWZ.js +0 -447
- package/dist/chunk-52LGZKT3.cjs +0 -47
- package/dist/chunk-55XGPMAP.cjs +0 -146
- package/dist/chunk-6QVAYW7C.cjs +0 -438
- package/dist/chunk-6S4BJ65N.js +0 -113
- package/dist/chunk-76HYEPDM.js +0 -307
- package/dist/chunk-7BI3V74Y.cjs +0 -447
- package/dist/chunk-7EG3V4JY.cjs +0 -113
- package/dist/chunk-7JVTYEEC.js +0 -340
- package/dist/chunk-7QIM3BKD.js +0 -44
- package/dist/chunk-7Y6S3OCX.js +0 -438
- package/dist/chunk-ABRRONJ7.js +0 -107
- package/dist/chunk-BSW22MPA.js +0 -146
- package/dist/chunk-BXCY2FSE.js +0 -203
- package/dist/chunk-BZ5TNE7L.js +0 -5128
- package/dist/chunk-DDB6QOKJ.cjs +0 -1252
- package/dist/chunk-HEKQCI7B.cjs +0 -224
- package/dist/chunk-IK4EWJBP.cjs +0 -203
- package/dist/chunk-ILHE7XLT.cjs +0 -107
- package/dist/chunk-JMR33QVF.cjs +0 -169
- package/dist/chunk-KAQHULYN.js +0 -54
- package/dist/chunk-KE4EQOWA.js +0 -294
- package/dist/chunk-KOVYSDHZ.cjs +0 -340
- package/dist/chunk-KS3RYAYL.cjs +0 -45
- package/dist/chunk-MD32R22I.js +0 -50
- package/dist/chunk-MV7YI4WO.cjs +0 -293
- package/dist/chunk-MY5XHADU.cjs +0 -216
- package/dist/chunk-NUNC3VFB.cjs +0 -307
- package/dist/chunk-PKGRTCCY.js +0 -9092
- package/dist/chunk-QARL3IDQ.js +0 -1252
- package/dist/chunk-S754JHLR.cjs +0 -54
- package/dist/chunk-SFXHZSRF.js +0 -101
- package/dist/chunk-SIHHIQLO.js +0 -224
- package/dist/chunk-T6VYG46N.js +0 -105
- package/dist/chunk-TNLGBJYS.cjs +0 -44
- package/dist/chunk-TUY2T5KP.cjs +0 -105
- package/dist/chunk-UXOCVJJ6.cjs +0 -9092
- package/dist/chunk-VIAGTYYW.js +0 -169
- package/dist/chunk-WASS5YWB.js +0 -215
- package/dist/chunk-WZJV6DJC.cjs +0 -5128
- package/dist/chunk-YIQBXAYU.cjs +0 -264
- package/dist/chunk-YKIAELDZ.cjs +0 -4711
- package/dist/chunk-ZBPSQCPU.js +0 -264
- package/dist/cli/main.cjs +0 -22156
- package/dist/client-base-HTF236ZD.cjs +0 -9
- package/dist/client-base-QKRKCOWB.js +0 -9
- package/dist/compaction-6VU2T643.js +0 -33
- package/dist/compaction-OKUNTCA7.cjs +0 -33
- package/dist/devtools-T2NIZBJK.cjs +0 -6
- package/dist/devtools-YXWHOVKR.js +0 -6
- package/dist/export-md-RXDW6F5W.cjs +0 -135
- package/dist/export-md-XXKZANW5.js +0 -135
- package/dist/file-history-KYPE3ECT.cjs +0 -7
- package/dist/file-history-LF4F7X26.js +0 -7
- package/dist/index.cjs +0 -347
- package/dist/manager-D65VFAPX.js +0 -7
- package/dist/manager-TTF5VHJC.cjs +0 -7
- package/dist/mcp-manager-QMKWPBZ4.js +0 -8
- package/dist/mcp-manager-Z3OKI74O.cjs +0 -8
- package/dist/memory-5LWZ6FI2.cjs +0 -9
- package/dist/memory-VIJLBAMQ.js +0 -9
- package/dist/model-cache-5KIYL5SL.js +0 -13
- package/dist/model-cache-OED3IM4R.cjs +0 -13
- package/dist/model-fetcher-HKGICACL.js +0 -8
- package/dist/model-fetcher-UR6WJOQP.cjs +0 -8
- package/dist/openai-JR2WEKOF.js +0 -10
- package/dist/openai-YBTOET4O.cjs +0 -10
- package/dist/openrouter-models-H56GHBHN.js +0 -15
- package/dist/openrouter-models-TWUFWZ5T.cjs +0 -15
- package/dist/openrouter-sync-5VMGN6C2.cjs +0 -11
- package/dist/openrouter-sync-ALEMF5IU.js +0 -11
- package/dist/product/index.cjs +0 -21
- package/dist/run/index.cjs +0 -48
- package/dist/session-manager-Q22BBMD3.js +0 -8
- package/dist/session-manager-XODQVL3C.cjs +0 -8
- package/dist/tool-summary-63DPIS7G.cjs +0 -31
- package/dist/tool-summary-NP5CDBKG.js +0 -31
- package/dist/updater-I7QBW4DP.cjs +0 -17
- package/dist/updater-NVME5S3Z.js +0 -17
package/dist/types.d.ts
CHANGED
|
@@ -169,6 +169,7 @@ export interface TaskInfo {
|
|
|
169
169
|
export type StreamEvent = {
|
|
170
170
|
type: "session_started";
|
|
171
171
|
sessionId: string;
|
|
172
|
+
promptTokens: number;
|
|
172
173
|
} | {
|
|
173
174
|
type: "stream_request_start";
|
|
174
175
|
turnNumber: number;
|
|
@@ -176,6 +177,7 @@ export type StreamEvent = {
|
|
|
176
177
|
} | {
|
|
177
178
|
type: "text_delta";
|
|
178
179
|
text: string;
|
|
180
|
+
tokens?: number;
|
|
179
181
|
agentId?: string;
|
|
180
182
|
} | {
|
|
181
183
|
type: "tool_use_start";
|
|
@@ -247,6 +249,19 @@ export interface LLMConfig {
|
|
|
247
249
|
timeout?: number;
|
|
248
250
|
retryMaxAttempts?: number;
|
|
249
251
|
enableStreaming?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Default thinking-mode for DeepSeek V4. Per-call `options.thinking`
|
|
254
|
+
* (e.g. summarize sub-calls) overrides this. Ignored on other providers.
|
|
255
|
+
*/
|
|
256
|
+
thinking?: "enabled" | "disabled";
|
|
257
|
+
/**
|
|
258
|
+
* The provider's `kind` (deepseek/openai/zai/openrouter/...). Used by
|
|
259
|
+
* the capability layer to look up per-(kind, model) request-shape rules
|
|
260
|
+
* (token-limit field, rejected sampling params, thinking shape, etc.).
|
|
261
|
+
* Distinct from `provider` above, which is the protocol family
|
|
262
|
+
* ("openai" or "anthropic") that picks which client class to use.
|
|
263
|
+
*/
|
|
264
|
+
providerKind?: string;
|
|
250
265
|
}
|
|
251
266
|
export interface LLMResponse {
|
|
252
267
|
text: string;
|
|
@@ -258,6 +273,8 @@ export interface LLMResponse {
|
|
|
258
273
|
export interface LLMStreamChunk {
|
|
259
274
|
type: "text" | "tool_use_start" | "tool_use_delta" | "tool_use_end" | "stop";
|
|
260
275
|
text?: string;
|
|
276
|
+
/** Token count for this text delta, when provider can compute it. */
|
|
277
|
+
tokens?: number;
|
|
261
278
|
toolCall?: Partial<ToolCall>;
|
|
262
279
|
stopReason?: string;
|
|
263
280
|
}
|
|
@@ -5,9 +5,14 @@ import { type MutableRefObject } from "react";
|
|
|
5
5
|
export type SpinnerMode = "responding" | "tool-use" | "thinking";
|
|
6
6
|
interface SpinnerWithVerbProps {
|
|
7
7
|
mode: SpinnerMode;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Per-turn streamed token count — used purely as a "still alive" signal so
|
|
10
|
+
* the user sees activity. NOT a measure of context size; that's in the
|
|
11
|
+
* StatusLine ctx bar.
|
|
12
|
+
*/
|
|
13
|
+
streamingTokensRef?: MutableRefObject<number>;
|
|
9
14
|
runStartRef?: MutableRefObject<number>;
|
|
10
15
|
thinkingContent?: string;
|
|
11
16
|
}
|
|
12
|
-
export declare function SpinnerWithVerb({ mode,
|
|
17
|
+
export declare function SpinnerWithVerb({ mode, streamingTokensRef, runStartRef, thinkingContent, }: SpinnerWithVerbProps): import("react/jsx-runtime").JSX.Element;
|
|
13
18
|
export {};
|
|
@@ -12,13 +12,17 @@ interface StatusLineProps {
|
|
|
12
12
|
tokens: number;
|
|
13
13
|
cost: number;
|
|
14
14
|
sessionId?: string;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Authoritative live context size. The engine emits `usage_update` at every
|
|
17
|
+
* message-array mutation (post-tool-result, post-compact, post-LLM), so this
|
|
18
|
+
* tracks the real prompt token count without UI-side accumulation.
|
|
19
|
+
*/
|
|
16
20
|
baseContextTokens?: number;
|
|
17
21
|
maxContextTokens?: number;
|
|
18
22
|
gitBranch?: string;
|
|
19
23
|
isRunning?: boolean;
|
|
20
|
-
|
|
24
|
+
streamingTokensRef?: MutableRefObject<number>;
|
|
21
25
|
runStartRef?: MutableRefObject<number>;
|
|
22
26
|
}
|
|
23
|
-
export declare function StatusLine({ model, effort, tokens, cost, sessionId, baseContextTokens, maxContextTokens, gitBranch, isRunning,
|
|
27
|
+
export declare function StatusLine({ model, effort, tokens, cost, sessionId, baseContextTokens, maxContextTokens, gitBranch, isRunning, streamingTokensRef, runStartRef, }: StatusLineProps): import("react/jsx-runtime").JSX.Element;
|
|
24
28
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as __internal,a as checkForUpdate,c as getAutoUpdateDisabledReason,e as getCurrentVersion,b as getUpdateAvailable,d as scheduleAutoInstallOnExit}from'./chunk-TKJA6W36.js';import'./chunk-3QP5BQ3L.js';
|
package/package.json
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cjhyy/code-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Code Shell — general-purpose agent orchestration framework with a terminal coding preset",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js"
|
|
13
|
-
"require": "./dist/index.cjs"
|
|
12
|
+
"import": "./dist/index.js"
|
|
14
13
|
},
|
|
15
14
|
"./run": {
|
|
16
15
|
"types": "./dist/run/index.d.ts",
|
|
17
|
-
"import": "./dist/run/index.js"
|
|
18
|
-
"require": "./dist/run/index.cjs"
|
|
16
|
+
"import": "./dist/run/index.js"
|
|
19
17
|
},
|
|
20
18
|
"./arena": {
|
|
21
19
|
"types": "./dist/arena/index.d.ts",
|
|
22
|
-
"import": "./dist/arena/index.js"
|
|
23
|
-
"require": "./dist/arena/index.cjs"
|
|
20
|
+
"import": "./dist/arena/index.js"
|
|
24
21
|
},
|
|
25
22
|
"./product": {
|
|
26
23
|
"types": "./dist/product/index.d.ts",
|
|
27
|
-
"import": "./dist/product/index.js"
|
|
28
|
-
"require": "./dist/product/index.cjs"
|
|
24
|
+
"import": "./dist/product/index.js"
|
|
29
25
|
},
|
|
30
26
|
"./package.json": "./package.json"
|
|
31
27
|
},
|
|
@@ -95,6 +91,7 @@
|
|
|
95
91
|
"emoji-regex": "^10.6.0",
|
|
96
92
|
"get-east-asian-width": "^1.5.0",
|
|
97
93
|
"glob": "^11.0.0",
|
|
94
|
+
"gpt-tokenizer": "^3.4.0",
|
|
98
95
|
"indent-string": "^5.0.0",
|
|
99
96
|
"lodash-es": "^4.17.23",
|
|
100
97
|
"marked": "^17.0.5",
|
|
@@ -1,10 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkDDB6QOKJcjs = require('../chunk-DDB6QOKJ.cjs');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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');
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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;
|
package/dist/arena-2LTLIXOL.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ModelPool
|
|
3
|
-
} from "./chunk-BSW22MPA.js";
|
|
4
|
-
import "./chunk-3OA5G4TM.js";
|
|
5
|
-
import {
|
|
6
|
-
SettingsManager
|
|
7
|
-
} from "./chunk-3SBSUOWZ.js";
|
|
8
|
-
import {
|
|
9
|
-
Arena,
|
|
10
|
-
MODEL_PRESETS,
|
|
11
|
-
createProgressRenderer,
|
|
12
|
-
formatArenaResultForSession,
|
|
13
|
-
getMaxOutputTokens,
|
|
14
|
-
printArenaResult,
|
|
15
|
-
renderProgress
|
|
16
|
-
} from "./chunk-BZ5TNE7L.js";
|
|
17
|
-
import "./chunk-3QO25N6E.js";
|
|
18
|
-
import "./chunk-SFXHZSRF.js";
|
|
19
|
-
import "./chunk-BXCY2FSE.js";
|
|
20
|
-
import {
|
|
21
|
-
init_esm_shims
|
|
22
|
-
} from "./chunk-MD32R22I.js";
|
|
23
|
-
|
|
24
|
-
// src/cli/commands/arena.ts
|
|
25
|
-
init_esm_shims();
|
|
26
|
-
import chalk from "chalk";
|
|
27
|
-
async function runArenaReview(arg, engineConfig, opts) {
|
|
28
|
-
const { models: modelsFlag, mode: explicitMode, base, head, topic } = parseFlags(arg);
|
|
29
|
-
const out = opts?.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(chalk.bold(`\u2550\u2550\u2550 Arena ${modeLabel} \u2550\u2550\u2550`));
|
|
41
|
-
out(chalk.dim(`Topic: ${topic}`));
|
|
42
|
-
out(chalk.dim(`Models: ${participants.map((p) => p.name).join(" vs ")}`));
|
|
43
|
-
const progressRenderer = opts?.output ? createProgressRenderer(opts.output) : renderProgress;
|
|
44
|
-
const arena = new 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 = opts?.outputMessage ?? opts?.output;
|
|
57
|
-
if (resultSink) {
|
|
58
|
-
resultSink(formatArenaResultForSession(result));
|
|
59
|
-
} else {
|
|
60
|
-
printArenaResult(result);
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
} catch (err) {
|
|
64
|
-
out(chalk.red(`Arena failed: ${err.message}`));
|
|
65
|
-
return void 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function buildModelPool(engineConfig) {
|
|
69
|
-
const pool = new ModelPool();
|
|
70
|
-
try {
|
|
71
|
-
const settings = new SettingsManager(process.cwd()).get();
|
|
72
|
-
if (settings.models?.length) {
|
|
73
|
-
for (const m of settings.models) {
|
|
74
|
-
pool.register({
|
|
75
|
-
key: m.key,
|
|
76
|
-
label: m.label,
|
|
77
|
-
provider: m.provider ?? "",
|
|
78
|
-
model: m.model,
|
|
79
|
-
baseUrl: m.baseUrl ?? engineConfig.llm.baseUrl,
|
|
80
|
-
apiKey: m.apiKey ?? engineConfig.llm.apiKey,
|
|
81
|
-
maxOutputTokens: m.maxOutputTokens
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch {
|
|
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: m.label ?? modelDisplayName(m.model),
|
|
95
|
-
llm: {
|
|
96
|
-
provider: m.provider,
|
|
97
|
-
model: m.model,
|
|
98
|
-
apiKey: m.apiKey ?? engineConfig.llm.apiKey,
|
|
99
|
-
baseUrl: m.baseUrl ?? engineConfig.llm.baseUrl,
|
|
100
|
-
temperature: 0.3,
|
|
101
|
-
maxTokens: m.maxOutputTokens ?? getMaxOutputTokens(m.model),
|
|
102
|
-
enableStreaming: false
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
name: entry.name,
|
|
108
|
-
llm: {
|
|
109
|
-
provider: entry.provider ?? engineConfig.llm.provider,
|
|
110
|
-
model: entry.model,
|
|
111
|
-
apiKey: entry.apiKey ?? engineConfig.llm.apiKey,
|
|
112
|
-
baseUrl: entry.baseUrl ?? engineConfig.llm.baseUrl,
|
|
113
|
-
temperature: 0.3,
|
|
114
|
-
maxTokens: getMaxOutputTokens(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: fromPool.label ?? modelDisplayName(fromPool.model),
|
|
128
|
-
llm: {
|
|
129
|
-
provider: fromPool.provider,
|
|
130
|
-
model: fromPool.model,
|
|
131
|
-
apiKey: fromPool.apiKey ?? engineConfig.llm.apiKey,
|
|
132
|
-
baseUrl: fromPool.baseUrl ?? engineConfig.llm.baseUrl,
|
|
133
|
-
temperature: 0.3,
|
|
134
|
-
maxTokens: fromPool.maxOutputTokens ?? getMaxOutputTokens(fromPool.model),
|
|
135
|
-
enableStreaming: false
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
const preset = 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 SettingsManager(process.cwd()).get();
|
|
161
|
-
if (settings.arena?.participants?.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: getMaxOutputTokens(engineConfig.llm.model),
|
|
171
|
-
enableStreaming: false
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
];
|
|
175
|
-
if (engineConfig.llm.baseUrl?.includes("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: getMaxOutputTokens(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(chalk.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
|
-
chalk.bold("Arena \u2014 Multi-model collaborative analysis"),
|
|
221
|
-
"",
|
|
222
|
-
chalk.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
|
-
`${chalk.dim("Modes:")} review (default), discussion, planning`,
|
|
231
|
-
chalk.dim("Mode is auto-detected from the topic if --mode is not specified."),
|
|
232
|
-
"",
|
|
233
|
-
chalk.dim("Flags:"),
|
|
234
|
-
" --base <ref> Base branch/ref for comparison",
|
|
235
|
-
" --head <ref> Head branch/ref (default: HEAD)",
|
|
236
|
-
"",
|
|
237
|
-
`${chalk.dim("Available model presets:")} ${Object.keys(MODEL_PRESETS).join(", ")}`
|
|
238
|
-
].join("\n");
|
|
239
|
-
}
|
|
240
|
-
function formatModelHelp(engineConfig) {
|
|
241
|
-
return [
|
|
242
|
-
chalk.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 = model.split("/").pop() ?? model;
|
|
256
|
-
return last.replace(/-\d.*$/, "").split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
257
|
-
}
|
|
258
|
-
export {
|
|
259
|
-
formatArenaResultForSession,
|
|
260
|
-
runArenaReview
|
|
261
|
-
};
|