UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

36 lines (35 loc) • 1.75 kB
import { t as splitTrailingAuthProfile } from "./model-ref-profile-C7DWqVP0.mjs"; import { a as resolveAgentEffectiveModelPrimary } from "./agent-scope-BwB8YH6y.mjs"; import { r as callGateway } from "./call-DVCK1deJ.mjs"; import { x as toSavedAuthSetupKind } from "./setup-inference-core-DP4j3gfH.mjs"; import { r as activateSetupInference } from "./setup-inference-BaK6auaX.mjs"; import { i as loadValidConfigSnapshotOrThrow, l as resolveModelsTargetAgent } from "./shared-jZuoMzdG.mjs"; import { n as refreshRunningGatewayAuthState } from "./auth-refresh-CoYY69-l.mjs"; //#region src/commands/models/auth-activate.ts async function modelsAuthActivateCommand(e, t) { const { runtimeConfig: n } = await loadValidConfigSnapshotOrThrow(); const { agentId: r } = resolveModelsTargetAgent(n, e.agent, { kind: "mutation" }); const i = await activateSetupInference({ kind: toSavedAuthSetupKind(e.profileId.trim()), agentId: r, surface: "cli", activationConfirmed: true, runtime: t }); if (!i.ok) throw new Error(i.error); const a = await refreshRunningGatewayAuthState(r, "update", t); for (const e of i.lines) t.log(e); let o = false; if (a === "refreshed") try { const t = await callGateway({ method: "config.get", params: {}, timeoutMs: 3e3, requireLocalBackendSharedAuth: true }); o = t.configRevisionHash === t.appliedConfigHash && splitTrailingAuthProfile(resolveAgentEffectiveModelPrimary(t.config, r) ?? "").profile === e.profileId.trim(); } catch {} t.log(o ? `Saved sign-in activated for ${r}: ${e.profileId}` : "Sign-in verified and saved. The running connection could not be confirmed. Run `openclaw gateway restart` to apply the saved settings."); } //#endregion export { modelsAuthActivateCommand };