@mrrlin-dev/mcp 0.4.148 → 0.4.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin.cjs +406 -241
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -346,23 +346,23 @@ var require_toml_parser = __commonJS({
346
346
  [CHAR_QUOT]: '"',
347
347
  [CHAR_BSOL]: "\\"
348
348
  };
349
- function isDigit(cp) {
350
- return cp >= CHAR_0 && cp <= CHAR_9;
349
+ function isDigit(cp2) {
350
+ return cp2 >= CHAR_0 && cp2 <= CHAR_9;
351
351
  }
352
- function isHexit(cp) {
353
- return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
352
+ function isHexit(cp2) {
353
+ return cp2 >= CHAR_A && cp2 <= CHAR_F || cp2 >= CHAR_a && cp2 <= CHAR_f || cp2 >= CHAR_0 && cp2 <= CHAR_9;
354
354
  }
355
- function isBit(cp) {
356
- return cp === CHAR_1 || cp === CHAR_0;
355
+ function isBit(cp2) {
356
+ return cp2 === CHAR_1 || cp2 === CHAR_0;
357
357
  }
358
- function isOctit(cp) {
359
- return cp >= CHAR_0 && cp <= CHAR_7;
358
+ function isOctit(cp2) {
359
+ return cp2 >= CHAR_0 && cp2 <= CHAR_7;
360
360
  }
361
- function isAlphaNumQuoteHyphen(cp) {
362
- return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
361
+ function isAlphaNumQuoteHyphen(cp2) {
362
+ return cp2 >= CHAR_A && cp2 <= CHAR_Z || cp2 >= CHAR_a && cp2 <= CHAR_z || cp2 >= CHAR_0 && cp2 <= CHAR_9 || cp2 === CHAR_APOS || cp2 === CHAR_QUOT || cp2 === CHAR_LOWBAR || cp2 === CHAR_HYPHEN;
363
363
  }
364
- function isAlphaNumHyphen(cp) {
365
- return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
364
+ function isAlphaNumHyphen(cp2) {
365
+ return cp2 >= CHAR_A && cp2 <= CHAR_Z || cp2 >= CHAR_a && cp2 <= CHAR_z || cp2 >= CHAR_0 && cp2 <= CHAR_9 || cp2 === CHAR_LOWBAR || cp2 === CHAR_HYPHEN;
366
366
  }
367
367
  var _type = Symbol("type");
368
368
  var _declared = Symbol("declared");
@@ -5118,14 +5118,14 @@ var require_utils = __commonJS({
5118
5118
  BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
5119
5119
  }
5120
5120
  }
5121
- function percentEncodeNonAscii(cp) {
5122
- if (cp < 2048) {
5123
- return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
5121
+ function percentEncodeNonAscii(cp2) {
5122
+ if (cp2 < 2048) {
5123
+ return BYTE_HEX[192 | cp2 >> 6] + BYTE_HEX[128 | cp2 & 63];
5124
5124
  }
5125
- if (cp < 65536) {
5126
- return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5125
+ if (cp2 < 65536) {
5126
+ return BYTE_HEX[224 | cp2 >> 12] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
5127
5127
  }
5128
- return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5128
+ return BYTE_HEX[240 | cp2 >> 18] + BYTE_HEX[128 | cp2 >> 12 & 63] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
5129
5129
  }
5130
5130
  function stringArrayToHexStripped(input) {
5131
5131
  let acc = "";
@@ -5489,8 +5489,8 @@ var require_utils = __commonJS({
5489
5489
  function encodeFragment(input) {
5490
5490
  return encodeComponent(input, isQueryFragmentCharacter);
5491
5491
  }
5492
- function isEscapeSafe(cp) {
5493
- 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;
5492
+ function isEscapeSafe(cp2) {
5493
+ return cp2 >= 48 && cp2 <= 57 || cp2 >= 65 && cp2 <= 90 || cp2 >= 97 && cp2 <= 122 || cp2 === 42 || cp2 === 43 || cp2 === 45 || cp2 === 46 || cp2 === 47 || cp2 === 64 || cp2 === 95;
5494
5494
  }
5495
5495
  function normalizeQueryFragmentEncoding(input) {
5496
5496
  let output3 = "";
@@ -9733,19 +9733,19 @@ var require_enoent = __commonJS({
9733
9733
  spawnargs: original.args
9734
9734
  });
9735
9735
  }
9736
- function hookChildProcess(cp, parsed) {
9736
+ function hookChildProcess(cp2, parsed) {
9737
9737
  if (!isWin) {
9738
9738
  return;
9739
9739
  }
9740
- const originalEmit = cp.emit;
9741
- cp.emit = function(name, arg1) {
9740
+ const originalEmit = cp2.emit;
9741
+ cp2.emit = function(name, arg1) {
9742
9742
  if (name === "exit") {
9743
9743
  const err = verifyENOENT(arg1, parsed);
9744
9744
  if (err) {
9745
- return originalEmit.call(cp, "error", err);
9745
+ return originalEmit.call(cp2, "error", err);
9746
9746
  }
9747
9747
  }
9748
- return originalEmit.apply(cp, arguments);
9748
+ return originalEmit.apply(cp2, arguments);
9749
9749
  };
9750
9750
  }
9751
9751
  function verifyENOENT(status, parsed) {
@@ -9773,18 +9773,18 @@ var require_enoent = __commonJS({
9773
9773
  var require_cross_spawn = __commonJS({
9774
9774
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module2) {
9775
9775
  "use strict";
9776
- var cp = require("child_process");
9776
+ var cp2 = require("child_process");
9777
9777
  var parse8 = require_parse2();
9778
9778
  var enoent = require_enoent();
9779
9779
  function spawn9(command, args, options) {
9780
9780
  const parsed = parse8(command, args, options);
9781
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
9781
+ const spawned = cp2.spawn(parsed.command, parsed.args, parsed.options);
9782
9782
  enoent.hookChildProcess(spawned, parsed);
9783
9783
  return spawned;
9784
9784
  }
9785
9785
  function spawnSync9(command, args, options) {
9786
9786
  const parsed = parse8(command, args, options);
9787
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
9787
+ const result = cp2.spawnSync(parsed.command, parsed.args, parsed.options);
9788
9788
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
9789
9789
  return result;
9790
9790
  }
@@ -9863,7 +9863,7 @@ var require_polyfills = __commonJS({
9863
9863
  }
9864
9864
  if (platform === "win32") {
9865
9865
  fs16.rename = typeof fs16.rename !== "function" ? fs16.rename : function(fs$rename) {
9866
- function rename4(from, to, cb) {
9866
+ function rename5(from, to, cb) {
9867
9867
  var start = Date.now();
9868
9868
  var backoff = 0;
9869
9869
  fs$rename(from, to, function CB(er) {
@@ -9883,8 +9883,8 @@ var require_polyfills = __commonJS({
9883
9883
  if (cb) cb(er);
9884
9884
  });
9885
9885
  }
9886
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename4, fs$rename);
9887
- return rename4;
9886
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename5, fs$rename);
9887
+ return rename5;
9888
9888
  }(fs16.rename);
9889
9889
  }
9890
9890
  fs16.read = typeof fs16.read !== "function" ? fs16.read : function(fs$read) {
@@ -10288,8 +10288,8 @@ var require_graceful_fs = __commonJS({
10288
10288
  fs17.createReadStream = createReadStream2;
10289
10289
  fs17.createWriteStream = createWriteStream;
10290
10290
  var fs$readFile = fs17.readFile;
10291
- fs17.readFile = readFile9;
10292
- function readFile9(path34, options, cb) {
10291
+ fs17.readFile = readFile10;
10292
+ function readFile10(path34, options, cb) {
10293
10293
  if (typeof options === "function")
10294
10294
  cb = options, options = null;
10295
10295
  return go$readFile(path34, options, cb);
@@ -21663,7 +21663,7 @@ __export(bin_exports, {
21663
21663
  module.exports = __toCommonJS(bin_exports);
21664
21664
  var import_node_path47 = __toESM(require("node:path"), 1);
21665
21665
  var import_node_child_process27 = require("node:child_process");
21666
- var import_node_fs30 = require("node:fs");
21666
+ var import_node_fs31 = require("node:fs");
21667
21667
  var import_node_os25 = require("node:os");
21668
21668
  var import_node_path48 = __toESM(require("node:path"), 1);
21669
21669
 
@@ -21791,6 +21791,7 @@ async function resolveApiBaseUrlDynamic(opts = {}) {
21791
21791
  var import_node_os = __toESM(require("node:os"), 1);
21792
21792
  var import_node_path = __toESM(require("node:path"), 1);
21793
21793
  var fs = __toESM(require("node:fs/promises"), 1);
21794
+ var import_node_fs = require("node:fs");
21794
21795
  var import_node_child_process = require("node:child_process");
21795
21796
  var import_node_module = require("node:module");
21796
21797
  var import_node_url = require("node:url");
@@ -21818,8 +21819,138 @@ function resolvePackageBin(pkg, binName) {
21818
21819
  if (!rel) throw new Error(`${pkg} has no bin entry to resolve a CLI from`);
21819
21820
  return import_node_path.default.join(import_node_path.default.dirname(pkgJsonPath), rel);
21820
21821
  }
21821
- function browserServeArgs(homeDir = import_node_os.default.homedir()) {
21822
- const { browsersPath, profilePath } = browserPaths(homeDir);
21822
+ var BROWSER_PROFILE_DIR_ENV = "MRRLIN_BROWSER_PROFILE_DIR";
21823
+ function taskProfilesRoot(homeDir = import_node_os.default.homedir()) {
21824
+ return import_node_path.default.join(browserPaths(homeDir).root, "tasks");
21825
+ }
21826
+ var PROJECT_SLUG_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/;
21827
+ var TASK_ID_RE = /^GT-\d{1,12}$/;
21828
+ function taskBrowserProfileDir(projectSlug, taskId, homeDir = import_node_os.default.homedir()) {
21829
+ if (!projectSlug || !PROJECT_SLUG_RE.test(projectSlug)) return null;
21830
+ if (!taskId || !TASK_ID_RE.test(taskId)) return null;
21831
+ return import_node_path.default.join(taskProfilesRoot(homeDir), projectSlug, taskId);
21832
+ }
21833
+ function resolveServeProfilePath(homeDir = import_node_os.default.homedir(), env = process.env) {
21834
+ const shared = browserPaths(homeDir).profilePath;
21835
+ const requested = env[BROWSER_PROFILE_DIR_ENV]?.trim();
21836
+ if (!requested || !import_node_path.default.isAbsolute(requested)) return shared;
21837
+ const root = taskProfilesRoot(homeDir);
21838
+ const rel = import_node_path.default.relative(root, import_node_path.default.normalize(requested));
21839
+ if (!rel || rel.startsWith("..") || import_node_path.default.isAbsolute(rel)) return shared;
21840
+ if (taskProfileEscapes(homeDir, rel)) return shared;
21841
+ return import_node_path.default.normalize(requested);
21842
+ }
21843
+ function taskProfileEscapes(homeDir, rel) {
21844
+ return hasSymlinkBelow(browserPaths(homeDir).root, import_node_path.default.join("tasks", rel));
21845
+ }
21846
+ function hasSymlinkBelow(root, rel) {
21847
+ let current2 = root;
21848
+ for (const part of rel.split(import_node_path.default.sep)) {
21849
+ current2 = import_node_path.default.join(current2, part);
21850
+ let st;
21851
+ try {
21852
+ st = (0, import_node_fs.lstatSync)(current2);
21853
+ } catch {
21854
+ return false;
21855
+ }
21856
+ if (st.isSymbolicLink()) return true;
21857
+ }
21858
+ return false;
21859
+ }
21860
+ var UNCOPIED_PROFILE_ENTRY = /^(SingletonLock|SingletonSocket|SingletonCookie|Crashpad|Cache|Code Cache|GPUCache|ShaderCache|GrShaderCache|GraphiteDawnCache|DawnCache|DawnGraphiteCache|DawnWebGPUCache)$/;
21861
+ async function ensureTaskBrowserProfile(dir, homeDir = import_node_os.default.homedir(), opts = {}) {
21862
+ try {
21863
+ await fs.access(dir);
21864
+ return "existing";
21865
+ } catch {
21866
+ }
21867
+ await fs.mkdir(import_node_path.default.dirname(dir), { recursive: true });
21868
+ const shared = browserPaths(homeDir).profilePath;
21869
+ let sharedExists = true;
21870
+ try {
21871
+ await fs.access(shared);
21872
+ } catch {
21873
+ sharedExists = false;
21874
+ }
21875
+ const isBusy = opts.isSharedProfileBusy ?? (() => checkBrowserBusy({ homeDir }).busy);
21876
+ if (!sharedExists || isBusy()) {
21877
+ await fs.mkdir(dir, { recursive: true });
21878
+ return "empty";
21879
+ }
21880
+ const tmp = `${dir}.seeding-${process.pid}-${Date.now()}`;
21881
+ try {
21882
+ await fs.cp(shared, tmp, {
21883
+ recursive: true,
21884
+ errorOnExist: false,
21885
+ force: true,
21886
+ // A live profile can hold sockets and files that vanish mid-copy; skip the entries above and
21887
+ // anything that is not a plain file or directory.
21888
+ filter: async (src) => {
21889
+ if (UNCOPIED_PROFILE_ENTRY.test(import_node_path.default.basename(src))) return false;
21890
+ try {
21891
+ const st = await fs.lstat(src);
21892
+ return st.isDirectory() || st.isFile();
21893
+ } catch {
21894
+ return false;
21895
+ }
21896
+ }
21897
+ });
21898
+ if (isBusy()) {
21899
+ await fs.rm(tmp, { recursive: true, force: true });
21900
+ await fs.mkdir(dir, { recursive: true });
21901
+ return "empty";
21902
+ }
21903
+ await fs.rename(tmp, dir);
21904
+ return "seeded";
21905
+ } catch (err) {
21906
+ await fs.rm(tmp, { recursive: true, force: true }).catch(() => {
21907
+ });
21908
+ try {
21909
+ await fs.access(dir);
21910
+ return "existing";
21911
+ } catch {
21912
+ throw err;
21913
+ }
21914
+ }
21915
+ }
21916
+ function codexConfigDeclaresMrrlinBrowser(configToml) {
21917
+ const withoutMultilineStrings = configToml.replace(/"""[\s\S]*?"""|'''[\s\S]*?'''/g, '""');
21918
+ return /^[ \t]*\[mcp_servers\.(?:"mrrlin-browser"|'mrrlin-browser'|mrrlin-browser)\][ \t]*(?:#.*)?$/m.test(
21919
+ withoutMultilineStrings
21920
+ );
21921
+ }
21922
+ async function runBrowserThreadEnv(projectSlug, taskId, opts = {}) {
21923
+ const homeDir = opts.homeDir ?? import_node_os.default.homedir();
21924
+ const configPath = opts.codexConfigPath ?? import_node_path.default.join(process.env.CODEX_HOME?.trim() || import_node_path.default.join(homeDir, ".codex"), "config.toml");
21925
+ const read = opts.readFile ?? ((p) => fs.readFile(p, "utf8"));
21926
+ let config2;
21927
+ try {
21928
+ config2 = await read(configPath);
21929
+ } catch {
21930
+ return {};
21931
+ }
21932
+ if (!codexConfigDeclaresMrrlinBrowser(config2)) return {};
21933
+ const dir = taskBrowserProfileDir(projectSlug, taskId, homeDir);
21934
+ if (!dir) return {};
21935
+ const root = taskProfilesRoot(homeDir);
21936
+ const rel = import_node_path.default.relative(root, dir);
21937
+ if (taskProfileEscapes(homeDir, rel)) return {};
21938
+ try {
21939
+ await ensureTaskBrowserProfile(dir, homeDir, { isSharedProfileBusy: opts.isSharedProfileBusy });
21940
+ } catch {
21941
+ return {};
21942
+ }
21943
+ if (taskProfileEscapes(homeDir, rel)) return {};
21944
+ try {
21945
+ if (!(await fs.lstat(dir)).isDirectory()) return {};
21946
+ } catch {
21947
+ return {};
21948
+ }
21949
+ return { [BROWSER_PROFILE_DIR_ENV]: dir };
21950
+ }
21951
+ function browserServeArgs(homeDir = import_node_os.default.homedir(), env = process.env) {
21952
+ const { browsersPath } = browserPaths(homeDir);
21953
+ const profilePath = resolveServeProfilePath(homeDir, env);
21823
21954
  const cli = resolvePackageBin("@playwright/mcp");
21824
21955
  return {
21825
21956
  command: process.execPath,
@@ -21897,7 +22028,7 @@ function reapOrphanedBrowserProcesses(opts = {}) {
21897
22028
  }
21898
22029
  function checkBrowserBusy(opts = {}) {
21899
22030
  const homeDir = opts.homeDir ?? import_node_os.default.homedir();
21900
- const { profilePath } = browserPaths(homeDir);
22031
+ const profilePath = opts.profilePath ?? browserPaths(homeDir).profilePath;
21901
22032
  const listProcesses = opts.listProcesses ?? defaultListProcesses;
21902
22033
  const flag = `--user-data-dir=${profilePath}`;
21903
22034
  const flagSpaced = `--user-data-dir ${profilePath}`;
@@ -21985,7 +22116,7 @@ async function installBrowser(opts = {}) {
21985
22116
  }
21986
22117
 
21987
22118
  // src/mcp-config-reconcile.ts
21988
- var import_node_fs = __toESM(require("node:fs"), 1);
22119
+ var import_node_fs2 = __toESM(require("node:fs"), 1);
21989
22120
  var import_node_os2 = __toESM(require("node:os"), 1);
21990
22121
  var import_node_path2 = __toESM(require("node:path"), 1);
21991
22122
  var toml = __toESM(require_toml(), 1);
@@ -22107,7 +22238,7 @@ function defaultMcpConfigPath() {
22107
22238
  function readMcpServerById(configPath, serverId) {
22108
22239
  let raw;
22109
22240
  try {
22110
- raw = import_node_fs.default.readFileSync(configPath, "utf8");
22241
+ raw = import_node_fs2.default.readFileSync(configPath, "utf8");
22111
22242
  } catch {
22112
22243
  return null;
22113
22244
  }
@@ -22237,11 +22368,11 @@ function listDiscoveredMcpServers(customPaths) {
22237
22368
  { path: import_node_path2.default.join(home, ".config", "Claude", "claude_desktop_config.json"), source: "claude", format: "json" }
22238
22369
  ];
22239
22370
  if (customPaths) {
22240
- for (const cp of customPaths) {
22371
+ for (const cp2 of customPaths) {
22241
22372
  candidatePaths.unshift({
22242
- path: cp,
22373
+ path: cp2,
22243
22374
  source: "custom",
22244
- format: cp.endsWith(".toml") ? "toml" : "json"
22375
+ format: cp2.endsWith(".toml") ? "toml" : "json"
22245
22376
  });
22246
22377
  }
22247
22378
  }
@@ -22249,7 +22380,7 @@ function listDiscoveredMcpServers(customPaths) {
22249
22380
  for (const { path: cfgPath, source, format } of candidatePaths) {
22250
22381
  let raw;
22251
22382
  try {
22252
- raw = import_node_fs.default.readFileSync(cfgPath, "utf8");
22383
+ raw = import_node_fs2.default.readFileSync(cfgPath, "utf8");
22253
22384
  } catch {
22254
22385
  continue;
22255
22386
  }
@@ -43420,7 +43551,7 @@ async function runDeliverableGate(target, deps) {
43420
43551
 
43421
43552
  // src/consensus/wiring.ts
43422
43553
  var import_node_crypto4 = __toESM(require("node:crypto"), 1);
43423
- var import_node_fs5 = __toESM(require("node:fs"), 1);
43554
+ var import_node_fs6 = __toESM(require("node:fs"), 1);
43424
43555
  var import_node_path10 = __toESM(require("node:path"), 1);
43425
43556
  var import_node_url2 = require("node:url");
43426
43557
 
@@ -44364,6 +44495,8 @@ function createCodexAgentHandle(client) {
44364
44495
  return new CodexAgentHandle(client);
44365
44496
  }
44366
44497
  var MRRLIN_MCP_SERVER = "mrrlin";
44498
+ var MRRLIN_BROWSER_MCP_SERVER = "mrrlin-browser";
44499
+ var MRRLIN_BROWSER_ENV_PREFIX = "MRRLIN_BROWSER_";
44367
44500
  function codexThreadConfig(env) {
44368
44501
  if (!env)
44369
44502
  return null;
@@ -44371,7 +44504,8 @@ function codexThreadConfig(env) {
44371
44504
  for (const [key, value] of Object.entries(env)) {
44372
44505
  if (!ENV_NAME.test(key))
44373
44506
  continue;
44374
- config2[`mcp_servers.${MRRLIN_MCP_SERVER}.env.${key}`] = value ?? "";
44507
+ const server = key.startsWith(MRRLIN_BROWSER_ENV_PREFIX) ? MRRLIN_BROWSER_MCP_SERVER : MRRLIN_MCP_SERVER;
44508
+ config2[`mcp_servers.${server}.env.${key}`] = value ?? "";
44375
44509
  }
44376
44510
  return Object.keys(config2).length > 0 ? config2 : null;
44377
44511
  }
@@ -46137,7 +46271,7 @@ async function mintResolvedSeat(provider, opts) {
46137
46271
 
46138
46272
  // ../../packages/agent-client/dist/verification-network-sandbox.js
46139
46273
  var import_node_os5 = __toESM(require("node:os"), 1);
46140
- var import_node_fs2 = __toESM(require("node:fs"), 1);
46274
+ var import_node_fs3 = __toESM(require("node:fs"), 1);
46141
46275
  var import_node_net = __toESM(require("node:net"), 1);
46142
46276
  var import_node_http = __toESM(require("node:http"), 1);
46143
46277
  var import_node_https = __toESM(require("node:https"), 1);
@@ -46150,9 +46284,9 @@ function loadOrGenerateVerificationHostKeypair() {
46150
46284
  if (activeHostKeypair)
46151
46285
  return activeHostKeypair;
46152
46286
  const envKeyPath = process.env.VERIFICATION_HOST_KEY_PATH;
46153
- if (envKeyPath && import_node_fs2.default.existsSync(envKeyPath)) {
46287
+ if (envKeyPath && import_node_fs3.default.existsSync(envKeyPath)) {
46154
46288
  try {
46155
- const pem = import_node_fs2.default.readFileSync(envKeyPath, "utf8");
46289
+ const pem = import_node_fs3.default.readFileSync(envKeyPath, "utf8");
46156
46290
  const priv = import_node_crypto3.default.createPrivateKey(pem);
46157
46291
  const pub = import_node_crypto3.default.createPublicKey(priv);
46158
46292
  const pubPem2 = pub.export({ type: "spki", format: "pem" });
@@ -46171,7 +46305,7 @@ function getHostPublicKeyPem() {
46171
46305
  }
46172
46306
  var DEFAULT_HOST_PUBLIC_KEY = getHostPublicKeyPem();
46173
46307
  function resolveSafeSandboxBaseDir() {
46174
- const runtimeCandidate = process.env.XDG_RUNTIME_DIR ? import_node_path7.default.join(process.env.XDG_RUNTIME_DIR, "mrrlin-sandbox") : import_node_fs2.default.existsSync("/run/user/1000") ? "/run/user/1000/mrrlin-sandbox" : void 0;
46308
+ const runtimeCandidate = process.env.XDG_RUNTIME_DIR ? import_node_path7.default.join(process.env.XDG_RUNTIME_DIR, "mrrlin-sandbox") : import_node_fs3.default.existsSync("/run/user/1000") ? "/run/user/1000/mrrlin-sandbox" : void 0;
46175
46309
  const candidates = [
46176
46310
  runtimeCandidate,
46177
46311
  import_node_path7.default.join(import_node_os5.default.homedir(), ".mrrlin-sandbox")
@@ -46180,10 +46314,10 @@ function resolveSafeSandboxBaseDir() {
46180
46314
  if (!candidate)
46181
46315
  continue;
46182
46316
  try {
46183
- if (!import_node_fs2.default.existsSync(candidate)) {
46184
- import_node_fs2.default.mkdirSync(candidate, { recursive: true, mode: 448 });
46317
+ if (!import_node_fs3.default.existsSync(candidate)) {
46318
+ import_node_fs3.default.mkdirSync(candidate, { recursive: true, mode: 448 });
46185
46319
  }
46186
- const real = import_node_fs2.default.realpathSync(candidate);
46320
+ const real = import_node_fs3.default.realpathSync(candidate);
46187
46321
  if (real === "/tmp" || real.startsWith("/tmp/") || real === "/var/tmp" || real.startsWith("/var/tmp/")) {
46188
46322
  continue;
46189
46323
  }
@@ -46799,14 +46933,14 @@ async function startProviderProxy(allowedHosts, options) {
46799
46933
  if (options?.socketPath) {
46800
46934
  const socketPath = options.socketPath;
46801
46935
  try {
46802
- if (import_node_fs2.default.existsSync(socketPath)) {
46803
- import_node_fs2.default.unlinkSync(socketPath);
46936
+ if (import_node_fs3.default.existsSync(socketPath)) {
46937
+ import_node_fs3.default.unlinkSync(socketPath);
46804
46938
  }
46805
46939
  } catch {
46806
46940
  }
46807
46941
  server.listen(socketPath, () => {
46808
46942
  try {
46809
- import_node_fs2.default.chmodSync(socketPath, 384);
46943
+ import_node_fs3.default.chmodSync(socketPath, 384);
46810
46944
  } catch {
46811
46945
  }
46812
46946
  server.unref();
@@ -46834,8 +46968,8 @@ async function startProviderProxy(allowedHosts, options) {
46834
46968
  await new Promise((resolve3) => server.close(() => resolve3()));
46835
46969
  if (assignedSocketPath) {
46836
46970
  try {
46837
- if (import_node_fs2.default.existsSync(assignedSocketPath)) {
46838
- import_node_fs2.default.unlinkSync(assignedSocketPath);
46971
+ if (import_node_fs3.default.existsSync(assignedSocketPath)) {
46972
+ import_node_fs3.default.unlinkSync(assignedSocketPath);
46839
46973
  }
46840
46974
  } catch {
46841
46975
  }
@@ -46903,7 +47037,7 @@ async function createVerificationNetworkSandbox(config2) {
46903
47037
  let brokerSocketInherited = false;
46904
47038
  if (!config2.skipSocketCheck) {
46905
47039
  try {
46906
- const stat3 = import_node_fs2.default.statSync(config2.brokerSocketPath);
47040
+ const stat3 = import_node_fs3.default.statSync(config2.brokerSocketPath);
46907
47041
  brokerSocketInherited = stat3.isSocket();
46908
47042
  } catch {
46909
47043
  brokerSocketInherited = false;
@@ -47019,17 +47153,17 @@ async function createVerificationNetworkSandbox(config2) {
47019
47153
  ];
47020
47154
  const sandboxBaseDir = resolveSafeSandboxBaseDir();
47021
47155
  try {
47022
- import_node_fs2.default.mkdirSync(sandboxBaseDir, { recursive: true, mode: 448 });
47156
+ import_node_fs3.default.mkdirSync(sandboxBaseDir, { recursive: true, mode: 448 });
47023
47157
  } catch {
47024
47158
  }
47025
47159
  const hostsFilePath = import_node_path7.default.join(sandboxBaseDir, `mrrlin-hosts-${nonce}`);
47026
47160
  try {
47027
- import_node_fs2.default.writeFileSync(hostsFilePath, hostsLines.join("\n") + "\n", { mode: 420 });
47161
+ import_node_fs3.default.writeFileSync(hostsFilePath, hostsLines.join("\n") + "\n", { mode: 420 });
47028
47162
  } catch {
47029
47163
  }
47030
- const privateDir = import_node_fs2.default.mkdtempSync(import_node_path7.default.join(sandboxBaseDir, "mrrlin-sandbox-"));
47164
+ const privateDir = import_node_fs3.default.mkdtempSync(import_node_path7.default.join(sandboxBaseDir, "mrrlin-sandbox-"));
47031
47165
  try {
47032
- import_node_fs2.default.chmodSync(privateDir, 448);
47166
+ import_node_fs3.default.chmodSync(privateDir, 448);
47033
47167
  } catch {
47034
47168
  }
47035
47169
  const providerSocketPath = import_node_path7.default.join(privateDir, "provider.sock");
@@ -47269,7 +47403,7 @@ async function createVerificationNetworkSandbox(config2) {
47269
47403
  "}"
47270
47404
  ].join("\n");
47271
47405
  try {
47272
- import_node_fs2.default.writeFileSync(proxyBootstrapPath, proxyBootstrapCode, { mode: 420 });
47406
+ import_node_fs3.default.writeFileSync(proxyBootstrapPath, proxyBootstrapCode, { mode: 420 });
47273
47407
  } catch {
47274
47408
  }
47275
47409
  let commandWrapped = false;
@@ -47556,20 +47690,20 @@ exit $EXIT_CODE`,
47556
47690
  } catch {
47557
47691
  }
47558
47692
  try {
47559
- if (import_node_fs2.default.existsSync(hostsFilePath)) {
47560
- import_node_fs2.default.unlinkSync(hostsFilePath);
47693
+ if (import_node_fs3.default.existsSync(hostsFilePath)) {
47694
+ import_node_fs3.default.unlinkSync(hostsFilePath);
47561
47695
  }
47562
47696
  } catch {
47563
47697
  }
47564
47698
  try {
47565
- if (import_node_fs2.default.existsSync(proxyBootstrapPath)) {
47566
- import_node_fs2.default.unlinkSync(proxyBootstrapPath);
47699
+ if (import_node_fs3.default.existsSync(proxyBootstrapPath)) {
47700
+ import_node_fs3.default.unlinkSync(proxyBootstrapPath);
47567
47701
  }
47568
47702
  } catch {
47569
47703
  }
47570
47704
  try {
47571
- if (import_node_fs2.default.existsSync(privateDir)) {
47572
- import_node_fs2.default.rmSync(privateDir, { recursive: true, force: true });
47705
+ if (import_node_fs3.default.existsSync(privateDir)) {
47706
+ import_node_fs3.default.rmSync(privateDir, { recursive: true, force: true });
47573
47707
  }
47574
47708
  } catch {
47575
47709
  }
@@ -47640,13 +47774,13 @@ function verifySandboxAttestation(attestation, options) {
47640
47774
  }
47641
47775
 
47642
47776
  // src/consensus/gate-usage-log.ts
47643
- var import_node_fs3 = require("node:fs");
47777
+ var import_node_fs4 = require("node:fs");
47644
47778
  var import_node_path8 = require("node:path");
47645
47779
  function recordGateCall(stateDir, projectSlug, record2) {
47646
47780
  try {
47647
47781
  const dir = (0, import_node_path8.join)(stateDir, "telemetry");
47648
- (0, import_node_fs3.mkdirSync)(dir, { recursive: true });
47649
- (0, import_node_fs3.appendFileSync)((0, import_node_path8.join)(dir, gateFileName(projectSlug, record2.day)), `${JSON.stringify(record2)}
47782
+ (0, import_node_fs4.mkdirSync)(dir, { recursive: true });
47783
+ (0, import_node_fs4.appendFileSync)((0, import_node_path8.join)(dir, gateFileName(projectSlug, record2.day)), `${JSON.stringify(record2)}
47650
47784
  `, "utf8");
47651
47785
  } catch {
47652
47786
  }
@@ -47769,12 +47903,12 @@ ${issuesBlock}`,
47769
47903
  }
47770
47904
 
47771
47905
  // src/consensus/sterile-cwd.ts
47772
- var import_node_fs4 = require("node:fs");
47906
+ var import_node_fs5 = require("node:fs");
47773
47907
  var import_node_os6 = require("node:os");
47774
47908
  var import_node_path9 = require("node:path");
47775
47909
  var sterileDir = null;
47776
47910
  function sterileCwd() {
47777
- sterileDir ??= (0, import_node_fs4.mkdtempSync)((0, import_node_path9.join)((0, import_node_os6.tmpdir)(), "mrrlin-gate-"));
47911
+ sterileDir ??= (0, import_node_fs5.mkdtempSync)((0, import_node_path9.join)((0, import_node_os6.tmpdir)(), "mrrlin-gate-"));
47778
47912
  return sterileDir;
47779
47913
  }
47780
47914
 
@@ -48018,7 +48152,7 @@ var personaCache = /* @__PURE__ */ new Map();
48018
48152
  function loadPersona(name) {
48019
48153
  const cached2 = personaCache.get(name);
48020
48154
  if (cached2 !== void 0) return cached2;
48021
- const content = import_node_fs5.default.readFileSync(import_node_path10.default.join(getPersonasDir(), `${name}.md`), "utf8");
48155
+ const content = import_node_fs6.default.readFileSync(import_node_path10.default.join(getPersonasDir(), `${name}.md`), "utf8");
48022
48156
  personaCache.set(name, content);
48023
48157
  return content;
48024
48158
  }
@@ -57245,7 +57379,7 @@ var import_promises7 = require("node:fs/promises");
57245
57379
  var import_node_path13 = require("node:path");
57246
57380
 
57247
57381
  // src/bridge-log.ts
57248
- var import_node_fs6 = require("node:fs");
57382
+ var import_node_fs7 = require("node:fs");
57249
57383
  var import_promises6 = require("node:fs/promises");
57250
57384
  var import_node_path12 = require("node:path");
57251
57385
 
@@ -57494,26 +57628,26 @@ function tightenBridgeLogPermissions(logsDir, opts = {}) {
57494
57628
  const uid = opts.uid ?? process.getuid?.();
57495
57629
  if (uid === void 0) return;
57496
57630
  try {
57497
- const dir = (0, import_node_fs6.lstatSync)(logsDir);
57631
+ const dir = (0, import_node_fs7.lstatSync)(logsDir);
57498
57632
  if (!dir.isDirectory()) return;
57499
57633
  if (dir.uid === uid && (dir.mode & 511) !== (dir.mode & LOG_DIR_MODE)) {
57500
- (0, import_node_fs6.chmodSync)(logsDir, dir.mode & LOG_DIR_MODE);
57634
+ (0, import_node_fs7.chmodSync)(logsDir, dir.mode & LOG_DIR_MODE);
57501
57635
  }
57502
57636
  } catch {
57503
57637
  return;
57504
57638
  }
57505
57639
  let names;
57506
57640
  try {
57507
- names = (0, import_node_fs6.readdirSync)(logsDir);
57641
+ names = (0, import_node_fs7.readdirSync)(logsDir);
57508
57642
  } catch {
57509
57643
  return;
57510
57644
  }
57511
57645
  for (const name of names) {
57512
57646
  const fp = (0, import_node_path12.join)(logsDir, name);
57513
57647
  try {
57514
- const st = (0, import_node_fs6.lstatSync)(fp);
57648
+ const st = (0, import_node_fs7.lstatSync)(fp);
57515
57649
  if (!st.isFile() || st.uid !== uid) continue;
57516
- if ((st.mode & 511) !== (st.mode & LOG_FILE_MODE)) (0, import_node_fs6.chmodSync)(fp, st.mode & LOG_FILE_MODE);
57650
+ if ((st.mode & 511) !== (st.mode & LOG_FILE_MODE)) (0, import_node_fs7.chmodSync)(fp, st.mode & LOG_FILE_MODE);
57517
57651
  } catch {
57518
57652
  }
57519
57653
  }
@@ -57531,7 +57665,7 @@ function createBridgeLogger(stateDir, env = process.env) {
57531
57665
  tightenBridgeLogPermissions(logsDir);
57532
57666
  if (!resolveBridgeLogEnabled(env)) return NOOP_LOGGER;
57533
57667
  try {
57534
- (0, import_node_fs6.mkdirSync)(logsDir, { recursive: true, mode: LOG_DIR_MODE });
57668
+ (0, import_node_fs7.mkdirSync)(logsDir, { recursive: true, mode: LOG_DIR_MODE });
57535
57669
  } catch {
57536
57670
  return NOOP_LOGGER;
57537
57671
  }
@@ -57580,7 +57714,7 @@ function createBridgeLogger(stateDir, env = process.env) {
57580
57714
  const sessionsPath = (0, import_node_path12.join)(logsDir, ".sessions.json");
57581
57715
  let sessionsObj = {};
57582
57716
  try {
57583
- const parsed = JSON.parse((0, import_node_fs6.readFileSync)(sessionsPath, "utf8"));
57717
+ const parsed = JSON.parse((0, import_node_fs7.readFileSync)(sessionsPath, "utf8"));
57584
57718
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) sessionsObj = parsed;
57585
57719
  } catch {
57586
57720
  sessionsObj = {};
@@ -57590,8 +57724,8 @@ function createBridgeLogger(stateDir, env = process.env) {
57590
57724
  if (idsToday.includes(sessionId)) return;
57591
57725
  sessionsObj[day] = [...idsToday, sessionId];
57592
57726
  const tmpPath = `${sessionsPath}.tmp`;
57593
- (0, import_node_fs6.writeFileSync)(tmpPath, JSON.stringify(sessionsObj), { mode: LOG_FILE_MODE });
57594
- (0, import_node_fs6.renameSync)(tmpPath, sessionsPath);
57727
+ (0, import_node_fs7.writeFileSync)(tmpPath, JSON.stringify(sessionsObj), { mode: LOG_FILE_MODE });
57728
+ (0, import_node_fs7.renameSync)(tmpPath, sessionsPath);
57595
57729
  };
57596
57730
  const write = (dir, rec) => {
57597
57731
  try {
@@ -57682,7 +57816,7 @@ function createBridgeLogger(stateDir, env = process.env) {
57682
57816
  ...recordingObligationUnresolved ? { recordingObligationUnresolved } : {},
57683
57817
  ...recordingObligationMultiResolve ? { recordingObligationMultiResolve } : {}
57684
57818
  }) + "\n";
57685
- (0, import_node_fs6.appendFileSync)(fileFor(), line, { mode: LOG_FILE_MODE });
57819
+ (0, import_node_fs7.appendFileSync)(fileFor(), line, { mode: LOG_FILE_MODE });
57686
57820
  if (rec.sessionId !== null) gainDay(rec.sessionId);
57687
57821
  } catch {
57688
57822
  }
@@ -57977,18 +58111,18 @@ async function enqueueAsyncTool(client, descriptor2, input) {
57977
58111
  }
57978
58112
 
57979
58113
  // src/checkout-registry.ts
57980
- var import_node_fs7 = require("node:fs");
58114
+ var import_node_fs8 = require("node:fs");
57981
58115
  var import_node_path14 = require("node:path");
57982
58116
  var CheckoutRegistry = class {
57983
58117
  file;
57984
58118
  constructor(stateDir) {
57985
58119
  this.file = (0, import_node_path14.join)(stateDir, "checkouts.json");
57986
- (0, import_node_fs7.mkdirSync)(stateDir, { recursive: true });
58120
+ (0, import_node_fs8.mkdirSync)(stateDir, { recursive: true });
57987
58121
  }
57988
58122
  read() {
57989
- if (!(0, import_node_fs7.existsSync)(this.file)) return {};
58123
+ if (!(0, import_node_fs8.existsSync)(this.file)) return {};
57990
58124
  try {
57991
- return JSON.parse((0, import_node_fs7.readFileSync)(this.file, "utf8"));
58125
+ return JSON.parse((0, import_node_fs8.readFileSync)(this.file, "utf8"));
57992
58126
  } catch {
57993
58127
  return {};
57994
58128
  }
@@ -57999,7 +58133,7 @@ var CheckoutRegistry = class {
57999
58133
  confirm(slug, path34, now) {
58000
58134
  const all = this.read();
58001
58135
  all[slug] = { path: path34, confirmedAt: now };
58002
- (0, import_node_fs7.writeFileSync)(this.file, JSON.stringify(all, null, 2));
58136
+ (0, import_node_fs8.writeFileSync)(this.file, JSON.stringify(all, null, 2));
58003
58137
  }
58004
58138
  /**
58005
58139
  * Task 5.2 (github-via-capabilities): another slug whose registered path resolves, via
@@ -58022,14 +58156,14 @@ var CheckoutRegistry = class {
58022
58156
  if (!own) return null;
58023
58157
  let ownReal;
58024
58158
  try {
58025
- ownReal = (0, import_node_fs7.realpathSync)(own.path);
58159
+ ownReal = (0, import_node_fs8.realpathSync)(own.path);
58026
58160
  } catch {
58027
58161
  return null;
58028
58162
  }
58029
58163
  for (const [otherSlug, entry] of Object.entries(this.read())) {
58030
58164
  if (otherSlug === slug) continue;
58031
58165
  try {
58032
- if ((0, import_node_fs7.realpathSync)(entry.path) === ownReal) return otherSlug;
58166
+ if ((0, import_node_fs8.realpathSync)(entry.path) === ownReal) return otherSlug;
58033
58167
  } catch {
58034
58168
  continue;
58035
58169
  }
@@ -58040,7 +58174,7 @@ var CheckoutRegistry = class {
58040
58174
 
58041
58175
  // src/checkout-handlers.ts
58042
58176
  var import_node_child_process13 = require("node:child_process");
58043
- var import_node_fs8 = require("node:fs");
58177
+ var import_node_fs9 = require("node:fs");
58044
58178
  var import_node_path15 = __toESM(require("node:path"), 1);
58045
58179
 
58046
58180
  // src/git-remote-match.ts
@@ -58076,7 +58210,7 @@ function validateCheckoutPath(checkoutPath, repo) {
58076
58210
  }
58077
58211
  let resolvedPath;
58078
58212
  try {
58079
- resolvedPath = (import_node_fs8.realpathSync.native ?? import_node_fs8.realpathSync)(trimmedPath);
58213
+ resolvedPath = (import_node_fs9.realpathSync.native ?? import_node_fs9.realpathSync)(trimmedPath);
58080
58214
  } catch {
58081
58215
  return {
58082
58216
  ok: false,
@@ -58138,7 +58272,7 @@ function checkoutStateData(projectSlug, entry, machineLabel) {
58138
58272
 
58139
58273
  // src/local-checkout.ts
58140
58274
  var import_node_child_process14 = require("node:child_process");
58141
- var import_node_fs9 = require("node:fs");
58275
+ var import_node_fs10 = require("node:fs");
58142
58276
  var import_node_os8 = require("node:os");
58143
58277
  var import_node_path16 = __toESM(require("node:path"), 1);
58144
58278
  var SYSTEM_PATH_PREFIXES = [
@@ -58202,7 +58336,7 @@ function checkLocalPathRules(input, options = {}) {
58202
58336
  if (!import_node_path16.default.isAbsolute(trimmed)) return { ok: false, code: "not_absolute", detail: `Path must be absolute, got: ${trimmed}` };
58203
58337
  let realPath;
58204
58338
  try {
58205
- realPath = (import_node_fs9.realpathSync.native ?? import_node_fs9.realpathSync)(trimmed);
58339
+ realPath = (import_node_fs10.realpathSync.native ?? import_node_fs10.realpathSync)(trimmed);
58206
58340
  } catch {
58207
58341
  return { ok: false, code: "not_found", detail: `Path does not exist or is not accessible: ${trimmed}` };
58208
58342
  }
@@ -58211,7 +58345,7 @@ function checkLocalPathRules(input, options = {}) {
58211
58345
  const home = options.homeDir ?? (0, import_node_os8.homedir)();
58212
58346
  let realHome = home;
58213
58347
  try {
58214
- realHome = (import_node_fs9.realpathSync.native ?? import_node_fs9.realpathSync)(home);
58348
+ realHome = (import_node_fs10.realpathSync.native ?? import_node_fs10.realpathSync)(home);
58215
58349
  } catch {
58216
58350
  }
58217
58351
  if (realPath === import_node_path16.default.parse(realPath).root || isUnderFolded(realHome, realPath)) {
@@ -58236,8 +58370,8 @@ function checkLocalPathRules(input, options = {}) {
58236
58370
  const uid = options.uid ?? (typeof process.getuid === "function" ? process.getuid() : void 0);
58237
58371
  let fd;
58238
58372
  try {
58239
- fd = (0, import_node_fs9.openSync)(realPath, import_node_fs9.constants.O_RDONLY | (import_node_fs9.constants.O_DIRECTORY ?? 0) | (import_node_fs9.constants.O_NOFOLLOW ?? 0));
58240
- const stat3 = (0, import_node_fs9.fstatSync)(fd);
58373
+ fd = (0, import_node_fs10.openSync)(realPath, import_node_fs10.constants.O_RDONLY | (import_node_fs10.constants.O_DIRECTORY ?? 0) | (import_node_fs10.constants.O_NOFOLLOW ?? 0));
58374
+ const stat3 = (0, import_node_fs10.fstatSync)(fd);
58241
58375
  if (!stat3.isDirectory()) return { ok: false, code: "not_a_directory", detail: `Not a directory: ${realPath}` };
58242
58376
  if (uid !== void 0 && stat3.uid !== uid) {
58243
58377
  return { ok: false, code: "not_owned", detail: `Directory is not owned by the bridge's user: ${realPath}` };
@@ -58247,7 +58381,7 @@ function checkLocalPathRules(input, options = {}) {
58247
58381
  if (code === "ENOTDIR") return { ok: false, code: "not_a_directory", detail: `Not a directory: ${realPath}` };
58248
58382
  return { ok: false, code: "path_changed", detail: `Could not open ${realPath} without following links (${code ?? "error"})` };
58249
58383
  } finally {
58250
- if (fd !== void 0) (0, import_node_fs9.closeSync)(fd);
58384
+ if (fd !== void 0) (0, import_node_fs10.closeSync)(fd);
58251
58385
  }
58252
58386
  return { ok: true, realPath };
58253
58387
  }
@@ -58268,7 +58402,7 @@ function validateLocalCheckoutPath(input, options = {}) {
58268
58402
  if (!checked.ok) return checked;
58269
58403
  const top = gitTopLevel(checked.realPath);
58270
58404
  if (!top) return { ok: false, code: "not_a_git_repo", detail: `Path is not inside a git repository: ${checked.realPath}` };
58271
- const realTop = (import_node_fs9.realpathSync.native ?? import_node_fs9.realpathSync)(top);
58405
+ const realTop = (import_node_fs10.realpathSync.native ?? import_node_fs10.realpathSync)(top);
58272
58406
  if (realTop !== checked.realPath) {
58273
58407
  return {
58274
58408
  ok: false,
@@ -58333,7 +58467,7 @@ function initLocalRepo(registry3, input, machineLabel, options = {}, now = (/* @
58333
58467
  runGit(realPath, ["init", "-q", "-b", "main"]);
58334
58468
  const gitignore = import_node_path16.default.join(realPath, ".gitignore");
58335
58469
  try {
58336
- (0, import_node_fs9.writeFileSync)(gitignore, DEFAULT_GITIGNORE, { flag: "wx" });
58470
+ (0, import_node_fs10.writeFileSync)(gitignore, DEFAULT_GITIGNORE, { flag: "wx" });
58337
58471
  wroteGitignore = true;
58338
58472
  } catch {
58339
58473
  }
@@ -58361,28 +58495,28 @@ function initLocalRepo(registry3, input, machineLabel, options = {}, now = (/* @
58361
58495
  // src/local-apply.ts
58362
58496
  var import_node_child_process17 = require("node:child_process");
58363
58497
  var import_node_crypto13 = __toESM(require("node:crypto"), 1);
58364
- var import_node_fs13 = require("node:fs");
58498
+ var import_node_fs14 = require("node:fs");
58365
58499
  var import_node_path20 = __toESM(require("node:path"), 1);
58366
58500
 
58367
58501
  // src/checkout-lock.ts
58368
58502
  var import_node_crypto10 = require("node:crypto");
58369
- var import_node_fs10 = require("node:fs");
58503
+ var import_node_fs11 = require("node:fs");
58370
58504
  var import_node_path17 = require("node:path");
58371
58505
  var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
58372
58506
  var DELIVERY_LOCK_NAME = "delivery";
58373
58507
  var DELIVERY_LOCK_MAX_WAIT_MS = 36e5;
58374
58508
  function deliveryLockKey(checkoutPath) {
58375
58509
  const absolute = (0, import_node_path17.resolve)(checkoutPath);
58376
- const canonical = (0, import_node_fs10.existsSync)(absolute) ? (0, import_node_fs10.realpathSync)(absolute) : absolute;
58510
+ const canonical = (0, import_node_fs11.existsSync)(absolute) ? (0, import_node_fs11.realpathSync)(absolute) : absolute;
58377
58511
  return `checkout-${(0, import_node_crypto10.createHash)("sha256").update(canonical).digest("hex").slice(0, 24)}`;
58378
58512
  }
58379
58513
  var LOCK_RETRY_INTERVAL_MS = 100;
58380
58514
  var DEFAULT_LOCK_MAX_WAIT_MS = 6e4;
58381
58515
  async function withCheckoutLock(locksDir, slug, fn, options = {}) {
58382
- (0, import_node_fs10.mkdirSync)(locksDir, { recursive: true });
58516
+ (0, import_node_fs11.mkdirSync)(locksDir, { recursive: true });
58383
58517
  const fileName = options.name ? `${slug}.${options.name}.lock` : `${slug}.lock`;
58384
58518
  const target = (0, import_node_path17.join)(locksDir, fileName);
58385
- if (!(0, import_node_fs10.existsSync)(target)) (0, import_node_fs10.writeFileSync)(target, "");
58519
+ if (!(0, import_node_fs11.existsSync)(target)) (0, import_node_fs11.writeFileSync)(target, "");
58386
58520
  const retries = Math.ceil((options.maxWaitMs ?? DEFAULT_LOCK_MAX_WAIT_MS) / LOCK_RETRY_INTERVAL_MS);
58387
58521
  const release = await import_proper_lockfile.default.lock(target, {
58388
58522
  retries: {
@@ -58410,7 +58544,7 @@ function isDeliveryLockHeld(locksDir, key) {
58410
58544
  // src/delivery/local-git.ts
58411
58545
  var import_node_child_process15 = require("node:child_process");
58412
58546
  var import_node_crypto11 = require("node:crypto");
58413
- var import_node_fs11 = require("node:fs");
58547
+ var import_node_fs12 = require("node:fs");
58414
58548
  var import_node_os9 = __toESM(require("node:os"), 1);
58415
58549
  var import_node_path18 = __toESM(require("node:path"), 1);
58416
58550
  function isLocalGitRoute(route) {
@@ -58418,10 +58552,10 @@ function isLocalGitRoute(route) {
58418
58552
  }
58419
58553
  var noHooksDir = null;
58420
58554
  function emptyHooksDir() {
58421
- if (!noHooksDir || !(0, import_node_fs11.existsSync)(noHooksDir)) {
58422
- noHooksDir = (0, import_node_fs11.mkdtempSync)(import_node_path18.default.join(import_node_os9.default.tmpdir(), "mrrlin-no-hooks-"));
58555
+ if (!noHooksDir || !(0, import_node_fs12.existsSync)(noHooksDir)) {
58556
+ noHooksDir = (0, import_node_fs12.mkdtempSync)(import_node_path18.default.join(import_node_os9.default.tmpdir(), "mrrlin-no-hooks-"));
58423
58557
  try {
58424
- (0, import_node_fs11.chmodSync)(noHooksDir, 320);
58558
+ (0, import_node_fs12.chmodSync)(noHooksDir, 320);
58425
58559
  } catch {
58426
58560
  }
58427
58561
  }
@@ -58579,29 +58713,29 @@ function resolveLocalDefaultBranch(checkout) {
58579
58713
  var NPM_PLACEHOLDER_TEST = /no test specified/i;
58580
58714
  function detectBuildCommands(worktree) {
58581
58715
  const pkgPath = import_node_path18.default.join(worktree, "package.json");
58582
- if ((0, import_node_fs11.existsSync)(pkgPath)) {
58716
+ if ((0, import_node_fs12.existsSync)(pkgPath)) {
58583
58717
  let scripts = {};
58584
58718
  let hasDeps = false;
58585
58719
  try {
58586
- const pkg = JSON.parse((0, import_node_fs11.readFileSync)(pkgPath, "utf8"));
58720
+ const pkg = JSON.parse((0, import_node_fs12.readFileSync)(pkgPath, "utf8"));
58587
58721
  scripts = pkg.scripts ?? {};
58588
58722
  hasDeps = Boolean(pkg.dependencies || pkg.devDependencies);
58589
58723
  } catch {
58590
58724
  return [];
58591
58725
  }
58592
- const pm = (0, import_node_fs11.existsSync)(import_node_path18.default.join(worktree, "pnpm-lock.yaml")) ? "pnpm" : (0, import_node_fs11.existsSync)(import_node_path18.default.join(worktree, "yarn.lock")) ? "yarn" : "npm";
58726
+ const pm = (0, import_node_fs12.existsSync)(import_node_path18.default.join(worktree, "pnpm-lock.yaml")) ? "pnpm" : (0, import_node_fs12.existsSync)(import_node_path18.default.join(worktree, "yarn.lock")) ? "yarn" : "npm";
58593
58727
  const commands = [];
58594
58728
  const wantsBuild = typeof scripts.build === "string" && scripts.build.trim().length > 0;
58595
58729
  const wantsTest = typeof scripts.test === "string" && scripts.test.trim().length > 0 && !NPM_PLACEHOLDER_TEST.test(scripts.test);
58596
- if ((wantsBuild || wantsTest) && hasDeps && !(0, import_node_fs11.existsSync)(import_node_path18.default.join(worktree, "node_modules"))) {
58730
+ if ((wantsBuild || wantsTest) && hasDeps && !(0, import_node_fs12.existsSync)(import_node_path18.default.join(worktree, "node_modules"))) {
58597
58731
  commands.push({ label: `${pm} install`, file: pm, args: ["install"] });
58598
58732
  }
58599
58733
  if (wantsBuild) commands.push({ label: `${pm} run build`, file: pm, args: ["run", "build"] });
58600
58734
  if (wantsTest) commands.push({ label: `${pm} run test`, file: pm, args: ["run", "test"] });
58601
58735
  return commands;
58602
58736
  }
58603
- const makefile = ["Makefile", "makefile", "GNUmakefile"].map((name) => import_node_path18.default.join(worktree, name)).find(import_node_fs11.existsSync);
58604
- if (makefile && /^test\s*:/m.test((0, import_node_fs11.readFileSync)(makefile, "utf8"))) {
58737
+ const makefile = ["Makefile", "makefile", "GNUmakefile"].map((name) => import_node_path18.default.join(worktree, name)).find(import_node_fs12.existsSync);
58738
+ if (makefile && /^test\s*:/m.test((0, import_node_fs12.readFileSync)(makefile, "utf8"))) {
58605
58739
  return [{ label: "make test", file: "make", args: ["test"] }];
58606
58740
  }
58607
58741
  return [];
@@ -58719,10 +58853,10 @@ async function deliverLocalGit(input) {
58719
58853
  throw new Error(`local_delivery_commit_count_unreadable: git rev-list returned ${String(commitCount)}`);
58720
58854
  }
58721
58855
  const checkoutDigest = sha256(input.checkoutRealPath);
58722
- (0, import_node_fs11.mkdirSync)(input.evidenceDir, { recursive: true, mode: 448 });
58856
+ (0, import_node_fs12.mkdirSync)(input.evidenceDir, { recursive: true, mode: 448 });
58723
58857
  const evidenceFile = import_node_path18.default.join(input.evidenceDir, `${input.runId}.json`);
58724
58858
  if (!(commitCount > 0)) {
58725
- (0, import_node_fs11.writeFileSync)(
58859
+ (0, import_node_fs12.writeFileSync)(
58726
58860
  evidenceFile,
58727
58861
  JSON.stringify({ checkout: input.checkoutRealPath, branch, baseSha: input.baseSha, headSha, commitCount, steps: [], ...integration }, null, 2),
58728
58862
  { mode: 384 }
@@ -58745,7 +58879,7 @@ async function deliverLocalGit(input) {
58745
58879
  noBuildStep: steps.length === 0,
58746
58880
  checkoutDigest
58747
58881
  };
58748
- (0, import_node_fs11.writeFileSync)(evidenceFile, JSON.stringify({ checkout: input.checkoutRealPath, ...evidence, logs, ...integration }, null, 2), { mode: 384 });
58882
+ (0, import_node_fs12.writeFileSync)(evidenceFile, JSON.stringify({ checkout: input.checkoutRealPath, ...evidence, logs, ...integration }, null, 2), { mode: 384 });
58749
58883
  const problem = checkLocalBuildEvidence({ type: "build", value: headSha }, evidence);
58750
58884
  if (problem) {
58751
58885
  return { ok: false, reason: "build_failed", detail: `local_build_failed: ${problem}`, evidence, evidenceFile };
@@ -58826,7 +58960,7 @@ function verifyIntegrationResolved(input) {
58826
58960
  }
58827
58961
  const withMarkers = input.files.filter((file2) => {
58828
58962
  const full = import_node_path18.default.join(input.worktreePath, file2);
58829
- return (0, import_node_fs11.existsSync)(full) && CONFLICT_MARKER_LINE.test((0, import_node_fs11.readFileSync)(full, "utf8"));
58963
+ return (0, import_node_fs12.existsSync)(full) && CONFLICT_MARKER_LINE.test((0, import_node_fs12.readFileSync)(full, "utf8"));
58830
58964
  });
58831
58965
  if (withMarkers.length > 0) {
58832
58966
  return { ok: false, reason: "conflict_markers", detail: withMarkers.join(", ") };
@@ -58991,7 +59125,7 @@ function applyLocalRun(input) {
58991
59125
  }
58992
59126
  function realpathOr(target) {
58993
59127
  try {
58994
- return (0, import_node_fs11.realpathSync)(target);
59128
+ return (0, import_node_fs12.realpathSync)(target);
58995
59129
  } catch {
58996
59130
  return target;
58997
59131
  }
@@ -59002,7 +59136,7 @@ function worktreesWithBranch(repo, branch) {
59002
59136
  const lines2 = block.split("\n");
59003
59137
  const worktree = lines2.find((line) => line.startsWith("worktree "))?.slice("worktree ".length);
59004
59138
  if (!worktree || lines2.includes("bare") || lines2.some((line) => line.startsWith("prunable"))) continue;
59005
- if (lines2.includes(`branch refs/heads/${branch}`) && (0, import_node_fs11.existsSync)(worktree)) holders.push(worktree);
59139
+ if (lines2.includes(`branch refs/heads/${branch}`) && (0, import_node_fs12.existsSync)(worktree)) holders.push(worktree);
59006
59140
  }
59007
59141
  return holders;
59008
59142
  }
@@ -59010,7 +59144,7 @@ function worktreesWithBranch(repo, branch) {
59010
59144
  // src/worktree.ts
59011
59145
  var import_node_child_process16 = require("node:child_process");
59012
59146
  var import_node_crypto12 = require("node:crypto");
59013
- var import_node_fs12 = require("node:fs");
59147
+ var import_node_fs13 = require("node:fs");
59014
59148
  var import_node_path19 = require("node:path");
59015
59149
  function worktreeBranch(runId) {
59016
59150
  return `mrrlin/run-${runId}`;
@@ -59023,20 +59157,20 @@ function disabledGitHooksPath(locksDir, scope) {
59023
59157
  function prepareDisabledGitHooksDir(locksDir, scope) {
59024
59158
  const hooksDir = disabledGitHooksPath(locksDir, scope);
59025
59159
  const hooksRoot = (0, import_node_path19.resolve)(hooksDir, "..");
59026
- (0, import_node_fs12.mkdirSync)(hooksRoot, { recursive: true, mode: 448 });
59027
- (0, import_node_fs12.mkdirSync)(hooksDir, { recursive: true, mode: 320 });
59028
- if ((0, import_node_fs12.readdirSync)(hooksDir).length > 0) {
59160
+ (0, import_node_fs13.mkdirSync)(hooksRoot, { recursive: true, mode: 448 });
59161
+ (0, import_node_fs13.mkdirSync)(hooksDir, { recursive: true, mode: 320 });
59162
+ if ((0, import_node_fs13.readdirSync)(hooksDir).length > 0) {
59029
59163
  throw new Error(`disabled_git_hooks_dir_not_empty: ${hooksDir}`);
59030
59164
  }
59031
59165
  try {
59032
- (0, import_node_fs12.chmodSync)(hooksDir, 320);
59166
+ (0, import_node_fs13.chmodSync)(hooksDir, 320);
59033
59167
  } catch {
59034
59168
  }
59035
59169
  return hooksDir;
59036
59170
  }
59037
59171
  function removeDisabledGitHooksDir(locksDir, scope) {
59038
59172
  try {
59039
- (0, import_node_fs12.rmdirSync)(disabledGitHooksPath(locksDir, scope));
59173
+ (0, import_node_fs13.rmdirSync)(disabledGitHooksPath(locksDir, scope));
59040
59174
  } catch {
59041
59175
  }
59042
59176
  }
@@ -59062,11 +59196,11 @@ async function createRunWorktree(opts) {
59062
59196
  const worktreePath = (0, import_node_path19.join)(opts.worktreeRoot, opts.slug, opts.runId);
59063
59197
  const hooksDir = prepareDisabledGitHooksDir(opts.locksDir, opts.runId);
59064
59198
  await withCheckoutLock(opts.locksDir, opts.slug, async () => {
59065
- (0, import_node_fs12.mkdirSync)(opts.worktreeRoot, { recursive: true });
59199
+ (0, import_node_fs13.mkdirSync)(opts.worktreeRoot, { recursive: true });
59066
59200
  const base = opts.local ? `refs/heads/${opts.defaultBranch}` : `origin/${opts.defaultBranch}`;
59067
59201
  try {
59068
59202
  if (!opts.local) git2(opts.checkout, ["fetch", "origin", opts.defaultBranch], hooksDir);
59069
- if (!(0, import_node_fs12.existsSync)(worktreePath)) {
59203
+ if (!(0, import_node_fs13.existsSync)(worktreePath)) {
59070
59204
  git2(opts.checkout, [
59071
59205
  "worktree",
59072
59206
  "add",
@@ -59092,11 +59226,11 @@ async function openRunWorktree(opts) {
59092
59226
  const branch = worktreeBranch(opts.runId);
59093
59227
  const env = buildLocalStepEnv();
59094
59228
  await withCheckoutLock(opts.locksDir, opts.slug, async () => {
59095
- if ((0, import_node_fs12.existsSync)(worktreePath)) {
59096
- const real = (0, import_node_fs12.realpathSync)(worktreePath);
59229
+ if ((0, import_node_fs13.existsSync)(worktreePath)) {
59230
+ const real = (0, import_node_fs13.realpathSync)(worktreePath);
59097
59231
  const listed = git2(opts.checkout, ["worktree", "list", "--porcelain"], hooksDir, env).split(/\n\s*\n/).map((block) => block.split("\n")).find((lines2) => {
59098
59232
  const listedPath = lines2.find((line) => line.startsWith("worktree "))?.slice("worktree ".length);
59099
- return listedPath !== void 0 && (0, import_node_fs12.existsSync)(listedPath) && (0, import_node_fs12.realpathSync)(listedPath) === real;
59233
+ return listedPath !== void 0 && (0, import_node_fs13.existsSync)(listedPath) && (0, import_node_fs13.realpathSync)(listedPath) === real;
59100
59234
  });
59101
59235
  if (!listed) {
59102
59236
  throw new Error(`run_worktree_invalid: ${worktreePath} exists but is not a worktree of ${opts.checkout}`);
@@ -59111,7 +59245,7 @@ async function openRunWorktree(opts) {
59111
59245
  } catch {
59112
59246
  throw new Error(`run_branch_missing: ${opts.checkout} has no branch ${branch}`);
59113
59247
  }
59114
- (0, import_node_fs12.mkdirSync)(opts.worktreeRoot, { recursive: true });
59248
+ (0, import_node_fs13.mkdirSync)(opts.worktreeRoot, { recursive: true });
59115
59249
  git2(opts.checkout, ["worktree", "prune"], hooksDir, env);
59116
59250
  git2(opts.checkout, ["worktree", "add", worktreePath, branch], hooksDir, env);
59117
59251
  });
@@ -59243,7 +59377,7 @@ async function sweepOrphanWorktrees(opts) {
59243
59377
  const hooksDir = prepareDisabledGitHooksDir(opts.locksDir, `sweep:${opts.slug}`);
59244
59378
  const ownedPrefix = (() => {
59245
59379
  try {
59246
- return (import_node_fs12.realpathSync.native ?? import_node_fs12.realpathSync)(opts.worktreeRoot);
59380
+ return (import_node_fs13.realpathSync.native ?? import_node_fs13.realpathSync)(opts.worktreeRoot);
59247
59381
  } catch {
59248
59382
  return opts.worktreeRoot;
59249
59383
  }
@@ -59257,7 +59391,7 @@ async function sweepOrphanWorktrees(opts) {
59257
59391
  if (!wt) continue;
59258
59392
  const canonicalWt = (() => {
59259
59393
  try {
59260
- return (import_node_fs12.realpathSync.native ?? import_node_fs12.realpathSync)(wt);
59394
+ return (import_node_fs13.realpathSync.native ?? import_node_fs13.realpathSync)(wt);
59261
59395
  } catch {
59262
59396
  return wt;
59263
59397
  }
@@ -59285,7 +59419,7 @@ async function sweepOrphanWorktrees(opts) {
59285
59419
  // src/local-apply.ts
59286
59420
  function readIntegratedTip(localEvidenceDir, runId) {
59287
59421
  try {
59288
- const evidence = JSON.parse((0, import_node_fs13.readFileSync)(import_node_path20.default.join(localEvidenceDir, `${runId}.json`), "utf8"));
59422
+ const evidence = JSON.parse((0, import_node_fs14.readFileSync)(import_node_path20.default.join(localEvidenceDir, `${runId}.json`), "utf8"));
59289
59423
  return typeof evidence.integration?.defaultTipSha === "string" ? evidence.integration.defaultTipSha : null;
59290
59424
  } catch {
59291
59425
  return null;
@@ -59308,7 +59442,7 @@ function gitRead(cwd, args) {
59308
59442
  }
59309
59443
  function isBridgeRunWorktree(worktreePath, checkout, worktreeRoot) {
59310
59444
  const real = (target) => {
59311
- const resolved = (import_node_fs13.realpathSync.native ?? import_node_fs13.realpathSync)(target);
59445
+ const resolved = (import_node_fs14.realpathSync.native ?? import_node_fs14.realpathSync)(target);
59312
59446
  return process.platform === "win32" ? resolved.toLowerCase() : resolved;
59313
59447
  };
59314
59448
  try {
@@ -59473,8 +59607,8 @@ async function applyLocalRunForTool(deps, input) {
59473
59607
  })
59474
59608
  );
59475
59609
  const record2 = (extra) => {
59476
- (0, import_node_fs13.mkdirSync)(deps.localEvidenceDir, { recursive: true, mode: 448 });
59477
- (0, import_node_fs13.writeFileSync)(
59610
+ (0, import_node_fs14.mkdirSync)(deps.localEvidenceDir, { recursive: true, mode: 448 });
59611
+ (0, import_node_fs14.writeFileSync)(
59478
59612
  import_node_path20.default.join(deps.localEvidenceDir, `${runId}.apply.json`),
59479
59613
  JSON.stringify({ checkout, defaultBranch, ...extra }, null, 2),
59480
59614
  { mode: 384 }
@@ -59616,7 +59750,7 @@ async function applyLocalRunForTool(deps, input) {
59616
59750
  );
59617
59751
  if (landing.outcome === "applied" || landing.outcome === "already_applied") {
59618
59752
  const worktreePath = import_node_path20.default.join(deps.worktreeRoot, projectSlug, runId);
59619
- if ((0, import_node_fs13.existsSync)(worktreePath)) {
59753
+ if ((0, import_node_fs14.existsSync)(worktreePath)) {
59620
59754
  await removeRunWorktree({ checkout, worktreePath, locksDir: deps.locksDir, slug: projectSlug }).catch(() => {
59621
59755
  });
59622
59756
  }
@@ -59642,7 +59776,7 @@ async function applyLocalRunForTool(deps, input) {
59642
59776
  }
59643
59777
 
59644
59778
  // src/operator-token.ts
59645
- var import_node_fs14 = require("node:fs");
59779
+ var import_node_fs15 = require("node:fs");
59646
59780
  var import_node_os10 = __toESM(require("node:os"), 1);
59647
59781
  var import_node_path21 = __toESM(require("node:path"), 1);
59648
59782
  function operatorDir() {
@@ -59654,7 +59788,7 @@ function operatorTokenPath() {
59654
59788
  }
59655
59789
  function readOperatorToken() {
59656
59790
  try {
59657
- const token = (0, import_node_fs14.readFileSync)(operatorTokenPath(), "utf8").trim();
59791
+ const token = (0, import_node_fs15.readFileSync)(operatorTokenPath(), "utf8").trim();
59658
59792
  return token.length > 0 ? token : null;
59659
59793
  } catch {
59660
59794
  return null;
@@ -59662,8 +59796,8 @@ function readOperatorToken() {
59662
59796
  }
59663
59797
  function persistOperatorToken(token) {
59664
59798
  const dir = operatorDir();
59665
- (0, import_node_fs14.mkdirSync)(dir, { recursive: true, mode: 448 });
59666
- (0, import_node_fs14.writeFileSync)(operatorTokenPath(), `${token.trim()}
59799
+ (0, import_node_fs15.mkdirSync)(dir, { recursive: true, mode: 448 });
59800
+ (0, import_node_fs15.writeFileSync)(operatorTokenPath(), `${token.trim()}
59667
59801
  `, { encoding: "utf8", mode: 384 });
59668
59802
  }
59669
59803
  function agentCredentialPath() {
@@ -59671,15 +59805,15 @@ function agentCredentialPath() {
59671
59805
  }
59672
59806
  function persistAgentSecret(secret) {
59673
59807
  const dir = operatorDir();
59674
- (0, import_node_fs14.mkdirSync)(dir, { recursive: true, mode: 448 });
59675
- (0, import_node_fs14.writeFileSync)(agentCredentialPath(), `${secret.trim()}
59808
+ (0, import_node_fs15.mkdirSync)(dir, { recursive: true, mode: 448 });
59809
+ (0, import_node_fs15.writeFileSync)(agentCredentialPath(), `${secret.trim()}
59676
59810
  `, { encoding: "utf8", mode: 384 });
59677
59811
  }
59678
59812
  function readAgentSecret() {
59679
59813
  const fromEnv = process.env.MRRLIN_AGENT_SECRET?.trim();
59680
59814
  if (fromEnv) return fromEnv;
59681
59815
  try {
59682
- const raw = (0, import_node_fs14.readFileSync)(agentCredentialPath(), "utf8").trim();
59816
+ const raw = (0, import_node_fs15.readFileSync)(agentCredentialPath(), "utf8").trim();
59683
59817
  return raw || void 0;
59684
59818
  } catch {
59685
59819
  return void 0;
@@ -59688,7 +59822,7 @@ function readAgentSecret() {
59688
59822
 
59689
59823
  // src/worker-token.ts
59690
59824
  var import_node_crypto14 = require("node:crypto");
59691
- var import_node_fs15 = require("node:fs");
59825
+ var import_node_fs16 = require("node:fs");
59692
59826
  var import_node_os11 = __toESM(require("node:os"), 1);
59693
59827
  var import_node_path22 = __toESM(require("node:path"), 1);
59694
59828
  var DEFAULT_WORKER_PORT = 8792;
@@ -59707,7 +59841,7 @@ function workerTokenPath() {
59707
59841
  }
59708
59842
  function readWorkerToken() {
59709
59843
  try {
59710
- const token = (0, import_node_fs15.readFileSync)(workerTokenPath(), "utf8").trim();
59844
+ const token = (0, import_node_fs16.readFileSync)(workerTokenPath(), "utf8").trim();
59711
59845
  return token.length > 0 ? token : null;
59712
59846
  } catch {
59713
59847
  return null;
@@ -59717,9 +59851,9 @@ function readOrCreateWorkerToken() {
59717
59851
  const existing = readWorkerToken();
59718
59852
  if (existing) return existing;
59719
59853
  const dir = workerDir();
59720
- (0, import_node_fs15.mkdirSync)(dir, { recursive: true, mode: 448 });
59854
+ (0, import_node_fs16.mkdirSync)(dir, { recursive: true, mode: 448 });
59721
59855
  const token = (0, import_node_crypto14.randomBytes)(32).toString("hex");
59722
- (0, import_node_fs15.writeFileSync)(workerTokenPath(), `${token}
59856
+ (0, import_node_fs16.writeFileSync)(workerTokenPath(), `${token}
59723
59857
  `, { encoding: "utf8", mode: 384 });
59724
59858
  return token;
59725
59859
  }
@@ -59867,7 +60001,7 @@ function threadRetireDisabled(env = process.env) {
59867
60001
  // src/context-compact/handles.ts
59868
60002
  var MRRLIN_HANDLE_SCHEME = "mrrlin://";
59869
60003
  var SLUG_RE = /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/;
59870
- var TASK_ID_RE = /^GT-[A-Za-z0-9-]+$/;
60004
+ var TASK_ID_RE2 = /^GT-[A-Za-z0-9-]+$/;
59871
60005
  var WIKI_ID_RE = /^WK-[A-Za-z0-9-]+$/;
59872
60006
  var RUN_ID_RE = /^ER-[A-Za-z0-9-]+$/;
59873
60007
  function isProjectSlug(value) {
@@ -59903,7 +60037,7 @@ function parseMrrlinHandle(value) {
59903
60037
  case "task": {
59904
60038
  if (tail2.length < 1 || tail2.length > 2) return null;
59905
60039
  const taskId = tail2[0] ?? "";
59906
- if (!TASK_ID_RE.test(taskId)) return null;
60040
+ if (!TASK_ID_RE2.test(taskId)) return null;
59907
60041
  if (tail2.length === 1) return { kind: "task", projectSlug: slug, taskId };
59908
60042
  if (tail2[1] !== "events") return null;
59909
60043
  return { kind: "task-events", projectSlug: slug, taskId };
@@ -62197,7 +62331,7 @@ async function installAgy(options) {
62197
62331
 
62198
62332
  // src/provider-readiness.ts
62199
62333
  var import_promises10 = require("node:fs/promises");
62200
- var import_node_fs16 = require("node:fs");
62334
+ var import_node_fs17 = require("node:fs");
62201
62335
  var import_node_os14 = __toESM(require("node:os"), 1);
62202
62336
  var import_node_path25 = __toESM(require("node:path"), 1);
62203
62337
  var import_semver2 = __toESM(require_semver2(), 1);
@@ -62367,7 +62501,7 @@ async function verifyProviderReadiness(provider, run3, opts = {}) {
62367
62501
  if (provider === "codex") {
62368
62502
  const authPath = import_node_path25.default.join(resolveCodexHome2(opts), "auth.json");
62369
62503
  try {
62370
- await (0, import_promises10.access)(authPath, import_node_fs16.constants.F_OK);
62504
+ await (0, import_promises10.access)(authPath, import_node_fs17.constants.F_OK);
62371
62505
  checks.auth = true;
62372
62506
  } catch {
62373
62507
  details.push(`auth: ${authPath} not found`);
@@ -62663,7 +62797,7 @@ async function runBrowserServeProxy(opts) {
62663
62797
  }
62664
62798
 
62665
62799
  // src/director-bridge.ts
62666
- var import_node_fs28 = __toESM(require("node:fs"), 1);
62800
+ var import_node_fs29 = __toESM(require("node:fs"), 1);
62667
62801
  var import_node_http3 = __toESM(require("node:http"), 1);
62668
62802
  var import_node_os22 = __toESM(require("node:os"), 1);
62669
62803
  var import_node_path43 = __toESM(require("node:path"), 1);
@@ -63223,13 +63357,13 @@ function directorThreadEnv(projectSlug) {
63223
63357
  // src/self-update.ts
63224
63358
  var import_node_child_process21 = require("node:child_process");
63225
63359
  var import_node_crypto16 = require("node:crypto");
63226
- var import_node_fs18 = require("node:fs");
63360
+ var import_node_fs19 = require("node:fs");
63227
63361
  var import_node_path27 = __toESM(require("node:path"), 1);
63228
63362
  var import_semver3 = __toESM(require_semver2(), 1);
63229
63363
 
63230
63364
  // src/codex-auth-preflight.ts
63231
63365
  var import_node_child_process20 = require("node:child_process");
63232
- var import_node_fs17 = require("node:fs");
63366
+ var import_node_fs18 = require("node:fs");
63233
63367
  var import_node_os16 = __toESM(require("node:os"), 1);
63234
63368
  var import_node_path26 = __toESM(require("node:path"), 1);
63235
63369
  var DEFAULT_CODEX_AUTH_MIN_TTL_SECONDS = 15 * 60;
@@ -63371,10 +63505,10 @@ function inspectCodexAuthForBridgeUpdate(opts = {}) {
63371
63505
  const nowMs = opts.nowMs ?? Date.now();
63372
63506
  const minTtlSeconds = opts.minTtlSeconds ?? codexAuthMinTtlSeconds(env);
63373
63507
  const authPath = resolveCodexAuthPath({ env, homeDir: opts.homeDir });
63374
- const readFile9 = opts.readFileSyncImpl ?? ((p, encoding) => (0, import_node_fs17.readFileSync)(p, encoding));
63508
+ const readFile10 = opts.readFileSyncImpl ?? ((p, encoding) => (0, import_node_fs18.readFileSync)(p, encoding));
63375
63509
  let raw;
63376
63510
  try {
63377
- raw = readFile9(authPath, "utf8");
63511
+ raw = readFile10(authPath, "utf8");
63378
63512
  } catch (e) {
63379
63513
  const code = typeof e === "object" && e !== null && "code" in e ? String(e.code) : "";
63380
63514
  const status = code === "ENOENT" ? "missing" : "unreadable";
@@ -63495,7 +63629,7 @@ function resolveBinPath(opts) {
63495
63629
  return null;
63496
63630
  }
63497
63631
  });
63498
- const existsSync7 = opts.existsSync ?? import_node_fs18.existsSync;
63632
+ const existsSync7 = opts.existsSync ?? import_node_fs19.existsSync;
63499
63633
  const resolved = whichSync(BIN_NAME);
63500
63634
  if (resolved && existsSync7(resolved)) {
63501
63635
  return { path: resolved, source: "which" };
@@ -63535,7 +63669,7 @@ function sha2562(buf) {
63535
63669
  function startSelfUpdate(deps) {
63536
63670
  const log = deps.log ?? (() => {
63537
63671
  });
63538
- const readFile9 = deps.readFileSyncImpl ?? ((p) => (0, import_node_fs18.readFileSync)(p));
63672
+ const readFile10 = deps.readFileSyncImpl ?? ((p) => (0, import_node_fs19.readFileSync)(p));
63539
63673
  const setIntervalFn = deps.setIntervalImpl ?? setInterval;
63540
63674
  const clearIntervalFn = deps.clearIntervalImpl ?? clearInterval;
63541
63675
  const intervalMs = deps.intervalMs ?? readIntervalEnv("MRRLIN_DIRECTOR_BRIDGE_SELF_UPDATE_INTERVAL_MS", DEFAULT_INTERVAL_MS);
@@ -63661,7 +63795,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
63661
63795
  }
63662
63796
  let startupBinSha = null;
63663
63797
  try {
63664
- startupBinSha = sha2562(readFile9(deps.binPath));
63798
+ startupBinSha = sha2562(readFile10(deps.binPath));
63665
63799
  } catch (e) {
63666
63800
  log("warn", "bridge.self_update.startup_hash_read_failed", {
63667
63801
  err: String(e?.message ?? e)
@@ -63740,14 +63874,14 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
63740
63874
  try {
63741
63875
  if (!startupBinSha) {
63742
63876
  try {
63743
- startupBinSha = sha2562(readFile9(deps.binPath));
63877
+ startupBinSha = sha2562(readFile10(deps.binPath));
63744
63878
  } catch {
63745
63879
  return;
63746
63880
  }
63747
63881
  }
63748
63882
  let currentBinSha;
63749
63883
  try {
63750
- currentBinSha = sha2562(readFile9(deps.binPath));
63884
+ currentBinSha = sha2562(readFile10(deps.binPath));
63751
63885
  } catch {
63752
63886
  return;
63753
63887
  }
@@ -63826,7 +63960,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
63826
63960
  }
63827
63961
 
63828
63962
  // src/_generated/version.ts
63829
- var PKG_VERSION = "0.4.148";
63963
+ var PKG_VERSION = "0.4.150";
63830
63964
 
63831
63965
  // src/bridge-allowed-origins.ts
63832
63966
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
@@ -64736,7 +64870,7 @@ function parseLedger(value) {
64736
64870
  }
64737
64871
 
64738
64872
  // src/api-base-url-migrate.ts
64739
- var import_node_fs19 = __toESM(require("node:fs"), 1);
64873
+ var import_node_fs20 = __toESM(require("node:fs"), 1);
64740
64874
  var import_node_os17 = __toESM(require("node:os"), 1);
64741
64875
  var import_node_path29 = __toESM(require("node:path"), 1);
64742
64876
 
@@ -64819,16 +64953,16 @@ function defaultDeps(deps) {
64819
64953
  return {
64820
64954
  home,
64821
64955
  codexHome: deps.codexHome ?? process.env.CODEX_HOME?.trim() ?? import_node_path29.default.join(home, ".codex"),
64822
- readFile: deps.readFile ?? ((p) => import_node_fs19.default.readFileSync(p, "utf8")),
64956
+ readFile: deps.readFile ?? ((p) => import_node_fs20.default.readFileSync(p, "utf8")),
64823
64957
  // Temp-file + atomic rename so a concurrent `serve` and `director-bridge` startup can never
64824
64958
  // interleave partial writes into a config the next start has to parse. Note this normalizes the
64825
64959
  // file to 0o600 — deliberate, since both files can carry a credential-bearing URL.
64826
64960
  writeFile: deps.writeFile ?? ((p, c) => {
64827
64961
  const tmp = `${p}.tmp-${process.pid}`;
64828
- import_node_fs19.default.writeFileSync(tmp, c, { mode: 384 });
64829
- import_node_fs19.default.renameSync(tmp, p);
64962
+ import_node_fs20.default.writeFileSync(tmp, c, { mode: 384 });
64963
+ import_node_fs20.default.renameSync(tmp, p);
64830
64964
  }),
64831
- exists: deps.exists ?? ((p) => import_node_fs19.default.existsSync(p)),
64965
+ exists: deps.exists ?? ((p) => import_node_fs20.default.existsSync(p)),
64832
64966
  log: deps.log ?? ((m) => process.stderr.write(`${m}
64833
64967
  `))
64834
64968
  };
@@ -65181,7 +65315,7 @@ function migrateRetiredApiBaseUrls(deps = {}) {
65181
65315
  }
65182
65316
 
65183
65317
  // src/bridge-health.ts
65184
- var import_node_fs20 = require("node:fs");
65318
+ var import_node_fs21 = require("node:fs");
65185
65319
  var import_node_path30 = __toESM(require("node:path"), 1);
65186
65320
  var SENTINEL_FILE_NAME = "bridge-health-circuit-breaker.json";
65187
65321
  var CRASH_WINDOW_MS = 60 * 60 * 1e3;
@@ -65196,7 +65330,7 @@ function isCrashSentinel(value) {
65196
65330
  async function readCrashSentinel(stateDir, now = Date.now) {
65197
65331
  const sentinelPath = import_node_path30.default.join(stateDir, SENTINEL_FILE_NAME);
65198
65332
  try {
65199
- const raw = await import_node_fs20.promises.readFile(sentinelPath, "utf8");
65333
+ const raw = await import_node_fs21.promises.readFile(sentinelPath, "utf8");
65200
65334
  const parsed = JSON.parse(raw);
65201
65335
  if (isCrashSentinel(parsed)) return parsed;
65202
65336
  } catch {
@@ -65204,11 +65338,11 @@ async function readCrashSentinel(stateDir, now = Date.now) {
65204
65338
  return { crashCount: 0, windowStartedAt: new Date(now()).toISOString() };
65205
65339
  }
65206
65340
  async function writeCrashSentinel(stateDir, sentinel) {
65207
- await import_node_fs20.promises.mkdir(stateDir, { recursive: true });
65341
+ await import_node_fs21.promises.mkdir(stateDir, { recursive: true });
65208
65342
  const sentinelPath = import_node_path30.default.join(stateDir, SENTINEL_FILE_NAME);
65209
65343
  const tmpPath = `${sentinelPath}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;
65210
- await import_node_fs20.promises.writeFile(tmpPath, JSON.stringify(sentinel), "utf8");
65211
- await import_node_fs20.promises.rename(tmpPath, sentinelPath);
65344
+ await import_node_fs21.promises.writeFile(tmpPath, JSON.stringify(sentinel), "utf8");
65345
+ await import_node_fs21.promises.rename(tmpPath, sentinelPath);
65212
65346
  }
65213
65347
  function withTimeout(fn, ms = DEFAULT_OPERATION_TIMEOUT_MS) {
65214
65348
  const controller = new AbortController();
@@ -65840,7 +65974,7 @@ var import_node_path34 = require("node:path");
65840
65974
 
65841
65975
  // src/telemetry/installation-id.ts
65842
65976
  var import_node_crypto19 = require("node:crypto");
65843
- var import_node_fs21 = require("node:fs");
65977
+ var import_node_fs22 = require("node:fs");
65844
65978
  var import_node_path33 = require("node:path");
65845
65979
  var FILE_NAME = "installation-id";
65846
65980
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
@@ -65851,12 +65985,12 @@ function resolveInstallationId(stateDir) {
65851
65985
  const path34 = (0, import_node_path33.join)(stateDir, FILE_NAME);
65852
65986
  let id;
65853
65987
  try {
65854
- id = (0, import_node_fs21.readFileSync)(path34, "utf8").trim();
65988
+ id = (0, import_node_fs22.readFileSync)(path34, "utf8").trim();
65855
65989
  if (!UUID.test(id)) throw new Error("unusable");
65856
65990
  } catch {
65857
65991
  id = (0, import_node_crypto19.randomUUID)();
65858
- (0, import_node_fs21.mkdirSync)((0, import_node_path33.dirname)(path34), { recursive: true });
65859
- (0, import_node_fs21.writeFileSync)(path34, `${id}
65992
+ (0, import_node_fs22.mkdirSync)((0, import_node_path33.dirname)(path34), { recursive: true });
65993
+ (0, import_node_fs22.writeFileSync)(path34, `${id}
65860
65994
  `, "utf8");
65861
65995
  }
65862
65996
  cache.set(stateDir, id);
@@ -67640,7 +67774,8 @@ var BASE_INSTRUCTIONS_PREFIX = [
67640
67774
  " browser_snapshot, browser_type, etc. Never invoke the same-named tools from any other",
67641
67775
  " browser MCP (`playwright`, `chrome-devtools`, `puppeteer`, ...) that may also be connected.",
67642
67776
  "- Only `mrrlin-browser` uses this project's dedicated, version-pinned Chromium + persistent",
67643
- " operator profile (`~/.mrrlin/browser/profile`). Others share the default Playwright profile",
67777
+ " operator profile (`~/.mrrlin/browser/profile`; a code run uses its task's own copy of it).",
67778
+ " Others share the default Playwright profile",
67644
67779
  " and lose login/cookie state across runs.",
67645
67780
  "- If tool listings show duplicate names across servers, prefer the `mrrlin-browser` one",
67646
67781
  " unconditionally. Do not switch mid-run.",
@@ -67687,6 +67822,26 @@ var EXECUTOR_BASE_INSTRUCTIONS = [
67687
67822
  // Dogfood v2 F-20: "stop the turn after the next increment" made runs stop after one small step;
67688
67823
  // see workTurnInstruction.
67689
67824
  "turn: carry the task as far as you can and stop only when it is complete or you are genuinely blocked.",
67825
+ // Dogfood v2 F-26: a login check failed in the run's own browser because the executor's page set
67826
+ // `Referrer-Policy: no-referrer` -- under the Fetch spec ("append a request `Origin` header") a
67827
+ // non-GET/HEAD request with that policy carries `Origin: null` -- and its own Origin guard rejected
67828
+ // it. The executor blamed the automation browser and handed the operator a flow that fails in
67829
+ // every Chrome.
67830
+ "When a check you run fails \u2014 a test, a request, a browser flow \u2014 treat it as a defect in your own",
67831
+ "change until you have evidence otherwise. Before blaming the browser, a tool, or the environment,",
67832
+ "find the concrete cause: inspect what your code sends and receives, and reproduce the failure another",
67833
+ "way. Only concrete evidence proves an environment cause: a log or response that shows an outage or",
67834
+ "a platform restriction (a provider outage, a rate limit, a network or DNS failure, a sandbox or OS",
67835
+ "restriction), or the same failure reproduced with that browser or tool on a minimal case outside the project",
67836
+ "together with evidence that the project cannot remove the trigger within the task without weakening security.",
67837
+ "A browser or tool behaving as its specification says is your code's problem, not the environment's;",
67838
+ "an environment cause shown that way is a legitimate blocker, and an unproven environment",
67839
+ "problem is not a blocker. A failure that also happens without your change is a defect already in the",
67840
+ "project, not an environment problem: fix it if the task covers it, otherwise report it as a defect.",
67841
+ "Fix the cause without removing or relaxing a security",
67842
+ "check (origin, CSRF, authentication, authorization) just to make a check pass. Never hand the operator",
67843
+ "a flow to verify that failed when you ran it unless you name the evidence that it will behave",
67844
+ "differently for them.",
67690
67845
  // ADR 0022 Phase 3: the executor is the orchestrator, not the sole worker. It has the
67691
67846
  // external-agents `pick`/`dispatch` MCP tools (a pool of cheap/free models) and should
67692
67847
  // delegate judgment-requiring work to them, keeping itself as judge. If external-agents
@@ -68101,10 +68256,16 @@ async function driveRun(deps, projectSlug, runId) {
68101
68256
  if (kind === "code_change") localGitMode = isLocalGitRoute(routeResolution.route);
68102
68257
  }
68103
68258
  }
68259
+ let browserEnv = {};
68260
+ try {
68261
+ browserEnv = await deps.runBrowserThreadEnv?.(projectSlug, task.id) ?? {};
68262
+ } catch {
68263
+ browserEnv = {};
68264
+ }
68265
+ const runProfilePath = browserEnv[BROWSER_PROFILE_DIR_ENV];
68104
68266
  const needsBrowser = claimed.prerequisites?.some((p) => p.mcp === "mrrlin-browser") || task.domains?.includes("browser");
68105
68267
  if (needsBrowser) {
68106
- const checkBusy = deps.checkBrowserBusy ?? checkBrowserBusy;
68107
- const busy = checkBusy();
68268
+ const busy = deps.checkBrowserBusy ? deps.checkBrowserBusy(runProfilePath) : checkBrowserBusy(runProfilePath ? { profilePath: runProfilePath } : {});
68108
68269
  if (busy.busy) {
68109
68270
  await failRun(
68110
68271
  deps,
@@ -68513,7 +68674,8 @@ ${renderTaskStateSection(taskState)}`;
68513
68674
  // (acquireExecutorAgent) never reached them and every project tool refused the run with "no
68514
68675
  // active workspace bound". The adapter applies this per thread (codexThreadConfig), and a
68515
68676
  // resumed thread loaded with another binding is refused and restarted fresh.
68516
- env: directorThreadEnv(projectSlug)
68677
+ // Dogfood v2 F-21: plus the run's own per-task browser profile (routed to `mrrlin-browser`).
68678
+ env: { ...directorThreadEnv(projectSlug), ...browserEnv }
68517
68679
  };
68518
68680
  let resumed = true;
68519
68681
  let acquireResult;
@@ -70560,7 +70722,7 @@ async function runAsyncBackstopSweep(deps, drive = (slug, jobId) => driveAsyncJo
70560
70722
  }
70561
70723
 
70562
70724
  // src/bridge-artifacts.ts
70563
- var import_node_fs22 = __toESM(require("node:fs"), 1);
70725
+ var import_node_fs23 = __toESM(require("node:fs"), 1);
70564
70726
  var import_promises14 = __toESM(require("node:fs/promises"), 1);
70565
70727
  var import_node_path36 = __toESM(require("node:path"), 1);
70566
70728
  var DEFAULT_MAX_ARTIFACTS_BYTES = 500 * 1024 * 1024;
@@ -70570,9 +70732,9 @@ function resolveArtifactsDir(baseStateDir) {
70570
70732
  return import_node_path36.default.join(stateDir, "artifacts");
70571
70733
  }
70572
70734
  function ensureDir(dir) {
70573
- import_node_fs22.default.mkdirSync(dir, { recursive: true, mode: 448 });
70735
+ import_node_fs23.default.mkdirSync(dir, { recursive: true, mode: 448 });
70574
70736
  try {
70575
- import_node_fs22.default.chmodSync(dir, 448);
70737
+ import_node_fs23.default.chmodSync(dir, 448);
70576
70738
  } catch {
70577
70739
  }
70578
70740
  }
@@ -70872,7 +71034,7 @@ function agentIdleMs(provider) {
70872
71034
  }
70873
71035
 
70874
71036
  // src/thread-index.ts
70875
- var import_node_fs23 = require("node:fs");
71037
+ var import_node_fs24 = require("node:fs");
70876
71038
  var import_node_path37 = __toESM(require("node:path"), 1);
70877
71039
  function threadIndexPath(stateDir) {
70878
71040
  return import_node_path37.default.join(stateDir, "threads.json");
@@ -70881,7 +71043,7 @@ function loadThreadIndex(stateDir, ttlMs, now) {
70881
71043
  const result = /* @__PURE__ */ new Map();
70882
71044
  let parsed;
70883
71045
  try {
70884
- parsed = JSON.parse((0, import_node_fs23.readFileSync)(threadIndexPath(stateDir), "utf8"));
71046
+ parsed = JSON.parse((0, import_node_fs24.readFileSync)(threadIndexPath(stateDir), "utf8"));
70885
71047
  } catch {
70886
71048
  return result;
70887
71049
  }
@@ -70906,8 +71068,8 @@ function loadThreadIndex(stateDir, ttlMs, now) {
70906
71068
  return result;
70907
71069
  }
70908
71070
  function saveThreadIndex(stateDir, entries) {
70909
- (0, import_node_fs23.mkdirSync)(stateDir, { recursive: true, mode: 448 });
70910
- (0, import_node_fs23.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
71071
+ (0, import_node_fs24.mkdirSync)(stateDir, { recursive: true, mode: 448 });
71072
+ (0, import_node_fs24.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
70911
71073
  `, {
70912
71074
  encoding: "utf8",
70913
71075
  mode: 384
@@ -71043,7 +71205,7 @@ function createToolBusyClock(opts) {
71043
71205
 
71044
71206
  // src/remote-phone-relay.ts
71045
71207
  var import_node_events3 = require("node:events");
71046
- var import_node_fs24 = require("node:fs");
71208
+ var import_node_fs25 = require("node:fs");
71047
71209
  var import_node_os18 = require("node:os");
71048
71210
  var import_node_path38 = require("node:path");
71049
71211
 
@@ -74618,7 +74780,7 @@ var DirectorRelay = class {
74618
74780
  function loadOrCreateAgentDeviceKey() {
74619
74781
  const path34 = (0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin", "agent-device-key");
74620
74782
  try {
74621
- const raw = JSON.parse((0, import_node_fs24.readFileSync)(path34, "utf8"));
74783
+ const raw = JSON.parse((0, import_node_fs25.readFileSync)(path34, "utf8"));
74622
74784
  if (typeof raw.priv === "string" && typeof raw.pub === "string") {
74623
74785
  return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
74624
74786
  }
@@ -74626,8 +74788,8 @@ function loadOrCreateAgentDeviceKey() {
74626
74788
  }
74627
74789
  const kp = generateIdentityKeyPair();
74628
74790
  try {
74629
- (0, import_node_fs24.mkdirSync)((0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin"), { recursive: true });
74630
- (0, import_node_fs24.writeFileSync)(
74791
+ (0, import_node_fs25.mkdirSync)((0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin"), { recursive: true });
74792
+ (0, import_node_fs25.writeFileSync)(
74631
74793
  path34,
74632
74794
  JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
74633
74795
  { mode: 384 }
@@ -74639,7 +74801,7 @@ function loadOrCreateAgentDeviceKey() {
74639
74801
  var AGENT_PAIRING_PATH = (0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin", "agent-pairing.json");
74640
74802
  function loadAgentPairing() {
74641
74803
  try {
74642
- const raw = JSON.parse((0, import_node_fs24.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
74804
+ const raw = JSON.parse((0, import_node_fs25.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
74643
74805
  if (typeof raw.channelId === "string" && typeof raw.agentControlSecret === "string" && typeof raw.relayAuth === "string" && typeof raw.peerIdentityKey === "string") {
74644
74806
  return {
74645
74807
  channelId: raw.channelId,
@@ -74654,8 +74816,8 @@ function loadAgentPairing() {
74654
74816
  }
74655
74817
  function saveAgentPairing(record2) {
74656
74818
  try {
74657
- (0, import_node_fs24.mkdirSync)((0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin"), { recursive: true });
74658
- (0, import_node_fs24.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
74819
+ (0, import_node_fs25.mkdirSync)((0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin"), { recursive: true });
74820
+ (0, import_node_fs25.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
74659
74821
  } catch {
74660
74822
  }
74661
74823
  }
@@ -75102,7 +75264,7 @@ var import_node_http2 = __toESM(require("node:http"), 1);
75102
75264
  var import_node_https2 = __toESM(require("node:https"), 1);
75103
75265
  var import_node_net2 = __toESM(require("node:net"), 1);
75104
75266
  var import_node_tls = __toESM(require("node:tls"), 1);
75105
- var import_node_fs25 = __toESM(require("node:fs"), 1);
75267
+ var import_node_fs26 = __toESM(require("node:fs"), 1);
75106
75268
  var import_node_os19 = __toESM(require("node:os"), 1);
75107
75269
  var import_node_path39 = __toESM(require("node:path"), 1);
75108
75270
  var import_node_crypto22 = __toESM(require("node:crypto"), 1);
@@ -75447,16 +75609,16 @@ async function createVerificationBrokerSession(options) {
75447
75609
  let createdDir = null;
75448
75610
  let socketPath = options.socketPath;
75449
75611
  if (!socketPath) {
75450
- createdDir = import_node_fs25.default.mkdtempSync(import_node_path39.default.join(import_node_os19.default.tmpdir(), "mrrlin-broker-"));
75451
- import_node_fs25.default.chmodSync(createdDir, 448);
75612
+ createdDir = import_node_fs26.default.mkdtempSync(import_node_path39.default.join(import_node_os19.default.tmpdir(), "mrrlin-broker-"));
75613
+ import_node_fs26.default.chmodSync(createdDir, 448);
75452
75614
  socketPath = import_node_path39.default.join(
75453
75615
  createdDir,
75454
75616
  `broker-${options.runId.replace(/[^a-zA-Z0-9_-]/g, "")}-${nonce}.sock`
75455
75617
  );
75456
75618
  }
75457
75619
  try {
75458
- if (import_node_fs25.default.existsSync(socketPath)) {
75459
- import_node_fs25.default.unlinkSync(socketPath);
75620
+ if (import_node_fs26.default.existsSync(socketPath)) {
75621
+ import_node_fs26.default.unlinkSync(socketPath);
75460
75622
  }
75461
75623
  } catch {
75462
75624
  }
@@ -75744,12 +75906,12 @@ async function createVerificationBrokerSession(options) {
75744
75906
  } catch (err) {
75745
75907
  server.close();
75746
75908
  try {
75747
- if (import_node_fs25.default.existsSync(socketPath)) import_node_fs25.default.unlinkSync(socketPath);
75909
+ if (import_node_fs26.default.existsSync(socketPath)) import_node_fs26.default.unlinkSync(socketPath);
75748
75910
  } catch (error51) {
75749
75911
  }
75750
75912
  if (createdDir) {
75751
75913
  try {
75752
- import_node_fs25.default.rmSync(createdDir, { recursive: true, force: true });
75914
+ import_node_fs26.default.rmSync(createdDir, { recursive: true, force: true });
75753
75915
  } catch (error51) {
75754
75916
  }
75755
75917
  }
@@ -75777,14 +75939,14 @@ async function createVerificationBrokerSession(options) {
75777
75939
  server.close(() => resolve3());
75778
75940
  });
75779
75941
  try {
75780
- if (import_node_fs25.default.existsSync(socketPath)) {
75781
- import_node_fs25.default.unlinkSync(socketPath);
75942
+ if (import_node_fs26.default.existsSync(socketPath)) {
75943
+ import_node_fs26.default.unlinkSync(socketPath);
75782
75944
  }
75783
75945
  } catch {
75784
75946
  }
75785
75947
  if (createdDir) {
75786
75948
  try {
75787
- import_node_fs25.default.rmSync(createdDir, { recursive: true, force: true });
75949
+ import_node_fs26.default.rmSync(createdDir, { recursive: true, force: true });
75788
75950
  } catch {
75789
75951
  }
75790
75952
  }
@@ -76280,7 +76442,7 @@ function extractVerificationSection(markdown) {
76280
76442
  }
76281
76443
 
76282
76444
  // src/director-reseed.ts
76283
- var import_node_fs26 = require("node:fs");
76445
+ var import_node_fs27 = require("node:fs");
76284
76446
  var import_node_readline2 = require("node:readline");
76285
76447
  var import_node_path40 = require("node:path");
76286
76448
  function estimateTokens(s) {
@@ -76433,7 +76595,7 @@ async function readSessionRows(logsDir, files, sessionIds) {
76433
76595
  for (const f of files) {
76434
76596
  const filePath = (0, import_node_path40.join)(logsDir, f);
76435
76597
  try {
76436
- const stream = (0, import_node_fs26.createReadStream)(filePath, { encoding: "utf8" });
76598
+ const stream = (0, import_node_fs27.createReadStream)(filePath, { encoding: "utf8" });
76437
76599
  const rl = (0, import_node_readline2.createInterface)({ input: stream, crlfDelay: Infinity });
76438
76600
  try {
76439
76601
  for await (const line of rl) {
@@ -76457,7 +76619,7 @@ async function readSessionRows(logsDir, files, sessionIds) {
76457
76619
  }
76458
76620
 
76459
76621
  // src/external-agents-scrub.ts
76460
- var import_node_fs27 = __toESM(require("node:fs"), 1);
76622
+ var import_node_fs28 = __toESM(require("node:fs"), 1);
76461
76623
  var import_node_os20 = __toESM(require("node:os"), 1);
76462
76624
  var import_node_path41 = __toESM(require("node:path"), 1);
76463
76625
  var REDACTION = "[REDACTED]";
@@ -76468,7 +76630,7 @@ function readKeysEnv() {
76468
76630
  const filePath = KEYS_ENV_PATH();
76469
76631
  let mtimeMs = 0;
76470
76632
  try {
76471
- mtimeMs = import_node_fs27.default.statSync(filePath).mtimeMs;
76633
+ mtimeMs = import_node_fs28.default.statSync(filePath).mtimeMs;
76472
76634
  } catch {
76473
76635
  mtimeMs = 0;
76474
76636
  }
@@ -76477,7 +76639,7 @@ function readKeysEnv() {
76477
76639
  }
76478
76640
  const map2 = /* @__PURE__ */ new Map();
76479
76641
  try {
76480
- const content = import_node_fs27.default.readFileSync(filePath, "utf8");
76642
+ const content = import_node_fs28.default.readFileSync(filePath, "utf8");
76481
76643
  for (const rawLine of content.split(/\r?\n/)) {
76482
76644
  const line = rawLine.trim();
76483
76645
  if (line === "" || line.startsWith("#")) continue;
@@ -76883,7 +77045,7 @@ function addBridgeModel(target, model) {
76883
77045
  }
76884
77046
  function readTextIfExists(filePath) {
76885
77047
  try {
76886
- return import_node_fs28.default.readFileSync(filePath, "utf8");
77048
+ return import_node_fs29.default.readFileSync(filePath, "utf8");
76887
77049
  } catch {
76888
77050
  return null;
76889
77051
  }
@@ -76962,7 +77124,7 @@ function readCodexFallbackModels() {
76962
77124
  }
76963
77125
  const automationsDir = import_node_path43.default.join(codexHome, "automations");
76964
77126
  try {
76965
- for (const entry of import_node_fs28.default.readdirSync(automationsDir, { withFileTypes: true })) {
77127
+ for (const entry of import_node_fs29.default.readdirSync(automationsDir, { withFileTypes: true })) {
76966
77128
  if (!entry.isDirectory()) continue;
76967
77129
  for (const slug of readKnownGptSlugsFromTomlFile(import_node_path43.default.join(automationsDir, entry.name, "automation.toml"))) {
76968
77130
  addBridgeModel(
@@ -76992,8 +77154,8 @@ function selfUpdateInboxItemId(offeredVersion) {
76992
77154
  function neutralCheckoutCwd(stateDir) {
76993
77155
  const dir = import_node_path43.default.join(stateDir, "no-checkout");
76994
77156
  try {
76995
- import_node_fs28.default.mkdirSync(dir, { recursive: true });
76996
- if (!import_node_fs28.default.existsSync(import_node_path43.default.join(dir, ".git"))) {
77157
+ import_node_fs29.default.mkdirSync(dir, { recursive: true });
77158
+ if (!import_node_fs29.default.existsSync(import_node_path43.default.join(dir, ".git"))) {
76997
77159
  try {
76998
77160
  (0, import_node_child_process26.spawnSync)("git", ["init", "-b", "main"], { cwd: dir, stdio: "ignore" });
76999
77161
  } catch {
@@ -77185,7 +77347,7 @@ function buildThreadStartParams(msg, config2, desiredModel) {
77185
77347
  "- When creating a task, classify and supply the `domain` field explicitly based on the nature of the work: pass `domain:'code'` for software engineering work, `domain:'seo'` for SEO/optimization, `domain:'marketing'` for marketing/growth, or `domain:'content'` for content creation/writing \u2014 the same way you select category/subcategory. A follow-up task spawned with `parentTaskId` inherits its parent's domain automatically and requires no explicit domain.",
77186
77348
  '- When a task needs a browser (login flows, UI verification/clicks, scraping), pass `prerequisites:[{mcp:"mrrlin-browser",reason:"..."}]` to `create_execution_run`. If that run later fails into a handoff, the operator gets a one-click "Launch browser & resume" that brings up the dedicated browser as the turn starts.',
77187
77349
  "- When you actually drive a browser (calling `browser_navigate`, `browser_click`, `browser_snapshot`, `browser_type`, etc.), invoke those tools from the **`mrrlin-browser`** MCP server ONLY. Do NOT use tools from any other browser MCP (`playwright`, `chrome-devtools`, `puppeteer`, etc.) even if they are also connected on this operator's box \u2014 those use a shared/default Playwright profile that is fragile across runs. Only `mrrlin-browser` uses this project's dedicated Chromium + persistent operator profile (`~/.mrrlin/browser/profile`). If your host exposes multiple browser MCPs with overlapping tool names, prefer the `mrrlin-browser` server unconditionally.",
77188
- "- Exactly one browser session exists for this operator, shared across every concurrent chat and task on their box \u2014 a deliberate tradeoff, not a bug, so a second concurrent user of the browser is expected, not exceptional. If a `mrrlin-browser` call fails with `Browser is already in use for ...`, that means another one of the operator's own chats or tasks is driving the browser RIGHT NOW. Do not present this as a broken tool or a mysterious error: tell the operator plainly that the browser is busy with another task, ask them to wait for it to finish (or close it), and offer to retry shortly. Never retry-loop this silently.",
77350
+ "- One browser session is shared by every concurrent chat on this operator's box (a code run drives its task's own copy) \u2014 a deliberate tradeoff, so a second user is expected, not exceptional. If a `mrrlin-browser` call fails with `Browser is already in use for ...`, that means another one of the operator's own chats or tasks is driving the browser RIGHT NOW. Do not present this as a broken tool or a mysterious error: tell the operator plainly that the browser is busy with another task, ask them to wait for it to finish (or close it), and offer to retry shortly. Never retry-loop this silently.",
77189
77351
  '- If a mrrlin-browser call result additionally contains the text "Self-collision recovered", that is a DIFFERENT case from the one above: it was YOUR OWN earlier turn in THIS SAME chat that left the browser open, not another task. It has already been closed automatically \u2014 briefly tell the operator that, then immediately retry the exact same browser action once without asking first.',
77190
77352
  "",
77191
77353
  'Research playbook \u2014 when the user asks about a topic, an area, or "what do we have on X":',
@@ -77560,7 +77722,7 @@ async function runOrphanWorktreeSweep(client, opts) {
77560
77722
  const cutoff = Date.now() - worktreeRetentionMs();
77561
77723
  const isReapable = (worktreePath) => {
77562
77724
  try {
77563
- return import_node_fs28.default.statSync(worktreePath).mtimeMs < cutoff;
77725
+ return import_node_fs29.default.statSync(worktreePath).mtimeMs < cutoff;
77564
77726
  } catch {
77565
77727
  return false;
77566
77728
  }
@@ -79545,6 +79707,9 @@ async function startDirectorBridge() {
79545
79707
  // fail. If the resolved branch does not exist on origin, createRunWorktree surfaces a
79546
79708
  // `default_branch_unresolved` error which the consumer routes to a clean operator handoff.
79547
79709
  getDefaultBranch: (projectSlug) => Promise.resolve(resolveDefaultBranch(checkoutRegistry.get(projectSlug)?.path ?? null)),
79710
+ // Dogfood v2 F-21: each task's runs drive their own browser profile, so another session's
79711
+ // long-lived `mrrlin-browser` holding the shared one cannot block a run's browser.
79712
+ runBrowserThreadEnv: (projectSlug, taskId) => runBrowserThreadEnv(projectSlug, taskId),
79548
79713
  // ADR 0007 self-review: critique the committed diff on the executor's own agent handle before
79549
79714
  // push/PR. Reuses the collected-turn runner (startThread + collect assistant text).
79550
79715
  selfReviewTurn: createSelfReviewTurn({
@@ -79568,7 +79733,7 @@ async function startDirectorBridge() {
79568
79733
  runVerificationTurn: createRunVerificationTurn({
79569
79734
  startSandbox: async (egressDomains, providerId, opts) => {
79570
79735
  opts?.wrapCommand?.(["node"]);
79571
- const scratchDir = import_node_fs28.default.mkdtempSync(import_node_path43.default.join(import_node_os22.default.tmpdir(), "mrrlin-verify-"));
79736
+ const scratchDir = import_node_fs29.default.mkdtempSync(import_node_path43.default.join(import_node_os22.default.tmpdir(), "mrrlin-verify-"));
79572
79737
  const executor = await startExecutorServer({
79573
79738
  worktree: scratchDir,
79574
79739
  disabledGitHooksDir: prepareDisabledGitHooksDir(import_node_path43.default.join(config2.stateDir, "locks"), import_node_path43.default.basename(scratchDir)),
@@ -79584,7 +79749,7 @@ async function startDirectorBridge() {
79584
79749
  dispose: () => {
79585
79750
  executor.dispose();
79586
79751
  try {
79587
- import_node_fs28.default.rmSync(scratchDir, { recursive: true, force: true });
79752
+ import_node_fs29.default.rmSync(scratchDir, { recursive: true, force: true });
79588
79753
  } catch {
79589
79754
  }
79590
79755
  },
@@ -79943,7 +80108,7 @@ async function startDirectorBridge() {
79943
80108
  const bridgeLogger = createBridgeLogger(config2.stateDir, process.env);
79944
80109
  let bridgeBinShaShort = "unknown00000";
79945
80110
  try {
79946
- bridgeBinShaShort = import_node_crypto23.default.createHash("sha256").update(import_node_fs28.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
80111
+ bridgeBinShaShort = import_node_crypto23.default.createHash("sha256").update(import_node_fs29.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
79947
80112
  } catch {
79948
80113
  }
79949
80114
  attachBridgeWss(server, {
@@ -80413,13 +80578,13 @@ function readOrCreateBridgeToken(stateDir) {
80413
80578
  if (explicit) return explicit;
80414
80579
  const tokenPath = import_node_path43.default.join(stateDir, "token.txt");
80415
80580
  try {
80416
- const existing = import_node_fs28.default.readFileSync(tokenPath, "utf8").trim();
80581
+ const existing = import_node_fs29.default.readFileSync(tokenPath, "utf8").trim();
80417
80582
  if (existing) return existing;
80418
80583
  } catch {
80419
80584
  }
80420
- import_node_fs28.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
80585
+ import_node_fs29.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
80421
80586
  const token = import_node_crypto23.default.randomBytes(32).toString("base64url");
80422
- import_node_fs28.default.writeFileSync(tokenPath, `${token}
80587
+ import_node_fs29.default.writeFileSync(tokenPath, `${token}
80423
80588
  `, { mode: 384 });
80424
80589
  return token;
80425
80590
  }
@@ -81328,7 +81493,7 @@ function runSetCredential(args) {
81328
81493
 
81329
81494
  // src/install-service.ts
81330
81495
  var import_node_os23 = __toESM(require("node:os"), 1);
81331
- var import_node_fs29 = require("node:fs");
81496
+ var import_node_fs30 = require("node:fs");
81332
81497
  var import_node_path44 = __toESM(require("node:path"), 1);
81333
81498
  function parseEnvLine(line, env) {
81334
81499
  const trimmed = line.trim();
@@ -81765,7 +81930,7 @@ function performConfigBackup(deps, ecoPath, existingText) {
81765
81930
  var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
81766
81931
  function defaultHomeOwnerUid(home) {
81767
81932
  try {
81768
- return (0, import_node_fs29.statSync)(home).uid;
81933
+ return (0, import_node_fs30.statSync)(home).uid;
81769
81934
  } catch {
81770
81935
  return null;
81771
81936
  }
@@ -82117,7 +82282,7 @@ function augmentProcessPathWithCommonDirs() {
82117
82282
  ];
82118
82283
  const existing = (process.env.PATH || "").split(import_node_path48.default.delimiter).filter(Boolean);
82119
82284
  const existingSet = new Set(existing);
82120
- const toAdd = candidates.filter((d) => !existingSet.has(d) && (0, import_node_fs30.existsSync)(d));
82285
+ const toAdd = candidates.filter((d) => !existingSet.has(d) && (0, import_node_fs31.existsSync)(d));
82121
82286
  if (toAdd.length > 0) {
82122
82287
  process.env.PATH = [...existing, ...toAdd].join(import_node_path48.default.delimiter);
82123
82288
  }
@@ -82147,7 +82312,7 @@ function bootHookStatus() {
82147
82312
  for (const candidate of candidates) {
82148
82313
  const printed = (0, import_node_child_process27.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
82149
82314
  if (printed.status !== 0) continue;
82150
- if (!(0, import_node_fs30.existsSync)(candidate.plist)) continue;
82315
+ if (!(0, import_node_fs31.existsSync)(candidate.plist)) continue;
82151
82316
  const out = printed.stdout ?? "";
82152
82317
  const runs = /^\s*runs\s*=\s*(\d+)/m.exec(out);
82153
82318
  const exitCode = /^\s*last exit code\s*=\s*(-?\d+)/m.exec(out);
@@ -82426,7 +82591,7 @@ async function main() {
82426
82591
  }
82427
82592
  try {
82428
82593
  const codexHome = process.env.CODEX_HOME ?? import_node_path48.default.join(process.env.HOME ?? (0, import_node_os25.homedir)(), ".codex");
82429
- (0, import_node_fs30.rmSync)(import_node_path48.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
82594
+ (0, import_node_fs31.rmSync)(import_node_path48.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
82430
82595
  } catch {
82431
82596
  }
82432
82597
  const claudeResult = await installClaude({ binPath, force, serveEnv });
@@ -82496,13 +82661,13 @@ async function main() {
82496
82661
  env: process.env,
82497
82662
  cwd: process.cwd(),
82498
82663
  writeFile: (p, c) => {
82499
- (0, import_node_fs30.mkdirSync)(import_node_path48.default.dirname(p), { recursive: true, mode: 448 });
82500
- (0, import_node_fs30.writeFileSync)(p, c, { mode: 384 });
82664
+ (0, import_node_fs31.mkdirSync)(import_node_path48.default.dirname(p), { recursive: true, mode: 448 });
82665
+ (0, import_node_fs31.writeFileSync)(p, c, { mode: 384 });
82501
82666
  },
82502
- writeExclusiveFile: (p, c) => (0, import_node_fs30.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
82667
+ writeExclusiveFile: (p, c) => (0, import_node_fs31.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
82503
82668
  listDir: (p) => {
82504
82669
  try {
82505
- return (0, import_node_fs30.readdirSync)(p);
82670
+ return (0, import_node_fs31.readdirSync)(p);
82506
82671
  } catch {
82507
82672
  return null;
82508
82673
  }
@@ -82513,7 +82678,7 @@ async function main() {
82513
82678
  // value", never a failed install. See readExistingTelemetryDefaultProject.
82514
82679
  readFile: (p) => {
82515
82680
  try {
82516
- return (0, import_node_fs30.readFileSync)(p, "utf8");
82681
+ return (0, import_node_fs31.readFileSync)(p, "utf8");
82517
82682
  } catch {
82518
82683
  return null;
82519
82684
  }
@@ -82534,7 +82699,7 @@ async function main() {
82534
82699
  runPm2: (a) => ({ code: pm2Runner(a).code }),
82535
82700
  removeFile: (p) => {
82536
82701
  try {
82537
- (0, import_node_fs30.rmSync)(p, { force: true });
82702
+ (0, import_node_fs31.rmSync)(p, { force: true });
82538
82703
  } catch {
82539
82704
  }
82540
82705
  },
@@ -82555,7 +82720,7 @@ async function main() {
82555
82720
  runPm2: (a) => ({ code: pm2Runner(a).code }),
82556
82721
  removeFile: (p) => {
82557
82722
  try {
82558
- (0, import_node_fs30.rmSync)(p, { force: true });
82723
+ (0, import_node_fs31.rmSync)(p, { force: true });
82559
82724
  } catch {
82560
82725
  }
82561
82726
  },
@@ -82582,7 +82747,7 @@ async function main() {
82582
82747
  log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
82583
82748
  }
82584
82749
  try {
82585
- (0, import_node_fs30.rmSync)(import_node_path48.default.join(home, ".mrrlin"), { recursive: true, force: true });
82750
+ (0, import_node_fs31.rmSync)(import_node_path48.default.join(home, ".mrrlin"), { recursive: true, force: true });
82586
82751
  } catch {
82587
82752
  }
82588
82753
  log("removed ~/.mrrlin");