claudemesh-cli 0.9.0 → 0.9.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.
Files changed (2) hide show
  1. package/dist/index.js +1238 -122
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -40047,6 +40047,1023 @@ function deriveHttpUrl(wssUrl) {
40047
40047
  return url.toString().replace(/\/$/, "");
40048
40048
  }
40049
40049
 
40050
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
40051
+ var require_QRMode = __commonJS((exports, module) => {
40052
+ module.exports = {
40053
+ MODE_NUMBER: 1 << 0,
40054
+ MODE_ALPHA_NUM: 1 << 1,
40055
+ MODE_8BIT_BYTE: 1 << 2,
40056
+ MODE_KANJI: 1 << 3
40057
+ };
40058
+ });
40059
+
40060
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js
40061
+ var require_QR8bitByte = __commonJS((exports, module) => {
40062
+ var QRMode = require_QRMode();
40063
+ function QR8bitByte(data) {
40064
+ this.mode = QRMode.MODE_8BIT_BYTE;
40065
+ this.data = data;
40066
+ }
40067
+ QR8bitByte.prototype = {
40068
+ getLength: function() {
40069
+ return this.data.length;
40070
+ },
40071
+ write: function(buffer) {
40072
+ for (var i = 0;i < this.data.length; i++) {
40073
+ buffer.put(this.data.charCodeAt(i), 8);
40074
+ }
40075
+ }
40076
+ };
40077
+ module.exports = QR8bitByte;
40078
+ });
40079
+
40080
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRMath.js
40081
+ var require_QRMath = __commonJS((exports, module) => {
40082
+ var QRMath = {
40083
+ glog: function(n) {
40084
+ if (n < 1) {
40085
+ throw new Error("glog(" + n + ")");
40086
+ }
40087
+ return QRMath.LOG_TABLE[n];
40088
+ },
40089
+ gexp: function(n) {
40090
+ while (n < 0) {
40091
+ n += 255;
40092
+ }
40093
+ while (n >= 256) {
40094
+ n -= 255;
40095
+ }
40096
+ return QRMath.EXP_TABLE[n];
40097
+ },
40098
+ EXP_TABLE: new Array(256),
40099
+ LOG_TABLE: new Array(256)
40100
+ };
40101
+ for (i = 0;i < 8; i++) {
40102
+ QRMath.EXP_TABLE[i] = 1 << i;
40103
+ }
40104
+ var i;
40105
+ for (i = 8;i < 256; i++) {
40106
+ QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
40107
+ }
40108
+ var i;
40109
+ for (i = 0;i < 255; i++) {
40110
+ QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
40111
+ }
40112
+ var i;
40113
+ module.exports = QRMath;
40114
+ });
40115
+
40116
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js
40117
+ var require_QRPolynomial = __commonJS((exports, module) => {
40118
+ var QRMath = require_QRMath();
40119
+ function QRPolynomial(num, shift) {
40120
+ if (num.length === undefined) {
40121
+ throw new Error(num.length + "/" + shift);
40122
+ }
40123
+ var offset = 0;
40124
+ while (offset < num.length && num[offset] === 0) {
40125
+ offset++;
40126
+ }
40127
+ this.num = new Array(num.length - offset + shift);
40128
+ for (var i = 0;i < num.length - offset; i++) {
40129
+ this.num[i] = num[i + offset];
40130
+ }
40131
+ }
40132
+ QRPolynomial.prototype = {
40133
+ get: function(index) {
40134
+ return this.num[index];
40135
+ },
40136
+ getLength: function() {
40137
+ return this.num.length;
40138
+ },
40139
+ multiply: function(e) {
40140
+ var num = new Array(this.getLength() + e.getLength() - 1);
40141
+ for (var i = 0;i < this.getLength(); i++) {
40142
+ for (var j = 0;j < e.getLength(); j++) {
40143
+ num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
40144
+ }
40145
+ }
40146
+ return new QRPolynomial(num, 0);
40147
+ },
40148
+ mod: function(e) {
40149
+ if (this.getLength() - e.getLength() < 0) {
40150
+ return this;
40151
+ }
40152
+ var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0));
40153
+ var num = new Array(this.getLength());
40154
+ for (var i = 0;i < this.getLength(); i++) {
40155
+ num[i] = this.get(i);
40156
+ }
40157
+ for (var x = 0;x < e.getLength(); x++) {
40158
+ num[x] ^= QRMath.gexp(QRMath.glog(e.get(x)) + ratio);
40159
+ }
40160
+ return new QRPolynomial(num, 0).mod(e);
40161
+ }
40162
+ };
40163
+ module.exports = QRPolynomial;
40164
+ });
40165
+
40166
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js
40167
+ var require_QRMaskPattern = __commonJS((exports, module) => {
40168
+ module.exports = {
40169
+ PATTERN000: 0,
40170
+ PATTERN001: 1,
40171
+ PATTERN010: 2,
40172
+ PATTERN011: 3,
40173
+ PATTERN100: 4,
40174
+ PATTERN101: 5,
40175
+ PATTERN110: 6,
40176
+ PATTERN111: 7
40177
+ };
40178
+ });
40179
+
40180
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js
40181
+ var require_QRUtil = __commonJS((exports, module) => {
40182
+ var QRMode = require_QRMode();
40183
+ var QRPolynomial = require_QRPolynomial();
40184
+ var QRMath = require_QRMath();
40185
+ var QRMaskPattern = require_QRMaskPattern();
40186
+ var QRUtil = {
40187
+ PATTERN_POSITION_TABLE: [
40188
+ [],
40189
+ [6, 18],
40190
+ [6, 22],
40191
+ [6, 26],
40192
+ [6, 30],
40193
+ [6, 34],
40194
+ [6, 22, 38],
40195
+ [6, 24, 42],
40196
+ [6, 26, 46],
40197
+ [6, 28, 50],
40198
+ [6, 30, 54],
40199
+ [6, 32, 58],
40200
+ [6, 34, 62],
40201
+ [6, 26, 46, 66],
40202
+ [6, 26, 48, 70],
40203
+ [6, 26, 50, 74],
40204
+ [6, 30, 54, 78],
40205
+ [6, 30, 56, 82],
40206
+ [6, 30, 58, 86],
40207
+ [6, 34, 62, 90],
40208
+ [6, 28, 50, 72, 94],
40209
+ [6, 26, 50, 74, 98],
40210
+ [6, 30, 54, 78, 102],
40211
+ [6, 28, 54, 80, 106],
40212
+ [6, 32, 58, 84, 110],
40213
+ [6, 30, 58, 86, 114],
40214
+ [6, 34, 62, 90, 118],
40215
+ [6, 26, 50, 74, 98, 122],
40216
+ [6, 30, 54, 78, 102, 126],
40217
+ [6, 26, 52, 78, 104, 130],
40218
+ [6, 30, 56, 82, 108, 134],
40219
+ [6, 34, 60, 86, 112, 138],
40220
+ [6, 30, 58, 86, 114, 142],
40221
+ [6, 34, 62, 90, 118, 146],
40222
+ [6, 30, 54, 78, 102, 126, 150],
40223
+ [6, 24, 50, 76, 102, 128, 154],
40224
+ [6, 28, 54, 80, 106, 132, 158],
40225
+ [6, 32, 58, 84, 110, 136, 162],
40226
+ [6, 26, 54, 82, 110, 138, 166],
40227
+ [6, 30, 58, 86, 114, 142, 170]
40228
+ ],
40229
+ G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
40230
+ G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
40231
+ G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
40232
+ getBCHTypeInfo: function(data) {
40233
+ var d = data << 10;
40234
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
40235
+ d ^= QRUtil.G15 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15);
40236
+ }
40237
+ return (data << 10 | d) ^ QRUtil.G15_MASK;
40238
+ },
40239
+ getBCHTypeNumber: function(data) {
40240
+ var d = data << 12;
40241
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
40242
+ d ^= QRUtil.G18 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18);
40243
+ }
40244
+ return data << 12 | d;
40245
+ },
40246
+ getBCHDigit: function(data) {
40247
+ var digit = 0;
40248
+ while (data !== 0) {
40249
+ digit++;
40250
+ data >>>= 1;
40251
+ }
40252
+ return digit;
40253
+ },
40254
+ getPatternPosition: function(typeNumber) {
40255
+ return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
40256
+ },
40257
+ getMask: function(maskPattern, i, j) {
40258
+ switch (maskPattern) {
40259
+ case QRMaskPattern.PATTERN000:
40260
+ return (i + j) % 2 === 0;
40261
+ case QRMaskPattern.PATTERN001:
40262
+ return i % 2 === 0;
40263
+ case QRMaskPattern.PATTERN010:
40264
+ return j % 3 === 0;
40265
+ case QRMaskPattern.PATTERN011:
40266
+ return (i + j) % 3 === 0;
40267
+ case QRMaskPattern.PATTERN100:
40268
+ return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
40269
+ case QRMaskPattern.PATTERN101:
40270
+ return i * j % 2 + i * j % 3 === 0;
40271
+ case QRMaskPattern.PATTERN110:
40272
+ return (i * j % 2 + i * j % 3) % 2 === 0;
40273
+ case QRMaskPattern.PATTERN111:
40274
+ return (i * j % 3 + (i + j) % 2) % 2 === 0;
40275
+ default:
40276
+ throw new Error("bad maskPattern:" + maskPattern);
40277
+ }
40278
+ },
40279
+ getErrorCorrectPolynomial: function(errorCorrectLength) {
40280
+ var a = new QRPolynomial([1], 0);
40281
+ for (var i = 0;i < errorCorrectLength; i++) {
40282
+ a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
40283
+ }
40284
+ return a;
40285
+ },
40286
+ getLengthInBits: function(mode, type) {
40287
+ if (1 <= type && type < 10) {
40288
+ switch (mode) {
40289
+ case QRMode.MODE_NUMBER:
40290
+ return 10;
40291
+ case QRMode.MODE_ALPHA_NUM:
40292
+ return 9;
40293
+ case QRMode.MODE_8BIT_BYTE:
40294
+ return 8;
40295
+ case QRMode.MODE_KANJI:
40296
+ return 8;
40297
+ default:
40298
+ throw new Error("mode:" + mode);
40299
+ }
40300
+ } else if (type < 27) {
40301
+ switch (mode) {
40302
+ case QRMode.MODE_NUMBER:
40303
+ return 12;
40304
+ case QRMode.MODE_ALPHA_NUM:
40305
+ return 11;
40306
+ case QRMode.MODE_8BIT_BYTE:
40307
+ return 16;
40308
+ case QRMode.MODE_KANJI:
40309
+ return 10;
40310
+ default:
40311
+ throw new Error("mode:" + mode);
40312
+ }
40313
+ } else if (type < 41) {
40314
+ switch (mode) {
40315
+ case QRMode.MODE_NUMBER:
40316
+ return 14;
40317
+ case QRMode.MODE_ALPHA_NUM:
40318
+ return 13;
40319
+ case QRMode.MODE_8BIT_BYTE:
40320
+ return 16;
40321
+ case QRMode.MODE_KANJI:
40322
+ return 12;
40323
+ default:
40324
+ throw new Error("mode:" + mode);
40325
+ }
40326
+ } else {
40327
+ throw new Error("type:" + type);
40328
+ }
40329
+ },
40330
+ getLostPoint: function(qrCode) {
40331
+ var moduleCount = qrCode.getModuleCount();
40332
+ var lostPoint = 0;
40333
+ var row = 0;
40334
+ var col = 0;
40335
+ for (row = 0;row < moduleCount; row++) {
40336
+ for (col = 0;col < moduleCount; col++) {
40337
+ var sameCount = 0;
40338
+ var dark = qrCode.isDark(row, col);
40339
+ for (var r = -1;r <= 1; r++) {
40340
+ if (row + r < 0 || moduleCount <= row + r) {
40341
+ continue;
40342
+ }
40343
+ for (var c = -1;c <= 1; c++) {
40344
+ if (col + c < 0 || moduleCount <= col + c) {
40345
+ continue;
40346
+ }
40347
+ if (r === 0 && c === 0) {
40348
+ continue;
40349
+ }
40350
+ if (dark === qrCode.isDark(row + r, col + c)) {
40351
+ sameCount++;
40352
+ }
40353
+ }
40354
+ }
40355
+ if (sameCount > 5) {
40356
+ lostPoint += 3 + sameCount - 5;
40357
+ }
40358
+ }
40359
+ }
40360
+ for (row = 0;row < moduleCount - 1; row++) {
40361
+ for (col = 0;col < moduleCount - 1; col++) {
40362
+ var count = 0;
40363
+ if (qrCode.isDark(row, col))
40364
+ count++;
40365
+ if (qrCode.isDark(row + 1, col))
40366
+ count++;
40367
+ if (qrCode.isDark(row, col + 1))
40368
+ count++;
40369
+ if (qrCode.isDark(row + 1, col + 1))
40370
+ count++;
40371
+ if (count === 0 || count === 4) {
40372
+ lostPoint += 3;
40373
+ }
40374
+ }
40375
+ }
40376
+ for (row = 0;row < moduleCount; row++) {
40377
+ for (col = 0;col < moduleCount - 6; col++) {
40378
+ 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)) {
40379
+ lostPoint += 40;
40380
+ }
40381
+ }
40382
+ }
40383
+ for (col = 0;col < moduleCount; col++) {
40384
+ for (row = 0;row < moduleCount - 6; row++) {
40385
+ 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)) {
40386
+ lostPoint += 40;
40387
+ }
40388
+ }
40389
+ }
40390
+ var darkCount = 0;
40391
+ for (col = 0;col < moduleCount; col++) {
40392
+ for (row = 0;row < moduleCount; row++) {
40393
+ if (qrCode.isDark(row, col)) {
40394
+ darkCount++;
40395
+ }
40396
+ }
40397
+ }
40398
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
40399
+ lostPoint += ratio * 10;
40400
+ return lostPoint;
40401
+ }
40402
+ };
40403
+ module.exports = QRUtil;
40404
+ });
40405
+
40406
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js
40407
+ var require_QRErrorCorrectLevel = __commonJS((exports, module) => {
40408
+ module.exports = {
40409
+ L: 1,
40410
+ M: 0,
40411
+ Q: 3,
40412
+ H: 2
40413
+ };
40414
+ });
40415
+
40416
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js
40417
+ var require_QRRSBlock = __commonJS((exports, module) => {
40418
+ var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
40419
+ function QRRSBlock(totalCount, dataCount) {
40420
+ this.totalCount = totalCount;
40421
+ this.dataCount = dataCount;
40422
+ }
40423
+ QRRSBlock.RS_BLOCK_TABLE = [
40424
+ [1, 26, 19],
40425
+ [1, 26, 16],
40426
+ [1, 26, 13],
40427
+ [1, 26, 9],
40428
+ [1, 44, 34],
40429
+ [1, 44, 28],
40430
+ [1, 44, 22],
40431
+ [1, 44, 16],
40432
+ [1, 70, 55],
40433
+ [1, 70, 44],
40434
+ [2, 35, 17],
40435
+ [2, 35, 13],
40436
+ [1, 100, 80],
40437
+ [2, 50, 32],
40438
+ [2, 50, 24],
40439
+ [4, 25, 9],
40440
+ [1, 134, 108],
40441
+ [2, 67, 43],
40442
+ [2, 33, 15, 2, 34, 16],
40443
+ [2, 33, 11, 2, 34, 12],
40444
+ [2, 86, 68],
40445
+ [4, 43, 27],
40446
+ [4, 43, 19],
40447
+ [4, 43, 15],
40448
+ [2, 98, 78],
40449
+ [4, 49, 31],
40450
+ [2, 32, 14, 4, 33, 15],
40451
+ [4, 39, 13, 1, 40, 14],
40452
+ [2, 121, 97],
40453
+ [2, 60, 38, 2, 61, 39],
40454
+ [4, 40, 18, 2, 41, 19],
40455
+ [4, 40, 14, 2, 41, 15],
40456
+ [2, 146, 116],
40457
+ [3, 58, 36, 2, 59, 37],
40458
+ [4, 36, 16, 4, 37, 17],
40459
+ [4, 36, 12, 4, 37, 13],
40460
+ [2, 86, 68, 2, 87, 69],
40461
+ [4, 69, 43, 1, 70, 44],
40462
+ [6, 43, 19, 2, 44, 20],
40463
+ [6, 43, 15, 2, 44, 16],
40464
+ [4, 101, 81],
40465
+ [1, 80, 50, 4, 81, 51],
40466
+ [4, 50, 22, 4, 51, 23],
40467
+ [3, 36, 12, 8, 37, 13],
40468
+ [2, 116, 92, 2, 117, 93],
40469
+ [6, 58, 36, 2, 59, 37],
40470
+ [4, 46, 20, 6, 47, 21],
40471
+ [7, 42, 14, 4, 43, 15],
40472
+ [4, 133, 107],
40473
+ [8, 59, 37, 1, 60, 38],
40474
+ [8, 44, 20, 4, 45, 21],
40475
+ [12, 33, 11, 4, 34, 12],
40476
+ [3, 145, 115, 1, 146, 116],
40477
+ [4, 64, 40, 5, 65, 41],
40478
+ [11, 36, 16, 5, 37, 17],
40479
+ [11, 36, 12, 5, 37, 13],
40480
+ [5, 109, 87, 1, 110, 88],
40481
+ [5, 65, 41, 5, 66, 42],
40482
+ [5, 54, 24, 7, 55, 25],
40483
+ [11, 36, 12],
40484
+ [5, 122, 98, 1, 123, 99],
40485
+ [7, 73, 45, 3, 74, 46],
40486
+ [15, 43, 19, 2, 44, 20],
40487
+ [3, 45, 15, 13, 46, 16],
40488
+ [1, 135, 107, 5, 136, 108],
40489
+ [10, 74, 46, 1, 75, 47],
40490
+ [1, 50, 22, 15, 51, 23],
40491
+ [2, 42, 14, 17, 43, 15],
40492
+ [5, 150, 120, 1, 151, 121],
40493
+ [9, 69, 43, 4, 70, 44],
40494
+ [17, 50, 22, 1, 51, 23],
40495
+ [2, 42, 14, 19, 43, 15],
40496
+ [3, 141, 113, 4, 142, 114],
40497
+ [3, 70, 44, 11, 71, 45],
40498
+ [17, 47, 21, 4, 48, 22],
40499
+ [9, 39, 13, 16, 40, 14],
40500
+ [3, 135, 107, 5, 136, 108],
40501
+ [3, 67, 41, 13, 68, 42],
40502
+ [15, 54, 24, 5, 55, 25],
40503
+ [15, 43, 15, 10, 44, 16],
40504
+ [4, 144, 116, 4, 145, 117],
40505
+ [17, 68, 42],
40506
+ [17, 50, 22, 6, 51, 23],
40507
+ [19, 46, 16, 6, 47, 17],
40508
+ [2, 139, 111, 7, 140, 112],
40509
+ [17, 74, 46],
40510
+ [7, 54, 24, 16, 55, 25],
40511
+ [34, 37, 13],
40512
+ [4, 151, 121, 5, 152, 122],
40513
+ [4, 75, 47, 14, 76, 48],
40514
+ [11, 54, 24, 14, 55, 25],
40515
+ [16, 45, 15, 14, 46, 16],
40516
+ [6, 147, 117, 4, 148, 118],
40517
+ [6, 73, 45, 14, 74, 46],
40518
+ [11, 54, 24, 16, 55, 25],
40519
+ [30, 46, 16, 2, 47, 17],
40520
+ [8, 132, 106, 4, 133, 107],
40521
+ [8, 75, 47, 13, 76, 48],
40522
+ [7, 54, 24, 22, 55, 25],
40523
+ [22, 45, 15, 13, 46, 16],
40524
+ [10, 142, 114, 2, 143, 115],
40525
+ [19, 74, 46, 4, 75, 47],
40526
+ [28, 50, 22, 6, 51, 23],
40527
+ [33, 46, 16, 4, 47, 17],
40528
+ [8, 152, 122, 4, 153, 123],
40529
+ [22, 73, 45, 3, 74, 46],
40530
+ [8, 53, 23, 26, 54, 24],
40531
+ [12, 45, 15, 28, 46, 16],
40532
+ [3, 147, 117, 10, 148, 118],
40533
+ [3, 73, 45, 23, 74, 46],
40534
+ [4, 54, 24, 31, 55, 25],
40535
+ [11, 45, 15, 31, 46, 16],
40536
+ [7, 146, 116, 7, 147, 117],
40537
+ [21, 73, 45, 7, 74, 46],
40538
+ [1, 53, 23, 37, 54, 24],
40539
+ [19, 45, 15, 26, 46, 16],
40540
+ [5, 145, 115, 10, 146, 116],
40541
+ [19, 75, 47, 10, 76, 48],
40542
+ [15, 54, 24, 25, 55, 25],
40543
+ [23, 45, 15, 25, 46, 16],
40544
+ [13, 145, 115, 3, 146, 116],
40545
+ [2, 74, 46, 29, 75, 47],
40546
+ [42, 54, 24, 1, 55, 25],
40547
+ [23, 45, 15, 28, 46, 16],
40548
+ [17, 145, 115],
40549
+ [10, 74, 46, 23, 75, 47],
40550
+ [10, 54, 24, 35, 55, 25],
40551
+ [19, 45, 15, 35, 46, 16],
40552
+ [17, 145, 115, 1, 146, 116],
40553
+ [14, 74, 46, 21, 75, 47],
40554
+ [29, 54, 24, 19, 55, 25],
40555
+ [11, 45, 15, 46, 46, 16],
40556
+ [13, 145, 115, 6, 146, 116],
40557
+ [14, 74, 46, 23, 75, 47],
40558
+ [44, 54, 24, 7, 55, 25],
40559
+ [59, 46, 16, 1, 47, 17],
40560
+ [12, 151, 121, 7, 152, 122],
40561
+ [12, 75, 47, 26, 76, 48],
40562
+ [39, 54, 24, 14, 55, 25],
40563
+ [22, 45, 15, 41, 46, 16],
40564
+ [6, 151, 121, 14, 152, 122],
40565
+ [6, 75, 47, 34, 76, 48],
40566
+ [46, 54, 24, 10, 55, 25],
40567
+ [2, 45, 15, 64, 46, 16],
40568
+ [17, 152, 122, 4, 153, 123],
40569
+ [29, 74, 46, 14, 75, 47],
40570
+ [49, 54, 24, 10, 55, 25],
40571
+ [24, 45, 15, 46, 46, 16],
40572
+ [4, 152, 122, 18, 153, 123],
40573
+ [13, 74, 46, 32, 75, 47],
40574
+ [48, 54, 24, 14, 55, 25],
40575
+ [42, 45, 15, 32, 46, 16],
40576
+ [20, 147, 117, 4, 148, 118],
40577
+ [40, 75, 47, 7, 76, 48],
40578
+ [43, 54, 24, 22, 55, 25],
40579
+ [10, 45, 15, 67, 46, 16],
40580
+ [19, 148, 118, 6, 149, 119],
40581
+ [18, 75, 47, 31, 76, 48],
40582
+ [34, 54, 24, 34, 55, 25],
40583
+ [20, 45, 15, 61, 46, 16]
40584
+ ];
40585
+ QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
40586
+ var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
40587
+ if (rsBlock === undefined) {
40588
+ throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
40589
+ }
40590
+ var length = rsBlock.length / 3;
40591
+ var list = [];
40592
+ for (var i = 0;i < length; i++) {
40593
+ var count = rsBlock[i * 3 + 0];
40594
+ var totalCount = rsBlock[i * 3 + 1];
40595
+ var dataCount = rsBlock[i * 3 + 2];
40596
+ for (var j = 0;j < count; j++) {
40597
+ list.push(new QRRSBlock(totalCount, dataCount));
40598
+ }
40599
+ }
40600
+ return list;
40601
+ };
40602
+ QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
40603
+ switch (errorCorrectLevel) {
40604
+ case QRErrorCorrectLevel.L:
40605
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
40606
+ case QRErrorCorrectLevel.M:
40607
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
40608
+ case QRErrorCorrectLevel.Q:
40609
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
40610
+ case QRErrorCorrectLevel.H:
40611
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
40612
+ default:
40613
+ return;
40614
+ }
40615
+ };
40616
+ module.exports = QRRSBlock;
40617
+ });
40618
+
40619
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js
40620
+ var require_QRBitBuffer = __commonJS((exports, module) => {
40621
+ function QRBitBuffer() {
40622
+ this.buffer = [];
40623
+ this.length = 0;
40624
+ }
40625
+ QRBitBuffer.prototype = {
40626
+ get: function(index) {
40627
+ var bufIndex = Math.floor(index / 8);
40628
+ return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
40629
+ },
40630
+ put: function(num, length) {
40631
+ for (var i = 0;i < length; i++) {
40632
+ this.putBit((num >>> length - i - 1 & 1) == 1);
40633
+ }
40634
+ },
40635
+ getLengthInBits: function() {
40636
+ return this.length;
40637
+ },
40638
+ putBit: function(bit) {
40639
+ var bufIndex = Math.floor(this.length / 8);
40640
+ if (this.buffer.length <= bufIndex) {
40641
+ this.buffer.push(0);
40642
+ }
40643
+ if (bit) {
40644
+ this.buffer[bufIndex] |= 128 >>> this.length % 8;
40645
+ }
40646
+ this.length++;
40647
+ }
40648
+ };
40649
+ module.exports = QRBitBuffer;
40650
+ });
40651
+
40652
+ // ../../node_modules/qrcode-terminal/vendor/QRCode/index.js
40653
+ var require_QRCode = __commonJS((exports, module) => {
40654
+ var QR8bitByte = require_QR8bitByte();
40655
+ var QRUtil = require_QRUtil();
40656
+ var QRPolynomial = require_QRPolynomial();
40657
+ var QRRSBlock = require_QRRSBlock();
40658
+ var QRBitBuffer = require_QRBitBuffer();
40659
+ function QRCode(typeNumber, errorCorrectLevel) {
40660
+ this.typeNumber = typeNumber;
40661
+ this.errorCorrectLevel = errorCorrectLevel;
40662
+ this.modules = null;
40663
+ this.moduleCount = 0;
40664
+ this.dataCache = null;
40665
+ this.dataList = [];
40666
+ }
40667
+ QRCode.prototype = {
40668
+ addData: function(data) {
40669
+ var newData = new QR8bitByte(data);
40670
+ this.dataList.push(newData);
40671
+ this.dataCache = null;
40672
+ },
40673
+ isDark: function(row, col) {
40674
+ if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
40675
+ throw new Error(row + "," + col);
40676
+ }
40677
+ return this.modules[row][col];
40678
+ },
40679
+ getModuleCount: function() {
40680
+ return this.moduleCount;
40681
+ },
40682
+ make: function() {
40683
+ if (this.typeNumber < 1) {
40684
+ var typeNumber = 1;
40685
+ for (typeNumber = 1;typeNumber < 40; typeNumber++) {
40686
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
40687
+ var buffer = new QRBitBuffer;
40688
+ var totalDataCount = 0;
40689
+ for (var i = 0;i < rsBlocks.length; i++) {
40690
+ totalDataCount += rsBlocks[i].dataCount;
40691
+ }
40692
+ for (var x = 0;x < this.dataList.length; x++) {
40693
+ var data = this.dataList[x];
40694
+ buffer.put(data.mode, 4);
40695
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
40696
+ data.write(buffer);
40697
+ }
40698
+ if (buffer.getLengthInBits() <= totalDataCount * 8)
40699
+ break;
40700
+ }
40701
+ this.typeNumber = typeNumber;
40702
+ }
40703
+ this.makeImpl(false, this.getBestMaskPattern());
40704
+ },
40705
+ makeImpl: function(test, maskPattern) {
40706
+ this.moduleCount = this.typeNumber * 4 + 17;
40707
+ this.modules = new Array(this.moduleCount);
40708
+ for (var row = 0;row < this.moduleCount; row++) {
40709
+ this.modules[row] = new Array(this.moduleCount);
40710
+ for (var col = 0;col < this.moduleCount; col++) {
40711
+ this.modules[row][col] = null;
40712
+ }
40713
+ }
40714
+ this.setupPositionProbePattern(0, 0);
40715
+ this.setupPositionProbePattern(this.moduleCount - 7, 0);
40716
+ this.setupPositionProbePattern(0, this.moduleCount - 7);
40717
+ this.setupPositionAdjustPattern();
40718
+ this.setupTimingPattern();
40719
+ this.setupTypeInfo(test, maskPattern);
40720
+ if (this.typeNumber >= 7) {
40721
+ this.setupTypeNumber(test);
40722
+ }
40723
+ if (this.dataCache === null) {
40724
+ this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
40725
+ }
40726
+ this.mapData(this.dataCache, maskPattern);
40727
+ },
40728
+ setupPositionProbePattern: function(row, col) {
40729
+ for (var r = -1;r <= 7; r++) {
40730
+ if (row + r <= -1 || this.moduleCount <= row + r)
40731
+ continue;
40732
+ for (var c = -1;c <= 7; c++) {
40733
+ if (col + c <= -1 || this.moduleCount <= col + c)
40734
+ continue;
40735
+ if (0 <= r && r <= 6 && (c === 0 || c === 6) || 0 <= c && c <= 6 && (r === 0 || r === 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
40736
+ this.modules[row + r][col + c] = true;
40737
+ } else {
40738
+ this.modules[row + r][col + c] = false;
40739
+ }
40740
+ }
40741
+ }
40742
+ },
40743
+ getBestMaskPattern: function() {
40744
+ var minLostPoint = 0;
40745
+ var pattern = 0;
40746
+ for (var i = 0;i < 8; i++) {
40747
+ this.makeImpl(true, i);
40748
+ var lostPoint = QRUtil.getLostPoint(this);
40749
+ if (i === 0 || minLostPoint > lostPoint) {
40750
+ minLostPoint = lostPoint;
40751
+ pattern = i;
40752
+ }
40753
+ }
40754
+ return pattern;
40755
+ },
40756
+ createMovieClip: function(target_mc, instance_name, depth) {
40757
+ var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
40758
+ var cs = 1;
40759
+ this.make();
40760
+ for (var row = 0;row < this.modules.length; row++) {
40761
+ var y = row * cs;
40762
+ for (var col = 0;col < this.modules[row].length; col++) {
40763
+ var x = col * cs;
40764
+ var dark = this.modules[row][col];
40765
+ if (dark) {
40766
+ qr_mc.beginFill(0, 100);
40767
+ qr_mc.moveTo(x, y);
40768
+ qr_mc.lineTo(x + cs, y);
40769
+ qr_mc.lineTo(x + cs, y + cs);
40770
+ qr_mc.lineTo(x, y + cs);
40771
+ qr_mc.endFill();
40772
+ }
40773
+ }
40774
+ }
40775
+ return qr_mc;
40776
+ },
40777
+ setupTimingPattern: function() {
40778
+ for (var r = 8;r < this.moduleCount - 8; r++) {
40779
+ if (this.modules[r][6] !== null) {
40780
+ continue;
40781
+ }
40782
+ this.modules[r][6] = r % 2 === 0;
40783
+ }
40784
+ for (var c = 8;c < this.moduleCount - 8; c++) {
40785
+ if (this.modules[6][c] !== null) {
40786
+ continue;
40787
+ }
40788
+ this.modules[6][c] = c % 2 === 0;
40789
+ }
40790
+ },
40791
+ setupPositionAdjustPattern: function() {
40792
+ var pos = QRUtil.getPatternPosition(this.typeNumber);
40793
+ for (var i = 0;i < pos.length; i++) {
40794
+ for (var j = 0;j < pos.length; j++) {
40795
+ var row = pos[i];
40796
+ var col = pos[j];
40797
+ if (this.modules[row][col] !== null) {
40798
+ continue;
40799
+ }
40800
+ for (var r = -2;r <= 2; r++) {
40801
+ for (var c = -2;c <= 2; c++) {
40802
+ if (Math.abs(r) === 2 || Math.abs(c) === 2 || r === 0 && c === 0) {
40803
+ this.modules[row + r][col + c] = true;
40804
+ } else {
40805
+ this.modules[row + r][col + c] = false;
40806
+ }
40807
+ }
40808
+ }
40809
+ }
40810
+ }
40811
+ },
40812
+ setupTypeNumber: function(test) {
40813
+ var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
40814
+ var mod;
40815
+ for (var i = 0;i < 18; i++) {
40816
+ mod = !test && (bits >> i & 1) === 1;
40817
+ this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
40818
+ }
40819
+ for (var x = 0;x < 18; x++) {
40820
+ mod = !test && (bits >> x & 1) === 1;
40821
+ this.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod;
40822
+ }
40823
+ },
40824
+ setupTypeInfo: function(test, maskPattern) {
40825
+ var data = this.errorCorrectLevel << 3 | maskPattern;
40826
+ var bits = QRUtil.getBCHTypeInfo(data);
40827
+ var mod;
40828
+ for (var v = 0;v < 15; v++) {
40829
+ mod = !test && (bits >> v & 1) === 1;
40830
+ if (v < 6) {
40831
+ this.modules[v][8] = mod;
40832
+ } else if (v < 8) {
40833
+ this.modules[v + 1][8] = mod;
40834
+ } else {
40835
+ this.modules[this.moduleCount - 15 + v][8] = mod;
40836
+ }
40837
+ }
40838
+ for (var h = 0;h < 15; h++) {
40839
+ mod = !test && (bits >> h & 1) === 1;
40840
+ if (h < 8) {
40841
+ this.modules[8][this.moduleCount - h - 1] = mod;
40842
+ } else if (h < 9) {
40843
+ this.modules[8][15 - h - 1 + 1] = mod;
40844
+ } else {
40845
+ this.modules[8][15 - h - 1] = mod;
40846
+ }
40847
+ }
40848
+ this.modules[this.moduleCount - 8][8] = !test;
40849
+ },
40850
+ mapData: function(data, maskPattern) {
40851
+ var inc = -1;
40852
+ var row = this.moduleCount - 1;
40853
+ var bitIndex = 7;
40854
+ var byteIndex = 0;
40855
+ for (var col = this.moduleCount - 1;col > 0; col -= 2) {
40856
+ if (col === 6)
40857
+ col--;
40858
+ while (true) {
40859
+ for (var c = 0;c < 2; c++) {
40860
+ if (this.modules[row][col - c] === null) {
40861
+ var dark = false;
40862
+ if (byteIndex < data.length) {
40863
+ dark = (data[byteIndex] >>> bitIndex & 1) === 1;
40864
+ }
40865
+ var mask = QRUtil.getMask(maskPattern, row, col - c);
40866
+ if (mask) {
40867
+ dark = !dark;
40868
+ }
40869
+ this.modules[row][col - c] = dark;
40870
+ bitIndex--;
40871
+ if (bitIndex === -1) {
40872
+ byteIndex++;
40873
+ bitIndex = 7;
40874
+ }
40875
+ }
40876
+ }
40877
+ row += inc;
40878
+ if (row < 0 || this.moduleCount <= row) {
40879
+ row -= inc;
40880
+ inc = -inc;
40881
+ break;
40882
+ }
40883
+ }
40884
+ }
40885
+ }
40886
+ };
40887
+ QRCode.PAD0 = 236;
40888
+ QRCode.PAD1 = 17;
40889
+ QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
40890
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
40891
+ var buffer = new QRBitBuffer;
40892
+ for (var i = 0;i < dataList.length; i++) {
40893
+ var data = dataList[i];
40894
+ buffer.put(data.mode, 4);
40895
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
40896
+ data.write(buffer);
40897
+ }
40898
+ var totalDataCount = 0;
40899
+ for (var x = 0;x < rsBlocks.length; x++) {
40900
+ totalDataCount += rsBlocks[x].dataCount;
40901
+ }
40902
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
40903
+ throw new Error("code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")");
40904
+ }
40905
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
40906
+ buffer.put(0, 4);
40907
+ }
40908
+ while (buffer.getLengthInBits() % 8 !== 0) {
40909
+ buffer.putBit(false);
40910
+ }
40911
+ while (true) {
40912
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
40913
+ break;
40914
+ }
40915
+ buffer.put(QRCode.PAD0, 8);
40916
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
40917
+ break;
40918
+ }
40919
+ buffer.put(QRCode.PAD1, 8);
40920
+ }
40921
+ return QRCode.createBytes(buffer, rsBlocks);
40922
+ };
40923
+ QRCode.createBytes = function(buffer, rsBlocks) {
40924
+ var offset = 0;
40925
+ var maxDcCount = 0;
40926
+ var maxEcCount = 0;
40927
+ var dcdata = new Array(rsBlocks.length);
40928
+ var ecdata = new Array(rsBlocks.length);
40929
+ for (var r = 0;r < rsBlocks.length; r++) {
40930
+ var dcCount = rsBlocks[r].dataCount;
40931
+ var ecCount = rsBlocks[r].totalCount - dcCount;
40932
+ maxDcCount = Math.max(maxDcCount, dcCount);
40933
+ maxEcCount = Math.max(maxEcCount, ecCount);
40934
+ dcdata[r] = new Array(dcCount);
40935
+ for (var i = 0;i < dcdata[r].length; i++) {
40936
+ dcdata[r][i] = 255 & buffer.buffer[i + offset];
40937
+ }
40938
+ offset += dcCount;
40939
+ var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
40940
+ var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
40941
+ var modPoly = rawPoly.mod(rsPoly);
40942
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
40943
+ for (var x = 0;x < ecdata[r].length; x++) {
40944
+ var modIndex = x + modPoly.getLength() - ecdata[r].length;
40945
+ ecdata[r][x] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
40946
+ }
40947
+ }
40948
+ var totalCodeCount = 0;
40949
+ for (var y = 0;y < rsBlocks.length; y++) {
40950
+ totalCodeCount += rsBlocks[y].totalCount;
40951
+ }
40952
+ var data = new Array(totalCodeCount);
40953
+ var index = 0;
40954
+ for (var z = 0;z < maxDcCount; z++) {
40955
+ for (var s = 0;s < rsBlocks.length; s++) {
40956
+ if (z < dcdata[s].length) {
40957
+ data[index++] = dcdata[s][z];
40958
+ }
40959
+ }
40960
+ }
40961
+ for (var xx = 0;xx < maxEcCount; xx++) {
40962
+ for (var t = 0;t < rsBlocks.length; t++) {
40963
+ if (xx < ecdata[t].length) {
40964
+ data[index++] = ecdata[t][xx];
40965
+ }
40966
+ }
40967
+ }
40968
+ return data;
40969
+ };
40970
+ module.exports = QRCode;
40971
+ });
40972
+
40973
+ // ../../node_modules/qrcode-terminal/lib/main.js
40974
+ var require_main = __commonJS((exports, module) => {
40975
+ var QRCode = require_QRCode();
40976
+ var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
40977
+ var black = "\x1B[40m \x1B[0m";
40978
+ var white = "\x1B[47m \x1B[0m";
40979
+ var toCell = function(isBlack) {
40980
+ return isBlack ? black : white;
40981
+ };
40982
+ var repeat = function(color) {
40983
+ return {
40984
+ times: function(count) {
40985
+ return new Array(count).join(color);
40986
+ }
40987
+ };
40988
+ };
40989
+ var fill = function(length, value) {
40990
+ var arr = new Array(length);
40991
+ for (var i = 0;i < length; i++) {
40992
+ arr[i] = value;
40993
+ }
40994
+ return arr;
40995
+ };
40996
+ module.exports = {
40997
+ error: QRErrorCorrectLevel.L,
40998
+ generate: function(input, opts, cb) {
40999
+ if (typeof opts === "function") {
41000
+ cb = opts;
41001
+ opts = {};
41002
+ }
41003
+ var qrcode = new QRCode(-1, this.error);
41004
+ qrcode.addData(input);
41005
+ qrcode.make();
41006
+ var output = "";
41007
+ if (opts && opts.small) {
41008
+ var BLACK = true, WHITE = false;
41009
+ var moduleCount = qrcode.getModuleCount();
41010
+ var moduleData = qrcode.modules.slice();
41011
+ var oddRow = moduleCount % 2 === 1;
41012
+ if (oddRow) {
41013
+ moduleData.push(fill(moduleCount, WHITE));
41014
+ }
41015
+ var platte = {
41016
+ WHITE_ALL: "█",
41017
+ WHITE_BLACK: "▀",
41018
+ BLACK_WHITE: "▄",
41019
+ BLACK_ALL: " "
41020
+ };
41021
+ var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3);
41022
+ var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3);
41023
+ output += borderTop + `
41024
+ `;
41025
+ for (var row = 0;row < moduleCount; row += 2) {
41026
+ output += platte.WHITE_ALL;
41027
+ for (var col = 0;col < moduleCount; col++) {
41028
+ if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {
41029
+ output += platte.WHITE_ALL;
41030
+ } else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {
41031
+ output += platte.WHITE_BLACK;
41032
+ } else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {
41033
+ output += platte.BLACK_WHITE;
41034
+ } else {
41035
+ output += platte.BLACK_ALL;
41036
+ }
41037
+ }
41038
+ output += platte.WHITE_ALL + `
41039
+ `;
41040
+ }
41041
+ if (!oddRow) {
41042
+ output += borderBottom;
41043
+ }
41044
+ } else {
41045
+ var border = repeat(white).times(qrcode.getModuleCount() + 3);
41046
+ output += border + `
41047
+ `;
41048
+ qrcode.modules.forEach(function(row2) {
41049
+ output += white;
41050
+ output += row2.map(toCell).join("");
41051
+ output += white + `
41052
+ `;
41053
+ });
41054
+ output += border;
41055
+ }
41056
+ if (cb)
41057
+ cb(output);
41058
+ else
41059
+ console.log(output);
41060
+ },
41061
+ setErrorLevel: function(error2) {
41062
+ this.error = QRErrorCorrectLevel[error2] || this.error;
41063
+ }
41064
+ };
41065
+ });
41066
+
40050
41067
  // ../../node_modules/citty/dist/_chunks/libs/scule.mjs
40051
41068
  var NUMBER_CHAR_RE = /\d/;
40052
41069
  var STR_SPLITTERS = [
@@ -50121,6 +51138,15 @@ ${manifest.allowed_tools.map((t) => ` - ${t}`).join(`
50121
51138
  if (fm.length > 3)
50122
51139
  content = fm.join(`
50123
51140
  `) + content;
51141
+ if (manifest.context === "fork") {
51142
+ const agentType = manifest.agent || "general-purpose";
51143
+ const modelHint = manifest.model ? `, model: "${manifest.model}"` : "";
51144
+ const toolsHint = manifest.allowed_tools?.length ? `
51145
+ Only use these tools: ${manifest.allowed_tools.join(", ")}.` : "";
51146
+ content = `IMPORTANT: Execute this skill in an isolated sub-agent. Use the Agent tool with subagent_type="${agentType}"${modelHint}. Pass the full instructions below as the agent prompt.${toolsHint}
51147
+
51148
+ ` + content;
51149
+ }
50124
51150
  }
50125
51151
  return {
50126
51152
  description: skill.description,
@@ -50606,7 +51632,11 @@ ${lines.join(`
50606
51632
  writeFileSync3(save_to, plaintext);
50607
51633
  return text(`Downloaded and decrypted: ${result.name} → ${save_to}`);
50608
51634
  }
50609
- const res = await fetch(result.url, { signal: AbortSignal.timeout(30000) });
51635
+ let res = await fetch(result.url, { signal: AbortSignal.timeout(1e4) }).catch(() => null);
51636
+ if (!res || !res.ok) {
51637
+ const brokerHttp = client2.mesh.brokerUrl.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
51638
+ res = await fetch(`${brokerHttp}/download/${id}?mesh=${client2.meshId}`, { signal: AbortSignal.timeout(30000) });
51639
+ }
50610
51640
  if (!res.ok)
50611
51641
  return text(`get_file: download failed (${res.status})`, true);
50612
51642
  const { writeFileSync: writeFileSync2, mkdirSync: mkdirSync2 } = await import("node:fs");
@@ -51622,159 +52652,165 @@ ${lines.join(`
51622
52652
  return text(`Unknown tool: ${name}`, true);
51623
52653
  }
51624
52654
  });
51625
- await startClients(config2);
51626
52655
  const transport = new StdioServerTransport;
51627
52656
  await server.connect(transport);
51628
- for (const client2 of allClients()) {
51629
- client2.onPush(async (msg) => {
51630
- if (messageMode === "off")
51631
- return;
51632
- if (msg.subtype === "system" && msg.event) {
51633
- const eventName = msg.event;
51634
- const data = msg.eventData ?? {};
51635
- let content2;
51636
- if (eventName === "tick") {
51637
- const tick = data.tick ?? 0;
51638
- const simTime = String(data.simTime ?? "").replace("T", " ").replace(/\..*/, "");
51639
- const speed = data.speed ?? 1;
51640
- content2 = `[heartbeat] tick ${tick} | sim time: ${simTime} | speed: x${speed}`;
51641
- } else if (eventName === "peer_joined") {
51642
- content2 = `[system] Peer "${data.name ?? "unknown"}" joined the mesh`;
51643
- } else if (eventName === "peer_returned") {
51644
- const peerName = String(data.name ?? "unknown");
51645
- const lastSeenAt = data.lastSeenAt ? relativeTime(String(data.lastSeenAt)) : "unknown";
51646
- const groups = Array.isArray(data.groups) ? data.groups.map((g) => g.role ? `@${g.name}:${g.role}` : `@${g.name}`).join(", ") : "";
51647
- const summary = data.summary ? ` Summary: "${data.summary}"` : "";
51648
- content2 = `[system] Welcome back, "${peerName}"! Last seen ${lastSeenAt}.${groups ? ` Restored: ${groups}` : ""}${summary}`;
51649
- } else if (eventName === "peer_left") {
51650
- content2 = `[system] Peer "${data.name ?? "unknown"}" left the mesh`;
51651
- } else if (eventName === "mcp_registered") {
51652
- const tools = Array.isArray(data.tools) ? data.tools.join(", ") : "";
51653
- content2 = `[system] New MCP server available: "${data.serverName}" (hosted by ${data.hostedBy}). Tools: ${tools}. Use mesh_tool_call to invoke.`;
51654
- } else if (eventName === "mcp_unregistered") {
51655
- content2 = `[system] MCP server "${data.serverName}" removed (was hosted by ${data.hostedBy})`;
51656
- } else if (eventName === "mcp_restored") {
51657
- content2 = `[system] MCP server "${data.serverName}" is back online (hosted by ${data.hostedBy})`;
51658
- } else if (eventName === "watch_triggered") {
51659
- content2 = `[WATCH] ${data.label ?? data.url}: ${data.oldValue} ${data.newValue}`;
51660
- } else if (eventName === "mcp_deployed") {
51661
- content2 = `[SERVICE] "${data.name}" deployed (${data.tool_count} tools) by ${data.deployed_by}`;
51662
- } else if (eventName === "mcp_undeployed") {
51663
- content2 = `[SERVICE] "${data.name}" undeployed by ${data.by}`;
51664
- } else if (eventName === "mcp_scope_changed") {
51665
- content2 = `[SERVICE] "${data.name}" scope changed to ${JSON.stringify(data.scope)} by ${data.by}`;
51666
- } else {
51667
- content2 = `[system] ${eventName}: ${JSON.stringify(data)}`;
52657
+ startClients(config2).then(() => {
52658
+ wirePushHandlers().catch(() => {});
52659
+ }).catch(() => {
52660
+ wirePushHandlers().catch(() => {});
52661
+ });
52662
+ async function wirePushHandlers() {
52663
+ for (const client2 of allClients()) {
52664
+ client2.onPush(async (msg) => {
52665
+ if (messageMode === "off")
52666
+ return;
52667
+ if (msg.subtype === "system" && msg.event) {
52668
+ const eventName = msg.event;
52669
+ const data = msg.eventData ?? {};
52670
+ let content2;
52671
+ if (eventName === "tick") {
52672
+ const tick = data.tick ?? 0;
52673
+ const simTime = String(data.simTime ?? "").replace("T", " ").replace(/\..*/, "");
52674
+ const speed = data.speed ?? 1;
52675
+ content2 = `[heartbeat] tick ${tick} | sim time: ${simTime} | speed: x${speed}`;
52676
+ } else if (eventName === "peer_joined") {
52677
+ content2 = `[system] Peer "${data.name ?? "unknown"}" joined the mesh`;
52678
+ } else if (eventName === "peer_returned") {
52679
+ const peerName = String(data.name ?? "unknown");
52680
+ const lastSeenAt = data.lastSeenAt ? relativeTime(String(data.lastSeenAt)) : "unknown";
52681
+ const groups = Array.isArray(data.groups) ? data.groups.map((g) => g.role ? `@${g.name}:${g.role}` : `@${g.name}`).join(", ") : "";
52682
+ const summary = data.summary ? ` Summary: "${data.summary}"` : "";
52683
+ content2 = `[system] Welcome back, "${peerName}"! Last seen ${lastSeenAt}.${groups ? ` Restored: ${groups}` : ""}${summary}`;
52684
+ } else if (eventName === "peer_left") {
52685
+ content2 = `[system] Peer "${data.name ?? "unknown"}" left the mesh`;
52686
+ } else if (eventName === "mcp_registered") {
52687
+ const tools = Array.isArray(data.tools) ? data.tools.join(", ") : "";
52688
+ content2 = `[system] New MCP server available: "${data.serverName}" (hosted by ${data.hostedBy}). Tools: ${tools}. Use mesh_tool_call to invoke.`;
52689
+ } else if (eventName === "mcp_unregistered") {
52690
+ content2 = `[system] MCP server "${data.serverName}" removed (was hosted by ${data.hostedBy})`;
52691
+ } else if (eventName === "mcp_restored") {
52692
+ content2 = `[system] MCP server "${data.serverName}" is back online (hosted by ${data.hostedBy})`;
52693
+ } else if (eventName === "watch_triggered") {
52694
+ content2 = `[WATCH] ${data.label ?? data.url}: ${data.oldValue} ${data.newValue}`;
52695
+ } else if (eventName === "mcp_deployed") {
52696
+ content2 = `[SERVICE] "${data.name}" deployed (${data.tool_count} tools) by ${data.deployed_by}`;
52697
+ } else if (eventName === "mcp_undeployed") {
52698
+ content2 = `[SERVICE] "${data.name}" undeployed by ${data.by}`;
52699
+ } else if (eventName === "mcp_scope_changed") {
52700
+ content2 = `[SERVICE] "${data.name}" scope changed to ${JSON.stringify(data.scope)} by ${data.by}`;
52701
+ } else {
52702
+ content2 = `[system] ${eventName}: ${JSON.stringify(data)}`;
52703
+ }
52704
+ try {
52705
+ await server.notification({
52706
+ method: "notifications/claude/channel",
52707
+ params: {
52708
+ content: content2,
52709
+ meta: {
52710
+ kind: "system",
52711
+ event: eventName,
52712
+ mesh_slug: client2.meshSlug,
52713
+ mesh_id: client2.meshId,
52714
+ ...Object.keys(data).length > 0 ? { eventData: data } : {}
52715
+ }
52716
+ }
52717
+ });
52718
+ process.stderr.write(`[claudemesh] system: ${content2}
52719
+ `);
52720
+ } catch (pushErr) {
52721
+ process.stderr.write(`[claudemesh] system push FAILED: ${pushErr}
52722
+ `);
52723
+ }
52724
+ return;
52725
+ }
52726
+ const fromPubkey = msg.senderPubkey || "";
52727
+ const fromName = fromPubkey ? await resolvePeerName(client2, fromPubkey) : "unknown";
52728
+ if (messageMode === "inbox") {
52729
+ try {
52730
+ await server.notification({
52731
+ method: "notifications/claude/channel",
52732
+ params: {
52733
+ content: `[inbox] New message from ${fromName}. Use check_messages to read.`,
52734
+ meta: { kind: "inbox_notification", from_name: fromName }
52735
+ }
52736
+ });
52737
+ } catch {}
52738
+ return;
51668
52739
  }
52740
+ const content = msg.plaintext ?? decryptFailedWarning(fromPubkey);
51669
52741
  try {
51670
52742
  await server.notification({
51671
52743
  method: "notifications/claude/channel",
51672
52744
  params: {
51673
- content: content2,
52745
+ content,
51674
52746
  meta: {
51675
- kind: "system",
51676
- event: eventName,
52747
+ from_id: fromPubkey,
52748
+ from_name: fromName,
51677
52749
  mesh_slug: client2.meshSlug,
51678
52750
  mesh_id: client2.meshId,
51679
- ...Object.keys(data).length > 0 ? { eventData: data } : {}
52751
+ priority: msg.priority,
52752
+ sent_at: msg.createdAt,
52753
+ delivered_at: msg.receivedAt,
52754
+ kind: msg.kind,
52755
+ ...msg.subtype ? { subtype: msg.subtype } : {}
51680
52756
  }
51681
52757
  }
51682
52758
  });
51683
- process.stderr.write(`[claudemesh] system: ${content2}
52759
+ process.stderr.write(`[claudemesh] pushed: from=${fromName} content=${content.slice(0, 60)}
51684
52760
  `);
51685
52761
  } catch (pushErr) {
51686
- process.stderr.write(`[claudemesh] system push FAILED: ${pushErr}
52762
+ process.stderr.write(`[claudemesh] push FAILED: ${pushErr}
51687
52763
  `);
51688
52764
  }
51689
- return;
51690
- }
51691
- const fromPubkey = msg.senderPubkey || "";
51692
- const fromName = fromPubkey ? await resolvePeerName(client2, fromPubkey) : "unknown";
51693
- if (messageMode === "inbox") {
52765
+ });
52766
+ client2.onStreamData(async (evt) => {
51694
52767
  try {
51695
52768
  await server.notification({
51696
52769
  method: "notifications/claude/channel",
51697
52770
  params: {
51698
- content: `[inbox] New message from ${fromName}. Use check_messages to read.`,
51699
- meta: { kind: "inbox_notification", from_name: fromName }
52771
+ content: `[stream:${evt.stream}] from ${evt.publishedBy}: ${JSON.stringify(evt.data)}`,
52772
+ meta: {
52773
+ kind: "stream_data",
52774
+ stream: evt.stream,
52775
+ published_by: evt.publishedBy
52776
+ }
51700
52777
  }
51701
52778
  });
51702
52779
  } catch {}
51703
- return;
51704
- }
51705
- const content = msg.plaintext ?? decryptFailedWarning(fromPubkey);
51706
- try {
51707
- await server.notification({
51708
- method: "notifications/claude/channel",
51709
- params: {
51710
- content,
51711
- meta: {
51712
- from_id: fromPubkey,
51713
- from_name: fromName,
51714
- mesh_slug: client2.meshSlug,
51715
- mesh_id: client2.meshId,
51716
- priority: msg.priority,
51717
- sent_at: msg.createdAt,
51718
- delivered_at: msg.receivedAt,
51719
- kind: msg.kind,
51720
- ...msg.subtype ? { subtype: msg.subtype } : {}
51721
- }
51722
- }
51723
- });
51724
- process.stderr.write(`[claudemesh] pushed: from=${fromName} content=${content.slice(0, 60)}
51725
- `);
51726
- } catch (pushErr) {
51727
- process.stderr.write(`[claudemesh] push FAILED: ${pushErr}
51728
- `);
51729
- }
51730
- });
51731
- client2.onStreamData(async (evt) => {
51732
- try {
51733
- await server.notification({
51734
- method: "notifications/claude/channel",
51735
- params: {
51736
- content: `[stream:${evt.stream}] from ${evt.publishedBy}: ${JSON.stringify(evt.data)}`,
51737
- meta: {
51738
- kind: "stream_data",
51739
- stream: evt.stream,
51740
- published_by: evt.publishedBy
52780
+ });
52781
+ client2.onStateChange(async (change) => {
52782
+ try {
52783
+ await server.notification({
52784
+ method: "notifications/claude/channel",
52785
+ params: {
52786
+ content: `[state] ${change.key} = ${JSON.stringify(change.value)} (set by ${change.updatedBy})`,
52787
+ meta: {
52788
+ kind: "state_change",
52789
+ key: change.key,
52790
+ updated_by: change.updatedBy
52791
+ }
51741
52792
  }
51742
- }
51743
- });
51744
- } catch {}
51745
- });
51746
- client2.onStateChange(async (change) => {
52793
+ });
52794
+ } catch {}
52795
+ });
52796
+ }
52797
+ setTimeout(async () => {
52798
+ const welcomeClient = allClients()[0];
52799
+ if (!welcomeClient || welcomeClient.status !== "open")
52800
+ return;
51747
52801
  try {
52802
+ const peers = await welcomeClient.listPeers();
52803
+ const peerNames = peers.filter((p) => p.displayName !== myName).map((p) => p.displayName).join(", ") || "none";
51748
52804
  await server.notification({
51749
52805
  method: "notifications/claude/channel",
51750
52806
  params: {
51751
- content: `[state] ${change.key} = ${JSON.stringify(change.value)} (set by ${change.updatedBy})`,
51752
- meta: {
51753
- kind: "state_change",
51754
- key: change.key,
51755
- updated_by: change.updatedBy
51756
- }
52807
+ content: `[system] Connected as ${myName} to mesh ${welcomeClient.meshSlug}. ${peers.length} peer(s) online: ${peerNames}. Call mesh_info for full details or set_summary to announce yourself.`,
52808
+ meta: { kind: "welcome", mesh_slug: welcomeClient.meshSlug }
51757
52809
  }
51758
52810
  });
51759
52811
  } catch {}
51760
- });
52812
+ }, 2000);
51761
52813
  }
51762
- setTimeout(async () => {
51763
- const client2 = allClients()[0];
51764
- if (!client2 || client2.status !== "open")
51765
- return;
51766
- try {
51767
- const peers = await client2.listPeers();
51768
- const peerNames = peers.filter((p) => p.displayName !== myName).map((p) => p.displayName).join(", ") || "none";
51769
- await server.notification({
51770
- method: "notifications/claude/channel",
51771
- params: {
51772
- content: `[system] Connected as ${myName} to mesh ${client2.meshSlug}. ${peers.length} peer(s) online: ${peerNames}. Call mesh_info for full details or set_summary to announce yourself.`,
51773
- meta: { kind: "welcome", mesh_slug: client2.meshSlug }
51774
- }
51775
- });
51776
- } catch {}
51777
- }, 3000);
51778
52814
  const keepalive = setInterval(() => {}, 1000);
51779
52815
  const shutdown = () => {
51780
52816
  clearInterval(keepalive);
@@ -53127,7 +54163,7 @@ init_config();
53127
54163
  // package.json
53128
54164
  var package_default = {
53129
54165
  name: "claudemesh-cli",
53130
- version: "0.9.0",
54166
+ version: "0.9.2",
53131
54167
  description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
53132
54168
  keywords: [
53133
54169
  "claude-code",
@@ -54216,6 +55252,62 @@ function printProfile(member, dim) {
54216
55252
  console.log(` Mesh: ${dim(String(member.id ?? ""))}`);
54217
55253
  }
54218
55254
 
55255
+ // src/commands/connect-telegram.ts
55256
+ init_config();
55257
+ async function connectTelegram(args) {
55258
+ const config2 = loadConfig();
55259
+ if (config2.meshes.length === 0) {
55260
+ console.error("No meshes joined. Run 'claudemesh join' first.");
55261
+ process.exit(1);
55262
+ }
55263
+ const mesh = config2.meshes[0];
55264
+ const linkOnly = args.includes("--link");
55265
+ const brokerHttp = mesh.brokerUrl.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
55266
+ console.log("Requesting Telegram connect token...");
55267
+ const res = await fetch(`${brokerHttp}/tg/token`, {
55268
+ method: "POST",
55269
+ headers: { "Content-Type": "application/json" },
55270
+ body: JSON.stringify({
55271
+ meshId: mesh.meshId,
55272
+ memberId: mesh.memberId,
55273
+ pubkey: mesh.pubkey,
55274
+ secretKey: mesh.secretKey
55275
+ }),
55276
+ signal: AbortSignal.timeout(1e4)
55277
+ });
55278
+ if (!res.ok) {
55279
+ const err = await res.json().catch(() => ({}));
55280
+ console.error(`Failed: ${err.error ?? res.statusText}`);
55281
+ process.exit(1);
55282
+ }
55283
+ const { token, deepLink } = await res.json();
55284
+ if (linkOnly) {
55285
+ console.log(deepLink);
55286
+ return;
55287
+ }
55288
+ console.log(`
55289
+ Connect Telegram to your mesh:
55290
+ `);
55291
+ console.log(` ${deepLink}
55292
+ `);
55293
+ console.log(" Open this link on your phone, or scan the QR code");
55294
+ console.log(` with your Telegram camera.
55295
+ `);
55296
+ try {
55297
+ const QRCode = require_main();
55298
+ QRCode.generate(deepLink, { small: true }, (code) => {
55299
+ console.log(code);
55300
+ });
55301
+ } catch {
55302
+ console.log(" (Install qrcode-terminal for QR code display)");
55303
+ }
55304
+ }
55305
+
55306
+ // src/commands/disconnect-telegram.ts
55307
+ async function disconnectTelegram() {
55308
+ console.log("To disconnect Telegram, send /disconnect in the bot chat.");
55309
+ }
55310
+
54219
55311
  // src/index.ts
54220
55312
  var launch = defineCommand({
54221
55313
  meta: {
@@ -54525,6 +55617,30 @@ var main = defineCommand({
54525
55617
  async run({ rawArgs }) {
54526
55618
  await runHook(rawArgs);
54527
55619
  }
55620
+ }),
55621
+ connect: defineCommand({
55622
+ meta: { name: "connect", description: "Connect an integration (e.g. telegram)" },
55623
+ args: { target: { type: "positional", description: "Integration target (telegram)", required: true } },
55624
+ async run({ args }) {
55625
+ if (args.target === "telegram")
55626
+ await connectTelegram(process.argv.slice(process.argv.indexOf("telegram") + 1));
55627
+ else {
55628
+ console.error(`Unknown target: ${args.target}`);
55629
+ process.exit(1);
55630
+ }
55631
+ }
55632
+ }),
55633
+ disconnect: defineCommand({
55634
+ meta: { name: "disconnect", description: "Disconnect an integration (e.g. telegram)" },
55635
+ args: { target: { type: "positional", description: "Integration target (telegram)", required: true } },
55636
+ async run({ args }) {
55637
+ if (args.target === "telegram")
55638
+ await disconnectTelegram();
55639
+ else {
55640
+ console.error(`Unknown target: ${args.target}`);
55641
+ process.exit(1);
55642
+ }
55643
+ }
54528
55644
  })
54529
55645
  },
54530
55646
  run() {