@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
|
@@ -30,18 +30,18 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
30
30
|
temperature: z.ZodDefault<z.ZodNumber>;
|
|
31
31
|
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
32
32
|
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
provider: string;
|
|
33
34
|
name: string;
|
|
34
35
|
maxTokens: number;
|
|
35
36
|
baseUrl: string;
|
|
36
|
-
provider: string;
|
|
37
37
|
temperature: number;
|
|
38
38
|
apiKey?: string | undefined;
|
|
39
39
|
}, {
|
|
40
|
+
provider?: string | undefined;
|
|
40
41
|
name?: string | undefined;
|
|
41
42
|
maxTokens?: number | undefined;
|
|
42
|
-
baseUrl?: string | undefined;
|
|
43
|
-
provider?: string | undefined;
|
|
44
43
|
apiKey?: string | undefined;
|
|
44
|
+
baseUrl?: string | undefined;
|
|
45
45
|
temperature?: number | undefined;
|
|
46
46
|
}>>;
|
|
47
47
|
models: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -52,22 +52,25 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
52
52
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
53
53
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
54
54
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
maxContextTokens: z.ZodOptional<z.ZodNumber>;
|
|
55
56
|
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
provider: string;
|
|
56
58
|
model: string;
|
|
57
59
|
key: string;
|
|
58
|
-
provider: string;
|
|
59
|
-
baseUrl?: string | undefined;
|
|
60
60
|
apiKey?: string | undefined;
|
|
61
|
+
baseUrl?: string | undefined;
|
|
61
62
|
label?: string | undefined;
|
|
62
63
|
maxOutputTokens?: number | undefined;
|
|
64
|
+
maxContextTokens?: number | undefined;
|
|
63
65
|
}, {
|
|
66
|
+
provider: string;
|
|
64
67
|
model: string;
|
|
65
68
|
key: string;
|
|
66
|
-
provider: string;
|
|
67
|
-
baseUrl?: string | undefined;
|
|
68
69
|
apiKey?: string | undefined;
|
|
70
|
+
baseUrl?: string | undefined;
|
|
69
71
|
label?: string | undefined;
|
|
70
72
|
maxOutputTokens?: number | undefined;
|
|
73
|
+
maxContextTokens?: number | undefined;
|
|
71
74
|
}>, "many">>;
|
|
72
75
|
permissions: z.ZodDefault<z.ZodObject<{
|
|
73
76
|
defaultMode: z.ZodDefault<z.ZodEnum<["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]>>;
|
|
@@ -178,31 +181,31 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
178
181
|
}, "strip", z.ZodTypeAny, {
|
|
179
182
|
model: string;
|
|
180
183
|
name: string;
|
|
181
|
-
baseUrl?: string | undefined;
|
|
182
184
|
provider?: string | undefined;
|
|
183
185
|
apiKey?: string | undefined;
|
|
186
|
+
baseUrl?: string | undefined;
|
|
184
187
|
}, {
|
|
185
188
|
model: string;
|
|
186
189
|
name: string;
|
|
187
|
-
baseUrl?: string | undefined;
|
|
188
190
|
provider?: string | undefined;
|
|
189
191
|
apiKey?: string | undefined;
|
|
192
|
+
baseUrl?: string | undefined;
|
|
190
193
|
}>]>, "many">>;
|
|
191
194
|
}, "strip", z.ZodTypeAny, {
|
|
192
195
|
participants: (string | {
|
|
193
196
|
model: string;
|
|
194
197
|
name: string;
|
|
195
|
-
baseUrl?: string | undefined;
|
|
196
198
|
provider?: string | undefined;
|
|
197
199
|
apiKey?: string | undefined;
|
|
200
|
+
baseUrl?: string | undefined;
|
|
198
201
|
})[];
|
|
199
202
|
}, {
|
|
200
203
|
participants?: (string | {
|
|
201
204
|
model: string;
|
|
202
205
|
name: string;
|
|
203
|
-
baseUrl?: string | undefined;
|
|
204
206
|
provider?: string | undefined;
|
|
205
207
|
apiKey?: string | undefined;
|
|
208
|
+
baseUrl?: string | undefined;
|
|
206
209
|
})[] | undefined;
|
|
207
210
|
}>>;
|
|
208
211
|
search: z.ZodDefault<z.ZodObject<{
|
|
@@ -211,12 +214,12 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
211
214
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
212
215
|
}, "strip", z.ZodTypeAny, {
|
|
213
216
|
provider: "serper" | "tavily" | "searxng";
|
|
214
|
-
baseUrl?: string | undefined;
|
|
215
217
|
apiKey?: string | undefined;
|
|
216
|
-
}, {
|
|
217
218
|
baseUrl?: string | undefined;
|
|
219
|
+
}, {
|
|
218
220
|
provider?: "serper" | "tavily" | "searxng" | undefined;
|
|
219
221
|
apiKey?: string | undefined;
|
|
222
|
+
baseUrl?: string | undefined;
|
|
220
223
|
}>>;
|
|
221
224
|
output: z.ZodDefault<z.ZodObject<{
|
|
222
225
|
format: z.ZodDefault<z.ZodEnum<["text", "json", "jsonl", "stream-json"]>>;
|
|
@@ -253,18 +256,18 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
253
256
|
temperature: z.ZodDefault<z.ZodNumber>;
|
|
254
257
|
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
255
258
|
}, "strip", z.ZodTypeAny, {
|
|
259
|
+
provider: string;
|
|
256
260
|
name: string;
|
|
257
261
|
maxTokens: number;
|
|
258
262
|
baseUrl: string;
|
|
259
|
-
provider: string;
|
|
260
263
|
temperature: number;
|
|
261
264
|
apiKey?: string | undefined;
|
|
262
265
|
}, {
|
|
266
|
+
provider?: string | undefined;
|
|
263
267
|
name?: string | undefined;
|
|
264
268
|
maxTokens?: number | undefined;
|
|
265
|
-
baseUrl?: string | undefined;
|
|
266
|
-
provider?: string | undefined;
|
|
267
269
|
apiKey?: string | undefined;
|
|
270
|
+
baseUrl?: string | undefined;
|
|
268
271
|
temperature?: number | undefined;
|
|
269
272
|
}>>;
|
|
270
273
|
models: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -275,22 +278,25 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
275
278
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
276
279
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
277
280
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
281
|
+
maxContextTokens: z.ZodOptional<z.ZodNumber>;
|
|
278
282
|
}, "strip", z.ZodTypeAny, {
|
|
283
|
+
provider: string;
|
|
279
284
|
model: string;
|
|
280
285
|
key: string;
|
|
281
|
-
provider: string;
|
|
282
|
-
baseUrl?: string | undefined;
|
|
283
286
|
apiKey?: string | undefined;
|
|
287
|
+
baseUrl?: string | undefined;
|
|
284
288
|
label?: string | undefined;
|
|
285
289
|
maxOutputTokens?: number | undefined;
|
|
290
|
+
maxContextTokens?: number | undefined;
|
|
286
291
|
}, {
|
|
292
|
+
provider: string;
|
|
287
293
|
model: string;
|
|
288
294
|
key: string;
|
|
289
|
-
provider: string;
|
|
290
|
-
baseUrl?: string | undefined;
|
|
291
295
|
apiKey?: string | undefined;
|
|
296
|
+
baseUrl?: string | undefined;
|
|
292
297
|
label?: string | undefined;
|
|
293
298
|
maxOutputTokens?: number | undefined;
|
|
299
|
+
maxContextTokens?: number | undefined;
|
|
294
300
|
}>, "many">>;
|
|
295
301
|
permissions: z.ZodDefault<z.ZodObject<{
|
|
296
302
|
defaultMode: z.ZodDefault<z.ZodEnum<["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]>>;
|
|
@@ -401,31 +407,31 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
401
407
|
}, "strip", z.ZodTypeAny, {
|
|
402
408
|
model: string;
|
|
403
409
|
name: string;
|
|
404
|
-
baseUrl?: string | undefined;
|
|
405
410
|
provider?: string | undefined;
|
|
406
411
|
apiKey?: string | undefined;
|
|
412
|
+
baseUrl?: string | undefined;
|
|
407
413
|
}, {
|
|
408
414
|
model: string;
|
|
409
415
|
name: string;
|
|
410
|
-
baseUrl?: string | undefined;
|
|
411
416
|
provider?: string | undefined;
|
|
412
417
|
apiKey?: string | undefined;
|
|
418
|
+
baseUrl?: string | undefined;
|
|
413
419
|
}>]>, "many">>;
|
|
414
420
|
}, "strip", z.ZodTypeAny, {
|
|
415
421
|
participants: (string | {
|
|
416
422
|
model: string;
|
|
417
423
|
name: string;
|
|
418
|
-
baseUrl?: string | undefined;
|
|
419
424
|
provider?: string | undefined;
|
|
420
425
|
apiKey?: string | undefined;
|
|
426
|
+
baseUrl?: string | undefined;
|
|
421
427
|
})[];
|
|
422
428
|
}, {
|
|
423
429
|
participants?: (string | {
|
|
424
430
|
model: string;
|
|
425
431
|
name: string;
|
|
426
|
-
baseUrl?: string | undefined;
|
|
427
432
|
provider?: string | undefined;
|
|
428
433
|
apiKey?: string | undefined;
|
|
434
|
+
baseUrl?: string | undefined;
|
|
429
435
|
})[] | undefined;
|
|
430
436
|
}>>;
|
|
431
437
|
search: z.ZodDefault<z.ZodObject<{
|
|
@@ -434,12 +440,12 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
434
440
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
435
441
|
}, "strip", z.ZodTypeAny, {
|
|
436
442
|
provider: "serper" | "tavily" | "searxng";
|
|
437
|
-
baseUrl?: string | undefined;
|
|
438
443
|
apiKey?: string | undefined;
|
|
439
|
-
}, {
|
|
440
444
|
baseUrl?: string | undefined;
|
|
445
|
+
}, {
|
|
441
446
|
provider?: "serper" | "tavily" | "searxng" | undefined;
|
|
442
447
|
apiKey?: string | undefined;
|
|
448
|
+
baseUrl?: string | undefined;
|
|
443
449
|
}>>;
|
|
444
450
|
output: z.ZodDefault<z.ZodObject<{
|
|
445
451
|
format: z.ZodDefault<z.ZodEnum<["text", "json", "jsonl", "stream-json"]>>;
|
|
@@ -476,18 +482,18 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
476
482
|
temperature: z.ZodDefault<z.ZodNumber>;
|
|
477
483
|
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
478
484
|
}, "strip", z.ZodTypeAny, {
|
|
485
|
+
provider: string;
|
|
479
486
|
name: string;
|
|
480
487
|
maxTokens: number;
|
|
481
488
|
baseUrl: string;
|
|
482
|
-
provider: string;
|
|
483
489
|
temperature: number;
|
|
484
490
|
apiKey?: string | undefined;
|
|
485
491
|
}, {
|
|
492
|
+
provider?: string | undefined;
|
|
486
493
|
name?: string | undefined;
|
|
487
494
|
maxTokens?: number | undefined;
|
|
488
|
-
baseUrl?: string | undefined;
|
|
489
|
-
provider?: string | undefined;
|
|
490
495
|
apiKey?: string | undefined;
|
|
496
|
+
baseUrl?: string | undefined;
|
|
491
497
|
temperature?: number | undefined;
|
|
492
498
|
}>>;
|
|
493
499
|
models: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -498,22 +504,25 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
498
504
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
499
505
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
500
506
|
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
507
|
+
maxContextTokens: z.ZodOptional<z.ZodNumber>;
|
|
501
508
|
}, "strip", z.ZodTypeAny, {
|
|
509
|
+
provider: string;
|
|
502
510
|
model: string;
|
|
503
511
|
key: string;
|
|
504
|
-
provider: string;
|
|
505
|
-
baseUrl?: string | undefined;
|
|
506
512
|
apiKey?: string | undefined;
|
|
513
|
+
baseUrl?: string | undefined;
|
|
507
514
|
label?: string | undefined;
|
|
508
515
|
maxOutputTokens?: number | undefined;
|
|
516
|
+
maxContextTokens?: number | undefined;
|
|
509
517
|
}, {
|
|
518
|
+
provider: string;
|
|
510
519
|
model: string;
|
|
511
520
|
key: string;
|
|
512
|
-
provider: string;
|
|
513
|
-
baseUrl?: string | undefined;
|
|
514
521
|
apiKey?: string | undefined;
|
|
522
|
+
baseUrl?: string | undefined;
|
|
515
523
|
label?: string | undefined;
|
|
516
524
|
maxOutputTokens?: number | undefined;
|
|
525
|
+
maxContextTokens?: number | undefined;
|
|
517
526
|
}>, "many">>;
|
|
518
527
|
permissions: z.ZodDefault<z.ZodObject<{
|
|
519
528
|
defaultMode: z.ZodDefault<z.ZodEnum<["default", "acceptEdits", "dontAsk", "bypassPermissions", "auto", "plan"]>>;
|
|
@@ -624,31 +633,31 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
624
633
|
}, "strip", z.ZodTypeAny, {
|
|
625
634
|
model: string;
|
|
626
635
|
name: string;
|
|
627
|
-
baseUrl?: string | undefined;
|
|
628
636
|
provider?: string | undefined;
|
|
629
637
|
apiKey?: string | undefined;
|
|
638
|
+
baseUrl?: string | undefined;
|
|
630
639
|
}, {
|
|
631
640
|
model: string;
|
|
632
641
|
name: string;
|
|
633
|
-
baseUrl?: string | undefined;
|
|
634
642
|
provider?: string | undefined;
|
|
635
643
|
apiKey?: string | undefined;
|
|
644
|
+
baseUrl?: string | undefined;
|
|
636
645
|
}>]>, "many">>;
|
|
637
646
|
}, "strip", z.ZodTypeAny, {
|
|
638
647
|
participants: (string | {
|
|
639
648
|
model: string;
|
|
640
649
|
name: string;
|
|
641
|
-
baseUrl?: string | undefined;
|
|
642
650
|
provider?: string | undefined;
|
|
643
651
|
apiKey?: string | undefined;
|
|
652
|
+
baseUrl?: string | undefined;
|
|
644
653
|
})[];
|
|
645
654
|
}, {
|
|
646
655
|
participants?: (string | {
|
|
647
656
|
model: string;
|
|
648
657
|
name: string;
|
|
649
|
-
baseUrl?: string | undefined;
|
|
650
658
|
provider?: string | undefined;
|
|
651
659
|
apiKey?: string | undefined;
|
|
660
|
+
baseUrl?: string | undefined;
|
|
652
661
|
})[] | undefined;
|
|
653
662
|
}>>;
|
|
654
663
|
search: z.ZodDefault<z.ZodObject<{
|
|
@@ -657,12 +666,12 @@ export declare const SettingsSchema: z.ZodObject<{
|
|
|
657
666
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
658
667
|
}, "strip", z.ZodTypeAny, {
|
|
659
668
|
provider: "serper" | "tavily" | "searxng";
|
|
660
|
-
baseUrl?: string | undefined;
|
|
661
669
|
apiKey?: string | undefined;
|
|
662
|
-
}, {
|
|
663
670
|
baseUrl?: string | undefined;
|
|
671
|
+
}, {
|
|
664
672
|
provider?: "serper" | "tavily" | "searxng" | undefined;
|
|
665
673
|
apiKey?: string | undefined;
|
|
674
|
+
baseUrl?: string | undefined;
|
|
666
675
|
}>>;
|
|
667
676
|
output: z.ZodDefault<z.ZodObject<{
|
|
668
677
|
format: z.ZodDefault<z.ZodEnum<["text", "json", "jsonl", "stream-json"]>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJHNCK7JPcjs = require('./chunk-JHNCK7JP.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
|
|
@@ -22,7 +22,7 @@ async function generateToolUseSummary(toolCalls, results, summarize) {
|
|
|
22
22
|
const summary = await summarize(SUMMARY_SYSTEM_PROMPT, parts.join("\n"));
|
|
23
23
|
return _optionalChain([summary, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]) || null;
|
|
24
24
|
} catch (err) {
|
|
25
|
-
|
|
25
|
+
_chunkJHNCK7JPcjs.logger.warn("tool_summary.failed", { error: err.message });
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -6,33 +6,10 @@
|
|
|
6
6
|
* Supports AbortSignal for cascading cancellation.
|
|
7
7
|
* Supports onStream for real-time output passthrough.
|
|
8
8
|
*/
|
|
9
|
-
import type { ToolDefinition
|
|
10
|
-
import type {
|
|
9
|
+
import type { ToolDefinition } from "../../types.js";
|
|
10
|
+
import type { ToolContext } from "../context.js";
|
|
11
11
|
export declare const agentToolDef: ToolDefinition;
|
|
12
|
-
export
|
|
13
|
-
llm: import("../../types.js").LLMConfig;
|
|
14
|
-
cwd: string;
|
|
15
|
-
permissionMode: string;
|
|
16
|
-
preset?: AgentPresetName;
|
|
17
|
-
enabledBuiltinTools?: string[];
|
|
18
|
-
disabledBuiltinTools?: string[];
|
|
19
|
-
customSystemPrompt?: string;
|
|
20
|
-
appendSystemPrompt?: string;
|
|
21
|
-
maxContextTokens: number;
|
|
22
|
-
sessionStorageDir?: string;
|
|
23
|
-
onStream?: StreamCallback;
|
|
24
|
-
createEngine: (config: Record<string, unknown>) => {
|
|
25
|
-
run(task: string, options?: {
|
|
26
|
-
signal?: AbortSignal;
|
|
27
|
-
onStream?: StreamCallback;
|
|
28
|
-
}): Promise<{
|
|
29
|
-
text: string;
|
|
30
|
-
reason: string;
|
|
31
|
-
}>;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export declare function setSubAgentConfig(config: SubAgentConfig | undefined): void;
|
|
35
|
-
export declare function agentTool(args: Record<string, unknown>): Promise<string>;
|
|
12
|
+
export declare function agentTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
36
13
|
export declare const agentStatusToolDef: ToolDefinition;
|
|
37
14
|
export declare function agentStatusTool(args: Record<string, unknown>): Promise<string>;
|
|
38
15
|
export declare const agentCancelToolDef: ToolDefinition;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Hunk } from "./types.js";
|
|
2
|
+
export interface ApplyPatchOptions {
|
|
3
|
+
/** Working directory for resolving relative paths in the patch. */
|
|
4
|
+
cwd: string;
|
|
5
|
+
/**
|
|
6
|
+
* If true, skip the snapshot/rollback safety net and apply each planned
|
|
7
|
+
* change one at a time, leaving partial work on disk if a later write
|
|
8
|
+
* fails. Mostly useful for codex-parity testing. Default: false.
|
|
9
|
+
*/
|
|
10
|
+
allowPartialOnCommit?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ApplyPatchResult {
|
|
13
|
+
added: string[];
|
|
14
|
+
modified: string[];
|
|
15
|
+
deleted: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Plan and commit the patch atomically.
|
|
19
|
+
*
|
|
20
|
+
* Phase 1 (plan): walk every hunk, compute the resulting file content in
|
|
21
|
+
* memory. Throws if any hunk cannot be applied; nothing is written.
|
|
22
|
+
*
|
|
23
|
+
* Phase 2 (commit): write all planned changes. If any write fails, restore
|
|
24
|
+
* from the in-memory snapshot captured in phase 1 and rethrow.
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyPatch(hunks: Hunk[], options: ApplyPatchOptions): Promise<ApplyPatchResult>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ApplyPatch tool — atomic, multi-file V4A patch application.
|
|
3
|
+
*
|
|
4
|
+
* Adapted from openai/codex codex-rs/apply-patch (Apache-2.0). See LICENSE-codex.
|
|
5
|
+
*
|
|
6
|
+
* Compared to Codex's reference implementation:
|
|
7
|
+
* - We dry-run all hunks first; nothing is written until every hunk
|
|
8
|
+
* successfully resolves.
|
|
9
|
+
* - On commit we snapshot every target file, so a write failure rolls back
|
|
10
|
+
* to the pre-patch state instead of leaving partial changes.
|
|
11
|
+
*
|
|
12
|
+
* Compared to CodeShell's existing Edit:
|
|
13
|
+
* - Multi-file in one call (cuts LLM round-trips for large changes).
|
|
14
|
+
* - Supports create / update / delete / rename in one transaction.
|
|
15
|
+
* - Context-anchor matching tolerates whitespace and Unicode quirks.
|
|
16
|
+
*/
|
|
17
|
+
import type { ToolDefinition } from "../../../types.js";
|
|
18
|
+
export declare const applyPatchToolDef: ToolDefinition;
|
|
19
|
+
export declare function applyPatchTool(args: Record<string, unknown>): Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Hunk } from "./types.js";
|
|
2
|
+
export declare const BEGIN_PATCH_MARKER = "*** Begin Patch";
|
|
3
|
+
export declare const END_PATCH_MARKER = "*** End Patch";
|
|
4
|
+
export declare const ADD_FILE_MARKER = "*** Add File: ";
|
|
5
|
+
export declare const DELETE_FILE_MARKER = "*** Delete File: ";
|
|
6
|
+
export declare const UPDATE_FILE_MARKER = "*** Update File: ";
|
|
7
|
+
export declare const MOVE_TO_MARKER = "*** Move to: ";
|
|
8
|
+
export declare const EOF_MARKER = "*** End of File";
|
|
9
|
+
export declare const CHANGE_CONTEXT_MARKER = "@@ ";
|
|
10
|
+
export declare const EMPTY_CHANGE_CONTEXT_MARKER = "@@";
|
|
11
|
+
export interface ParsedPatch {
|
|
12
|
+
hunks: Hunk[];
|
|
13
|
+
/** The patch body with any heredoc wrapper stripped. */
|
|
14
|
+
patch: string;
|
|
15
|
+
}
|
|
16
|
+
export type ParseMode = "strict" | "lenient";
|
|
17
|
+
export declare function parsePatch(text: string, mode?: ParseMode): ParsedPatch;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locate `pattern` within `lines` starting at or after `start`.
|
|
3
|
+
*
|
|
4
|
+
* Tries four passes with decreasing strictness:
|
|
5
|
+
* 1. exact equality
|
|
6
|
+
* 2. trailing whitespace ignored
|
|
7
|
+
* 3. leading + trailing whitespace ignored
|
|
8
|
+
* 4. Unicode punctuation normalized to ASCII (smart quotes, em-dashes, NBSP, …)
|
|
9
|
+
*
|
|
10
|
+
* When `eof` is true, search begins at the position that would let `pattern`
|
|
11
|
+
* end exactly at the end of `lines` — useful for chunks marked
|
|
12
|
+
* `*** End of File`. Falls back to `start` if that position is out of range.
|
|
13
|
+
*
|
|
14
|
+
* Defensive cases:
|
|
15
|
+
* - Empty pattern returns `start` (no-op match).
|
|
16
|
+
* - Pattern longer than input returns `null`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function seekSequence(lines: string[], pattern: string[], start: number, eof: boolean): number | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V4A patch AST. A parsed patch is a list of Hunks; each Hunk targets one file.
|
|
3
|
+
*
|
|
4
|
+
* Three variants:
|
|
5
|
+
* - AddFile: create a new file with the given contents
|
|
6
|
+
* - DeleteFile: remove an existing file
|
|
7
|
+
* - UpdateFile: in-place edit (optionally with a rename via movePath),
|
|
8
|
+
* expressed as one or more UpdateFileChunks.
|
|
9
|
+
*/
|
|
10
|
+
export type Hunk = {
|
|
11
|
+
kind: "add";
|
|
12
|
+
path: string;
|
|
13
|
+
contents: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "delete";
|
|
16
|
+
path: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "update";
|
|
19
|
+
path: string;
|
|
20
|
+
movePath?: string;
|
|
21
|
+
chunks: UpdateFileChunk[];
|
|
22
|
+
};
|
|
23
|
+
export interface UpdateFileChunk {
|
|
24
|
+
/** Optional `@@ <context>` anchor that narrows where this chunk applies. */
|
|
25
|
+
changeContext?: string;
|
|
26
|
+
/** Lines that must match in the existing file (` ` and `-` markers). */
|
|
27
|
+
oldLines: string[];
|
|
28
|
+
/** Lines that should appear after the edit (` ` and `+` markers). */
|
|
29
|
+
newLines: string[];
|
|
30
|
+
/** True if this chunk ended with `*** End of File`; matches only at EOF. */
|
|
31
|
+
isEndOfFile: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare class PatchParseError extends Error {
|
|
34
|
+
readonly kind: "InvalidPatch" | "InvalidHunk";
|
|
35
|
+
readonly lineNumber?: number;
|
|
36
|
+
constructor(kind: "InvalidPatch" | "InvalidHunk", message: string, lineNumber?: number);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Result of staging (dry-run) a single file's planned change.
|
|
40
|
+
*
|
|
41
|
+
* A rename is represented as two PlannedFileChange entries: one for the
|
|
42
|
+
* source path with `newContent: null` (delete) and one for the destination
|
|
43
|
+
* path with the new content.
|
|
44
|
+
*/
|
|
45
|
+
export interface PlannedFileChange {
|
|
46
|
+
path: string;
|
|
47
|
+
/** null = delete; string = create-or-overwrite with this content. */
|
|
48
|
+
newContent: string | null;
|
|
49
|
+
}
|
|
@@ -8,11 +8,24 @@
|
|
|
8
8
|
* setArenaLLMConfig(), following the same pattern as setAskUserFn() and
|
|
9
9
|
* setSubAgentConfig().
|
|
10
10
|
*/
|
|
11
|
-
import type { ToolDefinition
|
|
11
|
+
import type { ToolDefinition } from "../../types.js";
|
|
12
|
+
import type { ToolContext } from "../context.js";
|
|
12
13
|
export declare const arenaToolDef: ToolDefinition;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* Snapshot of what Arena would do right now if invoked. Used by the
|
|
16
|
+
* `/arena` REPL command (via the protocol `arena_status` query) so
|
|
17
|
+
* users can see participants/endpoint before launching a run.
|
|
16
18
|
*/
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
+
export interface ArenaStatus {
|
|
20
|
+
endpoint?: string;
|
|
21
|
+
defaultParticipants: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
model: string;
|
|
24
|
+
source: "pool" | "preset" | "raw";
|
|
25
|
+
compatible: boolean;
|
|
26
|
+
reason?: string;
|
|
27
|
+
}>;
|
|
28
|
+
poolSize: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function getArenaStatus(): ArenaStatus;
|
|
31
|
+
export declare function arenaTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in AskUserQuestion tool — ask the user a question during execution.
|
|
3
|
+
*
|
|
4
|
+
* The actual prompt-the-user implementation is provided per-Engine via
|
|
5
|
+
* ToolContext.askUser. Headless mode (no UI wired up) leaves askUser
|
|
6
|
+
* undefined and the tool reports back asking the LLM to assume.
|
|
3
7
|
*/
|
|
4
8
|
import type { ToolDefinition } from "../../types.js";
|
|
9
|
+
import type { ToolContext } from "../context.js";
|
|
5
10
|
export declare const askUserToolDef: ToolDefinition;
|
|
6
|
-
/**
|
|
7
|
-
* Factory: the actual executor is injected at runtime by the Engine,
|
|
8
|
-
* because it depends on the CLI/UI layer to collect user input.
|
|
9
|
-
*/
|
|
10
11
|
export type AskUserFn = (question: string) => Promise<string>;
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function askUserTool(args: Record<string, unknown>): Promise<string>;
|
|
12
|
+
export declare function askUserTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
* Built-in tool registration.
|
|
3
3
|
*/
|
|
4
4
|
import type { RegisteredTool } from "../../types.js";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Tool executor signature.
|
|
7
|
+
*
|
|
8
|
+
* Tools may inspect ctx for runtime services (askUser, llmConfig, modelPool,
|
|
9
|
+
* toolRegistry, subAgentSpawner). Tools that don't need any of these — Read,
|
|
10
|
+
* Write, Bash, Edit, Glob, Grep, etc. — may simply ignore the second arg.
|
|
11
|
+
*
|
|
12
|
+
* ctx is optional in the signature so legacy call sites (and tests) that
|
|
13
|
+
* pass only args still type-check; ToolRegistry always passes ctx at runtime.
|
|
14
|
+
*/
|
|
15
|
+
export type BuiltinToolFn = (args: Record<string, unknown>, ctx?: import("../context.js").ToolContext) => Promise<string>;
|
|
6
16
|
export interface BuiltinTool {
|
|
7
17
|
definition: RegisteredTool;
|
|
8
18
|
execute: BuiltinToolFn;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* saving context by not loading all MCP tool schemas upfront.
|
|
7
7
|
*/
|
|
8
8
|
import type { ToolDefinition } from "../../types.js";
|
|
9
|
-
import type {
|
|
9
|
+
import type { ToolContext } from "../context.js";
|
|
10
10
|
export declare const toolSearchToolDef: ToolDefinition;
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function toolSearchTool(args: Record<string, unknown>): Promise<string>;
|
|
11
|
+
export declare function toolSearchTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolContext — runtime services injected into every tool execution.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the legacy module-level singletons (`setAskUserFn`,
|
|
5
|
+
* `setArenaLLMConfig`, `setSubAgentConfig`, `setToolSearchRegistry`).
|
|
6
|
+
*
|
|
7
|
+
* Each Engine instance builds its own ToolContext when run() starts and
|
|
8
|
+
* passes it through ToolExecutor → ToolRegistry → executor function.
|
|
9
|
+
* That makes concurrent Engine instances safe: tools never see another
|
|
10
|
+
* Engine's askUser handler or LLM credentials.
|
|
11
|
+
*
|
|
12
|
+
* Tools that don't need any context (Read/Write/Bash/...) just ignore
|
|
13
|
+
* the second argument; the type is purely additive.
|
|
14
|
+
*/
|
|
15
|
+
import type { LLMConfig, StreamCallback } from "../types.js";
|
|
16
|
+
import type { ModelPool } from "../llm/model-pool.js";
|
|
17
|
+
import type { ToolRegistry } from "./registry.js";
|
|
18
|
+
import type { AgentPresetName } from "../preset/index.js";
|
|
19
|
+
/** Function the host UI / server uses to ask the user a question. */
|
|
20
|
+
export type AskUserFn = (question: string) => Promise<string>;
|
|
21
|
+
/** Spawn a sub-agent. Returns the produced text or throws. */
|
|
22
|
+
export interface SubAgentSpawnRequest {
|
|
23
|
+
agentId: string;
|
|
24
|
+
description: string;
|
|
25
|
+
prompt: string;
|
|
26
|
+
maxTurns: number;
|
|
27
|
+
signal: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
export interface SubAgentSpawner {
|
|
30
|
+
/** Run a sub-agent synchronously and return its text output. */
|
|
31
|
+
spawn(req: SubAgentSpawnRequest): Promise<string>;
|
|
32
|
+
/** Stream callback to forward sub-agent events back to the parent UI. */
|
|
33
|
+
parentStream?: StreamCallback;
|
|
34
|
+
/** Static config used to describe what the spawned engine looks like. */
|
|
35
|
+
describe(): {
|
|
36
|
+
cwd: string;
|
|
37
|
+
preset?: AgentPresetName;
|
|
38
|
+
permissionMode: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The full context object handed to every tool invocation.
|
|
43
|
+
*
|
|
44
|
+
* Optional fields are filled in by Engine.run(); some headless paths may
|
|
45
|
+
* leave them undefined (e.g. running without UI → no askUser).
|
|
46
|
+
*/
|
|
47
|
+
export interface ToolContext {
|
|
48
|
+
/** Active working directory for this Engine. */
|
|
49
|
+
cwd: string;
|
|
50
|
+
/** LLM credentials/endpoint for tools that need to make their own calls. */
|
|
51
|
+
llmConfig: LLMConfig;
|
|
52
|
+
/** Active model pool (Arena reads this to pick participants). */
|
|
53
|
+
modelPool?: ModelPool;
|
|
54
|
+
/** Tool registry (ToolSearch reads this to enumerate available tools). */
|
|
55
|
+
toolRegistry: ToolRegistry;
|
|
56
|
+
/** UI-backed AskUserQuestion handler. Undefined → headless mode. */
|
|
57
|
+
askUser?: AskUserFn;
|
|
58
|
+
/** Sub-agent spawner (Agent tool). Undefined → Agent tool unavailable. */
|
|
59
|
+
subAgentSpawner?: SubAgentSpawner;
|
|
60
|
+
/** Optional cancellation signal for the whole turn. */
|
|
61
|
+
signal?: AbortSignal;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Per-Engine container that produces a fresh ToolContext on demand.
|
|
65
|
+
* Engine creates one of these in run() and passes it to ToolExecutor.
|
|
66
|
+
*/
|
|
67
|
+
export declare class ServiceContainer {
|
|
68
|
+
private readonly base;
|
|
69
|
+
constructor(base: ToolContext);
|
|
70
|
+
/** Snapshot of the context at this moment. */
|
|
71
|
+
get(): ToolContext;
|
|
72
|
+
/** Create a derived context with overridden fields (e.g. per-call signal). */
|
|
73
|
+
withSignal(signal: AbortSignal): ToolContext;
|
|
74
|
+
}
|