Repository navigation
Replace per-workspace host state with one global publishUsers call - #157
Merged
Merged
Conversation
An outer host now hands moi its identity and users through a single call,
window.moi.collab.publishUsers({ me, users }). The same call covers startup
and every later change, and each call replaces the whole snapshot.
- The user directory is global to the moi instance instead of one list per
workspace, and it no longer has a loading state. A published list is
authoritative, including when it is empty.
- `me` is an id that must be listed in `users`. Leaving it out, or passing
null, means nobody is signed in. The directory is then emptied even if the
host still lists users.
- moi owns the state and the host only pushes into it. setHostState,
getHostState, subscribeHostState, the getter read before load, and the
moi:collab-ready event are removed.
- installHostApi() runs while the entry module evaluates rather than inside
the async init, so a host module script placed after the bundle finds the
API at once and publishes before React mounts. A classic inline script in
that position runs before the bundle and finds nothing.
- Current-user observers are notified only when the viewer or its source
actually changed. Each notice makes every open workspace resend the viewer
profile to its room, so a directory update for other users now sends
nothing over the socket.
- The engine contract exposes getDirectory and subscribeDirectory, and the
default engine reads the same global directory, so users also resolve
outside a workspace.
The applet API is unchanged. The applet guide drops the loading directory
and notes that the directory is the same in every workspace.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The guide is for agents building applets, who only read users through hooks. Where the user list comes from is nothing an applet can see or act on, so the paragraph about a host-supplied directory goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A host app that embeds moi now tells it who is signed in, and who all the users are, with one call. Before, the host had to keep a separate user list for each workspace, each with its own loading state, and go through a setup handshake to deliver it. Now there is one list for the whole app, and moi keeps it.
Each call replaces everything.
mehas to be one ofusers. Leave it out when nobody is signed in.Worth a look:
setHostStateAPI and themoi:collab-readyevent are gone.Also in here: the applet guide no longer says where users come from, and the PR description rule got a small update.
The commit message in 9375f9f has the rest of the details.
🤖 Generated with Claude Code