@oh-my-pi/pi-coding-agent 13.13.0 → 13.14.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 +39 -1
- package/README.md +3 -1
- package/package.json +7 -7
- package/src/capability/mcp.ts +2 -0
- package/src/config/keybindings.ts +0 -4
- package/src/config/mcp-schema.json +230 -0
- package/src/config/model-registry.ts +10 -3
- package/src/config/settings-schema.ts +13 -0
- package/src/discovery/builtin.ts +1 -0
- package/src/discovery/helpers.ts +9 -2
- package/src/discovery/mcp-json.ts +3 -0
- package/src/extensibility/custom-tools/types.ts +4 -0
- package/src/extensibility/extensions/types.ts +4 -0
- package/src/internal-urls/docs-index.generated.ts +2 -1
- package/src/mcp/client.ts +72 -17
- package/src/mcp/config-writer.ts +9 -2
- package/src/mcp/config.ts +1 -0
- package/src/mcp/discoverable-tool-metadata.ts +10 -0
- package/src/mcp/manager.ts +284 -57
- package/src/mcp/tool-bridge.ts +189 -106
- package/src/mcp/transports/http.ts +154 -29
- package/src/mcp/transports/stdio.ts +62 -12
- package/src/mcp/types.ts +22 -1
- package/src/modes/components/custom-editor.ts +126 -71
- package/src/modes/controllers/command-controller.ts +3 -12
- package/src/modes/controllers/extension-ui-controller.ts +3 -1
- package/src/modes/controllers/input-controller.ts +36 -37
- package/src/modes/controllers/mcp-command-controller.ts +45 -0
- package/src/modes/controllers/selector-controller.ts +11 -0
- package/src/modes/interactive-mode.ts +14 -17
- package/src/modes/utils/hotkeys-markdown.ts +24 -22
- package/src/patch/index.ts +36 -7
- package/src/prompts/agents/explore.md +4 -67
- package/src/sdk.ts +19 -2
- package/src/session/agent-session.ts +44 -21
- package/src/session/compaction/compaction.ts +1 -1
- package/src/slash-commands/builtin-registry.ts +1 -0
- package/src/system-prompt.ts +26 -14
- package/src/tools/write.ts +26 -2
- package/src/utils/title-generator.ts +46 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [13.14.0] - 2026-03-20
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Auto-reconnect MCP servers on connection loss with proactive SSE stream monitoring and retry backoff
|
|
10
|
+
- Tool-level reconnect: retriable connection errors (ECONNREFUSED, ECONNRESET, stale session 404/502/503) trigger automatic reconnection and single retry
|
|
11
|
+
- `/mcp reconnect <name>` command for manual server recovery after extended outages
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Extended transport reconnect handling to all transport types (not just HTTP/SSE), ensuring stdio and other transports trigger automatic reconnection on connection loss
|
|
16
|
+
- Improved reconnect robustness by aborting retry attempts when MCP server configuration changes during reconnection sequence
|
|
17
|
+
- Updated explore agent thinking level from off to med for improved reasoning
|
|
18
|
+
- Simplified explore agent output schema: consolidated file references into single `ref` field with optional line ranges instead of separate `path`, `line_start`, `line_end` fields
|
|
19
|
+
- Removed `code` section from explore agent output (critical code excerpts no longer extracted)
|
|
20
|
+
- Removed `dependencies` section from explore agent output
|
|
21
|
+
- Removed `risks` section from explore agent output
|
|
22
|
+
- Removed `start_here` section from explore agent output
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Fixed reconnect retry loop continuing after configuration changes by checking epoch before each reconnection attempt
|
|
27
|
+
- `roots/list` timeout on MCP server initialization: `connectToServer` now always installs a default handler for `ping` and `roots/list`
|
|
28
|
+
- Fixed resumed GitHub Copilot conversations that could fail with `401 input item does not belong to this connection` on the first follow-up after process restart ([#488](https://github.com/can1357/oh-my-pi/issues/488))
|
|
29
|
+
- Fixed STT Alt+H mic cursor rendering to measure the actual microphone glyph width, preventing one-column TUI overflow crashes when the active symbol preset uses a wide icon ([#484](https://github.com/can1357/oh-my-pi/issues/484))
|
|
30
|
+
|
|
31
|
+
## [13.13.2] - 2026-03-18
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- Added automatic stripping of hashline display prefixes (LINE#ID:) from write tool content when hashline edit mode is enabled, preventing the model from accidentally copying display markers into files
|
|
36
|
+
- Added `mcpServerName` and `mcpToolName` optional properties to custom tools for MCP server discovery and search metadata
|
|
37
|
+
|
|
38
|
+
## [13.13.1] - 2026-03-18
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- Automatic deduplication of identical context files by content, keeping the closest (lowest depth) copy when duplicates are discovered
|
|
42
|
+
|
|
5
43
|
## [13.13.0] - 2026-03-18
|
|
6
44
|
|
|
7
45
|
### Added
|
|
@@ -2214,7 +2252,7 @@
|
|
|
2214
2252
|
- New `appendModeChange()` method in SessionManager to record mode transitions
|
|
2215
2253
|
- New `mode` and `modeData` fields in SessionContext to track active agent mode
|
|
2216
2254
|
- Support for `PI_PACKAGE_DIR` environment variable to override package directory (useful for Nix/Guix store paths)
|
|
2217
|
-
- New keybindings for session management: `
|
|
2255
|
+
- New keybindings for session management: `newSession`, `tree`, `fork`, and `resume` actions
|
|
2218
2256
|
- Support for shell command execution in configuration values (API keys, headers) using `!` prefix, with result caching
|
|
2219
2257
|
- New `clearOnShrink` display setting to control whether empty rows are cleared when content shrinks
|
|
2220
2258
|
- New `SlashCommandInfo`, `SlashCommandLocation`, and `SlashCommandSource` types for extension slash command discovery
|
package/README.md
CHANGED
|
@@ -8,5 +8,7 @@ For installation, setup, provider configuration, model roles, slash commands, an
|
|
|
8
8
|
|
|
9
9
|
Package-specific references:
|
|
10
10
|
- [CHANGELOG](./CHANGELOG.md)
|
|
11
|
-
- [
|
|
11
|
+
- [MCP configuration guide](../../docs/mcp-config.md)
|
|
12
|
+
- [MCP runtime lifecycle](../../docs/mcp-runtime-lifecycle.md)
|
|
13
|
+
- [MCP server/tool authoring](../../docs/mcp-server-tool-authoring.md)
|
|
12
14
|
- [DEVELOPMENT](./DEVELOPMENT.md)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.14.0",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@mozilla/readability": "^0.6",
|
|
44
|
-
"@oh-my-pi/omp-stats": "13.
|
|
45
|
-
"@oh-my-pi/pi-agent-core": "13.
|
|
46
|
-
"@oh-my-pi/pi-ai": "13.
|
|
47
|
-
"@oh-my-pi/pi-natives": "13.
|
|
48
|
-
"@oh-my-pi/pi-tui": "13.
|
|
49
|
-
"@oh-my-pi/pi-utils": "13.
|
|
44
|
+
"@oh-my-pi/omp-stats": "13.14.0",
|
|
45
|
+
"@oh-my-pi/pi-agent-core": "13.14.0",
|
|
46
|
+
"@oh-my-pi/pi-ai": "13.14.0",
|
|
47
|
+
"@oh-my-pi/pi-natives": "13.14.0",
|
|
48
|
+
"@oh-my-pi/pi-tui": "13.14.0",
|
|
49
|
+
"@oh-my-pi/pi-utils": "13.14.0",
|
|
50
50
|
"@sinclair/typebox": "^0.34",
|
|
51
51
|
"@xterm/headless": "^6.0",
|
|
52
52
|
"ajv": "^8.18",
|
package/src/capability/mcp.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface MCPServer {
|
|
|
23
23
|
args?: string[];
|
|
24
24
|
/** Environment variables */
|
|
25
25
|
env?: Record<string, string>;
|
|
26
|
+
/** Working directory for stdio transport */
|
|
27
|
+
cwd?: string;
|
|
26
28
|
/** URL (for HTTP/SSE transport) */
|
|
27
29
|
url?: string;
|
|
28
30
|
/** HTTP headers (for HTTP transport) */
|
|
@@ -25,7 +25,6 @@ export type AppAction =
|
|
|
25
25
|
| "togglePlanMode"
|
|
26
26
|
| "expandTools"
|
|
27
27
|
| "toggleThinking"
|
|
28
|
-
| "toggleSessionNamedFilter"
|
|
29
28
|
| "externalEditor"
|
|
30
29
|
| "historySearch"
|
|
31
30
|
| "followUp"
|
|
@@ -67,7 +66,6 @@ export const DEFAULT_APP_KEYBINDINGS: Record<AppAction, KeyId | KeyId[]> = {
|
|
|
67
66
|
historySearch: "ctrl+r",
|
|
68
67
|
expandTools: "ctrl+o",
|
|
69
68
|
toggleThinking: "ctrl+t",
|
|
70
|
-
toggleSessionNamedFilter: "ctrl+n",
|
|
71
69
|
externalEditor: "ctrl+g",
|
|
72
70
|
followUp: "ctrl+enter",
|
|
73
71
|
dequeue: "alt+up",
|
|
@@ -80,7 +78,6 @@ export const DEFAULT_APP_KEYBINDINGS: Record<AppAction, KeyId | KeyId[]> = {
|
|
|
80
78
|
resume: [],
|
|
81
79
|
toggleSTT: "alt+h",
|
|
82
80
|
};
|
|
83
|
-
|
|
84
81
|
/**
|
|
85
82
|
* All default keybindings (app + editor).
|
|
86
83
|
*/
|
|
@@ -103,7 +100,6 @@ const APP_ACTIONS: AppAction[] = [
|
|
|
103
100
|
"historySearch",
|
|
104
101
|
"expandTools",
|
|
105
102
|
"toggleThinking",
|
|
106
|
-
"toggleSessionNamedFilter",
|
|
107
103
|
"externalEditor",
|
|
108
104
|
"followUp",
|
|
109
105
|
"dequeue",
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/can1357/oh-my-pi/main/packages/coding-agent/src/config/mcp-schema.json",
|
|
4
|
+
"title": "OMP MCP configuration",
|
|
5
|
+
"description": "Schema for mcp.json, .mcp.json, .omp/mcp.json, and ~/.omp/mcp.json used by the OMP coding agent.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Optional schema reference for editor autocomplete and validation."
|
|
12
|
+
},
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"description": "Map of MCP server name to server configuration.",
|
|
16
|
+
"propertyNames": {
|
|
17
|
+
"pattern": "^[a-zA-Z0-9_.-]{1,100}$"
|
|
18
|
+
},
|
|
19
|
+
"additionalProperties": {
|
|
20
|
+
"$ref": "#/$defs/serverConfig"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"disabledServers": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"description": "User-level denylist for disabling discovered servers by name.",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"minLength": 1
|
|
29
|
+
},
|
|
30
|
+
"uniqueItems": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"$defs": {
|
|
34
|
+
"stringMap": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"authConfig": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"required": ["type"],
|
|
44
|
+
"properties": {
|
|
45
|
+
"type": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"enum": ["oauth", "apikey"],
|
|
48
|
+
"description": "Auth strategy understood by OMP."
|
|
49
|
+
},
|
|
50
|
+
"credentialId": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Stored OAuth credential id from agent auth storage."
|
|
53
|
+
},
|
|
54
|
+
"tokenUrl": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"description": "Token endpoint persisted for refresh."
|
|
57
|
+
},
|
|
58
|
+
"clientId": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "OAuth client id persisted for refresh."
|
|
61
|
+
},
|
|
62
|
+
"clientSecret": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "OAuth client secret persisted for refresh."
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"oauthConfig": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"properties": {
|
|
72
|
+
"clientId": {
|
|
73
|
+
"type": "string"
|
|
74
|
+
},
|
|
75
|
+
"clientSecret": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
},
|
|
78
|
+
"redirectUri": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"callbackPort": {
|
|
82
|
+
"type": "integer",
|
|
83
|
+
"minimum": 1,
|
|
84
|
+
"maximum": 65535
|
|
85
|
+
},
|
|
86
|
+
"callbackPath": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"description": "Explicit OAuth client settings for servers that need them during /mcp reauth or initial connect."
|
|
91
|
+
},
|
|
92
|
+
"serverBase": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"enabled": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"description": "Whether OMP should try to connect this server."
|
|
98
|
+
},
|
|
99
|
+
"timeout": {
|
|
100
|
+
"type": "number",
|
|
101
|
+
"exclusiveMinimum": 0,
|
|
102
|
+
"description": "Connection timeout in milliseconds."
|
|
103
|
+
},
|
|
104
|
+
"auth": {
|
|
105
|
+
"$ref": "#/$defs/authConfig"
|
|
106
|
+
},
|
|
107
|
+
"oauth": {
|
|
108
|
+
"$ref": "#/$defs/oauthConfig"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"stdioServer": {
|
|
113
|
+
"allOf": [
|
|
114
|
+
{
|
|
115
|
+
"$ref": "#/$defs/serverBase"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"type": "object",
|
|
119
|
+
"additionalProperties": false,
|
|
120
|
+
"required": ["command"],
|
|
121
|
+
"properties": {
|
|
122
|
+
"type": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"enum": ["stdio"],
|
|
125
|
+
"description": "Default transport when omitted."
|
|
126
|
+
},
|
|
127
|
+
"command": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"minLength": 1,
|
|
130
|
+
"description": "Executable to spawn."
|
|
131
|
+
},
|
|
132
|
+
"args": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"items": {
|
|
135
|
+
"type": "string"
|
|
136
|
+
},
|
|
137
|
+
"description": "Arguments passed to the stdio server process."
|
|
138
|
+
},
|
|
139
|
+
"env": {
|
|
140
|
+
"$ref": "#/$defs/stringMap",
|
|
141
|
+
"description": "Environment variables passed to the stdio process."
|
|
142
|
+
},
|
|
143
|
+
"cwd": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"description": "Working directory used when spawning the stdio process."
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"not": {
|
|
149
|
+
"required": ["url"]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"httpServer": {
|
|
155
|
+
"allOf": [
|
|
156
|
+
{
|
|
157
|
+
"$ref": "#/$defs/serverBase"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"type": "object",
|
|
161
|
+
"additionalProperties": false,
|
|
162
|
+
"required": ["type", "url"],
|
|
163
|
+
"properties": {
|
|
164
|
+
"type": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"enum": ["http"],
|
|
167
|
+
"description": "Streamable HTTP transport."
|
|
168
|
+
},
|
|
169
|
+
"url": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"minLength": 1,
|
|
172
|
+
"description": "MCP endpoint URL."
|
|
173
|
+
},
|
|
174
|
+
"headers": {
|
|
175
|
+
"$ref": "#/$defs/stringMap",
|
|
176
|
+
"description": "HTTP headers sent with MCP requests."
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"not": {
|
|
180
|
+
"required": ["command"]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
"sseServer": {
|
|
186
|
+
"allOf": [
|
|
187
|
+
{
|
|
188
|
+
"$ref": "#/$defs/serverBase"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"type": "object",
|
|
192
|
+
"additionalProperties": false,
|
|
193
|
+
"required": ["type", "url"],
|
|
194
|
+
"properties": {
|
|
195
|
+
"type": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"enum": ["sse"],
|
|
198
|
+
"description": "Legacy SSE transport kept for compatibility. Prefer http for new configs."
|
|
199
|
+
},
|
|
200
|
+
"url": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"minLength": 1,
|
|
203
|
+
"description": "Legacy SSE endpoint URL."
|
|
204
|
+
},
|
|
205
|
+
"headers": {
|
|
206
|
+
"$ref": "#/$defs/stringMap",
|
|
207
|
+
"description": "HTTP headers sent with the SSE transport."
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"not": {
|
|
211
|
+
"required": ["command"]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
"serverConfig": {
|
|
217
|
+
"oneOf": [
|
|
218
|
+
{
|
|
219
|
+
"$ref": "#/$defs/stdioServer"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"$ref": "#/$defs/httpServer"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"$ref": "#/$defs/sseServer"
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -1440,10 +1440,17 @@ export class ModelRegistry {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
#applyHardcodedModelPolicies(models: Model<Api>[]): Model<Api>[] {
|
|
1442
1442
|
return models.map(model => {
|
|
1443
|
-
if (model.id
|
|
1444
|
-
return
|
|
1443
|
+
if (model.id !== "gpt-5.4" || model.provider === "github-copilot") {
|
|
1444
|
+
return model;
|
|
1445
|
+
}
|
|
1446
|
+
const overrides = this.#modelOverrides.get(model.provider)?.get(model.id);
|
|
1447
|
+
if (!overrides) {
|
|
1448
|
+
return applyModelOverride(model, { contextWindow: 1_000_000 });
|
|
1445
1449
|
}
|
|
1446
|
-
return model
|
|
1450
|
+
return applyModelOverride(model, {
|
|
1451
|
+
contextWindow: overrides.contextWindow ?? 1_000_000,
|
|
1452
|
+
...overrides,
|
|
1453
|
+
});
|
|
1447
1454
|
});
|
|
1448
1455
|
}
|
|
1449
1456
|
|
|
@@ -1217,6 +1217,16 @@ export const SETTINGS_SCHEMA = {
|
|
|
1217
1217
|
},
|
|
1218
1218
|
},
|
|
1219
1219
|
|
|
1220
|
+
"mcp.discoveryDefaultServers": {
|
|
1221
|
+
type: "array",
|
|
1222
|
+
default: [] as string[],
|
|
1223
|
+
ui: {
|
|
1224
|
+
tab: "tools",
|
|
1225
|
+
label: "MCP Discovery Default Servers",
|
|
1226
|
+
description: "Keep MCP tools from these servers visible while discovery mode hides other MCP tools",
|
|
1227
|
+
},
|
|
1228
|
+
},
|
|
1229
|
+
|
|
1220
1230
|
"mcp.notifications": {
|
|
1221
1231
|
type: "boolean",
|
|
1222
1232
|
default: false,
|
|
@@ -1511,6 +1521,8 @@ export const SETTINGS_SCHEMA = {
|
|
|
1511
1521
|
"thinkingBudgets.medium": { type: "number", default: 8192 },
|
|
1512
1522
|
|
|
1513
1523
|
"thinkingBudgets.high": { type: "number", default: 16384 },
|
|
1524
|
+
|
|
1525
|
+
"thinkingBudgets.xhigh": { type: "number", default: 32768 },
|
|
1514
1526
|
} as const;
|
|
1515
1527
|
|
|
1516
1528
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -1693,6 +1705,7 @@ export interface ThinkingBudgetsSettings {
|
|
|
1693
1705
|
low: number;
|
|
1694
1706
|
medium: number;
|
|
1695
1707
|
high: number;
|
|
1708
|
+
xhigh: number;
|
|
1696
1709
|
}
|
|
1697
1710
|
|
|
1698
1711
|
export interface SttSettings {
|
package/src/discovery/builtin.ts
CHANGED
|
@@ -158,6 +158,7 @@ async function loadMCPServers(ctx: LoadContext): Promise<LoadResult<MCPServer>>
|
|
|
158
158
|
command: serverConfig.command as string | undefined,
|
|
159
159
|
args: serverConfig.args as string[] | undefined,
|
|
160
160
|
env: serverConfig.env as Record<string, string> | undefined,
|
|
161
|
+
cwd: serverConfig.cwd as string | undefined,
|
|
161
162
|
url: serverConfig.url as string | undefined,
|
|
162
163
|
headers: serverConfig.headers as Record<string, string> | undefined,
|
|
163
164
|
auth: serverConfig.auth as
|
package/src/discovery/helpers.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as path from "node:path";
|
|
|
3
3
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
4
4
|
import { FileType, glob } from "@oh-my-pi/pi-natives";
|
|
5
5
|
import { CONFIG_DIR_NAME, getConfigDirName, tryParseJson } from "@oh-my-pi/pi-utils";
|
|
6
|
-
import { readFile } from "../capability/fs";
|
|
6
|
+
import { readDirEntries, readFile } from "../capability/fs";
|
|
7
7
|
import { parseRuleConditionAndScope, type Rule, type RuleFrontmatter } from "../capability/rule";
|
|
8
8
|
import type { Skill, SkillFrontmatter } from "../capability/skill";
|
|
9
9
|
import type { LoadContext, LoadResult, SourceMeta } from "../capability/types";
|
|
@@ -529,7 +529,14 @@ export async function discoverExtensionModulePaths(_ctx: LoadContext, dir: strin
|
|
|
529
529
|
subdirsWithDeclaredExtensions.add(subdir);
|
|
530
530
|
const subdirPath = path.join(dir, subdir);
|
|
531
531
|
for (const extPath of declaredExtensions) {
|
|
532
|
-
|
|
532
|
+
let resolvedExtPath = path.resolve(subdirPath, extPath);
|
|
533
|
+
const entries = await readDirEntries(resolvedExtPath);
|
|
534
|
+
if (entries.length !== 0) {
|
|
535
|
+
const pluginFilePath = entries.find(
|
|
536
|
+
e => e.isFile() && (e.name === "index.ts" || e.name === "index.js"),
|
|
537
|
+
)?.name;
|
|
538
|
+
resolvedExtPath = pluginFilePath ? path.join(resolvedExtPath, pluginFilePath) : resolvedExtPath;
|
|
539
|
+
}
|
|
533
540
|
const content = await readFile(resolvedExtPath);
|
|
534
541
|
if (content !== null) {
|
|
535
542
|
discovered.add(resolvedExtPath);
|
|
@@ -29,6 +29,7 @@ interface MCPConfigFile {
|
|
|
29
29
|
command?: string;
|
|
30
30
|
args?: string[];
|
|
31
31
|
env?: Record<string, string>;
|
|
32
|
+
cwd?: string;
|
|
32
33
|
url?: string;
|
|
33
34
|
headers?: Record<string, string>;
|
|
34
35
|
auth?: {
|
|
@@ -88,6 +89,7 @@ function transformMCPConfig(config: MCPConfigFile, source: SourceMeta): MCPServe
|
|
|
88
89
|
command: serverConfig.command,
|
|
89
90
|
args: serverConfig.args,
|
|
90
91
|
env: serverConfig.env,
|
|
92
|
+
cwd: serverConfig.cwd,
|
|
91
93
|
url: serverConfig.url,
|
|
92
94
|
headers: serverConfig.headers,
|
|
93
95
|
auth: serverConfig.auth,
|
|
@@ -100,6 +102,7 @@ function transformMCPConfig(config: MCPConfigFile, source: SourceMeta): MCPServe
|
|
|
100
102
|
if (server.command) server.command = expandEnvVarsDeep(server.command);
|
|
101
103
|
if (server.args) server.args = expandEnvVarsDeep(server.args);
|
|
102
104
|
if (server.env) server.env = expandEnvVarsDeep(server.env);
|
|
105
|
+
if (server.cwd) server.cwd = expandEnvVarsDeep(server.cwd);
|
|
103
106
|
if (server.url) server.url = expandEnvVarsDeep(server.url);
|
|
104
107
|
if (server.headers) server.headers = expandEnvVarsDeep(server.headers);
|
|
105
108
|
if (server.auth) server.auth = expandEnvVarsDeep(server.auth);
|
|
@@ -184,6 +184,10 @@ export interface CustomTool<TParams extends TSchema = TSchema, TDetails = any> {
|
|
|
184
184
|
hidden?: boolean;
|
|
185
185
|
/** If true, tool may stage deferred changes that require explicit resolve/discard. */
|
|
186
186
|
deferrable?: boolean;
|
|
187
|
+
/** MCP server name for discovery/search metadata when this tool fronts an MCP server. */
|
|
188
|
+
mcpServerName?: string;
|
|
189
|
+
/** Original MCP tool name for discovery/search metadata. */
|
|
190
|
+
mcpToolName?: string;
|
|
187
191
|
/**
|
|
188
192
|
* Execute the tool.
|
|
189
193
|
* @param toolCallId - Unique ID for this tool call
|
|
@@ -300,6 +300,10 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
|
|
|
300
300
|
hidden?: boolean;
|
|
301
301
|
/** If true, tool may stage deferred changes that require explicit resolve/discard. */
|
|
302
302
|
deferrable?: boolean;
|
|
303
|
+
/** MCP server name for discovery/search metadata when this tool fronts an MCP server. */
|
|
304
|
+
mcpServerName?: string;
|
|
305
|
+
/** Original MCP tool name for discovery/search metadata. */
|
|
306
|
+
mcpToolName?: string;
|
|
303
307
|
/** Execute the tool. */
|
|
304
308
|
execute(
|
|
305
309
|
toolCallId: string,
|