fix(agents): show exec target node in tool display · openclaw/openclaw@64533ba
JiataiWang
·
2026-05-31
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -441,4 +441,60 @@ describe("tool display details", () => {
|
441 | 441 | expect(nodeCheckDetail).toContain("check js syntax for /tmp/test.js"); |
442 | 442 | expect(nodeShortCheckDetail).toContain("check js syntax for /tmp/test.js"); |
443 | 443 | }); |
| 444 | + |
| 445 | +it("appends node name to exec detail when node is set", () => { |
| 446 | +const detail = formatToolDetail( |
| 447 | +resolveToolDisplay({ |
| 448 | +name: "exec", |
| 449 | +args: { |
| 450 | +command: "docker pull pihole/pihole:latest", |
| 451 | +host: "node", |
| 452 | +node: "raspberrypi", |
| 453 | +}, |
| 454 | +}), |
| 455 | +); |
| 456 | + |
| 457 | +expect(detail).toContain("node: raspberrypi"); |
| 458 | +}); |
| 459 | + |
| 460 | +it("includes both cwd and node name in exec detail for known commands", () => { |
| 461 | +const detail = formatToolDetail( |
| 462 | +resolveToolDisplay({ |
| 463 | +name: "exec", |
| 464 | +args: { |
| 465 | +command: "npm install", |
| 466 | +workdir: "/app", |
| 467 | +host: "node", |
| 468 | +node: "raspberrypi", |
| 469 | +}, |
| 470 | +}), |
| 471 | +); |
| 472 | + |
| 473 | +expect(detail).toContain("(in /app)"); |
| 474 | +expect(detail).toContain("node: raspberrypi"); |
| 475 | +}); |
| 476 | + |
| 477 | +it("omits node label when node param is absent or empty", () => { |
| 478 | +const detail = formatToolDetail( |
| 479 | +resolveToolDisplay({ |
| 480 | +name: "exec", |
| 481 | +args: { command: "npm install", host: "gateway" }, |
| 482 | +}), |
| 483 | +); |
| 484 | + |
| 485 | +expect(detail).not.toContain("node:"); |
| 486 | +}); |
| 487 | + |
| 488 | +it("omits node label when host is not 'node' even if node is set", () => { |
| 489 | +for (const host of ["gateway", "sandbox", "auto"]) { |
| 490 | +const detail = formatToolDetail( |
| 491 | +resolveToolDisplay({ |
| 492 | +name: "exec", |
| 493 | +args: { command: "npm install", host, node: "raspberrypi" }, |
| 494 | +}), |
| 495 | +); |
| 496 | + |
| 497 | +expect(detail).not.toContain("node:"); |
| 498 | +} |
| 499 | +}); |
444 | 500 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。