mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
fix: redact config values in skills status
This commit is contained in:
@@ -52,14 +52,13 @@ describe("requirements helpers", () => {
|
||||
).toEqual(["A"]);
|
||||
});
|
||||
|
||||
it("buildConfigChecks includes value+status", () => {
|
||||
it("buildConfigChecks includes status", () => {
|
||||
expect(
|
||||
buildConfigChecks({
|
||||
required: ["a.b"],
|
||||
resolveValue: (p) => (p === "a.b" ? 1 : null),
|
||||
isSatisfied: (p) => p === "a.b",
|
||||
}),
|
||||
).toEqual([{ path: "a.b", value: 1, satisfied: true }]);
|
||||
).toEqual([{ path: "a.b", satisfied: true }]);
|
||||
});
|
||||
|
||||
it("evaluateRequirementsFromMetadata derives required+missing", () => {
|
||||
@@ -72,7 +71,6 @@ describe("requirements helpers", () => {
|
||||
hasLocalBin: (bin) => bin === "a",
|
||||
localPlatform: "linux",
|
||||
isEnvSatisfied: (name) => name === "E",
|
||||
resolveConfigValue: () => "x",
|
||||
isConfigSatisfied: () => false,
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ export type Requirements = {
|
||||
|
||||
export type RequirementConfigCheck = {
|
||||
path: string;
|
||||
value: unknown;
|
||||
satisfied: boolean;
|
||||
};
|
||||
|
||||
@@ -84,13 +83,11 @@ export function resolveMissingEnv(params: {
|
||||
|
||||
export function buildConfigChecks(params: {
|
||||
required: string[];
|
||||
resolveValue: (pathStr: string) => unknown;
|
||||
isSatisfied: (pathStr: string) => boolean;
|
||||
}): RequirementConfigCheck[] {
|
||||
return params.required.map((pathStr) => {
|
||||
const value = params.resolveValue(pathStr);
|
||||
const satisfied = params.isSatisfied(pathStr);
|
||||
return { path: pathStr, value, satisfied };
|
||||
return { path: pathStr, satisfied };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -103,7 +100,6 @@ export function evaluateRequirements(params: {
|
||||
localPlatform: string;
|
||||
remotePlatforms?: string[];
|
||||
isEnvSatisfied: (envName: string) => boolean;
|
||||
resolveConfigValue: (pathStr: string) => unknown;
|
||||
isConfigSatisfied: (pathStr: string) => boolean;
|
||||
}): { missing: Requirements; eligible: boolean; configChecks: RequirementConfigCheck[] } {
|
||||
const missingBins = resolveMissingBins({
|
||||
@@ -127,7 +123,6 @@ export function evaluateRequirements(params: {
|
||||
});
|
||||
const configChecks = buildConfigChecks({
|
||||
required: params.required.config,
|
||||
resolveValue: params.resolveConfigValue,
|
||||
isSatisfied: params.isConfigSatisfied,
|
||||
});
|
||||
const missingConfig = configChecks.filter((check) => !check.satisfied).map((check) => check.path);
|
||||
@@ -162,7 +157,6 @@ export function evaluateRequirementsFromMetadata(params: {
|
||||
localPlatform: string;
|
||||
remotePlatforms?: string[];
|
||||
isEnvSatisfied: (envName: string) => boolean;
|
||||
resolveConfigValue: (pathStr: string) => unknown;
|
||||
isConfigSatisfied: (pathStr: string) => boolean;
|
||||
}): {
|
||||
required: Requirements;
|
||||
@@ -187,7 +181,6 @@ export function evaluateRequirementsFromMetadata(params: {
|
||||
localPlatform: params.localPlatform,
|
||||
remotePlatforms: params.remotePlatforms,
|
||||
isEnvSatisfied: params.isEnvSatisfied,
|
||||
resolveConfigValue: params.resolveConfigValue,
|
||||
isConfigSatisfied: params.isConfigSatisfied,
|
||||
});
|
||||
return { required, ...result };
|
||||
|
||||
Reference in New Issue
Block a user