mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 17:40:21 +00:00
fix: tighten lowercase helper typing
This commit is contained in:
@@ -33,7 +33,9 @@ export function sanitizeToolName(raw: string): string {
|
||||
|
||||
export function normalizeReservedToolNames(names?: Iterable<string>): Set<string> {
|
||||
return new Set(
|
||||
Array.from(names ?? [], (name) => normalizeOptionalLowercaseString(name)).filter(Boolean),
|
||||
Array.from(names ?? [], (name) => normalizeOptionalLowercaseString(name)).filter(
|
||||
(name): name is string => Boolean(name),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ function isLegacyFoundryVisionModelCandidate(params: {
|
||||
const normalizedCandidates = [params.modelId, params.modelName]
|
||||
.filter((value): value is string => typeof value === "string")
|
||||
.map((value) => normalizeOptionalLowercaseString(value))
|
||||
.filter(Boolean);
|
||||
.filter((value): value is string => Boolean(value));
|
||||
return normalizedCandidates.some(
|
||||
(candidate) =>
|
||||
candidate.startsWith("gpt-") ||
|
||||
|
||||
@@ -77,7 +77,7 @@ export function createSessionsListTool(opts?: {
|
||||
|
||||
const kindsRaw = readStringArrayParam(params, "kinds")
|
||||
?.map((value) => normalizeOptionalLowercaseString(value))
|
||||
.filter(Boolean);
|
||||
.filter((value): value is string => Boolean(value));
|
||||
const allowedKindsList = (kindsRaw ?? []).filter((value) =>
|
||||
["main", "group", "cron", "hook", "node", "other"].includes(value),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user