@chibitek/chibi 0.1.158 → 0.1.160
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/assets/{abnfDiagram-O67JEVCF-B8-8zzMS.js → abnfDiagram-O67JEVCF-CpuRvzQ3.js} +1 -1
- package/dist/assets/{arc-CSHQ9Dx3.js → arc-ko1e0R6h.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-BCHM9rXW.js → architectureDiagram-NJMV4G6O-OZ3SsOOa.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-B-5uxPFN.js → blockDiagram-BEXU5L5S-DLRkBkjs.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-CuKNM_MR.js → c4Diagram-YGBWAQC7-e8Q3qMnw.js} +1 -1
- package/dist/assets/channel-Lp7erhx-.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BNF02GM4.js → chunk-2Q5K7J3B-hCDqaM4Q.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-uEWgBd4M.js → chunk-3FUC2YCW-Dy3Pahu-.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-eSZuXctY.js → chunk-5VM5RSS4-QMK3iFBF.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-CslS8nRS.js → chunk-GTNCS2PH-6fyp9ERp.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-w71-MeKj.js → chunk-GWA4HPMP-DWvOhTaO.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-Bjju7WGh.js → chunk-JWPE2WC7-DgohMW2S.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-HxrroD4M.js → chunk-NETBCI7D-sRGeD2Y7.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-D7Rz470x.js → chunk-WEXAMYUT-CZslD_VF.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BWKnAeyM.js → chunk-XXDRQBXY-D7ocO3VN.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-CeBDRHmP.js → classDiagram-v2-NBCMYWYE-T1lLqHHW.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-BBbRKlvr.js → cose-bilkent-JH36ORCC-BdeLiJr3.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-W02cnJ0B.js → cynefin-OW5HDTMX-BydCA0pv.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-Cs47eaxd.js → cynefinDiagram-VND7K2PF-DBxckjwQ.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-8mG18hzT.js → dagre-6A5THRUB-CAsvq6Zk.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DF4Qrw67.js → diagram-22UHCM2B-DTwH3rA_.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-3BAVoed1.js → diagram-3UASUU5V-BNYj1bey.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-CKO3pECE.js → diagram-ATOU4E4O-CihwYFxb.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-CZhrGvur.js → diagram-CDSNMT55-nouwk3s2.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-C07l9pdQ.js → diagram-MLGK6HIB-BoKewJeA.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-D3or4lkZ.js → diagram-MPIPVDR6-CrE1m9DQ.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-DV2epXp_.js → ebnfDiagram-ZINNZB2B-DRj0aU4Y.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-DlvEn4-1.js → elk-276RUBZZ-Do0JzCG5.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-CB6X7Wt5.js → erDiagram-OPXOYQCR-CRsI9pXb.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-C3bqz4lC.js → flowDiagram-KWPJA3E3-dtD6wm3G.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-yo_Evhab.js → ganttDiagram-FUAMR5RP-Cn7KyLCo.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-Cq2oUlap.js → gitGraphDiagram-X574FWY7-CGH_VWzq.js} +1 -1
- package/dist/assets/index-B2fJMh8N.css +1 -0
- package/dist/assets/{index-CMcr5k3Z.js → index-BIcziktH.js} +246 -246
- package/dist/assets/{index-CG4AFPb4.js → index-Bk8iAodB.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-Y3ZrY7qL.js → infoDiagram-VRGFBTTK-CQKsYTCL.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-BpOtSfyi.js → ishikawaDiagram-OU5B5YK6-D5catDe0.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-UQM727le.js → journeyDiagram-ZHPQQLJL-KjY8mki9.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-C3s5oHpY.js → kanban-definition-PNTS6WVX-BKCyJtge.js} +1 -1
- package/dist/assets/{linear-hX6nFOQr.js → linear-B-_obUkq.js} +1 -1
- package/dist/assets/{mermaid.core-DZObGLN7.js → mermaid.core-DlSzuDKt.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-Br-i2E3P.js → mindmap-definition-NLK3R4M7-BFQSaYKh.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-D5SERB-N.js → pegDiagram-GJSIUBJH-l51izlev.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-BPNf4J3D.js → pieDiagram-5QR66LMP-6NEXRoZX.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-Bm_Wh7Jr.js → quadrantDiagram-O4NWA36T-BCC9XlOe.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-D6bo0abD.js → railroadDiagram-XR7U4H2S-Dd4TmJ86.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP--1n5rkV7.js → requirementDiagram-PLB6GJNP-C1E5DaDb.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-Ct4tP2kK.js → sankeyDiagram-IPEJSGJF-Ci6r7abb.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-CCG7O5fR.js → sequenceDiagram-PO4LG4MO-BJ-I6WOh.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CJJJra9c.js → sizeCapture-INFHLROL-Cs5QbLOP.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-BMdRvVEX.js → stateDiagram-v2-GCMORJYK-Bw--rdvq.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-B1wnogip.js → swimlanes-2SLR337P-B1O9IEz5.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-C6wGgYKP.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-l-3yhXUP.js → timeline-definition-EJHVYXUP-CTZ7DXaw.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-DtwtCOoJ.js → usecaseDiagram-POWQR4AR-DjwgNG0H.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-BZAEce1B.js → vennDiagram-UO4OBE2U-DrdJG55h.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-Na_BCMMO.js → wardleyDiagram-VNRHLVJA-HVq776nz.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-BW9dlUfE.js → xychartDiagram-PMCCYNJV-DPf9VEua.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/container-mcp.js +1 -1
- package/dist-server/index.js +3585 -3076
- package/dist-server/openmausbot.js +346 -159
- package/dist-server/pair-cli.js +346 -159
- package/dist-server/server/attachment-mimes.js +58 -0
- package/dist-server/server/attachments.js +28 -67
- package/dist-server/server/avatar-image.js +1 -0
- package/dist-server/server/avatar-subscription.js +24 -1
- package/dist-server/server/drivers/claude-message.js +12 -0
- package/dist-server/server/drivers/claude.js +9 -12
- package/dist-server/server/drivers/codex-image.js +141 -0
- package/dist-server/server/drivers/codex.js +6 -9
- package/dist-server/server/drivers/openai-chat.js +13 -2
- package/dist-server/server/engine-failover.js +40 -0
- package/dist-server/server/engine-failure.js +2 -2
- package/dist-server/server/harness-import/history.js +5 -5
- package/dist-server/server/harness-import/test-fixtures.js +1 -1
- package/dist-server/server/index.js +35 -20
- package/dist-server/server/message-reactions.js +11 -0
- package/dist-server/server/model-evidence-context.js +18 -0
- package/dist-server/server/model-evidence.js +145 -0
- package/dist-server/shared/emoji-catalog.json +1 -0
- package/dist-server/shared/emoji.js +27 -0
- package/dist-server/shared/mascot-bodies.js +9 -1
- package/dist-server/shared/model-evidence.js +25 -0
- package/dist-server/vps-container-mcp.js +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-bPN03jIt.js +0 -1
- package/dist/assets/index-CZjRcUdn.css +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DWyjdGGR.js +0 -8
|
@@ -18544,7 +18544,7 @@ var init_mascot_bodies = __esm({
|
|
|
18544
18544
|
"shared/mascot-bodies.ts"() {
|
|
18545
18545
|
"use strict";
|
|
18546
18546
|
init_zod();
|
|
18547
|
-
MASCOT_BODY_IDS = ["cursor", "blob", "circle", "squircle", "capsule", "drop", "shield", "hexagon", "diamond", "star"];
|
|
18547
|
+
MASCOT_BODY_IDS = ["cursor", "blob", "circle", "squircle", "capsule", "drop", "shield", "hexagon", "diamond", "star", "panes"];
|
|
18548
18548
|
mascotBodySchema = external_exports.enum(MASCOT_BODY_IDS);
|
|
18549
18549
|
}
|
|
18550
18550
|
});
|
|
@@ -28785,6 +28785,20 @@ var init_boxagent = __esm({
|
|
|
28785
28785
|
}
|
|
28786
28786
|
});
|
|
28787
28787
|
|
|
28788
|
+
// server/drivers/claude-message.ts
|
|
28789
|
+
function firstText(content) {
|
|
28790
|
+
if (typeof content === "string") return content;
|
|
28791
|
+
if (Array.isArray(content)) {
|
|
28792
|
+
return content.filter((b3) => b3?.type === "text" && b3.text).map((b3) => b3.text).join("");
|
|
28793
|
+
}
|
|
28794
|
+
return "";
|
|
28795
|
+
}
|
|
28796
|
+
var init_claude_message = __esm({
|
|
28797
|
+
"server/drivers/claude-message.ts"() {
|
|
28798
|
+
"use strict";
|
|
28799
|
+
}
|
|
28800
|
+
});
|
|
28801
|
+
|
|
28788
28802
|
// server/claude-account-connectors.ts
|
|
28789
28803
|
function parseClaudeMcpList(output) {
|
|
28790
28804
|
const found = [];
|
|
@@ -29801,13 +29815,6 @@ function decodeConfig2(raw) {
|
|
|
29801
29815
|
...disallowedTools !== void 0 ? { disallowedTools } : {}
|
|
29802
29816
|
};
|
|
29803
29817
|
}
|
|
29804
|
-
function firstText(content) {
|
|
29805
|
-
if (typeof content === "string") return content;
|
|
29806
|
-
if (Array.isArray(content)) {
|
|
29807
|
-
return content.filter((b3) => b3?.type === "text" && b3.text).map((b3) => b3.text).join("");
|
|
29808
|
-
}
|
|
29809
|
-
return "";
|
|
29810
|
-
}
|
|
29811
29818
|
function claudeUserMessage(text4, images) {
|
|
29812
29819
|
if (!images?.length) return { type: "user", message: { role: "user", content: text4 } };
|
|
29813
29820
|
const content = images.map((image) => ({
|
|
@@ -29843,6 +29850,7 @@ var CONNECTOR_CACHE_MS, CLAUDE_ACCOUNT_ENV_KEYS, DEFAULT_AUTOCOMPACT_TOKENS, CLA
|
|
|
29843
29850
|
var init_claude = __esm({
|
|
29844
29851
|
"server/drivers/claude.ts"() {
|
|
29845
29852
|
"use strict";
|
|
29853
|
+
init_claude_message();
|
|
29846
29854
|
init_config();
|
|
29847
29855
|
init_atomic();
|
|
29848
29856
|
init_env_path();
|
|
@@ -30548,7 +30556,7 @@ var init_claude = __esm({
|
|
|
30548
30556
|
if (delivered && delivered.sessionId === session.sessionId) delivered.sessionId = o.session_id;
|
|
30549
30557
|
session.sessionId = o.session_id;
|
|
30550
30558
|
}
|
|
30551
|
-
emit({ ...base3(threadId, currentTurnId()), type: "session.started", sessionId: o.session_id, model: o.model, ...retry.rebuilt ? { rebuilt: true } : {} });
|
|
30559
|
+
emit({ ...base3(threadId, currentTurnId()), type: "session.started", sessionId: o.session_id, model: o.model, modelEvidenceLevel: "session-reported", ...retry.rebuilt ? { rebuilt: true } : {} });
|
|
30552
30560
|
} else if (o.subtype === "compact_boundary") {
|
|
30553
30561
|
deliveredVolatile.delete(threadId);
|
|
30554
30562
|
} else if (o.subtype === "thinking_tokens") {
|
|
@@ -30573,6 +30581,16 @@ var init_claude = __esm({
|
|
|
30573
30581
|
}
|
|
30574
30582
|
case "assistant": {
|
|
30575
30583
|
const msg = o.message ?? {};
|
|
30584
|
+
if (o.is_api_error_message !== true && typeof o.error !== "string") {
|
|
30585
|
+
emit({
|
|
30586
|
+
...base3(threadId, currentTurnId()),
|
|
30587
|
+
type: "model.evidence",
|
|
30588
|
+
callId: typeof msg.id === "string" ? msg.id : newId(),
|
|
30589
|
+
responseId: typeof msg.id === "string" ? msg.id : void 0,
|
|
30590
|
+
model: typeof msg.model === "string" ? msg.model : null,
|
|
30591
|
+
level: typeof msg.model === "string" ? "response-reported" : "unknown"
|
|
30592
|
+
});
|
|
30593
|
+
}
|
|
30576
30594
|
const text4 = firstText(msg.content);
|
|
30577
30595
|
if (claudeAuthFailure(o, text4)) {
|
|
30578
30596
|
if (session.turn) session.turn.authFailed = true;
|
|
@@ -31360,6 +31378,163 @@ var init_codex_personal = __esm({
|
|
|
31360
31378
|
}
|
|
31361
31379
|
});
|
|
31362
31380
|
|
|
31381
|
+
// server/drivers/codex-image.ts
|
|
31382
|
+
import { mkdtemp as mkdtemp3, rm as rm4 } from "node:fs/promises";
|
|
31383
|
+
import { tmpdir as tmpdir4 } from "node:os";
|
|
31384
|
+
import { join as join27 } from "node:path";
|
|
31385
|
+
async function codexImage(cli, env, prompt, signal, diagnostic, model) {
|
|
31386
|
+
signal.throwIfAborted();
|
|
31387
|
+
const cwd = await mkdtemp3(join27(tmpdir4(), "atomic-avatar-"));
|
|
31388
|
+
const args = [
|
|
31389
|
+
"app-server",
|
|
31390
|
+
...codexToolSurfaceArgs(),
|
|
31391
|
+
...codexUserMcpOffArgs(codexConfigMcpServers(env, cwd)),
|
|
31392
|
+
...codexPersonalSetupOffArgs(env, cwd),
|
|
31393
|
+
...["shell_tool", "unified_exec", "view_image", "apps", "multi_agent", "multi_agent_v2", "code_mode"].flatMap((name) => ["-c", `features.${name}=false`]),
|
|
31394
|
+
"-c",
|
|
31395
|
+
"features.image_generation=true",
|
|
31396
|
+
"-c",
|
|
31397
|
+
'web_search="disabled"',
|
|
31398
|
+
"-c",
|
|
31399
|
+
'model_provider="openai"',
|
|
31400
|
+
"-c",
|
|
31401
|
+
'forced_login_method="chatgpt"',
|
|
31402
|
+
"-c",
|
|
31403
|
+
"project_doc_max_bytes=0"
|
|
31404
|
+
];
|
|
31405
|
+
let child;
|
|
31406
|
+
try {
|
|
31407
|
+
child = spawnCli(cli, args, { cwd, env, stdio: ["pipe", "pipe", "pipe"] });
|
|
31408
|
+
} catch {
|
|
31409
|
+
await rm4(cwd, { recursive: true, force: true });
|
|
31410
|
+
throw new Error("Could not start image generation.");
|
|
31411
|
+
}
|
|
31412
|
+
const pending = /* @__PURE__ */ new Map();
|
|
31413
|
+
let nextId = 0, buffer = "", image, done = false;
|
|
31414
|
+
let resolveImage;
|
|
31415
|
+
let rejectImage;
|
|
31416
|
+
const result = new Promise((resolve14, reject) => {
|
|
31417
|
+
resolveImage = resolve14;
|
|
31418
|
+
rejectImage = reject;
|
|
31419
|
+
});
|
|
31420
|
+
void result.catch(() => {
|
|
31421
|
+
});
|
|
31422
|
+
const fail = () => {
|
|
31423
|
+
const error51 = new Error("Codex image generation did not complete.");
|
|
31424
|
+
for (const waiter of pending.values()) waiter.reject(error51);
|
|
31425
|
+
pending.clear();
|
|
31426
|
+
if (!done) rejectImage(error51);
|
|
31427
|
+
done = true;
|
|
31428
|
+
};
|
|
31429
|
+
const send = (message2) => {
|
|
31430
|
+
child.stdin.write(JSON.stringify(message2) + "\n", (error51) => {
|
|
31431
|
+
if (error51) fail();
|
|
31432
|
+
});
|
|
31433
|
+
};
|
|
31434
|
+
const request = (method, params) => new Promise((resolve14, reject) => {
|
|
31435
|
+
if (done) {
|
|
31436
|
+
reject(new Error("Image session ended."));
|
|
31437
|
+
return;
|
|
31438
|
+
}
|
|
31439
|
+
const id = ++nextId;
|
|
31440
|
+
pending.set(id, { resolve: resolve14, reject });
|
|
31441
|
+
send({ id, method, params });
|
|
31442
|
+
});
|
|
31443
|
+
child.on("error", fail);
|
|
31444
|
+
child.on("exit", fail);
|
|
31445
|
+
child.stdin.on("error", fail);
|
|
31446
|
+
child.stderr.resume();
|
|
31447
|
+
child.stdout.setEncoding("utf8");
|
|
31448
|
+
child.stdout.on("data", (chunk) => {
|
|
31449
|
+
buffer += chunk;
|
|
31450
|
+
if (Buffer.byteLength(buffer) > 32 * 1024 * 1024) {
|
|
31451
|
+
fail();
|
|
31452
|
+
return;
|
|
31453
|
+
}
|
|
31454
|
+
for (; ; ) {
|
|
31455
|
+
const newline = buffer.indexOf("\n");
|
|
31456
|
+
if (newline < 0) break;
|
|
31457
|
+
const line = buffer.slice(0, newline);
|
|
31458
|
+
buffer = buffer.slice(newline + 1);
|
|
31459
|
+
try {
|
|
31460
|
+
const message2 = JSON.parse(line);
|
|
31461
|
+
if (message2.method === "item/completed" || message2.method === "turn/completed") diagnostic?.({
|
|
31462
|
+
method: message2.method,
|
|
31463
|
+
itemType: message2.params?.item?.type,
|
|
31464
|
+
status: message2.params?.turn?.status ?? message2.params?.item?.status,
|
|
31465
|
+
imageBytes: message2.params?.item?.type === "imageGeneration" ? message2.params.item.result?.length ?? 0 : void 0,
|
|
31466
|
+
errorTerms: message2.params?.turn?.error?.message?.match(/\b(?:usage|limit|quota|expired|auth|model|configuration|tools?|sandbox|rate|429|401|403|400|unsupported|invalid|image_generation|reasoning|summary|does not exist|not supported|not available|gpt-[\w.-]+)\b/gi) ?? void 0
|
|
31467
|
+
});
|
|
31468
|
+
if (message2.method && message2.id !== void 0) {
|
|
31469
|
+
send({ id: message2.id, error: { code: -32601, message: "Not available in avatar generation." } });
|
|
31470
|
+
fail();
|
|
31471
|
+
return;
|
|
31472
|
+
}
|
|
31473
|
+
if (message2.id !== void 0) {
|
|
31474
|
+
const waiter = pending.get(message2.id);
|
|
31475
|
+
pending.delete(message2.id);
|
|
31476
|
+
if (message2.error) waiter?.reject(new Error("Codex image request failed."));
|
|
31477
|
+
else waiter?.resolve(message2.result);
|
|
31478
|
+
} else if (message2.method === "item/completed" && message2.params?.item?.type === "imageGeneration") {
|
|
31479
|
+
const item = message2.params.item;
|
|
31480
|
+
if (item.status !== "failed" && typeof item.result === "string") image = item.result;
|
|
31481
|
+
} else if (message2.method === "turn/completed") {
|
|
31482
|
+
if (message2.params?.turn?.status !== "completed" || !image) {
|
|
31483
|
+
fail();
|
|
31484
|
+
return;
|
|
31485
|
+
}
|
|
31486
|
+
done = true;
|
|
31487
|
+
resolveImage(image);
|
|
31488
|
+
}
|
|
31489
|
+
} catch {
|
|
31490
|
+
fail();
|
|
31491
|
+
return;
|
|
31492
|
+
}
|
|
31493
|
+
}
|
|
31494
|
+
});
|
|
31495
|
+
signal.addEventListener("abort", fail, { once: true });
|
|
31496
|
+
try {
|
|
31497
|
+
if (signal.aborted) fail();
|
|
31498
|
+
await request("initialize", { clientInfo: { name: "atomic_avatar", version: "1" }, capabilities: { experimentalApi: true } });
|
|
31499
|
+
send({ method: "initialized", params: {} });
|
|
31500
|
+
const catalog2 = await request("model/list", { limit: 100 });
|
|
31501
|
+
const choices = Array.isArray(catalog2.data) ? catalog2.data.filter((item) => item && item.hidden !== true && (typeof item.model === "string" || typeof item.id === "string")) : [];
|
|
31502
|
+
const choice = choices.find((item) => item.id === model || item.model === model) ?? choices.find((item) => item.isDefault) ?? choices[0];
|
|
31503
|
+
if (!choice) throw new Error("No subscription image model is available.");
|
|
31504
|
+
const started = await request("thread/start", {
|
|
31505
|
+
cwd,
|
|
31506
|
+
model: choice.model ?? choice.id,
|
|
31507
|
+
modelProvider: "openai",
|
|
31508
|
+
ephemeral: true,
|
|
31509
|
+
approvalPolicy: "never",
|
|
31510
|
+
sandbox: "read-only",
|
|
31511
|
+
developerInstructions: "Generate exactly one image with the native image generation tool. Do not run commands, read files, use other tools or ask for credentials."
|
|
31512
|
+
});
|
|
31513
|
+
if (typeof started.thread?.id !== "string") throw new Error("Missing image session.");
|
|
31514
|
+
await request("turn/start", {
|
|
31515
|
+
threadId: started.thread.id,
|
|
31516
|
+
input: [{ type: "text", text: prompt }],
|
|
31517
|
+
approvalPolicy: "never",
|
|
31518
|
+
sandboxPolicy: { type: "readOnly" }
|
|
31519
|
+
});
|
|
31520
|
+
return await result;
|
|
31521
|
+
} finally {
|
|
31522
|
+
signal.removeEventListener("abort", fail);
|
|
31523
|
+
fail();
|
|
31524
|
+
const stopped = await killCliTree(child);
|
|
31525
|
+
if (stopped) await rm4(cwd, { recursive: true, force: true });
|
|
31526
|
+
}
|
|
31527
|
+
}
|
|
31528
|
+
var init_codex_image = __esm({
|
|
31529
|
+
"server/drivers/codex-image.ts"() {
|
|
31530
|
+
"use strict";
|
|
31531
|
+
init_procs();
|
|
31532
|
+
init_codex_mcp_names();
|
|
31533
|
+
init_codex_personal();
|
|
31534
|
+
init_codex_tool_surface();
|
|
31535
|
+
}
|
|
31536
|
+
});
|
|
31537
|
+
|
|
31363
31538
|
// server/mcp-remote-bridge.ts
|
|
31364
31539
|
var init_mcp_remote_bridge = __esm({
|
|
31365
31540
|
"server/mcp-remote-bridge.ts"() {
|
|
@@ -31400,7 +31575,7 @@ var init_mcp_tool_hints = __esm({
|
|
|
31400
31575
|
// server/drivers/codex-catalog.ts
|
|
31401
31576
|
import { readdirSync as readdirSync5, readFileSync as readFileSync12 } from "node:fs";
|
|
31402
31577
|
import { homedir as homedir12 } from "node:os";
|
|
31403
|
-
import { basename as basename7, join as
|
|
31578
|
+
import { basename as basename7, join as join28 } from "node:path";
|
|
31404
31579
|
function encodeCodexSelection(provider, model) {
|
|
31405
31580
|
return `${provider}${SEP}${model}`;
|
|
31406
31581
|
}
|
|
@@ -31516,7 +31691,7 @@ function readCodexAppServerModelCatalog(cli, env, timeoutMs = 8e3) {
|
|
|
31516
31691
|
}
|
|
31517
31692
|
function codexHome(env) {
|
|
31518
31693
|
if (env.CODEX_HOME) return env.CODEX_HOME;
|
|
31519
|
-
return
|
|
31694
|
+
return join28(env.HOME || env.USERPROFILE || homedir12(), ".codex");
|
|
31520
31695
|
}
|
|
31521
31696
|
function unquote(raw) {
|
|
31522
31697
|
let value = raw.trim();
|
|
@@ -31602,11 +31777,11 @@ function niceLabel(model, provider, known, named) {
|
|
|
31602
31777
|
}
|
|
31603
31778
|
function collectCatalogNames(home) {
|
|
31604
31779
|
const named = /* @__PURE__ */ new Map();
|
|
31605
|
-
for (const file2 of listDir(
|
|
31780
|
+
for (const file2 of listDir(join28(home, "model-catalogs"))) {
|
|
31606
31781
|
if (!file2.endsWith(".json")) continue;
|
|
31607
31782
|
const provider = basename7(file2, ".json").replace(/-models$/, "");
|
|
31608
31783
|
if (!PROVIDER_ID.test(provider)) continue;
|
|
31609
|
-
const raw = readText(
|
|
31784
|
+
const raw = readText(join28(home, "model-catalogs", file2));
|
|
31610
31785
|
if (!raw) continue;
|
|
31611
31786
|
let parsed;
|
|
31612
31787
|
try {
|
|
@@ -31658,7 +31833,7 @@ async function probeProviderModels(provider, env, fetchImpl) {
|
|
|
31658
31833
|
async function readCodexModelCatalog(env = process.env, fetchImpl = fetch, cli) {
|
|
31659
31834
|
const official = (cli ? await readCodexAppServerModelCatalog(cli, env) : null) ?? STATIC_CODEX_MODELS;
|
|
31660
31835
|
const home = codexHome(env);
|
|
31661
|
-
const mainText = readText(
|
|
31836
|
+
const mainText = readText(join28(home, "config.toml"));
|
|
31662
31837
|
if (!mainText) return mergeLocalInject(official, env, fetchImpl);
|
|
31663
31838
|
const main2 = parseCodexToml(mainText);
|
|
31664
31839
|
const known = new Map(main2.providers.map((provider) => [provider.id, provider]));
|
|
@@ -31673,7 +31848,7 @@ async function readCodexModelCatalog(env = process.env, fetchImpl = fetch, cli)
|
|
|
31673
31848
|
remember(main2.modelProvider, main2.model);
|
|
31674
31849
|
for (const file2 of listDir(home)) {
|
|
31675
31850
|
if (!file2.endsWith(".config.toml")) continue;
|
|
31676
|
-
const profile = parseCodexToml(readText(
|
|
31851
|
+
const profile = parseCodexToml(readText(join28(home, file2)) ?? "");
|
|
31677
31852
|
for (const provider of profile.providers) {
|
|
31678
31853
|
if (!known.has(provider.id)) known.set(provider.id, provider);
|
|
31679
31854
|
}
|
|
@@ -31740,7 +31915,7 @@ var init_codex_catalog = __esm({
|
|
|
31740
31915
|
// server/drivers/codex-instructions.ts
|
|
31741
31916
|
import { createHash as createHash8 } from "node:crypto";
|
|
31742
31917
|
import { mkdirSync as mkdirSync13, readFileSync as readFileSync13 } from "node:fs";
|
|
31743
|
-
import { join as
|
|
31918
|
+
import { join as join29 } from "node:path";
|
|
31744
31919
|
function codexDeveloperInstructions(config2, botInstructions) {
|
|
31745
31920
|
if (!config2 || typeof config2 !== "object" || Array.isArray(config2)) {
|
|
31746
31921
|
throw new Error("Codex returned no effective configuration; cannot safely update bot instructions.");
|
|
@@ -31754,8 +31929,8 @@ function codexDeveloperInstructions(config2, botInstructions) {
|
|
|
31754
31929
|
${configured}` : botInstructions;
|
|
31755
31930
|
}
|
|
31756
31931
|
async function syncCodexInstructions(key, nativeThreadId, instructions, resumed, request) {
|
|
31757
|
-
const directory =
|
|
31758
|
-
const path4 =
|
|
31932
|
+
const directory = join29(DATA_DIR, "codex-instructions");
|
|
31933
|
+
const path4 = join29(directory, `${digest(JSON.stringify([key, nativeThreadId]))}.sha256`);
|
|
31759
31934
|
const fingerprint2 = digest(instructions);
|
|
31760
31935
|
let previous;
|
|
31761
31936
|
try {
|
|
@@ -31802,14 +31977,14 @@ var init_codex_instructions = __esm({
|
|
|
31802
31977
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
31803
31978
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
31804
31979
|
import { homedir as homedir13 } from "node:os";
|
|
31805
|
-
import { basename as basename8, dirname as dirname10, isAbsolute as isAbsolute6, join as
|
|
31980
|
+
import { basename as basename8, dirname as dirname10, isAbsolute as isAbsolute6, join as join30, resolve as resolve9 } from "node:path";
|
|
31806
31981
|
import { stripVTControlCharacters as stripVTControlCharacters6 } from "node:util";
|
|
31807
31982
|
function canonicalPath2(path4) {
|
|
31808
31983
|
try {
|
|
31809
31984
|
return realpathSync2(path4);
|
|
31810
31985
|
} catch {
|
|
31811
31986
|
const parent = dirname10(path4);
|
|
31812
|
-
return parent === path4 ? path4 :
|
|
31987
|
+
return parent === path4 ? path4 : join30(canonicalPath2(parent), basename8(path4));
|
|
31813
31988
|
}
|
|
31814
31989
|
}
|
|
31815
31990
|
function codexDevicePrompt(output) {
|
|
@@ -31860,7 +32035,7 @@ var init_codex_device_auth = __esm({
|
|
|
31860
32035
|
if (!isAbsolute6(home) || env.CODEX_HOME && !isAbsolute6(env.CODEX_HOME)) {
|
|
31861
32036
|
throw new Error("Use an absolute HOME and CODEX_HOME path for this server's Codex provider before signing in.");
|
|
31862
32037
|
}
|
|
31863
|
-
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME ||
|
|
32038
|
+
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME || join30(home, ".codex")));
|
|
31864
32039
|
if (authenticatingHomes2.has(homeKey)) {
|
|
31865
32040
|
throw new Error("A ChatGPT sign-in is already running for this server account. Finish or cancel it before starting another.");
|
|
31866
32041
|
}
|
|
@@ -31939,7 +32114,7 @@ var init_codex_device_auth = __esm({
|
|
|
31939
32114
|
if (!isAbsolute6(home) || env.CODEX_HOME && !isAbsolute6(env.CODEX_HOME)) {
|
|
31940
32115
|
throw new Error("Use an absolute HOME and CODEX_HOME path for this server's Codex provider before signing out.");
|
|
31941
32116
|
}
|
|
31942
|
-
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME ||
|
|
32117
|
+
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME || join30(home, ".codex")));
|
|
31943
32118
|
if (authenticatingHomes2.has(homeKey)) {
|
|
31944
32119
|
throw new Error("A ChatGPT sign-in is running for this server account. Finish or cancel it before signing out.");
|
|
31945
32120
|
}
|
|
@@ -32098,11 +32273,11 @@ var init_codex_device_auth = __esm({
|
|
|
32098
32273
|
|
|
32099
32274
|
// server/drivers/codex-identity.ts
|
|
32100
32275
|
import { homedir as homedir14 } from "node:os";
|
|
32101
|
-
import { isAbsolute as isAbsolute7, join as
|
|
32276
|
+
import { isAbsolute as isAbsolute7, join as join31, resolve as resolve10 } from "node:path";
|
|
32102
32277
|
function codexHome2(env) {
|
|
32103
32278
|
if (env.CODEX_HOME) return isAbsolute7(env.CODEX_HOME) ? resolve10(env.CODEX_HOME) : null;
|
|
32104
32279
|
const home = env.HOME || env.USERPROFILE || homedir14();
|
|
32105
|
-
return isAbsolute7(home) ?
|
|
32280
|
+
return isAbsolute7(home) ? join31(home, ".codex") : null;
|
|
32106
32281
|
}
|
|
32107
32282
|
async function codexAccountEmail(cli, env, timeoutMs = 3e3) {
|
|
32108
32283
|
const cwd = env.HOME || env.USERPROFILE || homedir14();
|
|
@@ -32564,6 +32739,7 @@ var init_codex = __esm({
|
|
|
32564
32739
|
"server/drivers/codex.ts"() {
|
|
32565
32740
|
"use strict";
|
|
32566
32741
|
init_codex_tool_surface();
|
|
32742
|
+
init_codex_image();
|
|
32567
32743
|
init_codex_personal();
|
|
32568
32744
|
init_codex_mcp_names();
|
|
32569
32745
|
init_config();
|
|
@@ -33345,7 +33521,7 @@ var init_codex = __esm({
|
|
|
33345
33521
|
}
|
|
33346
33522
|
if (!codexThreadId) throw new Error("Codex did not return a native thread id");
|
|
33347
33523
|
await syncCodexInstructions(threadId, codexThreadId, developerInstructions, resumedNativeThread, request);
|
|
33348
|
-
emit({ ...base3(threadId, turnId), type: "session.started", sessionId: codexThreadId, model: startedModel ?? turn.model ?? null, ...rebuiltFromReplay ? { rebuilt: true } : {} });
|
|
33524
|
+
emit({ ...base3(threadId, turnId), type: "session.started", sessionId: codexThreadId, model: startedModel ?? turn.model ?? null, modelEvidenceLevel: startedModel ? "session-reported" : "requested-only", ...rebuiltFromReplay ? { rebuilt: true } : {} });
|
|
33349
33525
|
const note = turn.systemStable !== void 0 ? volatileNoteFor(threadId, codexThreadId, !resumedNativeThread || rebuiltFromReplay, turn) : "";
|
|
33350
33526
|
const inputText = withNote(promptText, note);
|
|
33351
33527
|
const turnInput = [
|
|
@@ -33467,6 +33643,7 @@ ${status.stderr}`)) {
|
|
|
33467
33643
|
cancelAuthentication: () => authentication.cancel(),
|
|
33468
33644
|
signOut: () => authentication.signOut(),
|
|
33469
33645
|
snapshot,
|
|
33646
|
+
...!config2.managed ? { generateImage: (prompt, options) => codexImage(config2.cli, childEnv(), prompt, options.signal, void 0, decodeCodexSelection(models2.default).model ?? void 0) } : {},
|
|
33470
33647
|
adapter: {
|
|
33471
33648
|
provider: DRIVER_KIND3,
|
|
33472
33649
|
capabilities: {
|
|
@@ -41572,7 +41749,7 @@ import {
|
|
|
41572
41749
|
unlinkSync as unlinkSync4,
|
|
41573
41750
|
writeFileSync as writeFileSync9
|
|
41574
41751
|
} from "node:fs";
|
|
41575
|
-
import { dirname as dirname11, join as
|
|
41752
|
+
import { dirname as dirname11, join as join32 } from "node:path";
|
|
41576
41753
|
function hasCode(error51, code) {
|
|
41577
41754
|
return error51 instanceof Error && "code" in error51 && error51.code === code;
|
|
41578
41755
|
}
|
|
@@ -41593,13 +41770,13 @@ function readEnvironmentId(file2) {
|
|
|
41593
41770
|
return id;
|
|
41594
41771
|
}
|
|
41595
41772
|
function loadEnvironmentId(dataDir) {
|
|
41596
|
-
const file2 =
|
|
41773
|
+
const file2 = join32(dataDir, "environment-id");
|
|
41597
41774
|
const existing = readEnvironmentId(file2);
|
|
41598
41775
|
if (existing) return existing;
|
|
41599
41776
|
const directory = dirname11(file2);
|
|
41600
41777
|
mkdirSync14(directory, { recursive: true, mode: 448 });
|
|
41601
41778
|
const id = randomUUID10();
|
|
41602
|
-
const temporaryFile =
|
|
41779
|
+
const temporaryFile = join32(directory, `.environment-id.${process.pid}.${randomUUID10()}.tmp`);
|
|
41603
41780
|
let descriptor;
|
|
41604
41781
|
try {
|
|
41605
41782
|
descriptor = openSync5(temporaryFile, "wx", 384);
|
|
@@ -41636,7 +41813,7 @@ var init_environment = __esm({
|
|
|
41636
41813
|
// server/box-create-idempotency.ts
|
|
41637
41814
|
import { createHash as createHash9, randomUUID as randomUUID11 } from "node:crypto";
|
|
41638
41815
|
import { linkSync as linkSync3, mkdirSync as mkdirSync15, readFileSync as readFileSync16, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "node:fs";
|
|
41639
|
-
import { join as
|
|
41816
|
+
import { join as join33 } from "node:path";
|
|
41640
41817
|
function isRequest(value) {
|
|
41641
41818
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
41642
41819
|
const request = value;
|
|
@@ -41895,8 +42072,8 @@ var init_box_create_idempotency = __esm({
|
|
|
41895
42072
|
"use strict";
|
|
41896
42073
|
init_atomic();
|
|
41897
42074
|
init_config();
|
|
41898
|
-
FILE =
|
|
41899
|
-
LOCK_FILE =
|
|
42075
|
+
FILE = join33(DATA_DIR, "box-create-requests.json");
|
|
42076
|
+
LOCK_FILE = join33(DATA_DIR, "box-create-requests.lock");
|
|
41900
42077
|
KEY_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
41901
42078
|
MAX_REQUESTS = 4096;
|
|
41902
42079
|
LOCK_WAIT_MS = 2e3;
|
|
@@ -41912,7 +42089,7 @@ var init_box_create_idempotency = __esm({
|
|
|
41912
42089
|
// server/box-delete-journal.ts
|
|
41913
42090
|
import { createHash as createHash10, randomUUID as randomUUID12 } from "node:crypto";
|
|
41914
42091
|
import { linkSync as linkSync4, mkdirSync as mkdirSync16, readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
41915
|
-
import { join as
|
|
42092
|
+
import { join as join34 } from "node:path";
|
|
41916
42093
|
function validTimestamp(value) {
|
|
41917
42094
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
41918
42095
|
}
|
|
@@ -42160,8 +42337,8 @@ var init_box_delete_journal = __esm({
|
|
|
42160
42337
|
"use strict";
|
|
42161
42338
|
init_atomic();
|
|
42162
42339
|
init_config();
|
|
42163
|
-
FILE2 =
|
|
42164
|
-
LOCK_FILE2 =
|
|
42340
|
+
FILE2 = join34(DATA_DIR, "box-delete-requests.json");
|
|
42341
|
+
LOCK_FILE2 = join34(DATA_DIR, "box-delete-requests.lock");
|
|
42165
42342
|
MAX_RECORDS = 4096;
|
|
42166
42343
|
LOCK_WAIT_MS2 = 2e3;
|
|
42167
42344
|
LOCK_RETRY_MS2 = 20;
|
|
@@ -43152,7 +43329,7 @@ function createOpenAIChatRuntime(options) {
|
|
|
43152
43329
|
turnId,
|
|
43153
43330
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
43154
43331
|
});
|
|
43155
|
-
const complete = async (messages, model, stream, signal, onDelta, tools = []) => {
|
|
43332
|
+
const complete = async (messages, model, stream, signal, onDelta, tools = [], onIdentity) => {
|
|
43156
43333
|
const timeoutController = new AbortController();
|
|
43157
43334
|
let idleTimer = null;
|
|
43158
43335
|
const resetIdleTimer = () => {
|
|
@@ -43182,6 +43359,7 @@ function createOpenAIChatRuntime(options) {
|
|
|
43182
43359
|
const json2 = await response.json();
|
|
43183
43360
|
const bodyError = providerError(json2);
|
|
43184
43361
|
if (bodyError) throw new ChatProtocolError(`provider returned a completion error: ${bodyError.slice(0, 200)}`);
|
|
43362
|
+
onIdentity?.(typeof json2.model === "string" ? json2.model : null, typeof json2.id === "string" ? json2.id : void 0);
|
|
43185
43363
|
const message2 = json2.choices?.[0]?.message;
|
|
43186
43364
|
if (!message2 || !object3(message2) || !["content", "reasoning_content", "reasoning", "reasoning_details", "tool_calls", "function_call"].some((key) => key in message2)) {
|
|
43187
43365
|
throw new ChatProtocolError("provider returned no completion message");
|
|
@@ -43232,6 +43410,7 @@ function createOpenAIChatRuntime(options) {
|
|
|
43232
43410
|
}
|
|
43233
43411
|
const chunkError = providerError(chunk);
|
|
43234
43412
|
if (chunkError) throw new ChatProtocolError(`provider returned a streaming completion error: ${chunkError.slice(0, 200)}`);
|
|
43413
|
+
onIdentity?.(typeof chunk.model === "string" ? chunk.model : null, typeof chunk.id === "string" ? chunk.id : void 0);
|
|
43235
43414
|
const choice = chunk.choices?.find((row) => row.index === void 0 || row.index === 0);
|
|
43236
43415
|
const delta = choice?.delta;
|
|
43237
43416
|
if (object3(delta)) sawChoice = true;
|
|
@@ -43398,10 +43577,18 @@ function createOpenAIChatRuntime(options) {
|
|
|
43398
43577
|
if (visible) emit({ ...base3(turn.threadId, turnId), type: "content.delta", streamKind, delta: visible });
|
|
43399
43578
|
};
|
|
43400
43579
|
try {
|
|
43580
|
+
const callId = newId();
|
|
43581
|
+
emit({ ...base3(turn.threadId, turnId), type: "model.call", callId });
|
|
43582
|
+
let previousIdentity = "";
|
|
43401
43583
|
completion = await complete(messages, model, true, abort.signal, (text4, streamKind) => {
|
|
43402
43584
|
streamed = true;
|
|
43403
43585
|
delta(text4, streamKind);
|
|
43404
|
-
}, tools.definitions)
|
|
43586
|
+
}, tools.definitions, (reportedModel, responseId) => {
|
|
43587
|
+
const identity = JSON.stringify([reportedModel, responseId]);
|
|
43588
|
+
if (identity === previousIdentity) return;
|
|
43589
|
+
previousIdentity = identity;
|
|
43590
|
+
emit({ ...base3(turn.threadId, turnId), type: "model.evidence", callId, model: reportedModel, responseId, level: reportedModel ? "response-reported" : "unknown" });
|
|
43591
|
+
});
|
|
43405
43592
|
delta("", "assistant_text", true);
|
|
43406
43593
|
delta("", "reasoning_text", true);
|
|
43407
43594
|
break;
|
|
@@ -43685,7 +43872,7 @@ var init_grok = __esm({
|
|
|
43685
43872
|
// server/drivers/acp/grok.ts
|
|
43686
43873
|
import { existsSync as existsSync16, readFileSync as readFileSync18, writeFileSync as writeFileSync12 } from "node:fs";
|
|
43687
43874
|
import { homedir as homedir16 } from "node:os";
|
|
43688
|
-
import { join as
|
|
43875
|
+
import { join as join35 } from "node:path";
|
|
43689
43876
|
function decodeGrokModelText(text4) {
|
|
43690
43877
|
if (/\bnot authenticated\b/i.test(text4)) return null;
|
|
43691
43878
|
const options = [];
|
|
@@ -43719,7 +43906,7 @@ function fetchGrokModels(cli, env, run2 = execCli) {
|
|
|
43719
43906
|
}
|
|
43720
43907
|
function grokHome(env) {
|
|
43721
43908
|
if (env.GROK_HOME) return env.GROK_HOME;
|
|
43722
|
-
return
|
|
43909
|
+
return join35(env.HOME || env.USERPROFILE || homedir16(), ".grok");
|
|
43723
43910
|
}
|
|
43724
43911
|
function unquote2(raw) {
|
|
43725
43912
|
const value = raw.trim();
|
|
@@ -43729,7 +43916,7 @@ function unquote2(raw) {
|
|
|
43729
43916
|
return value;
|
|
43730
43917
|
}
|
|
43731
43918
|
function readGrokModelCatalog(env = process.env, base3 = STATIC_GROK_MODELS) {
|
|
43732
|
-
const path4 =
|
|
43919
|
+
const path4 = join35(grokHome(env), "config.toml");
|
|
43733
43920
|
let text4 = "";
|
|
43734
43921
|
try {
|
|
43735
43922
|
text4 = readFileSync18(path4, "utf8");
|
|
@@ -43808,7 +43995,7 @@ function ensureGrokInjectSlug(modelId, env = process.env) {
|
|
|
43808
43995
|
if (!inject) return modelId;
|
|
43809
43996
|
const host = localHost(inject.host);
|
|
43810
43997
|
if (!host) return modelId;
|
|
43811
|
-
const path4 =
|
|
43998
|
+
const path4 = join35(grokHome(env), "config.toml");
|
|
43812
43999
|
let text4 = "";
|
|
43813
44000
|
try {
|
|
43814
44001
|
text4 = readFileSync18(path4, "utf8");
|
|
@@ -43964,7 +44151,7 @@ var init_grok2 = __esm({
|
|
|
43964
44151
|
pickAuthMethod: (methods) => methods.some((m3) => m3.id === "cached_token") ? "cached_token" : null,
|
|
43965
44152
|
authFailure: "fail",
|
|
43966
44153
|
classifyError: classifyGrokError,
|
|
43967
|
-
isAuthenticated: (env) => existsSync16(env.GROK_HOME ?
|
|
44154
|
+
isAuthenticated: (env) => existsSync16(env.GROK_HOME ? join35(env.GROK_HOME, "auth.json") : join35(homedir16(), ".grok", "auth.json")),
|
|
43968
44155
|
// `--append-system-prompt`/`--rules` are accepted by the CLI but do NOT
|
|
43969
44156
|
// reach the agent-stdio system prompt (verified against 1.0.0), so the
|
|
43970
44157
|
// persona is prepended codex-style.
|
|
@@ -43979,10 +44166,10 @@ ${turn.text}` : turn.text
|
|
|
43979
44166
|
// server/drivers/acp/gemini.ts
|
|
43980
44167
|
import { existsSync as existsSync17, readFileSync as readFileSync19 } from "node:fs";
|
|
43981
44168
|
import { homedir as homedir17 } from "node:os";
|
|
43982
|
-
import { join as
|
|
44169
|
+
import { join as join36 } from "node:path";
|
|
43983
44170
|
function liveOauthCredential() {
|
|
43984
44171
|
try {
|
|
43985
|
-
const creds = JSON.parse(readFileSync19(
|
|
44172
|
+
const creds = JSON.parse(readFileSync19(join36(homedir17(), ".gemini", "oauth_creds.json"), "utf8"));
|
|
43986
44173
|
if (typeof creds.access_token !== "string" || creds.access_token.trim().length === 0) return false;
|
|
43987
44174
|
const hasRefresh = typeof creds.refresh_token === "string" && creds.refresh_token.trim().length > 0;
|
|
43988
44175
|
if (creds.expiry_date !== void 0) {
|
|
@@ -43995,7 +44182,7 @@ function liveOauthCredential() {
|
|
|
43995
44182
|
}
|
|
43996
44183
|
}
|
|
43997
44184
|
function geminiIsAuthenticated(env) {
|
|
43998
|
-
return nonBlank(env.GEMINI_API_KEY) || nonBlank(env.GOOGLE_API_KEY) || existsSync17(
|
|
44185
|
+
return nonBlank(env.GEMINI_API_KEY) || nonBlank(env.GOOGLE_API_KEY) || existsSync17(join36(homedir17(), ".gemini", "oauth_creds.json")) && liveOauthCredential();
|
|
43999
44186
|
}
|
|
44000
44187
|
function geminiApprovalArgs(fullAuto, approvalMode) {
|
|
44001
44188
|
if (fullAuto) return ["--yolo"];
|
|
@@ -44044,15 +44231,15 @@ ${turn.text}` : turn.text
|
|
|
44044
44231
|
// server/drivers/acp/kimi.ts
|
|
44045
44232
|
import { existsSync as existsSync18, mkdirSync as mkdirSync17, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "node:fs";
|
|
44046
44233
|
import { homedir as homedir18 } from "node:os";
|
|
44047
|
-
import { join as
|
|
44234
|
+
import { join as join37 } from "node:path";
|
|
44048
44235
|
function isLocalInjectAlias(slug) {
|
|
44049
44236
|
return LOCAL_PROVIDER_PREFIXES.some((prefix) => slug.startsWith(prefix));
|
|
44050
44237
|
}
|
|
44051
44238
|
function kimiDataRoot(env) {
|
|
44052
|
-
return env.KIMI_CODE_HOME ||
|
|
44239
|
+
return env.KIMI_CODE_HOME || join37(env.HOME || env.USERPROFILE || homedir18(), ".kimi-code");
|
|
44053
44240
|
}
|
|
44054
44241
|
function credentialsPath(env) {
|
|
44055
|
-
return
|
|
44242
|
+
return join37(kimiDataRoot(env), "credentials", "kimi-code.json");
|
|
44056
44243
|
}
|
|
44057
44244
|
function quoteToml2(value) {
|
|
44058
44245
|
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
@@ -44340,7 +44527,7 @@ function ensureKimiInjectAlias(modelId, env = process.env) {
|
|
|
44340
44527
|
const alias = `${inject.host}/${inject.model.replace(/\//g, "-")}`;
|
|
44341
44528
|
const dataRoot = kimiDataRoot(env);
|
|
44342
44529
|
mkdirSync17(dataRoot, { recursive: true });
|
|
44343
|
-
const path4 =
|
|
44530
|
+
const path4 = join37(dataRoot, "config.toml");
|
|
44344
44531
|
let text4 = "";
|
|
44345
44532
|
try {
|
|
44346
44533
|
text4 = readFileSync20(path4, "utf8");
|
|
@@ -44405,7 +44592,7 @@ function readKimiModelCatalog(env) {
|
|
|
44405
44592
|
const dataRoot = kimiDataRoot(env);
|
|
44406
44593
|
let text4 = "";
|
|
44407
44594
|
try {
|
|
44408
|
-
text4 = readFileSync20(
|
|
44595
|
+
text4 = readFileSync20(join37(dataRoot, "config.toml"), "utf8");
|
|
44409
44596
|
} catch {
|
|
44410
44597
|
return STATIC_KIMI_MODELS;
|
|
44411
44598
|
}
|
|
@@ -44554,10 +44741,10 @@ ${turn.text}` : turn.text
|
|
|
44554
44741
|
// server/drivers/acp/droid.ts
|
|
44555
44742
|
import { existsSync as existsSync19, mkdirSync as mkdirSync18, readFileSync as readFileSync21, writeFileSync as writeFileSync14 } from "node:fs";
|
|
44556
44743
|
import { homedir as homedir19 } from "node:os";
|
|
44557
|
-
import { join as
|
|
44744
|
+
import { join as join38 } from "node:path";
|
|
44558
44745
|
function authFilePaths(env) {
|
|
44559
44746
|
const home = env.FACTORY_HOME_OVERRIDE || env.HOME || homedir19();
|
|
44560
|
-
return AUTH_FILES.map((name) =>
|
|
44747
|
+
return AUTH_FILES.map((name) => join38(home, ".factory", name));
|
|
44561
44748
|
}
|
|
44562
44749
|
function droidInjectId(host, model) {
|
|
44563
44750
|
const safe = `${host}-${model}`.replace(/[^a-zA-Z0-9._+-]+/g, "-").replace(/-+/g, "-");
|
|
@@ -44572,9 +44759,9 @@ function ensureDroidInjectModel(modelId, env = process.env) {
|
|
|
44572
44759
|
const host = localHost(inject.host);
|
|
44573
44760
|
if (!host) return modelId;
|
|
44574
44761
|
const id = droidInjectId(inject.host, inject.model);
|
|
44575
|
-
const dir =
|
|
44762
|
+
const dir = join38(factoryHome(env), ".factory");
|
|
44576
44763
|
mkdirSync18(dir, { recursive: true });
|
|
44577
|
-
const path4 =
|
|
44764
|
+
const path4 = join38(dir, "settings.json");
|
|
44578
44765
|
let settings2 = {};
|
|
44579
44766
|
try {
|
|
44580
44767
|
settings2 = JSON.parse(readFileSync21(path4, "utf8"));
|
|
@@ -44614,7 +44801,7 @@ function applyDroidLocalAuthEnv(env, modelId) {
|
|
|
44614
44801
|
env.FACTORY_API_KEY = "openmausbot-local";
|
|
44615
44802
|
}
|
|
44616
44803
|
function readSettings(env) {
|
|
44617
|
-
return JSON.parse(readFileSync21(
|
|
44804
|
+
return JSON.parse(readFileSync21(join38(factoryHome(env), ".factory", "settings.json"), "utf8"));
|
|
44618
44805
|
}
|
|
44619
44806
|
async function resolveModels(env) {
|
|
44620
44807
|
let catalog2 = MODELS3;
|
|
@@ -46502,12 +46689,12 @@ var init_muse_code_login = __esm({
|
|
|
46502
46689
|
// server/drivers/muse-code.ts
|
|
46503
46690
|
import { existsSync as existsSync20, mkdtempSync as mkdtempSync4, readFileSync as readFileSync22, rmSync as rmSync8, statSync as statSync5 } from "node:fs";
|
|
46504
46691
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
46505
|
-
import { homedir as homedir20, tmpdir as
|
|
46506
|
-
import { join as
|
|
46692
|
+
import { homedir as homedir20, tmpdir as tmpdir5 } from "node:os";
|
|
46693
|
+
import { join as join39 } from "node:path";
|
|
46507
46694
|
function museCredentialPath(env, platform = process.platform) {
|
|
46508
46695
|
if (env.MUSE_AUTH_PATH?.trim()) return env.MUSE_AUTH_PATH.trim();
|
|
46509
46696
|
const home = (platform === "win32" ? env.USERPROFILE || env.HOME : env.HOME) || homedir20();
|
|
46510
|
-
return
|
|
46697
|
+
return join39(env.XDG_CONFIG_HOME?.trim() || join39(home, ".config"), "muse", "auth.json");
|
|
46511
46698
|
}
|
|
46512
46699
|
function museCredential(path4) {
|
|
46513
46700
|
let raw;
|
|
@@ -46769,7 +46956,7 @@ var init_muse_code = __esm({
|
|
|
46769
46956
|
lastRefresh = Date.now();
|
|
46770
46957
|
});
|
|
46771
46958
|
const listModels = async () => {
|
|
46772
|
-
const cwd = mkdtempSync4(
|
|
46959
|
+
const cwd = mkdtempSync4(join39(tmpdir5(), "atomic-muse-models-"));
|
|
46773
46960
|
let host;
|
|
46774
46961
|
try {
|
|
46775
46962
|
host = await startHost(["serve", "--disable-shell", "--disable-write", "--no-session-log", "--contributor-mode", "off"], cwd, "models", false);
|
|
@@ -47267,7 +47454,7 @@ ${body}` : body;
|
|
|
47267
47454
|
// server/drivers/acp/opencode-go.ts
|
|
47268
47455
|
import { existsSync as existsSync21, mkdirSync as mkdirSync19, readFileSync as readFileSync23, writeFileSync as writeFileSync15 } from "node:fs";
|
|
47269
47456
|
import { homedir as homedir21 } from "node:os";
|
|
47270
|
-
import { join as
|
|
47457
|
+
import { join as join40 } from "node:path";
|
|
47271
47458
|
function labelForModel(id) {
|
|
47272
47459
|
return id.split(/[-_.]+/g).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
47273
47460
|
}
|
|
@@ -47370,7 +47557,7 @@ async function discoverOpenCodeModels(environment, cli = "opencode") {
|
|
|
47370
47557
|
}
|
|
47371
47558
|
function opencodeConfigDir(env) {
|
|
47372
47559
|
const home = env.HOME || env.USERPROFILE || homedir21();
|
|
47373
|
-
return
|
|
47560
|
+
return join40(env.XDG_CONFIG_HOME || join40(home, ".config"), "opencode");
|
|
47374
47561
|
}
|
|
47375
47562
|
function ensureOpenCodeInjectModel(modelId, env = process.env) {
|
|
47376
47563
|
const inject = decodeInjectId(modelId);
|
|
@@ -47380,7 +47567,7 @@ function ensureOpenCodeInjectModel(modelId, env = process.env) {
|
|
|
47380
47567
|
const native = `${inject.host}/${inject.model}`;
|
|
47381
47568
|
const dir = opencodeConfigDir(env);
|
|
47382
47569
|
mkdirSync19(dir, { recursive: true });
|
|
47383
|
-
const path4 =
|
|
47570
|
+
const path4 = join40(dir, "opencode.json");
|
|
47384
47571
|
let config2 = { $schema: "https://opencode.ai/config.json" };
|
|
47385
47572
|
if (existsSync21(path4)) {
|
|
47386
47573
|
try {
|
|
@@ -47418,10 +47605,10 @@ function ensureOpenCodeInjectModel(modelId, env = process.env) {
|
|
|
47418
47605
|
function storedAuthPaths(env) {
|
|
47419
47606
|
const home = env.HOME || env.USERPROFILE || homedir21();
|
|
47420
47607
|
const roots = [
|
|
47421
|
-
env.XDG_DATA_HOME ||
|
|
47422
|
-
process.platform === "darwin" ?
|
|
47608
|
+
env.XDG_DATA_HOME || join40(home, ".local", "share"),
|
|
47609
|
+
process.platform === "darwin" ? join40(home, "Library", "Application Support") : process.platform === "win32" ? env.LOCALAPPDATA || join40(home, "AppData", "Local") : ""
|
|
47423
47610
|
].filter(Boolean);
|
|
47424
|
-
return [...new Set(roots)].map((root) =>
|
|
47611
|
+
return [...new Set(roots)].map((root) => join40(root, "opencode", "auth.json"));
|
|
47425
47612
|
}
|
|
47426
47613
|
function usableAuthEntry(parsed) {
|
|
47427
47614
|
return Object.values(parsed).some((auth) => {
|
|
@@ -47580,10 +47767,10 @@ ${turn.text}` : turn.text
|
|
|
47580
47767
|
import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync20, readFileSync as readFileSync24, writeFileSync as writeFileSync16 } from "node:fs";
|
|
47581
47768
|
import { createHash as createHash13 } from "node:crypto";
|
|
47582
47769
|
import { homedir as homedir22 } from "node:os";
|
|
47583
|
-
import { join as
|
|
47770
|
+
import { join as join41 } from "node:path";
|
|
47584
47771
|
function qwenHome(env) {
|
|
47585
47772
|
const home = process.platform === "win32" ? env.USERPROFILE || env.HOME || homedir22() : env.HOME || env.USERPROFILE || homedir22();
|
|
47586
|
-
return
|
|
47773
|
+
return join41(home, ".qwen");
|
|
47587
47774
|
}
|
|
47588
47775
|
function isRecord5(value) {
|
|
47589
47776
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -47595,7 +47782,7 @@ function qwenModelLabel(id, name) {
|
|
|
47595
47782
|
function readQwenRoutes(env) {
|
|
47596
47783
|
let settings2;
|
|
47597
47784
|
try {
|
|
47598
|
-
settings2 = JSON.parse(readFileSync24(
|
|
47785
|
+
settings2 = JSON.parse(readFileSync24(join41(qwenHome(env), "settings.json"), "utf8"));
|
|
47599
47786
|
} catch {
|
|
47600
47787
|
return [];
|
|
47601
47788
|
}
|
|
@@ -47679,7 +47866,7 @@ function ensureQwenInjectModel(modelId, env = process.env) {
|
|
|
47679
47866
|
if (!host) return modelId;
|
|
47680
47867
|
const dir = qwenHome(env);
|
|
47681
47868
|
mkdirSync20(dir, { recursive: true });
|
|
47682
|
-
const path4 =
|
|
47869
|
+
const path4 = join41(dir, "settings.json");
|
|
47683
47870
|
let settings2 = {};
|
|
47684
47871
|
if (existsSync22(path4)) {
|
|
47685
47872
|
try {
|
|
@@ -48168,12 +48355,12 @@ var init_claude_accounts = __esm({
|
|
|
48168
48355
|
// server/atomic-engine-accounts.ts
|
|
48169
48356
|
import { mkdirSync as mkdirSync21, readFileSync as readFileSync25, writeFileSync as writeFileSync17 } from "node:fs";
|
|
48170
48357
|
import { homedir as homedir23 } from "node:os";
|
|
48171
|
-
import { join as
|
|
48358
|
+
import { join as join42 } from "node:path";
|
|
48172
48359
|
function rawConfig2(entry) {
|
|
48173
48360
|
return entry.config && typeof entry.config === "object" && !Array.isArray(entry.config) ? entry.config : {};
|
|
48174
48361
|
}
|
|
48175
48362
|
function expandHome(path4) {
|
|
48176
|
-
return path4 === "~" ? homedir23() : path4.startsWith("~/") ?
|
|
48363
|
+
return path4 === "~" ? homedir23() : path4.startsWith("~/") ? join42(homedir23(), path4.slice(2)) : path4;
|
|
48177
48364
|
}
|
|
48178
48365
|
function asAccount(id, entry) {
|
|
48179
48366
|
if (entry.enabled === false) return null;
|
|
@@ -48205,7 +48392,7 @@ function asAccount(id, entry) {
|
|
|
48205
48392
|
kind: "codex-cli",
|
|
48206
48393
|
label,
|
|
48207
48394
|
billing: "subscription",
|
|
48208
|
-
home: home ? expandHome(home) :
|
|
48395
|
+
home: home ? expandHome(home) : join42(homedir23(), ".codex"),
|
|
48209
48396
|
model: FAILOVER_MODEL["openai-codex"]
|
|
48210
48397
|
} };
|
|
48211
48398
|
}
|
|
@@ -48267,7 +48454,7 @@ function writeAtomicEngineAccountsFile(engineHome, accounts) {
|
|
|
48267
48454
|
const shareable = accounts.map(({ restingUntil: _resting, ...account }) => account);
|
|
48268
48455
|
const text4 = `${JSON.stringify({ version: 1, accounts: shareable }, null, 2)}
|
|
48269
48456
|
`;
|
|
48270
|
-
const path4 =
|
|
48457
|
+
const path4 = join42(engineHome, ACCOUNTS_FILE);
|
|
48271
48458
|
try {
|
|
48272
48459
|
if (readFileSync25(path4, "utf8") === text4) return;
|
|
48273
48460
|
} catch {
|
|
@@ -48344,20 +48531,20 @@ var init_atomic_engine_release = __esm({
|
|
|
48344
48531
|
// server/atomic-engine-runtime.ts
|
|
48345
48532
|
import { createHash as createHash14, randomUUID as randomUUID15 } from "node:crypto";
|
|
48346
48533
|
import { createWriteStream as createWriteStream2, existsSync as existsSync23, mkdirSync as mkdirSync22, readdirSync as readdirSync6, readFileSync as readFileSync26, rmSync as rmSync9, writeFileSync as writeFileSync18 } from "node:fs";
|
|
48347
|
-
import { join as
|
|
48534
|
+
import { join as join43 } from "node:path";
|
|
48348
48535
|
import { Readable, Transform as Transform2 } from "node:stream";
|
|
48349
48536
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
48350
48537
|
function atomicEngineHome(baseDir = DATA_DIR) {
|
|
48351
|
-
return
|
|
48538
|
+
return join43(baseDir, "tools", "atomic-engine");
|
|
48352
48539
|
}
|
|
48353
48540
|
function atomicEnginePython(root, platform = process.platform) {
|
|
48354
|
-
return platform === "win32" ?
|
|
48541
|
+
return platform === "win32" ? join43(root, "atomic-engine", "python", "python.exe") : join43(root, "atomic-engine", "python", "bin", "python3");
|
|
48355
48542
|
}
|
|
48356
48543
|
function managedAtomicEngine(baseDir = DATA_DIR, asset = atomicEngineAsset(), platform = process.platform) {
|
|
48357
48544
|
if (!asset) return null;
|
|
48358
|
-
const root =
|
|
48545
|
+
const root = join43(atomicEngineHome(baseDir), asset.version);
|
|
48359
48546
|
try {
|
|
48360
|
-
if (readFileSync26(
|
|
48547
|
+
if (readFileSync26(join43(root, MARKER2), "utf8").trim() !== asset.sha512) return null;
|
|
48361
48548
|
} catch {
|
|
48362
48549
|
return null;
|
|
48363
48550
|
}
|
|
@@ -48367,7 +48554,7 @@ function managedAtomicEngine(baseDir = DATA_DIR, asset = atomicEngineAsset(), pl
|
|
|
48367
48554
|
function systemTar(platform = process.platform) {
|
|
48368
48555
|
if (platform !== "win32") return "/usr/bin/tar";
|
|
48369
48556
|
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT ?? "C:\\Windows";
|
|
48370
|
-
return
|
|
48557
|
+
return join43(systemRoot, "System32", "tar.exe");
|
|
48371
48558
|
}
|
|
48372
48559
|
async function download(asset, file2, options) {
|
|
48373
48560
|
let response;
|
|
@@ -48412,8 +48599,8 @@ async function installOnce3(options) {
|
|
|
48412
48599
|
const home = atomicEngineHome(baseDir);
|
|
48413
48600
|
mkdirSync22(home, { recursive: true });
|
|
48414
48601
|
const id = randomUUID15();
|
|
48415
|
-
const archive =
|
|
48416
|
-
const staging =
|
|
48602
|
+
const archive = join43(home, `.download-${id}.tar.gz`);
|
|
48603
|
+
const staging = join43(home, `.staging-${id}`);
|
|
48417
48604
|
try {
|
|
48418
48605
|
await download(asset, archive, options);
|
|
48419
48606
|
options.onProgress?.({ phase: "installing" });
|
|
@@ -48424,7 +48611,7 @@ async function installOnce3(options) {
|
|
|
48424
48611
|
throw new AtomicEngineInstallError("install", `Could not unpack Atomic Engine: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
48425
48612
|
}
|
|
48426
48613
|
if (!existsSync23(atomicEnginePython(staging))) throw new AtomicEngineInstallError("install", "The Atomic Engine package has no Python runtime for this computer");
|
|
48427
|
-
const root =
|
|
48614
|
+
const root = join43(home, asset.version);
|
|
48428
48615
|
rmSync9(root, { recursive: true, force: true });
|
|
48429
48616
|
await promoteDirectory(staging, root);
|
|
48430
48617
|
const python = atomicEnginePython(root);
|
|
@@ -48435,10 +48622,10 @@ async function installOnce3(options) {
|
|
|
48435
48622
|
await removeDirectoryQuietly(root, "Atomic Engine has no install marker there, so it is not used");
|
|
48436
48623
|
throw new AtomicEngineInstallError("install", `Atomic Engine did not start after installing: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
48437
48624
|
}
|
|
48438
|
-
writeFileSync18(
|
|
48625
|
+
writeFileSync18(join43(root, MARKER2), `${asset.sha512}
|
|
48439
48626
|
`);
|
|
48440
48627
|
for (const name of readdirSync6(home)) {
|
|
48441
|
-
if (name !== asset.version && !name.startsWith(".")) rmSync9(
|
|
48628
|
+
if (name !== asset.version && !name.startsWith(".")) rmSync9(join43(home, name), { recursive: true, force: true });
|
|
48442
48629
|
}
|
|
48443
48630
|
const installed = managedAtomicEngine(baseDir, asset);
|
|
48444
48631
|
if (!installed) throw new AtomicEngineInstallError("install", "Atomic Engine did not install completely");
|
|
@@ -55362,7 +55549,7 @@ var init_memory_policy = __esm({
|
|
|
55362
55549
|
// server/drivers/acp/hermes-memory-lock.ts
|
|
55363
55550
|
import { createHash as createHash15 } from "node:crypto";
|
|
55364
55551
|
import { mkdirSync as mkdirSync23, readdirSync as readdirSync7, readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "node:fs";
|
|
55365
|
-
import { join as
|
|
55552
|
+
import { join as join44 } from "node:path";
|
|
55366
55553
|
function readText2(path4) {
|
|
55367
55554
|
try {
|
|
55368
55555
|
return readFileSync27(path4, "utf8");
|
|
@@ -55389,24 +55576,24 @@ function memoryProviderPlugins(pluginsDir) {
|
|
|
55389
55576
|
return [];
|
|
55390
55577
|
}
|
|
55391
55578
|
return dirs.flatMap((dir) => {
|
|
55392
|
-
const source2 = (readText2(
|
|
55579
|
+
const source2 = (readText2(join44(pluginsDir, dir, "__init__.py")) ?? "").slice(0, 8192);
|
|
55393
55580
|
if (!source2.includes("register_memory_provider") && !source2.includes("MemoryProvider")) return [];
|
|
55394
|
-
const name = record2(parseYamlSafe(readText2(
|
|
55581
|
+
const name = record2(parseYamlSafe(readText2(join44(pluginsDir, dir, "plugin.yaml"))))?.name;
|
|
55395
55582
|
return typeof name === "string" && name.trim() && name.trim() !== dir ? [dir, name.trim()] : [dir];
|
|
55396
55583
|
});
|
|
55397
55584
|
}
|
|
55398
55585
|
function lockHermesMemory(env, home, dataDir = DATA_DIR) {
|
|
55399
|
-
const own = record2(record2(parseYamlSafe(readText2(
|
|
55586
|
+
const own = record2(record2(parseYamlSafe(readText2(join44(home, "config.yaml"))))?.plugins);
|
|
55400
55587
|
const disabled = new Set(Array.isArray(own?.disabled) ? own.disabled.map(String) : []);
|
|
55401
|
-
for (const name of memoryProviderPlugins(
|
|
55588
|
+
for (const name of memoryProviderPlugins(join44(home, "plugins"))) disabled.add(name);
|
|
55402
55589
|
for (const name of BLOCKED_HERMES_MEMORY_PLUGINS) disabled.add(name);
|
|
55403
55590
|
const overlay = stringify3({
|
|
55404
55591
|
memory: { provider: "", memory_enabled: false, user_profile_enabled: false },
|
|
55405
55592
|
plugins: { disabled: [...disabled].sort() }
|
|
55406
55593
|
});
|
|
55407
|
-
const dir =
|
|
55594
|
+
const dir = join44(dataDir, "hermes-managed", createHash15("sha256").update(home).digest("hex").slice(0, 16));
|
|
55408
55595
|
mkdirSync23(dir, { recursive: true });
|
|
55409
|
-
const file2 =
|
|
55596
|
+
const file2 = join44(dir, "config.yaml");
|
|
55410
55597
|
if (readText2(file2) !== overlay) writeFileSync19(file2, overlay);
|
|
55411
55598
|
env.HERMES_MANAGED_DIR = dir;
|
|
55412
55599
|
return dir;
|
|
@@ -55424,7 +55611,7 @@ var init_hermes_memory_lock = __esm({
|
|
|
55424
55611
|
import { spawn as spawn7 } from "node:child_process";
|
|
55425
55612
|
import { mkdirSync as mkdirSync24, readFileSync as readFileSync28, writeFileSync as writeFileSync20 } from "node:fs";
|
|
55426
55613
|
import { homedir as homedir24 } from "node:os";
|
|
55427
|
-
import { join as
|
|
55614
|
+
import { join as join45 } from "node:path";
|
|
55428
55615
|
function bindHermesScreenshotCompat(env, modelId) {
|
|
55429
55616
|
delete env[HERMES_OPENMAUS_SCREENSHOT_COMPAT];
|
|
55430
55617
|
delete env[HERMES_OPENMAUS_SCREENSHOT_COMPAT_MODEL];
|
|
@@ -55434,7 +55621,7 @@ function bindHermesScreenshotCompat(env, modelId) {
|
|
|
55434
55621
|
env[HERMES_OPENMAUS_SCREENSHOT_COMPAT_MODEL] = inject.model;
|
|
55435
55622
|
}
|
|
55436
55623
|
function hermesHome(env) {
|
|
55437
|
-
return env.HERMES_HOME ||
|
|
55624
|
+
return env.HERMES_HOME || join45(env.HOME || env.USERPROFILE || homedir24(), ".hermes");
|
|
55438
55625
|
}
|
|
55439
55626
|
function quoteYaml(value) {
|
|
55440
55627
|
if (/^[\w./:+-]+$/.test(value)) return value;
|
|
@@ -55476,7 +55663,7 @@ function ensureHermesInjectProvider(modelId, env = process.env, home = hermesHom
|
|
|
55476
55663
|
if (!host) return modelId;
|
|
55477
55664
|
const dir = home;
|
|
55478
55665
|
mkdirSync24(dir, { recursive: true });
|
|
55479
|
-
const path4 =
|
|
55666
|
+
const path4 = join45(dir, "config.yaml");
|
|
55480
55667
|
let text4 = "";
|
|
55481
55668
|
try {
|
|
55482
55669
|
text4 = readFileSync28(path4, "utf8");
|
|
@@ -55547,13 +55734,13 @@ function hermesConfiguredModel(env = process.env) {
|
|
|
55547
55734
|
const dir = hermesHome(env);
|
|
55548
55735
|
let secrets = "";
|
|
55549
55736
|
try {
|
|
55550
|
-
secrets = readFileSync28(
|
|
55737
|
+
secrets = readFileSync28(join45(dir, ".env"), "utf8");
|
|
55551
55738
|
} catch {
|
|
55552
55739
|
}
|
|
55553
55740
|
const hasHostedProviderKey = HERMES_HOSTED_PROVIDER_KEYS.some((name) => nonEmptyDotenvValue(secrets, name));
|
|
55554
55741
|
let configuredDefault = null;
|
|
55555
55742
|
try {
|
|
55556
|
-
configuredDefault = hermesConfigDefault(readFileSync28(
|
|
55743
|
+
configuredDefault = hermesConfigDefault(readFileSync28(join45(dir, "config.yaml"), "utf8"));
|
|
55557
55744
|
} catch {
|
|
55558
55745
|
}
|
|
55559
55746
|
const configuredProvider = configuredDefault?.provider.toLowerCase() ?? "";
|
|
@@ -55598,7 +55785,7 @@ function oauthRowSignedIn(row, now) {
|
|
|
55598
55785
|
return present(row.access_token) && notExpired(row, now);
|
|
55599
55786
|
}
|
|
55600
55787
|
function hermesSignedInProviders(env = process.env, now = Date.now()) {
|
|
55601
|
-
const store = record3(readJson(
|
|
55788
|
+
const store = record3(readJson(join45(hermesHome(env), "auth.json")));
|
|
55602
55789
|
const out = /* @__PURE__ */ new Set();
|
|
55603
55790
|
if (!store) return out;
|
|
55604
55791
|
const providers = record3(store.providers) ?? {};
|
|
@@ -55622,7 +55809,7 @@ function hermesZaiCodingPlan(env = process.env) {
|
|
|
55622
55809
|
const dir = hermesHome(env);
|
|
55623
55810
|
let secrets = "";
|
|
55624
55811
|
try {
|
|
55625
|
-
secrets = readFileSync28(
|
|
55812
|
+
secrets = readFileSync28(join45(dir, ".env"), "utf8");
|
|
55626
55813
|
} catch {
|
|
55627
55814
|
}
|
|
55628
55815
|
const keyed = ["GLM_API_KEY", "ZAI_API_KEY", "Z_AI_API_KEY"].some((name) => present(env[name]) || nonEmptyDotenvValue(secrets, name));
|
|
@@ -55630,21 +55817,21 @@ function hermesZaiCodingPlan(env = process.env) {
|
|
|
55630
55817
|
const coding = (url2) => typeof url2 === "string" && /\/api\/coding\/paas\//i.test(url2);
|
|
55631
55818
|
const override = present(env.GLM_BASE_URL) ? env.GLM_BASE_URL : nonEmptyDotenvValue(secrets, "GLM_BASE_URL");
|
|
55632
55819
|
if (override) return coding(override);
|
|
55633
|
-
const detected = record3(record3(record3(record3(readJson(
|
|
55820
|
+
const detected = record3(record3(record3(record3(readJson(join45(dir, "auth.json")))?.providers)?.zai)?.detected_endpoint);
|
|
55634
55821
|
return coding(detected?.base_url);
|
|
55635
55822
|
}
|
|
55636
55823
|
function hermesZaiPlanHosts(options, codingPlan) {
|
|
55637
55824
|
return codingPlan ? options.map((option) => option.provider === "zai" ? { ...option, provider: "zai-coding-plan" } : option) : [...options];
|
|
55638
55825
|
}
|
|
55639
55826
|
function hermesCachedModels(home, provider) {
|
|
55640
|
-
const catalog2 = record3(record3(record3(readJson(
|
|
55827
|
+
const catalog2 = record3(record3(record3(readJson(join45(home, "cache", "model_catalog.json")))?.providers)?.[provider]);
|
|
55641
55828
|
const name = String(record3(catalog2?.metadata)?.display_name ?? "").trim() || provider;
|
|
55642
55829
|
const rows = Array.isArray(catalog2?.models) ? catalog2.models.map(record3).filter((row) => row && present(row.id)) : [];
|
|
55643
55830
|
if (rows.length) {
|
|
55644
55831
|
const ordered = [...rows.filter((row) => row.default === true), ...rows.filter((row) => row.default !== true)];
|
|
55645
55832
|
return { ids: ordered.map((row) => String(row.id).trim()), name };
|
|
55646
55833
|
}
|
|
55647
|
-
const cached3 = record3(record3(readJson(
|
|
55834
|
+
const cached3 = record3(record3(readJson(join45(home, "provider_models_cache.json")))?.[provider])?.models;
|
|
55648
55835
|
return { ids: Array.isArray(cached3) ? cached3.filter(present).map((id) => String(id).trim()) : [], name };
|
|
55649
55836
|
}
|
|
55650
55837
|
function hermesAuthStoreModels(env = process.env, now = Date.now()) {
|
|
@@ -55662,7 +55849,7 @@ function hermesConfiguredHostModel(env = process.env) {
|
|
|
55662
55849
|
const home = hermesHome(env);
|
|
55663
55850
|
let configured = null;
|
|
55664
55851
|
try {
|
|
55665
|
-
configured = hermesConfigDefault(readFileSync28(
|
|
55852
|
+
configured = hermesConfigDefault(readFileSync28(join45(home, "config.yaml"), "utf8"));
|
|
55666
55853
|
} catch {
|
|
55667
55854
|
return null;
|
|
55668
55855
|
}
|
|
@@ -55885,7 +56072,7 @@ ${turn.text}` : turn.text
|
|
|
55885
56072
|
|
|
55886
56073
|
// server/drivers/acp/custom.ts
|
|
55887
56074
|
import { homedir as homedir25 } from "node:os";
|
|
55888
|
-
import { basename as basename9, join as
|
|
56075
|
+
import { basename as basename9, join as join46 } from "node:path";
|
|
55889
56076
|
function isAtomicEngine(instanceId, cli) {
|
|
55890
56077
|
const program = (cli ?? "").trim().split(/\s+/)[0] ?? "";
|
|
55891
56078
|
return instanceId === "atomic-engine" || basename9(program) === "atomic";
|
|
@@ -55910,7 +56097,7 @@ async function customAcpSnapshot(env, cli, instanceId) {
|
|
|
55910
56097
|
return { state: "available", version: version2, authenticated: true };
|
|
55911
56098
|
}
|
|
55912
56099
|
function atomicEngineHome2(env) {
|
|
55913
|
-
return env.HERMES_HOME ||
|
|
56100
|
+
return env.HERMES_HOME || join46(env.HOME || env.USERPROFILE || homedir25(), ".atomic");
|
|
55914
56101
|
}
|
|
55915
56102
|
function applyAtomicEngineAccounts(env, instanceId, cli, accounts = currentAtomicEngineAccounts) {
|
|
55916
56103
|
if (!isAtomicEngine(instanceId, cli)) return;
|
|
@@ -56294,8 +56481,8 @@ var init_openai_compat = __esm({
|
|
|
56294
56481
|
|
|
56295
56482
|
// server/drivers/pi.ts
|
|
56296
56483
|
import { chmodSync as chmodSync6, existsSync as existsSync24, mkdirSync as mkdirSync25, mkdtempSync as mkdtempSync5, readFileSync as readFileSync29, rmSync as rmSync10, writeFileSync as writeFileSync21 } from "node:fs";
|
|
56297
|
-
import { homedir as homedir26, tmpdir as
|
|
56298
|
-
import { join as
|
|
56484
|
+
import { homedir as homedir26, tmpdir as tmpdir6 } from "node:os";
|
|
56485
|
+
import { join as join47 } from "node:path";
|
|
56299
56486
|
function readPiPromptImages(turn) {
|
|
56300
56487
|
return (turn.images ?? []).map((image) => ({
|
|
56301
56488
|
type: "image",
|
|
@@ -56417,7 +56604,7 @@ async function applyPiLocalCatalog(catalog2, env = process.env, fetchImpl = fetc
|
|
|
56417
56604
|
return preferPiInjectRows(await mergeLocalInject(catalog2, env, fetchImpl));
|
|
56418
56605
|
}
|
|
56419
56606
|
function piAgentDir(env) {
|
|
56420
|
-
return
|
|
56607
|
+
return join47(env.HOME || env.USERPROFILE || homedir26(), ".pi", "agent");
|
|
56421
56608
|
}
|
|
56422
56609
|
function ensurePiInjectModel(modelId, env = process.env) {
|
|
56423
56610
|
const split = splitPiModel(modelId);
|
|
@@ -56428,7 +56615,7 @@ function ensurePiInjectModel(modelId, env = process.env) {
|
|
|
56428
56615
|
if (!host) return split;
|
|
56429
56616
|
const dir = piAgentDir(env);
|
|
56430
56617
|
mkdirSync25(dir, { recursive: true });
|
|
56431
|
-
const path4 =
|
|
56618
|
+
const path4 = join47(dir, "models.json");
|
|
56432
56619
|
let root = { providers: {} };
|
|
56433
56620
|
if (existsSync24(path4)) {
|
|
56434
56621
|
try {
|
|
@@ -56648,9 +56835,9 @@ var init_pi = __esm({
|
|
|
56648
56835
|
const mcpServers = buildMcpServers(turn);
|
|
56649
56836
|
let mcpTempDir = null;
|
|
56650
56837
|
if (mcpServers) {
|
|
56651
|
-
mcpTempDir = mkdtempSync5(
|
|
56838
|
+
mcpTempDir = mkdtempSync5(join47(tmpdir6(), "omb-pi-mcp-"));
|
|
56652
56839
|
try {
|
|
56653
|
-
writeFileSync21(
|
|
56840
|
+
writeFileSync21(join47(mcpTempDir, "mcp.json"), JSON.stringify({ mcpServers }), { mode: 384 });
|
|
56654
56841
|
} catch (err) {
|
|
56655
56842
|
try {
|
|
56656
56843
|
rmSync10(mcpTempDir, { recursive: true, force: true });
|
|
@@ -56669,7 +56856,7 @@ var init_pi = __esm({
|
|
|
56669
56856
|
env: piEnvironment({
|
|
56670
56857
|
...process.env,
|
|
56671
56858
|
...input.environment,
|
|
56672
|
-
...mcpServers && mcpTempDir ? { OMB_MCP_CONFIG:
|
|
56859
|
+
...mcpServers && mcpTempDir ? { OMB_MCP_CONFIG: join47(mcpTempDir, "mcp.json") } : {}
|
|
56673
56860
|
})
|
|
56674
56861
|
});
|
|
56675
56862
|
} catch (err) {
|
|
@@ -56816,7 +57003,7 @@ var init_pi = __esm({
|
|
|
56816
57003
|
const mcpTool = isQuestion ? null : piMcpToolRef(
|
|
56817
57004
|
evt.title,
|
|
56818
57005
|
customServerNames,
|
|
56819
|
-
mcpTempDir ?
|
|
57006
|
+
mcpTempDir ? join47(mcpTempDir, PI_TOOL_HINTS_FILE) : null
|
|
56820
57007
|
);
|
|
56821
57008
|
emit({
|
|
56822
57009
|
...base3(threadId, turnId),
|
|
@@ -57151,14 +57338,14 @@ var init_mistral = __esm({
|
|
|
57151
57338
|
// server/drivers/minimax.ts
|
|
57152
57339
|
import { readFileSync as readFileSync30 } from "node:fs";
|
|
57153
57340
|
import { homedir as homedir27 } from "node:os";
|
|
57154
|
-
import { join as
|
|
57341
|
+
import { join as join48 } from "node:path";
|
|
57155
57342
|
function normalizedApiUrl(value) {
|
|
57156
57343
|
const root = value.trim().replace(/\/+$/, "");
|
|
57157
57344
|
return root.endsWith("/v1") ? root : `${root}/v1`;
|
|
57158
57345
|
}
|
|
57159
57346
|
function loadLocalMiniMaxConfig(home = homedir27()) {
|
|
57160
57347
|
try {
|
|
57161
|
-
const raw = localConfigSchema.parse(JSON.parse(readFileSync30(
|
|
57348
|
+
const raw = localConfigSchema.parse(JSON.parse(readFileSync30(join48(home, ".mmx", "config.json"), "utf8")));
|
|
57162
57349
|
const configuredUrl = raw.base_url?.trim() ? raw.base_url : raw.region === "cn" ? CN_URL : DEFAULT_URL3;
|
|
57163
57350
|
return {
|
|
57164
57351
|
apiKey: raw.api_key?.trim() ?? "",
|
|
@@ -57265,7 +57452,7 @@ var init_minimax = __esm({
|
|
|
57265
57452
|
// server/apple-intelligence.ts
|
|
57266
57453
|
import { spawn as spawn8 } from "node:child_process";
|
|
57267
57454
|
import { accessSync, constants as constants2 } from "node:fs";
|
|
57268
|
-
import { join as
|
|
57455
|
+
import { join as join49 } from "node:path";
|
|
57269
57456
|
function intelligenceErrorMessage(code) {
|
|
57270
57457
|
return MESSAGES[code] ?? `Apple Intelligence failed (${code}).`;
|
|
57271
57458
|
}
|
|
@@ -57273,9 +57460,9 @@ function resolveIntelligenceHelper(env = process.env, platform = process.platfor
|
|
|
57273
57460
|
if (platform !== "darwin" || arch !== "arm64") return null;
|
|
57274
57461
|
const candidates = [
|
|
57275
57462
|
env.ATOMIC_INTELLIGENCE_HELPER,
|
|
57276
|
-
env.OMB_RESOURCES_PATH &&
|
|
57277
|
-
|
|
57278
|
-
|
|
57463
|
+
env.OMB_RESOURCES_PATH && join49(env.OMB_RESOURCES_PATH, HELPER),
|
|
57464
|
+
join49(serverRoot, "..", HELPER),
|
|
57465
|
+
join49(serverRoot, "..", "dist-native", "arm64", HELPER)
|
|
57279
57466
|
];
|
|
57280
57467
|
for (const candidate of candidates) {
|
|
57281
57468
|
if (!candidate) continue;
|
|
@@ -57463,7 +57650,7 @@ var init_apple_intelligence = __esm({
|
|
|
57463
57650
|
"concurrent-requests": "Apple Intelligence is busy. Try again in a moment.",
|
|
57464
57651
|
"timeout": "Apple Intelligence took too long to answer."
|
|
57465
57652
|
};
|
|
57466
|
-
HELPER =
|
|
57653
|
+
HELPER = join49("Atomic Intelligence.app", "Contents", "MacOS", "intelligence-helper");
|
|
57467
57654
|
}
|
|
57468
57655
|
});
|
|
57469
57656
|
|
|
@@ -57816,7 +58003,7 @@ __export(cli_setup_exports, {
|
|
|
57816
58003
|
});
|
|
57817
58004
|
import { spawn as spawn9 } from "node:child_process";
|
|
57818
58005
|
import { readFileSync as readFileSync31 } from "node:fs";
|
|
57819
|
-
import { join as
|
|
58006
|
+
import { join as join50, resolve as resolve11 } from "node:path";
|
|
57820
58007
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
57821
58008
|
async function inspect(id, entry) {
|
|
57822
58009
|
const registry2 = new ProviderRegistry(BUILT_IN_DRIVERS);
|
|
@@ -57853,7 +58040,7 @@ function assertDataDir(dataDir) {
|
|
|
57853
58040
|
}
|
|
57854
58041
|
function checkStoredConfig(dataDir) {
|
|
57855
58042
|
try {
|
|
57856
|
-
parseStoredConfig(JSON.parse(readFileSync31(
|
|
58043
|
+
parseStoredConfig(JSON.parse(readFileSync31(join50(dataDir, "config.json"), "utf8")));
|
|
57857
58044
|
} catch (error51) {
|
|
57858
58045
|
if (error51.code === "ENOENT") return;
|
|
57859
58046
|
throw new Error("Existing config.json could not be read or validated. Setup has not changed it; repair it before continuing.");
|
|
@@ -58133,7 +58320,7 @@ var init_browser_engine_release = __esm({
|
|
|
58133
58320
|
});
|
|
58134
58321
|
|
|
58135
58322
|
// server/browser-bundle-release.ts
|
|
58136
|
-
import { join as
|
|
58323
|
+
import { join as join51 } from "node:path";
|
|
58137
58324
|
function browserBundleSpec(target) {
|
|
58138
58325
|
if (!Object.hasOwn(CHROME_ASSETS, target)) throw new Error(`Unsupported desktop browser target: ${target}`);
|
|
58139
58326
|
const pinned = CHROME_ASSETS[target];
|
|
@@ -58169,10 +58356,10 @@ function browserBundlePaths(bundleDirectory, target) {
|
|
|
58169
58356
|
const spec = browserBundleSpec(target);
|
|
58170
58357
|
return {
|
|
58171
58358
|
directory: bundleDirectory,
|
|
58172
|
-
manifest:
|
|
58173
|
-
engine:
|
|
58174
|
-
chrome:
|
|
58175
|
-
licenses:
|
|
58359
|
+
manifest: join51(bundleDirectory, "manifest.json"),
|
|
58360
|
+
engine: join51(bundleDirectory, spec.engine.executable),
|
|
58361
|
+
chrome: join51(bundleDirectory, spec.chrome.executable),
|
|
58362
|
+
licenses: join51(bundleDirectory, "licenses")
|
|
58176
58363
|
};
|
|
58177
58364
|
}
|
|
58178
58365
|
var CHROME_VERSION, CHROME_ASSETS;
|
|
@@ -58214,7 +58401,7 @@ var init_browser_runtime = __esm({
|
|
|
58214
58401
|
});
|
|
58215
58402
|
|
|
58216
58403
|
// server/bot-folder.ts
|
|
58217
|
-
import { join as
|
|
58404
|
+
import { join as join52 } from "node:path";
|
|
58218
58405
|
var BOTS_DIR;
|
|
58219
58406
|
var init_bot_folder = __esm({
|
|
58220
58407
|
"server/bot-folder.ts"() {
|
|
@@ -58222,7 +58409,7 @@ var init_bot_folder = __esm({
|
|
|
58222
58409
|
init_atomic();
|
|
58223
58410
|
init_config();
|
|
58224
58411
|
init_bot_profile();
|
|
58225
|
-
BOTS_DIR =
|
|
58412
|
+
BOTS_DIR = join52(DATA_DIR, "bots");
|
|
58226
58413
|
}
|
|
58227
58414
|
});
|
|
58228
58415
|
|
|
@@ -58264,8 +58451,8 @@ __export(browser_engine_exports, {
|
|
|
58264
58451
|
});
|
|
58265
58452
|
import { createHash as createHash16, randomBytes as randomBytes3, randomUUID as randomUUID17 } from "node:crypto";
|
|
58266
58453
|
import { chmodSync as chmodSync7, constants as constants3, copyFileSync, existsSync as existsSync25, mkdirSync as mkdirSync26, readFileSync as readFileSync32, readdirSync as readdirSync8, renameSync as renameSync8, rmSync as rmSync11, statSync as statSync6, unlinkSync as unlinkSync7, writeFileSync as writeFileSync22 } from "node:fs";
|
|
58267
|
-
import { homedir as homedir28, tmpdir as
|
|
58268
|
-
import { delimiter as delimiter7, dirname as dirname12, join as
|
|
58454
|
+
import { homedir as homedir28, tmpdir as tmpdir7 } from "node:os";
|
|
58455
|
+
import { delimiter as delimiter7, dirname as dirname12, join as join53, resolve as resolve12 } from "node:path";
|
|
58269
58456
|
function browserRestoreKey(session) {
|
|
58270
58457
|
if (!/^[A-Za-z0-9_.-]{1,96}$/.test(session)) throw new Error("Invalid browser session.");
|
|
58271
58458
|
return `omb-${createHash16("sha256").update(session).digest("hex")}`;
|
|
@@ -58274,11 +58461,11 @@ function browserSessionsDirectory(env) {
|
|
|
58274
58461
|
const namespace = env.AGENT_BROWSER_NAMESPACE;
|
|
58275
58462
|
if (namespace && !/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/.test(namespace)) throw new Error("Invalid browser namespace.");
|
|
58276
58463
|
const home = (process.platform === "win32" ? env.USERPROFILE : env.HOME) || homedir28();
|
|
58277
|
-
const stateRoot = namespace ?
|
|
58278
|
-
return
|
|
58464
|
+
const stateRoot = namespace ? join53(home, ".agent-browser", "namespaces", namespace, "state") : join53(home, ".agent-browser");
|
|
58465
|
+
return join53(stateRoot, "sessions");
|
|
58279
58466
|
}
|
|
58280
58467
|
function managedBrowserConfigPath(env) {
|
|
58281
|
-
return
|
|
58468
|
+
return join53(browserSessionsDirectory(env), "..", "omb-managed-config.json");
|
|
58282
58469
|
}
|
|
58283
58470
|
function ensureManagedBrowserConfig(env) {
|
|
58284
58471
|
const path4 = managedBrowserConfigPath(env);
|
|
@@ -58375,11 +58562,11 @@ async function prepareBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58375
58562
|
ensureManagedBrowserConfig(env);
|
|
58376
58563
|
if (options.persistent === false) return;
|
|
58377
58564
|
const directory = browserSessionsDirectory(env);
|
|
58378
|
-
const key =
|
|
58565
|
+
const key = join53(directory, session);
|
|
58379
58566
|
let pending = preparedBrowserSessions.get(key);
|
|
58380
58567
|
if (!pending) {
|
|
58381
58568
|
pending = (async () => {
|
|
58382
|
-
const targetBase =
|
|
58569
|
+
const targetBase = join53(directory, `${restoreKey}-${session}`);
|
|
58383
58570
|
const hasTarget = () => existsSync25(`${targetBase}.json.enc`) || existsSync25(`${targetBase}.json`);
|
|
58384
58571
|
if (hasTarget()) return;
|
|
58385
58572
|
check2();
|
|
@@ -58389,7 +58576,7 @@ async function prepareBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58389
58576
|
check2();
|
|
58390
58577
|
if (hasTarget()) return;
|
|
58391
58578
|
const candidates = [".json.enc", ".json"].flatMap((suffix) => {
|
|
58392
|
-
const path4 =
|
|
58579
|
+
const path4 = join53(directory, `${session}-${session}${suffix}`);
|
|
58393
58580
|
try {
|
|
58394
58581
|
const stat5 = statSync6(path4);
|
|
58395
58582
|
if (!stat5.isFile()) throw new Error("Saved browser state is not a file.");
|
|
@@ -58424,7 +58611,7 @@ function isMusl(platform = process.platform, exists = existsSync25) {
|
|
|
58424
58611
|
}
|
|
58425
58612
|
function pinnedBinaryPath(dataDir = DATA_DIR, platform = process.platform, arch = process.arch) {
|
|
58426
58613
|
const version2 = agentBrowserReleaseVersion(resolveAgentBrowserReleaseAsset(platform, arch));
|
|
58427
|
-
return
|
|
58614
|
+
return join53(dataDir, ENGINE_DIR, version2, executableName(platform));
|
|
58428
58615
|
}
|
|
58429
58616
|
function onPath(env, platform, exists) {
|
|
58430
58617
|
const pathValue = platform === "win32" ? Object.entries(env).findLast(([key]) => key.toUpperCase() === "PATH")?.[1] : env.PATH;
|
|
@@ -58440,7 +58627,7 @@ function packagedBrowser(options) {
|
|
|
58440
58627
|
const resources = (options.env ?? process.env).OMB_RESOURCES_PATH;
|
|
58441
58628
|
if (!resources) return null;
|
|
58442
58629
|
try {
|
|
58443
|
-
return browserBundlePaths(
|
|
58630
|
+
return browserBundlePaths(join53(resolve12(resources), "browser-engine"), `${options.platform ?? process.platform}-${options.arch ?? process.arch}`);
|
|
58444
58631
|
} catch {
|
|
58445
58632
|
return null;
|
|
58446
58633
|
}
|
|
@@ -58478,7 +58665,7 @@ async function installAgentBrowserBinary(options = {}) {
|
|
|
58478
58665
|
const asset = options.asset ?? resolveAgentBrowserReleaseAsset(platform, options.arch ?? process.arch, options.musl ?? isMusl(platform));
|
|
58479
58666
|
if (!asset) throw new Error(`agent-browser publishes no build for ${platform}-${options.arch ?? process.arch}.`);
|
|
58480
58667
|
const destination = pinnedBinaryPath(options.dataDir, platform, options.arch);
|
|
58481
|
-
const directory =
|
|
58668
|
+
const directory = join53(destination, "..");
|
|
58482
58669
|
mkdirSync26(directory, { recursive: true, mode: 448 });
|
|
58483
58670
|
const url2 = agentBrowserReleaseUrl(asset);
|
|
58484
58671
|
options.log?.(`downloading agent-browser ${agentBrowserReleaseVersion(asset)} (${Math.round(asset.bytes / 1024 / 1024)} MB, digest pinned)`);
|
|
@@ -58521,7 +58708,7 @@ async function installAgentBrowserBinary(options = {}) {
|
|
|
58521
58708
|
for (const name of readdirSync8(directory)) {
|
|
58522
58709
|
if (!name.endsWith(".part")) continue;
|
|
58523
58710
|
try {
|
|
58524
|
-
unlinkSync7(
|
|
58711
|
+
unlinkSync7(join53(directory, name));
|
|
58525
58712
|
} catch {
|
|
58526
58713
|
}
|
|
58527
58714
|
}
|
|
@@ -58580,7 +58767,7 @@ function ensureChrome(binaryPath, options = {}) {
|
|
|
58580
58767
|
});
|
|
58581
58768
|
}
|
|
58582
58769
|
function browserEngineEncryptionKey(dataDir = DATA_DIR) {
|
|
58583
|
-
const file2 =
|
|
58770
|
+
const file2 = join53(dataDir, KEY_FILE);
|
|
58584
58771
|
try {
|
|
58585
58772
|
const existing = readFileSync32(file2, "utf8").trim();
|
|
58586
58773
|
if (/^[0-9a-f]{64}$/u.test(existing)) return existing;
|
|
@@ -58641,7 +58828,7 @@ function agentBrowserIntegration(input) {
|
|
|
58641
58828
|
return { command: input.binaryPath, args: ["mcp", "--tools", "core", "--no-webmcp"], env };
|
|
58642
58829
|
}
|
|
58643
58830
|
function agentBrowserFrame(input) {
|
|
58644
|
-
const file2 =
|
|
58831
|
+
const file2 = join53(tmpdir7(), `openmausbot-browser-${randomUUID17()}.png`);
|
|
58645
58832
|
return new Promise((settle, fail) => {
|
|
58646
58833
|
const child = spawnCommand(input.binaryPath, ["screenshot", file2], {
|
|
58647
58834
|
env: browserRuntimeEnv(input.env),
|
|
@@ -58711,8 +58898,8 @@ async function clearBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58711
58898
|
}
|
|
58712
58899
|
};
|
|
58713
58900
|
try {
|
|
58714
|
-
for (const base3 of bases) for (const suffix of [".json", ".json.enc", ".json.previous", ".json.enc.previous"]) remove(
|
|
58715
|
-
const pendingDirectory =
|
|
58901
|
+
for (const base3 of bases) for (const suffix of [".json", ".json.enc", ".json.previous", ".json.enc.previous"]) remove(join53(directory, base3 + suffix));
|
|
58902
|
+
const pendingDirectory = join53(directory, ".tmp");
|
|
58716
58903
|
let pendingFiles = [];
|
|
58717
58904
|
try {
|
|
58718
58905
|
pendingFiles = readdirSync8(pendingDirectory);
|
|
@@ -58720,8 +58907,8 @@ async function clearBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58720
58907
|
if (error51.code !== "ENOENT") throw error51;
|
|
58721
58908
|
}
|
|
58722
58909
|
const candidates = bases.map((base3) => new RegExp(`^${base3}-candidate-[0-9]+\\.json(?:\\.enc)?$`));
|
|
58723
|
-
for (const name of pendingFiles) if (candidates.some((candidate) => candidate.test(name))) remove(
|
|
58724
|
-
preparedBrowserSessions.delete(
|
|
58910
|
+
for (const name of pendingFiles) if (candidates.some((candidate) => candidate.test(name))) remove(join53(pendingDirectory, name));
|
|
58911
|
+
preparedBrowserSessions.delete(join53(directory, session));
|
|
58725
58912
|
return true;
|
|
58726
58913
|
} catch {
|
|
58727
58914
|
return false;
|
|
@@ -58830,7 +59017,7 @@ import { spawn as spawn10 } from "node:child_process";
|
|
|
58830
59017
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
58831
59018
|
import { closeSync as closeSync6, existsSync as existsSync26, mkdirSync as mkdirSync27, openSync as openSync6, readFileSync as readFileSync33 } from "node:fs";
|
|
58832
59019
|
import { homedir as homedir29 } from "node:os";
|
|
58833
|
-
import { dirname as dirname13, join as
|
|
59020
|
+
import { dirname as dirname13, join as join54, resolve as resolve13 } from "node:path";
|
|
58834
59021
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
58835
59022
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
58836
59023
|
|
|
@@ -62550,7 +62737,7 @@ function parseArgs2(argv, env = process.env) {
|
|
|
62550
62737
|
const options = {
|
|
62551
62738
|
command: command === "--help" || command === "-h" ? "help" : command,
|
|
62552
62739
|
port: Number(env.OMB_PORT || 8799),
|
|
62553
|
-
dataDir: env.OMB_DATA_DIR ||
|
|
62740
|
+
dataDir: env.OMB_DATA_DIR || join54(homedir29(), ".atomic-app"),
|
|
62554
62741
|
tailscale: false,
|
|
62555
62742
|
tunnel: false,
|
|
62556
62743
|
client: false,
|
|
@@ -62689,7 +62876,7 @@ async function isWorkspaceRunning(options) {
|
|
|
62689
62876
|
try {
|
|
62690
62877
|
const { status, body } = await api(options.port, "/api/health");
|
|
62691
62878
|
if (status !== 200 || body?.app !== "openmausbot") return false;
|
|
62692
|
-
const expected = readFileSync33(
|
|
62879
|
+
const expected = readFileSync33(join54(options.dataDir, "environment-id"), "utf8").trim();
|
|
62693
62880
|
const descriptor = await api(options.port, "/.well-known/openmausbot/environment");
|
|
62694
62881
|
return /^[0-9a-f-]{36}$/i.test(expected) && descriptor.status === 200 && descriptor.body?.environmentId === expected;
|
|
62695
62882
|
} catch {
|
|
@@ -62928,7 +63115,7 @@ async function runStatus(options, io2 = defaultIo()) {
|
|
|
62928
63115
|
return code;
|
|
62929
63116
|
}
|
|
62930
63117
|
async function runAccess(options, io2 = defaultIo()) {
|
|
62931
|
-
const file2 =
|
|
63118
|
+
const file2 = join54(options.dataDir, "config.json");
|
|
62932
63119
|
let raw = {};
|
|
62933
63120
|
if (existsSync26(file2)) {
|
|
62934
63121
|
try {
|
|
@@ -63094,16 +63281,16 @@ async function runBrowser(options, io2 = defaultIo()) {
|
|
|
63094
63281
|
return 0;
|
|
63095
63282
|
}
|
|
63096
63283
|
function serverEntry(here = HERE2) {
|
|
63097
|
-
const bundled =
|
|
63284
|
+
const bundled = join54(here, "index.js");
|
|
63098
63285
|
const root = resolve13(here, "..");
|
|
63099
63286
|
if (existsSync26(bundled)) {
|
|
63100
|
-
const staticDir2 = [
|
|
63101
|
-
const skillsDir = existsSync26(
|
|
63287
|
+
const staticDir2 = [join54(root, "dist"), join54(here, "..", "ui")].find((d) => existsSync26(join54(d, "index.html"))) ?? null;
|
|
63288
|
+
const skillsDir = existsSync26(join54(root, "skills")) ? join54(root, "skills") : null;
|
|
63102
63289
|
return { command: process.execPath, args: [bundled], staticDir: staticDir2, skillsDir };
|
|
63103
63290
|
}
|
|
63104
|
-
const source2 =
|
|
63105
|
-
const staticDir = existsSync26(
|
|
63106
|
-
return { command: process.execPath, args: ["--experimental-strip-types", source2], staticDir, skillsDir: existsSync26(
|
|
63291
|
+
const source2 = join54(here, "index.ts");
|
|
63292
|
+
const staticDir = existsSync26(join54(root, "dist", "index.html")) ? join54(root, "dist") : null;
|
|
63293
|
+
return { command: process.execPath, args: ["--experimental-strip-types", source2], staticDir, skillsDir: existsSync26(join54(root, "skills")) ? join54(root, "skills") : null };
|
|
63107
63294
|
}
|
|
63108
63295
|
async function planTunnel(options, log) {
|
|
63109
63296
|
let access2 = null;
|
|
@@ -63146,7 +63333,7 @@ async function runServe(options, log = console.log) {
|
|
|
63146
63333
|
console.error(`something already answers on http://127.0.0.1:${options.port}; use \`chibi pair\` against it, or --port for a second server`);
|
|
63147
63334
|
return 1;
|
|
63148
63335
|
}
|
|
63149
|
-
if (await reportBusyPort(options.port, options.dataDir ===
|
|
63336
|
+
if (await reportBusyPort(options.port, options.dataDir === join54(homedir29(), ".atomic-app") ? "" : ` --data-dir ${options.dataDir}`)) return 1;
|
|
63150
63337
|
let publicUrl = options.publicUrl;
|
|
63151
63338
|
let tailscale = null;
|
|
63152
63339
|
if (options.tailscale) {
|
|
@@ -63208,9 +63395,9 @@ async function runServe(options, log = console.log) {
|
|
|
63208
63395
|
let child;
|
|
63209
63396
|
try {
|
|
63210
63397
|
if (options.guided) {
|
|
63211
|
-
const logsDir =
|
|
63398
|
+
const logsDir = join54(options.dataDir, "logs");
|
|
63212
63399
|
mkdirSync27(logsDir, { recursive: true, mode: 448 });
|
|
63213
|
-
logPath =
|
|
63400
|
+
logPath = join54(logsDir, `server-${Date.now()}-${process.pid}.log`);
|
|
63214
63401
|
logFd = openSync6(logPath, "wx", 384);
|
|
63215
63402
|
log("\nStarting your workspace\u2026");
|
|
63216
63403
|
}
|
|
@@ -63414,7 +63601,7 @@ async function runOnboardingCommand(options, io2 = defaultIo(), startServer = ru
|
|
|
63414
63601
|
saveCliStartup2(options.dataDir, startupPreferences(launch));
|
|
63415
63602
|
}
|
|
63416
63603
|
if (options.command === "setup") {
|
|
63417
|
-
const flags = [options.dataDir !==
|
|
63604
|
+
const flags = [options.dataDir !== join54(homedir29(), ".atomic-app") && ` --data-dir ${options.dataDir}`, options.port !== 8799 && ` --port ${options.port}`].filter(Boolean).join("");
|
|
63418
63605
|
io2.log(`
|
|
63419
63606
|
All set. Start with: chibi${flags ? ` start${flags}` : ""} (or npx @chibitek/chibi without a global install).`);
|
|
63420
63607
|
return 0;
|