@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,373 +0,0 @@
1
- import { createRequire as __mcpCreateRequire } from "node:module";
2
- const require = __mcpCreateRequire(import.meta.url);
3
- import {
4
- FormData,
5
- file_default,
6
- init_esm_min,
7
- init_from
8
- } from "./chunk-HYVN7FZZ.js";
9
- import {
10
- __esm
11
- } from "./chunk-3FYJ3FRD.js";
12
-
13
- // ../../node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js
14
- function _fileName(headerValue) {
15
- const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
16
- if (!m) {
17
- return;
18
- }
19
- const match = m[2] || m[3] || "";
20
- let filename = match.slice(match.lastIndexOf("\\") + 1);
21
- filename = filename.replace(/%22/g, '"');
22
- filename = filename.replace(/&#(\d{4});/g, (m2, code) => {
23
- return String.fromCharCode(code);
24
- });
25
- return filename;
26
- }
27
- async function toFormData(Body, ct) {
28
- if (!/multipart/i.test(ct)) {
29
- throw new TypeError("Failed to fetch");
30
- }
31
- const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
32
- if (!m) {
33
- throw new TypeError("no or bad content-type header, no multipart boundary");
34
- }
35
- const parser = new MultipartParser(m[1] || m[2]);
36
- let headerField;
37
- let headerValue;
38
- let entryValue;
39
- let entryName;
40
- let contentType;
41
- let filename;
42
- const entryChunks = [];
43
- const formData = new FormData();
44
- const onPartData = (ui8a) => {
45
- entryValue += decoder.decode(ui8a, { stream: true });
46
- };
47
- const appendToFile = (ui8a) => {
48
- entryChunks.push(ui8a);
49
- };
50
- const appendFileToFormData = () => {
51
- const file = new file_default(entryChunks, filename, { type: contentType });
52
- formData.append(entryName, file);
53
- };
54
- const appendEntryToFormData = () => {
55
- formData.append(entryName, entryValue);
56
- };
57
- const decoder = new TextDecoder("utf-8");
58
- decoder.decode();
59
- parser.onPartBegin = function() {
60
- parser.onPartData = onPartData;
61
- parser.onPartEnd = appendEntryToFormData;
62
- headerField = "";
63
- headerValue = "";
64
- entryValue = "";
65
- entryName = "";
66
- contentType = "";
67
- filename = null;
68
- entryChunks.length = 0;
69
- };
70
- parser.onHeaderField = function(ui8a) {
71
- headerField += decoder.decode(ui8a, { stream: true });
72
- };
73
- parser.onHeaderValue = function(ui8a) {
74
- headerValue += decoder.decode(ui8a, { stream: true });
75
- };
76
- parser.onHeaderEnd = function() {
77
- headerValue += decoder.decode();
78
- headerField = headerField.toLowerCase();
79
- if (headerField === "content-disposition") {
80
- const m2 = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
81
- if (m2) {
82
- entryName = m2[2] || m2[3] || "";
83
- }
84
- filename = _fileName(headerValue);
85
- if (filename) {
86
- parser.onPartData = appendToFile;
87
- parser.onPartEnd = appendFileToFormData;
88
- }
89
- } else if (headerField === "content-type") {
90
- contentType = headerValue;
91
- }
92
- headerValue = "";
93
- headerField = "";
94
- };
95
- for await (const chunk of Body) {
96
- parser.write(chunk);
97
- }
98
- parser.end();
99
- return formData;
100
- }
101
- var s, S, f, F, LF, CR, SPACE, HYPHEN, COLON, A, Z, lower, noop, MultipartParser;
102
- var init_multipart_parser = __esm({
103
- "../../node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js"() {
104
- init_from();
105
- init_esm_min();
106
- s = 0;
107
- S = {
108
- START_BOUNDARY: s++,
109
- HEADER_FIELD_START: s++,
110
- HEADER_FIELD: s++,
111
- HEADER_VALUE_START: s++,
112
- HEADER_VALUE: s++,
113
- HEADER_VALUE_ALMOST_DONE: s++,
114
- HEADERS_ALMOST_DONE: s++,
115
- PART_DATA_START: s++,
116
- PART_DATA: s++,
117
- END: s++
118
- };
119
- f = 1;
120
- F = {
121
- PART_BOUNDARY: f,
122
- LAST_BOUNDARY: f *= 2
123
- };
124
- LF = 10;
125
- CR = 13;
126
- SPACE = 32;
127
- HYPHEN = 45;
128
- COLON = 58;
129
- A = 97;
130
- Z = 122;
131
- lower = (c) => c | 32;
132
- noop = () => {
133
- };
134
- MultipartParser = class {
135
- /**
136
- * @param {string} boundary
137
- */
138
- constructor(boundary) {
139
- this.index = 0;
140
- this.flags = 0;
141
- this.onHeaderEnd = noop;
142
- this.onHeaderField = noop;
143
- this.onHeadersEnd = noop;
144
- this.onHeaderValue = noop;
145
- this.onPartBegin = noop;
146
- this.onPartData = noop;
147
- this.onPartEnd = noop;
148
- this.boundaryChars = {};
149
- boundary = "\r\n--" + boundary;
150
- const ui8a = new Uint8Array(boundary.length);
151
- for (let i = 0; i < boundary.length; i++) {
152
- ui8a[i] = boundary.charCodeAt(i);
153
- this.boundaryChars[ui8a[i]] = true;
154
- }
155
- this.boundary = ui8a;
156
- this.lookbehind = new Uint8Array(this.boundary.length + 8);
157
- this.state = S.START_BOUNDARY;
158
- }
159
- /**
160
- * @param {Uint8Array} data
161
- */
162
- write(data) {
163
- let i = 0;
164
- const length_ = data.length;
165
- let previousIndex = this.index;
166
- let { lookbehind, boundary, boundaryChars, index, state, flags } = this;
167
- const boundaryLength = this.boundary.length;
168
- const boundaryEnd = boundaryLength - 1;
169
- const bufferLength = data.length;
170
- let c;
171
- let cl;
172
- const mark = (name) => {
173
- this[name + "Mark"] = i;
174
- };
175
- const clear = (name) => {
176
- delete this[name + "Mark"];
177
- };
178
- const callback = (callbackSymbol, start, end, ui8a) => {
179
- if (start === void 0 || start !== end) {
180
- this[callbackSymbol](ui8a && ui8a.subarray(start, end));
181
- }
182
- };
183
- const dataCallback = (name, clear2) => {
184
- const markSymbol = name + "Mark";
185
- if (!(markSymbol in this)) {
186
- return;
187
- }
188
- if (clear2) {
189
- callback(name, this[markSymbol], i, data);
190
- delete this[markSymbol];
191
- } else {
192
- callback(name, this[markSymbol], data.length, data);
193
- this[markSymbol] = 0;
194
- }
195
- };
196
- for (i = 0; i < length_; i++) {
197
- c = data[i];
198
- switch (state) {
199
- case S.START_BOUNDARY:
200
- if (index === boundary.length - 2) {
201
- if (c === HYPHEN) {
202
- flags |= F.LAST_BOUNDARY;
203
- } else if (c !== CR) {
204
- return;
205
- }
206
- index++;
207
- break;
208
- } else if (index - 1 === boundary.length - 2) {
209
- if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
210
- state = S.END;
211
- flags = 0;
212
- } else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
213
- index = 0;
214
- callback("onPartBegin");
215
- state = S.HEADER_FIELD_START;
216
- } else {
217
- return;
218
- }
219
- break;
220
- }
221
- if (c !== boundary[index + 2]) {
222
- index = -2;
223
- }
224
- if (c === boundary[index + 2]) {
225
- index++;
226
- }
227
- break;
228
- case S.HEADER_FIELD_START:
229
- state = S.HEADER_FIELD;
230
- mark("onHeaderField");
231
- index = 0;
232
- // falls through
233
- case S.HEADER_FIELD:
234
- if (c === CR) {
235
- clear("onHeaderField");
236
- state = S.HEADERS_ALMOST_DONE;
237
- break;
238
- }
239
- index++;
240
- if (c === HYPHEN) {
241
- break;
242
- }
243
- if (c === COLON) {
244
- if (index === 1) {
245
- return;
246
- }
247
- dataCallback("onHeaderField", true);
248
- state = S.HEADER_VALUE_START;
249
- break;
250
- }
251
- cl = lower(c);
252
- if (cl < A || cl > Z) {
253
- return;
254
- }
255
- break;
256
- case S.HEADER_VALUE_START:
257
- if (c === SPACE) {
258
- break;
259
- }
260
- mark("onHeaderValue");
261
- state = S.HEADER_VALUE;
262
- // falls through
263
- case S.HEADER_VALUE:
264
- if (c === CR) {
265
- dataCallback("onHeaderValue", true);
266
- callback("onHeaderEnd");
267
- state = S.HEADER_VALUE_ALMOST_DONE;
268
- }
269
- break;
270
- case S.HEADER_VALUE_ALMOST_DONE:
271
- if (c !== LF) {
272
- return;
273
- }
274
- state = S.HEADER_FIELD_START;
275
- break;
276
- case S.HEADERS_ALMOST_DONE:
277
- if (c !== LF) {
278
- return;
279
- }
280
- callback("onHeadersEnd");
281
- state = S.PART_DATA_START;
282
- break;
283
- case S.PART_DATA_START:
284
- state = S.PART_DATA;
285
- mark("onPartData");
286
- // falls through
287
- case S.PART_DATA:
288
- previousIndex = index;
289
- if (index === 0) {
290
- i += boundaryEnd;
291
- while (i < bufferLength && !(data[i] in boundaryChars)) {
292
- i += boundaryLength;
293
- }
294
- i -= boundaryEnd;
295
- c = data[i];
296
- }
297
- if (index < boundary.length) {
298
- if (boundary[index] === c) {
299
- if (index === 0) {
300
- dataCallback("onPartData", true);
301
- }
302
- index++;
303
- } else {
304
- index = 0;
305
- }
306
- } else if (index === boundary.length) {
307
- index++;
308
- if (c === CR) {
309
- flags |= F.PART_BOUNDARY;
310
- } else if (c === HYPHEN) {
311
- flags |= F.LAST_BOUNDARY;
312
- } else {
313
- index = 0;
314
- }
315
- } else if (index - 1 === boundary.length) {
316
- if (flags & F.PART_BOUNDARY) {
317
- index = 0;
318
- if (c === LF) {
319
- flags &= ~F.PART_BOUNDARY;
320
- callback("onPartEnd");
321
- callback("onPartBegin");
322
- state = S.HEADER_FIELD_START;
323
- break;
324
- }
325
- } else if (flags & F.LAST_BOUNDARY) {
326
- if (c === HYPHEN) {
327
- callback("onPartEnd");
328
- state = S.END;
329
- flags = 0;
330
- } else {
331
- index = 0;
332
- }
333
- } else {
334
- index = 0;
335
- }
336
- }
337
- if (index > 0) {
338
- lookbehind[index - 1] = c;
339
- } else if (previousIndex > 0) {
340
- const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
341
- callback("onPartData", 0, previousIndex, _lookbehind);
342
- previousIndex = 0;
343
- mark("onPartData");
344
- i--;
345
- }
346
- break;
347
- case S.END:
348
- break;
349
- default:
350
- throw new Error(`Unexpected state entered: ${state}`);
351
- }
352
- }
353
- dataCallback("onHeaderField");
354
- dataCallback("onHeaderValue");
355
- dataCallback("onPartData");
356
- this.index = index;
357
- this.state = state;
358
- this.flags = flags;
359
- }
360
- end() {
361
- if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) {
362
- this.onPartEnd();
363
- } else if (this.state !== S.END) {
364
- throw new Error("MultipartParser.end(): stream ended unexpectedly");
365
- }
366
- }
367
- };
368
- }
369
- });
370
- init_multipart_parser();
371
- export {
372
- toFormData
373
- };