UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

43 lines (42 loc) • 1.9 kB
import { r as terminalText } from "./safe-text-C80HAQ2e.mjs"; import { t as dedupeByKey } from "./dedupe-by-key-Cpowmfct.mjs"; import { r as theme, t as colorize } from "./theme-BOI0xyRZ.mjs"; import { n as resolveGatewayDiscoveryEndpoint } from "./bonjour-discovery-B1DGhRj_.mjs"; import { n as buildGatewayDiscoveryTarget } from "./gateway-discovery-targets-BLlhMUdW.mjs"; //#region src/cli/gateway-cli/discover.ts function dedupeBeacons(e) { return dedupeByKey(e, (e) => { const t = resolveGatewayDiscoveryEndpoint(e)?.host ?? ""; return [ e.domain ?? "", e.instanceName ?? "", e.displayName ?? "", t, String(e.port ?? ""), String(e.gatewayPort ?? "") ].join("|"); }); } function renderBeaconLines(e, t) { const n = buildGatewayDiscoveryTarget(e); const r = [`- ${colorize(t, theme.accentBright, terminalText`${n.title}`)} ${colorize(t, theme.muted, terminalText`${n.domain}`)}`]; for (const [n, i] of [ ["tailnet", e.tailnetDns], ["lan", e.lanHost], ["host", e.host] ]) if (i) r.push(` ${colorize(t, theme.info, n)}` + terminalText`: ${i}`); if (n.wsUrl) r.push(` ${colorize(t, theme.muted, "ws")}: ${colorize(t, theme.command, terminalText`${n.wsUrl}`)}`); if (e.role) r.push(` ${colorize(t, theme.muted, "role")}` + terminalText`: ${e.role}`); if (e.transport) r.push(` ${colorize(t, theme.muted, "transport")}` + terminalText`: ${e.transport}`); if (e.gatewayTls) { const n = e.gatewayTlsFingerprintSha256 ? `sha256 ${e.gatewayTlsFingerprintSha256}` : "enabled"; r.push(` ${colorize(t, theme.muted, "tls")}` + terminalText`: ${n}`); } if (n.endpoint && n.sshPort) { const e = terminalText`ssh -N -L 18789:127.0.0.1:${n.endpoint.port} <user>@${n.endpoint.host} -p ${n.sshPort}`; r.push(` ${colorize(t, theme.muted, "ssh")}: ${colorize(t, theme.command, e)}`); } return r; } //#endregion export { dedupeBeacons, renderBeaconLines };