Skip to content

feat: in-memory event bus + reusable Spinner component (A2.1+A2.2) #100 - #101

Merged
four-bytes-robby merged 1 commit into
mainfrom
feat/100-event-bus-spinner
Jun 8, 2026
Merged

four-bytes-robby merged 1 commit into
mainfrom
feat/100-event-bus-spinner

Conversation

@four-bytes-robby

@four-bytes-robby four-bytes-robby commented Jun 8, 2026 •

Copy link
Copy Markdown
Member

Closes #100

Changes

A2.1 — In-memory event bus

  • New src/event-bus.ts — typed BrainEventBus with replay-on-subscribe
  • status.ts publishes via brainBus.emit('status', ...) instead of writeFileSync()
  • tui.tsx subscribes via brainBus.on('status', handler) instead of setInterval(poll, 200ms)
  • Removed all file I/O from status→TUI path (no more status JSON files on disk)
  • Removed getBrainStatusFile() — now dead code

A2.2 — Reusable Spinner component

  • New src/spinner.tsx — SolidJS <Spinner> with braille animation, configurable interval + color
  • tui.tsx uses <Spinner fg={fg()} /> instead of inline SPINNER array + manual spin++

Files changed: 7 (2 new, 5 modified, 0 deleted)

src/event-bus.ts    (+39 new)
src/spinner.tsx     (+21 new)
src/status.ts       (-9)
src/tui.tsx         (-14)
src/four-opencode-brain.ts (-1)
src/shared.ts       (-19)
ROADMAP.md          (9 A2.1+A2.2 checkboxes checked off)

Verification

  • bun run build ✅

Summary by cubic

Replaced file-based status polling with an in-memory event bus and added a reusable SolidJS <Spinner>. This removes disk I/O, delivers real-time TUI updates, and completes A2.1 + A2.2 acceptance criteria.

  • New Features

    • Added src/event-bus.ts with a typed brainBus that replays the latest event on subscribe.
    • Added src/spinner.tsx <Spinner> using braille frames with configurable interval and color (@opentui/solid, @opentui/core).
  • Refactors

    • src/status.ts now publishes via brainBus.emit('status', ...); removed status file writes.
    • src/tui.tsx subscribes with brainBus.on('status', ...); removed polling loop and inline spinner.
    • Removed getBrainStatusFile and related file I/O from src/shared.ts; updated initStatus(client) in src/four-opencode-brain.ts.
    • Uses @four-bytes/opencode-plugin-lib and @opencode-ai/plugin types as before; TUI colors sourced from theme.

Written for commit 98408f6. Summary will update on new commits.

Review in cubic

@four-bytes-robby four-bytes-robby self-assigned this Jun 8, 2026
@four-bytes-robby
four-bytes-robby merged commit aae5bf8 into main Jun 8, 2026
4 checks passed
@four-bytes-robby
four-bytes-robby deleted the feat/100-event-bus-spinner branch June 8, 2026 10:38
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.

A2.1+A2.2: In-memory event bus + reusable Spinner component

1 participant