@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
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
|
+
|
|
3
|
+
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
4
|
+
|
|
5
|
+
// src/settings/manager.ts
|
|
6
|
+
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
7
|
+
var _fs = require('fs');
|
|
8
|
+
var _path = require('path');
|
|
9
|
+
var _os = require('os');
|
|
10
|
+
|
|
11
|
+
// src/settings/schema.ts
|
|
12
|
+
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
13
|
+
var _zod = require('zod');
|
|
14
|
+
var SettingsSchema = _zod.z.object({
|
|
15
|
+
agent: _zod.z.object({
|
|
16
|
+
// Use z.string() instead of z.enum() to allow custom presets registered via registerPreset()
|
|
17
|
+
preset: _zod.z.string().default("terminal-coding"),
|
|
18
|
+
enabledBuiltinTools: _zod.z.array(_zod.z.string()).default([]),
|
|
19
|
+
disabledBuiltinTools: _zod.z.array(_zod.z.string()).default([]),
|
|
20
|
+
customSystemPrompt: _zod.z.string().optional(),
|
|
21
|
+
appendSystemPrompt: _zod.z.string().optional()
|
|
22
|
+
}).default({}),
|
|
23
|
+
model: _zod.z.object({
|
|
24
|
+
provider: _zod.z.string().default("openai"),
|
|
25
|
+
name: _zod.z.string().default("anthropic/claude-opus-4-6"),
|
|
26
|
+
apiKey: _zod.z.string().optional(),
|
|
27
|
+
baseUrl: _zod.z.string().default("https://openrouter.ai/api/v1"),
|
|
28
|
+
temperature: _zod.z.number().min(0).max(2).default(0.3),
|
|
29
|
+
maxTokens: _zod.z.number().default(8192)
|
|
30
|
+
}).default({}),
|
|
31
|
+
models: _zod.z.array(
|
|
32
|
+
_zod.z.object({
|
|
33
|
+
key: _zod.z.string(),
|
|
34
|
+
label: _zod.z.string().optional(),
|
|
35
|
+
provider: _zod.z.string(),
|
|
36
|
+
model: _zod.z.string(),
|
|
37
|
+
baseUrl: _zod.z.string().optional(),
|
|
38
|
+
apiKey: _zod.z.string().optional(),
|
|
39
|
+
maxOutputTokens: _zod.z.number().optional(),
|
|
40
|
+
maxContextTokens: _zod.z.number().optional()
|
|
41
|
+
})
|
|
42
|
+
).default([]),
|
|
43
|
+
permissions: _zod.z.object({
|
|
44
|
+
defaultMode: _zod.z.enum(["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]).default("default"),
|
|
45
|
+
rules: _zod.z.array(
|
|
46
|
+
_zod.z.object({
|
|
47
|
+
tool: _zod.z.string(),
|
|
48
|
+
argsPattern: _zod.z.record(_zod.z.string()).optional(),
|
|
49
|
+
decision: _zod.z.enum(["allow", "deny", "ask"]),
|
|
50
|
+
reason: _zod.z.string().optional()
|
|
51
|
+
})
|
|
52
|
+
).default([])
|
|
53
|
+
}).default({}),
|
|
54
|
+
context: _zod.z.object({
|
|
55
|
+
maxTokens: _zod.z.number().default(2e5),
|
|
56
|
+
compactAtRatio: _zod.z.number().default(0.6),
|
|
57
|
+
summarizeAtRatio: _zod.z.number().default(0.8)
|
|
58
|
+
}).default({}),
|
|
59
|
+
session: _zod.z.object({
|
|
60
|
+
storageDir: _zod.z.string().optional(),
|
|
61
|
+
maxHistory: _zod.z.number().default(100)
|
|
62
|
+
}).default({}),
|
|
63
|
+
mcpServers: _zod.z.record(
|
|
64
|
+
_zod.z.object({
|
|
65
|
+
name: _zod.z.string(),
|
|
66
|
+
command: _zod.z.string().optional(),
|
|
67
|
+
args: _zod.z.array(_zod.z.string()).optional(),
|
|
68
|
+
env: _zod.z.record(_zod.z.string()).optional(),
|
|
69
|
+
url: _zod.z.string().optional(),
|
|
70
|
+
transport: _zod.z.enum(["stdio", "sse", "streamable-http", "inprocess"]).optional(),
|
|
71
|
+
headers: _zod.z.record(_zod.z.string()).optional()
|
|
72
|
+
})
|
|
73
|
+
).default({}),
|
|
74
|
+
instructions: _zod.z.object({
|
|
75
|
+
fileName: _zod.z.string().default("CODESHELL.md"),
|
|
76
|
+
scanDirs: _zod.z.array(_zod.z.string()).default([]),
|
|
77
|
+
compatFileNames: _zod.z.array(_zod.z.string()).default(["CLAUDE.md", "AGENTS.md"]),
|
|
78
|
+
ignoreGitBoundary: _zod.z.boolean().default(false)
|
|
79
|
+
}).default({}),
|
|
80
|
+
arena: _zod.z.object({
|
|
81
|
+
participants: _zod.z.array(
|
|
82
|
+
_zod.z.union([
|
|
83
|
+
// Short form: just a model pool key
|
|
84
|
+
_zod.z.string(),
|
|
85
|
+
// Full form: explicit config (backward compat)
|
|
86
|
+
_zod.z.object({
|
|
87
|
+
name: _zod.z.string(),
|
|
88
|
+
model: _zod.z.string(),
|
|
89
|
+
provider: _zod.z.string().optional(),
|
|
90
|
+
apiKey: _zod.z.string().optional(),
|
|
91
|
+
baseUrl: _zod.z.string().optional()
|
|
92
|
+
})
|
|
93
|
+
])
|
|
94
|
+
).default([])
|
|
95
|
+
}).default({}),
|
|
96
|
+
search: _zod.z.object({
|
|
97
|
+
provider: _zod.z.enum(["serper", "tavily", "searxng"]).default("serper"),
|
|
98
|
+
apiKey: _zod.z.string().optional(),
|
|
99
|
+
baseUrl: _zod.z.string().optional()
|
|
100
|
+
}).default({}),
|
|
101
|
+
output: _zod.z.object({
|
|
102
|
+
format: _zod.z.enum(["text", "json", "jsonl", "stream-json"]).default("text")
|
|
103
|
+
}).default({})
|
|
104
|
+
}).passthrough();
|
|
105
|
+
function validateSettings(raw) {
|
|
106
|
+
return SettingsSchema.parse(raw);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// src/settings/manager.ts
|
|
110
|
+
var SettingsManager = (_class = class {
|
|
111
|
+
constructor(cwd = process.cwd()) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
|
|
112
|
+
this.cwd = cwd;
|
|
113
|
+
}
|
|
114
|
+
__init() {this.sources = []}
|
|
115
|
+
__init2() {this.merged = null}
|
|
116
|
+
/**
|
|
117
|
+
* Load settings from all sources.
|
|
118
|
+
*/
|
|
119
|
+
load(flagOverrides) {
|
|
120
|
+
this.sources = [];
|
|
121
|
+
this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.managed.json"), "managed", 0);
|
|
122
|
+
this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.json"), "user", 1);
|
|
123
|
+
this.loadJsonFile(_path.join.call(void 0, _os.homedir.call(void 0, ), ".claude", "settings.json"), "user", 1);
|
|
124
|
+
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".code-shell", "settings.json"), "project", 2);
|
|
125
|
+
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".claude", "settings.json"), "project", 2);
|
|
126
|
+
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".code-shell", "settings.local.json"), "local", 3);
|
|
127
|
+
this.loadJsonFile(_path.join.call(void 0, this.cwd, ".claude", "settings.local.json"), "local", 3);
|
|
128
|
+
if (flagOverrides && Object.keys(flagOverrides).length > 0) {
|
|
129
|
+
this.sources.push({ name: "flag", priority: 4, data: flagOverrides });
|
|
130
|
+
}
|
|
131
|
+
this.sources.sort((a, b) => a.priority - b.priority);
|
|
132
|
+
const raw = this.deepMerge();
|
|
133
|
+
this.merged = validateSettings(raw);
|
|
134
|
+
return this.merged;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get current effective settings.
|
|
138
|
+
*/
|
|
139
|
+
get() {
|
|
140
|
+
if (!this.merged) return this.load();
|
|
141
|
+
return this.merged;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Invalidate cached merge.
|
|
145
|
+
*/
|
|
146
|
+
invalidate() {
|
|
147
|
+
this.merged = null;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Persist a single setting (dotted key path) to the user-level config file
|
|
151
|
+
* at ~/.code-shell/settings.json. Other sources (project / local /
|
|
152
|
+
* managed) are intentionally untouched: writing back to project/local
|
|
153
|
+
* would surprise version control, and managed is read-only.
|
|
154
|
+
*
|
|
155
|
+
* The merged cache is invalidated so the next get() picks up the change.
|
|
156
|
+
*/
|
|
157
|
+
saveUserSetting(key, value) {
|
|
158
|
+
const path = _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "settings.json");
|
|
159
|
+
let current = {};
|
|
160
|
+
if (_fs.existsSync.call(void 0, path)) {
|
|
161
|
+
try {
|
|
162
|
+
const raw = _fs.readFileSync.call(void 0, path, "utf-8");
|
|
163
|
+
const parsed = JSON.parse(raw);
|
|
164
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
165
|
+
current = parsed;
|
|
166
|
+
}
|
|
167
|
+
} catch (e) {
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const parts = key.split(".");
|
|
171
|
+
let target = current;
|
|
172
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
173
|
+
const seg = parts[i];
|
|
174
|
+
const next = target[seg];
|
|
175
|
+
if (!next || typeof next !== "object" || Array.isArray(next)) {
|
|
176
|
+
target[seg] = {};
|
|
177
|
+
}
|
|
178
|
+
target = target[seg];
|
|
179
|
+
}
|
|
180
|
+
target[parts[parts.length - 1]] = value;
|
|
181
|
+
_fs.mkdirSync.call(void 0, _path.dirname.call(void 0, path), { recursive: true });
|
|
182
|
+
const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
183
|
+
_fs.writeFileSync.call(void 0, tmp, JSON.stringify(current, null, 2), "utf-8");
|
|
184
|
+
_fs.renameSync.call(void 0, tmp, path);
|
|
185
|
+
this.invalidate();
|
|
186
|
+
}
|
|
187
|
+
loadJsonFile(path, name, priority) {
|
|
188
|
+
if (!_fs.existsSync.call(void 0, path)) return;
|
|
189
|
+
try {
|
|
190
|
+
const content = _fs.readFileSync.call(void 0, path, "utf-8");
|
|
191
|
+
const data = JSON.parse(content);
|
|
192
|
+
if (typeof data === "object" && data !== null) {
|
|
193
|
+
this.sources.push({ name, priority, data });
|
|
194
|
+
}
|
|
195
|
+
} catch (e2) {
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
deepMerge() {
|
|
199
|
+
let result = {};
|
|
200
|
+
for (const source of this.sources) {
|
|
201
|
+
result = merge(result, source.data);
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
}, _class);
|
|
206
|
+
function merge(base, override) {
|
|
207
|
+
const result = { ...base };
|
|
208
|
+
for (const [key, value] of Object.entries(override)) {
|
|
209
|
+
if (value === null) {
|
|
210
|
+
delete result[key];
|
|
211
|
+
} else if (typeof value === "object" && !Array.isArray(value) && typeof result[key] === "object" && !Array.isArray(result[key]) && result[key] !== null) {
|
|
212
|
+
result[key] = merge(result[key], value);
|
|
213
|
+
} else {
|
|
214
|
+
result[key] = value;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
exports.SettingsSchema = SettingsSchema; exports.validateSettings = validateSettings; exports.SettingsManager = SettingsManager;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
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
3
|
|
|
4
4
|
|
|
5
5
|
var _chunkEL2RL5DGcjs = require('./chunk-EL2RL5DG.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
var _chunkJHNCK7JPcjs = require('./chunk-JHNCK7JP.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
9
12
|
|
|
10
13
|
// src/llm/client-base.ts
|
|
11
14
|
_chunkIJSHQGMPcjs.init_cjs_shims.call(void 0, );
|
|
12
|
-
var LLMClientBase = (_class = class {
|
|
15
|
+
var LLMClientBase = (_class = class _LLMClientBase {
|
|
13
16
|
constructor(config) {;_class.prototype.__init.call(this);
|
|
14
17
|
this.config = config;
|
|
15
18
|
this.provider = config.provider;
|
|
@@ -28,6 +31,13 @@ var LLMClientBase = (_class = class {
|
|
|
28
31
|
|
|
29
32
|
|
|
30
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Process-wide hook fired on every LLM response. The CLI installs this in
|
|
36
|
+
* main.ts to feed the cost tracker; lives on the base class so every code
|
|
37
|
+
* path (REPL, run, arena, sub-agents) reports through one funnel without
|
|
38
|
+
* each call site needing to remember.
|
|
39
|
+
*/
|
|
40
|
+
|
|
31
41
|
__init() {this.usage = {
|
|
32
42
|
records: [],
|
|
33
43
|
totalPromptTokens: 0,
|
|
@@ -41,6 +51,7 @@ var LLMClientBase = (_class = class {
|
|
|
41
51
|
this.usage.totalCompletionTokens += usage.completionTokens;
|
|
42
52
|
this.usage.totalTokens += usage.totalTokens;
|
|
43
53
|
this.usage.requestCount++;
|
|
54
|
+
_optionalChain([_LLMClientBase, 'access', _ => _.onUsage, 'optionalCall', _2 => _2(this.model, usage)]);
|
|
44
55
|
}
|
|
45
56
|
getUsage() {
|
|
46
57
|
return { ...this.usage };
|
|
@@ -56,11 +67,39 @@ var LLMClientBase = (_class = class {
|
|
|
56
67
|
if (err instanceof _chunkEL2RL5DGcjs.ContextLimitError) throw err;
|
|
57
68
|
if (err instanceof _chunkEL2RL5DGcjs.LLMRateLimitError) {
|
|
58
69
|
const waitMs = (_nullishCoalesce(err.retryAfter, () => ( attempt * 2))) * 1e3;
|
|
70
|
+
_chunkJHNCK7JPcjs.logger.warn("llm.retry", {
|
|
71
|
+
cat: "llm",
|
|
72
|
+
provider: this.provider,
|
|
73
|
+
model: this.model,
|
|
74
|
+
attempt,
|
|
75
|
+
of: attempts,
|
|
76
|
+
reason: "rate_limit",
|
|
77
|
+
waitMs
|
|
78
|
+
});
|
|
59
79
|
await new Promise((r) => setTimeout(r, waitMs));
|
|
60
80
|
continue;
|
|
61
81
|
}
|
|
62
|
-
if (attempt === attempts)
|
|
82
|
+
if (attempt === attempts) {
|
|
83
|
+
_chunkJHNCK7JPcjs.logger.error("llm.exhausted", {
|
|
84
|
+
cat: "llm",
|
|
85
|
+
provider: this.provider,
|
|
86
|
+
model: this.model,
|
|
87
|
+
attempts,
|
|
88
|
+
error: err.message
|
|
89
|
+
});
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
63
92
|
const backoff = Math.min(1e3 * Math.pow(2, attempt - 1), 3e4);
|
|
93
|
+
_chunkJHNCK7JPcjs.logger.warn("llm.retry", {
|
|
94
|
+
cat: "llm",
|
|
95
|
+
provider: this.provider,
|
|
96
|
+
model: this.model,
|
|
97
|
+
attempt,
|
|
98
|
+
of: attempts,
|
|
99
|
+
reason: "error",
|
|
100
|
+
error: err.message,
|
|
101
|
+
backoffMs: backoff
|
|
102
|
+
});
|
|
64
103
|
await new Promise((r) => setTimeout(r, backoff));
|
|
65
104
|
}
|
|
66
105
|
}
|