mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-26 10:51:16 +00:00
* refactor: delete dead infra and config exports * refactor: preserve live infra and config contracts * refactor(config): remove obsolete file-store lifecycle APIs * refactor(infra): finish current-main dead export cleanup
23 lines
683 B
TypeScript
23 lines
683 B
TypeScript
// Normalizes config.patch replacePaths shared by Gateway and agent preflight checks.
|
|
function normalizeConfigPatchReplacePath(value: string): string {
|
|
const trimmed = value.trim();
|
|
if (trimmed.endsWith("[]")) {
|
|
return trimmed.slice(0, -2).replace(/\[\d+\](?=\.)/g, "[]");
|
|
}
|
|
return trimmed.replace(/\[\d+\](?=\.)/g, "[]");
|
|
}
|
|
|
|
export function normalizeConfigPatchReplacePaths(
|
|
values: readonly unknown[] | undefined,
|
|
): Set<string> {
|
|
if (!values) {
|
|
return new Set();
|
|
}
|
|
return new Set(
|
|
values
|
|
.filter((value): value is string => typeof value === "string")
|
|
.map(normalizeConfigPatchReplacePath)
|
|
.filter((value) => value.length > 0),
|
|
);
|
|
}
|