Fix stale default-open doc comments per argus's review

ClassifyCtx's tool_use-id correlation gates markdown-vs-plain body
format for a recv result, not open/collapsed state — that's always
the operator's uniform preference now. 5 backend comments still
described it as controlling "default-open" rendering, contradicting
the actual render path and this PR's own rewritten docs.

Also fixed useAgentState.ts's stale comment promising an
SSE-triggered refresh model "in a later commit" — that's permanently
off the table now that the terminal stream's kind tag is gone by
design (argus flagged this as a drive-by, not blocking, but it's a
one-line cause-and-effect of this same PR so fixing it here).
This commit is contained in:
iris 2026-08-30 21:28:34 +02:00
commit 907567ef76
4 changed files with 32 additions and 29 deletions

View file

@ -1,16 +1,13 @@
// useAgentState — polls `GET /api/state` and exposes the latest
// snapshot + loading/error status. Mirrors app.js's old `refreshState`
// data fetch (not yet its exact re-poll cadence — see the interval
// comment below).
//
// Cadence note: the old page only re-polls on a timer while a login is
// in flight, and otherwise waits for an SSE `turn_end` event to trigger
// one-shot refreshes — this avoids clobbering the operator's half-typed
// message in the term-input field. That field doesn't exist in this
// rewrite yet (a later commit on this same PR), so there's nothing to
// clobber yet; this hook uses a flat interval for now and switches to
// the SSE-triggered model in the commit that adds TermInput + the live
// stream, matching the original behavior once it's actually needed.
// data fetch, not its exact re-poll cadence: the old page re-polled on a
// timer only while a login was in flight, and otherwise waited for an
// SSE `turn_end` event to trigger one-shot refreshes. That SSE-triggered
// model is permanently off the table now — the terminal stream's `kind`
// tag (what let a client single out a turn-boundary event) is gone by
// design, see `useLiveStream.ts`'s module doc — so this hook's flat 4s
// interval is the only refresh path, not a placeholder for a later
// commit.
import { useEffect, useRef, useState } from 'preact/hooks';
import type { AgentState } from '../types.js';