Add the Roam Inbox prototype: /message and the inbox badge - #24
Open
mattakamatsu wants to merge 1 commit into
Open
Add the Roam Inbox prototype: /message and the inbox badge#24mattakamatsu wants to merge 1 commit into
mattakamatsu wants to merge 1 commit into
Conversation
Ports DiscourseGraphs/roam-inbox v0.5.1 (a pasted roam/js file piloted on dg-team) into this repository's installable form. The two halves, the /message person picker and the topbar inbox badge with its panel, ship as one bundle so neither can be installed alone. Graph access goes through data.async.* with parameterized inputs; writes through data.block.* and data.page.*. Messages and mentions share one query and each row pulls only its direct parent. Badge, panel, and toasts subscribe to the inbox state and repaint themselves. The live-verified Roam editor traps (store lag, textarea write-through, namespaced-key-first reads, uid-based seen tracking) are preserved and documented in place. Tests: 43 vitest cases, including the unread-count cases from the roam/js build, a source guard against default imports from roamjs-components and legacy roamAlphaAPI aliases, and a built-bundle load check that runs onload the way a roam/js loader block does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Roam prototype previewsThe preview deployment is ready. Paste a URL below into Load Developer Extensions from URL in Roam: |
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.
What this adds
prototypes/roam-inbox: in-graph messaging for Roam, ported from the privateDiscourseGraphs/roam-inboxroam/js prototype (v0.5.1, piloted ondg-team) into this repository's installable form. It is one bundle with two halves that only work together:/messageregisters a "Send message" slash command. Picking a person turns the block into{{[[TODO]]}} [[+Name]], which matches[[Convention/Inbox]]verbatim.The README explains why the convention rotted (no signal, hand-built queues, read and done were the same checkbox) and the design decisions that fix it. Related feedback ticket: FEE-535.
What changed in the port
window.roamAlphaAPI.data.async.*, every write throughdata.block.*anddata.page.*, and datalog inputs are parameterized. The pull-watch entity is the one string built from text, so the page title is quoted throughJSON.stringify.+Mesplit into messages and mentions by theTODOreference, one overMefor the /task channel. Each row pulls only its direct parent.#in panel rows, and the badge mount retry was not cancelled on unload.The code went through a four-angle simplification review (reuse, simplification, efficiency, altitude) before this PR. One conclusion worth recording here: no
roamjs-componentshelper is a legal replacement for the graph code, becausewrites/*andqueries/*route through the legacyroamAlphaAPI.createBlockand.qaliases viasubmitActions. Also, the barrel formimport { addStyle } from "roamjs-components/dom"does work, but it pulls the wholedombarrel (marked, prismjs, refractor) into the bundle, measured at 900 KB against the 57 KB this extension ships. The stylesheet stays inline for that reason, and the comment insrc/styles.tsnow says so.Verification
pnpm testat the root passes. The prototype has 43 vitest cases: the unread-count cases from the roam/js build, text flattening, result shaping, a source guard against default imports fromroamjs-componentsand the legacyroamAlphaAPIaliases, and a built-bundle check that importsdist/extension.jsinto jsdom and runsonloadwithextensionAPIundefined, the way a roam/js loader block does.pnpm typecheck(opt-in, strict) is clean.pnpm buildandpnpm prepare:artifactssucceed.sandbox-discourse-graphsgraph from the built bundle: identity resolved, badge mounted after the search box, counts matched an independent three-query datalog cross-check exactly (0 / 12 / 10). A test message lit the badge to1through the pull watch in 2.5 s, opening the panel acknowledged it and rendered the row with flattened text, Done wrote{{[[DONE]]}}, and the full /message flow (slash menu, picker with the recently active list, filter, Enter, insert, persistence) worked end to end. The test page was deleted afterwards andonunloadremoved everything.Notes for the reviewer
pnpm-lock.yamlgains the new workspace entry plus two devDependencies (typescript,@types/node) for the opt-in typecheck. The diff also re-resolves two peer hashes for existing prototypes; a frozen-lockfile install passes.missingCapabilityandreportLoadFailureinsrc/index.tsare now the third near-verbatim copy across prototypes and belong in the extension-base template, and the AGENTS.md / react-rendering skill example that recommends theroamjs-components/dombarrel should carry the bundle-size warning above.🤖 Generated with Claude Code