import { useEffect, useRef, useState } from "react"; import { ThreadShell } from "@/components/thread/ThreadShell"; import { settings } from "@/dev/gallery/settings"; import { NanobotClient } from "@/lib/nanobot-client"; import type { ChatSummary, ConnectionStatus } from "@/lib/types"; import { ClientProvider } from "@/providers/ClientProvider"; const sessions: ChatSummary[] = ["a", "b"].map((suffix) => ({ key: `websocket:nan311-${suffix}`, channel: "websocket", chatId: `nan311-${suffix}`, createdAt: null, updatedAt: null, preview: "", })); // Synthetic backend-boundary reproduction, not an original user recording. export function HistoryHydrationFixture() { const [client] = useState(() => new NanobotClient({ url: `${location.protocol === "https:" ? "wss:" : "ws:"}//${location.host}/nan311-fixture-ws`, reconnect: false, })); const [status, setStatus] = useState("idle"); const [session, setSession] = useState(sessions[0]!); const receiptRef = useRef(null); useEffect(() => { // Observers provide a wire-delivery barrier even when painting is paused. // They never consume transcript replay, project events, or supply body rows. const observers = sessions.map(({ chatId }) => client.onChat(chatId, (event) => { if (!receiptRef.current) return; const sequence = "turn_seq" in event ? event.turn_seq ?? "-" : "-"; const turn = "turn_id" in event ? event.turn_id ?? "-" : "-"; receiptRef.current.textContent = `${chatId}/${turn}/${event.event}/${sequence}`; })); const unsubscribe = client.onStatus(setStatus); client.connect(); return () => { observers.forEach((dispose) => dispose()); unsubscribe(); client.close(); }; }, [client]); return

Synthetic NAN-311 history hydration fixture — not a user recording.

{status} {session.chatId} Awaiting frame
{status === "open" && {}} settingsSnapshot={settings} />}
; }