@rama_nigg/open-cursor 2.1.3 → 2.1.5

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
@@ -15,17 +15,9 @@ No prompt limits. No broken streams. Full thinking + tool support in Opencode. Y
15
15
  curl -fsSL https://raw.githubusercontent.com/Nomadcxx/opencode-cursor/main/install.sh | bash
16
16
  ```
17
17
 
18
- Note: if `npm` is available, `install.sh` installs/upgrades `@rama_nigg/open-cursor` and runs `open-cursor install`. Otherwise it falls back to building from source.
18
+ Note: if `npm` is available, `install.sh` installs/upgrades `@rama_nigg/open-cursor` and configures OpenCode automatically. Otherwise it falls back to building from source.
19
19
 
20
- **Option B: npm Package (Use when published)**
21
-
22
- Check whether the package is available on npm first:
23
-
24
- ```bash
25
- npm view @rama_nigg/open-cursor version
26
- ```
27
-
28
- If that returns a version, install with:
20
+ **Option B: npm Package (Recommended)**
29
21
 
30
22
  ```bash
31
23
  npm install -g @rama_nigg/open-cursor
@@ -39,8 +31,6 @@ npm update -g @rama_nigg/open-cursor
39
31
  open-cursor sync-models
40
32
  ```
41
33
 
42
- If `npm view` returns `404 Not Found`, the release has not been published yet. Use Option A, C, or E.
43
-
44
34
  **Option C: TUI Installer**
45
35
 
46
36
  ```bash
@@ -56,32 +46,28 @@ Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
56
46
  ```
57
47
  Install the cursor-acp plugin for OpenCode:
58
48
 
59
- 1. Clone and build:
49
+ 1. Preferred install (npm):
50
+ npm install -g @rama_nigg/open-cursor
51
+ open-cursor install
52
+
53
+ 2. Fallback (build from source):
60
54
  git clone https://github.com/Nomadcxx/opencode-cursor.git
61
55
  cd opencode-cursor
62
56
  bun install && bun run build
63
-
64
- 2. Create plugin symlink:
65
57
  mkdir -p ~/.config/opencode/plugin
66
58
  ln -sf $(pwd)/dist/plugin-entry.js ~/.config/opencode/plugin/cursor-acp.js
59
+ ./scripts/sync-models.sh
67
60
 
68
- 3. Get available models:
69
- cursor-agent models
70
-
71
- 4. Add to ~/.config/opencode/opencode.json - merge with existing config:
72
- - Add "cursor-acp" to the "plugin" array
73
- - Add a "cursor-acp" provider with models from step 3
74
- - Set npm to "@ai-sdk/openai-compatible"
75
- - Set options.baseURL to "http://127.0.0.1:32124/v1"
76
-
77
- 5. Verify: opencode models | grep cursor
61
+ 3. Verify:
62
+ opencode models | grep cursor-acp
78
63
  ```
79
64
 
80
65
  **Option E: Manual Install**
81
66
 
82
67
  ```bash
83
68
  bun install && bun run build
84
- ln -s $(pwd)/dist/plugin-entry.js ~/.config/opencode/plugin/cursor-acp.js
69
+ mkdir -p ~/.config/opencode/plugin
70
+ ln -sf $(pwd)/dist/plugin-entry.js ~/.config/opencode/plugin/cursor-acp.js
85
71
  ```
86
72
 
87
73
  The installers handle the rest automatically. If you're doing a manual install, you'll need to do the following steps yourself.
@@ -92,7 +78,7 @@ Easiest way is to run the sync script, which populates everything for you:
92
78
  ./scripts/sync-models.sh
93
79
  ```
94
80
 
95
- Or if you'd rather do it by hand, add this to `~/.config/opencode/opencode.json`:
81
+ Or if you'd rather do it by hand, add this to `~/.config/opencode/opencode.json` (then run `./scripts/sync-models.sh` to populate models):
96
82
 
97
83
  ```json
98
84
  {
@@ -103,39 +89,7 @@ Or if you'd rather do it by hand, add this to `~/.config/opencode/opencode.json`
103
89
  "npm": "@ai-sdk/openai-compatible",
104
90
  "options": { "baseURL": "http://127.0.0.1:32124/v1" },
105
91
  "models": {
106
- "auto": { "name": "Auto" },
107
- "composer-1.5": { "name": "Composer 1.5" },
108
- "composer-1": { "name": "Composer 1" },
109
- "gpt-5.3-codex": { "name": "GPT-5.3 Codex" },
110
- "gpt-5.3-codex-low": { "name": "GPT-5.3 Codex Low" },
111
- "gpt-5.3-codex-high": { "name": "GPT-5.3 Codex High" },
112
- "gpt-5.3-codex-xhigh": { "name": "GPT-5.3 Codex Extra High" },
113
- "gpt-5.3-codex-fast": { "name": "GPT-5.3 Codex Fast" },
114
- "gpt-5.3-codex-low-fast": { "name": "GPT-5.3 Codex Low Fast" },
115
- "gpt-5.3-codex-high-fast": { "name": "GPT-5.3 Codex High Fast" },
116
- "gpt-5.3-codex-xhigh-fast": { "name": "GPT-5.3 Codex Extra High Fast" },
117
- "gpt-5.2": { "name": "GPT-5.2" },
118
- "gpt-5.2-codex": { "name": "GPT-5.2 Codex" },
119
- "gpt-5.2-codex-high": { "name": "GPT-5.2 Codex High" },
120
- "gpt-5.2-codex-low": { "name": "GPT-5.2 Codex Low" },
121
- "gpt-5.2-codex-xhigh": { "name": "GPT-5.2 Codex Extra High" },
122
- "gpt-5.2-codex-fast": { "name": "GPT-5.2 Codex Fast" },
123
- "gpt-5.2-codex-high-fast": { "name": "GPT-5.2 Codex High Fast" },
124
- "gpt-5.2-codex-low-fast": { "name": "GPT-5.2 Codex Low Fast" },
125
- "gpt-5.2-codex-xhigh-fast": { "name": "GPT-5.2 Codex Extra High Fast" },
126
- "gpt-5.1-codex-max": { "name": "GPT-5.1 Codex Max" },
127
- "gpt-5.1-codex-max-high": { "name": "GPT-5.1 Codex Max High" },
128
- "opus-4.6-thinking": { "name": "Claude 4.6 Opus (Thinking)" },
129
- "sonnet-4.5-thinking": { "name": "Claude 4.5 Sonnet (Thinking)" },
130
- "gpt-5.2-high": { "name": "GPT-5.2 High" },
131
- "opus-4.6": { "name": "Claude 4.6 Opus" },
132
- "opus-4.5": { "name": "Claude 4.5 Opus" },
133
- "opus-4.5-thinking": { "name": "Claude 4.5 Opus (Thinking)" },
134
- "sonnet-4.5": { "name": "Claude 4.5 Sonnet" },
135
- "gpt-5.1-high": { "name": "GPT-5.1 High" },
136
- "gemini-3-pro": { "name": "Gemini 3 Pro" },
137
- "gemini-3-flash": { "name": "Gemini 3 Flash" },
138
- "grok": { "name": "Grok" }
92
+ "auto": { "name": "Auto" }
139
93
  }
140
94
  }
141
95
  }
@@ -186,7 +140,13 @@ open-cursor sync-models
186
140
 
187
141
  ## Models
188
142
 
189
- Models are pulled from `cursor-agent models` and written to your config during installation. If Cursor adds new models later, re-run:
143
+ Models are pulled from `cursor-agent models` and written to your config during installation. If Cursor adds new models later:
144
+
145
+ ```bash
146
+ open-cursor sync-models
147
+ ```
148
+
149
+ Or, if you installed from source (no npm CLI):
190
150
 
191
151
  ```bash
192
152
  ./scripts/sync-models.sh
@@ -131,7 +131,7 @@ import {
131
131
  writeFileSync
132
132
  } from "fs";
133
133
  import { homedir } from "os";
134
- import { dirname, join, resolve } from "path";
134
+ import { basename, dirname, join, resolve } from "path";
135
135
  import { fileURLToPath } from "url";
136
136
 
137
137
  // src/cli/model-discovery.ts
@@ -180,14 +180,15 @@ function fallbackModels() {
180
180
  var PROVIDER_ID = "cursor-acp";
181
181
  var DEFAULT_BASE_URL = "http://127.0.0.1:32124/v1";
182
182
  function printHelp() {
183
- console.log(`opencode-cursor
183
+ const binName = basename(process.argv[1] || "open-cursor");
184
+ console.log(`${binName}
184
185
 
185
186
  Usage:
186
- opencode-cursor install [--config <path>] [--plugin-dir <path>] [--base-url <url>] [--copy] [--skip-models] [--no-backup]
187
- opencode-cursor sync-models [--config <path>] [--no-backup]
188
- opencode-cursor uninstall [--config <path>] [--plugin-dir <path>] [--no-backup]
189
- opencode-cursor status [--config <path>] [--plugin-dir <path>]
190
- opencode-cursor help
187
+ ${binName} install [--config <path>] [--plugin-dir <path>] [--base-url <url>] [--copy] [--skip-models] [--no-backup]
188
+ ${binName} sync-models [--config <path>] [--no-backup]
189
+ ${binName} uninstall [--config <path>] [--plugin-dir <path>] [--no-backup]
190
+ ${binName} status [--config <path>] [--plugin-dir <path>]
191
+ ${binName} help
191
192
  `);
192
193
  }
193
194
  function parseArgs(argv) {
package/dist/index.js CHANGED
@@ -17478,6 +17478,31 @@ async function ensurePluginDirectory() {
17478
17478
  function getGlobalKey() {
17479
17479
  return "__opencode_cursor_proxy_server__";
17480
17480
  }
17481
+ function resolveWorkspaceDirectory(worktree, directory) {
17482
+ const envWorkspace = process.env.CURSOR_ACP_WORKSPACE?.trim();
17483
+ if (envWorkspace) {
17484
+ return resolve(envWorkspace);
17485
+ }
17486
+ const envProjectDir = process.env.OPENCODE_CURSOR_PROJECT_DIR?.trim();
17487
+ if (envProjectDir) {
17488
+ return resolve(envProjectDir);
17489
+ }
17490
+ const configHome = process.env.XDG_CONFIG_HOME ? resolve(process.env.XDG_CONFIG_HOME) : join2(homedir2(), ".config");
17491
+ const configPrefix = join2(configHome, "opencode");
17492
+ const worktreeCandidate = worktree ? resolve(worktree) : "";
17493
+ if (worktreeCandidate && !worktreeCandidate.startsWith(configPrefix)) {
17494
+ return worktreeCandidate;
17495
+ }
17496
+ const dirCandidate = directory ? resolve(directory) : "";
17497
+ if (dirCandidate && !dirCandidate.startsWith(configPrefix)) {
17498
+ return dirCandidate;
17499
+ }
17500
+ const cwd = process.cwd();
17501
+ if (cwd && !cwd.startsWith(configPrefix)) {
17502
+ return cwd;
17503
+ }
17504
+ return dirCandidate || cwd || configPrefix;
17505
+ }
17481
17506
  function parseToolLoopMode(value) {
17482
17507
  const normalized = (value ?? "opencode").trim().toLowerCase();
17483
17508
  if (normalized === "opencode" || normalized === "proxy-exec" || normalized === "off") {
@@ -18559,14 +18584,19 @@ function jsonSchemaToZod(jsonSchema) {
18559
18584
  }
18560
18585
  return zodShape;
18561
18586
  }
18562
- function resolveToolContextBaseDir(context) {
18563
- const candidates = [context?.worktree, context?.directory];
18564
- for (const candidate of candidates) {
18565
- if (typeof candidate === "string" && candidate.trim().length > 0) {
18566
- return candidate;
18567
- }
18568
- }
18569
- return null;
18587
+ function resolveToolContextBaseDir(context, fallbackBaseDir) {
18588
+ const configHome = process.env.XDG_CONFIG_HOME ? resolve(process.env.XDG_CONFIG_HOME) : join2(homedir2(), ".config");
18589
+ const configPrefix = join2(configHome, "opencode");
18590
+ const worktree = typeof context?.worktree === "string" ? context.worktree.trim() : "";
18591
+ if (worktree)
18592
+ return worktree;
18593
+ const directory = typeof context?.directory === "string" ? context.directory.trim() : "";
18594
+ if (directory && !resolve(directory).startsWith(configPrefix))
18595
+ return directory;
18596
+ const fallback = typeof fallbackBaseDir === "string" ? fallbackBaseDir.trim() : "";
18597
+ if (fallback)
18598
+ return fallback;
18599
+ return directory || null;
18570
18600
  }
18571
18601
  function toAbsoluteWithBase(value, baseDir) {
18572
18602
  if (typeof value !== "string") {
@@ -18578,8 +18608,8 @@ function toAbsoluteWithBase(value, baseDir) {
18578
18608
  }
18579
18609
  return resolve(baseDir, trimmed);
18580
18610
  }
18581
- function applyToolContextDefaults(toolName, rawArgs, context) {
18582
- const baseDir = resolveToolContextBaseDir(context);
18611
+ function applyToolContextDefaults(toolName, rawArgs, context, fallbackBaseDir) {
18612
+ const baseDir = resolveToolContextBaseDir(context, fallbackBaseDir);
18583
18613
  if (!baseDir) {
18584
18614
  return rawArgs;
18585
18615
  }
@@ -18606,7 +18636,7 @@ function applyToolContextDefaults(toolName, rawArgs, context) {
18606
18636
  }
18607
18637
  return args;
18608
18638
  }
18609
- function buildToolHookEntries(registry2) {
18639
+ function buildToolHookEntries(registry2, fallbackBaseDir) {
18610
18640
  const entries = {};
18611
18641
  const tools = registry2.list();
18612
18642
  for (const t of tools) {
@@ -18619,7 +18649,7 @@ function buildToolHookEntries(registry2) {
18619
18649
  args: zodArgs,
18620
18650
  async execute(args, context) {
18621
18651
  try {
18622
- const normalizedArgs = applyToolContextDefaults(toolName, args, context);
18652
+ const normalizedArgs = applyToolContextDefaults(toolName, args, context, fallbackBaseDir);
18623
18653
  return await handler(normalizedArgs);
18624
18654
  } catch (error45) {
18625
18655
  log13.warn("Tool hook execution failed", { tool: toolName, error: String(error45?.message || error45) });
@@ -18634,8 +18664,15 @@ function buildToolHookEntries(registry2) {
18634
18664
  }
18635
18665
  return entries;
18636
18666
  }
18637
- var log13, CURSOR_PROVIDER_ID = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1", CURSOR_PROXY_DEFAULT_PORT = 32124, CURSOR_PROXY_DEFAULT_BASE_URL, REUSE_EXISTING_PROXY, FORCE_TOOL_MODE, EMIT_TOOL_UPDATES, FORWARD_TOOL_CALLS, TOOL_LOOP_MODE_RAW, TOOL_LOOP_MODE, TOOL_LOOP_MODE_VALID, PROVIDER_BOUNDARY_MODE_RAW, PROVIDER_BOUNDARY_MODE, PROVIDER_BOUNDARY_MODE_VALID, LEGACY_PROVIDER_BOUNDARY, PROVIDER_BOUNDARY, ENABLE_PROVIDER_BOUNDARY_AUTOFALLBACK, TOOL_LOOP_MAX_REPEAT_RAW, TOOL_LOOP_MAX_REPEAT, TOOL_LOOP_MAX_REPEAT_VALID, PROXY_EXECUTE_TOOL_CALLS, SUPPRESS_CONVERTER_TOOL_EVENTS, SHOULD_EMIT_TOOL_UPDATES, CursorPlugin = async ({ $, directory, client: client3, serverUrl }) => {
18638
- log13.debug("Plugin initializing", { directory, serverUrl: serverUrl?.toString() });
18667
+ var log13, CURSOR_PROVIDER_ID = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1", CURSOR_PROXY_DEFAULT_PORT = 32124, CURSOR_PROXY_DEFAULT_BASE_URL, REUSE_EXISTING_PROXY, FORCE_TOOL_MODE, EMIT_TOOL_UPDATES, FORWARD_TOOL_CALLS, TOOL_LOOP_MODE_RAW, TOOL_LOOP_MODE, TOOL_LOOP_MODE_VALID, PROVIDER_BOUNDARY_MODE_RAW, PROVIDER_BOUNDARY_MODE, PROVIDER_BOUNDARY_MODE_VALID, LEGACY_PROVIDER_BOUNDARY, PROVIDER_BOUNDARY, ENABLE_PROVIDER_BOUNDARY_AUTOFALLBACK, TOOL_LOOP_MAX_REPEAT_RAW, TOOL_LOOP_MAX_REPEAT, TOOL_LOOP_MAX_REPEAT_VALID, PROXY_EXECUTE_TOOL_CALLS, SUPPRESS_CONVERTER_TOOL_EVENTS, SHOULD_EMIT_TOOL_UPDATES, CursorPlugin = async ({ $, directory, worktree, client: client3, serverUrl }) => {
18668
+ const workspaceDirectory = resolveWorkspaceDirectory(worktree, directory);
18669
+ log13.debug("Plugin initializing", {
18670
+ directory,
18671
+ worktree,
18672
+ workspaceDirectory,
18673
+ cwd: process.cwd(),
18674
+ serverUrl: serverUrl?.toString()
18675
+ });
18639
18676
  if (!TOOL_LOOP_MODE_VALID) {
18640
18677
  log13.warn("Invalid CURSOR_ACP_TOOL_LOOP_MODE; defaulting to opencode", { value: TOOL_LOOP_MODE_RAW });
18641
18678
  }
@@ -18667,7 +18704,7 @@ var log13, CURSOR_PROVIDER_ID = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1", C
18667
18704
  } else if (toolsEnabled && TOOL_LOOP_MODE === "off") {
18668
18705
  log13.debug("Tool loop mode off; proxy-side tool execution disabled");
18669
18706
  }
18670
- const serverClient = legacyProxyToolPathsEnabled ? createOpencodeClient({ baseUrl: serverUrl.toString(), directory }) : null;
18707
+ const serverClient = legacyProxyToolPathsEnabled ? createOpencodeClient({ baseUrl: serverUrl.toString(), directory: workspaceDirectory }) : null;
18671
18708
  const discovery = legacyProxyToolPathsEnabled ? new OpenCodeToolDiscovery(serverClient ?? client3) : null;
18672
18709
  const localRegistry = new ToolRegistry;
18673
18710
  registerDefaultTools(localRegistry);
@@ -18750,9 +18787,9 @@ var log13, CURSOR_PROVIDER_ID = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1", C
18750
18787
  log13.debug("Tools refreshed", { local: localTools.length, discovered: discoveredList.length, total: toolEntries.length });
18751
18788
  return toolEntries;
18752
18789
  }
18753
- const proxyBaseURL = await ensureCursorProxyServer(directory, router);
18790
+ const proxyBaseURL = await ensureCursorProxyServer(workspaceDirectory, router);
18754
18791
  log13.debug("Proxy server started", { baseURL: proxyBaseURL });
18755
- const toolHookEntries = buildToolHookEntries(localRegistry);
18792
+ const toolHookEntries = buildToolHookEntries(localRegistry, workspaceDirectory);
18756
18793
  return {
18757
18794
  tool: toolHookEntries,
18758
18795
  auth: {
@@ -17478,6 +17478,31 @@ async function ensurePluginDirectory() {
17478
17478
  function getGlobalKey() {
17479
17479
  return "__opencode_cursor_proxy_server__";
17480
17480
  }
17481
+ function resolveWorkspaceDirectory(worktree, directory) {
17482
+ const envWorkspace = process.env.CURSOR_ACP_WORKSPACE?.trim();
17483
+ if (envWorkspace) {
17484
+ return resolve2(envWorkspace);
17485
+ }
17486
+ const envProjectDir = process.env.OPENCODE_CURSOR_PROJECT_DIR?.trim();
17487
+ if (envProjectDir) {
17488
+ return resolve2(envProjectDir);
17489
+ }
17490
+ const configHome = process.env.XDG_CONFIG_HOME ? resolve2(process.env.XDG_CONFIG_HOME) : join3(homedir3(), ".config");
17491
+ const configPrefix = join3(configHome, "opencode");
17492
+ const worktreeCandidate = worktree ? resolve2(worktree) : "";
17493
+ if (worktreeCandidate && !worktreeCandidate.startsWith(configPrefix)) {
17494
+ return worktreeCandidate;
17495
+ }
17496
+ const dirCandidate = directory ? resolve2(directory) : "";
17497
+ if (dirCandidate && !dirCandidate.startsWith(configPrefix)) {
17498
+ return dirCandidate;
17499
+ }
17500
+ const cwd = process.cwd();
17501
+ if (cwd && !cwd.startsWith(configPrefix)) {
17502
+ return cwd;
17503
+ }
17504
+ return dirCandidate || cwd || configPrefix;
17505
+ }
17481
17506
  function parseToolLoopMode(value) {
17482
17507
  const normalized = (value ?? "opencode").trim().toLowerCase();
17483
17508
  if (normalized === "opencode" || normalized === "proxy-exec" || normalized === "off") {
@@ -18559,14 +18584,19 @@ function jsonSchemaToZod(jsonSchema) {
18559
18584
  }
18560
18585
  return zodShape;
18561
18586
  }
18562
- function resolveToolContextBaseDir(context) {
18563
- const candidates = [context?.worktree, context?.directory];
18564
- for (const candidate of candidates) {
18565
- if (typeof candidate === "string" && candidate.trim().length > 0) {
18566
- return candidate;
18567
- }
18568
- }
18569
- return null;
18587
+ function resolveToolContextBaseDir(context, fallbackBaseDir) {
18588
+ const configHome = process.env.XDG_CONFIG_HOME ? resolve2(process.env.XDG_CONFIG_HOME) : join3(homedir3(), ".config");
18589
+ const configPrefix = join3(configHome, "opencode");
18590
+ const worktree = typeof context?.worktree === "string" ? context.worktree.trim() : "";
18591
+ if (worktree)
18592
+ return worktree;
18593
+ const directory = typeof context?.directory === "string" ? context.directory.trim() : "";
18594
+ if (directory && !resolve2(directory).startsWith(configPrefix))
18595
+ return directory;
18596
+ const fallback = typeof fallbackBaseDir === "string" ? fallbackBaseDir.trim() : "";
18597
+ if (fallback)
18598
+ return fallback;
18599
+ return directory || null;
18570
18600
  }
18571
18601
  function toAbsoluteWithBase(value, baseDir) {
18572
18602
  if (typeof value !== "string") {
@@ -18578,8 +18608,8 @@ function toAbsoluteWithBase(value, baseDir) {
18578
18608
  }
18579
18609
  return resolve2(baseDir, trimmed);
18580
18610
  }
18581
- function applyToolContextDefaults(toolName, rawArgs, context) {
18582
- const baseDir = resolveToolContextBaseDir(context);
18611
+ function applyToolContextDefaults(toolName, rawArgs, context, fallbackBaseDir) {
18612
+ const baseDir = resolveToolContextBaseDir(context, fallbackBaseDir);
18583
18613
  if (!baseDir) {
18584
18614
  return rawArgs;
18585
18615
  }
@@ -18606,7 +18636,7 @@ function applyToolContextDefaults(toolName, rawArgs, context) {
18606
18636
  }
18607
18637
  return args;
18608
18638
  }
18609
- function buildToolHookEntries(registry2) {
18639
+ function buildToolHookEntries(registry2, fallbackBaseDir) {
18610
18640
  const entries = {};
18611
18641
  const tools = registry2.list();
18612
18642
  for (const t of tools) {
@@ -18619,7 +18649,7 @@ function buildToolHookEntries(registry2) {
18619
18649
  args: zodArgs,
18620
18650
  async execute(args, context) {
18621
18651
  try {
18622
- const normalizedArgs = applyToolContextDefaults(toolName, args, context);
18652
+ const normalizedArgs = applyToolContextDefaults(toolName, args, context, fallbackBaseDir);
18623
18653
  return await handler(normalizedArgs);
18624
18654
  } catch (error45) {
18625
18655
  log13.warn("Tool hook execution failed", { tool: toolName, error: String(error45?.message || error45) });
@@ -18634,8 +18664,15 @@ function buildToolHookEntries(registry2) {
18634
18664
  }
18635
18665
  return entries;
18636
18666
  }
18637
- var log13, CURSOR_PROVIDER_ID2 = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1", CURSOR_PROXY_DEFAULT_PORT = 32124, CURSOR_PROXY_DEFAULT_BASE_URL, REUSE_EXISTING_PROXY, FORCE_TOOL_MODE, EMIT_TOOL_UPDATES, FORWARD_TOOL_CALLS, TOOL_LOOP_MODE_RAW, TOOL_LOOP_MODE, TOOL_LOOP_MODE_VALID, PROVIDER_BOUNDARY_MODE_RAW, PROVIDER_BOUNDARY_MODE, PROVIDER_BOUNDARY_MODE_VALID, LEGACY_PROVIDER_BOUNDARY, PROVIDER_BOUNDARY, ENABLE_PROVIDER_BOUNDARY_AUTOFALLBACK, TOOL_LOOP_MAX_REPEAT_RAW, TOOL_LOOP_MAX_REPEAT, TOOL_LOOP_MAX_REPEAT_VALID, PROXY_EXECUTE_TOOL_CALLS, SUPPRESS_CONVERTER_TOOL_EVENTS, SHOULD_EMIT_TOOL_UPDATES, CursorPlugin = async ({ $, directory, client: client3, serverUrl }) => {
18638
- log13.debug("Plugin initializing", { directory, serverUrl: serverUrl?.toString() });
18667
+ var log13, CURSOR_PROVIDER_ID2 = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1", CURSOR_PROXY_DEFAULT_PORT = 32124, CURSOR_PROXY_DEFAULT_BASE_URL, REUSE_EXISTING_PROXY, FORCE_TOOL_MODE, EMIT_TOOL_UPDATES, FORWARD_TOOL_CALLS, TOOL_LOOP_MODE_RAW, TOOL_LOOP_MODE, TOOL_LOOP_MODE_VALID, PROVIDER_BOUNDARY_MODE_RAW, PROVIDER_BOUNDARY_MODE, PROVIDER_BOUNDARY_MODE_VALID, LEGACY_PROVIDER_BOUNDARY, PROVIDER_BOUNDARY, ENABLE_PROVIDER_BOUNDARY_AUTOFALLBACK, TOOL_LOOP_MAX_REPEAT_RAW, TOOL_LOOP_MAX_REPEAT, TOOL_LOOP_MAX_REPEAT_VALID, PROXY_EXECUTE_TOOL_CALLS, SUPPRESS_CONVERTER_TOOL_EVENTS, SHOULD_EMIT_TOOL_UPDATES, CursorPlugin = async ({ $, directory, worktree, client: client3, serverUrl }) => {
18668
+ const workspaceDirectory = resolveWorkspaceDirectory(worktree, directory);
18669
+ log13.debug("Plugin initializing", {
18670
+ directory,
18671
+ worktree,
18672
+ workspaceDirectory,
18673
+ cwd: process.cwd(),
18674
+ serverUrl: serverUrl?.toString()
18675
+ });
18639
18676
  if (!TOOL_LOOP_MODE_VALID) {
18640
18677
  log13.warn("Invalid CURSOR_ACP_TOOL_LOOP_MODE; defaulting to opencode", { value: TOOL_LOOP_MODE_RAW });
18641
18678
  }
@@ -18667,7 +18704,7 @@ var log13, CURSOR_PROVIDER_ID2 = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1",
18667
18704
  } else if (toolsEnabled && TOOL_LOOP_MODE === "off") {
18668
18705
  log13.debug("Tool loop mode off; proxy-side tool execution disabled");
18669
18706
  }
18670
- const serverClient = legacyProxyToolPathsEnabled ? createOpencodeClient({ baseUrl: serverUrl.toString(), directory }) : null;
18707
+ const serverClient = legacyProxyToolPathsEnabled ? createOpencodeClient({ baseUrl: serverUrl.toString(), directory: workspaceDirectory }) : null;
18671
18708
  const discovery = legacyProxyToolPathsEnabled ? new OpenCodeToolDiscovery(serverClient ?? client3) : null;
18672
18709
  const localRegistry = new ToolRegistry;
18673
18710
  registerDefaultTools(localRegistry);
@@ -18750,9 +18787,9 @@ var log13, CURSOR_PROVIDER_ID2 = "cursor-acp", CURSOR_PROXY_HOST = "127.0.0.1",
18750
18787
  log13.debug("Tools refreshed", { local: localTools.length, discovered: discoveredList.length, total: toolEntries.length });
18751
18788
  return toolEntries;
18752
18789
  }
18753
- const proxyBaseURL = await ensureCursorProxyServer(directory, router);
18790
+ const proxyBaseURL = await ensureCursorProxyServer(workspaceDirectory, router);
18754
18791
  log13.debug("Proxy server started", { baseURL: proxyBaseURL });
18755
- const toolHookEntries = buildToolHookEntries(localRegistry);
18792
+ const toolHookEntries = buildToolHookEntries(localRegistry, workspaceDirectory);
18756
18793
  return {
18757
18794
  tool: toolHookEntries,
18758
18795
  auth: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rama_nigg/open-cursor",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "No prompt limits. No broken streams. Full thinking + tool support. Your Cursor subscription, properly integrated.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",