pybao-cli 1.4.89 → 1.4.91
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-XPMCTX6L.js +49 -0
- package/dist/{acp-SMGE3N7N.js → acp-WP36SKSE.js} +30 -30
- package/dist/{agentsValidate-FJNQTZ6L.js → agentsValidate-RQL2SLGC.js} +7 -7
- package/dist/{ask-2XWNVTSB.js → ask-D3IZ5ZRJ.js} +29 -29
- package/dist/{autoUpdater-7PB65YC7.js → autoUpdater-OMUHLOGO.js} +3 -3
- package/dist/{chunk-CSP6P6NO.js → chunk-2NGXOHGX.js} +2 -2
- package/dist/{chunk-YNDZ73R7.js → chunk-35DF6XKC.js} +2 -2
- package/dist/{chunk-3JTP3A2Y.js → chunk-3JJGOOVV.js} +1 -1
- package/dist/{chunk-JJSCNIBA.js → chunk-4IZGIKGU.js} +1 -1
- package/dist/{chunk-LV4FISWZ.js → chunk-5Z6IMMMW.js} +3 -3
- package/dist/{chunk-I72YSEMN.js → chunk-6FUTCMZK.js} +4 -4
- package/dist/{chunk-UNDLA4M4.js → chunk-7KPYOLFD.js} +3 -3
- package/dist/{chunk-A5255NE3.js → chunk-7VNU2ZKH.js} +1 -1
- package/dist/{chunk-67D6QME2.js → chunk-B5AO2OEN.js} +9 -1
- package/dist/chunk-B5AO2OEN.js.map +7 -0
- package/dist/{chunk-THQLFNKQ.js → chunk-B7YI7BZU.js} +3 -3
- package/dist/{chunk-IUXFIASK.js → chunk-BZRGSGVE.js} +3 -3
- package/dist/{chunk-YVW2YZZ3.js → chunk-C2LGKJSR.js} +3 -3
- package/dist/{chunk-KHSTNHZE.js → chunk-CHTGXWNW.js} +4 -4
- package/dist/{chunk-JW3MBSMJ.js → chunk-FNYI3AHB.js} +79 -404
- package/dist/chunk-FNYI3AHB.js.map +7 -0
- package/dist/{chunk-DRHWOS44.js → chunk-FSSXF2YS.js} +1 -1
- package/dist/{chunk-JDMIFTZT.js → chunk-FZAPDUPC.js} +1 -1
- package/dist/{chunk-RLD57RVF.js → chunk-GZ3J3MB7.js} +1 -1
- package/dist/{chunk-NZPUVS6K.js → chunk-IRVS47LS.js} +1 -1
- package/dist/{chunk-5DBEI4U3.js → chunk-KLFTZBHM.js} +2 -2
- package/dist/{chunk-4CTXCXJV.js → chunk-KSWPVLIN.js} +2 -2
- package/dist/{chunk-FYLGTG5A.js → chunk-KXCSPC5I.js} +4 -4
- package/dist/{chunk-YAC4ZESX.js → chunk-L5FMWVFJ.js} +2 -2
- package/dist/{chunk-R2BVICE2.js → chunk-LMF7SSDW.js} +1 -1
- package/dist/{chunk-HVJRX43N.js → chunk-MNVUFKYB.js} +839 -270
- package/dist/chunk-MNVUFKYB.js.map +7 -0
- package/dist/{chunk-UAMS53ZK.js → chunk-OM7XZWUN.js} +2 -2
- package/dist/{chunk-UIGWD3MR.js → chunk-PAW3JPND.js} +1 -1
- package/dist/{chunk-XAABWNGX.js → chunk-U3LLCIIX.js} +4 -4
- package/dist/{chunk-5DKBPIUY.js → chunk-UULWYB2S.js} +2 -2
- package/dist/{chunk-3WX6M33B.js → chunk-W3Z3A6JG.js} +164 -8
- package/dist/chunk-W3Z3A6JG.js.map +7 -0
- package/dist/{chunk-5N4LX65G.js → chunk-XUPHN5RT.js} +3 -3
- package/dist/{chunk-JQBOODVQ.js → chunk-Z7TKBN4K.js} +3 -3
- package/dist/{cli-PTMHC2XV.js → cli-IOYAJ3RP.js} +89 -89
- package/dist/commands-XLJTAJDU.js +53 -0
- package/dist/{config-MCXPTUSG.js → config-QOBUIJ2T.js} +4 -4
- package/dist/{context-ZJZSHKCR.js → context-T72O7CNM.js} +6 -6
- package/dist/{conversationTracker-A33U2LAZ.js → conversationTracker-DGV5IOEO.js} +3 -3
- package/dist/{customCommands-M7HD5SVI.js → customCommands-TB4PW6BZ.js} +4 -4
- package/dist/{env-XWJBXPMS.js → env-EN4O7GDK.js} +2 -2
- package/dist/{file-HSVA6LNE.js → file-GOVYPFCU.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-UGJYESRH.js → llm-VY6QQH5B.js} +30 -30
- package/dist/{llmLazy-QEOEBBKC.js → llmLazy-ZRBSOAI6.js} +1 -1
- package/dist/{loader-R2QFYVHX.js → loader-6F76UNRR.js} +4 -4
- package/dist/{lsp-YN2SPF7O.js → lsp-RE4N652Z.js} +6 -6
- package/dist/{lspAnchor-J4GMFONT.js → lspAnchor-KQ2FF4JY.js} +6 -6
- package/dist/{mcp-O625QZ5R.js → mcp-ZE7PLYMD.js} +7 -7
- package/dist/{mentionProcessor-UPKZXHO4.js → mentionProcessor-7UT4VG43.js} +5 -5
- package/dist/{messages-3EGLQBFT.js → messages-JCHA3R7R.js} +1 -1
- package/dist/{model-7P6UKMPN.js → model-3NZZUFFU.js} +5 -5
- package/dist/{openai-J43QDBDS.js → openai-5MV5ABZF.js} +5 -5
- package/dist/{outputStyles-HANCH32Z.js → outputStyles-2HZOTSRS.js} +4 -4
- package/dist/{pluginRuntime-GQDZD5BX.js → pluginRuntime-R57OZ4VU.js} +6 -6
- package/dist/{pluginValidation-NMBEAEQW.js → pluginValidation-3BCKLZYR.js} +6 -6
- package/dist/prompts-QAJNDKD2.js +55 -0
- package/dist/{pybAgentSessionLoad-F67ZDP5H.js → pybAgentSessionLoad-X4LXVK5R.js} +4 -4
- package/dist/{pybAgentSessionResume-UC66IPGZ.js → pybAgentSessionResume-U5GJDTHH.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-IO42JQAR.js → pybAgentStreamJsonSession-3Z5BYBNJ.js} +1 -1
- package/dist/{pybHooks-RTLJ2AV5.js → pybHooks-6272ZZXC.js} +4 -4
- package/dist/query-Y66ZKOAY.js +57 -0
- package/dist/{registry-4NUGUWGX.js → registry-4E7E4FW7.js} +5 -5
- package/dist/{ripgrep-GXECIJXM.js → ripgrep-QSJWXAK7.js} +13 -5
- package/dist/{skillMarketplace-VM4XNPW4.js → skillMarketplace-Z3ZMMNEG.js} +3 -3
- package/dist/{state-QPNSGH4C.js → state-35W4BKTE.js} +2 -2
- package/dist/{theme-ME74IEH2.js → theme-YUI56RAR.js} +5 -5
- package/dist/{toolPermissionSettings-4DJ7GGUG.js → toolPermissionSettings-RULNIKWU.js} +6 -6
- package/dist/tools-VGH43OZ7.js +54 -0
- package/dist/{userInput-BEZBVV52.js → userInput-UNVIW76K.js} +31 -31
- package/package.json +9 -1
- package/resources/ripgrep/COPYING +3 -0
- package/resources/ripgrep/arm64-darwin/rg +0 -0
- package/resources/ripgrep/arm64-linux/rg +0 -0
- package/resources/ripgrep/manifest.json +32 -0
- package/resources/ripgrep/x64-darwin/rg +0 -0
- package/resources/ripgrep/x64-linux/rg +0 -0
- package/resources/ripgrep/x64-win32/rg.exe +0 -0
- package/resources/tree-sitter/manifest.json +14 -0
- package/scripts/postinstall.js +23 -0
- package/dist/REPL-VRZRANK3.js +0 -49
- package/dist/chunk-3WX6M33B.js.map +0 -7
- package/dist/chunk-67D6QME2.js.map +0 -7
- package/dist/chunk-HVJRX43N.js.map +0 -7
- package/dist/chunk-JW3MBSMJ.js.map +0 -7
- package/dist/commands-52E2E77C.js +0 -53
- package/dist/prompts-OFPZUEBC.js +0 -55
- package/dist/query-KHETENT7.js +0 -57
- package/dist/tools-7V7X7CNV.js +0 -54
- /package/dist/{REPL-VRZRANK3.js.map → REPL-XPMCTX6L.js.map} +0 -0
- /package/dist/{acp-SMGE3N7N.js.map → acp-WP36SKSE.js.map} +0 -0
- /package/dist/{agentsValidate-FJNQTZ6L.js.map → agentsValidate-RQL2SLGC.js.map} +0 -0
- /package/dist/{ask-2XWNVTSB.js.map → ask-D3IZ5ZRJ.js.map} +0 -0
- /package/dist/{autoUpdater-7PB65YC7.js.map → autoUpdater-OMUHLOGO.js.map} +0 -0
- /package/dist/{chunk-CSP6P6NO.js.map → chunk-2NGXOHGX.js.map} +0 -0
- /package/dist/{chunk-YNDZ73R7.js.map → chunk-35DF6XKC.js.map} +0 -0
- /package/dist/{chunk-3JTP3A2Y.js.map → chunk-3JJGOOVV.js.map} +0 -0
- /package/dist/{chunk-JJSCNIBA.js.map → chunk-4IZGIKGU.js.map} +0 -0
- /package/dist/{chunk-LV4FISWZ.js.map → chunk-5Z6IMMMW.js.map} +0 -0
- /package/dist/{chunk-I72YSEMN.js.map → chunk-6FUTCMZK.js.map} +0 -0
- /package/dist/{chunk-UNDLA4M4.js.map → chunk-7KPYOLFD.js.map} +0 -0
- /package/dist/{chunk-A5255NE3.js.map → chunk-7VNU2ZKH.js.map} +0 -0
- /package/dist/{chunk-THQLFNKQ.js.map → chunk-B7YI7BZU.js.map} +0 -0
- /package/dist/{chunk-IUXFIASK.js.map → chunk-BZRGSGVE.js.map} +0 -0
- /package/dist/{chunk-YVW2YZZ3.js.map → chunk-C2LGKJSR.js.map} +0 -0
- /package/dist/{chunk-KHSTNHZE.js.map → chunk-CHTGXWNW.js.map} +0 -0
- /package/dist/{chunk-DRHWOS44.js.map → chunk-FSSXF2YS.js.map} +0 -0
- /package/dist/{chunk-JDMIFTZT.js.map → chunk-FZAPDUPC.js.map} +0 -0
- /package/dist/{chunk-RLD57RVF.js.map → chunk-GZ3J3MB7.js.map} +0 -0
- /package/dist/{chunk-NZPUVS6K.js.map → chunk-IRVS47LS.js.map} +0 -0
- /package/dist/{chunk-5DBEI4U3.js.map → chunk-KLFTZBHM.js.map} +0 -0
- /package/dist/{chunk-4CTXCXJV.js.map → chunk-KSWPVLIN.js.map} +0 -0
- /package/dist/{chunk-FYLGTG5A.js.map → chunk-KXCSPC5I.js.map} +0 -0
- /package/dist/{chunk-YAC4ZESX.js.map → chunk-L5FMWVFJ.js.map} +0 -0
- /package/dist/{chunk-R2BVICE2.js.map → chunk-LMF7SSDW.js.map} +0 -0
- /package/dist/{chunk-UAMS53ZK.js.map → chunk-OM7XZWUN.js.map} +0 -0
- /package/dist/{chunk-UIGWD3MR.js.map → chunk-PAW3JPND.js.map} +0 -0
- /package/dist/{chunk-XAABWNGX.js.map → chunk-U3LLCIIX.js.map} +0 -0
- /package/dist/{chunk-5DKBPIUY.js.map → chunk-UULWYB2S.js.map} +0 -0
- /package/dist/{chunk-5N4LX65G.js.map → chunk-XUPHN5RT.js.map} +0 -0
- /package/dist/{chunk-JQBOODVQ.js.map → chunk-Z7TKBN4K.js.map} +0 -0
- /package/dist/{cli-PTMHC2XV.js.map → cli-IOYAJ3RP.js.map} +0 -0
- /package/dist/{commands-52E2E77C.js.map → commands-XLJTAJDU.js.map} +0 -0
- /package/dist/{config-MCXPTUSG.js.map → config-QOBUIJ2T.js.map} +0 -0
- /package/dist/{context-ZJZSHKCR.js.map → context-T72O7CNM.js.map} +0 -0
- /package/dist/{conversationTracker-A33U2LAZ.js.map → conversationTracker-DGV5IOEO.js.map} +0 -0
- /package/dist/{customCommands-M7HD5SVI.js.map → customCommands-TB4PW6BZ.js.map} +0 -0
- /package/dist/{env-XWJBXPMS.js.map → env-EN4O7GDK.js.map} +0 -0
- /package/dist/{file-HSVA6LNE.js.map → file-GOVYPFCU.js.map} +0 -0
- /package/dist/{llm-UGJYESRH.js.map → llm-VY6QQH5B.js.map} +0 -0
- /package/dist/{llmLazy-QEOEBBKC.js.map → llmLazy-ZRBSOAI6.js.map} +0 -0
- /package/dist/{loader-R2QFYVHX.js.map → loader-6F76UNRR.js.map} +0 -0
- /package/dist/{lsp-YN2SPF7O.js.map → lsp-RE4N652Z.js.map} +0 -0
- /package/dist/{lspAnchor-J4GMFONT.js.map → lspAnchor-KQ2FF4JY.js.map} +0 -0
- /package/dist/{mcp-O625QZ5R.js.map → mcp-ZE7PLYMD.js.map} +0 -0
- /package/dist/{mentionProcessor-UPKZXHO4.js.map → mentionProcessor-7UT4VG43.js.map} +0 -0
- /package/dist/{messages-3EGLQBFT.js.map → messages-JCHA3R7R.js.map} +0 -0
- /package/dist/{model-7P6UKMPN.js.map → model-3NZZUFFU.js.map} +0 -0
- /package/dist/{openai-J43QDBDS.js.map → openai-5MV5ABZF.js.map} +0 -0
- /package/dist/{outputStyles-HANCH32Z.js.map → outputStyles-2HZOTSRS.js.map} +0 -0
- /package/dist/{pluginRuntime-GQDZD5BX.js.map → pluginRuntime-R57OZ4VU.js.map} +0 -0
- /package/dist/{pluginValidation-NMBEAEQW.js.map → pluginValidation-3BCKLZYR.js.map} +0 -0
- /package/dist/{prompts-OFPZUEBC.js.map → prompts-QAJNDKD2.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-F67ZDP5H.js.map → pybAgentSessionLoad-X4LXVK5R.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-UC66IPGZ.js.map → pybAgentSessionResume-U5GJDTHH.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-IO42JQAR.js.map → pybAgentStreamJsonSession-3Z5BYBNJ.js.map} +0 -0
- /package/dist/{pybHooks-RTLJ2AV5.js.map → pybHooks-6272ZZXC.js.map} +0 -0
- /package/dist/{query-KHETENT7.js.map → query-Y66ZKOAY.js.map} +0 -0
- /package/dist/{registry-4NUGUWGX.js.map → registry-4E7E4FW7.js.map} +0 -0
- /package/dist/{ripgrep-GXECIJXM.js.map → ripgrep-QSJWXAK7.js.map} +0 -0
- /package/dist/{skillMarketplace-VM4XNPW4.js.map → skillMarketplace-Z3ZMMNEG.js.map} +0 -0
- /package/dist/{state-QPNSGH4C.js.map → state-35W4BKTE.js.map} +0 -0
- /package/dist/{theme-ME74IEH2.js.map → theme-YUI56RAR.js.map} +0 -0
- /package/dist/{toolPermissionSettings-4DJ7GGUG.js.map → toolPermissionSettings-RULNIKWU.js.map} +0 -0
- /package/dist/{tools-7V7X7CNV.js.map → tools-VGH43OZ7.js.map} +0 -0
- /package/dist/{userInput-BEZBVV52.js.map → userInput-UNVIW76K.js.map} +0 -0
|
@@ -2,11 +2,11 @@ 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-3JJGOOVV.js";
|
|
6
6
|
import {
|
|
7
7
|
formatValidationResult,
|
|
8
8
|
validatePluginOrMarketplacePath
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Z7TKBN4K.js";
|
|
10
10
|
import {
|
|
11
11
|
ConversationTracker,
|
|
12
12
|
appendFinishState,
|
|
@@ -14,18 +14,18 @@ import {
|
|
|
14
14
|
getConversationTrackerForContext,
|
|
15
15
|
isFinishComplete,
|
|
16
16
|
mapFinishReason
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FZAPDUPC.js";
|
|
18
18
|
import {
|
|
19
19
|
beginReplSessionScope
|
|
20
20
|
} from "./chunk-F4AXICO7.js";
|
|
21
21
|
import {
|
|
22
22
|
loadPybAgentSessionMessages
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4IZGIKGU.js";
|
|
24
24
|
import {
|
|
25
25
|
appendSessionCustomTitleRecord,
|
|
26
26
|
appendSessionJsonlFromMessage,
|
|
27
27
|
appendSessionTagRecord
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-KSWPVLIN.js";
|
|
29
29
|
import {
|
|
30
30
|
drainHookSystemPromptAdditions,
|
|
31
31
|
getHookTranscriptPath,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
runStopHooks,
|
|
38
38
|
runUserPromptSubmitHooks,
|
|
39
39
|
updateHookTranscriptForMessages
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-5Z6IMMMW.js";
|
|
41
41
|
import {
|
|
42
42
|
DEFAULT_OUTPUT_STYLE,
|
|
43
43
|
getAvailableOutputStyles,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
getOutputStyleSystemPromptAdditions,
|
|
47
47
|
resolveOutputStyleName,
|
|
48
48
|
setCurrentOutputStyle
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-2NGXOHGX.js";
|
|
50
50
|
import {
|
|
51
51
|
fetchCustomModels,
|
|
52
52
|
getModelFeatures
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-UULWYB2S.js";
|
|
54
54
|
import {
|
|
55
55
|
getSessionState
|
|
56
56
|
} from "./chunk-XKYHFZEC.js";
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
queryLLM,
|
|
59
59
|
queryQuick,
|
|
60
60
|
verifyApiKey
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-U3LLCIIX.js";
|
|
62
62
|
import {
|
|
63
63
|
DEFAULT_TIMEOUT_MS,
|
|
64
64
|
FallbackToolUseRejectedMessage,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
listMCPServers,
|
|
73
73
|
loadMergedSettings,
|
|
74
74
|
normalizeSandboxRuntimeConfigFromSettings
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-CHTGXWNW.js";
|
|
76
76
|
import {
|
|
77
77
|
addMarketplace,
|
|
78
78
|
disableSkillPlugin,
|
|
@@ -85,11 +85,11 @@ import {
|
|
|
85
85
|
refreshMarketplaceAsync,
|
|
86
86
|
removeMarketplace,
|
|
87
87
|
uninstallSkillPlugin
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-IRVS47LS.js";
|
|
89
89
|
import {
|
|
90
90
|
loadToolPermissionContextFromDisk,
|
|
91
91
|
persistToolPermissionUpdateToDisk
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-B7YI7BZU.js";
|
|
93
93
|
import {
|
|
94
94
|
applyToolPermissionContextUpdate,
|
|
95
95
|
applyToolPermissionContextUpdates,
|
|
@@ -100,13 +100,13 @@ import {
|
|
|
100
100
|
generateSystemReminders,
|
|
101
101
|
resetReminderSession,
|
|
102
102
|
systemReminderService
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-L5FMWVFJ.js";
|
|
104
104
|
import {
|
|
105
105
|
clearAgentCache,
|
|
106
106
|
getActiveAgents,
|
|
107
107
|
getAgentByType,
|
|
108
108
|
getAllAgents
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-KLFTZBHM.js";
|
|
110
110
|
import {
|
|
111
111
|
API_ERROR_MESSAGE_PREFIX,
|
|
112
112
|
CANCEL_MESSAGE,
|
|
@@ -137,7 +137,7 @@ import {
|
|
|
137
137
|
processUserInput,
|
|
138
138
|
reorderMessages,
|
|
139
139
|
stripSystemMessages
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-7VNU2ZKH.js";
|
|
141
141
|
import {
|
|
142
142
|
getRequestStatus,
|
|
143
143
|
setRequestStatus,
|
|
@@ -167,7 +167,7 @@ import {
|
|
|
167
167
|
normalizeFilePath,
|
|
168
168
|
readTextContent,
|
|
169
169
|
writeTextContent
|
|
170
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-OM7XZWUN.js";
|
|
171
171
|
import {
|
|
172
172
|
parseBlockEdits
|
|
173
173
|
} from "./chunk-QWIBSCDN.js";
|
|
@@ -177,18 +177,18 @@ import {
|
|
|
177
177
|
ParserRegistry,
|
|
178
178
|
initParser,
|
|
179
179
|
loadLanguage
|
|
180
|
-
} from "./chunk-
|
|
180
|
+
} from "./chunk-6FUTCMZK.js";
|
|
181
181
|
import {
|
|
182
182
|
getSettingsFileCandidates,
|
|
183
183
|
loadSettingsWithLegacyFallback,
|
|
184
184
|
readSettingsFile
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-GZ3J3MB7.js";
|
|
186
186
|
import {
|
|
187
187
|
getCustomCommandDirectories,
|
|
188
188
|
hasCustomCommands,
|
|
189
189
|
loadCustomCommands,
|
|
190
190
|
reloadCustomCommands
|
|
191
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-35DF6XKC.js";
|
|
192
192
|
import {
|
|
193
193
|
getSessionPlugins
|
|
194
194
|
} from "./chunk-BJSWTHRM.js";
|
|
@@ -196,7 +196,7 @@ import {
|
|
|
196
196
|
ModelManager,
|
|
197
197
|
getModelManager,
|
|
198
198
|
isDefaultSlowAndCapableModel
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-7KPYOLFD.js";
|
|
200
200
|
import {
|
|
201
201
|
getCodeStyle,
|
|
202
202
|
getContext,
|
|
@@ -204,13 +204,16 @@ import {
|
|
|
204
204
|
getIsGit,
|
|
205
205
|
getProjectDocs,
|
|
206
206
|
getProjectStructureStatisticsBlock
|
|
207
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-KXCSPC5I.js";
|
|
208
208
|
import {
|
|
209
|
+
getRipgrepPath,
|
|
210
|
+
getRipgrepPolicyMode,
|
|
211
|
+
resolveRipgrepPolicy,
|
|
209
212
|
ripGrep
|
|
210
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-W3Z3A6JG.js";
|
|
211
214
|
import {
|
|
212
215
|
getTheme
|
|
213
|
-
} from "./chunk-
|
|
216
|
+
} from "./chunk-LMF7SSDW.js";
|
|
214
217
|
import {
|
|
215
218
|
DEFAULT_GLOBAL_CONFIG,
|
|
216
219
|
enableConfigs,
|
|
@@ -223,7 +226,7 @@ import {
|
|
|
223
226
|
saveGlobalConfig,
|
|
224
227
|
setAllPointersToModel,
|
|
225
228
|
setModelPointer
|
|
226
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-XUPHN5RT.js";
|
|
227
230
|
import {
|
|
228
231
|
AbortError
|
|
229
232
|
} from "./chunk-RQVLBMP7.js";
|
|
@@ -232,7 +235,7 @@ import {
|
|
|
232
235
|
getCurrentRequest,
|
|
233
236
|
logUserFriendly,
|
|
234
237
|
markPhase
|
|
235
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-PAW3JPND.js";
|
|
236
239
|
import {
|
|
237
240
|
ASCII_LOGO,
|
|
238
241
|
BunShell,
|
|
@@ -272,16 +275,16 @@ import {
|
|
|
272
275
|
setCwd,
|
|
273
276
|
shouldApplyToolOutputTruncation,
|
|
274
277
|
truncateToolOutput
|
|
275
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-FSSXF2YS.js";
|
|
276
279
|
import {
|
|
277
280
|
MACRO
|
|
278
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-B5AO2OEN.js";
|
|
279
282
|
import {
|
|
280
283
|
__export
|
|
281
284
|
} from "./chunk-I3J4JYES.js";
|
|
282
285
|
|
|
283
286
|
// src/tools/system/BashTool/BashTool.tsx
|
|
284
|
-
import { statSync as
|
|
287
|
+
import { statSync as statSync14 } from "fs";
|
|
285
288
|
import { EOL as EOL3 } from "os";
|
|
286
289
|
import { isAbsolute as isAbsolute8, relative as relative12, resolve as resolve11 } from "path";
|
|
287
290
|
import * as React106 from "react";
|
|
@@ -456,7 +459,7 @@ var getCommandSubcommandPrefix = memoize(
|
|
|
456
459
|
var getCommandPrefix = memoize(
|
|
457
460
|
async (command4, abortSignal) => {
|
|
458
461
|
const { systemPrompt, userPrompt } = buildBashCommandPrefixDetectionPrompt(command4);
|
|
459
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-
|
|
462
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryQuick: queryQuick2 } = await import("./llm-VY6QQH5B.js");
|
|
460
463
|
const response = await queryQuick2({
|
|
461
464
|
systemPrompt,
|
|
462
465
|
userPrompt,
|
|
@@ -939,9 +942,9 @@ async function startHttpProxy() {
|
|
|
939
942
|
writeHttpErrorResponse(clientSocket, "502 Bad Gateway");
|
|
940
943
|
});
|
|
941
944
|
upstream.once("connect", () => {
|
|
942
|
-
const
|
|
945
|
+
const path6 = `${targetUrl.pathname}${targetUrl.search}`;
|
|
943
946
|
try {
|
|
944
|
-
upstream.write(`${method} ${
|
|
947
|
+
upstream.write(`${method} ${path6} ${version}\r
|
|
945
948
|
`);
|
|
946
949
|
for (const [k, v] of Object.entries(headers)) {
|
|
947
950
|
upstream.write(`${k}: ${v}\r
|
|
@@ -4258,7 +4261,7 @@ function formatParseError(error) {
|
|
|
4258
4261
|
return error instanceof Error ? error.message : String(error);
|
|
4259
4262
|
}
|
|
4260
4263
|
async function defaultGateQuery(args) {
|
|
4261
|
-
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-
|
|
4264
|
+
const { API_ERROR_MESSAGE_PREFIX: API_ERROR_MESSAGE_PREFIX2, queryLLM: queryLLM2 } = await import("./llm-VY6QQH5B.js");
|
|
4262
4265
|
const queryLLMFn = args.queryLLMOverride ?? queryLLM2;
|
|
4263
4266
|
const messages = [
|
|
4264
4267
|
{
|
|
@@ -4337,7 +4340,7 @@ function writeGateFailureDump(args) {
|
|
|
4337
4340
|
const dir = join2(CACHE_PATHS.errors(), "bash-llm-gate");
|
|
4338
4341
|
mkdirSync(dir, { recursive: true });
|
|
4339
4342
|
const filename = `${dateToFilename(/* @__PURE__ */ new Date())}-${randomUUID()}.txt`;
|
|
4340
|
-
const
|
|
4343
|
+
const path6 = join2(dir, filename);
|
|
4341
4344
|
const body = [
|
|
4342
4345
|
"=== Bash LLM gate failure ===",
|
|
4343
4346
|
"",
|
|
@@ -4364,7 +4367,7 @@ function writeGateFailureDump(args) {
|
|
|
4364
4367
|
args.output ?? "",
|
|
4365
4368
|
""
|
|
4366
4369
|
].filter(Boolean).join("\n");
|
|
4367
|
-
writeFileSync(
|
|
4370
|
+
writeFileSync(path6, body, "utf8");
|
|
4368
4371
|
} catch {
|
|
4369
4372
|
}
|
|
4370
4373
|
}
|
|
@@ -6049,8 +6052,8 @@ var FileFreshnessService = class {
|
|
|
6049
6052
|
return this.state.readTimestamps.has(filePath);
|
|
6050
6053
|
}
|
|
6051
6054
|
getImportantFiles(maxFiles = 5) {
|
|
6052
|
-
return Array.from(this.state.readTimestamps.entries()).map(([
|
|
6053
|
-
path:
|
|
6055
|
+
return Array.from(this.state.readTimestamps.entries()).map(([path6, info]) => ({
|
|
6056
|
+
path: path6,
|
|
6054
6057
|
timestamp: info.lastRead,
|
|
6055
6058
|
size: info.size
|
|
6056
6059
|
})).filter((file) => this.isValidForRecovery(file.path)).sort((a, b) => b.timestamp - a.timestamp).slice(0, maxFiles);
|
|
@@ -6108,8 +6111,8 @@ import { dirname, isAbsolute, resolve, relative as relative2 } from "path";
|
|
|
6108
6111
|
import { statSync as statSync3 } from "fs";
|
|
6109
6112
|
var readFileAllowedDirectories = /* @__PURE__ */ new Set();
|
|
6110
6113
|
var writeFileAllowedDirectories = /* @__PURE__ */ new Set();
|
|
6111
|
-
function toAbsolutePath(
|
|
6112
|
-
const abs = isAbsolute(
|
|
6114
|
+
function toAbsolutePath(path6) {
|
|
6115
|
+
const abs = isAbsolute(path6) ? resolve(path6) : resolve(getCwd(), path6);
|
|
6113
6116
|
return normalizeForCompare(abs);
|
|
6114
6117
|
}
|
|
6115
6118
|
function normalizeForCompare(p) {
|
|
@@ -6123,13 +6126,13 @@ function isSubpath(base, target) {
|
|
|
6123
6126
|
if (isAbsolute(rel)) return false;
|
|
6124
6127
|
return true;
|
|
6125
6128
|
}
|
|
6126
|
-
function pathToPermissionDirectory(
|
|
6129
|
+
function pathToPermissionDirectory(path6) {
|
|
6127
6130
|
try {
|
|
6128
|
-
const stats = statSync3(
|
|
6129
|
-
if (stats.isDirectory()) return
|
|
6131
|
+
const stats = statSync3(path6);
|
|
6132
|
+
if (stats.isDirectory()) return path6;
|
|
6130
6133
|
} catch {
|
|
6131
6134
|
}
|
|
6132
|
-
return dirname(
|
|
6135
|
+
return dirname(path6);
|
|
6133
6136
|
}
|
|
6134
6137
|
function hasReadPermission(directory) {
|
|
6135
6138
|
if (isMainPlanFilePathForActiveConversation(directory)) return true;
|
|
@@ -6169,8 +6172,8 @@ function saveWritePermission(directory) {
|
|
|
6169
6172
|
}
|
|
6170
6173
|
writeFileAllowedDirectories.add(absolutePath);
|
|
6171
6174
|
}
|
|
6172
|
-
function grantWritePermissionForPath(
|
|
6173
|
-
const absolutePath = toAbsolutePath(
|
|
6175
|
+
function grantWritePermissionForPath(path6) {
|
|
6176
|
+
const absolutePath = toAbsolutePath(path6);
|
|
6174
6177
|
saveWritePermission(pathToPermissionDirectory(absolutePath));
|
|
6175
6178
|
}
|
|
6176
6179
|
|
|
@@ -6655,7 +6658,7 @@ var FileEditTool = {
|
|
|
6655
6658
|
const originalFileContent = currentFileContent;
|
|
6656
6659
|
let totalPatch = [];
|
|
6657
6660
|
const { SmartEdit } = await import("./smart-edit-AWHJDSU6.js");
|
|
6658
|
-
const { findLspAnchor } = await import("./lspAnchor-
|
|
6661
|
+
const { findLspAnchor } = await import("./lspAnchor-KQ2FF4JY.js");
|
|
6659
6662
|
for (const op of editOperations) {
|
|
6660
6663
|
const normalizedSearch = normalizeLineEndings(op.search);
|
|
6661
6664
|
const normalizedReplace = normalizeLineEndings(op.replace);
|
|
@@ -6756,13 +6759,24 @@ Suggestion: fix errors or rerun with verify=false.`);
|
|
|
6756
6759
|
};
|
|
6757
6760
|
|
|
6758
6761
|
// src/tools/filesystem/FileReadTool/FileReadTool.tsx
|
|
6759
|
-
import { statSync as
|
|
6762
|
+
import { statSync as statSync7 } from "fs";
|
|
6760
6763
|
import { Box as Box12, Text as Text13 } from "ink";
|
|
6761
|
-
import * as
|
|
6764
|
+
import * as path5 from "node:path";
|
|
6762
6765
|
import { extname as extname4, relative as relative6 } from "node:path";
|
|
6763
6766
|
import * as React13 from "react";
|
|
6764
6767
|
import { z as z4 } from "zod";
|
|
6765
6768
|
|
|
6769
|
+
// src/services/telemetry/eventBus.ts
|
|
6770
|
+
var listeners2 = /* @__PURE__ */ new Map();
|
|
6771
|
+
function registerTelemetryListener(listenerId, listener) {
|
|
6772
|
+
listeners2.set(listenerId, listener);
|
|
6773
|
+
}
|
|
6774
|
+
function emitTelemetryEvent(event) {
|
|
6775
|
+
for (const listener of listeners2.values()) {
|
|
6776
|
+
listener(event);
|
|
6777
|
+
}
|
|
6778
|
+
}
|
|
6779
|
+
|
|
6766
6780
|
// src/tools/filesystem/FileReadTool/prompt.ts
|
|
6767
6781
|
var MAX_LINES_TO_READ = 2e3;
|
|
6768
6782
|
var MAX_LINE_LENGTH = 2e3;
|
|
@@ -7265,6 +7279,165 @@ var SmartTruncator = class _SmartTruncator {
|
|
|
7265
7279
|
}
|
|
7266
7280
|
};
|
|
7267
7281
|
|
|
7282
|
+
// src/services/stability/runtimeAssetHealth/checks/treeSitter.ts
|
|
7283
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync as statSync6 } from "node:fs";
|
|
7284
|
+
import { createHash } from "node:crypto";
|
|
7285
|
+
import path4 from "node:path";
|
|
7286
|
+
import { fileURLToPath } from "node:url";
|
|
7287
|
+
function getDirname() {
|
|
7288
|
+
try {
|
|
7289
|
+
return __dirname;
|
|
7290
|
+
} catch {
|
|
7291
|
+
return path4.dirname(fileURLToPath(import.meta.url));
|
|
7292
|
+
}
|
|
7293
|
+
}
|
|
7294
|
+
function resolveTreeSitterResourceDir() {
|
|
7295
|
+
const envDir = process.env.PYB_RESOURCE_DIR?.trim();
|
|
7296
|
+
if (envDir) return envDir;
|
|
7297
|
+
const dirname11 = getDirname();
|
|
7298
|
+
if (dirname11.includes("dist") || dirname11.includes("node_modules")) {
|
|
7299
|
+
return path4.resolve(dirname11, "../../../../resources/tree-sitter");
|
|
7300
|
+
}
|
|
7301
|
+
return path4.resolve(dirname11, "../../../../../resources/tree-sitter");
|
|
7302
|
+
}
|
|
7303
|
+
var REQUIRED_TREE_SITTER_FILES = [
|
|
7304
|
+
"tree-sitter.wasm",
|
|
7305
|
+
"tree-sitter-typescript.wasm",
|
|
7306
|
+
"tree-sitter-bash.wasm"
|
|
7307
|
+
];
|
|
7308
|
+
function isTreeSitterVerifyEnabled() {
|
|
7309
|
+
const raw = process.env.PYB_TREE_SITTER_VERIFY?.trim().toLowerCase();
|
|
7310
|
+
return raw === "1" || raw === "true" || raw === "yes";
|
|
7311
|
+
}
|
|
7312
|
+
function verifyTreeSitterManifestIntegrity(input) {
|
|
7313
|
+
if (!input.verifyEnabled) {
|
|
7314
|
+
return;
|
|
7315
|
+
}
|
|
7316
|
+
const manifestPath = path4.join(input.resourcesDir, "manifest.json");
|
|
7317
|
+
const hasExplicitResourceDir = Boolean(process.env.PYB_RESOURCE_DIR?.trim());
|
|
7318
|
+
if (!existsSync5(manifestPath)) {
|
|
7319
|
+
if (hasExplicitResourceDir) {
|
|
7320
|
+
throw new Error(
|
|
7321
|
+
`resource path drift: PYB_RESOURCE_DIR points to directory without manifest: ${input.resourcesDir}`
|
|
7322
|
+
);
|
|
7323
|
+
}
|
|
7324
|
+
throw new Error(`tree-sitter manifest missing: ${manifestPath}`);
|
|
7325
|
+
}
|
|
7326
|
+
const manifestRaw = readFileSync3(manifestPath, "utf8");
|
|
7327
|
+
const manifest = JSON.parse(manifestRaw);
|
|
7328
|
+
if (!manifest.files) {
|
|
7329
|
+
throw new Error(`tree-sitter manifest invalid: files field missing`);
|
|
7330
|
+
}
|
|
7331
|
+
for (const fileName of REQUIRED_TREE_SITTER_FILES) {
|
|
7332
|
+
const filePath = path4.join(input.resourcesDir, fileName);
|
|
7333
|
+
const expectedSha256 = manifest.files[fileName]?.sha256;
|
|
7334
|
+
if (!expectedSha256) {
|
|
7335
|
+
throw new Error(`tree-sitter manifest invalid: checksum missing for ${fileName}`);
|
|
7336
|
+
}
|
|
7337
|
+
const actualSha256 = createHash("sha256").update(readFileSync3(filePath)).digest("hex");
|
|
7338
|
+
if (actualSha256 !== expectedSha256) {
|
|
7339
|
+
throw new Error(
|
|
7340
|
+
`tree-sitter checksum mismatch for ${fileName}: expected ${expectedSha256}, got ${actualSha256}`
|
|
7341
|
+
);
|
|
7342
|
+
}
|
|
7343
|
+
}
|
|
7344
|
+
}
|
|
7345
|
+
async function checkTreeSitterCoreLoadable() {
|
|
7346
|
+
const resourcesDir = resolveTreeSitterResourceDir();
|
|
7347
|
+
verifyTreeSitterManifestIntegrity({
|
|
7348
|
+
resourcesDir,
|
|
7349
|
+
verifyEnabled: isTreeSitterVerifyEnabled()
|
|
7350
|
+
});
|
|
7351
|
+
const corePath = path4.join(resourcesDir, "tree-sitter.wasm");
|
|
7352
|
+
const stat2 = statSync6(corePath);
|
|
7353
|
+
if (!stat2.isFile() || stat2.size <= 0) {
|
|
7354
|
+
throw new Error(`tree-sitter core wasm is missing or empty: ${corePath}`);
|
|
7355
|
+
}
|
|
7356
|
+
const { Parser } = await import("web-tree-sitter");
|
|
7357
|
+
await Parser.init({
|
|
7358
|
+
locateFile: () => corePath
|
|
7359
|
+
});
|
|
7360
|
+
}
|
|
7361
|
+
async function checkTreeSitterGrammarLoadable(lang) {
|
|
7362
|
+
emitTelemetryEvent({
|
|
7363
|
+
channel: "runtime_assets",
|
|
7364
|
+
phase: "TREE_SITTER_LANGUAGE_LOAD",
|
|
7365
|
+
timestamp: Date.now(),
|
|
7366
|
+
data: {
|
|
7367
|
+
lang,
|
|
7368
|
+
stage: "before",
|
|
7369
|
+
status: "start"
|
|
7370
|
+
}
|
|
7371
|
+
});
|
|
7372
|
+
try {
|
|
7373
|
+
await loadLanguage(lang);
|
|
7374
|
+
emitTelemetryEvent({
|
|
7375
|
+
channel: "runtime_assets",
|
|
7376
|
+
phase: "TREE_SITTER_LANGUAGE_LOAD",
|
|
7377
|
+
timestamp: Date.now(),
|
|
7378
|
+
data: {
|
|
7379
|
+
lang,
|
|
7380
|
+
stage: "after",
|
|
7381
|
+
status: "ok"
|
|
7382
|
+
}
|
|
7383
|
+
});
|
|
7384
|
+
} catch (error) {
|
|
7385
|
+
emitTelemetryEvent({
|
|
7386
|
+
channel: "runtime_assets",
|
|
7387
|
+
phase: "TREE_SITTER_LANGUAGE_LOAD",
|
|
7388
|
+
timestamp: Date.now(),
|
|
7389
|
+
data: {
|
|
7390
|
+
lang,
|
|
7391
|
+
stage: "error",
|
|
7392
|
+
status: "error",
|
|
7393
|
+
message: String(error instanceof Error ? error.message : error)
|
|
7394
|
+
}
|
|
7395
|
+
});
|
|
7396
|
+
throw error;
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
function classifyTreeSitterHealthError(error) {
|
|
7400
|
+
const message = String(error ?? "").toLowerCase();
|
|
7401
|
+
if ((message.includes("checksum") || message.includes("sha256")) && message.includes("mismatch")) {
|
|
7402
|
+
return "TS_CHECKSUM_MISMATCH";
|
|
7403
|
+
}
|
|
7404
|
+
if (message.includes("manifest") && message.includes("tree-sitter")) {
|
|
7405
|
+
return "TS_CHECKSUM_MISMATCH";
|
|
7406
|
+
}
|
|
7407
|
+
if (message.includes("resource path drift") || message.includes("pyb_resource_dir") && (message.includes("stale") || message.includes("drift"))) {
|
|
7408
|
+
return "TS_RESOURCE_PATH_DRIFT";
|
|
7409
|
+
}
|
|
7410
|
+
if (message.includes("incompatible language version") || message.includes("compatibility range")) {
|
|
7411
|
+
return "TS_VERSION_INCOMPATIBLE";
|
|
7412
|
+
}
|
|
7413
|
+
if (message.includes("tree-sitter.wasm") && (message.includes("enoent") || message.includes("missing"))) {
|
|
7414
|
+
return "TS_WASM_MISSING";
|
|
7415
|
+
}
|
|
7416
|
+
if (message.includes("tree-sitter-") && message.includes(".wasm")) {
|
|
7417
|
+
return "TS_GRAMMAR_MISSING";
|
|
7418
|
+
}
|
|
7419
|
+
if (message.includes("enoent") && message.includes("wasm")) {
|
|
7420
|
+
return "TS_GRAMMAR_MISSING";
|
|
7421
|
+
}
|
|
7422
|
+
return "TS_LOAD_UNKNOWN";
|
|
7423
|
+
}
|
|
7424
|
+
|
|
7425
|
+
// src/services/stability/runtimeAssetHealth/fallback.ts
|
|
7426
|
+
function toSmartTruncationFallbackEvent(input) {
|
|
7427
|
+
const code = classifyTreeSitterHealthError(input.error);
|
|
7428
|
+
const message = String(input.error instanceof Error ? input.error.message : input.error);
|
|
7429
|
+
return {
|
|
7430
|
+
channel: "runtime_assets",
|
|
7431
|
+
phase: "TREE_SITTER_SMART_TRUNCATION_FALLBACK",
|
|
7432
|
+
timestamp: input.timestamp ?? Date.now(),
|
|
7433
|
+
data: {
|
|
7434
|
+
code,
|
|
7435
|
+
filePath: input.filePath,
|
|
7436
|
+
message
|
|
7437
|
+
}
|
|
7438
|
+
};
|
|
7439
|
+
}
|
|
7440
|
+
|
|
7268
7441
|
// src/tools/filesystem/FileReadTool/FileReadTool.tsx
|
|
7269
7442
|
var MAX_LINES_TO_RENDER = 5;
|
|
7270
7443
|
var MAX_LINE_LENGTH2 = 2e3;
|
|
@@ -7448,7 +7621,7 @@ var FileReadTool = {
|
|
|
7448
7621
|
message
|
|
7449
7622
|
};
|
|
7450
7623
|
}
|
|
7451
|
-
const ext =
|
|
7624
|
+
const ext = path5.extname(fullFilePath).toLowerCase();
|
|
7452
7625
|
const fileSize = fileCheck.stats?.size ?? 0;
|
|
7453
7626
|
if (BINARY_EXTENSIONS.has(ext)) {
|
|
7454
7627
|
return {
|
|
@@ -7476,7 +7649,7 @@ var FileReadTool = {
|
|
|
7476
7649
|
return { result: true };
|
|
7477
7650
|
},
|
|
7478
7651
|
async *call({ file_path, offset = 1, limit = void 0, symbol_name }, { readFileTimestamps }) {
|
|
7479
|
-
const ext =
|
|
7652
|
+
const ext = path5.extname(file_path).toLowerCase();
|
|
7480
7653
|
const fullFilePath = normalizeFilePath(file_path);
|
|
7481
7654
|
let startLine = offset;
|
|
7482
7655
|
let finalLimit = limit;
|
|
@@ -7515,7 +7688,7 @@ var FileReadTool = {
|
|
|
7515
7688
|
extension: ext,
|
|
7516
7689
|
timestamp: Date.now()
|
|
7517
7690
|
});
|
|
7518
|
-
readFileTimestamps[fullFilePath] =
|
|
7691
|
+
readFileTimestamps[fullFilePath] = statSync7(fullFilePath).mtimeMs;
|
|
7519
7692
|
const modificationReminder = generateFileModificationReminder(fullFilePath);
|
|
7520
7693
|
if (modificationReminder) {
|
|
7521
7694
|
emitReminderEvent("file:modified", {
|
|
@@ -7591,6 +7764,12 @@ var FileReadTool = {
|
|
|
7591
7764
|
finalLimit = range.end - range.start + 1;
|
|
7592
7765
|
}
|
|
7593
7766
|
} catch (e) {
|
|
7767
|
+
emitTelemetryEvent(
|
|
7768
|
+
toSmartTruncationFallbackEvent({
|
|
7769
|
+
filePath: fullFilePath,
|
|
7770
|
+
error: e
|
|
7771
|
+
})
|
|
7772
|
+
);
|
|
7594
7773
|
}
|
|
7595
7774
|
}
|
|
7596
7775
|
const { content, lineCount, totalLines } = readTextContent(
|
|
@@ -7690,7 +7869,7 @@ function createImageResponse(buffer, ext, originalSize) {
|
|
|
7690
7869
|
}
|
|
7691
7870
|
async function readImage(filePath, ext) {
|
|
7692
7871
|
try {
|
|
7693
|
-
const stats =
|
|
7872
|
+
const stats = statSync7(filePath);
|
|
7694
7873
|
const sharpModule = await import("sharp");
|
|
7695
7874
|
const sharp = sharpModule.default || sharpModule;
|
|
7696
7875
|
const fileReadResult = secureFileService.safeReadFile(filePath, {
|
|
@@ -7743,7 +7922,7 @@ async function readImage(filePath, ext) {
|
|
|
7743
7922
|
return createImageResponse(resizedImageBuffer, ext, stats.size);
|
|
7744
7923
|
} catch (e) {
|
|
7745
7924
|
logError(e);
|
|
7746
|
-
const stats =
|
|
7925
|
+
const stats = statSync7(filePath);
|
|
7747
7926
|
const fileReadResult = secureFileService.safeReadFile(filePath, {
|
|
7748
7927
|
encoding: "buffer",
|
|
7749
7928
|
maxFileSize: MAX_IMAGE_SIZE
|
|
@@ -7760,7 +7939,7 @@ async function readImage(filePath, ext) {
|
|
|
7760
7939
|
}
|
|
7761
7940
|
|
|
7762
7941
|
// src/tools/filesystem/FileWriteTool/FileWriteTool.tsx
|
|
7763
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
7942
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync4, statSync as statSync8 } from "fs";
|
|
7764
7943
|
import { Box as Box13, Text as Text14 } from "ink";
|
|
7765
7944
|
import { EOL } from "os";
|
|
7766
7945
|
import { dirname as dirname4, extname as extname5, isAbsolute as isAbsolute5, relative as relative7, resolve as resolve5 } from "path";
|
|
@@ -7820,7 +7999,7 @@ var FileWriteTool = {
|
|
|
7820
7999
|
const fullFilePath = isAbsolute5(file_path) ? file_path : resolve5(getCwd(), file_path);
|
|
7821
8000
|
const oldFileExists = fileExistsBun(fullFilePath);
|
|
7822
8001
|
const enc = oldFileExists ? detectFileEncoding(fullFilePath) : "utf-8";
|
|
7823
|
-
const oldContent = oldFileExists ?
|
|
8002
|
+
const oldContent = oldFileExists ? readFileSync4(fullFilePath, enc) : null;
|
|
7824
8003
|
const type3 = oldContent ? "update" : "create";
|
|
7825
8004
|
const patch = getPatch({
|
|
7826
8005
|
filePath: file_path,
|
|
@@ -7880,7 +8059,7 @@ var FileWriteTool = {
|
|
|
7880
8059
|
message: "File has not been read yet. Read it first before writing to it."
|
|
7881
8060
|
};
|
|
7882
8061
|
}
|
|
7883
|
-
const stats =
|
|
8062
|
+
const stats = statSync8(fullFilePath);
|
|
7884
8063
|
const lastWriteTime = stats.mtimeMs;
|
|
7885
8064
|
if (lastWriteTime > readTimestamp) {
|
|
7886
8065
|
return {
|
|
@@ -7896,7 +8075,7 @@ var FileWriteTool = {
|
|
|
7896
8075
|
const oldFileExists = fileExistsBun(fullFilePath);
|
|
7897
8076
|
if (oldFileExists) {
|
|
7898
8077
|
const readTimestamp = readFileTimestamps[fullFilePath];
|
|
7899
|
-
const lastWriteTime =
|
|
8078
|
+
const lastWriteTime = statSync8(fullFilePath).mtimeMs;
|
|
7900
8079
|
if (!readTimestamp || lastWriteTime > readTimestamp) {
|
|
7901
8080
|
throw new Error(
|
|
7902
8081
|
"File has been unexpectedly modified. Read it again before attempting to write it."
|
|
@@ -7909,7 +8088,7 @@ var FileWriteTool = {
|
|
|
7909
8088
|
mkdirSync4(dir, { recursive: true });
|
|
7910
8089
|
writeTextContent(fullFilePath, content, enc, endings);
|
|
7911
8090
|
recordFileEdit(fullFilePath, content);
|
|
7912
|
-
readFileTimestamps[fullFilePath] =
|
|
8091
|
+
readFileTimestamps[fullFilePath] = statSync8(fullFilePath).mtimeMs;
|
|
7913
8092
|
emitReminderEvent("file:edited", {
|
|
7914
8093
|
filePath: fullFilePath,
|
|
7915
8094
|
content,
|
|
@@ -8004,9 +8183,9 @@ var DESCRIPTION4 = `- Fast file pattern matching tool that works with any codeba
|
|
|
8004
8183
|
- If LSP is unavailable, it falls back to standard glob results without impacting the main file-finding flow.`;
|
|
8005
8184
|
|
|
8006
8185
|
// src/tools/filesystem/GlobTool/GlobTool.tsx
|
|
8007
|
-
import { existsSync as
|
|
8186
|
+
import { existsSync as existsSync6, statSync as statSync9 } from "fs";
|
|
8008
8187
|
import { isAbsolute as isAbsolute6, join as join4, relative as relative8, resolve as resolve6 } from "path";
|
|
8009
|
-
import { fileURLToPath } from "url";
|
|
8188
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8010
8189
|
var inputSchema6 = z6.strictObject({
|
|
8011
8190
|
pattern: z6.string().describe("The glob pattern to match files against"),
|
|
8012
8191
|
path: z6.string().optional().describe(
|
|
@@ -8035,36 +8214,36 @@ var GlobTool = {
|
|
|
8035
8214
|
isConcurrencySafe() {
|
|
8036
8215
|
return true;
|
|
8037
8216
|
},
|
|
8038
|
-
needsPermissions({ path:
|
|
8039
|
-
return !hasReadPermission(
|
|
8217
|
+
needsPermissions({ path: path6 }) {
|
|
8218
|
+
return !hasReadPermission(path6 || getCwd());
|
|
8040
8219
|
},
|
|
8041
8220
|
async prompt() {
|
|
8042
8221
|
return DESCRIPTION4;
|
|
8043
8222
|
},
|
|
8044
|
-
async validateInput({ path:
|
|
8045
|
-
if (!
|
|
8046
|
-
const absolute = isAbsolute6(
|
|
8047
|
-
if (!
|
|
8223
|
+
async validateInput({ path: path6 }) {
|
|
8224
|
+
if (!path6) return { result: true };
|
|
8225
|
+
const absolute = isAbsolute6(path6) ? path6 : resolve6(getCwd(), path6);
|
|
8226
|
+
if (!existsSync6(absolute)) {
|
|
8048
8227
|
return {
|
|
8049
8228
|
result: false,
|
|
8050
|
-
message: `Directory does not exist: ${
|
|
8229
|
+
message: `Directory does not exist: ${path6}`,
|
|
8051
8230
|
errorCode: 1
|
|
8052
8231
|
};
|
|
8053
8232
|
}
|
|
8054
|
-
if (!
|
|
8233
|
+
if (!statSync9(absolute).isDirectory()) {
|
|
8055
8234
|
return {
|
|
8056
8235
|
result: false,
|
|
8057
|
-
message: `Path is not a directory: ${
|
|
8236
|
+
message: `Path is not a directory: ${path6}`,
|
|
8058
8237
|
errorCode: 2
|
|
8059
8238
|
};
|
|
8060
8239
|
}
|
|
8061
8240
|
return { result: true };
|
|
8062
8241
|
},
|
|
8063
|
-
renderToolUseMessage({ pattern, path:
|
|
8064
|
-
const absolutePath =
|
|
8242
|
+
renderToolUseMessage({ pattern, path: path6, semantic }, { verbose }) {
|
|
8243
|
+
const absolutePath = path6 ? isAbsolute6(path6) ? path6 : resolve6(getCwd(), path6) : void 0;
|
|
8065
8244
|
const relativePath = absolutePath ? relative8(getCwd(), absolutePath) : void 0;
|
|
8066
8245
|
const parts = [`pattern: "${pattern}"`];
|
|
8067
|
-
if (
|
|
8246
|
+
if (path6) parts.push(`path: "${verbose ? absolutePath : relativePath}"`);
|
|
8068
8247
|
if (semantic) parts.push("semantic: true");
|
|
8069
8248
|
return parts.join(", ");
|
|
8070
8249
|
},
|
|
@@ -8077,9 +8256,9 @@ var GlobTool = {
|
|
|
8077
8256
|
}
|
|
8078
8257
|
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 }));
|
|
8079
8258
|
},
|
|
8080
|
-
async *call({ pattern, path:
|
|
8259
|
+
async *call({ pattern, path: path6, semantic }, { abortController }) {
|
|
8081
8260
|
const start = Date.now();
|
|
8082
|
-
const searchPath =
|
|
8261
|
+
const searchPath = path6 ? isAbsolute6(path6) ? path6 : resolve6(getCwd(), path6) : getCwd();
|
|
8083
8262
|
const raw = await ripGrep(
|
|
8084
8263
|
[
|
|
8085
8264
|
"--files",
|
|
@@ -8104,7 +8283,7 @@ var GlobTool = {
|
|
|
8104
8283
|
let filePath = s.location?.uri || "";
|
|
8105
8284
|
if (filePath.startsWith("file://")) {
|
|
8106
8285
|
try {
|
|
8107
|
-
filePath =
|
|
8286
|
+
filePath = fileURLToPath2(filePath);
|
|
8108
8287
|
} catch (e) {
|
|
8109
8288
|
filePath = filePath.replace("file://", "");
|
|
8110
8289
|
}
|
|
@@ -8155,7 +8334,7 @@ ${output.semanticNotice}`;
|
|
|
8155
8334
|
// src/tools/search/GrepTool/GrepTool.tsx
|
|
8156
8335
|
import { Box as Box15, Text as Text16 } from "ink";
|
|
8157
8336
|
import React16 from "react";
|
|
8158
|
-
import { existsSync as
|
|
8337
|
+
import { existsSync as existsSync7 } from "fs";
|
|
8159
8338
|
import { stat as statAsync } from "fs/promises";
|
|
8160
8339
|
import { z as z7 } from "zod";
|
|
8161
8340
|
|
|
@@ -8206,7 +8385,7 @@ var DESCRIPTION5 = `A powerful search tool built on ripgrep
|
|
|
8206
8385
|
|
|
8207
8386
|
// src/tools/search/GrepTool/GrepTool.tsx
|
|
8208
8387
|
import { isAbsolute as isAbsolute7, relative as relative9, resolve as resolve7 } from "path";
|
|
8209
|
-
import { fileURLToPath as
|
|
8388
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
8210
8389
|
var inputSchema7 = z7.strictObject({
|
|
8211
8390
|
pattern: z7.string().describe("The regular expression pattern to search for in file contents"),
|
|
8212
8391
|
path: z7.string().optional().describe(
|
|
@@ -8311,8 +8490,8 @@ var GrepTool = {
|
|
|
8311
8490
|
async isEnabled() {
|
|
8312
8491
|
return true;
|
|
8313
8492
|
},
|
|
8314
|
-
needsPermissions({ path:
|
|
8315
|
-
return !hasReadPermission(
|
|
8493
|
+
needsPermissions({ path: path6 }) {
|
|
8494
|
+
return !hasReadPermission(path6 || getCwd());
|
|
8316
8495
|
},
|
|
8317
8496
|
async prompt() {
|
|
8318
8497
|
return DESCRIPTION5;
|
|
@@ -8320,7 +8499,7 @@ var GrepTool = {
|
|
|
8320
8499
|
renderToolUseMessage(input, { verbose }) {
|
|
8321
8500
|
const {
|
|
8322
8501
|
pattern,
|
|
8323
|
-
path:
|
|
8502
|
+
path: path6,
|
|
8324
8503
|
glob,
|
|
8325
8504
|
type: type3,
|
|
8326
8505
|
output_mode = "files_with_matches",
|
|
@@ -8328,8 +8507,8 @@ var GrepTool = {
|
|
|
8328
8507
|
} = input;
|
|
8329
8508
|
if (!pattern) return null;
|
|
8330
8509
|
const parts = [`pattern: "${pattern}"`];
|
|
8331
|
-
if (
|
|
8332
|
-
const { absolutePath, relativePath } = getAbsoluteAndRelativePaths(
|
|
8510
|
+
if (path6) {
|
|
8511
|
+
const { absolutePath, relativePath } = getAbsoluteAndRelativePaths(path6);
|
|
8333
8512
|
parts.push(`path: "${verbose ? absolutePath : relativePath}"`);
|
|
8334
8513
|
}
|
|
8335
8514
|
if (glob) parts.push(`glob: "${glob}"`);
|
|
@@ -8382,7 +8561,7 @@ Found ${numMatches} total ${numMatches === 1 ? "occurrence" : "occurrences"} acr
|
|
|
8382
8561
|
${result.filenames.join("\n")}`;
|
|
8383
8562
|
return appendNotice(truncateToCharBudget(header));
|
|
8384
8563
|
},
|
|
8385
|
-
async validateInput({ path:
|
|
8564
|
+
async validateInput({ path: path6, semantic, symbol_type }) {
|
|
8386
8565
|
if (symbol_type && !semantic) {
|
|
8387
8566
|
return {
|
|
8388
8567
|
result: false,
|
|
@@ -8390,12 +8569,12 @@ ${result.filenames.join("\n")}`;
|
|
|
8390
8569
|
errorCode: 5
|
|
8391
8570
|
};
|
|
8392
8571
|
}
|
|
8393
|
-
if (
|
|
8394
|
-
const abs = getAbsolutePath(
|
|
8395
|
-
if (!abs || !
|
|
8572
|
+
if (path6) {
|
|
8573
|
+
const abs = getAbsolutePath(path6);
|
|
8574
|
+
if (!abs || !existsSync7(abs)) {
|
|
8396
8575
|
return {
|
|
8397
8576
|
result: false,
|
|
8398
|
-
message: `Path does not exist: ${
|
|
8577
|
+
message: `Path does not exist: ${path6}`,
|
|
8399
8578
|
errorCode: 1
|
|
8400
8579
|
};
|
|
8401
8580
|
}
|
|
@@ -8404,7 +8583,7 @@ ${result.filenames.join("\n")}`;
|
|
|
8404
8583
|
},
|
|
8405
8584
|
async *call({
|
|
8406
8585
|
pattern,
|
|
8407
|
-
path:
|
|
8586
|
+
path: path6,
|
|
8408
8587
|
glob,
|
|
8409
8588
|
type: type3,
|
|
8410
8589
|
output_mode = "files_with_matches",
|
|
@@ -8421,7 +8600,7 @@ ${result.filenames.join("\n")}`;
|
|
|
8421
8600
|
}, toolUseContext) {
|
|
8422
8601
|
const { abortController } = toolUseContext;
|
|
8423
8602
|
const start = Date.now();
|
|
8424
|
-
const absolutePath = getAbsolutePath(
|
|
8603
|
+
const absolutePath = getAbsolutePath(path6) || getCwd();
|
|
8425
8604
|
const baseArgs = ["--hidden"];
|
|
8426
8605
|
for (const dir of EXCLUDED_DIRS) {
|
|
8427
8606
|
baseArgs.push("--glob", `!${dir}`);
|
|
@@ -8514,7 +8693,7 @@ ${result.filenames.join("\n")}`;
|
|
|
8514
8693
|
let filePath = s.location?.uri || "";
|
|
8515
8694
|
if (filePath.startsWith("file://")) {
|
|
8516
8695
|
try {
|
|
8517
|
-
filePath =
|
|
8696
|
+
filePath = fileURLToPath3(filePath);
|
|
8518
8697
|
} catch {
|
|
8519
8698
|
filePath = filePath.replace("file://", "");
|
|
8520
8699
|
}
|
|
@@ -9372,7 +9551,7 @@ var MeasuredText = class {
|
|
|
9372
9551
|
|
|
9373
9552
|
// src/utils/terminal/imagePaste.ts
|
|
9374
9553
|
import { execSync } from "child_process";
|
|
9375
|
-
import { readFileSync as
|
|
9554
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
9376
9555
|
var SCREENSHOT_PATH = "/tmp/pyb_cli_latest_screenshot.png";
|
|
9377
9556
|
var CLIPBOARD_ERROR_MESSAGE = "No image found in clipboard. Use Cmd + Ctrl + Shift + 4 to copy a screenshot to clipboard.";
|
|
9378
9557
|
function getImageFromClipboard() {
|
|
@@ -9387,7 +9566,7 @@ function getImageFromClipboard() {
|
|
|
9387
9566
|
`osascript -e 'set png_data to (the clipboard as \xABclass PNGf\xBB)' -e 'set fp to open for access POSIX file "${SCREENSHOT_PATH}" with write permission' -e 'write png_data to fp' -e 'close access fp'`,
|
|
9388
9567
|
{ stdio: "ignore" }
|
|
9389
9568
|
);
|
|
9390
|
-
const imageBuffer =
|
|
9569
|
+
const imageBuffer = readFileSync5(SCREENSHOT_PATH);
|
|
9391
9570
|
const base64Image = imageBuffer.toString("base64");
|
|
9392
9571
|
execSync(`rm -f "${SCREENSHOT_PATH}"`, { stdio: "ignore" });
|
|
9393
9572
|
return base64Image;
|
|
@@ -10637,12 +10816,389 @@ function PressEnterToContinue() {
|
|
|
10637
10816
|
return /* @__PURE__ */ React23.createElement(Text21, { color: getTheme().permission }, "Press ", /* @__PURE__ */ React23.createElement(Text21, { bold: true }, "Enter"), " to continue\u2026");
|
|
10638
10817
|
}
|
|
10639
10818
|
|
|
10819
|
+
// src/services/stability/runtimeAssetHealth/checks/ripgrep.ts
|
|
10820
|
+
import { join as join5, sep as sep3 } from "node:path";
|
|
10821
|
+
import envPaths from "env-paths";
|
|
10822
|
+
async function resolveRipgrepPath() {
|
|
10823
|
+
return getRipgrepPath();
|
|
10824
|
+
}
|
|
10825
|
+
async function execRipgrepVersion(path6) {
|
|
10826
|
+
return execFileNoThrow(path6, ["--version"]);
|
|
10827
|
+
}
|
|
10828
|
+
function detectRipgrepSource(resolvedPath) {
|
|
10829
|
+
const explicit = process.env.PYB_RIPGREP_PATH?.trim();
|
|
10830
|
+
if (explicit && normalizePath(explicit) === normalizePath(resolvedPath)) {
|
|
10831
|
+
return "explicit";
|
|
10832
|
+
}
|
|
10833
|
+
if (resolvedPath.includes(`${sep3}resources${sep3}ripgrep${sep3}`)) {
|
|
10834
|
+
return "vendor";
|
|
10835
|
+
}
|
|
10836
|
+
const cacheRoot = getRipgrepCacheRoot();
|
|
10837
|
+
if (normalizePath(resolvedPath).startsWith(normalizePath(cacheRoot))) {
|
|
10838
|
+
return "cache";
|
|
10839
|
+
}
|
|
10840
|
+
if (isLikelyPathResolved(resolvedPath)) {
|
|
10841
|
+
return "path";
|
|
10842
|
+
}
|
|
10843
|
+
return "unknown";
|
|
10844
|
+
}
|
|
10845
|
+
function classifyRipgrepHealthError(error) {
|
|
10846
|
+
const message = String(error ?? "").toLowerCase();
|
|
10847
|
+
if (message.includes("pyb_ripgrep_path") && (message.includes("missing") || message.includes("not found"))) {
|
|
10848
|
+
return "RG_EXPLICIT_PATH_MISSING";
|
|
10849
|
+
}
|
|
10850
|
+
if (message.includes("download failed") || message.includes("network timeout") || message.includes("failed to download")) {
|
|
10851
|
+
return "RG_DOWNLOAD_FAILED";
|
|
10852
|
+
}
|
|
10853
|
+
if ((message.includes("checksum") || message.includes("sha256")) && message.includes("mismatch")) {
|
|
10854
|
+
return "RG_CHECKSUM_MISMATCH";
|
|
10855
|
+
}
|
|
10856
|
+
if (message.includes("vendor") && (message.includes("missing") || message.includes("not found"))) {
|
|
10857
|
+
return "RG_VENDOR_MISSING";
|
|
10858
|
+
}
|
|
10859
|
+
if (message.includes("not executable") || message.includes("eacces") || message.includes("permission denied")) {
|
|
10860
|
+
return "RG_NOT_EXECUTABLE";
|
|
10861
|
+
}
|
|
10862
|
+
if (message.includes("enoent") || message.includes("path not found") || message.includes("not found")) {
|
|
10863
|
+
return "RG_PATH_NOT_FOUND";
|
|
10864
|
+
}
|
|
10865
|
+
return "RG_LOAD_UNKNOWN";
|
|
10866
|
+
}
|
|
10867
|
+
function resolveRipgrepPolicyVisibility() {
|
|
10868
|
+
const policy = resolveRipgrepPolicy();
|
|
10869
|
+
return {
|
|
10870
|
+
vendorFirst: policy.vendorFirst,
|
|
10871
|
+
offlineStrict: policy.offlineStrict,
|
|
10872
|
+
networkFallbackAllowed: policy.allowNetworkFallback,
|
|
10873
|
+
policyMode: getRipgrepPolicyMode(policy)
|
|
10874
|
+
};
|
|
10875
|
+
}
|
|
10876
|
+
function getRipgrepCacheRoot() {
|
|
10877
|
+
const override = process.env.PYB_RIPGREP_CACHE_DIR?.trim();
|
|
10878
|
+
if (override) return override;
|
|
10879
|
+
return join5(envPaths("pyb").cache, "ripgrep");
|
|
10880
|
+
}
|
|
10881
|
+
function normalizePath(value) {
|
|
10882
|
+
return value.replaceAll("/", sep3).replaceAll("\\", sep3).toLowerCase();
|
|
10883
|
+
}
|
|
10884
|
+
function isLikelyPathResolved(value) {
|
|
10885
|
+
const normalized = normalizePath(value);
|
|
10886
|
+
return normalized.includes(`${sep3}bin${sep3}`) || normalized.endsWith(`${sep3}rg`);
|
|
10887
|
+
}
|
|
10888
|
+
|
|
10889
|
+
// src/services/stability/runtimeAssetHealth/diagnostics.ts
|
|
10890
|
+
function toRuntimeAssetHealthEvent(report) {
|
|
10891
|
+
return {
|
|
10892
|
+
channel: "runtime_assets",
|
|
10893
|
+
phase: "RUNTIME_ASSET_HEALTH_CHECK",
|
|
10894
|
+
timestamp: Date.now(),
|
|
10895
|
+
data: report
|
|
10896
|
+
};
|
|
10897
|
+
}
|
|
10898
|
+
|
|
10899
|
+
// src/services/stability/runtimeAssetHealth/index.ts
|
|
10900
|
+
var defaultChecks = {
|
|
10901
|
+
checkTreeSitterCore: checkTreeSitterCoreLoadable,
|
|
10902
|
+
checkTreeSitterGrammar: checkTreeSitterGrammarLoadable,
|
|
10903
|
+
resolveRipgrepPath,
|
|
10904
|
+
execRipgrepVersion
|
|
10905
|
+
};
|
|
10906
|
+
async function runRuntimeAssetHealthCheck(options = {}) {
|
|
10907
|
+
const checks = { ...defaultChecks, ...options.checks ?? {} };
|
|
10908
|
+
const now = options.now ?? (() => Date.now());
|
|
10909
|
+
const errors = [];
|
|
10910
|
+
const report = {
|
|
10911
|
+
status: "ok",
|
|
10912
|
+
checks: {
|
|
10913
|
+
treeSitterCore: { status: "ok" },
|
|
10914
|
+
treeSitterGrammarTypescript: { status: "ok" },
|
|
10915
|
+
treeSitterGrammarBash: { status: "ok" },
|
|
10916
|
+
ripgrep: { status: "ok" }
|
|
10917
|
+
},
|
|
10918
|
+
errors,
|
|
10919
|
+
timestamp: now()
|
|
10920
|
+
};
|
|
10921
|
+
await runTreeSitterChecks(report, checks, errors);
|
|
10922
|
+
await runRipgrepCheck(report, checks, errors);
|
|
10923
|
+
report.status = errors.length > 0 ? "error" : "ok";
|
|
10924
|
+
const event = toRuntimeAssetHealthEvent(report);
|
|
10925
|
+
if (options.emitEvent) {
|
|
10926
|
+
options.emitEvent(event);
|
|
10927
|
+
} else {
|
|
10928
|
+
emitTelemetryEvent(event);
|
|
10929
|
+
}
|
|
10930
|
+
return report;
|
|
10931
|
+
}
|
|
10932
|
+
async function runTreeSitterChecks(report, checks, errors) {
|
|
10933
|
+
await runSingleCheck({
|
|
10934
|
+
execute: () => checks.checkTreeSitterCore(),
|
|
10935
|
+
onError: (error) => {
|
|
10936
|
+
const code = classifyTreeSitterHealthError2(error);
|
|
10937
|
+
report.checks.treeSitterCore = {
|
|
10938
|
+
status: "error",
|
|
10939
|
+
code,
|
|
10940
|
+
message: String(error instanceof Error ? error.message : error)
|
|
10941
|
+
};
|
|
10942
|
+
errors.push({
|
|
10943
|
+
code,
|
|
10944
|
+
check: "treeSitterCore",
|
|
10945
|
+
message: report.checks.treeSitterCore.message ?? ""
|
|
10946
|
+
});
|
|
10947
|
+
}
|
|
10948
|
+
});
|
|
10949
|
+
await runSingleCheck({
|
|
10950
|
+
execute: () => checks.checkTreeSitterGrammar("typescript"),
|
|
10951
|
+
onError: (error) => {
|
|
10952
|
+
const code = classifyTreeSitterHealthError2(error);
|
|
10953
|
+
report.checks.treeSitterGrammarTypescript = {
|
|
10954
|
+
status: "error",
|
|
10955
|
+
code,
|
|
10956
|
+
message: String(error instanceof Error ? error.message : error)
|
|
10957
|
+
};
|
|
10958
|
+
errors.push({
|
|
10959
|
+
code,
|
|
10960
|
+
check: "treeSitterGrammarTypescript",
|
|
10961
|
+
message: report.checks.treeSitterGrammarTypescript.message ?? ""
|
|
10962
|
+
});
|
|
10963
|
+
}
|
|
10964
|
+
});
|
|
10965
|
+
await runSingleCheck({
|
|
10966
|
+
execute: () => checks.checkTreeSitterGrammar("bash"),
|
|
10967
|
+
onError: (error) => {
|
|
10968
|
+
const code = classifyTreeSitterHealthError2(error);
|
|
10969
|
+
report.checks.treeSitterGrammarBash = {
|
|
10970
|
+
status: "error",
|
|
10971
|
+
code,
|
|
10972
|
+
message: String(error instanceof Error ? error.message : error)
|
|
10973
|
+
};
|
|
10974
|
+
errors.push({
|
|
10975
|
+
code,
|
|
10976
|
+
check: "treeSitterGrammarBash",
|
|
10977
|
+
message: report.checks.treeSitterGrammarBash.message ?? ""
|
|
10978
|
+
});
|
|
10979
|
+
}
|
|
10980
|
+
});
|
|
10981
|
+
}
|
|
10982
|
+
async function runRipgrepCheck(report, checks, errors) {
|
|
10983
|
+
let resolvedPath = "";
|
|
10984
|
+
const policy = resolveRipgrepPolicyVisibility();
|
|
10985
|
+
report.checks.ripgrep.vendorFirst = policy.vendorFirst;
|
|
10986
|
+
report.checks.ripgrep.offlineStrict = policy.offlineStrict;
|
|
10987
|
+
report.checks.ripgrep.networkFallbackAllowed = policy.networkFallbackAllowed;
|
|
10988
|
+
report.checks.ripgrep.policyMode = policy.policyMode;
|
|
10989
|
+
await runSingleCheck({
|
|
10990
|
+
execute: async () => {
|
|
10991
|
+
resolvedPath = await checks.resolveRipgrepPath();
|
|
10992
|
+
report.checks.ripgrep.path = resolvedPath;
|
|
10993
|
+
report.checks.ripgrep.source = detectRipgrepSource(resolvedPath);
|
|
10994
|
+
const versionResult = await checks.execRipgrepVersion(resolvedPath);
|
|
10995
|
+
if (versionResult.code !== 0) {
|
|
10996
|
+
throw new Error(versionResult.stderr || versionResult.stdout || "rg --version failed");
|
|
10997
|
+
}
|
|
10998
|
+
const firstLine = versionResult.stdout.split(/\r?\n/).find(Boolean);
|
|
10999
|
+
report.checks.ripgrep.version = firstLine ?? "";
|
|
11000
|
+
},
|
|
11001
|
+
onError: (error) => {
|
|
11002
|
+
const code = classifyRipgrepHealthError2(error);
|
|
11003
|
+
report.checks.ripgrep = {
|
|
11004
|
+
...report.checks.ripgrep,
|
|
11005
|
+
status: "error",
|
|
11006
|
+
code,
|
|
11007
|
+
message: String(error instanceof Error ? error.message : error)
|
|
11008
|
+
};
|
|
11009
|
+
errors.push({
|
|
11010
|
+
code,
|
|
11011
|
+
check: "ripgrep",
|
|
11012
|
+
message: report.checks.ripgrep.message ?? ""
|
|
11013
|
+
});
|
|
11014
|
+
}
|
|
11015
|
+
});
|
|
11016
|
+
}
|
|
11017
|
+
async function runSingleCheck(input) {
|
|
11018
|
+
try {
|
|
11019
|
+
await input.execute();
|
|
11020
|
+
} catch (error) {
|
|
11021
|
+
input.onError(error);
|
|
11022
|
+
}
|
|
11023
|
+
}
|
|
11024
|
+
function classifyTreeSitterHealthError2(error) {
|
|
11025
|
+
return classifyTreeSitterHealthError(error);
|
|
11026
|
+
}
|
|
11027
|
+
function classifyRipgrepHealthError2(error) {
|
|
11028
|
+
return classifyRipgrepHealthError(error);
|
|
11029
|
+
}
|
|
11030
|
+
|
|
11031
|
+
// src/services/stability/runtimeAssetHealth/suggestions.ts
|
|
11032
|
+
function getRuntimeAssetHealthSuggestions(code) {
|
|
11033
|
+
const mapped = suggestionsMap[code];
|
|
11034
|
+
if (mapped) return mapped;
|
|
11035
|
+
return [
|
|
11036
|
+
"\u8BF7\u8FD0\u884C doctor \u5E76\u67E5\u770B runtime assets \u8BE6\u60C5\u3002",
|
|
11037
|
+
"\u8BF7\u68C0\u67E5\u8D44\u6E90\u76EE\u5F55\u4E0E\u53EF\u6267\u884C\u6587\u4EF6\u8DEF\u5F84\u914D\u7F6E\u662F\u5426\u6B63\u786E\u3002"
|
|
11038
|
+
];
|
|
11039
|
+
}
|
|
11040
|
+
var suggestionsMap = {
|
|
11041
|
+
TS_WASM_MISSING: [
|
|
11042
|
+
"\u8BF7\u91CD\u88C5 pyb \u4EE5\u6062\u590D tree-sitter core \u8D44\u6E90\u3002",
|
|
11043
|
+
"\u8BF7\u68C0\u67E5 PYB_RESOURCE_DIR \u662F\u5426\u6307\u5411\u6709\u6548\u8D44\u6E90\u76EE\u5F55\u3002"
|
|
11044
|
+
],
|
|
11045
|
+
TS_GRAMMAR_MISSING: [
|
|
11046
|
+
"\u8BF7\u786E\u8BA4 tree-sitter grammar wasm \u6587\u4EF6\u5B58\u5728\u3002",
|
|
11047
|
+
"\u8BF7\u68C0\u67E5 PYB_RESOURCE_DIR \u662F\u5426\u4E0E\u5F53\u524D\u5B89\u88C5\u7248\u672C\u4E00\u81F4\u3002"
|
|
11048
|
+
],
|
|
11049
|
+
TS_VERSION_INCOMPATIBLE: [
|
|
11050
|
+
"\u8BF7\u66F4\u65B0\u6216\u91CD\u88C5 pyb \u4EE5\u5339\u914D tree-sitter runtime \u4E0E grammar \u7248\u672C\u3002",
|
|
11051
|
+
"\u8BF7\u907F\u514D\u6DF7\u7528\u65E7\u7F13\u5B58\u4E0E\u65B0\u7248\u672C\u8D44\u6E90\u76EE\u5F55\u3002"
|
|
11052
|
+
],
|
|
11053
|
+
TS_CHECKSUM_MISMATCH: [
|
|
11054
|
+
"\u8BF7\u91CD\u65B0\u5B89\u88C5\u8D44\u6E90\u6587\u4EF6\u5E76\u6821\u9A8C\u6765\u6E90\u5B8C\u6574\u6027\u3002",
|
|
11055
|
+
"\u8BF7\u6E05\u7406\u5F02\u5E38\u7F13\u5B58\u540E\u91CD\u8BD5\u3002"
|
|
11056
|
+
],
|
|
11057
|
+
TS_RESOURCE_PATH_DRIFT: [
|
|
11058
|
+
"\u8BF7\u68C0\u67E5 PYB_RESOURCE_DIR \u662F\u5426\u6F02\u79FB\u5230\u65E7\u76EE\u5F55\u3002",
|
|
11059
|
+
"\u8BF7\u79FB\u9664\u8FC7\u671F\u73AF\u5883\u53D8\u91CF\u8986\u76D6\u540E\u91CD\u8BD5\u3002"
|
|
11060
|
+
],
|
|
11061
|
+
TS_LOAD_UNKNOWN: [
|
|
11062
|
+
"\u8BF7\u8FD0\u884C doctor \u6536\u96C6 tree-sitter \u8BCA\u65AD\u4FE1\u606F\u3002",
|
|
11063
|
+
"\u8BF7\u9644\u5E26\u9519\u8BEF\u7801\u4E0E\u8D44\u6E90\u8DEF\u5F84\u63D0\u4EA4\u95EE\u9898\u3002"
|
|
11064
|
+
],
|
|
11065
|
+
RG_EXPLICIT_PATH_MISSING: [
|
|
11066
|
+
"\u8BF7\u4FEE\u6B63 PYB_RIPGREP_PATH \u6307\u5411\u53EF\u6267\u884C\u6587\u4EF6\u3002",
|
|
11067
|
+
"\u8BF7\u79FB\u9664\u65E0\u6548 PYB_RIPGREP_PATH \u540E\u91CD\u8BD5\u3002"
|
|
11068
|
+
],
|
|
11069
|
+
RG_PATH_NOT_FOUND: [
|
|
11070
|
+
"\u8BF7\u786E\u8BA4 ripgrep \u5DF2\u5B89\u88C5\u6216\u53EF\u4ECE\u7F13\u5B58\u76EE\u5F55\u8BFB\u53D6\u3002",
|
|
11071
|
+
"\u8BF7\u68C0\u67E5 PATH \u6216\u7F13\u5B58\u76EE\u5F55\u914D\u7F6E\u3002"
|
|
11072
|
+
],
|
|
11073
|
+
RG_DOWNLOAD_FAILED: [
|
|
11074
|
+
"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u901A\u6027\u6216\u955C\u50CF\u5730\u5740\u914D\u7F6E\u3002",
|
|
11075
|
+
"\u8BF7\u786E\u8BA4 PYB_RIPGREP_DOWNLOAD_BASE_URL \u53EF\u8BBF\u95EE\u3002"
|
|
11076
|
+
],
|
|
11077
|
+
RG_CHECKSUM_MISMATCH: [
|
|
11078
|
+
"\u8BF7\u6E05\u7406\u635F\u574F\u7684 ripgrep \u7F13\u5B58\u5E76\u91CD\u65B0\u4E0B\u8F7D\u3002",
|
|
11079
|
+
"\u8BF7\u786E\u8BA4\u4E0B\u8F7D\u6E90\u672A\u88AB\u7BE1\u6539\u3002"
|
|
11080
|
+
],
|
|
11081
|
+
RG_VENDOR_MISSING: [
|
|
11082
|
+
"\u8BF7\u786E\u8BA4\u5F53\u524D\u5E73\u53F0 vendor ripgrep \u8D44\u4EA7\u5DF2\u6253\u5305\u3002",
|
|
11083
|
+
"\u8BF7\u5207\u6362\u5230\u7F13\u5B58\u4E0B\u8F7D\u8DEF\u5F84\u6216\u8865\u9F50 vendor \u8D44\u6E90\u3002"
|
|
11084
|
+
],
|
|
11085
|
+
RG_NOT_EXECUTABLE: [
|
|
11086
|
+
"\u8BF7\u68C0\u67E5\u6587\u4EF6\u6267\u884C\u6743\u9650\u5E76\u786E\u8BA4\u4E8C\u8FDB\u5236\u53EF\u8FD0\u884C\u3002",
|
|
11087
|
+
"\u8BF7\u66F4\u6362\u5230\u6709\u6548 ripgrep \u53EF\u6267\u884C\u8DEF\u5F84\u3002"
|
|
11088
|
+
],
|
|
11089
|
+
RG_LOAD_UNKNOWN: [
|
|
11090
|
+
"\u8BF7\u8FD0\u884C doctor \u5E76\u6536\u96C6 ripgrep \u8BCA\u65AD\u8F93\u51FA\u3002",
|
|
11091
|
+
"\u8BF7\u9644\u5E26\u9519\u8BEF\u7801\u4E0E\u8DEF\u5F84\u4FE1\u606F\u63D0\u4EA4\u95EE\u9898\u3002"
|
|
11092
|
+
]
|
|
11093
|
+
};
|
|
11094
|
+
|
|
11095
|
+
// src/services/stability/runtimeAssetHealth/view.ts
|
|
11096
|
+
var suggestionPriorityByCode = {
|
|
11097
|
+
TS_WASM_MISSING: 10,
|
|
11098
|
+
TS_GRAMMAR_MISSING: 20,
|
|
11099
|
+
TS_VERSION_INCOMPATIBLE: 30,
|
|
11100
|
+
TS_CHECKSUM_MISMATCH: 40,
|
|
11101
|
+
TS_RESOURCE_PATH_DRIFT: 50,
|
|
11102
|
+
TS_LOAD_UNKNOWN: 60,
|
|
11103
|
+
RG_EXPLICIT_PATH_MISSING: 70,
|
|
11104
|
+
RG_NOT_EXECUTABLE: 80,
|
|
11105
|
+
RG_PATH_NOT_FOUND: 90,
|
|
11106
|
+
RG_VENDOR_MISSING: 100,
|
|
11107
|
+
RG_DOWNLOAD_FAILED: 110,
|
|
11108
|
+
RG_CHECKSUM_MISMATCH: 120,
|
|
11109
|
+
RG_LOAD_UNKNOWN: 130
|
|
11110
|
+
};
|
|
11111
|
+
function buildRuntimeAssetHealthViewLines(report) {
|
|
11112
|
+
if (!report) {
|
|
11113
|
+
return ["Runtime assets: unavailable"];
|
|
11114
|
+
}
|
|
11115
|
+
const lines = [];
|
|
11116
|
+
lines.push(`Runtime assets: ${report.status === "ok" ? "OK" : "ERROR"}`);
|
|
11117
|
+
lines.push(`Tree-sitter core: ${formatCheck(report.checks.treeSitterCore)}`);
|
|
11118
|
+
lines.push(
|
|
11119
|
+
`Tree-sitter typescript: ${formatCheck(report.checks.treeSitterGrammarTypescript)}`
|
|
11120
|
+
);
|
|
11121
|
+
lines.push(`Tree-sitter bash: ${formatCheck(report.checks.treeSitterGrammarBash)}`);
|
|
11122
|
+
const ripgrepTail = [];
|
|
11123
|
+
if (report.checks.ripgrep.source) {
|
|
11124
|
+
ripgrepTail.push(`source=${report.checks.ripgrep.source}`);
|
|
11125
|
+
}
|
|
11126
|
+
if (report.checks.ripgrep.version) {
|
|
11127
|
+
ripgrepTail.push(report.checks.ripgrep.version);
|
|
11128
|
+
}
|
|
11129
|
+
if (report.checks.ripgrep.policyMode) {
|
|
11130
|
+
ripgrepTail.push(`policy=${report.checks.ripgrep.policyMode}`);
|
|
11131
|
+
}
|
|
11132
|
+
if (typeof report.checks.ripgrep.offlineStrict === "boolean") {
|
|
11133
|
+
ripgrepTail.push(`strict=${report.checks.ripgrep.offlineStrict ? "on" : "off"}`);
|
|
11134
|
+
}
|
|
11135
|
+
if (typeof report.checks.ripgrep.networkFallbackAllowed === "boolean") {
|
|
11136
|
+
ripgrepTail.push(
|
|
11137
|
+
`network_fallback=${report.checks.ripgrep.networkFallbackAllowed ? "on" : "off"}`
|
|
11138
|
+
);
|
|
11139
|
+
}
|
|
11140
|
+
const ripgrepSuffix = ripgrepTail.length > 0 ? ` (${ripgrepTail.join(", ")})` : "";
|
|
11141
|
+
lines.push(`Ripgrep: ${formatCheck(report.checks.ripgrep)}${ripgrepSuffix}`);
|
|
11142
|
+
return lines;
|
|
11143
|
+
}
|
|
11144
|
+
function buildRuntimeAssetHealthSuggestionLines(report) {
|
|
11145
|
+
if (!report || report.status !== "error") {
|
|
11146
|
+
return [];
|
|
11147
|
+
}
|
|
11148
|
+
const seenCodes = /* @__PURE__ */ new Set();
|
|
11149
|
+
const lines = [];
|
|
11150
|
+
for (const error of report.errors) {
|
|
11151
|
+
if (seenCodes.has(error.code)) {
|
|
11152
|
+
continue;
|
|
11153
|
+
}
|
|
11154
|
+
seenCodes.add(error.code);
|
|
11155
|
+
}
|
|
11156
|
+
const sortedCodes = [...seenCodes].sort((left, right) => {
|
|
11157
|
+
const leftPriority = suggestionPriorityByCode[left] ?? 999;
|
|
11158
|
+
const rightPriority = suggestionPriorityByCode[right] ?? 999;
|
|
11159
|
+
if (leftPriority !== rightPriority) {
|
|
11160
|
+
return leftPriority - rightPriority;
|
|
11161
|
+
}
|
|
11162
|
+
return left.localeCompare(right);
|
|
11163
|
+
});
|
|
11164
|
+
for (const code of sortedCodes) {
|
|
11165
|
+
const suggestions = getRuntimeAssetHealthSuggestions(code);
|
|
11166
|
+
for (const suggestion of suggestions) {
|
|
11167
|
+
lines.push(`Suggestion: ${suggestion}`);
|
|
11168
|
+
}
|
|
11169
|
+
}
|
|
11170
|
+
return lines;
|
|
11171
|
+
}
|
|
11172
|
+
function formatCheck(check) {
|
|
11173
|
+
if (check.status === "ok") {
|
|
11174
|
+
return "OK";
|
|
11175
|
+
}
|
|
11176
|
+
return check.code ? `ERROR (${check.code})` : "ERROR";
|
|
11177
|
+
}
|
|
11178
|
+
|
|
10640
11179
|
// src/ui/screens/Doctor.tsx
|
|
10641
|
-
function Doctor({
|
|
11180
|
+
function Doctor({
|
|
11181
|
+
onDone,
|
|
11182
|
+
doctorMode = false,
|
|
11183
|
+
runtimeHealthChecker = runRuntimeAssetHealthCheck
|
|
11184
|
+
}) {
|
|
10642
11185
|
const [checked, setChecked] = useState8(false);
|
|
11186
|
+
const [runtimeHealth, setRuntimeHealth] = useState8(
|
|
11187
|
+
null
|
|
11188
|
+
);
|
|
10643
11189
|
const theme = getTheme();
|
|
10644
11190
|
useEffect5(() => {
|
|
10645
|
-
|
|
11191
|
+
;
|
|
11192
|
+
(async () => {
|
|
11193
|
+
try {
|
|
11194
|
+
const report = await runtimeHealthChecker();
|
|
11195
|
+
setRuntimeHealth(report);
|
|
11196
|
+
} catch {
|
|
11197
|
+
setRuntimeHealth(null);
|
|
11198
|
+
} finally {
|
|
11199
|
+
setChecked(true);
|
|
11200
|
+
}
|
|
11201
|
+
})();
|
|
10646
11202
|
}, []);
|
|
10647
11203
|
useInput7((_input, key) => {
|
|
10648
11204
|
if (key.return) onDone();
|
|
@@ -10650,7 +11206,7 @@ function Doctor({ onDone, doctorMode = false }) {
|
|
|
10650
11206
|
if (!checked) {
|
|
10651
11207
|
return /* @__PURE__ */ React24.createElement(Box19, { paddingX: 1, paddingTop: 1 }, /* @__PURE__ */ React24.createElement(Text22, { color: theme.secondaryText }, "Running checks\u2026"));
|
|
10652
11208
|
}
|
|
10653
|
-
return /* @__PURE__ */ React24.createElement(Box19, { flexDirection: "column", gap: 1, paddingX: 1, paddingTop: 1 }, /* @__PURE__ */ React24.createElement(Text22, { color: theme.success }, "\u2713 Installation checks passed"), /* @__PURE__ */ React24.createElement(Text22, { dimColor: true }, "Note: Auto-update is disabled by design. Use npm/bun to update."), /* @__PURE__ */ React24.createElement(PressEnterToContinue, null));
|
|
11209
|
+
return /* @__PURE__ */ React24.createElement(Box19, { flexDirection: "column", gap: 1, paddingX: 1, paddingTop: 1 }, /* @__PURE__ */ React24.createElement(Text22, { color: runtimeHealth?.status === "error" ? theme.warning : theme.success }, runtimeHealth?.status === "error" ? "\u26A0 Installation checks completed with warnings" : "\u2713 Installation checks passed"), buildRuntimeAssetHealthViewLines(runtimeHealth).map((line) => /* @__PURE__ */ React24.createElement(React24.Fragment, { key: line }, /* @__PURE__ */ React24.createElement(Text22, { dimColor: true }, line))), buildRuntimeAssetHealthSuggestionLines(runtimeHealth).map((line) => /* @__PURE__ */ React24.createElement(React24.Fragment, { key: line }, /* @__PURE__ */ React24.createElement(Text22, { color: theme.warning }, line))), /* @__PURE__ */ React24.createElement(Text22, { dimColor: true }, "Note: Auto-update is disabled by design. Use npm/bun to update."), /* @__PURE__ */ React24.createElement(PressEnterToContinue, null));
|
|
10654
11210
|
}
|
|
10655
11211
|
|
|
10656
11212
|
// src/commands/doctor.ts
|
|
@@ -10663,7 +11219,23 @@ var doctor = {
|
|
|
10663
11219
|
return "doctor";
|
|
10664
11220
|
},
|
|
10665
11221
|
type: "local-jsx",
|
|
10666
|
-
call(onDone) {
|
|
11222
|
+
async call(onDone, context, args) {
|
|
11223
|
+
if (isRuntimeJsonMode(args)) {
|
|
11224
|
+
const report = await getRuntimeHealthChecker(context)();
|
|
11225
|
+
const suggestions = buildRuntimeAssetHealthSuggestionLines(report).map(
|
|
11226
|
+
(line) => line.replace(/^Suggestion:\s*/, "")
|
|
11227
|
+
);
|
|
11228
|
+
onDone(
|
|
11229
|
+
JSON.stringify({
|
|
11230
|
+
status: report.status,
|
|
11231
|
+
checks: report.checks,
|
|
11232
|
+
errors: report.errors,
|
|
11233
|
+
suggestions,
|
|
11234
|
+
timestamp: report.timestamp
|
|
11235
|
+
})
|
|
11236
|
+
);
|
|
11237
|
+
return null;
|
|
11238
|
+
}
|
|
10667
11239
|
const element = React25.createElement(Doctor, {
|
|
10668
11240
|
onDone,
|
|
10669
11241
|
doctorMode: true
|
|
@@ -10671,6 +11243,15 @@ var doctor = {
|
|
|
10671
11243
|
return Promise.resolve(element);
|
|
10672
11244
|
}
|
|
10673
11245
|
};
|
|
11246
|
+
function getRuntimeHealthChecker(context) {
|
|
11247
|
+
const checker = context?.runtimeHealthChecker;
|
|
11248
|
+
return typeof checker === "function" ? checker : runRuntimeAssetHealthCheck;
|
|
11249
|
+
}
|
|
11250
|
+
function isRuntimeJsonMode(args) {
|
|
11251
|
+
const normalized = String(args ?? "").trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
11252
|
+
if (normalized.length < 2) return false;
|
|
11253
|
+
return normalized[0] === "runtime" && normalized.includes("--json");
|
|
11254
|
+
}
|
|
10674
11255
|
var doctor_default = doctor;
|
|
10675
11256
|
|
|
10676
11257
|
// src/ui/components/Help.tsx
|
|
@@ -10724,8 +11305,8 @@ var help_default = help;
|
|
|
10724
11305
|
// src/ui/components/ProjectOnboarding.tsx
|
|
10725
11306
|
import * as React28 from "react";
|
|
10726
11307
|
import { Box as Box21, Text as Text24 } from "ink";
|
|
10727
|
-
import { existsSync as
|
|
10728
|
-
import { join as
|
|
11308
|
+
import { existsSync as existsSync8 } from "fs";
|
|
11309
|
+
import { join as join6 } from "path";
|
|
10729
11310
|
import { homedir as homedir6 } from "os";
|
|
10730
11311
|
|
|
10731
11312
|
// src/constants/releaseNotes.ts
|
|
@@ -10773,7 +11354,7 @@ function ProjectOnboarding({
|
|
|
10773
11354
|
if (!showOnboarding && !hasReleaseNotes) {
|
|
10774
11355
|
return null;
|
|
10775
11356
|
}
|
|
10776
|
-
const workspaceHasProjectGuide =
|
|
11357
|
+
const workspaceHasProjectGuide = existsSync8(join6(workspaceDir, PROJECT_FILE));
|
|
10777
11358
|
const isWorkspaceDirEmpty = isDirEmpty(workspaceDir);
|
|
10778
11359
|
const shouldRecommendProjectGuide = !workspaceHasProjectGuide && !isWorkspaceDirEmpty;
|
|
10779
11360
|
const theme = getTheme();
|
|
@@ -10928,8 +11509,8 @@ function getReplStaticPrefixLength(orderedMessages, allMessages, unresolvedToolU
|
|
|
10928
11509
|
}
|
|
10929
11510
|
|
|
10930
11511
|
// src/commands/messages-debug.ts
|
|
10931
|
-
import { existsSync as
|
|
10932
|
-
import { join as
|
|
11512
|
+
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync6, statSync as statSync10 } from "fs";
|
|
11513
|
+
import { join as join7 } from "path";
|
|
10933
11514
|
function isDebugMode() {
|
|
10934
11515
|
return process.argv.includes("--debug") || process.argv.includes("--debug-verbose");
|
|
10935
11516
|
}
|
|
@@ -10960,15 +11541,15 @@ function getProgressText(message) {
|
|
|
10960
11541
|
}
|
|
10961
11542
|
function getLatestMessagesLogFile() {
|
|
10962
11543
|
const dir = CACHE_PATHS.messages();
|
|
10963
|
-
if (!
|
|
11544
|
+
if (!existsSync9(dir)) return null;
|
|
10964
11545
|
const files = readdirSync(dir).filter((f) => f.endsWith(".json"));
|
|
10965
11546
|
if (files.length === 0) return null;
|
|
10966
11547
|
let best = null;
|
|
10967
11548
|
for (const file of files) {
|
|
10968
|
-
const fullPath =
|
|
11549
|
+
const fullPath = join7(dir, file);
|
|
10969
11550
|
let mtimeMs = 0;
|
|
10970
11551
|
try {
|
|
10971
|
-
mtimeMs =
|
|
11552
|
+
mtimeMs = statSync10(fullPath).mtimeMs;
|
|
10972
11553
|
} catch {
|
|
10973
11554
|
continue;
|
|
10974
11555
|
}
|
|
@@ -11079,9 +11660,9 @@ var command3 = {
|
|
|
11079
11660
|
);
|
|
11080
11661
|
const { toolUseIDs, duplicates, byID } = summarizeToolUses(normalized);
|
|
11081
11662
|
const latestLog = getLatestMessagesLogFile();
|
|
11082
|
-
const latestLogContent = latestLog &&
|
|
11663
|
+
const latestLogContent = latestLog && existsSync9(latestLog.path) ? (() => {
|
|
11083
11664
|
try {
|
|
11084
|
-
return JSON.parse(
|
|
11665
|
+
return JSON.parse(readFileSync6(latestLog.path, "utf8"));
|
|
11085
11666
|
} catch {
|
|
11086
11667
|
return null;
|
|
11087
11668
|
}
|
|
@@ -11359,7 +11940,7 @@ async function createAndStoreApiKey(accessToken) {
|
|
|
11359
11940
|
}
|
|
11360
11941
|
saveGlobalConfig(config2);
|
|
11361
11942
|
try {
|
|
11362
|
-
const { resetAnthropicClient } = await import("./llm-
|
|
11943
|
+
const { resetAnthropicClient } = await import("./llm-VY6QQH5B.js");
|
|
11363
11944
|
resetAnthropicClient();
|
|
11364
11945
|
} catch {
|
|
11365
11946
|
}
|
|
@@ -15726,7 +16307,7 @@ async function refreshPluginRuntimeFromInstalls() {
|
|
|
15726
16307
|
const existingRoots = getSessionPlugins().map((p) => p.rootDir);
|
|
15727
16308
|
const dirs = Array.from(/* @__PURE__ */ new Set([...existingRoots, ...installedRoots]));
|
|
15728
16309
|
if (dirs.length === 0) return [];
|
|
15729
|
-
const { configureSessionPlugins } = await import("./pluginRuntime-
|
|
16310
|
+
const { configureSessionPlugins } = await import("./pluginRuntime-R57OZ4VU.js");
|
|
15730
16311
|
const { errors } = await configureSessionPlugins({ pluginDirs: dirs });
|
|
15731
16312
|
return errors;
|
|
15732
16313
|
}
|
|
@@ -16395,7 +16976,7 @@ async function call(onDone, context) {
|
|
|
16395
16976
|
ModelConfig,
|
|
16396
16977
|
{
|
|
16397
16978
|
onClose: () => {
|
|
16398
|
-
import("./model-
|
|
16979
|
+
import("./model-3NZZUFFU.js").then(({ reloadModelManager: reloadModelManager2 }) => {
|
|
16399
16980
|
reloadModelManager2();
|
|
16400
16981
|
triggerModelConfigChange();
|
|
16401
16982
|
onDone();
|
|
@@ -19025,17 +19606,17 @@ import { Box as Box54, Text as Text59 } from "ink";
|
|
|
19025
19606
|
|
|
19026
19607
|
// src/utils/session/taskStore.ts
|
|
19027
19608
|
import {
|
|
19028
|
-
existsSync as
|
|
19609
|
+
existsSync as existsSync10,
|
|
19029
19610
|
closeSync,
|
|
19030
19611
|
mkdirSync as mkdirSync5,
|
|
19031
19612
|
openSync,
|
|
19032
|
-
readFileSync as
|
|
19613
|
+
readFileSync as readFileSync7,
|
|
19033
19614
|
readdirSync as readdirSync2,
|
|
19034
19615
|
renameSync as renameSync2,
|
|
19035
19616
|
rmSync,
|
|
19036
19617
|
writeFileSync as writeFileSync3
|
|
19037
19618
|
} from "fs";
|
|
19038
|
-
import { join as
|
|
19619
|
+
import { join as join8 } from "path";
|
|
19039
19620
|
import { homedir as homedir7 } from "os";
|
|
19040
19621
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
19041
19622
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -19203,15 +19784,15 @@ function resolveGlobalTaskRootDir() {
|
|
|
19203
19784
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19204
19785
|
if (override) return override;
|
|
19205
19786
|
const home = homedir7();
|
|
19206
|
-
const pybDir =
|
|
19207
|
-
if (
|
|
19208
|
-
const claudeDir =
|
|
19209
|
-
if (
|
|
19787
|
+
const pybDir = join8(home, ".pyb");
|
|
19788
|
+
if (existsSync10(pybDir)) return pybDir;
|
|
19789
|
+
const claudeDir = join8(home, ".claude");
|
|
19790
|
+
if (existsSync10(claudeDir)) return claudeDir;
|
|
19210
19791
|
return pybDir;
|
|
19211
19792
|
}
|
|
19212
19793
|
function findBaseDirWithList(listId, candidates) {
|
|
19213
19794
|
for (const candidate of candidates) {
|
|
19214
|
-
if (
|
|
19795
|
+
if (existsSync10(join8(candidate, listId))) return candidate;
|
|
19215
19796
|
}
|
|
19216
19797
|
return null;
|
|
19217
19798
|
}
|
|
@@ -19248,39 +19829,39 @@ function getTaskListId(options) {
|
|
|
19248
19829
|
}
|
|
19249
19830
|
function resolveTaskBaseDir(context, cwd) {
|
|
19250
19831
|
if (context.scope === "project") {
|
|
19251
|
-
const pybDir =
|
|
19252
|
-
const claudeDir =
|
|
19253
|
-
const hasProjectPyb =
|
|
19254
|
-
const hasProjectClaude =
|
|
19832
|
+
const pybDir = join8(cwd, ".pyb");
|
|
19833
|
+
const claudeDir = join8(cwd, ".claude");
|
|
19834
|
+
const hasProjectPyb = existsSync10(pybDir);
|
|
19835
|
+
const hasProjectClaude = existsSync10(claudeDir);
|
|
19255
19836
|
const projectRoot = hasProjectPyb ? pybDir : hasProjectClaude ? claudeDir : pybDir;
|
|
19256
19837
|
const override2 = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19257
|
-
const defaultBaseDir2 = !hasProjectPyb && !hasProjectClaude && override2 ?
|
|
19838
|
+
const defaultBaseDir2 = !hasProjectPyb && !hasProjectClaude && override2 ? join8(override2, "tasks") : join8(projectRoot, "tasks");
|
|
19258
19839
|
const candidates2 = [
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
...override2 ? [
|
|
19840
|
+
join8(cwd, ".pyb", "tasks"),
|
|
19841
|
+
join8(cwd, ".claude", "tasks"),
|
|
19842
|
+
...override2 ? [join8(override2, "tasks")] : [],
|
|
19262
19843
|
resolveXdgDataPath("tasks")
|
|
19263
19844
|
];
|
|
19264
19845
|
return findBaseDirWithList(context.listId, candidates2) ?? defaultBaseDir2;
|
|
19265
19846
|
}
|
|
19266
19847
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19267
|
-
const globalCandidates = override ? [
|
|
19268
|
-
|
|
19269
|
-
|
|
19848
|
+
const globalCandidates = override ? [join8(override, "tasks")] : [
|
|
19849
|
+
join8(homedir7(), ".pyb", "tasks"),
|
|
19850
|
+
join8(homedir7(), ".claude", "tasks")
|
|
19270
19851
|
];
|
|
19271
|
-
const defaultBaseDir =
|
|
19852
|
+
const defaultBaseDir = join8(resolveGlobalTaskRootDir(), "tasks");
|
|
19272
19853
|
const candidates = [...globalCandidates, resolveXdgDataPath("tasks")];
|
|
19273
19854
|
return findBaseDirWithList(context.listId, candidates) ?? defaultBaseDir;
|
|
19274
19855
|
}
|
|
19275
19856
|
function buildTaskListPaths(baseDir, listId) {
|
|
19276
|
-
const listDir =
|
|
19857
|
+
const listDir = join8(baseDir, listId);
|
|
19277
19858
|
return {
|
|
19278
19859
|
listId,
|
|
19279
19860
|
baseDir,
|
|
19280
19861
|
listDir,
|
|
19281
19862
|
tasksDir: listDir,
|
|
19282
|
-
lockPath:
|
|
19283
|
-
highwatermarkPath:
|
|
19863
|
+
lockPath: join8(listDir, ".lock"),
|
|
19864
|
+
highwatermarkPath: join8(listDir, ".highwatermark")
|
|
19284
19865
|
};
|
|
19285
19866
|
}
|
|
19286
19867
|
function getTaskListPaths(listId) {
|
|
@@ -19294,26 +19875,26 @@ function sortReadPaths(paths) {
|
|
|
19294
19875
|
return [...paths].sort((a, b) => priority[a.source] - priority[b.source]);
|
|
19295
19876
|
}
|
|
19296
19877
|
function resolveSourceForBaseDir(baseDir) {
|
|
19297
|
-
if (baseDir.includes(`${
|
|
19298
|
-
if (baseDir.includes(`${
|
|
19299
|
-
if (baseDir.includes(`${
|
|
19300
|
-
if (baseDir.includes(`${
|
|
19878
|
+
if (baseDir.includes(`${join8(".pyb", "tasks")}`)) return "pyb";
|
|
19879
|
+
if (baseDir.includes(`${join8(".claude", "tasks")}`)) return "claude";
|
|
19880
|
+
if (baseDir.includes(`${join8(".pyb")}`)) return "pyb";
|
|
19881
|
+
if (baseDir.includes(`${join8(".claude")}`)) return "claude";
|
|
19301
19882
|
return "other";
|
|
19302
19883
|
}
|
|
19303
19884
|
function getTaskListReadPaths(listId) {
|
|
19304
19885
|
const context = getTaskListContext({ listId });
|
|
19305
19886
|
const cwd = getCwd();
|
|
19306
|
-
const projectPyb =
|
|
19307
|
-
const projectClaude =
|
|
19887
|
+
const projectPyb = join8(cwd, ".pyb", "tasks");
|
|
19888
|
+
const projectClaude = join8(cwd, ".claude", "tasks");
|
|
19308
19889
|
if (context.scope === "project") {
|
|
19309
19890
|
const existing2 = [];
|
|
19310
|
-
if (
|
|
19891
|
+
if (existsSync10(join8(projectPyb, context.listId))) {
|
|
19311
19892
|
existing2.push({
|
|
19312
19893
|
...buildTaskListPaths(projectPyb, context.listId),
|
|
19313
19894
|
source: "pyb"
|
|
19314
19895
|
});
|
|
19315
19896
|
}
|
|
19316
|
-
if (
|
|
19897
|
+
if (existsSync10(join8(projectClaude, context.listId))) {
|
|
19317
19898
|
existing2.push({
|
|
19318
19899
|
...buildTaskListPaths(projectClaude, context.listId),
|
|
19319
19900
|
source: "claude"
|
|
@@ -19324,18 +19905,18 @@ function getTaskListReadPaths(listId) {
|
|
|
19324
19905
|
const override = process.env.PYB_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR;
|
|
19325
19906
|
const globalCandidates = override ? [
|
|
19326
19907
|
{
|
|
19327
|
-
baseDir:
|
|
19328
|
-
source: resolveSourceForBaseDir(
|
|
19908
|
+
baseDir: join8(override, "tasks"),
|
|
19909
|
+
source: resolveSourceForBaseDir(join8(override, "tasks"))
|
|
19329
19910
|
}
|
|
19330
19911
|
] : [
|
|
19331
|
-
{ baseDir:
|
|
19332
|
-
{ baseDir:
|
|
19912
|
+
{ baseDir: join8(homedir7(), ".pyb", "tasks"), source: "pyb" },
|
|
19913
|
+
{ baseDir: join8(homedir7(), ".claude", "tasks"), source: "claude" }
|
|
19333
19914
|
];
|
|
19334
19915
|
const candidates = [
|
|
19335
19916
|
...globalCandidates,
|
|
19336
19917
|
{ baseDir: resolveXdgDataPath("tasks"), source: "other" }
|
|
19337
19918
|
];
|
|
19338
|
-
const existing = candidates.filter((candidate) =>
|
|
19919
|
+
const existing = candidates.filter((candidate) => existsSync10(join8(candidate.baseDir, context.listId))).map((candidate) => ({
|
|
19339
19920
|
...buildTaskListPaths(candidate.baseDir, context.listId),
|
|
19340
19921
|
source: candidate.source
|
|
19341
19922
|
}));
|
|
@@ -19350,27 +19931,27 @@ function getTaskListReadPaths(listId) {
|
|
|
19350
19931
|
}
|
|
19351
19932
|
function ensureTaskListDirs(paths) {
|
|
19352
19933
|
mkdirSync5(paths.listDir, { recursive: true });
|
|
19353
|
-
if (!
|
|
19934
|
+
if (!existsSync10(paths.lockPath)) {
|
|
19354
19935
|
writeFileSync3(paths.lockPath, "");
|
|
19355
19936
|
}
|
|
19356
19937
|
cleanupLegacyFiles(paths);
|
|
19357
19938
|
}
|
|
19358
|
-
function readJson(
|
|
19359
|
-
if (!
|
|
19939
|
+
function readJson(path6) {
|
|
19940
|
+
if (!existsSync10(path6)) return null;
|
|
19360
19941
|
try {
|
|
19361
|
-
const raw =
|
|
19942
|
+
const raw = readFileSync7(path6, "utf8");
|
|
19362
19943
|
return JSON.parse(raw);
|
|
19363
19944
|
} catch {
|
|
19364
19945
|
return null;
|
|
19365
19946
|
}
|
|
19366
19947
|
}
|
|
19367
|
-
function writeJson(
|
|
19368
|
-
writeFileSync3(
|
|
19948
|
+
function writeJson(path6, value) {
|
|
19949
|
+
writeFileSync3(path6, JSON.stringify(value, null, 2), "utf8");
|
|
19369
19950
|
}
|
|
19370
|
-
function writeJsonAtomic(
|
|
19371
|
-
const tempPath = `${
|
|
19951
|
+
function writeJsonAtomic(path6, value) {
|
|
19952
|
+
const tempPath = `${path6}.${randomUUID4()}.tmp`;
|
|
19372
19953
|
writeFileSync3(tempPath, JSON.stringify(value, null, 2), "utf8");
|
|
19373
|
-
renameSync2(tempPath,
|
|
19954
|
+
renameSync2(tempPath, path6);
|
|
19374
19955
|
}
|
|
19375
19956
|
function serializeTaskRecord(task) {
|
|
19376
19957
|
const serialized = {
|
|
@@ -19386,8 +19967,8 @@ function serializeTaskRecord(task) {
|
|
|
19386
19967
|
return serialized;
|
|
19387
19968
|
}
|
|
19388
19969
|
function readHighwatermark(paths) {
|
|
19389
|
-
if (!
|
|
19390
|
-
const raw =
|
|
19970
|
+
if (!existsSync10(paths.highwatermarkPath)) return null;
|
|
19971
|
+
const raw = readFileSync7(paths.highwatermarkPath, "utf8").trim();
|
|
19391
19972
|
const value = Number(raw);
|
|
19392
19973
|
if (!Number.isFinite(value) || value < 0) return null;
|
|
19393
19974
|
return value;
|
|
@@ -19402,8 +19983,8 @@ function updateHighwatermark(paths, value) {
|
|
|
19402
19983
|
const next = current !== null ? Math.max(current, value) : value;
|
|
19403
19984
|
writeHighwatermark(paths, next);
|
|
19404
19985
|
}
|
|
19405
|
-
function readTaskFile(
|
|
19406
|
-
const data = readJson(
|
|
19986
|
+
function readTaskFile(path6) {
|
|
19987
|
+
const data = readJson(path6);
|
|
19407
19988
|
if (!data || !data.id || !data.subject && !data.title || !data.status) {
|
|
19408
19989
|
return null;
|
|
19409
19990
|
}
|
|
@@ -19478,7 +20059,7 @@ function persistBlocksForPaths(paths) {
|
|
|
19478
20059
|
const prevBlockedBy = normalizeIds(existing?.blockedBy);
|
|
19479
20060
|
const nextBlockedBy = normalizeIds(task.blockedBy);
|
|
19480
20061
|
const raw = readJson(
|
|
19481
|
-
|
|
20062
|
+
join8(paths.tasksDir, `${task.id}.json`)
|
|
19482
20063
|
);
|
|
19483
20064
|
const missingBlocks = !raw || !("blocks" in raw);
|
|
19484
20065
|
const missingBlockedBy = !raw || !("blockedBy" in raw);
|
|
@@ -19487,7 +20068,7 @@ function persistBlocksForPaths(paths) {
|
|
|
19487
20068
|
if (!blocksChanged && !blockedByChanged && !missingBlocks && !missingBlockedBy)
|
|
19488
20069
|
continue;
|
|
19489
20070
|
updated += 1;
|
|
19490
|
-
writeJsonAtomic(
|
|
20071
|
+
writeJsonAtomic(join8(paths.tasksDir, `${task.id}.json`), serializeTaskRecord(task));
|
|
19491
20072
|
}
|
|
19492
20073
|
return { updated, total: rebuilt.length };
|
|
19493
20074
|
}
|
|
@@ -19519,9 +20100,9 @@ function applyLegacyBlocks(tasks) {
|
|
|
19519
20100
|
}));
|
|
19520
20101
|
}
|
|
19521
20102
|
function readTasksFromDisk(paths) {
|
|
19522
|
-
if (!
|
|
20103
|
+
if (!existsSync10(paths.tasksDir)) return [];
|
|
19523
20104
|
const files = readdirSync2(paths.tasksDir).filter((file) => file.endsWith(".json"));
|
|
19524
|
-
return files.map((file) => readTaskFile(
|
|
20105
|
+
return files.map((file) => readTaskFile(join8(paths.tasksDir, file))).filter(Boolean);
|
|
19525
20106
|
}
|
|
19526
20107
|
function applyBlocksMap(tasks, map) {
|
|
19527
20108
|
return tasks.map((task) => ({
|
|
@@ -19536,14 +20117,14 @@ function buildTaskListForPaths(paths) {
|
|
|
19536
20117
|
var legacyFiles = ["index.json", "meta.json", "events.jsonl"];
|
|
19537
20118
|
function cleanupLegacyFiles(paths) {
|
|
19538
20119
|
for (const file of legacyFiles) {
|
|
19539
|
-
const
|
|
19540
|
-
if (
|
|
19541
|
-
rmSync(
|
|
20120
|
+
const path6 = join8(paths.listDir, file);
|
|
20121
|
+
if (existsSync10(path6)) {
|
|
20122
|
+
rmSync(path6, { force: true });
|
|
19542
20123
|
}
|
|
19543
20124
|
}
|
|
19544
20125
|
}
|
|
19545
20126
|
function getMaxIdFromTasksDir(paths) {
|
|
19546
|
-
if (!
|
|
20127
|
+
if (!existsSync10(paths.tasksDir)) return 0;
|
|
19547
20128
|
const files = readdirSync2(paths.tasksDir).filter((file) => file.endsWith(".json"));
|
|
19548
20129
|
let maxId = 0;
|
|
19549
20130
|
for (const file of files) {
|
|
@@ -19718,7 +20299,7 @@ function createTask(input, options) {
|
|
|
19718
20299
|
blocks: [],
|
|
19719
20300
|
blockedBy: input.blockedBy ?? []
|
|
19720
20301
|
};
|
|
19721
|
-
writeJson(
|
|
20302
|
+
writeJson(join8(paths.tasksDir, `${id}.json`), serializeTaskRecord(record));
|
|
19722
20303
|
if ((record.blockedBy ?? []).length > 0) {
|
|
19723
20304
|
persistBlocksForPaths(paths);
|
|
19724
20305
|
}
|
|
@@ -19730,8 +20311,8 @@ function createTask(input, options) {
|
|
|
19730
20311
|
function getTask(id, options) {
|
|
19731
20312
|
const pathsList = getTaskListReadPaths(options?.listId);
|
|
19732
20313
|
for (const paths of pathsList) {
|
|
19733
|
-
const taskPath =
|
|
19734
|
-
if (!
|
|
20314
|
+
const taskPath = join8(paths.tasksDir, `${id}.json`);
|
|
20315
|
+
if (!existsSync10(taskPath)) continue;
|
|
19735
20316
|
const task = readTaskFile(taskPath);
|
|
19736
20317
|
if (task) return task;
|
|
19737
20318
|
}
|
|
@@ -19756,18 +20337,18 @@ function updateTask(id, updates, options) {
|
|
|
19756
20337
|
}
|
|
19757
20338
|
const pathsList = getTaskListReadPaths(options?.listId);
|
|
19758
20339
|
const target = pathsList.find(
|
|
19759
|
-
(paths) =>
|
|
20340
|
+
(paths) => existsSync10(join8(paths.tasksDir, `${id}.json`))
|
|
19760
20341
|
);
|
|
19761
20342
|
if (!target) {
|
|
19762
20343
|
throw new Error(`Task ${id} not found`);
|
|
19763
20344
|
}
|
|
19764
20345
|
return withTaskListLock(target, () => {
|
|
19765
|
-
const existing = readTaskFile(
|
|
20346
|
+
const existing = readTaskFile(join8(target.tasksDir, `${id}.json`));
|
|
19766
20347
|
if (!existing) {
|
|
19767
20348
|
throw new Error(`Task ${id} not found`);
|
|
19768
20349
|
}
|
|
19769
20350
|
const updated = applyTaskUpdates(existing, updates);
|
|
19770
|
-
writeJsonAtomic(
|
|
20351
|
+
writeJsonAtomic(join8(target.tasksDir, `${id}.json`), serializeTaskRecord(updated));
|
|
19771
20352
|
const depsChanged = normalizeIds(existing.blockedBy).join(",") !== normalizeIds(updated.blockedBy).join(",") || normalizeIds(existing.blocks).join(",") !== normalizeIds(updated.blocks).join(",");
|
|
19772
20353
|
if (depsChanged) {
|
|
19773
20354
|
persistBlocksForPaths(target);
|
|
@@ -19922,7 +20503,7 @@ function PermissionRequestTitle({
|
|
|
19922
20503
|
|
|
19923
20504
|
// src/ui/components/permissions/file-edit-permission-request/FileEditToolDiff.tsx
|
|
19924
20505
|
import * as React76 from "react";
|
|
19925
|
-
import { existsSync as
|
|
20506
|
+
import { existsSync as existsSync11, readFileSync as readFileSync8 } from "fs";
|
|
19926
20507
|
import { useMemo as useMemo14 } from "react";
|
|
19927
20508
|
import { Box as Box56, Text as Text61 } from "ink";
|
|
19928
20509
|
import { relative as relative10 } from "path";
|
|
@@ -19935,7 +20516,7 @@ function FileEditToolDiff({
|
|
|
19935
20516
|
width
|
|
19936
20517
|
}) {
|
|
19937
20518
|
const file = useMemo14(
|
|
19938
|
-
() =>
|
|
20519
|
+
() => existsSync11(file_path) ? readFileSync8(file_path, "utf8") : "",
|
|
19939
20520
|
[file_path]
|
|
19940
20521
|
);
|
|
19941
20522
|
const patch = useMemo14(
|
|
@@ -20560,12 +21141,12 @@ function useNotifyAfterTimeout(message, timeout = DEFAULT_INTERACTION_THRESHOLD_
|
|
|
20560
21141
|
import { Box as Box61, Text as Text66, useInput as useInput20 } from "ink";
|
|
20561
21142
|
import React81, { useCallback as useCallback9, useMemo as useMemo19 } from "react";
|
|
20562
21143
|
import { basename as basename2, dirname as dirname6, extname as extname8 } from "path";
|
|
20563
|
-
import { existsSync as
|
|
21144
|
+
import { existsSync as existsSync13 } from "fs";
|
|
20564
21145
|
import chalk10 from "chalk";
|
|
20565
21146
|
|
|
20566
21147
|
// src/ui/components/permissions/file-write-permission-request/FileWriteToolDiff.tsx
|
|
20567
21148
|
import * as React80 from "react";
|
|
20568
|
-
import { existsSync as
|
|
21149
|
+
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
20569
21150
|
import { useMemo as useMemo18 } from "react";
|
|
20570
21151
|
import { Box as Box60, Text as Text65 } from "ink";
|
|
20571
21152
|
import { extname as extname7, relative as relative11 } from "path";
|
|
@@ -20575,13 +21156,13 @@ function FileWriteToolDiff({
|
|
|
20575
21156
|
verbose,
|
|
20576
21157
|
width
|
|
20577
21158
|
}) {
|
|
20578
|
-
const fileExists = useMemo18(() =>
|
|
21159
|
+
const fileExists = useMemo18(() => existsSync12(file_path), [file_path]);
|
|
20579
21160
|
const oldContent = useMemo18(() => {
|
|
20580
21161
|
if (!fileExists) {
|
|
20581
21162
|
return "";
|
|
20582
21163
|
}
|
|
20583
21164
|
const enc = detectFileEncoding(file_path);
|
|
20584
|
-
return
|
|
21165
|
+
return readFileSync9(file_path, enc);
|
|
20585
21166
|
}, [file_path, fileExists]);
|
|
20586
21167
|
const hunks = useMemo18(() => {
|
|
20587
21168
|
if (!fileExists) {
|
|
@@ -20664,7 +21245,7 @@ function FileWritePermissionRequest({
|
|
|
20664
21245
|
);
|
|
20665
21246
|
return isInWorkingDir ? `Yes, allow all edits during this session ${shortcutHint}` : `Yes, allow all edits in ${chalk10.bold(`${dirName}/`)} during this session ${shortcutHint}`;
|
|
20666
21247
|
}, [file_path, isInWorkingDir, modeCycleShortcut.displayText]);
|
|
20667
|
-
const fileExists = useMemo19(() =>
|
|
21248
|
+
const fileExists = useMemo19(() => existsSync13(file_path), [file_path]);
|
|
20668
21249
|
const unaryEvent = useMemo19(
|
|
20669
21250
|
() => ({
|
|
20670
21251
|
completion_type: "write_file_single",
|
|
@@ -20814,7 +21395,7 @@ import { Box as Box62, Text as Text67, useInput as useInput21 } from "ink";
|
|
|
20814
21395
|
import React82, { useCallback as useCallback10, useMemo as useMemo20 } from "react";
|
|
20815
21396
|
import chalk11 from "chalk";
|
|
20816
21397
|
import { basename as basename3, dirname as dirname7 } from "path";
|
|
20817
|
-
import { statSync as
|
|
21398
|
+
import { statSync as statSync11 } from "fs";
|
|
20818
21399
|
function pathArgNameForToolUse(toolUseConfirm) {
|
|
20819
21400
|
switch (toolUseConfirm.tool) {
|
|
20820
21401
|
case FileWriteTool:
|
|
@@ -20841,13 +21422,13 @@ function isMultiFile(toolUseConfirm) {
|
|
|
20841
21422
|
}
|
|
20842
21423
|
return false;
|
|
20843
21424
|
}
|
|
20844
|
-
function pathToPermissionDirectory2(
|
|
21425
|
+
function pathToPermissionDirectory2(path6) {
|
|
20845
21426
|
try {
|
|
20846
|
-
const stats =
|
|
20847
|
-
if (stats.isDirectory()) return
|
|
21427
|
+
const stats = statSync11(path6);
|
|
21428
|
+
if (stats.isDirectory()) return path6;
|
|
20848
21429
|
} catch {
|
|
20849
21430
|
}
|
|
20850
|
-
return dirname7(
|
|
21431
|
+
return dirname7(path6);
|
|
20851
21432
|
}
|
|
20852
21433
|
function pathFromToolUse(toolUseConfirm) {
|
|
20853
21434
|
const pathArgName = pathArgNameForToolUse(toolUseConfirm);
|
|
@@ -20866,8 +21447,8 @@ function FilesystemPermissionRequest({
|
|
|
20866
21447
|
onDone,
|
|
20867
21448
|
verbose
|
|
20868
21449
|
}) {
|
|
20869
|
-
const
|
|
20870
|
-
if (!
|
|
21450
|
+
const path6 = pathFromToolUse(toolUseConfirm);
|
|
21451
|
+
if (!path6) {
|
|
20871
21452
|
return /* @__PURE__ */ React82.createElement(
|
|
20872
21453
|
FallbackPermissionRequest,
|
|
20873
21454
|
{
|
|
@@ -20881,15 +21462,15 @@ function FilesystemPermissionRequest({
|
|
|
20881
21462
|
FilesystemPermissionRequestImpl,
|
|
20882
21463
|
{
|
|
20883
21464
|
toolUseConfirm,
|
|
20884
|
-
path:
|
|
21465
|
+
path: path6,
|
|
20885
21466
|
onDone,
|
|
20886
21467
|
verbose
|
|
20887
21468
|
}
|
|
20888
21469
|
);
|
|
20889
21470
|
}
|
|
20890
|
-
function getDontAskAgainOptions(toolUseConfirm,
|
|
21471
|
+
function getDontAskAgainOptions(toolUseConfirm, path6, modeCycleShortcut, isInWorkingDir, hasSessionSuggestion) {
|
|
20891
21472
|
if (!hasSessionSuggestion) return [];
|
|
20892
|
-
const permissionDirPath = pathToPermissionDirectory2(
|
|
21473
|
+
const permissionDirPath = pathToPermissionDirectory2(path6);
|
|
20893
21474
|
const permissionDirName = basename3(permissionDirPath) || "this directory";
|
|
20894
21475
|
if (toolUseConfirm.tool.isReadOnly(toolUseConfirm.input)) {
|
|
20895
21476
|
const label2 = isInWorkingDir ? "Yes, during this session" : `Yes, allow reading from ${chalk11.bold(`${permissionDirName}/`)} during this session`;
|
|
@@ -20921,7 +21502,7 @@ function applySessionPermissionUpdates3(args) {
|
|
|
20921
21502
|
}
|
|
20922
21503
|
function FilesystemPermissionRequestImpl({
|
|
20923
21504
|
toolUseConfirm,
|
|
20924
|
-
path:
|
|
21505
|
+
path: path6,
|
|
20925
21506
|
onDone,
|
|
20926
21507
|
verbose
|
|
20927
21508
|
}) {
|
|
@@ -20956,8 +21537,8 @@ function FilesystemPermissionRequestImpl({
|
|
|
20956
21537
|
toolUseConfirm
|
|
20957
21538
|
]);
|
|
20958
21539
|
const permissionDirPath = useMemo20(
|
|
20959
|
-
() => pathToPermissionDirectory2(
|
|
20960
|
-
[
|
|
21540
|
+
() => pathToPermissionDirectory2(path6),
|
|
21541
|
+
[path6]
|
|
20961
21542
|
);
|
|
20962
21543
|
const isInWorkingDir = useMemo20(
|
|
20963
21544
|
() => isPathInWorkingDirectories(permissionDirPath, toolPermissionContext),
|
|
@@ -21051,7 +21632,7 @@ function FilesystemPermissionRequestImpl({
|
|
|
21051
21632
|
},
|
|
21052
21633
|
...getDontAskAgainOptions(
|
|
21053
21634
|
toolUseConfirm,
|
|
21054
|
-
|
|
21635
|
+
path6,
|
|
21055
21636
|
modeCycleShortcut.displayText,
|
|
21056
21637
|
isInWorkingDir,
|
|
21057
21638
|
hasSessionSuggestion
|
|
@@ -22289,8 +22870,8 @@ function getCompletionContext(args) {
|
|
|
22289
22870
|
}
|
|
22290
22871
|
|
|
22291
22872
|
// src/utils/completion/fileSuggestions.ts
|
|
22292
|
-
import { existsSync as
|
|
22293
|
-
import { basename as basename4, dirname as dirname8, join as
|
|
22873
|
+
import { existsSync as existsSync14, readdirSync as readdirSync3, statSync as statSync12 } from "fs";
|
|
22874
|
+
import { basename as basename4, dirname as dirname8, join as join9, resolve as resolve8 } from "path";
|
|
22294
22875
|
function generateFileSuggestions(args) {
|
|
22295
22876
|
const { prefix, cwd } = args;
|
|
22296
22877
|
try {
|
|
@@ -22306,7 +22887,7 @@ function generateFileSuggestions(args) {
|
|
|
22306
22887
|
searchPath = resolve8(cwd, userPath);
|
|
22307
22888
|
}
|
|
22308
22889
|
const endsWithSlash = userPath.endsWith("/");
|
|
22309
|
-
const searchStat =
|
|
22890
|
+
const searchStat = existsSync14(searchPath) ? statSync12(searchPath) : null;
|
|
22310
22891
|
let searchDir;
|
|
22311
22892
|
let nameFilter;
|
|
22312
22893
|
if (endsWithSlash || searchStat?.isDirectory()) {
|
|
@@ -22316,7 +22897,7 @@ function generateFileSuggestions(args) {
|
|
|
22316
22897
|
searchDir = dirname8(searchPath);
|
|
22317
22898
|
nameFilter = basename4(searchPath);
|
|
22318
22899
|
}
|
|
22319
|
-
if (!
|
|
22900
|
+
if (!existsSync14(searchDir)) return [];
|
|
22320
22901
|
const showHidden = nameFilter.startsWith(".") || userPath.includes("/.");
|
|
22321
22902
|
const entries = readdirSync3(searchDir).filter((entry) => {
|
|
22322
22903
|
if (!showHidden && entry.startsWith(".")) return false;
|
|
@@ -22324,17 +22905,17 @@ function generateFileSuggestions(args) {
|
|
|
22324
22905
|
return false;
|
|
22325
22906
|
return true;
|
|
22326
22907
|
}).sort((a, b) => {
|
|
22327
|
-
const aPath =
|
|
22328
|
-
const bPath =
|
|
22329
|
-
const aIsDir =
|
|
22330
|
-
const bIsDir =
|
|
22908
|
+
const aPath = join9(searchDir, a);
|
|
22909
|
+
const bPath = join9(searchDir, b);
|
|
22910
|
+
const aIsDir = statSync12(aPath).isDirectory();
|
|
22911
|
+
const bIsDir = statSync12(bPath).isDirectory();
|
|
22331
22912
|
if (aIsDir && !bIsDir) return -1;
|
|
22332
22913
|
if (!aIsDir && bIsDir) return 1;
|
|
22333
22914
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
22334
22915
|
}).slice(0, 25);
|
|
22335
22916
|
return entries.map((entry) => {
|
|
22336
|
-
const entryPath =
|
|
22337
|
-
const isDir =
|
|
22917
|
+
const entryPath = join9(searchDir, entry);
|
|
22918
|
+
const isDir = statSync12(entryPath).isDirectory();
|
|
22338
22919
|
const icon = isDir ? "\u{1F4C1}" : "\u{1F4C4}";
|
|
22339
22920
|
let value;
|
|
22340
22921
|
if (userPath.includes("/")) {
|
|
@@ -23667,19 +24248,19 @@ function useUnifiedCompletion({
|
|
|
23667
24248
|
if (systemCommands.length > 0 || isLoadingCommands) return;
|
|
23668
24249
|
setIsLoadingCommands(true);
|
|
23669
24250
|
try {
|
|
23670
|
-
const { readdirSync: readdirSync4, statSync:
|
|
24251
|
+
const { readdirSync: readdirSync4, statSync: statSync15 } = await import("fs");
|
|
23671
24252
|
const pathDirs = (process.env.PATH || "").split(":").filter(Boolean);
|
|
23672
24253
|
const commandSet = /* @__PURE__ */ new Set();
|
|
23673
24254
|
const essentialCommands = getEssentialCommands();
|
|
23674
24255
|
essentialCommands.forEach((cmd) => commandSet.add(cmd));
|
|
23675
24256
|
for (const dir of pathDirs) {
|
|
23676
24257
|
try {
|
|
23677
|
-
if (readdirSync4 &&
|
|
24258
|
+
if (readdirSync4 && statSync15) {
|
|
23678
24259
|
const entries = readdirSync4(dir);
|
|
23679
24260
|
for (const entry of entries) {
|
|
23680
24261
|
try {
|
|
23681
24262
|
const fullPath = `${dir}/${entry}`;
|
|
23682
|
-
const stats =
|
|
24263
|
+
const stats = statSync15(fullPath);
|
|
23683
24264
|
if (stats.isFile() && (stats.mode & 73) !== 0) {
|
|
23684
24265
|
commandSet.add(entry);
|
|
23685
24266
|
}
|
|
@@ -24222,9 +24803,9 @@ function TokenWarning({ tokenUsage }) {
|
|
|
24222
24803
|
|
|
24223
24804
|
// src/utils/system/externalEditor.ts
|
|
24224
24805
|
import { spawn, spawnSync } from "child_process";
|
|
24225
|
-
import { mkdtempSync, readFileSync as
|
|
24806
|
+
import { mkdtempSync, readFileSync as readFileSync10, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
24226
24807
|
import { tmpdir } from "os";
|
|
24227
|
-
import { join as
|
|
24808
|
+
import { join as join10 } from "path";
|
|
24228
24809
|
var isWindows = process.platform === "win32";
|
|
24229
24810
|
function isCommandAvailable(command4) {
|
|
24230
24811
|
const checker = isWindows ? "where" : "which";
|
|
@@ -24300,8 +24881,8 @@ async function launchExternalEditor(initialText) {
|
|
|
24300
24881
|
)
|
|
24301
24882
|
};
|
|
24302
24883
|
}
|
|
24303
|
-
const dir = mkdtempSync(
|
|
24304
|
-
const filePath =
|
|
24884
|
+
const dir = mkdtempSync(join10(tmpdir(), "pyb-edit-"));
|
|
24885
|
+
const filePath = join10(dir, "message.txt");
|
|
24305
24886
|
writeFileSync4(filePath, initialText, "utf-8");
|
|
24306
24887
|
const wasRaw = Boolean(process.stdin.isTTY && process.stdin.isRaw);
|
|
24307
24888
|
if (process.stdin.isTTY) {
|
|
@@ -24344,7 +24925,7 @@ async function launchExternalEditor(initialText) {
|
|
|
24344
24925
|
}
|
|
24345
24926
|
restoreStdinState(wasRaw);
|
|
24346
24927
|
try {
|
|
24347
|
-
const edited = normalizeNewlines(
|
|
24928
|
+
const edited = normalizeNewlines(readFileSync10(filePath, "utf-8"));
|
|
24348
24929
|
rmSync2(dir, { recursive: true, force: true });
|
|
24349
24930
|
return { text: edited, editorLabel: editorCommand.displayName };
|
|
24350
24931
|
} catch (error) {
|
|
@@ -24358,17 +24939,17 @@ async function launchExternalEditor(initialText) {
|
|
|
24358
24939
|
}
|
|
24359
24940
|
|
|
24360
24941
|
// src/utils/commands/hashCommand.ts
|
|
24361
|
-
import { join as
|
|
24362
|
-
import { readFileSync as
|
|
24942
|
+
import { join as join11 } from "path";
|
|
24943
|
+
import { readFileSync as readFileSync11, writeFileSync as writeFileSync5 } from "fs";
|
|
24363
24944
|
function handleHashCommand(interpreted) {
|
|
24364
24945
|
try {
|
|
24365
24946
|
const cwd = process.cwd();
|
|
24366
|
-
const agentsPath =
|
|
24367
|
-
const legacyPath =
|
|
24947
|
+
const agentsPath = join11(cwd, "AGENTS.md");
|
|
24948
|
+
const legacyPath = join11(cwd, "CLAUDE.md");
|
|
24368
24949
|
const filesToUpdate = [];
|
|
24369
24950
|
filesToUpdate.push({ path: agentsPath, name: "AGENTS.md" });
|
|
24370
24951
|
try {
|
|
24371
|
-
|
|
24952
|
+
readFileSync11(legacyPath, "utf-8");
|
|
24372
24953
|
filesToUpdate.push({ path: legacyPath, name: "CLAUDE.md" });
|
|
24373
24954
|
} catch {
|
|
24374
24955
|
}
|
|
@@ -24383,7 +24964,7 @@ _Added on ${now.toLocaleString()} ${timezone}_`;
|
|
|
24383
24964
|
try {
|
|
24384
24965
|
let existingContent = "";
|
|
24385
24966
|
try {
|
|
24386
|
-
existingContent =
|
|
24967
|
+
existingContent = readFileSync11(file.path, "utf-8").trim();
|
|
24387
24968
|
} catch {
|
|
24388
24969
|
}
|
|
24389
24970
|
const separator = existingContent ? "\n\n" : "";
|
|
@@ -24512,7 +25093,7 @@ function logStartupProfile(event) {
|
|
|
24512
25093
|
import { useEffect as useEffect21, useRef as useRef10, useState as useState24 } from "react";
|
|
24513
25094
|
|
|
24514
25095
|
// src/services/ui/statusline.ts
|
|
24515
|
-
import { join as
|
|
25096
|
+
import { join as join12 } from "path";
|
|
24516
25097
|
function normalizeString(value) {
|
|
24517
25098
|
if (typeof value !== "string") return null;
|
|
24518
25099
|
const trimmed = value.trim();
|
|
@@ -24531,7 +25112,7 @@ function getStatusLineCommand(options) {
|
|
|
24531
25112
|
const configDir = normalizeString(options?.configDir);
|
|
24532
25113
|
if (configDir) {
|
|
24533
25114
|
const settings2 = readSettingsFile(
|
|
24534
|
-
|
|
25115
|
+
join12(configDir, "settings.json")
|
|
24535
25116
|
);
|
|
24536
25117
|
const command4 = getCommandFromSettings(settings2 ?? {});
|
|
24537
25118
|
if (command4) return command4;
|
|
@@ -24599,7 +25180,7 @@ function useStatusLine() {
|
|
|
24599
25180
|
// src/ui/components/PromptInput.tsx
|
|
24600
25181
|
async function interpretHashCommand(input) {
|
|
24601
25182
|
try {
|
|
24602
|
-
const { queryQuick: queryQuick2 } = await import("./llm-
|
|
25183
|
+
const { queryQuick: queryQuick2 } = await import("./llm-VY6QQH5B.js");
|
|
24603
25184
|
const systemPrompt = [
|
|
24604
25185
|
"You're helping the user structure notes that will be added to their PYB.md file.",
|
|
24605
25186
|
"Format the user's input into a well-structured note that will be useful for later reference.",
|
|
@@ -24912,7 +25493,7 @@ function PromptInput({
|
|
|
24912
25493
|
if (messages2.length) {
|
|
24913
25494
|
if (mode === "bash") {
|
|
24914
25495
|
onQuery(messages2, newAbortController).then(async () => {
|
|
24915
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
25496
|
+
const { getCwd: getCwd2 } = await import("./state-35W4BKTE.js");
|
|
24916
25497
|
setCurrentPwd(getCwd2());
|
|
24917
25498
|
});
|
|
24918
25499
|
} else {
|
|
@@ -25679,7 +26260,7 @@ As you answer the user's questions, you can use the following context:
|
|
|
25679
26260
|
}
|
|
25680
26261
|
|
|
25681
26262
|
// src/services/system/taskWatcher.ts
|
|
25682
|
-
import { existsSync as
|
|
26263
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync6, statSync as statSync13, watch } from "fs";
|
|
25683
26264
|
|
|
25684
26265
|
// src/utils/session/taskGraph.ts
|
|
25685
26266
|
function buildTaskGraph(tasks) {
|
|
@@ -25779,8 +26360,8 @@ function ensureDirs(paths) {
|
|
|
25779
26360
|
}
|
|
25780
26361
|
function getLatestMtime(dir) {
|
|
25781
26362
|
try {
|
|
25782
|
-
if (!
|
|
25783
|
-
const entries =
|
|
26363
|
+
if (!existsSync15(dir)) return 0;
|
|
26364
|
+
const entries = statSync13(dir);
|
|
25784
26365
|
if (!entries.isDirectory()) return 0;
|
|
25785
26366
|
return entries.mtimeMs;
|
|
25786
26367
|
} catch {
|
|
@@ -25929,17 +26510,6 @@ async function selectAndReadFiles() {
|
|
|
25929
26510
|
return results;
|
|
25930
26511
|
}
|
|
25931
26512
|
|
|
25932
|
-
// src/services/telemetry/eventBus.ts
|
|
25933
|
-
var listeners2 = /* @__PURE__ */ new Map();
|
|
25934
|
-
function registerTelemetryListener(listenerId, listener) {
|
|
25935
|
-
listeners2.set(listenerId, listener);
|
|
25936
|
-
}
|
|
25937
|
-
function emitTelemetryEvent(event) {
|
|
25938
|
-
for (const listener of listeners2.values()) {
|
|
25939
|
-
listener(event);
|
|
25940
|
-
}
|
|
25941
|
-
}
|
|
25942
|
-
|
|
25943
26513
|
// src/utils/session/autoCompactMetrics.ts
|
|
25944
26514
|
function safeDivide(numerator, denominator) {
|
|
25945
26515
|
if (denominator <= 0) return 0;
|
|
@@ -26270,8 +26840,8 @@ function getModelCapabilities(modelName) {
|
|
|
26270
26840
|
}
|
|
26271
26841
|
|
|
26272
26842
|
// src/services/ai/policyDispatch/policyConfigLoader.ts
|
|
26273
|
-
import { existsSync as
|
|
26274
|
-
import { join as
|
|
26843
|
+
import { existsSync as existsSync16, readFileSync as readFileSync12 } from "fs";
|
|
26844
|
+
import { join as join13, resolve as resolve9 } from "path";
|
|
26275
26845
|
|
|
26276
26846
|
// src/services/ai/policyDispatch/policyConfigSchema.ts
|
|
26277
26847
|
import { z as z11 } from "zod";
|
|
@@ -26313,13 +26883,13 @@ function getModelFamily(model) {
|
|
|
26313
26883
|
return segments.length >= 2 ? `${segments[0]}-${segments[1]}` : normalized;
|
|
26314
26884
|
}
|
|
26315
26885
|
function getDefaultPolicyConfigPath() {
|
|
26316
|
-
return resolve9(
|
|
26886
|
+
return resolve9(join13(process.cwd(), "config/auto-compact-policy.config.json"));
|
|
26317
26887
|
}
|
|
26318
26888
|
function loadAutoCompactPolicyConfig(options) {
|
|
26319
26889
|
const filePath = resolve9(options?.filePath ?? getDefaultPolicyConfigPath());
|
|
26320
|
-
if (!
|
|
26890
|
+
if (!existsSync16(filePath)) return null;
|
|
26321
26891
|
try {
|
|
26322
|
-
const raw =
|
|
26892
|
+
const raw = readFileSync12(filePath, "utf8");
|
|
26323
26893
|
const parsed = JSON.parse(raw);
|
|
26324
26894
|
return policyConfigSchema.parse(parsed);
|
|
26325
26895
|
} catch {
|
|
@@ -26552,7 +27122,7 @@ function flushTypedParts(state) {
|
|
|
26552
27122
|
}
|
|
26553
27123
|
|
|
26554
27124
|
// src/services/ai/streamTyped/partStore.ts
|
|
26555
|
-
import { appendFileSync, existsSync as
|
|
27125
|
+
import { appendFileSync, existsSync as existsSync17, mkdirSync as mkdirSync7, readFileSync as readFileSync13 } from "fs";
|
|
26556
27126
|
import { dirname as dirname9 } from "path";
|
|
26557
27127
|
function getStreamTypedOutputFilePath() {
|
|
26558
27128
|
return resolveXdgCachePath("telemetry/stream-typed-parts.jsonl");
|
|
@@ -26561,8 +27131,8 @@ function validateTypedPartRecord(record) {
|
|
|
26561
27131
|
return streamTypedPartSchema.safeParse(record).success;
|
|
26562
27132
|
}
|
|
26563
27133
|
function readAllValidParts(outputFilePath) {
|
|
26564
|
-
if (!
|
|
26565
|
-
const raw =
|
|
27134
|
+
if (!existsSync17(outputFilePath)) return [];
|
|
27135
|
+
const raw = readFileSync13(outputFilePath, "utf8");
|
|
26566
27136
|
const lines = raw.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
26567
27137
|
const parts = [];
|
|
26568
27138
|
for (const line of lines) {
|
|
@@ -26581,7 +27151,7 @@ function appendTypedParts(options) {
|
|
|
26581
27151
|
return { appended: 0 };
|
|
26582
27152
|
}
|
|
26583
27153
|
const outputFilePath = options.outputFilePath ?? getStreamTypedOutputFilePath();
|
|
26584
|
-
if (!
|
|
27154
|
+
if (!existsSync17(dirname9(outputFilePath))) {
|
|
26585
27155
|
mkdirSync7(dirname9(outputFilePath), { recursive: true });
|
|
26586
27156
|
}
|
|
26587
27157
|
const existingIds = new Set(readAllValidParts(outputFilePath).map((item) => item.id));
|
|
@@ -27240,7 +27810,7 @@ ${contentWithLines}
|
|
|
27240
27810
|
}
|
|
27241
27811
|
|
|
27242
27812
|
// src/services/telemetry/autoCompactTelemetryPersistence.ts
|
|
27243
|
-
import { appendFileSync as appendFileSync2, existsSync as
|
|
27813
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync18, mkdirSync as mkdirSync8 } from "fs";
|
|
27244
27814
|
import { dirname as dirname10 } from "path";
|
|
27245
27815
|
function getAutoCompactTelemetryOutputFilePath() {
|
|
27246
27816
|
return resolveXdgCachePath("telemetry/auto-compact-metrics.jsonl");
|
|
@@ -27256,7 +27826,7 @@ function flushAutoCompactTelemetrySnapshot(options = {}) {
|
|
|
27256
27826
|
eventCount: snapshot.eventCount,
|
|
27257
27827
|
metrics: snapshot.metrics
|
|
27258
27828
|
};
|
|
27259
|
-
if (!
|
|
27829
|
+
if (!existsSync18(dirname10(outputFilePath))) {
|
|
27260
27830
|
mkdirSync8(dirname10(outputFilePath), { recursive: true });
|
|
27261
27831
|
}
|
|
27262
27832
|
appendFileSync2(outputFilePath, JSON.stringify(record) + "\n");
|
|
@@ -29311,7 +29881,7 @@ import React101, { useCallback as useCallback17, useEffect as useEffect26, useMe
|
|
|
29311
29881
|
import { Box as Box74, Text as Text78, useInput as useInput28 } from "ink";
|
|
29312
29882
|
import figures9 from "figures";
|
|
29313
29883
|
import chalk15 from "chalk";
|
|
29314
|
-
import { join as
|
|
29884
|
+
import { join as join15 } from "path";
|
|
29315
29885
|
import { spawn as spawn2 } from "child_process";
|
|
29316
29886
|
|
|
29317
29887
|
// src/commands/agents/tooling.ts
|
|
@@ -29366,19 +29936,19 @@ async function getAvailableTools() {
|
|
|
29366
29936
|
|
|
29367
29937
|
// src/commands/agents/storage.ts
|
|
29368
29938
|
import {
|
|
29369
|
-
existsSync as
|
|
29939
|
+
existsSync as existsSync19,
|
|
29370
29940
|
mkdirSync as mkdirSync9,
|
|
29371
29941
|
renameSync as renameSync3,
|
|
29372
29942
|
unlinkSync as unlinkSync2,
|
|
29373
29943
|
writeFileSync as writeFileSync6
|
|
29374
29944
|
} from "fs";
|
|
29375
|
-
import { join as
|
|
29945
|
+
import { join as join14 } from "path";
|
|
29376
29946
|
import { homedir as homedir8 } from "os";
|
|
29377
29947
|
|
|
29378
29948
|
// src/commands/agents/generation.ts
|
|
29379
29949
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
29380
29950
|
async function generateAgentWithClaude(prompt) {
|
|
29381
|
-
const { queryModel } = await import("./llm-
|
|
29951
|
+
const { queryModel } = await import("./llm-VY6QQH5B.js");
|
|
29382
29952
|
const systemPrompt = `You are an expert at creating AI agent configurations. Based on the user's description, generate a specialized agent configuration.
|
|
29383
29953
|
|
|
29384
29954
|
Return your response as a JSON object with exactly these fields:
|
|
@@ -29562,25 +30132,25 @@ var LEGACY_FOLDER = ".claude";
|
|
|
29562
30132
|
var AGENTS_DIR = "agents";
|
|
29563
30133
|
function getAgentDirectory(location) {
|
|
29564
30134
|
if (location === "user") {
|
|
29565
|
-
return
|
|
30135
|
+
return join14(homedir8(), PRIMARY_FOLDER, AGENTS_DIR);
|
|
29566
30136
|
}
|
|
29567
|
-
return
|
|
30137
|
+
return join14(getCwd(), PRIMARY_FOLDER, AGENTS_DIR);
|
|
29568
30138
|
}
|
|
29569
30139
|
function getLegacyAgentDirectory(location) {
|
|
29570
30140
|
if (location === "user") {
|
|
29571
|
-
return
|
|
30141
|
+
return join14(homedir8(), LEGACY_FOLDER, AGENTS_DIR);
|
|
29572
30142
|
}
|
|
29573
|
-
return
|
|
30143
|
+
return join14(getCwd(), LEGACY_FOLDER, AGENTS_DIR);
|
|
29574
30144
|
}
|
|
29575
30145
|
function getPrimaryAgentFilePath(location, agentType) {
|
|
29576
|
-
return
|
|
30146
|
+
return join14(getAgentDirectory(location), `${agentType}.md`);
|
|
29577
30147
|
}
|
|
29578
30148
|
function getLegacyAgentFilePath(location, agentType) {
|
|
29579
|
-
return
|
|
30149
|
+
return join14(getLegacyAgentDirectory(location), `${agentType}.md`);
|
|
29580
30150
|
}
|
|
29581
30151
|
function ensureDirectoryExists(location) {
|
|
29582
30152
|
const dir = getAgentDirectory(location);
|
|
29583
|
-
if (!
|
|
30153
|
+
if (!existsSync19(dir)) {
|
|
29584
30154
|
mkdirSync9(dir, { recursive: true });
|
|
29585
30155
|
}
|
|
29586
30156
|
return dir;
|
|
@@ -29589,7 +30159,7 @@ async function saveAgent(location, agentType, description3, tools, systemPrompt,
|
|
|
29589
30159
|
ensureDirectoryExists(location);
|
|
29590
30160
|
const filePath = getPrimaryAgentFilePath(location, agentType);
|
|
29591
30161
|
const legacyPath = getLegacyAgentFilePath(location, agentType);
|
|
29592
|
-
if (throwIfExists && (
|
|
30162
|
+
if (throwIfExists && (existsSync19(filePath) || existsSync19(legacyPath))) {
|
|
29593
30163
|
throw new Error(`Agent file already exists: ${filePath}`);
|
|
29594
30164
|
}
|
|
29595
30165
|
const tempFile = `${filePath}.tmp.${Date.now()}.${Math.random().toString(36).substr(2, 9)}`;
|
|
@@ -29604,7 +30174,7 @@ async function saveAgent(location, agentType, description3, tools, systemPrompt,
|
|
|
29604
30174
|
);
|
|
29605
30175
|
try {
|
|
29606
30176
|
writeFileSync6(tempFile, content, { encoding: "utf-8", flag: "wx" });
|
|
29607
|
-
if (throwIfExists && (
|
|
30177
|
+
if (throwIfExists && (existsSync19(filePath) || existsSync19(legacyPath))) {
|
|
29608
30178
|
try {
|
|
29609
30179
|
unlinkSync2(tempFile);
|
|
29610
30180
|
} catch {
|
|
@@ -29614,7 +30184,7 @@ async function saveAgent(location, agentType, description3, tools, systemPrompt,
|
|
|
29614
30184
|
renameSync3(tempFile, filePath);
|
|
29615
30185
|
} catch (error) {
|
|
29616
30186
|
try {
|
|
29617
|
-
if (
|
|
30187
|
+
if (existsSync19(tempFile)) {
|
|
29618
30188
|
unlinkSync2(tempFile);
|
|
29619
30189
|
}
|
|
29620
30190
|
} catch (cleanupError) {
|
|
@@ -29642,7 +30212,7 @@ async function updateAgent(agent, description3, tools, systemPrompt, color, mode
|
|
|
29642
30212
|
const location = agent.location;
|
|
29643
30213
|
const primaryPath = getPrimaryAgentFilePath(location, agent.agentType);
|
|
29644
30214
|
const legacyPath = getLegacyAgentFilePath(location, agent.agentType);
|
|
29645
|
-
const filePath =
|
|
30215
|
+
const filePath = existsSync19(primaryPath) ? primaryPath : existsSync19(legacyPath) ? legacyPath : primaryPath;
|
|
29646
30216
|
ensureDirectoryExists(location);
|
|
29647
30217
|
writeFileSync6(filePath, content, { encoding: "utf-8", flag: "w" });
|
|
29648
30218
|
}
|
|
@@ -29653,10 +30223,10 @@ async function deleteAgent(agent) {
|
|
|
29653
30223
|
const location = agent.location;
|
|
29654
30224
|
const primaryPath = getPrimaryAgentFilePath(location, agent.agentType);
|
|
29655
30225
|
const legacyPath = getLegacyAgentFilePath(location, agent.agentType);
|
|
29656
|
-
if (
|
|
30226
|
+
if (existsSync19(primaryPath)) {
|
|
29657
30227
|
unlinkSync2(primaryPath);
|
|
29658
30228
|
}
|
|
29659
|
-
if (
|
|
30229
|
+
if (existsSync19(legacyPath)) {
|
|
29660
30230
|
unlinkSync2(legacyPath);
|
|
29661
30231
|
}
|
|
29662
30232
|
}
|
|
@@ -30603,8 +31173,8 @@ function CreateAgentWizard(props) {
|
|
|
30603
31173
|
true
|
|
30604
31174
|
);
|
|
30605
31175
|
if (openEditor) {
|
|
30606
|
-
const
|
|
30607
|
-
await openInEditor(
|
|
31176
|
+
const path6 = getPrimaryAgentFilePath(location, finalAgent.agentType);
|
|
31177
|
+
await openInEditor(path6);
|
|
30608
31178
|
props.onComplete(
|
|
30609
31179
|
`Created agent: ${chalk15.bold(finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`
|
|
30610
31180
|
);
|
|
@@ -30674,8 +31244,8 @@ function ViewAgent(props) {
|
|
|
30674
31244
|
if (props.agent.source === "plugin") return `Plugin: ${props.agent.baseDir ?? "Unknown"}`;
|
|
30675
31245
|
const baseDir = props.agent.baseDir;
|
|
30676
31246
|
const file = `${props.agent.filename ?? props.agent.agentType}.md`;
|
|
30677
|
-
if (props.agent.source === "projectSettings") return
|
|
30678
|
-
if (baseDir) return
|
|
31247
|
+
if (props.agent.source === "projectSettings") return join15(".claude", "agents", file);
|
|
31248
|
+
if (baseDir) return join15(baseDir, file);
|
|
30679
31249
|
return props.agent.source;
|
|
30680
31250
|
})();
|
|
30681
31251
|
const toolsSummary = () => {
|
|
@@ -32885,7 +33455,7 @@ ${footerParts.join(" ")}`;
|
|
|
32885
33455
|
for (const filePath of filePaths) {
|
|
32886
33456
|
const fullFilePath = isAbsolute8(filePath) ? filePath : resolve11(getCwd(), filePath);
|
|
32887
33457
|
try {
|
|
32888
|
-
readFileTimestamps[fullFilePath] =
|
|
33458
|
+
readFileTimestamps[fullFilePath] = statSync14(fullFilePath).mtimeMs;
|
|
32889
33459
|
} catch (e) {
|
|
32890
33460
|
logError(e);
|
|
32891
33461
|
}
|
|
@@ -32985,7 +33555,7 @@ Single-task work does not require a dependency chain. When dependencies are read
|
|
|
32985
33555
|
Task records use subject as the single primary name, with activeForm provided by the caller to describe the in-progress action. Keep description and blockedBy independent in JSON; any joining is only for terminal rendering. blockedBy should always be present as an array (empty when not used). Ordering is by task id; do not use priority fields.
|
|
32986
33556
|
|
|
32987
33557
|
It is critical that you mark tasks as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.
|
|
32988
|
-
For non-trivial reasoning, planning under uncertainty, debugging, or multi-step tradeoff decisions, proactively use
|
|
33558
|
+
For non-trivial reasoning, planning under uncertainty, debugging, or multi-step tradeoff decisions, proactively use Ultra-Think to externalize step-by-step thinking before and during tool execution.
|
|
32989
33559
|
|
|
32990
33560
|
# Cognitive Safety & Sensing
|
|
32991
33561
|
1. **Modification Check**: Before editing, you MUST verify if the change is already present (e.g. use \`grep\` or \`read\`). Do not rely on memory from previous turns.
|
|
@@ -33176,6 +33746,7 @@ export {
|
|
|
33176
33746
|
grantReadPermissionForOriginalDir,
|
|
33177
33747
|
NotebookEditTool,
|
|
33178
33748
|
FileEditTool,
|
|
33749
|
+
emitTelemetryEvent,
|
|
33179
33750
|
FileReadTool,
|
|
33180
33751
|
FileWriteTool,
|
|
33181
33752
|
GlobTool,
|
|
@@ -33195,7 +33766,6 @@ export {
|
|
|
33195
33766
|
getReasoningEffort,
|
|
33196
33767
|
generatePybContext,
|
|
33197
33768
|
refreshPybContext,
|
|
33198
|
-
emitTelemetryEvent,
|
|
33199
33769
|
resolveModelResponsePolicy,
|
|
33200
33770
|
formatSystemPromptWithContext,
|
|
33201
33771
|
useExitOnCtrlCD,
|
|
@@ -33204,7 +33774,6 @@ export {
|
|
|
33204
33774
|
Onboarding,
|
|
33205
33775
|
review_default,
|
|
33206
33776
|
applyMarkdown,
|
|
33207
|
-
MessageResponse,
|
|
33208
33777
|
generateTaskListId,
|
|
33209
33778
|
runWithTaskListId,
|
|
33210
33779
|
runWithTaskListEnv,
|