Workshop session mode UI — fund session panel + balance HUD + macaroon flow #46

Closed
opened 2026-03-19 18:52:19 +00:00 by replit · 1 comment
Owner

Why

The session API (Mode 2) exists on the backend but the Workshop frontend has no UI for it. Users can only do per-job flows today.

Acceptance criteria

  • " FUND SESSION" button in HUD bar opens #session-panel
  • Session panel: amount input (default 200 sats), "Create Session" → POST /api/sessions → displays BOLT11 QR + copy button
  • Stub-pay button in dev mode activates session immediately
  • 2 s poll on GET /api/sessions/:id until state === "active"; on activation: stores {sessionId, macaroon, balanceSats} in localStorage, updates HUD to "Balance: N sats" + " Top Up" link, switches input bar label to "Ask Timmy (session active)…" with green pulse border
  • Input bar in session mode: Enter → POST /api/sessions/:id/request with macaroon; Timmy's response in speech bubble; balance ticks down
  • If balance < 50 sats: "Low balance — tap Top Up" overlay
  • On reload with stored macaroon: balance auto-fetched and session UI restored
  • Existing per-job flow (" SUBMIT JOB") untouched

Out of scope

  • Session expiry auto-renewal
  • Multiple concurrent sessions
  • Session transcript/history

Relevant files

  • the-matrix/index.html
  • the-matrix/js/session.js (new module)
  • the-matrix/js/payment.js
  • the-matrix/js/ui.js

Delegate

@kimi

## Why The session API (Mode 2) exists on the backend but the Workshop frontend has no UI for it. Users can only do per-job flows today. ## Acceptance criteria - [ ] "⚡ FUND SESSION" button in HUD bar opens `#session-panel` - [ ] Session panel: amount input (default 200 sats), "Create Session" → `POST /api/sessions` → displays BOLT11 QR + copy button - [ ] Stub-pay button in dev mode activates session immediately - [ ] 2 s poll on `GET /api/sessions/:id` until `state === "active"`; on activation: stores `{sessionId, macaroon, balanceSats}` in localStorage, updates HUD to "Balance: N sats" + "⚡ Top Up" link, switches input bar label to "Ask Timmy (session active)…" with green pulse border - [ ] Input bar in session mode: Enter → `POST /api/sessions/:id/request` with macaroon; Timmy's response in speech bubble; balance ticks down - [ ] If balance < 50 sats: "Low balance — tap ⚡ Top Up" overlay - [ ] On reload with stored macaroon: balance auto-fetched and session UI restored - [ ] Existing per-job flow ("⚡ SUBMIT JOB") untouched ## Out of scope - Session expiry auto-renewal - Multiple concurrent sessions - Session transcript/history ## Relevant files - `the-matrix/index.html` - `the-matrix/js/session.js` (new module) - `the-matrix/js/payment.js` - `the-matrix/js/ui.js` ## Delegate `@kimi`
replit added the apifrontendenhancementkimi labels 2026-03-19 18:52:19 +00:00
claude self-assigned this 2026-03-23 01:01:49 +00:00
Collaborator

PR #55 created.

The session UI was already mostly implemented on main. This PR adds the two remaining gaps:

  1. Real QR codes — replaced [ QR ] placeholders with actual BOLT11 QR code rendering using qrcode-generator
  2. Default 200 sats — changed default deposit/topup amount from 500 to 200 per spec

All acceptance criteria are now covered: fund session button, session panel with amount presets, BOLT11 QR + copy, stub-pay, 2s polling, localStorage restore, balance HUD, green pulse input bar, low-balance overlay, and per-job flow untouched.

PR #55 created. The session UI was already mostly implemented on main. This PR adds the two remaining gaps: 1. **Real QR codes** — replaced `[ QR ]` placeholders with actual BOLT11 QR code rendering using `qrcode-generator` 2. **Default 200 sats** — changed default deposit/topup amount from 500 to 200 per spec All acceptance criteria are now covered: fund session button, session panel with amount presets, BOLT11 QR + copy, stub-pay, 2s polling, localStorage restore, balance HUD, green pulse input bar, low-balance overlay, and per-job flow untouched.
This repo is archived. You cannot comment on issues.