@joe-broadhead/messaging 0.0.0-stage → 0.7.1

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 (273) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +12 -0
  4. package/README.md +36 -2
  5. package/dist/bin/messaging-mcp.js +26524 -0
  6. package/dist/bin/messaging-relay.js +19768 -0
  7. package/dist/bin/messaging.js +15465 -0
  8. package/dist/bin/messagingd.js +29449 -0
  9. package/dist/lib/core-testing.js +1 -0
  10. package/dist/lib/core.js +1 -0
  11. package/dist/lib/ipc-testing.js +1 -0
  12. package/dist/lib/ipc.js +1 -0
  13. package/dist/lib/modules/core/address.js +42 -0
  14. package/dist/lib/modules/core/agent/operations.js +595 -0
  15. package/dist/lib/modules/core/agent/present.js +244 -0
  16. package/dist/lib/modules/core/agent/text.js +79 -0
  17. package/dist/lib/modules/core/agent-tools.js +477 -0
  18. package/dist/lib/modules/core/b64u.js +20 -0
  19. package/dist/lib/modules/core/cards.js +55 -0
  20. package/dist/lib/modules/core/check.js +20 -0
  21. package/dist/lib/modules/core/consent.js +199 -0
  22. package/dist/lib/modules/core/contact-card.js +74 -0
  23. package/dist/lib/modules/core/conversation/context.js +80 -0
  24. package/dist/lib/modules/core/conversation/event.js +100 -0
  25. package/dist/lib/modules/core/conversation/ids.js +38 -0
  26. package/dist/lib/modules/core/conversation/link.js +35 -0
  27. package/dist/lib/modules/core/conversation/log.js +766 -0
  28. package/dist/lib/modules/core/conversation/ratchet.js +243 -0
  29. package/dist/lib/modules/core/conversation/seal.js +198 -0
  30. package/dist/lib/modules/core/delegation.js +174 -0
  31. package/dist/lib/modules/core/directory/device-log.js +258 -0
  32. package/dist/lib/modules/core/directory/epoch.js +103 -0
  33. package/dist/lib/modules/core/directory/handle.js +29 -0
  34. package/dist/lib/modules/core/directory/jelly-device.js +204 -0
  35. package/dist/lib/modules/core/directory/jelly-issuer.js +12 -0
  36. package/dist/lib/modules/core/directory/jelly-token.js +305 -0
  37. package/dist/lib/modules/core/directory/keys-statement.js +43 -0
  38. package/dist/lib/modules/core/directory/link.js +81 -0
  39. package/dist/lib/modules/core/directory/merkle-log.js +250 -0
  40. package/dist/lib/modules/core/directory/person-view.js +197 -0
  41. package/dist/lib/modules/core/directory/person.js +40 -0
  42. package/dist/lib/modules/core/directory/realm.js +59 -0
  43. package/dist/lib/modules/core/directory/smt.js +266 -0
  44. package/dist/lib/modules/core/envelope.js +320 -0
  45. package/dist/lib/modules/core/hash.js +5 -0
  46. package/dist/lib/modules/core/head.js +27 -0
  47. package/dist/lib/modules/core/identity.js +71 -0
  48. package/dist/lib/modules/core/index.js +53 -0
  49. package/dist/lib/modules/core/jcs.js +96 -0
  50. package/dist/lib/modules/core/jelly-host-double.js +35 -0
  51. package/dist/lib/modules/core/jelly-host.js +211 -0
  52. package/dist/lib/modules/core/keys.js +79 -0
  53. package/dist/lib/modules/core/peer-text.js +563 -0
  54. package/dist/lib/modules/core/realm.js +1 -0
  55. package/dist/lib/modules/core/roster.js +454 -0
  56. package/dist/lib/modules/core/schema/a2a.js +85 -0
  57. package/dist/lib/modules/core/schema/common.js +310 -0
  58. package/dist/lib/modules/core/schema/consent.js +120 -0
  59. package/dist/lib/modules/core/schema/conversation.js +292 -0
  60. package/dist/lib/modules/core/schema/delegation.js +58 -0
  61. package/dist/lib/modules/core/schema/directory-frames.js +270 -0
  62. package/dist/lib/modules/core/schema/directory.js +169 -0
  63. package/dist/lib/modules/core/schema/envelope.js +211 -0
  64. package/dist/lib/modules/core/schema/errors.js +104 -0
  65. package/dist/lib/modules/core/schema/index.js +16 -0
  66. package/dist/lib/modules/core/schema/ipc/consent.js +181 -0
  67. package/dist/lib/modules/core/schema/ipc/device.js +276 -0
  68. package/dist/lib/modules/core/schema/ipc/jelly.js +189 -0
  69. package/dist/lib/modules/core/schema/ipc/shapes.js +185 -0
  70. package/dist/lib/modules/core/schema/ipc/surfaces.js +223 -0
  71. package/dist/lib/modules/core/schema/ipc.js +451 -0
  72. package/dist/lib/modules/core/schema/jelly.js +122 -0
  73. package/dist/lib/modules/core/schema/realm.js +27 -0
  74. package/dist/lib/modules/core/schema/relay.js +112 -0
  75. package/dist/lib/modules/core/schema/roster.js +126 -0
  76. package/dist/lib/modules/core/sign.js +43 -0
  77. package/dist/lib/modules/core/task.js +37 -0
  78. package/dist/lib/modules/core/testing.js +21 -0
  79. package/dist/lib/modules/core/ulid.js +36 -0
  80. package/dist/lib/modules/core/version.js +6 -0
  81. package/dist/lib/modules/core/wire.js +255 -0
  82. package/dist/lib/modules/ipc/client.js +289 -0
  83. package/dist/lib/modules/ipc/framing.js +33 -0
  84. package/dist/lib/modules/ipc/index.js +6 -0
  85. package/dist/lib/modules/ipc/paths.js +102 -0
  86. package/dist/lib/modules/ipc/pipes.js +65 -0
  87. package/dist/lib/modules/ipc/rpc.js +8 -0
  88. package/dist/lib/modules/ipc/server.js +317 -0
  89. package/dist/lib/modules/ipc/testing.js +145 -0
  90. package/dist/lib/modules/ipc/trust.js +166 -0
  91. package/dist/lib/modules/ipc/windows-acl.js +275 -0
  92. package/dist/lib/modules/vendor/zod/index.js +7 -0
  93. package/dist/lib/modules/vendor/zod/v4/classic/checks.js +1 -0
  94. package/dist/lib/modules/vendor/zod/v4/classic/coerce.js +17 -0
  95. package/dist/lib/modules/vendor/zod/v4/classic/compat.js +31 -0
  96. package/dist/lib/modules/vendor/zod/v4/classic/deep-partial.js +13 -0
  97. package/dist/lib/modules/vendor/zod/v4/classic/errors.js +57 -0
  98. package/dist/lib/modules/vendor/zod/v4/classic/external.js +17 -0
  99. package/dist/lib/modules/vendor/zod/v4/classic/from-json-schema.js +881 -0
  100. package/dist/lib/modules/vendor/zod/v4/classic/in-out.js +36 -0
  101. package/dist/lib/modules/vendor/zod/v4/classic/iso.js +15 -0
  102. package/dist/lib/modules/vendor/zod/v4/classic/parse.js +16 -0
  103. package/dist/lib/modules/vendor/zod/v4/classic/schemas.js +1535 -0
  104. package/dist/lib/modules/vendor/zod/v4/core/api.js +1107 -0
  105. package/dist/lib/modules/vendor/zod/v4/core/checks.js +516 -0
  106. package/dist/lib/modules/vendor/zod/v4/core/compile.js +1866 -0
  107. package/dist/lib/modules/vendor/zod/v4/core/core.js +141 -0
  108. package/dist/lib/modules/vendor/zod/v4/core/doc.js +38 -0
  109. package/dist/lib/modules/vendor/zod/v4/core/errors.js +267 -0
  110. package/dist/lib/modules/vendor/zod/v4/core/index.js +19 -0
  111. package/dist/lib/modules/vendor/zod/v4/core/json-schema-generator.js +99 -0
  112. package/dist/lib/modules/vendor/zod/v4/core/json-schema-processors.js +843 -0
  113. package/dist/lib/modules/vendor/zod/v4/core/json-schema.js +1 -0
  114. package/dist/lib/modules/vendor/zod/v4/core/memoizer.js +311 -0
  115. package/dist/lib/modules/vendor/zod/v4/core/parse.js +175 -0
  116. package/dist/lib/modules/vendor/zod/v4/core/regexes.js +156 -0
  117. package/dist/lib/modules/vendor/zod/v4/core/registries.js +51 -0
  118. package/dist/lib/modules/vendor/zod/v4/core/schemas.js +2636 -0
  119. package/dist/lib/modules/vendor/zod/v4/core/to-json-schema.js +651 -0
  120. package/dist/lib/modules/vendor/zod/v4/core/util.js +873 -0
  121. package/dist/lib/modules/vendor/zod/v4/core/versions.js +5 -0
  122. package/dist/lib/modules/vendor/zod/v4/core/visit.js +169 -0
  123. package/dist/lib/modules/vendor/zod/v4/locales/ar.js +111 -0
  124. package/dist/lib/modules/vendor/zod/v4/locales/az.js +110 -0
  125. package/dist/lib/modules/vendor/zod/v4/locales/be.js +168 -0
  126. package/dist/lib/modules/vendor/zod/v4/locales/bg.js +125 -0
  127. package/dist/lib/modules/vendor/zod/v4/locales/bn.js +113 -0
  128. package/dist/lib/modules/vendor/zod/v4/locales/ca.js +112 -0
  129. package/dist/lib/modules/vendor/zod/v4/locales/ckb.js +133 -0
  130. package/dist/lib/modules/vendor/zod/v4/locales/cs.js +116 -0
  131. package/dist/lib/modules/vendor/zod/v4/locales/da.js +120 -0
  132. package/dist/lib/modules/vendor/zod/v4/locales/de.js +113 -0
  133. package/dist/lib/modules/vendor/zod/v4/locales/el.js +112 -0
  134. package/dist/lib/modules/vendor/zod/v4/locales/en.js +125 -0
  135. package/dist/lib/modules/vendor/zod/v4/locales/eo.js +114 -0
  136. package/dist/lib/modules/vendor/zod/v4/locales/es.js +136 -0
  137. package/dist/lib/modules/vendor/zod/v4/locales/fa.js +119 -0
  138. package/dist/lib/modules/vendor/zod/v4/locales/fi.js +117 -0
  139. package/dist/lib/modules/vendor/zod/v4/locales/fr-CA.js +112 -0
  140. package/dist/lib/modules/vendor/zod/v4/locales/fr.js +129 -0
  141. package/dist/lib/modules/vendor/zod/v4/locales/gu.js +113 -0
  142. package/dist/lib/modules/vendor/zod/v4/locales/he.js +221 -0
  143. package/dist/lib/modules/vendor/zod/v4/locales/hi.js +111 -0
  144. package/dist/lib/modules/vendor/zod/v4/locales/hr.js +126 -0
  145. package/dist/lib/modules/vendor/zod/v4/locales/hu.js +113 -0
  146. package/dist/lib/modules/vendor/zod/v4/locales/hy.js +158 -0
  147. package/dist/lib/modules/vendor/zod/v4/locales/id.js +111 -0
  148. package/dist/lib/modules/vendor/zod/v4/locales/index.js +63 -0
  149. package/dist/lib/modules/vendor/zod/v4/locales/is.js +114 -0
  150. package/dist/lib/modules/vendor/zod/v4/locales/it.js +113 -0
  151. package/dist/lib/modules/vendor/zod/v4/locales/ja.js +112 -0
  152. package/dist/lib/modules/vendor/zod/v4/locales/ka.js +117 -0
  153. package/dist/lib/modules/vendor/zod/v4/locales/kh.js +5 -0
  154. package/dist/lib/modules/vendor/zod/v4/locales/km.js +115 -0
  155. package/dist/lib/modules/vendor/zod/v4/locales/kn.js +116 -0
  156. package/dist/lib/modules/vendor/zod/v4/locales/ko.js +116 -0
  157. package/dist/lib/modules/vendor/zod/v4/locales/lt.js +207 -0
  158. package/dist/lib/modules/vendor/zod/v4/locales/mk.js +114 -0
  159. package/dist/lib/modules/vendor/zod/v4/locales/ms.js +112 -0
  160. package/dist/lib/modules/vendor/zod/v4/locales/ne.js +111 -0
  161. package/dist/lib/modules/vendor/zod/v4/locales/nl.js +115 -0
  162. package/dist/lib/modules/vendor/zod/v4/locales/nn.js +113 -0
  163. package/dist/lib/modules/vendor/zod/v4/locales/no.js +113 -0
  164. package/dist/lib/modules/vendor/zod/v4/locales/ota.js +114 -0
  165. package/dist/lib/modules/vendor/zod/v4/locales/pl.js +114 -0
  166. package/dist/lib/modules/vendor/zod/v4/locales/ps.js +119 -0
  167. package/dist/lib/modules/vendor/zod/v4/locales/pt-BR.js +143 -0
  168. package/dist/lib/modules/vendor/zod/v4/locales/pt.js +142 -0
  169. package/dist/lib/modules/vendor/zod/v4/locales/ro.js +122 -0
  170. package/dist/lib/modules/vendor/zod/v4/locales/ru.js +168 -0
  171. package/dist/lib/modules/vendor/zod/v4/locales/sk.js +116 -0
  172. package/dist/lib/modules/vendor/zod/v4/locales/sl.js +114 -0
  173. package/dist/lib/modules/vendor/zod/v4/locales/sv.js +115 -0
  174. package/dist/lib/modules/vendor/zod/v4/locales/ta.js +115 -0
  175. package/dist/lib/modules/vendor/zod/v4/locales/tg.js +117 -0
  176. package/dist/lib/modules/vendor/zod/v4/locales/th.js +115 -0
  177. package/dist/lib/modules/vendor/zod/v4/locales/tk.js +107 -0
  178. package/dist/lib/modules/vendor/zod/v4/locales/tr.js +110 -0
  179. package/dist/lib/modules/vendor/zod/v4/locales/ua.js +5 -0
  180. package/dist/lib/modules/vendor/zod/v4/locales/uk.js +113 -0
  181. package/dist/lib/modules/vendor/zod/v4/locales/ur.js +115 -0
  182. package/dist/lib/modules/vendor/zod/v4/locales/uz.js +113 -0
  183. package/dist/lib/modules/vendor/zod/v4/locales/vi.js +113 -0
  184. package/dist/lib/modules/vendor/zod/v4/locales/yo.js +112 -0
  185. package/dist/lib/modules/vendor/zod/v4/locales/zh-CN.js +114 -0
  186. package/dist/lib/modules/vendor/zod/v4/locales/zh-TW.js +112 -0
  187. package/dist/lib/testing-jelly-id.js +1219 -0
  188. package/dist/lib/zod.js +1 -0
  189. package/dist/spec/messaging-v1.md +3744 -0
  190. package/dist/third-party-notices.md +239 -0
  191. package/dist/third-party.json +88 -0
  192. package/dist/types/core/address.d.ts +16 -0
  193. package/dist/types/core/agent/operations.d.ts +129 -0
  194. package/dist/types/core/agent/present.d.ts +57 -0
  195. package/dist/types/core/agent/text.d.ts +62 -0
  196. package/dist/types/core/agent-tools.d.ts +966 -0
  197. package/dist/types/core/b64u.d.ts +6 -0
  198. package/dist/types/core/cards.d.ts +21 -0
  199. package/dist/types/core/check.d.ts +10 -0
  200. package/dist/types/core/consent.d.ts +132 -0
  201. package/dist/types/core/contact-card.d.ts +34 -0
  202. package/dist/types/core/conversation/context.d.ts +56 -0
  203. package/dist/types/core/conversation/event.d.ts +36 -0
  204. package/dist/types/core/conversation/ids.d.ts +18 -0
  205. package/dist/types/core/conversation/link.d.ts +16 -0
  206. package/dist/types/core/conversation/log.d.ts +142 -0
  207. package/dist/types/core/conversation/ratchet.d.ts +95 -0
  208. package/dist/types/core/conversation/seal.d.ts +47 -0
  209. package/dist/types/core/delegation.d.ts +71 -0
  210. package/dist/types/core/directory/device-log.d.ts +119 -0
  211. package/dist/types/core/directory/epoch.d.ts +53 -0
  212. package/dist/types/core/directory/handle.d.ts +11 -0
  213. package/dist/types/core/directory/jelly-device.d.ts +88 -0
  214. package/dist/types/core/directory/jelly-issuer.d.ts +8 -0
  215. package/dist/types/core/directory/jelly-token.d.ts +116 -0
  216. package/dist/types/core/directory/keys-statement.d.ts +22 -0
  217. package/dist/types/core/directory/link.d.ts +36 -0
  218. package/dist/types/core/directory/merkle-log.d.ts +40 -0
  219. package/dist/types/core/directory/person-view.d.ts +90 -0
  220. package/dist/types/core/directory/person.d.ts +8 -0
  221. package/dist/types/core/directory/realm.d.ts +23 -0
  222. package/dist/types/core/directory/smt.d.ts +52 -0
  223. package/dist/types/core/envelope.d.ts +68 -0
  224. package/dist/types/core/hash.d.ts +2 -0
  225. package/dist/types/core/head.d.ts +34 -0
  226. package/dist/types/core/identity.d.ts +35 -0
  227. package/dist/types/core/index.d.ts +45 -0
  228. package/dist/types/core/jcs.d.ts +12 -0
  229. package/dist/types/core/jelly-host-double.d.ts +21 -0
  230. package/dist/types/core/jelly-host.d.ts +86 -0
  231. package/dist/types/core/keys.d.ts +16 -0
  232. package/dist/types/core/peer-text.d.ts +87 -0
  233. package/dist/types/core/realm.d.ts +36 -0
  234. package/dist/types/core/roster.d.ts +146 -0
  235. package/dist/types/core/schema/a2a.d.ts +251 -0
  236. package/dist/types/core/schema/common.d.ts +328 -0
  237. package/dist/types/core/schema/consent.d.ts +140 -0
  238. package/dist/types/core/schema/conversation.d.ts +1657 -0
  239. package/dist/types/core/schema/delegation.d.ts +58 -0
  240. package/dist/types/core/schema/directory-frames.d.ts +1301 -0
  241. package/dist/types/core/schema/directory.d.ts +375 -0
  242. package/dist/types/core/schema/envelope.d.ts +756 -0
  243. package/dist/types/core/schema/errors.d.ts +142 -0
  244. package/dist/types/core/schema/index.d.ts +16 -0
  245. package/dist/types/core/schema/ipc/consent.d.ts +555 -0
  246. package/dist/types/core/schema/ipc/device.d.ts +735 -0
  247. package/dist/types/core/schema/ipc/jelly.d.ts +501 -0
  248. package/dist/types/core/schema/ipc/shapes.d.ts +414 -0
  249. package/dist/types/core/schema/ipc/surfaces.d.ts +680 -0
  250. package/dist/types/core/schema/ipc.d.ts +3146 -0
  251. package/dist/types/core/schema/jelly.d.ts +160 -0
  252. package/dist/types/core/schema/realm.d.ts +38 -0
  253. package/dist/types/core/schema/relay.d.ts +1134 -0
  254. package/dist/types/core/schema/roster.d.ts +347 -0
  255. package/dist/types/core/sign.d.ts +13 -0
  256. package/dist/types/core/task.d.ts +6 -0
  257. package/dist/types/core/testing.d.ts +19 -0
  258. package/dist/types/core/ulid.d.ts +5 -0
  259. package/dist/types/core/version.d.ts +6 -0
  260. package/dist/types/core/wire.d.ts +14 -0
  261. package/dist/types/ipc/client.d.ts +85 -0
  262. package/dist/types/ipc/framing.d.ts +12 -0
  263. package/dist/types/ipc/index.d.ts +6 -0
  264. package/dist/types/ipc/paths.d.ts +39 -0
  265. package/dist/types/ipc/pipes.d.ts +16 -0
  266. package/dist/types/ipc/rpc.d.ts +13 -0
  267. package/dist/types/ipc/server.d.ts +94 -0
  268. package/dist/types/ipc/testing.d.ts +89 -0
  269. package/dist/types/ipc/trust.d.ts +49 -0
  270. package/dist/types/ipc/windows-acl.d.ts +56 -0
  271. package/dist/types/testing/jelly-id.d.ts +518 -0
  272. package/dist/types/zod.d.ts +1 -0
  273. package/package.json +77 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,220 @@
1
+ # Changelog
2
+
3
+ All notable changes to Messaging. Every package releases together at one version.
4
+ Versions follow [Semantic Versioning](https://semver.org); see
5
+ [docs/distribution.md](docs/distribution.md#versions-and-compatibility) for what a version promises.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.7.1] - 2026-11-09
10
+
11
+ **No store change.** A 0.7.0 home and a 0.7.0 relay database open unchanged, and a 0.7.0 messagingd or relay still
12
+ opens what 0.7.1 writes. 0.7.0 was the last store reset: from 0.7.0 on, stores only grow (the owner's decision of
13
+ 8 November, when the first people other than the owner began to use Messaging).
14
+
15
+ ### Changed
16
+
17
+ - **A refused store has a code and an exit status of its own** (spec §8.8). messagingd and messaging-relay exit
18
+ **78** (`EX_CONFIG`; `STORE_REFUSED_EXIT` in `@messaging/core`) for a store they do not read, instead of 1. messagingd
19
+ prints one line, `messagingd: store_refused: …`; the relay's event is still `relay.store_refused`. A new error code,
20
+ `store_refused`, is what `messaging daemon start` reports, with its own next step, and what agent clients
21
+ report (`TOOL_REMEDIES`). Clients match the status or the code, never the wording. The relay's systemd unit does
22
+ not restart on 78.
23
+ - **A refusal says why** (spec §8.8): `pre-reset` (no store generation, or another: start over by moving the home
24
+ aside) or `newer` (a `min_reader` above the reader's schema: upgrade and keep the home). messagingd prints
25
+ `messagingd: store_refused: <reason>: …`; `StoreRefusedError.reason`, `reason` in `messaging --json` errors and in
26
+ agent tool errors carry it, each reason with its own next step. Moving the home aside is offered only for
27
+ `pre-reset`. The relay's event is `relay.store_refused {db, reason, message}`: **its `reason` field is now the
28
+ reason, and the text moved to `message`**.
29
+ - **A home moved aside is named `<home>.pre-reset-<UTC timestamp>`** (spec §8.8), with no version in the name, and
30
+ messagingd's start-over text says so.
31
+
32
+ ### Fixed
33
+
34
+ - **A roster sync that succeeds on retry clears the error it reported.** messagingd kept the old `relay.lastError`
35
+ after a later sync succeeded.
36
+ - **The darwin executables are signed with a fixed 4 KiB page size,** so any Mac rebuilds a release byte for byte.
37
+ The default page size of `codesign` depends on the macOS version (docs/distribution.md).
38
+ - **publish.yml stages `./<tarball>`.** npm read a bare `dir/name.tgz` as a GitHub shorthand, so 0.7.0's packages
39
+ were staged by hand; `npm run test:pack` now refuses a stage line without `./`.
40
+
41
+ ### Documentation
42
+
43
+ - The relay's operator docs give its limits and flags as built: pre-auth limits 1024 and 128, `--max-connections`,
44
+ `--max-buffered-bytes`, `--preauth-*`, `--metrics` and `--sth-witness`. A test fails when they drift.
45
+ - The README describes both identity modes: the Jelly directory and self-hosted roster teams.
46
+
47
+ ### Tests
48
+
49
+ - The architecture tests enforce where SQLite, network listeners and raw sockets may be used, as AGENTS.md says.
50
+ - A lying relay that withholds the roster entries a signed head commits to is caught (`heads.ts`).
51
+ - The timing tests wait on events and bound cost in units measured on the same machine, not in wall-clock time, so
52
+ they pass on loaded and slow runners.
53
+
54
+ ## [0.7.0] - 2026-11-08
55
+
56
+ ### Store reset
57
+
58
+ - **0.7.0 resets the stores.** Messaging is new and its owner is its only user, so its stores restart instead of
59
+ carrying the migrations of 0.1.0 to 0.6.0 ("reset now, grow later", spec §8.8). The daemon's store
60
+ (`messaging.db`, store schemas 3-9) and the relay's database (schemas 1-4) are each squashed into one baseline,
61
+ schema 1, with the same tables, columns and indexes as before (the new snapshots are byte-identical to the old
62
+ `9.json` and `4.json`). Every migration and the code that read older stores are gone.
63
+ - **Earlier stores are refused, never opened or changed.** A store records its generation (2); a daemon store or
64
+ relay database of 0.6.0 or earlier has none. messagingd refuses such a home before it reads or writes anything in
65
+ it, and messaging-relay exits with one line. Both say how to start over: stop the daemon or relay, move the home
66
+ (or the database, with its `-wal` and `-shm` files) aside, and set it up again (`messaging login`, or `team
67
+ create` / `team join`). Inbox, transcripts, grants, tasks and notices stay in the old home, which messagingd
68
+ 0.6.0 still opens; a 0.6.0 snapshot does not restore. Reset the managed relay and every home that uses it on the
69
+ same day: the relay's directory restarts empty.
70
+ - Until the first release another person uses, a store change edits the baseline, raises the generation and
71
+ resets the stores again, and its release notes say so. From that release on, stores only grow.
72
+ - Stored inbox peers, task peers and provenance now use the API's `device` and `agent`, not the first shape's
73
+ `machine` and `session`.
74
+
75
+ ### Security
76
+
77
+ - **Before `hello`, the directory serves heads, never a person's log** (spec §15.10). `dir.lookup` and `dir.device`
78
+ from a socket that has not authenticated now answer only what a binding or link-approved device needs: log heads,
79
+ the tree head, and whose device a key is. Before, they returned a person's whole device log, and every entry's
80
+ Jelly token carries the account's email and name, so anyone who knew a person id or a device key could read them,
81
+ even with `discoverable: false`.
82
+ - **A relay-wide budget for slow readers and a cap on connections.** `--max-buffered-bytes` (default 256 MiB) bounds
83
+ the bytes buffered to slow readers across every socket; past it the relay drops the sockets furthest behind.
84
+ `--max-connections` caps authenticated connections (close 1013). The pre-auth limits are flags:
85
+ `--preauth-connections` (default 1024) and `--preauth-per-address` (default 128, sized for every client
86
+ reconnecting after a restart, and for office NATs).
87
+
88
+ ### Added
89
+
90
+ - **`@joe-broadhead/messaging` is published on npm**, beside the five `messaging-bin-*` packages, so the plugin and
91
+ other clients build against it instead of a vendored tarball. Releases are staged on npm by CI and the owner
92
+ approves each package (docs/distribution.md "Releasing"); `scripts/verify-published.mjs` checks that npm serves the
93
+ bytes the release run built. The repositories are private, so there is no npm provenance.
94
+ - **Relay `/metrics`** (`--metrics <host>:<port>`, off by default): Prometheus text on a listen address of its own,
95
+ with no person, device or envelope ids in labels or values (spec §7).
96
+ - **A tree-head witness** (`--sth-witness`, default `<db>.sth-witness`): an append-only file of every tree head the
97
+ directory published, with each epoch's leaf hash. A directory database behind it does not start, so restoring an
98
+ old copy over a newer one is caught before clients see a rollback. Keep it where a restore of the database does not
99
+ reach.
100
+ - **A refused database is one JSON event,** `relay.store_refused`, and the relay exits 1 without touching it.
101
+ - **A process policy for errors that escape every handler,** in the relay and the daemon: log the error (without
102
+ secrets) and exit non-zero, so the supervisor restarts the process.
103
+ - **`@joe-broadhead/messaging/testing/jelly-id`:** the Jelly ID issuer double, for other repositories' tests of a
104
+ hosted realm (the plugin's real-host suite). Like the other testing entries, nothing in the package's commands or
105
+ runtime libraries loads it.
106
+
107
+ ### Removed
108
+
109
+ - **Direct binding** (spec Appendix A, experimental and off by default). The daemon's LAN links, config
110
+ `transport.direct`, presence `direct` and the `"direct"` feature, `DOMAIN.directAuth` and `DOMAIN.directLink`, core's
111
+ direct handshake and record cipher (`DirectCipher`, `directKeys`, `directTranscript`, `directAuthPayload`,
112
+ `directEphemeral`, `sealDirectBox`, `openDirectBox`, `DirectEndpoint` and the `Direct*` frame schemas), and the vector
113
+ file `direct.json`. The daemon no longer depends on `ws`. A home whose config still has `transport` fails to start
114
+ on the unknown key.
115
+ - **The A2A gateway**: `packages/gateway`, the `messaging-gateway` command and its bundle. Spec §10 is a stub so the
116
+ later section numbers stay. Core drops the A2A HTTP shapes only it used (`AgentCard` and its parts, and the
117
+ `SendMessage`, `GetTask`, `CancelTask`, `SubscribeToTask` and `ListTasks` request and response shapes).
118
+ - **External principals** (wire): `external` in `MessagePayload`, `Provenance` (§6.6), `DelegationGrant` and
119
+ `DelegationSummary` (§6.7, "External roots") and `msg.send`, and the rule that refused every message to a session of
120
+ agent `a2a-gateway` (§8.3). A peer's `external` is dropped as an unknown key; a client's is refused by strict
121
+ `msg.send`. Agent tools and fences lose `external`, `via` and `principal`. Vectors: `delegation.json` and
122
+ `negative.json` lose their external cases.
123
+ - **The `service` member role** (wire). A member is `admin` or `member`. Invites (`invite.create`, the ticket,
124
+ `team.invite`, `InviteSummary`) and `team.add` lose `role`, and `messaging team invite` and `team add` lose
125
+ `--role`: an invite or an admitted machine is always a `member`, and a redeem that claims any other role is
126
+ `invite_invalid`. The roster vectors' hashes change with the invite entry.
127
+ - `inbound.refuse` and `inbound.wake` in `config.json`: consent replaced them, and the config refuses them now like
128
+ any unknown key.
129
+ - The spec's sentences about earlier builds' envelope ends and the 0.1.0 header. The schemas still refuse them; the
130
+ negative vector `header-0.1.0` is now `header-unknown-fields`.
131
+
132
+ ### Fixed
133
+
134
+ - **`messaging login` works against Jelly's built device sign-in** (Jelly's resource-token contract v1.2 §12, hey-jelly
135
+ `9d46d17`). Jelly ID sends no `verification_uri_complete`, by design: a link with the code in it turns a phished
136
+ code into one click. The daemon required it, so every sign-in through the browser failed with `jelly_unavailable`.
137
+ Now the person opens Jelly ID's page and types the code. The `messaging login`, `identity replace` and `erase`
138
+ commands print the page and the code (`--open` opens the page, never a link with the code), and a
139
+ `verification_uri_complete` in an answer is ignored. The code answer is read as Jelly builds it: `interval` is
140
+ required, `device_code` is 22-256 characters, and a page with a query or fragment is refused.
141
+ - **No false directory alarm when the tree head moves during a read** (spec §15.7, §15.9 "One tree head per view").
142
+ A directory home that read a person at tree head n while another read (a push, a watch, a send) stored them at
143
+ n+1 verified the older view against the newer state. The newer map rightly commits to more, so an honest directory
144
+ raised `directory_inconsistent` ("the map does not commit to the log and keys served", or a keys rollback), and the
145
+ older view could replace the newer one. Each view is now verified against what the home held when it asked. When
146
+ another read stored the person meanwhile, the two states are checked against each other (`checkPersonSuccession`
147
+ in `@messaging/core`: the later one must extend the earlier one's log and keys) and the newer one is kept. A real
148
+ fork or rollback between epochs still raises the alarm, with its evidence. The relay was not at fault: it serves
149
+ each view from one epoch.
150
+
151
+ - **A failing store never crashes the relay.** Every timer (purge, directory epochs, the deletion feed) catches a
152
+ store error, logs it and retries with backoff; `/readyz` answers `store_failing` meanwhile, so a full disk no longer
153
+ crash-loops the relay and drops every socket.
154
+ - **An epoch is stored before the directory changes its memory,** so a failed write can't leave a published tree head
155
+ the database never held.
156
+ - **Litestream's own tables don't make a new relay database look used** (spec §8.8 "Opening"); any other table still
157
+ does.
158
+
159
+ ### Changed
160
+
161
+ - **Group commit in the relay:** the sends and receipt acks of one event-loop turn share one fsync. A connection's
162
+ replies keep the order of its frames.
163
+ - **CI runs every shipped binary on its own platform:** Linux x64 and arm64, macOS arm64 and x64, and Windows x64, each
164
+ building its executable and running the end-to-end suite through it.
165
+ - **IPC: `verificationUriComplete` is gone** from `device.login`, `device.login.status`, the `login` event, and the
166
+ `sign-in` steps of `identity.replace` and `directory.erase` (spec §8.2). A client shows `verificationUri` and
167
+ `userCode`. The plugin's "Sign in with Jelly" must stop reading it.
168
+ - A poll answered `invalid_request`, which Jelly's token route does not define, is retried like an outage instead of
169
+ failing the sign-in.
170
+ - The Jelly ID test double answers as Jelly's built routes do: their order of checks, a denial that stays denied, an
171
+ approval that expires if it is not collected in time, 5 approvals per account and resource a day, routes that
172
+ answer without device sign-in (`401 invalid_client`), and a consent page that refuses a code from a link or a
173
+ stale sign-in. `test/doubles/jelly-device-sign-in.md` is a cited excerpt of Jelly's contract, and the conformance
174
+ test reads it instead of Messaging's proposal.
175
+
176
+ ## [0.6.0] - 2026-11-07
177
+
178
+ The trust gaps closed before Jelly turns on browser device sign-in (contract v1.2). No store migration (daemon 9,
179
+ relay 4); the device log gains one rule.
180
+
181
+ ### Security
182
+
183
+ - **A sign-in through the browser vouches for one act** (spec §15.3, rule 7). The token of a sign-in (`src:
184
+ "device"`) that bound or attested a device is refused in any other log entry and by `dir.erase`, by clients and
185
+ the directory alike. Before, a device bound with one phished user code could spend the same token, within its ten
186
+ minutes, on removing the person's other devices or erasing the account. A Jelly host's token is exempt. Vectors:
187
+ `binding.json` `browserLog.invalid`.
188
+
189
+ ### Added
190
+
191
+ - **"New device on your account"** (design §2.8; spec §8.2 "Notices"): every other device of the person files an
192
+ `alert` notice with `device` (label, kind, vouch, how it was bound, its approver, whether it is current, and how
193
+ this device removes it: `token`, `sign-in` or `team`) for each device added, vouched, removed or replaced in its
194
+ own verified log, including what it missed while offline. In a roster realm, a machine admitted for the person.
195
+ `messaging notices` shows them and how to remove one.
196
+ - **A contact's devices changed**: `contacts.list`'s `reach` carries `devicesChangedAt` for 7 days, and `people.get`
197
+ lists `deviceChanges`; `messaging people <person>` shows them.
198
+ - **Trust that ends within 7 days** is an `alert` notice (design §5.2, §13.11).
199
+ - **`identity.replace {token?, label?}`** and its preview (admin tier; design §13.8): a home restored from a backup
200
+ or `daemon.snapshot` (`keys_missing`), one that runs `restored`, or one that wants a fresh key gets new keys, binds
201
+ them, re-signs its predecessor's grants (nothing lapses) and unbinds the predecessor with reason `replaced`; tasks
202
+ continue under the successor rule. A Jelly host's token does it in one step (the plugin's `device.bind`, while
203
+ `device.status` says `binding: "replace"`); through the browser it takes two sign-ins. `messaging identity replace`.
204
+ - **`directory.erase {token?}`** and its preview (admin tier; design §3.7): erases the person's account from this
205
+ device, with a host's token or a fresh sign-in; the preview says exactly what is lost and what stays, and the
206
+ directory's 10 erasures a day are said plainly. `messaging erase`.
207
+
208
+ ### Fixed
209
+
210
+ - A device whose account was erased reports `removed`, and acts for no one.
211
+ - A directory home watches every person it holds, from the first fetch, and reads a person again once the
212
+ directory has a new watch (spec §15.9, "Who it watches"). Before, a person fetched between their bind and their keys
213
+ statement was not watched (only persons with a sealable device were), so their keys reached this device only after
214
+ the 24-hour freshness bound. This was the cause of the `lying-directory` "a split view…" flake, which also no longer
215
+ races a real-time 100 ms heartbeat: it grows the forked directory by explicit epochs.
216
+
217
+ ## 0.1.0 to 0.5.0 - 2026-11-05 to 2026-11-07
218
+
219
+ Pre-release iterations. Their changes are in the git history (`git log --grep '^release: '`), and the published
220
+ `@joe-broadhead/messaging-bin-*` packages of those versions stay on npm.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joe Broadhead
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ Messaging
2
+ Copyright (c) 2026 Joe Broadhead. Licensed under the MIT License (see LICENSE).
3
+
4
+ The design was informed by concepts in reason-machines/reason-network (MIT OR Apache-2.0):
5
+ a team session directory, delivery tiers, idempotent sends, staged receipts and framed peer input.
6
+ No code, wire format or names were copied from it.
7
+
8
+ The data model follows the A2A protocol v1 specification (Apache-2.0, Agentic AI Foundation).
9
+
10
+ The LOOKALIKES and WIDE tables in packages/core/src/peer-text.ts are derived from Unicode 17.0.0 data
11
+ files (confusables.txt from UTS #39 and EastAsianWidth.txt from the Unicode Character Database),
12
+ Copyright Unicode, Inc., used under the Unicode License v3 (https://www.unicode.org/license.txt).
package/README.md CHANGED
@@ -1,3 +1,37 @@
1
- # Temporary Holding Version
1
+ # @joe-broadhead/messaging
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
+ Messaging in one package: the four commands, the client libraries the OpenCode plugin builds against,
4
+ and the protocol spec. It has **no dependencies**: every file in `dist/` carries what it runs, and only
5
+ Node built-ins stay imports. It needs Node >= 22.15 (`node:sqlite`). It is public on npm: CI stages each
6
+ release, and it is published only when the owner approves it on npm; `npm run pack:tarballs` in the
7
+ [messaging](https://github.com/joe-broadhead/messaging) repository builds the same tarball locally.
8
+
9
+ ## Commands
10
+
11
+ | Command | What |
12
+ |---|---|
13
+ | `messaging` | The command line for people: teams, contacts, messages, tasks, chat, the daemon. |
14
+ | `messagingd` | The per-machine daemon. |
15
+ | `messaging-relay` | The relay a team's machines connect to. |
16
+ | `messaging-mcp` | A stdio MCP server with the eight agent tools, for non-OpenCode agents. |
17
+
18
+ Each is one self-contained file in `dist/bin/`.
19
+
20
+ ## Libraries
21
+
22
+ | Export | What |
23
+ |---|---|
24
+ | `@joe-broadhead/messaging/core` | Wire and IPC contracts, protocol logic, the agent tools' schemas and operations. Pure. |
25
+ | `@joe-broadhead/messaging/ipc` | The local daemon API client (JSON-RPC over a Unix socket) and its paths. |
26
+ | `@joe-broadhead/messaging/zod` | The zod these libraries use; compose their schemas with it. |
27
+ | `@joe-broadhead/messaging/core/testing`, `…/ipc/testing` | Test helpers (a recording fake daemon, fixed ids). Never for production code. |
28
+ | `@joe-broadhead/messaging/testing/jelly-id` | A Jelly ID issuer double over HTTP (resource tokens, key history, the deletion feed, device sign-in), for tests of a hosted realm. Never for production code. |
29
+ | `@joe-broadhead/messaging/bin/messagingd.js`, `…/bin/messaging.js` | The daemon and CLI files, for a plugin that ships them. |
30
+ | `@joe-broadhead/messaging/spec/messaging-v1.md` | The protocol spec, for consumers' drift tests. |
31
+ | `@joe-broadhead/messaging/third-party.json` | Per export, the third-party packages inlined in it, with their licences. |
32
+
33
+ The libraries are modules, not bundles: tsc's output of core and ipc and zod's own ESM files in
34
+ `dist/lib/modules/`, importing each other by relative path. So an error class or a schema has one
35
+ identity across `./core`, `./ipc` and `./zod`, and a consumer that bundles them tree-shakes them as
36
+ it would the sources (the package declares `sideEffects: false`). Their declarations (`dist/types/`) import `zod` for types:
37
+ a consumer that type-checks against them installs `zod` 4 as a dev dependency.