Skip to content

Foreground in-app toasts on new live messages (N.3)#20

Merged
andrew-jon-p7a merged 1 commit intomainfrom
feature/foreground-notifications
Apr 24, 2026
Merged

Foreground in-app toasts on new live messages (N.3)#20
andrew-jon-p7a merged 1 commit intomainfrom
feature/foreground-notifications

Conversation

@andrew-jon-p7a
Copy link
Copy Markdown
Contributor

@andrew-jon-p7a andrew-jon-p7a commented Apr 24, 2026

Summary

  • New `lib/notify.ts` + `notifyNewMessage` in `@agentc7/web-shell`: when a live WS frame arrives for a thread the viewer isn't currently reading, fire `toast.info` with a click-through that deep-links to the thread (primary, DM, or objective-detail).
  • Skips the sender's own messages and non-visible tabs (push path handles the latter).
  • Tagged by `msg:` so rapid-fire bursts in one thread collapse to one rolling toast.
  • Backfill / history loads stay silent — only live WS frames trigger.
  • Exports `toasts` signal from the public API so SaaS / other consumers can read queue state.

Test plan

  • `pnpm --filter @agentc7/web-shell test` — 149 tests pass (12 new `notify.test.ts`)
  • `pnpm --filter @agentc7/web-shell typecheck` / `@agentc7/web` typecheck
  • `pnpm lint` clean (biome)
  • Manual: send a DM from a second account, confirm toast fires on the first account's overview view; click through lands in the DM thread

🤖 Generated with Claude Code

When a live WebSocket message arrives and:
  - the sender isn't the viewer,
  - the tab is visible, and
  - the viewer isn't already reading that thread,
fire toast.info with a click-through to the thread. Tagged by
msg:<threadKey> so bursts in the same thread collapse to one
rolling toast.

Objective-thread messages deep-link to the objective detail view;
DMs deep-link to the DM thread; the shared channel deep-links to
primary. Backfill paths (history fetch on (re)connect) stay silent
— only the live WS frame handler calls notifyNewMessage.

Also exports `toasts` signal from the public API so hosts (SaaS
platform) can read queue state for their own tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@andrew-jon-p7a andrew-jon-p7a merged commit a337c8d into main Apr 24, 2026
1 check passed
@andrew-jon-p7a andrew-jon-p7a deleted the feature/foreground-notifications branch April 29, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant