bitfab-cli 0.2.387 → 0.2.389
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +158 -436
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5093,34 +5093,15 @@ var require_data = __commonJS({
|
|
|
5093
5093
|
}
|
|
5094
5094
|
});
|
|
5095
5095
|
|
|
5096
|
-
// ../node_modules/.pnpm/fast-uri@3.1.
|
|
5096
|
+
// ../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js
|
|
5097
5097
|
var require_utils = __commonJS({
|
|
5098
|
-
"../node_modules/.pnpm/fast-uri@3.1.
|
|
5098
|
+
"../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js"(exports, module) {
|
|
5099
5099
|
"use strict";
|
|
5100
5100
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
5101
5101
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
5102
|
-
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
5103
5102
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
5104
5103
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
5105
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[
|
|
5106
|
-
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
5107
|
-
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
5108
|
-
var BYTE_HEX = new Array(256);
|
|
5109
|
-
{
|
|
5110
|
-
const HEX_DIGITS = "0123456789ABCDEF";
|
|
5111
|
-
for (let i = 0; i < 256; i++) {
|
|
5112
|
-
BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
|
|
5113
|
-
}
|
|
5114
|
-
}
|
|
5115
|
-
function percentEncodeNonAscii(cp) {
|
|
5116
|
-
if (cp < 2048) {
|
|
5117
|
-
return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
5118
|
-
}
|
|
5119
|
-
if (cp < 65536) {
|
|
5120
|
-
return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
5121
|
-
}
|
|
5122
|
-
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
5123
|
-
}
|
|
5104
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
|
|
5124
5105
|
function stringArrayToHexStripped(input) {
|
|
5125
5106
|
let acc = "";
|
|
5126
5107
|
let code2 = 0;
|
|
@@ -5145,105 +5126,91 @@ var require_utils = __commonJS({
|
|
|
5145
5126
|
}
|
|
5146
5127
|
return acc;
|
|
5147
5128
|
}
|
|
5148
|
-
var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
5149
|
-
var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
5150
|
-
var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
5151
5129
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
5152
|
-
function
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5130
|
+
function consumeIsZone(buffer) {
|
|
5131
|
+
buffer.length = 0;
|
|
5132
|
+
return true;
|
|
5133
|
+
}
|
|
5134
|
+
function consumeHextets(buffer, address, output) {
|
|
5135
|
+
if (buffer.length) {
|
|
5136
|
+
const hex3 = stringArrayToHexStripped(buffer);
|
|
5137
|
+
if (hex3 !== "") {
|
|
5138
|
+
address.push(hex3);
|
|
5139
|
+
} else {
|
|
5140
|
+
output.error = true;
|
|
5141
|
+
return false;
|
|
5159
5142
|
}
|
|
5160
|
-
|
|
5143
|
+
buffer.length = 0;
|
|
5161
5144
|
}
|
|
5162
5145
|
return true;
|
|
5163
5146
|
}
|
|
5164
|
-
function
|
|
5165
|
-
let
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5147
|
+
function getIPV6(input) {
|
|
5148
|
+
let tokenCount = 0;
|
|
5149
|
+
const output = { error: false, address: "", zone: "" };
|
|
5150
|
+
const address = [];
|
|
5151
|
+
const buffer = [];
|
|
5152
|
+
let endipv6Encountered = false;
|
|
5153
|
+
let endIpv6 = false;
|
|
5154
|
+
let consume = consumeHextets;
|
|
5155
|
+
for (let i = 0; i < input.length; i++) {
|
|
5156
|
+
const cursor = input[i];
|
|
5157
|
+
if (cursor === "[" || cursor === "]") {
|
|
5158
|
+
continue;
|
|
5159
|
+
}
|
|
5160
|
+
if (cursor === ":") {
|
|
5161
|
+
if (endipv6Encountered === true) {
|
|
5162
|
+
endIpv6 = true;
|
|
5163
|
+
}
|
|
5164
|
+
if (!consume(buffer, address, output)) {
|
|
5165
|
+
break;
|
|
5166
|
+
}
|
|
5167
|
+
if (++tokenCount > 7) {
|
|
5168
|
+
output.error = true;
|
|
5169
|
+
break;
|
|
5176
5170
|
}
|
|
5171
|
+
if (i > 0 && input[i - 1] === ":") {
|
|
5172
|
+
endipv6Encountered = true;
|
|
5173
|
+
}
|
|
5174
|
+
address.push(":");
|
|
5175
|
+
continue;
|
|
5176
|
+
} else if (cursor === "%") {
|
|
5177
|
+
if (!consume(buffer, address, output)) {
|
|
5178
|
+
break;
|
|
5179
|
+
}
|
|
5180
|
+
consume = consumeIsZone;
|
|
5177
5181
|
} else {
|
|
5178
|
-
|
|
5179
|
-
runLength = 0;
|
|
5180
|
-
}
|
|
5181
|
-
}
|
|
5182
|
-
if (bestLength < 2) return hextets.join(":");
|
|
5183
|
-
const head = hextets.slice(0, bestStart).join(":");
|
|
5184
|
-
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
5185
|
-
return head + "::" + tail;
|
|
5186
|
-
}
|
|
5187
|
-
function normalizeIPv6Address(input) {
|
|
5188
|
-
const compression = input.indexOf("::");
|
|
5189
|
-
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
|
|
5190
|
-
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
5191
|
-
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
5192
|
-
if (compression !== -1) {
|
|
5193
|
-
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
5194
|
-
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
5195
|
-
}
|
|
5196
|
-
const parts = left.concat(right);
|
|
5197
|
-
let hextetCount = 0;
|
|
5198
|
-
for (let i = 0; i < parts.length; i++) {
|
|
5199
|
-
const part = parts[i];
|
|
5200
|
-
if (part === "") return void 0;
|
|
5201
|
-
if (part.indexOf(".") !== -1) {
|
|
5202
|
-
if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
5203
|
-
hextetCount += 2;
|
|
5182
|
+
buffer.push(cursor);
|
|
5204
5183
|
continue;
|
|
5205
5184
|
}
|
|
5206
|
-
if (!isHextet(part)) return void 0;
|
|
5207
|
-
parts[i] = parseInt(part, 16).toString(16);
|
|
5208
|
-
hextetCount++;
|
|
5209
5185
|
}
|
|
5210
|
-
if (
|
|
5211
|
-
if (
|
|
5212
|
-
|
|
5186
|
+
if (buffer.length) {
|
|
5187
|
+
if (consume === consumeIsZone) {
|
|
5188
|
+
output.zone = buffer.join("");
|
|
5189
|
+
} else if (endIpv6) {
|
|
5190
|
+
address.push(buffer.join(""));
|
|
5191
|
+
} else {
|
|
5192
|
+
address.push(stringArrayToHexStripped(buffer));
|
|
5193
|
+
}
|
|
5213
5194
|
}
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
for (let i = hextetCount; i < 8; i++) expanded.push("0");
|
|
5217
|
-
for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
|
|
5218
|
-
return compressIPv6ZeroRun(expanded);
|
|
5195
|
+
output.address = address.join("");
|
|
5196
|
+
return output;
|
|
5219
5197
|
}
|
|
5220
5198
|
function normalizeIPv6(host) {
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
if (
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
5237
|
-
if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
|
|
5238
|
-
input = input.slice(0, zoneSeparator);
|
|
5239
|
-
}
|
|
5240
|
-
const address = normalizeIPv6Address(input);
|
|
5241
|
-
if (address === void 0) return { host, isIPV6: false, error: true };
|
|
5242
|
-
return {
|
|
5243
|
-
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
5244
|
-
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
5245
|
-
isIPV6: true
|
|
5246
|
-
};
|
|
5199
|
+
if (findToken(host, ":") < 2) {
|
|
5200
|
+
return { host, isIPV6: false };
|
|
5201
|
+
}
|
|
5202
|
+
const ipv63 = getIPV6(host);
|
|
5203
|
+
if (!ipv63.error) {
|
|
5204
|
+
let newHost = ipv63.address;
|
|
5205
|
+
let escapedHost = ipv63.address;
|
|
5206
|
+
if (ipv63.zone) {
|
|
5207
|
+
newHost += "%" + ipv63.zone;
|
|
5208
|
+
escapedHost += "%25" + ipv63.zone;
|
|
5209
|
+
}
|
|
5210
|
+
return { host: newHost, isIPV6: true, escapedHost };
|
|
5211
|
+
} else {
|
|
5212
|
+
return { host, isIPV6: false };
|
|
5213
|
+
}
|
|
5247
5214
|
}
|
|
5248
5215
|
function findToken(str, token) {
|
|
5249
5216
|
let ind = 0;
|
|
@@ -5362,8 +5329,7 @@ var require_utils = __commonJS({
|
|
|
5362
5329
|
function normalizePathEncoding(input) {
|
|
5363
5330
|
let output = "";
|
|
5364
5331
|
for (let i = 0; i < input.length; i++) {
|
|
5365
|
-
|
|
5366
|
-
if (ch === "%" && i + 2 < input.length) {
|
|
5332
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
5367
5333
|
const hex3 = input.slice(i + 1, i + 3);
|
|
5368
5334
|
if (isHexPair(hex3)) {
|
|
5369
5335
|
const normalizedHex = hex3.toUpperCase();
|
|
@@ -5377,152 +5343,10 @@ var require_utils = __commonJS({
|
|
|
5377
5343
|
continue;
|
|
5378
5344
|
}
|
|
5379
5345
|
}
|
|
5380
|
-
if (isPathCharacter(
|
|
5381
|
-
output +=
|
|
5346
|
+
if (isPathCharacter(input[i])) {
|
|
5347
|
+
output += input[i];
|
|
5382
5348
|
} else {
|
|
5383
|
-
|
|
5384
|
-
if (code2 < 128) {
|
|
5385
|
-
output += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
|
|
5386
|
-
} else if (code2 < 55296 || code2 > 57343) {
|
|
5387
|
-
output += percentEncodeNonAscii(code2);
|
|
5388
|
-
} else if (code2 <= 56319 && i + 1 < input.length) {
|
|
5389
|
-
const low = input.charCodeAt(i + 1);
|
|
5390
|
-
if (low >= 56320 && low <= 57343) {
|
|
5391
|
-
output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
5392
|
-
i++;
|
|
5393
|
-
} else {
|
|
5394
|
-
output += percentEncodeNonAscii(65533);
|
|
5395
|
-
}
|
|
5396
|
-
} else {
|
|
5397
|
-
output += percentEncodeNonAscii(65533);
|
|
5398
|
-
}
|
|
5399
|
-
}
|
|
5400
|
-
}
|
|
5401
|
-
return output;
|
|
5402
|
-
}
|
|
5403
|
-
function serializePathEncoding(input, pathNoScheme = false) {
|
|
5404
|
-
let output = "";
|
|
5405
|
-
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
5406
|
-
for (let i = 0; i < input.length; i++) {
|
|
5407
|
-
const ch = input[i];
|
|
5408
|
-
if (ch === "%" && i + 2 < input.length) {
|
|
5409
|
-
const hex3 = input.slice(i + 1, i + 3);
|
|
5410
|
-
if (isHexPair(hex3)) {
|
|
5411
|
-
output += "%" + hex3.toUpperCase();
|
|
5412
|
-
i += 2;
|
|
5413
|
-
continue;
|
|
5414
|
-
}
|
|
5415
|
-
}
|
|
5416
|
-
if (ch === "/") {
|
|
5417
|
-
firstSegment = false;
|
|
5418
|
-
}
|
|
5419
|
-
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
|
|
5420
|
-
output += ch;
|
|
5421
|
-
} else {
|
|
5422
|
-
const code2 = input.charCodeAt(i);
|
|
5423
|
-
if (code2 < 128) {
|
|
5424
|
-
output += BYTE_HEX[code2];
|
|
5425
|
-
} else if (code2 < 55296 || code2 > 57343) {
|
|
5426
|
-
output += percentEncodeNonAscii(code2);
|
|
5427
|
-
} else if (code2 <= 56319 && i + 1 < input.length) {
|
|
5428
|
-
const low = input.charCodeAt(i + 1);
|
|
5429
|
-
if (low >= 56320 && low <= 57343) {
|
|
5430
|
-
output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
5431
|
-
i++;
|
|
5432
|
-
} else {
|
|
5433
|
-
output += percentEncodeNonAscii(65533);
|
|
5434
|
-
}
|
|
5435
|
-
} else {
|
|
5436
|
-
output += percentEncodeNonAscii(65533);
|
|
5437
|
-
}
|
|
5438
|
-
}
|
|
5439
|
-
}
|
|
5440
|
-
return output;
|
|
5441
|
-
}
|
|
5442
|
-
function encodeComponent(input, isAllowed) {
|
|
5443
|
-
let output = "";
|
|
5444
|
-
for (let i = 0; i < input.length; i++) {
|
|
5445
|
-
const ch = input[i];
|
|
5446
|
-
if (ch === "%" && i + 2 < input.length) {
|
|
5447
|
-
const hex3 = input.slice(i + 1, i + 3);
|
|
5448
|
-
if (isHexPair(hex3)) {
|
|
5449
|
-
output += "%" + hex3.toUpperCase();
|
|
5450
|
-
i += 2;
|
|
5451
|
-
continue;
|
|
5452
|
-
}
|
|
5453
|
-
}
|
|
5454
|
-
if (isAllowed(ch)) {
|
|
5455
|
-
output += ch;
|
|
5456
|
-
} else {
|
|
5457
|
-
const code2 = input.charCodeAt(i);
|
|
5458
|
-
if (code2 < 128) {
|
|
5459
|
-
output += BYTE_HEX[code2];
|
|
5460
|
-
} else if (code2 < 55296 || code2 > 57343) {
|
|
5461
|
-
output += percentEncodeNonAscii(code2);
|
|
5462
|
-
} else if (code2 <= 56319 && i + 1 < input.length) {
|
|
5463
|
-
const low = input.charCodeAt(i + 1);
|
|
5464
|
-
if (low >= 56320 && low <= 57343) {
|
|
5465
|
-
output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
5466
|
-
i++;
|
|
5467
|
-
} else {
|
|
5468
|
-
output += percentEncodeNonAscii(65533);
|
|
5469
|
-
}
|
|
5470
|
-
} else {
|
|
5471
|
-
output += percentEncodeNonAscii(65533);
|
|
5472
|
-
}
|
|
5473
|
-
}
|
|
5474
|
-
}
|
|
5475
|
-
return output;
|
|
5476
|
-
}
|
|
5477
|
-
function encodeUserinfo(input) {
|
|
5478
|
-
return encodeComponent(input, isUserinfoCharacter);
|
|
5479
|
-
}
|
|
5480
|
-
function encodeQuery(input) {
|
|
5481
|
-
return encodeComponent(input, isQueryFragmentCharacter);
|
|
5482
|
-
}
|
|
5483
|
-
function encodeFragment(input) {
|
|
5484
|
-
return encodeComponent(input, isQueryFragmentCharacter);
|
|
5485
|
-
}
|
|
5486
|
-
function isEscapeSafe(cp) {
|
|
5487
|
-
return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
|
|
5488
|
-
}
|
|
5489
|
-
function normalizeQueryFragmentEncoding(input) {
|
|
5490
|
-
let output = "";
|
|
5491
|
-
for (let i = 0; i < input.length; i++) {
|
|
5492
|
-
const ch = input[i];
|
|
5493
|
-
if (ch === "%" && i + 2 < input.length) {
|
|
5494
|
-
const hex3 = input.slice(i + 1, i + 3);
|
|
5495
|
-
if (isHexPair(hex3)) {
|
|
5496
|
-
const normalizedHex = hex3.toUpperCase();
|
|
5497
|
-
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
5498
|
-
if (isUnreserved(decoded)) {
|
|
5499
|
-
output += decoded;
|
|
5500
|
-
} else {
|
|
5501
|
-
output += "%" + normalizedHex;
|
|
5502
|
-
}
|
|
5503
|
-
i += 2;
|
|
5504
|
-
continue;
|
|
5505
|
-
}
|
|
5506
|
-
}
|
|
5507
|
-
if (isQueryFragmentCharacter(ch)) {
|
|
5508
|
-
output += ch;
|
|
5509
|
-
} else {
|
|
5510
|
-
const code2 = input.charCodeAt(i);
|
|
5511
|
-
if (code2 < 128) {
|
|
5512
|
-
output += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
|
|
5513
|
-
} else if (code2 < 55296 || code2 > 57343) {
|
|
5514
|
-
output += percentEncodeNonAscii(code2);
|
|
5515
|
-
} else if (code2 <= 56319 && i + 1 < input.length) {
|
|
5516
|
-
const low = input.charCodeAt(i + 1);
|
|
5517
|
-
if (low >= 56320 && low <= 57343) {
|
|
5518
|
-
output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
|
|
5519
|
-
i++;
|
|
5520
|
-
} else {
|
|
5521
|
-
output += percentEncodeNonAscii(65533);
|
|
5522
|
-
}
|
|
5523
|
-
} else {
|
|
5524
|
-
output += percentEncodeNonAscii(65533);
|
|
5525
|
-
}
|
|
5349
|
+
output += escape(input[i]);
|
|
5526
5350
|
}
|
|
5527
5351
|
}
|
|
5528
5352
|
return output;
|
|
@@ -5545,18 +5369,14 @@ var require_utils = __commonJS({
|
|
|
5545
5369
|
function recomposeAuthority(component) {
|
|
5546
5370
|
const uriTokens = [];
|
|
5547
5371
|
if (component.userinfo !== void 0) {
|
|
5548
|
-
uriTokens.push(
|
|
5372
|
+
uriTokens.push(component.userinfo);
|
|
5549
5373
|
uriTokens.push("@");
|
|
5550
5374
|
}
|
|
5551
5375
|
if (component.host !== void 0) {
|
|
5552
|
-
let host = component.host;
|
|
5376
|
+
let host = unescape(component.host);
|
|
5553
5377
|
if (!isIPv4(host)) {
|
|
5554
|
-
|
|
5555
|
-
if (ipV6res.isIPV6
|
|
5556
|
-
host = normalizePercentEncoding(host, true);
|
|
5557
|
-
ipV6res = normalizeIPv6(host);
|
|
5558
|
-
}
|
|
5559
|
-
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
5378
|
+
const ipV6res = normalizeIPv6(host);
|
|
5379
|
+
if (ipV6res.isIPV6 === true) {
|
|
5560
5380
|
host = `[${ipV6res.escapedHost}]`;
|
|
5561
5381
|
} else {
|
|
5562
5382
|
host = reescapeHostDelimiters(host, false);
|
|
@@ -5565,12 +5385,8 @@ var require_utils = __commonJS({
|
|
|
5565
5385
|
uriTokens.push(host);
|
|
5566
5386
|
}
|
|
5567
5387
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
5568
|
-
const port = String(component.port);
|
|
5569
|
-
if (!isPort(port)) {
|
|
5570
|
-
throw new TypeError("URI port is malformed.");
|
|
5571
|
-
}
|
|
5572
5388
|
uriTokens.push(":");
|
|
5573
|
-
uriTokens.push(port);
|
|
5389
|
+
uriTokens.push(String(component.port));
|
|
5574
5390
|
}
|
|
5575
5391
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
5576
5392
|
}
|
|
@@ -5580,11 +5396,6 @@ var require_utils = __commonJS({
|
|
|
5580
5396
|
reescapeHostDelimiters,
|
|
5581
5397
|
normalizePercentEncoding,
|
|
5582
5398
|
normalizePathEncoding,
|
|
5583
|
-
serializePathEncoding,
|
|
5584
|
-
normalizeQueryFragmentEncoding,
|
|
5585
|
-
encodeUserinfo,
|
|
5586
|
-
encodeQuery,
|
|
5587
|
-
encodeFragment,
|
|
5588
5399
|
escapePreservingEscapes,
|
|
5589
5400
|
removeDotSegments,
|
|
5590
5401
|
isIPv4,
|
|
@@ -5595,12 +5406,12 @@ var require_utils = __commonJS({
|
|
|
5595
5406
|
}
|
|
5596
5407
|
});
|
|
5597
5408
|
|
|
5598
|
-
// ../node_modules/.pnpm/fast-uri@3.1.
|
|
5409
|
+
// ../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js
|
|
5599
5410
|
var require_schemes = __commonJS({
|
|
5600
|
-
"../node_modules/.pnpm/fast-uri@3.1.
|
|
5411
|
+
"../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js"(exports, module) {
|
|
5601
5412
|
"use strict";
|
|
5602
5413
|
var { isUUID } = require_utils();
|
|
5603
|
-
var URN_REG =
|
|
5414
|
+
var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
5604
5415
|
var supportedSchemeNames = (
|
|
5605
5416
|
/** @type {const} */
|
|
5606
5417
|
[
|
|
@@ -5661,10 +5472,9 @@ var require_schemes = __commonJS({
|
|
|
5661
5472
|
wsComponent.secure = void 0;
|
|
5662
5473
|
}
|
|
5663
5474
|
if (wsComponent.resourceName) {
|
|
5664
|
-
const
|
|
5665
|
-
const path15 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
5475
|
+
const [path15, query] = wsComponent.resourceName.split("?");
|
|
5666
5476
|
wsComponent.path = path15 && path15 !== "/" ? path15 : void 0;
|
|
5667
|
-
wsComponent.query =
|
|
5477
|
+
wsComponent.query = query;
|
|
5668
5478
|
wsComponent.resourceName = void 0;
|
|
5669
5479
|
}
|
|
5670
5480
|
wsComponent.fragment = void 0;
|
|
@@ -5676,7 +5486,7 @@ var require_schemes = __commonJS({
|
|
|
5676
5486
|
return urnComponent;
|
|
5677
5487
|
}
|
|
5678
5488
|
const matches = urnComponent.path.match(URN_REG);
|
|
5679
|
-
if (matches
|
|
5489
|
+
if (matches) {
|
|
5680
5490
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
5681
5491
|
urnComponent.nid = matches[1].toLowerCase();
|
|
5682
5492
|
urnComponent.nss = matches[2];
|
|
@@ -5806,21 +5616,12 @@ var require_schemes = __commonJS({
|
|
|
5806
5616
|
}
|
|
5807
5617
|
});
|
|
5808
5618
|
|
|
5809
|
-
// ../node_modules/.pnpm/fast-uri@3.1.
|
|
5619
|
+
// ../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js
|
|
5810
5620
|
var require_fast_uri = __commonJS({
|
|
5811
|
-
"../node_modules/.pnpm/fast-uri@3.1.
|
|
5621
|
+
"../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js"(exports, module) {
|
|
5812
5622
|
"use strict";
|
|
5813
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding,
|
|
5623
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
5814
5624
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
5815
|
-
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
5816
|
-
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
5817
|
-
function decodeValidScheme(scheme) {
|
|
5818
|
-
const decodedScheme = unescape(String(scheme));
|
|
5819
|
-
if (!VALID_SCHEME.test(decodedScheme)) {
|
|
5820
|
-
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
5821
|
-
}
|
|
5822
|
-
return decodedScheme;
|
|
5823
|
-
}
|
|
5824
5625
|
function normalize(uri, options) {
|
|
5825
5626
|
if (typeof uri === "string") {
|
|
5826
5627
|
uri = /** @type {T} */
|
|
@@ -5833,34 +5634,12 @@ var require_fast_uri = __commonJS({
|
|
|
5833
5634
|
}
|
|
5834
5635
|
function resolve5(baseURI, relativeURI, options) {
|
|
5835
5636
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
5836
|
-
const {
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
5840
|
-
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
5841
|
-
malformedHost: baseMalformedHost,
|
|
5842
|
-
malformedScheme: baseMalformedScheme
|
|
5843
|
-
} = parseWithStatus(baseURI, schemelessOptions);
|
|
5844
|
-
const {
|
|
5845
|
-
parsed: relativeParsed,
|
|
5846
|
-
malformedAuthorityOrPort: relativeMalformed,
|
|
5847
|
-
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
5848
|
-
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
5849
|
-
malformedHost: relativeMalformedHost,
|
|
5850
|
-
malformedScheme: relativeMalformedScheme
|
|
5851
|
-
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
5852
|
-
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
5637
|
+
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
|
|
5638
|
+
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
|
|
5639
|
+
if (baseMalformed || relativeMalformed) {
|
|
5853
5640
|
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
5854
5641
|
}
|
|
5855
5642
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
5856
|
-
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
5857
|
-
const resolvedHost = resolved.host;
|
|
5858
|
-
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
5859
|
-
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
5860
|
-
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
|
|
5861
|
-
if (resolved.error && !encodedASCIIHost) {
|
|
5862
|
-
throw new Error(resolved.error);
|
|
5863
|
-
}
|
|
5864
5643
|
schemelessOptions.skipEscape = true;
|
|
5865
5644
|
return serialize(resolved, schemelessOptions);
|
|
5866
5645
|
}
|
|
@@ -5920,7 +5699,7 @@ var require_fast_uri = __commonJS({
|
|
|
5920
5699
|
function equal(uriA, uriB, options) {
|
|
5921
5700
|
const normalizedA = normalizeComparableURI(uriA, options);
|
|
5922
5701
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
5923
|
-
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
5702
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
|
|
5924
5703
|
}
|
|
5925
5704
|
function serialize(cmpts, opts) {
|
|
5926
5705
|
const component = {
|
|
@@ -5941,22 +5720,19 @@ var require_fast_uri = __commonJS({
|
|
|
5941
5720
|
};
|
|
5942
5721
|
const options = Object.assign({}, opts);
|
|
5943
5722
|
const uriTokens = [];
|
|
5944
|
-
if (component.scheme) {
|
|
5945
|
-
component.scheme = decodeValidScheme(component.scheme);
|
|
5946
|
-
}
|
|
5947
5723
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
5948
5724
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
5949
|
-
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
5950
|
-
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
5951
5725
|
if (component.path !== void 0) {
|
|
5952
5726
|
if (!options.skipEscape) {
|
|
5953
|
-
component.path =
|
|
5727
|
+
component.path = escapePreservingEscapes(component.path);
|
|
5728
|
+
if (component.scheme !== void 0) {
|
|
5729
|
+
component.path = component.path.split("%3A").join(":");
|
|
5730
|
+
}
|
|
5954
5731
|
} else {
|
|
5955
5732
|
component.path = normalizePercentEncoding(component.path);
|
|
5956
5733
|
}
|
|
5957
5734
|
}
|
|
5958
5735
|
if (options.reference !== "suffix" && component.scheme) {
|
|
5959
|
-
component.scheme = decodeValidScheme(component.scheme);
|
|
5960
5736
|
uriTokens.push(component.scheme, ":");
|
|
5961
5737
|
}
|
|
5962
5738
|
const authority = recomposeAuthority(component);
|
|
@@ -5974,19 +5750,16 @@ var require_fast_uri = __commonJS({
|
|
|
5974
5750
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
5975
5751
|
s2 = removeDotSegments(s2);
|
|
5976
5752
|
}
|
|
5977
|
-
if (pathNoScheme) {
|
|
5978
|
-
s2 = serializePathEncoding(s2, true);
|
|
5979
|
-
}
|
|
5980
5753
|
if (authority === void 0 && s2[0] === "/" && s2[1] === "/") {
|
|
5981
5754
|
s2 = "/%2F" + s2.slice(2);
|
|
5982
5755
|
}
|
|
5983
5756
|
uriTokens.push(s2);
|
|
5984
5757
|
}
|
|
5985
5758
|
if (component.query !== void 0) {
|
|
5986
|
-
uriTokens.push("?",
|
|
5759
|
+
uriTokens.push("?", component.query);
|
|
5987
5760
|
}
|
|
5988
5761
|
if (component.fragment !== void 0) {
|
|
5989
|
-
uriTokens.push("#",
|
|
5762
|
+
uriTokens.push("#", component.fragment);
|
|
5990
5763
|
}
|
|
5991
5764
|
return uriTokens.join("");
|
|
5992
5765
|
}
|
|
@@ -6002,35 +5775,6 @@ var require_fast_uri = __commonJS({
|
|
|
6002
5775
|
}
|
|
6003
5776
|
return void 0;
|
|
6004
5777
|
}
|
|
6005
|
-
function hasMalformedPercentEncoding(component) {
|
|
6006
|
-
if (component === void 0) return false;
|
|
6007
|
-
let percent = component.indexOf("%");
|
|
6008
|
-
while (percent !== -1) {
|
|
6009
|
-
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
|
|
6010
|
-
return true;
|
|
6011
|
-
}
|
|
6012
|
-
percent = component.indexOf("%", percent + 3);
|
|
6013
|
-
}
|
|
6014
|
-
return false;
|
|
6015
|
-
}
|
|
6016
|
-
function isIPLiteral(host) {
|
|
6017
|
-
return host[0] === "[" && host[host.length - 1] === "]";
|
|
6018
|
-
}
|
|
6019
|
-
function hasMalformedComponentPercentEncoding(matches) {
|
|
6020
|
-
const host = matches[4];
|
|
6021
|
-
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
6022
|
-
}
|
|
6023
|
-
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
6024
|
-
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
6025
|
-
try {
|
|
6026
|
-
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
6027
|
-
} catch (e) {
|
|
6028
|
-
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
6029
|
-
return true;
|
|
6030
|
-
}
|
|
6031
|
-
}
|
|
6032
|
-
return false;
|
|
6033
|
-
}
|
|
6034
5778
|
function parseWithStatus(uri, opts) {
|
|
6035
5779
|
const options = Object.assign({}, opts);
|
|
6036
5780
|
const parsed = {
|
|
@@ -6043,11 +5787,6 @@ var require_fast_uri = __commonJS({
|
|
|
6043
5787
|
fragment: void 0
|
|
6044
5788
|
};
|
|
6045
5789
|
let malformedAuthorityOrPort = false;
|
|
6046
|
-
let malformedPercentEncoding = false;
|
|
6047
|
-
let malformedSchemeSpecific = false;
|
|
6048
|
-
let malformedHost = false;
|
|
6049
|
-
let malformedIPLiteral = false;
|
|
6050
|
-
let malformedScheme = false;
|
|
6051
5790
|
let isIP = false;
|
|
6052
5791
|
if (options.reference === "suffix") {
|
|
6053
5792
|
if (options.scheme) {
|
|
@@ -6084,19 +5823,6 @@ var require_fast_uri = __commonJS({
|
|
|
6084
5823
|
parsed.path = matches[6] || "";
|
|
6085
5824
|
parsed.query = matches[7];
|
|
6086
5825
|
parsed.fragment = matches[8];
|
|
6087
|
-
if (parsed.scheme !== void 0) {
|
|
6088
|
-
const decodedScheme = unescape(parsed.scheme);
|
|
6089
|
-
if (VALID_SCHEME.test(decodedScheme)) {
|
|
6090
|
-
parsed.scheme = decodedScheme.toLowerCase();
|
|
6091
|
-
} else {
|
|
6092
|
-
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
6093
|
-
malformedScheme = true;
|
|
6094
|
-
}
|
|
6095
|
-
}
|
|
6096
|
-
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
6097
|
-
if (malformedPercentEncoding) {
|
|
6098
|
-
parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
6099
|
-
}
|
|
6100
5826
|
if (isNaN(parsed.port)) {
|
|
6101
5827
|
parsed.port = matches[5];
|
|
6102
5828
|
}
|
|
@@ -6108,16 +5834,9 @@ var require_fast_uri = __commonJS({
|
|
|
6108
5834
|
if (parsed.host) {
|
|
6109
5835
|
const ipv4result = isIPv4(parsed.host);
|
|
6110
5836
|
if (ipv4result === false) {
|
|
6111
|
-
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
6112
|
-
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
6113
5837
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
6117
|
-
if (malformedIPLiteral) {
|
|
6118
|
-
parsed.error = parsed.error || "URI host is malformed.";
|
|
6119
|
-
malformedAuthorityOrPort = true;
|
|
6120
|
-
}
|
|
5838
|
+
parsed.host = ipv6result.host.toLowerCase();
|
|
5839
|
+
isIP = ipv6result.isIPV6;
|
|
6121
5840
|
} else {
|
|
6122
5841
|
isIP = true;
|
|
6123
5842
|
}
|
|
@@ -6135,37 +5854,42 @@ var require_fast_uri = __commonJS({
|
|
|
6135
5854
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
6136
5855
|
}
|
|
6137
5856
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
6138
|
-
if (!
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
5857
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
5858
|
+
if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
5859
|
+
try {
|
|
5860
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
5861
|
+
} catch (e) {
|
|
5862
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
5863
|
+
}
|
|
6145
5864
|
}
|
|
6146
|
-
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
6147
5865
|
}
|
|
6148
5866
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
5867
|
+
if (uri.indexOf("%") !== -1) {
|
|
5868
|
+
if (parsed.scheme !== void 0) {
|
|
5869
|
+
parsed.scheme = unescape(parsed.scheme);
|
|
5870
|
+
}
|
|
5871
|
+
if (parsed.host !== void 0) {
|
|
5872
|
+
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
5873
|
+
}
|
|
5874
|
+
}
|
|
6149
5875
|
if (parsed.path) {
|
|
6150
5876
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
6151
5877
|
}
|
|
6152
|
-
if (parsed.query) {
|
|
6153
|
-
parsed.query = normalizeQueryFragmentEncoding(parsed.query);
|
|
6154
|
-
}
|
|
6155
5878
|
if (parsed.fragment) {
|
|
6156
|
-
|
|
5879
|
+
try {
|
|
5880
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
5881
|
+
} catch {
|
|
5882
|
+
parsed.error = parsed.error || "URI malformed";
|
|
5883
|
+
}
|
|
6157
5884
|
}
|
|
6158
5885
|
}
|
|
6159
5886
|
if (schemeHandler && schemeHandler.parse) {
|
|
6160
5887
|
schemeHandler.parse(parsed, options);
|
|
6161
|
-
if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
|
|
6162
|
-
malformedSchemeSpecific = true;
|
|
6163
|
-
}
|
|
6164
5888
|
}
|
|
6165
5889
|
} else {
|
|
6166
5890
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
6167
5891
|
}
|
|
6168
|
-
return { parsed, malformedAuthorityOrPort
|
|
5892
|
+
return { parsed, malformedAuthorityOrPort };
|
|
6169
5893
|
}
|
|
6170
5894
|
function parse3(uri, opts) {
|
|
6171
5895
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -6174,28 +5898,20 @@ var require_fast_uri = __commonJS({
|
|
|
6174
5898
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
6175
5899
|
}
|
|
6176
5900
|
function normalizeStringWithStatus(uri, opts) {
|
|
6177
|
-
const { parsed, malformedAuthorityOrPort
|
|
5901
|
+
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
6178
5902
|
return {
|
|
6179
|
-
normalized: malformedAuthorityOrPort
|
|
6180
|
-
malformedAuthorityOrPort
|
|
6181
|
-
malformedPercentEncoding,
|
|
6182
|
-
malformedSchemeSpecific,
|
|
6183
|
-
malformedHost,
|
|
6184
|
-
malformedScheme
|
|
5903
|
+
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
5904
|
+
malformedAuthorityOrPort
|
|
6185
5905
|
};
|
|
6186
5906
|
}
|
|
6187
5907
|
function normalizeComparableURI(uri, opts) {
|
|
6188
|
-
if (typeof uri
|
|
6189
|
-
|
|
5908
|
+
if (typeof uri === "string") {
|
|
5909
|
+
const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
|
|
5910
|
+
return malformedAuthorityOrPort ? void 0 : normalized;
|
|
6190
5911
|
}
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
value = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
6194
|
-
} catch {
|
|
6195
|
-
return void 0;
|
|
5912
|
+
if (typeof uri === "object") {
|
|
5913
|
+
return serialize(uri, opts);
|
|
6196
5914
|
}
|
|
6197
|
-
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
6198
|
-
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
6199
5915
|
}
|
|
6200
5916
|
var fastUri = {
|
|
6201
5917
|
SCHEMES,
|
|
@@ -24194,7 +23910,7 @@ var listExperimentTraces = {
|
|
|
24194
23910
|
var getReplayStatus = {
|
|
24195
23911
|
name: "get_replay_status",
|
|
24196
23912
|
title: "Get Replay Status",
|
|
24197
|
-
description: "Read
|
|
23913
|
+
description: "Read an experiment's replay progress: status, local to server replay trace IDs, and finished and remaining trace attempts. Call it while a replay runs, or after one crashes to check `resumable` before rerunning with `--resume <experimentId>`.",
|
|
24198
23914
|
inputSchema: {
|
|
24199
23915
|
experimentId: external_exports.uuid().describe("The experiment ID to get status for")
|
|
24200
23916
|
}
|
|
@@ -24962,8 +24678,8 @@ var semver3 = __toESM(require_semver2(), 1);
|
|
|
24962
24678
|
|
|
24963
24679
|
// ../bitfab-plugin-lib/dist/bakedSdkVersions.js
|
|
24964
24680
|
var BAKED_SDK_VERSIONS = {
|
|
24965
|
-
typescript: "0.61.
|
|
24966
|
-
python: "0.61.
|
|
24681
|
+
typescript: "0.61.2",
|
|
24682
|
+
python: "0.61.2",
|
|
24967
24683
|
ruby: "0.61.0",
|
|
24968
24684
|
go: "0.61.0"
|
|
24969
24685
|
};
|
|
@@ -26073,7 +25789,7 @@ import { dirname as dirname3, resolve as resolve3 } from "path";
|
|
|
26073
25789
|
import { createInterface } from "readline";
|
|
26074
25790
|
|
|
26075
25791
|
// ../bitfab-plugin-lib/dist/replayItemWriter.js
|
|
26076
|
-
import { mkdirSync as mkdirSync3, renameSync, writeFileSync as writeFileSync3 } from "fs";
|
|
25792
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync3, renameSync, writeFileSync as writeFileSync3 } from "fs";
|
|
26077
25793
|
import { join as join3 } from "path";
|
|
26078
25794
|
|
|
26079
25795
|
// ../bitfab-plugin-lib/dist/bestEffortFs.js
|
|
@@ -28925,7 +28641,7 @@ var assistantFlow = Flow.parse({
|
|
|
28925
28641
|
},
|
|
28926
28642
|
replayProgress: {
|
|
28927
28643
|
description: "Run a replay and emit one ready-to-relay line per trace to stdout (header, then per trace: a pass/fail glyph, running n/total, and that trace's duration, with the error reason inline on failure; a liveness heartbeat line when a slow trace goes quiet; then a summary with total + average time), write a per-run replay event index to .bitfab/replays/<run-id>/events.jsonl, and write full item payloads to .bitfab/replays/<run-id>/items/*.json. Background it and relay each new line to the user",
|
|
28928
|
-
args: "[--label <key>] [--total N] [--run-dir <path>] -- <replay command...>"
|
|
28644
|
+
args: "[--label <key>] [--total N] [--run-dir <path>] [--resume <experimentId> [--force]] -- <replay command...>"
|
|
28929
28645
|
},
|
|
28930
28646
|
readTracesBatched: {
|
|
28931
28647
|
description: "Read many traces at once: fans get_traces out in parallel batches of 10, writes the concatenated result to a temp file, and prints its path as JSON",
|
|
@@ -30516,7 +30232,8 @@ If \`completed === 0\`, do not score pass/fail on an empty set, branch to \`chec
|
|
|
30516
30232
|
"edit",
|
|
30517
30233
|
"getTraces",
|
|
30518
30234
|
"searchTraces",
|
|
30519
|
-
"ask"
|
|
30235
|
+
"ask",
|
|
30236
|
+
"getReplayStatus"
|
|
30520
30237
|
],
|
|
30521
30238
|
title: "Check replay health",
|
|
30522
30239
|
body: `**Route on the counts and exit code.** Goal: keep infra noise out of evaluation. Read a sample of \`item.error\` strings (and stderr on crash) first to identify the DB-shaped pattern (missing record, FK / unique constraint, write rejected, connection refused, missing env).
|
|
@@ -30539,6 +30256,11 @@ After whichever workaround the user picks, re-run \`replay-against-dataset\` and
|
|
|
30539
30256
|
description: `the function's shape drifted since these traces were captured, so replay can't call it with the recorded inputs. This is recoverable: route to \`adapt-replay-inputs\` to map the recorded inputs onto the current signature, then re-run`,
|
|
30540
30257
|
next: "iterate/adapt-replay-inputs"
|
|
30541
30258
|
},
|
|
30259
|
+
{
|
|
30260
|
+
when: "whole replay command crashed after it printed an experiment ID (the `[replay] Experiment <id>` line, the `Resume with:` line, or `experimentId` in this run's `run.json`), and the experiment's status reports `resumable: true`",
|
|
30261
|
+
description: `before any other crash handling, call {{tool:getReplayStatus}} with that experiment ID. When it returns \`resumable: true\`, tell the user in plain words how many traces already finished (\`finishedCount\`) and how many are left (\`remainingCount\`), and that the finished ones will be kept, not replayed again. Then show stderr and the exit code, diagnose the crash, confirm the fix with the user, and apply it. When the cause was outside the code (the process was killed, the network dropped, a rate limit, running out of memory, or the machine went to sleep), resume as described next. If that resume is refused because the working tree differs from the one the experiment started with (the refusal names the stored commit and tree, and {{tool:getReplayStatus}} returns them as \`commitSha\` and \`experimentSha\`), do not change the user's working tree yourself. Relay the refusal, name the commit and tree, and give the user three choices: return their working tree to that state their own way and ask you to resume again, resume on their current code by adding \`--force\` to the same command (finished traces from the old code are kept alongside new ones), or start a fresh replay through the crash route below. When fixing the crash needed a code change, do not resume: tell the user plainly that resuming would run the old code the experiment started with, which would hit the same crash, and start a fresh replay with the fixed code through the crash route below. Loop back to \`replay-against-dataset\`, but instead of a fresh replay, run the same \`{{command:replayProgress}}\` command with \`--resume <experimentId>\` added before \`--\`, and the replay command after \`--\` changed to the \`Resume with:\` line the crashed run printed, or else \`bitfab-replay --registry <registry-path> <pipeline-name> --resume <experimentId>\` behind the same package runner. Keep the same \`--code-change\` file, \`--mock\`, and \`--param\` / \`--params\` flags as the crashed run. Drop \`--trace-ids\`, \`--dataset-id\`, \`--limit\`, \`--attempts\`, \`--grader-ids\`, \`--only-with-assertions\`, \`--name\`, and \`--experiment-group-id\`, because the experiment already stores its traces and settings. Keep the same run directory, since resume adds to that run's \`events.jsonl\` and item files, and items marked \`carriedOver\` in the final result count as already finished. If the resume is refused, relay the refusal message as is. When it says the replay may still be running, wait two minutes and try again. For any other refusal, or when {{tool:getReplayStatus}} does not return \`resumable: true\`, use the crash route below and start a fresh replay`,
|
|
30262
|
+
next: "iterate/replay-against-dataset"
|
|
30263
|
+
},
|
|
30542
30264
|
{
|
|
30543
30265
|
when: "whole replay command crashed (non-zero child exit, or the server confirms zero replay items)",
|
|
30544
30266
|
description: `show stderr / exit code, diagnose, confirm a script fix with the user, apply, loop back to \`replay-against-dataset\``,
|
|
@@ -31536,7 +31258,7 @@ If the block prints \`ERROR: Bitfab plugin not installed\`, the user hasn't inst
|
|
|
31536
31258
|
{{/plugin-dir-lookup}}
|
|
31537
31259
|
**SDK reference:** https://docs.bitfab.ai is the source of truth for SDK install, initialization, API surface, and replay. Every docs path below ends in \`.md\`: that suffix returns the page as plain markdown (no HTML chrome), so fetch the URLs exactly as written. Fetch in this order before writing any code, do not improvise from memory:
|
|
31538
31260
|
- **Canonical API surface (preferred for agents):** the dense reference pages at \`/reference/typescript.md\`, \`/reference/python.md\`, \`/reference/ruby.md\`, \`/reference/go.md\`. These list every public export, signature, type, default, and error semantic, no tutorials, no prose. Read these first.
|
|
31539
|
-
- **Default to opt-out tracing.** For TypeScript,
|
|
31261
|
+
- **Default to opt-out tracing.** For TypeScript, wire the matching \`@bitfab/sdk/transform\` build adapter included with the SDK, then use \`withTrace\`/\`trace\` for the workflow root and \`withNode\`/\`node\` only where a discovered call needs naming, typing, capture, finalization, or replay-mocking policy. For Python 3.12+, use \`@client.trace\` and \`@client.node\` the same way. Opt-in \`withSpan\`/\`span\` remains supported, but setup chooses it only when opt-out is technically impossible: Ruby, Go, Python before 3.12, a TypeScript build path for which the documented transform adapters truly cannot be wired, or a live streaming root whose output opt-out tracing cannot finalize without changing behavior. Framework handlers, processors, and their generated spans are compatible descendants of an opt-out root and are never by themselves a reason to choose spans. Keep the framework integration and use \`withNode\`/\`node\` for first-party calls that need explicit policy. Existing manual spans in the selected call stack are also not a reason to fall back. Convert that whole call stack to one opt-out surface. Before converting a span-bearing helper in place, inspect every production caller and confirm each caller belongs to the same opt-out surface; a helper shared with an opt-in caller requires a disjoint trace boundary or explicit refactor confirmation. Remove redundant span wrappers and replace policy-bearing spans with nodes. Preserve their names, types, capture controls, finalizers, and replay-mocking behavior. TypeScript \`withNode\` requires a named function, so preserve an existing name or use an additive named function form; stop for refactor confirmation if naming it would require a non-additive rewrite. Never put \`withSpan\` beneath \`withTrace\`. The SDK raises \`MixedTracingError\`. Name all three primitives when fetching a reference page so the fetched guidance cannot collapse back to spans alone.
|
|
31540
31262
|
- **Cross-SDK shared semantics:** \`/reference/overview.md\` (invariants), \`/reference/span-types.md\` (the \`SpanType\` enum), \`/reference/http.md\` (wire protocol).
|
|
31541
31263
|
- **Framework integrations (fetch when a framework is detected in step 1 of Instrument):** {{frameworkDocsPaths}}. Each page documents the SDK's native handler/processor/wrapper for that framework, which is usually preferable to hand-wrapping every node/agent call with \`withSpan\`/\`@span\`.
|
|
31542
31264
|
- **Tutorials / walkthroughs / replay registry module template:** the language-specific documentation pages (\`/typescript-sdk.md\`, \`/python-sdk.md\`, \`/ruby-sdk.md\`, \`/go-sdk.md\`). Use these for the copy-pasteable replay registry module and the replay output contract. During Instrument, fetch the Replay section before Instrument's write-instrumentation step so the replay registry module can be written alongside the instrumentation in the same cycle without re-fetching.
|
|
@@ -31798,7 +31520,7 @@ Bitfab provides opt-out tracing and safe replay during development. For TypeScri
|
|
|
31798
31520
|
- \`withNode(...)\` / \`node(...)\` to configure a discovered call
|
|
31799
31521
|
- \`replay(...)\` to run recorded scenarios against current code
|
|
31800
31522
|
|
|
31801
|
-
Default to opt-out tracing. A trace root records its serializable inputs and output plus every first-party call beneath it. Most descendants need no wrapper. Add a node only when a call needs a name, type, capture override, finalizer, or replay-mocking policy. TypeScript requires the matching \`@bitfab/transform\` build adapter; setup
|
|
31523
|
+
Default to opt-out tracing. A trace root records its serializable inputs and output plus every first-party call beneath it. Most descendants need no wrapper. Add a node only when a call needs a name, type, capture override, finalizer, or replay-mocking policy. TypeScript requires the matching \`@bitfab/sdk/transform\` build adapter included with the SDK; setup configures it. Python requires 3.12+. Opt-in spans remain supported; setup uses them as the fallback for Ruby, Go, unsupported runtimes, and live streaming roots that opt-out tracing cannot finalize without changing behavior. Keep one tracing surface per call stack. Never mix \`withSpan\` beneath \`withTrace\`; the SDK rejects mixed tracing surfaces.
|
|
31802
31524
|
|
|
31803
31525
|
\`replay\` calls into your trace root and can modify each captured descendant in one of five ways:
|
|
31804
31526
|
|
|
@@ -32059,7 +31781,7 @@ Confirm the change to the user.`,
|
|
|
32059
31781
|
|
|
32060
31782
|
**Install the SDK now.** Detect the project's package manager from its manifest (\`pyproject.toml\` \u2192 \`uv\`/\`poetry\`; \`package.json\` \u2192 \`pnpm\`/\`npm\`/\`yarn\`/\`bun\`; \`Gemfile\` \u2192 \`bundle\`; \`go.mod\` \u2192 \`go get\`; \`requirements.txt\` \u2192 edit file + \`pip install -r\`) and run its canonical add command, do NOT stop to ask about version pinning, dependency groups, package publishing, or whether a supported transform adapter should be added. The user's request to instrument authorizes the dependencies and build wiring required by the selected approach. Prefer \`uv add\`/\`poetry add\` over bare \`pip install\` (bare \`pip install\` doesn't persist to pyproject.toml). In monorepos, scope to the correct workspace (e.g. \`pnpm add --filter <pkg>\`, or cd into the app directory first), running from the repo root will install into the wrong package. Install the SDK as a runtime dependency whenever instrumented code ships or executes from the package, including published libraries and CLIs. Use a development dependency only when the instrumented code is excluded from the published/runtime artifact. Then set the \`BITFAB_API_KEY\` environment variable.
|
|
32061
31783
|
|
|
32062
|
-
**Install opt-out capture support at the same time.** For TypeScript,
|
|
31784
|
+
**Install opt-out capture support at the same time.** For TypeScript, the SDK already includes every transform adapter; do not install a second transform package. Wire the matching \`@bitfab/sdk/transform\` adapter into the actual server build before instrumenting. Inspect the build tool and use the matching documented adapter. For Next.js, wrap the existing config with \`@bitfab/sdk/transform/next\` while preserving existing wrappers such as Sentry; do not replace or bypass them. For tsup, add the \`@bitfab/sdk/transform/esbuild\` plugin to the existing tsup esbuild options. For direct Node or \`tsx\`, update the real start command to register \`@bitfab/sdk/transform/register\`. The package also ships documented adapters for Vite, Rollup, webpack, Rspack, Rsbuild, Rolldown, Bun, SWC, Babel, Nest, and the TypeScript compiler. Verify the transformed build path covers the production entrypoint. Do not call a build unsupported until you have checked these adapters and the language guide. For Python, verify the runtime is 3.12+ before choosing \`trace\`/\`node\`. Fall back to opt-in spans only when the language/runtime or build path truly cannot support subtree capture, or when the selected root returns a live stream that opt-out tracing cannot finalize without changing behavior. A published package, a framework-generated span model, or the need to add a supported transform adapter is not a fallback reason. State the concrete technical blocker to the user and keep the whole selected call stack on one tracing surface.
|
|
32063
31785
|
|
|
32064
31786
|
**Keep organization-specific keys isolated.** Inspect how the selected application already names and loads Bitfab keys before changing its client initialization. A TypeScript client whose configured \`apiKey\` is missing or resolves empty falls back to \`BITFAB_API_KEY\`. If this client intentionally uses a dedicated key for another organization or environment, also set \`captureEnabled\` from the presence of that dedicated key. Never rely on an empty dedicated key to disable tracing because the fallback can send traces to the organization bound to \`BITFAB_API_KEY\`. Do not replace an existing general-purpose \`BITFAB_API_KEY\` when the application deliberately keeps these destinations separate.
|
|
32065
31787
|
|
|
@@ -32194,7 +31916,7 @@ Recommend one to start with. **Ask the user to pick exactly ONE workflow to inst
|
|
|
32194
31916
|
|
|
32195
31917
|
**Delegate 11b to a subagent only when 11a is itself a large mechanical fan-out** (>10 files) whose generation genuinely overlaps the registry work. The subagent must follow the same registry-only contract.
|
|
32196
31918
|
|
|
32197
|
-
**Default instrumentation policy:** use opt-out tracing whenever the selected TypeScript or Python workflow supports it. TypeScript setup must
|
|
31919
|
+
**Default instrumentation policy:** use opt-out tracing whenever the selected TypeScript or Python workflow supports it. TypeScript setup must configure the bundled \`@bitfab/sdk/transform\` adapter in the application build, then put \`withTrace\`/\`trace\` on the existing workflow root. Python 3.12+ uses \`trace\` on the root. Let first-party descendants be discovered automatically and use \`withNode\`/\`node\` for external reads, unsafe side effects, model calls, naming, typing, capture overrides, finalization, and replay mocking. Do not add \`withSpan\` inside an opt-out trace. Existing \`withSpan\` usage is not a reason to extend the opt-in pattern. When a manual span already runs inside the selected call stack, migrate the call stack instead of abandoning opt-out. Before converting a span-bearing helper in place, inspect every production caller and confirm each caller belongs to the same opt-out surface; if an opt-in caller remains, use a disjoint trace boundary or stop for refactor confirmation. Remove redundant span wrappers. Replace spans that carry policy with nodes and preserve that policy. TypeScript \`withNode\` requires a named function, so preserve an existing name or use an additive named function form; stop for refactor confirmation if naming it requires a non-additive rewrite. This tracing-surface migration is instrumentation work, not an application refactor. Stop for refactor confirmation only if preserving application behavior requires changing the underlying function or its callers. Spans remain supported, but during setup choose them only when opt-out is technically impossible: Ruby, Go, unsupported Python runtimes, a TypeScript build path unsupported by every documented transform adapter, or a live streaming root whose output opt-out tracing cannot finalize without changing behavior. Framework integrations and their generated spans remain nested beneath the opt-out root; they do not justify a span root. Adding a supported transform adapter, including the esbuild adapter used by tsup, is required setup work rather than a fallback reason. Report the concrete technical blocker and keep the selected call stack on one tracing surface.
|
|
32198
31920
|
|
|
32199
31921
|
- **11a. Instrumentation edits**: follow the SDK reference exactly, purely additive. Never change behavior, arguments, return values, error handling, variable names, types, control flow, or code structure. **Wrapping means wrapping, not silently rewriting.** Attach the opt-out trace to the existing root and configure only the discovered nodes that need policy. Rewriting, re-implementing, inlining, or hand-reconstructing a framework/SDK call to seat a root is sometimes genuinely necessary, but it is a refactor, not additive instrumentation: never do it silently as part of the write step. Any such rewrite must preserve behavior exactly (labeled *visibility* or *structural* in the refactor plan); a rewrite that would change behavior is never allowed, fall back to an additive root or move the boundary inward instead. Try the additive root first, when the natural root is opaque or stream-returning, reach for the framework handler/middleware or the \`finalize\` option wrapped around the *unchanged* call. If none of those fit and a rewrite really is required, STOP, present the refactor plan to the user in plain terms and get an explicit yes before touching the code (the "Refactor confirmation" rules below say what the plan must contain), then proceed once they approve. **Likewise, if the additive wrap doesn't typecheck, STOP and surface it rather than dropping or loosening an argument, weakening validation, or otherwise quietly changing runtime behavior to make it compile** (the same "no type-checker escape hatches, don't paper over it" rule the replay step enforces): a compile error on a purely-additive wrap means the wrap isn't additive, so either find the additive form or present it to the user as a refactor and get approval first. Batch repetitive edits into one message (many Edit calls); for large mechanical fan-outs (>10 files of the same wrapper pattern), validate the pattern on one file, then delegate the rest to a subagent. **For each external read or unsafe side effect that replay must mock, configure the discovered node with replay mocking** (TypeScript \`withNode({ type, mockOnReplay: true }, fn)\` / \`@client.node(...)\`; Python \`@client.node(type=..., mock_on_replay=True)\`). Under opt-in fallback, put the equivalent option on the span. This lets replay's \`mock: "marked"\` strategy serve its recorded output without mixing tracing surfaces.
|
|
32200
31922
|
|
|
@@ -32212,7 +31934,7 @@ Recommend one to start with. **Ask the user to pick exactly ONE workflow to inst
|
|
|
32212
31934
|
- **Side-effect check**: if importing the instrumented function triggers module-level side effects (booting listeners/ports/prod connections), do not work around it silently; flag it to the user (a subagent returns that fact in its report so the main agent can flag it).
|
|
32213
31935
|
- **Result**: confirm the registry module path and the exact \`bitfab-replay --registry ...\` command. Surface signature mismatches or import side effects.{{/codex}}{{#codex}}**Write instrumentation AND the replay registry module for this trace function in the same cycle.** Skip the registry for Go-only projects.
|
|
32214
31936
|
|
|
32215
|
-
**Default instrumentation policy:** use opt-out tracing whenever the selected TypeScript or Python workflow supports it. TypeScript setup must
|
|
31937
|
+
**Default instrumentation policy:** use opt-out tracing whenever the selected TypeScript or Python workflow supports it. TypeScript setup must configure the bundled \`@bitfab/sdk/transform\` adapter in the application build, then put \`withTrace\`/\`trace\` on the existing workflow root. Python 3.12+ uses \`trace\` on the root. Let first-party descendants be discovered automatically and use \`withNode\`/\`node\` for external reads, unsafe side effects, model calls, naming, typing, capture overrides, finalization, and replay mocking. Do not add \`withSpan\` inside an opt-out trace. Existing \`withSpan\` usage is not a reason to extend the opt-in pattern. When a manual span already runs inside the selected call stack, migrate the call stack instead of abandoning opt-out. Before converting a span-bearing helper in place, inspect every production caller and confirm each caller belongs to the same opt-out surface; if an opt-in caller remains, use a disjoint trace boundary or stop for refactor confirmation. Remove redundant span wrappers. Replace spans that carry policy with nodes and preserve that policy. TypeScript \`withNode\` requires a named function, so preserve an existing name or use an additive named function form; stop for refactor confirmation if naming it requires a non-additive rewrite. This tracing-surface migration is instrumentation work, not an application refactor. Stop for refactor confirmation only if preserving application behavior requires changing the underlying function or its callers. Spans remain supported, but during setup choose them only when opt-out is technically impossible: Ruby, Go, unsupported Python runtimes, a TypeScript build path unsupported by every documented transform adapter, or a live streaming root whose output opt-out tracing cannot finalize without changing behavior. Framework integrations and their generated spans remain nested beneath the opt-out root; they do not justify a span root. Adding a supported transform adapter, including the esbuild adapter used by tsup, is required setup work rather than a fallback reason. Report the concrete technical blocker and keep the selected call stack on one tracing surface.
|
|
32216
31938
|
|
|
32217
31939
|
- **11a. Instrumentation edits**: follow the SDK reference exactly, purely additive. Never change behavior, arguments, return values, error handling, variable names, types, control flow, or code structure. **Wrapping means wrapping, not silently rewriting.** Attach the opt-out trace to the existing root and configure only the discovered nodes that need policy. Rewriting, re-implementing, inlining, or hand-reconstructing a framework/SDK call to seat a root is sometimes genuinely necessary, but it is a refactor, not additive instrumentation: never do it silently as part of the write step. Any such rewrite must preserve behavior exactly (labeled *visibility* or *structural* in the refactor plan); a rewrite that would change behavior is never allowed, fall back to an additive root or move the boundary inward instead. Try the additive root first, when the natural root is opaque or stream-returning, reach for the framework handler/middleware or the \`finalize\` option wrapped around the *unchanged* call. If none of those fit and a rewrite really is required, STOP, present the refactor plan to the user in plain terms and get an explicit yes before touching the code (the "Refactor confirmation" rules below say what the plan must contain), then proceed once they approve. **Likewise, if the additive wrap doesn't typecheck, STOP and surface it rather than dropping or loosening an argument, weakening validation, or otherwise quietly changing runtime behavior to make it compile** (the same "no type-checker escape hatches, don't paper over it" rule the replay step enforces): a compile error on a purely-additive wrap means the wrap isn't additive, so either find the additive form or present it to the user as a refactor and get approval first. Batch repetitive edits in parallel (one message, many Edit calls); for large mechanical fan-outs (>10 files of the same wrapper pattern), validate the pattern on one file, then do the remaining files. **For each external read or unsafe side effect that replay must mock, configure the discovered node with replay mocking** (TypeScript \`withNode({ type, mockOnReplay: true }, fn)\` / \`@client.node(...)\`; Python \`@client.node(type=..., mock_on_replay=True)\`). Under opt-in fallback, put the equivalent option on the span. This lets replay's \`mock: "marked"\` strategy serve its recorded output without mixing tracing surfaces.
|
|
32218
31940
|
|
|
@@ -32457,7 +32179,7 @@ Mark each key as \u2705 traces arriving (with most recent timestamp), \u26A0\uFE
|
|
|
32457
32179
|
- **Bare trace-processor keys** ({{traceProcessorNames}} over plain \`run()\`): the processor captures the run but its root span records an empty input, so a processor-only key without the run wrapper {{traceProcessorRootWrappers}} or an application root is NOT replayable. Flag it \u26A0\uFE0F root not replayable and recommend adding a \`withTrace\`/\`trace\` root that takes the run input in supported subtree runtimes, or routing through the run wrapper. Recommend a manual \`withSpan\`/\`@span\` root only when opt-out is technically unavailable. When an application root exists, check its signature like any decorated key (next bullet).
|
|
32458
32180
|
- **Decorated/wrapped keys**: read the root function signature and confirm it's replayable per Instrument's trace-boundary serializability requirement (serializable inputs). Flag any key whose root takes unserializable inputs (live SDK/DB clients, HTTP \`Request\`/\`Response\`, stream writers, sockets, opaque request contexts) as \u26A0\uFE0F root not replayable, reasoning from the signature, not the function name. This is independent of the replay-registry coverage in sub-step 3 above: a non-replayable root is \u26A0\uFE0F whether or not a registry exists for it (a key can be \u274C no replay registry module AND \u26A0\uFE0F root not replayable at once), so never roll a non-replayable root up into \u2705 just because it has no registry entry.
|
|
32459
32181
|
|
|
32460
|
-
5. **Subtree capture wiring**: an opt-out \`trace\`/\`withTrace\` root records the root and nothing beneath it unless the runtime support is actually there, which looks like healthy tracing until someone opens a trace and finds one node. Only check this when step {{step:inspect/gather-functions}} found an opt-out root; a repo whose roots are all \`withSpan\`/\`span\` needs none of it. **TypeScript** needs two things, both required: (a) \`@bitfab/
|
|
32182
|
+
5. **Subtree capture wiring**: an opt-out \`trace\`/\`withTrace\` root records the root and nothing beneath it unless the runtime support is actually there, which looks like healthy tracing until someone opens a trace and finds one node. Only check this when step {{step:inspect/gather-functions}} found an opt-out root; a repo whose roots are all \`withSpan\`/\`span\` needs none of it. **TypeScript** needs two things, both required: (a) \`@bitfab/sdk\` in that workspace's manifest, and (b) an adapter wired into the build that produces the server entrypoint. Grep the build configuration and start scripts for either the current \`@bitfab/sdk/transform/\` prefix or the still-supported \`@bitfab/transform/\` compatibility prefix: \`next.config.*\`, \`vite.config.*\`, \`webpack.config.*\`, \`rspack.config.*\`, \`rsbuild.config.*\`, \`rollup.config.*\`, \`tsup.config.*\`, \`babel.config.*\`, Nest's \`webpackConfigPath\` target, or the corresponding \`--import .../register\` on the real start command. Treat either adapter prefix as wired; do not add an SDK adapter alongside an existing compatibility adapter. Mark \u2705 package present and adapter wired, \u26A0\uFE0F package installed but no adapter in the real build path, or \u274C package missing. **Python** needs 3.12+ instead; read the project's declared version and flag anything below it. The application's own log corroborates a \u274C or \u26A0\uFE0F finding: both SDKs log one \`[bitfab]\` warning when an opt-out root runs without its runtime support.
|
|
32461
32183
|
|
|
32462
32184
|
Hold these results for the report. (If nothing is instrumented, no trace function keys AND no trace-processor registrations, skip both the **replay** and the **replayability** checks, they are per-workflow, so there's nothing to evaluate; report both as \`n/a (nothing instrumented)\`, never \u2705. Still run the **plugin** and **SDK** checks: the SDK may be installed and stale, or on the legacy \`bitfab\` package needing the \`@bitfab/sdk\` rename, independent of whether any trace functions exist in this repo yet.)`,
|
|
32463
32185
|
next: "inspect/report"
|
|
@@ -32473,13 +32195,13 @@ Hold these results for the report. (If nothing is instrumented, no trace functio
|
|
|
32473
32195
|
- **Instrumented here**: the list of keys with \u2705 / \u26A0\uFE0F / \u2753 markers from step {{step:inspect/check-traces}}.
|
|
32474
32196
|
- **Replay**: \u2705 covers all keys / \u26A0\uFE0F missing keys / \u274C none (from the replay-registry check in step {{step:inspect/check-freshness}}).
|
|
32475
32197
|
- **Replayable**: \u2705 all roots replayable / \u26A0\uFE0F \`<key>\` root not replayable / \`n/a (nothing instrumented)\` (from the per-root replayability check in step {{step:inspect/check-freshness}}; flagged whether or not a replay registry module exists for the key; never \u2705 when nothing is instrumented).
|
|
32476
|
-
- **Subtree capture**: \u2705 wired / \u26A0\uFE0F \`@bitfab/
|
|
32198
|
+
- **Subtree capture**: \u2705 wired / \u26A0\uFE0F \`@bitfab/sdk\` installed but no transform adapter in the real build path / \u274C \`@bitfab/sdk\` missing / \u274C Python below 3.12 / \`n/a (no opt-out roots)\` (from the subtree-capture check in step {{step:inspect/check-freshness}}).
|
|
32477
32199
|
|
|
32478
32200
|
Then, for anything not healthy, name the most likely cause and the fix:
|
|
32479
32201
|
- **Plugin or SDK out of date, or on the legacy \`bitfab\` package**: apply via the fix prompt below (upgrades the version and/or switches \`bitfab\` \u2192 \`@bitfab/sdk\`; same effect as \`{{cmd}}update\`).
|
|
32480
32202
|
- **Replay missing or incomplete**: refresh via \`{{cmd}}setup replay\` (non-interactive; creates or extends registry entries to cover every key).
|
|
32481
32203
|
- **Root not replayable**, two failure modes, with the fix matched to each: **(a) the root takes unserializable inputs** (live SDK/DB clients, HTTP req/res, streams, opaque contexts), with or without a replay registry module: move the trace boundary inward to a serializable-input function or refactor to introduce one; **(b) a bare trace-processor-only key** ({{traceProcessorNames}}) whose root is the processor's empty-input span: add a \`withTrace\`/\`trace\` root that wraps the run and takes its input in a supported subtree runtime, or route the run through the run wrapper ({{traceProcessorRootWrappers}}). Use a manual \`withSpan\`/\`@span\` root only when opt-out is technically unavailable. Either way, re-instrument via \`{{cmd}}setup modify\` (or \`{{cmd}}setup instrument\` for a fresh boundary). This is a code change, recommended here, not applied blanket.
|
|
32482
|
-
- **Opt-out roots without subtree capture**: every trace is the root alone, so tracing looks healthy and the traces are useless for per-step diagnosis, replay mocking, and prompt iteration. For TypeScript,
|
|
32204
|
+
- **Opt-out roots without subtree capture**: every trace is the root alone, so tracing looks healthy and the traces are useless for per-step diagnosis, replay mocking, and prompt iteration. For TypeScript, use the installed SDK and wire the matching adapter into the build behind the server entrypoint, preserving existing config wrappers such as Sentry. For Python, this is a runtime upgrade to 3.12+; report it rather than attempting it.
|
|
32483
32205
|
- **Instrumented but no traces**: the app hasn't run with tracing enabled, or \`BITFAB_API_KEY\` isn't set in the run environment. Run the app with the key loaded.
|
|
32484
32206
|
- **Key set but traces aren't visible in the browser**: the API key is bound to a different Clerk org/tenant than the browser session. A key resolves \`API key \u2192 organization_id \u2192 clerk_organization_id \u2192 Clerk tenant\` at creation time; browser visibility requires both to be the same tenant.
|
|
32485
32207
|
- **Nothing instrumented**: run \`{{cmd}}setup instrument\`.
|
|
@@ -32532,7 +32254,7 @@ Then continue to the fix prompt. Inspect does not open Bitfab.`,
|
|
|
32532
32254
|
- **SDK out of date** (\`updateAvailable: true\`, \`renameFrom\` null), name the workspace and the \`current \u2192 latest\` jump, then {{askVerb}} to upgrade; if yes, run the package manager's upgrade from that workspace directory (the same commands \`{{cmd}}update\` uses): npm / pnpm / yarn / bun \`add @bitfab/sdk@latest\`; uv / poetry / pip \`bitfab-py@latest\`; \`bundle update bitfab\`; \`go get github.com/Project-White-Rabbit/bitfab-go@latest && go mod tidy\`. Read the manifest afterward to confirm the new version. Each workspace is its own decision.
|
|
32533
32255
|
- **On the legacy \`bitfab\` package** (\`renameFrom\` non-null), this rewrites import sites, so **preview before touching code**: list every \`from "bitfab"\` / \`require("bitfab")\` site you would change, then {{askVerb}} to proceed. If yes, remove the old package and add the new one in one step (e.g. \`pnpm remove bitfab && pnpm add @bitfab/sdk@latest\`, or the npm / yarn / bun equivalent) and rewrite those imports to \`@bitfab/sdk\`. Do this even when \`current\` already equals \`latest\`, the rename is the fix. (TypeScript-only; Python / Ruby / Go package names don't change.)
|
|
32534
32256
|
- **Replay missing or incomplete**: {{askVerb}} to refresh; if yes, run \`{{cmd}}setup replay\` to create or extend the scripts so every trace function key is covered (it is non-interactive).
|
|
32535
|
-
- **Subtree capture not wired** (TypeScript), this edits a build file, so **preview before touching code**: name the workspace, the adapter you would use, and the exact config file or start script you would change, then {{askVerb}} to proceed. If yes,
|
|
32257
|
+
- **Subtree capture not wired** (TypeScript), this edits a build file, so **preview before touching code**: name the workspace, the adapter you would use, and the exact config file or start script you would change, then {{askVerb}} to proceed. If yes, use the installed SDK and wire the matching \`@bitfab/sdk/transform\` adapter: \`@bitfab/sdk/transform/next\` wrapping the existing \`next.config\`, the \`/vite\`, \`/rollup\`, \`/rolldown\`, \`/esbuild\`, \`/bun\`, \`/webpack\`, \`/rspack\`, \`/rsbuild\`, \`/babel\`, \`/nest\`, or \`/typescript\` entry in the existing build config, or \`--import @bitfab/sdk/transform/register\` on the real start command. Preserve every existing wrapper; never replace or bypass one. Python below 3.12 is a runtime upgrade, report it and do not attempt it.
|
|
32536
32258
|
|
|
32537
32259
|
For unusual monorepos or private registries, defer to \`{{cmd}}update\`. Report what was applied and what the user declined. Do not open Bitfab.`,
|
|
32538
32260
|
next: "cleanup/finish"
|
|
@@ -45700,7 +45422,7 @@ import * as p8 from "@clack/prompts";
|
|
|
45700
45422
|
|
|
45701
45423
|
// src/setupV2Verification.ts
|
|
45702
45424
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
45703
|
-
import { existsSync as
|
|
45425
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4 } from "fs";
|
|
45704
45426
|
import { basename, relative, resolve as resolve4 } from "path";
|
|
45705
45427
|
var MUTATING_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write"]);
|
|
45706
45428
|
var CODE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
@@ -45857,7 +45579,7 @@ function importedSourcePaths(registryPath, source, sourcePaths) {
|
|
|
45857
45579
|
}
|
|
45858
45580
|
function projectTypecheckCoversRegistry(cwd, registryPath) {
|
|
45859
45581
|
const configPath = resolve4(cwd, "tsconfig.json");
|
|
45860
|
-
if (!
|
|
45582
|
+
if (!existsSync3(configPath)) {
|
|
45861
45583
|
return false;
|
|
45862
45584
|
}
|
|
45863
45585
|
const config4 = readFileSync4(configPath, "utf8");
|
|
@@ -45954,7 +45676,7 @@ var SetupV2VerificationGate = class {
|
|
|
45954
45676
|
candidatePaths.add(path15);
|
|
45955
45677
|
}
|
|
45956
45678
|
}
|
|
45957
|
-
const readableFiles = [...candidatePaths].filter((path15) =>
|
|
45679
|
+
const readableFiles = [...candidatePaths].filter((path15) => existsSync3(path15));
|
|
45958
45680
|
const sources = /* @__PURE__ */ new Map();
|
|
45959
45681
|
const issues = [];
|
|
45960
45682
|
for (const path15 of readableFiles) {
|
package/package.json
CHANGED