perf(plugins): prefer native jiti for bundled plugin dist modules (#69925)

Merged via squash.

Prepared head SHA: 1b2da10865
Co-authored-by: aauren <1392295+aauren@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Aaron U'Ren
2026-04-21 21:18:35 -05:00
committed by GitHub
parent fe663de8c7
commit 8d021ee7bf
3 changed files with 8 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ Docs: https://docs.openclaw.ai
- CLI/doctor plugins: lazy-load doctor plugin paths and prefer installed plugin `dist/*` runtime entries over source-adjacent JavaScript fallbacks, reducing the measured `doctor --non-interactive` runtime by about 74% while keeping cold doctor startup on built plugin artifacts. (#69840) Thanks @gumadeiras.
- WhatsApp/groups+direct: forward per-group and per-direct `systemPrompt` config into inbound context `GroupSystemPrompt` so configured per-chat behavioral instructions are injected on every turn. Supports `"*"` wildcard fallback and account-scoped overrides under `channels.whatsapp.accounts.<id>.{groups,direct}`; account maps fully replace root maps (no deep merge), matching the existing `requireMention` pattern. Closes #7011. (#59553) Thanks @Bluetegu.
- Plugins/startup: prefer native Jiti loading for built bundled plugin dist modules on supported runtimes, cutting measured bundled plugin load time by 82-90% while keeping source TypeScript on the transform path. (#69925) Thanks @aauren.
### Fixes

View File

@@ -916,12 +916,16 @@ describe("plugin sdk alias helpers", () => {
}
});
it("keeps bundled plugin dist modules on the aliased Jiti path", () => {
it("prefers native jiti for bundled plugin dist .js modules, keeps .ts on aliased path", () => {
// Built .js/.mjs/.cjs files under dist/extensions/ should now delegate
// to shouldPreferNativeJiti() — which returns true on Linux/macOS for
// compiled artifacts, avoiding the slow jiti transform path.
expect(
resolvePluginLoaderJitiTryNative(`/repo/${bundledDistPluginFile("browser", "index.js")}`, {
preferBuiltDist: true,
}),
).toBe(false);
).toBe(true);
// TypeScript source files still need jiti's transform pipeline.
expect(
resolvePluginLoaderJitiTryNative(`/repo/${bundledDistPluginFile("browser", "helper.ts")}`, {
preferBuiltDist: true,

View File

@@ -671,7 +671,7 @@ export function resolvePluginLoaderJitiTryNative(
},
): boolean {
if (isBundledPluginDistModulePath(modulePath)) {
return false;
return shouldPreferNativeJiti(modulePath);
}
return (
shouldPreferNativeJiti(modulePath) ||