From 7d04253791e2212dd4df8291a68f01f026262f94 Mon Sep 17 00:00:00 2001 From: Jiang Bohan Date: Fri, 30 Jan 2026 21:54:55 +0800 Subject: [PATCH] fix(tools): replace replaceAll with replace for ES2020 compatibility Use regex replace instead of replaceAll to support older target versions. Co-Authored-By: Claude Opus 4.5 --- src/agent/tools/policy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agent/tools/policy.ts b/src/agent/tools/policy.ts index 91a1ec08d4..765cdd075d 100644 --- a/src/agent/tools/policy.ts +++ b/src/agent/tools/policy.ts @@ -60,7 +60,7 @@ function compilePattern(pattern: string): CompiledPattern { const escaped = normalized.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); return { kind: "regex", - value: new RegExp(`^${escaped.replaceAll("\\*", ".*")}$`), + value: new RegExp(`^${escaped.replace(/\\\*/g, ".*")}$`), }; }