@prompt-optimizer/mcp-server 0.1.0 → 0.1.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.
Files changed (67) hide show
  1. package/README.md +9 -7
  2. package/dist/browser.js +10 -4200
  3. package/dist/chunk-2AOVKKBT.js +7 -0
  4. package/dist/chunk-5QROM7SH.js +3 -0
  5. package/dist/chunk-7FYOSVIN.js +3 -0
  6. package/dist/chunk-AKXNS3YY.js +4 -0
  7. package/dist/chunk-BBXFEEUH.js +43 -0
  8. package/dist/chunk-CHINCAF5.js +33 -0
  9. package/dist/chunk-EJ2IIPFF.js +3 -0
  10. package/dist/chunk-FLQML3XF.js +64 -0
  11. package/dist/chunk-GA7S5A7R.js +3 -0
  12. package/dist/chunk-IABPRAPS.js +3 -0
  13. package/dist/chunk-JE2EBI2C.js +3 -0
  14. package/dist/chunk-JL6XIA4S.js +4 -0
  15. package/dist/chunk-JXWLV6TC.js +12 -0
  16. package/dist/chunk-MUXGFCOV.js +7012 -0
  17. package/dist/chunk-NT2DBZVA.js +3 -0
  18. package/dist/chunk-NVZFDKDX.js +3 -0
  19. package/dist/chunk-PKJ2PK6J.js +106 -0
  20. package/dist/chunk-SDHFVY4F.js +6 -0
  21. package/dist/chunk-TWLLFRFQ.js +6 -0
  22. package/dist/desktop-business.js +4 -1225
  23. package/dist/desktop-comparison-UIIN3WK4.js +3 -0
  24. package/dist/desktop-storage-KJWV2A3P.js +3 -0
  25. package/dist/desktop.js +1 -24
  26. package/dist/dist-OM6QMJNC.js +10 -0
  27. package/dist/dist-YR425RV6.js +3 -0
  28. package/dist/index.js +1 -10
  29. package/dist/legacy.js +97 -26634
  30. package/dist/multipart-parser-XGXMMB2Z.js +4 -0
  31. package/dist/node-2SMUH4FH.js +3 -0
  32. package/dist/node-NX6BPYD5.js +3 -0
  33. package/dist/node-U7LDATXE.js +17 -0
  34. package/dist/registry-H5F4DGAM-2GPEVJMD.js +3 -0
  35. package/dist/src-3F22P42W.js +5 -0
  36. package/dist/start.js +2 -13
  37. package/package.json +10 -1
  38. package/preload-env.cjs +3 -352
  39. package/dist/chunk-3FYJ3FRD.js +0 -57
  40. package/dist/chunk-E7Z4Y3F4.js +0 -36402
  41. package/dist/chunk-GBDJTSRW.js +0 -298
  42. package/dist/chunk-HLCN3DLS.js +0 -19745
  43. package/dist/chunk-HYVN7FZZ.js +0 -4787
  44. package/dist/chunk-MEUCFQGU.js +0 -537
  45. package/dist/chunk-N6AUTPPS.js +0 -10647
  46. package/dist/chunk-Q52SACHI.js +0 -304
  47. package/dist/chunk-Q5B3KFB3.js +0 -31
  48. package/dist/chunk-QSPNNVX3.js +0 -49017
  49. package/dist/chunk-SO4YJHYW.js +0 -13450
  50. package/dist/chunk-SV2GETJH.js +0 -65
  51. package/dist/chunk-TFH2LO2H.js +0 -58
  52. package/dist/chunk-TFJEYQ3G.js +0 -786
  53. package/dist/chunk-TLOFCHZI.js +0 -70
  54. package/dist/chunk-TQGHULC7.js +0 -188
  55. package/dist/chunk-UTOMPKTK.js +0 -2209
  56. package/dist/chunk-XXALDAL7.js +0 -1838
  57. package/dist/chunk-YT3U6B54.js +0 -21
  58. package/dist/desktop-comparison-HDIQ6K45.js +0 -22
  59. package/dist/desktop-storage-YRABQCLF.js +0 -14
  60. package/dist/dist-O5VNBF5I.js +0 -622
  61. package/dist/dist-UMX52UME.js +0 -481
  62. package/dist/multipart-parser-XE6WGDAU.js +0 -373
  63. package/dist/node-2RBNZOSK.js +0 -2225
  64. package/dist/node-4Z3USCHW.js +0 -21
  65. package/dist/node-QHGLD5ST.js +0 -25
  66. package/dist/registry-H5F4DGAM-UHR4F6LL.js +0 -13
  67. package/dist/src-7PBMYCGI.js +0 -1398
@@ -1,481 +0,0 @@
1
- import { createRequire as __mcpCreateRequire } from "node:module";
2
- const require = __mcpCreateRequire(import.meta.url);
3
- import {
4
- require_src
5
- } from "./chunk-TFJEYQ3G.js";
6
- import {
7
- __commonJS,
8
- __require
9
- } from "./chunk-3FYJ3FRD.js";
10
-
11
- // ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
12
- var require_helpers = __commonJS({
13
- "../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(exports) {
14
- "use strict";
15
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
16
- if (k2 === void 0) k2 = k;
17
- var desc = Object.getOwnPropertyDescriptor(m, k);
18
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
- desc = { enumerable: true, get: function() {
20
- return m[k];
21
- } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === void 0) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = exports && exports.__importStar || function(mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) {
37
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38
- }
39
- __setModuleDefault(result, mod);
40
- return result;
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.req = exports.json = exports.toBuffer = void 0;
44
- var http = __importStar(__require("http"));
45
- var https = __importStar(__require("https"));
46
- async function toBuffer(stream) {
47
- let length = 0;
48
- const chunks = [];
49
- for await (const chunk of stream) {
50
- length += chunk.length;
51
- chunks.push(chunk);
52
- }
53
- return Buffer.concat(chunks, length);
54
- }
55
- exports.toBuffer = toBuffer;
56
- async function json(stream) {
57
- const buf = await toBuffer(stream);
58
- const str = buf.toString("utf8");
59
- try {
60
- return JSON.parse(str);
61
- } catch (_err) {
62
- const err = _err;
63
- err.message += ` (input: ${str})`;
64
- throw err;
65
- }
66
- }
67
- exports.json = json;
68
- function req(url, opts = {}) {
69
- const href = typeof url === "string" ? url : url.href;
70
- const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
71
- const promise = new Promise((resolve, reject) => {
72
- req2.once("response", resolve).once("error", reject).end();
73
- });
74
- req2.then = promise.then.bind(promise);
75
- return req2;
76
- }
77
- exports.req = req;
78
- }
79
- });
80
-
81
- // ../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
82
- var require_dist = __commonJS({
83
- "../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(exports) {
84
- "use strict";
85
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
86
- if (k2 === void 0) k2 = k;
87
- var desc = Object.getOwnPropertyDescriptor(m, k);
88
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
89
- desc = { enumerable: true, get: function() {
90
- return m[k];
91
- } };
92
- }
93
- Object.defineProperty(o, k2, desc);
94
- }) : (function(o, m, k, k2) {
95
- if (k2 === void 0) k2 = k;
96
- o[k2] = m[k];
97
- }));
98
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
99
- Object.defineProperty(o, "default", { enumerable: true, value: v });
100
- }) : function(o, v) {
101
- o["default"] = v;
102
- });
103
- var __importStar = exports && exports.__importStar || function(mod) {
104
- if (mod && mod.__esModule) return mod;
105
- var result = {};
106
- if (mod != null) {
107
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
108
- }
109
- __setModuleDefault(result, mod);
110
- return result;
111
- };
112
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
113
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
114
- };
115
- Object.defineProperty(exports, "__esModule", { value: true });
116
- exports.Agent = void 0;
117
- var net = __importStar(__require("net"));
118
- var http = __importStar(__require("http"));
119
- var https_1 = __require("https");
120
- __exportStar(require_helpers(), exports);
121
- var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState");
122
- var Agent = class extends http.Agent {
123
- constructor(opts) {
124
- super(opts);
125
- this[INTERNAL] = {};
126
- }
127
- /**
128
- * Determine whether this is an `http` or `https` request.
129
- */
130
- isSecureEndpoint(options) {
131
- if (options) {
132
- if (typeof options.secureEndpoint === "boolean") {
133
- return options.secureEndpoint;
134
- }
135
- if (typeof options.protocol === "string") {
136
- return options.protocol === "https:";
137
- }
138
- }
139
- const { stack } = new Error();
140
- if (typeof stack !== "string")
141
- return false;
142
- return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
143
- }
144
- // In order to support async signatures in `connect()` and Node's native
145
- // connection pooling in `http.Agent`, the array of sockets for each origin
146
- // has to be updated synchronously. This is so the length of the array is
147
- // accurate when `addRequest()` is next called. We achieve this by creating a
148
- // fake socket and adding it to `sockets[origin]` and incrementing
149
- // `totalSocketCount`.
150
- incrementSockets(name) {
151
- if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
152
- return null;
153
- }
154
- if (!this.sockets[name]) {
155
- this.sockets[name] = [];
156
- }
157
- const fakeSocket = new net.Socket({ writable: false });
158
- this.sockets[name].push(fakeSocket);
159
- this.totalSocketCount++;
160
- return fakeSocket;
161
- }
162
- decrementSockets(name, socket) {
163
- if (!this.sockets[name] || socket === null) {
164
- return;
165
- }
166
- const sockets = this.sockets[name];
167
- const index = sockets.indexOf(socket);
168
- if (index !== -1) {
169
- sockets.splice(index, 1);
170
- this.totalSocketCount--;
171
- if (sockets.length === 0) {
172
- delete this.sockets[name];
173
- }
174
- }
175
- }
176
- // In order to properly update the socket pool, we need to call `getName()` on
177
- // the core `https.Agent` if it is a secureEndpoint.
178
- getName(options) {
179
- const secureEndpoint = this.isSecureEndpoint(options);
180
- if (secureEndpoint) {
181
- return https_1.Agent.prototype.getName.call(this, options);
182
- }
183
- return super.getName(options);
184
- }
185
- createSocket(req, options, cb) {
186
- const connectOpts = {
187
- ...options,
188
- secureEndpoint: this.isSecureEndpoint(options)
189
- };
190
- const name = this.getName(connectOpts);
191
- const fakeSocket = this.incrementSockets(name);
192
- Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
193
- this.decrementSockets(name, fakeSocket);
194
- if (socket instanceof http.Agent) {
195
- try {
196
- return socket.addRequest(req, connectOpts);
197
- } catch (err) {
198
- return cb(err);
199
- }
200
- }
201
- this[INTERNAL].currentSocket = socket;
202
- super.createSocket(req, options, cb);
203
- }, (err) => {
204
- this.decrementSockets(name, fakeSocket);
205
- cb(err);
206
- });
207
- }
208
- createConnection() {
209
- const socket = this[INTERNAL].currentSocket;
210
- this[INTERNAL].currentSocket = void 0;
211
- if (!socket) {
212
- throw new Error("No socket was returned in the `connect()` function");
213
- }
214
- return socket;
215
- }
216
- get defaultPort() {
217
- return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
218
- }
219
- set defaultPort(v) {
220
- if (this[INTERNAL]) {
221
- this[INTERNAL].defaultPort = v;
222
- }
223
- }
224
- get protocol() {
225
- return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
226
- }
227
- set protocol(v) {
228
- if (this[INTERNAL]) {
229
- this[INTERNAL].protocol = v;
230
- }
231
- }
232
- };
233
- exports.Agent = Agent;
234
- }
235
- });
236
-
237
- // ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js
238
- var require_parse_proxy_response = __commonJS({
239
- "../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
240
- "use strict";
241
- var __importDefault = exports && exports.__importDefault || function(mod) {
242
- return mod && mod.__esModule ? mod : { "default": mod };
243
- };
244
- Object.defineProperty(exports, "__esModule", { value: true });
245
- exports.parseProxyResponse = void 0;
246
- var debug_1 = __importDefault(require_src());
247
- var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
248
- function parseProxyResponse(socket) {
249
- return new Promise((resolve, reject) => {
250
- let buffersLength = 0;
251
- const buffers = [];
252
- function read() {
253
- const b = socket.read();
254
- if (b)
255
- ondata(b);
256
- else
257
- socket.once("readable", read);
258
- }
259
- function cleanup() {
260
- socket.removeListener("end", onend);
261
- socket.removeListener("error", onerror);
262
- socket.removeListener("readable", read);
263
- }
264
- function onend() {
265
- cleanup();
266
- debug("onend");
267
- reject(new Error("Proxy connection ended before receiving CONNECT response"));
268
- }
269
- function onerror(err) {
270
- cleanup();
271
- debug("onerror %o", err);
272
- reject(err);
273
- }
274
- function ondata(b) {
275
- buffers.push(b);
276
- buffersLength += b.length;
277
- const buffered = Buffer.concat(buffers, buffersLength);
278
- const endOfHeaders = buffered.indexOf("\r\n\r\n");
279
- if (endOfHeaders === -1) {
280
- debug("have not received end of HTTP headers yet...");
281
- read();
282
- return;
283
- }
284
- const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
285
- const firstLine = headerParts.shift();
286
- if (!firstLine) {
287
- socket.destroy();
288
- return reject(new Error("No header received from proxy CONNECT response"));
289
- }
290
- const firstLineParts = firstLine.split(" ");
291
- const statusCode = +firstLineParts[1];
292
- const statusText = firstLineParts.slice(2).join(" ");
293
- const headers = {};
294
- for (const header of headerParts) {
295
- if (!header)
296
- continue;
297
- const firstColon = header.indexOf(":");
298
- if (firstColon === -1) {
299
- socket.destroy();
300
- return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
301
- }
302
- const key = header.slice(0, firstColon).toLowerCase();
303
- const value = header.slice(firstColon + 1).trimStart();
304
- const current = headers[key];
305
- if (typeof current === "string") {
306
- headers[key] = [current, value];
307
- } else if (Array.isArray(current)) {
308
- current.push(value);
309
- } else {
310
- headers[key] = value;
311
- }
312
- }
313
- debug("got proxy server response: %o %o", firstLine, headers);
314
- cleanup();
315
- resolve({
316
- connect: {
317
- statusCode,
318
- statusText,
319
- headers
320
- },
321
- buffered
322
- });
323
- }
324
- socket.on("error", onerror);
325
- socket.on("end", onend);
326
- read();
327
- });
328
- }
329
- exports.parseProxyResponse = parseProxyResponse;
330
- }
331
- });
332
-
333
- // ../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js
334
- var require_dist2 = __commonJS({
335
- "../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js"(exports) {
336
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
337
- if (k2 === void 0) k2 = k;
338
- var desc = Object.getOwnPropertyDescriptor(m, k);
339
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
340
- desc = { enumerable: true, get: function() {
341
- return m[k];
342
- } };
343
- }
344
- Object.defineProperty(o, k2, desc);
345
- }) : (function(o, m, k, k2) {
346
- if (k2 === void 0) k2 = k;
347
- o[k2] = m[k];
348
- }));
349
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
350
- Object.defineProperty(o, "default", { enumerable: true, value: v });
351
- }) : function(o, v) {
352
- o["default"] = v;
353
- });
354
- var __importStar = exports && exports.__importStar || function(mod) {
355
- if (mod && mod.__esModule) return mod;
356
- var result = {};
357
- if (mod != null) {
358
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
359
- }
360
- __setModuleDefault(result, mod);
361
- return result;
362
- };
363
- var __importDefault = exports && exports.__importDefault || function(mod) {
364
- return mod && mod.__esModule ? mod : { "default": mod };
365
- };
366
- Object.defineProperty(exports, "__esModule", { value: true });
367
- exports.HttpsProxyAgent = void 0;
368
- var net = __importStar(__require("net"));
369
- var tls = __importStar(__require("tls"));
370
- var assert_1 = __importDefault(__require("assert"));
371
- var debug_1 = __importDefault(require_src());
372
- var agent_base_1 = require_dist();
373
- var url_1 = __require("url");
374
- var parse_proxy_response_1 = require_parse_proxy_response();
375
- var debug = (0, debug_1.default)("https-proxy-agent");
376
- var setServernameFromNonIpHost = (options) => {
377
- if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
378
- return {
379
- ...options,
380
- servername: options.host
381
- };
382
- }
383
- return options;
384
- };
385
- var HttpsProxyAgent = class extends agent_base_1.Agent {
386
- constructor(proxy, opts) {
387
- super(opts);
388
- this.options = { path: void 0 };
389
- this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
390
- this.proxyHeaders = opts?.headers ?? {};
391
- debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
392
- const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
393
- const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
394
- this.connectOpts = {
395
- // Attempt to negotiate http/1.1 for proxy servers that support http/2
396
- ALPNProtocols: ["http/1.1"],
397
- ...opts ? omit(opts, "headers") : null,
398
- host,
399
- port
400
- };
401
- }
402
- /**
403
- * Called when the node-core HTTP client library is creating a
404
- * new HTTP request.
405
- */
406
- async connect(req, opts) {
407
- const { proxy } = this;
408
- if (!opts.host) {
409
- throw new TypeError('No "host" provided');
410
- }
411
- let socket;
412
- if (proxy.protocol === "https:") {
413
- debug("Creating `tls.Socket`: %o", this.connectOpts);
414
- socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
415
- } else {
416
- debug("Creating `net.Socket`: %o", this.connectOpts);
417
- socket = net.connect(this.connectOpts);
418
- }
419
- const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
420
- const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
421
- let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
422
- `;
423
- if (proxy.username || proxy.password) {
424
- const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
425
- headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
426
- }
427
- headers.Host = `${host}:${opts.port}`;
428
- if (!headers["Proxy-Connection"]) {
429
- headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
430
- }
431
- for (const name of Object.keys(headers)) {
432
- payload += `${name}: ${headers[name]}\r
433
- `;
434
- }
435
- const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
436
- socket.write(`${payload}\r
437
- `);
438
- const { connect, buffered } = await proxyResponsePromise;
439
- req.emit("proxyConnect", connect);
440
- this.emit("proxyConnect", connect, req);
441
- if (connect.statusCode === 200) {
442
- req.once("socket", resume);
443
- if (opts.secureEndpoint) {
444
- debug("Upgrading socket connection to TLS");
445
- return tls.connect({
446
- ...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
447
- socket
448
- });
449
- }
450
- return socket;
451
- }
452
- socket.destroy();
453
- const fakeSocket = new net.Socket({ writable: false });
454
- fakeSocket.readable = true;
455
- req.once("socket", (s) => {
456
- debug("Replaying proxy buffer for failed request");
457
- (0, assert_1.default)(s.listenerCount("data") > 0);
458
- s.push(buffered);
459
- s.push(null);
460
- });
461
- return fakeSocket;
462
- }
463
- };
464
- HttpsProxyAgent.protocols = ["http", "https"];
465
- exports.HttpsProxyAgent = HttpsProxyAgent;
466
- function resume(socket) {
467
- socket.resume();
468
- }
469
- function omit(obj, ...keys) {
470
- const ret = {};
471
- let key;
472
- for (key in obj) {
473
- if (!keys.includes(key)) {
474
- ret[key] = obj[key];
475
- }
476
- }
477
- return ret;
478
- }
479
- }
480
- });
481
- export default require_dist2();