UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.55 kB
import{t as splitTrailingAuthProfile}from"./model-ref-profile-DFGpvDZX.mjs";import{o as resolveAgentEffectiveModelPrimary}from"./agent-scope-Dw5XRSEh.mjs";import{r as callGateway}from"./call-CVqWsTxX.mjs";import{S as toSavedAuthSetupKind}from"./setup-inference-core-DuOcVPPf.mjs";import{r as activateSetupInference}from"./setup-inference-D4RUp64U.mjs";import{i as loadValidConfigSnapshotOrThrow,l as resolveModelsTargetAgent}from"./shared-Sc7lnGKV.mjs";import{n as refreshRunningGatewayAuthState}from"./auth-refresh-B35YNJt_.mjs"; //!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.")}export{modelsAuthActivateCommand};