UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.87 kB
import{l as normalizeOptionalString,o as normalizeLowercaseStringOrEmpty}from"./string-coerce-CpTFcSwY.mjs";import{r as defaultRuntime}from"./runtime-DIcLIHcp.mjs";import{o as getAsyncWorkSignal}from"./async-work-scope-DBcxYU4O.mjs";import{n as sanitizeTerminalText}from"./safe-text-B_QTgn0s.mjs";import{t as formatErrorMessage}from"./errors-D37BJTfI.mjs";import{n as isRich,r as theme}from"./theme-DS2CtI9X.mjs";import{n as runCommandWithRuntime}from"./cli-utils-Dm67QQ71.mjs"; //!src/cli/nodes-cli/cli-utils.ts function getNodesTheme(){const e=isRich();const color=t=>n=>e?t(n):n;return{rich:e,heading:color(theme.heading),ok:color(theme.success),warn:color(theme.warn),muted:color(theme.muted),error:color(theme.error)}}function formatConnectionFlagReminder(e){const t=[normalizeOptionalString(e.url)?`--url`:null,normalizeOptionalString(e.token)?`--token`:null].filter(e=>e!==null);return t.length>0?`Reuse the same connection option${t.length===1?``:`s`} when rerunning: ${t.join(`, `)}.`:null}function runNodesCommand(e,t){return runCommandWithRuntime(defaultRuntime,t,t=>{const n=formatErrorMessage(t);const{error:r,warn:i}=getNodesTheme();defaultRuntime.error(r(sanitizeTerminalText(`nodes ${e} failed: ${n}`)));const a=normalizeLowercaseStringOrEmpty(n);if(a.includes(`unauthorizedclient`)||a.includes(`bridge client is not authorized`)||a.includes(`unsigned bridge clients are not allowed`))defaultRuntime.error(i(`peekaboo bridge rejected the client. sign the peekaboo CLI (TeamID Y5PE65HELJ) or launch the host with PEEKABOO_ALLOW_UNSIGNED_SOCKET_CLIENTS=1 for local dev.`));defaultRuntime.exit(1)})}function runNodesReadCommand(e,t){const n=getAsyncWorkSignal();return runNodesCommand(e,async()=>{try{await t(n)}catch(e){if(!n?.aborted)throw e}})}export{runNodesReadCommand as i,getNodesTheme as n,runNodesCommand as r,formatConnectionFlagReminder as t};