@mrrlin-dev/mcp 0.4.149 → 0.4.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +386 -241
- 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(
|
|
350
|
-
return
|
|
349
|
+
function isDigit(cp2) {
|
|
350
|
+
return cp2 >= CHAR_0 && cp2 <= CHAR_9;
|
|
351
351
|
}
|
|
352
|
-
function isHexit(
|
|
353
|
-
return
|
|
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(
|
|
356
|
-
return
|
|
355
|
+
function isBit(cp2) {
|
|
356
|
+
return cp2 === CHAR_1 || cp2 === CHAR_0;
|
|
357
357
|
}
|
|
358
|
-
function isOctit(
|
|
359
|
-
return
|
|
358
|
+
function isOctit(cp2) {
|
|
359
|
+
return cp2 >= CHAR_0 && cp2 <= CHAR_7;
|
|
360
360
|
}
|
|
361
|
-
function isAlphaNumQuoteHyphen(
|
|
362
|
-
return
|
|
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(
|
|
365
|
-
return
|
|
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(
|
|
5122
|
-
if (
|
|
5123
|
-
return BYTE_HEX[192 |
|
|
5121
|
+
function percentEncodeNonAscii(cp2) {
|
|
5122
|
+
if (cp2 < 2048) {
|
|
5123
|
+
return BYTE_HEX[192 | cp2 >> 6] + BYTE_HEX[128 | cp2 & 63];
|
|
5124
5124
|
}
|
|
5125
|
-
if (
|
|
5126
|
-
return BYTE_HEX[224 |
|
|
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 |
|
|
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(
|
|
5493
|
-
return
|
|
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(
|
|
9736
|
+
function hookChildProcess(cp2, parsed) {
|
|
9737
9737
|
if (!isWin) {
|
|
9738
9738
|
return;
|
|
9739
9739
|
}
|
|
9740
|
-
const originalEmit =
|
|
9741
|
-
|
|
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(
|
|
9745
|
+
return originalEmit.call(cp2, "error", err);
|
|
9746
9746
|
}
|
|
9747
9747
|
}
|
|
9748
|
-
return originalEmit.apply(
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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(
|
|
9887
|
-
return
|
|
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 =
|
|
10292
|
-
function
|
|
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
|
|
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
|
-
|
|
21822
|
-
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
22371
|
+
for (const cp2 of customPaths) {
|
|
22241
22372
|
candidatePaths.unshift({
|
|
22242
|
-
path:
|
|
22373
|
+
path: cp2,
|
|
22243
22374
|
source: "custom",
|
|
22244
|
-
format:
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
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 &&
|
|
46287
|
+
if (envKeyPath && import_node_fs3.default.existsSync(envKeyPath)) {
|
|
46154
46288
|
try {
|
|
46155
|
-
const pem =
|
|
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") :
|
|
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 (!
|
|
46184
|
-
|
|
46317
|
+
if (!import_node_fs3.default.existsSync(candidate)) {
|
|
46318
|
+
import_node_fs3.default.mkdirSync(candidate, { recursive: true, mode: 448 });
|
|
46185
46319
|
}
|
|
46186
|
-
const real =
|
|
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 (
|
|
46803
|
-
|
|
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
|
-
|
|
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 (
|
|
46838
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
47161
|
+
import_node_fs3.default.writeFileSync(hostsFilePath, hostsLines.join("\n") + "\n", { mode: 420 });
|
|
47028
47162
|
} catch {
|
|
47029
47163
|
}
|
|
47030
|
-
const privateDir =
|
|
47164
|
+
const privateDir = import_node_fs3.default.mkdtempSync(import_node_path7.default.join(sandboxBaseDir, "mrrlin-sandbox-"));
|
|
47031
47165
|
try {
|
|
47032
|
-
|
|
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
|
-
|
|
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 (
|
|
47560
|
-
|
|
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 (
|
|
47566
|
-
|
|
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 (
|
|
47572
|
-
|
|
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
|
|
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,
|
|
47649
|
-
(0,
|
|
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
|
|
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,
|
|
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 =
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
57594
|
-
(0,
|
|
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,
|
|
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
|
|
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,
|
|
58120
|
+
(0, import_node_fs8.mkdirSync)(stateDir, { recursive: true });
|
|
57987
58121
|
}
|
|
57988
58122
|
read() {
|
|
57989
|
-
if (!(0,
|
|
58123
|
+
if (!(0, import_node_fs8.existsSync)(this.file)) return {};
|
|
57990
58124
|
try {
|
|
57991
|
-
return JSON.parse((0,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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 = (
|
|
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
|
|
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 = (
|
|
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 = (
|
|
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,
|
|
58240
|
-
const stat3 = (0,
|
|
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,
|
|
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 = (
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
58422
|
-
noHooksDir = (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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(
|
|
58604
|
-
if (makefile && /^test\s*:/m.test((0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
59027
|
-
(0,
|
|
59028
|
-
if ((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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
59096
|
-
const real = (0,
|
|
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,
|
|
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,
|
|
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 (
|
|
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 (
|
|
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,
|
|
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 = (
|
|
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,
|
|
59477
|
-
(0,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
59666
|
-
(0,
|
|
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,
|
|
59675
|
-
(0,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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 (!
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
63508
|
+
const readFile10 = opts.readFileSyncImpl ?? ((p, encoding) => (0, import_node_fs18.readFileSync)(p, encoding));
|
|
63375
63509
|
let raw;
|
|
63376
63510
|
try {
|
|
63377
|
-
raw =
|
|
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 ??
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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.
|
|
63963
|
+
var PKG_VERSION = "0.4.151";
|
|
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
|
|
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) =>
|
|
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
|
-
|
|
64829
|
-
|
|
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) =>
|
|
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
|
|
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
|
|
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
|
|
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
|
|
65211
|
-
await
|
|
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
|
|
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,
|
|
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,
|
|
65859
|
-
(0,
|
|
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
|
|
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.",
|
|
@@ -68121,10 +68256,16 @@ async function driveRun(deps, projectSlug, runId) {
|
|
|
68121
68256
|
if (kind === "code_change") localGitMode = isLocalGitRoute(routeResolution.route);
|
|
68122
68257
|
}
|
|
68123
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];
|
|
68124
68266
|
const needsBrowser = claimed.prerequisites?.some((p) => p.mcp === "mrrlin-browser") || task.domains?.includes("browser");
|
|
68125
68267
|
if (needsBrowser) {
|
|
68126
|
-
const
|
|
68127
|
-
const busy = checkBusy();
|
|
68268
|
+
const busy = deps.checkBrowserBusy ? deps.checkBrowserBusy(runProfilePath) : checkBrowserBusy(runProfilePath ? { profilePath: runProfilePath } : {});
|
|
68128
68269
|
if (busy.busy) {
|
|
68129
68270
|
await failRun(
|
|
68130
68271
|
deps,
|
|
@@ -68533,7 +68674,8 @@ ${renderTaskStateSection(taskState)}`;
|
|
|
68533
68674
|
// (acquireExecutorAgent) never reached them and every project tool refused the run with "no
|
|
68534
68675
|
// active workspace bound". The adapter applies this per thread (codexThreadConfig), and a
|
|
68535
68676
|
// resumed thread loaded with another binding is refused and restarted fresh.
|
|
68536
|
-
|
|
68677
|
+
// Dogfood v2 F-21: plus the run's own per-task browser profile (routed to `mrrlin-browser`).
|
|
68678
|
+
env: { ...directorThreadEnv(projectSlug), ...browserEnv }
|
|
68537
68679
|
};
|
|
68538
68680
|
let resumed = true;
|
|
68539
68681
|
let acquireResult;
|
|
@@ -70580,7 +70722,7 @@ async function runAsyncBackstopSweep(deps, drive = (slug, jobId) => driveAsyncJo
|
|
|
70580
70722
|
}
|
|
70581
70723
|
|
|
70582
70724
|
// src/bridge-artifacts.ts
|
|
70583
|
-
var
|
|
70725
|
+
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
70584
70726
|
var import_promises14 = __toESM(require("node:fs/promises"), 1);
|
|
70585
70727
|
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
70586
70728
|
var DEFAULT_MAX_ARTIFACTS_BYTES = 500 * 1024 * 1024;
|
|
@@ -70590,9 +70732,9 @@ function resolveArtifactsDir(baseStateDir) {
|
|
|
70590
70732
|
return import_node_path36.default.join(stateDir, "artifacts");
|
|
70591
70733
|
}
|
|
70592
70734
|
function ensureDir(dir) {
|
|
70593
|
-
|
|
70735
|
+
import_node_fs23.default.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
70594
70736
|
try {
|
|
70595
|
-
|
|
70737
|
+
import_node_fs23.default.chmodSync(dir, 448);
|
|
70596
70738
|
} catch {
|
|
70597
70739
|
}
|
|
70598
70740
|
}
|
|
@@ -70892,7 +71034,7 @@ function agentIdleMs(provider) {
|
|
|
70892
71034
|
}
|
|
70893
71035
|
|
|
70894
71036
|
// src/thread-index.ts
|
|
70895
|
-
var
|
|
71037
|
+
var import_node_fs24 = require("node:fs");
|
|
70896
71038
|
var import_node_path37 = __toESM(require("node:path"), 1);
|
|
70897
71039
|
function threadIndexPath(stateDir) {
|
|
70898
71040
|
return import_node_path37.default.join(stateDir, "threads.json");
|
|
@@ -70901,7 +71043,7 @@ function loadThreadIndex(stateDir, ttlMs, now) {
|
|
|
70901
71043
|
const result = /* @__PURE__ */ new Map();
|
|
70902
71044
|
let parsed;
|
|
70903
71045
|
try {
|
|
70904
|
-
parsed = JSON.parse((0,
|
|
71046
|
+
parsed = JSON.parse((0, import_node_fs24.readFileSync)(threadIndexPath(stateDir), "utf8"));
|
|
70905
71047
|
} catch {
|
|
70906
71048
|
return result;
|
|
70907
71049
|
}
|
|
@@ -70926,8 +71068,8 @@ function loadThreadIndex(stateDir, ttlMs, now) {
|
|
|
70926
71068
|
return result;
|
|
70927
71069
|
}
|
|
70928
71070
|
function saveThreadIndex(stateDir, entries) {
|
|
70929
|
-
(0,
|
|
70930
|
-
(0,
|
|
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)}
|
|
70931
71073
|
`, {
|
|
70932
71074
|
encoding: "utf8",
|
|
70933
71075
|
mode: 384
|
|
@@ -71063,7 +71205,7 @@ function createToolBusyClock(opts) {
|
|
|
71063
71205
|
|
|
71064
71206
|
// src/remote-phone-relay.ts
|
|
71065
71207
|
var import_node_events3 = require("node:events");
|
|
71066
|
-
var
|
|
71208
|
+
var import_node_fs25 = require("node:fs");
|
|
71067
71209
|
var import_node_os18 = require("node:os");
|
|
71068
71210
|
var import_node_path38 = require("node:path");
|
|
71069
71211
|
|
|
@@ -74638,7 +74780,7 @@ var DirectorRelay = class {
|
|
|
74638
74780
|
function loadOrCreateAgentDeviceKey() {
|
|
74639
74781
|
const path34 = (0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin", "agent-device-key");
|
|
74640
74782
|
try {
|
|
74641
|
-
const raw = JSON.parse((0,
|
|
74783
|
+
const raw = JSON.parse((0, import_node_fs25.readFileSync)(path34, "utf8"));
|
|
74642
74784
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
74643
74785
|
return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
|
|
74644
74786
|
}
|
|
@@ -74646,8 +74788,8 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
74646
74788
|
}
|
|
74647
74789
|
const kp = generateIdentityKeyPair();
|
|
74648
74790
|
try {
|
|
74649
|
-
(0,
|
|
74650
|
-
(0,
|
|
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)(
|
|
74651
74793
|
path34,
|
|
74652
74794
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
74653
74795
|
{ mode: 384 }
|
|
@@ -74659,7 +74801,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
74659
74801
|
var AGENT_PAIRING_PATH = (0, import_node_path38.join)((0, import_node_os18.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
74660
74802
|
function loadAgentPairing() {
|
|
74661
74803
|
try {
|
|
74662
|
-
const raw = JSON.parse((0,
|
|
74804
|
+
const raw = JSON.parse((0, import_node_fs25.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
74663
74805
|
if (typeof raw.channelId === "string" && typeof raw.agentControlSecret === "string" && typeof raw.relayAuth === "string" && typeof raw.peerIdentityKey === "string") {
|
|
74664
74806
|
return {
|
|
74665
74807
|
channelId: raw.channelId,
|
|
@@ -74674,8 +74816,8 @@ function loadAgentPairing() {
|
|
|
74674
74816
|
}
|
|
74675
74817
|
function saveAgentPairing(record2) {
|
|
74676
74818
|
try {
|
|
74677
|
-
(0,
|
|
74678
|
-
(0,
|
|
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 });
|
|
74679
74821
|
} catch {
|
|
74680
74822
|
}
|
|
74681
74823
|
}
|
|
@@ -75122,7 +75264,7 @@ var import_node_http2 = __toESM(require("node:http"), 1);
|
|
|
75122
75264
|
var import_node_https2 = __toESM(require("node:https"), 1);
|
|
75123
75265
|
var import_node_net2 = __toESM(require("node:net"), 1);
|
|
75124
75266
|
var import_node_tls = __toESM(require("node:tls"), 1);
|
|
75125
|
-
var
|
|
75267
|
+
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
75126
75268
|
var import_node_os19 = __toESM(require("node:os"), 1);
|
|
75127
75269
|
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
75128
75270
|
var import_node_crypto22 = __toESM(require("node:crypto"), 1);
|
|
@@ -75467,16 +75609,16 @@ async function createVerificationBrokerSession(options) {
|
|
|
75467
75609
|
let createdDir = null;
|
|
75468
75610
|
let socketPath = options.socketPath;
|
|
75469
75611
|
if (!socketPath) {
|
|
75470
|
-
createdDir =
|
|
75471
|
-
|
|
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);
|
|
75472
75614
|
socketPath = import_node_path39.default.join(
|
|
75473
75615
|
createdDir,
|
|
75474
75616
|
`broker-${options.runId.replace(/[^a-zA-Z0-9_-]/g, "")}-${nonce}.sock`
|
|
75475
75617
|
);
|
|
75476
75618
|
}
|
|
75477
75619
|
try {
|
|
75478
|
-
if (
|
|
75479
|
-
|
|
75620
|
+
if (import_node_fs26.default.existsSync(socketPath)) {
|
|
75621
|
+
import_node_fs26.default.unlinkSync(socketPath);
|
|
75480
75622
|
}
|
|
75481
75623
|
} catch {
|
|
75482
75624
|
}
|
|
@@ -75764,12 +75906,12 @@ async function createVerificationBrokerSession(options) {
|
|
|
75764
75906
|
} catch (err) {
|
|
75765
75907
|
server.close();
|
|
75766
75908
|
try {
|
|
75767
|
-
if (
|
|
75909
|
+
if (import_node_fs26.default.existsSync(socketPath)) import_node_fs26.default.unlinkSync(socketPath);
|
|
75768
75910
|
} catch (error51) {
|
|
75769
75911
|
}
|
|
75770
75912
|
if (createdDir) {
|
|
75771
75913
|
try {
|
|
75772
|
-
|
|
75914
|
+
import_node_fs26.default.rmSync(createdDir, { recursive: true, force: true });
|
|
75773
75915
|
} catch (error51) {
|
|
75774
75916
|
}
|
|
75775
75917
|
}
|
|
@@ -75797,14 +75939,14 @@ async function createVerificationBrokerSession(options) {
|
|
|
75797
75939
|
server.close(() => resolve3());
|
|
75798
75940
|
});
|
|
75799
75941
|
try {
|
|
75800
|
-
if (
|
|
75801
|
-
|
|
75942
|
+
if (import_node_fs26.default.existsSync(socketPath)) {
|
|
75943
|
+
import_node_fs26.default.unlinkSync(socketPath);
|
|
75802
75944
|
}
|
|
75803
75945
|
} catch {
|
|
75804
75946
|
}
|
|
75805
75947
|
if (createdDir) {
|
|
75806
75948
|
try {
|
|
75807
|
-
|
|
75949
|
+
import_node_fs26.default.rmSync(createdDir, { recursive: true, force: true });
|
|
75808
75950
|
} catch {
|
|
75809
75951
|
}
|
|
75810
75952
|
}
|
|
@@ -76300,7 +76442,7 @@ function extractVerificationSection(markdown) {
|
|
|
76300
76442
|
}
|
|
76301
76443
|
|
|
76302
76444
|
// src/director-reseed.ts
|
|
76303
|
-
var
|
|
76445
|
+
var import_node_fs27 = require("node:fs");
|
|
76304
76446
|
var import_node_readline2 = require("node:readline");
|
|
76305
76447
|
var import_node_path40 = require("node:path");
|
|
76306
76448
|
function estimateTokens(s) {
|
|
@@ -76453,7 +76595,7 @@ async function readSessionRows(logsDir, files, sessionIds) {
|
|
|
76453
76595
|
for (const f of files) {
|
|
76454
76596
|
const filePath = (0, import_node_path40.join)(logsDir, f);
|
|
76455
76597
|
try {
|
|
76456
|
-
const stream = (0,
|
|
76598
|
+
const stream = (0, import_node_fs27.createReadStream)(filePath, { encoding: "utf8" });
|
|
76457
76599
|
const rl = (0, import_node_readline2.createInterface)({ input: stream, crlfDelay: Infinity });
|
|
76458
76600
|
try {
|
|
76459
76601
|
for await (const line of rl) {
|
|
@@ -76477,7 +76619,7 @@ async function readSessionRows(logsDir, files, sessionIds) {
|
|
|
76477
76619
|
}
|
|
76478
76620
|
|
|
76479
76621
|
// src/external-agents-scrub.ts
|
|
76480
|
-
var
|
|
76622
|
+
var import_node_fs28 = __toESM(require("node:fs"), 1);
|
|
76481
76623
|
var import_node_os20 = __toESM(require("node:os"), 1);
|
|
76482
76624
|
var import_node_path41 = __toESM(require("node:path"), 1);
|
|
76483
76625
|
var REDACTION = "[REDACTED]";
|
|
@@ -76488,7 +76630,7 @@ function readKeysEnv() {
|
|
|
76488
76630
|
const filePath = KEYS_ENV_PATH();
|
|
76489
76631
|
let mtimeMs = 0;
|
|
76490
76632
|
try {
|
|
76491
|
-
mtimeMs =
|
|
76633
|
+
mtimeMs = import_node_fs28.default.statSync(filePath).mtimeMs;
|
|
76492
76634
|
} catch {
|
|
76493
76635
|
mtimeMs = 0;
|
|
76494
76636
|
}
|
|
@@ -76497,7 +76639,7 @@ function readKeysEnv() {
|
|
|
76497
76639
|
}
|
|
76498
76640
|
const map2 = /* @__PURE__ */ new Map();
|
|
76499
76641
|
try {
|
|
76500
|
-
const content =
|
|
76642
|
+
const content = import_node_fs28.default.readFileSync(filePath, "utf8");
|
|
76501
76643
|
for (const rawLine of content.split(/\r?\n/)) {
|
|
76502
76644
|
const line = rawLine.trim();
|
|
76503
76645
|
if (line === "" || line.startsWith("#")) continue;
|
|
@@ -76903,7 +77045,7 @@ function addBridgeModel(target, model) {
|
|
|
76903
77045
|
}
|
|
76904
77046
|
function readTextIfExists(filePath) {
|
|
76905
77047
|
try {
|
|
76906
|
-
return
|
|
77048
|
+
return import_node_fs29.default.readFileSync(filePath, "utf8");
|
|
76907
77049
|
} catch {
|
|
76908
77050
|
return null;
|
|
76909
77051
|
}
|
|
@@ -76982,7 +77124,7 @@ function readCodexFallbackModels() {
|
|
|
76982
77124
|
}
|
|
76983
77125
|
const automationsDir = import_node_path43.default.join(codexHome, "automations");
|
|
76984
77126
|
try {
|
|
76985
|
-
for (const entry of
|
|
77127
|
+
for (const entry of import_node_fs29.default.readdirSync(automationsDir, { withFileTypes: true })) {
|
|
76986
77128
|
if (!entry.isDirectory()) continue;
|
|
76987
77129
|
for (const slug of readKnownGptSlugsFromTomlFile(import_node_path43.default.join(automationsDir, entry.name, "automation.toml"))) {
|
|
76988
77130
|
addBridgeModel(
|
|
@@ -77012,8 +77154,8 @@ function selfUpdateInboxItemId(offeredVersion) {
|
|
|
77012
77154
|
function neutralCheckoutCwd(stateDir) {
|
|
77013
77155
|
const dir = import_node_path43.default.join(stateDir, "no-checkout");
|
|
77014
77156
|
try {
|
|
77015
|
-
|
|
77016
|
-
if (!
|
|
77157
|
+
import_node_fs29.default.mkdirSync(dir, { recursive: true });
|
|
77158
|
+
if (!import_node_fs29.default.existsSync(import_node_path43.default.join(dir, ".git"))) {
|
|
77017
77159
|
try {
|
|
77018
77160
|
(0, import_node_child_process26.spawnSync)("git", ["init", "-b", "main"], { cwd: dir, stdio: "ignore" });
|
|
77019
77161
|
} catch {
|
|
@@ -77205,7 +77347,7 @@ function buildThreadStartParams(msg, config2, desiredModel) {
|
|
|
77205
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.",
|
|
77206
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.',
|
|
77207
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.",
|
|
77208
|
-
"-
|
|
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.",
|
|
77209
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.',
|
|
77210
77352
|
"",
|
|
77211
77353
|
'Research playbook \u2014 when the user asks about a topic, an area, or "what do we have on X":',
|
|
@@ -77580,7 +77722,7 @@ async function runOrphanWorktreeSweep(client, opts) {
|
|
|
77580
77722
|
const cutoff = Date.now() - worktreeRetentionMs();
|
|
77581
77723
|
const isReapable = (worktreePath) => {
|
|
77582
77724
|
try {
|
|
77583
|
-
return
|
|
77725
|
+
return import_node_fs29.default.statSync(worktreePath).mtimeMs < cutoff;
|
|
77584
77726
|
} catch {
|
|
77585
77727
|
return false;
|
|
77586
77728
|
}
|
|
@@ -79565,6 +79707,9 @@ async function startDirectorBridge() {
|
|
|
79565
79707
|
// fail. If the resolved branch does not exist on origin, createRunWorktree surfaces a
|
|
79566
79708
|
// `default_branch_unresolved` error which the consumer routes to a clean operator handoff.
|
|
79567
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),
|
|
79568
79713
|
// ADR 0007 self-review: critique the committed diff on the executor's own agent handle before
|
|
79569
79714
|
// push/PR. Reuses the collected-turn runner (startThread + collect assistant text).
|
|
79570
79715
|
selfReviewTurn: createSelfReviewTurn({
|
|
@@ -79588,7 +79733,7 @@ async function startDirectorBridge() {
|
|
|
79588
79733
|
runVerificationTurn: createRunVerificationTurn({
|
|
79589
79734
|
startSandbox: async (egressDomains, providerId, opts) => {
|
|
79590
79735
|
opts?.wrapCommand?.(["node"]);
|
|
79591
|
-
const scratchDir =
|
|
79736
|
+
const scratchDir = import_node_fs29.default.mkdtempSync(import_node_path43.default.join(import_node_os22.default.tmpdir(), "mrrlin-verify-"));
|
|
79592
79737
|
const executor = await startExecutorServer({
|
|
79593
79738
|
worktree: scratchDir,
|
|
79594
79739
|
disabledGitHooksDir: prepareDisabledGitHooksDir(import_node_path43.default.join(config2.stateDir, "locks"), import_node_path43.default.basename(scratchDir)),
|
|
@@ -79604,7 +79749,7 @@ async function startDirectorBridge() {
|
|
|
79604
79749
|
dispose: () => {
|
|
79605
79750
|
executor.dispose();
|
|
79606
79751
|
try {
|
|
79607
|
-
|
|
79752
|
+
import_node_fs29.default.rmSync(scratchDir, { recursive: true, force: true });
|
|
79608
79753
|
} catch {
|
|
79609
79754
|
}
|
|
79610
79755
|
},
|
|
@@ -79963,7 +80108,7 @@ async function startDirectorBridge() {
|
|
|
79963
80108
|
const bridgeLogger = createBridgeLogger(config2.stateDir, process.env);
|
|
79964
80109
|
let bridgeBinShaShort = "unknown00000";
|
|
79965
80110
|
try {
|
|
79966
|
-
bridgeBinShaShort = import_node_crypto23.default.createHash("sha256").update(
|
|
80111
|
+
bridgeBinShaShort = import_node_crypto23.default.createHash("sha256").update(import_node_fs29.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
|
|
79967
80112
|
} catch {
|
|
79968
80113
|
}
|
|
79969
80114
|
attachBridgeWss(server, {
|
|
@@ -80433,13 +80578,13 @@ function readOrCreateBridgeToken(stateDir) {
|
|
|
80433
80578
|
if (explicit) return explicit;
|
|
80434
80579
|
const tokenPath = import_node_path43.default.join(stateDir, "token.txt");
|
|
80435
80580
|
try {
|
|
80436
|
-
const existing =
|
|
80581
|
+
const existing = import_node_fs29.default.readFileSync(tokenPath, "utf8").trim();
|
|
80437
80582
|
if (existing) return existing;
|
|
80438
80583
|
} catch {
|
|
80439
80584
|
}
|
|
80440
|
-
|
|
80585
|
+
import_node_fs29.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
|
|
80441
80586
|
const token = import_node_crypto23.default.randomBytes(32).toString("base64url");
|
|
80442
|
-
|
|
80587
|
+
import_node_fs29.default.writeFileSync(tokenPath, `${token}
|
|
80443
80588
|
`, { mode: 384 });
|
|
80444
80589
|
return token;
|
|
80445
80590
|
}
|
|
@@ -81348,7 +81493,7 @@ function runSetCredential(args) {
|
|
|
81348
81493
|
|
|
81349
81494
|
// src/install-service.ts
|
|
81350
81495
|
var import_node_os23 = __toESM(require("node:os"), 1);
|
|
81351
|
-
var
|
|
81496
|
+
var import_node_fs30 = require("node:fs");
|
|
81352
81497
|
var import_node_path44 = __toESM(require("node:path"), 1);
|
|
81353
81498
|
function parseEnvLine(line, env) {
|
|
81354
81499
|
const trimmed = line.trim();
|
|
@@ -81785,7 +81930,7 @@ function performConfigBackup(deps, ecoPath, existingText) {
|
|
|
81785
81930
|
var SYSTEM_PATH_DIRS = ["/usr/bin", "/bin", "/usr/sbin", "/sbin"];
|
|
81786
81931
|
function defaultHomeOwnerUid(home) {
|
|
81787
81932
|
try {
|
|
81788
|
-
return (0,
|
|
81933
|
+
return (0, import_node_fs30.statSync)(home).uid;
|
|
81789
81934
|
} catch {
|
|
81790
81935
|
return null;
|
|
81791
81936
|
}
|
|
@@ -82137,7 +82282,7 @@ function augmentProcessPathWithCommonDirs() {
|
|
|
82137
82282
|
];
|
|
82138
82283
|
const existing = (process.env.PATH || "").split(import_node_path48.default.delimiter).filter(Boolean);
|
|
82139
82284
|
const existingSet = new Set(existing);
|
|
82140
|
-
const toAdd = candidates.filter((d) => !existingSet.has(d) && (0,
|
|
82285
|
+
const toAdd = candidates.filter((d) => !existingSet.has(d) && (0, import_node_fs31.existsSync)(d));
|
|
82141
82286
|
if (toAdd.length > 0) {
|
|
82142
82287
|
process.env.PATH = [...existing, ...toAdd].join(import_node_path48.default.delimiter);
|
|
82143
82288
|
}
|
|
@@ -82167,7 +82312,7 @@ function bootHookStatus() {
|
|
|
82167
82312
|
for (const candidate of candidates) {
|
|
82168
82313
|
const printed = (0, import_node_child_process27.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
|
|
82169
82314
|
if (printed.status !== 0) continue;
|
|
82170
|
-
if (!(0,
|
|
82315
|
+
if (!(0, import_node_fs31.existsSync)(candidate.plist)) continue;
|
|
82171
82316
|
const out = printed.stdout ?? "";
|
|
82172
82317
|
const runs = /^\s*runs\s*=\s*(\d+)/m.exec(out);
|
|
82173
82318
|
const exitCode = /^\s*last exit code\s*=\s*(-?\d+)/m.exec(out);
|
|
@@ -82446,7 +82591,7 @@ async function main() {
|
|
|
82446
82591
|
}
|
|
82447
82592
|
try {
|
|
82448
82593
|
const codexHome = process.env.CODEX_HOME ?? import_node_path48.default.join(process.env.HOME ?? (0, import_node_os25.homedir)(), ".codex");
|
|
82449
|
-
(0,
|
|
82594
|
+
(0, import_node_fs31.rmSync)(import_node_path48.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
82450
82595
|
} catch {
|
|
82451
82596
|
}
|
|
82452
82597
|
const claudeResult = await installClaude({ binPath, force, serveEnv });
|
|
@@ -82516,13 +82661,13 @@ async function main() {
|
|
|
82516
82661
|
env: process.env,
|
|
82517
82662
|
cwd: process.cwd(),
|
|
82518
82663
|
writeFile: (p, c) => {
|
|
82519
|
-
(0,
|
|
82520
|
-
(0,
|
|
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 });
|
|
82521
82666
|
},
|
|
82522
|
-
writeExclusiveFile: (p, c) => (0,
|
|
82667
|
+
writeExclusiveFile: (p, c) => (0, import_node_fs31.writeFileSync)(p, c, { flag: "wx", mode: 384 }),
|
|
82523
82668
|
listDir: (p) => {
|
|
82524
82669
|
try {
|
|
82525
|
-
return (0,
|
|
82670
|
+
return (0, import_node_fs31.readdirSync)(p);
|
|
82526
82671
|
} catch {
|
|
82527
82672
|
return null;
|
|
82528
82673
|
}
|
|
@@ -82533,7 +82678,7 @@ async function main() {
|
|
|
82533
82678
|
// value", never a failed install. See readExistingTelemetryDefaultProject.
|
|
82534
82679
|
readFile: (p) => {
|
|
82535
82680
|
try {
|
|
82536
|
-
return (0,
|
|
82681
|
+
return (0, import_node_fs31.readFileSync)(p, "utf8");
|
|
82537
82682
|
} catch {
|
|
82538
82683
|
return null;
|
|
82539
82684
|
}
|
|
@@ -82554,7 +82699,7 @@ async function main() {
|
|
|
82554
82699
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
82555
82700
|
removeFile: (p) => {
|
|
82556
82701
|
try {
|
|
82557
|
-
(0,
|
|
82702
|
+
(0, import_node_fs31.rmSync)(p, { force: true });
|
|
82558
82703
|
} catch {
|
|
82559
82704
|
}
|
|
82560
82705
|
},
|
|
@@ -82575,7 +82720,7 @@ async function main() {
|
|
|
82575
82720
|
runPm2: (a) => ({ code: pm2Runner(a).code }),
|
|
82576
82721
|
removeFile: (p) => {
|
|
82577
82722
|
try {
|
|
82578
|
-
(0,
|
|
82723
|
+
(0, import_node_fs31.rmSync)(p, { force: true });
|
|
82579
82724
|
} catch {
|
|
82580
82725
|
}
|
|
82581
82726
|
},
|
|
@@ -82602,7 +82747,7 @@ async function main() {
|
|
|
82602
82747
|
log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
82603
82748
|
}
|
|
82604
82749
|
try {
|
|
82605
|
-
(0,
|
|
82750
|
+
(0, import_node_fs31.rmSync)(import_node_path48.default.join(home, ".mrrlin"), { recursive: true, force: true });
|
|
82606
82751
|
} catch {
|
|
82607
82752
|
}
|
|
82608
82753
|
log("removed ~/.mrrlin");
|