mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:44:30 +00:00
refactor(agents): dedupe config and truncation guards
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { OpenClawConfig, SkillConfig } from "../../config/config.js";
|
||||
import {
|
||||
evaluateRuntimeRequires,
|
||||
evaluateRuntimeEligibility,
|
||||
hasBinary,
|
||||
isConfigPathTruthyWithDefaults,
|
||||
resolveConfigPath,
|
||||
@@ -76,8 +76,6 @@ export function shouldIncludeSkill(params: {
|
||||
const skillKey = resolveSkillKey(entry.skill, entry);
|
||||
const skillConfig = resolveSkillConfig(config, skillKey);
|
||||
const allowBundled = normalizeAllowlist(config?.skills?.allowBundled);
|
||||
const osList = entry.metadata?.os ?? [];
|
||||
const remotePlatforms = eligibility?.remote?.platforms ?? [];
|
||||
|
||||
if (skillConfig?.enabled === false) {
|
||||
return false;
|
||||
@@ -85,18 +83,10 @@ export function shouldIncludeSkill(params: {
|
||||
if (!isBundledSkillAllowed(entry, allowBundled)) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
osList.length > 0 &&
|
||||
!osList.includes(resolveRuntimePlatform()) &&
|
||||
!remotePlatforms.some((platform) => osList.includes(platform))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (entry.metadata?.always === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return evaluateRuntimeRequires({
|
||||
return evaluateRuntimeEligibility({
|
||||
os: entry.metadata?.os,
|
||||
remotePlatforms: eligibility?.remote?.platforms,
|
||||
always: entry.metadata?.always,
|
||||
requires: entry.metadata?.requires,
|
||||
hasBin: hasBinary,
|
||||
hasRemoteBin: eligibility?.remote?.hasBin,
|
||||
|
||||
Reference in New Issue
Block a user