@openeryc/pi-coding-agent 0.75.37 → 0.75.39
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/CHANGELOG.md +11 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.d.ts +23 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/mcp-selector.js +81 -0
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +2 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +63 -65
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -50,6 +50,7 @@ import { ExtensionSelectorComponent } from "./components/extension-selector.js";
|
|
|
50
50
|
import { FooterComponent } from "./components/footer.js";
|
|
51
51
|
import { formatKeyText, keyDisplayText, keyHint, keyText, rawKeyHint } from "./components/keybinding-hints.js";
|
|
52
52
|
import { LoginDialogComponent } from "./components/login-dialog.js";
|
|
53
|
+
import { McpSelectorComponent } from "./components/mcp-selector.js";
|
|
53
54
|
import { ModelSelectorComponent } from "./components/model-selector.js";
|
|
54
55
|
import { OAuthSelectorComponent } from "./components/oauth-selector.js";
|
|
55
56
|
import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
|
|
@@ -2022,14 +2023,19 @@ export class InteractiveMode {
|
|
|
2022
2023
|
return;
|
|
2023
2024
|
}
|
|
2024
2025
|
if (text === "/mcp") {
|
|
2025
|
-
this.handleMcpCommand();
|
|
2026
2026
|
this.editor.setText("");
|
|
2027
|
+
this.showMcpSelector();
|
|
2027
2028
|
return;
|
|
2028
2029
|
}
|
|
2029
2030
|
if (text.startsWith("/mcp ")) {
|
|
2030
2031
|
const name = text.slice(5).trim();
|
|
2031
|
-
this.handleMcpToggle(name);
|
|
2032
2032
|
this.editor.setText("");
|
|
2033
|
+
this.showMcpSelector(name);
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
if (text === "/skills") {
|
|
2037
|
+
this.editor.setText("");
|
|
2038
|
+
this.showSkillsSelector();
|
|
2033
2039
|
return;
|
|
2034
2040
|
}
|
|
2035
2041
|
if (text === "/usage") {
|
|
@@ -3204,6 +3210,7 @@ export class InteractiveMode {
|
|
|
3204
3210
|
this.editorContainer.clear();
|
|
3205
3211
|
this.editorContainer.addChild(this.editor);
|
|
3206
3212
|
this.ui.setFocus(this.editor);
|
|
3213
|
+
this.ui.requestRender();
|
|
3207
3214
|
};
|
|
3208
3215
|
const { component, focus } = create(done);
|
|
3209
3216
|
this.editorContainer.clear();
|
|
@@ -4408,84 +4415,75 @@ export class InteractiveMode {
|
|
|
4408
4415
|
this.chatContainer.addChild(new Text(info, 1, 0));
|
|
4409
4416
|
this.ui.requestRender();
|
|
4410
4417
|
}
|
|
4411
|
-
|
|
4412
|
-
const
|
|
4418
|
+
showMcpSelector(highlightServer) {
|
|
4419
|
+
const configured = this.settingsManager.getMcpServers();
|
|
4413
4420
|
const allTools = this.session.getAllTools();
|
|
4414
4421
|
const mcpTools = allTools.filter((t) => t.name.startsWith("mcp_"));
|
|
4415
|
-
const
|
|
4422
|
+
const toolCountByServer = new Map();
|
|
4416
4423
|
for (const tool of mcpTools) {
|
|
4417
4424
|
const rest = tool.name.slice(4);
|
|
4418
|
-
const
|
|
4419
|
-
const
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4425
|
+
const idx = rest.indexOf("_");
|
|
4426
|
+
const srv = idx === -1 ? rest : rest.slice(0, idx);
|
|
4427
|
+
toolCountByServer.set(srv, (toolCountByServer.get(srv) ?? 0) + 1);
|
|
4428
|
+
}
|
|
4429
|
+
const items = (configured ? Object.entries(configured) : []).map(([name, cfg]) => {
|
|
4430
|
+
const disabled = cfg.enabled === false;
|
|
4431
|
+
const connected = (toolCountByServer.get(name) ?? 0) > 0;
|
|
4432
|
+
const transport = cfg.url ? (cfg.transport ?? "sse") : cfg.command ? "stdio" : "unknown";
|
|
4433
|
+
return {
|
|
4434
|
+
name,
|
|
4435
|
+
status: disabled ? "disabled" : connected ? "connected" : "disconnected",
|
|
4436
|
+
toolCount: toolCountByServer.get(name) ?? 0,
|
|
4437
|
+
transport,
|
|
4438
|
+
};
|
|
4439
|
+
});
|
|
4440
|
+
if (items.length === 0) {
|
|
4441
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
4430
4442
|
this.chatContainer.addChild(new Text(`${theme.bold("MCP Servers")}\n\n${theme.fg("dim", "No MCP servers configured. Add 'mcpServers' to settings.json.")}`, 1, 0));
|
|
4431
4443
|
this.ui.requestRender();
|
|
4432
4444
|
return;
|
|
4433
4445
|
}
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
const connected = tools.length > 0;
|
|
4441
|
-
let status;
|
|
4442
|
-
if (disabled) {
|
|
4443
|
-
status = theme.fg("muted", "disabled");
|
|
4444
|
-
}
|
|
4445
|
-
else if (connected) {
|
|
4446
|
-
status = theme.fg("success", "connected");
|
|
4446
|
+
if (highlightServer) {
|
|
4447
|
+
const server = configured?.[highlightServer];
|
|
4448
|
+
if (server) {
|
|
4449
|
+
const currentEnabled = server.enabled !== false;
|
|
4450
|
+
this.settingsManager.setMcpServerEnabled(highlightServer, !currentEnabled);
|
|
4451
|
+
this.session.reloadMcp();
|
|
4447
4452
|
}
|
|
4448
|
-
else {
|
|
4449
|
-
status = theme.fg("warning", "disconnected");
|
|
4450
|
-
}
|
|
4451
|
-
const toggleHint = disabled ? "[/mcp " + serverName + " to enable]" : "[/mcp " + serverName + " to disable]";
|
|
4452
|
-
const transport = config.url ? (config.transport ?? "sse") : config.command ? "stdio" : "unknown";
|
|
4453
|
-
const toolCount = tools.length;
|
|
4454
|
-
info += `${theme.bold(++idx + ". " + serverName)} ${status} ${theme.fg("dim", toggleHint)}\n`;
|
|
4455
|
-
info += `${theme.fg("dim", ` Transport: ${transport} | Tools: ${toolCount}`)}\n`;
|
|
4456
|
-
if (config.command) {
|
|
4457
|
-
const cmd = config.args ? `${config.command} ${config.args.join(" ")}` : config.command;
|
|
4458
|
-
info += `${theme.fg("dim", ` Command: ${cmd}`)}\n`;
|
|
4459
|
-
}
|
|
4460
|
-
if (config.url) {
|
|
4461
|
-
info += `${theme.fg("dim", ` URL: ${config.url}`)}\n`;
|
|
4462
|
-
}
|
|
4463
|
-
// Show detailed tool list only for highlighted server
|
|
4464
|
-
if (highlightServer === serverName && connected) {
|
|
4465
|
-
for (const tool of tools) {
|
|
4466
|
-
const desc = tool.description ? ` - ${tool.description.split("\n")[0].slice(0, 80)}` : "";
|
|
4467
|
-
info += `${theme.fg("dim", ` ${tool.name}${desc}`)}\n`;
|
|
4468
|
-
}
|
|
4469
|
-
}
|
|
4470
|
-
info += "\n";
|
|
4471
4453
|
}
|
|
4472
|
-
this.
|
|
4473
|
-
|
|
4454
|
+
this.showSelector((done) => {
|
|
4455
|
+
const selector = new McpSelectorComponent(items, async (name) => {
|
|
4456
|
+
const server = configured?.[name];
|
|
4457
|
+
if (!server)
|
|
4458
|
+
return;
|
|
4459
|
+
const currentEnabled = server.enabled !== false;
|
|
4460
|
+
this.settingsManager.setMcpServerEnabled(name, !currentEnabled);
|
|
4461
|
+
await this.session.reloadMcp();
|
|
4462
|
+
done();
|
|
4463
|
+
this.showStatus(`${name} ${currentEnabled ? "disabled" : "enabled"}`);
|
|
4464
|
+
}, () => done());
|
|
4465
|
+
return { component: selector, focus: selector };
|
|
4466
|
+
});
|
|
4474
4467
|
}
|
|
4475
|
-
|
|
4476
|
-
const
|
|
4477
|
-
if (
|
|
4468
|
+
showSkillsSelector() {
|
|
4469
|
+
const skills = this.session.resourceLoader.getSkills().skills;
|
|
4470
|
+
if (skills.length === 0) {
|
|
4478
4471
|
this.chatContainer.addChild(new Spacer(1));
|
|
4479
|
-
this.chatContainer.addChild(new Text(theme.fg("
|
|
4472
|
+
this.chatContainer.addChild(new Text(theme.fg("dim", "No skills loaded."), 1, 0));
|
|
4480
4473
|
this.ui.requestRender();
|
|
4481
4474
|
return;
|
|
4482
4475
|
}
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4476
|
+
this.showSelector((done) => {
|
|
4477
|
+
const selector = new McpSelectorComponent(skills.map((s) => ({
|
|
4478
|
+
name: s.name,
|
|
4479
|
+
status: s.disableModelInvocation ? "disabled" : "connected",
|
|
4480
|
+
toolCount: 0,
|
|
4481
|
+
transport: s.description.slice(0, 60),
|
|
4482
|
+
})), (_name) => {
|
|
4483
|
+
done();
|
|
4484
|
+
}, () => done());
|
|
4485
|
+
return { component: selector, focus: selector };
|
|
4486
|
+
});
|
|
4489
4487
|
}
|
|
4490
4488
|
async handleUsageCommand() {
|
|
4491
4489
|
this.showStatus("Loading usage stats...");
|