dsh-cursor-subscription 0.6.1 → 0.6.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/lib/index.js +30 -10
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2636,14 +2636,13 @@ export class CursorAdapter extends LlmAdapter {
|
|
|
2636
2636
|
} else if (update.type === "tokenDelta") {
|
|
2637
2637
|
if (Number.isFinite(update.tokens) && update.tokens > 0) outputTokens = update.tokens;
|
|
2638
2638
|
} else if (update.type === "partialToolCall") {
|
|
2639
|
+
// Buffer only. Emitting incomplete tool-call chunks here created
|
|
2640
|
+
// nameless DSH tool blocks that competed with real mcpArgs frames.
|
|
2639
2641
|
if (toolCallBuffer === undefined || toolCallBuffer.id !== update.callId) {
|
|
2640
2642
|
toolCallBuffer = { id: update.callId, name: "", arguments: "" };
|
|
2641
|
-
yield { type: "block-start", index: TOOL_BLOCK_INDEX, blockType: "tool-call" };
|
|
2642
|
-
yield { type: "tool-call-delta", index: TOOL_BLOCK_INDEX, id: ToolCallId(update.callId), argumentsDelta: "" };
|
|
2643
2643
|
}
|
|
2644
2644
|
if (update.argsTextDelta.length > 0) {
|
|
2645
2645
|
toolCallBuffer.arguments += update.argsTextDelta;
|
|
2646
|
-
yield { type: "tool-call-delta", index: TOOL_BLOCK_INDEX, id: ToolCallId(update.callId), argumentsDelta: update.argsTextDelta };
|
|
2647
2646
|
}
|
|
2648
2647
|
} else if (update.type === "toolCallStarted" || update.type === "toolCallCompleted" || update.type === "toolCallDelta") {
|
|
2649
2648
|
emittedToolCall = true;
|
|
@@ -2682,7 +2681,6 @@ export class CursorAdapter extends LlmAdapter {
|
|
|
2682
2681
|
"TOOL_LIMIT",
|
|
2683
2682
|
);
|
|
2684
2683
|
}
|
|
2685
|
-
emittedToolCall = true;
|
|
2686
2684
|
// decodeExecServerMessage nests the parsed McpArgs under
|
|
2687
2685
|
// `exec.args`: { name, toolCallId, providerIdentifier, toolName, args }.
|
|
2688
2686
|
const mcp = exec.args ?? {};
|
|
@@ -2694,24 +2692,46 @@ export class CursorAdapter extends LlmAdapter {
|
|
|
2694
2692
|
args[key] = null;
|
|
2695
2693
|
}
|
|
2696
2694
|
}
|
|
2695
|
+
const candidateName = mcp.toolName || mcp.name;
|
|
2696
|
+
const tool = resolveTextTool(candidateName, options.tools ?? []);
|
|
2697
|
+
if (tool === undefined) {
|
|
2698
|
+
// Cursor occasionally emits empty/placeholder MCP execs around
|
|
2699
|
+
// real calls. Reject them immediately so they never become
|
|
2700
|
+
// pending bridge entries that later poison the resume path with
|
|
2701
|
+
// "Tool result not provided".
|
|
2702
|
+
run.writeMessage(encodeExecClientMessageEnvelope(encodeExecClientMessage(
|
|
2703
|
+
exec.id,
|
|
2704
|
+
exec.execId,
|
|
2705
|
+
11,
|
|
2706
|
+
encodeMcpError(`Unknown or unsupported MCP tool: ${candidateName || "(empty)"}`),
|
|
2707
|
+
)));
|
|
2708
|
+
continue;
|
|
2709
|
+
}
|
|
2710
|
+
emittedToolCall = true;
|
|
2697
2711
|
const id = mcp.toolCallId || exec.execId || crypto.randomUUID();
|
|
2698
|
-
const name =
|
|
2699
|
-
|
|
2712
|
+
const name = tool.name;
|
|
2713
|
+
const normalizedArgs = normalizeTextToolArguments(tool, args);
|
|
2714
|
+
const argumentsJson = JSON.stringify(normalizedArgs);
|
|
2715
|
+
// Parallel MCP calls must use distinct DSH block indexes. Reusing
|
|
2716
|
+
// TOOL_BLOCK_INDEX causes the agent loop to keep only one call while
|
|
2717
|
+
// pendingExecs still waits for every sibling.
|
|
2718
|
+
const blockIndex = TOOL_BLOCK_INDEX + pendingExecs.length;
|
|
2719
|
+
yield { type: "block-start", index: blockIndex, blockType: "tool-call" };
|
|
2700
2720
|
yield {
|
|
2701
2721
|
type: "tool-call-delta",
|
|
2702
|
-
index:
|
|
2722
|
+
index: blockIndex,
|
|
2703
2723
|
id: ToolCallId(id),
|
|
2704
2724
|
name,
|
|
2705
|
-
argumentsDelta:
|
|
2725
|
+
argumentsDelta: argumentsJson,
|
|
2706
2726
|
};
|
|
2707
2727
|
yield {
|
|
2708
2728
|
type: "block-end",
|
|
2709
|
-
index:
|
|
2729
|
+
index: blockIndex,
|
|
2710
2730
|
block: {
|
|
2711
2731
|
type: "tool-call",
|
|
2712
2732
|
id: ToolCallId(id),
|
|
2713
2733
|
name,
|
|
2714
|
-
arguments:
|
|
2734
|
+
arguments: argumentsJson,
|
|
2715
2735
|
},
|
|
2716
2736
|
};
|
|
2717
2737
|
pendingExecs.push({ id: exec.id, execId: exec.execId, toolCallId: id });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cursor-subscription",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"packageManager": "pnpm@11.19.0",
|
|
5
5
|
"description": "Cursor subscription for DeepSeek Harness with browser login, token refresh, model discovery, and the Cursor Agent chat protocol",
|
|
6
6
|
"type": "module",
|