Skip to content
Back to skills

Nyxs Live Messages

ASecurity

How a streaming reply is kept and shown in Nyxs (live copies vs. the chat state). Use whenever changing src/lib/liveMessages.ts, src/lib/useChatStore.ts's commit of live replies, how a reply's streaming flag ends, or when a finished reply still shows "Working…" or an old version of itself.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 6, 2026
ai-agentsgoreact

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add nyxs-code/nyxs-code --skill nyxs-live-messages --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nyxs Live Messages?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nyxs Live Messages
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nyxs-code-nyxs-live-messages/badge)](https://www.skillsdirectory.com/skills/nyxs-code-nyxs-live-messages)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nyxs-live-messages
description: How a streaming reply is kept and shown in Nyxs (live copies vs. the chat state). Use whenever changing src/lib/liveMessages.ts, src/lib/useChatStore.ts's commit of live replies, how a reply's streaming flag ends, or when a finished reply still shows "Working…" or an old version of itself.
---

# Live replies

While a reply streams, its ticks don't go through React state: they land in a per-message live
copy (`setLiveMessage` in `src/lib/liveMessages.ts`), and only that row re-renders
(`useLiveMessage`). The chat state gets the live copies folded in (`withLiveMessages`) every
`LIVE_COMMIT_MS` (1000 ms, `src/lib/useChatStore.ts`) and at once when anything else changes or
the reply stops streaming; then `clearLiveMessages` drops them.

## The rule that broke once

**A live copy never wins over a finished reply.**

- `withLiveMessages`: a message in the state that is no longer `streaming` keeps the state's
  version (`if (!lm || lm === m || !m.streaming) return m`).
- `useLiveMessage`: a finished message in the state is shown as is, even if a live copy is still
  around (`current && message.streaming ? current : message`).

In v0.8.66 the turn's end and another state update landed together: the snapshot taken for the
update still held the old live copy with `streaming: true`, folded it over the finished reply,
and the chat stayed on "Working…" after the agent had finished. v0.8.67 fixed it with the two
checks above.

## When changing this

- Keep live copies keyed by chat and message (`keyOf`), and only for replies that stream.
- A snapshot (`snapshotLiveMessages`) is taken when an update is asked for: any code that folds
  it must check the state's `streaming` flag first.
- Tests: `src/lib/__tests__/liveMessages.test.tsx` ("stays finished when another change is asked
  for in the same moment as the end", "never shows a leftover live copy over a finished
  reply"). Add a case for any new path, and check it fails without the fix.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.