pi-cursor-bridge 0.1.0 → 0.1.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.
@@ -4,12 +4,25 @@ import { fileURLToPath } from "node:url";
4
4
  import { createStdioMcpExtension } from "./mcp-stdio.ts";
5
5
 
6
6
  const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
7
+ const hostCwd = resolve(process.cwd());
8
+ const hostWorkspaceId = hostCwd.replace(/\\/g, "/").toLowerCase();
7
9
 
8
10
  export default createStdioMcpExtension({
9
11
  label: "Cursor Bridge",
10
12
  clientName: "pi-cursor-bridge",
11
- packageVersion: "0.1.0",
13
+ packageVersion: "0.1.2",
12
14
  serverName: "cursor-bridge",
13
15
  serverScript: join(packageRoot, "dist", "cursor-bridge.mjs"),
14
- cwd: packageRoot,
16
+ cwd: hostCwd,
17
+ env: {
18
+ // A Pi process can be launched from Codex or Claude Code during testing.
19
+ // Do not let inherited host variables steal Pi's workspace identity.
20
+ CODEX_THREAD_ID: undefined,
21
+ CLAUDE_PROJECT_DIR: undefined,
22
+ CLAUDE_CODE_PROJECT_DIR: undefined,
23
+ CLAUDE_CODE_SESSION_ID: undefined,
24
+ CLAUDE_SESSION_ID: undefined,
25
+ CURSOR_BRIDGE_HOST_ID: `pi:${hostWorkspaceId}`,
26
+ CURSOR_PROJECT_PATH: hostCwd,
27
+ },
15
28
  });
@@ -3,6 +3,8 @@ import { existsSync } from "node:fs";
3
3
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
4
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
5
5
 
6
+ const DEFAULT_TOOL_TIMEOUT_MS = 15 * 60 * 1000;
7
+
6
8
  function stringEnvironment(extra = {}) {
7
9
  return Object.fromEntries(
8
10
  Object.entries({ ...process.env, ...extra })
@@ -33,6 +35,9 @@ export function createStdioMcpExtension(options) {
33
35
  { name: options.clientName, version: options.packageVersion },
34
36
  { capabilities: {} },
35
37
  );
38
+ const toolTimeoutMs = Number.isInteger(options.toolTimeoutMs) && options.toolTimeoutMs > 0
39
+ ? options.toolTimeoutMs
40
+ : DEFAULT_TOOL_TIMEOUT_MS;
36
41
  const transport = new StdioClientTransport({
37
42
  command: options.nodeCommand || "node",
38
43
  args: [options.serverScript],
@@ -55,7 +60,11 @@ export function createStdioMcpExtension(options) {
55
60
  const result = await client.callTool(
56
61
  { name: tool.name, arguments: params || {} },
57
62
  undefined,
58
- { signal },
63
+ {
64
+ signal,
65
+ timeout: toolTimeoutMs,
66
+ maxTotalTimeout: toolTimeoutMs,
67
+ },
59
68
  );
60
69
  return {
61
70
  content: toolContent(result),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cursor-bridge",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Use Cursor Context Engine and bounded Cursor Agent execution from the Pi coding agent.",
5
5
  "type": "module",
6
6
  "license": "MIT",