diff --git a/docker/bridge/index.mjs b/docker/bridge/index.mjs index 2838271..c562baf 100644 --- a/docker/bridge/index.mjs +++ b/docker/bridge/index.mjs @@ -3,7 +3,7 @@ // web prompts through pi.sendUserMessage. This process just hosts the session. // Global npm layout: resolve pi via absolute path (NODE_PATH does not apply to ESM). import { spawn } from "node:child_process"; -import { existsSync } from "node:fs"; +import { copyFileSync, existsSync } from "node:fs"; import { createAgentSession, ModelRuntime, @@ -61,6 +61,13 @@ process.on("unhandledRejection", (err) => { try { await runRepoSetup(); + // Dotfiles-less bakes ship only models.json.fallback: promote it so the + // registry always resolves the zai provider (glm) instead of "not found". + const piAgent = "/root/.pi/agent"; + if (!existsSync(`${piAgent}/models.json`) && existsSync(`${piAgent}/models.json.fallback`)) { + copyFileSync(`${piAgent}/models.json.fallback`, `${piAgent}/models.json`); + console.error("[lvmh-bridge] promoted models.json.fallback -> models.json"); + } // Optional initial model: LVMH_MODEL="provider/model-id" from the spawn // request. Resolved against the session's model registry; a bad value is // logged and falls back to the default model.