refactor(plugin-sdk): remove unused reserved helper exports

This commit is contained in:
Peter Steinberger
2026-04-28 05:00:47 +01:00
parent 4d69f81a4e
commit 1e3ce10e27
58 changed files with 53 additions and 3483 deletions

View File

@@ -95,9 +95,6 @@ export const pluginSdkDocMetadata = {
"provider-selection-runtime": {
category: "provider",
},
opencode: {
category: "provider",
},
"runtime-store": {
category: "runtime",
},

View File

@@ -76,7 +76,6 @@
"media-generation-runtime",
"conversation-binding-runtime",
"conversation-runtime",
"matrix-runtime-heavy",
"matrix-runtime-shared",
"thread-bindings-runtime",
"thread-bindings-session-runtime",
@@ -95,7 +94,6 @@
"secret-file-runtime",
"security-runtime",
"gateway-runtime",
"github-copilot-login",
"github-copilot-token",
"cli-runtime",
"cli-backend",
@@ -134,18 +132,12 @@
"agent-config-primitives",
"allow-from",
"allowlist-config-edit",
"bluebubbles",
"bluebubbles-policy",
"browser-cdp",
"browser-config",
"browser-config-runtime",
"browser-config-support",
"browser-control-auth",
"browser-node-runtime",
"browser-profiles",
"browser-security-runtime",
"browser-setup-tools",
"browser-support",
"boolean-param",
"channel-contract-testing",
"dangerous-name-runtime",
@@ -164,9 +156,6 @@
"direct-dm-guard-policy",
"device-bootstrap",
"diagnostic-runtime",
"diagnostics-otel",
"diagnostics-prometheus",
"diffs",
"error-runtime",
"extension-shared",
"channel-config-helpers",
@@ -196,9 +185,6 @@
"channel-route",
"channel-targets",
"context-visibility-runtime",
"feishu",
"feishu-conversation",
"feishu-setup",
"file-lock",
"fetch-runtime",
"runtime-fetch",
@@ -215,8 +201,6 @@
"global-singleton",
"directory-config-runtime",
"directory-runtime",
"googlechat",
"googlechat-runtime-shared",
"media-generation-runtime-shared",
"image-generation",
"image-generation-runtime",
@@ -226,8 +210,6 @@
"video-generation",
"video-generation-runtime",
"video-generation-core",
"irc",
"irc-surface",
"reply-history",
"realtime-transcription",
"realtime-voice",
@@ -239,19 +221,7 @@
"json-store",
"persistent-dedupe",
"keyed-async-queue",
"line",
"line-core",
"line-runtime",
"line-surface",
"llm-task",
"matrix",
"matrix-helper",
"matrix-runtime-surface",
"matrix-surface",
"matrix-thread-bindings",
"qa-runner-runtime",
"mattermost",
"mattermost-policy",
"memory-core",
"memory-core-engine-runtime",
"memory-core-host-engine-embeddings",
@@ -272,14 +242,10 @@
"memory-host-markdown",
"memory-host-search",
"memory-host-status",
"memory-lancedb",
"msteams",
"models-provider-runtime",
"skill-commands-runtime",
"native-command-config-runtime",
"native-command-registry",
"nextcloud-talk",
"nostr",
"provider-auth",
"provider-auth-runtime",
"provider-auth-api-key",
@@ -294,7 +260,6 @@
"provider-http",
"provider-model-types",
"provider-model-shared",
"opencode",
"volc-model-catalog-shared",
"provider-onboard",
"provider-stream-family",
@@ -323,21 +288,13 @@
"state-paths",
"target-resolver-runtime",
"telegram-command-config",
"telegram-command-ui",
"text-autolink-runtime",
"thread-ownership",
"tlon",
"tool-payload",
"tool-send",
"twitch",
"webhook-ingress",
"webhook-targets",
"webhook-request-guards",
"webhook-path",
"web-media",
"voice-call",
"zalo",
"zalo-setup",
"zalouser",
"zod"
]

View File

@@ -2,14 +2,11 @@
import { existsSync, readdirSync, readFileSync } from "node:fs";
import { join, relative, resolve } from "node:path";
import {
dormantReservedBundledPluginSdkEntrypoints,
dormantReservedBundledPluginSdkEntrypointRecords,
pluginSdkEntrypoints,
publicPluginOwnedSdkEntrypoints,
reservedBundledPluginSdkEntrypoints,
supportedBundledFacadeSdkEntrypoints,
} from "../src/plugin-sdk/entrypoints.ts";
import type { DormantReservedBundledPluginSdkEntrypointRecord } from "../src/plugin-sdk/entrypoints.ts";
import { PLUGIN_COMPAT_RECORDS } from "../src/plugins/compat/registry.ts";
import type { PluginCompatRecord } from "../src/plugins/compat/types.ts";
@@ -30,7 +27,6 @@ const PLUGIN_SDK_SPECIFIER_PATTERN =
type CliOptions = {
json: boolean;
summary: boolean;
retirementPlan: boolean;
owner?: string;
failOnCrossOwner: boolean;
failOnEligibleCompat: boolean;
@@ -71,16 +67,11 @@ type BoundaryReport = {
pluginSdk: {
entrypointCount: number;
reservedCount: number;
dormantReservedCount: number;
supportedBundledFacadeCount: number;
publicPluginOwnedCount: number;
reservedImports: ReservedSdkImport[];
crossOwnerReservedImports: ReservedSdkImport[];
unusedReservedSubpaths: string[];
dormantReservedSubpaths: string[];
dormantReservedRecords: DormantReservedBundledPluginSdkEntrypointRecord[];
unclassifiedUnusedReservedSubpaths: string[];
dormantReservedEligibleForRemovalSubpaths: string[];
};
memoryHostSdk: {
privatePackage: boolean;
@@ -102,17 +93,12 @@ type BoundaryReportSummary = {
pluginSdk: {
entrypointCount: number;
reservedCount: number;
dormantReservedCount: number;
supportedBundledFacadeCount: number;
publicPluginOwnedCount: number;
reservedImportCount: number;
crossOwnerReservedImportCount: number;
unusedReservedCount: number;
dormantReservedCountInUnused: number;
unclassifiedUnusedReservedCount: number;
unclassifiedUnusedReservedSubpaths: string[];
dormantReservedEligibleForRemovalCount: number;
dormantReservedEligibleForRemovalSubpaths: string[];
unusedReservedSubpaths: string[];
crossOwnerReservedImports: ReservedSdkImport[];
};
memoryHostSdk: {
@@ -163,7 +149,6 @@ function parseArgs(args: readonly string[]): CliOptions {
const options: CliOptions = {
json: false,
summary: false,
retirementPlan: false,
failOnCrossOwner: false,
failOnEligibleCompat: false,
failOnUnclassifiedUnusedReserved: false,
@@ -175,8 +160,6 @@ function parseArgs(args: readonly string[]): CliOptions {
options.json = true;
} else if (arg === "--summary") {
options.summary = true;
} else if (arg === "--retirement-plan") {
options.retirementPlan = true;
} else if (arg === "--owner") {
const owner = args[index + 1];
if (!owner || owner.startsWith("--")) {
@@ -196,9 +179,6 @@ function parseArgs(args: readonly string[]): CliOptions {
throw new Error(`Unknown argument: ${arg}`);
}
}
if (options.retirementPlan && (options.json || options.summary)) {
throw new Error("--retirement-plan cannot be combined with --summary or --json");
}
return options;
}
@@ -209,11 +189,10 @@ function renderHelp(): string {
"Options:",
" --summary Print compact counts only.",
" --json Emit JSON instead of text.",
" --retirement-plan Emit an issue/PR-ready dormant SDK subpath retirement checklist.",
" --owner <id> Filter compat/imports/reserved shims by owner id.",
" --fail-on-cross-owner Exit non-zero on cross-owner reserved SDK imports.",
" --fail-on-eligible-compat Exit non-zero when deprecated compat is due for removal.",
" --fail-on-unclassified-unused-reserved Exit non-zero on unused reserved SDK shims without a dormant classification.",
" --fail-on-unclassified-unused-reserved Exit non-zero on unused reserved SDK shims.",
].join("\n");
}
@@ -395,10 +374,6 @@ function resolveMemoryHostImplementation(
return "mixed";
}
function isDateDue(removeAfter: string, today = new Date()): boolean {
return new Date(`${removeAfter}T00:00:00Z`) <= today;
}
function buildSummary(report: BoundaryReport, owner?: string): BoundaryReportSummary {
const eligibleForRemoval = report.compat.records
.filter((record) => record.eligibleForRemoval)
@@ -419,19 +394,12 @@ function buildSummary(report: BoundaryReport, owner?: string): BoundaryReportSum
pluginSdk: {
entrypointCount: report.pluginSdk.entrypointCount,
reservedCount: report.pluginSdk.reservedCount,
dormantReservedCount: report.pluginSdk.dormantReservedCount,
supportedBundledFacadeCount: report.pluginSdk.supportedBundledFacadeCount,
publicPluginOwnedCount: report.pluginSdk.publicPluginOwnedCount,
reservedImportCount: report.pluginSdk.reservedImports.length,
crossOwnerReservedImportCount: report.pluginSdk.crossOwnerReservedImports.length,
unusedReservedCount: report.pluginSdk.unusedReservedSubpaths.length,
dormantReservedCountInUnused: report.pluginSdk.dormantReservedSubpaths.length,
unclassifiedUnusedReservedCount: report.pluginSdk.unclassifiedUnusedReservedSubpaths.length,
unclassifiedUnusedReservedSubpaths: report.pluginSdk.unclassifiedUnusedReservedSubpaths,
dormantReservedEligibleForRemovalCount:
report.pluginSdk.dormantReservedEligibleForRemovalSubpaths.length,
dormantReservedEligibleForRemovalSubpaths:
report.pluginSdk.dormantReservedEligibleForRemovalSubpaths,
unusedReservedSubpaths: report.pluginSdk.unusedReservedSubpaths,
crossOwnerReservedImports: report.pluginSdk.crossOwnerReservedImports,
},
memoryHostSdk: {
@@ -455,10 +423,6 @@ function buildReport(options: Pick<CliOptions, "owner"> = {}): BoundaryReport {
matchesOwner(options.owner, entry.owner) || matchesOwner(options.owner, entry.consumerOwner),
);
const usedReserved = new Set(reservedImports.map((entry) => entry.subpath));
const dormantReserved = new Set<string>(dormantReservedBundledPluginSdkEntrypoints);
const dormantReservedRecords = dormantReservedBundledPluginSdkEntrypointRecords.filter((record) =>
matchesOwner(options.owner, record.owner),
);
const unusedReservedSubpaths = reservedBundledPluginSdkEntrypoints
.filter(
(subpath) =>
@@ -466,14 +430,6 @@ function buildReport(options: Pick<CliOptions, "owner"> = {}): BoundaryReport {
matchesOwner(options.owner, resolvePluginOwner(subpath, pluginIds)),
)
.toSorted();
const dormantReservedSubpaths = unusedReservedSubpaths
.filter((subpath) => dormantReserved.has(subpath))
.toSorted();
const dormantReservedEligibleForRemovalSubpaths = dormantReservedRecords
.filter((record) => unusedReservedSubpaths.includes(record.subpath))
.filter((record) => isDateDue(record.removeAfter))
.map((record) => record.subpath)
.toSorted();
return {
generatedAt: new Date().toISOString(),
compat: {
@@ -484,7 +440,6 @@ function buildReport(options: Pick<CliOptions, "owner"> = {}): BoundaryReport {
pluginSdk: {
entrypointCount: pluginSdkEntrypoints.length,
reservedCount: reservedBundledPluginSdkEntrypoints.length,
dormantReservedCount: dormantReservedBundledPluginSdkEntrypoints.length,
supportedBundledFacadeCount: supportedBundledFacadeSdkEntrypoints.length,
publicPluginOwnedCount: publicPluginOwnedSdkEntrypoints.length,
reservedImports,
@@ -492,12 +447,6 @@ function buildReport(options: Pick<CliOptions, "owner"> = {}): BoundaryReport {
(entry) => entry.relation === "cross-owner",
),
unusedReservedSubpaths,
dormantReservedSubpaths,
dormantReservedRecords,
unclassifiedUnusedReservedSubpaths: unusedReservedSubpaths
.filter((subpath) => !dormantReserved.has(subpath))
.toSorted(),
dormantReservedEligibleForRemovalSubpaths,
},
memoryHostSdk: collectMemoryHostBoundary(files),
};
@@ -511,22 +460,13 @@ function renderSummaryText(summary: BoundaryReportSummary): string {
`compat deprecated=${summary.compat.deprecatedCount} eligibleForRemoval=${summary.compat.eligibleForRemovalCount}`,
);
lines.push(
`plugin-sdk entrypoints=${summary.pluginSdk.entrypointCount} reserved=${summary.pluginSdk.reservedCount} dormantReserved=${summary.pluginSdk.dormantReservedCount}`,
`plugin-sdk entrypoints=${summary.pluginSdk.entrypointCount} reserved=${summary.pluginSdk.reservedCount}`,
);
lines.push(
` reservedImports=${summary.pluginSdk.reservedImportCount} crossOwnerReservedImports=${summary.pluginSdk.crossOwnerReservedImportCount} unusedReserved=${summary.pluginSdk.unusedReservedCount}`,
);
lines.push(
` dormantUnused=${summary.pluginSdk.dormantReservedCountInUnused} unclassifiedUnused=${summary.pluginSdk.unclassifiedUnusedReservedCount}`,
);
lines.push(
` dormantEligibleForRemoval=${summary.pluginSdk.dormantReservedEligibleForRemovalCount}`,
);
for (const subpath of summary.pluginSdk.unclassifiedUnusedReservedSubpaths) {
lines.push(` unclassified-unused ${subpath}`);
}
for (const subpath of summary.pluginSdk.dormantReservedEligibleForRemovalSubpaths) {
lines.push(` dormant-due ${subpath}`);
for (const subpath of summary.pluginSdk.unusedReservedSubpaths) {
lines.push(` unused-reserved ${subpath}`);
}
for (const entry of summary.pluginSdk.crossOwnerReservedImports) {
lines.push(` cross-owner ${entry.file}: ${entry.specifier} owner=${entry.owner ?? "unknown"}`);
@@ -551,22 +491,13 @@ function renderText(report: BoundaryReport, owner?: string): string {
}
lines.push("");
lines.push(
`plugin-sdk entrypoints=${report.pluginSdk.entrypointCount} reserved=${report.pluginSdk.reservedCount} dormantReserved=${report.pluginSdk.dormantReservedCount} supportedBundledFacade=${report.pluginSdk.supportedBundledFacadeCount} publicPluginOwned=${report.pluginSdk.publicPluginOwnedCount}`,
`plugin-sdk entrypoints=${report.pluginSdk.entrypointCount} reserved=${report.pluginSdk.reservedCount} supportedBundledFacade=${report.pluginSdk.supportedBundledFacadeCount} publicPluginOwned=${report.pluginSdk.publicPluginOwnedCount}`,
);
lines.push(
` reservedImports=${report.pluginSdk.reservedImports.length} crossOwnerReservedImports=${report.pluginSdk.crossOwnerReservedImports.length} unusedReserved=${report.pluginSdk.unusedReservedSubpaths.length}`,
);
lines.push(
` dormantUnused=${report.pluginSdk.dormantReservedSubpaths.length} unclassifiedUnused=${report.pluginSdk.unclassifiedUnusedReservedSubpaths.length}`,
);
lines.push(
` dormantEligibleForRemoval=${report.pluginSdk.dormantReservedEligibleForRemovalSubpaths.length}`,
);
for (const subpath of report.pluginSdk.unclassifiedUnusedReservedSubpaths) {
lines.push(` unclassified-unused ${subpath}`);
}
for (const subpath of report.pluginSdk.dormantReservedEligibleForRemovalSubpaths) {
lines.push(` dormant-due ${subpath}`);
for (const subpath of report.pluginSdk.unusedReservedSubpaths) {
lines.push(` unused-reserved ${subpath}`);
}
for (const entry of report.pluginSdk.crossOwnerReservedImports) {
lines.push(` cross-owner ${entry.file}: ${entry.specifier} owner=${entry.owner ?? "unknown"}`);
@@ -578,49 +509,6 @@ function renderText(report: BoundaryReport, owner?: string): string {
return lines.join("\n");
}
function renderRetirementPlan(report: BoundaryReport, owner?: string): string {
const records = report.pluginSdk.dormantReservedRecords.toSorted(
(left, right) =>
left.owner.localeCompare(right.owner) ||
left.removeAfter.localeCompare(right.removeAfter) ||
left.subpath.localeCompare(right.subpath),
);
const dueSubpaths = new Set(report.pluginSdk.dormantReservedEligibleForRemovalSubpaths);
const owners = [...new Set(records.map((record) => record.owner))];
const removeAfterDates = [...new Set(records.map((record) => record.removeAfter))];
const lines: string[] = [];
lines.push(`# Plugin SDK Dormant Reserved Subpath Retirement Plan`);
lines.push("");
lines.push(`Generated: ${report.generatedAt}`);
if (owner) {
lines.push(`Owner filter: \`${owner}\``);
}
lines.push("");
lines.push("## Summary");
lines.push("");
lines.push(`- Dormant reserved subpaths: ${records.length}`);
lines.push(`- Owners: ${owners.length}`);
lines.push(`- Removal dates: ${removeAfterDates.join(", ") || "none"}`);
lines.push(`- Eligible for removal now: ${dueSubpaths.size}`);
lines.push(`- CI gate: \`pnpm plugins:boundary-report:ci\``);
if (records.length === 0) {
lines.push("");
lines.push("No dormant reserved SDK subpaths match this filter.");
return lines.join("\n");
}
for (const ownerId of owners) {
lines.push("");
lines.push(`## ${ownerId}`);
for (const record of records.filter((candidate) => candidate.owner === ownerId)) {
const status = dueSubpaths.has(record.subpath) ? "due" : "waiting";
lines.push(
`- [ ] \`openclaw/plugin-sdk/${record.subpath}\` remove after \`${record.removeAfter}\` (${status}); reason=\`${record.reason}\`; replacement: ${record.replacement}`,
);
}
}
return lines.join("\n");
}
function collectFailures(report: BoundaryReport, options: CliOptions): string[] {
const failures: string[] = [];
if (options.failOnCrossOwner && report.pluginSdk.crossOwnerReservedImports.length > 0) {
@@ -630,10 +518,10 @@ function collectFailures(report: BoundaryReport, options: CliOptions): string[]
}
if (
options.failOnUnclassifiedUnusedReserved &&
report.pluginSdk.unclassifiedUnusedReservedSubpaths.length > 0
report.pluginSdk.unusedReservedSubpaths.length > 0
) {
failures.push(
`${report.pluginSdk.unclassifiedUnusedReservedSubpaths.length} unused reserved SDK subpath(s) lack dormant classification`,
`${report.pluginSdk.unusedReservedSubpaths.length} unused reserved SDK subpath(s) found`,
);
}
if (options.failOnEligibleCompat && report.compat.eligibleForRemovalCount > 0) {
@@ -641,14 +529,6 @@ function collectFailures(report: BoundaryReport, options: CliOptions): string[]
`${report.compat.eligibleForRemovalCount} compatibility record(s) are due for removal`,
);
}
if (
options.failOnEligibleCompat &&
report.pluginSdk.dormantReservedEligibleForRemovalSubpaths.length > 0
) {
failures.push(
`${report.pluginSdk.dormantReservedEligibleForRemovalSubpaths.length} dormant reserved SDK subpath(s) are due for removal`,
);
}
return failures;
}
@@ -669,9 +549,7 @@ if (options.help) {
const report = buildReport(options);
const summary = buildSummary(report, options.owner);
if (options.retirementPlan) {
process.stdout.write(`${renderRetirementPlan(report, options.owner)}\n`);
} else if (options.json) {
if (options.json) {
process.stdout.write(`${JSON.stringify(options.summary ? summary : report, null, 2)}\n`);
} else if (options.summary) {
process.stdout.write(`${renderSummaryText(summary)}\n`);