@oh-my-pi/pi-coding-agent 1.338.0 → 1.340.0
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 +18 -0
- package/package.json +3 -3
- package/src/core/export-html/index.ts +48 -15
- package/src/core/export-html/template.html +3 -11
- package/src/core/mcp/client.ts +43 -16
- package/src/core/mcp/config.ts +152 -6
- package/src/core/mcp/index.ts +6 -2
- package/src/core/mcp/loader.ts +30 -3
- package/src/core/mcp/manager.ts +69 -10
- package/src/core/mcp/types.ts +9 -3
- package/src/core/sdk.ts +15 -1
- package/src/core/settings-manager.ts +17 -0
- package/src/modes/interactive/components/settings-defs.ts +9 -0
- package/src/modes/interactive/interactive-mode.ts +1 -1
- package/src/core/export-html/vendor/highlight.min.js +0 -1213
- package/src/core/export-html/vendor/marked.min.js +0 -6
package/src/core/sdk.ts
CHANGED
|
@@ -596,10 +596,24 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
596
596
|
let mcpManager: MCPManager | undefined;
|
|
597
597
|
const enableMCP = options.enableMCP ?? true;
|
|
598
598
|
if (enableMCP) {
|
|
599
|
-
const mcpResult = await discoverAndLoadMCPTools(cwd
|
|
599
|
+
const mcpResult = await discoverAndLoadMCPTools(cwd, {
|
|
600
|
+
onConnecting: (serverNames) => {
|
|
601
|
+
if (options.hasUI && serverNames.length > 0) {
|
|
602
|
+
process.stderr.write(`\x1b[90mConnecting to MCP servers: ${serverNames.join(", ")}...\x1b[0m\n`);
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
enableProjectConfig: settingsManager.getMCPProjectConfigEnabled(),
|
|
606
|
+
// Always filter Exa - we have native integration
|
|
607
|
+
filterExa: true,
|
|
608
|
+
});
|
|
600
609
|
time("discoverAndLoadMCPTools");
|
|
601
610
|
mcpManager = mcpResult.manager;
|
|
602
611
|
|
|
612
|
+
// If we extracted Exa API keys from MCP configs and EXA_API_KEY isn't set, use the first one
|
|
613
|
+
if (mcpResult.exaApiKeys.length > 0 && !process.env.EXA_API_KEY) {
|
|
614
|
+
process.env.EXA_API_KEY = mcpResult.exaApiKeys[0];
|
|
615
|
+
}
|
|
616
|
+
|
|
603
617
|
// Log MCP errors
|
|
604
618
|
for (const { path, error } of mcpResult.errors) {
|
|
605
619
|
console.error(`MCP "${path}": ${error}`);
|
|
@@ -47,6 +47,10 @@ export interface BashInterceptorSettings {
|
|
|
47
47
|
enabled?: boolean; // default: false (blocks shell commands that have dedicated tools)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
export interface MCPSettings {
|
|
51
|
+
enableProjectConfig?: boolean; // default: true (load .mcp.json from project root)
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
export interface Settings {
|
|
51
55
|
lastChangelogVersion?: string;
|
|
52
56
|
defaultProvider?: string;
|
|
@@ -67,6 +71,7 @@ export interface Settings {
|
|
|
67
71
|
enabledModels?: string[]; // Model patterns for cycling (same format as --models CLI flag)
|
|
68
72
|
exa?: ExaSettings;
|
|
69
73
|
bashInterceptor?: BashInterceptorSettings;
|
|
74
|
+
mcp?: MCPSettings;
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */
|
|
@@ -457,4 +462,16 @@ export class SettingsManager {
|
|
|
457
462
|
this.globalSettings.bashInterceptor.enabled = enabled;
|
|
458
463
|
this.save();
|
|
459
464
|
}
|
|
465
|
+
|
|
466
|
+
getMCPProjectConfigEnabled(): boolean {
|
|
467
|
+
return this.settings.mcp?.enableProjectConfig ?? true;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
setMCPProjectConfigEnabled(enabled: boolean): void {
|
|
471
|
+
if (!this.globalSettings.mcp) {
|
|
472
|
+
this.globalSettings.mcp = {};
|
|
473
|
+
}
|
|
474
|
+
this.globalSettings.mcp.enableProjectConfig = enabled;
|
|
475
|
+
this.save();
|
|
476
|
+
}
|
|
460
477
|
}
|
|
@@ -126,6 +126,15 @@ export const SETTINGS_DEFS: SettingDef[] = [
|
|
|
126
126
|
get: (sm) => sm.getBashInterceptorEnabled(),
|
|
127
127
|
set: (sm, v) => sm.setBashInterceptorEnabled(v),
|
|
128
128
|
},
|
|
129
|
+
{
|
|
130
|
+
id: "mcpProjectConfig",
|
|
131
|
+
tab: "config",
|
|
132
|
+
type: "boolean",
|
|
133
|
+
label: "MCP project config",
|
|
134
|
+
description: "Load .mcp.json/mcp.json from project root",
|
|
135
|
+
get: (sm) => sm.getMCPProjectConfigEnabled(),
|
|
136
|
+
set: (sm, v) => sm.setMCPProjectConfigEnabled(v),
|
|
137
|
+
},
|
|
129
138
|
{
|
|
130
139
|
id: "thinkingLevel",
|
|
131
140
|
tab: "config",
|
|
@@ -2122,7 +2122,7 @@ export class InteractiveMode {
|
|
|
2122
2122
|
}
|
|
2123
2123
|
|
|
2124
2124
|
// Create the preview URL
|
|
2125
|
-
const previewUrl = `https://
|
|
2125
|
+
const previewUrl = `https://gistpreview.github.io/?${gistId}`;
|
|
2126
2126
|
this.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
|
|
2127
2127
|
} catch (error: unknown) {
|
|
2128
2128
|
if (!loader.signal.aborted) {
|