@cometix/claude-code 2.1.270 → 2.1.272
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/bun-ink-compat.cjs +1169 -0
- package/package.json +23 -19
- package/sdk-tools.d.ts +3 -7
package/bun-ink-compat.cjs
CHANGED
|
@@ -1174,3 +1174,1172 @@ var wrapAnsi2 = wrapAnsi;
|
|
|
1174
1174
|
stripANSI,
|
|
1175
1175
|
wrapAnsi
|
|
1176
1176
|
});
|
|
1177
|
+
|
|
1178
|
+
/*!
|
|
1179
|
+
slice-ansi 9.0.0
|
|
1180
|
+
MIT License
|
|
1181
|
+
|
|
1182
|
+
Copyright (c) DC <threedeecee@gmail.com>
|
|
1183
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1184
|
+
|
|
1185
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1186
|
+
|
|
1187
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1188
|
+
|
|
1189
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
ansi-styles 6.2.3
|
|
1193
|
+
MIT License
|
|
1194
|
+
|
|
1195
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1196
|
+
|
|
1197
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1198
|
+
|
|
1199
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1200
|
+
|
|
1201
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
get-east-asian-width 1.6.0
|
|
1205
|
+
MIT License
|
|
1206
|
+
|
|
1207
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1208
|
+
|
|
1209
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1210
|
+
|
|
1211
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1212
|
+
|
|
1213
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
is-fullwidth-code-point 5.1.0
|
|
1217
|
+
MIT License
|
|
1218
|
+
|
|
1219
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
1220
|
+
|
|
1221
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1222
|
+
|
|
1223
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1224
|
+
|
|
1225
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1226
|
+
|
|
1227
|
+
*/
|
|
1228
|
+
var __ccAnsiSlice = (() => {
|
|
1229
|
+
var __defProp = Object.defineProperty;
|
|
1230
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1231
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1232
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1233
|
+
var __export = (target, all) => {
|
|
1234
|
+
for (var name in all)
|
|
1235
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
1236
|
+
};
|
|
1237
|
+
var __copyProps = (to, from, except, desc) => {
|
|
1238
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1239
|
+
for (let key of __getOwnPropNames(from))
|
|
1240
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1241
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
1242
|
+
}
|
|
1243
|
+
return to;
|
|
1244
|
+
};
|
|
1245
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1246
|
+
|
|
1247
|
+
// dl-2.1.271-output/deps/slice-entry.js
|
|
1248
|
+
var slice_entry_exports = {};
|
|
1249
|
+
__export(slice_entry_exports, {
|
|
1250
|
+
sliceAnsi: () => sliceAnsi
|
|
1251
|
+
});
|
|
1252
|
+
|
|
1253
|
+
// dl-2.1.271-output/deps/node_modules/ansi-styles/index.js
|
|
1254
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
1255
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
1256
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
1257
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1258
|
+
var styles = {
|
|
1259
|
+
modifier: {
|
|
1260
|
+
reset: [0, 0],
|
|
1261
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
1262
|
+
bold: [1, 22],
|
|
1263
|
+
dim: [2, 22],
|
|
1264
|
+
italic: [3, 23],
|
|
1265
|
+
underline: [4, 24],
|
|
1266
|
+
overline: [53, 55],
|
|
1267
|
+
inverse: [7, 27],
|
|
1268
|
+
hidden: [8, 28],
|
|
1269
|
+
strikethrough: [9, 29]
|
|
1270
|
+
},
|
|
1271
|
+
color: {
|
|
1272
|
+
black: [30, 39],
|
|
1273
|
+
red: [31, 39],
|
|
1274
|
+
green: [32, 39],
|
|
1275
|
+
yellow: [33, 39],
|
|
1276
|
+
blue: [34, 39],
|
|
1277
|
+
magenta: [35, 39],
|
|
1278
|
+
cyan: [36, 39],
|
|
1279
|
+
white: [37, 39],
|
|
1280
|
+
// Bright color
|
|
1281
|
+
blackBright: [90, 39],
|
|
1282
|
+
gray: [90, 39],
|
|
1283
|
+
// Alias of `blackBright`
|
|
1284
|
+
grey: [90, 39],
|
|
1285
|
+
// Alias of `blackBright`
|
|
1286
|
+
redBright: [91, 39],
|
|
1287
|
+
greenBright: [92, 39],
|
|
1288
|
+
yellowBright: [93, 39],
|
|
1289
|
+
blueBright: [94, 39],
|
|
1290
|
+
magentaBright: [95, 39],
|
|
1291
|
+
cyanBright: [96, 39],
|
|
1292
|
+
whiteBright: [97, 39]
|
|
1293
|
+
},
|
|
1294
|
+
bgColor: {
|
|
1295
|
+
bgBlack: [40, 49],
|
|
1296
|
+
bgRed: [41, 49],
|
|
1297
|
+
bgGreen: [42, 49],
|
|
1298
|
+
bgYellow: [43, 49],
|
|
1299
|
+
bgBlue: [44, 49],
|
|
1300
|
+
bgMagenta: [45, 49],
|
|
1301
|
+
bgCyan: [46, 49],
|
|
1302
|
+
bgWhite: [47, 49],
|
|
1303
|
+
// Bright color
|
|
1304
|
+
bgBlackBright: [100, 49],
|
|
1305
|
+
bgGray: [100, 49],
|
|
1306
|
+
// Alias of `bgBlackBright`
|
|
1307
|
+
bgGrey: [100, 49],
|
|
1308
|
+
// Alias of `bgBlackBright`
|
|
1309
|
+
bgRedBright: [101, 49],
|
|
1310
|
+
bgGreenBright: [102, 49],
|
|
1311
|
+
bgYellowBright: [103, 49],
|
|
1312
|
+
bgBlueBright: [104, 49],
|
|
1313
|
+
bgMagentaBright: [105, 49],
|
|
1314
|
+
bgCyanBright: [106, 49],
|
|
1315
|
+
bgWhiteBright: [107, 49]
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
1319
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
1320
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
1321
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
1322
|
+
function assembleStyles() {
|
|
1323
|
+
const codes = /* @__PURE__ */ new Map();
|
|
1324
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1325
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1326
|
+
styles[styleName] = {
|
|
1327
|
+
open: `\x1B[${style[0]}m`,
|
|
1328
|
+
close: `\x1B[${style[1]}m`
|
|
1329
|
+
};
|
|
1330
|
+
group[styleName] = styles[styleName];
|
|
1331
|
+
codes.set(style[0], style[1]);
|
|
1332
|
+
}
|
|
1333
|
+
Object.defineProperty(styles, groupName, {
|
|
1334
|
+
value: group,
|
|
1335
|
+
enumerable: false
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
Object.defineProperty(styles, "codes", {
|
|
1339
|
+
value: codes,
|
|
1340
|
+
enumerable: false
|
|
1341
|
+
});
|
|
1342
|
+
styles.color.close = "\x1B[39m";
|
|
1343
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1344
|
+
styles.color.ansi = wrapAnsi16();
|
|
1345
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
1346
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
1347
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
1348
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
1349
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
1350
|
+
Object.defineProperties(styles, {
|
|
1351
|
+
rgbToAnsi256: {
|
|
1352
|
+
value(red, green, blue) {
|
|
1353
|
+
if (red === green && green === blue) {
|
|
1354
|
+
if (red < 8) {
|
|
1355
|
+
return 16;
|
|
1356
|
+
}
|
|
1357
|
+
if (red > 248) {
|
|
1358
|
+
return 231;
|
|
1359
|
+
}
|
|
1360
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
1361
|
+
}
|
|
1362
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
1363
|
+
},
|
|
1364
|
+
enumerable: false
|
|
1365
|
+
},
|
|
1366
|
+
hexToRgb: {
|
|
1367
|
+
value(hex) {
|
|
1368
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
1369
|
+
if (!matches) {
|
|
1370
|
+
return [0, 0, 0];
|
|
1371
|
+
}
|
|
1372
|
+
let [colorString] = matches;
|
|
1373
|
+
if (colorString.length === 3) {
|
|
1374
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
1375
|
+
}
|
|
1376
|
+
const integer = Number.parseInt(colorString, 16);
|
|
1377
|
+
return [
|
|
1378
|
+
/* eslint-disable no-bitwise */
|
|
1379
|
+
integer >> 16 & 255,
|
|
1380
|
+
integer >> 8 & 255,
|
|
1381
|
+
integer & 255
|
|
1382
|
+
/* eslint-enable no-bitwise */
|
|
1383
|
+
];
|
|
1384
|
+
},
|
|
1385
|
+
enumerable: false
|
|
1386
|
+
},
|
|
1387
|
+
hexToAnsi256: {
|
|
1388
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
1389
|
+
enumerable: false
|
|
1390
|
+
},
|
|
1391
|
+
ansi256ToAnsi: {
|
|
1392
|
+
value(code) {
|
|
1393
|
+
if (code < 8) {
|
|
1394
|
+
return 30 + code;
|
|
1395
|
+
}
|
|
1396
|
+
if (code < 16) {
|
|
1397
|
+
return 90 + (code - 8);
|
|
1398
|
+
}
|
|
1399
|
+
let red;
|
|
1400
|
+
let green;
|
|
1401
|
+
let blue;
|
|
1402
|
+
if (code >= 232) {
|
|
1403
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
1404
|
+
green = red;
|
|
1405
|
+
blue = red;
|
|
1406
|
+
} else {
|
|
1407
|
+
code -= 16;
|
|
1408
|
+
const remainder = code % 36;
|
|
1409
|
+
red = Math.floor(code / 36) / 5;
|
|
1410
|
+
green = Math.floor(remainder / 6) / 5;
|
|
1411
|
+
blue = remainder % 6 / 5;
|
|
1412
|
+
}
|
|
1413
|
+
const value = Math.max(red, green, blue) * 2;
|
|
1414
|
+
if (value === 0) {
|
|
1415
|
+
return 30;
|
|
1416
|
+
}
|
|
1417
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
1418
|
+
if (value === 2) {
|
|
1419
|
+
result += 60;
|
|
1420
|
+
}
|
|
1421
|
+
return result;
|
|
1422
|
+
},
|
|
1423
|
+
enumerable: false
|
|
1424
|
+
},
|
|
1425
|
+
rgbToAnsi: {
|
|
1426
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
1427
|
+
enumerable: false
|
|
1428
|
+
},
|
|
1429
|
+
hexToAnsi: {
|
|
1430
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
1431
|
+
enumerable: false
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
return styles;
|
|
1435
|
+
}
|
|
1436
|
+
var ansiStyles = assembleStyles();
|
|
1437
|
+
var ansi_styles_default = ansiStyles;
|
|
1438
|
+
|
|
1439
|
+
// dl-2.1.271-output/deps/node_modules/get-east-asian-width/lookup-data.js
|
|
1440
|
+
var fullwidthMinimalCodePoint = 12288;
|
|
1441
|
+
var fullwidthMaximumCodePoint = 65510;
|
|
1442
|
+
var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
1443
|
+
var wideMinimalCodePoint = 4352;
|
|
1444
|
+
var wideMaximumCodePoint = 262141;
|
|
1445
|
+
var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
|
|
1446
|
+
|
|
1447
|
+
// dl-2.1.271-output/deps/node_modules/get-east-asian-width/utilities.js
|
|
1448
|
+
var isInRange = (ranges, codePoint) => {
|
|
1449
|
+
let low = 0;
|
|
1450
|
+
let high = Math.floor(ranges.length / 2) - 1;
|
|
1451
|
+
while (low <= high) {
|
|
1452
|
+
const mid = Math.floor((low + high) / 2);
|
|
1453
|
+
const i = mid * 2;
|
|
1454
|
+
if (codePoint < ranges[i]) {
|
|
1455
|
+
high = mid - 1;
|
|
1456
|
+
} else if (codePoint > ranges[i + 1]) {
|
|
1457
|
+
low = mid + 1;
|
|
1458
|
+
} else {
|
|
1459
|
+
return true;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
return false;
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
// dl-2.1.271-output/deps/node_modules/get-east-asian-width/lookup.js
|
|
1466
|
+
var commonCjkCodePoint = 19968;
|
|
1467
|
+
var [wideFastPathStart, wideFastPathEnd] = /* @__PURE__ */ findWideFastPathRange(wideRanges);
|
|
1468
|
+
function findWideFastPathRange(ranges) {
|
|
1469
|
+
let fastPathStart = ranges[0];
|
|
1470
|
+
let fastPathEnd = ranges[1];
|
|
1471
|
+
for (let index = 0; index < ranges.length; index += 2) {
|
|
1472
|
+
const start = ranges[index];
|
|
1473
|
+
const end = ranges[index + 1];
|
|
1474
|
+
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
|
|
1475
|
+
return [start, end];
|
|
1476
|
+
}
|
|
1477
|
+
if (end - start > fastPathEnd - fastPathStart) {
|
|
1478
|
+
fastPathStart = start;
|
|
1479
|
+
fastPathEnd = end;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return [fastPathStart, fastPathEnd];
|
|
1483
|
+
}
|
|
1484
|
+
var isFullWidth = (codePoint) => {
|
|
1485
|
+
if (codePoint < fullwidthMinimalCodePoint || codePoint > fullwidthMaximumCodePoint) {
|
|
1486
|
+
return false;
|
|
1487
|
+
}
|
|
1488
|
+
return isInRange(fullwidthRanges, codePoint);
|
|
1489
|
+
};
|
|
1490
|
+
var isWide = (codePoint) => {
|
|
1491
|
+
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
|
|
1492
|
+
return true;
|
|
1493
|
+
}
|
|
1494
|
+
if (codePoint < wideMinimalCodePoint || codePoint > wideMaximumCodePoint) {
|
|
1495
|
+
return false;
|
|
1496
|
+
}
|
|
1497
|
+
return isInRange(wideRanges, codePoint);
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
// dl-2.1.271-output/deps/node_modules/is-fullwidth-code-point/index.js
|
|
1501
|
+
function isFullwidthCodePoint(codePoint) {
|
|
1502
|
+
if (!Number.isInteger(codePoint)) {
|
|
1503
|
+
return false;
|
|
1504
|
+
}
|
|
1505
|
+
return isFullWidth(codePoint) || isWide(codePoint);
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// dl-2.1.271-output/deps/node_modules/slice-ansi/tokenize-ansi.js
|
|
1509
|
+
var ESCAPE_CODE_POINT = 27;
|
|
1510
|
+
var C1_DCS_CODE_POINT = 144;
|
|
1511
|
+
var C1_SOS_CODE_POINT = 152;
|
|
1512
|
+
var C1_CSI_CODE_POINT = 155;
|
|
1513
|
+
var C1_ST_CODE_POINT = 156;
|
|
1514
|
+
var C1_OSC_CODE_POINT = 157;
|
|
1515
|
+
var C1_PM_CODE_POINT = 158;
|
|
1516
|
+
var C1_APC_CODE_POINT = 159;
|
|
1517
|
+
var ESCAPES = /* @__PURE__ */ new Set([
|
|
1518
|
+
ESCAPE_CODE_POINT,
|
|
1519
|
+
C1_DCS_CODE_POINT,
|
|
1520
|
+
C1_SOS_CODE_POINT,
|
|
1521
|
+
C1_CSI_CODE_POINT,
|
|
1522
|
+
C1_ST_CODE_POINT,
|
|
1523
|
+
C1_OSC_CODE_POINT,
|
|
1524
|
+
C1_PM_CODE_POINT,
|
|
1525
|
+
C1_APC_CODE_POINT
|
|
1526
|
+
]);
|
|
1527
|
+
var ESCAPE = "\x1B";
|
|
1528
|
+
var ANSI_BELL = "\x07";
|
|
1529
|
+
var ANSI_CSI = "[";
|
|
1530
|
+
var ANSI_OSC = "]";
|
|
1531
|
+
var ANSI_DCS = "P";
|
|
1532
|
+
var ANSI_SOS = "X";
|
|
1533
|
+
var ANSI_PM = "^";
|
|
1534
|
+
var ANSI_APC = "_";
|
|
1535
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
1536
|
+
var ANSI_OSC_TERMINATOR = "\\";
|
|
1537
|
+
var ANSI_STRING_TERMINATOR = `${ESCAPE}${ANSI_OSC_TERMINATOR}`;
|
|
1538
|
+
var C1_OSC = "\x9D";
|
|
1539
|
+
var C1_STRING_TERMINATOR = "\x9C";
|
|
1540
|
+
var ANSI_HYPERLINK_ESC_PREFIX = `${ESCAPE}${ANSI_OSC}8;`;
|
|
1541
|
+
var ANSI_HYPERLINK_C1_PREFIX = `${C1_OSC}8;`;
|
|
1542
|
+
var ANSI_HYPERLINK_ESC_CLOSE = `${ANSI_HYPERLINK_ESC_PREFIX};`;
|
|
1543
|
+
var ANSI_HYPERLINK_C1_CLOSE = `${ANSI_HYPERLINK_C1_PREFIX};`;
|
|
1544
|
+
var CODE_POINT_0 = "0".codePointAt(0);
|
|
1545
|
+
var CODE_POINT_9 = "9".codePointAt(0);
|
|
1546
|
+
var CODE_POINT_SEMICOLON = ";".codePointAt(0);
|
|
1547
|
+
var CODE_POINT_COLON = ":".codePointAt(0);
|
|
1548
|
+
var CODE_POINT_CSI_PARAMETER_START = "0".codePointAt(0);
|
|
1549
|
+
var CODE_POINT_CSI_PARAMETER_END = "?".codePointAt(0);
|
|
1550
|
+
var CODE_POINT_CSI_INTERMEDIATE_START = " ".codePointAt(0);
|
|
1551
|
+
var CODE_POINT_CSI_INTERMEDIATE_END = "/".codePointAt(0);
|
|
1552
|
+
var CODE_POINT_CSI_FINAL_START = "@".codePointAt(0);
|
|
1553
|
+
var CODE_POINT_CSI_FINAL_END = "~".codePointAt(0);
|
|
1554
|
+
var REGIONAL_INDICATOR_SYMBOL_LETTER_A = 127462;
|
|
1555
|
+
var REGIONAL_INDICATOR_SYMBOL_LETTER_Z = 127487;
|
|
1556
|
+
var SGR_RESET_CODE = 0;
|
|
1557
|
+
var SGR_EXTENDED_FOREGROUND_CODE = 38;
|
|
1558
|
+
var SGR_DEFAULT_FOREGROUND_CODE = 39;
|
|
1559
|
+
var SGR_EXTENDED_BACKGROUND_CODE = 48;
|
|
1560
|
+
var SGR_DEFAULT_BACKGROUND_CODE = 49;
|
|
1561
|
+
var SGR_COLOR_TYPE_ANSI_256 = 5;
|
|
1562
|
+
var SGR_COLOR_TYPE_TRUECOLOR = 2;
|
|
1563
|
+
var SGR_ANSI_256_FRAGMENT_LENGTH = 3;
|
|
1564
|
+
var SGR_TRUECOLOR_FRAGMENT_LENGTH = 5;
|
|
1565
|
+
var SGR_ANSI_256_LAST_PARAMETER_OFFSET = 2;
|
|
1566
|
+
var SGR_TRUECOLOR_LAST_PARAMETER_OFFSET = 4;
|
|
1567
|
+
var VARIATION_SELECTOR_16_CODE_POINT = 65039;
|
|
1568
|
+
var COMBINING_ENCLOSING_KEYCAP_CODE_POINT = 8419;
|
|
1569
|
+
var EMOJI_PRESENTATION_GRAPHEME_REGEX = new RegExp("\\p{Emoji_Presentation}", "v");
|
|
1570
|
+
var GRAPHEME_SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
1571
|
+
var endCodeNumbers = /* @__PURE__ */ new Set();
|
|
1572
|
+
for (const [, end] of ansi_styles_default.codes) {
|
|
1573
|
+
endCodeNumbers.add(end);
|
|
1574
|
+
}
|
|
1575
|
+
function isSgrParameterCharacter(codePoint) {
|
|
1576
|
+
return codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9 || codePoint === CODE_POINT_SEMICOLON || codePoint === CODE_POINT_COLON;
|
|
1577
|
+
}
|
|
1578
|
+
function isCsiParameterCharacter(codePoint) {
|
|
1579
|
+
return codePoint >= CODE_POINT_CSI_PARAMETER_START && codePoint <= CODE_POINT_CSI_PARAMETER_END;
|
|
1580
|
+
}
|
|
1581
|
+
function isCsiIntermediateCharacter(codePoint) {
|
|
1582
|
+
return codePoint >= CODE_POINT_CSI_INTERMEDIATE_START && codePoint <= CODE_POINT_CSI_INTERMEDIATE_END;
|
|
1583
|
+
}
|
|
1584
|
+
function isCsiFinalCharacter(codePoint) {
|
|
1585
|
+
return codePoint >= CODE_POINT_CSI_FINAL_START && codePoint <= CODE_POINT_CSI_FINAL_END;
|
|
1586
|
+
}
|
|
1587
|
+
function isRegionalIndicatorCodePoint(codePoint) {
|
|
1588
|
+
return codePoint >= REGIONAL_INDICATOR_SYMBOL_LETTER_A && codePoint <= REGIONAL_INDICATOR_SYMBOL_LETTER_Z;
|
|
1589
|
+
}
|
|
1590
|
+
function createControlParseResult(code, endIndex) {
|
|
1591
|
+
return {
|
|
1592
|
+
token: {
|
|
1593
|
+
type: "control",
|
|
1594
|
+
code
|
|
1595
|
+
},
|
|
1596
|
+
endIndex
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
function isEmojiStyleGrapheme(grapheme) {
|
|
1600
|
+
if (EMOJI_PRESENTATION_GRAPHEME_REGEX.test(grapheme)) {
|
|
1601
|
+
return true;
|
|
1602
|
+
}
|
|
1603
|
+
for (const character of grapheme) {
|
|
1604
|
+
const codePoint = character.codePointAt(0);
|
|
1605
|
+
if (codePoint === VARIATION_SELECTOR_16_CODE_POINT || codePoint === COMBINING_ENCLOSING_KEYCAP_CODE_POINT) {
|
|
1606
|
+
return true;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
return false;
|
|
1610
|
+
}
|
|
1611
|
+
function getGraphemeWidth(grapheme) {
|
|
1612
|
+
let regionalIndicatorCount = 0;
|
|
1613
|
+
for (const character of grapheme) {
|
|
1614
|
+
const codePoint = character.codePointAt(0);
|
|
1615
|
+
if (isFullwidthCodePoint(codePoint)) {
|
|
1616
|
+
return 2;
|
|
1617
|
+
}
|
|
1618
|
+
if (isRegionalIndicatorCodePoint(codePoint)) {
|
|
1619
|
+
regionalIndicatorCount++;
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
if (regionalIndicatorCount >= 1) {
|
|
1623
|
+
return 2;
|
|
1624
|
+
}
|
|
1625
|
+
if (isEmojiStyleGrapheme(grapheme)) {
|
|
1626
|
+
return 2;
|
|
1627
|
+
}
|
|
1628
|
+
return 1;
|
|
1629
|
+
}
|
|
1630
|
+
function getSgrPrefix(code) {
|
|
1631
|
+
if (code.startsWith("\x9B")) {
|
|
1632
|
+
return "\x9B";
|
|
1633
|
+
}
|
|
1634
|
+
return `${ESCAPE}${ANSI_CSI}`;
|
|
1635
|
+
}
|
|
1636
|
+
function createSgrCode(prefix, values) {
|
|
1637
|
+
return `${prefix}${values.join(";")}${ANSI_SGR_TERMINATOR}`;
|
|
1638
|
+
}
|
|
1639
|
+
function getSgrFragments(code) {
|
|
1640
|
+
const fragments = [];
|
|
1641
|
+
const sgrPrefix = getSgrPrefix(code);
|
|
1642
|
+
let parameterString;
|
|
1643
|
+
if (code.startsWith(`${ESCAPE}${ANSI_CSI}`)) {
|
|
1644
|
+
parameterString = code.slice(2, -1);
|
|
1645
|
+
} else if (code.startsWith("\x9B")) {
|
|
1646
|
+
parameterString = code.slice(1, -1);
|
|
1647
|
+
} else {
|
|
1648
|
+
return fragments;
|
|
1649
|
+
}
|
|
1650
|
+
const rawCodes = parameterString.length === 0 ? [String(SGR_RESET_CODE)] : parameterString.split(";");
|
|
1651
|
+
let index = 0;
|
|
1652
|
+
while (index < rawCodes.length) {
|
|
1653
|
+
const codeNumber = Number.parseInt(rawCodes[index], 10);
|
|
1654
|
+
if (Number.isNaN(codeNumber)) {
|
|
1655
|
+
index++;
|
|
1656
|
+
continue;
|
|
1657
|
+
}
|
|
1658
|
+
if (codeNumber === SGR_RESET_CODE) {
|
|
1659
|
+
fragments.push({ type: "reset" });
|
|
1660
|
+
index++;
|
|
1661
|
+
continue;
|
|
1662
|
+
}
|
|
1663
|
+
if (codeNumber === SGR_EXTENDED_FOREGROUND_CODE || codeNumber === SGR_EXTENDED_BACKGROUND_CODE) {
|
|
1664
|
+
const colorType = Number.parseInt(rawCodes[index + 1], 10);
|
|
1665
|
+
if (colorType === SGR_COLOR_TYPE_ANSI_256 && index + SGR_ANSI_256_LAST_PARAMETER_OFFSET < rawCodes.length) {
|
|
1666
|
+
const openCode3 = createSgrCode(sgrPrefix, rawCodes.slice(index, index + SGR_ANSI_256_FRAGMENT_LENGTH));
|
|
1667
|
+
fragments.push({
|
|
1668
|
+
type: "start",
|
|
1669
|
+
code: openCode3,
|
|
1670
|
+
endCode: ansi_styles_default.color.ansi(codeNumber === SGR_EXTENDED_FOREGROUND_CODE ? SGR_DEFAULT_FOREGROUND_CODE : SGR_DEFAULT_BACKGROUND_CODE)
|
|
1671
|
+
});
|
|
1672
|
+
index += SGR_ANSI_256_FRAGMENT_LENGTH;
|
|
1673
|
+
continue;
|
|
1674
|
+
}
|
|
1675
|
+
if (colorType === SGR_COLOR_TYPE_TRUECOLOR && index + SGR_TRUECOLOR_LAST_PARAMETER_OFFSET < rawCodes.length) {
|
|
1676
|
+
const openCode3 = createSgrCode(sgrPrefix, rawCodes.slice(index, index + SGR_TRUECOLOR_FRAGMENT_LENGTH));
|
|
1677
|
+
fragments.push({
|
|
1678
|
+
type: "start",
|
|
1679
|
+
code: openCode3,
|
|
1680
|
+
endCode: ansi_styles_default.color.ansi(codeNumber === SGR_EXTENDED_FOREGROUND_CODE ? SGR_DEFAULT_FOREGROUND_CODE : SGR_DEFAULT_BACKGROUND_CODE)
|
|
1681
|
+
});
|
|
1682
|
+
index += SGR_TRUECOLOR_FRAGMENT_LENGTH;
|
|
1683
|
+
continue;
|
|
1684
|
+
}
|
|
1685
|
+
const openCode2 = createSgrCode(sgrPrefix, [rawCodes[index]]);
|
|
1686
|
+
fragments.push({
|
|
1687
|
+
type: "start",
|
|
1688
|
+
code: openCode2,
|
|
1689
|
+
endCode: ansi_styles_default.color.ansi(codeNumber === SGR_EXTENDED_FOREGROUND_CODE ? SGR_DEFAULT_FOREGROUND_CODE : SGR_DEFAULT_BACKGROUND_CODE)
|
|
1690
|
+
});
|
|
1691
|
+
index++;
|
|
1692
|
+
continue;
|
|
1693
|
+
}
|
|
1694
|
+
if (endCodeNumbers.has(codeNumber)) {
|
|
1695
|
+
fragments.push({
|
|
1696
|
+
type: "end",
|
|
1697
|
+
endCode: ansi_styles_default.color.ansi(codeNumber)
|
|
1698
|
+
});
|
|
1699
|
+
index++;
|
|
1700
|
+
continue;
|
|
1701
|
+
}
|
|
1702
|
+
const mappedEndCode = ansi_styles_default.codes.get(codeNumber);
|
|
1703
|
+
if (mappedEndCode !== void 0) {
|
|
1704
|
+
const openCode2 = createSgrCode(sgrPrefix, [rawCodes[index]]);
|
|
1705
|
+
fragments.push({
|
|
1706
|
+
type: "start",
|
|
1707
|
+
code: openCode2,
|
|
1708
|
+
endCode: ansi_styles_default.color.ansi(mappedEndCode)
|
|
1709
|
+
});
|
|
1710
|
+
index++;
|
|
1711
|
+
continue;
|
|
1712
|
+
}
|
|
1713
|
+
const openCode = createSgrCode(sgrPrefix, [rawCodes[index]]);
|
|
1714
|
+
fragments.push({
|
|
1715
|
+
type: "start",
|
|
1716
|
+
code: openCode,
|
|
1717
|
+
endCode: ansi_styles_default.reset.open
|
|
1718
|
+
});
|
|
1719
|
+
index++;
|
|
1720
|
+
}
|
|
1721
|
+
if (fragments.length === 0) {
|
|
1722
|
+
fragments.push({ type: "reset" });
|
|
1723
|
+
}
|
|
1724
|
+
return fragments;
|
|
1725
|
+
}
|
|
1726
|
+
function parseCsiCode(string, index) {
|
|
1727
|
+
const escapeCodePoint = string.codePointAt(index);
|
|
1728
|
+
let sequenceStartIndex;
|
|
1729
|
+
if (escapeCodePoint === ESCAPE_CODE_POINT) {
|
|
1730
|
+
if (string[index + 1] !== ANSI_CSI) {
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
sequenceStartIndex = index + 2;
|
|
1734
|
+
} else if (escapeCodePoint === C1_CSI_CODE_POINT) {
|
|
1735
|
+
sequenceStartIndex = index + 1;
|
|
1736
|
+
} else {
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
let hasCanonicalSgrParameters = true;
|
|
1740
|
+
for (let sequenceIndex = sequenceStartIndex; sequenceIndex < string.length; sequenceIndex++) {
|
|
1741
|
+
const codePoint = string.codePointAt(sequenceIndex);
|
|
1742
|
+
if (isCsiFinalCharacter(codePoint)) {
|
|
1743
|
+
const code = string.slice(index, sequenceIndex + 1);
|
|
1744
|
+
if (string[sequenceIndex] !== ANSI_SGR_TERMINATOR || !hasCanonicalSgrParameters) {
|
|
1745
|
+
return createControlParseResult(code, sequenceIndex + 1);
|
|
1746
|
+
}
|
|
1747
|
+
return {
|
|
1748
|
+
token: {
|
|
1749
|
+
type: "sgr",
|
|
1750
|
+
code,
|
|
1751
|
+
fragments: getSgrFragments(code)
|
|
1752
|
+
},
|
|
1753
|
+
endIndex: sequenceIndex + 1
|
|
1754
|
+
};
|
|
1755
|
+
}
|
|
1756
|
+
if (isCsiParameterCharacter(codePoint)) {
|
|
1757
|
+
if (!isSgrParameterCharacter(codePoint)) {
|
|
1758
|
+
hasCanonicalSgrParameters = false;
|
|
1759
|
+
}
|
|
1760
|
+
continue;
|
|
1761
|
+
}
|
|
1762
|
+
if (isCsiIntermediateCharacter(codePoint)) {
|
|
1763
|
+
hasCanonicalSgrParameters = false;
|
|
1764
|
+
continue;
|
|
1765
|
+
}
|
|
1766
|
+
const endIndex = sequenceIndex;
|
|
1767
|
+
return createControlParseResult(string.slice(index, endIndex), endIndex);
|
|
1768
|
+
}
|
|
1769
|
+
return createControlParseResult(string.slice(index), string.length);
|
|
1770
|
+
}
|
|
1771
|
+
function parseHyperlinkCode(string, index) {
|
|
1772
|
+
let hyperlinkPrefix;
|
|
1773
|
+
let hyperlinkClose;
|
|
1774
|
+
const codePoint = string.codePointAt(index);
|
|
1775
|
+
if (codePoint === ESCAPE_CODE_POINT && string.startsWith(ANSI_HYPERLINK_ESC_PREFIX, index)) {
|
|
1776
|
+
hyperlinkPrefix = ANSI_HYPERLINK_ESC_PREFIX;
|
|
1777
|
+
hyperlinkClose = ANSI_HYPERLINK_ESC_CLOSE;
|
|
1778
|
+
} else if (codePoint === C1_OSC_CODE_POINT && string.startsWith(ANSI_HYPERLINK_C1_PREFIX, index)) {
|
|
1779
|
+
hyperlinkPrefix = ANSI_HYPERLINK_C1_PREFIX;
|
|
1780
|
+
hyperlinkClose = ANSI_HYPERLINK_C1_CLOSE;
|
|
1781
|
+
} else {
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
const uriStart = string.indexOf(";", index + hyperlinkPrefix.length);
|
|
1785
|
+
if (uriStart === -1) {
|
|
1786
|
+
return createControlParseResult(string.slice(index), string.length);
|
|
1787
|
+
}
|
|
1788
|
+
for (let sequenceIndex = uriStart + 1; sequenceIndex < string.length; sequenceIndex++) {
|
|
1789
|
+
const character = string[sequenceIndex];
|
|
1790
|
+
if (character === ANSI_BELL) {
|
|
1791
|
+
const code = string.slice(index, sequenceIndex + 1);
|
|
1792
|
+
const action = sequenceIndex === uriStart + 1 ? "close" : "open";
|
|
1793
|
+
return {
|
|
1794
|
+
token: {
|
|
1795
|
+
type: "hyperlink",
|
|
1796
|
+
code,
|
|
1797
|
+
action,
|
|
1798
|
+
closePrefix: hyperlinkClose,
|
|
1799
|
+
terminator: ANSI_BELL
|
|
1800
|
+
},
|
|
1801
|
+
endIndex: sequenceIndex + 1
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
if (character === ESCAPE && string[sequenceIndex + 1] === ANSI_OSC_TERMINATOR) {
|
|
1805
|
+
const code = string.slice(index, sequenceIndex + 2);
|
|
1806
|
+
const action = sequenceIndex === uriStart + 1 ? "close" : "open";
|
|
1807
|
+
return {
|
|
1808
|
+
token: {
|
|
1809
|
+
type: "hyperlink",
|
|
1810
|
+
code,
|
|
1811
|
+
action,
|
|
1812
|
+
closePrefix: hyperlinkClose,
|
|
1813
|
+
terminator: ANSI_STRING_TERMINATOR
|
|
1814
|
+
},
|
|
1815
|
+
endIndex: sequenceIndex + 2
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
if (character === C1_STRING_TERMINATOR) {
|
|
1819
|
+
const code = string.slice(index, sequenceIndex + 1);
|
|
1820
|
+
const action = sequenceIndex === uriStart + 1 ? "close" : "open";
|
|
1821
|
+
return {
|
|
1822
|
+
token: {
|
|
1823
|
+
type: "hyperlink",
|
|
1824
|
+
code,
|
|
1825
|
+
action,
|
|
1826
|
+
closePrefix: hyperlinkClose,
|
|
1827
|
+
terminator: C1_STRING_TERMINATOR
|
|
1828
|
+
},
|
|
1829
|
+
endIndex: sequenceIndex + 1
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
return createControlParseResult(string.slice(index), string.length);
|
|
1834
|
+
}
|
|
1835
|
+
function parseControlStringCode(string, index) {
|
|
1836
|
+
const codePoint = string.codePointAt(index);
|
|
1837
|
+
let sequenceStartIndex;
|
|
1838
|
+
let supportsBellTerminator = false;
|
|
1839
|
+
switch (codePoint) {
|
|
1840
|
+
case ESCAPE_CODE_POINT: {
|
|
1841
|
+
const command = string[index + 1];
|
|
1842
|
+
switch (command) {
|
|
1843
|
+
case ANSI_OSC: {
|
|
1844
|
+
sequenceStartIndex = index + 2;
|
|
1845
|
+
supportsBellTerminator = true;
|
|
1846
|
+
break;
|
|
1847
|
+
}
|
|
1848
|
+
case ANSI_DCS:
|
|
1849
|
+
case ANSI_SOS:
|
|
1850
|
+
case ANSI_PM:
|
|
1851
|
+
case ANSI_APC: {
|
|
1852
|
+
sequenceStartIndex = index + 2;
|
|
1853
|
+
break;
|
|
1854
|
+
}
|
|
1855
|
+
case ANSI_OSC_TERMINATOR: {
|
|
1856
|
+
return createControlParseResult(ANSI_STRING_TERMINATOR, index + 2);
|
|
1857
|
+
}
|
|
1858
|
+
default: {
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
break;
|
|
1863
|
+
}
|
|
1864
|
+
case C1_OSC_CODE_POINT: {
|
|
1865
|
+
sequenceStartIndex = index + 1;
|
|
1866
|
+
supportsBellTerminator = true;
|
|
1867
|
+
break;
|
|
1868
|
+
}
|
|
1869
|
+
case C1_DCS_CODE_POINT:
|
|
1870
|
+
case C1_SOS_CODE_POINT:
|
|
1871
|
+
case C1_PM_CODE_POINT:
|
|
1872
|
+
case C1_APC_CODE_POINT: {
|
|
1873
|
+
sequenceStartIndex = index + 1;
|
|
1874
|
+
break;
|
|
1875
|
+
}
|
|
1876
|
+
case C1_ST_CODE_POINT: {
|
|
1877
|
+
return createControlParseResult(C1_STRING_TERMINATOR, index + 1);
|
|
1878
|
+
}
|
|
1879
|
+
default: {
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
for (let sequenceIndex = sequenceStartIndex; sequenceIndex < string.length; sequenceIndex++) {
|
|
1884
|
+
if (supportsBellTerminator && string[sequenceIndex] === ANSI_BELL) {
|
|
1885
|
+
return createControlParseResult(string.slice(index, sequenceIndex + 1), sequenceIndex + 1);
|
|
1886
|
+
}
|
|
1887
|
+
if (string[sequenceIndex] === ESCAPE && string[sequenceIndex + 1] === ANSI_OSC_TERMINATOR) {
|
|
1888
|
+
return createControlParseResult(string.slice(index, sequenceIndex + 2), sequenceIndex + 2);
|
|
1889
|
+
}
|
|
1890
|
+
if (string[sequenceIndex] === C1_STRING_TERMINATOR) {
|
|
1891
|
+
return createControlParseResult(string.slice(index, sequenceIndex + 1), sequenceIndex + 1);
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
return createControlParseResult(string.slice(index), string.length);
|
|
1895
|
+
}
|
|
1896
|
+
function parseAnsiCode(string, index) {
|
|
1897
|
+
const codePoint = string.codePointAt(index);
|
|
1898
|
+
if (codePoint === ESCAPE_CODE_POINT || codePoint === C1_OSC_CODE_POINT) {
|
|
1899
|
+
const hyperlinkCode = parseHyperlinkCode(string, index);
|
|
1900
|
+
if (hyperlinkCode) {
|
|
1901
|
+
return hyperlinkCode;
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
const controlStringCode = parseControlStringCode(string, index);
|
|
1905
|
+
if (controlStringCode) {
|
|
1906
|
+
return controlStringCode;
|
|
1907
|
+
}
|
|
1908
|
+
return parseCsiCode(string, index);
|
|
1909
|
+
}
|
|
1910
|
+
function appendTrailingAnsiTokens(string, index, tokens) {
|
|
1911
|
+
while (index < string.length) {
|
|
1912
|
+
const nextCodePoint = string.codePointAt(index);
|
|
1913
|
+
if (!ESCAPES.has(nextCodePoint)) {
|
|
1914
|
+
break;
|
|
1915
|
+
}
|
|
1916
|
+
const escapeCode = parseAnsiCode(string, index);
|
|
1917
|
+
if (!escapeCode) {
|
|
1918
|
+
break;
|
|
1919
|
+
}
|
|
1920
|
+
tokens.push(escapeCode.token);
|
|
1921
|
+
index = escapeCode.endIndex;
|
|
1922
|
+
}
|
|
1923
|
+
return index;
|
|
1924
|
+
}
|
|
1925
|
+
function parseCharacterTokenWithRawSegmentation(string, index, graphemeSegments) {
|
|
1926
|
+
const segment = graphemeSegments.containing(index);
|
|
1927
|
+
if (!segment || segment.index !== index) {
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
return {
|
|
1931
|
+
token: {
|
|
1932
|
+
type: "character",
|
|
1933
|
+
// Intentionally preserve UAX29 behavior (GB3): CRLF is one grapheme cluster.
|
|
1934
|
+
value: segment.segment,
|
|
1935
|
+
visibleWidth: getGraphemeWidth(segment.segment),
|
|
1936
|
+
isGraphemeContinuation: false
|
|
1937
|
+
},
|
|
1938
|
+
endIndex: index + segment.segment.length
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
function collectVisibleCharacters(string) {
|
|
1942
|
+
const visibleCharacters = [];
|
|
1943
|
+
let index = 0;
|
|
1944
|
+
while (index < string.length) {
|
|
1945
|
+
const codePoint = string.codePointAt(index);
|
|
1946
|
+
if (ESCAPES.has(codePoint)) {
|
|
1947
|
+
const code = parseAnsiCode(string, index);
|
|
1948
|
+
if (code) {
|
|
1949
|
+
index = code.endIndex;
|
|
1950
|
+
continue;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
const value = String.fromCodePoint(codePoint);
|
|
1954
|
+
visibleCharacters.push({
|
|
1955
|
+
value,
|
|
1956
|
+
visibleWidth: 1,
|
|
1957
|
+
isGraphemeContinuation: false
|
|
1958
|
+
});
|
|
1959
|
+
index += value.length;
|
|
1960
|
+
}
|
|
1961
|
+
return visibleCharacters;
|
|
1962
|
+
}
|
|
1963
|
+
function applyGraphemeMetadata(visibleCharacters) {
|
|
1964
|
+
if (visibleCharacters.length === 0) {
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
const visibleString = visibleCharacters.map(({ value }) => value).join("");
|
|
1968
|
+
const scalarOffsets = [];
|
|
1969
|
+
let scalarOffset = 0;
|
|
1970
|
+
for (const visibleCharacter of visibleCharacters) {
|
|
1971
|
+
scalarOffsets.push(scalarOffset);
|
|
1972
|
+
scalarOffset += visibleCharacter.value.length;
|
|
1973
|
+
}
|
|
1974
|
+
let scalarIndex = 0;
|
|
1975
|
+
for (const segment of GRAPHEME_SEGMENTER.segment(visibleString)) {
|
|
1976
|
+
while (scalarIndex < visibleCharacters.length && scalarOffsets[scalarIndex] < segment.index) {
|
|
1977
|
+
scalarIndex++;
|
|
1978
|
+
}
|
|
1979
|
+
let graphemeIndex = scalarIndex;
|
|
1980
|
+
let isFirstInGrapheme = true;
|
|
1981
|
+
while (graphemeIndex < visibleCharacters.length && scalarOffsets[graphemeIndex] < segment.index + segment.segment.length) {
|
|
1982
|
+
visibleCharacters[graphemeIndex].visibleWidth = isFirstInGrapheme ? getGraphemeWidth(segment.segment) : 0;
|
|
1983
|
+
visibleCharacters[graphemeIndex].isGraphemeContinuation = !isFirstInGrapheme;
|
|
1984
|
+
isFirstInGrapheme = false;
|
|
1985
|
+
graphemeIndex++;
|
|
1986
|
+
}
|
|
1987
|
+
scalarIndex = graphemeIndex;
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
function tokenizeAnsiWithVisibleSegmentation(string, { endCharacter = Number.POSITIVE_INFINITY } = {}) {
|
|
1991
|
+
const tokens = [];
|
|
1992
|
+
const visibleCharacters = collectVisibleCharacters(string);
|
|
1993
|
+
applyGraphemeMetadata(visibleCharacters);
|
|
1994
|
+
let index = 0;
|
|
1995
|
+
let visibleCharacterIndex = 0;
|
|
1996
|
+
let visibleCount = 0;
|
|
1997
|
+
while (index < string.length) {
|
|
1998
|
+
const codePoint = string.codePointAt(index);
|
|
1999
|
+
if (ESCAPES.has(codePoint)) {
|
|
2000
|
+
const code = parseAnsiCode(string, index);
|
|
2001
|
+
if (code) {
|
|
2002
|
+
tokens.push(code.token);
|
|
2003
|
+
index = code.endIndex;
|
|
2004
|
+
continue;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
const value = String.fromCodePoint(codePoint);
|
|
2008
|
+
const visibleCharacter = visibleCharacters[visibleCharacterIndex];
|
|
2009
|
+
let visibleWidth = isFullwidthCodePoint(codePoint) ? 2 : value.length;
|
|
2010
|
+
if (visibleCharacter) {
|
|
2011
|
+
visibleWidth = visibleCharacter.visibleWidth;
|
|
2012
|
+
}
|
|
2013
|
+
const token = {
|
|
2014
|
+
type: "character",
|
|
2015
|
+
value,
|
|
2016
|
+
visibleWidth,
|
|
2017
|
+
isGraphemeContinuation: visibleCharacter ? visibleCharacter.isGraphemeContinuation : false
|
|
2018
|
+
};
|
|
2019
|
+
tokens.push(token);
|
|
2020
|
+
index += value.length;
|
|
2021
|
+
visibleCharacterIndex++;
|
|
2022
|
+
visibleCount += token.visibleWidth;
|
|
2023
|
+
if (visibleCount >= endCharacter) {
|
|
2024
|
+
const nextVisibleCharacter = visibleCharacters[visibleCharacterIndex];
|
|
2025
|
+
if (!nextVisibleCharacter || !nextVisibleCharacter.isGraphemeContinuation) {
|
|
2026
|
+
index = appendTrailingAnsiTokens(string, index, tokens);
|
|
2027
|
+
break;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
return tokens;
|
|
2032
|
+
}
|
|
2033
|
+
function areValuesInSameGrapheme(leftValue, rightValue) {
|
|
2034
|
+
const pair = `${leftValue}${rightValue}`;
|
|
2035
|
+
const splitIndex = leftValue.length;
|
|
2036
|
+
for (const segment of GRAPHEME_SEGMENTER.segment(pair)) {
|
|
2037
|
+
if (segment.index === splitIndex) {
|
|
2038
|
+
return false;
|
|
2039
|
+
}
|
|
2040
|
+
if (segment.index > splitIndex) {
|
|
2041
|
+
return true;
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
return true;
|
|
2045
|
+
}
|
|
2046
|
+
function hasAnsiSplitContinuationAhead(string, startIndex, previousVisibleValue, graphemeSegments) {
|
|
2047
|
+
if (!previousVisibleValue) {
|
|
2048
|
+
return false;
|
|
2049
|
+
}
|
|
2050
|
+
let index = startIndex;
|
|
2051
|
+
let hasAnsiCode = false;
|
|
2052
|
+
while (index < string.length) {
|
|
2053
|
+
const codePoint = string.codePointAt(index);
|
|
2054
|
+
if (ESCAPES.has(codePoint)) {
|
|
2055
|
+
const code = parseAnsiCode(string, index);
|
|
2056
|
+
if (code) {
|
|
2057
|
+
hasAnsiCode = true;
|
|
2058
|
+
index = code.endIndex;
|
|
2059
|
+
continue;
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
if (!hasAnsiCode) {
|
|
2063
|
+
return false;
|
|
2064
|
+
}
|
|
2065
|
+
const characterToken = parseCharacterTokenWithRawSegmentation(string, index, graphemeSegments);
|
|
2066
|
+
if (!characterToken) {
|
|
2067
|
+
return true;
|
|
2068
|
+
}
|
|
2069
|
+
return areValuesInSameGrapheme(previousVisibleValue, characterToken.token.value);
|
|
2070
|
+
}
|
|
2071
|
+
return false;
|
|
2072
|
+
}
|
|
2073
|
+
function tokenizeAnsi(string, { endCharacter = Number.POSITIVE_INFINITY } = {}) {
|
|
2074
|
+
const tokens = [];
|
|
2075
|
+
const graphemeSegments = GRAPHEME_SEGMENTER.segment(string);
|
|
2076
|
+
let index = 0;
|
|
2077
|
+
let visibleCount = 0;
|
|
2078
|
+
let previousVisibleValue;
|
|
2079
|
+
let hasAnsiSinceLastVisible = false;
|
|
2080
|
+
while (index < string.length) {
|
|
2081
|
+
const codePoint = string.codePointAt(index);
|
|
2082
|
+
if (ESCAPES.has(codePoint)) {
|
|
2083
|
+
const code = parseAnsiCode(string, index);
|
|
2084
|
+
if (code) {
|
|
2085
|
+
tokens.push(code.token);
|
|
2086
|
+
index = code.endIndex;
|
|
2087
|
+
hasAnsiSinceLastVisible = true;
|
|
2088
|
+
continue;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
const characterToken = parseCharacterTokenWithRawSegmentation(string, index, graphemeSegments);
|
|
2092
|
+
if (!characterToken) {
|
|
2093
|
+
return tokenizeAnsiWithVisibleSegmentation(string, { endCharacter });
|
|
2094
|
+
}
|
|
2095
|
+
if (hasAnsiSinceLastVisible && previousVisibleValue && areValuesInSameGrapheme(previousVisibleValue, characterToken.token.value)) {
|
|
2096
|
+
return tokenizeAnsiWithVisibleSegmentation(string, { endCharacter });
|
|
2097
|
+
}
|
|
2098
|
+
tokens.push(characterToken.token);
|
|
2099
|
+
index = characterToken.endIndex;
|
|
2100
|
+
visibleCount += characterToken.token.visibleWidth;
|
|
2101
|
+
hasAnsiSinceLastVisible = false;
|
|
2102
|
+
previousVisibleValue = characterToken.token.value;
|
|
2103
|
+
if (visibleCount >= endCharacter) {
|
|
2104
|
+
if (hasAnsiSplitContinuationAhead(string, index, previousVisibleValue, graphemeSegments)) {
|
|
2105
|
+
return tokenizeAnsiWithVisibleSegmentation(string, { endCharacter });
|
|
2106
|
+
}
|
|
2107
|
+
index = appendTrailingAnsiTokens(string, index, tokens);
|
|
2108
|
+
break;
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
return tokens;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
// dl-2.1.271-output/deps/node_modules/slice-ansi/index.js
|
|
2115
|
+
function applySgrFragments(activeStyles, fragments) {
|
|
2116
|
+
for (const fragment of fragments) {
|
|
2117
|
+
switch (fragment.type) {
|
|
2118
|
+
case "reset": {
|
|
2119
|
+
activeStyles.clear();
|
|
2120
|
+
break;
|
|
2121
|
+
}
|
|
2122
|
+
case "end": {
|
|
2123
|
+
activeStyles.delete(fragment.endCode);
|
|
2124
|
+
break;
|
|
2125
|
+
}
|
|
2126
|
+
case "start": {
|
|
2127
|
+
activeStyles.delete(fragment.endCode);
|
|
2128
|
+
activeStyles.set(fragment.endCode, fragment.code);
|
|
2129
|
+
break;
|
|
2130
|
+
}
|
|
2131
|
+
default: {
|
|
2132
|
+
break;
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
return activeStyles;
|
|
2137
|
+
}
|
|
2138
|
+
function undoAnsiCodes(activeStyles) {
|
|
2139
|
+
return [...activeStyles.keys()].toReversed().join("");
|
|
2140
|
+
}
|
|
2141
|
+
function closeHyperlink(hyperlinkToken) {
|
|
2142
|
+
return `${hyperlinkToken.closePrefix}${hyperlinkToken.terminator}`;
|
|
2143
|
+
}
|
|
2144
|
+
function shouldIncludeSgrAfterEnd(token, activeStyles) {
|
|
2145
|
+
let hasStartFragment = false;
|
|
2146
|
+
let hasClosingEffect = false;
|
|
2147
|
+
for (const fragment of token.fragments) {
|
|
2148
|
+
if (fragment.type === "start") {
|
|
2149
|
+
hasStartFragment = true;
|
|
2150
|
+
continue;
|
|
2151
|
+
}
|
|
2152
|
+
if (fragment.type === "reset" && activeStyles.size > 0) {
|
|
2153
|
+
hasClosingEffect = true;
|
|
2154
|
+
continue;
|
|
2155
|
+
}
|
|
2156
|
+
if (fragment.type === "end" && activeStyles.has(fragment.endCode)) {
|
|
2157
|
+
hasClosingEffect = true;
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
return hasClosingEffect && !hasStartFragment;
|
|
2161
|
+
}
|
|
2162
|
+
function hasSgrStartFragment(token) {
|
|
2163
|
+
return token.fragments.some((fragment) => fragment.type === "start");
|
|
2164
|
+
}
|
|
2165
|
+
function discardPendingHyperlink(parameters) {
|
|
2166
|
+
if (parameters.activeHyperlink && !parameters.activeHyperlinkHasVisibleText && parameters.activeHyperlinkOutputIndex !== void 0) {
|
|
2167
|
+
const openCodeLength = parameters.activeHyperlink.code.length;
|
|
2168
|
+
parameters.returnValue = parameters.returnValue.slice(0, parameters.activeHyperlinkOutputIndex) + parameters.returnValue.slice(parameters.activeHyperlinkOutputIndex + openCodeLength);
|
|
2169
|
+
if (parameters.pendingSgrOutputIndex !== void 0 && parameters.pendingSgrOutputIndex > parameters.activeHyperlinkOutputIndex) {
|
|
2170
|
+
parameters.pendingSgrOutputIndex -= openCodeLength;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
parameters.activeHyperlink = void 0;
|
|
2174
|
+
parameters.activeHyperlinkHasVisibleText = false;
|
|
2175
|
+
parameters.activeHyperlinkOutputIndex = void 0;
|
|
2176
|
+
}
|
|
2177
|
+
function applySgrToken(parameters) {
|
|
2178
|
+
if (parameters.isPastEnd && !shouldIncludeSgrAfterEnd(parameters.token, parameters.activeStyles)) {
|
|
2179
|
+
return parameters;
|
|
2180
|
+
}
|
|
2181
|
+
if (parameters.include && hasSgrStartFragment(parameters.token) && parameters.pendingSgrOutputIndex === void 0) {
|
|
2182
|
+
parameters.pendingSgrOutputIndex = parameters.returnValue.length;
|
|
2183
|
+
parameters.pendingSgrActiveStyles = new Map(parameters.activeStyles);
|
|
2184
|
+
}
|
|
2185
|
+
parameters.activeStyles = applySgrFragments(parameters.activeStyles, parameters.token.fragments);
|
|
2186
|
+
if (parameters.include) {
|
|
2187
|
+
parameters.returnValue += parameters.token.code;
|
|
2188
|
+
}
|
|
2189
|
+
return parameters;
|
|
2190
|
+
}
|
|
2191
|
+
function applyHyperlinkToken(parameters) {
|
|
2192
|
+
if (parameters.isPastEnd && (parameters.token.action !== "close" || !parameters.activeHyperlink)) {
|
|
2193
|
+
return parameters;
|
|
2194
|
+
}
|
|
2195
|
+
if (parameters.token.action === "open") {
|
|
2196
|
+
parameters.activeHyperlink = parameters.token;
|
|
2197
|
+
parameters.activeHyperlinkHasVisibleText = false;
|
|
2198
|
+
parameters.activeHyperlinkOutputIndex = void 0;
|
|
2199
|
+
if (parameters.include) {
|
|
2200
|
+
parameters.activeHyperlinkOutputIndex = parameters.returnValue.length;
|
|
2201
|
+
}
|
|
2202
|
+
} else if (parameters.token.action === "close") {
|
|
2203
|
+
if (parameters.include && parameters.activeHyperlink && !parameters.activeHyperlinkHasVisibleText) {
|
|
2204
|
+
discardPendingHyperlink(parameters);
|
|
2205
|
+
return parameters;
|
|
2206
|
+
}
|
|
2207
|
+
parameters.activeHyperlink = void 0;
|
|
2208
|
+
parameters.activeHyperlinkHasVisibleText = false;
|
|
2209
|
+
parameters.activeHyperlinkOutputIndex = void 0;
|
|
2210
|
+
}
|
|
2211
|
+
if (parameters.include) {
|
|
2212
|
+
parameters.returnValue += parameters.token.code;
|
|
2213
|
+
}
|
|
2214
|
+
return parameters;
|
|
2215
|
+
}
|
|
2216
|
+
function applyControlToken(parameters) {
|
|
2217
|
+
if (!parameters.isPastEnd && parameters.include) {
|
|
2218
|
+
parameters.returnValue += parameters.token.code;
|
|
2219
|
+
}
|
|
2220
|
+
return parameters;
|
|
2221
|
+
}
|
|
2222
|
+
function applyCharacterToken(parameters) {
|
|
2223
|
+
if (!parameters.include && parameters.position >= parameters.start && !parameters.token.isGraphemeContinuation) {
|
|
2224
|
+
parameters.include = true;
|
|
2225
|
+
parameters.returnValue = [...parameters.activeStyles.values()].join("");
|
|
2226
|
+
if (parameters.activeHyperlink) {
|
|
2227
|
+
parameters.activeHyperlinkOutputIndex = parameters.returnValue.length;
|
|
2228
|
+
parameters.returnValue += parameters.activeHyperlink.code;
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
if (parameters.include) {
|
|
2232
|
+
parameters.returnValue += parameters.token.value;
|
|
2233
|
+
parameters.pendingSgrOutputIndex = void 0;
|
|
2234
|
+
parameters.pendingSgrActiveStyles = void 0;
|
|
2235
|
+
if (parameters.activeHyperlink) {
|
|
2236
|
+
parameters.activeHyperlinkHasVisibleText = true;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
parameters.position += parameters.token.visibleWidth;
|
|
2240
|
+
return parameters;
|
|
2241
|
+
}
|
|
2242
|
+
var tokenHandlers = {
|
|
2243
|
+
sgr: applySgrToken,
|
|
2244
|
+
hyperlink: applyHyperlinkToken,
|
|
2245
|
+
control: applyControlToken,
|
|
2246
|
+
character: applyCharacterToken
|
|
2247
|
+
};
|
|
2248
|
+
function applyToken(parameters) {
|
|
2249
|
+
const tokenHandler = tokenHandlers[parameters.token.type];
|
|
2250
|
+
if (!tokenHandler) {
|
|
2251
|
+
return parameters;
|
|
2252
|
+
}
|
|
2253
|
+
return tokenHandler(parameters);
|
|
2254
|
+
}
|
|
2255
|
+
function createHasContinuationAheadMap(tokens) {
|
|
2256
|
+
const hasContinuationAhead = Array.from({ length: tokens.length }, () => false);
|
|
2257
|
+
let nextCharacterIsContinuation = false;
|
|
2258
|
+
for (let tokenIndex = tokens.length - 1; tokenIndex >= 0; tokenIndex--) {
|
|
2259
|
+
const token = tokens[tokenIndex];
|
|
2260
|
+
hasContinuationAhead[tokenIndex] = nextCharacterIsContinuation;
|
|
2261
|
+
if (token.type === "character") {
|
|
2262
|
+
nextCharacterIsContinuation = Boolean(token.isGraphemeContinuation);
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
return hasContinuationAhead;
|
|
2266
|
+
}
|
|
2267
|
+
function isPastEndBoundary(token, position, end) {
|
|
2268
|
+
if (end === void 0) {
|
|
2269
|
+
return false;
|
|
2270
|
+
}
|
|
2271
|
+
if (position >= end) {
|
|
2272
|
+
return true;
|
|
2273
|
+
}
|
|
2274
|
+
return token.type === "character" && !token.isGraphemeContinuation && position + token.visibleWidth > end;
|
|
2275
|
+
}
|
|
2276
|
+
function sliceAnsi(string, start, end) {
|
|
2277
|
+
const tokens = tokenizeAnsi(string, { endCharacter: end });
|
|
2278
|
+
const hasContinuationAhead = createHasContinuationAheadMap(tokens);
|
|
2279
|
+
let activeStyles = /* @__PURE__ */ new Map();
|
|
2280
|
+
let activeHyperlink;
|
|
2281
|
+
let activeHyperlinkHasVisibleText = false;
|
|
2282
|
+
let activeHyperlinkOutputIndex;
|
|
2283
|
+
let pendingSgrOutputIndex;
|
|
2284
|
+
let pendingSgrActiveStyles;
|
|
2285
|
+
let position = 0;
|
|
2286
|
+
let returnValue = "";
|
|
2287
|
+
let include = false;
|
|
2288
|
+
for (const [tokenIndex, token] of tokens.entries()) {
|
|
2289
|
+
let isPastEnd = isPastEndBoundary(token, position, end);
|
|
2290
|
+
if (isPastEnd && token.type !== "character" && hasContinuationAhead[tokenIndex]) {
|
|
2291
|
+
isPastEnd = false;
|
|
2292
|
+
}
|
|
2293
|
+
if (isPastEnd && token.type === "character" && !token.isGraphemeContinuation) {
|
|
2294
|
+
if (activeHyperlink && !activeHyperlinkHasVisibleText) {
|
|
2295
|
+
const hyperlinkState = {
|
|
2296
|
+
activeHyperlink,
|
|
2297
|
+
activeHyperlinkHasVisibleText,
|
|
2298
|
+
activeHyperlinkOutputIndex,
|
|
2299
|
+
pendingSgrOutputIndex,
|
|
2300
|
+
returnValue
|
|
2301
|
+
};
|
|
2302
|
+
discardPendingHyperlink(hyperlinkState);
|
|
2303
|
+
({
|
|
2304
|
+
activeHyperlink,
|
|
2305
|
+
activeHyperlinkHasVisibleText,
|
|
2306
|
+
activeHyperlinkOutputIndex,
|
|
2307
|
+
pendingSgrOutputIndex,
|
|
2308
|
+
returnValue
|
|
2309
|
+
} = hyperlinkState);
|
|
2310
|
+
}
|
|
2311
|
+
if (pendingSgrOutputIndex !== void 0) {
|
|
2312
|
+
returnValue = returnValue.slice(0, pendingSgrOutputIndex);
|
|
2313
|
+
activeStyles = pendingSgrActiveStyles;
|
|
2314
|
+
pendingSgrOutputIndex = void 0;
|
|
2315
|
+
pendingSgrActiveStyles = void 0;
|
|
2316
|
+
}
|
|
2317
|
+
break;
|
|
2318
|
+
}
|
|
2319
|
+
({ activeStyles, activeHyperlink, activeHyperlinkHasVisibleText, activeHyperlinkOutputIndex, pendingSgrOutputIndex, pendingSgrActiveStyles, position, returnValue, include } = applyToken({
|
|
2320
|
+
token,
|
|
2321
|
+
isPastEnd,
|
|
2322
|
+
start,
|
|
2323
|
+
activeStyles,
|
|
2324
|
+
activeHyperlink,
|
|
2325
|
+
activeHyperlinkHasVisibleText,
|
|
2326
|
+
activeHyperlinkOutputIndex,
|
|
2327
|
+
pendingSgrOutputIndex,
|
|
2328
|
+
pendingSgrActiveStyles,
|
|
2329
|
+
position,
|
|
2330
|
+
returnValue,
|
|
2331
|
+
include
|
|
2332
|
+
}));
|
|
2333
|
+
}
|
|
2334
|
+
if (!include) {
|
|
2335
|
+
return "";
|
|
2336
|
+
}
|
|
2337
|
+
if (activeHyperlink) {
|
|
2338
|
+
returnValue += closeHyperlink(activeHyperlink);
|
|
2339
|
+
}
|
|
2340
|
+
returnValue += undoAnsiCodes(activeStyles);
|
|
2341
|
+
return returnValue;
|
|
2342
|
+
}
|
|
2343
|
+
return __toCommonJS(slice_entry_exports);
|
|
2344
|
+
})();
|
|
2345
|
+
module.exports.sliceAnsi = __ccAnsiSlice.sliceAnsi;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometix/claude-code",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.272",
|
|
4
4
|
"bin": {
|
|
5
5
|
"claude": "cli.js"
|
|
6
6
|
},
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
"smol-toml": "^1.8.0"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@cometix/claude-code-darwin-arm64": "2.1.
|
|
35
|
-
"@cometix/claude-code-darwin-x64": "2.1.
|
|
36
|
-
"@cometix/claude-code-linux-arm64": "2.1.
|
|
37
|
-
"@cometix/claude-code-linux-x64": "2.1.
|
|
38
|
-
"@cometix/claude-code-linux-arm64-musl": "2.1.
|
|
39
|
-
"@cometix/claude-code-linux-x64-musl": "2.1.
|
|
40
|
-
"@cometix/claude-code-win32-arm64": "2.1.
|
|
41
|
-
"@cometix/claude-code-win32-x64": "2.1.
|
|
42
|
-
"@cometix/claude-code-android-arm64": "2.1.
|
|
43
|
-
"@img/sharp-darwin-arm64": "
|
|
44
|
-
"@img/sharp-darwin-x64": "
|
|
45
|
-
"@img/sharp-linux-arm": "
|
|
46
|
-
"@img/sharp-linux-arm64": "
|
|
47
|
-
"@img/sharp-linux-x64": "
|
|
48
|
-
"@img/sharp-linuxmusl-arm64": "
|
|
49
|
-
"@img/sharp-linuxmusl-x64": "
|
|
50
|
-
"@img/sharp-win32-arm64": "
|
|
51
|
-
"@img/sharp-win32-x64": "
|
|
34
|
+
"@cometix/claude-code-darwin-arm64": "2.1.272",
|
|
35
|
+
"@cometix/claude-code-darwin-x64": "2.1.272",
|
|
36
|
+
"@cometix/claude-code-linux-arm64": "2.1.272",
|
|
37
|
+
"@cometix/claude-code-linux-x64": "2.1.272",
|
|
38
|
+
"@cometix/claude-code-linux-arm64-musl": "2.1.272",
|
|
39
|
+
"@cometix/claude-code-linux-x64-musl": "2.1.272",
|
|
40
|
+
"@cometix/claude-code-win32-arm64": "2.1.272",
|
|
41
|
+
"@cometix/claude-code-win32-x64": "2.1.272",
|
|
42
|
+
"@cometix/claude-code-android-arm64": "2.1.272",
|
|
43
|
+
"@img/sharp-darwin-arm64": "0.34.5",
|
|
44
|
+
"@img/sharp-darwin-x64": "0.34.5",
|
|
45
|
+
"@img/sharp-linux-arm": "0.34.5",
|
|
46
|
+
"@img/sharp-linux-arm64": "0.34.5",
|
|
47
|
+
"@img/sharp-linux-x64": "0.34.5",
|
|
48
|
+
"@img/sharp-linuxmusl-arm64": "0.34.5",
|
|
49
|
+
"@img/sharp-linuxmusl-x64": "0.34.5",
|
|
50
|
+
"@img/sharp-win32-arm64": "0.34.5",
|
|
51
|
+
"@img/sharp-win32-x64": "0.34.5"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"cli.js",
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
"sdk-tools.d.ts",
|
|
58
58
|
"chunk-*.js",
|
|
59
59
|
"bun-polyfill.mjs",
|
|
60
|
+
"bun-image-compat.cjs",
|
|
61
|
+
"bun-sharp-compat.cjs",
|
|
62
|
+
"bun-transpiler-compat.cjs",
|
|
63
|
+
"node-fetch-compat.mjs",
|
|
60
64
|
"src/",
|
|
61
65
|
"vendor/"
|
|
62
66
|
]
|
package/sdk-tools.d.ts
CHANGED
|
@@ -2910,13 +2910,9 @@ export interface MonitorInput {
|
|
|
2910
2910
|
*/
|
|
2911
2911
|
description: string;
|
|
2912
2912
|
/**
|
|
2913
|
-
* Kill the monitor after this deadline. Default 300000ms
|
|
2913
|
+
* Kill the monitor after this deadline. Default 300000ms. Deadlines above 1800000ms are capped to 1800000ms. You are notified at expiry and can re-arm.
|
|
2914
2914
|
*/
|
|
2915
2915
|
timeout_ms: number;
|
|
2916
|
-
/**
|
|
2917
|
-
* Run for the lifetime of the session (no timeout). Use for session-length watches like PR monitoring or log tails. Stop with TaskStop.
|
|
2918
|
-
*/
|
|
2919
|
-
persistent: boolean;
|
|
2920
2916
|
/**
|
|
2921
2917
|
* Shell command or script. Each stdout line is an event; exit ends the watch.
|
|
2922
2918
|
*/
|
|
@@ -3092,7 +3088,7 @@ export interface ProposeGoalInput {
|
|
|
3092
3088
|
}
|
|
3093
3089
|
export interface ArtifactInput {
|
|
3094
3090
|
/**
|
|
3095
|
-
* Omit (or 'publish') to publish file_path. 'list' enumerates artifacts — the user's own by default, see `scope`; only `limit` and `scope` may accompany it. 'read' returns the content of the published artifact at `url` (raw HTML for the user's own; an isolated summary, steered by the optional `prompt`, for one shared with them, though a page published in this session's own Slack channel can come back in full as untrusted content) — see **
|
|
3091
|
+
* Omit (or 'publish') to publish file_path. 'list' enumerates artifacts — the user's own by default, see `scope`; only `limit` and `scope` may accompany it. 'read' returns the content of the published artifact at `url` (raw HTML for the user's own; an isolated summary, steered by the optional `prompt`, for one shared with them, though a page published in this session's own Slack channel can come back in full as untrusted content) — see **Calls**. 'watch', 'unwatch', and 'status' manage live-update subscriptions that notify a session when an artifact is republished elsewhere, and those aren't available in this session: 'watch' only reports that — no republish notification reaches this session — and 'status' lists this session's artifact watches (pass `url` to check one). 'upload_asset' adds one local media, PDF, font, or text file to an existing artifact — pass `url` and `file_path`. 'list_assets' lists the files in an artifact's asset store (pass `url`; `after` continues a listing), 'read_asset' saves one of them to a local file named by its id (pass `url` and `asset_id`, optionally `out_dir`), and 'delete_asset' permanently removes one (pass `url` and `asset_id`). See **Artifact assets** above.
|
|
3096
3092
|
*/
|
|
3097
3093
|
action?:
|
|
3098
3094
|
| "publish"
|
|
@@ -3151,7 +3147,7 @@ export interface ArtifactInput {
|
|
|
3151
3147
|
*/
|
|
3152
3148
|
force?: boolean;
|
|
3153
3149
|
/**
|
|
3154
|
-
* read_asset: directory to save
|
|
3150
|
+
* read_asset: directory to save into — default: this artifact’s folder in your scratchpad directory, where saving needs no approval and which you can Read from. read_asset names the file by the asset id plus the extension for its type; saving to any directory other than the default is an ordinary file save the user may be asked to approve.
|
|
3155
3151
|
*/
|
|
3156
3152
|
out_dir?: string;
|
|
3157
3153
|
/**
|