Files
openclaw/scripts/lib/plugin-sdk-declaration-budget.mjs
2026-07-12 16:22:29 +08:00

22 lines
991 B
JavaScript

// Raised for the plugins.uninstall/catalog actions and sessions.search protocol surfaces;
// the cap exists to force a conscious decision on published declaration growth.
export const MAX_PUBLIC_PLUGIN_SDK_DECLARATION_BYTES = 5_100_000;
// Private-only entrypoints reshape chunks reachable from public roots but are never published.
// Bound that topology overhead without counting local-only declarations as package surface.
export const MAX_PRIVATE_QA_PUBLIC_PLUGIN_SDK_DECLARATION_BYTES = 5_125_000;
export function isPrivateQaPluginSdkBuild(env) {
return env.OPENCLAW_BUILD_PRIVATE_QA === "1";
}
export function evaluatePluginSdkDeclarationBudget({ declarationBytes, buildPrivateQa }) {
const budgetBytes = buildPrivateQa
? MAX_PRIVATE_QA_PUBLIC_PLUGIN_SDK_DECLARATION_BYTES
: MAX_PUBLIC_PLUGIN_SDK_DECLARATION_BYTES;
return {
budgetBytes,
budgetKind: buildPrivateQa ? "private-qa-public-entry" : "public",
shouldFail: declarationBytes > budgetBytes,
};
}