openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1,023 lines (1,022 loc) • 44.4 kB
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-CCIiB4H7.mjs";
import { m as asSafeIntegerInRange } from "./number-coercion-D6u-4YD8.mjs";
import { f as omitUndefinedFields, i as asOptionalObjectRecord, l as isRecord } from "./record-coerce-CVPuDqcc.mjs";
import { c as normalizeOptionalTrimmedStringList, m as normalizeTrimmedStringList, n as containsAsciiControlCharacter, v as normalizeUniqueTrimmedStringList } from "./string-normalization-DLmfYZXI.mjs";
import { t as isBlockedObjectKey } from "./prototype-keys-CLGi5xDj.mjs";
import { n as ENV_SECRET_REF_ID_RE } from "./ref-contract-b8L-9DrQ.mjs";
import "./types.secrets-BmNLLnHp.mjs";
import { i as matchRootFileOpenFailure } from "./boundary-file-read-BfaFLDqt.mjs";
import { n as sanitizeForLog } from "./ansi-CZa2t0Hf.mjs";
import "./utils-C8YECn2Q.mjs";
import { r as normalizeProviderId } from "./provider-id-b5XGSf9C.mjs";
import { n as ok, t as err } from "./result-CV1-31DB.mjs";
import { c as readPluginCacheFile, i as pluginCacheLstatSync, n as parsePluginCacheJson } from "./plugin-cache-files-e1aGp2KM.mjs";
import { t as normalizePluginPolicyId } from "./plugin-policy-id-CkilMowp.mjs";
import { t as normalizeModelCatalog } from "./model-catalog-normalize-DcKoDb8P.mjs";
import { n as validatePluginUiCapabilities } from "./plugin-ui-capabilities-CphHLqKu.mjs";
import { t as validatePluginCategories } from "./src-DFVOpZlE.mjs";
import { t as dedupeByKey } from "./dedupe-by-key-Cpowmfct.mjs";
import { _ as normalizeStringListRecord, a as normalizeManifestContracts, c as normalizeManifestObjectList, d as normalizeManifestStringRecord, f as normalizeManifestTranscriptSources, g as normalizeProviderAssistantVisibility, h as normalizePluginToolMetadata, i as normalizeManifestConfigContracts, l as normalizeManifestProviderAuthAliases, m as normalizeNamedMetadataRecord, n as normalizeCapabilityProviderMetadata, o as normalizeManifestDecisionModels, p as normalizeMediaUnderstandingProviderMetadata, r as normalizeManifestCatalog, s as normalizeManifestMcpServers, t as isPluginManifestOnboardingScope, u as normalizeManifestProviderEndpoints, v as optionalManifestFields } from "./manifest-capability-normalizers-mW51WFYi.mjs";
import { t as normalizeManifestPlatforms } from "./manifest-platforms-UY_COXnx.mjs";
import { t as normalizeManifestCommandAliases } from "./manifest-command-aliases-BbKGP3od.mjs";
import { r as normalizeModelPricingProvider } from "./model-catalog-pricing-BcJ_qCkh.mjs";
import { n as normalizeManifestProviderRequestProvider } from "./plugin-provider-request-policy-BLJf3HzF.mjs";
import { a as isThemeId, r as THEME_LOCAL_ID_PATTERN } from "./theme-ids-CP6Aodag.mjs";
import { a as THEME_BRAND_ICON_IDS, c as THEME_CRITTER_IDS, f as THEME_NAME_MAX_LENGTH, i as THEME_AVATAR_HAT_IDS, l as THEME_DESCRIPTION_MAX_LENGTH, r as THEME_ARTWORK_ID_PATTERN } from "./theme-DHNzyMXg.mjs";
import { createRequire } from "node:module";
import path from "node:path";
//#region src/plugins/manifest-control-ui.ts
/** Package authoring metadata names source; the runtime manifest names only built assets. */
function controlUiSource(e) {
const t = isRecord(e.openclaw) ? e.openclaw.controlUi : void 0;
if (t === void 0) return;
if (typeof t !== "string" || !t.trim()) throw new Error("package.json openclaw.controlUi must name a browser source entrypoint.");
return t;
}
function normalizeManifestControlUi(e, t = []) {
if (e === void 0) return ok(void 0);
if (!isRecord(e) || Object.keys(e).some((e) => ![
"entry",
"styles",
"activation",
"settingsViews"
].includes(e))) return err("controlUi contains an unknown field");
if (e.activation !== void 0 && e.activation !== "settings-only") return err("controlUi.activation must be settings-only when specified");
const n = new Set(Array.isArray(t) ? t : []);
const r = [];
const i = /* @__PURE__ */ new Set();
if (e.settingsViews !== void 0) {
if (!Array.isArray(e.settingsViews) || e.settingsViews.length === 0 || e.settingsViews.length > 2 + n.size) return err("controlUi.settingsViews must declare unique Settings placements");
for (const t of e.settingsViews) {
if (!isRecord(t)) return err("invalid Control UI Settings placement");
let e;
if (Object.keys(t).length === 2 && t.section === "memory" && (t.panel === "overview" || t.panel === "memories")) e = {
section: "memory",
panel: t.panel
};
else if (Object.keys(t).length === 3 && t.section === "channels" && t.panel === "detail" && typeof t.channelId === "string" && /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(t.channelId) && n.has(t.channelId)) e = {
section: "channels",
panel: "detail",
channelId: t.channelId
};
else return err("Control UI Settings placement must name Memory or an owned channel detail");
const a = JSON.stringify(e);
if (i.has(a)) return err("controlUi.settingsViews must declare unique Settings placements");
i.add(a);
r.push(e);
}
}
if (e.activation === "settings-only" && !e.settingsViews) return err("settings-only Control UI requires a Settings placement");
const a = typeof e.entry === "string" ? e.entry.replace(/^\.\//u, "") : "";
if (a.length > 512 || !/^dist\/(?:[\w-][\w.-]*\/)+[\w-][\w.-]*\.m?js$/u.test(a)) return err("controlUi.entry must be a JavaScript file in a dedicated dist subdirectory");
if (e.styles !== void 0 && (!Array.isArray(e.styles) || e.styles.length > 16)) return err("controlUi.styles must be an array of at most 16 stylesheets");
const o = a.slice(0, a.lastIndexOf("/") + 1);
const s = [];
for (const t of e.styles ?? []) {
const e = typeof t === "string" ? t.replace(/^\.\//u, "") : "";
if (e.length > 512 || !e.startsWith(o) || !/^(?:[\w-][\w.-]*\/)+[\w-][\w.-]*\.css$/u.test(e)) return err("controlUi.styles must contain CSS files under the entry's asset directory");
if (!s.includes(e)) s.push(e);
}
return ok({
entry: a,
...s.length > 0 ? { styles: s } : {},
...e.activation === "settings-only" ? { activation: e.activation } : {},
...r.length > 0 ? { settingsViews: r } : {}
});
}
//#endregion
//#region src/cli/program/command-descriptor-utils.ts
const SAFE_COMMAND_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
/** Normalize and validate a command descriptor name for safe Commander registration. */
function normalizeCommandDescriptorName(e) {
const t = e.trim();
return SAFE_COMMAND_NAME_PATTERN.test(t) ? t : null;
}
function assertSafeCommandDescriptorName(e) {
const t = normalizeCommandDescriptorName(e);
if (!t) throw new Error(`Invalid CLI command name: ${JSON.stringify(e.trim())}`);
return t;
}
/** Strip unsafe terminal content from descriptor descriptions. */
function sanitizeCommandDescriptorDescription(e) {
return sanitizeForLog(e).trim();
}
/** Merge descriptor groups while keeping the first descriptor for each command name. */
function collectUniqueCommandDescriptors(e) {
return dedupeByKey(e.flat(), (e) => e.name);
}
/** Add safe placeholder commands to Commander without duplicating existing command names. */
function addCommandDescriptorsToProgram(e, t, n = /* @__PURE__ */ new Set()) {
for (const r of t) {
const t = assertSafeCommandDescriptorName(r.name);
if (n.has(t)) continue;
e.command(t, { hidden: r.hidden }).description(sanitizeCommandDescriptorDescription(r.description));
n.add(t);
}
return n;
}
//#endregion
//#region src/plugins/setup-presentation-url.ts
function normalizeSetupPresentationHttpsUrl(e) {
const t = normalizeOptionalString(e);
const n = t ? URL.parse(t) : null;
if (!n) return;
const r = n.toString();
return n.protocol === "https:" && n.hostname && !n.username && !n.password && r.length <= 2048 ? r : void 0;
}
//#endregion
//#region src/plugins/manifest-setup-normalizers.ts
function normalizeManifestActivation(e) {
if (!isRecord(e)) return;
const t = {};
if (typeof e.onStartup === "boolean") t.onStartup = e.onStartup;
for (const n of [
"onProviders",
"onAgentHarnesses",
"onCommands",
"onChannels",
"onRoutes",
"onConfigPaths"
]) {
const r = normalizeTrimmedStringList(e[n]);
if (r.length > 0) t[n] = r;
}
const n = normalizeTrimmedStringList(e.onCapabilities).filter((e) => e === "provider" || e === "channel" || e === "tool" || e === "hook");
if (n.length > 0) t.onCapabilities = n;
return Object.keys(t).length > 0 ? t : void 0;
}
function normalizeChannelAccountKeyPolicies(e, t) {
if (!isRecord(e)) return;
const n = Object.create(null);
for (const r of t) {
if (isBlockedObjectKey(r) || !Object.hasOwn(e, r)) continue;
const t = e[r];
const i = isRecord(t) ? normalizeOptionalString(t.canonicalAliasesRequireOwnField) : void 0;
if (i && !isBlockedObjectKey(i)) n[r] = { canonicalAliasesRequireOwnField: i };
}
return Object.keys(n).length ? n : void 0;
}
function normalizeManifestCliCommands(e) {
if (!Array.isArray(e)) return;
const t = /* @__PURE__ */ new Set();
return normalizeManifestObjectList(e, (e) => {
if (typeof e.name !== "string" || typeof e.description !== "string") return;
const n = normalizeCommandDescriptorName(e.name);
const r = sanitizeCommandDescriptorDescription(e.description);
if (!n || !r || typeof e.hasSubcommands !== "boolean" || t.has(n)) return;
t.add(n);
return {
name: n,
description: r,
hasSubcommands: e.hasSubcommands
};
}) ?? [];
}
function normalizeManifestSetup(e) {
if (!isRecord(e)) return;
const t = isRecord(e.nativeSessionCatalog) ? omitUndefinedFields({
label: normalizeOptionalString(e.nativeSessionCatalog.label) ?? "",
legacyDefaultEnabled: e.nativeSessionCatalog.legacyDefaultEnabled === true ? true : void 0,
nodeCommands: normalizeOptionalTrimmedStringList(e.nativeSessionCatalog.nodeCommands),
description: normalizeOptionalString(e.nativeSessionCatalog.description)
}) : void 0;
return optionalManifestFields({
providers: normalizeManifestObjectList(e.providers, (e) => {
const t = normalizeOptionalString(e.id) ?? "";
if (!t) return;
return omitUndefinedFields({
id: t,
authMethods: normalizeOptionalTrimmedStringList(e.authMethods),
envVars: normalizeOptionalTrimmedStringList(e.envVars),
authEvidence: normalizeManifestObjectList(e.authEvidence, (e) => {
if (e.type !== "local-file-with-env") return;
const t = normalizeOptionalString(e.credentialMarker);
if (!t) return;
const n = normalizeOptionalString(e.fileEnvVar);
const r = normalizeOptionalTrimmedStringList(e.fallbackPaths);
if (!n && !r) return;
return omitUndefinedFields({
type: "local-file-with-env",
fileEnvVar: n,
fallbackPaths: r,
requiresAnyEnv: normalizeOptionalTrimmedStringList(e.requiresAnyEnv),
requiresAllEnv: normalizeOptionalTrimmedStringList(e.requiresAllEnv),
credentialMarker: t,
source: normalizeOptionalString(e.source)
});
})
});
}),
cliBackends: normalizeOptionalTrimmedStringList(e.cliBackends),
configMigrations: normalizeOptionalTrimmedStringList(e.configMigrations),
nativeSessionCatalog: t?.label ? t : void 0,
requiresRuntime: typeof e.requiresRuntime === "boolean" ? e.requiresRuntime : void 0
});
}
function normalizeManifestQaRunners(e) {
return normalizeManifestObjectList(e, (e) => {
const t = normalizeOptionalString(e.commandName) ?? "";
if (!t) return;
return omitUndefinedFields({
commandName: t,
description: normalizeOptionalString(e.description)
});
});
}
function normalizeDashboardCapabilityBase(e, t, n) {
if (!isRecord(e)) return `${t}[${n}] must be an object`;
const r = normalizeOptionalString(e.id);
const i = normalizeOptionalString(e.method);
const a = normalizeOptionalString(e.description);
if (!r || !/^[a-z0-9][a-z0-9._-]*$/u.test(r)) return `${t}[${n}].id must be a lowercase capability id`;
if (!i) return `${t}[${n}].method must be a non-empty string`;
if (!a) return `${t}[${n}].description must be a non-empty string`;
return {
id: r,
method: i,
description: a
};
}
function normalizeManifestDashboard(e) {
if (e === void 0) return { ok: true };
if (!isRecord(e)) return {
ok: false,
error: "dashboard must be an object"
};
const t = [];
for (const n of ["dataBindings", "actionVerbs"]) {
const r = e[n];
if (r !== void 0 && !Array.isArray(r)) return {
ok: false,
error: `dashboard.${n} must be an array`
};
t.push({
field: n,
entries: r ?? []
});
}
const n = {};
for (const e of t) {
const { field: t } = e;
const r = [];
for (const [n, i] of e.entries.entries()) {
const e = normalizeDashboardCapabilityBase(i, `dashboard.${t}`, n);
if (typeof e === "string") return {
ok: false,
error: e
};
const a = t === "actionVerbs" && isRecord(i) ? i.paramShape : void 0;
if (a !== void 0 && !isRecord(a)) return {
ok: false,
error: `dashboard.actionVerbs[${n}].paramShape must be a JSON Schema object`
};
r.push({
...e,
...a ? { paramShape: a } : {}
});
}
if (r.length > 0) n[t] = r;
}
return Object.keys(n).length > 0 ? {
ok: true,
dashboard: n
} : { ok: true };
}
function normalizeProviderChannelLogin(e) {
if (!isRecord(e) || Object.keys(e).some((e) => e !== "aliases")) return;
if (e.aliases !== void 0 && (!Array.isArray(e.aliases) || e.aliases.some((e) => typeof e !== "string" || !e.trim()))) return;
const t = normalizeUniqueTrimmedStringList(e.aliases);
return t.length > 0 ? { aliases: t } : {};
}
function normalizeProviderAuthChoices(e) {
return normalizeManifestObjectList(e, (e) => {
const t = normalizeOptionalString(e.provider) ?? "";
const n = normalizeOptionalString(e.method) ?? "";
const r = normalizeOptionalString(e.choiceId) ?? "";
if (!t || !n || !r) return;
const i = normalizeTrimmedStringList(e.onboardingScopes).filter(isPluginManifestOnboardingScope);
return omitUndefinedFields({
provider: t,
method: n,
choiceId: r,
modelTarget: e.modelTarget === "utility" ? "utility" : void 0,
platforms: e.platforms !== void 0 ? normalizeManifestPlatforms(e.platforms) : void 0,
choiceLabel: normalizeOptionalString(e.choiceLabel),
choiceHint: normalizeOptionalString(e.choiceHint),
icon: normalizeSetupPresentationHttpsUrl(e.icon),
website: normalizeSetupPresentationHttpsUrl(e.website),
docsUrl: normalizeSetupPresentationHttpsUrl(e.docsUrl),
assistantPriority: typeof e.assistantPriority === "number" && Number.isFinite(e.assistantPriority) ? e.assistantPriority : void 0,
assistantVisibility: normalizeProviderAssistantVisibility(e.assistantVisibility),
deprecatedChoiceIds: normalizeOptionalTrimmedStringList(e.deprecatedChoiceIds),
groupId: normalizeOptionalString(e.groupId),
groupLabel: normalizeOptionalString(e.groupLabel),
groupHint: normalizeOptionalString(e.groupHint),
onboardingFeatured: e.onboardingFeatured === true ? true : void 0,
appGuidedDiscovery: e.appGuidedDiscovery === true ? true : void 0,
optionKey: normalizeOptionalString(e.optionKey),
cliFlag: normalizeOptionalString(e.cliFlag),
cliOption: normalizeOptionalString(e.cliOption),
cliDescription: normalizeOptionalString(e.cliDescription),
appGuidedSecret: e.appGuidedSecret === true ? true : void 0,
personalAccount: e.personalAccount === true ? true : void 0,
appGuidedActionLabel: normalizeOptionalString(e.appGuidedActionLabel),
appGuidedAuth: e.appGuidedAuth === "oauth" || e.appGuidedAuth === "device-code" ? e.appGuidedAuth : void 0,
credentialOnly: e.credentialOnly === true ? true : void 0,
channelLogin: normalizeProviderChannelLogin(e.channelLogin),
onboardingScopes: i.length > 0 ? i : void 0
});
});
}
function normalizeConfigUiHints(e) {
if (!isRecord(e)) return;
const t = Object.create(null);
for (const [n, r] of Object.entries(e)) {
if (!isRecord(r)) continue;
const e = { ...r };
if ("presentation" in e && e.presentation !== "phone-number") delete e.presentation;
if ("multiline" in e && typeof e.multiline !== "boolean") delete e.multiline;
t[n] = e;
}
return Object.keys(t).length > 0 ? t : void 0;
}
function normalizeChannelConfigs(e) {
return normalizeNamedMetadataRecord(e, (e) => {
const t = isRecord(e.schema) ? e.schema : null;
if (!t) return;
return omitUndefinedFields({
schema: t,
uiHints: normalizeConfigUiHints(e.uiHints),
runtime: isRecord(e.runtime) && typeof e.runtime.safeParse === "function" ? e.runtime : void 0,
label: normalizeOptionalString(e.label),
description: normalizeOptionalString(e.description),
preferOver: normalizeOptionalTrimmedStringList(e.preferOver),
commands: normalizeManifestChannelCommandDefaults(e.commands)
});
});
}
function normalizeManifestChannelCommandDefaults(e) {
if (!isRecord(e)) return;
const t = {};
for (const n of ["nativeCommandsAutoEnabled", "nativeSkillsAutoEnabled"]) if (typeof e[n] === "boolean") t[n] = e[n];
return Object.keys(t).length > 0 ? t : void 0;
}
//#endregion
//#region src/plugins/control-ui-build-manifest.ts
/** Browser builds replace only their declaration; authored capabilities remain authoritative. */
function loadPluginControlUiDeclaration(e) {
const t = "dist/openclaw.plugin.json";
if (!pluginCacheLstatSync(path.join(e.rootDir, t)) || !pluginCacheLstatSync(path.join(e.rootDir, "package.json"))) return normalizeManifestControlUi(e.controlUi, e.channels);
const n = readPluginCacheFile({
...e,
relativePath: "package.json"
});
if (!n.ok) return err("generated Control UI package metadata could not be safely read");
const r = parsePluginCacheJson(n);
if (!r.ok || !isRecord(r.value)) return err("generated Control UI package metadata must be an object");
try {
if (!controlUiSource(r.value)) return normalizeManifestControlUi(e.controlUi, e.channels);
} catch (e) {
return err(String(e));
}
const i = readPluginCacheFile({
rootDir: e.rootDir,
relativePath: t,
rejectHardlinks: e.rejectHardlinks,
rootRealPath: e.rootRealPath,
maxBytes: 262144
});
if (!i.ok) return err("generated Control UI manifest could not be safely read");
const a = parsePluginCacheJson(i);
if (!a.ok || !isRecord(a.value) || a.value.controlUi === void 0) return err("generated Control UI manifest must contain controlUi");
return normalizeManifestControlUi(a.value.controlUi, e.channels);
}
//#endregion
//#region src/plugins/doctor-session-route-state-owner-types.ts
function coerceDoctorSessionRouteStateOwners(e) {
if (!Array.isArray(e)) return [];
return e.flatMap((e) => {
const t = asOptionalObjectRecord(e);
if (typeof t?.id !== "string" || typeof t.label !== "string") return [];
const n = t.id.trim();
const r = t.label.trim();
if (!n || !r) return [];
const i = {
id: n,
label: r,
providerIds: normalizeTrimmedStringList(t.providerIds),
runtimeIds: normalizeTrimmedStringList(t.runtimeIds),
cliSessionKeys: normalizeTrimmedStringList(t.cliSessionKeys),
authProfilePrefixes: normalizeTrimmedStringList(t.authProfilePrefixes)
};
return [
"providerIds",
"runtimeIds",
"cliSessionKeys",
"authProfilePrefixes"
].every((e) => t[e] === void 0 || i[e].length > 0) ? [i] : [];
});
}
//#endregion
//#region src/plugins/manifest-config-groups.ts
/** Invalid presentation metadata leaves the plugin's complete flat settings form available. */
function normalizeConfigGroups(e, t) {
if (!Array.isArray(e) || e.length === 0 || !isRecord(t.properties)) return;
const n = /* @__PURE__ */ new Set();
const r = /* @__PURE__ */ new Set();
const i = [];
for (const a of e) {
if (!isRecord(a)) return;
const e = typeof a.id === "string" ? a.id.trim() : "";
const o = typeof a.title === "string" ? a.title.trim() : "";
if (!e || !o || n.has(e) || a.order !== void 0 && !Number.isInteger(a.order) || !Array.isArray(a.properties) || a.properties.length === 0) return;
const s = [];
for (const e of a.properties) {
if (typeof e !== "string" || !e || !Object.hasOwn(t.properties, e) || r.has(e)) return;
r.add(e);
s.push(e);
}
n.add(e);
i.push({
id: e,
title: o,
...typeof a.order === "number" ? { order: a.order } : {},
properties: s
});
}
return i;
}
//#endregion
//#region src/plugins/manifest-model-provider-normalizers.ts
const MAX_SECRET_PROVIDER_EXEC_ARGS = 128;
const MAX_SECRET_PROVIDER_EXEC_ARG_BYTES = 1024;
const MAX_SECRET_PROVIDER_EXEC_TIMEOUT_MS = 12e4;
const MAX_SECRET_PROVIDER_EXEC_OUTPUT_BYTES = 20971520;
const MAX_SECRET_PROVIDER_EXEC_PASS_ENV = 128;
const SECRET_PROVIDER_NODE_COMMAND_PLACEHOLDER = "${node}";
function normalizeManifestModelSupport(e) {
if (!isRecord(e)) return;
return optionalManifestFields({
modelPrefixes: normalizeOptionalTrimmedStringList(e.modelPrefixes),
modelPatterns: normalizeOptionalTrimmedStringList(e.modelPatterns)
});
}
function normalizeOwnedProviderMap(e, t, n) {
if (!isRecord(e) || !isRecord(e.providers)) return;
const r = new Set([...t].map((e) => normalizeProviderId(e)).filter(Boolean));
const i = {};
for (const [t, a] of Object.entries(e.providers)) {
const e = normalizeProviderId(t);
const o = e && r.has(e) ? n(a) : null;
if (e && o) i[e] = o;
}
return Object.keys(i).length > 0 ? i : void 0;
}
function normalizeManifestModelPricing(e, t) {
const n = normalizeOwnedProviderMap(e, t.ownedProviders, normalizeModelPricingProvider);
return n ? { providers: n } : void 0;
}
function normalizeManifestModelIdPrefixRules(e) {
return normalizeManifestObjectList(e, (e) => {
const t = normalizeOptionalString(e.modelPrefix);
const n = normalizeOptionalString(e.prefix);
return t && n ? {
modelPrefix: t,
prefix: n
} : void 0;
});
}
function normalizeManifestModelIdNormalizationProvider(e) {
if (!isRecord(e)) return;
const t = {};
if (isRecord(e.aliases)) for (const [n, r] of Object.entries(e.aliases)) {
const e = normalizeProviderId(n);
const i = normalizeOptionalString(r);
if (e && i) t[e] = i;
}
return optionalManifestFields({
aliases: Object.keys(t).length > 0 ? t : void 0,
stripPrefixes: normalizeOptionalTrimmedStringList(e.stripPrefixes),
prefixWhenBare: normalizeOptionalString(e.prefixWhenBare),
prefixWhenBareAfterAliasStartsWith: normalizeManifestModelIdPrefixRules(e.prefixWhenBareAfterAliasStartsWith)
});
}
function normalizeManifestModelIdNormalization(e, t) {
const n = normalizeOwnedProviderMap(e, t.ownedProviders, normalizeManifestModelIdNormalizationProvider);
return n ? { providers: n } : void 0;
}
function normalizeManifestProviderRequest(e, t) {
const n = normalizeOwnedProviderMap(e, t.ownedProviders, normalizeManifestProviderRequestProvider);
return n ? { providers: n } : void 0;
}
function normalizeManifestPositiveInteger(e, t) {
return asSafeIntegerInRange(e, {
min: 1,
max: t
});
}
function normalizeManifestSecretProviderIntegrations(e) {
return normalizeNamedMetadataRecord(e, (e) => {
const t = normalizeOptionalString(e.command);
if (e.source !== "exec" || t !== SECRET_PROVIDER_NODE_COMMAND_PLACEHOLDER) return;
const n = [];
if (Array.isArray(e.args)) for (const t of e.args) {
if (typeof t !== "string" || t.length > MAX_SECRET_PROVIDER_EXEC_ARG_BYTES) continue;
n.push(t);
if (n.length >= MAX_SECRET_PROVIDER_EXEC_ARGS) break;
}
const r = normalizeTrimmedStringList(e.passEnv).filter((e) => ENV_SECRET_REF_ID_RE.test(e)).slice(0, MAX_SECRET_PROVIDER_EXEC_PASS_ENV);
return omitUndefinedFields({
providerAlias: normalizeOptionalString(e.providerAlias),
displayName: normalizeOptionalString(e.displayName),
description: normalizeOptionalString(e.description),
source: "exec",
command: t,
args: n.length > 0 ? n : void 0,
timeoutMs: normalizeManifestPositiveInteger(e.timeoutMs, MAX_SECRET_PROVIDER_EXEC_TIMEOUT_MS),
noOutputTimeoutMs: normalizeManifestPositiveInteger(e.noOutputTimeoutMs, MAX_SECRET_PROVIDER_EXEC_TIMEOUT_MS),
maxOutputBytes: normalizeManifestPositiveInteger(e.maxOutputBytes, MAX_SECRET_PROVIDER_EXEC_OUTPUT_BYTES),
jsonOnly: typeof e.jsonOnly === "boolean" ? e.jsonOnly : void 0,
env: normalizeManifestStringRecord(e.env),
passEnv: r.length > 0 ? r : void 0
});
});
}
//#endregion
//#region src/plugins/manifest-themes.ts
const MAX_PLUGIN_THEMES = 32;
const MAX_THEME_ARTWORK_ENTRIES = 8;
function objectProperties(e) {
return e.type === "ObjectExpression" ? e.properties.filter((e) => e.type === "Property") : [];
}
function propertyName(e) {
return e.key.type === "Identifier" ? e.key.name : e.key.type === "Literal" ? String(e.key.value) : "";
}
function validateArtworkDuplicates(e) {
const { parseExpressionAt: t } = createRequire(import.meta.url)("acorn");
const n = t(`(${e}\n)`, 0, { ecmaVersion: "latest" });
for (const e of objectProperties(n)) {
if (propertyName(e) !== "themes" || e.value.type !== "ArrayExpression") continue;
for (const t of e.value.elements) {
if (!t || t.type !== "ObjectExpression") continue;
for (const e of objectProperties(t)) {
const t = propertyName(e);
if (t !== "icons" && t !== "hats" && t !== "critters" && t !== "backgrounds") continue;
const n = /* @__PURE__ */ new Set();
for (const r of objectProperties(e.value)) {
const e = propertyName(r);
if (n.has(e)) throw new Error(`themes.${t} has duplicate artwork ID ${e}`);
n.add(e);
}
}
}
}
}
function normalizeArtworkEntries(e, t, n, r) {
if (e === void 0) return;
if (!isRecord(e)) throw new Error(`${t} must be a map with at most ${MAX_THEME_ARTWORK_ENTRIES} entries`);
const i = Object.entries(e);
if (i.length > MAX_THEME_ARTWORK_ENTRIES) throw new Error(`${t} must be a map with at most ${MAX_THEME_ARTWORK_ENTRIES} entries`);
for (const [e] of i) if (!THEME_ARTWORK_ID_PATTERN.test(e) || n.includes(e)) throw new Error(`${t}.${e} must use a safe local ID outside the built-in catalog`);
return Object.fromEntries(i.map(([e, n]) => [e, r(n, `${t}.${e}`)]));
}
function normalizeArtworkPath(e, t) {
const n = typeof e === "string" ? e.replace(/^\.\//, "") : "";
if (!/^(?:[a-z0-9_-][a-z0-9._-]*\/)*[a-z0-9_-][a-z0-9._-]*\.svg$/i.test(n)) throw new Error(`${t} must be an SVG file inside the plugin root`);
return n;
}
function normalizeBackgrounds(e, t) {
if (e === void 0) return;
const n = isRecord(e) ? Object.entries(e) : [];
if (!n.length || n.some(([e]) => e !== "light" && e !== "dark")) throw new Error(`${t} must map light and/or dark to an image`);
return Object.fromEntries(n.map(([e, n]) => {
const r = typeof n === "string" ? n.replace(/^\.\//, "") : "";
if (!/^(?:[a-z0-9_-][a-z0-9._-]*\/)*[a-z0-9_-][a-z0-9._-]*\.(?:png|jpe?g|webp)$/i.test(r)) throw new Error(`${t}.${e} must be a PNG, JPEG, or WebP file inside the plugin root`);
return [e, r];
}));
}
function normalizeCritter(e, t) {
if (!isRecord(e)) throw new Error(`${t} must be an object with an SVG source`);
const { source: n, title: r, crossMs: i } = e;
if (Object.keys(e).some((e) => ![
"source",
"title",
"crossMs"
].includes(e))) throw new Error(`${t} has unsupported fields`);
if (r !== void 0 && (typeof r !== "string" || r.length > 60 || /[\p{Cc}\p{Cf}\p{Cs}]/u.test(r))) throw new Error(`${t}.title must be at most 60 printable characters`);
if (i !== void 0 && (typeof i !== "number" || !Number.isInteger(i) || i < 5e3 || i > 9e4)) throw new Error(`${t}.crossMs must be an integer from 5000 to 90000`);
return omitUndefinedFields({
source: normalizeArtworkPath(n, `${t}.source`),
title: r,
crossMs: i
});
}
function normalizeManifestThemes(e, t, n) {
if (e === void 0) return { ok: true };
if (!Array.isArray(e) || e.length > MAX_PLUGIN_THEMES) return {
ok: false,
error: `themes must be an array with at most ${MAX_PLUGIN_THEMES} entries`
};
if (e.length && (t === "user" || !isThemeId(`${t}/x`))) return {
ok: false,
error: "themes require a portable plugin ID outside the reserved user namespace"
};
const r = [];
const i = /* @__PURE__ */ new Set();
for (const [t, n] of e.entries()) {
if (!isRecord(n)) return {
ok: false,
error: `themes[${t}] must be an object`
};
const { id: e, name: a, description: o, source: s, icons: c, hats: l, critters: u, backgrounds: d } = n;
if (Object.keys(n).some((e) => ![
"id",
"name",
"description",
"source",
"icons",
"hats",
"critters",
"backgrounds"
].includes(e)) || typeof e !== "string" || !THEME_LOCAL_ID_PATTERN.test(e) || i.has(e) || typeof a !== "string" || !a.trim() || a.trim().length > 80 || typeof o !== "string" || !o.trim() || o.trim().length > 320 || containsAsciiControlCharacter(a + o) || typeof s !== "string") return {
ok: false,
error: `themes[${t}] requires a unique safe id, name, description, and JSON source`
};
const f = s.replace(/^\.\//, "");
if (!/^(?:[a-z0-9_-][a-z0-9._-]*\/)*[a-z0-9_-][a-z0-9._-]*\.json$/i.test(f)) return {
ok: false,
error: `themes[${t}].source must be a JSON file inside the plugin root`
};
try {
r.push({
id: e,
name: a.trim(),
description: o.trim(),
source: f,
...omitUndefinedFields({
icons: normalizeArtworkEntries(c, `themes[${t}].icons`, THEME_BRAND_ICON_IDS, normalizeArtworkPath),
hats: normalizeArtworkEntries(l, `themes[${t}].hats`, THEME_AVATAR_HAT_IDS, normalizeArtworkPath),
critters: normalizeArtworkEntries(u, `themes[${t}].critters`, THEME_CRITTER_IDS, normalizeCritter),
backgrounds: normalizeBackgrounds(d, `themes[${t}].backgrounds`)
})
});
} catch (e) {
return {
ok: false,
error: e instanceof Error ? e.message : "invalid theme artwork"
};
}
i.add(e);
}
if (n && r.some((e) => e.icons || e.hats || e.critters || e.backgrounds)) try {
validateArtworkDuplicates(n);
} catch (e) {
return {
ok: false,
error: e instanceof Error ? e.message : "invalid theme artwork"
};
}
return {
ok: true,
themes: r
};
}
//#endregion
//#region src/plugins/manifest.ts
/** Loads and normalizes OpenClaw plugin manifests, including contracts and config schemas. */
/** Canonical plugin manifest filename inside plugin roots. */
const PLUGIN_MANIFEST_FILENAME = "openclaw.plugin.json";
const MAX_PLUGIN_MANIFEST_BYTES = 262144;
const CORE_RESERVED_PLUGIN_IDS = /* @__PURE__ */ new Set(["node-mcp"]);
const VALID_PLUGIN_KINDS = /* @__PURE__ */ new Set(["memory", "context-engine"]);
function isCoreReservedPluginId(e) {
return CORE_RESERVED_PLUGIN_IDS.has(normalizePluginPolicyId(e));
}
function parsePluginKind(e) {
const t = typeof e === "string" ? [e] : Array.isArray(e) ? e : [];
const n = [];
for (const e of t) {
if (typeof e !== "string" || !VALID_PLUGIN_KINDS.has(e)) continue;
const t = e;
if (!n.includes(t)) n.push(t);
}
return n.length === 0 ? void 0 : n.length === 1 ? n[0] : n;
}
function parseDoctorStateMigrationDescriptors(e) {
if (typeof e === "boolean") return e;
if (!Array.isArray(e)) return;
const t = /* @__PURE__ */ new Set();
return e.flatMap((e) => {
if (!isRecord(e)) return [];
const n = normalizeOptionalString(e.id);
if (!n || t.has(n)) return [];
t.add(n);
return [{
id: n,
...e.doctorOnly === true ? { doctorOnly: true } : {},
...e.phase === "after-session-repair" ? { phase: "after-session-repair" } : {}
}];
});
}
function parseManifestBackupResources(e) {
if (e === void 0) return { ok: true };
if (!Array.isArray(e)) return {
ok: false,
error: "backupResources must be an array"
};
const t = /* @__PURE__ */ new Map();
for (const [n, r] of e.entries()) {
if (!isRecord(r) || Object.keys(r).some((e) => ![
"disposition",
"scope",
"relativePath",
"databaseFamily"
].includes(e)) || !("disposition" in r) || !("scope" in r) || !("relativePath" in r)) return {
ok: false,
error: `backupResources[${n}] requires disposition, scope, relativePath, and optional databaseFamily`
};
const { disposition: e, scope: i, relativePath: a, databaseFamily: o } = r;
if (e !== "include" && e !== "regenerable") return {
ok: false,
error: `backupResources[${n}].disposition is invalid`
};
if (i !== "state" && i !== "agent") return {
ok: false,
error: `backupResources[${n}].scope is invalid`
};
if (o !== void 0 && (e !== "include" || i !== "state" || o !== "state")) return {
ok: false,
error: `backupResources[${n}].databaseFamily is invalid`
};
if (typeof a !== "string" || !a || a.includes("\\") || a.includes("\0") || path.posix.isAbsolute(a) || path.win32.isAbsolute(a) || /^[A-Za-z][A-Za-z\d+.-]*:/.test(a) || a.split("/").some((e) => !e || e === "." || e === "..")) return {
ok: false,
error: `backupResources[${n}].relativePath must be a strict relative POSIX path`
};
const s = {
disposition: e,
scope: i,
relativePath: a,
...o !== void 0 ? { databaseFamily: o } : {}
};
t.set(`${i}\0${a}\0${e}\0${o ?? ""}`, s);
}
return {
ok: true,
resources: [...t.entries()].toSorted(([e], [t]) => e < t ? -1 : e > t ? 1 : 0).map(([, e]) => e)
};
}
function loadPluginManifest(e, t = true, n) {
const r = readPluginCacheFile({
rootDir: e,
relativePath: PLUGIN_MANIFEST_FILENAME,
...n !== void 0 ? { rootRealPath: n } : {},
maxBytes: MAX_PLUGIN_MANIFEST_BYTES,
rejectHardlinks: t
});
const i = r.ok ? r.path : path.join(e, PLUGIN_MANIFEST_FILENAME);
if (!r.ok) return matchRootFileOpenFailure(r.failure, {
path: () => ({
ok: false,
error: `plugin manifest not found: ${i}`,
manifestPath: i
}),
fallback: (e) => ({
ok: false,
error: `unsafe plugin manifest path: ${i} (${e.reason})`,
manifestPath: i
})
});
if (r.manifest) return r.manifest;
const cacheResult = (e) => {
return r.manifest = e;
};
const fail = (e) => cacheResult({
ok: false,
error: e,
manifestPath: i
});
const a = parsePluginCacheJson(r, { json5: true });
if (!a.ok) return fail(`failed to parse plugin manifest: ${String(a.error)}`);
const o = a.value;
if (!isRecord(o)) return fail("plugin manifest must be an object");
const s = normalizeOptionalString(o.id) ?? "";
if (!s) return fail("plugin manifest requires id");
if (isCoreReservedPluginId(s)) return fail(`plugin manifest id "${s}" is reserved by OpenClaw core`);
const c = isRecord(o.configSchema) ? o.configSchema : null;
if (!c) return fail("plugin manifest requires configSchema");
const l = parseManifestBackupResources(o.backupResources);
if (!l.ok) return cacheResult({
ok: false,
error: `invalid plugin manifest backupResources: ${l.error}`,
manifestPath: i,
diagnosticCode: "backup-resource-declaration-invalid"
});
const u = validatePluginCategories(o.categories);
if (!u.ok) return fail(`invalid plugin manifest categories: ${u.error}`);
const d = parsePluginKind(o.kind);
let f;
if (o.contextEngineIds !== void 0) {
if (!(Array.isArray(d) ? d : [d]).includes("context-engine") || !Array.isArray(o.contextEngineIds) || o.contextEngineIds.length === 0 || o.contextEngineIds.some((e) => typeof e !== "string" || !e.trim() || ["legacy", "none"].includes(e.trim().toLowerCase()))) return cacheResult({
ok: false,
error: "contextEngineIds requires context-engine kind and a nonempty array of nonreserved engine IDs",
manifestPath: i
});
f = [...new Set(normalizeTrimmedStringList(o.contextEngineIds))];
}
const p = normalizeTrimmedStringList(o.requiresPlugins);
const m = normalizeManifestPlatforms(o.enabledByDefaultOnPlatforms);
const h = normalizeTrimmedStringList(o.legacyPluginIds);
const g = normalizeTrimmedStringList(o.autoEnableWhenConfiguredProviders);
const _ = normalizeTrimmedStringList(o.providers);
const v = normalizeTrimmedStringList(o.channels);
const y = normalizeManifestContracts(o.contracts);
const b = normalizeTrimmedStringList(o.cliBackends);
const x = isRecord(o.doctorContract) ? o.doctorContract : void 0;
const S = normalizeManifestCliCommands(o.cliCommands);
let C;
if (x?.recoveryCli !== void 0) {
if (!Array.isArray(x.recoveryCli)) return fail("doctorContract.recoveryCli must be an array of command paths");
C = [];
const e = /* @__PURE__ */ new Set();
for (const t of x.recoveryCli) {
if (!Array.isArray(t) || t.length === 0 || !t.every((e) => typeof e === "string" && normalizeCommandDescriptorName(e) === e) || !S?.some(({ name: e }) => e === t[0])) return fail("doctorContract.recoveryCli paths must use plain command names beneath a declared cliCommands root");
const n = t.join(" ");
if (!e.has(n)) {
e.add(n);
C.push(t);
}
}
}
const w = parseDoctorStateMigrationDescriptors(x?.stateMigrations);
const T = x ? {
...Object.fromEntries([
"configRepair",
"resolveSessionStoreAgentIds",
"sessionRouteStateOwners"
].flatMap((e) => typeof x[e] === "boolean" ? [[e, x[e]]] : [])),
...w !== void 0 ? { stateMigrations: w } : {},
...C !== void 0 ? { recoveryCli: C } : {}
} : void 0;
/** The documented V1 manifest is an input adapter, not a second catalog. */
const normalizeManifestModelCatalog = () => {
const e = /* @__PURE__ */ new Set([
..._,
...b,
...y?.decisionProviders ?? []
]);
const t = normalizeModelCatalog(o.modelCatalog, { ownedProviders: e });
const n = normalizeManifestDecisionModels(o.decisionModels, y?.decisionProviders);
if (!n?.length) return t;
const r = /* @__PURE__ */ new Map();
if (isRecord(o.modelCatalog) && isRecord(o.modelCatalog.providers)) for (const [e, t] of Object.entries(o.modelCatalog.providers)) {
if (!isRecord(t) || !Array.isArray(t.models)) continue;
const n = normalizeProviderId(e);
const i = r.get(n) ?? /* @__PURE__ */ new Set();
for (const e of t.models) {
const t = isRecord(e) ? normalizeOptionalString(e.id) : void 0;
if (t) i.add(t);
}
r.set(n, i);
}
const i = { ...t?.providers };
for (const e of n) {
const t = normalizeProviderId(e.provider);
if (!t || isBlockedObjectKey(t)) continue;
const n = i[t];
if (r.get(t)?.has(e.id)) continue;
const a = e.capabilities;
const o = {};
for (const e of a?.questionTypes ?? []) o[e] = {
probabilities: e === "boolean" ? "boolean" : "provider-defined",
abstention: false,
...e === "boolean" && a?.requiresBooleanCriteria !== void 0 ? { requiresCriteria: a.requiresBooleanCriteria } : {},
...e === "choice" && a?.maxChoiceAlternatives !== void 0 ? { maxOptions: a.maxChoiceAlternatives } : {},
...e === "score" && a?.maxScoreLevels !== void 0 ? { maxOptions: a.maxScoreLevels } : {}
};
const s = {
id: e.id,
name: e.name,
inference: {
chat: false,
decision: {
protocol: "decision-v1",
input: ["text"],
...a ? {
questions: o,
...a.confidence ? { confidence: a.confidence } : {},
limits: {
...a.maxQuestions !== void 0 ? { maxQuestions: a.maxQuestions } : {},
...a.maxInputTokens !== void 0 ? { maxInputTokens: a.maxInputTokens } : {},
...a.inputTokenScope ? { inputTokenScope: a.inputTokenScope } : {}
}
} : {}
}
}
};
i[t] = {
...n,
models: [...n?.models ?? [], s]
};
}
return normalizeModelCatalog({
...t,
providers: i
}, { ownedProviders: e });
};
let E;
try {
E = normalizeManifestModelCatalog();
} catch {
return cacheResult({
ok: false,
error: "invalid plugin manifest modelCatalog ownership metadata",
manifestPath: i
});
}
const D = {
id: s,
configSchema: c,
..."categories" in u ? { categories: u.categories } : {},
...l.resources !== void 0 ? { backupResources: l.resources } : {},
...p.length > 0 ? { requiresPlugins: p } : {},
...o.enabledByDefault === true ? { enabledByDefault: true } : {},
...m.length > 0 ? { enabledByDefaultOnPlatforms: m } : {},
...h.length > 0 ? { legacyPluginIds: h } : {},
...g.length > 0 ? { autoEnableWhenConfiguredProviders: g } : {},
kind: d,
...f ? { contextEngineIds: f } : {},
...isRecord(o.reload) && o.reload.turnHandover === true ? { reload: { turnHandover: true } } : {},
channels: v,
channelAccountKeyPolicies: normalizeChannelAccountKeyPolicies(o.channelAccountKeyPolicies, v),
providers: _,
...o.managesOwnAvailability === true ? { managesOwnAvailability: true } : {},
providerCatalogEntry: normalizeOptionalString(o.providerCatalogEntry),
capabilityCatalogEntry: o.capabilityCatalogEntry === void 0 ? void 0 : normalizeOptionalString(o.capabilityCatalogEntry) ?? "",
modelSupport: normalizeManifestModelSupport(o.modelSupport),
modelCatalog: E,
modelPricing: normalizeManifestModelPricing(o.modelPricing, { ownedProviders: /* @__PURE__ */ new Set([..._, ...b]) }),
modelIdNormalization: normalizeManifestModelIdNormalization(o.modelIdNormalization, { ownedProviders: new Set(_) }),
providerEndpoints: normalizeManifestProviderEndpoints(o.providerEndpoints),
providerRequest: normalizeManifestProviderRequest(o.providerRequest, { ownedProviders: new Set(_) }),
secretProviderIntegrations: normalizeManifestSecretProviderIntegrations(o.secretProviderIntegrations),
cliBackends: b,
syntheticAuthRefs: normalizeTrimmedStringList(o.syntheticAuthRefs),
nonSecretAuthMarkers: normalizeTrimmedStringList(o.nonSecretAuthMarkers),
commandAliases: normalizeManifestCommandAliases(o.commandAliases),
cliCommands: S,
providerUsageAuthEnvVars: normalizeStringListRecord(o.providerUsageAuthEnvVars),
providerAuthAliases: normalizeManifestProviderAuthAliases(o.providerAuthAliases),
providerAuthChoices: normalizeProviderAuthChoices(o.providerAuthChoices),
activation: normalizeManifestActivation(o.activation),
setup: normalizeManifestSetup(o.setup),
doctorContract: T,
doctorHealthChecks: o.doctorHealthChecks === true ? true : void 0,
sessionRouteStateOwners: o.sessionRouteStateOwners === void 0 ? void 0 : coerceDoctorSessionRouteStateOwners(o.sessionRouteStateOwners),
qaRunners: normalizeManifestQaRunners(o.qaRunners)
};
const O = normalizeManifestDashboard(o.dashboard);
if (!O.ok) return fail(`invalid plugin manifest dashboard: ${O.error}`);
const k = validatePluginUiCapabilities(o.uiCapabilities);
const A = loadPluginControlUiDeclaration({
rootDir: e,
controlUi: o.controlUi,
channels: v,
rejectHardlinks: t,
rootRealPath: n
});
if (!A.ok) return fail(`invalid plugin manifest controlUi: ${A.error}`);
const j = normalizeManifestThemes(o.themes, s, r.contents.toString("utf8"));
if (!j.ok) return fail(`invalid plugin manifest themes: ${j.error}`);
return cacheResult({
ok: true,
...!k.ok ? { warnings: [`ignoring invalid plugin manifest uiCapabilities: ${k.error}`] } : {},
manifest: {
...D,
dashboard: O.dashboard,
controlUi: A.value,
...k.ok && k.capabilities !== void 0 ? { uiCapabilities: k.capabilities } : {},
themes: j.themes,
mcpServers: normalizeManifestMcpServers(o.mcpServers),
skills: normalizeTrimmedStringList(o.skills),
name: normalizeOptionalString(o.name),
description: normalizeOptionalString(o.description),
catalog: normalizeManifestCatalog(o.catalog),
version: normalizeOptionalString(o.version),
uiHints: normalizeConfigUiHints(o.uiHints),
configGroups: normalizeConfigGroups(o.configGroups, c),
contracts: y,
decisionModels: normalizeManifestDecisionModels(o.decisionModels, y?.decisionProviders),
transcriptSources: normalizeManifestTranscriptSources(o.transcriptSources, y?.transcriptSourceProviders),
mediaUnderstandingProviderMetadata: normalizeMediaUnderstandingProviderMetadata(o.mediaUnderstandingProviderMetadata),
imageGenerationProviderMetadata: normalizeCapabilityProviderMetadata(o.imageGenerationProviderMetadata),
videoGenerationProviderMetadata: normalizeCapabilityProviderMetadata(o.videoGenerationProviderMetadata),
musicGenerationProviderMetadata: normalizeCapabilityProviderMetadata(o.musicGenerationProviderMetadata),
toolMetadata: normalizePluginToolMetadata(o.toolMetadata),
configContracts: normalizeManifestConfigContracts(o.configContracts),
channelConfigs: normalizeChannelConfigs(o.channelConfigs)
},
manifestPath: i
});
}
//#endregion
export { loadPluginControlUiDeclaration as a, normalizeSetupPresentationHttpsUrl as c, normalizeCommandDescriptorName as d, sanitizeCommandDescriptorDescription as f, coerceDoctorSessionRouteStateOwners as i, addCommandDescriptorsToProgram as l, normalizeManifestControlUi as m, isCoreReservedPluginId as n, normalizeManifestActivation as o, controlUiSource as p, loadPluginManifest as r, normalizeManifestChannelCommandDefaults as s, PLUGIN_MANIFEST_FILENAME as t, collectUniqueCommandDescriptors as u };