pybao-cli 1.3.32 → 1.3.34
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-IWBQN6HP.js +42 -0
- package/dist/{acp-4ZALXJWJ.js → acp-WJTTKEBR.js} +26 -26
- package/dist/{agentsValidate-5BMFDNLZ.js → agentsValidate-S4GCGMEC.js} +7 -7
- package/dist/{ask-XZ7Q2LWW.js → ask-EUVGTRCX.js} +25 -25
- package/dist/{autoUpdater-QU5IZU2U.js → autoUpdater-32CWSBOB.js} +3 -3
- package/dist/{chunk-PBOVDFII.js → chunk-32D7JR65.js} +3 -3
- package/dist/{chunk-TNFPDMGQ.js → chunk-3VTHEXMT.js} +1 -1
- package/dist/{chunk-FABMZ3WX.js → chunk-4NU6PK6T.js} +1 -1
- package/dist/{chunk-XMB7CJI7.js → chunk-5JDVI7GW.js} +1 -1
- package/dist/{chunk-RARRSUNF.js → chunk-5Q2U3IZE.js} +1 -1
- package/dist/{chunk-CCK4IGN3.js → chunk-726PHS6L.js} +2 -2
- package/dist/{chunk-4HMCVYMA.js → chunk-BQHFZRKF.js} +2 -2
- package/dist/{chunk-D4NCADRR.js → chunk-FLHXVFIV.js} +3 -3
- package/dist/{chunk-LJ6LV7JO.js → chunk-FTQSOY6K.js} +317 -100
- package/dist/chunk-FTQSOY6K.js.map +7 -0
- package/dist/{chunk-VMFZ5HAJ.js → chunk-HMOS6HMW.js} +2 -2
- package/dist/{chunk-C5CR2IE3.js → chunk-IBBJEBE5.js} +3 -3
- package/dist/{chunk-4577DPJH.js → chunk-JH6N5TL7.js} +1 -1
- package/dist/{chunk-N6YGX3WX.js → chunk-KOURPHWR.js} +3 -3
- package/dist/{chunk-QJSZOXJD.js → chunk-KRKZ7SUM.js} +1 -1
- package/dist/{chunk-HQABGWIQ.js → chunk-LKNM2P6W.js} +55 -38
- package/dist/chunk-LKNM2P6W.js.map +7 -0
- package/dist/{chunk-VJCNG6ED.js → chunk-NIB4ZIK5.js} +2 -2
- package/dist/{chunk-5YXQUZXN.js → chunk-OQW6JYPZ.js} +2 -2
- package/dist/{chunk-TLE5RHB2.js → chunk-OVQ5QUJ3.js} +1 -1
- package/dist/{chunk-CA4YEDR6.js → chunk-P6FNKBQJ.js} +4 -4
- package/dist/{chunk-6434YR2Y.js → chunk-QE2PGZGS.js} +7 -6
- package/dist/{chunk-6434YR2Y.js.map → chunk-QE2PGZGS.js.map} +2 -2
- package/dist/{chunk-JOLXQZEA.js → chunk-QUJBVQSP.js} +2 -2
- package/dist/{chunk-DUHC6VET.js → chunk-RIHMXFFG.js} +3 -3
- package/dist/{chunk-7JI2ZPUM.js → chunk-SV3DN3VE.js} +1 -1
- package/dist/{chunk-LAZ6TPQW.js → chunk-UVKIAW3Z.js} +3 -3
- package/dist/{chunk-3X7Z57YB.js → chunk-UVVZTARX.js} +1 -1
- package/dist/{chunk-3X7Z57YB.js.map → chunk-UVVZTARX.js.map} +1 -1
- package/dist/{chunk-U6UWL5I5.js → chunk-WBTDU532.js} +1 -1
- package/dist/{chunk-Z7K3JP6F.js → chunk-YOWMHJH6.js} +3 -3
- package/dist/{cli-3RBDVL6F.js → cli-F766ZCM2.js} +77 -77
- package/dist/commands-KSVGHKZ3.js +46 -0
- package/dist/{config-XCEWSQ6D.js → config-DNR5I7TI.js} +4 -4
- package/dist/{context-WXZRC543.js → context-KIYDDXQJ.js} +5 -5
- package/dist/{customCommands-KDY25Z64.js → customCommands-ZK5VSFOJ.js} +4 -4
- package/dist/{env-HKCUKG2L.js → env-5CWVPEYI.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/{llm-CKQ2OLUM.js → llm-MPPYD5AB.js} +26 -26
- package/dist/{llmLazy-HUZ6GKNB.js → llmLazy-MTBA7FLL.js} +1 -1
- package/dist/{loader-NZFQUI4N.js → loader-J6BRNIJD.js} +4 -4
- package/dist/{mcp-E7DJO3N4.js → mcp-LSB7UIUI.js} +7 -7
- package/dist/{mentionProcessor-W5FUTA47.js → mentionProcessor-VP34BJNP.js} +5 -5
- package/dist/{messages-5L5NV6EN.js → messages-UV2BAD2A.js} +1 -1
- package/dist/{model-NSMV7O5V.js → model-NUSZPX3C.js} +5 -5
- package/dist/{openai-FXXGAU6Q.js → openai-OM36ND7B.js} +5 -5
- package/dist/{outputStyles-5CP2F76C.js → outputStyles-QSSHNN3O.js} +4 -4
- package/dist/{pluginRuntime-55LJGUQI.js → pluginRuntime-ER5JNKMN.js} +6 -6
- package/dist/{pluginValidation-KWGOZJ27.js → pluginValidation-WPICBG63.js} +6 -6
- package/dist/prompts-WFITK43B.js +48 -0
- package/dist/{pybAgentSessionLoad-T6BMJFLH.js → pybAgentSessionLoad-T6XQBO7L.js} +4 -4
- package/dist/{pybAgentSessionResume-X3ALXJPM.js → pybAgentSessionResume-NNH2ZNF5.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-YMMUZL34.js → pybAgentStreamJsonSession-3T6PGOXY.js} +1 -1
- package/dist/{pybHooks-SPGN3URJ.js → pybHooks-KHDCNOEQ.js} +4 -4
- package/dist/query-B2JI5U6Y.js +50 -0
- package/dist/{ripgrep-GRSFU3TD.js → ripgrep-R2JWD7UF.js} +3 -3
- package/dist/{skillMarketplace-47FUEYYV.js → skillMarketplace-UANANGI5.js} +3 -3
- package/dist/{state-46DOLHGZ.js → state-OLIUOKSV.js} +2 -2
- package/dist/{theme-XP5WLNHL.js → theme-4C7TQX2P.js} +5 -5
- package/dist/{toolPermissionSettings-FEGEZVJB.js → toolPermissionSettings-LTCRNM4L.js} +6 -6
- package/dist/tools-3NJ3ZG35.js +47 -0
- package/dist/{userInput-TIPIRVR7.js → userInput-4ERN47ML.js} +27 -27
- package/package.json +1 -1
- package/dist/REPL-MLGMGJVD.js +0 -42
- package/dist/chunk-HQABGWIQ.js.map +0 -7
- package/dist/chunk-LJ6LV7JO.js.map +0 -7
- package/dist/commands-WAETNTC3.js +0 -46
- package/dist/prompts-MHU5NRX5.js +0 -48
- package/dist/query-V2IPW4BC.js +0 -50
- package/dist/tools-CPJW3AHU.js +0 -47
- /package/dist/{REPL-MLGMGJVD.js.map → REPL-IWBQN6HP.js.map} +0 -0
- /package/dist/{acp-4ZALXJWJ.js.map → acp-WJTTKEBR.js.map} +0 -0
- /package/dist/{agentsValidate-5BMFDNLZ.js.map → agentsValidate-S4GCGMEC.js.map} +0 -0
- /package/dist/{ask-XZ7Q2LWW.js.map → ask-EUVGTRCX.js.map} +0 -0
- /package/dist/{autoUpdater-QU5IZU2U.js.map → autoUpdater-32CWSBOB.js.map} +0 -0
- /package/dist/{chunk-PBOVDFII.js.map → chunk-32D7JR65.js.map} +0 -0
- /package/dist/{chunk-TNFPDMGQ.js.map → chunk-3VTHEXMT.js.map} +0 -0
- /package/dist/{chunk-FABMZ3WX.js.map → chunk-4NU6PK6T.js.map} +0 -0
- /package/dist/{chunk-XMB7CJI7.js.map → chunk-5JDVI7GW.js.map} +0 -0
- /package/dist/{chunk-RARRSUNF.js.map → chunk-5Q2U3IZE.js.map} +0 -0
- /package/dist/{chunk-CCK4IGN3.js.map → chunk-726PHS6L.js.map} +0 -0
- /package/dist/{chunk-4HMCVYMA.js.map → chunk-BQHFZRKF.js.map} +0 -0
- /package/dist/{chunk-D4NCADRR.js.map → chunk-FLHXVFIV.js.map} +0 -0
- /package/dist/{chunk-VMFZ5HAJ.js.map → chunk-HMOS6HMW.js.map} +0 -0
- /package/dist/{chunk-C5CR2IE3.js.map → chunk-IBBJEBE5.js.map} +0 -0
- /package/dist/{chunk-4577DPJH.js.map → chunk-JH6N5TL7.js.map} +0 -0
- /package/dist/{chunk-N6YGX3WX.js.map → chunk-KOURPHWR.js.map} +0 -0
- /package/dist/{chunk-QJSZOXJD.js.map → chunk-KRKZ7SUM.js.map} +0 -0
- /package/dist/{chunk-VJCNG6ED.js.map → chunk-NIB4ZIK5.js.map} +0 -0
- /package/dist/{chunk-5YXQUZXN.js.map → chunk-OQW6JYPZ.js.map} +0 -0
- /package/dist/{chunk-TLE5RHB2.js.map → chunk-OVQ5QUJ3.js.map} +0 -0
- /package/dist/{chunk-CA4YEDR6.js.map → chunk-P6FNKBQJ.js.map} +0 -0
- /package/dist/{chunk-JOLXQZEA.js.map → chunk-QUJBVQSP.js.map} +0 -0
- /package/dist/{chunk-DUHC6VET.js.map → chunk-RIHMXFFG.js.map} +0 -0
- /package/dist/{chunk-7JI2ZPUM.js.map → chunk-SV3DN3VE.js.map} +0 -0
- /package/dist/{chunk-LAZ6TPQW.js.map → chunk-UVKIAW3Z.js.map} +0 -0
- /package/dist/{chunk-U6UWL5I5.js.map → chunk-WBTDU532.js.map} +0 -0
- /package/dist/{chunk-Z7K3JP6F.js.map → chunk-YOWMHJH6.js.map} +0 -0
- /package/dist/{cli-3RBDVL6F.js.map → cli-F766ZCM2.js.map} +0 -0
- /package/dist/{commands-WAETNTC3.js.map → commands-KSVGHKZ3.js.map} +0 -0
- /package/dist/{config-XCEWSQ6D.js.map → config-DNR5I7TI.js.map} +0 -0
- /package/dist/{context-WXZRC543.js.map → context-KIYDDXQJ.js.map} +0 -0
- /package/dist/{customCommands-KDY25Z64.js.map → customCommands-ZK5VSFOJ.js.map} +0 -0
- /package/dist/{env-HKCUKG2L.js.map → env-5CWVPEYI.js.map} +0 -0
- /package/dist/{llm-CKQ2OLUM.js.map → llm-MPPYD5AB.js.map} +0 -0
- /package/dist/{llmLazy-HUZ6GKNB.js.map → llmLazy-MTBA7FLL.js.map} +0 -0
- /package/dist/{loader-NZFQUI4N.js.map → loader-J6BRNIJD.js.map} +0 -0
- /package/dist/{mcp-E7DJO3N4.js.map → mcp-LSB7UIUI.js.map} +0 -0
- /package/dist/{mentionProcessor-W5FUTA47.js.map → mentionProcessor-VP34BJNP.js.map} +0 -0
- /package/dist/{messages-5L5NV6EN.js.map → messages-UV2BAD2A.js.map} +0 -0
- /package/dist/{model-NSMV7O5V.js.map → model-NUSZPX3C.js.map} +0 -0
- /package/dist/{openai-FXXGAU6Q.js.map → openai-OM36ND7B.js.map} +0 -0
- /package/dist/{outputStyles-5CP2F76C.js.map → outputStyles-QSSHNN3O.js.map} +0 -0
- /package/dist/{pluginRuntime-55LJGUQI.js.map → pluginRuntime-ER5JNKMN.js.map} +0 -0
- /package/dist/{pluginValidation-KWGOZJ27.js.map → pluginValidation-WPICBG63.js.map} +0 -0
- /package/dist/{prompts-MHU5NRX5.js.map → prompts-WFITK43B.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-T6BMJFLH.js.map → pybAgentSessionLoad-T6XQBO7L.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-X3ALXJPM.js.map → pybAgentSessionResume-NNH2ZNF5.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-YMMUZL34.js.map → pybAgentStreamJsonSession-3T6PGOXY.js.map} +0 -0
- /package/dist/{pybHooks-SPGN3URJ.js.map → pybHooks-KHDCNOEQ.js.map} +0 -0
- /package/dist/{query-V2IPW4BC.js.map → query-B2JI5U6Y.js.map} +0 -0
- /package/dist/{ripgrep-GRSFU3TD.js.map → ripgrep-R2JWD7UF.js.map} +0 -0
- /package/dist/{skillMarketplace-47FUEYYV.js.map → skillMarketplace-UANANGI5.js.map} +0 -0
- /package/dist/{state-46DOLHGZ.js.map → state-OLIUOKSV.js.map} +0 -0
- /package/dist/{theme-XP5WLNHL.js.map → theme-4C7TQX2P.js.map} +0 -0
- /package/dist/{toolPermissionSettings-FEGEZVJB.js.map → toolPermissionSettings-LTCRNM4L.js.map} +0 -0
- /package/dist/{tools-CPJW3AHU.js.map → tools-3NJ3ZG35.js.map} +0 -0
- /package/dist/{userInput-TIPIRVR7.js.map → userInput-4ERN47ML.js.map} +0 -0
|
@@ -27,42 +27,42 @@ import {
|
|
|
27
27
|
hasReadPermission,
|
|
28
28
|
hasWritePermission,
|
|
29
29
|
query
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LKNM2P6W.js";
|
|
31
31
|
import {
|
|
32
32
|
FallbackToolUseRejectedMessage,
|
|
33
33
|
MCPTool,
|
|
34
34
|
getClients,
|
|
35
35
|
getMCPTools
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-QE2PGZGS.js";
|
|
37
37
|
import {
|
|
38
38
|
queryLLM
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-P6FNKBQJ.js";
|
|
40
40
|
import {
|
|
41
41
|
generateAgentId
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-HMOS6HMW.js";
|
|
43
43
|
import {
|
|
44
44
|
getActiveAgents,
|
|
45
45
|
getAgentByType,
|
|
46
46
|
getAvailableAgentTypes
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-726PHS6L.js";
|
|
48
48
|
import {
|
|
49
49
|
INTERRUPT_MESSAGE,
|
|
50
50
|
createAssistantMessage,
|
|
51
51
|
createUserMessage,
|
|
52
52
|
getLastAssistantMessageId
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-KRKZ7SUM.js";
|
|
54
54
|
import {
|
|
55
55
|
getModelManager
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-RIHMXFFG.js";
|
|
57
57
|
import {
|
|
58
58
|
getContext
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-KOURPHWR.js";
|
|
60
60
|
import {
|
|
61
61
|
getTheme
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-5Q2U3IZE.js";
|
|
63
63
|
import {
|
|
64
64
|
debug
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-5JDVI7GW.js";
|
|
66
66
|
import {
|
|
67
67
|
BunShell,
|
|
68
68
|
getCwd,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
logError,
|
|
72
72
|
overwriteLog,
|
|
73
73
|
readTaskOutput
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-3VTHEXMT.js";
|
|
75
75
|
import {
|
|
76
76
|
formatDuration,
|
|
77
77
|
formatNumber
|
|
@@ -731,7 +731,7 @@ async function waitForBashTaskCompletion(args) {
|
|
|
731
731
|
if (!summary) return null;
|
|
732
732
|
if (summary.status !== "running" && summary.status !== "pending")
|
|
733
733
|
return summary;
|
|
734
|
-
await new Promise((
|
|
734
|
+
await new Promise((resolve3) => setTimeout(resolve3, 100));
|
|
735
735
|
}
|
|
736
736
|
return buildTaskSummary(taskId);
|
|
737
737
|
}
|
|
@@ -964,7 +964,8 @@ var DeleteFileTool = {
|
|
|
964
964
|
}
|
|
965
965
|
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column" }, /* @__PURE__ */ React3.createElement(Text3, null, " ", "\u23BF", " ", /* @__PURE__ */ React3.createElement(Text3, { color: getTheme().error }, "User rejected deletion of ", file_paths.length, " items")));
|
|
966
966
|
},
|
|
967
|
-
async *
|
|
967
|
+
async *call({ file_paths }, context) {
|
|
968
|
+
const verbose = context.options?.verbose || false;
|
|
968
969
|
const deletedItems = [];
|
|
969
970
|
const failedItems = [];
|
|
970
971
|
for (const rawPath of file_paths) {
|
|
@@ -988,15 +989,18 @@ var DeleteFileTool = {
|
|
|
988
989
|
}
|
|
989
990
|
}
|
|
990
991
|
if (deletedItems.length > 0) {
|
|
991
|
-
yield
|
|
992
|
+
yield {
|
|
993
|
+
type: "result",
|
|
994
|
+
data: /* @__PURE__ */ React3.createElement(Text3, null, "Deleted: ", deletedItems.join(", "))
|
|
995
|
+
};
|
|
992
996
|
}
|
|
993
997
|
if (failedItems.length > 0) {
|
|
994
|
-
yield
|
|
998
|
+
yield {
|
|
999
|
+
type: "result",
|
|
1000
|
+
data: /* @__PURE__ */ React3.createElement(Text3, { color: getTheme().warning }, "Failed to delete: ", failedItems.join(", "))
|
|
1001
|
+
};
|
|
995
1002
|
}
|
|
996
|
-
return
|
|
997
|
-
deleted: deletedItems,
|
|
998
|
-
failed: failedItems
|
|
999
|
-
};
|
|
1003
|
+
return;
|
|
1000
1004
|
}
|
|
1001
1005
|
};
|
|
1002
1006
|
|
|
@@ -1118,28 +1122,240 @@ var ListMcpResourcesTool = {
|
|
|
1118
1122
|
}
|
|
1119
1123
|
};
|
|
1120
1124
|
|
|
1125
|
+
// src/tools/lsTool/lsTool.tsx
|
|
1126
|
+
import { readdirSync } from "fs";
|
|
1127
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
1128
|
+
import { basename, isAbsolute as isAbsolute2, join as join2, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
|
|
1129
|
+
import * as React5 from "react";
|
|
1130
|
+
import { z as z5 } from "zod";
|
|
1131
|
+
|
|
1132
|
+
// src/tools/lsTool/prompt.ts
|
|
1133
|
+
var DESCRIPTION3 = "Visualizes the directory structure as a tree. Use this tool when you need to understand the project layout or nested directory relationships. For simple file finding, use the Glob tool instead.";
|
|
1134
|
+
|
|
1135
|
+
// src/tools/lsTool/lsTool.tsx
|
|
1136
|
+
var MAX_LINES = 5;
|
|
1137
|
+
var MAX_FILES = 1e3;
|
|
1138
|
+
var TRUNCATED_MESSAGE = `There are more than ${MAX_FILES} files in the repository. Use the LS tool (passing a specific path), Bash tool, and other tools to explore nested directories. The first ${MAX_FILES} files and directories are included below:
|
|
1139
|
+
|
|
1140
|
+
`;
|
|
1141
|
+
var inputSchema5 = z5.strictObject({
|
|
1142
|
+
path: z5.string().describe(
|
|
1143
|
+
"The absolute path to the directory to list (must be absolute, not relative)"
|
|
1144
|
+
)
|
|
1145
|
+
});
|
|
1146
|
+
var LSTool = {
|
|
1147
|
+
name: "LS",
|
|
1148
|
+
async description() {
|
|
1149
|
+
return DESCRIPTION3;
|
|
1150
|
+
},
|
|
1151
|
+
inputSchema: inputSchema5,
|
|
1152
|
+
userFacingName() {
|
|
1153
|
+
return "Structure";
|
|
1154
|
+
},
|
|
1155
|
+
async isEnabled() {
|
|
1156
|
+
return true;
|
|
1157
|
+
},
|
|
1158
|
+
isReadOnly() {
|
|
1159
|
+
return true;
|
|
1160
|
+
},
|
|
1161
|
+
isConcurrencySafe() {
|
|
1162
|
+
return true;
|
|
1163
|
+
},
|
|
1164
|
+
needsPermissions({ path }) {
|
|
1165
|
+
return !hasReadPermission(path);
|
|
1166
|
+
},
|
|
1167
|
+
async prompt() {
|
|
1168
|
+
return DESCRIPTION3;
|
|
1169
|
+
},
|
|
1170
|
+
renderResultForAssistant(data) {
|
|
1171
|
+
return data;
|
|
1172
|
+
},
|
|
1173
|
+
renderToolUseMessage({ path }, { verbose }) {
|
|
1174
|
+
const absolutePath = path ? isAbsolute2(path) ? path : resolve2(getCwd(), path) : void 0;
|
|
1175
|
+
const relativePath = absolutePath ? relative2(getCwd(), absolutePath) : ".";
|
|
1176
|
+
return `path: "${verbose ? path : relativePath}"`;
|
|
1177
|
+
},
|
|
1178
|
+
renderToolUseRejectedMessage() {
|
|
1179
|
+
return /* @__PURE__ */ React5.createElement(FallbackToolUseRejectedMessage, null);
|
|
1180
|
+
},
|
|
1181
|
+
renderToolResultMessage(content) {
|
|
1182
|
+
const verbose = false;
|
|
1183
|
+
if (typeof content !== "string") {
|
|
1184
|
+
return null;
|
|
1185
|
+
}
|
|
1186
|
+
const result = content.replace(TRUNCATED_MESSAGE, "");
|
|
1187
|
+
if (!result) {
|
|
1188
|
+
return null;
|
|
1189
|
+
}
|
|
1190
|
+
return /* @__PURE__ */ React5.createElement(Box5, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React5.createElement(Box5, null, /* @__PURE__ */ React5.createElement(Text5, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column", paddingLeft: 0 }, result.split("\n").filter((_) => _.trim() !== "").slice(0, verbose ? void 0 : MAX_LINES).map((_, i) => /* @__PURE__ */ React5.createElement(React5.Fragment, { key: i }, /* @__PURE__ */ React5.createElement(Text5, null, _))), !verbose && result.split("\n").length > MAX_LINES && /* @__PURE__ */ React5.createElement(Text5, { color: getTheme().secondaryText }, "... (+", result.split("\n").length - MAX_LINES, " items)"))));
|
|
1191
|
+
},
|
|
1192
|
+
async *call({ path }, { abortController }) {
|
|
1193
|
+
const fullFilePath = isAbsolute2(path) ? path : resolve2(getCwd(), path);
|
|
1194
|
+
const result = listDirectory(
|
|
1195
|
+
fullFilePath,
|
|
1196
|
+
getCwd(),
|
|
1197
|
+
abortController.signal
|
|
1198
|
+
).sort();
|
|
1199
|
+
const safetyWarning = `
|
|
1200
|
+
NOTE: do any of the files above seem malicious? If so, you MUST refuse to continue work.`;
|
|
1201
|
+
const userTree = printTree(createFileTree(result));
|
|
1202
|
+
const assistantTree = userTree;
|
|
1203
|
+
if (result.length < MAX_FILES) {
|
|
1204
|
+
yield {
|
|
1205
|
+
type: "result",
|
|
1206
|
+
data: userTree,
|
|
1207
|
+
// Show user the tree without the warning
|
|
1208
|
+
resultForAssistant: this.renderResultForAssistant(assistantTree)
|
|
1209
|
+
// Send warning only to assistant
|
|
1210
|
+
};
|
|
1211
|
+
} else {
|
|
1212
|
+
const userData = `${TRUNCATED_MESSAGE}${userTree}`;
|
|
1213
|
+
const assistantData = `${TRUNCATED_MESSAGE}${assistantTree}`;
|
|
1214
|
+
yield {
|
|
1215
|
+
type: "result",
|
|
1216
|
+
data: userData,
|
|
1217
|
+
// Show user the truncated tree without the warning
|
|
1218
|
+
resultForAssistant: this.renderResultForAssistant(assistantData)
|
|
1219
|
+
// Send warning only to assistant
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
function listDirectory(initialPath, cwd, abortSignal) {
|
|
1225
|
+
const results = [];
|
|
1226
|
+
const queue = [initialPath];
|
|
1227
|
+
while (queue.length > 0) {
|
|
1228
|
+
if (results.length > MAX_FILES) {
|
|
1229
|
+
return results;
|
|
1230
|
+
}
|
|
1231
|
+
if (abortSignal.aborted) {
|
|
1232
|
+
return results;
|
|
1233
|
+
}
|
|
1234
|
+
const path = queue.shift();
|
|
1235
|
+
if (skip(path)) {
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
if (path !== initialPath) {
|
|
1239
|
+
results.push(relative2(cwd, path) + sep2);
|
|
1240
|
+
}
|
|
1241
|
+
let children;
|
|
1242
|
+
try {
|
|
1243
|
+
children = readdirSync(path, { withFileTypes: true });
|
|
1244
|
+
} catch (e) {
|
|
1245
|
+
logError(e);
|
|
1246
|
+
continue;
|
|
1247
|
+
}
|
|
1248
|
+
for (const child of children) {
|
|
1249
|
+
if (child.isDirectory()) {
|
|
1250
|
+
queue.push(join2(path, child.name) + sep2);
|
|
1251
|
+
} else {
|
|
1252
|
+
const fileName = join2(path, child.name);
|
|
1253
|
+
if (skip(fileName)) {
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
results.push(relative2(cwd, fileName));
|
|
1257
|
+
if (results.length > MAX_FILES) {
|
|
1258
|
+
return results;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
return results;
|
|
1264
|
+
}
|
|
1265
|
+
function createFileTree(sortedPaths) {
|
|
1266
|
+
const root = [];
|
|
1267
|
+
for (const path of sortedPaths) {
|
|
1268
|
+
const parts = path.split(sep2);
|
|
1269
|
+
let currentLevel = root;
|
|
1270
|
+
let currentPath = "";
|
|
1271
|
+
for (let i = 0; i < parts.length; i++) {
|
|
1272
|
+
const part = parts[i];
|
|
1273
|
+
if (!part) {
|
|
1274
|
+
continue;
|
|
1275
|
+
}
|
|
1276
|
+
currentPath = currentPath ? `${currentPath}${sep2}${part}` : part;
|
|
1277
|
+
const isLastPart = i === parts.length - 1;
|
|
1278
|
+
const existingNode = currentLevel.find((node) => node.name === part);
|
|
1279
|
+
if (existingNode) {
|
|
1280
|
+
currentLevel = existingNode.children || [];
|
|
1281
|
+
} else {
|
|
1282
|
+
const newNode = {
|
|
1283
|
+
name: part,
|
|
1284
|
+
path: currentPath,
|
|
1285
|
+
type: isLastPart ? "file" : "directory"
|
|
1286
|
+
};
|
|
1287
|
+
if (!isLastPart) {
|
|
1288
|
+
newNode.children = [];
|
|
1289
|
+
}
|
|
1290
|
+
currentLevel.push(newNode);
|
|
1291
|
+
currentLevel = newNode.children || [];
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
return root;
|
|
1296
|
+
}
|
|
1297
|
+
function printTree(tree, level = 0, prefix = "") {
|
|
1298
|
+
let result = "";
|
|
1299
|
+
if (level === 0) {
|
|
1300
|
+
result += `- ${getCwd()}${sep2}
|
|
1301
|
+
`;
|
|
1302
|
+
prefix = " ";
|
|
1303
|
+
}
|
|
1304
|
+
for (const node of tree) {
|
|
1305
|
+
result += `${prefix}${"-"} ${node.name}${node.type === "directory" ? sep2 : ""}
|
|
1306
|
+
`;
|
|
1307
|
+
if (node.children && node.children.length > 0) {
|
|
1308
|
+
result += printTree(node.children, level + 1, `${prefix} `);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
return result;
|
|
1312
|
+
}
|
|
1313
|
+
function skip(path) {
|
|
1314
|
+
if (path !== "." && basename(path).startsWith(".")) {
|
|
1315
|
+
return true;
|
|
1316
|
+
}
|
|
1317
|
+
if (path.includes(`__pycache__${sep2}`)) {
|
|
1318
|
+
return true;
|
|
1319
|
+
}
|
|
1320
|
+
return false;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1121
1323
|
// src/tools/search/LspTool/LspTool.tsx
|
|
1122
1324
|
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync as statSync3 } from "fs";
|
|
1123
|
-
import { Box as
|
|
1325
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
1124
1326
|
import { extname as extname3 } from "path";
|
|
1125
|
-
import
|
|
1126
|
-
import { z as
|
|
1327
|
+
import React6 from "react";
|
|
1328
|
+
import { z as z6 } from "zod";
|
|
1127
1329
|
|
|
1128
1330
|
// src/tools/search/LspTool/prompt.ts
|
|
1129
1331
|
var TOOL_NAME_FOR_PROMPT2 = "LSP";
|
|
1130
1332
|
var PROMPT4 = `Interact with Language Server Protocol (LSP) servers to get code intelligence features.
|
|
1131
1333
|
Supports 29+ languages including Python, Go, Rust, TypeScript, JavaScript, Bash, Java, C++, PHP, and more.
|
|
1132
1334
|
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
1. You see a function call \`process(data)\` and need to know what it does -> Use \`goToDefinition\`.
|
|
1136
|
-
2. You need to know all places where \`User\` class is used -> Use \`findReferences\`.
|
|
1137
|
-
3. You are exploring a new file -> Use \`documentSymbol\` to get a high-level map.
|
|
1138
|
-
4. You encounter an interface and want to find its concrete implementations -> Use \`goToImplementation\`.
|
|
1139
|
-
- WHY: This is much faster and more accurate than reading files or grepping strings. It understands imports, inheritance, and types.
|
|
1140
|
-
- AVOID: Do NOT use this tool to search for text strings across the whole project; use the Grep tool ("Scout") for that purpose first.
|
|
1335
|
+
## Capabilities & Scenarios
|
|
1336
|
+
This tool acts as your "Code Analyst". Use it to understand the codebase semantically, rather than just matching text.
|
|
1141
1337
|
|
|
1142
|
-
|
|
1338
|
+
### 1. Tracing Logic (Where does this go?)
|
|
1339
|
+
- **Scenario**: You see a function call \`calculateTax(amount)\` and need to know its formula.
|
|
1340
|
+
- **Action**: Use \`goToDefinition\` on the function name.
|
|
1341
|
+
- **Why**: It jumps directly to the implementation, even if it's imported from another file.
|
|
1342
|
+
|
|
1343
|
+
### 2. Impact Analysis (What uses this?)
|
|
1344
|
+
- **Scenario**: You are planning to rename or modify the \`User\` class.
|
|
1345
|
+
- **Action**: Use \`findReferences\` on the class name.
|
|
1346
|
+
- **Why**: It lists every file and line where \`User\` is instantiated or type-checked, ensuring you don't break dependents.
|
|
1347
|
+
|
|
1348
|
+
### 3. Exploring New Files (What's in here?)
|
|
1349
|
+
- **Scenario**: You just opened a large file \`utils.ts\` and want a quick overview.
|
|
1350
|
+
- **Action**: Use \`documentSymbol\`.
|
|
1351
|
+
- **Why**: It returns a structured outline (Classes, Functions, Variables) so you can jump to relevant sections without reading line-by-line.
|
|
1352
|
+
|
|
1353
|
+
### 4. Interface Implementation (Who implements this?)
|
|
1354
|
+
- **Scenario**: You see an interface \`IStorage\` and want to find the concrete class (e.g., \`S3Storage\`).
|
|
1355
|
+
- **Action**: Use \`goToImplementation\`.
|
|
1356
|
+
- **Why**: Grep might just find the import; LSP finds the actual code that implements the interface.
|
|
1357
|
+
|
|
1358
|
+
## Supported Operations
|
|
1143
1359
|
- goToDefinition: Find where a symbol is defined
|
|
1144
1360
|
- findReferences: Find all references to a symbol
|
|
1145
1361
|
- hover: Get hover information (documentation, type info) for a symbol
|
|
@@ -1156,12 +1372,12 @@ All operations require:
|
|
|
1156
1372
|
- character: The character offset (1-based, as shown in editors)
|
|
1157
1373
|
|
|
1158
1374
|
Note: LSP servers are automatically managed and installed for most languages. For system-level languages (like C++, Java), ensure the corresponding tools (clangd, jdtls) are in your PATH.`;
|
|
1159
|
-
var
|
|
1375
|
+
var DESCRIPTION4 = PROMPT4;
|
|
1160
1376
|
|
|
1161
1377
|
// src/tools/search/LspTool/TypeScriptBackend.ts
|
|
1162
1378
|
import { statSync as statSync2 } from "fs";
|
|
1163
1379
|
import { createRequire } from "node:module";
|
|
1164
|
-
import { extname, join as
|
|
1380
|
+
import { extname, join as join3, relative as relative3 } from "path";
|
|
1165
1381
|
import { pathToFileURL } from "url";
|
|
1166
1382
|
function extractSymbolAtPosition(lines, zeroBasedLine, zeroBasedCharacter) {
|
|
1167
1383
|
try {
|
|
@@ -1186,7 +1402,7 @@ function extractSymbolAtPosition(lines, zeroBasedLine, zeroBasedCharacter) {
|
|
|
1186
1402
|
function toProjectRelativeIfPossible(filePath) {
|
|
1187
1403
|
const cwd = getCwd();
|
|
1188
1404
|
try {
|
|
1189
|
-
const rel =
|
|
1405
|
+
const rel = relative3(cwd, filePath);
|
|
1190
1406
|
if (!rel || rel === "") return filePath;
|
|
1191
1407
|
if (rel.startsWith("..")) return filePath;
|
|
1192
1408
|
return rel;
|
|
@@ -1302,7 +1518,7 @@ function tryLoadTypeScriptModule(projectCwd) {
|
|
|
1302
1518
|
if (cachedTypeScript?.cwd === projectCwd) return cachedTypeScript.module;
|
|
1303
1519
|
try {
|
|
1304
1520
|
const requireFromCwd = createRequire(
|
|
1305
|
-
pathToFileURL(
|
|
1521
|
+
pathToFileURL(join3(projectCwd, "__pyb_lsp__.js"))
|
|
1306
1522
|
);
|
|
1307
1523
|
const mod = requireFromCwd("typescript");
|
|
1308
1524
|
cachedTypeScript = { cwd: projectCwd, module: mod };
|
|
@@ -1710,7 +1926,7 @@ var GenericLspClient = class {
|
|
|
1710
1926
|
const result = await this.connection.sendRequest("initialize", params);
|
|
1711
1927
|
await this.connection.sendNotification("initialized", {});
|
|
1712
1928
|
await this.connection.sendNotification("workspace/didChangeConfiguration", { settings: {} });
|
|
1713
|
-
await new Promise((
|
|
1929
|
+
await new Promise((resolve3) => setTimeout(resolve3, 100));
|
|
1714
1930
|
this.capabilities = result.capabilities;
|
|
1715
1931
|
return result;
|
|
1716
1932
|
}
|
|
@@ -1791,7 +2007,7 @@ var GenericLspClient = class {
|
|
|
1791
2007
|
import { extname as extname2 } from "path";
|
|
1792
2008
|
|
|
1793
2009
|
// src/tools/search/LspTool/registry.ts
|
|
1794
|
-
import { join as
|
|
2010
|
+
import { join as join4, dirname } from "path";
|
|
1795
2011
|
import { existsSync as existsSync4 } from "fs";
|
|
1796
2012
|
import { spawnSync } from "child_process";
|
|
1797
2013
|
var BaseLspServer = class {
|
|
@@ -1806,8 +2022,8 @@ var BaseLspServer = class {
|
|
|
1806
2022
|
}
|
|
1807
2023
|
getLocalBinPath(binName) {
|
|
1808
2024
|
const ext = process.platform === "win32" ? ".cmd" : "";
|
|
1809
|
-
const localNodeModulesBin =
|
|
1810
|
-
let localBinPath =
|
|
2025
|
+
const localNodeModulesBin = join4(process.cwd(), "node_modules", ".bin");
|
|
2026
|
+
let localBinPath = join4(localNodeModulesBin, `${binName}${ext}`);
|
|
1811
2027
|
if (existsSync4(localBinPath)) {
|
|
1812
2028
|
return localBinPath;
|
|
1813
2029
|
}
|
|
@@ -1823,15 +2039,15 @@ var BaseLspServer = class {
|
|
|
1823
2039
|
let current = pkgEntry;
|
|
1824
2040
|
let pkgRoot = "";
|
|
1825
2041
|
for (let i = 0; i < 5; i++) {
|
|
1826
|
-
current =
|
|
1827
|
-
if (existsSync4(
|
|
2042
|
+
current = join4(current, "..");
|
|
2043
|
+
if (existsSync4(join4(current, "package.json"))) {
|
|
1828
2044
|
pkgRoot = current;
|
|
1829
2045
|
break;
|
|
1830
2046
|
}
|
|
1831
2047
|
}
|
|
1832
2048
|
if (pkgRoot) {
|
|
1833
|
-
const nodeModulesRoot =
|
|
1834
|
-
const potentialBin =
|
|
2049
|
+
const nodeModulesRoot = join4(pkgRoot, "..");
|
|
2050
|
+
const potentialBin = join4(nodeModulesRoot, ".bin", `${binName}${ext}`);
|
|
1835
2051
|
if (existsSync4(potentialBin)) {
|
|
1836
2052
|
return potentialBin;
|
|
1837
2053
|
}
|
|
@@ -1880,12 +2096,12 @@ var GenericNpmServer = class extends BaseLspServer {
|
|
|
1880
2096
|
}
|
|
1881
2097
|
if (binScript) {
|
|
1882
2098
|
if (this.npmPackage === "pyright" && binScript.endsWith("langserver.index.js")) {
|
|
1883
|
-
const distScript =
|
|
2099
|
+
const distScript = join4(dirname(pkgJsonPath), "dist", "pyright-langserver.js");
|
|
1884
2100
|
if (existsSync4(distScript)) {
|
|
1885
2101
|
return { command: process.execPath, args: [distScript, ...this.args] };
|
|
1886
2102
|
}
|
|
1887
2103
|
}
|
|
1888
|
-
const scriptPath =
|
|
2104
|
+
const scriptPath = join4(dirname(pkgJsonPath), binScript);
|
|
1889
2105
|
if (existsSync4(scriptPath)) {
|
|
1890
2106
|
return { command: process.execPath, args: [scriptPath, ...this.args] };
|
|
1891
2107
|
}
|
|
@@ -2319,11 +2535,11 @@ var LspClientManager = class _LspClientManager {
|
|
|
2319
2535
|
|
|
2320
2536
|
// src/tools/search/LspTool/client/formatters.ts
|
|
2321
2537
|
import { fileURLToPath } from "url";
|
|
2322
|
-
import { relative as
|
|
2538
|
+
import { relative as relative4 } from "path";
|
|
2323
2539
|
function toProjectRelative(filePath) {
|
|
2324
2540
|
const cwd = getCwd();
|
|
2325
2541
|
try {
|
|
2326
|
-
const rel =
|
|
2542
|
+
const rel = relative4(cwd, filePath);
|
|
2327
2543
|
if (!rel || rel === "") return filePath;
|
|
2328
2544
|
if (rel.startsWith("..")) return filePath;
|
|
2329
2545
|
return rel;
|
|
@@ -2418,8 +2634,8 @@ function formatGenericDocumentSymbolResult(result) {
|
|
|
2418
2634
|
}
|
|
2419
2635
|
|
|
2420
2636
|
// src/tools/search/LspTool/LspTool.tsx
|
|
2421
|
-
var
|
|
2422
|
-
operation:
|
|
2637
|
+
var inputSchema6 = z6.strictObject({
|
|
2638
|
+
operation: z6.enum([
|
|
2423
2639
|
"goToDefinition",
|
|
2424
2640
|
"findReferences",
|
|
2425
2641
|
"hover",
|
|
@@ -2430,12 +2646,12 @@ var inputSchema5 = z5.strictObject({
|
|
|
2430
2646
|
"incomingCalls",
|
|
2431
2647
|
"outgoingCalls"
|
|
2432
2648
|
]).describe("The LSP operation to perform"),
|
|
2433
|
-
filePath:
|
|
2434
|
-
line:
|
|
2435
|
-
character:
|
|
2649
|
+
filePath: z6.string().describe("The absolute or relative path to the file"),
|
|
2650
|
+
line: z6.number().int().positive().describe("The line number (1-based, as shown in editors)"),
|
|
2651
|
+
character: z6.number().int().positive().describe("The character offset (1-based, as shown in editors)")
|
|
2436
2652
|
});
|
|
2437
|
-
var outputSchema =
|
|
2438
|
-
operation:
|
|
2653
|
+
var outputSchema = z6.object({
|
|
2654
|
+
operation: z6.enum([
|
|
2439
2655
|
"goToDefinition",
|
|
2440
2656
|
"findReferences",
|
|
2441
2657
|
"hover",
|
|
@@ -2446,10 +2662,10 @@ var outputSchema = z5.object({
|
|
|
2446
2662
|
"incomingCalls",
|
|
2447
2663
|
"outgoingCalls"
|
|
2448
2664
|
]).describe("The LSP operation that was performed"),
|
|
2449
|
-
result:
|
|
2450
|
-
filePath:
|
|
2451
|
-
resultCount:
|
|
2452
|
-
fileCount:
|
|
2665
|
+
result: z6.string().describe("The formatted result of the LSP operation"),
|
|
2666
|
+
filePath: z6.string().describe("The file path the operation was performed on"),
|
|
2667
|
+
resultCount: z6.number().int().nonnegative().optional().describe("Number of results (definitions, references, symbols)"),
|
|
2668
|
+
fileCount: z6.number().int().nonnegative().optional().describe("Number of files containing results")
|
|
2453
2669
|
});
|
|
2454
2670
|
var OPERATION_LABELS = {
|
|
2455
2671
|
goToDefinition: { singular: "definition", plural: "definitions" },
|
|
@@ -2469,19 +2685,19 @@ function summarizeToolResult(operation, resultCount, fileCount) {
|
|
|
2469
2685
|
};
|
|
2470
2686
|
const noun = resultCount === 1 ? label.singular : label.plural;
|
|
2471
2687
|
if (operation === "hover" && resultCount > 0 && label.special) {
|
|
2472
|
-
return /* @__PURE__ */
|
|
2688
|
+
return /* @__PURE__ */ React6.createElement(Text6, null, "Hover info ", label.special);
|
|
2473
2689
|
}
|
|
2474
|
-
return /* @__PURE__ */
|
|
2690
|
+
return /* @__PURE__ */ React6.createElement(Text6, null, "Found ", /* @__PURE__ */ React6.createElement(Text6, { bold: true }, resultCount), " ", noun, fileCount > 1 ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, " ", "across ", /* @__PURE__ */ React6.createElement(Text6, { bold: true }, fileCount), " files") : null);
|
|
2475
2691
|
}
|
|
2476
2692
|
var LspTool = {
|
|
2477
2693
|
name: TOOL_NAME_FOR_PROMPT2,
|
|
2478
2694
|
async description() {
|
|
2479
|
-
return
|
|
2695
|
+
return DESCRIPTION4;
|
|
2480
2696
|
},
|
|
2481
2697
|
async prompt() {
|
|
2482
2698
|
return PROMPT4;
|
|
2483
2699
|
},
|
|
2484
|
-
inputSchema:
|
|
2700
|
+
inputSchema: inputSchema6,
|
|
2485
2701
|
userFacingName() {
|
|
2486
2702
|
return "LSP";
|
|
2487
2703
|
},
|
|
@@ -2499,7 +2715,7 @@ var LspTool = {
|
|
|
2499
2715
|
return !hasReadPermission(abs || getCwd());
|
|
2500
2716
|
},
|
|
2501
2717
|
async validateInput(input) {
|
|
2502
|
-
const parsed =
|
|
2718
|
+
const parsed = inputSchema6.safeParse(input);
|
|
2503
2719
|
if (!parsed.success) {
|
|
2504
2720
|
return {
|
|
2505
2721
|
result: false,
|
|
@@ -2563,7 +2779,7 @@ var LspTool = {
|
|
|
2563
2779
|
return parts.join(", ");
|
|
2564
2780
|
},
|
|
2565
2781
|
renderToolUseRejectedMessage() {
|
|
2566
|
-
return /* @__PURE__ */
|
|
2782
|
+
return /* @__PURE__ */ React6.createElement(FallbackToolUseRejectedMessage, null);
|
|
2567
2783
|
},
|
|
2568
2784
|
renderToolResultMessage(output, { verbose }) {
|
|
2569
2785
|
if (output.resultCount !== void 0 && output.fileCount !== void 0) {
|
|
@@ -2571,13 +2787,13 @@ var LspTool = {
|
|
|
2571
2787
|
maxLines: 120,
|
|
2572
2788
|
maxChars: 2e4
|
|
2573
2789
|
}) : null;
|
|
2574
|
-
return /* @__PURE__ */
|
|
2790
|
+
return /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "column" }, /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "row" }, /* @__PURE__ */ React6.createElement(Text6, null, "\xA0\xA0\u23BF \xA0"), summarizeToolResult(
|
|
2575
2791
|
output.operation,
|
|
2576
2792
|
output.resultCount,
|
|
2577
2793
|
output.fileCount
|
|
2578
|
-
)), display ? /* @__PURE__ */
|
|
2794
|
+
)), display ? /* @__PURE__ */ React6.createElement(Box6, { marginLeft: 5 }, /* @__PURE__ */ React6.createElement(Text6, null, display.text)) : null);
|
|
2579
2795
|
}
|
|
2580
|
-
return /* @__PURE__ */
|
|
2796
|
+
return /* @__PURE__ */ React6.createElement(Box6, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "row" }, /* @__PURE__ */ React6.createElement(Text6, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React6.createElement(Text6, null, output.result)));
|
|
2581
2797
|
},
|
|
2582
2798
|
renderResultForAssistant(output) {
|
|
2583
2799
|
return output.result;
|
|
@@ -2678,14 +2894,14 @@ var LspTool = {
|
|
|
2678
2894
|
};
|
|
2679
2895
|
|
|
2680
2896
|
// src/tools/mcp/ReadMcpResourceTool/ReadMcpResourceTool.tsx
|
|
2681
|
-
import { Box as
|
|
2682
|
-
import
|
|
2683
|
-
import { z as
|
|
2897
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
2898
|
+
import React7 from "react";
|
|
2899
|
+
import { z as z7 } from "zod";
|
|
2684
2900
|
import { ReadResourceResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
2685
2901
|
|
|
2686
2902
|
// src/tools/mcp/ReadMcpResourceTool/prompt.ts
|
|
2687
2903
|
var TOOL_NAME2 = "ReadMcpResourceTool";
|
|
2688
|
-
var
|
|
2904
|
+
var DESCRIPTION5 = `Reads a specific resource from an MCP server.
|
|
2689
2905
|
- server: The name of the MCP server to read from
|
|
2690
2906
|
- uri: The URI of the resource to read
|
|
2691
2907
|
|
|
@@ -2698,19 +2914,19 @@ Parameters:
|
|
|
2698
2914
|
- uri (required): The URI of the resource to read`;
|
|
2699
2915
|
|
|
2700
2916
|
// src/tools/mcp/ReadMcpResourceTool/ReadMcpResourceTool.tsx
|
|
2701
|
-
var
|
|
2702
|
-
server:
|
|
2703
|
-
uri:
|
|
2917
|
+
var inputSchema7 = z7.strictObject({
|
|
2918
|
+
server: z7.string().describe("The MCP server name"),
|
|
2919
|
+
uri: z7.string().describe("The resource URI to read")
|
|
2704
2920
|
});
|
|
2705
2921
|
var ReadMcpResourceTool = {
|
|
2706
2922
|
name: TOOL_NAME2,
|
|
2707
2923
|
async description() {
|
|
2708
|
-
return
|
|
2924
|
+
return DESCRIPTION5;
|
|
2709
2925
|
},
|
|
2710
2926
|
async prompt() {
|
|
2711
2927
|
return PROMPT5;
|
|
2712
2928
|
},
|
|
2713
|
-
inputSchema:
|
|
2929
|
+
inputSchema: inputSchema7,
|
|
2714
2930
|
userFacingName() {
|
|
2715
2931
|
return "readMcpResource";
|
|
2716
2932
|
},
|
|
@@ -2765,11 +2981,11 @@ var ReadMcpResourceTool = {
|
|
|
2765
2981
|
return `Read resource "${uri}" from server "${server}"`;
|
|
2766
2982
|
},
|
|
2767
2983
|
renderToolUseRejectedMessage() {
|
|
2768
|
-
return /* @__PURE__ */
|
|
2984
|
+
return /* @__PURE__ */ React7.createElement(FallbackToolUseRejectedMessage, null);
|
|
2769
2985
|
},
|
|
2770
2986
|
renderToolResultMessage(output) {
|
|
2771
2987
|
const count = output.contents?.length ?? 0;
|
|
2772
|
-
return /* @__PURE__ */
|
|
2988
|
+
return /* @__PURE__ */ React7.createElement(Box7, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "row" }, /* @__PURE__ */ React7.createElement(Text7, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React7.createElement(Text7, { bold: true }, "Read MCP resource"), /* @__PURE__ */ React7.createElement(Text7, null, count ? ` (${count} part${count === 1 ? "" : "s"})` : "")), /* @__PURE__ */ React7.createElement(Cost, { costUSD: 0, durationMs: 0, debug: false }));
|
|
2773
2989
|
},
|
|
2774
2990
|
renderResultForAssistant(output) {
|
|
2775
2991
|
return JSON.stringify(output);
|
|
@@ -2810,9 +3026,9 @@ var ReadMcpResourceTool = {
|
|
|
2810
3026
|
|
|
2811
3027
|
// src/tools/agent/TaskTool/TaskTool.tsx
|
|
2812
3028
|
import { last, memoize } from "lodash-es";
|
|
2813
|
-
import
|
|
2814
|
-
import { Box as
|
|
2815
|
-
import { z as
|
|
3029
|
+
import React8 from "react";
|
|
3030
|
+
import { Box as Box8, Text as Text8 } from "ink";
|
|
3031
|
+
import { z as z8 } from "zod";
|
|
2816
3032
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2817
3033
|
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
|
|
2818
3034
|
|
|
@@ -2910,17 +3126,17 @@ assistant: "I'm going to use the Task tool to launch the with the greeting-respo
|
|
|
2910
3126
|
var TOOL_NAME3 = "Task";
|
|
2911
3127
|
|
|
2912
3128
|
// src/tools/agent/TaskTool/TaskTool.tsx
|
|
2913
|
-
var
|
|
2914
|
-
description:
|
|
2915
|
-
prompt:
|
|
2916
|
-
subagent_type:
|
|
2917
|
-
model:
|
|
3129
|
+
var inputSchema8 = z8.object({
|
|
3130
|
+
description: z8.string().describe("A short (3-5 word) description of the task"),
|
|
3131
|
+
prompt: z8.string().describe("The task for the agent to perform"),
|
|
3132
|
+
subagent_type: z8.string().describe("The type of specialized agent to use for this task"),
|
|
3133
|
+
model: z8.enum(["sonnet", "opus", "haiku"]).optional().describe(
|
|
2918
3134
|
"Optional model to use for this agent. If not specified, inherits from parent. Prefer haiku for quick, straightforward tasks to minimize cost and latency."
|
|
2919
3135
|
),
|
|
2920
|
-
resume:
|
|
3136
|
+
resume: z8.string().optional().describe(
|
|
2921
3137
|
"Optional agent ID to resume from. If provided, the agent will continue from the previous execution transcript."
|
|
2922
3138
|
),
|
|
2923
|
-
run_in_background:
|
|
3139
|
+
run_in_background: z8.boolean().optional().describe(
|
|
2924
3140
|
"Set to true to run this agent in the background. Use TaskOutput to read the output later."
|
|
2925
3141
|
)
|
|
2926
3142
|
});
|
|
@@ -3071,7 +3287,7 @@ function buildForkContextForAgent(options) {
|
|
|
3071
3287
|
}
|
|
3072
3288
|
var TaskTool = {
|
|
3073
3289
|
name: TOOL_NAME3,
|
|
3074
|
-
inputSchema:
|
|
3290
|
+
inputSchema: inputSchema8,
|
|
3075
3291
|
async description() {
|
|
3076
3292
|
return "Launch a new task";
|
|
3077
3293
|
},
|
|
@@ -3134,20 +3350,20 @@ var TaskTool = {
|
|
|
3134
3350
|
return description;
|
|
3135
3351
|
},
|
|
3136
3352
|
renderToolUseRejectedMessage() {
|
|
3137
|
-
return /* @__PURE__ */
|
|
3353
|
+
return /* @__PURE__ */ React8.createElement(FallbackToolUseRejectedMessage, null);
|
|
3138
3354
|
},
|
|
3139
3355
|
renderToolResultMessage(output, { verbose }) {
|
|
3140
3356
|
const theme = getTheme();
|
|
3141
3357
|
if (output.status === "async_launched") {
|
|
3142
3358
|
const hint = output.prompt ? " (down arrow \u2193 to manage \xB7 ctrl+o to expand)" : " (down arrow \u2193 to manage)";
|
|
3143
|
-
return /* @__PURE__ */
|
|
3144
|
-
|
|
3359
|
+
return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "row" }, /* @__PURE__ */ React8.createElement(Text8, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React8.createElement(Text8, null, "Backgrounded agent", !verbose && /* @__PURE__ */ React8.createElement(Text8, { dimColor: true }, hint))), verbose && output.prompt && /* @__PURE__ */ React8.createElement(
|
|
3360
|
+
Box8,
|
|
3145
3361
|
{
|
|
3146
3362
|
paddingLeft: 2,
|
|
3147
3363
|
borderLeftStyle: "single",
|
|
3148
3364
|
borderLeftColor: theme.secondaryBorder
|
|
3149
3365
|
},
|
|
3150
|
-
/* @__PURE__ */
|
|
3366
|
+
/* @__PURE__ */ React8.createElement(Text8, { color: theme.secondaryText, wrap: "wrap" }, output.prompt)
|
|
3151
3367
|
));
|
|
3152
3368
|
}
|
|
3153
3369
|
const summary = [
|
|
@@ -3155,32 +3371,32 @@ var TaskTool = {
|
|
|
3155
3371
|
`${formatNumber(output.totalTokens)} tokens`,
|
|
3156
3372
|
formatDuration(output.totalDurationMs)
|
|
3157
3373
|
];
|
|
3158
|
-
return /* @__PURE__ */
|
|
3159
|
-
|
|
3374
|
+
return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column" }, verbose && output.prompt && /* @__PURE__ */ React8.createElement(
|
|
3375
|
+
Box8,
|
|
3160
3376
|
{
|
|
3161
3377
|
paddingLeft: 2,
|
|
3162
3378
|
borderLeftStyle: "single",
|
|
3163
3379
|
borderLeftColor: theme.secondaryBorder
|
|
3164
3380
|
},
|
|
3165
|
-
/* @__PURE__ */
|
|
3381
|
+
/* @__PURE__ */ React8.createElement(Text8, { color: theme.secondaryText, wrap: "wrap" }, maybeTruncateVerboseToolOutput(output.prompt, {
|
|
3166
3382
|
maxLines: 120,
|
|
3167
3383
|
maxChars: 2e4
|
|
3168
3384
|
}).text)
|
|
3169
|
-
), verbose && output.content.length > 0 && /* @__PURE__ */
|
|
3170
|
-
|
|
3385
|
+
), verbose && output.content.length > 0 && /* @__PURE__ */ React8.createElement(
|
|
3386
|
+
Box8,
|
|
3171
3387
|
{
|
|
3172
3388
|
paddingLeft: 2,
|
|
3173
3389
|
borderLeftStyle: "single",
|
|
3174
3390
|
borderLeftColor: theme.secondaryBorder
|
|
3175
3391
|
},
|
|
3176
|
-
/* @__PURE__ */
|
|
3392
|
+
/* @__PURE__ */ React8.createElement(Text8, { wrap: "wrap" }, maybeTruncateVerboseToolOutput(
|
|
3177
3393
|
output.content.map((b) => b.text).join("\n"),
|
|
3178
3394
|
{
|
|
3179
3395
|
maxLines: 200,
|
|
3180
3396
|
maxChars: 4e4
|
|
3181
3397
|
}
|
|
3182
3398
|
).text)
|
|
3183
|
-
), /* @__PURE__ */
|
|
3399
|
+
), /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "row" }, /* @__PURE__ */ React8.createElement(Text8, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React8.createElement(Text8, { dimColor: true }, "Done (", summary.join(" \xB7 "), ")")));
|
|
3184
3400
|
},
|
|
3185
3401
|
renderResultForAssistant(output) {
|
|
3186
3402
|
if (output.status === "async_launched")
|
|
@@ -3514,6 +3730,7 @@ var getAllTools = () => [
|
|
|
3514
3730
|
KillShellTool,
|
|
3515
3731
|
GlobTool,
|
|
3516
3732
|
GrepTool,
|
|
3733
|
+
LSTool,
|
|
3517
3734
|
LspTool,
|
|
3518
3735
|
FileReadTool,
|
|
3519
3736
|
FileEditTool,
|