placeholder is content-gated: survives agent_start, releases at first visible content, sticky per turn

This commit is contained in:
amosblomqvist
2026-10-02 02:42:25 +03:00
parent 0f99a92fd3
commit e5b06f7fbd
4 changed files with 128 additions and 17 deletions
+14 -14
View File
@@ -186,7 +186,7 @@ export function Chat({
// (core/view.ts projectView); sends are ONE explicit input event each
// ({chatId, input} — the stash indirection died with the SDK), and the
// turn stream is the VERBATIM AgentEvent passthrough the server emits.
const { messages, nativeMessages, send, submitAnswer, setMessages, adoptRecord, status, error, stop, clearError, resumeStream, setReattachSettled } =
const { messages, nativeMessages, send, submitAnswer, setMessages, adoptRecord, status, error, awaitingFirstChunk, stop, clearError, resumeStream, setReattachSettled } =
useChatSession({ chatId, initialMessages, initiallyInFlight });
// The reattach settled terminal → the sync-and-continue seam (below).
@@ -1177,19 +1177,19 @@ export function Chat({
</Fragment>
))}
{/* THE pre-first-chunk placeholder, ONE grammar everywhere
(owner, optimistic round 2026-10-02): spinner + shimmered
Thinking… from the instant anything is submitted (send,
answer, reattach — status flips synchronously, so it shows
before the first token, however slow the provider's
connection) until the first event lands, then it hands off
to the live stream — minimal change: the collapsible
reasoning row carries the SAME look, now with content.
Never collapsible itself (there is nothing to show yet).
Once a tool call starts writing, its LIVE card carries the
activity inline (the bottom tool-activity line retired,
streaming round 2026-10-01). */}
{(status === "submitted" || turnInFlight) && (
{/* THE pre-first-CONTENT placeholder, ONE grammar everywhere
(owner, optimistic round 2, 2026-10-02): spinner +
shimmered Thinking… from the instant of any action that
produces tokens (send, answer, session start, reattach,
wake) — status flips synchronously — and it stays past
agent_start (protocol events release nothing; the old
status gate vanished the line into an empty wait) until
the turn's first VISIBLE content: a reasoning/text delta
or a tool call being written, where the stream takes over
with the SAME look (the collapsible reasoning row / live
tool card). The release is sticky — no flash between
assistant steps. Never collapsible itself. */}
{(awaitingFirstChunk || turnInFlight) && (
<span className="flex items-center gap-2">
<BrailleSpinner label="Thinking" />
<Shimmer duration={1} className="text-sm">