[claude] Add real-time cost ticker for Workshop interactions (#68) #82

Merged
Rockachopa merged 1 commits from claude/issue-68 into main 2026-03-23 20:01:27 +00:00
Collaborator

Fixes #68

Summary

  • Adds a live ⚡ ~N sats cost ticker in the top-right HUD during active paid interactions
  • Backend emits cost:update events via the EventBus at two points: when the work invoice is issued (estimated) and when work completes (actual final cost)
  • Sessions route also emits cost:update after each session request with the charged sats
  • Frontend WebSocket handler drives the ticker: shows on isFinal=false, updates and auto-hides after 5s on isFinal=true
  • Free-tier (0-sat) jobs do not trigger the ticker

Files changed

  • artifacts/api-server/src/lib/event-bus.ts — new CostEvent type added to BusEvent union
  • artifacts/api-server/src/routes/events.tscost:updatecost_update WS translation
  • artifacts/api-server/src/routes/jobs.ts — publish estimated and actual cost events for paid jobs
  • artifacts/api-server/src/routes/sessions.ts — publish cost event after each charged session request
  • the-matrix/js/ui.jsshowCostTicker, updateCostTicker, hideCostTicker exports
  • the-matrix/js/websocket.js — handle cost_update messages
Fixes #68 ## Summary - Adds a live `⚡ ~N sats` cost ticker in the top-right HUD during active paid interactions - Backend emits `cost:update` events via the EventBus at two points: when the work invoice is issued (estimated) and when work completes (actual final cost) - Sessions route also emits `cost:update` after each session request with the charged sats - Frontend WebSocket handler drives the ticker: shows on `isFinal=false`, updates and auto-hides after 5s on `isFinal=true` - Free-tier (0-sat) jobs do not trigger the ticker ## Files changed - `artifacts/api-server/src/lib/event-bus.ts` — new `CostEvent` type added to `BusEvent` union - `artifacts/api-server/src/routes/events.ts` — `cost:update` → `cost_update` WS translation - `artifacts/api-server/src/routes/jobs.ts` — publish estimated and actual cost events for paid jobs - `artifacts/api-server/src/routes/sessions.ts` — publish cost event after each charged session request - `the-matrix/js/ui.js` — `showCostTicker`, `updateCostTicker`, `hideCostTicker` exports - `the-matrix/js/websocket.js` — handle `cost_update` messages
claude added 1 commit 2026-03-23 19:57:52 +00:00
feat: add real-time cost ticker for Workshop interactions
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
15fec51bb7
Adds a live cost ticker ( ~N sats) visible in the top-right HUD
during active paid interactions. The ticker appears when a work
invoice is issued with the estimated cost, updates to the final
charged amount when the job completes, and auto-hides after 5s.

Changes:
- event-bus.ts: add CostEvent type { cost:update, jobId, sats, phase, isFinal }
- events.ts: translate cost:update bus events → cost_update WS messages
- jobs.ts: emit cost:update with estimated sats on invoice creation,
  and again with actual sats when work completes (paid jobs only)
- sessions.ts: emit cost:update with debitedSats after each session request
- ui.js: add showCostTicker/updateCostTicker/hideCostTicker (fixed-position HUD badge)
- websocket.js: handle cost_update messages, drive the cost ticker

Fixes #68

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rockachopa merged commit 821aa48543 into main 2026-03-23 20:01:27 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#82