@oh-my-pi/pi-coding-agent 13.12.10 → 13.13.2

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/README.md +3 -1
  3. package/package.json +7 -7
  4. package/src/capability/mcp.ts +2 -0
  5. package/src/config/keybindings.ts +0 -4
  6. package/src/config/mcp-schema.json +230 -0
  7. package/src/config/settings-schema.ts +30 -1
  8. package/src/discovery/builtin.ts +1 -0
  9. package/src/discovery/mcp-json.ts +3 -0
  10. package/src/extensibility/custom-tools/types.ts +4 -0
  11. package/src/extensibility/extensions/types.ts +4 -0
  12. package/src/internal-urls/docs-index.generated.ts +2 -1
  13. package/src/main.ts +6 -0
  14. package/src/mcp/client.ts +46 -16
  15. package/src/mcp/config-writer.ts +9 -2
  16. package/src/mcp/config.ts +1 -0
  17. package/src/mcp/discoverable-tool-metadata.ts +10 -0
  18. package/src/mcp/manager.ts +28 -0
  19. package/src/mcp/transports/http.ts +148 -28
  20. package/src/mcp/transports/stdio.ts +62 -12
  21. package/src/mcp/types.ts +22 -1
  22. package/src/modes/components/custom-editor.ts +126 -71
  23. package/src/modes/controllers/command-controller.ts +3 -12
  24. package/src/modes/controllers/extension-ui-controller.ts +3 -1
  25. package/src/modes/controllers/input-controller.ts +36 -37
  26. package/src/modes/controllers/selector-controller.ts +11 -0
  27. package/src/modes/interactive-mode.ts +5 -12
  28. package/src/modes/utils/hotkeys-markdown.ts +24 -22
  29. package/src/patch/index.ts +25 -0
  30. package/src/sdk.ts +19 -2
  31. package/src/session/agent-session.ts +37 -5
  32. package/src/session/compaction/compaction.ts +1 -1
  33. package/src/system-prompt.ts +26 -14
  34. package/src/tools/auto-generated-guard.ts +310 -0
  35. package/src/tools/write.ts +33 -2
  36. package/src/utils/title-generator.ts +46 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [13.13.2] - 2026-03-18
6
+
7
+ ### Added
8
+
9
+ - 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
10
+ - Added `mcpServerName` and `mcpToolName` optional properties to custom tools for MCP server discovery and search metadata
11
+
12
+ ## [13.13.1] - 2026-03-18
13
+ ### Added
14
+
15
+ - Automatic deduplication of identical context files by content, keeping the closest (lowest depth) copy when duplicates are discovered
16
+
17
+ ## [13.13.0] - 2026-03-18
18
+
19
+ ### Added
20
+
21
+ - Added `edit.blockAutoGenerated` setting to control whether auto-generated file detection is enforced (enabled by default)
22
+ - Improved auto-generated file detection to use language-specific comment parsing instead of broad regex patterns, reducing false positives
23
+ - Added auto-generated file detection to prevent accidental modification of generated code (protoc, sqlc, buf, swagger, etc.)
24
+ - Added validation in Edit and Write tools to block modifications to files with auto-generated markers or naming patterns
25
+
26
+ ### Changed
27
+
28
+ - Enhanced auto-generated marker detection to only scan leading header comments rather than entire file prefix, improving accuracy for files with generated markers in code
29
+
5
30
  ## [13.12.10] - 2026-03-17
6
31
  ### Added
7
32
 
@@ -2201,7 +2226,7 @@
2201
2226
  - New `appendModeChange()` method in SessionManager to record mode transitions
2202
2227
  - New `mode` and `modeData` fields in SessionContext to track active agent mode
2203
2228
  - Support for `PI_PACKAGE_DIR` environment variable to override package directory (useful for Nix/Guix store paths)
2204
- - New keybindings for session management: `toggleSessionNamedFilter` (Ctrl+N), `newSession`, `tree`, `fork`, and `resume` actions
2229
+ - New keybindings for session management: `newSession`, `tree`, `fork`, and `resume` actions
2205
2230
  - Support for shell command execution in configuration values (API keys, headers) using `!` prefix, with result caching
2206
2231
  - New `clearOnShrink` display setting to control whether empty rows are cleared when content shrinks
2207
2232
  - 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
- - [Documentation](./docs/)
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.12.10",
4
+ "version": "13.13.2",
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.12.10",
45
- "@oh-my-pi/pi-agent-core": "13.12.10",
46
- "@oh-my-pi/pi-ai": "13.12.10",
47
- "@oh-my-pi/pi-natives": "13.12.10",
48
- "@oh-my-pi/pi-tui": "13.12.10",
49
- "@oh-my-pi/pi-utils": "13.12.10",
44
+ "@oh-my-pi/omp-stats": "13.13.2",
45
+ "@oh-my-pi/pi-agent-core": "13.13.2",
46
+ "@oh-my-pi/pi-ai": "13.13.2",
47
+ "@oh-my-pi/pi-natives": "13.13.2",
48
+ "@oh-my-pi/pi-tui": "13.13.2",
49
+ "@oh-my-pi/pi-utils": "13.13.2",
50
50
  "@sinclair/typebox": "^0.34",
51
51
  "@xterm/headless": "^6.0",
52
52
  "ajv": "^8.18",
@@ -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
+ }
@@ -549,6 +549,16 @@ export const SETTINGS_SCHEMA = {
549
549
  },
550
550
  },
551
551
 
552
+ "startup.checkUpdate": {
553
+ type: "boolean",
554
+ default: true,
555
+ ui: {
556
+ tab: "interaction",
557
+ label: "Check for Updates",
558
+ description: "If false, skip update check",
559
+ },
560
+ },
561
+
552
562
  collapseChangelog: {
553
563
  type: "boolean",
554
564
  default: false,
@@ -849,7 +859,16 @@ export const SETTINGS_SCHEMA = {
849
859
  },
850
860
  },
851
861
 
852
- // Read tool
862
+ "edit.blockAutoGenerated": {
863
+ type: "boolean",
864
+ default: true,
865
+ ui: {
866
+ tab: "editing",
867
+ label: "Block Auto-Generated Files",
868
+ description: "Prevent editing of files that appear to be auto-generated (protoc, sqlc, swagger, etc.)",
869
+ },
870
+ },
871
+
853
872
  readLineNumbers: {
854
873
  type: "boolean",
855
874
  default: false,
@@ -1198,6 +1217,16 @@ export const SETTINGS_SCHEMA = {
1198
1217
  },
1199
1218
  },
1200
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
+
1201
1230
  "mcp.notifications": {
1202
1231
  type: "boolean",
1203
1232
  default: false,
@@ -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
@@ -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,