agent-comms 8.6.2 → 8.8.0

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 (240) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +34 -3
  4. package/dist/account-cli.d.ts +34 -0
  5. package/dist/account-cli.d.ts.map +1 -0
  6. package/dist/account-cli.js +140 -0
  7. package/dist/account-cli.js.map +1 -0
  8. package/dist/account-join-cli.d.ts +17 -0
  9. package/dist/account-join-cli.d.ts.map +1 -0
  10. package/dist/account-join-cli.js +144 -0
  11. package/dist/account-join-cli.js.map +1 -0
  12. package/dist/bridges/mcp/server.d.ts +1 -4
  13. package/dist/bridges/mcp/server.d.ts.map +1 -1
  14. package/dist/bridges/mcp/server.js +1 -1
  15. package/dist/bridges/mcp/server.js.map +1 -1
  16. package/dist/bridges/user/web/dist/mesh-worker.js +1 -1
  17. package/dist/bridges/user/web/dist/sw.js +1 -1
  18. package/dist/cli.d.ts +4 -0
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +24 -1
  21. package/dist/cli.js.map +1 -1
  22. package/dist/core/account-bundle.d.ts +27 -0
  23. package/dist/core/account-bundle.d.ts.map +1 -0
  24. package/dist/core/account-bundle.js +173 -0
  25. package/dist/core/account-bundle.js.map +1 -0
  26. package/dist/core/account-join.d.ts +70 -0
  27. package/dist/core/account-join.d.ts.map +1 -0
  28. package/dist/core/account-join.js +183 -0
  29. package/dist/core/account-join.js.map +1 -0
  30. package/dist/core/account-ledger-crypto.d.ts +28 -0
  31. package/dist/core/account-ledger-crypto.d.ts.map +1 -0
  32. package/dist/core/account-ledger-crypto.js +101 -0
  33. package/dist/core/account-ledger-crypto.js.map +1 -0
  34. package/dist/core/account-ledger-store.d.ts +21 -0
  35. package/dist/core/account-ledger-store.d.ts.map +1 -0
  36. package/dist/core/account-ledger-store.js +34 -0
  37. package/dist/core/account-ledger-store.js.map +1 -0
  38. package/dist/core/account-ledger.d.ts +80 -0
  39. package/dist/core/account-ledger.d.ts.map +1 -0
  40. package/dist/core/account-ledger.js +247 -0
  41. package/dist/core/account-ledger.js.map +1 -0
  42. package/dist/core/agent-registry.d.ts.map +1 -1
  43. package/dist/core/agent-registry.js +2 -0
  44. package/dist/core/agent-registry.js.map +1 -1
  45. package/dist/core/bridge-mesh.d.ts.map +1 -1
  46. package/dist/core/bridge-mesh.js +12 -1
  47. package/dist/core/bridge-mesh.js.map +1 -1
  48. package/dist/core/bridge.d.ts +1 -0
  49. package/dist/core/bridge.d.ts.map +1 -1
  50. package/dist/core/bridge.js +6 -0
  51. package/dist/core/bridge.js.map +1 -1
  52. package/dist/core/data-frame-routing.d.ts +50 -3
  53. package/dist/core/data-frame-routing.d.ts.map +1 -1
  54. package/dist/core/data-frame-routing.js +112 -5
  55. package/dist/core/data-frame-routing.js.map +1 -1
  56. package/dist/core/device-membership.d.ts +8 -8
  57. package/dist/core/device-membership.d.ts.map +1 -1
  58. package/dist/core/device-membership.js +17 -16
  59. package/dist/core/device-membership.js.map +1 -1
  60. package/dist/core/dm-send-delegation.d.ts +4 -4
  61. package/dist/core/dm-send-delegation.d.ts.map +1 -1
  62. package/dist/core/dm-send-delegation.js +2 -3
  63. package/dist/core/dm-send-delegation.js.map +1 -1
  64. package/dist/core/gossip-directory.d.ts +4 -2
  65. package/dist/core/gossip-directory.d.ts.map +1 -1
  66. package/dist/core/gossip-directory.js +4 -5
  67. package/dist/core/gossip-directory.js.map +1 -1
  68. package/dist/core/gossip-extensions.d.ts +2 -0
  69. package/dist/core/gossip-extensions.d.ts.map +1 -1
  70. package/dist/core/gossip-extensions.js +3 -0
  71. package/dist/core/gossip-extensions.js.map +1 -1
  72. package/dist/core/group-proofs.d.ts +15 -6
  73. package/dist/core/group-proofs.d.ts.map +1 -1
  74. package/dist/core/group-proofs.js +73 -18
  75. package/dist/core/group-proofs.js.map +1 -1
  76. package/dist/core/identity-store.d.ts.map +1 -1
  77. package/dist/core/identity-store.js +2 -62
  78. package/dist/core/identity-store.js.map +1 -1
  79. package/dist/core/issuer-grouping.d.ts +52 -0
  80. package/dist/core/issuer-grouping.d.ts.map +1 -0
  81. package/dist/core/{machine-grouping.js → issuer-grouping.js} +33 -33
  82. package/dist/core/issuer-grouping.js.map +1 -0
  83. package/dist/core/issuer-identity-file.d.ts +4 -0
  84. package/dist/core/issuer-identity-file.d.ts.map +1 -1
  85. package/dist/core/issuer-identity-file.js +7 -5
  86. package/dist/core/issuer-identity-file.js.map +1 -1
  87. package/dist/core/ledger-lock.d.ts +12 -0
  88. package/dist/core/ledger-lock.d.ts.map +1 -0
  89. package/dist/core/ledger-lock.js +62 -0
  90. package/dist/core/ledger-lock.js.map +1 -0
  91. package/dist/core/membership-proofs.d.ts +7 -0
  92. package/dist/core/membership-proofs.d.ts.map +1 -1
  93. package/dist/core/membership-proofs.js +26 -1
  94. package/dist/core/membership-proofs.js.map +1 -1
  95. package/dist/core/mesh-store-shared.d.ts +4 -1
  96. package/dist/core/mesh-store-shared.d.ts.map +1 -1
  97. package/dist/core/mesh-store-shared.js.map +1 -1
  98. package/dist/core/mesh-store.d.ts +17 -8
  99. package/dist/core/mesh-store.d.ts.map +1 -1
  100. package/dist/core/mesh-store.js +44 -42
  101. package/dist/core/mesh-store.js.map +1 -1
  102. package/dist/core/naming-actions.d.ts +5 -1
  103. package/dist/core/naming-actions.d.ts.map +1 -1
  104. package/dist/core/naming-actions.js +13 -1
  105. package/dist/core/naming-actions.js.map +1 -1
  106. package/dist/core/naming.d.ts +9 -5
  107. package/dist/core/naming.d.ts.map +1 -1
  108. package/dist/core/naming.js +14 -4
  109. package/dist/core/naming.js.map +1 -1
  110. package/dist/core/peer-versions.d.ts +11 -0
  111. package/dist/core/peer-versions.d.ts.map +1 -1
  112. package/dist/core/peer-versions.js +9 -0
  113. package/dist/core/peer-versions.js.map +1 -1
  114. package/dist/core/pid-lock-file.d.ts +20 -0
  115. package/dist/core/pid-lock-file.d.ts.map +1 -0
  116. package/dist/core/pid-lock-file.js +115 -0
  117. package/dist/core/pid-lock-file.js.map +1 -0
  118. package/dist/core/room-lifecycle.d.ts +2 -2
  119. package/dist/core/room-lifecycle.d.ts.map +1 -1
  120. package/dist/core/room-lifecycle.js +18 -19
  121. package/dist/core/room-lifecycle.js.map +1 -1
  122. package/dist/core/self-name-claim.d.ts +27 -0
  123. package/dist/core/self-name-claim.d.ts.map +1 -0
  124. package/dist/core/{machine-name-claim.js → self-name-claim.js} +7 -8
  125. package/dist/core/self-name-claim.js.map +1 -0
  126. package/dist/core/tool.d.ts.map +1 -1
  127. package/dist/core/tool.js +11 -7
  128. package/dist/core/tool.js.map +1 -1
  129. package/dist/core/transport-queries.d.ts +11 -0
  130. package/dist/core/transport-queries.d.ts.map +1 -0
  131. package/dist/core/transport-queries.js +30 -0
  132. package/dist/core/transport-queries.js.map +1 -0
  133. package/dist/core/types.d.ts +6 -0
  134. package/dist/core/types.d.ts.map +1 -1
  135. package/dist/core/types.js +5 -0
  136. package/dist/core/types.js.map +1 -1
  137. package/dist/core/user-identity.d.ts +28 -18
  138. package/dist/core/user-identity.d.ts.map +1 -1
  139. package/dist/core/user-identity.js +126 -59
  140. package/dist/core/user-identity.js.map +1 -1
  141. package/dist/core/wire-mesh-transport-options.d.ts +11 -2
  142. package/dist/core/wire-mesh-transport-options.d.ts.map +1 -1
  143. package/dist/core/wire-mesh-transport-options.js.map +1 -1
  144. package/dist/core/wire-mesh-transport.d.ts +4 -6
  145. package/dist/core/wire-mesh-transport.d.ts.map +1 -1
  146. package/dist/core/wire-mesh-transport.js +16 -20
  147. package/dist/core/wire-mesh-transport.js.map +1 -1
  148. package/dist/test/account-join.integration.test.d.ts +5 -0
  149. package/dist/test/account-join.integration.test.d.ts.map +1 -0
  150. package/dist/test/account-join.integration.test.js +280 -0
  151. package/dist/test/account-join.integration.test.js.map +1 -0
  152. package/dist/test/account-ledger-lock-worker.d.ts +9 -0
  153. package/dist/test/account-ledger-lock-worker.d.ts.map +1 -0
  154. package/dist/test/account-ledger-lock-worker.js +34 -0
  155. package/dist/test/account-ledger-lock-worker.js.map +1 -0
  156. package/dist/test/account-ledger-lock.integration.test.d.ts +5 -0
  157. package/dist/test/account-ledger-lock.integration.test.d.ts.map +1 -0
  158. package/dist/test/account-ledger-lock.integration.test.js +71 -0
  159. package/dist/test/account-ledger-lock.integration.test.js.map +1 -0
  160. package/dist/test/account-ledger-replication.integration.test.d.ts +5 -0
  161. package/dist/test/account-ledger-replication.integration.test.d.ts.map +1 -0
  162. package/dist/test/account-ledger-replication.integration.test.js +145 -0
  163. package/dist/test/account-ledger-replication.integration.test.js.map +1 -0
  164. package/dist/test/account-ledger.unit.test.d.ts +5 -0
  165. package/dist/test/account-ledger.unit.test.d.ts.map +1 -0
  166. package/dist/test/account-ledger.unit.test.js +317 -0
  167. package/dist/test/account-ledger.unit.test.js.map +1 -0
  168. package/dist/test/account-transfer.unit.test.d.ts +5 -0
  169. package/dist/test/account-transfer.unit.test.d.ts.map +1 -0
  170. package/dist/test/account-transfer.unit.test.js +232 -0
  171. package/dist/test/account-transfer.unit.test.js.map +1 -0
  172. package/dist/test/delivery-engine-delivery.unit.test.js +1 -0
  173. package/dist/test/delivery-engine-delivery.unit.test.js.map +1 -1
  174. package/dist/test/delivery-engine-directed-notify.unit.test.js +1 -0
  175. package/dist/test/delivery-engine-directed-notify.unit.test.js.map +1 -1
  176. package/dist/test/delivery-engine-own-agent.unit.test.js +1 -0
  177. package/dist/test/delivery-engine-own-agent.unit.test.js.map +1 -1
  178. package/dist/test/delivery-engine.unit.test.js +1 -0
  179. package/dist/test/delivery-engine.unit.test.js.map +1 -1
  180. package/dist/test/device-membership.unit.test.js +81 -30
  181. package/dist/test/device-membership.unit.test.js.map +1 -1
  182. package/dist/test/dm-send-delegation.unit.test.js +25 -14
  183. package/dist/test/dm-send-delegation.unit.test.js.map +1 -1
  184. package/dist/test/dm-send-principal-delegation.integration.test.js +9 -2
  185. package/dist/test/dm-send-principal-delegation.integration.test.js.map +1 -1
  186. package/dist/test/hidden-line.unit.test.d.ts +5 -0
  187. package/dist/test/hidden-line.unit.test.d.ts.map +1 -0
  188. package/dist/test/hidden-line.unit.test.js +40 -0
  189. package/dist/test/hidden-line.unit.test.js.map +1 -0
  190. package/dist/test/identity-restart.integration.test.js +8 -1
  191. package/dist/test/identity-restart.integration.test.js.map +1 -1
  192. package/dist/test/issuer-grouping.unit.test.d.ts +2 -0
  193. package/dist/test/issuer-grouping.unit.test.d.ts.map +1 -0
  194. package/dist/test/issuer-grouping.unit.test.js +137 -0
  195. package/dist/test/issuer-grouping.unit.test.js.map +1 -0
  196. package/dist/test/mcp-stdout-channel.integration.test.js +2 -2
  197. package/dist/test/mcp-stdout-channel.integration.test.js.map +1 -1
  198. package/dist/test/mesh-smoke.runner.js +2 -1
  199. package/dist/test/mesh-smoke.runner.js.map +1 -1
  200. package/dist/test/naming.integration.test.d.ts +1 -1
  201. package/dist/test/naming.integration.test.js +45 -1
  202. package/dist/test/naming.integration.test.js.map +1 -1
  203. package/dist/test/room-join-admission.integration.test.js +8 -1
  204. package/dist/test/room-join-admission.integration.test.js.map +1 -1
  205. package/dist/test/room-lifecycle-bare-name.unit.test.js +1 -0
  206. package/dist/test/room-lifecycle-bare-name.unit.test.js.map +1 -1
  207. package/dist/test/room-lifecycle-membership.unit.test.js +1 -0
  208. package/dist/test/room-lifecycle-membership.unit.test.js.map +1 -1
  209. package/dist/test/room-lifecycle-remote.unit.test.js +1 -0
  210. package/dist/test/room-lifecycle-remote.unit.test.js.map +1 -1
  211. package/dist/test/room-lifecycle.unit.test.js +1 -0
  212. package/dist/test/room-lifecycle.unit.test.js.map +1 -1
  213. package/dist/test/room-messaging-durable-send.unit.test.js +1 -0
  214. package/dist/test/room-messaging-durable-send.unit.test.js.map +1 -1
  215. package/dist/test/room-messaging.unit.test.js +1 -0
  216. package/dist/test/room-messaging.unit.test.js.map +1 -1
  217. package/dist/test/room-protocol-notify.unit.test.js +1 -0
  218. package/dist/test/room-protocol-notify.unit.test.js.map +1 -1
  219. package/dist/test/room-protocol.helper.d.ts.map +1 -1
  220. package/dist/test/room-protocol.helper.js +1 -0
  221. package/dist/test/room-protocol.helper.js.map +1 -1
  222. package/dist/test/room-send-retry.integration.test.js +8 -1
  223. package/dist/test/room-send-retry.integration.test.js.map +1 -1
  224. package/dist/test/test-transport.d.ts +9 -0
  225. package/dist/test/test-transport.d.ts.map +1 -1
  226. package/dist/test/test-transport.js +14 -5
  227. package/dist/test/test-transport.js.map +1 -1
  228. package/dist/test/user-identity.unit.test.js +92 -99
  229. package/dist/test/user-identity.unit.test.js.map +1 -1
  230. package/package.json +1 -1
  231. package/dist/core/machine-grouping.d.ts +0 -47
  232. package/dist/core/machine-grouping.d.ts.map +0 -1
  233. package/dist/core/machine-grouping.js.map +0 -1
  234. package/dist/core/machine-name-claim.d.ts +0 -22
  235. package/dist/core/machine-name-claim.d.ts.map +0 -1
  236. package/dist/core/machine-name-claim.js.map +0 -1
  237. package/dist/test/machine-grouping.unit.test.d.ts +0 -2
  238. package/dist/test/machine-grouping.unit.test.d.ts.map +0 -1
  239. package/dist/test/machine-grouping.unit.test.js +0 -68
  240. package/dist/test/machine-grouping.unit.test.js.map +0 -1
@@ -1,21 +1,53 @@
1
1
  /**
2
- * data-frame-routing -- WireMeshTransport's own core/data frame dispatch (data-have/data-request/data-entries), split out under the repo's max-lines cap the same way gossip-directory.ts/hub-forwarding.ts were each split from the same owning file.
2
+ * WireMeshTransport's own core/data frame dispatch (data-have, data-request, data-entries), split out under the repo's max-lines cap the same way gossip-directory.ts and hub-forwarding.ts were each split from the same owning file.
3
3
  */
4
4
  import { handleDataEntries, handleDataHave, handleDataRequest, } from "wire-mesh-core/domain/data-sync";
5
5
  import { deviceIdToHex } from "wire-mesh-core/domain/device-id";
6
- const DATA_ENTRIES_RESPONSE_LIMIT = 100;
7
- /** Routes one frame received on a raw data connection to wire-mesh-core's own core/data handlers, tracking the connection against its peer's device-id along the way (connectionsByPeer, mutated in place) so a later data-have/data-request/data-entries send addressed to that same peer reuses it. A no-op past the connectionsByPeer update when dataStorage is unset (this side doesn't participate in core/data at all) or the sender isn't yet a tracked peer session -- mirrors WireMeshTransport's own pre-extraction guard clauses exactly. Any handler error is reported via onError and swallowed, never thrown, since this runs inside the transport's own onFrame callback with no caller awaiting it directly. */
6
+ import { isDataFrame } from "wire-mesh-core/domain/hub-mailbox";
7
+ import { readMembershipProof } from "./gossip-directory.js";
8
+ /** The most entries one data-entries reply carries, for every log this side answers for, the account ledger's included: a longer log catches up over several rounds, so the bound only caps one frame's size. */
9
+ export const DATA_ENTRIES_RESPONSE_LIMIT = 100;
10
+ /** Builds the router's account replication from the transport option: a peer is an account peer when the membership proof in its gossiped advert (looked up through `advertOf`) verifies against this machine's own principal. Undefined when the transport has no account ledger. */
11
+ export function accountReplicationFrom(options, advertOf) {
12
+ if (options === undefined)
13
+ return undefined;
14
+ return {
15
+ ledger: options.getLedger,
16
+ isAccountPeer: async (deviceHex) => {
17
+ const advert = advertOf(deviceHex);
18
+ const proof = advert === undefined
19
+ ? undefined
20
+ : readMembershipProof(advert, "membership");
21
+ return proof === undefined
22
+ ? false
23
+ : options.isAccountMember({ proof, deviceHex });
24
+ },
25
+ };
26
+ }
27
+ /** Routes one frame received on a raw data connection, tracking the connection against its peer's device-id along the way (connectionsByPeer, mutated in place) so a later data-have, data-request or data-entries send addressed to that same peer reuses it. Nothing further happens until the sender is a tracked peer session. A frame naming one of the account's writer logs goes to the account ledger when the sender holds the same account and is dropped otherwise, without reaching dataStorage either way; any other data frame goes to wire-mesh-core's own core/data handlers over dataStorage, and is dropped when this side has no dataStorage. Any handler error is reported via onError and swallowed, never thrown, since this runs inside the transport's own onFrame callback with no caller awaiting it directly. */
8
28
  export async function routeDataFrame(deps, connection, frame) {
9
29
  const peerDeviceId = connection.peerDeviceId;
10
30
  if (peerDeviceId === undefined)
11
31
  return;
12
32
  const deviceIdHex = deviceIdToHex(peerDeviceId);
13
33
  deps.connectionsByPeer.set(deviceIdHex, connection);
14
- if (deps.dataStorage === undefined)
15
- return;
16
34
  if (!deps.peerSessions.has(deviceIdHex))
17
35
  return;
18
36
  try {
37
+ const ledger = deps.account?.ledger();
38
+ if (isDataFrame(frame) &&
39
+ ledger !== undefined &&
40
+ deps.account !== undefined &&
41
+ ledger.ownsLog(frame.peer)) {
42
+ if (!(await deps.account.isAccountPeer(deviceIdHex)))
43
+ return;
44
+ const reply = await ledger.handleDataFrame(frame);
45
+ if (reply !== null)
46
+ await connection.send(reply);
47
+ return;
48
+ }
49
+ if (deps.dataStorage === undefined)
50
+ return;
19
51
  if (frame.type === "data-have") {
20
52
  const request = await handleDataHave(deps.dataStorage, frame);
21
53
  if (request !== null)
@@ -34,4 +66,79 @@ export async function routeDataFrame(deps, connection, frame) {
34
66
  deps.onError?.(error instanceof Error ? error : new Error(String(error)));
35
67
  }
36
68
  }
69
+ /** Offers every account writer log this machine holds to every peer it has a live, trusted data connection with that holds the same account (agent-comms#344): such a peer that is behind asks for what it is missing, which is the data-domain fan-out that carries each machine's grants and revocations to every other. Called on the gossip cadence, so a machine that was away when an entry was written still catches up the next time it is connected. A send that fails is reported and the rest carry on; the next round retries it. */
70
+ export async function announceAccountLedger(deps) {
71
+ const ledger = deps.account.ledger();
72
+ if (ledger === undefined)
73
+ return;
74
+ const frames = await ledger.announcements();
75
+ if (frames.length === 0)
76
+ return;
77
+ for (const [deviceHex, connection] of deps.connectionsByPeer) {
78
+ if (!deps.peerSessions.has(deviceHex))
79
+ continue;
80
+ if (!(await deps.account.isAccountPeer(deviceHex)))
81
+ continue;
82
+ for (const frame of frames) {
83
+ try {
84
+ await connection.send(frame);
85
+ }
86
+ catch (error) {
87
+ deps.onError?.(error instanceof Error ? error : new Error(String(error)));
88
+ }
89
+ }
90
+ }
91
+ }
92
+ /** WireMeshTransport's core/data state and dispatch, split out under the repo's max-lines cap: the connection each peer's frames arrive on, routing of every data frame received, the mechanical send primitive, and the periodic offer of the account ledger's writer logs. */
93
+ export class DataFrameRouter {
94
+ deps;
95
+ /** Backs this side's own responder for an incoming data-have, data-request or data-entries frame about any log other than the account ledger's (agent-comms#50's P5 integration). When undefined, such frames are dropped; the account ledger's are routed either way. For those logs, deciding when to proactively call sendDataFrame at all (the catch-up policy: which peers' logs to track, when to send an initial data-have) stays the caller's business and this field only backs the mechanical parts (answering a have or request, storing entries); the account ledger's own offers are the router's, sent every announceIntervalMs. */
96
+ dataStorage;
97
+ /** Every peer this side has ever received a frame from, keyed by device-id hex, tracking the raw wire-mesh-core Connection each frame arrived on: what sendDataFrame needs, since neither AcceptedMeshSession nor MeshSession exposes a generic "send an arbitrary frame" method the way the raw Connection itself does. Registered eagerly on the very first frame from a connection (including one still in quarantine, e.g. before connect_request approval) so a later sendDataFrame call can reach it; routeDataFrame's own trust gate (peerSessions.has) is what actually decides whether to act on anything received this way, not this map. */
98
+ connectionsByPeer = new Map();
99
+ announceInterval;
100
+ constructor(deps) {
101
+ this.deps = deps;
102
+ this.dataStorage = deps.dataStorage;
103
+ const { account } = deps;
104
+ if (account === undefined)
105
+ return;
106
+ this.announceInterval = setInterval(() => {
107
+ announceAccountLedger({
108
+ connectionsByPeer: this.connectionsByPeer,
109
+ account,
110
+ peerSessions: deps.peerSessions,
111
+ onError: deps.onError,
112
+ }).catch((error) => {
113
+ deps.onError?.(error instanceof Error ? error : new Error(String(error)));
114
+ });
115
+ }, deps.announceIntervalMs);
116
+ this.announceInterval.unref();
117
+ }
118
+ /** See routeDataFrame. */
119
+ async route(connection, frame) {
120
+ await routeDataFrame({
121
+ connectionsByPeer: this.connectionsByPeer,
122
+ dataStorage: this.dataStorage,
123
+ account: this.deps.account,
124
+ peerSessions: this.deps.peerSessions,
125
+ onError: this.deps.onError,
126
+ }, connection, frame);
127
+ }
128
+ /** Sends one frame on the connection peerDeviceHex's frames last arrived on. Throws if none has arrived from it yet. */
129
+ async send(peerDeviceHex, frame) {
130
+ const connection = this.connectionsByPeer.get(peerDeviceHex);
131
+ if (connection === undefined) {
132
+ throw new Error(`WireMeshTransport: no live connection for peer ${peerDeviceHex}`);
133
+ }
134
+ await connection.send(frame);
135
+ }
136
+ /** Stops offering the account ledger. A router that never started offering it has no timer to clear. */
137
+ stop() {
138
+ if (this.announceInterval === undefined)
139
+ return;
140
+ clearInterval(this.announceInterval);
141
+ this.announceInterval = undefined;
142
+ }
143
+ }
37
144
  //# sourceMappingURL=data-frame-routing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-frame-routing.js","sourceRoot":"","sources":["../../src/core/data-frame-routing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKhE,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAExC,isBAAisB;AACjsB,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAKE,EACF,UAAgC,EAChC,KAAY;IAEZ,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;IAC7C,IAAI,YAAY,KAAK,SAAS;QAAE,OAAO;IACvC,MAAM,WAAW,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IAChD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO;IAC3C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC;QAAE,OAAO;IAChD,IAAI,CAAC;QACH,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YAC9D,IAAI,OAAO,KAAK,IAAI;gBAAE,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CA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evocationView } from "wire-mesh-core/domain/revocation-view";
8
8
  import type { IdentityPort } from "wire-mesh-core/ports/identity";
9
9
  import type { Clock } from "wire-mesh-core/ports/clock";
10
10
  import type { DeviceId, RevocationEntry } from "wire-mesh-core/generated/protocol";
11
- import { type UserIdentityOptions } from "./user-identity.js";
11
+ import type { AccountLedger } from "./account-ledger.js";
12
12
  export interface AdmitDeviceOptions {
13
13
  /** The user principal's own identity -- signs the membership grant. */
14
14
  userIdentity: IdentityPort;
15
- /** Directory override for tests, forwarded to user-identity.ts's own issued-grant storage -- must resolve to the same user-identity.json userIdentity's own key material lives in. */
16
- userIdentityOptions?: UserIdentityOptions;
15
+ /** The account's replicated grant ledger, which records the admission so any machine holding the account key can revoke it. */
16
+ accountLedger: AccountLedger;
17
17
  clock: Clock;
18
18
  tokenId: Uint8Array<ArrayBuffer>;
19
19
  /** The device being admitted. */
@@ -32,22 +32,22 @@ export interface MintGroupMembershipOptions {
32
32
  /** The group:member token itself, with no record kept of having issued it: a root-level, non-delegable grant bearing options.deviceId and scoped to the issuer's own group (groupPath). admitDevice adds the issued-grant bookkeeping a later removeDevice needs; a caller that only needs a short-lived proof (membership-proof.ts) uses this directly, so the shared identity file is not rewritten every time one of its many bridges refreshes its proof. */
33
33
  export declare function mintGroupMembership(options: Readonly<MintGroupMembershipOptions>): Promise<MintVerdict>;
34
34
  /**
35
- * Mints deviceId's own group:member grant from the user principal: a root-level, non-delegable token scoped to the principal's own group (groupPath). On success, records the grant's token-id under the principal's own issued-grant store so a later removeDevice call can find it to revoke: an admission without this bookkeeping would leave removal permanently unable to find what to revoke, so this is not optional side-book-keeping, it is what makes revocation possible at all.
35
+ * Mints deviceId's own group:member grant from the user principal: a root-level, non-delegable token scoped to the principal's own group (groupPath). On success, records the grant's token-id in the account's replicated ledger so a later removeDevice, on this machine or any other holding the account key, can find it to revoke. An admission without that record would leave removal permanently unable to find what to revoke, so it is what makes revocation possible at all.
36
36
  */
37
37
  export declare function admitDevice(options: Readonly<AdmitDeviceOptions>): Promise<MintVerdict>;
38
38
  export interface RemoveDeviceOptions {
39
39
  /** The user principal's own identity -- only the principal that issued a device's membership may revoke it. */
40
40
  userIdentity: IdentityPort;
41
- userIdentityOptions?: UserIdentityOptions;
41
+ accountLedger: AccountLedger;
42
42
  clock: Clock;
43
43
  /** Recorded locally immediately, so this principal's own future verifications see the removal without waiting on gossip -- mirrors room-lifecycle.ts's own revokeMemberGrant ordering (record before broadcast). */
44
44
  revocation: RevocationView;
45
45
  deviceId: DeviceId;
46
46
  }
47
47
  /**
48
- * Revokes deviceId's own group:member grant for real, if this principal ever recorded admitting it: mints a revocation-entry for its token-id, records it in the given RevocationView immediately, and forgets the issued-grant record (a later re-admission mints and records a genuinely fresh one rather than leaving a stale entry alongside it). Silently returns undefined when no issued-grant record exists (a device that was never actually admitted, or a grant predating this bookkeeping) -- mirrors room-lifecycle.ts's own revokeMemberGrant, which does the same for a room member.
48
+ * Revokes every group:member grant for deviceId that the account's ledger holds as outstanding, whichever machine of the account minted it: mints a revocation-entry for each token-id, records it in the given RevocationView immediately, and appends it to the ledger, so every other machine of the account sees the grant as revoked and a later re-admission starts from nothing outstanding. Returns no entries for a device the account never admitted.
49
49
  *
50
- * Returns the minted entry so the caller can broadcast it to the mesh (this module has no MeshTransport dependency to do so itself, mirroring the module-level "no assumption about locality" boundary documented above) -- every other device that might hold this device's grant, including other devices of this same user, needs the entry to independently start refusing it.
50
+ * Returns the minted entries so the caller can broadcast them to the mesh (this module has no MeshTransport dependency to do so itself, mirroring the module-level "no assumption about locality" boundary documented above): every other device that might hold one of this device's grants needs the entry to independently start refusing it.
51
51
  */
52
- export declare function removeDevice(options: Readonly<RemoveDeviceOptions>): Promise<RevocationEntry | undefined>;
52
+ export declare function removeDevice(options: Readonly<RemoveDeviceOptions>): Promise<RevocationEntry[]>;
53
53
  //# sourceMappingURL=device-membership.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-membership.d.ts","sourceRoot":"","sources":["../../src/core/device-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ic;AACjc,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAC5C,OAAO,CAAC,WAAW,CAAC,CActB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACpC,OAAO,CAAC,WAAW,CAAC,CAatB;AAED,MAAM,WAAW,mBAAmB;IAClC,+GAA+G;IAC/G,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,oNAAoN;IACpN,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GACrC,OAAO,CAAC,eAAe,EAAE,CAAC,CAuB5B"}
@@ -6,7 +6,6 @@
6
6
  import { mintCapabilityToken, mintRevocationEntry, } from "wire-mesh-core/domain/tokens";
7
7
  import { deviceIdToHex } from "wire-mesh-core/domain/device-id";
8
8
  import { DEVICE_MEMBER_CAPABILITY, groupPath, } from "./device-membership-verification.js";
9
- import { deleteIssuedDeviceGrant, loadIssuedDeviceGrant, saveIssuedDeviceGrant, } from "./user-identity.js";
10
9
  /** delegationsRemaining for every device-membership grant -- deliberately non-delegable: a device that could re-mint membership for another device would let any admitted device silently admit others, defeating the point of the principal being the one place admission is decided (the same reasoning room-lifecycle.ts's own mintOwnerRootGrant already documents for a room owner's self-grant). */
11
10
  const NOT_DELEGABLE = 0;
12
11
  /** The group:member token itself, with no record kept of having issued it: a root-level, non-delegable grant bearing options.deviceId and scoped to the issuer's own group (groupPath). admitDevice adds the issued-grant bookkeeping a later removeDevice needs; a caller that only needs a short-lived proof (membership-proof.ts) uses this directly, so the shared identity file is not rewritten every time one of its many bridges refreshes its proof. */
@@ -26,7 +25,7 @@ export async function mintGroupMembership(options) {
26
25
  });
27
26
  }
28
27
  /**
29
- * Mints deviceId's own group:member grant from the user principal: a root-level, non-delegable token scoped to the principal's own group (groupPath). On success, records the grant's token-id under the principal's own issued-grant store so a later removeDevice call can find it to revoke: an admission without this bookkeeping would leave removal permanently unable to find what to revoke, so this is not optional side-book-keeping, it is what makes revocation possible at all.
28
+ * Mints deviceId's own group:member grant from the user principal: a root-level, non-delegable token scoped to the principal's own group (groupPath). On success, records the grant's token-id in the account's replicated ledger so a later removeDevice, on this machine or any other holding the account key, can find it to revoke. An admission without that record would leave removal permanently unable to find what to revoke, so it is what makes revocation possible at all.
30
29
  */
31
30
  export async function admitDevice(options) {
32
31
  const verdict = await mintGroupMembership({
@@ -35,26 +34,28 @@ export async function admitDevice(options) {
35
34
  });
36
35
  if (!verdict.ok)
37
36
  return verdict;
38
- saveIssuedDeviceGrant(options.userIdentityOptions, deviceIdToHex(options.deviceId), options.tokenId);
37
+ await options.accountLedger.recordGrant("device", deviceIdToHex(options.deviceId), options.tokenId);
39
38
  return verdict;
40
39
  }
41
40
  /**
42
- * Revokes deviceId's own group:member grant for real, if this principal ever recorded admitting it: mints a revocation-entry for its token-id, records it in the given RevocationView immediately, and forgets the issued-grant record (a later re-admission mints and records a genuinely fresh one rather than leaving a stale entry alongside it). Silently returns undefined when no issued-grant record exists (a device that was never actually admitted, or a grant predating this bookkeeping) -- mirrors room-lifecycle.ts's own revokeMemberGrant, which does the same for a room member.
41
+ * Revokes every group:member grant for deviceId that the account's ledger holds as outstanding, whichever machine of the account minted it: mints a revocation-entry for each token-id, records it in the given RevocationView immediately, and appends it to the ledger, so every other machine of the account sees the grant as revoked and a later re-admission starts from nothing outstanding. Returns no entries for a device the account never admitted.
43
42
  *
44
- * Returns the minted entry so the caller can broadcast it to the mesh (this module has no MeshTransport dependency to do so itself, mirroring the module-level "no assumption about locality" boundary documented above) -- every other device that might hold this device's grant, including other devices of this same user, needs the entry to independently start refusing it.
43
+ * Returns the minted entries so the caller can broadcast them to the mesh (this module has no MeshTransport dependency to do so itself, mirroring the module-level "no assumption about locality" boundary documented above): every other device that might hold one of this device's grants needs the entry to independently start refusing it.
45
44
  */
46
45
  export async function removeDevice(options) {
47
46
  const deviceHex = deviceIdToHex(options.deviceId);
48
- const tokenId = loadIssuedDeviceGrant(options.userIdentityOptions, deviceHex);
49
- if (tokenId === undefined)
50
- return undefined;
51
- const entry = await mintRevocationEntry({
52
- identity: options.userIdentity,
53
- tokenId,
54
- revokedAt: options.clock.now(),
55
- });
56
- await options.revocation.record(entry, { identity: options.userIdentity });
57
- deleteIssuedDeviceGrant(options.userIdentityOptions, deviceHex);
58
- return entry;
47
+ const outstanding = await options.accountLedger.outstandingGrants("device", deviceHex);
48
+ const entries = [];
49
+ for (const { tokenId } of outstanding) {
50
+ const entry = await mintRevocationEntry({
51
+ identity: options.userIdentity,
52
+ tokenId,
53
+ revokedAt: options.clock.now(),
54
+ });
55
+ await options.revocation.record(entry, { identity: options.userIdentity });
56
+ await options.accountLedger.recordRevocation("device", deviceHex, tokenId, entry);
57
+ entries.push(entry);
58
+ }
59
+ return entries;
59
60
  }
60
61
  //# sourceMappingURL=device-membership.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-membership.js","sourceRoot":"","sources":["../../src/core/device-membership.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAQhE,OAAO,EACL,wBAAwB,EACxB,SAAS,GACV,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC;AAE5B,0YAA0Y;AAC1Y,MAAM,aAAa,GAAG,CAAC,CAAC;AAwBxB,icAAic;AACjc,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA6C;IAE7C,OAAO,mBAAmB,CAAC;QACzB,QAAQ,EAAE,OAA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aAAa,CAAC,WAAW,CACrC,QAAQ,EACR,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAC/B,OAAO,CAAC,OAAO,CAChB,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC;AAYD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAsC;IAEtC,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAC/D,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,WAAW,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC;YACtC,QAAQ,EAAE,OAAO,CAAC,YAAY;YAC9B,OAAO;YACP,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;SAC/B,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QAC3E,MAAM,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAC1C,QAAQ,EACR,SAAS,EACT,OAAO,EACP,KAAK,CACN,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -7,12 +7,12 @@ import { type MintVerdict } from "wire-mesh-core/domain/tokens";
7
7
  import type { IdentityPort } from "wire-mesh-core/ports/identity";
8
8
  import type { Clock } from "wire-mesh-core/ports/clock";
9
9
  import type { CapabilityToken, DeviceId } from "wire-mesh-core/generated/protocol";
10
- import { type UserIdentityOptions } from "./user-identity.js";
10
+ import type { AccountLedger } from "./account-ledger.js";
11
11
  export interface DelegateDmSendToDeviceOptions {
12
12
  /** The principal doing the sub-delegating -- must be the same identity the parent grant's own bearer names, or mintCapabilityToken's own parent-bearer-matches-issuer narrowing check refuses the mint outright (`parent_bearer_mismatch`). */
13
13
  userIdentity: IdentityPort;
14
- /** Directory override for tests, forwarded to user-identity.ts's own issued-grant storage -- must resolve to the same user-identity.json userIdentity's own key material lives in. */
15
- userIdentityOptions?: UserIdentityOptions;
14
+ /** The account's replicated grant ledger, which records the delegation so any machine holding the account key can revoke it. */
15
+ accountLedger: AccountLedger;
16
16
  clock: Clock;
17
17
  tokenId: Uint8Array<ArrayBuffer>;
18
18
  /** The grant this principal itself was admitted with (room-lifecycle.ts's admitAgentForDm, minted with delegationsRemaining \> 0) -- every one of tokens.cddl's own narrowing obligations is checked against it at mint time. */
@@ -26,7 +26,7 @@ export interface DelegateDmSendToDeviceOptions {
26
26
  delegationsRemaining?: number;
27
27
  }
28
28
  /**
29
- * Mints deviceId's own dm:send delegation from a received grant: bearer = deviceId, parent = the grant this principal itself was admitted with, scope unchanged (still the REMOTE admitting principal's own "user" scope, never this principal's own device-id) -- mintCapabilityToken's own narrowing refuses this outright if parent's own delegationsRemaining was 0 (nothing left to sub-delegate) or if userIdentity does not match parent's own bearer. On success, records the token-id under THIS principal's own issued-grant store, keyed by deviceId's hex, so a later revocation can find it -- reuses user-identity.ts's saveIssuedDmGrant/loadIssuedDmGrant/deleteIssuedDmGrant exactly as admitAgentForDm's own root-level self-grants do, since both are simply "grants this identity has issued," keyed by bearer, regardless of whether the grant is root-level or itself a delegation.
29
+ * Mints deviceId's own dm:send delegation from a received grant: bearer = deviceId, parent = the grant this principal itself was admitted with, scope unchanged (still the REMOTE admitting principal's own "user" scope, never this principal's own device-id); mintCapabilityToken's own narrowing refuses this outright if parent's own delegationsRemaining was 0 (nothing left to sub-delegate) or if userIdentity does not match parent's own bearer. On success, records the token-id in THIS principal's own replicated grant ledger as a dm grant keyed by deviceId's hex, so a later revocation on any of the account's machines can find it; admitAgentForDm's own root-level self-grants are recorded the same way, since both are simply grants this identity has issued, keyed by bearer, whether root-level or a delegation.
30
30
  */
31
31
  export declare function delegateDmSendToDevice(options: Readonly<DelegateDmSendToDeviceOptions>): Promise<MintVerdict>;
32
32
  //# sourceMappingURL=dm-send-delegation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dm-send-delegation.d.ts","sourceRoot":"","sources":["../../src/core/dm-send-delegation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACT,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAK5B,MAAM,WAAW,6BAA6B;IAC5C,+OAA+O;IAC/O,YAAY,EAAE,YAAY,CAAC;IAC3B,sLAAsL;IACtL,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACjC,iOAAiO;IACjO,MAAM,EAAE,eAAe,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,EAAE,QAAQ,CAAC;IACnB,yPAAyP;IACzP,2BAA2B,EAAE,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,sNAAsN;IACtN,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,QAAQ,CAAC,6BAA6B,CAAC,GAC/C,OAAO,CAAC,WAAW,CAAC,CAuBtB"}
1
+ {"version":3,"file":"dm-send-delegation.d.ts","sourceRoot":"","sources":["../../src/core/dm-send-delegation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACT,MAAM,mCAAmC,CAAC;AAK3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzD,MAAM,WAAW,6BAA6B;IAC5C,+OAA+O;IAC/O,YAAY,EAAE,YAAY,CAAC;IAC3B,gIAAgI;IAChI,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACjC,iOAAiO;IACjO,MAAM,EAAE,eAAe,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,EAAE,QAAQ,CAAC;IACnB,yPAAyP;IACzP,2BAA2B,EAAE,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,sNAAsN;IACtN,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,QAAQ,CAAC,6BAA6B,CAAC,GAC/C,OAAO,CAAC,WAAW,CAAC,CAuBtB"}
@@ -6,11 +6,10 @@
6
6
  import { mintCapabilityToken, } from "wire-mesh-core/domain/tokens";
7
7
  import { deviceIdToHex } from "wire-mesh-core/domain/device-id";
8
8
  import { DM_SEND_CAPABILITY, DM_SEND_SCOPE_KIND, } from "./dm-token-verification.js";
9
- import { saveIssuedDmGrant, } from "./user-identity.js";
10
9
  /** delegationsRemaining a delegated device's own token permits below it, when the caller doesn't ask for more -- 0, matching every other non-delegable grant this codebase already mints by default (device-membership.ts's own NOT_DELEGABLE): an ordinary device is a leaf of the chain, not a further delegator. */
11
10
  const LEAF_NOT_DELEGABLE = 0;
12
11
  /**
13
- * Mints deviceId's own dm:send delegation from a received grant: bearer = deviceId, parent = the grant this principal itself was admitted with, scope unchanged (still the REMOTE admitting principal's own "user" scope, never this principal's own device-id) -- mintCapabilityToken's own narrowing refuses this outright if parent's own delegationsRemaining was 0 (nothing left to sub-delegate) or if userIdentity does not match parent's own bearer. On success, records the token-id under THIS principal's own issued-grant store, keyed by deviceId's hex, so a later revocation can find it -- reuses user-identity.ts's saveIssuedDmGrant/loadIssuedDmGrant/deleteIssuedDmGrant exactly as admitAgentForDm's own root-level self-grants do, since both are simply "grants this identity has issued," keyed by bearer, regardless of whether the grant is root-level or itself a delegation.
12
+ * Mints deviceId's own dm:send delegation from a received grant: bearer = deviceId, parent = the grant this principal itself was admitted with, scope unchanged (still the REMOTE admitting principal's own "user" scope, never this principal's own device-id); mintCapabilityToken's own narrowing refuses this outright if parent's own delegationsRemaining was 0 (nothing left to sub-delegate) or if userIdentity does not match parent's own bearer. On success, records the token-id in THIS principal's own replicated grant ledger as a dm grant keyed by deviceId's hex, so a later revocation on any of the account's machines can find it; admitAgentForDm's own root-level self-grants are recorded the same way, since both are simply grants this identity has issued, keyed by bearer, whether root-level or a delegation.
14
13
  */
15
14
  export async function delegateDmSendToDevice(options) {
16
15
  const verdict = await mintCapabilityToken({
@@ -29,7 +28,7 @@ export async function delegateDmSendToDevice(options) {
29
28
  });
30
29
  if (!verdict.ok)
31
30
  return verdict;
32
- saveIssuedDmGrant(options.userIdentityOptions, deviceIdToHex(options.deviceId), options.tokenId);
31
+ await options.accountLedger.recordGrant("dm", deviceIdToHex(options.deviceId), options.tokenId);
33
32
  return verdict;
34
33
  }
35
34
  //# sourceMappingURL=dm-send-delegation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dm-send-delegation.js","sourceRoot":"","sources":["../../src/core/dm-send-delegation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,GAEpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,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uT;AACvT,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAoB7B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAgD;IAEhD,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC;QACxC,QAAQ,EAAE,OAAO,CAAC,YAAY;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,QAAQ;QACxB,UAAU,EAAE,kBAAkB;QAC9B,KAAK,EAAE;YACL,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,2BAA2B,CAAC;SACzD;QACD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,kBAAkB;QACxE,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,OAAO,CAAC;IAEhC,MAAM,OAAO,CAAC,aAAa,CAAC,WAAW,CACrC,IAAI,EACJ,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAC/B,OAAO,CAAC,OAAO,CAChB,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -40,8 +40,10 @@ export declare function findPresenceAdvert(deviceIdHex: string, directory: reado
40
40
  export type MembershipProofField = "membership" | "machine";
41
41
  /** The membership proof a peer gossiped in its agent/self advert under field, or undefined when it carries none. The advert is self-asserted by whichever peer sent it, so this only reads it; nothing about the proof is believed until it is verified. */
42
42
  export declare function readMembershipProof(advert: Readonly<Record<string, unknown>>, field: MembershipProofField): string | undefined;
43
- /** The machine name claim a peer gossiped in its agent/self advert (name-claim.ts), or undefined when it carries none. Only read here; nothing it says is believed until it is verified against the machine its proof names. */
44
- export declare function readMachineNameClaim(advert: Readonly<Record<string, unknown>>): string | undefined;
43
+ /** Which agent/self field carries which issuer's name claim: `machineName` the machine's, `principalName` the user principal's. */
44
+ export type NameClaimField = "machineName" | "principalName";
45
+ /** The name claim a peer gossiped in its agent/self advert under field (name-claim.ts), or undefined when it carries none. Only read here; nothing it says is believed until it is verified against the issuer its proof names. */
46
+ export declare function readNameClaim(advert: Readonly<Record<string, unknown>>, field: NameClaimField): string | undefined;
45
47
  /** The one thing gossip re-advertisement needs from a session: somewhere to send the extension bag. */
46
48
  export type GossipSession = Pick<AcceptedMeshSession, "sendGossipUpdate">;
47
49
  /** Which session, if any, is the hub's. */
@@ -1 +1 @@
1
- {"version":3,"file":"gossip-directory.d.ts","sourceRoot":"","sources":["../../src/core/gossip-directory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,8nBAA8nB;AAC9nB,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACrC,SAAS,EAAE,SAAS,cAAc,EAAE,GACnC,IAAI,CAWN;AAED;;;;GAIG;AACH,qBAAa,YAAY;IAKX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAElD,iFAAiF;gBACpD,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO;IAErE,uEAAuE;IACvE,UAAU,CAAC,SAAS,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,SAAS,CAAC;IACpE,gBAAgB,EAAE,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,SAAS,CAiC7C"}
@@ -87,14 +87,13 @@ export function readMembershipProof(advert, field) {
87
87
  ? self.machine
88
88
  : undefined;
89
89
  }
90
- /** The machine name claim a peer gossiped in its agent/self advert (name-claim.ts), or undefined when it carries none. Only read here; nothing it says is believed until it is verified against the machine its proof names. */
91
- export function readMachineNameClaim(advert) {
90
+ /** The name claim a peer gossiped in its agent/self advert under field (name-claim.ts), or undefined when it carries none. Only read here; nothing it says is believed until it is verified against the issuer its proof names. */
91
+ export function readNameClaim(advert, field) {
92
92
  const self = advert[AGENT_SELF_GOSSIP_KEY];
93
93
  if (typeof self !== "object" || self === null)
94
94
  return undefined;
95
- return "machineName" in self && typeof self.machineName === "string"
96
- ? self.machineName
97
- : undefined;
95
+ const claim = field in self ? Reflect.get(self, field) : undefined;
96
+ return typeof claim === "string" ? claim : undefined;
98
97
  }
99
98
  /** Re-sends this side's own current presence status, currently-hosted rooms, self-agent identity, and package versions, together, onto every live session's gossip self-advert -- one gossip frame per tick carrying whichever facts are actually known, rather than a separate frame per fact. Split out of wire-mesh-transport.ts's own WireMeshTransport class purely to keep that file under the repo's max-lines cap, the same reason mergeKnownDevices/findPresenceAdvert above already live here rather than there. A session that fails to send (mid-disconnect, most likely -- watchForDisconnect will independently notice and clean it up) is reported via onError and skipped, not allowed to stop the tick from reaching the rest of allSessions: a periodic broadcast to N peers is N independent operations, not one atomic unit. Unlike presence/hostedRooms/selfAgentAdvert, the versions extension is never actually absent (this side's own agent-comms package version is always known), so every tick this function is called for sends at least that one fact -- there is no "nothing to report" case left to short-circuit on. The hub's own session (agent-comms#156) is gated separately from every ordinary local-peer session in allSessions: local mesh trust is a different layer (connect_request/introduce approval already gated it before it ever joined allSessions), but the hub session is a broadcast to every connected hub peer, trusted or not, and would otherwise leak this side's own presence/hosted-rooms/self-agent/versions advert onto the hub regardless of GatewayTrust -- so this side's own advert waits on the same hasAny gate. It also waits for a visible agent (selfAgentAdvert is only ever defined for one): presence, hosted rooms and versions describe the agent and its process, so a hidden or unregistered store puts none of them on the hub, and a hidden agent is left with only the device advert every session opens with, which is what lets it be reached by device id. What the hub session does carry is reduced to what is safe to hand to strangers (presence, the agent's name, harness and membership proof, the public rooms it hosts by path and name, and the package versions): the hub relays it to every client that connects, so the working directory, process id, tags and rooms go only to peers this side is connected to directly (agent-comms#322). */
100
99
  export function readvertiseGossip(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"gossip-directory.js","sourceRoot":"","sources":["../../src/core/gossip-directory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAMhE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,GAGrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,8BAA8B,GAE/B,MAAM,oBAAoB,CAAC;AAG5B,8nBAA8nB;AAC9nB,MAAM,UAAU,iBAAiB,CAC/B,YAAqC,EACrC,SAAoC;IAEpC,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC/C,IACE,QAAQ,KAAK,SAAS;YACtB,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,EAChE,CAAC;YACD,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,K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,SAAS;QAChC,cAAc,KAAK,SAAS;QAC5B,kBAAkB,KAAK,SAAS,EAChC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,iBAAiB,CAAC;YAChB,WAAW;YACX,GAAG;YACH,oBAAoB;YACpB,OAAO;YACP,kBAAkB;YAClB,cAAc;YACd,kBAAkB;YAClB,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC,EAAE,UAAU,CAAC,CAAC;IACf,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -33,6 +33,8 @@ export interface AgentSelfSummary {
33
33
  machine?: string;
34
34
  /** This device's machine's self display name claim (name-claim.ts, agent-comms#345), signed by the machine key, so a peer can show the name the machine chose for itself. Absent while the machine has no name. Travels with the machine proof, under the same visibility rule. */
35
35
  machineName?: string;
36
+ /** This device's user principal's self display name claim (name-claim.ts, agent-comms#359), signed by the user key, so a peer can show the name the account chose for itself. Absent while the account has no name. Travels with the membership proof, under the same visibility rule. */
37
+ principalName?: string;
36
38
  }
37
39
  /** What a bridge knows about itself beyond its summary, and shares only with peers it deals with directly: a hub relays what it is given to every client that connects, so none of this goes to one. */
38
40
  export interface AgentSelfDetails {
@@ -1 +1 @@
1
- {"version":3,"file":"gossip-extensions.d.ts","sourceRoot":"","sources":["../../src/core/gossip-extensions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,eAAO,MAAM,gCAAgC,QACU,CAAC;AAIxD,gPAAgP;AAChP,eAAO,MAAM,+BAA+B,QACoB,CAAC;AAEjE,8QAA8Q;AAC9Q,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,mSAAmS;AACnS,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD,+cAA+c;AAC/c,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;I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GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,gkBAAgkB;AAChkB,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,gBAAgB;CAAG;AAE9E,sHAAsH;AACtH,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GACpD,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE5B,mEAAmE;AACnE,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,GAChC,gBAAgB,CAelB"}
@@ -33,6 +33,9 @@ export function summariseAgentSelfAdvert(advert) {
33
33
  ...(advert.machineName !== undefined
34
34
  ? { machineName: advert.machineName }
35
35
  : {}),
36
+ ...(advert.principalName !== undefined
37
+ ? { principalName: advert.principalName }
38
+ : {}),
36
39
  };
37
40
  }
38
41
  //# sourceMappingURL=gossip-extensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gossip-extensions.js","sourceRoot":"","sources":["../../src/core/gossip-extensions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,mZAAmZ;AACnZ,MAAM,qCAAqC,GAAG,EAAE,CAAC;AACjD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,qCAAqC,GAAG,aAAa,CAAC;AAExD,0zBAA0zB;AAC1zB,MAAM,2BAA2B,GAAG,CAAC,CAAC;AACtC,gPAAgP;AAChP,MAAM,CAAC,MAAM,+BAA+B,GAC1C,gCAAgC,GAAG,2BAA2B,CAAC;AAEjE,8QAA8Q;AAC9Q,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD,mSAAmS;AACnS,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAoBrD,6FAA6F;AAC7F,MAAM,UAAU,o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AC,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE;YACzC,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This device's membership proofs under both of its grouping issuers, its user principal (agent-comms#266) and its machine (agent-comms#343), and the machine's self display name claim (agent-comms#345), with the checks for other devices' proofs and claims and the machine grouping and names list_agents shows. Split out of MeshStore, which hands it its identity, peer id, transport and error sink.
2
+ * This device's membership proofs under both of its grouping issuers, its user principal (agent-comms#266) and its machine (agent-comms#343), and the self display name claims of both (agent-comms#345 for the machine, agent-comms#359 for the principal), with the checks for other devices' proofs and claims and the machine grouping and names list_agents shows. Split out of MeshStore, which hands it its identity, peer id, transport and error sink.
3
3
  */
4
4
  import type { MeshStoreIdentity } from "./mesh-store-shared.js";
5
5
  import type { MeshTransport } from "./transport.js";
@@ -19,17 +19,26 @@ export interface GroupProofsDeps {
19
19
  export declare class GroupProofs {
20
20
  private readonly principal;
21
21
  private readonly machine;
22
- private readonly grouping;
22
+ private readonly machineGrouping;
23
+ private readonly principalGrouping;
23
24
  private readonly machineName;
25
+ private readonly principalName;
24
26
  private readonly getIdentity;
25
27
  constructor(deps: Readonly<GroupProofsDeps>);
28
+ /** Whether a gossiped proof shows that deviceHex belongs to the account this store holds, judged against the user principal's own proofs (MembershipProofs.isAccountMember). */
29
+ isAccountMember(claim: Readonly<{
30
+ proof: string;
31
+ deviceHex: string;
32
+ }>): Promise<boolean>;
26
33
  /** The agent/self advert fields carrying this device's current proofs, each absent until it has first been minted. */
27
- advertFields(): Pick<AgentSelfSummary, "membership" | "machine" | "machineName">;
28
- /** Starts keeping both proofs fresh; called once the store's identity is attached. */
34
+ advertFields(): Pick<AgentSelfSummary, "membership" | "machine" | "machineName" | "principalName">;
35
+ /** Starts keeping both proofs and both name claims fresh; called once the store's identity is attached. */
29
36
  start(): void;
30
37
  stop(): void;
31
38
  /** Sets (or, given undefined, clears) this machine's self display name and re-mints its claim now rather than on the next refresh. Throws if the store has no identity yet. */
32
39
  saveMachineName(name: string | undefined): Promise<void>;
40
+ /** Sets (or, given undefined, clears) this account's self display name and re-mints its claim now rather than on the next refresh. Throws if the store has no identity yet. */
41
+ saveUserName(name: string | undefined): Promise<void>;
33
42
  /** Whether a gossiped proof shows that issuerHex, a principal or a machine, vouches for deviceHex. */
34
43
  verify(claim: Readonly<{
35
44
  proof: string;
@@ -43,7 +52,7 @@ export declare class GroupProofs {
43
52
  }>): Promise<IdentifiedMembershipProof>;
44
53
  /** The machine (hex) of each device this side can place on one, keyed by device id. */
45
54
  machinesByDevice(): Promise<Map<string, string>>;
46
- /** The self display name of each machine this side can place a device on, keyed by machine id. */
47
- machineNames(): Promise<Map<string, string>>;
55
+ /** The self display name of each grouping issuer this side can place a device under, machines and user principals together, keyed by issuer id. The two kinds of id never collide, since each is the hash of a different key. */
56
+ issuerNames(): Promise<Map<string, string>>;
48
57
  }
49
58
  //# sourceMappingURL=group-proofs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"group-proofs.d.ts","sourceRoot":"","sources":["../../src/core/group-proofs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AASpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,WAAW,EAAE,MAAM,iBAAiB,CAAC;IACrC,iEAAiE;IACjE,YAAY,EAAE,MAAM,iBAAiB,GAAG,SAAS,CAAC;IAClD,kCAAkC;IAClC,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,aAAa,CAAC;IACtC,OAAO,EAAE,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