@rama_nigg/open-cursor 2.4.5 → 2.4.6

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
@@ -147,6 +147,8 @@ opencode run "your prompt" --model cursor-acp/sonnet-4.5
147
147
 
148
148
  Any MCP servers already configured in your `opencode.json` work automatically with cursor-acp models — no extra setup needed. The plugin discovers them at startup and injects usage instructions into the system prompt so the model calls them via cursor-agent's Shell tool.
149
149
 
150
+ `mcptool` is a shell CLI, so opencode applies your `bash` permission rules to `mcptool call ...`. If you rely on MCP tools asking for confirmation, keep `bash` as `ask` or add explicit `ask`/`deny` rules for `mcptool call *`.
151
+
150
152
  ```bash
151
153
  mcptool servers # list discovered servers
152
154
  mcptool tools [server] # list available tools
package/dist/index.js CHANGED
@@ -1002,27 +1002,6 @@ var init_perf = __esm(() => {
1002
1002
  });
1003
1003
 
1004
1004
  // src/proxy/prompt-builder.ts
1005
- import { appendFileSync as appendFileSync2, existsSync as existsSync3, mkdirSync as mkdirSync2 } from "node:fs";
1006
- import { homedir as homedir3 } from "node:os";
1007
- import { join as join4 } from "node:path";
1008
- function ensureLogDir2() {
1009
- try {
1010
- if (!existsSync3(DEBUG_LOG_DIR)) {
1011
- mkdirSync2(DEBUG_LOG_DIR, { recursive: true });
1012
- }
1013
- } catch {}
1014
- }
1015
- function debugLogToFile(message, data) {
1016
- try {
1017
- ensureLogDir2();
1018
- const timestamp = new Date().toISOString();
1019
- const logLine = `[${timestamp}] ${message}: ${JSON.stringify(data, null, 2)}
1020
- `;
1021
- appendFileSync2(DEBUG_LOG_FILE, logLine);
1022
- } catch (err) {
1023
- log5.debug(message, data);
1024
- }
1025
- }
1026
1005
  function buildPromptFromMessages(messages, tools, subagentNames = []) {
1027
1006
  const messageSummary = messages.map((m, i) => {
1028
1007
  const role = m?.role ?? "?";
@@ -1036,7 +1015,7 @@ function buildPromptFromMessages(messages, tools, subagentNames = []) {
1036
1015
  const assistantWithToolCalls = messages.filter((m) => m?.role === "assistant" && Array.isArray(m?.tool_calls) && m.tool_calls.length > 0);
1037
1016
  const assistantEmpty = messages.filter((m) => m?.role === "assistant" && (!m?.tool_calls || m.tool_calls.length === 0) && (!m?.content || m.content === "" || m.content === null));
1038
1017
  const toolResults = messages.filter((m) => m?.role === "tool");
1039
- debugLogToFile("buildPromptFromMessages", {
1018
+ log5.debug("buildPromptFromMessages", {
1040
1019
  totalMessages: messages.length,
1041
1020
  totalTools: tools.length,
1042
1021
  messageSummary,
@@ -1131,22 +1110,20 @@ ${toolDescs}`);
1131
1110
  const finalPrompt = lines.join(`
1132
1111
 
1133
1112
  `);
1134
- debugLogToFile("buildPromptFromMessages: final prompt", {
1113
+ log5.debug("buildPromptFromMessages: final prompt", {
1135
1114
  lineCount: lines.length,
1136
1115
  promptLength: finalPrompt.length,
1137
1116
  promptPreview: finalPrompt.slice(0, 500),
1138
1117
  hasToolResultFormat: finalPrompt.includes("TOOL_RESULT"),
1139
1118
  hasAssistantToolCallFormat: finalPrompt.includes("tool_call(id:"),
1140
- hasCompletionSignal: finalPrompt.includes("Based on the tool results")
1119
+ hasCompletionSignal: finalPrompt.includes("The above tool calls have been executed")
1141
1120
  });
1142
1121
  return finalPrompt;
1143
1122
  }
1144
- var log5, DEBUG_LOG_DIR, DEBUG_LOG_FILE;
1123
+ var log5;
1145
1124
  var init_prompt_builder = __esm(() => {
1146
1125
  init_logger();
1147
1126
  log5 = createLogger("proxy:prompt-builder");
1148
- DEBUG_LOG_DIR = join4(homedir3(), ".config", "opencode", "logs");
1149
- DEBUG_LOG_FILE = join4(DEBUG_LOG_DIR, "tool-loop-debug.log");
1150
1127
  });
1151
1128
 
1152
1129
  // src/proxy/tool-loop.ts
@@ -1827,9 +1804,9 @@ var init_model_discovery = __esm(() => {
1827
1804
  });
1828
1805
 
1829
1806
  // src/plugin-toggle.ts
1830
- import { existsSync as existsSync4, readFileSync } from "fs";
1831
- import { homedir as homedir4 } from "os";
1832
- import { join as join5, resolve } from "path";
1807
+ import { existsSync as existsSync3, readFileSync } from "fs";
1808
+ import { homedir as homedir3 } from "os";
1809
+ import { join as join4, resolve } from "path";
1833
1810
  function matchesPlugin(entry) {
1834
1811
  if (entry === CURSOR_PROVIDER_ID)
1835
1812
  return true;
@@ -1843,8 +1820,8 @@ function resolveOpenCodeConfigPath(env = process.env) {
1843
1820
  if (env.OPENCODE_CONFIG && env.OPENCODE_CONFIG.length > 0) {
1844
1821
  return resolve(env.OPENCODE_CONFIG);
1845
1822
  }
1846
- const configHome = env.XDG_CONFIG_HOME && env.XDG_CONFIG_HOME.length > 0 ? env.XDG_CONFIG_HOME : join5(homedir4(), ".config");
1847
- return join5(configHome, "opencode", "opencode.json");
1823
+ const configHome = env.XDG_CONFIG_HOME && env.XDG_CONFIG_HOME.length > 0 ? env.XDG_CONFIG_HOME : join4(homedir3(), ".config");
1824
+ return join4(configHome, "opencode", "opencode.json");
1848
1825
  }
1849
1826
  function isCursorPluginEnabledInConfig(config) {
1850
1827
  if (!config || typeof config !== "object") {
@@ -1863,7 +1840,7 @@ function isCursorPluginEnabledInConfig(config) {
1863
1840
  }
1864
1841
  function shouldEnableCursorPlugin(env = process.env) {
1865
1842
  const configPath = resolveOpenCodeConfigPath(env);
1866
- if (!existsSync4(configPath)) {
1843
+ if (!existsSync3(configPath)) {
1867
1844
  return {
1868
1845
  enabled: true,
1869
1846
  configPath,
@@ -11999,7 +11976,7 @@ function buildMcpToolDefinitions(tools) {
11999
11976
  function namespaceMcpTool(serverName, toolName) {
12000
11977
  const sanitizedServer = serverName.replace(/[^a-zA-Z0-9]/g, "_");
12001
11978
  const sanitizedTool = toolName.replace(/[^a-zA-Z0-9]/g, "_");
12002
- return `mcp__${sanitizedServer}__${sanitizedTool}`;
11979
+ return `${MCP_TOOL_PREFIX}${sanitizedServer}__${sanitizedTool}`;
12003
11980
  }
12004
11981
  function mcpSchemaToZod(inputSchema, z2) {
12005
11982
  if (!inputSchema || typeof inputSchema !== "object") {
@@ -12041,7 +12018,7 @@ function mcpSchemaToZod(inputSchema, z2) {
12041
12018
  }
12042
12019
  return shape;
12043
12020
  }
12044
- var log13;
12021
+ var log13, MCP_TOOL_PREFIX = "mcp__";
12045
12022
  var init_tool_bridge = __esm(() => {
12046
12023
  init_logger();
12047
12024
  log13 = createLogger("mcp:tool-bridge");
@@ -14046,9 +14023,6 @@ function resolveEditArguments(args) {
14046
14023
  newString = fallbackContent;
14047
14024
  }
14048
14025
  }
14049
- if (oldString === undefined && newString !== undefined) {
14050
- oldString = "";
14051
- }
14052
14026
  return {
14053
14027
  path: path2,
14054
14028
  old_string: oldString,
@@ -14455,7 +14429,10 @@ function applyToolSchemaCompat(toolCall, toolSchemaMap) {
14455
14429
  const toolSpecificArgs = normalizeToolSpecificArgs(toolCall.function.name, normalizedArgs);
14456
14430
  const schema = toolSchemaMap.get(toolCall.function.name);
14457
14431
  const sanitization = sanitizeArgumentsForSchema(toolSpecificArgs, schema);
14458
- const validation = validateToolArguments(toolCall.function.name, sanitization.args, schema, sanitization.unexpected);
14432
+ const validation = validateToolArguments(toolCall.function.name, sanitization.args, schema, sanitization.unexpected, {
14433
+ originalArgs: parsedArgs,
14434
+ writeSchema: toolSchemaMap.get("write")
14435
+ });
14459
14436
  const normalizedToolCall = {
14460
14437
  ...toolCall,
14461
14438
  function: {
@@ -14466,12 +14443,59 @@ function applyToolSchemaCompat(toolCall, toolSchemaMap) {
14466
14443
  return {
14467
14444
  toolCall: normalizedToolCall,
14468
14445
  normalizedArgs: sanitization.args,
14446
+ originalArgs: parsedArgs,
14469
14447
  originalArgKeys,
14470
14448
  normalizedArgKeys: Object.keys(sanitization.args),
14471
14449
  collisionKeys,
14472
14450
  validation
14473
14451
  };
14474
14452
  }
14453
+ function isFullFileShapedEditValidationFailure(toolName, args, validation, originalArgs, writeSchema) {
14454
+ if (toolName.toLowerCase() !== "edit" || validation.ok) {
14455
+ return false;
14456
+ }
14457
+ return buildEditFullFileHint(args, validation.missing, validation.typeErrors, {
14458
+ originalArgs,
14459
+ writeSchema
14460
+ }) !== null;
14461
+ }
14462
+ function buildWriteArguments(filePath, content, writeSchema) {
14463
+ if (!isRecord3(writeSchema)) {
14464
+ return { path: filePath, content };
14465
+ }
14466
+ const required = Array.isArray(writeSchema.required) ? writeSchema.required.filter((value) => typeof value === "string") : [];
14467
+ if (required.includes("filePath")) {
14468
+ return { filePath, content };
14469
+ }
14470
+ return { path: filePath, content };
14471
+ }
14472
+ function tryRerouteEditToWrite(toolCall, compat, allowedToolNames, toolSchemaMap) {
14473
+ if (toolCall.function.name.toLowerCase() !== "edit") {
14474
+ return null;
14475
+ }
14476
+ if (!allowedToolNames.has("write") || !toolSchemaMap.has("write")) {
14477
+ return null;
14478
+ }
14479
+ const writeSchema = toolSchemaMap.get("write");
14480
+ if (!isFullFileShapedEditValidationFailure(toolCall.function.name, compat.normalizedArgs, compat.validation, compat.originalArgs, writeSchema)) {
14481
+ return null;
14482
+ }
14483
+ const filePath = typeof compat.normalizedArgs.path === "string" && compat.normalizedArgs.path.length > 0 ? compat.normalizedArgs.path : typeof compat.normalizedArgs.filePath === "string" && compat.normalizedArgs.filePath.length > 0 ? compat.normalizedArgs.filePath : null;
14484
+ if (!filePath) {
14485
+ return null;
14486
+ }
14487
+ const content = typeof compat.normalizedArgs.new_string === "string" ? compat.normalizedArgs.new_string : typeof compat.normalizedArgs.newString === "string" ? compat.normalizedArgs.newString : typeof compat.normalizedArgs.content === "string" ? compat.normalizedArgs.content : null;
14488
+ if (content === null) {
14489
+ return null;
14490
+ }
14491
+ return {
14492
+ ...toolCall,
14493
+ function: {
14494
+ name: "write",
14495
+ arguments: JSON.stringify(buildWriteArguments(filePath, content, writeSchema))
14496
+ }
14497
+ };
14498
+ }
14475
14499
  function parseArguments(rawArguments) {
14476
14500
  try {
14477
14501
  const parsed = JSON.parse(rawArguments);
@@ -14654,7 +14678,7 @@ function sanitizeArgumentsForSchema(args, schema) {
14654
14678
  }
14655
14679
  return { args: sanitized, unexpected };
14656
14680
  }
14657
- function validateToolArguments(toolName, args, schema, unexpected) {
14681
+ function validateToolArguments(toolName, args, schema, unexpected, context = {}) {
14658
14682
  if (!isRecord3(schema)) {
14659
14683
  return {
14660
14684
  hasSchema: false,
@@ -14690,10 +14714,59 @@ function validateToolArguments(toolName, args, schema, unexpected) {
14690
14714
  missing,
14691
14715
  unexpected,
14692
14716
  typeErrors,
14693
- repairHint: ok ? undefined : buildRepairHint(toolName, missing, unexpected, typeErrors)
14717
+ repairHint: ok ? undefined : buildRepairHint(toolName, args, missing, unexpected, typeErrors, context)
14694
14718
  };
14695
14719
  }
14696
- function buildRepairHint(toolName, missing, unexpected, typeErrors) {
14720
+ function hadOldStringPropertyInPayload(args) {
14721
+ for (const key of Object.keys(args)) {
14722
+ const token = key.toLowerCase().replace(/[^a-z0-9]/g, "");
14723
+ if (token === "oldstring") {
14724
+ return true;
14725
+ }
14726
+ }
14727
+ return false;
14728
+ }
14729
+ function hasEditFilePath(args) {
14730
+ const pathValue = args.path ?? args.filePath;
14731
+ return typeof pathValue === "string" && pathValue.trim().length > 0;
14732
+ }
14733
+ function hasEditBody(args) {
14734
+ const body = args.new_string ?? args.newString ?? args.content;
14735
+ return typeof body === "string" && body.length > 0;
14736
+ }
14737
+ function writeToolExample(writeSchema) {
14738
+ if (!isRecord3(writeSchema)) {
14739
+ return "write with path and content";
14740
+ }
14741
+ const required = Array.isArray(writeSchema.required) ? writeSchema.required.filter((value) => typeof value === "string") : [];
14742
+ if (required.includes("filePath")) {
14743
+ return "write with filePath and content";
14744
+ }
14745
+ return "write with path and content";
14746
+ }
14747
+ function buildEditFullFileHint(args, missing, typeErrors, context) {
14748
+ if (typeErrors.length > 0) {
14749
+ return null;
14750
+ }
14751
+ const missingOldStringOnly = (missing.includes("old_string") || missing.includes("oldString")) && missing.every((key) => key === "old_string" || key === "oldString");
14752
+ if (!missingOldStringOnly) {
14753
+ return null;
14754
+ }
14755
+ const originalArgs = context.originalArgs ?? {};
14756
+ if (hadOldStringPropertyInPayload(originalArgs)) {
14757
+ return null;
14758
+ }
14759
+ if (!hasEditFilePath(args) || !hasEditBody(args)) {
14760
+ return null;
14761
+ }
14762
+ const example = writeToolExample(context.writeSchema);
14763
+ return `For a full file body, use ${example} instead of edit without old_string`;
14764
+ }
14765
+ function buildRepairHint(toolName, args, missing, unexpected, typeErrors, context = {}) {
14766
+ const fullFileHint = toolName.toLowerCase() === "edit" ? buildEditFullFileHint(args, missing, typeErrors, context) : null;
14767
+ if (fullFileHint) {
14768
+ return fullFileHint;
14769
+ }
14697
14770
  const hints = [];
14698
14771
  if (missing.length > 0) {
14699
14772
  hints.push(`missing required: ${missing.join(", ")}`);
@@ -14704,7 +14777,7 @@ function buildRepairHint(toolName, missing, unexpected, typeErrors) {
14704
14777
  if (typeErrors.length > 0) {
14705
14778
  hints.push(`fix type errors: ${typeErrors.join("; ")}`);
14706
14779
  }
14707
- if (toolName.toLowerCase() === "edit" && (missing.includes("old_string") || missing.includes("new_string"))) {
14780
+ if (toolName.toLowerCase() === "edit" && (missing.includes("old_string") || missing.includes("oldString") || missing.includes("new_string") || missing.includes("newString"))) {
14708
14781
  hints.push("edit requires path, old_string, and new_string");
14709
14782
  }
14710
14783
  return hints.join(" | ");
@@ -14891,6 +14964,14 @@ async function handleToolLoopEventLegacy(options) {
14891
14964
  }
14892
14965
  return { intercepted: false, skipConverter: true, terminate: validationTermination };
14893
14966
  }
14967
+ const reroutedWrite = tryRerouteEditToWrite(normalizedToolCall, compat, allowedToolNames, toolSchemaMap);
14968
+ if (reroutedWrite) {
14969
+ log18.debug("Rerouting malformed edit call to write (legacy)", {
14970
+ missing: compat.validation.missing
14971
+ });
14972
+ await onInterceptedToolCall(reroutedWrite);
14973
+ return { intercepted: true, skipConverter: true };
14974
+ }
14894
14975
  if (shouldEmitNonFatalSchemaValidationHint(normalizedToolCall, compat.validation)) {
14895
14976
  const hintChunk = createNonFatalSchemaValidationHintChunk(responseMeta, normalizedToolCall, compat.validation);
14896
14977
  log18.debug("Emitting non-fatal schema validation hint in legacy and skipping malformed tool execution", {
@@ -15042,6 +15123,18 @@ async function handleToolLoopEventV1(options) {
15042
15123
  terminate: createSchemaValidationTermination(normalizedToolCall, compat.validation)
15043
15124
  };
15044
15125
  }
15126
+ const reroutedWrite = tryRerouteEditToWrite(normalizedToolCall, compat, allowedToolNames, toolSchemaMap);
15127
+ if (reroutedWrite) {
15128
+ log18.debug("Rerouting malformed edit call to write", {
15129
+ missing: compat.validation.missing,
15130
+ typeErrors: compat.validation.typeErrors
15131
+ });
15132
+ await onInterceptedToolCall(reroutedWrite);
15133
+ return {
15134
+ intercepted: true,
15135
+ skipConverter: true
15136
+ };
15137
+ }
15045
15138
  if (schemaValidationFailureMode === "pass_through" && shouldEmitNonFatalSchemaValidationHint(normalizedToolCall, compat.validation)) {
15046
15139
  const hintChunk = createNonFatalSchemaValidationHintChunk(responseMeta, normalizedToolCall, compat.validation);
15047
15140
  log18.debug("Emitting non-fatal schema validation hint and skipping malformed tool execution", {
@@ -15252,8 +15345,9 @@ function shouldTerminateOnSchemaValidation(toolCall, validation) {
15252
15345
  }
15253
15346
  function createNonFatalSchemaValidationHintChunk(meta, toolCall, validation) {
15254
15347
  const termination = createSchemaValidationTermination(toolCall, validation);
15255
- const hint = termination.repairHint || "Use write for full-file replacement, or provide path, old_string, and new_string for edit.";
15256
- const content = `Skipped malformed tool call "${toolCall.function.name}": ${termination.message} ${hint}`.trim();
15348
+ const fallbackHint = "Use write for full-file replacement, or provide path, old_string, and new_string for edit.";
15349
+ const suffix = termination.repairHint ? "" : ` ${fallbackHint}`;
15350
+ const content = `Skipped malformed tool call "${toolCall.function.name}": ${termination.message}${suffix}`.trim();
15257
15351
  return {
15258
15352
  id: meta.id,
15259
15353
  object: "chat.completion.chunk",
@@ -15894,25 +15988,13 @@ __export(exports_plugin, {
15894
15988
  CursorPlugin: () => CursorPlugin
15895
15989
  });
15896
15990
  import { tool as tool2 } from "@opencode-ai/plugin";
15897
- import { appendFileSync as appendFileSync3, existsSync as existsSync5, realpathSync } from "fs";
15991
+ import { realpathSync } from "fs";
15898
15992
  import { mkdir } from "fs/promises";
15899
- import { homedir as homedir5 } from "os";
15900
- import { isAbsolute, join as join6, relative, resolve as resolve2 } from "path";
15901
- function ensureDebugLogDir() {
15902
- try {
15903
- if (!existsSync5(DEBUG_LOG_DIR2)) {
15904
- mkdir(DEBUG_LOG_DIR2, { recursive: true }).catch(() => {});
15905
- }
15906
- } catch {}
15907
- }
15908
- function debugLogToFile2(message, data) {
15909
- try {
15910
- ensureDebugLogDir();
15911
- const timestamp = new Date().toISOString();
15912
- const logLine = `[${timestamp}] ${message}: ${JSON.stringify(data, null, 2)}
15913
- `;
15914
- appendFileSync3(DEBUG_LOG_FILE2, logLine);
15915
- } catch {}
15993
+ import { homedir as homedir4 } from "os";
15994
+ import { isAbsolute, join as join5, relative, resolve as resolve2 } from "path";
15995
+ function getMcpToolDefinitionName(mcpToolDefs, index) {
15996
+ const name = mcpToolDefs[index]?.function?.name;
15997
+ return typeof name === "string" && name.length > 0 ? name : undefined;
15916
15998
  }
15917
15999
  function buildAvailableToolsSystemMessage(lastToolNames, lastToolMap, mcpToolDefs, mcpToolSummaries, subagentNames = []) {
15918
16000
  const parts = [];
@@ -15922,27 +16004,27 @@ function buildAvailableToolsSystemMessage(lastToolNames, lastToolMap, mcpToolDef
15922
16004
  parts.push(`Available OpenCode tools (use via tool calls): ${names}. Original skill ids mapped as: ${mapping}. Aliases include oc_skill_* and oc_superskill_* when applicable.`);
15923
16005
  }
15924
16006
  if (mcpToolSummaries && mcpToolSummaries.length > 0) {
16007
+ const summariesWithCallNames = mcpToolSummaries.map((summary, index) => ({
16008
+ ...summary,
16009
+ callName: summary.callName ?? getMcpToolDefinitionName(mcpToolDefs, index) ?? namespaceMcpTool(summary.serverName, summary.toolName)
16010
+ }));
15925
16011
  const servers = new Map;
15926
- for (const s of mcpToolSummaries) {
16012
+ for (const s of summariesWithCallNames) {
15927
16013
  const list = servers.get(s.serverName) ?? [];
15928
16014
  list.push(s);
15929
16015
  servers.set(s.serverName, list);
15930
16016
  }
15931
16017
  const lines = [
15932
- "MCP TOOLS — Use via Shell with the `mcptool` CLI.",
15933
- "Syntax: mcptool call <server> <tool> [json-args]",
16018
+ `MCP TOOLS — Use via direct tool calls (\`${MCP_TOOL_PREFIX}<server>__<tool>\`).`,
16019
+ "These tools are exposed as first-class tool calls (e.g. mcp__filesystem__read_file).",
15934
16020
  ""
15935
16021
  ];
15936
16022
  for (const [server2, tools] of servers) {
15937
16023
  lines.push(`Server: ${server2}`);
15938
16024
  for (const t of tools) {
15939
16025
  const paramHint = t.params?.length ? ` (params: ${t.params.join(", ")})` : "";
15940
- lines.push(` - ${t.toolName}${paramHint}${t.description ? " " + t.description : ""}`);
15941
- }
15942
- if (tools.length > 0) {
15943
- const ex = tools[0];
15944
- const exArgs = ex.params?.length ? ` '{"${ex.params[0]}":"..."}'` : "";
15945
- lines.push(` Example: mcptool call ${server2} ${ex.toolName}${exArgs}`);
16026
+ const sourceHint = t.callName === t.toolName ? "" : ` (server: ${t.serverName}; tool: ${t.toolName})`;
16027
+ lines.push(` - ${t.callName}${paramHint}${t.description ? " — " + t.description : ""}${sourceHint}`);
15946
16028
  }
15947
16029
  lines.push("");
15948
16030
  }
@@ -15957,8 +16039,8 @@ function buildAvailableToolsSystemMessage(lastToolNames, lastToolMap, mcpToolDef
15957
16039
  `) : null;
15958
16040
  }
15959
16041
  async function ensurePluginDirectory() {
15960
- const configHome = process.env.XDG_CONFIG_HOME ? resolve2(process.env.XDG_CONFIG_HOME) : join6(homedir5(), ".config");
15961
- const pluginDir = join6(configHome, "opencode", "plugin");
16042
+ const configHome = process.env.XDG_CONFIG_HOME ? resolve2(process.env.XDG_CONFIG_HOME) : join5(homedir4(), ".config");
16043
+ const pluginDir = join5(configHome, "opencode", "plugin");
15962
16044
  try {
15963
16045
  await mkdir(pluginDir, { recursive: true });
15964
16046
  log20.debug("Plugin directory ensured", { path: pluginDir });
@@ -15975,8 +16057,8 @@ function getGlobalKey() {
15975
16057
  return "__opencode_cursor_proxy_server__";
15976
16058
  }
15977
16059
  function getOpenCodeConfigPrefix() {
15978
- const configHome = process.env.XDG_CONFIG_HOME ? resolve2(process.env.XDG_CONFIG_HOME) : join6(homedir5(), ".config");
15979
- return join6(configHome, "opencode");
16060
+ const configHome = process.env.XDG_CONFIG_HOME ? resolve2(process.env.XDG_CONFIG_HOME) : join5(homedir4(), ".config");
16061
+ return join5(configHome, "opencode");
15980
16062
  }
15981
16063
  function canonicalizePathForCompare(pathValue) {
15982
16064
  const resolvedPath = resolve2(pathValue);
@@ -16053,7 +16135,7 @@ function resolveWorkspaceDirectory(worktree, directory) {
16053
16135
  if (isAcceptableWorkspace(cwd, configPrefix)) {
16054
16136
  return cwd;
16055
16137
  }
16056
- const home = resolveCandidate(homedir5());
16138
+ const home = resolveCandidate(homedir4());
16057
16139
  if (home && !isRootPath(home)) {
16058
16140
  return home;
16059
16141
  }
@@ -16355,7 +16437,7 @@ async function ensureCursorProxyServer(workspaceDirectory, toolRouter) {
16355
16437
  const messages = Array.isArray(body?.messages) ? body.messages : [];
16356
16438
  const stream = body?.stream === true;
16357
16439
  const tools = Array.isArray(body?.tools) ? body.tools : [];
16358
- debugLogToFile2("raw_request_body", {
16440
+ log20.debug("raw request body", {
16359
16441
  model: body?.model,
16360
16442
  cursorModel: body?.cursorModel,
16361
16443
  stream,
@@ -17346,7 +17428,7 @@ function buildToolHookEntries(registry, fallbackBaseDir) {
17346
17428
  }
17347
17429
  return entries;
17348
17430
  }
17349
- var log20, DEBUG_LOG_DIR2, DEBUG_LOG_FILE2, CURSOR_PROVIDER_ID2 = "cursor-acp", CURSOR_PROVIDER_PREFIX, CURSOR_PROXY_HOST = "127.0.0.1", CURSOR_PROXY_DEFAULT_PORT = 32124, CURSOR_PROXY_DEFAULT_BASE_URL, REUSE_EXISTING_PROXY, SESSION_WORKSPACE_CACHE_LIMIT = 200, 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, NATIVE_TOOL_HOOK_EXCLUSIONS, CursorPlugin = async ({ $, directory, worktree, client: client3, serverUrl }) => {
17431
+ var log20, CURSOR_PROVIDER_ID2 = "cursor-acp", CURSOR_PROVIDER_PREFIX, CURSOR_PROXY_HOST = "127.0.0.1", CURSOR_PROXY_DEFAULT_PORT = 32124, CURSOR_PROXY_DEFAULT_BASE_URL, REUSE_EXISTING_PROXY, SESSION_WORKSPACE_CACHE_LIMIT = 200, 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, NATIVE_TOOL_HOOK_EXCLUSIONS, CursorPlugin = async ({ $, directory, worktree, client: client3, serverUrl }) => {
17350
17432
  const workspaceDirectory = resolveWorkspaceDirectory(worktree, directory);
17351
17433
  log20.debug("Plugin initializing", {
17352
17434
  directory,
@@ -17402,6 +17484,7 @@ var log20, DEBUG_LOG_DIR2, DEBUG_LOG_FILE2, CURSOR_PROVIDER_ID2 = "cursor-acp",
17402
17484
  mcpToolSummaries = tools.map((t) => ({
17403
17485
  serverName: t.serverName,
17404
17486
  toolName: t.name,
17487
+ callName: namespaceMcpTool(t.serverName, t.name),
17405
17488
  description: t.description,
17406
17489
  params: t.inputSchema ? Object.keys(t.inputSchema.properties ?? {}) : undefined
17407
17490
  }));
@@ -17619,8 +17702,6 @@ var init_plugin = __esm(() => {
17619
17702
  init_tool_loop_guard();
17620
17703
  init_binary();
17621
17704
  log20 = createLogger("plugin");
17622
- DEBUG_LOG_DIR2 = join6(homedir5(), ".config", "opencode", "logs");
17623
- DEBUG_LOG_FILE2 = join6(DEBUG_LOG_DIR2, "tool-loop-debug.log");
17624
17705
  CURSOR_PROVIDER_PREFIX = `${CURSOR_PROVIDER_ID2}/`;
17625
17706
  CURSOR_PROXY_DEFAULT_BASE_URL = `http://${CURSOR_PROXY_HOST}:${CURSOR_PROXY_DEFAULT_PORT}/v1`;
17626
17707
  REUSE_EXISTING_PROXY = process.env.CURSOR_ACP_REUSE_EXISTING_PROXY !== "false";
@@ -18353,11 +18434,11 @@ init_auth();
18353
18434
  // src/commands/status.ts
18354
18435
  init_auth();
18355
18436
  init_logger();
18356
- import { existsSync as existsSync6 } from "fs";
18437
+ import { existsSync as existsSync4 } from "fs";
18357
18438
  var log22 = createLogger("status");
18358
18439
  function checkAuthStatus() {
18359
18440
  const authFilePath = getAuthFilePath();
18360
- const exists = existsSync6(authFilePath);
18441
+ const exists = existsSync4(authFilePath);
18361
18442
  log22.debug("Checking auth status", { path: authFilePath });
18362
18443
  if (exists) {
18363
18444
  return {