UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

30 lines (29 loc) • 1.84 kB
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs"; import { i as buildPluginApprovalExpiredMessage, o as buildPluginApprovalResolvedMessage } from "./plugin-approvals-DAqwCYQr.mjs"; import { h as normalizeApprovalRequest } from "./approval-request-account-binding-DOCAr58L.mjs"; import "./approval-gateway-runtime-CGnxw7Hi.mjs"; import { n as buildSystemAgentApprovalResolvedText, t as SYSTEM_AGENT_APPROVAL_EXPIRED_TEXT } from "./approval-terminal-CZf0AP8U.mjs"; import "./approval-handler-runtime-DaVxiojg.mjs"; //#region src/plugin-sdk/approval-handler-runtime.ts /** Builds channel-visible resolved approval text for every approval kind. */ function buildChannelApprovalResolvedText(e) { if (e.view.approvalKind === "system-agent") return buildSystemAgentApprovalResolvedText({ ...e.view, decision: e.resolved.decision }); if (e.view.approvalKind === "plugin") return buildPluginApprovalResolvedMessage(e.resolved); const t = e.resolved.resolvedBy ? ` Resolved by ${e.resolved.resolvedBy}.` : ""; return `✅ Exec approval ${e.resolved.decision}.${t} ID: ${e.request.id}`; } /** Builds channel-visible expiration text for exec and plugin approvals. */ function buildChannelApprovalExpiredText(e) { const t = normalizeApprovalRequest(e.request); if (t.approvalKind === "system-agent") return SYSTEM_AGENT_APPROVAL_EXPIRED_TEXT; if (t.approvalKind === "plugin") return buildPluginApprovalExpiredMessage(t); return `⏱️ Exec approval expired. ID: ${t.id}`; } function resolvePreparedApprovalAccountId(e) { return normalizeOptionalString(e.plannedAccountId) ?? normalizeOptionalString(e.contextAccountId) ?? normalizeOptionalString(e.fallbackAccountId); } //#endregion export { buildChannelApprovalResolvedText as n, resolvePreparedApprovalAccountId as r, buildChannelApprovalExpiredText as t };