UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

63 lines (62 loc) • 2.16 kB
import "./session-key-CqAyZeVk.mjs"; import { t as DEFAULT_ACCOUNT_ID } from "./account-id-BqKT3GuY.mjs"; import "./setup-contract-hyC_qGOR.mjs"; import { t as formatDocsLink } from "./links-41lO3DKP.mjs"; import "./setup-CpdkGBHT.mjs"; //#region src/plugin-sdk/optional-channel-setup.ts function buildOptionalChannelSetupMessage(e) { const t = e.npmSpec ?? `the ${e.label} plugin`; const n = [`${e.label} setup requires ${t} to be installed.`]; if (e.docsPath) n.push(`Docs: ${formatDocsLink(e.docsPath, e.docsPath.replace(/^\/+/u, ""))}`); return n.join(" "); } /** * Creates a setup adapter for optional channel plugins that are not installed. * Validation returns install guidance, while config mutation fails with the same * message so setup flows cannot silently create partial channel config. */ function createOptionalChannelSetupAdapter(e) { const t = buildOptionalChannelSetupMessage(e); return { resolveAccountId: ({ accountId: e }) => e ?? "default", applyAccountConfig: () => { throw new Error(t); }, validateInput: () => t }; } /** * Creates a wizard surface for optional channel plugins that are not installed. * The wizard is always unconfigured and stops finalize with install guidance. */ function createOptionalChannelSetupWizard(e) { const t = buildOptionalChannelSetupMessage(e); return { channel: e.channel, status: { configuredLabel: `${e.label} plugin installed`, unconfiguredLabel: `install ${e.label} plugin`, configuredHint: t, unconfiguredHint: t, unconfiguredScore: 0, resolveConfigured: () => false, resolveStatusLines: () => [t], resolveSelectionHint: () => t }, credentials: [], finalize: async () => { throw new Error(t); } }; } //#endregion //#region src/plugin-sdk/channel-setup.ts /** Build both optional setup surfaces from one metadata object. */ function createOptionalChannelSetupSurface(e) { return { setupAdapter: createOptionalChannelSetupAdapter(e), setupWizard: createOptionalChannelSetupWizard(e) }; } //#endregion export { createOptionalChannelSetupAdapter as n, createOptionalChannelSetupWizard as r, createOptionalChannelSetupSurface as t };