cliskill 1.1.4 → 1.1.6
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/bootstrap/cli.js
CHANGED
|
@@ -8247,15 +8247,16 @@ Examples of the kind of risky actions that warrant user confirmation:
|
|
|
8247
8247
|
}
|
|
8248
8248
|
function getUsingYourToolsSection() {
|
|
8249
8249
|
return `# Using your tools
|
|
8250
|
-
|
|
8250
|
+
- Do NOT use the ${BASH} to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:
|
|
8251
8251
|
- To read files use ${FILE_READ} instead of cat, head, tail, or sed
|
|
8252
8252
|
- To edit files use ${FILE_EDIT} instead of sed or awk
|
|
8253
8253
|
- To create files use ${FILE_WRITE} instead of cat with heredoc or echo redirection
|
|
8254
8254
|
- To search for files use ${GLOB} instead of find or ls
|
|
8255
8255
|
- To search the content of files, use ${GREP} instead of grep or rg
|
|
8256
8256
|
- Reserve using the ${BASH} exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool.
|
|
8257
|
-
|
|
8258
|
-
|
|
8257
|
+
- Break down and manage your work with the ${TODO_WRITE} tool. These tools are helpful for planning your work and helping the user track your progress. Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed.
|
|
8258
|
+
- You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially.
|
|
8259
|
+
- In addition to the built-in tools listed above, you may have access to MCP (Model Context Protocol) tools from external servers. If an "MCP Tools" section appears in your system prompt, those tools are available to you. When the user asks about your tools or capabilities, include MCP tools in your response \u2014 do NOT claim you have no external tools if MCP tools are listed.`;
|
|
8259
8260
|
}
|
|
8260
8261
|
function getAgentToolSection() {
|
|
8261
8262
|
return ` - Use the ${AGENT} tool with specialized sub-agents when the task at hand benefits from parallelization or when you need to protect the main context window from excessive results. Importantly, avoid duplicating work that sub-agents are already doing \u2014 if you delegate research to a sub-agent, do not also perform the same searches yourself.`;
|
|
@@ -8324,6 +8325,42 @@ You have been invoked in the following environment:
|
|
|
8324
8325
|
- Hostname: ${hostname()}
|
|
8325
8326
|
- Shell: ${isWin ? "cmd.exe (use Windows-compatible commands)" : "bash/zsh"}`;
|
|
8326
8327
|
}
|
|
8328
|
+
function buildMcpToolsSection(servers, failedServers = []) {
|
|
8329
|
+
if (servers.length === 0 && failedServers.length === 0) return "";
|
|
8330
|
+
const lines = [
|
|
8331
|
+
"# MCP (Model Context Protocol) Tools",
|
|
8332
|
+
"",
|
|
8333
|
+
"You have access to tools from MCP (Model Context Protocol) servers.",
|
|
8334
|
+
"These are external tools provided by MCP services that extend your capabilities beyond the built-in tools.",
|
|
8335
|
+
"Use them like any other tool when they are relevant to the task.",
|
|
8336
|
+
"",
|
|
8337
|
+
"IMPORTANT: When the user asks about your available tools, MCP capabilities, or what external services you can access,",
|
|
8338
|
+
"you MUST include the MCP tools listed below in your response. Do NOT claim you have no MCP tools if this section exists.",
|
|
8339
|
+
""
|
|
8340
|
+
];
|
|
8341
|
+
if (servers.length > 0) {
|
|
8342
|
+
lines.push("## Connected MCP Servers");
|
|
8343
|
+
lines.push("");
|
|
8344
|
+
for (const server of servers) {
|
|
8345
|
+
lines.push(`### ${server.name}`);
|
|
8346
|
+
for (const tool of server.tools) {
|
|
8347
|
+
lines.push(`- **${tool.name}**: ${tool.description}`);
|
|
8348
|
+
}
|
|
8349
|
+
lines.push("");
|
|
8350
|
+
}
|
|
8351
|
+
}
|
|
8352
|
+
if (failedServers.length > 0) {
|
|
8353
|
+
lines.push("## MCP Servers (Connection Failed)");
|
|
8354
|
+
lines.push("");
|
|
8355
|
+
for (const failed of failedServers) {
|
|
8356
|
+
lines.push(`- **${failed.name}**: ${failed.error}`);
|
|
8357
|
+
}
|
|
8358
|
+
lines.push("");
|
|
8359
|
+
lines.push("The above MCP servers are configured but failed to connect. Inform the user if they ask about MCP.");
|
|
8360
|
+
lines.push("");
|
|
8361
|
+
}
|
|
8362
|
+
return lines.join("\n");
|
|
8363
|
+
}
|
|
8327
8364
|
function buildSystemPrompt() {
|
|
8328
8365
|
return [
|
|
8329
8366
|
getIntroSection(),
|
|
@@ -8919,7 +8956,10 @@ function buildModelRouter(adapterRegistry, config) {
|
|
|
8919
8956
|
});
|
|
8920
8957
|
}
|
|
8921
8958
|
async function connectMcpServers(config, toolRegistry) {
|
|
8922
|
-
|
|
8959
|
+
const failedServers = [];
|
|
8960
|
+
if (config.mcpServers.length === 0) {
|
|
8961
|
+
return { manager: null, failedServers };
|
|
8962
|
+
}
|
|
8923
8963
|
const mcpManager = new MCPConnectionManager();
|
|
8924
8964
|
let connectedCount = 0;
|
|
8925
8965
|
for (const serverConfig of config.mcpServers) {
|
|
@@ -8933,10 +8973,14 @@ async function connectMcpServers(config, toolRegistry) {
|
|
|
8933
8973
|
});
|
|
8934
8974
|
connectedCount++;
|
|
8935
8975
|
} catch (err) {
|
|
8936
|
-
|
|
8976
|
+
const message = err.message;
|
|
8977
|
+
console.error(`MCP server "${serverConfig.name}" connection failed: ${message}`);
|
|
8978
|
+
failedServers.push({ name: serverConfig.name, error: message });
|
|
8937
8979
|
}
|
|
8938
8980
|
}
|
|
8939
|
-
if (connectedCount === 0)
|
|
8981
|
+
if (connectedCount === 0) {
|
|
8982
|
+
return { manager: null, failedServers };
|
|
8983
|
+
}
|
|
8940
8984
|
const registeredTools = await registerMCPTools(mcpManager, (tool) => {
|
|
8941
8985
|
try {
|
|
8942
8986
|
toolRegistry.register(tool);
|
|
@@ -8947,7 +8991,26 @@ async function connectMcpServers(config, toolRegistry) {
|
|
|
8947
8991
|
console.log(` MCP: ${connectedCount} server(s) connected, ${registeredTools.length} tool(s) loaded`);
|
|
8948
8992
|
}
|
|
8949
8993
|
mcpManager.registerShutdownHandlers();
|
|
8950
|
-
return mcpManager;
|
|
8994
|
+
return { manager: mcpManager, failedServers };
|
|
8995
|
+
}
|
|
8996
|
+
async function buildMcpSystemSection(mcpResult) {
|
|
8997
|
+
const { manager, failedServers } = mcpResult;
|
|
8998
|
+
if (!manager) {
|
|
8999
|
+
return buildMcpToolsSection([], failedServers);
|
|
9000
|
+
}
|
|
9001
|
+
const servers = [];
|
|
9002
|
+
for (const serverName of manager.getConnectedServers()) {
|
|
9003
|
+
const tools = await manager.getToolsForServer(serverName);
|
|
9004
|
+
if (tools.length === 0) continue;
|
|
9005
|
+
servers.push({
|
|
9006
|
+
name: serverName,
|
|
9007
|
+
tools: tools.map((t) => ({
|
|
9008
|
+
name: `mcp_${serverName}_${t.name}`,
|
|
9009
|
+
description: t.description ?? `MCP tool: ${t.name}`
|
|
9010
|
+
}))
|
|
9011
|
+
});
|
|
9012
|
+
}
|
|
9013
|
+
return buildMcpToolsSection(servers, failedServers);
|
|
8951
9014
|
}
|
|
8952
9015
|
async function runTuiRepl(config) {
|
|
8953
9016
|
const adapterRegistry = new AdapterRegistry();
|
|
@@ -8961,7 +9024,10 @@ async function runTuiRepl(config) {
|
|
|
8961
9024
|
const adapter = config.defaultProvider ? adapterRegistry.get(config.defaultProvider) : adapterRegistry.getAll()[0];
|
|
8962
9025
|
const modelRouter = buildModelRouter(adapterRegistry, config);
|
|
8963
9026
|
const toolRegistry = createDefaultToolRegistry(modelRouter);
|
|
8964
|
-
const
|
|
9027
|
+
const mcpResult = await connectMcpServers(config, toolRegistry);
|
|
9028
|
+
const mcpSection = await buildMcpSystemSection(mcpResult);
|
|
9029
|
+
const baseSystemPrompt = config.systemPrompt ?? buildSystemPrompt();
|
|
9030
|
+
const systemPrompt = mcpSection ? baseSystemPrompt + "\n\n" + mcpSection : baseSystemPrompt;
|
|
8965
9031
|
ensureDataDir();
|
|
8966
9032
|
const sessionSaver = new SessionSaver();
|
|
8967
9033
|
await sessionSaver.init();
|
|
@@ -8980,7 +9046,7 @@ async function runTuiRepl(config) {
|
|
|
8980
9046
|
adapter,
|
|
8981
9047
|
toolRegistry,
|
|
8982
9048
|
config,
|
|
8983
|
-
systemPrompt
|
|
9049
|
+
systemPrompt,
|
|
8984
9050
|
cwd: process.cwd(),
|
|
8985
9051
|
abortSignal: activeAbortController.signal,
|
|
8986
9052
|
onPermissionRequest: async () => true,
|
|
@@ -9059,7 +9125,10 @@ async function runBasicRepl(config) {
|
|
|
9059
9125
|
`);
|
|
9060
9126
|
}
|
|
9061
9127
|
const toolRegistry = createDefaultToolRegistry(modelRouter);
|
|
9062
|
-
await connectMcpServers(config, toolRegistry);
|
|
9128
|
+
const mcpResult = await connectMcpServers(config, toolRegistry);
|
|
9129
|
+
const mcpSection = await buildMcpSystemSection(mcpResult);
|
|
9130
|
+
const baseSystemPrompt = config.systemPrompt ?? buildSystemPrompt();
|
|
9131
|
+
const systemPrompt = mcpSection ? baseSystemPrompt + "\n\n" + mcpSection : baseSystemPrompt;
|
|
9063
9132
|
const abortController = new AbortController();
|
|
9064
9133
|
ensureDataDir();
|
|
9065
9134
|
const sessionSaver = new SessionSaver();
|
|
@@ -9140,7 +9209,7 @@ async function runBasicRepl(config) {
|
|
|
9140
9209
|
adapter,
|
|
9141
9210
|
toolRegistry,
|
|
9142
9211
|
config,
|
|
9143
|
-
systemPrompt
|
|
9212
|
+
systemPrompt,
|
|
9144
9213
|
cwd: process.cwd(),
|
|
9145
9214
|
abortSignal: abortController.signal,
|
|
9146
9215
|
onPermissionRequest: async (operation, details) => {
|
|
@@ -12194,4 +12263,4 @@ export {
|
|
|
12194
12263
|
MCPConnectionManager,
|
|
12195
12264
|
runCli
|
|
12196
12265
|
};
|
|
12197
|
-
//# sourceMappingURL=chunk-
|
|
12266
|
+
//# sourceMappingURL=chunk-6PBITIPP.js.map
|