fix(agents): handle exact smart-quoted args · openclaw/openclaw@d560588
ferminquant
·
2026-05-29
·
via Recent Commits to openclaw:main
File tree
src/agents/embedded-agent-runner/run
| Original file line number | Diff line number | Diff line change |
|---|
@@ -303,6 +303,15 @@ const re = /\d+/;
|
303 | 303 | expectAllToolCallArgs(result, { command: "pwd", workdir: "/tmp" }); |
304 | 304 | }); |
305 | 305 | |
| 306 | +it("repairs an exact smart-quoted argument object without preamble or trailing junk", async () => { |
| 307 | +const result = await runToolCallRepairCase({ |
| 308 | +toolName: "read", |
| 309 | +delta: "{“path”:“safe.txt”}", |
| 310 | +}); |
| 311 | + |
| 312 | +expectAllToolCallArgs(result, { path: "safe.txt" }); |
| 313 | +}); |
| 314 | + |
306 | 315 | it("keeps duplicate-looking smart-quoted args inside content", async () => { |
307 | 316 | const result = await runToolCallRepairCase({ |
308 | 317 | delta: String.raw` {“path”:“safe.txt”,“content”:“text ”, “path”: “other.txt””}`, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -422,7 +422,6 @@ function tryExtractSmartQuotedToolCallArguments(raw: string): ToolCallArgumentRe
|
422 | 422 | } |
423 | 423 | const suffix = raw.slice(parsed.endIndex).trim(); |
424 | 424 | if ( |
425 | | -(leadingPrefix.length === 0 && suffix.length === 0) || |
426 | 425 | suffix.length > MAX_TOOLCALL_REPAIR_TRAILING_CHARS || |
427 | 426 | (suffix.length > 0 && !TOOLCALL_REPAIR_ALLOWED_TRAILING_RE.test(suffix)) |
428 | 427 | ) { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。