Skip to content

Conversation

kumavis
Copy link
Member

@kumavis kumavis commented Sep 17, 2025

Tagged-based "marshal plugin" for the OCapN client to send and receive Automerge document handles as objects.

This is a proof of concept for marshal plugins

Notes:

  • This is a fairly trivial proof of concept, as theres no extra stuff necessary (such as adding the remote to the read access list) to send a document to someone. Doing this for Keyhive may be a bit more interesting as we may be able to automatically add the recipient to the read-access or write-access list as part of the marshal plugin.
  • Automerge Documents don't indicate any connection information that could be used to connect to a network that has the document, and I don't attempt to fix that here. This implementation assumes its available via the sync.automerge.org sync server.
  • in current implementation they arrive as Promise<DocHandle> (result of repo.find) but could likely be DocHandle if using repo.findClassic or something
  • Automerge Document snapshots (handle.doc()) should be json-serializeable plain objects but in actuality don't seem to be Compartment-safe, seems like they might be exposing some internal machinery. hardening such a doc seems to break automerge internal syncing + networking. I did not investigate further.
  • the name "pbcap" suggests a "peanut butter + chocolate" mutually beneficial relationship of ocapn refs + keyhive c-caps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant