Commit Graph

293 Commits

Author SHA1 Message Date
Jeff Emmett f4e72452f1 debug: add logging for coordinate defaults during sanitization 2025-11-19 20:25:24 -07:00
Jeff Emmett cae367db28 fix: migrate geo shapes with props.text during Automerge load
Geo shapes saved before the tldraw schema change have props.text which is
no longer valid. This causes ValidationError on page reload when shapes are
loaded from Automerge:

  "ValidationError: At shape(type = geo).props.text: Unexpected property"

The migration logic was only in JSON import (CustomMainMenu.tsx), but shapes
loading from Automerge also need migration.

This fix adds the props.text → props.richText migration to the sanitizeRecord
function in AutomergeToTLStore.ts, ensuring geo shapes are properly migrated
when loaded from Automerge, matching the behavior during JSON import.

The original text is preserved in meta.text for backward compatibility with
search and other features that reference it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 16:25:58 -07:00
Jeff Emmett 7e09d22843 fix: preserve coordinates and convert geo shape text during JSON import
- Fix coordinate collapse bug where shapes were resetting to (0,0)
- Convert geo shape props.text to props.richText (tldraw schema change)
- Preserve text in meta.text for backward compatibility
- Add .nvmrc to enforce Node 20
- Update package.json to require Node >=20.0.0
- Add debug logging for sync and import operations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 16:14:23 -07:00
Jeff Emmett 943162899e fix: use useMemo instead of useState for repo/adapter initialization
Fixed TypeScript error by changing from useState to useMemo for repo and
adapter initialization. This properly exposes the repo and adapter objects
instead of returning a state setter function.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 22:10:55 -07:00
Jeff Emmett e70cba82b4 fix: wait for network adapter to be ready before creating document
Added await for adapter.whenReady() to ensure WebSocket connection is
established before creating the Automerge document. This should enable
the Automerge Repo to properly send binary sync messages when document
changes occur.

Changes:
- Extract adapter from repo initialization to access it
- Wait for adapter.whenReady() before creating document
- Update useEffect dependencies to include adapter and workerUrl

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 22:07:24 -07:00
Jeff Emmett 63b19f7db8 fix: restore working Automerge sync from pre-Cloudflare version
Reverted to the proven approach from commit 90605be where each client
creates its own Automerge document with repo.create(). The Automerge
binary sync protocol handles synchronization between clients through
the WebSocket network adapter, without requiring shared document IDs.

Key changes:
- Each client calls repo.create() to get a unique document
- Initial content loaded from server via HTTP/R2
- Binary sync messages broadcast between clients keep documents in sync
- No need for shared document ID storage/retrieval

This fixes the "Document unavailable" errors and enables real-time
collaboration across multiple board instances.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 21:59:59 -07:00
Jeff Emmett c18d204814 fix: simplify Automerge document creation for concurrent access
Removed document ID storage/retrieval logic that was causing "Document unavailable"
errors. Each client now creates its own Automerge document handle and syncs content
via WebSocket binary protocol. This allows multiple boards to load the same room
simultaneously without conflicts.

- Removed /room/:roomId/documentId endpoints usage
- Each client creates document with repo.create()
- Content syncs via Automerge's native binary sync protocol
- Initial content still loaded from server via HTTP

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 21:40:15 -07:00
Jeff Emmett 3231720004 fix: add await to repo.find() call
repo.find() returns a Promise<DocHandle>, not DocHandle directly.
Added missing await keyword to fix TypeScript build error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 21:26:42 -07:00
Jeff Emmett ca9f250de8 fix: handle concurrent Automerge document access with try-catch
When multiple clients try to load the same room simultaneously, repo.find()
throws "Document unavailable" error if the document isn't in the repo yet.
Wrapped repo.find() in try-catch to create a new handle when document isn't
available, allowing multiple boards to load the same page concurrently.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 21:15:56 -07:00
Jeff Emmett 6ab966cc95 fix: use proper Automerge URL format for repo.find()
The issue was that repo.find() was creating a NEW document instead of
waiting for the existing one to sync from the network.

Changes:
- Use 'automerge:{documentId}' URL format for repo.find()
- Remove try-catch that was creating new documents
- Let repo.find() properly wait for network sync

This ensures all clients use the SAME document ID and can sync in real-time.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 21:00:18 -07:00
Jeff Emmett 02808d170e fix: handle Document unavailable error with try-catch in repo.find()
When repo.find() is called for a document that exists on the server but not
locally, it throws 'Document unavailable' error. This fix:

- Wraps repo.find() in try-catch block
- Falls back to creating new handle if document not found
- Allows sync adapter to merge with server state via network

This handles the case where clients join existing rooms and need to sync
documents from the network.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 20:33:31 -07:00
Jeff Emmett 2cc7c52755 refactor: remove OddJS dependency and fix Automerge sync
Major Changes:
- Fix Automerge "Document unavailable" error by awaiting repo.find()
- Remove @oddjs/odd package and all related dependencies (205 packages)
- Remove location sharing features (OddJS filesystem-dependent)
- Simplify auth to use only CryptoAuthService (WebCryptoAPI-based)

Auth System Changes:
- Refactor AuthService to remove OddJS filesystem integration
- Update AuthContext to remove FileSystem references
- Delete unused auth files (account.ts, backup.ts, linking.ts)
- Delete unused auth components (Register.tsx, LinkDevice.tsx)

Location Features Removed:
- Delete all location components and routes
- Remove LocationShareShape from shape registry
- Clean up location references across codebase

Documentation Updates:
- Update WEBCRYPTO_AUTH.md to remove OddJS references
- Correct component names (CryptoLogin → CryptID)
- Update file structure and dependencies
- Fix Automerge README WebSocket path documentation

Build System:
- Successfully builds without OddJS dependencies
- All TypeScript errors resolved
- Production bundle size optimized

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 20:19:02 -07:00
Jeff Emmett 1e68150b60 fix: implement real-time Automerge sync across clients
- Add document ID coordination via server to ensure all clients sync to same document
- Add new endpoints GET/POST /room/:roomId/documentId for document ID management
- Store automergeDocumentId in Durable Object storage
- Add enhanced logging to CloudflareAdapter send() method for debugging
- Add sharePolicy to Automerge Repo to enable document sharing
- Fix TypeScript errors in useAutomergeSyncRepo

This fixes the issue where each client was creating its own Automerge document
with a unique ID, preventing real-time sync. Now all clients in a room use the
same document ID, enabling proper real-time collaboration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 19:45:36 -07:00
Jeff Emmett b52b715340 feat: add RunPod AI integration with image generation and enhanced LLM support
Add comprehensive RunPod AI API integration including:
- New runpodApi.ts client for RunPod endpoint communication
- Image generation tool and shape utilities for AI-generated images
- Enhanced LLM utilities with RunPod support for text generation
- Updated Whisper transcription with improved error handling
- UI components for image generation tool
- Setup and testing documentation

This commit preserves work-in-progress RunPod integration before switching branches.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 16:14:39 -07:00
Jeff Emmett 0882648565 feat: rebrand CryptoLogin to CryptID
- Rename CryptoLogin component to CryptID
- Update all imports and usages across the codebase
- Display 'CryptID: username' in user dropdown menu
- Update UI text to reference CryptID branding
- Update Profile component header to show CryptID
- Update component comments and documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 14:09:23 -07:00
Jeff Emmett f963152238 chore: remove Vercel dependencies and config files
- Remove @vercel/analytics dependency and usage
- Remove vercel CLI dependency
- Delete vercel.json configuration file
- Delete .vercel cache directory
- Site now fully configured for Cloudflare Pages deployment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 13:35:50 -07:00
Jeff Emmett 48dac00f59 fix: use repo.create() instead of invalid document ID format
Change from repo.find('automerge:patricia') to repo.create() because
Automerge requires proper UUID-based document IDs, not arbitrary strings.

Each client creates a local document, loads initial data from server,
and syncs via WebSocket. The server syncs documents by room ID, not
by Automerge document ID.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 05:13:37 -07:00
Jeff Emmett 776526c65e fix: add type cast for currentDoc to fix TypeScript error
Cast handle.doc() to any to fix TypeScript error about missing 'store' property.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 05:04:54 -07:00
Jeff Emmett 64d4a65613 fix: await repo.find() to fix TypeScript build errors
repo.find() returns a Promise<DocHandle>, so we need to await it.
This fixes the TypeScript compilation errors in the build.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 05:00:04 -07:00
Jeff Emmett 432e90d9ef fix: enable production logging for R2 persistence debugging
Add console logs in production to debug why shapes aren't being saved to R2.
This will help identify if saves are:
- Being triggered
- Being deferred/skipped
- Successfully completing

Logs added:
- 💾 When persistence starts
-  When persistence succeeds
- 🔍 When shape patches are detected
- 🚫 When saves are skipped (ephemeral/pinned changes)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 04:56:32 -07:00
Jeff Emmett 71e7e5de05 fix: remove ImageGen references to fix build
Remove ImageGenShape import and references from useAutomergeStoreV2.ts
to fix TypeScript build error. ImageGen feature files are not yet committed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 04:17:49 -07:00
Jeff Emmett 90605bee09 fix: enable real-time multiplayer sync for automerge
Add manual sync triggering to broadcast document changes to other peers in real-time.
The Automerge Repo wasn't auto-broadcasting because the WebSocket setup doesn't use peer discovery.

Changes:
- Add triggerSync() helper function to manually trigger sync broadcasts
- Call triggerSync() after all document changes (position updates, eraser changes, regular changes)
- Pass Automerge document to patch handlers to prevent coordinate loss
- Add ImageGenShape support to schema

This fixes the issue where changes were being saved to Automerge locally but not
broadcast to other connected clients until page reload.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 04:00:31 -07:00
Jeff Emmett 7a17b0944a fix custom shape type validation errors
Add case normalization for custom shape types to prevent validation errors when loading shapes with lowercase type names (e.g., "chatBox" → "ChatBox"). The TLDraw schema expects PascalCase type names for custom shapes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 03:13:07 -07:00
Jeff Emmett f5582fc7d1 prevent coordinate collapse on reload
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 03:03:39 -07:00
Jeff Emmett 4d7b05efa2 update obsidian shape deployment 2025-11-12 16:23:08 -08:00
Jeff Emmett ab1d0344a5 fix cloudflare deployment glitches 2025-11-11 22:47:36 -08:00
Jeff Emmett 04f6fe5192 deployment fix 2025-11-11 22:42:38 -08:00
Jeff Emmett 2528ad4726 update cloudflare errors 2025-11-11 22:38:24 -08:00
Jeff Emmett ffef04df50 pin object, fix fathom, and a bunch of other things 2025-11-11 22:32:36 -08:00
Jeff Emmett 5fd83944fc coordinate fix 2025-11-11 01:08:55 -08:00
Jeff Emmett a3950baf17 fix coords 2025-11-11 00:57:45 -08:00
Jeff Emmett ef4a84e8f1 remove coordinate reset 2025-11-11 00:53:55 -08:00
Jeff Emmett d1179169cc fix coordinates 2025-11-10 23:54:54 -08:00
Jeff Emmett 0e90e2d097 preserve coordinates 2025-11-10 23:51:53 -08:00
Jeff Emmett eafbf6c9fe shape rendering on prod 2025-11-10 23:36:12 -08:00
Jeff Emmett edbe76ebda fix coordinates 2025-11-10 23:25:44 -08:00
Jeff Emmett ef39328d95 preserve coordinates 2025-11-10 23:17:16 -08:00
Jeff Emmett 229f4d6b41 fix coordinates 2025-11-10 23:04:52 -08:00
Jeff Emmett 0fa1652f72 prevent coordinate reset 2025-11-10 23:01:35 -08:00
Jeff Emmett 1b172d7529 update x & y coordinates 2025-11-10 22:42:52 -08:00
Jeff Emmett c1df50c49b fix prod 2025-11-10 22:27:21 -08:00
Jeff Emmett 053bd95d4a fix prod I hope 2025-11-10 20:53:29 -08:00
Jeff Emmett 73ac456e17 update dev and prod shape render 2025-11-10 20:16:45 -08:00
Jeff Emmett 92cac8dee5 fix prod shape render 2025-11-10 20:05:07 -08:00
Jeff Emmett b8fb64c01b update prod shape render 2025-11-10 19:54:20 -08:00
Jeff Emmett 680b6a5359 update prod 2025-11-10 19:44:49 -08:00
Jeff Emmett fec80ddd18 fix shape rendering in prod 2025-11-10 19:42:06 -08:00
Jeff Emmett 5b32184012 fix shape deployment in prod 2025-11-10 19:26:44 -08:00
Jeff Emmett be5f1a5a3a fix prod deployment 2025-11-10 19:23:15 -08:00
Jeff Emmett bf5d214e45 update for prod 2025-11-10 19:21:22 -08:00
Jeff Emmett f8e4fa3802 update production shape loading 2025-11-10 19:15:36 -08:00
Jeff Emmett 04135a5487 updates to production 2025-11-10 18:57:04 -08:00
Jeff Emmett 5e11183557 fix cloudflare 2025-11-10 18:48:39 -08:00
Jeff Emmett b5463d4d64 update for shape rendering in prod 2025-11-10 18:43:52 -08:00
Jeff Emmett bda2523e3b fix production automerge 2025-11-10 18:29:19 -08:00
Jeff Emmett 3072dc70c0 fix prod 2025-11-10 18:10:55 -08:00
Jeff Emmett 62afed445e final automerge errors on cloudflare 2025-11-10 18:01:36 -08:00
Jeff Emmett f2b05a8fe6 fix final bugs for automerge 2025-11-10 17:58:23 -08:00
Jeff Emmett 0a34c0ab3e shape viewing bug fixed 2025-11-10 15:57:17 -08:00
Jeff Emmett 0c2ca28d0e update automerge bug fix 2025-11-10 15:41:56 -08:00
Jeff Emmett 5cfa2d683c final update fix old data conversion 2025-11-10 15:38:53 -08:00
Jeff Emmett b5785f059f update automerge 2025-11-10 14:44:13 -08:00
Jeff Emmett fa6b874313 fix typescript errors 2025-11-10 14:36:30 -08:00
Jeff Emmett 657df72534 update to prod 2025-11-10 14:24:17 -08:00
Jeff Emmett 9664439f31 update worker 2025-11-10 14:18:23 -08:00
Jeff Emmett f688851764 update to fix deployment 2025-11-10 13:41:17 -08:00
Jeff Emmett 5c99a82c14 final updates to Automerge conversion 2025-11-10 13:34:55 -08:00
Jeff Emmett 822b979864 update package.json, remove cloudflare worker deployment 2025-11-10 12:46:49 -08:00
Jeff Emmett d1ad51c8ab latest update to fix cloudflare 2025-11-10 11:51:57 -08:00
Jeff Emmett d3f2029521 more updates to get vercel and cloudflare working 2025-11-10 11:48:33 -08:00
Jeff Emmett 119146e094 update to fix vercel and cloudflare errors 2025-11-10 11:30:33 -08:00
Jeff Emmett 38d1f28e35 update more typescript errors for vercel 2025-11-10 11:22:32 -08:00
Jeff Emmett 4815fa4a23 update typescript errors for vercel 2025-11-10 11:19:24 -08:00
Jeff Emmett f8e4647e1a everything working in dev 2025-11-10 11:06:13 -08:00
Jeff Emmett 368732e3b1 Update presentations page to have sub-links 2025-10-08 14:19:02 -04:00
Jeff Emmett 719a4eb918 automerge, obsidian/quartz, transcribe attempt, fix AI APIs 2025-09-21 11:43:06 +02:00
Jeff Emmett 8fa8c388d9 fixed shared piano 2025-09-04 17:54:39 +02:00
Jeff Emmett 356a262114 update tldraw functions for update 2025-09-04 16:58:15 +02:00
Jeff Emmett 1abeeaea10 update R2 storage to JSON format 2025-09-04 16:26:35 +02:00
Jeff Emmett 808b37425a update tldraw functions 2025-09-04 15:30:57 +02:00
Jeff Emmett 8385e30d25 separate worker and buckets between dev & prod, fix cron job scheduler 2025-09-04 15:12:44 +02:00
Jeff Emmett 3b137b0b55 fix worker url in env vars for prod 2025-09-02 14:28:11 +02:00
Jeff Emmett ec9db36a50 debug videochat 2025-09-02 13:26:57 +02:00
Jeff Emmett 9a9cab1b8e fix video chat in prod env vars 2025-09-02 00:43:57 +02:00
Jeff Emmett 17ba57ce6e fix zoom & videochat 2025-09-01 09:44:52 +02:00
Jeff Emmett fa2f16c019 fix vercel errors 2025-08-25 23:46:37 +02:00
Jeff Emmett 0c980f5f48 Merge branch 'auth-webcrypto' 2025-08-25 16:11:46 +02:00
Jeff Emmett fdc14a1a92 fix vercel deployment errors 2025-08-25 07:14:21 +02:00
Jeff Emmett 956463d43f user auth via webcryptoapi, starred boards, dashboard view 2025-08-25 06:48:47 +02:00
Jeff Emmett 125e565c55 shared piano in progress 2025-08-23 16:07:43 +02:00
Jeff Emmett 129d72cd58 fix gesturetool 2025-07-29 23:01:37 -04:00
Jeff Emmett b01cb9abf8 fix gesturetool for vercel 2025-07-29 22:49:27 -04:00
Jeff Emmett f949f323de working auth login and starred boards on dashboard! 2025-07-29 22:04:14 -04:00
Jeff Emmett 5eb5789c23 add in gestures and ctrl+space command tool (TBD add global LLM) 2025-07-29 16:02:51 -04:00
Jeff Emmett 15fa9b8d19 implemented collections and graph layout tool 2025-07-29 14:52:57 -04:00
Jeff Emmett 7e3cca656e update spelling 2025-07-29 12:46:23 -04:00
Jeff Emmett 6e373e57f1 update presentations and added resilience subpage 2025-07-29 12:41:15 -04:00
Jeff Emmett 545372dcba update presentations page 2025-07-27 17:52:23 -04:00
Jeff Emmett d7fcf121f8 update contact page with calendar booking & added presentations 2025-07-27 16:07:44 -04:00
Jeff Emmett c5e606e326 auth in progress 2025-04-17 15:51:49 -07:00