Files
openclaw/src/agents/apply-patch-model-policy.ts
Peter Steinberger 32c84b0f41 feat(skills): capture reusable techniques from successful work (#105674)
* feat(skills): capture reusable experience safely

* feat(skills): review completed work for reusable learning

* docs(skills): explain self-learning

* docs: clarify self-learning runtime scope

* fix(skills): harden autonomous workshop reviews

* test(skills): align review prompt fixture
2026-07-13 00:22:06 -07:00

32 lines
1001 B
TypeScript

import {
normalizeLowercaseStringOrEmpty,
normalizeOptionalLowercaseString,
} from "@openclaw/normalization-core/string-coerce";
export function isApplyPatchAllowedForModel(params: {
modelProvider?: string;
modelId?: string;
allowModels?: string[];
}) {
const allowModels = Array.isArray(params.allowModels) ? params.allowModels : [];
if (allowModels.length === 0) {
return true;
}
const modelId = params.modelId?.trim();
if (!modelId) {
return false;
}
const normalizedModelId = normalizeLowercaseStringOrEmpty(modelId);
const provider = normalizeOptionalLowercaseString(params.modelProvider);
const normalizedFull =
provider && !normalizedModelId.includes("/")
? `${provider}/${normalizedModelId}`
: normalizedModelId;
return allowModels.some((entry) => {
const normalized = normalizeOptionalLowercaseString(entry);
return Boolean(
normalized && (normalized === normalizedModelId || normalized === normalizedFull),
);
});
}