@shareai-lab/kode 1.2.0 → 2.0.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/README.md +25 -388
- package/cli-acp.js +82 -0
- package/cli.js +89 -79
- package/dist/REPL-GIU4ZIXM.js +42 -0
- package/dist/acp-H3VJ77YG.js +1357 -0
- package/dist/acp-H3VJ77YG.js.map +7 -0
- package/dist/agentsValidate-XP3CFN6F.js +373 -0
- package/dist/agentsValidate-XP3CFN6F.js.map +7 -0
- package/dist/ask-3G5H5KD5.js +125 -0
- package/dist/ask-3G5H5KD5.js.map +7 -0
- package/dist/autoUpdater-DNRMJWFQ.js +17 -0
- package/dist/chunk-2KWKUXLT.js +490 -0
- package/dist/chunk-2KWKUXLT.js.map +7 -0
- package/dist/chunk-2PMO2FS2.js +1097 -0
- package/dist/chunk-2PMO2FS2.js.map +7 -0
- package/dist/chunk-3RUXVV4S.js +23 -0
- package/dist/chunk-3RUXVV4S.js.map +7 -0
- package/dist/chunk-3TXNP6HH.js +240 -0
- package/dist/chunk-3TXNP6HH.js.map +7 -0
- package/dist/chunk-4GAIJGRH.js +472 -0
- package/dist/chunk-4GAIJGRH.js.map +7 -0
- package/dist/chunk-4RTX4AG4.js +249 -0
- package/dist/chunk-4RTX4AG4.js.map +7 -0
- package/dist/chunk-54DNHKOD.js +511 -0
- package/dist/chunk-54DNHKOD.js.map +7 -0
- package/dist/chunk-67PY5IX6.js +34 -0
- package/dist/chunk-67PY5IX6.js.map +7 -0
- package/dist/chunk-6DRDLOLP.js +2613 -0
- package/dist/chunk-6DRDLOLP.js.map +7 -0
- package/dist/chunk-7CQVZNQV.js +1609 -0
- package/dist/chunk-7CQVZNQV.js.map +7 -0
- package/dist/chunk-ABLVTESJ.js +19 -0
- package/dist/chunk-ABLVTESJ.js.map +7 -0
- package/dist/{utils/config.js → chunk-AIMIPK4B.js} +351 -171
- package/dist/chunk-AIMIPK4B.js.map +7 -0
- package/dist/{utils/autoUpdater.js → chunk-BHGTA6JQ.js} +38 -21
- package/dist/chunk-BHGTA6JQ.js.map +7 -0
- package/dist/chunk-CIG63V4E.js +72 -0
- package/dist/chunk-CIG63V4E.js.map +7 -0
- package/dist/chunk-E6YNABER.js +24 -0
- package/dist/chunk-E6YNABER.js.map +7 -0
- package/dist/chunk-EH34V7CY.js +191 -0
- package/dist/chunk-EH34V7CY.js.map +7 -0
- package/dist/{cost-tracker.js → chunk-EZXMVTDU.js} +51 -32
- package/dist/chunk-EZXMVTDU.js.map +7 -0
- package/dist/chunk-FH5CHM6L.js +148 -0
- package/dist/chunk-FH5CHM6L.js.map +7 -0
- package/dist/chunk-G6I7XROM.js +138 -0
- package/dist/chunk-G6I7XROM.js.map +7 -0
- package/dist/chunk-HN4E4UUQ.js +96 -0
- package/dist/chunk-HN4E4UUQ.js.map +7 -0
- package/dist/chunk-HSPVVDIW.js +30198 -0
- package/dist/chunk-HSPVVDIW.js.map +7 -0
- package/dist/{services/systemReminder.js → chunk-IE2CG2TV.js} +221 -59
- package/dist/chunk-IE2CG2TV.js.map +7 -0
- package/dist/chunk-JC6NCUG5.js +11 -0
- package/dist/chunk-K2MI4TPB.js +1256 -0
- package/dist/chunk-K2MI4TPB.js.map +7 -0
- package/dist/chunk-KAA5BGMQ.js +12 -0
- package/dist/chunk-KAA5BGMQ.js.map +7 -0
- package/dist/chunk-MN77D2F7.js +2931 -0
- package/dist/chunk-MN77D2F7.js.map +7 -0
- package/dist/chunk-NPFOMITO.js +21 -0
- package/dist/chunk-NPFOMITO.js.map +7 -0
- package/dist/chunk-NQLEUHMS.js +196 -0
- package/dist/chunk-NQLEUHMS.js.map +7 -0
- package/dist/chunk-OIFQB3S4.js +515 -0
- package/dist/chunk-OIFQB3S4.js.map +7 -0
- package/dist/chunk-OWTG2W3A.js +164 -0
- package/dist/chunk-OWTG2W3A.js.map +7 -0
- package/dist/chunk-OZNRLY3E.js +735 -0
- package/dist/chunk-OZNRLY3E.js.map +7 -0
- package/dist/{utils/debugLogger.js → chunk-QYFKRZQC.js} +107 -204
- package/dist/chunk-QYFKRZQC.js.map +7 -0
- package/dist/chunk-S3J2TLV6.js +16 -0
- package/dist/chunk-S3J2TLV6.js.map +7 -0
- package/dist/chunk-S6HRABTA.js +95 -0
- package/dist/chunk-S6HRABTA.js.map +7 -0
- package/dist/{utils/theme.js → chunk-SDGKPKDK.js} +28 -6
- package/dist/chunk-SDGKPKDK.js.map +7 -0
- package/dist/chunk-SRZZFAS7.js +766 -0
- package/dist/chunk-SRZZFAS7.js.map +7 -0
- package/dist/chunk-UKHTVRJM.js +47 -0
- package/dist/chunk-UKHTVRJM.js.map +7 -0
- package/dist/chunk-UYXEDKOZ.js +24 -0
- package/dist/chunk-UYXEDKOZ.js.map +7 -0
- package/dist/chunk-VBXVYQYY.js +145 -0
- package/dist/chunk-VBXVYQYY.js.map +7 -0
- package/dist/chunk-WVHORZQ5.js +17 -0
- package/dist/chunk-WVHORZQ5.js.map +7 -0
- package/dist/chunk-WWUWDNWW.js +49 -0
- package/dist/chunk-WWUWDNWW.js.map +7 -0
- package/dist/{utils/model.js → chunk-Z33T5YN5.js} +194 -227
- package/dist/chunk-Z33T5YN5.js.map +7 -0
- package/dist/{services/openai.js → chunk-ZQU3TXLC.js} +168 -234
- package/dist/chunk-ZQU3TXLC.js.map +7 -0
- package/dist/cli-SRV2INSL.js +3917 -0
- package/dist/cli-SRV2INSL.js.map +7 -0
- package/dist/commands-TWH6PGVG.js +46 -0
- package/dist/config-6ZMBCL23.js +81 -0
- package/dist/context-JQIOOI4W.js +30 -0
- package/dist/costTracker-6SL26FDB.js +19 -0
- package/dist/customCommands-DNEJS3ZU.js +25 -0
- package/dist/customCommands-DNEJS3ZU.js.map +7 -0
- package/dist/env-OFAXZ3XG.js +22 -0
- package/dist/env-OFAXZ3XG.js.map +7 -0
- package/dist/index.js +34 -5
- package/dist/index.js.map +4 -4
- package/dist/kodeAgentSessionId-X6XWQW7B.js +13 -0
- package/dist/kodeAgentSessionId-X6XWQW7B.js.map +7 -0
- package/dist/kodeAgentSessionLoad-6N27AC5K.js +18 -0
- package/dist/kodeAgentSessionLoad-6N27AC5K.js.map +7 -0
- package/dist/kodeAgentSessionResume-HUSAEO24.js +16 -0
- package/dist/kodeAgentSessionResume-HUSAEO24.js.map +7 -0
- package/dist/kodeAgentStreamJson-NXFN7TXH.js +13 -0
- package/dist/kodeAgentStreamJson-NXFN7TXH.js.map +7 -0
- package/dist/kodeAgentStreamJsonSession-GRWG3SPE.js +131 -0
- package/dist/kodeAgentStreamJsonSession-GRWG3SPE.js.map +7 -0
- package/dist/kodeAgentStructuredStdio-HGWJT7CU.js +10 -0
- package/dist/kodeAgentStructuredStdio-HGWJT7CU.js.map +7 -0
- package/dist/kodeHooks-TDMXFWSO.js +36 -0
- package/dist/kodeHooks-TDMXFWSO.js.map +7 -0
- package/dist/llm-XVXWYOHK.js +3118 -0
- package/dist/llm-XVXWYOHK.js.map +7 -0
- package/dist/llmLazy-7TD5N7XP.js +15 -0
- package/dist/llmLazy-7TD5N7XP.js.map +7 -0
- package/dist/loader-AUXIJTY6.js +28 -0
- package/dist/loader-AUXIJTY6.js.map +7 -0
- package/dist/mcp-BXJ3K7NZ.js +49 -0
- package/dist/mcp-BXJ3K7NZ.js.map +7 -0
- package/dist/{services/mentionProcessor.js → mentionProcessor-YD7YXYGF.js} +61 -50
- package/dist/mentionProcessor-YD7YXYGF.js.map +7 -0
- package/dist/messages-OFUJSPRV.js +63 -0
- package/dist/messages-OFUJSPRV.js.map +7 -0
- package/dist/model-KPYCXWBK.js +30 -0
- package/dist/model-KPYCXWBK.js.map +7 -0
- package/dist/openai-5G5D5Q4B.js +29 -0
- package/dist/openai-5G5D5Q4B.js.map +7 -0
- package/dist/outputStyles-HLDXFQK3.js +28 -0
- package/dist/outputStyles-HLDXFQK3.js.map +7 -0
- package/dist/package.json +1 -1
- package/dist/pluginRuntime-FPTKK6NY.js +218 -0
- package/dist/pluginRuntime-FPTKK6NY.js.map +7 -0
- package/dist/pluginValidation-DSFXZ4GF.js +17 -0
- package/dist/pluginValidation-DSFXZ4GF.js.map +7 -0
- package/dist/prompts-LWLAJRS2.js +48 -0
- package/dist/prompts-LWLAJRS2.js.map +7 -0
- package/dist/query-HVPWL27C.js +50 -0
- package/dist/query-HVPWL27C.js.map +7 -0
- package/dist/responsesStreaming-AW344PQO.js +10 -0
- package/dist/responsesStreaming-AW344PQO.js.map +7 -0
- package/dist/ripgrep-YOPCY2GO.js +17 -0
- package/dist/ripgrep-YOPCY2GO.js.map +7 -0
- package/dist/skillMarketplace-PSNKDINM.js +37 -0
- package/dist/skillMarketplace-PSNKDINM.js.map +7 -0
- package/dist/state-KNRWP3FO.js +16 -0
- package/dist/state-KNRWP3FO.js.map +7 -0
- package/dist/theme-7S2QN2FO.js +14 -0
- package/dist/theme-7S2QN2FO.js.map +7 -0
- package/dist/toolPermissionContext-65L65VEZ.js +17 -0
- package/dist/toolPermissionContext-65L65VEZ.js.map +7 -0
- package/dist/toolPermissionSettings-GPOBH4IV.js +18 -0
- package/dist/toolPermissionSettings-GPOBH4IV.js.map +7 -0
- package/dist/tools-FZU2FZBD.js +47 -0
- package/dist/tools-FZU2FZBD.js.map +7 -0
- package/dist/userInput-VHNBN2MW.js +311 -0
- package/dist/userInput-VHNBN2MW.js.map +7 -0
- package/dist/uuid-QN2CNKKN.js +9 -0
- package/dist/uuid-QN2CNKKN.js.map +7 -0
- package/package.json +43 -14
- package/scripts/binary-utils.cjs +62 -0
- package/scripts/cli-acp-wrapper.cjs +82 -0
- package/scripts/cli-wrapper.cjs +105 -0
- package/scripts/postinstall.js +135 -9
- package/LICENSE +0 -201
- package/README.zh-CN.md +0 -312
- package/dist/ProjectOnboarding.js +0 -99
- package/dist/ProjectOnboarding.js.map +0 -7
- package/dist/Tool.js +0 -1
- package/dist/commands/agents.js +0 -2087
- package/dist/commands/agents.js.map +0 -7
- package/dist/commands/approvedTools.js +0 -36
- package/dist/commands/approvedTools.js.map +0 -7
- package/dist/commands/bug.js +0 -21
- package/dist/commands/bug.js.map +0 -7
- package/dist/commands/clear.js +0 -37
- package/dist/commands/clear.js.map +0 -7
- package/dist/commands/compact.js +0 -104
- package/dist/commands/compact.js.map +0 -7
- package/dist/commands/config.js +0 -20
- package/dist/commands/config.js.map +0 -7
- package/dist/commands/cost.js +0 -19
- package/dist/commands/cost.js.map +0 -7
- package/dist/commands/ctx_viz.js +0 -152
- package/dist/commands/ctx_viz.js.map +0 -7
- package/dist/commands/doctor.js +0 -25
- package/dist/commands/doctor.js.map +0 -7
- package/dist/commands/help.js +0 -20
- package/dist/commands/help.js.map +0 -7
- package/dist/commands/init.js +0 -38
- package/dist/commands/init.js.map +0 -7
- package/dist/commands/listen.js +0 -37
- package/dist/commands/listen.js.map +0 -7
- package/dist/commands/login.js +0 -37
- package/dist/commands/login.js.map +0 -7
- package/dist/commands/logout.js +0 -33
- package/dist/commands/logout.js.map +0 -7
- package/dist/commands/mcp.js +0 -34
- package/dist/commands/mcp.js.map +0 -7
- package/dist/commands/model.js +0 -41
- package/dist/commands/model.js.map +0 -7
- package/dist/commands/modelstatus.js +0 -21
- package/dist/commands/modelstatus.js.map +0 -7
- package/dist/commands/onboarding.js +0 -36
- package/dist/commands/onboarding.js.map +0 -7
- package/dist/commands/pr_comments.js +0 -61
- package/dist/commands/pr_comments.js.map +0 -7
- package/dist/commands/refreshCommands.js +0 -37
- package/dist/commands/refreshCommands.js.map +0 -7
- package/dist/commands/release-notes.js +0 -30
- package/dist/commands/release-notes.js.map +0 -7
- package/dist/commands/resume.js +0 -35
- package/dist/commands/resume.js.map +0 -7
- package/dist/commands/review.js +0 -51
- package/dist/commands/review.js.map +0 -7
- package/dist/commands/terminalSetup.js +0 -163
- package/dist/commands/terminalSetup.js.map +0 -7
- package/dist/commands.js +0 -84
- package/dist/commands.js.map +0 -7
- package/dist/components/ApproveApiKey.js +0 -74
- package/dist/components/ApproveApiKey.js.map +0 -7
- package/dist/components/AsciiLogo.js +0 -12
- package/dist/components/AsciiLogo.js.map +0 -7
- package/dist/components/AutoUpdater.js +0 -74
- package/dist/components/AutoUpdater.js.map +0 -7
- package/dist/components/Bug.js +0 -147
- package/dist/components/Bug.js.map +0 -7
- package/dist/components/Config.js +0 -166
- package/dist/components/Config.js.map +0 -7
- package/dist/components/ConsoleOAuthFlow.js +0 -188
- package/dist/components/ConsoleOAuthFlow.js.map +0 -7
- package/dist/components/Cost.js +0 -13
- package/dist/components/Cost.js.map +0 -7
- package/dist/components/CostThresholdDialog.js +0 -38
- package/dist/components/CostThresholdDialog.js.map +0 -7
- package/dist/components/CustomSelect/option-map.js +0 -32
- package/dist/components/CustomSelect/option-map.js.map +0 -7
- package/dist/components/CustomSelect/select-option.js +0 -34
- package/dist/components/CustomSelect/select-option.js.map +0 -7
- package/dist/components/CustomSelect/select.js +0 -64
- package/dist/components/CustomSelect/select.js.map +0 -7
- package/dist/components/CustomSelect/theme.js +0 -1
- package/dist/components/CustomSelect/use-select-state.js +0 -220
- package/dist/components/CustomSelect/use-select-state.js.map +0 -7
- package/dist/components/CustomSelect/use-select.js +0 -21
- package/dist/components/CustomSelect/use-select.js.map +0 -7
- package/dist/components/FallbackToolUseRejectedMessage.js +0 -11
- package/dist/components/FallbackToolUseRejectedMessage.js.map +0 -7
- package/dist/components/FileEditToolUpdatedMessage.js +0 -32
- package/dist/components/FileEditToolUpdatedMessage.js.map +0 -7
- package/dist/components/Help.js +0 -41
- package/dist/components/Help.js.map +0 -7
- package/dist/components/HighlightedCode.js +0 -30
- package/dist/components/HighlightedCode.js.map +0 -7
- package/dist/components/InvalidConfigDialog.js +0 -83
- package/dist/components/InvalidConfigDialog.js.map +0 -7
- package/dist/components/Link.js +0 -18
- package/dist/components/Link.js.map +0 -7
- package/dist/components/LogSelector.js +0 -50
- package/dist/components/LogSelector.js.map +0 -7
- package/dist/components/Logo.js +0 -94
- package/dist/components/Logo.js.map +0 -7
- package/dist/components/MCPServerApprovalDialog.js +0 -79
- package/dist/components/MCPServerApprovalDialog.js.map +0 -7
- package/dist/components/MCPServerDialogCopy.js +0 -11
- package/dist/components/MCPServerDialogCopy.js.map +0 -7
- package/dist/components/MCPServerMultiselectDialog.js +0 -80
- package/dist/components/MCPServerMultiselectDialog.js.map +0 -7
- package/dist/components/Message.js +0 -146
- package/dist/components/Message.js.map +0 -7
- package/dist/components/MessageResponse.js +0 -9
- package/dist/components/MessageResponse.js.map +0 -7
- package/dist/components/MessageSelector.js +0 -133
- package/dist/components/MessageSelector.js.map +0 -7
- package/dist/components/ModeIndicator.js +0 -38
- package/dist/components/ModeIndicator.js.map +0 -7
- package/dist/components/ModelConfig.js +0 -208
- package/dist/components/ModelConfig.js.map +0 -7
- package/dist/components/ModelListManager.js +0 -140
- package/dist/components/ModelListManager.js.map +0 -7
- package/dist/components/ModelSelector.js +0 -1985
- package/dist/components/ModelSelector.js.map +0 -7
- package/dist/components/ModelStatusDisplay.js +0 -87
- package/dist/components/ModelStatusDisplay.js.map +0 -7
- package/dist/components/Onboarding.js +0 -153
- package/dist/components/Onboarding.js.map +0 -7
- package/dist/components/PressEnterToContinue.js +0 -10
- package/dist/components/PressEnterToContinue.js.map +0 -7
- package/dist/components/PromptInput.js +0 -488
- package/dist/components/PromptInput.js.map +0 -7
- package/dist/components/SentryErrorBoundary.js +0 -27
- package/dist/components/SentryErrorBoundary.js.map +0 -7
- package/dist/components/Spinner.js +0 -101
- package/dist/components/Spinner.js.map +0 -7
- package/dist/components/StickerRequestForm.js +0 -7
- package/dist/components/StickerRequestForm.js.map +0 -7
- package/dist/components/StructuredDiff.js +0 -148
- package/dist/components/StructuredDiff.js.map +0 -7
- package/dist/components/TextInput.js +0 -100
- package/dist/components/TextInput.js.map +0 -7
- package/dist/components/TodoItem.js +0 -35
- package/dist/components/TodoItem.js.map +0 -7
- package/dist/components/TokenWarning.js +0 -19
- package/dist/components/TokenWarning.js.map +0 -7
- package/dist/components/ToolUseLoader.js +0 -24
- package/dist/components/ToolUseLoader.js.map +0 -7
- package/dist/components/TrustDialog.js +0 -76
- package/dist/components/TrustDialog.js.map +0 -7
- package/dist/components/binary-feedback/BinaryFeedback.js +0 -50
- package/dist/components/binary-feedback/BinaryFeedback.js.map +0 -7
- package/dist/components/binary-feedback/BinaryFeedbackOption.js +0 -94
- package/dist/components/binary-feedback/BinaryFeedbackOption.js.map +0 -7
- package/dist/components/binary-feedback/BinaryFeedbackView.js +0 -139
- package/dist/components/binary-feedback/BinaryFeedbackView.js.map +0 -7
- package/dist/components/binary-feedback/utils.js +0 -161
- package/dist/components/binary-feedback/utils.js.map +0 -7
- package/dist/components/messages/AssistantBashOutputMessage.js +0 -23
- package/dist/components/messages/AssistantBashOutputMessage.js.map +0 -7
- package/dist/components/messages/AssistantLocalCommandOutputMessage.js +0 -36
- package/dist/components/messages/AssistantLocalCommandOutputMessage.js.map +0 -7
- package/dist/components/messages/AssistantRedactedThinkingMessage.js +0 -12
- package/dist/components/messages/AssistantRedactedThinkingMessage.js.map +0 -7
- package/dist/components/messages/AssistantTextMessage.js +0 -78
- package/dist/components/messages/AssistantTextMessage.js.map +0 -7
- package/dist/components/messages/AssistantThinkingMessage.js +0 -27
- package/dist/components/messages/AssistantThinkingMessage.js.map +0 -7
- package/dist/components/messages/AssistantToolUseMessage.js +0 -91
- package/dist/components/messages/AssistantToolUseMessage.js.map +0 -7
- package/dist/components/messages/TaskProgressMessage.js +0 -11
- package/dist/components/messages/TaskProgressMessage.js.map +0 -7
- package/dist/components/messages/TaskToolMessage.js +0 -39
- package/dist/components/messages/TaskToolMessage.js.map +0 -7
- package/dist/components/messages/UserBashInputMessage.js +0 -18
- package/dist/components/messages/UserBashInputMessage.js.map +0 -7
- package/dist/components/messages/UserCommandMessage.js +0 -20
- package/dist/components/messages/UserCommandMessage.js.map +0 -7
- package/dist/components/messages/UserKodingInputMessage.js +0 -18
- package/dist/components/messages/UserKodingInputMessage.js.map +0 -7
- package/dist/components/messages/UserPromptMessage.js +0 -20
- package/dist/components/messages/UserPromptMessage.js.map +0 -7
- package/dist/components/messages/UserTextMessage.js +0 -25
- package/dist/components/messages/UserTextMessage.js.map +0 -7
- package/dist/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +0 -10
- package/dist/components/messages/UserToolResultMessage/UserToolCanceledMessage.js.map +0 -7
- package/dist/components/messages/UserToolResultMessage/UserToolErrorMessage.js +0 -15
- package/dist/components/messages/UserToolResultMessage/UserToolErrorMessage.js.map +0 -7
- package/dist/components/messages/UserToolResultMessage/UserToolRejectMessage.js +0 -25
- package/dist/components/messages/UserToolResultMessage/UserToolRejectMessage.js.map +0 -7
- package/dist/components/messages/UserToolResultMessage/UserToolResultMessage.js +0 -47
- package/dist/components/messages/UserToolResultMessage/UserToolResultMessage.js.map +0 -7
- package/dist/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +0 -23
- package/dist/components/messages/UserToolResultMessage/UserToolSuccessMessage.js.map +0 -7
- package/dist/components/messages/UserToolResultMessage/utils.js +0 -42
- package/dist/components/messages/UserToolResultMessage/utils.js.map +0 -7
- package/dist/components/permissions/BashPermissionRequest/BashPermissionRequest.js +0 -112
- package/dist/components/permissions/BashPermissionRequest/BashPermissionRequest.js.map +0 -7
- package/dist/components/permissions/FallbackPermissionRequest.js +0 -131
- package/dist/components/permissions/FallbackPermissionRequest.js.map +0 -7
- package/dist/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +0 -159
- package/dist/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js.map +0 -7
- package/dist/components/permissions/FileEditPermissionRequest/FileEditToolDiff.js +0 -58
- package/dist/components/permissions/FileEditPermissionRequest/FileEditToolDiff.js.map +0 -7
- package/dist/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +0 -153
- package/dist/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js.map +0 -7
- package/dist/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +0 -70
- package/dist/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js.map +0 -7
- package/dist/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +0 -212
- package/dist/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js.map +0 -7
- package/dist/components/permissions/PermissionRequest.js +0 -70
- package/dist/components/permissions/PermissionRequest.js.map +0 -7
- package/dist/components/permissions/PermissionRequestTitle.js +0 -52
- package/dist/components/permissions/PermissionRequestTitle.js.map +0 -7
- package/dist/components/permissions/hooks.js +0 -28
- package/dist/components/permissions/hooks.js.map +0 -7
- package/dist/components/permissions/toolUseOptions.js +0 -46
- package/dist/components/permissions/toolUseOptions.js.map +0 -7
- package/dist/components/permissions/utils.js +0 -21
- package/dist/components/permissions/utils.js.map +0 -7
- package/dist/constants/betas.js +0 -11
- package/dist/constants/betas.js.map +0 -7
- package/dist/constants/claude-asterisk-ascii-art.js +0 -242
- package/dist/constants/claude-asterisk-ascii-art.js.map +0 -7
- package/dist/constants/figures.js +0 -6
- package/dist/constants/figures.js.map +0 -7
- package/dist/constants/keys.js +0 -7
- package/dist/constants/keys.js.map +0 -7
- package/dist/constants/macros.js +0 -13
- package/dist/constants/macros.js.map +0 -7
- package/dist/constants/modelCapabilities.js +0 -154
- package/dist/constants/modelCapabilities.js.map +0 -7
- package/dist/constants/models.js +0 -1034
- package/dist/constants/models.js.map +0 -7
- package/dist/constants/oauth.js +0 -18
- package/dist/constants/oauth.js.map +0 -7
- package/dist/constants/product.js +0 -26
- package/dist/constants/product.js.map +0 -7
- package/dist/constants/prompts.js +0 -168
- package/dist/constants/prompts.js.map +0 -7
- package/dist/constants/releaseNotes.js +0 -9
- package/dist/constants/releaseNotes.js.map +0 -7
- package/dist/context/PermissionContext.js +0 -111
- package/dist/context/PermissionContext.js.map +0 -7
- package/dist/context.js +0 -259
- package/dist/context.js.map +0 -7
- package/dist/cost-tracker.js.map +0 -7
- package/dist/entrypoints/cli.js +0 -1107
- package/dist/entrypoints/cli.js.map +0 -7
- package/dist/entrypoints/mcp.js +0 -150
- package/dist/entrypoints/mcp.js.map +0 -7
- package/dist/history.js +0 -25
- package/dist/history.js.map +0 -7
- package/dist/hooks/useApiKeyVerification.js +0 -12
- package/dist/hooks/useApiKeyVerification.js.map +0 -7
- package/dist/hooks/useArrowKeyHistory.js +0 -50
- package/dist/hooks/useArrowKeyHistory.js.map +0 -7
- package/dist/hooks/useCanUseTool.js +0 -112
- package/dist/hooks/useCanUseTool.js.map +0 -7
- package/dist/hooks/useCancelRequest.js +0 -30
- package/dist/hooks/useCancelRequest.js.map +0 -7
- package/dist/hooks/useDoublePress.js +0 -31
- package/dist/hooks/useDoublePress.js.map +0 -7
- package/dist/hooks/useExitOnCtrlCD.js +0 -26
- package/dist/hooks/useExitOnCtrlCD.js.map +0 -7
- package/dist/hooks/useInterval.js +0 -18
- package/dist/hooks/useInterval.js.map +0 -7
- package/dist/hooks/useLogMessages.js +0 -14
- package/dist/hooks/useLogMessages.js.map +0 -7
- package/dist/hooks/useLogStartupTime.js +0 -15
- package/dist/hooks/useLogStartupTime.js.map +0 -7
- package/dist/hooks/useNotifyAfterTimeout.js +0 -42
- package/dist/hooks/useNotifyAfterTimeout.js.map +0 -7
- package/dist/hooks/usePermissionRequestLogging.js +0 -28
- package/dist/hooks/usePermissionRequestLogging.js.map +0 -7
- package/dist/hooks/useTerminalSize.js +0 -38
- package/dist/hooks/useTerminalSize.js.map +0 -7
- package/dist/hooks/useTextInput.js +0 -250
- package/dist/hooks/useTextInput.js.map +0 -7
- package/dist/hooks/useUnifiedCompletion.js +0 -929
- package/dist/hooks/useUnifiedCompletion.js.map +0 -7
- package/dist/messages.js +0 -33
- package/dist/messages.js.map +0 -7
- package/dist/permissions.js +0 -194
- package/dist/permissions.js.map +0 -7
- package/dist/query.js +0 -492
- package/dist/query.js.map +0 -7
- package/dist/screens/ConfigureNpmPrefix.js +0 -128
- package/dist/screens/ConfigureNpmPrefix.js.map +0 -7
- package/dist/screens/Doctor.js +0 -22
- package/dist/screens/Doctor.js.map +0 -7
- package/dist/screens/LogList.js +0 -55
- package/dist/screens/LogList.js.map +0 -7
- package/dist/screens/REPL.js +0 -593
- package/dist/screens/REPL.js.map +0 -7
- package/dist/screens/ResumeConversation.js +0 -56
- package/dist/screens/ResumeConversation.js.map +0 -7
- package/dist/services/adapters/base.js +0 -29
- package/dist/services/adapters/base.js.map +0 -7
- package/dist/services/adapters/chatCompletions.js +0 -69
- package/dist/services/adapters/chatCompletions.js.map +0 -7
- package/dist/services/adapters/responsesAPI.js +0 -126
- package/dist/services/adapters/responsesAPI.js.map +0 -7
- package/dist/services/browserMocks.js +0 -48
- package/dist/services/browserMocks.js.map +0 -7
- package/dist/services/claude.js +0 -1605
- package/dist/services/claude.js.map +0 -7
- package/dist/services/customCommands.js +0 -359
- package/dist/services/customCommands.js.map +0 -7
- package/dist/services/fileFreshness.js +0 -280
- package/dist/services/fileFreshness.js.map +0 -7
- package/dist/services/gpt5ConnectionTest.js +0 -248
- package/dist/services/gpt5ConnectionTest.js.map +0 -7
- package/dist/services/mcpClient.js +0 -435
- package/dist/services/mcpClient.js.map +0 -7
- package/dist/services/mcpServerApproval.js +0 -55
- package/dist/services/mcpServerApproval.js.map +0 -7
- package/dist/services/mentionProcessor.js.map +0 -7
- package/dist/services/modelAdapterFactory.js +0 -47
- package/dist/services/modelAdapterFactory.js.map +0 -7
- package/dist/services/notifier.js +0 -35
- package/dist/services/notifier.js.map +0 -7
- package/dist/services/oauth.js +0 -259
- package/dist/services/oauth.js.map +0 -7
- package/dist/services/openai.js.map +0 -7
- package/dist/services/responseStateManager.js +0 -68
- package/dist/services/responseStateManager.js.map +0 -7
- package/dist/services/sentry.js +0 -9
- package/dist/services/sentry.js.map +0 -7
- package/dist/services/statsig.js +0 -112
- package/dist/services/statsig.js.map +0 -7
- package/dist/services/statsigStorage.js +0 -75
- package/dist/services/statsigStorage.js.map +0 -7
- package/dist/services/systemReminder.js.map +0 -7
- package/dist/services/vcr.js +0 -133
- package/dist/services/vcr.js.map +0 -7
- package/dist/tools/ArchitectTool/ArchitectTool.js +0 -119
- package/dist/tools/ArchitectTool/ArchitectTool.js.map +0 -7
- package/dist/tools/ArchitectTool/prompt.js +0 -18
- package/dist/tools/ArchitectTool/prompt.js.map +0 -7
- package/dist/tools/AskExpertModelTool/AskExpertModelTool.js +0 -423
- package/dist/tools/AskExpertModelTool/AskExpertModelTool.js.map +0 -7
- package/dist/tools/BashTool/BashTool.js +0 -188
- package/dist/tools/BashTool/BashTool.js.map +0 -7
- package/dist/tools/BashTool/BashToolResultMessage.js +0 -21
- package/dist/tools/BashTool/BashToolResultMessage.js.map +0 -7
- package/dist/tools/BashTool/OutputLine.js +0 -30
- package/dist/tools/BashTool/OutputLine.js.map +0 -7
- package/dist/tools/BashTool/prompt.js +0 -179
- package/dist/tools/BashTool/prompt.js.map +0 -7
- package/dist/tools/BashTool/utils.js +0 -51
- package/dist/tools/BashTool/utils.js.map +0 -7
- package/dist/tools/FileEditTool/FileEditTool.js +0 -228
- package/dist/tools/FileEditTool/FileEditTool.js.map +0 -7
- package/dist/tools/FileEditTool/prompt.js +0 -54
- package/dist/tools/FileEditTool/prompt.js.map +0 -7
- package/dist/tools/FileEditTool/utils.js +0 -42
- package/dist/tools/FileEditTool/utils.js.map +0 -7
- package/dist/tools/FileReadTool/FileReadTool.js +0 -272
- package/dist/tools/FileReadTool/FileReadTool.js.map +0 -7
- package/dist/tools/FileReadTool/prompt.js +0 -10
- package/dist/tools/FileReadTool/prompt.js.map +0 -7
- package/dist/tools/FileWriteTool/FileWriteTool.js +0 -204
- package/dist/tools/FileWriteTool/FileWriteTool.js.map +0 -7
- package/dist/tools/FileWriteTool/prompt.js +0 -14
- package/dist/tools/FileWriteTool/prompt.js.map +0 -7
- package/dist/tools/GlobTool/GlobTool.js +0 -88
- package/dist/tools/GlobTool/GlobTool.js.map +0 -7
- package/dist/tools/GlobTool/prompt.js +0 -12
- package/dist/tools/GlobTool/prompt.js.map +0 -7
- package/dist/tools/GrepTool/GrepTool.js +0 -107
- package/dist/tools/GrepTool/GrepTool.js.map +0 -7
- package/dist/tools/GrepTool/prompt.js +0 -15
- package/dist/tools/GrepTool/prompt.js.map +0 -7
- package/dist/tools/MCPTool/MCPTool.js +0 -90
- package/dist/tools/MCPTool/MCPTool.js.map +0 -7
- package/dist/tools/MCPTool/prompt.js +0 -7
- package/dist/tools/MCPTool/prompt.js.map +0 -7
- package/dist/tools/MemoryReadTool/MemoryReadTool.js +0 -103
- package/dist/tools/MemoryReadTool/MemoryReadTool.js.map +0 -7
- package/dist/tools/MemoryReadTool/prompt.js +0 -7
- package/dist/tools/MemoryReadTool/prompt.js.map +0 -7
- package/dist/tools/MemoryWriteTool/MemoryWriteTool.js +0 -77
- package/dist/tools/MemoryWriteTool/MemoryWriteTool.js.map +0 -7
- package/dist/tools/MemoryWriteTool/prompt.js +0 -7
- package/dist/tools/MemoryWriteTool/prompt.js.map +0 -7
- package/dist/tools/MultiEditTool/MultiEditTool.js +0 -308
- package/dist/tools/MultiEditTool/MultiEditTool.js.map +0 -7
- package/dist/tools/MultiEditTool/prompt.js +0 -48
- package/dist/tools/MultiEditTool/prompt.js.map +0 -7
- package/dist/tools/NotebookEditTool/NotebookEditTool.js +0 -238
- package/dist/tools/NotebookEditTool/NotebookEditTool.js.map +0 -7
- package/dist/tools/NotebookEditTool/prompt.js +0 -7
- package/dist/tools/NotebookEditTool/prompt.js.map +0 -7
- package/dist/tools/NotebookReadTool/NotebookReadTool.js +0 -212
- package/dist/tools/NotebookReadTool/NotebookReadTool.js.map +0 -7
- package/dist/tools/NotebookReadTool/prompt.js +0 -7
- package/dist/tools/NotebookReadTool/prompt.js.map +0 -7
- package/dist/tools/StickerRequestTool/StickerRequestTool.js +0 -86
- package/dist/tools/StickerRequestTool/StickerRequestTool.js.map +0 -7
- package/dist/tools/StickerRequestTool/prompt.js +0 -23
- package/dist/tools/StickerRequestTool/prompt.js.map +0 -7
- package/dist/tools/TaskTool/TaskTool.js +0 -351
- package/dist/tools/TaskTool/TaskTool.js.map +0 -7
- package/dist/tools/TaskTool/constants.js +0 -5
- package/dist/tools/TaskTool/constants.js.map +0 -7
- package/dist/tools/TaskTool/prompt.js +0 -82
- package/dist/tools/TaskTool/prompt.js.map +0 -7
- package/dist/tools/ThinkTool/ThinkTool.js +0 -48
- package/dist/tools/ThinkTool/ThinkTool.js.map +0 -7
- package/dist/tools/ThinkTool/prompt.js +0 -16
- package/dist/tools/ThinkTool/prompt.js.map +0 -7
- package/dist/tools/TodoWriteTool/TodoWriteTool.js +0 -216
- package/dist/tools/TodoWriteTool/TodoWriteTool.js.map +0 -7
- package/dist/tools/TodoWriteTool/prompt.js +0 -66
- package/dist/tools/TodoWriteTool/prompt.js.map +0 -7
- package/dist/tools/URLFetcherTool/URLFetcherTool.js +0 -137
- package/dist/tools/URLFetcherTool/URLFetcherTool.js.map +0 -7
- package/dist/tools/URLFetcherTool/cache.js +0 -45
- package/dist/tools/URLFetcherTool/cache.js.map +0 -7
- package/dist/tools/URLFetcherTool/htmlToMarkdown.js +0 -42
- package/dist/tools/URLFetcherTool/htmlToMarkdown.js.map +0 -7
- package/dist/tools/URLFetcherTool/prompt.js +0 -22
- package/dist/tools/URLFetcherTool/prompt.js.map +0 -7
- package/dist/tools/WebSearchTool/WebSearchTool.js +0 -86
- package/dist/tools/WebSearchTool/WebSearchTool.js.map +0 -7
- package/dist/tools/WebSearchTool/prompt.js +0 -17
- package/dist/tools/WebSearchTool/prompt.js.map +0 -7
- package/dist/tools/WebSearchTool/searchProviders.js +0 -48
- package/dist/tools/WebSearchTool/searchProviders.js.map +0 -7
- package/dist/tools/lsTool/lsTool.js +0 -201
- package/dist/tools/lsTool/lsTool.js.map +0 -7
- package/dist/tools/lsTool/prompt.js +0 -5
- package/dist/tools/lsTool/prompt.js.map +0 -7
- package/dist/tools.js +0 -64
- package/dist/tools.js.map +0 -7
- package/dist/types/PermissionMode.js +0 -82
- package/dist/types/PermissionMode.js.map +0 -7
- package/dist/types/RequestContext.js +0 -47
- package/dist/types/RequestContext.js.map +0 -7
- package/dist/types/common.d.js +0 -1
- package/dist/types/conversation.js +0 -1
- package/dist/types/logs.js +0 -1
- package/dist/types/modelCapabilities.js +0 -1
- package/dist/types/notebook.js +0 -1
- package/dist/utils/Cursor.js +0 -313
- package/dist/utils/Cursor.js.map +0 -7
- package/dist/utils/PersistentShell.js +0 -382
- package/dist/utils/PersistentShell.js.map +0 -7
- package/dist/utils/advancedFuzzyMatcher.js +0 -206
- package/dist/utils/advancedFuzzyMatcher.js.map +0 -7
- package/dist/utils/agentLoader.js +0 -199
- package/dist/utils/agentLoader.js.map +0 -7
- package/dist/utils/agentStorage.js +0 -59
- package/dist/utils/agentStorage.js.map +0 -7
- package/dist/utils/array.js +0 -7
- package/dist/utils/array.js.map +0 -7
- package/dist/utils/ask.js +0 -77
- package/dist/utils/ask.js.map +0 -7
- package/dist/utils/auth.js +0 -11
- package/dist/utils/auth.js.map +0 -7
- package/dist/utils/autoCompactCore.js +0 -149
- package/dist/utils/autoCompactCore.js.map +0 -7
- package/dist/utils/autoUpdater.js.map +0 -7
- package/dist/utils/betas.js +0 -21
- package/dist/utils/betas.js.map +0 -7
- package/dist/utils/browser.js +0 -15
- package/dist/utils/browser.js.map +0 -7
- package/dist/utils/cleanup.js +0 -54
- package/dist/utils/cleanup.js.map +0 -7
- package/dist/utils/commands.js +0 -207
- package/dist/utils/commands.js.map +0 -7
- package/dist/utils/commonUnixCommands.js +0 -687
- package/dist/utils/commonUnixCommands.js.map +0 -7
- package/dist/utils/config.js.map +0 -7
- package/dist/utils/conversationRecovery.js +0 -35
- package/dist/utils/conversationRecovery.js.map +0 -7
- package/dist/utils/debugLogger.js.map +0 -7
- package/dist/utils/diff.js +0 -32
- package/dist/utils/diff.js.map +0 -7
- package/dist/utils/env.js +0 -44
- package/dist/utils/env.js.map +0 -7
- package/dist/utils/errors.js +0 -23
- package/dist/utils/errors.js.map +0 -7
- package/dist/utils/exampleCommands.js +0 -80
- package/dist/utils/exampleCommands.js.map +0 -7
- package/dist/utils/execFileNoThrow.js +0 -44
- package/dist/utils/execFileNoThrow.js.map +0 -7
- package/dist/utils/expertChatStorage.js +0 -78
- package/dist/utils/expertChatStorage.js.map +0 -7
- package/dist/utils/file.js +0 -282
- package/dist/utils/file.js.map +0 -7
- package/dist/utils/fileRecoveryCore.js +0 -41
- package/dist/utils/fileRecoveryCore.js.map +0 -7
- package/dist/utils/format.js +0 -41
- package/dist/utils/format.js.map +0 -7
- package/dist/utils/fuzzyMatcher.js +0 -252
- package/dist/utils/fuzzyMatcher.js.map +0 -7
- package/dist/utils/generators.js +0 -46
- package/dist/utils/generators.js.map +0 -7
- package/dist/utils/git.js +0 -83
- package/dist/utils/git.js.map +0 -7
- package/dist/utils/globalLogger.js +0 -54
- package/dist/utils/globalLogger.js.map +0 -7
- package/dist/utils/http.js +0 -7
- package/dist/utils/http.js.map +0 -7
- package/dist/utils/imagePaste.js +0 -29
- package/dist/utils/imagePaste.js.map +0 -7
- package/dist/utils/json.js +0 -16
- package/dist/utils/json.js.map +0 -7
- package/dist/utils/log.js +0 -298
- package/dist/utils/log.js.map +0 -7
- package/dist/utils/markdown.js +0 -187
- package/dist/utils/markdown.js.map +0 -7
- package/dist/utils/messageContextManager.js +0 -195
- package/dist/utils/messageContextManager.js.map +0 -7
- package/dist/utils/messages.js +0 -633
- package/dist/utils/messages.js.map +0 -7
- package/dist/utils/model.js.map +0 -7
- package/dist/utils/permissions/filesystem.js +0 -80
- package/dist/utils/permissions/filesystem.js.map +0 -7
- package/dist/utils/responseState.js +0 -20
- package/dist/utils/responseState.js.map +0 -7
- package/dist/utils/ripgrep.js +0 -131
- package/dist/utils/ripgrep.js.map +0 -7
- package/dist/utils/secureFile.js +0 -483
- package/dist/utils/secureFile.js.map +0 -7
- package/dist/utils/sessionState.js +0 -31
- package/dist/utils/sessionState.js.map +0 -7
- package/dist/utils/state.js +0 -24
- package/dist/utils/state.js.map +0 -7
- package/dist/utils/style.js +0 -31
- package/dist/utils/style.js.map +0 -7
- package/dist/utils/terminal.js +0 -43
- package/dist/utils/terminal.js.map +0 -7
- package/dist/utils/theme.js.map +0 -7
- package/dist/utils/thinking.js +0 -103
- package/dist/utils/thinking.js.map +0 -7
- package/dist/utils/todoStorage.js +0 -291
- package/dist/utils/todoStorage.js.map +0 -7
- package/dist/utils/tokens.js +0 -30
- package/dist/utils/tokens.js.map +0 -7
- package/dist/utils/toolExecutionController.js +0 -109
- package/dist/utils/toolExecutionController.js.map +0 -7
- package/dist/utils/unaryLogging.js +0 -14
- package/dist/utils/unaryLogging.js.map +0 -7
- package/dist/utils/user.js +0 -40
- package/dist/utils/user.js.map +0 -7
- package/dist/utils/validate.js +0 -132
- package/dist/utils/validate.js.map +0 -7
- /package/dist/{Tool.js.map → REPL-GIU4ZIXM.js.map} +0 -0
- /package/dist/{components/CustomSelect/theme.js.map → autoUpdater-DNRMJWFQ.js.map} +0 -0
- /package/dist/{types/common.d.js.map → chunk-JC6NCUG5.js.map} +0 -0
- /package/dist/{types/conversation.js.map → commands-TWH6PGVG.js.map} +0 -0
- /package/dist/{types/logs.js.map → config-6ZMBCL23.js.map} +0 -0
- /package/dist/{types/modelCapabilities.js.map → context-JQIOOI4W.js.map} +0 -0
- /package/dist/{types/notebook.js.map → costTracker-6SL26FDB.js.map} +0 -0
|
@@ -0,0 +1,735 @@
|
|
|
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
|
+
import {
|
|
7
|
+
getSessionPlugins
|
|
8
|
+
} from "./chunk-S3J2TLV6.js";
|
|
9
|
+
import {
|
|
10
|
+
debug
|
|
11
|
+
} from "./chunk-QYFKRZQC.js";
|
|
12
|
+
import {
|
|
13
|
+
getCwd,
|
|
14
|
+
logError
|
|
15
|
+
} from "./chunk-MN77D2F7.js";
|
|
16
|
+
|
|
17
|
+
// src/utils/agent/loader.ts
|
|
18
|
+
import {
|
|
19
|
+
existsSync,
|
|
20
|
+
readFileSync,
|
|
21
|
+
readdirSync,
|
|
22
|
+
statSync,
|
|
23
|
+
watch
|
|
24
|
+
} from "fs";
|
|
25
|
+
import { basename, dirname, join, resolve } from "path";
|
|
26
|
+
import { homedir } from "os";
|
|
27
|
+
import matter from "gray-matter";
|
|
28
|
+
import yaml from "js-yaml";
|
|
29
|
+
import { memoize } from "lodash-es";
|
|
30
|
+
import { z } from "zod";
|
|
31
|
+
function getClaudePolicyBaseDir() {
|
|
32
|
+
switch (process.platform) {
|
|
33
|
+
case "darwin":
|
|
34
|
+
return "/Library/Application Support/ClaudeCode";
|
|
35
|
+
case "win32":
|
|
36
|
+
return existsSync("C:\\Program Files\\ClaudeCode") ? "C:\\Program Files\\ClaudeCode" : "C:\\ProgramData\\ClaudeCode";
|
|
37
|
+
default:
|
|
38
|
+
return "/etc/claude-code";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function normalizeOverride(value) {
|
|
42
|
+
if (typeof value !== "string") return null;
|
|
43
|
+
const trimmed = value.trim();
|
|
44
|
+
return trimmed ? resolve(trimmed) : null;
|
|
45
|
+
}
|
|
46
|
+
function dedupeStrings(values) {
|
|
47
|
+
const out = [];
|
|
48
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49
|
+
for (const value of values) {
|
|
50
|
+
if (!value) continue;
|
|
51
|
+
if (seen.has(value)) continue;
|
|
52
|
+
seen.add(value);
|
|
53
|
+
out.push(value);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
function getUserConfigRoots() {
|
|
58
|
+
const claudeOverride = normalizeOverride(process.env.CLAUDE_CONFIG_DIR);
|
|
59
|
+
const kodeOverride = normalizeOverride(process.env.KODE_CONFIG_DIR);
|
|
60
|
+
const hasAnyOverride = Boolean(claudeOverride || kodeOverride);
|
|
61
|
+
if (hasAnyOverride) {
|
|
62
|
+
return dedupeStrings([claudeOverride ?? "", kodeOverride ?? ""]);
|
|
63
|
+
}
|
|
64
|
+
return dedupeStrings([join(homedir(), ".claude"), join(homedir(), ".kode")]);
|
|
65
|
+
}
|
|
66
|
+
function findProjectAgentDirs(cwd) {
|
|
67
|
+
const result = [];
|
|
68
|
+
const home = resolve(homedir());
|
|
69
|
+
let current = resolve(cwd);
|
|
70
|
+
while (current !== home) {
|
|
71
|
+
const claudeDir = join(current, ".claude", "agents");
|
|
72
|
+
if (existsSync(claudeDir)) result.push(claudeDir);
|
|
73
|
+
const kodeDir = join(current, ".kode", "agents");
|
|
74
|
+
if (existsSync(kodeDir)) result.push(kodeDir);
|
|
75
|
+
const parent = dirname(current);
|
|
76
|
+
if (parent === current) break;
|
|
77
|
+
current = parent;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
function listMarkdownFilesRecursively(rootDir) {
|
|
82
|
+
const files = [];
|
|
83
|
+
const visitedDirs = /* @__PURE__ */ new Set();
|
|
84
|
+
const walk = (dirPath) => {
|
|
85
|
+
let dirStat;
|
|
86
|
+
try {
|
|
87
|
+
dirStat = statSync(dirPath);
|
|
88
|
+
} catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!dirStat.isDirectory()) return;
|
|
92
|
+
const dirKey = `${dirStat.dev}:${dirStat.ino}`;
|
|
93
|
+
if (visitedDirs.has(dirKey)) return;
|
|
94
|
+
visitedDirs.add(dirKey);
|
|
95
|
+
let entries;
|
|
96
|
+
try {
|
|
97
|
+
entries = readdirSync(dirPath, {
|
|
98
|
+
withFileTypes: true,
|
|
99
|
+
encoding: "utf8"
|
|
100
|
+
});
|
|
101
|
+
} catch {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
for (const entry of entries) {
|
|
105
|
+
const name = String(entry.name ?? "");
|
|
106
|
+
const fullPath = join(dirPath, name);
|
|
107
|
+
if (entry.isDirectory()) {
|
|
108
|
+
walk(fullPath);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (entry.isFile()) {
|
|
112
|
+
if (name.endsWith(".md")) files.push(fullPath);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (entry.isSymbolicLink()) {
|
|
116
|
+
try {
|
|
117
|
+
const st = statSync(fullPath);
|
|
118
|
+
if (st.isDirectory()) {
|
|
119
|
+
walk(fullPath);
|
|
120
|
+
} else if (st.isFile() && name.endsWith(".md")) {
|
|
121
|
+
files.push(fullPath);
|
|
122
|
+
}
|
|
123
|
+
} catch {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
if (!existsSync(rootDir)) return [];
|
|
130
|
+
walk(rootDir);
|
|
131
|
+
return files;
|
|
132
|
+
}
|
|
133
|
+
function readMarkdownFile(filePath) {
|
|
134
|
+
try {
|
|
135
|
+
const raw = readFileSync(filePath, "utf8");
|
|
136
|
+
const yamlSchema = yaml.JSON_SCHEMA;
|
|
137
|
+
const matterOptions = {
|
|
138
|
+
engines: {
|
|
139
|
+
yaml: {
|
|
140
|
+
parse: (input) => yaml.load(input, yamlSchema ? { schema: yamlSchema } : void 0) ?? {}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const parsed = matter(raw, matterOptions);
|
|
145
|
+
return {
|
|
146
|
+
frontmatter: parsed.data ?? {},
|
|
147
|
+
content: String(parsed.content ?? "")
|
|
148
|
+
};
|
|
149
|
+
} catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function splitCliList(values) {
|
|
154
|
+
if (values.length === 0) return [];
|
|
155
|
+
const out = [];
|
|
156
|
+
for (const value of values) {
|
|
157
|
+
if (!value) continue;
|
|
158
|
+
let current = "";
|
|
159
|
+
let inParens = false;
|
|
160
|
+
for (const ch of value) {
|
|
161
|
+
switch (ch) {
|
|
162
|
+
case "(":
|
|
163
|
+
inParens = true;
|
|
164
|
+
current += ch;
|
|
165
|
+
break;
|
|
166
|
+
case ")":
|
|
167
|
+
inParens = false;
|
|
168
|
+
current += ch;
|
|
169
|
+
break;
|
|
170
|
+
case ",":
|
|
171
|
+
if (inParens) {
|
|
172
|
+
current += ch;
|
|
173
|
+
} else {
|
|
174
|
+
const trimmed2 = current.trim();
|
|
175
|
+
if (trimmed2) out.push(trimmed2);
|
|
176
|
+
current = "";
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case " ":
|
|
180
|
+
if (inParens) {
|
|
181
|
+
current += ch;
|
|
182
|
+
} else {
|
|
183
|
+
const trimmed2 = current.trim();
|
|
184
|
+
if (trimmed2) out.push(trimmed2);
|
|
185
|
+
current = "";
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
default:
|
|
189
|
+
current += ch;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const trimmed = current.trim();
|
|
193
|
+
if (trimmed) out.push(trimmed);
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
function normalizeToolList(value) {
|
|
198
|
+
if (value === void 0 || value === null) return null;
|
|
199
|
+
if (!value) return [];
|
|
200
|
+
let raw = [];
|
|
201
|
+
if (typeof value === "string") raw = [value];
|
|
202
|
+
else if (Array.isArray(value))
|
|
203
|
+
raw = value.filter((v) => typeof v === "string");
|
|
204
|
+
if (raw.length === 0) return [];
|
|
205
|
+
const parsed = splitCliList(raw);
|
|
206
|
+
if (parsed.includes("*")) return ["*"];
|
|
207
|
+
return parsed;
|
|
208
|
+
}
|
|
209
|
+
function z2A(value) {
|
|
210
|
+
const normalized = normalizeToolList(value);
|
|
211
|
+
if (normalized === null) return value === void 0 ? void 0 : [];
|
|
212
|
+
if (normalized.includes("*")) return void 0;
|
|
213
|
+
return normalized;
|
|
214
|
+
}
|
|
215
|
+
function qP(value) {
|
|
216
|
+
const normalized = normalizeToolList(value);
|
|
217
|
+
if (normalized === null) return [];
|
|
218
|
+
return normalized;
|
|
219
|
+
}
|
|
220
|
+
var VALID_PERMISSION_MODES = [
|
|
221
|
+
"default",
|
|
222
|
+
"acceptEdits",
|
|
223
|
+
"plan",
|
|
224
|
+
"bypassPermissions",
|
|
225
|
+
"dontAsk",
|
|
226
|
+
"delegate"
|
|
227
|
+
];
|
|
228
|
+
function sourceToLocation(source) {
|
|
229
|
+
switch (source) {
|
|
230
|
+
case "plugin":
|
|
231
|
+
return "plugin";
|
|
232
|
+
case "userSettings":
|
|
233
|
+
return "user";
|
|
234
|
+
case "projectSettings":
|
|
235
|
+
return "project";
|
|
236
|
+
case "built-in":
|
|
237
|
+
case "flagSettings":
|
|
238
|
+
case "policySettings":
|
|
239
|
+
default:
|
|
240
|
+
return "built-in";
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function parseAgentFromFile(options) {
|
|
244
|
+
const parsed = readMarkdownFile(options.filePath);
|
|
245
|
+
if (!parsed) return null;
|
|
246
|
+
try {
|
|
247
|
+
const fm = parsed.frontmatter ?? {};
|
|
248
|
+
let name = fm.name;
|
|
249
|
+
let description = fm.description;
|
|
250
|
+
if (!name || typeof name !== "string" || !description || typeof description !== "string") {
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
const whenToUse = description.replace(/\\n/g, "\n");
|
|
254
|
+
const filename = basename(options.filePath, ".md");
|
|
255
|
+
const color = typeof fm.color === "string" ? fm.color : void 0;
|
|
256
|
+
let modelRaw = fm.model;
|
|
257
|
+
if (typeof modelRaw !== "string" && typeof fm.model_name === "string") {
|
|
258
|
+
modelRaw = fm.model_name;
|
|
259
|
+
}
|
|
260
|
+
let model = typeof modelRaw === "string" ? modelRaw.trim() : void 0;
|
|
261
|
+
if (model === "") model = void 0;
|
|
262
|
+
const forkContextValue = fm.forkContext;
|
|
263
|
+
if (forkContextValue !== void 0 && forkContextValue !== "true" && forkContextValue !== "false") {
|
|
264
|
+
debug.warn("AGENT_LOADER_INVALID_FORK_CONTEXT", {
|
|
265
|
+
filePath: options.filePath,
|
|
266
|
+
forkContext: String(forkContextValue)
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const forkContext = forkContextValue === "true";
|
|
270
|
+
if (forkContext && model && model !== "inherit") {
|
|
271
|
+
debug.warn("AGENT_LOADER_FORK_CONTEXT_MODEL_OVERRIDE", {
|
|
272
|
+
filePath: options.filePath,
|
|
273
|
+
model
|
|
274
|
+
});
|
|
275
|
+
model = "inherit";
|
|
276
|
+
}
|
|
277
|
+
const permissionModeValue = fm.permissionMode;
|
|
278
|
+
const permissionModeIsValid = typeof permissionModeValue === "string" && VALID_PERMISSION_MODES.includes(permissionModeValue);
|
|
279
|
+
if (typeof permissionModeValue === "string" && permissionModeValue && !permissionModeIsValid) {
|
|
280
|
+
debug.warn("AGENT_LOADER_INVALID_PERMISSION_MODE", {
|
|
281
|
+
filePath: options.filePath,
|
|
282
|
+
permissionMode: permissionModeValue,
|
|
283
|
+
valid: VALID_PERMISSION_MODES
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
const toolsList = z2A(fm.tools);
|
|
287
|
+
const tools = toolsList === void 0 || toolsList.includes("*") ? "*" : toolsList;
|
|
288
|
+
const disallowedRaw = fm.disallowedTools ?? fm["disallowed-tools"] ?? fm["disallowed_tools"];
|
|
289
|
+
const disallowedTools = disallowedRaw !== void 0 ? z2A(disallowedRaw) : void 0;
|
|
290
|
+
const skills = qP(fm.skills);
|
|
291
|
+
const systemPrompt = parsed.content.trim();
|
|
292
|
+
const agent = {
|
|
293
|
+
agentType: name,
|
|
294
|
+
whenToUse,
|
|
295
|
+
tools,
|
|
296
|
+
...disallowedTools !== void 0 ? { disallowedTools } : {},
|
|
297
|
+
...skills.length > 0 ? { skills } : { skills: [] },
|
|
298
|
+
systemPrompt,
|
|
299
|
+
source: options.source,
|
|
300
|
+
location: sourceToLocation(options.source),
|
|
301
|
+
baseDir: options.baseDir,
|
|
302
|
+
filename,
|
|
303
|
+
...color ? { color } : {},
|
|
304
|
+
...model ? { model } : {},
|
|
305
|
+
...permissionModeIsValid ? { permissionMode: permissionModeValue } : {},
|
|
306
|
+
...forkContext ? { forkContext: true } : {}
|
|
307
|
+
};
|
|
308
|
+
return agent;
|
|
309
|
+
} catch {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
var agentJsonSchema = z.object({
|
|
314
|
+
description: z.string().min(1, "Description cannot be empty"),
|
|
315
|
+
tools: z.array(z.string()).optional(),
|
|
316
|
+
disallowedTools: z.array(z.string()).optional(),
|
|
317
|
+
prompt: z.string().min(1, "Prompt cannot be empty"),
|
|
318
|
+
model: z.string().optional(),
|
|
319
|
+
permissionMode: z.enum(VALID_PERMISSION_MODES).optional()
|
|
320
|
+
});
|
|
321
|
+
var agentsJsonSchema = z.record(z.string(), agentJsonSchema);
|
|
322
|
+
function parseAgentFromJson(agentType, value) {
|
|
323
|
+
const parsed = agentJsonSchema.safeParse(value);
|
|
324
|
+
if (!parsed.success) return null;
|
|
325
|
+
const toolsList = z2A(parsed.data.tools);
|
|
326
|
+
const disallowedList = parsed.data.disallowedTools !== void 0 ? z2A(parsed.data.disallowedTools) : void 0;
|
|
327
|
+
const model = typeof parsed.data.model === "string" ? parsed.data.model.trim() : void 0;
|
|
328
|
+
return {
|
|
329
|
+
agentType,
|
|
330
|
+
whenToUse: parsed.data.description,
|
|
331
|
+
tools: toolsList === void 0 || toolsList.includes("*") ? "*" : toolsList,
|
|
332
|
+
...disallowedList !== void 0 ? { disallowedTools: disallowedList } : {},
|
|
333
|
+
systemPrompt: parsed.data.prompt,
|
|
334
|
+
source: "flagSettings",
|
|
335
|
+
location: "built-in",
|
|
336
|
+
...model ? { model } : {},
|
|
337
|
+
...parsed.data.permissionMode ? { permissionMode: parsed.data.permissionMode } : {}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
var FLAG_AGENTS = [];
|
|
341
|
+
function setFlagAgentsFromCliJson(json) {
|
|
342
|
+
if (!json) {
|
|
343
|
+
FLAG_AGENTS = [];
|
|
344
|
+
clearAgentCache();
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
let raw;
|
|
348
|
+
try {
|
|
349
|
+
raw = JSON.parse(json);
|
|
350
|
+
} catch (err) {
|
|
351
|
+
logError(err);
|
|
352
|
+
debug.warn("AGENT_LOADER_FLAG_AGENTS_JSON_PARSE_FAILED", {
|
|
353
|
+
error: err instanceof Error ? err.message : String(err)
|
|
354
|
+
});
|
|
355
|
+
FLAG_AGENTS = [];
|
|
356
|
+
clearAgentCache();
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const parsed = agentsJsonSchema.safeParse(raw);
|
|
360
|
+
if (!parsed.success) {
|
|
361
|
+
logError(parsed.error);
|
|
362
|
+
debug.warn("AGENT_LOADER_FLAG_AGENTS_SCHEMA_INVALID", {
|
|
363
|
+
error: parsed.error.message
|
|
364
|
+
});
|
|
365
|
+
FLAG_AGENTS = [];
|
|
366
|
+
clearAgentCache();
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
FLAG_AGENTS = Object.entries(parsed.data).map(([agentType, value]) => parseAgentFromJson(agentType, value)).filter((agent) => agent !== null);
|
|
370
|
+
clearAgentCache();
|
|
371
|
+
}
|
|
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
|
+
function mergeAgents(allAgents) {
|
|
529
|
+
const builtIn = allAgents.filter((a) => a.source === "built-in");
|
|
530
|
+
const plugin = allAgents.filter((a) => a.source === "plugin");
|
|
531
|
+
const user = allAgents.filter((a) => a.source === "userSettings");
|
|
532
|
+
const project = allAgents.filter((a) => a.source === "projectSettings");
|
|
533
|
+
const flag = allAgents.filter((a) => a.source === "flagSettings");
|
|
534
|
+
const policy = allAgents.filter((a) => a.source === "policySettings");
|
|
535
|
+
const ordered = [builtIn, plugin, user, project, flag, policy];
|
|
536
|
+
const map = /* @__PURE__ */ new Map();
|
|
537
|
+
for (const group of ordered) {
|
|
538
|
+
for (const agent of group) {
|
|
539
|
+
map.set(agent.agentType, agent);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return Array.from(map.values());
|
|
543
|
+
}
|
|
544
|
+
function inodeKeyForPath(filePath) {
|
|
545
|
+
try {
|
|
546
|
+
const st = statSync(filePath);
|
|
547
|
+
if (typeof st.dev === "number" && typeof st.ino === "number") {
|
|
548
|
+
return `${st.dev}:${st.ino}`;
|
|
549
|
+
}
|
|
550
|
+
return null;
|
|
551
|
+
} catch {
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function scanAgentPaths(options) {
|
|
556
|
+
const out = [];
|
|
557
|
+
const addFile = (filePath) => {
|
|
558
|
+
if (!filePath.endsWith(".md")) return;
|
|
559
|
+
const inodeKey = inodeKeyForPath(filePath);
|
|
560
|
+
if (inodeKey) {
|
|
561
|
+
const existing = options.seenInodes.get(inodeKey);
|
|
562
|
+
if (existing) return;
|
|
563
|
+
options.seenInodes.set(inodeKey, options.source);
|
|
564
|
+
}
|
|
565
|
+
const agent = parseAgentFromFile({
|
|
566
|
+
filePath,
|
|
567
|
+
baseDir: options.baseDir,
|
|
568
|
+
source: options.source
|
|
569
|
+
});
|
|
570
|
+
if (agent) out.push(agent);
|
|
571
|
+
};
|
|
572
|
+
let st;
|
|
573
|
+
try {
|
|
574
|
+
st = statSync(options.dirPathOrFile);
|
|
575
|
+
} catch {
|
|
576
|
+
return [];
|
|
577
|
+
}
|
|
578
|
+
if (st.isFile()) {
|
|
579
|
+
addFile(options.dirPathOrFile);
|
|
580
|
+
return out;
|
|
581
|
+
}
|
|
582
|
+
if (!st.isDirectory()) return [];
|
|
583
|
+
for (const filePath of listMarkdownFilesRecursively(options.dirPathOrFile)) {
|
|
584
|
+
addFile(filePath);
|
|
585
|
+
}
|
|
586
|
+
return out;
|
|
587
|
+
}
|
|
588
|
+
async function loadAllAgents() {
|
|
589
|
+
const builtinAgents = [
|
|
590
|
+
BUILTIN_GENERAL_PURPOSE,
|
|
591
|
+
BUILTIN_STATUSLINE_SETUP,
|
|
592
|
+
BUILTIN_EXPLORE,
|
|
593
|
+
BUILTIN_PLAN
|
|
594
|
+
];
|
|
595
|
+
const seenInodes = /* @__PURE__ */ new Map();
|
|
596
|
+
const sessionPlugins = getSessionPlugins();
|
|
597
|
+
const pluginAgentDirs = sessionPlugins.flatMap((p) => p.agentsDirs ?? []);
|
|
598
|
+
const pluginAgents = pluginAgentDirs.flatMap(
|
|
599
|
+
(dir) => scanAgentPaths({
|
|
600
|
+
dirPathOrFile: dir,
|
|
601
|
+
baseDir: dir,
|
|
602
|
+
source: "plugin",
|
|
603
|
+
seenInodes
|
|
604
|
+
})
|
|
605
|
+
);
|
|
606
|
+
const policyAgentsDir = join(getClaudePolicyBaseDir(), ".claude", "agents");
|
|
607
|
+
const policyAgents = scanAgentPaths({
|
|
608
|
+
dirPathOrFile: policyAgentsDir,
|
|
609
|
+
baseDir: policyAgentsDir,
|
|
610
|
+
source: "policySettings",
|
|
611
|
+
seenInodes
|
|
612
|
+
});
|
|
613
|
+
const userAgents = [];
|
|
614
|
+
if (isSettingSourceEnabled("userSettings")) {
|
|
615
|
+
for (const root of getUserConfigRoots()) {
|
|
616
|
+
const dir = join(root, "agents");
|
|
617
|
+
userAgents.push(
|
|
618
|
+
...scanAgentPaths({
|
|
619
|
+
dirPathOrFile: dir,
|
|
620
|
+
baseDir: dir,
|
|
621
|
+
source: "userSettings",
|
|
622
|
+
seenInodes
|
|
623
|
+
})
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
const projectAgents = [];
|
|
628
|
+
if (isSettingSourceEnabled("projectSettings")) {
|
|
629
|
+
const dirs = findProjectAgentDirs(getCwd());
|
|
630
|
+
for (const dir of dirs) {
|
|
631
|
+
projectAgents.push(
|
|
632
|
+
...scanAgentPaths({
|
|
633
|
+
dirPathOrFile: dir,
|
|
634
|
+
baseDir: dir,
|
|
635
|
+
source: "projectSettings",
|
|
636
|
+
seenInodes
|
|
637
|
+
})
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const allAgents = [
|
|
642
|
+
...builtinAgents,
|
|
643
|
+
...pluginAgents,
|
|
644
|
+
...userAgents,
|
|
645
|
+
...projectAgents,
|
|
646
|
+
...FLAG_AGENTS,
|
|
647
|
+
...policyAgents
|
|
648
|
+
];
|
|
649
|
+
const activeAgents = mergeAgents(allAgents);
|
|
650
|
+
return { activeAgents, allAgents };
|
|
651
|
+
}
|
|
652
|
+
var getActiveAgents = memoize(async () => {
|
|
653
|
+
const { activeAgents } = await loadAllAgents();
|
|
654
|
+
return activeAgents;
|
|
655
|
+
});
|
|
656
|
+
var getAllAgents = memoize(async () => {
|
|
657
|
+
const { allAgents } = await loadAllAgents();
|
|
658
|
+
return allAgents;
|
|
659
|
+
});
|
|
660
|
+
var getAgentByType = memoize(
|
|
661
|
+
async (agentType) => {
|
|
662
|
+
const agents = await getActiveAgents();
|
|
663
|
+
return agents.find((agent) => agent.agentType === agentType);
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
var getAvailableAgentTypes = memoize(async () => {
|
|
667
|
+
const agents = await getActiveAgents();
|
|
668
|
+
return agents.map((agent) => agent.agentType);
|
|
669
|
+
});
|
|
670
|
+
function clearAgentCache() {
|
|
671
|
+
getActiveAgents.cache?.clear?.();
|
|
672
|
+
getAllAgents.cache?.clear?.();
|
|
673
|
+
getAgentByType.cache?.clear?.();
|
|
674
|
+
getAvailableAgentTypes.cache?.clear?.();
|
|
675
|
+
}
|
|
676
|
+
var watchers = [];
|
|
677
|
+
async function startAgentWatcher(onChange) {
|
|
678
|
+
await stopAgentWatcher();
|
|
679
|
+
const watchDirs = [];
|
|
680
|
+
watchDirs.push(join(getClaudePolicyBaseDir(), ".claude", "agents"));
|
|
681
|
+
if (isSettingSourceEnabled("userSettings")) {
|
|
682
|
+
for (const root of getUserConfigRoots()) {
|
|
683
|
+
watchDirs.push(join(root, "agents"));
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
if (isSettingSourceEnabled("projectSettings")) {
|
|
687
|
+
watchDirs.push(...findProjectAgentDirs(getCwd()));
|
|
688
|
+
}
|
|
689
|
+
for (const plugin of getSessionPlugins()) {
|
|
690
|
+
for (const dir of plugin.agentsDirs ?? []) {
|
|
691
|
+
watchDirs.push(dir);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
for (const dirPath of dedupeStrings(watchDirs)) {
|
|
695
|
+
if (!existsSync(dirPath)) continue;
|
|
696
|
+
try {
|
|
697
|
+
const watcher = watch(
|
|
698
|
+
dirPath,
|
|
699
|
+
{ recursive: false },
|
|
700
|
+
async (_eventType, filename) => {
|
|
701
|
+
if (filename && filename.endsWith(".md")) {
|
|
702
|
+
clearAgentCache();
|
|
703
|
+
onChange?.();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
watchers.push(watcher);
|
|
708
|
+
} catch {
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
async function stopAgentWatcher() {
|
|
714
|
+
try {
|
|
715
|
+
for (const watcher of watchers) {
|
|
716
|
+
try {
|
|
717
|
+
watcher.close();
|
|
718
|
+
} catch {
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
} finally {
|
|
722
|
+
watchers = [];
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
export {
|
|
727
|
+
setFlagAgentsFromCliJson,
|
|
728
|
+
getActiveAgents,
|
|
729
|
+
getAllAgents,
|
|
730
|
+
getAgentByType,
|
|
731
|
+
getAvailableAgentTypes,
|
|
732
|
+
clearAgentCache,
|
|
733
|
+
startAgentWatcher,
|
|
734
|
+
stopAgentWatcher
|
|
735
|
+
};
|