linkque-cli-v2 1.5.0 → 1.6.0

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 +1211 -584
  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-3WYLH7P7.js} +1883 -1201
  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-GPVKBHKR.js} +1 -2
  10. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-UIU24A4Z.js → chunk-TSJX2OMA.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 +1153 -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 +3005 -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) {
@@ -20194,6 +20478,9 @@ var A2UI_CARD_TRANSFORM_PROFILE = "linkque-structural-v1";
20194
20478
  var A2UI_CARD_EXPRESSION_MAX_LENGTH = 4096;
20195
20479
  var A2UI_CARD_EXPRESSION_MAX_AST_NODES = 512;
20196
20480
  var A2UI_CARD_EXPRESSION_MAX_AST_DEPTH = 32;
20481
+ var A2UI_CARD_DATA_TRANSFORM_LANGUAGE = "javascript";
20482
+ var A2UI_CARD_DATA_TRANSFORM_PROFILE = "linkque-card-data-transform-v1";
20483
+ var A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES = 32 * 1024;
20197
20484
 
20198
20485
  // ../linkque-agent-data-binding-contract/dist/esm/json.js
20199
20486
  var BLOCKED_PATH_SEGMENTS = /* @__PURE__ */ new Set([
@@ -20360,8 +20647,8 @@ function analyzeA2UIBindings(protocol) {
20360
20647
  visitValue(component, "", context);
20361
20648
  const children = component.children;
20362
20649
  if (isPlainRecord(children) && typeof children.path === "string") {
20363
- const canonicalPath = canonicalizeBindingPath(children.path);
20364
- if (!canonicalPath || !isSafeJsonPointer(canonicalPath)) {
20650
+ const canonicalPath = canonicalizeBindingPath(children.path, context.listRoot);
20651
+ if (!canonicalPath || !isSafeJsonPointer(canonicalPath, true)) {
20365
20652
  issues.push(issue2(`card.surfaces.${surfaceId}.components.${component.id}.children.path`, "INVALID_BINDING_PATH", `Invalid list path ${children.path}`));
20366
20653
  } else {
20367
20654
  occurrences.push({
@@ -20371,6 +20658,7 @@ function analyzeA2UIBindings(protocol) {
20371
20658
  propertyPath: "children.path",
20372
20659
  rawPath: children.path,
20373
20660
  canonicalPath,
20661
+ ...context.listRoot ? { listRoot: context.listRoot } : {},
20374
20662
  usage: "list"
20375
20663
  });
20376
20664
  }
@@ -20435,6 +20723,7 @@ function addOccurrence(rawPath, propertyPath, usage, context) {
20435
20723
  propertyPath,
20436
20724
  rawPath,
20437
20725
  canonicalPath,
20726
+ ...context.listRoot ? { listRoot: context.listRoot } : {},
20438
20727
  usage
20439
20728
  });
20440
20729
  }
@@ -20545,6 +20834,33 @@ function validateJsonSchemaValue2(schema, value, path24 = "$") {
20545
20834
  validateValue(schema, value, path24, issues);
20546
20835
  return issues;
20547
20836
  }
20837
+ function normalizeCardDataValue(schema, value, required2 = true) {
20838
+ if (value === void 0 || value === null)
20839
+ return required2 ? value : void 0;
20840
+ let normalized = value;
20841
+ if (schema.type === "string" && (typeof value === "boolean" || typeof value === "number" && Number.isFinite(value))) {
20842
+ normalized = String(value);
20843
+ } else if ((schema.type === "number" || schema.type === "integer") && typeof value === "string") {
20844
+ const text = value.trim();
20845
+ if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u.test(text)) {
20846
+ const number4 = Number(text);
20847
+ if (Number.isFinite(number4) && (schema.type !== "integer" || Number.isSafeInteger(number4))) {
20848
+ normalized = number4;
20849
+ }
20850
+ }
20851
+ } else if (schema.type === "object" && isPlainRecord(value)) {
20852
+ const properties = isPlainRecord(schema.properties) ? schema.properties : {};
20853
+ const requiredKeys = new Set(Array.isArray(schema.required) ? schema.required : []);
20854
+ normalized = Object.fromEntries(Object.entries(value).flatMap(([key, child]) => {
20855
+ const childSchema = properties[key];
20856
+ const next = isPlainRecord(childSchema) ? normalizeCardDataValue(childSchema, child, requiredKeys.has(key)) : child;
20857
+ return next === void 0 ? [] : [[key, next]];
20858
+ }));
20859
+ } else if (schema.type === "array" && Array.isArray(value) && isPlainRecord(schema.items)) {
20860
+ normalized = value.map((child) => normalizeCardDataValue(schema.items, child));
20861
+ }
20862
+ return !required2 && validateJsonSchemaValue2(schema, normalized).length > 0 ? void 0 : normalized;
20863
+ }
20548
20864
  function generateJsonSchemaSample(schema) {
20549
20865
  const defaultValue = cloneJsonValue(schema.default);
20550
20866
  if (defaultValue !== void 0)
@@ -21455,7 +21771,8 @@ var decoration = {
21455
21771
  "primary",
21456
21772
  "primary-muted",
21457
21773
  "accent",
21458
- "warning"
21774
+ "warning",
21775
+ "transparent"
21459
21776
  ]
21460
21777
  },
21461
21778
  border: {
@@ -21467,6 +21784,7 @@ var decoration = {
21467
21784
  var typography = {
21468
21785
  color: { kind: "string", values: colors },
21469
21786
  fontSize: { kind: "string", values: ["xs", "sm", "md", "lg", "xl", "xxl"] },
21787
+ fontFamily: { kind: "string", values: ["digit", "digit-bold"] },
21470
21788
  fontWeight: { kind: "string", values: ["normal", "semibold", "bold"] }
21471
21789
  };
21472
21790
  var container = {
@@ -21503,6 +21821,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21503
21821
  ...layoutItem,
21504
21822
  ...containerSize,
21505
21823
  ...decoration,
21824
+ verticalAlign: { kind: "string", values: ["top", "center", "bottom"] },
21506
21825
  child: { kind: "child", required: true },
21507
21826
  action: { kind: "action" },
21508
21827
  disabled: { kind: "boolean" }
@@ -21537,8 +21856,8 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21537
21856
  shrink: { kind: "boolean" },
21538
21857
  text: { kind: "binding", required: true },
21539
21858
  maxLines: { kind: "number", values: [0, 1, 2, 3, 4, 5, 6] },
21540
- decoration: { kind: "string", values: ["line-through"] },
21541
- format: { kind: "format" }
21859
+ textAlign: { kind: "string", values: ["left", "center", "right"] },
21860
+ decoration: { kind: "string", values: ["line-through"] }
21542
21861
  }
21543
21862
  },
21544
21863
  Tag: {
@@ -21547,6 +21866,7 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21547
21866
  ...layoutItem,
21548
21867
  text: { kind: "binding", required: true },
21549
21868
  icon: { kind: "string", values: iconNames },
21869
+ image: { kind: "binding" },
21550
21870
  tone: {
21551
21871
  kind: "string",
21552
21872
  values: [
@@ -21602,7 +21922,20 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21602
21922
  height: { kind: "string", values: ["auto", "fill"] },
21603
21923
  size: {
21604
21924
  kind: "string",
21605
- values: ["xs", "sm", "md", "lg", "xl", "full"]
21925
+ values: [
21926
+ "xs",
21927
+ "sm",
21928
+ "md",
21929
+ "lg",
21930
+ "xl",
21931
+ "full",
21932
+ "text-xs",
21933
+ "text-sm",
21934
+ "text-md",
21935
+ "text-lg",
21936
+ "text-xl",
21937
+ "text-xxl"
21938
+ ]
21606
21939
  }
21607
21940
  }
21608
21941
  },
@@ -21646,7 +21979,6 @@ var A2UI_V4_COMPONENT_CATALOG = Object.freeze({
21646
21979
  "x2-funds"
21647
21980
  ]
21648
21981
  },
21649
- format: { kind: "string", values: ["date"] },
21650
21982
  validationRegexp: { kind: "string" },
21651
21983
  "x2-limit": { kind: "number" }
21652
21984
  }
@@ -21757,14 +22089,6 @@ function validateV4Component(component, componentPath, issues) {
21757
22089
  issues.push(issue2(`${componentPath}.component`, "UNSUPPORTED_COMPONENT", `V4 does not support component ${component.component}`));
21758
22090
  return;
21759
22091
  }
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
22092
  for (const [name, property] of Object.entries(schema.properties)) {
21769
22093
  const value = component[name];
21770
22094
  if (property.required && value === void 0)
@@ -21794,8 +22118,8 @@ function validateV4Component(component, componentPath, issues) {
21794
22118
  }
21795
22119
  if (component.checks !== void 0)
21796
22120
  validateChecks(component.checks, `${componentPath}.checks`, issues);
21797
- if (component.format !== void 0 && component.component === "Text")
21798
- validateNumberFormat(component.format, `${componentPath}.format`, issues);
22121
+ if (component.component === "Tag" && component.icon !== void 0 && component.image !== void 0)
22122
+ issues.push(issue2(componentPath, "INVALID_COMPONENT_PROP_VALUE", "Tag icon and image cannot be used together"));
21799
22123
  if (component.action !== void 0)
21800
22124
  validateAction(component.action, `${componentPath}.action`, issues, 0);
21801
22125
  }
@@ -21820,7 +22144,7 @@ function validateComponents(payload, path24, surfaces, issues) {
21820
22144
  }
21821
22145
  function validateProperty(value, schema, path24, issues, propertyName) {
21822
22146
  if (schema.kind === "binding") {
21823
- const stringOnly = propertyName === "label" || propertyName === "src" || propertyName === "alt";
22147
+ const stringOnly = propertyName === "label" || propertyName === "src" || propertyName === "alt" || propertyName === "image";
21824
22148
  const literalValid = typeof value === "string" || !stringOnly && typeof value === "number" && Number.isFinite(value);
21825
22149
  if (!literalValid && !isDisplayBinding(value, stringOnly))
21826
22150
  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 +22167,10 @@ function validateProperty(value, schema, path24, issues, propertyName) {
21843
22167
  return;
21844
22168
  if (schema.kind === "boolean" && typeof value !== "boolean")
21845
22169
  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"));
22170
+ if (schema.kind === "number" && !Number.isFinite(value))
22171
+ issues.push(issue2(path24, "INVALID_COMPONENT_PROP_VALUE", "value must be a finite number"));
22172
+ if (schema.kind === "string" && typeof value !== "string")
22173
+ issues.push(issue2(path24, "INVALID_COMPONENT_PROP_VALUE", "value must be a string"));
21850
22174
  }
21851
22175
  function isDisplayBinding(value, stringOnly = false) {
21852
22176
  if (!isPlainRecord(value) || typeof value.path !== "string" || !isSafePath(value.path))
@@ -21938,51 +22262,8 @@ function validateClientAction(body, path24, issues) {
21938
22262
  issues.push(issue2(`${path24}.context.url`, "INVALID_PAGE_URL", "ui.page.open URL must use https or the approved Alipay scheme"));
21939
22263
  return;
21940
22264
  }
21941
- if (body.name === "payment.trade-pay") {
21942
- validatePaymentActionContext(body.context, `${path24}.context`, issues);
21943
- return;
21944
- }
21945
22265
  issues.push(issue2(`${path24}.name`, "UNSUPPORTED_CLIENT_ACTION", `unsupported client action ${String(body.name)}`));
21946
22266
  }
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
22267
  function validateActionDynamicValue(value, path24, issues) {
21987
22268
  if (Array.isArray(value)) {
21988
22269
  value.forEach((entry, index) => validateActionDynamicValue(entry, `${path24}[${index}]`, issues));
@@ -22027,7 +22308,7 @@ function validateTextField(component, path24, issues) {
22027
22308
  issues.push(issue2(`${path24}.validationRegexp`, "INVALID_VALIDATION_REGEXP", "validationRegexp is too long"));
22028
22309
  else
22029
22310
  try {
22030
- new RegExp(component.validationRegexp);
22311
+ RegExp(component.validationRegexp);
22031
22312
  } catch {
22032
22313
  issues.push(issue2(`${path24}.validationRegexp`, "INVALID_VALIDATION_REGEXP", "validationRegexp is invalid"));
22033
22314
  }
@@ -22078,26 +22359,6 @@ function validateOverflow(component, path24, issues) {
22078
22359
  }
22079
22360
  }
22080
22361
  }
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
22362
  function rejectUnknownKeys(value, allowed, path24, issues) {
22102
22363
  const allowedKeys = new Set(allowed);
22103
22364
  Object.keys(value).forEach((key) => {
@@ -22187,20 +22448,20 @@ function hasInteractiveDescendant(id, components, visited) {
22187
22448
  }
22188
22449
 
22189
22450
  // ../agent-a2ui-card-contract/dist/esm/validation.js
22190
- var FIELD_TYPES = [
22451
+ var FIELD_TYPES = /* @__PURE__ */ new Set([
22191
22452
  "array",
22192
22453
  "boolean",
22193
22454
  "integer",
22194
22455
  "number",
22195
22456
  "object",
22196
22457
  "string"
22197
- ];
22198
- var FIELD_SOURCES = [
22458
+ ]);
22459
+ var FIELD_SOURCES = /* @__PURE__ */ new Set([
22199
22460
  "business",
22200
22461
  "invocation",
22201
22462
  "runtime-context",
22202
22463
  "local"
22203
- ];
22464
+ ]);
22204
22465
  var RUNTIME_CONTEXT_KEYS2 = /* @__PURE__ */ new Set([
22205
22466
  "agentId",
22206
22467
  "tenantId",
@@ -22235,7 +22496,7 @@ function getA2UICardDraftBundleIssues(value) {
22235
22496
  if (manifest?.schemaVersion === "4") {
22236
22497
  issues.push(...getA2UIV4ProtocolIssues(card, "draft.card"));
22237
22498
  issues.push(...getPersistedV4ProtocolIssues(card, "draft.card"));
22238
- validateV4BindingContracts(card, analysis.occurrences, manifest.fields, "draft.card", issues);
22499
+ validateV4BindingContracts(card, analysis.occurrences, manifest.fields, "draft.card", issues, manifest.dataMode === "pipeline" ? manifest.dataModelSchema : void 0);
22239
22500
  }
22240
22501
  }
22241
22502
  return issues;
@@ -22277,17 +22538,17 @@ function validateV4Fixture(value, fields, path24, issues) {
22277
22538
  issues.push(...validateJsonSchemaValue2(field.valueSchema, resolved.value, `${path24}${field.path}`));
22278
22539
  }
22279
22540
  }
22280
- function validateV4BindingContracts(card, occurrences, fields, path24, issues) {
22541
+ function validateV4BindingContracts(card, occurrences, fields, path24, issues, dataModelSchema) {
22281
22542
  const ordered = fields.slice().sort((left, right) => right.path.length - left.path.length);
22282
22543
  for (const occurrence of occurrences) {
22283
22544
  const field = ordered.find((candidate) => occurrence.canonicalPath === candidate.path || occurrence.canonicalPath.startsWith(`${candidate.path}/*/`) || occurrence.canonicalPath.startsWith(`${candidate.path}/`));
22284
22545
  const issuePath = `${path24}.surfaces.${occurrence.surfaceId ?? "unknown"}.components.${occurrence.componentId}.${occurrence.propertyPath}`;
22285
- if (!field) {
22546
+ if (!field && !dataModelSchema) {
22286
22547
  issues.push(issue2(issuePath, "UNDECLARED_BINDING_PATH", `binding path ${occurrence.rawPath} is not declared by a manifest field`));
22287
22548
  continue;
22288
22549
  }
22289
- const suffix = occurrence.canonicalPath.slice(field.path.length).replace(/^\/\*\//u, "/");
22290
- const schema = suffix ? getJsonSchemaAtDataPointer(field.valueSchema, suffix) : field.valueSchema;
22550
+ const suffix = occurrence.canonicalPath.slice(field?.path.length ?? 0).replace(/^\/\*\//u, "/");
22551
+ const schema = dataModelSchema ? getJsonSchemaAtDataPointer(dataModelSchema, occurrence.canonicalPath) : field && (suffix ? getJsonSchemaAtDataPointer(field.valueSchema, suffix) : field.valueSchema);
22291
22552
  const component = findV4Component(card, occurrence.surfaceId, occurrence.componentId);
22292
22553
  const allowedTypes = expectedBindingTypes(occurrence, component);
22293
22554
  if (allowedTypes && (!schema || typeof schema.type !== "string" || !allowedTypes.has(schema.type))) {
@@ -22358,6 +22619,9 @@ function getA2UICardResourceConfigIssues(value) {
22358
22619
  ];
22359
22620
  }
22360
22621
  const issues = [];
22622
+ if (value.schemaVersion === "4" && value.dataMode === "pipeline") {
22623
+ return getA2UICardResourceConfigV4PipelineIssues(value);
22624
+ }
22361
22625
  if (value.schemaVersion === "3" || value.schemaVersion === "4") {
22362
22626
  return getA2UICardResourceConfigV3Issues(value);
22363
22627
  }
@@ -22392,6 +22656,50 @@ function getA2UICardResourceConfigIssues(value) {
22392
22656
  validateResolverCoverage(fields, resolver, issues, card);
22393
22657
  return issues;
22394
22658
  }
22659
+ function getA2UICardResourceConfigV4PipelineIssues(value) {
22660
+ const issues = [];
22661
+ exactKeys(value, [
22662
+ "schemaVersion",
22663
+ "dataMode",
22664
+ "revision",
22665
+ "displayName",
22666
+ "description",
22667
+ "whenToUse",
22668
+ "whenNotToUse",
22669
+ "presentationInputSchema",
22670
+ "fields",
22671
+ "dataSources",
22672
+ "dataTransform",
22673
+ "dataModelSchema",
22674
+ "a2uiTemplate"
22675
+ ], "config", issues);
22676
+ if (value.schemaVersion !== "4" || value.dataMode !== "pipeline") {
22677
+ issues.push(issue2("config.dataMode", "INVALID_DATA_MODE", "pipeline cards require schemaVersion 4 and dataMode pipeline"));
22678
+ }
22679
+ if (!isSafeIdentifier(value.revision)) {
22680
+ issues.push(issue2("config.revision", "INVALID_CARD_REVISION", "revision must be a stable safe identifier"));
22681
+ }
22682
+ requiredString(value.displayName, "config.displayName", issues);
22683
+ requiredString(value.description, "config.description", issues);
22684
+ requiredString(value.whenToUse, "config.whenToUse", issues);
22685
+ optionalString(value.whenNotToUse, "config.whenNotToUse", issues);
22686
+ validateLooseJsonSchema(value.presentationInputSchema, "config.presentationInputSchema", issues);
22687
+ const fields = validateFields(value.fields, "config.fields", issues);
22688
+ validatePipelineDataSources(value.dataSources, "config.dataSources", issues);
22689
+ validateDataTransform(value.dataTransform, "config.dataTransform", issues);
22690
+ const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, "config.dataModelSchema", issues);
22691
+ const card = validateTemplate(value.a2uiTemplate, fields, issues);
22692
+ if (card) {
22693
+ issues.push(...getA2UIV4ProtocolIssues(card, "config.a2uiTemplate.content"), ...getPersistedV4ProtocolIssues(card, "config.a2uiTemplate.content"));
22694
+ }
22695
+ if (fields && dataModelSchema) {
22696
+ validatePipelineFieldSchemas(fields, value.dataModelSchema, issues);
22697
+ }
22698
+ if (dataModelSchema && isPlainRecord(value.a2uiTemplate) && stableJsonStringify(value.a2uiTemplate.argsSchema) !== stableJsonStringify(value.dataModelSchema)) {
22699
+ issues.push(issue2("config.a2uiTemplate.argsSchema", "DATA_MODEL_SCHEMA_MISMATCH", "a2uiTemplate.argsSchema must equal dataModelSchema"));
22700
+ }
22701
+ return issues;
22702
+ }
22395
22703
  function getA2UICardResourceConfigV3Issues(value) {
22396
22704
  const issues = [];
22397
22705
  if (value.actionBindings !== void 0) {
@@ -22501,7 +22809,88 @@ function validateDataSources(value, path24, issues, options = {}) {
22501
22809
  if ([...byId.keys()].some(visit)) {
22502
22810
  issues.push(issue2(path24, "CYCLIC_SOURCE_DEPENDENCY", "data source dependencies must be acyclic"));
22503
22811
  }
22504
- return value;
22812
+ return value;
22813
+ }
22814
+ function validatePipelineDataSources(value, path24, issues) {
22815
+ if (!Array.isArray(value) || value.length === 0) {
22816
+ issues.push(issue2(path24, "INVALID_DATA_SOURCES", "pipeline dataSources must be a non-empty array"));
22817
+ return void 0;
22818
+ }
22819
+ const ids = /* @__PURE__ */ new Set();
22820
+ value.forEach((candidate, index) => {
22821
+ const itemPath = `${path24}[${index}]`;
22822
+ if (!isPlainRecord(candidate)) {
22823
+ issues.push(issue2(itemPath, "INVALID_DATA_SOURCE", "data source must be an object"));
22824
+ return;
22825
+ }
22826
+ exactKeys(candidate, [
22827
+ "sourceId",
22828
+ "mcpResourceId",
22829
+ "toolName",
22830
+ "purpose",
22831
+ "fixedInput",
22832
+ "inputBindings",
22833
+ "inputSchema",
22834
+ "outputSchema"
22835
+ ], itemPath, issues);
22836
+ if (!isSafeIdentifier(candidate.sourceId)) {
22837
+ issues.push(issue2(`${itemPath}.sourceId`, "INVALID_SOURCE_ID", "sourceId is invalid"));
22838
+ } else if (ids.has(candidate.sourceId)) {
22839
+ issues.push(issue2(`${itemPath}.sourceId`, "DUPLICATE_SOURCE_ID", `sourceId ${candidate.sourceId} is duplicated`));
22840
+ } else {
22841
+ ids.add(candidate.sourceId);
22842
+ }
22843
+ if (!isSafeIdentifier(candidate.mcpResourceId)) {
22844
+ issues.push(issue2(`${itemPath}.mcpResourceId`, "INVALID_MCP_RESOURCE_ID", "mcpResourceId is invalid"));
22845
+ }
22846
+ requiredString(candidate.toolName, `${itemPath}.toolName`, issues);
22847
+ requiredString(candidate.purpose, `${itemPath}.purpose`, issues);
22848
+ if (!isPlainRecord(candidate.fixedInput) || !isJsonValue(candidate.fixedInput)) {
22849
+ issues.push(issue2(`${itemPath}.fixedInput`, "INVALID_FIXED_INPUT", "fixedInput must be a JSON object"));
22850
+ }
22851
+ const inputBindings = validateInputBindings2(candidate.inputBindings, `${itemPath}.inputBindings`, issues);
22852
+ if (isPlainRecord(candidate.fixedInput) && inputBindings) {
22853
+ for (let bindingIndex = 0; bindingIndex < inputBindings.length; bindingIndex += 1) {
22854
+ const binding = inputBindings[bindingIndex];
22855
+ if (hasOverlappingJsonPointer(candidate.fixedInput, binding.inputPath)) {
22856
+ issues.push(issue2(`${itemPath}.inputBindings[${bindingIndex}].inputPath`, "FIXED_INPUT_OVERRIDE", `dynamic input ${binding.inputPath} overlaps a fixed input and cannot override it`));
22857
+ }
22858
+ }
22859
+ }
22860
+ validateLooseJsonSchema(candidate.inputSchema, `${itemPath}.inputSchema`, issues);
22861
+ validateLooseJsonSchema(candidate.outputSchema, `${itemPath}.outputSchema`, issues);
22862
+ });
22863
+ return value;
22864
+ }
22865
+ function validateDataTransform(value, path24, issues) {
22866
+ if (!isPlainRecord(value)) {
22867
+ issues.push(issue2(path24, "INVALID_DATA_TRANSFORM", "dataTransform must be an object"));
22868
+ return;
22869
+ }
22870
+ exactKeys(value, ["language", "profile", "source"], path24, issues);
22871
+ if (value.language !== A2UI_CARD_DATA_TRANSFORM_LANGUAGE) {
22872
+ issues.push(issue2(`${path24}.language`, "INVALID_DATA_TRANSFORM_LANGUAGE", `language must be ${A2UI_CARD_DATA_TRANSFORM_LANGUAGE}`));
22873
+ }
22874
+ if (value.profile !== A2UI_CARD_DATA_TRANSFORM_PROFILE) {
22875
+ issues.push(issue2(`${path24}.profile`, "INVALID_DATA_TRANSFORM_PROFILE", `profile must be ${A2UI_CARD_DATA_TRANSFORM_PROFILE}`));
22876
+ }
22877
+ if (typeof value.source !== "string" || value.source.trim().length === 0) {
22878
+ issues.push(issue2(`${path24}.source`, "INVALID_DATA_TRANSFORM_SOURCE", "source must be a non-empty string"));
22879
+ } else if (new TextEncoder().encode(value.source).byteLength > A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES) {
22880
+ issues.push(issue2(`${path24}.source`, "DATA_TRANSFORM_SOURCE_TOO_LARGE", `source exceeds ${A2UI_CARD_DATA_TRANSFORM_MAX_SOURCE_BYTES} bytes`));
22881
+ } else if (!/^\s*function\s+transform\s*\(\s*input\s*\)\s*\{/u.test(value.source)) {
22882
+ issues.push(issue2(`${path24}.source`, "INVALID_DATA_TRANSFORM_SOURCE", "source must declare function transform(input) { ... }"));
22883
+ }
22884
+ }
22885
+ function validatePipelineFieldSchemas(fields, dataModelSchema, issues) {
22886
+ fields.forEach((field, index) => {
22887
+ if (field.source !== "business")
22888
+ return;
22889
+ const schema = getJsonSchemaAtDataPointer(dataModelSchema, field.path);
22890
+ if (!schema) {
22891
+ issues.push(issue2(`config.fields[${index}].path`, "DATA_MODEL_FIELD_MISSING", `dataModelSchema does not define ${field.path}`));
22892
+ }
22893
+ });
22505
22894
  }
22506
22895
  function validateV3OutputBindings(value, path24, issues) {
22507
22896
  if (!Array.isArray(value)) {
@@ -22624,12 +23013,60 @@ function validateManifest(value, path24, issues) {
22624
23013
  issues.push(issue2(path24, "INVALID_MANIFEST", `${path24} must be an object`));
22625
23014
  return void 0;
22626
23015
  }
23016
+ if (value.schemaVersion === "4" && value.dataMode === "pipeline") {
23017
+ exactKeys(value, [
23018
+ "schemaVersion",
23019
+ "dataMode",
23020
+ "draftId",
23021
+ "resourceId",
23022
+ "baseRevision",
23023
+ "displayName",
23024
+ "description",
23025
+ "whenToUse",
23026
+ "whenNotToUse",
23027
+ "presentationInputSchema",
23028
+ "fields",
23029
+ "dataSources",
23030
+ "dataTransform",
23031
+ "dataModelSchema"
23032
+ ], path24, issues);
23033
+ if (!isSafeIdentifier(value.draftId)) {
23034
+ issues.push(issue2(`${path24}.draftId`, "INVALID_DRAFT_ID", "draftId is invalid"));
23035
+ }
23036
+ if (!isSafeIdentifier(value.resourceId)) {
23037
+ issues.push(issue2(`${path24}.resourceId`, "INVALID_RESOURCE_ID", "resourceId is invalid"));
23038
+ }
23039
+ optionalString(value.baseRevision, `${path24}.baseRevision`, issues);
23040
+ requiredString(value.displayName, `${path24}.displayName`, issues);
23041
+ requiredString(value.description, `${path24}.description`, issues);
23042
+ requiredString(value.whenToUse, `${path24}.whenToUse`, issues);
23043
+ optionalString(value.whenNotToUse, `${path24}.whenNotToUse`, issues);
23044
+ validateLooseJsonSchema(value.presentationInputSchema, `${path24}.presentationInputSchema`, issues);
23045
+ const fields2 = validateFields(value.fields, `${path24}.fields`, issues);
23046
+ validatePipelineDataSources(value.dataSources, `${path24}.dataSources`, issues);
23047
+ validateDataTransform(value.dataTransform, `${path24}.dataTransform`, issues);
23048
+ const dataModelSchema = validateLooseJsonSchema(value.dataModelSchema, `${path24}.dataModelSchema`, issues);
23049
+ if (fields2 && dataModelSchema) {
23050
+ fields2.forEach((field, index) => {
23051
+ if (field.source !== "business")
23052
+ return;
23053
+ if (!getJsonSchemaAtDataPointer(value.dataModelSchema, field.path)) {
23054
+ issues.push(issue2(`${path24}.fields[${index}].path`, "DATA_MODEL_FIELD_MISSING", `dataModelSchema does not define ${field.path}`));
23055
+ }
23056
+ });
23057
+ }
23058
+ return fields2 ? value : void 0;
23059
+ }
22627
23060
  if (value.schemaVersion === "3" || value.schemaVersion === "4") {
23061
+ if (value.dataMode !== void 0 && (value.schemaVersion !== "4" || value.dataMode !== "bindings")) {
23062
+ issues.push(issue2(`${path24}.dataMode`, "INVALID_DATA_MODE", "bindings dataMode is only available for schemaVersion 4"));
23063
+ }
22628
23064
  if (value.actionBindings !== void 0) {
22629
23065
  issues.push(issue2(`${path24}.actionBindings`, "LEGACY_PAYMENT_ACTION_BINDINGS_UNSUPPORTED", "payment actions must be defined inline in card JSON"));
22630
23066
  }
22631
23067
  exactKeys(value, [
22632
23068
  "schemaVersion",
23069
+ "dataMode",
22633
23070
  "draftId",
22634
23071
  "resourceId",
22635
23072
  "baseRevision",
@@ -22694,6 +23131,23 @@ function validateManifest(value, path24, issues) {
22694
23131
  }
22695
23132
  return schema && fields ? value : void 0;
22696
23133
  }
23134
+ function hasOverlappingJsonPointer(fixedInput, inputPath) {
23135
+ const fixedPaths = [];
23136
+ const visit = (value, path24) => {
23137
+ fixedPaths.push(path24);
23138
+ if (!isPlainRecord(value))
23139
+ return;
23140
+ for (const [key, child] of Object.entries(value)) {
23141
+ const escaped = key.replace(/~/gu, "~0").replace(/\//gu, "~1");
23142
+ visit(child, `${path24}/${escaped}`);
23143
+ }
23144
+ };
23145
+ for (const [key, value] of Object.entries(fixedInput)) {
23146
+ const escaped = key.replace(/~/gu, "~0").replace(/\//gu, "~1");
23147
+ visit(value, `/${escaped}`);
23148
+ }
23149
+ return fixedPaths.some((fixedPath) => fixedPath === inputPath || fixedPath.startsWith(`${inputPath}/`) || inputPath.startsWith(`${fixedPath}/`));
23150
+ }
22697
23151
  function validateFields(value, path24, issues) {
22698
23152
  if (!Array.isArray(value)) {
22699
23153
  issues.push(issue2(path24, "INVALID_FIELDS", `${path24} must be an array`));
@@ -22738,13 +23192,13 @@ function validateFields(value, path24, issues) {
22738
23192
  paths.add(canonicalPath);
22739
23193
  }
22740
23194
  requiredString(candidate.label, `${itemPath}.label`, issues);
22741
- if (!FIELD_TYPES.includes(candidate.type)) {
23195
+ if (!FIELD_TYPES.has(candidate.type)) {
22742
23196
  issues.push(issue2(`${itemPath}.type`, "INVALID_FIELD_TYPE", "field type is invalid"));
22743
23197
  }
22744
23198
  if (typeof candidate.required !== "boolean") {
22745
23199
  issues.push(issue2(`${itemPath}.required`, "INVALID_FIELD_REQUIRED", "required must be a boolean"));
22746
23200
  }
22747
- if (!FIELD_SOURCES.includes(candidate.source)) {
23201
+ if (!FIELD_SOURCES.has(candidate.source)) {
22748
23202
  issues.push(issue2(`${itemPath}.source`, "INVALID_FIELD_SOURCE", "field source is invalid"));
22749
23203
  }
22750
23204
  const schemaIssues = getJsonSchemaIssues(candidate.valueSchema, `${itemPath}.valueSchema`, { requireCompleteStructures: true });
@@ -23089,6 +23543,9 @@ function compileA2UICardResource(input) {
23089
23543
  throw new A2UICardCompileError("CARD_REVISION_INVALID", "CARD revision must be a stable safe identifier");
23090
23544
  }
23091
23545
  const draft = draftResult.data;
23546
+ if (draft.manifest.schemaVersion === "4" && draft.manifest.dataMode === "pipeline") {
23547
+ return compilePipelineResource(draft, input.revision);
23548
+ }
23092
23549
  if (draft.manifest.schemaVersion === "3" || draft.manifest.schemaVersion === "4") {
23093
23550
  return compileModernResource(draft, input.revision, input.bindings, input.tools ?? []);
23094
23551
  }
@@ -23139,6 +23596,31 @@ function compileA2UICardResource(input) {
23139
23596
  }
23140
23597
  return parsed.data;
23141
23598
  }
23599
+ function compilePipelineResource(draft, revision) {
23600
+ const resource = {
23601
+ schemaVersion: "4",
23602
+ dataMode: "pipeline",
23603
+ revision,
23604
+ displayName: draft.manifest.displayName,
23605
+ description: draft.manifest.description,
23606
+ whenToUse: draft.manifest.whenToUse,
23607
+ ...draft.manifest.whenNotToUse ? { whenNotToUse: draft.manifest.whenNotToUse } : {},
23608
+ presentationInputSchema: draft.manifest.presentationInputSchema,
23609
+ fields: draft.manifest.fields,
23610
+ dataSources: draft.manifest.dataSources,
23611
+ dataTransform: draft.manifest.dataTransform,
23612
+ dataModelSchema: draft.manifest.dataModelSchema,
23613
+ a2uiTemplate: {
23614
+ argsSchema: draft.manifest.dataModelSchema,
23615
+ content: stableJsonStringify(draft.card)
23616
+ }
23617
+ };
23618
+ const parsed = parseA2UICardResourceConfig(resource);
23619
+ if (!parsed.success) {
23620
+ throw new A2UICardCompileError("CARD_RESOURCE_INVALID", parsed.issues.map((entry) => `${entry.path}: ${entry.message}`).join("; "));
23621
+ }
23622
+ return parsed.data;
23623
+ }
23142
23624
  function compileLegacyDraftAsV3(draft, revision, bindings, tools, targetSchemaVersion = "3") {
23143
23625
  if (draft.manifest.schemaVersion !== "2") {
23144
23626
  throw new A2UICardCompileError("DRAFT_INVALID", "Expected a schema v2 draft for migration");
@@ -23429,9 +23911,9 @@ function sha256Hex(value) {
23429
23911
  b3 = a;
23430
23912
  a = add(temporary1, temporary2);
23431
23913
  }
23432
- state = state.map((value2, index) => add(value2, [a, b3, c, d, e3, f3, g2, h][index]));
23914
+ state = state.map((v2, index) => add(v2, [a, b3, c, d, e3, f3, g2, h][index]));
23433
23915
  }
23434
- return state.map((value2) => (value2 >>> 0).toString(16).padStart(8, "0")).join("");
23916
+ return state.map((v2) => (v2 >>> 0).toString(16).padStart(8, "0")).join("");
23435
23917
  }
23436
23918
  function createA2UICardDraftStructureChecksum(draft) {
23437
23919
  const cloned = JSON.parse(JSON.stringify(draft));
@@ -23516,9 +23998,6 @@ var SHA256_CONSTANTS = [
23516
23998
  3329325298
23517
23999
  ];
23518
24000
 
23519
- // ../agent-a2ui-card-contract/dist/esm/payment-action.js
23520
- var A2UI_PAYMENT_ACTION_NAME = "payment.trade-pay";
23521
-
23522
24001
  // ../agent-a2ui-card-contract/dist/esm/authoring-model.js
23523
24002
  var INTERNAL_KEYS = /* @__PURE__ */ new Set([
23524
24003
  "__proto__",
@@ -23557,6 +24036,27 @@ function extractA2UICardAuthoringModel(bundle, options = {}) {
23557
24036
  binding
23558
24037
  ]));
23559
24038
  const fields = bundle.manifest.fields.filter((field) => field.source === "business");
24039
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline") {
24040
+ for (const [key, schema] of Object.entries(bundle.manifest.dataModelSchema.properties ?? {})) {
24041
+ const path24 = `/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`;
24042
+ if (!isPlainRecord(schema) || fields.some((field) => field.path === path24))
24043
+ continue;
24044
+ if (!["string", "number", "integer", "boolean", "object", "array"].includes(String(schema.type)))
24045
+ continue;
24046
+ let idIndex = fields.length;
24047
+ while (fields.some((field) => field.fieldId === `pipeline-field-${idIndex}`))
24048
+ idIndex += 1;
24049
+ fields.push({
24050
+ fieldId: `pipeline-field-${idIndex}`,
24051
+ path: path24,
24052
+ label: key,
24053
+ type: schema.type,
24054
+ source: "business",
24055
+ required: Array.isArray(bundle.manifest.dataModelSchema.required) && bundle.manifest.dataModelSchema.required.includes(key),
24056
+ valueSchema: schema
24057
+ });
24058
+ }
24059
+ }
23560
24060
  const registered = options.registeredComponents ? new Set(options.registeredComponents) : void 0;
23561
24061
  const occurrencesByComponent = groupBindingOccurrences(analysis.occurrences);
23562
24062
  const allFieldOccurrenceTargets = [];
@@ -23596,12 +24096,13 @@ function extractA2UICardAuthoringModel(bundle, options = {}) {
23596
24096
  const fieldStates = fields.map((field) => {
23597
24097
  const occurrences = allFieldOccurrenceTargets.filter((target) => target.fieldId === field.fieldId);
23598
24098
  const binding = bindingByField.get(field.fieldId);
24099
+ const pipelineBound = bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline" && getJsonSchemaAtDataPointer(bundle.manifest.dataModelSchema, field.path) !== void 0;
23599
24100
  return {
23600
24101
  field,
23601
24102
  ...binding ? { binding: cloneBinding(binding) } : {},
23602
24103
  occurrences,
23603
24104
  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"
24105
+ status: occurrences.length === 0 ? "unused" : binding || pipelineBound ? "bound" : field.required ? "unbound-required" : "unbound-optional"
23605
24106
  };
23606
24107
  });
23607
24108
  const diagnostics = getA2UICardAuthoringDiagnostics(bundle, {
@@ -23668,11 +24169,7 @@ function getA2UICardAuthoringDiagnostics(bundle, partial2) {
23668
24169
  occurrenceId: group.occurrenceId
23669
24170
  });
23670
24171
  }
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)) {
24172
+ } else if (client && typeof client.name === "string" && !["ui.overlay.close", "ui.surface.open"].includes(client.name)) {
23676
24173
  diagnostics.push({
23677
24174
  code: "UNREGISTERED_CLIENT_ACTION",
23678
24175
  path: `${group.occurrenceId}.action.client.name`,
@@ -23816,21 +24313,6 @@ function actionTargets(component, occurrenceId) {
23816
24313
  }
23817
24314
  ];
23818
24315
  }
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
24316
  return [agentOnlyAction(occurrenceId, "\u8BE5\u884C\u4E3A\u53EA\u80FD\u901A\u8FC7 Coding Agent \u4FEE\u6539")];
23835
24317
  }
23836
24318
  function fieldTargets(component, occurrenceId, fields, occurrences, projectedOnly) {
@@ -23853,6 +24335,9 @@ function fieldTargets(component, occurrenceId, fields, occurrences, projectedOnl
23853
24335
  propertyPath: occurrence.propertyPath,
23854
24336
  label: fieldOccurrenceLabel(targetPath, occurrence.propertyPath),
23855
24337
  fieldId: field.fieldId,
24338
+ dataPath: occurrence.rawPath,
24339
+ ...occurrence.listRoot ? { listRoot: occurrence.listRoot } : {},
24340
+ valueType: occurrence.usage === "list" ? "array" : getJsonSchemaAtDataPointer(field.valueSchema, occurrence.canonicalPath.slice(field.path.length) || "/")?.type,
23856
24341
  ...targetPath ? { targetPath } : {}
23857
24342
  }
23858
24343
  ];
@@ -23942,6 +24427,22 @@ function cloneBinding(binding) {
23942
24427
  var CONTENT_VALUE_MAX_LENGTH = 16 * 1024;
23943
24428
  var ETelemetryAttribute;
23944
24429
  (function(ETelemetryAttribute2) {
24430
+ ETelemetryAttribute2["LINKQUE_REMOTE_TRACE_ID"] = "linkque.remote.trace_id";
24431
+ ETelemetryAttribute2["LINKQUE_REMOTE_TRACE_ID_HEADER"] = "linkque.remote.trace_id_header";
24432
+ ETelemetryAttribute2["HTTP_REQUEST_METHOD"] = "http.request.method";
24433
+ ETelemetryAttribute2["SERVER_ADDRESS"] = "server.address";
24434
+ ETelemetryAttribute2["URL_PATH"] = "url.path";
24435
+ ETelemetryAttribute2["LINKQUE_MCP_PHASE"] = "linkque.mcp.phase";
24436
+ ETelemetryAttribute2["LINKQUE_MCP_SERVER_NAME"] = "linkque.mcp.server_name";
24437
+ ETelemetryAttribute2["LINKQUE_IO_ATTEMPT"] = "linkque.io.attempt";
24438
+ ETelemetryAttribute2["LINKQUE_SKILL_RESOURCE_ID"] = "linkque.skill.resource_id";
24439
+ ETelemetryAttribute2["LINKQUE_SKILL_REQUESTED_COUNT"] = "linkque.skill.requested_count";
24440
+ ETelemetryAttribute2["LINKQUE_SKILL_RESOLVED_COUNT"] = "linkque.skill.resolved_count";
24441
+ ETelemetryAttribute2["LINKQUE_SKILL_LOADED_COUNT"] = "linkque.skill.loaded_count";
24442
+ ETelemetryAttribute2["LINKQUE_SKILL_SKIPPED_COUNT"] = "linkque.skill.skipped_count";
24443
+ ETelemetryAttribute2["LINKQUE_CHUNK_INDEX"] = "linkque.chunk.index";
24444
+ ETelemetryAttribute2["LINKQUE_CHUNK_STATUS"] = "linkque.chunk.status";
24445
+ ETelemetryAttribute2["LINKQUE_CHUNK_LINE_COUNT"] = "linkque.chunk.line_count";
23945
24446
  ETelemetryAttribute2["HARNESS_TELEMETRY_SCHEMA_VERSION"] = "harness.telemetry.schema.version";
23946
24447
  ETelemetryAttribute2["LINKQUE_TELEMETRY_SCHEMA_VERSION"] = "linkque.telemetry.schema.version";
23947
24448
  ETelemetryAttribute2["LINKQUE_TELEMETRY_ADAPTER_VERSION"] = "linkque.telemetry.adapter.version";
@@ -23974,6 +24475,8 @@ var ETelemetryAttribute;
23974
24475
  ETelemetryAttribute2["HARNESS_RECORD_ID"] = "harness.record.id";
23975
24476
  ETelemetryAttribute2["HARNESS_EVENT_SEQUENCE"] = "harness.event.sequence";
23976
24477
  ETelemetryAttribute2["ERROR_TYPE"] = "error.type";
24478
+ ETelemetryAttribute2["LINKQUE_APPBASE_RUN_FAILURE_STAGE"] = "linkque.appbase.run.failure_stage";
24479
+ ETelemetryAttribute2["LINKQUE_APPBASE_RUN_ERROR_MESSAGE"] = "linkque.appbase.run.error_message";
23977
24480
  ETelemetryAttribute2["LINKQUE_STREAM_TERMINATION"] = "linkque.stream.termination";
23978
24481
  ETelemetryAttribute2["LINKQUE_STREAM_CANCEL_SOURCE"] = "linkque.stream.cancel_source";
23979
24482
  ETelemetryAttribute2["LINKQUE_TERMINAL_EVIDENCE"] = "linkque.terminal.evidence";
@@ -24136,6 +24639,18 @@ var ETelemetryContentSection;
24136
24639
  })(ETelemetryContentSection || (ETelemetryContentSection = {}));
24137
24640
  var ETelemetryOperationName;
24138
24641
  (function(ETelemetryOperationName2) {
24642
+ ETelemetryOperationName2["APPBASE_RUN"] = "linkque.appbase.run";
24643
+ ETelemetryOperationName2["RUNS_WRITE"] = "linkque.appbase.runs.write";
24644
+ ETelemetryOperationName2["MCP_DISCOVER"] = "linkque.mcp.discover";
24645
+ ETelemetryOperationName2["MCP_SIGN"] = "linkque.mcp.sign";
24646
+ ETelemetryOperationName2["MCP_OPENGW"] = "linkque.mcp.opengw";
24647
+ ETelemetryOperationName2["MCP_VERIFY"] = "linkque.mcp.verify";
24648
+ ETelemetryOperationName2["KNOWLEDGE_SEARCH"] = "linkque.knowledge.search";
24649
+ ETelemetryOperationName2["WEB_SEARCH"] = "linkque.web_search.search";
24650
+ ETelemetryOperationName2["SKILL_LOAD"] = "linkque.skill.load";
24651
+ ETelemetryOperationName2["SKILL_QUERY"] = "linkque.skill.query";
24652
+ ETelemetryOperationName2["SKILL_RESOURCE_LOAD"] = "linkque.skill.resource.load";
24653
+ ETelemetryOperationName2["SKILL_DOWNLOAD"] = "linkque.skill.download";
24139
24654
  ETelemetryOperationName2["OPERATION"] = "linkque.operation";
24140
24655
  ETelemetryOperationName2["TOOL_INVOKE"] = "harness.tool.invoke";
24141
24656
  ETelemetryOperationName2["ADVANCE"] = "harness.advance";
@@ -24281,6 +24796,9 @@ var ETelemetryModelPurpose;
24281
24796
  })(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
24282
24797
  var ETelemetryErrorType;
24283
24798
  (function(ETelemetryErrorType2) {
24799
+ ETelemetryErrorType2["IO_ERROR"] = "io_error";
24800
+ ETelemetryErrorType2["IO_CANCELLED"] = "io_cancelled";
24801
+ ETelemetryErrorType2["IO_TIMEOUT"] = "io_timeout";
24284
24802
  ETelemetryErrorType2["PROVIDER_STREAM_ERROR"] = "ProviderStreamError";
24285
24803
  ETelemetryErrorType2["TOOL_EXECUTION_ERROR"] = "ToolExecutionError";
24286
24804
  ETelemetryErrorType2["HOOK_DISPATCH_ERROR"] = "HookDispatchError";
@@ -24291,6 +24809,16 @@ var ETelemetrySpanKind;
24291
24809
  ETelemetrySpanKind2["INTERNAL"] = "internal";
24292
24810
  ETelemetrySpanKind2["CLIENT"] = "client";
24293
24811
  })(ETelemetrySpanKind || (ETelemetrySpanKind = {}));
24812
+ var ETelemetryMcpPhase;
24813
+ (function(ETelemetryMcpPhase2) {
24814
+ ETelemetryMcpPhase2["SSE_CONNECT"] = "sse_connect";
24815
+ ETelemetryMcpPhase2["INITIALIZE"] = "initialize";
24816
+ ETelemetryMcpPhase2["TOOLS_LIST"] = "tools/list";
24817
+ ETelemetryMcpPhase2["TOOLS_CALL"] = "tools/call";
24818
+ ETelemetryMcpPhase2["INITIALIZED"] = "notifications/initialized";
24819
+ ETelemetryMcpPhase2["CANCELLED"] = "notifications/cancelled";
24820
+ ETelemetryMcpPhase2["HTTP"] = "http";
24821
+ })(ETelemetryMcpPhase || (ETelemetryMcpPhase = {}));
24294
24822
  var ETelemetryGenAiOperation;
24295
24823
  (function(ETelemetryGenAiOperation2) {
24296
24824
  ETelemetryGenAiOperation2["CHAT"] = "chat";
@@ -24357,6 +24885,7 @@ var LINKQUE_ENDPOINT_PROD = "https://linkquegw.alipay.com";
24357
24885
  var RUNTIME_CONFIG_DEFAULTS = Object.freeze({
24358
24886
  LINKQUE_BASE_URL: `${LINKQUE_ENDPOINT_PROD}/api/anthropic`,
24359
24887
  LINKQUEGW_KNOWLEDGE_BASE_URL: LINKQUE_ENDPOINT_PROD,
24888
+ LINKQUEGW_SKILL_LOADER_BASE_URL: LINKQUE_ENDPOINT_PROD,
24360
24889
  LINKQUEGW_WEB_SEARCH_BASE_URL: LINKQUE_ENDPOINT_PROD,
24361
24890
  LINKQUEGW_EVENT_BASE_URL: LINKQUE_ENDPOINT_PROD,
24362
24891
  LINKQUEGW_MCP_SIGN_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/mcp/signature`,
@@ -34621,6 +35150,22 @@ var CONVERSATION_CUSTOM_EVENT_NAMES = Object.freeze({
34621
35150
 
34622
35151
  // ../linkque-agent-runtime/dist/esm/impl/telemetry/attributes.js
34623
35152
  var allowedAttributeKeys = /* @__PURE__ */ new Set([
35153
+ ETelemetryAttribute.LINKQUE_REMOTE_TRACE_ID,
35154
+ ETelemetryAttribute.LINKQUE_REMOTE_TRACE_ID_HEADER,
35155
+ ETelemetryAttribute.HTTP_REQUEST_METHOD,
35156
+ ETelemetryAttribute.SERVER_ADDRESS,
35157
+ ETelemetryAttribute.URL_PATH,
35158
+ ETelemetryAttribute.LINKQUE_MCP_PHASE,
35159
+ ETelemetryAttribute.LINKQUE_MCP_SERVER_NAME,
35160
+ ETelemetryAttribute.LINKQUE_IO_ATTEMPT,
35161
+ ETelemetryAttribute.LINKQUE_SKILL_RESOURCE_ID,
35162
+ ETelemetryAttribute.LINKQUE_SKILL_REQUESTED_COUNT,
35163
+ ETelemetryAttribute.LINKQUE_SKILL_LOADED_COUNT,
35164
+ ETelemetryAttribute.LINKQUE_SKILL_RESOLVED_COUNT,
35165
+ ETelemetryAttribute.LINKQUE_SKILL_SKIPPED_COUNT,
35166
+ ETelemetryAttribute.LINKQUE_CHUNK_INDEX,
35167
+ ETelemetryAttribute.LINKQUE_CHUNK_STATUS,
35168
+ ETelemetryAttribute.LINKQUE_CHUNK_LINE_COUNT,
34624
35169
  ETelemetryAttribute.HARNESS_TELEMETRY_SCHEMA_VERSION,
34625
35170
  ETelemetryAttribute.LINKQUE_TELEMETRY_SCHEMA_VERSION,
34626
35171
  ETelemetryAttribute.LINKQUE_TELEMETRY_ADAPTER_VERSION,
@@ -34642,6 +35187,8 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
34642
35187
  ETelemetryAttribute.HARNESS_INVOCATION_ID,
34643
35188
  ETelemetryAttribute.HARNESS_ATTEMPT_ID,
34644
35189
  ETelemetryAttribute.HARNESS_ATTEMPT_VISIBILITY,
35190
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_FAILURE_STAGE,
35191
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_ERROR_MESSAGE,
34645
35192
  ETelemetryAttribute.HARNESS_ADVANCE_OUTCOME,
34646
35193
  ETelemetryAttribute.HARNESS_OPERATION_OUTCOME,
34647
35194
  ETelemetryAttribute.HARNESS_REMOTE_COMPLETION,
@@ -34719,6 +35266,7 @@ var allowedAttributeKeys = /* @__PURE__ */ new Set([
34719
35266
  ETelemetryAttribute.HTTP_RESPONSE_STATUS_CODE
34720
35267
  ]);
34721
35268
  var priorityAttributeKeys = /* @__PURE__ */ new Set([
35269
+ ETelemetryAttribute.ERROR_TYPE,
34722
35270
  ETelemetryAttribute.HARNESS_RECORD_ID,
34723
35271
  ETelemetryAttribute.HARNESS_EVENT_SEQUENCE,
34724
35272
  ETelemetryAttribute.HARNESS_ADVANCE_ID,
@@ -34728,6 +35276,8 @@ var priorityAttributeKeys = /* @__PURE__ */ new Set([
34728
35276
  ETelemetryAttribute.LINKQUE_OPERATION_NAME,
34729
35277
  ETelemetryAttribute.LINKQUE_OPERATION_DURATION_MS,
34730
35278
  ETelemetryAttribute.HARNESS_OPERATION_OUTCOME,
35279
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_FAILURE_STAGE,
35280
+ ETelemetryAttribute.LINKQUE_APPBASE_RUN_ERROR_MESSAGE,
34731
35281
  ETelemetryAttribute.HARNESS_ADVANCE_OUTCOME,
34732
35282
  ETelemetryAttribute.HARNESS_CALL_ID,
34733
35283
  ETelemetryAttribute.HARNESS_INVOCATION_ID,
@@ -34750,6 +35300,7 @@ var APPBASE_RUNTIME_CONFIG_DEFAULTS = Object.freeze({
34750
35300
  AGENT_CONFIG_URL_PRE: `${LINKQUE_ENDPOINT_PRE}/api/agent/config`,
34751
35301
  LINKQUE_BASE_URL_PRE: `${LINKQUE_ENDPOINT_PRE}/api/anthropic`,
34752
35302
  LINKQUEGW_KNOWLEDGE_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
35303
+ LINKQUEGW_SKILL_LOADER_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
34753
35304
  LINKQUEGW_WEB_SEARCH_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
34754
35305
  LINKQUEGW_EVENT_BASE_URL_PRE: LINKQUE_ENDPOINT_PRE,
34755
35306
  LINKQUEGW_TELEMETRY_LOGS_ENDPOINT: `${LINKQUE_ENDPOINT_PROD}/api/telemetry/v1/logs`,
@@ -35939,7 +36490,7 @@ var resolveDeployCredentials = (env = process.env) => {
35939
36490
  // src/commands/agentdeploy/gwDeployer.ts
35940
36491
  var import_node_fs8 = require("node:fs");
35941
36492
  var import_node_os = require("node:os");
35942
- var import_node_path11 = require("node:path");
36493
+ var import_node_path12 = require("node:path");
35943
36494
  var UPLOAD_PATH = "/api/appbase/deployBundle/upload";
35944
36495
  var BUNDLE_CONFIG_NAME2 = "appwrite.config.json";
35945
36496
  var HDR_PROJECT_ID = "x-linkque-project-id";
@@ -35960,7 +36511,7 @@ async function deployViaGw(config3) {
35960
36511
  log(
35961
36512
  `\u90E8\u7F72\u5230 gw: ${gwBaseUrl}${UPLOAD_PATH} projectId=${projectId} functions=[${inScope.map((f3) => f3.$id).join(",")}]`
35962
36513
  );
35963
- const staging = (0, import_node_fs8.mkdtempSync)((0, import_node_path11.join)((0, import_node_os.tmpdir)(), "linkquejs-gw-deploy-"));
36514
+ const staging = (0, import_node_fs8.mkdtempSync)((0, import_node_path12.join)((0, import_node_os.tmpdir)(), "linkquejs-gw-deploy-"));
35964
36515
  try {
35965
36516
  const configPayload = {
35966
36517
  ...config3.config,
@@ -35971,14 +36522,14 @@ async function deployViaGw(config3) {
35971
36522
  functions: inScope
35972
36523
  };
35973
36524
  (0, import_node_fs8.writeFileSync)(
35974
- (0, import_node_path11.join)(staging, BUNDLE_CONFIG_NAME2),
36525
+ (0, import_node_path12.join)(staging, BUNDLE_CONFIG_NAME2),
35975
36526
  `${JSON.stringify(configPayload, null, 2)}
35976
36527
  `,
35977
36528
  "utf8"
35978
36529
  );
35979
36530
  const archiveEntries = [BUNDLE_CONFIG_NAME2];
35980
36531
  for (const fn of inScope) {
35981
- const subArchive = (0, import_node_path11.join)(bundlePath, `${fn.$id}.tar.gz`);
36532
+ const subArchive = (0, import_node_path12.join)(bundlePath, `${fn.$id}.tar.gz`);
35982
36533
  if (!(0, import_node_fs8.existsSync)(subArchive)) {
35983
36534
  throw new LinkqueCliError(
35984
36535
  "AGENTDEPLOY_BUNDLE_NOT_FOUND",
@@ -35986,7 +36537,7 @@ async function deployViaGw(config3) {
35986
36537
  );
35987
36538
  }
35988
36539
  const destName = `${fn.$id}.tar.gz`;
35989
- (0, import_node_fs8.copyFileSync)(subArchive, (0, import_node_path11.join)(staging, destName));
36540
+ (0, import_node_fs8.copyFileSync)(subArchive, (0, import_node_path12.join)(staging, destName));
35990
36541
  archiveEntries.push(destName);
35991
36542
  }
35992
36543
  const uploadUrl = `${gwBaseUrl.replace(/\/+$/, "")}${UPLOAD_PATH}`;
@@ -36247,7 +36798,6 @@ var AGENT_LOG = ".linkque/logs/agent.log";
36247
36798
  var HEALTH_PATH = "/healthz";
36248
36799
  var RUNS_PATH = "/runs";
36249
36800
  var HOME_DATA_PATH = "/home-data";
36250
- var A2UI_ACTION_PATH = "/a2ui-action";
36251
36801
  var FUNCTION_ACTION_MCP_PATH = "/function-actions/mcp";
36252
36802
  var AGENT_RUNTIME_PROTOCOL = "conversation-runs-v2";
36253
36803
  var API_KEY_ENV = "LINKQUE_AGENT_API_KEY";
@@ -36516,7 +37066,6 @@ var spawnAgentOwner = (cwd, config3, port, apiKey, statePath) => {
36516
37066
  cwd,
36517
37067
  healthPath: HEALTH_PATH,
36518
37068
  homeDataPath: HOME_DATA_PATH,
36519
- a2uiActionPath: A2UI_ACTION_PATH,
36520
37069
  functionActionMcpPath: FUNCTION_ACTION_MCP_PATH,
36521
37070
  logPath: import_path15.default.join(cwd, AGENT_LOG),
36522
37071
  port,
@@ -37080,29 +37629,29 @@ t.fill(8, 0, 144), t.fill(9, 144, 256), t.fill(7, 256, 280), t.fill(8, 280, 288)
37080
37629
  var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
37081
37630
  var e = (t3) => t3({ workerURI: (t4) => {
37082
37631
  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 });
37632
+ 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';
37633
+ if ("string" == typeof s4 && (s4 = new TextEncoder().encode(s4)), t4) {
37634
+ const t5 = new Blob([s4], { type: e3 });
37086
37635
  return URL.createObjectURL(t5);
37087
37636
  }
37088
37637
  return "data:" + e3 + ";base64," + function(t5) {
37089
37638
  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] + "=";
37639
+ const s5 = t5.length;
37640
+ let r2 = 0;
37641
+ for (; r2 + 2 < s5; r2 += 3) {
37642
+ const s6 = t5[r2] << 16 | t5[r2 + 1] << 8 | t5[r2 + 2];
37643
+ e4 += n[s6 >> 18 & 63] + n[s6 >> 12 & 63] + n[s6 >> 6 & 63] + n[63 & s6];
37644
+ }
37645
+ const o2 = s5 - r2;
37646
+ if (1 === o2) {
37647
+ const s6 = t5[r2] << 16;
37648
+ e4 += n[s6 >> 18 & 63] + n[s6 >> 12 & 63] + "==";
37649
+ } else if (2 === o2) {
37650
+ const s6 = t5[r2] << 16 | t5[r2 + 1] << 8;
37651
+ e4 += n[s6 >> 18 & 63] + n[s6 >> 12 & 63] + n[s6 >> 6 & 63] + "=";
37103
37652
  }
37104
37653
  return e4;
37105
- }(r2);
37654
+ }(s4);
37106
37655
  } });
37107
37656
 
37108
37657
  // ../../node_modules/@zip.js/zip.js/lib/zip-core-base.js
@@ -37117,7 +37666,6 @@ init_codec_worker();
37117
37666
  var MODULE_WORKER_OPTIONS = { type: "module" };
37118
37667
  var ERROR_EVENT_TYPE = "error";
37119
37668
  var MESSAGE_ERROR_EVENT_TYPE = "messageerror";
37120
- var ABORT_EVENT_TYPE = "abort";
37121
37669
  var webWorkerSource;
37122
37670
  var webWorkerURI;
37123
37671
  var webWorkerOptions;
@@ -37282,13 +37830,6 @@ function watchClosedStream(writableSource, workerData) {
37282
37830
  Object.assign(workerData, { destinationFailed: true, destinationError: error2 });
37283
37831
  }
37284
37832
  });
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
37833
  return {
37293
37834
  writable,
37294
37835
  closed,
@@ -37537,6 +38078,9 @@ function getResponseError(errorData, errorValue) {
37537
38078
  responseError = errorValue.value;
37538
38079
  } else {
37539
38080
  responseError = Object.assign(new Error(message), { stack, code, name });
38081
+ if (cause) {
38082
+ responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
38083
+ }
37540
38084
  }
37541
38085
  if (isErrorObject(responseError)) {
37542
38086
  try {
@@ -37546,9 +38090,6 @@ function getResponseError(errorData, errorValue) {
37546
38090
  if (codecImportFailed) {
37547
38091
  responseError.codecImportFailed = true;
37548
38092
  }
37549
- if (cause && !isErrorObject(responseError.cause)) {
37550
- responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
37551
- }
37552
38093
  if (errorValue) {
37553
38094
  if (responseError.name !== name) {
37554
38095
  responseError.name = name;
@@ -38223,11 +38764,9 @@ function resolveMetadata(zipWriter, name, options) {
38223
38764
  const passThrough = checkPassThroughOption(getOptionValue2(zipWriter, options, OPTION_PASS_THROUGH));
38224
38765
  const passThroughCompression = Boolean(passThrough);
38225
38766
  const passThroughEncryption = passThrough === true;
38226
- let password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38227
- let rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38767
+ const password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38768
+ const rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38228
38769
  checkPasswordOption(password, rawPassword);
38229
- password = password && password.length ? password : UNDEFINED_VALUE;
38230
- rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
38231
38770
  const encryptionStrength = getNumberOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
38232
38771
  const zipCrypto = getOptionValue2(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
38233
38772
  const extendedTimestamp = getOptionValue2(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
@@ -38738,7 +39277,6 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
38738
39277
  const result = await runWorker2({ readable, writable }, workerOptions);
38739
39278
  compressedSize = result.outputSize;
38740
39279
  writer.size += compressedSize;
38741
- throwIfAborted(signal);
38742
39280
  if (!passThroughCompression) {
38743
39281
  uncompressedSize = result.inputSize;
38744
39282
  if (!encrypted || zipCrypto) {
@@ -39904,10 +40442,6 @@ var FORMAT_DEFLATE = "deflate";
39904
40442
  var FORMAT_DEFLATE_RAW2 = "deflate-raw";
39905
40443
  var FORMAT_DEFLATE64_RAW2 = "deflate64-raw";
39906
40444
  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
40445
  var wasm;
39912
40446
  var malloc;
39913
40447
  var free;
@@ -39924,16 +40458,7 @@ function setWasmExports(wasmAPI) {
39924
40458
  function setInitError(error2) {
39925
40459
  initError = error2;
39926
40460
  }
39927
- function setZlibCode(error2, result) {
39928
- if (result === Z_MEM_ERROR) {
39929
- error2.code = Z_MEM_ERROR_CODE2;
39930
- }
39931
- return error2;
39932
- }
39933
40461
  function _make(isCompress, type, options = {}) {
39934
- if (!(isCompress ? COMPRESSION_FORMATS : DECOMPRESSION_FORMATS).includes(type)) {
39935
- throw new TypeError("Unsupported format: " + type);
39936
- }
39937
40462
  if (!wasm) {
39938
40463
  const error2 = new Error("WASM module not loaded");
39939
40464
  error2.cause = initError;
@@ -39942,208 +40467,147 @@ function _make(isCompress, type, options = {}) {
39942
40467
  const level = typeof options.level === "number" ? options.level : -1;
39943
40468
  const outBufferSize = typeof options.outBuffer === "number" ? options.outBuffer : 64 * 1024;
39944
40469
  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
- }
40470
+ return new TransformStream({
40471
+ start() {
39977
40472
  try {
39978
- processChunk(chunk);
40473
+ let result;
40474
+ this.out = malloc(outBufferSize);
40475
+ this.in = malloc(inBufferSize);
40476
+ this.inBufferSize = inBufferSize;
40477
+ if (!this.out || !this.in) {
40478
+ throw new Error("allocation failed");
40479
+ }
40480
+ if (isCompress) {
40481
+ this._process = wasm.deflate_process;
40482
+ this._last_consumed = wasm.deflate_last_consumed;
40483
+ this._end = wasm.deflate_end;
40484
+ this.streamHandle = wasm.deflate_new();
40485
+ if (type === FORMAT_GZIP2) {
40486
+ result = wasm.deflate_init_gzip(this.streamHandle, level);
40487
+ } else if (type === FORMAT_DEFLATE_RAW2) {
40488
+ result = wasm.deflate_init_raw(this.streamHandle, level);
40489
+ } else {
40490
+ result = wasm.deflate_init(this.streamHandle, level);
40491
+ }
40492
+ } else {
40493
+ if (type === FORMAT_DEFLATE64_RAW2) {
40494
+ this._process = wasm.inflate9_process;
40495
+ this._last_consumed = wasm.inflate9_last_consumed;
40496
+ this._end = wasm.inflate9_end;
40497
+ this.streamHandle = wasm.inflate9_new();
40498
+ result = wasm.inflate9_init_raw(this.streamHandle);
40499
+ } else {
40500
+ this._process = wasm.inflate_process;
40501
+ this._last_consumed = wasm.inflate_last_consumed;
40502
+ this._end = wasm.inflate_end;
40503
+ this.streamHandle = wasm.inflate_new();
40504
+ if (type === FORMAT_DEFLATE_RAW2) {
40505
+ result = wasm.inflate_init_raw(this.streamHandle);
40506
+ } else if (type === FORMAT_GZIP2) {
40507
+ result = wasm.inflate_init_gzip(this.streamHandle);
40508
+ } else {
40509
+ result = wasm.inflate_init(this.streamHandle);
40510
+ }
40511
+ }
40512
+ }
40513
+ if (result !== 0) {
40514
+ throw new Error("init failed:" + result);
40515
+ }
39979
40516
  } catch (error2) {
39980
- disposeStream(state);
39981
- readableController.error(error2);
40517
+ disposeStream(this);
39982
40518
  throw error2;
39983
40519
  }
39984
40520
  },
39985
- close() {
39986
- if (cancelled) {
39987
- return;
39988
- }
40521
+ transform(chunk, controller) {
39989
40522
  try {
39990
- flushStream();
40523
+ const buffer2 = chunk;
40524
+ const heap = new Uint8Array(memory.buffer);
40525
+ const process2 = this._process;
40526
+ const last_consumed = this._last_consumed;
40527
+ const out = this.out;
40528
+ let offset = 0;
40529
+ while (offset < buffer2.length) {
40530
+ const toRead = Math.min(buffer2.length - offset, 32 * 1024);
40531
+ if (!this.in || this.inBufferSize < toRead) {
40532
+ if (this.in && free) {
40533
+ free(this.in);
40534
+ this.in = 0;
40535
+ }
40536
+ this.in = malloc(toRead);
40537
+ this.inBufferSize = toRead;
40538
+ if (!this.in) {
40539
+ throw new Error("allocation failed");
40540
+ }
40541
+ }
40542
+ heap.set(buffer2.subarray(offset, offset + toRead), this.in);
40543
+ const result = process2(this.streamHandle, this.in, toRead, out, outBufferSize, 0);
40544
+ const code = result >> 24 & 255;
40545
+ const signedCode = code & 128 ? code - 256 : code;
40546
+ if (signedCode < 0) {
40547
+ throw new Error("process error:" + signedCode);
40548
+ }
40549
+ const prod = result & 16777215;
40550
+ if (prod) {
40551
+ controller.enqueue(heap.slice(out, out + prod));
40552
+ }
40553
+ const consumed = last_consumed(this.streamHandle);
40554
+ if (consumed === 0 && prod === 0) {
40555
+ break;
40556
+ }
40557
+ offset += consumed;
40558
+ }
39991
40559
  } 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;
40560
+ disposeStream(this);
40561
+ controller.error(error2);
40001
40562
  }
40002
- readableController.close();
40003
40563
  },
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);
40564
+ flush(controller) {
40565
+ try {
40566
+ const heap = new Uint8Array(memory.buffer);
40567
+ const process2 = this._process;
40568
+ const out = this.out;
40569
+ while (true) {
40570
+ const result = process2(this.streamHandle, 0, 0, out, outBufferSize, 4);
40571
+ const code = result >> 24 & 255;
40572
+ const signedCode = code & 128 ? code - 256 : code;
40573
+ if (signedCode < 0) {
40574
+ throw new Error("process error:" + signedCode);
40575
+ }
40576
+ const produced = result & 16777215;
40577
+ if (produced) {
40578
+ controller.enqueue(heap.slice(out, out + produced));
40579
+ }
40580
+ if (code === 1 || produced === 0) {
40581
+ break;
40049
40582
  }
40050
40583
  }
40584
+ } catch (error2) {
40585
+ controller.error(error2);
40586
+ } finally {
40587
+ const result = disposeStream(this);
40588
+ if (result !== 0) {
40589
+ controller.error(new Error("end error:" + result));
40590
+ }
40051
40591
  }
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();
40592
+ },
40593
+ cancel() {
40594
+ disposeStream(this);
40131
40595
  }
40132
- }
40133
- function disposeStream(state2) {
40596
+ });
40597
+ function disposeStream(state) {
40134
40598
  let endResult = 0;
40135
- if (state2.streamHandle && state2._end) {
40136
- endResult = state2._end(state2.streamHandle);
40599
+ if (state.streamHandle && state._end) {
40600
+ endResult = state._end(state.streamHandle);
40137
40601
  }
40138
- state2.streamHandle = 0;
40139
- if (state2.in && free) {
40140
- free(state2.in);
40602
+ state.streamHandle = 0;
40603
+ if (state.in && free) {
40604
+ free(state.in);
40141
40605
  }
40142
- state2.in = 0;
40143
- if (state2.out && free) {
40144
- free(state2.out);
40606
+ state.in = 0;
40607
+ if (state.out && free) {
40608
+ free(state.out);
40145
40609
  }
40146
- state2.out = 0;
40610
+ state.out = 0;
40147
40611
  return endResult;
40148
40612
  }
40149
40613
  }
@@ -40159,8 +40623,8 @@ var DecompressionStreamZlib = class {
40159
40623
  };
40160
40624
  CompressionStreamZlib.requiresModule = true;
40161
40625
  DecompressionStreamZlib.requiresModule = true;
40162
- CompressionStreamZlib.supportedFormats = COMPRESSION_FORMATS;
40163
- DecompressionStreamZlib.supportedFormats = DECOMPRESSION_FORMATS;
40626
+ CompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2];
40627
+ DecompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2, FORMAT_DEFLATE64_RAW2];
40164
40628
 
40165
40629
  // ../../node_modules/@zip.js/zip.js/lib/core/streams/zlib-wasm/aes-hmac-sha1-wasm.js
40166
40630
  init_constants();
@@ -40305,7 +40769,6 @@ init_constants();
40305
40769
  init_array();
40306
40770
  init_compatible_streams();
40307
40771
  init_error();
40308
- var EMPTY_RAW_PASSWORD = new Uint8Array(0);
40309
40772
 
40310
40773
  // ../../node_modules/@zip.js/zip.js/lib/zip-fs-wasm.js
40311
40774
  e(setDefaultConfiguration);
@@ -40761,6 +41224,7 @@ var THEME_PATH = "src/theme/tokens.json";
40761
41224
  var RUNTIME_CAPABILITIES_PATH = ".platform-sdk/runtime-capabilities.json";
40762
41225
  var LEGACY_RUNTIME_CARD_SCHEMA_VERSIONS = ["2", "3"];
40763
41226
  var DRAFT_FILE_MAX_BYTES = 1024 * 1024;
41227
+ var TRANSFORM_PREVIEW_REQUEST_MAX_BYTES = 4 * 1024 * 1024;
40764
41228
  var DRAFT_LIST_LIMIT = 1e3;
40765
41229
  var AGENT_CONFIG_MAX_BYTES = 16777215;
40766
41230
  var FINALIZE_LOCK_PATH = ".linkque/runtime/card-finalize.lock";
@@ -40850,6 +41314,48 @@ async function finalizeCardFromRequest(cwd, requestFile) {
40850
41314
  request.contextChecksum
40851
41315
  );
40852
41316
  }
41317
+ async function previewCardTransformFromRequest(cwd, requestFile) {
41318
+ const value = await readRequiredJsonWithLimit(
41319
+ import_path22.default.resolve(cwd, requestFile),
41320
+ TRANSFORM_PREVIEW_REQUEST_MAX_BYTES
41321
+ );
41322
+ if (!isCardTransformPreviewRequest(value)) {
41323
+ throw new LinkqueCliError(
41324
+ "CARD_DRAFT_INVALID",
41325
+ "\u6570\u636E\u8F6C\u6362\u8BD5\u8FD0\u884C\u8BF7\u6C42\u683C\u5F0F\u65E0\u6548"
41326
+ );
41327
+ }
41328
+ const executor = new DataTransformExecutor();
41329
+ try {
41330
+ const result = await executor.execute(value.source, value.input);
41331
+ if (result.data !== null) {
41332
+ result.data = normalizeCardDataValue(
41333
+ value.dataModelSchema,
41334
+ result.data
41335
+ );
41336
+ }
41337
+ if (result.data !== null) {
41338
+ const issues = validateJsonSchemaValue2(
41339
+ value.dataModelSchema,
41340
+ result.data
41341
+ );
41342
+ if (issues.length > 0) {
41343
+ throw new LinkqueCliError(
41344
+ "CARD_TRANSFORM_OUTPUT_SCHEMA_MISMATCH",
41345
+ `\u6570\u636E\u8F6C\u6362\u7ED3\u679C\u4E0D\u7B26\u5408 Schema\uFF1A${issues[0].path} ${issues[0].message}`
41346
+ );
41347
+ }
41348
+ }
41349
+ return { ...result, status: result.data === null ? "skipped" : "rendered" };
41350
+ } catch (cause) {
41351
+ if (cause instanceof DataTransformError) {
41352
+ throw new LinkqueCliError(cause.code, cause.message, { cause });
41353
+ }
41354
+ throw cause;
41355
+ } finally {
41356
+ await executor.close();
41357
+ }
41358
+ }
40853
41359
  async function rollbackCardFinalize(cwd, rollbackToken) {
40854
41360
  const payload = parseRollbackToken(rollbackToken);
40855
41361
  return withWorkspaceLock(
@@ -40900,6 +41406,29 @@ async function validateCardBindingsForBundle(cwd, draftId, bundle, fieldId) {
40900
41406
  const mountedMcpResourceIds = new Set(
40901
41407
  mcpResources.map((resource) => String(resource.resourceId))
40902
41408
  );
41409
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline") {
41410
+ const missing = bundle.manifest.dataSources.filter(
41411
+ (source) => !mountedMcpResourceIds.has(source.mcpResourceId)
41412
+ );
41413
+ if (missing.length > 0) {
41414
+ throw new LinkqueCliError(
41415
+ "CARD_BINDING_VALIDATION_FAILED",
41416
+ missing.map(
41417
+ (source, index) => `manifest.dataSources[${index}]: MCP resource ${source.mcpResourceId} is not mounted`
41418
+ ).join("; ")
41419
+ );
41420
+ }
41421
+ const businessFieldIds2 = bundle.manifest.fields.filter((field) => field.source === "business").map((field) => field.fieldId);
41422
+ return {
41423
+ bindingCount: bundle.manifest.dataSources.length,
41424
+ complete: true,
41425
+ draftChecksum: draftChecksum(bundle),
41426
+ draftId,
41427
+ draftStructureChecksum,
41428
+ validatedFieldIds: fieldId ? [fieldId] : businessFieldIds2,
41429
+ valid: true
41430
+ };
41431
+ }
40903
41432
  const issues = context ? validateA2UICardBindings(
40904
41433
  { draft: bundle, context, mountedMcpResourceIds },
40905
41434
  fieldId ? { fieldIds: /* @__PURE__ */ new Set([fieldId]) } : void 0
@@ -40947,6 +41476,25 @@ async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
40947
41476
  "\u5F53\u524D Runtime \u4E0D\u652F\u6301\u524D\u7AEF\u51FD\u6570 Action\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
40948
41477
  );
40949
41478
  }
41479
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline" && !await readRuntimeSupportsDataPipeline(cwd)) {
41480
+ throw new LinkqueCliError(
41481
+ "CARD_RUNTIME_SCHEMA_UNSUPPORTED",
41482
+ "\u5F53\u524D Agent Runtime \u4E0D\u652F\u6301\u670D\u52A1\u7AEF\u6570\u636E\u8F6C\u6362 pipeline\uFF0C\u8BF7\u5148\u5347\u7EA7 Runtime"
41483
+ );
41484
+ }
41485
+ if (bundle.manifest.schemaVersion === "4" && bundle.manifest.dataMode === "pipeline") {
41486
+ const executor = new DataTransformExecutor();
41487
+ try {
41488
+ await executor.validateSource(bundle.manifest.dataTransform.source);
41489
+ } catch (cause) {
41490
+ if (cause instanceof DataTransformError) {
41491
+ throw new LinkqueCliError(cause.code, cause.message, { cause });
41492
+ }
41493
+ throw cause;
41494
+ } finally {
41495
+ await executor.close();
41496
+ }
41497
+ }
40950
41498
  const context = parseOptionalBindingContext(
40951
41499
  await readOptionalJson(import_path22.default.join(directory, "binding-context.json"))
40952
41500
  );
@@ -41211,6 +41759,44 @@ async function readRequiredJson(file, missingCode = "CARD_DRAFT_INVALID") {
41211
41759
  );
41212
41760
  }
41213
41761
  }
41762
+ async function readRequiredJsonWithLimit(file, maxBytes) {
41763
+ try {
41764
+ const content = await (0, import_promises15.readFile)(file, "utf8");
41765
+ if (Buffer.byteLength(content, "utf8") > maxBytes) {
41766
+ throw new LinkqueCliError(
41767
+ "CARD_DRAFT_INVALID",
41768
+ `${import_path22.default.basename(file)} \u8D85\u8FC7\u5927\u5C0F\u9650\u5236`
41769
+ );
41770
+ }
41771
+ return JSON.parse(content);
41772
+ } catch (cause) {
41773
+ if (cause instanceof LinkqueCliError) throw cause;
41774
+ if (isNodeError(cause, "ENOENT")) {
41775
+ throw new LinkqueCliError(
41776
+ "CARD_DRAFT_NOT_FOUND",
41777
+ `\u8BF7\u6C42\u6587\u4EF6\u7F3A\u5931: ${import_path22.default.basename(file)}`,
41778
+ { cause }
41779
+ );
41780
+ }
41781
+ if (cause instanceof SyntaxError) {
41782
+ throw new LinkqueCliError(
41783
+ "CARD_DRAFT_INVALID",
41784
+ `\u8BF7\u6C42\u6587\u4EF6\u4E0D\u662F\u6709\u6548 JSON: ${import_path22.default.basename(file)}`,
41785
+ { cause }
41786
+ );
41787
+ }
41788
+ throw new LinkqueCliError(
41789
+ "CARD_DRAFT_READ_FAILED",
41790
+ `\u8BF7\u6C42\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25: ${import_path22.default.basename(file)}`,
41791
+ { cause: cause instanceof Error ? cause : void 0 }
41792
+ );
41793
+ }
41794
+ }
41795
+ function isCardTransformPreviewRequest(value) {
41796
+ return isJsonObject(value) && value.version === 1 && typeof value.source === "string" && Array.isArray(value.input) && isJsonObject(value.dataModelSchema) && Object.keys(value).every(
41797
+ (key) => ["version", "source", "input", "dataModelSchema"].includes(key)
41798
+ );
41799
+ }
41214
41800
  async function readOptionalJson(file) {
41215
41801
  try {
41216
41802
  return await readRequiredJson(file, "CARD_DRAFT_NOT_FOUND");
@@ -41246,6 +41832,12 @@ async function readRuntimeSupportsFunctionActions(cwd) {
41246
41832
  ).catch(() => void 0);
41247
41833
  return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.frontendFunctionActions === true;
41248
41834
  }
41835
+ async function readRuntimeSupportsDataPipeline(cwd) {
41836
+ const value = await readOptionalJson(
41837
+ import_path22.default.join(cwd, RUNTIME_CAPABILITIES_PATH)
41838
+ ).catch(() => void 0);
41839
+ return isJsonObject(value) && value.schemaVersion === 1 && isJsonObject(value.a2uiCard) && value.a2uiCard.serverDataPipeline === true;
41840
+ }
41249
41841
  function containsFunctionAction(value) {
41250
41842
  if (Array.isArray(value)) return value.some(containsFunctionAction);
41251
41843
  if (!isJsonObject(value)) return false;
@@ -42469,6 +43061,13 @@ var nanoToMs = (nano) => {
42469
43061
  return void 0;
42470
43062
  }
42471
43063
  };
43064
+ function reverse(arr) {
43065
+ const ret = [];
43066
+ for (let i = arr.length - 1; i >= 0; i--) {
43067
+ ret.push(arr[i]);
43068
+ }
43069
+ return ret;
43070
+ }
42472
43071
 
42473
43072
  // ../linkque-agent-runtime-trace/dist/esm/decode.js
42474
43073
  function validateMetadata(attrs) {
@@ -42665,7 +43264,7 @@ function decodeOtlpLine(line, source, byteRange) {
42665
43264
  }
42666
43265
 
42667
43266
  // ../linkque-agent-runtime-trace/dist/esm/summarize.js
42668
- var import_node_crypto2 = require("node:crypto");
43267
+ var import_node_crypto3 = require("node:crypto");
42669
43268
  var dedupKey = (advanceId, suffix) => `${advanceId ?? ""}
42670
43269
  ${suffix ?? ""}`;
42671
43270
  var extractQueryInput = (facts) => {
@@ -42703,7 +43302,7 @@ var buildOperations = (facts) => {
42703
43302
  const ends = group.flatMap((f3) => f3.finishedAt !== void 0 ? [f3.finishedAt] : f3.name?.endsWith(".finished") && f3.startedAt !== void 0 ? [f3.startedAt] : []);
42704
43303
  const startedAt = starts.length ? Math.min(...starts) : void 0;
42705
43304
  const finishedAt = ends.length ? Math.max(...ends) : void 0;
42706
- const terminal = group.filter((f3) => f3.kind === "span" || f3.name?.endsWith(".finished")).reverse();
43305
+ const terminal = reverse(group.filter((f3) => f3.kind === "span" || f3.name?.endsWith(".finished")));
42707
43306
  const outcome = terminal.map((f3) => f3.outcome).find((v2) => v2 && v2 !== "0") ?? void 0;
42708
43307
  const operationId = group[0].identity.operationId;
42709
43308
  const parentOperationId = attrs[ETelemetryAttribute.LINKQUE_OPERATION_PARENT_ID];
@@ -42839,7 +43438,7 @@ ${body.section}`;
42839
43438
  section: body.section,
42840
43439
  contentRef,
42841
43440
  ...body.reason === "content_limit" ? { reason: "content_limit" } : {},
42842
- valueDigest: (0, import_node_crypto2.createHash)("sha256").update(JSON.stringify(body.value) ?? "").digest("hex"),
43441
+ valueDigest: (0, import_node_crypto3.createHash)("sha256").update(JSON.stringify(body.value) ?? "").digest("hex"),
42843
43442
  ...body.value && typeof body.value === "object" && (body.section.endsWith(".output") || body.section === "knowledge.input") ? {
42844
43443
  result: Object.fromEntries(Object.entries(body.value).filter(([key, value]) => [
42845
43444
  "status",
@@ -42906,8 +43505,8 @@ function summarize(input) {
42906
43505
  }
42907
43506
 
42908
43507
  // src/utils/otlpScanner.ts
42909
- var import_node_path12 = __toESM(require("node:path"));
42910
- var import_node_crypto3 = require("node:crypto");
43508
+ var import_node_path13 = __toESM(require("node:path"));
43509
+ var import_node_crypto4 = require("node:crypto");
42911
43510
  var import_promises20 = require("node:fs/promises");
42912
43511
 
42913
43512
  // src/commands/runs/types.ts
@@ -42962,7 +43561,7 @@ var scanFile = (content, source) => {
42962
43561
  return { facts, warnings };
42963
43562
  };
42964
43563
  async function scanRetainedLogs(cwd, pinned) {
42965
- const dir = import_node_path12.default.join(cwd, LOGS_ROOT);
43564
+ const dir = import_node_path13.default.join(cwd, LOGS_ROOT);
42966
43565
  let files;
42967
43566
  try {
42968
43567
  files = await (0, import_promises20.readdir)(dir);
@@ -42985,7 +43584,7 @@ async function scanRetainedLogs(cwd, pinned) {
42985
43584
  for (const file of selected) {
42986
43585
  try {
42987
43586
  const source = retainedFiles.get(file);
42988
- const filePath = import_node_path12.default.join(dir, file);
43587
+ const filePath = import_node_path13.default.join(dir, file);
42989
43588
  const before = await (0, import_promises20.stat)(filePath);
42990
43589
  const content = await (0, import_promises20.readFile)(filePath);
42991
43590
  const after = await (0, import_promises20.stat)(filePath);
@@ -42997,7 +43596,7 @@ async function scanRetainedLogs(cwd, pinned) {
42997
43596
  let window;
42998
43597
  if (pinned) {
42999
43598
  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
43599
+ (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
43600
  );
43002
43601
  if (!window) continue;
43003
43602
  remaining.delete(window);
@@ -43008,7 +43607,7 @@ async function scanRetainedLogs(cwd, pinned) {
43008
43607
  window = {
43009
43608
  source,
43010
43609
  bytes: complete.length,
43011
- digest: (0, import_node_crypto3.createHash)("sha256").update(complete).digest("hex")
43610
+ digest: (0, import_node_crypto4.createHash)("sha256").update(complete).digest("hex")
43012
43611
  };
43013
43612
  }
43014
43613
  readWindow.push(window);
@@ -43261,7 +43860,12 @@ var scanContent = async (input) => {
43261
43860
  return { availability: "unavailable" };
43262
43861
  }
43263
43862
  const body = matched.body;
43264
- const availability = body.availability === "available" ? "available" : body.availability === "partial" ? "partial" : body.availability === "unavailable" ? "unavailable" : "available";
43863
+ let availability = "available";
43864
+ if (body.availability === "partial") {
43865
+ availability = "partial";
43866
+ } else if (body.availability === "unavailable") {
43867
+ availability = "unavailable";
43868
+ }
43265
43869
  const maxBytes = input.maxBytes ?? 1024 * 1024;
43266
43870
  if (body.value === void 0) return { availability: "not_recorded" };
43267
43871
  const serialized = JSON.stringify(body.value);
@@ -43693,6 +44297,28 @@ var cardValidateBindings = {
43693
44297
  );
43694
44298
  }
43695
44299
  };
44300
+ var cardTransformPreview = {
44301
+ name: "card.transform-preview",
44302
+ description: "run a server-side card data transform against indexed sample input",
44303
+ options: [
44304
+ {
44305
+ flags: "--request-file <requestFile>",
44306
+ description: "manager-owned JSON request containing source, samples and schema",
44307
+ key: "requestFile",
44308
+ parse: parseRequestFile
44309
+ }
44310
+ ],
44311
+ summarize: ({ status: status2 }) => `Card data transform preview ${status2}.
44312
+ `,
44313
+ run: (cwd, options) => {
44314
+ if (options.requestFile === void 0) {
44315
+ throw new InvalidArgumentError(
44316
+ "required option '--request-file <requestFile>' not specified"
44317
+ );
44318
+ }
44319
+ return previewCardTransformFromRequest(cwd, options.requestFile);
44320
+ }
44321
+ };
43696
44322
  var cardFinalize = {
43697
44323
  name: "card.finalize",
43698
44324
  description: "[deprecated; manager compatibility only] validate and atomically upsert a CARD resource into agent config",
@@ -44071,6 +44697,7 @@ var COMMANDS = [
44071
44697
  cardList,
44072
44698
  cardRead,
44073
44699
  cardValidateBindings,
44700
+ cardTransformPreview,
44074
44701
  cardFinalize,
44075
44702
  cardRollback,
44076
44703
  agentdevStart,