@shareai-lab/kode 2.0.1 → 2.0.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/LICENSE +201 -0
- package/README.md +649 -25
- package/README.zh-CN.md +579 -0
- package/cli-acp.js +3 -17
- package/cli.js +5 -7
- package/dist/chunks/Doctor-M3J7GRTJ.js +12 -0
- package/dist/chunks/LogList-ISWZ6DDD.js +121 -0
- package/dist/chunks/LogList-ISWZ6DDD.js.map +7 -0
- package/dist/chunks/REPL-RQ6LO6S7.js +56 -0
- package/dist/chunks/ResumeConversation-6DMVBEGH.js +56 -0
- package/dist/chunks/agentLoader-FCRG3TFJ.js +31 -0
- package/dist/{agentsValidate-7LH4HTNR.js → chunks/agentsValidate-PEWMYN4Q.js} +97 -69
- package/dist/chunks/agentsValidate-PEWMYN4Q.js.map +7 -0
- package/dist/{ask-3NHFFUQG.js → chunks/ask-D7SOHJ6Z.js} +36 -44
- package/dist/chunks/ask-D7SOHJ6Z.js.map +7 -0
- package/dist/chunks/autoUpdater-CNESBOKO.js +19 -0
- package/dist/{chunk-AFFSCMYS.js → chunks/chunk-2JN5MY67.js} +12 -14
- package/dist/chunks/chunk-2JN5MY67.js.map +7 -0
- package/dist/chunks/chunk-2QONJ5MG.js +14 -0
- package/dist/chunks/chunk-2QONJ5MG.js.map +7 -0
- package/dist/chunks/chunk-2WEXPKHH.js +903 -0
- package/dist/chunks/chunk-2WEXPKHH.js.map +7 -0
- package/dist/{chunk-ARZSBOAO.js → chunks/chunk-3BYE3ME6.js} +717 -792
- package/dist/chunks/chunk-3BYE3ME6.js.map +7 -0
- package/dist/chunks/chunk-3JDNWX7W.js +1264 -0
- package/dist/chunks/chunk-3JDNWX7W.js.map +7 -0
- package/dist/chunks/chunk-3OEJVB5A.js +906 -0
- package/dist/chunks/chunk-3OEJVB5A.js.map +7 -0
- package/dist/chunks/chunk-3TNIOEBO.js +369 -0
- package/dist/chunks/chunk-3TNIOEBO.js.map +7 -0
- package/dist/chunks/chunk-4A46ZXMJ.js +67 -0
- package/dist/chunks/chunk-4A46ZXMJ.js.map +7 -0
- package/dist/{chunk-UHYRLID6.js → chunks/chunk-4ATBQOFO.js} +107 -55
- package/dist/chunks/chunk-4ATBQOFO.js.map +7 -0
- package/dist/chunks/chunk-4CRUCZR4.js +0 -0
- package/dist/{chunk-YC6LJCDE.js → chunks/chunk-4EO6SIQY.js} +32 -75
- package/dist/chunks/chunk-4EO6SIQY.js.map +7 -0
- package/dist/chunks/chunk-53M46S5I.js +64 -0
- package/dist/chunks/chunk-53M46S5I.js.map +7 -0
- package/dist/{chunk-JC6NCUG5.js → chunks/chunk-54KOYG5C.js} +0 -2
- package/dist/{chunk-EZXMVTDU.js → chunks/chunk-6BAS4WY6.js} +29 -45
- package/dist/chunks/chunk-6BAS4WY6.js.map +7 -0
- package/dist/{chunk-3IN27HA5.js → chunks/chunk-6KRRFSDN.js} +4 -6
- package/dist/chunks/chunk-6KRRFSDN.js.map +7 -0
- package/dist/chunks/chunk-6LJNZK4K.js +39 -0
- package/dist/chunks/chunk-6LJNZK4K.js.map +7 -0
- package/dist/chunks/chunk-6ZWEOSEI.js +666 -0
- package/dist/chunks/chunk-6ZWEOSEI.js.map +7 -0
- package/dist/chunks/chunk-77XDJMBP.js +3326 -0
- package/dist/chunks/chunk-77XDJMBP.js.map +7 -0
- package/dist/chunks/chunk-7RRW4NTB.js +6454 -0
- package/dist/chunks/chunk-7RRW4NTB.js.map +7 -0
- package/dist/chunks/chunk-7X3TW4JB.js +4520 -0
- package/dist/chunks/chunk-7X3TW4JB.js.map +7 -0
- package/dist/chunks/chunk-B3MW3YGY.js +1409 -0
- package/dist/chunks/chunk-B3MW3YGY.js.map +7 -0
- package/dist/chunks/chunk-BBJFHTBC.js +28 -0
- package/dist/chunks/chunk-BBJFHTBC.js.map +7 -0
- package/dist/chunks/chunk-BHDHXOXB.js +24 -0
- package/dist/chunks/chunk-BHDHXOXB.js.map +7 -0
- package/dist/{chunk-73WGVYLQ.js → chunks/chunk-BTA7SZ26.js} +152 -223
- package/dist/chunks/chunk-BTA7SZ26.js.map +7 -0
- package/dist/chunks/chunk-CDGRYGPZ.js +103 -0
- package/dist/chunks/chunk-CDGRYGPZ.js.map +7 -0
- package/dist/{chunk-S6HRABTA.js → chunks/chunk-CP6E5UG6.js} +1 -4
- package/dist/chunks/chunk-CP6E5UG6.js.map +7 -0
- package/dist/{chunk-QVLYOPO5.js → chunks/chunk-DQ4JHXMT.js} +462 -424
- package/dist/chunks/chunk-DQ4JHXMT.js.map +7 -0
- package/dist/chunks/chunk-DXD76CMV.js +208 -0
- package/dist/chunks/chunk-DXD76CMV.js.map +7 -0
- package/dist/chunks/chunk-GCQCAXJZ.js +0 -0
- package/dist/chunks/chunk-GELCZWMB.js +42 -0
- package/dist/chunks/chunk-GELCZWMB.js.map +7 -0
- package/dist/{chunk-K2CWOTI2.js → chunks/chunk-HJYOH4HC.js} +23 -18
- package/dist/chunks/chunk-HJYOH4HC.js.map +7 -0
- package/dist/chunks/chunk-HPYNW6TT.js +744 -0
- package/dist/chunks/chunk-HPYNW6TT.js.map +7 -0
- package/dist/{chunk-RZWOUA25.js → chunks/chunk-HRJ3ICQK.js} +59 -55
- package/dist/chunks/chunk-HRJ3ICQK.js.map +7 -0
- package/dist/{chunk-DZE5YA7L.js → chunks/chunk-IFCIADS3.js} +571 -573
- package/dist/chunks/chunk-IFCIADS3.js.map +7 -0
- package/dist/chunks/chunk-IN7XZ7BC.js +27 -0
- package/dist/chunks/chunk-IN7XZ7BC.js.map +7 -0
- package/dist/chunks/chunk-L7P4M4KW.js +193 -0
- package/dist/chunks/chunk-L7P4M4KW.js.map +7 -0
- package/dist/chunks/chunk-LB6TCPDI.js +0 -0
- package/dist/{chunk-3RUXVV4S.js → chunks/chunk-LOCXPQNJ.js} +1 -4
- package/dist/{chunk-3RUXVV4S.js.map → chunks/chunk-LOCXPQNJ.js.map} +2 -2
- package/dist/{chunk-7M2YN6TU.js → chunks/chunk-LOD5ZHCI.js} +213 -208
- package/dist/chunks/chunk-LOD5ZHCI.js.map +7 -0
- package/dist/{chunk-S3J2TLV6.js → chunks/chunk-M7P3QNRU.js} +1 -4
- package/dist/{chunk-S3J2TLV6.js.map → chunks/chunk-M7P3QNRU.js.map} +2 -2
- package/dist/chunks/chunk-PPHLQVL7.js +4234 -0
- package/dist/chunks/chunk-PPHLQVL7.js.map +7 -0
- package/dist/{chunk-ABLVTESJ.js → chunks/chunk-QAXE37B5.js} +1 -4
- package/dist/chunks/chunk-QAXE37B5.js.map +7 -0
- package/dist/chunks/chunk-QHQOBUF6.js +60 -0
- package/dist/chunks/chunk-QHQOBUF6.js.map +7 -0
- package/dist/{chunk-W7GRKO7Q.js → chunks/chunk-RPJXO7GG.js} +241 -214
- package/dist/chunks/chunk-RPJXO7GG.js.map +7 -0
- package/dist/{chunk-NPFOMITO.js → chunks/chunk-SWQV4KSY.js} +1 -4
- package/dist/{chunk-NPFOMITO.js.map → chunks/chunk-SWQV4KSY.js.map} +2 -2
- package/dist/chunks/chunk-SZLAPULP.js +28 -0
- package/dist/chunks/chunk-SZLAPULP.js.map +7 -0
- package/dist/{chunk-7U7L4NMD.js → chunks/chunk-T7RB5V5J.js} +23 -25
- package/dist/chunks/chunk-T7RB5V5J.js.map +7 -0
- package/dist/{chunk-HN4E4UUQ.js → chunks/chunk-TI2CTTMA.js} +25 -17
- package/dist/chunks/chunk-TI2CTTMA.js.map +7 -0
- package/dist/{chunk-ZVDRDPII.js → chunks/chunk-TNGVRTO5.js} +45 -20
- package/dist/chunks/chunk-TNGVRTO5.js.map +7 -0
- package/dist/chunks/chunk-TNWB3U5Y.js +2077 -0
- package/dist/chunks/chunk-TNWB3U5Y.js.map +7 -0
- package/dist/chunks/chunk-U2IHWPCU.js +12 -0
- package/dist/chunks/chunk-U2IHWPCU.js.map +7 -0
- package/dist/{chunk-KAA5BGMQ.js → chunks/chunk-UNOY3VJ2.js} +1 -4
- package/dist/{chunk-KAA5BGMQ.js.map → chunks/chunk-UNOY3VJ2.js.map} +2 -2
- package/dist/{chunk-MWRSY4X6.js → chunks/chunk-UVDJL6ZZ.js} +97 -58
- package/dist/chunks/chunk-UVDJL6ZZ.js.map +7 -0
- package/dist/chunks/chunk-VNCW4C2Z.js +13452 -0
- package/dist/chunks/chunk-VNCW4C2Z.js.map +7 -0
- package/dist/chunks/chunk-W5EGGA44.js +15 -0
- package/dist/chunks/chunk-W5EGGA44.js.map +7 -0
- package/dist/chunks/chunk-XR2W3MAM.js +1533 -0
- package/dist/chunks/chunk-XR2W3MAM.js.map +7 -0
- package/dist/{chunk-STSX7GIX.js → chunks/chunk-YIO5EBMQ.js} +423 -377
- package/dist/chunks/chunk-YIO5EBMQ.js.map +7 -0
- package/dist/chunks/chunk-ZBVLKZ5V.js +1062 -0
- package/dist/chunks/chunk-ZBVLKZ5V.js.map +7 -0
- package/dist/{chunk-E6YNABER.js → chunks/chunk-ZCLTZIVP.js} +1 -4
- package/dist/chunks/chunk-ZCLTZIVP.js.map +7 -0
- package/dist/chunks/client-SILZNM5N.js +42 -0
- package/dist/{config-RUSD6G5Y.js → chunks/config-25HRTPSP.js} +48 -10
- package/dist/chunks/cost-tracker-Z2UZT2J5.js +28 -0
- package/dist/{customCommands-TOIJFZAL.js → chunks/customCommands-TYMYZRG5.js} +11 -8
- package/dist/chunks/engine-MRVF6FK6.js +39 -0
- package/dist/{env-XGKBLU3D.js → chunks/env-TJ5NOBEB.js} +7 -5
- package/dist/{kodeAgentSessionId-X6XWQW7B.js → chunks/kodeAgentSessionId-VTNISJ2L.js} +2 -4
- package/dist/chunks/kodeAgentSessionLoad-YB2RKBGJ.js +15 -0
- package/dist/chunks/kodeAgentSessionResume-DZSIVKVA.js +13 -0
- package/dist/chunks/kodeAgentStreamJson-X5PLS2S6.js +11 -0
- package/dist/{kodeAgentStreamJsonSession-UGEZJJEB.js → chunks/kodeAgentStreamJsonSession-RDXM4XYF.js} +38 -24
- package/dist/chunks/kodeAgentStreamJsonSession-RDXM4XYF.js.map +7 -0
- package/dist/{chunk-4RTX4AG4.js → chunks/kodeAgentStructuredStdio-SVGDSB4P.js} +14 -9
- package/dist/chunks/kodeAgentStructuredStdio-SVGDSB4P.js.map +7 -0
- package/dist/{kodeHooks-QWM36A3D.js → chunks/kodeHooks-RVKYRJHG.js} +11 -9
- package/dist/{llm-ZUQC4WYM.js → chunks/llm-62N6T5ZT.js} +1734 -1526
- package/dist/chunks/llm-62N6T5ZT.js.map +7 -0
- package/dist/chunks/llmLazy-ZUSSE3ZA.js +13 -0
- package/dist/{mentionProcessor-EE3XFHCJ.js → chunks/mentionProcessor-RJW5UPJD.js} +46 -16
- package/dist/chunks/mentionProcessor-RJW5UPJD.js.map +7 -0
- package/dist/{messages-EOYQKPGM.js → chunks/messages-EEWWLPHN.js} +2 -6
- package/dist/chunks/model-5TIEKQPD.js +37 -0
- package/dist/{openai-RRCWW33N.js → chunks/openai-XXK3YZG4.js} +13 -10
- package/dist/{outputStyles-62Q3VH2J.js → chunks/outputStyles-FAJTXN2A.js} +6 -9
- package/dist/chunks/permissions-HO7INPWM.js +27 -0
- package/dist/{pluginRuntime-6ETCZ2LL.js → chunks/pluginRuntime-C7K5ULK2.js} +31 -48
- package/dist/chunks/pluginRuntime-C7K5ULK2.js.map +7 -0
- package/dist/chunks/pluginValidation-DAM7WRTC.js +20 -0
- package/dist/chunks/registry-XYJXMOA5.js +60 -0
- package/dist/chunks/responsesStreaming-JNGE2P3D.js +8 -0
- package/dist/chunks/runNonTextPrintMode-SVBLCZQX.js +577 -0
- package/dist/chunks/runNonTextPrintMode-SVBLCZQX.js.map +7 -0
- package/dist/chunks/server-REXXF5IK.js +46 -0
- package/dist/{skillMarketplace-3RXQBVOL.js → chunks/skillMarketplace-N4HVHNST.js} +8 -6
- package/dist/chunks/src-OROQIWP3.js +44 -0
- package/dist/chunks/src-QXLGGMUW.js +1647 -0
- package/dist/chunks/src-QXLGGMUW.js.map +7 -0
- package/dist/{cli-DOPVY2CW.js → chunks/src-SSDT6MVP.js} +2659 -3384
- package/dist/chunks/src-SSDT6MVP.js.map +7 -0
- package/dist/chunks/theme-YBJUIMWK.js +10 -0
- package/dist/{toolPermissionContext-65L65VEZ.js → chunks/toolPermissionContext-MOCTRR7N.js} +2 -4
- package/dist/chunks/toolPermissionSettings-EV2EJAXL.js +18 -0
- package/dist/chunks/toolPermissionSettings-EV2EJAXL.js.map +7 -0
- package/dist/chunks/uuid-6577SO6X.js +7 -0
- package/dist/chunks/uuid-6577SO6X.js.map +7 -0
- package/dist/chunks/webOnlyMode-ALXX7UQY.js +66 -0
- package/dist/chunks/webOnlyMode-ALXX7UQY.js.map +7 -0
- package/dist/entrypoints/cli.js +10 -0
- package/dist/entrypoints/cli.js.map +7 -0
- package/dist/entrypoints/daemon.js +10 -0
- package/dist/entrypoints/daemon.js.map +7 -0
- package/dist/entrypoints/mcp.js +71 -0
- package/dist/entrypoints/mcp.js.map +7 -0
- package/dist/index.js +6 -7
- package/dist/index.js.map +3 -3
- package/dist/sdk/client.cjs +391 -0
- package/dist/sdk/client.cjs.map +7 -0
- package/dist/sdk/client.js +364 -0
- package/dist/sdk/client.js.map +7 -0
- package/dist/sdk/core.cjs +19932 -0
- package/dist/sdk/core.cjs.map +7 -0
- package/dist/sdk/core.js +19893 -0
- package/dist/sdk/core.js.map +7 -0
- package/dist/sdk/daemon-client.cjs +257 -0
- package/dist/sdk/daemon-client.cjs.map +7 -0
- package/dist/sdk/daemon-client.js +221 -0
- package/dist/sdk/daemon-client.js.map +7 -0
- package/dist/sdk/protocol.cjs +170 -0
- package/dist/sdk/protocol.cjs.map +7 -0
- package/dist/sdk/protocol.js +140 -0
- package/dist/sdk/protocol.js.map +7 -0
- package/dist/sdk/runtime-node.cjs +236 -0
- package/dist/sdk/runtime-node.cjs.map +7 -0
- package/dist/sdk/runtime-node.js +222 -0
- package/dist/sdk/runtime-node.js.map +7 -0
- package/dist/sdk/runtime.cjs +17 -0
- package/dist/sdk/runtime.cjs.map +7 -0
- package/dist/sdk/runtime.js +0 -0
- package/dist/sdk/runtime.js.map +7 -0
- package/dist/sdk/tools.cjs +30300 -0
- package/dist/sdk/tools.cjs.map +7 -0
- package/dist/sdk/tools.js +30282 -0
- package/dist/sdk/tools.js.map +7 -0
- package/dist/webui/assets/index-5hlfByVS.css +1 -0
- package/dist/webui/assets/index-BR9lm1lA.js +82 -0
- package/dist/webui/index.html +28 -0
- package/package.json +93 -22
- package/scripts/binary-utils.cjs +12 -4
- package/scripts/cli-acp-wrapper.cjs +3 -17
- package/scripts/cli-wrapper.cjs +5 -7
- package/scripts/postinstall.js +8 -4
- package/dist/REPL-CW7AYLVL.js +0 -42
- package/dist/acp-VEPJ74LT.js +0 -1357
- package/dist/acp-VEPJ74LT.js.map +0 -7
- package/dist/agentsValidate-7LH4HTNR.js.map +0 -7
- package/dist/ask-3NHFFUQG.js.map +0 -7
- package/dist/autoUpdater-ITPIHCOI.js +0 -17
- package/dist/chunk-3IN27HA5.js.map +0 -7
- package/dist/chunk-4FX3IVPT.js +0 -164
- package/dist/chunk-4FX3IVPT.js.map +0 -7
- package/dist/chunk-4RTX4AG4.js.map +0 -7
- package/dist/chunk-5PDP7R6N.js +0 -515
- package/dist/chunk-5PDP7R6N.js.map +0 -7
- package/dist/chunk-73WGVYLQ.js.map +0 -7
- package/dist/chunk-7M2YN6TU.js.map +0 -7
- package/dist/chunk-7U7L4NMD.js.map +0 -7
- package/dist/chunk-ABLVTESJ.js.map +0 -7
- package/dist/chunk-AFFSCMYS.js.map +0 -7
- package/dist/chunk-ARZSBOAO.js.map +0 -7
- package/dist/chunk-CIG63V4E.js +0 -72
- package/dist/chunk-CIG63V4E.js.map +0 -7
- package/dist/chunk-CM3EGTG6.js +0 -1609
- package/dist/chunk-CM3EGTG6.js.map +0 -7
- package/dist/chunk-DZE5YA7L.js.map +0 -7
- package/dist/chunk-E6YNABER.js.map +0 -7
- package/dist/chunk-EZXMVTDU.js.map +0 -7
- package/dist/chunk-F2SJXUDI.js +0 -148
- package/dist/chunk-F2SJXUDI.js.map +0 -7
- package/dist/chunk-FC5ZCKBI.js +0 -30167
- package/dist/chunk-FC5ZCKBI.js.map +0 -7
- package/dist/chunk-HCBELH4J.js +0 -145
- package/dist/chunk-HCBELH4J.js.map +0 -7
- package/dist/chunk-HN4E4UUQ.js.map +0 -7
- package/dist/chunk-IZVMU4S2.js +0 -654
- package/dist/chunk-IZVMU4S2.js.map +0 -7
- package/dist/chunk-K2CWOTI2.js.map +0 -7
- package/dist/chunk-LC4TVOCZ.js +0 -835
- package/dist/chunk-LC4TVOCZ.js.map +0 -7
- package/dist/chunk-MIW7N2MY.js +0 -2613
- package/dist/chunk-MIW7N2MY.js.map +0 -7
- package/dist/chunk-MWRSY4X6.js.map +0 -7
- package/dist/chunk-ND3XWFO6.js +0 -34
- package/dist/chunk-ND3XWFO6.js.map +0 -7
- package/dist/chunk-QVLYOPO5.js.map +0 -7
- package/dist/chunk-RZWOUA25.js.map +0 -7
- package/dist/chunk-S6HRABTA.js.map +0 -7
- package/dist/chunk-STSX7GIX.js.map +0 -7
- package/dist/chunk-UHYRLID6.js.map +0 -7
- package/dist/chunk-UKHTVRJM.js +0 -47
- package/dist/chunk-UKHTVRJM.js.map +0 -7
- package/dist/chunk-UYXEDKOZ.js +0 -24
- package/dist/chunk-UYXEDKOZ.js.map +0 -7
- package/dist/chunk-W7GRKO7Q.js.map +0 -7
- package/dist/chunk-WVHORZQ5.js +0 -17
- package/dist/chunk-WVHORZQ5.js.map +0 -7
- package/dist/chunk-WWUWDNWW.js +0 -49
- package/dist/chunk-WWUWDNWW.js.map +0 -7
- package/dist/chunk-YC6LJCDE.js.map +0 -7
- package/dist/chunk-YXYYDIMI.js +0 -2931
- package/dist/chunk-YXYYDIMI.js.map +0 -7
- package/dist/chunk-ZVDRDPII.js.map +0 -7
- package/dist/cli-DOPVY2CW.js.map +0 -7
- package/dist/commands-2BF2CJ3A.js +0 -46
- package/dist/context-6FXPETYH.js +0 -30
- package/dist/costTracker-6SL26FDB.js +0 -19
- package/dist/kodeAgentSessionLoad-MITZADPB.js +0 -18
- package/dist/kodeAgentSessionResume-GVRWB4WO.js +0 -16
- package/dist/kodeAgentStreamJson-NXFN7TXH.js +0 -13
- package/dist/kodeAgentStreamJsonSession-UGEZJJEB.js.map +0 -7
- package/dist/kodeAgentStructuredStdio-HGWJT7CU.js +0 -10
- package/dist/llm-ZUQC4WYM.js.map +0 -7
- package/dist/llmLazy-54QQHA54.js +0 -15
- package/dist/loader-FYHJQES5.js +0 -28
- package/dist/mcp-J332IKT3.js +0 -49
- package/dist/mentionProcessor-EE3XFHCJ.js.map +0 -7
- package/dist/model-FV3JDJKH.js +0 -30
- package/dist/pluginRuntime-6ETCZ2LL.js.map +0 -7
- package/dist/pluginValidation-I4YKUWGS.js +0 -17
- package/dist/prompts-ZLEKDD77.js +0 -48
- package/dist/query-VFRJPBGD.js +0 -50
- package/dist/responsesStreaming-AW344PQO.js +0 -10
- package/dist/ripgrep-3NTIKQYW.js +0 -17
- package/dist/state-P5G6CO5V.js +0 -16
- package/dist/theme-3LWP3BG7.js +0 -14
- package/dist/toolPermissionSettings-3ROBVTUK.js +0 -18
- package/dist/tools-RO7HSSE5.js +0 -47
- package/dist/userInput-JSBJRFSK.js +0 -311
- package/dist/userInput-JSBJRFSK.js.map +0 -7
- package/dist/uuid-QN2CNKKN.js +0 -9
- /package/dist/{REPL-CW7AYLVL.js.map → chunks/Doctor-M3J7GRTJ.js.map} +0 -0
- /package/dist/{autoUpdater-ITPIHCOI.js.map → chunks/REPL-RQ6LO6S7.js.map} +0 -0
- /package/dist/{chunk-JC6NCUG5.js.map → chunks/ResumeConversation-6DMVBEGH.js.map} +0 -0
- /package/dist/{commands-2BF2CJ3A.js.map → chunks/agentLoader-FCRG3TFJ.js.map} +0 -0
- /package/dist/{config-RUSD6G5Y.js.map → chunks/autoUpdater-CNESBOKO.js.map} +0 -0
- /package/dist/{context-6FXPETYH.js.map → chunks/chunk-4CRUCZR4.js.map} +0 -0
- /package/dist/{costTracker-6SL26FDB.js.map → chunks/chunk-54KOYG5C.js.map} +0 -0
- /package/dist/{customCommands-TOIJFZAL.js.map → chunks/chunk-GCQCAXJZ.js.map} +0 -0
- /package/dist/{env-XGKBLU3D.js.map → chunks/chunk-LB6TCPDI.js.map} +0 -0
- /package/dist/{kodeAgentSessionId-X6XWQW7B.js.map → chunks/client-SILZNM5N.js.map} +0 -0
- /package/dist/{kodeAgentSessionLoad-MITZADPB.js.map → chunks/config-25HRTPSP.js.map} +0 -0
- /package/dist/{kodeAgentSessionResume-GVRWB4WO.js.map → chunks/cost-tracker-Z2UZT2J5.js.map} +0 -0
- /package/dist/{kodeAgentStreamJson-NXFN7TXH.js.map → chunks/customCommands-TYMYZRG5.js.map} +0 -0
- /package/dist/{kodeAgentStructuredStdio-HGWJT7CU.js.map → chunks/engine-MRVF6FK6.js.map} +0 -0
- /package/dist/{kodeHooks-QWM36A3D.js.map → chunks/env-TJ5NOBEB.js.map} +0 -0
- /package/dist/{llmLazy-54QQHA54.js.map → chunks/kodeAgentSessionId-VTNISJ2L.js.map} +0 -0
- /package/dist/{loader-FYHJQES5.js.map → chunks/kodeAgentSessionLoad-YB2RKBGJ.js.map} +0 -0
- /package/dist/{mcp-J332IKT3.js.map → chunks/kodeAgentSessionResume-DZSIVKVA.js.map} +0 -0
- /package/dist/{messages-EOYQKPGM.js.map → chunks/kodeAgentStreamJson-X5PLS2S6.js.map} +0 -0
- /package/dist/{model-FV3JDJKH.js.map → chunks/kodeHooks-RVKYRJHG.js.map} +0 -0
- /package/dist/{openai-RRCWW33N.js.map → chunks/llmLazy-ZUSSE3ZA.js.map} +0 -0
- /package/dist/{outputStyles-62Q3VH2J.js.map → chunks/messages-EEWWLPHN.js.map} +0 -0
- /package/dist/{pluginValidation-I4YKUWGS.js.map → chunks/model-5TIEKQPD.js.map} +0 -0
- /package/dist/{prompts-ZLEKDD77.js.map → chunks/openai-XXK3YZG4.js.map} +0 -0
- /package/dist/{query-VFRJPBGD.js.map → chunks/outputStyles-FAJTXN2A.js.map} +0 -0
- /package/dist/{responsesStreaming-AW344PQO.js.map → chunks/permissions-HO7INPWM.js.map} +0 -0
- /package/dist/{ripgrep-3NTIKQYW.js.map → chunks/pluginValidation-DAM7WRTC.js.map} +0 -0
- /package/dist/{skillMarketplace-3RXQBVOL.js.map → chunks/registry-XYJXMOA5.js.map} +0 -0
- /package/dist/{state-P5G6CO5V.js.map → chunks/responsesStreaming-JNGE2P3D.js.map} +0 -0
- /package/dist/{theme-3LWP3BG7.js.map → chunks/server-REXXF5IK.js.map} +0 -0
- /package/dist/{toolPermissionContext-65L65VEZ.js.map → chunks/skillMarketplace-N4HVHNST.js.map} +0 -0
- /package/dist/{toolPermissionSettings-3ROBVTUK.js.map → chunks/src-OROQIWP3.js.map} +0 -0
- /package/dist/{tools-RO7HSSE5.js.map → chunks/theme-YBJUIMWK.js.map} +0 -0
- /package/dist/{uuid-QN2CNKKN.js.map → chunks/toolPermissionContext-MOCTRR7N.js.map} +0 -0
|
@@ -1,33 +1,107 @@
|
|
|
1
|
-
import { createRequire as __kodeCreateRequire } from "node:module";
|
|
2
|
-
const require = __kodeCreateRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
isSettingSourceEnabled
|
|
5
|
-
} from "./chunk-UKHTVRJM.js";
|
|
6
1
|
import {
|
|
7
2
|
getSessionPlugins
|
|
8
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M7P3QNRU.js";
|
|
9
4
|
import {
|
|
10
5
|
debug
|
|
11
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YIO5EBMQ.js";
|
|
12
7
|
import {
|
|
13
|
-
getCwd,
|
|
14
8
|
logError
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
|
|
17
|
-
// src/utils/agent/loader.ts
|
|
9
|
+
} from "./chunk-3OEJVB5A.js";
|
|
18
10
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import yaml from "js-yaml";
|
|
11
|
+
getCwd
|
|
12
|
+
} from "./chunk-BBJFHTBC.js";
|
|
13
|
+
import {
|
|
14
|
+
isSettingSourceEnabled
|
|
15
|
+
} from "./chunk-XR2W3MAM.js";
|
|
16
|
+
|
|
17
|
+
// packages/core/src/agent/loader.ts
|
|
18
|
+
import { existsSync as existsSync2, statSync as statSync2, watch } from "fs";
|
|
19
|
+
import { join as join2 } from "path";
|
|
29
20
|
import { memoize } from "lodash-es";
|
|
30
|
-
|
|
21
|
+
|
|
22
|
+
// packages/core/src/agent/builtin.ts
|
|
23
|
+
var BUILTIN_GENERAL_PURPOSE = {
|
|
24
|
+
agentType: "general-purpose",
|
|
25
|
+
whenToUse: "General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks",
|
|
26
|
+
tools: "*",
|
|
27
|
+
systemPrompt: `You are a general-purpose agent. Given the user's task, use the tools available to complete it efficiently and thoroughly.
|
|
28
|
+
|
|
29
|
+
When to use your capabilities:
|
|
30
|
+
- Searching for code, configurations, and patterns across large codebases
|
|
31
|
+
- Analyzing multiple files to understand system architecture
|
|
32
|
+
- Investigating complex questions that require exploring many files
|
|
33
|
+
- Performing multi-step research tasks
|
|
34
|
+
|
|
35
|
+
Guidelines:
|
|
36
|
+
- For file searches: Use Grep or Glob when you need to search broadly. Use FileRead when you know the specific file path.
|
|
37
|
+
- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
|
|
38
|
+
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
|
|
39
|
+
- Complete tasks directly using your capabilities.`,
|
|
40
|
+
source: "built-in",
|
|
41
|
+
location: "built-in",
|
|
42
|
+
baseDir: "built-in"
|
|
43
|
+
};
|
|
44
|
+
var BUILTIN_EXPLORE = {
|
|
45
|
+
agentType: "Explore",
|
|
46
|
+
whenToUse: 'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.',
|
|
47
|
+
tools: "*",
|
|
48
|
+
disallowedTools: ["Task", "ExitPlanMode", "Edit", "Write", "NotebookEdit"],
|
|
49
|
+
systemPrompt: "You are an agent specialized for exploring codebases quickly and efficiently. Focus on fast, targeted searches and high-signal summaries.",
|
|
50
|
+
source: "built-in",
|
|
51
|
+
location: "built-in",
|
|
52
|
+
baseDir: "built-in"
|
|
53
|
+
};
|
|
54
|
+
var BUILTIN_PLAN = {
|
|
55
|
+
agentType: "Plan",
|
|
56
|
+
whenToUse: "Agent specialized for producing high quality plans before execution.",
|
|
57
|
+
tools: "*",
|
|
58
|
+
disallowedTools: ["Task", "ExitPlanMode", "Edit", "Write", "NotebookEdit"],
|
|
59
|
+
systemPrompt: "You are an agent specialized for planning. Produce a clear, actionable step-by-step plan, then stop.",
|
|
60
|
+
source: "built-in",
|
|
61
|
+
location: "built-in",
|
|
62
|
+
baseDir: "built-in"
|
|
63
|
+
};
|
|
64
|
+
var BUILTIN_STATUSLINE_SETUP = {
|
|
65
|
+
agentType: "StatuslineSetup",
|
|
66
|
+
whenToUse: "Agent specialized for configuring the CLI status line command.",
|
|
67
|
+
tools: ["Read", "Edit", "Bash"],
|
|
68
|
+
systemPrompt: `You are the status line setup agent.
|
|
69
|
+
|
|
70
|
+
Your job is to configure a fast, single-line status command for the CLI UI.
|
|
71
|
+
|
|
72
|
+
Requirements:
|
|
73
|
+
- Write/update the user's ~/.kode/settings.json and set the top-level key "statusLine" to a shell command string.
|
|
74
|
+
- IMPORTANT: When using Read/Edit tools, use absolute paths (do not pass "~" to tool inputs).
|
|
75
|
+
- The command must be quick (ideally <200ms), produce a single line, and be safe to run repeatedly.
|
|
76
|
+
- Prefer using information that is generally available: current directory, git branch/dirty state, etc.
|
|
77
|
+
- If you can't infer the user's preferred status info from their shell config, ask them what they want and propose a reasonable default.
|
|
78
|
+
|
|
79
|
+
Suggested approach:
|
|
80
|
+
1) Inspect common shell config files (Read):
|
|
81
|
+
- macOS/Linux: ~/.zshrc, ~/.bashrc, ~/.config/fish/config.fish
|
|
82
|
+
- Windows: consider PowerShell profile if the user provides its location
|
|
83
|
+
2) Propose a statusLine command:
|
|
84
|
+
- macOS/Linux: e.g. a small sh snippet that prints cwd basename and git branch if present
|
|
85
|
+
- Windows: e.g. a short PowerShell one-liner that prints similar info
|
|
86
|
+
3) Update ~/.kode/settings.json:
|
|
87
|
+
- If the file does not exist, create it as a minimal JSON object.
|
|
88
|
+
- Preserve unrelated fields if present.
|
|
89
|
+
4) Reply with the exact command you set and how the user can change/remove it later.`,
|
|
90
|
+
source: "built-in",
|
|
91
|
+
location: "built-in",
|
|
92
|
+
baseDir: "built-in"
|
|
93
|
+
};
|
|
94
|
+
var BUILTIN_AGENTS = [
|
|
95
|
+
BUILTIN_GENERAL_PURPOSE,
|
|
96
|
+
BUILTIN_STATUSLINE_SETUP,
|
|
97
|
+
BUILTIN_EXPLORE,
|
|
98
|
+
BUILTIN_PLAN
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
// packages/core/src/agent/storage.ts
|
|
102
|
+
import { existsSync, readdirSync, statSync } from "fs";
|
|
103
|
+
import { dirname, join, resolve } from "path";
|
|
104
|
+
import { homedir } from "os";
|
|
31
105
|
function getClaudePolicyBaseDir() {
|
|
32
106
|
switch (process.platform) {
|
|
33
107
|
case "darwin":
|
|
@@ -94,10 +168,7 @@ function listMarkdownFilesRecursively(rootDir) {
|
|
|
94
168
|
visitedDirs.add(dirKey);
|
|
95
169
|
let entries;
|
|
96
170
|
try {
|
|
97
|
-
entries = readdirSync(dirPath, {
|
|
98
|
-
withFileTypes: true,
|
|
99
|
-
encoding: "utf8"
|
|
100
|
-
});
|
|
171
|
+
entries = readdirSync(dirPath, { withFileTypes: true });
|
|
101
172
|
} catch {
|
|
102
173
|
return;
|
|
103
174
|
}
|
|
@@ -130,20 +201,36 @@ function listMarkdownFilesRecursively(rootDir) {
|
|
|
130
201
|
walk(rootDir);
|
|
131
202
|
return files;
|
|
132
203
|
}
|
|
204
|
+
|
|
205
|
+
// packages/core/src/agent/validator.ts
|
|
206
|
+
import { readFileSync } from "fs";
|
|
207
|
+
import { basename } from "path";
|
|
208
|
+
import matter from "gray-matter";
|
|
209
|
+
import yaml from "js-yaml";
|
|
210
|
+
import { z } from "zod";
|
|
211
|
+
function asRecord(value) {
|
|
212
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
213
|
+
return value;
|
|
214
|
+
}
|
|
215
|
+
var yamlSchema = yaml.JSON_SCHEMA;
|
|
133
216
|
function readMarkdownFile(filePath) {
|
|
134
217
|
try {
|
|
135
218
|
const raw = readFileSync(filePath, "utf8");
|
|
136
|
-
const
|
|
137
|
-
const matterOptions = {
|
|
219
|
+
const parsed = matter(raw, {
|
|
138
220
|
engines: {
|
|
139
221
|
yaml: {
|
|
140
|
-
parse: (input) =>
|
|
222
|
+
parse: (input) => {
|
|
223
|
+
const loaded = yaml.load(
|
|
224
|
+
input,
|
|
225
|
+
yamlSchema ? { schema: yamlSchema } : void 0
|
|
226
|
+
);
|
|
227
|
+
return asRecord(loaded) ?? {};
|
|
228
|
+
}
|
|
141
229
|
}
|
|
142
230
|
}
|
|
143
|
-
};
|
|
144
|
-
const parsed = matter(raw, matterOptions);
|
|
231
|
+
});
|
|
145
232
|
return {
|
|
146
|
-
frontmatter: parsed.data ?? {},
|
|
233
|
+
frontmatter: asRecord(parsed.data) ?? {},
|
|
147
234
|
content: String(parsed.content ?? "")
|
|
148
235
|
};
|
|
149
236
|
} catch {
|
|
@@ -245,8 +332,8 @@ function parseAgentFromFile(options) {
|
|
|
245
332
|
if (!parsed) return null;
|
|
246
333
|
try {
|
|
247
334
|
const fm = parsed.frontmatter ?? {};
|
|
248
|
-
|
|
249
|
-
|
|
335
|
+
const name = fm.name;
|
|
336
|
+
const description = fm.description;
|
|
250
337
|
if (!name || typeof name !== "string" || !description || typeof description !== "string") {
|
|
251
338
|
return null;
|
|
252
339
|
}
|
|
@@ -275,7 +362,9 @@ function parseAgentFromFile(options) {
|
|
|
275
362
|
model = "inherit";
|
|
276
363
|
}
|
|
277
364
|
const permissionModeValue = fm.permissionMode;
|
|
278
|
-
const permissionModeIsValid = typeof permissionModeValue === "string" && VALID_PERMISSION_MODES.includes(
|
|
365
|
+
const permissionModeIsValid = typeof permissionModeValue === "string" && VALID_PERMISSION_MODES.includes(
|
|
366
|
+
permissionModeValue
|
|
367
|
+
);
|
|
279
368
|
if (typeof permissionModeValue === "string" && permissionModeValue && !permissionModeIsValid) {
|
|
280
369
|
debug.warn("AGENT_LOADER_INVALID_PERMISSION_MODE", {
|
|
281
370
|
filePath: options.filePath,
|
|
@@ -337,13 +426,7 @@ function parseAgentFromJson(agentType, value) {
|
|
|
337
426
|
...parsed.data.permissionMode ? { permissionMode: parsed.data.permissionMode } : {}
|
|
338
427
|
};
|
|
339
428
|
}
|
|
340
|
-
|
|
341
|
-
function setFlagAgentsFromCliJson(json) {
|
|
342
|
-
if (!json) {
|
|
343
|
-
FLAG_AGENTS = [];
|
|
344
|
-
clearAgentCache();
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
429
|
+
function parseFlagAgentsFromCliJson(json) {
|
|
347
430
|
let raw;
|
|
348
431
|
try {
|
|
349
432
|
raw = JSON.parse(json);
|
|
@@ -352,9 +435,7 @@ function setFlagAgentsFromCliJson(json) {
|
|
|
352
435
|
debug.warn("AGENT_LOADER_FLAG_AGENTS_JSON_PARSE_FAILED", {
|
|
353
436
|
error: err instanceof Error ? err.message : String(err)
|
|
354
437
|
});
|
|
355
|
-
|
|
356
|
-
clearAgentCache();
|
|
357
|
-
return;
|
|
438
|
+
return [];
|
|
358
439
|
}
|
|
359
440
|
const parsed = agentsJsonSchema.safeParse(raw);
|
|
360
441
|
if (!parsed.success) {
|
|
@@ -362,169 +443,22 @@ function setFlagAgentsFromCliJson(json) {
|
|
|
362
443
|
debug.warn("AGENT_LOADER_FLAG_AGENTS_SCHEMA_INVALID", {
|
|
363
444
|
error: parsed.error.message
|
|
364
445
|
});
|
|
446
|
+
return [];
|
|
447
|
+
}
|
|
448
|
+
return Object.entries(parsed.data).map(([agentType, value]) => parseAgentFromJson(agentType, value)).filter((agent) => agent !== null);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// packages/core/src/agent/loader.ts
|
|
452
|
+
var FLAG_AGENTS = [];
|
|
453
|
+
function setFlagAgentsFromCliJson(json) {
|
|
454
|
+
if (!json) {
|
|
365
455
|
FLAG_AGENTS = [];
|
|
366
456
|
clearAgentCache();
|
|
367
457
|
return;
|
|
368
458
|
}
|
|
369
|
-
FLAG_AGENTS =
|
|
459
|
+
FLAG_AGENTS = parseFlagAgentsFromCliJson(json);
|
|
370
460
|
clearAgentCache();
|
|
371
461
|
}
|
|
372
|
-
var BUILTIN_GENERAL_PURPOSE = {
|
|
373
|
-
agentType: "general-purpose",
|
|
374
|
-
whenToUse: "General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks",
|
|
375
|
-
tools: "*",
|
|
376
|
-
systemPrompt: `You are a general-purpose agent. Given the user's task, use the tools available to complete it efficiently and thoroughly.
|
|
377
|
-
|
|
378
|
-
When to use your capabilities:
|
|
379
|
-
- Searching for code, configurations, and patterns across large codebases
|
|
380
|
-
- Analyzing multiple files to understand system architecture
|
|
381
|
-
- Investigating complex questions that require exploring many files
|
|
382
|
-
- Performing multi-step research tasks
|
|
383
|
-
|
|
384
|
-
Guidelines:
|
|
385
|
-
- For file searches: Use Grep or Glob when you need to search broadly. Use FileRead when you know the specific file path.
|
|
386
|
-
- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
|
|
387
|
-
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
|
|
388
|
-
- Complete tasks directly using your capabilities.`,
|
|
389
|
-
source: "built-in",
|
|
390
|
-
location: "built-in",
|
|
391
|
-
baseDir: "built-in"
|
|
392
|
-
};
|
|
393
|
-
var BUILTIN_EXPLORE = {
|
|
394
|
-
agentType: "Explore",
|
|
395
|
-
whenToUse: 'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.',
|
|
396
|
-
tools: "*",
|
|
397
|
-
disallowedTools: ["Task", "ExitPlanMode", "Edit", "Write", "NotebookEdit"],
|
|
398
|
-
model: "haiku",
|
|
399
|
-
systemPrompt: `You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
|
|
400
|
-
|
|
401
|
-
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
402
|
-
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
|
|
403
|
-
- Creating new files (no Write, touch, or file creation of any kind)
|
|
404
|
-
- Modifying existing files (no Edit operations)
|
|
405
|
-
- Deleting files (no rm or deletion)
|
|
406
|
-
- Moving or copying files (no mv or cp)
|
|
407
|
-
- Creating temporary files anywhere, including /tmp
|
|
408
|
-
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
409
|
-
- Running ANY commands that change system state
|
|
410
|
-
|
|
411
|
-
Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
412
|
-
|
|
413
|
-
Your strengths:
|
|
414
|
-
- Rapidly finding files using glob patterns
|
|
415
|
-
- Searching code and text with powerful regex patterns
|
|
416
|
-
- Reading and analyzing file contents
|
|
417
|
-
|
|
418
|
-
Guidelines:
|
|
419
|
-
- Use Glob for broad file pattern matching
|
|
420
|
-
- Use Grep for searching file contents with regex
|
|
421
|
-
- Use Read when you know the specific file path you need to read
|
|
422
|
-
- Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
|
|
423
|
-
- NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
424
|
-
- Adapt your search approach based on the thoroughness level specified by the caller
|
|
425
|
-
- Return file paths as absolute paths in your final response
|
|
426
|
-
- For clear communication, avoid using emojis
|
|
427
|
-
- Communicate your final report directly as a regular message - do NOT attempt to create files
|
|
428
|
-
|
|
429
|
-
NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
|
|
430
|
-
- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
|
|
431
|
-
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
|
|
432
|
-
|
|
433
|
-
Complete the user's search request efficiently and report your findings clearly.`,
|
|
434
|
-
source: "built-in",
|
|
435
|
-
location: "built-in",
|
|
436
|
-
baseDir: "built-in"
|
|
437
|
-
};
|
|
438
|
-
var BUILTIN_PLAN = {
|
|
439
|
-
agentType: "Plan",
|
|
440
|
-
whenToUse: "Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs.",
|
|
441
|
-
tools: "*",
|
|
442
|
-
disallowedTools: ["Task", "ExitPlanMode", "Edit", "Write", "NotebookEdit"],
|
|
443
|
-
model: "inherit",
|
|
444
|
-
systemPrompt: `You are a software architect and planning specialist. Your role is to explore the codebase and design implementation plans.
|
|
445
|
-
|
|
446
|
-
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
447
|
-
This is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:
|
|
448
|
-
- Creating new files (no Write, touch, or file creation of any kind)
|
|
449
|
-
- Modifying existing files (no Edit operations)
|
|
450
|
-
- Deleting files (no rm or deletion)
|
|
451
|
-
- Moving or copying files (no mv or cp)
|
|
452
|
-
- Creating temporary files anywhere, including /tmp
|
|
453
|
-
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
454
|
-
- Running ANY commands that change system state
|
|
455
|
-
|
|
456
|
-
Your role is EXCLUSIVELY to explore the codebase and design implementation plans. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
457
|
-
|
|
458
|
-
You will be provided with a set of requirements and optionally a perspective on how to approach the design process.
|
|
459
|
-
|
|
460
|
-
## Your Process
|
|
461
|
-
|
|
462
|
-
1. **Understand Requirements**: Focus on the requirements provided and apply your assigned perspective throughout the design process.
|
|
463
|
-
|
|
464
|
-
2. **Explore Thoroughly**:
|
|
465
|
-
- Read any files provided to you in the initial prompt
|
|
466
|
-
- Find existing patterns and conventions using Glob, Grep, and Read
|
|
467
|
-
- Understand the current architecture
|
|
468
|
-
- Identify similar features as reference
|
|
469
|
-
- Trace through relevant code paths
|
|
470
|
-
- Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
|
|
471
|
-
- NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
472
|
-
|
|
473
|
-
3. **Design Solution**:
|
|
474
|
-
- Create implementation approach based on your assigned perspective
|
|
475
|
-
- Consider trade-offs and architectural decisions
|
|
476
|
-
- Follow existing patterns where appropriate
|
|
477
|
-
|
|
478
|
-
4. **Detail the Plan**:
|
|
479
|
-
- Provide step-by-step implementation strategy
|
|
480
|
-
- Identify dependencies and sequencing
|
|
481
|
-
- Anticipate potential challenges
|
|
482
|
-
|
|
483
|
-
## Required Output
|
|
484
|
-
|
|
485
|
-
End your response with:
|
|
486
|
-
|
|
487
|
-
### Critical Files for Implementation
|
|
488
|
-
List 3-5 files most critical for implementing this plan:
|
|
489
|
-
- path/to/file1.ts - [Brief reason: e.g., "Core logic to modify"]
|
|
490
|
-
- path/to/file2.ts - [Brief reason: e.g., "Interfaces to implement"]
|
|
491
|
-
- path/to/file3.ts - [Brief reason: e.g., "Pattern to follow"]
|
|
492
|
-
|
|
493
|
-
REMEMBER: You can ONLY explore and plan. You CANNOT and MUST NOT write, edit, or modify any files. You do NOT have access to file editing tools.`,
|
|
494
|
-
source: "built-in",
|
|
495
|
-
location: "built-in",
|
|
496
|
-
baseDir: "built-in"
|
|
497
|
-
};
|
|
498
|
-
var BUILTIN_STATUSLINE_SETUP = {
|
|
499
|
-
agentType: "statusline-setup",
|
|
500
|
-
whenToUse: "Set up the CLI status line command (writes to ~/.kode/settings.json statusLine). Use when the user runs /statusline.",
|
|
501
|
-
tools: ["Read", "Edit", "Bash"],
|
|
502
|
-
systemPrompt: `You are the status line setup agent.
|
|
503
|
-
|
|
504
|
-
Your job is to configure a fast, single-line status command for the CLI UI.
|
|
505
|
-
|
|
506
|
-
Requirements:
|
|
507
|
-
- Write/update the user's ~/.kode/settings.json and set the top-level key "statusLine" to a shell command string.
|
|
508
|
-
- IMPORTANT: When using Read/Edit tools, use absolute paths (do not pass "~" to tool inputs).
|
|
509
|
-
- The command must be quick (ideally <200ms), produce a single line, and be safe to run repeatedly.
|
|
510
|
-
- Prefer using information that is generally available: current directory, git branch/dirty state, etc.
|
|
511
|
-
- If you can't infer the user's preferred status info from their shell config, ask them what they want and propose a reasonable default.
|
|
512
|
-
|
|
513
|
-
Suggested approach:
|
|
514
|
-
1) Inspect common shell config files (Read):
|
|
515
|
-
- macOS/Linux: ~/.zshrc, ~/.bashrc, ~/.config/fish/config.fish
|
|
516
|
-
- Windows: consider PowerShell profile if the user provides its location
|
|
517
|
-
2) Propose a statusLine command:
|
|
518
|
-
- macOS/Linux: e.g. a small sh snippet that prints cwd basename and git branch if present
|
|
519
|
-
- Windows: e.g. a short PowerShell one-liner that prints similar info
|
|
520
|
-
3) Update ~/.kode/settings.json:
|
|
521
|
-
- If the file does not exist, create it as a minimal JSON object.
|
|
522
|
-
- Preserve unrelated fields if present.
|
|
523
|
-
4) Reply with the exact command you set and how the user can change/remove it later.`,
|
|
524
|
-
source: "built-in",
|
|
525
|
-
location: "built-in",
|
|
526
|
-
baseDir: "built-in"
|
|
527
|
-
};
|
|
528
462
|
function mergeAgents(allAgents) {
|
|
529
463
|
const builtIn = allAgents.filter((a) => a.source === "built-in");
|
|
530
464
|
const plugin = allAgents.filter((a) => a.source === "plugin");
|
|
@@ -543,11 +477,8 @@ function mergeAgents(allAgents) {
|
|
|
543
477
|
}
|
|
544
478
|
function inodeKeyForPath(filePath) {
|
|
545
479
|
try {
|
|
546
|
-
const st =
|
|
547
|
-
|
|
548
|
-
return `${st.dev}:${st.ino}`;
|
|
549
|
-
}
|
|
550
|
-
return null;
|
|
480
|
+
const st = statSync2(filePath);
|
|
481
|
+
return `${st.dev}:${st.ino}`;
|
|
551
482
|
} catch {
|
|
552
483
|
return null;
|
|
553
484
|
}
|
|
@@ -571,7 +502,7 @@ function scanAgentPaths(options) {
|
|
|
571
502
|
};
|
|
572
503
|
let st;
|
|
573
504
|
try {
|
|
574
|
-
st =
|
|
505
|
+
st = statSync2(options.dirPathOrFile);
|
|
575
506
|
} catch {
|
|
576
507
|
return [];
|
|
577
508
|
}
|
|
@@ -586,12 +517,6 @@ function scanAgentPaths(options) {
|
|
|
586
517
|
return out;
|
|
587
518
|
}
|
|
588
519
|
async function loadAllAgents() {
|
|
589
|
-
const builtinAgents = [
|
|
590
|
-
BUILTIN_GENERAL_PURPOSE,
|
|
591
|
-
BUILTIN_STATUSLINE_SETUP,
|
|
592
|
-
BUILTIN_EXPLORE,
|
|
593
|
-
BUILTIN_PLAN
|
|
594
|
-
];
|
|
595
520
|
const seenInodes = /* @__PURE__ */ new Map();
|
|
596
521
|
const sessionPlugins = getSessionPlugins();
|
|
597
522
|
const pluginAgentDirs = sessionPlugins.flatMap((p) => p.agentsDirs ?? []);
|
|
@@ -603,7 +528,7 @@ async function loadAllAgents() {
|
|
|
603
528
|
seenInodes
|
|
604
529
|
})
|
|
605
530
|
);
|
|
606
|
-
const policyAgentsDir =
|
|
531
|
+
const policyAgentsDir = join2(getClaudePolicyBaseDir(), ".claude", "agents");
|
|
607
532
|
const policyAgents = scanAgentPaths({
|
|
608
533
|
dirPathOrFile: policyAgentsDir,
|
|
609
534
|
baseDir: policyAgentsDir,
|
|
@@ -613,7 +538,7 @@ async function loadAllAgents() {
|
|
|
613
538
|
const userAgents = [];
|
|
614
539
|
if (isSettingSourceEnabled("userSettings")) {
|
|
615
540
|
for (const root of getUserConfigRoots()) {
|
|
616
|
-
const dir =
|
|
541
|
+
const dir = join2(root, "agents");
|
|
617
542
|
userAgents.push(
|
|
618
543
|
...scanAgentPaths({
|
|
619
544
|
dirPathOrFile: dir,
|
|
@@ -639,7 +564,7 @@ async function loadAllAgents() {
|
|
|
639
564
|
}
|
|
640
565
|
}
|
|
641
566
|
const allAgents = [
|
|
642
|
-
...
|
|
567
|
+
...BUILTIN_AGENTS,
|
|
643
568
|
...pluginAgents,
|
|
644
569
|
...userAgents,
|
|
645
570
|
...projectAgents,
|
|
@@ -677,10 +602,10 @@ var watchers = [];
|
|
|
677
602
|
async function startAgentWatcher(onChange) {
|
|
678
603
|
await stopAgentWatcher();
|
|
679
604
|
const watchDirs = [];
|
|
680
|
-
watchDirs.push(
|
|
605
|
+
watchDirs.push(join2(getClaudePolicyBaseDir(), ".claude", "agents"));
|
|
681
606
|
if (isSettingSourceEnabled("userSettings")) {
|
|
682
607
|
for (const root of getUserConfigRoots()) {
|
|
683
|
-
watchDirs.push(
|
|
608
|
+
watchDirs.push(join2(root, "agents"));
|
|
684
609
|
}
|
|
685
610
|
}
|
|
686
611
|
if (isSettingSourceEnabled("projectSettings")) {
|
|
@@ -692,12 +617,12 @@ async function startAgentWatcher(onChange) {
|
|
|
692
617
|
}
|
|
693
618
|
}
|
|
694
619
|
for (const dirPath of dedupeStrings(watchDirs)) {
|
|
695
|
-
if (!
|
|
620
|
+
if (!existsSync2(dirPath)) continue;
|
|
696
621
|
try {
|
|
697
622
|
const watcher = watch(
|
|
698
623
|
dirPath,
|
|
699
624
|
{ recursive: false },
|
|
700
|
-
|
|
625
|
+
(_eventType, filename) => {
|
|
701
626
|
if (filename && filename.endsWith(".md")) {
|
|
702
627
|
clearAgentCache();
|
|
703
628
|
onChange?.();
|
|
@@ -705,8 +630,12 @@ async function startAgentWatcher(onChange) {
|
|
|
705
630
|
}
|
|
706
631
|
);
|
|
707
632
|
watchers.push(watcher);
|
|
708
|
-
} catch {
|
|
709
|
-
|
|
633
|
+
} catch (err) {
|
|
634
|
+
logError(err);
|
|
635
|
+
debug.warn("AGENT_LOADER_WATCH_FAILED", {
|
|
636
|
+
dirPath,
|
|
637
|
+
error: err instanceof Error ? err.message : String(err)
|
|
638
|
+
});
|
|
710
639
|
}
|
|
711
640
|
}
|
|
712
641
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/core/src/agent/loader.ts", "../../packages/core/src/agent/builtin.ts", "../../packages/core/src/agent/storage.ts", "../../packages/core/src/agent/validator.ts"],
|
|
4
|
+
"sourcesContent": ["import { existsSync, statSync, watch, type FSWatcher } from 'fs'\nimport { join } from 'path'\n\nimport { memoize } from 'lodash-es'\n\nimport { getCwd } from '#core/utils/state'\nimport { getSessionPlugins } from '#core/utils/sessionPlugins'\nimport { isSettingSourceEnabled } from '#config'\nimport { debug as debugLogger } from '#core/utils/debugLogger'\nimport { logError } from '#core/utils/log'\n\nimport { BUILTIN_AGENTS } from './builtin'\nimport type { AgentConfig, AgentSource } from './types'\nimport {\n dedupeStrings,\n findProjectAgentDirs,\n getClaudePolicyBaseDir,\n getUserConfigRoots,\n listMarkdownFilesRecursively,\n} from './storage'\nimport { parseAgentFromFile, parseFlagAgentsFromCliJson } from './validator'\n\nlet FLAG_AGENTS: AgentConfig[] = []\n\nexport function setFlagAgentsFromCliJson(json: string | undefined): void {\n if (!json) {\n FLAG_AGENTS = []\n clearAgentCache()\n return\n }\n\n FLAG_AGENTS = parseFlagAgentsFromCliJson(json)\n clearAgentCache()\n}\n\nfunction mergeAgents(allAgents: AgentConfig[]): AgentConfig[] {\n const builtIn = allAgents.filter(a => a.source === 'built-in')\n const plugin = allAgents.filter(a => a.source === 'plugin')\n const user = allAgents.filter(a => a.source === 'userSettings')\n const project = allAgents.filter(a => a.source === 'projectSettings')\n const flag = allAgents.filter(a => a.source === 'flagSettings')\n const policy = allAgents.filter(a => a.source === 'policySettings')\n\n const ordered = [builtIn, plugin, user, project, flag, policy]\n const map = new Map<string, AgentConfig>()\n for (const group of ordered) {\n for (const agent of group) {\n map.set(agent.agentType, agent)\n }\n }\n return Array.from(map.values())\n}\n\nfunction inodeKeyForPath(filePath: string): string | null {\n try {\n const st = statSync(filePath)\n return `${st.dev}:${st.ino}`\n } catch {\n return null\n }\n}\n\nfunction scanAgentPaths(options: {\n dirPathOrFile: string\n baseDir: string\n source: Exclude<AgentSource, 'built-in' | 'flagSettings'>\n seenInodes: Map<string, AgentSource>\n}): AgentConfig[] {\n const out: AgentConfig[] = []\n\n const addFile = (filePath: string) => {\n if (!filePath.endsWith('.md')) return\n\n const inodeKey = inodeKeyForPath(filePath)\n if (inodeKey) {\n const existing = options.seenInodes.get(inodeKey)\n if (existing) return\n options.seenInodes.set(inodeKey, options.source)\n }\n\n const agent = parseAgentFromFile({\n filePath,\n baseDir: options.baseDir,\n source: options.source,\n })\n if (agent) out.push(agent)\n }\n\n let st: ReturnType<typeof statSync>\n try {\n st = statSync(options.dirPathOrFile)\n } catch {\n return []\n }\n\n if (st.isFile()) {\n addFile(options.dirPathOrFile)\n return out\n }\n\n if (!st.isDirectory()) return []\n\n for (const filePath of listMarkdownFilesRecursively(options.dirPathOrFile)) {\n addFile(filePath)\n }\n\n return out\n}\n\nasync function loadAllAgents(): Promise<{\n activeAgents: AgentConfig[]\n allAgents: AgentConfig[]\n}> {\n const seenInodes = new Map<string, AgentSource>()\n\n // Plugins\n const sessionPlugins = getSessionPlugins()\n const pluginAgentDirs = sessionPlugins.flatMap(p => p.agentsDirs ?? [])\n const pluginAgents = pluginAgentDirs.flatMap(dir =>\n scanAgentPaths({\n dirPathOrFile: dir,\n baseDir: dir,\n source: 'plugin',\n seenInodes,\n }),\n )\n\n // Policy\n const policyAgentsDir = join(getClaudePolicyBaseDir(), '.claude', 'agents')\n const policyAgents = scanAgentPaths({\n dirPathOrFile: policyAgentsDir,\n baseDir: policyAgentsDir,\n source: 'policySettings',\n seenInodes,\n })\n\n // User\n const userAgents: AgentConfig[] = []\n if (isSettingSourceEnabled('userSettings')) {\n for (const root of getUserConfigRoots()) {\n const dir = join(root, 'agents')\n userAgents.push(\n ...scanAgentPaths({\n dirPathOrFile: dir,\n baseDir: dir,\n source: 'userSettings',\n seenInodes,\n }),\n )\n }\n }\n\n // Project\n const projectAgents: AgentConfig[] = []\n if (isSettingSourceEnabled('projectSettings')) {\n const dirs = findProjectAgentDirs(getCwd())\n for (const dir of dirs) {\n projectAgents.push(\n ...scanAgentPaths({\n dirPathOrFile: dir,\n baseDir: dir,\n source: 'projectSettings',\n seenInodes,\n }),\n )\n }\n }\n\n const allAgents: AgentConfig[] = [\n ...BUILTIN_AGENTS,\n ...pluginAgents,\n ...userAgents,\n ...projectAgents,\n ...FLAG_AGENTS,\n ...policyAgents,\n ]\n\n const activeAgents = mergeAgents(allAgents)\n return { activeAgents, allAgents }\n}\n\nexport const getActiveAgents = memoize(async (): Promise<AgentConfig[]> => {\n const { activeAgents } = await loadAllAgents()\n return activeAgents\n})\n\nexport const getAllAgents = memoize(async (): Promise<AgentConfig[]> => {\n const { allAgents } = await loadAllAgents()\n return allAgents\n})\n\nexport const getAgentByType = memoize(\n async (agentType: string): Promise<AgentConfig | undefined> => {\n const agents = await getActiveAgents()\n return agents.find(agent => agent.agentType === agentType)\n },\n)\n\nexport const getAvailableAgentTypes = memoize(async (): Promise<string[]> => {\n const agents = await getActiveAgents()\n return agents.map(agent => agent.agentType)\n})\n\nexport function clearAgentCache(): void {\n getActiveAgents.cache?.clear?.()\n getAllAgents.cache?.clear?.()\n getAgentByType.cache?.clear?.()\n getAvailableAgentTypes.cache?.clear?.()\n}\n\nlet watchers: FSWatcher[] = []\n\nexport async function startAgentWatcher(onChange?: () => void): Promise<void> {\n await stopAgentWatcher()\n\n const watchDirs: string[] = []\n\n // Policy\n watchDirs.push(join(getClaudePolicyBaseDir(), '.claude', 'agents'))\n\n // User\n if (isSettingSourceEnabled('userSettings')) {\n for (const root of getUserConfigRoots()) {\n watchDirs.push(join(root, 'agents'))\n }\n }\n\n // Project\n if (isSettingSourceEnabled('projectSettings')) {\n watchDirs.push(...findProjectAgentDirs(getCwd()))\n }\n\n // Plugins (session-scoped)\n for (const plugin of getSessionPlugins()) {\n for (const dir of plugin.agentsDirs ?? []) {\n watchDirs.push(dir)\n }\n }\n\n for (const dirPath of dedupeStrings(watchDirs)) {\n if (!existsSync(dirPath)) continue\n try {\n const watcher = watch(\n dirPath,\n { recursive: false },\n (_eventType, filename) => {\n if (filename && filename.endsWith('.md')) {\n clearAgentCache()\n onChange?.()\n }\n },\n )\n watchers.push(watcher)\n } catch (err) {\n logError(err)\n debugLogger.warn('AGENT_LOADER_WATCH_FAILED', {\n dirPath,\n error: err instanceof Error ? err.message : String(err),\n })\n }\n }\n}\n\nexport async function stopAgentWatcher(): Promise<void> {\n try {\n for (const watcher of watchers) {\n try {\n watcher.close()\n } catch {\n // ignore\n }\n }\n } finally {\n watchers = []\n }\n}\n", "import type { AgentConfig } from './types'\n\nexport const BUILTIN_GENERAL_PURPOSE: AgentConfig = {\n agentType: 'general-purpose',\n whenToUse:\n 'General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks',\n tools: '*',\n systemPrompt: `You are a general-purpose agent. Given the user's task, use the tools available to complete it efficiently and thoroughly.\n\nWhen to use your capabilities:\n- Searching for code, configurations, and patterns across large codebases\n- Analyzing multiple files to understand system architecture \n- Investigating complex questions that require exploring many files\n- Performing multi-step research tasks\n\nGuidelines:\n- For file searches: Use Grep or Glob when you need to search broadly. Use FileRead when you know the specific file path.\n- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.\n- Be thorough: Check multiple locations, consider different naming conventions, look for related files.\n- Complete tasks directly using your capabilities.`,\n source: 'built-in',\n location: 'built-in',\n baseDir: 'built-in',\n}\n\nexport const BUILTIN_EXPLORE: AgentConfig = {\n agentType: 'Explore',\n whenToUse:\n 'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. \"src/components/**/*.tsx\"), search code for keywords (eg. \"API endpoints\"), or answer questions about the codebase (eg. \"how do API endpoints work?\"). When calling this agent, specify the desired thoroughness level: \"quick\" for basic searches, \"medium\" for moderate exploration, or \"very thorough\" for comprehensive analysis across multiple locations and naming conventions.',\n tools: '*',\n disallowedTools: ['Task', 'ExitPlanMode', 'Edit', 'Write', 'NotebookEdit'],\n systemPrompt:\n 'You are an agent specialized for exploring codebases quickly and efficiently. Focus on fast, targeted searches and high-signal summaries.',\n source: 'built-in',\n location: 'built-in',\n baseDir: 'built-in',\n}\n\nexport const BUILTIN_PLAN: AgentConfig = {\n agentType: 'Plan',\n whenToUse:\n 'Agent specialized for producing high quality plans before execution.',\n tools: '*',\n disallowedTools: ['Task', 'ExitPlanMode', 'Edit', 'Write', 'NotebookEdit'],\n systemPrompt:\n 'You are an agent specialized for planning. Produce a clear, actionable step-by-step plan, then stop.',\n source: 'built-in',\n location: 'built-in',\n baseDir: 'built-in',\n}\n\nexport const BUILTIN_STATUSLINE_SETUP: AgentConfig = {\n agentType: 'StatuslineSetup',\n whenToUse: 'Agent specialized for configuring the CLI status line command.',\n tools: ['Read', 'Edit', 'Bash'],\n systemPrompt: `You are the status line setup agent.\n\nYour job is to configure a fast, single-line status command for the CLI UI.\n\nRequirements:\n- Write/update the user's ~/.kode/settings.json and set the top-level key \"statusLine\" to a shell command string.\n- IMPORTANT: When using Read/Edit tools, use absolute paths (do not pass \"~\" to tool inputs).\n- The command must be quick (ideally <200ms), produce a single line, and be safe to run repeatedly.\n- Prefer using information that is generally available: current directory, git branch/dirty state, etc.\n- If you can't infer the user's preferred status info from their shell config, ask them what they want and propose a reasonable default.\n\nSuggested approach:\n1) Inspect common shell config files (Read):\n - macOS/Linux: ~/.zshrc, ~/.bashrc, ~/.config/fish/config.fish\n - Windows: consider PowerShell profile if the user provides its location\n2) Propose a statusLine command:\n - macOS/Linux: e.g. a small sh snippet that prints cwd basename and git branch if present\n - Windows: e.g. a short PowerShell one-liner that prints similar info\n3) Update ~/.kode/settings.json:\n - If the file does not exist, create it as a minimal JSON object.\n - Preserve unrelated fields if present.\n4) Reply with the exact command you set and how the user can change/remove it later.`,\n source: 'built-in',\n location: 'built-in',\n baseDir: 'built-in',\n}\n\nexport const BUILTIN_AGENTS: AgentConfig[] = [\n BUILTIN_GENERAL_PURPOSE,\n BUILTIN_STATUSLINE_SETUP,\n BUILTIN_EXPLORE,\n BUILTIN_PLAN,\n]\n", "import { existsSync, readdirSync, statSync } from 'fs'\nimport type { Dirent } from 'fs'\nimport { dirname, join, resolve } from 'path'\nimport { homedir } from 'os'\n\nexport function getClaudePolicyBaseDir(): string {\n switch (process.platform) {\n case 'darwin':\n return '/Library/Application Support/ClaudeCode'\n case 'win32':\n return existsSync('C:\\\\Program Files\\\\ClaudeCode')\n ? 'C:\\\\Program Files\\\\ClaudeCode'\n : 'C:\\\\ProgramData\\\\ClaudeCode'\n default:\n return '/etc/claude-code'\n }\n}\n\nfunction normalizeOverride(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed ? resolve(trimmed) : null\n}\n\nexport function dedupeStrings(values: string[]): string[] {\n const out: string[] = []\n const seen = new Set<string>()\n for (const value of values) {\n if (!value) continue\n if (seen.has(value)) continue\n seen.add(value)\n out.push(value)\n }\n return out\n}\n\nexport function getUserConfigRoots(): string[] {\n const claudeOverride = normalizeOverride(process.env.CLAUDE_CONFIG_DIR)\n const kodeOverride = normalizeOverride(process.env.KODE_CONFIG_DIR)\n\n const hasAnyOverride = Boolean(claudeOverride || kodeOverride)\n if (hasAnyOverride) {\n return dedupeStrings([claudeOverride ?? '', kodeOverride ?? ''])\n }\n\n return dedupeStrings([join(homedir(), '.claude'), join(homedir(), '.kode')])\n}\n\nexport function findProjectAgentDirs(cwd: string): string[] {\n const result: string[] = []\n const home = resolve(homedir())\n let current = resolve(cwd)\n\n while (current !== home) {\n const claudeDir = join(current, '.claude', 'agents')\n if (existsSync(claudeDir)) result.push(claudeDir)\n\n const kodeDir = join(current, '.kode', 'agents')\n if (existsSync(kodeDir)) result.push(kodeDir)\n\n const parent = dirname(current)\n if (parent === current) break\n current = parent\n }\n\n return result\n}\n\nexport function listMarkdownFilesRecursively(rootDir: string): string[] {\n const files: string[] = []\n const visitedDirs = new Set<string>()\n\n const walk = (dirPath: string) => {\n let dirStat: ReturnType<typeof statSync>\n try {\n dirStat = statSync(dirPath)\n } catch {\n return\n }\n if (!dirStat.isDirectory()) return\n\n const dirKey = `${dirStat.dev}:${dirStat.ino}`\n if (visitedDirs.has(dirKey)) return\n visitedDirs.add(dirKey)\n\n let entries: Dirent[]\n try {\n entries = readdirSync(dirPath, { withFileTypes: true })\n } catch {\n return\n }\n\n for (const entry of entries) {\n const name = String(entry.name ?? '')\n const fullPath = join(dirPath, name)\n\n if (entry.isDirectory()) {\n walk(fullPath)\n continue\n }\n\n if (entry.isFile()) {\n if (name.endsWith('.md')) files.push(fullPath)\n continue\n }\n\n if (entry.isSymbolicLink()) {\n try {\n const st = statSync(fullPath)\n if (st.isDirectory()) {\n walk(fullPath)\n } else if (st.isFile() && name.endsWith('.md')) {\n files.push(fullPath)\n }\n } catch {\n continue\n }\n }\n }\n }\n\n if (!existsSync(rootDir)) return []\n walk(rootDir)\n return files\n}\n", "import { readFileSync } from 'fs'\nimport { basename } from 'path'\n\nimport matter from 'gray-matter'\nimport yaml from 'js-yaml'\nimport { z } from 'zod'\n\nimport { debug as debugLogger } from '#core/utils/debugLogger'\nimport { logError } from '#core/utils/log'\n\nimport type {\n AgentConfig,\n AgentLocation,\n AgentModel,\n AgentPermissionMode,\n AgentSource,\n} from './types'\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null\n return value as Record<string, unknown>\n}\n\nconst yamlSchema = (yaml as unknown as { JSON_SCHEMA?: unknown }).JSON_SCHEMA\n\nfunction readMarkdownFile(\n filePath: string,\n): { frontmatter: Record<string, unknown>; content: string } | null {\n try {\n const raw = readFileSync(filePath, 'utf8')\n const parsed = matter(raw, {\n engines: {\n yaml: {\n parse: (input: string) => {\n const loaded = yaml.load(\n input,\n yamlSchema ? { schema: yamlSchema as never } : undefined,\n )\n return asRecord(loaded) ?? {}\n },\n },\n },\n })\n\n return {\n frontmatter: asRecord(parsed.data) ?? {},\n content: String(parsed.content ?? ''),\n }\n } catch {\n return null\n }\n}\n\nfunction splitCliList(values: string[]): string[] {\n if (values.length === 0) return []\n const out: string[] = []\n\n for (const value of values) {\n if (!value) continue\n let current = ''\n let inParens = false\n\n for (const ch of value) {\n switch (ch) {\n case '(':\n inParens = true\n current += ch\n break\n case ')':\n inParens = false\n current += ch\n break\n case ',':\n if (inParens) {\n current += ch\n } else {\n const trimmed = current.trim()\n if (trimmed) out.push(trimmed)\n current = ''\n }\n break\n case ' ':\n if (inParens) {\n current += ch\n } else {\n const trimmed = current.trim()\n if (trimmed) out.push(trimmed)\n current = ''\n }\n break\n default:\n current += ch\n }\n }\n\n const trimmed = current.trim()\n if (trimmed) out.push(trimmed)\n }\n\n return out\n}\n\nfunction normalizeToolList(value: unknown): string[] | null {\n if (value === undefined || value === null) return null\n if (!value) return []\n\n let raw: string[] = []\n if (typeof value === 'string') raw = [value]\n else if (Array.isArray(value))\n raw = value.filter((v): v is string => typeof v === 'string')\n\n if (raw.length === 0) return []\n const parsed = splitCliList(raw)\n if (parsed.includes('*')) return ['*']\n return parsed\n}\n\nfunction z2A(value: unknown): string[] | undefined {\n const normalized = normalizeToolList(value)\n if (normalized === null) return value === undefined ? undefined : []\n if (normalized.includes('*')) return undefined\n return normalized\n}\n\nfunction qP(value: unknown): string[] {\n const normalized = normalizeToolList(value)\n if (normalized === null) return []\n return normalized\n}\n\nconst VALID_PERMISSION_MODES = [\n 'default',\n 'acceptEdits',\n 'plan',\n 'bypassPermissions',\n 'dontAsk',\n 'delegate',\n] as const\n\nfunction sourceToLocation(source: AgentSource): AgentLocation {\n switch (source) {\n case 'plugin':\n return 'plugin'\n case 'userSettings':\n return 'user'\n case 'projectSettings':\n return 'project'\n case 'built-in':\n case 'flagSettings':\n case 'policySettings':\n default:\n return 'built-in'\n }\n}\n\nexport function parseAgentFromFile(options: {\n filePath: string\n baseDir: string\n source: Exclude<AgentSource, 'flagSettings' | 'built-in'>\n}): AgentConfig | null {\n const parsed = readMarkdownFile(options.filePath)\n if (!parsed) return null\n\n try {\n const fm = parsed.frontmatter ?? {}\n const name = fm.name\n const description = fm.description\n\n if (\n !name ||\n typeof name !== 'string' ||\n !description ||\n typeof description !== 'string'\n ) {\n return null\n }\n\n const whenToUse = description.replace(/\\\\n/g, '\\n')\n const filename = basename(options.filePath, '.md')\n\n const color = typeof fm.color === 'string' ? fm.color : undefined\n\n let modelRaw: unknown = fm.model\n if (typeof modelRaw !== 'string' && typeof fm.model_name === 'string') {\n modelRaw = fm.model_name\n }\n let model = typeof modelRaw === 'string' ? modelRaw.trim() : undefined\n if (model === '') model = undefined\n\n const forkContextValue: unknown = fm.forkContext\n if (\n forkContextValue !== undefined &&\n forkContextValue !== 'true' &&\n forkContextValue !== 'false'\n ) {\n debugLogger.warn('AGENT_LOADER_INVALID_FORK_CONTEXT', {\n filePath: options.filePath,\n forkContext: String(forkContextValue),\n })\n }\n const forkContext = forkContextValue === 'true'\n\n if (forkContext && model && model !== 'inherit') {\n debugLogger.warn('AGENT_LOADER_FORK_CONTEXT_MODEL_OVERRIDE', {\n filePath: options.filePath,\n model,\n })\n model = 'inherit'\n }\n\n const permissionModeValue: unknown = fm.permissionMode\n const permissionModeIsValid =\n typeof permissionModeValue === 'string' &&\n VALID_PERMISSION_MODES.includes(\n permissionModeValue as AgentPermissionMode,\n )\n if (\n typeof permissionModeValue === 'string' &&\n permissionModeValue &&\n !permissionModeIsValid\n ) {\n debugLogger.warn('AGENT_LOADER_INVALID_PERMISSION_MODE', {\n filePath: options.filePath,\n permissionMode: permissionModeValue,\n valid: VALID_PERMISSION_MODES,\n })\n }\n\n const toolsList = z2A(fm.tools)\n const tools: string[] | '*' =\n toolsList === undefined || toolsList.includes('*') ? '*' : toolsList\n\n const disallowedRaw =\n fm.disallowedTools ?? fm['disallowed-tools'] ?? fm['disallowed_tools']\n const disallowedTools =\n disallowedRaw !== undefined ? z2A(disallowedRaw) : undefined\n\n const skills = qP(fm.skills)\n const systemPrompt = parsed.content.trim()\n\n const agent: AgentConfig = {\n agentType: name,\n whenToUse,\n tools,\n ...(disallowedTools !== undefined ? { disallowedTools } : {}),\n ...(skills.length > 0 ? { skills } : { skills: [] }),\n systemPrompt,\n source: options.source,\n location: sourceToLocation(options.source),\n baseDir: options.baseDir,\n filename,\n ...(color ? { color } : {}),\n ...(model ? { model: model as AgentModel } : {}),\n ...(permissionModeIsValid\n ? { permissionMode: permissionModeValue as AgentPermissionMode }\n : {}),\n ...(forkContext ? { forkContext: true } : {}),\n }\n\n return agent\n } catch {\n return null\n }\n}\n\nconst agentJsonSchema = z.object({\n description: z.string().min(1, 'Description cannot be empty'),\n tools: z.array(z.string()).optional(),\n disallowedTools: z.array(z.string()).optional(),\n prompt: z.string().min(1, 'Prompt cannot be empty'),\n model: z.string().optional(),\n permissionMode: z.enum(VALID_PERMISSION_MODES).optional(),\n})\n\nconst agentsJsonSchema = z.record(z.string(), agentJsonSchema)\n\nfunction parseAgentFromJson(\n agentType: string,\n value: unknown,\n): AgentConfig | null {\n const parsed = agentJsonSchema.safeParse(value)\n if (!parsed.success) return null\n\n const toolsList = z2A(parsed.data.tools)\n const disallowedList =\n parsed.data.disallowedTools !== undefined\n ? z2A(parsed.data.disallowedTools)\n : undefined\n const model =\n typeof parsed.data.model === 'string' ? parsed.data.model.trim() : undefined\n\n return {\n agentType,\n whenToUse: parsed.data.description,\n tools: toolsList === undefined || toolsList.includes('*') ? '*' : toolsList,\n ...(disallowedList !== undefined\n ? { disallowedTools: disallowedList }\n : {}),\n systemPrompt: parsed.data.prompt,\n source: 'flagSettings',\n location: 'built-in',\n ...(model ? { model: model as AgentModel } : {}),\n ...(parsed.data.permissionMode\n ? { permissionMode: parsed.data.permissionMode }\n : {}),\n }\n}\n\nexport function parseFlagAgentsFromCliJson(json: string): AgentConfig[] {\n let raw: unknown\n try {\n raw = JSON.parse(json)\n } catch (err) {\n logError(err)\n debugLogger.warn('AGENT_LOADER_FLAG_AGENTS_JSON_PARSE_FAILED', {\n error: err instanceof Error ? err.message : String(err),\n })\n return []\n }\n\n const parsed = agentsJsonSchema.safeParse(raw)\n if (!parsed.success) {\n logError(parsed.error)\n debugLogger.warn('AGENT_LOADER_FLAG_AGENTS_SCHEMA_INVALID', {\n error: parsed.error.message,\n })\n return []\n }\n\n return Object.entries(parsed.data)\n .map(([agentType, value]) => parseAgentFromJson(agentType, value))\n .filter((agent): agent is AgentConfig => agent !== null)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAAA,aAAY,YAAAC,WAAU,aAA6B;AAC5D,SAAS,QAAAC,aAAY;AAErB,SAAS,eAAe;;;ACDjB,IAAM,0BAAuC;AAAA,EAClD,WAAW;AAAA,EACX,WACE;AAAA,EACF,OAAO;AAAA,EACP,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAad,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AACX;AAEO,IAAM,kBAA+B;AAAA,EAC1C,WAAW;AAAA,EACX,WACE;AAAA,EACF,OAAO;AAAA,EACP,iBAAiB,CAAC,QAAQ,gBAAgB,QAAQ,SAAS,cAAc;AAAA,EACzE,cACE;AAAA,EACF,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AACX;AAEO,IAAM,eAA4B;AAAA,EACvC,WAAW;AAA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