SkillPedia Skills Encyclopedia
中文 EN
今日更新 2026-11-18 UTC

今天还没有新提交

查看更新动态

技能 2026-10-09 14:06 UTC

moi

由提交人 molefrog 提交,主要更新类型为:依赖升级与工程维护。提交说明:Replace per-workspace host state with one global publishUsers call (#157)。更新了依赖与构建配置,跟进上游版本。

molefrog 87bbbfb molefrog/moi

Commit提交信息原文

Replace per-workspace host state with one global publishUsers call (#157)

* Replace per-workspace host state with one global publishUsers call

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>

* Upd: the pull request desc rule.

* Remove user directory details from the collab applet guide

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>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>