Files
openclaw/scripts/lib/deprecated-plugin-sdk-usage.mts
T
Peter Steinberger 8ee945b907 refactor(channels): flatten channel-turn dispatch naming layers (#121308)
* refactor(channels): flatten channel turn dispatch naming

* docs(plugin-sdk): narrow inbound reply compat guidance

* docs(channels): point stale references at turn defining modules

* fix(channels): preserve dispatch contracts after flattening

* chore(plugin-sdk): ratchet surface budgets after flattening

* chore(channels): ratchet removed export collisions

* fix(plugin-sdk): restore inbound reply compat exports

Restore eight still-existing legacy callable re-exports from canonical SDK seams and cover the deprecated package subpath with a table-driven compatibility test.

Raise the public export, callable export, and deprecated export budgets by exactly eight; the three maintainer-authorized zero-consumer symbols remain removed.

* test(channels): split channel turn kernel coverage

Replace the oversized kernel test with independently mocked delivery, pipeline, and finalize suites, preserving all 51 tests while removing the max-lines suppression and stale ratchet entry.

* chore(plugin-sdk): refresh inbound reply API hash

* fix(ci): align channel turn review fixes

Restore the test-local DeliveryResult type removed during the split.

Ratchet the public export, callable export, and deprecated export budgets by exactly seven: six channel-inbound plus one channel-outbound legacy re-export.
2026-08-09 22:22:46 -07:00

55 lines
2.2 KiB
TypeScript

// Builds the list of deprecated public plugin SDK specifiers guarded by scripts.
import deprecatedPublicPluginSdkSubpaths from "./plugin-sdk-deprecated-public-subpaths.json" with { type: "json" };
const DEPRECATED_PLUGIN_SDK_EXTRA_SPECIFIERS: string[] = [];
type BannedInternalPluginSdkFacadeModule = {
modulePath: string;
canonical: string;
allowedImporters?: string[];
};
/** Build fully qualified deprecated plugin SDK module specifiers from subpath metadata. */
export function buildDeprecatedPluginSdkModuleSpecifiers(
deprecatedSubpaths: string[] = deprecatedPublicPluginSdkSubpaths,
) {
const unscoped = [
...DEPRECATED_PLUGIN_SDK_EXTRA_SPECIFIERS,
...deprecatedSubpaths.map((subpath) => `openclaw/plugin-sdk/${subpath}`),
];
// tsconfig aliases the scoped @openclaw/plugin-sdk package to the same
// src/plugin-sdk modules, so ban both spellings of every deprecated specifier.
return [...new Set(unscoped.flatMap((specifier) => [specifier, `@${specifier}`]))].toSorted(
(a, b) => a.localeCompare(b),
);
}
/**
* Deprecated facade modules that stay exported for third-party plugins until the
* documented break train, but must have zero internal importers (src/**,
* extensions/**) via package specifier or relative path. Table-driven and
* additive: future facade collapses (e.g. config-schema) append rows here.
* `modulePath` is the extension-less repo path; `allowedImporters` lists the
* compat re-export chain that keeps the public subpath alive.
*/
export const BANNED_INTERNAL_PLUGIN_SDK_FACADE_MODULES: BannedInternalPluginSdkFacadeModule[] = [
// Reply facades: canonical seams are openclaw/plugin-sdk/channel-inbound and
// openclaw/plugin-sdk/channel-outbound (defineChannelMessageAdapter family).
{
modulePath: "src/plugin-sdk/channel-message",
canonical: "openclaw/plugin-sdk/channel-outbound",
},
{
modulePath: "src/plugin-sdk/channel-reply-pipeline",
canonical: "openclaw/plugin-sdk/channel-outbound",
},
{
modulePath: "src/plugin-sdk/inbound-reply-dispatch",
canonical: "openclaw/plugin-sdk/channel-inbound",
},
{
modulePath: "src/plugin-sdk/inbound-envelope",
canonical: "openclaw/plugin-sdk/channel-inbound",
},
];