pybao-cli 1.3.30 → 1.3.32
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-MLGMGJVD.js +42 -0
- package/dist/{acp-PSLYEI2X.js → acp-4ZALXJWJ.js} +26 -26
- package/dist/{agentsValidate-QM5IA7BZ.js → agentsValidate-5BMFDNLZ.js} +7 -7
- package/dist/{ask-GVGPAJCL.js → ask-XZ7Q2LWW.js} +25 -25
- package/dist/{autoUpdater-CHDMNRHS.js → autoUpdater-QU5IZU2U.js} +3 -3
- package/dist/{chunk-QUNW7WP7.js → chunk-3X7Z57YB.js} +1 -1
- package/dist/{chunk-QUNW7WP7.js.map → chunk-3X7Z57YB.js.map} +1 -1
- package/dist/{chunk-CK3Y22QN.js → chunk-4577DPJH.js} +1 -1
- package/dist/{chunk-Z2WBLT56.js → chunk-4HMCVYMA.js} +2 -2
- package/dist/{chunk-ZES4WJFY.js → chunk-5YXQUZXN.js} +2 -2
- package/dist/{chunk-C4UTFQLY.js → chunk-6434YR2Y.js} +4 -4
- package/dist/{chunk-VTPTICEE.js → chunk-7JI2ZPUM.js} +1 -1
- package/dist/{chunk-AVMYN6SA.js → chunk-C5CR2IE3.js} +3 -3
- package/dist/{chunk-QH73CG6D.js → chunk-CA4YEDR6.js} +4 -4
- package/dist/{chunk-CM663ZMY.js → chunk-CCK4IGN3.js} +2 -2
- package/dist/{chunk-HSLSFTOU.js → chunk-D4NCADRR.js} +3 -3
- package/dist/{chunk-BRUXNRVO.js → chunk-DUHC6VET.js} +3 -3
- package/dist/{chunk-NHJTFAOC.js → chunk-FABMZ3WX.js} +1 -1
- package/dist/{chunk-76IEF3FP.js → chunk-HQABGWIQ.js} +33 -32
- package/dist/{chunk-QNNNP4QP.js → chunk-JOLXQZEA.js} +2 -2
- package/dist/{chunk-RQUFQROB.js → chunk-LAZ6TPQW.js} +3 -3
- package/dist/{chunk-PFG37IPV.js → chunk-LJ6LV7JO.js} +195 -100
- package/dist/chunk-LJ6LV7JO.js.map +7 -0
- package/dist/{chunk-7VXMLP6I.js → chunk-N6YGX3WX.js} +3 -3
- package/dist/{chunk-XP6BTN4D.js → chunk-PBOVDFII.js} +3 -3
- package/dist/{chunk-UNCAEERM.js → chunk-QJSZOXJD.js} +1 -1
- package/dist/{chunk-LTHBC74R.js → chunk-RARRSUNF.js} +1 -1
- package/dist/{chunk-H7XIXJSB.js → chunk-TLE5RHB2.js} +1 -1
- package/dist/{chunk-VOSGO62D.js → chunk-TNFPDMGQ.js} +1 -1
- package/dist/{chunk-KKFBXX35.js → chunk-U6UWL5I5.js} +1 -1
- package/dist/{chunk-3VCTP434.js → chunk-VJCNG6ED.js} +2 -2
- package/dist/{chunk-HLGBFDIL.js → chunk-VMFZ5HAJ.js} +2 -2
- package/dist/{chunk-25RTD7HS.js → chunk-XMB7CJI7.js} +1 -1
- package/dist/{chunk-OSX24KVB.js → chunk-Z7K3JP6F.js} +3 -3
- package/dist/{cli-ED2FUUTE.js → cli-3RBDVL6F.js} +77 -77
- package/dist/commands-WAETNTC3.js +46 -0
- package/dist/{config-XSGBORJ3.js → config-XCEWSQ6D.js} +4 -4
- package/dist/{context-VM3K4JBR.js → context-WXZRC543.js} +5 -5
- package/dist/{customCommands-D3DQK33V.js → customCommands-KDY25Z64.js} +4 -4
- package/dist/{env-F5EWQ3AT.js → env-HKCUKG2L.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/{llm-CUHZ2PFS.js → llm-CKQ2OLUM.js} +26 -26
- package/dist/{llmLazy-L5PBPBXV.js → llmLazy-HUZ6GKNB.js} +1 -1
- package/dist/{loader-3BZQTJ3A.js → loader-NZFQUI4N.js} +4 -4
- package/dist/{mcp-RVOZCXKI.js → mcp-E7DJO3N4.js} +7 -7
- package/dist/{mentionProcessor-Q6CU33BE.js → mentionProcessor-W5FUTA47.js} +5 -5
- package/dist/{messages-4BHMX62G.js → messages-5L5NV6EN.js} +1 -1
- package/dist/{model-RR54H3PA.js → model-NSMV7O5V.js} +5 -5
- package/dist/{openai-E6FFNKJT.js → openai-FXXGAU6Q.js} +5 -5
- package/dist/{outputStyles-DN52VH52.js → outputStyles-5CP2F76C.js} +4 -4
- package/dist/{pluginRuntime-WNPDAJ37.js → pluginRuntime-55LJGUQI.js} +6 -6
- package/dist/{pluginValidation-3ESTMGEP.js → pluginValidation-KWGOZJ27.js} +6 -6
- package/dist/prompts-MHU5NRX5.js +48 -0
- package/dist/{pybAgentSessionLoad-JOERGWE6.js → pybAgentSessionLoad-T6BMJFLH.js} +4 -4
- package/dist/{pybAgentSessionResume-5ZKWZMIK.js → pybAgentSessionResume-X3ALXJPM.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-ZVRPC5KZ.js → pybAgentStreamJsonSession-YMMUZL34.js} +1 -1
- package/dist/{pybHooks-SM2CIYMN.js → pybHooks-SPGN3URJ.js} +4 -4
- package/dist/query-V2IPW4BC.js +50 -0
- package/dist/{ripgrep-TTQHT357.js → ripgrep-GRSFU3TD.js} +3 -3
- package/dist/{skillMarketplace-Z77XBUZV.js → skillMarketplace-47FUEYYV.js} +3 -3
- package/dist/{state-6IYCS2M5.js → state-46DOLHGZ.js} +2 -2
- package/dist/{theme-MAM4ZSCT.js → theme-XP5WLNHL.js} +5 -5
- package/dist/{toolPermissionSettings-ANKS7SSJ.js → toolPermissionSettings-FEGEZVJB.js} +6 -6
- package/dist/tools-CPJW3AHU.js +47 -0
- package/dist/{userInput-2ZXOQV46.js → userInput-TIPIRVR7.js} +27 -27
- package/package.json +1 -1
- package/dist/REPL-BJ2BB5FW.js +0 -42
- package/dist/chunk-PFG37IPV.js.map +0 -7
- package/dist/commands-4HCITHBL.js +0 -46
- package/dist/prompts-YHJBO3R4.js +0 -48
- package/dist/query-7Y6VUPRL.js +0 -50
- package/dist/tools-DGKKDLNU.js +0 -47
- /package/dist/{REPL-BJ2BB5FW.js.map → REPL-MLGMGJVD.js.map} +0 -0
- /package/dist/{acp-PSLYEI2X.js.map → acp-4ZALXJWJ.js.map} +0 -0
- /package/dist/{agentsValidate-QM5IA7BZ.js.map → agentsValidate-5BMFDNLZ.js.map} +0 -0
- /package/dist/{ask-GVGPAJCL.js.map → ask-XZ7Q2LWW.js.map} +0 -0
- /package/dist/{autoUpdater-CHDMNRHS.js.map → autoUpdater-QU5IZU2U.js.map} +0 -0
- /package/dist/{chunk-CK3Y22QN.js.map → chunk-4577DPJH.js.map} +0 -0
- /package/dist/{chunk-Z2WBLT56.js.map → chunk-4HMCVYMA.js.map} +0 -0
- /package/dist/{chunk-ZES4WJFY.js.map → chunk-5YXQUZXN.js.map} +0 -0
- /package/dist/{chunk-C4UTFQLY.js.map → chunk-6434YR2Y.js.map} +0 -0
- /package/dist/{chunk-VTPTICEE.js.map → chunk-7JI2ZPUM.js.map} +0 -0
- /package/dist/{chunk-AVMYN6SA.js.map → chunk-C5CR2IE3.js.map} +0 -0
- /package/dist/{chunk-QH73CG6D.js.map → chunk-CA4YEDR6.js.map} +0 -0
- /package/dist/{chunk-CM663ZMY.js.map → chunk-CCK4IGN3.js.map} +0 -0
- /package/dist/{chunk-HSLSFTOU.js.map → chunk-D4NCADRR.js.map} +0 -0
- /package/dist/{chunk-BRUXNRVO.js.map → chunk-DUHC6VET.js.map} +0 -0
- /package/dist/{chunk-NHJTFAOC.js.map → chunk-FABMZ3WX.js.map} +0 -0
- /package/dist/{chunk-76IEF3FP.js.map → chunk-HQABGWIQ.js.map} +0 -0
- /package/dist/{chunk-QNNNP4QP.js.map → chunk-JOLXQZEA.js.map} +0 -0
- /package/dist/{chunk-RQUFQROB.js.map → chunk-LAZ6TPQW.js.map} +0 -0
- /package/dist/{chunk-7VXMLP6I.js.map → chunk-N6YGX3WX.js.map} +0 -0
- /package/dist/{chunk-XP6BTN4D.js.map → chunk-PBOVDFII.js.map} +0 -0
- /package/dist/{chunk-UNCAEERM.js.map → chunk-QJSZOXJD.js.map} +0 -0
- /package/dist/{chunk-LTHBC74R.js.map → chunk-RARRSUNF.js.map} +0 -0
- /package/dist/{chunk-H7XIXJSB.js.map → chunk-TLE5RHB2.js.map} +0 -0
- /package/dist/{chunk-VOSGO62D.js.map → chunk-TNFPDMGQ.js.map} +0 -0
- /package/dist/{chunk-KKFBXX35.js.map → chunk-U6UWL5I5.js.map} +0 -0
- /package/dist/{chunk-3VCTP434.js.map → chunk-VJCNG6ED.js.map} +0 -0
- /package/dist/{chunk-HLGBFDIL.js.map → chunk-VMFZ5HAJ.js.map} +0 -0
- /package/dist/{chunk-25RTD7HS.js.map → chunk-XMB7CJI7.js.map} +0 -0
- /package/dist/{chunk-OSX24KVB.js.map → chunk-Z7K3JP6F.js.map} +0 -0
- /package/dist/{cli-ED2FUUTE.js.map → cli-3RBDVL6F.js.map} +0 -0
- /package/dist/{commands-4HCITHBL.js.map → commands-WAETNTC3.js.map} +0 -0
- /package/dist/{config-XSGBORJ3.js.map → config-XCEWSQ6D.js.map} +0 -0
- /package/dist/{context-VM3K4JBR.js.map → context-WXZRC543.js.map} +0 -0
- /package/dist/{customCommands-D3DQK33V.js.map → customCommands-KDY25Z64.js.map} +0 -0
- /package/dist/{env-F5EWQ3AT.js.map → env-HKCUKG2L.js.map} +0 -0
- /package/dist/{llm-CUHZ2PFS.js.map → llm-CKQ2OLUM.js.map} +0 -0
- /package/dist/{llmLazy-L5PBPBXV.js.map → llmLazy-HUZ6GKNB.js.map} +0 -0
- /package/dist/{loader-3BZQTJ3A.js.map → loader-NZFQUI4N.js.map} +0 -0
- /package/dist/{mcp-RVOZCXKI.js.map → mcp-E7DJO3N4.js.map} +0 -0
- /package/dist/{mentionProcessor-Q6CU33BE.js.map → mentionProcessor-W5FUTA47.js.map} +0 -0
- /package/dist/{messages-4BHMX62G.js.map → messages-5L5NV6EN.js.map} +0 -0
- /package/dist/{model-RR54H3PA.js.map → model-NSMV7O5V.js.map} +0 -0
- /package/dist/{openai-E6FFNKJT.js.map → openai-FXXGAU6Q.js.map} +0 -0
- /package/dist/{outputStyles-DN52VH52.js.map → outputStyles-5CP2F76C.js.map} +0 -0
- /package/dist/{pluginRuntime-WNPDAJ37.js.map → pluginRuntime-55LJGUQI.js.map} +0 -0
- /package/dist/{pluginValidation-3ESTMGEP.js.map → pluginValidation-KWGOZJ27.js.map} +0 -0
- /package/dist/{prompts-YHJBO3R4.js.map → prompts-MHU5NRX5.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-JOERGWE6.js.map → pybAgentSessionLoad-T6BMJFLH.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-5ZKWZMIK.js.map → pybAgentSessionResume-X3ALXJPM.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-ZVRPC5KZ.js.map → pybAgentStreamJsonSession-YMMUZL34.js.map} +0 -0
- /package/dist/{pybHooks-SM2CIYMN.js.map → pybHooks-SPGN3URJ.js.map} +0 -0
- /package/dist/{query-7Y6VUPRL.js.map → query-V2IPW4BC.js.map} +0 -0
- /package/dist/{ripgrep-TTQHT357.js.map → ripgrep-GRSFU3TD.js.map} +0 -0
- /package/dist/{skillMarketplace-Z77XBUZV.js.map → skillMarketplace-47FUEYYV.js.map} +0 -0
- /package/dist/{state-6IYCS2M5.js.map → state-46DOLHGZ.js.map} +0 -0
- /package/dist/{theme-MAM4ZSCT.js.map → theme-XP5WLNHL.js.map} +0 -0
- /package/dist/{toolPermissionSettings-ANKS7SSJ.js.map → toolPermissionSettings-FEGEZVJB.js.map} +0 -0
- /package/dist/{tools-DGKKDLNU.js.map → tools-CPJW3AHU.js.map} +0 -0
- /package/dist/{userInput-2ZXOQV46.js.map → userInput-TIPIRVR7.js.map} +0 -0
|
@@ -25,43 +25,44 @@ import {
|
|
|
25
25
|
getMaxThinkingTokens,
|
|
26
26
|
hasPermissionsToUseTool,
|
|
27
27
|
hasReadPermission,
|
|
28
|
+
hasWritePermission,
|
|
28
29
|
query
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HQABGWIQ.js";
|
|
30
31
|
import {
|
|
31
32
|
FallbackToolUseRejectedMessage,
|
|
32
33
|
MCPTool,
|
|
33
34
|
getClients,
|
|
34
35
|
getMCPTools
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-6434YR2Y.js";
|
|
36
37
|
import {
|
|
37
38
|
queryLLM
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-CA4YEDR6.js";
|
|
39
40
|
import {
|
|
40
41
|
generateAgentId
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-VMFZ5HAJ.js";
|
|
42
43
|
import {
|
|
43
44
|
getActiveAgents,
|
|
44
45
|
getAgentByType,
|
|
45
46
|
getAvailableAgentTypes
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-CCK4IGN3.js";
|
|
47
48
|
import {
|
|
48
49
|
INTERRUPT_MESSAGE,
|
|
49
50
|
createAssistantMessage,
|
|
50
51
|
createUserMessage,
|
|
51
52
|
getLastAssistantMessageId
|
|
52
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-QJSZOXJD.js";
|
|
53
54
|
import {
|
|
54
55
|
getModelManager
|
|
55
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-DUHC6VET.js";
|
|
56
57
|
import {
|
|
57
58
|
getContext
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-N6YGX3WX.js";
|
|
59
60
|
import {
|
|
60
61
|
getTheme
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-RARRSUNF.js";
|
|
62
63
|
import {
|
|
63
64
|
debug
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-XMB7CJI7.js";
|
|
65
66
|
import {
|
|
66
67
|
BunShell,
|
|
67
68
|
getCwd,
|
|
@@ -70,7 +71,7 @@ import {
|
|
|
70
71
|
logError,
|
|
71
72
|
overwriteLog,
|
|
72
73
|
readTaskOutput
|
|
73
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-TNFPDMGQ.js";
|
|
74
75
|
import {
|
|
75
76
|
formatDuration,
|
|
76
77
|
formatNumber
|
|
@@ -730,7 +731,7 @@ async function waitForBashTaskCompletion(args) {
|
|
|
730
731
|
if (!summary) return null;
|
|
731
732
|
if (summary.status !== "running" && summary.status !== "pending")
|
|
732
733
|
return summary;
|
|
733
|
-
await new Promise((
|
|
734
|
+
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
734
735
|
}
|
|
735
736
|
return buildTaskSummary(taskId);
|
|
736
737
|
}
|
|
@@ -905,10 +906,104 @@ ${output.task.output.trimEnd()}
|
|
|
905
906
|
}
|
|
906
907
|
};
|
|
907
908
|
|
|
908
|
-
// src/tools/
|
|
909
|
+
// src/tools/filesystem/DeleteFileTool/DeleteFileTool.tsx
|
|
910
|
+
import { rmSync, existsSync as existsSync2, statSync } from "fs";
|
|
909
911
|
import { Box as Box3, Text as Text3 } from "ink";
|
|
910
|
-
import React3 from "react";
|
|
912
|
+
import * as React3 from "react";
|
|
911
913
|
import { z as z3 } from "zod";
|
|
914
|
+
import { isAbsolute, relative, resolve } from "path";
|
|
915
|
+
|
|
916
|
+
// src/tools/filesystem/DeleteFileTool/prompt.ts
|
|
917
|
+
var PROMPT2 = `You can use this tool to delete files (regular file or directory), you can delete multi files in one toolcall, and you MUST make sure the files is exist before deleting.
|
|
918
|
+
When you need to delete file, you MUST use this tool to delete file instead of using shell.
|
|
919
|
+
|
|
920
|
+
Usage:
|
|
921
|
+
- The file_paths parameter must be an array of absolute paths.
|
|
922
|
+
- Supports recursive deletion for directories (be careful!).
|
|
923
|
+
- Safe and cross-platform (works on Windows/Linux/Mac).
|
|
924
|
+
- Do NOT use BashTool/RunCommand with 'rm', 'del', or 'rmdir'.
|
|
925
|
+
`;
|
|
926
|
+
|
|
927
|
+
// src/tools/filesystem/DeleteFileTool/DeleteFileTool.tsx
|
|
928
|
+
var inputSchema3 = z3.strictObject({
|
|
929
|
+
file_paths: z3.array(z3.string()).describe(
|
|
930
|
+
"The list of file paths you want to delete, you MUST set file path to absolute path."
|
|
931
|
+
)
|
|
932
|
+
});
|
|
933
|
+
var DeleteFileTool = {
|
|
934
|
+
name: "DeleteFile",
|
|
935
|
+
async description() {
|
|
936
|
+
return "Use this tool to delete files or directories. ALWAYS use this tool instead of running shell commands (like 'rm', 'del') to ensure cross-platform compatibility and safety. Supports deleting multiple paths at once.";
|
|
937
|
+
},
|
|
938
|
+
userFacingName: () => "DeleteFile",
|
|
939
|
+
async prompt() {
|
|
940
|
+
return PROMPT2;
|
|
941
|
+
},
|
|
942
|
+
inputSchema: inputSchema3,
|
|
943
|
+
async isEnabled() {
|
|
944
|
+
return true;
|
|
945
|
+
},
|
|
946
|
+
isReadOnly() {
|
|
947
|
+
return false;
|
|
948
|
+
},
|
|
949
|
+
isConcurrencySafe() {
|
|
950
|
+
return false;
|
|
951
|
+
},
|
|
952
|
+
needsPermissions({ file_paths }) {
|
|
953
|
+
return file_paths.some((path) => !hasWritePermission(path));
|
|
954
|
+
},
|
|
955
|
+
renderToolUseMessage(input, { verbose }) {
|
|
956
|
+
const paths = input.file_paths.map(
|
|
957
|
+
(p) => verbose ? p : relative(getCwd(), p)
|
|
958
|
+
).join(", ");
|
|
959
|
+
return `Deleting: ${paths}`;
|
|
960
|
+
},
|
|
961
|
+
renderToolUseRejectedMessage({ file_paths } = {}, { columns, verbose } = {}) {
|
|
962
|
+
if (!file_paths || file_paths.length === 0) {
|
|
963
|
+
return /* @__PURE__ */ React3.createElement(FallbackToolUseRejectedMessage, null);
|
|
964
|
+
}
|
|
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
|
+
},
|
|
967
|
+
async *execute({ file_paths }, { verbose }) {
|
|
968
|
+
const deletedItems = [];
|
|
969
|
+
const failedItems = [];
|
|
970
|
+
for (const rawPath of file_paths) {
|
|
971
|
+
const fullPath = isAbsolute(rawPath) ? rawPath : resolve(getCwd(), rawPath);
|
|
972
|
+
try {
|
|
973
|
+
if (!existsSync2(fullPath)) {
|
|
974
|
+
failedItems.push(`${rawPath} (not found)`);
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
const root = resolve(fullPath, "/");
|
|
978
|
+
if (fullPath === root) {
|
|
979
|
+
throw new Error("Cannot delete filesystem root");
|
|
980
|
+
}
|
|
981
|
+
const stats = statSync(fullPath);
|
|
982
|
+
const type = stats.isDirectory() ? "directory" : "file";
|
|
983
|
+
rmSync(fullPath, { recursive: true, force: true });
|
|
984
|
+
deletedItems.push(`${rawPath} (${type})`);
|
|
985
|
+
} catch (err) {
|
|
986
|
+
logError(err);
|
|
987
|
+
failedItems.push(`${rawPath} (${err.message})`);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
if (deletedItems.length > 0) {
|
|
991
|
+
yield /* @__PURE__ */ React3.createElement(Text3, null, "Deleted: ", deletedItems.join(", "));
|
|
992
|
+
}
|
|
993
|
+
if (failedItems.length > 0) {
|
|
994
|
+
yield /* @__PURE__ */ React3.createElement(Text3, { color: getTheme().warning }, "Failed to delete: ", failedItems.join(", "));
|
|
995
|
+
}
|
|
996
|
+
return {
|
|
997
|
+
deleted: deletedItems,
|
|
998
|
+
failed: failedItems
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
// src/tools/mcp/ListMcpResourcesTool/ListMcpResourcesTool.tsx
|
|
1004
|
+
import { Box as Box4, Text as Text4 } from "ink";
|
|
1005
|
+
import React4 from "react";
|
|
1006
|
+
import { z as z4 } from "zod";
|
|
912
1007
|
import { ListResourcesResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
913
1008
|
|
|
914
1009
|
// src/tools/mcp/ListMcpResourcesTool/prompt.ts
|
|
@@ -919,7 +1014,7 @@ Each resource object includes a 'server' field indicating which server it's from
|
|
|
919
1014
|
Usage examples:
|
|
920
1015
|
- List all resources from all servers: \`listMcpResources\`
|
|
921
1016
|
- List resources from a specific server: \`listMcpResources({ server: "myserver" })\``;
|
|
922
|
-
var
|
|
1017
|
+
var PROMPT3 = `List available resources from configured MCP servers.
|
|
923
1018
|
Each returned resource will include all standard MCP resource fields plus a 'server' field
|
|
924
1019
|
indicating which server the resource belongs to.
|
|
925
1020
|
|
|
@@ -928,8 +1023,8 @@ Parameters:
|
|
|
928
1023
|
resources from all servers will be returned.`;
|
|
929
1024
|
|
|
930
1025
|
// src/tools/mcp/ListMcpResourcesTool/ListMcpResourcesTool.tsx
|
|
931
|
-
var
|
|
932
|
-
server:
|
|
1026
|
+
var inputSchema4 = z4.strictObject({
|
|
1027
|
+
server: z4.string().optional().describe("Optional server name to filter resources by")
|
|
933
1028
|
});
|
|
934
1029
|
var ListMcpResourcesTool = {
|
|
935
1030
|
name: TOOL_NAME,
|
|
@@ -937,9 +1032,9 @@ var ListMcpResourcesTool = {
|
|
|
937
1032
|
return DESCRIPTION2;
|
|
938
1033
|
},
|
|
939
1034
|
async prompt() {
|
|
940
|
-
return
|
|
1035
|
+
return PROMPT3;
|
|
941
1036
|
},
|
|
942
|
-
inputSchema:
|
|
1037
|
+
inputSchema: inputSchema4,
|
|
943
1038
|
userFacingName() {
|
|
944
1039
|
return "listMcpResources";
|
|
945
1040
|
},
|
|
@@ -972,10 +1067,10 @@ var ListMcpResourcesTool = {
|
|
|
972
1067
|
return server ? `List MCP resources from server "${server}"` : "List all MCP resources";
|
|
973
1068
|
},
|
|
974
1069
|
renderToolUseRejectedMessage() {
|
|
975
|
-
return /* @__PURE__ */
|
|
1070
|
+
return /* @__PURE__ */ React4.createElement(FallbackToolUseRejectedMessage, null);
|
|
976
1071
|
},
|
|
977
1072
|
renderToolResultMessage(output) {
|
|
978
|
-
return /* @__PURE__ */
|
|
1073
|
+
return /* @__PURE__ */ React4.createElement(Box4, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "row" }, /* @__PURE__ */ React4.createElement(Text4, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React4.createElement(Text4, { bold: true }, output.length), /* @__PURE__ */ React4.createElement(Text4, null, " resources")), /* @__PURE__ */ React4.createElement(Cost, { costUSD: 0, durationMs: 0, debug: false }));
|
|
979
1074
|
},
|
|
980
1075
|
renderResultForAssistant(output) {
|
|
981
1076
|
return JSON.stringify(output);
|
|
@@ -1024,15 +1119,15 @@ var ListMcpResourcesTool = {
|
|
|
1024
1119
|
};
|
|
1025
1120
|
|
|
1026
1121
|
// src/tools/search/LspTool/LspTool.tsx
|
|
1027
|
-
import { existsSync as
|
|
1028
|
-
import { Box as
|
|
1122
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, statSync as statSync3 } from "fs";
|
|
1123
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
1029
1124
|
import { extname as extname3 } from "path";
|
|
1030
|
-
import
|
|
1031
|
-
import { z as
|
|
1125
|
+
import React5 from "react";
|
|
1126
|
+
import { z as z5 } from "zod";
|
|
1032
1127
|
|
|
1033
1128
|
// src/tools/search/LspTool/prompt.ts
|
|
1034
1129
|
var TOOL_NAME_FOR_PROMPT2 = "LSP";
|
|
1035
|
-
var
|
|
1130
|
+
var PROMPT4 = `Interact with Language Server Protocol (LSP) servers to get code intelligence features.
|
|
1036
1131
|
Supports 29+ languages including Python, Go, Rust, TypeScript, JavaScript, Bash, Java, C++, PHP, and more.
|
|
1037
1132
|
|
|
1038
1133
|
STRATEGY: Use this tool as an "Analyst" to *understand* code structure and relationships.
|
|
@@ -1061,12 +1156,12 @@ All operations require:
|
|
|
1061
1156
|
- character: The character offset (1-based, as shown in editors)
|
|
1062
1157
|
|
|
1063
1158
|
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.`;
|
|
1064
|
-
var DESCRIPTION3 =
|
|
1159
|
+
var DESCRIPTION3 = PROMPT4;
|
|
1065
1160
|
|
|
1066
1161
|
// src/tools/search/LspTool/TypeScriptBackend.ts
|
|
1067
|
-
import { statSync } from "fs";
|
|
1162
|
+
import { statSync as statSync2 } from "fs";
|
|
1068
1163
|
import { createRequire } from "node:module";
|
|
1069
|
-
import { extname, join as join2, relative } from "path";
|
|
1164
|
+
import { extname, join as join2, relative as relative2 } from "path";
|
|
1070
1165
|
import { pathToFileURL } from "url";
|
|
1071
1166
|
function extractSymbolAtPosition(lines, zeroBasedLine, zeroBasedCharacter) {
|
|
1072
1167
|
try {
|
|
@@ -1091,7 +1186,7 @@ function extractSymbolAtPosition(lines, zeroBasedLine, zeroBasedCharacter) {
|
|
|
1091
1186
|
function toProjectRelativeIfPossible(filePath) {
|
|
1092
1187
|
const cwd = getCwd();
|
|
1093
1188
|
try {
|
|
1094
|
-
const rel =
|
|
1189
|
+
const rel = relative2(cwd, filePath);
|
|
1095
1190
|
if (!rel || rel === "") return filePath;
|
|
1096
1191
|
if (rel.startsWith("..")) return filePath;
|
|
1097
1192
|
return rel;
|
|
@@ -1259,7 +1354,7 @@ function getOrCreateTsProject(projectCwd) {
|
|
|
1259
1354
|
getScriptFileNames: () => Array.from(rootFiles),
|
|
1260
1355
|
getScriptVersion: (fileName) => {
|
|
1261
1356
|
try {
|
|
1262
|
-
const stat =
|
|
1357
|
+
const stat = statSync2(fileName);
|
|
1263
1358
|
const version = String(stat.mtimeMs ?? Date.now());
|
|
1264
1359
|
versions.set(fileName, version);
|
|
1265
1360
|
return version;
|
|
@@ -1272,7 +1367,7 @@ function getOrCreateTsProject(projectCwd) {
|
|
|
1272
1367
|
if (!ts.sys.fileExists(fileName)) return void 0;
|
|
1273
1368
|
const content = ts.sys.readFile(fileName);
|
|
1274
1369
|
if (content === void 0) return void 0;
|
|
1275
|
-
const stat =
|
|
1370
|
+
const stat = statSync2(fileName);
|
|
1276
1371
|
versions.set(fileName, String(stat.mtimeMs ?? Date.now()));
|
|
1277
1372
|
return ts.ScriptSnapshot.fromString(content);
|
|
1278
1373
|
} catch {
|
|
@@ -1615,7 +1710,7 @@ var GenericLspClient = class {
|
|
|
1615
1710
|
const result = await this.connection.sendRequest("initialize", params);
|
|
1616
1711
|
await this.connection.sendNotification("initialized", {});
|
|
1617
1712
|
await this.connection.sendNotification("workspace/didChangeConfiguration", { settings: {} });
|
|
1618
|
-
await new Promise((
|
|
1713
|
+
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
1619
1714
|
this.capabilities = result.capabilities;
|
|
1620
1715
|
return result;
|
|
1621
1716
|
}
|
|
@@ -1697,7 +1792,7 @@ import { extname as extname2 } from "path";
|
|
|
1697
1792
|
|
|
1698
1793
|
// src/tools/search/LspTool/registry.ts
|
|
1699
1794
|
import { join as join3, dirname } from "path";
|
|
1700
|
-
import { existsSync as
|
|
1795
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1701
1796
|
import { spawnSync } from "child_process";
|
|
1702
1797
|
var BaseLspServer = class {
|
|
1703
1798
|
isInPath(cmd) {
|
|
@@ -1713,7 +1808,7 @@ var BaseLspServer = class {
|
|
|
1713
1808
|
const ext = process.platform === "win32" ? ".cmd" : "";
|
|
1714
1809
|
const localNodeModulesBin = join3(process.cwd(), "node_modules", ".bin");
|
|
1715
1810
|
let localBinPath = join3(localNodeModulesBin, `${binName}${ext}`);
|
|
1716
|
-
if (
|
|
1811
|
+
if (existsSync4(localBinPath)) {
|
|
1717
1812
|
return localBinPath;
|
|
1718
1813
|
}
|
|
1719
1814
|
try {
|
|
@@ -1729,7 +1824,7 @@ var BaseLspServer = class {
|
|
|
1729
1824
|
let pkgRoot = "";
|
|
1730
1825
|
for (let i = 0; i < 5; i++) {
|
|
1731
1826
|
current = join3(current, "..");
|
|
1732
|
-
if (
|
|
1827
|
+
if (existsSync4(join3(current, "package.json"))) {
|
|
1733
1828
|
pkgRoot = current;
|
|
1734
1829
|
break;
|
|
1735
1830
|
}
|
|
@@ -1737,7 +1832,7 @@ var BaseLspServer = class {
|
|
|
1737
1832
|
if (pkgRoot) {
|
|
1738
1833
|
const nodeModulesRoot = join3(pkgRoot, "..");
|
|
1739
1834
|
const potentialBin = join3(nodeModulesRoot, ".bin", `${binName}${ext}`);
|
|
1740
|
-
if (
|
|
1835
|
+
if (existsSync4(potentialBin)) {
|
|
1741
1836
|
return potentialBin;
|
|
1742
1837
|
}
|
|
1743
1838
|
}
|
|
@@ -1767,7 +1862,7 @@ var GenericNpmServer = class extends BaseLspServer {
|
|
|
1767
1862
|
return true;
|
|
1768
1863
|
}
|
|
1769
1864
|
const localBin = this.getLocalBinPath(this.binName);
|
|
1770
|
-
if (
|
|
1865
|
+
if (existsSync4(localBin)) {
|
|
1771
1866
|
return true;
|
|
1772
1867
|
}
|
|
1773
1868
|
return false;
|
|
@@ -1786,12 +1881,12 @@ var GenericNpmServer = class extends BaseLspServer {
|
|
|
1786
1881
|
if (binScript) {
|
|
1787
1882
|
if (this.npmPackage === "pyright" && binScript.endsWith("langserver.index.js")) {
|
|
1788
1883
|
const distScript = join3(dirname(pkgJsonPath), "dist", "pyright-langserver.js");
|
|
1789
|
-
if (
|
|
1884
|
+
if (existsSync4(distScript)) {
|
|
1790
1885
|
return { command: process.execPath, args: [distScript, ...this.args] };
|
|
1791
1886
|
}
|
|
1792
1887
|
}
|
|
1793
1888
|
const scriptPath = join3(dirname(pkgJsonPath), binScript);
|
|
1794
|
-
if (
|
|
1889
|
+
if (existsSync4(scriptPath)) {
|
|
1795
1890
|
return { command: process.execPath, args: [scriptPath, ...this.args] };
|
|
1796
1891
|
}
|
|
1797
1892
|
}
|
|
@@ -1802,7 +1897,7 @@ var GenericNpmServer = class extends BaseLspServer {
|
|
|
1802
1897
|
return { command: this.binName, args: this.args };
|
|
1803
1898
|
}
|
|
1804
1899
|
const localBin = this.getLocalBinPath(this.binName);
|
|
1805
|
-
if (
|
|
1900
|
+
if (existsSync4(localBin)) {
|
|
1806
1901
|
return { command: localBin, args: this.args };
|
|
1807
1902
|
}
|
|
1808
1903
|
return null;
|
|
@@ -2224,11 +2319,11 @@ var LspClientManager = class _LspClientManager {
|
|
|
2224
2319
|
|
|
2225
2320
|
// src/tools/search/LspTool/client/formatters.ts
|
|
2226
2321
|
import { fileURLToPath } from "url";
|
|
2227
|
-
import { relative as
|
|
2322
|
+
import { relative as relative3 } from "path";
|
|
2228
2323
|
function toProjectRelative(filePath) {
|
|
2229
2324
|
const cwd = getCwd();
|
|
2230
2325
|
try {
|
|
2231
|
-
const rel =
|
|
2326
|
+
const rel = relative3(cwd, filePath);
|
|
2232
2327
|
if (!rel || rel === "") return filePath;
|
|
2233
2328
|
if (rel.startsWith("..")) return filePath;
|
|
2234
2329
|
return rel;
|
|
@@ -2323,8 +2418,8 @@ function formatGenericDocumentSymbolResult(result) {
|
|
|
2323
2418
|
}
|
|
2324
2419
|
|
|
2325
2420
|
// src/tools/search/LspTool/LspTool.tsx
|
|
2326
|
-
var
|
|
2327
|
-
operation:
|
|
2421
|
+
var inputSchema5 = z5.strictObject({
|
|
2422
|
+
operation: z5.enum([
|
|
2328
2423
|
"goToDefinition",
|
|
2329
2424
|
"findReferences",
|
|
2330
2425
|
"hover",
|
|
@@ -2335,12 +2430,12 @@ var inputSchema4 = z4.strictObject({
|
|
|
2335
2430
|
"incomingCalls",
|
|
2336
2431
|
"outgoingCalls"
|
|
2337
2432
|
]).describe("The LSP operation to perform"),
|
|
2338
|
-
filePath:
|
|
2339
|
-
line:
|
|
2340
|
-
character:
|
|
2433
|
+
filePath: z5.string().describe("The absolute or relative path to the file"),
|
|
2434
|
+
line: z5.number().int().positive().describe("The line number (1-based, as shown in editors)"),
|
|
2435
|
+
character: z5.number().int().positive().describe("The character offset (1-based, as shown in editors)")
|
|
2341
2436
|
});
|
|
2342
|
-
var outputSchema =
|
|
2343
|
-
operation:
|
|
2437
|
+
var outputSchema = z5.object({
|
|
2438
|
+
operation: z5.enum([
|
|
2344
2439
|
"goToDefinition",
|
|
2345
2440
|
"findReferences",
|
|
2346
2441
|
"hover",
|
|
@@ -2351,10 +2446,10 @@ var outputSchema = z4.object({
|
|
|
2351
2446
|
"incomingCalls",
|
|
2352
2447
|
"outgoingCalls"
|
|
2353
2448
|
]).describe("The LSP operation that was performed"),
|
|
2354
|
-
result:
|
|
2355
|
-
filePath:
|
|
2356
|
-
resultCount:
|
|
2357
|
-
fileCount:
|
|
2449
|
+
result: z5.string().describe("The formatted result of the LSP operation"),
|
|
2450
|
+
filePath: z5.string().describe("The file path the operation was performed on"),
|
|
2451
|
+
resultCount: z5.number().int().nonnegative().optional().describe("Number of results (definitions, references, symbols)"),
|
|
2452
|
+
fileCount: z5.number().int().nonnegative().optional().describe("Number of files containing results")
|
|
2358
2453
|
});
|
|
2359
2454
|
var OPERATION_LABELS = {
|
|
2360
2455
|
goToDefinition: { singular: "definition", plural: "definitions" },
|
|
@@ -2374,9 +2469,9 @@ function summarizeToolResult(operation, resultCount, fileCount) {
|
|
|
2374
2469
|
};
|
|
2375
2470
|
const noun = resultCount === 1 ? label.singular : label.plural;
|
|
2376
2471
|
if (operation === "hover" && resultCount > 0 && label.special) {
|
|
2377
|
-
return /* @__PURE__ */
|
|
2472
|
+
return /* @__PURE__ */ React5.createElement(Text5, null, "Hover info ", label.special);
|
|
2378
2473
|
}
|
|
2379
|
-
return /* @__PURE__ */
|
|
2474
|
+
return /* @__PURE__ */ React5.createElement(Text5, null, "Found ", /* @__PURE__ */ React5.createElement(Text5, { bold: true }, resultCount), " ", noun, fileCount > 1 ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, " ", "across ", /* @__PURE__ */ React5.createElement(Text5, { bold: true }, fileCount), " files") : null);
|
|
2380
2475
|
}
|
|
2381
2476
|
var LspTool = {
|
|
2382
2477
|
name: TOOL_NAME_FOR_PROMPT2,
|
|
@@ -2384,9 +2479,9 @@ var LspTool = {
|
|
|
2384
2479
|
return DESCRIPTION3;
|
|
2385
2480
|
},
|
|
2386
2481
|
async prompt() {
|
|
2387
|
-
return
|
|
2482
|
+
return PROMPT4;
|
|
2388
2483
|
},
|
|
2389
|
-
inputSchema:
|
|
2484
|
+
inputSchema: inputSchema5,
|
|
2390
2485
|
userFacingName() {
|
|
2391
2486
|
return "LSP";
|
|
2392
2487
|
},
|
|
@@ -2404,7 +2499,7 @@ var LspTool = {
|
|
|
2404
2499
|
return !hasReadPermission(abs || getCwd());
|
|
2405
2500
|
},
|
|
2406
2501
|
async validateInput(input) {
|
|
2407
|
-
const parsed =
|
|
2502
|
+
const parsed = inputSchema5.safeParse(input);
|
|
2408
2503
|
if (!parsed.success) {
|
|
2409
2504
|
return {
|
|
2410
2505
|
result: false,
|
|
@@ -2413,7 +2508,7 @@ var LspTool = {
|
|
|
2413
2508
|
};
|
|
2414
2509
|
}
|
|
2415
2510
|
const absPath = getAbsolutePath(input.filePath) ?? input.filePath;
|
|
2416
|
-
if (!
|
|
2511
|
+
if (!existsSync5(absPath)) {
|
|
2417
2512
|
return {
|
|
2418
2513
|
result: false,
|
|
2419
2514
|
message: `File does not exist: ${input.filePath}`,
|
|
@@ -2421,7 +2516,7 @@ var LspTool = {
|
|
|
2421
2516
|
};
|
|
2422
2517
|
}
|
|
2423
2518
|
try {
|
|
2424
|
-
if (!
|
|
2519
|
+
if (!statSync3(absPath).isFile()) {
|
|
2425
2520
|
return {
|
|
2426
2521
|
result: false,
|
|
2427
2522
|
message: `Path is not a file: ${input.filePath}`,
|
|
@@ -2468,7 +2563,7 @@ var LspTool = {
|
|
|
2468
2563
|
return parts.join(", ");
|
|
2469
2564
|
},
|
|
2470
2565
|
renderToolUseRejectedMessage() {
|
|
2471
|
-
return /* @__PURE__ */
|
|
2566
|
+
return /* @__PURE__ */ React5.createElement(FallbackToolUseRejectedMessage, null);
|
|
2472
2567
|
},
|
|
2473
2568
|
renderToolResultMessage(output, { verbose }) {
|
|
2474
2569
|
if (output.resultCount !== void 0 && output.fileCount !== void 0) {
|
|
@@ -2476,13 +2571,13 @@ var LspTool = {
|
|
|
2476
2571
|
maxLines: 120,
|
|
2477
2572
|
maxChars: 2e4
|
|
2478
2573
|
}) : null;
|
|
2479
|
-
return /* @__PURE__ */
|
|
2574
|
+
return /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column" }, /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "row" }, /* @__PURE__ */ React5.createElement(Text5, null, "\xA0\xA0\u23BF \xA0"), summarizeToolResult(
|
|
2480
2575
|
output.operation,
|
|
2481
2576
|
output.resultCount,
|
|
2482
2577
|
output.fileCount
|
|
2483
|
-
)), display ? /* @__PURE__ */
|
|
2578
|
+
)), display ? /* @__PURE__ */ React5.createElement(Box5, { marginLeft: 5 }, /* @__PURE__ */ React5.createElement(Text5, null, display.text)) : null);
|
|
2484
2579
|
}
|
|
2485
|
-
return /* @__PURE__ */
|
|
2580
|
+
return /* @__PURE__ */ React5.createElement(Box5, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "row" }, /* @__PURE__ */ React5.createElement(Text5, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React5.createElement(Text5, null, output.result)));
|
|
2486
2581
|
},
|
|
2487
2582
|
renderResultForAssistant(output) {
|
|
2488
2583
|
return output.result;
|
|
@@ -2583,9 +2678,9 @@ var LspTool = {
|
|
|
2583
2678
|
};
|
|
2584
2679
|
|
|
2585
2680
|
// src/tools/mcp/ReadMcpResourceTool/ReadMcpResourceTool.tsx
|
|
2586
|
-
import { Box as
|
|
2587
|
-
import
|
|
2588
|
-
import { z as
|
|
2681
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
2682
|
+
import React6 from "react";
|
|
2683
|
+
import { z as z6 } from "zod";
|
|
2589
2684
|
import { ReadResourceResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
2590
2685
|
|
|
2591
2686
|
// src/tools/mcp/ReadMcpResourceTool/prompt.ts
|
|
@@ -2596,16 +2691,16 @@ var DESCRIPTION4 = `Reads a specific resource from an MCP server.
|
|
|
2596
2691
|
|
|
2597
2692
|
Usage examples:
|
|
2598
2693
|
- Read a resource from a server: \`readMcpResource({ server: "myserver", uri: "my-resource-uri" })\``;
|
|
2599
|
-
var
|
|
2694
|
+
var PROMPT5 = `Reads a specific resource from an MCP server, identified by server name and resource URI.
|
|
2600
2695
|
|
|
2601
2696
|
Parameters:
|
|
2602
2697
|
- server (required): The name of the MCP server from which to read the resource
|
|
2603
2698
|
- uri (required): The URI of the resource to read`;
|
|
2604
2699
|
|
|
2605
2700
|
// src/tools/mcp/ReadMcpResourceTool/ReadMcpResourceTool.tsx
|
|
2606
|
-
var
|
|
2607
|
-
server:
|
|
2608
|
-
uri:
|
|
2701
|
+
var inputSchema6 = z6.strictObject({
|
|
2702
|
+
server: z6.string().describe("The MCP server name"),
|
|
2703
|
+
uri: z6.string().describe("The resource URI to read")
|
|
2609
2704
|
});
|
|
2610
2705
|
var ReadMcpResourceTool = {
|
|
2611
2706
|
name: TOOL_NAME2,
|
|
@@ -2613,9 +2708,9 @@ var ReadMcpResourceTool = {
|
|
|
2613
2708
|
return DESCRIPTION4;
|
|
2614
2709
|
},
|
|
2615
2710
|
async prompt() {
|
|
2616
|
-
return
|
|
2711
|
+
return PROMPT5;
|
|
2617
2712
|
},
|
|
2618
|
-
inputSchema:
|
|
2713
|
+
inputSchema: inputSchema6,
|
|
2619
2714
|
userFacingName() {
|
|
2620
2715
|
return "readMcpResource";
|
|
2621
2716
|
},
|
|
@@ -2670,11 +2765,11 @@ var ReadMcpResourceTool = {
|
|
|
2670
2765
|
return `Read resource "${uri}" from server "${server}"`;
|
|
2671
2766
|
},
|
|
2672
2767
|
renderToolUseRejectedMessage() {
|
|
2673
|
-
return /* @__PURE__ */
|
|
2768
|
+
return /* @__PURE__ */ React6.createElement(FallbackToolUseRejectedMessage, null);
|
|
2674
2769
|
},
|
|
2675
2770
|
renderToolResultMessage(output) {
|
|
2676
2771
|
const count = output.contents?.length ?? 0;
|
|
2677
|
-
return /* @__PURE__ */
|
|
2772
|
+
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, { bold: true }, "Read MCP resource"), /* @__PURE__ */ React6.createElement(Text6, null, count ? ` (${count} part${count === 1 ? "" : "s"})` : "")), /* @__PURE__ */ React6.createElement(Cost, { costUSD: 0, durationMs: 0, debug: false }));
|
|
2678
2773
|
},
|
|
2679
2774
|
renderResultForAssistant(output) {
|
|
2680
2775
|
return JSON.stringify(output);
|
|
@@ -2715,11 +2810,11 @@ var ReadMcpResourceTool = {
|
|
|
2715
2810
|
|
|
2716
2811
|
// src/tools/agent/TaskTool/TaskTool.tsx
|
|
2717
2812
|
import { last, memoize } from "lodash-es";
|
|
2718
|
-
import
|
|
2719
|
-
import { Box as
|
|
2720
|
-
import { z as
|
|
2813
|
+
import React7 from "react";
|
|
2814
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
2815
|
+
import { z as z7 } from "zod";
|
|
2721
2816
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
2722
|
-
import { existsSync as
|
|
2817
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
|
|
2723
2818
|
|
|
2724
2819
|
// src/utils/agent/transcripts.ts
|
|
2725
2820
|
var transcripts = /* @__PURE__ */ new Map();
|
|
@@ -2815,17 +2910,17 @@ assistant: "I'm going to use the Task tool to launch the with the greeting-respo
|
|
|
2815
2910
|
var TOOL_NAME3 = "Task";
|
|
2816
2911
|
|
|
2817
2912
|
// src/tools/agent/TaskTool/TaskTool.tsx
|
|
2818
|
-
var
|
|
2819
|
-
description:
|
|
2820
|
-
prompt:
|
|
2821
|
-
subagent_type:
|
|
2822
|
-
model:
|
|
2913
|
+
var inputSchema7 = z7.object({
|
|
2914
|
+
description: z7.string().describe("A short (3-5 word) description of the task"),
|
|
2915
|
+
prompt: z7.string().describe("The task for the agent to perform"),
|
|
2916
|
+
subagent_type: z7.string().describe("The type of specialized agent to use for this task"),
|
|
2917
|
+
model: z7.enum(["sonnet", "opus", "haiku"]).optional().describe(
|
|
2823
2918
|
"Optional model to use for this agent. If not specified, inherits from parent. Prefer haiku for quick, straightforward tasks to minimize cost and latency."
|
|
2824
2919
|
),
|
|
2825
|
-
resume:
|
|
2920
|
+
resume: z7.string().optional().describe(
|
|
2826
2921
|
"Optional agent ID to resume from. If provided, the agent will continue from the previous execution transcript."
|
|
2827
2922
|
),
|
|
2828
|
-
run_in_background:
|
|
2923
|
+
run_in_background: z7.boolean().optional().describe(
|
|
2829
2924
|
"Set to true to run this agent in the background. Use TaskOutput to read the output later."
|
|
2830
2925
|
)
|
|
2831
2926
|
});
|
|
@@ -2893,7 +2988,7 @@ function applyAgentPermissionMode(base, options) {
|
|
|
2893
2988
|
return { ...base, mode: options.agentPermissionMode };
|
|
2894
2989
|
}
|
|
2895
2990
|
function readJsonArrayFile(path) {
|
|
2896
|
-
if (!
|
|
2991
|
+
if (!existsSync6(path)) return null;
|
|
2897
2992
|
try {
|
|
2898
2993
|
const raw = readFileSync4(path, "utf8");
|
|
2899
2994
|
const parsed = JSON.parse(raw);
|
|
@@ -2976,7 +3071,7 @@ function buildForkContextForAgent(options) {
|
|
|
2976
3071
|
}
|
|
2977
3072
|
var TaskTool = {
|
|
2978
3073
|
name: TOOL_NAME3,
|
|
2979
|
-
inputSchema:
|
|
3074
|
+
inputSchema: inputSchema7,
|
|
2980
3075
|
async description() {
|
|
2981
3076
|
return "Launch a new task";
|
|
2982
3077
|
},
|
|
@@ -3039,20 +3134,20 @@ var TaskTool = {
|
|
|
3039
3134
|
return description;
|
|
3040
3135
|
},
|
|
3041
3136
|
renderToolUseRejectedMessage() {
|
|
3042
|
-
return /* @__PURE__ */
|
|
3137
|
+
return /* @__PURE__ */ React7.createElement(FallbackToolUseRejectedMessage, null);
|
|
3043
3138
|
},
|
|
3044
3139
|
renderToolResultMessage(output, { verbose }) {
|
|
3045
3140
|
const theme = getTheme();
|
|
3046
3141
|
if (output.status === "async_launched") {
|
|
3047
3142
|
const hint = output.prompt ? " (down arrow \u2193 to manage \xB7 ctrl+o to expand)" : " (down arrow \u2193 to manage)";
|
|
3048
|
-
return /* @__PURE__ */
|
|
3049
|
-
|
|
3143
|
+
return /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "column" }, /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "row" }, /* @__PURE__ */ React7.createElement(Text7, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React7.createElement(Text7, null, "Backgrounded agent", !verbose && /* @__PURE__ */ React7.createElement(Text7, { dimColor: true }, hint))), verbose && output.prompt && /* @__PURE__ */ React7.createElement(
|
|
3144
|
+
Box7,
|
|
3050
3145
|
{
|
|
3051
3146
|
paddingLeft: 2,
|
|
3052
3147
|
borderLeftStyle: "single",
|
|
3053
3148
|
borderLeftColor: theme.secondaryBorder
|
|
3054
3149
|
},
|
|
3055
|
-
/* @__PURE__ */
|
|
3150
|
+
/* @__PURE__ */ React7.createElement(Text7, { color: theme.secondaryText, wrap: "wrap" }, output.prompt)
|
|
3056
3151
|
));
|
|
3057
3152
|
}
|
|
3058
3153
|
const summary = [
|
|
@@ -3060,32 +3155,32 @@ var TaskTool = {
|
|
|
3060
3155
|
`${formatNumber(output.totalTokens)} tokens`,
|
|
3061
3156
|
formatDuration(output.totalDurationMs)
|
|
3062
3157
|
];
|
|
3063
|
-
return /* @__PURE__ */
|
|
3064
|
-
|
|
3158
|
+
return /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "column" }, verbose && output.prompt && /* @__PURE__ */ React7.createElement(
|
|
3159
|
+
Box7,
|
|
3065
3160
|
{
|
|
3066
3161
|
paddingLeft: 2,
|
|
3067
3162
|
borderLeftStyle: "single",
|
|
3068
3163
|
borderLeftColor: theme.secondaryBorder
|
|
3069
3164
|
},
|
|
3070
|
-
/* @__PURE__ */
|
|
3165
|
+
/* @__PURE__ */ React7.createElement(Text7, { color: theme.secondaryText, wrap: "wrap" }, maybeTruncateVerboseToolOutput(output.prompt, {
|
|
3071
3166
|
maxLines: 120,
|
|
3072
3167
|
maxChars: 2e4
|
|
3073
3168
|
}).text)
|
|
3074
|
-
), verbose && output.content.length > 0 && /* @__PURE__ */
|
|
3075
|
-
|
|
3169
|
+
), verbose && output.content.length > 0 && /* @__PURE__ */ React7.createElement(
|
|
3170
|
+
Box7,
|
|
3076
3171
|
{
|
|
3077
3172
|
paddingLeft: 2,
|
|
3078
3173
|
borderLeftStyle: "single",
|
|
3079
3174
|
borderLeftColor: theme.secondaryBorder
|
|
3080
3175
|
},
|
|
3081
|
-
/* @__PURE__ */
|
|
3176
|
+
/* @__PURE__ */ React7.createElement(Text7, { wrap: "wrap" }, maybeTruncateVerboseToolOutput(
|
|
3082
3177
|
output.content.map((b) => b.text).join("\n"),
|
|
3083
3178
|
{
|
|
3084
3179
|
maxLines: 200,
|
|
3085
3180
|
maxChars: 4e4
|
|
3086
3181
|
}
|
|
3087
3182
|
).text)
|
|
3088
|
-
), /* @__PURE__ */
|
|
3183
|
+
), /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "row" }, /* @__PURE__ */ React7.createElement(Text7, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React7.createElement(Text7, { dimColor: true }, "Done (", summary.join(" \xB7 "), ")")));
|
|
3089
3184
|
},
|
|
3090
3185
|
renderResultForAssistant(output) {
|
|
3091
3186
|
if (output.status === "async_launched")
|