linkque-cli-v2 1.6.6 → 1.6.8
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/linkquejs.js +98 -28
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-FH2M6YD6.js → chunk-OYT6HQOV.js} +131 -29
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ICPH34ZQ.js → chunk-U6OH2FQV.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-FC6S43DG.js → chunk-UAOFFEXJ.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +19 -36
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
- package/worker.js +116 -50
package/linkquejs.js
CHANGED
|
@@ -6763,6 +6763,37 @@ var require_utils = __commonJS({
|
|
|
6763
6763
|
}
|
|
6764
6764
|
return output.join("");
|
|
6765
6765
|
}
|
|
6766
|
+
function removeDotSegmentsRelative(path24) {
|
|
6767
|
+
if (path24 === "" || path24[0] === "/") {
|
|
6768
|
+
return removeDotSegments(path24);
|
|
6769
|
+
}
|
|
6770
|
+
const segments = path24.split("/");
|
|
6771
|
+
const last = segments.length - 1;
|
|
6772
|
+
const output = [];
|
|
6773
|
+
let trailingDirectory = false;
|
|
6774
|
+
for (let i = 0; i <= last; i++) {
|
|
6775
|
+
const segment = segments[i];
|
|
6776
|
+
if (segment === "." || segment === "..") {
|
|
6777
|
+
if (segment === "..") {
|
|
6778
|
+
if (output.length !== 0 && output[output.length - 1] !== "..") {
|
|
6779
|
+
output.pop();
|
|
6780
|
+
} else {
|
|
6781
|
+
output.push("..");
|
|
6782
|
+
}
|
|
6783
|
+
}
|
|
6784
|
+
trailingDirectory = i === last;
|
|
6785
|
+
} else {
|
|
6786
|
+
output.push(segment);
|
|
6787
|
+
}
|
|
6788
|
+
}
|
|
6789
|
+
if (trailingDirectory && output[output.length - 1] !== "..") {
|
|
6790
|
+
output.push("");
|
|
6791
|
+
}
|
|
6792
|
+
if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
|
|
6793
|
+
output.unshift(".");
|
|
6794
|
+
}
|
|
6795
|
+
return output.join("/");
|
|
6796
|
+
}
|
|
6766
6797
|
var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
|
|
6767
6798
|
var HOST_DELIM_RE = /[@/?#:]/g;
|
|
6768
6799
|
var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
@@ -7023,6 +7054,7 @@ var require_utils = __commonJS({
|
|
|
7023
7054
|
encodeFragment,
|
|
7024
7055
|
escapePreservingEscapes,
|
|
7025
7056
|
removeDotSegments,
|
|
7057
|
+
removeDotSegmentsRelative,
|
|
7026
7058
|
isIPv4,
|
|
7027
7059
|
isUUID,
|
|
7028
7060
|
normalizeIPv6,
|
|
@@ -7246,16 +7278,18 @@ var require_schemes = __commonJS({
|
|
|
7246
7278
|
var require_fast_uri = __commonJS({
|
|
7247
7279
|
"../../node_modules/fast-uri/index.js"(exports2, module2) {
|
|
7248
7280
|
"use strict";
|
|
7249
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
7281
|
+
var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
7250
7282
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
7251
7283
|
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
7252
7284
|
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7285
|
+
var MALFORMED_HOST_ERROR = "URI host is malformed.";
|
|
7286
|
+
var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
|
|
7287
|
+
function validateScheme(scheme) {
|
|
7288
|
+
const stringScheme = String(scheme);
|
|
7289
|
+
if (!VALID_SCHEME.test(stringScheme)) {
|
|
7256
7290
|
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
7257
7291
|
}
|
|
7258
|
-
return
|
|
7292
|
+
return stringScheme;
|
|
7259
7293
|
}
|
|
7260
7294
|
function normalize(uri, options) {
|
|
7261
7295
|
if (typeof uri === "string") {
|
|
@@ -7292,6 +7326,9 @@ var require_fast_uri = __commonJS({
|
|
|
7292
7326
|
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
7293
7327
|
const resolvedHost = resolved.host;
|
|
7294
7328
|
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
7329
|
+
if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
|
|
7330
|
+
throw new Error(MALFORMED_HOST_ERROR);
|
|
7331
|
+
}
|
|
7295
7332
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
7296
7333
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
7297
7334
|
if (resolved.error && !encodedASCIIHost) {
|
|
@@ -7333,14 +7370,15 @@ var require_fast_uri = __commonJS({
|
|
|
7333
7370
|
if (relative.path[0] === "/") {
|
|
7334
7371
|
target.path = removeDotSegments(relative.path);
|
|
7335
7372
|
} else {
|
|
7336
|
-
|
|
7373
|
+
const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
|
|
7374
|
+
if (baseHasAuthority && !base.path) {
|
|
7337
7375
|
target.path = "/" + relative.path;
|
|
7338
7376
|
} else if (!base.path) {
|
|
7339
7377
|
target.path = relative.path;
|
|
7340
7378
|
} else {
|
|
7341
7379
|
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
7342
7380
|
}
|
|
7343
|
-
target.path = removeDotSegments(target.path);
|
|
7381
|
+
target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
|
|
7344
7382
|
}
|
|
7345
7383
|
target.query = relative.query;
|
|
7346
7384
|
}
|
|
@@ -7378,12 +7416,13 @@ var require_fast_uri = __commonJS({
|
|
|
7378
7416
|
const options = Object.assign({}, opts);
|
|
7379
7417
|
const uriTokens = [];
|
|
7380
7418
|
if (component.scheme) {
|
|
7381
|
-
component.scheme =
|
|
7419
|
+
component.scheme = validateScheme(component.scheme);
|
|
7382
7420
|
}
|
|
7383
7421
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
7384
7422
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
7385
7423
|
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
7386
|
-
const
|
|
7424
|
+
const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
|
|
7425
|
+
const pathNoScheme = !options.skipEscape && schemelessReference;
|
|
7387
7426
|
if (component.path !== void 0) {
|
|
7388
7427
|
if (!options.skipEscape) {
|
|
7389
7428
|
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
@@ -7392,7 +7431,7 @@ var require_fast_uri = __commonJS({
|
|
|
7392
7431
|
}
|
|
7393
7432
|
}
|
|
7394
7433
|
if (options.reference !== "suffix" && component.scheme) {
|
|
7395
|
-
component.scheme =
|
|
7434
|
+
component.scheme = validateScheme(component.scheme);
|
|
7396
7435
|
uriTokens.push(component.scheme, ":");
|
|
7397
7436
|
}
|
|
7398
7437
|
const authority = recomposeAuthority(component);
|
|
@@ -7408,9 +7447,9 @@ var require_fast_uri = __commonJS({
|
|
|
7408
7447
|
if (component.path !== void 0) {
|
|
7409
7448
|
let s4 = component.path;
|
|
7410
7449
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
7411
|
-
s4 = removeDotSegments(s4);
|
|
7450
|
+
s4 = schemelessReference && s4[0] !== "/" ? removeDotSegmentsRelative(s4) : removeDotSegments(s4);
|
|
7412
7451
|
}
|
|
7413
|
-
if (
|
|
7452
|
+
if (schemelessReference) {
|
|
7414
7453
|
s4 = serializePathEncoding(s4, true);
|
|
7415
7454
|
}
|
|
7416
7455
|
if (authority === void 0 && s4[0] === "/" && s4[1] === "/") {
|
|
@@ -7457,16 +7496,34 @@ var require_fast_uri = __commonJS({
|
|
|
7457
7496
|
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
7458
7497
|
}
|
|
7459
7498
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
7499
|
+
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
|
|
7500
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
7501
|
+
return true;
|
|
7502
|
+
}
|
|
7460
7503
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
7504
|
+
let url2;
|
|
7461
7505
|
try {
|
|
7462
|
-
|
|
7506
|
+
url2 = new URL("http://" + parsed.host);
|
|
7463
7507
|
} catch (e3) {
|
|
7464
7508
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e3;
|
|
7465
7509
|
return true;
|
|
7466
7510
|
}
|
|
7511
|
+
if (!isHostOnlyURL(url2)) {
|
|
7512
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
7513
|
+
return true;
|
|
7514
|
+
}
|
|
7515
|
+
parsed.host = url2.hostname;
|
|
7467
7516
|
}
|
|
7468
7517
|
return false;
|
|
7469
7518
|
}
|
|
7519
|
+
function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
|
|
7520
|
+
return Boolean(
|
|
7521
|
+
parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
|
|
7522
|
+
);
|
|
7523
|
+
}
|
|
7524
|
+
function isHostOnlyURL(url2) {
|
|
7525
|
+
return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
|
|
7526
|
+
}
|
|
7470
7527
|
function parseWithStatus(uri, opts) {
|
|
7471
7528
|
const options = Object.assign({}, opts);
|
|
7472
7529
|
const parsed = {
|
|
@@ -7521,9 +7578,8 @@ var require_fast_uri = __commonJS({
|
|
|
7521
7578
|
parsed.query = matches[7];
|
|
7522
7579
|
parsed.fragment = matches[8];
|
|
7523
7580
|
if (parsed.scheme !== void 0) {
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
parsed.scheme = decodedScheme.toLowerCase();
|
|
7581
|
+
if (VALID_SCHEME.test(parsed.scheme)) {
|
|
7582
|
+
parsed.scheme = parsed.scheme.toLowerCase();
|
|
7527
7583
|
} else {
|
|
7528
7584
|
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
7529
7585
|
malformedScheme = true;
|
|
@@ -7551,7 +7607,7 @@ var require_fast_uri = __commonJS({
|
|
|
7551
7607
|
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
7552
7608
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
7553
7609
|
if (malformedIPLiteral) {
|
|
7554
|
-
parsed.error = parsed.error ||
|
|
7610
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
7555
7611
|
malformedAuthorityOrPort = true;
|
|
7556
7612
|
}
|
|
7557
7613
|
} else {
|
|
@@ -7579,7 +7635,7 @@ var require_fast_uri = __commonJS({
|
|
|
7579
7635
|
if (!isIP) {
|
|
7580
7636
|
host = normalizePercentEncoding(host.toLowerCase());
|
|
7581
7637
|
}
|
|
7582
|
-
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
7638
|
+
parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
|
|
7583
7639
|
}
|
|
7584
7640
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
7585
7641
|
if (parsed.path) {
|
|
@@ -35750,11 +35806,11 @@ var RUN_TABLE_COLUMNS = [
|
|
|
35750
35806
|
},
|
|
35751
35807
|
{
|
|
35752
35808
|
key: "lines",
|
|
35753
|
-
type: "
|
|
35809
|
+
type: "longtext",
|
|
35754
35810
|
required: false,
|
|
35755
35811
|
array: true,
|
|
35756
|
-
// 单条 SSE data 行可能承载完整 A2UI Config,使用
|
|
35757
|
-
size:
|
|
35812
|
+
// 单条 SSE data 行可能承载完整 A2UI Config,使用 longtext 数组避免 varchar 长度限制。
|
|
35813
|
+
size: 0,
|
|
35758
35814
|
default: null
|
|
35759
35815
|
},
|
|
35760
35816
|
{
|
|
@@ -38444,6 +38500,7 @@ var ERR_INVALID_UNIX_ID_SIZE = "uid/gid must be 0..65535 for unixExtraFieldType
|
|
|
38444
38500
|
var ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be integer 0..255)";
|
|
38445
38501
|
var ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
38446
38502
|
var ERR_INVALID_LEVEL = "Invalid level (must be integer 0..9)";
|
|
38503
|
+
var ERR_INVALID_UNCOMPRESSED_SIZE_OPTION = "Invalid uncompressedSize option (must be a non-negative integer)";
|
|
38447
38504
|
var ERR_INVALID_SIGNATURE_DATA = "Signature data exceeds 64KB";
|
|
38448
38505
|
var ERR_INVALID_ENTRY = "Invalid entry option (must be an entry returned by ZipReader#getEntries())";
|
|
38449
38506
|
var ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
@@ -39216,8 +39273,10 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
39216
39273
|
let maximumCompressedSize = 0;
|
|
39217
39274
|
let uncompressedSize = 0;
|
|
39218
39275
|
let unknownSize = false;
|
|
39276
|
+
const uncompressedSizeOption = toNumber(options[PROPERTY_NAME_UNCOMPRESSED_SIZE]);
|
|
39277
|
+
checkIntegerOption(uncompressedSizeOption, Number.MAX_SAFE_INTEGER, ERR_INVALID_UNCOMPRESSED_SIZE_OPTION);
|
|
39219
39278
|
if (passThroughCompression && hasContent) {
|
|
39220
|
-
uncompressedSize =
|
|
39279
|
+
uncompressedSize = uncompressedSizeOption;
|
|
39221
39280
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
39222
39281
|
throw new Error(ERR_UNDEFINED_UNCOMPRESSED_SIZE);
|
|
39223
39282
|
}
|
|
@@ -39238,14 +39297,14 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
39238
39297
|
const encryptionOverhead = getEncryptionOverhead(encryptedEntry, zipCrypto, encryptionStrength);
|
|
39239
39298
|
if (hasContent) {
|
|
39240
39299
|
if (!passThroughCompression) {
|
|
39241
|
-
|
|
39242
|
-
|
|
39300
|
+
const expectedSize = contentSize === UNDEFINED_VALUE ? uncompressedSizeOption : contentSize;
|
|
39301
|
+
if (expectedSize === UNDEFINED_VALUE) {
|
|
39243
39302
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
39244
39303
|
zip64 = unknownSize = true;
|
|
39245
39304
|
maximumCompressedSize = MAX_32_BITS + 1;
|
|
39246
39305
|
}
|
|
39247
39306
|
} else {
|
|
39248
|
-
options.uncompressedSize = uncompressedSize =
|
|
39307
|
+
options.uncompressedSize = uncompressedSize = expectedSize;
|
|
39249
39308
|
maximumCompressedSize = (isCompressed(compressionMethod, level) ? getMaximumCompressedSize(uncompressedSize) : uncompressedSize) + encryptionOverhead;
|
|
39250
39309
|
}
|
|
39251
39310
|
} else {
|
|
@@ -39254,7 +39313,9 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
39254
39313
|
}
|
|
39255
39314
|
}
|
|
39256
39315
|
const emptyEntry = !encryptedEntry && (!hasContent || contentSize === 0 && !passThroughCompression) && !isCompressed(compressionMethod, level);
|
|
39257
|
-
|
|
39316
|
+
const crc32Provided = options.crc32 !== UNDEFINED_VALUE || options[PROPERTY_NAME_SIGNATURE] !== UNDEFINED_VALUE;
|
|
39317
|
+
const completeHeader = passThroughCompression && hasContent && contentSize !== UNDEFINED_VALUE && !(encryptedEntry && zipCrypto) && (crc32Provided || encryptedEntry && !zipCrypto);
|
|
39318
|
+
if ((emptyEntry || completeHeader) && getOptionValue2(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
39258
39319
|
dataDescriptor = false;
|
|
39259
39320
|
}
|
|
39260
39321
|
const zip64UncompressedSize = zip64Enabled || unknownSize || uncompressedSize >= MAX_32_BITS;
|
|
@@ -39272,6 +39333,8 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
39272
39333
|
resolvedOptions: {
|
|
39273
39334
|
dataDescriptor,
|
|
39274
39335
|
emptyEntry,
|
|
39336
|
+
completeHeader,
|
|
39337
|
+
knownCompressedSize: completeHeader ? maximumCompressedSize : UNDEFINED_VALUE,
|
|
39275
39338
|
zip64,
|
|
39276
39339
|
zip64Enabled,
|
|
39277
39340
|
unknownSize,
|
|
@@ -39293,6 +39356,7 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
39293
39356
|
keepOrder,
|
|
39294
39357
|
dataDescriptor,
|
|
39295
39358
|
emptyEntry,
|
|
39359
|
+
completeHeader,
|
|
39296
39360
|
signal
|
|
39297
39361
|
} = options;
|
|
39298
39362
|
const {
|
|
@@ -39314,7 +39378,7 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
39314
39378
|
const lockPreviousFileEntry = keepOrder && previousFileEntry ? previousFileEntry.lockFileEntry : UNDEFINED_VALUE;
|
|
39315
39379
|
fileEntries.set(name, fileEntry);
|
|
39316
39380
|
try {
|
|
39317
|
-
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || zipWriter.directWrites || !dataDescriptor && !emptyEntry) {
|
|
39381
|
+
if (options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || zipWriter.directWrites || !dataDescriptor && !emptyEntry && !completeHeader) {
|
|
39318
39382
|
bufferedWrite = true;
|
|
39319
39383
|
zipWriter.bufferedWrites++;
|
|
39320
39384
|
if (options.createTempStream) {
|
|
@@ -39657,10 +39721,12 @@ function getHeaderInfo(options) {
|
|
|
39657
39721
|
zip64UncompressedSize,
|
|
39658
39722
|
zip64CompressedSize,
|
|
39659
39723
|
uncompressedSize,
|
|
39724
|
+
knownCompressedSize,
|
|
39660
39725
|
unknownSize,
|
|
39661
39726
|
crc32
|
|
39662
39727
|
} = options;
|
|
39663
39728
|
let { version: version3, compressionMethod } = options;
|
|
39729
|
+
const compressedSize = dataDescriptor ? UNDEFINED_VALUE : knownCompressedSize;
|
|
39664
39730
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
39665
39731
|
let rawLocalExtraFieldZip64;
|
|
39666
39732
|
const uncompressedFile = passThroughCompression || !compressed;
|
|
@@ -39676,7 +39742,7 @@ function getHeaderInfo(options) {
|
|
|
39676
39742
|
extraFieldZip64.writeUint64(uncompressedSize);
|
|
39677
39743
|
if (uncompressedFile) {
|
|
39678
39744
|
const encryptionOverhead = getEncryptionOverhead(encrypted, zipCrypto, encryptionStrength);
|
|
39679
|
-
extraFieldZip64.writeUint64(passThroughCompression ? 0 : uncompressedSize + encryptionOverhead);
|
|
39745
|
+
extraFieldZip64.writeUint64(passThroughCompression ? compressedSize === UNDEFINED_VALUE ? 0 : compressedSize : uncompressedSize + encryptionOverhead);
|
|
39680
39746
|
}
|
|
39681
39747
|
}
|
|
39682
39748
|
} else {
|
|
@@ -39814,6 +39880,7 @@ function getHeaderInfo(options) {
|
|
|
39814
39880
|
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
|
|
39815
39881
|
compressionMethod,
|
|
39816
39882
|
uncompressedSize,
|
|
39883
|
+
compressedSize,
|
|
39817
39884
|
lastModDate: clampedLastModDate,
|
|
39818
39885
|
rawLastModDate: rawLastModDateOption,
|
|
39819
39886
|
rawFilename,
|
|
@@ -39821,6 +39888,9 @@ function getHeaderInfo(options) {
|
|
|
39821
39888
|
zip64UncompressedSize,
|
|
39822
39889
|
extraFieldLength
|
|
39823
39890
|
});
|
|
39891
|
+
if (compressedSize !== UNDEFINED_VALUE && passThroughCompression && crc32 !== UNDEFINED_VALUE) {
|
|
39892
|
+
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
39893
|
+
}
|
|
39824
39894
|
const localHeader = createRecordWriter(HEADER_SIZE + getLength(rawFilename) + extraFieldLength);
|
|
39825
39895
|
const localHeaderArray = localHeader.array;
|
|
39826
39896
|
const localHeaderView = getDataView(localHeaderArray);
|
package/package.json
CHANGED
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-FH2M6YD6.js → chunk-OYT6HQOV.js}
RENAMED
|
@@ -3703,6 +3703,37 @@ var require_utils = __commonJS({
|
|
|
3703
3703
|
}
|
|
3704
3704
|
return output.join("");
|
|
3705
3705
|
}
|
|
3706
|
+
function removeDotSegmentsRelative(path2) {
|
|
3707
|
+
if (path2 === "" || path2[0] === "/") {
|
|
3708
|
+
return removeDotSegments(path2);
|
|
3709
|
+
}
|
|
3710
|
+
const segments = path2.split("/");
|
|
3711
|
+
const last = segments.length - 1;
|
|
3712
|
+
const output = [];
|
|
3713
|
+
let trailingDirectory = false;
|
|
3714
|
+
for (let i = 0; i <= last; i++) {
|
|
3715
|
+
const segment = segments[i];
|
|
3716
|
+
if (segment === "." || segment === "..") {
|
|
3717
|
+
if (segment === "..") {
|
|
3718
|
+
if (output.length !== 0 && output[output.length - 1] !== "..") {
|
|
3719
|
+
output.pop();
|
|
3720
|
+
} else {
|
|
3721
|
+
output.push("..");
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3724
|
+
trailingDirectory = i === last;
|
|
3725
|
+
} else {
|
|
3726
|
+
output.push(segment);
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
if (trailingDirectory && output[output.length - 1] !== "..") {
|
|
3730
|
+
output.push("");
|
|
3731
|
+
}
|
|
3732
|
+
if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
|
|
3733
|
+
output.unshift(".");
|
|
3734
|
+
}
|
|
3735
|
+
return output.join("/");
|
|
3736
|
+
}
|
|
3706
3737
|
var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
|
|
3707
3738
|
var HOST_DELIM_RE = /[@/?#:]/g;
|
|
3708
3739
|
var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
@@ -3963,6 +3994,7 @@ var require_utils = __commonJS({
|
|
|
3963
3994
|
encodeFragment,
|
|
3964
3995
|
escapePreservingEscapes,
|
|
3965
3996
|
removeDotSegments,
|
|
3997
|
+
removeDotSegmentsRelative,
|
|
3966
3998
|
isIPv4,
|
|
3967
3999
|
isUUID,
|
|
3968
4000
|
normalizeIPv6,
|
|
@@ -4186,16 +4218,18 @@ var require_schemes = __commonJS({
|
|
|
4186
4218
|
var require_fast_uri = __commonJS({
|
|
4187
4219
|
"../../node_modules/fast-uri/index.js"(exports, module) {
|
|
4188
4220
|
"use strict";
|
|
4189
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4221
|
+
var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4190
4222
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
4191
4223
|
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
4192
4224
|
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4225
|
+
var MALFORMED_HOST_ERROR = "URI host is malformed.";
|
|
4226
|
+
var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
|
|
4227
|
+
function validateScheme(scheme) {
|
|
4228
|
+
const stringScheme = String(scheme);
|
|
4229
|
+
if (!VALID_SCHEME.test(stringScheme)) {
|
|
4196
4230
|
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
4197
4231
|
}
|
|
4198
|
-
return
|
|
4232
|
+
return stringScheme;
|
|
4199
4233
|
}
|
|
4200
4234
|
function normalize(uri, options) {
|
|
4201
4235
|
if (typeof uri === "string") {
|
|
@@ -4232,6 +4266,9 @@ var require_fast_uri = __commonJS({
|
|
|
4232
4266
|
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
4233
4267
|
const resolvedHost = resolved.host;
|
|
4234
4268
|
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
4269
|
+
if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
|
|
4270
|
+
throw new Error(MALFORMED_HOST_ERROR);
|
|
4271
|
+
}
|
|
4235
4272
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
4236
4273
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
4237
4274
|
if (resolved.error && !encodedASCIIHost) {
|
|
@@ -4273,14 +4310,15 @@ var require_fast_uri = __commonJS({
|
|
|
4273
4310
|
if (relative.path[0] === "/") {
|
|
4274
4311
|
target.path = removeDotSegments(relative.path);
|
|
4275
4312
|
} else {
|
|
4276
|
-
|
|
4313
|
+
const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
|
|
4314
|
+
if (baseHasAuthority && !base.path) {
|
|
4277
4315
|
target.path = "/" + relative.path;
|
|
4278
4316
|
} else if (!base.path) {
|
|
4279
4317
|
target.path = relative.path;
|
|
4280
4318
|
} else {
|
|
4281
4319
|
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
4282
4320
|
}
|
|
4283
|
-
target.path = removeDotSegments(target.path);
|
|
4321
|
+
target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
|
|
4284
4322
|
}
|
|
4285
4323
|
target.query = relative.query;
|
|
4286
4324
|
}
|
|
@@ -4318,12 +4356,13 @@ var require_fast_uri = __commonJS({
|
|
|
4318
4356
|
const options = Object.assign({}, opts);
|
|
4319
4357
|
const uriTokens = [];
|
|
4320
4358
|
if (component.scheme) {
|
|
4321
|
-
component.scheme =
|
|
4359
|
+
component.scheme = validateScheme(component.scheme);
|
|
4322
4360
|
}
|
|
4323
4361
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
4324
4362
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
4325
4363
|
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
4326
|
-
const
|
|
4364
|
+
const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
|
|
4365
|
+
const pathNoScheme = !options.skipEscape && schemelessReference;
|
|
4327
4366
|
if (component.path !== void 0) {
|
|
4328
4367
|
if (!options.skipEscape) {
|
|
4329
4368
|
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
@@ -4332,7 +4371,7 @@ var require_fast_uri = __commonJS({
|
|
|
4332
4371
|
}
|
|
4333
4372
|
}
|
|
4334
4373
|
if (options.reference !== "suffix" && component.scheme) {
|
|
4335
|
-
component.scheme =
|
|
4374
|
+
component.scheme = validateScheme(component.scheme);
|
|
4336
4375
|
uriTokens.push(component.scheme, ":");
|
|
4337
4376
|
}
|
|
4338
4377
|
const authority = recomposeAuthority(component);
|
|
@@ -4348,9 +4387,9 @@ var require_fast_uri = __commonJS({
|
|
|
4348
4387
|
if (component.path !== void 0) {
|
|
4349
4388
|
let s = component.path;
|
|
4350
4389
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
4351
|
-
s = removeDotSegments(s);
|
|
4390
|
+
s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
|
|
4352
4391
|
}
|
|
4353
|
-
if (
|
|
4392
|
+
if (schemelessReference) {
|
|
4354
4393
|
s = serializePathEncoding(s, true);
|
|
4355
4394
|
}
|
|
4356
4395
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") {
|
|
@@ -4397,16 +4436,34 @@ var require_fast_uri = __commonJS({
|
|
|
4397
4436
|
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
4398
4437
|
}
|
|
4399
4438
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
4439
|
+
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
|
|
4440
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4441
|
+
return true;
|
|
4442
|
+
}
|
|
4400
4443
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
4444
|
+
let url2;
|
|
4401
4445
|
try {
|
|
4402
|
-
|
|
4446
|
+
url2 = new URL("http://" + parsed.host);
|
|
4403
4447
|
} catch (e) {
|
|
4404
4448
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
4405
4449
|
return true;
|
|
4406
4450
|
}
|
|
4451
|
+
if (!isHostOnlyURL(url2)) {
|
|
4452
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4453
|
+
return true;
|
|
4454
|
+
}
|
|
4455
|
+
parsed.host = url2.hostname;
|
|
4407
4456
|
}
|
|
4408
4457
|
return false;
|
|
4409
4458
|
}
|
|
4459
|
+
function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
|
|
4460
|
+
return Boolean(
|
|
4461
|
+
parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
|
|
4462
|
+
);
|
|
4463
|
+
}
|
|
4464
|
+
function isHostOnlyURL(url2) {
|
|
4465
|
+
return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
|
|
4466
|
+
}
|
|
4410
4467
|
function parseWithStatus(uri, opts) {
|
|
4411
4468
|
const options = Object.assign({}, opts);
|
|
4412
4469
|
const parsed = {
|
|
@@ -4461,9 +4518,8 @@ var require_fast_uri = __commonJS({
|
|
|
4461
4518
|
parsed.query = matches[7];
|
|
4462
4519
|
parsed.fragment = matches[8];
|
|
4463
4520
|
if (parsed.scheme !== void 0) {
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
parsed.scheme = decodedScheme.toLowerCase();
|
|
4521
|
+
if (VALID_SCHEME.test(parsed.scheme)) {
|
|
4522
|
+
parsed.scheme = parsed.scheme.toLowerCase();
|
|
4467
4523
|
} else {
|
|
4468
4524
|
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
4469
4525
|
malformedScheme = true;
|
|
@@ -4491,7 +4547,7 @@ var require_fast_uri = __commonJS({
|
|
|
4491
4547
|
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
4492
4548
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
4493
4549
|
if (malformedIPLiteral) {
|
|
4494
|
-
parsed.error = parsed.error ||
|
|
4550
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4495
4551
|
malformedAuthorityOrPort = true;
|
|
4496
4552
|
}
|
|
4497
4553
|
} else {
|
|
@@ -4519,7 +4575,7 @@ var require_fast_uri = __commonJS({
|
|
|
4519
4575
|
if (!isIP) {
|
|
4520
4576
|
host = normalizePercentEncoding(host.toLowerCase());
|
|
4521
4577
|
}
|
|
4522
|
-
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
4578
|
+
parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
|
|
4523
4579
|
}
|
|
4524
4580
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
4525
4581
|
if (parsed.path) {
|
|
@@ -31249,6 +31305,37 @@ function encodeConversationSseEvent(event) {
|
|
|
31249
31305
|
// ../linkque-agent-runtime/dist/esm/impl/scenario/gatewayRunAuthorization.js
|
|
31250
31306
|
import { hkdfSync, randomBytes } from "node:crypto";
|
|
31251
31307
|
|
|
31308
|
+
// ../linkque-agent-runtime/dist/esm/core/scenarioRunAuthorization.js
|
|
31309
|
+
var SCENARIO_RUN_ERROR_CODES = [
|
|
31310
|
+
"SCENARIO_TURN_LIMIT",
|
|
31311
|
+
"SCENARIO_TURN_ID_CONFLICT",
|
|
31312
|
+
"SCENARIO_CIPHER_TIMEOUT",
|
|
31313
|
+
"SCENARIO_CIPHER_UNAVAILABLE",
|
|
31314
|
+
"SCENARIO_TURN_CONFIG_UNAVAILABLE",
|
|
31315
|
+
"SCENARIO_RUNTIME_AUTH_INVALID",
|
|
31316
|
+
"SCENARIO_RUNTIME_REPLAY",
|
|
31317
|
+
"SCENARIO_RUN_UNAVAILABLE"
|
|
31318
|
+
];
|
|
31319
|
+
function normalizeScenarioRunErrorCode(value) {
|
|
31320
|
+
return typeof value === "string" && SCENARIO_RUN_ERROR_CODES.includes(value) ? value : "SCENARIO_RUN_UNAVAILABLE";
|
|
31321
|
+
}
|
|
31322
|
+
async function authorizeAgentRun(runId, identity, port) {
|
|
31323
|
+
if (typeof runId !== "string" || !/^[\x21-\x7e]{1,64}$/u.test(runId) || typeof identity?.userId !== "string" || !/^[\x21-\x7e]{1,128}$/u.test(identity.userId) || typeof identity.agentId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/u.test(identity.agentId)) {
|
|
31324
|
+
throw new Error("SCENARIO_RUNTIME_AUTH_INVALID");
|
|
31325
|
+
}
|
|
31326
|
+
const result = await port.authorizeRun({
|
|
31327
|
+
runId,
|
|
31328
|
+
agentId: identity.agentId,
|
|
31329
|
+
appbaseUserId: identity.userId
|
|
31330
|
+
});
|
|
31331
|
+
if (result?.quotaMode === "NORMAL")
|
|
31332
|
+
return { quotaMode: "NORMAL" };
|
|
31333
|
+
if (result?.quotaMode !== "LIMITED" && result?.quotaMode !== "AUTH_ONLY" || typeof result.modelFetch !== "function") {
|
|
31334
|
+
throw new Error("SCENARIO_RUN_UNAVAILABLE");
|
|
31335
|
+
}
|
|
31336
|
+
return result;
|
|
31337
|
+
}
|
|
31338
|
+
|
|
31252
31339
|
// ../linkque-agent-runtime/dist/esm/impl/scenario/runtimeMac.js
|
|
31253
31340
|
import { createHash as createHash3, createHmac, timingSafeEqual } from "node:crypto";
|
|
31254
31341
|
function invalid() {
|
|
@@ -31295,6 +31382,7 @@ function signRuntimeRequest(input, key) {
|
|
|
31295
31382
|
// ../linkque-agent-runtime/dist/esm/impl/scenario/gatewayRunAuthorization.js
|
|
31296
31383
|
var SCENARIO_RUNTIME_CALLER = "appbase-agent-function";
|
|
31297
31384
|
var SCENARIO_RUNTIME_KEY_ID = "agent-aak-v1";
|
|
31385
|
+
var SCENARIO_AUTH_REQUEST_TIMEOUT_MS = 3e4;
|
|
31298
31386
|
function deriveScenarioRuntimeMacKey(accessKey) {
|
|
31299
31387
|
const normalized = accessKey.trim();
|
|
31300
31388
|
if (!normalized)
|
|
@@ -31312,6 +31400,7 @@ function createGatewayRunAuthorization(options) {
|
|
|
31312
31400
|
}
|
|
31313
31401
|
const modelPath = `${base.pathname.replace(/\/$/u, "")}/v1/messages`;
|
|
31314
31402
|
const baseFetch = options.fetch ?? globalThis.fetch;
|
|
31403
|
+
const log = (...args) => options.debugLog?.("[scenario-run-auth]", ...args);
|
|
31315
31404
|
return {
|
|
31316
31405
|
async authorizeRun(identity) {
|
|
31317
31406
|
const signedHeaders = (url2, body, proof) => {
|
|
@@ -31339,6 +31428,8 @@ function createGatewayRunAuthorization(options) {
|
|
|
31339
31428
|
};
|
|
31340
31429
|
};
|
|
31341
31430
|
const invoke = async (path2, previousProof) => {
|
|
31431
|
+
const startedAt = Date.now();
|
|
31432
|
+
const operation = previousProof ? "renew" : "authorize";
|
|
31342
31433
|
const url2 = new URL(path2, base.origin);
|
|
31343
31434
|
const body = {
|
|
31344
31435
|
agentId: identity.agentId,
|
|
@@ -31346,11 +31437,12 @@ function createGatewayRunAuthorization(options) {
|
|
|
31346
31437
|
...previousProof ? { proof: previousProof } : {}
|
|
31347
31438
|
};
|
|
31348
31439
|
let response;
|
|
31440
|
+
log(`event=request.start operation=${operation} runId=${identity.runId} agentId=${identity.agentId}`);
|
|
31349
31441
|
try {
|
|
31350
31442
|
response = await baseFetch(url2, {
|
|
31351
31443
|
method: "POST",
|
|
31352
31444
|
redirect: "error",
|
|
31353
|
-
signal: AbortSignal.timeout(
|
|
31445
|
+
signal: AbortSignal.timeout(SCENARIO_AUTH_REQUEST_TIMEOUT_MS),
|
|
31354
31446
|
headers: {
|
|
31355
31447
|
authorization: options.authorizationHeader,
|
|
31356
31448
|
"content-type": "application/json",
|
|
@@ -31359,31 +31451,39 @@ function createGatewayRunAuthorization(options) {
|
|
|
31359
31451
|
body: JSON.stringify(body)
|
|
31360
31452
|
});
|
|
31361
31453
|
} catch {
|
|
31454
|
+
log(`event=request.error operation=${operation} runId=${identity.runId} agentId=${identity.agentId} reason=network durationMs=${Date.now() - startedAt}`);
|
|
31362
31455
|
throw new Error("SCENARIO_RUN_UNAVAILABLE");
|
|
31363
31456
|
}
|
|
31364
|
-
|
|
31457
|
+
const gatewayRequestId = response.headers.get("request-id") ?? response.headers.get("x-request-id") ?? "-";
|
|
31458
|
+
const rejectResponse = (reason) => {
|
|
31459
|
+
log(`event=request.rejected operation=${operation} runId=${identity.runId} agentId=${identity.agentId} status=${response.status} requestId=${gatewayRequestId} reason=${reason} durationMs=${Date.now() - startedAt}`);
|
|
31365
31460
|
throw new Error("SCENARIO_RUN_UNAVAILABLE");
|
|
31461
|
+
};
|
|
31462
|
+
if (!response.ok) {
|
|
31463
|
+
return rejectResponse("http");
|
|
31464
|
+
}
|
|
31366
31465
|
const raw = await response.text();
|
|
31367
31466
|
if (raw.length > 16384)
|
|
31368
|
-
|
|
31467
|
+
return rejectResponse("response_too_large");
|
|
31369
31468
|
let result;
|
|
31370
31469
|
try {
|
|
31371
31470
|
result = JSON.parse(raw);
|
|
31372
31471
|
} catch {
|
|
31373
|
-
|
|
31472
|
+
return rejectResponse("invalid_json");
|
|
31374
31473
|
}
|
|
31375
31474
|
if (result?.success !== true) {
|
|
31376
|
-
|
|
31377
|
-
|
|
31378
|
-
|
|
31379
|
-
"SCENARIO_RUNTIME_REPLAY"
|
|
31380
|
-
].includes(result?.errorCode) ? result.errorCode : "SCENARIO_RUN_UNAVAILABLE");
|
|
31475
|
+
const errorCode = normalizeScenarioRunErrorCode(result?.errorCode);
|
|
31476
|
+
log(`event=request.rejected operation=${operation} runId=${identity.runId} agentId=${identity.agentId} status=${response.status} requestId=${gatewayRequestId} reason=${errorCode} durationMs=${Date.now() - startedAt}`);
|
|
31477
|
+
throw new Error(errorCode);
|
|
31381
31478
|
}
|
|
31382
31479
|
const data = result.data;
|
|
31383
|
-
if (data?.quotaMode === "NORMAL" && !previousProof)
|
|
31480
|
+
if (data?.quotaMode === "NORMAL" && !previousProof) {
|
|
31481
|
+
log(`event=request.completed operation=${operation} runId=${identity.runId} agentId=${identity.agentId} quotaMode=NORMAL requestId=${gatewayRequestId} durationMs=${Date.now() - startedAt}`);
|
|
31384
31482
|
return { quotaMode: "NORMAL" };
|
|
31483
|
+
}
|
|
31385
31484
|
if (!["LIMITED", "AUTH_ONLY"].includes(data?.quotaMode) || typeof data.proof !== "string" || !data.proof || data.proof.length > 4200 || !Number.isSafeInteger(data.expiresAt) || data.expiresAt <= Date.now())
|
|
31386
|
-
|
|
31485
|
+
return rejectResponse("invalid_response");
|
|
31486
|
+
log(`event=request.completed operation=${operation} runId=${identity.runId} agentId=${identity.agentId} quotaMode=${data.quotaMode} requestId=${gatewayRequestId} durationMs=${Date.now() - startedAt}`);
|
|
31387
31487
|
return data;
|
|
31388
31488
|
};
|
|
31389
31489
|
let grant = await invoke("/api/scenario/authorize-run");
|
|
@@ -39728,6 +39828,8 @@ export {
|
|
|
39728
39828
|
createKnowledgeTools,
|
|
39729
39829
|
NoopWebSearchPort,
|
|
39730
39830
|
EventObservationRegistry,
|
|
39831
|
+
normalizeScenarioRunErrorCode,
|
|
39832
|
+
authorizeAgentRun,
|
|
39731
39833
|
createGatewayRunAuthorization,
|
|
39732
39834
|
abortableDelay,
|
|
39733
39835
|
RemoteGatewayMcpServerProvider,
|
|
@@ -50,13 +50,13 @@ import {
|
|
|
50
50
|
resolveRunStorage,
|
|
51
51
|
toAgentRunMessages,
|
|
52
52
|
withIsoTimestamp
|
|
53
|
-
} from "../../chunk-
|
|
53
|
+
} from "../../chunk-U6OH2FQV.js";
|
|
54
54
|
import "../../chunk-IWOFD643.js";
|
|
55
55
|
import "../../chunk-PXCGFBV5.js";
|
|
56
56
|
import "../../chunk-ETG6PNHQ.js";
|
|
57
57
|
import {
|
|
58
58
|
getBakedProtocol
|
|
59
|
-
} from "../../chunk-
|
|
59
|
+
} from "../../chunk-UAOFFEXJ.js";
|
|
60
60
|
import {
|
|
61
61
|
ACTIVATE_SKILL_TOOL_NAME,
|
|
62
62
|
CANCEL_CONVERSATION_RUN_OPERATION,
|
|
@@ -133,6 +133,7 @@ import {
|
|
|
133
133
|
WebSkillLoader,
|
|
134
134
|
abortableDelay,
|
|
135
135
|
aggregateMcpServers,
|
|
136
|
+
authorizeAgentRun,
|
|
136
137
|
buildHookCommonParams,
|
|
137
138
|
buildSkillCatalog,
|
|
138
139
|
cloneJsonObject,
|
|
@@ -163,6 +164,7 @@ import {
|
|
|
163
164
|
normalizeFollowUpQuestionStrings,
|
|
164
165
|
normalizeHookResources,
|
|
165
166
|
normalizeMcpInputSchema,
|
|
167
|
+
normalizeScenarioRunErrorCode,
|
|
166
168
|
observeEvent,
|
|
167
169
|
observeIo,
|
|
168
170
|
observePromise,
|
|
@@ -194,7 +196,7 @@ import {
|
|
|
194
196
|
warnLogFailure,
|
|
195
197
|
wrapToolWithHooks,
|
|
196
198
|
writeJsonPointer
|
|
197
|
-
} from "../../chunk-
|
|
199
|
+
} from "../../chunk-OYT6HQOV.js";
|
|
198
200
|
import "../../chunk-EAODRPW4.js";
|
|
199
201
|
import "../../chunk-XUFLSZM4.js";
|
|
200
202
|
import "../../chunk-GAYNLDWK.js";
|
|
@@ -41313,24 +41315,6 @@ var EMPTY_TELEMETRY_RUN_CONTEXT = {
|
|
|
41313
41315
|
userKey: ""
|
|
41314
41316
|
};
|
|
41315
41317
|
|
|
41316
|
-
// ../linkque-agent-runtime/dist/esm/core/scenarioRunAuthorization.js
|
|
41317
|
-
async function authorizeAgentRun(runId, identity, port) {
|
|
41318
|
-
if (typeof runId !== "string" || !/^[\x21-\x7e]{1,64}$/u.test(runId) || typeof identity?.userId !== "string" || !/^[\x21-\x7e]{1,128}$/u.test(identity.userId) || typeof identity.agentId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/u.test(identity.agentId)) {
|
|
41319
|
-
throw new Error("SCENARIO_RUNTIME_AUTH_INVALID");
|
|
41320
|
-
}
|
|
41321
|
-
const result = await port.authorizeRun({
|
|
41322
|
-
runId,
|
|
41323
|
-
agentId: identity.agentId,
|
|
41324
|
-
appbaseUserId: identity.userId
|
|
41325
|
-
});
|
|
41326
|
-
if (result?.quotaMode === "NORMAL")
|
|
41327
|
-
return { quotaMode: "NORMAL" };
|
|
41328
|
-
if (result?.quotaMode !== "LIMITED" && result?.quotaMode !== "AUTH_ONLY" || typeof result.modelFetch !== "function") {
|
|
41329
|
-
throw new Error("SCENARIO_RUN_UNAVAILABLE");
|
|
41330
|
-
}
|
|
41331
|
-
return result;
|
|
41332
|
-
}
|
|
41333
|
-
|
|
41334
41318
|
// ../linkque-agent-runtime/dist/esm/core/agentRuntimePlugin.js
|
|
41335
41319
|
var validatePlugins = (plugins) => {
|
|
41336
41320
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -42662,11 +42646,7 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
42662
42646
|
auth = { ...auth, modelFetch: grant.modelFetch };
|
|
42663
42647
|
} catch (error) {
|
|
42664
42648
|
const reason = error instanceof Error ? error.message : "";
|
|
42665
|
-
const code =
|
|
42666
|
-
"SCENARIO_TURN_LIMIT",
|
|
42667
|
-
"SCENARIO_RUNTIME_AUTH_INVALID",
|
|
42668
|
-
"SCENARIO_RUNTIME_REPLAY"
|
|
42669
|
-
].includes(reason) ? reason : "SCENARIO_RUN_UNAVAILABLE";
|
|
42649
|
+
const code = normalizeScenarioRunErrorCode(reason);
|
|
42670
42650
|
yield {
|
|
42671
42651
|
type: "error",
|
|
42672
42652
|
error: {
|
|
@@ -42717,12 +42697,9 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
42717
42697
|
const body = {
|
|
42718
42698
|
section: ETelemetryContentSection.QUERY_INPUT,
|
|
42719
42699
|
inputType: "card",
|
|
42720
|
-
displayText,
|
|
42700
|
+
...displayText ? { displayText } : {},
|
|
42721
42701
|
availability: card ? "available" : "not_recorded"
|
|
42722
42702
|
};
|
|
42723
|
-
if (displayText) {
|
|
42724
|
-
body.displayText = displayText;
|
|
42725
|
-
}
|
|
42726
42703
|
observation.record(ETelemetryEventName.CONTENT_RECORDED, { [ETelemetryAttribute.LINKQUE_CONTENT_VALUE_TRUNCATED]: false }, body);
|
|
42727
42704
|
}
|
|
42728
42705
|
}
|
|
@@ -44317,9 +44294,9 @@ function describeHookExecutorAssembly(ports, mcpAuthHeader, hasLinkquegwEventPlu
|
|
|
44317
44294
|
return "\u7AEF\u53E3\u5217\u8868\u4E0E\u63D2\u4EF6\u5217\u8868\u6309 name \u5408\u5E76";
|
|
44318
44295
|
} else if ((ports.gatewayAuthMode === "user-token" || ports.gatewayAuthMode === "scenario-token") && mcpAuthHeader) {
|
|
44319
44296
|
if (hasLinkquegwEventPlugin) {
|
|
44320
|
-
return
|
|
44297
|
+
return `\u4F7F\u7528\u6CE8\u5165\u7684 LinkquegwEventPlugin(auth-mode=${ports.gatewayAuthMode})`;
|
|
44321
44298
|
} else {
|
|
44322
|
-
return
|
|
44299
|
+
return `LinkquegwEventPlugin(auth-mode=${ports.gatewayAuthMode},\u9ED8\u8BA4\u6CE8\u5165)`;
|
|
44323
44300
|
}
|
|
44324
44301
|
} else if (ports.gatewayAuthMode === "aak") {
|
|
44325
44302
|
return "Noop(AAK \u6A21\u5F0F\u4E0D\u89E6\u53D1 user-token-only event)";
|
|
@@ -45591,6 +45568,7 @@ function isUncertainWriteError(error) {
|
|
|
45591
45568
|
import { createHash as createHash3 } from "node:crypto";
|
|
45592
45569
|
var DEFAULT_LEASE_TTL_MS = 20 * 60 * 1e3;
|
|
45593
45570
|
var TRANSACTION_TTL_SECONDS = 60;
|
|
45571
|
+
var LEASE_RELEASE_MAX_ATTEMPTS = 3;
|
|
45594
45572
|
function createSessionLease(persistence, options = {}) {
|
|
45595
45573
|
const ttlMs = options.ttlMs ?? DEFAULT_LEASE_TTL_MS;
|
|
45596
45574
|
const now = options.now ?? Date.now;
|
|
@@ -45608,10 +45586,14 @@ function createSessionLease(persistence, options = {}) {
|
|
|
45608
45586
|
},
|
|
45609
45587
|
release: async (threadId, ownerId) => {
|
|
45610
45588
|
const leaseId = createSessionLeaseId(threadId);
|
|
45611
|
-
|
|
45612
|
-
|
|
45613
|
-
|
|
45589
|
+
for (let attempt = 0; attempt < LEASE_RELEASE_MAX_ATTEMPTS; attempt += 1) {
|
|
45590
|
+
if (await persistence.deleteIfOwner(leaseId, ownerId))
|
|
45591
|
+
return;
|
|
45592
|
+
const current = await persistence.read(leaseId);
|
|
45593
|
+
if (!current || current.ownerId !== ownerId)
|
|
45594
|
+
return;
|
|
45614
45595
|
}
|
|
45596
|
+
throw new Error("\u4F1A\u8BDD\u79DF\u7EA6\u91CA\u653E\u672A\u63D0\u4EA4\uFF0C\u5F53\u524D\u8BF7\u6C42\u4ECD\u6301\u6709\u79DF\u7EA6");
|
|
45615
45597
|
}
|
|
45616
45598
|
};
|
|
45617
45599
|
}
|
|
@@ -46488,7 +46470,8 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
46488
46470
|
baseUrl: linkqueBaseUrl,
|
|
46489
46471
|
token: resolved.modelCredential,
|
|
46490
46472
|
authorizationHeader: resolved.authorizationHeader,
|
|
46491
|
-
accessKey
|
|
46473
|
+
accessKey,
|
|
46474
|
+
debugLog: (...args) => log(...args)
|
|
46492
46475
|
});
|
|
46493
46476
|
} catch {
|
|
46494
46477
|
return jsonError(503, "SCENARIO_RUN_UNAVAILABLE", "\u573A\u666F\u53EF\u4FE1\u8BA4\u8BC1\u914D\u7F6E\u6682\u4E0D\u53EF\u7528");
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
runClientCapability,
|
|
4
4
|
runClientCapabilityCleanup,
|
|
5
5
|
runClientCapabilityResult
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-U6OH2FQV.js";
|
|
7
7
|
import "../../chunk-IWOFD643.js";
|
|
8
8
|
import "../../chunk-PXCGFBV5.js";
|
|
9
9
|
import "../../chunk-ETG6PNHQ.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-OYT6HQOV.js";
|
|
11
11
|
import "../../chunk-EAODRPW4.js";
|
|
12
12
|
import "../../chunk-XUFLSZM4.js";
|
|
13
13
|
import "../../chunk-GAYNLDWK.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBakedProtocol,
|
|
3
3
|
setBakedProtocol
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-UAOFFEXJ.js";
|
|
5
|
+
import "../chunk-OYT6HQOV.js";
|
|
6
6
|
import "../chunk-EAODRPW4.js";
|
|
7
7
|
import "../chunk-XUFLSZM4.js";
|
|
8
8
|
import "../chunk-GAYNLDWK.js";
|
package/worker.js
CHANGED
|
@@ -3851,6 +3851,37 @@ var require_utils = __commonJS({
|
|
|
3851
3851
|
}
|
|
3852
3852
|
return output.join("");
|
|
3853
3853
|
}
|
|
3854
|
+
function removeDotSegmentsRelative(path9) {
|
|
3855
|
+
if (path9 === "" || path9[0] === "/") {
|
|
3856
|
+
return removeDotSegments(path9);
|
|
3857
|
+
}
|
|
3858
|
+
const segments = path9.split("/");
|
|
3859
|
+
const last = segments.length - 1;
|
|
3860
|
+
const output = [];
|
|
3861
|
+
let trailingDirectory = false;
|
|
3862
|
+
for (let i2 = 0; i2 <= last; i2++) {
|
|
3863
|
+
const segment = segments[i2];
|
|
3864
|
+
if (segment === "." || segment === "..") {
|
|
3865
|
+
if (segment === "..") {
|
|
3866
|
+
if (output.length !== 0 && output[output.length - 1] !== "..") {
|
|
3867
|
+
output.pop();
|
|
3868
|
+
} else {
|
|
3869
|
+
output.push("..");
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
trailingDirectory = i2 === last;
|
|
3873
|
+
} else {
|
|
3874
|
+
output.push(segment);
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
if (trailingDirectory && output[output.length - 1] !== "..") {
|
|
3878
|
+
output.push("");
|
|
3879
|
+
}
|
|
3880
|
+
if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
|
|
3881
|
+
output.unshift(".");
|
|
3882
|
+
}
|
|
3883
|
+
return output.join("/");
|
|
3884
|
+
}
|
|
3854
3885
|
var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
|
|
3855
3886
|
var HOST_DELIM_RE = /[@/?#:]/g;
|
|
3856
3887
|
var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
@@ -4111,6 +4142,7 @@ var require_utils = __commonJS({
|
|
|
4111
4142
|
encodeFragment,
|
|
4112
4143
|
escapePreservingEscapes,
|
|
4113
4144
|
removeDotSegments,
|
|
4145
|
+
removeDotSegmentsRelative,
|
|
4114
4146
|
isIPv4,
|
|
4115
4147
|
isUUID,
|
|
4116
4148
|
normalizeIPv6,
|
|
@@ -4334,16 +4366,18 @@ var require_schemes = __commonJS({
|
|
|
4334
4366
|
var require_fast_uri = __commonJS({
|
|
4335
4367
|
"../../node_modules/fast-uri/index.js"(exports2, module2) {
|
|
4336
4368
|
"use strict";
|
|
4337
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4369
|
+
var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4338
4370
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
4339
4371
|
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
4340
4372
|
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4373
|
+
var MALFORMED_HOST_ERROR = "URI host is malformed.";
|
|
4374
|
+
var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
|
|
4375
|
+
function validateScheme(scheme) {
|
|
4376
|
+
const stringScheme = String(scheme);
|
|
4377
|
+
if (!VALID_SCHEME.test(stringScheme)) {
|
|
4344
4378
|
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
4345
4379
|
}
|
|
4346
|
-
return
|
|
4380
|
+
return stringScheme;
|
|
4347
4381
|
}
|
|
4348
4382
|
function normalize(uri, options) {
|
|
4349
4383
|
if (typeof uri === "string") {
|
|
@@ -4380,6 +4414,9 @@ var require_fast_uri = __commonJS({
|
|
|
4380
4414
|
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
4381
4415
|
const resolvedHost = resolved.host;
|
|
4382
4416
|
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
4417
|
+
if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
|
|
4418
|
+
throw new Error(MALFORMED_HOST_ERROR);
|
|
4419
|
+
}
|
|
4383
4420
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
4384
4421
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
4385
4422
|
if (resolved.error && !encodedASCIIHost) {
|
|
@@ -4421,14 +4458,15 @@ var require_fast_uri = __commonJS({
|
|
|
4421
4458
|
if (relative.path[0] === "/") {
|
|
4422
4459
|
target.path = removeDotSegments(relative.path);
|
|
4423
4460
|
} else {
|
|
4424
|
-
|
|
4461
|
+
const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
|
|
4462
|
+
if (baseHasAuthority && !base.path) {
|
|
4425
4463
|
target.path = "/" + relative.path;
|
|
4426
4464
|
} else if (!base.path) {
|
|
4427
4465
|
target.path = relative.path;
|
|
4428
4466
|
} else {
|
|
4429
4467
|
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
4430
4468
|
}
|
|
4431
|
-
target.path = removeDotSegments(target.path);
|
|
4469
|
+
target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
|
|
4432
4470
|
}
|
|
4433
4471
|
target.query = relative.query;
|
|
4434
4472
|
}
|
|
@@ -4466,12 +4504,13 @@ var require_fast_uri = __commonJS({
|
|
|
4466
4504
|
const options = Object.assign({}, opts);
|
|
4467
4505
|
const uriTokens = [];
|
|
4468
4506
|
if (component.scheme) {
|
|
4469
|
-
component.scheme =
|
|
4507
|
+
component.scheme = validateScheme(component.scheme);
|
|
4470
4508
|
}
|
|
4471
4509
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
4472
4510
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
4473
4511
|
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
4474
|
-
const
|
|
4512
|
+
const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
|
|
4513
|
+
const pathNoScheme = !options.skipEscape && schemelessReference;
|
|
4475
4514
|
if (component.path !== void 0) {
|
|
4476
4515
|
if (!options.skipEscape) {
|
|
4477
4516
|
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
@@ -4480,7 +4519,7 @@ var require_fast_uri = __commonJS({
|
|
|
4480
4519
|
}
|
|
4481
4520
|
}
|
|
4482
4521
|
if (options.reference !== "suffix" && component.scheme) {
|
|
4483
|
-
component.scheme =
|
|
4522
|
+
component.scheme = validateScheme(component.scheme);
|
|
4484
4523
|
uriTokens.push(component.scheme, ":");
|
|
4485
4524
|
}
|
|
4486
4525
|
const authority = recomposeAuthority(component);
|
|
@@ -4496,9 +4535,9 @@ var require_fast_uri = __commonJS({
|
|
|
4496
4535
|
if (component.path !== void 0) {
|
|
4497
4536
|
let s2 = component.path;
|
|
4498
4537
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
4499
|
-
s2 = removeDotSegments(s2);
|
|
4538
|
+
s2 = schemelessReference && s2[0] !== "/" ? removeDotSegmentsRelative(s2) : removeDotSegments(s2);
|
|
4500
4539
|
}
|
|
4501
|
-
if (
|
|
4540
|
+
if (schemelessReference) {
|
|
4502
4541
|
s2 = serializePathEncoding(s2, true);
|
|
4503
4542
|
}
|
|
4504
4543
|
if (authority === void 0 && s2[0] === "/" && s2[1] === "/") {
|
|
@@ -4545,16 +4584,34 @@ var require_fast_uri = __commonJS({
|
|
|
4545
4584
|
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
4546
4585
|
}
|
|
4547
4586
|
function canonicalizeHost(parsed, options, schemeHandler, isIP2) {
|
|
4587
|
+
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP2)) {
|
|
4588
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4589
|
+
return true;
|
|
4590
|
+
}
|
|
4548
4591
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP2 === false && nonSimpleDomain(parsed.host)) {
|
|
4592
|
+
let url2;
|
|
4549
4593
|
try {
|
|
4550
|
-
|
|
4594
|
+
url2 = new URL("http://" + parsed.host);
|
|
4551
4595
|
} catch (e2) {
|
|
4552
4596
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e2;
|
|
4553
4597
|
return true;
|
|
4554
4598
|
}
|
|
4599
|
+
if (!isHostOnlyURL(url2)) {
|
|
4600
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4601
|
+
return true;
|
|
4602
|
+
}
|
|
4603
|
+
parsed.host = url2.hostname;
|
|
4555
4604
|
}
|
|
4556
4605
|
return false;
|
|
4557
4606
|
}
|
|
4607
|
+
function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP2) {
|
|
4608
|
+
return Boolean(
|
|
4609
|
+
parsed.host && isIP2 === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
|
|
4610
|
+
);
|
|
4611
|
+
}
|
|
4612
|
+
function isHostOnlyURL(url2) {
|
|
4613
|
+
return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
|
|
4614
|
+
}
|
|
4558
4615
|
function parseWithStatus(uri, opts) {
|
|
4559
4616
|
const options = Object.assign({}, opts);
|
|
4560
4617
|
const parsed = {
|
|
@@ -4609,9 +4666,8 @@ var require_fast_uri = __commonJS({
|
|
|
4609
4666
|
parsed.query = matches[7];
|
|
4610
4667
|
parsed.fragment = matches[8];
|
|
4611
4668
|
if (parsed.scheme !== void 0) {
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
parsed.scheme = decodedScheme.toLowerCase();
|
|
4669
|
+
if (VALID_SCHEME.test(parsed.scheme)) {
|
|
4670
|
+
parsed.scheme = parsed.scheme.toLowerCase();
|
|
4615
4671
|
} else {
|
|
4616
4672
|
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
4617
4673
|
malformedScheme = true;
|
|
@@ -4639,7 +4695,7 @@ var require_fast_uri = __commonJS({
|
|
|
4639
4695
|
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
4640
4696
|
parsed.host = isIP2 ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
4641
4697
|
if (malformedIPLiteral) {
|
|
4642
|
-
parsed.error = parsed.error ||
|
|
4698
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4643
4699
|
malformedAuthorityOrPort = true;
|
|
4644
4700
|
}
|
|
4645
4701
|
} else {
|
|
@@ -4667,7 +4723,7 @@ var require_fast_uri = __commonJS({
|
|
|
4667
4723
|
if (!isIP2) {
|
|
4668
4724
|
host = normalizePercentEncoding(host.toLowerCase());
|
|
4669
4725
|
}
|
|
4670
|
-
parsed.host = reescapeHostDelimiters(host, isIP2);
|
|
4726
|
+
parsed.host = isIP2 || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP2) : host;
|
|
4671
4727
|
}
|
|
4672
4728
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
4673
4729
|
if (parsed.path) {
|
|
@@ -16077,6 +16133,43 @@ var init_noopWebSearchPort = __esm({
|
|
|
16077
16133
|
}
|
|
16078
16134
|
});
|
|
16079
16135
|
|
|
16136
|
+
// ../linkque-agent-runtime/dist/esm/core/scenarioRunAuthorization.js
|
|
16137
|
+
function normalizeScenarioRunErrorCode(value) {
|
|
16138
|
+
return typeof value === "string" && SCENARIO_RUN_ERROR_CODES.includes(value) ? value : "SCENARIO_RUN_UNAVAILABLE";
|
|
16139
|
+
}
|
|
16140
|
+
async function authorizeAgentRun(runId, identity, port) {
|
|
16141
|
+
if (typeof runId !== "string" || !/^[\x21-\x7e]{1,64}$/u.test(runId) || typeof identity?.userId !== "string" || !/^[\x21-\x7e]{1,128}$/u.test(identity.userId) || typeof identity.agentId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/u.test(identity.agentId)) {
|
|
16142
|
+
throw new Error("SCENARIO_RUNTIME_AUTH_INVALID");
|
|
16143
|
+
}
|
|
16144
|
+
const result = await port.authorizeRun({
|
|
16145
|
+
runId,
|
|
16146
|
+
agentId: identity.agentId,
|
|
16147
|
+
appbaseUserId: identity.userId
|
|
16148
|
+
});
|
|
16149
|
+
if (result?.quotaMode === "NORMAL")
|
|
16150
|
+
return { quotaMode: "NORMAL" };
|
|
16151
|
+
if (result?.quotaMode !== "LIMITED" && result?.quotaMode !== "AUTH_ONLY" || typeof result.modelFetch !== "function") {
|
|
16152
|
+
throw new Error("SCENARIO_RUN_UNAVAILABLE");
|
|
16153
|
+
}
|
|
16154
|
+
return result;
|
|
16155
|
+
}
|
|
16156
|
+
var SCENARIO_RUN_ERROR_CODES;
|
|
16157
|
+
var init_scenarioRunAuthorization = __esm({
|
|
16158
|
+
"../linkque-agent-runtime/dist/esm/core/scenarioRunAuthorization.js"() {
|
|
16159
|
+
"use strict";
|
|
16160
|
+
SCENARIO_RUN_ERROR_CODES = [
|
|
16161
|
+
"SCENARIO_TURN_LIMIT",
|
|
16162
|
+
"SCENARIO_TURN_ID_CONFLICT",
|
|
16163
|
+
"SCENARIO_CIPHER_TIMEOUT",
|
|
16164
|
+
"SCENARIO_CIPHER_UNAVAILABLE",
|
|
16165
|
+
"SCENARIO_TURN_CONFIG_UNAVAILABLE",
|
|
16166
|
+
"SCENARIO_RUNTIME_AUTH_INVALID",
|
|
16167
|
+
"SCENARIO_RUNTIME_REPLAY",
|
|
16168
|
+
"SCENARIO_RUN_UNAVAILABLE"
|
|
16169
|
+
];
|
|
16170
|
+
}
|
|
16171
|
+
});
|
|
16172
|
+
|
|
16080
16173
|
// ../../node_modules/zod/v3/helpers/util.js
|
|
16081
16174
|
var util, objectUtil, ZodParsedType, getParsedType;
|
|
16082
16175
|
var init_util = __esm({
|
|
@@ -208052,29 +208145,6 @@ var init_types12 = __esm({
|
|
|
208052
208145
|
}
|
|
208053
208146
|
});
|
|
208054
208147
|
|
|
208055
|
-
// ../linkque-agent-runtime/dist/esm/core/scenarioRunAuthorization.js
|
|
208056
|
-
async function authorizeAgentRun(runId, identity, port) {
|
|
208057
|
-
if (typeof runId !== "string" || !/^[\x21-\x7e]{1,64}$/u.test(runId) || typeof identity?.userId !== "string" || !/^[\x21-\x7e]{1,128}$/u.test(identity.userId) || typeof identity.agentId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/u.test(identity.agentId)) {
|
|
208058
|
-
throw new Error("SCENARIO_RUNTIME_AUTH_INVALID");
|
|
208059
|
-
}
|
|
208060
|
-
const result = await port.authorizeRun({
|
|
208061
|
-
runId,
|
|
208062
|
-
agentId: identity.agentId,
|
|
208063
|
-
appbaseUserId: identity.userId
|
|
208064
|
-
});
|
|
208065
|
-
if (result?.quotaMode === "NORMAL")
|
|
208066
|
-
return { quotaMode: "NORMAL" };
|
|
208067
|
-
if (result?.quotaMode !== "LIMITED" && result?.quotaMode !== "AUTH_ONLY" || typeof result.modelFetch !== "function") {
|
|
208068
|
-
throw new Error("SCENARIO_RUN_UNAVAILABLE");
|
|
208069
|
-
}
|
|
208070
|
-
return result;
|
|
208071
|
-
}
|
|
208072
|
-
var init_scenarioRunAuthorization = __esm({
|
|
208073
|
-
"../linkque-agent-runtime/dist/esm/core/scenarioRunAuthorization.js"() {
|
|
208074
|
-
"use strict";
|
|
208075
|
-
}
|
|
208076
|
-
});
|
|
208077
|
-
|
|
208078
208148
|
// ../linkque-agent-runtime/dist/esm/core/agentRuntimePlugin.js
|
|
208079
208149
|
function assertAgentConfigRoot(value, pluginName) {
|
|
208080
208150
|
if (typeof value !== "object" || value === null || !("agent" in value)) {
|
|
@@ -209531,11 +209601,7 @@ var init_agentRuntime = __esm({
|
|
|
209531
209601
|
auth2 = { ...auth2, modelFetch: grant.modelFetch };
|
|
209532
209602
|
} catch (error40) {
|
|
209533
209603
|
const reason = error40 instanceof Error ? error40.message : "";
|
|
209534
|
-
const code =
|
|
209535
|
-
"SCENARIO_TURN_LIMIT",
|
|
209536
|
-
"SCENARIO_RUNTIME_AUTH_INVALID",
|
|
209537
|
-
"SCENARIO_RUNTIME_REPLAY"
|
|
209538
|
-
].includes(reason) ? reason : "SCENARIO_RUN_UNAVAILABLE";
|
|
209604
|
+
const code = normalizeScenarioRunErrorCode(reason);
|
|
209539
209605
|
yield {
|
|
209540
209606
|
type: "error",
|
|
209541
209607
|
error: {
|
|
@@ -209586,12 +209652,9 @@ var init_agentRuntime = __esm({
|
|
|
209586
209652
|
const body = {
|
|
209587
209653
|
section: ETelemetryContentSection.QUERY_INPUT,
|
|
209588
209654
|
inputType: "card",
|
|
209589
|
-
displayText,
|
|
209655
|
+
...displayText ? { displayText } : {},
|
|
209590
209656
|
availability: card ? "available" : "not_recorded"
|
|
209591
209657
|
};
|
|
209592
|
-
if (displayText) {
|
|
209593
|
-
body.displayText = displayText;
|
|
209594
|
-
}
|
|
209595
209658
|
observation.record(ETelemetryEventName.CONTENT_RECORDED, { [ETelemetryAttribute.LINKQUE_CONTENT_VALUE_TRUNCATED]: false }, body);
|
|
209596
209659
|
}
|
|
209597
209660
|
}
|
|
@@ -211406,6 +211469,9 @@ init_runtimeObservation();
|
|
|
211406
211469
|
init_telemetryEnums2();
|
|
211407
211470
|
init_observe();
|
|
211408
211471
|
|
|
211472
|
+
// ../linkque-agent-runtime/dist/esm/impl/scenario/gatewayRunAuthorization.js
|
|
211473
|
+
init_scenarioRunAuthorization();
|
|
211474
|
+
|
|
211409
211475
|
// ../../node_modules/zod/v4/mini/parse.js
|
|
211410
211476
|
init_core2();
|
|
211411
211477
|
|