fix(plugin-sdk): align speech runtime packaging (#89899)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
xingzhou 2026-07-07 14:38:41 +08:00 committed by GitHub
parent 5537bc9c4d
commit de152b1f65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 109 additions and 14 deletions

View file

@ -25,6 +25,7 @@ import {
} from "node:path";
import { pathToFileURL } from "node:url";
import { formatErrorMessage } from "../src/infra/errors.ts";
import { ALWAYS_ALLOWED_RUNTIME_DIR_NAMES } from "../src/plugin-sdk/facade-activation-contract.ts";
import { BUNDLED_RUNTIME_SIDECAR_PATHS } from "../src/plugins/runtime-sidecar-paths.ts";
import { readBoundedResponseText } from "./lib/bounded-response.ts";
import { listBundledPluginPackArtifacts } from "./lib/bundled-plugin-build-entries.mjs";
@ -409,6 +410,7 @@ export function collectInstalledPackageErrors(params: {
}
errors.push(...collectInstalledBundledExtensionManifestErrors(params.packageRoot));
errors.push(...collectInstalledAlwaysAllowedRuntimeFacadeErrors(params.packageRoot));
errors.push(...collectInstalledContextEngineRuntimeErrors(params.packageRoot));
errors.push(...collectInstalledPluginSdkZodArtifactErrors(params.packageRoot));
errors.push(...collectInstalledPluginSdkDeclarationErrors(params.packageRoot));
@ -417,6 +419,25 @@ export function collectInstalledPackageErrors(params: {
return errors;
}
export function collectInstalledAlwaysAllowedRuntimeFacadeErrors(packageRoot: string): string[] {
const errors: string[] = [];
const activationRuntimePath = "dist/facade-activation-check.runtime.js";
if (!existsSync(join(packageRoot, activationRuntimePath))) {
errors.push(
`installed package is missing required facade activation runtime: ${activationRuntimePath}`,
);
}
for (const dirName of ALWAYS_ALLOWED_RUNTIME_DIR_NAMES) {
const relativePath = `dist/extensions/${dirName}/runtime-api.js`;
if (!existsSync(join(packageRoot, relativePath))) {
errors.push(
`installed package allows bundled runtime facade ${dirName}/runtime-api.js but is missing required runtime sidecar: ${relativePath}.`,
);
}
}
return errors;
}
function collectInstalledBundledExtensionIds(packageRoot: string): Set<string> {
const extensionsDir = join(packageRoot, "dist", "extensions");
if (!existsSync(extensionsDir)) {