From 9c5bbba6eab4466621028e3cf3467119051423fb Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Fri, 20 Feb 2026 09:13:13 -0600 Subject: [PATCH] fix(app): patch tool renders like edit tool --- packages/ui/src/components/message-part.tsx | 231 ++++++++++++-------- 1 file changed, 142 insertions(+), 89 deletions(-) diff --git a/packages/ui/src/components/message-part.tsx b/packages/ui/src/components/message-part.tsx index f3a60b09e..6421985e0 100644 --- a/packages/ui/src/components/message-part.tsx +++ b/packages/ui/src/components/message-part.tsx @@ -1603,6 +1603,12 @@ ToolRegistry.register({ const i18n = useI18n() const diffComponent = useDiffComponent() const files = createMemo(() => (props.metadata.files ?? []) as ApplyPatchFile[]) + const pending = createMemo(() => props.status === "pending" || props.status === "running") + const single = createMemo(() => { + const list = files() + if (list.length !== 1) return + return list[0] + }) const [expanded, setExpanded] = createSignal([]) let seeded = false @@ -1621,100 +1627,147 @@ ToolRegistry.register({ }) return ( -
- - 0}> - setExpanded(Array.isArray(value) ? value : value ? [value] : [])} + + - - {(file) => { - const active = createMemo(() => expanded().includes(file.filePath)) - const [visible, setVisible] = createSignal(false) + 0}> + setExpanded(Array.isArray(value) ? value : value ? [value] : [])} + > + + {(file) => { + const active = createMemo(() => expanded().includes(file.filePath)) + const [visible, setVisible] = createSignal(false) - createEffect(() => { - if (!active()) { - setVisible(false) - return - } + createEffect(() => { + if (!active()) { + setVisible(false) + return + } - requestAnimationFrame(() => { - if (!active()) return - setVisible(true) - }) - }) + requestAnimationFrame(() => { + if (!active()) return + setVisible(true) + }) + }) - return ( - - - -
-
- -
- - {`\u202A${getDirectory(file.relativePath)}\u202C`} - - {getFilename(file.relativePath)} + return ( + + + +
+
+ +
+ + {`\u202A${getDirectory(file.relativePath)}\u202C`} + + {getFilename(file.relativePath)} +
+
+
+ + + + {i18n.t("ui.patch.action.created")} + + + + + {i18n.t("ui.patch.action.deleted")} + + + + + {i18n.t("ui.patch.action.moved")} + + + + + + + +
-
-
- - - - {i18n.t("ui.patch.action.created")} - - - - - {i18n.t("ui.patch.action.deleted")} - - - - - {i18n.t("ui.patch.action.moved")} - - - - - - - -
-
- - - - -
- -
-
-
- - ) - }} - - - - -
+
+
+ + +
+ +
+
+
+
+ ) + }} +
+
+
+
+
+ } + > + {(file) => ( + +
+
+ + + + + + + {getFilename(file().relativePath)} + +
+ +
+ {getDirectory(file().relativePath)} +
+
+
+
+ + + +
+ + } + > +
+ +
+
+ )} + ) }, })