perf: prepare bundled skill allowlist once · openclaw/openclaw@112939d
shakkernerd
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -88,17 +88,17 @@ export function isBundledSkillAllowed(entry: SkillEntry, allowlist?: string[]):
|
88 | 88 | export function shouldIncludeSkill(params: { |
89 | 89 | entry: SkillEntry; |
90 | 90 | config?: OpenClawConfig; |
| 91 | +bundledAllowlist: string[] | undefined; |
91 | 92 | eligibility?: SkillEligibilityContext; |
92 | 93 | }): boolean { |
93 | | -const { entry, config, eligibility } = params; |
| 94 | +const { entry, config, bundledAllowlist, eligibility } = params; |
94 | 95 | const skillKey = resolveSkillKey(entry.skill, entry); |
95 | 96 | const skillConfig = resolveSkillConfig(config, skillKey); |
96 | | -const allowBundled = normalizeAllowlist(config?.skills?.allowBundled); |
97 | 97 | |
98 | 98 | if (skillConfig?.enabled === false) { |
99 | 99 | return false; |
100 | 100 | } |
101 | | -if (!isBundledSkillAllowed(entry, allowBundled)) { |
| 101 | +if (!isBundledSkillAllowed(entry, bundledAllowlist)) { |
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | return evaluateRuntimeEligibility({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,7 @@ import type {
|
24 | 24 | SkillSnapshot, |
25 | 25 | } from "../types.js"; |
26 | 26 | import { resolveBundledSkillsDir } from "./bundled-dir.js"; |
27 | | -import { shouldIncludeSkill } from "./config.js"; |
| 27 | +import { resolveBundledAllowlist, shouldIncludeSkill } from "./config.js"; |
28 | 28 | import { resolveOpenClawMetadata, resolveSkillInvocationPolicy } from "./frontmatter.js"; |
29 | 29 | import { loadSkillsFromDirSafe, readSkillFrontmatterSafe } from "./local-loader.js"; |
30 | 30 | import { resolvePluginSkillDirs } from "./plugin-skills.js"; |
@@ -113,7 +113,10 @@ function filterSkillEntries(
|
113 | 113 | skillFilter?: string[], |
114 | 114 | eligibility?: SkillEligibilityContext, |
115 | 115 | ): SkillEntry[] { |
116 | | -let filtered = entries.filter((entry) => shouldIncludeSkill({ entry, config, eligibility })); |
| 116 | +const bundledAllowlist = resolveBundledAllowlist(config); |
| 117 | +let filtered = entries.filter((entry) => |
| 118 | +shouldIncludeSkill({ entry, config, bundledAllowlist, eligibility }), |
| 119 | +); |
117 | 120 | // If skillFilter is provided, only include skills in the filter list. |
118 | 121 | if (skillFilter !== undefined) { |
119 | 122 | const normalized = normalizeSkillFilter(skillFilter) ?? []; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。