René's URL Explorer Experiment


Title: feat(files): collaborative document editing — client provider + editor [5/N] by waleedlatif1 · Pull Request #5946 · simstudioai/sim · GitHub

Open Graph Title: feat(files): collaborative document editing — client provider + editor [5/N] by waleedlatif1 · Pull Request #5946 · simstudioai/sim

X Title: feat(files): collaborative document editing — client provider + editor [5/N] by waleedlatif1 · Pull Request #5946 · simstudioai/sim

Description: What The client half of collaborative document editing, on top of the merged server relay (#5941). Two people editing the same file's rich-text editor now see each other's live carets + text selection in their own color (Google-Docs style), with the name on hover. ⚠️ Needs live two-browser verification before merge Caret positioning and concurrent-edit convergence cannot be certified headlessly. Before merge, please open the same workspace file as two different users in two browsers and confirm: both carets appear, colored + name-on-hover; typing in one shows live in the other, and simultaneous typing converges (no lost/garbled text); the selection highlight renders as a lighter tint; opening a fresh file seeds its content exactly once (no duplication); closing/reopening preserves content (the markdown mirror). Everything below is unit-tested + typechecks, but that last mile is yours. Contents use-file-doc-collaboration hook — owns the per-file Y.Doc + Awareness (created synchronously so the editor binds at mount) and the FileDocProvider (connects async over the shared socket). Enabled only for an editable, round-trip-safe, non-streaming workspace document with a known user, decided once at mount. FileDocProvider (14 tests) — the Socket.IO analogue of y-websocket's provider; binds its clientId at join, exchanges sync only after the ack, publishes only its own awareness, re-syncs on reconnect, detaches on destroy. Editor wiring — per-instance Collaboration/CollaborationCaret; StarterKit's history disabled only on the collab path (Yjs owns undo/redo) so the headless markdown round-trip path is untouched; the manual streaming reconcile loop is bypassed when collaborating. Seeding — on SEED_REQUEST + synced, setContent(markdown) + the initialContentLoaded flag in one doc.transact (the relay's exactly-once contract). Autosave gate — the editor holds the markdown-mirror save until the doc is synced && seeded, so an empty/partially-synced doc can never overwrite the real file (the data-loss vector the earlier audit flagged). CSS — caret + name-on-hover + lighter-tint selection, themed under .rich-markdown-prose. Infra reuse Same socket server, Redis fan-out, and auth spine as the rest of realtime (no new services). Uses the existing content PUT for the markdown mirror (no new routes/contracts). Deps added: yjs, y-protocols, lib0, @tiptap/extension-collaboration, @tiptap/extension-collaboration-caret. Gates Full apps/sim typecheck clean; the editor suite (442 tests) + provider tests green; biome + check:api-validation pass. Deferred (follow-ups) Durable Yjs snapshot persistence (content is durable via the markdown mirror today); presence avatars in the editor header; Tables cell-selection presence.

Open Graph Description: What The client half of collaborative document editing, on top of the merged server relay (#5941). Two people editing the same file's rich-text editor now see each other's live carets + tex...

X Description: What The client half of collaborative document editing, on top of the merged server relay (#5941). Two people editing the same file's rich-text editor now see each other's live care...

Opengraph URL: https://github.com/simstudioai/sim/pull/5946

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:7767ddfe-3452-1c5b-b1ff-aecf973eee80
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9CEE:243AE6:8E9307:CA7F07:6AFB5087
html-safe-noncea587530e15b02771fb22ac42abea9f7f077665002b46878b62ed0ace7b0402c1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0VFOjI0M0FFNjo4RTkzMDc6Q0E3RjA3OjZBRkI1MDg3IiwidmlzaXRvcl9pZCI6IjM0MjMzNjU3Mzg3NTkxNDc2NTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4b01670c2779951f196abb197dba1642a5f4657f16aa5fbb8e9d53c2bf171719
hovercard-subject-tagpull_request:4130187813
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5946/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altWhat The client half of collaborative document editing, on top of the merged server relay (#5941). Two people editing the same file's rich-text editor now see each other's live carets + tex...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecbf66c024bb6d10e6955baa7413c54cf13a201bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5946/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5946%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5946%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5946/files
Reloadhttps://github.com/simstudioai/sim/pull/5946/files
Reloadhttps://github.com/simstudioai/sim/pull/5946/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
realtime-roomshttps://github.com/simstudioai/sim/tree/realtime-rooms
realtime-rooms-phase5-collab-editorhttps://github.com/simstudioai/sim/tree/realtime-rooms-phase5-collab-editor
Conversation 66 https://github.com/simstudioai/sim/pull/5946
Commits 13 https://github.com/simstudioai/sim/pull/5946/commits
Checks 4 https://github.com/simstudioai/sim/pull/5946/checks
Files changed https://github.com/simstudioai/sim/pull/5946/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5946/files
feat(files): collaborative document editing — client provider + editor [5/N] https://github.com/simstudioai/sim/pull/5946/files#top
Show all changes 13 commits https://github.com/simstudioai/sim/pull/5946/files
f29c337 feat(files): client Yjs provider for collaborative document editing [… waleedlatif1 Jul 24, 2026 https://github.com/simstudioai/sim/pull/5946/commits/f29c337fb7c2fc78ec052e388e07771ed21374dd
4800157 feat(files): wire collaborative editing into the rich-markdown editor waleedlatif1 Jul 24, 2026 https://github.com/simstudioai/sim/pull/5946/commits/480015729d25f1d546f4f1c7f1b25660ceb28928
dcf9898 fix(files): harden collab editor lifecycle (review + audit round) waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/dcf989835e89d819479b33f70b845eb1ad15e381
7fcd273 docs(files): convert method-level collab comments to TSDoc waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/7fcd273d57d8f5c41b34d7b4f1fd9ff4656d3a1d
184bdc7 fix(files): run post-stream settle in collab mode waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/184bdc796340c88192da5d51dc585a16006fa040
267503a fix(files): gate collab editability + read-only fallback for denied a… waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/267503ae78a3afc451746b73b12efd8342b5377e
80ff02c fix(files): latch fatal join-error + gate stream settle on collab rea… waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/80ff02cdb4b33f8881d63249cae8f1312ae6b0fd
dc324ba fix(files): all fatal collab joins fall back to read-only waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/dc324ba5a32b4bfdb941c2fe79fe355465c8bed0
84ed863 chore(files): cleanup pass — label contrast, dead-code, comment hygiene waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/84ed86300148ae019bfd1185186d5fc669aac37a
26746a2 fix(files): make collab and agent-streaming mutually exclusive + real… waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/26746a280aa96fe5439dbf9af1bb2b35405427d7
7b937c5 fix(files): scope collaboration to the Files surface (disjoint from a… waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/7b937c5a3d01238322d8a1ce12b7b0b45a7918c2
288960e fix(files): arm outage fallback on socket disconnect, not provider ab… waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/288960ea0643658b58d1c0b20e55fa9e96d70bbd
bad7cdd fix(files): remove unsafe outage seed fallback (duplicates content on… waleedlatif1 Jul 25, 2026 https://github.com/simstudioai/sim/pull/5946/commits/bad7cdd1a9aee72454b51bc3ac724524b8085f77
Clear filters https://github.com/simstudioai/sim/pull/5946/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5946/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5946/files
file-viewer.tsx https://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
file-doc-provider.test.ts https://github.com/simstudioai/sim/pull/5946/files#diff-86ca687225a7128b114120aeef6e5609bd452da7c03292cf199518373ace515d
file-doc-provider.ts https://github.com/simstudioai/sim/pull/5946/files#diff-598531064700e61a529706f022aa7de5653fea72bca2dfd7a0ca6ab621a666b2
use-file-doc-collaboration.ts https://github.com/simstudioai/sim/pull/5946/files#diff-c9736519fd609a6344dda75d5bcfe0ca8d56f6dfd33fbe58a6c83751d572842e
editor-extensions.ts https://github.com/simstudioai/sim/pull/5946/files#diff-cb2c206d25ea13655dbf4c2c1723b67c66a469f397a8de625f9917c5ad59f926
extensions.ts https://github.com/simstudioai/sim/pull/5946/files#diff-7b00ff67d864b0cefc6bdabee28efdfce930aba686376131939d4f98af1a09ae
rich-markdown-editor.css https://github.com/simstudioai/sim/pull/5946/files#diff-72cd52075ca5767b1230f7ea9f4ec66103bff3ff90441919771b63bfad3a7984
rich-markdown-editor.tsx https://github.com/simstudioai/sim/pull/5946/files#diff-6ddf250be25a5febc97c8c4a2e0f9e93b869e674efbb9bd43358137571ddc05a
use-editable-file-content.ts https://github.com/simstudioai/sim/pull/5946/files#diff-0b8b432b66e254eda11f8159084482d71fa80cf6a3bb0765ccfe41420fe82125
files.tsx https://github.com/simstudioai/sim/pull/5946/files#diff-0284e2e46ba0636bd37fb01a0bee2a53844af9bbaf0a5879e3b182c0f34e67a9
colors.ts https://github.com/simstudioai/sim/pull/5946/files#diff-5075b35755f685a09ad956d115142f79c01cbc86a0af0f5e3fae9a8ff17d1b12
package.json https://github.com/simstudioai/sim/pull/5946/files#diff-43a1bb37ce68ac536b0a4ed9e973d9d52da3975d74b37865f591bb37e191be64
bun.lock https://github.com/simstudioai/sim/pull/5946/files#diff-bfd0ef82a01108fa1e836c2500b98b7de8a92bb1ae352a8efcbd9d6ffcaabd60
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsxhttps://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
View file https://github.com/simstudioai/sim/blob/bad7cdd1a9aee72454b51bc3ac724524b8085f77/apps/sim/app/workspace/%5BworkspaceId%5D/files/components/file-viewer/file-viewer.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5946/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
https://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
https://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
https://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
https://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
https://github.com/simstudioai/sim/pull/5946/files#diff-41f31a97adfda85382418ff71f00df02005b2d85b01516c49967857a1ee0b948
...files/components/file-viewer/rich-markdown-editor/collaboration/file-doc-provider.test.tshttps://github.com/simstudioai/sim/pull/5946/files#diff-86ca687225a7128b114120aeef6e5609bd452da7c03292cf199518373ace515d
View file https://github.com/simstudioai/sim/blob/bad7cdd1a9aee72454b51bc3ac724524b8085f77/apps/sim/app/workspace/%5BworkspaceId%5D/files/components/file-viewer/rich-markdown-editor/collaboration/file-doc-provider.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5946/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/5946/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.