pi-repoprompt-mcp 0.7.1 → 0.7.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.
package/README.md
CHANGED
|
@@ -164,6 +164,7 @@ Create `~/.pi/agent/extensions/repoprompt-mcp.json`:
|
|
|
164
164
|
|
|
165
165
|
"confirmDeletes": true,
|
|
166
166
|
"confirmEdits": false,
|
|
167
|
+
"toolCallTimeoutMs": 5400000,
|
|
167
168
|
|
|
168
169
|
"readcacheReadFile": true,
|
|
169
170
|
"autoSelectReadSlices": true,
|
|
@@ -185,6 +186,7 @@ Options:
|
|
|
185
186
|
| `command` | auto-detect | MCP server command |
|
|
186
187
|
| `args` | `[]` | MCP server args |
|
|
187
188
|
| `env` | unset | Extra environment variables for the MCP server |
|
|
189
|
+
| `toolCallTimeoutMs` | `5400000` | MCP tool call timeout in milliseconds for RepoPrompt tools like `context_builder` and `oracle_send` (90 minutes by default) |
|
|
188
190
|
| `autoBindOnStart` | `true` | Auto-detect and bind on session start, then reconcile the branch-safe tab for the chosen window |
|
|
189
191
|
| `persistBinding` | `true` | Persist window and tab bindings in Pi session history for branch-safe replay |
|
|
190
192
|
| `confirmDeletes` | `true` | Block delete operations unless `allowDelete: true` |
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
4
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
5
|
+
import { DEFAULT_TOOL_CALL_TIMEOUT_MS } from "./types.js";
|
|
5
6
|
import type {
|
|
6
7
|
RpConnection,
|
|
7
8
|
RpToolMeta,
|
|
@@ -18,10 +19,6 @@ const CLIENT_INFO = {
|
|
|
18
19
|
const DEFAULT_CONNECT_TIMEOUT_MS = 6_000;
|
|
19
20
|
const DEFAULT_LIST_TOOLS_TIMEOUT_MS = 10_000;
|
|
20
21
|
|
|
21
|
-
// Keep parity with the rp-cli integration default (15 minutes). Some RepoPrompt tools
|
|
22
|
-
// (notably context_builder and chat_send) can legitimately take longer than 10s
|
|
23
|
-
const DEFAULT_TOOL_CALL_TIMEOUT_MS = 15 * 60 * 1000;
|
|
24
|
-
|
|
25
22
|
async function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T> {
|
|
26
23
|
let timeoutId: ReturnType<typeof setTimeout> | undefined;
|
|
27
24
|
|
|
@@ -51,6 +48,7 @@ export class RpClient {
|
|
|
51
48
|
private _status: ConnectionStatus = "disconnected";
|
|
52
49
|
private _tools: RpToolMeta[] = [];
|
|
53
50
|
private _error: string | undefined;
|
|
51
|
+
private toolCallTimeoutMs = DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
54
52
|
|
|
55
53
|
get status(): ConnectionStatus {
|
|
56
54
|
return this._status;
|
|
@@ -68,13 +66,18 @@ export class RpClient {
|
|
|
68
66
|
return this._status === "connected" && this.client !== null;
|
|
69
67
|
}
|
|
70
68
|
|
|
69
|
+
setToolCallTimeoutMs(timeoutMs: number): void {
|
|
70
|
+
this.toolCallTimeoutMs = timeoutMs;
|
|
71
|
+
}
|
|
72
|
+
|
|
71
73
|
/**
|
|
72
74
|
* Connect to the RepoPrompt MCP server
|
|
73
75
|
*/
|
|
74
76
|
async connect(
|
|
75
77
|
command: string,
|
|
76
78
|
args: string[],
|
|
77
|
-
env?: Record<string, string
|
|
79
|
+
env?: Record<string, string>,
|
|
80
|
+
toolCallTimeoutMs = DEFAULT_TOOL_CALL_TIMEOUT_MS
|
|
78
81
|
): Promise<void> {
|
|
79
82
|
if (this._status === "connecting") {
|
|
80
83
|
throw new Error("Connection already in progress");
|
|
@@ -85,6 +88,7 @@ export class RpClient {
|
|
|
85
88
|
|
|
86
89
|
this._status = "connecting";
|
|
87
90
|
this._error = undefined;
|
|
91
|
+
this.toolCallTimeoutMs = toolCallTimeoutMs;
|
|
88
92
|
|
|
89
93
|
try {
|
|
90
94
|
// Create transport
|
|
@@ -156,12 +160,14 @@ export class RpClient {
|
|
|
156
160
|
async callTool(
|
|
157
161
|
name: string,
|
|
158
162
|
args?: Record<string, unknown>,
|
|
159
|
-
timeoutMs
|
|
163
|
+
timeoutMs?: number
|
|
160
164
|
): Promise<McpToolResult> {
|
|
161
165
|
if (!this.client) {
|
|
162
166
|
throw new Error("Not connected to RepoPrompt MCP server");
|
|
163
167
|
}
|
|
164
168
|
|
|
169
|
+
const resolvedTimeoutMs = timeoutMs ?? this.toolCallTimeoutMs;
|
|
170
|
+
|
|
165
171
|
let result;
|
|
166
172
|
try {
|
|
167
173
|
result = await this.client.callTool(
|
|
@@ -170,7 +176,7 @@ export class RpClient {
|
|
|
170
176
|
arguments: args ?? {},
|
|
171
177
|
},
|
|
172
178
|
undefined,
|
|
173
|
-
{ timeout:
|
|
179
|
+
{ timeout: resolvedTimeoutMs }
|
|
174
180
|
);
|
|
175
181
|
} catch (error) {
|
|
176
182
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -4,7 +4,7 @@ import * as fs from "node:fs";
|
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import * as os from "node:os";
|
|
6
6
|
import { execFileSync } from "node:child_process";
|
|
7
|
-
import { DIFF_VIEW_MODES, type DiffViewMode, type RpConfig } from "./types.js";
|
|
7
|
+
import { DEFAULT_TOOL_CALL_TIMEOUT_MS, DIFF_VIEW_MODES, type DiffViewMode, type RpConfig } from "./types.js";
|
|
8
8
|
|
|
9
9
|
// Default configuration
|
|
10
10
|
const DEFAULT_CONFIG: RpConfig = {
|
|
@@ -12,6 +12,7 @@ const DEFAULT_CONFIG: RpConfig = {
|
|
|
12
12
|
persistBinding: true,
|
|
13
13
|
confirmDeletes: true,
|
|
14
14
|
confirmEdits: false,
|
|
15
|
+
toolCallTimeoutMs: DEFAULT_TOOL_CALL_TIMEOUT_MS,
|
|
15
16
|
collapsedMaxLines: 3,
|
|
16
17
|
diffViewMode: "auto",
|
|
17
18
|
diffSplitMinWidth: 120,
|
|
@@ -197,6 +198,12 @@ export function loadConfig(overrides?: Partial<RpConfig>): RpConfig {
|
|
|
197
198
|
config = { ...config, ...overrides };
|
|
198
199
|
}
|
|
199
200
|
|
|
201
|
+
config.toolCallTimeoutMs = clampNumber(
|
|
202
|
+
config.toolCallTimeoutMs,
|
|
203
|
+
1_000,
|
|
204
|
+
24 * 60 * 60 * 1000,
|
|
205
|
+
DEFAULT_TOOL_CALL_TIMEOUT_MS
|
|
206
|
+
);
|
|
200
207
|
config.diffViewMode = toDiffViewMode(config.diffViewMode);
|
|
201
208
|
config.diffSplitMinWidth = clampNumber(config.diffSplitMinWidth, 70, 240, DEFAULT_CONFIG.diffSplitMinWidth ?? 120);
|
|
202
209
|
|
|
@@ -569,6 +569,9 @@ export default function repopromptMcp(pi: ExtensionAPI) {
|
|
|
569
569
|
pi.on("before_agent_start", async () => {
|
|
570
570
|
// Reload config so display knobs (collapsedMaxLines etc.) apply without requiring /reload
|
|
571
571
|
config = loadConfig();
|
|
572
|
+
if (config.toolCallTimeoutMs !== undefined) {
|
|
573
|
+
getRpClient().setToolCallTimeoutMs(config.toolCallTimeoutMs);
|
|
574
|
+
}
|
|
572
575
|
});
|
|
573
576
|
|
|
574
577
|
// Replay-aware read_file caching state (optional; guarded by config.readcacheReadFile)
|
|
@@ -2008,15 +2011,19 @@ Mode priority: call > describe > search > windows > bind > status`,
|
|
|
2008
2011
|
await initPromise;
|
|
2009
2012
|
}
|
|
2010
2013
|
|
|
2014
|
+
// Reload config so connection/runtime knobs apply without requiring /reload
|
|
2015
|
+
config = loadConfig();
|
|
2016
|
+
|
|
2011
2017
|
const client = getRpClient();
|
|
2018
|
+
if (config.toolCallTimeoutMs !== undefined) {
|
|
2019
|
+
client.setToolCallTimeoutMs(config.toolCallTimeoutMs);
|
|
2020
|
+
}
|
|
2012
2021
|
if (client.isConnected) {
|
|
2013
2022
|
return;
|
|
2014
2023
|
}
|
|
2015
2024
|
|
|
2016
2025
|
// Lazy reconnect: allow the user to install/configure RepoPrompt after Pi starts
|
|
2017
2026
|
// and have `rp(...)` work without requiring a restart.
|
|
2018
|
-
config = loadConfig();
|
|
2019
|
-
|
|
2020
2027
|
const server = getServerCommand(config);
|
|
2021
2028
|
if (!server) {
|
|
2022
2029
|
throw new Error(
|
|
@@ -2024,7 +2031,7 @@ Mode priority: call > describe > search > windows > bind > status`,
|
|
|
2024
2031
|
);
|
|
2025
2032
|
}
|
|
2026
2033
|
|
|
2027
|
-
await client.connect(server.command, server.args, config.env);
|
|
2034
|
+
await client.connect(server.command, server.args, config.env, config.toolCallTimeoutMs);
|
|
2028
2035
|
|
|
2029
2036
|
if (ctx) {
|
|
2030
2037
|
try {
|
|
@@ -3151,7 +3158,7 @@ async function initializeExtension(
|
|
|
3151
3158
|
|
|
3152
3159
|
// Connect to RepoPrompt
|
|
3153
3160
|
const client = getRpClient();
|
|
3154
|
-
await client.connect(server.command, server.args, config.env);
|
|
3161
|
+
await client.connect(server.command, server.args, config.env, config.toolCallTimeoutMs);
|
|
3155
3162
|
|
|
3156
3163
|
// Notify connection
|
|
3157
3164
|
if (ctx.hasUI) {
|
|
@@ -95,25 +95,28 @@ export interface RpConnection {
|
|
|
95
95
|
export const DIFF_VIEW_MODES = ["auto", "split", "unified"] as const;
|
|
96
96
|
export type DiffViewMode = (typeof DIFF_VIEW_MODES)[number];
|
|
97
97
|
|
|
98
|
+
export const DEFAULT_TOOL_CALL_TIMEOUT_MS = 90 * 60 * 1000;
|
|
99
|
+
|
|
98
100
|
export interface RpConfig {
|
|
99
101
|
// Server connection
|
|
100
102
|
command?: string;
|
|
101
103
|
args?: string[];
|
|
102
104
|
env?: Record<string, string>;
|
|
103
|
-
|
|
105
|
+
toolCallTimeoutMs?: number; // MCP tool call timeout in ms (default: 5_400_000 / 90 minutes)
|
|
106
|
+
|
|
104
107
|
// Logging
|
|
105
108
|
suppressHostDisconnectedLog?: boolean; // Filter known-noisy shutdown log line (default: true)
|
|
106
|
-
|
|
109
|
+
|
|
107
110
|
// Behavior
|
|
108
111
|
autoBindOnStart?: boolean; // Auto-detect and bind to matching window (default: true)
|
|
109
112
|
persistBinding?: boolean; // Remember binding across session (default: true)
|
|
110
|
-
|
|
113
|
+
|
|
111
114
|
// Safety
|
|
112
115
|
confirmDeletes?: boolean; // Require confirmation for deletes (default: true)
|
|
113
116
|
confirmEdits?: boolean; // Require confirmation for edit-like operations (default: false)
|
|
114
|
-
|
|
117
|
+
|
|
115
118
|
// Display
|
|
116
|
-
collapsedMaxLines?: number; // Max lines in collapsed view (default:
|
|
119
|
+
collapsedMaxLines?: number; // Max lines in collapsed view (default: 3)
|
|
117
120
|
diffViewMode?: DiffViewMode; // Diff layout mode: auto, split, unified (default: auto)
|
|
118
121
|
diffSplitMinWidth?: number; // Minimum width before auto mode uses split diff layout (default: 120)
|
|
119
122
|
|
|
@@ -124,12 +127,12 @@ export interface RpConfig {
|
|
|
124
127
|
// (tracks read slices/full files so chat_send/"Oracle" has context without manual selection)
|
|
125
128
|
autoSelectReadSlices?: boolean; // When true, read_file calls add slices/full selection (default: true)
|
|
126
129
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
// App launch
|
|
131
|
+
autoLaunchApp?: boolean; // Auto-launch RepoPrompt.app on connection failure (default: false)
|
|
132
|
+
appPath?: string; // Explicit path to Repo Prompt.app (inferred from command if omitted)
|
|
130
133
|
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
// /rp oracle behavior
|
|
135
|
+
oracleDefaultMode?: "chat" | "plan" | "edit" | "review"; // Default mode when /rp oracle omits --mode (default: "chat")
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-repoprompt-mcp",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "A token-efficient RepoPrompt integration for Pi with automated and branch-safe workspace management",
|
|
5
5
|
"keywords": ["pi-package", "pi", "pi-coding-agent", "repoprompt", "mcp"],
|
|
6
6
|
"license": "MIT",
|