Commit Graph

85 Commits

Author SHA1 Message Date
Jeff Emmett eed7b2f151 feat: unified module system — Phase 0 shell + Phase 1 canvas module
Implement the rSpace module architecture that enables all r-suite apps
to run as modules within a single-origin platform at rspace.online,
while each module can still deploy standalone at its own domain.

Phase 0 — Shell + Module System:
- RSpaceModule interface (shared/module.ts) with routes, metadata, hooks
- Shell HTML renderer (server/shell.ts) for wrapping module content
- Three header web components: rstack-app-switcher, rstack-space-switcher,
  rstack-identity (refactored from rspace-header.ts into Shadow DOM)
- Space registry API (server/spaces.ts) — /api/spaces CRUD
- Hono-based server (server/index.ts) replacing raw Bun.serve fetch handler
  while preserving all WebSocket, API, and subdomain backward compat
- Shared PostgreSQL with per-module schema isolation (rbooks, rcart, etc.)
- Vite multi-entry build: shell.js + shell.css built alongside existing entries
- Module info API: GET /api/modules returns registered module metadata

Phase 1 — Canvas Module:
- modules/canvas/mod.ts exports canvasModule as first RSpaceModule
- Canvas routes mounted at /:space/canvas with shell wrapper
- Fallback serves existing canvas.html for backward compatibility
- /:space redirects to /:space/canvas

URL structure: rspace.online/{space}/{module} (e.g. /demo/canvas)
All existing subdomain routing (*.rspace.online) preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:54:15 +00:00
Jeff Emmett 7210888aed feat: unify EncryptID passkeys across all r*.online apps
Simplify resolveRpId() to always return 'rspace.online' so passkeys
registered from any r*.online domain share the same RP ID. Browsers
use .well-known/webauthn Related Origins to validate cross-domain
passkey usage. This makes one passkey work everywhere.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:38:26 +00:00
Jeff Emmett cac038ed0d chore: migrate SMTP from mx.jeffemmett.com to mail.rmail.online
Update EncryptID SMTP defaults to use rmail.online Mailcow instance.
From address now noreply@rspace.online instead of noreply@jeffemmett.com.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:14:58 +00:00
Jeff Emmett 2d0cf499f6 fix: mobile input focus, toolbar UX, and viewport clipping
- folk-shape: skip preventDefault on touch events targeting inputs/textareas
  so mobile keyboards can open inside shapes
- toolbar: replace unreadable emoji-only strip with FAB toggle (+) that
  opens a 3-column grid overlay with emoji + labels; auto-closes on tool
  select; separate always-visible zoom strip at bottom-left
- canvas: remove overflow:hidden from #canvas so viewport moves with
  pan/zoom instead of clipping at initial bounds
- canvas-content: add width/height 100% and overflow:visible for robust
  containing block

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:55:43 +00:00
Jeff Emmett 34a1e3b640 feat: mobile toolbar + infinite canvas pan/zoom
- Mobile toolbar: icon-only scrollable strip with horizontal swipe
- Infinite canvas: separate viewport (grid) from content layer (shapes)
- Single-finger pan via pointer events on empty canvas background
- Widen zoom range from 0.25-4x to 0.05-20x
- Fix Automerge sync fallback to full doc reconciliation when no patches

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 02:32:48 +00:00
Jeff Emmett 7fcef2c2b2 Fix JWT verify calls for Hono 4.11.10 — add required 'HS256' alg
Hono 4.11.10 made the `alg` parameter required in `verify()`. All 6
verify() calls were failing with "JWT verification requires alg option
to be specified", causing every token verification to return 401. This
broke space creation and all authenticated operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 02:07:51 +00:00
Jeff Emmett 9050298c6f Fix CORS for dynamic rspace.online subdomains in EncryptID
The allowedOrigins array only listed explicit subdomains (auth, cca, demo,
app, dev) so any canvas slug subdomain like create.rspace.online was
rejected by CORS. Switch to a function-based origin check that allows all
*.rspace.online subdomains dynamically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 01:55:42 +00:00
Jeff Emmett 7103366047 Dynamic RP ID: use caller's domain for WebAuthn passkeys
Instead of hardcoding rpId to "rspace.online" (which requires Related
Origins support), derive the RP ID from the request's Origin header.
Each r* app (rmaps.online, rnotes.online, etc.) now gets its own RP ID
matching its domain, so passkeys work natively without browser support
for Related Origin Requests.

- Added resolveRpId() helper that maps Origin → hostname for allowed origins
- Registration creates passkeys with the caller's domain as RP ID
- Authentication uses the caller's domain as RP ID
- Added rp_id column to credentials table for per-credential RP ID tracking
- rspace.online subdomains still use rspace.online as shared RP ID

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 01:46:15 +00:00
Jeff Emmett 048171131b feat: implement FUN model replacing CRUD across rSpace canvas
Forget (F): Soft-delete shapes — close button sets forgotten:true in
Automerge doc instead of removing. Memory panel (toolbar toggle) lets
users browse and Remember forgotten shapes. Server-side forgetShape()
and rememberShape() with WebSocket handlers.

Update (U): New public updateShape(id, fields) method on CommunitySync
for programmatic field updates. Existing auto-capture unchanged.

New (N): Renamed all create/add vocabulary to new — toolbar buttons,
event names (new-shape, shape-new, shape-removed), internal functions
(newShape, newShapeElement).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 23:21:53 +00:00
Jeff Emmett 33f0ef4077 fix: server-backed auth + show username instead of DID key
Rewrote auth flow to go through EncryptID server instead of
client-side unsigned JWTs. Fixes "Invalid or expired authentication
token" on space creation, and shows username in header.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 22:26:50 +00:00
Jeff Emmett 9f39e2393b fix: change WebAuthn RP ID from jeffemmett.com to rspace.online
The RP ID jeffemmett.com caused "relying party ID is not a registrable
domain suffix" errors on *.rspace.online subdomains. Related Origins
also exceeded the 5 eTLD+1 browser limit with 18+ domains listed.

Now rspace.online is the RP ID, so all *.rspace.online subdomains
(including cca.rspace.online) are valid automatically. The Related
Origins file only lists non-rspace.online r* ecosystem domains.

Also points rspace-header auth URL to auth.rspace.online.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:32:57 -07:00
Jeff Emmett 73aee64401 feat: add path-based community routing under subdomain namespaces
cca.rspace.online/campaign/demo now loads the campaign-demo community.
Path segments are joined with hyphens to derive the slug. Subdomain
acts as a brand namespace; root path still loads the subdomain slug.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:20:57 -07:00
Jeff Emmett 533ce89cea backlog: add system clock heartbeat service task (TASK-47)
Server-side clock broadcasting time signals via Event Bus for shapes
to subscribe to periodic events (tick, hourly, daily).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:19:42 -07:00
Jeff Emmett a3572f7a5f feat: add rChats.online to ecosystem links and EncryptID allowed origins
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:15:42 -07:00
Jeff Emmett ea8f1b3f95 Add offline-first section to rSpace landing page
New feature card in hero grid and a dedicated section explaining
local IndexedDB persistence, Automerge auto-merge, and incremental
sync. Matches the existing visual style with pillars and identity cards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 12:41:24 -07:00
Jeff Emmett 6b06168f11 feat: add offline-first support with IndexedDB persistence and Service Worker
rSpace apps now work fully offline. Automerge documents and sync state
persist to IndexedDB, enabling instant load from cache, offline editing,
and automatic incremental merge on reconnect. A Service Worker caches
the app shell (HTML/JS/WASM) for loading without network.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 12:39:28 -07:00
Jeff Emmett cda6dfeaaf Add rData analytics tracking and ecosystem footer link
- Inject rdata.online/collect.js tracking script in layout
- Add rData link to ecosystem footer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 18:58:02 +00:00
Jeff Emmett ef8eef8497 Add rSwag to the ecosystem apps section
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 04:20:40 -07:00
Jeff Emmett 20a0796a4d Add folk-choice-* collaborative decision components
Three new canvas shapes for small-group decisions:
- folk-choice-vote: live polling with plurality, approval, and
  quadratic voting modes
- folk-choice-rank: drag-to-reorder with Borda count and
  instant-runoff aggregation
- folk-choice-spider: multi-criteria scoring with SVG radar chart,
  per-user polygon overlays, and weighted mean aggregation

All sync via rSpace's existing Automerge CRDT infrastructure.
Aggregation algorithms are exported as pure functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:18:00 +00:00
Jeff Emmett 0489319e15 Add rForum to ecosystem apps
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:12:50 +00:00
Jeff Emmett e65cfffefd feat: move EncryptID to auth.rspace.online, rebrand as rStack Identity
Traefik routes auth.rspace.online (priority 150) with encryptid.jeffemmett.com
fallback. Landing page rebranded as rStack Identity with rStack.online ecosystem
tagline. Registration form now includes optional email for account recovery.
JWT issuer and recovery URL updated. 14 r* apps listed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 10:49:35 +00:00
Jeff Emmett fa80968b7f Replace EncryptID landing page with real auth UI
Replace marketing-only landing page with a functional auth page that
lets users register and sign in with passkeys. Shows profile view
after login with DID, passkey list, session info, and recovery email
setup. Still includes feature descriptions and r-suite app links.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 07:47:47 +00:00
Jeff Emmett d0a6c3ada5 feat: add rauctions.online to EncryptID allowed origins
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:45:29 +00:00
Jeff Emmett cff0c21c0c fix: WebAuthn .well-known routing and cross-origin passkey support
Add Traefik priority=200 and service assignment to encryptid-wellknown
router so it wins over canvas-website/personal-site for the
/.well-known/webauthn path on jeffemmett.com. Add missing origins
(rpubs.online, shop.mycofi.earth, canvas/press/cart.jeffemmett.com)
to the allowed origins list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 04:53:08 +00:00
Jeff Emmett 2b2f054c65 chore: backlog TASK-20 membership endpoints + shape sync (Done)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:35:26 -07:00
Jeff Emmett 5d517dbdf1 chore: update TASK-13 with cross-space auth progress
SSO token relay, membership endpoints, SpaceRole bridges, and
bidirectional sync all implemented. AC #6 and #7 checked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:33:16 -07:00
Jeff Emmett 08985d774e feat: add membership endpoints and bidirectional shape sync
Adds space_members table and CRUD endpoints to EncryptID server for
centralized membership management. Extends Automerge CommunityDoc with
members map and PATCH endpoint for module→canvas shape updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:31:48 -07:00
Jeff Emmett e4bcc3f04a docs: add MODULE_SPEC.md with permission model and capabilities
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:30:14 -07:00
Jeff Emmett fa4898ca9f chore: update backlog tasks 9 and 19
Mark task-19 acceptance criteria complete, add notes on header
re-render fix, Docker build fix, and auto-deploy setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 19:16:40 -07:00
Jeff Emmett 6bafcf35bd fix: skip tsc in Docker build to avoid bun-types conflict
Type checking runs locally/CI. The Docker build just needs vite build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:52:38 -07:00
Jeff Emmett 3ba98da1a8 chore: update bun lockfile
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:51:56 -07:00
Jeff Emmett fd25996a0c fix: make Docker build self-contained with local context
The parent-directory build context was blocked by a sibling project's
.dockerignore. Switch to using the repo root as context and pull
encryptid-sdk via Docker's additional_contexts feature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:51:24 -07:00
Jeff Emmett 46d8429082 fix: update header after auth via requireAuth flow
When a user authenticates through the community creation form (via
requireAuth), the header bar now re-renders to show the logged-in
state instead of still displaying the Sign In button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:34:03 -07:00
Jeff Emmett da48f6faf6 feat: add EncryptID auth header and gate community creation behind sign-in
Adds a persistent header bar with sign-in/sign-up across landing and canvas
pages. The "Create Community Space" form now requires EncryptID authentication,
showing a passkey auth modal if the user isn't signed in. Auth tokens are sent
with the community creation API call. EncryptID WebAuthn modules are lazy-loaded
only when auth is triggered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:50:48 -07:00
Jeff Emmett 163ab3c288 fix: remove hardcoded secret fallbacks from EncryptID (GitGuardian alert)
Require DATABASE_URL and JWT_SECRET via env vars instead of falling back
to hardcoded defaults. Removes insecure fallback passwords from compose
file as well. Production was already using strong .env secrets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:33:02 -07:00
Jeff Emmett d8b8864fbc chore: add backlog task 18 for CRDT token issuance
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:15:45 -07:00
Jeff Emmett c2255f1296 feat: add CRDT token issuance system with mint/ledger shapes
Implements BFT-CRDT token infrastructure as FolkShape components that
live in the existing Automerge document — no new server or database needed.
Admins can create token types (mint) and issue them to participants by
DID or email (ledger), with real-time sync across all connected peers.

- folk-token-mint: token definition (name, symbol, supply, color, icon)
- folk-token-ledger: distribution tracker with issuance form, email escrow
- Canvas toolbar "Token" button creates mint+ledger+arrow pair
- Demo seeds: GOV (equal governance) and CRED (contribution credits)
- community-sync: remote property updates for both token shapes
- EncryptID: add rTube, rStack to allowed origins and landing page
- rSpace landing page: add EncryptID and interoperability sections

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:01:47 -07:00
Jeff Emmett 65aeceddd1 chore: add backlog tasks 14-17
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:09:30 -07:00
Jeff Emmett 0a32944243 feat: add JSON WebSocket mode, demo seed data, and useDemoSync hook
Add lightweight JSON WebSocket protocol (?mode=json) that bridges
Automerge to JSON for demo pages, avoiding the ~500KB Automerge bundle.
Includes GET /api/communities/:slug/shapes endpoint, POST demo reset
with rate limiting, Alpine Explorer 2026 seed data (~40 shapes), and
the useDemoSync React hook for real-time demo page connectivity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 09:38:59 -07:00
Jeff Emmett 89fba95e40 feat: add email recovery with Mailcow SMTP and recovery page
- Add email column to users table, recovery_tokens table
- Add recovery endpoints (set/request/verify email)
- Integrate nodemailer with Mailcow SMTP (mx.jeffemmett.com)
- Add branded HTML recovery email template
- Add /recover landing page with passkey registration
- Add SMTP env vars to docker-compose

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 09:35:53 -07:00
Jeff Emmett 38636862d8 fix: overhaul canvas shape creation, connections, and sync
- Fix CSS position:absolute missing for 5 trip planning shapes
- Expand arrow connection mode to all 21 shape types (was only 2)
- Center new shapes in viewport instead of clustering top-left
- Extract createAndAddShape() utility, eliminating ~270 lines of duplication
- Add missing Google Item toolbar button
- Add error handling on remote shape creation (try-catch-finally)
- Implement actual WebSocket keep-alive ping (was a no-op)
- Use shape.toJSON() in sync layer to capture all shape properties (was only 3 types)
- Add index signature to ShapeData for arbitrary shape-specific properties

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:27:48 -07:00
Jeff Emmett eedc6b1b4a feat: add rFunds, rNetwork, rCart to r-Ecosystem app icons
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:27:40 -07:00
Jeff Emmett aa3db67048 Fix EncryptID Docker build to include encryptid-sdk dependency
Build context changed to parent directory so the encryptid-sdk
(referenced as file:../encryptid-sdk) is accessible during build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 21:23:18 -07:00
Jeff Emmett 7f37e47934 Add rcart.online to EncryptID CORS allowed origins
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 21:21:13 -07:00
Jeff Emmett fe53340869 Add task_prefix to backlog config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:40:56 -07:00
Jeff Emmett e9f7dba926 Add emoji favicon (🌌) for browser tab
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 19:13:40 -07:00
Jeff Emmett 8e51ba923a feat: add rNotes and rTrips to r-Ecosystem app icons
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 19:05:25 -07:00
Jeff Emmett 6db71abef9 feat: add internal API key bypass for service-to-service calls
Allows trusted internal services (e.g. rnotes) to push shapes
without EncryptID auth by passing X-Internal-Key header.
Key is set via INTERNAL_API_KEY env var.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 15:02:08 -07:00
Jeff Emmett 3a04416b10 fix: resolve TypeScript build errors for Docker deployment
- Fix duplicate property in addShapes object literal
- Exclude src/encryptid/ from tsc (pre-existing errors, separate module)
- Add ambient type declaration for @encryptid/sdk/server

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:59:04 -07:00
Jeff Emmett 7b230baa9c fix: update Dockerfile for encryptid-sdk file: dependency
Use parent context (context: ..) so the SDK at file:../encryptid-sdk
resolves correctly during Docker build. Same pattern as rnotes-online.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:57:31 -07:00