linkque-cli-v2 1.6.16 → 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.
- package/dataTransformWorker.js +161 -89
- package/dev/worker.js +37 -11
- package/linkquejs.js +27708 -9430
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/data-transform/dataTransformWorker.js +161 -89
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-2O5AZ546.js → chunk-3BH2PDL3.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-JMBJJF7P.js → chunk-KRE5FADB.js} +37 -11
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ZQGBHENQ.js → chunk-L5WNKJ4W.js} +3147 -229
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ZK7HXMMY.js → chunk-M6E4Y5HY.js} +40001 -20775
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-DNTEEBEH.js → chunk-SICWMO5Y.js} +1 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-bsd-JGCLGHFY.js → getMachineId-bsd-NYGVHXGN.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-darwin-COHLFNXH.js → getMachineId-darwin-OPTJOAYC.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-linux-XV3Z5FQG.js → getMachineId-linux-5SQRYTUJ.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-unsupported-FCRKLIZL.js → getMachineId-unsupported-OJE7WPEH.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{getMachineId-win-A4WRNVV6.js → getMachineId-win-SLTTCNXU.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-KD7MXONK.js → google-generative-ai-YD5ZGNXC.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-TREYA472.js → google-vertex-M34UDW4J.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-OEOTQWE5.js → mistral-conversations-EIVAJAMW.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{otel-WGS5CC2J.js → otel-LQR5KPZ3.js} +579 -267
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +2299 -339
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +3 -4
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +3 -4
- package/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
- package/worker.js +46299 -26114
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-EAODRPW4.js +0 -518
package/package.json
CHANGED
|
@@ -1743,6 +1743,9 @@ function smartUnwrap(val) {
|
|
|
1743
1743
|
return val && "default" in val && val.default ? val.default && "default" in val.default && val.default.default ? val.default.default : val.default : val;
|
|
1744
1744
|
}
|
|
1745
1745
|
|
|
1746
|
+
// ../linkque-agent-runtime/dist/esm/core/aiFilter.js
|
|
1747
|
+
var DEFAULT_AI_FILTER_PROMPT = "\u6309\u7167\u7528\u6237\u539F\u59CB\u95EE\u9898\uFF0C\u5BF9\u8FD9\u4E9B\u6570\u636E\u8FDB\u884C\u7B5B\u9009\u548C\u6392\u5E8F";
|
|
1748
|
+
|
|
1746
1749
|
// ../linkque-agent-runtime/dist/esm/core/dataTransformWorker.js
|
|
1747
1750
|
void initialize();
|
|
1748
1751
|
async function initialize() {
|
|
@@ -1752,129 +1755,198 @@ async function initialize() {
|
|
|
1752
1755
|
if (input?.type !== "execute")
|
|
1753
1756
|
return;
|
|
1754
1757
|
const startedAt = Date.now();
|
|
1755
|
-
void execute(quickJs, input).then((resultJson) => {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
requestId: input.requestId,
|
|
1768
|
-
ok: false,
|
|
1769
|
-
code: classified.code,
|
|
1770
|
-
message: classified.message
|
|
1771
|
-
});
|
|
1772
|
-
});
|
|
1758
|
+
void execute(quickJs, input).then((resultJson) => import_node_worker_threads.parentPort?.postMessage({
|
|
1759
|
+
type: "result",
|
|
1760
|
+
requestId: input.requestId,
|
|
1761
|
+
ok: true,
|
|
1762
|
+
resultJson,
|
|
1763
|
+
durationMs: Date.now() - startedAt
|
|
1764
|
+
}), (error) => import_node_worker_threads.parentPort?.postMessage({
|
|
1765
|
+
type: "result",
|
|
1766
|
+
requestId: input.requestId,
|
|
1767
|
+
ok: false,
|
|
1768
|
+
...classifyError(error)
|
|
1769
|
+
}));
|
|
1773
1770
|
});
|
|
1774
1771
|
}
|
|
1775
1772
|
async function execute(module2, input) {
|
|
1776
1773
|
const runtime = module2.newRuntime();
|
|
1777
1774
|
runtime.setMemoryLimit(input.limits.memoryBytes);
|
|
1778
1775
|
runtime.setMaxStackSize(input.limits.stackBytes);
|
|
1779
|
-
|
|
1776
|
+
let remaining = input.limits.executionMs;
|
|
1777
|
+
let deadline = 0;
|
|
1780
1778
|
let interrupted = false;
|
|
1781
1779
|
runtime.setInterruptHandler(() => {
|
|
1782
1780
|
interrupted = Date.now() > deadline;
|
|
1783
1781
|
return interrupted;
|
|
1784
1782
|
});
|
|
1785
1783
|
const context = runtime.newContext();
|
|
1784
|
+
const pending = /* @__PURE__ */ new Map();
|
|
1785
|
+
let nextCallId = 1;
|
|
1786
|
+
let wake;
|
|
1787
|
+
const run = (callback) => {
|
|
1788
|
+
const started = Date.now();
|
|
1789
|
+
deadline = started + remaining;
|
|
1790
|
+
if (remaining <= 0)
|
|
1791
|
+
throw new Error("\u6570\u636E\u8F6C\u6362\u8D85\u8FC7\u6267\u884C\u65F6\u95F4\u9650\u5236");
|
|
1792
|
+
try {
|
|
1793
|
+
return callback();
|
|
1794
|
+
} finally {
|
|
1795
|
+
remaining -= Date.now() - started;
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
const read = (handle) => {
|
|
1799
|
+
const value = context.dump(handle);
|
|
1800
|
+
if (typeof value !== "string")
|
|
1801
|
+
throw new TypeError("transform \u7ED3\u679C\u65E0\u6CD5\u5E8F\u5217\u5316");
|
|
1802
|
+
return value;
|
|
1803
|
+
};
|
|
1804
|
+
const onResponse = (message) => {
|
|
1805
|
+
if (message?.type !== "filter-result" || message.requestId !== input.requestId)
|
|
1806
|
+
return;
|
|
1807
|
+
const promise = pending.get(message.callId);
|
|
1808
|
+
if (!promise)
|
|
1809
|
+
return;
|
|
1810
|
+
pending.delete(message.callId);
|
|
1811
|
+
const handle = message.error ? context.newError(message.error) : context.newString(JSON.stringify(message.indices));
|
|
1812
|
+
if (message.error)
|
|
1813
|
+
promise.reject(handle);
|
|
1814
|
+
else
|
|
1815
|
+
promise.resolve(handle);
|
|
1816
|
+
handle.dispose();
|
|
1817
|
+
promise.dispose();
|
|
1818
|
+
wake?.();
|
|
1819
|
+
};
|
|
1820
|
+
import_node_worker_threads.parentPort?.on("message", onResponse);
|
|
1786
1821
|
try {
|
|
1787
1822
|
if (input.mode === "validate") {
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
`);
|
|
1798
|
-
if (validated.error) {
|
|
1799
|
-
const dumped = context.dump(validated.error);
|
|
1800
|
-
validated.error.dispose();
|
|
1801
|
-
throw new Error(readQuickJsError(dumped));
|
|
1802
|
-
}
|
|
1803
|
-
const result2 = context.dump(validated.value);
|
|
1804
|
-
validated.value.dispose();
|
|
1805
|
-
if (typeof result2 !== "string")
|
|
1806
|
-
throw new TypeError("transform \u6E90\u7801\u6821\u9A8C\u5931\u8D25");
|
|
1807
|
-
return result2;
|
|
1823
|
+
const result = run(() => context.evalCode(`'use strict'; (() => { ${input.source}
|
|
1824
|
+
});`, void 0, { compileOnly: true }));
|
|
1825
|
+
if (result.error) {
|
|
1826
|
+
const error = context.dump(result.error);
|
|
1827
|
+
result.error.dispose();
|
|
1828
|
+
throw new Error(readQuickJsError(error));
|
|
1829
|
+
}
|
|
1830
|
+
result.value.dispose();
|
|
1831
|
+
return "{}";
|
|
1808
1832
|
}
|
|
1833
|
+
const host = context.newFunction("__hostFilter", (listHandle, promptHandle) => {
|
|
1834
|
+
const modelList = JSON.parse(context.getString(listHandle));
|
|
1835
|
+
const prompt = context.getString(promptHandle);
|
|
1836
|
+
const callId = nextCallId++;
|
|
1837
|
+
const promise = context.newPromise();
|
|
1838
|
+
pending.set(callId, promise);
|
|
1839
|
+
import_node_worker_threads.parentPort?.postMessage({
|
|
1840
|
+
type: "filter",
|
|
1841
|
+
requestId: input.requestId,
|
|
1842
|
+
callId,
|
|
1843
|
+
modelList,
|
|
1844
|
+
prompt
|
|
1845
|
+
});
|
|
1846
|
+
return promise.handle;
|
|
1847
|
+
});
|
|
1848
|
+
context.setProp(context.global, "__LINKQUE_FILTER__", host);
|
|
1849
|
+
host.dispose();
|
|
1809
1850
|
const inputHandle = context.newString(input.inputJson);
|
|
1810
1851
|
context.setProp(context.global, "__LINKQUE_INPUT_JSON__", inputHandle);
|
|
1811
1852
|
inputHandle.dispose();
|
|
1812
|
-
const
|
|
1853
|
+
const source = `
|
|
1813
1854
|
'use strict';
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1855
|
+
(() => {
|
|
1856
|
+
const hostFilter = globalThis.__LINKQUE_FILTER__;
|
|
1857
|
+
delete globalThis.__LINKQUE_FILTER__;
|
|
1858
|
+
const input = JSON.parse(globalThis.__LINKQUE_INPUT_JSON__);
|
|
1859
|
+
delete globalThis.__LINKQUE_INPUT_JSON__;
|
|
1860
|
+
const ctx = Object.freeze({ ai: Object.freeze({ filter: async (list, modelList = list, prompt = ${JSON.stringify(DEFAULT_AI_FILTER_PROMPT)}) => {
|
|
1861
|
+
if (!Array.isArray(list) || !Array.isArray(modelList)) throw new TypeError('AI \u7B5B\u9009\u8F93\u5165\u5FC5\u987B\u662F\u6570\u7EC4');
|
|
1862
|
+
if (list.length !== modelList.length) throw new TypeError('\u6A21\u578B\u6295\u5F71\u5FC5\u987B\u4E0E\u539F\u59CB\u6570\u7EC4\u7B49\u957F\u4E14\u987A\u5E8F\u4E00\u81F4');
|
|
1863
|
+
if (typeof prompt !== 'string') throw new TypeError('AI \u7B5B\u9009\u6307\u4EE4\u5FC5\u987B\u662F\u5B57\u7B26\u4E32');
|
|
1864
|
+
const original = list.slice();
|
|
1865
|
+
if (original.length === 0 || ${input.preview === true}) return original;
|
|
1866
|
+
const indices = JSON.parse(await hostFilter(JSON.stringify(modelList), prompt));
|
|
1867
|
+
return indices.map(index => original[index]);
|
|
1868
|
+
} }) });
|
|
1869
|
+
const transform = (() => { ${input.source}
|
|
1870
|
+
return transform; })();
|
|
1871
|
+
if (typeof transform !== 'function') throw new TypeError('transform \u5FC5\u987B\u662F\u51FD\u6570');
|
|
1872
|
+
return Promise.resolve(transform(input, ctx)).then(output => JSON.stringify(output));
|
|
1873
|
+
})()
|
|
1874
|
+
`;
|
|
1875
|
+
const evaluated = run(() => context.evalCode(source));
|
|
1831
1876
|
if (evaluated.error) {
|
|
1832
|
-
const
|
|
1877
|
+
const error = context.dump(evaluated.error);
|
|
1833
1878
|
evaluated.error.dispose();
|
|
1834
|
-
|
|
1835
|
-
throw new TransformWorkerError("timeout");
|
|
1836
|
-
throw new Error(readQuickJsError(dumped));
|
|
1879
|
+
throw new Error(readQuickJsError(error));
|
|
1837
1880
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1881
|
+
try {
|
|
1882
|
+
let done = false;
|
|
1883
|
+
const settled = context.resolvePromise(evaluated.value).then((result2) => {
|
|
1884
|
+
done = true;
|
|
1885
|
+
wake?.();
|
|
1886
|
+
return result2;
|
|
1887
|
+
});
|
|
1888
|
+
for (; ; ) {
|
|
1889
|
+
import_node_worker_threads.parentPort?.postMessage({
|
|
1890
|
+
type: "running",
|
|
1891
|
+
requestId: input.requestId
|
|
1892
|
+
});
|
|
1893
|
+
const jobs = run(() => runtime.executePendingJobs());
|
|
1894
|
+
if (jobs.error) {
|
|
1895
|
+
const error = context.dump(jobs.error);
|
|
1896
|
+
jobs.error.dispose();
|
|
1897
|
+
throw new Error(readQuickJsError(error));
|
|
1898
|
+
}
|
|
1899
|
+
await Promise.resolve();
|
|
1900
|
+
if (done)
|
|
1901
|
+
break;
|
|
1902
|
+
if (pending.size === 0)
|
|
1903
|
+
throw new Error("\u5F02\u6B65\u8F6C\u6362\u672A\u5B8C\u6210\u4E14\u6CA1\u6709\u53EF\u7B49\u5F85\u7684\u5BBF\u4E3B\u8BF7\u6C42");
|
|
1904
|
+
import_node_worker_threads.parentPort?.postMessage({
|
|
1905
|
+
type: "waiting",
|
|
1906
|
+
requestId: input.requestId
|
|
1907
|
+
});
|
|
1908
|
+
await new Promise((resolve) => {
|
|
1909
|
+
wake = resolve;
|
|
1910
|
+
});
|
|
1911
|
+
wake = void 0;
|
|
1912
|
+
}
|
|
1913
|
+
const result = await settled;
|
|
1914
|
+
if (result.error) {
|
|
1915
|
+
const error = context.dump(result.error);
|
|
1916
|
+
result.error.dispose();
|
|
1917
|
+
throw new Error(readQuickJsError(error));
|
|
1918
|
+
}
|
|
1919
|
+
try {
|
|
1920
|
+
return read(result.value);
|
|
1921
|
+
} finally {
|
|
1922
|
+
result.value.dispose();
|
|
1923
|
+
}
|
|
1924
|
+
} finally {
|
|
1925
|
+
evaluated.value.dispose();
|
|
1842
1926
|
}
|
|
1843
|
-
|
|
1927
|
+
} catch (error) {
|
|
1928
|
+
if (interrupted || remaining <= 0)
|
|
1929
|
+
throw new Error("\u6570\u636E\u8F6C\u6362\u8D85\u8FC7\u6267\u884C\u65F6\u95F4\u9650\u5236", { cause: error });
|
|
1930
|
+
throw error;
|
|
1844
1931
|
} finally {
|
|
1932
|
+
import_node_worker_threads.parentPort?.off("message", onResponse);
|
|
1933
|
+
for (const promise of pending.values())
|
|
1934
|
+
promise.dispose();
|
|
1845
1935
|
context.dispose();
|
|
1846
1936
|
runtime.dispose();
|
|
1847
1937
|
}
|
|
1848
1938
|
}
|
|
1849
|
-
var TransformWorkerError = class extends Error {
|
|
1850
|
-
kind;
|
|
1851
|
-
constructor(kind) {
|
|
1852
|
-
super(kind);
|
|
1853
|
-
this.kind = kind;
|
|
1854
|
-
}
|
|
1855
|
-
};
|
|
1856
1939
|
function classifyError(error) {
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
};
|
|
1862
|
-
}
|
|
1863
|
-
const message = sanitizeError(error);
|
|
1864
|
-
if (/out of memory|stack overflow|allocation failed/iu.test(message)) {
|
|
1940
|
+
const message = error instanceof Error ? error.message.slice(0, 500) : "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5931\u8D25";
|
|
1941
|
+
if (/超过执行时间限制/u.test(message))
|
|
1942
|
+
return { code: "CARD_TRANSFORM_TIMEOUT", message };
|
|
1943
|
+
if (/out of memory|stack overflow|allocation failed/iu.test(message))
|
|
1865
1944
|
return {
|
|
1866
1945
|
code: "CARD_TRANSFORM_RESOURCE_EXCEEDED",
|
|
1867
1946
|
message: "\u6570\u636E\u8F6C\u6362\u8D85\u8FC7\u5185\u5B58\u6216\u6808\u9650\u5236"
|
|
1868
1947
|
};
|
|
1869
|
-
}
|
|
1870
1948
|
return { code: "CARD_TRANSFORM_FAILED", message };
|
|
1871
1949
|
}
|
|
1872
1950
|
function readQuickJsError(value) {
|
|
1873
|
-
|
|
1874
|
-
return value.message;
|
|
1875
|
-
}
|
|
1876
|
-
return "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5931\u8D25";
|
|
1877
|
-
}
|
|
1878
|
-
function sanitizeError(error) {
|
|
1879
|
-
return error instanceof Error && error.message.trim() ? error.message.slice(0, 500) : "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5931\u8D25";
|
|
1951
|
+
return value && typeof value === "object" && "message" in value && typeof value.message === "string" ? value.message : "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5931\u8D25";
|
|
1880
1952
|
}
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-JMBJJF7P.js → chunk-KRE5FADB.js}
RENAMED
|
@@ -9350,6 +9350,7 @@ var require_constants = __commonJS({
|
|
|
9350
9350
|
var require_buffer_util = __commonJS({
|
|
9351
9351
|
"../../node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
9352
9352
|
"use strict";
|
|
9353
|
+
var { websocketMask, websocketUnmask } = __require("http");
|
|
9353
9354
|
var { EMPTY_BUFFER } = require_constants();
|
|
9354
9355
|
var FastBuffer = Buffer[Symbol.species];
|
|
9355
9356
|
function concat(list, totalLength) {
|
|
@@ -9404,7 +9405,16 @@ var require_buffer_util = __commonJS({
|
|
|
9404
9405
|
toBuffer,
|
|
9405
9406
|
unmask: _unmask
|
|
9406
9407
|
};
|
|
9407
|
-
if (
|
|
9408
|
+
if (websocketMask) {
|
|
9409
|
+
module.exports.mask = function(source, mask, output, offset, length) {
|
|
9410
|
+
if (length < 24) _mask(source, mask, output, offset, length);
|
|
9411
|
+
else websocketMask(source, mask, output, offset, length);
|
|
9412
|
+
};
|
|
9413
|
+
module.exports.unmask = function(buffer, mask) {
|
|
9414
|
+
if (buffer.length < 24) _unmask(buffer, mask);
|
|
9415
|
+
else websocketUnmask(buffer, mask);
|
|
9416
|
+
};
|
|
9417
|
+
} else if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
9408
9418
|
try {
|
|
9409
9419
|
const bufferUtil = __require("bufferutil");
|
|
9410
9420
|
module.exports.mask = function(source, mask, output, offset, length) {
|
|
@@ -10467,6 +10477,7 @@ var require_receiver = __commonJS({
|
|
|
10467
10477
|
unmask(data, this._mask);
|
|
10468
10478
|
}
|
|
10469
10479
|
}
|
|
10480
|
+
this._mask = void 0;
|
|
10470
10481
|
if (this._opcode > 7) {
|
|
10471
10482
|
this.controlMessage(data, cb);
|
|
10472
10483
|
return;
|
|
@@ -10799,12 +10810,15 @@ var require_sender = __commonJS({
|
|
|
10799
10810
|
target[2] = target[3] = 0;
|
|
10800
10811
|
target.writeUIntBE(dataLength, 4, 6);
|
|
10801
10812
|
}
|
|
10802
|
-
if (!options.mask)
|
|
10813
|
+
if (!options.mask) {
|
|
10814
|
+
return dataLength ? [target, data] : [target];
|
|
10815
|
+
}
|
|
10803
10816
|
target[1] |= 128;
|
|
10804
10817
|
target[offset - 4] = mask[0];
|
|
10805
10818
|
target[offset - 3] = mask[1];
|
|
10806
10819
|
target[offset - 2] = mask[2];
|
|
10807
10820
|
target[offset - 1] = mask[3];
|
|
10821
|
+
if (!dataLength) return [target];
|
|
10808
10822
|
if (skipMasking) return [target, data];
|
|
10809
10823
|
if (merge) {
|
|
10810
10824
|
applyMask(data, mask, target, offset, dataLength);
|
|
@@ -11561,6 +11575,7 @@ var require_websocket = __commonJS({
|
|
|
11561
11575
|
var https = __require("https");
|
|
11562
11576
|
var http = __require("http");
|
|
11563
11577
|
var net = __require("net");
|
|
11578
|
+
var querystring = __require("querystring");
|
|
11564
11579
|
var tls = __require("tls");
|
|
11565
11580
|
var { randomBytes, createHash } = __require("crypto");
|
|
11566
11581
|
var { Duplex, Readable: Readable2 } = __require("stream");
|
|
@@ -12087,10 +12102,9 @@ var require_websocket = __commonJS({
|
|
|
12087
12102
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
12088
12103
|
}
|
|
12089
12104
|
}
|
|
12090
|
-
if (parsedUrl.protocol === "http:") {
|
|
12091
|
-
parsedUrl
|
|
12092
|
-
|
|
12093
|
-
parsedUrl.protocol = "wss:";
|
|
12105
|
+
if (parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:") {
|
|
12106
|
+
parsedUrl = new URL2(parsedUrl);
|
|
12107
|
+
parsedUrl.protocol = parsedUrl.protocol === "http:" ? "ws:" : "wss:";
|
|
12094
12108
|
}
|
|
12095
12109
|
websocket._url = parsedUrl.href;
|
|
12096
12110
|
const isSecure = parsedUrl.protocol === "wss:";
|
|
@@ -12159,12 +12173,19 @@ var require_websocket = __commonJS({
|
|
|
12159
12173
|
}
|
|
12160
12174
|
}
|
|
12161
12175
|
if (parsedUrl.username || parsedUrl.password) {
|
|
12162
|
-
|
|
12176
|
+
const username = querystring.unescape(parsedUrl.username);
|
|
12177
|
+
const password = querystring.unescape(parsedUrl.password);
|
|
12178
|
+
opts.auth = `${username}:${password}`;
|
|
12163
12179
|
}
|
|
12164
12180
|
if (isIpcUrl) {
|
|
12165
|
-
const
|
|
12166
|
-
|
|
12167
|
-
|
|
12181
|
+
const i = opts.path.indexOf(":");
|
|
12182
|
+
if (i === -1) {
|
|
12183
|
+
opts.socketPath = opts.path;
|
|
12184
|
+
opts.path = "";
|
|
12185
|
+
} else {
|
|
12186
|
+
opts.socketPath = opts.path.slice(0, i);
|
|
12187
|
+
opts.path = opts.path.slice(i + 1);
|
|
12188
|
+
}
|
|
12168
12189
|
}
|
|
12169
12190
|
let req;
|
|
12170
12191
|
if (opts.followRedirects) {
|
|
@@ -12359,8 +12380,13 @@ var require_websocket = __commonJS({
|
|
|
12359
12380
|
function receiverOnConclude(code, reason) {
|
|
12360
12381
|
const websocket = this[kWebSocket];
|
|
12361
12382
|
websocket._closeFrameReceived = true;
|
|
12362
|
-
websocket._closeMessage = reason;
|
|
12363
12383
|
websocket._closeCode = code;
|
|
12384
|
+
if (reason.length === 0) {
|
|
12385
|
+
websocket._closeMessage = EMPTY_BUFFER;
|
|
12386
|
+
} else {
|
|
12387
|
+
websocket._closeMessage = Buffer.allocUnsafeSlow(reason.length);
|
|
12388
|
+
websocket._closeMessage.set(reason);
|
|
12389
|
+
}
|
|
12364
12390
|
if (websocket._socket[kWebSocket] === void 0) return;
|
|
12365
12391
|
websocket._socket.removeListener("data", socketOnData);
|
|
12366
12392
|
process.nextTick(resume, websocket._socket);
|