opencode-cursor-provider 0.3.0 → 0.3.1
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/dist/bridge/tool-bridge.js +12 -1
- package/package.json +1 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
const TOOL_PREFIX = "opencode__";
|
|
3
|
+
const CODE_MODE_DISCOVERY = [
|
|
4
|
+
"OpenCode MCP tools are available only inside this Code Mode tool.",
|
|
5
|
+
"Do not search for them with Cursor GetDynamicTools.",
|
|
6
|
+
'To find an MCP tool, call this tool with code such as `return await tools.$codemode.search({ query: "posthog" })`.',
|
|
7
|
+
].join("\n");
|
|
3
8
|
export function createOpenCodeToolBridge(tools, bridgeID = randomUUID()) {
|
|
4
9
|
const queued = [];
|
|
5
10
|
const pending = new Map();
|
|
@@ -11,7 +16,13 @@ export function createOpenCodeToolBridge(tools, bridgeID = randomUUID()) {
|
|
|
11
16
|
.map((tool) => [
|
|
12
17
|
`${TOOL_PREFIX}${tool.name}`,
|
|
13
18
|
{
|
|
14
|
-
...(tool.description === undefined
|
|
19
|
+
...(tool.description === undefined && tool.name !== "execute"
|
|
20
|
+
? {}
|
|
21
|
+
: {
|
|
22
|
+
description: tool.name === "execute"
|
|
23
|
+
? [CODE_MODE_DISCOVERY, tool.description].filter((item) => item !== undefined).join("\n\n")
|
|
24
|
+
: tool.description,
|
|
25
|
+
}),
|
|
15
26
|
inputSchema: tool.inputSchema,
|
|
16
27
|
execute(args, context) {
|
|
17
28
|
sequence += 1;
|