pybao-cli 1.5.37 → 1.5.39
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-QXWIXDPD.js +51 -0
- package/dist/{acp-JW3TIYAD.js → acp-Z3ROU4NT.js} +30 -30
- package/dist/{agentsValidate-SBWTSOTC.js → agentsValidate-T5RRKNH7.js} +7 -7
- package/dist/{ask-REOHQELX.js → ask-Q5DD7Y5V.js} +30 -30
- package/dist/{autoUpdater-QOASKMIL.js → autoUpdater-X4MGXTHY.js} +3 -3
- package/dist/{chunk-66IQQBOM.js → chunk-25DI6YMP.js} +1 -1
- package/dist/{chunk-Q6ADAH2V.js → chunk-3YYZBLYE.js} +3 -3
- package/dist/{chunk-UBR4EMJG.js → chunk-4L2R7COO.js} +3 -3
- package/dist/{chunk-GBRPRP4C.js → chunk-6ZXSYUC4.js} +3 -3
- package/dist/{chunk-GBRPRP4C.js.map → chunk-6ZXSYUC4.js.map} +1 -1
- package/dist/{chunk-T5T43XFI.js → chunk-7A7AGNEX.js} +5 -5
- package/dist/{chunk-T5T43XFI.js.map → chunk-7A7AGNEX.js.map} +1 -1
- package/dist/{chunk-HS72NWQM.js → chunk-B6KK6QP2.js} +1 -1
- package/dist/chunk-BKCAVW2G.js.map +7 -0
- package/dist/{chunk-JRCCJJTK.js → chunk-C2XL4PP4.js} +5 -4
- package/dist/chunk-C2XL4PP4.js.map +7 -0
- package/dist/{chunk-BV4JBKPK.js → chunk-CARZ3VV2.js} +3 -3
- package/dist/{chunk-LQ3YSDHE.js → chunk-E2O5ZNMG.js} +1 -1
- package/dist/{chunk-PKMXJDHS.js → chunk-IOJSVTJI.js} +1 -1
- package/dist/{chunk-VNJSOVCS.js → chunk-J6RVV73S.js} +3 -20
- package/dist/chunk-J6RVV73S.js.map +7 -0
- package/dist/{chunk-K53ERJZE.js → chunk-JZ7UEGNN.js} +1 -1
- package/dist/{chunk-XYD26HOU.js → chunk-K5F6WOED.js} +1 -1
- package/dist/{chunk-T5VIUVWS.js → chunk-K6USRWZZ.js} +583 -408
- package/dist/chunk-K6USRWZZ.js.map +7 -0
- package/dist/{chunk-ORTVYWVH.js → chunk-K6ZSF4XV.js} +4 -4
- package/dist/{chunk-TM2IQSS6.js → chunk-M74TFPOY.js} +3 -3
- package/dist/{chunk-6EUA3JLK.js → chunk-N4KEHLUE.js} +6 -6
- package/dist/{chunk-6EUA3JLK.js.map → chunk-N4KEHLUE.js.map} +1 -1
- package/dist/{chunk-EXOVGTTX.js → chunk-OQV3ASGW.js} +3 -3
- package/dist/{chunk-2OX2HGKH.js → chunk-OXMRNROM.js} +2 -2
- package/dist/{chunk-66GPSPHJ.js → chunk-PMPJBZ4W.js} +3 -3
- package/dist/{chunk-T3NFIJVE.js → chunk-QJPGHOOD.js} +3 -3
- package/dist/{chunk-SFFHKLKV.js → chunk-RF4TLZ2G.js} +1 -1
- package/dist/{chunk-HKC3XNTU.js → chunk-TNVELATG.js} +4 -4
- package/dist/{chunk-DNJ2EUI4.js → chunk-TPEX7GP6.js} +2 -2
- package/dist/{chunk-PJMRV734.js → chunk-UIHCMY35.js} +2 -2
- package/dist/{chunk-6UJ2IX6O.js → chunk-UXJEDV2F.js} +1 -1
- package/dist/{chunk-37VT7CBN.js → chunk-WU3KYQFA.js} +3 -3
- package/dist/{chunk-A4MELTXR.js → chunk-XEZ4I2EW.js} +1 -1
- package/dist/{chunk-GAHOCTVO.js → chunk-XQZYIKQG.js} +1 -1
- package/dist/{chunk-CWEWMSYK.js → chunk-YGMNRXWM.js} +2 -2
- package/dist/{chunk-X2LEA5WZ.js → chunk-YQX2PZMK.js} +4 -4
- package/dist/{cli-ILXOOGOB.js → cli-KXJVBKJ3.js} +91 -91
- package/dist/commands-ESZSE6NV.js +55 -0
- package/dist/{config-HVU5BUJR.js → config-WAHXMCBU.js} +4 -4
- package/dist/{context-Z3QI3FNI.js → context-F57XOU2V.js} +6 -6
- package/dist/{conversationPersistence-FKNK4HLK.js → conversationPersistence-AQ4ICXAB.js} +3 -3
- package/dist/{conversationTracker-2LFSHPJQ.js → conversationTracker-E4JUPWAN.js} +4 -4
- package/dist/{customCommands-JC4SMHEG.js → customCommands-JIPCN2R2.js} +4 -4
- package/dist/{env-C4DAPLWY.js → env-CQDTZSMG.js} +2 -2
- package/dist/{file-V2C5K5KH.js → file-67TG46SO.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-YTSS25IN.js → llm-S4UIKFEI.js} +32 -32
- package/dist/{llmLazy-TFIRXTKR.js → llmLazy-C4LTCDFH.js} +1 -1
- package/dist/{loader-GTHCSRZZ.js → loader-TEMIJTXY.js} +4 -4
- package/dist/{lsp-GS74PXYZ.js → lsp-NRIYSZQ4.js} +6 -6
- package/dist/{lspAnchor-ACLDKRMF.js → lspAnchor-FM5VJH4Y.js} +6 -6
- package/dist/{mcp-WULQ66CY.js → mcp-TCYAGRRL.js} +7 -7
- package/dist/{mentionProcessor-GWPPEFEF.js → mentionProcessor-I3NLABF6.js} +5 -5
- package/dist/{messages-OGPCOESK.js → messages-RI367EVZ.js} +1 -1
- package/dist/{model-URPSX5FV.js → model-NJI57V4I.js} +5 -5
- package/dist/{openai-6W76QZ5A.js → openai-CD6FJTQW.js} +5 -5
- package/dist/{outputStyles-IUWSV34Z.js → outputStyles-DTQLGYLI.js} +4 -4
- package/dist/{pluginRuntime-7ZEORM4F.js → pluginRuntime-HAYCLP4K.js} +6 -6
- package/dist/{pluginValidation-OJES7FNG.js → pluginValidation-EXHNDUOT.js} +6 -6
- package/dist/prompts-UGQX7FG5.js +57 -0
- package/dist/{pybAgentSessionLoad-HQOBJLOU.js → pybAgentSessionLoad-WRYHVHEJ.js} +4 -4
- package/dist/{pybAgentSessionResume-XDKORGD2.js → pybAgentSessionResume-UWLIZORC.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-FTCT4HKD.js → pybAgentStreamJsonSession-IPKXSPWK.js} +1 -1
- package/dist/{pybHooks-FKA2AQ47.js → pybHooks-GMZAQ3EO.js} +4 -4
- package/dist/query-LBWLTCLG.js +55 -0
- package/dist/{registry-GT6NBBK5.js → registry-63DZ2LVO.js} +5 -5
- package/dist/{ripgrep-GHL736ND.js → ripgrep-XTOLMKN5.js} +3 -3
- package/dist/{skillMarketplace-2IXTVWA6.js → skillMarketplace-BY4UWKWZ.js} +3 -3
- package/dist/{state-M7627Z3G.js → state-34X5ECUL.js} +2 -2
- package/dist/{theme-NDLGHEH5.js → theme-CDSY27SJ.js} +5 -5
- package/dist/{toolPermissionSettings-KVBN66MO.js → toolPermissionSettings-RCPBRGPK.js} +6 -6
- package/dist/tools-53UXDJ64.js +55 -0
- package/dist/{userInput-GU6FNIO4.js → userInput-4FVP4WYV.js} +32 -32
- package/package.json +3 -20
- package/dist/REPL-N755RAFU.js +0 -51
- package/dist/chunk-2DKSGO53.js.map +0 -7
- package/dist/chunk-JRCCJJTK.js.map +0 -7
- package/dist/chunk-T5VIUVWS.js.map +0 -7
- package/dist/chunk-VNJSOVCS.js.map +0 -7
- package/dist/commands-EMWY7YKA.js +0 -55
- package/dist/prompts-XOIWSFPX.js +0 -57
- package/dist/query-FMWLAT3K.js +0 -55
- package/dist/tools-LHTT7WYX.js +0 -55
- /package/dist/{REPL-N755RAFU.js.map → REPL-QXWIXDPD.js.map} +0 -0
- /package/dist/{acp-JW3TIYAD.js.map → acp-Z3ROU4NT.js.map} +0 -0
- /package/dist/{agentsValidate-SBWTSOTC.js.map → agentsValidate-T5RRKNH7.js.map} +0 -0
- /package/dist/{ask-REOHQELX.js.map → ask-Q5DD7Y5V.js.map} +0 -0
- /package/dist/{autoUpdater-QOASKMIL.js.map → autoUpdater-X4MGXTHY.js.map} +0 -0
- /package/dist/{chunk-66IQQBOM.js.map → chunk-25DI6YMP.js.map} +0 -0
- /package/dist/{chunk-Q6ADAH2V.js.map → chunk-3YYZBLYE.js.map} +0 -0
- /package/dist/{chunk-UBR4EMJG.js.map → chunk-4L2R7COO.js.map} +0 -0
- /package/dist/{chunk-HS72NWQM.js.map → chunk-B6KK6QP2.js.map} +0 -0
- /package/dist/{chunk-2DKSGO53.js → chunk-BKCAVW2G.js} +0 -0
- /package/dist/{chunk-BV4JBKPK.js.map → chunk-CARZ3VV2.js.map} +0 -0
- /package/dist/{chunk-LQ3YSDHE.js.map → chunk-E2O5ZNMG.js.map} +0 -0
- /package/dist/{chunk-PKMXJDHS.js.map → chunk-IOJSVTJI.js.map} +0 -0
- /package/dist/{chunk-K53ERJZE.js.map → chunk-JZ7UEGNN.js.map} +0 -0
- /package/dist/{chunk-XYD26HOU.js.map → chunk-K5F6WOED.js.map} +0 -0
- /package/dist/{chunk-ORTVYWVH.js.map → chunk-K6ZSF4XV.js.map} +0 -0
- /package/dist/{chunk-TM2IQSS6.js.map → chunk-M74TFPOY.js.map} +0 -0
- /package/dist/{chunk-EXOVGTTX.js.map → chunk-OQV3ASGW.js.map} +0 -0
- /package/dist/{chunk-2OX2HGKH.js.map → chunk-OXMRNROM.js.map} +0 -0
- /package/dist/{chunk-66GPSPHJ.js.map → chunk-PMPJBZ4W.js.map} +0 -0
- /package/dist/{chunk-T3NFIJVE.js.map → chunk-QJPGHOOD.js.map} +0 -0
- /package/dist/{chunk-SFFHKLKV.js.map → chunk-RF4TLZ2G.js.map} +0 -0
- /package/dist/{chunk-HKC3XNTU.js.map → chunk-TNVELATG.js.map} +0 -0
- /package/dist/{chunk-DNJ2EUI4.js.map → chunk-TPEX7GP6.js.map} +0 -0
- /package/dist/{chunk-PJMRV734.js.map → chunk-UIHCMY35.js.map} +0 -0
- /package/dist/{chunk-6UJ2IX6O.js.map → chunk-UXJEDV2F.js.map} +0 -0
- /package/dist/{chunk-37VT7CBN.js.map → chunk-WU3KYQFA.js.map} +0 -0
- /package/dist/{chunk-A4MELTXR.js.map → chunk-XEZ4I2EW.js.map} +0 -0
- /package/dist/{chunk-GAHOCTVO.js.map → chunk-XQZYIKQG.js.map} +0 -0
- /package/dist/{chunk-CWEWMSYK.js.map → chunk-YGMNRXWM.js.map} +0 -0
- /package/dist/{chunk-X2LEA5WZ.js.map → chunk-YQX2PZMK.js.map} +0 -0
- /package/dist/{cli-ILXOOGOB.js.map → cli-KXJVBKJ3.js.map} +0 -0
- /package/dist/{commands-EMWY7YKA.js.map → commands-ESZSE6NV.js.map} +0 -0
- /package/dist/{config-HVU5BUJR.js.map → config-WAHXMCBU.js.map} +0 -0
- /package/dist/{context-Z3QI3FNI.js.map → context-F57XOU2V.js.map} +0 -0
- /package/dist/{conversationPersistence-FKNK4HLK.js.map → conversationPersistence-AQ4ICXAB.js.map} +0 -0
- /package/dist/{conversationTracker-2LFSHPJQ.js.map → conversationTracker-E4JUPWAN.js.map} +0 -0
- /package/dist/{customCommands-JC4SMHEG.js.map → customCommands-JIPCN2R2.js.map} +0 -0
- /package/dist/{env-C4DAPLWY.js.map → env-CQDTZSMG.js.map} +0 -0
- /package/dist/{file-V2C5K5KH.js.map → file-67TG46SO.js.map} +0 -0
- /package/dist/{llm-YTSS25IN.js.map → llm-S4UIKFEI.js.map} +0 -0
- /package/dist/{llmLazy-TFIRXTKR.js.map → llmLazy-C4LTCDFH.js.map} +0 -0
- /package/dist/{loader-GTHCSRZZ.js.map → loader-TEMIJTXY.js.map} +0 -0
- /package/dist/{lsp-GS74PXYZ.js.map → lsp-NRIYSZQ4.js.map} +0 -0
- /package/dist/{lspAnchor-ACLDKRMF.js.map → lspAnchor-FM5VJH4Y.js.map} +0 -0
- /package/dist/{mcp-WULQ66CY.js.map → mcp-TCYAGRRL.js.map} +0 -0
- /package/dist/{mentionProcessor-GWPPEFEF.js.map → mentionProcessor-I3NLABF6.js.map} +0 -0
- /package/dist/{messages-OGPCOESK.js.map → messages-RI367EVZ.js.map} +0 -0
- /package/dist/{model-URPSX5FV.js.map → model-NJI57V4I.js.map} +0 -0
- /package/dist/{openai-6W76QZ5A.js.map → openai-CD6FJTQW.js.map} +0 -0
- /package/dist/{outputStyles-IUWSV34Z.js.map → outputStyles-DTQLGYLI.js.map} +0 -0
- /package/dist/{pluginRuntime-7ZEORM4F.js.map → pluginRuntime-HAYCLP4K.js.map} +0 -0
- /package/dist/{pluginValidation-OJES7FNG.js.map → pluginValidation-EXHNDUOT.js.map} +0 -0
- /package/dist/{prompts-XOIWSFPX.js.map → prompts-UGQX7FG5.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-HQOBJLOU.js.map → pybAgentSessionLoad-WRYHVHEJ.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-XDKORGD2.js.map → pybAgentSessionResume-UWLIZORC.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-FTCT4HKD.js.map → pybAgentStreamJsonSession-IPKXSPWK.js.map} +0 -0
- /package/dist/{pybHooks-FKA2AQ47.js.map → pybHooks-GMZAQ3EO.js.map} +0 -0
- /package/dist/{query-FMWLAT3K.js.map → query-LBWLTCLG.js.map} +0 -0
- /package/dist/{registry-GT6NBBK5.js.map → registry-63DZ2LVO.js.map} +0 -0
- /package/dist/{ripgrep-GHL736ND.js.map → ripgrep-XTOLMKN5.js.map} +0 -0
- /package/dist/{skillMarketplace-2IXTVWA6.js.map → skillMarketplace-BY4UWKWZ.js.map} +0 -0
- /package/dist/{state-M7627Z3G.js.map → state-34X5ECUL.js.map} +0 -0
- /package/dist/{theme-NDLGHEH5.js.map → theme-CDSY27SJ.js.map} +0 -0
- /package/dist/{toolPermissionSettings-KVBN66MO.js.map → toolPermissionSettings-RCPBRGPK.js.map} +0 -0
- /package/dist/{tools-LHTT7WYX.js.map → tools-53UXDJ64.js.map} +0 -0
- /package/dist/{userInput-GU6FNIO4.js.map → userInput-4FVP4WYV.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-E2O5ZNMG.js";
|
|
6
6
|
import {
|
|
7
7
|
appendSessionCustomTitleRecord,
|
|
8
8
|
appendSessionJsonlFromMessage,
|
|
9
9
|
appendSessionTagRecord,
|
|
10
10
|
listPybAgentSessions
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WU3KYQFA.js";
|
|
12
12
|
import {
|
|
13
13
|
formatValidationResult,
|
|
14
14
|
validatePluginOrMarketplacePath
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OQV3ASGW.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-JZ7UEGNN.js";
|
|
24
24
|
import {
|
|
25
25
|
FileSystemConversationPersistence
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-B6KK6QP2.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-4L2R7COO.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-C2XL4PP4.js";
|
|
51
51
|
import {
|
|
52
52
|
fetchCustomModels,
|
|
53
53
|
getModelFeatures
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-YGMNRXWM.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-TNVELATG.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-K6ZSF4XV.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-K5F6WOED.js";
|
|
92
92
|
import {
|
|
93
93
|
loadToolPermissionContextFromDisk,
|
|
94
94
|
persistToolPermissionUpdateToDisk
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-M74TFPOY.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-TPEX7GP6.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-N4KEHLUE.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-RF4TLZ2G.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-OXMRNROM.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-YQX2PZMK.js";
|
|
194
194
|
import {
|
|
195
195
|
getSettingsFileCandidates,
|
|
196
196
|
loadSettingsWithLegacyFallback,
|
|
197
197
|
readSettingsFile
|
|
198
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-25DI6YMP.js";
|
|
199
199
|
import {
|
|
200
200
|
getCustomCommandDirectories,
|
|
201
201
|
hasCustomCommands,
|
|
202
202
|
loadCustomCommands,
|
|
203
203
|
reloadCustomCommands
|
|
204
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-UIHCMY35.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-3YYZBLYE.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-7A7AGNEX.js";
|
|
222
222
|
import {
|
|
223
223
|
getRipgrepPath,
|
|
224
224
|
getRipgrepPolicyMode,
|
|
225
225
|
resolveRipgrepPolicy,
|
|
226
226
|
ripGrep
|
|
227
|
-
} from "./chunk-
|
|
227
|
+
} from "./chunk-IOJSVTJI.js";
|
|
228
228
|
import {
|
|
229
229
|
getTheme
|
|
230
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-XQZYIKQG.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-CARZ3VV2.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-UXJEDV2F.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-6ZXSYUC4.js";
|
|
297
297
|
import {
|
|
298
298
|
MACRO
|
|
299
|
-
} from "./chunk-
|
|
299
|
+
} from "./chunk-J6RVV73S.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-S4UIKFEI.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-S4UIKFEI.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-FM5VJH4Y.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,25 @@ 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;
|
|
7483
|
+
var BINARY_SAMPLE_BYTES = 4096;
|
|
7484
|
+
var NON_PRINTABLE_THRESHOLD = 0.3;
|
|
7485
|
+
var TEXT_LIKE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
7486
|
+
".txt",
|
|
7487
|
+
".md",
|
|
7488
|
+
".ts",
|
|
7489
|
+
".tsx",
|
|
7490
|
+
".js",
|
|
7491
|
+
".jsx",
|
|
7492
|
+
".json",
|
|
7493
|
+
".yml",
|
|
7494
|
+
".yaml",
|
|
7495
|
+
".toml",
|
|
7496
|
+
".ini",
|
|
7497
|
+
".env"
|
|
7498
|
+
]);
|
|
7469
7499
|
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".webp"]);
|
|
7470
7500
|
var MAX_WIDTH = 2e3;
|
|
7471
7501
|
var MAX_HEIGHT = 2e3;
|
|
@@ -7548,6 +7578,13 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
7548
7578
|
".swf",
|
|
7549
7579
|
".fla"
|
|
7550
7580
|
]);
|
|
7581
|
+
var binaryDetectionStats = {
|
|
7582
|
+
totalChecks: 0,
|
|
7583
|
+
extensionHitCount: 0,
|
|
7584
|
+
samplingHitCount: 0,
|
|
7585
|
+
degradationTriggerCount: 0,
|
|
7586
|
+
suspectedMisclassificationCount: 0
|
|
7587
|
+
};
|
|
7551
7588
|
var inputSchema4 = z4.strictObject({
|
|
7552
7589
|
file_path: z4.string().describe("The absolute path to the file to read"),
|
|
7553
7590
|
offset: z4.number().optional().describe(
|
|
@@ -7608,6 +7645,8 @@ var FileReadTool = {
|
|
|
7608
7645
|
}
|
|
7609
7646
|
), !verbose && numLines > MAX_LINES_TO_RENDER && /* @__PURE__ */ React13.createElement(Text13, { color: getTheme().secondaryText }, "... (+", numLines - MAX_LINES_TO_RENDER, " lines)"))));
|
|
7610
7647
|
}
|
|
7648
|
+
case "directory":
|
|
7649
|
+
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
7650
|
}
|
|
7612
7651
|
},
|
|
7613
7652
|
renderToolUseRejectedMessage() {
|
|
@@ -7633,7 +7672,7 @@ var FileReadTool = {
|
|
|
7633
7672
|
if (similarFilename) {
|
|
7634
7673
|
message += ` Did you mean ${similarFilename}?`;
|
|
7635
7674
|
}
|
|
7636
|
-
message += "\nSuggestion: If the path came from search results,
|
|
7675
|
+
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
7676
|
message += "\nSuggestion: in multi-repo or multi-branch environments, confirm the current working directory and branch before locating.";
|
|
7638
7677
|
} else if (error.includes("too long")) {
|
|
7639
7678
|
message = "Path too long (max 4096 characters). Please provide a shorter path.";
|
|
@@ -7646,11 +7685,26 @@ var FileReadTool = {
|
|
|
7646
7685
|
};
|
|
7647
7686
|
}
|
|
7648
7687
|
const ext = path5.extname(fullFilePath).toLowerCase();
|
|
7688
|
+
const isDirectory = fileCheck.stats?.isDirectory ?? false;
|
|
7689
|
+
if (isDirectory) {
|
|
7690
|
+
if (offset !== void 0 && offset < 1) {
|
|
7691
|
+
return {
|
|
7692
|
+
result: false,
|
|
7693
|
+
message: "Invalid offset. For directory reads, offset must be >= 1."
|
|
7694
|
+
};
|
|
7695
|
+
}
|
|
7696
|
+
return { result: true };
|
|
7697
|
+
}
|
|
7649
7698
|
const fileSize = fileCheck.stats?.size ?? 0;
|
|
7650
7699
|
if (BINARY_EXTENSIONS.has(ext)) {
|
|
7700
|
+
recordBinaryDetection({
|
|
7701
|
+
mode: "extension",
|
|
7702
|
+
detail: `extension:${ext}`,
|
|
7703
|
+
ext
|
|
7704
|
+
});
|
|
7651
7705
|
return {
|
|
7652
7706
|
result: false,
|
|
7653
|
-
message: `This tool cannot read binary files. The file appears to be a binary ${ext} file. Please use appropriate tools for binary file analysis.`
|
|
7707
|
+
message: `This tool cannot read binary files. The file appears to be a binary ${ext} file (extension-based detection). Please use appropriate tools for binary file analysis.`
|
|
7654
7708
|
};
|
|
7655
7709
|
}
|
|
7656
7710
|
if (fileSize === 0 && IMAGE_EXTENSIONS.has(ext)) {
|
|
@@ -7659,22 +7713,43 @@ var FileReadTool = {
|
|
|
7659
7713
|
message: "Empty image files cannot be processed."
|
|
7660
7714
|
};
|
|
7661
7715
|
}
|
|
7662
|
-
const
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7716
|
+
const isSpecialFileType = IMAGE_EXTENSIONS.has(ext) || ext === ".pdf" || ext === ".ipynb";
|
|
7717
|
+
if (!isSpecialFileType) {
|
|
7718
|
+
const sampleResult = await detectBinaryBySampling(fullFilePath, fileSize);
|
|
7719
|
+
if (sampleResult.isBinary) {
|
|
7720
|
+
recordBinaryDetection({
|
|
7721
|
+
mode: "sampling",
|
|
7722
|
+
detail: sampleResult.detail,
|
|
7723
|
+
ext
|
|
7724
|
+
});
|
|
7667
7725
|
return {
|
|
7668
7726
|
result: false,
|
|
7669
|
-
message:
|
|
7727
|
+
message: `This tool cannot read binary files. The file was identified as binary by content-sampling detection (${sampleResult.detail}). Please use appropriate tools for binary file analysis.`
|
|
7670
7728
|
};
|
|
7671
7729
|
}
|
|
7730
|
+
recordBinaryDetection({ mode: "none", ext });
|
|
7672
7731
|
}
|
|
7673
7732
|
return { result: true };
|
|
7674
7733
|
},
|
|
7675
7734
|
async *call({ file_path, offset = 1, limit = void 0, symbol_name }, { readFileTimestamps }) {
|
|
7676
7735
|
const ext = path5.extname(file_path).toLowerCase();
|
|
7677
7736
|
const fullFilePath = normalizeFilePath(file_path);
|
|
7737
|
+
const fileInfo = secureFileService.safeGetFileInfo(fullFilePath);
|
|
7738
|
+
if (!fileInfo.success || !fileInfo.stats) {
|
|
7739
|
+
throw new Error(fileInfo.error || "Failed to access file");
|
|
7740
|
+
}
|
|
7741
|
+
if (fileInfo.stats.isDirectory) {
|
|
7742
|
+
if (offset < 1) {
|
|
7743
|
+
throw new Error("Invalid offset. For directory reads, offset must be >= 1.");
|
|
7744
|
+
}
|
|
7745
|
+
const directoryData = readDirectoryPage(fullFilePath, file_path, offset, limit);
|
|
7746
|
+
yield {
|
|
7747
|
+
type: "result",
|
|
7748
|
+
data: directoryData,
|
|
7749
|
+
resultForAssistant: this.renderResultForAssistant(directoryData)
|
|
7750
|
+
};
|
|
7751
|
+
return;
|
|
7752
|
+
}
|
|
7678
7753
|
let startLine = offset;
|
|
7679
7754
|
let finalLimit = limit;
|
|
7680
7755
|
if (symbol_name) {
|
|
@@ -7700,8 +7775,12 @@ var FileReadTool = {
|
|
|
7700
7775
|
if (!symbol) {
|
|
7701
7776
|
throw new Error(`Symbol '${symbol_name}' not found in file. Use offset/limit or LspTool instead.`);
|
|
7702
7777
|
}
|
|
7703
|
-
|
|
7704
|
-
|
|
7778
|
+
const range = getSymbolRange(symbol);
|
|
7779
|
+
if (!range) {
|
|
7780
|
+
throw new Error(`Symbol '${symbol_name}' has no valid range information`);
|
|
7781
|
+
}
|
|
7782
|
+
startLine = range.start.line + 1;
|
|
7783
|
+
finalLimit = range.end.line - range.start.line + 1;
|
|
7705
7784
|
} catch (e) {
|
|
7706
7785
|
throw new Error(`Symbol reading failed: ${e.message}`);
|
|
7707
7786
|
}
|
|
@@ -7764,6 +7843,20 @@ var FileReadTool = {
|
|
|
7764
7843
|
};
|
|
7765
7844
|
return;
|
|
7766
7845
|
}
|
|
7846
|
+
if (BINARY_EXTENSIONS.has(ext)) {
|
|
7847
|
+
throw new Error(
|
|
7848
|
+
`This tool cannot read binary files. The file appears to be a binary ${ext} file (extension-based detection). Please use appropriate tools for binary file analysis.`
|
|
7849
|
+
);
|
|
7850
|
+
}
|
|
7851
|
+
const sampleResult = await detectBinaryBySampling(
|
|
7852
|
+
fullFilePath,
|
|
7853
|
+
fileInfo.stats.size ?? 0
|
|
7854
|
+
);
|
|
7855
|
+
if (sampleResult.isBinary) {
|
|
7856
|
+
throw new Error(
|
|
7857
|
+
`This tool cannot read binary files. The file was identified as binary by content-sampling detection (${sampleResult.detail}). Please use appropriate tools for binary file analysis.`
|
|
7858
|
+
);
|
|
7859
|
+
}
|
|
7767
7860
|
let zeroBasedOffset = startLine === 0 ? 0 : startLine - 1;
|
|
7768
7861
|
if (limit && !symbol_name) {
|
|
7769
7862
|
try {
|
|
@@ -7788,7 +7881,7 @@ var FileReadTool = {
|
|
|
7788
7881
|
);
|
|
7789
7882
|
}
|
|
7790
7883
|
}
|
|
7791
|
-
const { content,
|
|
7884
|
+
const { content, totalLines } = readTextContent(
|
|
7792
7885
|
fullFilePath,
|
|
7793
7886
|
zeroBasedOffset,
|
|
7794
7887
|
finalLimit
|
|
@@ -7796,19 +7889,21 @@ var FileReadTool = {
|
|
|
7796
7889
|
const truncatedLines = content.split(/\r?\n/).map(
|
|
7797
7890
|
(line) => line.length > MAX_LINE_LENGTH2 ? line.slice(0, MAX_LINE_LENGTH2) : line
|
|
7798
7891
|
).join("\n");
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
}
|
|
7892
|
+
const textPage = capTextOutput(truncatedLines, {
|
|
7893
|
+
startLine,
|
|
7894
|
+
maxLines: MAX_TEXT_OUTPUT_LINES,
|
|
7895
|
+
maxBytes: MAX_TEXT_OUTPUT_BYTES
|
|
7896
|
+
});
|
|
7804
7897
|
const data = {
|
|
7805
7898
|
type: "text",
|
|
7806
7899
|
file: {
|
|
7807
7900
|
filePath: file_path,
|
|
7808
|
-
content:
|
|
7809
|
-
numLines: lineCount,
|
|
7901
|
+
content: textPage.content,
|
|
7902
|
+
numLines: textPage.lineCount,
|
|
7810
7903
|
startLine,
|
|
7811
|
-
totalLines
|
|
7904
|
+
totalLines,
|
|
7905
|
+
truncated: textPage.truncated,
|
|
7906
|
+
nextOffset: textPage.nextOffset
|
|
7812
7907
|
}
|
|
7813
7908
|
};
|
|
7814
7909
|
yield {
|
|
@@ -7848,10 +7943,190 @@ var FileReadTool = {
|
|
|
7848
7943
|
content: data.file.content,
|
|
7849
7944
|
startLine: data.file.startLine
|
|
7850
7945
|
});
|
|
7946
|
+
case "directory":
|
|
7947
|
+
return data.file.content;
|
|
7851
7948
|
}
|
|
7852
7949
|
}
|
|
7853
7950
|
};
|
|
7854
|
-
|
|
7951
|
+
function readDirectoryPage(fullFilePath, sourceFilePath, offset, limit) {
|
|
7952
|
+
const entries = readdirSync(fullFilePath, { withFileTypes: true });
|
|
7953
|
+
const items = entries.map((entry) => ({
|
|
7954
|
+
name: entry.name,
|
|
7955
|
+
isDir: isDirectoryEntry(fullFilePath, entry)
|
|
7956
|
+
})).sort((a, b) => {
|
|
7957
|
+
if (a.isDir !== b.isDir) {
|
|
7958
|
+
return a.isDir ? -1 : 1;
|
|
7959
|
+
}
|
|
7960
|
+
return a.name.localeCompare(b.name);
|
|
7961
|
+
});
|
|
7962
|
+
const startIndex = Math.max(0, offset - 1);
|
|
7963
|
+
const pageSize = Math.max(1, limit ?? DIRECTORY_DEFAULT_LIMIT);
|
|
7964
|
+
if (items.length > 0 && startIndex >= items.length) {
|
|
7965
|
+
throw new Error(
|
|
7966
|
+
`Directory pagination offset out of range: offset=${offset}, totalEntries=${items.length}.`
|
|
7967
|
+
);
|
|
7968
|
+
}
|
|
7969
|
+
const pageItems = items.slice(startIndex, startIndex + pageSize);
|
|
7970
|
+
const truncated = startIndex + pageSize < items.length;
|
|
7971
|
+
const nextOffset = truncated ? startIndex + pageItems.length + 1 : void 0;
|
|
7972
|
+
const content = renderDirectoryTreePage(
|
|
7973
|
+
fullFilePath,
|
|
7974
|
+
pageItems,
|
|
7975
|
+
truncated,
|
|
7976
|
+
nextOffset,
|
|
7977
|
+
pageSize
|
|
7978
|
+
);
|
|
7979
|
+
return {
|
|
7980
|
+
type: "directory",
|
|
7981
|
+
file: {
|
|
7982
|
+
filePath: sourceFilePath,
|
|
7983
|
+
content,
|
|
7984
|
+
numEntries: pageItems.length,
|
|
7985
|
+
startEntry: offset,
|
|
7986
|
+
totalEntries: items.length,
|
|
7987
|
+
truncated,
|
|
7988
|
+
nextOffset
|
|
7989
|
+
}
|
|
7990
|
+
};
|
|
7991
|
+
}
|
|
7992
|
+
function isDirectoryEntry(fullFilePath, entry) {
|
|
7993
|
+
if (entry.isDirectory()) {
|
|
7994
|
+
return true;
|
|
7995
|
+
}
|
|
7996
|
+
try {
|
|
7997
|
+
return statSync7(path5.join(fullFilePath, entry.name)).isDirectory();
|
|
7998
|
+
} catch {
|
|
7999
|
+
return false;
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
8002
|
+
function renderDirectoryTreePage(rootPath, pageItems, truncated, nextOffset, pageSize) {
|
|
8003
|
+
const rootLabel = rootPath.endsWith(path5.sep) ? rootPath : `${rootPath}${path5.sep}`;
|
|
8004
|
+
const lines = [rootLabel];
|
|
8005
|
+
for (let i = 0; i < pageItems.length; i++) {
|
|
8006
|
+
const connector = i === pageItems.length - 1 ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
8007
|
+
const suffix = pageItems[i].isDir ? path5.sep : "";
|
|
8008
|
+
lines.push(`${connector}${pageItems[i].name}${suffix}`);
|
|
8009
|
+
}
|
|
8010
|
+
if (truncated && nextOffset) {
|
|
8011
|
+
lines.push(`
|
|
8012
|
+
Use offset=${nextOffset} limit=${pageSize} to continue`);
|
|
8013
|
+
} else {
|
|
8014
|
+
lines.push("\nEnd of directory");
|
|
8015
|
+
}
|
|
8016
|
+
return lines.join("\n");
|
|
8017
|
+
}
|
|
8018
|
+
function getSymbolRange(symbol) {
|
|
8019
|
+
const directRange = symbol?.range;
|
|
8020
|
+
if (typeof directRange?.start?.line === "number" && typeof directRange?.end?.line === "number") {
|
|
8021
|
+
return directRange;
|
|
8022
|
+
}
|
|
8023
|
+
const locationRange = symbol?.location?.range;
|
|
8024
|
+
if (typeof locationRange?.start?.line === "number" && typeof locationRange?.end?.line === "number") {
|
|
8025
|
+
return locationRange;
|
|
8026
|
+
}
|
|
8027
|
+
return null;
|
|
8028
|
+
}
|
|
8029
|
+
function capTextOutput(content, options) {
|
|
8030
|
+
const lines = content.split(/\r?\n/);
|
|
8031
|
+
const limitedByLines = lines.slice(0, options.maxLines);
|
|
8032
|
+
const bytes = [];
|
|
8033
|
+
let currentBytes = 0;
|
|
8034
|
+
for (let i = 0; i < limitedByLines.length; i++) {
|
|
8035
|
+
const segment = i === 0 ? limitedByLines[i] : `
|
|
8036
|
+
${limitedByLines[i]}`;
|
|
8037
|
+
const segmentBytes = Buffer.byteLength(segment, "utf8");
|
|
8038
|
+
if (currentBytes + segmentBytes > options.maxBytes) {
|
|
8039
|
+
break;
|
|
8040
|
+
}
|
|
8041
|
+
bytes.push(limitedByLines[i]);
|
|
8042
|
+
currentBytes += segmentBytes;
|
|
8043
|
+
}
|
|
8044
|
+
const lineCount = bytes.length;
|
|
8045
|
+
const truncated = lineCount < lines.length;
|
|
8046
|
+
const nextOffset = truncated ? options.startLine + lineCount : void 0;
|
|
8047
|
+
return {
|
|
8048
|
+
content: bytes.join("\n"),
|
|
8049
|
+
lineCount,
|
|
8050
|
+
truncated,
|
|
8051
|
+
nextOffset
|
|
8052
|
+
};
|
|
8053
|
+
}
|
|
8054
|
+
async function detectBinaryBySampling(filePath, fileSize) {
|
|
8055
|
+
if (fileSize <= 0) {
|
|
8056
|
+
return { isBinary: false };
|
|
8057
|
+
}
|
|
8058
|
+
const sampleSize = Math.min(BINARY_SAMPLE_BYTES, fileSize);
|
|
8059
|
+
try {
|
|
8060
|
+
const buffer = await Bun.file(filePath).slice(0, sampleSize).arrayBuffer();
|
|
8061
|
+
const bytes = new Uint8Array(buffer);
|
|
8062
|
+
if (bytes.length === 0) {
|
|
8063
|
+
return { isBinary: false };
|
|
8064
|
+
}
|
|
8065
|
+
let nonPrintableCount = 0;
|
|
8066
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
8067
|
+
const byte = bytes[i];
|
|
8068
|
+
if (byte === 0) {
|
|
8069
|
+
return { isBinary: true, detail: "null-byte" };
|
|
8070
|
+
}
|
|
8071
|
+
if (byte < 9 || byte > 13 && byte < 32) {
|
|
8072
|
+
nonPrintableCount++;
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8075
|
+
const ratio = nonPrintableCount / bytes.length;
|
|
8076
|
+
if (ratio > NON_PRINTABLE_THRESHOLD) {
|
|
8077
|
+
return { isBinary: true, detail: "non-printable-ratio" };
|
|
8078
|
+
}
|
|
8079
|
+
return { isBinary: false };
|
|
8080
|
+
} catch (error) {
|
|
8081
|
+
recordBinaryDetection({
|
|
8082
|
+
mode: "none",
|
|
8083
|
+
detail: "sampling-read-error",
|
|
8084
|
+
degraded: true,
|
|
8085
|
+
ext: path5.extname(filePath).toLowerCase()
|
|
8086
|
+
});
|
|
8087
|
+
logError(error);
|
|
8088
|
+
return { isBinary: false };
|
|
8089
|
+
}
|
|
8090
|
+
}
|
|
8091
|
+
function recordBinaryDetection({
|
|
8092
|
+
mode,
|
|
8093
|
+
detail,
|
|
8094
|
+
degraded = false,
|
|
8095
|
+
ext
|
|
8096
|
+
}) {
|
|
8097
|
+
binaryDetectionStats.totalChecks++;
|
|
8098
|
+
if (mode === "extension") {
|
|
8099
|
+
binaryDetectionStats.extensionHitCount++;
|
|
8100
|
+
}
|
|
8101
|
+
if (mode === "sampling") {
|
|
8102
|
+
binaryDetectionStats.samplingHitCount++;
|
|
8103
|
+
if (ext && TEXT_LIKE_EXTENSIONS.has(ext)) {
|
|
8104
|
+
binaryDetectionStats.suspectedMisclassificationCount++;
|
|
8105
|
+
}
|
|
8106
|
+
}
|
|
8107
|
+
if (degraded) {
|
|
8108
|
+
binaryDetectionStats.degradationTriggerCount++;
|
|
8109
|
+
}
|
|
8110
|
+
emitTelemetryEvent({
|
|
8111
|
+
channel: "tool.read.binary_detection",
|
|
8112
|
+
phase: "decision",
|
|
8113
|
+
timestamp: Date.now(),
|
|
8114
|
+
data: {
|
|
8115
|
+
mode,
|
|
8116
|
+
detail: detail || null,
|
|
8117
|
+
degraded,
|
|
8118
|
+
ext: ext || null,
|
|
8119
|
+
totalChecks: binaryDetectionStats.totalChecks,
|
|
8120
|
+
extensionHitCount: binaryDetectionStats.extensionHitCount,
|
|
8121
|
+
samplingHitCount: binaryDetectionStats.samplingHitCount,
|
|
8122
|
+
degradationTriggerCount: binaryDetectionStats.degradationTriggerCount,
|
|
8123
|
+
suspectedMisclassificationCount: binaryDetectionStats.suspectedMisclassificationCount,
|
|
8124
|
+
samplingHitRate: binaryDetectionStats.totalChecks > 0 ? Number(
|
|
8125
|
+
(binaryDetectionStats.samplingHitCount / binaryDetectionStats.totalChecks).toFixed(4)
|
|
8126
|
+
) : 0
|
|
8127
|
+
}
|
|
8128
|
+
});
|
|
8129
|
+
}
|
|
7855
8130
|
var isSecurityError = (error) => {
|
|
7856
8131
|
const patterns = [
|
|
7857
8132
|
"outside allowed directories",
|
|
@@ -8174,16 +8449,9 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8174
8449
|
- 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
8450
|
- This tool is for FINDING files.
|
|
8176
8451
|
|
|
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)
|
|
8452
|
+
## Directory Structure Guidance
|
|
8453
|
+
- For one-level directory structure, use Read directly on the directory path (offset>=1, optional limit)
|
|
8454
|
+
- Use Glob for file-path discovery and candidate narrowing, not as the primary one-level directory listing workflow
|
|
8187
8455
|
|
|
8188
8456
|
## Search Strategy
|
|
8189
8457
|
- **Broad-to-Narrow Pattern**: Start with a broad pattern, then narrow based on results.
|
|
@@ -8191,20 +8459,19 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8191
8459
|
- Step 2: Analyze results and refine with more specific patterns
|
|
8192
8460
|
- Example: "\`**/*.test.ts\`" \u2192 too many results \u2192 "src/**/auth*.test.ts"
|
|
8193
8461
|
- **Pattern Selection Guide**:
|
|
8194
|
-
- Unknown structure? Start with \`
|
|
8462
|
+
- Unknown structure? Start with \`**/*.{ext}\` to discover layout, then use Read on specific directory paths for one-level structure
|
|
8195
8463
|
- Looking for specific type? Use descriptive names: \`**/test*\`, \`**/config*\`
|
|
8196
8464
|
- In a specific area? Combine path + pattern: \`src/auth/**/*.ts\`
|
|
8197
8465
|
- **Discovery Workflow**: For unfamiliar codebases, run these in parallel:
|
|
8198
|
-
-
|
|
8466
|
+
- \`**/package.json\`, \`**/*.{ts,js,tsx,jsx}\`, \`**/README*\`, \`**/*config*.{ts,js,json}\`
|
|
8199
8467
|
- Analyze structure \u2192 refine search \u2192 read key files
|
|
8200
8468
|
- **Tool Collaboration**:
|
|
8201
|
-
-
|
|
8469
|
+
- Read \`directory_path\` \u2192 Get one-level directory tree structure
|
|
8202
8470
|
- Grep \u2192 After Glob finds files, use Grep to search content
|
|
8203
8471
|
- Read \u2192 Read the found file contents
|
|
8204
8472
|
|
|
8205
8473
|
## Usage Details
|
|
8206
8474
|
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
8207
|
-
- Use \`dir/*\` pattern to list immediate children of a directory (single level, non-recursive)
|
|
8208
8475
|
- Returns absolute file paths sorted by modification time (most recent first)
|
|
8209
8476
|
- Use this tool when you need to find files by name patterns
|
|
8210
8477
|
- Powered by ripgrep with \`--files\` mode for fast pattern matching
|
|
@@ -8216,40 +8483,33 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8216
8483
|
- **Truncated Results**: When results are truncated (limited to 100 files), narrow down using:
|
|
8217
8484
|
1. Add a more specific path: \`src/core/**/*.ts\` instead of \`**/*.ts\`
|
|
8218
8485
|
2. Use file extension filter: \`src/**/*.test.ts\` instead of \`src/**/*.ts\`
|
|
8219
|
-
3. Use
|
|
8486
|
+
3. Use Read on a specific directory path to confirm one-level structure, then target specific directories with Glob
|
|
8220
8487
|
|
|
8221
8488
|
## Typical Usage Examples
|
|
8222
8489
|
|
|
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)
|
|
8490
|
+
### Example 1: Project Structure Discovery (Unknown Codebase)
|
|
8231
8491
|
<example>
|
|
8232
8492
|
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="
|
|
8493
|
+
assistant: [uses Glob tool with pattern="**/package.json" to find project roots]
|
|
8494
|
+
[reads the confirmed source directory path to inspect one-level tree structure]
|
|
8495
|
+
[uses Glob tool with pattern="**/*.{ts,tsx,js,jsx}" to locate major source areas]
|
|
8236
8496
|
</example>
|
|
8237
8497
|
|
|
8238
|
-
### Example
|
|
8498
|
+
### Example 2: Find Files by Type in Specific Area
|
|
8239
8499
|
<example>
|
|
8240
8500
|
user: Find all test files in the auth module
|
|
8241
8501
|
assistant: [uses Glob tool with pattern="src/auth/**/*.test.ts"]
|
|
8242
8502
|
[uses Read tool to examine specific test files]
|
|
8243
8503
|
</example>
|
|
8244
8504
|
|
|
8245
|
-
### Example
|
|
8505
|
+
### Example 3: Config File Location (Deterministic)
|
|
8246
8506
|
<example>
|
|
8247
8507
|
user: Where is the webpack configuration?
|
|
8248
8508
|
assistant: [uses Glob tool with pattern="**/webpack*.{js,ts,json}"]
|
|
8249
8509
|
[uses Read tool on the matched config file]
|
|
8250
8510
|
</example>
|
|
8251
8511
|
|
|
8252
|
-
### Example
|
|
8512
|
+
### Example 4: Parallel Discovery for Entry Points
|
|
8253
8513
|
<example>
|
|
8254
8514
|
user: What are the main entry points of this application?
|
|
8255
8515
|
assistant: [uses Glob tool with pattern="**/index.{ts,js}"]
|
|
@@ -8258,7 +8518,7 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8258
8518
|
[uses Read tool to examine the entry point files]
|
|
8259
8519
|
</example>
|
|
8260
8520
|
|
|
8261
|
-
### Example
|
|
8521
|
+
### Example 5: Narrow Down After Broad Results
|
|
8262
8522
|
<example>
|
|
8263
8523
|
user: Find all TypeScript files in the project
|
|
8264
8524
|
assistant: [uses Glob tool with pattern="**/*.ts" - returns 500+ files, truncated]
|
|
@@ -8269,7 +8529,7 @@ var DESCRIPTION4 = `Fast file pattern matching tool that works with any codebase
|
|
|
8269
8529
|
|
|
8270
8530
|
// src/tools/filesystem/GlobTool/GlobTool.tsx
|
|
8271
8531
|
import { existsSync as existsSync6, statSync as statSync9 } from "fs";
|
|
8272
|
-
import { isAbsolute as isAbsolute6, join as
|
|
8532
|
+
import { isAbsolute as isAbsolute6, join as join5, relative as relative8, resolve as resolve6 } from "path";
|
|
8273
8533
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8274
8534
|
var inputSchema6 = z6.strictObject({
|
|
8275
8535
|
pattern: z6.string().describe("The glob pattern to match files against"),
|
|
@@ -8356,7 +8616,7 @@ var GlobTool = {
|
|
|
8356
8616
|
searchPath,
|
|
8357
8617
|
abortController.signal
|
|
8358
8618
|
);
|
|
8359
|
-
let files = raw.map((p) => isAbsolute6(p) ? p :
|
|
8619
|
+
let files = raw.map((p) => isAbsolute6(p) ? p : join5(searchPath, p));
|
|
8360
8620
|
const scopedPath = resolve6(searchPath);
|
|
8361
8621
|
let semanticNotice;
|
|
8362
8622
|
if (semantic && files.length === 0) {
|
|
@@ -8403,9 +8663,9 @@ var GlobTool = {
|
|
|
8403
8663
|
renderResultForAssistant(output) {
|
|
8404
8664
|
let result = output.filenames.join("\n");
|
|
8405
8665
|
if (output.filenames.length === 0) {
|
|
8406
|
-
result =
|
|
8666
|
+
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
8667
|
} 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)
|
|
8668
|
+
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
8669
|
}
|
|
8410
8670
|
if (output.semanticNotice) {
|
|
8411
8671
|
return `${result}
|
|
@@ -8449,7 +8709,7 @@ var DESCRIPTION5 = `A powerful fast content search tool that works with any code
|
|
|
8449
8709
|
- No results? Broaden pattern, try case-insensitive (\`-i\`), or try alternative keywords
|
|
8450
8710
|
- Wrong results? Adjust pattern, check regex syntax, try alternative keywords
|
|
8451
8711
|
- **Tool Collaboration**:
|
|
8452
|
-
-
|
|
8712
|
+
- Read "directory_path" \u2192 Confirm one-level directory structure for search scope
|
|
8453
8713
|
- Glob "file_path" \u2192 Confirm file path existence
|
|
8454
8714
|
- Read \u2192 Read specific content of matched files
|
|
8455
8715
|
- LspTool \u2192 Trace definitions and references (replace manual Grep tracing)
|
|
@@ -8679,14 +8939,14 @@ var GrepTool = {
|
|
|
8679
8939
|
|
|
8680
8940
|
${result.semanticNotice}` : base;
|
|
8681
8941
|
if (result.mode === "content") {
|
|
8682
|
-
const base = result.content && result.content.length > 0 ? truncateToCharBudget(result.content) :
|
|
8942
|
+
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
8943
|
const withPagination = pagination ? `${base}
|
|
8684
8944
|
|
|
8685
8945
|
[Showing results with pagination = ${pagination}]` : base;
|
|
8686
8946
|
return appendNotice(withPagination);
|
|
8687
8947
|
}
|
|
8688
8948
|
if (result.mode === "count") {
|
|
8689
|
-
const base = result.content && result.content.length > 0 ? truncateToCharBudget(result.content) :
|
|
8949
|
+
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
8950
|
const numMatches = result.numMatches ?? 0;
|
|
8691
8951
|
const numFiles = result.numFiles ?? 0;
|
|
8692
8952
|
const summary = base + `
|
|
@@ -8696,7 +8956,7 @@ Found ${numMatches} total ${numMatches === 1 ? "occurrence" : "occurrences"} acr
|
|
|
8696
8956
|
}
|
|
8697
8957
|
if (result.numFiles === 0) {
|
|
8698
8958
|
return appendNotice(
|
|
8699
|
-
|
|
8959
|
+
"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
8960
|
);
|
|
8701
8961
|
}
|
|
8702
8962
|
const header = `Found ${result.numFiles} file${result.numFiles === 1 ? "" : "s"}${pagination ? ` ${pagination}` : ""}
|
|
@@ -11052,7 +11312,7 @@ function PressEnterToContinue() {
|
|
|
11052
11312
|
}
|
|
11053
11313
|
|
|
11054
11314
|
// src/services/stability/runtimeAssetHealth/checks/ripgrep.ts
|
|
11055
|
-
import { join as
|
|
11315
|
+
import { join as join6, sep as sep4 } from "node:path";
|
|
11056
11316
|
import envPaths from "env-paths";
|
|
11057
11317
|
async function resolveRipgrepPath() {
|
|
11058
11318
|
return getRipgrepPath();
|
|
@@ -11065,7 +11325,7 @@ function detectRipgrepSource(resolvedPath) {
|
|
|
11065
11325
|
if (explicit && normalizePath(explicit) === normalizePath(resolvedPath)) {
|
|
11066
11326
|
return "explicit";
|
|
11067
11327
|
}
|
|
11068
|
-
if (resolvedPath.includes(`${
|
|
11328
|
+
if (resolvedPath.includes(`${sep4}resources${sep4}ripgrep${sep4}`)) {
|
|
11069
11329
|
return "vendor";
|
|
11070
11330
|
}
|
|
11071
11331
|
const cacheRoot = getRipgrepCacheRoot();
|
|
@@ -11111,14 +11371,14 @@ function resolveRipgrepPolicyVisibility() {
|
|
|
11111
11371
|
function getRipgrepCacheRoot() {
|
|
11112
11372
|
const override = process.env.PYB_RIPGREP_CACHE_DIR?.trim();
|
|
11113
11373
|
if (override) return override;
|
|
11114
|
-
return
|
|
11374
|
+
return join6(envPaths("pyb").cache, "ripgrep");
|
|
11115
11375
|
}
|
|
11116
11376
|
function normalizePath(value) {
|
|
11117
|
-
return value.replaceAll("/",
|
|
11377
|
+
return value.replaceAll("/", sep4).replaceAll("\\", sep4).toLowerCase();
|
|
11118
11378
|
}
|
|
11119
11379
|
function isLikelyPathResolved(value) {
|
|
11120
11380
|
const normalized = normalizePath(value);
|
|
11121
|
-
return normalized.includes(`${
|
|
11381
|
+
return normalized.includes(`${sep4}bin${sep4}`) || normalized.endsWith(`${sep4}rg`);
|
|
11122
11382
|
}
|
|
11123
11383
|
|
|
11124
11384
|
// src/services/stability/runtimeAssetHealth/diagnostics.ts
|
|
@@ -11541,7 +11801,7 @@ var help_default = help;
|
|
|
11541
11801
|
import * as React28 from "react";
|
|
11542
11802
|
import { Box as Box21, Text as Text24 } from "ink";
|
|
11543
11803
|
import { existsSync as existsSync8 } from "fs";
|
|
11544
|
-
import { join as
|
|
11804
|
+
import { join as join7 } from "path";
|
|
11545
11805
|
import { homedir as homedir6 } from "os";
|
|
11546
11806
|
|
|
11547
11807
|
// src/constants/releaseNotes.ts
|
|
@@ -11589,7 +11849,7 @@ function ProjectOnboarding({
|
|
|
11589
11849
|
if (!showOnboarding && !hasReleaseNotes) {
|
|
11590
11850
|
return null;
|
|
11591
11851
|
}
|
|
11592
|
-
const workspaceHasProjectGuide = existsSync8(
|
|
11852
|
+
const workspaceHasProjectGuide = existsSync8(join7(workspaceDir, PROJECT_FILE));
|
|
11593
11853
|
const isWorkspaceDirEmpty = isDirEmpty(workspaceDir);
|
|
11594
11854
|
const shouldRecommendProjectGuide = !workspaceHasProjectGuide && !isWorkspaceDirEmpty;
|
|
11595
11855
|
const theme = getTheme();
|
|
@@ -11744,8 +12004,8 @@ function getReplStaticPrefixLength(orderedMessages, allMessages, unresolvedToolU
|
|
|
11744
12004
|
}
|
|
11745
12005
|
|
|
11746
12006
|
// src/commands/messages-debug.ts
|
|
11747
|
-
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync6, statSync as statSync10 } from "fs";
|
|
11748
|
-
import { join as
|
|
12007
|
+
import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync6, statSync as statSync10 } from "fs";
|
|
12008
|
+
import { join as join8 } from "path";
|
|
11749
12009
|
function isDebugMode() {
|
|
11750
12010
|
return process.argv.includes("--debug") || process.argv.includes("--debug-verbose");
|
|
11751
12011
|
}
|
|
@@ -11777,11 +12037,11 @@ function getProgressText(message) {
|
|
|
11777
12037
|
function getLatestMessagesLogFile() {
|
|
11778
12038
|
const dir = CACHE_PATHS.messages();
|
|
11779
12039
|
if (!existsSync9(dir)) return null;
|
|
11780
|
-
const files =
|
|
12040
|
+
const files = readdirSync2(dir).filter((f) => f.endsWith(".json"));
|
|
11781
12041
|
if (files.length === 0) return null;
|
|
11782
12042
|
let best = null;
|
|
11783
12043
|
for (const file of files) {
|
|
11784
|
-
const fullPath =
|
|
12044
|
+
const fullPath = join8(dir, file);
|
|
11785
12045
|
let mtimeMs = 0;
|
|
11786
12046
|
try {
|
|
11787
12047
|
mtimeMs = statSync10(fullPath).mtimeMs;
|
|
@@ -12175,7 +12435,7 @@ async function createAndStoreApiKey(accessToken) {
|
|
|
12175
12435
|
}
|
|
12176
12436
|
saveGlobalConfig(config2);
|
|
12177
12437
|
try {
|
|
12178
|
-
const { resetAnthropicClient } = await import("./llm-
|
|
12438
|
+
const { resetAnthropicClient } = await import("./llm-S4UIKFEI.js");
|
|
12179
12439
|
resetAnthropicClient();
|
|
12180
12440
|
} catch {
|
|
12181
12441
|
}
|
|
@@ -16599,7 +16859,7 @@ async function refreshPluginRuntimeFromInstalls() {
|
|
|
16599
16859
|
const existingRoots = getSessionPlugins().map((p) => p.rootDir);
|
|
16600
16860
|
const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
|
|
16601
16861
|
if (dirs.length === 0) return [];
|
|
16602
|
-
const { configureSessionPlugins } = await import("./pluginRuntime-
|
|
16862
|
+
const { configureSessionPlugins } = await import("./pluginRuntime-HAYCLP4K.js");
|
|
16603
16863
|
const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
|
|
16604
16864
|
return errors;
|
|
16605
16865
|
}
|
|
@@ -17274,7 +17534,7 @@ async function call(onDone, context) {
|
|
|
17274
17534
|
ModelConfig,
|
|
17275
17535
|
{
|
|
17276
17536
|
onClose: () => {
|
|
17277
|
-
import("./model-
|
|
17537
|
+
import("./model-NJI57V4I.js").then(({ reloadModelManager: reloadModelManager2 }) => {
|
|
17278
17538
|
reloadModelManager2();
|
|
17279
17539
|
triggerModelConfigChange();
|
|
17280
17540
|
onDone();
|
|
@@ -18251,7 +18511,7 @@ function resolveAutoMemoryFlags(env2 = process.env) {
|
|
|
18251
18511
|
|
|
18252
18512
|
// src/services/memory/inject.ts
|
|
18253
18513
|
import { existsSync as existsSync10, readFileSync as readFileSync7 } from "fs";
|
|
18254
|
-
import { join as
|
|
18514
|
+
import { join as join9 } from "path";
|
|
18255
18515
|
|
|
18256
18516
|
// src/services/memory/paths.ts
|
|
18257
18517
|
import { isAbsolute as isAbsolute8, relative as relative10, resolve as resolve8 } from "path";
|
|
@@ -18371,7 +18631,7 @@ function getMemoryFilePath(input) {
|
|
|
18371
18631
|
agentId,
|
|
18372
18632
|
agentType: input.agentType
|
|
18373
18633
|
});
|
|
18374
|
-
return
|
|
18634
|
+
return join9(agentMemoryDir, "MEMORY.md");
|
|
18375
18635
|
}
|
|
18376
18636
|
function truncateByLines(content, maxLines) {
|
|
18377
18637
|
return content.split("\n").slice(0, maxLines).join("\n");
|
|
@@ -18740,12 +19000,12 @@ import {
|
|
|
18740
19000
|
mkdirSync as mkdirSync5,
|
|
18741
19001
|
openSync,
|
|
18742
19002
|
readFileSync as readFileSync8,
|
|
18743
|
-
readdirSync as
|
|
19003
|
+
readdirSync as readdirSync3,
|
|
18744
19004
|
renameSync as renameSync2,
|
|
18745
19005
|
rmSync,
|
|
18746
19006
|
writeFileSync as writeFileSync3
|
|
18747
19007
|
} from "fs";
|
|
18748
|
-
import { join as
|
|
19008
|
+
import { join as join10 } from "path";
|
|
18749
19009
|
import { homedir as homedir7 } from "os";
|
|
18750
19010
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
18751
19011
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -18970,15 +19230,15 @@ function resolveGlobalTaskRootDir() {
|
|
|
18970
19230
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
18971
19231
|
if (override) return override;
|
|
18972
19232
|
const home = homedir7();
|
|
18973
|
-
const pybDir =
|
|
19233
|
+
const pybDir = join10(home, ".pyb");
|
|
18974
19234
|
if (existsSync11(pybDir)) return pybDir;
|
|
18975
|
-
const claudeDir =
|
|
19235
|
+
const claudeDir = join10(home, ".claude");
|
|
18976
19236
|
if (existsSync11(claudeDir)) return claudeDir;
|
|
18977
19237
|
return pybDir;
|
|
18978
19238
|
}
|
|
18979
19239
|
function findBaseDirWithList(listId, candidates) {
|
|
18980
19240
|
for (const candidate of candidates) {
|
|
18981
|
-
if (existsSync11(
|
|
19241
|
+
if (existsSync11(join10(candidate, listId))) return candidate;
|
|
18982
19242
|
}
|
|
18983
19243
|
return null;
|
|
18984
19244
|
}
|
|
@@ -19015,39 +19275,39 @@ function getTaskListId(options) {
|
|
|
19015
19275
|
}
|
|
19016
19276
|
function resolveTaskBaseDir(context, cwd) {
|
|
19017
19277
|
if (context.scope === "project") {
|
|
19018
|
-
const pybDir =
|
|
19019
|
-
const claudeDir =
|
|
19278
|
+
const pybDir = join10(cwd, ".pyb");
|
|
19279
|
+
const claudeDir = join10(cwd, ".claude");
|
|
19020
19280
|
const hasProjectPyb = existsSync11(pybDir);
|
|
19021
19281
|
const hasProjectClaude = existsSync11(claudeDir);
|
|
19022
19282
|
const projectRoot = hasProjectPyb ? pybDir : hasProjectClaude ? claudeDir : pybDir;
|
|
19023
19283
|
const override2 = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19024
|
-
const defaultBaseDir2 = !hasProjectPyb && !hasProjectClaude && override2 ?
|
|
19284
|
+
const defaultBaseDir2 = !hasProjectPyb && !hasProjectClaude && override2 ? join10(override2, "tasks") : join10(projectRoot, "tasks");
|
|
19025
19285
|
const candidates2 = [
|
|
19026
|
-
|
|
19027
|
-
|
|
19028
|
-
...override2 ? [
|
|
19286
|
+
join10(cwd, ".pyb", "tasks"),
|
|
19287
|
+
join10(cwd, ".claude", "tasks"),
|
|
19288
|
+
...override2 ? [join10(override2, "tasks")] : [],
|
|
19029
19289
|
resolveXdgDataPath("tasks")
|
|
19030
19290
|
];
|
|
19031
19291
|
return findBaseDirWithList(context.listId, candidates2) ?? defaultBaseDir2;
|
|
19032
19292
|
}
|
|
19033
19293
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19034
|
-
const globalCandidates = override ? [
|
|
19035
|
-
|
|
19036
|
-
|
|
19294
|
+
const globalCandidates = override ? [join10(override, "tasks")] : [
|
|
19295
|
+
join10(homedir7(), ".pyb", "tasks"),
|
|
19296
|
+
join10(homedir7(), ".claude", "tasks")
|
|
19037
19297
|
];
|
|
19038
|
-
const defaultBaseDir =
|
|
19298
|
+
const defaultBaseDir = join10(resolveGlobalTaskRootDir(), "tasks");
|
|
19039
19299
|
const candidates = [...globalCandidates, resolveXdgDataPath("tasks")];
|
|
19040
19300
|
return findBaseDirWithList(context.listId, candidates) ?? defaultBaseDir;
|
|
19041
19301
|
}
|
|
19042
19302
|
function buildTaskListPaths(baseDir, listId) {
|
|
19043
|
-
const listDir =
|
|
19303
|
+
const listDir = join10(baseDir, listId);
|
|
19044
19304
|
return {
|
|
19045
19305
|
listId,
|
|
19046
19306
|
baseDir,
|
|
19047
19307
|
listDir,
|
|
19048
19308
|
tasksDir: listDir,
|
|
19049
|
-
lockPath:
|
|
19050
|
-
highwatermarkPath:
|
|
19309
|
+
lockPath: join10(listDir, ".lock"),
|
|
19310
|
+
highwatermarkPath: join10(listDir, ".highwatermark")
|
|
19051
19311
|
};
|
|
19052
19312
|
}
|
|
19053
19313
|
function getTaskListPaths(listId) {
|
|
@@ -19061,26 +19321,26 @@ function sortReadPaths(paths) {
|
|
|
19061
19321
|
return [...paths].sort((a, b) => priority[a.source] - priority[b.source]);
|
|
19062
19322
|
}
|
|
19063
19323
|
function resolveSourceForBaseDir(baseDir) {
|
|
19064
|
-
if (baseDir.includes(`${
|
|
19065
|
-
if (baseDir.includes(`${
|
|
19066
|
-
if (baseDir.includes(`${
|
|
19067
|
-
if (baseDir.includes(`${
|
|
19324
|
+
if (baseDir.includes(`${join10(".pyb", "tasks")}`)) return "pyb";
|
|
19325
|
+
if (baseDir.includes(`${join10(".claude", "tasks")}`)) return "claude";
|
|
19326
|
+
if (baseDir.includes(`${join10(".pyb")}`)) return "pyb";
|
|
19327
|
+
if (baseDir.includes(`${join10(".claude")}`)) return "claude";
|
|
19068
19328
|
return "other";
|
|
19069
19329
|
}
|
|
19070
19330
|
function getTaskListReadPaths(listId) {
|
|
19071
19331
|
const context = getTaskListContext({ listId });
|
|
19072
19332
|
const cwd = getCwd();
|
|
19073
|
-
const projectPyb =
|
|
19074
|
-
const projectClaude =
|
|
19333
|
+
const projectPyb = join10(cwd, ".pyb", "tasks");
|
|
19334
|
+
const projectClaude = join10(cwd, ".claude", "tasks");
|
|
19075
19335
|
if (context.scope === "project") {
|
|
19076
19336
|
const existing2 = [];
|
|
19077
|
-
if (existsSync11(
|
|
19337
|
+
if (existsSync11(join10(projectPyb, context.listId))) {
|
|
19078
19338
|
existing2.push({
|
|
19079
19339
|
...buildTaskListPaths(projectPyb, context.listId),
|
|
19080
19340
|
source: "pyb"
|
|
19081
19341
|
});
|
|
19082
19342
|
}
|
|
19083
|
-
if (existsSync11(
|
|
19343
|
+
if (existsSync11(join10(projectClaude, context.listId))) {
|
|
19084
19344
|
existing2.push({
|
|
19085
19345
|
...buildTaskListPaths(projectClaude, context.listId),
|
|
19086
19346
|
source: "claude"
|
|
@@ -19091,18 +19351,18 @@ function getTaskListReadPaths(listId) {
|
|
|
19091
19351
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19092
19352
|
const globalCandidates = override ? [
|
|
19093
19353
|
{
|
|
19094
|
-
baseDir:
|
|
19095
|
-
source: resolveSourceForBaseDir(
|
|
19354
|
+
baseDir: join10(override, "tasks"),
|
|
19355
|
+
source: resolveSourceForBaseDir(join10(override, "tasks"))
|
|
19096
19356
|
}
|
|
19097
19357
|
] : [
|
|
19098
|
-
{ baseDir:
|
|
19099
|
-
{ baseDir:
|
|
19358
|
+
{ baseDir: join10(homedir7(), ".pyb", "tasks"), source: "pyb" },
|
|
19359
|
+
{ baseDir: join10(homedir7(), ".claude", "tasks"), source: "claude" }
|
|
19100
19360
|
];
|
|
19101
19361
|
const candidates = [
|
|
19102
19362
|
...globalCandidates,
|
|
19103
19363
|
{ baseDir: resolveXdgDataPath("tasks"), source: "other" }
|
|
19104
19364
|
];
|
|
19105
|
-
const existing = candidates.filter((candidate) => existsSync11(
|
|
19365
|
+
const existing = candidates.filter((candidate) => existsSync11(join10(candidate.baseDir, context.listId))).map((candidate) => ({
|
|
19106
19366
|
...buildTaskListPaths(candidate.baseDir, context.listId),
|
|
19107
19367
|
source: candidate.source
|
|
19108
19368
|
}));
|
|
@@ -19289,7 +19549,7 @@ function persistBlocksForPaths(paths) {
|
|
|
19289
19549
|
const prevBlockedBy = normalizeIds(existing?.blockedBy);
|
|
19290
19550
|
const nextBlockedBy = normalizeIds(task.blockedBy);
|
|
19291
19551
|
const raw = readJson(
|
|
19292
|
-
|
|
19552
|
+
join10(paths.tasksDir, `${task.id}.json`)
|
|
19293
19553
|
);
|
|
19294
19554
|
const missingBlocks = !raw || !("blocks" in raw);
|
|
19295
19555
|
const missingBlockedBy = !raw || !("blockedBy" in raw);
|
|
@@ -19299,7 +19559,7 @@ function persistBlocksForPaths(paths) {
|
|
|
19299
19559
|
continue;
|
|
19300
19560
|
updated += 1;
|
|
19301
19561
|
fixedTaskIdSet.add(task.id);
|
|
19302
|
-
writeJsonAtomic(
|
|
19562
|
+
writeJsonAtomic(join10(paths.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19303
19563
|
}
|
|
19304
19564
|
return {
|
|
19305
19565
|
updated,
|
|
@@ -19337,8 +19597,8 @@ function applyLegacyBlocks(tasks) {
|
|
|
19337
19597
|
}
|
|
19338
19598
|
function readTasksFromDisk(paths) {
|
|
19339
19599
|
if (!existsSync11(paths.tasksDir)) return [];
|
|
19340
|
-
const files =
|
|
19341
|
-
return files.map((file) => readTaskFile(
|
|
19600
|
+
const files = readdirSync3(paths.tasksDir).filter((file) => file.endsWith(".json"));
|
|
19601
|
+
return files.map((file) => readTaskFile(join10(paths.tasksDir, file))).filter(Boolean);
|
|
19342
19602
|
}
|
|
19343
19603
|
function applyBlocksMap(tasks, map) {
|
|
19344
19604
|
return tasks.map((task) => ({
|
|
@@ -19353,7 +19613,7 @@ function buildTaskListForPaths(paths) {
|
|
|
19353
19613
|
var legacyFiles = ["index.json", "meta.json", "events.jsonl"];
|
|
19354
19614
|
function cleanupLegacyFiles(paths) {
|
|
19355
19615
|
for (const file of legacyFiles) {
|
|
19356
|
-
const path6 =
|
|
19616
|
+
const path6 = join10(paths.listDir, file);
|
|
19357
19617
|
if (existsSync11(path6)) {
|
|
19358
19618
|
rmSync(path6, { force: true });
|
|
19359
19619
|
}
|
|
@@ -19361,7 +19621,7 @@ function cleanupLegacyFiles(paths) {
|
|
|
19361
19621
|
}
|
|
19362
19622
|
function getMaxIdFromTasksDir(paths) {
|
|
19363
19623
|
if (!existsSync11(paths.tasksDir)) return 0;
|
|
19364
|
-
const files =
|
|
19624
|
+
const files = readdirSync3(paths.tasksDir).filter((file) => file.endsWith(".json"));
|
|
19365
19625
|
let maxId = 0;
|
|
19366
19626
|
for (const file of files) {
|
|
19367
19627
|
const numeric = Number(file.replace(/\.json$/, ""));
|
|
@@ -19613,7 +19873,7 @@ function createTask(input, options) {
|
|
|
19613
19873
|
blocks: [],
|
|
19614
19874
|
blockedBy: input.blockedBy ?? []
|
|
19615
19875
|
};
|
|
19616
|
-
writeJson(
|
|
19876
|
+
writeJson(join10(paths.tasksDir, `${id}.json`), serializeTaskRecord(record));
|
|
19617
19877
|
if ((record.blockedBy ?? []).length > 0) {
|
|
19618
19878
|
persistBlocksForPaths(paths);
|
|
19619
19879
|
}
|
|
@@ -19625,7 +19885,7 @@ function createTask(input, options) {
|
|
|
19625
19885
|
function getTask(id, options) {
|
|
19626
19886
|
const pathsList = getTaskListReadPaths(options?.listId);
|
|
19627
19887
|
for (const paths of pathsList) {
|
|
19628
|
-
const taskPath =
|
|
19888
|
+
const taskPath = join10(paths.tasksDir, `${id}.json`);
|
|
19629
19889
|
if (!existsSync11(taskPath)) continue;
|
|
19630
19890
|
const task = readTaskFile(taskPath);
|
|
19631
19891
|
if (task) return task;
|
|
@@ -19651,7 +19911,7 @@ function updateTask(id, updates, options) {
|
|
|
19651
19911
|
}
|
|
19652
19912
|
const pathsList = getTaskListReadPaths(options?.listId);
|
|
19653
19913
|
const target = pathsList.find(
|
|
19654
|
-
(paths) => existsSync11(
|
|
19914
|
+
(paths) => existsSync11(join10(paths.tasksDir, `${id}.json`))
|
|
19655
19915
|
);
|
|
19656
19916
|
if (!target) {
|
|
19657
19917
|
emitTaskBoundaryTelemetryEvent("TASK_UPDATE_NOT_FOUND_NO_SIDE_EFFECT", {
|
|
@@ -19701,18 +19961,18 @@ function updateTask(id, updates, options) {
|
|
|
19701
19961
|
}
|
|
19702
19962
|
for (const task of allAfter) {
|
|
19703
19963
|
if (forceWriteIds.has(task.id)) {
|
|
19704
|
-
writeJsonAtomic(
|
|
19964
|
+
writeJsonAtomic(join10(target.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19705
19965
|
continue;
|
|
19706
19966
|
}
|
|
19707
19967
|
const prev = beforeById.get(task.id);
|
|
19708
19968
|
if (!prev) {
|
|
19709
|
-
writeJsonAtomic(
|
|
19969
|
+
writeJsonAtomic(join10(target.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19710
19970
|
continue;
|
|
19711
19971
|
}
|
|
19712
19972
|
const prevSerialized = JSON.stringify(serializeTaskRecord(prev));
|
|
19713
19973
|
const nextSerialized = JSON.stringify(serializeTaskRecord(task));
|
|
19714
19974
|
if (prevSerialized === nextSerialized) continue;
|
|
19715
|
-
writeJsonAtomic(
|
|
19975
|
+
writeJsonAtomic(join10(target.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19716
19976
|
}
|
|
19717
19977
|
const depsChanged2 = normalizeIds(existing.blockedBy).join(",") !== normalizeIds(updated.blockedBy).join(",") || normalizeIds(existing.blocks).join(",") !== normalizeIds(updated.blocks).join(",");
|
|
19718
19978
|
if (depsChanged2 || Boolean(unlockResult)) {
|
|
@@ -21188,33 +21448,33 @@ async function getMainConversationContextLimit() {
|
|
|
21188
21448
|
return 2e5;
|
|
21189
21449
|
}
|
|
21190
21450
|
}
|
|
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
|
|
21451
|
+
var COMPRESSION_PROMPT2 = `Please provide a comprehensive summary of our conversation structured as follows:
|
|
21198
21452
|
|
|
21199
|
-
|
|
21453
|
+
## Technical Context
|
|
21454
|
+
Development environment, tools, frameworks, and configurations in use. Programming languages, libraries, and technical constraints. File structure, directory organization, and project architecture.
|
|
21200
21455
|
|
|
21201
|
-
##
|
|
21456
|
+
## Project Overview
|
|
21457
|
+
Main project goals, features, and scope. Key components, modules, and their relationships. Data models, APIs, and integration patterns.
|
|
21202
21458
|
|
|
21203
|
-
|
|
21204
|
-
|
|
21459
|
+
## Code Changes
|
|
21460
|
+
Files created, modified, or analyzed during our conversation. Specific code implementations, functions, and algorithms added. Configuration changes and structural modifications.
|
|
21205
21461
|
|
|
21206
|
-
##
|
|
21462
|
+
## Debugging & Issues
|
|
21463
|
+
Problems encountered and their root causes. Solutions implemented and their effectiveness. Error messages, logs, and diagnostic information.
|
|
21207
21464
|
|
|
21208
|
-
|
|
21465
|
+
## Current Status
|
|
21466
|
+
What we just completed successfully. Current state of the codebase and any ongoing work. Test results, validation steps, and verification performed.
|
|
21209
21467
|
|
|
21210
|
-
##
|
|
21468
|
+
## Pending Tasks
|
|
21469
|
+
Immediate next steps and priorities. Planned features, improvements, and refactoring. Known issues, technical debt, and areas needing attention.
|
|
21211
21470
|
|
|
21212
|
-
|
|
21471
|
+
## User Preferences
|
|
21472
|
+
Coding style, formatting, and organizational preferences. Communication patterns and feedback style. Tool choices and workflow preferences.
|
|
21213
21473
|
|
|
21214
|
-
##
|
|
21474
|
+
## Key Decisions
|
|
21475
|
+
Important technical decisions made and their rationale. Alternative approaches considered and why they were rejected. Trade-offs accepted and their implications.
|
|
21215
21476
|
|
|
21216
|
-
|
|
21217
|
-
---`;
|
|
21477
|
+
Focus on information essential for continuing the conversation effectively, including specific details about code, files, errors, and plans.`;
|
|
21218
21478
|
var AUTO_COMPACT_NOTICE = "Context automatically compressed due to token limit.";
|
|
21219
21479
|
var RECOVERED_FILE_MARKER2 = "**Recovered File:";
|
|
21220
21480
|
var CONVERSATION_SUMMARY_LIMITS = {
|
|
@@ -24340,10 +24600,33 @@ function createErrorToolResultBlock(args) {
|
|
|
24340
24600
|
}
|
|
24341
24601
|
|
|
24342
24602
|
// src/app/queryRuntime/toolExecution.ts
|
|
24343
|
-
|
|
24603
|
+
var DEFAULT_TOOL_TIMEOUT_MS = 45e3;
|
|
24604
|
+
function resolveToolTimeoutMs() {
|
|
24605
|
+
const raw = Number(process.env.PYB_TOOL_TIMEOUT_MS ?? DEFAULT_TOOL_TIMEOUT_MS);
|
|
24606
|
+
if (!Number.isFinite(raw) || raw <= 0) {
|
|
24607
|
+
return DEFAULT_TOOL_TIMEOUT_MS;
|
|
24608
|
+
}
|
|
24609
|
+
return raw;
|
|
24610
|
+
}
|
|
24611
|
+
async function consumeGeneratorWithTimeout(generator, timeoutMs, toolName) {
|
|
24344
24612
|
const results = [];
|
|
24345
|
-
|
|
24346
|
-
|
|
24613
|
+
while (true) {
|
|
24614
|
+
let timer;
|
|
24615
|
+
const nextPromise = generator.next();
|
|
24616
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
24617
|
+
timer = setTimeout(() => {
|
|
24618
|
+
reject(new Error(`TOOL_TIMEOUT:${toolName}:${timeoutMs}`));
|
|
24619
|
+
}, timeoutMs);
|
|
24620
|
+
});
|
|
24621
|
+
const nextResult = await Promise.race([nextPromise, timeoutPromise]).finally(() => {
|
|
24622
|
+
if (timer) {
|
|
24623
|
+
clearTimeout(timer);
|
|
24624
|
+
}
|
|
24625
|
+
});
|
|
24626
|
+
if (nextResult.done) {
|
|
24627
|
+
break;
|
|
24628
|
+
}
|
|
24629
|
+
results.push(nextResult.value);
|
|
24347
24630
|
}
|
|
24348
24631
|
return results;
|
|
24349
24632
|
}
|
|
@@ -24674,7 +24957,8 @@ async function* checkPermissionsAndCallTool(args) {
|
|
|
24674
24957
|
...args.context,
|
|
24675
24958
|
toolUseId: args.toolUseID
|
|
24676
24959
|
});
|
|
24677
|
-
const
|
|
24960
|
+
const timeoutMs = resolveToolTimeoutMs();
|
|
24961
|
+
const results = await consumeGeneratorWithTimeout(generator, timeoutMs, args.tool.name);
|
|
24678
24962
|
for (const result of results) {
|
|
24679
24963
|
switch (result.type) {
|
|
24680
24964
|
case "result": {
|
|
@@ -25970,7 +26254,6 @@ var QueryRunner = class {
|
|
|
25970
26254
|
return {
|
|
25971
26255
|
abortController: this.abortController,
|
|
25972
26256
|
onQueryLifecycleEvent: (event) => {
|
|
25973
|
-
this.config.onQueryLifecycleEvent?.(event);
|
|
25974
26257
|
},
|
|
25975
26258
|
sessionContext: new SessionContext(),
|
|
25976
26259
|
options: {
|
|
@@ -25980,7 +26263,6 @@ var QueryRunner = class {
|
|
|
25980
26263
|
tools: [],
|
|
25981
26264
|
verbose: false,
|
|
25982
26265
|
safeMode: false,
|
|
25983
|
-
permissionMode: "default",
|
|
25984
26266
|
maxThinkingTokens: 16e3
|
|
25985
26267
|
},
|
|
25986
26268
|
readFileTimestamps: {},
|
|
@@ -26211,18 +26493,18 @@ import { z as z11 } from "zod";
|
|
|
26211
26493
|
|
|
26212
26494
|
// src/utils/session/expertChatStorage.ts
|
|
26213
26495
|
import { existsSync as existsSync17, readFileSync as readFileSync9, writeFileSync as writeFileSync4, mkdirSync as mkdirSync10 } from "fs";
|
|
26214
|
-
import { join as
|
|
26496
|
+
import { join as join11 } from "path";
|
|
26215
26497
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
26216
26498
|
function getExpertChatDirectory() {
|
|
26217
26499
|
const override = process.env.ANYKODE_CONFIG_DIR?.trim();
|
|
26218
|
-
const expertChatDir = override ?
|
|
26500
|
+
const expertChatDir = override ? join11(override, "expert-chats") : resolveXdgDataPath("expert-chats");
|
|
26219
26501
|
if (!existsSync17(expertChatDir)) {
|
|
26220
26502
|
mkdirSync10(expertChatDir, { recursive: true });
|
|
26221
26503
|
}
|
|
26222
26504
|
return expertChatDir;
|
|
26223
26505
|
}
|
|
26224
26506
|
function getSessionFilePath(sessionId) {
|
|
26225
|
-
return
|
|
26507
|
+
return join11(getExpertChatDirectory(), `${sessionId}.json`);
|
|
26226
26508
|
}
|
|
26227
26509
|
function createExpertChatSession(expertModel) {
|
|
26228
26510
|
const sessionId = randomUUID4().slice(0, 5);
|
|
@@ -27163,7 +27445,7 @@ async function analyzeOutputWithLsp(output, exitCode) {
|
|
|
27163
27445
|
if (exitCode !== 0 || errorCount > 0 || warningCount > 0) {
|
|
27164
27446
|
try {
|
|
27165
27447
|
const { isAbsolute: isAbsolute11, resolve: resolve16 } = await import("path");
|
|
27166
|
-
const { getSessionRoot: getSessionRoot2 } = await import("./state-
|
|
27448
|
+
const { getSessionRoot: getSessionRoot2 } = await import("./state-34X5ECUL.js");
|
|
27167
27449
|
const lines = output.split("\n");
|
|
27168
27450
|
const uniqueFiles = /* @__PURE__ */ new Set();
|
|
27169
27451
|
const lspSuggestions = [];
|
|
@@ -27533,7 +27815,7 @@ var DeleteTool = {
|
|
|
27533
27815
|
}
|
|
27534
27816
|
if (!force) {
|
|
27535
27817
|
try {
|
|
27536
|
-
const { LspFacade: LspFacade2 } = await import("./lsp-
|
|
27818
|
+
const { LspFacade: LspFacade2 } = await import("./lsp-NRIYSZQ4.js");
|
|
27537
27819
|
const referenceDetail = await LspFacade2.checkFileReferences(fullPath);
|
|
27538
27820
|
if (referenceDetail) {
|
|
27539
27821
|
failedItems.push(
|
|
@@ -30922,9 +31204,9 @@ var TaskUpdateTool = {
|
|
|
30922
31204
|
};
|
|
30923
31205
|
|
|
30924
31206
|
// src/tools/memory/MemoryReadTool/MemoryReadTool.tsx
|
|
30925
|
-
import { existsSync as existsSync21, lstatSync, mkdirSync as mkdirSync11, readdirSync as
|
|
31207
|
+
import { existsSync as existsSync21, lstatSync, mkdirSync as mkdirSync11, readdirSync as readdirSync4, readFileSync as readFileSync12 } from "fs";
|
|
30926
31208
|
import { Box as Box45, Text as Text49 } from "ink";
|
|
30927
|
-
import { join as
|
|
31209
|
+
import { join as join12 } from "path";
|
|
30928
31210
|
import * as React57 from "react";
|
|
30929
31211
|
import { z as z26 } from "zod";
|
|
30930
31212
|
|
|
@@ -31037,8 +31319,8 @@ var MemoryReadTool = {
|
|
|
31037
31319
|
};
|
|
31038
31320
|
return;
|
|
31039
31321
|
}
|
|
31040
|
-
const files =
|
|
31041
|
-
const indexPath =
|
|
31322
|
+
const files = readdirSync4(agentMemoryDir, { recursive: true }).map((f) => join12(agentMemoryDir, f.toString())).filter((f) => !lstatSync(f).isDirectory()).map((f) => `- ${f}`).join("\n");
|
|
31323
|
+
const indexPath = join12(agentMemoryDir, "index.md");
|
|
31042
31324
|
const index = existsSync21(indexPath) ? readFileSync12(indexPath, "utf-8") : "";
|
|
31043
31325
|
const quotes = "'''";
|
|
31044
31326
|
const content = `Here are the contents of the agent memory file, \`${indexPath}\`:
|
|
@@ -31257,6 +31539,68 @@ var getReadOnlyTools = memoize4(async () => {
|
|
|
31257
31539
|
return tools.filter((_, index) => isEnabled5[index]);
|
|
31258
31540
|
});
|
|
31259
31541
|
|
|
31542
|
+
// src/server/routes/tool.ts
|
|
31543
|
+
function createToolRoutes() {
|
|
31544
|
+
const router = new Hono2();
|
|
31545
|
+
router.get("/", async (c) => {
|
|
31546
|
+
const tools = await getTools();
|
|
31547
|
+
return c.json({
|
|
31548
|
+
success: true,
|
|
31549
|
+
data: tools.map((tool) => ({
|
|
31550
|
+
name: tool.name,
|
|
31551
|
+
description: tool.description,
|
|
31552
|
+
inputSchema: tool.inputSchema,
|
|
31553
|
+
category: tool.category ?? "system",
|
|
31554
|
+
requiresPermission: tool.requiresConfirmation ?? false,
|
|
31555
|
+
dangerousLevel: tool.dangerousLevel ?? "safe"
|
|
31556
|
+
}))
|
|
31557
|
+
});
|
|
31558
|
+
});
|
|
31559
|
+
router.post("/:toolName/execute", async (c) => {
|
|
31560
|
+
const toolName = c.req.param("toolName");
|
|
31561
|
+
const body = await c.req.json();
|
|
31562
|
+
const { input, options } = body;
|
|
31563
|
+
const tools = await getTools();
|
|
31564
|
+
const tool = tools.find((item) => item.name === toolName);
|
|
31565
|
+
if (!tool) {
|
|
31566
|
+
return c.json({
|
|
31567
|
+
success: false,
|
|
31568
|
+
error: { code: "TOOL_NOT_FOUND", message: `Tool '${toolName}' not found` }
|
|
31569
|
+
}, 404);
|
|
31570
|
+
}
|
|
31571
|
+
const startTime = Date.now();
|
|
31572
|
+
try {
|
|
31573
|
+
const result = await tool.call(input, {
|
|
31574
|
+
skipPermission: options?.skipPermission
|
|
31575
|
+
});
|
|
31576
|
+
return c.json({
|
|
31577
|
+
success: true,
|
|
31578
|
+
data: {
|
|
31579
|
+
success: true,
|
|
31580
|
+
result: result.resultForAssistant,
|
|
31581
|
+
duration: Date.now() - startTime
|
|
31582
|
+
}
|
|
31583
|
+
});
|
|
31584
|
+
} catch (error) {
|
|
31585
|
+
return c.json({
|
|
31586
|
+
success: true,
|
|
31587
|
+
data: {
|
|
31588
|
+
success: false,
|
|
31589
|
+
error: {
|
|
31590
|
+
code: "TOOL_EXECUTION_ERROR",
|
|
31591
|
+
message: error instanceof Error ? error.message : String(error)
|
|
31592
|
+
},
|
|
31593
|
+
duration: Date.now() - startTime
|
|
31594
|
+
}
|
|
31595
|
+
});
|
|
31596
|
+
}
|
|
31597
|
+
});
|
|
31598
|
+
return router;
|
|
31599
|
+
}
|
|
31600
|
+
|
|
31601
|
+
// src/server/routes/permission.ts
|
|
31602
|
+
import { Hono as Hono3 } from "hono";
|
|
31603
|
+
|
|
31260
31604
|
// src/server/permission/manager.ts
|
|
31261
31605
|
import { v4 as uuidv42 } from "uuid";
|
|
31262
31606
|
var PermissionManager = class {
|
|
@@ -31335,174 +31679,7 @@ var PermissionManager = class {
|
|
|
31335
31679
|
};
|
|
31336
31680
|
var permissionManager = new PermissionManager();
|
|
31337
31681
|
|
|
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
31682
|
// src/server/routes/permission.ts
|
|
31505
|
-
import { Hono as Hono3 } from "hono";
|
|
31506
31683
|
function createPermissionRoutes() {
|
|
31507
31684
|
const router = new Hono3();
|
|
31508
31685
|
router.post("/:permissionId/respond", async (c) => {
|
|
@@ -31588,6 +31765,7 @@ function createConfigRoutes() {
|
|
|
31588
31765
|
// src/server/routes/mcp.ts
|
|
31589
31766
|
import { Hono as Hono5 } from "hono";
|
|
31590
31767
|
var knownServers = /* @__PURE__ */ new Set();
|
|
31768
|
+
var connectedServers = /* @__PURE__ */ new Set();
|
|
31591
31769
|
function createMCPRoutes() {
|
|
31592
31770
|
const router = new Hono5();
|
|
31593
31771
|
router.get("/servers", async (c) => {
|
|
@@ -31595,12 +31773,15 @@ function createMCPRoutes() {
|
|
|
31595
31773
|
for (const serverName of Object.keys(servers ?? {})) {
|
|
31596
31774
|
knownServers.add(serverName);
|
|
31597
31775
|
}
|
|
31776
|
+
for (const serverName of connectedServers) {
|
|
31777
|
+
knownServers.add(serverName);
|
|
31778
|
+
}
|
|
31598
31779
|
const serverNames = Array.from(knownServers);
|
|
31599
31780
|
return c.json({
|
|
31600
31781
|
success: true,
|
|
31601
31782
|
data: serverNames.map((name3) => ({
|
|
31602
31783
|
name: name3,
|
|
31603
|
-
status: getMcprcServerStatus(name3),
|
|
31784
|
+
status: connectedServers.has(name3) ? "connected" : getMcprcServerStatus(name3),
|
|
31604
31785
|
tools: [],
|
|
31605
31786
|
resources: [],
|
|
31606
31787
|
error: void 0
|
|
@@ -31610,26 +31791,23 @@ function createMCPRoutes() {
|
|
|
31610
31791
|
router.post("/servers/:serverName/connect", async (c) => {
|
|
31611
31792
|
const serverName = c.req.param("serverName");
|
|
31612
31793
|
knownServers.add(serverName);
|
|
31794
|
+
connectedServers.add(serverName);
|
|
31613
31795
|
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);
|
|
31796
|
+
success: true,
|
|
31797
|
+
data: { connected: true, serverName, tools: [] }
|
|
31798
|
+
});
|
|
31621
31799
|
});
|
|
31622
31800
|
router.post("/servers/:serverName/disconnect", async (c) => {
|
|
31623
31801
|
const serverName = c.req.param("serverName");
|
|
31624
31802
|
knownServers.add(serverName);
|
|
31803
|
+
connectedServers.delete(serverName);
|
|
31625
31804
|
return c.json({
|
|
31626
|
-
success:
|
|
31627
|
-
|
|
31628
|
-
|
|
31629
|
-
|
|
31630
|
-
}
|
|
31631
|
-
|
|
31632
|
-
}, 501);
|
|
31805
|
+
success: true,
|
|
31806
|
+
data: {
|
|
31807
|
+
disconnected: true,
|
|
31808
|
+
serverName
|
|
31809
|
+
}
|
|
31810
|
+
});
|
|
31633
31811
|
});
|
|
31634
31812
|
return router;
|
|
31635
31813
|
}
|
|
@@ -31727,8 +31905,6 @@ function createServer2(options = {}) {
|
|
|
31727
31905
|
async function startServer(options = {}) {
|
|
31728
31906
|
const port = options.port ?? 4096;
|
|
31729
31907
|
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
31908
|
const app = createServer2(options);
|
|
31733
31909
|
if (typeof Bun === "undefined" || typeof Bun.serve !== "function") {
|
|
31734
31910
|
throw new Error("Bun runtime is required to start the web server");
|
|
@@ -31736,8 +31912,7 @@ async function startServer(options = {}) {
|
|
|
31736
31912
|
const server = Bun.serve({
|
|
31737
31913
|
fetch: app.fetch,
|
|
31738
31914
|
hostname: host,
|
|
31739
|
-
port
|
|
31740
|
-
idleTimeout
|
|
31915
|
+
port
|
|
31741
31916
|
});
|
|
31742
31917
|
console.log(`PYB-CLI Web Server starting on http://${host}:${port}`);
|
|
31743
31918
|
return {
|
|
@@ -35716,8 +35891,8 @@ function getCompletionContext(args) {
|
|
|
35716
35891
|
}
|
|
35717
35892
|
|
|
35718
35893
|
// src/utils/completion/fileSuggestions.ts
|
|
35719
|
-
import { existsSync as existsSync26, readdirSync as
|
|
35720
|
-
import { basename as basename4, dirname as dirname14, join as
|
|
35894
|
+
import { existsSync as existsSync26, readdirSync as readdirSync5, statSync as statSync15 } from "fs";
|
|
35895
|
+
import { basename as basename4, dirname as dirname14, join as join13, resolve as resolve13 } from "path";
|
|
35721
35896
|
function generateFileSuggestions(args) {
|
|
35722
35897
|
const { prefix, cwd } = args;
|
|
35723
35898
|
try {
|
|
@@ -35745,14 +35920,14 @@ function generateFileSuggestions(args) {
|
|
|
35745
35920
|
}
|
|
35746
35921
|
if (!existsSync26(searchDir)) return [];
|
|
35747
35922
|
const showHidden = nameFilter.startsWith(".") || userPath.includes("/.");
|
|
35748
|
-
const entries =
|
|
35923
|
+
const entries = readdirSync5(searchDir).filter((entry) => {
|
|
35749
35924
|
if (!showHidden && entry.startsWith(".")) return false;
|
|
35750
35925
|
if (nameFilter && !entry.toLowerCase().startsWith(nameFilter.toLowerCase()))
|
|
35751
35926
|
return false;
|
|
35752
35927
|
return true;
|
|
35753
35928
|
}).sort((a, b) => {
|
|
35754
|
-
const aPath =
|
|
35755
|
-
const bPath =
|
|
35929
|
+
const aPath = join13(searchDir, a);
|
|
35930
|
+
const bPath = join13(searchDir, b);
|
|
35756
35931
|
const aIsDir = statSync15(aPath).isDirectory();
|
|
35757
35932
|
const bIsDir = statSync15(bPath).isDirectory();
|
|
35758
35933
|
if (aIsDir && !bIsDir) return -1;
|
|
@@ -35760,7 +35935,7 @@ function generateFileSuggestions(args) {
|
|
|
35760
35935
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
35761
35936
|
}).slice(0, 25);
|
|
35762
35937
|
return entries.map((entry) => {
|
|
35763
|
-
const entryPath =
|
|
35938
|
+
const entryPath = join13(searchDir, entry);
|
|
35764
35939
|
const isDir = statSync15(entryPath).isDirectory();
|
|
35765
35940
|
const icon = isDir ? "\u{1F4C1}" : "\u{1F4C4}";
|
|
35766
35941
|
let value;
|
|
@@ -37094,15 +37269,15 @@ function useUnifiedCompletion({
|
|
|
37094
37269
|
if (systemCommands.length > 0 || isLoadingCommands) return;
|
|
37095
37270
|
setIsLoadingCommands(true);
|
|
37096
37271
|
try {
|
|
37097
|
-
const { readdirSync:
|
|
37272
|
+
const { readdirSync: readdirSync6, statSync: statSync17 } = await import("fs");
|
|
37098
37273
|
const pathDirs = (process.env.PATH || "").split(":").filter(Boolean);
|
|
37099
37274
|
const commandSet = /* @__PURE__ */ new Set();
|
|
37100
37275
|
const essentialCommands = getEssentialCommands();
|
|
37101
37276
|
essentialCommands.forEach((cmd) => commandSet.add(cmd));
|
|
37102
37277
|
for (const dir of pathDirs) {
|
|
37103
37278
|
try {
|
|
37104
|
-
if (
|
|
37105
|
-
const entries =
|
|
37279
|
+
if (readdirSync6 && statSync17) {
|
|
37280
|
+
const entries = readdirSync6(dir);
|
|
37106
37281
|
for (const entry of entries) {
|
|
37107
37282
|
try {
|
|
37108
37283
|
const fullPath = `${dir}/${entry}`;
|
|
@@ -37667,7 +37842,7 @@ function TokenWarning({
|
|
|
37667
37842
|
import { spawn, spawnSync } from "child_process";
|
|
37668
37843
|
import { mkdtempSync, readFileSync as readFileSync17, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
37669
37844
|
import { tmpdir } from "os";
|
|
37670
|
-
import { join as
|
|
37845
|
+
import { join as join14 } from "path";
|
|
37671
37846
|
var isWindows = process.platform === "win32";
|
|
37672
37847
|
function isCommandAvailable(command4) {
|
|
37673
37848
|
const checker = isWindows ? "where" : "which";
|
|
@@ -37743,8 +37918,8 @@ async function launchExternalEditor(initialText) {
|
|
|
37743
37918
|
)
|
|
37744
37919
|
};
|
|
37745
37920
|
}
|
|
37746
|
-
const dir = mkdtempSync(
|
|
37747
|
-
const filePath =
|
|
37921
|
+
const dir = mkdtempSync(join14(tmpdir(), "pyb-edit-"));
|
|
37922
|
+
const filePath = join14(dir, "message.txt");
|
|
37748
37923
|
writeFileSync6(filePath, initialText, "utf-8");
|
|
37749
37924
|
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
37750
37925
|
if (process.stdin.isTTY) {
|
|
@@ -37801,13 +37976,13 @@ async function launchExternalEditor(initialText) {
|
|
|
37801
37976
|
}
|
|
37802
37977
|
|
|
37803
37978
|
// src/utils/commands/hashCommand.ts
|
|
37804
|
-
import { join as
|
|
37979
|
+
import { join as join15 } from "path";
|
|
37805
37980
|
import { readFileSync as readFileSync18, writeFileSync as writeFileSync7 } from "fs";
|
|
37806
37981
|
function handleHashCommand(interpreted) {
|
|
37807
37982
|
try {
|
|
37808
37983
|
const cwd = process.cwd();
|
|
37809
|
-
const agentsPath =
|
|
37810
|
-
const legacyPath =
|
|
37984
|
+
const agentsPath = join15(cwd, "AGENTS.md");
|
|
37985
|
+
const legacyPath = join15(cwd, "CLAUDE.md");
|
|
37811
37986
|
const filesToUpdate = [];
|
|
37812
37987
|
filesToUpdate.push({ path: agentsPath, name: "AGENTS.md" });
|
|
37813
37988
|
try {
|
|
@@ -37955,7 +38130,7 @@ function logStartupProfile(event) {
|
|
|
37955
38130
|
import { useEffect as useEffect21, useRef as useRef10, useState as useState25 } from "react";
|
|
37956
38131
|
|
|
37957
38132
|
// src/services/ui/statusline.ts
|
|
37958
|
-
import { join as
|
|
38133
|
+
import { join as join16 } from "path";
|
|
37959
38134
|
function normalizeString(value) {
|
|
37960
38135
|
if (typeof value !== "string") return null;
|
|
37961
38136
|
const trimmed = value.trim();
|
|
@@ -37974,7 +38149,7 @@ function getStatusLineCommand(options) {
|
|
|
37974
38149
|
const configDir = normalizeString(options?.configDir);
|
|
37975
38150
|
if (configDir) {
|
|
37976
38151
|
const settings2 = readSettingsFile(
|
|
37977
|
-
|
|
38152
|
+
join16(configDir, "settings.json")
|
|
37978
38153
|
);
|
|
37979
38154
|
const command4 = getCommandFromSettings(settings2 ?? {});
|
|
37980
38155
|
if (command4) return command4;
|
|
@@ -38042,7 +38217,7 @@ function useStatusLine() {
|
|
|
38042
38217
|
// src/ui/components/PromptInput.tsx
|
|
38043
38218
|
async function interpretHashCommand(input) {
|
|
38044
38219
|
try {
|
|
38045
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
38220
|
+
const { queryQuick: queryQuick2 } = await import("./llm-S4UIKFEI.js");
|
|
38046
38221
|
const systemPrompt = [
|
|
38047
38222
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
38048
38223
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -38355,7 +38530,7 @@ function PromptInput({
|
|
|
38355
38530
|
if (messages2.length) {
|
|
38356
38531
|
if (mode === "bash") {
|
|
38357
38532
|
onQuery(messages2, newAbortController).then(async () => {
|
|
38358
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
38533
|
+
const { getCwd: getCwd2 } = await import("./state-34X5ECUL.js");
|
|
38359
38534
|
setCurrentPwd(getCwd2());
|
|
38360
38535
|
});
|
|
38361
38536
|
} else {
|
|
@@ -39134,12 +39309,12 @@ function createConversationTrackerPersistenceTelemetryEmitter(entrypoint) {
|
|
|
39134
39309
|
}
|
|
39135
39310
|
|
|
39136
39311
|
// src/ui/screens/REPL.tsx
|
|
39137
|
-
import { join as
|
|
39312
|
+
import { join as join17 } from "path";
|
|
39138
39313
|
function getProjectDirSlug(cwd) {
|
|
39139
39314
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
39140
39315
|
}
|
|
39141
39316
|
function getConversationTrackerPersistenceDir(cwd) {
|
|
39142
|
-
return resolveXdgDataPath(
|
|
39317
|
+
return resolveXdgDataPath(join17(getProjectDirSlug(cwd), "conversation-trackers"));
|
|
39143
39318
|
}
|
|
39144
39319
|
function REPL({
|
|
39145
39320
|
commands,
|
|
@@ -39919,7 +40094,7 @@ import React111, { useCallback as useCallback17, useEffect as useEffect26, useMe
|
|
|
39919
40094
|
import { Box as Box84, Text as Text88, useInput as useInput28 } from "ink";
|
|
39920
40095
|
import figures9 from "figures";
|
|
39921
40096
|
import chalk15 from "chalk";
|
|
39922
|
-
import { join as
|
|
40097
|
+
import { join as join19 } from "path";
|
|
39923
40098
|
import { spawn as spawn2 } from "child_process";
|
|
39924
40099
|
|
|
39925
40100
|
// src/commands/agents/tooling.ts
|
|
@@ -39979,13 +40154,13 @@ import {
|
|
|
39979
40154
|
unlinkSync as unlinkSync2,
|
|
39980
40155
|
writeFileSync as writeFileSync8
|
|
39981
40156
|
} from "fs";
|
|
39982
|
-
import { join as
|
|
40157
|
+
import { join as join18 } from "path";
|
|
39983
40158
|
import { homedir as homedir8 } from "os";
|
|
39984
40159
|
|
|
39985
40160
|
// src/commands/agents/generation.ts
|
|
39986
40161
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
39987
40162
|
async function generateAgentWithClaude(prompt) {
|
|
39988
|
-
const { queryModel } = await import("./llm-
|
|
40163
|
+
const { queryModel } = await import("./llm-S4UIKFEI.js");
|
|
39989
40164
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
39990
40165
|
|
|
39991
40166
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -40169,21 +40344,21 @@ var LEGACY_FOLDER = ".claude";
|
|
|
40169
40344
|
var AGENTS_DIR = "agents";
|
|
40170
40345
|
function getAgentDirectory(location) {
|
|
40171
40346
|
if (location === "user") {
|
|
40172
|
-
return
|
|
40347
|
+
return join18(homedir8(), PRIMARY_FOLDER, AGENTS_DIR);
|
|
40173
40348
|
}
|
|
40174
|
-
return
|
|
40349
|
+
return join18(getCwd(), PRIMARY_FOLDER, AGENTS_DIR);
|
|
40175
40350
|
}
|
|
40176
40351
|
function getLegacyAgentDirectory(location) {
|
|
40177
40352
|
if (location === "user") {
|
|
40178
|
-
return
|
|
40353
|
+
return join18(homedir8(), LEGACY_FOLDER, AGENTS_DIR);
|
|
40179
40354
|
}
|
|
40180
|
-
return
|
|
40355
|
+
return join18(getCwd(), LEGACY_FOLDER, AGENTS_DIR);
|
|
40181
40356
|
}
|
|
40182
40357
|
function getPrimaryAgentFilePath(location, agentType) {
|
|
40183
|
-
return
|
|
40358
|
+
return join18(getAgentDirectory(location), `${agentType}.md`);
|
|
40184
40359
|
}
|
|
40185
40360
|
function getLegacyAgentFilePath(location, agentType) {
|
|
40186
|
-
return
|
|
40361
|
+
return join18(getLegacyAgentDirectory(location), `${agentType}.md`);
|
|
40187
40362
|
}
|
|
40188
40363
|
function ensureDirectoryExists(location) {
|
|
40189
40364
|
const dir = getAgentDirectory(location);
|
|
@@ -41281,8 +41456,8 @@ function ViewAgent(props) {
|
|
|
41281
41456
|
if (props.agent.source === "plugin") return `Plugin: ${props.agent.baseDir ?? "Unknown"}`;
|
|
41282
41457
|
const baseDir = props.agent.baseDir;
|
|
41283
41458
|
const file = `${props.agent.filename ?? props.agent.agentType}.md`;
|
|
41284
|
-
if (props.agent.source === "projectSettings") return
|
|
41285
|
-
if (baseDir) return
|
|
41459
|
+
if (props.agent.source === "projectSettings") return join19(".claude", "agents", file);
|
|
41460
|
+
if (baseDir) return join19(baseDir, file);
|
|
41286
41461
|
return props.agent.source;
|
|
41287
41462
|
})();
|
|
41288
41463
|
const toolsSummary = () => {
|
|
@@ -42901,7 +43076,7 @@ var BashTool = {
|
|
|
42901
43076
|
result: false,
|
|
42902
43077
|
message: `Security Policy: Do not use 'ls' for simple file listing.
|
|
42903
43078
|
- To find files: Use the 'Glob' tool.
|
|
42904
|
-
- To
|
|
43079
|
+
- To inspect one-level directory structure: Use Read on the directory path (offset>=1, optional limit).
|
|
42905
43080
|
- To check permissions/metadata: Use 'ls -l' (allowed).`
|
|
42906
43081
|
};
|
|
42907
43082
|
}
|
|
@@ -43610,7 +43785,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
|
|
|
43610
43785
|
- Example: \`GlobTool(pattern: "tests", semantic: true)\` will find test files based on project structure.
|
|
43611
43786
|
2. **Exact Identifier**: WHEN you know the precise class/function name (e.g., "UserProfile", "initDatabase"), use standard Grep/Glob without \`semantic\` flag.
|
|
43612
43787
|
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
|
|
43788
|
+
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
43789
|
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
43790
|
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
43791
|
|