{/* Actions and the time sit beside the author on hover: the reply under it has the turn's duration. */}
-
- void copyText(text)} />
- {inPlace && entry.text && (
- setEditing(true)} />
- )}
- {inPlace && (
-
- )}
- {!archived && entry.text && entry.attachments.length === 0 && (
-
- void (
- inPlace
- ? rerunFrom(task.id, turn, entry.text, images, {
- title: "Run Again From Here",
- later: turn < turnCount - 1,
- })
- : resendMessage(task.id, entry.text)
- ).catch(fail)
- }
- />
- )}
- {canFork && (
- void forkTask(task.id, turn + 1).catch(failed("Couldn't fork the task"))}
- />
- )}
-
+ {!(editing && turn !== null) && (
+
+ void copyText(text)} />
+ {inPlace && entry.text && }
+ {inPlace && (
+
+ )}
+ {!archived && entry.text && entry.attachments.length === 0 && (
+
+ void (
+ inPlace
+ ? rerunFrom(task.id, turn, entry.text, images, {
+ title: "Run Again From Here",
+ later: turn < turnCount - 1,
+ })
+ : resendMessage(task.id, entry.text)
+ ).catch(fail)
+ }
+ />
+ )}
+ {canFork && (
+ void forkTask(task.id, turn + 1).catch(failed("Couldn't fork the task"))}
+ />
+ )}
+
+ )}
You
-
-
-
- {files.length > 0 && (
-
- {files.map((a, i) => (
- // oxlint-disable-next-line react/no-array-index-key -- attachments from different directories can share a basename
-
-
- {a}
-
- ))}
-
- )}
-
+ {editing && turn !== null ? (
+
setEditing(false)}
+ onSend={async (nextText, nextImages) => {
+ if (await rerunFrom(task.id, turn, nextText, nextImages)) setEditing(false);
+ }}
+ />
+ ) : (
+
+
+
+ {files.length > 0 && (
+
+ {files.map((a, i) => (
+ // oxlint-disable-next-line react/no-array-index-key -- attachments from different directories can share a basename
+
+
+ {a}
+
+ ))}
+
+ )}
+
+ )}
);
}
@@ -406,12 +414,15 @@ function UserMessage({
function MessageEditor({
initial,
initialImages,
+ initialWidth,
later,
onCancel,
onSend,
}: {
initial: string;
initialImages: AgentImage[];
+ /** Measured width of the bubble being replaced, so editing starts in place without jumping. */
+ initialWidth: number | null;
/** Turns follow it (they are dropped on send). */
later: boolean;
onCancel: () => void;
@@ -423,6 +434,25 @@ function MessageEditor({
const [sending, setSending] = useState(false);
const [error, setError] = useState