linkque-cli-v2 1.6.20 → 1.6.22

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 (17) hide show
  1. package/dev/worker.js +61 -17
  2. package/linkquejs.js +294 -161
  3. package/package.json +1 -1
  4. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-WHXLLQZR.js → chunk-27TIUPEZ.js} +1 -1
  5. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-JMBJJF7P.js → chunk-2QJITP7G.js} +62 -18
  6. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-5MR5ICJ4.js → chunk-5YW4CWBG.js} +2988 -2022
  7. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-22EQ6RXO.js → chunk-Q6N5427R.js} +3019 -168
  8. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-TGBYXSBU.js → dist-6U5W3RLM.js} +74 -95
  9. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-KD7MXONK.js → google-generative-ai-RT2OOQDJ.js} +1 -1
  10. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-TREYA472.js → google-vertex-HVFMVQVY.js} +1 -1
  11. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-5EI6JQBZ.js → mistral-conversations-KIOTOF73.js} +1 -1
  12. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{otel-RUUFBBFE.js → otel-LQR5KPZ3.js} +578 -266
  13. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +1357 -658
  14. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -3
  15. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -3
  16. package/worker.js +6028 -4038
  17. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-EAODRPW4.js +0 -518
package/dev/worker.js CHANGED
@@ -53,6 +53,7 @@ var require_constants = __commonJS({
53
53
  var require_buffer_util = __commonJS({
54
54
  "../../node_modules/ws/lib/buffer-util.js"(exports2, module2) {
55
55
  "use strict";
56
+ var { websocketMask, websocketUnmask } = require("http");
56
57
  var { EMPTY_BUFFER } = require_constants();
57
58
  var FastBuffer = Buffer[Symbol.species];
58
59
  function concat(list, totalLength) {
@@ -107,7 +108,16 @@ var require_buffer_util = __commonJS({
107
108
  toBuffer,
108
109
  unmask: _unmask
109
110
  };
110
- if (!process.env.WS_NO_BUFFER_UTIL) {
111
+ if (websocketMask) {
112
+ module2.exports.mask = function(source, mask, output, offset, length) {
113
+ if (length < 24) _mask(source, mask, output, offset, length);
114
+ else websocketMask(source, mask, output, offset, length);
115
+ };
116
+ module2.exports.unmask = function(buffer, mask) {
117
+ if (buffer.length < 24) _unmask(buffer, mask);
118
+ else websocketUnmask(buffer, mask);
119
+ };
120
+ } else if (!process.env.WS_NO_BUFFER_UTIL) {
111
121
  try {
112
122
  const bufferUtil = require("bufferutil");
113
123
  module2.exports.mask = function(source, mask, output, offset, length) {
@@ -1170,6 +1180,7 @@ var require_receiver = __commonJS({
1170
1180
  unmask(data, this._mask);
1171
1181
  }
1172
1182
  }
1183
+ this._mask = void 0;
1173
1184
  if (this._opcode > 7) {
1174
1185
  this.controlMessage(data, cb);
1175
1186
  return;
@@ -1502,12 +1513,15 @@ var require_sender = __commonJS({
1502
1513
  target[2] = target[3] = 0;
1503
1514
  target.writeUIntBE(dataLength, 4, 6);
1504
1515
  }
1505
- if (!options.mask) return [target, data];
1516
+ if (!options.mask) {
1517
+ return dataLength ? [target, data] : [target];
1518
+ }
1506
1519
  target[1] |= 128;
1507
1520
  target[offset - 4] = mask[0];
1508
1521
  target[offset - 3] = mask[1];
1509
1522
  target[offset - 2] = mask[2];
1510
1523
  target[offset - 1] = mask[3];
1524
+ if (!dataLength) return [target];
1511
1525
  if (skipMasking) return [target, data];
1512
1526
  if (merge) {
1513
1527
  applyMask(data, mask, target, offset, dataLength);
@@ -2264,6 +2278,7 @@ var require_websocket = __commonJS({
2264
2278
  var https = require("https");
2265
2279
  var http = require("http");
2266
2280
  var net = require("net");
2281
+ var querystring = require("querystring");
2267
2282
  var tls = require("tls");
2268
2283
  var { randomBytes, createHash } = require("crypto");
2269
2284
  var { Duplex, Readable } = require("stream");
@@ -2342,12 +2357,17 @@ var require_websocket = __commonJS({
2342
2357
  protocols = [protocols];
2343
2358
  }
2344
2359
  }
2345
- initAsClient(this, address, protocols, options);
2360
+ options = initAsClient(this, address, protocols, options);
2346
2361
  } else {
2347
- this._autoPong = options.autoPong;
2348
- this._closeTimeout = options.closeTimeout;
2349
2362
  this._isServer = true;
2350
2363
  }
2364
+ if (options.autoPong) {
2365
+ this._autoPong = true;
2366
+ this._autoPongComplete = () => autoPongComplete(this);
2367
+ this._pendingAutoPongs = 0;
2368
+ this._maxPendingAutoPongs = options.maxPendingAutoPongs | 0;
2369
+ }
2370
+ this._closeTimeout = options.closeTimeout;
2351
2371
  }
2352
2372
  /**
2353
2373
  * For historical reasons, the custom "nodebuffer" type is used by the default
@@ -2758,6 +2778,7 @@ var require_websocket = __commonJS({
2758
2778
  maxBufferedChunks: 256 * 1024,
2759
2779
  maxFragments: 16 * 1024,
2760
2780
  maxPayload: 100 * 1024 * 1024,
2781
+ maxPendingAutoPongs: 60,
2761
2782
  skipUTF8Validation: false,
2762
2783
  perMessageDeflate: true,
2763
2784
  followRedirects: false,
@@ -2773,8 +2794,6 @@ var require_websocket = __commonJS({
2773
2794
  path: void 0,
2774
2795
  port: void 0
2775
2796
  };
2776
- websocket._autoPong = opts.autoPong;
2777
- websocket._closeTimeout = opts.closeTimeout;
2778
2797
  if (!protocolVersions.includes(opts.protocolVersion)) {
2779
2798
  throw new RangeError(
2780
2799
  `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
@@ -2790,10 +2809,9 @@ var require_websocket = __commonJS({
2790
2809
  throw new SyntaxError(`Invalid URL: ${address}`);
2791
2810
  }
2792
2811
  }
2793
- if (parsedUrl.protocol === "http:") {
2794
- parsedUrl.protocol = "ws:";
2795
- } else if (parsedUrl.protocol === "https:") {
2796
- parsedUrl.protocol = "wss:";
2812
+ if (parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:") {
2813
+ parsedUrl = new URL2(parsedUrl);
2814
+ parsedUrl.protocol = parsedUrl.protocol === "http:" ? "ws:" : "wss:";
2797
2815
  }
2798
2816
  websocket._url = parsedUrl.href;
2799
2817
  const isSecure = parsedUrl.protocol === "wss:";
@@ -2862,12 +2880,19 @@ var require_websocket = __commonJS({
2862
2880
  }
2863
2881
  }
2864
2882
  if (parsedUrl.username || parsedUrl.password) {
2865
- opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
2883
+ const username = querystring.unescape(parsedUrl.username);
2884
+ const password = querystring.unescape(parsedUrl.password);
2885
+ opts.auth = `${username}:${password}`;
2866
2886
  }
2867
2887
  if (isIpcUrl) {
2868
- const parts = opts.path.split(":");
2869
- opts.socketPath = parts[0];
2870
- opts.path = parts[1];
2888
+ const i = opts.path.indexOf(":");
2889
+ if (i === -1) {
2890
+ opts.socketPath = opts.path;
2891
+ opts.path = "";
2892
+ } else {
2893
+ opts.socketPath = opts.path.slice(0, i);
2894
+ opts.path = opts.path.slice(i + 1);
2895
+ }
2871
2896
  }
2872
2897
  let req;
2873
2898
  if (opts.followRedirects) {
@@ -3011,6 +3036,7 @@ var require_websocket = __commonJS({
3011
3036
  } else {
3012
3037
  req.end();
3013
3038
  }
3039
+ return opts;
3014
3040
  }
3015
3041
  function emitErrorAndClose(websocket, err) {
3016
3042
  websocket._readyState = WebSocket2.CLOSING;
@@ -3062,8 +3088,13 @@ var require_websocket = __commonJS({
3062
3088
  function receiverOnConclude(code, reason) {
3063
3089
  const websocket = this[kWebSocket];
3064
3090
  websocket._closeFrameReceived = true;
3065
- websocket._closeMessage = reason;
3066
3091
  websocket._closeCode = code;
3092
+ if (reason.length === 0) {
3093
+ websocket._closeMessage = EMPTY_BUFFER;
3094
+ } else {
3095
+ websocket._closeMessage = Buffer.allocUnsafeSlow(reason.length);
3096
+ websocket._closeMessage.set(reason);
3097
+ }
3067
3098
  if (websocket._socket[kWebSocket] === void 0) return;
3068
3099
  websocket._socket.removeListener("data", socketOnData);
3069
3100
  process.nextTick(resume, websocket._socket);
@@ -3094,9 +3125,19 @@ var require_websocket = __commonJS({
3094
3125
  }
3095
3126
  function receiverOnPing(data) {
3096
3127
  const websocket = this[kWebSocket];
3097
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
3128
+ if (websocket._autoPong && websocket.readyState === WebSocket2.OPEN) {
3129
+ if (websocket._maxPendingAutoPongs > 0 && websocket._pendingAutoPongs >= websocket._maxPendingAutoPongs) {
3130
+ websocket.terminate();
3131
+ } else {
3132
+ websocket._pendingAutoPongs++;
3133
+ websocket.pong(data, !this._isServer, websocket._autoPongComplete);
3134
+ }
3135
+ }
3098
3136
  websocket.emit("ping", data);
3099
3137
  }
3138
+ function autoPongComplete(websocket) {
3139
+ websocket._pendingAutoPongs--;
3140
+ }
3100
3141
  function receiverOnPong(data) {
3101
3142
  this[kWebSocket].emit("pong", data);
3102
3143
  }
@@ -3350,6 +3391,8 @@ var require_websocket_server = __commonJS({
3350
3391
  * fragments
3351
3392
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
3352
3393
  * size
3394
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
3395
+ * pending automatic pongs
3353
3396
  * @param {Boolean} [options.noServer=false] Enable no server mode
3354
3397
  * @param {String} [options.path] Accept only connections matching this path
3355
3398
  * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
@@ -3372,6 +3415,7 @@ var require_websocket_server = __commonJS({
3372
3415
  maxBufferedChunks: 256 * 1024,
3373
3416
  maxFragments: 16 * 1024,
3374
3417
  maxPayload: 100 * 1024 * 1024,
3418
+ maxPendingAutoPongs: 60,
3375
3419
  skipUTF8Validation: false,
3376
3420
  perMessageDeflate: false,
3377
3421
  handleProtocols: null,