cliskill 1.1.5 → 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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-GEH466DM.js";
4
+ } from "../chunk-6PBITIPP.js";
5
5
  import "../chunk-S7IQHES2.js";
6
6
  export {
7
7
  runCli
@@ -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
- - 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:
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
- - 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.`;
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,24 +8325,39 @@ 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
  }
8327
- function buildMcpToolsSection(servers) {
8328
- if (servers.length === 0) return "";
8328
+ function buildMcpToolsSection(servers, failedServers = []) {
8329
+ if (servers.length === 0 && failedServers.length === 0) return "";
8329
8330
  const lines = [
8330
8331
  "# MCP (Model Context Protocol) Tools",
8331
8332
  "",
8332
- "You have access to tools from connected MCP (Model Context Protocol) servers.",
8333
+ "You have access to tools from MCP (Model Context Protocol) servers.",
8333
8334
  "These are external tools provided by MCP services that extend your capabilities beyond the built-in tools.",
8334
8335
  "Use them like any other tool when they are relevant to the task.",
8335
8336
  "",
8336
- "When the user asks about MCP services, MCP tools, or what external tools are available, refer to the list below.",
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.",
8337
8339
  ""
8338
8340
  ];
8339
- for (const server of servers) {
8340
- lines.push(`## MCP Server: ${server.name}`);
8341
- for (const tool of server.tools) {
8342
- lines.push(`- **${tool.name}**: ${tool.description}`);
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}`);
8343
8357
  }
8344
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("");
8345
8361
  }
8346
8362
  return lines.join("\n");
8347
8363
  }
@@ -8940,7 +8956,10 @@ function buildModelRouter(adapterRegistry, config) {
8940
8956
  });
8941
8957
  }
8942
8958
  async function connectMcpServers(config, toolRegistry) {
8943
- if (config.mcpServers.length === 0) return null;
8959
+ const failedServers = [];
8960
+ if (config.mcpServers.length === 0) {
8961
+ return { manager: null, failedServers };
8962
+ }
8944
8963
  const mcpManager = new MCPConnectionManager();
8945
8964
  let connectedCount = 0;
8946
8965
  for (const serverConfig of config.mcpServers) {
@@ -8954,10 +8973,14 @@ async function connectMcpServers(config, toolRegistry) {
8954
8973
  });
8955
8974
  connectedCount++;
8956
8975
  } catch (err) {
8957
- console.error(`MCP server "${serverConfig.name}" connection failed: ${err.message}`);
8976
+ const message = err.message;
8977
+ console.error(`MCP server "${serverConfig.name}" connection failed: ${message}`);
8978
+ failedServers.push({ name: serverConfig.name, error: message });
8958
8979
  }
8959
8980
  }
8960
- if (connectedCount === 0) return null;
8981
+ if (connectedCount === 0) {
8982
+ return { manager: null, failedServers };
8983
+ }
8961
8984
  const registeredTools = await registerMCPTools(mcpManager, (tool) => {
8962
8985
  try {
8963
8986
  toolRegistry.register(tool);
@@ -8968,13 +8991,16 @@ async function connectMcpServers(config, toolRegistry) {
8968
8991
  console.log(` MCP: ${connectedCount} server(s) connected, ${registeredTools.length} tool(s) loaded`);
8969
8992
  }
8970
8993
  mcpManager.registerShutdownHandlers();
8971
- return mcpManager;
8994
+ return { manager: mcpManager, failedServers };
8972
8995
  }
8973
- async function buildMcpSystemSection(mcpManager) {
8974
- if (!mcpManager) return "";
8996
+ async function buildMcpSystemSection(mcpResult) {
8997
+ const { manager, failedServers } = mcpResult;
8998
+ if (!manager) {
8999
+ return buildMcpToolsSection([], failedServers);
9000
+ }
8975
9001
  const servers = [];
8976
- for (const serverName of mcpManager.getConnectedServers()) {
8977
- const tools = await mcpManager.getToolsForServer(serverName);
9002
+ for (const serverName of manager.getConnectedServers()) {
9003
+ const tools = await manager.getToolsForServer(serverName);
8978
9004
  if (tools.length === 0) continue;
8979
9005
  servers.push({
8980
9006
  name: serverName,
@@ -8984,7 +9010,7 @@ async function buildMcpSystemSection(mcpManager) {
8984
9010
  }))
8985
9011
  });
8986
9012
  }
8987
- return buildMcpToolsSection(servers);
9013
+ return buildMcpToolsSection(servers, failedServers);
8988
9014
  }
8989
9015
  async function runTuiRepl(config) {
8990
9016
  const adapterRegistry = new AdapterRegistry();
@@ -8998,8 +9024,8 @@ async function runTuiRepl(config) {
8998
9024
  const adapter = config.defaultProvider ? adapterRegistry.get(config.defaultProvider) : adapterRegistry.getAll()[0];
8999
9025
  const modelRouter = buildModelRouter(adapterRegistry, config);
9000
9026
  const toolRegistry = createDefaultToolRegistry(modelRouter);
9001
- const mcpManager = await connectMcpServers(config, toolRegistry);
9002
- const mcpSection = await buildMcpSystemSection(mcpManager);
9027
+ const mcpResult = await connectMcpServers(config, toolRegistry);
9028
+ const mcpSection = await buildMcpSystemSection(mcpResult);
9003
9029
  const baseSystemPrompt = config.systemPrompt ?? buildSystemPrompt();
9004
9030
  const systemPrompt = mcpSection ? baseSystemPrompt + "\n\n" + mcpSection : baseSystemPrompt;
9005
9031
  ensureDataDir();
@@ -9099,8 +9125,8 @@ async function runBasicRepl(config) {
9099
9125
  `);
9100
9126
  }
9101
9127
  const toolRegistry = createDefaultToolRegistry(modelRouter);
9102
- const mcpManager = await connectMcpServers(config, toolRegistry);
9103
- const mcpSection = await buildMcpSystemSection(mcpManager);
9128
+ const mcpResult = await connectMcpServers(config, toolRegistry);
9129
+ const mcpSection = await buildMcpSystemSection(mcpResult);
9104
9130
  const baseSystemPrompt = config.systemPrompt ?? buildSystemPrompt();
9105
9131
  const systemPrompt = mcpSection ? baseSystemPrompt + "\n\n" + mcpSection : baseSystemPrompt;
9106
9132
  const abortController = new AbortController();
@@ -12237,4 +12263,4 @@ export {
12237
12263
  MCPConnectionManager,
12238
12264
  runCli
12239
12265
  };
12240
- //# sourceMappingURL=chunk-GEH466DM.js.map
12266
+ //# sourceMappingURL=chunk-6PBITIPP.js.map