@get-bb/plugin-sdk 0.6.79 → 0.6.89
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/README.md +26 -23
- package/bundled-types/bb-plugin-sdk-app.d.ts +1009 -896
- package/bundled-types/bb-plugin-sdk-internal-file-navigation-validation.d.ts +7 -0
- package/bundled-types/bb-plugin-sdk-process.d.ts +61 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +40 -21
- package/bundled-types/bb-plugin-sdk-testing.d.ts +11 -0
- package/bundled-types/bb-plugin-sdk.d.ts +1006 -894
- package/dist/app.js +4 -0
- package/dist/host.js +557 -13
- package/dist/index.js +1 -1
- package/dist/internal/file-navigation-validation.js +14 -3
- package/dist/internal/host-policy.js +1 -1
- package/dist/internal/plugin-app-collector.js +11 -3
- package/dist/internal/rpc-query-host.js +333 -489
- package/dist/process.js +694 -0
- package/dist/provider-bridge-acp-next.js +724 -317
- package/dist/provider-bridge-acp.js +724 -317
- package/dist/provider-bridge-testing.js +677 -43
- package/dist/provider-bridge-worker-entry.mjs +534 -66
- package/dist/provider-bridge.js +605 -212
- package/dist/testing/app.js +563 -617
- package/dist/testing/index.js +126 -108
- package/package.json +7 -1
|
@@ -6319,13 +6319,647 @@ function describeCalibrationEvents(events) {
|
|
|
6319
6319
|
});
|
|
6320
6320
|
}
|
|
6321
6321
|
|
|
6322
|
+
// ../process-utils/src/host-process.ts
|
|
6323
|
+
import parse from "cross-spawn/lib/parse.js";
|
|
6324
|
+
import {
|
|
6325
|
+
spawn as nodeSpawn,
|
|
6326
|
+
fork as nodeFork,
|
|
6327
|
+
execFile as nodeExecFile
|
|
6328
|
+
} from "node:child_process";
|
|
6329
|
+
import crossSpawn from "cross-spawn";
|
|
6330
|
+
|
|
6331
|
+
// ../process-utils/src/host-toolchain.ts
|
|
6332
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
6333
|
+
import {
|
|
6334
|
+
accessSync,
|
|
6335
|
+
constants,
|
|
6336
|
+
existsSync,
|
|
6337
|
+
readdirSync,
|
|
6338
|
+
realpathSync,
|
|
6339
|
+
statSync
|
|
6340
|
+
} from "node:fs";
|
|
6341
|
+
import { createRequire } from "node:module";
|
|
6342
|
+
import { homedir } from "node:os";
|
|
6343
|
+
import {
|
|
6344
|
+
basename,
|
|
6345
|
+
delimiter,
|
|
6346
|
+
dirname,
|
|
6347
|
+
extname,
|
|
6348
|
+
isAbsolute,
|
|
6349
|
+
join
|
|
6350
|
+
} from "node:path";
|
|
6351
|
+
import { fileURLToPath } from "node:url";
|
|
6352
|
+
|
|
6353
|
+
// ../../node_modules/.pnpm/which-command@0.1.0/node_modules/which-command/index.js
|
|
6354
|
+
import fs from "node:fs";
|
|
6355
|
+
import path from "node:path";
|
|
6356
|
+
import process2 from "node:process";
|
|
6357
|
+
var isWindows = process2.platform === "win32";
|
|
6358
|
+
var separatorPattern = isWindows ? new RegExp("[\\/\\\\]", "v") : new RegExp("\\/", "v");
|
|
6359
|
+
var defaultPathExt = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";
|
|
6360
|
+
function resolveOptions(command, options) {
|
|
6361
|
+
if (typeof command !== "string" || command.length === 0) {
|
|
6362
|
+
throw new TypeError("Expected a non-empty string.");
|
|
6363
|
+
}
|
|
6364
|
+
const {
|
|
6365
|
+
cwd = process2.cwd(),
|
|
6366
|
+
// On Windows, `process.env.PATH` can be undefined in some contexts (for example, worker threads), where it's only exposed as `Path`.
|
|
6367
|
+
path: searchPath = process2.env.PATH ?? (isWindows ? process2.env.Path : void 0) ?? "",
|
|
6368
|
+
// `||` (not `??`) so an empty `PATHEXT` falls back to the default instead of disabling all lookup on Windows.
|
|
6369
|
+
pathExt = process2.env.PATHEXT || defaultPathExt
|
|
6370
|
+
} = options;
|
|
6371
|
+
return { cwd, searchPath, pathExt };
|
|
6372
|
+
}
|
|
6373
|
+
function windowsExtensions(command, pathExt) {
|
|
6374
|
+
const extensions = pathExt.split(path.delimiter).filter(Boolean);
|
|
6375
|
+
const commandExtension = path.extname(command).toLowerCase();
|
|
6376
|
+
if (commandExtension !== "" && extensions.some((extension) => extension.toLowerCase() === commandExtension)) {
|
|
6377
|
+
return ["", ...extensions];
|
|
6378
|
+
}
|
|
6379
|
+
return extensions;
|
|
6380
|
+
}
|
|
6381
|
+
function* candidatePaths(command, { cwd, searchPath, pathExt }) {
|
|
6382
|
+
const extensions = isWindows ? windowsExtensions(command, pathExt) : [""];
|
|
6383
|
+
if (separatorPattern.test(command)) {
|
|
6384
|
+
const base = path.resolve(cwd, command);
|
|
6385
|
+
for (const extension of extensions) {
|
|
6386
|
+
yield base + extension;
|
|
6387
|
+
}
|
|
6388
|
+
return;
|
|
6389
|
+
}
|
|
6390
|
+
const directories = [
|
|
6391
|
+
// Windows searches the current directory before `PATH`.
|
|
6392
|
+
...isWindows ? [cwd] : [],
|
|
6393
|
+
...searchPath.split(path.delimiter)
|
|
6394
|
+
];
|
|
6395
|
+
for (const directory of directories) {
|
|
6396
|
+
const unquoted = isWindows && directory.length > 1 && directory.startsWith('"') && directory.endsWith('"') ? directory.slice(1, -1) : directory;
|
|
6397
|
+
if (unquoted === "") {
|
|
6398
|
+
continue;
|
|
6399
|
+
}
|
|
6400
|
+
const base = path.resolve(cwd, unquoted, command);
|
|
6401
|
+
for (const extension of extensions) {
|
|
6402
|
+
yield base + extension;
|
|
6403
|
+
}
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
function isExecutableSync(filePath) {
|
|
6407
|
+
let stats;
|
|
6408
|
+
try {
|
|
6409
|
+
stats = fs.statSync(filePath);
|
|
6410
|
+
} catch (error) {
|
|
6411
|
+
return isWindows && error.code === "EACCES";
|
|
6412
|
+
}
|
|
6413
|
+
if (!stats.isFile()) {
|
|
6414
|
+
return false;
|
|
6415
|
+
}
|
|
6416
|
+
if (isWindows) {
|
|
6417
|
+
return true;
|
|
6418
|
+
}
|
|
6419
|
+
try {
|
|
6420
|
+
fs.accessSync(filePath, fs.constants.X_OK);
|
|
6421
|
+
return true;
|
|
6422
|
+
} catch {
|
|
6423
|
+
return false;
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
function whichCommandSync(command, options = {}) {
|
|
6427
|
+
const resolved = resolveOptions(command, options);
|
|
6428
|
+
for (const candidate of candidatePaths(command, resolved)) {
|
|
6429
|
+
if (isExecutableSync(candidate)) {
|
|
6430
|
+
return candidate;
|
|
6431
|
+
}
|
|
6432
|
+
}
|
|
6433
|
+
return void 0;
|
|
6434
|
+
}
|
|
6435
|
+
|
|
6436
|
+
// ../process-utils/src/host-toolchain.ts
|
|
6437
|
+
var NETWORK_KEYS = [
|
|
6438
|
+
"HTTP_PROXY",
|
|
6439
|
+
"HTTPS_PROXY",
|
|
6440
|
+
"NO_PROXY",
|
|
6441
|
+
"http_proxy",
|
|
6442
|
+
"https_proxy",
|
|
6443
|
+
"no_proxy",
|
|
6444
|
+
"NODE_EXTRA_CA_CERTS",
|
|
6445
|
+
"SSL_CERT_FILE",
|
|
6446
|
+
"SSL_CERT_DIR"
|
|
6447
|
+
];
|
|
6448
|
+
var SHELL_START = "__BB_SHELL_ENV_START__";
|
|
6449
|
+
var SHELL_END = "__BB_SHELL_ENV_END__";
|
|
6450
|
+
var PROBE_TIMEOUT_MS = 3e3;
|
|
6451
|
+
var PROBE_OUTPUT_MAX_CHARS = 1024 * 1024;
|
|
6452
|
+
function executable(file) {
|
|
6453
|
+
try {
|
|
6454
|
+
accessSync(
|
|
6455
|
+
file,
|
|
6456
|
+
process.platform === "win32" ? constants.F_OK : constants.X_OK
|
|
6457
|
+
);
|
|
6458
|
+
return statSync(file).isFile();
|
|
6459
|
+
} catch {
|
|
6460
|
+
return false;
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
function envValue(env, key) {
|
|
6464
|
+
if (process.platform !== "win32") return env[key];
|
|
6465
|
+
return env[Object.keys(env).find(
|
|
6466
|
+
(entry) => entry.toUpperCase() === key.toUpperCase()
|
|
6467
|
+
) ?? key];
|
|
6468
|
+
}
|
|
6469
|
+
function mergePath(...paths) {
|
|
6470
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6471
|
+
return paths.flatMap((value) => (value ?? "").split(delimiter)).filter((entry) => {
|
|
6472
|
+
if (!entry) return false;
|
|
6473
|
+
const key = process.platform === "win32" ? entry.replace(/[\\/]+$/u, "").toLowerCase() : entry;
|
|
6474
|
+
if (seen.has(key)) return false;
|
|
6475
|
+
seen.add(key);
|
|
6476
|
+
return true;
|
|
6477
|
+
}).join(delimiter);
|
|
6478
|
+
}
|
|
6479
|
+
function onDiskName(file) {
|
|
6480
|
+
if (process.platform !== "win32") return file;
|
|
6481
|
+
try {
|
|
6482
|
+
const name = basename(file).toLowerCase();
|
|
6483
|
+
const entry = readdirSync(dirname(file)).find(
|
|
6484
|
+
(candidate) => candidate.toLowerCase() === name
|
|
6485
|
+
);
|
|
6486
|
+
return entry === void 0 ? file : join(dirname(file), entry);
|
|
6487
|
+
} catch {
|
|
6488
|
+
return file;
|
|
6489
|
+
}
|
|
6490
|
+
}
|
|
6491
|
+
function runProbe(command, args, env) {
|
|
6492
|
+
return new Promise((resolve3) => {
|
|
6493
|
+
let stdout = "";
|
|
6494
|
+
let settled = false;
|
|
6495
|
+
let timer;
|
|
6496
|
+
const finish = (status) => {
|
|
6497
|
+
if (settled) return;
|
|
6498
|
+
settled = true;
|
|
6499
|
+
clearTimeout(timer);
|
|
6500
|
+
resolve3({ status, stdout });
|
|
6501
|
+
};
|
|
6502
|
+
let child;
|
|
6503
|
+
try {
|
|
6504
|
+
child = spawn(command, args, {
|
|
6505
|
+
cwd: homedir(),
|
|
6506
|
+
env,
|
|
6507
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
6508
|
+
windowsHide: true
|
|
6509
|
+
});
|
|
6510
|
+
} catch {
|
|
6511
|
+
finish(null);
|
|
6512
|
+
return;
|
|
6513
|
+
}
|
|
6514
|
+
timer = setTimeout(() => {
|
|
6515
|
+
child.kill("SIGKILL");
|
|
6516
|
+
finish(null);
|
|
6517
|
+
}, PROBE_TIMEOUT_MS);
|
|
6518
|
+
child.stdout?.setEncoding("utf8");
|
|
6519
|
+
child.stdout?.on("data", (chunk) => {
|
|
6520
|
+
if (stdout.length < PROBE_OUTPUT_MAX_CHARS) stdout += chunk;
|
|
6521
|
+
});
|
|
6522
|
+
child.once("error", () => finish(null));
|
|
6523
|
+
child.once("close", (code) => finish(code));
|
|
6524
|
+
});
|
|
6525
|
+
}
|
|
6526
|
+
async function readShellEnvironment(env, retainPrevious) {
|
|
6527
|
+
if (process.platform === "win32") {
|
|
6528
|
+
const registry2 = join(
|
|
6529
|
+
envValue(env, "SystemRoot") ?? "C:\\Windows",
|
|
6530
|
+
"System32",
|
|
6531
|
+
"reg.exe"
|
|
6532
|
+
);
|
|
6533
|
+
const values = { ...env };
|
|
6534
|
+
const paths = [];
|
|
6535
|
+
for (const key of [
|
|
6536
|
+
"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
|
|
6537
|
+
"HKCU\\Environment"
|
|
6538
|
+
]) {
|
|
6539
|
+
const result2 = await runProbe(registry2, ["query", key], env);
|
|
6540
|
+
if (result2.status !== 0) continue;
|
|
6541
|
+
for (const match of result2.stdout.matchAll(
|
|
6542
|
+
/^ {4}(.+?) {4}REG_[A-Z_]+ {4}(.*)$/gmu
|
|
6543
|
+
)) {
|
|
6544
|
+
const name = match[1]?.trim();
|
|
6545
|
+
if (!name) continue;
|
|
6546
|
+
const value = (match[2] ?? "").trim();
|
|
6547
|
+
if (name.toUpperCase() === "PATH") paths.push(value);
|
|
6548
|
+
else {
|
|
6549
|
+
const existing = Object.keys(values).find(
|
|
6550
|
+
(key2) => key2.toUpperCase() === name.toUpperCase()
|
|
6551
|
+
);
|
|
6552
|
+
values[existing ?? name] = value;
|
|
6553
|
+
}
|
|
6554
|
+
}
|
|
6555
|
+
}
|
|
6556
|
+
const expand = (value) => {
|
|
6557
|
+
for (let depth = 0; depth < 10; depth += 1) {
|
|
6558
|
+
const expanded = value.replace(
|
|
6559
|
+
/%([^%;\\/]+)%/gu,
|
|
6560
|
+
(reference, variable) => envValue(values, variable) ?? reference
|
|
6561
|
+
);
|
|
6562
|
+
if (expanded === value) break;
|
|
6563
|
+
value = expanded;
|
|
6564
|
+
}
|
|
6565
|
+
return value;
|
|
6566
|
+
};
|
|
6567
|
+
return paths.length === 0 ? null : { PATH: mergePath(...paths.map(expand), envValue(env, "PATH")) };
|
|
6568
|
+
}
|
|
6569
|
+
const shell = env.SHELL?.trim() || (process.platform === "darwin" ? "/bin/zsh" : "/bin/sh");
|
|
6570
|
+
const command = `printf '%s\\n' ${SHELL_START}; /usr/bin/env; printf '%s\\n' ${SHELL_END}`;
|
|
6571
|
+
const shellArgs = ["sh", "dash"].includes(basename(shell)) ? ["-lc"] : ["-ilc", "-lc"];
|
|
6572
|
+
for (const arg of shellArgs) {
|
|
6573
|
+
const result2 = await runProbe(shell, [arg, command], env);
|
|
6574
|
+
if (result2.status !== 0) {
|
|
6575
|
+
if (retainPrevious) return null;
|
|
6576
|
+
continue;
|
|
6577
|
+
}
|
|
6578
|
+
const start = result2.stdout.indexOf(`${SHELL_START}
|
|
6579
|
+
`);
|
|
6580
|
+
const end = result2.stdout.indexOf(`
|
|
6581
|
+
${SHELL_END}`, start);
|
|
6582
|
+
if (start < 0 || end < 0) {
|
|
6583
|
+
if (retainPrevious) return null;
|
|
6584
|
+
continue;
|
|
6585
|
+
}
|
|
6586
|
+
const values = {};
|
|
6587
|
+
for (const line of result2.stdout.slice(start + SHELL_START.length + 1, end).split("\n")) {
|
|
6588
|
+
const separator = line.indexOf("=");
|
|
6589
|
+
const key = line.slice(0, separator);
|
|
6590
|
+
if (key === "PATH" || NETWORK_KEYS.includes(key))
|
|
6591
|
+
values[key] = line.slice(separator + 1);
|
|
6592
|
+
}
|
|
6593
|
+
if (values.PATH) return values;
|
|
6594
|
+
}
|
|
6595
|
+
return null;
|
|
6596
|
+
}
|
|
6597
|
+
var HostToolchain = class {
|
|
6598
|
+
constructor(baseEnv = process.env, runtimePath = process.execPath) {
|
|
6599
|
+
this.baseEnv = baseEnv;
|
|
6600
|
+
this.runtimePath = runtimePath;
|
|
6601
|
+
this.inheritedPath = envValue(baseEnv, "PATH");
|
|
6602
|
+
this.nodePath = runtimePath;
|
|
6603
|
+
}
|
|
6604
|
+
baseEnv;
|
|
6605
|
+
runtimePath;
|
|
6606
|
+
shellEnv = {};
|
|
6607
|
+
inheritedPath;
|
|
6608
|
+
misses = /* @__PURE__ */ new Set();
|
|
6609
|
+
nodePath;
|
|
6610
|
+
refreshing = null;
|
|
6611
|
+
refreshedAt = 0;
|
|
6612
|
+
refresh() {
|
|
6613
|
+
if (this.refreshing !== null) return this.refreshing;
|
|
6614
|
+
this.misses.clear();
|
|
6615
|
+
this.refreshedAt = Date.now();
|
|
6616
|
+
const retainPrevious = this.shellEnv.PATH !== void 0;
|
|
6617
|
+
this.refreshing = readShellEnvironment(this.baseEnv, retainPrevious).then((env) => {
|
|
6618
|
+
if (env !== null) this.shellEnv = env;
|
|
6619
|
+
}).finally(() => {
|
|
6620
|
+
this.refreshing = null;
|
|
6621
|
+
});
|
|
6622
|
+
return this.refreshing;
|
|
6623
|
+
}
|
|
6624
|
+
invalidateFailure(errorOrCode) {
|
|
6625
|
+
const code = typeof errorOrCode === "object" && errorOrCode !== null && "code" in errorOrCode ? errorOrCode.code : errorOrCode;
|
|
6626
|
+
if (code === "ENOENT" || code === 127) void this.refresh();
|
|
6627
|
+
}
|
|
6628
|
+
searchPath(env) {
|
|
6629
|
+
const inherited = envValue(env, "PATH");
|
|
6630
|
+
const home = envValue(env, process.platform === "win32" ? "USERPROFILE" : "HOME") ?? homedir();
|
|
6631
|
+
const fallbacks = [
|
|
6632
|
+
join(home, ".local", "bin"),
|
|
6633
|
+
join(home, ".local", "share", "mise", "shims"),
|
|
6634
|
+
join(home, ".asdf", "shims"),
|
|
6635
|
+
join(home, ".asdf", "bin"),
|
|
6636
|
+
join(home, ".volta", "bin")
|
|
6637
|
+
];
|
|
6638
|
+
if (process.platform === "darwin") fallbacks.push("/opt/homebrew/bin");
|
|
6639
|
+
if (process.platform !== "win32")
|
|
6640
|
+
fallbacks.push("/usr/local/bin", "/usr/bin", "/bin");
|
|
6641
|
+
const [first, second] = inherited === void 0 || inherited === this.inheritedPath ? [this.shellEnv.PATH, inherited] : [inherited, this.shellEnv.PATH];
|
|
6642
|
+
return mergePath(
|
|
6643
|
+
first,
|
|
6644
|
+
second,
|
|
6645
|
+
executable(this.nodePath) && /^node(?:\.exe)?$/iu.test(basename(this.nodePath)) ? dirname(this.nodePath) : void 0,
|
|
6646
|
+
...fallbacks
|
|
6647
|
+
);
|
|
6648
|
+
}
|
|
6649
|
+
environment(env = this.baseEnv) {
|
|
6650
|
+
const path2 = this.searchPath(env);
|
|
6651
|
+
const result2 = { ...env };
|
|
6652
|
+
if (process.platform === "win32") {
|
|
6653
|
+
for (const key of Object.keys(result2))
|
|
6654
|
+
if (key !== "PATH" && key.toUpperCase() === "PATH") delete result2[key];
|
|
6655
|
+
}
|
|
6656
|
+
if (path2 !== "") result2.PATH = path2;
|
|
6657
|
+
const callerKeys = new Set(
|
|
6658
|
+
Object.keys(env).filter((key) => env[key] !== void 0).map((key) => key.toUpperCase())
|
|
6659
|
+
);
|
|
6660
|
+
for (const key of NETWORK_KEYS)
|
|
6661
|
+
if (!callerKeys.has(key.toUpperCase()) && this.shellEnv[key] !== void 0)
|
|
6662
|
+
result2[key] = this.shellEnv[key];
|
|
6663
|
+
return result2;
|
|
6664
|
+
}
|
|
6665
|
+
lookup(command, options) {
|
|
6666
|
+
const env = this.environment(options.env);
|
|
6667
|
+
const cwd = options.cwd instanceof URL ? fileURLToPath(options.cwd) : options.cwd ?? process.cwd();
|
|
6668
|
+
if (command === "bb") {
|
|
6669
|
+
for (const candidate of [
|
|
6670
|
+
env.BB_CLI_LAUNCHER,
|
|
6671
|
+
env.BB_CLI,
|
|
6672
|
+
env.BB_CLI_DIR ? join(env.BB_CLI_DIR, "bb") : void 0
|
|
6673
|
+
]) {
|
|
6674
|
+
if (candidate?.trim() && isAbsolute(candidate.trim()) && executable(candidate.trim()))
|
|
6675
|
+
return candidate.trim();
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
const extension = extname(command);
|
|
6679
|
+
const pathExt = envValue(env, "PATHEXT");
|
|
6680
|
+
const path2 = envValue(env, "PATH") ?? "";
|
|
6681
|
+
const lookupOptions = {
|
|
6682
|
+
cwd,
|
|
6683
|
+
path: path2,
|
|
6684
|
+
pathExt: extension ? `${extension};${pathExt ?? ".EXE;.COM;.CMD;.BAT"}` : pathExt
|
|
6685
|
+
};
|
|
6686
|
+
const found = command === "bb" ? path2.split(delimiter).filter(isAbsolute).map(
|
|
6687
|
+
(directory) => whichCommandSync(join(directory, command), lookupOptions)
|
|
6688
|
+
).find(Boolean) : whichCommandSync(command, lookupOptions);
|
|
6689
|
+
return found ? onDiskName(found) : null;
|
|
6690
|
+
}
|
|
6691
|
+
resolve(command, options = {}) {
|
|
6692
|
+
const found = this.lookup(command, options);
|
|
6693
|
+
if (found !== null) return found;
|
|
6694
|
+
const key = `${command}\0${String(options.cwd ?? "")}\0${envValue(options.env ?? this.baseEnv, "PATH") ?? ""}`;
|
|
6695
|
+
const sinceRefresh = Date.now() - this.refreshedAt;
|
|
6696
|
+
if (!(this.misses.has(key) && sinceRefresh < 3e4) && (this.misses.size === 0 || sinceRefresh >= 1e3))
|
|
6697
|
+
void this.refresh();
|
|
6698
|
+
this.misses.add(key);
|
|
6699
|
+
return null;
|
|
6700
|
+
}
|
|
6701
|
+
node(options = {}) {
|
|
6702
|
+
if (executable(this.nodePath)) return this.nodePath;
|
|
6703
|
+
const stableHomebrew = this.runtimePath.replace(
|
|
6704
|
+
/\/Cellar\/([^/]+)\/[^/]+\//u,
|
|
6705
|
+
"/opt/$1/"
|
|
6706
|
+
);
|
|
6707
|
+
const candidates = [
|
|
6708
|
+
stableHomebrew,
|
|
6709
|
+
process.argv0,
|
|
6710
|
+
this.lookup(process.platform === "win32" ? "node.exe" : "node", options)
|
|
6711
|
+
];
|
|
6712
|
+
for (const candidate of candidates) {
|
|
6713
|
+
if (!candidate || !isAbsolute(candidate) || !executable(candidate))
|
|
6714
|
+
continue;
|
|
6715
|
+
const probe = spawnSync(
|
|
6716
|
+
candidate,
|
|
6717
|
+
[
|
|
6718
|
+
"-p",
|
|
6719
|
+
"JSON.stringify({path:process.execPath,abi:process.versions.modules,electron:!!process.versions.electron})"
|
|
6720
|
+
],
|
|
6721
|
+
{
|
|
6722
|
+
env: this.environment(options.env),
|
|
6723
|
+
cwd: options.cwd,
|
|
6724
|
+
encoding: "utf8",
|
|
6725
|
+
timeout: PROBE_TIMEOUT_MS,
|
|
6726
|
+
killSignal: "SIGKILL",
|
|
6727
|
+
windowsHide: true
|
|
6728
|
+
}
|
|
6729
|
+
);
|
|
6730
|
+
if (probe.status !== 0) continue;
|
|
6731
|
+
try {
|
|
6732
|
+
const runtime = JSON.parse(probe.stdout.trim());
|
|
6733
|
+
if (typeof runtime !== "object" || runtime === null || !("path" in runtime) || typeof runtime.path !== "string" || !("abi" in runtime) || runtime.abi !== process.versions.modules || !("electron" in runtime) || runtime.electron !== Boolean(process.versions.electron))
|
|
6734
|
+
continue;
|
|
6735
|
+
if (isAbsolute(runtime.path) && executable(runtime.path)) {
|
|
6736
|
+
this.nodePath = runtime.path;
|
|
6737
|
+
return runtime.path;
|
|
6738
|
+
}
|
|
6739
|
+
} catch {
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
throw Object.assign(
|
|
6743
|
+
new Error(
|
|
6744
|
+
"The Node runtime was removed and no replacement was found. Reinstall Node or restart bb with an available runtime."
|
|
6745
|
+
),
|
|
6746
|
+
{ code: "ENOENT" }
|
|
6747
|
+
);
|
|
6748
|
+
}
|
|
6749
|
+
bundledNpmCli(command = "npm") {
|
|
6750
|
+
const require2 = createRequire(import.meta.url);
|
|
6751
|
+
return join(
|
|
6752
|
+
dirname(require2.resolve("npm/package.json")),
|
|
6753
|
+
"bin",
|
|
6754
|
+
`${command}-cli.js`
|
|
6755
|
+
);
|
|
6756
|
+
}
|
|
6757
|
+
npmCli(command = "npm", options = {}) {
|
|
6758
|
+
const bin = `${command}-cli.js`;
|
|
6759
|
+
const runtime = process.versions.electron ? null : this.node(options);
|
|
6760
|
+
const candidates = [];
|
|
6761
|
+
if (runtime !== null)
|
|
6762
|
+
for (const cli of [
|
|
6763
|
+
join(dirname(runtime), "..", "lib", "node_modules", "npm", "bin", bin),
|
|
6764
|
+
join(dirname(runtime), "node_modules", "npm", "bin", bin)
|
|
6765
|
+
])
|
|
6766
|
+
candidates.push({ node: runtime, cli });
|
|
6767
|
+
const installed = this.resolve(command, options);
|
|
6768
|
+
if (installed) {
|
|
6769
|
+
try {
|
|
6770
|
+
const cli = realpathSync(installed);
|
|
6771
|
+
const npmRoot = dirname(dirname(cli));
|
|
6772
|
+
const node = [
|
|
6773
|
+
join(npmRoot, "..", "..", "..", "bin", "node"),
|
|
6774
|
+
join(npmRoot, "..", "..", "node.exe"),
|
|
6775
|
+
join(dirname(installed), "node")
|
|
6776
|
+
].find(executable);
|
|
6777
|
+
if (basename(cli) === bin && node !== void 0)
|
|
6778
|
+
candidates.push({ node: realpathSync(node), cli });
|
|
6779
|
+
} catch {
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
if (runtime !== null) {
|
|
6783
|
+
try {
|
|
6784
|
+
candidates.push({ node: runtime, cli: this.bundledNpmCli(command) });
|
|
6785
|
+
} catch {
|
|
6786
|
+
}
|
|
6787
|
+
}
|
|
6788
|
+
return candidates.find((candidate) => existsSync(candidate.cli)) ?? null;
|
|
6789
|
+
}
|
|
6790
|
+
command(command, args = [], options = {}) {
|
|
6791
|
+
const file = command === this.runtimePath ? this.node(options) : this.resolve(command, options) ?? command;
|
|
6792
|
+
const env = this.environment(options.env);
|
|
6793
|
+
if (/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(args[0] ?? "")) {
|
|
6794
|
+
env.PATH = mergePath(dirname(file), env.PATH);
|
|
6795
|
+
}
|
|
6796
|
+
return { command: file, args: [...args], env };
|
|
6797
|
+
}
|
|
6798
|
+
};
|
|
6799
|
+
var toolchainKey = /* @__PURE__ */ Symbol.for("@bb/process-utils/host-toolchain");
|
|
6800
|
+
var shared = globalThis;
|
|
6801
|
+
var hostToolchain = shared[toolchainKey] ??= new HostToolchain();
|
|
6802
|
+
|
|
6803
|
+
// ../process-utils/src/host-process.ts
|
|
6804
|
+
function observe(child) {
|
|
6805
|
+
child.once("error", (error) => hostToolchain.invalidateFailure(error));
|
|
6806
|
+
child.once("exit", (code) => hostToolchain.invalidateFailure(code));
|
|
6807
|
+
return child;
|
|
6808
|
+
}
|
|
6809
|
+
function spawnHostProcess(command, args = [], options = {}) {
|
|
6810
|
+
const launch = options.shell ? { command, args: [...args], env: hostToolchain.environment(options.env) } : hostToolchain.command(command, args, options);
|
|
6811
|
+
const spawn2 = options.shell ? nodeSpawn : crossSpawn;
|
|
6812
|
+
return observe(
|
|
6813
|
+
spawn2(launch.command, launch.args, {
|
|
6814
|
+
...options,
|
|
6815
|
+
env: launch.env,
|
|
6816
|
+
windowsHide: options.windowsHide ?? true
|
|
6817
|
+
})
|
|
6818
|
+
);
|
|
6819
|
+
}
|
|
6820
|
+
|
|
6821
|
+
// ../process-utils/src/vcs-process-scheduler.ts
|
|
6822
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6823
|
+
import { availableParallelism } from "node:os";
|
|
6824
|
+
var ranks = { interactive: 0, status: 1, background: 2 };
|
|
6825
|
+
function localProcessCapacities(parallelism) {
|
|
6826
|
+
const total = Math.min(6, Math.max(4, parallelism - 2));
|
|
6827
|
+
return [total, total - 1, total - 2];
|
|
6828
|
+
}
|
|
6829
|
+
var capacities = {
|
|
6830
|
+
local: localProcessCapacities(availableParallelism()),
|
|
6831
|
+
network: [4, 3, 2]
|
|
6832
|
+
};
|
|
6833
|
+
var githubCapacity = 2;
|
|
6834
|
+
var agingMs = 15e3;
|
|
6835
|
+
var networkGitSubcommands = /* @__PURE__ */ new Set([
|
|
6836
|
+
"fetch",
|
|
6837
|
+
"pull",
|
|
6838
|
+
"push",
|
|
6839
|
+
"clone",
|
|
6840
|
+
"ls-remote"
|
|
6841
|
+
]);
|
|
6842
|
+
var gitGlobalOptionsWithValue = /* @__PURE__ */ new Set([
|
|
6843
|
+
"-C",
|
|
6844
|
+
"-c",
|
|
6845
|
+
"--git-dir",
|
|
6846
|
+
"--work-tree",
|
|
6847
|
+
"--namespace",
|
|
6848
|
+
"--config-env"
|
|
6849
|
+
]);
|
|
6850
|
+
function isNetworkGitCommand(args) {
|
|
6851
|
+
let index = 0;
|
|
6852
|
+
while (index < args.length && args[index].startsWith("-")) {
|
|
6853
|
+
index += gitGlobalOptionsWithValue.has(args[index]) ? 2 : 1;
|
|
6854
|
+
}
|
|
6855
|
+
const subcommand = args[index];
|
|
6856
|
+
if (subcommand === void 0) return false;
|
|
6857
|
+
if (networkGitSubcommands.has(subcommand)) return true;
|
|
6858
|
+
const action = args.slice(index + 1).find((arg) => !arg.startsWith("-"));
|
|
6859
|
+
return (subcommand === "submodule" || subcommand === "remote") && action === "update";
|
|
6860
|
+
}
|
|
6861
|
+
var VcsProcessScheduler = class {
|
|
6862
|
+
priority = new AsyncLocalStorage();
|
|
6863
|
+
admitted = new AsyncLocalStorage();
|
|
6864
|
+
active = { local: 0, network: 0 };
|
|
6865
|
+
githubActive = 0;
|
|
6866
|
+
queue = [];
|
|
6867
|
+
timer;
|
|
6868
|
+
acquire(command, args, options) {
|
|
6869
|
+
const pool = command === "gh" || isNetworkGitCommand(args) ? "network" : "local";
|
|
6870
|
+
const slots = options.slots ?? 1;
|
|
6871
|
+
if (!Number.isInteger(slots) || slots < 1 || slots > capacities[pool][ranks.background]) {
|
|
6872
|
+
return Promise.reject(new Error("Invalid VCS process slot count"));
|
|
6873
|
+
}
|
|
6874
|
+
if (options.signal?.aborted) {
|
|
6875
|
+
return Promise.reject(this.abortError(options.signal));
|
|
6876
|
+
}
|
|
6877
|
+
return new Promise((grant, reject) => {
|
|
6878
|
+
const waiter = {
|
|
6879
|
+
command,
|
|
6880
|
+
pool,
|
|
6881
|
+
priority: options.priority ?? this.priority.getStore() ?? "status",
|
|
6882
|
+
slots,
|
|
6883
|
+
queuedAt: performance.now(),
|
|
6884
|
+
signal: options.signal,
|
|
6885
|
+
grant,
|
|
6886
|
+
onAbort: () => {
|
|
6887
|
+
const index = this.queue.indexOf(waiter);
|
|
6888
|
+
if (index === -1) return;
|
|
6889
|
+
this.queue.splice(index, 1);
|
|
6890
|
+
reject(this.abortError(options.signal));
|
|
6891
|
+
this.drain();
|
|
6892
|
+
}
|
|
6893
|
+
};
|
|
6894
|
+
this.queue.push(waiter);
|
|
6895
|
+
options.signal?.addEventListener("abort", waiter.onAbort, { once: true });
|
|
6896
|
+
this.drain();
|
|
6897
|
+
});
|
|
6898
|
+
}
|
|
6899
|
+
abortError(signal) {
|
|
6900
|
+
return Object.assign(
|
|
6901
|
+
new Error("The operation was aborted", { cause: signal?.reason }),
|
|
6902
|
+
{
|
|
6903
|
+
name: "AbortError",
|
|
6904
|
+
code: "ABORT_ERR"
|
|
6905
|
+
}
|
|
6906
|
+
);
|
|
6907
|
+
}
|
|
6908
|
+
rank(waiter) {
|
|
6909
|
+
return Math.max(
|
|
6910
|
+
0,
|
|
6911
|
+
ranks[waiter.priority] - Math.floor((performance.now() - waiter.queuedAt) / agingMs)
|
|
6912
|
+
);
|
|
6913
|
+
}
|
|
6914
|
+
drain() {
|
|
6915
|
+
clearTimeout(this.timer);
|
|
6916
|
+
this.queue.sort(
|
|
6917
|
+
(a, b) => this.rank(a) - this.rank(b) || a.queuedAt - b.queuedAt
|
|
6918
|
+
);
|
|
6919
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
6920
|
+
for (let index = 0; index < this.queue.length; ) {
|
|
6921
|
+
const waiter = this.queue[index];
|
|
6922
|
+
if (blocked.has(waiter.pool) || waiter.command === "gh" && this.githubActive + waiter.slots > githubCapacity) {
|
|
6923
|
+
index += 1;
|
|
6924
|
+
continue;
|
|
6925
|
+
}
|
|
6926
|
+
if (this.active[waiter.pool] + waiter.slots > capacities[waiter.pool][this.rank(waiter)]) {
|
|
6927
|
+
blocked.add(waiter.pool);
|
|
6928
|
+
index += 1;
|
|
6929
|
+
continue;
|
|
6930
|
+
}
|
|
6931
|
+
this.queue.splice(index, 1);
|
|
6932
|
+
waiter.signal?.removeEventListener("abort", waiter.onAbort);
|
|
6933
|
+
this.active[waiter.pool] += waiter.slots;
|
|
6934
|
+
if (waiter.command === "gh") this.githubActive += waiter.slots;
|
|
6935
|
+
let released = false;
|
|
6936
|
+
waiter.grant(() => {
|
|
6937
|
+
if (released) return;
|
|
6938
|
+
released = true;
|
|
6939
|
+
this.active[waiter.pool] -= waiter.slots;
|
|
6940
|
+
if (waiter.command === "gh") this.githubActive -= waiter.slots;
|
|
6941
|
+
this.drain();
|
|
6942
|
+
});
|
|
6943
|
+
}
|
|
6944
|
+
if (this.queue.length > 0) {
|
|
6945
|
+
const delay = Math.min(
|
|
6946
|
+
...this.queue.map(
|
|
6947
|
+
(waiter) => agingMs - (performance.now() - waiter.queuedAt) % agingMs
|
|
6948
|
+
)
|
|
6949
|
+
);
|
|
6950
|
+
this.timer = setTimeout(() => this.drain(), delay);
|
|
6951
|
+
}
|
|
6952
|
+
}
|
|
6953
|
+
};
|
|
6954
|
+
var registry = globalThis;
|
|
6955
|
+
var scheduler = registry.__bbVcsProcessScheduler ??= new VcsProcessScheduler();
|
|
6956
|
+
|
|
6322
6957
|
// ../provider-bridge-protocol/src/testing/parity.ts
|
|
6323
|
-
import {
|
|
6324
|
-
import { existsSync as existsSync2, mkdtempSync, realpathSync, writeFileSync } from "node:fs";
|
|
6958
|
+
import { existsSync as existsSync3, mkdtempSync, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
6325
6959
|
import { rm } from "node:fs/promises";
|
|
6326
6960
|
import { tmpdir } from "node:os";
|
|
6327
|
-
import { isAbsolute, join as
|
|
6328
|
-
import { fileURLToPath as
|
|
6961
|
+
import { isAbsolute as isAbsolute2, join as join3, resolve as resolve2 } from "node:path";
|
|
6962
|
+
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
6329
6963
|
|
|
6330
6964
|
// ../provider-bridge-protocol/src/bridge-kit/bounded-line-reader.ts
|
|
6331
6965
|
import { StringDecoder } from "node:string_decoder";
|
|
@@ -6379,9 +7013,9 @@ function readBoundedLines(args) {
|
|
|
6379
7013
|
}
|
|
6380
7014
|
|
|
6381
7015
|
// ../provider-bridge-protocol/src/testing/recording.ts
|
|
6382
|
-
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
6383
|
-
import { join, resolve } from "node:path";
|
|
6384
|
-
import { fileURLToPath } from "node:url";
|
|
7016
|
+
import { existsSync as existsSync2, readdirSync as readdirSync2, readFileSync, statSync as statSync2 } from "node:fs";
|
|
7017
|
+
import { join as join2, resolve } from "node:path";
|
|
7018
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6385
7019
|
|
|
6386
7020
|
// ../provider-bridge-protocol/src/bridge-kit/bridge-recorder.ts
|
|
6387
7021
|
var BRIDGE_RECORDING_DIRECTIONS = [
|
|
@@ -6395,7 +7029,7 @@ function bridgeRecordingFileName(direction) {
|
|
|
6395
7029
|
}
|
|
6396
7030
|
|
|
6397
7031
|
// ../provider-bridge-protocol/src/testing/recording.ts
|
|
6398
|
-
var COMMITTED_RECORDINGS_ROOT =
|
|
7032
|
+
var COMMITTED_RECORDINGS_ROOT = fileURLToPath2(
|
|
6399
7033
|
new URL("../../recordings", import.meta.url)
|
|
6400
7034
|
);
|
|
6401
7035
|
var RECORDINGS_CHECKOUT_ROOT = resolve(
|
|
@@ -6436,16 +7070,16 @@ function readLaneEntries(file, direction, laneLabel) {
|
|
|
6436
7070
|
return entries;
|
|
6437
7071
|
}
|
|
6438
7072
|
function readBridgeRecordingLane(dir, direction) {
|
|
6439
|
-
const file =
|
|
6440
|
-
if (!
|
|
7073
|
+
const file = join2(dir, bridgeRecordingFileName(direction));
|
|
7074
|
+
if (!existsSync2(file)) {
|
|
6441
7075
|
return [];
|
|
6442
7076
|
}
|
|
6443
7077
|
return readLaneEntries(file, direction, `${direction} lane`);
|
|
6444
7078
|
}
|
|
6445
7079
|
var CURRENT_BRIDGE_LANE_FILE = "bridge\u2192runtime.current.ndjson";
|
|
6446
7080
|
function readCurrentBridgeLane(dir) {
|
|
6447
|
-
const file =
|
|
6448
|
-
if (!
|
|
7081
|
+
const file = join2(dir, CURRENT_BRIDGE_LANE_FILE);
|
|
7082
|
+
if (!existsSync2(file)) {
|
|
6449
7083
|
return null;
|
|
6450
7084
|
}
|
|
6451
7085
|
return readLaneEntries(file, "bridge\u2192runtime", "current bridge lane");
|
|
@@ -6463,8 +7097,8 @@ function withCurrentBridgeLane(recording) {
|
|
|
6463
7097
|
return { ...recording, entries };
|
|
6464
7098
|
}
|
|
6465
7099
|
function readBridgeRecording(dir) {
|
|
6466
|
-
const manifestPath =
|
|
6467
|
-
const manifest =
|
|
7100
|
+
const manifestPath = join2(dir, "manifest.json");
|
|
7101
|
+
const manifest = existsSync2(manifestPath) ? JSON.parse(
|
|
6468
7102
|
readFileSync(manifestPath, "utf8")
|
|
6469
7103
|
) : null;
|
|
6470
7104
|
const entries = [];
|
|
@@ -6476,17 +7110,17 @@ function readBridgeRecording(dir) {
|
|
|
6476
7110
|
}
|
|
6477
7111
|
function listRecordedCells(root) {
|
|
6478
7112
|
const cells = [];
|
|
6479
|
-
if (!
|
|
7113
|
+
if (!existsSync2(root)) {
|
|
6480
7114
|
return cells;
|
|
6481
7115
|
}
|
|
6482
|
-
for (const provider of
|
|
6483
|
-
const providerDir =
|
|
6484
|
-
if (!
|
|
6485
|
-
for (const cell of
|
|
6486
|
-
const dir =
|
|
6487
|
-
if (!
|
|
7116
|
+
for (const provider of readdirSync2(root).sort()) {
|
|
7117
|
+
const providerDir = join2(root, provider);
|
|
7118
|
+
if (!statSync2(providerDir).isDirectory()) continue;
|
|
7119
|
+
for (const cell of readdirSync2(providerDir).sort()) {
|
|
7120
|
+
const dir = join2(providerDir, cell);
|
|
7121
|
+
if (!statSync2(dir).isDirectory()) continue;
|
|
6488
7122
|
const hasLane = BRIDGE_RECORDING_DIRECTIONS.some(
|
|
6489
|
-
(direction) =>
|
|
7123
|
+
(direction) => existsSync2(join2(dir, bridgeRecordingFileName(direction)))
|
|
6490
7124
|
);
|
|
6491
7125
|
if (hasLane) {
|
|
6492
7126
|
cells.push({ provider, cell, dir });
|
|
@@ -6499,21 +7133,21 @@ function listRecordedCells(root) {
|
|
|
6499
7133
|
// ../provider-bridge-protocol/src/testing/parity.ts
|
|
6500
7134
|
var REPLAY_CLEANUP_RETRIES = 20;
|
|
6501
7135
|
var REPLAY_CLEANUP_RETRY_DELAY_MS = 100;
|
|
6502
|
-
var SOURCE_BOOTSTRAP =
|
|
7136
|
+
var SOURCE_BOOTSTRAP = fileURLToPath3(
|
|
6503
7137
|
new URL("../bridge-worker-entry.ts", import.meta.url)
|
|
6504
7138
|
);
|
|
6505
|
-
var BUNDLED_BOOTSTRAP =
|
|
7139
|
+
var BUNDLED_BOOTSTRAP = fileURLToPath3(
|
|
6506
7140
|
new URL("./provider-bridge-worker-entry.mjs", import.meta.url)
|
|
6507
7141
|
);
|
|
6508
7142
|
function resolveProviderBridgeBootstrapPath() {
|
|
6509
|
-
if (
|
|
6510
|
-
if (
|
|
7143
|
+
if (existsSync3(SOURCE_BOOTSTRAP)) return SOURCE_BOOTSTRAP;
|
|
7144
|
+
if (existsSync3(BUNDLED_BOOTSTRAP)) return BUNDLED_BOOTSTRAP;
|
|
6511
7145
|
throw new Error(
|
|
6512
7146
|
`provider-bridge bootstrap not found at ${SOURCE_BOOTSTRAP} or ${BUNDLED_BOOTSTRAP}`
|
|
6513
7147
|
);
|
|
6514
7148
|
}
|
|
6515
|
-
function isTypeScriptPath(
|
|
6516
|
-
return /\.[cm]?tsx?$/u.test(
|
|
7149
|
+
function isTypeScriptPath(path2) {
|
|
7150
|
+
return /\.[cm]?tsx?$/u.test(path2);
|
|
6517
7151
|
}
|
|
6518
7152
|
function tsxSpecifier() {
|
|
6519
7153
|
return import.meta.resolve("tsx");
|
|
@@ -6525,13 +7159,13 @@ function defaultNodeArgs(bootstrapPath, modulePath) {
|
|
|
6525
7159
|
return isTypeScriptPath(modulePath) ? ["--import", tsxSpecifier()] : [];
|
|
6526
7160
|
}
|
|
6527
7161
|
function resolveProviderBridgeLaunch(options) {
|
|
6528
|
-
if (!
|
|
7162
|
+
if (!isAbsolute2(options.modulePath)) {
|
|
6529
7163
|
throw new Error(
|
|
6530
7164
|
`bridge module path must be absolute: ${options.modulePath}`
|
|
6531
7165
|
);
|
|
6532
7166
|
}
|
|
6533
7167
|
const bootstrapPath = options.bootstrapPath ?? resolveProviderBridgeBootstrapPath();
|
|
6534
|
-
const dataDir = options.dataDir ?? mkdtempSync(
|
|
7168
|
+
const dataDir = options.dataDir ?? mkdtempSync(join3(tmpdir(), "bb-parity-data-"));
|
|
6535
7169
|
return {
|
|
6536
7170
|
command: process.execPath,
|
|
6537
7171
|
args: [
|
|
@@ -6634,7 +7268,7 @@ function methodOfRecordedBridgeRequest(recording, response, id) {
|
|
|
6634
7268
|
}
|
|
6635
7269
|
return void 0;
|
|
6636
7270
|
}
|
|
6637
|
-
var REPLAY_CHILD_PATH =
|
|
7271
|
+
var REPLAY_CHILD_PATH = fileURLToPath3(
|
|
6638
7272
|
new URL("./replay-provider-child.mjs", import.meta.url)
|
|
6639
7273
|
);
|
|
6640
7274
|
var PARITY_INITIALIZE_ID = "parity-initialize";
|
|
@@ -6693,9 +7327,9 @@ async function replayRecordingAttempt(options) {
|
|
|
6693
7327
|
const providerId = options.providerId;
|
|
6694
7328
|
const profile = options.profile ?? DEFAULT_REPLAY_PROFILE;
|
|
6695
7329
|
const recording = readBridgeRecording(options.recordingDir);
|
|
6696
|
-
const stateDir = mkdtempSync(
|
|
6697
|
-
const workspaceDir =
|
|
6698
|
-
mkdtempSync(
|
|
7330
|
+
const stateDir = mkdtempSync(join3(tmpdir(), "bb-parity-replay-"));
|
|
7331
|
+
const workspaceDir = realpathSync2(
|
|
7332
|
+
mkdtempSync(join3(tmpdir(), "bb-parity-ws-"))
|
|
6699
7333
|
);
|
|
6700
7334
|
const replayCommand = [
|
|
6701
7335
|
process.execPath,
|
|
@@ -6707,14 +7341,14 @@ async function replayRecordingAttempt(options) {
|
|
|
6707
7341
|
"--state",
|
|
6708
7342
|
stateDir
|
|
6709
7343
|
];
|
|
6710
|
-
const cursorPath =
|
|
7344
|
+
const cursorPath = join3(stateDir, "cursor");
|
|
6711
7345
|
const setCursor = (position) => {
|
|
6712
7346
|
writeFileSync(
|
|
6713
7347
|
cursorPath,
|
|
6714
7348
|
position === "end" ? "end" : `${position.run} ${position.seq}`
|
|
6715
7349
|
);
|
|
6716
7350
|
};
|
|
6717
|
-
const wrapperPath =
|
|
7351
|
+
const wrapperPath = join3(stateDir, "replay-provider.mjs");
|
|
6718
7352
|
writeFileSync(
|
|
6719
7353
|
wrapperPath,
|
|
6720
7354
|
[
|
|
@@ -6759,7 +7393,7 @@ async function replayRecordingAttempt(options) {
|
|
|
6759
7393
|
write2(JSON.stringify({ ...recorded, id: message.id }));
|
|
6760
7394
|
};
|
|
6761
7395
|
var write = write2, answerBridgeRequest = answerBridgeRequest2;
|
|
6762
|
-
const child =
|
|
7396
|
+
const child = spawnHostProcess(launch.command, launch.args, {
|
|
6763
7397
|
cwd: launch.cwd,
|
|
6764
7398
|
env: {
|
|
6765
7399
|
...process.env,
|
|
@@ -7170,11 +7804,11 @@ function normalizeParityRows(rows) {
|
|
|
7170
7804
|
})
|
|
7171
7805
|
);
|
|
7172
7806
|
}
|
|
7173
|
-
function pointerSegments(
|
|
7174
|
-
return
|
|
7807
|
+
function pointerSegments(path2) {
|
|
7808
|
+
return path2.split("/").filter((segment) => segment.length > 0);
|
|
7175
7809
|
}
|
|
7176
|
-
function maskPath(value,
|
|
7177
|
-
const segments = pointerSegments(
|
|
7810
|
+
function maskPath(value, path2) {
|
|
7811
|
+
const segments = pointerSegments(path2);
|
|
7178
7812
|
if (segments.length === 0) {
|
|
7179
7813
|
if (!Array.isArray(value)) return 0;
|
|
7180
7814
|
const removed2 = value.length;
|
|
@@ -7260,7 +7894,7 @@ function diffLayer(oldSide, newSide) {
|
|
|
7260
7894
|
|
|
7261
7895
|
// ../provider-bridge-protocol/src/testing/rerecord.ts
|
|
7262
7896
|
import { writeFileSync as writeFileSync2 } from "node:fs";
|
|
7263
|
-
import { join as
|
|
7897
|
+
import { join as join4 } from "node:path";
|
|
7264
7898
|
var BRIDGE_TO_RUNTIME = "bridge\u2192runtime";
|
|
7265
7899
|
function parseWireLine(line) {
|
|
7266
7900
|
try {
|
|
@@ -7323,7 +7957,7 @@ async function rerecordCurrentBridgeLane(options) {
|
|
|
7323
7957
|
line
|
|
7324
7958
|
});
|
|
7325
7959
|
});
|
|
7326
|
-
const file =
|
|
7960
|
+
const file = join4(options.recordingDir, CURRENT_BRIDGE_LANE_FILE);
|
|
7327
7961
|
writeFileSync2(
|
|
7328
7962
|
file,
|
|
7329
7963
|
entries.map((entry) => JSON.stringify(entry)).join("\n") + (entries.length > 0 ? "\n" : "")
|