linkque-cli-v2 1.0.5 → 1.0.6

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