perf: reuse auto-enable manifest registry

This commit is contained in:
Shakker
2026-05-06 23:30:15 +01:00
parent 6aafdf121a
commit e66edcc8b9
2 changed files with 24 additions and 6 deletions

View File

@@ -46,6 +46,7 @@ Docs: https://docs.openclaw.ai
- Docs: clarify that IRC uses raw TCP/TLS sockets outside operator-managed forward proxy routing, so direct IRC egress should be explicitly approved before enabling IRC. Thanks @jesse-merhi.
- Gateway/performance: defer non-readiness sidecars until after the ready signal, avoid hot-path channel plugin barrel imports, and fast-path trusted bundled plugin metadata during Gateway startup.
- Gateway/performance: reuse the compatible plugin metadata snapshot across dashboard and channel agent turns so auto-enabled runtime config does not repeatedly rescan plugin metadata before provider calls. Thanks @shakkernerd.
- Gateway/performance: avoid resolving plugin auto-enable metadata twice in one runtime config pass, reducing repeated dashboard turn metadata scans. Thanks @shakkernerd.
- Auth/providers: pass `config` and `workspaceDir` lookup context through to provider-id resolution so workspace-scoped auth aliases resolve correctly when no explicit alias map is supplied. Thanks @shakkernerd.
- Gateway/performance: avoid importing `jiti` on native-loadable plugin startup paths, so compiled bundled plugin surfaces do not pay source-transform loader cost unless fallback loading is actually needed.
- Gateway/diagnostics: add startup phase spans, active work labels, stale terminal bridge markers, and default sync-I/O tracing in `pnpm gateway:watch` so slow Gateway turns are easier to attribute from logs and stability diagnostics.

View File

@@ -1,8 +1,9 @@
import type { PluginManifestRegistry } from "../plugins/manifest-registry.js";
import { detectPluginAutoEnableCandidates } from "./plugin-auto-enable.detect.js";
import {
materializePluginAutoEnableCandidatesInternal,
resolveConfiguredPluginAutoEnableCandidates,
resolvePluginAutoEnableManifestRegistry,
resolvePluginAutoEnableReadiness,
} from "./plugin-auto-enable.shared.js";
import type {
PluginAutoEnableCandidate,
@@ -45,11 +46,27 @@ export function applyPluginAutoEnable(params: {
env?: NodeJS.ProcessEnv;
manifestRegistry?: PluginManifestRegistry;
}): PluginAutoEnableResult {
const candidates = detectPluginAutoEnableCandidates(params);
return materializePluginAutoEnableCandidates({
config: params.config,
candidates,
env: params.env,
const env = params.env ?? process.env;
const config = params.config ?? {};
const readiness = resolvePluginAutoEnableReadiness(config, env);
if (!readiness.mayNeedAutoEnable) {
return { config, changes: [], autoEnabledReasons: {} };
}
const manifestRegistry = resolvePluginAutoEnableManifestRegistry({
config,
env,
manifestRegistry: params.manifestRegistry,
});
const candidates = resolveConfiguredPluginAutoEnableCandidates({
config,
env,
registry: manifestRegistry,
configuredChannelIds: readiness.configuredChannelIds,
});
return materializePluginAutoEnableCandidates({
config,
candidates,
env,
manifestRegistry,
});
}