Skip to content

Add stream package for console event timeline and system publishers#573

Merged
asim merged 2 commits into
mainfrom
claude/add-wallet-transfers-74PHC
Apr 23, 2026
Merged

Add stream package for console event timeline and system publishers#573
asim merged 2 commits into
mainfrom
claude/add-wallet-transfers-74PHC

Conversation

@asim
Copy link
Copy Markdown
Member

@asim asim commented Apr 23, 2026

No description provided.

claude added 2 commits April 22, 2026 15:58
New package mu/stream: a typed, append-only event log that powers the
home console. Every building block publishes to it. Users interact
with it. The agent responds in it. Separate from status (profile
feature) and social (threaded forum).

Data model:
- Event{ID, Type, AuthorID, Author, Content, Metadata, CreatedAt}
- Types: user, agent, system, market, news, reminder
- Stored in stream.json, capped at 500, newest first
- DedupeAdjacent collapses consecutive same-user same-text entries

Publishing API:
- stream.Publish(e) — generic
- stream.PostUser(id, content) — human console input
- stream.PostAgent(content) — @micro responses
- stream.PostSystem(content, meta) — system notifications
- stream.Recent(max, viewerID) — filtered by ban status
- stream.Since(t) / stream.CountSince(t) — for polling
- stream.Clear() / stream.ClearByAuthor(id) — admin

HTTP:
- GET /stream — HTML console page or JSON (?format=json&since=ts)
- POST /stream — post a message (middleware gates auth + credits)
- GET /stream/fragment — HTML fragment for polling

Console UI:
- Compose box with @micro hint
- Three visual treatments: user (avatar+name), agent (green M),
  system/market/news/reminder (icon + compact one-liner)
- 10s polling via /stream/fragment, scroll-preserving
- Form submits via fetch with CSRF, clears on success

Wiring:
- stream.AIReplyHook wired in main.go → agent.Query → PostAgent
- POST /stream in chargedWriteOp → 1 credit (OpSocialPost)
- /updates endpoint includes stream count
- MCP tools: stream (read) and stream_post (write, 1 credit)

Next: wire system publishers (reminder, markets, headlines) and
add Console/Cards toggle to the home page.

https://claude.ai/code/session_01GRGLA9yj7BpqKiyi6xFwnm
System events now publish into the stream automatically:

Reminder: when the daily reminder updates, the verse text is posted
as a TypeReminder event. Appears in the console with 🕌 icon.

Markets: when BTC, ETH, SOL, GOLD, or OIL moves >2% between
refreshes, a TypeMarket event is posted with the ticker, price,
and percentage change. e.g. "BTC +3.2% ($68,500)"

News: when SurfaceBreaking detects a story covered by 2+ sources,
the headline is posted as a TypeNews event with the URL.

Home page Console/Cards toggle:
The home screen now has two views toggled by Console | Cards tabs
at the top. Choice persists in localStorage.

Console (default): full-height stream with compose box. Shows user
messages, @micro agent responses, and system events (reminders,
markets, news) in one chronological timeline. Polling updates every
10 seconds. Form submits via fetch. This is the command-and-control
surface.

Cards: the existing dashboard layout with weather, blog, markets,
news, social, video, reminder cards. Same as before for people who
want the overview-at-a-glance.

The old status card is still in the cards view but the console is
now the primary interaction surface — mobile users see the stream
first, which is what they naturally interact with.

https://claude.ai/code/session_01GRGLA9yj7BpqKiyi6xFwnm
@asim asim merged commit 5cde3fe into main Apr 23, 2026
2 checks passed
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.

2 participants