pybao-cli 1.5.36 → 1.5.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/REPL-EOGX5USK.js +51 -0
- package/dist/{acp-QRIZ5IYO.js → acp-JTVVQGX6.js} +30 -30
- package/dist/{agentsValidate-P2QSA4XL.js → agentsValidate-T552HEU3.js} +7 -7
- package/dist/{ask-WIQYOQEG.js → ask-JT2UVHOU.js} +30 -30
- package/dist/{autoUpdater-MEUBMTCZ.js → autoUpdater-ZBN46KEI.js} +3 -3
- package/dist/{chunk-TLP5DVEM.js → chunk-2P4E3ZNA.js} +3 -3
- package/dist/{chunk-JJ5HRVLG.js → chunk-34KB4DEZ.js} +4 -4
- package/dist/{chunk-7KPPJFGR.js → chunk-3L5QLWHQ.js} +1 -1
- package/dist/{chunk-QA3HDYQZ.js → chunk-45CYYYU7.js} +2 -2
- package/dist/{chunk-44H5ROEF.js → chunk-5AM65D7G.js} +1 -1
- package/dist/{chunk-542JZAJQ.js → chunk-A33Z7A54.js} +5 -5
- package/dist/{chunk-542JZAJQ.js.map → chunk-A33Z7A54.js.map} +1 -1
- package/dist/chunk-BKCAVW2G.js.map +7 -0
- package/dist/{chunk-DDJPFVCD.js → chunk-DXS27TBK.js} +3 -3
- package/dist/{chunk-EN7KOPIA.js → chunk-FGAQGENO.js} +3 -3
- package/dist/chunk-FGAQGENO.js.map +7 -0
- package/dist/{chunk-XHLFDFPQ.js → chunk-GLNNII3K.js} +3 -3
- package/dist/{chunk-7HMF5J3F.js → chunk-HKDUNAZU.js} +1 -1
- package/dist/{chunk-3KHMRGJJ.js → chunk-HPHRVBGM.js} +3 -3
- package/dist/{chunk-MJT2BJLD.js → chunk-JQW3XPSA.js} +1 -1
- package/dist/{chunk-AI7TZGEO.js → chunk-JQXGDP2G.js} +2 -2
- package/dist/{chunk-YWK2UVTO.js → chunk-LGWP73N3.js} +1 -1
- package/dist/{chunk-D3FZBDVS.js → chunk-M3XZZUER.js} +2 -2
- package/dist/{chunk-7POF6LG4.js → chunk-MPW3OMAB.js} +4 -4
- package/dist/{chunk-DWHXB72J.js → chunk-MQ56NHZY.js} +3 -3
- package/dist/{chunk-EAPNJV2Z.js → chunk-ODHAKZLW.js} +3 -3
- package/dist/{chunk-SEJZHZ5F.js → chunk-OONY2XEJ.js} +3 -18
- package/dist/chunk-OONY2XEJ.js.map +7 -0
- package/dist/{chunk-45XR2OAY.js → chunk-OQ7GMNEA.js} +1 -1
- package/dist/{chunk-PRDPN4QZ.js → chunk-PPTR7ECF.js} +1 -1
- package/dist/{chunk-DDN6NKCL.js → chunk-QLLHQ4NC.js} +1 -1
- package/dist/{chunk-X5IT55SG.js → chunk-R357FMHE.js} +1 -1
- package/dist/{chunk-U7MKXQK6.js → chunk-REIICUCF.js} +6 -6
- package/dist/{chunk-U7MKXQK6.js.map → chunk-REIICUCF.js.map} +1 -1
- package/dist/{chunk-5ZNLZ4TP.js → chunk-RKTBVJGG.js} +2 -2
- package/dist/{chunk-MUBRIEFY.js → chunk-T4YXQTDG.js} +3 -3
- package/dist/{chunk-YZBVDQNG.js → chunk-TW7VYZCV.js} +3 -3
- package/dist/{chunk-OUREC4BI.js → chunk-TYK67RSX.js} +4 -4
- package/dist/{chunk-6QEIHAGS.js → chunk-USNKNXS4.js} +1 -1
- package/dist/{chunk-MV747DN6.js → chunk-X7II6NLY.js} +3 -3
- package/dist/{chunk-MV747DN6.js.map → chunk-X7II6NLY.js.map} +1 -1
- package/dist/{chunk-DGLIAB7C.js → chunk-XGFLQLPP.js} +436 -410
- package/dist/chunk-XGFLQLPP.js.map +7 -0
- package/dist/{cli-NLMPMQ2E.js → cli-GW2RLZKS.js} +91 -91
- package/dist/commands-OMEB6ZPR.js +55 -0
- package/dist/{config-D5UJFGPG.js → config-7YD4R22V.js} +4 -4
- package/dist/{context-5K45JNRQ.js → context-4EG6BLW4.js} +6 -6
- package/dist/{conversationPersistence-ZQQCB6BK.js → conversationPersistence-XSJ7MFZQ.js} +3 -3
- package/dist/{conversationTracker-PUTHQLXK.js → conversationTracker-VXYBDUQD.js} +4 -4
- package/dist/{customCommands-46VIFQ34.js → customCommands-CEGHI3EI.js} +4 -4
- package/dist/{env-6IPMBPS4.js → env-SFBXDZAW.js} +2 -2
- package/dist/{file-MSKCELHV.js → file-TKPF7WPK.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-FH3V2XTE.js → llm-UPZIAGPI.js} +32 -32
- package/dist/{llmLazy-URJDLFSZ.js → llmLazy-AH4Z4W4G.js} +1 -1
- package/dist/{loader-A62HAK4O.js → loader-KR2G4MZH.js} +4 -4
- package/dist/{lsp-HMODWV7I.js → lsp-4BXZN54S.js} +6 -6
- package/dist/{lspAnchor-ZC7I7COT.js → lspAnchor-J7X23CTJ.js} +6 -6
- package/dist/{mcp-7LRQSBP6.js → mcp-PQ7E5V6N.js} +7 -7
- package/dist/{mentionProcessor-ZMRROWKA.js → mentionProcessor-OBZEHVOK.js} +5 -5
- package/dist/{messages-LXUVZTLH.js → messages-Y45VMQJM.js} +1 -1
- package/dist/{model-QV7OOHHG.js → model-PLE3KNNX.js} +5 -5
- package/dist/{openai-YUTDZOKP.js → openai-2R2NDBUU.js} +5 -5
- package/dist/{outputStyles-TBOL576J.js → outputStyles-XXPDKDY2.js} +4 -4
- package/dist/{pluginRuntime-IB7YAUZR.js → pluginRuntime-SROFDMKU.js} +6 -6
- package/dist/{pluginValidation-5JVF2CA3.js → pluginValidation-WRO2DZTR.js} +6 -6
- package/dist/prompts-5Q6CSNXC.js +57 -0
- package/dist/{pybAgentSessionLoad-YOZUCXGF.js → pybAgentSessionLoad-FQQRBPKP.js} +4 -4
- package/dist/{pybAgentSessionResume-KBCPZ5M7.js → pybAgentSessionResume-P3UHSOY6.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-A7CQ6PEZ.js → pybAgentStreamJsonSession-SIHHDMP6.js} +1 -1
- package/dist/{pybHooks-ZXVD4ACH.js → pybHooks-J6EDF4HT.js} +4 -4
- package/dist/query-CADGN75M.js +55 -0
- package/dist/{registry-WYGTZAW4.js → registry-FWP3Q2GA.js} +5 -5
- package/dist/{ripgrep-V2OK4EJP.js → ripgrep-MRW3JRSV.js} +3 -3
- package/dist/{skillMarketplace-D3MIES5B.js → skillMarketplace-I6WS3AB4.js} +3 -3
- package/dist/{state-L4B23VCD.js → state-FFCKZLBN.js} +2 -2
- package/dist/{theme-DH6QMGKW.js → theme-ALYM3CFD.js} +5 -5
- package/dist/{toolPermissionSettings-QPTI6L6H.js → toolPermissionSettings-6TUFSTN3.js} +6 -6
- package/dist/tools-IEYQ4SAS.js +55 -0
- package/dist/{userInput-7XK4U2ZK.js → userInput-4MUAKMGX.js} +32 -32
- package/package.json +3 -18
- package/resources/output-styles/accessibility-champion.md +66 -0
- package/resources/output-styles/api-designer.md +88 -0
- package/resources/output-styles/concise-engineer.md +32 -0
- package/resources/output-styles/critical-code-reviewer.md +36 -0
- package/resources/output-styles/data-engineer.md +104 -0
- package/resources/output-styles/defensive-programmer.md +81 -0
- package/resources/output-styles/devil-advocate.md +43 -0
- package/resources/output-styles/devops-automator.md +118 -0
- package/resources/output-styles/distributed-systems-architect.md +77 -0
- package/resources/output-styles/documentation-writer.md +47 -0
- package/resources/output-styles/evan-king-system-design-reviewer.md +45 -0
- package/resources/output-styles/functional-purist.md +84 -0
- package/resources/output-styles/performance-optimizer.md +49 -0
- package/resources/output-styles/refactoring-expert.md +118 -0
- package/resources/output-styles/security-auditor.md +49 -0
- package/resources/output-styles/startup-pragmatist.md +58 -0
- package/resources/output-styles/test-driven-developer.md +48 -0
- package/dist/REPL-BECQEFPJ.js +0 -51
- package/dist/chunk-2DKSGO53.js.map +0 -7
- package/dist/chunk-DGLIAB7C.js.map +0 -7
- package/dist/chunk-EN7KOPIA.js.map +0 -7
- package/dist/chunk-SEJZHZ5F.js.map +0 -7
- package/dist/commands-QMNEULJC.js +0 -55
- package/dist/prompts-6JCRUF2G.js +0 -57
- package/dist/query-LAHU5G7G.js +0 -55
- package/dist/tools-SG2ZUUUH.js +0 -55
- /package/dist/{REPL-BECQEFPJ.js.map → REPL-EOGX5USK.js.map} +0 -0
- /package/dist/{acp-QRIZ5IYO.js.map → acp-JTVVQGX6.js.map} +0 -0
- /package/dist/{agentsValidate-P2QSA4XL.js.map → agentsValidate-T552HEU3.js.map} +0 -0
- /package/dist/{ask-WIQYOQEG.js.map → ask-JT2UVHOU.js.map} +0 -0
- /package/dist/{autoUpdater-MEUBMTCZ.js.map → autoUpdater-ZBN46KEI.js.map} +0 -0
- /package/dist/{chunk-TLP5DVEM.js.map → chunk-2P4E3ZNA.js.map} +0 -0
- /package/dist/{chunk-JJ5HRVLG.js.map → chunk-34KB4DEZ.js.map} +0 -0
- /package/dist/{chunk-7KPPJFGR.js.map → chunk-3L5QLWHQ.js.map} +0 -0
- /package/dist/{chunk-QA3HDYQZ.js.map → chunk-45CYYYU7.js.map} +0 -0
- /package/dist/{chunk-44H5ROEF.js.map → chunk-5AM65D7G.js.map} +0 -0
- /package/dist/{chunk-2DKSGO53.js → chunk-BKCAVW2G.js} +0 -0
- /package/dist/{chunk-DDJPFVCD.js.map → chunk-DXS27TBK.js.map} +0 -0
- /package/dist/{chunk-XHLFDFPQ.js.map → chunk-GLNNII3K.js.map} +0 -0
- /package/dist/{chunk-7HMF5J3F.js.map → chunk-HKDUNAZU.js.map} +0 -0
- /package/dist/{chunk-3KHMRGJJ.js.map → chunk-HPHRVBGM.js.map} +0 -0
- /package/dist/{chunk-MJT2BJLD.js.map → chunk-JQW3XPSA.js.map} +0 -0
- /package/dist/{chunk-AI7TZGEO.js.map → chunk-JQXGDP2G.js.map} +0 -0
- /package/dist/{chunk-YWK2UVTO.js.map → chunk-LGWP73N3.js.map} +0 -0
- /package/dist/{chunk-D3FZBDVS.js.map → chunk-M3XZZUER.js.map} +0 -0
- /package/dist/{chunk-7POF6LG4.js.map → chunk-MPW3OMAB.js.map} +0 -0
- /package/dist/{chunk-DWHXB72J.js.map → chunk-MQ56NHZY.js.map} +0 -0
- /package/dist/{chunk-EAPNJV2Z.js.map → chunk-ODHAKZLW.js.map} +0 -0
- /package/dist/{chunk-45XR2OAY.js.map → chunk-OQ7GMNEA.js.map} +0 -0
- /package/dist/{chunk-PRDPN4QZ.js.map → chunk-PPTR7ECF.js.map} +0 -0
- /package/dist/{chunk-DDN6NKCL.js.map → chunk-QLLHQ4NC.js.map} +0 -0
- /package/dist/{chunk-X5IT55SG.js.map → chunk-R357FMHE.js.map} +0 -0
- /package/dist/{chunk-5ZNLZ4TP.js.map → chunk-RKTBVJGG.js.map} +0 -0
- /package/dist/{chunk-MUBRIEFY.js.map → chunk-T4YXQTDG.js.map} +0 -0
- /package/dist/{chunk-YZBVDQNG.js.map → chunk-TW7VYZCV.js.map} +0 -0
- /package/dist/{chunk-OUREC4BI.js.map → chunk-TYK67RSX.js.map} +0 -0
- /package/dist/{chunk-6QEIHAGS.js.map → chunk-USNKNXS4.js.map} +0 -0
- /package/dist/{cli-NLMPMQ2E.js.map → cli-GW2RLZKS.js.map} +0 -0
- /package/dist/{commands-QMNEULJC.js.map → commands-OMEB6ZPR.js.map} +0 -0
- /package/dist/{config-D5UJFGPG.js.map → config-7YD4R22V.js.map} +0 -0
- /package/dist/{context-5K45JNRQ.js.map → context-4EG6BLW4.js.map} +0 -0
- /package/dist/{conversationPersistence-ZQQCB6BK.js.map → conversationPersistence-XSJ7MFZQ.js.map} +0 -0
- /package/dist/{conversationTracker-PUTHQLXK.js.map → conversationTracker-VXYBDUQD.js.map} +0 -0
- /package/dist/{customCommands-46VIFQ34.js.map → customCommands-CEGHI3EI.js.map} +0 -0
- /package/dist/{env-6IPMBPS4.js.map → env-SFBXDZAW.js.map} +0 -0
- /package/dist/{file-MSKCELHV.js.map → file-TKPF7WPK.js.map} +0 -0
- /package/dist/{llm-FH3V2XTE.js.map → llm-UPZIAGPI.js.map} +0 -0
- /package/dist/{llmLazy-URJDLFSZ.js.map → llmLazy-AH4Z4W4G.js.map} +0 -0
- /package/dist/{loader-A62HAK4O.js.map → loader-KR2G4MZH.js.map} +0 -0
- /package/dist/{lsp-HMODWV7I.js.map → lsp-4BXZN54S.js.map} +0 -0
- /package/dist/{lspAnchor-ZC7I7COT.js.map → lspAnchor-J7X23CTJ.js.map} +0 -0
- /package/dist/{mcp-7LRQSBP6.js.map → mcp-PQ7E5V6N.js.map} +0 -0
- /package/dist/{mentionProcessor-ZMRROWKA.js.map → mentionProcessor-OBZEHVOK.js.map} +0 -0
- /package/dist/{messages-LXUVZTLH.js.map → messages-Y45VMQJM.js.map} +0 -0
- /package/dist/{model-QV7OOHHG.js.map → model-PLE3KNNX.js.map} +0 -0
- /package/dist/{openai-YUTDZOKP.js.map → openai-2R2NDBUU.js.map} +0 -0
- /package/dist/{outputStyles-TBOL576J.js.map → outputStyles-XXPDKDY2.js.map} +0 -0
- /package/dist/{pluginRuntime-IB7YAUZR.js.map → pluginRuntime-SROFDMKU.js.map} +0 -0
- /package/dist/{pluginValidation-5JVF2CA3.js.map → pluginValidation-WRO2DZTR.js.map} +0 -0
- /package/dist/{prompts-6JCRUF2G.js.map → prompts-5Q6CSNXC.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-YOZUCXGF.js.map → pybAgentSessionLoad-FQQRBPKP.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-KBCPZ5M7.js.map → pybAgentSessionResume-P3UHSOY6.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-A7CQ6PEZ.js.map → pybAgentStreamJsonSession-SIHHDMP6.js.map} +0 -0
- /package/dist/{pybHooks-ZXVD4ACH.js.map → pybHooks-J6EDF4HT.js.map} +0 -0
- /package/dist/{query-LAHU5G7G.js.map → query-CADGN75M.js.map} +0 -0
- /package/dist/{registry-WYGTZAW4.js.map → registry-FWP3Q2GA.js.map} +0 -0
- /package/dist/{ripgrep-V2OK4EJP.js.map → ripgrep-MRW3JRSV.js.map} +0 -0
- /package/dist/{skillMarketplace-D3MIES5B.js.map → skillMarketplace-I6WS3AB4.js.map} +0 -0
- /package/dist/{state-L4B23VCD.js.map → state-FFCKZLBN.js.map} +0 -0
- /package/dist/{theme-DH6QMGKW.js.map → theme-ALYM3CFD.js.map} +0 -0
- /package/dist/{toolPermissionSettings-QPTI6L6H.js.map → toolPermissionSettings-6TUFSTN3.js.map} +0 -0
- /package/dist/{tools-SG2ZUUUH.js.map → tools-IEYQ4SAS.js.map} +0 -0
- /package/dist/{userInput-7XK4U2ZK.js.map → userInput-4MUAKMGX.js.map} +0 -0
|
@@ -2,17 +2,17 @@ import { createRequire as __pybCreateRequire } from "node:module";
|
|
|
2
2
|
const require = __pybCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
loadPybAgentSessionMessages
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HKDUNAZU.js";
|
|
6
6
|
import {
|
|
7
7
|
appendSessionCustomTitleRecord,
|
|
8
8
|
appendSessionJsonlFromMessage,
|
|
9
9
|
appendSessionTagRecord,
|
|
10
10
|
listPybAgentSessions
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MQ56NHZY.js";
|
|
12
12
|
import {
|
|
13
13
|
formatValidationResult,
|
|
14
14
|
validatePluginOrMarketplacePath
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TW7VYZCV.js";
|
|
16
16
|
import {
|
|
17
17
|
ConversationTracker,
|
|
18
18
|
appendFinishState,
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
getConversationTrackerForContext,
|
|
21
21
|
isFinishComplete,
|
|
22
22
|
mapFinishReason
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-PPTR7ECF.js";
|
|
24
24
|
import {
|
|
25
25
|
FileSystemConversationPersistence
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-5AM65D7G.js";
|
|
27
27
|
import {
|
|
28
28
|
beginReplSessionScope
|
|
29
29
|
} from "./chunk-F4AXICO7.js";
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
runStopHooks,
|
|
39
39
|
runUserPromptSubmitHooks,
|
|
40
40
|
updateHookTranscriptForMessages
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-HPHRVBGM.js";
|
|
42
42
|
import {
|
|
43
43
|
DEFAULT_OUTPUT_STYLE,
|
|
44
44
|
getAvailableOutputStyles,
|
|
@@ -47,11 +47,11 @@ import {
|
|
|
47
47
|
getOutputStyleSystemPromptAdditions,
|
|
48
48
|
resolveOutputStyleName,
|
|
49
49
|
setCurrentOutputStyle
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-FGAQGENO.js";
|
|
51
51
|
import {
|
|
52
52
|
fetchCustomModels,
|
|
53
53
|
getModelFeatures
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-JQXGDP2G.js";
|
|
55
55
|
import {
|
|
56
56
|
getCurrentSessionId,
|
|
57
57
|
getSessionState
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
queryLLM,
|
|
61
61
|
queryQuick,
|
|
62
62
|
verifyApiKey
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-34KB4DEZ.js";
|
|
64
64
|
import {
|
|
65
65
|
DEFAULT_TIMEOUT_MS,
|
|
66
66
|
FallbackToolUseRejectedMessage,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
listMCPServers,
|
|
76
76
|
loadMergedSettings,
|
|
77
77
|
normalizeSandboxRuntimeConfigFromSettings
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-TYK67RSX.js";
|
|
79
79
|
import {
|
|
80
80
|
addMarketplace,
|
|
81
81
|
disableSkillPlugin,
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
refreshMarketplaceAsync,
|
|
89
89
|
removeMarketplace,
|
|
90
90
|
uninstallSkillPlugin
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-QLLHQ4NC.js";
|
|
92
92
|
import {
|
|
93
93
|
loadToolPermissionContextFromDisk,
|
|
94
94
|
persistToolPermissionUpdateToDisk
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-DXS27TBK.js";
|
|
96
96
|
import {
|
|
97
97
|
applyToolPermissionContextUpdate,
|
|
98
98
|
applyToolPermissionContextUpdates,
|
|
@@ -103,14 +103,14 @@ import {
|
|
|
103
103
|
generateSystemReminders,
|
|
104
104
|
resetReminderSession,
|
|
105
105
|
systemReminderService
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-M3XZZUER.js";
|
|
107
107
|
import {
|
|
108
108
|
clearAgentCache,
|
|
109
109
|
getActiveAgents,
|
|
110
110
|
getAgentByType,
|
|
111
111
|
getAllAgents,
|
|
112
112
|
getAvailableAgentTypes
|
|
113
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-REIICUCF.js";
|
|
114
114
|
import {
|
|
115
115
|
API_ERROR_MESSAGE_PREFIX,
|
|
116
116
|
CANCEL_MESSAGE,
|
|
@@ -147,7 +147,7 @@ import {
|
|
|
147
147
|
reorderMessages,
|
|
148
148
|
resetAutoCompactTelemetry,
|
|
149
149
|
stripSystemMessages
|
|
150
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-OQ7GMNEA.js";
|
|
151
151
|
import {
|
|
152
152
|
getRequestStatus,
|
|
153
153
|
setRequestStatus,
|
|
@@ -179,7 +179,7 @@ import {
|
|
|
179
179
|
normalizeFilePath,
|
|
180
180
|
readTextContent,
|
|
181
181
|
writeTextContent
|
|
182
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-45CYYYU7.js";
|
|
183
183
|
import {
|
|
184
184
|
parseBlockEdits
|
|
185
185
|
} from "./chunk-QWIBSCDN.js";
|
|
@@ -190,18 +190,18 @@ import {
|
|
|
190
190
|
formatDiagnosticsPretty,
|
|
191
191
|
initParser,
|
|
192
192
|
loadLanguage
|
|
193
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-MPW3OMAB.js";
|
|
194
194
|
import {
|
|
195
195
|
getSettingsFileCandidates,
|
|
196
196
|
loadSettingsWithLegacyFallback,
|
|
197
197
|
readSettingsFile
|
|
198
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-JQW3XPSA.js";
|
|
199
199
|
import {
|
|
200
200
|
getCustomCommandDirectories,
|
|
201
201
|
hasCustomCommands,
|
|
202
202
|
loadCustomCommands,
|
|
203
203
|
reloadCustomCommands
|
|
204
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-RKTBVJGG.js";
|
|
205
205
|
import {
|
|
206
206
|
getSessionPlugins
|
|
207
207
|
} from "./chunk-BJSWTHRM.js";
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
buildModelProfileKey,
|
|
211
211
|
getModelManager,
|
|
212
212
|
isDefaultSlowAndCapableModel
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-GLNNII3K.js";
|
|
214
214
|
import {
|
|
215
215
|
getCodeStyle,
|
|
216
216
|
getContext,
|
|
@@ -218,16 +218,16 @@ import {
|
|
|
218
218
|
getIsGit,
|
|
219
219
|
getProjectDocs,
|
|
220
220
|
getProjectStructureStatisticsBlock
|
|
221
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-A33Z7A54.js";
|
|
222
222
|
import {
|
|
223
223
|
getRipgrepPath,
|
|
224
224
|
getRipgrepPolicyMode,
|
|
225
225
|
resolveRipgrepPolicy,
|
|
226
226
|
ripGrep
|
|
227
|
-
} from "./chunk-
|
|
227
|
+
} from "./chunk-LGWP73N3.js";
|
|
228
228
|
import {
|
|
229
229
|
getTheme
|
|
230
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-R357FMHE.js";
|
|
231
231
|
import {
|
|
232
232
|
DEFAULT_GLOBAL_CONFIG,
|
|
233
233
|
enableConfigs,
|
|
@@ -240,7 +240,7 @@ import {
|
|
|
240
240
|
saveGlobalConfig,
|
|
241
241
|
setAllPointersToModel,
|
|
242
242
|
setModelPointer
|
|
243
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-2P4E3ZNA.js";
|
|
244
244
|
import {
|
|
245
245
|
AbortError
|
|
246
246
|
} from "./chunk-RQVLBMP7.js";
|
|
@@ -249,7 +249,7 @@ import {
|
|
|
249
249
|
getCurrentRequest,
|
|
250
250
|
logUserFriendly,
|
|
251
251
|
markPhase
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-USNKNXS4.js";
|
|
253
253
|
import {
|
|
254
254
|
ASCII_LOGO,
|
|
255
255
|
BunShell,
|
|
@@ -293,10 +293,10 @@ import {
|
|
|
293
293
|
setCwd,
|
|
294
294
|
shouldApplyToolOutputTruncation,
|
|
295
295
|
truncateToolOutput
|
|
296
|
-
} from "./chunk-
|
|
296
|
+
} from "./chunk-X7II6NLY.js";
|
|
297
297
|
import {
|
|
298
298
|
MACRO
|
|
299
|
-
} from "./chunk-
|
|
299
|
+
} from "./chunk-OONY2XEJ.js";
|
|
300
300
|
import {
|
|
301
301
|
__export
|
|
302
302
|
} from "./chunk-I3J4JYES.js";
|
|
@@ -477,7 +477,7 @@ var getCommandSubcommandPrefix = memoize(
|
|
|
477
477
|
var getCommandPrefix = memoize(
|
|
478
478
|
async (command4, abortSignal) => {
|
|
479
479
|
const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
|
|
480
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-
|
|
480
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-UPZIAGPI.js");
|
|
481
481
|
const response = await queryQuick2({
|
|
482
482
|
systemPrompt,
|
|
483
483
|
userPrompt,
|
|
@@ -4279,7 +4279,7 @@ function formatParseError(error) {
|
|
|
4279
4279
|
return error instanceof Error ? error.message : String(error);
|
|
4280
4280
|
}
|
|
4281
4281
|
async function defaultGateQuery(args) {
|
|
4282
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-
|
|
4282
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-UPZIAGPI.js");
|
|
4283
4283
|
const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
|
|
4284
4284
|
const messages = [
|
|
4285
4285
|
{
|
|
@@ -6672,7 +6672,7 @@ var FileEditTool = {
|
|
|
6672
6672
|
const originalFileContent = currentFileContent;
|
|
6673
6673
|
let totalPatch = [];
|
|
6674
6674
|
const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
|
|
6675
|
-
const { findLspAnchor } = await import("./lspAnchor-
|
|
6675
|
+
const { findLspAnchor } = await import("./lspAnchor-J7X23CTJ.js");
|
|
6676
6676
|
for (const op of editOperations) {
|
|
6677
6677
|
const normalizedSearch = normalizeLineEndings(op.search);
|
|
6678
6678
|
const normalizedReplace = normalizeLineEndings(op.replace);
|
|
@@ -6773,7 +6773,7 @@ Suggestion: fix errors or rerun with verify=false.`);
|
|
|
6773
6773
|
};
|
|
6774
6774
|
|
|
6775
6775
|
// src/tools/filesystem/FileReadTool/FileReadTool.tsx
|
|
6776
|
-
import { statSync as statSync7 } from "fs";
|
|
6776
|
+
import { readdirSync, statSync as statSync7 } from "fs";
|
|
6777
6777
|
import { Box as Box12, Text as Text13 } from "ink";
|
|
6778
6778
|
import * as path5 from "node:path";
|
|
6779
6779
|
import { extname as extname4, relative as relative6 } from "node:path";
|
|
@@ -6783,8 +6783,8 @@ import { z as z4 } from "zod";
|
|
|
6783
6783
|
// src/tools/filesystem/FileReadTool/prompt.ts
|
|
6784
6784
|
var MAX_LINES_TO_READ = 2e3;
|
|
6785
6785
|
var MAX_LINE_LENGTH = 2e3;
|
|
6786
|
-
var DESCRIPTION3 = "Read a file from the local filesystem.";
|
|
6787
|
-
var PROMPT3 = `Reads a file from the local filesystem. You can access any file directly by using this tool.Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid; otherwise, Ensure the path is confirmed by Glob/Grep before reading.
|
|
6786
|
+
var DESCRIPTION3 = "Read a file or directory from the local filesystem.";
|
|
6787
|
+
var PROMPT3 = `Reads a file or directory from the local filesystem. You can access any file or directory directly by using this tool.Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid; otherwise, Ensure the path is confirmed by Glob/Grep before reading.
|
|
6788
6788
|
|
|
6789
6789
|
## Best Practice
|
|
6790
6790
|
- **Read vs Analyze**: Use this tool when you need to inspect full implementation details.
|
|
@@ -6798,16 +6798,20 @@ var PROMPT3 = `Reads a file from the local filesystem. You can access any file d
|
|
|
6798
6798
|
|
|
6799
6799
|
## Usage Details
|
|
6800
6800
|
- The file_path parameter must be an absolute path, not a relative path
|
|
6801
|
-
-
|
|
6801
|
+
- This tool supports both file mode and directory mode
|
|
6802
|
+
- In directory mode, offset/limit are 1-based entry pagination and offset>=1 is required
|
|
6803
|
+
- In file mode, offset/limit are 1-based line pagination; offset=1 starts from the first line shown in cat -n output
|
|
6804
|
+
- By default, file mode reads up to ${MAX_LINES_TO_READ} lines starting from the beginning of the file
|
|
6802
6805
|
- You can optionally specify a line offset and limit (especially handy for long files). **Smart Truncation is active**: If your limit cuts a function or class in the middle, the tool will automatically extend the read range to include the full semantic block (up to 500 extra lines).
|
|
6803
|
-
-
|
|
6806
|
+
- Directory mode returns a one-level tree structure using \u251C\u2500\u2500/\u2514\u2500\u2500 and supports pagination continuation hints
|
|
6804
6807
|
- For large files, iterate in chunks: offset=1 limit=200, then offset=201 limit=200, and so on until the needed region is covered
|
|
6808
|
+
- File text truncation is capped at 50KB per result and 2000 lines; 50KB is file text truncation and not a directory access gate
|
|
6805
6809
|
- Any lines longer than ${MAX_LINE_LENGTH} characters will be truncated
|
|
6806
6810
|
- Results are returned using cat -n format, with line numbers starting at 1
|
|
6807
6811
|
- This tool allows reading images (eg PNG, JPG, etc). When reading an image file the contents are presented visually.
|
|
6808
6812
|
- This tool can read PDF files and return them as document blocks for analysis.
|
|
6809
6813
|
- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
|
|
6810
|
-
-
|
|
6814
|
+
- For wide repository exploration, still prefer Glob first, then use Read for focused file/directory inspection.
|
|
6811
6815
|
- You can call multiple tools in a single response. It is always better to speculatively read multiple potentially useful files in parallel.
|
|
6812
6816
|
- You will regularly be asked to read screenshots. If the user provides a path to a screenshot, ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths.
|
|
6813
6817
|
- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.
|
|
@@ -6825,9 +6829,17 @@ var PROMPT3 = `Reads a file from the local filesystem. You can access any file d
|
|
|
6825
6829
|
<example>
|
|
6826
6830
|
user: Check the database configuration
|
|
6827
6831
|
assistant: [uses Glob tool with pattern="**/config*.{ts,js,json}"]
|
|
6828
|
-
[uses Grep tool with pattern="database|db_" to find config files with db settings]
|
|
6832
|
+
[uses Grep tool with pattern="database|db_" to find config files with db settings]
|
|
6829
6833
|
[reads the confirmed config file]
|
|
6830
6834
|
</example>
|
|
6835
|
+
|
|
6836
|
+
### Example 3: Read Directory Structure Then Read File
|
|
6837
|
+
<example>
|
|
6838
|
+
user: Check the API module layout and read router implementation
|
|
6839
|
+
assistant: [uses Glob tool with pattern="**/api*"]
|
|
6840
|
+
[reads the confirmed api directory path to get one-level tree structure with Read]
|
|
6841
|
+
[reads the router file path found in that directory tree]
|
|
6842
|
+
</example>
|
|
6831
6843
|
`.trim();
|
|
6832
6844
|
|
|
6833
6845
|
// src/utils/fs/secureFile.ts
|
|
@@ -7465,7 +7477,9 @@ function toSmartTruncationFallbackEvent(input) {
|
|
|
7465
7477
|
// src/tools/filesystem/FileReadTool/FileReadTool.tsx
|
|
7466
7478
|
var MAX_LINES_TO_RENDER = 0;
|
|
7467
7479
|
var MAX_LINE_LENGTH2 = 2e3;
|
|
7468
|
-
var
|
|
7480
|
+
var MAX_TEXT_OUTPUT_BYTES = 50 * 1024;
|
|
7481
|
+
var MAX_TEXT_OUTPUT_LINES = 2e3;
|
|
7482
|
+
var DIRECTORY_DEFAULT_LIMIT = 200;
|
|
7469
7483
|
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".webp"]);
|
|
7470
7484
|
var MAX_WIDTH = 2e3;
|
|
7471
7485
|
var MAX_HEIGHT = 2e3;
|
|
@@ -7608,6 +7622,8 @@ var FileReadTool = {
|
|
|
7608
7622
|
}
|
|
7609
7623
|
), !verbose && numLines > MAX_LINES_TO_RENDER && /* @__PURE__ */ React13.createElement(Text13, { color: getTheme().secondaryText }, "... (+", numLines - MAX_LINES_TO_RENDER, " lines)"))));
|
|
7610
7624
|
}
|
|
7625
|
+
case "directory":
|
|
7626
|
+
return /* @__PURE__ */ React13.createElement(Box12, { justifyContent: "space-between", overflowX: "hidden", width: "100%" }, /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "row" }, /* @__PURE__ */ React13.createElement(Text13, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React13.createElement(Text13, null, "Read directory")));
|
|
7611
7627
|
}
|
|
7612
7628
|
},
|
|
7613
7629
|
renderToolUseRejectedMessage() {
|
|
@@ -7633,7 +7649,7 @@ var FileReadTool = {
|
|
|
7633
7649
|
if (similarFilename) {
|
|
7634
7650
|
message += ` Did you mean ${similarFilename}?`;
|
|
7635
7651
|
}
|
|
7636
|
-
message += "\nSuggestion: If the path came from search results,
|
|
7652
|
+
message += "\nSuggestion: If the path came from search results, confirm it with Glob/Grep first; for directory structure, read the directory path directly with Read (offset>=1, optional limit) before reading target files.";
|
|
7637
7653
|
message += "\nSuggestion: in multi-repo or multi-branch environments, confirm the current working directory and branch before locating.";
|
|
7638
7654
|
} else if (error.includes("too long")) {
|
|
7639
7655
|
message = "Path too long (max 4096 characters). Please provide a shorter path.";
|
|
@@ -7646,6 +7662,16 @@ var FileReadTool = {
|
|
|
7646
7662
|
};
|
|
7647
7663
|
}
|
|
7648
7664
|
const ext = path5.extname(fullFilePath).toLowerCase();
|
|
7665
|
+
const isDirectory = fileCheck.stats?.isDirectory ?? false;
|
|
7666
|
+
if (isDirectory) {
|
|
7667
|
+
if (offset !== void 0 && offset < 1) {
|
|
7668
|
+
return {
|
|
7669
|
+
result: false,
|
|
7670
|
+
message: "Invalid offset. For directory reads, offset must be >= 1."
|
|
7671
|
+
};
|
|
7672
|
+
}
|
|
7673
|
+
return { result: true };
|
|
7674
|
+
}
|
|
7649
7675
|
const fileSize = fileCheck.stats?.size ?? 0;
|
|
7650
7676
|
if (BINARY_EXTENSIONS.has(ext)) {
|
|
7651
7677
|
return {
|
|
@@ -7659,22 +7685,27 @@ var FileReadTool = {
|
|
|
7659
7685
|
message: "Empty image files cannot be processed."
|
|
7660
7686
|
};
|
|
7661
7687
|
}
|
|
7662
|
-
const isNotebook = ext === ".ipynb";
|
|
7663
|
-
const isPdf = ext === ".pdf";
|
|
7664
|
-
const isImage = IMAGE_EXTENSIONS.has(ext);
|
|
7665
|
-
if (!isImage && !isNotebook && !isPdf) {
|
|
7666
|
-
if (fileSize > MAX_OUTPUT_SIZE && !offset && !limit) {
|
|
7667
|
-
return {
|
|
7668
|
-
result: false,
|
|
7669
|
-
message: formatFileSizeError(fileSize)
|
|
7670
|
-
};
|
|
7671
|
-
}
|
|
7672
|
-
}
|
|
7673
7688
|
return { result: true };
|
|
7674
7689
|
},
|
|
7675
7690
|
async *call({ file_path, offset = 1, limit = void 0, symbol_name }, { readFileTimestamps }) {
|
|
7676
7691
|
const ext = path5.extname(file_path).toLowerCase();
|
|
7677
7692
|
const fullFilePath = normalizeFilePath(file_path);
|
|
7693
|
+
const fileInfo = secureFileService.safeGetFileInfo(fullFilePath);
|
|
7694
|
+
if (!fileInfo.success || !fileInfo.stats) {
|
|
7695
|
+
throw new Error(fileInfo.error || "Failed to access file");
|
|
7696
|
+
}
|
|
7697
|
+
if (fileInfo.stats.isDirectory) {
|
|
7698
|
+
if (offset < 1) {
|
|
7699
|
+
throw new Error("Invalid offset. For directory reads, offset must be >= 1.");
|
|
7700
|
+
}
|
|
7701
|
+
const directoryData = readDirectoryPage(fullFilePath, file_path, offset, limit);
|
|
7702
|
+
yield {
|
|
7703
|
+
type: "result",
|
|
7704
|
+
data: directoryData,
|
|
7705
|
+
resultForAssistant: this.renderResultForAssistant(directoryData)
|
|
7706
|
+
};
|
|
7707
|
+
return;
|
|
7708
|
+
}
|
|
7678
7709
|
let startLine = offset;
|
|
7679
7710
|
let finalLimit = limit;
|
|
7680
7711
|
if (symbol_name) {
|
|
@@ -7788,7 +7819,7 @@ var FileReadTool = {
|
|
|
7788
7819
|
);
|
|
7789
7820
|
}
|
|
7790
7821
|
}
|
|
7791
|
-
const { content,
|
|
7822
|
+
const { content, totalLines } = readTextContent(
|
|
7792
7823
|
fullFilePath,
|
|
7793
7824
|
zeroBasedOffset,
|
|
7794
7825
|
finalLimit
|
|
@@ -7796,19 +7827,21 @@ var FileReadTool = {
|
|
|
7796
7827
|
const truncatedLines = content.split(/\r?\n/).map(
|
|
7797
7828
|
(line) => line.length > MAX_LINE_LENGTH2 ? line.slice(0, MAX_LINE_LENGTH2) : line
|
|
7798
7829
|
).join("\n");
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
}
|
|
7830
|
+
const textPage = capTextOutput(truncatedLines, {
|
|
7831
|
+
startLine,
|
|
7832
|
+
maxLines: MAX_TEXT_OUTPUT_LINES,
|
|
7833
|
+
maxBytes: MAX_TEXT_OUTPUT_BYTES
|
|
7834
|
+
});
|
|
7804
7835
|
const data = {
|
|
7805
7836
|
type: "text",
|
|
7806
7837
|
file: {
|
|
7807
7838
|
filePath: file_path,
|
|
7808
|
-
content:
|
|
7809
|
-
numLines: lineCount,
|
|
7839
|
+
content: textPage.content,
|
|
7840
|
+
numLines: textPage.lineCount,
|
|
7810
7841
|
startLine,
|
|
7811
|
-
totalLines
|
|
7842
|
+
totalLines,
|
|
7843
|
+
truncated: textPage.truncated,
|
|
7844
|
+
nextOffset: textPage.nextOffset
|
|
7812
7845
|
}
|
|
7813
7846
|
};
|
|
7814
7847
|
yield {
|
|
@@ -7848,10 +7881,103 @@ var FileReadTool = {
|
|
|
7848
7881
|
content: data.file.content,
|
|
7849
7882
|
startLine: data.file.startLine
|
|
7850
7883
|
});
|
|
7884
|
+
case "directory":
|
|
7885
|
+
return data.file.content;
|
|
7851
7886
|
}
|
|
7852
7887
|
}
|
|
7853
7888
|
};
|
|
7854
|
-
|
|
7889
|
+
function readDirectoryPage(fullFilePath, sourceFilePath, offset, limit) {
|
|
7890
|
+
const entries = readdirSync(fullFilePath, { withFileTypes: true });
|
|
7891
|
+
const items = entries.map((entry) => ({
|
|
7892
|
+
name: entry.name,
|
|
7893
|
+
isDir: isDirectoryEntry(fullFilePath, entry)
|
|
7894
|
+
})).sort((a, b) => {
|
|
7895
|
+
if (a.isDir !== b.isDir) {
|
|
7896
|
+
return a.isDir ? -1 : 1;
|
|
7897
|
+
}
|
|
7898
|
+
return a.name.localeCompare(b.name);
|
|
7899
|
+
});
|
|
7900
|
+
const startIndex = Math.max(0, offset - 1);
|
|
7901
|
+
const pageSize = Math.max(1, limit ?? DIRECTORY_DEFAULT_LIMIT);
|
|
7902
|
+
if (items.length > 0 && startIndex >= items.length) {
|
|
7903
|
+
throw new Error(
|
|
7904
|
+
`Directory pagination offset out of range: offset=${offset}, totalEntries=${items.length}.`
|
|
7905
|
+
);
|
|
7906
|
+
}
|
|
7907
|
+
const pageItems = items.slice(startIndex, startIndex + pageSize);
|
|
7908
|
+
const truncated = startIndex + pageSize < items.length;
|
|
7909
|
+
const nextOffset = truncated ? startIndex + pageItems.length + 1 : void 0;
|
|
7910
|
+
const content = renderDirectoryTreePage(
|
|
7911
|
+
fullFilePath,
|
|
7912
|
+
pageItems,
|
|
7913
|
+
truncated,
|
|
7914
|
+
nextOffset,
|
|
7915
|
+
pageSize
|
|
7916
|
+
);
|
|
7917
|
+
return {
|
|
7918
|
+
type: "directory",
|
|
7919
|
+
file: {
|
|
7920
|
+
filePath: sourceFilePath,
|
|
7921
|
+
content,
|
|
7922
|
+
numEntries: pageItems.length,
|
|
7923
|
+
startEntry: offset,
|
|
7924
|
+
totalEntries: items.length,
|
|
7925
|
+
truncated,
|
|
7926
|
+
nextOffset
|
|
7927
|
+
}
|
|
7928
|
+
};
|
|
7929
|
+
}
|
|
7930
|
+
function isDirectoryEntry(fullFilePath, entry) {
|
|
7931
|
+
if (entry.isDirectory()) {
|
|
7932
|
+
return true;
|
|
7933
|
+
}
|
|
7934
|
+
try {
|
|
7935
|
+
return statSync7(path5.join(fullFilePath, entry.name)).isDirectory();
|
|
7936
|
+
} catch {
|
|
7937
|
+
return false;
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
function renderDirectoryTreePage(rootPath, pageItems, truncated, nextOffset, pageSize) {
|
|
7941
|
+
const rootLabel = rootPath.endsWith(path5.sep) ? rootPath : `${rootPath}${path5.sep}`;
|
|
7942
|
+
const lines = [rootLabel];
|
|
7943
|
+
for (let i = 0; i < pageItems.length; i++) {
|
|
7944
|
+
const connector = i === pageItems.length - 1 ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
7945
|
+
const suffix = pageItems[i].isDir ? path5.sep : "";
|
|
7946
|
+
lines.push(`${connector}${pageItems[i].name}${suffix}`);
|
|
7947
|
+
}
|
|
7948
|
+
if (truncated && nextOffset) {
|
|
7949
|
+
lines.push(`
|
|
7950
|
+
Use offset=${nextOffset} limit=${pageSize} to continue`);
|
|
7951
|
+
} else {
|
|
7952
|
+
lines.push("\nEnd of directory");
|
|
7953
|
+
}
|
|
7954
|
+
return lines.join("\n");
|
|
7955
|
+
}
|
|
7956
|
+
function capTextOutput(content, options) {
|
|
7957
|
+
const lines = content.split(/\r?\n/);
|
|
7958
|
+
const limitedByLines = lines.slice(0, options.maxLines);
|
|
7959
|
+
const bytes = [];
|
|
7960
|
+
let currentBytes = 0;
|
|
7961
|
+
for (let i = 0; i < limitedByLines.length; i++) {
|
|
7962
|
+
const segment = i === 0 ? limitedByLines[i] : `
|
|
7963
|
+
${limitedByLines[i]}`;
|
|
7964
|
+
const segmentBytes = Buffer.byteLength(segment, "utf8");
|
|
7965
|
+
if (currentBytes + segmentBytes > options.maxBytes) {
|
|
7966
|
+
break;
|
|
7967
|
+
}
|
|
7968
|
+
bytes.push(limitedByLines[i]);
|
|
7969
|
+
currentBytes += segmentBytes;
|
|
7970
|
+
}
|
|
7971
|
+
const lineCount = bytes.length;
|
|
7972
|
+
const truncated = lineCount < lines.length;
|
|
7973
|
+
const nextOffset = truncated ? options.startLine + lineCount : void 0;
|
|
7974
|
+
return {
|
|
7975
|
+
content: bytes.join("\n"),
|
|
7976
|
+
lineCount,
|
|
7977
|
+
truncated,
|
|
7978
|
+
nextOffset
|
|
7979
|
+
};
|
|
7980
|
+
}
|
|
7855
7981
|
var isSecurityError = (error) => {
|
|
7856
7982
|
const patterns = [
|
|
7857
7983
|
"outside allowed directories",
|
|
@@ -8174,16 +8300,9 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8174
8300
|
- You can call multiple tools in a single response. It is always better to speculatively perform multiple searches in parallel if they are potentially useful.
|
|
8175
8301
|
- This tool is for FINDING files.
|
|
8176
8302
|
|
|
8177
|
-
##
|
|
8178
|
-
-
|
|
8179
|
-
-
|
|
8180
|
-
- Example: \`src/*\` lists immediate children of src/ (like src/index.ts, src/components/, src/utils/)
|
|
8181
|
-
- Example: \`src/components/*\` lists immediate children of src/components/
|
|
8182
|
-
- Use this instead of bash \`ls\` command for directory exploration
|
|
8183
|
-
- **Pattern variations for one-level listing**:
|
|
8184
|
-
- \`dir/*\` matches both files and directories at one level (most common)
|
|
8185
|
-
- \`dir/*.ts\` matches only .ts files at one level
|
|
8186
|
-
- \`dir/*/\` matches only directories at one level (trailing slash filters to directories)
|
|
8303
|
+
## Directory Structure Guidance
|
|
8304
|
+
- For one-level directory structure, use Read directly on the directory path (offset>=1, optional limit)
|
|
8305
|
+
- Use Glob for file-path discovery and candidate narrowing, not as the primary one-level directory listing workflow
|
|
8187
8306
|
|
|
8188
8307
|
## Search Strategy
|
|
8189
8308
|
- **Broad-to-Narrow Pattern**: Start with a broad pattern, then narrow based on results.
|
|
@@ -8191,20 +8310,19 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8191
8310
|
- Step 2: Analyze results and refine with more specific patterns
|
|
8192
8311
|
- Example: "\`**/*.test.ts\`" \u2192 too many results \u2192 "src/**/auth*.test.ts"
|
|
8193
8312
|
- **Pattern Selection Guide**:
|
|
8194
|
-
- Unknown structure? Start with \`
|
|
8313
|
+
- Unknown structure? Start with \`**/*.{ext}\` to discover layout, then use Read on specific directory paths for one-level structure
|
|
8195
8314
|
- Looking for specific type? Use descriptive names: \`**/test*\`, \`**/config*\`
|
|
8196
8315
|
- In a specific area? Combine path + pattern: \`src/auth/**/*.ts\`
|
|
8197
8316
|
- **Discovery Workflow**: For unfamiliar codebases, run these in parallel:
|
|
8198
|
-
-
|
|
8317
|
+
- \`**/package.json\`, \`**/*.{ts,js,tsx,jsx}\`, \`**/README*\`, \`**/*config*.{ts,js,json}\`
|
|
8199
8318
|
- Analyze structure \u2192 refine search \u2192 read key files
|
|
8200
8319
|
- **Tool Collaboration**:
|
|
8201
|
-
-
|
|
8320
|
+
- Read \`directory_path\` \u2192 Get one-level directory tree structure
|
|
8202
8321
|
- Grep \u2192 After Glob finds files, use Grep to search content
|
|
8203
8322
|
- Read \u2192 Read the found file contents
|
|
8204
8323
|
|
|
8205
8324
|
## Usage Details
|
|
8206
8325
|
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
8207
|
-
- Use \`dir/*\` pattern to list immediate children of a directory (single level, non-recursive)
|
|
8208
8326
|
- Returns absolute file paths sorted by modification time (most recent first)
|
|
8209
8327
|
- Use this tool when you need to find files by name patterns
|
|
8210
8328
|
- Powered by ripgrep with \`--files\` mode for fast pattern matching
|
|
@@ -8216,40 +8334,33 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8216
8334
|
- **Truncated Results**: When results are truncated (limited to 100 files), narrow down using:
|
|
8217
8335
|
1. Add a more specific path: \`src/core/**/*.ts\` instead of \`**/*.ts\`
|
|
8218
8336
|
2. Use file extension filter: \`src/**/*.test.ts\` instead of \`src/**/*.ts\`
|
|
8219
|
-
3. Use
|
|
8337
|
+
3. Use Read on a specific directory path to confirm one-level structure, then target specific directories with Glob
|
|
8220
8338
|
|
|
8221
8339
|
## Typical Usage Examples
|
|
8222
8340
|
|
|
8223
|
-
### Example 1:
|
|
8224
|
-
<example>
|
|
8225
|
-
user: list files in the directory src/
|
|
8226
|
-
assistant: [uses Glob tool with pattern="src/*" to list immediate children]
|
|
8227
|
-
Result: src/index.ts, src/components/, src/utils/, src/App.tsx
|
|
8228
|
-
</example>
|
|
8229
|
-
|
|
8230
|
-
### Example 2: Project Structure Discovery (Unknown Codebase)
|
|
8341
|
+
### Example 1: Project Structure Discovery (Unknown Codebase)
|
|
8231
8342
|
<example>
|
|
8232
8343
|
user: I'm new to this project, what's the structure?
|
|
8233
|
-
assistant: [uses Glob tool with pattern="
|
|
8234
|
-
[
|
|
8235
|
-
[uses Glob tool with pattern="
|
|
8344
|
+
assistant: [uses Glob tool with pattern="**/package.json" to find project roots]
|
|
8345
|
+
[reads the confirmed source directory path to inspect one-level tree structure]
|
|
8346
|
+
[uses Glob tool with pattern="**/*.{ts,tsx,js,jsx}" to locate major source areas]
|
|
8236
8347
|
</example>
|
|
8237
8348
|
|
|
8238
|
-
### Example
|
|
8349
|
+
### Example 2: Find Files by Type in Specific Area
|
|
8239
8350
|
<example>
|
|
8240
8351
|
user: Find all test files in the auth module
|
|
8241
8352
|
assistant: [uses Glob tool with pattern="src/auth/**/*.test.ts"]
|
|
8242
8353
|
[uses Read tool to examine specific test files]
|
|
8243
8354
|
</example>
|
|
8244
8355
|
|
|
8245
|
-
### Example
|
|
8356
|
+
### Example 3: Config File Location (Deterministic)
|
|
8246
8357
|
<example>
|
|
8247
8358
|
user: Where is the webpack configuration?
|
|
8248
8359
|
assistant: [uses Glob tool with pattern="**/webpack*.{js,ts,json}"]
|
|
8249
8360
|
[uses Read tool on the matched config file]
|
|
8250
8361
|
</example>
|
|
8251
8362
|
|
|
8252
|
-
### Example
|
|
8363
|
+
### Example 4: Parallel Discovery for Entry Points
|
|
8253
8364
|
<example>
|
|
8254
8365
|
user: What are the main entry points of this application?
|
|
8255
8366
|
assistant: [uses Glob tool with pattern="**/index.{ts,js}"]
|
|
@@ -8258,7 +8369,7 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8258
8369
|
[uses Read tool to examine the entry point files]
|
|
8259
8370
|
</example>
|
|
8260
8371
|
|
|
8261
|
-
### Example
|
|
8372
|
+
### Example 5: Narrow Down After Broad Results
|
|
8262
8373
|
<example>
|
|
8263
8374
|
user: Find all TypeScript files in the project
|
|
8264
8375
|
assistant: [uses Glob tool with pattern="**/*.ts" - returns 500+ files, truncated]
|
|
@@ -8269,7 +8380,7 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8269
8380
|
|
|
8270
8381
|
// src/tools/filesystem/GlobTool/GlobTool.tsx
|
|
8271
8382
|
import { existsSync as existsSync6, statSync as statSync9 } from "fs";
|
|
8272
|
-
import { isAbsolute as isAbsolute6, join as
|
|
8383
|
+
import { isAbsolute as isAbsolute6, join as join5, relative as relative8, resolve as resolve6 } from "path";
|
|
8273
8384
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8274
8385
|
var inputSchema6 = z6.strictObject({
|
|
8275
8386
|
pattern: z6.string().describe("The glob pattern to match files against"),
|
|
@@ -8356,7 +8467,7 @@ var GlobTool = {
|
|
|
8356
8467
|
searchPath,
|
|
8357
8468
|
abortController.signal
|
|
8358
8469
|
);
|
|
8359
|
-
let files = raw.map((p) => isAbsolute6(p) ? p :
|
|
8470
|
+
let files = raw.map((p) => isAbsolute6(p) ? p : join5(searchPath, p));
|
|
8360
8471
|
const scopedPath = resolve6(searchPath);
|
|
8361
8472
|
let semanticNotice;
|
|
8362
8473
|
if (semantic && files.length === 0) {
|
|
@@ -8403,9 +8514,9 @@ var GlobTool = {
|
|
|
8403
8514
|
renderResultForAssistant(output) {
|
|
8404
8515
|
let result = output.filenames.join("\n");
|
|
8405
8516
|
if (output.filenames.length === 0) {
|
|
8406
|
-
result =
|
|
8517
|
+
result = "No files found\nSuggestion: Verify the search path, broaden the pattern (e.g., src/**/*), and if you need structure clues read the target directory path directly with Read.";
|
|
8407
8518
|
} else if (output.truncated) {
|
|
8408
|
-
result += '\n(Results truncated to 100 files. Narrow down: 1) Add specific path like "src/core/**/*" 2) Filter by extension like "*.test.ts" 3)
|
|
8519
|
+
result += '\n(Results truncated to 100 files. Narrow down: 1) Add specific path like "src/core/**/*" 2) Filter by extension like "*.test.ts" 3) Read a target directory path with Read for structure confirmation.)';
|
|
8409
8520
|
}
|
|
8410
8521
|
if (output.semanticNotice) {
|
|
8411
8522
|
return `${result}
|
|
@@ -8449,7 +8560,7 @@ var DESCRIPTION5 = `A powerful fast content search tool that works with any code
|
|
|
8449
8560
|
- No results? Broaden pattern, try case-insensitive (\`-i\`), or try alternative keywords
|
|
8450
8561
|
- Wrong results? Adjust pattern, check regex syntax, try alternative keywords
|
|
8451
8562
|
- **Tool Collaboration**:
|
|
8452
|
-
-
|
|
8563
|
+
- Read "directory_path" \u2192 Confirm one-level directory structure for search scope
|
|
8453
8564
|
- Glob "file_path" \u2192 Confirm file path existence
|
|
8454
8565
|
- Read \u2192 Read specific content of matched files
|
|
8455
8566
|
- LspTool \u2192 Trace definitions and references (replace manual Grep tracing)
|
|
@@ -8679,14 +8790,14 @@ var GrepTool = {
|
|
|
8679
8790
|
|
|
8680
8791
|
${result.semanticNotice}` : base;
|
|
8681
8792
|
if (result.mode === "content") {
|
|
8682
|
-
const base = result.content && result.content.length > 0 ? truncateToCharBudget(result.content) :
|
|
8793
|
+
const base = result.content && result.content.length > 0 ? truncateToCharBudget(result.content) : "No matches found\nSuggestion: Read the target directory path to confirm one-level structure and search scope, then broaden matching conditions (case/regex/keyword variants, semantic=true), and if needed switch to content mode or expand the file set before searching again.";
|
|
8683
8794
|
const withPagination = pagination ? `${base}
|
|
8684
8795
|
|
|
8685
8796
|
[Showing results with pagination = ${pagination}]` : base;
|
|
8686
8797
|
return appendNotice(withPagination);
|
|
8687
8798
|
}
|
|
8688
8799
|
if (result.mode === "count") {
|
|
8689
|
-
const base = result.content && result.content.length > 0 ? truncateToCharBudget(result.content) :
|
|
8800
|
+
const base = result.content && result.content.length > 0 ? truncateToCharBudget(result.content) : "No matches found\nSuggestion: Read the target directory path to confirm one-level structure and search scope, then broaden matching conditions (case/regex/keyword variants, semantic=true), and if needed switch to content mode or expand the file set before searching again.";
|
|
8690
8801
|
const numMatches = result.numMatches ?? 0;
|
|
8691
8802
|
const numFiles = result.numFiles ?? 0;
|
|
8692
8803
|
const summary = base + `
|
|
@@ -8696,7 +8807,7 @@ Found ${numMatches} total ${numMatches === 1 ? "occurrence" : "occurrences"} acr
|
|
|
8696
8807
|
}
|
|
8697
8808
|
if (result.numFiles === 0) {
|
|
8698
8809
|
return appendNotice(
|
|
8699
|
-
|
|
8810
|
+
"No files found\nSuggestion: Read the target directory path to confirm one-level structure and search scope, then broaden matching conditions (case/regex/keyword variants, semantic=true), and if needed switch to content mode or expand the file set before searching again."
|
|
8700
8811
|
);
|
|
8701
8812
|
}
|
|
8702
8813
|
const header = `Found ${result.numFiles} file${result.numFiles === 1 ? "" : "s"}${pagination ? ` ${pagination}` : ""}
|
|
@@ -11052,7 +11163,7 @@ function PressEnterToContinue() {
|
|
|
11052
11163
|
}
|
|
11053
11164
|
|
|
11054
11165
|
// src/services/stability/runtimeAssetHealth/checks/ripgrep.ts
|
|
11055
|
-
import { join as
|
|
11166
|
+
import { join as join6, sep as sep4 } from "node:path";
|
|
11056
11167
|
import envPaths from "env-paths";
|
|
11057
11168
|
async function resolveRipgrepPath() {
|
|
11058
11169
|
return getRipgrepPath();
|
|
@@ -11065,7 +11176,7 @@ function detectRipgrepSource(resolvedPath) {
|
|
|
11065
11176
|
if (explicit && normalizePath(explicit) === normalizePath(resolvedPath)) {
|
|
11066
11177
|
return "explicit";
|
|
11067
11178
|
}
|
|
11068
|
-
if (resolvedPath.includes(`${
|
|
11179
|
+
if (resolvedPath.includes(`${sep4}resources${sep4}ripgrep${sep4}`)) {
|
|
11069
11180
|
return "vendor";
|
|
11070
11181
|
}
|
|
11071
11182
|
const cacheRoot = getRipgrepCacheRoot();
|
|
@@ -11111,14 +11222,14 @@ function resolveRipgrepPolicyVisibility() {
|
|
|
11111
11222
|
function getRipgrepCacheRoot() {
|
|
11112
11223
|
const override = process.env.PYB_RIPGREP_CACHE_DIR?.trim();
|
|
11113
11224
|
if (override) return override;
|
|
11114
|
-
return
|
|
11225
|
+
return join6(envPaths("pyb").cache, "ripgrep");
|
|
11115
11226
|
}
|
|
11116
11227
|
function normalizePath(value) {
|
|
11117
|
-
return value.replaceAll("/",
|
|
11228
|
+
return value.replaceAll("/", sep4).replaceAll("\\", sep4).toLowerCase();
|
|
11118
11229
|
}
|
|
11119
11230
|
function isLikelyPathResolved(value) {
|
|
11120
11231
|
const normalized = normalizePath(value);
|
|
11121
|
-
return normalized.includes(`${
|
|
11232
|
+
return normalized.includes(`${sep4}bin${sep4}`) || normalized.endsWith(`${sep4}rg`);
|
|
11122
11233
|
}
|
|
11123
11234
|
|
|
11124
11235
|
// src/services/stability/runtimeAssetHealth/diagnostics.ts
|
|
@@ -11541,7 +11652,7 @@ var help_default = help;
|
|
|
11541
11652
|
import * as React28 from "react";
|
|
11542
11653
|
import { Box as Box21, Text as Text24 } from "ink";
|
|
11543
11654
|
import { existsSync as existsSync8 } from "fs";
|
|
11544
|
-
import { join as
|
|
11655
|
+
import { join as join7 } from "path";
|
|
11545
11656
|
import { homedir as homedir6 } from "os";
|
|
11546
11657
|
|
|
11547
11658
|
// src/constants/releaseNotes.ts
|
|
@@ -11589,7 +11700,7 @@ function ProjectOnboarding({
|
|
|
11589
11700
|
if (!showOnboarding && !hasReleaseNotes) {
|
|
11590
11701
|
return null;
|
|
11591
11702
|
}
|
|
11592
|
-
const workspaceHasProjectGuide = existsSync8(
|
|
11703
|
+
const workspaceHasProjectGuide = existsSync8(join7(workspaceDir, PROJECT_FILE));
|
|
11593
11704
|
const isWorkspaceDirEmpty = isDirEmpty(workspaceDir);
|
|
11594
11705
|
const shouldRecommendProjectGuide = !workspaceHasProjectGuide && !isWorkspaceDirEmpty;
|
|
11595
11706
|
const theme = getTheme();
|
|
@@ -11744,8 +11855,8 @@ function getReplStaticPrefixLength(orderedMessages, allMessages, unresolvedToolU
|
|
|
11744
11855
|
}
|
|
11745
11856
|
|
|
11746
11857
|
// src/commands/messages-debug.ts
|
|
11747
|
-
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync6, statSync as statSync10 } from "fs";
|
|
11748
|
-
import { join as
|
|
11858
|
+
import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync6, statSync as statSync10 } from "fs";
|
|
11859
|
+
import { join as join8 } from "path";
|
|
11749
11860
|
function isDebugMode() {
|
|
11750
11861
|
return process.argv.includes("--debug") || process.argv.includes("--debug-verbose");
|
|
11751
11862
|
}
|
|
@@ -11777,11 +11888,11 @@ function getProgressText(message) {
|
|
|
11777
11888
|
function getLatestMessagesLogFile() {
|
|
11778
11889
|
const dir = CACHE_PATHS.messages();
|
|
11779
11890
|
if (!existsSync9(dir)) return null;
|
|
11780
|
-
const files =
|
|
11891
|
+
const files = readdirSync2(dir).filter((f) => f.endsWith(".json"));
|
|
11781
11892
|
if (files.length === 0) return null;
|
|
11782
11893
|
let best = null;
|
|
11783
11894
|
for (const file of files) {
|
|
11784
|
-
const fullPath =
|
|
11895
|
+
const fullPath = join8(dir, file);
|
|
11785
11896
|
let mtimeMs = 0;
|
|
11786
11897
|
try {
|
|
11787
11898
|
mtimeMs = statSync10(fullPath).mtimeMs;
|
|
@@ -12175,7 +12286,7 @@ async function createAndStoreApiKey(accessToken) {
|
|
|
12175
12286
|
}
|
|
12176
12287
|
saveGlobalConfig(config2);
|
|
12177
12288
|
try {
|
|
12178
|
-
const { resetAnthropicClient } = await import("./llm-
|
|
12289
|
+
const { resetAnthropicClient } = await import("./llm-UPZIAGPI.js");
|
|
12179
12290
|
resetAnthropicClient();
|
|
12180
12291
|
} catch {
|
|
12181
12292
|
}
|
|
@@ -16599,7 +16710,7 @@ async function refreshPluginRuntimeFromInstalls() {
|
|
|
16599
16710
|
const existingRoots = getSessionPlugins().map((p) => p.rootDir);
|
|
16600
16711
|
const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
|
|
16601
16712
|
if (dirs.length === 0) return [];
|
|
16602
|
-
const { configureSessionPlugins } = await import("./pluginRuntime-
|
|
16713
|
+
const { configureSessionPlugins } = await import("./pluginRuntime-SROFDMKU.js");
|
|
16603
16714
|
const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
|
|
16604
16715
|
return errors;
|
|
16605
16716
|
}
|
|
@@ -17274,7 +17385,7 @@ async function call(onDone, context) {
|
|
|
17274
17385
|
ModelConfig,
|
|
17275
17386
|
{
|
|
17276
17387
|
onClose: () => {
|
|
17277
|
-
import("./model-
|
|
17388
|
+
import("./model-PLE3KNNX.js").then(({ reloadModelManager: reloadModelManager2 }) => {
|
|
17278
17389
|
reloadModelManager2();
|
|
17279
17390
|
triggerModelConfigChange();
|
|
17280
17391
|
onDone();
|
|
@@ -18251,7 +18362,7 @@ function resolveAutoMemoryFlags(env2 = process.env) {
|
|
|
18251
18362
|
|
|
18252
18363
|
// src/services/memory/inject.ts
|
|
18253
18364
|
import { existsSync as existsSync10, readFileSync as readFileSync7 } from "fs";
|
|
18254
|
-
import { join as
|
|
18365
|
+
import { join as join9 } from "path";
|
|
18255
18366
|
|
|
18256
18367
|
// src/services/memory/paths.ts
|
|
18257
18368
|
import { isAbsolute as isAbsolute8, relative as relative10, resolve as resolve8 } from "path";
|
|
@@ -18371,7 +18482,7 @@ function getMemoryFilePath(input) {
|
|
|
18371
18482
|
agentId,
|
|
18372
18483
|
agentType: input.agentType
|
|
18373
18484
|
});
|
|
18374
|
-
return
|
|
18485
|
+
return join9(agentMemoryDir, "MEMORY.md");
|
|
18375
18486
|
}
|
|
18376
18487
|
function truncateByLines(content, maxLines) {
|
|
18377
18488
|
return content.split("\n").slice(0, maxLines).join("\n");
|
|
@@ -18740,12 +18851,12 @@ import {
|
|
|
18740
18851
|
mkdirSync as mkdirSync5,
|
|
18741
18852
|
openSync,
|
|
18742
18853
|
readFileSync as readFileSync8,
|
|
18743
|
-
readdirSync as
|
|
18854
|
+
readdirSync as readdirSync3,
|
|
18744
18855
|
renameSync as renameSync2,
|
|
18745
18856
|
rmSync,
|
|
18746
18857
|
writeFileSync as writeFileSync3
|
|
18747
18858
|
} from "fs";
|
|
18748
|
-
import { join as
|
|
18859
|
+
import { join as join10 } from "path";
|
|
18749
18860
|
import { homedir as homedir7 } from "os";
|
|
18750
18861
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
18751
18862
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -18970,15 +19081,15 @@ function resolveGlobalTaskRootDir() {
|
|
|
18970
19081
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
18971
19082
|
if (override) return override;
|
|
18972
19083
|
const home = homedir7();
|
|
18973
|
-
const pybDir =
|
|
19084
|
+
const pybDir = join10(home, ".pyb");
|
|
18974
19085
|
if (existsSync11(pybDir)) return pybDir;
|
|
18975
|
-
const claudeDir =
|
|
19086
|
+
const claudeDir = join10(home, ".claude");
|
|
18976
19087
|
if (existsSync11(claudeDir)) return claudeDir;
|
|
18977
19088
|
return pybDir;
|
|
18978
19089
|
}
|
|
18979
19090
|
function findBaseDirWithList(listId, candidates) {
|
|
18980
19091
|
for (const candidate of candidates) {
|
|
18981
|
-
if (existsSync11(
|
|
19092
|
+
if (existsSync11(join10(candidate, listId))) return candidate;
|
|
18982
19093
|
}
|
|
18983
19094
|
return null;
|
|
18984
19095
|
}
|
|
@@ -19015,39 +19126,39 @@ function getTaskListId(options) {
|
|
|
19015
19126
|
}
|
|
19016
19127
|
function resolveTaskBaseDir(context, cwd) {
|
|
19017
19128
|
if (context.scope === "project") {
|
|
19018
|
-
const pybDir =
|
|
19019
|
-
const claudeDir =
|
|
19129
|
+
const pybDir = join10(cwd, ".pyb");
|
|
19130
|
+
const claudeDir = join10(cwd, ".claude");
|
|
19020
19131
|
const hasProjectPyb = existsSync11(pybDir);
|
|
19021
19132
|
const hasProjectClaude = existsSync11(claudeDir);
|
|
19022
19133
|
const projectRoot = hasProjectPyb ? pybDir : hasProjectClaude ? claudeDir : pybDir;
|
|
19023
19134
|
const override2 = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19024
|
-
const defaultBaseDir2 = !hasProjectPyb && !hasProjectClaude && override2 ?
|
|
19135
|
+
const defaultBaseDir2 = !hasProjectPyb && !hasProjectClaude && override2 ? join10(override2, "tasks") : join10(projectRoot, "tasks");
|
|
19025
19136
|
const candidates2 = [
|
|
19026
|
-
|
|
19027
|
-
|
|
19028
|
-
...override2 ? [
|
|
19137
|
+
join10(cwd, ".pyb", "tasks"),
|
|
19138
|
+
join10(cwd, ".claude", "tasks"),
|
|
19139
|
+
...override2 ? [join10(override2, "tasks")] : [],
|
|
19029
19140
|
resolveXdgDataPath("tasks")
|
|
19030
19141
|
];
|
|
19031
19142
|
return findBaseDirWithList(context.listId, candidates2) ?? defaultBaseDir2;
|
|
19032
19143
|
}
|
|
19033
19144
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19034
|
-
const globalCandidates = override ? [
|
|
19035
|
-
|
|
19036
|
-
|
|
19145
|
+
const globalCandidates = override ? [join10(override, "tasks")] : [
|
|
19146
|
+
join10(homedir7(), ".pyb", "tasks"),
|
|
19147
|
+
join10(homedir7(), ".claude", "tasks")
|
|
19037
19148
|
];
|
|
19038
|
-
const defaultBaseDir =
|
|
19149
|
+
const defaultBaseDir = join10(resolveGlobalTaskRootDir(), "tasks");
|
|
19039
19150
|
const candidates = [...globalCandidates, resolveXdgDataPath("tasks")];
|
|
19040
19151
|
return findBaseDirWithList(context.listId, candidates) ?? defaultBaseDir;
|
|
19041
19152
|
}
|
|
19042
19153
|
function buildTaskListPaths(baseDir, listId) {
|
|
19043
|
-
const listDir =
|
|
19154
|
+
const listDir = join10(baseDir, listId);
|
|
19044
19155
|
return {
|
|
19045
19156
|
listId,
|
|
19046
19157
|
baseDir,
|
|
19047
19158
|
listDir,
|
|
19048
19159
|
tasksDir: listDir,
|
|
19049
|
-
lockPath:
|
|
19050
|
-
highwatermarkPath:
|
|
19160
|
+
lockPath: join10(listDir, ".lock"),
|
|
19161
|
+
highwatermarkPath: join10(listDir, ".highwatermark")
|
|
19051
19162
|
};
|
|
19052
19163
|
}
|
|
19053
19164
|
function getTaskListPaths(listId) {
|
|
@@ -19061,26 +19172,26 @@ function sortReadPaths(paths) {
|
|
|
19061
19172
|
return [...paths].sort((a, b) => priority[a.source] - priority[b.source]);
|
|
19062
19173
|
}
|
|
19063
19174
|
function resolveSourceForBaseDir(baseDir) {
|
|
19064
|
-
if (baseDir.includes(`${
|
|
19065
|
-
if (baseDir.includes(`${
|
|
19066
|
-
if (baseDir.includes(`${
|
|
19067
|
-
if (baseDir.includes(`${
|
|
19175
|
+
if (baseDir.includes(`${join10(".pyb", "tasks")}`)) return "pyb";
|
|
19176
|
+
if (baseDir.includes(`${join10(".claude", "tasks")}`)) return "claude";
|
|
19177
|
+
if (baseDir.includes(`${join10(".pyb")}`)) return "pyb";
|
|
19178
|
+
if (baseDir.includes(`${join10(".claude")}`)) return "claude";
|
|
19068
19179
|
return "other";
|
|
19069
19180
|
}
|
|
19070
19181
|
function getTaskListReadPaths(listId) {
|
|
19071
19182
|
const context = getTaskListContext({ listId });
|
|
19072
19183
|
const cwd = getCwd();
|
|
19073
|
-
const projectPyb =
|
|
19074
|
-
const projectClaude =
|
|
19184
|
+
const projectPyb = join10(cwd, ".pyb", "tasks");
|
|
19185
|
+
const projectClaude = join10(cwd, ".claude", "tasks");
|
|
19075
19186
|
if (context.scope === "project") {
|
|
19076
19187
|
const existing2 = [];
|
|
19077
|
-
if (existsSync11(
|
|
19188
|
+
if (existsSync11(join10(projectPyb, context.listId))) {
|
|
19078
19189
|
existing2.push({
|
|
19079
19190
|
...buildTaskListPaths(projectPyb, context.listId),
|
|
19080
19191
|
source: "pyb"
|
|
19081
19192
|
});
|
|
19082
19193
|
}
|
|
19083
|
-
if (existsSync11(
|
|
19194
|
+
if (existsSync11(join10(projectClaude, context.listId))) {
|
|
19084
19195
|
existing2.push({
|
|
19085
19196
|
...buildTaskListPaths(projectClaude, context.listId),
|
|
19086
19197
|
source: "claude"
|
|
@@ -19091,18 +19202,18 @@ function getTaskListReadPaths(listId) {
|
|
|
19091
19202
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19092
19203
|
const globalCandidates = override ? [
|
|
19093
19204
|
{
|
|
19094
|
-
baseDir:
|
|
19095
|
-
source: resolveSourceForBaseDir(
|
|
19205
|
+
baseDir: join10(override, "tasks"),
|
|
19206
|
+
source: resolveSourceForBaseDir(join10(override, "tasks"))
|
|
19096
19207
|
}
|
|
19097
19208
|
] : [
|
|
19098
|
-
{ baseDir:
|
|
19099
|
-
{ baseDir:
|
|
19209
|
+
{ baseDir: join10(homedir7(), ".pyb", "tasks"), source: "pyb" },
|
|
19210
|
+
{ baseDir: join10(homedir7(), ".claude", "tasks"), source: "claude" }
|
|
19100
19211
|
];
|
|
19101
19212
|
const candidates = [
|
|
19102
19213
|
...globalCandidates,
|
|
19103
19214
|
{ baseDir: resolveXdgDataPath("tasks"), source: "other" }
|
|
19104
19215
|
];
|
|
19105
|
-
const existing = candidates.filter((candidate) => existsSync11(
|
|
19216
|
+
const existing = candidates.filter((candidate) => existsSync11(join10(candidate.baseDir, context.listId))).map((candidate) => ({
|
|
19106
19217
|
...buildTaskListPaths(candidate.baseDir, context.listId),
|
|
19107
19218
|
source: candidate.source
|
|
19108
19219
|
}));
|
|
@@ -19289,7 +19400,7 @@ function persistBlocksForPaths(paths) {
|
|
|
19289
19400
|
const prevBlockedBy = normalizeIds(existing?.blockedBy);
|
|
19290
19401
|
const nextBlockedBy = normalizeIds(task.blockedBy);
|
|
19291
19402
|
const raw = readJson(
|
|
19292
|
-
|
|
19403
|
+
join10(paths.tasksDir, `${task.id}.json`)
|
|
19293
19404
|
);
|
|
19294
19405
|
const missingBlocks = !raw || !("blocks" in raw);
|
|
19295
19406
|
const missingBlockedBy = !raw || !("blockedBy" in raw);
|
|
@@ -19299,7 +19410,7 @@ function persistBlocksForPaths(paths) {
|
|
|
19299
19410
|
continue;
|
|
19300
19411
|
updated += 1;
|
|
19301
19412
|
fixedTaskIdSet.add(task.id);
|
|
19302
|
-
writeJsonAtomic(
|
|
19413
|
+
writeJsonAtomic(join10(paths.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19303
19414
|
}
|
|
19304
19415
|
return {
|
|
19305
19416
|
updated,
|
|
@@ -19337,8 +19448,8 @@ function applyLegacyBlocks(tasks) {
|
|
|
19337
19448
|
}
|
|
19338
19449
|
function readTasksFromDisk(paths) {
|
|
19339
19450
|
if (!existsSync11(paths.tasksDir)) return [];
|
|
19340
|
-
const files =
|
|
19341
|
-
return files.map((file) => readTaskFile(
|
|
19451
|
+
const files = readdirSync3(paths.tasksDir).filter((file) => file.endsWith(".json"));
|
|
19452
|
+
return files.map((file) => readTaskFile(join10(paths.tasksDir, file))).filter(Boolean);
|
|
19342
19453
|
}
|
|
19343
19454
|
function applyBlocksMap(tasks, map) {
|
|
19344
19455
|
return tasks.map((task) => ({
|
|
@@ -19353,7 +19464,7 @@ function buildTaskListForPaths(paths) {
|
|
|
19353
19464
|
var legacyFiles = ["index.json", "meta.json", "events.jsonl"];
|
|
19354
19465
|
function cleanupLegacyFiles(paths) {
|
|
19355
19466
|
for (const file of legacyFiles) {
|
|
19356
|
-
const path6 =
|
|
19467
|
+
const path6 = join10(paths.listDir, file);
|
|
19357
19468
|
if (existsSync11(path6)) {
|
|
19358
19469
|
rmSync(path6, { force: true });
|
|
19359
19470
|
}
|
|
@@ -19361,7 +19472,7 @@ function cleanupLegacyFiles(paths) {
|
|
|
19361
19472
|
}
|
|
19362
19473
|
function getMaxIdFromTasksDir(paths) {
|
|
19363
19474
|
if (!existsSync11(paths.tasksDir)) return 0;
|
|
19364
|
-
const files =
|
|
19475
|
+
const files = readdirSync3(paths.tasksDir).filter((file) => file.endsWith(".json"));
|
|
19365
19476
|
let maxId = 0;
|
|
19366
19477
|
for (const file of files) {
|
|
19367
19478
|
const numeric = Number(file.replace(/\.json$/, ""));
|
|
@@ -19613,7 +19724,7 @@ function createTask(input, options) {
|
|
|
19613
19724
|
blocks: [],
|
|
19614
19725
|
blockedBy: input.blockedBy ?? []
|
|
19615
19726
|
};
|
|
19616
|
-
writeJson(
|
|
19727
|
+
writeJson(join10(paths.tasksDir, `${id}.json`), serializeTaskRecord(record));
|
|
19617
19728
|
if ((record.blockedBy ?? []).length > 0) {
|
|
19618
19729
|
persistBlocksForPaths(paths);
|
|
19619
19730
|
}
|
|
@@ -19625,7 +19736,7 @@ function createTask(input, options) {
|
|
|
19625
19736
|
function getTask(id, options) {
|
|
19626
19737
|
const pathsList = getTaskListReadPaths(options?.listId);
|
|
19627
19738
|
for (const paths of pathsList) {
|
|
19628
|
-
const taskPath =
|
|
19739
|
+
const taskPath = join10(paths.tasksDir, `${id}.json`);
|
|
19629
19740
|
if (!existsSync11(taskPath)) continue;
|
|
19630
19741
|
const task = readTaskFile(taskPath);
|
|
19631
19742
|
if (task) return task;
|
|
@@ -19651,7 +19762,7 @@ function updateTask(id, updates, options) {
|
|
|
19651
19762
|
}
|
|
19652
19763
|
const pathsList = getTaskListReadPaths(options?.listId);
|
|
19653
19764
|
const target = pathsList.find(
|
|
19654
|
-
(paths) => existsSync11(
|
|
19765
|
+
(paths) => existsSync11(join10(paths.tasksDir, `${id}.json`))
|
|
19655
19766
|
);
|
|
19656
19767
|
if (!target) {
|
|
19657
19768
|
emitTaskBoundaryTelemetryEvent("TASK_UPDATE_NOT_FOUND_NO_SIDE_EFFECT", {
|
|
@@ -19701,18 +19812,18 @@ function updateTask(id, updates, options) {
|
|
|
19701
19812
|
}
|
|
19702
19813
|
for (const task of allAfter) {
|
|
19703
19814
|
if (forceWriteIds.has(task.id)) {
|
|
19704
|
-
writeJsonAtomic(
|
|
19815
|
+
writeJsonAtomic(join10(target.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19705
19816
|
continue;
|
|
19706
19817
|
}
|
|
19707
19818
|
const prev = beforeById.get(task.id);
|
|
19708
19819
|
if (!prev) {
|
|
19709
|
-
writeJsonAtomic(
|
|
19820
|
+
writeJsonAtomic(join10(target.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19710
19821
|
continue;
|
|
19711
19822
|
}
|
|
19712
19823
|
const prevSerialized = JSON.stringify(serializeTaskRecord(prev));
|
|
19713
19824
|
const nextSerialized = JSON.stringify(serializeTaskRecord(task));
|
|
19714
19825
|
if (prevSerialized === nextSerialized) continue;
|
|
19715
|
-
writeJsonAtomic(
|
|
19826
|
+
writeJsonAtomic(join10(target.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19716
19827
|
}
|
|
19717
19828
|
const depsChanged2 = normalizeIds(existing.blockedBy).join(",") !== normalizeIds(updated.blockedBy).join(",") || normalizeIds(existing.blocks).join(",") !== normalizeIds(updated.blocks).join(",");
|
|
19718
19829
|
if (depsChanged2 || Boolean(unlockResult)) {
|
|
@@ -21188,33 +21299,33 @@ async function getMainConversationContextLimit() {
|
|
|
21188
21299
|
return 2e5;
|
|
21189
21300
|
}
|
|
21190
21301
|
}
|
|
21191
|
-
var COMPRESSION_PROMPT2 = `
|
|
21192
|
-
Focus on information that would be helpful for continuing the conversation, including what we did, what we're doing, which files we're working on, and what we're going to do next.
|
|
21193
|
-
The summary that you construct will be used so that another agent can read it and continue the work.
|
|
21194
|
-
|
|
21195
|
-
When constructing the summary, try to stick to this template:
|
|
21196
|
-
---
|
|
21197
|
-
## Goal
|
|
21302
|
+
var COMPRESSION_PROMPT2 = `Please provide a comprehensive summary of our conversation structured as follows:
|
|
21198
21303
|
|
|
21199
|
-
|
|
21304
|
+
## Technical Context
|
|
21305
|
+
Development environment, tools, frameworks, and configurations in use. Programming languages, libraries, and technical constraints. File structure, directory organization, and project architecture.
|
|
21200
21306
|
|
|
21201
|
-
##
|
|
21307
|
+
## Project Overview
|
|
21308
|
+
Main project goals, features, and scope. Key components, modules, and their relationships. Data models, APIs, and integration patterns.
|
|
21202
21309
|
|
|
21203
|
-
|
|
21204
|
-
|
|
21310
|
+
## Code Changes
|
|
21311
|
+
Files created, modified, or analyzed during our conversation. Specific code implementations, functions, and algorithms added. Configuration changes and structural modifications.
|
|
21205
21312
|
|
|
21206
|
-
##
|
|
21313
|
+
## Debugging & Issues
|
|
21314
|
+
Problems encountered and their root causes. Solutions implemented and their effectiveness. Error messages, logs, and diagnostic information.
|
|
21207
21315
|
|
|
21208
|
-
|
|
21316
|
+
## Current Status
|
|
21317
|
+
What we just completed successfully. Current state of the codebase and any ongoing work. Test results, validation steps, and verification performed.
|
|
21209
21318
|
|
|
21210
|
-
##
|
|
21319
|
+
## Pending Tasks
|
|
21320
|
+
Immediate next steps and priorities. Planned features, improvements, and refactoring. Known issues, technical debt, and areas needing attention.
|
|
21211
21321
|
|
|
21212
|
-
|
|
21322
|
+
## User Preferences
|
|
21323
|
+
Coding style, formatting, and organizational preferences. Communication patterns and feedback style. Tool choices and workflow preferences.
|
|
21213
21324
|
|
|
21214
|
-
##
|
|
21325
|
+
## Key Decisions
|
|
21326
|
+
Important technical decisions made and their rationale. Alternative approaches considered and why they were rejected. Trade-offs accepted and their implications.
|
|
21215
21327
|
|
|
21216
|
-
|
|
21217
|
-
---`;
|
|
21328
|
+
Focus on information essential for continuing the conversation effectively, including specific details about code, files, errors, and plans.`;
|
|
21218
21329
|
var AUTO_COMPACT_NOTICE = "Context automatically compressed due to token limit.";
|
|
21219
21330
|
var RECOVERED_FILE_MARKER2 = "**Recovered File:";
|
|
21220
21331
|
var CONVERSATION_SUMMARY_LIMITS = {
|
|
@@ -24340,10 +24451,33 @@ function createErrorToolResultBlock(args) {
|
|
|
24340
24451
|
}
|
|
24341
24452
|
|
|
24342
24453
|
// src/app/queryRuntime/toolExecution.ts
|
|
24343
|
-
|
|
24454
|
+
var DEFAULT_TOOL_TIMEOUT_MS = 45e3;
|
|
24455
|
+
function resolveToolTimeoutMs() {
|
|
24456
|
+
const raw = Number(process.env.PYB_TOOL_TIMEOUT_MS ?? DEFAULT_TOOL_TIMEOUT_MS);
|
|
24457
|
+
if (!Number.isFinite(raw) || raw <= 0) {
|
|
24458
|
+
return DEFAULT_TOOL_TIMEOUT_MS;
|
|
24459
|
+
}
|
|
24460
|
+
return raw;
|
|
24461
|
+
}
|
|
24462
|
+
async function consumeGeneratorWithTimeout(generator, timeoutMs, toolName) {
|
|
24344
24463
|
const results = [];
|
|
24345
|
-
|
|
24346
|
-
|
|
24464
|
+
while (true) {
|
|
24465
|
+
let timer;
|
|
24466
|
+
const nextPromise = generator.next();
|
|
24467
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
24468
|
+
timer = setTimeout(() => {
|
|
24469
|
+
reject(new Error(`TOOL_TIMEOUT:${toolName}:${timeoutMs}`));
|
|
24470
|
+
}, timeoutMs);
|
|
24471
|
+
});
|
|
24472
|
+
const nextResult = await Promise.race([nextPromise, timeoutPromise]).finally(() => {
|
|
24473
|
+
if (timer) {
|
|
24474
|
+
clearTimeout(timer);
|
|
24475
|
+
}
|
|
24476
|
+
});
|
|
24477
|
+
if (nextResult.done) {
|
|
24478
|
+
break;
|
|
24479
|
+
}
|
|
24480
|
+
results.push(nextResult.value);
|
|
24347
24481
|
}
|
|
24348
24482
|
return results;
|
|
24349
24483
|
}
|
|
@@ -24674,7 +24808,8 @@ async function* checkPermissionsAndCallTool(args) {
|
|
|
24674
24808
|
...args.context,
|
|
24675
24809
|
toolUseId: args.toolUseID
|
|
24676
24810
|
});
|
|
24677
|
-
const
|
|
24811
|
+
const timeoutMs = resolveToolTimeoutMs();
|
|
24812
|
+
const results = await consumeGeneratorWithTimeout(generator, timeoutMs, args.tool.name);
|
|
24678
24813
|
for (const result of results) {
|
|
24679
24814
|
switch (result.type) {
|
|
24680
24815
|
case "result": {
|
|
@@ -25970,7 +26105,6 @@ var QueryRunner = class {
|
|
|
25970
26105
|
return {
|
|
25971
26106
|
abortController: this.abortController,
|
|
25972
26107
|
onQueryLifecycleEvent: (event) => {
|
|
25973
|
-
this.config.onQueryLifecycleEvent?.(event);
|
|
25974
26108
|
},
|
|
25975
26109
|
sessionContext: new SessionContext(),
|
|
25976
26110
|
options: {
|
|
@@ -25980,7 +26114,6 @@ var QueryRunner = class {
|
|
|
25980
26114
|
tools: [],
|
|
25981
26115
|
verbose: false,
|
|
25982
26116
|
safeMode: false,
|
|
25983
|
-
permissionMode: "default",
|
|
25984
26117
|
maxThinkingTokens: 16e3
|
|
25985
26118
|
},
|
|
25986
26119
|
readFileTimestamps: {},
|
|
@@ -26211,18 +26344,18 @@ import { z as z11 } from "zod";
|
|
|
26211
26344
|
|
|
26212
26345
|
// src/utils/session/expertChatStorage.ts
|
|
26213
26346
|
import { existsSync as existsSync17, readFileSync as readFileSync9, writeFileSync as writeFileSync4, mkdirSync as mkdirSync10 } from "fs";
|
|
26214
|
-
import { join as
|
|
26347
|
+
import { join as join11 } from "path";
|
|
26215
26348
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
26216
26349
|
function getExpertChatDirectory() {
|
|
26217
26350
|
const override = process.env.ANYKODE_CONFIG_DIR?.trim();
|
|
26218
|
-
const expertChatDir = override ?
|
|
26351
|
+
const expertChatDir = override ? join11(override, "expert-chats") : resolveXdgDataPath("expert-chats");
|
|
26219
26352
|
if (!existsSync17(expertChatDir)) {
|
|
26220
26353
|
mkdirSync10(expertChatDir, { recursive: true });
|
|
26221
26354
|
}
|
|
26222
26355
|
return expertChatDir;
|
|
26223
26356
|
}
|
|
26224
26357
|
function getSessionFilePath(sessionId) {
|
|
26225
|
-
return
|
|
26358
|
+
return join11(getExpertChatDirectory(), `${sessionId}.json`);
|
|
26226
26359
|
}
|
|
26227
26360
|
function createExpertChatSession(expertModel) {
|
|
26228
26361
|
const sessionId = randomUUID4().slice(0, 5);
|
|
@@ -27163,7 +27296,7 @@ async function analyzeOutputWithLsp(output, exitCode) {
|
|
|
27163
27296
|
if (exitCode !== 0 || errorCount > 0 || warningCount > 0) {
|
|
27164
27297
|
try {
|
|
27165
27298
|
const { isAbsolute: isAbsolute11, resolve: resolve16 } = await import("path");
|
|
27166
|
-
const { getSessionRoot: getSessionRoot2 } = await import("./state-
|
|
27299
|
+
const { getSessionRoot: getSessionRoot2 } = await import("./state-FFCKZLBN.js");
|
|
27167
27300
|
const lines = output.split("\n");
|
|
27168
27301
|
const uniqueFiles = /* @__PURE__ */ new Set();
|
|
27169
27302
|
const lspSuggestions = [];
|
|
@@ -27533,7 +27666,7 @@ var DeleteTool = {
|
|
|
27533
27666
|
}
|
|
27534
27667
|
if (!force) {
|
|
27535
27668
|
try {
|
|
27536
|
-
const { LspFacade: LspFacade2 } = await import("./lsp-
|
|
27669
|
+
const { LspFacade: LspFacade2 } = await import("./lsp-4BXZN54S.js");
|
|
27537
27670
|
const referenceDetail = await LspFacade2.checkFileReferences(fullPath);
|
|
27538
27671
|
if (referenceDetail) {
|
|
27539
27672
|
failedItems.push(
|
|
@@ -30922,9 +31055,9 @@ var TaskUpdateTool = {
|
|
|
30922
31055
|
};
|
|
30923
31056
|
|
|
30924
31057
|
// src/tools/memory/MemoryReadTool/MemoryReadTool.tsx
|
|
30925
|
-
import { existsSync as existsSync21, lstatSync, mkdirSync as mkdirSync11, readdirSync as
|
|
31058
|
+
import { existsSync as existsSync21, lstatSync, mkdirSync as mkdirSync11, readdirSync as readdirSync4, readFileSync as readFileSync12 } from "fs";
|
|
30926
31059
|
import { Box as Box45, Text as Text49 } from "ink";
|
|
30927
|
-
import { join as
|
|
31060
|
+
import { join as join12 } from "path";
|
|
30928
31061
|
import * as React57 from "react";
|
|
30929
31062
|
import { z as z26 } from "zod";
|
|
30930
31063
|
|
|
@@ -31037,8 +31170,8 @@ var MemoryReadTool = {
|
|
|
31037
31170
|
};
|
|
31038
31171
|
return;
|
|
31039
31172
|
}
|
|
31040
|
-
const files =
|
|
31041
|
-
const indexPath =
|
|
31173
|
+
const files = readdirSync4(agentMemoryDir, { recursive: true }).map((f) => join12(agentMemoryDir, f.toString())).filter((f) => !lstatSync(f).isDirectory()).map((f) => `- ${f}`).join("\n");
|
|
31174
|
+
const indexPath = join12(agentMemoryDir, "index.md");
|
|
31042
31175
|
const index = existsSync21(indexPath) ? readFileSync12(indexPath, "utf-8") : "";
|
|
31043
31176
|
const quotes = "'''";
|
|
31044
31177
|
const content = `Here are the contents of the agent memory file, \`${indexPath}\`:
|
|
@@ -31257,6 +31390,68 @@ var getReadOnlyTools = memoize4(async () => {
|
|
|
31257
31390
|
return tools.filter((_, index) => isEnabled5[index]);
|
|
31258
31391
|
});
|
|
31259
31392
|
|
|
31393
|
+
// src/server/routes/tool.ts
|
|
31394
|
+
function createToolRoutes() {
|
|
31395
|
+
const router = new Hono2();
|
|
31396
|
+
router.get("/", async (c) => {
|
|
31397
|
+
const tools = await getTools();
|
|
31398
|
+
return c.json({
|
|
31399
|
+
success: true,
|
|
31400
|
+
data: tools.map((tool) => ({
|
|
31401
|
+
name: tool.name,
|
|
31402
|
+
description: tool.description,
|
|
31403
|
+
inputSchema: tool.inputSchema,
|
|
31404
|
+
category: tool.category ?? "system",
|
|
31405
|
+
requiresPermission: tool.requiresConfirmation ?? false,
|
|
31406
|
+
dangerousLevel: tool.dangerousLevel ?? "safe"
|
|
31407
|
+
}))
|
|
31408
|
+
});
|
|
31409
|
+
});
|
|
31410
|
+
router.post("/:toolName/execute", async (c) => {
|
|
31411
|
+
const toolName = c.req.param("toolName");
|
|
31412
|
+
const body = await c.req.json();
|
|
31413
|
+
const { input, options } = body;
|
|
31414
|
+
const tools = await getTools();
|
|
31415
|
+
const tool = tools.find((item) => item.name === toolName);
|
|
31416
|
+
if (!tool) {
|
|
31417
|
+
return c.json({
|
|
31418
|
+
success: false,
|
|
31419
|
+
error: { code: "TOOL_NOT_FOUND", message: `Tool '${toolName}' not found` }
|
|
31420
|
+
}, 404);
|
|
31421
|
+
}
|
|
31422
|
+
const startTime = Date.now();
|
|
31423
|
+
try {
|
|
31424
|
+
const result = await tool.call(input, {
|
|
31425
|
+
skipPermission: options?.skipPermission
|
|
31426
|
+
});
|
|
31427
|
+
return c.json({
|
|
31428
|
+
success: true,
|
|
31429
|
+
data: {
|
|
31430
|
+
success: true,
|
|
31431
|
+
result: result.resultForAssistant,
|
|
31432
|
+
duration: Date.now() - startTime
|
|
31433
|
+
}
|
|
31434
|
+
});
|
|
31435
|
+
} catch (error) {
|
|
31436
|
+
return c.json({
|
|
31437
|
+
success: true,
|
|
31438
|
+
data: {
|
|
31439
|
+
success: false,
|
|
31440
|
+
error: {
|
|
31441
|
+
code: "TOOL_EXECUTION_ERROR",
|
|
31442
|
+
message: error instanceof Error ? error.message : String(error)
|
|
31443
|
+
},
|
|
31444
|
+
duration: Date.now() - startTime
|
|
31445
|
+
}
|
|
31446
|
+
});
|
|
31447
|
+
}
|
|
31448
|
+
});
|
|
31449
|
+
return router;
|
|
31450
|
+
}
|
|
31451
|
+
|
|
31452
|
+
// src/server/routes/permission.ts
|
|
31453
|
+
import { Hono as Hono3 } from "hono";
|
|
31454
|
+
|
|
31260
31455
|
// src/server/permission/manager.ts
|
|
31261
31456
|
import { v4 as uuidv42 } from "uuid";
|
|
31262
31457
|
var PermissionManager = class {
|
|
@@ -31335,174 +31530,7 @@ var PermissionManager = class {
|
|
|
31335
31530
|
};
|
|
31336
31531
|
var permissionManager = new PermissionManager();
|
|
31337
31532
|
|
|
31338
|
-
// src/server/routes/tool.ts
|
|
31339
|
-
function buildServerToolUseContext(args) {
|
|
31340
|
-
return {
|
|
31341
|
-
messageId: void 0,
|
|
31342
|
-
toolUseId: args.toolUseId,
|
|
31343
|
-
sessionId: args.sessionId,
|
|
31344
|
-
abortController: args.abortController ?? new AbortController(),
|
|
31345
|
-
readFileTimestamps: {},
|
|
31346
|
-
options: {
|
|
31347
|
-
tools: args.tools,
|
|
31348
|
-
verbose: false,
|
|
31349
|
-
safeMode: false,
|
|
31350
|
-
permissionMode: "default"
|
|
31351
|
-
}
|
|
31352
|
-
};
|
|
31353
|
-
}
|
|
31354
|
-
function createToolRoutes() {
|
|
31355
|
-
const router = new Hono2();
|
|
31356
|
-
router.get("/", async (c) => {
|
|
31357
|
-
const tools = await getTools();
|
|
31358
|
-
return c.json({
|
|
31359
|
-
success: true,
|
|
31360
|
-
data: tools.map((tool) => ({
|
|
31361
|
-
name: tool.name,
|
|
31362
|
-
description: tool.description,
|
|
31363
|
-
inputSchema: tool.inputSchema,
|
|
31364
|
-
category: tool.category ?? "system",
|
|
31365
|
-
requiresPermission: tool.requiresConfirmation ?? false,
|
|
31366
|
-
dangerousLevel: tool.dangerousLevel ?? "safe"
|
|
31367
|
-
}))
|
|
31368
|
-
});
|
|
31369
|
-
});
|
|
31370
|
-
router.post("/:toolName/execute", async (c) => {
|
|
31371
|
-
const toolName = c.req.param("toolName");
|
|
31372
|
-
const body = await c.req.json();
|
|
31373
|
-
const { input = {}, options, sessionId } = body;
|
|
31374
|
-
const tools = await getTools();
|
|
31375
|
-
const tool = tools.find((item) => item.name === toolName);
|
|
31376
|
-
if (!tool) {
|
|
31377
|
-
return c.json({
|
|
31378
|
-
success: false,
|
|
31379
|
-
error: { code: "TOOL_NOT_FOUND", message: `Tool '${toolName}' not found` }
|
|
31380
|
-
}, 404);
|
|
31381
|
-
}
|
|
31382
|
-
const startTime = Date.now();
|
|
31383
|
-
const toolUseId = `tool_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
31384
|
-
const requestSessionId = typeof sessionId === "string" && sessionId.length > 0 ? sessionId : "server_tool_execute";
|
|
31385
|
-
const timeoutMs = typeof options?.timeout === "number" && options.timeout > 0 ? options.timeout : void 0;
|
|
31386
|
-
const requiresPermission = Boolean(tool.requiresConfirmation);
|
|
31387
|
-
const dangerousLevel = tool.dangerousLevel ?? "safe";
|
|
31388
|
-
try {
|
|
31389
|
-
await Bus.publish(ToolEvents.Started, {
|
|
31390
|
-
sessionId: requestSessionId,
|
|
31391
|
-
toolUseId,
|
|
31392
|
-
toolName: tool.name,
|
|
31393
|
-
input,
|
|
31394
|
-
dangerousLevel,
|
|
31395
|
-
requiresPermission
|
|
31396
|
-
});
|
|
31397
|
-
if (requiresPermission && options?.skipPermission !== true) {
|
|
31398
|
-
const decision = await permissionManager.requestPermission(
|
|
31399
|
-
requestSessionId,
|
|
31400
|
-
tool.name,
|
|
31401
|
-
toolUseId,
|
|
31402
|
-
input,
|
|
31403
|
-
dangerousLevel,
|
|
31404
|
-
`Tool ${tool.name} requires permission`,
|
|
31405
|
-
dangerousLevel === "dangerous" ? "deny" : "allow"
|
|
31406
|
-
);
|
|
31407
|
-
if (decision === "deny") {
|
|
31408
|
-
return c.json({
|
|
31409
|
-
success: true,
|
|
31410
|
-
data: {
|
|
31411
|
-
success: false,
|
|
31412
|
-
error: {
|
|
31413
|
-
code: "PERMISSION_DENIED",
|
|
31414
|
-
message: `Tool '${tool.name}' execution was denied by permission decision`
|
|
31415
|
-
},
|
|
31416
|
-
duration: Date.now() - startTime
|
|
31417
|
-
}
|
|
31418
|
-
});
|
|
31419
|
-
}
|
|
31420
|
-
}
|
|
31421
|
-
const abortController = new AbortController();
|
|
31422
|
-
const generator = tool.call(
|
|
31423
|
-
input,
|
|
31424
|
-
buildServerToolUseContext({
|
|
31425
|
-
toolUseId,
|
|
31426
|
-
sessionId: requestSessionId,
|
|
31427
|
-
tools,
|
|
31428
|
-
abortController
|
|
31429
|
-
})
|
|
31430
|
-
);
|
|
31431
|
-
const executionPromise = (async () => {
|
|
31432
|
-
let resultForAssistant2 = void 0;
|
|
31433
|
-
for await (const chunk of generator) {
|
|
31434
|
-
if (chunk?.type === "result") {
|
|
31435
|
-
resultForAssistant2 = chunk.resultForAssistant ?? chunk.data;
|
|
31436
|
-
break;
|
|
31437
|
-
}
|
|
31438
|
-
}
|
|
31439
|
-
return resultForAssistant2;
|
|
31440
|
-
})();
|
|
31441
|
-
let timeoutId;
|
|
31442
|
-
let resultForAssistant = void 0;
|
|
31443
|
-
try {
|
|
31444
|
-
if (timeoutMs !== void 0) {
|
|
31445
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
31446
|
-
timeoutId = setTimeout(() => {
|
|
31447
|
-
abortController.abort();
|
|
31448
|
-
reject(new Error("TOOL_EXECUTION_TIMEOUT"));
|
|
31449
|
-
}, timeoutMs);
|
|
31450
|
-
});
|
|
31451
|
-
resultForAssistant = await Promise.race([executionPromise, timeoutPromise]);
|
|
31452
|
-
} else {
|
|
31453
|
-
resultForAssistant = await executionPromise;
|
|
31454
|
-
}
|
|
31455
|
-
} finally {
|
|
31456
|
-
if (timeoutId !== void 0) {
|
|
31457
|
-
clearTimeout(timeoutId);
|
|
31458
|
-
}
|
|
31459
|
-
}
|
|
31460
|
-
await Bus.publish(ToolEvents.Completed, {
|
|
31461
|
-
sessionId: requestSessionId,
|
|
31462
|
-
toolUseId,
|
|
31463
|
-
toolName: tool.name,
|
|
31464
|
-
result: typeof resultForAssistant === "string" ? resultForAssistant : JSON.stringify(resultForAssistant ?? null),
|
|
31465
|
-
isError: false,
|
|
31466
|
-
duration: Date.now() - startTime
|
|
31467
|
-
});
|
|
31468
|
-
return c.json({
|
|
31469
|
-
success: true,
|
|
31470
|
-
data: {
|
|
31471
|
-
success: true,
|
|
31472
|
-
result: resultForAssistant,
|
|
31473
|
-
duration: Date.now() - startTime
|
|
31474
|
-
}
|
|
31475
|
-
});
|
|
31476
|
-
} catch (error) {
|
|
31477
|
-
const isTimeout = error instanceof Error && error.message === "TOOL_EXECUTION_TIMEOUT";
|
|
31478
|
-
await Bus.publish(ToolEvents.Error, {
|
|
31479
|
-
sessionId: requestSessionId,
|
|
31480
|
-
toolUseId,
|
|
31481
|
-
toolName: tool.name,
|
|
31482
|
-
error: {
|
|
31483
|
-
code: isTimeout ? "TOOL_EXECUTION_TIMEOUT" : "TOOL_EXECUTION_ERROR",
|
|
31484
|
-
message: isTimeout ? "Tool execution timed out" : error instanceof Error ? error.message : String(error),
|
|
31485
|
-
details: void 0
|
|
31486
|
-
}
|
|
31487
|
-
});
|
|
31488
|
-
return c.json({
|
|
31489
|
-
success: true,
|
|
31490
|
-
data: {
|
|
31491
|
-
success: false,
|
|
31492
|
-
error: {
|
|
31493
|
-
code: isTimeout ? "TOOL_EXECUTION_TIMEOUT" : "TOOL_EXECUTION_ERROR",
|
|
31494
|
-
message: isTimeout ? "Tool execution timed out" : error instanceof Error ? error.message : String(error)
|
|
31495
|
-
},
|
|
31496
|
-
duration: Date.now() - startTime
|
|
31497
|
-
}
|
|
31498
|
-
});
|
|
31499
|
-
}
|
|
31500
|
-
});
|
|
31501
|
-
return router;
|
|
31502
|
-
}
|
|
31503
|
-
|
|
31504
31533
|
// src/server/routes/permission.ts
|
|
31505
|
-
import { Hono as Hono3 } from "hono";
|
|
31506
31534
|
function createPermissionRoutes() {
|
|
31507
31535
|
const router = new Hono3();
|
|
31508
31536
|
router.post("/:permissionId/respond", async (c) => {
|
|
@@ -31588,6 +31616,7 @@ function createConfigRoutes() {
|
|
|
31588
31616
|
// src/server/routes/mcp.ts
|
|
31589
31617
|
import { Hono as Hono5 } from "hono";
|
|
31590
31618
|
var knownServers = /* @__PURE__ */ new Set();
|
|
31619
|
+
var connectedServers = /* @__PURE__ */ new Set();
|
|
31591
31620
|
function createMCPRoutes() {
|
|
31592
31621
|
const router = new Hono5();
|
|
31593
31622
|
router.get("/servers", async (c) => {
|
|
@@ -31595,12 +31624,15 @@ function createMCPRoutes() {
|
|
|
31595
31624
|
for (const serverName of Object.keys(servers ?? {})) {
|
|
31596
31625
|
knownServers.add(serverName);
|
|
31597
31626
|
}
|
|
31627
|
+
for (const serverName of connectedServers) {
|
|
31628
|
+
knownServers.add(serverName);
|
|
31629
|
+
}
|
|
31598
31630
|
const serverNames = Array.from(knownServers);
|
|
31599
31631
|
return c.json({
|
|
31600
31632
|
success: true,
|
|
31601
31633
|
data: serverNames.map((name3) => ({
|
|
31602
31634
|
name: name3,
|
|
31603
|
-
status: getMcprcServerStatus(name3),
|
|
31635
|
+
status: connectedServers.has(name3) ? "connected" : getMcprcServerStatus(name3),
|
|
31604
31636
|
tools: [],
|
|
31605
31637
|
resources: [],
|
|
31606
31638
|
error: void 0
|
|
@@ -31610,26 +31642,23 @@ function createMCPRoutes() {
|
|
|
31610
31642
|
router.post("/servers/:serverName/connect", async (c) => {
|
|
31611
31643
|
const serverName = c.req.param("serverName");
|
|
31612
31644
|
knownServers.add(serverName);
|
|
31645
|
+
connectedServers.add(serverName);
|
|
31613
31646
|
return c.json({
|
|
31614
|
-
success:
|
|
31615
|
-
|
|
31616
|
-
|
|
31617
|
-
message: "MCP connect flow is not implemented in current server adapter"
|
|
31618
|
-
},
|
|
31619
|
-
data: { serverName }
|
|
31620
|
-
}, 501);
|
|
31647
|
+
success: true,
|
|
31648
|
+
data: { connected: true, serverName, tools: [] }
|
|
31649
|
+
});
|
|
31621
31650
|
});
|
|
31622
31651
|
router.post("/servers/:serverName/disconnect", async (c) => {
|
|
31623
31652
|
const serverName = c.req.param("serverName");
|
|
31624
31653
|
knownServers.add(serverName);
|
|
31654
|
+
connectedServers.delete(serverName);
|
|
31625
31655
|
return c.json({
|
|
31626
|
-
success:
|
|
31627
|
-
|
|
31628
|
-
|
|
31629
|
-
|
|
31630
|
-
}
|
|
31631
|
-
|
|
31632
|
-
}, 501);
|
|
31656
|
+
success: true,
|
|
31657
|
+
data: {
|
|
31658
|
+
disconnected: true,
|
|
31659
|
+
serverName
|
|
31660
|
+
}
|
|
31661
|
+
});
|
|
31633
31662
|
});
|
|
31634
31663
|
return router;
|
|
31635
31664
|
}
|
|
@@ -31727,8 +31756,6 @@ function createServer2(options = {}) {
|
|
|
31727
31756
|
async function startServer(options = {}) {
|
|
31728
31757
|
const port = options.port ?? 4096;
|
|
31729
31758
|
const host = options.host ?? "localhost";
|
|
31730
|
-
const envIdleTimeout = Number(process.env.PYB_SERVER_IDLE_TIMEOUT ?? "");
|
|
31731
|
-
const idleTimeout = options.idleTimeout ?? (Number.isFinite(envIdleTimeout) && envIdleTimeout > 0 ? envIdleTimeout : 120);
|
|
31732
31759
|
const app = createServer2(options);
|
|
31733
31760
|
if (typeof Bun === "undefined" || typeof Bun.serve !== "function") {
|
|
31734
31761
|
throw new Error("Bun runtime is required to start the web server");
|
|
@@ -31736,8 +31763,7 @@ async function startServer(options = {}) {
|
|
|
31736
31763
|
const server = Bun.serve({
|
|
31737
31764
|
fetch: app.fetch,
|
|
31738
31765
|
hostname: host,
|
|
31739
|
-
port
|
|
31740
|
-
idleTimeout
|
|
31766
|
+
port
|
|
31741
31767
|
});
|
|
31742
31768
|
console.log(`PYB-CLI Web Server starting on http://${host}:${port}`);
|
|
31743
31769
|
return {
|
|
@@ -35716,8 +35742,8 @@ function getCompletionContext(args) {
|
|
|
35716
35742
|
}
|
|
35717
35743
|
|
|
35718
35744
|
// src/utils/completion/fileSuggestions.ts
|
|
35719
|
-
import { existsSync as existsSync26, readdirSync as
|
|
35720
|
-
import { basename as basename4, dirname as dirname14, join as
|
|
35745
|
+
import { existsSync as existsSync26, readdirSync as readdirSync5, statSync as statSync15 } from "fs";
|
|
35746
|
+
import { basename as basename4, dirname as dirname14, join as join13, resolve as resolve13 } from "path";
|
|
35721
35747
|
function generateFileSuggestions(args) {
|
|
35722
35748
|
const { prefix, cwd } = args;
|
|
35723
35749
|
try {
|
|
@@ -35745,14 +35771,14 @@ function generateFileSuggestions(args) {
|
|
|
35745
35771
|
}
|
|
35746
35772
|
if (!existsSync26(searchDir)) return [];
|
|
35747
35773
|
const showHidden = nameFilter.startsWith(".") || userPath.includes("/.");
|
|
35748
|
-
const entries =
|
|
35774
|
+
const entries = readdirSync5(searchDir).filter((entry) => {
|
|
35749
35775
|
if (!showHidden && entry.startsWith(".")) return false;
|
|
35750
35776
|
if (nameFilter && !entry.toLowerCase().startsWith(nameFilter.toLowerCase()))
|
|
35751
35777
|
return false;
|
|
35752
35778
|
return true;
|
|
35753
35779
|
}).sort((a, b) => {
|
|
35754
|
-
const aPath =
|
|
35755
|
-
const bPath =
|
|
35780
|
+
const aPath = join13(searchDir, a);
|
|
35781
|
+
const bPath = join13(searchDir, b);
|
|
35756
35782
|
const aIsDir = statSync15(aPath).isDirectory();
|
|
35757
35783
|
const bIsDir = statSync15(bPath).isDirectory();
|
|
35758
35784
|
if (aIsDir && !bIsDir) return -1;
|
|
@@ -35760,7 +35786,7 @@ function generateFileSuggestions(args) {
|
|
|
35760
35786
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
35761
35787
|
}).slice(0, 25);
|
|
35762
35788
|
return entries.map((entry) => {
|
|
35763
|
-
const entryPath =
|
|
35789
|
+
const entryPath = join13(searchDir, entry);
|
|
35764
35790
|
const isDir = statSync15(entryPath).isDirectory();
|
|
35765
35791
|
const icon = isDir ? "\u{1F4C1}" : "\u{1F4C4}";
|
|
35766
35792
|
let value;
|
|
@@ -37094,15 +37120,15 @@ function useUnifiedCompletion({
|
|
|
37094
37120
|
if (systemCommands.length > 0 || isLoadingCommands) return;
|
|
37095
37121
|
setIsLoadingCommands(true);
|
|
37096
37122
|
try {
|
|
37097
|
-
const { readdirSync:
|
|
37123
|
+
const { readdirSync: readdirSync6, statSync: statSync17 } = await import("fs");
|
|
37098
37124
|
const pathDirs = (process.env.PATH || "").split(":").filter(Boolean);
|
|
37099
37125
|
const commandSet = /* @__PURE__ */ new Set();
|
|
37100
37126
|
const essentialCommands = getEssentialCommands();
|
|
37101
37127
|
essentialCommands.forEach((cmd) => commandSet.add(cmd));
|
|
37102
37128
|
for (const dir of pathDirs) {
|
|
37103
37129
|
try {
|
|
37104
|
-
if (
|
|
37105
|
-
const entries =
|
|
37130
|
+
if (readdirSync6 && statSync17) {
|
|
37131
|
+
const entries = readdirSync6(dir);
|
|
37106
37132
|
for (const entry of entries) {
|
|
37107
37133
|
try {
|
|
37108
37134
|
const fullPath = `${dir}/${entry}`;
|
|
@@ -37667,7 +37693,7 @@ function TokenWarning({
|
|
|
37667
37693
|
import { spawn, spawnSync } from "child_process";
|
|
37668
37694
|
import { mkdtempSync, readFileSync as readFileSync17, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
37669
37695
|
import { tmpdir } from "os";
|
|
37670
|
-
import { join as
|
|
37696
|
+
import { join as join14 } from "path";
|
|
37671
37697
|
var isWindows = process.platform === "win32";
|
|
37672
37698
|
function isCommandAvailable(command4) {
|
|
37673
37699
|
const checker = isWindows ? "where" : "which";
|
|
@@ -37743,8 +37769,8 @@ async function launchExternalEditor(initialText) {
|
|
|
37743
37769
|
)
|
|
37744
37770
|
};
|
|
37745
37771
|
}
|
|
37746
|
-
const dir = mkdtempSync(
|
|
37747
|
-
const filePath =
|
|
37772
|
+
const dir = mkdtempSync(join14(tmpdir(), "pyb-edit-"));
|
|
37773
|
+
const filePath = join14(dir, "message.txt");
|
|
37748
37774
|
writeFileSync6(filePath, initialText, "utf-8");
|
|
37749
37775
|
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
37750
37776
|
if (process.stdin.isTTY) {
|
|
@@ -37801,13 +37827,13 @@ async function launchExternalEditor(initialText) {
|
|
|
37801
37827
|
}
|
|
37802
37828
|
|
|
37803
37829
|
// src/utils/commands/hashCommand.ts
|
|
37804
|
-
import { join as
|
|
37830
|
+
import { join as join15 } from "path";
|
|
37805
37831
|
import { readFileSync as readFileSync18, writeFileSync as writeFileSync7 } from "fs";
|
|
37806
37832
|
function handleHashCommand(interpreted) {
|
|
37807
37833
|
try {
|
|
37808
37834
|
const cwd = process.cwd();
|
|
37809
|
-
const agentsPath =
|
|
37810
|
-
const legacyPath =
|
|
37835
|
+
const agentsPath = join15(cwd, "AGENTS.md");
|
|
37836
|
+
const legacyPath = join15(cwd, "CLAUDE.md");
|
|
37811
37837
|
const filesToUpdate = [];
|
|
37812
37838
|
filesToUpdate.push({ path: agentsPath, name: "AGENTS.md" });
|
|
37813
37839
|
try {
|
|
@@ -37955,7 +37981,7 @@ function logStartupProfile(event) {
|
|
|
37955
37981
|
import { useEffect as useEffect21, useRef as useRef10, useState as useState25 } from "react";
|
|
37956
37982
|
|
|
37957
37983
|
// src/services/ui/statusline.ts
|
|
37958
|
-
import { join as
|
|
37984
|
+
import { join as join16 } from "path";
|
|
37959
37985
|
function normalizeString(value) {
|
|
37960
37986
|
if (typeof value !== "string") return null;
|
|
37961
37987
|
const trimmed = value.trim();
|
|
@@ -37974,7 +38000,7 @@ function getStatusLineCommand(options) {
|
|
|
37974
38000
|
const configDir = normalizeString(options?.configDir);
|
|
37975
38001
|
if (configDir) {
|
|
37976
38002
|
const settings2 = readSettingsFile(
|
|
37977
|
-
|
|
38003
|
+
join16(configDir, "settings.json")
|
|
37978
38004
|
);
|
|
37979
38005
|
const command4 = getCommandFromSettings(settings2 ?? {});
|
|
37980
38006
|
if (command4) return command4;
|
|
@@ -38042,7 +38068,7 @@ function useStatusLine() {
|
|
|
38042
38068
|
// src/ui/components/PromptInput.tsx
|
|
38043
38069
|
async function interpretHashCommand(input) {
|
|
38044
38070
|
try {
|
|
38045
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
38071
|
+
const { queryQuick: queryQuick2 } = await import("./llm-UPZIAGPI.js");
|
|
38046
38072
|
const systemPrompt = [
|
|
38047
38073
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
38048
38074
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -38355,7 +38381,7 @@ function PromptInput({
|
|
|
38355
38381
|
if (messages2.length) {
|
|
38356
38382
|
if (mode === "bash") {
|
|
38357
38383
|
onQuery(messages2, newAbortController).then(async () => {
|
|
38358
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
38384
|
+
const { getCwd: getCwd2 } = await import("./state-FFCKZLBN.js");
|
|
38359
38385
|
setCurrentPwd(getCwd2());
|
|
38360
38386
|
});
|
|
38361
38387
|
} else {
|
|
@@ -39134,12 +39160,12 @@ function createConversationTrackerPersistenceTelemetryEmitter(entrypoint) {
|
|
|
39134
39160
|
}
|
|
39135
39161
|
|
|
39136
39162
|
// src/ui/screens/REPL.tsx
|
|
39137
|
-
import { join as
|
|
39163
|
+
import { join as join17 } from "path";
|
|
39138
39164
|
function getProjectDirSlug(cwd) {
|
|
39139
39165
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
39140
39166
|
}
|
|
39141
39167
|
function getConversationTrackerPersistenceDir(cwd) {
|
|
39142
|
-
return resolveXdgDataPath(
|
|
39168
|
+
return resolveXdgDataPath(join17(getProjectDirSlug(cwd), "conversation-trackers"));
|
|
39143
39169
|
}
|
|
39144
39170
|
function REPL({
|
|
39145
39171
|
commands,
|
|
@@ -39919,7 +39945,7 @@ import React111, { useCallback as useCallback17, useEffect as useEffect26, useMe
|
|
|
39919
39945
|
import { Box as Box84, Text as Text88, useInput as useInput28 } from "ink";
|
|
39920
39946
|
import figures9 from "figures";
|
|
39921
39947
|
import chalk15 from "chalk";
|
|
39922
|
-
import { join as
|
|
39948
|
+
import { join as join19 } from "path";
|
|
39923
39949
|
import { spawn as spawn2 } from "child_process";
|
|
39924
39950
|
|
|
39925
39951
|
// src/commands/agents/tooling.ts
|
|
@@ -39979,13 +40005,13 @@ import {
|
|
|
39979
40005
|
unlinkSync as unlinkSync2,
|
|
39980
40006
|
writeFileSync as writeFileSync8
|
|
39981
40007
|
} from "fs";
|
|
39982
|
-
import { join as
|
|
40008
|
+
import { join as join18 } from "path";
|
|
39983
40009
|
import { homedir as homedir8 } from "os";
|
|
39984
40010
|
|
|
39985
40011
|
// src/commands/agents/generation.ts
|
|
39986
40012
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
39987
40013
|
async function generateAgentWithClaude(prompt) {
|
|
39988
|
-
const { queryModel } = await import("./llm-
|
|
40014
|
+
const { queryModel } = await import("./llm-UPZIAGPI.js");
|
|
39989
40015
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
39990
40016
|
|
|
39991
40017
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -40169,21 +40195,21 @@ var LEGACY_FOLDER = ".claude";
|
|
|
40169
40195
|
var AGENTS_DIR = "agents";
|
|
40170
40196
|
function getAgentDirectory(location) {
|
|
40171
40197
|
if (location === "user") {
|
|
40172
|
-
return
|
|
40198
|
+
return join18(homedir8(), PRIMARY_FOLDER, AGENTS_DIR);
|
|
40173
40199
|
}
|
|
40174
|
-
return
|
|
40200
|
+
return join18(getCwd(), PRIMARY_FOLDER, AGENTS_DIR);
|
|
40175
40201
|
}
|
|
40176
40202
|
function getLegacyAgentDirectory(location) {
|
|
40177
40203
|
if (location === "user") {
|
|
40178
|
-
return
|
|
40204
|
+
return join18(homedir8(), LEGACY_FOLDER, AGENTS_DIR);
|
|
40179
40205
|
}
|
|
40180
|
-
return
|
|
40206
|
+
return join18(getCwd(), LEGACY_FOLDER, AGENTS_DIR);
|
|
40181
40207
|
}
|
|
40182
40208
|
function getPrimaryAgentFilePath(location, agentType) {
|
|
40183
|
-
return
|
|
40209
|
+
return join18(getAgentDirectory(location), `${agentType}.md`);
|
|
40184
40210
|
}
|
|
40185
40211
|
function getLegacyAgentFilePath(location, agentType) {
|
|
40186
|
-
return
|
|
40212
|
+
return join18(getLegacyAgentDirectory(location), `${agentType}.md`);
|
|
40187
40213
|
}
|
|
40188
40214
|
function ensureDirectoryExists(location) {
|
|
40189
40215
|
const dir = getAgentDirectory(location);
|
|
@@ -41281,8 +41307,8 @@ function ViewAgent(props) {
|
|
|
41281
41307
|
if (props.agent.source === "plugin") return `Plugin: ${props.agent.baseDir ?? "Unknown"}`;
|
|
41282
41308
|
const baseDir = props.agent.baseDir;
|
|
41283
41309
|
const file = `${props.agent.filename ?? props.agent.agentType}.md`;
|
|
41284
|
-
if (props.agent.source === "projectSettings") return
|
|
41285
|
-
if (baseDir) return
|
|
41310
|
+
if (props.agent.source === "projectSettings") return join19(".claude", "agents", file);
|
|
41311
|
+
if (baseDir) return join19(baseDir, file);
|
|
41286
41312
|
return props.agent.source;
|
|
41287
41313
|
})();
|
|
41288
41314
|
const toolsSummary = () => {
|
|
@@ -42901,7 +42927,7 @@ var BashTool = {
|
|
|
42901
42927
|
result: false,
|
|
42902
42928
|
message: `Security Policy: Do not use 'ls' for simple file listing.
|
|
42903
42929
|
- To find files: Use the 'Glob' tool.
|
|
42904
|
-
- To
|
|
42930
|
+
- To inspect one-level directory structure: Use Read on the directory path (offset>=1, optional limit).
|
|
42905
42931
|
- To check permissions/metadata: Use 'ls -l' (allowed).`
|
|
42906
42932
|
};
|
|
42907
42933
|
}
|
|
@@ -43610,7 +43636,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
|
|
|
43610
43636
|
- Example: \`GlobTool(pattern: "tests", semantic: true)\` will find test files based on project structure.
|
|
43611
43637
|
2. **Exact Identifier**: WHEN you know the precise class/function name (e.g., "UserProfile", "initDatabase"), use standard Grep/Glob without \`semantic\` flag.
|
|
43612
43638
|
3. **Exploration**: If standard search returns 0 results, AUTOMATICALLY retry with \`semantic: true\`.
|
|
43613
|
-
4. **File System Exploration Priority**:For file system exploration, decide based on intent: if you need
|
|
43639
|
+
4. **File System Exploration Priority**:For file system exploration, decide based on intent: if you need one-level directory structure, read the directory path with Read first; if you have keywords or fuzzy paths, prefer Glob first. If results are too broad, use Read for structure confirmation or combine with Grep/LSP. Only use Bash for executing scripts or binaries.
|
|
43614
43640
|
5. **Code Analysis & Exploration Priority**:For codebase exploration tasks (e.g., searching across 2 or more directories, requiring more than 3 steps searching iterations, or investigating cross-module patterns), prefer using the Task tool with Explore subagent. This isolates exploration context in a separate transcript.
|
|
43615
43641
|
6. **File Search Priority**:When doing file search, prefer to use the Task tool for open-ended, multi-step exploration to reduce context usage. For known paths or small scopes, prefer Lsp/Read/Glob/Grep directly.
|
|
43616
43642
|
|