@blueshed/joined 0.0.0-stage → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/.claude/skills/joined/SKILL.md +17 -0
  2. package/.claude/skills/joined/reference.md +768 -0
  3. package/LICENSE +19 -0
  4. package/README.md +115 -2
  5. package/docs/design.md +148 -0
  6. package/docs/introduction.md +193 -0
  7. package/docs/learning.md +76 -0
  8. package/docs/stories.md +82 -0
  9. package/examples/app.css +27 -0
  10. package/examples/cafe/books.html +38 -0
  11. package/examples/cafe/books.json +13 -0
  12. package/examples/cafe/books.ts +64 -0
  13. package/examples/cafe/cafe.css +512 -0
  14. package/examples/cafe/front.html +115 -0
  15. package/examples/cafe/front.ts +7 -0
  16. package/examples/cafe/generated/books.elements.ts +52 -0
  17. package/examples/cafe/generated/books.queries.ts +11 -0
  18. package/examples/cafe/generated/books.rules.ts +42 -0
  19. package/examples/cafe/generated/kitchen.elements.ts +87 -0
  20. package/examples/cafe/generated/kitchen.queries.ts +47 -0
  21. package/examples/cafe/generated/kitchen.rules.ts +98 -0
  22. package/examples/cafe/generated/menu.elements.ts +61 -0
  23. package/examples/cafe/generated/menu.queries.ts +28 -0
  24. package/examples/cafe/generated/menu.rules.ts +65 -0
  25. package/examples/cafe/generated/order.elements.ts +87 -0
  26. package/examples/cafe/generated/order.queries.ts +47 -0
  27. package/examples/cafe/generated/order.rules.ts +95 -0
  28. package/examples/cafe/generated/staff.elements.ts +55 -0
  29. package/examples/cafe/generated/staff.queries.ts +27 -0
  30. package/examples/cafe/generated/staff.rules.ts +59 -0
  31. package/examples/cafe/generated/supplies.elements.ts +62 -0
  32. package/examples/cafe/generated/supplies.queries.ts +43 -0
  33. package/examples/cafe/generated/supplies.rules.ts +84 -0
  34. package/examples/cafe/generated/till.elements.ts +93 -0
  35. package/examples/cafe/generated/till.queries.ts +57 -0
  36. package/examples/cafe/generated/till.rules.ts +113 -0
  37. package/examples/cafe/index.html +70 -0
  38. package/examples/cafe/kitchen.css +107 -0
  39. package/examples/cafe/kitchen.html +39 -0
  40. package/examples/cafe/kitchen.ts +125 -0
  41. package/examples/cafe/menu.html +55 -0
  42. package/examples/cafe/menu.json +41 -0
  43. package/examples/cafe/menu.ts +84 -0
  44. package/examples/cafe/migrations/001-cafe.ts +11 -0
  45. package/examples/cafe/order.html +37 -0
  46. package/examples/cafe/order.ts +45 -0
  47. package/examples/cafe/rail-drag.ts +30 -0
  48. package/examples/cafe/routes.ts +32 -0
  49. package/examples/cafe/staff.json +20 -0
  50. package/examples/cafe/stories.jsonl +43 -0
  51. package/examples/cafe/supplies.html +77 -0
  52. package/examples/cafe/supplies.json +33 -0
  53. package/examples/cafe/supplies.ts +170 -0
  54. package/examples/cafe/till.json +95 -0
  55. package/examples/cafe/till.ts +122 -0
  56. package/examples/cafe/trust.ts +20 -0
  57. package/examples/cafe/views.ts +171 -0
  58. package/examples/docs.ts +28 -0
  59. package/examples/film.jpg +0 -0
  60. package/examples/hello/generated/elements.ts +45 -0
  61. package/examples/hello/generated/queries.ts +24 -0
  62. package/examples/hello/generated/rules.ts +45 -0
  63. package/examples/hello/hello.css +27 -0
  64. package/examples/hello/hello.json +1 -0
  65. package/examples/hello/index.html +32 -0
  66. package/examples/hello/migrations/001-hello.ts +6 -0
  67. package/examples/hello/page.ts +49 -0
  68. package/examples/hello/routes.ts +6 -0
  69. package/examples/hello/stories.jsonl +3 -0
  70. package/examples/index.html +146 -0
  71. package/examples/page.ts +11 -0
  72. package/examples/people/adding.ts +20 -0
  73. package/examples/people/generated/elements.ts +68 -0
  74. package/examples/people/generated/queries.ts +28 -0
  75. package/examples/people/generated/rules.ts +85 -0
  76. package/examples/people/links.ts +124 -0
  77. package/examples/people/migrations/001-people.ts +6 -0
  78. package/examples/people/migrations/002-add-people-member-and-guard-people.ts +7 -0
  79. package/examples/people/migrations/003-add-people-rank-and-guard-people.ts +7 -0
  80. package/examples/people/order.ts +61 -0
  81. package/examples/people/people.css +65 -0
  82. package/examples/people/people.json +26 -0
  83. package/examples/people/routes.ts +12 -0
  84. package/examples/people/stories.jsonl +20 -0
  85. package/examples/people/trust.ts +14 -0
  86. package/examples/people/view.ts +115 -0
  87. package/examples/routes.ts +11 -0
  88. package/examples/trip/answer-rows.ts +70 -0
  89. package/examples/trip/answers.ts +11 -0
  90. package/examples/trip/bar.ts +89 -0
  91. package/examples/trip/calendar-map.css +709 -0
  92. package/examples/trip/calendar-map.ts +249 -0
  93. package/examples/trip/drags.ts +143 -0
  94. package/examples/trip/drawer.ts +250 -0
  95. package/examples/trip/event-form.ts +199 -0
  96. package/examples/trip/generated/elements.ts +144 -0
  97. package/examples/trip/generated/queries.ts +46 -0
  98. package/examples/trip/generated/rules.ts +239 -0
  99. package/examples/trip/holding.ts +61 -0
  100. package/examples/trip/ics.ts +117 -0
  101. package/examples/trip/index.html +82 -0
  102. package/examples/trip/line-stops.ts +92 -0
  103. package/examples/trip/line-words.ts +79 -0
  104. package/examples/trip/line.ts +121 -0
  105. package/examples/trip/map.ts +234 -0
  106. package/examples/trip/mercator.ts +28 -0
  107. package/examples/trip/migrations/001-trip.ts +7 -0
  108. package/examples/trip/migrations/002-add-events-zone-and-guard-events.ts +7 -0
  109. package/examples/trip/migrations/003-guard-events-and-create-events_asked-and-more.ts +9 -0
  110. package/examples/trip/migrations/004-create-stays.ts +6 -0
  111. package/examples/trip/migrations/005-guard-events-and-create-events_arrives-and-more.ts +8 -0
  112. package/examples/trip/month.ts +87 -0
  113. package/examples/trip/other-weeks.ts +67 -0
  114. package/examples/trip/page.ts +121 -0
  115. package/examples/trip/peek.ts +71 -0
  116. package/examples/trip/people-chips.ts +74 -0
  117. package/examples/trip/place-search.ts +51 -0
  118. package/examples/trip/places.ts +34 -0
  119. package/examples/trip/routes.ts +27 -0
  120. package/examples/trip/shell.ts +39 -0
  121. package/examples/trip/stays.css +51 -0
  122. package/examples/trip/stays.ts +68 -0
  123. package/examples/trip/stories.jsonl +72 -0
  124. package/examples/trip/time.ts +46 -0
  125. package/examples/trip/told.ts +48 -0
  126. package/examples/trip/trip.json +69 -0
  127. package/examples/trip/trust.ts +51 -0
  128. package/examples/trip/week.ts +237 -0
  129. package/examples/trip/words.ts +4 -0
  130. package/examples/trip/writes.ts +91 -0
  131. package/examples/trip/zones.ts +16 -0
  132. package/examples/trips/card.ts +149 -0
  133. package/examples/trips/generated/elements.ts +60 -0
  134. package/examples/trips/generated/queries.ts +28 -0
  135. package/examples/trips/generated/rules.ts +62 -0
  136. package/examples/trips/index.html +47 -0
  137. package/examples/trips/map.ts +52 -0
  138. package/examples/trips/migrations/001-trips.ts +8 -0
  139. package/examples/trips/new-trip.ts +46 -0
  140. package/examples/trips/page.ts +9 -0
  141. package/examples/trips/routes.ts +7 -0
  142. package/examples/trips/stories.jsonl +12 -0
  143. package/examples/trips/trips.css +183 -0
  144. package/examples/trips/trips.json +7 -0
  145. package/examples/weeks/derive.ts +23 -0
  146. package/examples/weeks/generated/elements.ts +52 -0
  147. package/examples/weeks/generated/rules.ts +33 -0
  148. package/examples/weeks/routes.ts +4 -0
  149. package/examples/weeks/weeks.json +1 -0
  150. package/examples/welcome.css +299 -0
  151. package/package.json +55 -4
  152. package/src/attachment.ts +70 -0
  153. package/src/cli.ts +52 -0
  154. package/src/client.ts +98 -0
  155. package/src/compile.ts +2034 -0
  156. package/src/css.d.ts +5 -0
  157. package/src/definitions.ts +268 -0
  158. package/src/demo.css +29 -0
  159. package/src/demo.ts +42 -0
  160. package/src/draft.ts +69 -0
  161. package/src/engine.ts +288 -0
  162. package/src/file-value.ts +13 -0
  163. package/src/files.ts +187 -0
  164. package/src/follow.ts +56 -0
  165. package/src/hues.ts +3 -0
  166. package/src/icon-names.ts +77 -0
  167. package/src/icon.png +0 -0
  168. package/src/icons.ts +32 -0
  169. package/src/keep.ts +33 -0
  170. package/src/link.ts +31 -0
  171. package/src/mcp.ts +252 -0
  172. package/src/members/demo.ts +53 -0
  173. package/src/members/generated/elements.ts +68 -0
  174. package/src/members/generated/queries.ts +29 -0
  175. package/src/members/generated/rules.ts +65 -0
  176. package/src/members/group.ts +294 -0
  177. package/src/members/keys.ts +221 -0
  178. package/src/members/members.json +9 -0
  179. package/src/members/migrations/001-members.ts +6 -0
  180. package/src/members/migrations/002-guard-members.ts +11 -0
  181. package/src/members/migrations/003-add-members-act-and-guard-members.ts +7 -0
  182. package/src/members/panel.css +208 -0
  183. package/src/members/panel.ts +398 -0
  184. package/src/members/routes.ts +4 -0
  185. package/src/members/stories.jsonl +27 -0
  186. package/src/members/trust.ts +116 -0
  187. package/src/migrate.ts +597 -0
  188. package/src/migrations/001-joined.ts +13 -0
  189. package/src/migrations/002-group-keys.ts +16 -0
  190. package/src/migrations/003-change-inverse.ts +10 -0
  191. package/src/migrations/004-change-followed.ts +6 -0
  192. package/src/ops.ts +61 -0
  193. package/src/page.css +79 -0
  194. package/src/page.ts +413 -0
  195. package/src/parts.css +471 -0
  196. package/src/parts.ts +152 -0
  197. package/src/server.ts +862 -0
  198. package/src/settings.ts +94 -0
  199. package/src/starter.ts +89 -0
  200. package/src/store.ts +815 -0
  201. package/src/stories.ts +387 -0
  202. package/src/toast.ts +52 -0
  203. package/src/together.ts +167 -0
  204. package/src/tokens.css +85 -0
  205. package/src/tokens.json +457 -0
  206. package/src/upkeep.ts +86 -0
  207. package/src/visitors.ts +43 -0
  208. package/src/write.ts +567 -0
  209. package/starter/CLAUDE.md +37 -0
  210. package/starter/gitignore +3 -0
  211. package/starter/tests/hello-page.test.ts +14 -0
  212. package/starter/tests/hello.test.ts +8 -0
  213. package/starter/tsconfig.json +17 -0
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 blueshed.co.uk
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,116 @@
1
- # Temporary Holding Version
1
+ # joined
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Write what people do, one story a line. Get a live, shared app whose page _is_ the document.**
4
+
5
+ ![A trip's events, on a calendar and a map: the dinner picked on both](docs/trip.png)
6
+
7
+ Open the trip in two windows and drag the dinner to Thursday: it moves in both, at once. Drag its
8
+ pin across the map, and the other window's pin follows. Nothing in between holds a copy. Each
9
+ event is an element on the page, and the calendar and the map are two drawings of the same
10
+ elements.
11
+
12
+ ## Why it's different
13
+
14
+ - **Stories are the source.** You don't write a schema, an API or a model. You write what people
15
+ do, one story a line, and joined works out the rest from them: what the document holds, what may
16
+ change, and what's refused. The same stories are the tests.
17
+ - **The page is the document.** Every event is a `<j-event>` element, with its fields as
18
+ attributes. A change is an op on a path (`replace /events/3/start`), and it lands on exactly one
19
+ element. There's no virtual DOM, and no store beside the page.
20
+ - **Drawing is separate from holding.** A display, like `<calendar-map>`, holds the elements and
21
+ draws them in its shadow, moving only what changed. Add a third way of seeing the same events
22
+ without touching the other two.
23
+ - **What you still write is how it looks.** joined writes the data: what a document holds, who may
24
+ change what, the tables, the elements and their methods, and the tests. A view or a display is
25
+ yours, by hand: for the trip, the compiler writes about 400 lines, and `<calendar-map>` is about 1,700, a file for
26
+ each of its parts; the
27
+ cafe's kitchen, `<kitchen-rail>`, a small one, about 100.
28
+ - **Links are plain HTML.** An event links to people as `people="1 3"`, so CSS finds who's on
29
+ what: `[people~="2"]`.
30
+ - **Sign-in is a link.** Your link is who you are, on every device. Friends who invite people
31
+ hold their links and can give them again. Behind them all is a kind BDFL, who always says why.
32
+ - **Small.** Bun, web components and one dependency (lucide, for icons), and PGlite, optional, for a
33
+ Postgres store; the migrations are joined's own. The compiler, the server, the page's side and the store
34
+ together are about 4,200 lines of code, and a change to one of 100,000 events costs at most twice one of 1,000
35
+ (`bun run claims` counts the one and times the other).
36
+
37
+ ## Try it
38
+
39
+ ```
40
+ bun install
41
+ echo ROOT_TOKEN=42 > .env # a local link you can type: http://localhost:3380/auth/42
42
+ bun run dev
43
+ ```
44
+
45
+ Open your link, then the trips and Japan, in two windows. Without `.env`, joined is open to anyone who can
46
+ reach it, but nobody has a role: the trips are their organisers' and travellers', so they're no one's.
47
+
48
+ ## Claude, in a chat
49
+
50
+ Claude can read and change a joined app from a chat on claude.ai, on your phone too:
51
+
52
+ 1. Open the group (your avatar), go to **Agents**, and make one labelled `claude`.
53
+ 2. Copy its connector address (`…/mcp/<its token>`).
54
+ 3. In claude.ai, add it as a custom connector.
55
+ 4. Ask Claude to read a document or change it.
56
+
57
+ Each change Claude makes is yours, marked "via claude", under the same rules as a page's, and every open page
58
+ shows it at once. A change made on a page reaches Claude the same way. Keep the address to yourself: it is the
59
+ agent's link. Take it back from the same tab whenever you like.
60
+
61
+ An app with no members (hello, or one made by `bun create joined`) has no group to make an agent in: it's anyone's,
62
+ so its connector address is `…/mcp`, with no link, and Claude changes it as anyone would on its page.
63
+
64
+ ## Your own apps
65
+
66
+ joined is a package: a project takes it as a dependency and keeps its apps in `apps/`, each a
67
+ folder like those in `examples/`. Once it's published (as `@blueshed/joined`), an app begins with:
68
+
69
+ ```
70
+ bun create joined my-app
71
+ cd my-app && bun run dev
72
+ ```
73
+
74
+ That makes `my-app/` with joined in it (as `joined`), hello in `apps/`, the skill for Claude, a CLAUDE.md, a
75
+ test telling hello's stories, and the scripts: `dev`, `compile` (each app's `generated/` and migrations, from
76
+ its stories), `start` (serves `apps/`, keeping what the pages change in `.data/`), `link`, `upgrade` and `test`.
77
+ `bun run upgrade` moves it to the newest joined and refreshes the skill.
78
+
79
+ Until then, try it from a tarball: `bun run pack` in joined makes `.pack/blueshed-joined-<version>.tgz`, and
80
+ `JOINED_FROM=<that tarball> bun <joined>/create/index.ts my-app` makes the app on it. Never take joined's folder
81
+ itself (`file:../joined`): Bun copies a folder dependency whole, `.data/` (the store, and the members' keys)
82
+ included.
83
+
84
+ An app imports joined by its name, `joined/page`, `joined/draft`, `joined/parts` and the rest
85
+ (`package.json`'s `exports`), and a page links `joined/tokens.css` and `joined/page.css`, every page's layout. joined's own examples do the
86
+ same. A project's group begins from its own `apps/members.json`, if it gives one, else joined's.
87
+ Its stories are its tests: `tell(doc)` from `joined/stories` tells each on a server of its own and
88
+ says what didn't go as it says (`expect(await tell("notes")).toEqual([])`).
89
+
90
+ ## A taste
91
+
92
+ One line of `examples/hello/stories.jsonl`:
93
+
94
+ ```jsonl
95
+ {"story":"Someone changes the greeting, and every page shows it","does":{"doc":"hello","ops":[{"op":"replace","path":"/greeting","value":"Hello, Japan"}]}}
96
+ ```
97
+
98
+ From that line and its neighbours, joined compiles `<j-hello>`, the document as one element, its greeting
99
+ an attribute, that can do only what the stories do: change the greeting, to words. The server refuses
100
+ anything else and says why. The story itself is run as a test, by someone signed in as nobody: hello is anonymous.
101
+
102
+ ## Where next
103
+
104
+ - **[docs/introduction.md](docs/introduction.md):** how stories, ops on the page and displays fit
105
+ together, with pictures (also at `/docs/introduction` on a running joined).
106
+ - **[docs/stories.md](docs/stories.md):** the stories language: what a line of `stories.jsonl` may say.
107
+ - **[docs/design.md](docs/design.md):** how it looks: colour, type, icons, layout and parts.
108
+ - **[docs/plan.md](docs/plan.md):** joined as it's aimed, self-contained: the architecture, the
109
+ words, what's decided and why, every story and seed, what's built, and the phases still to build.
110
+ - **[compiled-documents.md](../docs/architecture/compiled-documents.md):** where it came from.
111
+ joined joins dzql (documents compiled from stories), doclets (routes and resources) and fewer
112
+ (rows as elements) into one idea.
113
+
114
+ ## Licence
115
+
116
+ MIT, blueshed.co.uk: [LICENSE](LICENSE).
package/docs/design.md ADDED
@@ -0,0 +1,148 @@
1
+ # joined
2
+
3
+ How every joined page looks and moves. This page says the rules, and names the tokens and parts it
4
+ means; it holds no values. The values are the tokens (`src/tokens.json`); the parts are the
5
+ components (`design/`, each a guideline and a preview, drawn by joined's own stylesheets); the icons
6
+ and the logo are the assets. `bun run design` makes `src/tokens.css` from the tokens and builds the
7
+ published design system from all of it, so a change to the look is made here, in the code, never on
8
+ the system's page. Where joined doesn't meet a rule yet, the rule says so, with its item in
9
+ `todo.jsonl`. The look comes down from fewer's design system and Paintbrush's plain look:
10
+ hairlines, black controls, 4px corners, no shadows, plain words.
11
+
12
+ ## What a page is for
13
+
14
+ A page brings what a person needs to act to one place. It says where they are and what they can do,
15
+ and offers nothing they can't.
16
+
17
+ ### Three surfaces, three meanings
18
+
19
+ - **The page** shows what is here: a document's collection, in its readings.
20
+ - **A drawer** (Drawer) is editing: one thing's own fields, its deeds at its foot. Docked at the
21
+ right, `panel` wide; on a phone, a sheet rising from the foot. The page stays behind it, as it was.
22
+ Its changes wait in it until Save.
23
+ - **A modal** (Modal, New event) is new or delete: one question, one answer, gone. It never edits.
24
+ Removing, or anything that can't be taken back, is always asked first in the app's own modal,
25
+ never the browser's `confirm()`.
26
+ - **A sheet** (Sheet, The group) shows a list beside the page. It has a title and its ×, and closes
27
+ when you tap away. A form in it is laid out as a drawer's: its fields one under another, its deeds at
28
+ its foot, removing apart.
29
+ - **Each keeps its head and its foot in view.** A drawer, a modal and a sheet always show what it is
30
+ (its title, its ×) and what you may do (its deeds, a sheet's add field); only what's between them
31
+ scrolls, however tall it grows, under a band of its card (8px) below the head and above the foot, so
32
+ nothing half scrolled away touches a title or a button.
33
+
34
+ A row or a block displays; tapping it opens its drawer.
35
+
36
+ ### A page shows one thing, in its readings
37
+
38
+ A page shows one document's collection in a reading: a list, a calendar, a map, a line. Nothing is
39
+ shown twice: the trip's week and its map are its events read two ways, one page split between them;
40
+ the week is read as a calendar or as a Line, or the month (Month) as a grid of its six weeks, the views beside them choosing, the map beside each. On a phone, a pin tapped peeks (Peek) before anything opens. A
41
+ place with a picture is drawn as it (a trip is its week and its map), never as a box of sections. A new reading is a new display over the same elements, never a new copy of the data.
42
+
43
+ ### What a tap does
44
+
45
+ - A tap on something named is that thing, in one tap.
46
+ - Nothing opens by itself, and closing changes nothing. One thing open at a time; Escape closes it.
47
+ Back closes it too, what's open being in the URL's hash (`#event=2`), so a link opens it again.
48
+ - Offer only what this person may do: each element's `may` says it, from the grants and their roles
49
+ (`add` on a collection; `remove`, `replace:price`, a move `replace:status>ready` on an item), and a
50
+ control it doesn't name isn't there (the cafe's till offers a cook nothing). The group's sheet offers
51
+ what each may by its own rules.
52
+ - Every write says what it did, where the person is: done, the change shows, on every page alike;
53
+ refused, and why, beside the control that sent it (Said), to that person alone. Nothing typed is
54
+ lost to a refusal.
55
+ - Away, what's shown dims, as it may be behind, and the group's button says it's coming back (Away).
56
+
57
+ ### What a drag does
58
+
59
+ - A drag changes a thing along its reading's axes, and only what this person may change.
60
+ - Where it's let go is where it goes: a block lands on the day under the pointer, its start in
61
+ 15-minute steps; its `grip` makes it longer or shorter, never under 15 minutes; a pin lands where
62
+ it's let go. It shows where it would land as it goes, the saved one a ghost behind (Event block,
63
+ Map pin).
64
+ - A drag never taps: letting go opens nothing but the drawer holding the change.
65
+ - A phone drags too, with pointer events, never HTML drag and drop. A finger presses and holds to pick a
66
+ thing up (`held()`, the trip's `follow.ts`), so a swipe still scrolls the page, and a tap is still a tap; a
67
+ mouse picks it up at once.
68
+ - The map is a place to look round: dragged on its ground it pans, nearer and farther by its buttons, a pinch or
69
+ a trackpad's; where it's put, it stays while the week does. The wheel alone scrolls the page.
70
+ - An order is dragged by its grip (`grip`), held by a finger: the row follows the pointer, and let go it takes a
71
+ place between its new neighbours, on every page. The arrow keys on the grip move it a place at a time.
72
+ - Whatever a drag can do, the drawer's fields can do too.
73
+
74
+ ### Choosing
75
+
76
+ - Six choices or fewer are shown as themselves: People chips, or a select.
77
+ - More than six is a typeahead, never a select: type, and the matches drop beneath (`typeahead()`,
78
+ `joined/parts`; the Place search, and an event's people past six).
79
+ - Several of many are chips, each with its ×, and a typeahead for the rest (People, past six). Never a
80
+ native multi-select. Six or fewer, they're chips to press (People chips).
81
+
82
+ ## Colour
83
+
84
+ - **The controls are black.** Links, focus and what is open or pressed are `accent`; the one button
85
+ that makes or keeps is `add` with `add-ink`. Never blue.
86
+ - **`danger` is for taking away, and for a refusal,** nothing else: Remove, a refusal's words. Filled (`danger` with `danger-ink`) only as a modal's answer.
87
+ - **The ground is `paper`; what sits on it is `card`,** framed by a 1px `edge`. Hairlines between
88
+ rows and hours are `line`. A recess (the map before its tiles) is `well`. Labels, notes
89
+ and an icon at rest are `muted`.
90
+ - **Colour is for identity, never for a control.** A thing with a colour has it everywhere it shows,
91
+ so the eye joins them: a person's chip and their dot on each event; an event's block and its pin
92
+ (Identity). Its hue is `hue-0` … `hue-9` by its key's last digit; a kind of thing with no key, a fixed few (a
93
+ shop's aisles), by its place in their list. Hues join things in one collection; the same digit in another means
94
+ nothing.
95
+ - **A chip and a block are a tint and a stripe:** the hue at `tint` over `card` (`tint-strong`
96
+ under the pointer, or picked), a 3px stripe of the hue at the left, the words in `ink`. Never solid
97
+ with white words: white misses 3:1 on five of the ten hues.
98
+ - **A pin is solid:** its hue in a 2px white ring, `pin` across.
99
+ - **Picked is a 2px `ink` outline,** on the block and the pin both.
100
+ - **A control's border is `control-edge`, 3:1 on `card`:** a field, a chip not pressed, a day on the strip,
101
+ a small tool. A frame (the calendar, the map, a drawer, a card) keeps the soft `edge`: it isn't a control.
102
+
103
+ ## Type
104
+
105
+ One family, the system's own sans. Every text joined draws is one of the thirteen styles, never a size by
106
+ hand. A landing page (the root, a list of trips) speaks up: `display` its headline, `lead` the words under it,
107
+ `section` a section's name, and `name` a thing's name on its card. Every page is named in `section`, under joined at its top (Page head). Inside a page: `heading` a part's name, `title` a drawer's, modal's or sheet's, `row` a row's words, `label` a
108
+ label and a day's name, `tool` a button's word, `small` a note, the toast and a notice, `tiny` inside the
109
+ calendar, `body` the rest, and `field` every field, which a phone would zoom into if it were smaller.
110
+
111
+ ## Icons
112
+
113
+ An icon is a word the page says in a picture, so each has one meaning, everywhere (Icons, and the
114
+ Icons assets).
115
+
116
+ - Lucide's, and only Lucide's, by joined's own names. Never an emoji, another set, or one drawn by
117
+ hand.
118
+ - Drawn as Lucide draws them, in its control's colour: `muted` at rest, `ink` under the pointer,
119
+ `danger` on Remove.
120
+ - A harmless deed is an icon alone (Icon button), its label saying the deed. Never a word link.
121
+ - A deed that makes, keeps or removes says its word, its icon beside it (Button).
122
+
123
+ ## Layout
124
+
125
+ - **One breakpoint, 40rem.** Above it the drawer docks at the right and the week stands beside the
126
+ map; below it the drawer and a sheet rise from the foot, and the trip is a strip of its days (Day
127
+ strip) over one day.
128
+ - **A page is 72rem at most, its sides the `gutter`:** 1rem on a phone, 1.5rem where there's room. A row
129
+ that runs to the screen's edges bleeds by the gutter's name, `calc(-1 * var(--gutter))`, never its number.
130
+ - **Every space is a token** (`space-4` … `space-64`), on one scale, never a number of rem or px by hand.
131
+ - **Under a finger, 44px:** a button (`touch`), an icon button (`control`) and a field.
132
+ - **4px corners everywhere** (`radius`), a card's too; 3px inside a 4px box; a tag is a pill; a dot and a face are round.
133
+ - **No shadows.** A drawer, a modal and a sheet are set apart by a 1px `edge`.
134
+
135
+ ## Words
136
+
137
+ - A button names its deed: "Add", "Save", "Never mind", "Remove". Never "OK" or "Submit".
138
+ - Sentence case; labels in plain words.
139
+ - A note says what isn't there ("Nothing links here yet"), and a held change what will happen to it
140
+ ("Not kept yet: Save keeps it, Never mind puts it back").
141
+ - A refusal says why, in the server's own words, never a code.
142
+ - A modal's question says what goes and what goes with it ("Dev will be removed. Sam moves up to
143
+ Nora.").
144
+
145
+ ## Motion
146
+
147
+ A drawer rises into place in 200ms, a modal in 160ms, and the Toast fades; nothing else moves, and
148
+ under `prefers-reduced-motion` nothing does (`src/parts.css`, `rise`).
@@ -0,0 +1,193 @@
1
+ <img src="logo.svg" alt="joined" style="width:64px;height:64px;margin:0 0 0.5rem">
2
+
3
+ # An Introduction to `joined`
4
+
5
+ `joined` turns user stories into real-time, multi-user web applications where **the page itself is
6
+ the document**.
7
+
8
+ Most web stacks keep three copies of everything: rows in a database, JSON objects in a client-side
9
+ state store (like Pinia or Redux), and nodes in a Virtual DOM that diff into the real DOM. Every
10
+ feature has to be written four times: a schema, an API endpoint, a store action, and a component.
11
+
12
+ `joined` collapses that stack into two operations—**reduce** and **map**:
13
+
14
+ 1. **Stories reduce into the model.** You write what people do, one JSON line per story. The
15
+ compiler reduces those stories into server validation rules, SQLite table migrations, and typed
16
+ HTML custom elements.
17
+ 2. **Ops reduce into the light DOM; displays map the light DOM into their shadow DOM.** The wire
18
+ carries tiny JSON Patch ops (`/events/3/start`). On the page, each item is an HTML element and
19
+ each field is an attribute. Displays watch those elements and move only what changed.
20
+
21
+ ---
22
+
23
+ ## 1. Stories Are the Source
24
+
25
+ An application in `joined` starts as `stories.jsonl`—a plain list of who does what to a document,
26
+ and who sees the result:
27
+
28
+ ```jsonl
29
+ {"story":"The shinkansen leaves an hour later","as":"phone","does":{"doc":"trip:1","ops":[{"op":"replace","path":"/events/3/start","value":"2026-11-06T10:00:00"}]},"seen":["peter","phone"]}
30
+ {"story":"An event cannot link to someone not in people","as":"peter","cannot":{"doc":"trip:1","ops":[{"op":"replace","path":"/events/2/people","value":[1,9]}]}}
31
+ ```
32
+
33
+ You never write a schema file or a REST controller. Running `bun run compile` reads every app's
34
+ stories and generates the server rules, the migrations, and the custom elements:
35
+
36
+ ![How stories compile into server rules, migrations, and custom elements](stories-to-code.svg)
37
+
38
+ - **Capability security by construction:** An operation exists only if a story does it. Because a
39
+ story removes an event's `location`, `<j-event>` gets `removeField("location")`; because no story ever
40
+ removes an event's `title`, `removeField("title")` does not exist on the client, and no grant lets the
41
+ server make it.
42
+ - **Tables and migrations from the same stories:** Each collection becomes a table, each field a
43
+ column, and each list of IDs (`people: [1, 2]`) a table of pairs. When new stories add a field or
44
+ collection, `bun run compile` writes the next numbered migration in `migrations/`.
45
+ - **The stories are the tests:** Every line of `stories.jsonl` is replayed against the real server
46
+ in `bun test`, signed in as the person `as` names (nobody, where a story has no `as`), verifying that `does` ops reach every page in
47
+ `seen` and `cannot` ops are refused.
48
+
49
+ ---
50
+
51
+ ## 2. The Light DOM Is the Document; the Shadow DOM Is the Display
52
+
53
+ Once a collection element (`<j-events>`) is placed on a page, it subscribes to its document on the page's WebSocket and
54
+ populates itself with `<j-event>` children. Each item's `id` is its `key` attribute, and each field
55
+ is an HTML attribute:
56
+
57
+ ```html
58
+ <calendar-map people="people">
59
+ <j-events>
60
+ <j-event
61
+ key="2"
62
+ title="Dinner in Shinjuku"
63
+ start="2026-11-04T19:00:00"
64
+ duration="PT2H"
65
+ location="Shinjuku, Tokyo"
66
+ coordinates="geo:35.6938,139.7034"
67
+ people="1 2"
68
+ ></j-event>
69
+ </j-events>
70
+ </calendar-map>
71
+ ```
72
+
73
+ Just as HTML's `<select>` holds `<option>` elements as data, `<calendar-map>` holds `<j-events>` in
74
+ its light DOM, hides them, and draws them twice in its shadow DOM—once as a block on a calendar day,
75
+ and once as a pin on an OpenStreetMap map:
76
+
77
+ ![Light DOM holds the document; Shadow DOM draws the display](light-and-shadow.svg)
78
+
79
+ - **No store beside the DOM:** `el.data` reads the element's attributes once, freezes the object,
80
+ and caches it until an attribute changes.
81
+ - **Drafts until Save (`src/draft.ts`):** When you drag an event block, stretch its duration, or
82
+ move its pin on the map, the edit is held in a drawer form (`src/draft.ts`)—with the saved event
83
+ drawn faintly behind—until you press **Save**, which sends a single write. If someone else changes
84
+ another field while your drawer is open, the drawer updates that field while keeping your unsaved
85
+ edit intact.
86
+ - **Surgical updates (`MutationObserver` + `keep()`):** When `key="2"`'s `start` attribute changes,
87
+ the `MutationObserver` tells `<calendar-map>` that `<j-event key="2">` mutated, and only that
88
+ event's calendar block moves. Every other node on the page is untouched.
89
+
90
+ ---
91
+
92
+ ## 3. One Socket per Page, Ops on Paths
93
+
94
+ Regardless of how many documents a page holds (a week of Japan's trip, `trip:1?week=2026-11-02`; `people`;
95
+ `members`), the browser opens a single `/ws` connection per tab.
96
+
97
+ When Peter drags an event on his laptop and clicks **Save**, the element dispatches its compiled op:
98
+
99
+ ![How a single op travels from one browser through the server to every other browser](wire-op.svg)
100
+
101
+ 1. **On the wire:**
102
+ `{ doc: "trip:1?week=2026-11-02", ops: [{ op: "replace", path: "/events/3/start", value: "2026-11-06T10:00:00" }] }`.
103
+ 2. **At the server (`src/server.ts` & `src/store.ts`):**
104
+ - in the write's transaction: the app's trust, the grants (what the stories do, and the writer's roles
105
+ may), and the group's rules (`group.write`);
106
+ - the tables' own guards, as the rows are written: each value's CHECK, named for the words it's refused
107
+ in, and triggers for what an add needs and a link's target.
108
+ - `store.write(doc, ops, by, via)` applies the ops and records the change in `changes` inside a
109
+ single transaction (SQLite, or Postgres), then `publish()` reads the committed change row and sends it via
110
+ Bun's WebSocket pub/sub to every tab holding that week; a tab holding another week isn't told.
111
+ 3. **Away and back (`since`):** If a phone sleeps or switches networks, the page marks itself
112
+ `data-away` (keeping any unsaved edit in its form so nothing is lost) and reconnects
113
+ automatically. On reconnect, it sends `{ subscribe: "trip:1?week=2026-11-02", since: version }`. A whole document is
114
+ sent **only the changes it missed** while asleep, falling back to all of it (`whole()`) only if it is more
115
+ than 500 versions behind; a week, a part of one, is sent whole, and put in place by key.
116
+
117
+ ---
118
+
119
+ ## 4. Links as HTML `IDREFS`, and Sign-In as a Trust Tree
120
+
121
+ Two ideas complete the picture: how documents link to one another, and how people (and their AI
122
+ agents) sign in.
123
+
124
+ ![Cross-document IDREFS links and the members trust network](links-and-trust.svg)
125
+
126
+ ### Cross-Document Links (`people="1 2"`)
127
+
128
+ A field holding a list of IDs, named after another document's collection (`people: [1, 2]`), is a
129
+ link.
130
+
131
+ - On the page, it renders as a space-separated HTML `IDREFS` attribute: `people="1 2"`.
132
+ - That means **plain CSS** can query reverse references across any document on the page:
133
+ `document.querySelectorAll('[people~="2"]')` finds every event Kenji is on, without the `people`
134
+ view knowing anything about the trip.
135
+ - On the server, referential integrity is enforced automatically: Kenji cannot be removed from
136
+ `people` while any event in Japan's trip links to him (`"1 event in trip:1 links to it"`).
137
+
138
+ ### Sign-In by Link (`src/members/`)
139
+
140
+ The group of people who may use the app is itself a compiled document, `members`, held on every page
141
+ by `<members-panel><j-members>…</j-members></members-panel>`. A project whose stories have no `as` has
142
+ no group: anyone may read and write.
143
+
144
+ - **Your link is who you are** (`/auth/<token>`), working across your laptop, phone, and tablet.
145
+ - **Friends help friends:** Whoever invited you holds your link too, so if you lose it they can copy
146
+ it for you again; if it leaks, either of you can replace it.
147
+ - **Every act of removal or restriction says why:** If Nick removes Nora (whom he invited), a dialog
148
+ explains what follows and asks for a reason; Dev (whom Nora invited) moves up the tree to Nick. Nick
149
+ may make Nora read-only too, or invite someone so, and give it back. At the root sits the BDFL
150
+ (`ROOT_TOKEN`), who can make a member read-only or remove them anywhere in the tree, and what the BDFL
151
+ made read-only only the BDFL gives back, though the inviter may still remove them—always with a reason
152
+ shown to that person.
153
+ - **Agent links (`via`):** Any member can create a labelled link for an AI agent. The agent connects
154
+ over the same WebSocket and writes under the same compiled `rules.ts`, with its changes attributed
155
+ to its member (`via` the agent), while `group.ts` refuses any attempt by an agent to invite or
156
+ remove members.
157
+
158
+ ### Claude in a Chat (`src/mcp.ts`)
159
+
160
+ An agent's link is also an MCP connector. The Agents tab copies it as `/mcp/<token>`, ready to paste
161
+ into claude.ai's custom connectors, so Claude in a chat, on a phone too, can work with the app.
162
+
163
+ - **Its tools come from the compiled rules.** For each document its member may hold there is a
164
+ `read_<doc>`, the document as that member sees it, and a `write_<doc>`, one write whose ops are
165
+ typed as the stories allow (`replace /greeting`, `add /events/-`). A trip's tools take its `key`.
166
+ - **A write is a page's write.** It lands whole or not at all, under the app's trust rules, the grants
167
+ and the group's, as the member via the agent, and every page holding the document sees it at once. A
168
+ refusal comes back in its own words: "greeting is a string".
169
+ - **An app can brief Claude.** Its `routes.ts` may export `instructions`, said as the connector opens
170
+ (the trip's say how its times and places are written).
171
+ - **Only an agent's link opens the door.** A member's own link, one taken back, or an unknown one is
172
+ refused, and the token is never printed.
173
+
174
+ ---
175
+
176
+ ## 5. An App Is a Folder
177
+
178
+ Everything an app needs lives in one folder under `examples/`:
179
+
180
+ | File | Role |
181
+ | ------------------------ | ----------------------------------------------------------------------------------------- |
182
+ | `stories.jsonl` | What people do to the document—compiles the model and runs as tests |
183
+ | `<doc>.json` | The committed seed where stories and tests begin |
184
+ | `generated/` | Written by `bun run compile`: `rules.ts` (server checks) and `elements.ts` (DOM elements) |
185
+ | `migrations/` | Numbered SQLite table migrations written by `bun run compile` |
186
+ | `<doc>.css` & views | How the document's elements or shadow displays look |
187
+ | `index.html` & `page.ts` | The page and its controls |
188
+ | `routes.ts` | Exports `document` and `routes` (the page and any edges like `/trip/1/trip.ics`) |
189
+
190
+ To read deeper, see [docs/plan.md](plan.md) for `joined` as it's aimed: its architecture, what's decided
191
+ and why, every story and seed, what's built, and the phases still to build. See [docs/design.md](design.md) for how it
192
+ looks: the rules for its surfaces, taps and drags, colour, type, icons and words, whose values and parts
193
+ are `joined`'s design system.
@@ -0,0 +1,76 @@
1
+ # Learning joined
2
+
3
+ Why joined is hard to pick up, and what would make it easier. It isn't the size: the compiler, the
4
+ server, the page's side and the store are about 4,200 lines of code, and every line is tested. It's that a
5
+ newcomer meets several unfamiliar things at once, with nothing familiar to hold on to.
6
+
7
+ ## Why it's hard
8
+
9
+ ### Its own words, chosen for how they read
10
+
11
+ - **The code's names are joined's, not the trade's:** `say()`, `seen()`, `once()`,
12
+ `whole()`, `keep()`, `held`, `behind`, `again`; the group's doors `at`, `admit`, `within`, `after`,
13
+ `edge`. Someone searching for _broadcast_, _subscribe_, _permission_, _validate_ or _schema_ finds
14
+ nothing: those words aren't used.
15
+ - **Some words mean two things.** A _link_ is a field (`people="1 3"`) and a sign-in link. _Told_ is a
16
+ story's refusal words, the page's event, and the server's publish. A _key_ is an item's id
17
+ attribute and a member's secret.
18
+ - **The comments are compressed:** "A link is who you are." "The light DOM is the document; the
19
+ shadow DOM is the display." Each is right, and lovely once you know the system; before that, each
20
+ is a riddle.
21
+
22
+ ### About forty ideas before anything past hello
23
+
24
+ The plan's table of words has over thirty: story, cast, premise, seen, unseen, document, kind,
25
+ instance, collection, item, field, link, role, owns, grant, may, trust, the group, BDFL, agent's
26
+ link, view, display, reading, applier and more. Then the who-paths have a syntax of their own:
27
+ `posts[role=keeper]@members`, `members/members[!inviter]`, `@owners`. Each is simple; you need most
28
+ of them at once.
29
+
30
+ ### What's allowed is inferred, so it can't be read
31
+
32
+ A field is needed if every story that adds one gives it. An op is granted to its teller's
33
+ narrowest role, as the seeds have them. So to know why a write is refused, you run the compiler in
34
+ your head. `generated/rules.ts` is readable, but it's what came out, not what you wrote, and nothing
35
+ says which story granted what. (`bun run compile` now says when a story lets a needed field go.)
36
+
37
+ ### Stories are written for the machine
38
+
39
+ A story is one JSON line of about 250 characters, with JSON Patch inside. Its ids are the seed's
40
+ (`/events/2`), so the seed is held in your head as you write. There's no shorthand, and no `then` to
41
+ say what the document holds after (todo 36).
42
+
43
+ ### The model is new, and nothing is around it
44
+
45
+ The DOM is the state, a field is a string attribute, and a display is a custom element watching
46
+ its children with a `MutationObserver`. Someone who thinks in components and reactive stores has to
47
+ put that down first. There's no community, no answers to search, and the models that help people code
48
+ don't know joined. The trip's display alone is about 800 lines of DOM by hand.
49
+
50
+ ### The docs are for those who know
51
+
52
+ The best guide, the skill's `reference.md`, is written for an AI, as `CLAUDE.md` is. The README and
53
+ the introduction are good, with pictures, but in the same compressed voice. Until 30 October,
54
+ `docs/plan.md` described another joined.
55
+
56
+ ### A narrow way in
57
+
58
+ Bun only, and Bun 1.4's own (HTML imports, `Bun.WebView`); TypeScript 7; hot reload off; not
59
+ published, so a project takes a tarball; the page tests ran only on a Mac until 30 October; and the
60
+ gate holds every line and function to its tests before a first contribution lands.
61
+
62
+ ## What would help, cheapest first
63
+
64
+ 1. **Plain names in the code, the voice in the docs.** `catchUp` for `behind` (`publish` is
65
+ `told()` no more); or keep joined's and give a table from each to the trade's word.
66
+ 2. **A tutorial:** one small app, from its first story to a display, showing what the compiler
67
+ writes at each step.
68
+ 3. **`joined why <doc> <op>`:** which check refuses it, or which story grants it, and to whom.
69
+ 4. **Stories a person writes:** a shorter form, `then`, and a way to make them that shows what each
70
+ part may be (see below).
71
+
72
+ ## Stories from blocks
73
+
74
+ Item 4 goes further than a shorter syntax: stories made of blocks, each shaped by what it is, so only
75
+ what fits goes together, in the file's own words: one block a key, and the ops add, replace and remove
76
+ (`docs/blocks.md`).
@@ -0,0 +1,82 @@
1
+ # The stories language
2
+
3
+ What a line of `stories.jsonl` may say, and nothing else. It is two layers: the core, which says what is
4
+ written to a document and whether it is done; and members, which says who writes it, who sees it, and who
5
+ mustn't. The compiler refuses a line that says anything more, naming it (`unspoken` in `src/compile.ts`).
6
+
7
+ A story without `as` is anonymous: the core alone, told with nobody signed in. One with `as` is in both layers. A
8
+ project whose stories are all anonymous has no members, and runs without them.
9
+
10
+ ## The core
11
+
12
+ ```
13
+ story := { "story": words,
14
+ "does" | "cannot": write | [write], several writes: one, all or none
15
+ "refused"?: words, with "cannot" alone
16
+ "then"?: { place: json, … }, with "does" alone
17
+ "premise"?: [write] }
18
+ write := { "doc": document, "ops": [op] }
19
+ document := name | name:key | name:$n $n: the instance of a kind the write's nth add made
20
+ place := path | document path menu/items/5/stock: another document's
21
+ op := { "op": "add", "path": "/collection/-", "value": { field: value, … } }
22
+ | { "op": "replace", "path": "/collection/id/field", "value": value }
23
+ | { "op": "remove", "path": "/collection/id" | "/collection/id/field" }
24
+ | { "op": "add", "path": "/collection/id/field/-", "value": id }
25
+ | { "op": "remove", "path": "/collection/id/field/id" }
26
+ value := words | number | true | false | [id]
27
+ | "$n" the id the write's nth add was given
28
+ ```
29
+
30
+ | Word | Means |
31
+ | ------- | ---------------------------------------------------- |
32
+ | story | the sentence |
33
+ | does | the write (or writes) must be done |
34
+ | cannot | the write (or writes) must be refused, none landed |
35
+ | refused | the words a cannot is refused in |
36
+ | then | what each place holds after a does, as JSON |
37
+ | premise | the writes before it |
38
+ | doc | the document written to |
39
+ | ops | the write's ops, all or none |
40
+ | op | `add`, `replace` or `remove` |
41
+ | path | `/collection/id/field`, and `/id` in a list of ids |
42
+ | value | what an add or a replace gives |
43
+ | $n | the write's nth add, whichever of its writes made it |
44
+
45
+ ## Members
46
+
47
+ Members add who writes, who sees, and who mustn't:
48
+
49
+ ```
50
+ line := cast | story
51
+ cast := { "cast": { name: member | null, … } }
52
+ story += { "as": name,
53
+ "seen"?: [name], "unseen"?: [name],
54
+ "premise"?: { name: [write] } } in place of the core's [write]
55
+ write += { "why"?: words }
56
+ name := a member's name, or a cast name
57
+ ```
58
+
59
+ | Word | Means |
60
+ | ------- | ------------------------------------------------------ |
61
+ | as | the member who writes it |
62
+ | seen | who must see the change |
63
+ | unseen | who must never see it |
64
+ | cast | other names for a member's pages, or `null` for nobody |
65
+ | why | the writer's reason |
66
+ | premise | the writes before it, each by its name |
67
+
68
+ ## Examples
69
+
70
+ A message, begun from `{ "messages": [{ "id": 1, "text": "Hello" }] }`.
71
+
72
+ Anonymous, the core alone:
73
+
74
+ ```jsonl
75
+ {"story":"Change the message","does":{"doc":"message","ops":[{"op":"replace","path":"/messages/1/text","value":"Back at six"}]}}
76
+ ```
77
+
78
+ With members: who changed it is the change's `by`, and `seen` holds that Peter's page hears it, by Nick:
79
+
80
+ ```jsonl
81
+ {"story":"Nick changes the message, and Peter sees he did","as":"nick","does":{"doc":"message","ops":[{"op":"replace","path":"/messages/1/text","value":"Back at six"}]},"seen":["peter"]}
82
+ ```