@mrrlin-dev/mcp 0.4.99 → 0.4.101
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 +311 -81
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -9776,7 +9776,7 @@ var require_cross_spawn = __commonJS({
|
|
|
9776
9776
|
var cp = require("child_process");
|
|
9777
9777
|
var parse8 = require_parse2();
|
|
9778
9778
|
var enoent = require_enoent();
|
|
9779
|
-
function
|
|
9779
|
+
function spawn7(command, args, options) {
|
|
9780
9780
|
const parsed = parse8(command, args, options);
|
|
9781
9781
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
9782
9782
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -9788,8 +9788,8 @@ var require_cross_spawn = __commonJS({
|
|
|
9788
9788
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
9789
9789
|
return result;
|
|
9790
9790
|
}
|
|
9791
|
-
module2.exports =
|
|
9792
|
-
module2.exports.spawn =
|
|
9791
|
+
module2.exports = spawn7;
|
|
9792
|
+
module2.exports.spawn = spawn7;
|
|
9793
9793
|
module2.exports.sync = spawnSync7;
|
|
9794
9794
|
module2.exports._parse = parse8;
|
|
9795
9795
|
module2.exports._enoent = enoent;
|
|
@@ -21593,7 +21593,7 @@ args = ${JSON.stringify(expected.args)}
|
|
|
21593
21593
|
return tomlStr;
|
|
21594
21594
|
}
|
|
21595
21595
|
async function installPublicMcpServerToConfigs(serverId, expected) {
|
|
21596
|
-
const homeDir =
|
|
21596
|
+
const homeDir = import_node_os17.default.homedir();
|
|
21597
21597
|
const claudePath = import_node_path37.default.join(homeDir, ".claude.json");
|
|
21598
21598
|
if (await pathExists5(claudePath)) {
|
|
21599
21599
|
try {
|
|
@@ -21644,12 +21644,12 @@ async function installPublicMcpServerToConfigs(serverId, expected) {
|
|
|
21644
21644
|
await writeAtomic(agyPath, JSON.stringify({ mcpServers: { [serverId]: expected } }, null, 2) + "\n");
|
|
21645
21645
|
}
|
|
21646
21646
|
}
|
|
21647
|
-
var import_promises15,
|
|
21647
|
+
var import_promises15, import_node_os17, import_node_path37, toml4;
|
|
21648
21648
|
var init_install_public_mcp = __esm({
|
|
21649
21649
|
"src/install-public-mcp.ts"() {
|
|
21650
21650
|
"use strict";
|
|
21651
21651
|
import_promises15 = __toESM(require("node:fs/promises"), 1);
|
|
21652
|
-
|
|
21652
|
+
import_node_os17 = __toESM(require("node:os"), 1);
|
|
21653
21653
|
import_node_path37 = __toESM(require("node:path"), 1);
|
|
21654
21654
|
toml4 = __toESM(require_toml(), 1);
|
|
21655
21655
|
}
|
|
@@ -21662,9 +21662,9 @@ __export(bin_exports, {
|
|
|
21662
21662
|
});
|
|
21663
21663
|
module.exports = __toCommonJS(bin_exports);
|
|
21664
21664
|
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
21665
|
-
var
|
|
21665
|
+
var import_node_child_process23 = require("node:child_process");
|
|
21666
21666
|
var import_node_fs25 = require("node:fs");
|
|
21667
|
-
var
|
|
21667
|
+
var import_node_os21 = require("node:os");
|
|
21668
21668
|
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
21669
21669
|
|
|
21670
21670
|
// src/install-codex.ts
|
|
@@ -44765,7 +44765,7 @@ function firstString(...values) {
|
|
|
44765
44765
|
return null;
|
|
44766
44766
|
}
|
|
44767
44767
|
function runCodexExec(input, deps) {
|
|
44768
|
-
const
|
|
44768
|
+
const spawn7 = deps?.spawn ?? import_node_child_process6.spawn;
|
|
44769
44769
|
const executable = input.codexExecutable ?? "codex";
|
|
44770
44770
|
const sandbox = input.sandbox ?? "read-only";
|
|
44771
44771
|
const fullPrompt = input.developerInstructions.trim() ? `${input.developerInstructions.trim()}
|
|
@@ -44811,7 +44811,7 @@ ${input.prompt}` : input.prompt;
|
|
|
44811
44811
|
}
|
|
44812
44812
|
let child;
|
|
44813
44813
|
try {
|
|
44814
|
-
child =
|
|
44814
|
+
child = spawn7(spawnCmd, spawnArgs, options);
|
|
44815
44815
|
} catch (err) {
|
|
44816
44816
|
finish({ ok: false, error: `Failed to spawn codex exec: ${errMessage(err)}` });
|
|
44817
44817
|
return;
|
|
@@ -44854,7 +44854,7 @@ function errMessage(err) {
|
|
|
44854
44854
|
// ../../packages/agent-client/dist/providers/claude/exec.js
|
|
44855
44855
|
var import_node_child_process7 = require("node:child_process");
|
|
44856
44856
|
function runClaudeExec(input, deps) {
|
|
44857
|
-
const
|
|
44857
|
+
const spawn7 = deps?.spawn ?? import_node_child_process7.spawn;
|
|
44858
44858
|
const executable = input.codexExecutable ?? "claude";
|
|
44859
44859
|
const args = ["--print", "--output-format", "json", "--strict-mcp-config"];
|
|
44860
44860
|
if (input.mcpConfig) {
|
|
@@ -44898,7 +44898,7 @@ function runClaudeExec(input, deps) {
|
|
|
44898
44898
|
}
|
|
44899
44899
|
let child;
|
|
44900
44900
|
try {
|
|
44901
|
-
child =
|
|
44901
|
+
child = spawn7(spawnCmd, spawnArgs, options);
|
|
44902
44902
|
} catch (err) {
|
|
44903
44903
|
finish({ ok: false, error: `Failed to spawn ${executable} exec: ${errMessage2(err)}` });
|
|
44904
44904
|
return;
|
|
@@ -44966,7 +44966,7 @@ function errMessage2(err) {
|
|
|
44966
44966
|
// ../../packages/agent-client/dist/providers/agy/exec.js
|
|
44967
44967
|
var import_node_child_process8 = require("node:child_process");
|
|
44968
44968
|
function runAgyExec(input, deps) {
|
|
44969
|
-
const
|
|
44969
|
+
const spawn7 = deps?.spawn ?? import_node_child_process8.spawn;
|
|
44970
44970
|
const executable = input.codexExecutable ?? "agy";
|
|
44971
44971
|
const args = ["--output-format", "json"];
|
|
44972
44972
|
if (input.sandbox === "read-only") {
|
|
@@ -45019,7 +45019,7 @@ function runAgyExec(input, deps) {
|
|
|
45019
45019
|
}
|
|
45020
45020
|
let child;
|
|
45021
45021
|
try {
|
|
45022
|
-
child =
|
|
45022
|
+
child = spawn7(spawnCmd, spawnArgs, options);
|
|
45023
45023
|
} catch (err) {
|
|
45024
45024
|
finish({ ok: false, error: `Failed to spawn ${executable} exec: ${err instanceof Error ? err.message : String(err)}` });
|
|
45025
45025
|
return;
|
|
@@ -46267,7 +46267,7 @@ var DEFAULT_STATUS_TIMEOUT_MS = 1e4;
|
|
|
46267
46267
|
function errMessage3(err) {
|
|
46268
46268
|
return err instanceof Error ? err.message : String(err);
|
|
46269
46269
|
}
|
|
46270
|
-
function runExternalAgentsStatus(bin, args, timeoutMs,
|
|
46270
|
+
function runExternalAgentsStatus(bin, args, timeoutMs, spawn7) {
|
|
46271
46271
|
return new Promise((resolve2) => {
|
|
46272
46272
|
let settled = false;
|
|
46273
46273
|
const timerRef = { id: void 0 };
|
|
@@ -46280,7 +46280,7 @@ function runExternalAgentsStatus(bin, args, timeoutMs, spawn6) {
|
|
|
46280
46280
|
const options = { stdio: ["ignore", "pipe", "pipe"], env: process.env, shell: false };
|
|
46281
46281
|
let child;
|
|
46282
46282
|
try {
|
|
46283
|
-
child =
|
|
46283
|
+
child = spawn7(bin, args, options);
|
|
46284
46284
|
} catch (err) {
|
|
46285
46285
|
finish({ stdout: "", error: `spawn ${bin} failed: ${errMessage3(err)}` });
|
|
46286
46286
|
return;
|
|
@@ -46304,13 +46304,13 @@ function runExternalAgentsStatus(bin, args, timeoutMs, spawn6) {
|
|
|
46304
46304
|
});
|
|
46305
46305
|
}
|
|
46306
46306
|
async function fetchRegistrySnapshot(deps) {
|
|
46307
|
-
const
|
|
46307
|
+
const spawn7 = deps?.spawn ?? import_node_child_process10.spawn;
|
|
46308
46308
|
const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
|
|
46309
46309
|
const { stdout, error: error51 } = await runExternalAgentsStatus(
|
|
46310
46310
|
command,
|
|
46311
46311
|
[...prefixArgs, "status", "--json"],
|
|
46312
46312
|
deps?.statusTimeoutMs ?? DEFAULT_STATUS_TIMEOUT_MS,
|
|
46313
|
-
|
|
46313
|
+
spawn7
|
|
46314
46314
|
);
|
|
46315
46315
|
if (error51) return { ok: false, error: error51 };
|
|
46316
46316
|
try {
|
|
@@ -46354,7 +46354,7 @@ function estimateTokenCount(text) {
|
|
|
46354
46354
|
function errMessage4(err) {
|
|
46355
46355
|
return err instanceof Error ? err.message : String(err);
|
|
46356
46356
|
}
|
|
46357
|
-
function runExternalAgents(bin, args, label, timeoutMs,
|
|
46357
|
+
function runExternalAgents(bin, args, label, timeoutMs, spawn7) {
|
|
46358
46358
|
return new Promise((resolve2) => {
|
|
46359
46359
|
let settled = false;
|
|
46360
46360
|
const timerRef = { id: void 0 };
|
|
@@ -46372,7 +46372,7 @@ function runExternalAgents(bin, args, label, timeoutMs, spawn6) {
|
|
|
46372
46372
|
};
|
|
46373
46373
|
let child;
|
|
46374
46374
|
try {
|
|
46375
|
-
child =
|
|
46375
|
+
child = spawn7(bin, args, options);
|
|
46376
46376
|
} catch (err) {
|
|
46377
46377
|
finish({ code: null, stdout: "", error: `spawn ${bin} failed: ${errMessage4(err)}` });
|
|
46378
46378
|
return;
|
|
@@ -46392,7 +46392,7 @@ function runExternalAgents(bin, args, label, timeoutMs, spawn6) {
|
|
|
46392
46392
|
});
|
|
46393
46393
|
}
|
|
46394
46394
|
async function pickPanel(input, deps) {
|
|
46395
|
-
const
|
|
46395
|
+
const spawn7 = deps?.spawn ?? import_node_child_process11.spawn;
|
|
46396
46396
|
const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
|
|
46397
46397
|
const args = [
|
|
46398
46398
|
"pick",
|
|
@@ -46405,7 +46405,7 @@ async function pickPanel(input, deps) {
|
|
|
46405
46405
|
"--exclude-providers",
|
|
46406
46406
|
input.excludeProvider
|
|
46407
46407
|
];
|
|
46408
|
-
const r = await runExternalAgents(command, [...prefixArgs, ...args], "pick", input.timeoutMs,
|
|
46408
|
+
const r = await runExternalAgents(command, [...prefixArgs, ...args], "pick", input.timeoutMs, spawn7);
|
|
46409
46409
|
if (r.error) return { ok: false, error: r.error };
|
|
46410
46410
|
if (r.code === 3) return { ok: true, agents: [] };
|
|
46411
46411
|
if (r.code !== 0) return { ok: false, error: `external-agents pick exited ${r.code}` };
|
|
@@ -46439,10 +46439,10 @@ function parseDispatch(agentId, stdout, exitCode) {
|
|
|
46439
46439
|
return { ok: true, text: parsed.text, usage };
|
|
46440
46440
|
}
|
|
46441
46441
|
async function dispatchHead(agentId, prompt, timeoutMs, deps) {
|
|
46442
|
-
const
|
|
46442
|
+
const spawn7 = deps?.spawn ?? import_node_child_process11.spawn;
|
|
46443
46443
|
const { command, prefixArgs } = resolveExternalAgentsCliInvocation(deps?.externalAgentsBin);
|
|
46444
46444
|
const args = ["dispatch", agentId, "--json", prompt];
|
|
46445
|
-
const r = await runExternalAgents(command, [...prefixArgs, ...args], "dispatch", timeoutMs,
|
|
46445
|
+
const r = await runExternalAgents(command, [...prefixArgs, ...args], "dispatch", timeoutMs, spawn7);
|
|
46446
46446
|
if (r.error) return { ok: false, error: r.error };
|
|
46447
46447
|
return parseDispatch(agentId, r.stdout, r.code);
|
|
46448
46448
|
}
|
|
@@ -57769,12 +57769,242 @@ async function verifyProviderReadiness(provider, run3, opts = {}) {
|
|
|
57769
57769
|
return { ready, checks, details };
|
|
57770
57770
|
}
|
|
57771
57771
|
|
|
57772
|
+
// src/browser-interceptor.ts
|
|
57773
|
+
var import_node_os12 = __toESM(require("node:os"), 1);
|
|
57774
|
+
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
57775
|
+
var import_node_child_process14 = require("node:child_process");
|
|
57776
|
+
var INTERNAL_HOST_PATTERNS = [
|
|
57777
|
+
/^(?:.*\.)?mrrlin\.(?:com|internal|local)$/i,
|
|
57778
|
+
/^(?:localhost|127\.0\.0\.1)(?::\d+)?$/i
|
|
57779
|
+
];
|
|
57780
|
+
var INTERNAL_ROUTE_PREFIXES = [
|
|
57781
|
+
"/wiki",
|
|
57782
|
+
"/deliverables",
|
|
57783
|
+
"/specs",
|
|
57784
|
+
"/items",
|
|
57785
|
+
"/memory",
|
|
57786
|
+
"/tasks",
|
|
57787
|
+
"/autopilot",
|
|
57788
|
+
"/settings"
|
|
57789
|
+
];
|
|
57790
|
+
function isInternalMrrlinUrl(urlString) {
|
|
57791
|
+
if (!urlString || typeof urlString !== "string") {
|
|
57792
|
+
return { isInternal: false };
|
|
57793
|
+
}
|
|
57794
|
+
const trimmed = urlString.trim();
|
|
57795
|
+
try {
|
|
57796
|
+
const isRelative = trimmed.startsWith("/");
|
|
57797
|
+
const parsed = isRelative ? new URL(trimmed, "http://localhost") : new URL(trimmed);
|
|
57798
|
+
const isInternalHost = isRelative || INTERNAL_HOST_PATTERNS.some((p) => p.test(parsed.hostname));
|
|
57799
|
+
if (!isInternalHost) {
|
|
57800
|
+
return { isInternal: false };
|
|
57801
|
+
}
|
|
57802
|
+
const pathname = (parsed.pathname ?? "").toLowerCase();
|
|
57803
|
+
const matchedPrefix = INTERNAL_ROUTE_PREFIXES.find(
|
|
57804
|
+
(prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`)
|
|
57805
|
+
);
|
|
57806
|
+
if (matchedPrefix) {
|
|
57807
|
+
let suggestedTool = "get_wiki_page / search_wiki_pages";
|
|
57808
|
+
if (matchedPrefix === "/items" || matchedPrefix === "/deliverables" || matchedPrefix === "/tasks") {
|
|
57809
|
+
suggestedTool = "get_task / list_tasks";
|
|
57810
|
+
} else if (matchedPrefix === "/autopilot") {
|
|
57811
|
+
suggestedTool = "list_inbox_items (filtering kind='handoff') / list_tasks";
|
|
57812
|
+
}
|
|
57813
|
+
return {
|
|
57814
|
+
isInternal: true,
|
|
57815
|
+
reason: `Route '${matchedPrefix}' belongs to internal Mrrlin domain/state.`,
|
|
57816
|
+
suggestedTool
|
|
57817
|
+
};
|
|
57818
|
+
}
|
|
57819
|
+
} catch {
|
|
57820
|
+
}
|
|
57821
|
+
return { isInternal: false };
|
|
57822
|
+
}
|
|
57823
|
+
function formatInternalRouteRejectionMessage(url2, suggestedTool) {
|
|
57824
|
+
return `[Preflight Guard] Refused to navigate browser to internal route "${url2}". Internal entities must be accessed via fast typed MCP tools directly against the database/API. Suggested tool: ${suggestedTool}. Do NOT open Chromium for internal data retrieval. If browser rendering is strictly required for visual UI testing, pass force_internal: true.`;
|
|
57825
|
+
}
|
|
57826
|
+
function processClientJsonRpcLine(rawLine) {
|
|
57827
|
+
const trimmed = rawLine.trim();
|
|
57828
|
+
if (!trimmed) return { type: "forward", payload: rawLine };
|
|
57829
|
+
try {
|
|
57830
|
+
const msg = JSON.parse(trimmed);
|
|
57831
|
+
if (msg && msg.jsonrpc === "2.0" && msg.method === "tools/call" && msg.params?.name === "browser_navigate") {
|
|
57832
|
+
const args = msg.params.arguments;
|
|
57833
|
+
const url2 = typeof args?.url === "string" ? args.url : "";
|
|
57834
|
+
const forceInternal = args?.force_internal === true;
|
|
57835
|
+
const hadForceInternal = args && typeof args === "object" && "force_internal" in args;
|
|
57836
|
+
if (hadForceInternal) {
|
|
57837
|
+
delete args.force_internal;
|
|
57838
|
+
}
|
|
57839
|
+
if (forceInternal) {
|
|
57840
|
+
return { type: "forward", payload: JSON.stringify(msg) };
|
|
57841
|
+
}
|
|
57842
|
+
if (url2) {
|
|
57843
|
+
const check2 = isInternalMrrlinUrl(url2);
|
|
57844
|
+
if (check2.isInternal) {
|
|
57845
|
+
const rejectionText = formatInternalRouteRejectionMessage(
|
|
57846
|
+
url2,
|
|
57847
|
+
check2.suggestedTool ?? "get_wiki_page / get_task"
|
|
57848
|
+
);
|
|
57849
|
+
return {
|
|
57850
|
+
type: "respond",
|
|
57851
|
+
payload: JSON.stringify({
|
|
57852
|
+
jsonrpc: "2.0",
|
|
57853
|
+
id: msg.id,
|
|
57854
|
+
result: {
|
|
57855
|
+
isError: true,
|
|
57856
|
+
content: [
|
|
57857
|
+
{
|
|
57858
|
+
type: "text",
|
|
57859
|
+
text: rejectionText
|
|
57860
|
+
}
|
|
57861
|
+
]
|
|
57862
|
+
}
|
|
57863
|
+
})
|
|
57864
|
+
};
|
|
57865
|
+
}
|
|
57866
|
+
}
|
|
57867
|
+
if (hadForceInternal) {
|
|
57868
|
+
return { type: "forward", payload: JSON.stringify(msg) };
|
|
57869
|
+
}
|
|
57870
|
+
}
|
|
57871
|
+
} catch {
|
|
57872
|
+
}
|
|
57873
|
+
return { type: "forward", payload: rawLine };
|
|
57874
|
+
}
|
|
57875
|
+
function processChildJsonRpcLine(rawLine) {
|
|
57876
|
+
const trimmed = rawLine.trim();
|
|
57877
|
+
if (!trimmed) return rawLine;
|
|
57878
|
+
try {
|
|
57879
|
+
const msg = JSON.parse(trimmed);
|
|
57880
|
+
if (msg && msg.result && Array.isArray(msg.result.tools)) {
|
|
57881
|
+
const navTool = msg.result.tools.find((t) => t.name === "browser_navigate");
|
|
57882
|
+
if (navTool && navTool.inputSchema) {
|
|
57883
|
+
if (!navTool.inputSchema.properties) {
|
|
57884
|
+
navTool.inputSchema.properties = {};
|
|
57885
|
+
}
|
|
57886
|
+
navTool.inputSchema.properties.force_internal = {
|
|
57887
|
+
type: "boolean",
|
|
57888
|
+
description: "Bypass the preflight guard for internal Mrrlin routes when visual browser rendering is strictly required."
|
|
57889
|
+
};
|
|
57890
|
+
return JSON.stringify(msg);
|
|
57891
|
+
}
|
|
57892
|
+
}
|
|
57893
|
+
} catch {
|
|
57894
|
+
}
|
|
57895
|
+
return rawLine;
|
|
57896
|
+
}
|
|
57897
|
+
function wireBrowserServeProxy(streams) {
|
|
57898
|
+
const { input, output: output3, childIn, childOut } = streams;
|
|
57899
|
+
childIn.on("error", () => {
|
|
57900
|
+
});
|
|
57901
|
+
const rl = import_node_readline.default.createInterface({
|
|
57902
|
+
input,
|
|
57903
|
+
crlfDelay: Infinity,
|
|
57904
|
+
terminal: false
|
|
57905
|
+
});
|
|
57906
|
+
const childRl = import_node_readline.default.createInterface({
|
|
57907
|
+
input: childOut,
|
|
57908
|
+
crlfDelay: Infinity,
|
|
57909
|
+
terminal: false
|
|
57910
|
+
});
|
|
57911
|
+
rl.on("line", (line) => {
|
|
57912
|
+
const action = processClientJsonRpcLine(line);
|
|
57913
|
+
if (action.type === "respond") {
|
|
57914
|
+
output3.write(action.payload + "\n");
|
|
57915
|
+
} else {
|
|
57916
|
+
try {
|
|
57917
|
+
childIn.write(action.payload + "\n");
|
|
57918
|
+
} catch {
|
|
57919
|
+
}
|
|
57920
|
+
}
|
|
57921
|
+
});
|
|
57922
|
+
childRl.on("line", (line) => {
|
|
57923
|
+
const augmented = processChildJsonRpcLine(line);
|
|
57924
|
+
try {
|
|
57925
|
+
output3.write(augmented + "\n");
|
|
57926
|
+
} catch {
|
|
57927
|
+
}
|
|
57928
|
+
});
|
|
57929
|
+
const close = () => {
|
|
57930
|
+
rl.close();
|
|
57931
|
+
childRl.close();
|
|
57932
|
+
try {
|
|
57933
|
+
childIn.end();
|
|
57934
|
+
} catch {
|
|
57935
|
+
}
|
|
57936
|
+
};
|
|
57937
|
+
rl.on("close", () => {
|
|
57938
|
+
try {
|
|
57939
|
+
childIn.end();
|
|
57940
|
+
} catch {
|
|
57941
|
+
}
|
|
57942
|
+
});
|
|
57943
|
+
return { close };
|
|
57944
|
+
}
|
|
57945
|
+
function signalToExitCode(signal) {
|
|
57946
|
+
if (!signal) return 1;
|
|
57947
|
+
const sigNum = import_node_os12.default.constants.signals[signal];
|
|
57948
|
+
if (typeof sigNum === "number") {
|
|
57949
|
+
return 128 + sigNum;
|
|
57950
|
+
}
|
|
57951
|
+
return 128 + 15;
|
|
57952
|
+
}
|
|
57953
|
+
async function runBrowserServeProxy(opts) {
|
|
57954
|
+
const input = opts.input ?? process.stdin;
|
|
57955
|
+
const output3 = opts.output ?? process.stdout;
|
|
57956
|
+
const child = (0, import_node_child_process14.spawn)(opts.command, opts.args, {
|
|
57957
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
57958
|
+
env: { ...process.env, ...opts.env }
|
|
57959
|
+
});
|
|
57960
|
+
if (!child.stdin || !child.stdout) {
|
|
57961
|
+
throw new Error("Failed to open stdio pipes to @playwright/mcp child process");
|
|
57962
|
+
}
|
|
57963
|
+
const proxy = wireBrowserServeProxy({
|
|
57964
|
+
input,
|
|
57965
|
+
output: output3,
|
|
57966
|
+
childIn: child.stdin,
|
|
57967
|
+
childOut: child.stdout
|
|
57968
|
+
});
|
|
57969
|
+
const sigintHandler = () => {
|
|
57970
|
+
try {
|
|
57971
|
+
child.kill("SIGINT");
|
|
57972
|
+
} catch {
|
|
57973
|
+
}
|
|
57974
|
+
};
|
|
57975
|
+
const sigtermHandler = () => {
|
|
57976
|
+
try {
|
|
57977
|
+
child.kill("SIGTERM");
|
|
57978
|
+
} catch {
|
|
57979
|
+
}
|
|
57980
|
+
};
|
|
57981
|
+
process.on("SIGINT", sigintHandler);
|
|
57982
|
+
process.on("SIGTERM", sigtermHandler);
|
|
57983
|
+
return new Promise((resolve2) => {
|
|
57984
|
+
child.on("close", (code, signal) => {
|
|
57985
|
+
process.off("SIGINT", sigintHandler);
|
|
57986
|
+
process.off("SIGTERM", sigtermHandler);
|
|
57987
|
+
proxy.close();
|
|
57988
|
+
const exitCode = code !== null ? code : signalToExitCode(signal);
|
|
57989
|
+
resolve2(exitCode);
|
|
57990
|
+
});
|
|
57991
|
+
child.on("error", (err) => {
|
|
57992
|
+
process.off("SIGINT", sigintHandler);
|
|
57993
|
+
process.off("SIGTERM", sigtermHandler);
|
|
57994
|
+
proxy.close();
|
|
57995
|
+
process.stderr.write(`[browser-serve proxy error]: ${err.message}
|
|
57996
|
+
`);
|
|
57997
|
+
resolve2(1);
|
|
57998
|
+
});
|
|
57999
|
+
});
|
|
58000
|
+
}
|
|
58001
|
+
|
|
57772
58002
|
// src/director-bridge.ts
|
|
57773
58003
|
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
57774
58004
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
57775
|
-
var
|
|
58005
|
+
var import_node_os18 = __toESM(require("node:os"), 1);
|
|
57776
58006
|
var import_node_path38 = __toESM(require("node:path"), 1);
|
|
57777
|
-
var
|
|
58007
|
+
var import_node_child_process22 = require("node:child_process");
|
|
57778
58008
|
var import_node_crypto16 = __toESM(require("node:crypto"), 1);
|
|
57779
58009
|
|
|
57780
58010
|
// src/turn-replay-buffer.ts
|
|
@@ -58319,16 +58549,16 @@ function createTurnLock() {
|
|
|
58319
58549
|
}
|
|
58320
58550
|
|
|
58321
58551
|
// src/self-update.ts
|
|
58322
|
-
var
|
|
58552
|
+
var import_node_child_process16 = require("node:child_process");
|
|
58323
58553
|
var import_node_crypto10 = require("node:crypto");
|
|
58324
58554
|
var import_node_fs12 = require("node:fs");
|
|
58325
58555
|
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
58326
58556
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
58327
58557
|
|
|
58328
58558
|
// src/codex-auth-preflight.ts
|
|
58329
|
-
var
|
|
58559
|
+
var import_node_child_process15 = require("node:child_process");
|
|
58330
58560
|
var import_node_fs11 = require("node:fs");
|
|
58331
|
-
var
|
|
58561
|
+
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
58332
58562
|
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
58333
58563
|
var DEFAULT_CODEX_AUTH_MIN_TTL_SECONDS = 15 * 60;
|
|
58334
58564
|
var DEFAULT_CODEX_AUTH_SMOKE_TIMEOUT_MS = 2e4;
|
|
@@ -58348,7 +58578,7 @@ function codexAuthSmokeTimeoutMs(env = process.env) {
|
|
|
58348
58578
|
function resolveCodexAuthPath(opts = {}) {
|
|
58349
58579
|
const env = opts.env ?? process.env;
|
|
58350
58580
|
const codexHome = env.CODEX_HOME?.trim();
|
|
58351
|
-
return import_node_path20.default.join(codexHome || import_node_path20.default.join(opts.homeDir ??
|
|
58581
|
+
return import_node_path20.default.join(codexHome || import_node_path20.default.join(opts.homeDir ?? import_node_os13.default.homedir(), ".codex"), "auth.json");
|
|
58352
58582
|
}
|
|
58353
58583
|
function decodeJwtExpMs(token) {
|
|
58354
58584
|
const parts = token.split(".");
|
|
@@ -58406,7 +58636,7 @@ function runCodexAuthRefreshSmokeForBridgeUpdate(opts = {}) {
|
|
|
58406
58636
|
const configuredExecutable = opts.codexExecutable ?? env.MRRLIN_DIRECTOR_BRIDGE_CODEX_BIN?.trim();
|
|
58407
58637
|
const executable = configuredExecutable || "codex";
|
|
58408
58638
|
const timeoutMs = opts.timeoutMs ?? codexAuthSmokeTimeoutMs(env);
|
|
58409
|
-
const cwd = opts.cwd ??
|
|
58639
|
+
const cwd = opts.cwd ?? import_node_os13.default.tmpdir();
|
|
58410
58640
|
const args = [
|
|
58411
58641
|
"exec",
|
|
58412
58642
|
"--sandbox",
|
|
@@ -58417,7 +58647,7 @@ function runCodexAuthRefreshSmokeForBridgeUpdate(opts = {}) {
|
|
|
58417
58647
|
CODEX_AUTH_SMOKE_PROMPT
|
|
58418
58648
|
];
|
|
58419
58649
|
const command = commandForSmoke(executable, model);
|
|
58420
|
-
const execFileSync5 = opts.execFileSyncImpl ??
|
|
58650
|
+
const execFileSync5 = opts.execFileSyncImpl ?? import_node_child_process15.execFileSync;
|
|
58421
58651
|
try {
|
|
58422
58652
|
execFileSync5(executable, args, {
|
|
58423
58653
|
cwd,
|
|
@@ -58573,7 +58803,7 @@ function resolveBinPath(opts) {
|
|
|
58573
58803
|
}
|
|
58574
58804
|
const whichSync = opts.whichSync ?? ((name) => {
|
|
58575
58805
|
try {
|
|
58576
|
-
return (0,
|
|
58806
|
+
return (0, import_node_child_process16.execFileSync)("which", [name], { encoding: "utf8", timeout: 3e3 }).trim() || null;
|
|
58577
58807
|
} catch {
|
|
58578
58808
|
return null;
|
|
58579
58809
|
}
|
|
@@ -58904,7 +59134,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
58904
59134
|
}
|
|
58905
59135
|
|
|
58906
59136
|
// src/_generated/version.ts
|
|
58907
|
-
var PKG_VERSION = "0.4.
|
|
59137
|
+
var PKG_VERSION = "0.4.101";
|
|
58908
59138
|
|
|
58909
59139
|
// src/director-closure.ts
|
|
58910
59140
|
var CLOSURE_SNAPSHOT_TIMEOUT_MS = 2e3;
|
|
@@ -59618,7 +59848,7 @@ function parseLedger(value) {
|
|
|
59618
59848
|
|
|
59619
59849
|
// src/api-base-url-migrate.ts
|
|
59620
59850
|
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
59621
|
-
var
|
|
59851
|
+
var import_node_os14 = __toESM(require("node:os"), 1);
|
|
59622
59852
|
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
59623
59853
|
|
|
59624
59854
|
// src/service-paths.ts
|
|
@@ -59696,7 +59926,7 @@ ${envLines}
|
|
|
59696
59926
|
|
|
59697
59927
|
// src/api-base-url-migrate.ts
|
|
59698
59928
|
function defaultDeps(deps) {
|
|
59699
|
-
const home = deps.home ?? process.env.HOME ??
|
|
59929
|
+
const home = deps.home ?? process.env.HOME ?? import_node_os14.default.homedir();
|
|
59700
59930
|
return {
|
|
59701
59931
|
home,
|
|
59702
59932
|
codexHome: deps.codexHome ?? process.env.CODEX_HOME?.trim() ?? import_node_path23.default.join(home, ".codex"),
|
|
@@ -61031,7 +61261,7 @@ async function collectAgentPoolSnapshot(deps) {
|
|
|
61031
61261
|
}
|
|
61032
61262
|
|
|
61033
61263
|
// src/external-agents-spawn.ts
|
|
61034
|
-
var
|
|
61264
|
+
var import_node_child_process17 = require("node:child_process");
|
|
61035
61265
|
function runExternalAgentsCli(args, opts) {
|
|
61036
61266
|
let command;
|
|
61037
61267
|
let prefixArgs;
|
|
@@ -61062,7 +61292,7 @@ function runExternalAgentsCli(args, opts) {
|
|
|
61062
61292
|
};
|
|
61063
61293
|
let spawned;
|
|
61064
61294
|
try {
|
|
61065
|
-
spawned = (0,
|
|
61295
|
+
spawned = (0, import_node_child_process17.spawn)(command, [...prefixArgs, ...args], { stdio: stdioConfig });
|
|
61066
61296
|
} catch {
|
|
61067
61297
|
done(1);
|
|
61068
61298
|
return;
|
|
@@ -61174,14 +61404,14 @@ function startAgentPoolLoop(deps) {
|
|
|
61174
61404
|
}
|
|
61175
61405
|
|
|
61176
61406
|
// src/provider-readiness-loop.ts
|
|
61177
|
-
var
|
|
61407
|
+
var import_node_child_process18 = require("node:child_process");
|
|
61178
61408
|
var DEFAULT_INTERVAL_MS3 = 6e4;
|
|
61179
61409
|
function providerReadinessLoopDisabled(env = process.env) {
|
|
61180
61410
|
return env["MRRLIN_BRIDGE_PROVIDER_READINESS_DISABLE"] === "1";
|
|
61181
61411
|
}
|
|
61182
61412
|
function defaultRunnerFor(command) {
|
|
61183
61413
|
return (args) => {
|
|
61184
|
-
const r = (0,
|
|
61414
|
+
const r = (0, import_node_child_process18.spawnSync)(command, args, { encoding: "utf8", timeout: 8e3 });
|
|
61185
61415
|
return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
61186
61416
|
};
|
|
61187
61417
|
}
|
|
@@ -61224,7 +61454,7 @@ function startProviderReadinessLoop(deps) {
|
|
|
61224
61454
|
}
|
|
61225
61455
|
|
|
61226
61456
|
// src/execution-consumer.ts
|
|
61227
|
-
var
|
|
61457
|
+
var import_node_child_process20 = require("node:child_process");
|
|
61228
61458
|
var import_node_crypto14 = __toESM(require("node:crypto"), 1);
|
|
61229
61459
|
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
61230
61460
|
var import_node_util2 = require("node:util");
|
|
@@ -62080,7 +62310,7 @@ async function awaitTurnWithDeadline(opts) {
|
|
|
62080
62310
|
}
|
|
62081
62311
|
|
|
62082
62312
|
// src/worktree.ts
|
|
62083
|
-
var
|
|
62313
|
+
var import_node_child_process19 = require("node:child_process");
|
|
62084
62314
|
var import_node_crypto13 = require("node:crypto");
|
|
62085
62315
|
var import_node_fs17 = require("node:fs");
|
|
62086
62316
|
var import_node_path30 = require("node:path");
|
|
@@ -62108,7 +62338,7 @@ async function withCheckoutLock(locksDir, slug, fn) {
|
|
|
62108
62338
|
function worktreeBranch(runId) {
|
|
62109
62339
|
return `mrrlin/run-${runId}`;
|
|
62110
62340
|
}
|
|
62111
|
-
var defaultGitExec = (args, env) => (0,
|
|
62341
|
+
var defaultGitExec = (args, env) => (0, import_node_child_process19.execFileSync)("git", args, { encoding: "utf8", timeout: 3e4, env });
|
|
62112
62342
|
function disabledGitHooksPath(locksDir, scope) {
|
|
62113
62343
|
const scopeKey = (0, import_node_crypto13.createHash)("sha256").update(scope).digest("hex").slice(0, 32);
|
|
62114
62344
|
return (0, import_node_path30.resolve)(locksDir, "..", "disabled-git-hooks", scopeKey);
|
|
@@ -62145,7 +62375,7 @@ function withDisabledGitHooksEnv(env, hooksDir) {
|
|
|
62145
62375
|
};
|
|
62146
62376
|
}
|
|
62147
62377
|
function git(checkout, args, hooksDir) {
|
|
62148
|
-
return (0,
|
|
62378
|
+
return (0, import_node_child_process19.execFileSync)("git", ["-C", checkout, "-c", `core.hooksPath=${hooksDir}`, ...args], {
|
|
62149
62379
|
encoding: "utf8",
|
|
62150
62380
|
timeout: 3e4,
|
|
62151
62381
|
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
@@ -62833,7 +63063,7 @@ var BLAST_RADIUS_FLOOR_PATTERNS = [/^supabase\/migrations\//, /^packages\/db\/sr
|
|
|
62833
63063
|
function isBlastRadiusFloorPath(path29) {
|
|
62834
63064
|
return BLAST_RADIUS_FLOOR_PATTERNS.some((re) => re.test(path29));
|
|
62835
63065
|
}
|
|
62836
|
-
var execFileAsync2 = (0, import_node_util2.promisify)(
|
|
63066
|
+
var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process20.execFile);
|
|
62837
63067
|
async function defaultListRunDiffPaths(opts) {
|
|
62838
63068
|
const parse8 = (stdout) => stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
62839
63069
|
try {
|
|
@@ -65381,7 +65611,7 @@ function createToolBusyClock(opts) {
|
|
|
65381
65611
|
// src/remote-phone-relay.ts
|
|
65382
65612
|
var import_node_events3 = require("node:events");
|
|
65383
65613
|
var import_node_fs20 = require("node:fs");
|
|
65384
|
-
var
|
|
65614
|
+
var import_node_os15 = require("node:os");
|
|
65385
65615
|
var import_node_path34 = require("node:path");
|
|
65386
65616
|
|
|
65387
65617
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
@@ -68953,7 +69183,7 @@ var DirectorRelay = class {
|
|
|
68953
69183
|
|
|
68954
69184
|
// src/remote-phone-relay.ts
|
|
68955
69185
|
function loadOrCreateAgentDeviceKey() {
|
|
68956
|
-
const path29 = (0, import_node_path34.join)((0,
|
|
69186
|
+
const path29 = (0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin", "agent-device-key");
|
|
68957
69187
|
try {
|
|
68958
69188
|
const raw = JSON.parse((0, import_node_fs20.readFileSync)(path29, "utf8"));
|
|
68959
69189
|
if (typeof raw.priv === "string" && typeof raw.pub === "string") {
|
|
@@ -68963,7 +69193,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
68963
69193
|
}
|
|
68964
69194
|
const kp = generateIdentityKeyPair();
|
|
68965
69195
|
try {
|
|
68966
|
-
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0,
|
|
69196
|
+
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin"), { recursive: true });
|
|
68967
69197
|
(0, import_node_fs20.writeFileSync)(
|
|
68968
69198
|
path29,
|
|
68969
69199
|
JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
|
|
@@ -68973,7 +69203,7 @@ function loadOrCreateAgentDeviceKey() {
|
|
|
68973
69203
|
}
|
|
68974
69204
|
return kp;
|
|
68975
69205
|
}
|
|
68976
|
-
var AGENT_PAIRING_PATH = (0, import_node_path34.join)((0,
|
|
69206
|
+
var AGENT_PAIRING_PATH = (0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin", "agent-pairing.json");
|
|
68977
69207
|
function loadAgentPairing() {
|
|
68978
69208
|
try {
|
|
68979
69209
|
const raw = JSON.parse((0, import_node_fs20.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
|
|
@@ -68991,7 +69221,7 @@ function loadAgentPairing() {
|
|
|
68991
69221
|
}
|
|
68992
69222
|
function saveAgentPairing(record2) {
|
|
68993
69223
|
try {
|
|
68994
|
-
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0,
|
|
69224
|
+
(0, import_node_fs20.mkdirSync)((0, import_node_path34.join)((0, import_node_os15.homedir)(), ".mrrlin"), { recursive: true });
|
|
68995
69225
|
(0, import_node_fs20.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
|
|
68996
69226
|
} catch {
|
|
68997
69227
|
}
|
|
@@ -69170,14 +69400,14 @@ async function renderPairingQrSvg(payload) {
|
|
|
69170
69400
|
}
|
|
69171
69401
|
|
|
69172
69402
|
// src/executor-server.ts
|
|
69173
|
-
var
|
|
69403
|
+
var import_node_child_process21 = require("node:child_process");
|
|
69174
69404
|
function defaultReadinessRunner(provider) {
|
|
69175
69405
|
if (provider !== "codex" && provider !== "claude" && provider !== "agy") {
|
|
69176
69406
|
throw new Error(`unsupported executor provider: ${String(provider)}`);
|
|
69177
69407
|
}
|
|
69178
69408
|
const command = provider === "claude" ? "claude" : provider === "agy" ? "agy" : "codex";
|
|
69179
69409
|
return (args) => {
|
|
69180
|
-
const r = (0,
|
|
69410
|
+
const r = (0, import_node_child_process21.spawnSync)(command, args, { encoding: "utf8", timeout: 8e3, shell: true });
|
|
69181
69411
|
return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
69182
69412
|
};
|
|
69183
69413
|
}
|
|
@@ -69320,7 +69550,7 @@ function createSelfReviewTurn(deps) {
|
|
|
69320
69550
|
|
|
69321
69551
|
// src/director-reseed.ts
|
|
69322
69552
|
var import_node_fs21 = require("node:fs");
|
|
69323
|
-
var
|
|
69553
|
+
var import_node_readline2 = require("node:readline");
|
|
69324
69554
|
var import_node_path35 = require("node:path");
|
|
69325
69555
|
function estimateTokens(s) {
|
|
69326
69556
|
return Buffer.byteLength(s, "utf8");
|
|
@@ -69473,7 +69703,7 @@ async function readSessionRows(logsDir, files, sessionIds) {
|
|
|
69473
69703
|
const filePath = (0, import_node_path35.join)(logsDir, f);
|
|
69474
69704
|
try {
|
|
69475
69705
|
const stream = (0, import_node_fs21.createReadStream)(filePath, { encoding: "utf8" });
|
|
69476
|
-
const rl = (0,
|
|
69706
|
+
const rl = (0, import_node_readline2.createInterface)({ input: stream, crlfDelay: Infinity });
|
|
69477
69707
|
try {
|
|
69478
69708
|
for await (const line of rl) {
|
|
69479
69709
|
if (line.trim() === "") continue;
|
|
@@ -69497,11 +69727,11 @@ async function readSessionRows(logsDir, files, sessionIds) {
|
|
|
69497
69727
|
|
|
69498
69728
|
// src/external-agents-scrub.ts
|
|
69499
69729
|
var import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
69500
|
-
var
|
|
69730
|
+
var import_node_os16 = __toESM(require("node:os"), 1);
|
|
69501
69731
|
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
69502
69732
|
var REDACTION = "[REDACTED]";
|
|
69503
69733
|
var SHORT_VALUE_THRESHOLD = 8;
|
|
69504
|
-
var KEYS_ENV_PATH = () => import_node_path36.default.join(
|
|
69734
|
+
var KEYS_ENV_PATH = () => import_node_path36.default.join(import_node_os16.default.homedir(), ".local", "state", "external-agents", "keys.env");
|
|
69505
69735
|
var keysEnvCache = null;
|
|
69506
69736
|
function readKeysEnv() {
|
|
69507
69737
|
const filePath = KEYS_ENV_PATH();
|
|
@@ -69945,7 +70175,7 @@ function readKnownGptSlugsFromTomlFile(filePath) {
|
|
|
69945
70175
|
return Array.from(raw.matchAll(/^\s*model\s*=\s*"([^"]+)"/gm)).map((match) => match[1]?.trim() ?? "").filter(isSelectableModelSlug);
|
|
69946
70176
|
}
|
|
69947
70177
|
function readCodexFallbackModels() {
|
|
69948
|
-
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path38.default.join(
|
|
70178
|
+
const codexHome = process.env.CODEX_HOME?.trim() || import_node_path38.default.join(import_node_os18.default.homedir(), ".codex");
|
|
69949
70179
|
const models = /* @__PURE__ */ new Map();
|
|
69950
70180
|
const cachePath = import_node_path38.default.join(codexHome, "models_cache.json");
|
|
69951
70181
|
const cacheRaw = readTextIfExists(cachePath);
|
|
@@ -70046,7 +70276,7 @@ function neutralCheckoutCwd(stateDir) {
|
|
|
70046
70276
|
import_node_fs23.default.mkdirSync(dir, { recursive: true });
|
|
70047
70277
|
if (!import_node_fs23.default.existsSync(import_node_path38.default.join(dir, ".git"))) {
|
|
70048
70278
|
try {
|
|
70049
|
-
(0,
|
|
70279
|
+
(0, import_node_child_process22.spawnSync)("git", ["init", "-b", "main"], { cwd: dir, stdio: "ignore" });
|
|
70050
70280
|
} catch {
|
|
70051
70281
|
}
|
|
70052
70282
|
}
|
|
@@ -70557,7 +70787,7 @@ function resolveDefaultBranch(checkoutPath) {
|
|
|
70557
70787
|
if (!checkoutPath) return "main";
|
|
70558
70788
|
const runGit = (args) => {
|
|
70559
70789
|
try {
|
|
70560
|
-
return (0,
|
|
70790
|
+
return (0, import_node_child_process22.execFileSync)("git", ["-C", checkoutPath, ...args], {
|
|
70561
70791
|
encoding: "utf8",
|
|
70562
70792
|
stdio: ["ignore", "pipe", "ignore"],
|
|
70563
70793
|
timeout: 15e3,
|
|
@@ -71111,7 +71341,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
71111
71341
|
sendForSpan({ type: "checkout-state", ok: false, error: { code: "invalid_input", fields: { projectSlug: "required" } } });
|
|
71112
71342
|
return;
|
|
71113
71343
|
}
|
|
71114
|
-
const state = readCheckoutState(deps.checkoutRegistry, projectSlug,
|
|
71344
|
+
const state = readCheckoutState(deps.checkoutRegistry, projectSlug, import_node_os18.default.hostname());
|
|
71115
71345
|
if (!state) {
|
|
71116
71346
|
sendForSpan({ type: "checkout-state", ok: false, error: { code: "checkout_missing" } });
|
|
71117
71347
|
return;
|
|
@@ -71143,7 +71373,7 @@ function createBridgeMessageHandler(deps) {
|
|
|
71143
71373
|
const result = registerCheckout(
|
|
71144
71374
|
deps.checkoutRegistry,
|
|
71145
71375
|
{ projectSlug, path: typeof msg.path === "string" ? msg.path : "", repo },
|
|
71146
|
-
|
|
71376
|
+
import_node_os18.default.hostname()
|
|
71147
71377
|
);
|
|
71148
71378
|
if (!result.ok) {
|
|
71149
71379
|
sendForSpan({ type: "checkout-register", ok: false, error: { code: result.code, detail: result.detail } });
|
|
@@ -72325,7 +72555,7 @@ function parseConfig() {
|
|
|
72325
72555
|
}
|
|
72326
72556
|
function scanForOtherBridges() {
|
|
72327
72557
|
try {
|
|
72328
|
-
const result = (0,
|
|
72558
|
+
const result = (0, import_node_child_process22.spawnSync)("pgrep", ["-f", "mrrlin-mcp director-bridge"], {
|
|
72329
72559
|
encoding: "utf8"
|
|
72330
72560
|
});
|
|
72331
72561
|
if (result.status !== 0) return [];
|
|
@@ -74240,7 +74470,7 @@ function runSetCredential(args) {
|
|
|
74240
74470
|
}
|
|
74241
74471
|
|
|
74242
74472
|
// src/install-service.ts
|
|
74243
|
-
var
|
|
74473
|
+
var import_node_os19 = __toESM(require("node:os"), 1);
|
|
74244
74474
|
var import_node_fs24 = require("node:fs");
|
|
74245
74475
|
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
74246
74476
|
function parseEnvLine(line, env) {
|
|
@@ -74719,11 +74949,11 @@ function installService(deps) {
|
|
|
74719
74949
|
deps.log(resolved.reason);
|
|
74720
74950
|
return { ok: false };
|
|
74721
74951
|
}
|
|
74722
|
-
const home = deps.env.HOME ??
|
|
74952
|
+
const home = deps.env.HOME ?? import_node_os19.default.homedir();
|
|
74723
74953
|
const user = resolveBridgeUser({
|
|
74724
74954
|
env: deps.env,
|
|
74725
74955
|
home,
|
|
74726
|
-
userInfo: deps.userInfo ?? (() =>
|
|
74956
|
+
userInfo: deps.userInfo ?? (() => import_node_os19.default.userInfo()),
|
|
74727
74957
|
homeOwnerUid: deps.homeOwnerUid ?? defaultHomeOwnerUid,
|
|
74728
74958
|
log: deps.log
|
|
74729
74959
|
});
|
|
@@ -74744,7 +74974,7 @@ function installService(deps) {
|
|
|
74744
74974
|
const claudeBin = deps.which("claude");
|
|
74745
74975
|
const agyBin = deps.which("agy");
|
|
74746
74976
|
const resolvedBins = [...bins, claudeBin, agyBin].filter((b) => b !== null);
|
|
74747
|
-
const isWin =
|
|
74977
|
+
const isWin = import_node_os19.default.platform() === "win32";
|
|
74748
74978
|
const systemDirs = isWin ? (deps.env.PATH || "").split(import_node_path39.default.delimiter).filter(Boolean) : SYSTEM_PATH_DIRS;
|
|
74749
74979
|
const pathEnv = Array.from(
|
|
74750
74980
|
/* @__PURE__ */ new Set([...resolvedBins.map((b) => import_node_path39.default.dirname(b)), ...systemDirs])
|
|
@@ -74827,14 +75057,14 @@ function uninstallService(deps) {
|
|
|
74827
75057
|
|
|
74828
75058
|
// src/uninstall-codex.ts
|
|
74829
75059
|
var import_promises16 = __toESM(require("node:fs/promises"), 1);
|
|
74830
|
-
var
|
|
75060
|
+
var import_node_os20 = __toESM(require("node:os"), 1);
|
|
74831
75061
|
var import_node_path40 = __toESM(require("node:path"), 1);
|
|
74832
75062
|
var toml5 = __toESM(require_toml(), 1);
|
|
74833
75063
|
function resolveCodexHome3(options) {
|
|
74834
75064
|
if (options.codexHome) return options.codexHome;
|
|
74835
75065
|
if (options.homeDir) return import_node_path40.default.join(options.homeDir, ".codex");
|
|
74836
75066
|
if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
|
|
74837
|
-
return import_node_path40.default.join(
|
|
75067
|
+
return import_node_path40.default.join(import_node_os20.default.homedir(), ".codex");
|
|
74838
75068
|
}
|
|
74839
75069
|
async function pathExists6(target) {
|
|
74840
75070
|
try {
|
|
@@ -75021,7 +75251,7 @@ Missing required flag(s): ${missing.join(
|
|
|
75021
75251
|
function augmentProcessPathWithCommonDirs() {
|
|
75022
75252
|
const isWin = process.platform === "win32";
|
|
75023
75253
|
if (isWin) return;
|
|
75024
|
-
const home = process.env.HOME || (0,
|
|
75254
|
+
const home = process.env.HOME || (0, import_node_os21.homedir)();
|
|
75025
75255
|
const candidates = [
|
|
75026
75256
|
import_node_path43.default.join(home, ".local", "bin"),
|
|
75027
75257
|
import_node_path43.default.join(home, ".cargo", "bin"),
|
|
@@ -75037,13 +75267,13 @@ function augmentProcessPathWithCommonDirs() {
|
|
|
75037
75267
|
}
|
|
75038
75268
|
augmentProcessPathWithCommonDirs();
|
|
75039
75269
|
function pm2Runner(args) {
|
|
75040
|
-
const r = (0,
|
|
75270
|
+
const r = (0, import_node_child_process23.spawnSync)("pm2", args, { encoding: "utf8" });
|
|
75041
75271
|
process.stderr.write(r.stdout ?? "");
|
|
75042
75272
|
process.stderr.write(r.stderr ?? "");
|
|
75043
75273
|
return { code: r.status ?? 1, stdout: r.stdout ?? "" };
|
|
75044
75274
|
}
|
|
75045
75275
|
function whichBin(bin) {
|
|
75046
|
-
const r = (0,
|
|
75276
|
+
const r = (0, import_node_child_process23.spawnSync)("which", [bin], { encoding: "utf8" });
|
|
75047
75277
|
const out = (r.stdout ?? "").trim();
|
|
75048
75278
|
return r.status === 0 && out ? out.split("\n")[0] ?? null : null;
|
|
75049
75279
|
}
|
|
@@ -75051,14 +75281,14 @@ function bootHookStatus() {
|
|
|
75051
75281
|
if (process.platform !== "darwin") return { status: "unknown" };
|
|
75052
75282
|
const uid = process.getuid?.();
|
|
75053
75283
|
if (uid === void 0 || uid === 0) return { status: "unknown" };
|
|
75054
|
-
const home = process.env.HOME ?? (0,
|
|
75284
|
+
const home = process.env.HOME ?? (0, import_node_os21.homedir)();
|
|
75055
75285
|
const agents = import_node_path43.default.join(home, "Library", "LaunchAgents");
|
|
75056
75286
|
const candidates = [
|
|
75057
75287
|
{ label: "com.mrrlin.director-bridge", plist: import_node_path43.default.join(agents, "com.mrrlin.director-bridge.plist") },
|
|
75058
|
-
{ label: "com.PM2", plist: import_node_path43.default.join(agents, `pm2.${(0,
|
|
75288
|
+
{ label: "com.PM2", plist: import_node_path43.default.join(agents, `pm2.${(0, import_node_os21.userInfo)().username}.plist`) }
|
|
75059
75289
|
];
|
|
75060
75290
|
for (const candidate of candidates) {
|
|
75061
|
-
const printed = (0,
|
|
75291
|
+
const printed = (0, import_node_child_process23.spawnSync)("launchctl", ["print", `gui/${uid}/${candidate.label}`], { encoding: "utf8" });
|
|
75062
75292
|
if (printed.status !== 0) continue;
|
|
75063
75293
|
if (!(0, import_node_fs25.existsSync)(candidate.plist)) continue;
|
|
75064
75294
|
const out = printed.stdout ?? "";
|
|
@@ -75272,8 +75502,8 @@ async function main() {
|
|
|
75272
75502
|
);
|
|
75273
75503
|
}
|
|
75274
75504
|
const { command: command2, args, env } = browserServeArgs();
|
|
75275
|
-
const
|
|
75276
|
-
process.exitCode =
|
|
75505
|
+
const exitCode = await runBrowserServeProxy({ command: command2, args, env });
|
|
75506
|
+
process.exitCode = exitCode;
|
|
75277
75507
|
return;
|
|
75278
75508
|
}
|
|
75279
75509
|
case "browser-status": {
|
|
@@ -75283,7 +75513,7 @@ async function main() {
|
|
|
75283
75513
|
}
|
|
75284
75514
|
case "external-agents-serve": {
|
|
75285
75515
|
const { command: command2, args } = externalAgentsServeArgs();
|
|
75286
|
-
const r = (0,
|
|
75516
|
+
const r = (0, import_node_child_process23.spawnSync)(command2, args, { stdio: "inherit", env: process.env });
|
|
75287
75517
|
process.exitCode = r.status ?? 1;
|
|
75288
75518
|
return;
|
|
75289
75519
|
}
|
|
@@ -75337,7 +75567,7 @@ async function main() {
|
|
|
75337
75567
|
}
|
|
75338
75568
|
}
|
|
75339
75569
|
try {
|
|
75340
|
-
const codexHome = process.env.CODEX_HOME ?? import_node_path43.default.join(process.env.HOME ?? (0,
|
|
75570
|
+
const codexHome = process.env.CODEX_HOME ?? import_node_path43.default.join(process.env.HOME ?? (0, import_node_os21.homedir)(), ".codex");
|
|
75341
75571
|
(0, import_node_fs25.rmSync)(import_node_path43.default.join(codexHome, "prompts", "report-issue.md"), { force: true });
|
|
75342
75572
|
} catch {
|
|
75343
75573
|
}
|
|
@@ -75360,7 +75590,7 @@ async function main() {
|
|
|
75360
75590
|
);
|
|
75361
75591
|
}
|
|
75362
75592
|
const realProviderRunner = (command2) => (args) => {
|
|
75363
|
-
const r = (0,
|
|
75593
|
+
const r = (0, import_node_child_process23.spawnSync)(command2, args, { encoding: "utf8", timeout: 8e3 });
|
|
75364
75594
|
return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
|
|
75365
75595
|
};
|
|
75366
75596
|
for (const provider of ["codex", "claude", "agy"]) {
|
|
@@ -75453,14 +75683,14 @@ async function main() {
|
|
|
75453
75683
|
purgeSecret: purge,
|
|
75454
75684
|
secretPath: agentCredentialPath(),
|
|
75455
75685
|
tokenPath: operatorTokenPath(),
|
|
75456
|
-
ecoPath: import_node_path43.default.join(process.env.HOME ?? (0,
|
|
75686
|
+
ecoPath: import_node_path43.default.join(process.env.HOME ?? (0, import_node_os21.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
|
|
75457
75687
|
log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
|
|
75458
75688
|
`)
|
|
75459
75689
|
});
|
|
75460
75690
|
return;
|
|
75461
75691
|
}
|
|
75462
75692
|
case "uninstall": {
|
|
75463
|
-
const home = process.env.HOME ?? (0,
|
|
75693
|
+
const home = process.env.HOME ?? (0, import_node_os21.homedir)();
|
|
75464
75694
|
const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
|
|
75465
75695
|
`);
|
|
75466
75696
|
uninstallService({
|