Files
openclaw/scripts/lib/plugin-sdk-entries.mts
T
Peter Steinberger dceb2c343c refactor: retire due compat-ledger surfaces (context-engine host params, deactivate alias, logging internals) (#121845)
* refactor(plugins): retire deactivate hook alias

* refactor(plugin-sdk): prune retired facade exports

* test(logging): isolate logger test controls

* refactor(logging): internalize file transport controls

* test(plugin-sdk): preserve retired facade coverage

* test(auto-reply): remove stale diagnostic imports

* refactor(logging): delete dead config-read guard

shouldSkipMutatingLoggingConfigRead had no production caller even on main;
it survived the dead-export scan only via logger's testApi re-export. The
test-isolation commit removed that mask, exposing the fossil. Delete the
guard, its test-only re-export, its mock entry, and its dedicated test file.

* refactor(plugin-sdk): retire due compatibility subpaths

* test(plugin-sdk): type group policy predicates

* refactor(plugin-sdk): split removed subpath records

* refactor(secrets): remove retired collector barrel

* test(plugin-sdk): tighten wildcard surface pin

* refactor(plugin-sdk): retire matrix facade metadata

* style(plugin-sdk): format facade metadata

* fix(ci): load channel setup contracts from source

Repair the main-owned regression from 99d662473c (Peter Steinberger): the new env-contract test could consume stale ignored dist metadata instead of the checked-in plugin declaration.

* test(plugin-sdk): refresh API baseline after rebase
2026-08-12 12:41:27 -07:00

192 lines
6.8 KiB
TypeScript

// Derives plugin SDK entrypoint sets, package exports, and dist artifact paths.
import deprecatedBarrelPluginSdkSubpathList from "./plugin-sdk-deprecated-barrel-subpaths.json" with { type: "json" };
import deprecatedPublicPluginSdkSubpathList from "./plugin-sdk-deprecated-public-subpaths.json" with { type: "json" };
import pluginSdkEntryList from "./plugin-sdk-entrypoints.json" with { type: "json" };
import privateLocalOnlyPluginSdkSubpathList from "./plugin-sdk-private-local-only-subpaths.json" with { type: "json" };
/**
* All plugin SDK subpath entrypoints. The package root barrel has been removed.
* @internal Shared repository-script contract.
*/
export const pluginSdkEntrypoints = [...pluginSdkEntryList];
/**
* Plugin SDK subpath entrypoints.
* @internal Shared test-configuration contract.
*/
export const pluginSdkSubpaths = pluginSdkEntrypoints;
const privateLocalOnlyPluginSdkSubpathSet = new Set(
privateLocalOnlyPluginSdkSubpathList.filter(
(entry) => typeof entry === "string" && !entry.includes("/"),
),
);
/**
* Private plugin SDK entrypoints excluded from the typed, documented public API.
* @internal Shared repository-script contract.
*/
export const privateLocalOnlyPluginSdkEntrypoints = pluginSdkSubpaths.filter((entry) =>
privateLocalOnlyPluginSdkSubpathSet.has(entry),
);
/** Typed public plugin SDK entrypoints. */
export const publicPluginSdkEntrypoints = pluginSdkEntrypoints.filter(
(entry) => !privateLocalOnlyPluginSdkSubpathSet.has(entry),
);
/**
* Public plugin SDK subpaths.
* @internal Shared repository-script contract.
*/
export const publicPluginSdkSubpaths = publicPluginSdkEntrypoints;
// These local-only entries were already omitted from ordinary packaged builds
// before bundled runtime facades moved behind the same private-local boundary.
const nonProductionPluginSdkSubpathSet = new Set([
"agent-runtime-test-contracts",
"channel-contract-testing",
"channel-target-testing",
"channel-test-helpers",
"plugin-test-api",
"plugin-test-contracts",
"plugin-state-test-runtime",
"plugin-test-runtime",
"provider-http-test-mocks",
"provider-test-contracts",
"qa-channel",
"qa-channel-protocol",
"qa-lab",
"qa-runtime",
"reply-payload-testing",
"sqlite-runtime-testing",
"ssrf-runtime-internal",
"test-env",
"test-fixtures",
"test-live",
"test-live-auth",
"test-media-generation",
"test-media-understanding",
"test-node-mocks",
"test-state",
]);
/** Plugin SDK entrypoints built in ordinary source and packaged runtime builds. */
export const productionPluginSdkEntrypoints = pluginSdkEntrypoints.filter(
(entry) => !nonProductionPluginSdkSubpathSet.has(entry),
);
/** List flat plugin SDK declaration outputs for the selected entrypoints. */
export function listPluginSdkDeclarationOutputs(entries = productionPluginSdkEntrypoints) {
return entries.map((entry) => `dist/plugin-sdk/${entry}.d.ts`);
}
const productionPluginSdkEntrypointSet = new Set(productionPluginSdkEntrypoints);
/** Private runtime facades required by bundled or separately published official plugins. */
export const packagedPrivatePluginSdkRuntimeEntrypoints =
privateLocalOnlyPluginSdkEntrypoints.filter((entry) =>
productionPluginSdkEntrypointSet.has(entry),
);
/** Private entrypoints reserved for local tests and QA builds. */
const nonProductionPrivatePluginSdkEntrypoints = privateLocalOnlyPluginSdkEntrypoints.filter(
(entry) => !productionPluginSdkEntrypointSet.has(entry),
);
/**
* Deprecated public plugin SDK subpaths kept for compatibility.
* @internal Shared repository-script contract.
*/
export const deprecatedPublicPluginSdkEntrypoints = publicPluginSdkSubpaths.filter((entry) =>
deprecatedPublicPluginSdkSubpathList.includes(entry),
);
/**
* Deprecated barrel entrypoints that should not be expanded further.
* @internal Shared repository-script contract.
*/
export const deprecatedBarrelPluginSdkEntrypoints = pluginSdkSubpaths.filter((entry) =>
deprecatedBarrelPluginSdkSubpathList.includes(entry),
);
/** Supported SDK facades backed by bundled plugins until generic contracts replace them. */
export const supportedBundledFacadeSdkEntrypoints = ["discord", "telegram-account"] as const;
/** Plugin-owned surfaces intentionally public and documented for third-party plugins. */
export const publicPluginOwnedSdkEntrypoints = ["memory-core-host-engine-foundation"] as const;
/**
* Build tsdown entry source paths for plugin SDK entrypoints.
* @internal Shared repository-script contract.
*/
export function buildPluginSdkEntrySources(entries: readonly string[] = pluginSdkEntrypoints) {
return Object.fromEntries(entries.map((entry) => [entry, `src/plugin-sdk/${entry}.ts`]));
}
/**
* Build package export metadata for typed public SDK and official plugin runtime entrypoints.
* @internal Shared repository-script contract.
*/
export function buildPluginSdkPackageExports() {
return Object.fromEntries(
pluginSdkEntrypoints.flatMap((entry) => {
if (publicPluginSdkEntrypoints.includes(entry)) {
return [
[
`./plugin-sdk/${entry}`,
{
types: `./dist/plugin-sdk/${entry}.d.ts`,
default: `./dist/plugin-sdk/${entry}.js`,
},
],
];
}
if (packagedPrivatePluginSdkRuntimeEntrypoints.includes(entry)) {
// Official plugins ship separately but execute against the host's private runtime.
// Their declarations stay pack-excluded by listUnpackagedPrivatePluginSdkDistArtifacts.
return [
[
`./plugin-sdk/${entry}`,
{
default: `./dist/plugin-sdk/${entry}.js`,
},
],
];
}
return [];
}),
);
}
/**
* List public plugin SDK dist artifacts expected in package output.
* @internal Shared repository-script contract.
*/
export function listPluginSdkDistArtifacts() {
return [
...publicPluginSdkEntrypoints.flatMap((entry) => [
`dist/plugin-sdk/${entry}.js`,
`dist/plugin-sdk/${entry}.d.ts`,
]),
...packagedPrivatePluginSdkRuntimeEntrypoints.map((entry) => `dist/plugin-sdk/${entry}.js`),
];
}
/**
* List private local-only plugin SDK dist artifacts expected after local builds.
* @internal Shared repository-script contract.
*/
/** List private runtime facade artifacts required inside package output. */
export function listPackagedPrivatePluginSdkRuntimeArtifacts() {
return packagedPrivatePluginSdkRuntimeEntrypoints.map((entry) => `dist/plugin-sdk/${entry}.js`);
}
/** List private artifacts that must stay out of package output. */
export function listUnpackagedPrivatePluginSdkDistArtifacts() {
return [
...listPluginSdkDeclarationOutputs(privateLocalOnlyPluginSdkEntrypoints),
...nonProductionPrivatePluginSdkEntrypoints.map((entry) => `dist/plugin-sdk/${entry}.js`),
];
}