@@ -53,15 +53,15 @@ export function resolveSkillConfig(
|
53 | 53 | return entry; |
54 | 54 | } |
55 | 55 | |
56 | | -function normalizeAllowlist(input: unknown): string[] | undefined { |
| 56 | +function normalizeAllowlist(input: unknown): ReadonlySet<string> | undefined { |
57 | 57 | if (!input) { |
58 | 58 | return undefined; |
59 | 59 | } |
60 | 60 | if (!Array.isArray(input)) { |
61 | 61 | return undefined; |
62 | 62 | } |
63 | 63 | const normalized = normalizeStringEntries(input); |
64 | | -return normalized.length > 0 ? normalized : undefined; |
| 64 | +return normalized.length > 0 ? new Set(normalized) : undefined; |
65 | 65 | } |
66 | 66 | |
67 | 67 | const BUNDLED_SOURCES = new Set(["openclaw-bundled"]); |
@@ -70,25 +70,25 @@ function isBundledSkill(entry: SkillEntry): boolean {
|
70 | 70 | return BUNDLED_SOURCES.has(resolveSkillSource(entry.skill)); |
71 | 71 | } |
72 | 72 | |
73 | | -export function resolveBundledAllowlist(config?: OpenClawConfig): string[] | undefined { |
| 73 | +export function resolveBundledAllowlist(config?: OpenClawConfig): ReadonlySet<string> | undefined { |
74 | 74 | return normalizeAllowlist(config?.skills?.allowBundled); |
75 | 75 | } |
76 | 76 | |
77 | | -export function isBundledSkillAllowed(entry: SkillEntry, allowlist?: string[]): boolean { |
78 | | -if (!allowlist || allowlist.length === 0) { |
| 77 | +export function isBundledSkillAllowed(entry: SkillEntry, allowlist?: ReadonlySet<string>): boolean { |
| 78 | +if (!allowlist || allowlist.size === 0) { |
79 | 79 | return true; |
80 | 80 | } |
81 | 81 | if (!isBundledSkill(entry)) { |
82 | 82 | return true; |
83 | 83 | } |
84 | 84 | const key = resolveSkillKey(entry.skill, entry); |
85 | | -return allowlist.includes(key) || allowlist.includes(entry.skill.name); |
| 85 | +return allowlist.has(key) || allowlist.has(entry.skill.name); |
86 | 86 | } |
87 | 87 | |
88 | 88 | export function shouldIncludeSkill(params: { |
89 | 89 | entry: SkillEntry; |
90 | 90 | config?: OpenClawConfig; |
91 | | -bundledAllowlist: string[] | undefined; |
| 91 | +bundledAllowlist: ReadonlySet<string> | undefined; |
92 | 92 | eligibility?: SkillEligibilityContext; |
93 | 93 | }): boolean { |
94 | 94 | const { entry, config, bundledAllowlist, eligibility } = params; |
|