linkque-cli-v2 1.6.17 → 1.6.18

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 (18) hide show
  1. package/dataTransformWorker.js +3 -17
  2. package/dev/worker.js +37 -11
  3. package/linkquejs.js +471 -384
  4. package/package.json +1 -1
  5. package/vendor/linkque-agent-appwrite-integrate/data-transform/dataTransformWorker.js +3 -17
  6. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-RSMGFPPK.js → chunk-3BH2PDL3.js} +1 -1
  7. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-JMBJJF7P.js → chunk-KRE5FADB.js} +37 -11
  8. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-EJB2EPNQ.js → chunk-L5WNKJ4W.js} +2852 -1
  9. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-7OYTZGOC.js → chunk-M6E4Y5HY.js} +2998 -2125
  10. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-KD7MXONK.js → google-generative-ai-YD5ZGNXC.js} +1 -1
  11. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-TREYA472.js → google-vertex-M34UDW4J.js} +1 -1
  12. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-C43A6QIS.js → mistral-conversations-EIVAJAMW.js} +1 -1
  13. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{otel-RUUFBBFE.js → otel-LQR5KPZ3.js} +578 -266
  14. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +770 -185
  15. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -3
  16. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -3
  17. package/worker.js +6093 -4380
  18. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-EAODRPW4.js +0 -518
@@ -1830,11 +1830,8 @@ async function execute(module2, input) {
1830
1830
  result.value.dispose();
1831
1831
  return "{}";
1832
1832
  }
1833
- const host = context.newFunction("__hostFilter", (listHandle, promptHandle, lengthHandle) => {
1833
+ const host = context.newFunction("__hostFilter", (listHandle, promptHandle) => {
1834
1834
  const modelList = JSON.parse(context.getString(listHandle));
1835
- if (!Array.isArray(modelList) || modelList.length !== context.getNumber(lengthHandle)) {
1836
- throw new TypeError("\u5E8F\u5217\u5316\u540E\u7684\u6A21\u578B\u6295\u5F71\u5FC5\u987B\u4E0E\u539F\u59CB\u6570\u7EC4\u7B49\u957F");
1837
- }
1838
1835
  const prompt = context.getString(promptHandle);
1839
1836
  const callId = nextCallId++;
1840
1837
  const promise = context.newPromise();
@@ -1866,22 +1863,13 @@ async function execute(module2, input) {
1866
1863
  if (typeof prompt !== 'string') throw new TypeError('AI \u7B5B\u9009\u6307\u4EE4\u5FC5\u987B\u662F\u5B57\u7B26\u4E32');
1867
1864
  const original = list.slice();
1868
1865
  if (original.length === 0 || ${input.preview === true}) return original;
1869
- const indices = JSON.parse(await hostFilter(JSON.stringify(modelList), prompt, original.length));
1866
+ const indices = JSON.parse(await hostFilter(JSON.stringify(modelList), prompt));
1870
1867
  return indices.map(index => original[index]);
1871
1868
  } }) });
1872
1869
  const transform = (() => { ${input.source}
1873
1870
  return transform; })();
1874
1871
  if (typeof transform !== 'function') throw new TypeError('transform \u5FC5\u987B\u662F\u51FD\u6570');
1875
- const serialize = output => {
1876
- if (output === undefined || typeof output !== 'object') {
1877
- throw new TypeError('transform \u5FC5\u987B\u8FD4\u56DE JSON \u5BF9\u8C61\u6216 null');
1878
- }
1879
- return JSON.stringify(output);
1880
- };
1881
- const output = transform(input, ctx);
1882
- return output && typeof output.then === 'function'
1883
- ? Promise.resolve(output).then(serialize)
1884
- : serialize(output);
1872
+ return Promise.resolve(transform(input, ctx)).then(output => JSON.stringify(output));
1885
1873
  })()
1886
1874
  `;
1887
1875
  const evaluated = run(() => context.evalCode(source));
@@ -1891,8 +1879,6 @@ async function execute(module2, input) {
1891
1879
  throw new Error(readQuickJsError(error));
1892
1880
  }
1893
1881
  try {
1894
- if (context.typeof(evaluated.value) !== "object")
1895
- return read(evaluated.value);
1896
1882
  let done = false;
1897
1883
  const settled = context.resolvePromise(evaluated.value).then((result2) => {
1898
1884
  done = true;
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");
@@ -2790,10 +2805,9 @@ var require_websocket = __commonJS({
2790
2805
  throw new SyntaxError(`Invalid URL: ${address}`);
2791
2806
  }
2792
2807
  }
2793
- if (parsedUrl.protocol === "http:") {
2794
- parsedUrl.protocol = "ws:";
2795
- } else if (parsedUrl.protocol === "https:") {
2796
- parsedUrl.protocol = "wss:";
2808
+ if (parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:") {
2809
+ parsedUrl = new URL2(parsedUrl);
2810
+ parsedUrl.protocol = parsedUrl.protocol === "http:" ? "ws:" : "wss:";
2797
2811
  }
2798
2812
  websocket._url = parsedUrl.href;
2799
2813
  const isSecure = parsedUrl.protocol === "wss:";
@@ -2862,12 +2876,19 @@ var require_websocket = __commonJS({
2862
2876
  }
2863
2877
  }
2864
2878
  if (parsedUrl.username || parsedUrl.password) {
2865
- opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
2879
+ const username = querystring.unescape(parsedUrl.username);
2880
+ const password = querystring.unescape(parsedUrl.password);
2881
+ opts.auth = `${username}:${password}`;
2866
2882
  }
2867
2883
  if (isIpcUrl) {
2868
- const parts = opts.path.split(":");
2869
- opts.socketPath = parts[0];
2870
- opts.path = parts[1];
2884
+ const i = opts.path.indexOf(":");
2885
+ if (i === -1) {
2886
+ opts.socketPath = opts.path;
2887
+ opts.path = "";
2888
+ } else {
2889
+ opts.socketPath = opts.path.slice(0, i);
2890
+ opts.path = opts.path.slice(i + 1);
2891
+ }
2871
2892
  }
2872
2893
  let req;
2873
2894
  if (opts.followRedirects) {
@@ -3062,8 +3083,13 @@ var require_websocket = __commonJS({
3062
3083
  function receiverOnConclude(code, reason) {
3063
3084
  const websocket = this[kWebSocket];
3064
3085
  websocket._closeFrameReceived = true;
3065
- websocket._closeMessage = reason;
3066
3086
  websocket._closeCode = code;
3087
+ if (reason.length === 0) {
3088
+ websocket._closeMessage = EMPTY_BUFFER;
3089
+ } else {
3090
+ websocket._closeMessage = Buffer.allocUnsafeSlow(reason.length);
3091
+ websocket._closeMessage.set(reason);
3092
+ }
3067
3093
  if (websocket._socket[kWebSocket] === void 0) return;
3068
3094
  websocket._socket.removeListener("data", socketOnData);
3069
3095
  process.nextTick(resume, websocket._socket);