linkque-cli-v2 1.5.0 → 1.6.1

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 +1880 -0
  2. package/emscripten-module.wasm +0 -0
  3. package/linkquejs.js +1277 -583
  4. package/package.json +1 -1
  5. package/vendor/linkque-agent-appwrite-integrate/data-transform/dataTransformWorker.js +1880 -0
  6. package/vendor/linkque-agent-appwrite-integrate/data-transform/emscripten-module.wasm +0 -0
  7. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-EWGNYBVV.js → chunk-2ZKZKYDK.js} +1935 -1205
  8. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-GQ4TD3EQ.js → chunk-4XAZNSEQ.js} +1 -1
  9. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-CBGTFDSE.js → chunk-CV22XO3R.js} +1 -2
  10. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-UIU24A4Z.js → chunk-HINGKYT5.js} +2 -19
  11. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-TGBYXSBU.js → dist-ZPLSQEAM.js} +42 -27
  12. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-ENBYCHYT.js → google-generative-ai-OLT56CSV.js} +1 -1
  13. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-RIGAEYLC.js → google-vertex-4DBBJ7SR.js} +1 -1
  14. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +1251 -624
  15. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
  16. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
  17. package/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
  18. package/worker.js +3166 -1872
package/linkquejs.js CHANGED
@@ -13060,37 +13060,7 @@ function initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength) {
13060
13060
  ready: new Promise((resolve2) => aesCrypto.resolveReady = resolve2),
13061
13061
  password: encodePassword(password, rawPassword),
13062
13062
  strength: encryptionStrength - 1,
13063
- pendingInput: EMPTY_UINT8_ARRAY,
13064
- discarded: false
13065
- });
13066
- }
13067
- function setDisposingReadable(stream, aesCrypto) {
13068
- const reader = stream.readable.getReader();
13069
- const readable = new ReadableStream({
13070
- async pull(controller) {
13071
- try {
13072
- const { value, done } = await reader.read();
13073
- if (done) {
13074
- controller.close();
13075
- } else {
13076
- controller.enqueue(value);
13077
- }
13078
- } catch (error2) {
13079
- disposeEngine(aesCrypto);
13080
- reader.cancel(error2).catch(() => {
13081
- });
13082
- throw error2;
13083
- }
13084
- },
13085
- cancel(reason) {
13086
- disposeEngine(aesCrypto);
13087
- return reader.cancel(reason);
13088
- }
13089
- });
13090
- Object.defineProperty(stream, "readable", {
13091
- get() {
13092
- return readable;
13093
- }
13063
+ pendingInput: EMPTY_UINT8_ARRAY
13094
13064
  });
13095
13065
  }
13096
13066
  function append(aesCrypto, input, output, paddingStart, paddingEnd, decrypt2) {
@@ -13120,9 +13090,7 @@ async function createDecryptionKeys(decrypt2, strength, password, preamble) {
13120
13090
  throw new Error(ERR_INVALID_PASSWORD);
13121
13091
  }
13122
13092
  }
13123
- function disposeEngine(aesCrypto) {
13124
- const { engine } = aesCrypto;
13125
- aesCrypto.discarded = true;
13093
+ function disposeEngine({ engine }) {
13126
13094
  if (engine && engine.dispose) {
13127
13095
  engine.dispose();
13128
13096
  }
@@ -13137,9 +13105,6 @@ async function createKeys(aesCrypto, strength, password, salt) {
13137
13105
  const keyLength = KEY_LENGTH[strength];
13138
13106
  const compositeKey = await deriveKey(password, salt, keyLength * 2 + PASSWORD_VERIFICATION_LENGTH);
13139
13107
  aesCrypto.engine = createEngine2(subarray(compositeKey, 0, keyLength), subarray(compositeKey, keyLength, keyLength * 2));
13140
- if (aesCrypto.discarded) {
13141
- disposeEngine(aesCrypto);
13142
- }
13143
13108
  return subarray(compositeKey, keyLength * 2);
13144
13109
  }
13145
13110
  async function deriveKey(password, salt, length) {
@@ -13199,12 +13164,12 @@ var init_aes_crypto_stream = __esm({
13199
13164
  createEngine2 = createEngine;
13200
13165
  AESDecryptionStream = class extends TransformStream {
13201
13166
  constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
13202
- const aesCrypto = {};
13203
13167
  super({
13204
13168
  start() {
13205
- initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
13169
+ initAesCrypto(this, password, rawPassword, encryptionStrength);
13206
13170
  },
13207
13171
  async transform(chunk, controller) {
13172
+ const aesCrypto = this;
13208
13173
  const {
13209
13174
  password: password2,
13210
13175
  strength,
@@ -13223,9 +13188,6 @@ var init_aes_crypto_stream = __esm({
13223
13188
  } else {
13224
13189
  await ready;
13225
13190
  }
13226
- if (aesCrypto.discarded) {
13227
- return;
13228
- }
13229
13191
  const output = new Uint8Array(chunk.length - AUTHENTICATION_CODE_LENGTH - (chunk.length - AUTHENTICATION_CODE_LENGTH) % BLOCK_LENGTH2);
13230
13192
  controller.enqueue(append(aesCrypto, chunk, output, 0, AUTHENTICATION_CODE_LENGTH, true));
13231
13193
  },
@@ -13234,12 +13196,9 @@ var init_aes_crypto_stream = __esm({
13234
13196
  engine,
13235
13197
  pendingInput,
13236
13198
  ready
13237
- } = aesCrypto;
13199
+ } = this;
13238
13200
  if (engine) {
13239
13201
  await ready;
13240
- if (aesCrypto.discarded) {
13241
- return;
13242
- }
13243
13202
  const originalAuthenticationCode = subarray(pendingInput, pendingInput.length - AUTHENTICATION_CODE_LENGTH);
13244
13203
  const decryptedChunkArray = new Uint8Array(subarray(pendingInput, 0, pendingInput.length - AUTHENTICATION_CODE_LENGTH));
13245
13204
  engine.process(decryptedChunkArray, true);
@@ -13249,24 +13208,25 @@ var init_aes_crypto_stream = __esm({
13249
13208
  invalidAuthenticationCode |= authenticationCode[indexByte] ^ originalAuthenticationCode[indexByte];
13250
13209
  }
13251
13210
  if (invalidAuthenticationCode && checkAuthenticationCode) {
13252
- controller.error(new Error(ERR_INVALID_AUTHENTICATION_CODE));
13253
- return;
13211
+ throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
13254
13212
  }
13255
13213
  controller.enqueue(decryptedChunkArray);
13256
13214
  }
13215
+ },
13216
+ cancel() {
13217
+ disposeEngine(this);
13257
13218
  }
13258
13219
  });
13259
- setDisposingReadable(this, aesCrypto);
13260
13220
  }
13261
13221
  };
13262
13222
  AESEncryptionStream = class extends TransformStream {
13263
13223
  constructor({ password, rawPassword, encryptionStrength }) {
13264
- const aesCrypto = {};
13265
13224
  super({
13266
13225
  start() {
13267
- initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
13226
+ initAesCrypto(this, password, rawPassword, encryptionStrength);
13268
13227
  },
13269
13228
  async transform(chunk, controller) {
13229
+ const aesCrypto = this;
13270
13230
  const {
13271
13231
  password: password2,
13272
13232
  strength,
@@ -13280,9 +13240,6 @@ var init_aes_crypto_stream = __esm({
13280
13240
  } else {
13281
13241
  await ready;
13282
13242
  }
13283
- if (aesCrypto.discarded) {
13284
- return;
13285
- }
13286
13243
  const output = new Uint8Array(preamble.length + chunk.length - chunk.length % BLOCK_LENGTH2);
13287
13244
  output.set(preamble, 0);
13288
13245
  controller.enqueue(append(aesCrypto, chunk, output, preamble.length, 0, false));
@@ -13292,20 +13249,19 @@ var init_aes_crypto_stream = __esm({
13292
13249
  engine,
13293
13250
  pendingInput,
13294
13251
  ready
13295
- } = aesCrypto;
13252
+ } = this;
13296
13253
  if (engine) {
13297
13254
  await ready;
13298
- if (aesCrypto.discarded) {
13299
- return;
13300
- }
13301
13255
  const encryptedChunkArray = new Uint8Array(pendingInput);
13302
13256
  engine.process(encryptedChunkArray, false);
13303
13257
  const authenticationCode = subarray(engine.digest(), 0, AUTHENTICATION_CODE_LENGTH);
13304
13258
  controller.enqueue(concat(encryptedChunkArray, authenticationCode));
13305
13259
  }
13260
+ },
13261
+ cancel() {
13262
+ disposeEngine(this);
13306
13263
  }
13307
13264
  });
13308
- setDisposingReadable(this, aesCrypto);
13309
13265
  }
13310
13266
  };
13311
13267
  }
@@ -13337,11 +13293,11 @@ function encrypt(target, input) {
13337
13293
  return output;
13338
13294
  }
13339
13295
  function createKeys2(target, password, rawPassword) {
13340
- const cryptoKeys = [305419896, 591751049, 878082192];
13296
+ const keys = [305419896, 591751049, 878082192];
13341
13297
  Object.assign(target, {
13342
- cryptoKeys,
13343
- crcKey0: new Crc32(cryptoKeys[0]),
13344
- crcKey2: new Crc32(cryptoKeys[2])
13298
+ keys,
13299
+ crcKey0: new Crc32(keys[0]),
13300
+ crcKey2: new Crc32(keys[2])
13345
13301
  });
13346
13302
  if (rawPassword) {
13347
13303
  for (let index = 0; index < rawPassword.length; index++) {
@@ -13354,16 +13310,16 @@ function createKeys2(target, password, rawPassword) {
13354
13310
  }
13355
13311
  }
13356
13312
  function updateKeys(target, byte) {
13357
- let [, key1] = target.cryptoKeys;
13313
+ let [, key1] = target.keys;
13358
13314
  target.crcKey0.append([byte]);
13359
13315
  const key0 = ~target.crcKey0.get();
13360
13316
  key1 = getInt32(Math.imul(getInt32(key1 + getInt8(key0)), 134775813) + 1);
13361
13317
  target.crcKey2.append([key1 >>> 24]);
13362
13318
  const key2 = ~target.crcKey2.get();
13363
- target.cryptoKeys = [key0, key1, key2];
13319
+ target.keys = [key0, key1, key2];
13364
13320
  }
13365
13321
  function getByte(target) {
13366
- const temp = target.cryptoKeys[2] | 2;
13322
+ const temp = target.keys[2] | 2;
13367
13323
  return getInt8(Math.imul(temp, temp ^ 1) >>> 8);
13368
13324
  }
13369
13325
  function getInt8(number4) {
@@ -13441,17 +13397,11 @@ function toCompatibleReadable(readable) {
13441
13397
  const reader = readable.getReader();
13442
13398
  return new ReadableStream({
13443
13399
  async pull(controller) {
13444
- try {
13445
- const { value, done } = await reader.read();
13446
- if (done) {
13447
- controller.close();
13448
- } else {
13449
- controller.enqueue(value);
13450
- }
13451
- } catch (error2) {
13452
- reader.cancel(error2).catch(() => {
13453
- });
13454
- throw error2;
13400
+ const { value, done } = await reader.read();
13401
+ if (done) {
13402
+ controller.close();
13403
+ } else {
13404
+ controller.enqueue(value);
13455
13405
  }
13456
13406
  },
13457
13407
  cancel(reason) {
@@ -13533,30 +13483,54 @@ var init_codec_registry = __esm({
13533
13483
  });
13534
13484
 
13535
13485
  // ../../node_modules/@zip.js/zip.js/lib/core/streams/zip-entry-stream.js
13536
- function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors) {
13486
+ function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32) {
13537
13487
  const writer = gzipStream.writable.getWriter();
13538
13488
  const reader = gzipStream.readable.getReader();
13539
13489
  const outputCrc32 = crc32 === UNDEFINED_VALUE ? new Crc32() : UNDEFINED_VALUE;
13540
13490
  let outputLength = 0;
13491
+ let inputDone = false;
13541
13492
  let trailerWritten = false;
13542
- let settled = false;
13543
- let resolvePull, controller;
13544
- const output = new ReadableStream({
13545
- start(streamController) {
13546
- controller = streamController;
13547
- },
13548
- pull() {
13549
- resumePump();
13493
+ let idleCheckArmed = false;
13494
+ let readCount = 0;
13495
+ let readPending = false;
13496
+ let resolveTrailerReady, rejectTrailerReady;
13497
+ const trailerReady = new Promise((resolve2, reject) => {
13498
+ resolveTrailerReady = resolve2;
13499
+ rejectTrailerReady = reject;
13500
+ });
13501
+ trailerReady.catch(() => {
13502
+ });
13503
+ pump();
13504
+ return new ReadableStream({
13505
+ async pull(controller) {
13506
+ let result;
13507
+ try {
13508
+ result = await read();
13509
+ } catch (error2) {
13510
+ throw trailerWritten ? getTrailerError(error2) : error2;
13511
+ }
13512
+ const { value, done } = result;
13513
+ if (done) {
13514
+ controller.close();
13515
+ } else {
13516
+ outputLength += value.length;
13517
+ if (outputLength > outputSize) {
13518
+ const error2 = new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
13519
+ rejectTrailerReady(error2);
13520
+ await cancel(reader, error2);
13521
+ throw error2;
13522
+ }
13523
+ if (outputCrc32) {
13524
+ outputCrc32.append(value);
13525
+ }
13526
+ controller.enqueue(value);
13527
+ }
13550
13528
  },
13551
13529
  cancel(reason) {
13552
- settled = true;
13553
- resumePump();
13530
+ rejectTrailerReady(reason);
13554
13531
  return reader.cancel(reason);
13555
13532
  }
13556
13533
  });
13557
- pump();
13558
- drain();
13559
- return output;
13560
13534
  async function pump() {
13561
13535
  const inputReader = readable.getReader();
13562
13536
  try {
@@ -13564,16 +13538,19 @@ function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, cr
13564
13538
  header.set(GZIP_HEADER_BYTES);
13565
13539
  await writer.write(header);
13566
13540
  for (; ; ) {
13567
- await outputCapacity();
13568
13541
  await writer.ready;
13569
- const { value, done } = await readSource(inputReader, sourceErrors);
13542
+ const { value, done } = await inputReader.read();
13570
13543
  if (done) {
13571
13544
  break;
13572
13545
  }
13573
13546
  await writer.write(value);
13574
13547
  }
13548
+ inputDone = true;
13575
13549
  if (outputCrc32) {
13576
- await writer.write(new Uint8Array(0));
13550
+ if (readPending) {
13551
+ armIdleCheck();
13552
+ }
13553
+ await trailerReady;
13577
13554
  }
13578
13555
  const trailer = new Uint8Array(GZIP_TRAILER_LENGTH);
13579
13556
  const dataView = getDataView(trailer);
@@ -13587,65 +13564,51 @@ function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, cr
13587
13564
  await cancel(inputReader, error2);
13588
13565
  }
13589
13566
  }
13590
- async function drain() {
13591
- try {
13592
- for (; ; ) {
13593
- const { value, done } = await read();
13594
- if (done) {
13595
- break;
13596
- }
13597
- outputLength += value.length;
13598
- if (outputLength > outputSize) {
13599
- throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
13600
- }
13601
- if (outputCrc32) {
13602
- outputCrc32.append(value);
13603
- }
13604
- controller.enqueue(value);
13605
- }
13606
- if (!settled) {
13607
- settled = true;
13608
- controller.close();
13609
- }
13610
- } catch (error2) {
13611
- fail(error2);
13612
- await cancel(reader, error2);
13567
+ function read() {
13568
+ readCount++;
13569
+ readPending = true;
13570
+ const result = reader.read();
13571
+ result.then(onReadSettled, onReadSettled);
13572
+ if (inputDone && outputCrc32) {
13573
+ armIdleCheck();
13613
13574
  }
13575
+ return result;
13614
13576
  }
13615
- function read() {
13616
- return reader.read().catch((error2) => {
13617
- if (trailerWritten) {
13618
- if (!outputCrc32) {
13619
- throw mapError(error2, ERR_INVALID_CRC32);
13620
- }
13621
- if (outputLength != outputSize) {
13622
- throw mapError(error2, ERR_INVALID_UNCOMPRESSED_SIZE);
13577
+ function onReadSettled() {
13578
+ readPending = false;
13579
+ }
13580
+ async function armIdleCheck() {
13581
+ if (!idleCheckArmed) {
13582
+ idleCheckArmed = true;
13583
+ const count = readCount;
13584
+ await nextTask();
13585
+ idleCheckArmed = false;
13586
+ if (readPending) {
13587
+ if (readCount == count) {
13588
+ resolveTrailerReady();
13589
+ } else {
13590
+ armIdleCheck();
13623
13591
  }
13624
- return { done: true };
13625
13592
  }
13626
- throw mapCodecError(error2, sourceErrors);
13627
- });
13628
- }
13629
- function outputCapacity() {
13630
- if (!settled && controller.desiredSize <= 0) {
13631
- return new Promise((resolve2) => resolvePull = resolve2);
13632
13593
  }
13633
13594
  }
13634
- function resumePump() {
13635
- if (resolvePull) {
13636
- const resolve2 = resolvePull;
13637
- resolvePull = UNDEFINED_VALUE;
13638
- resolve2();
13639
- }
13640
- }
13641
- function fail(error2) {
13642
- if (!settled) {
13643
- settled = true;
13644
- controller.error(error2);
13645
- resumePump();
13646
- }
13595
+ function getTrailerError(error2) {
13596
+ const trailerError = new Error(outputLength == outputSize ? ERR_INVALID_CRC32 : ERR_INVALID_UNCOMPRESSED_SIZE);
13597
+ trailerError.cause = error2;
13598
+ return trailerError;
13647
13599
  }
13648
13600
  }
13601
+ function nextTask() {
13602
+ return new Promise((resolve2) => {
13603
+ const { port1, port2 } = new MessageChannel();
13604
+ port2.onmessage = () => {
13605
+ port1.close();
13606
+ port2.close();
13607
+ resolve2();
13608
+ };
13609
+ port1.postMessage(UNDEFINED_VALUE);
13610
+ });
13611
+ }
13649
13612
  function supportsFormat(StreamClass, format) {
13650
13613
  if (!StreamClass) {
13651
13614
  return false;
@@ -13694,7 +13657,7 @@ function getGzipCodecStream(useCompressionStream, CodecStreamNative, CodecStream
13694
13657
  return CodecStreamFallback;
13695
13658
  }
13696
13659
  }
13697
- function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback, sourceErrors) {
13660
+ function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback) {
13698
13661
  const Stream2 = useCompressionStream && CompressionStreamNative ? CompressionStreamNative : CompressionStreamFallback || CompressionStreamNative;
13699
13662
  const format = options.deflate64 ? FORMAT_DEFLATE64_RAW : FORMAT_DEFLATE_RAW;
13700
13663
  let codecStream;
@@ -13707,12 +13670,12 @@ function pipeThroughCompressionStream(readable, useCompressionStream, options, C
13707
13670
  throw error2;
13708
13671
  }
13709
13672
  }
13710
- return pipeThroughBackpressured(readable, codecStream, sourceErrors);
13673
+ return pipeThroughBackpressured(readable, codecStream);
13711
13674
  }
13712
13675
  function pipeThrough(readable, transformStream) {
13713
13676
  return toCompatibleReadable(readable).pipeThrough(transformStream);
13714
13677
  }
13715
- function pipeThroughBackpressured(readable, transformStream, sourceErrors) {
13678
+ function pipeThroughBackpressured(readable, transformStream) {
13716
13679
  const writer = transformStream.writable.getWriter();
13717
13680
  const reader = readable.getReader();
13718
13681
  pump();
@@ -13721,7 +13684,7 @@ function pipeThroughBackpressured(readable, transformStream, sourceErrors) {
13721
13684
  try {
13722
13685
  for (; ; ) {
13723
13686
  await writer.ready;
13724
- const result = await readSource(reader, sourceErrors);
13687
+ const result = await reader.read();
13725
13688
  if (result.done) {
13726
13689
  await writer.close();
13727
13690
  break;
@@ -13746,44 +13709,26 @@ async function cancel(reader, error2) {
13746
13709
  } catch {
13747
13710
  }
13748
13711
  }
13749
- function readSource(reader, sourceErrors) {
13750
- const result = reader.read();
13751
- return sourceErrors ? result.catch((error2) => {
13752
- sourceErrors.add(error2);
13753
- throw error2;
13754
- }) : result;
13755
- }
13756
- function mapCodecError(error2, sourceErrors) {
13757
- if (sourceErrors.has(error2)) {
13758
- return error2;
13759
- }
13760
- return mapError(error2, isMemoryError(error2) ? ERR_CODEC_OUT_OF_MEMORY : ERR_INVALID_COMPRESSED_DATA);
13761
- }
13762
- function mapMemoryError(error2) {
13763
- return isMemoryError(error2) ? mapError(error2, ERR_CODEC_OUT_OF_MEMORY) : error2;
13764
- }
13765
- function isMemoryError(error2) {
13766
- return isErrorObject(error2) && error2.code == Z_MEM_ERROR_CODE;
13767
- }
13768
- function mapError(error2, message) {
13769
- const mappedError = new Error(message);
13770
- mappedError.cause = error2;
13771
- return mappedError;
13772
- }
13773
- function mapInflateStreamError(readable, sourceErrors) {
13712
+ function mapInflateStreamError(readable) {
13774
13713
  const reader = readable.getReader();
13775
13714
  return new ReadableStream({
13776
13715
  async pull(controller) {
13716
+ let result;
13777
13717
  try {
13778
- const { value, done } = await reader.read();
13779
- if (done) {
13780
- controller.close();
13781
- } else {
13782
- controller.enqueue(value);
13783
- }
13718
+ result = await reader.read();
13784
13719
  } catch (error2) {
13785
- await cancel(reader, error2);
13786
- throw mapCodecError(error2, sourceErrors);
13720
+ if (error2 && error2.message) {
13721
+ throw error2;
13722
+ }
13723
+ const mappedError = new Error(ERR_INVALID_COMPRESSED_DATA);
13724
+ mappedError.cause = error2;
13725
+ throw mappedError;
13726
+ }
13727
+ const { value, done } = result;
13728
+ if (done) {
13729
+ controller.close();
13730
+ } else {
13731
+ controller.enqueue(value);
13787
13732
  }
13788
13733
  },
13789
13734
  cancel(reason) {
@@ -13791,7 +13736,7 @@ function mapInflateStreamError(readable, sourceErrors) {
13791
13736
  }
13792
13737
  });
13793
13738
  }
13794
- var ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_COMPRESSED_DATA, ERR_CODEC_OUT_OF_MEMORY, ERR_INVALID_CRC32, Z_MEM_ERROR_CODE, FORMAT_DEFLATE_RAW, FORMAT_DEFLATE64_RAW, FORMAT_GZIP, GZIP_HEADER_LENGTH, GZIP_TRAILER_LENGTH, GZIP_HEADER_BYTES, DeflateStream, GzipToRawDeflateStream, InflateStream, formatSupportByStream;
13739
+ var ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_COMPRESSED_DATA, ERR_INVALID_CRC32, FORMAT_DEFLATE_RAW, FORMAT_DEFLATE64_RAW, FORMAT_GZIP, GZIP_HEADER_LENGTH, GZIP_TRAILER_LENGTH, GZIP_HEADER_BYTES, DeflateStream, GzipToRawDeflateStream, InflateStream, formatSupportByStream;
13795
13740
  var init_zip_entry_stream = __esm({
13796
13741
  "../../node_modules/@zip.js/zip.js/lib/core/streams/zip-entry-stream.js"() {
13797
13742
  init_crc32();
@@ -13802,13 +13747,10 @@ var init_zip_entry_stream = __esm({
13802
13747
  init_constants();
13803
13748
  init_array();
13804
13749
  init_compatible_streams();
13805
- init_error();
13806
13750
  init_codec_registry();
13807
13751
  ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
13808
13752
  ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
13809
- ERR_CODEC_OUT_OF_MEMORY = "Codec out of memory";
13810
13753
  ERR_INVALID_CRC32 = "Invalid CRC32";
13811
- Z_MEM_ERROR_CODE = "Z_MEM_ERROR";
13812
13754
  FORMAT_DEFLATE_RAW = "deflate-raw";
13813
13755
  FORMAT_DEFLATE64_RAW = "deflate64-raw";
13814
13756
  FORMAT_GZIP = "gzip";
@@ -13841,13 +13783,13 @@ var init_zip_entry_stream = __esm({
13841
13783
  readable = pipeThroughCompressionStream(readable, useCompressionStream, { level, chunkSize }, CompressionStream2, CompressionStreamFallback);
13842
13784
  } catch (error2) {
13843
13785
  if (!useCompressionStream && CompressionStreamFallback) {
13844
- throw mapMemoryError(error2);
13786
+ throw error2;
13845
13787
  }
13846
13788
  let gzipStream;
13847
13789
  try {
13848
13790
  gzipStream = new CompressionStream2(FORMAT_GZIP);
13849
13791
  } catch {
13850
- throw mapMemoryError(error2);
13792
+ throw error2;
13851
13793
  }
13852
13794
  readable = pipeThroughBackpressured(readable, gzipStream);
13853
13795
  readable = pipeThrough(readable, new GzipToRawDeflateStream());
@@ -13924,12 +13866,11 @@ var init_zip_entry_stream = __esm({
13924
13866
  }
13925
13867
  }
13926
13868
  if (compressed) {
13927
- const sourceErrors = /* @__PURE__ */ new Set();
13928
13869
  const codecStreams2 = format && getCodecStreams(format);
13929
- let gzipStream;
13930
13870
  if (codecStreams2) {
13931
- readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams2.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }), sourceErrors);
13871
+ readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams2.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }));
13932
13872
  } else {
13873
+ let gzipStream;
13933
13874
  const GzipDecompressionStream = getGzipCodecStream(useCompressionStream, DecompressionStream2, DecompressionStreamFallback);
13934
13875
  if (checkCrc32 && !deflate64 && crc32 !== UNDEFINED_VALUE && outputSize !== UNDEFINED_VALUE && GzipDecompressionStream) {
13935
13876
  try {
@@ -13940,25 +13881,24 @@ var init_zip_entry_stream = __esm({
13940
13881
  }
13941
13882
  if (!gzipStream) {
13942
13883
  try {
13943
- readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream2, DecompressionStreamFallback, sourceErrors);
13884
+ readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream2, DecompressionStreamFallback);
13944
13885
  } catch (error2) {
13945
13886
  if (deflate64 || outputSize === UNDEFINED_VALUE || !useCompressionStream && DecompressionStreamFallback) {
13946
- throw mapMemoryError(error2);
13887
+ throw error2;
13947
13888
  }
13948
13889
  try {
13949
13890
  gzipStream = new DecompressionStream2(FORMAT_GZIP);
13950
13891
  } catch {
13951
- throw mapMemoryError(error2);
13892
+ throw error2;
13952
13893
  }
13953
13894
  }
13954
13895
  }
13896
+ if (gzipStream) {
13897
+ gzipCrc32 = true;
13898
+ readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32);
13899
+ }
13955
13900
  }
13956
- if (gzipStream) {
13957
- gzipCrc32 = true;
13958
- readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors);
13959
- } else {
13960
- readable = mapInflateStreamError(readable, sourceErrors);
13961
- }
13901
+ readable = mapInflateStreamError(readable);
13962
13902
  }
13963
13903
  if (checkCrc32 && !gzipCrc32) {
13964
13904
  crc32Stream = new Crc32Stream();
@@ -14174,8 +14114,7 @@ async function runWorker({ options, readable, writable, onTaskFinished, workerOp
14174
14114
  }
14175
14115
  codecStream = new CodecStream(options, config3);
14176
14116
  chunkStream = new ChunkStream(getChunkSize(config3));
14177
- const { signal } = workerOptions.streamOptions;
14178
- await readable.pipeThrough(codecStream).pipeThrough(chunkStream).pipeTo(writable, { preventClose: true, preventAbort: true, signal });
14117
+ await readable.pipeThrough(codecStream).pipeThrough(chunkStream).pipeTo(writable, { preventClose: true, preventAbort: true });
14179
14118
  const {
14180
14119
  crc32,
14181
14120
  inputSize,
@@ -15035,7 +14974,6 @@ __export(zip_reader_exports, {
15035
14974
  ERR_AMBIGUOUS_ARCHIVE: () => ERR_AMBIGUOUS_ARCHIVE,
15036
14975
  ERR_BAD_FORMAT: () => ERR_BAD_FORMAT,
15037
14976
  ERR_CENTRAL_DIRECTORY_NOT_FOUND: () => ERR_CENTRAL_DIRECTORY_NOT_FOUND,
15038
- ERR_CODEC_OUT_OF_MEMORY: () => ERR_CODEC_OUT_OF_MEMORY,
15039
14977
  ERR_ENCRYPTED: () => ERR_ENCRYPTED,
15040
14978
  ERR_ENCRYPTED_CENTRAL_DIRECTORY: () => ERR_ENCRYPTED_CENTRAL_DIRECTORY,
15041
14979
  ERR_ENTRY_DATA_OUT_OF_BOUNDS: () => ERR_ENTRY_DATA_OUT_OF_BOUNDS,
@@ -15671,7 +15609,7 @@ function getMaxAppendedDataSize(maxAppendedDataSize, strictness) {
15671
15609
  async function findEndOfCentralDirectory(reader, rejectAmbiguous, maxAppendedDataSize) {
15672
15610
  const { size } = reader;
15673
15611
  const anchoredLength = Math.min(size, END_OF_CENTRAL_DIR_LENGTH + MAX_16_BITS);
15674
- const remoteProbeBudget = { remaining: MAX_END_OF_CENTRAL_DIR_PROBES };
15612
+ const remoteProbeBudget = { count: MAX_END_OF_CENTRAL_DIR_PROBES };
15675
15613
  let endOfDirectoryInfo;
15676
15614
  let plausibleEndOfDirectoryInfo;
15677
15615
  let endOfDirectoryReachingEndCount = 0;
@@ -15758,8 +15696,8 @@ async function readSignature(reader, view, anchoredOffset, signatureOffset, size
15758
15696
  if (signatureOffset >= anchoredOffset) {
15759
15697
  return getUint32(view, signatureOffset - anchoredOffset);
15760
15698
  }
15761
- if (remoteProbeBudget.remaining > 0) {
15762
- remoteProbeBudget.remaining--;
15699
+ if (remoteProbeBudget.count > 0) {
15700
+ remoteProbeBudget.count--;
15763
15701
  const signatureArray = await readUint8Array(reader, signatureOffset, 4);
15764
15702
  return getUint32(getDataView(signatureArray), 0);
15765
15703
  }
@@ -16395,8 +16333,8 @@ var init_zip_reader = __esm({
16395
16333
  const passThroughCompression = Boolean(passThrough);
16396
16334
  const passThroughEncryption = passThrough === true;
16397
16335
  checkPasswordOption(password, rawPassword);
16398
- password = password && password.length ? password : UNDEFINED_VALUE;
16399
- rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
16336
+ password = password && password.length && password;
16337
+ rawPassword = rawPassword && rawPassword.length && rawPassword;
16400
16338
  if (extraFieldAES) {
16401
16339
  if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {
16402
16340
  throw new Error(ERR_UNSUPPORTED_COMPRESSION);
@@ -16541,7 +16479,6 @@ var init_zip_reader = __esm({
16541
16479
  ({ writable } = writer);
16542
16480
  const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
16543
16481
  const { outputSize: writtenSize } = await runWorker2({ readable, writable }, workerOptions);
16544
- throwIfAborted(signal);
16545
16482
  if (writtenSize != outputSize) {
16546
16483
  throw Object.assign(new Error(ERR_INVALID_UNCOMPRESSED_SIZE), { outputSize: writtenSize });
16547
16484
  }
@@ -16623,6 +16560,15 @@ var ERROR_CATALOG = {
16623
16560
  CARD_BINDING_CONTEXT_STALE: { retryable: false, exitCode: 1 },
16624
16561
  CARD_BINDING_VALIDATION_FAILED: { retryable: false, exitCode: 1 },
16625
16562
  CARD_RUNTIME_SCHEMA_UNSUPPORTED: { retryable: false, exitCode: 1 },
16563
+ CARD_TRANSFORM_BUSY: { retryable: true, exitCode: 1 },
16564
+ CARD_TRANSFORM_INPUT_TOO_LARGE: { retryable: false, exitCode: 1 },
16565
+ CARD_TRANSFORM_OUTPUT_INVALID: { retryable: false, exitCode: 1 },
16566
+ CARD_TRANSFORM_OUTPUT_SCHEMA_MISMATCH: { retryable: false, exitCode: 1 },
16567
+ CARD_TRANSFORM_OUTPUT_TOO_LARGE: { retryable: false, exitCode: 1 },
16568
+ CARD_TRANSFORM_RESOURCE_EXCEEDED: { retryable: false, exitCode: 1 },
16569
+ CARD_TRANSFORM_SOURCE_INVALID: { retryable: false, exitCode: 1 },
16570
+ CARD_TRANSFORM_TIMEOUT: { retryable: false, exitCode: 1 },
16571
+ CARD_TRANSFORM_FAILED: { retryable: false, exitCode: 1 },
16626
16572
  CARD_FINALIZE_CONFLICT: { retryable: false, exitCode: 1 },
16627
16573
  CARD_FINALIZE_CONFIG_TOO_LARGE: { retryable: false, exitCode: 1 },
16628
16574
  CARD_FINALIZE_LOCK_TIMEOUT: { retryable: true, exitCode: 1 },
@@ -19948,6 +19894,7 @@ var withWorkspaceLock = async (options, operation) => {
19948
19894
  var import_esbuild = require("esbuild");
19949
19895
  var import_node_fs7 = require("node:fs");
19950
19896
  var import_node_path10 = require("node:path");
19897
+ var import_node_module = require("node:module");
19951
19898
  var import_node_zlib = require("node:zlib");
19952
19899
  function distModulePath(pkgRoot, rel) {
19953
19900
  return (0, import_node_path10.resolve)(pkgRoot, "dist", "esm", rel);
@@ -19996,6 +19943,7 @@ async function createBundler(input) {
19996
19943
  if (!outputFile) throw new Error("esbuild \u672A\u4EA7\u51FA\u6587\u4EF6");
19997
19944
  const outputPath = (0, import_node_path10.join)(outDir, "index.js");
19998
19945
  (0, import_node_fs7.writeFileSync)(outputPath, outputFile.text, "utf8");
19946
+ await buildDataTransformWorker(pkgRoot, outDir, minify);
19999
19947
  const bundleName = "@alipay/linkque-agent-appwrite-gateway-bundle";
20000
19948
  (0, import_node_fs7.writeFileSync)(
20001
19949
  (0, import_node_path10.join)(outDir, "package.json"),
@@ -20028,6 +19976,60 @@ async function createBundler(input) {
20028
19976
  (0, import_node_fs7.rmSync)(bakeDir, { recursive: true, force: true });
20029
19977
  }
20030
19978
  }
19979
+ async function buildDataTransformWorker(pkgRoot, outDir, minify) {
19980
+ const portableRoot = (0, import_node_path10.join)(pkgRoot, "data-transform");
19981
+ const portableWorker = (0, import_node_path10.join)(portableRoot, "dataTransformWorker.js");
19982
+ const portableWasm = (0, import_node_path10.join)(portableRoot, "emscripten-module.wasm");
19983
+ if ((0, import_node_fs7.existsSync)(portableWorker) && (0, import_node_fs7.existsSync)(portableWasm)) {
19984
+ (0, import_node_fs7.copyFileSync)(portableWorker, (0, import_node_path10.join)(outDir, "dataTransformWorker.js"));
19985
+ (0, import_node_fs7.copyFileSync)(portableWasm, (0, import_node_path10.join)(outDir, "emscripten-module.wasm"));
19986
+ return;
19987
+ }
19988
+ const resolver = (0, import_node_module.createRequire)((0, import_node_path10.join)(pkgRoot, "package.json"));
19989
+ const runtimeRoot = (0, import_node_path10.dirname)(
19990
+ resolver.resolve("@alipay/linkque-agent-runtime/package.json")
19991
+ );
19992
+ const quickJsRoot = (0, import_node_path10.dirname)(
19993
+ resolver.resolve("@jitl/quickjs-wasmfile-release-sync/package.json")
19994
+ );
19995
+ const workerEntry = (0, import_node_path10.join)(runtimeRoot, "dist/esm/core/dataTransformWorker.js");
19996
+ const variantCjs = (0, import_node_path10.join)(quickJsRoot, "dist/index.js");
19997
+ const emscriptenCjs = (0, import_node_path10.join)(quickJsRoot, "dist/emscripten-module.cjs");
19998
+ await (0, import_esbuild.build)({
19999
+ entryPoints: [workerEntry],
20000
+ bundle: true,
20001
+ format: "cjs",
20002
+ platform: "node",
20003
+ target: "node22",
20004
+ outfile: (0, import_node_path10.join)(outDir, "dataTransformWorker.js"),
20005
+ minify,
20006
+ sourcemap: false,
20007
+ treeShaking: true,
20008
+ legalComments: "none",
20009
+ logLevel: "warning",
20010
+ plugins: [
20011
+ {
20012
+ name: "quickjs-node-cjs",
20013
+ setup(api) {
20014
+ api.onResolve(
20015
+ { filter: /^@jitl\/quickjs-wasmfile-release-sync$/u },
20016
+ () => ({ path: variantCjs })
20017
+ );
20018
+ api.onResolve(
20019
+ {
20020
+ filter: /^@jitl\/quickjs-wasmfile-release-sync\/emscripten-module$/u
20021
+ },
20022
+ () => ({ path: emscriptenCjs })
20023
+ );
20024
+ }
20025
+ }
20026
+ ]
20027
+ });
20028
+ (0, import_node_fs7.copyFileSync)(
20029
+ (0, import_node_path10.join)(quickJsRoot, "dist/emscripten-module.wasm"),
20030
+ (0, import_node_path10.join)(outDir, "emscripten-module.wasm")
20031
+ );
20032
+ }
20031
20033
  function prepareBakeDir(bakeDir) {
20032
20034
  (0, import_node_fs7.rmSync)(bakeDir, { recursive: true, force: true });
20033
20035
  (0, import_node_fs7.mkdirSync)(bakeDir, { recursive: true });
@@ -20120,6 +20122,288 @@ var EModelRequestSource;
20120
20122
  EModelRequestSource2["APPBASE_FUNCTION"] = "APPBASE_FUNCTION";
20121
20123
  })(EModelRequestSource || (EModelRequestSource = {}));
20122
20124
 
20125
+ // ../linkque-agent-runtime/dist/esm/core/dataTransformExecutor.js
20126
+ var import_node_crypto2 = require("node:crypto");
20127
+ var import_node_path11 = require("node:path");
20128
+ var import_node_module2 = require("node:module");
20129
+ var import_node_url = require("node:url");
20130
+ var import_node_worker_threads = require("node:worker_threads");
20131
+ var DATA_TRANSFORM_LIMITS = Object.freeze({
20132
+ sourceBytes: 32 * 1024,
20133
+ inputBytes: 2 * 1024 * 1024,
20134
+ outputBytes: 1024 * 1024,
20135
+ maxDepth: 64,
20136
+ memoryBytes: 32 * 1024 * 1024,
20137
+ stackBytes: 512 * 1024,
20138
+ executionMs: 100,
20139
+ watchdogMs: 500,
20140
+ initializationMs: 5e3,
20141
+ maxConcurrent: 4,
20142
+ maxQueued: 32
20143
+ });
20144
+ var DataTransformError = class extends Error {
20145
+ code;
20146
+ sourceHash;
20147
+ constructor(code, message, sourceHash) {
20148
+ super(message);
20149
+ this.code = code;
20150
+ this.sourceHash = sourceHash;
20151
+ this.name = "DataTransformError";
20152
+ }
20153
+ };
20154
+ var DataTransformExecutor = class {
20155
+ workerUrl;
20156
+ queue = [];
20157
+ slots = [];
20158
+ nextRequestId = 1;
20159
+ disposed = false;
20160
+ constructor(workerUrl = defaultWorkerUrl()) {
20161
+ this.workerUrl = workerUrl;
20162
+ }
20163
+ execute(source, input, signal) {
20164
+ const sourceBytes = Buffer.byteLength(source, "utf8");
20165
+ const sourceHash = (0, import_node_crypto2.createHash)("sha256").update(source).digest("hex");
20166
+ if (!source.trim() || sourceBytes > DATA_TRANSFORM_LIMITS.sourceBytes) {
20167
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_SOURCE_INVALID", `\u6570\u636E\u8F6C\u6362\u6E90\u7801\u4E3A\u7A7A\u6216\u8D85\u8FC7 ${DATA_TRANSFORM_LIMITS.sourceBytes} \u5B57\u8282`, sourceHash));
20168
+ }
20169
+ if (signal?.aborted) {
20170
+ return Promise.reject(signal.reason ?? new Error("\u64CD\u4F5C\u5DF2\u53D6\u6D88"));
20171
+ }
20172
+ let inputJson;
20173
+ try {
20174
+ inputJson = JSON.stringify(input);
20175
+ } catch {
20176
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_INPUT_TOO_LARGE", "\u6570\u636E\u8F6C\u6362\u8F93\u5165\u65E0\u6CD5\u5E8F\u5217\u5316", sourceHash));
20177
+ }
20178
+ const inputBytes = Buffer.byteLength(inputJson, "utf8");
20179
+ if (inputBytes > DATA_TRANSFORM_LIMITS.inputBytes || jsonDepth(input) > DATA_TRANSFORM_LIMITS.maxDepth) {
20180
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_INPUT_TOO_LARGE", "\u6570\u636E\u8F6C\u6362\u8F93\u5165\u8D85\u8FC7\u5927\u5C0F\u6216\u6DF1\u5EA6\u9650\u5236", sourceHash));
20181
+ }
20182
+ const active = this.slots.filter((slot) => slot.busy).length;
20183
+ if (active >= DATA_TRANSFORM_LIMITS.maxConcurrent && this.queue.length >= DATA_TRANSFORM_LIMITS.maxQueued) {
20184
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_BUSY", "\u6570\u636E\u8F6C\u6362\u6267\u884C\u961F\u5217\u5DF2\u6EE1", sourceHash));
20185
+ }
20186
+ if (this.disposed) {
20187
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_FAILED", "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5668\u5DF2\u5173\u95ED", sourceHash));
20188
+ }
20189
+ return new Promise((resolve2, reject) => {
20190
+ this.queue.push({
20191
+ mode: "execute",
20192
+ source,
20193
+ sourceHash,
20194
+ inputJson,
20195
+ inputBytes,
20196
+ signal,
20197
+ resolve: resolve2,
20198
+ reject
20199
+ });
20200
+ this.drain();
20201
+ });
20202
+ }
20203
+ validateSource(source) {
20204
+ const sourceBytes = Buffer.byteLength(source, "utf8");
20205
+ const sourceHash = (0, import_node_crypto2.createHash)("sha256").update(source).digest("hex");
20206
+ if (!source.trim() || sourceBytes > DATA_TRANSFORM_LIMITS.sourceBytes) {
20207
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_SOURCE_INVALID", `\u6570\u636E\u8F6C\u6362\u6E90\u7801\u4E3A\u7A7A\u6216\u8D85\u8FC7 ${DATA_TRANSFORM_LIMITS.sourceBytes} \u5B57\u8282`, sourceHash));
20208
+ }
20209
+ if (this.disposed) {
20210
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_FAILED", "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5668\u5DF2\u5173\u95ED", sourceHash));
20211
+ }
20212
+ const active = this.slots.filter((slot) => slot.busy).length;
20213
+ if (active >= DATA_TRANSFORM_LIMITS.maxConcurrent && this.queue.length >= DATA_TRANSFORM_LIMITS.maxQueued) {
20214
+ return Promise.reject(new DataTransformError("CARD_TRANSFORM_BUSY", "\u6570\u636E\u8F6C\u6362\u6267\u884C\u961F\u5217\u5DF2\u6EE1", sourceHash));
20215
+ }
20216
+ return new Promise((resolve2, reject) => {
20217
+ this.queue.push({
20218
+ mode: "validate",
20219
+ source,
20220
+ sourceHash,
20221
+ inputJson: "[]",
20222
+ inputBytes: 2,
20223
+ resolve: () => resolve2(),
20224
+ reject
20225
+ });
20226
+ this.drain();
20227
+ });
20228
+ }
20229
+ async close() {
20230
+ this.disposed = true;
20231
+ for (const queued of this.queue.splice(0)) {
20232
+ queued.reject(new DataTransformError("CARD_TRANSFORM_FAILED", "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5668\u5DF2\u5173\u95ED", queued.sourceHash));
20233
+ }
20234
+ await Promise.all(this.slots.splice(0).map(async (slot) => {
20235
+ slot.disposed = true;
20236
+ await slot.worker.terminate();
20237
+ }));
20238
+ }
20239
+ drain() {
20240
+ if (this.disposed)
20241
+ return;
20242
+ while (this.queue.length > 0) {
20243
+ let slot = this.slots.find((candidate) => !candidate.busy);
20244
+ if (!slot && this.slots.length < DATA_TRANSFORM_LIMITS.maxConcurrent) {
20245
+ slot = this.createSlot();
20246
+ this.slots.push(slot);
20247
+ }
20248
+ if (!slot)
20249
+ return;
20250
+ const queued = this.queue.shift();
20251
+ if (!queued)
20252
+ return;
20253
+ if (queued.signal?.aborted) {
20254
+ queued.reject(queued.signal.reason ?? new Error("\u64CD\u4F5C\u5DF2\u53D6\u6D88"));
20255
+ continue;
20256
+ }
20257
+ slot.busy = true;
20258
+ void this.run(slot, queued).finally(() => {
20259
+ if (!slot.disposed)
20260
+ slot.busy = false;
20261
+ this.drain();
20262
+ });
20263
+ }
20264
+ }
20265
+ createSlot() {
20266
+ const worker = new import_node_worker_threads.Worker(this.workerUrl);
20267
+ const slot = {
20268
+ worker,
20269
+ busy: false,
20270
+ disposed: false,
20271
+ ready: Promise.resolve()
20272
+ };
20273
+ slot.ready = new Promise((resolve2, reject) => {
20274
+ const timeout = setTimeout(() => {
20275
+ reject(new DataTransformError("CARD_TRANSFORM_TIMEOUT", "\u6570\u636E\u8F6C\u6362\u5F15\u64CE\u521D\u59CB\u5316\u8D85\u65F6"));
20276
+ this.discardSlot(slot);
20277
+ }, DATA_TRANSFORM_LIMITS.initializationMs);
20278
+ worker.once("message", (message) => {
20279
+ if (message?.type !== "ready")
20280
+ return;
20281
+ clearTimeout(timeout);
20282
+ resolve2();
20283
+ });
20284
+ worker.once("error", (error2) => {
20285
+ clearTimeout(timeout);
20286
+ reject(error2);
20287
+ });
20288
+ });
20289
+ return slot;
20290
+ }
20291
+ async run(slot, queued) {
20292
+ try {
20293
+ await slot.ready;
20294
+ } catch (error2) {
20295
+ queued.reject(error2 instanceof DataTransformError ? error2 : new DataTransformError("CARD_TRANSFORM_FAILED", error2 instanceof Error ? error2.message : "\u6570\u636E\u8F6C\u6362\u5F15\u64CE\u521D\u59CB\u5316\u5931\u8D25", queued.sourceHash));
20296
+ this.discardSlot(slot);
20297
+ return;
20298
+ }
20299
+ if (queued.signal?.aborted) {
20300
+ queued.reject(queued.signal.reason ?? new Error("\u64CD\u4F5C\u5DF2\u53D6\u6D88"));
20301
+ return;
20302
+ }
20303
+ const requestId = this.nextRequestId++;
20304
+ await new Promise((resolve2) => {
20305
+ let settled = false;
20306
+ let watchdog;
20307
+ const finish = (callback) => {
20308
+ if (settled)
20309
+ return;
20310
+ settled = true;
20311
+ clearTimeout(watchdog);
20312
+ queued.signal?.removeEventListener("abort", abort2);
20313
+ slot.worker.off("message", onMessage2);
20314
+ slot.worker.off("error", onError);
20315
+ callback();
20316
+ resolve2();
20317
+ };
20318
+ const abort2 = () => {
20319
+ finish(() => {
20320
+ queued.reject(queued.signal?.reason ?? new Error("\u64CD\u4F5C\u5DF2\u53D6\u6D88"));
20321
+ this.discardSlot(slot);
20322
+ });
20323
+ };
20324
+ const onError = (error2) => {
20325
+ finish(() => {
20326
+ queued.reject(new DataTransformError("CARD_TRANSFORM_FAILED", error2.message, queued.sourceHash));
20327
+ this.discardSlot(slot);
20328
+ });
20329
+ };
20330
+ const onMessage2 = (message) => {
20331
+ if (message?.type !== "result" || message.requestId !== requestId)
20332
+ return;
20333
+ finish(() => this.acceptWorkerResult(queued, message));
20334
+ };
20335
+ watchdog = setTimeout(() => {
20336
+ finish(() => {
20337
+ queued.reject(new DataTransformError("CARD_TRANSFORM_TIMEOUT", "\u6570\u636E\u8F6C\u6362\u8D85\u8FC7\u5BBF\u4E3B\u6267\u884C\u671F\u9650", queued.sourceHash));
20338
+ this.discardSlot(slot);
20339
+ });
20340
+ }, DATA_TRANSFORM_LIMITS.watchdogMs);
20341
+ queued.signal?.addEventListener("abort", abort2, { once: true });
20342
+ slot.worker.on("message", onMessage2);
20343
+ slot.worker.once("error", onError);
20344
+ slot.worker.postMessage({
20345
+ type: "execute",
20346
+ mode: queued.mode,
20347
+ requestId,
20348
+ source: queued.source,
20349
+ inputJson: queued.inputJson,
20350
+ limits: DATA_TRANSFORM_LIMITS
20351
+ });
20352
+ });
20353
+ }
20354
+ acceptWorkerResult(queued, message) {
20355
+ if (!message.ok || typeof message.resultJson !== "string") {
20356
+ queued.reject(new DataTransformError(message.code ?? "CARD_TRANSFORM_FAILED", message.message ?? "\u6570\u636E\u8F6C\u6362\u6267\u884C\u5931\u8D25", queued.sourceHash));
20357
+ return;
20358
+ }
20359
+ const outputBytes = Buffer.byteLength(message.resultJson, "utf8");
20360
+ if (outputBytes > DATA_TRANSFORM_LIMITS.outputBytes) {
20361
+ queued.reject(new DataTransformError("CARD_TRANSFORM_OUTPUT_TOO_LARGE", "\u6570\u636E\u8F6C\u6362\u7ED3\u679C\u8D85\u8FC7\u5927\u5C0F\u9650\u5236", queued.sourceHash));
20362
+ return;
20363
+ }
20364
+ try {
20365
+ const data = JSON.parse(message.resultJson);
20366
+ if (data !== null && (typeof data !== "object" || Array.isArray(data) || jsonDepth(data) > DATA_TRANSFORM_LIMITS.maxDepth)) {
20367
+ throw new DataTransformError("CARD_TRANSFORM_OUTPUT_INVALID", "\u6570\u636E\u8F6C\u6362\u7ED3\u679C\u5FC5\u987B\u662F JSON \u5BF9\u8C61\u6216 null", queued.sourceHash);
20368
+ }
20369
+ queued.resolve({
20370
+ data,
20371
+ durationMs: message.durationMs ?? 0,
20372
+ inputBytes: queued.inputBytes,
20373
+ outputBytes,
20374
+ sourceHash: queued.sourceHash
20375
+ });
20376
+ } catch (error2) {
20377
+ queued.reject(error2 instanceof DataTransformError ? error2 : new DataTransformError("CARD_TRANSFORM_OUTPUT_INVALID", "\u6570\u636E\u8F6C\u6362\u7ED3\u679C\u4E0D\u662F\u6709\u6548 JSON", queued.sourceHash));
20378
+ }
20379
+ }
20380
+ discardSlot(slot) {
20381
+ if (slot.disposed)
20382
+ return;
20383
+ slot.disposed = true;
20384
+ const index = this.slots.indexOf(slot);
20385
+ if (index >= 0)
20386
+ this.slots.splice(index, 1);
20387
+ void slot.worker.terminate();
20388
+ }
20389
+ };
20390
+ function defaultWorkerUrl() {
20391
+ if (typeof __dirname === "string") {
20392
+ return (0, import_node_url.pathToFileURL)((0, import_node_path11.join)(__dirname, "dataTransformWorker.js"));
20393
+ }
20394
+ const resolver = (0, import_node_module2.createRequire)((0, import_node_url.pathToFileURL)((0, import_node_path11.join)(process.cwd(), "__linkque_worker_resolver__.js")).href);
20395
+ const packageJson = resolver.resolve("@alipay/linkque-agent-runtime/package.json");
20396
+ return (0, import_node_url.pathToFileURL)((0, import_node_path11.join)((0, import_node_path11.dirname)(packageJson), "dist/esm/core/dataTransformWorker.js"));
20397
+ }
20398
+ function jsonDepth(value, depth = 0) {
20399
+ if (value === null || typeof value !== "object")
20400
+ return depth;
20401
+ if (depth > DATA_TRANSFORM_LIMITS.maxDepth)
20402
+ return depth;
20403
+ const children = Array.isArray(value) ? value : Object.values(value);
20404
+ return children.reduce((maximum, child) => Math.max(maximum, jsonDepth(child, depth + 1)), depth);
20405
+ }
20406
+
20123
20407
  // ../linkque-agent-runtime/dist/esm/core/types.js
20124
20408
  var EDebugLogScope;
20125
20409
  (function(EDebugLogScope2) {
@@ -20183,6 +20467,7 @@ var EHookExecutorName;
20183
20467
  EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
20184
20468
  EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
20185
20469
  EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
20470
+ EHookExecutorName2["CurrentTimeHookExecutor"] = "CurrentTimeHookExecutor";
20186
20471
  })(EHookExecutorName || (EHookExecutorName = {}));
20187
20472
 
20188
20473
  // ../agent-a2ui-card-contract/dist/esm/protocol.js
@@ -20194,6 +20479,9 @@ var A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
20194
20479
  var A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
20195
20480
  var A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
20196
20481
  var A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
20482
+ var A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
20483
+ var A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
20484
+ var A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
20197
20485
 
20198
20486
  // ../linkque-agent-data-binding-contract/dist/esm/json.js
20199
20487
  var BLOCKED_PATH_SEGMENTS = /* @__PURE__ */ new Set([
@@ -20360,8 +20648,8 @@ function analyzeA2UIBindings(protocol) {
20360
20648
  visitValue(component, "", context);
20361
20649
  const children = component.children;
20362
20650
  if (isPlainRecord(children) && typeof children.path === "string") {
20363
- const canonicalPath = canonicalizeBindingPath(children.path);
20364
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath)) {
20651
+ const canonicalPath = canonicalizeBindingPath(children.path, context.listRoot);
20652
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
20365
20653
  issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}.children.path`, "INVALID_BINDING_PATH", `Invalid list path ${children.path}`));
20366
20654
  } else {
20367
20655
  occurrences.push({
@@ -20371,6 +20659,7 @@ function analyzeA2UIBindings(protocol) {
20371
20659
  propertyPath: "children.path",
20372
20660
  rawPath: children.path,
20373
20661
  canonicalPath,
20662
+ ...context.listRoot ? { listRoot: context.listRoot } : {},
20374
20663
  usage: "list"
20375
20664
  });
20376
20665
  }
@@ -20435,6 +20724,7 @@ function addOccurrence(rawPath, propertyPath, usage, context) {
20435
20724
  propertyPath,
20436
20725
  rawPath,
20437
20726
  canonicalPath,
20727
+ ...context.listRoot ? { listRoot: context.listRoot } : {},
20438
20728
  usage
20439
20729
  });
20440
20730
  }
@@ -20545,6 +20835,33 @@ function validateJsonSchemaValue2(schema, value, path24 = "$") {
20545
20835
  validateValue(schema, value, path24, issues);
20546
20836
  return issues;
20547
20837
  }
20838
+ function normalizeCardDataValue(schema, value, required2 = true) {
20839
+ if (value === void 0 || value === null)
20840
+ return required2 ? value : void 0;
20841
+ let normalized = value;
20842
+ if (schema.type === "string" && (typeof value === "boolean" || typeof value === "number" && Number.isFinite(value))) {
20843
+ normalized = String(value);
20844
+ } else if ((schema.type === "number" || schema.type === "integer") && typeof value === "string") {
20845
+ const text = value.trim();
20846
+ if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u.test(text)) {
20847
+ const number4 = Number(text);
20848
+ if (Number.isFinite(number4) && (schema.type !== "integer" || Number.isSafeInteger(number4))) {
20849
+ normalized = number4;
20850
+ }
20851
+ }
20852
+ } else if (schema.type === "object" && isPlainRecord(value)) {
20853
+ const properties = isPlainRecord(schema.properties) ? schema.properties : {};
20854
+ const requiredKeys = new Set(Array.isArray(schema.required) ? schema.required : []);
20855
+ normalized = Object.fromEntries(Object.entries(value).flatMap(([key, child]) => {
20856
+ const childSchema = properties[key];
20857
+ const next = isPlainRecord(childSchema) ? normalizeCardDataValue(childSchema, child, requiredKeys.has(key)) : child;
20858
+ return next === void 0 ? [] : [[key, next]];
20859
+ }));
20860
+ } else if (schema.type === "array" && Array.isArray(value) && isPlainRecord(schema.items)) {
20861
+ normalized = value.map((child) => normalizeCardDataValue(schema.items, child));
20862
+ }
20863
+ return !required2 && validateJsonSchemaValue2(schema, normalized).length > 0 ? void 0 : normalized;
20864
+ }
20548
20865
  function generateJsonSchemaSample(schema) {
20549
20866
  const defaultValue = cloneJsonValue(schema.default);
20550
20867
  if (defaultValue !== void 0)
@@ -21455,7 +21772,8 @@ var decoration = {
21455
21772
  "primary",
21456
21773
  "primary-muted",
21457
21774
  "accent",
21458
- "warning"
21775
+ "warning",
21776
+ "transparent"
21459
21777
  ]
21460
21778
  },
21461
21779
  border: {
@@ -21467,6 +21785,7 @@ var decoration = {
21467
21785
  var typography = {
21468
21786
  color: { kind: "string", values: colors },
21469
21787
  fontSize: { kind: "string", values: ["xs", "sm", "md", "lg", "xl", "xxl"] },
21788
+ fontFamily: { kind: "string", values: ["digit", "digit-bold"] },
21470
21789
  fontWeight: { kind: "string", values: ["normal", "semibold", "bold"] }
21471
21790
  };
21472
21791
  var container = {
@@ -21503,6 +21822,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21503
21822
  ...layoutItem,
21504
21823
  ...containerSize,
21505
21824
  ...decoration,
21825
+ verticalAlign: { kind: "string", values: ["top", "center", "bottom"] },
21506
21826
  child: { kind: "child", required: true },
21507
21827
  action: { kind: "action" },
21508
21828
  disabled: { kind: "boolean" }
@@ -21537,8 +21857,8 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21537
21857
  shrink: { kind: "boolean" },
21538
21858
  text: { kind: "binding", required: true },
21539
21859
  maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
21540
- decoration: { kind: "string", values: ["line-through"] },
21541
- format: { kind: "format" }
21860
+ textAlign: { kind: "string", values: ["left", "center", "right"] },
21861
+ decoration: { kind: "string", values: ["line-through"] }
21542
21862
  }
21543
21863
  },
21544
21864
  Tag: {
@@ -21547,6 +21867,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21547
21867
  ...layoutItem,
21548
21868
  text: { kind: "binding", required: true },
21549
21869
  icon: { kind: "string", values: iconNames },
21870
+ image: { kind: "binding" },
21550
21871
  tone: {
21551
21872
  kind: "string",
21552
21873
  values: [
@@ -21602,7 +21923,20 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21602
21923
  height: { kind: "string", values: ["auto", "fill"] },
21603
21924
  size: {
21604
21925
  kind: "string",
21605
- values: ["xs", "sm", "md", "lg", "xl", "full"]
21926
+ values: [
21927
+ "xs",
21928
+ "sm",
21929
+ "md",
21930
+ "lg",
21931
+ "xl",
21932
+ "full",
21933
+ "text-xs",
21934
+ "text-sm",
21935
+ "text-md",
21936
+ "text-lg",
21937
+ "text-xl",
21938
+ "text-xxl"
21939
+ ]
21606
21940
  }
21607
21941
  }
21608
21942
  },
@@ -21646,7 +21980,6 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21646
21980
  "x2-funds"
21647
21981
  ]
21648
21982
  },
21649
- format: { kind: "string", values: ["date"] },
21650
21983
  validationRegexp: { kind: "string" },
21651
21984
  "x2-limit": { kind: "number" }
21652
21985
  }
@@ -21757,14 +22090,6 @@ function validateV4Component(component, componentPath, issues) {
21757
22090
  issues.push(issue2(`${componentPath}.component`, "UNSUPPORTED_COMPONENT", `V4 does not support component ${component.component}`));
21758
22091
  return;
21759
22092
  }
21760
- const allowed = /* @__PURE__ */ new Set([
21761
- "id",
21762
- "component",
21763
- ...Object.keys(schema.properties)
21764
- ]);
21765
- for (const key of Object.keys(component))
21766
- if (!allowed.has(key))
21767
- issues.push(issue2(`${componentPath}.${key}`, "UNSUPPORTED_COMPONENT_PROP", `${component.component} does not support property ${key}`));
21768
22093
  for (const [name, property] of Object.entries(schema.properties)) {
21769
22094
  const value = component[name];
21770
22095
  if (property.required && value === void 0)
@@ -21794,8 +22119,8 @@ function validateV4Component(component, componentPath, issues) {
21794
22119
  }
21795
22120
  if (component.checks !== void 0)
21796
22121
  validateChecks(component.checks, `${componentPath}.checks`, issues);
21797
- if (component.format !== void 0 && component.component === "Text")
21798
- validateNumberFormat(component.format, `${componentPath}.format`, issues);
22122
+ if (component.component === "Tag" && component.icon !== void 0 && component.image !== void 0)
22123
+ issues.push(issue2(componentPath, "INVALID_COMPONENT_PROP_VALUE", "Tag icon and image cannot be used together"));
21799
22124
  if (component.action !== void 0)
21800
22125
  validateAction(component.action, `${componentPath}.action`, issues, 0);
21801
22126
  }
@@ -21820,7 +22145,7 @@ function validateComponents(payload, path24, surfaces, issues) {
21820
22145
  }
21821
22146
  function validateProperty(value, schema, path24, issues, propertyName) {
21822
22147
  if (schema.kind === "binding") {
21823
- const stringOnly = propertyName === "label" || propertyName === "src" || propertyName === "alt";
22148
+ const stringOnly = propertyName === "label" || propertyName === "src" || propertyName === "alt" || propertyName === "image";
21824
22149
  const literalValid = typeof value === "string" || !stringOnly && typeof value === "number" && Number.isFinite(value);
21825
22150
  if (!literalValid && !isDisplayBinding(value, stringOnly))
21826
22151
  issues.push(issue2(path24, "INVALID_DISPLAY_VALUE", `display value must be ${stringOnly ? "a string" : "a string or finite number"}, or a compatible display binding`));
@@ -21843,10 +22168,10 @@ function validateProperty(value, schema, path24, issues, propertyName) {
21843
22168
  return;
21844
22169
  if (schema.kind === "boolean" && typeof value !== "boolean")
21845
22170
  issues.push(issue2(path24, "INVALID_COMPONENT_PROP_TYPE", "value must be boolean"));
21846
- if (schema.kind === "number" && (!Number.isFinite(value) || schema.values && !schema.values.includes(value)))
21847
- issues.push(issue2(path24, "INVALID_COMPONENT_PROP_VALUE", "value is not an allowed finite number"));
21848
- if (schema.kind === "string" && (typeof value !== "string" || schema.values && !schema.values.includes(value)))
21849
- issues.push(issue2(path24, "INVALID_COMPONENT_PROP_VALUE", "value is not an allowed string"));
22171
+ if (schema.kind === "number" && !Number.isFinite(value))
22172
+ issues.push(issue2(path24, "INVALID_COMPONENT_PROP_VALUE", "value must be a finite number"));
22173
+ if (schema.kind === "string" && typeof value !== "string")
22174
+ issues.push(issue2(path24, "INVALID_COMPONENT_PROP_VALUE", "value must be a string"));
21850
22175
  }
21851
22176
  function isDisplayBinding(value, stringOnly = false) {
21852
22177
  if (!isPlainRecord(value) || typeof value.path !== "string" || !isSafePath(value.path))
@@ -21938,51 +22263,8 @@ function validateClientAction(body, path24, issues) {
21938
22263
  issues.push(issue2(`${path24}.context.url`, "INVALID_PAGE_URL", "ui.page.open URL must use https or the approved Alipay scheme"));
21939
22264
  return;
21940
22265
  }
21941
- if (body.name === "payment.trade-pay") {
21942
- validatePaymentActionContext(body.context, `${path24}.context`, issues);
21943
- return;
21944
- }
21945
22266
  issues.push(issue2(`${path24}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
21946
22267
  }
21947
- function validatePaymentActionContext(value, path24, issues) {
21948
- if (!isPlainRecord(value)) {
21949
- issues.push(issue2(path24, "INVALID_CLIENT_ACTION_CONTEXT", "payment.trade-pay requires createTrade and onSuccess"));
21950
- return;
21951
- }
21952
- rejectUnknownKeys(value, ["createTrade", "onSuccess"], path24, issues);
21953
- const createTrade = isPlainRecord(value.createTrade) ? value.createTrade : void 0;
21954
- if (!createTrade) {
21955
- issues.push(issue2(`${path24}.createTrade`, "INVALID_PAYMENT_CREATE_TRADE", "createTrade must be an object"));
21956
- } else {
21957
- rejectUnknownKeys(createTrade, ["mcpResourceId", "toolName", "input", "tradeNoPath"], `${path24}.createTrade`, issues);
21958
- if (!isSafeIdentifier(createTrade.mcpResourceId))
21959
- issues.push(issue2(`${path24}.createTrade.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
21960
- if (typeof createTrade.toolName !== "string" || !createTrade.toolName.trim())
21961
- issues.push(issue2(`${path24}.createTrade.toolName`, "INVALID_TOOL_NAME", "toolName is required"));
21962
- if (!isPlainRecord(createTrade.input))
21963
- issues.push(issue2(`${path24}.createTrade.input`, "INVALID_PAYMENT_INPUT", "input must be an object"));
21964
- else
21965
- validateActionDynamicValue(createTrade.input, `${path24}.createTrade.input`, issues);
21966
- if (!isSafeJsonPointer(createTrade.tradeNoPath))
21967
- issues.push(issue2(`${path24}.createTrade.tradeNoPath`, "INVALID_TRADE_NO_PATH", "tradeNoPath must be an absolute JSON Pointer"));
21968
- }
21969
- const onSuccess = isPlainRecord(value.onSuccess) ? value.onSuccess : void 0;
21970
- const event = onSuccess && isPlainRecord(onSuccess.event) ? onSuccess.event : void 0;
21971
- if (!onSuccess || !event) {
21972
- issues.push(issue2(`${path24}.onSuccess`, "INVALID_PAYMENT_SUCCESS_EVENT", "onSuccess.event is required"));
21973
- return;
21974
- }
21975
- rejectUnknownKeys(onSuccess, ["event"], `${path24}.onSuccess`, issues);
21976
- rejectUnknownKeys(event, ["name", "context", "x2-user-message"], `${path24}.onSuccess.event`, issues);
21977
- if (typeof event.name !== "string" || !/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(event.name) || event.name.length > 96)
21978
- issues.push(issue2(`${path24}.onSuccess.event.name`, "INVALID_ACTION_NAME", "event name is invalid"));
21979
- if (event.context !== void 0 && !isPlainRecord(event.context))
21980
- issues.push(issue2(`${path24}.onSuccess.event.context`, "INVALID_ACTION_CONTEXT", "event context must be an object"));
21981
- else if (event.context !== void 0)
21982
- validateActionDynamicValue(event.context, `${path24}.onSuccess.event.context`, issues);
21983
- if (typeof event["x2-user-message"] !== "string" || !event["x2-user-message"].trim())
21984
- issues.push(issue2(`${path24}.onSuccess.event.x2-user-message`, "INVALID_ACTION_CONTEXT", "x2-user-message must be a non-empty string"));
21985
- }
21986
22268
  function validateActionDynamicValue(value, path24, issues) {
21987
22269
  if (Array.isArray(value)) {
21988
22270
  value.forEach((entry, index) => validateActionDynamicValue(entry, `${path24}[${index}]`, issues));
@@ -22027,7 +22309,7 @@ function validateTextField(component, path24, issues) {
22027
22309
  issues.push(issue2(`${path24}.validationRegexp`, "INVALID_VALIDATION_REGEXP", "validationRegexp is too long"));
22028
22310
  else
22029
22311
  try {
22030
- new RegExp(component.validationRegexp);
22312
+ RegExp(component.validationRegexp);
22031
22313
  } catch {
22032
22314
  issues.push(issue2(`${path24}.validationRegexp`, "INVALID_VALIDATION_REGEXP", "validationRegexp is invalid"));
22033
22315
  }
@@ -22078,26 +22360,6 @@ function validateOverflow(component, path24, issues) {
22078
22360
  }
22079
22361
  }
22080
22362
  }
22081
- function validateNumberFormat(value, path24, issues) {
22082
- if (!isPlainRecord(value))
22083
- return void issues.push(issue2(path24, "INVALID_NUMBER_FORMAT", "format must be an object"));
22084
- rejectUnknownKeys(value, [
22085
- "type",
22086
- "style",
22087
- "currency",
22088
- "locale",
22089
- "minimumFractionDigits",
22090
- "maximumFractionDigits",
22091
- "useGrouping",
22092
- "prefix",
22093
- "suffix"
22094
- ], path24, issues);
22095
- const style = value.style ?? "decimal";
22096
- const digit = (entry) => entry === void 0 || Number.isInteger(entry) && Number(entry) >= 0 && Number(entry) <= 20;
22097
- if (value.type !== "number" || !["decimal", "currency", "percent"].includes(String(style)) || style === "currency" && (typeof value.currency !== "string" || !/^[A-Z]{3}$/u.test(value.currency)) || value.locale !== void 0 && typeof value.locale !== "string" || !digit(value.minimumFractionDigits) || !digit(value.maximumFractionDigits) || Number.isInteger(value.minimumFractionDigits) && Number.isInteger(value.maximumFractionDigits) && Number(value.minimumFractionDigits) > Number(value.maximumFractionDigits) || value.useGrouping !== void 0 && typeof value.useGrouping !== "boolean" || value.prefix !== void 0 && (typeof value.prefix !== "string" || value.prefix.length > 32) || value.suffix !== void 0 && (typeof value.suffix !== "string" || value.suffix.length > 32)) {
22098
- issues.push(issue2(path24, "INVALID_NUMBER_FORMAT", "number format options are invalid"));
22099
- }
22100
- }
22101
22363
  function rejectUnknownKeys(value, allowed, path24, issues) {
22102
22364
  const allowedKeys = new Set(allowed);
22103
22365
  Object.keys(value).forEach((key) => {
@@ -22186,21 +22448,49 @@ function hasInteractiveDescendant(id, components, visited) {
22186
22448
  return refs.some((ref) => typeof ref === "string" && hasInteractiveDescendant(ref, components, visited));
22187
22449
  }
22188
22450
 
22451
+ // ../agent-a2ui-card-contract/dist/esm/pipeline-input.js
22452
+ function createA2UICardPipelineModelInputSchema(sources) {
22453
+ const properties = {};
22454
+ const required2 = [];
22455
+ sources.forEach((source, index) => {
22456
+ const name = `input${index}`;
22457
+ properties[name] = {
22458
+ ...scopeLocalReferences(source.inputSchema, `#/properties/${name}`),
22459
+ description: `\u7B2C ${index} \u4E2A\u6570\u636E\u6E90 ${source.toolName} \u7684 MCP \u8C03\u7528\u53C2\u6570\u3002${source.purpose}`
22460
+ };
22461
+ required2.push(name);
22462
+ });
22463
+ return { type: "object", properties, required: required2, additionalProperties: false };
22464
+ }
22465
+ function scopeLocalReferences(schema, root) {
22466
+ const visit = (value) => {
22467
+ if (Array.isArray(value))
22468
+ return value.map(visit);
22469
+ if (value === null || typeof value !== "object")
22470
+ return value;
22471
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
22472
+ key,
22473
+ key === "$ref" && typeof entry === "string" && (entry === "#" || entry.startsWith("#/")) ? `${root}${entry.slice(1)}` : visit(entry)
22474
+ ]));
22475
+ };
22476
+ return visit(schema);
22477
+ }
22478
+
22189
22479
  // ../agent-a2ui-card-contract/dist/esm/validation.js
22190
- var FIELD_TYPES = [
22480
+ var FIELD_TYPES = /* @__PURE__ */ new Set([
22191
22481
  "array",
22192
22482
  "boolean",
22193
22483
  "integer",
22194
22484
  "number",
22195
22485
  "object",
22196
22486
  "string"
22197
- ];
22198
- var FIELD_SOURCES = [
22487
+ ]);
22488
+ var FIELD_SOURCES = /* @__PURE__ */ new Set([
22199
22489
  "business",
22200
22490
  "invocation",
22201
22491
  "runtime-context",
22202
22492
  "local"
22203
- ];
22493
+ ]);
22204
22494
  var RUNTIME_CONTEXT_KEYS2 = /* @__PURE__ */ new Set([
22205
22495
  "agentId",
22206
22496
  "tenantId",
@@ -22235,7 +22525,7 @@ function getA2UICardDraftBundleIssues(value) {
22235
22525
  if (manifest?.schemaVersion === "4") {
22236
22526
  issues.push(...getA2UIV4ProtocolIssues(card, "draft.card"));
22237
22527
  issues.push(...getPersistedV4ProtocolIssues(card, "draft.card"));
22238
- validateV4BindingContracts(card, analysis.occurrences, manifest.fields, "draft.card", issues);
22528
+ validateV4BindingContracts(card, analysis.occurrences, manifest.fields, "draft.card", issues, manifest.dataMode === "pipeline" ? manifest.dataModelSchema : void 0);
22239
22529
  }
22240
22530
  }
22241
22531
  return issues;
@@ -22277,17 +22567,17 @@ function validateV4Fixture(value, fields, path24, issues) {
22277
22567
  issues.push(...validateJsonSchemaValue2(field.valueSchema, resolved.value, `${path24}${field.path}`));
22278
22568
  }
22279
22569
  }
22280
- function validateV4BindingContracts(card, occurrences, fields, path24, issues) {
22570
+ function validateV4BindingContracts(card, occurrences, fields, path24, issues, dataModelSchema) {
22281
22571
  const ordered = fields.slice().sort((left, right) => right.path.length - left.path.length);
22282
22572
  for (const occurrence of occurrences) {
22283
22573
  const field = ordered.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
22284
22574
  const issuePath = `${path24}.surfaces.${occurrence.surfaceId ?? "unknown"}.components.${occurrence.componentId}.${occurrence.propertyPath}`;
22285
- if (!field) {
22575
+ if (!field && !dataModelSchema) {
22286
22576
  issues.push(issue2(issuePath, "UNDECLARED_BINDING_PATH", `binding path ${occurrence.rawPath} is not declared by a manifest field`));
22287
22577
  continue;
22288
22578
  }
22289
- const suffix = occurrence.canonicalPath.slice(field.path.length).replace(/^\/\*\//u, "/");
22290
- const schema = suffix ? getJsonSchemaAtDataPointer(field.valueSchema, suffix) : field.valueSchema;
22579
+ const suffix = occurrence.canonicalPath.slice(field?.path.length ?? 0).replace(/^\/\*\//u, "/");
22580
+ const schema = dataModelSchema ? getJsonSchemaAtDataPointer(dataModelSchema, occurrence.canonicalPath) : field && (suffix ? getJsonSchemaAtDataPointer(field.valueSchema, suffix) : field.valueSchema);
22291
22581
  const component = findV4Component(card, occurrence.surfaceId, occurrence.componentId);
22292
22582
  const allowedTypes = expectedBindingTypes(occurrence, component);
22293
22583
  if (allowedTypes && (!schema || typeof schema.type !== "string" || !allowedTypes.has(schema.type))) {
@@ -22358,6 +22648,9 @@ function getA2UICardResourceConfigIssues(value) {
22358
22648
  ];
22359
22649
  }
22360
22650
  const issues = [];
22651
+ if (value.schemaVersion === "4" && value.dataMode === "pipeline") {
22652
+ return getA2UICardResourceConfigV4PipelineIssues(value);
22653
+ }
22361
22654
  if (value.schemaVersion === "3" || value.schemaVersion === "4") {
22362
22655
  return getA2UICardResourceConfigV3Issues(value);
22363
22656
  }
@@ -22392,6 +22685,57 @@ function getA2UICardResourceConfigIssues(value) {
22392
22685
  validateResolverCoverage(fields, resolver, issues, card);
22393
22686
  return issues;
22394
22687
  }
22688
+ function getA2UICardResourceConfigV4PipelineIssues(value) {
22689
+ const issues = [];
22690
+ exactKeys(value, [
22691
+ "schemaVersion",
22692
+ "dataMode",
22693
+ "argumentMode",
22694
+ "revision",
22695
+ "displayName",
22696
+ "description",
22697
+ "whenToUse",
22698
+ "whenNotToUse",
22699
+ "presentationInputSchema",
22700
+ "fields",
22701
+ "dataSources",
22702
+ "dataTransform",
22703
+ "dataModelSchema",
22704
+ "a2uiTemplate"
22705
+ ], "config", issues);
22706
+ if (value.schemaVersion !== "4" || value.dataMode !== "pipeline") {
22707
+ issues.push(issue2("config.dataMode", "INVALID_DATA_MODE", "pipeline cards require schemaVersion 4 and dataMode pipeline"));
22708
+ }
22709
+ if (value.argumentMode !== void 0 && value.argumentMode !== "model") {
22710
+ issues.push(issue2("config.argumentMode", "INVALID_ARGUMENT_MODE", "argumentMode must be model"));
22711
+ }
22712
+ if (!isSafeIdentifier(value.revision)) {
22713
+ issues.push(issue2("config.revision", "INVALID_CARD_REVISION", "revision must be a stable safe identifier"));
22714
+ }
22715
+ requiredString(value.displayName, "config.displayName", issues);
22716
+ requiredString(value.description, "config.description", issues);
22717
+ requiredString(value.whenToUse, "config.whenToUse", issues);
22718
+ optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
22719
+ validateLooseJsonSchema(value.presentationInputSchema, "config.presentationInputSchema", issues);
22720
+ const fields = validateFields(value.fields, "config.fields", issues);
22721
+ const pipelineSources = validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
22722
+ if (value.argumentMode === "model" && pipelineSources) {
22723
+ validateModelPipelineArguments(value, pipelineSources, "config", issues);
22724
+ }
22725
+ validateDataTransform(value.dataTransform, "config.dataTransform", issues);
22726
+ const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
22727
+ const card = validateTemplate(value.a2uiTemplate, fields, issues);
22728
+ if (card) {
22729
+ issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"), ...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
22730
+ }
22731
+ if (fields && dataModelSchema) {
22732
+ validatePipelineFieldSchemas(fields, value.dataModelSchema, issues);
22733
+ }
22734
+ if (dataModelSchema && isPlainRecord(value.a2uiTemplate) && stableJsonStringify(value.a2uiTemplate.argsSchema) !== stableJsonStringify(value.dataModelSchema)) {
22735
+ issues.push(issue2("config.a2uiTemplate.argsSchema", "DATA_MODEL_SCHEMA_MISMATCH", "a2uiTemplate.argsSchema must equal dataModelSchema"));
22736
+ }
22737
+ return issues;
22738
+ }
22395
22739
  function getA2UICardResourceConfigV3Issues(value) {
22396
22740
  const issues = [];
22397
22741
  if (value.actionBindings !== void 0) {
@@ -22503,6 +22847,98 @@ function validateDataSources(value, path24, issues, options = {}) {
22503
22847
  }
22504
22848
  return value;
22505
22849
  }
22850
+ function validateModelPipelineArguments(value, sources, path24, issues) {
22851
+ sources.forEach((source, index) => {
22852
+ if (isPlainRecord(source.fixedInput) && Object.keys(source.fixedInput).length || Array.isArray(source.inputBindings) && source.inputBindings.length) {
22853
+ issues.push(issue2(`${path24}.dataSources[${index}]`, "MODEL_ARGUMENTS_CONFLICT", "model arguments cannot be combined with fixedInput or inputBindings"));
22854
+ }
22855
+ });
22856
+ const expected = createA2UICardPipelineModelInputSchema(sources);
22857
+ if (isJsonValue(value.presentationInputSchema) && stableJsonStringify(value.presentationInputSchema) !== stableJsonStringify(expected)) {
22858
+ issues.push(issue2(`${path24}.presentationInputSchema`, "MODEL_ARGUMENT_SCHEMA_MISMATCH", "presentationInputSchema must match the configured MCP input schemas"));
22859
+ }
22860
+ }
22861
+ function validatePipelineDataSources(value, path24, issues) {
22862
+ if (!Array.isArray(value) || value.length === 0) {
22863
+ issues.push(issue2(path24, "INVALID_DATA_SOURCES", "pipeline dataSources must be a non-empty array"));
22864
+ return void 0;
22865
+ }
22866
+ const ids = /* @__PURE__ */ new Set();
22867
+ value.forEach((candidate, index) => {
22868
+ const itemPath = `${path24}[${index}]`;
22869
+ if (!isPlainRecord(candidate)) {
22870
+ issues.push(issue2(itemPath, "INVALID_DATA_SOURCE", "data source must be an object"));
22871
+ return;
22872
+ }
22873
+ exactKeys(candidate, [
22874
+ "sourceId",
22875
+ "mcpResourceId",
22876
+ "toolName",
22877
+ "purpose",
22878
+ "fixedInput",
22879
+ "inputBindings",
22880
+ "inputSchema",
22881
+ "outputSchema"
22882
+ ], itemPath, issues);
22883
+ if (!isSafeIdentifier(candidate.sourceId)) {
22884
+ issues.push(issue2(`${itemPath}.sourceId`, "INVALID_SOURCE_ID", "sourceId is invalid"));
22885
+ } else if (ids.has(candidate.sourceId)) {
22886
+ issues.push(issue2(`${itemPath}.sourceId`, "DUPLICATE_SOURCE_ID", `sourceId ${candidate.sourceId} is duplicated`));
22887
+ } else {
22888
+ ids.add(candidate.sourceId);
22889
+ }
22890
+ if (!isSafeIdentifier(candidate.mcpResourceId)) {
22891
+ issues.push(issue2(`${itemPath}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
22892
+ }
22893
+ requiredString(candidate.toolName, `${itemPath}.toolName`, issues);
22894
+ requiredString(candidate.purpose, `${itemPath}.purpose`, issues);
22895
+ if (!isPlainRecord(candidate.fixedInput) || !isJsonValue(candidate.fixedInput)) {
22896
+ issues.push(issue2(`${itemPath}.fixedInput`, "INVALID_FIXED_INPUT", "fixedInput must be a JSON object"));
22897
+ }
22898
+ const inputBindings = validateInputBindings2(candidate.inputBindings, `${itemPath}.inputBindings`, issues);
22899
+ if (isPlainRecord(candidate.fixedInput) && inputBindings) {
22900
+ for (let bindingIndex = 0; bindingIndex < inputBindings.length; bindingIndex += 1) {
22901
+ const binding = inputBindings[bindingIndex];
22902
+ if (hasOverlappingJsonPointer(candidate.fixedInput, binding.inputPath)) {
22903
+ issues.push(issue2(`${itemPath}.inputBindings[${bindingIndex}].inputPath`, "FIXED_INPUT_OVERRIDE", `dynamic input ${binding.inputPath} overlaps a fixed input and cannot override it`));
22904
+ }
22905
+ }
22906
+ }
22907
+ validateLooseJsonSchema(candidate.inputSchema, `${itemPath}.inputSchema`, issues);
22908
+ validateLooseJsonSchema(candidate.outputSchema, `${itemPath}.outputSchema`, issues);
22909
+ });
22910
+ return value;
22911
+ }
22912
+ function validateDataTransform(value, path24, issues) {
22913
+ if (!isPlainRecord(value)) {
22914
+ issues.push(issue2(path24, "INVALID_DATA_TRANSFORM", "dataTransform must be an object"));
22915
+ return;
22916
+ }
22917
+ exactKeys(value, ["language", "profile", "source"], path24, issues);
22918
+ if (value.language !== A2UI_CARD_DATA_TRANSFORM_LANGUAGE) {
22919
+ issues.push(issue2(`${path24}.language`, "INVALID_DATA_TRANSFORM_LANGUAGE", `language must be ${A2UI_CARD_DATA_TRANSFORM_LANGUAGE}`));
22920
+ }
22921
+ if (value.profile !== A2UI_CARD_DATA_TRANSFORM_PROFILE) {
22922
+ issues.push(issue2(`${path24}.profile`, "INVALID_DATA_TRANSFORM_PROFILE", `profile must be ${A2UI_CARD_DATA_TRANSFORM_PROFILE}`));
22923
+ }
22924
+ if (typeof value.source !== "string" || value.source.trim().length === 0) {
22925
+ issues.push(issue2(`${path24}.source`, "INVALID_DATA_TRANSFORM_SOURCE", "source must be a non-empty string"));
22926
+ } else if (new TextEncoder().encode(value.source).byteLength > A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES) {
22927
+ issues.push(issue2(`${path24}.source`, "DATA_TRANSFORM_SOURCE_TOO_LARGE", `source exceeds ${A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES} bytes`));
22928
+ } else if (!/^\s*function\s+transform\s*\(\s*input\s*\)\s*\{/u.test(value.source)) {
22929
+ issues.push(issue2(`${path24}.source`, "INVALID_DATA_TRANSFORM_SOURCE", "source must declare function transform(input) { ... }"));
22930
+ }
22931
+ }
22932
+ function validatePipelineFieldSchemas(fields, dataModelSchema, issues) {
22933
+ fields.forEach((field, index) => {
22934
+ if (field.source !== "business")
22935
+ return;
22936
+ const schema = getJsonSchemaAtDataPointer(dataModelSchema, field.path);
22937
+ if (!schema) {
22938
+ issues.push(issue2(`config.fields[${index}].path`, "DATA_MODEL_FIELD_MISSING", `dataModelSchema does not define ${field.path}`));
22939
+ }
22940
+ });
22941
+ }
22506
22942
  function validateV3OutputBindings(value, path24, issues) {
22507
22943
  if (!Array.isArray(value)) {
22508
22944
  issues.push(issue2(path24, "INVALID_OUTPUT_BINDINGS", "bindings must be an array"));
@@ -22624,12 +23060,67 @@ function validateManifest(value, path24, issues) {
22624
23060
  issues.push(issue2(path24, "INVALID_MANIFEST", `${path24} must be an object`));
22625
23061
  return void 0;
22626
23062
  }
23063
+ if (value.schemaVersion === "4" && value.dataMode === "pipeline") {
23064
+ exactKeys(value, [
23065
+ "schemaVersion",
23066
+ "dataMode",
23067
+ "argumentMode",
23068
+ "draftId",
23069
+ "resourceId",
23070
+ "baseRevision",
23071
+ "displayName",
23072
+ "description",
23073
+ "whenToUse",
23074
+ "whenNotToUse",
23075
+ "presentationInputSchema",
23076
+ "fields",
23077
+ "dataSources",
23078
+ "dataTransform",
23079
+ "dataModelSchema"
23080
+ ], path24, issues);
23081
+ if (!isSafeIdentifier(value.draftId)) {
23082
+ issues.push(issue2(`${path24}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
23083
+ }
23084
+ if (value.argumentMode !== void 0 && value.argumentMode !== "model") {
23085
+ issues.push(issue2(`${path24}.argumentMode`, "INVALID_ARGUMENT_MODE", "argumentMode must be model"));
23086
+ }
23087
+ if (!isSafeIdentifier(value.resourceId)) {
23088
+ issues.push(issue2(`${path24}.resourceId`, "INVALID_RESOURCE_ID", "resourceId is invalid"));
23089
+ }
23090
+ optionalString(value.baseRevision, `${path24}.baseRevision`, issues);
23091
+ requiredString(value.displayName, `${path24}.displayName`, issues);
23092
+ requiredString(value.description, `${path24}.description`, issues);
23093
+ requiredString(value.whenToUse, `${path24}.whenToUse`, issues);
23094
+ optionalString(value.whenNotToUse, `${path24}.whenNotToUse`, issues);
23095
+ validateLooseJsonSchema(value.presentationInputSchema, `${path24}.presentationInputSchema`, issues);
23096
+ const fields2 = validateFields(value.fields, `${path24}.fields`, issues);
23097
+ const pipelineSources = validatePipelineDataSources(value.dataSources, `${path24}.dataSources`, issues);
23098
+ if (value.argumentMode === "model" && pipelineSources) {
23099
+ validateModelPipelineArguments(value, pipelineSources, path24, issues);
23100
+ }
23101
+ validateDataTransform(value.dataTransform, `${path24}.dataTransform`, issues);
23102
+ const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, `${path24}.dataModelSchema`, issues);
23103
+ if (fields2 && dataModelSchema) {
23104
+ fields2.forEach((field, index) => {
23105
+ if (field.source !== "business")
23106
+ return;
23107
+ if (!getJsonSchemaAtDataPointer(value.dataModelSchema, field.path)) {
23108
+ issues.push(issue2(`${path24}.fields[${index}].path`, "DATA_MODEL_FIELD_MISSING", `dataModelSchema does not define ${field.path}`));
23109
+ }
23110
+ });
23111
+ }
23112
+ return fields2 ? value : void 0;
23113
+ }
22627
23114
  if (value.schemaVersion === "3" || value.schemaVersion === "4") {
23115
+ if (value.dataMode !== void 0 && (value.schemaVersion !== "4" || value.dataMode !== "bindings")) {
23116
+ issues.push(issue2(`${path24}.dataMode`, "INVALID_DATA_MODE", "bindings dataMode is only available for schemaVersion 4"));
23117
+ }
22628
23118
  if (value.actionBindings !== void 0) {
22629
23119
  issues.push(issue2(`${path24}.actionBindings`, "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
22630
23120
  }
22631
23121
  exactKeys(value, [
22632
23122
  "schemaVersion",
23123
+ "dataMode",
22633
23124
  "draftId",
22634
23125
  "resourceId",
22635
23126
  "baseRevision",
@@ -22694,6 +23185,23 @@ function validateManifest(value, path24, issues) {
22694
23185
  }
22695
23186
  return schema && fields ? value : void 0;
22696
23187
  }
23188
+ function hasOverlappingJsonPointer(fixedInput, inputPath) {
23189
+ const fixedPaths = [];
23190
+ const visit = (value, path24) => {
23191
+ fixedPaths.push(path24);
23192
+ if (!isPlainRecord(value))
23193
+ return;
23194
+ for (const [key, child] of Object.entries(value)) {
23195
+ const escaped = key.replace(/~/gu, "~0").replace(/\//gu, "~1");
23196
+ visit(child, `${path24}/${escaped}`);
23197
+ }
23198
+ };
23199
+ for (const [key, value] of Object.entries(fixedInput)) {
23200
+ const escaped = key.replace(/~/gu, "~0").replace(/\//gu, "~1");
23201
+ visit(value, `/${escaped}`);
23202
+ }
23203
+ return fixedPaths.some((fixedPath) => fixedPath === inputPath || fixedPath.startsWith(`${inputPath}/`) || inputPath.startsWith(`${fixedPath}/`));
23204
+ }
22697
23205
  function validateFields(value, path24, issues) {
22698
23206
  if (!Array.isArray(value)) {
22699
23207
  issues.push(issue2(path24, "INVALID_FIELDS", `${path24} must be an array`));
@@ -22738,13 +23246,13 @@ function validateFields(value, path24, issues) {
22738
23246
  paths.add(canonicalPath);
22739
23247
  }
22740
23248
  requiredString(candidate.label, `${itemPath}.label`, issues);
22741
- if (!FIELD_TYPES.includes(candidate.type)) {
23249
+ if (!FIELD_TYPES.has(candidate.type)) {
22742
23250
  issues.push(issue2(`${itemPath}.type`, "INVALID_FIELD_TYPE", "field type is invalid"));
22743
23251
  }
22744
23252
  if (typeof candidate.required !== "boolean") {
22745
23253
  issues.push(issue2(`${itemPath}.required`, "INVALID_FIELD_REQUIRED", "required must be a boolean"));
22746
23254
  }
22747
- if (!FIELD_SOURCES.includes(candidate.source)) {
23255
+ if (!FIELD_SOURCES.has(candidate.source)) {
22748
23256
  issues.push(issue2(`${itemPath}.source`, "INVALID_FIELD_SOURCE", "field source is invalid"));
22749
23257
  }
22750
23258
  const schemaIssues = getJsonSchemaIssues(candidate.valueSchema, `${itemPath}.valueSchema`, { requireCompleteStructures: true });
@@ -23089,6 +23597,9 @@ function compileA2UICardResource(input) {
23089
23597
  throw new A2UICardCompileError("CARD_REVISION_INVALID", "CARD revision must be a stable safe identifier");
23090
23598
  }
23091
23599
  const draft = draftResult.data;
23600
+ if (draft.manifest.schemaVersion === "4" && draft.manifest.dataMode === "pipeline") {
23601
+ return compilePipelineResource(draft, input.revision);
23602
+ }
23092
23603
  if (draft.manifest.schemaVersion === "3" || draft.manifest.schemaVersion === "4") {
23093
23604
  return compileModernResource(draft, input.revision, input.bindings, input.tools ?? []);
23094
23605
  }
@@ -23139,6 +23650,32 @@ function compileA2UICardResource(input) {
23139
23650
  }
23140
23651
  return parsed.data;
23141
23652
  }
23653
+ function compilePipelineResource(draft, revision) {
23654
+ const resource = {
23655
+ schemaVersion: "4",
23656
+ dataMode: "pipeline",
23657
+ ...draft.manifest.argumentMode ? { argumentMode: draft.manifest.argumentMode } : {},
23658
+ revision,
23659
+ displayName: draft.manifest.displayName,
23660
+ description: draft.manifest.description,
23661
+ whenToUse: draft.manifest.whenToUse,
23662
+ ...draft.manifest.whenNotToUse ? { whenNotToUse: draft.manifest.whenNotToUse } : {},
23663
+ presentationInputSchema: draft.manifest.presentationInputSchema,
23664
+ fields: draft.manifest.fields,
23665
+ dataSources: draft.manifest.dataSources,
23666
+ dataTransform: draft.manifest.dataTransform,
23667
+ dataModelSchema: draft.manifest.dataModelSchema,
23668
+ a2uiTemplate: {
23669
+ argsSchema: draft.manifest.dataModelSchema,
23670
+ content: stableJsonStringify(draft.card)
23671
+ }
23672
+ };
23673
+ const parsed = parseA2UICardResourceConfig(resource);
23674
+ if (!parsed.success) {
23675
+ throw new A2UICardCompileError("CARD_RESOURCE_INVALID", parsed.issues.map((entry) => `${entry.path}: ${entry.message}`).join("; "));
23676
+ }
23677
+ return parsed.data;
23678
+ }
23142
23679
  function compileLegacyDraftAsV3(draft, revision, bindings, tools, targetSchemaVersion = "3") {
23143
23680
  if (draft.manifest.schemaVersion !== "2") {
23144
23681
  throw new A2UICardCompileError("DRAFT_INVALID", "Expected a schema v2 draft for migration");
@@ -23429,9 +23966,9 @@ function sha256Hex(value) {
23429
23966
  b3 = a;
23430
23967
  a = add(temporary1, temporary2);
23431
23968
  }
23432
- state = state.map((value2, index) => add(value2, [a, b3, c, d, e3, f3, g2, h][index]));
23969
+ state = state.map((v2, index) => add(v2, [a, b3, c, d, e3, f3, g2, h][index]));
23433
23970
  }
23434
- return state.map((value2) => (value2 >>> 0).toString(16).padStart(8, "0")).join("");
23971
+ return state.map((v2) => (v2 >>> 0).toString(16).padStart(8, "0")).join("");
23435
23972
  }
23436
23973
  function createA2UICardDraftStructureChecksum(draft) {
23437
23974
  const cloned = JSON.parse(JSON.stringify(draft));
@@ -23516,9 +24053,6 @@ var SHA256_CONSTANTS = [
23516
24053
  3329325298
23517
24054
  ];
23518
24055
 
23519
- // ../agent-a2ui-card-contract/dist/esm/payment-action.js
23520
- var A2UI_PAYMENT_ACTION_NAME = "payment.trade-pay";
23521
-
23522
24056
  // ../agent-a2ui-card-contract/dist/esm/authoring-model.js
23523
24057
  var INTERNAL_KEYS = /* @__PURE__ */ new Set([
23524
24058
  "__proto__",
@@ -23557,6 +24091,27 @@ function extractA2UICardAuthoringModel(bundle, options = {}) {
23557
24091
  binding
23558
24092
  ]));
23559
24093
  const fields = bundle.manifest.fields.filter((field) => field.source === "business");
24094
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline") {
24095
+ for (const [key, schema] of Object.entries(bundle.manifest.dataModelSchema.properties ?? {})) {
24096
+ const path24 = `/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`;
24097
+ if (!isPlainRecord(schema) || fields.some((field) => field.path === path24))
24098
+ continue;
24099
+ if (!["string", "number", "integer", "boolean", "object", "array"].includes(String(schema.type)))
24100
+ continue;
24101
+ let idIndex = fields.length;
24102
+ while (fields.some((field) => field.fieldId === `pipeline-field-${idIndex}`))
24103
+ idIndex += 1;
24104
+ fields.push({
24105
+ fieldId: `pipeline-field-${idIndex}`,
24106
+ path: path24,
24107
+ label: key,
24108
+ type: schema.type,
24109
+ source: "business",
24110
+ required: Array.isArray(bundle.manifest.dataModelSchema.required) && bundle.manifest.dataModelSchema.required.includes(key),
24111
+ valueSchema: schema
24112
+ });
24113
+ }
24114
+ }
23560
24115
  const registered = options.registeredComponents ? new Set(options.registeredComponents) : void 0;
23561
24116
  const occurrencesByComponent = groupBindingOccurrences(analysis.occurrences);
23562
24117
  const allFieldOccurrenceTargets = [];
@@ -23596,12 +24151,13 @@ function extractA2UICardAuthoringModel(bundle, options = {}) {
23596
24151
  const fieldStates = fields.map((field) => {
23597
24152
  const occurrences = allFieldOccurrenceTargets.filter((target) => target.fieldId === field.fieldId);
23598
24153
  const binding = bindingByField.get(field.fieldId);
24154
+ const pipelineBound = bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline" && getJsonSchemaAtDataPointer(bundle.manifest.dataModelSchema, field.path) !== void 0;
23599
24155
  return {
23600
24156
  field,
23601
24157
  ...binding ? { binding: cloneBinding(binding) } : {},
23602
24158
  occurrences,
23603
24159
  usageCount: new Set(occurrences.map((target) => `${target.occurrenceId}\0${target.propertyPath}`)).size,
23604
- status: occurrences.length === 0 ? "unused" : binding ? "bound" : field.required ? "unbound-required" : "unbound-optional"
24160
+ status: occurrences.length === 0 ? "unused" : binding || pipelineBound ? "bound" : field.required ? "unbound-required" : "unbound-optional"
23605
24161
  };
23606
24162
  });
23607
24163
  const diagnostics = getA2UICardAuthoringDiagnostics(bundle, {
@@ -23668,11 +24224,7 @@ function getA2UICardAuthoringDiagnostics(bundle, partial2) {
23668
24224
  occurrenceId: group.occurrenceId
23669
24225
  });
23670
24226
  }
23671
- } else if (client && typeof client.name === "string" && ![
23672
- "ui.overlay.close",
23673
- "ui.surface.open",
23674
- A2UI_PAYMENT_ACTION_NAME
23675
- ].includes(client.name)) {
24227
+ } else if (client && typeof client.name === "string" && !["ui.overlay.close", "ui.surface.open"].includes(client.name)) {
23676
24228
  diagnostics.push({
23677
24229
  code: "UNREGISTERED_CLIENT_ACTION",
23678
24230
  path: `${group.occurrenceId}.action.client.name`,
@@ -23816,21 +24368,6 @@ function actionTargets(component, occurrenceId) {
23816
24368
  }
23817
24369
  ];
23818
24370
  }
23819
- if (client?.name === A2UI_PAYMENT_ACTION_NAME) {
23820
- const context = isPlainRecord(client.context) ? client.context : void 0;
23821
- const payment = context ? JSON.parse(JSON.stringify(context)) : void 0;
23822
- return [
23823
- {
23824
- kind: "payment",
23825
- targetId: createA2UICardAuthoringTargetId(occurrenceId, "action"),
23826
- occurrenceId,
23827
- propertyPath: "action",
23828
- label: "\u652F\u4ED8",
23829
- ...payment ? { payment } : {},
23830
- configured: Boolean(payment)
23831
- }
23832
- ];
23833
- }
23834
24371
  return [agentOnlyAction(occurrenceId, "\u8BE5\u884C\u4E3A\u53EA\u80FD\u901A\u8FC7 Coding Agent \u4FEE\u6539")];
23835
24372
  }
23836
24373
  function fieldTargets(component, occurrenceId, fields, occurrences, projectedOnly) {
@@ -23853,6 +24390,9 @@ function fieldTargets(component, occurrenceId, fields, occurrences, projectedOnl
23853
24390
  propertyPath: occurrence.propertyPath,
23854
24391
  label: fieldOccurrenceLabel(targetPath, occurrence.propertyPath),
23855
24392
  fieldId: field.fieldId,
24393
+ dataPath: occurrence.rawPath,
24394
+ ...occurrence.listRoot ? { listRoot: occurrence.listRoot } : {},
24395
+ valueType: occurrence.usage === "list" ? "array" : getJsonSchemaAtDataPointer(field.valueSchema, occurrence.canonicalPath.slice(field.path.length) || "/")?.type,
23856
24396
  ...targetPath ? { targetPath } : {}
23857
24397
  }
23858
24398
  ];
@@ -23942,6 +24482,22 @@ function cloneBinding(binding) {
23942
24482
  var CONTENT_VALUE_MAX_LENGTH = 16 * 1024;
23943
24483
  var ETelemetryAttribute;
23944
24484
  (function(ETelemetryAttribute2) {
24485
+ ETelemetryAttribute2["LINKQUE_REMOTE_TRACE_ID"] = "linkque.remote.trace_id";
24486
+ ETelemetryAttribute2["LINKQUE_REMOTE_TRACE_ID_HEADER"] = "linkque.remote.trace_id_header";
24487
+ ETelemetryAttribute2["HTTP_REQUEST_METHOD"] = "http.request.method";
24488
+ ETelemetryAttribute2["SERVER_ADDRESS"] = "server.address";
24489
+ ETelemetryAttribute2["URL_PATH"] = "url.path";
24490
+ ETelemetryAttribute2["LINKQUE_MCP_PHASE"] = "linkque.mcp.phase";
24491
+ ETelemetryAttribute2["LINKQUE_MCP_SERVER_NAME"] = "linkque.mcp.server_name";
24492
+ ETelemetryAttribute2["LINKQUE_IO_ATTEMPT"] = "linkque.io.attempt";
24493
+ ETelemetryAttribute2["LINKQUE_SKILL_RESOURCE_ID"] = "linkque.skill.resource_id";
24494
+ ETelemetryAttribute2["LINKQUE_SKILL_REQUESTED_COUNT"] = "linkque.skill.requested_count";
24495
+ ETelemetryAttribute2["LINKQUE_SKILL_RESOLVED_COUNT"] = "linkque.skill.resolved_count";
24496
+ ETelemetryAttribute2["LINKQUE_SKILL_LOADED_COUNT"] = "linkque.skill.loaded_count";
24497
+ ETelemetryAttribute2["LINKQUE_SKILL_SKIPPED_COUNT"] = "linkque.skill.skipped_count";
24498
+ ETelemetryAttribute2["LINKQUE_CHUNK_INDEX"] = "linkque.chunk.index";
24499
+ ETelemetryAttribute2["LINKQUE_CHUNK_STATUS"] = "linkque.chunk.status";
24500
+ ETelemetryAttribute2["LINKQUE_CHUNK_LINE_COUNT"] = "linkque.chunk.line_count";
23945
24501
  ETelemetryAttribute2["HARNESS_TELEMETRY_SCHEMA_VERSION"] = "harness.telemetry.schema.version";
23946
24502
  ETelemetryAttribute2["LINKQUE_TELEMETRY_SCHEMA_VERSION"] = "linkque.telemetry.schema.version";
23947
24503
  ETelemetryAttribute2["LINKQUE_TELEMETRY_ADAPTER_VERSION"] = "linkque.telemetry.adapter.version";
@@ -23974,6 +24530,8 @@ var ETelemetryAttribute;
23974
24530
  ETelemetryAttribute2["HARNESS_RECORD_ID"] = "harness.record.id";
23975
24531
  ETelemetryAttribute2["HARNESS_EVENT_SEQUENCE"] = "harness.event.sequence";
23976
24532
  ETelemetryAttribute2["ERROR_TYPE"] = "error.type";
24533
+ ETelemetryAttribute2["LINKQUE_APPBASE_RUN_FAILURE_STAGE"] = "linkque.appbase.run.failure_stage";
24534
+ ETelemetryAttribute2["LINKQUE_APPBASE_RUN_ERROR_MESSAGE"] = "linkque.appbase.run.error_message";
23977
24535
  ETelemetryAttribute2["LINKQUE_STREAM_TERMINATION"] = "linkque.stream.termination";
23978
24536
  ETelemetryAttribute2["LINKQUE_STREAM_CANCEL_SOURCE"] = "linkque.stream.cancel_source";
23979
24537
  ETelemetryAttribute2["LINKQUE_TERMINAL_EVIDENCE"] = "linkque.terminal.evidence";
@@ -24136,6 +24694,18 @@ var ETelemetryContentSection;
24136
24694
  })(ETelemetryContentSection || (ETelemetryContentSection = {}));
24137
24695
  var ETelemetryOperationName;
24138
24696
  (function(ETelemetryOperationName2) {
24697
+ ETelemetryOperationName2["APPBASE_RUN"] = "linkque.appbase.run";
24698
+ ETelemetryOperationName2["RUNS_WRITE"] = "linkque.appbase.runs.write";
24699
+ ETelemetryOperationName2["MCP_DISCOVER"] = "linkque.mcp.discover";
24700
+ ETelemetryOperationName2["MCP_SIGN"] = "linkque.mcp.sign";
24701
+ ETelemetryOperationName2["MCP_OPENGW"] = "linkque.mcp.opengw";
24702
+ ETelemetryOperationName2["MCP_VERIFY"] = "linkque.mcp.verify";
24703
+ ETelemetryOperationName2["KNOWLEDGE_SEARCH"] = "linkque.knowledge.search";
24704
+ ETelemetryOperationName2["WEB_SEARCH"] = "linkque.web_search.search";
24705
+ ETelemetryOperationName2["SKILL_LOAD"] = "linkque.skill.load";
24706
+ ETelemetryOperationName2["SKILL_QUERY"] = "linkque.skill.query";
24707
+ ETelemetryOperationName2["SKILL_RESOURCE_LOAD"] = "linkque.skill.resource.load";
24708
+ ETelemetryOperationName2["SKILL_DOWNLOAD"] = "linkque.skill.download";
24139
24709
  ETelemetryOperationName2["OPERATION"] = "linkque.operation";
24140
24710
  ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
24141
24711
  ETelemetryOperationName2["ADVANCE"] = "harness.advance";
@@ -24281,6 +24851,9 @@ var ETelemetryModelPurpose;
24281
24851
  })(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
24282
24852
  var ETelemetryErrorType;
24283
24853
  (function(ETelemetryErrorType2) {
24854
+ ETelemetryErrorType2["IO_ERROR"] = "io_error";
24855
+ ETelemetryErrorType2["IO_CANCELLED"] = "io_cancelled";
24856
+ ETelemetryErrorType2["IO_TIMEOUT"] = "io_timeout";
24284
24857
  ETelemetryErrorType2["PROVIDER_STREAM_ERROR"] = "ProviderStreamError";
24285
24858
  ETelemetryErrorType2["TOOL_EXECUTION_ERROR"] = "ToolExecutionError";
24286
24859
  ETelemetryErrorType2["HOOK_DISPATCH_ERROR"] = "HookDispatchError";
@@ -24291,6 +24864,16 @@ var ETelemetrySpanKind;
24291
24864
  ETelemetrySpanKind2["INTERNAL"] = "internal";
24292
24865
  ETelemetrySpanKind2["CLIENT"] = "client";
24293
24866
  })(ETelemetrySpanKind || (ETelemetrySpanKind = {}));
24867
+ var ETelemetryMcpPhase;
24868
+ (function(ETelemetryMcpPhase2) {
24869
+ ETelemetryMcpPhase2["SSE_CONNECT"] = "sse_connect";
24870
+ ETelemetryMcpPhase2["INITIALIZE"] = "initialize";
24871
+ ETelemetryMcpPhase2["TOOLS_LIST"] = "tools/list";
24872
+ ETelemetryMcpPhase2["TOOLS_CALL"] = "tools/call";
24873
+ ETelemetryMcpPhase2["INITIALIZED"] = "notifications/initialized";
24874
+ ETelemetryMcpPhase2["CANCELLED"] = "notifications/cancelled";
24875
+ ETelemetryMcpPhase2["HTTP"] = "http";
24876
+ })(ETelemetryMcpPhase || (ETelemetryMcpPhase = {}));
24294
24877
  var ETelemetryGenAiOperation;
24295
24878
  (function(ETelemetryGenAiOperation2) {
24296
24879
  ETelemetryGenAiOperation2["CHAT"] = "chat";
@@ -24357,6 +24940,7 @@ var LINKQUE_ENDPOINT_PROD = "https://linkquegw.alipay.com";
24357
24940
  var RUNTIME_CONFIG_DEFAULTS = Object.freeze({
24358
24941
  LINKQUE_BASE_URL: `${LINKQUE_ENDPOINT_PROD}/api/anthropic`,
24359
24942
  LINKQUEGW_KNOWLEDGE_BASE_URL: LINKQUE_ENDPOINT_PROD,
24943
+ LINKQUEGW_SKILL_LOADER_BASE_URL: LINKQUE_ENDPOINT_PROD,
24360
24944
  LINKQUEGW_WEB_SEARCH_BASE_URL: LINKQUE_ENDPOINT_PROD,
24361
24945
  LINKQUEGW_EVENT_BASE_URL: LINKQUE_ENDPOINT_PROD,
24362
24946
  LINKQUEGW_MCP_SIGN_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/mcp/signature`,
@@ -34621,6 +35205,22 @@ var CONVERSATION_CUSTOM_EVENT_NAMES = Object.freeze({
34621
35205
 
34622
35206
  // ../linkque-agent-runtime/dist/esm/impl/telemetry/attributes.js
34623
35207
  var allowedAttributeKeys = /* @__PURE__ */ new Set([
35208
+ ETelemetryAttribute.LINKQUE_REMOTE_TRACE_ID,
35209
+ ETelemetryAttribute.LINKQUE_REMOTE_TRACE_ID_HEADER,
35210
+ ETelemetryAttribute.HTTP_REQUEST_METHOD,
35211
+ ETelemetryAttribute.SERVER_ADDRESS,
35212
+ ETelemetryAttribute.URL_PATH,
35213
+ ETelemetryAttribute.LINKQUE_MCP_PHASE,
35214
+ ETelemetryAttribute.LINKQUE_MCP_SERVER_NAME,
35215
+ ETelemetryAttribute.LINKQUE_IO_ATTEMPT,
35216
+ ETelemetryAttribute.LINKQUE_SKILL_RESOURCE_ID,
35217
+ ETelemetryAttribute.LINKQUE_SKILL_REQUESTED_COUNT,
35218
+ ETelemetryAttribute.LINKQUE_SKILL_LOADED_COUNT,
35219
+ ETelemetryAttribute.LINKQUE_SKILL_RESOLVED_COUNT,
35220
+ ETelemetryAttribute.LINKQUE_SKILL_SKIPPED_COUNT,
35221
+ ETelemetryAttribute.LINKQUE_CHUNK_INDEX,
35222
+ ETelemetryAttribute.LINKQUE_CHUNK_STATUS,
35223
+ ETelemetryAttribute.LINKQUE_CHUNK_LINE_COUNT,
34624
35224
  ETelemetryAttribute.HARNESS_TELEMETRY_SCHEMA_VERSION,
34625
35225
  ETelemetryAttribute.LINKQUE_TELEMETRY_SCHEMA_VERSION,
34626
35226
  ETelemetryAttribute.LINKQUE_TELEMETRY_ADAPTER_VERSION,
@@ -34642,6 +35242,8 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
34642
35242
  ETelemetryAttribute.HARNESS_INVOCATION_ID,
34643
35243
  ETelemetryAttribute.HARNESS_ATTEMPT_ID,
34644
35244
  ETelemetryAttribute.HARNESS_ATTEMPT_VISIBILITY,
35245
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_FAILURE_STAGE,
35246
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_ERROR_MESSAGE,
34645
35247
  ETelemetryAttribute.HARNESS_ADVANCE_OUTCOME,
34646
35248
  ETelemetryAttribute.HARNESS_OPERATION_OUTCOME,
34647
35249
  ETelemetryAttribute.HARNESS_REMOTE_COMPLETION,
@@ -34719,6 +35321,7 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
34719
35321
  ETelemetryAttribute.HTTP_RESPONSE_STATUS_CODE
34720
35322
  ]);
34721
35323
  var priorityAttributeKeys = /* @__PURE__ */ new Set([
35324
+ ETelemetryAttribute.ERROR_TYPE,
34722
35325
  ETelemetryAttribute.HARNESS_RECORD_ID,
34723
35326
  ETelemetryAttribute.HARNESS_EVENT_SEQUENCE,
34724
35327
  ETelemetryAttribute.HARNESS_ADVANCE_ID,
@@ -34728,6 +35331,8 @@ var priorityAttributeKeys = /* @__PURE__ */ new Set([
34728
35331
  ETelemetryAttribute.LINKQUE_OPERATION_NAME,
34729
35332
  ETelemetryAttribute.LINKQUE_OPERATION_DURATION_MS,
34730
35333
  ETelemetryAttribute.HARNESS_OPERATION_OUTCOME,
35334
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_FAILURE_STAGE,
35335
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_ERROR_MESSAGE,
34731
35336
  ETelemetryAttribute.HARNESS_ADVANCE_OUTCOME,
34732
35337
  ETelemetryAttribute.HARNESS_CALL_ID,
34733
35338
  ETelemetryAttribute.HARNESS_INVOCATION_ID,
@@ -34750,6 +35355,7 @@ var APPBASE_RUNTIME_CONFIG_DEFAULTS = Object.freeze({
34750
35355
  AGENT_CONFIG_URL_PRE: `${LINKQUE_ENDPOINT_PRE}/api/agent/config`,
34751
35356
  LINKQUE_BASE_URL_PRE: `${LINKQUE_ENDPOINT_PRE}/api/anthropic`,
34752
35357
  LINKQUEGW_KNOWLEDGE_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
35358
+ LINKQUEGW_SKILL_LOADER_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
34753
35359
  LINKQUEGW_WEB_SEARCH_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
34754
35360
  LINKQUEGW_EVENT_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
34755
35361
  LINKQUEGW_TELEMETRY_LOGS_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/telemetry/v1/logs`,
@@ -35939,7 +36545,7 @@ var resolveDeployCredentials = (env = process.env) => {
35939
36545
  // src/commands/agentdeploy/gwDeployer.ts
35940
36546
  var import_node_fs8 = require("node:fs");
35941
36547
  var import_node_os = require("node:os");
35942
- var import_node_path11 = require("node:path");
36548
+ var import_node_path12 = require("node:path");
35943
36549
  var UPLOAD_PATH = "/api/appbase/deployBundle/upload";
35944
36550
  var BUNDLE_CONFIG_NAME2 = "appwrite.config.json";
35945
36551
  var HDR_PROJECT_ID = "x-linkque-project-id";
@@ -35960,7 +36566,7 @@ async function deployViaGw(config3) {
35960
36566
  log(
35961
36567
  `\u90E8\u7F72\u5230 gw: ${gwBaseUrl}${UPLOAD_PATH} projectId=${projectId} functions=[${inScope.map((f3) => f3.$id).join(",")}]`
35962
36568
  );
35963
- const staging = (0, import_node_fs8.mkdtempSync)((0, import_node_path11.join)((0, import_node_os.tmpdir)(), "linkquejs-gw-deploy-"));
36569
+ const staging = (0, import_node_fs8.mkdtempSync)((0, import_node_path12.join)((0, import_node_os.tmpdir)(), "linkquejs-gw-deploy-"));
35964
36570
  try {
35965
36571
  const configPayload = {
35966
36572
  ...config3.config,
@@ -35971,14 +36577,14 @@ async function deployViaGw(config3) {
35971
36577
  functions: inScope
35972
36578
  };
35973
36579
  (0, import_node_fs8.writeFileSync)(
35974
- (0, import_node_path11.join)(staging, BUNDLE_CONFIG_NAME2),
36580
+ (0, import_node_path12.join)(staging, BUNDLE_CONFIG_NAME2),
35975
36581
  `${JSON.stringify(configPayload, null, 2)}
35976
36582
  `,
35977
36583
  "utf8"
35978
36584
  );
35979
36585
  const archiveEntries = [BUNDLE_CONFIG_NAME2];
35980
36586
  for (const fn of inScope) {
35981
- const subArchive = (0, import_node_path11.join)(bundlePath, `${fn.$id}.tar.gz`);
36587
+ const subArchive = (0, import_node_path12.join)(bundlePath, `${fn.$id}.tar.gz`);
35982
36588
  if (!(0, import_node_fs8.existsSync)(subArchive)) {
35983
36589
  throw new LinkqueCliError(
35984
36590
  "AGENTDEPLOY_BUNDLE_NOT_FOUND",
@@ -35986,7 +36592,7 @@ async function deployViaGw(config3) {
35986
36592
  );
35987
36593
  }
35988
36594
  const destName = `${fn.$id}.tar.gz`;
35989
- (0, import_node_fs8.copyFileSync)(subArchive, (0, import_node_path11.join)(staging, destName));
36595
+ (0, import_node_fs8.copyFileSync)(subArchive, (0, import_node_path12.join)(staging, destName));
35990
36596
  archiveEntries.push(destName);
35991
36597
  }
35992
36598
  const uploadUrl = `${gwBaseUrl.replace(/\/+$/, "")}${UPLOAD_PATH}`;
@@ -36247,7 +36853,6 @@ var AGENT_LOG = ".linkque/logs/agent.log";
36247
36853
  var HEALTH_PATH = "/healthz";
36248
36854
  var RUNS_PATH = "/runs";
36249
36855
  var HOME_DATA_PATH = "/home-data";
36250
- var A2UI_ACTION_PATH = "/a2ui-action";
36251
36856
  var FUNCTION_ACTION_MCP_PATH = "/function-actions/mcp";
36252
36857
  var AGENT_RUNTIME_PROTOCOL = "conversation-runs-v2";
36253
36858
  var API_KEY_ENV = "LINKQUE_AGENT_API_KEY";
@@ -36516,7 +37121,6 @@ var spawnAgentOwner = (cwd, config3, port, apiKey, statePath) => {
36516
37121
  cwd,
36517
37122
  healthPath: HEALTH_PATH,
36518
37123
  homeDataPath: HOME_DATA_PATH,
36519
- a2uiActionPath: A2UI_ACTION_PATH,
36520
37124
  functionActionMcpPath: FUNCTION_ACTION_MCP_PATH,
36521
37125
  logPath: import_path15.default.join(cwd, AGENT_LOG),
36522
37126
  port,
@@ -37080,29 +37684,29 @@ t.fill(8, 0, 144), t.fill(9, 144, 256), t.fill(7, 256, 280), t.fill(8, 280, 288)
37080
37684
  var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
37081
37685
  var e = (t3) => t3({ workerURI: (t4) => {
37082
37686
  const e3 = "text/javascript";
37083
- let r2 = '!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:o,Error:r,Uint8Array:c,Uint16Array:s,Uint32Array:a,Int32Array:i,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:d,postMessage:p,TransformStream:h,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new c,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,M,A,E,R,x,P,D]=C;class F{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),c=e-8;for(;o<=c;o+=8){const t=n^r.getInt32(o,!0),e=r.getInt32(o+4,!0);n=D[255&t]^P[t>>>8&255]^x[t>>>16&255]^R[t>>>24&255]^E[255&e]^A[e>>>8&255]^M[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];this.o=n}get(){return~this.o}}class U extends h{constructor(){let t;const n=new F;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new c(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new c(t.length+n.length);return e.set(t),e.set(n,t.length),e}function W(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const O=64,V=20,K=new c([128]),T=new c(1),_=new i([1732584193,4023233417,2562383102,271733878,3285377520]),j=new c(256),H=new i(256),L=new i(256),Z=new i(256),N=new i(256);let q=!1;function G(t,n){!function(){if(!q){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),j[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);j[0]=99;for(let t=0;t<256;t++){const n=j[t],e=Y(n),o=e<<24|n<<16|n<<8|e^n;H[t]=o,L[t]=o>>>8|o<<24,Z[t]=o>>>16|o<<16,N[t]=o>>>24|o<<8}q=!0}}();const e=new i(60),o=function(t,n){const e=t.length>>2,o=e+6,r=4*(o+1);let c=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<r;t++){let o=n[t-1];t%e==0?(o=Q(o<<8|o>>>24)^c<<24,c=Y(c)):e>6&&t%e==4&&(o=Q(o)),n[t]=n[t-e]^o}return o}(t,e),r=new i(4),c=J(n);let s=0,a=0,f=0,w=0;return{process(t,n){n&&c.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^r[0]),n.setInt32(o+4,n.getInt32(o+4)^r[1]),n.setInt32(o+8,n.getInt32(o+8)^r[2]),n.setInt32(o+12,n.getInt32(o+12)^r[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=r[n>>2]>>>24-8*(3&n)}}(t),n||c.update(t,0,t.length)},digest:()=>c.digest()};function l(){s=s+1|0,s||(a=a+1|0,a||(f=f+1|0,f||(w=w+1|0)));let t=X(s)^e[0],n=X(a)^e[1],c=X(f)^e[2],i=X(w)^e[3],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[4],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[5],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[6],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[7];t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[8],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[9],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[10],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[11],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[12],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[13],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[14],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[15],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[16],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[17],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[18],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[19],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[20],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[21],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[22],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[23],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[24],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[25],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[26],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[27],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[28],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[29],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[30],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[31],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[32],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[33],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[34],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[35],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[36],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[37],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[38],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[39];let h=40;o>10&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[40],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[41],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[42],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[43],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[44],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[45],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[46],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[47],h=48),o>12&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[48],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[49],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[50],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[51],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[52],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[53],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[54],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[55],h=56),r[0]=(j[u>>>24]<<24|j[l>>>16&255]<<16|j[d>>>8&255]<<8|j[255&p])^e[h],r[1]=(j[l>>>24]<<24|j[d>>>16&255]<<16|j[p>>>8&255]<<8|j[255&u])^e[h+1],r[2]=(j[d>>>24]<<24|j[p>>>16&255]<<16|j[u>>>8&255]<<8|j[255&l])^e[h+2],r[3]=(j[p>>>24]<<24|j[u>>>16&255]<<16|j[l>>>8&255]<<8|j[255&d])^e[h+3]}}function J(t){const n=function(){const t=new i(_),n=new i(16),e=new c(O),r=new u(e.buffer),s=new c(8);let a=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),r=n>>>0;for(w(K,0,1);56!=a;)w(T,0,1);s[0]=e>>>24,s[1]=e>>>16,s[2]=e>>>8,s[3]=e,s[4]=r>>>24,s[5]=r>>>16,s[6]=r>>>8,s[7]=r,w(s,0,8);const i=new c(V),l=new u(i.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(_),a=0,f=0,i}};function w(t,n,o){const c=n+o;if(f+=o,a){for(;n<c&&a<O;)e[a++]=t[n++];a==O&&(l(r,0),a=0)}if(n+O<=c){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+O<=c;n+=O)l(e,n)}for(;n<c;)e[a++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let r,c=t[0],s=t[1],a=t[2],i=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[t]|0,s=s<<30|s>>>2,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+n[t+1]|0,c=c<<30|c>>>2,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+n[t+2]|0,f=f<<30|f>>>2,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+n[t+3]|0,i=i<<30|i>>>2,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+n[t+4]|0,a=a<<30|a>>>2;f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[15]|0,s=s<<30|s>>>2,r=n[13]^n[8]^n[2]^n[0],r=r<<1|r>>>31,n[0]=r,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+r|0,c=c<<30|c>>>2,r=n[14]^n[9]^n[3]^n[1],r=r<<1|r>>>31,n[1]=r,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+r|0,f=f<<30|f>>>2,r=n[15]^n[10]^n[4]^n[2],r=r<<1|r>>>31,n[2]=r,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+r|0,i=i<<30|i>>>2,r=n[0]^n[11]^n[5]^n[3],r=r<<1|r>>>31,n[3]=r,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+r|0,a=a<<30|a>>>2;for(let t=20;t<40;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+1859775393+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+1859775393+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+1859775393+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+1859775393+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+1859775393+r|0,a=a<<30|a>>>2;for(let t=40;t<60;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s&a|(s|a)&i)+f+2400959708+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c&s|(c|s)&a)+i+2400959708+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f&c|(f|c)&s)+a+2400959708+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i&f|(i|f)&c)+s+2400959708+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a&i|(a|i)&f)+c+2400959708+r|0,a=a<<30|a>>>2;for(let t=60;t<80;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+3395469782+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+3395469782+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+3395469782+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+3395469782+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+3395469782+r|0,a=a<<30|a>>>2;t[0]=t[0]+c|0,t[1]=t[1]+s|0,t[2]=t[2]+a|0,t[3]=t[3]+i|0,t[4]=t[4]+f|0}}(),e=new c(O),r=new c(O);t.length>O&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<O;n++){const o=n<t.length?t[n]:0;e[n]=54^o,r[n]=92^o}return n.update(e,0,O),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(r,0,O),n.update(t,0,V);const o=n.digest();return n.update(e,0,O),o}}}function Q(t){return j[t>>>24]<<24|j[t>>>16&255]<<16|j[t>>>8&255]<<8|j[255&t]}function X(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function Y(t){return 255&(t<<1^27*(t>>7))}const $=typeof d!=b&&typeof d.getRandomValues==k,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if($)return d.getRandomValues(t);throw new r("Crypto API not supported")}const ot={name:"PBKDF2"},rt=n.assign({hash:{name:"HMAC"}},ot),ct=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),st=["deriveBits"],at=[8,12,16],it=[16,24,32],ft=10,ut=typeof d!=b,wt=ut&&d.subtle;let lt=ut&&typeof wt!=b&&typeof wt.importKey==k&&typeof wt.deriveBits==k,dt=G;class pt extends h{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:s=!0}){const a={};super({start(){yt(a,t,n,e)},async transform(t,n){const{password:e,strength:s,l:i,ready:f}=a;if(e?(await async function(t,n,e,o){const c=await vt(t,n,e,kt(o,0,at[n])),s=kt(o,at[n]);if(c[0]!=s[0]||c[1]!=s[1])throw gt(t),new r(tt)}(a,s,e,kt(t,0,at[s]+2)),t=kt(t,at[s]+2),o?(gt(a),n.error(new r(nt))):i()):await f,a.h)return;const u=new c(t.length-ft-(t.length-ft)%16);n.enqueue(St(a,t,u,0,ft,!0))},async flush(t){const{m:n,S:e,ready:o}=a;if(n){if(await o,a.h)return;const i=kt(e,e.length-ft),f=new c(kt(e,0,e.length-ft));n.process(f,!0);const u=n.digest();let w=e.length<ft?1:0;for(let t=0;t<ft;t++)w|=u[t]^i[t];if(w&&s)return void t.error(new r("Invalid authentication code"));t.enqueue(f)}}}),mt(this,a)}}class ht extends h{constructor({password:t,rawPassword:n,encryptionStrength:e}){const o={};super({start(){yt(o,t,n,e)},async transform(t,n){const{password:e,strength:r,l:s,ready:a}=o;let i=z;if(e?(i=await async function(t,n,e){const o=et(new c(at[n]));return B(o,await vt(t,n,e,o))}(o,r,e),s()):await a,o.h)return;const f=new c(i.length+t.length-t.length%16);f.set(i,0),n.enqueue(St(o,t,f,i.length,0,!1))},async flush(t){const{m:n,S:e,ready:r}=o;if(n){if(await r,o.h)return;const s=new c(e);n.process(s,!1);const a=kt(n.digest(),0,ft);t.enqueue(B(s,a))}}}),mt(this,o)}}function yt(t,e,o,r){n.assign(t,{ready:new w(n=>t.l=n),password:bt(e,o),strength:r-1,S:z,h:!1})}function mt(t,e){const o=t.readable.getReader(),r=new y({async pull(t){try{const{value:n,done:e}=await o.read();e?t.close():t.enqueue(n)}catch(t){throw gt(e),o.cancel(t).catch(()=>{}),t}},cancel:t=>(gt(e),o.cancel(t))});n.defineProperty(t,"readable",{get:()=>r})}function St(t,n,e,o,r,s){const{m:a,S:i}=t;i.length&&(n=B(i,n));const f=n.length-r,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new c(n)).set(e,0)}return t}(e,o+u),u){const t=kt(e,o,o+u);t.set(kt(n,0,u)),a.process(t,s)}return t.S=kt(n,u),e}function gt(t){const{m:n}=t;t.h=!0,n&&n.dispose&&n.dispose()}async function vt(t,e,r,s){t.password=null;const a=it[e],i=await async function(t,e,r){if(lt)try{const o=await wt.importKey("raw",t,rt,!1,st);return new c(await wt.deriveBits(n.assign({salt:e},ct),o,8*r))}catch{lt=!1}return function(t,n,e,r){const s=J(t),a=new c(r),i=new c(n.length+4),f=new u(i.buffer);i.set(n);for(let t=1,e=0;e<r;t++,e+=V){f.setUint32(n.length,t),s.update(i,0,i.length);let c=s.digest();const u=c.slice();for(let t=1;t<1e3;t++){s.update(c,0,V),c=s.digest();for(let t=0;t<V;t++)u[t]^=c[t]}a.set(u.subarray(0,o.min(V,r-e)),e)}return a}(t,e,0,r)}(r,s,2*a+2);return t.m=dt(kt(i,0,a),kt(i,a,2*a)),t.h&&gt(t),kt(i,2*a)}function bt(t,n){return n===v?function(t){if(typeof l==b){t=unescape(encodeURIComponent(t));const n=new c(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function kt(t,n,e){return t.subarray(n,e)}class zt extends h{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=Mt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(tt);t=t.subarray(12)}o?n.error(new r(nt)):n.enqueue(Mt(e,t))}})}}class Ct extends h{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;let o,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new c(12));n[11]=e.passwordVerification,o=new c(t.length+n.length),o.set(At(e,n),0),r=12}else o=new c(t.length),r=0;o.set(At(e,t),r),n.enqueue(o)}})}}function It(t,e,o,r){n.assign(t,{password:e,rawPassword:o,passwordVerification:r}),function(t,e,o){const r=[305419896,591751049,878082192];if(n.assign(t,{v:r,C:new F(r[0]),I:new F(r[2])}),o)for(let n=0;n<o.length;n++)Et(t,o[n]);else for(let n=0;n<e.length;n++)Et(t,e.charCodeAt(n))}(t,e,o)}function Mt(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,e[o]);return e}function At(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,n[o]);return e}function Et(t,n){let[,e]=t.v;t.C.append([n]);const r=~t.C.get();e=Pt(o.imul(Pt(e+xt(r)),134775813)+1),t.I.append([e>>>24]);const c=~t.I.get();t.v=[r,e,c]}function Rt(t){const n=2|t.v[2];return xt(o.imul(n,1^n)>>>8)}function xt(t){return 255&t}function Pt(t){return 4294967295&t}function Dt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){try{const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)}catch(t){throw n.cancel(t).catch(()=>{}),t}},cancel:t=>n.cancel(t)})}function Ft(t){return Boolean(t)&&"object"==typeof t}const Ut=new f;function Bt(t){return Ut.get(t)}const Wt="Invalid uncompressed size",Ot="Codec out of memory",Vt="Invalid CRC32",Kt="deflate-raw",Tt="gzip",_t=[31,139,8];class jt extends h{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:r,encrypted:c,useCompressionStream:s,zipCrypto:a,computeCrc32:i,level:f,deflate64:w,format:l,compressionMethod:d,inputSize:p}=t,h=this;let y,m,S,g=super.readable;const v=l&&Bt(l),b=Gt(s,o,e),k=i&&r&&!w&&!v&&(!c||a)&&Boolean(b);if(c&&!a||!i||k||(y=new U,g=Qt(g,y)),r)if(v)g=Xt(g,qt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:d,uncompressedSize:p}));else if(k)S=new Ht,g=Xt(g,new b(Tt,{level:f,chunkSize:n})),g=Qt(g,S);else try{g=Jt(g,s,{level:f,chunkSize:n},o,e)}catch(t){if(!s&&e)throw en(t);let n;try{n=new o(Tt)}catch{throw en(t)}g=Xt(g,n),g=Qt(g,new Ht)}c&&(a?g=Qt(g,new Ct(t)):(m=new ht(t),g=Qt(g,m))),Nt(h,g,()=>{c&&!a||!i||(h.crc32=k?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Ht extends h{constructor(){let t,n=10,e=new c(0);super({transform(t,r){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const c=e.length+t.length;if(c<=8)return void(e=B(e,t));const s=c-8,a=o.min(s,e.length);r.enqueue(B(e.subarray(0,a),t.subarray(0,s-a))),e=B(e.subarray(a),t.subarray(s-a))},flush(){const n=W(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Lt extends h{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:s,encrypted:a,checkCrc32:i,crc32:f,compressed:l,useCompressionStream:d,deflate64:p,format:h,compressionMethod:m,rawBitFlag:S,outputSize:g}=t;let b,k,z,C=super.readable;if(a&&(s?C=Qt(C,new zt(t)):(k=new pt(t),C=Qt(C,k))),l){const t=new Set,s=h&&Bt(h);let a;if(s)C=Xt(C,qt(s.DecompressionStream,h,{chunkSize:n,compressionMethod:m,rawBitFlag:S,uncompressedSize:g}),t);else{const r=Gt(d,o,e);if(i&&!p&&f!==v&&g!==v&&r)try{a=new r(Tt,{chunkSize:n})}catch{a=v}if(!a)try{C=Jt(C,d,{chunkSize:n,deflate64:p},o,e,t)}catch(t){if(p||g===v||!d&&e)throw en(t);try{a=new o(Tt)}catch{throw en(t)}}}a?(z=!0,C=function(t,n,e,o,s){const a=n.writable.getWriter(),i=n.readable.getReader(),f=o===v?new F:v;let u,l,d=0,p=!1,h=!1;const m=new y({start(t){l=t},pull(){b()},cancel:t=>(h=!0,b(),i.cancel(t))});return async function(){const n=t.getReader();try{const t=new c(10);for(t.set(_t),await a.write(t);;){await g(),await a.ready;const{value:t,done:e}=await tn(n,s);if(e)break;await a.write(t)}f&&await a.write(new c(0));const r=new c(8),i=W(r);i.setUint32(0,f?f.get():o,!0),i.setUint32(4,e,!0),p=!0,await a.write(r),await a.close()}catch(t){await Yt(a,t),await $t(n,t)}}(),async function(){try{for(;;){const{value:t,done:n}=await S();if(n)break;if(d+=t.length,d>e)throw new r(Wt);f&&f.append(t),l.enqueue(t)}h||(h=!0,l.close())}catch(t){!function(t){h||(h=!0,l.error(t),b())}(t),await $t(i,t)}}(),m;function S(){return i.read().catch(t=>{if(p){if(!f)throw rn(t,Vt);if(d!=e)throw rn(t,Wt);return{done:!0}}throw nn(t,s)})}function g(){if(!h&&l.desiredSize<=0)return new w(t=>u=t)}function b(){if(u){const t=u;u=v,t()}}}(C,a,g,f,t)):C=function(t,n){const e=t.getReader();return new y({async pull(t){try{const{value:n,done:o}=await e.read();o?t.close():t.enqueue(n)}catch(t){throw await $t(e,t),nn(t,n)}},cancel:t=>e.cancel(t)})}(C,t)}i&&!z&&(b=new U,C=Qt(C,b)),Nt(this,C,()=>{if(b){const t=new u(b.value.buffer).getUint32(0,!1);if(f!=t)throw new r(Vt)}})}}const Zt=new f;function Nt(t,e,o){e=Qt(e,new h({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function qt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Gt(t,n,e){return t&&n?n:e&&e.requiresModule?e:void 0}function Jt(t,n,e,o,r,c){const s=n&&o?o:r||o,a=e.deflate64?"deflate64-raw":Kt;let i;try{i=new s(a,e)}catch(t){if(!n||!r||s==r)throw t;i=new r(a,e)}return Xt(t,i,c)}function Qt(t,n){return Dt(t).pipeThrough(n)}function Xt(t,n,e){const o=n.writable.getWriter(),r=t.getReader();return async function(){try{for(;;){await o.ready;const t=await tn(r,e);if(t.done){await o.close();break}await o.write(t.value)}}catch(t){await Yt(o,t),await $t(r,t)}}(),n.readable}async function Yt(t,n){try{await t.abort(n)}catch{}}async function $t(t,n){try{await t.cancel(n)}catch{}}function tn(t,n){const e=t.read();return n?e.catch(t=>{throw n.add(t),t}):e}function nn(t,n){return n.has(t)?t:rn(t,on(t)?Ot:"Invalid compressed data")}function en(t){return on(t)?rn(t,Ot):t}function on(t){return Ft(t)&&"Z_MEM_ERROR"==t.code}function rn(t,n){const e=new r(n);return e.cause=t,e}const cn="data",sn="deflate";class an extends h{constructor(t,e){super({});const o=this,{codecType:c}=t;let s;c.startsWith(sn)?s=jt:c.startsWith("inflate")&&(s=Lt),o.outputSize=0;let a=0;const i=new s(t,e),f=super.readable,u=new h({transform(t,n){t&&t.length&&(a+=t.length,n.enqueue(t))},flush(){n.assign(o,{inputSize:a})}}),w=new h({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new r(Wt)},flush(){const{crc32:t}=i;n.assign(o,{crc32:t,inputSize:a})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(i).pipeThrough(w)})}}class fn extends h{constructor(t){const o=[];let r=0,s=0;function a(){const n=new c(t);let e=0;for(;e<t;){const r=o[0],c=t-e;r.length<=c?(n.set(r,e),e+=r.length,o.shift()):(n.set(r.subarray(0,c),e),o[0]=r.subarray(c),e+=c)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),r+=n.length;r>t;)s+=t,e.enqueue(a())},flush(t){r&&(s+=r,t.enqueue(function(t,n){const e=new c(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,r)))}}),n.defineProperty(this,"outputSize",{get:()=>s})}}let un=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(un=navigator.hardwareConcurrency)}catch{}const wn=new f,ln=new f,dn=function(){try{return structuredClone(new r)instanceof r}catch{return!1}}();let pn=0;async function hn(t){let n,c,s;try{const{options:a,config:i}=t;if(a.format)try{await async function(t,n){!Ut.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=k&&typeof o!=k)throw new r("Invalid codec module");Ut.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(a.format,a.codecURI)}catch(t){if(Ft(t))try{t.codecImportFailed=!0}catch{}throw t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,a.compressed&&!a.format)if(a.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Zt.get(t);e||(e=new f,Zt.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(a.codecType.startsWith(sn)?i.CompressionStream:i.DecompressionStream,Kt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{a.useCompressionStream=!0}if(a.encrypted&&!a.zipCrypto)try{await self.initModule(t.config)}catch{}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Dt(t.readable):new y({async pull(t){const n=new w(t=>wn.set(pn,t));yn({type:"pull",messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER;const{value:o,done:r}=await n;t.enqueue(o),r&&t.close()}},u);s=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const o=new w(t=>n=t);ln.set(pn,n),yn({type:cn,value:t,messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new an(a,i),c=new fn(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?o.max(r,64):65536;var n,r}(i)),await l.pipeThrough(n).pipeThrough(c).pipeTo(s,{preventClose:!0,preventAbort:!0}),await s.getWriter().close();const{crc32:d,inputSize:p,outputSize:h}=n;yn({type:"close",result:{crc32:d,inputSize:p,outputSize:h}})}catch(t){const n=c?c.outputSize:0;if(Ft(t))try{t.outputSize=n}catch{}if(s&&!s.locked)try{await s.getWriter().close()}catch{}mn(t,n)}}function yn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new c(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function mn(t,n){const{message:e,stack:o,code:c,name:s,outputSize:a,cause:i,codecImportFailed:f}=function(t=new r("Unknown error")){return Ft(t)?t:new r(String(t))}(t),u={message:e,stack:o,code:c,name:s,outputSize:a===v?n:a};if(Ft(i)&&(u.cause={name:i.name,message:i.message}),f&&(u.codecImportFailed=!0),dn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:r}=t;try{if("start"==n&&hn(t),n==cn){const t=wn.get(e);wn.delete(e),t({value:o||new c,done:r})}if("ack"==n){const t=ln.get(e);ln.delete(e),t()}}catch(t){mn(t)}}),p({type:"ready"});const Sn="deflate",gn="deflate-raw",vn="deflate64-raw",bn="gzip",kn=[Sn,gn,bn],zn=[Sn,gn,bn,vn];let Cn,In,Mn,An,En;function Rn(t,n){return-4===n&&(t.code="Z_MEM_ERROR"),t}function xn(t,n,e={}){if(!(t?kn:zn).includes(n))throw new TypeError("Unsupported format: "+n);if(!Cn){const t=new r("WASM module not loaded");throw t.cause=En,t}const s="number"==typeof e.level?e.level:-1,a="number"==typeof e.outBuffer?e.outBuffer:65536,i="number"==typeof e.inBufferSize?e.inBufferSize:65536,f={M:0,in:0,inBufferSize:0,A:0,R:!1};let u,l,d,p,h=!0,S=!1;return function(){try{let e;if(f.M=In(a),f.in=In(i),f.inBufferSize=i,!f.M||!f.in)throw Rn(new r("allocation failed"),-4);if(t?(f.P=Cn.deflate_process,f.D=Cn.deflate_last_consumed,f.F=Cn.deflate_end,f.A=Cn.deflate_new(),e=n===bn?Cn.deflate_init_gzip(f.A,s):n===gn?Cn.deflate_init_raw(f.A,s):Cn.deflate_init(f.A,s)):n===vn?(f.P=Cn.inflate9_process,f.D=Cn.inflate9_last_consumed,f.F=Cn.inflate9_end,f.A=Cn.inflate9_new(),e=Cn.inflate9_init_raw(f.A)):(f.P=Cn.inflate_process,f.D=Cn.inflate_last_consumed,f.F=Cn.inflate_end,f.A=Cn.inflate_new(),e=n===gn?Cn.inflate_init_raw(f.A):n===bn?Cn.inflate_init_gzip(f.A):Cn.inflate_init(f.A)),0!==e)throw Rn(new r("init failed:"+e),e)}catch(t){throw b(f),t}}(),{readable:new y({start(t){u=t},pull(){h=!1,v()},cancel(t){S=!0,p=t,b(f),l.error(t),v()}},{highWaterMark:0}),writable:new m({start(t){l=t},async write(t){if(h&&await new w(t=>d=t),S)throw p;try{!function(t){const n=new c(An.buffer),e=f.P,s=f.D,i=f.M;let u=0;for(;u<t.length;){if(f.R)throw new r("trailing data after the end of the stream");const c=o.min(t.length-u,32768);if((!f.in||f.inBufferSize<c)&&(f.in&&Mn&&(Mn(f.in),f.in=0),f.in=In(c),f.inBufferSize=c,!f.in))throw Rn(new r("allocation failed"),-4);n.set(t.subarray(u,u+c),f.in);const w=e(f.A,f.in,c,i,a,0),l=w>>24&255,d=128&l?l-256:l;if(d<0)throw Rn(new r("process error:"+d),d);const p=16777215&w;p&&g(n.slice(i,i+p));const h=s(f.A);if(1===l)f.R=!0;else if(0===h&&0===p)break;u+=h}}(t)}catch(t){throw b(f),u.error(t),t}},close(){if(S)return;try{!function(){const t=new c(An.buffer),n=f.P,e=f.M;for(;;){const o=n(f.A,0,0,e,a,4),c=o>>24&255,s=128&c?c-256:c;if(s<0)throw Rn(new r("process error:"+s),s);const i=16777215&o;if(i&&g(t.slice(e,e+i)),1===c||0===i)break}}()}catch(t){throw b(f),u.error(t),t}const t=b(f);if(0!==t){const n=Rn(new r("end error:"+t),t);throw u.error(n),n}u.close()},abort(t){b(f),u.error(t)}},{highWaterMark:1})};function g(t){h=!0,u.enqueue(t)}function v(){if(d){const t=d;d=null,t()}}function b(t){let n=0;return t.A&&t.F&&(n=t.F(t.A)),t.A=0,t.in&&Mn&&Mn(t.in),t.in=0,t.M&&Mn&&Mn(t.M),t.M=0,n}}class Pn{constructor(t=Sn,n){return xn(!0,t,n)}}class Dn{constructor(t=Sn,n){return xn(!1,t,n)}}Pn.requiresModule=!0,Dn.requiresModule=!0,Pn.supportedFormats=kn,Dn.supportedFormats=zn;const Fn=65536;let Un,Bn;function Wn(t){return new c(t.memory.buffer)}let On=!1;!function(t={}){const{init:n,U:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(dt=e||G),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),r&&(t.DecompressionStreamFallback=r)}}({CompressionStreamFallback:Pn,DecompressionStreamFallback:Dn,U:function(t,n){const e=Un;let o=e?function(t,n,e){Bn||(Bn=t.malloc(Fn));const o=Bn?t.aes_hmac_new():0;if(o){const r=Wn(t);if(r.set(n,Bn),r.set(e,Bn+n.length),t.aes_hmac_init(o,Bn,n.length,Bn+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return G(t,n);const r=Bn;return{process(t,n){for(let c=0;c<t.length;c+=Fn){const s=t.subarray(c,c+Fn),a=Wn(e);a.set(s,r),e.aes_hmac_process(o,r,s.length,n?1:0),s.set(a.subarray(r,r+s.length))}},digest:()=>(e.aes_hmac_end(o,r),o=0,Wn(e).slice(r,r+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!On)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const r=await fetch(o);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),o=e.length,r=new c(o);for(let t=0;t<o;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}const s=await WebAssembly.instantiate(e);var a;(function(t){if(Cn=t,({malloc:In,free:Mn,memory:An}=Cn),"function"!=typeof In||"function"!=typeof Mn||!An)throw Cn=In=Mn=An=null,new r("Invalid WASM module")})(s.instance.exports),typeof(a=s.instance.exports).aes_hmac_new==k&&(Un=a,Bn=0)}(t,n),On=!0}catch(t){throw function(t){En=t}(t),t}}(t.wasmURI,t)})});\n';
37084
- if ("string" == typeof r2 && (r2 = new TextEncoder().encode(r2)), t4) {
37085
- const t5 = new Blob([r2], { type: e3 });
37687
+ let s4 = '!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:o,Error:s,Uint8Array:r,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,k="undefined",z="function",b=new r,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,M,x,P,D,F,E]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const s=new u(t.buffer,t.byteOffset,e),r=e-8;for(;o<=r;o+=8){const t=n^s.getInt32(o,!0),e=s.getInt32(o+4,!0);n=E[255&t]^F[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^x[255&e]^M[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new r(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new r(t.length+n.length);return e.set(t),e.set(n,t.length),e}function V(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const W=64,j=20,K=new r([128]),O=new r(1),T=new a([1732584193,4023233417,2562383102,271733878,3285377520]),H=new r(256),L=new a(256),N=new a(256),q=new a(256),G=new a(256);let J=!1;function Q(t,n){!function(){if(!J){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),H[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);H[0]=99;for(let t=0;t<256;t++){const n=H[t],e=$(n),o=e<<24|n<<16|n<<8|e^n;L[t]=o,N[t]=o>>>8|o<<24,q[t]=o>>>16|o<<16,G[t]=o>>>24|o<<8}J=!0}}();const e=new a(60),o=function(t,n){const e=t.length>>2,o=e+6,s=4*(o+1);let r=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<s;t++){let o=n[t-1];t%e==0?(o=Y(o<<8|o>>>24)^r<<24,r=$(r)):e>6&&t%e==4&&(o=Y(o)),n[t]=n[t-e]^o}return o}(t,e),s=new a(4),r=X(n);let c=0,i=0,f=0,w=0;return{process(t,n){n&&r.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^s[0]),n.setInt32(o+4,n.getInt32(o+4)^s[1]),n.setInt32(o+8,n.getInt32(o+8)^s[2]),n.setInt32(o+12,n.getInt32(o+12)^s[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=s[n>>2]>>>24-8*(3&n)}}(t),n||r.update(t,0,t.length)},digest:()=>r.digest()};function l(){c=c+1|0,c||(i=i+1|0,i||(f=f+1|0,f||(w=w+1|0)));let t=Z(c)^e[0],n=Z(i)^e[1],r=Z(f)^e[2],a=Z(w)^e[3],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[4],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[5],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[6],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[7];t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[8],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[9],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[10],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[11],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[12],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[13],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[14],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[15],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[16],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[17],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[18],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[19],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[20],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[21],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[22],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[23],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[24],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[25],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[26],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[27],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[28],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[29],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[30],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[31],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[32],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[33],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[34],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[35],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[36],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[37],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[38],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[39];let d=40;o>10&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[40],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[41],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[42],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[43],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[44],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[45],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[46],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[47],d=48),o>12&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[48],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[49],r=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[50],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[51],u=L[t>>>24]^N[n>>>16&255]^q[r>>>8&255]^G[255&a]^e[52],l=L[n>>>24]^N[r>>>16&255]^q[a>>>8&255]^G[255&t]^e[53],h=L[r>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[54],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&r]^e[55],d=56),s[0]=(H[u>>>24]<<24|H[l>>>16&255]<<16|H[h>>>8&255]<<8|H[255&p])^e[d],s[1]=(H[l>>>24]<<24|H[h>>>16&255]<<16|H[p>>>8&255]<<8|H[255&u])^e[d+1],s[2]=(H[h>>>24]<<24|H[p>>>16&255]<<16|H[u>>>8&255]<<8|H[255&l])^e[d+2],s[3]=(H[p>>>24]<<24|H[u>>>16&255]<<16|H[l>>>8&255]<<8|H[255&h])^e[d+3]}}function X(t){const n=function(){const t=new a(T),n=new a(16),e=new r(W),s=new u(e.buffer),c=new r(8);let i=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),s=n>>>0;for(w(K,0,1);56!=i;)w(O,0,1);c[0]=e>>>24,c[1]=e>>>16,c[2]=e>>>8,c[3]=e,c[4]=s>>>24,c[5]=s>>>16,c[6]=s>>>8,c[7]=s,w(c,0,8);const a=new r(j),l=new u(a.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(T),i=0,f=0,a}};function w(t,n,o){const r=n+o;if(f+=o,i){for(;n<r&&i<W;)e[i++]=t[n++];i==W&&(l(s,0),i=0)}if(n+W<=r){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+W<=r;n+=W)l(e,n)}for(;n<r;)e[i++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let s,r=t[0],c=t[1],i=t[2],a=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(r<<5|r>>>27)+((i^a)&c^a)+f+1518500249+n[t]|0,c=c<<30|c>>>2,a=(f<<5|f>>>27)+((c^i)&r^i)+a+1518500249+n[t+1]|0,r=r<<30|r>>>2,i=(a<<5|a>>>27)+((r^c)&f^c)+i+1518500249+n[t+2]|0,f=f<<30|f>>>2,c=(i<<5|i>>>27)+((f^r)&a^r)+c+1518500249+n[t+3]|0,a=a<<30|a>>>2,r=(c<<5|c>>>27)+((a^f)&i^f)+r+1518500249+n[t+4]|0,i=i<<30|i>>>2;f=(r<<5|r>>>27)+((i^a)&c^a)+f+1518500249+n[15]|0,c=c<<30|c>>>2,s=n[13]^n[8]^n[2]^n[0],s=s<<1|s>>>31,n[0]=s,a=(f<<5|f>>>27)+((c^i)&r^i)+a+1518500249+s|0,r=r<<30|r>>>2,s=n[14]^n[9]^n[3]^n[1],s=s<<1|s>>>31,n[1]=s,i=(a<<5|a>>>27)+((r^c)&f^c)+i+1518500249+s|0,f=f<<30|f>>>2,s=n[15]^n[10]^n[4]^n[2],s=s<<1|s>>>31,n[2]=s,c=(i<<5|i>>>27)+((f^r)&a^r)+c+1518500249+s|0,a=a<<30|a>>>2,s=n[0]^n[11]^n[5]^n[3],s=s<<1|s>>>31,n[3]=s,r=(c<<5|c>>>27)+((a^f)&i^f)+r+1518500249+s|0,i=i<<30|i>>>2;for(let t=20;t<40;t+=5)s=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],s=s<<1|s>>>31,n[15&t]=s,f=(r<<5|r>>>27)+(c^i^a)+f+1859775393+s|0,c=c<<30|c>>>2,s=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],s=s<<1|s>>>31,n[t+1&15]=s,a=(f<<5|f>>>27)+(r^c^i)+a+1859775393+s|0,r=r<<30|r>>>2,s=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],s=s<<1|s>>>31,n[t+2&15]=s,i=(a<<5|a>>>27)+(f^r^c)+i+1859775393+s|0,f=f<<30|f>>>2,s=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],s=s<<1|s>>>31,n[t+3&15]=s,c=(i<<5|i>>>27)+(a^f^r)+c+1859775393+s|0,a=a<<30|a>>>2,s=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],s=s<<1|s>>>31,n[t+4&15]=s,r=(c<<5|c>>>27)+(i^a^f)+r+1859775393+s|0,i=i<<30|i>>>2;for(let t=40;t<60;t+=5)s=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],s=s<<1|s>>>31,n[15&t]=s,f=(r<<5|r>>>27)+(c&i|(c|i)&a)+f+2400959708+s|0,c=c<<30|c>>>2,s=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],s=s<<1|s>>>31,n[t+1&15]=s,a=(f<<5|f>>>27)+(r&c|(r|c)&i)+a+2400959708+s|0,r=r<<30|r>>>2,s=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],s=s<<1|s>>>31,n[t+2&15]=s,i=(a<<5|a>>>27)+(f&r|(f|r)&c)+i+2400959708+s|0,f=f<<30|f>>>2,s=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],s=s<<1|s>>>31,n[t+3&15]=s,c=(i<<5|i>>>27)+(a&f|(a|f)&r)+c+2400959708+s|0,a=a<<30|a>>>2,s=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],s=s<<1|s>>>31,n[t+4&15]=s,r=(c<<5|c>>>27)+(i&a|(i|a)&f)+r+2400959708+s|0,i=i<<30|i>>>2;for(let t=60;t<80;t+=5)s=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],s=s<<1|s>>>31,n[15&t]=s,f=(r<<5|r>>>27)+(c^i^a)+f+3395469782+s|0,c=c<<30|c>>>2,s=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],s=s<<1|s>>>31,n[t+1&15]=s,a=(f<<5|f>>>27)+(r^c^i)+a+3395469782+s|0,r=r<<30|r>>>2,s=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],s=s<<1|s>>>31,n[t+2&15]=s,i=(a<<5|a>>>27)+(f^r^c)+i+3395469782+s|0,f=f<<30|f>>>2,s=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],s=s<<1|s>>>31,n[t+3&15]=s,c=(i<<5|i>>>27)+(a^f^r)+c+3395469782+s|0,a=a<<30|a>>>2,s=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],s=s<<1|s>>>31,n[t+4&15]=s,r=(c<<5|c>>>27)+(i^a^f)+r+3395469782+s|0,i=i<<30|i>>>2;t[0]=t[0]+r|0,t[1]=t[1]+c|0,t[2]=t[2]+i|0,t[3]=t[3]+a|0,t[4]=t[4]+f|0}}(),e=new r(W),s=new r(W);t.length>W&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<W;n++){const o=n<t.length?t[n]:0;e[n]=54^o,s[n]=92^o}return n.update(e,0,W),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(s,0,W),n.update(t,0,j);const o=n.digest();return n.update(e,0,W),o}}}function Y(t){return H[t>>>24]<<24|H[t>>>16&255]<<16|H[t>>>8&255]<<8|H[255&t]}function Z(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function $(t){return 255&(t<<1^27*(t>>7))}const _=typeof h!=k&&typeof h.getRandomValues==z,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if(_)return h.getRandomValues(t);throw new s("Crypto API not supported")}const ot={name:"PBKDF2"},st=n.assign({hash:{name:"HMAC"}},ot),rt=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),ct=["deriveBits"],it=[8,12,16],at=[16,24,32],ft=10,ut=typeof h!=k,wt=ut&&h.subtle;let lt=ut&&typeof wt!=k&&typeof wt.importKey==z&&typeof wt.deriveBits==z,ht=Q;class pt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:c=!0}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,l:a,ready:f}=e;c?(await async function(t,n,e,o){const r=await gt(t,n,e,kt(o,0,it[n])),c=kt(o,it[n]);if(r[0]!=c[0]||r[1]!=c[1])throw St(t),new s(tt)}(e,i,c,kt(t,0,it[i]+2)),t=kt(t,it[i]+2),o?(St(e),n.error(new s(nt))):a()):await f;const u=new r(t.length-ft-(t.length-ft)%16);n.enqueue(mt(e,t,u,0,ft,!0))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const i=kt(e,e.length-ft),a=new r(kt(e,0,e.length-ft));n.process(a,!0);const f=n.digest();let u=e.length<ft?1:0;for(let t=0;t<ft;t++)u|=f[t]^i[t];if(u&&c)throw new s("Invalid authentication code");t.enqueue(a)}},cancel(){St(this)}})}}class dt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:o,strength:s,l:c,ready:i}=e;let a=b;o?(a=await async function(t,n,e){const o=et(new r(it[n]));return B(o,await gt(t,n,e,o))}(e,s,o),c()):await i;const f=new r(a.length+t.length-t.length%16);f.set(a,0),n.enqueue(mt(e,t,f,a.length,0,!1))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const s=new r(e);n.process(s,!1);const c=kt(n.digest(),0,ft);t.enqueue(B(s,c))}},cancel(){St(this)}})}}function yt(t,e,o,s){n.assign(t,{ready:new w(n=>t.l=n),password:vt(e,o),strength:s-1,m:b})}function mt(t,n,e,o,s,c){const{h:i,m:a}=t;a.length&&(n=B(a,n));const f=n.length-s,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new r(n)).set(e,0)}return t}(e,o+u),u){const t=kt(e,o,o+u);t.set(kt(n,0,u)),i.process(t,c)}return t.m=kt(n,u),e}function St({h:t}){t&&t.dispose&&t.dispose()}async function gt(t,e,s,c){t.password=null;const i=at[e],a=await async function(t,e,s){if(lt)try{const o=await wt.importKey("raw",t,st,!1,ct);return new r(await wt.deriveBits(n.assign({salt:e},rt),o,8*s))}catch{lt=!1}return function(t,n,e,s){const c=X(t),i=new r(s),a=new r(n.length+4),f=new u(a.buffer);a.set(n);for(let t=1,e=0;e<s;t++,e+=j){f.setUint32(n.length,t),c.update(a,0,a.length);let r=c.digest();const u=r.slice();for(let t=1;t<1e3;t++){c.update(r,0,j),r=c.digest();for(let t=0;t<j;t++)u[t]^=r[t]}i.set(u.subarray(0,o.min(j,s-e)),e)}return i}(t,e,0,s)}(s,c,2*i+2);return t.h=ht(kt(a,0,i),kt(a,i,2*i)),kt(a,2*i)}function vt(t,n){return n===v?function(t){if(typeof l==k){t=unescape(encodeURIComponent(t));const n=new r(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function kt(t,n,e){return t.subarray(n,e)}class zt extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=It(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new s(tt);t=t.subarray(12)}o?n.error(new s(nt)):n.enqueue(It(e,t))}})}}class bt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;let o,s;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new r(12));n[11]=e.passwordVerification,o=new r(t.length+n.length),o.set(At(e,n),0),s=12}else o=new r(t.length),s=0;o.set(At(e,t),s),n.enqueue(o)}})}}function Ct(t,e,o,s){n.assign(t,{password:e,rawPassword:o,passwordVerification:s}),function(t,e,o){const s=[305419896,591751049,878082192];if(n.assign(t,{keys:s,S:new R(s[0]),v:new R(s[2])}),o)for(let n=0;n<o.length;n++)Mt(t,o[n]);else for(let n=0;n<e.length;n++)Mt(t,e.charCodeAt(n))}(t,e,o)}function It(t,n){const e=new r(n.length);for(let o=0;o<n.length;o++)e[o]=xt(t)^n[o],Mt(t,e[o]);return e}function At(t,n){const e=new r(n.length);for(let o=0;o<n.length;o++)e[o]=xt(t)^n[o],Mt(t,n[o]);return e}function Mt(t,n){let[,e]=t.keys;t.S.append([n]);const s=~t.S.get();e=Dt(o.imul(Dt(e+Pt(s)),134775813)+1),t.v.append([e>>>24]);const r=~t.v.get();t.keys=[s,e,r]}function xt(t){const n=2|t.keys[2];return Pt(o.imul(n,1^n)>>>8)}function Pt(t){return 255&t}function Dt(t){return 4294967295&t}function Ft(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Et=new f;function Rt(t){return Et.get(t)}const Ut="Invalid uncompressed size",Bt="Invalid CRC32",Vt="deflate-raw",Wt="gzip",jt=[31,139,8];class Kt extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:s,encrypted:r,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:w,format:l,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=l&&Rt(l),k=qt(c,o,e),z=a&&s&&!w&&!v&&(!r||i)&&Boolean(k);if(r&&!i||!a||z||(y=new U,g=Jt(g,y)),s)if(v)g=Qt(g,Nt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(z)S=new Ot,g=Qt(g,new k(Wt,{level:f,chunkSize:n})),g=Jt(g,S);else try{g=Gt(g,c,{level:f,chunkSize:n},o,e)}catch(t){if(!c&&e)throw t;let n;try{n=new o(Wt)}catch{throw t}g=Qt(g,n),g=Jt(g,new Ot)}r&&(i?g=Jt(g,new bt(t)):(m=new dt(t),g=Jt(g,m))),Lt(d,g,()=>{r&&!i||!a||(d.crc32=z?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Ot extends d{constructor(){let t,n=10,e=new r(0);super({transform(t,s){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const r=e.length+t.length;if(r<=8)return void(e=B(e,t));const c=r-8,i=o.min(c,e.length);s.enqueue(B(e.subarray(0,i),t.subarray(0,c-i))),e=B(e.subarray(i),t.subarray(c-i))},flush(){const n=V(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Tt extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:l,useCompressionStream:h,deflate64:p,format:d,compressionMethod:m,rawBitFlag:S,outputSize:g}=t;let k,z,b,C=super.readable;if(i&&(c?C=Jt(C,new zt(t)):(z=new pt(t),C=Jt(C,z))),l){const t=d&&Rt(d);if(t)C=Qt(C,Nt(t.DecompressionStream,d,{chunkSize:n,compressionMethod:m,rawBitFlag:S,uncompressedSize:g}));else{let t;const c=qt(h,o,e);if(a&&!p&&f!==v&&g!==v&&c)try{t=new c(Wt,{chunkSize:n})}catch{t=v}if(!t)try{C=Gt(C,h,{chunkSize:n,deflate64:p},o,e)}catch(n){if(p||g===v||!h&&e)throw n;try{t=new o(Wt)}catch{throw n}}t&&(b=!0,C=function(t,n,e,o){const c=n.writable.getWriter(),i=n.readable.getReader(),a=o===v?new R:v;let f,u,l=0,h=!1,p=!1,d=!1,m=0,S=!1;const g=new w((t,n)=>{f=t,u=n});return g.catch(()=>{}),async function(){const n=t.getReader();try{const t=new r(10);for(t.set(jt),await c.write(t);;){await c.ready;const{value:t,done:e}=await n.read();if(e)break;await c.write(t)}h=!0,a&&(S&&z(),await g);const s=new r(8),i=V(s);i.setUint32(0,a?a.get():o,!0),i.setUint32(4,e,!0),p=!0,await c.write(s),await c.close()}catch(t){await Xt(c,t),await Yt(n,t)}}(),new y({async pull(t){let n;try{n=await function(){m++,S=!0;const t=i.read();return t.then(k,k),h&&a&&z(),t}()}catch(t){throw p?function(t){const n=new s(l==e?Bt:Ut);return n.cause=t,n}(t):t}const{value:o,done:r}=n;if(r)t.close();else{if(l+=o.length,l>e){const t=new s(Ut);throw u(t),await Yt(i,t),t}a&&a.append(o),t.enqueue(o)}},cancel:t=>(u(t),i.cancel(t))});function k(){S=!1}async function z(){if(!d){d=!0;const t=m;await new w(t=>{const{port1:n,port2:e}=new MessageChannel;e.onmessage=()=>{n.close(),e.close(),t()},n.postMessage(v)}),d=!1,S&&(m==t?f():z())}}}(C,t,g,f))}C=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new s("Invalid compressed data");throw n.cause=t,n}const{value:o,done:r}=e;r?t.close():t.enqueue(o)},cancel:t=>n.cancel(t)})}(C)}a&&!b&&(k=new U,C=Jt(C,k)),Lt(this,C,()=>{if(k){const t=new u(k.value.buffer).getUint32(0,!1);if(f!=t)throw new s(Bt)}})}}const Ht=new f;function Lt(t,e,o){e=Jt(e,new d({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function Nt(t,n,e){if(!t)throw new s("Compression method not supported");return new t(n,e)}function qt(t,n,e){return t&&n?n:e&&e.requiresModule?e:void 0}function Gt(t,n,e,o,s){const r=n&&o?o:s||o,c=e.deflate64?"deflate64-raw":Vt;let i;try{i=new r(c,e)}catch(t){if(!n||!s||r==s)throw t;i=new s(c,e)}return Qt(t,i)}function Jt(t,n){return Ft(t).pipeThrough(n)}function Qt(t,n){const e=n.writable.getWriter(),o=t.getReader();return async function(){try{for(;;){await e.ready;const t=await o.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await Xt(e,t),await Yt(o,t)}}(),n.readable}async function Xt(t,n){try{await t.abort(n)}catch{}}async function Yt(t,n){try{await t.cancel(n)}catch{}}const Zt="data",$t="deflate";class _t extends d{constructor(t,e){super({});const o=this,{codecType:r}=t;let c;r.startsWith($t)?c=Kt:r.startsWith("inflate")&&(c=Tt),o.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(o,{inputSize:i})}}),w=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new s(Ut)},flush(){const{crc32:t}=a;n.assign(o,{crc32:t,inputSize:i})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(w)})}}class tn extends d{constructor(t){const o=[];let s=0,c=0;function i(){const n=new r(t);let e=0;for(;e<t;){const s=o[0],r=t-e;s.length<=r?(n.set(s,e),e+=s.length,o.shift()):(n.set(s.subarray(0,r),e),o[0]=s.subarray(r),e+=r)}return s-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),s+=n.length;s>t;)c+=t,e.enqueue(i())},flush(t){s&&(c+=s,t.enqueue(function(t,n){const e=new r(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,s)))}}),n.defineProperty(this,"outputSize",{get:()=>c})}}let nn=2;try{typeof navigator!=k&&navigator.hardwareConcurrency&&(nn=navigator.hardwareConcurrency)}catch{}function en(t){return Boolean(t)&&"object"==typeof t}const on=new f,sn=new f,rn=function(){try{return structuredClone(new s)instanceof s}catch{return!1}}();let cn=0;async function an(t){let n,r,c;try{const{options:i,config:a}=t;if(i.format)try{await async function(t,n){!Et.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=z&&typeof o!=z)throw new s("Invalid codec module");Et.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(i.format,i.codecURI)}catch(t){if(en(t))try{t.codecImportFailed=!0}catch{}throw t}if(a.CompressionStream=self.CompressionStream,a.DecompressionStream=self.DecompressionStream,i.compressed&&!i.format)if(i.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Ht.get(t);e||(e=new f,Ht.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(i.codecType.startsWith($t)?a.CompressionStream:a.DecompressionStream,Vt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{i.useCompressionStream=!0}if(i.encrypted&&!i.zipCrypto)try{await self.initModule(t.config)}catch{}!a.CompressionStreamFallback&&a.CompressionStreamZlib&&(a.CompressionStreamFallback=a.CompressionStreamZlib),!a.DecompressionStreamFallback&&a.DecompressionStreamZlib&&(a.DecompressionStreamFallback=a.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Ft(t.readable):new y({async pull(t){const n=new w(t=>on.set(cn,t));fn({type:"pull",messageId:cn}),cn=(cn+1)%e.MAX_SAFE_INTEGER;const{value:o,done:s}=await n;t.enqueue(o),s&&t.close()}},u);c=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const o=new w(t=>n=t);sn.set(cn,n),fn({type:Zt,value:t,messageId:cn}),cn=(cn+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new _t(i,a),r=new tn(function(t){return s="string"==typeof(n=s=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(s)&&s>=1?o.max(s,64):65536;var n,s}(a)),await l.pipeThrough(n).pipeThrough(r).pipeTo(c,{preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;fn({type:"close",result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){const n=r?r.outputSize:0;if(en(t))try{t.outputSize=n}catch{}if(c&&!c.locked)try{await c.getWriter().close()}catch{}un(t,n)}}function fn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new r(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function un(t,n){const{message:e,stack:o,code:r,name:c,outputSize:i,cause:a,codecImportFailed:f}=function(t=new s("Unknown error")){return en(t)?t:new s(String(t))}(t),u={message:e,stack:o,code:r,name:c,outputSize:i===v?n:i};if(a&&(u.cause={name:a.name,message:a.message}),f&&(u.codecImportFailed=!0),rn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:s}=t;try{if("start"==n&&an(t),n==Zt){const t=on.get(e);on.delete(e),t({value:o||new r,done:s})}if("ack"==n){const t=sn.get(e);sn.delete(e),t()}}catch(t){un(t)}}),p({type:"ready"});const wn="deflate",ln="deflate-raw",hn="deflate64-raw",pn="gzip";let dn,yn,mn,Sn,gn;function vn(t,n,e={}){if(!dn){const t=new s("WASM module not loaded");throw t.cause=gn,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.C=yn(i),this.in=yn(a),this.inBufferSize=a,!this.C||!this.in)throw new s("allocation failed");if(t?(this.I=dn.deflate_process,this.A=dn.deflate_last_consumed,this.M=dn.deflate_end,this.P=dn.deflate_new(),e=n===pn?dn.deflate_init_gzip(this.P,c):n===ln?dn.deflate_init_raw(this.P,c):dn.deflate_init(this.P,c)):n===hn?(this.I=dn.inflate9_process,this.A=dn.inflate9_last_consumed,this.M=dn.inflate9_end,this.P=dn.inflate9_new(),e=dn.inflate9_init_raw(this.P)):(this.I=dn.inflate_process,this.A=dn.inflate_last_consumed,this.M=dn.inflate_end,this.P=dn.inflate_new(),e=n===ln?dn.inflate_init_raw(this.P):n===pn?dn.inflate_init_gzip(this.P):dn.inflate_init(this.P)),0!==e)throw new s("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new r(Sn.buffer),a=this.I,f=this.A,u=this.C;let w=0;for(;w<e.length;){const t=o.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&mn&&(mn(this.in),this.in=0),this.in=yn(t),this.inBufferSize=t,!this.in))throw new s("allocation failed");c.set(e.subarray(w,w+t),this.in);const r=a(this.P,this.in,t,u,i,0),l=r>>24&255,h=128&l?l-256:l;if(h<0)throw new s("process error:"+h);const p=16777215&r;p&&n.enqueue(c.slice(u,u+p));const d=f(this.P);if(0===d&&0===p)break;w+=d}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new r(Sn.buffer),e=this.I,o=this.C;for(;;){const r=e(this.P,0,0,o,i,4),c=r>>24&255,a=128&c?c-256:c;if(a<0)throw new s("process error:"+a);const f=16777215&r;if(f&&t.enqueue(n.slice(o,o+f)),1===c||0===f)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new s("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.P&&t.M&&(n=t.M(t.P)),t.P=0,t.in&&mn&&mn(t.in),t.in=0,t.C&&mn&&mn(t.C),t.C=0,n}}class kn{constructor(t=wn,n){return vn(!0,t,n)}}class zn{constructor(t=wn,n){return vn(!1,t,n)}}kn.requiresModule=!0,zn.requiresModule=!0,kn.supportedFormats=[wn,ln,pn],zn.supportedFormats=[wn,ln,pn,hn];const bn=65536;let Cn,In;function An(t){return new r(t.memory.buffer)}let Mn=!1;!function(t={}){const{init:n,D:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(ht=e||Q),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),s&&(t.DecompressionStreamFallback=s)}}({CompressionStreamFallback:kn,DecompressionStreamFallback:zn,D:function(t,n){const e=Cn;let o=e?function(t,n,e){In||(In=t.malloc(bn));const o=In?t.aes_hmac_new():0;if(o){const s=An(t);if(s.set(n,In),s.set(e,In+n.length),t.aes_hmac_init(o,In,n.length,In+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return Q(t,n);const s=In;return{process(t,n){for(let r=0;r<t.length;r+=bn){const c=t.subarray(r,r+bn),i=An(e);i.set(c,s),e.aes_hmac_process(o,s,c.length,n?1:0),c.set(i.subarray(s,s+c.length))}},digest:()=>(e.aes_hmac_end(o,s),o=0,An(e).slice(s,s+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!Mn)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const s=await fetch(o);e=await s.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),o=e.length,s=new r(o);for(let t=0;t<o;++t)s[t]=e.charCodeAt(t);return s.buffer}(t)}const c=await WebAssembly.instantiate(e);var i;(function(t){if(dn=t,({malloc:yn,free:mn,memory:Sn}=dn),"function"!=typeof yn||"function"!=typeof mn||!Sn)throw dn=yn=mn=Sn=null,new s("Invalid WASM module")})(c.instance.exports),typeof(i=c.instance.exports).aes_hmac_new==z&&(Cn=i,In=0)}(t,n),Mn=!0}catch(t){throw function(t){gn=t}(t),t}}(t.wasmURI,t)})});\n';
37688
+ if ("string" == typeof s4 && (s4 = new TextEncoder().encode(s4)), t4) {
37689
+ const t5 = new Blob([s4], { type: e3 });
37086
37690
  return URL.createObjectURL(t5);
37087
37691
  }
37088
37692
  return "data:" + e3 + ";base64," + function(t5) {
37089
37693
  let e4 = "";
37090
- const r3 = t5.length;
37091
- let o2 = 0;
37092
- for (; o2 + 2 < r3; o2 += 3) {
37093
- const r4 = t5[o2] << 16 | t5[o2 + 1] << 8 | t5[o2 + 2];
37094
- e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + n[r4 >> 6 & 63] + n[63 & r4];
37095
- }
37096
- const s4 = r3 - o2;
37097
- if (1 === s4) {
37098
- const r4 = t5[o2] << 16;
37099
- e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + "==";
37100
- } else if (2 === s4) {
37101
- const r4 = t5[o2] << 16 | t5[o2 + 1] << 8;
37102
- e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + n[r4 >> 6 & 63] + "=";
37694
+ const s5 = t5.length;
37695
+ let r2 = 0;
37696
+ for (; r2 + 2 < s5; r2 += 3) {
37697
+ const s6 = t5[r2] << 16 | t5[r2 + 1] << 8 | t5[r2 + 2];
37698
+ e4 += n[s6 >> 18 & 63] + n[s6 >> 12 & 63] + n[s6 >> 6 & 63] + n[63 & s6];
37699
+ }
37700
+ const o2 = s5 - r2;
37701
+ if (1 === o2) {
37702
+ const s6 = t5[r2] << 16;
37703
+ e4 += n[s6 >> 18 & 63] + n[s6 >> 12 & 63] + "==";
37704
+ } else if (2 === o2) {
37705
+ const s6 = t5[r2] << 16 | t5[r2 + 1] << 8;
37706
+ e4 += n[s6 >> 18 & 63] + n[s6 >> 12 & 63] + n[s6 >> 6 & 63] + "=";
37103
37707
  }
37104
37708
  return e4;
37105
- }(r2);
37709
+ }(s4);
37106
37710
  } });
37107
37711
 
37108
37712
  // ../../node_modules/@zip.js/zip.js/lib/zip-core-base.js
@@ -37117,7 +37721,6 @@ init_codec_worker();
37117
37721
  var MODULE_WORKER_OPTIONS = { type: "module" };
37118
37722
  var ERROR_EVENT_TYPE = "error";
37119
37723
  var MESSAGE_ERROR_EVENT_TYPE = "messageerror";
37120
- var ABORT_EVENT_TYPE = "abort";
37121
37724
  var webWorkerSource;
37122
37725
  var webWorkerURI;
37123
37726
  var webWorkerOptions;
@@ -37282,13 +37885,6 @@ function watchClosedStream(writableSource, workerData) {
37282
37885
  Object.assign(workerData, { destinationFailed: true, destinationError: error2 });
37283
37886
  }
37284
37887
  });
37285
- const { signal } = workerData.workerOptions.streamOptions;
37286
- if (signal) {
37287
- const onAbort = () => abortController.abort(signal.reason);
37288
- const removeAbortListener = () => signal.removeEventListener(ABORT_EVENT_TYPE, onAbort);
37289
- signal.addEventListener(ABORT_EVENT_TYPE, onAbort);
37290
- closed.then(removeAbortListener, removeAbortListener);
37291
- }
37292
37888
  return {
37293
37889
  writable,
37294
37890
  closed,
@@ -37537,6 +38133,9 @@ function getResponseError(errorData, errorValue) {
37537
38133
  responseError = errorValue.value;
37538
38134
  } else {
37539
38135
  responseError = Object.assign(new Error(message), { stack, code, name });
38136
+ if (cause) {
38137
+ responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
38138
+ }
37540
38139
  }
37541
38140
  if (isErrorObject(responseError)) {
37542
38141
  try {
@@ -37546,9 +38145,6 @@ function getResponseError(errorData, errorValue) {
37546
38145
  if (codecImportFailed) {
37547
38146
  responseError.codecImportFailed = true;
37548
38147
  }
37549
- if (cause && !isErrorObject(responseError.cause)) {
37550
- responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
37551
- }
37552
38148
  if (errorValue) {
37553
38149
  if (responseError.name !== name) {
37554
38150
  responseError.name = name;
@@ -38223,11 +38819,9 @@ function resolveMetadata(zipWriter, name, options) {
38223
38819
  const passThrough = checkPassThroughOption(getOptionValue2(zipWriter, options, OPTION_PASS_THROUGH));
38224
38820
  const passThroughCompression = Boolean(passThrough);
38225
38821
  const passThroughEncryption = passThrough === true;
38226
- let password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38227
- let rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38822
+ const password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38823
+ const rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38228
38824
  checkPasswordOption(password, rawPassword);
38229
- password = password && password.length ? password : UNDEFINED_VALUE;
38230
- rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
38231
38825
  const encryptionStrength = getNumberOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
38232
38826
  const zipCrypto = getOptionValue2(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
38233
38827
  const extendedTimestamp = getOptionValue2(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
@@ -38738,7 +39332,6 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
38738
39332
  const result = await runWorker2({ readable, writable }, workerOptions);
38739
39333
  compressedSize = result.outputSize;
38740
39334
  writer.size += compressedSize;
38741
- throwIfAborted(signal);
38742
39335
  if (!passThroughCompression) {
38743
39336
  uncompressedSize = result.inputSize;
38744
39337
  if (!encrypted || zipCrypto) {
@@ -39904,10 +40497,6 @@ var FORMAT_DEFLATE = "deflate";
39904
40497
  var FORMAT_DEFLATE_RAW2 = "deflate-raw";
39905
40498
  var FORMAT_DEFLATE64_RAW2 = "deflate64-raw";
39906
40499
  var FORMAT_GZIP2 = "gzip";
39907
- var Z_MEM_ERROR = -4;
39908
- var Z_MEM_ERROR_CODE2 = "Z_MEM_ERROR";
39909
- var COMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2];
39910
- var DECOMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2, FORMAT_DEFLATE64_RAW2];
39911
40500
  var wasm;
39912
40501
  var malloc;
39913
40502
  var free;
@@ -39924,16 +40513,7 @@ function setWasmExports(wasmAPI) {
39924
40513
  function setInitError(error2) {
39925
40514
  initError = error2;
39926
40515
  }
39927
- function setZlibCode(error2, result) {
39928
- if (result === Z_MEM_ERROR) {
39929
- error2.code = Z_MEM_ERROR_CODE2;
39930
- }
39931
- return error2;
39932
- }
39933
40516
  function _make(isCompress, type, options = {}) {
39934
- if (!(isCompress ? COMPRESSION_FORMATS : DECOMPRESSION_FORMATS).includes(type)) {
39935
- throw new TypeError("Unsupported format: " + type);
39936
- }
39937
40517
  if (!wasm) {
39938
40518
  const error2 = new Error("WASM module not loaded");
39939
40519
  error2.cause = initError;
@@ -39942,208 +40522,147 @@ function _make(isCompress, type, options = {}) {
39942
40522
  const level = typeof options.level === "number" ? options.level : -1;
39943
40523
  const outBufferSize = typeof options.outBuffer === "number" ? options.outBuffer : 64 * 1024;
39944
40524
  const inBufferSize = typeof options.inBufferSize === "number" ? options.inBufferSize : 64 * 1024;
39945
- const state = { out: 0, in: 0, inBufferSize: 0, streamHandle: 0, streamEnded: false };
39946
- let readableController, writableController, resolveWrite, cancelReason;
39947
- let backpressure = true;
39948
- let cancelled = false;
39949
- initStream2();
39950
- const readable = new ReadableStream({
39951
- start(controller) {
39952
- readableController = controller;
39953
- },
39954
- pull() {
39955
- backpressure = false;
39956
- resumeWrite();
39957
- },
39958
- cancel(reason) {
39959
- cancelled = true;
39960
- cancelReason = reason;
39961
- disposeStream(state);
39962
- writableController.error(reason);
39963
- resumeWrite();
39964
- }
39965
- }, { highWaterMark: 0 });
39966
- const writable = new WritableStream({
39967
- start(controller) {
39968
- writableController = controller;
39969
- },
39970
- async write(chunk) {
39971
- if (backpressure) {
39972
- await new Promise((resolve2) => resolveWrite = resolve2);
39973
- }
39974
- if (cancelled) {
39975
- throw cancelReason;
39976
- }
40525
+ return new TransformStream({
40526
+ start() {
39977
40527
  try {
39978
- processChunk(chunk);
40528
+ let result;
40529
+ this.out = malloc(outBufferSize);
40530
+ this.in = malloc(inBufferSize);
40531
+ this.inBufferSize = inBufferSize;
40532
+ if (!this.out || !this.in) {
40533
+ throw new Error("allocation failed");
40534
+ }
40535
+ if (isCompress) {
40536
+ this._process = wasm.deflate_process;
40537
+ this._last_consumed = wasm.deflate_last_consumed;
40538
+ this._end = wasm.deflate_end;
40539
+ this.streamHandle = wasm.deflate_new();
40540
+ if (type === FORMAT_GZIP2) {
40541
+ result = wasm.deflate_init_gzip(this.streamHandle, level);
40542
+ } else if (type === FORMAT_DEFLATE_RAW2) {
40543
+ result = wasm.deflate_init_raw(this.streamHandle, level);
40544
+ } else {
40545
+ result = wasm.deflate_init(this.streamHandle, level);
40546
+ }
40547
+ } else {
40548
+ if (type === FORMAT_DEFLATE64_RAW2) {
40549
+ this._process = wasm.inflate9_process;
40550
+ this._last_consumed = wasm.inflate9_last_consumed;
40551
+ this._end = wasm.inflate9_end;
40552
+ this.streamHandle = wasm.inflate9_new();
40553
+ result = wasm.inflate9_init_raw(this.streamHandle);
40554
+ } else {
40555
+ this._process = wasm.inflate_process;
40556
+ this._last_consumed = wasm.inflate_last_consumed;
40557
+ this._end = wasm.inflate_end;
40558
+ this.streamHandle = wasm.inflate_new();
40559
+ if (type === FORMAT_DEFLATE_RAW2) {
40560
+ result = wasm.inflate_init_raw(this.streamHandle);
40561
+ } else if (type === FORMAT_GZIP2) {
40562
+ result = wasm.inflate_init_gzip(this.streamHandle);
40563
+ } else {
40564
+ result = wasm.inflate_init(this.streamHandle);
40565
+ }
40566
+ }
40567
+ }
40568
+ if (result !== 0) {
40569
+ throw new Error("init failed:" + result);
40570
+ }
39979
40571
  } catch (error2) {
39980
- disposeStream(state);
39981
- readableController.error(error2);
40572
+ disposeStream(this);
39982
40573
  throw error2;
39983
40574
  }
39984
40575
  },
39985
- close() {
39986
- if (cancelled) {
39987
- return;
39988
- }
40576
+ transform(chunk, controller) {
39989
40577
  try {
39990
- flushStream();
40578
+ const buffer2 = chunk;
40579
+ const heap = new Uint8Array(memory.buffer);
40580
+ const process2 = this._process;
40581
+ const last_consumed = this._last_consumed;
40582
+ const out = this.out;
40583
+ let offset = 0;
40584
+ while (offset < buffer2.length) {
40585
+ const toRead = Math.min(buffer2.length - offset, 32 * 1024);
40586
+ if (!this.in || this.inBufferSize < toRead) {
40587
+ if (this.in && free) {
40588
+ free(this.in);
40589
+ this.in = 0;
40590
+ }
40591
+ this.in = malloc(toRead);
40592
+ this.inBufferSize = toRead;
40593
+ if (!this.in) {
40594
+ throw new Error("allocation failed");
40595
+ }
40596
+ }
40597
+ heap.set(buffer2.subarray(offset, offset + toRead), this.in);
40598
+ const result = process2(this.streamHandle, this.in, toRead, out, outBufferSize, 0);
40599
+ const code = result >> 24 & 255;
40600
+ const signedCode = code & 128 ? code - 256 : code;
40601
+ if (signedCode < 0) {
40602
+ throw new Error("process error:" + signedCode);
40603
+ }
40604
+ const prod = result & 16777215;
40605
+ if (prod) {
40606
+ controller.enqueue(heap.slice(out, out + prod));
40607
+ }
40608
+ const consumed = last_consumed(this.streamHandle);
40609
+ if (consumed === 0 && prod === 0) {
40610
+ break;
40611
+ }
40612
+ offset += consumed;
40613
+ }
39991
40614
  } catch (error2) {
39992
- disposeStream(state);
39993
- readableController.error(error2);
39994
- throw error2;
39995
- }
39996
- const result = disposeStream(state);
39997
- if (result !== 0) {
39998
- const error2 = setZlibCode(new Error("end error:" + result), result);
39999
- readableController.error(error2);
40000
- throw error2;
40615
+ disposeStream(this);
40616
+ controller.error(error2);
40001
40617
  }
40002
- readableController.close();
40003
40618
  },
40004
- abort(reason) {
40005
- disposeStream(state);
40006
- readableController.error(reason);
40007
- }
40008
- }, { highWaterMark: 1 });
40009
- return { readable, writable };
40010
- function initStream2() {
40011
- try {
40012
- let result;
40013
- state.out = malloc(outBufferSize);
40014
- state.in = malloc(inBufferSize);
40015
- state.inBufferSize = inBufferSize;
40016
- if (!state.out || !state.in) {
40017
- throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
40018
- }
40019
- if (isCompress) {
40020
- state._process = wasm.deflate_process;
40021
- state._last_consumed = wasm.deflate_last_consumed;
40022
- state._end = wasm.deflate_end;
40023
- state.streamHandle = wasm.deflate_new();
40024
- if (type === FORMAT_GZIP2) {
40025
- result = wasm.deflate_init_gzip(state.streamHandle, level);
40026
- } else if (type === FORMAT_DEFLATE_RAW2) {
40027
- result = wasm.deflate_init_raw(state.streamHandle, level);
40028
- } else {
40029
- result = wasm.deflate_init(state.streamHandle, level);
40030
- }
40031
- } else {
40032
- if (type === FORMAT_DEFLATE64_RAW2) {
40033
- state._process = wasm.inflate9_process;
40034
- state._last_consumed = wasm.inflate9_last_consumed;
40035
- state._end = wasm.inflate9_end;
40036
- state.streamHandle = wasm.inflate9_new();
40037
- result = wasm.inflate9_init_raw(state.streamHandle);
40038
- } else {
40039
- state._process = wasm.inflate_process;
40040
- state._last_consumed = wasm.inflate_last_consumed;
40041
- state._end = wasm.inflate_end;
40042
- state.streamHandle = wasm.inflate_new();
40043
- if (type === FORMAT_DEFLATE_RAW2) {
40044
- result = wasm.inflate_init_raw(state.streamHandle);
40045
- } else if (type === FORMAT_GZIP2) {
40046
- result = wasm.inflate_init_gzip(state.streamHandle);
40047
- } else {
40048
- result = wasm.inflate_init(state.streamHandle);
40619
+ flush(controller) {
40620
+ try {
40621
+ const heap = new Uint8Array(memory.buffer);
40622
+ const process2 = this._process;
40623
+ const out = this.out;
40624
+ while (true) {
40625
+ const result = process2(this.streamHandle, 0, 0, out, outBufferSize, 4);
40626
+ const code = result >> 24 & 255;
40627
+ const signedCode = code & 128 ? code - 256 : code;
40628
+ if (signedCode < 0) {
40629
+ throw new Error("process error:" + signedCode);
40630
+ }
40631
+ const produced = result & 16777215;
40632
+ if (produced) {
40633
+ controller.enqueue(heap.slice(out, out + produced));
40634
+ }
40635
+ if (code === 1 || produced === 0) {
40636
+ break;
40049
40637
  }
40050
40638
  }
40639
+ } catch (error2) {
40640
+ controller.error(error2);
40641
+ } finally {
40642
+ const result = disposeStream(this);
40643
+ if (result !== 0) {
40644
+ controller.error(new Error("end error:" + result));
40645
+ }
40051
40646
  }
40052
- if (result !== 0) {
40053
- throw setZlibCode(new Error("init failed:" + result), result);
40054
- }
40055
- } catch (error2) {
40056
- disposeStream(state);
40057
- throw error2;
40058
- }
40059
- }
40060
- function processChunk(chunk) {
40061
- const heap = new Uint8Array(memory.buffer);
40062
- const process2 = state._process;
40063
- const last_consumed = state._last_consumed;
40064
- const out = state.out;
40065
- let offset = 0;
40066
- while (offset < chunk.length) {
40067
- if (state.streamEnded) {
40068
- throw new Error("trailing data after the end of the stream");
40069
- }
40070
- const toRead = Math.min(chunk.length - offset, 32 * 1024);
40071
- if (!state.in || state.inBufferSize < toRead) {
40072
- if (state.in && free) {
40073
- free(state.in);
40074
- state.in = 0;
40075
- }
40076
- state.in = malloc(toRead);
40077
- state.inBufferSize = toRead;
40078
- if (!state.in) {
40079
- throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
40080
- }
40081
- }
40082
- heap.set(chunk.subarray(offset, offset + toRead), state.in);
40083
- const result = process2(state.streamHandle, state.in, toRead, out, outBufferSize, 0);
40084
- const code = result >> 24 & 255;
40085
- const signedCode = code & 128 ? code - 256 : code;
40086
- if (signedCode < 0) {
40087
- throw setZlibCode(new Error("process error:" + signedCode), signedCode);
40088
- }
40089
- const prod = result & 16777215;
40090
- if (prod) {
40091
- enqueue(heap.slice(out, out + prod));
40092
- }
40093
- const consumed = last_consumed(state.streamHandle);
40094
- if (code === 1) {
40095
- state.streamEnded = true;
40096
- } else if (consumed === 0 && prod === 0) {
40097
- break;
40098
- }
40099
- offset += consumed;
40100
- }
40101
- }
40102
- function flushStream() {
40103
- const heap = new Uint8Array(memory.buffer);
40104
- const process2 = state._process;
40105
- const out = state.out;
40106
- while (true) {
40107
- const result = process2(state.streamHandle, 0, 0, out, outBufferSize, 4);
40108
- const code = result >> 24 & 255;
40109
- const signedCode = code & 128 ? code - 256 : code;
40110
- if (signedCode < 0) {
40111
- throw setZlibCode(new Error("process error:" + signedCode), signedCode);
40112
- }
40113
- const produced = result & 16777215;
40114
- if (produced) {
40115
- enqueue(heap.slice(out, out + produced));
40116
- }
40117
- if (code === 1 || produced === 0) {
40118
- break;
40119
- }
40120
- }
40121
- }
40122
- function enqueue(chunk) {
40123
- backpressure = true;
40124
- readableController.enqueue(chunk);
40125
- }
40126
- function resumeWrite() {
40127
- if (resolveWrite) {
40128
- const resolve2 = resolveWrite;
40129
- resolveWrite = null;
40130
- resolve2();
40647
+ },
40648
+ cancel() {
40649
+ disposeStream(this);
40131
40650
  }
40132
- }
40133
- function disposeStream(state2) {
40651
+ });
40652
+ function disposeStream(state) {
40134
40653
  let endResult = 0;
40135
- if (state2.streamHandle && state2._end) {
40136
- endResult = state2._end(state2.streamHandle);
40654
+ if (state.streamHandle && state._end) {
40655
+ endResult = state._end(state.streamHandle);
40137
40656
  }
40138
- state2.streamHandle = 0;
40139
- if (state2.in && free) {
40140
- free(state2.in);
40657
+ state.streamHandle = 0;
40658
+ if (state.in && free) {
40659
+ free(state.in);
40141
40660
  }
40142
- state2.in = 0;
40143
- if (state2.out && free) {
40144
- free(state2.out);
40661
+ state.in = 0;
40662
+ if (state.out && free) {
40663
+ free(state.out);
40145
40664
  }
40146
- state2.out = 0;
40665
+ state.out = 0;
40147
40666
  return endResult;
40148
40667
  }
40149
40668
  }
@@ -40159,8 +40678,8 @@ var DecompressionStreamZlib = class {
40159
40678
  };
40160
40679
  CompressionStreamZlib.requiresModule = true;
40161
40680
  DecompressionStreamZlib.requiresModule = true;
40162
- CompressionStreamZlib.supportedFormats = COMPRESSION_FORMATS;
40163
- DecompressionStreamZlib.supportedFormats = DECOMPRESSION_FORMATS;
40681
+ CompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2];
40682
+ DecompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2, FORMAT_DEFLATE64_RAW2];
40164
40683
 
40165
40684
  // ../../node_modules/@zip.js/zip.js/lib/core/streams/zlib-wasm/aes-hmac-sha1-wasm.js
40166
40685
  init_constants();
@@ -40305,7 +40824,6 @@ init_constants();
40305
40824
  init_array();
40306
40825
  init_compatible_streams();
40307
40826
  init_error();
40308
- var EMPTY_RAW_PASSWORD = new Uint8Array(0);
40309
40827
 
40310
40828
  // ../../node_modules/@zip.js/zip.js/lib/zip-fs-wasm.js
40311
40829
  e(setDefaultConfiguration);
@@ -40761,6 +41279,7 @@ var THEME_PATH = "src/theme/tokens.json";
40761
41279
  var RUNTIME_CAPABILITIES_PATH = ".platform-sdk/runtime-capabilities.json";
40762
41280
  var LEGACY_RUNTIME_CARD_SCHEMA_VERSIONS = ["2", "3"];
40763
41281
  var DRAFT_FILE_MAX_BYTES = 1024 * 1024;
41282
+ var TRANSFORM_PREVIEW_REQUEST_MAX_BYTES = 4 * 1024 * 1024;
40764
41283
  var DRAFT_LIST_LIMIT = 1e3;
40765
41284
  var AGENT_CONFIG_MAX_BYTES = 16777215;
40766
41285
  var FINALIZE_LOCK_PATH = ".linkque/runtime/card-finalize.lock";
@@ -40850,6 +41369,48 @@ async function finalizeCardFromRequest(cwd, requestFile) {
40850
41369
  request.contextChecksum
40851
41370
  );
40852
41371
  }
41372
+ async function previewCardTransformFromRequest(cwd, requestFile) {
41373
+ const value = await readRequiredJsonWithLimit(
41374
+ import_path22.default.resolve(cwd, requestFile),
41375
+ TRANSFORM_PREVIEW_REQUEST_MAX_BYTES
41376
+ );
41377
+ if (!isCardTransformPreviewRequest(value)) {
41378
+ throw new LinkqueCliError(
41379
+ "CARD_DRAFT_INVALID",
41380
+ "\u6570\u636E\u8F6C\u6362\u8BD5\u8FD0\u884C\u8BF7\u6C42\u683C\u5F0F\u65E0\u6548"
41381
+ );
41382
+ }
41383
+ const executor = new DataTransformExecutor();
41384
+ try {
41385
+ const result = await executor.execute(value.source, value.input);
41386
+ if (result.data !== null) {
41387
+ result.data = normalizeCardDataValue(
41388
+ value.dataModelSchema,
41389
+ result.data
41390
+ );
41391
+ }
41392
+ if (result.data !== null) {
41393
+ const issues = validateJsonSchemaValue2(
41394
+ value.dataModelSchema,
41395
+ result.data
41396
+ );
41397
+ if (issues.length > 0) {
41398
+ throw new LinkqueCliError(
41399
+ "CARD_TRANSFORM_OUTPUT_SCHEMA_MISMATCH",
41400
+ `\u6570\u636E\u8F6C\u6362\u7ED3\u679C\u4E0D\u7B26\u5408 Schema\uFF1A${issues[0].path} ${issues[0].message}`
41401
+ );
41402
+ }
41403
+ }
41404
+ return { ...result, status: result.data === null ? "skipped" : "rendered" };
41405
+ } catch (cause) {
41406
+ if (cause instanceof DataTransformError) {
41407
+ throw new LinkqueCliError(cause.code, cause.message, { cause });
41408
+ }
41409
+ throw cause;
41410
+ } finally {
41411
+ await executor.close();
41412
+ }
41413
+ }
40853
41414
  async function rollbackCardFinalize(cwd, rollbackToken) {
40854
41415
  const payload = parseRollbackToken(rollbackToken);
40855
41416
  return withWorkspaceLock(
@@ -40900,6 +41461,29 @@ async function validateCardBindingsForBundle(cwd, draftId, bundle, fieldId) {
40900
41461
  const mountedMcpResourceIds = new Set(
40901
41462
  mcpResources.map((resource) => String(resource.resourceId))
40902
41463
  );
41464
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline") {
41465
+ const missing = bundle.manifest.dataSources.filter(
41466
+ (source) => !mountedMcpResourceIds.has(source.mcpResourceId)
41467
+ );
41468
+ if (missing.length > 0) {
41469
+ throw new LinkqueCliError(
41470
+ "CARD_BINDING_VALIDATION_FAILED",
41471
+ missing.map(
41472
+ (source, index) => `manifest.dataSources[${index}]: MCP resource ${source.mcpResourceId} is not mounted`
41473
+ ).join("; ")
41474
+ );
41475
+ }
41476
+ const businessFieldIds2 = bundle.manifest.fields.filter((field) => field.source === "business").map((field) => field.fieldId);
41477
+ return {
41478
+ bindingCount: bundle.manifest.dataSources.length,
41479
+ complete: true,
41480
+ draftChecksum: draftChecksum(bundle),
41481
+ draftId,
41482
+ draftStructureChecksum,
41483
+ validatedFieldIds: fieldId ? [fieldId] : businessFieldIds2,
41484
+ valid: true
41485
+ };
41486
+ }
40903
41487
  const issues = context ? validateA2UICardBindings(
40904
41488
  { draft: bundle, context, mountedMcpResourceIds },
40905
41489
  fieldId ? { fieldIds: /* @__PURE__ */ new Set([fieldId]) } : void 0
@@ -40947,6 +41531,31 @@ async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
40947
41531
  "\u5F53\u524D Runtime \u4E0D\u652F\u6301\u524D\u7AEF\u51FD\u6570 Action\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
40948
41532
  );
40949
41533
  }
41534
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline" && !await readRuntimeSupportsDataPipeline(cwd)) {
41535
+ throw new LinkqueCliError(
41536
+ "CARD_RUNTIME_SCHEMA_UNSUPPORTED",
41537
+ "\u5F53\u524D Agent Runtime \u4E0D\u652F\u6301\u670D\u52A1\u7AEF\u6570\u636E\u8F6C\u6362 pipeline\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
41538
+ );
41539
+ }
41540
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline" && bundle.manifest.argumentMode === "model" && !await readRuntimeSupportsModelFilledPipelineArguments(cwd)) {
41541
+ throw new LinkqueCliError(
41542
+ "CARD_RUNTIME_SCHEMA_UNSUPPORTED",
41543
+ "\u5F53\u524D Agent Runtime \u4E0D\u652F\u6301\u6A21\u578B\u586B\u5199\u591A MCP \u53C2\u6570\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
41544
+ );
41545
+ }
41546
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline") {
41547
+ const executor = new DataTransformExecutor();
41548
+ try {
41549
+ await executor.validateSource(bundle.manifest.dataTransform.source);
41550
+ } catch (cause) {
41551
+ if (cause instanceof DataTransformError) {
41552
+ throw new LinkqueCliError(cause.code, cause.message, { cause });
41553
+ }
41554
+ throw cause;
41555
+ } finally {
41556
+ await executor.close();
41557
+ }
41558
+ }
40950
41559
  const context = parseOptionalBindingContext(
40951
41560
  await readOptionalJson(import_path22.default.join(directory, "binding-context.json"))
40952
41561
  );
@@ -41211,6 +41820,44 @@ async function readRequiredJson(file, missingCode = "CARD_DRAFT_INVALID") {
41211
41820
  );
41212
41821
  }
41213
41822
  }
41823
+ async function readRequiredJsonWithLimit(file, maxBytes) {
41824
+ try {
41825
+ const content = await (0, import_promises15.readFile)(file, "utf8");
41826
+ if (Buffer.byteLength(content, "utf8") > maxBytes) {
41827
+ throw new LinkqueCliError(
41828
+ "CARD_DRAFT_INVALID",
41829
+ `${import_path22.default.basename(file)} \u8D85\u8FC7\u5927\u5C0F\u9650\u5236`
41830
+ );
41831
+ }
41832
+ return JSON.parse(content);
41833
+ } catch (cause) {
41834
+ if (cause instanceof LinkqueCliError) throw cause;
41835
+ if (isNodeError(cause, "ENOENT")) {
41836
+ throw new LinkqueCliError(
41837
+ "CARD_DRAFT_NOT_FOUND",
41838
+ `\u8BF7\u6C42\u6587\u4EF6\u7F3A\u5931: ${import_path22.default.basename(file)}`,
41839
+ { cause }
41840
+ );
41841
+ }
41842
+ if (cause instanceof SyntaxError) {
41843
+ throw new LinkqueCliError(
41844
+ "CARD_DRAFT_INVALID",
41845
+ `\u8BF7\u6C42\u6587\u4EF6\u4E0D\u662F\u6709\u6548 JSON: ${import_path22.default.basename(file)}`,
41846
+ { cause }
41847
+ );
41848
+ }
41849
+ throw new LinkqueCliError(
41850
+ "CARD_DRAFT_READ_FAILED",
41851
+ `\u8BF7\u6C42\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25: ${import_path22.default.basename(file)}`,
41852
+ { cause: cause instanceof Error ? cause : void 0 }
41853
+ );
41854
+ }
41855
+ }
41856
+ function isCardTransformPreviewRequest(value) {
41857
+ return isJsonObject(value) && value.version === 1 && typeof value.source === "string" && Array.isArray(value.input) && isJsonObject(value.dataModelSchema) && Object.keys(value).every(
41858
+ (key) => ["version", "source", "input", "dataModelSchema"].includes(key)
41859
+ );
41860
+ }
41214
41861
  async function readOptionalJson(file) {
41215
41862
  try {
41216
41863
  return await readRequiredJson(file, "CARD_DRAFT_NOT_FOUND");
@@ -41246,6 +41893,18 @@ async function readRuntimeSupportsFunctionActions(cwd) {
41246
41893
  ).catch(() => void 0);
41247
41894
  return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.frontendFunctionActions === true;
41248
41895
  }
41896
+ async function readRuntimeSupportsDataPipeline(cwd) {
41897
+ const value = await readOptionalJson(
41898
+ import_path22.default.join(cwd, RUNTIME_CAPABILITIES_PATH)
41899
+ ).catch(() => void 0);
41900
+ return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.serverDataPipeline === true;
41901
+ }
41902
+ async function readRuntimeSupportsModelFilledPipelineArguments(cwd) {
41903
+ const value = await readOptionalJson(
41904
+ import_path22.default.join(cwd, RUNTIME_CAPABILITIES_PATH)
41905
+ ).catch(() => void 0);
41906
+ return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.serverDataPipeline === true && value.a2uiCard.modelFilledPipelineArguments === true;
41907
+ }
41249
41908
  function containsFunctionAction(value) {
41250
41909
  if (Array.isArray(value)) return value.some(containsFunctionAction);
41251
41910
  if (!isJsonObject(value)) return false;
@@ -42469,6 +43128,13 @@ var nanoToMs = (nano) => {
42469
43128
  return void 0;
42470
43129
  }
42471
43130
  };
43131
+ function reverse(arr) {
43132
+ const ret = [];
43133
+ for (let i = arr.length - 1; i >= 0; i--) {
43134
+ ret.push(arr[i]);
43135
+ }
43136
+ return ret;
43137
+ }
42472
43138
 
42473
43139
  // ../linkque-agent-runtime-trace/dist/esm/decode.js
42474
43140
  function validateMetadata(attrs) {
@@ -42665,7 +43331,7 @@ function decodeOtlpLine(line, source, byteRange) {
42665
43331
  }
42666
43332
 
42667
43333
  // ../linkque-agent-runtime-trace/dist/esm/summarize.js
42668
- var import_node_crypto2 = require("node:crypto");
43334
+ var import_node_crypto3 = require("node:crypto");
42669
43335
  var dedupKey = (advanceId, suffix) => `${advanceId ?? ""}
42670
43336
  ${suffix ?? ""}`;
42671
43337
  var extractQueryInput = (facts) => {
@@ -42703,7 +43369,7 @@ var buildOperations = (facts) => {
42703
43369
  const ends = group.flatMap((f3) => f3.finishedAt !== void 0 ? [f3.finishedAt] : f3.name?.endsWith(".finished") && f3.startedAt !== void 0 ? [f3.startedAt] : []);
42704
43370
  const startedAt = starts.length ? Math.min(...starts) : void 0;
42705
43371
  const finishedAt = ends.length ? Math.max(...ends) : void 0;
42706
- const terminal = group.filter((f3) => f3.kind === "span" || f3.name?.endsWith(".finished")).reverse();
43372
+ const terminal = reverse(group.filter((f3) => f3.kind === "span" || f3.name?.endsWith(".finished")));
42707
43373
  const outcome = terminal.map((f3) => f3.outcome).find((v2) => v2 && v2 !== "0") ?? void 0;
42708
43374
  const operationId = group[0].identity.operationId;
42709
43375
  const parentOperationId = attrs[ETelemetryAttribute.LINKQUE_OPERATION_PARENT_ID];
@@ -42839,7 +43505,7 @@ ${body.section}`;
42839
43505
  section: body.section,
42840
43506
  contentRef,
42841
43507
  ...body.reason === "content_limit" ? { reason: "content_limit" } : {},
42842
- valueDigest: (0, import_node_crypto2.createHash)("sha256").update(JSON.stringify(body.value) ?? "").digest("hex"),
43508
+ valueDigest: (0, import_node_crypto3.createHash)("sha256").update(JSON.stringify(body.value) ?? "").digest("hex"),
42843
43509
  ...body.value && typeof body.value === "object" && (body.section.endsWith(".output") || body.section === "knowledge.input") ? {
42844
43510
  result: Object.fromEntries(Object.entries(body.value).filter(([key, value]) => [
42845
43511
  "status",
@@ -42906,8 +43572,8 @@ function summarize(input) {
42906
43572
  }
42907
43573
 
42908
43574
  // src/utils/otlpScanner.ts
42909
- var import_node_path12 = __toESM(require("node:path"));
42910
- var import_node_crypto3 = require("node:crypto");
43575
+ var import_node_path13 = __toESM(require("node:path"));
43576
+ var import_node_crypto4 = require("node:crypto");
42911
43577
  var import_promises20 = require("node:fs/promises");
42912
43578
 
42913
43579
  // src/commands/runs/types.ts
@@ -42962,7 +43628,7 @@ var scanFile = (content, source) => {
42962
43628
  return { facts, warnings };
42963
43629
  };
42964
43630
  async function scanRetainedLogs(cwd, pinned) {
42965
- const dir = import_node_path12.default.join(cwd, LOGS_ROOT);
43631
+ const dir = import_node_path13.default.join(cwd, LOGS_ROOT);
42966
43632
  let files;
42967
43633
  try {
42968
43634
  files = await (0, import_promises20.readdir)(dir);
@@ -42985,7 +43651,7 @@ async function scanRetainedLogs(cwd, pinned) {
42985
43651
  for (const file of selected) {
42986
43652
  try {
42987
43653
  const source = retainedFiles.get(file);
42988
- const filePath = import_node_path12.default.join(dir, file);
43654
+ const filePath = import_node_path13.default.join(dir, file);
42989
43655
  const before = await (0, import_promises20.stat)(filePath);
42990
43656
  const content = await (0, import_promises20.readFile)(filePath);
42991
43657
  const after = await (0, import_promises20.stat)(filePath);
@@ -42997,7 +43663,7 @@ async function scanRetainedLogs(cwd, pinned) {
42997
43663
  let window;
42998
43664
  if (pinned) {
42999
43665
  window = [...remaining].find(
43000
- (entry) => entry.source === source && content.length >= entry.bytes && (0, import_node_crypto3.createHash)("sha256").update(content.subarray(0, entry.bytes)).digest("hex") === entry.digest
43666
+ (entry) => entry.source === source && content.length >= entry.bytes && (0, import_node_crypto4.createHash)("sha256").update(content.subarray(0, entry.bytes)).digest("hex") === entry.digest
43001
43667
  );
43002
43668
  if (!window) continue;
43003
43669
  remaining.delete(window);
@@ -43008,7 +43674,7 @@ async function scanRetainedLogs(cwd, pinned) {
43008
43674
  window = {
43009
43675
  source,
43010
43676
  bytes: complete.length,
43011
- digest: (0, import_node_crypto3.createHash)("sha256").update(complete).digest("hex")
43677
+ digest: (0, import_node_crypto4.createHash)("sha256").update(complete).digest("hex")
43012
43678
  };
43013
43679
  }
43014
43680
  readWindow.push(window);
@@ -43261,7 +43927,12 @@ var scanContent = async (input) => {
43261
43927
  return { availability: "unavailable" };
43262
43928
  }
43263
43929
  const body = matched.body;
43264
- const availability = body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : body.availability === "unavailable" ? "unavailable" : "available";
43930
+ let availability = "available";
43931
+ if (body.availability === "partial") {
43932
+ availability = "partial";
43933
+ } else if (body.availability === "unavailable") {
43934
+ availability = "unavailable";
43935
+ }
43265
43936
  const maxBytes = input.maxBytes ?? 1024 * 1024;
43266
43937
  if (body.value === void 0) return { availability: "not_recorded" };
43267
43938
  const serialized = JSON.stringify(body.value);
@@ -43693,6 +44364,28 @@ var cardValidateBindings = {
43693
44364
  );
43694
44365
  }
43695
44366
  };
44367
+ var cardTransformPreview = {
44368
+ name: "card.transform-preview",
44369
+ description: "run a server-side card data transform against indexed sample input",
44370
+ options: [
44371
+ {
44372
+ flags: "--request-file <requestFile>",
44373
+ description: "manager-owned JSON request containing source, samples and schema",
44374
+ key: "requestFile",
44375
+ parse: parseRequestFile
44376
+ }
44377
+ ],
44378
+ summarize: ({ status: status2 }) => `Card data transform preview ${status2}.
44379
+ `,
44380
+ run: (cwd, options) => {
44381
+ if (options.requestFile === void 0) {
44382
+ throw new InvalidArgumentError(
44383
+ "required option '--request-file <requestFile>' not specified"
44384
+ );
44385
+ }
44386
+ return previewCardTransformFromRequest(cwd, options.requestFile);
44387
+ }
44388
+ };
43696
44389
  var cardFinalize = {
43697
44390
  name: "card.finalize",
43698
44391
  description: "[deprecated; manager compatibility only] validate and atomically upsert a CARD resource into agent config",
@@ -44071,6 +44764,7 @@ var COMMANDS = [
44071
44764
  cardList,
44072
44765
  cardRead,
44073
44766
  cardValidateBindings,
44767
+ cardTransformPreview,
44074
44768
  cardFinalize,
44075
44769
  cardRollback,
44076
44770
  agentdevStart,