usebeeline 0.0.117 → 0.0.120
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/usebeeline.mjs +351 -68
- package/package.json +1 -1
package/dist/usebeeline.mjs
CHANGED
|
@@ -17439,6 +17439,22 @@ function isAgentCommand(value) {
|
|
|
17439
17439
|
}
|
|
17440
17440
|
|
|
17441
17441
|
// packages/api-contract/dist/artifacts.js
|
|
17442
|
+
var ARTIFACT_EXTENSIONS_BY_MIME = {
|
|
17443
|
+
"text/html": [".html", ".htm"],
|
|
17444
|
+
"image/svg+xml": [".svg"],
|
|
17445
|
+
"application/pdf": [".pdf"],
|
|
17446
|
+
"text/markdown": [".md"],
|
|
17447
|
+
"image/png": [".png"],
|
|
17448
|
+
"image/jpeg": [".jpg", ".jpeg"],
|
|
17449
|
+
"image/gif": [".gif"],
|
|
17450
|
+
"image/webp": [".webp"],
|
|
17451
|
+
"text/plain": [".txt", ".log"],
|
|
17452
|
+
"application/json": [".json"],
|
|
17453
|
+
"text/csv": [".csv"],
|
|
17454
|
+
"application/zip": [".zip"],
|
|
17455
|
+
"application/octet-stream": []
|
|
17456
|
+
};
|
|
17457
|
+
var ARTIFACT_MIME_BY_EXTENSION = Object.fromEntries(Object.entries(ARTIFACT_EXTENSIONS_BY_MIME).flatMap(([mime, extensions]) => extensions.map((extension2) => [extension2, mime])));
|
|
17442
17458
|
var ARTIFACT_MAXIMUM_BYTES = 25 * 1024 * 1024;
|
|
17443
17459
|
|
|
17444
17460
|
// packages/api-contract/dist/system-events.js
|
|
@@ -28433,6 +28449,155 @@ function parse5(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
28433
28449
|
return res;
|
|
28434
28450
|
}
|
|
28435
28451
|
|
|
28452
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
28453
|
+
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
28454
|
+
function extendedTypeOf(obj) {
|
|
28455
|
+
let type = typeof obj;
|
|
28456
|
+
if (type === "object") {
|
|
28457
|
+
if (Array.isArray(obj))
|
|
28458
|
+
return "array";
|
|
28459
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
|
|
28460
|
+
return "date";
|
|
28461
|
+
if (globalThis.Temporal && // check for the 'since' property as an early bailout that avoids running all 5 instanceof checks
|
|
28462
|
+
typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) {
|
|
28463
|
+
return "temporal";
|
|
28464
|
+
}
|
|
28465
|
+
}
|
|
28466
|
+
return type;
|
|
28467
|
+
}
|
|
28468
|
+
function isArrayOfTables(obj) {
|
|
28469
|
+
for (let i3 = 0; i3 < obj.length; i3++) {
|
|
28470
|
+
if (extendedTypeOf(obj[i3]) !== "object")
|
|
28471
|
+
return false;
|
|
28472
|
+
}
|
|
28473
|
+
return obj.length != 0;
|
|
28474
|
+
}
|
|
28475
|
+
function formatString(s) {
|
|
28476
|
+
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
28477
|
+
}
|
|
28478
|
+
function stringifyTemporal(temporal) {
|
|
28479
|
+
return temporal.toString({
|
|
28480
|
+
calendarName: "never",
|
|
28481
|
+
timeZoneName: "never"
|
|
28482
|
+
});
|
|
28483
|
+
}
|
|
28484
|
+
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
28485
|
+
if (depth === 0) {
|
|
28486
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
28487
|
+
}
|
|
28488
|
+
switch (type) {
|
|
28489
|
+
// @ts-expect-error -- intentional fallthrough case
|
|
28490
|
+
case "number":
|
|
28491
|
+
if (isNaN(val))
|
|
28492
|
+
return "nan";
|
|
28493
|
+
if (val === Infinity)
|
|
28494
|
+
return "inf";
|
|
28495
|
+
if (val === -Infinity)
|
|
28496
|
+
return "-inf";
|
|
28497
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
|
|
28498
|
+
return val.toFixed(1);
|
|
28499
|
+
case "bigint":
|
|
28500
|
+
case "boolean":
|
|
28501
|
+
return val.toString();
|
|
28502
|
+
case "string":
|
|
28503
|
+
return formatString(val);
|
|
28504
|
+
case "date":
|
|
28505
|
+
if (isNaN(val.getTime()))
|
|
28506
|
+
throw new TypeError("cannot serialize invalid date");
|
|
28507
|
+
return val.toISOString();
|
|
28508
|
+
case "object":
|
|
28509
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
28510
|
+
case "array":
|
|
28511
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
28512
|
+
case "temporal":
|
|
28513
|
+
return stringifyTemporal(val);
|
|
28514
|
+
}
|
|
28515
|
+
}
|
|
28516
|
+
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
28517
|
+
let keys = Object.keys(obj);
|
|
28518
|
+
if (keys.length === 0)
|
|
28519
|
+
return "{}";
|
|
28520
|
+
let res = "{ ";
|
|
28521
|
+
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
28522
|
+
let k = keys[i3];
|
|
28523
|
+
if (i3)
|
|
28524
|
+
res += ", ";
|
|
28525
|
+
res += BARE_KEY.test(k) ? k : formatString(k);
|
|
28526
|
+
res += " = ";
|
|
28527
|
+
res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
|
|
28528
|
+
}
|
|
28529
|
+
return res + " }";
|
|
28530
|
+
}
|
|
28531
|
+
function stringifyArray(array, depth, numberAsFloat) {
|
|
28532
|
+
if (array.length === 0)
|
|
28533
|
+
return "[]";
|
|
28534
|
+
let res = "[ ";
|
|
28535
|
+
for (let i3 = 0; i3 < array.length; i3++) {
|
|
28536
|
+
if (i3)
|
|
28537
|
+
res += ", ";
|
|
28538
|
+
if (array[i3] === null || array[i3] === void 0) {
|
|
28539
|
+
throw new TypeError("arrays cannot contain null or undefined values");
|
|
28540
|
+
}
|
|
28541
|
+
res += stringifyValue(array[i3], extendedTypeOf(array[i3]), depth - 1, numberAsFloat);
|
|
28542
|
+
}
|
|
28543
|
+
return res + " ]";
|
|
28544
|
+
}
|
|
28545
|
+
function stringifyArrayTable(array, key, depth, numberAsFloat) {
|
|
28546
|
+
if (depth === 0) {
|
|
28547
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
28548
|
+
}
|
|
28549
|
+
let res = "";
|
|
28550
|
+
for (let i3 = 0; i3 < array.length; i3++) {
|
|
28551
|
+
res += `${res && "\n"}[[${key}]]
|
|
28552
|
+
`;
|
|
28553
|
+
res += stringifyTable(0, array[i3], key, depth, numberAsFloat);
|
|
28554
|
+
}
|
|
28555
|
+
return res;
|
|
28556
|
+
}
|
|
28557
|
+
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
28558
|
+
if (depth === 0) {
|
|
28559
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
28560
|
+
}
|
|
28561
|
+
let preamble = "";
|
|
28562
|
+
let tables = "";
|
|
28563
|
+
let keys = Object.keys(obj);
|
|
28564
|
+
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
28565
|
+
let k = keys[i3];
|
|
28566
|
+
if (obj[k] !== null && obj[k] !== void 0) {
|
|
28567
|
+
let type = extendedTypeOf(obj[k]);
|
|
28568
|
+
if (type === "symbol" || type === "function") {
|
|
28569
|
+
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
28570
|
+
}
|
|
28571
|
+
let key = BARE_KEY.test(k) ? k : formatString(k);
|
|
28572
|
+
if (type === "array" && isArrayOfTables(obj[k])) {
|
|
28573
|
+
tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
28574
|
+
} else if (type === "object") {
|
|
28575
|
+
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
28576
|
+
tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
28577
|
+
} else {
|
|
28578
|
+
preamble += key;
|
|
28579
|
+
preamble += " = ";
|
|
28580
|
+
preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
|
|
28581
|
+
preamble += "\n";
|
|
28582
|
+
}
|
|
28583
|
+
}
|
|
28584
|
+
}
|
|
28585
|
+
if (tableKey && (preamble || !tables))
|
|
28586
|
+
preamble = preamble ? `[${tableKey}]
|
|
28587
|
+
${preamble}` : `[${tableKey}]`;
|
|
28588
|
+
return preamble && tables ? `${preamble}
|
|
28589
|
+
${tables}` : preamble || tables;
|
|
28590
|
+
}
|
|
28591
|
+
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
28592
|
+
if (extendedTypeOf(obj) !== "object") {
|
|
28593
|
+
throw new TypeError("stringify can only be called with an object");
|
|
28594
|
+
}
|
|
28595
|
+
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
|
|
28596
|
+
if (str[str.length - 1] !== "\n")
|
|
28597
|
+
return str + "\n";
|
|
28598
|
+
return str;
|
|
28599
|
+
}
|
|
28600
|
+
|
|
28436
28601
|
// apps/body/dist/agent-home.js
|
|
28437
28602
|
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
28438
28603
|
import { chmod as chmod3, copyFile, lstat as lstat2, mkdir as mkdir6, readFile as readFile6, readdir as readdir2, realpath, rename as rename3, rm as rm2, symlink, unlink as unlink3, writeFile as writeFile7 } from "node:fs/promises";
|
|
@@ -28751,6 +28916,68 @@ var SQUIRE_GOVERNED_TOOLS = [
|
|
|
28751
28916
|
];
|
|
28752
28917
|
var SQUIRE_GOVERNED_TOOL_SET = new Set(SQUIRE_GOVERNED_TOOLS);
|
|
28753
28918
|
|
|
28919
|
+
// apps/body/dist/mcp-route-class.js
|
|
28920
|
+
var CODE_OWNED_HOST_MCP_NAMES = ["squire"];
|
|
28921
|
+
var MCP_ROUTE_CLASS_KEY = "beeline_route";
|
|
28922
|
+
var MCP_ROUTE_HOST = "host";
|
|
28923
|
+
function isCodeOwnedHostMcpName(name) {
|
|
28924
|
+
return CODE_OWNED_HOST_MCP_NAMES.includes(name.trim().toLowerCase());
|
|
28925
|
+
}
|
|
28926
|
+
function classifyImportedMcpServer(input) {
|
|
28927
|
+
const name = input.name.trim();
|
|
28928
|
+
if (isCodeOwnedHostMcpName(name))
|
|
28929
|
+
return "host";
|
|
28930
|
+
const command = input.command ?? mcpLaunchCommand(input.declaration);
|
|
28931
|
+
const args = input.args ?? mcpLaunchArgs(input.declaration);
|
|
28932
|
+
if (command && isTrustySquireMcpLaunch(command, args))
|
|
28933
|
+
return "host";
|
|
28934
|
+
if (operatorMarkedHost(input.declaration))
|
|
28935
|
+
return "host";
|
|
28936
|
+
return "local";
|
|
28937
|
+
}
|
|
28938
|
+
function hostMcpIdentityPrefixes(name) {
|
|
28939
|
+
const lower = name.trim().toLowerCase();
|
|
28940
|
+
const normalized = lower.replace(/[^a-z0-9]+/g, "_");
|
|
28941
|
+
return [
|
|
28942
|
+
`mcp__${lower}__`,
|
|
28943
|
+
`mcp__${normalized}__`,
|
|
28944
|
+
`mcp.${lower}.`,
|
|
28945
|
+
`${lower}.`,
|
|
28946
|
+
`${lower}/`,
|
|
28947
|
+
`${lower}__`
|
|
28948
|
+
];
|
|
28949
|
+
}
|
|
28950
|
+
function isHostMcpIdentity(candidate, hostNames = CODE_OWNED_HOST_MCP_NAMES) {
|
|
28951
|
+
const lowered = candidate.trim().toLowerCase();
|
|
28952
|
+
if (!lowered)
|
|
28953
|
+
return false;
|
|
28954
|
+
return hostNames.some((name) => {
|
|
28955
|
+
const n3 = name.trim().toLowerCase();
|
|
28956
|
+
if (!n3)
|
|
28957
|
+
return false;
|
|
28958
|
+
if (lowered === n3)
|
|
28959
|
+
return true;
|
|
28960
|
+
return hostMcpIdentityPrefixes(n3).some((prefix) => lowered.startsWith(prefix));
|
|
28961
|
+
});
|
|
28962
|
+
}
|
|
28963
|
+
function operatorMarkedHost(declaration) {
|
|
28964
|
+
return declaration?.[MCP_ROUTE_CLASS_KEY] === MCP_ROUTE_HOST;
|
|
28965
|
+
}
|
|
28966
|
+
function mcpLaunchCommand(declaration) {
|
|
28967
|
+
if (!declaration)
|
|
28968
|
+
return void 0;
|
|
28969
|
+
return stringField(declaration.command) ?? stringField(declaration.cmd);
|
|
28970
|
+
}
|
|
28971
|
+
function mcpLaunchArgs(declaration) {
|
|
28972
|
+
return stringArray(declaration?.args);
|
|
28973
|
+
}
|
|
28974
|
+
function stringField(value) {
|
|
28975
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
28976
|
+
}
|
|
28977
|
+
function stringArray(value) {
|
|
28978
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : [];
|
|
28979
|
+
}
|
|
28980
|
+
|
|
28754
28981
|
// apps/body/dist/openrouter-routing.js
|
|
28755
28982
|
import { mkdir as mkdir5, readFile as readFile5, writeFile as writeFile6 } from "node:fs/promises";
|
|
28756
28983
|
import { resolve as resolve13 } from "node:path";
|
|
@@ -29434,7 +29661,7 @@ async function provisionAgentSkillsAndMcp(root, operatorHome, skillReleaseId, fa
|
|
|
29434
29661
|
try {
|
|
29435
29662
|
const source = resolve14(operatorHome, config.toml);
|
|
29436
29663
|
const target = resolve14(root, config.dir, "config.toml");
|
|
29437
|
-
const mcpSection = existsSync4(source) ?
|
|
29664
|
+
const mcpSection = existsSync4(source) ? localHarnessMcpToml(readFileSync7(source, "utf8")) : void 0;
|
|
29438
29665
|
const section = config.dir === "codex" ? [CODEX_ROOM_AGENT_LOCKDOWN_TOML, CODEX_ROOM_WEB_SEARCH_TOML, mcpSection].filter(Boolean).join("\n") : mcpSection;
|
|
29439
29666
|
if (!section) {
|
|
29440
29667
|
await unlink3(target).catch(() => void 0);
|
|
@@ -29454,7 +29681,8 @@ async function provisionAgentSkillsAndMcp(root, operatorHome, skillReleaseId, fa
|
|
|
29454
29681
|
const source = resolve14(operatorHome, ".config", "goose", name);
|
|
29455
29682
|
const target = resolve14(gooseConfigDir, name);
|
|
29456
29683
|
if (existsSync4(source)) {
|
|
29457
|
-
|
|
29684
|
+
const body = readFileSync7(source, "utf8");
|
|
29685
|
+
await writeIsolatedHarnessFile(target, name === "config.yaml" ? localGooseConfig(body) : body);
|
|
29458
29686
|
} else {
|
|
29459
29687
|
await unlink3(target).catch(() => void 0);
|
|
29460
29688
|
}
|
|
@@ -29538,27 +29766,62 @@ async function provisionPiCustomModelConfig(root, operatorHome, failClosed, open
|
|
|
29538
29766
|
function readClaudeUserScopeMcpServers(path) {
|
|
29539
29767
|
try {
|
|
29540
29768
|
const parsed = JSON.parse(readFileSync7(path, "utf8"));
|
|
29541
|
-
|
|
29542
|
-
|
|
29543
|
-
|
|
29544
|
-
return false;
|
|
29545
|
-
const server = value;
|
|
29546
|
-
if (!server || typeof server.command !== "string")
|
|
29547
|
-
return true;
|
|
29548
|
-
const args = Array.isArray(server.args) && server.args.every((arg) => typeof arg === "string") ? server.args : [];
|
|
29549
|
-
return !isTrustySquireMcpLaunch(server.command, args);
|
|
29550
|
-
}));
|
|
29551
|
-
}
|
|
29769
|
+
const servers = recordValue(parsed.mcpServers);
|
|
29770
|
+
if (servers)
|
|
29771
|
+
return localMcpServers(servers);
|
|
29552
29772
|
} catch {
|
|
29553
29773
|
}
|
|
29554
29774
|
return void 0;
|
|
29555
29775
|
}
|
|
29556
|
-
function
|
|
29557
|
-
|
|
29558
|
-
|
|
29559
|
-
|
|
29560
|
-
}
|
|
29561
|
-
|
|
29776
|
+
function localHarnessMcpToml(source) {
|
|
29777
|
+
let servers;
|
|
29778
|
+
try {
|
|
29779
|
+
servers = recordValue(parse5(source).mcp_servers);
|
|
29780
|
+
} catch {
|
|
29781
|
+
return void 0;
|
|
29782
|
+
}
|
|
29783
|
+
if (!servers)
|
|
29784
|
+
return void 0;
|
|
29785
|
+
const hostNames = hostMcpServerNames(servers);
|
|
29786
|
+
const childTables = tomlChildTableNames(source, ["mcp_servers"]);
|
|
29787
|
+
if (hostNames.every((name) => childTables.includes(name))) {
|
|
29788
|
+
return extractTomlSections(source, ["mcp_servers"], hostNames);
|
|
29789
|
+
}
|
|
29790
|
+
const bareLocal = Object.fromEntries(Object.entries(servers).filter(([name]) => !childTables.includes(name) && !hostNames.includes(name)));
|
|
29791
|
+
const sections = [
|
|
29792
|
+
Object.keys(bareLocal).length > 0 ? stringify({ mcp_servers: bareLocal }) : void 0,
|
|
29793
|
+
...childTables.filter((name) => !hostNames.includes(name)).map((name) => extractTomlSections(source, ["mcp_servers", name]))
|
|
29794
|
+
].filter((section) => section !== void 0).map((section) => section.endsWith("\n") ? section : `${section}
|
|
29795
|
+
`);
|
|
29796
|
+
return sections.length > 0 ? sections.join("\n") : void 0;
|
|
29797
|
+
}
|
|
29798
|
+
function localGooseConfig(source) {
|
|
29799
|
+
let parsed;
|
|
29800
|
+
try {
|
|
29801
|
+
parsed = (0, import_yaml.parse)(source);
|
|
29802
|
+
} catch {
|
|
29803
|
+
return source;
|
|
29804
|
+
}
|
|
29805
|
+
const document = recordValue(parsed);
|
|
29806
|
+
const extensions = recordValue(document?.extensions);
|
|
29807
|
+
if (!document || !extensions)
|
|
29808
|
+
return source;
|
|
29809
|
+
const local = localMcpServers(extensions);
|
|
29810
|
+
if (Object.keys(local).length === Object.keys(extensions).length)
|
|
29811
|
+
return source;
|
|
29812
|
+
return (0, import_yaml.stringify)({ ...document, extensions: local });
|
|
29813
|
+
}
|
|
29814
|
+
function isHostMcpDeclaration(name, value) {
|
|
29815
|
+
return classifyImportedMcpServer({ name, declaration: recordValue(value) ?? {} }) === "host";
|
|
29816
|
+
}
|
|
29817
|
+
function hostMcpServerNames(servers) {
|
|
29818
|
+
return Object.entries(servers).filter(([name, value]) => isHostMcpDeclaration(name, value)).map(([name]) => name);
|
|
29819
|
+
}
|
|
29820
|
+
function localMcpServers(servers) {
|
|
29821
|
+
return Object.fromEntries(Object.entries(servers).filter(([name, value]) => !isHostMcpDeclaration(name, value)));
|
|
29822
|
+
}
|
|
29823
|
+
function recordValue(value) {
|
|
29824
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
29562
29825
|
}
|
|
29563
29826
|
function mountedImportedMcpServerNames(input = {}) {
|
|
29564
29827
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -29567,13 +29830,13 @@ function mountedImportedMcpServerNames(input = {}) {
|
|
|
29567
29830
|
const home = env.HOME ?? input.operatorHome ?? homedir6();
|
|
29568
29831
|
const kind = input.agentKind;
|
|
29569
29832
|
if (!kind || kind === "codex") {
|
|
29570
|
-
addTomlMcpNames(names, resolve14(env.CODEX_HOME ?? resolve14(home, ".codex"), "config.toml")
|
|
29833
|
+
addTomlMcpNames(names, resolve14(env.CODEX_HOME ?? resolve14(home, ".codex"), "config.toml"));
|
|
29571
29834
|
}
|
|
29572
29835
|
if (!kind || kind === "grok") {
|
|
29573
|
-
addTomlMcpNames(names, resolve14(env.GROK_HOME ?? resolve14(home, ".grok"), "config.toml")
|
|
29836
|
+
addTomlMcpNames(names, resolve14(env.GROK_HOME ?? resolve14(home, ".grok"), "config.toml"));
|
|
29574
29837
|
}
|
|
29575
29838
|
if (!kind || kind === "claude") {
|
|
29576
|
-
addClaudeMcpNames(names, resolve14(env.CLAUDE_CONFIG_DIR ?? home, ".claude.json")
|
|
29839
|
+
addClaudeMcpNames(names, resolve14(env.CLAUDE_CONFIG_DIR ?? home, ".claude.json"));
|
|
29577
29840
|
}
|
|
29578
29841
|
if (!kind || kind === "goose") {
|
|
29579
29842
|
addGooseExtensionNames(names, env.GOOSE_PATH_ROOT ? resolve14(env.GOOSE_PATH_ROOT, "config/config.yaml") : resolve14(home, ".config/goose/config.yaml"));
|
|
@@ -29583,63 +29846,87 @@ function mountedImportedMcpServerNames(input = {}) {
|
|
|
29583
29846
|
}
|
|
29584
29847
|
return [...names].sort((left, right) => left.localeCompare(right));
|
|
29585
29848
|
}
|
|
29586
|
-
function
|
|
29849
|
+
function hostImportedMcpServerNames(input = {}) {
|
|
29850
|
+
const operatorHome = input.operatorHome ?? homedir6();
|
|
29851
|
+
const kind = input.agentKind;
|
|
29852
|
+
const names = /* @__PURE__ */ new Set();
|
|
29587
29853
|
if (!kind || kind === "codex") {
|
|
29588
|
-
|
|
29854
|
+
addHostMcpNames(names, readTomlMcpServers(resolve14(operatorHome, ".codex/config.toml")));
|
|
29589
29855
|
}
|
|
29590
29856
|
if (!kind || kind === "grok") {
|
|
29591
|
-
|
|
29857
|
+
addHostMcpNames(names, readTomlMcpServers(resolve14(operatorHome, ".grok/config.toml")));
|
|
29592
29858
|
}
|
|
29593
29859
|
if (!kind || kind === "claude") {
|
|
29594
|
-
|
|
29860
|
+
addHostMcpNames(names, recordValue(readJsonObject(resolve14(operatorHome, ".claude.json"))?.mcpServers));
|
|
29595
29861
|
}
|
|
29596
29862
|
if (!kind || kind === "goose") {
|
|
29597
|
-
|
|
29863
|
+
addHostMcpNames(names, readGooseExtensions(resolve14(operatorHome, ".config/goose/config.yaml")));
|
|
29598
29864
|
}
|
|
29865
|
+
return [...names].sort((left, right) => left.localeCompare(right));
|
|
29599
29866
|
}
|
|
29600
|
-
function
|
|
29601
|
-
|
|
29602
|
-
|
|
29603
|
-
|
|
29604
|
-
|
|
29605
|
-
|
|
29606
|
-
|
|
29607
|
-
|
|
29608
|
-
|
|
29609
|
-
|
|
29610
|
-
|
|
29611
|
-
|
|
29867
|
+
function collectImportedMcpNames(operatorHome, names, kind) {
|
|
29868
|
+
if (!kind || kind === "codex") {
|
|
29869
|
+
addLocalMcpNames(names, readTomlMcpServers(resolve14(operatorHome, ".codex/config.toml")));
|
|
29870
|
+
}
|
|
29871
|
+
if (!kind || kind === "grok") {
|
|
29872
|
+
addLocalMcpNames(names, readTomlMcpServers(resolve14(operatorHome, ".grok/config.toml")));
|
|
29873
|
+
}
|
|
29874
|
+
if (!kind || kind === "claude") {
|
|
29875
|
+
addLocalMcpNames(names, recordValue(readJsonObject(resolve14(operatorHome, ".claude.json"))?.mcpServers));
|
|
29876
|
+
}
|
|
29877
|
+
if (!kind || kind === "goose") {
|
|
29878
|
+
addLocalMcpNames(names, readGooseExtensions(resolve14(operatorHome, ".config/goose/config.yaml")));
|
|
29612
29879
|
}
|
|
29613
|
-
|
|
29880
|
+
}
|
|
29881
|
+
function addLocalMcpNames(names, servers) {
|
|
29882
|
+
if (!servers)
|
|
29614
29883
|
return;
|
|
29615
|
-
for (const name of Object.keys(servers))
|
|
29884
|
+
for (const name of Object.keys(localMcpServers(servers)))
|
|
29616
29885
|
names.add(name);
|
|
29617
29886
|
}
|
|
29618
|
-
function
|
|
29619
|
-
|
|
29620
|
-
if (!servers || typeof servers !== "object" || Array.isArray(servers))
|
|
29887
|
+
function addHostMcpNames(names, servers) {
|
|
29888
|
+
if (!servers)
|
|
29621
29889
|
return;
|
|
29622
|
-
for (const name of
|
|
29890
|
+
for (const name of hostMcpServerNames(servers))
|
|
29623
29891
|
names.add(name);
|
|
29624
29892
|
}
|
|
29625
|
-
function
|
|
29893
|
+
function addTomlMcpNames(names, path) {
|
|
29894
|
+
addMcpNamesFromMap(names, readTomlMcpServers(path));
|
|
29895
|
+
}
|
|
29896
|
+
function addClaudeMcpNames(names, path) {
|
|
29897
|
+
addMcpNamesFromMap(names, recordValue(readJsonObject(path)?.mcpServers));
|
|
29898
|
+
}
|
|
29899
|
+
function readTomlMcpServers(path) {
|
|
29626
29900
|
const source = readExistingText(path);
|
|
29627
29901
|
if (source === void 0)
|
|
29628
|
-
return;
|
|
29902
|
+
return void 0;
|
|
29903
|
+
try {
|
|
29904
|
+
return recordValue(parse5(source).mcp_servers);
|
|
29905
|
+
} catch {
|
|
29906
|
+
return void 0;
|
|
29907
|
+
}
|
|
29908
|
+
}
|
|
29909
|
+
function readGooseExtensions(path) {
|
|
29910
|
+
const source = readExistingText(path);
|
|
29911
|
+
if (source === void 0)
|
|
29912
|
+
return void 0;
|
|
29629
29913
|
let parsed;
|
|
29630
29914
|
try {
|
|
29631
29915
|
parsed = (0, import_yaml.parse)(source);
|
|
29632
29916
|
} catch {
|
|
29633
|
-
return;
|
|
29917
|
+
return void 0;
|
|
29634
29918
|
}
|
|
29635
|
-
|
|
29636
|
-
|
|
29637
|
-
|
|
29638
|
-
if (!
|
|
29919
|
+
return recordValue(recordValue(parsed)?.extensions);
|
|
29920
|
+
}
|
|
29921
|
+
function addMcpNamesFromMap(names, servers) {
|
|
29922
|
+
if (!servers)
|
|
29639
29923
|
return;
|
|
29640
|
-
for (const name of Object.keys(
|
|
29924
|
+
for (const name of Object.keys(servers))
|
|
29641
29925
|
names.add(name);
|
|
29642
29926
|
}
|
|
29927
|
+
function addGooseExtensionNames(names, path) {
|
|
29928
|
+
addMcpNamesFromMap(names, readGooseExtensions(path));
|
|
29929
|
+
}
|
|
29643
29930
|
function readExistingText(path) {
|
|
29644
29931
|
if (!existsSync4(path))
|
|
29645
29932
|
return void 0;
|
|
@@ -30794,22 +31081,14 @@ var AGENT_SURFACE_TOOL_NAMES = [
|
|
|
30794
31081
|
"write_scratch_file",
|
|
30795
31082
|
"fetch_image"
|
|
30796
31083
|
];
|
|
30797
|
-
|
|
30798
|
-
"mcp__squire__",
|
|
30799
|
-
"mcp.squire.",
|
|
30800
|
-
"squire.",
|
|
30801
|
-
"squire/",
|
|
30802
|
-
// grok's qualified `<server>__<tool>` spelling, inside `use_tool` or as the
|
|
30803
|
-
// relabelled title.
|
|
30804
|
-
"squire__"
|
|
30805
|
-
];
|
|
30806
|
-
function isSquireMcpPermissionRequest(request) {
|
|
31084
|
+
function isHostMcpPermissionRequest(request, hostServers = CODE_OWNED_HOST_MCP_NAMES) {
|
|
30807
31085
|
const rawInput = request.toolCall?.rawInput;
|
|
30808
31086
|
if (rawInput && typeof rawInput === "object" && !Array.isArray(rawInput)) {
|
|
30809
|
-
|
|
31087
|
+
const server = rawInput.server;
|
|
31088
|
+
if (typeof server === "string" && isHostMcpIdentity(server, hostServers))
|
|
30810
31089
|
return true;
|
|
30811
31090
|
}
|
|
30812
|
-
return toolIdentityCandidates(request.toolCall).some((candidate) =>
|
|
31091
|
+
return toolIdentityCandidates(request.toolCall).some((candidate) => isHostMcpIdentity(candidate, hostServers));
|
|
30813
31092
|
}
|
|
30814
31093
|
function isBeelineAgentMcpPermissionRequest(request) {
|
|
30815
31094
|
const toolCall = request.toolCall;
|
|
@@ -32087,8 +32366,8 @@ var SCHEDULE_RAN_VERB = "ran a schedule for";
|
|
|
32087
32366
|
|
|
32088
32367
|
// apps/body/dist/monolith-room-turn.js
|
|
32089
32368
|
var ROOM_PROMPT_INACTIVITY_TIMEOUT_MS = 18e4;
|
|
32090
|
-
function isRoomMcpPermissionRequest(request, mountedServers = ROOM_MOUNTED_MCP_SERVERS) {
|
|
32091
|
-
if (
|
|
32369
|
+
function isRoomMcpPermissionRequest(request, mountedServers = ROOM_MOUNTED_MCP_SERVERS, hostServers = CODE_OWNED_HOST_MCP_NAMES) {
|
|
32370
|
+
if (isHostMcpPermissionRequest(request, hostServers))
|
|
32092
32371
|
return false;
|
|
32093
32372
|
return isMountedMcpToolPermissionRequest(request, mountedServers);
|
|
32094
32373
|
}
|
|
@@ -32453,6 +32732,10 @@ var MonolithRoomTurnLoop = class {
|
|
|
32453
32732
|
servers
|
|
32454
32733
|
});
|
|
32455
32734
|
const mountedServers = servers.map((server) => server.name);
|
|
32735
|
+
const hostServers = hostImportedMcpServerNames({
|
|
32736
|
+
operatorHome: this.options.config.operatorHome,
|
|
32737
|
+
agentKind: this.options.config.agentKind
|
|
32738
|
+
});
|
|
32456
32739
|
const clientOptions = {
|
|
32457
32740
|
agentCommand: spawnCommand.command,
|
|
32458
32741
|
agentArgs: spawnCommand.args,
|
|
@@ -32463,7 +32746,7 @@ var MonolithRoomTurnLoop = class {
|
|
|
32463
32746
|
// (`config.ts`), which is exactly when `wrapAgentCommand` above wraps.
|
|
32464
32747
|
osSandbox: Boolean(this.options.config.bwrapPath),
|
|
32465
32748
|
autoApprovePermissions: false,
|
|
32466
|
-
permissionAllowlist: (request) => isRoomMcpPermissionRequest(request, mountedServers)
|
|
32749
|
+
permissionAllowlist: (request) => isRoomMcpPermissionRequest(request, mountedServers, hostServers)
|
|
32467
32750
|
};
|
|
32468
32751
|
this.client = (this.options.createAcpClient ?? ((value) => new AcpClient(value)))(clientOptions);
|
|
32469
32752
|
await this.client.start();
|