openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.15 kB
JavaScript
import{t as ExitError}from"./runtime-DIcLIHcp.mjs";import{o as registerSecretValueForRedaction}from"./secret-redaction-registry-DospXE4m.mjs";import{n as normalizeSecretInput}from"./normalize-secret-input-CEFJUjQX.mjs";import{n as WizardCancelledError}from"./prompts-BviNnQo2.mjs";import{t as createClackPrompter}from"./clack-prompter-CkhFfk2k.mjs";import{r as readPipedStdin}from"./auth-manual-input-Cy929dbG.mjs";import{addAbortSignal}from"node:stream";
//!src/commands/models/auth-gateway.ts
async function readGatewayApiKeyParams(e,t){let n;try{n=process.stdin.isTTY?await createClackPrompter(process.stderr,t).text({message:`Paste API key`,sensitive:true}):await readPipedStdin(addAbortSignal(t,process.stdin))}catch(e){if(e instanceof WizardCancelledError)throw new ExitError(0);throw e}t.throwIfAborted();const r=normalizeSecretInput(n);if(!r)throw new Error(`No API key was supplied. Rerun this command and paste a non-empty API key, or pipe one to stdin.`);registerSecretValueForRedaction(r);if(!e.provider)throw new Error(`Missing --provider.`);return{provider:e.provider,apiKey:r,agentId:e.agent}}export{readGatewayApiKeyParams as t};