cursor-oauth-opencode 0.1.1 → 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.
- package/dist/proxy.d.ts +4 -0
- package/dist/proxy.js +14 -2
- package/package.json +1 -1
package/dist/proxy.d.ts
CHANGED
|
@@ -16,4 +16,8 @@ export declare function startProxy(getAccessToken: () => Promise<string>, models
|
|
|
16
16
|
name: string;
|
|
17
17
|
}>): Promise<number>;
|
|
18
18
|
export declare function stopProxy(): void;
|
|
19
|
+
declare function normalizeMcpArgsForOpenCode(toolName: string, args: Record<string, unknown>): Record<string, unknown>;
|
|
20
|
+
export declare const __test: {
|
|
21
|
+
normalizeMcpArgsForOpenCode: typeof normalizeMcpArgsForOpenCode;
|
|
22
|
+
};
|
|
19
23
|
export {};
|
package/dist/proxy.js
CHANGED
|
@@ -392,6 +392,14 @@ function decodeMcpArgsMap(args) {
|
|
|
392
392
|
}
|
|
393
393
|
return decoded;
|
|
394
394
|
}
|
|
395
|
+
function normalizeMcpArgsForOpenCode(toolName, args) {
|
|
396
|
+
if (toolName !== "read" || typeof args.filePath === "string")
|
|
397
|
+
return args;
|
|
398
|
+
if (typeof args.path !== "string")
|
|
399
|
+
return args;
|
|
400
|
+
const { path, ...rest } = args;
|
|
401
|
+
return { ...rest, filePath: path };
|
|
402
|
+
}
|
|
395
403
|
function blobKey(blobId) {
|
|
396
404
|
return Buffer.from(blobId).toString("hex");
|
|
397
405
|
}
|
|
@@ -731,12 +739,13 @@ function handleExecMessage(execMsg, mcpTools, sendFrame, onMcpExec) {
|
|
|
731
739
|
}
|
|
732
740
|
if (execCase === "mcpArgs") {
|
|
733
741
|
const mcpArgs = execMsg.message.value;
|
|
734
|
-
const
|
|
742
|
+
const toolName = mcpArgs.toolName || mcpArgs.name;
|
|
743
|
+
const decoded = normalizeMcpArgsForOpenCode(toolName, decodeMcpArgsMap(mcpArgs.args ?? {}));
|
|
735
744
|
onMcpExec({
|
|
736
745
|
execId: execMsg.execId,
|
|
737
746
|
execMsgId: execMsg.id,
|
|
738
747
|
toolCallId: mcpArgs.toolCallId || crypto.randomUUID(),
|
|
739
|
-
toolName
|
|
748
|
+
toolName,
|
|
740
749
|
decodedArgs: JSON.stringify(decoded),
|
|
741
750
|
});
|
|
742
751
|
return;
|
|
@@ -851,6 +860,9 @@ function handleExecMessage(execMsg, mcpTools, sendFrame, onMcpExec) {
|
|
|
851
860
|
// Unknown exec type — log and ignore
|
|
852
861
|
console.error(`[proxy] unhandled exec: ${execCase}`);
|
|
853
862
|
}
|
|
863
|
+
export const __test = {
|
|
864
|
+
normalizeMcpArgsForOpenCode,
|
|
865
|
+
};
|
|
854
866
|
/** Send an exec client message back to Cursor. */
|
|
855
867
|
function sendExecResult(execMsg, messageCase, value, sendFrame) {
|
|
856
868
|
const execClientMessage = create(ExecClientMessageSchema, {
|
package/package.json
CHANGED