@shareai-lab/kode 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{Doctor-AES5ON33.js → Doctor-TWRIVOVW.js} +13 -13
- package/dist/chunks/{LogList-PQJEJHHE.js → LogList-PUTPM24L.js} +10 -10
- package/dist/chunks/REPL-YGIR5VXC.js +78 -0
- package/dist/chunks/{ResumeConversation-OWQ3DB4M.js → ResumeConversation-IJMKQXBU.js} +44 -44
- package/dist/chunks/{ScreenFrame-AGLR6B4D.js → ScreenFrame-PQJRZ5DQ.js} +2 -2
- package/dist/chunks/{agentLoader-BMWB4UKI.js → agentLoader-GOYNJTAO.js} +5 -5
- package/dist/chunks/{agentsValidate-LSMJSFYW.js → agentsValidate-R26AKPAA.js} +6 -6
- package/dist/chunks/{ask-3TSZR6AJ.js → ask-6SYVJONJ.js} +18 -18
- package/dist/chunks/{autoUpdater-MEPC7LJF.js → autoUpdater-SDLJ5QSH.js} +4 -4
- package/dist/chunks/{chunk-NC3RX5AB.js → chunk-2B2TR2S3.js} +4 -4
- package/dist/chunks/{chunk-HDEYMVIJ.js → chunk-437YGKVA.js} +2 -2
- package/dist/chunks/{chunk-WGMKKKS2.js → chunk-4BBWDSDC.js} +1 -1
- package/dist/chunks/{chunk-KKOES3YK.js → chunk-4T5LR4P5.js} +55 -116
- package/dist/chunks/chunk-4T5LR4P5.js.map +7 -0
- package/dist/chunks/{chunk-PMC3BZ3M.js → chunk-5HZWM4JB.js} +1 -1
- package/dist/chunks/{chunk-REQTXUXO.js → chunk-5LBRVQT5.js} +1 -1
- package/dist/chunks/{chunk-BEDQTC44.js → chunk-5LL33G6X.js} +2 -2
- package/dist/chunks/{chunk-YUXYJB45.js → chunk-5RCVEFJS.js} +19 -8
- package/dist/chunks/chunk-5RCVEFJS.js.map +7 -0
- package/dist/chunks/{chunk-MDCOIZVX.js → chunk-6C6VNA2D.js} +2 -2
- package/dist/chunks/{chunk-P77NF36M.js → chunk-6CAQXUDY.js} +1 -1
- package/dist/chunks/{chunk-DPQE5NA4.js → chunk-7SRIFZDJ.js} +1 -1
- package/dist/chunks/{chunk-TI2CTTMA.js → chunk-7ZC22R33.js} +1 -1
- package/dist/chunks/{chunk-EV56PDOI.js → chunk-AX3VXMUS.js} +1 -1
- package/dist/chunks/{chunk-5MVUCX6O.js → chunk-AZHJLRRP.js} +1 -1
- package/dist/chunks/{chunk-LIBZWJEW.js → chunk-BNSPVA24.js} +11 -10
- package/dist/chunks/chunk-BNSPVA24.js.map +7 -0
- package/dist/chunks/{chunk-Z3J3WJ2K.js → chunk-BPMYW5DT.js} +415 -414
- package/dist/chunks/chunk-BPMYW5DT.js.map +7 -0
- package/dist/chunks/{chunk-QBW7VU7C.js → chunk-DWKF6SQH.js} +3 -3
- package/dist/chunks/{chunk-4RVYYLN7.js → chunk-E4C4N7OV.js} +1 -1
- package/dist/chunks/{chunk-4RVYYLN7.js.map → chunk-E4C4N7OV.js.map} +1 -1
- package/dist/chunks/chunk-ESRGV7DC.js +34 -0
- package/dist/chunks/chunk-ESRGV7DC.js.map +7 -0
- package/dist/chunks/{chunk-VSKGDU73.js → chunk-FKWFR23G.js} +2 -2
- package/dist/chunks/{chunk-E6BU32L2.js → chunk-H5F7M5D3.js} +2 -2
- package/dist/chunks/{chunk-DZPD6H7A.js → chunk-JXYXMP2Q.js} +2 -2
- package/dist/chunks/{chunk-65FLXXMH.js → chunk-KA543BHH.js} +8 -8
- package/dist/chunks/{chunk-MEQ7TAT7.js → chunk-KHMXPPO7.js} +4 -4
- package/dist/chunks/{chunk-G5ET7GFB.js → chunk-KQV5FGSS.js} +5 -5
- package/dist/chunks/{chunk-DPVCHIF7.js → chunk-KRBZO255.js} +1 -1
- package/dist/chunks/{chunk-Y33AS3MY.js → chunk-L2LWCVUF.js} +21 -7
- package/dist/chunks/chunk-L2LWCVUF.js.map +7 -0
- package/dist/chunks/{chunk-EKXQ7ZWV.js → chunk-L5ZJIOEF.js} +4 -4
- package/dist/chunks/{chunk-UUJN5ZCN.js → chunk-LBHVWSUP.js} +2 -2
- package/dist/chunks/{chunk-GL6HUBBX.js → chunk-LKDMUCWA.js} +6 -6
- package/dist/chunks/{chunk-HJCYE2AS.js → chunk-LUZMHHQF.js} +10 -10
- package/dist/chunks/{chunk-MXFN7OSL.js → chunk-MOGUUWKG.js} +1 -1
- package/dist/chunks/{chunk-4UDKRYWZ.js → chunk-N4772IDQ.js} +3 -3
- package/dist/chunks/{chunk-TJMA65RL.js → chunk-N5AH66UG.js} +168 -23
- package/dist/chunks/chunk-N5AH66UG.js.map +7 -0
- package/dist/chunks/{chunk-JJ67KF6A.js → chunk-PTIAF6KF.js} +4 -4
- package/dist/chunks/{chunk-YUJB4WDK.js → chunk-PVMCLI36.js} +1 -1
- package/dist/chunks/{chunk-3TLVYEGW.js → chunk-RTGKCKD3.js} +1 -1
- package/dist/chunks/{chunk-AKC4BUW5.js → chunk-SOBWNYOW.js} +7 -6
- package/dist/chunks/chunk-SOBWNYOW.js.map +7 -0
- package/dist/chunks/{chunk-3DBNJOZI.js → chunk-SUNG5KP5.js} +1 -1
- package/dist/chunks/{chunk-VBGSHKHX.js → chunk-SVRXO73D.js} +16 -13
- package/dist/chunks/chunk-SVRXO73D.js.map +7 -0
- package/dist/chunks/{chunk-Q55CB4Y4.js → chunk-WE7CQGRG.js} +2 -2
- package/dist/chunks/{chunk-V3IXG64X.js → chunk-WOMV4RCI.js} +404 -446
- package/dist/chunks/chunk-WOMV4RCI.js.map +7 -0
- package/dist/chunks/{chunk-ZAT5BSQI.js → chunk-WVJMXIKQ.js} +12 -12
- package/dist/chunks/{chunk-ZAT5BSQI.js.map → chunk-WVJMXIKQ.js.map} +1 -1
- package/dist/chunks/{chunk-DELUVYKS.js → chunk-XVNEJVZC.js} +2 -2
- package/dist/chunks/{chunk-KDY7XYYS.js → chunk-YQ3YJSMI.js} +1 -1
- package/dist/chunks/{chunk-6CNJ3CYQ.js → chunk-YUZBVKVH.js} +3 -3
- package/dist/chunks/{chunk-VJ2QSQ3E.js → chunk-ZXOTOID7.js} +2 -2
- package/dist/chunks/{client-OWTJ7TPE.js → client-QUCHWMEW.js} +5 -5
- package/dist/chunks/{customCommands-FA6HRXXV.js → customCommands-S6YGRUED.js} +5 -5
- package/dist/chunks/{engine-UBCAVO7E.js → engine-FRDEQVDF.js} +17 -17
- package/dist/chunks/{env-JIMGBRE2.js → env-YH77MILU.js} +3 -3
- package/dist/chunks/{kodeAgentSessionLoad-BZRTCPMB.js → kodeAgentSessionLoad-TBPU4TWU.js} +3 -3
- package/dist/chunks/{kodeAgentSessionResume-V3WB3OWQ.js → kodeAgentSessionResume-3CNE5T6N.js} +3 -3
- package/dist/chunks/{kodeHooks-R3YHG4ZI.js → kodeHooks-6SWQE5W7.js} +4 -4
- package/dist/chunks/{llm-C4F2Q7I2.js → llm-PONI6QWH.js} +47 -20
- package/dist/chunks/llm-PONI6QWH.js.map +7 -0
- package/dist/chunks/{llmLazy-IBED5LIH.js → llmLazy-O4T62IIT.js} +1 -1
- package/dist/chunks/{mcpCli-A744Z3FL.js → mcpCli-HIA4I4GG.js} +5 -5
- package/dist/chunks/{mentionProcessor-VV6DN2LJ.js → mentionProcessor-HH4EF7BE.js} +6 -6
- package/dist/chunks/{messages-ZR64JVON.js → messages-WKWCZBGM.js} +1 -1
- package/dist/chunks/{model-NPMMYL2U.js → model-4EIFU5QN.js} +5 -5
- package/dist/chunks/{openai-FEBNBOGM.js → openai-KTBJ2KNZ.js} +5 -5
- package/dist/chunks/{permissions-34CRWMCH.js → permissions-C3N4DKS2.js} +7 -7
- package/dist/chunks/{pluginRuntime-7YBUMVFI.js → pluginRuntime-2FKZLVA5.js} +3 -3
- package/dist/chunks/{pluginValidation-NZ4LOT3Q.js → pluginValidation-X5NZZCFA.js} +7 -7
- package/dist/chunks/registry-3UVW32YF.js +68 -0
- package/dist/chunks/{responsesStreaming-JNGE2P3D.js → responsesStreaming-LB4THIUM.js} +2 -2
- package/dist/chunks/{ripgrep-KGHLK4RO.js → ripgrep-N7O6M4IE.js} +4 -4
- package/dist/chunks/{runNonTextPrintMode-U3TKEYYN.js → runNonTextPrintMode-YFWCUTWZ.js} +12 -12
- package/dist/chunks/server-3CICV7EL.js +59 -0
- package/dist/chunks/server-FRP7OT4H.js +61 -0
- package/dist/chunks/{skillMarketplace-PPPUBC4N.js → skillMarketplace-4Y2H4JFK.js} +4 -4
- package/dist/chunks/{src-TVS6YABL.js → src-IETAWKYR.js} +30 -30
- package/dist/chunks/{src-QST7UD2A.js → src-OB2HE3RX.js} +27 -27
- package/dist/chunks/{src-DB7GKD4L.js → src-Y2IM2VKU.js} +78 -78
- package/dist/chunks/{thinking-O7LIIMFW.js → thinking-XG3FB4HO.js} +6 -6
- package/dist/chunks/{toolPermissionContext-UWGATCUZ.js → toolPermissionContext-RFYFDINH.js} +1 -1
- package/dist/chunks/{toolPermissionSettings-WD7CB37T.js → toolPermissionSettings-EEFURGBO.js} +5 -5
- package/dist/chunks/{useScreenLayout-PKLCMNZD.js → useScreenLayout-OUGQRR4I.js} +2 -2
- package/dist/chunks/{webOnlyMode-GJ6PQCPU.js → webOnlyMode-FRQBIAXG.js} +1 -1
- package/dist/entrypoints/cli.js +1 -1
- package/dist/entrypoints/daemon.js +1 -1
- package/dist/entrypoints/mcp.js +28 -28
- package/dist/index.js +5 -5
- package/dist/sdk/core.cjs +93 -34
- package/dist/sdk/core.cjs.map +3 -3
- package/dist/sdk/core.js +96 -37
- package/dist/sdk/core.js.map +4 -4
- package/dist/sdk/tools.cjs +1787 -1748
- package/dist/sdk/tools.cjs.map +4 -4
- package/dist/sdk/tools.js +1611 -1572
- package/dist/sdk/tools.js.map +4 -4
- package/package.json +1 -1
- package/dist/chunks/REPL-KD7YOSI5.js +0 -78
- package/dist/chunks/chunk-AKC4BUW5.js.map +0 -7
- package/dist/chunks/chunk-KKOES3YK.js.map +0 -7
- package/dist/chunks/chunk-LIBZWJEW.js.map +0 -7
- package/dist/chunks/chunk-LOCXPQNJ.js +0 -20
- package/dist/chunks/chunk-LOCXPQNJ.js.map +0 -7
- package/dist/chunks/chunk-TJMA65RL.js.map +0 -7
- package/dist/chunks/chunk-V3IXG64X.js.map +0 -7
- package/dist/chunks/chunk-VBGSHKHX.js.map +0 -7
- package/dist/chunks/chunk-Y33AS3MY.js.map +0 -7
- package/dist/chunks/chunk-YUXYJB45.js.map +0 -7
- package/dist/chunks/chunk-Z3J3WJ2K.js.map +0 -7
- package/dist/chunks/llm-C4F2Q7I2.js.map +0 -7
- package/dist/chunks/registry-FHPZ36EO.js +0 -68
- package/dist/chunks/server-Y42VR6YJ.js +0 -59
- package/dist/chunks/server-ZSC5G3TU.js +0 -61
- /package/dist/chunks/{Doctor-AES5ON33.js.map → Doctor-TWRIVOVW.js.map} +0 -0
- /package/dist/chunks/{LogList-PQJEJHHE.js.map → LogList-PUTPM24L.js.map} +0 -0
- /package/dist/chunks/{REPL-KD7YOSI5.js.map → REPL-YGIR5VXC.js.map} +0 -0
- /package/dist/chunks/{ResumeConversation-OWQ3DB4M.js.map → ResumeConversation-IJMKQXBU.js.map} +0 -0
- /package/dist/chunks/{ScreenFrame-AGLR6B4D.js.map → ScreenFrame-PQJRZ5DQ.js.map} +0 -0
- /package/dist/chunks/{agentLoader-BMWB4UKI.js.map → agentLoader-GOYNJTAO.js.map} +0 -0
- /package/dist/chunks/{agentsValidate-LSMJSFYW.js.map → agentsValidate-R26AKPAA.js.map} +0 -0
- /package/dist/chunks/{ask-3TSZR6AJ.js.map → ask-6SYVJONJ.js.map} +0 -0
- /package/dist/chunks/{autoUpdater-MEPC7LJF.js.map → autoUpdater-SDLJ5QSH.js.map} +0 -0
- /package/dist/chunks/{chunk-NC3RX5AB.js.map → chunk-2B2TR2S3.js.map} +0 -0
- /package/dist/chunks/{chunk-HDEYMVIJ.js.map → chunk-437YGKVA.js.map} +0 -0
- /package/dist/chunks/{chunk-WGMKKKS2.js.map → chunk-4BBWDSDC.js.map} +0 -0
- /package/dist/chunks/{chunk-PMC3BZ3M.js.map → chunk-5HZWM4JB.js.map} +0 -0
- /package/dist/chunks/{chunk-REQTXUXO.js.map → chunk-5LBRVQT5.js.map} +0 -0
- /package/dist/chunks/{chunk-BEDQTC44.js.map → chunk-5LL33G6X.js.map} +0 -0
- /package/dist/chunks/{chunk-MDCOIZVX.js.map → chunk-6C6VNA2D.js.map} +0 -0
- /package/dist/chunks/{chunk-P77NF36M.js.map → chunk-6CAQXUDY.js.map} +0 -0
- /package/dist/chunks/{chunk-DPQE5NA4.js.map → chunk-7SRIFZDJ.js.map} +0 -0
- /package/dist/chunks/{chunk-TI2CTTMA.js.map → chunk-7ZC22R33.js.map} +0 -0
- /package/dist/chunks/{chunk-EV56PDOI.js.map → chunk-AX3VXMUS.js.map} +0 -0
- /package/dist/chunks/{chunk-5MVUCX6O.js.map → chunk-AZHJLRRP.js.map} +0 -0
- /package/dist/chunks/{chunk-QBW7VU7C.js.map → chunk-DWKF6SQH.js.map} +0 -0
- /package/dist/chunks/{chunk-VSKGDU73.js.map → chunk-FKWFR23G.js.map} +0 -0
- /package/dist/chunks/{chunk-E6BU32L2.js.map → chunk-H5F7M5D3.js.map} +0 -0
- /package/dist/chunks/{chunk-DZPD6H7A.js.map → chunk-JXYXMP2Q.js.map} +0 -0
- /package/dist/chunks/{chunk-65FLXXMH.js.map → chunk-KA543BHH.js.map} +0 -0
- /package/dist/chunks/{chunk-MEQ7TAT7.js.map → chunk-KHMXPPO7.js.map} +0 -0
- /package/dist/chunks/{chunk-G5ET7GFB.js.map → chunk-KQV5FGSS.js.map} +0 -0
- /package/dist/chunks/{chunk-DPVCHIF7.js.map → chunk-KRBZO255.js.map} +0 -0
- /package/dist/chunks/{chunk-EKXQ7ZWV.js.map → chunk-L5ZJIOEF.js.map} +0 -0
- /package/dist/chunks/{chunk-UUJN5ZCN.js.map → chunk-LBHVWSUP.js.map} +0 -0
- /package/dist/chunks/{chunk-GL6HUBBX.js.map → chunk-LKDMUCWA.js.map} +0 -0
- /package/dist/chunks/{chunk-HJCYE2AS.js.map → chunk-LUZMHHQF.js.map} +0 -0
- /package/dist/chunks/{chunk-MXFN7OSL.js.map → chunk-MOGUUWKG.js.map} +0 -0
- /package/dist/chunks/{chunk-4UDKRYWZ.js.map → chunk-N4772IDQ.js.map} +0 -0
- /package/dist/chunks/{chunk-JJ67KF6A.js.map → chunk-PTIAF6KF.js.map} +0 -0
- /package/dist/chunks/{chunk-YUJB4WDK.js.map → chunk-PVMCLI36.js.map} +0 -0
- /package/dist/chunks/{chunk-3TLVYEGW.js.map → chunk-RTGKCKD3.js.map} +0 -0
- /package/dist/chunks/{chunk-3DBNJOZI.js.map → chunk-SUNG5KP5.js.map} +0 -0
- /package/dist/chunks/{chunk-Q55CB4Y4.js.map → chunk-WE7CQGRG.js.map} +0 -0
- /package/dist/chunks/{chunk-DELUVYKS.js.map → chunk-XVNEJVZC.js.map} +0 -0
- /package/dist/chunks/{chunk-KDY7XYYS.js.map → chunk-YQ3YJSMI.js.map} +0 -0
- /package/dist/chunks/{chunk-6CNJ3CYQ.js.map → chunk-YUZBVKVH.js.map} +0 -0
- /package/dist/chunks/{chunk-VJ2QSQ3E.js.map → chunk-ZXOTOID7.js.map} +0 -0
- /package/dist/chunks/{client-OWTJ7TPE.js.map → client-QUCHWMEW.js.map} +0 -0
- /package/dist/chunks/{customCommands-FA6HRXXV.js.map → customCommands-S6YGRUED.js.map} +0 -0
- /package/dist/chunks/{engine-UBCAVO7E.js.map → engine-FRDEQVDF.js.map} +0 -0
- /package/dist/chunks/{env-JIMGBRE2.js.map → env-YH77MILU.js.map} +0 -0
- /package/dist/chunks/{kodeAgentSessionLoad-BZRTCPMB.js.map → kodeAgentSessionLoad-TBPU4TWU.js.map} +0 -0
- /package/dist/chunks/{kodeAgentSessionResume-V3WB3OWQ.js.map → kodeAgentSessionResume-3CNE5T6N.js.map} +0 -0
- /package/dist/chunks/{kodeHooks-R3YHG4ZI.js.map → kodeHooks-6SWQE5W7.js.map} +0 -0
- /package/dist/chunks/{llmLazy-IBED5LIH.js.map → llmLazy-O4T62IIT.js.map} +0 -0
- /package/dist/chunks/{mcpCli-A744Z3FL.js.map → mcpCli-HIA4I4GG.js.map} +0 -0
- /package/dist/chunks/{mentionProcessor-VV6DN2LJ.js.map → mentionProcessor-HH4EF7BE.js.map} +0 -0
- /package/dist/chunks/{messages-ZR64JVON.js.map → messages-WKWCZBGM.js.map} +0 -0
- /package/dist/chunks/{model-NPMMYL2U.js.map → model-4EIFU5QN.js.map} +0 -0
- /package/dist/chunks/{openai-FEBNBOGM.js.map → openai-KTBJ2KNZ.js.map} +0 -0
- /package/dist/chunks/{permissions-34CRWMCH.js.map → permissions-C3N4DKS2.js.map} +0 -0
- /package/dist/chunks/{pluginRuntime-7YBUMVFI.js.map → pluginRuntime-2FKZLVA5.js.map} +0 -0
- /package/dist/chunks/{pluginValidation-NZ4LOT3Q.js.map → pluginValidation-X5NZZCFA.js.map} +0 -0
- /package/dist/chunks/{registry-FHPZ36EO.js.map → registry-3UVW32YF.js.map} +0 -0
- /package/dist/chunks/{responsesStreaming-JNGE2P3D.js.map → responsesStreaming-LB4THIUM.js.map} +0 -0
- /package/dist/chunks/{ripgrep-KGHLK4RO.js.map → ripgrep-N7O6M4IE.js.map} +0 -0
- /package/dist/chunks/{runNonTextPrintMode-U3TKEYYN.js.map → runNonTextPrintMode-YFWCUTWZ.js.map} +0 -0
- /package/dist/chunks/{server-Y42VR6YJ.js.map → server-3CICV7EL.js.map} +0 -0
- /package/dist/chunks/{server-ZSC5G3TU.js.map → server-FRP7OT4H.js.map} +0 -0
- /package/dist/chunks/{skillMarketplace-PPPUBC4N.js.map → skillMarketplace-4Y2H4JFK.js.map} +0 -0
- /package/dist/chunks/{src-TVS6YABL.js.map → src-IETAWKYR.js.map} +0 -0
- /package/dist/chunks/{src-QST7UD2A.js.map → src-OB2HE3RX.js.map} +0 -0
- /package/dist/chunks/{src-DB7GKD4L.js.map → src-Y2IM2VKU.js.map} +0 -0
- /package/dist/chunks/{thinking-O7LIIMFW.js.map → thinking-XG3FB4HO.js.map} +0 -0
- /package/dist/chunks/{toolPermissionContext-UWGATCUZ.js.map → toolPermissionContext-RFYFDINH.js.map} +0 -0
- /package/dist/chunks/{toolPermissionSettings-WD7CB37T.js.map → toolPermissionSettings-EEFURGBO.js.map} +0 -0
- /package/dist/chunks/{useScreenLayout-PKLCMNZD.js.map → useScreenLayout-OUGQRR4I.js.map} +0 -0
- /package/dist/chunks/{webOnlyMode-GJ6PQCPU.js.map → webOnlyMode-FRQBIAXG.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
countTokens,
|
|
3
3
|
query
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SVRXO73D.js";
|
|
5
5
|
import {
|
|
6
6
|
FileReadTool,
|
|
7
7
|
FileWriteTool,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
toProjectRelativeIfPossible,
|
|
19
19
|
upsertBackgroundAgentTask,
|
|
20
20
|
waitForBackgroundAgentTask
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BNSPVA24.js";
|
|
22
22
|
import {
|
|
23
23
|
addLineNumbers,
|
|
24
24
|
detectFileEncoding,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
recordFileEdit,
|
|
31
31
|
startWatchingTodoFile,
|
|
32
32
|
writeTextContent
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-L5ZJIOEF.js";
|
|
34
34
|
import {
|
|
35
35
|
getCachedStringWidth
|
|
36
36
|
} from "./chunk-UKNILZCN.js";
|
|
@@ -38,10 +38,10 @@ import {
|
|
|
38
38
|
getActiveAgents,
|
|
39
39
|
getAgentByType,
|
|
40
40
|
getAvailableAgentTypes
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-437YGKVA.js";
|
|
42
42
|
import {
|
|
43
43
|
loadKodeAgentSidechainMessagesForResume
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-PVMCLI36.js";
|
|
45
45
|
import {
|
|
46
46
|
applyToolPermissionContextUpdateForConversationKey,
|
|
47
47
|
getBunShellSandboxPlan,
|
|
@@ -55,25 +55,25 @@ import {
|
|
|
55
55
|
splitBashCommandIntoSubcommands,
|
|
56
56
|
splitCommand,
|
|
57
57
|
xi
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-N5AH66UG.js";
|
|
59
59
|
import {
|
|
60
60
|
getAnthropicClient,
|
|
61
61
|
resolveToolDescription
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-DWKF6SQH.js";
|
|
63
63
|
import {
|
|
64
64
|
getAgentPrompt,
|
|
65
65
|
getContext
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-KHMXPPO7.js";
|
|
67
67
|
import {
|
|
68
68
|
emitReminderEvent,
|
|
69
69
|
generateAgentId,
|
|
70
70
|
getTodos,
|
|
71
71
|
setTodos
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-JXYXMP2Q.js";
|
|
73
73
|
import {
|
|
74
74
|
getRequestStatus,
|
|
75
75
|
subscribeRequestStatus
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-ESRGV7DC.js";
|
|
77
77
|
import {
|
|
78
78
|
buildRequestStrategyFallbackPlan,
|
|
79
79
|
classifyRequestFailure
|
|
@@ -81,18 +81,18 @@ import {
|
|
|
81
81
|
import {
|
|
82
82
|
queryLLM,
|
|
83
83
|
queryQuick
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-2B2TR2S3.js";
|
|
85
85
|
import {
|
|
86
86
|
createDefaultToolPermissionContext
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-E4C4N7OV.js";
|
|
88
88
|
import {
|
|
89
89
|
getClients,
|
|
90
90
|
getMCPTools,
|
|
91
91
|
getMcpListChangedVersion
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-6C6VNA2D.js";
|
|
93
93
|
import {
|
|
94
94
|
safeParseJSON
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-RTGKCKD3.js";
|
|
96
96
|
import {
|
|
97
97
|
INTERRUPT_MESSAGE,
|
|
98
98
|
createAssistantMessage,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
extractTag,
|
|
101
101
|
getLastAssistantMessageId,
|
|
102
102
|
stripSystemMessages
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-L2LWCVUF.js";
|
|
104
104
|
import {
|
|
105
105
|
getTheme
|
|
106
106
|
} from "./chunk-HDVL5VTM.js";
|
|
@@ -110,16 +110,16 @@ import {
|
|
|
110
110
|
} from "./chunk-GJYXZ5IL.js";
|
|
111
111
|
import {
|
|
112
112
|
getMaxThinkingTokens
|
|
113
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-SUNG5KP5.js";
|
|
114
114
|
import {
|
|
115
115
|
getModelManager
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-FKWFR23G.js";
|
|
117
117
|
import {
|
|
118
118
|
debug
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-YQ3YJSMI.js";
|
|
120
120
|
import {
|
|
121
121
|
ripGrep
|
|
122
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-4BBWDSDC.js";
|
|
123
123
|
import {
|
|
124
124
|
CACHE_PATHS,
|
|
125
125
|
PRODUCT_NAME,
|
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
logError,
|
|
137
137
|
overwriteLog,
|
|
138
138
|
readPlanFile
|
|
139
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-SOBWNYOW.js";
|
|
140
140
|
import {
|
|
141
141
|
getCwd,
|
|
142
142
|
getOriginalCwd
|
|
@@ -717,7 +717,11 @@ import React2 from "react";
|
|
|
717
717
|
import { z as z2 } from "zod";
|
|
718
718
|
|
|
719
719
|
// packages/core/src/constants/figures.ts
|
|
720
|
-
var BLACK_CIRCLE = env.platform === "macos" ? "\
|
|
720
|
+
var BLACK_CIRCLE = env.platform === "macos" ? "\u25C6" : "\u25C6";
|
|
721
|
+
var RECORD_CIRCLE = "\u23FA";
|
|
722
|
+
var CHECKMARK = "\u2713";
|
|
723
|
+
var CROSS = "\u2717";
|
|
724
|
+
var DIAMOND_HOLLOW = "\u25C7";
|
|
721
725
|
|
|
722
726
|
// packages/tools/src/tools/interaction/AskUserQuestionTool/prompt.ts
|
|
723
727
|
var TOOL_NAME_FOR_PROMPT = "AskUserQuestion";
|
|
@@ -827,7 +831,7 @@ var AskUserQuestionTool = {
|
|
|
827
831
|
// packages/tools/src/tools/system/BashTool/BashTool.tsx
|
|
828
832
|
import { EOL as EOL3 } from "os";
|
|
829
833
|
import { isAbsolute as isAbsolute2, relative, resolve as resolve2 } from "path";
|
|
830
|
-
import * as
|
|
834
|
+
import * as React11 from "react";
|
|
831
835
|
import { z as z4 } from "zod";
|
|
832
836
|
|
|
833
837
|
// packages/core/src/permissions/bashReadOnly.ts
|
|
@@ -1160,7 +1164,7 @@ function renderTruncatedContent(content, totalLines, maxLines = MAX_RENDERED_LIN
|
|
|
1160
1164
|
}
|
|
1161
1165
|
const lastLines = allLines.slice(-maxLines);
|
|
1162
1166
|
return [
|
|
1163
|
-
chalk3.grey(
|
|
1167
|
+
chalk3.grey(`... ${totalLines - maxLines} lines hidden, showing last ${maxLines} lines`),
|
|
1164
1168
|
...lastLines
|
|
1165
1169
|
].join("\n");
|
|
1166
1170
|
}
|
|
@@ -1173,9 +1177,10 @@ function OutputLine({
|
|
|
1173
1177
|
maxWidth
|
|
1174
1178
|
}) {
|
|
1175
1179
|
const trimmed = content.trim();
|
|
1180
|
+
const theme = getTheme();
|
|
1176
1181
|
if (maxHeight && maxWidth) {
|
|
1177
|
-
const coloredText = isError ? chalk3.hex(
|
|
1178
|
-
return /* @__PURE__ */ React4.createElement(Box3, {
|
|
1182
|
+
const coloredText = isError ? chalk3.hex(theme.error)(trimmed) : chalk3.dim(trimmed);
|
|
1183
|
+
return /* @__PURE__ */ React4.createElement(Box3, { width: "100%", paddingLeft: 2 }, /* @__PURE__ */ React4.createElement(
|
|
1179
1184
|
MaxSizedText,
|
|
1180
1185
|
{
|
|
1181
1186
|
text: coloredText,
|
|
@@ -1183,10 +1188,10 @@ function OutputLine({
|
|
|
1183
1188
|
maxWidth,
|
|
1184
1189
|
overflowDirection: "bottom"
|
|
1185
1190
|
}
|
|
1186
|
-
))
|
|
1191
|
+
));
|
|
1187
1192
|
}
|
|
1188
1193
|
const displayText = verbose ? trimmed : renderTruncatedContent(trimmed, lines);
|
|
1189
|
-
return /* @__PURE__ */ React4.createElement(Box3, {
|
|
1194
|
+
return /* @__PURE__ */ React4.createElement(Box3, { width: "100%", paddingLeft: 2 }, /* @__PURE__ */ React4.createElement(Text4, { color: isError ? theme.error : theme.secondaryText }, displayText));
|
|
1190
1195
|
}
|
|
1191
1196
|
|
|
1192
1197
|
// packages/tools/src/tools/system/BashTool/BashToolResultMessage.tsx
|
|
@@ -1206,7 +1211,8 @@ function BashToolResultMessage({
|
|
|
1206
1211
|
const reservedLines = bashId ? 1 : 0;
|
|
1207
1212
|
const availableHeight = maxHeight && maxHeight > 0 ? Math.max(1, maxHeight - reservedLines) : void 0;
|
|
1208
1213
|
const perSectionHeight = availableHeight && outputSections > 0 ? Math.max(1, Math.floor(availableHeight / outputSections)) : void 0;
|
|
1209
|
-
|
|
1214
|
+
const theme = getTheme();
|
|
1215
|
+
return /* @__PURE__ */ React5.createElement(Box4, { flexDirection: "column" }, bashId ? /* @__PURE__ */ React5.createElement(Box4, { paddingLeft: 2 }, /* @__PURE__ */ React5.createElement(Text5, { color: theme.secondaryText }, "(background task: ", bashId, ")")) : null, stdout !== "" ? /* @__PURE__ */ React5.createElement(
|
|
1210
1216
|
OutputLine,
|
|
1211
1217
|
{
|
|
1212
1218
|
content: stdout,
|
|
@@ -1225,7 +1231,7 @@ function BashToolResultMessage({
|
|
|
1225
1231
|
maxHeight: perSectionHeight,
|
|
1226
1232
|
maxWidth
|
|
1227
1233
|
}
|
|
1228
|
-
) : null, stdout === "" && stderr === "" ? /* @__PURE__ */ React5.createElement(Box4, {
|
|
1234
|
+
) : null, stdout === "" && stderr === "" ? /* @__PURE__ */ React5.createElement(Box4, { paddingLeft: 2 }, /* @__PURE__ */ React5.createElement(Text5, { color: theme.secondaryText }, "[no output /]")) : null);
|
|
1229
1235
|
}
|
|
1230
1236
|
var BashToolResultMessage_default = BashToolResultMessage;
|
|
1231
1237
|
|
|
@@ -1262,6 +1268,9 @@ function countNewlines(text) {
|
|
|
1262
1268
|
return count;
|
|
1263
1269
|
}
|
|
1264
1270
|
|
|
1271
|
+
// packages/tools/src/tools/system/BashTool/call.tsx
|
|
1272
|
+
import * as React10 from "react";
|
|
1273
|
+
|
|
1265
1274
|
// packages/core/src/sandbox/systemSandbox.ts
|
|
1266
1275
|
function parseBoolLike(value) {
|
|
1267
1276
|
const v = value.trim().toLowerCase();
|
|
@@ -1478,381 +1487,268 @@ To override (not recommended), set ${ENV_ALLOW}=1 in the ${args.platform ?? proc
|
|
|
1478
1487
|
return null;
|
|
1479
1488
|
}
|
|
1480
1489
|
|
|
1481
|
-
// packages/tools/src/tools/system/BashTool/
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
code: "PRIV_SUDO",
|
|
1486
|
-
severity: "high",
|
|
1487
|
-
category: "privilege",
|
|
1488
|
-
title: "sudo escalates privileges",
|
|
1489
|
-
patterns: [/\bsudo\b/i]
|
|
1490
|
-
},
|
|
1491
|
-
{
|
|
1492
|
-
code: "PRIV_SU",
|
|
1493
|
-
severity: "high",
|
|
1494
|
-
category: "privilege",
|
|
1495
|
-
title: "su changes user identity",
|
|
1496
|
-
patterns: [/\bsu\b(\s|$)/i]
|
|
1497
|
-
},
|
|
1498
|
-
{
|
|
1499
|
-
code: "PRIV_SUDOERS",
|
|
1500
|
-
severity: "high",
|
|
1501
|
-
category: "privilege",
|
|
1502
|
-
title: "modifies sudoers policy",
|
|
1503
|
-
patterns: [/\/etc\/sudoers(\.d\/[^\s]+)?/i]
|
|
1504
|
-
},
|
|
1505
|
-
// System power / service management
|
|
1506
|
-
{
|
|
1507
|
-
code: "SYS_SHUTDOWN",
|
|
1508
|
-
severity: "high",
|
|
1509
|
-
category: "system",
|
|
1510
|
-
title: "shutdown/reboot/poweroff",
|
|
1511
|
-
patterns: [/\b(shutdown|reboot|poweroff|halt|init\s+0)\b/i]
|
|
1512
|
-
},
|
|
1490
|
+
// packages/tools/src/tools/system/BashTool/dataLossRules.ts
|
|
1491
|
+
import { parse as parse2 } from "shell-quote";
|
|
1492
|
+
var BASH_GATE_RULES = [
|
|
1493
|
+
// Git permanent data loss
|
|
1513
1494
|
{
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1495
|
+
id: "GIT_RESET_HARD",
|
|
1496
|
+
category: "git",
|
|
1497
|
+
title: "git reset --hard discards uncommitted changes permanently",
|
|
1498
|
+
tokens: ["git", "reset"],
|
|
1499
|
+
validate: (ctx) => ctx.flags.has("--hard")
|
|
1519
1500
|
},
|
|
1520
|
-
// Filesystem / disk destructive operations
|
|
1521
1501
|
{
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1502
|
+
id: "GIT_CLEAN_FD",
|
|
1503
|
+
category: "git",
|
|
1504
|
+
title: "git clean -fd deletes untracked files permanently",
|
|
1505
|
+
tokens: ["git", "clean"],
|
|
1506
|
+
validate: (ctx) => ctx.flags.has("-f") || ctx.args.some((a) => /^-[a-z]*f/i.test(a))
|
|
1527
1507
|
},
|
|
1528
1508
|
{
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1509
|
+
id: "GIT_PUSH_FORCE",
|
|
1510
|
+
category: "git",
|
|
1511
|
+
title: "git push --force rewrites remote history permanently",
|
|
1512
|
+
tokens: ["git", "push"],
|
|
1513
|
+
validate: (ctx) => ctx.flags.has("--force") || ctx.flags.has("--force-with-lease") || ctx.args.some((a) => /^-[a-z]*f$/i.test(a))
|
|
1534
1514
|
},
|
|
1535
1515
|
{
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1516
|
+
id: "GIT_STASH_DROP",
|
|
1517
|
+
category: "git",
|
|
1518
|
+
title: "git stash drop/clear removes saved work permanently",
|
|
1519
|
+
tokens: ["git", "stash"],
|
|
1520
|
+
validate: (ctx) => ctx.args.some((a) => /^(drop|clear)$/i.test(a))
|
|
1541
1521
|
},
|
|
1542
1522
|
{
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
patterns: [/\bdd\b[^\n]*\bof=\S+/i]
|
|
1523
|
+
id: "GIT_REFLOG_EXPIRE",
|
|
1524
|
+
category: "git",
|
|
1525
|
+
title: "git reflog expire reduces recoverability permanently",
|
|
1526
|
+
tokens: ["git", "reflog", "expire"]
|
|
1548
1527
|
},
|
|
1549
|
-
// Remote fetch + exec / code execution
|
|
1550
1528
|
{
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1529
|
+
id: "GIT_GC_PRUNE",
|
|
1530
|
+
category: "git",
|
|
1531
|
+
title: "git gc --prune=now reduces recoverability permanently",
|
|
1532
|
+
tokens: ["git", "gc"],
|
|
1533
|
+
validate: (ctx) => ctx.args.some((a) => /^--prune=now$/i.test(a))
|
|
1556
1534
|
},
|
|
1535
|
+
// Filesystem destruction
|
|
1557
1536
|
{
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
patterns: [/\beval\b/i]
|
|
1537
|
+
id: "FS_MKFS",
|
|
1538
|
+
category: "filesystem",
|
|
1539
|
+
title: "mkfs formats filesystem (irreversible data loss)",
|
|
1540
|
+
tokens: ["mkfs"]
|
|
1563
1541
|
},
|
|
1564
1542
|
{
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
patterns: [/\b(source|\.)\b[^\n]*<\(/i]
|
|
1543
|
+
id: "FS_WIPE",
|
|
1544
|
+
category: "filesystem",
|
|
1545
|
+
title: "secure wipe destroys data permanently",
|
|
1546
|
+
tokens: ["shred"]
|
|
1570
1547
|
},
|
|
1571
1548
|
{
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
patterns: [/\bsource\b\s+(?!<\()\S+/i, /(^|[;&|()\s])\.\s+(?!<\()\S+/i]
|
|
1549
|
+
id: "FS_WIPEFS",
|
|
1550
|
+
category: "filesystem",
|
|
1551
|
+
title: "wipefs removes filesystem signatures",
|
|
1552
|
+
tokens: ["wipefs"]
|
|
1577
1553
|
},
|
|
1578
1554
|
{
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
patterns: [/\bbase64\b[^\n]*\s+-d\b[^\n]*\|\s*(bash|sh)\b/i]
|
|
1584
|
-
},
|
|
1585
|
-
{
|
|
1586
|
-
code: "RCE_ONE_LINER",
|
|
1587
|
-
severity: "medium",
|
|
1588
|
-
category: "remote_exec",
|
|
1589
|
-
title: "interpreter one-liner execution",
|
|
1590
|
-
patterns: [
|
|
1591
|
-
/\bpython3?\b\s+-c\b/i,
|
|
1592
|
-
/\bperl\b\s+-e\b/i,
|
|
1593
|
-
/\bruby\b\s+-e\b/i,
|
|
1594
|
-
/\bnode\b\s+-e\b/i
|
|
1595
|
-
]
|
|
1555
|
+
id: "FS_BLKDISCARD",
|
|
1556
|
+
category: "filesystem",
|
|
1557
|
+
title: "blkdiscard discards device data",
|
|
1558
|
+
tokens: ["blkdiscard"]
|
|
1596
1559
|
},
|
|
1597
|
-
// Persistence / startup modification
|
|
1598
1560
|
{
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1561
|
+
id: "FS_DD_DEV",
|
|
1562
|
+
category: "filesystem",
|
|
1563
|
+
title: "dd overwrites device (potential data destruction)",
|
|
1564
|
+
tokens: ["dd"],
|
|
1565
|
+
validate: (ctx) => ctx.args.some((a) => /^of=\/dev\//i.test(a))
|
|
1604
1566
|
},
|
|
1567
|
+
// Infrastructure destruction
|
|
1605
1568
|
{
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
patterns: [/\bcrontab\b/i, /\/etc\/cron\./i, /cron\.d/i]
|
|
1569
|
+
id: "INFRA_TERRAFORM_DESTROY",
|
|
1570
|
+
category: "infrastructure",
|
|
1571
|
+
title: "terraform destroy destroys infrastructure permanently",
|
|
1572
|
+
tokens: ["terraform", "destroy"]
|
|
1611
1573
|
},
|
|
1612
1574
|
{
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
patterns: [/\/etc\/systemd\/system\//i, /\bsystemctl\b[^\n]*\benable\b/i]
|
|
1575
|
+
id: "INFRA_KUBECTL_DELETE",
|
|
1576
|
+
category: "infrastructure",
|
|
1577
|
+
title: "kubectl delete removes cluster resources",
|
|
1578
|
+
tokens: ["kubectl", "delete"]
|
|
1618
1579
|
},
|
|
1619
|
-
// Credentials / secrets access
|
|
1620
1580
|
{
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
patterns: [/~\/\.ssh\//i, /\/etc\/ssh\//i]
|
|
1626
|
-
},
|
|
1627
|
-
{
|
|
1628
|
-
code: "CRED_SHADOW",
|
|
1629
|
-
severity: "high",
|
|
1630
|
-
category: "credentials",
|
|
1631
|
-
title: "reads /etc/shadow",
|
|
1632
|
-
patterns: [/\/etc\/shadow\b/i]
|
|
1633
|
-
},
|
|
1634
|
-
{
|
|
1635
|
-
code: "CRED_ENV_FILE",
|
|
1636
|
-
severity: "high",
|
|
1637
|
-
category: "credentials",
|
|
1638
|
-
title: "reads .env secrets file",
|
|
1639
|
-
patterns: [
|
|
1640
|
-
/(\s|^)(cat|sed|awk|perl|python3?)\b[^\n]*\s+(\.\/)?\.env(\s|$)/i,
|
|
1641
|
-
/(^|\/)\.env(\.|$)/i
|
|
1642
|
-
]
|
|
1643
|
-
},
|
|
1644
|
-
// Infra destroy
|
|
1645
|
-
{
|
|
1646
|
-
code: "INFRA_KUBECTL_DELETE",
|
|
1647
|
-
severity: "high",
|
|
1648
|
-
category: "infra_destroy",
|
|
1649
|
-
title: "kubectl delete can destroy cluster resources",
|
|
1650
|
-
patterns: [/\bkubectl\b[^\n]*\bdelete\b/i]
|
|
1651
|
-
},
|
|
1652
|
-
{
|
|
1653
|
-
code: "INFRA_TERRAFORM_DESTROY",
|
|
1654
|
-
severity: "high",
|
|
1655
|
-
category: "infra_destroy",
|
|
1656
|
-
title: "terraform destroy destroys infrastructure",
|
|
1657
|
-
patterns: [/\bterraform\b[^\n]*\bdestroy\b/i]
|
|
1658
|
-
},
|
|
1659
|
-
{
|
|
1660
|
-
code: "INFRA_PULUMI_DESTROY",
|
|
1661
|
-
severity: "high",
|
|
1662
|
-
category: "infra_destroy",
|
|
1663
|
-
title: "pulumi destroy destroys infrastructure",
|
|
1664
|
-
patterns: [/\bpulumi\b[^\n]*\bdestroy\b/i]
|
|
1665
|
-
},
|
|
1666
|
-
// Containers / data loss
|
|
1667
|
-
{
|
|
1668
|
-
code: "DOCKER_PRUNE",
|
|
1669
|
-
severity: "medium",
|
|
1670
|
-
category: "container",
|
|
1671
|
-
title: "docker prune can delete data",
|
|
1672
|
-
patterns: [/\bdocker\b[^\n]*\b(system\s+prune|volume\s+rm)\b/i]
|
|
1673
|
-
},
|
|
1674
|
-
// Package removal
|
|
1675
|
-
{
|
|
1676
|
-
code: "PKG_REMOVE",
|
|
1677
|
-
severity: "medium",
|
|
1678
|
-
category: "pkg",
|
|
1679
|
-
title: "package removal/purge can break environment",
|
|
1680
|
-
patterns: [
|
|
1681
|
-
/\bapt(-get)?\b[^\n]*\b(remove|purge)\b/i,
|
|
1682
|
-
/\byum\b[^\n]*\bremove\b/i,
|
|
1683
|
-
/\bdnf\b[^\n]*\bremove\b/i,
|
|
1684
|
-
/\bpacman\b[^\n]*\b-R(ns)?\b/i,
|
|
1685
|
-
/\bnpm\b[^\n]*\buninstall\b/i,
|
|
1686
|
-
/\bpnpm\b[^\n]*\bremove\b/i,
|
|
1687
|
-
/\byarn\b[^\n]*\bremove\b/i
|
|
1688
|
-
]
|
|
1689
|
-
},
|
|
1690
|
-
// Obfuscation / shell bomb
|
|
1691
|
-
{
|
|
1692
|
-
code: "OBF_FORK_BOMB",
|
|
1693
|
-
severity: "high",
|
|
1694
|
-
category: "obfuscation",
|
|
1695
|
-
title: "fork bomb pattern",
|
|
1696
|
-
patterns: [/:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;:/]
|
|
1581
|
+
id: "INFRA_PULUMI_DESTROY",
|
|
1582
|
+
category: "infrastructure",
|
|
1583
|
+
title: "pulumi destroy destroys stack permanently",
|
|
1584
|
+
tokens: ["pulumi", "destroy"]
|
|
1697
1585
|
}
|
|
1698
1586
|
];
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1587
|
+
function tokensToStrings(entries) {
|
|
1588
|
+
const result = [];
|
|
1589
|
+
for (const entry of entries) {
|
|
1590
|
+
if (typeof entry === "string") {
|
|
1591
|
+
result.push(entry);
|
|
1592
|
+
} else if (entry && typeof entry === "object") {
|
|
1593
|
+
const record = entry;
|
|
1594
|
+
if (record.op === "glob" && typeof record.pattern === "string") {
|
|
1595
|
+
result.push(record.pattern);
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
return result;
|
|
1704
1600
|
}
|
|
1705
|
-
function
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1601
|
+
function splitByOperators(entries) {
|
|
1602
|
+
const commands = [];
|
|
1603
|
+
let current = [];
|
|
1604
|
+
for (const entry of entries) {
|
|
1605
|
+
if (typeof entry === "object" && entry !== null) {
|
|
1606
|
+
const record = entry;
|
|
1607
|
+
const op = record.op;
|
|
1608
|
+
if (op === ";" || op === "&&" || op === "||" || op === "|") {
|
|
1609
|
+
if (current.length > 0) {
|
|
1610
|
+
commands.push(current);
|
|
1611
|
+
current = [];
|
|
1612
|
+
}
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1719
1615
|
}
|
|
1616
|
+
current.push(entry);
|
|
1720
1617
|
}
|
|
1721
|
-
|
|
1618
|
+
if (current.length > 0) {
|
|
1619
|
+
commands.push(current);
|
|
1620
|
+
}
|
|
1621
|
+
return commands;
|
|
1722
1622
|
}
|
|
1723
|
-
function
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
if (
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1623
|
+
function isNonExecutableSubcommand(tokens) {
|
|
1624
|
+
if (tokens.length === 0) return true;
|
|
1625
|
+
const first = tokens[0]?.toLowerCase();
|
|
1626
|
+
if (first === "echo" || first === "printf") return true;
|
|
1627
|
+
if (["grep", "cat", "head", "tail", "less", "more"].includes(first ?? "")) return true;
|
|
1628
|
+
return false;
|
|
1629
|
+
}
|
|
1630
|
+
function parseCommand(command) {
|
|
1631
|
+
const trimmed = command.trim();
|
|
1632
|
+
if (trimmed.startsWith("#")) return [];
|
|
1633
|
+
let parsed;
|
|
1634
|
+
try {
|
|
1635
|
+
parsed = parse2(command, (varName) => `$${varName}`);
|
|
1636
|
+
} catch {
|
|
1637
|
+
const tokens = command.split(/\s+/).filter(Boolean);
|
|
1638
|
+
if (isNonExecutableSubcommand(tokens)) return [];
|
|
1639
|
+
return [buildContext(command, tokens)];
|
|
1640
|
+
}
|
|
1641
|
+
const subcommands = splitByOperators(parsed);
|
|
1642
|
+
const contexts = [];
|
|
1643
|
+
for (const sub of subcommands) {
|
|
1644
|
+
const tokens = tokensToStrings(sub);
|
|
1645
|
+
if (isNonExecutableSubcommand(tokens)) continue;
|
|
1646
|
+
contexts.push(buildContext(command, tokens));
|
|
1647
|
+
}
|
|
1648
|
+
return contexts;
|
|
1649
|
+
}
|
|
1650
|
+
function buildContext(command, tokens) {
|
|
1651
|
+
const flags = /* @__PURE__ */ new Set();
|
|
1652
|
+
const args = [];
|
|
1653
|
+
for (const token of tokens) {
|
|
1654
|
+
if (token.startsWith("--")) {
|
|
1655
|
+
flags.add(token.split("=")[0]);
|
|
1656
|
+
} else if (token.startsWith("-") && token.length > 1) {
|
|
1657
|
+
flags.add(token);
|
|
1658
|
+
for (let i = 1; i < token.length; i++) {
|
|
1659
|
+
if (token[i] !== "=") {
|
|
1660
|
+
flags.add(`-${token[i]}`);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
args.push(token);
|
|
1739
1665
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1666
|
+
return { command, tokens, args, flags };
|
|
1667
|
+
}
|
|
1668
|
+
function matchTokenSequence(actual, required) {
|
|
1669
|
+
let ai = 0;
|
|
1670
|
+
for (const req of required) {
|
|
1671
|
+
const reqLower = req.toLowerCase();
|
|
1672
|
+
let found = false;
|
|
1673
|
+
while (ai < actual.length) {
|
|
1674
|
+
const actualLower = actual[ai].toLowerCase();
|
|
1675
|
+
if (actualLower === reqLower || actualLower.startsWith(`${reqLower}.`)) {
|
|
1676
|
+
found = true;
|
|
1677
|
+
ai++;
|
|
1678
|
+
break;
|
|
1679
|
+
}
|
|
1680
|
+
ai++;
|
|
1748
1681
|
}
|
|
1682
|
+
if (!found) return false;
|
|
1683
|
+
}
|
|
1684
|
+
return true;
|
|
1685
|
+
}
|
|
1686
|
+
function isCriticalRmTarget(args) {
|
|
1687
|
+
const criticalPatterns = [
|
|
1688
|
+
{ pattern: /^\/$/, label: "/" },
|
|
1689
|
+
{ pattern: /^~\/?$/, label: "~" },
|
|
1690
|
+
{ pattern: /^\.\/?$/, label: "." },
|
|
1691
|
+
{ pattern: /^\.\.\/?$/, label: ".." },
|
|
1692
|
+
// Only match direct system directories, not subdirectories
|
|
1693
|
+
// /etc is critical, /etc/nginx is not as critical
|
|
1694
|
+
// /var is critical, /var/folders/... (macOS tmp) is safe
|
|
1695
|
+
{ pattern: /^\/(etc|bin|sbin|usr|lib|boot|root)\/?$/, label: "system directory" }
|
|
1749
1696
|
];
|
|
1750
|
-
for (const
|
|
1751
|
-
if (
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
title: "rm targets a critical path",
|
|
1757
|
-
evidence: t.label
|
|
1758
|
-
});
|
|
1759
|
-
break;
|
|
1697
|
+
for (const arg of args) {
|
|
1698
|
+
if (arg.startsWith("-")) continue;
|
|
1699
|
+
for (const { pattern, label } of criticalPatterns) {
|
|
1700
|
+
if (pattern.test(arg)) {
|
|
1701
|
+
return { isCritical: true, target: label };
|
|
1702
|
+
}
|
|
1760
1703
|
}
|
|
1761
1704
|
}
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
title: "rm uses glob/expansion patterns (wider blast radius)"
|
|
1768
|
-
});
|
|
1705
|
+
return { isCritical: false };
|
|
1706
|
+
}
|
|
1707
|
+
function detectRmCritical(ctx) {
|
|
1708
|
+
if (!ctx.tokens.some((t) => t === "rm" || t === "rmdir")) {
|
|
1709
|
+
return null;
|
|
1769
1710
|
}
|
|
1770
|
-
|
|
1711
|
+
const { isCritical, target } = isCriticalRmTarget(ctx.args);
|
|
1712
|
+
if (isCritical) {
|
|
1713
|
+
return {
|
|
1714
|
+
code: "FS_RM_CRITICAL",
|
|
1715
|
+
severity: "high",
|
|
1716
|
+
category: "filesystem",
|
|
1717
|
+
title: `rm targets critical path (${target})`,
|
|
1718
|
+
evidence: target
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
return null;
|
|
1771
1722
|
}
|
|
1772
|
-
function
|
|
1723
|
+
function getBashGateFindings(command) {
|
|
1724
|
+
const contexts = parseCommand(command);
|
|
1773
1725
|
const findings = [];
|
|
1774
|
-
|
|
1775
|
-
const
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
}
|
|
1781
|
-
{
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
re: /\bgit\b[^\n]*\breset\b[^\n]*--hard\b/i
|
|
1795
|
-
},
|
|
1796
|
-
{
|
|
1797
|
-
code: "GIT_CLEAN",
|
|
1798
|
-
title: "git clean deletes untracked files",
|
|
1799
|
-
re: /\bgit\b[^\n]*\bclean\b/i
|
|
1800
|
-
},
|
|
1801
|
-
{
|
|
1802
|
-
code: "GIT_CLEAN_FDX",
|
|
1803
|
-
title: "git clean -fdx deletes untracked + ignored files",
|
|
1804
|
-
re: /\bgit\b[^\n]*\bclean\b[^\n]*-(?:[^\n]*f[^\n]*d|[^\n]*d[^\n]*f)[^\n]*x/i
|
|
1805
|
-
},
|
|
1806
|
-
{
|
|
1807
|
-
code: "GIT_PUSH_FORCE",
|
|
1808
|
-
title: "git push --force rewrites remote history",
|
|
1809
|
-
re: /\bgit\b[^\n]*\bpush\b[^\n]*(--force|--force-with-lease|\s-f(\s|$))/i
|
|
1810
|
-
},
|
|
1811
|
-
{
|
|
1812
|
-
code: "GIT_PUSH_DELETE",
|
|
1813
|
-
title: "git push --delete deletes remote refs",
|
|
1814
|
-
re: /\bgit\b[^\n]*\bpush\b[^\n]*(--delete|:\S+)/i
|
|
1815
|
-
},
|
|
1816
|
-
{
|
|
1817
|
-
code: "GIT_FILTER_REWRITE",
|
|
1818
|
-
title: "history rewrite (filter-branch/filter-repo/rebase/amend)",
|
|
1819
|
-
re: /\bgit\b[^\n]*\b(filter-branch|filter-repo|rebase|commit\b[^\n]*--amend)\b/i
|
|
1820
|
-
},
|
|
1821
|
-
{
|
|
1822
|
-
code: "GIT_RECOVERY_REDUCE",
|
|
1823
|
-
title: "reduces recoverability (reflog expire / gc --prune=now)",
|
|
1824
|
-
re: /\bgit\b[^\n]*\b(reflog\b[^\n]*expire|gc\b[^\n]*--prune=now)\b/i
|
|
1825
|
-
},
|
|
1826
|
-
{
|
|
1827
|
-
code: "GIT_STASH_DROP",
|
|
1828
|
-
title: "stash drop/clear removes saved work",
|
|
1829
|
-
re: /\bgit\b[^\n]*\bstash\b[^\n]*\b(drop|clear)\b/i
|
|
1726
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
1727
|
+
for (const ctx of contexts) {
|
|
1728
|
+
const rmFinding = detectRmCritical(ctx);
|
|
1729
|
+
if (rmFinding && !seenIds.has(rmFinding.code)) {
|
|
1730
|
+
seenIds.add(rmFinding.code);
|
|
1731
|
+
findings.push(rmFinding);
|
|
1732
|
+
}
|
|
1733
|
+
for (const rule of BASH_GATE_RULES) {
|
|
1734
|
+
if (seenIds.has(rule.id)) continue;
|
|
1735
|
+
if (matchTokenSequence(ctx.tokens, rule.tokens)) {
|
|
1736
|
+
if (!rule.validate || rule.validate(ctx)) {
|
|
1737
|
+
seenIds.add(rule.id);
|
|
1738
|
+
findings.push({
|
|
1739
|
+
code: rule.id,
|
|
1740
|
+
severity: "high",
|
|
1741
|
+
category: rule.category,
|
|
1742
|
+
title: rule.title
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1830
1746
|
}
|
|
1831
|
-
];
|
|
1832
|
-
for (const op of dataLossOps) {
|
|
1833
|
-
if (!op.re.test(command)) continue;
|
|
1834
|
-
addUnique(findings, {
|
|
1835
|
-
code: op.code,
|
|
1836
|
-
severity: "medium",
|
|
1837
|
-
category: "git_data_loss",
|
|
1838
|
-
title: op.title
|
|
1839
|
-
});
|
|
1840
1747
|
}
|
|
1841
1748
|
return findings;
|
|
1842
1749
|
}
|
|
1843
|
-
function getBashGateFindings(command) {
|
|
1844
|
-
const c = command.trim();
|
|
1845
|
-
if (!c) return [];
|
|
1846
|
-
const findings = [
|
|
1847
|
-
...analyzeRm(c),
|
|
1848
|
-
...analyzeGit(c),
|
|
1849
|
-
...applySimpleRules(c, SIMPLE_RULES)
|
|
1850
|
-
];
|
|
1851
|
-
findings.sort((a, b) => a.code.localeCompare(b.code));
|
|
1852
|
-
return findings;
|
|
1853
|
-
}
|
|
1854
1750
|
function shouldReviewBashCommand(findings) {
|
|
1855
|
-
return findings.
|
|
1751
|
+
return findings.length > 0;
|
|
1856
1752
|
}
|
|
1857
1753
|
|
|
1858
1754
|
// packages/tools/src/tools/system/BashTool/llmSafetyGateDump.ts
|
|
@@ -2058,7 +1954,7 @@ function formatParseError(error) {
|
|
|
2058
1954
|
return error instanceof Error ? error.message : String(error);
|
|
2059
1955
|
}
|
|
2060
1956
|
async function defaultGateQuery(args) {
|
|
2061
|
-
const { API_ERROR_MESSAGE_PREFIX, queryLLM: queryLLM2 } = await import("./llm-
|
|
1957
|
+
const { API_ERROR_MESSAGE_PREFIX, queryLLM: queryLLM2 } = await import("./llm-PONI6QWH.js");
|
|
2062
1958
|
const messages = [createUserMessage(args.userInput)];
|
|
2063
1959
|
const assistant = await queryLLM2(
|
|
2064
1960
|
messages,
|
|
@@ -2214,25 +2110,34 @@ import * as React7 from "react";
|
|
|
2214
2110
|
|
|
2215
2111
|
// packages/tools/src/tools/system/BashTool/BashToolRunInBackgroundOverlay.tsx
|
|
2216
2112
|
import { Box as Box5, Text as Text6, useInput } from "ink";
|
|
2217
|
-
import React6, { useEffect,
|
|
2218
|
-
var
|
|
2113
|
+
import React6, { useEffect, useRef, useState } from "react";
|
|
2114
|
+
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
2219
2115
|
function getLabel(status) {
|
|
2220
2116
|
switch (status.kind) {
|
|
2221
2117
|
case "thinking":
|
|
2222
|
-
return "
|
|
2118
|
+
return "Prefilling";
|
|
2223
2119
|
case "streaming":
|
|
2224
|
-
return "
|
|
2225
|
-
|
|
2226
|
-
return
|
|
2227
|
-
|
|
2228
|
-
|
|
2120
|
+
return "Decoding";
|
|
2121
|
+
default:
|
|
2122
|
+
return "";
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
function formatTokens(tokens) {
|
|
2126
|
+
if (tokens >= 1e3) {
|
|
2127
|
+
return `${(tokens / 1e3).toFixed(1)}k`;
|
|
2229
2128
|
}
|
|
2129
|
+
return tokens.toString();
|
|
2130
|
+
}
|
|
2131
|
+
function getTokenDisplay(status) {
|
|
2132
|
+
if (status.kind === "thinking" && status.inputTokens) {
|
|
2133
|
+
return ` \xB7 \u2191 ${formatTokens(status.inputTokens)}`;
|
|
2134
|
+
}
|
|
2135
|
+
if (status.kind === "streaming" && status.outputTokens !== void 0) {
|
|
2136
|
+
return ` \xB7 \u2193 ${formatTokens(status.outputTokens)}`;
|
|
2137
|
+
}
|
|
2138
|
+
return "";
|
|
2230
2139
|
}
|
|
2231
2140
|
function RequestStatusIndicator() {
|
|
2232
|
-
const frames = useMemo(
|
|
2233
|
-
() => [...CHARACTERS, ...[...CHARACTERS].reverse()],
|
|
2234
|
-
[]
|
|
2235
|
-
);
|
|
2236
2141
|
const theme = getTheme();
|
|
2237
2142
|
const [frame, setFrame] = useState(0);
|
|
2238
2143
|
const [elapsedTime, setElapsedTime] = useState(0);
|
|
@@ -2252,10 +2157,10 @@ function RequestStatusIndicator() {
|
|
|
2252
2157
|
}, []);
|
|
2253
2158
|
useEffect(() => {
|
|
2254
2159
|
const timer = setInterval(() => {
|
|
2255
|
-
setFrame((f) => (f + 1) %
|
|
2256
|
-
},
|
|
2160
|
+
setFrame((f) => (f + 1) % SPINNER_FRAMES.length);
|
|
2161
|
+
}, 80);
|
|
2257
2162
|
return () => clearInterval(timer);
|
|
2258
|
-
}, [
|
|
2163
|
+
}, []);
|
|
2259
2164
|
useEffect(() => {
|
|
2260
2165
|
const timer = setInterval(() => {
|
|
2261
2166
|
if (requestStartTime.current === null) {
|
|
@@ -2263,10 +2168,13 @@ function RequestStatusIndicator() {
|
|
|
2263
2168
|
return;
|
|
2264
2169
|
}
|
|
2265
2170
|
setElapsedTime(Math.floor((Date.now() - requestStartTime.current) / 1e3));
|
|
2266
|
-
},
|
|
2171
|
+
}, 1e3);
|
|
2267
2172
|
return () => clearInterval(timer);
|
|
2268
2173
|
}, []);
|
|
2269
|
-
|
|
2174
|
+
if (status.kind === "tool" || status.kind === "idle") {
|
|
2175
|
+
return null;
|
|
2176
|
+
}
|
|
2177
|
+
return /* @__PURE__ */ React6.createElement(Box5, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React6.createElement(Text6, { color: theme.kode, bold: true }, SPINNER_FRAMES[frame], " ", getLabel(status)), /* @__PURE__ */ React6.createElement(Text6, { color: theme.secondaryText }, " ", ":: ", elapsedTime, "s (Esc to interrupt)", getTokenDisplay(status)));
|
|
2270
2178
|
}
|
|
2271
2179
|
function BashToolRunInBackgroundOverlay({
|
|
2272
2180
|
onBackground
|
|
@@ -2619,7 +2527,7 @@ ${footerParts.join(" ")}`;
|
|
|
2619
2527
|
isImage: /^data:image\/[^;]+;base64,/i.test(stdoutContent.trim())
|
|
2620
2528
|
};
|
|
2621
2529
|
const outputForAnalysis = [stdoutContent, stderrContent].filter(Boolean).join("\n");
|
|
2622
|
-
if (!data.isImage) {
|
|
2530
|
+
if (!data.isImage && !options.skipSummary) {
|
|
2623
2531
|
const summary = await maybeSummarizeBashOutput({
|
|
2624
2532
|
command,
|
|
2625
2533
|
stdout: stdout.trimEnd(),
|
|
@@ -3787,7 +3695,36 @@ async function maybeAttachSandboxNetworkPorts(args) {
|
|
|
3787
3695
|
};
|
|
3788
3696
|
}
|
|
3789
3697
|
|
|
3790
|
-
// packages/tools/src/tools/system/BashTool/
|
|
3698
|
+
// packages/tools/src/tools/system/BashTool/LlmGateProgress.tsx
|
|
3699
|
+
import * as React9 from "react";
|
|
3700
|
+
import { Box as Box7, Text as Text8 } from "ink";
|
|
3701
|
+
import { useState as useState2, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
3702
|
+
var SPINNER_FRAMES2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
3703
|
+
function LlmGateProgress({
|
|
3704
|
+
command,
|
|
3705
|
+
findings
|
|
3706
|
+
}) {
|
|
3707
|
+
const theme = getTheme();
|
|
3708
|
+
const [frame, setFrame] = useState2(0);
|
|
3709
|
+
const [elapsedTime, setElapsedTime] = useState2(0);
|
|
3710
|
+
const startTime = useRef2(Date.now());
|
|
3711
|
+
useEffect2(() => {
|
|
3712
|
+
const timer = setInterval(() => {
|
|
3713
|
+
setFrame((f) => (f + 1) % SPINNER_FRAMES2.length);
|
|
3714
|
+
}, 80);
|
|
3715
|
+
return () => clearInterval(timer);
|
|
3716
|
+
}, []);
|
|
3717
|
+
useEffect2(() => {
|
|
3718
|
+
const timer = setInterval(() => {
|
|
3719
|
+
setElapsedTime(Math.floor((Date.now() - startTime.current) / 1e3));
|
|
3720
|
+
}, 1e3);
|
|
3721
|
+
return () => clearInterval(timer);
|
|
3722
|
+
}, []);
|
|
3723
|
+
const truncatedCommand = command.length > 60 ? `${command.slice(0, 57)}...` : command;
|
|
3724
|
+
return /* @__PURE__ */ React9.createElement(Box7, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React9.createElement(Box7, null, /* @__PURE__ */ React9.createElement(Text8, { color: theme.warning }, SPINNER_FRAMES2[frame], " "), /* @__PURE__ */ React9.createElement(Text8, { color: theme.warning, bold: true }, "Reviewing destructive command..."), /* @__PURE__ */ React9.createElement(Text8, { color: theme.secondaryText }, " (", elapsedTime, "s)")), /* @__PURE__ */ React9.createElement(Box7, { marginTop: 1, paddingLeft: 2 }, /* @__PURE__ */ React9.createElement(Text8, { color: theme.secondaryText }, "$ ", truncatedCommand)), findings.length > 0 && /* @__PURE__ */ React9.createElement(Box7, { marginTop: 1, paddingLeft: 2, flexDirection: "column" }, findings.slice(0, 3).map((f) => /* @__PURE__ */ React9.createElement(Text8, { key: f.code, color: theme.error }, "- ", f.title)), findings.length > 3 && /* @__PURE__ */ React9.createElement(Text8, { color: theme.secondaryText }, "... and ", findings.length - 3, " more")));
|
|
3725
|
+
}
|
|
3726
|
+
|
|
3727
|
+
// packages/tools/src/tools/system/BashTool/call.tsx
|
|
3791
3728
|
async function* callBashTool(input, context, renderResultForAssistant) {
|
|
3792
3729
|
const { abortController, readFileTimestamps } = context;
|
|
3793
3730
|
const hasSetToolJSX = (value) => {
|
|
@@ -3857,6 +3794,20 @@ async function* callBashTool(input, context, renderResultForAssistant) {
|
|
|
3857
3794
|
}
|
|
3858
3795
|
let sandboxOptions = sandboxPlan.settings.enabled === true ? sandboxPlan.bunShellSandboxOptions : systemSandboxOptions;
|
|
3859
3796
|
const bashLlmGateQuery = context.options?.bashLlmGateQuery;
|
|
3797
|
+
const findings = getBashGateFindings(input.command);
|
|
3798
|
+
const needsLlmGate = shouldReviewBashCommand(findings);
|
|
3799
|
+
if (needsLlmGate && setToolJSX) {
|
|
3800
|
+
setToolJSX({
|
|
3801
|
+
jsx: /* @__PURE__ */ React10.createElement(LlmGateProgress, { command: input.command, findings }),
|
|
3802
|
+
shouldHidePromptInput: false
|
|
3803
|
+
});
|
|
3804
|
+
yield {
|
|
3805
|
+
type: "progress",
|
|
3806
|
+
content: createAssistantMessage(
|
|
3807
|
+
`<tool-progress>Reviewing: ${findings.map((f) => f.title).join(", ")}</tool-progress>`
|
|
3808
|
+
)
|
|
3809
|
+
};
|
|
3810
|
+
}
|
|
3860
3811
|
const llmGateResult = await runBashLlmSafetyGate({
|
|
3861
3812
|
command: input.command,
|
|
3862
3813
|
userPrompt,
|
|
@@ -3872,6 +3823,9 @@ async function* callBashTool(input, context, renderResultForAssistant) {
|
|
|
3872
3823
|
parentAbortSignal: abortController.signal,
|
|
3873
3824
|
query: bashLlmGateQuery
|
|
3874
3825
|
});
|
|
3826
|
+
if (needsLlmGate && setToolJSX) {
|
|
3827
|
+
setToolJSX(null);
|
|
3828
|
+
}
|
|
3875
3829
|
if (llmGateResult.decision === "block") {
|
|
3876
3830
|
const message = formatBashLlmGateBlockMessage(llmGateResult.verdict);
|
|
3877
3831
|
const data = {
|
|
@@ -3973,7 +3927,8 @@ async function* callBashTool(input, context, renderResultForAssistant) {
|
|
|
3973
3927
|
dangerouslyDisableSandbox: sandboxDisabled,
|
|
3974
3928
|
setToolJSX,
|
|
3975
3929
|
renderResultForAssistant,
|
|
3976
|
-
conversationKey: getPlanConversationKey(context)
|
|
3930
|
+
conversationKey: getPlanConversationKey(context),
|
|
3931
|
+
skipSummary: commandSource === "user_bash_mode"
|
|
3977
3932
|
});
|
|
3978
3933
|
} catch (error) {
|
|
3979
3934
|
const isAborted = abortController.signal.aborted;
|
|
@@ -4138,7 +4093,7 @@ var BashTool = {
|
|
|
4138
4093
|
return null;
|
|
4139
4094
|
},
|
|
4140
4095
|
renderToolResultMessage(content) {
|
|
4141
|
-
return /* @__PURE__ */
|
|
4096
|
+
return /* @__PURE__ */ React11.createElement(BashToolResultMessage_default, { content, verbose: false });
|
|
4142
4097
|
},
|
|
4143
4098
|
renderResultForAssistant({
|
|
4144
4099
|
interrupted,
|
|
@@ -4419,8 +4374,8 @@ ${output.task.output.trimEnd()}
|
|
|
4419
4374
|
};
|
|
4420
4375
|
|
|
4421
4376
|
// packages/tools/src/tools/interaction/PlanModeTool/EnterPlanModeTool.tsx
|
|
4422
|
-
import { Box as
|
|
4423
|
-
import
|
|
4377
|
+
import { Box as Box8, Text as Text9 } from "ink";
|
|
4378
|
+
import React12 from "react";
|
|
4424
4379
|
import { z as z6 } from "zod";
|
|
4425
4380
|
|
|
4426
4381
|
// packages/tools/src/tools/interaction/PlanModeTool/prompt.ts
|
|
@@ -4572,11 +4527,11 @@ var EnterPlanModeTool = {
|
|
|
4572
4527
|
},
|
|
4573
4528
|
renderToolUseRejectedMessage() {
|
|
4574
4529
|
const theme = getTheme();
|
|
4575
|
-
return /* @__PURE__ */
|
|
4530
|
+
return /* @__PURE__ */ React12.createElement(Box8, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text9, { color: theme.text }, BLACK_CIRCLE), /* @__PURE__ */ React12.createElement(Text9, null, " User declined to enter plan mode"));
|
|
4576
4531
|
},
|
|
4577
4532
|
renderToolResultMessage(_output) {
|
|
4578
4533
|
const theme = getTheme();
|
|
4579
|
-
return /* @__PURE__ */
|
|
4534
|
+
return /* @__PURE__ */ React12.createElement(Box8, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React12.createElement(Box8, { flexDirection: "row" }, /* @__PURE__ */ React12.createElement(Text9, { color: theme.planMode }, BLACK_CIRCLE), /* @__PURE__ */ React12.createElement(Text9, null, " Entered plan mode")), /* @__PURE__ */ React12.createElement(Box8, { paddingLeft: 2 }, /* @__PURE__ */ React12.createElement(Text9, { dimColor: true }, "Kode Agent is now exploring and designing an implementation approach.")));
|
|
4580
4535
|
},
|
|
4581
4536
|
renderResultForAssistant(output) {
|
|
4582
4537
|
return `${output.message}
|
|
@@ -4620,8 +4575,8 @@ Remember: DO NOT write or edit any files yet. This is a read-only exploration an
|
|
|
4620
4575
|
};
|
|
4621
4576
|
|
|
4622
4577
|
// packages/tools/src/tools/interaction/PlanModeTool/ExitPlanModeTool.tsx
|
|
4623
|
-
import { Box as
|
|
4624
|
-
import
|
|
4578
|
+
import { Box as Box9, Text as Text10 } from "ink";
|
|
4579
|
+
import React13 from "react";
|
|
4625
4580
|
import { z as z7 } from "zod";
|
|
4626
4581
|
function getExitPlanModePlanText(conversationKey) {
|
|
4627
4582
|
const { content } = readPlanFile(void 0, conversationKey);
|
|
@@ -4672,8 +4627,8 @@ var ExitPlanModeTool = {
|
|
|
4672
4627
|
const conversationKey = typeof options.conversationKey === "string" && options.conversationKey.trim() ? options.conversationKey.trim() : void 0;
|
|
4673
4628
|
const { content } = readPlanFile(void 0, conversationKey);
|
|
4674
4629
|
const plan = getExitPlanModePlanText(conversationKey);
|
|
4675
|
-
return /* @__PURE__ */
|
|
4676
|
-
|
|
4630
|
+
return /* @__PURE__ */ React13.createElement(Box9, { flexDirection: "column", marginTop: 1, width: "100%" }, /* @__PURE__ */ React13.createElement(Box9, { flexDirection: "row" }, /* @__PURE__ */ React13.createElement(Text10, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React13.createElement(Box9, { flexDirection: "column", width: "100%" }, /* @__PURE__ */ React13.createElement(Text10, { color: theme.error }, "User rejected the plan:"), /* @__PURE__ */ React13.createElement(
|
|
4631
|
+
Box9,
|
|
4677
4632
|
{
|
|
4678
4633
|
borderStyle: "round",
|
|
4679
4634
|
borderColor: theme.planMode,
|
|
@@ -4681,14 +4636,14 @@ var ExitPlanModeTool = {
|
|
|
4681
4636
|
paddingX: 1,
|
|
4682
4637
|
overflow: "hidden"
|
|
4683
4638
|
},
|
|
4684
|
-
/* @__PURE__ */
|
|
4639
|
+
/* @__PURE__ */ React13.createElement(Text10, { dimColor: true }, plan)
|
|
4685
4640
|
))));
|
|
4686
4641
|
},
|
|
4687
4642
|
renderToolResultMessage(output) {
|
|
4688
4643
|
const theme = getTheme();
|
|
4689
4644
|
const planPath = typeof output.filePath === "string" ? output.filePath : null;
|
|
4690
4645
|
const plan = output.plan || "No plan found";
|
|
4691
|
-
return /* @__PURE__ */
|
|
4646
|
+
return /* @__PURE__ */ React13.createElement(Box9, { flexDirection: "column", marginTop: 1, width: "100%" }, /* @__PURE__ */ React13.createElement(Box9, { flexDirection: "row" }, /* @__PURE__ */ React13.createElement(Text10, { color: theme.planMode }, BLACK_CIRCLE), /* @__PURE__ */ React13.createElement(Text10, null, " User approved the plan")), /* @__PURE__ */ React13.createElement(Box9, { flexDirection: "row" }, /* @__PURE__ */ React13.createElement(Text10, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React13.createElement(Box9, { flexDirection: "column" }, planPath ? /* @__PURE__ */ React13.createElement(Text10, { dimColor: true }, "Plan file: ", planPath, " \xB7 /plan to edit") : null, /* @__PURE__ */ React13.createElement(Text10, { dimColor: true }, plan))));
|
|
4692
4647
|
},
|
|
4693
4648
|
renderResultForAssistant(output) {
|
|
4694
4649
|
if (output.isAgent) {
|
|
@@ -4747,9 +4702,9 @@ import { dirname, isAbsolute as isAbsolute5, relative as relative3, resolve as r
|
|
|
4747
4702
|
import { z as z9 } from "zod";
|
|
4748
4703
|
|
|
4749
4704
|
// packages/tools/src/tools/filesystem/NotebookEditTool/NotebookEditTool.tsx
|
|
4750
|
-
import { Box as
|
|
4705
|
+
import { Box as Box10, Text as Text11 } from "ink";
|
|
4751
4706
|
import { extname, relative as relative2 } from "path";
|
|
4752
|
-
import * as
|
|
4707
|
+
import * as React14 from "react";
|
|
4753
4708
|
import { z as z8 } from "zod";
|
|
4754
4709
|
import { highlight as highlight2, supportsLanguage as supportsLanguage2 } from "cli-highlight";
|
|
4755
4710
|
|
|
@@ -4945,9 +4900,9 @@ var NotebookEditTool = {
|
|
|
4945
4900
|
},
|
|
4946
4901
|
renderToolResultMessage({ cell_id, new_source, language, error }) {
|
|
4947
4902
|
if (error) {
|
|
4948
|
-
return /* @__PURE__ */
|
|
4903
|
+
return /* @__PURE__ */ React14.createElement(Box10, { flexDirection: "column" }, /* @__PURE__ */ React14.createElement(Text11, { color: "red" }, error));
|
|
4949
4904
|
}
|
|
4950
|
-
return /* @__PURE__ */
|
|
4905
|
+
return /* @__PURE__ */ React14.createElement(Box10, { flexDirection: "column" }, /* @__PURE__ */ React14.createElement(Text11, null, "Updated cell ", cell_id, ":"), /* @__PURE__ */ React14.createElement(Box10, { marginLeft: 2 }, /* @__PURE__ */ React14.createElement(Text11, null, highlightCode(new_source, language))));
|
|
4951
4906
|
},
|
|
4952
4907
|
async validateInput({
|
|
4953
4908
|
notebook_path,
|
|
@@ -5548,8 +5503,8 @@ var LSTool = {
|
|
|
5548
5503
|
};
|
|
5549
5504
|
|
|
5550
5505
|
// packages/tools/src/tools/search/GrepTool/GrepTool.tsx
|
|
5551
|
-
import { Box as
|
|
5552
|
-
import
|
|
5506
|
+
import { Box as Box11, Text as Text12 } from "ink";
|
|
5507
|
+
import React15 from "react";
|
|
5553
5508
|
import { existsSync as existsSync5 } from "fs";
|
|
5554
5509
|
import { z as z12 } from "zod";
|
|
5555
5510
|
|
|
@@ -5850,7 +5805,7 @@ var GrepTool = {
|
|
|
5850
5805
|
if (typeof output === "string") {
|
|
5851
5806
|
output = output;
|
|
5852
5807
|
}
|
|
5853
|
-
return /* @__PURE__ */
|
|
5808
|
+
return /* @__PURE__ */ React15.createElement(Box11, { flexDirection: "row" }, /* @__PURE__ */ React15.createElement(Text12, null, "\xA0\xA0\u23BF \xA0Found "), /* @__PURE__ */ React15.createElement(Text12, { bold: true }, output.mode === "content" ? output.numLines ?? 0 : output.mode === "count" ? output.numMatches ?? 0 : output.numFiles, " "), /* @__PURE__ */ React15.createElement(Text12, null, output.mode === "content" ? (output.numLines ?? 0) === 1 ? "line" : "lines" : output.mode === "count" ? (output.numMatches ?? 0) === 1 ? "match" : "matches" : output.numFiles === 1 ? "file" : "files"));
|
|
5854
5809
|
},
|
|
5855
5810
|
renderResultForAssistant(result) {
|
|
5856
5811
|
const pagination = formatPagination(
|
|
@@ -5983,8 +5938,8 @@ var KillShellTool = {
|
|
|
5983
5938
|
};
|
|
5984
5939
|
|
|
5985
5940
|
// packages/tools/src/tools/mcp/ListMcpResourcesTool/ListMcpResourcesTool.tsx
|
|
5986
|
-
import { Box as
|
|
5987
|
-
import
|
|
5941
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
5942
|
+
import React16 from "react";
|
|
5988
5943
|
import { z as z14 } from "zod";
|
|
5989
5944
|
import { ListResourcesResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
5990
5945
|
|
|
@@ -6066,7 +6021,7 @@ var ListMcpResourcesTool = {
|
|
|
6066
6021
|
return server ? `List MCP resources from server "${server}"` : "List all MCP resources";
|
|
6067
6022
|
},
|
|
6068
6023
|
renderToolResultMessage(output) {
|
|
6069
|
-
return /* @__PURE__ */
|
|
6024
|
+
return /* @__PURE__ */ React16.createElement(Box12, { flexDirection: "row" }, /* @__PURE__ */ React16.createElement(Text13, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React16.createElement(Text13, { bold: true }, output.length), /* @__PURE__ */ React16.createElement(Text13, null, " resources"));
|
|
6070
6025
|
},
|
|
6071
6026
|
renderResultForAssistant(output) {
|
|
6072
6027
|
return JSON.stringify(output);
|
|
@@ -6195,8 +6150,8 @@ function maybeTruncateVerboseToolOutput(text, options) {
|
|
|
6195
6150
|
|
|
6196
6151
|
// packages/tools/src/tools/system/LspTool/LspTool.tsx
|
|
6197
6152
|
import { existsSync as existsSync6, readFileSync as readFileSync3, statSync as statSync5 } from "fs";
|
|
6198
|
-
import { Box as
|
|
6199
|
-
import
|
|
6153
|
+
import { Box as Box13, Text as Text15 } from "ink";
|
|
6154
|
+
import React18 from "react";
|
|
6200
6155
|
import { z as z15 } from "zod";
|
|
6201
6156
|
|
|
6202
6157
|
// packages/tools/src/tools/system/LspTool/constants.ts
|
|
@@ -6224,8 +6179,8 @@ var OPERATION_LABELS = {
|
|
|
6224
6179
|
};
|
|
6225
6180
|
|
|
6226
6181
|
// packages/tools/src/tools/system/LspTool/summary.tsx
|
|
6227
|
-
import { Text as
|
|
6228
|
-
import
|
|
6182
|
+
import { Text as Text14 } from "ink";
|
|
6183
|
+
import React17 from "react";
|
|
6229
6184
|
function summarizeToolResult(operation, resultCount, fileCount) {
|
|
6230
6185
|
const label = OPERATION_LABELS[operation] ?? {
|
|
6231
6186
|
singular: "result",
|
|
@@ -6233,9 +6188,9 @@ function summarizeToolResult(operation, resultCount, fileCount) {
|
|
|
6233
6188
|
};
|
|
6234
6189
|
const noun = resultCount === 1 ? label.singular : label.plural;
|
|
6235
6190
|
if (operation === "hover" && resultCount > 0 && label.special) {
|
|
6236
|
-
return /* @__PURE__ */
|
|
6191
|
+
return /* @__PURE__ */ React17.createElement(Text14, null, "Hover info ", label.special);
|
|
6237
6192
|
}
|
|
6238
|
-
return /* @__PURE__ */
|
|
6193
|
+
return /* @__PURE__ */ React17.createElement(Text14, null, "Found ", /* @__PURE__ */ React17.createElement(Text14, { bold: true }, resultCount), " ", noun, fileCount > 1 ? /* @__PURE__ */ React17.createElement(React17.Fragment, null, " ", "across ", /* @__PURE__ */ React17.createElement(Text14, { bold: true }, fileCount), " files") : null);
|
|
6239
6194
|
}
|
|
6240
6195
|
|
|
6241
6196
|
// packages/tools/src/tools/system/LspTool/prompt.ts
|
|
@@ -6374,13 +6329,13 @@ var LspTool = {
|
|
|
6374
6329
|
maxLines: 120,
|
|
6375
6330
|
maxChars: 2e4
|
|
6376
6331
|
}) : null;
|
|
6377
|
-
return /* @__PURE__ */
|
|
6332
|
+
return /* @__PURE__ */ React18.createElement(Box13, { flexDirection: "column" }, /* @__PURE__ */ React18.createElement(Box13, { flexDirection: "row" }, /* @__PURE__ */ React18.createElement(Text15, null, "\xA0\xA0\u23BF \xA0"), summarizeToolResult(
|
|
6378
6333
|
output.operation,
|
|
6379
6334
|
output.resultCount,
|
|
6380
6335
|
output.fileCount
|
|
6381
|
-
)), display ? /* @__PURE__ */
|
|
6336
|
+
)), display ? /* @__PURE__ */ React18.createElement(Box13, { marginLeft: 5 }, /* @__PURE__ */ React18.createElement(Text15, null, display.text)) : null);
|
|
6382
6337
|
}
|
|
6383
|
-
return /* @__PURE__ */
|
|
6338
|
+
return /* @__PURE__ */ React18.createElement(Box13, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React18.createElement(Box13, { flexDirection: "row" }, /* @__PURE__ */ React18.createElement(Text15, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React18.createElement(Text15, null, output.result)));
|
|
6384
6339
|
},
|
|
6385
6340
|
renderResultForAssistant(output) {
|
|
6386
6341
|
return output.result;
|
|
@@ -6391,8 +6346,8 @@ var LspTool = {
|
|
|
6391
6346
|
};
|
|
6392
6347
|
|
|
6393
6348
|
// packages/tools/src/tools/mcp/MCPTool/MCPTool.tsx
|
|
6394
|
-
import { Box as
|
|
6395
|
-
import * as
|
|
6349
|
+
import { Box as Box14, Text as Text16 } from "ink";
|
|
6350
|
+
import * as React19 from "react";
|
|
6396
6351
|
import { z as z16 } from "zod";
|
|
6397
6352
|
|
|
6398
6353
|
// packages/tools/src/tools/mcp/MCPTool/prompt.ts
|
|
@@ -6444,21 +6399,21 @@ var MCPTool = {
|
|
|
6444
6399
|
renderToolResultMessage(output) {
|
|
6445
6400
|
const verbose = false;
|
|
6446
6401
|
if (Array.isArray(output)) {
|
|
6447
|
-
return /* @__PURE__ */
|
|
6402
|
+
return /* @__PURE__ */ React19.createElement(Box14, { flexDirection: "column" }, output.map((item, i) => {
|
|
6448
6403
|
if (item.type === "image") {
|
|
6449
|
-
return /* @__PURE__ */
|
|
6450
|
-
|
|
6404
|
+
return /* @__PURE__ */ React19.createElement(
|
|
6405
|
+
Box14,
|
|
6451
6406
|
{
|
|
6452
6407
|
key: i,
|
|
6453
6408
|
justifyContent: "space-between",
|
|
6454
6409
|
overflowX: "hidden",
|
|
6455
6410
|
width: "100%"
|
|
6456
6411
|
},
|
|
6457
|
-
/* @__PURE__ */
|
|
6412
|
+
/* @__PURE__ */ React19.createElement(Box14, { flexDirection: "row" }, /* @__PURE__ */ React19.createElement(Text16, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React19.createElement(Text16, null, "[Image]"))
|
|
6458
6413
|
);
|
|
6459
6414
|
}
|
|
6460
6415
|
const lines2 = item.text.split("\n").length;
|
|
6461
|
-
return /* @__PURE__ */
|
|
6416
|
+
return /* @__PURE__ */ React19.createElement(
|
|
6462
6417
|
OutputLine,
|
|
6463
6418
|
{
|
|
6464
6419
|
key: i,
|
|
@@ -6470,10 +6425,10 @@ var MCPTool = {
|
|
|
6470
6425
|
}));
|
|
6471
6426
|
}
|
|
6472
6427
|
if (!output) {
|
|
6473
|
-
return /* @__PURE__ */
|
|
6428
|
+
return /* @__PURE__ */ React19.createElement(Box14, { justifyContent: "space-between", overflowX: "hidden", width: "100%" }, /* @__PURE__ */ React19.createElement(Box14, { flexDirection: "row" }, /* @__PURE__ */ React19.createElement(Text16, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React19.createElement(Text16, { color: getTheme().secondaryText }, "(No content)")));
|
|
6474
6429
|
}
|
|
6475
6430
|
const lines = output.split("\n").length;
|
|
6476
|
-
return /* @__PURE__ */
|
|
6431
|
+
return /* @__PURE__ */ React19.createElement(OutputLine, { content: output, lines, verbose });
|
|
6477
6432
|
},
|
|
6478
6433
|
renderResultForAssistant(content) {
|
|
6479
6434
|
return content;
|
|
@@ -6481,8 +6436,8 @@ var MCPTool = {
|
|
|
6481
6436
|
};
|
|
6482
6437
|
|
|
6483
6438
|
// packages/tools/src/tools/mcp/MCPSearchTool/MCPSearchTool.tsx
|
|
6484
|
-
import { Box as
|
|
6485
|
-
import
|
|
6439
|
+
import { Box as Box15, Text as Text17 } from "ink";
|
|
6440
|
+
import React20 from "react";
|
|
6486
6441
|
import { z as z17 } from "zod";
|
|
6487
6442
|
|
|
6488
6443
|
// packages/tools/src/tools/mcp/MCPSearchTool/prompt.ts
|
|
@@ -6627,9 +6582,9 @@ var MCPSearchTool = {
|
|
|
6627
6582
|
renderToolResultMessage(output) {
|
|
6628
6583
|
const theme = getTheme();
|
|
6629
6584
|
if (output.matches.length === 0) {
|
|
6630
|
-
return /* @__PURE__ */
|
|
6585
|
+
return /* @__PURE__ */ React20.createElement(Box15, { flexDirection: "row" }, /* @__PURE__ */ React20.createElement(Text17, { color: theme.text }, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React20.createElement(Text17, { dimColor: true }, "No matching MCP tools found"));
|
|
6631
6586
|
}
|
|
6632
|
-
return /* @__PURE__ */
|
|
6587
|
+
return /* @__PURE__ */ React20.createElement(Box15, { flexDirection: "row" }, /* @__PURE__ */ React20.createElement(Text17, { color: theme.text }, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React20.createElement(Text17, null, "Found ", /* @__PURE__ */ React20.createElement(Text17, { bold: true }, output.matches.length), " ", output.matches.length === 1 ? "tool" : "tools"));
|
|
6633
6588
|
},
|
|
6634
6589
|
renderResultForAssistant(output) {
|
|
6635
6590
|
return output.matches.map((toolName) => ({
|
|
@@ -6681,8 +6636,8 @@ var MCPSearchTool = {
|
|
|
6681
6636
|
};
|
|
6682
6637
|
|
|
6683
6638
|
// packages/tools/src/tools/mcp/ReadMcpResourceTool/ReadMcpResourceTool.tsx
|
|
6684
|
-
import { Box as
|
|
6685
|
-
import
|
|
6639
|
+
import { Box as Box16, Text as Text18 } from "ink";
|
|
6640
|
+
import React21 from "react";
|
|
6686
6641
|
import { z as z18 } from "zod";
|
|
6687
6642
|
import { ReadResourceResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
6688
6643
|
|
|
@@ -6786,7 +6741,7 @@ var ReadMcpResourceTool = {
|
|
|
6786
6741
|
},
|
|
6787
6742
|
renderToolResultMessage(output) {
|
|
6788
6743
|
const count = output.contents?.length ?? 0;
|
|
6789
|
-
return /* @__PURE__ */
|
|
6744
|
+
return /* @__PURE__ */ React21.createElement(Box16, { flexDirection: "row" }, /* @__PURE__ */ React21.createElement(Text18, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React21.createElement(Text18, { bold: true }, "Read MCP resource"), /* @__PURE__ */ React21.createElement(Text18, null, count ? ` (${count} part${count === 1 ? "" : "s"})` : ""));
|
|
6790
6745
|
},
|
|
6791
6746
|
renderResultForAssistant(output) {
|
|
6792
6747
|
return JSON.stringify(output);
|
|
@@ -7243,7 +7198,7 @@ async function* callTaskToolBackground(input, prepared, metadata) {
|
|
|
7243
7198
|
|
|
7244
7199
|
// packages/tools/src/tools/ai/TaskTool/callForeground.ts
|
|
7245
7200
|
import { last as last2, memoize } from "lodash-es";
|
|
7246
|
-
import
|
|
7201
|
+
import React22 from "react";
|
|
7247
7202
|
function isTextBlock2(block) {
|
|
7248
7203
|
return Boolean(block) && typeof block === "object" && block.type === "text" && typeof block.text === "string";
|
|
7249
7204
|
}
|
|
@@ -7370,7 +7325,7 @@ async function* callTaskToolForeground(input, prepared, options) {
|
|
|
7370
7325
|
if (backgrounded) return;
|
|
7371
7326
|
if (runAbortController.signal.aborted) return;
|
|
7372
7327
|
setToolJSX({
|
|
7373
|
-
jsx:
|
|
7328
|
+
jsx: React22.createElement(BashToolRunInBackgroundOverlay, {
|
|
7374
7329
|
onBackground: requestBackground
|
|
7375
7330
|
}),
|
|
7376
7331
|
shouldHidePromptInput: false
|
|
@@ -8220,7 +8175,7 @@ var SkillTool = {
|
|
|
8220
8175
|
const MAX_AVAILABLE_SKILLS_CHARS = 8e3;
|
|
8221
8176
|
async function loadCommands() {
|
|
8222
8177
|
try {
|
|
8223
|
-
const mod = await import("./customCommands-
|
|
8178
|
+
const mod = await import("./customCommands-S6YGRUED.js");
|
|
8224
8179
|
if (typeof mod.loadCustomCommands !== "function") return [];
|
|
8225
8180
|
const cmds = await mod.loadCustomCommands();
|
|
8226
8181
|
if (!Array.isArray(cmds)) return [];
|
|
@@ -8526,8 +8481,8 @@ var inputSchema21 = z21.object({
|
|
|
8526
8481
|
});
|
|
8527
8482
|
|
|
8528
8483
|
// packages/tools/src/tools/ai/TaskTool/render.tsx
|
|
8529
|
-
import
|
|
8530
|
-
import { Box as
|
|
8484
|
+
import React23 from "react";
|
|
8485
|
+
import { Box as Box17, Text as Text19 } from "ink";
|
|
8531
8486
|
function renderTaskToolUseMessage(input) {
|
|
8532
8487
|
if (!input.description || !input.prompt) return "";
|
|
8533
8488
|
return input.description;
|
|
@@ -8536,8 +8491,8 @@ function renderTaskToolResultMessage(output, options) {
|
|
|
8536
8491
|
const theme = getTheme();
|
|
8537
8492
|
if (output.status === "async_launched") {
|
|
8538
8493
|
const hint = output.prompt ? " (down arrow \u2193 to manage \xB7 ctrl+o to expand)" : " (down arrow \u2193 to manage)";
|
|
8539
|
-
return /* @__PURE__ */
|
|
8540
|
-
|
|
8494
|
+
return /* @__PURE__ */ React23.createElement(Box17, { flexDirection: "column" }, /* @__PURE__ */ React23.createElement(Box17, { flexDirection: "row" }, /* @__PURE__ */ React23.createElement(Text19, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React23.createElement(Text19, null, "Backgrounded agent", !options.verbose && /* @__PURE__ */ React23.createElement(Text19, { dimColor: true }, hint))), options.verbose && output.prompt && /* @__PURE__ */ React23.createElement(
|
|
8495
|
+
Box17,
|
|
8541
8496
|
{
|
|
8542
8497
|
paddingLeft: 2,
|
|
8543
8498
|
borderStyle: "single",
|
|
@@ -8547,7 +8502,7 @@ function renderTaskToolResultMessage(output, options) {
|
|
|
8547
8502
|
borderBottom: false,
|
|
8548
8503
|
borderLeftColor: theme.secondaryBorder
|
|
8549
8504
|
},
|
|
8550
|
-
/* @__PURE__ */
|
|
8505
|
+
/* @__PURE__ */ React23.createElement(Text19, { color: theme.secondaryText, wrap: "wrap" }, output.prompt)
|
|
8551
8506
|
));
|
|
8552
8507
|
}
|
|
8553
8508
|
const summary = [
|
|
@@ -8555,8 +8510,8 @@ function renderTaskToolResultMessage(output, options) {
|
|
|
8555
8510
|
`${formatNumber(output.totalTokens)} tokens`,
|
|
8556
8511
|
formatDuration(output.totalDurationMs)
|
|
8557
8512
|
];
|
|
8558
|
-
return /* @__PURE__ */
|
|
8559
|
-
|
|
8513
|
+
return /* @__PURE__ */ React23.createElement(Box17, { flexDirection: "column" }, options.verbose && output.prompt && /* @__PURE__ */ React23.createElement(
|
|
8514
|
+
Box17,
|
|
8560
8515
|
{
|
|
8561
8516
|
paddingLeft: 2,
|
|
8562
8517
|
borderStyle: "single",
|
|
@@ -8566,12 +8521,12 @@ function renderTaskToolResultMessage(output, options) {
|
|
|
8566
8521
|
borderBottom: false,
|
|
8567
8522
|
borderLeftColor: theme.secondaryBorder
|
|
8568
8523
|
},
|
|
8569
|
-
/* @__PURE__ */
|
|
8524
|
+
/* @__PURE__ */ React23.createElement(Text19, { color: theme.secondaryText, wrap: "wrap" }, maybeTruncateVerboseToolOutput(output.prompt, {
|
|
8570
8525
|
maxLines: 120,
|
|
8571
8526
|
maxChars: 2e4
|
|
8572
8527
|
}).text)
|
|
8573
|
-
), options.verbose && output.content.length > 0 && /* @__PURE__ */
|
|
8574
|
-
|
|
8528
|
+
), options.verbose && output.content.length > 0 && /* @__PURE__ */ React23.createElement(
|
|
8529
|
+
Box17,
|
|
8575
8530
|
{
|
|
8576
8531
|
paddingLeft: 2,
|
|
8577
8532
|
borderStyle: "single",
|
|
@@ -8581,11 +8536,11 @@ function renderTaskToolResultMessage(output, options) {
|
|
|
8581
8536
|
borderBottom: false,
|
|
8582
8537
|
borderLeftColor: theme.secondaryBorder
|
|
8583
8538
|
},
|
|
8584
|
-
/* @__PURE__ */
|
|
8539
|
+
/* @__PURE__ */ React23.createElement(Text19, { wrap: "wrap" }, maybeTruncateVerboseToolOutput(
|
|
8585
8540
|
output.content.map((b) => b.text).join("\n"),
|
|
8586
8541
|
{ maxLines: 200, maxChars: 4e4 }
|
|
8587
8542
|
).text)
|
|
8588
|
-
), /* @__PURE__ */
|
|
8543
|
+
), /* @__PURE__ */ React23.createElement(Box17, { flexDirection: "row" }, /* @__PURE__ */ React23.createElement(Text19, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React23.createElement(Text19, { dimColor: true }, "Done (", summary.join(" \xB7 "), ")")));
|
|
8589
8544
|
}
|
|
8590
8545
|
function renderTaskToolResultForAssistant(output) {
|
|
8591
8546
|
if (output.status === "async_launched")
|
|
@@ -9017,8 +8972,8 @@ var TodoWriteTool = {
|
|
|
9017
8972
|
};
|
|
9018
8973
|
|
|
9019
8974
|
// packages/tools/src/tools/search/WebSearchTool/WebSearchTool.tsx
|
|
9020
|
-
import { Box as
|
|
9021
|
-
import
|
|
8975
|
+
import { Box as Box18, Text as Text20 } from "ink";
|
|
8976
|
+
import React24 from "react";
|
|
9022
8977
|
import { z as z23 } from "zod";
|
|
9023
8978
|
|
|
9024
8979
|
// packages/tools/src/tools/search/WebSearchTool/prompt.ts
|
|
@@ -9059,7 +9014,7 @@ IMPORTANT - Use the correct year in search queries:
|
|
|
9059
9014
|
`.trim();
|
|
9060
9015
|
|
|
9061
9016
|
// packages/tools/src/tools/search/WebSearchTool/searchProviders.ts
|
|
9062
|
-
import { parse as
|
|
9017
|
+
import { parse as parse3 } from "node-html-parser";
|
|
9063
9018
|
var duckDuckGoSearchProvider = {
|
|
9064
9019
|
isEnabled: () => true,
|
|
9065
9020
|
search: async (query2) => {
|
|
@@ -9077,7 +9032,7 @@ var duckDuckGoSearchProvider = {
|
|
|
9077
9032
|
);
|
|
9078
9033
|
}
|
|
9079
9034
|
const html = await response.text();
|
|
9080
|
-
const root =
|
|
9035
|
+
const root = parse3(html);
|
|
9081
9036
|
const results = [];
|
|
9082
9037
|
const resultNodes = root.querySelectorAll(".result.web-result");
|
|
9083
9038
|
for (const node of resultNodes) {
|
|
@@ -9427,7 +9382,7 @@ var WebSearchTool = {
|
|
|
9427
9382
|
renderToolResultMessage(output) {
|
|
9428
9383
|
const { searchCount } = summarizeResults(output.results);
|
|
9429
9384
|
const duration = output.durationSeconds >= 1 ? `${Math.round(output.durationSeconds)}s` : `${Math.round(output.durationSeconds * 1e3)}ms`;
|
|
9430
|
-
return /* @__PURE__ */
|
|
9385
|
+
return /* @__PURE__ */ React24.createElement(Box18, { flexDirection: "row" }, /* @__PURE__ */ React24.createElement(Text20, null, "\xA0\xA0\u23BF \xA0Did "), /* @__PURE__ */ React24.createElement(Text20, { bold: true }, searchCount, " "), /* @__PURE__ */ React24.createElement(Text20, null, "search", searchCount === 1 ? "" : "es", " in ", duration));
|
|
9431
9386
|
},
|
|
9432
9387
|
renderResultForAssistant(output) {
|
|
9433
9388
|
let result = `Web search results for query: "${output.query}"
|
|
@@ -9571,7 +9526,10 @@ var getReadOnlyTools = memoize2(async () => {
|
|
|
9571
9526
|
|
|
9572
9527
|
export {
|
|
9573
9528
|
applyMarkdown,
|
|
9574
|
-
|
|
9529
|
+
RECORD_CIRCLE,
|
|
9530
|
+
CHECKMARK,
|
|
9531
|
+
CROSS,
|
|
9532
|
+
DIAMOND_HOLLOW,
|
|
9575
9533
|
AskUserQuestionTool,
|
|
9576
9534
|
MaxSizedText,
|
|
9577
9535
|
BashToolResultMessage_default,
|