UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

41 lines (40 loc) • 1.55 kB
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs"; import { d as asPositiveFiniteNumber } from "./number-coercion-D6u-4YD8.mjs"; import { n as resolveGatewayDiscoveryEndpoint } from "./bonjour-discovery-B1DGhRj_.mjs"; //#region src/infra/gateway-discovery-targets.ts function buildGatewayDiscoveryTarget(e, t) { const n = resolveGatewayDiscoveryEndpoint(e); const r = asPositiveFiniteNumber(e.sshPort) ?? null; const i = normalizeOptionalString(t?.sshUser) ?? ""; const a = n ? i ? `${i}@${n.host}` : n.host : null; const o = a && r && r !== 22 ? `${a}:${r}` : a; return { title: normalizeOptionalString(e.displayName || e.instanceName || "Gateway") ?? "Gateway", domain: normalizeOptionalString(e.domain || "local.") ?? "local.", endpoint: n, wsUrl: n?.wsUrl ?? null, sshPort: r, sshTarget: o }; } function buildGatewayDiscoveryLabel(e) { const t = buildGatewayDiscoveryTarget(e); const n = t.endpoint ? `${t.endpoint.host}:${t.endpoint.port}` : "host unknown"; return `${t.title} (${n})`; } function serializeGatewayDiscoveryBeacon(e) { const t = buildGatewayDiscoveryTarget(e); return { instanceName: e.instanceName, displayName: e.displayName ?? null, domain: e.domain ?? null, host: e.host ?? null, lanHost: e.lanHost ?? null, tailnetDns: e.tailnetDns ?? null, gatewayPort: e.gatewayPort ?? null, sshPort: e.sshPort ?? null, wsUrl: t.wsUrl }; } //#endregion export { buildGatewayDiscoveryTarget as n, serializeGatewayDiscoveryBeacon as r, buildGatewayDiscoveryLabel as t };