Skip to content

feat(miner-ui): useStreamingText hook + StreamingText renderer - #6579

Closed
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:feat-miner-ui-streaming-text-6516-v2
Closed

feat(miner-ui): useStreamingText hook + StreamingText renderer#6579
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:feat-miner-ui-streaming-text-6516-v2

Conversation

@jaytbarimbao-collab

Copy link
Copy Markdown
Contributor

Summary

The first streaming-text primitive for the miner-ui chat rail (#6516): progressively reveal a chat response's text as chunks arrive. Unwired plumbing only — no backend, no route, no live fetch/EventSource; exercised solely against mock chunk sources in tests.

Deliverables

  • lib/use-streaming-text.tsuseStreamingText(source) consumes a ChunkSource (a () => AsyncIterable<string> factory, exported by name), accumulating each chunk into text with an idle | streaming | done | error | cancelled status and a cancel(). Mirrors usePolledFetch's cancelled-flag discipline: a chunk resolving after a new source starts, after cancel(), or after unmount never touches state; a mid-stream throw/reject surfaces via status/error, never as an unhandled rejection.
  • components/streaming-text.tsx — thin <StreamingText> renderer showing the accumulated text with a caret while streaming, suppressed under prefers-reduced-motion (via window.matchMedia + a change listener — the use-mobile.tsx technique; no motion dependency).
  • use-streaming-text.test.ts + streaming-text.test.tsx — co-located flat in src/, mirroring use-polled-fetch.test.ts.

Tests (every branch)

Incremental accumulation; cancel-on-new-source; cancel-on-unmount (no late write); mid-stream error → status: error; renderer full-motion caret vs reduced-motion suppression. apps/** is Codecov-ignored, so the operative gate is the local vitest coverage threshold (85/85/75/85) — this suite lands at 88/86/81/90. Local @loopover/ui-miner typecheck + 192 tests + full npm run ui:lint (0 errors) all green.

Resubmit of #6573, which an automated pass closed on a CI-only "UI lint" step failure that does not reproduce locally (the full npm run ui:lint exits 0 here; both UI workspaces report 0 errors) — rebased on latest main.

Closes #6516

The first streaming-text primitive for the miner-ui chat rail (JSONbored#6516):
progressively reveal a chat response's text as chunks arrive, instead of
popping the whole message in at once. Unwired plumbing only — no backend,
no route, exercised solely against mock chunk sources in tests.

- lib/use-streaming-text.ts — useStreamingText(source): consumes a
  ChunkSource (a () => AsyncIterable<string> factory, exported by name),
  accumulating each chunk into text with an idle/streaming/done/error/
  cancelled status and a cancel(). Mirrors usePolledFetch's cancelled-flag
  discipline: a chunk resolving after a new source starts, after cancel(),
  or after unmount never touches state; a mid-stream throw/reject surfaces
  via status/error, never as an unhandled rejection.
- components/streaming-text.tsx — thin <StreamingText> renderer showing the
  accumulated text with a caret while streaming, suppressed under
  prefers-reduced-motion (detected via window.matchMedia + a change listener,
  the use-mobile.tsx technique — no motion dependency added).

Tests (co-located flat in src/, mirroring use-polled-fetch.test.ts) cover
every status transition — incremental accumulation, cancel-on-new-source,
cancel-on-unmount (no late write), and the error path — plus the renderer's
full-motion caret vs reduced-motion suppression. Local @loopover/ui-miner
gate green: typecheck + 192 tests (coverage 88/86/81/90, above the 85/85/75/85
threshold) + eslint (0 errors).

Closes JSONbored#6516
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing CI.

@JSONbored JSONbored closed this Jul 16, 2026
@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat UI: streaming text renderer / useStreamingText hook

2 participants