pybao-cli 1.3.89 → 1.3.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-LOJVC37U.js +47 -0
- package/dist/{acp-RGMIE4DU.js → acp-6PJPOT5M.js} +29 -29
- package/dist/{agentsValidate-MIP3HSNM.js → agentsValidate-LZNBNHP6.js} +7 -7
- package/dist/{ask-WWDKFT4S.js → ask-76BUROTN.js} +28 -28
- package/dist/{autoUpdater-HNFOZCBL.js → autoUpdater-OK2HAUOA.js} +3 -3
- package/dist/{chunk-SNRPFDBW.js → chunk-57ZD6EQN.js} +1 -1
- package/dist/{chunk-RVS72LGR.js → chunk-7LTDWLR6.js} +1 -1
- package/dist/{chunk-RVS72LGR.js.map → chunk-7LTDWLR6.js.map} +1 -1
- package/dist/{chunk-52XBAAOD.js → chunk-AKPBJECB.js} +1 -1
- package/dist/{chunk-SG7SPYM4.js → chunk-AWQ5CGW5.js} +1 -1
- package/dist/{chunk-AWJL67ZK.js → chunk-BULWYV5N.js} +53 -39
- package/dist/{chunk-AWJL67ZK.js.map → chunk-BULWYV5N.js.map} +3 -3
- package/dist/{chunk-N32NFSDQ.js → chunk-DCRXZZJX.js} +2 -2
- package/dist/{chunk-PC4T3EHY.js → chunk-DG4EUTSH.js} +2 -2
- package/dist/{chunk-7ZRJIA2T.js → chunk-ESQZEVRN.js} +1 -1
- package/dist/{chunk-HENGZ5QD.js → chunk-F5CU72WX.js} +3 -3
- package/dist/{chunk-ZMKBSLLD.js → chunk-FLLFJL7B.js} +1 -1
- package/dist/{chunk-RHMAO6OV.js → chunk-GQWBRVCL.js} +1 -1
- package/dist/{chunk-5VYUNKPN.js → chunk-IQDGXR2L.js} +3 -3
- package/dist/{chunk-CUICIV5I.js → chunk-JTGSEBAT.js} +3 -3
- package/dist/{chunk-NSNUA3AI.js → chunk-K3QOARLB.js} +3 -3
- package/dist/{chunk-CU7LUROX.js → chunk-KOHH2H5S.js} +2 -2
- package/dist/{chunk-4IUTKGZ3.js → chunk-KOZFO5PM.js} +3 -3
- package/dist/{chunk-LNJEAGUM.js → chunk-MBBGTD7O.js} +1 -1
- package/dist/{chunk-QQP7RZHT.js → chunk-MJCH3WTW.js} +3 -3
- package/dist/{chunk-3DJZ2FP3.js → chunk-O2UT6CSX.js} +4 -4
- package/dist/{chunk-L7H4HULV.js → chunk-ODYWGMTG.js} +3 -3
- package/dist/{chunk-5P7OEKKE.js → chunk-RQVFFNI2.js} +556 -149
- package/dist/chunk-RQVFFNI2.js.map +7 -0
- package/dist/{chunk-K427K545.js → chunk-TQMAHPW3.js} +3 -3
- package/dist/{chunk-P4BU7OLK.js → chunk-TU4W4WGH.js} +1 -1
- package/dist/{chunk-RWT3O44A.js → chunk-TYHTF3BE.js} +2 -2
- package/dist/{chunk-LHVJ4DCY.js → chunk-UJAA45KE.js} +2 -2
- package/dist/{chunk-NE7ZMP3U.js → chunk-UMO4Y6IF.js} +2 -2
- package/dist/{chunk-YI4WTP42.js → chunk-VNIV2R6B.js} +2 -2
- package/dist/{chunk-XKJGQBIN.js → chunk-WNZU3TS3.js} +3 -3
- package/dist/{chunk-BBZOZE5U.js → chunk-WW3UO4TS.js} +1 -1
- package/dist/{chunk-QNTNP3TF.js → chunk-ZMABUWI2.js} +4 -4
- package/dist/{cli-DBIRYO2K.js → cli-MHACN3EZ.js} +87 -87
- package/dist/commands-27WBI67S.js +51 -0
- package/dist/{config-WF57SRJH.js → config-FAPLL3AS.js} +4 -4
- package/dist/{context-KZT5TVOO.js → context-ZNW4KPID.js} +5 -5
- package/dist/{customCommands-RROXEXFI.js → customCommands-L46UUKJJ.js} +4 -4
- package/dist/{env-V3EUI52X.js → env-I77N3GWS.js} +2 -2
- package/dist/{file-EY5S5X2I.js → file-DZLGJNYY.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-HRDLIEIJ.js → llm-RTLJBLJE.js} +29 -29
- package/dist/{llmLazy-5JLFDV6C.js → llmLazy-5RJ5OQ6P.js} +1 -1
- package/dist/{loader-F2SDAB3W.js → loader-OMI5VTDL.js} +4 -4
- package/dist/{lsp-IEUZLTEJ.js → lsp-4GIZ5WWB.js} +6 -6
- package/dist/{lspAnchor-UT54IBRE.js → lspAnchor-MYE3MOZN.js} +6 -6
- package/dist/{mcp-MJTCLGYY.js → mcp-GJCOU7DQ.js} +7 -7
- package/dist/{mentionProcessor-H7F7SZ5E.js → mentionProcessor-SBDFSDIJ.js} +5 -5
- package/dist/{messages-5PHNMZRG.js → messages-WVSU2VE6.js} +1 -1
- package/dist/{model-L7BXTDSH.js → model-V2EMCPKL.js} +5 -5
- package/dist/{openai-5VV7N26J.js → openai-2ZGXLFBL.js} +5 -5
- package/dist/{outputStyles-GTAHP23K.js → outputStyles-KNUAGEEW.js} +4 -4
- package/dist/{pluginRuntime-23TPWKF3.js → pluginRuntime-UFC7JFLE.js} +6 -6
- package/dist/{pluginValidation-6VPGAZPM.js → pluginValidation-Q2S2P43C.js} +6 -6
- package/dist/prompts-QC6HQ3RR.js +53 -0
- package/dist/{pybAgentSessionLoad-H5RDHP7Z.js → pybAgentSessionLoad-XFMEFBHA.js} +4 -4
- package/dist/{pybAgentSessionResume-Z735IT3K.js → pybAgentSessionResume-IKMAZTZ6.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-YI2CEMWO.js → pybAgentStreamJsonSession-5NVTYHLV.js} +1 -1
- package/dist/{pybHooks-5MA4UT4U.js → pybHooks-O6BH4JWL.js} +4 -4
- package/dist/query-TAKHQYZM.js +55 -0
- package/dist/{registry-G36Y7TJR.js → registry-NBBQP3S3.js} +5 -5
- package/dist/{ripgrep-BYLSY4AL.js → ripgrep-D4Z26BOH.js} +3 -3
- package/dist/{skillMarketplace-XN5XMW6F.js → skillMarketplace-JYHTX2L2.js} +3 -3
- package/dist/{state-ZZAYLXSR.js → state-YCFRC443.js} +2 -2
- package/dist/{theme-HHHWSTRG.js → theme-CAVO3N6U.js} +5 -5
- package/dist/{toolPermissionSettings-F5675VV2.js → toolPermissionSettings-QF7N6PGX.js} +6 -6
- package/dist/tools-N2JA5WOB.js +52 -0
- package/dist/{userInput-VPY4CM4B.js → userInput-7XB2LRXJ.js} +30 -30
- package/package.json +1 -1
- package/dist/REPL-6C4OPI2C.js +0 -47
- package/dist/chunk-5P7OEKKE.js.map +0 -7
- package/dist/commands-CYQHNNSX.js +0 -51
- package/dist/prompts-D3KBVMOD.js +0 -53
- package/dist/query-NJIFF75Q.js +0 -55
- package/dist/tools-BJAC444Q.js +0 -52
- /package/dist/{REPL-6C4OPI2C.js.map → REPL-LOJVC37U.js.map} +0 -0
- /package/dist/{acp-RGMIE4DU.js.map → acp-6PJPOT5M.js.map} +0 -0
- /package/dist/{agentsValidate-MIP3HSNM.js.map → agentsValidate-LZNBNHP6.js.map} +0 -0
- /package/dist/{ask-WWDKFT4S.js.map → ask-76BUROTN.js.map} +0 -0
- /package/dist/{autoUpdater-HNFOZCBL.js.map → autoUpdater-OK2HAUOA.js.map} +0 -0
- /package/dist/{chunk-SNRPFDBW.js.map → chunk-57ZD6EQN.js.map} +0 -0
- /package/dist/{chunk-52XBAAOD.js.map → chunk-AKPBJECB.js.map} +0 -0
- /package/dist/{chunk-SG7SPYM4.js.map → chunk-AWQ5CGW5.js.map} +0 -0
- /package/dist/{chunk-N32NFSDQ.js.map → chunk-DCRXZZJX.js.map} +0 -0
- /package/dist/{chunk-PC4T3EHY.js.map → chunk-DG4EUTSH.js.map} +0 -0
- /package/dist/{chunk-7ZRJIA2T.js.map → chunk-ESQZEVRN.js.map} +0 -0
- /package/dist/{chunk-HENGZ5QD.js.map → chunk-F5CU72WX.js.map} +0 -0
- /package/dist/{chunk-ZMKBSLLD.js.map → chunk-FLLFJL7B.js.map} +0 -0
- /package/dist/{chunk-RHMAO6OV.js.map → chunk-GQWBRVCL.js.map} +0 -0
- /package/dist/{chunk-5VYUNKPN.js.map → chunk-IQDGXR2L.js.map} +0 -0
- /package/dist/{chunk-CUICIV5I.js.map → chunk-JTGSEBAT.js.map} +0 -0
- /package/dist/{chunk-NSNUA3AI.js.map → chunk-K3QOARLB.js.map} +0 -0
- /package/dist/{chunk-CU7LUROX.js.map → chunk-KOHH2H5S.js.map} +0 -0
- /package/dist/{chunk-4IUTKGZ3.js.map → chunk-KOZFO5PM.js.map} +0 -0
- /package/dist/{chunk-LNJEAGUM.js.map → chunk-MBBGTD7O.js.map} +0 -0
- /package/dist/{chunk-QQP7RZHT.js.map → chunk-MJCH3WTW.js.map} +0 -0
- /package/dist/{chunk-3DJZ2FP3.js.map → chunk-O2UT6CSX.js.map} +0 -0
- /package/dist/{chunk-L7H4HULV.js.map → chunk-ODYWGMTG.js.map} +0 -0
- /package/dist/{chunk-K427K545.js.map → chunk-TQMAHPW3.js.map} +0 -0
- /package/dist/{chunk-P4BU7OLK.js.map → chunk-TU4W4WGH.js.map} +0 -0
- /package/dist/{chunk-RWT3O44A.js.map → chunk-TYHTF3BE.js.map} +0 -0
- /package/dist/{chunk-LHVJ4DCY.js.map → chunk-UJAA45KE.js.map} +0 -0
- /package/dist/{chunk-NE7ZMP3U.js.map → chunk-UMO4Y6IF.js.map} +0 -0
- /package/dist/{chunk-YI4WTP42.js.map → chunk-VNIV2R6B.js.map} +0 -0
- /package/dist/{chunk-XKJGQBIN.js.map → chunk-WNZU3TS3.js.map} +0 -0
- /package/dist/{chunk-BBZOZE5U.js.map → chunk-WW3UO4TS.js.map} +0 -0
- /package/dist/{chunk-QNTNP3TF.js.map → chunk-ZMABUWI2.js.map} +0 -0
- /package/dist/{cli-DBIRYO2K.js.map → cli-MHACN3EZ.js.map} +0 -0
- /package/dist/{commands-CYQHNNSX.js.map → commands-27WBI67S.js.map} +0 -0
- /package/dist/{config-WF57SRJH.js.map → config-FAPLL3AS.js.map} +0 -0
- /package/dist/{context-KZT5TVOO.js.map → context-ZNW4KPID.js.map} +0 -0
- /package/dist/{customCommands-RROXEXFI.js.map → customCommands-L46UUKJJ.js.map} +0 -0
- /package/dist/{env-V3EUI52X.js.map → env-I77N3GWS.js.map} +0 -0
- /package/dist/{file-EY5S5X2I.js.map → file-DZLGJNYY.js.map} +0 -0
- /package/dist/{llm-HRDLIEIJ.js.map → llm-RTLJBLJE.js.map} +0 -0
- /package/dist/{llmLazy-5JLFDV6C.js.map → llmLazy-5RJ5OQ6P.js.map} +0 -0
- /package/dist/{loader-F2SDAB3W.js.map → loader-OMI5VTDL.js.map} +0 -0
- /package/dist/{lsp-IEUZLTEJ.js.map → lsp-4GIZ5WWB.js.map} +0 -0
- /package/dist/{lspAnchor-UT54IBRE.js.map → lspAnchor-MYE3MOZN.js.map} +0 -0
- /package/dist/{mcp-MJTCLGYY.js.map → mcp-GJCOU7DQ.js.map} +0 -0
- /package/dist/{mentionProcessor-H7F7SZ5E.js.map → mentionProcessor-SBDFSDIJ.js.map} +0 -0
- /package/dist/{messages-5PHNMZRG.js.map → messages-WVSU2VE6.js.map} +0 -0
- /package/dist/{model-L7BXTDSH.js.map → model-V2EMCPKL.js.map} +0 -0
- /package/dist/{openai-5VV7N26J.js.map → openai-2ZGXLFBL.js.map} +0 -0
- /package/dist/{outputStyles-GTAHP23K.js.map → outputStyles-KNUAGEEW.js.map} +0 -0
- /package/dist/{pluginRuntime-23TPWKF3.js.map → pluginRuntime-UFC7JFLE.js.map} +0 -0
- /package/dist/{pluginValidation-6VPGAZPM.js.map → pluginValidation-Q2S2P43C.js.map} +0 -0
- /package/dist/{prompts-D3KBVMOD.js.map → prompts-QC6HQ3RR.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-H5RDHP7Z.js.map → pybAgentSessionLoad-XFMEFBHA.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-Z735IT3K.js.map → pybAgentSessionResume-IKMAZTZ6.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-YI2CEMWO.js.map → pybAgentStreamJsonSession-5NVTYHLV.js.map} +0 -0
- /package/dist/{pybHooks-5MA4UT4U.js.map → pybHooks-O6BH4JWL.js.map} +0 -0
- /package/dist/{query-NJIFF75Q.js.map → query-TAKHQYZM.js.map} +0 -0
- /package/dist/{registry-G36Y7TJR.js.map → registry-NBBQP3S3.js.map} +0 -0
- /package/dist/{ripgrep-BYLSY4AL.js.map → ripgrep-D4Z26BOH.js.map} +0 -0
- /package/dist/{skillMarketplace-XN5XMW6F.js.map → skillMarketplace-JYHTX2L2.js.map} +0 -0
- /package/dist/{state-ZZAYLXSR.js.map → state-YCFRC443.js.map} +0 -0
- /package/dist/{theme-HHHWSTRG.js.map → theme-CAVO3N6U.js.map} +0 -0
- /package/dist/{toolPermissionSettings-F5675VV2.js.map → toolPermissionSettings-QF7N6PGX.js.map} +0 -0
- /package/dist/{tools-BJAC444Q.js.map → tools-N2JA5WOB.js.map} +0 -0
- /package/dist/{userInput-VPY4CM4B.js.map → userInput-7XB2LRXJ.js.map} +0 -0
|
@@ -25,55 +25,62 @@ import {
|
|
|
25
25
|
hasReadPermission,
|
|
26
26
|
hasWritePermission,
|
|
27
27
|
query
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-BULWYV5N.js";
|
|
29
|
+
import {
|
|
30
|
+
getHookTranscriptPath,
|
|
31
|
+
queueHookAdditionalContexts,
|
|
32
|
+
queueHookSystemMessages,
|
|
33
|
+
runPostToolUseHooks,
|
|
34
|
+
runPreToolUseHooks
|
|
35
|
+
} from "./chunk-WNZU3TS3.js";
|
|
29
36
|
import {
|
|
30
37
|
queryLLM,
|
|
31
38
|
queryQuick
|
|
32
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-ZMABUWI2.js";
|
|
33
40
|
import {
|
|
34
41
|
FallbackToolUseRejectedMessage,
|
|
35
42
|
MCPTool,
|
|
36
43
|
getClients,
|
|
37
44
|
getMCPTools
|
|
38
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-O2UT6CSX.js";
|
|
39
46
|
import {
|
|
40
47
|
generateAgentId
|
|
41
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-DG4EUTSH.js";
|
|
42
49
|
import {
|
|
43
50
|
getActiveAgents,
|
|
44
51
|
getAgentByType,
|
|
45
52
|
getAvailableAgentTypes
|
|
46
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-DCRXZZJX.js";
|
|
47
54
|
import {
|
|
48
55
|
INTERRUPT_MESSAGE,
|
|
49
56
|
createAssistantMessage,
|
|
50
57
|
createUserMessage,
|
|
51
58
|
getLastAssistantMessageId
|
|
52
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-AWQ5CGW5.js";
|
|
53
60
|
import {
|
|
54
61
|
getAbsolutePath
|
|
55
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-KOHH2H5S.js";
|
|
56
63
|
import {
|
|
57
64
|
filesToTree,
|
|
58
65
|
ripGrepWithStatus
|
|
59
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-AKPBJECB.js";
|
|
60
67
|
import {
|
|
61
68
|
LspAPI,
|
|
62
69
|
LspFacade,
|
|
63
70
|
formatDiagnosticsPretty
|
|
64
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-TQMAHPW3.js";
|
|
65
72
|
import {
|
|
66
73
|
getModelManager
|
|
67
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-K3QOARLB.js";
|
|
68
75
|
import {
|
|
69
76
|
getContext
|
|
70
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-ODYWGMTG.js";
|
|
71
78
|
import {
|
|
72
79
|
getTheme
|
|
73
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-57ZD6EQN.js";
|
|
74
81
|
import {
|
|
75
82
|
debug
|
|
76
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-WW3UO4TS.js";
|
|
77
84
|
import {
|
|
78
85
|
BunShell,
|
|
79
86
|
getCwd,
|
|
@@ -83,7 +90,7 @@ import {
|
|
|
83
90
|
overwriteLog,
|
|
84
91
|
readTaskOutput,
|
|
85
92
|
resolveXdgDataPath
|
|
86
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-MBBGTD7O.js";
|
|
87
94
|
import {
|
|
88
95
|
formatDuration,
|
|
89
96
|
formatNumber
|
|
@@ -556,11 +563,409 @@ Please check your model configuration with /model command.`
|
|
|
556
563
|
}
|
|
557
564
|
};
|
|
558
565
|
|
|
559
|
-
// src/tools/system/
|
|
566
|
+
// src/tools/system/BatchTool/BatchTool.tsx
|
|
560
567
|
import { Box as Box2, Text as Text2 } from "ink";
|
|
561
|
-
import React2 from "react";
|
|
568
|
+
import * as React2 from "react";
|
|
562
569
|
import { z as z2 } from "zod";
|
|
563
570
|
|
|
571
|
+
// src/tools/system/BatchTool/prompt.ts
|
|
572
|
+
var TOOL_NAME_FOR_PROMPT = "Batch";
|
|
573
|
+
var DESCRIPTION = `Execute multiple tool calls in parallel with a single request.
|
|
574
|
+
Only readonly and concurrency-safe tools should be batched. SkillTool is allowed as an exception.
|
|
575
|
+
MCP tools and marketplace skills must be called directly, not through batch.
|
|
576
|
+
Soft limits:
|
|
577
|
+
- Maximum of 10 tool calls per batch (11th+ are rejected)
|
|
578
|
+
- Do NOT use batch within batch`;
|
|
579
|
+
var PROMPT = `Use this tool to evaluate a batch of tool calls for parallel execution.
|
|
580
|
+
|
|
581
|
+
Rules:
|
|
582
|
+
- Only readonly and concurrency-safe tools are allowed in batch
|
|
583
|
+
- SkillTool is allowed as an exception
|
|
584
|
+
- MCP tools and marketplace skills are excluded and must be called directly
|
|
585
|
+
- Maximum 10 tool calls per batch (11th+ are rejected)
|
|
586
|
+
- Do NOT use batch within batch
|
|
587
|
+
|
|
588
|
+
Input format:
|
|
589
|
+
{
|
|
590
|
+
"tool_calls": [
|
|
591
|
+
{ "tool": "Read", "parameters": { "file_path": "/abs/path.txt" } },
|
|
592
|
+
{ "tool": "Grep", "parameters": { "pattern": "foo" } }
|
|
593
|
+
]
|
|
594
|
+
}`;
|
|
595
|
+
|
|
596
|
+
// src/tools/system/BatchTool/BatchTool.tsx
|
|
597
|
+
var toolCallSchema = z2.strictObject({
|
|
598
|
+
tool: z2.string().describe("The name of the tool to execute"),
|
|
599
|
+
parameters: z2.object({}).passthrough().describe("Parameters for the tool")
|
|
600
|
+
});
|
|
601
|
+
var inputSchema2 = z2.strictObject({
|
|
602
|
+
tool_calls: z2.preprocess(
|
|
603
|
+
(value) => value === void 0 ? [] : value,
|
|
604
|
+
z2.array(toolCallSchema).min(1, "Provide at least one tool call").describe("Array of tool calls to evaluate for batch execution")
|
|
605
|
+
)
|
|
606
|
+
});
|
|
607
|
+
var MAX_BATCH_TOOLS = 10;
|
|
608
|
+
function isBatchToolName(name) {
|
|
609
|
+
return name.trim().toLowerCase() === "batch";
|
|
610
|
+
}
|
|
611
|
+
function isMcpToolName(name) {
|
|
612
|
+
const trimmed = name.trim();
|
|
613
|
+
return trimmed === "mcp" || trimmed.startsWith("mcp__");
|
|
614
|
+
}
|
|
615
|
+
function isMarketplaceToolName(name) {
|
|
616
|
+
return name.trim().startsWith("marketplace__");
|
|
617
|
+
}
|
|
618
|
+
function formatBatchSummary(output) {
|
|
619
|
+
const lines = [];
|
|
620
|
+
lines.push(`Batch evaluation: ${output.success}/${output.total} successful`);
|
|
621
|
+
if (output.notes.length > 0) {
|
|
622
|
+
lines.push(...output.notes);
|
|
623
|
+
}
|
|
624
|
+
for (const result of output.results) {
|
|
625
|
+
const reason = result.error ? ` (${result.error})` : "";
|
|
626
|
+
lines.push(
|
|
627
|
+
`- ${result.tool}: ${result.success ? "success" : "error"}${reason}`
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
return lines.join("\n");
|
|
631
|
+
}
|
|
632
|
+
function preprocessToolInputForBatch(tool, input) {
|
|
633
|
+
if (tool.name === "TaskOutput") {
|
|
634
|
+
const task_id = typeof input.task_id === "string" && input.task_id || typeof input.agentId === "string" && String(input.agentId) || typeof input.bash_id === "string" && String(input.bash_id) || "";
|
|
635
|
+
const block = typeof input.block === "boolean" ? input.block : true;
|
|
636
|
+
const timeout = typeof input.timeout === "number" ? input.timeout : typeof input.wait_up_to === "number" ? Number(input.wait_up_to) * 1e3 : void 0;
|
|
637
|
+
return {
|
|
638
|
+
task_id,
|
|
639
|
+
block,
|
|
640
|
+
...timeout !== void 0 ? { timeout } : {}
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
return input;
|
|
644
|
+
}
|
|
645
|
+
function normalizeToolInputForBatch(tool, input) {
|
|
646
|
+
if (tool.name === "Bash") {
|
|
647
|
+
const parsed = tool.inputSchema.parse(input);
|
|
648
|
+
const {
|
|
649
|
+
command,
|
|
650
|
+
timeout,
|
|
651
|
+
description,
|
|
652
|
+
run_in_background,
|
|
653
|
+
dangerouslyDisableSandbox
|
|
654
|
+
} = parsed;
|
|
655
|
+
return {
|
|
656
|
+
command: String(command).replace(`cd ${getCwd()} && `, "").replace(/\\\\;/g, "\\;"),
|
|
657
|
+
...timeout !== void 0 ? { timeout } : {},
|
|
658
|
+
...description ? { description } : {},
|
|
659
|
+
...run_in_background ? { run_in_background } : {},
|
|
660
|
+
...dangerouslyDisableSandbox ? { dangerouslyDisableSandbox } : {}
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
return input;
|
|
664
|
+
}
|
|
665
|
+
async function executeToolCall({
|
|
666
|
+
tool,
|
|
667
|
+
toolName,
|
|
668
|
+
parameters,
|
|
669
|
+
context,
|
|
670
|
+
toolUseId
|
|
671
|
+
}) {
|
|
672
|
+
const preprocessedInput = preprocessToolInputForBatch(tool, parameters);
|
|
673
|
+
const parsedInput = tool.inputSchema.safeParse(preprocessedInput);
|
|
674
|
+
if (!parsedInput.success) {
|
|
675
|
+
return {
|
|
676
|
+
tool: toolName,
|
|
677
|
+
success: false,
|
|
678
|
+
error: `InputValidationError: ${parsedInput.error.message}`
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
let normalizedInput = normalizeToolInputForBatch(
|
|
682
|
+
tool,
|
|
683
|
+
parsedInput.data
|
|
684
|
+
);
|
|
685
|
+
if (tool.validateInput) {
|
|
686
|
+
const validated = await tool.validateInput(
|
|
687
|
+
normalizedInput,
|
|
688
|
+
context
|
|
689
|
+
);
|
|
690
|
+
if (validated?.result === false) {
|
|
691
|
+
return {
|
|
692
|
+
tool: toolName,
|
|
693
|
+
success: false,
|
|
694
|
+
error: validated.message
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
const hookOutcome = await runPreToolUseHooks({
|
|
699
|
+
toolName: tool.name,
|
|
700
|
+
toolInput: normalizedInput,
|
|
701
|
+
toolUseId,
|
|
702
|
+
permissionMode: context.options?.toolPermissionContext?.mode,
|
|
703
|
+
cwd: getCwd(),
|
|
704
|
+
transcriptPath: getHookTranscriptPath(context),
|
|
705
|
+
safeMode: context.options?.safeMode ?? false,
|
|
706
|
+
signal: context.abortController?.signal
|
|
707
|
+
});
|
|
708
|
+
if (hookOutcome.kind === "block") {
|
|
709
|
+
return {
|
|
710
|
+
tool: toolName,
|
|
711
|
+
success: false,
|
|
712
|
+
error: hookOutcome.message
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
if (hookOutcome.systemMessages && hookOutcome.systemMessages.length > 0) {
|
|
716
|
+
queueHookSystemMessages(context, hookOutcome.systemMessages);
|
|
717
|
+
}
|
|
718
|
+
if (hookOutcome.additionalContexts && hookOutcome.additionalContexts.length > 0) {
|
|
719
|
+
queueHookAdditionalContexts(context, hookOutcome.additionalContexts);
|
|
720
|
+
}
|
|
721
|
+
if (hookOutcome.updatedInput) {
|
|
722
|
+
const merged = { ...normalizedInput, ...hookOutcome.updatedInput };
|
|
723
|
+
const parsed = tool.inputSchema.safeParse(merged);
|
|
724
|
+
if (!parsed.success) {
|
|
725
|
+
return {
|
|
726
|
+
tool: toolName,
|
|
727
|
+
success: false,
|
|
728
|
+
error: `Hook updatedInput failed validation: ${parsed.error.message}`
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
normalizedInput = normalizeToolInputForBatch(
|
|
732
|
+
tool,
|
|
733
|
+
parsed.data
|
|
734
|
+
);
|
|
735
|
+
const isValidUpdate = await tool.validateInput?.(
|
|
736
|
+
normalizedInput,
|
|
737
|
+
context
|
|
738
|
+
);
|
|
739
|
+
if (isValidUpdate?.result === false) {
|
|
740
|
+
return {
|
|
741
|
+
tool: toolName,
|
|
742
|
+
success: false,
|
|
743
|
+
error: isValidUpdate.message
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
const hookPermissionDecision = hookOutcome.kind === "allow" ? hookOutcome.permissionDecision : void 0;
|
|
748
|
+
const effectiveShouldSkipPermissionCheck = hookPermissionDecision === "allow" ? true : hookPermissionDecision === "ask" ? false : false;
|
|
749
|
+
const permissionContextForCall = hookPermissionDecision === "ask" && context.options?.toolPermissionContext && context.options.toolPermissionContext.mode !== "default" ? {
|
|
750
|
+
...context,
|
|
751
|
+
options: {
|
|
752
|
+
...context.options,
|
|
753
|
+
toolPermissionContext: {
|
|
754
|
+
...context.options.toolPermissionContext,
|
|
755
|
+
mode: "default"
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
} : context;
|
|
759
|
+
const permissionResult = effectiveShouldSkipPermissionCheck ? { result: true } : await hasPermissionsToUseTool(
|
|
760
|
+
tool,
|
|
761
|
+
normalizedInput,
|
|
762
|
+
{ ...permissionContextForCall, toolUseId },
|
|
763
|
+
{}
|
|
764
|
+
);
|
|
765
|
+
if (permissionResult.result === false) {
|
|
766
|
+
return {
|
|
767
|
+
tool: toolName,
|
|
768
|
+
success: false,
|
|
769
|
+
error: permissionResult.message
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
try {
|
|
773
|
+
const generator = tool.call(normalizedInput, {
|
|
774
|
+
...context,
|
|
775
|
+
toolUseId
|
|
776
|
+
});
|
|
777
|
+
let data;
|
|
778
|
+
let resultForAssistant;
|
|
779
|
+
for await (const step of generator) {
|
|
780
|
+
if (step.type === "result") {
|
|
781
|
+
data = step.data;
|
|
782
|
+
resultForAssistant = step.resultForAssistant;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if (data === void 0) {
|
|
786
|
+
return {
|
|
787
|
+
tool: toolName,
|
|
788
|
+
success: false,
|
|
789
|
+
error: "Tool returned no result"
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
const postOutcome = await runPostToolUseHooks({
|
|
793
|
+
toolName: tool.name,
|
|
794
|
+
toolInput: normalizedInput,
|
|
795
|
+
toolResult: data,
|
|
796
|
+
toolUseId,
|
|
797
|
+
permissionMode: context.options?.toolPermissionContext?.mode,
|
|
798
|
+
cwd: getCwd(),
|
|
799
|
+
transcriptPath: getHookTranscriptPath(context),
|
|
800
|
+
safeMode: context.options?.safeMode ?? false,
|
|
801
|
+
signal: context.abortController?.signal
|
|
802
|
+
});
|
|
803
|
+
if (postOutcome.systemMessages.length > 0) {
|
|
804
|
+
queueHookSystemMessages(context, postOutcome.systemMessages);
|
|
805
|
+
}
|
|
806
|
+
if (postOutcome.additionalContexts.length > 0) {
|
|
807
|
+
queueHookAdditionalContexts(context, postOutcome.additionalContexts);
|
|
808
|
+
}
|
|
809
|
+
return {
|
|
810
|
+
tool: toolName,
|
|
811
|
+
success: true,
|
|
812
|
+
data,
|
|
813
|
+
...resultForAssistant ? { resultForAssistant } : { resultForAssistant: tool.renderResultForAssistant(data) }
|
|
814
|
+
};
|
|
815
|
+
} catch (error) {
|
|
816
|
+
return {
|
|
817
|
+
tool: toolName,
|
|
818
|
+
success: false,
|
|
819
|
+
error: error instanceof Error ? error.message : String(error)
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
var BatchTool = {
|
|
824
|
+
name: TOOL_NAME_FOR_PROMPT,
|
|
825
|
+
async description() {
|
|
826
|
+
return DESCRIPTION;
|
|
827
|
+
},
|
|
828
|
+
userFacingName() {
|
|
829
|
+
return "Batch";
|
|
830
|
+
},
|
|
831
|
+
inputSchema: inputSchema2,
|
|
832
|
+
isReadOnly() {
|
|
833
|
+
return false;
|
|
834
|
+
},
|
|
835
|
+
isConcurrencySafe() {
|
|
836
|
+
return false;
|
|
837
|
+
},
|
|
838
|
+
async isEnabled() {
|
|
839
|
+
return true;
|
|
840
|
+
},
|
|
841
|
+
needsPermissions() {
|
|
842
|
+
return false;
|
|
843
|
+
},
|
|
844
|
+
async prompt() {
|
|
845
|
+
return PROMPT;
|
|
846
|
+
},
|
|
847
|
+
renderToolUseMessage({ tool_calls }) {
|
|
848
|
+
return `Batch ${tool_calls.length} tool call(s)`;
|
|
849
|
+
},
|
|
850
|
+
renderToolUseRejectedMessage() {
|
|
851
|
+
return /* @__PURE__ */ React2.createElement(FallbackToolUseRejectedMessage, null);
|
|
852
|
+
},
|
|
853
|
+
renderToolResultMessage(output) {
|
|
854
|
+
return /* @__PURE__ */ React2.createElement(Box2, { flexDirection: "column" }, /* @__PURE__ */ React2.createElement(Text2, null, "Batch evaluation: ", output.success, "/", output.total, " successful"), output.notes.map((note, index) => /* @__PURE__ */ React2.createElement(React2.Fragment, { key: `${note}-${index}` }, /* @__PURE__ */ React2.createElement(Text2, null, note))));
|
|
855
|
+
},
|
|
856
|
+
renderResultForAssistant(output) {
|
|
857
|
+
return formatBatchSummary(output);
|
|
858
|
+
},
|
|
859
|
+
async validateInput({ tool_calls }) {
|
|
860
|
+
const hasNestedBatch = tool_calls.some((call) => isBatchToolName(call.tool));
|
|
861
|
+
if (hasNestedBatch) {
|
|
862
|
+
return {
|
|
863
|
+
result: false,
|
|
864
|
+
message: "Do NOT use batch within batch",
|
|
865
|
+
errorCode: 1
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
return { result: true };
|
|
869
|
+
},
|
|
870
|
+
async *call({ tool_calls }, context) {
|
|
871
|
+
const toolMap = new Map(
|
|
872
|
+
(context.options?.tools ?? []).map((tool) => [tool.name, tool])
|
|
873
|
+
);
|
|
874
|
+
const notes = [];
|
|
875
|
+
const allowedCalls = tool_calls.slice(0, MAX_BATCH_TOOLS);
|
|
876
|
+
const extraCalls = tool_calls.slice(MAX_BATCH_TOOLS);
|
|
877
|
+
let sawSkill = false;
|
|
878
|
+
let sawExcluded = false;
|
|
879
|
+
if (allowedCalls.length > 0) {
|
|
880
|
+
yield {
|
|
881
|
+
type: "progress",
|
|
882
|
+
content: createAssistantMessage(
|
|
883
|
+
`<tool-progress>Batch running ${allowedCalls.length} tool call(s)\u2026</tool-progress>`
|
|
884
|
+
)
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
const executionResults = await Promise.all(
|
|
888
|
+
allowedCalls.map(async (call, index) => {
|
|
889
|
+
const name = call.tool;
|
|
890
|
+
const toolUseId = `${context.toolUseId ?? "batch"}:${index + 1}`;
|
|
891
|
+
if (isMcpToolName(name) || isMarketplaceToolName(name)) {
|
|
892
|
+
sawExcluded = true;
|
|
893
|
+
return {
|
|
894
|
+
tool: name,
|
|
895
|
+
success: false,
|
|
896
|
+
error: "Excluded MCP/marketplace tools"
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
const tool = toolMap.get(name);
|
|
900
|
+
if (!tool) {
|
|
901
|
+
return {
|
|
902
|
+
tool: name,
|
|
903
|
+
success: false,
|
|
904
|
+
error: "Tool not in registry"
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
if (tool.name === "Skill") {
|
|
908
|
+
sawSkill = true;
|
|
909
|
+
return {
|
|
910
|
+
tool: name,
|
|
911
|
+
success: true
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
if (!tool.isReadOnly() || !tool.isConcurrencySafe()) {
|
|
915
|
+
return {
|
|
916
|
+
tool: name,
|
|
917
|
+
success: false,
|
|
918
|
+
error: "Tool is not read-only or concurrency-safe"
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
return executeToolCall({
|
|
922
|
+
tool,
|
|
923
|
+
toolName: name,
|
|
924
|
+
parameters: call.parameters ?? {},
|
|
925
|
+
context,
|
|
926
|
+
toolUseId
|
|
927
|
+
});
|
|
928
|
+
})
|
|
929
|
+
);
|
|
930
|
+
const results = [...executionResults];
|
|
931
|
+
if (extraCalls.length > 0) {
|
|
932
|
+
for (const call of extraCalls) {
|
|
933
|
+
results.push({
|
|
934
|
+
tool: call.tool,
|
|
935
|
+
success: false,
|
|
936
|
+
error: "Maximum of 10 tools allowed in batch"
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
notes.push("Maximum of 10 tools allowed in batch");
|
|
940
|
+
}
|
|
941
|
+
if (sawSkill) {
|
|
942
|
+
notes.push("SkillTool allowed as exception");
|
|
943
|
+
}
|
|
944
|
+
if (sawExcluded) {
|
|
945
|
+
notes.push("Excluded MCP/marketplace tools");
|
|
946
|
+
}
|
|
947
|
+
const success = results.filter((r) => r.success).length;
|
|
948
|
+
const failed = results.length - success;
|
|
949
|
+
const output = {
|
|
950
|
+
total: tool_calls.length,
|
|
951
|
+
success,
|
|
952
|
+
failed,
|
|
953
|
+
results,
|
|
954
|
+
notes
|
|
955
|
+
};
|
|
956
|
+
yield {
|
|
957
|
+
type: "result",
|
|
958
|
+
data: output,
|
|
959
|
+
resultForAssistant: this.renderResultForAssistant(output)
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
// src/tools/system/TaskOutputTool/TaskOutputTool.tsx
|
|
965
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
966
|
+
import React3 from "react";
|
|
967
|
+
import { z as z3 } from "zod";
|
|
968
|
+
|
|
564
969
|
// src/utils/session/backgroundTasks.ts
|
|
565
970
|
var backgroundTasks = /* @__PURE__ */ new Map();
|
|
566
971
|
function getBackgroundAgentTaskSnapshot(agentId) {
|
|
@@ -674,9 +1079,9 @@ function maybeTruncateVerboseToolOutput(text, options) {
|
|
|
674
1079
|
}
|
|
675
1080
|
|
|
676
1081
|
// src/tools/system/TaskOutputTool/prompt.ts
|
|
677
|
-
var
|
|
678
|
-
var
|
|
679
|
-
var
|
|
1082
|
+
var TOOL_NAME_FOR_PROMPT2 = "TaskOutput";
|
|
1083
|
+
var DESCRIPTION2 = "Retrieves output from a running or completed task";
|
|
1084
|
+
var PROMPT2 = `- Retrieves output from a running or completed task (background shell, agent, or remote session)
|
|
680
1085
|
- Takes a task_id parameter identifying the task
|
|
681
1086
|
- Returns the task output along with status information
|
|
682
1087
|
- Use block=true (default) to wait for task completion
|
|
@@ -685,11 +1090,11 @@ var PROMPT = `- Retrieves output from a running or completed task (background sh
|
|
|
685
1090
|
- Works with all task types: background shells, async agents, and remote sessions`;
|
|
686
1091
|
|
|
687
1092
|
// src/tools/system/TaskOutputTool/TaskOutputTool.tsx
|
|
688
|
-
var
|
|
689
|
-
task_id:
|
|
690
|
-
block:
|
|
691
|
-
timeout:
|
|
692
|
-
analyze:
|
|
1093
|
+
var inputSchema3 = z3.strictObject({
|
|
1094
|
+
task_id: z3.string().describe("The task ID to get output from"),
|
|
1095
|
+
block: z3.boolean().optional().default(true).describe("Whether to wait for completion"),
|
|
1096
|
+
timeout: z3.number().min(0).max(6e5).optional().default(3e4).describe("Max wait time in ms"),
|
|
1097
|
+
analyze: z3.boolean().optional().describe("Analyze the output for errors and warnings")
|
|
693
1098
|
});
|
|
694
1099
|
function normalizeTaskOutputInput(input) {
|
|
695
1100
|
const task_id = typeof input.task_id === "string" && input.task_id || typeof input.agentId === "string" && String(input.agentId) || typeof input.bash_id === "string" && String(input.bash_id) || "";
|
|
@@ -749,7 +1154,7 @@ async function analyzeOutputWithLsp(output, exitCode) {
|
|
|
749
1154
|
if (exitCode !== 0) {
|
|
750
1155
|
try {
|
|
751
1156
|
const { isAbsolute: isAbsolute3, resolve: resolve4 } = await import("path");
|
|
752
|
-
const { getCwd: getCwd2 } = await import("./state-
|
|
1157
|
+
const { getCwd: getCwd2 } = await import("./state-YCFRC443.js");
|
|
753
1158
|
const lines = output.split("\n");
|
|
754
1159
|
const uniqueFiles = /* @__PURE__ */ new Set();
|
|
755
1160
|
const lspSuggestions = [];
|
|
@@ -807,14 +1212,14 @@ async function waitForBashTaskCompletion(args) {
|
|
|
807
1212
|
return buildTaskSummary(taskId);
|
|
808
1213
|
}
|
|
809
1214
|
var TaskOutputTool = {
|
|
810
|
-
name:
|
|
1215
|
+
name: TOOL_NAME_FOR_PROMPT2,
|
|
811
1216
|
async description() {
|
|
812
|
-
return
|
|
1217
|
+
return DESCRIPTION2;
|
|
813
1218
|
},
|
|
814
1219
|
userFacingName() {
|
|
815
1220
|
return "Task Output";
|
|
816
1221
|
},
|
|
817
|
-
inputSchema:
|
|
1222
|
+
inputSchema: inputSchema3,
|
|
818
1223
|
isReadOnly() {
|
|
819
1224
|
return true;
|
|
820
1225
|
},
|
|
@@ -828,7 +1233,7 @@ var TaskOutputTool = {
|
|
|
828
1233
|
return false;
|
|
829
1234
|
},
|
|
830
1235
|
async prompt() {
|
|
831
|
-
return
|
|
1236
|
+
return PROMPT2;
|
|
832
1237
|
},
|
|
833
1238
|
renderToolUseMessage(input) {
|
|
834
1239
|
const normalized = normalizeTaskOutputInput(input);
|
|
@@ -841,26 +1246,26 @@ var TaskOutputTool = {
|
|
|
841
1246
|
renderToolResultMessage(output, { verbose }) {
|
|
842
1247
|
const theme = getTheme();
|
|
843
1248
|
if (output.retrieval_status === "timeout" || output.retrieval_status === "not_ready") {
|
|
844
|
-
return /* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ React3.createElement(Box3, null, /* @__PURE__ */ React3.createElement(Text3, { color: theme.secondaryText }, "Task is still running\u2026"));
|
|
845
1250
|
}
|
|
846
1251
|
if (!output.task) {
|
|
847
|
-
return /* @__PURE__ */
|
|
1252
|
+
return /* @__PURE__ */ React3.createElement(Box3, null, /* @__PURE__ */ React3.createElement(Text3, { color: theme.secondaryText }, "No task output available"));
|
|
848
1253
|
}
|
|
849
1254
|
if (output.task.task_type === "local_agent") {
|
|
850
1255
|
const lines = output.task.result ? output.task.result.split("\n").length : 0;
|
|
851
1256
|
if (!verbose) {
|
|
852
|
-
return /* @__PURE__ */
|
|
1257
|
+
return /* @__PURE__ */ React3.createElement(Box3, null, /* @__PURE__ */ React3.createElement(Text3, { color: theme.secondaryText }, "Read output (ctrl+o to expand)"));
|
|
853
1258
|
}
|
|
854
|
-
return /* @__PURE__ */
|
|
1259
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column" }, /* @__PURE__ */ React3.createElement(Text3, null, output.task.description, " (", lines, " lines)"), output.task.prompt ? /* @__PURE__ */ React3.createElement(Box3, { paddingLeft: 2 }, /* @__PURE__ */ React3.createElement(Text3, { color: theme.secondaryText }, output.task.prompt)) : null, output.task.result ? /* @__PURE__ */ React3.createElement(Box3, { paddingLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text3, null, maybeTruncateVerboseToolOutput(output.task.result, {
|
|
855
1260
|
maxLines: 200,
|
|
856
1261
|
maxChars: 4e4
|
|
857
|
-
}).text)) : null, output.task.error ? /* @__PURE__ */
|
|
1262
|
+
}).text)) : null, output.task.error ? /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", marginTop: 1, paddingLeft: 2 }, /* @__PURE__ */ React3.createElement(Text3, { color: theme.error, bold: true }, "Error:"), /* @__PURE__ */ React3.createElement(Text3, { color: theme.error }, output.task.error)) : null);
|
|
858
1263
|
}
|
|
859
1264
|
const content = output.task.output?.trimEnd() ?? "";
|
|
860
1265
|
if (!verbose) {
|
|
861
|
-
return /* @__PURE__ */
|
|
1266
|
+
return /* @__PURE__ */ React3.createElement(Box3, null, /* @__PURE__ */ React3.createElement(Text3, { color: theme.secondaryText }, content.length > 0 ? "Read output (ctrl+o to expand)" : "(No content)"));
|
|
862
1267
|
}
|
|
863
|
-
return /* @__PURE__ */
|
|
1268
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column" }, /* @__PURE__ */ React3.createElement(Text3, { color: theme.secondaryText }, output.task.description), content ? /* @__PURE__ */ React3.createElement(Box3, { paddingLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text3, null, maybeTruncateVerboseToolOutput(content, {
|
|
864
1269
|
maxLines: 200,
|
|
865
1270
|
maxChars: 4e4
|
|
866
1271
|
}).text)) : null);
|
|
@@ -989,13 +1394,13 @@ ${output.task.output.trimEnd()}
|
|
|
989
1394
|
|
|
990
1395
|
// src/tools/filesystem/DeleteTool/DeleteTool.tsx
|
|
991
1396
|
import { rmSync, existsSync as existsSync2, statSync } from "fs";
|
|
992
|
-
import { Box as
|
|
993
|
-
import * as
|
|
994
|
-
import { z as
|
|
1397
|
+
import { Box as Box4, Text as Text4 } from "ink";
|
|
1398
|
+
import * as React4 from "react";
|
|
1399
|
+
import { z as z4 } from "zod";
|
|
995
1400
|
import { isAbsolute, relative, resolve } from "path";
|
|
996
1401
|
|
|
997
1402
|
// src/tools/filesystem/DeleteTool/prompt.ts
|
|
998
|
-
var
|
|
1403
|
+
var PROMPT3 = `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.
|
|
999
1404
|
When you need to delete file, you MUST use this tool to delete file instead of using shell.
|
|
1000
1405
|
|
|
1001
1406
|
Usage:
|
|
@@ -1043,11 +1448,11 @@ Delete({
|
|
|
1043
1448
|
`;
|
|
1044
1449
|
|
|
1045
1450
|
// src/tools/filesystem/DeleteTool/DeleteTool.tsx
|
|
1046
|
-
var
|
|
1047
|
-
file_paths:
|
|
1451
|
+
var inputSchema4 = z4.strictObject({
|
|
1452
|
+
file_paths: z4.array(z4.string()).describe(
|
|
1048
1453
|
"The list of file paths you want to delete, you MUST set file path to absolute path."
|
|
1049
1454
|
),
|
|
1050
|
-
force:
|
|
1455
|
+
force: z4.boolean().optional().describe(
|
|
1051
1456
|
"Force deletion even if the file is referenced by other files (LSP check)."
|
|
1052
1457
|
)
|
|
1053
1458
|
});
|
|
@@ -1058,9 +1463,9 @@ var DeleteTool = {
|
|
|
1058
1463
|
},
|
|
1059
1464
|
userFacingName: () => "Delete",
|
|
1060
1465
|
async prompt() {
|
|
1061
|
-
return
|
|
1466
|
+
return PROMPT3;
|
|
1062
1467
|
},
|
|
1063
|
-
inputSchema:
|
|
1468
|
+
inputSchema: inputSchema4,
|
|
1064
1469
|
async isEnabled() {
|
|
1065
1470
|
return true;
|
|
1066
1471
|
},
|
|
@@ -1080,7 +1485,7 @@ var DeleteTool = {
|
|
|
1080
1485
|
return `Deleting: ${paths}`;
|
|
1081
1486
|
},
|
|
1082
1487
|
renderToolResultMessage(output) {
|
|
1083
|
-
return /* @__PURE__ */
|
|
1488
|
+
return /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column" }, output.deleted.length > 0 && /* @__PURE__ */ React4.createElement(Text4, null, "Deleted: ", output.deleted.join(", ")), output.failed.length > 0 && /* @__PURE__ */ React4.createElement(Text4, { color: getTheme().warning }, "Failed to delete: ", output.failed.join(", ")));
|
|
1084
1489
|
},
|
|
1085
1490
|
renderResultForAssistant(output) {
|
|
1086
1491
|
const parts = [];
|
|
@@ -1090,9 +1495,9 @@ var DeleteTool = {
|
|
|
1090
1495
|
},
|
|
1091
1496
|
renderToolUseRejectedMessage({ file_paths } = {}, { columns, verbose } = {}) {
|
|
1092
1497
|
if (!file_paths || file_paths.length === 0) {
|
|
1093
|
-
return /* @__PURE__ */
|
|
1498
|
+
return /* @__PURE__ */ React4.createElement(FallbackToolUseRejectedMessage, null);
|
|
1094
1499
|
}
|
|
1095
|
-
return /* @__PURE__ */
|
|
1500
|
+
return /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column" }, /* @__PURE__ */ React4.createElement(Text4, null, " ", "\u23BF", " ", /* @__PURE__ */ React4.createElement(Text4, { color: getTheme().error }, "User rejected deletion of ", file_paths.length, " items")));
|
|
1096
1501
|
},
|
|
1097
1502
|
async *call({ file_paths, force }, context) {
|
|
1098
1503
|
const verbose = context.options?.verbose || false;
|
|
@@ -1107,7 +1512,7 @@ var DeleteTool = {
|
|
|
1107
1512
|
}
|
|
1108
1513
|
if (!force) {
|
|
1109
1514
|
try {
|
|
1110
|
-
const { LspFacade: LspFacade2 } = await import("./lsp-
|
|
1515
|
+
const { LspFacade: LspFacade2 } = await import("./lsp-4GIZ5WWB.js");
|
|
1111
1516
|
const referenceDetail = await LspFacade2.checkFileReferences(fullPath);
|
|
1112
1517
|
if (referenceDetail) {
|
|
1113
1518
|
failedItems.push(
|
|
@@ -1153,20 +1558,20 @@ var DeleteTool = {
|
|
|
1153
1558
|
};
|
|
1154
1559
|
|
|
1155
1560
|
// src/tools/mcp/ListMcpResourcesTool/ListMcpResourcesTool.tsx
|
|
1156
|
-
import { Box as
|
|
1157
|
-
import
|
|
1158
|
-
import { z as
|
|
1561
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
1562
|
+
import React5 from "react";
|
|
1563
|
+
import { z as z5 } from "zod";
|
|
1159
1564
|
import { ListResourcesResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
1160
1565
|
|
|
1161
1566
|
// src/tools/mcp/ListMcpResourcesTool/prompt.ts
|
|
1162
1567
|
var TOOL_NAME = "ListMcpResourcesTool";
|
|
1163
|
-
var
|
|
1568
|
+
var DESCRIPTION3 = `Lists available resources from configured MCP servers.
|
|
1164
1569
|
Each resource object includes a 'server' field indicating which server it's from.
|
|
1165
1570
|
|
|
1166
1571
|
Usage examples:
|
|
1167
1572
|
- List all resources from all servers: \`listMcpResources\`
|
|
1168
1573
|
- List resources from a specific server: \`listMcpResources({ server: "myserver" })\``;
|
|
1169
|
-
var
|
|
1574
|
+
var PROMPT4 = `List available resources from configured MCP servers.
|
|
1170
1575
|
Each returned resource will include all standard MCP resource fields plus a 'server' field
|
|
1171
1576
|
indicating which server the resource belongs to.
|
|
1172
1577
|
|
|
@@ -1175,18 +1580,18 @@ Parameters:
|
|
|
1175
1580
|
resources from all servers will be returned.`;
|
|
1176
1581
|
|
|
1177
1582
|
// src/tools/mcp/ListMcpResourcesTool/ListMcpResourcesTool.tsx
|
|
1178
|
-
var
|
|
1179
|
-
server:
|
|
1583
|
+
var inputSchema5 = z5.strictObject({
|
|
1584
|
+
server: z5.string().optional().describe("Optional server name to filter resources by")
|
|
1180
1585
|
});
|
|
1181
1586
|
var ListMcpResourcesTool = {
|
|
1182
1587
|
name: TOOL_NAME,
|
|
1183
1588
|
async description() {
|
|
1184
|
-
return
|
|
1589
|
+
return DESCRIPTION3;
|
|
1185
1590
|
},
|
|
1186
1591
|
async prompt() {
|
|
1187
|
-
return
|
|
1592
|
+
return PROMPT4;
|
|
1188
1593
|
},
|
|
1189
|
-
inputSchema:
|
|
1594
|
+
inputSchema: inputSchema5,
|
|
1190
1595
|
userFacingName() {
|
|
1191
1596
|
return "listMcpResources";
|
|
1192
1597
|
},
|
|
@@ -1219,10 +1624,10 @@ var ListMcpResourcesTool = {
|
|
|
1219
1624
|
return server ? `List MCP resources from server "${server}"` : "List all MCP resources";
|
|
1220
1625
|
},
|
|
1221
1626
|
renderToolUseRejectedMessage() {
|
|
1222
|
-
return /* @__PURE__ */
|
|
1627
|
+
return /* @__PURE__ */ React5.createElement(FallbackToolUseRejectedMessage, null);
|
|
1223
1628
|
},
|
|
1224
1629
|
renderToolResultMessage(output) {
|
|
1225
|
-
return /* @__PURE__ */
|
|
1630
|
+
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, { bold: true }, output.length), /* @__PURE__ */ React5.createElement(Text5, null, " resources")), /* @__PURE__ */ React5.createElement(Cost, { costUSD: 0, durationMs: 0, debug: false }));
|
|
1226
1631
|
},
|
|
1227
1632
|
renderResultForAssistant(output) {
|
|
1228
1633
|
return JSON.stringify(output);
|
|
@@ -1271,14 +1676,14 @@ var ListMcpResourcesTool = {
|
|
|
1271
1676
|
};
|
|
1272
1677
|
|
|
1273
1678
|
// src/tools/lsTool/lsTool.tsx
|
|
1274
|
-
import { Box as
|
|
1679
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
1275
1680
|
import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve2, sep as sep2 } from "path";
|
|
1276
|
-
import * as
|
|
1277
|
-
import { z as
|
|
1681
|
+
import * as React6 from "react";
|
|
1682
|
+
import { z as z6 } from "zod";
|
|
1278
1683
|
import { minimatch } from "minimatch";
|
|
1279
1684
|
|
|
1280
1685
|
// src/tools/lsTool/prompt.ts
|
|
1281
|
-
var
|
|
1686
|
+
var DESCRIPTION4 = `Lists files and directories as a breadth-first tree with minimal metadata.
|
|
1282
1687
|
|
|
1283
1688
|
Usage:
|
|
1284
1689
|
1. **Structure First**: Use to understand the top-level layout quickly.
|
|
@@ -1298,18 +1703,18 @@ When to use:
|
|
|
1298
1703
|
|
|
1299
1704
|
// src/tools/lsTool/lsTool.tsx
|
|
1300
1705
|
var MAX_FILES_LIMIT = 1e3;
|
|
1301
|
-
var
|
|
1302
|
-
path:
|
|
1706
|
+
var inputSchema6 = z6.object({
|
|
1707
|
+
path: z6.string().describe(
|
|
1303
1708
|
"The absolute path to the directory to list (must be absolute, not relative)"
|
|
1304
1709
|
),
|
|
1305
|
-
ignore:
|
|
1710
|
+
ignore: z6.array(z6.string()).optional().describe("List of glob patterns to ignore.")
|
|
1306
1711
|
}).passthrough();
|
|
1307
1712
|
var LSTool = {
|
|
1308
1713
|
name: "LS",
|
|
1309
1714
|
async description() {
|
|
1310
|
-
return
|
|
1715
|
+
return DESCRIPTION4;
|
|
1311
1716
|
},
|
|
1312
|
-
inputSchema:
|
|
1717
|
+
inputSchema: inputSchema6,
|
|
1313
1718
|
userFacingName() {
|
|
1314
1719
|
return "Smart Structure";
|
|
1315
1720
|
},
|
|
@@ -1326,7 +1731,7 @@ var LSTool = {
|
|
|
1326
1731
|
return !hasReadPermission(path);
|
|
1327
1732
|
},
|
|
1328
1733
|
async prompt() {
|
|
1329
|
-
return
|
|
1734
|
+
return DESCRIPTION4;
|
|
1330
1735
|
},
|
|
1331
1736
|
async validateInput({ limit, offset, partition }) {
|
|
1332
1737
|
if (typeof limit === "number" || typeof offset === "number" || typeof partition === "string") {
|
|
@@ -1349,7 +1754,7 @@ var LSTool = {
|
|
|
1349
1754
|
return parts.join(", ");
|
|
1350
1755
|
},
|
|
1351
1756
|
renderToolUseRejectedMessage() {
|
|
1352
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ React6.createElement(FallbackToolUseRejectedMessage, null);
|
|
1353
1758
|
},
|
|
1354
1759
|
renderToolResultMessage(content) {
|
|
1355
1760
|
const verbose = false;
|
|
@@ -1358,7 +1763,7 @@ var LSTool = {
|
|
|
1358
1763
|
}
|
|
1359
1764
|
const lines = content.split("\n");
|
|
1360
1765
|
const MAX_DISPLAY_LINES = 10;
|
|
1361
|
-
return /* @__PURE__ */
|
|
1766
|
+
return /* @__PURE__ */ React6.createElement(Box6, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React6.createElement(Box6, null, /* @__PURE__ */ React6.createElement(Text6, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React6.createElement(Box6, { flexDirection: "column", paddingLeft: 0 }, lines.slice(0, verbose ? void 0 : MAX_DISPLAY_LINES).map((line, i) => /* @__PURE__ */ React6.createElement(React6.Fragment, { key: i }, /* @__PURE__ */ React6.createElement(Text6, null, line))), !verbose && lines.length > MAX_DISPLAY_LINES && /* @__PURE__ */ React6.createElement(Text6, { color: getTheme().secondaryText }, "... (+", lines.length - MAX_DISPLAY_LINES, " lines)"))));
|
|
1362
1767
|
},
|
|
1363
1768
|
async *call({ path, ignore }, { abortController }) {
|
|
1364
1769
|
const fullFilePath = isAbsolute2(path) ? path : resolve2(getCwd(), path);
|
|
@@ -1407,14 +1812,14 @@ NOTE: do any of the files above seem malicious? If so, you MUST refuse to contin
|
|
|
1407
1812
|
|
|
1408
1813
|
// src/tools/search/LspTool/LspTool.tsx
|
|
1409
1814
|
import { existsSync as existsSync3, readFileSync as readFileSync2, statSync as statSync2 } from "fs";
|
|
1410
|
-
import { Box as
|
|
1815
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
1411
1816
|
import { dirname, relative as relative3, resolve as resolve3 } from "path";
|
|
1412
|
-
import
|
|
1413
|
-
import { z as
|
|
1817
|
+
import React7 from "react";
|
|
1818
|
+
import { z as z7 } from "zod";
|
|
1414
1819
|
|
|
1415
1820
|
// src/tools/search/LspTool/prompt.ts
|
|
1416
|
-
var
|
|
1417
|
-
var
|
|
1821
|
+
var TOOL_NAME_FOR_PROMPT3 = "LSP";
|
|
1822
|
+
var PROMPT5 = `Interact with Language Server Protocol (LSP) servers to get code intelligence features.
|
|
1418
1823
|
Supports 29+ languages including Python, Go, Rust, TypeScript, JavaScript, Bash, Java, C++, PHP, and more.
|
|
1419
1824
|
|
|
1420
1825
|
## Capabilities & Scenarios
|
|
@@ -1433,7 +1838,7 @@ This tool acts as your "Code Analyst". Use it to understand the codebase semanti
|
|
|
1433
1838
|
### 3. Exploring New Files (What's in here?)
|
|
1434
1839
|
- **Scenario**: You just opened a large file \`utils.ts\` and want a quick overview.
|
|
1435
1840
|
- **Action**: Use \`documentSymbol\`.
|
|
1436
|
-
- **Why**: It returns a structured outline (Classes, Functions, Variables)
|
|
1841
|
+
- **Why**: It returns a structured outline (Classes, Functions, Variables) using LspFacade policy: LSP-first for accuracy, Tree-Sitter fallback for speed when needed.
|
|
1437
1842
|
|
|
1438
1843
|
### 4. Interface Implementation (Who implements this?)
|
|
1439
1844
|
- **Scenario**: You see an interface \`IStorage\` and want to find the concrete class (e.g., \`S3Storage\`).
|
|
@@ -1473,13 +1878,14 @@ Location-based operations require:
|
|
|
1473
1878
|
## LSP \u540E\u7F6E\u4E0E\u8303\u56F4\u9650\u5236
|
|
1474
1879
|
- \u4F18\u5148\u987A\u5E8F\uFF1A\u7ED3\u6784\u6811 -> \u70ED\u70B9\u5B9A\u4F4D -> Read -> LSP
|
|
1475
1880
|
- workspaceSymbol \u5FC5\u987B\u63D0\u4F9B\u660E\u786E\u7684\u8DEF\u5F84/\u6A21\u5757\u8303\u56F4\uFF0C\u907F\u514D\u5BF9\u5168\u4ED3\u5E93\u65E0\u754C\u67E5\u8BE2
|
|
1881
|
+
- documentSymbol \u7684\u4F18\u5148\u7EA7\u7531 LspFacade \u51B3\u5B9A\uFF08\u9ED8\u8BA4 LSP \u4F18\u5148\uFF0CTree-Sitter \u515C\u5E95\uFF09
|
|
1476
1882
|
|
|
1477
1883
|
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.`;
|
|
1478
|
-
var
|
|
1884
|
+
var DESCRIPTION5 = PROMPT5;
|
|
1479
1885
|
|
|
1480
1886
|
// src/tools/search/LspTool/LspTool.tsx
|
|
1481
|
-
var
|
|
1482
|
-
operation:
|
|
1887
|
+
var inputSchema7 = z7.strictObject({
|
|
1888
|
+
operation: z7.enum([
|
|
1483
1889
|
"goToDefinition",
|
|
1484
1890
|
"findReferences",
|
|
1485
1891
|
"hover",
|
|
@@ -1492,14 +1898,14 @@ var inputSchema6 = z6.strictObject({
|
|
|
1492
1898
|
"getScope",
|
|
1493
1899
|
"diagnostics"
|
|
1494
1900
|
]).describe("The LSP operation to perform"),
|
|
1495
|
-
filePath:
|
|
1496
|
-
line:
|
|
1497
|
-
character:
|
|
1498
|
-
waitForDiagnostics:
|
|
1499
|
-
timeout:
|
|
1901
|
+
filePath: z7.string().describe("The absolute or relative path to the file"),
|
|
1902
|
+
line: z7.number().int().positive().optional().describe("The line number (1-based, as shown in editors). Required for location-based operations."),
|
|
1903
|
+
character: z7.number().int().positive().optional().describe("The character offset (1-based, as shown in editors). Required for location-based operations."),
|
|
1904
|
+
waitForDiagnostics: z7.boolean().optional().describe('If true, wait for fresh diagnostics from the server (used with "diagnostics" operation)'),
|
|
1905
|
+
timeout: z7.number().optional().describe("Timeout in milliseconds for waiting operations (default: 5000)")
|
|
1500
1906
|
});
|
|
1501
|
-
var outputSchema =
|
|
1502
|
-
operation:
|
|
1907
|
+
var outputSchema = z7.object({
|
|
1908
|
+
operation: z7.enum([
|
|
1503
1909
|
"goToDefinition",
|
|
1504
1910
|
"findReferences",
|
|
1505
1911
|
"hover",
|
|
@@ -1512,10 +1918,10 @@ var outputSchema = z6.object({
|
|
|
1512
1918
|
"getScope",
|
|
1513
1919
|
"diagnostics"
|
|
1514
1920
|
]).describe("The LSP operation that was performed"),
|
|
1515
|
-
result:
|
|
1516
|
-
filePath:
|
|
1517
|
-
resultCount:
|
|
1518
|
-
fileCount:
|
|
1921
|
+
result: z7.string().describe("The formatted result of the LSP operation"),
|
|
1922
|
+
filePath: z7.string().describe("The file path the operation was performed on"),
|
|
1923
|
+
resultCount: z7.number().int().nonnegative().optional().describe("Number of results (definitions, references, symbols)"),
|
|
1924
|
+
fileCount: z7.number().int().nonnegative().optional().describe("Number of files containing results")
|
|
1519
1925
|
});
|
|
1520
1926
|
var OPERATION_LABELS = {
|
|
1521
1927
|
goToDefinition: { singular: "definition", plural: "definitions" },
|
|
@@ -1568,19 +1974,19 @@ function summarizeToolResult(operation, resultCount, fileCount) {
|
|
|
1568
1974
|
};
|
|
1569
1975
|
const noun = resultCount === 1 ? label.singular : label.plural;
|
|
1570
1976
|
if (operation === "hover" && resultCount > 0 && label.special) {
|
|
1571
|
-
return /* @__PURE__ */
|
|
1977
|
+
return /* @__PURE__ */ React7.createElement(Text7, null, "Hover info ", label.special);
|
|
1572
1978
|
}
|
|
1573
|
-
return /* @__PURE__ */
|
|
1979
|
+
return /* @__PURE__ */ React7.createElement(Text7, null, "Found ", /* @__PURE__ */ React7.createElement(Text7, { bold: true }, resultCount), " ", noun, fileCount > 1 ? /* @__PURE__ */ React7.createElement(React7.Fragment, null, " ", "across ", /* @__PURE__ */ React7.createElement(Text7, { bold: true }, fileCount), " files") : null);
|
|
1574
1980
|
}
|
|
1575
1981
|
var LspTool = {
|
|
1576
|
-
name:
|
|
1982
|
+
name: TOOL_NAME_FOR_PROMPT3,
|
|
1577
1983
|
async description() {
|
|
1578
|
-
return
|
|
1984
|
+
return DESCRIPTION5;
|
|
1579
1985
|
},
|
|
1580
1986
|
async prompt() {
|
|
1581
|
-
return
|
|
1987
|
+
return PROMPT5;
|
|
1582
1988
|
},
|
|
1583
|
-
inputSchema:
|
|
1989
|
+
inputSchema: inputSchema7,
|
|
1584
1990
|
userFacingName() {
|
|
1585
1991
|
return "LSP";
|
|
1586
1992
|
},
|
|
@@ -1598,7 +2004,7 @@ var LspTool = {
|
|
|
1598
2004
|
return !hasReadPermission(abs || getCwd());
|
|
1599
2005
|
},
|
|
1600
2006
|
async validateInput(input) {
|
|
1601
|
-
const parsed =
|
|
2007
|
+
const parsed = inputSchema7.safeParse(input);
|
|
1602
2008
|
if (!parsed.success) {
|
|
1603
2009
|
return {
|
|
1604
2010
|
result: false,
|
|
@@ -1681,7 +2087,7 @@ var LspTool = {
|
|
|
1681
2087
|
return parts.join(", ");
|
|
1682
2088
|
},
|
|
1683
2089
|
renderToolUseRejectedMessage() {
|
|
1684
|
-
return /* @__PURE__ */
|
|
2090
|
+
return /* @__PURE__ */ React7.createElement(FallbackToolUseRejectedMessage, null);
|
|
1685
2091
|
},
|
|
1686
2092
|
renderToolResultMessage(output, { verbose }) {
|
|
1687
2093
|
if (output.resultCount !== void 0 && output.fileCount !== void 0) {
|
|
@@ -1689,13 +2095,13 @@ var LspTool = {
|
|
|
1689
2095
|
maxLines: 120,
|
|
1690
2096
|
maxChars: 2e4
|
|
1691
2097
|
}) : null;
|
|
1692
|
-
return /* @__PURE__ */
|
|
2098
|
+
return /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "column" }, /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "row" }, /* @__PURE__ */ React7.createElement(Text7, null, "\xA0\xA0\u23BF \xA0"), summarizeToolResult(
|
|
1693
2099
|
output.operation,
|
|
1694
2100
|
output.resultCount,
|
|
1695
2101
|
output.fileCount
|
|
1696
|
-
)), display ? /* @__PURE__ */
|
|
2102
|
+
)), display ? /* @__PURE__ */ React7.createElement(Box7, { marginLeft: 5 }, /* @__PURE__ */ React7.createElement(Text7, null, display.text)) : null);
|
|
1697
2103
|
}
|
|
1698
|
-
return /* @__PURE__ */
|
|
2104
|
+
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, null, output.result)));
|
|
1699
2105
|
},
|
|
1700
2106
|
renderResultForAssistant(output) {
|
|
1701
2107
|
return output.result;
|
|
@@ -1726,39 +2132,39 @@ var LspTool = {
|
|
|
1726
2132
|
};
|
|
1727
2133
|
|
|
1728
2134
|
// src/tools/mcp/ReadMcpResourceTool/ReadMcpResourceTool.tsx
|
|
1729
|
-
import { Box as
|
|
1730
|
-
import
|
|
1731
|
-
import { z as
|
|
2135
|
+
import { Box as Box8, Text as Text8 } from "ink";
|
|
2136
|
+
import React8 from "react";
|
|
2137
|
+
import { z as z8 } from "zod";
|
|
1732
2138
|
import { ReadResourceResultSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
1733
2139
|
|
|
1734
2140
|
// src/tools/mcp/ReadMcpResourceTool/prompt.ts
|
|
1735
2141
|
var TOOL_NAME2 = "ReadMcpResourceTool";
|
|
1736
|
-
var
|
|
2142
|
+
var DESCRIPTION6 = `Reads a specific resource from an MCP server.
|
|
1737
2143
|
- server: The name of the MCP server to read from
|
|
1738
2144
|
- uri: The URI of the resource to read
|
|
1739
2145
|
|
|
1740
2146
|
Usage examples:
|
|
1741
2147
|
- Read a resource from a server: \`readMcpResource({ server: "myserver", uri: "my-resource-uri" })\``;
|
|
1742
|
-
var
|
|
2148
|
+
var PROMPT6 = `Reads a specific resource from an MCP server, identified by server name and resource URI.
|
|
1743
2149
|
|
|
1744
2150
|
Parameters:
|
|
1745
2151
|
- server (required): The name of the MCP server from which to read the resource
|
|
1746
2152
|
- uri (required): The URI of the resource to read`;
|
|
1747
2153
|
|
|
1748
2154
|
// src/tools/mcp/ReadMcpResourceTool/ReadMcpResourceTool.tsx
|
|
1749
|
-
var
|
|
1750
|
-
server:
|
|
1751
|
-
uri:
|
|
2155
|
+
var inputSchema8 = z8.strictObject({
|
|
2156
|
+
server: z8.string().describe("The MCP server name"),
|
|
2157
|
+
uri: z8.string().describe("The resource URI to read")
|
|
1752
2158
|
});
|
|
1753
2159
|
var ReadMcpResourceTool = {
|
|
1754
2160
|
name: TOOL_NAME2,
|
|
1755
2161
|
async description() {
|
|
1756
|
-
return
|
|
2162
|
+
return DESCRIPTION6;
|
|
1757
2163
|
},
|
|
1758
2164
|
async prompt() {
|
|
1759
|
-
return
|
|
2165
|
+
return PROMPT6;
|
|
1760
2166
|
},
|
|
1761
|
-
inputSchema:
|
|
2167
|
+
inputSchema: inputSchema8,
|
|
1762
2168
|
userFacingName() {
|
|
1763
2169
|
return "readMcpResource";
|
|
1764
2170
|
},
|
|
@@ -1813,11 +2219,11 @@ var ReadMcpResourceTool = {
|
|
|
1813
2219
|
return `Read resource "${uri}" from server "${server}"`;
|
|
1814
2220
|
},
|
|
1815
2221
|
renderToolUseRejectedMessage() {
|
|
1816
|
-
return /* @__PURE__ */
|
|
2222
|
+
return /* @__PURE__ */ React8.createElement(FallbackToolUseRejectedMessage, null);
|
|
1817
2223
|
},
|
|
1818
2224
|
renderToolResultMessage(output) {
|
|
1819
2225
|
const count = output.contents?.length ?? 0;
|
|
1820
|
-
return /* @__PURE__ */
|
|
2226
|
+
return /* @__PURE__ */ React8.createElement(Box8, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "row" }, /* @__PURE__ */ React8.createElement(Text8, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React8.createElement(Text8, { bold: true }, "Read MCP resource"), /* @__PURE__ */ React8.createElement(Text8, null, count ? ` (${count} part${count === 1 ? "" : "s"})` : "")), /* @__PURE__ */ React8.createElement(Cost, { costUSD: 0, durationMs: 0, debug: false }));
|
|
1821
2227
|
},
|
|
1822
2228
|
renderResultForAssistant(output) {
|
|
1823
2229
|
return JSON.stringify(output);
|
|
@@ -1858,9 +2264,9 @@ var ReadMcpResourceTool = {
|
|
|
1858
2264
|
|
|
1859
2265
|
// src/tools/agent/TaskTool/TaskTool.tsx
|
|
1860
2266
|
import { last, memoize } from "lodash-es";
|
|
1861
|
-
import
|
|
1862
|
-
import { Box as
|
|
1863
|
-
import { z as
|
|
2267
|
+
import React9 from "react";
|
|
2268
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
2269
|
+
import { z as z9 } from "zod";
|
|
1864
2270
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1865
2271
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
1866
2272
|
|
|
@@ -1958,17 +2364,17 @@ assistant: "I'm going to use the Task tool to launch the with the greeting-respo
|
|
|
1958
2364
|
var TOOL_NAME3 = "Task";
|
|
1959
2365
|
|
|
1960
2366
|
// src/tools/agent/TaskTool/TaskTool.tsx
|
|
1961
|
-
var
|
|
1962
|
-
description:
|
|
1963
|
-
prompt:
|
|
1964
|
-
subagent_type:
|
|
1965
|
-
model:
|
|
2367
|
+
var inputSchema9 = z9.object({
|
|
2368
|
+
description: z9.string().describe("A short (3-5 word) description of the task"),
|
|
2369
|
+
prompt: z9.string().describe("The task for the agent to perform"),
|
|
2370
|
+
subagent_type: z9.string().describe("The type of specialized agent to use for this task"),
|
|
2371
|
+
model: z9.enum(["sonnet", "opus", "haiku"]).optional().describe(
|
|
1966
2372
|
"Optional model to use for this agent. If not specified, inherits from parent. Prefer haiku for quick, straightforward tasks to minimize cost and latency."
|
|
1967
2373
|
),
|
|
1968
|
-
resume:
|
|
2374
|
+
resume: z9.string().optional().describe(
|
|
1969
2375
|
"Optional agent ID to resume from. If provided, the agent will continue from the previous execution transcript."
|
|
1970
2376
|
),
|
|
1971
|
-
run_in_background:
|
|
2377
|
+
run_in_background: z9.boolean().optional().describe(
|
|
1972
2378
|
"Set to true to run this agent in the background. Use TaskOutput to read the output later."
|
|
1973
2379
|
)
|
|
1974
2380
|
});
|
|
@@ -2119,7 +2525,7 @@ function buildForkContextForAgent(options) {
|
|
|
2119
2525
|
}
|
|
2120
2526
|
var TaskTool = {
|
|
2121
2527
|
name: TOOL_NAME3,
|
|
2122
|
-
inputSchema:
|
|
2528
|
+
inputSchema: inputSchema9,
|
|
2123
2529
|
async description() {
|
|
2124
2530
|
return "Launch a new task";
|
|
2125
2531
|
},
|
|
@@ -2182,20 +2588,20 @@ var TaskTool = {
|
|
|
2182
2588
|
return description;
|
|
2183
2589
|
},
|
|
2184
2590
|
renderToolUseRejectedMessage() {
|
|
2185
|
-
return /* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ React9.createElement(FallbackToolUseRejectedMessage, null);
|
|
2186
2592
|
},
|
|
2187
2593
|
renderToolResultMessage(output, { verbose }) {
|
|
2188
2594
|
const theme = getTheme();
|
|
2189
2595
|
if (output.status === "async_launched") {
|
|
2190
2596
|
const hint = output.prompt ? " (down arrow \u2193 to manage \xB7 ctrl+o to expand)" : " (down arrow \u2193 to manage)";
|
|
2191
|
-
return /* @__PURE__ */
|
|
2192
|
-
|
|
2597
|
+
return /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column" }, /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "row" }, /* @__PURE__ */ React9.createElement(Text9, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React9.createElement(Text9, null, "Backgrounded agent", !verbose && /* @__PURE__ */ React9.createElement(Text9, { dimColor: true }, hint))), verbose && output.prompt && /* @__PURE__ */ React9.createElement(
|
|
2598
|
+
Box9,
|
|
2193
2599
|
{
|
|
2194
2600
|
paddingLeft: 2,
|
|
2195
2601
|
borderLeftStyle: "single",
|
|
2196
2602
|
borderLeftColor: theme.secondaryBorder
|
|
2197
2603
|
},
|
|
2198
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ React9.createElement(Text9, { color: theme.secondaryText, wrap: "wrap" }, output.prompt)
|
|
2199
2605
|
));
|
|
2200
2606
|
}
|
|
2201
2607
|
const summary = [
|
|
@@ -2203,32 +2609,32 @@ var TaskTool = {
|
|
|
2203
2609
|
`${formatNumber(output.totalTokens)} tokens`,
|
|
2204
2610
|
formatDuration(output.totalDurationMs)
|
|
2205
2611
|
];
|
|
2206
|
-
return /* @__PURE__ */
|
|
2207
|
-
|
|
2612
|
+
return /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column" }, verbose && output.prompt && /* @__PURE__ */ React9.createElement(
|
|
2613
|
+
Box9,
|
|
2208
2614
|
{
|
|
2209
2615
|
paddingLeft: 2,
|
|
2210
2616
|
borderLeftStyle: "single",
|
|
2211
2617
|
borderLeftColor: theme.secondaryBorder
|
|
2212
2618
|
},
|
|
2213
|
-
/* @__PURE__ */
|
|
2619
|
+
/* @__PURE__ */ React9.createElement(Text9, { color: theme.secondaryText, wrap: "wrap" }, maybeTruncateVerboseToolOutput(output.prompt, {
|
|
2214
2620
|
maxLines: 120,
|
|
2215
2621
|
maxChars: 2e4
|
|
2216
2622
|
}).text)
|
|
2217
|
-
), verbose && output.content.length > 0 && /* @__PURE__ */
|
|
2218
|
-
|
|
2623
|
+
), verbose && output.content.length > 0 && /* @__PURE__ */ React9.createElement(
|
|
2624
|
+
Box9,
|
|
2219
2625
|
{
|
|
2220
2626
|
paddingLeft: 2,
|
|
2221
2627
|
borderLeftStyle: "single",
|
|
2222
2628
|
borderLeftColor: theme.secondaryBorder
|
|
2223
2629
|
},
|
|
2224
|
-
/* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ React9.createElement(Text9, { wrap: "wrap" }, maybeTruncateVerboseToolOutput(
|
|
2225
2631
|
output.content.map((b) => b.text).join("\n"),
|
|
2226
2632
|
{
|
|
2227
2633
|
maxLines: 200,
|
|
2228
2634
|
maxChars: 4e4
|
|
2229
2635
|
}
|
|
2230
2636
|
).text)
|
|
2231
|
-
), /* @__PURE__ */
|
|
2637
|
+
), /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "row" }, /* @__PURE__ */ React9.createElement(Text9, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React9.createElement(Text9, { dimColor: true }, "Done (", summary.join(" \xB7 "), ")")));
|
|
2232
2638
|
},
|
|
2233
2639
|
renderResultForAssistant(output) {
|
|
2234
2640
|
if (output.status === "async_launched")
|
|
@@ -2554,7 +2960,7 @@ var TaskTool = {
|
|
|
2554
2960
|
};
|
|
2555
2961
|
|
|
2556
2962
|
// src/tools/WebFetcher/WebFetcherTool.tsx
|
|
2557
|
-
import { z as
|
|
2963
|
+
import { z as z10 } from "zod";
|
|
2558
2964
|
|
|
2559
2965
|
// src/tools/WebFetcher/WebFetcher.ts
|
|
2560
2966
|
import fetch from "node-fetch";
|
|
@@ -2690,13 +3096,13 @@ User request: ${input.prompt}`;
|
|
|
2690
3096
|
};
|
|
2691
3097
|
|
|
2692
3098
|
// src/tools/WebFetcher/WebFetcherTool.tsx
|
|
2693
|
-
import
|
|
2694
|
-
import { Box as
|
|
2695
|
-
var
|
|
2696
|
-
url:
|
|
2697
|
-
prompt:
|
|
2698
|
-
format:
|
|
2699
|
-
timeout:
|
|
3099
|
+
import React10 from "react";
|
|
3100
|
+
import { Box as Box10, Text as Text10 } from "ink";
|
|
3101
|
+
var inputSchema10 = z10.strictObject({
|
|
3102
|
+
url: z10.string().url().describe("The URL to fetch content from"),
|
|
3103
|
+
prompt: z10.string().optional().describe("Optional prompt to perform AI analysis on the content"),
|
|
3104
|
+
format: z10.enum(["markdown", "html", "text"]).optional().describe("Output format (default: markdown)"),
|
|
3105
|
+
timeout: z10.number().optional().describe("Timeout in seconds (default: 30)")
|
|
2700
3106
|
});
|
|
2701
3107
|
var WebFetcherTool = {
|
|
2702
3108
|
name: "web_fetcher",
|
|
@@ -2704,7 +3110,7 @@ var WebFetcherTool = {
|
|
|
2704
3110
|
return "Fetch and analyze web content. Supports HTML cleaning, Markdown conversion, and AI-powered analysis.";
|
|
2705
3111
|
},
|
|
2706
3112
|
userFacingName: () => "Web Fetcher",
|
|
2707
|
-
inputSchema:
|
|
3113
|
+
inputSchema: inputSchema10,
|
|
2708
3114
|
isReadOnly: () => true,
|
|
2709
3115
|
isConcurrencySafe: () => true,
|
|
2710
3116
|
async isEnabled() {
|
|
@@ -2728,7 +3134,7 @@ ${output.content}`;
|
|
|
2728
3134
|
return `Fetching ${input.url}${input.prompt ? ` with prompt: "${input.prompt}"` : ""}`;
|
|
2729
3135
|
},
|
|
2730
3136
|
renderToolResultMessage(output) {
|
|
2731
|
-
return /* @__PURE__ */
|
|
3137
|
+
return /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text10, null, "Fetched ", output.url, " (", output.metadata.mode, ")"));
|
|
2732
3138
|
},
|
|
2733
3139
|
async *call(input, context) {
|
|
2734
3140
|
const fetcher = new WebFetcher();
|
|
@@ -2746,6 +3152,7 @@ var getAllTools = () => [
|
|
|
2746
3152
|
TaskTool,
|
|
2747
3153
|
AskExpertModelTool,
|
|
2748
3154
|
BashTool,
|
|
3155
|
+
BatchTool,
|
|
2749
3156
|
TaskOutputTool,
|
|
2750
3157
|
KillShellTool,
|
|
2751
3158
|
GlobTool,
|