converse-mcp-server 2.20.6 → 2.20.8
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/package.json +1 -1
- package/src/providers/copilot.js +20 -1
package/package.json
CHANGED
package/src/providers/copilot.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* - Requires GitHub CLI authenticated (gh auth login) with active Copilot subscription
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { register } from 'node:module';
|
|
15
16
|
import { debugLog, debugError } from '../utils/console.js';
|
|
16
17
|
import { ProviderError, ErrorCodes, StopReasons } from './interface.js';
|
|
17
18
|
|
|
@@ -290,16 +291,34 @@ function isCopilotSDKAvailable() {
|
|
|
290
291
|
return _sdkAvailable;
|
|
291
292
|
}
|
|
292
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Register a module resolution hook to fix the extensionless
|
|
296
|
+
* "vscode-jsonrpc/node" import in @github/copilot-sdk >=0.1.29.
|
|
297
|
+
* The SDK's session.js imports "vscode-jsonrpc/node" without a .js extension,
|
|
298
|
+
* which fails under Node.js strict ESM resolution. The hook rewrites it to
|
|
299
|
+
* "vscode-jsonrpc/node.js". Runs once, works regardless of package manager.
|
|
300
|
+
*/
|
|
301
|
+
let _hookRegistered = false;
|
|
302
|
+
function ensureJsonrpcResolveHook() {
|
|
303
|
+
if (_hookRegistered) return;
|
|
304
|
+
_hookRegistered = true;
|
|
305
|
+
register(`data:text/javascript,${encodeURIComponent(
|
|
306
|
+
'export function resolve(s,c,n){' +
|
|
307
|
+
'return s==="vscode-jsonrpc/node"?n("vscode-jsonrpc/node.js",c):n(s,c);}',
|
|
308
|
+
)}`);
|
|
309
|
+
}
|
|
310
|
+
|
|
293
311
|
/**
|
|
294
312
|
* Dynamically import Copilot SDK (lazy loading)
|
|
295
313
|
*/
|
|
296
314
|
async function getCopilotSDK() {
|
|
315
|
+
ensureJsonrpcResolveHook();
|
|
297
316
|
try {
|
|
298
317
|
const { CopilotClient } = await import('@github/copilot-sdk');
|
|
299
318
|
return CopilotClient;
|
|
300
319
|
} catch (error) {
|
|
301
320
|
throw new CopilotProviderError(
|
|
302
|
-
|
|
321
|
+
`Copilot SDK import failed: ${error.message}`,
|
|
303
322
|
ErrorCodes.API_ERROR,
|
|
304
323
|
error,
|
|
305
324
|
);
|