@cjhyy/code-shell 0.1.0-alpha.1 → 0.1.0-alpha.3
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/README.md +8 -0
- package/dist/anthropic-P5VETAFI.cjs +10 -0
- package/dist/{anthropic-NENYS535.js → anthropic-W2GU3D76.js} +3 -2
- package/dist/arena/context/context-tools.d.ts +1 -1
- package/dist/arena/index.cjs +4 -4
- package/dist/arena/index.js +3 -3
- package/dist/arena/providers/index.d.ts +19 -3
- package/dist/arena/strategies/utils.d.ts +6 -1
- package/dist/arena/types.d.ts +10 -1
- package/dist/{arena-46QQ6BZQ.js → arena-ENHBHB2W.js} +5 -7
- package/dist/{arena-HZZZ2GJH.cjs → arena-HHDYYVHJ.cjs} +19 -21
- package/dist/{chunk-BE6IPRDM.js → chunk-2EUAE7AY.js} +1 -1
- package/dist/{chunk-WYKNZ54E.cjs → chunk-3CAZIWUA.cjs} +6 -6
- package/dist/{chunk-J5XW6UYL.js → chunk-5C5HIOML.js} +63 -4
- package/dist/chunk-75E4BBFC.js +224 -0
- package/dist/chunk-BF4LXLQV.cjs +4753 -0
- package/dist/{chunk-ZJV3YSY3.cjs → chunk-BUJ5KYCI.cjs} +53 -11
- package/dist/{chunk-BMH65OVB.cjs → chunk-C7C7ZZY4.cjs} +8 -8
- package/dist/{chunk-KO2FPF7G.js → chunk-F5BS3GUC.js} +20 -2
- package/dist/chunk-FPFTIKEJ.js +4753 -0
- package/dist/chunk-FV2ARONZ.cjs +224 -0
- package/dist/{chunk-DICG4AB7.cjs → chunk-GZBD6QRS.cjs} +42 -3
- package/dist/{chunk-FVP7XJGS.cjs → chunk-HOXQLX5R.cjs} +406 -196
- package/dist/{chunk-4PKZPFCD.js → chunk-I57ZD5IQ.js} +47 -14
- package/dist/{chunk-JUHRV2XF.js → chunk-ID6EJUHP.js} +1703 -438
- package/dist/chunk-JHNCK7JP.cjs +202 -0
- package/dist/{chunk-MOILS4WE.cjs → chunk-JHXNOB5G.cjs} +3 -3
- package/dist/{chunk-UK2SU23S.cjs → chunk-KOGV6PDQ.cjs} +20 -2
- package/dist/{chunk-VKGNCYRL.js → chunk-LMEKCQX4.js} +95 -13
- package/dist/{chunk-3EAEC566.cjs → chunk-M2QI5X3X.cjs} +51 -18
- package/dist/{chunk-YZ25SSWJ.js → chunk-M2SVOKC6.js} +46 -4
- package/dist/{chunk-NG73UR3L.cjs → chunk-OP57WUWQ.cjs} +23 -1
- package/dist/{chunk-ZXYDDJEJ.js → chunk-OUC2DFA7.js} +2 -2
- package/dist/{chunk-AP5F6VYE.js → chunk-REFCCVDM.js} +1 -1
- package/dist/{chunk-O6F2EF2Z.js → chunk-SCDKLTN3.js} +41 -2
- package/dist/{chunk-FECTK5KJ.js → chunk-SW3L7HIM.js} +1 -1
- package/dist/chunk-TDXBHD24.js +54 -0
- package/dist/chunk-VIPLU4RY.cjs +54 -0
- package/dist/{chunk-Q6BYFYGD.cjs → chunk-VWFET3MG.cjs} +1886 -621
- package/dist/{chunk-3EUDE77E.cjs → chunk-X2DNIMPC.cjs} +19 -19
- package/dist/{chunk-SQZHPD3S.js → chunk-Y7TSCDF6.js} +297 -87
- package/dist/{chunk-WHRTARDJ.cjs → chunk-YAFCN7ZW.cjs} +112 -30
- package/dist/{chunk-LRAY5IYC.cjs → chunk-YD7XTI7T.cjs} +65 -6
- package/dist/{chunk-S74VVJBF.js → chunk-ZLPJJZUW.js} +23 -1
- package/dist/chunk-ZRVPCXI7.js +202 -0
- package/dist/cli/commands/builtin/advanced-commands.d.ts +1 -1
- package/dist/cli/commands/builtin/extra-commands.d.ts +2 -2
- package/dist/cli/commands/builtin/more-commands.d.ts +1 -3
- package/dist/cli/commands/registry.d.ts +8 -0
- package/dist/cli/cost-tracker.d.ts +6 -0
- package/dist/cli/main.cjs +3556 -1995
- package/dist/cli/main.js +3658 -2097
- package/dist/cli/onboarding.d.ts +67 -14
- package/dist/client-base-TOVE25FA.js +9 -0
- package/dist/client-base-VDDIADAC.cjs +9 -0
- package/dist/compaction-D3KV2NWY.cjs +31 -0
- package/dist/{compaction-CCHWA4G6.js → compaction-YNWCEF7B.js} +1 -2
- package/dist/context/manager.d.ts +9 -0
- package/dist/data/openrouter-models.d.ts +35 -0
- package/dist/data/openrouter-sync.d.ts +16 -0
- package/dist/{devtools-KIY3LWQJ.js → devtools-IRQQPIRY.js} +1 -1
- package/dist/{devtools-LRP47DDV.cjs → devtools-WTC3NFNE.cjs} +1 -1
- package/dist/engine/engine.d.ts +29 -6
- package/dist/engine/turn-loop.d.ts +7 -0
- package/dist/engine/turn-state.d.ts +6 -0
- package/dist/index.cjs +19 -28
- package/dist/index.js +28 -37
- package/dist/llm/client-base.d.ts +7 -0
- package/dist/llm/model-pool.d.ts +4 -0
- package/dist/logging/logger.d.ts +69 -8
- package/dist/manager-FWLOVEEK.cjs +7 -0
- package/dist/manager-GEXJLOIS.js +7 -0
- package/dist/{mcp-manager-OKXHHWYR.js → mcp-manager-37GQLFGX.js} +2 -2
- package/dist/mcp-manager-U77NEXBY.cjs +8 -0
- package/dist/memory-ADGOWADP.cjs +9 -0
- package/dist/memory-EPFDBPII.js +9 -0
- package/dist/native-ts/yoga-layout/index.d.ts +2 -2
- package/dist/{openai-5HQGBL4L.js → openai-RXU5URYI.js} +3 -2
- package/dist/openai-SQW4H2K4.cjs +10 -0
- package/dist/openrouter-models-2FM3H4SQ.js +15 -0
- package/dist/openrouter-models-PLCWZZYE.cjs +15 -0
- package/dist/openrouter-sync-K2WK3A2A.cjs +11 -0
- package/dist/openrouter-sync-SO3AWEAM.js +11 -0
- package/dist/product/index.cjs +12 -16
- package/dist/product/index.js +11 -15
- package/dist/protocol/types.d.ts +11 -3
- package/dist/{ink → render}/hooks/use-input.d.ts +1 -1
- package/dist/run/index.cjs +12 -16
- package/dist/run/index.js +11 -15
- package/dist/session/memory.d.ts +23 -3
- package/dist/session/session-manager.d.ts +4 -1
- package/dist/{session-manager-UQKB564H.cjs → session-manager-HRSKENKB.cjs} +2 -2
- package/dist/{session-manager-JIIBCFTC.js → session-manager-NEKFEHF3.js} +1 -1
- package/dist/settings/manager.d.ts +9 -0
- package/dist/settings/schema.d.ts +48 -39
- package/dist/{tool-summary-J2ICNMWP.js → tool-summary-2RUFL5QK.js} +1 -1
- package/dist/{tool-summary-5P2GKRA4.cjs → tool-summary-RYNR4DDB.cjs} +2 -2
- package/dist/tool-system/builtin/agent.d.ts +3 -26
- package/dist/tool-system/builtin/apply-patch/applier.d.ts +26 -0
- package/dist/tool-system/builtin/apply-patch/index.d.ts +19 -0
- package/dist/tool-system/builtin/apply-patch/parser.d.ts +17 -0
- package/dist/tool-system/builtin/apply-patch/seek-sequence.d.ts +18 -0
- package/dist/tool-system/builtin/apply-patch/types.d.ts +49 -0
- package/dist/tool-system/builtin/arena.d.ts +18 -5
- package/dist/tool-system/builtin/ask-user.d.ts +6 -6
- package/dist/tool-system/builtin/index.d.ts +11 -1
- package/dist/tool-system/builtin/tool-search.d.ts +2 -3
- package/dist/tool-system/context.d.ts +74 -0
- package/dist/tool-system/executor.d.ts +16 -0
- package/dist/tool-system/permission.d.ts +40 -5
- package/dist/tool-system/registry.d.ts +2 -0
- package/dist/types.d.ts +28 -1
- package/dist/ui/App.d.ts +1 -1
- package/dist/ui/components/AgentBlock.d.ts +1 -1
- package/dist/ui/components/AskUserPrompt.d.ts +7 -0
- package/dist/ui/components/MessageContent.d.ts +7 -3
- package/dist/ui/components/ModelManager.d.ts +35 -0
- package/dist/ui/components/ModelSelector.d.ts +10 -0
- package/dist/ui/components/OnboardingPrompt.d.ts +7 -0
- package/dist/ui/components/PermissionPrompt.d.ts +5 -2
- package/dist/ui/components/SessionPicker.d.ts +14 -0
- package/dist/ui/components/StatusLine.d.ts +4 -2
- package/dist/ui/components/ThemedBox.d.ts +1 -1
- package/dist/ui/components/ToolCall.d.ts +8 -1
- package/dist/ui/components/WelcomeTips.d.ts +5 -0
- package/dist/ui/onboarding-runner.d.ts +2 -0
- package/dist/ui/store.d.ts +1 -0
- package/dist/{updater-2N6745WR.cjs → updater-J7L7R6BY.cjs} +7 -5
- package/dist/{updater-PV7FKSUI.js → updater-LDBNYCAO.js} +7 -5
- package/dist/utils/debug.d.ts +17 -33
- package/package.json +7 -5
- package/scripts/check-node.cjs +21 -0
- package/dist/anthropic-XMTTVNSH.cjs +0 -9
- package/dist/bridge-4ZRXVWBN.js +0 -98
- package/dist/bridge-W476QDFH.cjs +0 -98
- package/dist/chunk-4RRUP4MM.js +0 -86
- package/dist/chunk-4SFPFHMG.js +0 -132
- package/dist/chunk-5LHVI777.cjs +0 -246
- package/dist/chunk-6ZIROYXX.js +0 -207
- package/dist/chunk-C7JBCO5V.js +0 -80
- package/dist/chunk-CSO5EOEP.cjs +0 -132
- package/dist/chunk-FGZGCFJX.cjs +0 -207
- package/dist/chunk-HD7MT5XU.cjs +0 -86
- package/dist/chunk-IMMTBZ33.cjs +0 -63
- package/dist/chunk-JT2WSQSR.cjs +0 -335
- package/dist/chunk-NZ4DQ72D.cjs +0 -664
- package/dist/chunk-OG4MIQJ6.js +0 -335
- package/dist/chunk-WRZJUQ5Z.js +0 -664
- package/dist/chunk-X4HAERTQ.js +0 -63
- package/dist/chunk-XHC2JMEC.cjs +0 -80
- package/dist/chunk-ZRSSGYA5.js +0 -246
- package/dist/compaction-44I55TLI.cjs +0 -32
- package/dist/coordinator-5HY7ALO2.js +0 -7
- package/dist/coordinator-INDLPVMF.cjs +0 -7
- package/dist/cost-tracker-IWYAUPXH.js +0 -9
- package/dist/cost-tracker-JXTJQQWE.cjs +0 -9
- package/dist/loader-DXFSUB4R.cjs +0 -91
- package/dist/loader-J5UID6CV.js +0 -91
- package/dist/manager-ETWDOCHN.cjs +0 -9
- package/dist/manager-HGMQNEJB.cjs +0 -11
- package/dist/manager-HUAQOORS.js +0 -9
- package/dist/manager-VJIZ2CQC.js +0 -11
- package/dist/mcp-manager-G4G2QASE.cjs +0 -8
- package/dist/memory-AP747G5H.js +0 -7
- package/dist/memory-BH3BYUN5.cjs +0 -7
- package/dist/onboarding-6WEPV7C2.js +0 -11
- package/dist/onboarding-QM5DY2TU.cjs +0 -11
- package/dist/openai-656VWUQW.cjs +0 -9
- package/dist/skills-63RBYQRX.js +0 -13
- package/dist/skills-V3BPLW3D.cjs +0 -13
- package/dist/token-counter-CHAXW5O7.cjs +0 -13
- package/dist/token-counter-DSOZGZ5Q.js +0 -13
- package/dist/utils/log.d.ts +0 -56
- package/dist/voice-KTZ7PAGO.js +0 -80
- package/dist/voice-KZE25GKB.cjs +0 -80
- /package/dist/{ink → render}/Ansi.d.ts +0 -0
- /package/dist/{ink → render}/bidi.d.ts +0 -0
- /package/dist/{ink → render}/clearTerminal.d.ts +0 -0
- /package/dist/{ink → render}/colorize.d.ts +0 -0
- /package/dist/{ink → render}/components/AlternateScreen.d.ts +0 -0
- /package/dist/{ink → render}/components/App.d.ts +0 -0
- /package/dist/{ink → render}/components/AppContext.d.ts +0 -0
- /package/dist/{ink → render}/components/Box.d.ts +0 -0
- /package/dist/{ink → render}/components/Button.d.ts +0 -0
- /package/dist/{ink → render}/components/ClockContext.d.ts +0 -0
- /package/dist/{ink → render}/components/CursorDeclarationContext.d.ts +0 -0
- /package/dist/{ink → render}/components/ErrorOverview.d.ts +0 -0
- /package/dist/{ink → render}/components/Link.d.ts +0 -0
- /package/dist/{ink → render}/components/Newline.d.ts +0 -0
- /package/dist/{ink → render}/components/NoSelect.d.ts +0 -0
- /package/dist/{ink → render}/components/RawAnsi.d.ts +0 -0
- /package/dist/{ink → render}/components/ScrollBox.d.ts +0 -0
- /package/dist/{ink → render}/components/Spacer.d.ts +0 -0
- /package/dist/{ink → render}/components/StdinContext.d.ts +0 -0
- /package/dist/{ink → render}/components/TerminalFocusContext.d.ts +0 -0
- /package/dist/{ink → render}/components/TerminalSizeContext.d.ts +0 -0
- /package/dist/{ink → render}/components/Text.d.ts +0 -0
- /package/dist/{ink → render}/constants.d.ts +0 -0
- /package/dist/{ink → render}/cursor.d.ts +0 -0
- /package/dist/{ink → render}/devtools.d.ts +0 -0
- /package/dist/{ink → render}/dom.d.ts +0 -0
- /package/dist/{ink → render}/events/click-event.d.ts +0 -0
- /package/dist/{ink → render}/events/dispatcher.d.ts +0 -0
- /package/dist/{ink → render}/events/emitter.d.ts +0 -0
- /package/dist/{ink → render}/events/event-handlers.d.ts +0 -0
- /package/dist/{ink → render}/events/event.d.ts +0 -0
- /package/dist/{ink → render}/events/focus-event.d.ts +0 -0
- /package/dist/{ink → render}/events/input-event.d.ts +0 -0
- /package/dist/{ink → render}/events/keyboard-event.d.ts +0 -0
- /package/dist/{ink → render}/events/paste-event.d.ts +0 -0
- /package/dist/{ink → render}/events/resize-event.d.ts +0 -0
- /package/dist/{ink → render}/events/terminal-event.d.ts +0 -0
- /package/dist/{ink → render}/events/terminal-focus-event.d.ts +0 -0
- /package/dist/{ink → render}/focus.d.ts +0 -0
- /package/dist/{ink → render}/frame.d.ts +0 -0
- /package/dist/{ink → render}/get-max-width.d.ts +0 -0
- /package/dist/{ink → render}/hit-test.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-animation-frame.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-app.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-declared-cursor.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-interval.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-search-highlight.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-selection.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-stdin.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-tab-status.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-terminal-focus.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-terminal-title.d.ts +0 -0
- /package/dist/{ink → render}/hooks/use-terminal-viewport.d.ts +0 -0
- /package/dist/{ink → render}/index.d.ts +0 -0
- /package/dist/{ink → render}/ink.d.ts +0 -0
- /package/dist/{ink → render}/instances.d.ts +0 -0
- /package/dist/{ink → render}/layout/engine.d.ts +0 -0
- /package/dist/{ink → render}/layout/geometry.d.ts +0 -0
- /package/dist/{ink → render}/layout/node.d.ts +0 -0
- /package/dist/{ink → render}/layout/yoga.d.ts +0 -0
- /package/dist/{ink → render}/line-width-cache.d.ts +0 -0
- /package/dist/{ink → render}/log-update.d.ts +0 -0
- /package/dist/{ink → render}/measure-element.d.ts +0 -0
- /package/dist/{ink → render}/measure-text.d.ts +0 -0
- /package/dist/{ink → render}/node-cache.d.ts +0 -0
- /package/dist/{ink → render}/optimizer.d.ts +0 -0
- /package/dist/{ink → render}/output.d.ts +0 -0
- /package/dist/{ink → render}/parse-keypress.d.ts +0 -0
- /package/dist/{ink → render}/reconciler.d.ts +0 -0
- /package/dist/{ink → render}/render-border.d.ts +0 -0
- /package/dist/{ink → render}/render-node-to-output.d.ts +0 -0
- /package/dist/{ink → render}/render-to-screen.d.ts +0 -0
- /package/dist/{ink → render}/renderer.d.ts +0 -0
- /package/dist/{ink → render}/root.d.ts +0 -0
- /package/dist/{ink → render}/screen.d.ts +0 -0
- /package/dist/{ink → render}/searchHighlight.d.ts +0 -0
- /package/dist/{ink → render}/selection.d.ts +0 -0
- /package/dist/{ink → render}/squash-text-nodes.d.ts +0 -0
- /package/dist/{ink → render}/stringWidth.d.ts +0 -0
- /package/dist/{ink → render}/styles.d.ts +0 -0
- /package/dist/{ink → render}/supports-hyperlinks.d.ts +0 -0
- /package/dist/{ink → render}/tabstops.d.ts +0 -0
- /package/dist/{ink → render}/terminal-focus-state.d.ts +0 -0
- /package/dist/{ink → render}/terminal-querier.d.ts +0 -0
- /package/dist/{ink → render}/terminal.d.ts +0 -0
- /package/dist/{ink → render}/termio/ansi.d.ts +0 -0
- /package/dist/{ink → render}/termio/csi.d.ts +0 -0
- /package/dist/{ink → render}/termio/dec.d.ts +0 -0
- /package/dist/{ink → render}/termio/esc.d.ts +0 -0
- /package/dist/{ink → render}/termio/osc.d.ts +0 -0
- /package/dist/{ink → render}/termio/parser.d.ts +0 -0
- /package/dist/{ink → render}/termio/sgr.d.ts +0 -0
- /package/dist/{ink → render}/termio/tokenize.d.ts +0 -0
- /package/dist/{ink → render}/termio/types.d.ts +0 -0
- /package/dist/{ink → render}/termio.d.ts +0 -0
- /package/dist/{ink → render}/useTerminalNotification.d.ts +0 -0
- /package/dist/{ink → render}/warn.d.ts +0 -0
- /package/dist/{ink → render}/widest-line.d.ts +0 -0
- /package/dist/{ink → render}/wrap-text.d.ts +0 -0
- /package/dist/{ink → render}/wrapAnsi.d.ts +0 -0
package/README.md
CHANGED
|
@@ -175,3 +175,11 @@ bun run tsc --noEmit
|
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
`bun run tsc --noEmit` currently reports many pre-existing repo-wide issues outside the preset/framework changes, so treat typecheck as a global health signal rather than a clean gate for just this slice.
|
|
178
|
+
|
|
179
|
+
## Acknowledgments
|
|
180
|
+
|
|
181
|
+
The `ApplyPatch` tool (`src/tool-system/builtin/apply-patch/`) is adapted from
|
|
182
|
+
[OpenAI Codex `codex-rs/apply-patch`](https://github.com/openai/codex/tree/main/codex-rs/apply-patch),
|
|
183
|
+
licensed under the Apache License 2.0. See `NOTICE.md` and `LICENSE-codex` in
|
|
184
|
+
that directory for details, including the intentional behavioral divergence
|
|
185
|
+
where our applier rolls back partial writes on failure.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkBUJ5KYCIcjs = require('./chunk-BUJ5KYCI.cjs');
|
|
4
|
+
require('./chunk-GZBD6QRS.cjs');
|
|
5
|
+
require('./chunk-EL2RL5DG.cjs');
|
|
6
|
+
require('./chunk-JHNCK7JP.cjs');
|
|
7
|
+
require('./chunk-IJSHQGMP.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.AnthropicClient = _chunkBUJ5KYCIcjs.AnthropicClient;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AnthropicClient
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-M2SVOKC6.js";
|
|
4
|
+
import "./chunk-SCDKLTN3.js";
|
|
5
5
|
import "./chunk-FUOKLKR2.js";
|
|
6
|
+
import "./chunk-ZRVPCXI7.js";
|
|
6
7
|
import "./chunk-DI7RDLOS.js";
|
|
7
8
|
export {
|
|
8
9
|
AnthropicClient
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { ToolDefinition, ToolCall } from "../../types.js";
|
|
10
10
|
export declare const MAX_TOOL_RESULT = 15000;
|
|
11
|
-
export declare const MAX_TOOL_ROUNDS =
|
|
11
|
+
export declare const MAX_TOOL_ROUNDS = 3;
|
|
12
12
|
export declare const CONTEXT_TOOLS: ToolDefinition[];
|
|
13
13
|
/**
|
|
14
14
|
* Execute a context tool call and return the result string.
|
package/dist/arena/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkX2DNIMPCcjs = require('../chunk-X2DNIMPC.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -48,9 +48,9 @@ var _chunk3EUDE77Ecjs = require('../chunk-3EUDE77E.cjs');
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
52
|
-
require('../chunk-IMMTBZ33.cjs');
|
|
51
|
+
var _chunkHOXQLX5Rcjs = require('../chunk-HOXQLX5R.cjs');
|
|
53
52
|
require('../chunk-EL2RL5DG.cjs');
|
|
53
|
+
require('../chunk-JHNCK7JP.cjs');
|
|
54
54
|
require('../chunk-IJSHQGMP.cjs');
|
|
55
55
|
|
|
56
56
|
|
|
@@ -100,4 +100,4 @@ require('../chunk-IJSHQGMP.cjs');
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
exports.Arena =
|
|
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;
|
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-OUC2DFA7.js";
|
|
9
9
|
import {
|
|
10
10
|
Arena,
|
|
11
11
|
ArenaLedger,
|
|
@@ -48,9 +48,9 @@ import {
|
|
|
48
48
|
selectTools,
|
|
49
49
|
transitionClaim,
|
|
50
50
|
validTransitions
|
|
51
|
-
} from "../chunk-
|
|
52
|
-
import "../chunk-X4HAERTQ.js";
|
|
51
|
+
} from "../chunk-Y7TSCDF6.js";
|
|
53
52
|
import "../chunk-FUOKLKR2.js";
|
|
53
|
+
import "../chunk-ZRVPCXI7.js";
|
|
54
54
|
import "../chunk-DI7RDLOS.js";
|
|
55
55
|
export {
|
|
56
56
|
Arena,
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provider registry — evidence collectors for Arena.
|
|
3
3
|
*/
|
|
4
|
-
import type { ArenaPlan, ArenaArtifact, ArenaQuickFact } from "../types.js";
|
|
4
|
+
import type { ArenaPlan, ArenaArtifact, ArenaSourceKind, ArenaQuickFact } from "../types.js";
|
|
5
5
|
export { gitProvider } from "./git.js";
|
|
6
6
|
export { repoProvider } from "./repo.js";
|
|
7
7
|
export { docsProvider } from "./docs.js";
|
|
8
8
|
export { noneProvider } from "./none.js";
|
|
9
|
+
export interface CollectEvidenceOptions {
|
|
10
|
+
/** Heartbeat callback fired before/after each provider runs. */
|
|
11
|
+
onProgress?: (event: {
|
|
12
|
+
type: "evidence_started" | "evidence_collected";
|
|
13
|
+
source: ArenaSourceKind;
|
|
14
|
+
count?: number;
|
|
15
|
+
durationMs?: number;
|
|
16
|
+
timedOut?: boolean;
|
|
17
|
+
}) => void;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
9
20
|
/**
|
|
10
21
|
* Collect all evidence according to the plan's sources.
|
|
11
22
|
* Returns unified ArenaArtifact[] and quickFacts.
|
|
23
|
+
*
|
|
24
|
+
* Providers run in parallel (independent of one another) with a
|
|
25
|
+
* per-provider timeout, so a single slow source can't stall the
|
|
26
|
+
* whole arena. Heartbeats are emitted around each provider so the
|
|
27
|
+
* UI can show "collecting from repo..." instead of a blank pause.
|
|
12
28
|
*/
|
|
13
|
-
export declare function collectEvidence(plan: ArenaPlan, topic: string): {
|
|
29
|
+
export declare function collectEvidence(plan: ArenaPlan, topic: string, options?: CollectEvidenceOptions): Promise<{
|
|
14
30
|
artifacts: ArenaArtifact[];
|
|
15
31
|
quickFacts: ArenaQuickFact[];
|
|
16
|
-
}
|
|
32
|
+
}>;
|
|
@@ -10,7 +10,12 @@ export declare function formatBaseContext(ctx: ArenaBaseContext): string;
|
|
|
10
10
|
export declare function formatReports(reports: ParticipantReport[]): string;
|
|
11
11
|
/** Format finding reviews for consensus prompts */
|
|
12
12
|
export declare function formatFindingReviews(reviews: FindingReview[]): string;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Parse a ParticipantReport. The research prompt now asks for an
|
|
15
|
+
* XML <report> element because thinking-mode models (DeepSeek V4)
|
|
16
|
+
* produced malformed JSON often enough to derail the loop. We try
|
|
17
|
+
* XML first, then JSON, then a free-text salvage.
|
|
18
|
+
*/
|
|
14
19
|
export declare function parseReport(participant: string, text: string): ParticipantReport;
|
|
15
20
|
/** Parse FindingReview[] from LLM JSON output */
|
|
16
21
|
export declare function parseReviews(reviewer: string, text: string): FindingReview[];
|
package/dist/arena/types.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface ArenaToolPack {
|
|
|
71
71
|
/** Context provider interface — collects evidence from a source */
|
|
72
72
|
export interface ArenaContextProvider {
|
|
73
73
|
kind: ArenaSourceKind;
|
|
74
|
-
collect(plan: ArenaPlan, topic: string): ArenaArtifact[]
|
|
74
|
+
collect(plan: ArenaPlan, topic: string): ArenaArtifact[] | Promise<ArenaArtifact[]>;
|
|
75
75
|
}
|
|
76
76
|
/** Quick fact — high-signal summary entry */
|
|
77
77
|
export interface ArenaQuickFact {
|
|
@@ -440,6 +440,15 @@ export interface ArenaConfig {
|
|
|
440
440
|
export type ArenaProgressEvent = {
|
|
441
441
|
type: "plan_resolved";
|
|
442
442
|
plan: ArenaPlan;
|
|
443
|
+
} | {
|
|
444
|
+
type: "evidence_started";
|
|
445
|
+
source: ArenaSourceKind;
|
|
446
|
+
} | {
|
|
447
|
+
type: "evidence_source_done";
|
|
448
|
+
source: ArenaSourceKind;
|
|
449
|
+
count: number;
|
|
450
|
+
durationMs: number;
|
|
451
|
+
timedOut: boolean;
|
|
443
452
|
} | {
|
|
444
453
|
type: "evidence_collected";
|
|
445
454
|
artifacts: ArenaArtifact[];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ModelPool
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F5BS3GUC.js";
|
|
4
4
|
import {
|
|
5
|
-
SettingsManager
|
|
6
|
-
|
|
7
|
-
} from "./chunk-6ZIROYXX.js";
|
|
5
|
+
SettingsManager
|
|
6
|
+
} from "./chunk-75E4BBFC.js";
|
|
8
7
|
import {
|
|
9
8
|
Arena,
|
|
10
9
|
MODEL_PRESETS,
|
|
@@ -13,9 +12,9 @@ import {
|
|
|
13
12
|
getMaxOutputTokens,
|
|
14
13
|
printArenaResult,
|
|
15
14
|
renderProgress
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-X4HAERTQ.js";
|
|
15
|
+
} from "./chunk-Y7TSCDF6.js";
|
|
18
16
|
import "./chunk-FUOKLKR2.js";
|
|
17
|
+
import "./chunk-ZRVPCXI7.js";
|
|
19
18
|
import {
|
|
20
19
|
init_esm_shims
|
|
21
20
|
} from "./chunk-DI7RDLOS.js";
|
|
@@ -23,7 +22,6 @@ import {
|
|
|
23
22
|
// src/cli/commands/arena.ts
|
|
24
23
|
init_esm_shims();
|
|
25
24
|
import chalk from "chalk";
|
|
26
|
-
init_manager();
|
|
27
25
|
async function runArenaReview(arg, engineConfig, opts) {
|
|
28
26
|
const { models: modelsFlag, mode: explicitMode, base, head, topic } = parseFlags(arg);
|
|
29
27
|
const out = opts?.output ?? ((text) => console.log(text));
|
|
@@ -1,10 +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 _chunkKOGV6PDQcjs = require('./chunk-KOGV6PDQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
var _chunkFV2ARONZcjs = require('./chunk-FV2ARONZ.cjs');
|
|
6
7
|
|
|
7
|
-
var _chunkFGZGCFJXcjs = require('./chunk-FGZGCFJX.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -12,10 +12,9 @@ var _chunkFGZGCFJXcjs = require('./chunk-FGZGCFJX.cjs');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
var _chunkFVP7XJGScjs = require('./chunk-FVP7XJGS.cjs');
|
|
17
|
-
require('./chunk-IMMTBZ33.cjs');
|
|
15
|
+
var _chunkHOXQLX5Rcjs = require('./chunk-HOXQLX5R.cjs');
|
|
18
16
|
require('./chunk-EL2RL5DG.cjs');
|
|
17
|
+
require('./chunk-JHNCK7JP.cjs');
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
@@ -23,7 +22,6 @@ var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
|
23
22
|
// src/cli/commands/arena.ts
|
|
24
23
|
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
25
24
|
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
|
|
26
|
-
_chunkFGZGCFJXcjs.init_manager.call(void 0, );
|
|
27
25
|
async function runArenaReview(arg, engineConfig, opts) {
|
|
28
26
|
const { models: modelsFlag, mode: explicitMode, base, head, topic } = parseFlags(arg);
|
|
29
27
|
const out = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _ => _.output]), () => ( ((text) => console.log(text))));
|
|
@@ -40,8 +38,8 @@ async function runArenaReview(arg, engineConfig, opts) {
|
|
|
40
38
|
out(_chalk2.default.bold(`\u2550\u2550\u2550 Arena ${modeLabel} \u2550\u2550\u2550`));
|
|
41
39
|
out(_chalk2.default.dim(`Topic: ${topic}`));
|
|
42
40
|
out(_chalk2.default.dim(`Models: ${participants.map((p) => p.name).join(" vs ")}`));
|
|
43
|
-
const progressRenderer = _optionalChain([opts, 'optionalAccess', _2 => _2.output]) ?
|
|
44
|
-
const arena = new (0,
|
|
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)({
|
|
45
43
|
participants,
|
|
46
44
|
mode: explicitMode,
|
|
47
45
|
enableContextTools: true,
|
|
@@ -55,9 +53,9 @@ async function runArenaReview(arg, engineConfig, opts) {
|
|
|
55
53
|
});
|
|
56
54
|
const resultSink = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _3 => _3.outputMessage]), () => ( _optionalChain([opts, 'optionalAccess', _4 => _4.output])));
|
|
57
55
|
if (resultSink) {
|
|
58
|
-
resultSink(
|
|
56
|
+
resultSink(_chunkHOXQLX5Rcjs.formatArenaResultForSession.call(void 0, result));
|
|
59
57
|
} else {
|
|
60
|
-
|
|
58
|
+
_chunkHOXQLX5Rcjs.printArenaResult.call(void 0, result);
|
|
61
59
|
}
|
|
62
60
|
return result;
|
|
63
61
|
} catch (err) {
|
|
@@ -66,9 +64,9 @@ async function runArenaReview(arg, engineConfig, opts) {
|
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
function buildModelPool(engineConfig) {
|
|
69
|
-
const pool = new (0,
|
|
67
|
+
const pool = new (0, _chunkKOGV6PDQcjs.ModelPool)();
|
|
70
68
|
try {
|
|
71
|
-
const settings = new (0,
|
|
69
|
+
const settings = new (0, _chunkFV2ARONZcjs.SettingsManager)(process.cwd()).get();
|
|
72
70
|
if (_optionalChain([settings, 'access', _5 => _5.models, 'optionalAccess', _6 => _6.length])) {
|
|
73
71
|
for (const m of settings.models) {
|
|
74
72
|
pool.register({
|
|
@@ -98,7 +96,7 @@ function resolveOneParticipant(entry, pool, engineConfig) {
|
|
|
98
96
|
apiKey: _nullishCoalesce(m.apiKey, () => ( engineConfig.llm.apiKey)),
|
|
99
97
|
baseUrl: _nullishCoalesce(m.baseUrl, () => ( engineConfig.llm.baseUrl)),
|
|
100
98
|
temperature: 0.3,
|
|
101
|
-
maxTokens: _nullishCoalesce(m.maxOutputTokens, () => (
|
|
99
|
+
maxTokens: _nullishCoalesce(m.maxOutputTokens, () => ( _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, m.model))),
|
|
102
100
|
enableStreaming: false
|
|
103
101
|
}
|
|
104
102
|
};
|
|
@@ -111,7 +109,7 @@ function resolveOneParticipant(entry, pool, engineConfig) {
|
|
|
111
109
|
apiKey: _nullishCoalesce(entry.apiKey, () => ( engineConfig.llm.apiKey)),
|
|
112
110
|
baseUrl: _nullishCoalesce(entry.baseUrl, () => ( engineConfig.llm.baseUrl)),
|
|
113
111
|
temperature: 0.3,
|
|
114
|
-
maxTokens:
|
|
112
|
+
maxTokens: _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, entry.model),
|
|
115
113
|
enableStreaming: false
|
|
116
114
|
}
|
|
117
115
|
};
|
|
@@ -131,12 +129,12 @@ function resolveParticipants(engineConfig, modelsFlag) {
|
|
|
131
129
|
apiKey: _nullishCoalesce(fromPool.apiKey, () => ( engineConfig.llm.apiKey)),
|
|
132
130
|
baseUrl: _nullishCoalesce(fromPool.baseUrl, () => ( engineConfig.llm.baseUrl)),
|
|
133
131
|
temperature: 0.3,
|
|
134
|
-
maxTokens: _nullishCoalesce(fromPool.maxOutputTokens, () => (
|
|
132
|
+
maxTokens: _nullishCoalesce(fromPool.maxOutputTokens, () => ( _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, fromPool.model))),
|
|
135
133
|
enableStreaming: false
|
|
136
134
|
}
|
|
137
135
|
};
|
|
138
136
|
}
|
|
139
|
-
const preset =
|
|
137
|
+
const preset = _chunkHOXQLX5Rcjs.MODEL_PRESETS[name];
|
|
140
138
|
if (preset) {
|
|
141
139
|
return {
|
|
142
140
|
name: modelDisplayName(preset.model),
|
|
@@ -157,7 +155,7 @@ function resolveParticipants(engineConfig, modelsFlag) {
|
|
|
157
155
|
};
|
|
158
156
|
});
|
|
159
157
|
}
|
|
160
|
-
const settings = new (0,
|
|
158
|
+
const settings = new (0, _chunkFV2ARONZcjs.SettingsManager)(process.cwd()).get();
|
|
161
159
|
if (_optionalChain([settings, 'access', _7 => _7.arena, 'optionalAccess', _8 => _8.participants, 'optionalAccess', _9 => _9.length]) >= 2) {
|
|
162
160
|
const resolved = settings.arena.participants.map((p) => resolveOneParticipant(p, pool, engineConfig)).filter((p) => p !== void 0);
|
|
163
161
|
if (resolved.length >= 2) return resolved;
|
|
@@ -167,7 +165,7 @@ function resolveParticipants(engineConfig, modelsFlag) {
|
|
|
167
165
|
name: modelDisplayName(engineConfig.llm.model),
|
|
168
166
|
llm: {
|
|
169
167
|
...engineConfig.llm,
|
|
170
|
-
maxTokens:
|
|
168
|
+
maxTokens: _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, engineConfig.llm.model),
|
|
171
169
|
enableStreaming: false
|
|
172
170
|
}
|
|
173
171
|
}
|
|
@@ -180,7 +178,7 @@ function resolveParticipants(engineConfig, modelsFlag) {
|
|
|
180
178
|
llm: {
|
|
181
179
|
...engineConfig.llm,
|
|
182
180
|
model: opponent,
|
|
183
|
-
maxTokens:
|
|
181
|
+
maxTokens: _chunkHOXQLX5Rcjs.getMaxOutputTokens.call(void 0, opponent),
|
|
184
182
|
enableStreaming: false
|
|
185
183
|
}
|
|
186
184
|
});
|
|
@@ -234,7 +232,7 @@ function formatUsage() {
|
|
|
234
232
|
" --base <ref> Base branch/ref for comparison",
|
|
235
233
|
" --head <ref> Head branch/ref (default: HEAD)",
|
|
236
234
|
"",
|
|
237
|
-
`${_chalk2.default.dim("Available model presets:")} ${Object.keys(
|
|
235
|
+
`${_chalk2.default.dim("Available model presets:")} ${Object.keys(_chunkHOXQLX5Rcjs.MODEL_PRESETS).join(", ")}`
|
|
238
236
|
].join("\n");
|
|
239
237
|
}
|
|
240
238
|
function formatModelHelp(engineConfig) {
|
|
@@ -258,4 +256,4 @@ function modelDisplayName(model) {
|
|
|
258
256
|
|
|
259
257
|
|
|
260
258
|
|
|
261
|
-
exports.formatArenaResultForSession =
|
|
259
|
+
exports.formatArenaResultForSession = _chunkHOXQLX5Rcjs.formatArenaResultForSession; exports.runArenaReview = runArenaReview;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkVWFET3MGcjs = require('./chunk-VWFET3MG.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
@@ -61,12 +61,12 @@ function defineProduct(definition, runtime) {
|
|
|
61
61
|
builtinTools: [...enabledSet],
|
|
62
62
|
defaultPermissionRules: permissionRules
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
_chunkVWFET3MGcjs.registerPreset.call(void 0, agentPreset);
|
|
65
65
|
let evaluator;
|
|
66
66
|
if (!_optionalChain([contract, 'optionalAccess', _4 => _4.evaluator])) {
|
|
67
|
-
evaluator = new (0,
|
|
67
|
+
evaluator = new (0, _chunkVWFET3MGcjs.NoopEvaluator)();
|
|
68
68
|
} else if (Array.isArray(contract.evaluator)) {
|
|
69
|
-
evaluator = new (0,
|
|
69
|
+
evaluator = new (0, _chunkVWFET3MGcjs.CompositeEvaluator)(contract.evaluator);
|
|
70
70
|
} else {
|
|
71
71
|
evaluator = contract.evaluator;
|
|
72
72
|
}
|
|
@@ -76,8 +76,8 @@ function defineProduct(definition, runtime) {
|
|
|
76
76
|
execute: ct.execute
|
|
77
77
|
}));
|
|
78
78
|
const runsDir = _nullishCoalesce(runtime.runsDir, () => ( _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "runs")));
|
|
79
|
-
const store = new (0,
|
|
80
|
-
const manager = new (0,
|
|
79
|
+
const store = new (0, _chunkVWFET3MGcjs.FileRunStore)(runsDir);
|
|
80
|
+
const manager = new (0, _chunkVWFET3MGcjs.RunManager)({
|
|
81
81
|
store,
|
|
82
82
|
executor: {
|
|
83
83
|
llm: runtime.llm,
|
|
@@ -1,13 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
estimateMessagesTokens,
|
|
3
|
-
init_token_counter
|
|
4
|
-
} from "./chunk-4RRUP4MM.js";
|
|
5
1
|
import {
|
|
6
2
|
__esm,
|
|
7
3
|
__export,
|
|
8
4
|
init_esm_shims
|
|
9
5
|
} from "./chunk-DI7RDLOS.js";
|
|
10
6
|
|
|
7
|
+
// src/context/token-counter.ts
|
|
8
|
+
function estimateStringTokens(text) {
|
|
9
|
+
if (!text) return 0;
|
|
10
|
+
const cjkChars = (text.match(/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g) ?? []).length;
|
|
11
|
+
const cjkRatio = cjkChars / text.length;
|
|
12
|
+
if (cjkRatio > 0.3) {
|
|
13
|
+
const cjkTokens = cjkChars / RATIOS.cjk;
|
|
14
|
+
const otherChars = text.length - cjkChars;
|
|
15
|
+
const otherTokens = otherChars / RATIOS.english;
|
|
16
|
+
return Math.ceil(cjkTokens + otherTokens);
|
|
17
|
+
}
|
|
18
|
+
const codeIndicators = ["{", "}", "(", ")", ";", "=>", "import ", "function ", "class ", "const "];
|
|
19
|
+
const codeScore = codeIndicators.reduce((s, ind) => s + (text.includes(ind) ? 1 : 0), 0);
|
|
20
|
+
if (codeScore >= 3) return Math.ceil(text.length / RATIOS.code);
|
|
21
|
+
if (text.startsWith("{") || text.startsWith("[")) return Math.ceil(text.length / RATIOS.json);
|
|
22
|
+
return Math.ceil(text.length / RATIOS.english);
|
|
23
|
+
}
|
|
24
|
+
function estimateMessagesTokens(messages) {
|
|
25
|
+
let total = 0;
|
|
26
|
+
for (const msg of messages) {
|
|
27
|
+
total += 4;
|
|
28
|
+
if (typeof msg.content === "string") {
|
|
29
|
+
total += estimateStringTokens(msg.content);
|
|
30
|
+
} else if (Array.isArray(msg.content)) {
|
|
31
|
+
for (const block of msg.content) {
|
|
32
|
+
total += estimateBlockTokens(block);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return total;
|
|
37
|
+
}
|
|
38
|
+
function estimateBlockTokens(block) {
|
|
39
|
+
let tokens = 2;
|
|
40
|
+
if (block.text) tokens += estimateStringTokens(block.text);
|
|
41
|
+
if (block.content && typeof block.content === "string") {
|
|
42
|
+
tokens += estimateStringTokens(block.content);
|
|
43
|
+
}
|
|
44
|
+
if (block.input) {
|
|
45
|
+
tokens += estimateStringTokens(JSON.stringify(block.input));
|
|
46
|
+
}
|
|
47
|
+
if (block.name) tokens += estimateStringTokens(block.name);
|
|
48
|
+
return tokens;
|
|
49
|
+
}
|
|
50
|
+
var RATIOS;
|
|
51
|
+
var init_token_counter = __esm({
|
|
52
|
+
"src/context/token-counter.ts"() {
|
|
53
|
+
"use strict";
|
|
54
|
+
init_esm_shims();
|
|
55
|
+
RATIOS = {
|
|
56
|
+
english: 4,
|
|
57
|
+
// ~4 chars per token for English prose
|
|
58
|
+
code: 3.2,
|
|
59
|
+
// ~3.2 chars per token for code (more tokens per char)
|
|
60
|
+
json: 3.5,
|
|
61
|
+
// JSON structures
|
|
62
|
+
mixed: 3.6,
|
|
63
|
+
// Mixed content (typical for tool results)
|
|
64
|
+
cjk: 1.5
|
|
65
|
+
// CJK characters: ~1.5 chars per token
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
11
70
|
// src/context/compaction.ts
|
|
12
71
|
var compaction_exports = {};
|
|
13
72
|
__export(compaction_exports, {
|