@openeryc/pi-coding-agent 0.75.35 → 0.75.36

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.
@@ -289,27 +289,32 @@ export class InteractiveMode {
289
289
  const modelCommand = slashCommands.find((command) => command.name === "model");
290
290
  if (modelCommand) {
291
291
  modelCommand.getArgumentCompletions = (prefix) => {
292
- // Get available models (scoped or from registry)
293
292
  const models = this.session.scopedModels.length > 0
294
293
  ? this.session.scopedModels.map((s) => s.model)
295
294
  : this.session.modelRegistry.getAvailable();
296
295
  if (models.length === 0)
297
296
  return null;
298
- // Create items with provider/id format
299
- const items = models.map((m) => ({
300
- id: m.id,
301
- provider: m.provider,
302
- label: `${m.provider}/${m.id}`,
303
- }));
304
- // Fuzzy filter by model ID + provider (allows "opus anthropic" to match)
297
+ const items = models.map((m) => ({ id: m.id, provider: m.provider, label: `${m.provider}/${m.id}` }));
305
298
  const filtered = fuzzyFilter(items, prefix, (item) => `${item.id} ${item.provider}`);
306
299
  if (filtered.length === 0)
307
300
  return null;
308
- return filtered.map((item) => ({
309
- value: item.label,
310
- label: item.id,
311
- description: item.provider,
312
- }));
301
+ return filtered.map((item) => ({ value: item.label, label: item.id, description: item.provider }));
302
+ };
303
+ }
304
+ // MCP command: autocomplete server names
305
+ const mcpCommand = slashCommands.find((command) => command.name === "mcp");
306
+ if (mcpCommand) {
307
+ mcpCommand.getArgumentCompletions = (prefix) => {
308
+ const servers = this.settingsManager.getMcpServers();
309
+ if (!servers)
310
+ return null;
311
+ const names = Object.keys(servers);
312
+ if (names.length === 0)
313
+ return null;
314
+ const filtered = fuzzyFilter(names.map((n) => ({ label: n })), prefix, (item) => item.label);
315
+ if (filtered.length === 0)
316
+ return null;
317
+ return filtered.map((item) => ({ value: item.label, label: item.label }));
313
318
  };
314
319
  }
315
320
  // Convert prompt templates to SlashCommand format for autocomplete
@@ -4403,15 +4408,13 @@ export class InteractiveMode {
4403
4408
  this.chatContainer.addChild(new Text(info, 1, 0));
4404
4409
  this.ui.requestRender();
4405
4410
  }
4406
- handleMcpCommand() {
4411
+ handleMcpCommand(highlightServer) {
4407
4412
  const configuredServers = this.settingsManager.getMcpServers();
4408
4413
  const allTools = this.session.getAllTools();
4409
- // Group MCP tools by server name
4410
4414
  const mcpTools = allTools.filter((t) => t.name.startsWith("mcp_"));
4411
4415
  const toolsByServer = new Map();
4412
4416
  for (const tool of mcpTools) {
4413
- const prefix = "mcp_";
4414
- const rest = tool.name.slice(prefix.length);
4417
+ const rest = tool.name.slice(4);
4415
4418
  const secondUnderscore = rest.indexOf("_");
4416
4419
  const serverName = secondUnderscore === -1 ? rest : rest.slice(0, secondUnderscore);
4417
4420
  const existing = toolsByServer.get(serverName);
@@ -4429,7 +4432,7 @@ export class InteractiveMode {
4429
4432
  return;
4430
4433
  }
4431
4434
  let info = `${theme.bold("MCP Servers")}\n`;
4432
- info += `${theme.fg("dim", "Use /mcp <name> to toggle a server on/off")}\n\n`;
4435
+ info += `${theme.fg("dim", "Use /mcp <name> to toggle or view details")}\n\n`;
4433
4436
  let idx = 0;
4434
4437
  for (const [serverName, config] of Object.entries(configuredServers)) {
4435
4438
  const tools = toolsByServer.get(serverName) ?? [];
@@ -4447,8 +4450,9 @@ export class InteractiveMode {
4447
4450
  }
4448
4451
  const toggleHint = disabled ? "[/mcp " + serverName + " to enable]" : "[/mcp " + serverName + " to disable]";
4449
4452
  const transport = config.url ? (config.transport ?? "sse") : config.command ? "stdio" : "unknown";
4453
+ const toolCount = tools.length;
4450
4454
  info += `${theme.bold(++idx + ". " + serverName)} ${status} ${theme.fg("dim", toggleHint)}\n`;
4451
- info += `${theme.fg("dim", ` Transport: ${transport}`)}\n`;
4455
+ info += `${theme.fg("dim", ` Transport: ${transport} | Tools: ${toolCount}`)}\n`;
4452
4456
  if (config.command) {
4453
4457
  const cmd = config.args ? `${config.command} ${config.args.join(" ")}` : config.command;
4454
4458
  info += `${theme.fg("dim", ` Command: ${cmd}`)}\n`;
@@ -4456,8 +4460,8 @@ export class InteractiveMode {
4456
4460
  if (config.url) {
4457
4461
  info += `${theme.fg("dim", ` URL: ${config.url}`)}\n`;
4458
4462
  }
4459
- if (connected) {
4460
- info += `${theme.fg("dim", ` Tools: ${tools.length}`)}\n`;
4463
+ // Show detailed tool list only for highlighted server
4464
+ if (highlightServer === serverName && connected) {
4461
4465
  for (const tool of tools) {
4462
4466
  const desc = tool.description ? ` - ${tool.description.split("\n")[0].slice(0, 80)}` : "";
4463
4467
  info += `${theme.fg("dim", ` ${tool.name}${desc}`)}\n`;
@@ -4481,7 +4485,7 @@ export class InteractiveMode {
4481
4485
  await this.session.reloadMcp();
4482
4486
  this.chatContainer.addChild(new Spacer(1));
4483
4487
  this.chatContainer.addChild(new Text(`${theme.bold(serverName)} ${theme.fg(currentEnabled ? "muted" : "success", currentEnabled ? "disabled" : "enabled")}`, 1, 0));
4484
- this.handleMcpCommand();
4488
+ this.handleMcpCommand(serverName);
4485
4489
  }
4486
4490
  async handleUsageCommand() {
4487
4491
  this.showStatus("Loading usage stats...");