pybao-cli 1.3.49 → 1.3.51
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-HGBE27IN.js +42 -0
- package/dist/{acp-6OUQ7H6U.js → acp-LAPVZQA3.js} +26 -26
- package/dist/{agentsValidate-J2PNDNBM.js → agentsValidate-JMWMX3MB.js} +7 -7
- package/dist/{ask-3BZLIIBS.js → ask-BD4FCNES.js} +25 -25
- package/dist/{autoUpdater-QBVI6CTI.js → autoUpdater-CJG22SEW.js} +3 -3
- package/dist/{chunk-ENRBBQDN.js → chunk-3EQQLZE4.js} +4 -4
- package/dist/{chunk-WZPKTYHT.js → chunk-4N2642UT.js} +1 -1
- package/dist/{chunk-W3BXW7II.js → chunk-6TN4XT74.js} +1 -1
- package/dist/{chunk-NN37RDXI.js → chunk-7N2XMOVQ.js} +328 -182
- package/dist/chunk-7N2XMOVQ.js.map +7 -0
- package/dist/{chunk-MYIG6T5F.js → chunk-ABPSBUQC.js} +2 -2
- package/dist/{chunk-RW4L32HN.js → chunk-B62QNVFY.js} +1 -1
- package/dist/{chunk-OKLVL6BJ.js → chunk-BSAIDJEJ.js} +2 -2
- package/dist/{chunk-INNHNGP3.js → chunk-C6HYECKQ.js} +3 -3
- package/dist/{chunk-ZYC4DB3G.js → chunk-E567RAA6.js} +3 -3
- package/dist/{chunk-ZFULAWUS.js → chunk-EGFQHPCU.js} +2 -2
- package/dist/{chunk-VKA3GRQ7.js → chunk-ESZZYVDK.js} +1 -1
- package/dist/{chunk-DQ3QQRPV.js → chunk-F5KZKSH3.js} +2 -2
- package/dist/{chunk-G3QWUH66.js → chunk-HITHFTHB.js} +3 -3
- package/dist/{chunk-RWLCKRAI.js → chunk-IS5VAOE5.js} +168 -83
- package/dist/chunk-IS5VAOE5.js.map +7 -0
- package/dist/{chunk-J6YTGLVB.js → chunk-JI5OFKTQ.js} +2 -2
- package/dist/{chunk-KDCZKRCN.js → chunk-KR37EQX6.js} +1 -1
- package/dist/{chunk-QI6HL74P.js → chunk-LT223NHT.js} +3 -3
- package/dist/{chunk-VXKMO6OQ.js → chunk-LYWVXCUX.js} +1 -1
- package/dist/{chunk-2AMK6VUE.js → chunk-P2DSZFRF.js} +1 -1
- package/dist/{chunk-QM7M2ER7.js → chunk-PE3FS7DD.js} +1 -1
- package/dist/{chunk-XUTLA6YR.js → chunk-QJRO335D.js} +3 -3
- package/dist/{chunk-B3P6TUJQ.js → chunk-REG5ADDD.js} +1 -1
- package/dist/{chunk-JMAZ43RF.js → chunk-THFK234H.js} +2 -2
- package/dist/{chunk-HTWMNXVH.js → chunk-ULDHZLLE.js} +3 -3
- package/dist/{chunk-CKSCNSGO.js → chunk-YYADUX77.js} +3 -3
- package/dist/{chunk-U5YVY2ZJ.js → chunk-ZNCD73BJ.js} +1 -1
- package/dist/{chunk-U5YVY2ZJ.js.map → chunk-ZNCD73BJ.js.map} +1 -1
- package/dist/{chunk-JS6WJUEJ.js → chunk-ZPTSUA2S.js} +4 -4
- package/dist/{cli-XVMAAFAL.js → cli-5BCAP7VK.js} +77 -77
- package/dist/commands-QLOCAID7.js +46 -0
- package/dist/{config-MPTOPKTC.js → config-OQDKF3CD.js} +4 -4
- package/dist/{context-AS5YCQ7Q.js → context-NF4FJFEK.js} +5 -5
- package/dist/{customCommands-MWT24UO2.js → customCommands-IXFRKO3B.js} +4 -4
- package/dist/{env-BD4TLPUJ.js → env-KXW5FQKK.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/{llm-TYCMK2E6.js → llm-NMG2UUYR.js} +26 -26
- package/dist/{llmLazy-BYDLIART.js → llmLazy-6PUMN62X.js} +1 -1
- package/dist/{loader-5TWPQP3K.js → loader-IOYXULJR.js} +4 -4
- package/dist/{mcp-XDNI7GJV.js → mcp-ZWZ5JUI4.js} +7 -7
- package/dist/{mentionProcessor-V4567WI5.js → mentionProcessor-BLHGSBTI.js} +5 -5
- package/dist/{messages-K7ABTOPV.js → messages-GRLE5KCQ.js} +1 -1
- package/dist/{model-ATBQ44KG.js → model-CLIHMLR3.js} +5 -5
- package/dist/{openai-ED25JRUI.js → openai-OUUKOJWE.js} +5 -5
- package/dist/{outputStyles-P5GC3SJX.js → outputStyles-QCM5QWSS.js} +4 -4
- package/dist/{pluginRuntime-ZQL56D63.js → pluginRuntime-3KLZVRRO.js} +6 -6
- package/dist/{pluginValidation-66AAHNBG.js → pluginValidation-LS2AWCCU.js} +6 -6
- package/dist/prompts-SA4OK6QD.js +48 -0
- package/dist/{pybAgentSessionLoad-GD3Z6LAG.js → pybAgentSessionLoad-ZONVZBLE.js} +4 -4
- package/dist/{pybAgentSessionResume-IKOTCDZW.js → pybAgentSessionResume-CC2LCPTW.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-IUMN533Q.js → pybAgentStreamJsonSession-ZNLPABQT.js} +1 -1
- package/dist/{pybHooks-ECZOIQMS.js → pybHooks-F3E2A22A.js} +4 -4
- package/dist/query-CYYPDG2D.js +50 -0
- package/dist/{ripgrep-BLLSBEDA.js → ripgrep-K24UEEMP.js} +3 -3
- package/dist/{skillMarketplace-XXFHN2HH.js → skillMarketplace-OU2GDZVW.js} +3 -3
- package/dist/{state-OWOACNRS.js → state-IZDGO44E.js} +2 -2
- package/dist/{theme-Y46LR7UJ.js → theme-MHQCQKW6.js} +5 -5
- package/dist/{toolPermissionSettings-HHGJYLGQ.js → toolPermissionSettings-HRONQYRZ.js} +6 -6
- package/dist/tools-XXBWIEJ5.js +47 -0
- package/dist/{userInput-FKO2RVA5.js → userInput-EGXVNNBE.js} +27 -27
- package/package.json +1 -1
- package/dist/REPL-OGPFEZQZ.js +0 -42
- package/dist/chunk-NN37RDXI.js.map +0 -7
- package/dist/chunk-RWLCKRAI.js.map +0 -7
- package/dist/commands-XQBJLM5C.js +0 -46
- package/dist/prompts-KDX7FM3E.js +0 -48
- package/dist/query-QCVQ7T76.js +0 -50
- package/dist/tools-6FBXOCLI.js +0 -47
- /package/dist/{REPL-OGPFEZQZ.js.map → REPL-HGBE27IN.js.map} +0 -0
- /package/dist/{acp-6OUQ7H6U.js.map → acp-LAPVZQA3.js.map} +0 -0
- /package/dist/{agentsValidate-J2PNDNBM.js.map → agentsValidate-JMWMX3MB.js.map} +0 -0
- /package/dist/{ask-3BZLIIBS.js.map → ask-BD4FCNES.js.map} +0 -0
- /package/dist/{autoUpdater-QBVI6CTI.js.map → autoUpdater-CJG22SEW.js.map} +0 -0
- /package/dist/{chunk-ENRBBQDN.js.map → chunk-3EQQLZE4.js.map} +0 -0
- /package/dist/{chunk-WZPKTYHT.js.map → chunk-4N2642UT.js.map} +0 -0
- /package/dist/{chunk-W3BXW7II.js.map → chunk-6TN4XT74.js.map} +0 -0
- /package/dist/{chunk-MYIG6T5F.js.map → chunk-ABPSBUQC.js.map} +0 -0
- /package/dist/{chunk-RW4L32HN.js.map → chunk-B62QNVFY.js.map} +0 -0
- /package/dist/{chunk-OKLVL6BJ.js.map → chunk-BSAIDJEJ.js.map} +0 -0
- /package/dist/{chunk-INNHNGP3.js.map → chunk-C6HYECKQ.js.map} +0 -0
- /package/dist/{chunk-ZYC4DB3G.js.map → chunk-E567RAA6.js.map} +0 -0
- /package/dist/{chunk-ZFULAWUS.js.map → chunk-EGFQHPCU.js.map} +0 -0
- /package/dist/{chunk-VKA3GRQ7.js.map → chunk-ESZZYVDK.js.map} +0 -0
- /package/dist/{chunk-DQ3QQRPV.js.map → chunk-F5KZKSH3.js.map} +0 -0
- /package/dist/{chunk-G3QWUH66.js.map → chunk-HITHFTHB.js.map} +0 -0
- /package/dist/{chunk-J6YTGLVB.js.map → chunk-JI5OFKTQ.js.map} +0 -0
- /package/dist/{chunk-KDCZKRCN.js.map → chunk-KR37EQX6.js.map} +0 -0
- /package/dist/{chunk-QI6HL74P.js.map → chunk-LT223NHT.js.map} +0 -0
- /package/dist/{chunk-VXKMO6OQ.js.map → chunk-LYWVXCUX.js.map} +0 -0
- /package/dist/{chunk-2AMK6VUE.js.map → chunk-P2DSZFRF.js.map} +0 -0
- /package/dist/{chunk-QM7M2ER7.js.map → chunk-PE3FS7DD.js.map} +0 -0
- /package/dist/{chunk-XUTLA6YR.js.map → chunk-QJRO335D.js.map} +0 -0
- /package/dist/{chunk-B3P6TUJQ.js.map → chunk-REG5ADDD.js.map} +0 -0
- /package/dist/{chunk-JMAZ43RF.js.map → chunk-THFK234H.js.map} +0 -0
- /package/dist/{chunk-HTWMNXVH.js.map → chunk-ULDHZLLE.js.map} +0 -0
- /package/dist/{chunk-CKSCNSGO.js.map → chunk-YYADUX77.js.map} +0 -0
- /package/dist/{chunk-JS6WJUEJ.js.map → chunk-ZPTSUA2S.js.map} +0 -0
- /package/dist/{cli-XVMAAFAL.js.map → cli-5BCAP7VK.js.map} +0 -0
- /package/dist/{commands-XQBJLM5C.js.map → commands-QLOCAID7.js.map} +0 -0
- /package/dist/{config-MPTOPKTC.js.map → config-OQDKF3CD.js.map} +0 -0
- /package/dist/{context-AS5YCQ7Q.js.map → context-NF4FJFEK.js.map} +0 -0
- /package/dist/{customCommands-MWT24UO2.js.map → customCommands-IXFRKO3B.js.map} +0 -0
- /package/dist/{env-BD4TLPUJ.js.map → env-KXW5FQKK.js.map} +0 -0
- /package/dist/{llm-TYCMK2E6.js.map → llm-NMG2UUYR.js.map} +0 -0
- /package/dist/{llmLazy-BYDLIART.js.map → llmLazy-6PUMN62X.js.map} +0 -0
- /package/dist/{loader-5TWPQP3K.js.map → loader-IOYXULJR.js.map} +0 -0
- /package/dist/{mcp-XDNI7GJV.js.map → mcp-ZWZ5JUI4.js.map} +0 -0
- /package/dist/{mentionProcessor-V4567WI5.js.map → mentionProcessor-BLHGSBTI.js.map} +0 -0
- /package/dist/{messages-K7ABTOPV.js.map → messages-GRLE5KCQ.js.map} +0 -0
- /package/dist/{model-ATBQ44KG.js.map → model-CLIHMLR3.js.map} +0 -0
- /package/dist/{openai-ED25JRUI.js.map → openai-OUUKOJWE.js.map} +0 -0
- /package/dist/{outputStyles-P5GC3SJX.js.map → outputStyles-QCM5QWSS.js.map} +0 -0
- /package/dist/{pluginRuntime-ZQL56D63.js.map → pluginRuntime-3KLZVRRO.js.map} +0 -0
- /package/dist/{pluginValidation-66AAHNBG.js.map → pluginValidation-LS2AWCCU.js.map} +0 -0
- /package/dist/{prompts-KDX7FM3E.js.map → prompts-SA4OK6QD.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-GD3Z6LAG.js.map → pybAgentSessionLoad-ZONVZBLE.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-IKOTCDZW.js.map → pybAgentSessionResume-CC2LCPTW.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-IUMN533Q.js.map → pybAgentStreamJsonSession-ZNLPABQT.js.map} +0 -0
- /package/dist/{pybHooks-ECZOIQMS.js.map → pybHooks-F3E2A22A.js.map} +0 -0
- /package/dist/{query-QCVQ7T76.js.map → query-CYYPDG2D.js.map} +0 -0
- /package/dist/{ripgrep-BLLSBEDA.js.map → ripgrep-K24UEEMP.js.map} +0 -0
- /package/dist/{skillMarketplace-XXFHN2HH.js.map → skillMarketplace-OU2GDZVW.js.map} +0 -0
- /package/dist/{state-OWOACNRS.js.map → state-IZDGO44E.js.map} +0 -0
- /package/dist/{theme-Y46LR7UJ.js.map → theme-MHQCQKW6.js.map} +0 -0
- /package/dist/{toolPermissionSettings-HHGJYLGQ.js.map → toolPermissionSettings-HRONQYRZ.js.map} +0 -0
- /package/dist/{tools-6FBXOCLI.js.map → tools-XXBWIEJ5.js.map} +0 -0
- /package/dist/{userInput-FKO2RVA5.js.map → userInput-EGXVNNBE.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import { createRequire as __pybCreateRequire } from "node:module";
|
|
|
2
2
|
const require = __pybCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
listPybAgentSessions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LYWVXCUX.js";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_TIMEOUT_MS,
|
|
8
8
|
FallbackToolUseRejectedMessage,
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
listMCPServers,
|
|
17
17
|
loadMergedSettings,
|
|
18
18
|
normalizeSandboxRuntimeConfigFromSettings
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3EQQLZE4.js";
|
|
20
20
|
import {
|
|
21
21
|
formatValidationResult,
|
|
22
22
|
validatePluginOrMarketplacePath
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-YYADUX77.js";
|
|
24
24
|
import {
|
|
25
25
|
addMarketplace,
|
|
26
26
|
disableSkillPlugin,
|
|
@@ -33,15 +33,15 @@ import {
|
|
|
33
33
|
refreshMarketplaceAsync,
|
|
34
34
|
removeMarketplace,
|
|
35
35
|
uninstallSkillPlugin
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-KR37EQX6.js";
|
|
37
37
|
import {
|
|
38
38
|
loadPybAgentSessionMessages
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-6TN4XT74.js";
|
|
40
40
|
import {
|
|
41
41
|
appendSessionCustomTitleRecord,
|
|
42
42
|
appendSessionJsonlFromMessage,
|
|
43
43
|
appendSessionTagRecord
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-F5KZKSH3.js";
|
|
45
45
|
import {
|
|
46
46
|
getRequestStatus,
|
|
47
47
|
setRequestStatus,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
runStopHooks,
|
|
59
59
|
runUserPromptSubmitHooks,
|
|
60
60
|
updateHookTranscriptForMessages
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-QJRO335D.js";
|
|
62
62
|
import {
|
|
63
63
|
getPybAgentSessionId,
|
|
64
64
|
setPybAgentSessionId
|
|
@@ -71,35 +71,35 @@ import {
|
|
|
71
71
|
getOutputStyleSystemPromptAdditions,
|
|
72
72
|
resolveOutputStyleName,
|
|
73
73
|
setCurrentOutputStyle
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-BSAIDJEJ.js";
|
|
75
75
|
import {
|
|
76
76
|
fetchCustomModels,
|
|
77
77
|
getModelFeatures
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-JI5OFKTQ.js";
|
|
79
79
|
import {
|
|
80
80
|
queryLLM,
|
|
81
81
|
queryQuick,
|
|
82
82
|
verifyApiKey
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-ZPTSUA2S.js";
|
|
84
84
|
import {
|
|
85
85
|
listAllContentFiles,
|
|
86
86
|
ripGrep,
|
|
87
87
|
tree
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-ESZZYVDK.js";
|
|
89
89
|
import {
|
|
90
90
|
getCustomCommandDirectories,
|
|
91
91
|
hasCustomCommands,
|
|
92
92
|
loadCustomCommands,
|
|
93
93
|
reloadCustomCommands
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-EGFQHPCU.js";
|
|
95
95
|
import {
|
|
96
96
|
loadToolPermissionContextFromDisk,
|
|
97
97
|
persistToolPermissionUpdateToDisk
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-ULDHZLLE.js";
|
|
99
99
|
import {
|
|
100
100
|
getSettingsFileCandidates,
|
|
101
101
|
loadSettingsWithLegacyFallback
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-4N2642UT.js";
|
|
103
103
|
import {
|
|
104
104
|
applyToolPermissionContextUpdate,
|
|
105
105
|
createDefaultToolPermissionContext
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
resetReminderSession,
|
|
113
113
|
setTodos,
|
|
114
114
|
systemReminderService
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-THFK234H.js";
|
|
116
116
|
import {
|
|
117
117
|
getSessionState
|
|
118
118
|
} from "./chunk-ERMQRV55.js";
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
getActiveAgents,
|
|
122
122
|
getAgentByType,
|
|
123
123
|
getAllAgents
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-ABPSBUQC.js";
|
|
125
125
|
import {
|
|
126
126
|
getSessionPlugins
|
|
127
127
|
} from "./chunk-BJSWTHRM.js";
|
|
@@ -154,22 +154,22 @@ import {
|
|
|
154
154
|
processUserInput,
|
|
155
155
|
reorderMessages,
|
|
156
156
|
stripSystemMessages
|
|
157
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-B62QNVFY.js";
|
|
158
158
|
import {
|
|
159
159
|
ModelManager,
|
|
160
160
|
getModelManager,
|
|
161
161
|
isDefaultSlowAndCapableModel
|
|
162
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-E567RAA6.js";
|
|
163
163
|
import {
|
|
164
164
|
getCodeStyle,
|
|
165
165
|
getContext,
|
|
166
166
|
getGitState,
|
|
167
167
|
getIsGit,
|
|
168
168
|
getProjectDocs
|
|
169
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-C6HYECKQ.js";
|
|
170
170
|
import {
|
|
171
171
|
getTheme
|
|
172
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-PE3FS7DD.js";
|
|
173
173
|
import {
|
|
174
174
|
DEFAULT_GLOBAL_CONFIG,
|
|
175
175
|
enableConfigs,
|
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
saveGlobalConfig,
|
|
183
183
|
setAllPointersToModel,
|
|
184
184
|
setModelPointer
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-LT223NHT.js";
|
|
186
186
|
import {
|
|
187
187
|
AbortError
|
|
188
188
|
} from "./chunk-RQVLBMP7.js";
|
|
@@ -191,7 +191,7 @@ import {
|
|
|
191
191
|
getCurrentRequest,
|
|
192
192
|
logUserFriendly,
|
|
193
193
|
markPhase
|
|
194
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-P2DSZFRF.js";
|
|
195
195
|
import {
|
|
196
196
|
ASCII_LOGO,
|
|
197
197
|
BunShell,
|
|
@@ -227,10 +227,10 @@ import {
|
|
|
227
227
|
renderBashNotification,
|
|
228
228
|
setActivePlanConversationKey,
|
|
229
229
|
setCwd
|
|
230
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-REG5ADDD.js";
|
|
231
231
|
import {
|
|
232
232
|
MACRO
|
|
233
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-ZNCD73BJ.js";
|
|
234
234
|
import {
|
|
235
235
|
formatTotalCost,
|
|
236
236
|
getTotalAPIDuration,
|
|
@@ -418,7 +418,7 @@ var getCommandSubcommandPrefix = memoize(
|
|
|
418
418
|
var getCommandPrefix = memoize(
|
|
419
419
|
async (command4, abortSignal) => {
|
|
420
420
|
const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
|
|
421
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-
|
|
421
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-NMG2UUYR.js");
|
|
422
422
|
const response = await queryQuick2({
|
|
423
423
|
systemPrompt,
|
|
424
424
|
userPrompt,
|
|
@@ -561,7 +561,7 @@ function writeTextContent(filePath, content, encoding, endings) {
|
|
|
561
561
|
writeFileSync(filePath, toWrite, { encoding, flush: true });
|
|
562
562
|
}
|
|
563
563
|
var repoEndingCache = new LRUCache({
|
|
564
|
-
fetchMethod: (
|
|
564
|
+
fetchMethod: (path7) => detectRepoLineEndingsDirect(path7),
|
|
565
565
|
ttl: 5 * 60 * 1e3,
|
|
566
566
|
ttlAutopurge: false,
|
|
567
567
|
max: 1e3
|
|
@@ -593,7 +593,7 @@ function fetch2(cache, key, value) {
|
|
|
593
593
|
return v;
|
|
594
594
|
}
|
|
595
595
|
var fileEncodingCache = new LRUCache({
|
|
596
|
-
fetchMethod: (
|
|
596
|
+
fetchMethod: (path7) => detectFileEncodingDirect(path7),
|
|
597
597
|
ttl: 5 * 60 * 1e3,
|
|
598
598
|
ttlAutopurge: false,
|
|
599
599
|
max: 1e3
|
|
@@ -625,7 +625,7 @@ function detectFileEncodingDirect(filePath) {
|
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
var lineEndingCache = new LRUCache({
|
|
628
|
-
fetchMethod: (
|
|
628
|
+
fetchMethod: (path7) => detectLineEndingsDirect(path7),
|
|
629
629
|
ttl: 5 * 60 * 1e3,
|
|
630
630
|
ttlAutopurge: false,
|
|
631
631
|
max: 1e3
|
|
@@ -674,11 +674,11 @@ function normalizeFilePath(filePath) {
|
|
|
674
674
|
}
|
|
675
675
|
return absoluteFilePath;
|
|
676
676
|
}
|
|
677
|
-
function getAbsolutePath(
|
|
678
|
-
return
|
|
677
|
+
function getAbsolutePath(path7) {
|
|
678
|
+
return path7 ? isAbsolute(path7) ? path7 : resolve(getCwd(), path7) : void 0;
|
|
679
679
|
}
|
|
680
|
-
function getAbsoluteAndRelativePaths(
|
|
681
|
-
const absolutePath = getAbsolutePath(
|
|
680
|
+
function getAbsoluteAndRelativePaths(path7) {
|
|
681
|
+
const absolutePath = getAbsolutePath(path7);
|
|
682
682
|
const relativePath = absolutePath ? relative(getCwd(), absolutePath) : void 0;
|
|
683
683
|
return { absolutePath, relativePath };
|
|
684
684
|
}
|
|
@@ -1139,9 +1139,9 @@ async function startHttpProxy() {
|
|
|
1139
1139
|
writeHttpErrorResponse(clientSocket, "502 Bad Gateway");
|
|
1140
1140
|
});
|
|
1141
1141
|
upstream.once("connect", () => {
|
|
1142
|
-
const
|
|
1142
|
+
const path7 = `${targetUrl.pathname}${targetUrl.search}`;
|
|
1143
1143
|
try {
|
|
1144
|
-
upstream.write(`${method} ${
|
|
1144
|
+
upstream.write(`${method} ${path7} ${version}\r
|
|
1145
1145
|
`);
|
|
1146
1146
|
for (const [k, v] of Object.entries(headers)) {
|
|
1147
1147
|
upstream.write(`${k}: ${v}\r
|
|
@@ -4458,7 +4458,7 @@ function formatParseError(error) {
|
|
|
4458
4458
|
return error instanceof Error ? error.message : String(error);
|
|
4459
4459
|
}
|
|
4460
4460
|
async function defaultGateQuery(args) {
|
|
4461
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-
|
|
4461
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-NMG2UUYR.js");
|
|
4462
4462
|
const messages = [
|
|
4463
4463
|
{
|
|
4464
4464
|
type: "user",
|
|
@@ -4536,7 +4536,7 @@ function writeGateFailureDump(args) {
|
|
|
4536
4536
|
const dir = join3(CACHE_PATHS.errors(), "bash-llm-gate");
|
|
4537
4537
|
mkdirSync(dir, { recursive: true });
|
|
4538
4538
|
const filename = `${dateToFilename(/* @__PURE__ */ new Date())}-${randomUUID()}.txt`;
|
|
4539
|
-
const
|
|
4539
|
+
const path7 = join3(dir, filename);
|
|
4540
4540
|
const body = [
|
|
4541
4541
|
"=== Bash LLM gate failure ===",
|
|
4542
4542
|
"",
|
|
@@ -4563,7 +4563,7 @@ function writeGateFailureDump(args) {
|
|
|
4563
4563
|
args.output ?? "",
|
|
4564
4564
|
""
|
|
4565
4565
|
].filter(Boolean).join("\n");
|
|
4566
|
-
writeFileSync2(
|
|
4566
|
+
writeFileSync2(path7, body, "utf8");
|
|
4567
4567
|
} catch {
|
|
4568
4568
|
}
|
|
4569
4569
|
}
|
|
@@ -6111,8 +6111,8 @@ var FileFreshnessService = class {
|
|
|
6111
6111
|
return this.state.readTimestamps.has(filePath);
|
|
6112
6112
|
}
|
|
6113
6113
|
getImportantFiles(maxFiles = 5) {
|
|
6114
|
-
return Array.from(this.state.readTimestamps.entries()).map(([
|
|
6115
|
-
path:
|
|
6114
|
+
return Array.from(this.state.readTimestamps.entries()).map(([path7, info]) => ({
|
|
6115
|
+
path: path7,
|
|
6116
6116
|
timestamp: info.lastRead,
|
|
6117
6117
|
size: info.size
|
|
6118
6118
|
})).filter((file) => this.isValidForRecovery(file.path)).sort((a, b) => b.timestamp - a.timestamp).slice(0, maxFiles);
|
|
@@ -6171,8 +6171,8 @@ import { dirname as dirname2, isAbsolute as isAbsolute2, resolve as resolve2, re
|
|
|
6171
6171
|
import { statSync as statSync3 } from "fs";
|
|
6172
6172
|
var readFileAllowedDirectories = /* @__PURE__ */ new Set();
|
|
6173
6173
|
var writeFileAllowedDirectories = /* @__PURE__ */ new Set();
|
|
6174
|
-
function toAbsolutePath(
|
|
6175
|
-
const abs = isAbsolute2(
|
|
6174
|
+
function toAbsolutePath(path7) {
|
|
6175
|
+
const abs = isAbsolute2(path7) ? resolve2(path7) : resolve2(getCwd(), path7);
|
|
6176
6176
|
return normalizeForCompare(abs);
|
|
6177
6177
|
}
|
|
6178
6178
|
function normalizeForCompare(p) {
|
|
@@ -6186,13 +6186,13 @@ function isSubpath(base, target) {
|
|
|
6186
6186
|
if (isAbsolute2(rel)) return false;
|
|
6187
6187
|
return true;
|
|
6188
6188
|
}
|
|
6189
|
-
function pathToPermissionDirectory(
|
|
6189
|
+
function pathToPermissionDirectory(path7) {
|
|
6190
6190
|
try {
|
|
6191
|
-
const stats = statSync3(
|
|
6192
|
-
if (stats.isDirectory()) return
|
|
6191
|
+
const stats = statSync3(path7);
|
|
6192
|
+
if (stats.isDirectory()) return path7;
|
|
6193
6193
|
} catch {
|
|
6194
6194
|
}
|
|
6195
|
-
return dirname2(
|
|
6195
|
+
return dirname2(path7);
|
|
6196
6196
|
}
|
|
6197
6197
|
function hasReadPermission(directory) {
|
|
6198
6198
|
if (isMainPlanFilePathForActiveConversation(directory)) return true;
|
|
@@ -6232,8 +6232,8 @@ function saveWritePermission(directory) {
|
|
|
6232
6232
|
}
|
|
6233
6233
|
writeFileAllowedDirectories.add(absolutePath);
|
|
6234
6234
|
}
|
|
6235
|
-
function grantWritePermissionForPath(
|
|
6236
|
-
const absolutePath = toAbsolutePath(
|
|
6235
|
+
function grantWritePermissionForPath(path7) {
|
|
6236
|
+
const absolutePath = toAbsolutePath(path7);
|
|
6237
6237
|
saveWritePermission(pathToPermissionDirectory(absolutePath));
|
|
6238
6238
|
}
|
|
6239
6239
|
|
|
@@ -6852,7 +6852,7 @@ function getSnippet(initialText, oldStr, newStr) {
|
|
|
6852
6852
|
// src/tools/filesystem/FileReadTool/FileReadTool.tsx
|
|
6853
6853
|
import { statSync as statSync6 } from "fs";
|
|
6854
6854
|
import { Box as Box12, Text as Text13 } from "ink";
|
|
6855
|
-
import * as
|
|
6855
|
+
import * as path6 from "node:path";
|
|
6856
6856
|
import { extname as extname5, relative as relative7 } from "node:path";
|
|
6857
6857
|
import * as React13 from "react";
|
|
6858
6858
|
import { z as z4 } from "zod";
|
|
@@ -7284,6 +7284,218 @@ var SecureFileService = class _SecureFileService {
|
|
|
7284
7284
|
};
|
|
7285
7285
|
var secureFileService = SecureFileService.getInstance();
|
|
7286
7286
|
|
|
7287
|
+
// src/utils/tree-sitter/registry.ts
|
|
7288
|
+
import path4 from "path";
|
|
7289
|
+
var ParserRegistry = class {
|
|
7290
|
+
static extensionMap = {
|
|
7291
|
+
".ts": "typescript",
|
|
7292
|
+
".tsx": "tsx",
|
|
7293
|
+
".js": "typescript",
|
|
7294
|
+
// Use TS parser for JS
|
|
7295
|
+
".jsx": "tsx",
|
|
7296
|
+
".py": "python",
|
|
7297
|
+
".sh": "bash",
|
|
7298
|
+
".bash": "bash",
|
|
7299
|
+
".rs": "rust",
|
|
7300
|
+
".go": "go",
|
|
7301
|
+
".java": "java",
|
|
7302
|
+
".cpp": "cpp",
|
|
7303
|
+
".c": "c",
|
|
7304
|
+
".h": "c",
|
|
7305
|
+
".cc": "cpp",
|
|
7306
|
+
".cs": "c_sharp",
|
|
7307
|
+
".scala": "scala",
|
|
7308
|
+
".sbt": "scala",
|
|
7309
|
+
".sc": "scala",
|
|
7310
|
+
".hs": "haskell",
|
|
7311
|
+
".lhs": "haskell",
|
|
7312
|
+
".jl": "julia",
|
|
7313
|
+
".ml": "ocaml",
|
|
7314
|
+
".mli": "ocaml",
|
|
7315
|
+
".swift": "swift",
|
|
7316
|
+
".nix": "nix",
|
|
7317
|
+
".rb": "ruby",
|
|
7318
|
+
".html": "html",
|
|
7319
|
+
".htm": "html",
|
|
7320
|
+
".css": "css",
|
|
7321
|
+
".json": "json",
|
|
7322
|
+
".jsonc": "json",
|
|
7323
|
+
".yaml": "yaml",
|
|
7324
|
+
".yml": "yaml"
|
|
7325
|
+
};
|
|
7326
|
+
/**
|
|
7327
|
+
* Get the supported language ID for a given filename.
|
|
7328
|
+
* Returns null if the extension is not supported.
|
|
7329
|
+
*/
|
|
7330
|
+
static getLanguage(filename) {
|
|
7331
|
+
const ext = path4.extname(filename).toLowerCase();
|
|
7332
|
+
return this.extensionMap[ext] || null;
|
|
7333
|
+
}
|
|
7334
|
+
/**
|
|
7335
|
+
* Register or override a file extension mapping.
|
|
7336
|
+
*/
|
|
7337
|
+
static registerExtension(ext, lang) {
|
|
7338
|
+
const normalizedExt = ext.startsWith(".") ? ext : `.${ext}`;
|
|
7339
|
+
this.extensionMap[normalizedExt.toLowerCase()] = lang;
|
|
7340
|
+
}
|
|
7341
|
+
};
|
|
7342
|
+
|
|
7343
|
+
// src/utils/tree-sitter/loader.ts
|
|
7344
|
+
import { Parser, Language } from "web-tree-sitter";
|
|
7345
|
+
import { fileURLToPath } from "url";
|
|
7346
|
+
import path5 from "path";
|
|
7347
|
+
var getDirname = () => {
|
|
7348
|
+
try {
|
|
7349
|
+
return __dirname;
|
|
7350
|
+
} catch {
|
|
7351
|
+
return path5.dirname(fileURLToPath(import.meta.url));
|
|
7352
|
+
}
|
|
7353
|
+
};
|
|
7354
|
+
var _dirname = getDirname();
|
|
7355
|
+
var parserCache = /* @__PURE__ */ new Map();
|
|
7356
|
+
var isInitialized = false;
|
|
7357
|
+
var LANGUAGE_MAP = {
|
|
7358
|
+
bash: "tree-sitter-bash.wasm",
|
|
7359
|
+
typescript: "tree-sitter-typescript.wasm",
|
|
7360
|
+
tsx: "tree-sitter-tsx.wasm",
|
|
7361
|
+
python: "tree-sitter-python.wasm",
|
|
7362
|
+
rust: "tree-sitter-rust.wasm",
|
|
7363
|
+
go: "tree-sitter-go.wasm",
|
|
7364
|
+
java: "tree-sitter-java.wasm",
|
|
7365
|
+
cpp: "tree-sitter-cpp.wasm",
|
|
7366
|
+
c: "tree-sitter-c.wasm",
|
|
7367
|
+
c_sharp: "tree-sitter-c_sharp.wasm",
|
|
7368
|
+
scala: "tree-sitter-scala.wasm",
|
|
7369
|
+
haskell: "tree-sitter-haskell.wasm",
|
|
7370
|
+
julia: "tree-sitter-julia.wasm",
|
|
7371
|
+
ocaml: "tree-sitter-ocaml.wasm",
|
|
7372
|
+
swift: "tree-sitter-swift.wasm",
|
|
7373
|
+
nix: "tree-sitter-nix.wasm",
|
|
7374
|
+
ruby: "tree-sitter-ruby.wasm",
|
|
7375
|
+
html: "tree-sitter-html.wasm",
|
|
7376
|
+
css: "tree-sitter-css.wasm",
|
|
7377
|
+
json: "tree-sitter-json.wasm",
|
|
7378
|
+
yaml: "tree-sitter-yaml.wasm"
|
|
7379
|
+
};
|
|
7380
|
+
async function ensureInitialized() {
|
|
7381
|
+
if (isInitialized) return;
|
|
7382
|
+
let resourcesDir;
|
|
7383
|
+
if (_dirname.includes("dist") || _dirname.includes("node_modules")) {
|
|
7384
|
+
resourcesDir = path5.resolve(_dirname, "../resources/tree-sitter");
|
|
7385
|
+
} else {
|
|
7386
|
+
resourcesDir = path5.resolve(_dirname, "../../../resources/tree-sitter");
|
|
7387
|
+
}
|
|
7388
|
+
const treeWasmPath = path5.join(resourcesDir, "tree-sitter.wasm");
|
|
7389
|
+
await Parser.init({
|
|
7390
|
+
locateFile: () => treeWasmPath
|
|
7391
|
+
});
|
|
7392
|
+
isInitialized = true;
|
|
7393
|
+
}
|
|
7394
|
+
var loadLanguage = async (lang) => {
|
|
7395
|
+
if (parserCache.has(lang)) {
|
|
7396
|
+
return parserCache.get(lang);
|
|
7397
|
+
}
|
|
7398
|
+
await ensureInitialized();
|
|
7399
|
+
const fileName = LANGUAGE_MAP[lang];
|
|
7400
|
+
if (!fileName) {
|
|
7401
|
+
throw new Error(`Unsupported language: ${lang}`);
|
|
7402
|
+
}
|
|
7403
|
+
try {
|
|
7404
|
+
let resourcesDir;
|
|
7405
|
+
if (_dirname.includes("dist") || _dirname.includes("node_modules")) {
|
|
7406
|
+
resourcesDir = path5.resolve(_dirname, "../resources/tree-sitter");
|
|
7407
|
+
} else {
|
|
7408
|
+
resourcesDir = path5.resolve(_dirname, "../../../resources/tree-sitter");
|
|
7409
|
+
}
|
|
7410
|
+
const wasmPath = path5.join(resourcesDir, fileName);
|
|
7411
|
+
const language = await Language.load(wasmPath);
|
|
7412
|
+
const parser = new Parser();
|
|
7413
|
+
parser.setLanguage(language);
|
|
7414
|
+
parserCache.set(lang, parser);
|
|
7415
|
+
return parser;
|
|
7416
|
+
} catch (error) {
|
|
7417
|
+
console.error(`Error loading language ${lang}:`, error);
|
|
7418
|
+
throw new Error(`Failed to load language ${lang}: ${error}`);
|
|
7419
|
+
}
|
|
7420
|
+
};
|
|
7421
|
+
var legacyParserInstance = null;
|
|
7422
|
+
var initParser = async () => {
|
|
7423
|
+
if (legacyParserInstance) return legacyParserInstance;
|
|
7424
|
+
legacyParserInstance = await loadLanguage("bash");
|
|
7425
|
+
return legacyParserInstance;
|
|
7426
|
+
};
|
|
7427
|
+
|
|
7428
|
+
// src/utils/tree-sitter/smart-truncator.ts
|
|
7429
|
+
var SmartTruncator = class _SmartTruncator {
|
|
7430
|
+
static CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
7431
|
+
// Python
|
|
7432
|
+
"function_definition",
|
|
7433
|
+
"class_definition",
|
|
7434
|
+
// TypeScript/JS
|
|
7435
|
+
"function_declaration",
|
|
7436
|
+
"class_declaration",
|
|
7437
|
+
"method_definition",
|
|
7438
|
+
"arrow_function",
|
|
7439
|
+
"interface_declaration"
|
|
7440
|
+
]);
|
|
7441
|
+
/**
|
|
7442
|
+
* Adjusts the start and end lines to try to preserve semantic boundaries.
|
|
7443
|
+
* @param filename
|
|
7444
|
+
* @param code
|
|
7445
|
+
* @param startLine 0-based inclusive
|
|
7446
|
+
* @param endLine 0-based inclusive
|
|
7447
|
+
*/
|
|
7448
|
+
static async getSmartRange(filename, code, startLine, endLine) {
|
|
7449
|
+
const langKey = ParserRegistry.getLanguage(filename);
|
|
7450
|
+
if (!langKey) {
|
|
7451
|
+
return { start: startLine, end: endLine };
|
|
7452
|
+
}
|
|
7453
|
+
try {
|
|
7454
|
+
const parser = await loadLanguage(langKey);
|
|
7455
|
+
const tree2 = parser.parse(code);
|
|
7456
|
+
let newStart = startLine;
|
|
7457
|
+
let newEnd = endLine;
|
|
7458
|
+
const endNode = tree2.rootNode.descendantForPosition({ row: endLine, column: 1e4 });
|
|
7459
|
+
const containers = _SmartTruncator.findContainers(endNode);
|
|
7460
|
+
for (const container of containers) {
|
|
7461
|
+
if (container.endPosition.row > endLine) {
|
|
7462
|
+
if (container.startPosition.row >= startLine) {
|
|
7463
|
+
if (container.endPosition.row - endLine <= 500) {
|
|
7464
|
+
newEnd = Math.max(newEnd, container.endPosition.row);
|
|
7465
|
+
}
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7468
|
+
}
|
|
7469
|
+
const startNode = tree2.rootNode.descendantForPosition({ row: startLine, column: 0 });
|
|
7470
|
+
const startContainers = _SmartTruncator.findContainers(startNode);
|
|
7471
|
+
for (const container of startContainers) {
|
|
7472
|
+
if (container.startPosition.row < startLine) {
|
|
7473
|
+
if (container.endPosition.row <= endLine) {
|
|
7474
|
+
if (startLine - container.startPosition.row <= 500) {
|
|
7475
|
+
newStart = Math.min(newStart, container.startPosition.row);
|
|
7476
|
+
}
|
|
7477
|
+
}
|
|
7478
|
+
}
|
|
7479
|
+
}
|
|
7480
|
+
return { start: newStart, end: newEnd };
|
|
7481
|
+
} catch (err) {
|
|
7482
|
+
console.error("SmartTruncator failed:", err);
|
|
7483
|
+
return { start: startLine, end: endLine };
|
|
7484
|
+
}
|
|
7485
|
+
}
|
|
7486
|
+
static findContainers(node) {
|
|
7487
|
+
const containers = [];
|
|
7488
|
+
let current = node;
|
|
7489
|
+
while (current) {
|
|
7490
|
+
if (_SmartTruncator.CONTAINER_TYPES.has(current.type)) {
|
|
7491
|
+
containers.push(current);
|
|
7492
|
+
}
|
|
7493
|
+
current = current.parent;
|
|
7494
|
+
}
|
|
7495
|
+
return containers;
|
|
7496
|
+
}
|
|
7497
|
+
};
|
|
7498
|
+
|
|
7287
7499
|
// src/tools/filesystem/FileReadTool/FileReadTool.tsx
|
|
7288
7500
|
var MAX_LINES_TO_RENDER = 5;
|
|
7289
7501
|
var MAX_LINE_LENGTH2 = 2e3;
|
|
@@ -7446,7 +7658,7 @@ var FileReadTool = {
|
|
|
7446
7658
|
message
|
|
7447
7659
|
};
|
|
7448
7660
|
}
|
|
7449
|
-
const ext =
|
|
7661
|
+
const ext = path6.extname(fullFilePath).toLowerCase();
|
|
7450
7662
|
const fileSize = fileCheck.stats?.size ?? 0;
|
|
7451
7663
|
if (BINARY_EXTENSIONS.has(ext)) {
|
|
7452
7664
|
return {
|
|
@@ -7474,7 +7686,7 @@ var FileReadTool = {
|
|
|
7474
7686
|
return { result: true };
|
|
7475
7687
|
},
|
|
7476
7688
|
async *call({ file_path, offset = 1, limit = void 0 }, { readFileTimestamps }) {
|
|
7477
|
-
const ext =
|
|
7689
|
+
const ext = path6.extname(file_path).toLowerCase();
|
|
7478
7690
|
const fullFilePath = normalizeFilePath(file_path);
|
|
7479
7691
|
recordFileRead(fullFilePath);
|
|
7480
7692
|
emitReminderEvent("file:read", {
|
|
@@ -7542,12 +7754,30 @@ var FileReadTool = {
|
|
|
7542
7754
|
};
|
|
7543
7755
|
return;
|
|
7544
7756
|
}
|
|
7545
|
-
|
|
7546
|
-
|
|
7757
|
+
let startLine = offset;
|
|
7758
|
+
let zeroBasedOffset = startLine === 0 ? 0 : startLine - 1;
|
|
7759
|
+
let finalLimit = limit;
|
|
7760
|
+
if (limit) {
|
|
7761
|
+
try {
|
|
7762
|
+
const fullContent = await readFileBun(fullFilePath);
|
|
7763
|
+
if (fullContent) {
|
|
7764
|
+
const range = await SmartTruncator.getSmartRange(
|
|
7765
|
+
fullFilePath,
|
|
7766
|
+
fullContent,
|
|
7767
|
+
zeroBasedOffset,
|
|
7768
|
+
zeroBasedOffset + limit - 1
|
|
7769
|
+
);
|
|
7770
|
+
zeroBasedOffset = range.start;
|
|
7771
|
+
startLine = zeroBasedOffset + 1;
|
|
7772
|
+
finalLimit = range.end - range.start + 1;
|
|
7773
|
+
}
|
|
7774
|
+
} catch (e) {
|
|
7775
|
+
}
|
|
7776
|
+
}
|
|
7547
7777
|
const { content, lineCount, totalLines } = readTextContent(
|
|
7548
7778
|
fullFilePath,
|
|
7549
7779
|
zeroBasedOffset,
|
|
7550
|
-
|
|
7780
|
+
finalLimit
|
|
7551
7781
|
);
|
|
7552
7782
|
const truncatedLines = content.split(/\r?\n/).map(
|
|
7553
7783
|
(line) => line.length > MAX_LINE_LENGTH2 ? line.slice(0, MAX_LINE_LENGTH2) : line
|
|
@@ -7938,33 +8168,33 @@ var GlobTool = {
|
|
|
7938
8168
|
isConcurrencySafe() {
|
|
7939
8169
|
return true;
|
|
7940
8170
|
},
|
|
7941
|
-
needsPermissions({ path:
|
|
7942
|
-
return !hasReadPermission(
|
|
8171
|
+
needsPermissions({ path: path7 }) {
|
|
8172
|
+
return !hasReadPermission(path7 || getCwd());
|
|
7943
8173
|
},
|
|
7944
8174
|
async prompt() {
|
|
7945
8175
|
return DESCRIPTION4;
|
|
7946
8176
|
},
|
|
7947
|
-
async validateInput({ path:
|
|
7948
|
-
if (!
|
|
7949
|
-
const absolute = isAbsolute8(
|
|
8177
|
+
async validateInput({ path: path7 }) {
|
|
8178
|
+
if (!path7) return { result: true };
|
|
8179
|
+
const absolute = isAbsolute8(path7) ? path7 : resolve8(getCwd(), path7);
|
|
7950
8180
|
if (!existsSync6(absolute)) {
|
|
7951
8181
|
return {
|
|
7952
8182
|
result: false,
|
|
7953
|
-
message: `Directory does not exist: ${
|
|
8183
|
+
message: `Directory does not exist: ${path7}`,
|
|
7954
8184
|
errorCode: 1
|
|
7955
8185
|
};
|
|
7956
8186
|
}
|
|
7957
8187
|
if (!statSync8(absolute).isDirectory()) {
|
|
7958
8188
|
return {
|
|
7959
8189
|
result: false,
|
|
7960
|
-
message: `Path is not a directory: ${
|
|
8190
|
+
message: `Path is not a directory: ${path7}`,
|
|
7961
8191
|
errorCode: 2
|
|
7962
8192
|
};
|
|
7963
8193
|
}
|
|
7964
8194
|
return { result: true };
|
|
7965
8195
|
},
|
|
7966
|
-
renderToolUseMessage({ pattern, path:
|
|
7967
|
-
const absolutePath =
|
|
8196
|
+
renderToolUseMessage({ pattern, path: path7 }, { verbose }) {
|
|
8197
|
+
const absolutePath = path7 ? isAbsolute8(path7) ? path7 : resolve8(getCwd(), path7) : void 0;
|
|
7968
8198
|
const relativePath = absolutePath ? relative9(getCwd(), absolutePath) : void 0;
|
|
7969
8199
|
return `pattern: "${pattern}"${relativePath || verbose ? `, path: "${verbose ? absolutePath : relativePath}"` : ""}`;
|
|
7970
8200
|
},
|
|
@@ -7977,9 +8207,9 @@ var GlobTool = {
|
|
|
7977
8207
|
}
|
|
7978
8208
|
return /* @__PURE__ */ React15.createElement(Box14, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "row" }, /* @__PURE__ */ React15.createElement(Text15, null, "\xA0\xA0\u23BF \xA0Found "), /* @__PURE__ */ React15.createElement(Text15, { bold: true }, output.numFiles, " "), /* @__PURE__ */ React15.createElement(Text15, null, output.numFiles === 0 || output.numFiles > 1 ? "files" : "file")), /* @__PURE__ */ React15.createElement(Cost, { costUSD: 0, durationMs: output.durationMs, debug: false }));
|
|
7979
8209
|
},
|
|
7980
|
-
async *call({ pattern, path:
|
|
8210
|
+
async *call({ pattern, path: path7 }, { abortController }) {
|
|
7981
8211
|
const start = Date.now();
|
|
7982
|
-
const searchPath =
|
|
8212
|
+
const searchPath = path7 ? isAbsolute8(path7) ? path7 : resolve8(getCwd(), path7) : getCwd();
|
|
7983
8213
|
const raw = await ripGrep(
|
|
7984
8214
|
[
|
|
7985
8215
|
"--files",
|
|
@@ -8144,8 +8374,8 @@ var GrepTool = {
|
|
|
8144
8374
|
async isEnabled() {
|
|
8145
8375
|
return true;
|
|
8146
8376
|
},
|
|
8147
|
-
needsPermissions({ path:
|
|
8148
|
-
return !hasReadPermission(
|
|
8377
|
+
needsPermissions({ path: path7 }) {
|
|
8378
|
+
return !hasReadPermission(path7 || getCwd());
|
|
8149
8379
|
},
|
|
8150
8380
|
async prompt() {
|
|
8151
8381
|
return DESCRIPTION5;
|
|
@@ -8153,7 +8383,7 @@ var GrepTool = {
|
|
|
8153
8383
|
renderToolUseMessage(input, { verbose }) {
|
|
8154
8384
|
const {
|
|
8155
8385
|
pattern,
|
|
8156
|
-
path:
|
|
8386
|
+
path: path7,
|
|
8157
8387
|
glob,
|
|
8158
8388
|
type: type2,
|
|
8159
8389
|
output_mode = "files_with_matches",
|
|
@@ -8161,8 +8391,8 @@ var GrepTool = {
|
|
|
8161
8391
|
} = input;
|
|
8162
8392
|
if (!pattern) return null;
|
|
8163
8393
|
const parts = [`pattern: "${pattern}"`];
|
|
8164
|
-
if (
|
|
8165
|
-
const { absolutePath, relativePath } = getAbsoluteAndRelativePaths(
|
|
8394
|
+
if (path7) {
|
|
8395
|
+
const { absolutePath, relativePath } = getAbsoluteAndRelativePaths(path7);
|
|
8166
8396
|
parts.push(`path: "${verbose ? absolutePath : relativePath}"`);
|
|
8167
8397
|
}
|
|
8168
8398
|
if (glob) parts.push(`glob: "${glob}"`);
|
|
@@ -8206,13 +8436,13 @@ Found ${numMatches} total ${numMatches === 1 ? "occurrence" : "occurrences"} acr
|
|
|
8206
8436
|
${result.filenames.join("\n")}`;
|
|
8207
8437
|
return truncateToCharBudget(header);
|
|
8208
8438
|
},
|
|
8209
|
-
async validateInput({ path:
|
|
8210
|
-
if (
|
|
8211
|
-
const abs = getAbsolutePath(
|
|
8439
|
+
async validateInput({ path: path7 }) {
|
|
8440
|
+
if (path7) {
|
|
8441
|
+
const abs = getAbsolutePath(path7);
|
|
8212
8442
|
if (!abs || !existsSync7(abs)) {
|
|
8213
8443
|
return {
|
|
8214
8444
|
result: false,
|
|
8215
|
-
message: `Path does not exist: ${
|
|
8445
|
+
message: `Path does not exist: ${path7}`,
|
|
8216
8446
|
errorCode: 1
|
|
8217
8447
|
};
|
|
8218
8448
|
}
|
|
@@ -8221,7 +8451,7 @@ ${result.filenames.join("\n")}`;
|
|
|
8221
8451
|
},
|
|
8222
8452
|
async *call({
|
|
8223
8453
|
pattern,
|
|
8224
|
-
path:
|
|
8454
|
+
path: path7,
|
|
8225
8455
|
glob,
|
|
8226
8456
|
type: type2,
|
|
8227
8457
|
output_mode = "files_with_matches",
|
|
@@ -8236,7 +8466,7 @@ ${result.filenames.join("\n")}`;
|
|
|
8236
8466
|
}, toolUseContext) {
|
|
8237
8467
|
const { abortController } = toolUseContext;
|
|
8238
8468
|
const start = Date.now();
|
|
8239
|
-
const absolutePath = getAbsolutePath(
|
|
8469
|
+
const absolutePath = getAbsolutePath(path7) || getCwd();
|
|
8240
8470
|
const baseArgs = ["--hidden"];
|
|
8241
8471
|
for (const dir of EXCLUDED_DIRS) {
|
|
8242
8472
|
baseArgs.push("--glob", `!${dir}`);
|
|
@@ -11013,7 +11243,7 @@ async function createAndStoreApiKey(accessToken) {
|
|
|
11013
11243
|
}
|
|
11014
11244
|
saveGlobalConfig(config2);
|
|
11015
11245
|
try {
|
|
11016
|
-
const { resetAnthropicClient } = await import("./llm-
|
|
11246
|
+
const { resetAnthropicClient } = await import("./llm-NMG2UUYR.js");
|
|
11017
11247
|
resetAnthropicClient();
|
|
11018
11248
|
} catch {
|
|
11019
11249
|
}
|
|
@@ -15295,7 +15525,7 @@ async function refreshPluginRuntimeFromInstalls() {
|
|
|
15295
15525
|
const existingRoots = getSessionPlugins().map((p) => p.rootDir);
|
|
15296
15526
|
const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
|
|
15297
15527
|
if (dirs.length === 0) return [];
|
|
15298
|
-
const { configureSessionPlugins } = await import("./pluginRuntime-
|
|
15528
|
+
const { configureSessionPlugins } = await import("./pluginRuntime-3KLZVRRO.js");
|
|
15299
15529
|
const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
|
|
15300
15530
|
return errors;
|
|
15301
15531
|
}
|
|
@@ -15964,7 +16194,7 @@ async function call(onDone, context) {
|
|
|
15964
16194
|
ModelConfig,
|
|
15965
16195
|
{
|
|
15966
16196
|
onClose: () => {
|
|
15967
|
-
import("./model-
|
|
16197
|
+
import("./model-CLIHMLR3.js").then(({ reloadModelManager: reloadModelManager2 }) => {
|
|
15968
16198
|
reloadModelManager2();
|
|
15969
16199
|
triggerModelConfigChange();
|
|
15970
16200
|
onDone();
|
|
@@ -18860,13 +19090,13 @@ function isMultiFile(toolUseConfirm) {
|
|
|
18860
19090
|
}
|
|
18861
19091
|
return false;
|
|
18862
19092
|
}
|
|
18863
|
-
function pathToPermissionDirectory2(
|
|
19093
|
+
function pathToPermissionDirectory2(path7) {
|
|
18864
19094
|
try {
|
|
18865
|
-
const stats = statSync10(
|
|
18866
|
-
if (stats.isDirectory()) return
|
|
19095
|
+
const stats = statSync10(path7);
|
|
19096
|
+
if (stats.isDirectory()) return path7;
|
|
18867
19097
|
} catch {
|
|
18868
19098
|
}
|
|
18869
|
-
return dirname8(
|
|
19099
|
+
return dirname8(path7);
|
|
18870
19100
|
}
|
|
18871
19101
|
function pathFromToolUse(toolUseConfirm) {
|
|
18872
19102
|
const pathArgName = pathArgNameForToolUse(toolUseConfirm);
|
|
@@ -18885,8 +19115,8 @@ function FilesystemPermissionRequest({
|
|
|
18885
19115
|
onDone,
|
|
18886
19116
|
verbose
|
|
18887
19117
|
}) {
|
|
18888
|
-
const
|
|
18889
|
-
if (!
|
|
19118
|
+
const path7 = pathFromToolUse(toolUseConfirm);
|
|
19119
|
+
if (!path7) {
|
|
18890
19120
|
return /* @__PURE__ */ React80.createElement(
|
|
18891
19121
|
FallbackPermissionRequest,
|
|
18892
19122
|
{
|
|
@@ -18900,15 +19130,15 @@ function FilesystemPermissionRequest({
|
|
|
18900
19130
|
FilesystemPermissionRequestImpl,
|
|
18901
19131
|
{
|
|
18902
19132
|
toolUseConfirm,
|
|
18903
|
-
path:
|
|
19133
|
+
path: path7,
|
|
18904
19134
|
onDone,
|
|
18905
19135
|
verbose
|
|
18906
19136
|
}
|
|
18907
19137
|
);
|
|
18908
19138
|
}
|
|
18909
|
-
function getDontAskAgainOptions(toolUseConfirm,
|
|
19139
|
+
function getDontAskAgainOptions(toolUseConfirm, path7, modeCycleShortcut, isInWorkingDir, hasSessionSuggestion) {
|
|
18910
19140
|
if (!hasSessionSuggestion) return [];
|
|
18911
|
-
const permissionDirPath = pathToPermissionDirectory2(
|
|
19141
|
+
const permissionDirPath = pathToPermissionDirectory2(path7);
|
|
18912
19142
|
const permissionDirName = basename4(permissionDirPath) || "this directory";
|
|
18913
19143
|
if (toolUseConfirm.tool.isReadOnly(toolUseConfirm.input)) {
|
|
18914
19144
|
const label2 = isInWorkingDir ? "Yes, during this session" : `Yes, allow reading from ${chalk11.bold(`${permissionDirName}/`)} during this session`;
|
|
@@ -18922,7 +19152,7 @@ function getDontAskAgainOptions(toolUseConfirm, path6, modeCycleShortcut, isInWo
|
|
|
18922
19152
|
}
|
|
18923
19153
|
function FilesystemPermissionRequestImpl({
|
|
18924
19154
|
toolUseConfirm,
|
|
18925
|
-
path:
|
|
19155
|
+
path: path7,
|
|
18926
19156
|
onDone,
|
|
18927
19157
|
verbose
|
|
18928
19158
|
}) {
|
|
@@ -18943,8 +19173,8 @@ function FilesystemPermissionRequestImpl({
|
|
|
18943
19173
|
);
|
|
18944
19174
|
usePermissionRequestLogging(toolUseConfirm, unaryEvent);
|
|
18945
19175
|
const permissionDirPath = useMemo18(
|
|
18946
|
-
() => pathToPermissionDirectory2(
|
|
18947
|
-
[
|
|
19176
|
+
() => pathToPermissionDirectory2(path7),
|
|
19177
|
+
[path7]
|
|
18948
19178
|
);
|
|
18949
19179
|
const isInWorkingDir = useMemo18(
|
|
18950
19180
|
() => isPathInWorkingDirectories(permissionDirPath, toolPermissionContext),
|
|
@@ -19042,7 +19272,7 @@ function FilesystemPermissionRequestImpl({
|
|
|
19042
19272
|
},
|
|
19043
19273
|
...getDontAskAgainOptions(
|
|
19044
19274
|
toolUseConfirm,
|
|
19045
|
-
|
|
19275
|
+
path7,
|
|
19046
19276
|
modeCycleShortcut.displayText,
|
|
19047
19277
|
isInWorkingDir,
|
|
19048
19278
|
hasSessionSuggestion
|
|
@@ -23223,7 +23453,7 @@ function useStatusLine() {
|
|
|
23223
23453
|
// src/ui/components/PromptInput.tsx
|
|
23224
23454
|
async function interpretHashCommand(input) {
|
|
23225
23455
|
try {
|
|
23226
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
23456
|
+
const { queryQuick: queryQuick2 } = await import("./llm-NMG2UUYR.js");
|
|
23227
23457
|
const systemPrompt = [
|
|
23228
23458
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
23229
23459
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -23536,7 +23766,7 @@ function PromptInput({
|
|
|
23536
23766
|
if (messages2.length) {
|
|
23537
23767
|
if (mode === "bash") {
|
|
23538
23768
|
onQuery(messages2, newAbortController).then(async () => {
|
|
23539
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
23769
|
+
const { getCwd: getCwd2 } = await import("./state-IZDGO44E.js");
|
|
23540
23770
|
setCurrentPwd(getCwd2());
|
|
23541
23771
|
});
|
|
23542
23772
|
} else {
|
|
@@ -26322,7 +26552,7 @@ import { homedir as homedir7 } from "os";
|
|
|
26322
26552
|
// src/commands/agents/generation.ts
|
|
26323
26553
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
26324
26554
|
async function generateAgentWithClaude(prompt) {
|
|
26325
|
-
const { queryModel } = await import("./llm-
|
|
26555
|
+
const { queryModel } = await import("./llm-NMG2UUYR.js");
|
|
26326
26556
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
26327
26557
|
|
|
26328
26558
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -27547,8 +27777,8 @@ function CreateAgentWizard(props) {
|
|
|
27547
27777
|
true
|
|
27548
27778
|
);
|
|
27549
27779
|
if (openEditor) {
|
|
27550
|
-
const
|
|
27551
|
-
await openInEditor(
|
|
27780
|
+
const path7 = getPrimaryAgentFilePath(location, finalAgent.agentType);
|
|
27781
|
+
await openInEditor(path7);
|
|
27552
27782
|
props.onComplete(
|
|
27553
27783
|
`Created agent: ${chalk15.bold(finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`
|
|
27554
27784
|
);
|
|
@@ -29490,91 +29720,6 @@ function WebFetchPermissionRequest({
|
|
|
29490
29720
|
);
|
|
29491
29721
|
}
|
|
29492
29722
|
|
|
29493
|
-
// src/utils/tree-sitter/loader.ts
|
|
29494
|
-
import { Parser, Language } from "web-tree-sitter";
|
|
29495
|
-
import { fileURLToPath } from "url";
|
|
29496
|
-
import path5 from "path";
|
|
29497
|
-
var getDirname = () => {
|
|
29498
|
-
try {
|
|
29499
|
-
return __dirname;
|
|
29500
|
-
} catch {
|
|
29501
|
-
return path5.dirname(fileURLToPath(import.meta.url));
|
|
29502
|
-
}
|
|
29503
|
-
};
|
|
29504
|
-
var _dirname = getDirname();
|
|
29505
|
-
var parserCache = /* @__PURE__ */ new Map();
|
|
29506
|
-
var isInitialized = false;
|
|
29507
|
-
var LANGUAGE_MAP = {
|
|
29508
|
-
bash: "tree-sitter-bash.wasm",
|
|
29509
|
-
typescript: "tree-sitter-typescript.wasm",
|
|
29510
|
-
tsx: "tree-sitter-tsx.wasm",
|
|
29511
|
-
python: "tree-sitter-python.wasm",
|
|
29512
|
-
rust: "tree-sitter-rust.wasm",
|
|
29513
|
-
go: "tree-sitter-go.wasm",
|
|
29514
|
-
java: "tree-sitter-java.wasm",
|
|
29515
|
-
cpp: "tree-sitter-cpp.wasm",
|
|
29516
|
-
c: "tree-sitter-c.wasm",
|
|
29517
|
-
c_sharp: "tree-sitter-c_sharp.wasm",
|
|
29518
|
-
scala: "tree-sitter-scala.wasm",
|
|
29519
|
-
haskell: "tree-sitter-haskell.wasm",
|
|
29520
|
-
julia: "tree-sitter-julia.wasm",
|
|
29521
|
-
ocaml: "tree-sitter-ocaml.wasm",
|
|
29522
|
-
swift: "tree-sitter-swift.wasm",
|
|
29523
|
-
nix: "tree-sitter-nix.wasm",
|
|
29524
|
-
ruby: "tree-sitter-ruby.wasm",
|
|
29525
|
-
html: "tree-sitter-html.wasm",
|
|
29526
|
-
css: "tree-sitter-css.wasm",
|
|
29527
|
-
json: "tree-sitter-json.wasm",
|
|
29528
|
-
yaml: "tree-sitter-yaml.wasm"
|
|
29529
|
-
};
|
|
29530
|
-
async function ensureInitialized() {
|
|
29531
|
-
if (isInitialized) return;
|
|
29532
|
-
let resourcesDir;
|
|
29533
|
-
if (_dirname.includes("dist") || _dirname.includes("node_modules")) {
|
|
29534
|
-
resourcesDir = path5.resolve(_dirname, "../resources/tree-sitter");
|
|
29535
|
-
} else {
|
|
29536
|
-
resourcesDir = path5.resolve(_dirname, "../../../resources/tree-sitter");
|
|
29537
|
-
}
|
|
29538
|
-
const treeWasmPath = path5.join(resourcesDir, "tree-sitter.wasm");
|
|
29539
|
-
await Parser.init({
|
|
29540
|
-
locateFile: () => treeWasmPath
|
|
29541
|
-
});
|
|
29542
|
-
isInitialized = true;
|
|
29543
|
-
}
|
|
29544
|
-
var loadLanguage = async (lang) => {
|
|
29545
|
-
if (parserCache.has(lang)) {
|
|
29546
|
-
return parserCache.get(lang);
|
|
29547
|
-
}
|
|
29548
|
-
await ensureInitialized();
|
|
29549
|
-
const fileName = LANGUAGE_MAP[lang];
|
|
29550
|
-
if (!fileName) {
|
|
29551
|
-
throw new Error(`Unsupported language: ${lang}`);
|
|
29552
|
-
}
|
|
29553
|
-
try {
|
|
29554
|
-
let resourcesDir;
|
|
29555
|
-
if (_dirname.includes("dist") || _dirname.includes("node_modules")) {
|
|
29556
|
-
resourcesDir = path5.resolve(_dirname, "../resources/tree-sitter");
|
|
29557
|
-
} else {
|
|
29558
|
-
resourcesDir = path5.resolve(_dirname, "../../../resources/tree-sitter");
|
|
29559
|
-
}
|
|
29560
|
-
const wasmPath = path5.join(resourcesDir, fileName);
|
|
29561
|
-
const language = await Language.load(wasmPath);
|
|
29562
|
-
const parser = new Parser();
|
|
29563
|
-
parser.setLanguage(language);
|
|
29564
|
-
parserCache.set(lang, parser);
|
|
29565
|
-
return parser;
|
|
29566
|
-
} catch (error) {
|
|
29567
|
-
console.error(`Error loading language ${lang}:`, error);
|
|
29568
|
-
throw new Error(`Failed to load language ${lang}: ${error}`);
|
|
29569
|
-
}
|
|
29570
|
-
};
|
|
29571
|
-
var legacyParserInstance = null;
|
|
29572
|
-
var initParser = async () => {
|
|
29573
|
-
if (legacyParserInstance) return legacyParserInstance;
|
|
29574
|
-
legacyParserInstance = await loadLanguage("bash");
|
|
29575
|
-
return legacyParserInstance;
|
|
29576
|
-
};
|
|
29577
|
-
|
|
29578
29723
|
// src/utils/tree-sitter/parser.ts
|
|
29579
29724
|
var BashParser = class {
|
|
29580
29725
|
/**
|
|
@@ -30523,6 +30668,8 @@ export {
|
|
|
30523
30668
|
grantReadPermissionForOriginalDir,
|
|
30524
30669
|
NotebookEditTool,
|
|
30525
30670
|
FileEditTool,
|
|
30671
|
+
ParserRegistry,
|
|
30672
|
+
loadLanguage,
|
|
30526
30673
|
FileReadTool,
|
|
30527
30674
|
FileWriteTool,
|
|
30528
30675
|
GlobTool,
|
|
@@ -30534,7 +30681,6 @@ export {
|
|
|
30534
30681
|
KillShellTool,
|
|
30535
30682
|
TodoWriteTool,
|
|
30536
30683
|
hasPermissionsToUseTool,
|
|
30537
|
-
loadLanguage,
|
|
30538
30684
|
BashTool,
|
|
30539
30685
|
getCLISyspromptPrefix,
|
|
30540
30686
|
getSystemPrompt,
|