refactor: finish browser compat untangle

This commit is contained in:
Peter Steinberger
2026-03-26 22:41:46 +00:00
parent 8ee809f3cc
commit 83ca6fbfc6
266 changed files with 424 additions and 179 deletions

View File

@@ -23,8 +23,11 @@ export {
} from "../media/image-ops.js";
export { ensureMediaDir, saveMediaBuffer } from "../media/store.js";
export { normalizePluginsConfig, resolveEffectiveEnableState } from "../plugins/config-state.js";
export {
startLazyPluginServiceModule,
type LazyPluginServiceHandle,
} from "../plugins/lazy-service-module.js";
export type { OpenClawPluginService } from "../plugins/types.js";
export { startBrowserControlServerIfEnabled } from "../gateway/server-browser.js";
export { resolveGatewayAuth } from "../gateway/auth.js";
export { isLoopbackHost } from "../gateway/net.js";
export { ensureGatewayStartupAuth } from "../gateway/startup-auth.js";

View File

@@ -268,17 +268,22 @@ function collectExtensionSourceFiles(): string[] {
function collectCoreSourceFiles(): string[] {
const srcDir = resolve(ROOT_DIR, "..", "src");
const normalizedPluginSdkDir = normalizePath(resolve(ROOT_DIR, "plugin-sdk"));
const normalizedBrowserCompatDir = normalizePath(resolve(ROOT_DIR, "compat", "browser"));
coreSourceFilesCache = collectSourceFiles(coreSourceFilesCache, {
rootDir: srcDir,
shouldSkipEntry: ({ normalizedFullPath }) =>
normalizedFullPath.includes(".test.") ||
normalizedFullPath.includes(".test-helpers.") ||
normalizedFullPath.includes(".mock-harness.") ||
normalizedFullPath.includes(".spec.") ||
normalizedFullPath.includes(".fixture.") ||
normalizedFullPath.includes(".snap") ||
// src/plugin-sdk is the curated bridge layer; validate its contracts with dedicated
// plugin-sdk guardrails instead of the generic "core should not touch extensions" rule.
normalizedFullPath.includes(`${normalizedPluginSdkDir}/`),
normalizedFullPath.includes(`${normalizedPluginSdkDir}/`) ||
// src/compat/browser is the explicit browser compatibility shim layer that forwards
// legacy core entrypoints into the bundled browser plugin.
normalizedFullPath.includes(`${normalizedBrowserCompatDir}/`),
});
return coreSourceFilesCache;
}

View File

@@ -5,5 +5,6 @@ export * from "../plugins/hook-runner-global.js";
export * from "../plugins/http-path.js";
export * from "../plugins/http-registry.js";
export * from "../plugins/interactive.js";
export * from "../plugins/lazy-service-module.js";
export * from "../plugins/types.js";
export type { RuntimeLogger } from "../plugins/runtime/types.js";