@chibitek/chibi 0.1.158 → 0.1.161
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-Bb-Unz3V.js} +1 -1
- package/dist/assets/{arc-CSHQ9Dx3.js → arc-HBMH7B4K.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-BCHM9rXW.js → architectureDiagram-NJMV4G6O-CYwkb2PE.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-B-5uxPFN.js → blockDiagram-BEXU5L5S-DPYYNxBH.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-CuKNM_MR.js → c4Diagram-YGBWAQC7-DZ9hKDlA.js} +1 -1
- package/dist/assets/channel-Nx85fHZ4.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BNF02GM4.js → chunk-2Q5K7J3B-OKrUlts6.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-uEWgBd4M.js → chunk-3FUC2YCW-Tuur0lqz.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-eSZuXctY.js → chunk-5VM5RSS4-BL8QOZeP.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-CslS8nRS.js → chunk-GTNCS2PH-DMi8-ixt.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-w71-MeKj.js → chunk-GWA4HPMP-Dd7yNJ0G.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-Bjju7WGh.js → chunk-JWPE2WC7-g2dOoIMX.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-HxrroD4M.js → chunk-NETBCI7D-Cum7feOh.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-D7Rz470x.js → chunk-WEXAMYUT-BzCC1jc4.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BWKnAeyM.js → chunk-XXDRQBXY-Ck63jUMo.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-CeBDRHmP.js → classDiagram-v2-NBCMYWYE-DFSuRVMZ.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-BBbRKlvr.js → cose-bilkent-JH36ORCC-CegRj_kY.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-W02cnJ0B.js → cynefin-OW5HDTMX-cZS_kt1A.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-Cs47eaxd.js → cynefinDiagram-VND7K2PF-DfQa9Rht.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-8mG18hzT.js → dagre-6A5THRUB-DJ9qftJu.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DF4Qrw67.js → diagram-22UHCM2B-KXUGUahJ.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-3BAVoed1.js → diagram-3UASUU5V-BudCYrCp.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-CKO3pECE.js → diagram-ATOU4E4O-Du2O03NS.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-CZhrGvur.js → diagram-CDSNMT55-DXybXGYf.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-C07l9pdQ.js → diagram-MLGK6HIB-DfrknXGE.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-D3or4lkZ.js → diagram-MPIPVDR6-C29FmaJm.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-DV2epXp_.js → ebnfDiagram-ZINNZB2B-BF9wS0Nz.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-DlvEn4-1.js → elk-276RUBZZ-B2Fah1VF.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-CB6X7Wt5.js → erDiagram-OPXOYQCR-Di3q4bpF.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-C3bqz4lC.js → flowDiagram-KWPJA3E3-D1UiqwbF.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-yo_Evhab.js → ganttDiagram-FUAMR5RP-BjZqMt7o.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-Cq2oUlap.js → gitGraphDiagram-X574FWY7-DiZtdip7.js} +1 -1
- package/dist/assets/index-B2fJMh8N.css +1 -0
- package/dist/assets/{index-CMcr5k3Z.js → index-XFwW09vd.js} +246 -246
- package/dist/assets/{index-CG4AFPb4.js → index-dbQveHan.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-Y3ZrY7qL.js → infoDiagram-VRGFBTTK-BJUJCgio.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-BpOtSfyi.js → ishikawaDiagram-OU5B5YK6-BX0XdHUx.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-UQM727le.js → journeyDiagram-ZHPQQLJL-Bg904IIx.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-C3s5oHpY.js → kanban-definition-PNTS6WVX-hkZMFMHZ.js} +1 -1
- package/dist/assets/{linear-hX6nFOQr.js → linear-Bh29RTbQ.js} +1 -1
- package/dist/assets/{mermaid.core-DZObGLN7.js → mermaid.core-aqB1jW_w.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-Br-i2E3P.js → mindmap-definition-NLK3R4M7-D5GMV-Zd.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-D5SERB-N.js → pegDiagram-GJSIUBJH-7_wFtkFH.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-BPNf4J3D.js → pieDiagram-5QR66LMP-DXtZBQ4f.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-Bm_Wh7Jr.js → quadrantDiagram-O4NWA36T-C1v3ydTF.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-D6bo0abD.js → railroadDiagram-XR7U4H2S-CLmhiOXg.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP--1n5rkV7.js → requirementDiagram-PLB6GJNP-BKxI2rh_.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-Ct4tP2kK.js → sankeyDiagram-IPEJSGJF-gKK-Qs7b.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-CCG7O5fR.js → sequenceDiagram-PO4LG4MO-BT94Uowp.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CJJJra9c.js → sizeCapture-INFHLROL-RDJL6sCM.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-BMdRvVEX.js → stateDiagram-v2-GCMORJYK-DqHMzv-J.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-B1wnogip.js → swimlanes-2SLR337P-B-NN0ql6.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BO2gR34z.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-l-3yhXUP.js → timeline-definition-EJHVYXUP-C51S9tpN.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-DtwtCOoJ.js → usecaseDiagram-POWQR4AR-DyfNMmhq.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-BZAEce1B.js → vennDiagram-UO4OBE2U-D924r33S.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-Na_BCMMO.js → wardleyDiagram-VNRHLVJA-DXSfsjUr.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-BW9dlUfE.js → xychartDiagram-PMCCYNJV-mYX9tnBU.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/container-mcp.js +1 -1
- package/dist-server/index.js +3611 -3082
- package/dist-server/openmausbot.js +370 -162
- package/dist-server/pair-cli.js +370 -162
- 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/checkpoint-recovery.js +18 -0
- package/dist-server/server/drivers/acp/core.js +17 -17
- 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 +44 -4
- 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 +40 -26
- 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
- package/dist-server/connector-proxy.js +0 -205
- package/dist-server/server/composio.js +0 -1051
- package/dist-server/server/connector-proxy.js +0 -249
- package/dist-server/server/mcp-public-registry.js +0 -325
- package/dist-server/shared/connector-availability.js +0 -12
|
@@ -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
|
});
|
|
@@ -25444,6 +25444,19 @@ var init_mcp_tool_ref = __esm({
|
|
|
25444
25444
|
}
|
|
25445
25445
|
});
|
|
25446
25446
|
|
|
25447
|
+
// server/checkpoint-recovery.ts
|
|
25448
|
+
function isBrokenAntigravityCheckpoint(driverKind, message2) {
|
|
25449
|
+
return driverKind === "antigravityAgent" && message2.includes("could not find doneCh for checkpoint");
|
|
25450
|
+
}
|
|
25451
|
+
function isAntigravityCheckpointReply(driverKind, text4) {
|
|
25452
|
+
return driverKind === "antigravityAgent" && /^Agent execution error: could not find doneCh for checkpoint\s*$/.test(text4.trim());
|
|
25453
|
+
}
|
|
25454
|
+
var init_checkpoint_recovery = __esm({
|
|
25455
|
+
"server/checkpoint-recovery.ts"() {
|
|
25456
|
+
"use strict";
|
|
25457
|
+
}
|
|
25458
|
+
});
|
|
25459
|
+
|
|
25447
25460
|
// server/resume-recovery.ts
|
|
25448
25461
|
function classifyResumeFailure(state2) {
|
|
25449
25462
|
if (state2.producedOutput || state2.promptSubmitted) return "after-accept";
|
|
@@ -26428,6 +26441,12 @@ function createAcpDriver(support12) {
|
|
|
26428
26441
|
session.acp.failAll(new Error("turn settled"));
|
|
26429
26442
|
session.current = null;
|
|
26430
26443
|
active.delete(threadId);
|
|
26444
|
+
if (isAntigravityCheckpointReply(DRIVER_KIND8, current.state.text)) {
|
|
26445
|
+
ok = false;
|
|
26446
|
+
stopReason = "invalid_checkpoint";
|
|
26447
|
+
emit({ ...base3(threadId, current.turnId), type: "runtime.error", message: current.state.text.trim() });
|
|
26448
|
+
closeSession(threadId, "invalid-checkpoint");
|
|
26449
|
+
}
|
|
26431
26450
|
current.flushAssistantText();
|
|
26432
26451
|
let finalOk = ok;
|
|
26433
26452
|
let finalStopReason = stopReason;
|
|
@@ -27234,7 +27253,8 @@ ${instructed.text}` : instructed.text;
|
|
|
27234
27253
|
type: "runtime.error",
|
|
27235
27254
|
message: errorMessage
|
|
27236
27255
|
});
|
|
27237
|
-
|
|
27256
|
+
if (isBrokenAntigravityCheckpoint(DRIVER_KIND8, errorMessage)) closeSession(threadId, "invalid-checkpoint");
|
|
27257
|
+
settle(threadId, session, false, isBrokenAntigravityCheckpoint(DRIVER_KIND8, errorMessage) ? "invalid_checkpoint" : reason ?? "failed");
|
|
27238
27258
|
}
|
|
27239
27259
|
} catch (e) {
|
|
27240
27260
|
if (!state2.settled) {
|
|
@@ -27251,10 +27271,10 @@ ${instructed.text}` : instructed.text;
|
|
|
27251
27271
|
...needsAuth ? { setup: true } : {},
|
|
27252
27272
|
...failure ? { failure } : {}
|
|
27253
27273
|
});
|
|
27254
|
-
if ((logAuth || !needsAuth && (stalled || e?.acpSessionFailure === true || code === "upstream_outage")) && session.child.exitCode === null && !session.closing) {
|
|
27274
|
+
if ((logAuth || !needsAuth && (stalled || isBrokenAntigravityCheckpoint(DRIVER_KIND8, message2) || e?.acpSessionFailure === true || code === "upstream_outage")) && session.child.exitCode === null && !session.closing) {
|
|
27255
27275
|
closeSession(threadId, logAuth ? "provider-auth" : stalled ? "prompt-stall" : "rpc-failure");
|
|
27256
27276
|
}
|
|
27257
|
-
settle(threadId, session, false, needsAuth ? "auth_required" : "rpc_error");
|
|
27277
|
+
settle(threadId, session, false, needsAuth ? "auth_required" : isBrokenAntigravityCheckpoint(DRIVER_KIND8, message2) ? "invalid_checkpoint" : "rpc_error");
|
|
27258
27278
|
}
|
|
27259
27279
|
}
|
|
27260
27280
|
})();
|
|
@@ -27343,6 +27363,7 @@ var init_core3 = __esm({
|
|
|
27343
27363
|
init_mcp_tool_images();
|
|
27344
27364
|
init_mcp_tool_ref();
|
|
27345
27365
|
init_redact2();
|
|
27366
|
+
init_checkpoint_recovery();
|
|
27346
27367
|
init_resume_recovery();
|
|
27347
27368
|
init_retry();
|
|
27348
27369
|
init_engine_failure();
|
|
@@ -28785,6 +28806,20 @@ var init_boxagent = __esm({
|
|
|
28785
28806
|
}
|
|
28786
28807
|
});
|
|
28787
28808
|
|
|
28809
|
+
// server/drivers/claude-message.ts
|
|
28810
|
+
function firstText(content) {
|
|
28811
|
+
if (typeof content === "string") return content;
|
|
28812
|
+
if (Array.isArray(content)) {
|
|
28813
|
+
return content.filter((b3) => b3?.type === "text" && b3.text).map((b3) => b3.text).join("");
|
|
28814
|
+
}
|
|
28815
|
+
return "";
|
|
28816
|
+
}
|
|
28817
|
+
var init_claude_message = __esm({
|
|
28818
|
+
"server/drivers/claude-message.ts"() {
|
|
28819
|
+
"use strict";
|
|
28820
|
+
}
|
|
28821
|
+
});
|
|
28822
|
+
|
|
28788
28823
|
// server/claude-account-connectors.ts
|
|
28789
28824
|
function parseClaudeMcpList(output) {
|
|
28790
28825
|
const found = [];
|
|
@@ -29801,13 +29836,6 @@ function decodeConfig2(raw) {
|
|
|
29801
29836
|
...disallowedTools !== void 0 ? { disallowedTools } : {}
|
|
29802
29837
|
};
|
|
29803
29838
|
}
|
|
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
29839
|
function claudeUserMessage(text4, images) {
|
|
29812
29840
|
if (!images?.length) return { type: "user", message: { role: "user", content: text4 } };
|
|
29813
29841
|
const content = images.map((image) => ({
|
|
@@ -29843,6 +29871,7 @@ var CONNECTOR_CACHE_MS, CLAUDE_ACCOUNT_ENV_KEYS, DEFAULT_AUTOCOMPACT_TOKENS, CLA
|
|
|
29843
29871
|
var init_claude = __esm({
|
|
29844
29872
|
"server/drivers/claude.ts"() {
|
|
29845
29873
|
"use strict";
|
|
29874
|
+
init_claude_message();
|
|
29846
29875
|
init_config();
|
|
29847
29876
|
init_atomic();
|
|
29848
29877
|
init_env_path();
|
|
@@ -30548,7 +30577,7 @@ var init_claude = __esm({
|
|
|
30548
30577
|
if (delivered && delivered.sessionId === session.sessionId) delivered.sessionId = o.session_id;
|
|
30549
30578
|
session.sessionId = o.session_id;
|
|
30550
30579
|
}
|
|
30551
|
-
emit({ ...base3(threadId, currentTurnId()), type: "session.started", sessionId: o.session_id, model: o.model, ...retry.rebuilt ? { rebuilt: true } : {} });
|
|
30580
|
+
emit({ ...base3(threadId, currentTurnId()), type: "session.started", sessionId: o.session_id, model: o.model, modelEvidenceLevel: "session-reported", ...retry.rebuilt ? { rebuilt: true } : {} });
|
|
30552
30581
|
} else if (o.subtype === "compact_boundary") {
|
|
30553
30582
|
deliveredVolatile.delete(threadId);
|
|
30554
30583
|
} else if (o.subtype === "thinking_tokens") {
|
|
@@ -30573,6 +30602,16 @@ var init_claude = __esm({
|
|
|
30573
30602
|
}
|
|
30574
30603
|
case "assistant": {
|
|
30575
30604
|
const msg = o.message ?? {};
|
|
30605
|
+
if (o.is_api_error_message !== true && typeof o.error !== "string") {
|
|
30606
|
+
emit({
|
|
30607
|
+
...base3(threadId, currentTurnId()),
|
|
30608
|
+
type: "model.evidence",
|
|
30609
|
+
callId: typeof msg.id === "string" ? msg.id : newId(),
|
|
30610
|
+
responseId: typeof msg.id === "string" ? msg.id : void 0,
|
|
30611
|
+
model: typeof msg.model === "string" ? msg.model : null,
|
|
30612
|
+
level: typeof msg.model === "string" ? "response-reported" : "unknown"
|
|
30613
|
+
});
|
|
30614
|
+
}
|
|
30576
30615
|
const text4 = firstText(msg.content);
|
|
30577
30616
|
if (claudeAuthFailure(o, text4)) {
|
|
30578
30617
|
if (session.turn) session.turn.authFailed = true;
|
|
@@ -31360,6 +31399,163 @@ var init_codex_personal = __esm({
|
|
|
31360
31399
|
}
|
|
31361
31400
|
});
|
|
31362
31401
|
|
|
31402
|
+
// server/drivers/codex-image.ts
|
|
31403
|
+
import { mkdtemp as mkdtemp3, rm as rm4 } from "node:fs/promises";
|
|
31404
|
+
import { tmpdir as tmpdir4 } from "node:os";
|
|
31405
|
+
import { join as join27 } from "node:path";
|
|
31406
|
+
async function codexImage(cli, env, prompt, signal, diagnostic, model) {
|
|
31407
|
+
signal.throwIfAborted();
|
|
31408
|
+
const cwd = await mkdtemp3(join27(tmpdir4(), "atomic-avatar-"));
|
|
31409
|
+
const args = [
|
|
31410
|
+
"app-server",
|
|
31411
|
+
...codexToolSurfaceArgs(),
|
|
31412
|
+
...codexUserMcpOffArgs(codexConfigMcpServers(env, cwd)),
|
|
31413
|
+
...codexPersonalSetupOffArgs(env, cwd),
|
|
31414
|
+
...["shell_tool", "unified_exec", "view_image", "apps", "multi_agent", "multi_agent_v2", "code_mode"].flatMap((name) => ["-c", `features.${name}=false`]),
|
|
31415
|
+
"-c",
|
|
31416
|
+
"features.image_generation=true",
|
|
31417
|
+
"-c",
|
|
31418
|
+
'web_search="disabled"',
|
|
31419
|
+
"-c",
|
|
31420
|
+
'model_provider="openai"',
|
|
31421
|
+
"-c",
|
|
31422
|
+
'forced_login_method="chatgpt"',
|
|
31423
|
+
"-c",
|
|
31424
|
+
"project_doc_max_bytes=0"
|
|
31425
|
+
];
|
|
31426
|
+
let child;
|
|
31427
|
+
try {
|
|
31428
|
+
child = spawnCli(cli, args, { cwd, env, stdio: ["pipe", "pipe", "pipe"] });
|
|
31429
|
+
} catch {
|
|
31430
|
+
await rm4(cwd, { recursive: true, force: true });
|
|
31431
|
+
throw new Error("Could not start image generation.");
|
|
31432
|
+
}
|
|
31433
|
+
const pending = /* @__PURE__ */ new Map();
|
|
31434
|
+
let nextId = 0, buffer = "", image, done = false;
|
|
31435
|
+
let resolveImage;
|
|
31436
|
+
let rejectImage;
|
|
31437
|
+
const result = new Promise((resolve14, reject) => {
|
|
31438
|
+
resolveImage = resolve14;
|
|
31439
|
+
rejectImage = reject;
|
|
31440
|
+
});
|
|
31441
|
+
void result.catch(() => {
|
|
31442
|
+
});
|
|
31443
|
+
const fail = () => {
|
|
31444
|
+
const error51 = new Error("Codex image generation did not complete.");
|
|
31445
|
+
for (const waiter of pending.values()) waiter.reject(error51);
|
|
31446
|
+
pending.clear();
|
|
31447
|
+
if (!done) rejectImage(error51);
|
|
31448
|
+
done = true;
|
|
31449
|
+
};
|
|
31450
|
+
const send = (message2) => {
|
|
31451
|
+
child.stdin.write(JSON.stringify(message2) + "\n", (error51) => {
|
|
31452
|
+
if (error51) fail();
|
|
31453
|
+
});
|
|
31454
|
+
};
|
|
31455
|
+
const request = (method, params) => new Promise((resolve14, reject) => {
|
|
31456
|
+
if (done) {
|
|
31457
|
+
reject(new Error("Image session ended."));
|
|
31458
|
+
return;
|
|
31459
|
+
}
|
|
31460
|
+
const id = ++nextId;
|
|
31461
|
+
pending.set(id, { resolve: resolve14, reject });
|
|
31462
|
+
send({ id, method, params });
|
|
31463
|
+
});
|
|
31464
|
+
child.on("error", fail);
|
|
31465
|
+
child.on("exit", fail);
|
|
31466
|
+
child.stdin.on("error", fail);
|
|
31467
|
+
child.stderr.resume();
|
|
31468
|
+
child.stdout.setEncoding("utf8");
|
|
31469
|
+
child.stdout.on("data", (chunk) => {
|
|
31470
|
+
buffer += chunk;
|
|
31471
|
+
if (Buffer.byteLength(buffer) > 32 * 1024 * 1024) {
|
|
31472
|
+
fail();
|
|
31473
|
+
return;
|
|
31474
|
+
}
|
|
31475
|
+
for (; ; ) {
|
|
31476
|
+
const newline = buffer.indexOf("\n");
|
|
31477
|
+
if (newline < 0) break;
|
|
31478
|
+
const line = buffer.slice(0, newline);
|
|
31479
|
+
buffer = buffer.slice(newline + 1);
|
|
31480
|
+
try {
|
|
31481
|
+
const message2 = JSON.parse(line);
|
|
31482
|
+
if (message2.method === "item/completed" || message2.method === "turn/completed") diagnostic?.({
|
|
31483
|
+
method: message2.method,
|
|
31484
|
+
itemType: message2.params?.item?.type,
|
|
31485
|
+
status: message2.params?.turn?.status ?? message2.params?.item?.status,
|
|
31486
|
+
imageBytes: message2.params?.item?.type === "imageGeneration" ? message2.params.item.result?.length ?? 0 : void 0,
|
|
31487
|
+
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
|
|
31488
|
+
});
|
|
31489
|
+
if (message2.method && message2.id !== void 0) {
|
|
31490
|
+
send({ id: message2.id, error: { code: -32601, message: "Not available in avatar generation." } });
|
|
31491
|
+
fail();
|
|
31492
|
+
return;
|
|
31493
|
+
}
|
|
31494
|
+
if (message2.id !== void 0) {
|
|
31495
|
+
const waiter = pending.get(message2.id);
|
|
31496
|
+
pending.delete(message2.id);
|
|
31497
|
+
if (message2.error) waiter?.reject(new Error("Codex image request failed."));
|
|
31498
|
+
else waiter?.resolve(message2.result);
|
|
31499
|
+
} else if (message2.method === "item/completed" && message2.params?.item?.type === "imageGeneration") {
|
|
31500
|
+
const item = message2.params.item;
|
|
31501
|
+
if (item.status !== "failed" && typeof item.result === "string") image = item.result;
|
|
31502
|
+
} else if (message2.method === "turn/completed") {
|
|
31503
|
+
if (message2.params?.turn?.status !== "completed" || !image) {
|
|
31504
|
+
fail();
|
|
31505
|
+
return;
|
|
31506
|
+
}
|
|
31507
|
+
done = true;
|
|
31508
|
+
resolveImage(image);
|
|
31509
|
+
}
|
|
31510
|
+
} catch {
|
|
31511
|
+
fail();
|
|
31512
|
+
return;
|
|
31513
|
+
}
|
|
31514
|
+
}
|
|
31515
|
+
});
|
|
31516
|
+
signal.addEventListener("abort", fail, { once: true });
|
|
31517
|
+
try {
|
|
31518
|
+
if (signal.aborted) fail();
|
|
31519
|
+
await request("initialize", { clientInfo: { name: "atomic_avatar", version: "1" }, capabilities: { experimentalApi: true } });
|
|
31520
|
+
send({ method: "initialized", params: {} });
|
|
31521
|
+
const catalog2 = await request("model/list", { limit: 100 });
|
|
31522
|
+
const choices = Array.isArray(catalog2.data) ? catalog2.data.filter((item) => item && item.hidden !== true && (typeof item.model === "string" || typeof item.id === "string")) : [];
|
|
31523
|
+
const choice = choices.find((item) => item.id === model || item.model === model) ?? choices.find((item) => item.isDefault) ?? choices[0];
|
|
31524
|
+
if (!choice) throw new Error("No subscription image model is available.");
|
|
31525
|
+
const started = await request("thread/start", {
|
|
31526
|
+
cwd,
|
|
31527
|
+
model: choice.model ?? choice.id,
|
|
31528
|
+
modelProvider: "openai",
|
|
31529
|
+
ephemeral: true,
|
|
31530
|
+
approvalPolicy: "never",
|
|
31531
|
+
sandbox: "read-only",
|
|
31532
|
+
developerInstructions: "Generate exactly one image with the native image generation tool. Do not run commands, read files, use other tools or ask for credentials."
|
|
31533
|
+
});
|
|
31534
|
+
if (typeof started.thread?.id !== "string") throw new Error("Missing image session.");
|
|
31535
|
+
await request("turn/start", {
|
|
31536
|
+
threadId: started.thread.id,
|
|
31537
|
+
input: [{ type: "text", text: prompt }],
|
|
31538
|
+
approvalPolicy: "never",
|
|
31539
|
+
sandboxPolicy: { type: "readOnly" }
|
|
31540
|
+
});
|
|
31541
|
+
return await result;
|
|
31542
|
+
} finally {
|
|
31543
|
+
signal.removeEventListener("abort", fail);
|
|
31544
|
+
fail();
|
|
31545
|
+
const stopped = await killCliTree(child);
|
|
31546
|
+
if (stopped) await rm4(cwd, { recursive: true, force: true });
|
|
31547
|
+
}
|
|
31548
|
+
}
|
|
31549
|
+
var init_codex_image = __esm({
|
|
31550
|
+
"server/drivers/codex-image.ts"() {
|
|
31551
|
+
"use strict";
|
|
31552
|
+
init_procs();
|
|
31553
|
+
init_codex_mcp_names();
|
|
31554
|
+
init_codex_personal();
|
|
31555
|
+
init_codex_tool_surface();
|
|
31556
|
+
}
|
|
31557
|
+
});
|
|
31558
|
+
|
|
31363
31559
|
// server/mcp-remote-bridge.ts
|
|
31364
31560
|
var init_mcp_remote_bridge = __esm({
|
|
31365
31561
|
"server/mcp-remote-bridge.ts"() {
|
|
@@ -31400,7 +31596,7 @@ var init_mcp_tool_hints = __esm({
|
|
|
31400
31596
|
// server/drivers/codex-catalog.ts
|
|
31401
31597
|
import { readdirSync as readdirSync5, readFileSync as readFileSync12 } from "node:fs";
|
|
31402
31598
|
import { homedir as homedir12 } from "node:os";
|
|
31403
|
-
import { basename as basename7, join as
|
|
31599
|
+
import { basename as basename7, join as join28 } from "node:path";
|
|
31404
31600
|
function encodeCodexSelection(provider, model) {
|
|
31405
31601
|
return `${provider}${SEP}${model}`;
|
|
31406
31602
|
}
|
|
@@ -31516,7 +31712,7 @@ function readCodexAppServerModelCatalog(cli, env, timeoutMs = 8e3) {
|
|
|
31516
31712
|
}
|
|
31517
31713
|
function codexHome(env) {
|
|
31518
31714
|
if (env.CODEX_HOME) return env.CODEX_HOME;
|
|
31519
|
-
return
|
|
31715
|
+
return join28(env.HOME || env.USERPROFILE || homedir12(), ".codex");
|
|
31520
31716
|
}
|
|
31521
31717
|
function unquote(raw) {
|
|
31522
31718
|
let value = raw.trim();
|
|
@@ -31602,11 +31798,11 @@ function niceLabel(model, provider, known, named) {
|
|
|
31602
31798
|
}
|
|
31603
31799
|
function collectCatalogNames(home) {
|
|
31604
31800
|
const named = /* @__PURE__ */ new Map();
|
|
31605
|
-
for (const file2 of listDir(
|
|
31801
|
+
for (const file2 of listDir(join28(home, "model-catalogs"))) {
|
|
31606
31802
|
if (!file2.endsWith(".json")) continue;
|
|
31607
31803
|
const provider = basename7(file2, ".json").replace(/-models$/, "");
|
|
31608
31804
|
if (!PROVIDER_ID.test(provider)) continue;
|
|
31609
|
-
const raw = readText(
|
|
31805
|
+
const raw = readText(join28(home, "model-catalogs", file2));
|
|
31610
31806
|
if (!raw) continue;
|
|
31611
31807
|
let parsed;
|
|
31612
31808
|
try {
|
|
@@ -31658,7 +31854,7 @@ async function probeProviderModels(provider, env, fetchImpl) {
|
|
|
31658
31854
|
async function readCodexModelCatalog(env = process.env, fetchImpl = fetch, cli) {
|
|
31659
31855
|
const official = (cli ? await readCodexAppServerModelCatalog(cli, env) : null) ?? STATIC_CODEX_MODELS;
|
|
31660
31856
|
const home = codexHome(env);
|
|
31661
|
-
const mainText = readText(
|
|
31857
|
+
const mainText = readText(join28(home, "config.toml"));
|
|
31662
31858
|
if (!mainText) return mergeLocalInject(official, env, fetchImpl);
|
|
31663
31859
|
const main2 = parseCodexToml(mainText);
|
|
31664
31860
|
const known = new Map(main2.providers.map((provider) => [provider.id, provider]));
|
|
@@ -31673,7 +31869,7 @@ async function readCodexModelCatalog(env = process.env, fetchImpl = fetch, cli)
|
|
|
31673
31869
|
remember(main2.modelProvider, main2.model);
|
|
31674
31870
|
for (const file2 of listDir(home)) {
|
|
31675
31871
|
if (!file2.endsWith(".config.toml")) continue;
|
|
31676
|
-
const profile = parseCodexToml(readText(
|
|
31872
|
+
const profile = parseCodexToml(readText(join28(home, file2)) ?? "");
|
|
31677
31873
|
for (const provider of profile.providers) {
|
|
31678
31874
|
if (!known.has(provider.id)) known.set(provider.id, provider);
|
|
31679
31875
|
}
|
|
@@ -31740,7 +31936,7 @@ var init_codex_catalog = __esm({
|
|
|
31740
31936
|
// server/drivers/codex-instructions.ts
|
|
31741
31937
|
import { createHash as createHash8 } from "node:crypto";
|
|
31742
31938
|
import { mkdirSync as mkdirSync13, readFileSync as readFileSync13 } from "node:fs";
|
|
31743
|
-
import { join as
|
|
31939
|
+
import { join as join29 } from "node:path";
|
|
31744
31940
|
function codexDeveloperInstructions(config2, botInstructions) {
|
|
31745
31941
|
if (!config2 || typeof config2 !== "object" || Array.isArray(config2)) {
|
|
31746
31942
|
throw new Error("Codex returned no effective configuration; cannot safely update bot instructions.");
|
|
@@ -31754,8 +31950,8 @@ function codexDeveloperInstructions(config2, botInstructions) {
|
|
|
31754
31950
|
${configured}` : botInstructions;
|
|
31755
31951
|
}
|
|
31756
31952
|
async function syncCodexInstructions(key, nativeThreadId, instructions, resumed, request) {
|
|
31757
|
-
const directory =
|
|
31758
|
-
const path4 =
|
|
31953
|
+
const directory = join29(DATA_DIR, "codex-instructions");
|
|
31954
|
+
const path4 = join29(directory, `${digest(JSON.stringify([key, nativeThreadId]))}.sha256`);
|
|
31759
31955
|
const fingerprint2 = digest(instructions);
|
|
31760
31956
|
let previous;
|
|
31761
31957
|
try {
|
|
@@ -31802,14 +31998,14 @@ var init_codex_instructions = __esm({
|
|
|
31802
31998
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
31803
31999
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
31804
32000
|
import { homedir as homedir13 } from "node:os";
|
|
31805
|
-
import { basename as basename8, dirname as dirname10, isAbsolute as isAbsolute6, join as
|
|
32001
|
+
import { basename as basename8, dirname as dirname10, isAbsolute as isAbsolute6, join as join30, resolve as resolve9 } from "node:path";
|
|
31806
32002
|
import { stripVTControlCharacters as stripVTControlCharacters6 } from "node:util";
|
|
31807
32003
|
function canonicalPath2(path4) {
|
|
31808
32004
|
try {
|
|
31809
32005
|
return realpathSync2(path4);
|
|
31810
32006
|
} catch {
|
|
31811
32007
|
const parent = dirname10(path4);
|
|
31812
|
-
return parent === path4 ? path4 :
|
|
32008
|
+
return parent === path4 ? path4 : join30(canonicalPath2(parent), basename8(path4));
|
|
31813
32009
|
}
|
|
31814
32010
|
}
|
|
31815
32011
|
function codexDevicePrompt(output) {
|
|
@@ -31860,7 +32056,7 @@ var init_codex_device_auth = __esm({
|
|
|
31860
32056
|
if (!isAbsolute6(home) || env.CODEX_HOME && !isAbsolute6(env.CODEX_HOME)) {
|
|
31861
32057
|
throw new Error("Use an absolute HOME and CODEX_HOME path for this server's Codex provider before signing in.");
|
|
31862
32058
|
}
|
|
31863
|
-
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME ||
|
|
32059
|
+
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME || join30(home, ".codex")));
|
|
31864
32060
|
if (authenticatingHomes2.has(homeKey)) {
|
|
31865
32061
|
throw new Error("A ChatGPT sign-in is already running for this server account. Finish or cancel it before starting another.");
|
|
31866
32062
|
}
|
|
@@ -31939,7 +32135,7 @@ var init_codex_device_auth = __esm({
|
|
|
31939
32135
|
if (!isAbsolute6(home) || env.CODEX_HOME && !isAbsolute6(env.CODEX_HOME)) {
|
|
31940
32136
|
throw new Error("Use an absolute HOME and CODEX_HOME path for this server's Codex provider before signing out.");
|
|
31941
32137
|
}
|
|
31942
|
-
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME ||
|
|
32138
|
+
const homeKey = canonicalPath2(resolve9(env.CODEX_HOME || join30(home, ".codex")));
|
|
31943
32139
|
if (authenticatingHomes2.has(homeKey)) {
|
|
31944
32140
|
throw new Error("A ChatGPT sign-in is running for this server account. Finish or cancel it before signing out.");
|
|
31945
32141
|
}
|
|
@@ -32098,11 +32294,11 @@ var init_codex_device_auth = __esm({
|
|
|
32098
32294
|
|
|
32099
32295
|
// server/drivers/codex-identity.ts
|
|
32100
32296
|
import { homedir as homedir14 } from "node:os";
|
|
32101
|
-
import { isAbsolute as isAbsolute7, join as
|
|
32297
|
+
import { isAbsolute as isAbsolute7, join as join31, resolve as resolve10 } from "node:path";
|
|
32102
32298
|
function codexHome2(env) {
|
|
32103
32299
|
if (env.CODEX_HOME) return isAbsolute7(env.CODEX_HOME) ? resolve10(env.CODEX_HOME) : null;
|
|
32104
32300
|
const home = env.HOME || env.USERPROFILE || homedir14();
|
|
32105
|
-
return isAbsolute7(home) ?
|
|
32301
|
+
return isAbsolute7(home) ? join31(home, ".codex") : null;
|
|
32106
32302
|
}
|
|
32107
32303
|
async function codexAccountEmail(cli, env, timeoutMs = 3e3) {
|
|
32108
32304
|
const cwd = env.HOME || env.USERPROFILE || homedir14();
|
|
@@ -32564,6 +32760,7 @@ var init_codex = __esm({
|
|
|
32564
32760
|
"server/drivers/codex.ts"() {
|
|
32565
32761
|
"use strict";
|
|
32566
32762
|
init_codex_tool_surface();
|
|
32763
|
+
init_codex_image();
|
|
32567
32764
|
init_codex_personal();
|
|
32568
32765
|
init_codex_mcp_names();
|
|
32569
32766
|
init_config();
|
|
@@ -33345,7 +33542,7 @@ var init_codex = __esm({
|
|
|
33345
33542
|
}
|
|
33346
33543
|
if (!codexThreadId) throw new Error("Codex did not return a native thread id");
|
|
33347
33544
|
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 } : {} });
|
|
33545
|
+
emit({ ...base3(threadId, turnId), type: "session.started", sessionId: codexThreadId, model: startedModel ?? turn.model ?? null, modelEvidenceLevel: startedModel ? "session-reported" : "requested-only", ...rebuiltFromReplay ? { rebuilt: true } : {} });
|
|
33349
33546
|
const note = turn.systemStable !== void 0 ? volatileNoteFor(threadId, codexThreadId, !resumedNativeThread || rebuiltFromReplay, turn) : "";
|
|
33350
33547
|
const inputText = withNote(promptText, note);
|
|
33351
33548
|
const turnInput = [
|
|
@@ -33467,6 +33664,7 @@ ${status.stderr}`)) {
|
|
|
33467
33664
|
cancelAuthentication: () => authentication.cancel(),
|
|
33468
33665
|
signOut: () => authentication.signOut(),
|
|
33469
33666
|
snapshot,
|
|
33667
|
+
...!config2.managed ? { generateImage: (prompt, options) => codexImage(config2.cli, childEnv(), prompt, options.signal, void 0, decodeCodexSelection(models2.default).model ?? void 0) } : {},
|
|
33470
33668
|
adapter: {
|
|
33471
33669
|
provider: DRIVER_KIND3,
|
|
33472
33670
|
capabilities: {
|
|
@@ -41572,7 +41770,7 @@ import {
|
|
|
41572
41770
|
unlinkSync as unlinkSync4,
|
|
41573
41771
|
writeFileSync as writeFileSync9
|
|
41574
41772
|
} from "node:fs";
|
|
41575
|
-
import { dirname as dirname11, join as
|
|
41773
|
+
import { dirname as dirname11, join as join32 } from "node:path";
|
|
41576
41774
|
function hasCode(error51, code) {
|
|
41577
41775
|
return error51 instanceof Error && "code" in error51 && error51.code === code;
|
|
41578
41776
|
}
|
|
@@ -41593,13 +41791,13 @@ function readEnvironmentId(file2) {
|
|
|
41593
41791
|
return id;
|
|
41594
41792
|
}
|
|
41595
41793
|
function loadEnvironmentId(dataDir) {
|
|
41596
|
-
const file2 =
|
|
41794
|
+
const file2 = join32(dataDir, "environment-id");
|
|
41597
41795
|
const existing = readEnvironmentId(file2);
|
|
41598
41796
|
if (existing) return existing;
|
|
41599
41797
|
const directory = dirname11(file2);
|
|
41600
41798
|
mkdirSync14(directory, { recursive: true, mode: 448 });
|
|
41601
41799
|
const id = randomUUID10();
|
|
41602
|
-
const temporaryFile =
|
|
41800
|
+
const temporaryFile = join32(directory, `.environment-id.${process.pid}.${randomUUID10()}.tmp`);
|
|
41603
41801
|
let descriptor;
|
|
41604
41802
|
try {
|
|
41605
41803
|
descriptor = openSync5(temporaryFile, "wx", 384);
|
|
@@ -41636,7 +41834,7 @@ var init_environment = __esm({
|
|
|
41636
41834
|
// server/box-create-idempotency.ts
|
|
41637
41835
|
import { createHash as createHash9, randomUUID as randomUUID11 } from "node:crypto";
|
|
41638
41836
|
import { linkSync as linkSync3, mkdirSync as mkdirSync15, readFileSync as readFileSync16, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "node:fs";
|
|
41639
|
-
import { join as
|
|
41837
|
+
import { join as join33 } from "node:path";
|
|
41640
41838
|
function isRequest(value) {
|
|
41641
41839
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
41642
41840
|
const request = value;
|
|
@@ -41895,8 +42093,8 @@ var init_box_create_idempotency = __esm({
|
|
|
41895
42093
|
"use strict";
|
|
41896
42094
|
init_atomic();
|
|
41897
42095
|
init_config();
|
|
41898
|
-
FILE =
|
|
41899
|
-
LOCK_FILE =
|
|
42096
|
+
FILE = join33(DATA_DIR, "box-create-requests.json");
|
|
42097
|
+
LOCK_FILE = join33(DATA_DIR, "box-create-requests.lock");
|
|
41900
42098
|
KEY_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
41901
42099
|
MAX_REQUESTS = 4096;
|
|
41902
42100
|
LOCK_WAIT_MS = 2e3;
|
|
@@ -41912,7 +42110,7 @@ var init_box_create_idempotency = __esm({
|
|
|
41912
42110
|
// server/box-delete-journal.ts
|
|
41913
42111
|
import { createHash as createHash10, randomUUID as randomUUID12 } from "node:crypto";
|
|
41914
42112
|
import { linkSync as linkSync4, mkdirSync as mkdirSync16, readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
41915
|
-
import { join as
|
|
42113
|
+
import { join as join34 } from "node:path";
|
|
41916
42114
|
function validTimestamp(value) {
|
|
41917
42115
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
41918
42116
|
}
|
|
@@ -42160,8 +42358,8 @@ var init_box_delete_journal = __esm({
|
|
|
42160
42358
|
"use strict";
|
|
42161
42359
|
init_atomic();
|
|
42162
42360
|
init_config();
|
|
42163
|
-
FILE2 =
|
|
42164
|
-
LOCK_FILE2 =
|
|
42361
|
+
FILE2 = join34(DATA_DIR, "box-delete-requests.json");
|
|
42362
|
+
LOCK_FILE2 = join34(DATA_DIR, "box-delete-requests.lock");
|
|
42165
42363
|
MAX_RECORDS = 4096;
|
|
42166
42364
|
LOCK_WAIT_MS2 = 2e3;
|
|
42167
42365
|
LOCK_RETRY_MS2 = 20;
|
|
@@ -43152,7 +43350,7 @@ function createOpenAIChatRuntime(options) {
|
|
|
43152
43350
|
turnId,
|
|
43153
43351
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
43154
43352
|
});
|
|
43155
|
-
const complete = async (messages, model, stream, signal, onDelta, tools = []) => {
|
|
43353
|
+
const complete = async (messages, model, stream, signal, onDelta, tools = [], onIdentity) => {
|
|
43156
43354
|
const timeoutController = new AbortController();
|
|
43157
43355
|
let idleTimer = null;
|
|
43158
43356
|
const resetIdleTimer = () => {
|
|
@@ -43182,6 +43380,7 @@ function createOpenAIChatRuntime(options) {
|
|
|
43182
43380
|
const json2 = await response.json();
|
|
43183
43381
|
const bodyError = providerError(json2);
|
|
43184
43382
|
if (bodyError) throw new ChatProtocolError(`provider returned a completion error: ${bodyError.slice(0, 200)}`);
|
|
43383
|
+
onIdentity?.(typeof json2.model === "string" ? json2.model : null, typeof json2.id === "string" ? json2.id : void 0);
|
|
43185
43384
|
const message2 = json2.choices?.[0]?.message;
|
|
43186
43385
|
if (!message2 || !object3(message2) || !["content", "reasoning_content", "reasoning", "reasoning_details", "tool_calls", "function_call"].some((key) => key in message2)) {
|
|
43187
43386
|
throw new ChatProtocolError("provider returned no completion message");
|
|
@@ -43232,6 +43431,7 @@ function createOpenAIChatRuntime(options) {
|
|
|
43232
43431
|
}
|
|
43233
43432
|
const chunkError = providerError(chunk);
|
|
43234
43433
|
if (chunkError) throw new ChatProtocolError(`provider returned a streaming completion error: ${chunkError.slice(0, 200)}`);
|
|
43434
|
+
onIdentity?.(typeof chunk.model === "string" ? chunk.model : null, typeof chunk.id === "string" ? chunk.id : void 0);
|
|
43235
43435
|
const choice = chunk.choices?.find((row) => row.index === void 0 || row.index === 0);
|
|
43236
43436
|
const delta = choice?.delta;
|
|
43237
43437
|
if (object3(delta)) sawChoice = true;
|
|
@@ -43398,10 +43598,18 @@ function createOpenAIChatRuntime(options) {
|
|
|
43398
43598
|
if (visible) emit({ ...base3(turn.threadId, turnId), type: "content.delta", streamKind, delta: visible });
|
|
43399
43599
|
};
|
|
43400
43600
|
try {
|
|
43601
|
+
const callId = newId();
|
|
43602
|
+
emit({ ...base3(turn.threadId, turnId), type: "model.call", callId });
|
|
43603
|
+
let previousIdentity = "";
|
|
43401
43604
|
completion = await complete(messages, model, true, abort.signal, (text4, streamKind) => {
|
|
43402
43605
|
streamed = true;
|
|
43403
43606
|
delta(text4, streamKind);
|
|
43404
|
-
}, tools.definitions)
|
|
43607
|
+
}, tools.definitions, (reportedModel, responseId) => {
|
|
43608
|
+
const identity = JSON.stringify([reportedModel, responseId]);
|
|
43609
|
+
if (identity === previousIdentity) return;
|
|
43610
|
+
previousIdentity = identity;
|
|
43611
|
+
emit({ ...base3(turn.threadId, turnId), type: "model.evidence", callId, model: reportedModel, responseId, level: reportedModel ? "response-reported" : "unknown" });
|
|
43612
|
+
});
|
|
43405
43613
|
delta("", "assistant_text", true);
|
|
43406
43614
|
delta("", "reasoning_text", true);
|
|
43407
43615
|
break;
|
|
@@ -43685,7 +43893,7 @@ var init_grok = __esm({
|
|
|
43685
43893
|
// server/drivers/acp/grok.ts
|
|
43686
43894
|
import { existsSync as existsSync16, readFileSync as readFileSync18, writeFileSync as writeFileSync12 } from "node:fs";
|
|
43687
43895
|
import { homedir as homedir16 } from "node:os";
|
|
43688
|
-
import { join as
|
|
43896
|
+
import { join as join35 } from "node:path";
|
|
43689
43897
|
function decodeGrokModelText(text4) {
|
|
43690
43898
|
if (/\bnot authenticated\b/i.test(text4)) return null;
|
|
43691
43899
|
const options = [];
|
|
@@ -43719,7 +43927,7 @@ function fetchGrokModels(cli, env, run2 = execCli) {
|
|
|
43719
43927
|
}
|
|
43720
43928
|
function grokHome(env) {
|
|
43721
43929
|
if (env.GROK_HOME) return env.GROK_HOME;
|
|
43722
|
-
return
|
|
43930
|
+
return join35(env.HOME || env.USERPROFILE || homedir16(), ".grok");
|
|
43723
43931
|
}
|
|
43724
43932
|
function unquote2(raw) {
|
|
43725
43933
|
const value = raw.trim();
|
|
@@ -43729,7 +43937,7 @@ function unquote2(raw) {
|
|
|
43729
43937
|
return value;
|
|
43730
43938
|
}
|
|
43731
43939
|
function readGrokModelCatalog(env = process.env, base3 = STATIC_GROK_MODELS) {
|
|
43732
|
-
const path4 =
|
|
43940
|
+
const path4 = join35(grokHome(env), "config.toml");
|
|
43733
43941
|
let text4 = "";
|
|
43734
43942
|
try {
|
|
43735
43943
|
text4 = readFileSync18(path4, "utf8");
|
|
@@ -43808,7 +44016,7 @@ function ensureGrokInjectSlug(modelId, env = process.env) {
|
|
|
43808
44016
|
if (!inject) return modelId;
|
|
43809
44017
|
const host = localHost(inject.host);
|
|
43810
44018
|
if (!host) return modelId;
|
|
43811
|
-
const path4 =
|
|
44019
|
+
const path4 = join35(grokHome(env), "config.toml");
|
|
43812
44020
|
let text4 = "";
|
|
43813
44021
|
try {
|
|
43814
44022
|
text4 = readFileSync18(path4, "utf8");
|
|
@@ -43964,7 +44172,7 @@ var init_grok2 = __esm({
|
|
|
43964
44172
|
pickAuthMethod: (methods) => methods.some((m3) => m3.id === "cached_token") ? "cached_token" : null,
|
|
43965
44173
|
authFailure: "fail",
|
|
43966
44174
|
classifyError: classifyGrokError,
|
|
43967
|
-
isAuthenticated: (env) => existsSync16(env.GROK_HOME ?
|
|
44175
|
+
isAuthenticated: (env) => existsSync16(env.GROK_HOME ? join35(env.GROK_HOME, "auth.json") : join35(homedir16(), ".grok", "auth.json")),
|
|
43968
44176
|
// `--append-system-prompt`/`--rules` are accepted by the CLI but do NOT
|
|
43969
44177
|
// reach the agent-stdio system prompt (verified against 1.0.0), so the
|
|
43970
44178
|
// persona is prepended codex-style.
|
|
@@ -43979,10 +44187,10 @@ ${turn.text}` : turn.text
|
|
|
43979
44187
|
// server/drivers/acp/gemini.ts
|
|
43980
44188
|
import { existsSync as existsSync17, readFileSync as readFileSync19 } from "node:fs";
|
|
43981
44189
|
import { homedir as homedir17 } from "node:os";
|
|
43982
|
-
import { join as
|
|
44190
|
+
import { join as join36 } from "node:path";
|
|
43983
44191
|
function liveOauthCredential() {
|
|
43984
44192
|
try {
|
|
43985
|
-
const creds = JSON.parse(readFileSync19(
|
|
44193
|
+
const creds = JSON.parse(readFileSync19(join36(homedir17(), ".gemini", "oauth_creds.json"), "utf8"));
|
|
43986
44194
|
if (typeof creds.access_token !== "string" || creds.access_token.trim().length === 0) return false;
|
|
43987
44195
|
const hasRefresh = typeof creds.refresh_token === "string" && creds.refresh_token.trim().length > 0;
|
|
43988
44196
|
if (creds.expiry_date !== void 0) {
|
|
@@ -43995,7 +44203,7 @@ function liveOauthCredential() {
|
|
|
43995
44203
|
}
|
|
43996
44204
|
}
|
|
43997
44205
|
function geminiIsAuthenticated(env) {
|
|
43998
|
-
return nonBlank(env.GEMINI_API_KEY) || nonBlank(env.GOOGLE_API_KEY) || existsSync17(
|
|
44206
|
+
return nonBlank(env.GEMINI_API_KEY) || nonBlank(env.GOOGLE_API_KEY) || existsSync17(join36(homedir17(), ".gemini", "oauth_creds.json")) && liveOauthCredential();
|
|
43999
44207
|
}
|
|
44000
44208
|
function geminiApprovalArgs(fullAuto, approvalMode) {
|
|
44001
44209
|
if (fullAuto) return ["--yolo"];
|
|
@@ -44044,15 +44252,15 @@ ${turn.text}` : turn.text
|
|
|
44044
44252
|
// server/drivers/acp/kimi.ts
|
|
44045
44253
|
import { existsSync as existsSync18, mkdirSync as mkdirSync17, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "node:fs";
|
|
44046
44254
|
import { homedir as homedir18 } from "node:os";
|
|
44047
|
-
import { join as
|
|
44255
|
+
import { join as join37 } from "node:path";
|
|
44048
44256
|
function isLocalInjectAlias(slug) {
|
|
44049
44257
|
return LOCAL_PROVIDER_PREFIXES.some((prefix) => slug.startsWith(prefix));
|
|
44050
44258
|
}
|
|
44051
44259
|
function kimiDataRoot(env) {
|
|
44052
|
-
return env.KIMI_CODE_HOME ||
|
|
44260
|
+
return env.KIMI_CODE_HOME || join37(env.HOME || env.USERPROFILE || homedir18(), ".kimi-code");
|
|
44053
44261
|
}
|
|
44054
44262
|
function credentialsPath(env) {
|
|
44055
|
-
return
|
|
44263
|
+
return join37(kimiDataRoot(env), "credentials", "kimi-code.json");
|
|
44056
44264
|
}
|
|
44057
44265
|
function quoteToml2(value) {
|
|
44058
44266
|
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
@@ -44340,7 +44548,7 @@ function ensureKimiInjectAlias(modelId, env = process.env) {
|
|
|
44340
44548
|
const alias = `${inject.host}/${inject.model.replace(/\//g, "-")}`;
|
|
44341
44549
|
const dataRoot = kimiDataRoot(env);
|
|
44342
44550
|
mkdirSync17(dataRoot, { recursive: true });
|
|
44343
|
-
const path4 =
|
|
44551
|
+
const path4 = join37(dataRoot, "config.toml");
|
|
44344
44552
|
let text4 = "";
|
|
44345
44553
|
try {
|
|
44346
44554
|
text4 = readFileSync20(path4, "utf8");
|
|
@@ -44405,7 +44613,7 @@ function readKimiModelCatalog(env) {
|
|
|
44405
44613
|
const dataRoot = kimiDataRoot(env);
|
|
44406
44614
|
let text4 = "";
|
|
44407
44615
|
try {
|
|
44408
|
-
text4 = readFileSync20(
|
|
44616
|
+
text4 = readFileSync20(join37(dataRoot, "config.toml"), "utf8");
|
|
44409
44617
|
} catch {
|
|
44410
44618
|
return STATIC_KIMI_MODELS;
|
|
44411
44619
|
}
|
|
@@ -44554,10 +44762,10 @@ ${turn.text}` : turn.text
|
|
|
44554
44762
|
// server/drivers/acp/droid.ts
|
|
44555
44763
|
import { existsSync as existsSync19, mkdirSync as mkdirSync18, readFileSync as readFileSync21, writeFileSync as writeFileSync14 } from "node:fs";
|
|
44556
44764
|
import { homedir as homedir19 } from "node:os";
|
|
44557
|
-
import { join as
|
|
44765
|
+
import { join as join38 } from "node:path";
|
|
44558
44766
|
function authFilePaths(env) {
|
|
44559
44767
|
const home = env.FACTORY_HOME_OVERRIDE || env.HOME || homedir19();
|
|
44560
|
-
return AUTH_FILES.map((name) =>
|
|
44768
|
+
return AUTH_FILES.map((name) => join38(home, ".factory", name));
|
|
44561
44769
|
}
|
|
44562
44770
|
function droidInjectId(host, model) {
|
|
44563
44771
|
const safe = `${host}-${model}`.replace(/[^a-zA-Z0-9._+-]+/g, "-").replace(/-+/g, "-");
|
|
@@ -44572,9 +44780,9 @@ function ensureDroidInjectModel(modelId, env = process.env) {
|
|
|
44572
44780
|
const host = localHost(inject.host);
|
|
44573
44781
|
if (!host) return modelId;
|
|
44574
44782
|
const id = droidInjectId(inject.host, inject.model);
|
|
44575
|
-
const dir =
|
|
44783
|
+
const dir = join38(factoryHome(env), ".factory");
|
|
44576
44784
|
mkdirSync18(dir, { recursive: true });
|
|
44577
|
-
const path4 =
|
|
44785
|
+
const path4 = join38(dir, "settings.json");
|
|
44578
44786
|
let settings2 = {};
|
|
44579
44787
|
try {
|
|
44580
44788
|
settings2 = JSON.parse(readFileSync21(path4, "utf8"));
|
|
@@ -44614,7 +44822,7 @@ function applyDroidLocalAuthEnv(env, modelId) {
|
|
|
44614
44822
|
env.FACTORY_API_KEY = "openmausbot-local";
|
|
44615
44823
|
}
|
|
44616
44824
|
function readSettings(env) {
|
|
44617
|
-
return JSON.parse(readFileSync21(
|
|
44825
|
+
return JSON.parse(readFileSync21(join38(factoryHome(env), ".factory", "settings.json"), "utf8"));
|
|
44618
44826
|
}
|
|
44619
44827
|
async function resolveModels(env) {
|
|
44620
44828
|
let catalog2 = MODELS3;
|
|
@@ -46502,12 +46710,12 @@ var init_muse_code_login = __esm({
|
|
|
46502
46710
|
// server/drivers/muse-code.ts
|
|
46503
46711
|
import { existsSync as existsSync20, mkdtempSync as mkdtempSync4, readFileSync as readFileSync22, rmSync as rmSync8, statSync as statSync5 } from "node:fs";
|
|
46504
46712
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
46505
|
-
import { homedir as homedir20, tmpdir as
|
|
46506
|
-
import { join as
|
|
46713
|
+
import { homedir as homedir20, tmpdir as tmpdir5 } from "node:os";
|
|
46714
|
+
import { join as join39 } from "node:path";
|
|
46507
46715
|
function museCredentialPath(env, platform = process.platform) {
|
|
46508
46716
|
if (env.MUSE_AUTH_PATH?.trim()) return env.MUSE_AUTH_PATH.trim();
|
|
46509
46717
|
const home = (platform === "win32" ? env.USERPROFILE || env.HOME : env.HOME) || homedir20();
|
|
46510
|
-
return
|
|
46718
|
+
return join39(env.XDG_CONFIG_HOME?.trim() || join39(home, ".config"), "muse", "auth.json");
|
|
46511
46719
|
}
|
|
46512
46720
|
function museCredential(path4) {
|
|
46513
46721
|
let raw;
|
|
@@ -46769,7 +46977,7 @@ var init_muse_code = __esm({
|
|
|
46769
46977
|
lastRefresh = Date.now();
|
|
46770
46978
|
});
|
|
46771
46979
|
const listModels = async () => {
|
|
46772
|
-
const cwd = mkdtempSync4(
|
|
46980
|
+
const cwd = mkdtempSync4(join39(tmpdir5(), "atomic-muse-models-"));
|
|
46773
46981
|
let host;
|
|
46774
46982
|
try {
|
|
46775
46983
|
host = await startHost(["serve", "--disable-shell", "--disable-write", "--no-session-log", "--contributor-mode", "off"], cwd, "models", false);
|
|
@@ -47267,7 +47475,7 @@ ${body}` : body;
|
|
|
47267
47475
|
// server/drivers/acp/opencode-go.ts
|
|
47268
47476
|
import { existsSync as existsSync21, mkdirSync as mkdirSync19, readFileSync as readFileSync23, writeFileSync as writeFileSync15 } from "node:fs";
|
|
47269
47477
|
import { homedir as homedir21 } from "node:os";
|
|
47270
|
-
import { join as
|
|
47478
|
+
import { join as join40 } from "node:path";
|
|
47271
47479
|
function labelForModel(id) {
|
|
47272
47480
|
return id.split(/[-_.]+/g).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
47273
47481
|
}
|
|
@@ -47370,7 +47578,7 @@ async function discoverOpenCodeModels(environment, cli = "opencode") {
|
|
|
47370
47578
|
}
|
|
47371
47579
|
function opencodeConfigDir(env) {
|
|
47372
47580
|
const home = env.HOME || env.USERPROFILE || homedir21();
|
|
47373
|
-
return
|
|
47581
|
+
return join40(env.XDG_CONFIG_HOME || join40(home, ".config"), "opencode");
|
|
47374
47582
|
}
|
|
47375
47583
|
function ensureOpenCodeInjectModel(modelId, env = process.env) {
|
|
47376
47584
|
const inject = decodeInjectId(modelId);
|
|
@@ -47380,7 +47588,7 @@ function ensureOpenCodeInjectModel(modelId, env = process.env) {
|
|
|
47380
47588
|
const native = `${inject.host}/${inject.model}`;
|
|
47381
47589
|
const dir = opencodeConfigDir(env);
|
|
47382
47590
|
mkdirSync19(dir, { recursive: true });
|
|
47383
|
-
const path4 =
|
|
47591
|
+
const path4 = join40(dir, "opencode.json");
|
|
47384
47592
|
let config2 = { $schema: "https://opencode.ai/config.json" };
|
|
47385
47593
|
if (existsSync21(path4)) {
|
|
47386
47594
|
try {
|
|
@@ -47418,10 +47626,10 @@ function ensureOpenCodeInjectModel(modelId, env = process.env) {
|
|
|
47418
47626
|
function storedAuthPaths(env) {
|
|
47419
47627
|
const home = env.HOME || env.USERPROFILE || homedir21();
|
|
47420
47628
|
const roots = [
|
|
47421
|
-
env.XDG_DATA_HOME ||
|
|
47422
|
-
process.platform === "darwin" ?
|
|
47629
|
+
env.XDG_DATA_HOME || join40(home, ".local", "share"),
|
|
47630
|
+
process.platform === "darwin" ? join40(home, "Library", "Application Support") : process.platform === "win32" ? env.LOCALAPPDATA || join40(home, "AppData", "Local") : ""
|
|
47423
47631
|
].filter(Boolean);
|
|
47424
|
-
return [...new Set(roots)].map((root) =>
|
|
47632
|
+
return [...new Set(roots)].map((root) => join40(root, "opencode", "auth.json"));
|
|
47425
47633
|
}
|
|
47426
47634
|
function usableAuthEntry(parsed) {
|
|
47427
47635
|
return Object.values(parsed).some((auth) => {
|
|
@@ -47580,10 +47788,10 @@ ${turn.text}` : turn.text
|
|
|
47580
47788
|
import { chmodSync as chmodSync5, existsSync as existsSync22, mkdirSync as mkdirSync20, readFileSync as readFileSync24, writeFileSync as writeFileSync16 } from "node:fs";
|
|
47581
47789
|
import { createHash as createHash13 } from "node:crypto";
|
|
47582
47790
|
import { homedir as homedir22 } from "node:os";
|
|
47583
|
-
import { join as
|
|
47791
|
+
import { join as join41 } from "node:path";
|
|
47584
47792
|
function qwenHome(env) {
|
|
47585
47793
|
const home = process.platform === "win32" ? env.USERPROFILE || env.HOME || homedir22() : env.HOME || env.USERPROFILE || homedir22();
|
|
47586
|
-
return
|
|
47794
|
+
return join41(home, ".qwen");
|
|
47587
47795
|
}
|
|
47588
47796
|
function isRecord5(value) {
|
|
47589
47797
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -47595,7 +47803,7 @@ function qwenModelLabel(id, name) {
|
|
|
47595
47803
|
function readQwenRoutes(env) {
|
|
47596
47804
|
let settings2;
|
|
47597
47805
|
try {
|
|
47598
|
-
settings2 = JSON.parse(readFileSync24(
|
|
47806
|
+
settings2 = JSON.parse(readFileSync24(join41(qwenHome(env), "settings.json"), "utf8"));
|
|
47599
47807
|
} catch {
|
|
47600
47808
|
return [];
|
|
47601
47809
|
}
|
|
@@ -47679,7 +47887,7 @@ function ensureQwenInjectModel(modelId, env = process.env) {
|
|
|
47679
47887
|
if (!host) return modelId;
|
|
47680
47888
|
const dir = qwenHome(env);
|
|
47681
47889
|
mkdirSync20(dir, { recursive: true });
|
|
47682
|
-
const path4 =
|
|
47890
|
+
const path4 = join41(dir, "settings.json");
|
|
47683
47891
|
let settings2 = {};
|
|
47684
47892
|
if (existsSync22(path4)) {
|
|
47685
47893
|
try {
|
|
@@ -48168,12 +48376,12 @@ var init_claude_accounts = __esm({
|
|
|
48168
48376
|
// server/atomic-engine-accounts.ts
|
|
48169
48377
|
import { mkdirSync as mkdirSync21, readFileSync as readFileSync25, writeFileSync as writeFileSync17 } from "node:fs";
|
|
48170
48378
|
import { homedir as homedir23 } from "node:os";
|
|
48171
|
-
import { join as
|
|
48379
|
+
import { join as join42 } from "node:path";
|
|
48172
48380
|
function rawConfig2(entry) {
|
|
48173
48381
|
return entry.config && typeof entry.config === "object" && !Array.isArray(entry.config) ? entry.config : {};
|
|
48174
48382
|
}
|
|
48175
48383
|
function expandHome(path4) {
|
|
48176
|
-
return path4 === "~" ? homedir23() : path4.startsWith("~/") ?
|
|
48384
|
+
return path4 === "~" ? homedir23() : path4.startsWith("~/") ? join42(homedir23(), path4.slice(2)) : path4;
|
|
48177
48385
|
}
|
|
48178
48386
|
function asAccount(id, entry) {
|
|
48179
48387
|
if (entry.enabled === false) return null;
|
|
@@ -48205,7 +48413,7 @@ function asAccount(id, entry) {
|
|
|
48205
48413
|
kind: "codex-cli",
|
|
48206
48414
|
label,
|
|
48207
48415
|
billing: "subscription",
|
|
48208
|
-
home: home ? expandHome(home) :
|
|
48416
|
+
home: home ? expandHome(home) : join42(homedir23(), ".codex"),
|
|
48209
48417
|
model: FAILOVER_MODEL["openai-codex"]
|
|
48210
48418
|
} };
|
|
48211
48419
|
}
|
|
@@ -48267,7 +48475,7 @@ function writeAtomicEngineAccountsFile(engineHome, accounts) {
|
|
|
48267
48475
|
const shareable = accounts.map(({ restingUntil: _resting, ...account }) => account);
|
|
48268
48476
|
const text4 = `${JSON.stringify({ version: 1, accounts: shareable }, null, 2)}
|
|
48269
48477
|
`;
|
|
48270
|
-
const path4 =
|
|
48478
|
+
const path4 = join42(engineHome, ACCOUNTS_FILE);
|
|
48271
48479
|
try {
|
|
48272
48480
|
if (readFileSync25(path4, "utf8") === text4) return;
|
|
48273
48481
|
} catch {
|
|
@@ -48344,20 +48552,20 @@ var init_atomic_engine_release = __esm({
|
|
|
48344
48552
|
// server/atomic-engine-runtime.ts
|
|
48345
48553
|
import { createHash as createHash14, randomUUID as randomUUID15 } from "node:crypto";
|
|
48346
48554
|
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
|
|
48555
|
+
import { join as join43 } from "node:path";
|
|
48348
48556
|
import { Readable, Transform as Transform2 } from "node:stream";
|
|
48349
48557
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
48350
48558
|
function atomicEngineHome(baseDir = DATA_DIR) {
|
|
48351
|
-
return
|
|
48559
|
+
return join43(baseDir, "tools", "atomic-engine");
|
|
48352
48560
|
}
|
|
48353
48561
|
function atomicEnginePython(root, platform = process.platform) {
|
|
48354
|
-
return platform === "win32" ?
|
|
48562
|
+
return platform === "win32" ? join43(root, "atomic-engine", "python", "python.exe") : join43(root, "atomic-engine", "python", "bin", "python3");
|
|
48355
48563
|
}
|
|
48356
48564
|
function managedAtomicEngine(baseDir = DATA_DIR, asset = atomicEngineAsset(), platform = process.platform) {
|
|
48357
48565
|
if (!asset) return null;
|
|
48358
|
-
const root =
|
|
48566
|
+
const root = join43(atomicEngineHome(baseDir), asset.version);
|
|
48359
48567
|
try {
|
|
48360
|
-
if (readFileSync26(
|
|
48568
|
+
if (readFileSync26(join43(root, MARKER2), "utf8").trim() !== asset.sha512) return null;
|
|
48361
48569
|
} catch {
|
|
48362
48570
|
return null;
|
|
48363
48571
|
}
|
|
@@ -48367,7 +48575,7 @@ function managedAtomicEngine(baseDir = DATA_DIR, asset = atomicEngineAsset(), pl
|
|
|
48367
48575
|
function systemTar(platform = process.platform) {
|
|
48368
48576
|
if (platform !== "win32") return "/usr/bin/tar";
|
|
48369
48577
|
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT ?? "C:\\Windows";
|
|
48370
|
-
return
|
|
48578
|
+
return join43(systemRoot, "System32", "tar.exe");
|
|
48371
48579
|
}
|
|
48372
48580
|
async function download(asset, file2, options) {
|
|
48373
48581
|
let response;
|
|
@@ -48412,8 +48620,8 @@ async function installOnce3(options) {
|
|
|
48412
48620
|
const home = atomicEngineHome(baseDir);
|
|
48413
48621
|
mkdirSync22(home, { recursive: true });
|
|
48414
48622
|
const id = randomUUID15();
|
|
48415
|
-
const archive =
|
|
48416
|
-
const staging =
|
|
48623
|
+
const archive = join43(home, `.download-${id}.tar.gz`);
|
|
48624
|
+
const staging = join43(home, `.staging-${id}`);
|
|
48417
48625
|
try {
|
|
48418
48626
|
await download(asset, archive, options);
|
|
48419
48627
|
options.onProgress?.({ phase: "installing" });
|
|
@@ -48424,7 +48632,7 @@ async function installOnce3(options) {
|
|
|
48424
48632
|
throw new AtomicEngineInstallError("install", `Could not unpack Atomic Engine: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
48425
48633
|
}
|
|
48426
48634
|
if (!existsSync23(atomicEnginePython(staging))) throw new AtomicEngineInstallError("install", "The Atomic Engine package has no Python runtime for this computer");
|
|
48427
|
-
const root =
|
|
48635
|
+
const root = join43(home, asset.version);
|
|
48428
48636
|
rmSync9(root, { recursive: true, force: true });
|
|
48429
48637
|
await promoteDirectory(staging, root);
|
|
48430
48638
|
const python = atomicEnginePython(root);
|
|
@@ -48435,10 +48643,10 @@ async function installOnce3(options) {
|
|
|
48435
48643
|
await removeDirectoryQuietly(root, "Atomic Engine has no install marker there, so it is not used");
|
|
48436
48644
|
throw new AtomicEngineInstallError("install", `Atomic Engine did not start after installing: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
48437
48645
|
}
|
|
48438
|
-
writeFileSync18(
|
|
48646
|
+
writeFileSync18(join43(root, MARKER2), `${asset.sha512}
|
|
48439
48647
|
`);
|
|
48440
48648
|
for (const name of readdirSync6(home)) {
|
|
48441
|
-
if (name !== asset.version && !name.startsWith(".")) rmSync9(
|
|
48649
|
+
if (name !== asset.version && !name.startsWith(".")) rmSync9(join43(home, name), { recursive: true, force: true });
|
|
48442
48650
|
}
|
|
48443
48651
|
const installed = managedAtomicEngine(baseDir, asset);
|
|
48444
48652
|
if (!installed) throw new AtomicEngineInstallError("install", "Atomic Engine did not install completely");
|
|
@@ -55362,7 +55570,7 @@ var init_memory_policy = __esm({
|
|
|
55362
55570
|
// server/drivers/acp/hermes-memory-lock.ts
|
|
55363
55571
|
import { createHash as createHash15 } from "node:crypto";
|
|
55364
55572
|
import { mkdirSync as mkdirSync23, readdirSync as readdirSync7, readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "node:fs";
|
|
55365
|
-
import { join as
|
|
55573
|
+
import { join as join44 } from "node:path";
|
|
55366
55574
|
function readText2(path4) {
|
|
55367
55575
|
try {
|
|
55368
55576
|
return readFileSync27(path4, "utf8");
|
|
@@ -55389,24 +55597,24 @@ function memoryProviderPlugins(pluginsDir) {
|
|
|
55389
55597
|
return [];
|
|
55390
55598
|
}
|
|
55391
55599
|
return dirs.flatMap((dir) => {
|
|
55392
|
-
const source2 = (readText2(
|
|
55600
|
+
const source2 = (readText2(join44(pluginsDir, dir, "__init__.py")) ?? "").slice(0, 8192);
|
|
55393
55601
|
if (!source2.includes("register_memory_provider") && !source2.includes("MemoryProvider")) return [];
|
|
55394
|
-
const name = record2(parseYamlSafe(readText2(
|
|
55602
|
+
const name = record2(parseYamlSafe(readText2(join44(pluginsDir, dir, "plugin.yaml"))))?.name;
|
|
55395
55603
|
return typeof name === "string" && name.trim() && name.trim() !== dir ? [dir, name.trim()] : [dir];
|
|
55396
55604
|
});
|
|
55397
55605
|
}
|
|
55398
55606
|
function lockHermesMemory(env, home, dataDir = DATA_DIR) {
|
|
55399
|
-
const own = record2(record2(parseYamlSafe(readText2(
|
|
55607
|
+
const own = record2(record2(parseYamlSafe(readText2(join44(home, "config.yaml"))))?.plugins);
|
|
55400
55608
|
const disabled = new Set(Array.isArray(own?.disabled) ? own.disabled.map(String) : []);
|
|
55401
|
-
for (const name of memoryProviderPlugins(
|
|
55609
|
+
for (const name of memoryProviderPlugins(join44(home, "plugins"))) disabled.add(name);
|
|
55402
55610
|
for (const name of BLOCKED_HERMES_MEMORY_PLUGINS) disabled.add(name);
|
|
55403
55611
|
const overlay = stringify3({
|
|
55404
55612
|
memory: { provider: "", memory_enabled: false, user_profile_enabled: false },
|
|
55405
55613
|
plugins: { disabled: [...disabled].sort() }
|
|
55406
55614
|
});
|
|
55407
|
-
const dir =
|
|
55615
|
+
const dir = join44(dataDir, "hermes-managed", createHash15("sha256").update(home).digest("hex").slice(0, 16));
|
|
55408
55616
|
mkdirSync23(dir, { recursive: true });
|
|
55409
|
-
const file2 =
|
|
55617
|
+
const file2 = join44(dir, "config.yaml");
|
|
55410
55618
|
if (readText2(file2) !== overlay) writeFileSync19(file2, overlay);
|
|
55411
55619
|
env.HERMES_MANAGED_DIR = dir;
|
|
55412
55620
|
return dir;
|
|
@@ -55424,7 +55632,7 @@ var init_hermes_memory_lock = __esm({
|
|
|
55424
55632
|
import { spawn as spawn7 } from "node:child_process";
|
|
55425
55633
|
import { mkdirSync as mkdirSync24, readFileSync as readFileSync28, writeFileSync as writeFileSync20 } from "node:fs";
|
|
55426
55634
|
import { homedir as homedir24 } from "node:os";
|
|
55427
|
-
import { join as
|
|
55635
|
+
import { join as join45 } from "node:path";
|
|
55428
55636
|
function bindHermesScreenshotCompat(env, modelId) {
|
|
55429
55637
|
delete env[HERMES_OPENMAUS_SCREENSHOT_COMPAT];
|
|
55430
55638
|
delete env[HERMES_OPENMAUS_SCREENSHOT_COMPAT_MODEL];
|
|
@@ -55434,7 +55642,7 @@ function bindHermesScreenshotCompat(env, modelId) {
|
|
|
55434
55642
|
env[HERMES_OPENMAUS_SCREENSHOT_COMPAT_MODEL] = inject.model;
|
|
55435
55643
|
}
|
|
55436
55644
|
function hermesHome(env) {
|
|
55437
|
-
return env.HERMES_HOME ||
|
|
55645
|
+
return env.HERMES_HOME || join45(env.HOME || env.USERPROFILE || homedir24(), ".hermes");
|
|
55438
55646
|
}
|
|
55439
55647
|
function quoteYaml(value) {
|
|
55440
55648
|
if (/^[\w./:+-]+$/.test(value)) return value;
|
|
@@ -55476,7 +55684,7 @@ function ensureHermesInjectProvider(modelId, env = process.env, home = hermesHom
|
|
|
55476
55684
|
if (!host) return modelId;
|
|
55477
55685
|
const dir = home;
|
|
55478
55686
|
mkdirSync24(dir, { recursive: true });
|
|
55479
|
-
const path4 =
|
|
55687
|
+
const path4 = join45(dir, "config.yaml");
|
|
55480
55688
|
let text4 = "";
|
|
55481
55689
|
try {
|
|
55482
55690
|
text4 = readFileSync28(path4, "utf8");
|
|
@@ -55547,13 +55755,13 @@ function hermesConfiguredModel(env = process.env) {
|
|
|
55547
55755
|
const dir = hermesHome(env);
|
|
55548
55756
|
let secrets = "";
|
|
55549
55757
|
try {
|
|
55550
|
-
secrets = readFileSync28(
|
|
55758
|
+
secrets = readFileSync28(join45(dir, ".env"), "utf8");
|
|
55551
55759
|
} catch {
|
|
55552
55760
|
}
|
|
55553
55761
|
const hasHostedProviderKey = HERMES_HOSTED_PROVIDER_KEYS.some((name) => nonEmptyDotenvValue(secrets, name));
|
|
55554
55762
|
let configuredDefault = null;
|
|
55555
55763
|
try {
|
|
55556
|
-
configuredDefault = hermesConfigDefault(readFileSync28(
|
|
55764
|
+
configuredDefault = hermesConfigDefault(readFileSync28(join45(dir, "config.yaml"), "utf8"));
|
|
55557
55765
|
} catch {
|
|
55558
55766
|
}
|
|
55559
55767
|
const configuredProvider = configuredDefault?.provider.toLowerCase() ?? "";
|
|
@@ -55598,7 +55806,7 @@ function oauthRowSignedIn(row, now) {
|
|
|
55598
55806
|
return present(row.access_token) && notExpired(row, now);
|
|
55599
55807
|
}
|
|
55600
55808
|
function hermesSignedInProviders(env = process.env, now = Date.now()) {
|
|
55601
|
-
const store = record3(readJson(
|
|
55809
|
+
const store = record3(readJson(join45(hermesHome(env), "auth.json")));
|
|
55602
55810
|
const out = /* @__PURE__ */ new Set();
|
|
55603
55811
|
if (!store) return out;
|
|
55604
55812
|
const providers = record3(store.providers) ?? {};
|
|
@@ -55622,7 +55830,7 @@ function hermesZaiCodingPlan(env = process.env) {
|
|
|
55622
55830
|
const dir = hermesHome(env);
|
|
55623
55831
|
let secrets = "";
|
|
55624
55832
|
try {
|
|
55625
|
-
secrets = readFileSync28(
|
|
55833
|
+
secrets = readFileSync28(join45(dir, ".env"), "utf8");
|
|
55626
55834
|
} catch {
|
|
55627
55835
|
}
|
|
55628
55836
|
const keyed = ["GLM_API_KEY", "ZAI_API_KEY", "Z_AI_API_KEY"].some((name) => present(env[name]) || nonEmptyDotenvValue(secrets, name));
|
|
@@ -55630,21 +55838,21 @@ function hermesZaiCodingPlan(env = process.env) {
|
|
|
55630
55838
|
const coding = (url2) => typeof url2 === "string" && /\/api\/coding\/paas\//i.test(url2);
|
|
55631
55839
|
const override = present(env.GLM_BASE_URL) ? env.GLM_BASE_URL : nonEmptyDotenvValue(secrets, "GLM_BASE_URL");
|
|
55632
55840
|
if (override) return coding(override);
|
|
55633
|
-
const detected = record3(record3(record3(record3(readJson(
|
|
55841
|
+
const detected = record3(record3(record3(record3(readJson(join45(dir, "auth.json")))?.providers)?.zai)?.detected_endpoint);
|
|
55634
55842
|
return coding(detected?.base_url);
|
|
55635
55843
|
}
|
|
55636
55844
|
function hermesZaiPlanHosts(options, codingPlan) {
|
|
55637
55845
|
return codingPlan ? options.map((option) => option.provider === "zai" ? { ...option, provider: "zai-coding-plan" } : option) : [...options];
|
|
55638
55846
|
}
|
|
55639
55847
|
function hermesCachedModels(home, provider) {
|
|
55640
|
-
const catalog2 = record3(record3(record3(readJson(
|
|
55848
|
+
const catalog2 = record3(record3(record3(readJson(join45(home, "cache", "model_catalog.json")))?.providers)?.[provider]);
|
|
55641
55849
|
const name = String(record3(catalog2?.metadata)?.display_name ?? "").trim() || provider;
|
|
55642
55850
|
const rows = Array.isArray(catalog2?.models) ? catalog2.models.map(record3).filter((row) => row && present(row.id)) : [];
|
|
55643
55851
|
if (rows.length) {
|
|
55644
55852
|
const ordered = [...rows.filter((row) => row.default === true), ...rows.filter((row) => row.default !== true)];
|
|
55645
55853
|
return { ids: ordered.map((row) => String(row.id).trim()), name };
|
|
55646
55854
|
}
|
|
55647
|
-
const cached3 = record3(record3(readJson(
|
|
55855
|
+
const cached3 = record3(record3(readJson(join45(home, "provider_models_cache.json")))?.[provider])?.models;
|
|
55648
55856
|
return { ids: Array.isArray(cached3) ? cached3.filter(present).map((id) => String(id).trim()) : [], name };
|
|
55649
55857
|
}
|
|
55650
55858
|
function hermesAuthStoreModels(env = process.env, now = Date.now()) {
|
|
@@ -55662,7 +55870,7 @@ function hermesConfiguredHostModel(env = process.env) {
|
|
|
55662
55870
|
const home = hermesHome(env);
|
|
55663
55871
|
let configured = null;
|
|
55664
55872
|
try {
|
|
55665
|
-
configured = hermesConfigDefault(readFileSync28(
|
|
55873
|
+
configured = hermesConfigDefault(readFileSync28(join45(home, "config.yaml"), "utf8"));
|
|
55666
55874
|
} catch {
|
|
55667
55875
|
return null;
|
|
55668
55876
|
}
|
|
@@ -55885,7 +56093,7 @@ ${turn.text}` : turn.text
|
|
|
55885
56093
|
|
|
55886
56094
|
// server/drivers/acp/custom.ts
|
|
55887
56095
|
import { homedir as homedir25 } from "node:os";
|
|
55888
|
-
import { basename as basename9, join as
|
|
56096
|
+
import { basename as basename9, join as join46 } from "node:path";
|
|
55889
56097
|
function isAtomicEngine(instanceId, cli) {
|
|
55890
56098
|
const program = (cli ?? "").trim().split(/\s+/)[0] ?? "";
|
|
55891
56099
|
return instanceId === "atomic-engine" || basename9(program) === "atomic";
|
|
@@ -55910,7 +56118,7 @@ async function customAcpSnapshot(env, cli, instanceId) {
|
|
|
55910
56118
|
return { state: "available", version: version2, authenticated: true };
|
|
55911
56119
|
}
|
|
55912
56120
|
function atomicEngineHome2(env) {
|
|
55913
|
-
return env.HERMES_HOME ||
|
|
56121
|
+
return env.HERMES_HOME || join46(env.HOME || env.USERPROFILE || homedir25(), ".atomic");
|
|
55914
56122
|
}
|
|
55915
56123
|
function applyAtomicEngineAccounts(env, instanceId, cli, accounts = currentAtomicEngineAccounts) {
|
|
55916
56124
|
if (!isAtomicEngine(instanceId, cli)) return;
|
|
@@ -56294,8 +56502,8 @@ var init_openai_compat = __esm({
|
|
|
56294
56502
|
|
|
56295
56503
|
// server/drivers/pi.ts
|
|
56296
56504
|
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
|
|
56505
|
+
import { homedir as homedir26, tmpdir as tmpdir6 } from "node:os";
|
|
56506
|
+
import { join as join47 } from "node:path";
|
|
56299
56507
|
function readPiPromptImages(turn) {
|
|
56300
56508
|
return (turn.images ?? []).map((image) => ({
|
|
56301
56509
|
type: "image",
|
|
@@ -56417,7 +56625,7 @@ async function applyPiLocalCatalog(catalog2, env = process.env, fetchImpl = fetc
|
|
|
56417
56625
|
return preferPiInjectRows(await mergeLocalInject(catalog2, env, fetchImpl));
|
|
56418
56626
|
}
|
|
56419
56627
|
function piAgentDir(env) {
|
|
56420
|
-
return
|
|
56628
|
+
return join47(env.HOME || env.USERPROFILE || homedir26(), ".pi", "agent");
|
|
56421
56629
|
}
|
|
56422
56630
|
function ensurePiInjectModel(modelId, env = process.env) {
|
|
56423
56631
|
const split = splitPiModel(modelId);
|
|
@@ -56428,7 +56636,7 @@ function ensurePiInjectModel(modelId, env = process.env) {
|
|
|
56428
56636
|
if (!host) return split;
|
|
56429
56637
|
const dir = piAgentDir(env);
|
|
56430
56638
|
mkdirSync25(dir, { recursive: true });
|
|
56431
|
-
const path4 =
|
|
56639
|
+
const path4 = join47(dir, "models.json");
|
|
56432
56640
|
let root = { providers: {} };
|
|
56433
56641
|
if (existsSync24(path4)) {
|
|
56434
56642
|
try {
|
|
@@ -56648,9 +56856,9 @@ var init_pi = __esm({
|
|
|
56648
56856
|
const mcpServers = buildMcpServers(turn);
|
|
56649
56857
|
let mcpTempDir = null;
|
|
56650
56858
|
if (mcpServers) {
|
|
56651
|
-
mcpTempDir = mkdtempSync5(
|
|
56859
|
+
mcpTempDir = mkdtempSync5(join47(tmpdir6(), "omb-pi-mcp-"));
|
|
56652
56860
|
try {
|
|
56653
|
-
writeFileSync21(
|
|
56861
|
+
writeFileSync21(join47(mcpTempDir, "mcp.json"), JSON.stringify({ mcpServers }), { mode: 384 });
|
|
56654
56862
|
} catch (err) {
|
|
56655
56863
|
try {
|
|
56656
56864
|
rmSync10(mcpTempDir, { recursive: true, force: true });
|
|
@@ -56669,7 +56877,7 @@ var init_pi = __esm({
|
|
|
56669
56877
|
env: piEnvironment({
|
|
56670
56878
|
...process.env,
|
|
56671
56879
|
...input.environment,
|
|
56672
|
-
...mcpServers && mcpTempDir ? { OMB_MCP_CONFIG:
|
|
56880
|
+
...mcpServers && mcpTempDir ? { OMB_MCP_CONFIG: join47(mcpTempDir, "mcp.json") } : {}
|
|
56673
56881
|
})
|
|
56674
56882
|
});
|
|
56675
56883
|
} catch (err) {
|
|
@@ -56816,7 +57024,7 @@ var init_pi = __esm({
|
|
|
56816
57024
|
const mcpTool = isQuestion ? null : piMcpToolRef(
|
|
56817
57025
|
evt.title,
|
|
56818
57026
|
customServerNames,
|
|
56819
|
-
mcpTempDir ?
|
|
57027
|
+
mcpTempDir ? join47(mcpTempDir, PI_TOOL_HINTS_FILE) : null
|
|
56820
57028
|
);
|
|
56821
57029
|
emit({
|
|
56822
57030
|
...base3(threadId, turnId),
|
|
@@ -57151,14 +57359,14 @@ var init_mistral = __esm({
|
|
|
57151
57359
|
// server/drivers/minimax.ts
|
|
57152
57360
|
import { readFileSync as readFileSync30 } from "node:fs";
|
|
57153
57361
|
import { homedir as homedir27 } from "node:os";
|
|
57154
|
-
import { join as
|
|
57362
|
+
import { join as join48 } from "node:path";
|
|
57155
57363
|
function normalizedApiUrl(value) {
|
|
57156
57364
|
const root = value.trim().replace(/\/+$/, "");
|
|
57157
57365
|
return root.endsWith("/v1") ? root : `${root}/v1`;
|
|
57158
57366
|
}
|
|
57159
57367
|
function loadLocalMiniMaxConfig(home = homedir27()) {
|
|
57160
57368
|
try {
|
|
57161
|
-
const raw = localConfigSchema.parse(JSON.parse(readFileSync30(
|
|
57369
|
+
const raw = localConfigSchema.parse(JSON.parse(readFileSync30(join48(home, ".mmx", "config.json"), "utf8")));
|
|
57162
57370
|
const configuredUrl = raw.base_url?.trim() ? raw.base_url : raw.region === "cn" ? CN_URL : DEFAULT_URL3;
|
|
57163
57371
|
return {
|
|
57164
57372
|
apiKey: raw.api_key?.trim() ?? "",
|
|
@@ -57265,7 +57473,7 @@ var init_minimax = __esm({
|
|
|
57265
57473
|
// server/apple-intelligence.ts
|
|
57266
57474
|
import { spawn as spawn8 } from "node:child_process";
|
|
57267
57475
|
import { accessSync, constants as constants2 } from "node:fs";
|
|
57268
|
-
import { join as
|
|
57476
|
+
import { join as join49 } from "node:path";
|
|
57269
57477
|
function intelligenceErrorMessage(code) {
|
|
57270
57478
|
return MESSAGES[code] ?? `Apple Intelligence failed (${code}).`;
|
|
57271
57479
|
}
|
|
@@ -57273,9 +57481,9 @@ function resolveIntelligenceHelper(env = process.env, platform = process.platfor
|
|
|
57273
57481
|
if (platform !== "darwin" || arch !== "arm64") return null;
|
|
57274
57482
|
const candidates = [
|
|
57275
57483
|
env.ATOMIC_INTELLIGENCE_HELPER,
|
|
57276
|
-
env.OMB_RESOURCES_PATH &&
|
|
57277
|
-
|
|
57278
|
-
|
|
57484
|
+
env.OMB_RESOURCES_PATH && join49(env.OMB_RESOURCES_PATH, HELPER),
|
|
57485
|
+
join49(serverRoot, "..", HELPER),
|
|
57486
|
+
join49(serverRoot, "..", "dist-native", "arm64", HELPER)
|
|
57279
57487
|
];
|
|
57280
57488
|
for (const candidate of candidates) {
|
|
57281
57489
|
if (!candidate) continue;
|
|
@@ -57463,7 +57671,7 @@ var init_apple_intelligence = __esm({
|
|
|
57463
57671
|
"concurrent-requests": "Apple Intelligence is busy. Try again in a moment.",
|
|
57464
57672
|
"timeout": "Apple Intelligence took too long to answer."
|
|
57465
57673
|
};
|
|
57466
|
-
HELPER =
|
|
57674
|
+
HELPER = join49("Atomic Intelligence.app", "Contents", "MacOS", "intelligence-helper");
|
|
57467
57675
|
}
|
|
57468
57676
|
});
|
|
57469
57677
|
|
|
@@ -57816,7 +58024,7 @@ __export(cli_setup_exports, {
|
|
|
57816
58024
|
});
|
|
57817
58025
|
import { spawn as spawn9 } from "node:child_process";
|
|
57818
58026
|
import { readFileSync as readFileSync31 } from "node:fs";
|
|
57819
|
-
import { join as
|
|
58027
|
+
import { join as join50, resolve as resolve11 } from "node:path";
|
|
57820
58028
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
57821
58029
|
async function inspect(id, entry) {
|
|
57822
58030
|
const registry2 = new ProviderRegistry(BUILT_IN_DRIVERS);
|
|
@@ -57853,7 +58061,7 @@ function assertDataDir(dataDir) {
|
|
|
57853
58061
|
}
|
|
57854
58062
|
function checkStoredConfig(dataDir) {
|
|
57855
58063
|
try {
|
|
57856
|
-
parseStoredConfig(JSON.parse(readFileSync31(
|
|
58064
|
+
parseStoredConfig(JSON.parse(readFileSync31(join50(dataDir, "config.json"), "utf8")));
|
|
57857
58065
|
} catch (error51) {
|
|
57858
58066
|
if (error51.code === "ENOENT") return;
|
|
57859
58067
|
throw new Error("Existing config.json could not be read or validated. Setup has not changed it; repair it before continuing.");
|
|
@@ -58133,7 +58341,7 @@ var init_browser_engine_release = __esm({
|
|
|
58133
58341
|
});
|
|
58134
58342
|
|
|
58135
58343
|
// server/browser-bundle-release.ts
|
|
58136
|
-
import { join as
|
|
58344
|
+
import { join as join51 } from "node:path";
|
|
58137
58345
|
function browserBundleSpec(target) {
|
|
58138
58346
|
if (!Object.hasOwn(CHROME_ASSETS, target)) throw new Error(`Unsupported desktop browser target: ${target}`);
|
|
58139
58347
|
const pinned = CHROME_ASSETS[target];
|
|
@@ -58169,10 +58377,10 @@ function browserBundlePaths(bundleDirectory, target) {
|
|
|
58169
58377
|
const spec = browserBundleSpec(target);
|
|
58170
58378
|
return {
|
|
58171
58379
|
directory: bundleDirectory,
|
|
58172
|
-
manifest:
|
|
58173
|
-
engine:
|
|
58174
|
-
chrome:
|
|
58175
|
-
licenses:
|
|
58380
|
+
manifest: join51(bundleDirectory, "manifest.json"),
|
|
58381
|
+
engine: join51(bundleDirectory, spec.engine.executable),
|
|
58382
|
+
chrome: join51(bundleDirectory, spec.chrome.executable),
|
|
58383
|
+
licenses: join51(bundleDirectory, "licenses")
|
|
58176
58384
|
};
|
|
58177
58385
|
}
|
|
58178
58386
|
var CHROME_VERSION, CHROME_ASSETS;
|
|
@@ -58214,7 +58422,7 @@ var init_browser_runtime = __esm({
|
|
|
58214
58422
|
});
|
|
58215
58423
|
|
|
58216
58424
|
// server/bot-folder.ts
|
|
58217
|
-
import { join as
|
|
58425
|
+
import { join as join52 } from "node:path";
|
|
58218
58426
|
var BOTS_DIR;
|
|
58219
58427
|
var init_bot_folder = __esm({
|
|
58220
58428
|
"server/bot-folder.ts"() {
|
|
@@ -58222,7 +58430,7 @@ var init_bot_folder = __esm({
|
|
|
58222
58430
|
init_atomic();
|
|
58223
58431
|
init_config();
|
|
58224
58432
|
init_bot_profile();
|
|
58225
|
-
BOTS_DIR =
|
|
58433
|
+
BOTS_DIR = join52(DATA_DIR, "bots");
|
|
58226
58434
|
}
|
|
58227
58435
|
});
|
|
58228
58436
|
|
|
@@ -58264,8 +58472,8 @@ __export(browser_engine_exports, {
|
|
|
58264
58472
|
});
|
|
58265
58473
|
import { createHash as createHash16, randomBytes as randomBytes3, randomUUID as randomUUID17 } from "node:crypto";
|
|
58266
58474
|
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
|
|
58475
|
+
import { homedir as homedir28, tmpdir as tmpdir7 } from "node:os";
|
|
58476
|
+
import { delimiter as delimiter7, dirname as dirname12, join as join53, resolve as resolve12 } from "node:path";
|
|
58269
58477
|
function browserRestoreKey(session) {
|
|
58270
58478
|
if (!/^[A-Za-z0-9_.-]{1,96}$/.test(session)) throw new Error("Invalid browser session.");
|
|
58271
58479
|
return `omb-${createHash16("sha256").update(session).digest("hex")}`;
|
|
@@ -58274,11 +58482,11 @@ function browserSessionsDirectory(env) {
|
|
|
58274
58482
|
const namespace = env.AGENT_BROWSER_NAMESPACE;
|
|
58275
58483
|
if (namespace && !/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/.test(namespace)) throw new Error("Invalid browser namespace.");
|
|
58276
58484
|
const home = (process.platform === "win32" ? env.USERPROFILE : env.HOME) || homedir28();
|
|
58277
|
-
const stateRoot = namespace ?
|
|
58278
|
-
return
|
|
58485
|
+
const stateRoot = namespace ? join53(home, ".agent-browser", "namespaces", namespace, "state") : join53(home, ".agent-browser");
|
|
58486
|
+
return join53(stateRoot, "sessions");
|
|
58279
58487
|
}
|
|
58280
58488
|
function managedBrowserConfigPath(env) {
|
|
58281
|
-
return
|
|
58489
|
+
return join53(browserSessionsDirectory(env), "..", "omb-managed-config.json");
|
|
58282
58490
|
}
|
|
58283
58491
|
function ensureManagedBrowserConfig(env) {
|
|
58284
58492
|
const path4 = managedBrowserConfigPath(env);
|
|
@@ -58375,11 +58583,11 @@ async function prepareBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58375
58583
|
ensureManagedBrowserConfig(env);
|
|
58376
58584
|
if (options.persistent === false) return;
|
|
58377
58585
|
const directory = browserSessionsDirectory(env);
|
|
58378
|
-
const key =
|
|
58586
|
+
const key = join53(directory, session);
|
|
58379
58587
|
let pending = preparedBrowserSessions.get(key);
|
|
58380
58588
|
if (!pending) {
|
|
58381
58589
|
pending = (async () => {
|
|
58382
|
-
const targetBase =
|
|
58590
|
+
const targetBase = join53(directory, `${restoreKey}-${session}`);
|
|
58383
58591
|
const hasTarget = () => existsSync25(`${targetBase}.json.enc`) || existsSync25(`${targetBase}.json`);
|
|
58384
58592
|
if (hasTarget()) return;
|
|
58385
58593
|
check2();
|
|
@@ -58389,7 +58597,7 @@ async function prepareBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58389
58597
|
check2();
|
|
58390
58598
|
if (hasTarget()) return;
|
|
58391
58599
|
const candidates = [".json.enc", ".json"].flatMap((suffix) => {
|
|
58392
|
-
const path4 =
|
|
58600
|
+
const path4 = join53(directory, `${session}-${session}${suffix}`);
|
|
58393
58601
|
try {
|
|
58394
58602
|
const stat5 = statSync6(path4);
|
|
58395
58603
|
if (!stat5.isFile()) throw new Error("Saved browser state is not a file.");
|
|
@@ -58424,7 +58632,7 @@ function isMusl(platform = process.platform, exists = existsSync25) {
|
|
|
58424
58632
|
}
|
|
58425
58633
|
function pinnedBinaryPath(dataDir = DATA_DIR, platform = process.platform, arch = process.arch) {
|
|
58426
58634
|
const version2 = agentBrowserReleaseVersion(resolveAgentBrowserReleaseAsset(platform, arch));
|
|
58427
|
-
return
|
|
58635
|
+
return join53(dataDir, ENGINE_DIR, version2, executableName(platform));
|
|
58428
58636
|
}
|
|
58429
58637
|
function onPath(env, platform, exists) {
|
|
58430
58638
|
const pathValue = platform === "win32" ? Object.entries(env).findLast(([key]) => key.toUpperCase() === "PATH")?.[1] : env.PATH;
|
|
@@ -58440,7 +58648,7 @@ function packagedBrowser(options) {
|
|
|
58440
58648
|
const resources = (options.env ?? process.env).OMB_RESOURCES_PATH;
|
|
58441
58649
|
if (!resources) return null;
|
|
58442
58650
|
try {
|
|
58443
|
-
return browserBundlePaths(
|
|
58651
|
+
return browserBundlePaths(join53(resolve12(resources), "browser-engine"), `${options.platform ?? process.platform}-${options.arch ?? process.arch}`);
|
|
58444
58652
|
} catch {
|
|
58445
58653
|
return null;
|
|
58446
58654
|
}
|
|
@@ -58478,7 +58686,7 @@ async function installAgentBrowserBinary(options = {}) {
|
|
|
58478
58686
|
const asset = options.asset ?? resolveAgentBrowserReleaseAsset(platform, options.arch ?? process.arch, options.musl ?? isMusl(platform));
|
|
58479
58687
|
if (!asset) throw new Error(`agent-browser publishes no build for ${platform}-${options.arch ?? process.arch}.`);
|
|
58480
58688
|
const destination = pinnedBinaryPath(options.dataDir, platform, options.arch);
|
|
58481
|
-
const directory =
|
|
58689
|
+
const directory = join53(destination, "..");
|
|
58482
58690
|
mkdirSync26(directory, { recursive: true, mode: 448 });
|
|
58483
58691
|
const url2 = agentBrowserReleaseUrl(asset);
|
|
58484
58692
|
options.log?.(`downloading agent-browser ${agentBrowserReleaseVersion(asset)} (${Math.round(asset.bytes / 1024 / 1024)} MB, digest pinned)`);
|
|
@@ -58521,7 +58729,7 @@ async function installAgentBrowserBinary(options = {}) {
|
|
|
58521
58729
|
for (const name of readdirSync8(directory)) {
|
|
58522
58730
|
if (!name.endsWith(".part")) continue;
|
|
58523
58731
|
try {
|
|
58524
|
-
unlinkSync7(
|
|
58732
|
+
unlinkSync7(join53(directory, name));
|
|
58525
58733
|
} catch {
|
|
58526
58734
|
}
|
|
58527
58735
|
}
|
|
@@ -58580,7 +58788,7 @@ function ensureChrome(binaryPath, options = {}) {
|
|
|
58580
58788
|
});
|
|
58581
58789
|
}
|
|
58582
58790
|
function browserEngineEncryptionKey(dataDir = DATA_DIR) {
|
|
58583
|
-
const file2 =
|
|
58791
|
+
const file2 = join53(dataDir, KEY_FILE);
|
|
58584
58792
|
try {
|
|
58585
58793
|
const existing = readFileSync32(file2, "utf8").trim();
|
|
58586
58794
|
if (/^[0-9a-f]{64}$/u.test(existing)) return existing;
|
|
@@ -58641,7 +58849,7 @@ function agentBrowserIntegration(input) {
|
|
|
58641
58849
|
return { command: input.binaryPath, args: ["mcp", "--tools", "core", "--no-webmcp"], env };
|
|
58642
58850
|
}
|
|
58643
58851
|
function agentBrowserFrame(input) {
|
|
58644
|
-
const file2 =
|
|
58852
|
+
const file2 = join53(tmpdir7(), `openmausbot-browser-${randomUUID17()}.png`);
|
|
58645
58853
|
return new Promise((settle, fail) => {
|
|
58646
58854
|
const child = spawnCommand(input.binaryPath, ["screenshot", file2], {
|
|
58647
58855
|
env: browserRuntimeEnv(input.env),
|
|
@@ -58711,8 +58919,8 @@ async function clearBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58711
58919
|
}
|
|
58712
58920
|
};
|
|
58713
58921
|
try {
|
|
58714
|
-
for (const base3 of bases) for (const suffix of [".json", ".json.enc", ".json.previous", ".json.enc.previous"]) remove(
|
|
58715
|
-
const pendingDirectory =
|
|
58922
|
+
for (const base3 of bases) for (const suffix of [".json", ".json.enc", ".json.previous", ".json.enc.previous"]) remove(join53(directory, base3 + suffix));
|
|
58923
|
+
const pendingDirectory = join53(directory, ".tmp");
|
|
58716
58924
|
let pendingFiles = [];
|
|
58717
58925
|
try {
|
|
58718
58926
|
pendingFiles = readdirSync8(pendingDirectory);
|
|
@@ -58720,8 +58928,8 @@ async function clearBrowserSessionState(binaryPath, session, options = {}) {
|
|
|
58720
58928
|
if (error51.code !== "ENOENT") throw error51;
|
|
58721
58929
|
}
|
|
58722
58930
|
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(
|
|
58931
|
+
for (const name of pendingFiles) if (candidates.some((candidate) => candidate.test(name))) remove(join53(pendingDirectory, name));
|
|
58932
|
+
preparedBrowserSessions.delete(join53(directory, session));
|
|
58725
58933
|
return true;
|
|
58726
58934
|
} catch {
|
|
58727
58935
|
return false;
|
|
@@ -58830,7 +59038,7 @@ import { spawn as spawn10 } from "node:child_process";
|
|
|
58830
59038
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
58831
59039
|
import { closeSync as closeSync6, existsSync as existsSync26, mkdirSync as mkdirSync27, openSync as openSync6, readFileSync as readFileSync33 } from "node:fs";
|
|
58832
59040
|
import { homedir as homedir29 } from "node:os";
|
|
58833
|
-
import { dirname as dirname13, join as
|
|
59041
|
+
import { dirname as dirname13, join as join54, resolve as resolve13 } from "node:path";
|
|
58834
59042
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
58835
59043
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
58836
59044
|
|
|
@@ -62550,7 +62758,7 @@ function parseArgs2(argv, env = process.env) {
|
|
|
62550
62758
|
const options = {
|
|
62551
62759
|
command: command === "--help" || command === "-h" ? "help" : command,
|
|
62552
62760
|
port: Number(env.OMB_PORT || 8799),
|
|
62553
|
-
dataDir: env.OMB_DATA_DIR ||
|
|
62761
|
+
dataDir: env.OMB_DATA_DIR || join54(homedir29(), ".atomic-app"),
|
|
62554
62762
|
tailscale: false,
|
|
62555
62763
|
tunnel: false,
|
|
62556
62764
|
client: false,
|
|
@@ -62689,7 +62897,7 @@ async function isWorkspaceRunning(options) {
|
|
|
62689
62897
|
try {
|
|
62690
62898
|
const { status, body } = await api(options.port, "/api/health");
|
|
62691
62899
|
if (status !== 200 || body?.app !== "openmausbot") return false;
|
|
62692
|
-
const expected = readFileSync33(
|
|
62900
|
+
const expected = readFileSync33(join54(options.dataDir, "environment-id"), "utf8").trim();
|
|
62693
62901
|
const descriptor = await api(options.port, "/.well-known/openmausbot/environment");
|
|
62694
62902
|
return /^[0-9a-f-]{36}$/i.test(expected) && descriptor.status === 200 && descriptor.body?.environmentId === expected;
|
|
62695
62903
|
} catch {
|
|
@@ -62928,7 +63136,7 @@ async function runStatus(options, io2 = defaultIo()) {
|
|
|
62928
63136
|
return code;
|
|
62929
63137
|
}
|
|
62930
63138
|
async function runAccess(options, io2 = defaultIo()) {
|
|
62931
|
-
const file2 =
|
|
63139
|
+
const file2 = join54(options.dataDir, "config.json");
|
|
62932
63140
|
let raw = {};
|
|
62933
63141
|
if (existsSync26(file2)) {
|
|
62934
63142
|
try {
|
|
@@ -63094,16 +63302,16 @@ async function runBrowser(options, io2 = defaultIo()) {
|
|
|
63094
63302
|
return 0;
|
|
63095
63303
|
}
|
|
63096
63304
|
function serverEntry(here = HERE2) {
|
|
63097
|
-
const bundled =
|
|
63305
|
+
const bundled = join54(here, "index.js");
|
|
63098
63306
|
const root = resolve13(here, "..");
|
|
63099
63307
|
if (existsSync26(bundled)) {
|
|
63100
|
-
const staticDir2 = [
|
|
63101
|
-
const skillsDir = existsSync26(
|
|
63308
|
+
const staticDir2 = [join54(root, "dist"), join54(here, "..", "ui")].find((d) => existsSync26(join54(d, "index.html"))) ?? null;
|
|
63309
|
+
const skillsDir = existsSync26(join54(root, "skills")) ? join54(root, "skills") : null;
|
|
63102
63310
|
return { command: process.execPath, args: [bundled], staticDir: staticDir2, skillsDir };
|
|
63103
63311
|
}
|
|
63104
|
-
const source2 =
|
|
63105
|
-
const staticDir = existsSync26(
|
|
63106
|
-
return { command: process.execPath, args: ["--experimental-strip-types", source2], staticDir, skillsDir: existsSync26(
|
|
63312
|
+
const source2 = join54(here, "index.ts");
|
|
63313
|
+
const staticDir = existsSync26(join54(root, "dist", "index.html")) ? join54(root, "dist") : null;
|
|
63314
|
+
return { command: process.execPath, args: ["--experimental-strip-types", source2], staticDir, skillsDir: existsSync26(join54(root, "skills")) ? join54(root, "skills") : null };
|
|
63107
63315
|
}
|
|
63108
63316
|
async function planTunnel(options, log) {
|
|
63109
63317
|
let access2 = null;
|
|
@@ -63146,7 +63354,7 @@ async function runServe(options, log = console.log) {
|
|
|
63146
63354
|
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
63355
|
return 1;
|
|
63148
63356
|
}
|
|
63149
|
-
if (await reportBusyPort(options.port, options.dataDir ===
|
|
63357
|
+
if (await reportBusyPort(options.port, options.dataDir === join54(homedir29(), ".atomic-app") ? "" : ` --data-dir ${options.dataDir}`)) return 1;
|
|
63150
63358
|
let publicUrl = options.publicUrl;
|
|
63151
63359
|
let tailscale = null;
|
|
63152
63360
|
if (options.tailscale) {
|
|
@@ -63208,9 +63416,9 @@ async function runServe(options, log = console.log) {
|
|
|
63208
63416
|
let child;
|
|
63209
63417
|
try {
|
|
63210
63418
|
if (options.guided) {
|
|
63211
|
-
const logsDir =
|
|
63419
|
+
const logsDir = join54(options.dataDir, "logs");
|
|
63212
63420
|
mkdirSync27(logsDir, { recursive: true, mode: 448 });
|
|
63213
|
-
logPath =
|
|
63421
|
+
logPath = join54(logsDir, `server-${Date.now()}-${process.pid}.log`);
|
|
63214
63422
|
logFd = openSync6(logPath, "wx", 384);
|
|
63215
63423
|
log("\nStarting your workspace\u2026");
|
|
63216
63424
|
}
|
|
@@ -63414,7 +63622,7 @@ async function runOnboardingCommand(options, io2 = defaultIo(), startServer = ru
|
|
|
63414
63622
|
saveCliStartup2(options.dataDir, startupPreferences(launch));
|
|
63415
63623
|
}
|
|
63416
63624
|
if (options.command === "setup") {
|
|
63417
|
-
const flags = [options.dataDir !==
|
|
63625
|
+
const flags = [options.dataDir !== join54(homedir29(), ".atomic-app") && ` --data-dir ${options.dataDir}`, options.port !== 8799 && ` --port ${options.port}`].filter(Boolean).join("");
|
|
63418
63626
|
io2.log(`
|
|
63419
63627
|
All set. Start with: chibi${flags ? ` start${flags}` : ""} (or npx @chibitek/chibi without a global install).`);
|
|
63420
63628
|
return 0;
|