polydev-ai 1.9.1 → 1.9.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/mcp/server.js CHANGED
@@ -1,5 +1,49 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // Ensure fetch is available (polyfill for environments where native fetch is missing)
4
+ if (typeof globalThis.fetch === 'undefined') {
5
+ const https = require('https');
6
+ const http = require('http');
7
+ const { URL } = require('url');
8
+
9
+ globalThis.fetch = function fetchPolyfill(url, options = {}) {
10
+ return new Promise((resolve, reject) => {
11
+ const parsed = new URL(url);
12
+ const mod = parsed.protocol === 'https:' ? https : http;
13
+ const reqOptions = {
14
+ hostname: parsed.hostname,
15
+ port: parsed.port,
16
+ path: parsed.pathname + parsed.search,
17
+ method: options.method || 'GET',
18
+ headers: options.headers || {}
19
+ };
20
+
21
+ const req = mod.request(reqOptions, (res) => {
22
+ const chunks = [];
23
+ res.on('data', (chunk) => chunks.push(chunk));
24
+ res.on('end', () => {
25
+ const body = Buffer.concat(chunks).toString('utf8');
26
+ resolve({
27
+ ok: res.statusCode >= 200 && res.statusCode < 300,
28
+ status: res.statusCode,
29
+ statusText: res.statusMessage,
30
+ headers: { get: (name) => res.headers[name.toLowerCase()] },
31
+ json: () => Promise.resolve(JSON.parse(body)),
32
+ text: () => Promise.resolve(body)
33
+ });
34
+ });
35
+ });
36
+
37
+ req.on('error', reject);
38
+ req.setTimeout(30000, () => { req.destroy(); reject(new Error('Request timed out')); });
39
+ if (options.body) req.write(options.body);
40
+ req.end();
41
+ });
42
+ };
43
+
44
+ console.error('[Polydev MCP] fetch polyfill loaded (native fetch unavailable)');
45
+ }
46
+
3
47
  // Register ts-node for TypeScript support
4
48
  try {
5
49
  require('ts-node/register');
@@ -1,5 +1,49 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // Ensure fetch is available (polyfill for environments where native fetch is missing)
4
+ if (typeof globalThis.fetch === 'undefined') {
5
+ const https = require('https');
6
+ const http = require('http');
7
+ const { URL } = require('url');
8
+
9
+ globalThis.fetch = function fetchPolyfill(url, options = {}) {
10
+ return new Promise((resolve, reject) => {
11
+ const parsed = new URL(url);
12
+ const mod = parsed.protocol === 'https:' ? https : http;
13
+ const reqOptions = {
14
+ hostname: parsed.hostname,
15
+ port: parsed.port,
16
+ path: parsed.pathname + parsed.search,
17
+ method: options.method || 'GET',
18
+ headers: options.headers || {}
19
+ };
20
+
21
+ const req = mod.request(reqOptions, (res) => {
22
+ const chunks = [];
23
+ res.on('data', (chunk) => chunks.push(chunk));
24
+ res.on('end', () => {
25
+ const body = Buffer.concat(chunks).toString('utf8');
26
+ resolve({
27
+ ok: res.statusCode >= 200 && res.statusCode < 300,
28
+ status: res.statusCode,
29
+ statusText: res.statusMessage,
30
+ headers: { get: (name) => res.headers[name.toLowerCase()] },
31
+ json: () => Promise.resolve(JSON.parse(body)),
32
+ text: () => Promise.resolve(body)
33
+ });
34
+ });
35
+ });
36
+
37
+ req.on('error', reject);
38
+ req.setTimeout(30000, () => { req.destroy(); reject(new Error('Request timed out')); });
39
+ if (options.body) req.write(options.body);
40
+ req.end();
41
+ });
42
+ };
43
+
44
+ console.error('[Polydev MCP] fetch polyfill loaded (native fetch unavailable)');
45
+ }
46
+
3
47
  // Lightweight stdio wrapper with local CLI functionality and remote Polydev MCP server fallback
4
48
  const fs = require('fs');
5
49
  const path = require('path');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "engines": {
5
5
  "node": ">=20.x <=22.x"
6
6
  },