@automagik/omni 2.260906.8 → 2.260907.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11233,1023 +11233,6 @@ var init_embedded_canonical_migration = __esm(() => {
11233
11233
  EMBEDDED_PGSERVE_DATA_DIR = EMBEDDED_DIR;
11234
11234
  });
11235
11235
 
11236
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
11237
- var require_QRMode = __commonJS((exports, module) => {
11238
- module.exports = {
11239
- MODE_NUMBER: 1 << 0,
11240
- MODE_ALPHA_NUM: 1 << 1,
11241
- MODE_8BIT_BYTE: 1 << 2,
11242
- MODE_KANJI: 1 << 3
11243
- };
11244
- });
11245
-
11246
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js
11247
- var require_QR8bitByte = __commonJS((exports, module) => {
11248
- var QRMode = require_QRMode();
11249
- function QR8bitByte(data2) {
11250
- this.mode = QRMode.MODE_8BIT_BYTE;
11251
- this.data = data2;
11252
- }
11253
- QR8bitByte.prototype = {
11254
- getLength: function() {
11255
- return this.data.length;
11256
- },
11257
- write: function(buffer2) {
11258
- for (var i = 0;i < this.data.length; i++) {
11259
- buffer2.put(this.data.charCodeAt(i), 8);
11260
- }
11261
- }
11262
- };
11263
- module.exports = QR8bitByte;
11264
- });
11265
-
11266
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js
11267
- var require_QRMath = __commonJS((exports, module) => {
11268
- var QRMath = {
11269
- glog: function(n) {
11270
- if (n < 1) {
11271
- throw new Error("glog(" + n + ")");
11272
- }
11273
- return QRMath.LOG_TABLE[n];
11274
- },
11275
- gexp: function(n) {
11276
- while (n < 0) {
11277
- n += 255;
11278
- }
11279
- while (n >= 256) {
11280
- n -= 255;
11281
- }
11282
- return QRMath.EXP_TABLE[n];
11283
- },
11284
- EXP_TABLE: new Array(256),
11285
- LOG_TABLE: new Array(256)
11286
- };
11287
- for (i = 0;i < 8; i++) {
11288
- QRMath.EXP_TABLE[i] = 1 << i;
11289
- }
11290
- var i;
11291
- for (i = 8;i < 256; i++) {
11292
- QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
11293
- }
11294
- var i;
11295
- for (i = 0;i < 255; i++) {
11296
- QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
11297
- }
11298
- var i;
11299
- module.exports = QRMath;
11300
- });
11301
-
11302
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js
11303
- var require_QRPolynomial = __commonJS((exports, module) => {
11304
- var QRMath = require_QRMath();
11305
- function QRPolynomial(num, shift) {
11306
- if (num.length === undefined) {
11307
- throw new Error(num.length + "/" + shift);
11308
- }
11309
- var offset = 0;
11310
- while (offset < num.length && num[offset] === 0) {
11311
- offset++;
11312
- }
11313
- this.num = new Array(num.length - offset + shift);
11314
- for (var i = 0;i < num.length - offset; i++) {
11315
- this.num[i] = num[i + offset];
11316
- }
11317
- }
11318
- QRPolynomial.prototype = {
11319
- get: function(index) {
11320
- return this.num[index];
11321
- },
11322
- getLength: function() {
11323
- return this.num.length;
11324
- },
11325
- multiply: function(e) {
11326
- var num = new Array(this.getLength() + e.getLength() - 1);
11327
- for (var i = 0;i < this.getLength(); i++) {
11328
- for (var j = 0;j < e.getLength(); j++) {
11329
- num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
11330
- }
11331
- }
11332
- return new QRPolynomial(num, 0);
11333
- },
11334
- mod: function(e) {
11335
- if (this.getLength() - e.getLength() < 0) {
11336
- return this;
11337
- }
11338
- var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0));
11339
- var num = new Array(this.getLength());
11340
- for (var i = 0;i < this.getLength(); i++) {
11341
- num[i] = this.get(i);
11342
- }
11343
- for (var x = 0;x < e.getLength(); x++) {
11344
- num[x] ^= QRMath.gexp(QRMath.glog(e.get(x)) + ratio);
11345
- }
11346
- return new QRPolynomial(num, 0).mod(e);
11347
- }
11348
- };
11349
- module.exports = QRPolynomial;
11350
- });
11351
-
11352
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js
11353
- var require_QRMaskPattern = __commonJS((exports, module) => {
11354
- module.exports = {
11355
- PATTERN000: 0,
11356
- PATTERN001: 1,
11357
- PATTERN010: 2,
11358
- PATTERN011: 3,
11359
- PATTERN100: 4,
11360
- PATTERN101: 5,
11361
- PATTERN110: 6,
11362
- PATTERN111: 7
11363
- };
11364
- });
11365
-
11366
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js
11367
- var require_QRUtil = __commonJS((exports, module) => {
11368
- var QRMode = require_QRMode();
11369
- var QRPolynomial = require_QRPolynomial();
11370
- var QRMath = require_QRMath();
11371
- var QRMaskPattern = require_QRMaskPattern();
11372
- var QRUtil = {
11373
- PATTERN_POSITION_TABLE: [
11374
- [],
11375
- [6, 18],
11376
- [6, 22],
11377
- [6, 26],
11378
- [6, 30],
11379
- [6, 34],
11380
- [6, 22, 38],
11381
- [6, 24, 42],
11382
- [6, 26, 46],
11383
- [6, 28, 50],
11384
- [6, 30, 54],
11385
- [6, 32, 58],
11386
- [6, 34, 62],
11387
- [6, 26, 46, 66],
11388
- [6, 26, 48, 70],
11389
- [6, 26, 50, 74],
11390
- [6, 30, 54, 78],
11391
- [6, 30, 56, 82],
11392
- [6, 30, 58, 86],
11393
- [6, 34, 62, 90],
11394
- [6, 28, 50, 72, 94],
11395
- [6, 26, 50, 74, 98],
11396
- [6, 30, 54, 78, 102],
11397
- [6, 28, 54, 80, 106],
11398
- [6, 32, 58, 84, 110],
11399
- [6, 30, 58, 86, 114],
11400
- [6, 34, 62, 90, 118],
11401
- [6, 26, 50, 74, 98, 122],
11402
- [6, 30, 54, 78, 102, 126],
11403
- [6, 26, 52, 78, 104, 130],
11404
- [6, 30, 56, 82, 108, 134],
11405
- [6, 34, 60, 86, 112, 138],
11406
- [6, 30, 58, 86, 114, 142],
11407
- [6, 34, 62, 90, 118, 146],
11408
- [6, 30, 54, 78, 102, 126, 150],
11409
- [6, 24, 50, 76, 102, 128, 154],
11410
- [6, 28, 54, 80, 106, 132, 158],
11411
- [6, 32, 58, 84, 110, 136, 162],
11412
- [6, 26, 54, 82, 110, 138, 166],
11413
- [6, 30, 58, 86, 114, 142, 170]
11414
- ],
11415
- G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
11416
- G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
11417
- G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
11418
- getBCHTypeInfo: function(data2) {
11419
- var d = data2 << 10;
11420
- while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
11421
- d ^= QRUtil.G15 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15);
11422
- }
11423
- return (data2 << 10 | d) ^ QRUtil.G15_MASK;
11424
- },
11425
- getBCHTypeNumber: function(data2) {
11426
- var d = data2 << 12;
11427
- while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
11428
- d ^= QRUtil.G18 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18);
11429
- }
11430
- return data2 << 12 | d;
11431
- },
11432
- getBCHDigit: function(data2) {
11433
- var digit = 0;
11434
- while (data2 !== 0) {
11435
- digit++;
11436
- data2 >>>= 1;
11437
- }
11438
- return digit;
11439
- },
11440
- getPatternPosition: function(typeNumber) {
11441
- return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
11442
- },
11443
- getMask: function(maskPattern, i, j) {
11444
- switch (maskPattern) {
11445
- case QRMaskPattern.PATTERN000:
11446
- return (i + j) % 2 === 0;
11447
- case QRMaskPattern.PATTERN001:
11448
- return i % 2 === 0;
11449
- case QRMaskPattern.PATTERN010:
11450
- return j % 3 === 0;
11451
- case QRMaskPattern.PATTERN011:
11452
- return (i + j) % 3 === 0;
11453
- case QRMaskPattern.PATTERN100:
11454
- return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
11455
- case QRMaskPattern.PATTERN101:
11456
- return i * j % 2 + i * j % 3 === 0;
11457
- case QRMaskPattern.PATTERN110:
11458
- return (i * j % 2 + i * j % 3) % 2 === 0;
11459
- case QRMaskPattern.PATTERN111:
11460
- return (i * j % 3 + (i + j) % 2) % 2 === 0;
11461
- default:
11462
- throw new Error("bad maskPattern:" + maskPattern);
11463
- }
11464
- },
11465
- getErrorCorrectPolynomial: function(errorCorrectLength) {
11466
- var a = new QRPolynomial([1], 0);
11467
- for (var i = 0;i < errorCorrectLength; i++) {
11468
- a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
11469
- }
11470
- return a;
11471
- },
11472
- getLengthInBits: function(mode, type) {
11473
- if (1 <= type && type < 10) {
11474
- switch (mode) {
11475
- case QRMode.MODE_NUMBER:
11476
- return 10;
11477
- case QRMode.MODE_ALPHA_NUM:
11478
- return 9;
11479
- case QRMode.MODE_8BIT_BYTE:
11480
- return 8;
11481
- case QRMode.MODE_KANJI:
11482
- return 8;
11483
- default:
11484
- throw new Error("mode:" + mode);
11485
- }
11486
- } else if (type < 27) {
11487
- switch (mode) {
11488
- case QRMode.MODE_NUMBER:
11489
- return 12;
11490
- case QRMode.MODE_ALPHA_NUM:
11491
- return 11;
11492
- case QRMode.MODE_8BIT_BYTE:
11493
- return 16;
11494
- case QRMode.MODE_KANJI:
11495
- return 10;
11496
- default:
11497
- throw new Error("mode:" + mode);
11498
- }
11499
- } else if (type < 41) {
11500
- switch (mode) {
11501
- case QRMode.MODE_NUMBER:
11502
- return 14;
11503
- case QRMode.MODE_ALPHA_NUM:
11504
- return 13;
11505
- case QRMode.MODE_8BIT_BYTE:
11506
- return 16;
11507
- case QRMode.MODE_KANJI:
11508
- return 12;
11509
- default:
11510
- throw new Error("mode:" + mode);
11511
- }
11512
- } else {
11513
- throw new Error("type:" + type);
11514
- }
11515
- },
11516
- getLostPoint: function(qrCode) {
11517
- var moduleCount = qrCode.getModuleCount();
11518
- var lostPoint = 0;
11519
- var row = 0;
11520
- var col = 0;
11521
- for (row = 0;row < moduleCount; row++) {
11522
- for (col = 0;col < moduleCount; col++) {
11523
- var sameCount = 0;
11524
- var dark = qrCode.isDark(row, col);
11525
- for (var r = -1;r <= 1; r++) {
11526
- if (row + r < 0 || moduleCount <= row + r) {
11527
- continue;
11528
- }
11529
- for (var c2 = -1;c2 <= 1; c2++) {
11530
- if (col + c2 < 0 || moduleCount <= col + c2) {
11531
- continue;
11532
- }
11533
- if (r === 0 && c2 === 0) {
11534
- continue;
11535
- }
11536
- if (dark === qrCode.isDark(row + r, col + c2)) {
11537
- sameCount++;
11538
- }
11539
- }
11540
- }
11541
- if (sameCount > 5) {
11542
- lostPoint += 3 + sameCount - 5;
11543
- }
11544
- }
11545
- }
11546
- for (row = 0;row < moduleCount - 1; row++) {
11547
- for (col = 0;col < moduleCount - 1; col++) {
11548
- var count = 0;
11549
- if (qrCode.isDark(row, col))
11550
- count++;
11551
- if (qrCode.isDark(row + 1, col))
11552
- count++;
11553
- if (qrCode.isDark(row, col + 1))
11554
- count++;
11555
- if (qrCode.isDark(row + 1, col + 1))
11556
- count++;
11557
- if (count === 0 || count === 4) {
11558
- lostPoint += 3;
11559
- }
11560
- }
11561
- }
11562
- for (row = 0;row < moduleCount; row++) {
11563
- for (col = 0;col < moduleCount - 6; col++) {
11564
- if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
11565
- lostPoint += 40;
11566
- }
11567
- }
11568
- }
11569
- for (col = 0;col < moduleCount; col++) {
11570
- for (row = 0;row < moduleCount - 6; row++) {
11571
- if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
11572
- lostPoint += 40;
11573
- }
11574
- }
11575
- }
11576
- var darkCount = 0;
11577
- for (col = 0;col < moduleCount; col++) {
11578
- for (row = 0;row < moduleCount; row++) {
11579
- if (qrCode.isDark(row, col)) {
11580
- darkCount++;
11581
- }
11582
- }
11583
- }
11584
- var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
11585
- lostPoint += ratio * 10;
11586
- return lostPoint;
11587
- }
11588
- };
11589
- module.exports = QRUtil;
11590
- });
11591
-
11592
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js
11593
- var require_QRErrorCorrectLevel = __commonJS((exports, module) => {
11594
- module.exports = {
11595
- L: 1,
11596
- M: 0,
11597
- Q: 3,
11598
- H: 2
11599
- };
11600
- });
11601
-
11602
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js
11603
- var require_QRRSBlock = __commonJS((exports, module) => {
11604
- var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
11605
- function QRRSBlock(totalCount, dataCount) {
11606
- this.totalCount = totalCount;
11607
- this.dataCount = dataCount;
11608
- }
11609
- QRRSBlock.RS_BLOCK_TABLE = [
11610
- [1, 26, 19],
11611
- [1, 26, 16],
11612
- [1, 26, 13],
11613
- [1, 26, 9],
11614
- [1, 44, 34],
11615
- [1, 44, 28],
11616
- [1, 44, 22],
11617
- [1, 44, 16],
11618
- [1, 70, 55],
11619
- [1, 70, 44],
11620
- [2, 35, 17],
11621
- [2, 35, 13],
11622
- [1, 100, 80],
11623
- [2, 50, 32],
11624
- [2, 50, 24],
11625
- [4, 25, 9],
11626
- [1, 134, 108],
11627
- [2, 67, 43],
11628
- [2, 33, 15, 2, 34, 16],
11629
- [2, 33, 11, 2, 34, 12],
11630
- [2, 86, 68],
11631
- [4, 43, 27],
11632
- [4, 43, 19],
11633
- [4, 43, 15],
11634
- [2, 98, 78],
11635
- [4, 49, 31],
11636
- [2, 32, 14, 4, 33, 15],
11637
- [4, 39, 13, 1, 40, 14],
11638
- [2, 121, 97],
11639
- [2, 60, 38, 2, 61, 39],
11640
- [4, 40, 18, 2, 41, 19],
11641
- [4, 40, 14, 2, 41, 15],
11642
- [2, 146, 116],
11643
- [3, 58, 36, 2, 59, 37],
11644
- [4, 36, 16, 4, 37, 17],
11645
- [4, 36, 12, 4, 37, 13],
11646
- [2, 86, 68, 2, 87, 69],
11647
- [4, 69, 43, 1, 70, 44],
11648
- [6, 43, 19, 2, 44, 20],
11649
- [6, 43, 15, 2, 44, 16],
11650
- [4, 101, 81],
11651
- [1, 80, 50, 4, 81, 51],
11652
- [4, 50, 22, 4, 51, 23],
11653
- [3, 36, 12, 8, 37, 13],
11654
- [2, 116, 92, 2, 117, 93],
11655
- [6, 58, 36, 2, 59, 37],
11656
- [4, 46, 20, 6, 47, 21],
11657
- [7, 42, 14, 4, 43, 15],
11658
- [4, 133, 107],
11659
- [8, 59, 37, 1, 60, 38],
11660
- [8, 44, 20, 4, 45, 21],
11661
- [12, 33, 11, 4, 34, 12],
11662
- [3, 145, 115, 1, 146, 116],
11663
- [4, 64, 40, 5, 65, 41],
11664
- [11, 36, 16, 5, 37, 17],
11665
- [11, 36, 12, 5, 37, 13],
11666
- [5, 109, 87, 1, 110, 88],
11667
- [5, 65, 41, 5, 66, 42],
11668
- [5, 54, 24, 7, 55, 25],
11669
- [11, 36, 12],
11670
- [5, 122, 98, 1, 123, 99],
11671
- [7, 73, 45, 3, 74, 46],
11672
- [15, 43, 19, 2, 44, 20],
11673
- [3, 45, 15, 13, 46, 16],
11674
- [1, 135, 107, 5, 136, 108],
11675
- [10, 74, 46, 1, 75, 47],
11676
- [1, 50, 22, 15, 51, 23],
11677
- [2, 42, 14, 17, 43, 15],
11678
- [5, 150, 120, 1, 151, 121],
11679
- [9, 69, 43, 4, 70, 44],
11680
- [17, 50, 22, 1, 51, 23],
11681
- [2, 42, 14, 19, 43, 15],
11682
- [3, 141, 113, 4, 142, 114],
11683
- [3, 70, 44, 11, 71, 45],
11684
- [17, 47, 21, 4, 48, 22],
11685
- [9, 39, 13, 16, 40, 14],
11686
- [3, 135, 107, 5, 136, 108],
11687
- [3, 67, 41, 13, 68, 42],
11688
- [15, 54, 24, 5, 55, 25],
11689
- [15, 43, 15, 10, 44, 16],
11690
- [4, 144, 116, 4, 145, 117],
11691
- [17, 68, 42],
11692
- [17, 50, 22, 6, 51, 23],
11693
- [19, 46, 16, 6, 47, 17],
11694
- [2, 139, 111, 7, 140, 112],
11695
- [17, 74, 46],
11696
- [7, 54, 24, 16, 55, 25],
11697
- [34, 37, 13],
11698
- [4, 151, 121, 5, 152, 122],
11699
- [4, 75, 47, 14, 76, 48],
11700
- [11, 54, 24, 14, 55, 25],
11701
- [16, 45, 15, 14, 46, 16],
11702
- [6, 147, 117, 4, 148, 118],
11703
- [6, 73, 45, 14, 74, 46],
11704
- [11, 54, 24, 16, 55, 25],
11705
- [30, 46, 16, 2, 47, 17],
11706
- [8, 132, 106, 4, 133, 107],
11707
- [8, 75, 47, 13, 76, 48],
11708
- [7, 54, 24, 22, 55, 25],
11709
- [22, 45, 15, 13, 46, 16],
11710
- [10, 142, 114, 2, 143, 115],
11711
- [19, 74, 46, 4, 75, 47],
11712
- [28, 50, 22, 6, 51, 23],
11713
- [33, 46, 16, 4, 47, 17],
11714
- [8, 152, 122, 4, 153, 123],
11715
- [22, 73, 45, 3, 74, 46],
11716
- [8, 53, 23, 26, 54, 24],
11717
- [12, 45, 15, 28, 46, 16],
11718
- [3, 147, 117, 10, 148, 118],
11719
- [3, 73, 45, 23, 74, 46],
11720
- [4, 54, 24, 31, 55, 25],
11721
- [11, 45, 15, 31, 46, 16],
11722
- [7, 146, 116, 7, 147, 117],
11723
- [21, 73, 45, 7, 74, 46],
11724
- [1, 53, 23, 37, 54, 24],
11725
- [19, 45, 15, 26, 46, 16],
11726
- [5, 145, 115, 10, 146, 116],
11727
- [19, 75, 47, 10, 76, 48],
11728
- [15, 54, 24, 25, 55, 25],
11729
- [23, 45, 15, 25, 46, 16],
11730
- [13, 145, 115, 3, 146, 116],
11731
- [2, 74, 46, 29, 75, 47],
11732
- [42, 54, 24, 1, 55, 25],
11733
- [23, 45, 15, 28, 46, 16],
11734
- [17, 145, 115],
11735
- [10, 74, 46, 23, 75, 47],
11736
- [10, 54, 24, 35, 55, 25],
11737
- [19, 45, 15, 35, 46, 16],
11738
- [17, 145, 115, 1, 146, 116],
11739
- [14, 74, 46, 21, 75, 47],
11740
- [29, 54, 24, 19, 55, 25],
11741
- [11, 45, 15, 46, 46, 16],
11742
- [13, 145, 115, 6, 146, 116],
11743
- [14, 74, 46, 23, 75, 47],
11744
- [44, 54, 24, 7, 55, 25],
11745
- [59, 46, 16, 1, 47, 17],
11746
- [12, 151, 121, 7, 152, 122],
11747
- [12, 75, 47, 26, 76, 48],
11748
- [39, 54, 24, 14, 55, 25],
11749
- [22, 45, 15, 41, 46, 16],
11750
- [6, 151, 121, 14, 152, 122],
11751
- [6, 75, 47, 34, 76, 48],
11752
- [46, 54, 24, 10, 55, 25],
11753
- [2, 45, 15, 64, 46, 16],
11754
- [17, 152, 122, 4, 153, 123],
11755
- [29, 74, 46, 14, 75, 47],
11756
- [49, 54, 24, 10, 55, 25],
11757
- [24, 45, 15, 46, 46, 16],
11758
- [4, 152, 122, 18, 153, 123],
11759
- [13, 74, 46, 32, 75, 47],
11760
- [48, 54, 24, 14, 55, 25],
11761
- [42, 45, 15, 32, 46, 16],
11762
- [20, 147, 117, 4, 148, 118],
11763
- [40, 75, 47, 7, 76, 48],
11764
- [43, 54, 24, 22, 55, 25],
11765
- [10, 45, 15, 67, 46, 16],
11766
- [19, 148, 118, 6, 149, 119],
11767
- [18, 75, 47, 31, 76, 48],
11768
- [34, 54, 24, 34, 55, 25],
11769
- [20, 45, 15, 61, 46, 16]
11770
- ];
11771
- QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
11772
- var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
11773
- if (rsBlock === undefined) {
11774
- throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
11775
- }
11776
- var length = rsBlock.length / 3;
11777
- var list2 = [];
11778
- for (var i = 0;i < length; i++) {
11779
- var count = rsBlock[i * 3 + 0];
11780
- var totalCount = rsBlock[i * 3 + 1];
11781
- var dataCount = rsBlock[i * 3 + 2];
11782
- for (var j = 0;j < count; j++) {
11783
- list2.push(new QRRSBlock(totalCount, dataCount));
11784
- }
11785
- }
11786
- return list2;
11787
- };
11788
- QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
11789
- switch (errorCorrectLevel) {
11790
- case QRErrorCorrectLevel.L:
11791
- return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
11792
- case QRErrorCorrectLevel.M:
11793
- return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
11794
- case QRErrorCorrectLevel.Q:
11795
- return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
11796
- case QRErrorCorrectLevel.H:
11797
- return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
11798
- default:
11799
- return;
11800
- }
11801
- };
11802
- module.exports = QRRSBlock;
11803
- });
11804
-
11805
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js
11806
- var require_QRBitBuffer = __commonJS((exports, module) => {
11807
- function QRBitBuffer() {
11808
- this.buffer = [];
11809
- this.length = 0;
11810
- }
11811
- QRBitBuffer.prototype = {
11812
- get: function(index) {
11813
- var bufIndex = Math.floor(index / 8);
11814
- return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
11815
- },
11816
- put: function(num, length) {
11817
- for (var i = 0;i < length; i++) {
11818
- this.putBit((num >>> length - i - 1 & 1) == 1);
11819
- }
11820
- },
11821
- getLengthInBits: function() {
11822
- return this.length;
11823
- },
11824
- putBit: function(bit) {
11825
- var bufIndex = Math.floor(this.length / 8);
11826
- if (this.buffer.length <= bufIndex) {
11827
- this.buffer.push(0);
11828
- }
11829
- if (bit) {
11830
- this.buffer[bufIndex] |= 128 >>> this.length % 8;
11831
- }
11832
- this.length++;
11833
- }
11834
- };
11835
- module.exports = QRBitBuffer;
11836
- });
11837
-
11838
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/index.js
11839
- var require_QRCode = __commonJS((exports, module) => {
11840
- var QR8bitByte = require_QR8bitByte();
11841
- var QRUtil = require_QRUtil();
11842
- var QRPolynomial = require_QRPolynomial();
11843
- var QRRSBlock = require_QRRSBlock();
11844
- var QRBitBuffer = require_QRBitBuffer();
11845
- function QRCode(typeNumber, errorCorrectLevel) {
11846
- this.typeNumber = typeNumber;
11847
- this.errorCorrectLevel = errorCorrectLevel;
11848
- this.modules = null;
11849
- this.moduleCount = 0;
11850
- this.dataCache = null;
11851
- this.dataList = [];
11852
- }
11853
- QRCode.prototype = {
11854
- addData: function(data2) {
11855
- var newData = new QR8bitByte(data2);
11856
- this.dataList.push(newData);
11857
- this.dataCache = null;
11858
- },
11859
- isDark: function(row, col) {
11860
- if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
11861
- throw new Error(row + "," + col);
11862
- }
11863
- return this.modules[row][col];
11864
- },
11865
- getModuleCount: function() {
11866
- return this.moduleCount;
11867
- },
11868
- make: function() {
11869
- if (this.typeNumber < 1) {
11870
- var typeNumber = 1;
11871
- for (typeNumber = 1;typeNumber < 40; typeNumber++) {
11872
- var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
11873
- var buffer2 = new QRBitBuffer;
11874
- var totalDataCount = 0;
11875
- for (var i = 0;i < rsBlocks.length; i++) {
11876
- totalDataCount += rsBlocks[i].dataCount;
11877
- }
11878
- for (var x = 0;x < this.dataList.length; x++) {
11879
- var data2 = this.dataList[x];
11880
- buffer2.put(data2.mode, 4);
11881
- buffer2.put(data2.getLength(), QRUtil.getLengthInBits(data2.mode, typeNumber));
11882
- data2.write(buffer2);
11883
- }
11884
- if (buffer2.getLengthInBits() <= totalDataCount * 8)
11885
- break;
11886
- }
11887
- this.typeNumber = typeNumber;
11888
- }
11889
- this.makeImpl(false, this.getBestMaskPattern());
11890
- },
11891
- makeImpl: function(test, maskPattern) {
11892
- this.moduleCount = this.typeNumber * 4 + 17;
11893
- this.modules = new Array(this.moduleCount);
11894
- for (var row = 0;row < this.moduleCount; row++) {
11895
- this.modules[row] = new Array(this.moduleCount);
11896
- for (var col = 0;col < this.moduleCount; col++) {
11897
- this.modules[row][col] = null;
11898
- }
11899
- }
11900
- this.setupPositionProbePattern(0, 0);
11901
- this.setupPositionProbePattern(this.moduleCount - 7, 0);
11902
- this.setupPositionProbePattern(0, this.moduleCount - 7);
11903
- this.setupPositionAdjustPattern();
11904
- this.setupTimingPattern();
11905
- this.setupTypeInfo(test, maskPattern);
11906
- if (this.typeNumber >= 7) {
11907
- this.setupTypeNumber(test);
11908
- }
11909
- if (this.dataCache === null) {
11910
- this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
11911
- }
11912
- this.mapData(this.dataCache, maskPattern);
11913
- },
11914
- setupPositionProbePattern: function(row, col) {
11915
- for (var r = -1;r <= 7; r++) {
11916
- if (row + r <= -1 || this.moduleCount <= row + r)
11917
- continue;
11918
- for (var c2 = -1;c2 <= 7; c2++) {
11919
- if (col + c2 <= -1 || this.moduleCount <= col + c2)
11920
- continue;
11921
- if (0 <= r && r <= 6 && (c2 === 0 || c2 === 6) || 0 <= c2 && c2 <= 6 && (r === 0 || r === 6) || 2 <= r && r <= 4 && 2 <= c2 && c2 <= 4) {
11922
- this.modules[row + r][col + c2] = true;
11923
- } else {
11924
- this.modules[row + r][col + c2] = false;
11925
- }
11926
- }
11927
- }
11928
- },
11929
- getBestMaskPattern: function() {
11930
- var minLostPoint = 0;
11931
- var pattern = 0;
11932
- for (var i = 0;i < 8; i++) {
11933
- this.makeImpl(true, i);
11934
- var lostPoint = QRUtil.getLostPoint(this);
11935
- if (i === 0 || minLostPoint > lostPoint) {
11936
- minLostPoint = lostPoint;
11937
- pattern = i;
11938
- }
11939
- }
11940
- return pattern;
11941
- },
11942
- createMovieClip: function(target_mc, instance_name, depth) {
11943
- var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
11944
- var cs = 1;
11945
- this.make();
11946
- for (var row = 0;row < this.modules.length; row++) {
11947
- var y = row * cs;
11948
- for (var col = 0;col < this.modules[row].length; col++) {
11949
- var x = col * cs;
11950
- var dark = this.modules[row][col];
11951
- if (dark) {
11952
- qr_mc.beginFill(0, 100);
11953
- qr_mc.moveTo(x, y);
11954
- qr_mc.lineTo(x + cs, y);
11955
- qr_mc.lineTo(x + cs, y + cs);
11956
- qr_mc.lineTo(x, y + cs);
11957
- qr_mc.endFill();
11958
- }
11959
- }
11960
- }
11961
- return qr_mc;
11962
- },
11963
- setupTimingPattern: function() {
11964
- for (var r = 8;r < this.moduleCount - 8; r++) {
11965
- if (this.modules[r][6] !== null) {
11966
- continue;
11967
- }
11968
- this.modules[r][6] = r % 2 === 0;
11969
- }
11970
- for (var c2 = 8;c2 < this.moduleCount - 8; c2++) {
11971
- if (this.modules[6][c2] !== null) {
11972
- continue;
11973
- }
11974
- this.modules[6][c2] = c2 % 2 === 0;
11975
- }
11976
- },
11977
- setupPositionAdjustPattern: function() {
11978
- var pos = QRUtil.getPatternPosition(this.typeNumber);
11979
- for (var i = 0;i < pos.length; i++) {
11980
- for (var j = 0;j < pos.length; j++) {
11981
- var row = pos[i];
11982
- var col = pos[j];
11983
- if (this.modules[row][col] !== null) {
11984
- continue;
11985
- }
11986
- for (var r = -2;r <= 2; r++) {
11987
- for (var c2 = -2;c2 <= 2; c2++) {
11988
- if (Math.abs(r) === 2 || Math.abs(c2) === 2 || r === 0 && c2 === 0) {
11989
- this.modules[row + r][col + c2] = true;
11990
- } else {
11991
- this.modules[row + r][col + c2] = false;
11992
- }
11993
- }
11994
- }
11995
- }
11996
- }
11997
- },
11998
- setupTypeNumber: function(test) {
11999
- var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
12000
- var mod;
12001
- for (var i = 0;i < 18; i++) {
12002
- mod = !test && (bits >> i & 1) === 1;
12003
- this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
12004
- }
12005
- for (var x = 0;x < 18; x++) {
12006
- mod = !test && (bits >> x & 1) === 1;
12007
- this.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod;
12008
- }
12009
- },
12010
- setupTypeInfo: function(test, maskPattern) {
12011
- var data2 = this.errorCorrectLevel << 3 | maskPattern;
12012
- var bits = QRUtil.getBCHTypeInfo(data2);
12013
- var mod;
12014
- for (var v = 0;v < 15; v++) {
12015
- mod = !test && (bits >> v & 1) === 1;
12016
- if (v < 6) {
12017
- this.modules[v][8] = mod;
12018
- } else if (v < 8) {
12019
- this.modules[v + 1][8] = mod;
12020
- } else {
12021
- this.modules[this.moduleCount - 15 + v][8] = mod;
12022
- }
12023
- }
12024
- for (var h = 0;h < 15; h++) {
12025
- mod = !test && (bits >> h & 1) === 1;
12026
- if (h < 8) {
12027
- this.modules[8][this.moduleCount - h - 1] = mod;
12028
- } else if (h < 9) {
12029
- this.modules[8][15 - h - 1 + 1] = mod;
12030
- } else {
12031
- this.modules[8][15 - h - 1] = mod;
12032
- }
12033
- }
12034
- this.modules[this.moduleCount - 8][8] = !test;
12035
- },
12036
- mapData: function(data2, maskPattern) {
12037
- var inc = -1;
12038
- var row = this.moduleCount - 1;
12039
- var bitIndex = 7;
12040
- var byteIndex = 0;
12041
- for (var col = this.moduleCount - 1;col > 0; col -= 2) {
12042
- if (col === 6)
12043
- col--;
12044
- while (true) {
12045
- for (var c2 = 0;c2 < 2; c2++) {
12046
- if (this.modules[row][col - c2] === null) {
12047
- var dark = false;
12048
- if (byteIndex < data2.length) {
12049
- dark = (data2[byteIndex] >>> bitIndex & 1) === 1;
12050
- }
12051
- var mask = QRUtil.getMask(maskPattern, row, col - c2);
12052
- if (mask) {
12053
- dark = !dark;
12054
- }
12055
- this.modules[row][col - c2] = dark;
12056
- bitIndex--;
12057
- if (bitIndex === -1) {
12058
- byteIndex++;
12059
- bitIndex = 7;
12060
- }
12061
- }
12062
- }
12063
- row += inc;
12064
- if (row < 0 || this.moduleCount <= row) {
12065
- row -= inc;
12066
- inc = -inc;
12067
- break;
12068
- }
12069
- }
12070
- }
12071
- }
12072
- };
12073
- QRCode.PAD0 = 236;
12074
- QRCode.PAD1 = 17;
12075
- QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
12076
- var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
12077
- var buffer2 = new QRBitBuffer;
12078
- for (var i = 0;i < dataList.length; i++) {
12079
- var data2 = dataList[i];
12080
- buffer2.put(data2.mode, 4);
12081
- buffer2.put(data2.getLength(), QRUtil.getLengthInBits(data2.mode, typeNumber));
12082
- data2.write(buffer2);
12083
- }
12084
- var totalDataCount = 0;
12085
- for (var x = 0;x < rsBlocks.length; x++) {
12086
- totalDataCount += rsBlocks[x].dataCount;
12087
- }
12088
- if (buffer2.getLengthInBits() > totalDataCount * 8) {
12089
- throw new Error("code length overflow. (" + buffer2.getLengthInBits() + ">" + totalDataCount * 8 + ")");
12090
- }
12091
- if (buffer2.getLengthInBits() + 4 <= totalDataCount * 8) {
12092
- buffer2.put(0, 4);
12093
- }
12094
- while (buffer2.getLengthInBits() % 8 !== 0) {
12095
- buffer2.putBit(false);
12096
- }
12097
- while (true) {
12098
- if (buffer2.getLengthInBits() >= totalDataCount * 8) {
12099
- break;
12100
- }
12101
- buffer2.put(QRCode.PAD0, 8);
12102
- if (buffer2.getLengthInBits() >= totalDataCount * 8) {
12103
- break;
12104
- }
12105
- buffer2.put(QRCode.PAD1, 8);
12106
- }
12107
- return QRCode.createBytes(buffer2, rsBlocks);
12108
- };
12109
- QRCode.createBytes = function(buffer2, rsBlocks) {
12110
- var offset = 0;
12111
- var maxDcCount = 0;
12112
- var maxEcCount = 0;
12113
- var dcdata = new Array(rsBlocks.length);
12114
- var ecdata = new Array(rsBlocks.length);
12115
- for (var r = 0;r < rsBlocks.length; r++) {
12116
- var dcCount = rsBlocks[r].dataCount;
12117
- var ecCount = rsBlocks[r].totalCount - dcCount;
12118
- maxDcCount = Math.max(maxDcCount, dcCount);
12119
- maxEcCount = Math.max(maxEcCount, ecCount);
12120
- dcdata[r] = new Array(dcCount);
12121
- for (var i = 0;i < dcdata[r].length; i++) {
12122
- dcdata[r][i] = 255 & buffer2.buffer[i + offset];
12123
- }
12124
- offset += dcCount;
12125
- var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
12126
- var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
12127
- var modPoly = rawPoly.mod(rsPoly);
12128
- ecdata[r] = new Array(rsPoly.getLength() - 1);
12129
- for (var x = 0;x < ecdata[r].length; x++) {
12130
- var modIndex = x + modPoly.getLength() - ecdata[r].length;
12131
- ecdata[r][x] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
12132
- }
12133
- }
12134
- var totalCodeCount = 0;
12135
- for (var y = 0;y < rsBlocks.length; y++) {
12136
- totalCodeCount += rsBlocks[y].totalCount;
12137
- }
12138
- var data2 = new Array(totalCodeCount);
12139
- var index = 0;
12140
- for (var z = 0;z < maxDcCount; z++) {
12141
- for (var s = 0;s < rsBlocks.length; s++) {
12142
- if (z < dcdata[s].length) {
12143
- data2[index++] = dcdata[s][z];
12144
- }
12145
- }
12146
- }
12147
- for (var xx = 0;xx < maxEcCount; xx++) {
12148
- for (var t = 0;t < rsBlocks.length; t++) {
12149
- if (xx < ecdata[t].length) {
12150
- data2[index++] = ecdata[t][xx];
12151
- }
12152
- }
12153
- }
12154
- return data2;
12155
- };
12156
- module.exports = QRCode;
12157
- });
12158
-
12159
- // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/lib/main.js
12160
- var require_main = __commonJS((exports, module) => {
12161
- var QRCode = require_QRCode();
12162
- var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
12163
- var black = "\x1B[40m \x1B[0m";
12164
- var white = "\x1B[47m \x1B[0m";
12165
- var toCell = function(isBlack) {
12166
- return isBlack ? black : white;
12167
- };
12168
- var repeat = function(color) {
12169
- return {
12170
- times: function(count) {
12171
- return new Array(count).join(color);
12172
- }
12173
- };
12174
- };
12175
- var fill = function(length, value) {
12176
- var arr = new Array(length);
12177
- for (var i = 0;i < length; i++) {
12178
- arr[i] = value;
12179
- }
12180
- return arr;
12181
- };
12182
- module.exports = {
12183
- error: QRErrorCorrectLevel.L,
12184
- generate: function(input, opts, cb) {
12185
- if (typeof opts === "function") {
12186
- cb = opts;
12187
- opts = {};
12188
- }
12189
- var qrcode = new QRCode(-1, this.error);
12190
- qrcode.addData(input);
12191
- qrcode.make();
12192
- var output = "";
12193
- if (opts && opts.small) {
12194
- var BLACK = true, WHITE = false;
12195
- var moduleCount = qrcode.getModuleCount();
12196
- var moduleData = qrcode.modules.slice();
12197
- var oddRow = moduleCount % 2 === 1;
12198
- if (oddRow) {
12199
- moduleData.push(fill(moduleCount, WHITE));
12200
- }
12201
- var platte = {
12202
- WHITE_ALL: "\u2588",
12203
- WHITE_BLACK: "\u2580",
12204
- BLACK_WHITE: "\u2584",
12205
- BLACK_ALL: " "
12206
- };
12207
- var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3);
12208
- var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3);
12209
- output += borderTop + `
12210
- `;
12211
- for (var row = 0;row < moduleCount; row += 2) {
12212
- output += platte.WHITE_ALL;
12213
- for (var col = 0;col < moduleCount; col++) {
12214
- if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {
12215
- output += platte.WHITE_ALL;
12216
- } else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {
12217
- output += platte.WHITE_BLACK;
12218
- } else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {
12219
- output += platte.BLACK_WHITE;
12220
- } else {
12221
- output += platte.BLACK_ALL;
12222
- }
12223
- }
12224
- output += platte.WHITE_ALL + `
12225
- `;
12226
- }
12227
- if (!oddRow) {
12228
- output += borderBottom;
12229
- }
12230
- } else {
12231
- var border = repeat(white).times(qrcode.getModuleCount() + 3);
12232
- output += border + `
12233
- `;
12234
- qrcode.modules.forEach(function(row2) {
12235
- output += white;
12236
- output += row2.map(toCell).join("");
12237
- output += white + `
12238
- `;
12239
- });
12240
- output += border;
12241
- }
12242
- if (cb)
12243
- cb(output);
12244
- else
12245
- console.log(output);
12246
- },
12247
- setErrorLevel: function(error2) {
12248
- this.error = QRErrorCorrectLevel[error2] || this.error;
12249
- }
12250
- };
12251
- });
12252
-
12253
11236
  // ../core/src/events/types.ts
12254
11237
  function isCoreEvent(type) {
12255
11238
  return CORE_EVENT_TYPES.includes(type);
@@ -29430,7 +28413,7 @@ var require_node_transport = __commonJS((exports) => {
29430
28413
  var util_1 = require_util();
29431
28414
  var tls_1 = __require("tls");
29432
28415
  var { resolve: resolve2 } = __require("path");
29433
- var { readFile, existsSync: existsSync13 } = __require("fs");
28416
+ var { readFile, existsSync: existsSync12 } = __require("fs");
29434
28417
  var dns = __require("dns");
29435
28418
  var VERSION2 = "2.29.3";
29436
28419
  var LANG = "nats.js";
@@ -29546,7 +28529,7 @@ var require_node_transport = __commonJS((exports) => {
29546
28529
  const d = (0, nats_base_client_1.deferred)();
29547
28530
  try {
29548
28531
  fn = resolve2(fn);
29549
- if (!existsSync13(fn)) {
28532
+ if (!existsSync12(fn)) {
29550
28533
  d.reject(new Error(`${fn} doesn't exist`));
29551
28534
  }
29552
28535
  readFile(fn, (err, data2) => {
@@ -30094,7 +29077,7 @@ function getModuleColor(module) {
30094
29077
  const index = hashString(module) % MODULE_COLORS.length;
30095
29078
  return MODULE_COLORS[index] ?? DEFAULT_COLOR;
30096
29079
  }
30097
- function formatTime3(timestamp) {
29080
+ function formatTime2(timestamp) {
30098
29081
  const date = new Date(timestamp);
30099
29082
  const hours = date.getHours().toString().padStart(2, "0");
30100
29083
  const minutes = date.getMinutes().toString().padStart(2, "0");
@@ -30144,7 +29127,7 @@ function formatData(data2) {
30144
29127
  }
30145
29128
  function formatPretty(entry) {
30146
29129
  const { level, time, module, msg, ...data2 } = entry;
30147
- const timeStr = formatTime3(time);
29130
+ const timeStr = formatTime2(time);
30148
29131
  const levelColor = COLORS[level];
30149
29132
  const levelStr = `${levelColor}${LEVEL_LABELS[level]}${COLORS.reset}`;
30150
29133
  const moduleStr = formatModule(module);
@@ -39521,7 +38504,8 @@ var init_channel = __esm(() => {
39521
38504
  "hermes",
39522
38505
  "asc-flow",
39523
38506
  "twilio-whatsapp",
39524
- "internal"
38507
+ "internal",
38508
+ "harness"
39525
38509
  ];
39526
38510
  CONTENT_TYPES = [
39527
38511
  "text",
@@ -74455,8 +73439,8 @@ var init_a2a_provider = __esm(() => {
74455
73439
  // ../core/src/providers/nats-genie-provider.ts
74456
73440
  import { createHash as createHash6 } from "crypto";
74457
73441
  import { mkdir, writeFile } from "fs/promises";
74458
- import { homedir as homedir10 } from "os";
74459
- import { join as join16 } from "path";
73442
+ import { homedir as homedir9 } from "os";
73443
+ import { join as join14 } from "path";
74460
73444
 
74461
73445
  class NatsGenieProvider {
74462
73446
  id;
@@ -74701,10 +73685,10 @@ class NatsGenieProvider {
74701
73685
  }
74702
73686
  async writeDeadLetter(payload, error2) {
74703
73687
  try {
74704
- const dlDir = join16(homedir10(), ".omni", "dead-letters");
73688
+ const dlDir = join14(homedir9(), ".omni", "dead-letters");
74705
73689
  await mkdir(dlDir, { recursive: true });
74706
73690
  const filename = `nats-genie-${Date.now()}-${payload.chatId}.json`;
74707
- await writeFile(join16(dlDir, filename), JSON.stringify({
73691
+ await writeFile(join14(dlDir, filename), JSON.stringify({
74708
73692
  payload,
74709
73693
  error: error2 instanceof Error ? error2.message : String(error2),
74710
73694
  timestamp: new Date().toISOString()
@@ -75865,6 +74849,1023 @@ var init_src2 = __esm(() => {
75865
74849
  init_egress();
75866
74850
  });
75867
74851
 
74852
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
74853
+ var require_QRMode = __commonJS((exports, module) => {
74854
+ module.exports = {
74855
+ MODE_NUMBER: 1 << 0,
74856
+ MODE_ALPHA_NUM: 1 << 1,
74857
+ MODE_8BIT_BYTE: 1 << 2,
74858
+ MODE_KANJI: 1 << 3
74859
+ };
74860
+ });
74861
+
74862
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js
74863
+ var require_QR8bitByte = __commonJS((exports, module) => {
74864
+ var QRMode = require_QRMode();
74865
+ function QR8bitByte(data2) {
74866
+ this.mode = QRMode.MODE_8BIT_BYTE;
74867
+ this.data = data2;
74868
+ }
74869
+ QR8bitByte.prototype = {
74870
+ getLength: function() {
74871
+ return this.data.length;
74872
+ },
74873
+ write: function(buffer3) {
74874
+ for (var i6 = 0;i6 < this.data.length; i6++) {
74875
+ buffer3.put(this.data.charCodeAt(i6), 8);
74876
+ }
74877
+ }
74878
+ };
74879
+ module.exports = QR8bitByte;
74880
+ });
74881
+
74882
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js
74883
+ var require_QRMath = __commonJS((exports, module) => {
74884
+ var QRMath = {
74885
+ glog: function(n2) {
74886
+ if (n2 < 1) {
74887
+ throw new Error("glog(" + n2 + ")");
74888
+ }
74889
+ return QRMath.LOG_TABLE[n2];
74890
+ },
74891
+ gexp: function(n2) {
74892
+ while (n2 < 0) {
74893
+ n2 += 255;
74894
+ }
74895
+ while (n2 >= 256) {
74896
+ n2 -= 255;
74897
+ }
74898
+ return QRMath.EXP_TABLE[n2];
74899
+ },
74900
+ EXP_TABLE: new Array(256),
74901
+ LOG_TABLE: new Array(256)
74902
+ };
74903
+ for (i6 = 0;i6 < 8; i6++) {
74904
+ QRMath.EXP_TABLE[i6] = 1 << i6;
74905
+ }
74906
+ var i6;
74907
+ for (i6 = 8;i6 < 256; i6++) {
74908
+ QRMath.EXP_TABLE[i6] = QRMath.EXP_TABLE[i6 - 4] ^ QRMath.EXP_TABLE[i6 - 5] ^ QRMath.EXP_TABLE[i6 - 6] ^ QRMath.EXP_TABLE[i6 - 8];
74909
+ }
74910
+ var i6;
74911
+ for (i6 = 0;i6 < 255; i6++) {
74912
+ QRMath.LOG_TABLE[QRMath.EXP_TABLE[i6]] = i6;
74913
+ }
74914
+ var i6;
74915
+ module.exports = QRMath;
74916
+ });
74917
+
74918
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js
74919
+ var require_QRPolynomial = __commonJS((exports, module) => {
74920
+ var QRMath = require_QRMath();
74921
+ function QRPolynomial(num, shift) {
74922
+ if (num.length === undefined) {
74923
+ throw new Error(num.length + "/" + shift);
74924
+ }
74925
+ var offset = 0;
74926
+ while (offset < num.length && num[offset] === 0) {
74927
+ offset++;
74928
+ }
74929
+ this.num = new Array(num.length - offset + shift);
74930
+ for (var i6 = 0;i6 < num.length - offset; i6++) {
74931
+ this.num[i6] = num[i6 + offset];
74932
+ }
74933
+ }
74934
+ QRPolynomial.prototype = {
74935
+ get: function(index) {
74936
+ return this.num[index];
74937
+ },
74938
+ getLength: function() {
74939
+ return this.num.length;
74940
+ },
74941
+ multiply: function(e10) {
74942
+ var num = new Array(this.getLength() + e10.getLength() - 1);
74943
+ for (var i6 = 0;i6 < this.getLength(); i6++) {
74944
+ for (var j = 0;j < e10.getLength(); j++) {
74945
+ num[i6 + j] ^= QRMath.gexp(QRMath.glog(this.get(i6)) + QRMath.glog(e10.get(j)));
74946
+ }
74947
+ }
74948
+ return new QRPolynomial(num, 0);
74949
+ },
74950
+ mod: function(e10) {
74951
+ if (this.getLength() - e10.getLength() < 0) {
74952
+ return this;
74953
+ }
74954
+ var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e10.get(0));
74955
+ var num = new Array(this.getLength());
74956
+ for (var i6 = 0;i6 < this.getLength(); i6++) {
74957
+ num[i6] = this.get(i6);
74958
+ }
74959
+ for (var x6 = 0;x6 < e10.getLength(); x6++) {
74960
+ num[x6] ^= QRMath.gexp(QRMath.glog(e10.get(x6)) + ratio);
74961
+ }
74962
+ return new QRPolynomial(num, 0).mod(e10);
74963
+ }
74964
+ };
74965
+ module.exports = QRPolynomial;
74966
+ });
74967
+
74968
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js
74969
+ var require_QRMaskPattern = __commonJS((exports, module) => {
74970
+ module.exports = {
74971
+ PATTERN000: 0,
74972
+ PATTERN001: 1,
74973
+ PATTERN010: 2,
74974
+ PATTERN011: 3,
74975
+ PATTERN100: 4,
74976
+ PATTERN101: 5,
74977
+ PATTERN110: 6,
74978
+ PATTERN111: 7
74979
+ };
74980
+ });
74981
+
74982
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js
74983
+ var require_QRUtil = __commonJS((exports, module) => {
74984
+ var QRMode = require_QRMode();
74985
+ var QRPolynomial = require_QRPolynomial();
74986
+ var QRMath = require_QRMath();
74987
+ var QRMaskPattern = require_QRMaskPattern();
74988
+ var QRUtil = {
74989
+ PATTERN_POSITION_TABLE: [
74990
+ [],
74991
+ [6, 18],
74992
+ [6, 22],
74993
+ [6, 26],
74994
+ [6, 30],
74995
+ [6, 34],
74996
+ [6, 22, 38],
74997
+ [6, 24, 42],
74998
+ [6, 26, 46],
74999
+ [6, 28, 50],
75000
+ [6, 30, 54],
75001
+ [6, 32, 58],
75002
+ [6, 34, 62],
75003
+ [6, 26, 46, 66],
75004
+ [6, 26, 48, 70],
75005
+ [6, 26, 50, 74],
75006
+ [6, 30, 54, 78],
75007
+ [6, 30, 56, 82],
75008
+ [6, 30, 58, 86],
75009
+ [6, 34, 62, 90],
75010
+ [6, 28, 50, 72, 94],
75011
+ [6, 26, 50, 74, 98],
75012
+ [6, 30, 54, 78, 102],
75013
+ [6, 28, 54, 80, 106],
75014
+ [6, 32, 58, 84, 110],
75015
+ [6, 30, 58, 86, 114],
75016
+ [6, 34, 62, 90, 118],
75017
+ [6, 26, 50, 74, 98, 122],
75018
+ [6, 30, 54, 78, 102, 126],
75019
+ [6, 26, 52, 78, 104, 130],
75020
+ [6, 30, 56, 82, 108, 134],
75021
+ [6, 34, 60, 86, 112, 138],
75022
+ [6, 30, 58, 86, 114, 142],
75023
+ [6, 34, 62, 90, 118, 146],
75024
+ [6, 30, 54, 78, 102, 126, 150],
75025
+ [6, 24, 50, 76, 102, 128, 154],
75026
+ [6, 28, 54, 80, 106, 132, 158],
75027
+ [6, 32, 58, 84, 110, 136, 162],
75028
+ [6, 26, 54, 82, 110, 138, 166],
75029
+ [6, 30, 58, 86, 114, 142, 170]
75030
+ ],
75031
+ G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
75032
+ G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
75033
+ G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
75034
+ getBCHTypeInfo: function(data2) {
75035
+ var d6 = data2 << 10;
75036
+ while (QRUtil.getBCHDigit(d6) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
75037
+ d6 ^= QRUtil.G15 << QRUtil.getBCHDigit(d6) - QRUtil.getBCHDigit(QRUtil.G15);
75038
+ }
75039
+ return (data2 << 10 | d6) ^ QRUtil.G15_MASK;
75040
+ },
75041
+ getBCHTypeNumber: function(data2) {
75042
+ var d6 = data2 << 12;
75043
+ while (QRUtil.getBCHDigit(d6) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
75044
+ d6 ^= QRUtil.G18 << QRUtil.getBCHDigit(d6) - QRUtil.getBCHDigit(QRUtil.G18);
75045
+ }
75046
+ return data2 << 12 | d6;
75047
+ },
75048
+ getBCHDigit: function(data2) {
75049
+ var digit = 0;
75050
+ while (data2 !== 0) {
75051
+ digit++;
75052
+ data2 >>>= 1;
75053
+ }
75054
+ return digit;
75055
+ },
75056
+ getPatternPosition: function(typeNumber) {
75057
+ return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
75058
+ },
75059
+ getMask: function(maskPattern, i6, j) {
75060
+ switch (maskPattern) {
75061
+ case QRMaskPattern.PATTERN000:
75062
+ return (i6 + j) % 2 === 0;
75063
+ case QRMaskPattern.PATTERN001:
75064
+ return i6 % 2 === 0;
75065
+ case QRMaskPattern.PATTERN010:
75066
+ return j % 3 === 0;
75067
+ case QRMaskPattern.PATTERN011:
75068
+ return (i6 + j) % 3 === 0;
75069
+ case QRMaskPattern.PATTERN100:
75070
+ return (Math.floor(i6 / 2) + Math.floor(j / 3)) % 2 === 0;
75071
+ case QRMaskPattern.PATTERN101:
75072
+ return i6 * j % 2 + i6 * j % 3 === 0;
75073
+ case QRMaskPattern.PATTERN110:
75074
+ return (i6 * j % 2 + i6 * j % 3) % 2 === 0;
75075
+ case QRMaskPattern.PATTERN111:
75076
+ return (i6 * j % 3 + (i6 + j) % 2) % 2 === 0;
75077
+ default:
75078
+ throw new Error("bad maskPattern:" + maskPattern);
75079
+ }
75080
+ },
75081
+ getErrorCorrectPolynomial: function(errorCorrectLength) {
75082
+ var a2 = new QRPolynomial([1], 0);
75083
+ for (var i6 = 0;i6 < errorCorrectLength; i6++) {
75084
+ a2 = a2.multiply(new QRPolynomial([1, QRMath.gexp(i6)], 0));
75085
+ }
75086
+ return a2;
75087
+ },
75088
+ getLengthInBits: function(mode, type) {
75089
+ if (1 <= type && type < 10) {
75090
+ switch (mode) {
75091
+ case QRMode.MODE_NUMBER:
75092
+ return 10;
75093
+ case QRMode.MODE_ALPHA_NUM:
75094
+ return 9;
75095
+ case QRMode.MODE_8BIT_BYTE:
75096
+ return 8;
75097
+ case QRMode.MODE_KANJI:
75098
+ return 8;
75099
+ default:
75100
+ throw new Error("mode:" + mode);
75101
+ }
75102
+ } else if (type < 27) {
75103
+ switch (mode) {
75104
+ case QRMode.MODE_NUMBER:
75105
+ return 12;
75106
+ case QRMode.MODE_ALPHA_NUM:
75107
+ return 11;
75108
+ case QRMode.MODE_8BIT_BYTE:
75109
+ return 16;
75110
+ case QRMode.MODE_KANJI:
75111
+ return 10;
75112
+ default:
75113
+ throw new Error("mode:" + mode);
75114
+ }
75115
+ } else if (type < 41) {
75116
+ switch (mode) {
75117
+ case QRMode.MODE_NUMBER:
75118
+ return 14;
75119
+ case QRMode.MODE_ALPHA_NUM:
75120
+ return 13;
75121
+ case QRMode.MODE_8BIT_BYTE:
75122
+ return 16;
75123
+ case QRMode.MODE_KANJI:
75124
+ return 12;
75125
+ default:
75126
+ throw new Error("mode:" + mode);
75127
+ }
75128
+ } else {
75129
+ throw new Error("type:" + type);
75130
+ }
75131
+ },
75132
+ getLostPoint: function(qrCode) {
75133
+ var moduleCount = qrCode.getModuleCount();
75134
+ var lostPoint = 0;
75135
+ var row = 0;
75136
+ var col = 0;
75137
+ for (row = 0;row < moduleCount; row++) {
75138
+ for (col = 0;col < moduleCount; col++) {
75139
+ var sameCount = 0;
75140
+ var dark = qrCode.isDark(row, col);
75141
+ for (var r6 = -1;r6 <= 1; r6++) {
75142
+ if (row + r6 < 0 || moduleCount <= row + r6) {
75143
+ continue;
75144
+ }
75145
+ for (var c10 = -1;c10 <= 1; c10++) {
75146
+ if (col + c10 < 0 || moduleCount <= col + c10) {
75147
+ continue;
75148
+ }
75149
+ if (r6 === 0 && c10 === 0) {
75150
+ continue;
75151
+ }
75152
+ if (dark === qrCode.isDark(row + r6, col + c10)) {
75153
+ sameCount++;
75154
+ }
75155
+ }
75156
+ }
75157
+ if (sameCount > 5) {
75158
+ lostPoint += 3 + sameCount - 5;
75159
+ }
75160
+ }
75161
+ }
75162
+ for (row = 0;row < moduleCount - 1; row++) {
75163
+ for (col = 0;col < moduleCount - 1; col++) {
75164
+ var count = 0;
75165
+ if (qrCode.isDark(row, col))
75166
+ count++;
75167
+ if (qrCode.isDark(row + 1, col))
75168
+ count++;
75169
+ if (qrCode.isDark(row, col + 1))
75170
+ count++;
75171
+ if (qrCode.isDark(row + 1, col + 1))
75172
+ count++;
75173
+ if (count === 0 || count === 4) {
75174
+ lostPoint += 3;
75175
+ }
75176
+ }
75177
+ }
75178
+ for (row = 0;row < moduleCount; row++) {
75179
+ for (col = 0;col < moduleCount - 6; col++) {
75180
+ if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
75181
+ lostPoint += 40;
75182
+ }
75183
+ }
75184
+ }
75185
+ for (col = 0;col < moduleCount; col++) {
75186
+ for (row = 0;row < moduleCount - 6; row++) {
75187
+ if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
75188
+ lostPoint += 40;
75189
+ }
75190
+ }
75191
+ }
75192
+ var darkCount = 0;
75193
+ for (col = 0;col < moduleCount; col++) {
75194
+ for (row = 0;row < moduleCount; row++) {
75195
+ if (qrCode.isDark(row, col)) {
75196
+ darkCount++;
75197
+ }
75198
+ }
75199
+ }
75200
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
75201
+ lostPoint += ratio * 10;
75202
+ return lostPoint;
75203
+ }
75204
+ };
75205
+ module.exports = QRUtil;
75206
+ });
75207
+
75208
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js
75209
+ var require_QRErrorCorrectLevel = __commonJS((exports, module) => {
75210
+ module.exports = {
75211
+ L: 1,
75212
+ M: 0,
75213
+ Q: 3,
75214
+ H: 2
75215
+ };
75216
+ });
75217
+
75218
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js
75219
+ var require_QRRSBlock = __commonJS((exports, module) => {
75220
+ var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
75221
+ function QRRSBlock(totalCount, dataCount) {
75222
+ this.totalCount = totalCount;
75223
+ this.dataCount = dataCount;
75224
+ }
75225
+ QRRSBlock.RS_BLOCK_TABLE = [
75226
+ [1, 26, 19],
75227
+ [1, 26, 16],
75228
+ [1, 26, 13],
75229
+ [1, 26, 9],
75230
+ [1, 44, 34],
75231
+ [1, 44, 28],
75232
+ [1, 44, 22],
75233
+ [1, 44, 16],
75234
+ [1, 70, 55],
75235
+ [1, 70, 44],
75236
+ [2, 35, 17],
75237
+ [2, 35, 13],
75238
+ [1, 100, 80],
75239
+ [2, 50, 32],
75240
+ [2, 50, 24],
75241
+ [4, 25, 9],
75242
+ [1, 134, 108],
75243
+ [2, 67, 43],
75244
+ [2, 33, 15, 2, 34, 16],
75245
+ [2, 33, 11, 2, 34, 12],
75246
+ [2, 86, 68],
75247
+ [4, 43, 27],
75248
+ [4, 43, 19],
75249
+ [4, 43, 15],
75250
+ [2, 98, 78],
75251
+ [4, 49, 31],
75252
+ [2, 32, 14, 4, 33, 15],
75253
+ [4, 39, 13, 1, 40, 14],
75254
+ [2, 121, 97],
75255
+ [2, 60, 38, 2, 61, 39],
75256
+ [4, 40, 18, 2, 41, 19],
75257
+ [4, 40, 14, 2, 41, 15],
75258
+ [2, 146, 116],
75259
+ [3, 58, 36, 2, 59, 37],
75260
+ [4, 36, 16, 4, 37, 17],
75261
+ [4, 36, 12, 4, 37, 13],
75262
+ [2, 86, 68, 2, 87, 69],
75263
+ [4, 69, 43, 1, 70, 44],
75264
+ [6, 43, 19, 2, 44, 20],
75265
+ [6, 43, 15, 2, 44, 16],
75266
+ [4, 101, 81],
75267
+ [1, 80, 50, 4, 81, 51],
75268
+ [4, 50, 22, 4, 51, 23],
75269
+ [3, 36, 12, 8, 37, 13],
75270
+ [2, 116, 92, 2, 117, 93],
75271
+ [6, 58, 36, 2, 59, 37],
75272
+ [4, 46, 20, 6, 47, 21],
75273
+ [7, 42, 14, 4, 43, 15],
75274
+ [4, 133, 107],
75275
+ [8, 59, 37, 1, 60, 38],
75276
+ [8, 44, 20, 4, 45, 21],
75277
+ [12, 33, 11, 4, 34, 12],
75278
+ [3, 145, 115, 1, 146, 116],
75279
+ [4, 64, 40, 5, 65, 41],
75280
+ [11, 36, 16, 5, 37, 17],
75281
+ [11, 36, 12, 5, 37, 13],
75282
+ [5, 109, 87, 1, 110, 88],
75283
+ [5, 65, 41, 5, 66, 42],
75284
+ [5, 54, 24, 7, 55, 25],
75285
+ [11, 36, 12],
75286
+ [5, 122, 98, 1, 123, 99],
75287
+ [7, 73, 45, 3, 74, 46],
75288
+ [15, 43, 19, 2, 44, 20],
75289
+ [3, 45, 15, 13, 46, 16],
75290
+ [1, 135, 107, 5, 136, 108],
75291
+ [10, 74, 46, 1, 75, 47],
75292
+ [1, 50, 22, 15, 51, 23],
75293
+ [2, 42, 14, 17, 43, 15],
75294
+ [5, 150, 120, 1, 151, 121],
75295
+ [9, 69, 43, 4, 70, 44],
75296
+ [17, 50, 22, 1, 51, 23],
75297
+ [2, 42, 14, 19, 43, 15],
75298
+ [3, 141, 113, 4, 142, 114],
75299
+ [3, 70, 44, 11, 71, 45],
75300
+ [17, 47, 21, 4, 48, 22],
75301
+ [9, 39, 13, 16, 40, 14],
75302
+ [3, 135, 107, 5, 136, 108],
75303
+ [3, 67, 41, 13, 68, 42],
75304
+ [15, 54, 24, 5, 55, 25],
75305
+ [15, 43, 15, 10, 44, 16],
75306
+ [4, 144, 116, 4, 145, 117],
75307
+ [17, 68, 42],
75308
+ [17, 50, 22, 6, 51, 23],
75309
+ [19, 46, 16, 6, 47, 17],
75310
+ [2, 139, 111, 7, 140, 112],
75311
+ [17, 74, 46],
75312
+ [7, 54, 24, 16, 55, 25],
75313
+ [34, 37, 13],
75314
+ [4, 151, 121, 5, 152, 122],
75315
+ [4, 75, 47, 14, 76, 48],
75316
+ [11, 54, 24, 14, 55, 25],
75317
+ [16, 45, 15, 14, 46, 16],
75318
+ [6, 147, 117, 4, 148, 118],
75319
+ [6, 73, 45, 14, 74, 46],
75320
+ [11, 54, 24, 16, 55, 25],
75321
+ [30, 46, 16, 2, 47, 17],
75322
+ [8, 132, 106, 4, 133, 107],
75323
+ [8, 75, 47, 13, 76, 48],
75324
+ [7, 54, 24, 22, 55, 25],
75325
+ [22, 45, 15, 13, 46, 16],
75326
+ [10, 142, 114, 2, 143, 115],
75327
+ [19, 74, 46, 4, 75, 47],
75328
+ [28, 50, 22, 6, 51, 23],
75329
+ [33, 46, 16, 4, 47, 17],
75330
+ [8, 152, 122, 4, 153, 123],
75331
+ [22, 73, 45, 3, 74, 46],
75332
+ [8, 53, 23, 26, 54, 24],
75333
+ [12, 45, 15, 28, 46, 16],
75334
+ [3, 147, 117, 10, 148, 118],
75335
+ [3, 73, 45, 23, 74, 46],
75336
+ [4, 54, 24, 31, 55, 25],
75337
+ [11, 45, 15, 31, 46, 16],
75338
+ [7, 146, 116, 7, 147, 117],
75339
+ [21, 73, 45, 7, 74, 46],
75340
+ [1, 53, 23, 37, 54, 24],
75341
+ [19, 45, 15, 26, 46, 16],
75342
+ [5, 145, 115, 10, 146, 116],
75343
+ [19, 75, 47, 10, 76, 48],
75344
+ [15, 54, 24, 25, 55, 25],
75345
+ [23, 45, 15, 25, 46, 16],
75346
+ [13, 145, 115, 3, 146, 116],
75347
+ [2, 74, 46, 29, 75, 47],
75348
+ [42, 54, 24, 1, 55, 25],
75349
+ [23, 45, 15, 28, 46, 16],
75350
+ [17, 145, 115],
75351
+ [10, 74, 46, 23, 75, 47],
75352
+ [10, 54, 24, 35, 55, 25],
75353
+ [19, 45, 15, 35, 46, 16],
75354
+ [17, 145, 115, 1, 146, 116],
75355
+ [14, 74, 46, 21, 75, 47],
75356
+ [29, 54, 24, 19, 55, 25],
75357
+ [11, 45, 15, 46, 46, 16],
75358
+ [13, 145, 115, 6, 146, 116],
75359
+ [14, 74, 46, 23, 75, 47],
75360
+ [44, 54, 24, 7, 55, 25],
75361
+ [59, 46, 16, 1, 47, 17],
75362
+ [12, 151, 121, 7, 152, 122],
75363
+ [12, 75, 47, 26, 76, 48],
75364
+ [39, 54, 24, 14, 55, 25],
75365
+ [22, 45, 15, 41, 46, 16],
75366
+ [6, 151, 121, 14, 152, 122],
75367
+ [6, 75, 47, 34, 76, 48],
75368
+ [46, 54, 24, 10, 55, 25],
75369
+ [2, 45, 15, 64, 46, 16],
75370
+ [17, 152, 122, 4, 153, 123],
75371
+ [29, 74, 46, 14, 75, 47],
75372
+ [49, 54, 24, 10, 55, 25],
75373
+ [24, 45, 15, 46, 46, 16],
75374
+ [4, 152, 122, 18, 153, 123],
75375
+ [13, 74, 46, 32, 75, 47],
75376
+ [48, 54, 24, 14, 55, 25],
75377
+ [42, 45, 15, 32, 46, 16],
75378
+ [20, 147, 117, 4, 148, 118],
75379
+ [40, 75, 47, 7, 76, 48],
75380
+ [43, 54, 24, 22, 55, 25],
75381
+ [10, 45, 15, 67, 46, 16],
75382
+ [19, 148, 118, 6, 149, 119],
75383
+ [18, 75, 47, 31, 76, 48],
75384
+ [34, 54, 24, 34, 55, 25],
75385
+ [20, 45, 15, 61, 46, 16]
75386
+ ];
75387
+ QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
75388
+ var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
75389
+ if (rsBlock === undefined) {
75390
+ throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
75391
+ }
75392
+ var length = rsBlock.length / 3;
75393
+ var list2 = [];
75394
+ for (var i6 = 0;i6 < length; i6++) {
75395
+ var count = rsBlock[i6 * 3 + 0];
75396
+ var totalCount = rsBlock[i6 * 3 + 1];
75397
+ var dataCount = rsBlock[i6 * 3 + 2];
75398
+ for (var j = 0;j < count; j++) {
75399
+ list2.push(new QRRSBlock(totalCount, dataCount));
75400
+ }
75401
+ }
75402
+ return list2;
75403
+ };
75404
+ QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
75405
+ switch (errorCorrectLevel) {
75406
+ case QRErrorCorrectLevel.L:
75407
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
75408
+ case QRErrorCorrectLevel.M:
75409
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
75410
+ case QRErrorCorrectLevel.Q:
75411
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
75412
+ case QRErrorCorrectLevel.H:
75413
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
75414
+ default:
75415
+ return;
75416
+ }
75417
+ };
75418
+ module.exports = QRRSBlock;
75419
+ });
75420
+
75421
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js
75422
+ var require_QRBitBuffer = __commonJS((exports, module) => {
75423
+ function QRBitBuffer() {
75424
+ this.buffer = [];
75425
+ this.length = 0;
75426
+ }
75427
+ QRBitBuffer.prototype = {
75428
+ get: function(index) {
75429
+ var bufIndex = Math.floor(index / 8);
75430
+ return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
75431
+ },
75432
+ put: function(num, length) {
75433
+ for (var i6 = 0;i6 < length; i6++) {
75434
+ this.putBit((num >>> length - i6 - 1 & 1) == 1);
75435
+ }
75436
+ },
75437
+ getLengthInBits: function() {
75438
+ return this.length;
75439
+ },
75440
+ putBit: function(bit) {
75441
+ var bufIndex = Math.floor(this.length / 8);
75442
+ if (this.buffer.length <= bufIndex) {
75443
+ this.buffer.push(0);
75444
+ }
75445
+ if (bit) {
75446
+ this.buffer[bufIndex] |= 128 >>> this.length % 8;
75447
+ }
75448
+ this.length++;
75449
+ }
75450
+ };
75451
+ module.exports = QRBitBuffer;
75452
+ });
75453
+
75454
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/index.js
75455
+ var require_QRCode = __commonJS((exports, module) => {
75456
+ var QR8bitByte = require_QR8bitByte();
75457
+ var QRUtil = require_QRUtil();
75458
+ var QRPolynomial = require_QRPolynomial();
75459
+ var QRRSBlock = require_QRRSBlock();
75460
+ var QRBitBuffer = require_QRBitBuffer();
75461
+ function QRCode(typeNumber, errorCorrectLevel) {
75462
+ this.typeNumber = typeNumber;
75463
+ this.errorCorrectLevel = errorCorrectLevel;
75464
+ this.modules = null;
75465
+ this.moduleCount = 0;
75466
+ this.dataCache = null;
75467
+ this.dataList = [];
75468
+ }
75469
+ QRCode.prototype = {
75470
+ addData: function(data2) {
75471
+ var newData = new QR8bitByte(data2);
75472
+ this.dataList.push(newData);
75473
+ this.dataCache = null;
75474
+ },
75475
+ isDark: function(row, col) {
75476
+ if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
75477
+ throw new Error(row + "," + col);
75478
+ }
75479
+ return this.modules[row][col];
75480
+ },
75481
+ getModuleCount: function() {
75482
+ return this.moduleCount;
75483
+ },
75484
+ make: function() {
75485
+ if (this.typeNumber < 1) {
75486
+ var typeNumber = 1;
75487
+ for (typeNumber = 1;typeNumber < 40; typeNumber++) {
75488
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
75489
+ var buffer3 = new QRBitBuffer;
75490
+ var totalDataCount = 0;
75491
+ for (var i6 = 0;i6 < rsBlocks.length; i6++) {
75492
+ totalDataCount += rsBlocks[i6].dataCount;
75493
+ }
75494
+ for (var x6 = 0;x6 < this.dataList.length; x6++) {
75495
+ var data2 = this.dataList[x6];
75496
+ buffer3.put(data2.mode, 4);
75497
+ buffer3.put(data2.getLength(), QRUtil.getLengthInBits(data2.mode, typeNumber));
75498
+ data2.write(buffer3);
75499
+ }
75500
+ if (buffer3.getLengthInBits() <= totalDataCount * 8)
75501
+ break;
75502
+ }
75503
+ this.typeNumber = typeNumber;
75504
+ }
75505
+ this.makeImpl(false, this.getBestMaskPattern());
75506
+ },
75507
+ makeImpl: function(test, maskPattern) {
75508
+ this.moduleCount = this.typeNumber * 4 + 17;
75509
+ this.modules = new Array(this.moduleCount);
75510
+ for (var row = 0;row < this.moduleCount; row++) {
75511
+ this.modules[row] = new Array(this.moduleCount);
75512
+ for (var col = 0;col < this.moduleCount; col++) {
75513
+ this.modules[row][col] = null;
75514
+ }
75515
+ }
75516
+ this.setupPositionProbePattern(0, 0);
75517
+ this.setupPositionProbePattern(this.moduleCount - 7, 0);
75518
+ this.setupPositionProbePattern(0, this.moduleCount - 7);
75519
+ this.setupPositionAdjustPattern();
75520
+ this.setupTimingPattern();
75521
+ this.setupTypeInfo(test, maskPattern);
75522
+ if (this.typeNumber >= 7) {
75523
+ this.setupTypeNumber(test);
75524
+ }
75525
+ if (this.dataCache === null) {
75526
+ this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
75527
+ }
75528
+ this.mapData(this.dataCache, maskPattern);
75529
+ },
75530
+ setupPositionProbePattern: function(row, col) {
75531
+ for (var r6 = -1;r6 <= 7; r6++) {
75532
+ if (row + r6 <= -1 || this.moduleCount <= row + r6)
75533
+ continue;
75534
+ for (var c10 = -1;c10 <= 7; c10++) {
75535
+ if (col + c10 <= -1 || this.moduleCount <= col + c10)
75536
+ continue;
75537
+ if (0 <= r6 && r6 <= 6 && (c10 === 0 || c10 === 6) || 0 <= c10 && c10 <= 6 && (r6 === 0 || r6 === 6) || 2 <= r6 && r6 <= 4 && 2 <= c10 && c10 <= 4) {
75538
+ this.modules[row + r6][col + c10] = true;
75539
+ } else {
75540
+ this.modules[row + r6][col + c10] = false;
75541
+ }
75542
+ }
75543
+ }
75544
+ },
75545
+ getBestMaskPattern: function() {
75546
+ var minLostPoint = 0;
75547
+ var pattern = 0;
75548
+ for (var i6 = 0;i6 < 8; i6++) {
75549
+ this.makeImpl(true, i6);
75550
+ var lostPoint = QRUtil.getLostPoint(this);
75551
+ if (i6 === 0 || minLostPoint > lostPoint) {
75552
+ minLostPoint = lostPoint;
75553
+ pattern = i6;
75554
+ }
75555
+ }
75556
+ return pattern;
75557
+ },
75558
+ createMovieClip: function(target_mc, instance_name, depth) {
75559
+ var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
75560
+ var cs = 1;
75561
+ this.make();
75562
+ for (var row = 0;row < this.modules.length; row++) {
75563
+ var y10 = row * cs;
75564
+ for (var col = 0;col < this.modules[row].length; col++) {
75565
+ var x6 = col * cs;
75566
+ var dark = this.modules[row][col];
75567
+ if (dark) {
75568
+ qr_mc.beginFill(0, 100);
75569
+ qr_mc.moveTo(x6, y10);
75570
+ qr_mc.lineTo(x6 + cs, y10);
75571
+ qr_mc.lineTo(x6 + cs, y10 + cs);
75572
+ qr_mc.lineTo(x6, y10 + cs);
75573
+ qr_mc.endFill();
75574
+ }
75575
+ }
75576
+ }
75577
+ return qr_mc;
75578
+ },
75579
+ setupTimingPattern: function() {
75580
+ for (var r6 = 8;r6 < this.moduleCount - 8; r6++) {
75581
+ if (this.modules[r6][6] !== null) {
75582
+ continue;
75583
+ }
75584
+ this.modules[r6][6] = r6 % 2 === 0;
75585
+ }
75586
+ for (var c10 = 8;c10 < this.moduleCount - 8; c10++) {
75587
+ if (this.modules[6][c10] !== null) {
75588
+ continue;
75589
+ }
75590
+ this.modules[6][c10] = c10 % 2 === 0;
75591
+ }
75592
+ },
75593
+ setupPositionAdjustPattern: function() {
75594
+ var pos = QRUtil.getPatternPosition(this.typeNumber);
75595
+ for (var i6 = 0;i6 < pos.length; i6++) {
75596
+ for (var j = 0;j < pos.length; j++) {
75597
+ var row = pos[i6];
75598
+ var col = pos[j];
75599
+ if (this.modules[row][col] !== null) {
75600
+ continue;
75601
+ }
75602
+ for (var r6 = -2;r6 <= 2; r6++) {
75603
+ for (var c10 = -2;c10 <= 2; c10++) {
75604
+ if (Math.abs(r6) === 2 || Math.abs(c10) === 2 || r6 === 0 && c10 === 0) {
75605
+ this.modules[row + r6][col + c10] = true;
75606
+ } else {
75607
+ this.modules[row + r6][col + c10] = false;
75608
+ }
75609
+ }
75610
+ }
75611
+ }
75612
+ }
75613
+ },
75614
+ setupTypeNumber: function(test) {
75615
+ var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
75616
+ var mod;
75617
+ for (var i6 = 0;i6 < 18; i6++) {
75618
+ mod = !test && (bits >> i6 & 1) === 1;
75619
+ this.modules[Math.floor(i6 / 3)][i6 % 3 + this.moduleCount - 8 - 3] = mod;
75620
+ }
75621
+ for (var x6 = 0;x6 < 18; x6++) {
75622
+ mod = !test && (bits >> x6 & 1) === 1;
75623
+ this.modules[x6 % 3 + this.moduleCount - 8 - 3][Math.floor(x6 / 3)] = mod;
75624
+ }
75625
+ },
75626
+ setupTypeInfo: function(test, maskPattern) {
75627
+ var data2 = this.errorCorrectLevel << 3 | maskPattern;
75628
+ var bits = QRUtil.getBCHTypeInfo(data2);
75629
+ var mod;
75630
+ for (var v4 = 0;v4 < 15; v4++) {
75631
+ mod = !test && (bits >> v4 & 1) === 1;
75632
+ if (v4 < 6) {
75633
+ this.modules[v4][8] = mod;
75634
+ } else if (v4 < 8) {
75635
+ this.modules[v4 + 1][8] = mod;
75636
+ } else {
75637
+ this.modules[this.moduleCount - 15 + v4][8] = mod;
75638
+ }
75639
+ }
75640
+ for (var h10 = 0;h10 < 15; h10++) {
75641
+ mod = !test && (bits >> h10 & 1) === 1;
75642
+ if (h10 < 8) {
75643
+ this.modules[8][this.moduleCount - h10 - 1] = mod;
75644
+ } else if (h10 < 9) {
75645
+ this.modules[8][15 - h10 - 1 + 1] = mod;
75646
+ } else {
75647
+ this.modules[8][15 - h10 - 1] = mod;
75648
+ }
75649
+ }
75650
+ this.modules[this.moduleCount - 8][8] = !test;
75651
+ },
75652
+ mapData: function(data2, maskPattern) {
75653
+ var inc = -1;
75654
+ var row = this.moduleCount - 1;
75655
+ var bitIndex = 7;
75656
+ var byteIndex = 0;
75657
+ for (var col = this.moduleCount - 1;col > 0; col -= 2) {
75658
+ if (col === 6)
75659
+ col--;
75660
+ while (true) {
75661
+ for (var c10 = 0;c10 < 2; c10++) {
75662
+ if (this.modules[row][col - c10] === null) {
75663
+ var dark = false;
75664
+ if (byteIndex < data2.length) {
75665
+ dark = (data2[byteIndex] >>> bitIndex & 1) === 1;
75666
+ }
75667
+ var mask = QRUtil.getMask(maskPattern, row, col - c10);
75668
+ if (mask) {
75669
+ dark = !dark;
75670
+ }
75671
+ this.modules[row][col - c10] = dark;
75672
+ bitIndex--;
75673
+ if (bitIndex === -1) {
75674
+ byteIndex++;
75675
+ bitIndex = 7;
75676
+ }
75677
+ }
75678
+ }
75679
+ row += inc;
75680
+ if (row < 0 || this.moduleCount <= row) {
75681
+ row -= inc;
75682
+ inc = -inc;
75683
+ break;
75684
+ }
75685
+ }
75686
+ }
75687
+ }
75688
+ };
75689
+ QRCode.PAD0 = 236;
75690
+ QRCode.PAD1 = 17;
75691
+ QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
75692
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
75693
+ var buffer3 = new QRBitBuffer;
75694
+ for (var i6 = 0;i6 < dataList.length; i6++) {
75695
+ var data2 = dataList[i6];
75696
+ buffer3.put(data2.mode, 4);
75697
+ buffer3.put(data2.getLength(), QRUtil.getLengthInBits(data2.mode, typeNumber));
75698
+ data2.write(buffer3);
75699
+ }
75700
+ var totalDataCount = 0;
75701
+ for (var x6 = 0;x6 < rsBlocks.length; x6++) {
75702
+ totalDataCount += rsBlocks[x6].dataCount;
75703
+ }
75704
+ if (buffer3.getLengthInBits() > totalDataCount * 8) {
75705
+ throw new Error("code length overflow. (" + buffer3.getLengthInBits() + ">" + totalDataCount * 8 + ")");
75706
+ }
75707
+ if (buffer3.getLengthInBits() + 4 <= totalDataCount * 8) {
75708
+ buffer3.put(0, 4);
75709
+ }
75710
+ while (buffer3.getLengthInBits() % 8 !== 0) {
75711
+ buffer3.putBit(false);
75712
+ }
75713
+ while (true) {
75714
+ if (buffer3.getLengthInBits() >= totalDataCount * 8) {
75715
+ break;
75716
+ }
75717
+ buffer3.put(QRCode.PAD0, 8);
75718
+ if (buffer3.getLengthInBits() >= totalDataCount * 8) {
75719
+ break;
75720
+ }
75721
+ buffer3.put(QRCode.PAD1, 8);
75722
+ }
75723
+ return QRCode.createBytes(buffer3, rsBlocks);
75724
+ };
75725
+ QRCode.createBytes = function(buffer3, rsBlocks) {
75726
+ var offset = 0;
75727
+ var maxDcCount = 0;
75728
+ var maxEcCount = 0;
75729
+ var dcdata = new Array(rsBlocks.length);
75730
+ var ecdata = new Array(rsBlocks.length);
75731
+ for (var r6 = 0;r6 < rsBlocks.length; r6++) {
75732
+ var dcCount = rsBlocks[r6].dataCount;
75733
+ var ecCount = rsBlocks[r6].totalCount - dcCount;
75734
+ maxDcCount = Math.max(maxDcCount, dcCount);
75735
+ maxEcCount = Math.max(maxEcCount, ecCount);
75736
+ dcdata[r6] = new Array(dcCount);
75737
+ for (var i6 = 0;i6 < dcdata[r6].length; i6++) {
75738
+ dcdata[r6][i6] = 255 & buffer3.buffer[i6 + offset];
75739
+ }
75740
+ offset += dcCount;
75741
+ var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
75742
+ var rawPoly = new QRPolynomial(dcdata[r6], rsPoly.getLength() - 1);
75743
+ var modPoly = rawPoly.mod(rsPoly);
75744
+ ecdata[r6] = new Array(rsPoly.getLength() - 1);
75745
+ for (var x6 = 0;x6 < ecdata[r6].length; x6++) {
75746
+ var modIndex = x6 + modPoly.getLength() - ecdata[r6].length;
75747
+ ecdata[r6][x6] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
75748
+ }
75749
+ }
75750
+ var totalCodeCount = 0;
75751
+ for (var y10 = 0;y10 < rsBlocks.length; y10++) {
75752
+ totalCodeCount += rsBlocks[y10].totalCount;
75753
+ }
75754
+ var data2 = new Array(totalCodeCount);
75755
+ var index = 0;
75756
+ for (var z = 0;z < maxDcCount; z++) {
75757
+ for (var s2 = 0;s2 < rsBlocks.length; s2++) {
75758
+ if (z < dcdata[s2].length) {
75759
+ data2[index++] = dcdata[s2][z];
75760
+ }
75761
+ }
75762
+ }
75763
+ for (var xx2 = 0;xx2 < maxEcCount; xx2++) {
75764
+ for (var t = 0;t < rsBlocks.length; t++) {
75765
+ if (xx2 < ecdata[t].length) {
75766
+ data2[index++] = ecdata[t][xx2];
75767
+ }
75768
+ }
75769
+ }
75770
+ return data2;
75771
+ };
75772
+ module.exports = QRCode;
75773
+ });
75774
+
75775
+ // ../../node_modules/.bun/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/lib/main.js
75776
+ var require_main = __commonJS((exports, module) => {
75777
+ var QRCode = require_QRCode();
75778
+ var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
75779
+ var black = "\x1B[40m \x1B[0m";
75780
+ var white = "\x1B[47m \x1B[0m";
75781
+ var toCell = function(isBlack) {
75782
+ return isBlack ? black : white;
75783
+ };
75784
+ var repeat = function(color) {
75785
+ return {
75786
+ times: function(count) {
75787
+ return new Array(count).join(color);
75788
+ }
75789
+ };
75790
+ };
75791
+ var fill = function(length, value) {
75792
+ var arr = new Array(length);
75793
+ for (var i6 = 0;i6 < length; i6++) {
75794
+ arr[i6] = value;
75795
+ }
75796
+ return arr;
75797
+ };
75798
+ module.exports = {
75799
+ error: QRErrorCorrectLevel.L,
75800
+ generate: function(input, opts, cb2) {
75801
+ if (typeof opts === "function") {
75802
+ cb2 = opts;
75803
+ opts = {};
75804
+ }
75805
+ var qrcode = new QRCode(-1, this.error);
75806
+ qrcode.addData(input);
75807
+ qrcode.make();
75808
+ var output = "";
75809
+ if (opts && opts.small) {
75810
+ var BLACK = true, WHITE = false;
75811
+ var moduleCount = qrcode.getModuleCount();
75812
+ var moduleData = qrcode.modules.slice();
75813
+ var oddRow = moduleCount % 2 === 1;
75814
+ if (oddRow) {
75815
+ moduleData.push(fill(moduleCount, WHITE));
75816
+ }
75817
+ var platte = {
75818
+ WHITE_ALL: "\u2588",
75819
+ WHITE_BLACK: "\u2580",
75820
+ BLACK_WHITE: "\u2584",
75821
+ BLACK_ALL: " "
75822
+ };
75823
+ var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3);
75824
+ var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3);
75825
+ output += borderTop + `
75826
+ `;
75827
+ for (var row = 0;row < moduleCount; row += 2) {
75828
+ output += platte.WHITE_ALL;
75829
+ for (var col = 0;col < moduleCount; col++) {
75830
+ if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {
75831
+ output += platte.WHITE_ALL;
75832
+ } else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {
75833
+ output += platte.WHITE_BLACK;
75834
+ } else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {
75835
+ output += platte.BLACK_WHITE;
75836
+ } else {
75837
+ output += platte.BLACK_ALL;
75838
+ }
75839
+ }
75840
+ output += platte.WHITE_ALL + `
75841
+ `;
75842
+ }
75843
+ if (!oddRow) {
75844
+ output += borderBottom;
75845
+ }
75846
+ } else {
75847
+ var border = repeat(white).times(qrcode.getModuleCount() + 3);
75848
+ output += border + `
75849
+ `;
75850
+ qrcode.modules.forEach(function(row2) {
75851
+ output += white;
75852
+ output += row2.map(toCell).join("");
75853
+ output += white + `
75854
+ `;
75855
+ });
75856
+ output += border;
75857
+ }
75858
+ if (cb2)
75859
+ cb2(output);
75860
+ else
75861
+ console.log(output);
75862
+ },
75863
+ setErrorLevel: function(error2) {
75864
+ this.error = QRErrorCorrectLevel[error2] || this.error;
75865
+ }
75866
+ };
75867
+ });
75868
+
75868
75869
  // ../../node_modules/.bun/drizzle-orm@0.38.4+db1fc555b1037084/node_modules/drizzle-orm/entity.js
75869
75870
  function is(value, type) {
75870
75871
  if (!value || typeof value !== "object") {
@@ -81286,7 +81287,8 @@ var init_schema2 = __esm(() => {
81286
81287
  "hermes",
81287
81288
  "asc-flow",
81288
81289
  "twilio-whatsapp",
81289
- "internal"
81290
+ "internal",
81291
+ "harness"
81290
81292
  ];
81291
81293
  agentTypes = ["agent", "team", "workflow"];
81292
81294
  agentSystems = ["claude", "agno", "openai", "gemini", "custom", "omni-internal"];
@@ -136388,7 +136390,7 @@ import { fileURLToPath } from "url";
136388
136390
  // package.json
136389
136391
  var package_default = {
136390
136392
  name: "@automagik/omni",
136391
- version: "2.260906.8",
136393
+ version: "2.260907.2",
136392
136394
  repository: {
136393
136395
  type: "git",
136394
136396
  url: "git+https://github.com/automagik-dev/omni.git",
@@ -136467,6 +136469,7 @@ var package_default = {
136467
136469
  "@omni/api": "workspace:*",
136468
136470
  "@omni/channel-a2a": "workspace:*",
136469
136471
  "@omni/channel-asc-flow": "workspace:*",
136472
+ "@omni/channel-harness": "workspace:*",
136470
136473
  "@omni/channel-discord": "workspace:*",
136471
136474
  "@omni/channel-gupshup": "workspace:*",
136472
136475
  "@omni/channel-hermes": "workspace:*",
@@ -139056,7 +139059,8 @@ var VALID_CHANNELS = [
139056
139059
  "telegram",
139057
139060
  "twilio-whatsapp",
139058
139061
  "hermes",
139059
- "asc-flow"
139062
+ "asc-flow",
139063
+ "harness"
139060
139064
  ];
139061
139065
  async function buildInstanceNameMap(client) {
139062
139066
  try {
@@ -142885,7 +142889,9 @@ function createDoneCommand() {
142885
142889
  }
142886
142890
 
142887
142891
  // src/commands/events.ts
142888
- import { readFileSync as readFileSync8 } from "fs";
142892
+ init_src2();
142893
+ import { readFileSync as readFileSync9 } from "fs";
142894
+ init_zod();
142889
142895
  init_config();
142890
142896
  init_output();
142891
142897
  function parseSinceTime(since) {
@@ -142948,18 +142954,18 @@ async function startReplay(client, options) {
142948
142954
  }
142949
142955
  async function listReplays(client) {
142950
142956
  const sessions = await client.eventOps.listReplays();
142951
- const items = sessions.map((s) => ({
142952
- id: s.id,
142953
- status: s.status,
142954
- since: s.options.since,
142955
- until: s.options.until ?? "-",
142956
- progress: s.progress ?? "-"
142957
+ const items = sessions.map((s2) => ({
142958
+ id: s2.id,
142959
+ status: s2.status,
142960
+ since: s2.options.since,
142961
+ until: s2.options.until ?? "-",
142962
+ progress: s2.progress ?? "-"
142957
142963
  }));
142958
142964
  list(items, { emptyMessage: "No replay sessions found." });
142959
142965
  }
142960
142966
  async function fetchAnalytics(options) {
142961
- const config = loadConfig();
142962
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
142967
+ const config2 = loadConfig();
142968
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
142963
142969
  const params = new URLSearchParams;
142964
142970
  if (options.instance) {
142965
142971
  const instanceId = await resolveInstanceId(options.instance);
@@ -142970,7 +142976,7 @@ async function fetchAnalytics(options) {
142970
142976
  if (options.since)
142971
142977
  params.set("since", parseSinceTime(options.since));
142972
142978
  const resp = await fetch(`${baseUrl}/api/v2/events/analytics?${params}`, {
142973
- headers: { "x-api-key": config.apiKey ?? "" }
142979
+ headers: { "x-api-key": config2.apiKey ?? "" }
142974
142980
  });
142975
142981
  if (!resp.ok) {
142976
142982
  throw new Error(`API returned ${resp.status}: ${await resp.text()}`);
@@ -143005,19 +143011,19 @@ function displayAnalytics(data2) {
143005
143011
  displayRecordBreakdown("Error Stages", data2.errorStages, "stage");
143006
143012
  }
143007
143013
  }
143008
- function displayRecordBreakdown(title, record, keyName) {
143009
- if (!record || Object.keys(record).length === 0)
143014
+ function displayRecordBreakdown(title, record2, keyName) {
143015
+ if (!record2 || Object.keys(record2).length === 0)
143010
143016
  return;
143011
143017
  raw(`
143012
143018
  ${title}:`);
143013
- const items = Object.entries(record).sort(([, a], [, b2]) => b2 - a).map(([key, count]) => ({ [keyName]: key, count }));
143019
+ const items = Object.entries(record2).sort(([, a2], [, b7]) => b7 - a2).map(([key, count]) => ({ [keyName]: key, count }));
143014
143020
  list(items);
143015
143021
  }
143016
143022
  async function fetchTrace(id) {
143017
- const config = loadConfig();
143018
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
143023
+ const config2 = loadConfig();
143024
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
143019
143025
  const resp = await fetch(`${baseUrl}/api/v2/events/${encodeURIComponent(id)}/trace`, {
143020
- headers: { "x-api-key": config.apiKey ?? "" }
143026
+ headers: { "x-api-key": config2.apiKey ?? "" }
143021
143027
  });
143022
143028
  if (!resp.ok) {
143023
143029
  throw new Error(`API returned ${resp.status}: ${await resp.text()}`);
@@ -143054,12 +143060,12 @@ function displayTrace(data2) {
143054
143060
  }
143055
143061
  }
143056
143062
  async function schemaApiRequest(path, init = {}) {
143057
- const config = loadConfig();
143058
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
143063
+ const config2 = loadConfig();
143064
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
143059
143065
  const resp = await fetch(`${baseUrl}/api/v2/events/schemas${path}`, {
143060
143066
  method: init.method ?? "GET",
143061
143067
  body: init.body,
143062
- headers: { "content-type": "application/json", "x-api-key": config.apiKey ?? "" }
143068
+ headers: { "content-type": "application/json", "x-api-key": config2.apiKey ?? "" }
143063
143069
  });
143064
143070
  if (!resp.ok) {
143065
143071
  throw new Error(`API returned ${resp.status}: ${await resp.text()}`);
@@ -143070,7 +143076,7 @@ function loadSchemaArtifact(options) {
143070
143076
  if ((options.file ? 1 : 0) + (options.schema ? 1 : 0) !== 1) {
143071
143077
  throw new Error("Provide the JSON Schema via exactly one of --file <path> or --schema <json>");
143072
143078
  }
143073
- const raw2 = options.file ? readFileSync8(options.file, "utf-8") : options.schema;
143079
+ const raw2 = options.file ? readFileSync9(options.file, "utf-8") : options.schema;
143074
143080
  const parsed = JSON.parse(raw2);
143075
143081
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
143076
143082
  throw new Error("The JSON Schema artifact must be a JSON object");
@@ -143105,9 +143111,9 @@ function createSchemaCommand() {
143105
143111
  version: result.data.version,
143106
143112
  enabled: result.data.enabled
143107
143113
  });
143108
- } catch (err) {
143109
- const message = err instanceof Error ? err.message : "Unknown error";
143110
- error(`Failed to register schema: ${message}`);
143114
+ } catch (err2) {
143115
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143116
+ error(`Failed to register schema: ${message2}`);
143111
143117
  }
143112
143118
  });
143113
143119
  schema.command("list").description("List registered event schemas").option("--enabled", "Only schemas with an active validation gate").action(async (options) => {
@@ -143115,18 +143121,18 @@ function createSchemaCommand() {
143115
143121
  const query = options.enabled ? "?enabled=true" : "";
143116
143122
  const result = await schemaApiRequest(query);
143117
143123
  list(result.items.map(summarizeSchemaRow), { emptyMessage: "No event schemas registered." });
143118
- } catch (err) {
143119
- const message = err instanceof Error ? err.message : "Unknown error";
143120
- error(`Failed to list schemas: ${message}`);
143124
+ } catch (err2) {
143125
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143126
+ error(`Failed to list schemas: ${message2}`);
143121
143127
  }
143122
143128
  });
143123
143129
  schema.command("get <eventType>").description("Show the registered schema for an event type").action(async (eventType) => {
143124
143130
  try {
143125
143131
  const result = await schemaApiRequest(`/${encodeURIComponent(eventType)}`);
143126
143132
  data(result.data);
143127
- } catch (err) {
143128
- const message = err instanceof Error ? err.message : "Unknown error";
143129
- error(`Failed to get schema: ${message}`);
143133
+ } catch (err2) {
143134
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143135
+ error(`Failed to get schema: ${message2}`);
143130
143136
  }
143131
143137
  });
143132
143138
  return schema;
@@ -143146,10 +143152,13 @@ function isErrorEvent(eventType) {
143146
143152
  function isNoisyEvent(eventType) {
143147
143153
  return NOISY_EVENT_TYPES.has(eventType);
143148
143154
  }
143155
+ function matchesEventTypeFilter(eventType, filter) {
143156
+ return filter.endsWith("*") ? eventType.startsWith(filter.slice(0, -1)) : eventType === filter;
143157
+ }
143149
143158
  function passesStreamFilters(event, options) {
143150
143159
  if (options.instanceId && event.instanceId !== options.instanceId)
143151
143160
  return false;
143152
- if (options.type && event.eventType !== options.type)
143161
+ if (options.type && !matchesEventTypeFilter(event.eventType, options.type))
143153
143162
  return false;
143154
143163
  if (options.chatId && event.chatUuid !== options.chatId)
143155
143164
  return false;
@@ -143163,11 +143172,11 @@ function passesStreamFilters(event, options) {
143163
143172
  }
143164
143173
  function formatEventLine(event) {
143165
143174
  const time = new Date(event.receivedAt).toISOString().slice(11, 19);
143166
- const instance = event.instanceId?.slice(0, 8) ?? "--------";
143175
+ const instance3 = event.instanceId?.slice(0, 8) ?? "--------";
143167
143176
  const chat = event.chatUuid?.slice(0, 8) ?? "--------";
143168
143177
  const summary = event.textContent ?? event.transcription ?? event.imageDescription ?? "";
143169
143178
  const trimmed = summary.length > 80 ? `${summary.slice(0, 77)}...` : summary;
143170
- return `${time} ${event.eventType.padEnd(28)} ${instance}/${chat} ${event.direction.padEnd(8)} ${trimmed}`.trimEnd();
143179
+ return `${time} ${event.eventType.padEnd(28)} ${instance3}/${chat} ${event.direction.padEnd(8)} ${trimmed}`.trimEnd();
143171
143180
  }
143172
143181
  function emitStreamEvent(event, ndjson) {
143173
143182
  if (ndjson) {
@@ -143176,36 +143185,36 @@ function emitStreamEvent(event, ndjson) {
143176
143185
  raw(formatEventLine(event));
143177
143186
  }
143178
143187
  }
143179
- async function fetchStreamBatch(client, filters, channel, type, sinceIso) {
143188
+ async function fetchStreamBatch(client, filters, channel2, type, sinceIso) {
143180
143189
  try {
143181
143190
  const result = await client.events.list({
143182
143191
  instanceId: filters.instanceId,
143183
- channel,
143192
+ channel: channel2,
143184
143193
  eventType: type,
143185
143194
  since: sinceIso,
143186
143195
  limit: 100
143187
143196
  });
143188
143197
  return result.items;
143189
- } catch (err) {
143190
- const message = err instanceof Error ? err.message : "Unknown error";
143191
- warn(`events stream: ${message}`);
143198
+ } catch (err2) {
143199
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143200
+ warn(`events stream: ${message2}`);
143192
143201
  return [];
143193
143202
  }
143194
143203
  }
143195
143204
  function processStreamBatch(items, filters, state, ndjson) {
143196
- const ascending = [...items].sort((a, b2) => a.receivedAt.localeCompare(b2.receivedAt));
143197
- for (const ev of ascending) {
143198
- if (state.seen.has(ev.id))
143205
+ const ascending = [...items].sort((a2, b7) => a2.receivedAt.localeCompare(b7.receivedAt));
143206
+ for (const ev2 of ascending) {
143207
+ if (state.seen.has(ev2.id))
143199
143208
  continue;
143200
- state.seen.add(ev.id);
143201
- if (!passesStreamFilters(ev, filters))
143209
+ state.seen.add(ev2.id);
143210
+ if (!passesStreamFilters(ev2, filters))
143202
143211
  continue;
143203
- emitStreamEvent(ev, ndjson);
143204
- if (ev.receivedAt > state.sinceIso)
143205
- state.sinceIso = ev.receivedAt;
143212
+ emitStreamEvent(ev2, ndjson);
143213
+ if (ev2.receivedAt > state.sinceIso)
143214
+ state.sinceIso = ev2.receivedAt;
143206
143215
  }
143207
143216
  if (state.seen.size > 5000 && items.length > 0) {
143208
- state.seen = new Set(items.map((ev) => ev.id));
143217
+ state.seen = new Set(items.map((ev2) => ev2.id));
143209
143218
  }
143210
143219
  }
143211
143220
  async function streamEvents(client, options) {
@@ -143249,10 +143258,58 @@ async function streamEvents(client, options) {
143249
143258
  await flushStdout();
143250
143259
  }
143251
143260
  }
143261
+ var WaitFilterEntrySchema = exports_external.string().regex(/^[^=\s]+=/, "each --filter must look like key=value (dot paths allowed, e.g. --filter user.id=42)");
143262
+ var WaitOptionsSchema = exports_external.object({
143263
+ timeout: exports_external.coerce.number().positive().max(86400).optional(),
143264
+ pollMs: exports_external.coerce.number().int().min(250).max(60000).default(2000),
143265
+ filter: exports_external.array(WaitFilterEntrySchema).default([])
143266
+ });
143267
+ function parseWaitFilters(entries) {
143268
+ return entries.map((entry) => {
143269
+ const idx = entry.indexOf("=");
143270
+ const raw2 = entry.slice(idx + 1);
143271
+ let value;
143272
+ try {
143273
+ value = JSON.parse(raw2);
143274
+ } catch {
143275
+ value = raw2;
143276
+ }
143277
+ return { field: entry.slice(0, idx), operator: "eq", value };
143278
+ });
143279
+ }
143280
+ function matchesWaitEvent(event, filters, conditions2) {
143281
+ if (!passesStreamFilters(event, filters))
143282
+ return false;
143283
+ return evaluateConditions(conditions2, event.rawPayload ?? {});
143284
+ }
143285
+ async function waitForEvent(client, params) {
143286
+ const deadline = params.timeoutMs === undefined ? undefined : Date.now() + params.timeoutMs;
143287
+ const state = { sinceIso: params.sinceIso, seen: new Set };
143288
+ for (;; ) {
143289
+ const items = await fetchStreamBatch(client, params.filters, params.filters.channel, params.filters.type, state.sinceIso);
143290
+ const ascending = [...items].sort((a2, b7) => a2.receivedAt.localeCompare(b7.receivedAt));
143291
+ for (const ev2 of ascending) {
143292
+ if (state.seen.has(ev2.id))
143293
+ continue;
143294
+ state.seen.add(ev2.id);
143295
+ if (ev2.receivedAt > state.sinceIso)
143296
+ state.sinceIso = ev2.receivedAt;
143297
+ if (matchesWaitEvent(ev2, params.filters, params.conditions))
143298
+ return ev2;
143299
+ }
143300
+ if (state.seen.size > 5000 && items.length > 0) {
143301
+ state.seen = new Set(items.map((ev2) => ev2.id));
143302
+ }
143303
+ const remaining = deadline === undefined ? params.pollMs : deadline - Date.now();
143304
+ if (remaining <= 0)
143305
+ return null;
143306
+ await new Promise((resolve2) => setTimeout(resolve2, Math.min(params.pollMs, remaining)));
143307
+ }
143308
+ }
143252
143309
  function createEventsCommand() {
143253
- const events = new Command("events").description("Query events");
143254
- events.addCommand(createSchemaCommand());
143255
- events.command("list").description("List events").option("--instance <id>", "Filter by instance ID").option("--channel <type>", "Filter by channel type").option("--type <type>", "Filter by event type").option("--chat-id <id>", "Filter by chat ID").option("--since <time>", "Events since (e.g., 24h, 7d, or ISO timestamp)").option("--until <time>", "Events until (ISO timestamp)").option("--limit <n>", "Limit results", (v) => Number.parseInt(v, 10), 50).action(async (options) => {
143310
+ const events2 = new Command("events").description("Query events");
143311
+ events2.addCommand(createSchemaCommand());
143312
+ events2.command("list").description("List events").option("--instance <id>", "Filter by instance ID").option("--channel <type>", "Filter by channel type").option("--type <type>", "Filter by event type (trailing * = prefix glob, e.g. custom.*)").option("--chat-id <id>", "Filter by chat ID").option("--since <time>", "Events since (e.g., 24h, 7d, or ISO timestamp)").option("--until <time>", "Events until (ISO timestamp)").option("--limit <n>", "Limit results", (v4) => Number.parseInt(v4, 10), 50).action(async (options) => {
143256
143313
  const client = getClient();
143257
143314
  try {
143258
143315
  const instanceId = options.instance ? await resolveInstanceId(options.instance) : undefined;
@@ -143267,48 +143324,83 @@ function createEventsCommand() {
143267
143324
  until: options.until,
143268
143325
  limit: options.limit
143269
143326
  });
143270
- const items = result.items.map((e) => ({
143271
- id: e.id,
143272
- type: e.eventType,
143273
- instanceId: e.instanceId,
143274
- direction: e.direction,
143275
- receivedAt: e.receivedAt
143327
+ const items = result.items.map((e10) => ({
143328
+ id: e10.id,
143329
+ type: e10.eventType,
143330
+ instanceId: e10.instanceId,
143331
+ direction: e10.direction,
143332
+ receivedAt: e10.receivedAt
143276
143333
  }));
143277
143334
  list(items, { emptyMessage: "No events found." });
143278
- } catch (err) {
143279
- const message = err instanceof Error ? err.message : "Unknown error";
143280
- error(`Failed to list events: ${message}`);
143335
+ } catch (err2) {
143336
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143337
+ error(`Failed to list events: ${message2}`);
143281
143338
  }
143282
143339
  });
143283
- events.command("stream").description("Stream events in real-time (tail -f style). Ctrl+C to stop.").option("--instance <id>", "Filter by instance ID").option("--channel <type>", "Filter by channel type").option("--type <type>", "Filter by event type").option("--chat-id <id>", "Filter by chat ID").option("--person-id <id>", "Filter by person ID").option("--since <time>", "Start cursor (e.g., 5min, 24h, 7d, or ISO timestamp)").option("--errors-only", "Show only error/failure events").option("--all", "Include noisy event types (presence, delivered, read, progress)").option("--ndjson", "Emit JSON Lines (one event per line) \u2014 same as global --json in stream mode").option("--poll-ms <n>", "Polling interval in milliseconds", (v) => Number.parseInt(v, 10), 2000).action(async (options) => {
143340
+ events2.command("stream").description("Stream events in real-time (tail -f style). Ctrl+C to stop.").option("--instance <id>", "Filter by instance ID").option("--channel <type>", "Filter by channel type").option("--type <type>", "Filter by event type (trailing * = prefix glob, e.g. custom.*)").option("--chat-id <id>", "Filter by chat ID").option("--person-id <id>", "Filter by person ID").option("--since <time>", "Start cursor (e.g., 5min, 24h, 7d, or ISO timestamp)").option("--errors-only", "Show only error/failure events").option("--all", "Include noisy event types (presence, delivered, read, progress)").option("--ndjson", "Emit JSON Lines (one event per line) \u2014 same as global --json in stream mode").option("--poll-ms <n>", "Polling interval in milliseconds", (v4) => Number.parseInt(v4, 10), 2000).action(async (options) => {
143284
143341
  const client = getClient();
143285
143342
  try {
143286
143343
  await streamEvents(client, options);
143287
- } catch (err) {
143288
- const message = err instanceof Error ? err.message : "Unknown error";
143289
- error(`Failed to stream events: ${message}`);
143344
+ } catch (err2) {
143345
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143346
+ error(`Failed to stream events: ${message2}`);
143290
143347
  }
143291
143348
  });
143292
- events.command("get <id>").description("Get full details for a single event by ID").action(async (id) => {
143349
+ events2.command("wait").description("Block until the first matching event, print it as JSON, exit 0. Exits non-zero on --timeout.").option("--instance <id>", "Filter by instance ID").option("--channel <type>", "Filter by channel type").option("--type <type>", "Filter by event type (trailing * = prefix glob, e.g. custom.*)").option("--chat-id <id>", "Filter by chat ID").option("--person-id <id>", "Filter by person ID").option("--filter <k=v>", "Payload condition, repeatable (dot paths + JSON values, e.g. --filter user.id=42 --filter status=open)", (value, previous) => [...previous, value], []).option("--timeout <seconds>", "Give up after N seconds: exit non-zero, nothing on stdout").option("--since <time>", "Start cursor (e.g., 5min, ISO timestamp; default: now)").option("--poll-ms <n>", "Polling interval in milliseconds", (v4) => Number.parseInt(v4, 10), 2000).action(async (options) => {
143350
+ const client = getClient();
143351
+ try {
143352
+ const parsed = WaitOptionsSchema.parse({
143353
+ timeout: options.timeout,
143354
+ pollMs: options.pollMs,
143355
+ filter: options.filter
143356
+ });
143357
+ const instanceId = options.instance ? await resolveInstanceId(options.instance) : undefined;
143358
+ const chatId = options.chatId ? await resolveChatId(options.chatId) : undefined;
143359
+ const event = await waitForEvent(client, {
143360
+ filters: {
143361
+ instanceId,
143362
+ channel: options.channel,
143363
+ type: options.type,
143364
+ chatId,
143365
+ personId: options.personId,
143366
+ all: true
143367
+ },
143368
+ conditions: parseWaitFilters(parsed.filter),
143369
+ sinceIso: options.since ? parseSinceTime(options.since) : new Date().toISOString(),
143370
+ pollMs: parsed.pollMs,
143371
+ timeoutMs: parsed.timeout === undefined ? undefined : parsed.timeout * 1000
143372
+ });
143373
+ if (event) {
143374
+ raw(JSON.stringify(event));
143375
+ await flushStdout();
143376
+ return;
143377
+ }
143378
+ error(`Timed out after ${parsed.timeout}s waiting for a matching event`);
143379
+ } catch (err2) {
143380
+ const message2 = err2 instanceof exports_external.ZodError ? err2.issues.map((i6) => i6.message).join("; ") : err2 instanceof Error ? err2.message : "Unknown error";
143381
+ error(`Failed to wait for event: ${message2}`);
143382
+ }
143383
+ });
143384
+ events2.command("get <id>").description("Get full details for a single event by ID").action(async (id) => {
143293
143385
  const client = getClient();
143294
143386
  try {
143295
143387
  const event = await client.events.get(id);
143296
143388
  data(event);
143297
- } catch (err) {
143298
- const message = err instanceof Error ? err.message : "Unknown error";
143299
- error(`Failed to get event: ${message}`);
143389
+ } catch (err2) {
143390
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143391
+ error(`Failed to get event: ${message2}`);
143300
143392
  }
143301
143393
  });
143302
- events.command("trace <id>").description("Walk the causality chain around an event: root \u2192 parents \u2192 this event \u2192 everything it caused").action(async (id) => {
143394
+ events2.command("trace <id>").description("Walk the causality chain around an event: root \u2192 parents \u2192 this event \u2192 everything it caused").action(async (id) => {
143303
143395
  try {
143304
143396
  const data2 = await fetchTrace(id);
143305
143397
  displayTrace(data2);
143306
- } catch (err) {
143307
- const message = err instanceof Error ? err.message : "Unknown error";
143308
- error(`Failed to trace event: ${message}`);
143398
+ } catch (err2) {
143399
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143400
+ error(`Failed to trace event: ${message2}`);
143309
143401
  }
143310
143402
  });
143311
- events.command("search <query>").description("Search events by content").option("--since <time>", "Events since (e.g., 24h, 7d)").option("--limit <n>", "Limit results", (v) => Number.parseInt(v, 10), 50).action(async (query, options) => {
143403
+ events2.command("search <query>").description("Search events by content").option("--since <time>", "Events since (e.g., 24h, 7d)").option("--limit <n>", "Limit results", (v4) => Number.parseInt(v4, 10), 50).action(async (query, options) => {
143312
143404
  const client = getClient();
143313
143405
  try {
143314
143406
  const result = await client.events.list({
@@ -143316,59 +143408,59 @@ function createEventsCommand() {
143316
143408
  since: options.since ? parseSinceTime(options.since) : undefined,
143317
143409
  limit: options.limit
143318
143410
  });
143319
- const items = result.items.map((e) => ({
143320
- id: e.id,
143321
- type: e.eventType,
143322
- instanceId: e.instanceId,
143323
- direction: e.direction,
143324
- receivedAt: e.receivedAt
143411
+ const items = result.items.map((e10) => ({
143412
+ id: e10.id,
143413
+ type: e10.eventType,
143414
+ instanceId: e10.instanceId,
143415
+ direction: e10.direction,
143416
+ receivedAt: e10.receivedAt
143325
143417
  }));
143326
143418
  list(items, { emptyMessage: "No matching events found." });
143327
- } catch (err) {
143328
- const message = err instanceof Error ? err.message : "Unknown error";
143329
- error(`Failed to search events: ${message}`);
143419
+ } catch (err2) {
143420
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143421
+ error(`Failed to search events: ${message2}`);
143330
143422
  }
143331
143423
  });
143332
- events.command("timeline <personId>").description("Show event timeline for a person").option("--limit <n>", "Limit results", (v) => Number.parseInt(v, 10), 50).action(async (personId, options) => {
143424
+ events2.command("timeline <personId>").description("Show event timeline for a person").option("--limit <n>", "Limit results", (v4) => Number.parseInt(v4, 10), 50).action(async (personId, options) => {
143333
143425
  const client = getClient();
143334
143426
  try {
143335
143427
  const result = await client.events.list({
143336
143428
  search: personId,
143337
143429
  limit: options.limit
143338
143430
  });
143339
- const items = result.items.map((e) => ({
143340
- id: e.id,
143341
- type: e.eventType,
143342
- instanceId: e.instanceId,
143343
- direction: e.direction,
143344
- receivedAt: e.receivedAt
143431
+ const items = result.items.map((e10) => ({
143432
+ id: e10.id,
143433
+ type: e10.eventType,
143434
+ instanceId: e10.instanceId,
143435
+ direction: e10.direction,
143436
+ receivedAt: e10.receivedAt
143345
143437
  }));
143346
143438
  list(items, { emptyMessage: `No events found for person: ${personId}` });
143347
- } catch (err) {
143348
- const message = err instanceof Error ? err.message : "Unknown error";
143349
- error(`Failed to get timeline: ${message}`);
143439
+ } catch (err2) {
143440
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143441
+ error(`Failed to get timeline: ${message2}`);
143350
143442
  }
143351
143443
  });
143352
- events.command("metrics").description("Get event processing metrics").action(async () => {
143444
+ events2.command("metrics").description("Get event processing metrics").action(async () => {
143353
143445
  const client = getClient();
143354
143446
  try {
143355
- const metrics = await client.eventOps.metrics();
143356
- data(metrics);
143357
- } catch (err) {
143358
- const message = err instanceof Error ? err.message : "Unknown error";
143359
- error(`Failed to get metrics: ${message}`);
143447
+ const metrics2 = await client.eventOps.metrics();
143448
+ data(metrics2);
143449
+ } catch (err2) {
143450
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143451
+ error(`Failed to get metrics: ${message2}`);
143360
143452
  }
143361
143453
  });
143362
- events.command("analytics").description("Show event analytics summary").option("--instance <id>", "Filter by instance ID").option("--since <time>", "Events since (e.g., 24h, 7d, or ISO timestamp)").option("--all-time", "Show all-time stats (default: last 24h)").action(async (options) => {
143454
+ events2.command("analytics").description("Show event analytics summary").option("--instance <id>", "Filter by instance ID").option("--since <time>", "Events since (e.g., 24h, 7d, or ISO timestamp)").option("--all-time", "Show all-time stats (default: last 24h)").action(async (options) => {
143363
143455
  try {
143364
143456
  const data2 = await fetchAnalytics(options);
143365
143457
  displayAnalytics(data2);
143366
- } catch (err) {
143367
- const message = err instanceof Error ? err.message : "Unknown error";
143368
- error(`Failed to get analytics: ${message}`);
143458
+ } catch (err2) {
143459
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143460
+ error(`Failed to get analytics: ${message2}`);
143369
143461
  }
143370
143462
  });
143371
- events.command("replay").description("Start, list, or manage replay sessions").option("--start", "Start a new replay session").option("--since <time>", "Replay events since (required with --start)").option("--until <time>", "Replay events until").option("--types <types>", "Comma-separated event types to replay").option("--instance <id>", "Filter by instance ID").option("--speed <n>", "Speed multiplier", (v) => Number.parseFloat(v)).option("--dry-run", "Dry run (don't actually process)").option("--status <id>", "Get status of a replay session").option("--cancel <id>", "Cancel a replay session").action(async (options) => {
143463
+ events2.command("replay").description("Start, list, or manage replay sessions").option("--start", "Start a new replay session").option("--since <time>", "Replay events since (required with --start)").option("--until <time>", "Replay events until").option("--types <types>", "Comma-separated event types to replay").option("--instance <id>", "Filter by instance ID").option("--speed <n>", "Speed multiplier", (v4) => Number.parseFloat(v4)).option("--dry-run", "Dry run (don't actually process)").option("--status <id>", "Get status of a replay session").option("--cancel <id>", "Cancel a replay session").action(async (options) => {
143372
143464
  const client = getClient();
143373
143465
  try {
143374
143466
  if (options.cancel) {
@@ -143380,16 +143472,16 @@ function createEventsCommand() {
143380
143472
  } else {
143381
143473
  await listReplays(client);
143382
143474
  }
143383
- } catch (err) {
143384
- const message = err instanceof Error ? err.message : "Unknown error";
143385
- error(`Failed to manage replay: ${message}`);
143475
+ } catch (err2) {
143476
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143477
+ error(`Failed to manage replay: ${message2}`);
143386
143478
  }
143387
143479
  });
143388
- return events;
143480
+ return events2;
143389
143481
  }
143390
143482
 
143391
143483
  // src/commands/film.ts
143392
- import { readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
143484
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
143393
143485
  import { resolve as resolvePath } from "path";
143394
143486
  init_output();
143395
143487
  function createFilmCommand() {
@@ -143433,12 +143525,12 @@ function createFilmCommand() {
143433
143525
  let imageMimeType;
143434
143526
  if (options.reference) {
143435
143527
  try {
143436
- const ref = readFileSync9(resolvePath(options.reference));
143528
+ const ref = readFileSync10(resolvePath(options.reference));
143437
143529
  imageBase64 = ref.toString("base64");
143438
143530
  imageMimeType = mimeForImagePath(options.reference);
143439
- } catch (err) {
143440
- const message = err instanceof Error ? err.message : "Unknown error";
143441
- return error(`Failed to read --reference ${options.reference}: ${message}`);
143531
+ } catch (err2) {
143532
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143533
+ return error(`Failed to read --reference ${options.reference}: ${message2}`);
143442
143534
  }
143443
143535
  }
143444
143536
  const spinner = ora({
@@ -143487,11 +143579,11 @@ function createFilmCommand() {
143487
143579
  caption: prompt
143488
143580
  });
143489
143581
  success("Video sent", { ...sent, filename, sizeBytes: videoBuffer.length });
143490
- } catch (err) {
143582
+ } catch (err2) {
143491
143583
  clearInterval(tick);
143492
143584
  spinner.fail("Video generation failed");
143493
- const message = err instanceof Error ? err.message : "Unknown error";
143494
- error(`omni film: ${message}`);
143585
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143586
+ error(`omni film: ${message2}`);
143495
143587
  }
143496
143588
  });
143497
143589
  }
@@ -143505,7 +143597,7 @@ function mimeForImagePath(path) {
143505
143597
  }
143506
143598
 
143507
143599
  // src/commands/follow-up.ts
143508
- import { readFileSync as readFileSync10 } from "fs";
143600
+ import { readFileSync as readFileSync11 } from "fs";
143509
143601
  init_output();
143510
143602
  var VALID_SCOPES = ["agents", "instances", "chats"];
143511
143603
  function assertScope(scope) {
@@ -143523,15 +143615,15 @@ async function resolveScopedId(scope, id) {
143523
143615
  function readJsonArg(raw2) {
143524
143616
  let body = raw2;
143525
143617
  if (body === "-") {
143526
- body = readFileSync10(0, "utf8");
143618
+ body = readFileSync11(0, "utf8");
143527
143619
  } else if (body.startsWith("@")) {
143528
- body = readFileSync10(body.slice(1), "utf8");
143620
+ body = readFileSync11(body.slice(1), "utf8");
143529
143621
  }
143530
143622
  try {
143531
143623
  return JSON.parse(body);
143532
- } catch (err) {
143533
- const message = err instanceof Error ? err.message : "Unknown error";
143534
- error(`Invalid JSON: ${message}`);
143624
+ } catch (err2) {
143625
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143626
+ error(`Invalid JSON: ${message2}`);
143535
143627
  }
143536
143628
  }
143537
143629
  function createFollowUpCommand() {
@@ -143543,22 +143635,22 @@ function createFollowUpCommand() {
143543
143635
  try {
143544
143636
  const data2 = scope === "agents" ? await client.followUp.getAgent(resolvedId) : scope === "instances" ? await client.followUp.getInstance(resolvedId) : await client.followUp.getChat(resolvedId);
143545
143637
  data(data2);
143546
- } catch (err) {
143547
- const message = err instanceof Error ? err.message : "Unknown error";
143548
- error(`Failed to read ${scope} follow-up: ${message}`, undefined, 3);
143638
+ } catch (err2) {
143639
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143640
+ error(`Failed to read ${scope} follow-up: ${message2}`, undefined, 3);
143549
143641
  }
143550
143642
  });
143551
143643
  cmd.command("set <scope> <id> <json>").description("Write follow-up config at a scope. <json> can be a literal, `@path`, or `-` for stdin.").action(async (scope, id, json) => {
143552
143644
  assertScope(scope);
143553
- const config = readJsonArg(json);
143645
+ const config2 = readJsonArg(json);
143554
143646
  const resolvedId = await resolveScopedId(scope, id);
143555
143647
  const client = getClient();
143556
143648
  try {
143557
- const data2 = scope === "agents" ? await client.followUp.setAgent(resolvedId, config) : scope === "instances" ? await client.followUp.setInstance(resolvedId, config) : await client.followUp.setChat(resolvedId, config);
143649
+ const data2 = scope === "agents" ? await client.followUp.setAgent(resolvedId, config2) : scope === "instances" ? await client.followUp.setInstance(resolvedId, config2) : await client.followUp.setChat(resolvedId, config2);
143558
143650
  success(`Follow-up config set on ${scope.slice(0, -1)} ${resolvedId}.`, data2);
143559
- } catch (err) {
143560
- const message = err instanceof Error ? err.message : "Unknown error";
143561
- error(`Failed to set ${scope} follow-up: ${message}`, undefined, 3);
143651
+ } catch (err2) {
143652
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143653
+ error(`Failed to set ${scope} follow-up: ${message2}`, undefined, 3);
143562
143654
  }
143563
143655
  });
143564
143656
  cmd.command("unset <scope> <id>").description("Clear the override at a scope so broader scopes apply.").action(async (scope, id) => {
@@ -143573,9 +143665,9 @@ function createFollowUpCommand() {
143573
143665
  else
143574
143666
  await client.followUp.unsetChat(resolvedId);
143575
143667
  success(`Follow-up config cleared on ${scope.slice(0, -1)} ${resolvedId}.`);
143576
- } catch (err) {
143577
- const message = err instanceof Error ? err.message : "Unknown error";
143578
- error(`Failed to unset ${scope} follow-up: ${message}`, undefined, 3);
143668
+ } catch (err2) {
143669
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143670
+ error(`Failed to unset ${scope} follow-up: ${message2}`, undefined, 3);
143579
143671
  }
143580
143672
  });
143581
143673
  return cmd;
@@ -143588,10 +143680,10 @@ function truncate2(str, maxLen) {
143588
143680
  return str;
143589
143681
  return `${str.slice(0, maxLen - 1)}\u2026`;
143590
143682
  }
143591
- function formatTime2(ts) {
143683
+ function formatTime3(ts) {
143592
143684
  try {
143593
- const d = new Date(ts);
143594
- return d.toLocaleString("en-US", {
143685
+ const d6 = new Date(ts);
143686
+ return d6.toLocaleString("en-US", {
143595
143687
  month: "short",
143596
143688
  day: "2-digit",
143597
143689
  hour: "2-digit",
@@ -143663,22 +143755,22 @@ function createHistoryCommand() {
143663
143755
  }
143664
143756
  const rows = messages2.map((msg) => ({
143665
143757
  ID: msg.externalId,
143666
- TIME: formatTime2(msg.platformTimestamp),
143758
+ TIME: formatTime3(msg.platformTimestamp),
143667
143759
  SENDER: senderLabel(msg),
143668
143760
  TYPE: msg.messageType,
143669
143761
  CONTENT: contentPreview(msg, !!options.full)
143670
143762
  }));
143671
143763
  list(rows, { rawData: messages2 });
143672
- } catch (err) {
143673
- const message = err instanceof Error ? err.message : "Unknown error";
143674
- error(`Failed to fetch history: ${message}`);
143764
+ } catch (err2) {
143765
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143766
+ error(`Failed to fetch history: ${message2}`);
143675
143767
  }
143676
143768
  });
143677
143769
  }
143678
143770
 
143679
143771
  // src/commands/imagine.ts
143680
143772
  import { writeFileSync as writeFileSync8 } from "fs";
143681
- import { basename as basename2, dirname as dirname4, extname as extname2, join as join14 } from "path";
143773
+ import { basename as basename2, dirname as dirname4, extname as extname2, join as join15 } from "path";
143682
143774
  init_output();
143683
143775
  var ALLOWED_ASPECT_RATIOS = ["1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3"];
143684
143776
  var ALLOWED_OUTPUT_FORMATS = ["png", "jpeg", "webp"];
@@ -143694,9 +143786,9 @@ function buildOutputPath(outputBase, index, total, mimeType) {
143694
143786
  const ext = extname2(outputBase) || extensionForMime(mimeType);
143695
143787
  const stem = basename2(outputBase, extname2(outputBase));
143696
143788
  if (total <= 1) {
143697
- return join14(dir, `${stem}${ext}`);
143789
+ return join15(dir, `${stem}${ext}`);
143698
143790
  }
143699
- return join14(dir, `${stem}-${index + 1}${ext}`);
143791
+ return join15(dir, `${stem}-${index + 1}${ext}`);
143700
143792
  }
143701
143793
  function parseAspectRatio(value) {
143702
143794
  if (!value)
@@ -143774,26 +143866,26 @@ function createImagineCommand() {
143774
143866
  outputFormat,
143775
143867
  compression
143776
143868
  });
143777
- } catch (err) {
143778
- const message = err instanceof Error ? err.message : "Unknown error";
143779
- return error(`Image generation failed: ${message}`);
143869
+ } catch (err2) {
143870
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143871
+ return error(`Image generation failed: ${message2}`);
143780
143872
  }
143781
143873
  if (!result.images || result.images.length === 0) {
143782
143874
  return error("API returned no images");
143783
143875
  }
143784
143876
  if (saveLocally && options.output) {
143785
143877
  const savedPaths = [];
143786
- for (let i = 0;i < result.images.length; i++) {
143787
- const image = result.images[i];
143878
+ for (let i6 = 0;i6 < result.images.length; i6++) {
143879
+ const image = result.images[i6];
143788
143880
  if (!image)
143789
143881
  continue;
143790
- const path = buildOutputPath(options.output, i, result.images.length, image.mimeType);
143882
+ const path = buildOutputPath(options.output, i6, result.images.length, image.mimeType);
143791
143883
  try {
143792
143884
  writeFileSync8(path, Buffer.from(image.base64, "base64"));
143793
143885
  savedPaths.push(path);
143794
- } catch (err) {
143795
- const message = err instanceof Error ? err.message : "Unknown error";
143796
- return error(`Failed to write ${path}: ${message}`);
143886
+ } catch (err2) {
143887
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143888
+ return error(`Failed to write ${path}: ${message2}`);
143797
143889
  }
143798
143890
  }
143799
143891
  return success(`Generated ${savedPaths.length} image(s) via ${result.provider}`, {
@@ -143803,11 +143895,11 @@ function createImagineCommand() {
143803
143895
  });
143804
143896
  }
143805
143897
  const sent = [];
143806
- for (let i = 0;i < result.images.length; i++) {
143807
- const image = result.images[i];
143898
+ for (let i6 = 0;i6 < result.images.length; i6++) {
143899
+ const image = result.images[i6];
143808
143900
  if (!image)
143809
143901
  continue;
143810
- const filename = result.images.length > 1 ? `imagine-${Date.now()}-${i + 1}.png` : `imagine-${Date.now()}.png`;
143902
+ const filename = result.images.length > 1 ? `imagine-${Date.now()}-${i6 + 1}.png` : `imagine-${Date.now()}.png`;
143811
143903
  try {
143812
143904
  const res = await client.messages.sendMedia({
143813
143905
  instanceId,
@@ -143815,12 +143907,12 @@ function createImagineCommand() {
143815
143907
  type: "image",
143816
143908
  base64: image.base64,
143817
143909
  filename,
143818
- caption: i === 0 ? prompt : undefined
143910
+ caption: i6 === 0 ? prompt : undefined
143819
143911
  });
143820
- sent.push({ messageId: res.messageId, index: i });
143821
- } catch (err) {
143822
- const message = err instanceof Error ? err.message : "Unknown error";
143823
- return error(`Failed to send image ${i + 1}: ${message}`);
143912
+ sent.push({ messageId: res.messageId, index: i6 });
143913
+ } catch (err2) {
143914
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
143915
+ return error(`Failed to send image ${i6 + 1}: ${message2}`);
143824
143916
  }
143825
143917
  }
143826
143918
  success(`Generated and sent ${sent.length} image(s) via ${result.provider}`, {
@@ -143834,12 +143926,12 @@ function createImagineCommand() {
143834
143926
  }
143835
143927
 
143836
143928
  // src/commands/install.ts
143837
- import { existsSync as existsSync12, mkdirSync as mkdirSync7 } from "fs";
143838
- import { homedir as homedir9 } from "os";
143839
- import { join as join15 } from "path";
143929
+ import { existsSync as existsSync13, mkdirSync as mkdirSync8 } from "fs";
143930
+ import { homedir as homedir10 } from "os";
143931
+ import { join as join16 } from "path";
143840
143932
  init_config();
143841
143933
  init_output();
143842
- var DEFAULT_DATA_DIR2 = join15(homedir9(), ".omni", "data");
143934
+ var DEFAULT_DATA_DIR2 = join16(homedir10(), ".omni", "data");
143843
143935
  function computeDefaultDatabaseUrl() {
143844
143936
  return buildEmbeddedDatabaseUrl();
143845
143937
  }
@@ -143938,13 +144030,13 @@ async function startServices(cfg, forceCleanup, forceSystemd, useCanonicalPgserv
143938
144030
  return false;
143939
144031
  }
143940
144032
  const bundlePath = getServerBundlePath();
143941
- if (!existsSync12(bundlePath)) {
144033
+ if (!existsSync13(bundlePath)) {
143942
144034
  warn(`Server bundle not found at: ${bundlePath}
143943
144035
  Install @automagik/omni from npm: bun add -g @automagik/omni
143944
144036
  Or build locally: make cli-build-full`);
143945
144037
  return false;
143946
144038
  }
143947
- mkdirSync7(getPm2LogDir(), { recursive: true });
144039
+ mkdirSync8(getPm2LogDir(), { recursive: true });
143948
144040
  await installPm2Logrotate();
143949
144041
  const runtimeEnv = buildInstallRuntimeEnv(cfg, forceCleanup, useCanonicalPgserve);
143950
144042
  await runPm2(["delete", PM2_PROCESSES.api]);
@@ -143962,10 +144054,10 @@ async function startServices(cfg, forceCleanup, forceSystemd, useCanonicalPgserv
143962
144054
  return false;
143963
144055
  }
143964
144056
  apiSpinner.succeed(`${PM2_PROCESSES.api} started`);
143965
- if (existsSync12(NATS_BINARY_PATH)) {
144057
+ if (existsSync13(NATS_BINARY_PATH)) {
143966
144058
  const natsSpinner = ora(`Starting ${PM2_PROCESSES.nats}...`).start();
143967
- const natsDataDir = join15(cfg.dataDir, "nats");
143968
- mkdirSync7(natsDataDir, { recursive: true });
144059
+ const natsDataDir = join16(cfg.dataDir, "nats");
144060
+ mkdirSync8(natsDataDir, { recursive: true });
143969
144061
  const natsArgs = buildPm2StartArgs({
143970
144062
  kind: "nats",
143971
144063
  script: NATS_BINARY_PATH,
@@ -144107,7 +144199,8 @@ var VALID_CHANNELS2 = [
144107
144199
  "gupshup",
144108
144200
  "twilio-whatsapp",
144109
144201
  "hermes",
144110
- "asc-flow"
144202
+ "asc-flow",
144203
+ "harness"
144111
144204
  ];
144112
144205
  var VALID_SYNC_TYPES = ["profile", "messages", "contacts", "groups", "all"];
144113
144206
  function setVal(body, key, val) {
@@ -144136,7 +144229,7 @@ function applyAgentFields(body, opts) {
144136
144229
  setBool(body, "agentWaitForMedia", opts.agentWaitForMedia);
144137
144230
  setBool(body, "agentSendMediaPath", opts.agentSendMediaPath);
144138
144231
  if (typeof opts.agentSendMediaPathTypes === "string") {
144139
- body.agentSendMediaPathTypes = opts.agentSendMediaPathTypes.split(",").map((s) => s.trim());
144232
+ body.agentSendMediaPathTypes = opts.agentSendMediaPathTypes.split(",").map((s2) => s2.trim());
144140
144233
  }
144141
144234
  }
144142
144235
  function applyReplyFilter(body, opts) {
@@ -144153,7 +144246,7 @@ function applyReplyFilter(body, opts) {
144153
144246
  if (opts.replyOnName === true || opts.replyOnName === false)
144154
144247
  cond.onNameMatch = opts.replyOnName;
144155
144248
  if (opts.replyNamePatterns) {
144156
- cond.namePatterns = opts.replyNamePatterns.split(",").map((s) => s.trim());
144249
+ cond.namePatterns = opts.replyNamePatterns.split(",").map((s2) => s2.trim());
144157
144250
  }
144158
144251
  body.agentReplyFilter = { mode: opts.replyFilterMode, conditions: cond };
144159
144252
  }
@@ -144216,7 +144309,7 @@ function applyMiscFields(body, opts) {
144216
144309
  setBool(body, "allowFirstParty", opts.allowFirstParty);
144217
144310
  if (opts.triggerEvents !== undefined) {
144218
144311
  const raw2 = opts.triggerEvents;
144219
- body.triggerEvents = raw2 === "null" ? null : raw2.split(",").map((s) => s.trim());
144312
+ body.triggerEvents = raw2 === "null" ? null : raw2.split(",").map((s2) => s2.trim());
144220
144313
  }
144221
144314
  }
144222
144315
  function applyAckFields(body, opts) {
@@ -144258,13 +144351,13 @@ async function resolveBase64Image(options) {
144258
144351
  const resp = await fetch(options.url);
144259
144352
  if (!resp.ok)
144260
144353
  throw new Error(`Failed to fetch image: ${resp.status}`);
144261
- const buffer2 = await resp.arrayBuffer();
144262
- return Buffer.from(buffer2).toString("base64");
144354
+ const buffer3 = await resp.arrayBuffer();
144355
+ return Buffer.from(buffer3).toString("base64");
144263
144356
  }
144264
144357
  async function apiCall2(path, method = "GET", body) {
144265
- const config = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144266
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
144267
- const apiKey = config.apiKey ?? "";
144358
+ const config2 = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144359
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
144360
+ const apiKey = config2.apiKey ?? "";
144268
144361
  const headers = { "x-api-key": apiKey };
144269
144362
  if (body)
144270
144363
  headers["Content-Type"] = "application/json";
@@ -144274,8 +144367,8 @@ async function apiCall2(path, method = "GET", body) {
144274
144367
  body: body ? JSON.stringify(body) : undefined
144275
144368
  });
144276
144369
  if (!resp.ok) {
144277
- const err = await resp.json();
144278
- throw new Error(err?.error?.message ?? `API error: ${resp.status}`);
144370
+ const err2 = await resp.json();
144371
+ throw new Error(err2?.error?.message ?? `API error: ${resp.status}`);
144279
144372
  }
144280
144373
  return resp.json();
144281
144374
  }
@@ -144290,61 +144383,61 @@ function createInstancesCommand() {
144290
144383
  limit: options.limit
144291
144384
  });
144292
144385
  const statusMap = new Map;
144293
- await Promise.allSettled(result.items.map(async (i) => {
144386
+ await Promise.allSettled(result.items.map(async (i6) => {
144294
144387
  try {
144295
- const st = await client.instances.status(i.id);
144388
+ const st = await client.instances.status(i6.id);
144296
144389
  if (st.ownerIdentifier) {
144297
144390
  const phone = st.ownerIdentifier.includes(":") ? st.ownerIdentifier.split(":")[0] : st.ownerIdentifier.split("@")[0];
144298
- statusMap.set(i.id, phone);
144391
+ statusMap.set(i6.id, phone);
144299
144392
  }
144300
144393
  } catch {}
144301
144394
  }));
144302
- const items = result.items.map((i) => ({
144303
- id: i.id,
144304
- name: i.name,
144305
- channel: i.channel,
144306
- active: i.isActive ? "yes" : "no",
144307
- profileName: i.profileName ?? "-",
144308
- phone: statusMap.get(i.id) ?? "-"
144395
+ const items = result.items.map((i6) => ({
144396
+ id: i6.id,
144397
+ name: i6.name,
144398
+ channel: i6.channel,
144399
+ active: i6.isActive ? "yes" : "no",
144400
+ profileName: i6.profileName ?? "-",
144401
+ phone: statusMap.get(i6.id) ?? "-"
144309
144402
  }));
144310
144403
  list(items, { emptyMessage: "No instances found.", rawData: result.items });
144311
- } catch (err) {
144312
- const message = err instanceof Error ? err.message : "Unknown error";
144313
- error(`Failed to list instances: ${message}`);
144404
+ } catch (err2) {
144405
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144406
+ error(`Failed to list instances: ${message2}`);
144314
144407
  }
144315
144408
  });
144316
144409
  instances.command("get <id>").description("Get instance details").action(async (rawId) => {
144317
144410
  const client = getClient();
144318
144411
  try {
144319
144412
  const id = await resolveInstanceId(rawId);
144320
- const instance = await client.instances.get(id);
144321
- data(instance);
144322
- } catch (err) {
144323
- const message = err instanceof Error ? err.message : "Unknown error";
144324
- error(`Failed to get instance: ${message}`, undefined, 3);
144413
+ const instance3 = await client.instances.get(id);
144414
+ data(instance3);
144415
+ } catch (err2) {
144416
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144417
+ error(`Failed to get instance: ${message2}`, undefined, 3);
144325
144418
  }
144326
144419
  });
144327
- instances.command("create").description("Create a new instance (supports all API fields)").requiredOption("--name <name>", "Instance name").requiredOption("--channel <type>", `Channel type (${VALID_CHANNELS2.join(", ")})`).option("--agent-fk-id <uuid>", 'Agent FK UUID (references agents table, use "null" to clear). When set without --reply-filter-mode, reply filter defaults to {mode:"all", onDm:true} so messages are dispatched instead of silently dropped (omni#443).').option("--agent-provider <id>", "Agent provider ID").option("--agent <id>", "Agent ID").option("--agent-type <type>", "Agent type: agent, team, or workflow").option("--agent-timeout <seconds>", "Agent timeout in seconds", (v) => Number.parseInt(v, 10)).option("--agent-error-message <text>", 'Customer-facing reply when agent dispatch fails; repeat the flag for multiple variants (one is picked at random per failure). Use "null" to clear; falls back to OMNI_AGENT_DISPATCH_ERROR_MESSAGE env, then built-in default', (value, previous = []) => [...previous, value]).option("--agent-stream-mode", "Enable streaming responses").option("--agent-session-strategy <strategy>", "Session strategy: per_user, per_chat, per_user_per_chat").option("--agent-prefix-sender-name", "Prefix messages with sender name").option("--no-agent-prefix-sender-name", "Disable sender name prefix").option("--agent-wait-for-media", "Wait for media processing before dispatch").option("--no-agent-wait-for-media", "Dispatch immediately without waiting for media").option("--agent-send-media-path", "Include file path in formatted media text").option("--no-agent-send-media-path", "Exclude file path from formatted media text").option("--agent-send-media-path-types <types>", "Content types that receive file path (comma-separated: image,video,document)").option("--reply-filter-mode <mode>", "Reply filter: all or filtered").option("--reply-on-dm", "Reply to DMs").option("--no-reply-on-dm", "Ignore DMs").option("--reply-on-mention", "Reply when @mentioned").option("--no-reply-on-mention", "Ignore @mentions").option("--reply-on-reply", "Reply when message is reply to bot").option("--no-reply-on-reply", "Ignore replies").option("--reply-on-name", "Reply when bot name appears in text").option("--no-reply-on-name", "Ignore name matches").option("--reply-name-patterns <patterns>", "Custom name patterns (comma-separated)").option("--enable-auto-split", "Split responses on double newlines").option("--no-enable-auto-split", "Disable auto-split").option("--message-format-mode <mode>", "Format mode: convert or passthrough").option("--debounce-mode <mode>", "Debounce mode: disabled, fixed, randomized, or presence").option("--debounce-min <ms>", "Minimum debounce delay in ms", (v) => Number.parseInt(v, 10)).option("--debounce-max <ms>", "Maximum debounce delay in ms", (v) => Number.parseInt(v, 10)).option("--debounce-restart-on-typing", "Restart debounce timer on typing").option("--debounce-group <ms>", "Group chat debounce in ms", (v) => Number.parseInt(v, 10)).option("--debounce-max-wait <ms>", "Presence-mode hard cap in ms (flush even under continuous typing)", (v) => Number.parseInt(v, 10)).option("--split-delay-mode <mode>", "Split delay mode: disabled, fixed, or randomized").option("--split-delay-fixed <ms>", "Fixed delay between split chunks in ms", (v) => Number.parseInt(v, 10)).option("--split-delay-min <ms>", "Minimum delay between split chunks in ms", (v) => Number.parseInt(v, 10)).option("--split-delay-max <ms>", "Maximum delay between split chunks in ms", (v) => Number.parseInt(v, 10)).option("--agent-gate", "Enable LLM response gate").option("--agent-gate-model <model>", "Model for response gate").option("--agent-gate-prompt <prompt>", "Custom gate prompt").option("--tts-voice <id>", "ElevenLabs voice ID").option("--tts-model <id>", "ElevenLabs model ID").option("--read-receipts <mode>", "Read receipts mode: on, off, or exclude-self").option("--access-mode <mode>", "Access mode: disabled, blocklist, or allowlist").option("--reaction-ack <mode>", "Reaction ack mode (on|off)").option("--reaction-ack-emoji <json>", "Per-channel emoji map as JSON").option("--ack-timeout <ms>", "Ack timeout in milliseconds", (v) => Number.parseInt(v, 10)).option("--agent-stalled-timeout-ms <ms>", "Idle threshold in ms before the internal turn.stalled event fires (no channel message is ever sent)", (v) => Number.parseInt(v, 10)).option("--token <token>", "Generic bot token (auto-resolves to channel-specific field)").option("--telegram-token <token>", "Telegram bot token").option("--discord-token <token>", "Discord bot token").option("--slack-bot-token <token>", "Slack bot token").option("--slack-app-token <token>", "Slack app token").option("--gupshup-callback-url <url>", "Gupshup Custom Integration callback URL").option("--gupshup-auth-token <token>", "Gupshup Custom Integration auth token").option("--gupshup-event-id <id>", "Gupshup event ID (default: nx_omni_agent_reply)").option("--gupshup-handoff-options <json>", "Gupshup HANDOFF routing defaults and customerFields template (JSON object)").option("--gupshup-webhook-verify-token <token>", "Gupshup webhook verify token").option("--twilio-account-sid <sid>", "Twilio Account SID").option("--twilio-auth-token <token>", "Twilio Auth Token").option("--twilio-from <address>", "Twilio WhatsApp sender address (whatsapp:+E164)").option("--twilio-messaging-service-sid <sid>", "Twilio Messaging Service SID").option("--twilio-status-callback-url <url>", "Twilio outbound status callback URL").option("--twilio-webhook-url <url>", "Public Twilio webhook URL for signature validation").option("--twilio-validate-signature", "Validate X-Twilio-Signature on webhooks").option("--no-twilio-validate-signature", "Disable X-Twilio-Signature validation").option("--bridge-tmux-session <name>", 'Tmux session name the genie bridge spawns into for this instance (propagated as GENIE_TMUX_SESSION via NATS). Use "null" to clear.').option("--require-genie-signature", "Require a verified X-Genie-Signature on requests targeting this instance. Bearer-only requests will be rejected with 401.").option("--no-require-genie-signature", "Allow bearer-only requests targeting this instance (default).").option("--allow-first-party", "Process (do not drop) inbound messages whose sender matches another active instance owner. Lets this instance reply to messages from your own personal number.").option("--no-allow-first-party", "Drop inbound messages whose sender matches another active instance owner (default, loop-protection).").option("--is-default", "Set as default instance for channel").action(async (options) => {
144328
- const channel = options.channel;
144329
- if (!VALID_CHANNELS2.includes(channel)) {
144330
- error(`Invalid channel: ${channel}`, { validChannels: VALID_CHANNELS2 });
144420
+ instances.command("create").description("Create a new instance (supports all API fields)").requiredOption("--name <name>", "Instance name").requiredOption("--channel <type>", `Channel type (${VALID_CHANNELS2.join(", ")})`).option("--agent-fk-id <uuid>", 'Agent FK UUID (references agents table, use "null" to clear). When set without --reply-filter-mode, reply filter defaults to {mode:"all", onDm:true} so messages are dispatched instead of silently dropped (omni#443).').option("--agent-provider <id>", "Agent provider ID").option("--agent <id>", "Agent ID").option("--agent-type <type>", "Agent type: agent, team, or workflow").option("--agent-timeout <seconds>", "Agent timeout in seconds", (v4) => Number.parseInt(v4, 10)).option("--agent-error-message <text>", 'Customer-facing reply when agent dispatch fails; repeat the flag for multiple variants (one is picked at random per failure). Use "null" to clear; falls back to OMNI_AGENT_DISPATCH_ERROR_MESSAGE env, then built-in default', (value, previous = []) => [...previous, value]).option("--agent-stream-mode", "Enable streaming responses").option("--agent-session-strategy <strategy>", "Session strategy: per_user, per_chat, per_user_per_chat").option("--agent-prefix-sender-name", "Prefix messages with sender name").option("--no-agent-prefix-sender-name", "Disable sender name prefix").option("--agent-wait-for-media", "Wait for media processing before dispatch").option("--no-agent-wait-for-media", "Dispatch immediately without waiting for media").option("--agent-send-media-path", "Include file path in formatted media text").option("--no-agent-send-media-path", "Exclude file path from formatted media text").option("--agent-send-media-path-types <types>", "Content types that receive file path (comma-separated: image,video,document)").option("--reply-filter-mode <mode>", "Reply filter: all or filtered").option("--reply-on-dm", "Reply to DMs").option("--no-reply-on-dm", "Ignore DMs").option("--reply-on-mention", "Reply when @mentioned").option("--no-reply-on-mention", "Ignore @mentions").option("--reply-on-reply", "Reply when message is reply to bot").option("--no-reply-on-reply", "Ignore replies").option("--reply-on-name", "Reply when bot name appears in text").option("--no-reply-on-name", "Ignore name matches").option("--reply-name-patterns <patterns>", "Custom name patterns (comma-separated)").option("--enable-auto-split", "Split responses on double newlines").option("--no-enable-auto-split", "Disable auto-split").option("--message-format-mode <mode>", "Format mode: convert or passthrough").option("--debounce-mode <mode>", "Debounce mode: disabled, fixed, randomized, or presence").option("--debounce-min <ms>", "Minimum debounce delay in ms", (v4) => Number.parseInt(v4, 10)).option("--debounce-max <ms>", "Maximum debounce delay in ms", (v4) => Number.parseInt(v4, 10)).option("--debounce-restart-on-typing", "Restart debounce timer on typing").option("--debounce-group <ms>", "Group chat debounce in ms", (v4) => Number.parseInt(v4, 10)).option("--debounce-max-wait <ms>", "Presence-mode hard cap in ms (flush even under continuous typing)", (v4) => Number.parseInt(v4, 10)).option("--split-delay-mode <mode>", "Split delay mode: disabled, fixed, or randomized").option("--split-delay-fixed <ms>", "Fixed delay between split chunks in ms", (v4) => Number.parseInt(v4, 10)).option("--split-delay-min <ms>", "Minimum delay between split chunks in ms", (v4) => Number.parseInt(v4, 10)).option("--split-delay-max <ms>", "Maximum delay between split chunks in ms", (v4) => Number.parseInt(v4, 10)).option("--agent-gate", "Enable LLM response gate").option("--agent-gate-model <model>", "Model for response gate").option("--agent-gate-prompt <prompt>", "Custom gate prompt").option("--tts-voice <id>", "ElevenLabs voice ID").option("--tts-model <id>", "ElevenLabs model ID").option("--read-receipts <mode>", "Read receipts mode: on, off, or exclude-self").option("--access-mode <mode>", "Access mode: disabled, blocklist, or allowlist").option("--reaction-ack <mode>", "Reaction ack mode (on|off)").option("--reaction-ack-emoji <json>", "Per-channel emoji map as JSON").option("--ack-timeout <ms>", "Ack timeout in milliseconds", (v4) => Number.parseInt(v4, 10)).option("--agent-stalled-timeout-ms <ms>", "Idle threshold in ms before the internal turn.stalled event fires (no channel message is ever sent)", (v4) => Number.parseInt(v4, 10)).option("--token <token>", "Generic bot token (auto-resolves to channel-specific field)").option("--telegram-token <token>", "Telegram bot token").option("--discord-token <token>", "Discord bot token").option("--slack-bot-token <token>", "Slack bot token").option("--slack-app-token <token>", "Slack app token").option("--gupshup-callback-url <url>", "Gupshup Custom Integration callback URL").option("--gupshup-auth-token <token>", "Gupshup Custom Integration auth token").option("--gupshup-event-id <id>", "Gupshup event ID (default: nx_omni_agent_reply)").option("--gupshup-handoff-options <json>", "Gupshup HANDOFF routing defaults and customerFields template (JSON object)").option("--gupshup-webhook-verify-token <token>", "Gupshup webhook verify token").option("--twilio-account-sid <sid>", "Twilio Account SID").option("--twilio-auth-token <token>", "Twilio Auth Token").option("--twilio-from <address>", "Twilio WhatsApp sender address (whatsapp:+E164)").option("--twilio-messaging-service-sid <sid>", "Twilio Messaging Service SID").option("--twilio-status-callback-url <url>", "Twilio outbound status callback URL").option("--twilio-webhook-url <url>", "Public Twilio webhook URL for signature validation").option("--twilio-validate-signature", "Validate X-Twilio-Signature on webhooks").option("--no-twilio-validate-signature", "Disable X-Twilio-Signature validation").option("--bridge-tmux-session <name>", 'Tmux session name the genie bridge spawns into for this instance (propagated as GENIE_TMUX_SESSION via NATS). Use "null" to clear.').option("--require-genie-signature", "Require a verified X-Genie-Signature on requests targeting this instance. Bearer-only requests will be rejected with 401.").option("--no-require-genie-signature", "Allow bearer-only requests targeting this instance (default).").option("--allow-first-party", "Process (do not drop) inbound messages whose sender matches another active instance owner. Lets this instance reply to messages from your own personal number.").option("--no-allow-first-party", "Drop inbound messages whose sender matches another active instance owner (default, loop-protection).").option("--is-default", "Set as default instance for channel").action(async (options) => {
144421
+ const channel2 = options.channel;
144422
+ if (!VALID_CHANNELS2.includes(channel2)) {
144423
+ error(`Invalid channel: ${channel2}`, { validChannels: VALID_CHANNELS2 });
144331
144424
  }
144332
144425
  try {
144333
144426
  const body = buildInstanceBody(options);
144334
144427
  body.name = options.name;
144335
- body.channel = channel;
144428
+ body.channel = channel2;
144336
144429
  setBool(body, "isDefault", options.isDefault);
144337
144430
  const response = await apiCall2("instances", "POST", body);
144338
- const instance = response.data ?? response;
144339
- success(`Instance created: ${instance.id}`, {
144340
- id: instance.id,
144341
- name: instance.name,
144342
- channel: instance.channel,
144343
- active: instance.isActive
144431
+ const instance3 = response.data ?? response;
144432
+ success(`Instance created: ${instance3.id}`, {
144433
+ id: instance3.id,
144434
+ name: instance3.name,
144435
+ channel: instance3.channel,
144436
+ active: instance3.isActive
144344
144437
  });
144345
- } catch (err) {
144346
- const message = err instanceof Error ? err.message : "Unknown error";
144347
- error(`Failed to create instance: ${message}`);
144438
+ } catch (err2) {
144439
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144440
+ error(`Failed to create instance: ${message2}`);
144348
144441
  }
144349
144442
  });
144350
144443
  instances.command("delete <id>").description("Delete an instance").action(async (rawId) => {
@@ -144353,9 +144446,9 @@ function createInstancesCommand() {
144353
144446
  const id = await resolveInstanceId(rawId);
144354
144447
  await client.instances.delete(id);
144355
144448
  success(`Instance deleted: ${id}`);
144356
- } catch (err) {
144357
- const message = err instanceof Error ? err.message : "Unknown error";
144358
- error(`Failed to delete instance: ${message}`);
144449
+ } catch (err2) {
144450
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144451
+ error(`Failed to delete instance: ${message2}`);
144359
144452
  }
144360
144453
  });
144361
144454
  instances.command("status <id>").description("Get instance connection status").action(async (rawId) => {
@@ -144367,9 +144460,9 @@ function createInstancesCommand() {
144367
144460
  instanceId: id,
144368
144461
  ...status
144369
144462
  });
144370
- } catch (err) {
144371
- const message = err instanceof Error ? err.message : "Unknown error";
144372
- error(`Failed to get status: ${message}`, undefined, 3);
144463
+ } catch (err2) {
144464
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144465
+ error(`Failed to get status: ${message2}`, undefined, 3);
144373
144466
  }
144374
144467
  });
144375
144468
  instances.command("whoami <id>").description("Show phone number and identity for an instance").action(async (rawId) => {
@@ -144387,9 +144480,9 @@ function createInstancesCommand() {
144387
144480
  state: status.state,
144388
144481
  isConnected: status.isConnected
144389
144482
  });
144390
- } catch (err) {
144391
- const message = err instanceof Error ? err.message : "Unknown error";
144392
- error(`Failed to get identity: ${message}`);
144483
+ } catch (err2) {
144484
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144485
+ error(`Failed to get identity: ${message2}`);
144393
144486
  }
144394
144487
  });
144395
144488
  instances.command("qr <id>").description("Get QR code for WhatsApp instances").option("--base64", "Output raw base64 instead of ASCII").option("--no-watch", "Show QR once without auto-refreshing").action(async (rawId, options) => {
@@ -144439,18 +144532,18 @@ function createInstancesCommand() {
144439
144532
  const connected = await fetchAndShowQr(true);
144440
144533
  if (!connected)
144441
144534
  setTimeout(poll, QR_POLL_INTERVAL_MS);
144442
- } catch (err) {
144443
- const message = err instanceof Error ? err.message : "Unknown error";
144444
- error(`Failed to get QR code: ${message}`);
144535
+ } catch (err2) {
144536
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144537
+ error(`Failed to get QR code: ${message2}`);
144445
144538
  }
144446
144539
  };
144447
144540
  await poll();
144448
144541
  } else {
144449
144542
  try {
144450
144543
  await fetchAndShowQr(false);
144451
- } catch (err) {
144452
- const message = err instanceof Error ? err.message : "Unknown error";
144453
- error(`Failed to get QR code: ${message}`);
144544
+ } catch (err2) {
144545
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144546
+ error(`Failed to get QR code: ${message2}`);
144454
144547
  }
144455
144548
  }
144456
144549
  });
@@ -144465,9 +144558,9 @@ function createInstancesCommand() {
144465
144558
  expiresIn: result.expiresIn,
144466
144559
  message: result.message
144467
144560
  });
144468
- } catch (err) {
144469
- const message = err instanceof Error ? err.message : "Unknown error";
144470
- error(`Failed to request pairing code: ${message}`);
144561
+ } catch (err2) {
144562
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144563
+ error(`Failed to request pairing code: ${message2}`);
144471
144564
  }
144472
144565
  });
144473
144566
  instances.command("passkey <id>").description("Get the pending WhatsApp passkey ceremony").action(async (rawId) => {
@@ -144475,9 +144568,9 @@ function createInstancesCommand() {
144475
144568
  try {
144476
144569
  const id = await resolveInstanceId(rawId);
144477
144570
  data(await client.instances.passkey(id));
144478
- } catch (err) {
144479
- const message = err instanceof Error ? err.message : "Unknown error";
144480
- error(`Failed to get passkey state: ${message}`);
144571
+ } catch (err2) {
144572
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144573
+ error(`Failed to get passkey state: ${message2}`);
144481
144574
  }
144482
144575
  });
144483
144576
  instances.command("passkey-submit <id>").description("Submit a WebAuthn assertion for WhatsApp pairing").requiredOption("--response-file <path>", "JSON file containing the one-time WebAuthn assertion").action(async (rawId, options) => {
@@ -144487,9 +144580,9 @@ function createInstancesCommand() {
144487
144580
  const credential = await Bun.file(options.responseFile).json();
144488
144581
  await client.instances.submitPasskey(id, credential);
144489
144582
  success("Passkey response submitted");
144490
- } catch (err) {
144491
- const message = err instanceof Error ? err.message : "Unknown error";
144492
- error(`Failed to submit passkey response: ${message}`);
144583
+ } catch (err2) {
144584
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144585
+ error(`Failed to submit passkey response: ${message2}`);
144493
144586
  }
144494
144587
  });
144495
144588
  instances.command("passkey-confirm <id>").description("Confirm a pending WhatsApp passkey pairing").action(async (rawId) => {
@@ -144498,9 +144591,9 @@ function createInstancesCommand() {
144498
144591
  const id = await resolveInstanceId(rawId);
144499
144592
  await client.instances.confirmPasskey(id);
144500
144593
  success("Passkey pairing confirmed");
144501
- } catch (err) {
144502
- const message = err instanceof Error ? err.message : "Unknown error";
144503
- error(`Failed to confirm passkey pairing: ${message}`);
144594
+ } catch (err2) {
144595
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144596
+ error(`Failed to confirm passkey pairing: ${message2}`);
144504
144597
  }
144505
144598
  });
144506
144599
  instances.command("connect <id>").description("Connect an instance").option("--force-new-qr", "Force generation of new QR code").option("--token <token>", "Discord bot token (for Discord instances)").option("--twilio-account-sid <sid>", "Twilio Account SID").option("--twilio-auth-token <token>", "Twilio Auth Token").option("--twilio-from <address>", "Twilio WhatsApp sender address (whatsapp:+E164)").option("--twilio-messaging-service-sid <sid>", "Twilio Messaging Service SID").option("--twilio-status-callback-url <url>", "Twilio outbound status callback URL").option("--twilio-webhook-url <url>", "Public Twilio webhook URL for signature validation").option("--twilio-validate-signature", "Validate X-Twilio-Signature on webhooks").option("--no-twilio-validate-signature", "Disable X-Twilio-Signature validation").option("--access-token <token>", "WhatsApp Cloud (Meta) access token \u2014 pair with --phone-number-id + --waba-id").option("--phone-number-id <id>", "WhatsApp Cloud phone_number_id (Graph API id, not E.164)").option("--waba-id <id>", "WhatsApp Business Account id (WABA id)").option("--meta-app-id <id>", "Optional override for META_APP_ID (when the tenant owns its own Meta App)").option("--meta-business-id <id>", "Optional Meta Business Manager id").action(async (rawId, options) => {
@@ -144509,9 +144602,9 @@ function createInstancesCommand() {
144509
144602
  const id = await resolveInstanceId(rawId);
144510
144603
  const wantsWhatsAppBusiness = options.accessToken && options.phoneNumberId && options.wabaId;
144511
144604
  if (wantsWhatsAppBusiness) {
144512
- const instance = await client.instances.get(id);
144513
- if (instance.channel !== "whatsapp-business") {
144514
- error(`Instance ${id} is not a whatsapp-business instance (channel=${instance.channel}). --access-token/--phone-number-id/--waba-id only apply to whatsapp-business.`);
144605
+ const instance3 = await client.instances.get(id);
144606
+ if (instance3.channel !== "whatsapp-business") {
144607
+ error(`Instance ${id} is not a whatsapp-business instance (channel=${instance3.channel}). --access-token/--phone-number-id/--waba-id only apply to whatsapp-business.`);
144515
144608
  return;
144516
144609
  }
144517
144610
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), exports_config));
@@ -144530,8 +144623,8 @@ function createInstancesCommand() {
144530
144623
  })
144531
144624
  });
144532
144625
  if (!resp.ok) {
144533
- const err = await resp.json().catch(() => ({}));
144534
- error(`Failed to connect: ${err?.error?.message ?? `HTTP ${resp.status}`}`);
144626
+ const err2 = await resp.json().catch(() => ({}));
144627
+ error(`Failed to connect: ${err2?.error?.message ?? `HTTP ${resp.status}`}`);
144535
144628
  return;
144536
144629
  }
144537
144630
  const result2 = await resp.json();
@@ -144556,9 +144649,9 @@ function createInstancesCommand() {
144556
144649
  success(result.message, {
144557
144650
  status: result.status
144558
144651
  });
144559
- } catch (err) {
144560
- const message = err instanceof Error ? err.message : "Unknown error";
144561
- error(`Failed to connect: ${message}`);
144652
+ } catch (err2) {
144653
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144654
+ error(`Failed to connect: ${message2}`);
144562
144655
  }
144563
144656
  });
144564
144657
  instances.command("disconnect <id>").description("Disconnect an instance").action(async (rawId) => {
@@ -144567,9 +144660,9 @@ function createInstancesCommand() {
144567
144660
  const id = await resolveInstanceId(rawId);
144568
144661
  await client.instances.disconnect(id);
144569
144662
  success(`Instance disconnected: ${id}`);
144570
- } catch (err) {
144571
- const message = err instanceof Error ? err.message : "Unknown error";
144572
- error(`Failed to disconnect: ${message}`);
144663
+ } catch (err2) {
144664
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144665
+ error(`Failed to disconnect: ${message2}`);
144573
144666
  }
144574
144667
  });
144575
144668
  instances.command("restart <id>").description("Restart an instance").option("--force-new-qr", "Force generation of new QR code after restart").action(async (rawId, options) => {
@@ -144580,9 +144673,9 @@ function createInstancesCommand() {
144580
144673
  success(result.message, {
144581
144674
  status: result.status
144582
144675
  });
144583
- } catch (err) {
144584
- const message = err instanceof Error ? err.message : "Unknown error";
144585
- error(`Failed to restart: ${message}`);
144676
+ } catch (err2) {
144677
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144678
+ error(`Failed to restart: ${message2}`);
144586
144679
  }
144587
144680
  });
144588
144681
  instances.command("logout <id>").description("Logout and clear session data").action(async (rawId) => {
@@ -144591,9 +144684,9 @@ function createInstancesCommand() {
144591
144684
  const id = await resolveInstanceId(rawId);
144592
144685
  await client.instances.logout(id);
144593
144686
  success(`Instance logged out: ${id}`);
144594
- } catch (err) {
144595
- const message = err instanceof Error ? err.message : "Unknown error";
144596
- error(`Failed to logout: ${message}`);
144687
+ } catch (err2) {
144688
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144689
+ error(`Failed to logout: ${message2}`);
144597
144690
  }
144598
144691
  });
144599
144692
  instances.command("sync <id>").description("Start a sync operation").requiredOption("--type <type>", `Sync type (${VALID_SYNC_TYPES.join(", ")})`).option("--depth <depth>", "Sync depth (7d, 30d, 90d, 1y, all)").option("--download-media", "Download media files").option("--chat <jid>", "Specific chat JID for per-chat active sync (WhatsApp only)").action(async (rawId, options) => {
@@ -144623,9 +144716,9 @@ function createInstancesCommand() {
144623
144716
  status: result.status,
144624
144717
  mode: syncMode
144625
144718
  });
144626
- } catch (err) {
144627
- const message = err instanceof Error ? err.message : "Unknown error";
144628
- error(`Failed to start sync: ${message}`);
144719
+ } catch (err2) {
144720
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144721
+ error(`Failed to start sync: ${message2}`);
144629
144722
  }
144630
144723
  });
144631
144724
  instances.command("syncs <id> [jobId]").description("List sync jobs or get job status").option("--status <status>", "Filter by status").option("--limit <n>", "Limit results", Number.parseInt).action(async (rawId, jobId, options) => {
@@ -144642,25 +144735,25 @@ function createInstancesCommand() {
144642
144735
  });
144643
144736
  list(result.items, { emptyMessage: "No sync jobs found." });
144644
144737
  }
144645
- } catch (err) {
144646
- const message = err instanceof Error ? err.message : "Unknown error";
144647
- error(`Failed to get sync info: ${message}`, undefined, 3);
144738
+ } catch (err2) {
144739
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144740
+ error(`Failed to get sync info: ${message2}`, undefined, 3);
144648
144741
  }
144649
144742
  });
144650
144743
  async function updateProfileName(instanceId, name) {
144651
- const config = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144652
- const apiUrl = (config.apiUrl ?? "http://localhost:8882").replace(/\/$/, "");
144744
+ const config2 = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144745
+ const apiUrl = (config2.apiUrl ?? "http://localhost:8882").replace(/\/$/, "");
144653
144746
  const response = await fetch(`${apiUrl}/api/v2/instances/${instanceId}/profile/name`, {
144654
144747
  method: "PUT",
144655
- headers: { "Content-Type": "application/json", "x-api-key": config.apiKey ?? "" },
144748
+ headers: { "Content-Type": "application/json", "x-api-key": config2.apiKey ?? "" },
144656
144749
  body: JSON.stringify({ name })
144657
144750
  });
144658
144751
  if (!response.ok) {
144659
- const err = await response.json();
144660
- throw new Error(err?.error?.message ?? `HTTP ${response.status}`);
144752
+ const err2 = await response.json();
144753
+ throw new Error(err2?.error?.message ?? `HTTP ${response.status}`);
144661
144754
  }
144662
144755
  }
144663
- instances.command("update <id>").description("Update an instance (supports all API fields)").option("--name <name>", "Instance name").option("--is-default", "Set as default instance for channel").option("--no-is-default", "Unset as default instance for channel").option("--agent-fk-id <uuid>", 'Agent FK UUID (references agents table, use "null" to clear). When assigning an agent on an instance with no reply filter, the filter defaults to {mode:"all", onDm:true} so messages are dispatched instead of silently dropped (omni#443).').option("--agent-provider <id>", 'Agent provider ID (use "null" to clear)').option("--agent <id>", 'Agent ID (use "null" to clear)').option("--agent-type <type>", "Agent type: agent, team, or workflow").option("--agent-timeout <seconds>", "Agent timeout in seconds", (v) => Number.parseInt(v, 10)).option("--agent-error-message <text>", 'Customer-facing reply when agent dispatch fails; repeat the flag for multiple variants (one is picked at random per failure). Use "null" to clear; falls back to OMNI_AGENT_DISPATCH_ERROR_MESSAGE env, then built-in default', (value, previous = []) => [...previous, value]).option("--agent-stream-mode", "Enable streaming responses").option("--no-agent-stream-mode", "Disable streaming responses").option("--agent-session-strategy <strategy>", "Session strategy: per_user, per_chat, per_user_per_chat").option("--agent-prefix-sender-name", "Prefix messages with sender name").option("--no-agent-prefix-sender-name", "Disable sender name prefix").option("--agent-wait-for-media", "Wait for media processing before dispatch").option("--no-agent-wait-for-media", "Dispatch immediately without waiting for media").option("--agent-send-media-path", "Include file path in formatted media text").option("--no-agent-send-media-path", "Exclude file path from formatted media text").option("--agent-send-media-path-types <types>", "Content types that receive file path (comma-separated: image,video,document)").option("--reply-filter-mode <mode>", "Reply filter: all or filtered").option("--reply-on-dm", "Reply to DMs (requires --reply-filter-mode filtered)").option("--no-reply-on-dm", "Ignore DMs").option("--reply-on-mention", "Reply when @mentioned").option("--no-reply-on-mention", "Ignore @mentions").option("--reply-on-reply", "Reply when message is reply to bot").option("--no-reply-on-reply", "Ignore replies").option("--reply-on-name", "Reply when bot name appears in text").option("--no-reply-on-name", "Ignore name matches").option("--reply-name-patterns <patterns>", "Custom name patterns (comma-separated)").option("--clear-reply-filter", "Remove reply filter (set to null)").option("--enable-auto-split", "Split responses on double newlines").option("--no-enable-auto-split", "Disable auto-split").option("--message-format-mode <mode>", "Format mode: convert or passthrough").option("--debounce-mode <mode>", "Debounce mode: disabled, fixed, randomized, or presence").option("--debounce-min <ms>", "Minimum debounce delay in ms", (v) => Number.parseInt(v, 10)).option("--debounce-max <ms>", "Maximum debounce delay in ms", (v) => Number.parseInt(v, 10)).option("--debounce-restart-on-typing", "Restart debounce timer on typing").option("--no-debounce-restart-on-typing", "Do not restart debounce on typing").option("--debounce-group <ms>", 'Group chat debounce in ms (use "null" to inherit)', (v) => v === "null" ? null : Number.parseInt(v, 10)).option("--debounce-max-wait <ms>", 'Presence-mode hard cap in ms (use "null" to inherit)', (v) => v === "null" ? null : Number.parseInt(v, 10)).option("--split-delay-mode <mode>", "Split delay mode: disabled, fixed, or randomized").option("--split-delay-fixed <ms>", "Fixed delay between split chunks in ms", (v) => Number.parseInt(v, 10)).option("--split-delay-min <ms>", "Minimum delay between split chunks in ms", (v) => Number.parseInt(v, 10)).option("--split-delay-max <ms>", "Maximum delay between split chunks in ms", (v) => Number.parseInt(v, 10)).option("--agent-gate", "Enable LLM response gate").option("--no-agent-gate", "Disable LLM response gate").option("--agent-gate-model <model>", 'Model for response gate (use "null" for default)').option("--agent-gate-prompt <prompt>", 'Custom gate prompt (use "null" for default)').option("--tts-voice <id>", 'ElevenLabs voice ID (use "null" to clear)').option("--tts-model <id>", 'ElevenLabs model ID (use "null" to clear)').option("--read-receipts <mode>", "Read receipts mode: on, off, or exclude-self").option("--access-mode <mode>", "Access mode: disabled, blocklist, or allowlist").option("--reaction-ack <mode>", "Reaction ack mode (on|off)").option("--reaction-ack-emoji <json>", "Per-channel emoji map as JSON").option("--ack-timeout <ms>", "Ack timeout in milliseconds", (v) => Number.parseInt(v, 10)).option("--agent-stalled-timeout-ms <ms>", "Idle threshold in ms before the internal turn.stalled event fires (no channel message is ever sent)", (v) => Number.parseInt(v, 10)).option("--token <token>", "Generic bot token (auto-resolves to channel-specific field)").option("--telegram-token <token>", 'Telegram bot token (use "null" to clear)').option("--discord-token <token>", 'Discord bot token (use "null" to clear)').option("--slack-bot-token <token>", 'Slack bot token (use "null" to clear)').option("--slack-app-token <token>", 'Slack app token (use "null" to clear)').option("--twilio-account-sid <sid>", 'Twilio Account SID (use "null" to clear)').option("--twilio-auth-token <token>", 'Twilio Auth Token (use "null" to clear)').option("--twilio-from <address>", 'Twilio WhatsApp sender address (use "null" to clear)').option("--twilio-messaging-service-sid <sid>", 'Twilio Messaging Service SID (use "null" to clear)').option("--twilio-status-callback-url <url>", 'Twilio outbound status callback URL (use "null" to clear)').option("--twilio-webhook-url <url>", 'Public Twilio webhook URL for signature validation (use "null" to clear)').option("--twilio-validate-signature", "Validate X-Twilio-Signature on webhooks").option("--no-twilio-validate-signature", "Disable X-Twilio-Signature validation").option("--gupshup-handoff-options <json>", 'Gupshup HANDOFF routing defaults and customerFields template (JSON object, use "null" to clear). The plugin reads it at connect: restart the instance for the change to take effect').option("--trigger-events <events>", 'Trigger events (comma-separated, use "null" to clear)').option("--profile-name <name>", "Update WhatsApp display name (push name)").option("--bridge-tmux-session <name>", 'Tmux session name the genie bridge spawns into for this instance (propagated as GENIE_TMUX_SESSION via NATS). Use "null" to clear.').option("--require-genie-signature", "Require a verified X-Genie-Signature on requests targeting this instance. Bearer-only requests will be rejected with 401.").option("--no-require-genie-signature", "Allow bearer-only requests targeting this instance (default).").option("--allow-first-party", "Process (do not drop) inbound messages whose sender matches another active instance owner. Lets this instance reply to messages from your own personal number.").option("--no-allow-first-party", "Drop inbound messages whose sender matches another active instance owner (default, loop-protection).").action(async (rawId, options) => {
144756
+ instances.command("update <id>").description("Update an instance (supports all API fields)").option("--name <name>", "Instance name").option("--is-default", "Set as default instance for channel").option("--no-is-default", "Unset as default instance for channel").option("--agent-fk-id <uuid>", 'Agent FK UUID (references agents table, use "null" to clear). When assigning an agent on an instance with no reply filter, the filter defaults to {mode:"all", onDm:true} so messages are dispatched instead of silently dropped (omni#443).').option("--agent-provider <id>", 'Agent provider ID (use "null" to clear)').option("--agent <id>", 'Agent ID (use "null" to clear)').option("--agent-type <type>", "Agent type: agent, team, or workflow").option("--agent-timeout <seconds>", "Agent timeout in seconds", (v4) => Number.parseInt(v4, 10)).option("--agent-error-message <text>", 'Customer-facing reply when agent dispatch fails; repeat the flag for multiple variants (one is picked at random per failure). Use "null" to clear; falls back to OMNI_AGENT_DISPATCH_ERROR_MESSAGE env, then built-in default', (value, previous = []) => [...previous, value]).option("--agent-stream-mode", "Enable streaming responses").option("--no-agent-stream-mode", "Disable streaming responses").option("--agent-session-strategy <strategy>", "Session strategy: per_user, per_chat, per_user_per_chat").option("--agent-prefix-sender-name", "Prefix messages with sender name").option("--no-agent-prefix-sender-name", "Disable sender name prefix").option("--agent-wait-for-media", "Wait for media processing before dispatch").option("--no-agent-wait-for-media", "Dispatch immediately without waiting for media").option("--agent-send-media-path", "Include file path in formatted media text").option("--no-agent-send-media-path", "Exclude file path from formatted media text").option("--agent-send-media-path-types <types>", "Content types that receive file path (comma-separated: image,video,document)").option("--reply-filter-mode <mode>", "Reply filter: all or filtered").option("--reply-on-dm", "Reply to DMs (requires --reply-filter-mode filtered)").option("--no-reply-on-dm", "Ignore DMs").option("--reply-on-mention", "Reply when @mentioned").option("--no-reply-on-mention", "Ignore @mentions").option("--reply-on-reply", "Reply when message is reply to bot").option("--no-reply-on-reply", "Ignore replies").option("--reply-on-name", "Reply when bot name appears in text").option("--no-reply-on-name", "Ignore name matches").option("--reply-name-patterns <patterns>", "Custom name patterns (comma-separated)").option("--clear-reply-filter", "Remove reply filter (set to null)").option("--enable-auto-split", "Split responses on double newlines").option("--no-enable-auto-split", "Disable auto-split").option("--message-format-mode <mode>", "Format mode: convert or passthrough").option("--debounce-mode <mode>", "Debounce mode: disabled, fixed, randomized, or presence").option("--debounce-min <ms>", "Minimum debounce delay in ms", (v4) => Number.parseInt(v4, 10)).option("--debounce-max <ms>", "Maximum debounce delay in ms", (v4) => Number.parseInt(v4, 10)).option("--debounce-restart-on-typing", "Restart debounce timer on typing").option("--no-debounce-restart-on-typing", "Do not restart debounce on typing").option("--debounce-group <ms>", 'Group chat debounce in ms (use "null" to inherit)', (v4) => v4 === "null" ? null : Number.parseInt(v4, 10)).option("--debounce-max-wait <ms>", 'Presence-mode hard cap in ms (use "null" to inherit)', (v4) => v4 === "null" ? null : Number.parseInt(v4, 10)).option("--split-delay-mode <mode>", "Split delay mode: disabled, fixed, or randomized").option("--split-delay-fixed <ms>", "Fixed delay between split chunks in ms", (v4) => Number.parseInt(v4, 10)).option("--split-delay-min <ms>", "Minimum delay between split chunks in ms", (v4) => Number.parseInt(v4, 10)).option("--split-delay-max <ms>", "Maximum delay between split chunks in ms", (v4) => Number.parseInt(v4, 10)).option("--agent-gate", "Enable LLM response gate").option("--no-agent-gate", "Disable LLM response gate").option("--agent-gate-model <model>", 'Model for response gate (use "null" for default)').option("--agent-gate-prompt <prompt>", 'Custom gate prompt (use "null" for default)').option("--tts-voice <id>", 'ElevenLabs voice ID (use "null" to clear)').option("--tts-model <id>", 'ElevenLabs model ID (use "null" to clear)').option("--read-receipts <mode>", "Read receipts mode: on, off, or exclude-self").option("--access-mode <mode>", "Access mode: disabled, blocklist, or allowlist").option("--reaction-ack <mode>", "Reaction ack mode (on|off)").option("--reaction-ack-emoji <json>", "Per-channel emoji map as JSON").option("--ack-timeout <ms>", "Ack timeout in milliseconds", (v4) => Number.parseInt(v4, 10)).option("--agent-stalled-timeout-ms <ms>", "Idle threshold in ms before the internal turn.stalled event fires (no channel message is ever sent)", (v4) => Number.parseInt(v4, 10)).option("--token <token>", "Generic bot token (auto-resolves to channel-specific field)").option("--telegram-token <token>", 'Telegram bot token (use "null" to clear)').option("--discord-token <token>", 'Discord bot token (use "null" to clear)').option("--slack-bot-token <token>", 'Slack bot token (use "null" to clear)').option("--slack-app-token <token>", 'Slack app token (use "null" to clear)').option("--twilio-account-sid <sid>", 'Twilio Account SID (use "null" to clear)').option("--twilio-auth-token <token>", 'Twilio Auth Token (use "null" to clear)').option("--twilio-from <address>", 'Twilio WhatsApp sender address (use "null" to clear)').option("--twilio-messaging-service-sid <sid>", 'Twilio Messaging Service SID (use "null" to clear)').option("--twilio-status-callback-url <url>", 'Twilio outbound status callback URL (use "null" to clear)').option("--twilio-webhook-url <url>", 'Public Twilio webhook URL for signature validation (use "null" to clear)').option("--twilio-validate-signature", "Validate X-Twilio-Signature on webhooks").option("--no-twilio-validate-signature", "Disable X-Twilio-Signature validation").option("--gupshup-handoff-options <json>", 'Gupshup HANDOFF routing defaults and customerFields template (JSON object, use "null" to clear). The plugin reads it at connect: restart the instance for the change to take effect').option("--trigger-events <events>", 'Trigger events (comma-separated, use "null" to clear)').option("--profile-name <name>", "Update WhatsApp display name (push name)").option("--bridge-tmux-session <name>", 'Tmux session name the genie bridge spawns into for this instance (propagated as GENIE_TMUX_SESSION via NATS). Use "null" to clear.').option("--require-genie-signature", "Require a verified X-Genie-Signature on requests targeting this instance. Bearer-only requests will be rejected with 401.").option("--no-require-genie-signature", "Allow bearer-only requests targeting this instance (default).").option("--allow-first-party", "Process (do not drop) inbound messages whose sender matches another active instance owner. Lets this instance reply to messages from your own personal number.").option("--no-allow-first-party", "Drop inbound messages whose sender matches another active instance owner (default, loop-protection).").action(async (rawId, options) => {
144664
144757
  const client = getClient();
144665
144758
  try {
144666
144759
  const id = await resolveInstanceId(rawId);
@@ -144681,12 +144774,12 @@ function createInstancesCommand() {
144681
144774
  } else if (!options.profileName) {
144682
144775
  error("No update options provided. Use --help to see all available options.");
144683
144776
  }
144684
- } catch (err) {
144685
- const message = err instanceof Error ? err.message : "Unknown error";
144686
- error(`Failed to update instance: ${message}`);
144777
+ } catch (err2) {
144778
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144779
+ error(`Failed to update instance: ${message2}`);
144687
144780
  }
144688
144781
  });
144689
- instances.command("contacts <id>").description("List contacts for an instance").option("--limit <n>", "Limit results", (v) => Number.parseInt(v, 10)).option("--cursor <cursor>", "Pagination cursor").option("--guild <id>", "Guild ID (required for Discord)").option("--search <query>", "Filter contacts by name or phone").option("--no-groups", "Exclude group contacts").action(async (rawId, options) => {
144782
+ instances.command("contacts <id>").description("List contacts for an instance").option("--limit <n>", "Limit results", (v4) => Number.parseInt(v4, 10)).option("--cursor <cursor>", "Pagination cursor").option("--guild <id>", "Guild ID (required for Discord)").option("--search <query>", "Filter contacts by name or phone").option("--no-groups", "Exclude group contacts").action(async (rawId, options) => {
144690
144783
  const client = getClient();
144691
144784
  try {
144692
144785
  const id = await resolveInstanceId(rawId);
@@ -144697,12 +144790,12 @@ function createInstancesCommand() {
144697
144790
  search: options.search,
144698
144791
  excludeGroups: options.groups === false ? true : undefined
144699
144792
  });
144700
- const items = result.items.map((c2) => ({
144701
- jid: c2.platformUserId,
144702
- name: c2.displayName ?? "-",
144703
- phone: c2.phone ?? "-",
144704
- isGroup: c2.isGroup ? "yes" : "no",
144705
- isBusiness: c2.isBusiness ? "yes" : "no"
144793
+ const items = result.items.map((c10) => ({
144794
+ jid: c10.platformUserId,
144795
+ name: c10.displayName ?? "-",
144796
+ phone: c10.phone ?? "-",
144797
+ isGroup: c10.isGroup ? "yes" : "no",
144798
+ isBusiness: c10.isBusiness ? "yes" : "no"
144706
144799
  }));
144707
144800
  list(items, { emptyMessage: "No contacts found.", rawData: result.items });
144708
144801
  if (result.meta.hasMore) {
@@ -144712,12 +144805,12 @@ function createInstancesCommand() {
144712
144805
  dim("More results available. Use --limit to adjust page size.");
144713
144806
  }
144714
144807
  }
144715
- } catch (err) {
144716
- const message = err instanceof Error ? err.message : "Unknown error";
144717
- error(`Failed to list contacts: ${message}`);
144808
+ } catch (err2) {
144809
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144810
+ error(`Failed to list contacts: ${message2}`);
144718
144811
  }
144719
144812
  });
144720
- instances.command("groups <id>").description("List groups for an instance").option("--limit <n>", "Limit results", (v) => Number.parseInt(v, 10)).option("--cursor <cursor>", "Pagination cursor").option("--search <query>", "Filter groups by name").action(async (rawId, options) => {
144813
+ instances.command("groups <id>").description("List groups for an instance").option("--limit <n>", "Limit results", (v4) => Number.parseInt(v4, 10)).option("--cursor <cursor>", "Pagination cursor").option("--search <query>", "Filter groups by name").action(async (rawId, options) => {
144721
144814
  const client = getClient();
144722
144815
  try {
144723
144816
  const id = await resolveInstanceId(rawId);
@@ -144726,11 +144819,11 @@ function createInstancesCommand() {
144726
144819
  cursor: options.cursor,
144727
144820
  search: options.search
144728
144821
  });
144729
- const items = result.items.map((g) => ({
144730
- jid: g.externalId,
144731
- name: g.name ?? "-",
144732
- members: g.memberCount ?? "-",
144733
- description: g.description ? g.description.length > 50 ? `${g.description.substring(0, 47)}...` : g.description : "-"
144822
+ const items = result.items.map((g11) => ({
144823
+ jid: g11.externalId,
144824
+ name: g11.name ?? "-",
144825
+ members: g11.memberCount ?? "-",
144826
+ description: g11.description ? g11.description.length > 50 ? `${g11.description.substring(0, 47)}...` : g11.description : "-"
144734
144827
  }));
144735
144828
  list(items, { emptyMessage: "No groups found.", rawData: result.items });
144736
144829
  if (result.meta.hasMore) {
@@ -144740,24 +144833,24 @@ function createInstancesCommand() {
144740
144833
  dim("More results available. Use --limit to adjust page size.");
144741
144834
  }
144742
144835
  }
144743
- } catch (err) {
144744
- const message = err instanceof Error ? err.message : "Unknown error";
144745
- error(`Failed to list groups: ${message}`);
144836
+ } catch (err2) {
144837
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144838
+ error(`Failed to list groups: ${message2}`);
144746
144839
  }
144747
144840
  });
144748
144841
  instances.command("group-members <id> <jid>").description("List members of a group").action(async (rawId, jid) => {
144749
144842
  try {
144750
144843
  const id = await resolveInstanceId(rawId);
144751
144844
  const result = await apiCall2(`instances/${id}/groups/${encodeURIComponent(jid)}/members`);
144752
- const items = result.members.map((m) => ({
144753
- id: m.id,
144754
- name: m.name ?? "-",
144755
- role: m.role ?? "member"
144845
+ const items = result.members.map((m10) => ({
144846
+ id: m10.id,
144847
+ name: m10.name ?? "-",
144848
+ role: m10.role ?? "member"
144756
144849
  }));
144757
144850
  list(items, { emptyMessage: "No members found.", rawData: result.members });
144758
- } catch (err) {
144759
- const message = err instanceof Error ? err.message : "Unknown error";
144760
- error(`Failed to list group members: ${message}`);
144851
+ } catch (err2) {
144852
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144853
+ error(`Failed to list group members: ${message2}`);
144761
144854
  }
144762
144855
  });
144763
144856
  instances.command("profile <id> <userId>").description("Get user profile from the channel").action(async (rawId, userId) => {
@@ -144767,25 +144860,25 @@ function createInstancesCommand() {
144767
144860
  const profile = await client.instances.getUserProfile(id, userId);
144768
144861
  const bio = profile.bio;
144769
144862
  data({ ...profile, bio: bio?.status ?? "-" });
144770
- } catch (err) {
144771
- const message = err instanceof Error ? err.message : "Unknown error";
144772
- error(`Failed to get user profile: ${message}`);
144863
+ } catch (err2) {
144864
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144865
+ error(`Failed to get user profile: ${message2}`);
144773
144866
  }
144774
144867
  });
144775
144868
  instances.command("check <id> <phone>").description("Check if phone number is registered on WhatsApp").action(async (rawId, phone) => {
144776
144869
  try {
144777
144870
  const id = await resolveInstanceId(rawId);
144778
- const config = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144779
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
144780
- const apiKey = config.apiKey ?? "";
144871
+ const config2 = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144872
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
144873
+ const apiKey = config2.apiKey ?? "";
144781
144874
  const resp = await fetch(`${baseUrl}/api/v2/instances/${id}/check-number`, {
144782
144875
  method: "POST",
144783
144876
  headers: { "Content-Type": "application/json", "x-api-key": apiKey },
144784
144877
  body: JSON.stringify({ phones: [phone] })
144785
144878
  });
144786
144879
  if (!resp.ok) {
144787
- const err = await resp.json();
144788
- throw new Error(err?.error?.message ?? `API error: ${resp.status}`);
144880
+ const err2 = await resp.json();
144881
+ throw new Error(err2?.error?.message ?? `API error: ${resp.status}`);
144789
144882
  }
144790
144883
  const data2 = await resp.json();
144791
144884
  const result = data2.data.results[0];
@@ -144794,86 +144887,86 @@ function createInstancesCommand() {
144794
144887
  } else {
144795
144888
  warn(`${phone} is NOT registered on WhatsApp`);
144796
144889
  }
144797
- } catch (err) {
144798
- const message = err instanceof Error ? err.message : "Unknown error";
144799
- error(`Failed to check number: ${message}`);
144890
+ } catch (err2) {
144891
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144892
+ error(`Failed to check number: ${message2}`);
144800
144893
  }
144801
144894
  });
144802
144895
  instances.command("update-bio <id> <status>").description("Update own profile bio/status on WhatsApp").action(async (rawId, status) => {
144803
144896
  try {
144804
144897
  const id = await resolveInstanceId(rawId);
144805
- const config = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144806
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
144807
- const apiKey = config.apiKey ?? "";
144898
+ const config2 = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144899
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
144900
+ const apiKey = config2.apiKey ?? "";
144808
144901
  const resp = await fetch(`${baseUrl}/api/v2/instances/${id}/profile/status`, {
144809
144902
  method: "PUT",
144810
144903
  headers: { "Content-Type": "application/json", "x-api-key": apiKey },
144811
144904
  body: JSON.stringify({ status })
144812
144905
  });
144813
144906
  if (!resp.ok) {
144814
- const err = await resp.json();
144815
- throw new Error(err?.error?.message ?? `API error: ${resp.status}`);
144907
+ const err2 = await resp.json();
144908
+ throw new Error(err2?.error?.message ?? `API error: ${resp.status}`);
144816
144909
  }
144817
144910
  success(`Bio updated: "${status}"`);
144818
- } catch (err) {
144819
- const message = err instanceof Error ? err.message : "Unknown error";
144820
- error(`Failed to update bio: ${message}`);
144911
+ } catch (err2) {
144912
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144913
+ error(`Failed to update bio: ${message2}`);
144821
144914
  }
144822
144915
  });
144823
144916
  instances.command("block <id> <contactId>").description("Block a contact on WhatsApp").action(async (rawId, contactId) => {
144824
144917
  try {
144825
144918
  const id = await resolveInstanceId(rawId);
144826
- const config = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144827
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
144828
- const apiKey = config.apiKey ?? "";
144919
+ const config2 = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144920
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
144921
+ const apiKey = config2.apiKey ?? "";
144829
144922
  const resp = await fetch(`${baseUrl}/api/v2/instances/${id}/block`, {
144830
144923
  method: "POST",
144831
144924
  headers: { "Content-Type": "application/json", "x-api-key": apiKey },
144832
144925
  body: JSON.stringify({ contactId })
144833
144926
  });
144834
144927
  if (!resp.ok) {
144835
- const err = await resp.json();
144836
- throw new Error(err?.error?.message ?? `API error: ${resp.status}`);
144928
+ const err2 = await resp.json();
144929
+ throw new Error(err2?.error?.message ?? `API error: ${resp.status}`);
144837
144930
  }
144838
144931
  success(`Contact blocked: ${contactId}`);
144839
- } catch (err) {
144840
- const message = err instanceof Error ? err.message : "Unknown error";
144841
- error(`Failed to block contact: ${message}`);
144932
+ } catch (err2) {
144933
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144934
+ error(`Failed to block contact: ${message2}`);
144842
144935
  }
144843
144936
  });
144844
144937
  instances.command("unblock <id> <contactId>").description("Unblock a contact on WhatsApp").action(async (rawId, contactId) => {
144845
144938
  try {
144846
144939
  const id = await resolveInstanceId(rawId);
144847
- const config = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144848
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
144849
- const apiKey = config.apiKey ?? "";
144940
+ const config2 = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144941
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
144942
+ const apiKey = config2.apiKey ?? "";
144850
144943
  const resp = await fetch(`${baseUrl}/api/v2/instances/${id}/block`, {
144851
144944
  method: "DELETE",
144852
144945
  headers: { "Content-Type": "application/json", "x-api-key": apiKey },
144853
144946
  body: JSON.stringify({ contactId })
144854
144947
  });
144855
144948
  if (!resp.ok) {
144856
- const err = await resp.json();
144857
- throw new Error(err?.error?.message ?? `API error: ${resp.status}`);
144949
+ const err2 = await resp.json();
144950
+ throw new Error(err2?.error?.message ?? `API error: ${resp.status}`);
144858
144951
  }
144859
144952
  success(`Contact unblocked: ${contactId}`);
144860
- } catch (err) {
144861
- const message = err instanceof Error ? err.message : "Unknown error";
144862
- error(`Failed to unblock contact: ${message}`);
144953
+ } catch (err2) {
144954
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144955
+ error(`Failed to unblock contact: ${message2}`);
144863
144956
  }
144864
144957
  });
144865
144958
  instances.command("blocklist <id>").description("List blocked contacts on WhatsApp").action(async (rawId) => {
144866
144959
  try {
144867
144960
  const id = await resolveInstanceId(rawId);
144868
- const config = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144869
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
144870
- const apiKey = config.apiKey ?? "";
144961
+ const config2 = (await Promise.resolve().then(() => (init_config(), exports_config))).loadConfig();
144962
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
144963
+ const apiKey = config2.apiKey ?? "";
144871
144964
  const resp = await fetch(`${baseUrl}/api/v2/instances/${id}/blocklist`, {
144872
144965
  headers: { "x-api-key": apiKey }
144873
144966
  });
144874
144967
  if (!resp.ok) {
144875
- const err = await resp.json();
144876
- throw new Error(err?.error?.message ?? `API error: ${resp.status}`);
144968
+ const err2 = await resp.json();
144969
+ throw new Error(err2?.error?.message ?? `API error: ${resp.status}`);
144877
144970
  }
144878
144971
  const data2 = await resp.json();
144879
144972
  const { blocklist, count } = data2.data;
@@ -144884,9 +144977,9 @@ function createInstancesCommand() {
144884
144977
  const items = blocklist.map((jid) => ({ jid }));
144885
144978
  list(items, { emptyMessage: "No blocked contacts." });
144886
144979
  dim(`Total: ${count} blocked`);
144887
- } catch (err) {
144888
- const message = err instanceof Error ? err.message : "Unknown error";
144889
- error(`Failed to fetch blocklist: ${message}`);
144980
+ } catch (err2) {
144981
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144982
+ error(`Failed to fetch blocklist: ${message2}`);
144890
144983
  }
144891
144984
  });
144892
144985
  instances.command("update-picture <id>").description("Update instance profile picture").option("--base64 <data>", "Base64-encoded image data").option("--url <url>", "URL to fetch image from").action(async (rawId, options) => {
@@ -144899,9 +144992,9 @@ function createInstancesCommand() {
144899
144992
  const base64Data = await resolveBase64Image(options);
144900
144993
  await apiCall2(`instances/${id}/profile/picture`, "PUT", { base64: base64Data });
144901
144994
  success("Profile picture updated");
144902
- } catch (err) {
144903
- const message = err instanceof Error ? err.message : "Unknown error";
144904
- error(`Failed to update profile picture: ${message}`);
144995
+ } catch (err2) {
144996
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
144997
+ error(`Failed to update profile picture: ${message2}`);
144905
144998
  }
144906
144999
  });
144907
145000
  instances.command("remove-picture <id>").description("Remove instance profile picture").action(async (rawId) => {
@@ -144909,9 +145002,9 @@ function createInstancesCommand() {
144909
145002
  const id = await resolveInstanceId(rawId);
144910
145003
  await apiCall2(`instances/${id}/profile/picture`, "DELETE");
144911
145004
  success("Profile picture removed");
144912
- } catch (err) {
144913
- const message = err instanceof Error ? err.message : "Unknown error";
144914
- error(`Failed to remove profile picture: ${message}`);
145005
+ } catch (err2) {
145006
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145007
+ error(`Failed to remove profile picture: ${message2}`);
144915
145008
  }
144916
145009
  });
144917
145010
  instances.command("group-update-picture <id>").description("Update a WhatsApp group profile picture").requiredOption("--group <jid>", "Group JID (e.g., 120363xxx@g.us)").option("--base64 <data>", "Base64-encoded image data").option("--url <url>", "URL to fetch image from").action(async (rawId, options) => {
@@ -144924,9 +145017,9 @@ function createInstancesCommand() {
144924
145017
  const base64Data = await resolveBase64Image(options);
144925
145018
  await apiCall2(`instances/${id}/groups/${options.group}/picture`, "PUT", { base64: base64Data });
144926
145019
  success(`Group picture updated for ${options.group}`);
144927
- } catch (err) {
144928
- const message = err instanceof Error ? err.message : "Unknown error";
144929
- error(`Failed to update group picture: ${message}`);
145020
+ } catch (err2) {
145021
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145022
+ error(`Failed to update group picture: ${message2}`);
144930
145023
  }
144931
145024
  });
144932
145025
  instances.command("group-create <id>").description("Create a new WhatsApp group").requiredOption("--subject <name>", "Group name/subject").requiredOption("--participants <phones...>", "Phone numbers or JIDs to add (space-separated)").action(async (rawId, opts) => {
@@ -144937,8 +145030,8 @@ function createInstancesCommand() {
144937
145030
  participants: opts.participants
144938
145031
  });
144939
145032
  success(`Group created: ${result.data.id}`, result.data);
144940
- } catch (err) {
144941
- const msg = err instanceof Error ? err.message : String(err);
145033
+ } catch (err2) {
145034
+ const msg = err2 instanceof Error ? err2.message : String(err2);
144942
145035
  error(`Failed to create group: ${msg}`);
144943
145036
  }
144944
145037
  });
@@ -144947,9 +145040,9 @@ function createInstancesCommand() {
144947
145040
  const id = await resolveInstanceId(rawId);
144948
145041
  const result = await apiCall2(`instances/${id}/groups/${encodeURIComponent(groupJid)}/invite`);
144949
145042
  data(result.data);
144950
- } catch (err) {
144951
- const message = err instanceof Error ? err.message : "Unknown error";
144952
- error(`Failed to get invite link: ${message}`);
145043
+ } catch (err2) {
145044
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145045
+ error(`Failed to get invite link: ${message2}`);
144953
145046
  }
144954
145047
  });
144955
145048
  instances.command("group-revoke-invite <id> <groupJid>").description("Revoke group invite link and generate new one").action(async (rawId, groupJid) => {
@@ -144957,9 +145050,9 @@ function createInstancesCommand() {
144957
145050
  const id = await resolveInstanceId(rawId);
144958
145051
  const result = await apiCall2(`instances/${id}/groups/${encodeURIComponent(groupJid)}/invite/revoke`, "POST");
144959
145052
  success("Invite link revoked", result.data);
144960
- } catch (err) {
144961
- const message = err instanceof Error ? err.message : "Unknown error";
144962
- error(`Failed to revoke invite link: ${message}`);
145053
+ } catch (err2) {
145054
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145055
+ error(`Failed to revoke invite link: ${message2}`);
144963
145056
  }
144964
145057
  });
144965
145058
  instances.command("group-join <id> <code>").description("Join a group via invite code").action(async (rawId, code) => {
@@ -144967,9 +145060,9 @@ function createInstancesCommand() {
144967
145060
  const id = await resolveInstanceId(rawId);
144968
145061
  const result = await apiCall2(`instances/${id}/groups/join`, "POST", { code });
144969
145062
  success(`Joined group: ${result.data.groupJid}`, result.data);
144970
- } catch (err) {
144971
- const message = err instanceof Error ? err.message : "Unknown error";
144972
- error(`Failed to join group: ${message}`);
145063
+ } catch (err2) {
145064
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145065
+ error(`Failed to join group: ${message2}`);
144973
145066
  }
144974
145067
  });
144975
145068
  instances.command("privacy <id>").description("Fetch privacy settings").action(async (rawId) => {
@@ -144977,9 +145070,9 @@ function createInstancesCommand() {
144977
145070
  const id = await resolveInstanceId(rawId);
144978
145071
  const result = await apiCall2(`instances/${id}/privacy`);
144979
145072
  data(result.data);
144980
- } catch (err) {
144981
- const message = err instanceof Error ? err.message : "Unknown error";
144982
- error(`Failed to fetch privacy settings: ${message}`);
145073
+ } catch (err2) {
145074
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145075
+ error(`Failed to fetch privacy settings: ${message2}`);
144983
145076
  }
144984
145077
  });
144985
145078
  instances.command("reject-call <id>").description("Reject an incoming call").requiredOption("--call-id <callId>", "Call ID from the call event").requiredOption("--from <jid>", "Caller JID").action(async (rawId, options) => {
@@ -144990,9 +145083,9 @@ function createInstancesCommand() {
144990
145083
  callFrom: options.from
144991
145084
  });
144992
145085
  success(`Call rejected: ${options.callId}`);
144993
- } catch (err) {
144994
- const message = err instanceof Error ? err.message : "Unknown error";
144995
- error(`Failed to reject call: ${message}`);
145086
+ } catch (err2) {
145087
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145088
+ error(`Failed to reject call: ${message2}`);
144996
145089
  }
144997
145090
  });
144998
145091
  return instances;
@@ -145048,10 +145141,10 @@ function formatMs(ms) {
145048
145141
  return source_default.red.bold(`${ms}ms`);
145049
145142
  }
145050
145143
  async function apiFetch(path) {
145051
- const config = loadConfig();
145052
- const baseUrl = config.apiUrl ?? "http://localhost:8882";
145144
+ const config2 = loadConfig();
145145
+ const baseUrl = config2.apiUrl ?? "http://localhost:8882";
145053
145146
  return fetch(`${baseUrl}/api/v2/journeys${path}`, {
145054
- headers: { "x-api-key": config.apiKey ?? "" }
145147
+ headers: { "x-api-key": config2.apiKey ?? "" }
145055
145148
  });
145056
145149
  }
145057
145150
  function printFlowSection(title, checkpoints, baseTime, maxDelta, totalLabel, totalMs) {
@@ -145074,9 +145167,9 @@ ${source_default.dim("\u2501".repeat(50))}`);
145074
145167
  if (latencies.omniProcessing != null) {
145075
145168
  console.log(` Omni Processing: ${formatMs(latencies.omniProcessing)} ${source_default.dim("(excl. agent)")}`);
145076
145169
  }
145077
- const stageLatencies = Object.entries(latencies).filter(([k]) => !k.startsWith("total") && k !== "omniProcessing" && k !== "agentRoundTrip").filter(([, v]) => v != null && v > 0);
145170
+ const stageLatencies = Object.entries(latencies).filter(([k4]) => !k4.startsWith("total") && k4 !== "omniProcessing" && k4 !== "agentRoundTrip").filter(([, v4]) => v4 != null && v4 > 0);
145078
145171
  if (stageLatencies.length > 0) {
145079
- const [bottleneckKey, bottleneckMs] = stageLatencies.sort((a, b2) => b2[1] - a[1])[0];
145172
+ const [bottleneckKey, bottleneckMs] = stageLatencies.sort((a2, b7) => b7[1] - a2[1])[0];
145080
145173
  const omniTime = latencies.omniProcessing;
145081
145174
  const pct = omniTime ? Math.round(bottleneckMs / omniTime * 100) : 0;
145082
145175
  const label = LATENCY_LABELS[bottleneckKey] ?? bottleneckKey;
@@ -145099,30 +145192,30 @@ async function showJourney(correlationId) {
145099
145192
  data(journey);
145100
145193
  return;
145101
145194
  }
145102
- const sorted = [...journey.checkpoints].sort((a, b2) => a.timestamp - b2.timestamp);
145195
+ const sorted = [...journey.checkpoints].sort((a2, b7) => a2.timestamp - b7.timestamp);
145103
145196
  if (sorted.length === 0) {
145104
145197
  warn("Journey has no checkpoints");
145105
145198
  return;
145106
145199
  }
145107
145200
  const baseTime = sorted[0].timestamp;
145108
145201
  const deltas = [];
145109
- for (let i = 1;i < sorted.length; i++) {
145110
- deltas.push(sorted[i].timestamp - sorted[i - 1].timestamp);
145202
+ for (let i6 = 1;i6 < sorted.length; i6++) {
145203
+ deltas.push(sorted[i6].timestamp - sorted[i6 - 1].timestamp);
145111
145204
  }
145112
145205
  const maxDelta = Math.max(...deltas, 1);
145113
145206
  console.log(`
145114
145207
  ${source_default.bold(`Message Journey: ${correlationId}`)}`);
145115
145208
  console.log(source_default.dim("\u2501".repeat(50)));
145116
145209
  const inbound = sorted.filter((cp) => ["T0", "T1", "T2", "T3", "T4", "T5"].includes(cp.stage));
145117
- const agent = sorted.filter((cp) => cp.stage === "T7");
145210
+ const agent3 = sorted.filter((cp) => cp.stage === "T7");
145118
145211
  const outbound = sorted.filter((cp) => ["T8", "T9", "T10", "T11"].includes(cp.stage));
145119
145212
  printFlowSection("Inbound Flow", inbound, baseTime, maxDelta, "Total Inbound", journey.latencies.totalInbound);
145120
- printFlowSection("Agent Processing", agent, baseTime, maxDelta, `Agent Time ${source_default.dim("(T5\u2192T7, external)")}`, journey.latencies.agentRoundTrip);
145213
+ printFlowSection("Agent Processing", agent3, baseTime, maxDelta, `Agent Time ${source_default.dim("(T5\u2192T7, external)")}`, journey.latencies.agentRoundTrip);
145121
145214
  printFlowSection("Outbound Flow", outbound, baseTime, maxDelta, "Total Outbound", journey.latencies.totalOutbound);
145122
145215
  printJourneySummaryFooter(journey.latencies);
145123
- } catch (err) {
145124
- const message = err instanceof Error ? err.message : "Unknown error";
145125
- error(`Failed to fetch journey: ${message}`);
145216
+ } catch (err2) {
145217
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145218
+ error(`Failed to fetch journey: ${message2}`);
145126
145219
  }
145127
145220
  }
145128
145221
  function printCheckpoints(checkpoints, baseTime, maxDelta) {
@@ -145198,9 +145291,9 @@ ${source_default.bold("Journey Summary")}`);
145198
145291
  return;
145199
145292
  }
145200
145293
  printSummaryStageTable(summary.stages);
145201
- } catch (err) {
145202
- const message = err instanceof Error ? err.message : "Unknown error";
145203
- error(`Failed to fetch summary: ${message}`);
145294
+ } catch (err2) {
145295
+ const message2 = err2 instanceof Error ? err2.message : "Unknown error";
145296
+ error(`Failed to fetch summary: ${message2}`);
145204
145297
  }
145205
145298
  }
145206
145299
  function createJourneyCommand() {