(p: ToolProps<typeof ApplyPatchTool>)
| 532 | } |
| 533 | |
| 534 | function snapPatch(p: ToolProps<typeof ApplyPatchTool>): ToolSnapshot | undefined { |
| 535 | const files = list<PatchFile>(p.frame.meta.files) |
| 536 | if (files.length === 0) { |
| 537 | return undefined |
| 538 | } |
| 539 | |
| 540 | const items = files.flatMap((file) => { |
| 541 | if (!file || typeof file !== "object") { |
| 542 | return [] |
| 543 | } |
| 544 | |
| 545 | const diff = typeof file.patch === "string" ? file.patch : "" |
| 546 | if (!diff.trim()) { |
| 547 | return [] |
| 548 | } |
| 549 | |
| 550 | const name = file.movePath || file.filePath || file.relativePath |
| 551 | return [ |
| 552 | { |
| 553 | title: patchTitle(file), |
| 554 | diff, |
| 555 | file: name, |
| 556 | deletions: typeof file.deletions === "number" ? file.deletions : 0, |
| 557 | }, |
| 558 | ] |
| 559 | }) |
| 560 | |
| 561 | if (items.length === 0) { |
| 562 | return undefined |
| 563 | } |
| 564 | |
| 565 | return { |
| 566 | kind: "diff", |
| 567 | items, |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | function snapTask(p: ToolProps<typeof TaskTool>): ToolSnapshot { |
| 572 | const kind = Locale.titlecase(p.input.subagent_type || "general") |
nothing calls this directly
no test coverage detected