Files
openclaw/ui/config/control-ui-chunking.ts
T
Peter SteinbergerandGitHub cf8b57e7d0 feat(skills): scan session history for workshop ideas (#106766)
* feat: scan past sessions for skill proposals

* feat(ui): add progressive skill history scans

* fix(ui): keep skill history scans synchronized

* refactor: split skill history scan ownership

* style: fix mock helper formatting

* style: format skill history scan

* build: refresh skill history schema baselines

* build: refresh plugin SDK baseline after rebase

* perf(ui): keep startup request budget bounded

* fix(skills): satisfy history scan integration gates

* fix(ui): bound control ui startup chunks

* build: refresh plugin SDK API baseline

* build(ui): refresh self-learning translation memory

* refactor(ui): split skill workshop state

* fix(ci): refresh skill workshop gates

* fix(ci): satisfy skill history lint

* build: refresh plugin SDK baseline after main rebase
2026-07-13 16:15:50 -07:00

84 lines
2.4 KiB
TypeScript

// Control UI config module wires control ui chunking behavior.
function normalizeModuleId(id: string): string {
return id.replace(/\\/g, "/");
}
function moduleIdIncludesPackage(id: string, packageName: string): boolean {
const normalized = normalizeModuleId(id);
return (
normalized.includes(`/node_modules/${packageName}/`) ||
normalized.includes(`/openclaw-pnpm-node-modules/${packageName}/`)
);
}
export function controlUiStableChunkName(id: string): string | undefined {
const normalized = normalizeModuleId(id);
// These entry-and-route helpers must stay together; separate shared chunks
// turn small route-graph changes into extra startup preload requests.
if (
normalized.endsWith("/ui/src/components/config-form.shared.ts") ||
normalized.endsWith("/ui/src/lib/clipboard.ts")
) {
return "control-ui-shared";
}
if (normalized.endsWith("/ui/src/lib/gateway-methods.ts")) {
return "gateway-runtime";
}
if (
moduleIdIncludesPackage(id, "lit") ||
moduleIdIncludesPackage(id, "lit-html") ||
moduleIdIncludesPackage(id, "@lit/reactive-element")
) {
return "lit-runtime";
}
if (
moduleIdIncludesPackage(id, "highlight.js") ||
moduleIdIncludesPackage(id, "markdown-it") ||
moduleIdIncludesPackage(id, "markdown-it-task-lists") ||
moduleIdIncludesPackage(id, "dompurify") ||
moduleIdIncludesPackage(id, "entities") ||
moduleIdIncludesPackage(id, "linkify-it") ||
moduleIdIncludesPackage(id, "mdurl") ||
moduleIdIncludesPackage(id, "punycode.js") ||
moduleIdIncludesPackage(id, "uc.micro")
) {
return "markdown-runtime";
}
if (moduleIdIncludesPackage(id, "zod") || moduleIdIncludesPackage(id, "json5")) {
return "config-runtime";
}
if (
moduleIdIncludesPackage(id, "@noble/ed25519") ||
moduleIdIncludesPackage(id, "@noble/hashes") ||
moduleIdIncludesPackage(id, "ipaddr.js")
) {
return "gateway-runtime";
}
return undefined;
}
export const controlUiCodeSplitting = {
includeDependenciesRecursively: false,
groups: [
{
name: (id: string) => controlUiStableChunkName(id) ?? null,
test: (id: string) => controlUiStableChunkName(id) !== undefined,
priority: 20,
},
{
name: (id: string) =>
normalizeModuleId(id).includes("/ui/src/") ? "control-ui-core" : "control-ui-foundation",
tags: ["$initial"] as ["$initial"],
priority: 10,
maxSize: 400 * 1024,
},
],
};