@serfab/cadre-core 1.23.0 → 1.24.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 (313) hide show
  1. package/README.md +216 -294
  2. package/dist/arachnode-stub.d.ts +12 -4
  3. package/dist/arachnode-stub.js +15 -8
  4. package/dist/arachnode-stub.js.map +1 -1
  5. package/dist/cadre-invite-protocol.js +5 -4
  6. package/dist/cadre-invite-protocol.js.map +1 -1
  7. package/dist/cadre-node.d.ts +145 -44
  8. package/dist/cadre-node.js +239 -79
  9. package/dist/cadre-node.js.map +1 -1
  10. package/dist/control-authorization.d.ts +14 -2
  11. package/dist/control-authorization.js +8 -3
  12. package/dist/control-authorization.js.map +1 -1
  13. package/dist/control-cohort.d.ts +27 -13
  14. package/dist/control-cohort.js +21 -14
  15. package/dist/control-cohort.js.map +1 -1
  16. package/dist/control-database.d.ts +18 -16
  17. package/dist/control-database.js +57 -22
  18. package/dist/control-database.js.map +1 -1
  19. package/dist/control-protocol-guard.d.ts +1 -1
  20. package/dist/control-protocol-guard.js +7 -3
  21. package/dist/control-protocol-guard.js.map +1 -1
  22. package/dist/control-read-retry.d.ts +49 -11
  23. package/dist/control-read-retry.js +56 -15
  24. package/dist/control-read-retry.js.map +1 -1
  25. package/dist/control-retry.d.ts +32 -3
  26. package/dist/control-retry.js +35 -4
  27. package/dist/control-retry.js.map +1 -1
  28. package/dist/control-schema-version.d.ts +5 -5
  29. package/dist/control-schema-version.js +5 -5
  30. package/dist/control-schema-version.js.map +1 -1
  31. package/dist/control-schema.d.ts +5 -5
  32. package/dist/control-schema.js +1032 -1011
  33. package/dist/control-schema.js.map +1 -1
  34. package/dist/control-write-retry.d.ts +54 -65
  35. package/dist/control-write-retry.js +134 -158
  36. package/dist/control-write-retry.js.map +1 -1
  37. package/dist/delegate-admission.d.ts +1 -1
  38. package/dist/delegate-admission.js +1 -1
  39. package/dist/edge-node/config.d.ts +4 -3
  40. package/dist/edge-node/config.js +11 -9
  41. package/dist/edge-node/config.js.map +1 -1
  42. package/dist/edge-node/dissolve.d.ts +4 -4
  43. package/dist/edge-node/dissolve.js +4 -4
  44. package/dist/edge-node/edge-join.d.ts +1 -1
  45. package/dist/edge-node/edge-join.js +1 -1
  46. package/dist/edge-node/edge-node.js +2 -2
  47. package/dist/edge-node/edge-node.js.map +1 -1
  48. package/dist/edge-node/index.d.ts +1 -0
  49. package/dist/edge-node/index.js +1 -0
  50. package/dist/edge-node/index.js.map +1 -1
  51. package/dist/edge-node/join-credential.d.ts +1 -1
  52. package/dist/edge-node/join-credential.js +1 -1
  53. package/dist/edge-node/lazy-raw-storage.js +12 -0
  54. package/dist/edge-node/lazy-raw-storage.js.map +1 -1
  55. package/dist/edge-node/listen-addrs.d.ts +21 -0
  56. package/dist/edge-node/listen-addrs.js +25 -0
  57. package/dist/edge-node/listen-addrs.js.map +1 -0
  58. package/dist/edge-node/owner-grant.d.ts +1 -1
  59. package/dist/edge-node/owner-grant.js +1 -1
  60. package/dist/edge-node/platform.d.ts +5 -4
  61. package/dist/edge-node/platform.js.map +1 -1
  62. package/dist/edge-node/strand-move.d.ts +1 -1
  63. package/dist/edge-node/strand-move.js +1 -1
  64. package/dist/edge-node/strands.js +27 -11
  65. package/dist/edge-node/strands.js.map +1 -1
  66. package/dist/index.d.ts +7 -5
  67. package/dist/index.js +18 -7
  68. package/dist/index.js.map +1 -1
  69. package/dist/invitation-bootstrap.d.ts +28 -5
  70. package/dist/invitation-bootstrap.js +41 -8
  71. package/dist/invitation-bootstrap.js.map +1 -1
  72. package/dist/link-budget.d.ts +53 -4
  73. package/dist/link-budget.js +58 -5
  74. package/dist/link-budget.js.map +1 -1
  75. package/dist/machine-removal.d.ts +2 -2
  76. package/dist/machine-removal.js +4 -3
  77. package/dist/machine-removal.js.map +1 -1
  78. package/dist/membership-connection-gater.d.ts +2 -2
  79. package/dist/membership-connection-gater.js +2 -2
  80. package/dist/membership-view.d.ts +2 -2
  81. package/dist/membership-view.js +2 -2
  82. package/dist/node-claim-payload.d.ts +15 -7
  83. package/dist/node-claim-payload.js +25 -9
  84. package/dist/node-claim-payload.js.map +1 -1
  85. package/dist/node-class.d.ts +36 -0
  86. package/dist/node-class.js +26 -0
  87. package/dist/node-class.js.map +1 -0
  88. package/dist/node-default-transports.d.ts +50 -3
  89. package/dist/node-default-transports.js +48 -3
  90. package/dist/node-default-transports.js.map +1 -1
  91. package/dist/node-roles.d.ts +118 -0
  92. package/dist/node-roles.js +142 -0
  93. package/dist/node-roles.js.map +1 -0
  94. package/dist/node-transports.d.ts +6 -2
  95. package/dist/node-transports.js +39 -7
  96. package/dist/node-transports.js.map +1 -1
  97. package/dist/owner-anchor-sync.js +1 -1
  98. package/dist/owner-key-export.js +1 -1
  99. package/dist/owner-key-flows.d.ts +1 -1
  100. package/dist/owner-key-store.js +1 -1
  101. package/dist/owner-signer.js +1 -1
  102. package/dist/peer-authorization.d.ts +3 -1
  103. package/dist/peer-authorization.js +3 -1
  104. package/dist/peer-authorization.js.map +1 -1
  105. package/dist/peer-dial.d.ts +74 -10
  106. package/dist/peer-dial.js +89 -17
  107. package/dist/peer-dial.js.map +1 -1
  108. package/dist/peer-join-backfill.js +4 -4
  109. package/dist/peer-join-backfill.js.map +1 -1
  110. package/dist/peer-record.d.ts +34 -9
  111. package/dist/peer-record.js +66 -13
  112. package/dist/peer-record.js.map +1 -1
  113. package/dist/pending-join-runner.d.ts +1 -1
  114. package/dist/pending-join-runner.js +1 -1
  115. package/dist/provider/client.d.ts +6 -5
  116. package/dist/provider/client.js +3 -3
  117. package/dist/provider/client.js.map +1 -1
  118. package/dist/provider/descriptor.d.ts +1 -1
  119. package/dist/provider/descriptor.js +1 -1
  120. package/dist/provider/oauth.d.ts +1 -1
  121. package/dist/provider/oauth.js +1 -1
  122. package/dist/provider/rent-node.d.ts +4 -3
  123. package/dist/provider/rent-node.js +3 -3
  124. package/dist/provider/rent-node.js.map +1 -1
  125. package/dist/relay-addrs.d.ts +62 -7
  126. package/dist/relay-addrs.js +74 -11
  127. package/dist/relay-addrs.js.map +1 -1
  128. package/dist/relay-reservation.d.ts +1 -1
  129. package/dist/relay-reservation.js +1 -1
  130. package/dist/relay-server.d.ts +6 -5
  131. package/dist/relay-server.js +5 -5
  132. package/dist/relay-server.js.map +1 -1
  133. package/dist/schema-verification.d.ts +13 -10
  134. package/dist/schema-verification.js +32 -24
  135. package/dist/schema-verification.js.map +1 -1
  136. package/dist/sealed-party-key.js +1 -1
  137. package/dist/seed-bootstrap.d.ts +4 -3
  138. package/dist/seed-bootstrap.js +6 -7
  139. package/dist/seed-bootstrap.js.map +1 -1
  140. package/dist/strand-addr-protocol.d.ts +8 -6
  141. package/dist/strand-addr-protocol.js +12 -10
  142. package/dist/strand-addr-protocol.js.map +1 -1
  143. package/dist/strand-app-schema-report.d.ts +16 -2
  144. package/dist/strand-app-schema-report.js +15 -0
  145. package/dist/strand-app-schema-report.js.map +1 -1
  146. package/dist/strand-cohort.d.ts +1 -4
  147. package/dist/strand-cohort.js.map +1 -1
  148. package/dist/strand-commit-durability.d.ts +1 -1
  149. package/dist/strand-database.d.ts +13 -6
  150. package/dist/strand-database.js +17 -9
  151. package/dist/strand-database.js.map +1 -1
  152. package/dist/strand-first-sync-gate.d.ts +3 -2
  153. package/dist/strand-first-sync-gate.js +3 -2
  154. package/dist/strand-first-sync-gate.js.map +1 -1
  155. package/dist/strand-formation-deadlines.d.ts +2 -2
  156. package/dist/strand-formation-deadlines.js +2 -2
  157. package/dist/strand-formation-protocol.d.ts +1 -1
  158. package/dist/strand-formation-protocol.js +51 -16
  159. package/dist/strand-formation-protocol.js.map +1 -1
  160. package/dist/strand-instance-manager.d.ts +67 -33
  161. package/dist/strand-instance-manager.js +164 -55
  162. package/dist/strand-instance-manager.js.map +1 -1
  163. package/dist/strand-membership-reconciler.d.ts +8 -3
  164. package/dist/strand-membership-reconciler.js +8 -3
  165. package/dist/strand-membership-reconciler.js.map +1 -1
  166. package/dist/strand-membership-writer.d.ts +2 -2
  167. package/dist/strand-membership-writer.js +41 -39
  168. package/dist/strand-membership-writer.js.map +1 -1
  169. package/dist/strand-move.js +1 -1
  170. package/dist/strand-network-config.d.ts +15 -5
  171. package/dist/strand-network-config.js +7 -6
  172. package/dist/strand-network-config.js.map +1 -1
  173. package/dist/strand-party-key-rotation.d.ts +7 -3
  174. package/dist/strand-party-key-rotation.js +7 -3
  175. package/dist/strand-party-key-rotation.js.map +1 -1
  176. package/dist/strand-party-machines.d.ts +19 -8
  177. package/dist/strand-party-machines.js +26 -11
  178. package/dist/strand-party-machines.js.map +1 -1
  179. package/dist/strand-party-peers.d.ts +36 -14
  180. package/dist/strand-party-peers.js +24 -15
  181. package/dist/strand-party-peers.js.map +1 -1
  182. package/dist/strand-peer-redial.d.ts +1 -1
  183. package/dist/strand-peer-redial.js +1 -1
  184. package/dist/strand-reactivity.d.ts +20 -17
  185. package/dist/strand-reactivity.js +31 -18
  186. package/dist/strand-reactivity.js.map +1 -1
  187. package/dist/strand-revocation-enforcer.d.ts +3 -3
  188. package/dist/strand-revocation-enforcer.js +3 -3
  189. package/dist/strand-wake-protocol.d.ts +19 -7
  190. package/dist/strand-wake-protocol.js +22 -10
  191. package/dist/strand-wake-protocol.js.map +1 -1
  192. package/dist/strand-watcher.d.ts +1 -1
  193. package/dist/strand-watcher.js +1 -1
  194. package/dist/table-change-watch.js +1 -1
  195. package/dist/types.d.ts +116 -55
  196. package/dist/types.js.map +1 -1
  197. package/dist/webrtc-upgrade.d.ts +254 -0
  198. package/dist/webrtc-upgrade.js +355 -0
  199. package/dist/webrtc-upgrade.js.map +1 -0
  200. package/package.json +9 -9
  201. package/src/announce-addrs.ts +93 -93
  202. package/src/arachnode-stub.ts +18 -10
  203. package/src/bootstrap-peer-store-file.ts +44 -44
  204. package/src/bootstrap-peer-store.ts +214 -214
  205. package/src/cadre-invite-protocol.ts +741 -740
  206. package/src/cadre-node.ts +12462 -12280
  207. package/src/claim-proof.ts +147 -147
  208. package/src/control-authorization.ts +290 -276
  209. package/src/control-cohort.ts +223 -204
  210. package/src/control-database.ts +72 -28
  211. package/src/control-formation-recorder.ts +359 -359
  212. package/src/control-protocol-guard.ts +370 -366
  213. package/src/control-read-retry.ts +222 -180
  214. package/src/control-retry.ts +36 -4
  215. package/src/control-schema-version.ts +301 -301
  216. package/src/control-schema.ts +1108 -1087
  217. package/src/control-write-retry.ts +639 -669
  218. package/src/delegate-admission.ts +351 -351
  219. package/src/describe-thrown.ts +60 -60
  220. package/src/ed25519-key.ts +185 -185
  221. package/src/edge-node/config.ts +13 -10
  222. package/src/edge-node/dissolve.ts +252 -252
  223. package/src/edge-node/edge-join.ts +320 -320
  224. package/src/edge-node/edge-node.ts +1095 -1095
  225. package/src/edge-node/index.ts +60 -59
  226. package/src/edge-node/join-credential.ts +16 -16
  227. package/src/edge-node/lazy-raw-storage.ts +194 -178
  228. package/src/edge-node/listen-addrs.ts +26 -0
  229. package/src/edge-node/node-local.ts +84 -84
  230. package/src/edge-node/options.ts +195 -195
  231. package/src/edge-node/owner-grant.ts +63 -63
  232. package/src/edge-node/platform.ts +5 -4
  233. package/src/edge-node/strand-move.ts +266 -266
  234. package/src/edge-node/strands.ts +27 -12
  235. package/src/enrolled-machine-store-file.ts +43 -43
  236. package/src/enrolled-machine-store.ts +280 -280
  237. package/src/fetch-impl.ts +23 -23
  238. package/src/file-durable-slot.ts +64 -64
  239. package/src/file-safe-name.ts +32 -32
  240. package/src/formation-approval.ts +604 -604
  241. package/src/formation-token.ts +63 -63
  242. package/src/fs-atomic.ts +92 -92
  243. package/src/index.ts +987 -957
  244. package/src/invitation-bootstrap.ts +152 -118
  245. package/src/joined-strand-store.ts +553 -553
  246. package/src/key-store-file.ts +142 -142
  247. package/src/link-budget.ts +61 -5
  248. package/src/machine-removal.ts +211 -210
  249. package/src/member-redemption.ts +643 -643
  250. package/src/membership-connection-gater.ts +650 -650
  251. package/src/membership-view.ts +147 -147
  252. package/src/node-claim-payload.ts +34 -12
  253. package/src/node-class.ts +47 -0
  254. package/src/node-default-transports.ts +65 -3
  255. package/src/node-roles.ts +220 -0
  256. package/src/node-transports.ts +86 -49
  257. package/src/owner-anchor-sync.ts +172 -172
  258. package/src/owner-grant-protocol.ts +547 -547
  259. package/src/owner-key-export.ts +348 -348
  260. package/src/owner-key-flows.ts +109 -109
  261. package/src/owner-key-store.ts +1 -1
  262. package/src/owner-keys.ts +179 -179
  263. package/src/owner-signer.ts +92 -92
  264. package/src/peer-addr-book.ts +252 -252
  265. package/src/peer-authorization.ts +584 -582
  266. package/src/peer-dial.ts +698 -605
  267. package/src/peer-join-backfill.ts +961 -961
  268. package/src/peer-record.ts +71 -16
  269. package/src/pending-join-runner.ts +798 -798
  270. package/src/primary-lan-address.ts +47 -47
  271. package/src/provider/client.ts +327 -326
  272. package/src/provider/descriptor.ts +129 -129
  273. package/src/provider/index.ts +59 -59
  274. package/src/provider/oauth.ts +285 -285
  275. package/src/provider/rent-node.ts +276 -275
  276. package/src/relay-addrs.ts +90 -12
  277. package/src/relay-reservation.ts +1 -1
  278. package/src/relay-server.ts +99 -98
  279. package/src/schema-verification.ts +38 -23
  280. package/src/sealed-party-key.ts +190 -190
  281. package/src/seed-bootstrap.ts +8 -11
  282. package/src/seed-trust-policy.ts +353 -353
  283. package/src/self-address-update.ts +19 -19
  284. package/src/strand-addr-protocol.ts +17 -14
  285. package/src/strand-app-schema-report.ts +147 -122
  286. package/src/strand-cohort.ts +1 -5
  287. package/src/strand-commit-durability.ts +165 -165
  288. package/src/strand-database.ts +522 -510
  289. package/src/strand-first-sync-gate.ts +3 -2
  290. package/src/strand-formation-deadlines.ts +227 -227
  291. package/src/strand-formation-manager.ts +731 -731
  292. package/src/strand-formation-protocol.ts +1174 -1138
  293. package/src/strand-fret-addrs.ts +179 -179
  294. package/src/strand-instance-manager.ts +188 -63
  295. package/src/strand-membership-reconciler.ts +1315 -1310
  296. package/src/strand-membership-writer.ts +2152 -2150
  297. package/src/strand-move.ts +1 -1
  298. package/src/strand-network-config.ts +16 -6
  299. package/src/strand-offline.ts +178 -178
  300. package/src/strand-party-key-rotation.ts +440 -436
  301. package/src/strand-party-machines.ts +308 -293
  302. package/src/strand-party-peers.ts +151 -129
  303. package/src/strand-peer-redial.ts +1 -1
  304. package/src/strand-reactivity.ts +36 -19
  305. package/src/strand-revocation-enforcer.ts +758 -758
  306. package/src/strand-wake-protocol.ts +406 -394
  307. package/src/strand-watcher.ts +1 -1
  308. package/src/table-change-watch.ts +285 -285
  309. package/src/timed-step.ts +28 -28
  310. package/src/timeout-scheduler.ts +29 -29
  311. package/src/trusted-owner-store.ts +242 -242
  312. package/src/types.ts +3182 -3121
  313. package/src/webrtc-upgrade.ts +439 -0
@@ -9,14 +9,23 @@
9
9
  * carries no party id: the claim supplies it, and the node records it.
10
10
  *
11
11
  * The decoder lives here, beside the encoder, because the phone and the host both need
12
- * it and neither depends on the other. Imports only `@multiformats/multiaddr`,
13
- * `@libp2p/peer-id` and `uint8arrays`, so it loads on React Native and in the browser.
12
+ * it and neither depends on the other. Its own code is pure, and it imports only
13
+ * `@multiformats/multiaddr`, `@libp2p/peer-id` and `uint8arrays` — nothing platform-bound —
14
+ * so it loads on React Native and in the browser.
15
+ *
16
+ * The one exception is {@link addrKindOfComponents} from `peer-dial.ts`, taken rather than
17
+ * restated so that "does this address need ICE after its relay hop" has ONE answer in the
18
+ * package (`docs/network/relay.md` → "Direct connections over WebRTC" is the rule it serves).
19
+ * That import's own graph reaches `link-budget.ts` and therefore `@optimystic/db-p2p`, which is
20
+ * heavier than anything else here but is not platform-bound either, and this module is reachable
21
+ * only through the package index, which loads it regardless.
14
22
  */
15
23
  import { peerIdFromString } from '@libp2p/peer-id';
16
24
  import { multiaddr, CODE_DNS, CODE_DNS4, CODE_DNS6, CODE_DNSADDR, CODE_IP4, CODE_IP6, CODE_IP6ZONE, CODE_P2P, CODE_P2P_CIRCUIT, CODE_WS, CODE_WSS, } from '@multiformats/multiaddr';
17
25
  import { fromString as uint8ArrayFromString, toString as uint8ArrayToString } from 'uint8arrays';
18
26
  import { canonicalJson } from './canonical-json.js';
19
27
  import { parseClaimSecret } from './claim-proof.js';
28
+ import { addrKindOfComponents } from './peer-dial.js';
20
29
  /** Version 1 of the payload; the only one either side reads. */
21
30
  export const NODE_CLAIM_PAYLOAD_PREFIX = 'sereus-join:1.';
22
31
  /** Encode a payload as the text the host shows. Refuses what {@link decodeNodeClaimPayload} would. */
@@ -66,24 +75,26 @@ export function decodeNodeClaimPayload(text) {
66
75
  * unparsable ones are dropped, and so is plain TCP unless `includeTcp`.
67
76
  * - Public names (`/dns*`) come first: they work away from home. Public IP addresses are
68
77
  * kept only when there is no public name, since they reach the same machine.
69
- * - Private addresses follow, narrowed by {@link NodeClaimAddressOptions.lan}; relay
70
- * addresses last.
78
+ * - Private addresses follow, narrowed by {@link NodeClaimAddressOptions.lan}; then relay
79
+ * addresses, and last of all a relayed address that needs ICE after its hop (`webrtc`),
80
+ * which answers nothing for about 23 s when ICE cannot connect.
71
81
  *
72
- * Pure and dependency-light, like the codec beside it, so it loads on React Native too.
73
- * Finding the LAN address is the caller's (Node: `@serfab/cadre-core/primary-lan-address`).
82
+ * Pure, like the codec beside it, so it loads on React Native too. Finding the LAN address is
83
+ * the caller's (Node: `@serfab/cadre-core/primary-lan-address`).
74
84
  */
75
85
  export function selectNodeClaimAddresses(reported, peerId, options = {}) {
76
86
  const names = [];
77
87
  const publicIps = [];
78
88
  const privates = [];
79
89
  const relayed = [];
90
+ const webrtc = [];
80
91
  for (const raw of reported) {
81
92
  const classified = classifyClaimAddress(raw.trim(), peerId, options);
82
93
  if (!classified)
83
94
  continue;
84
- ({ name: names, public: publicIps, private: privates, relay: relayed })[classified.kind].push(classified.addr);
95
+ ({ name: names, public: publicIps, private: privates, relay: relayed, webrtc })[classified.kind].push(classified.addr);
85
96
  }
86
- return [...new Set([...names, ...(names.length > 0 ? [] : publicIps), ...privates, ...relayed])];
97
+ return [...new Set([...names, ...(names.length > 0 ? [] : publicIps), ...privates, ...relayed, ...webrtc])];
87
98
  }
88
99
  /**
89
100
  * `addr` as a node code carries it: with `/p2p/<peerId>` appended unless it already names a
@@ -114,8 +125,13 @@ function componentsOf(addr) {
114
125
  }
115
126
  /** {@link classifyDialAddress}, keeping the IP for a caller that narrows private addresses by it. */
116
127
  function classifyComponents(components, includeTcp) {
117
- if (components.some((c) => c.code === CODE_P2P_CIRCUIT))
128
+ // One answer to "does this need a relay hop, and does it need ICE after that hop"; the
129
+ // `CODE_P2P_CIRCUIT` test below in `destinationIn` asks a different question.
130
+ const relayHop = addrKindOfComponents(components);
131
+ if (relayHop === 'relayed')
118
132
  return { kind: 'relay' };
133
+ if (relayHop === 'webrtc')
134
+ return { kind: 'webrtc' };
119
135
  if (!includeTcp && !components.some((c) => c.code === CODE_WS || c.code === CODE_WSS))
120
136
  return undefined;
121
137
  const host = components[0];
@@ -1 +1 @@
1
- {"version":3,"file":"node-claim-payload.js","sourceRoot":"","sources":["../src/node-claim-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACN,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,QAAQ,GACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,gEAAgE;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAW1D,sGAAsG;AACtG,MAAM,UAAU,sBAAsB,CAAC,OAAyB;IAC/D,MAAM,OAAO,GAAG,uBAAuB,CAA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4CAA4C,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,kBAAkB,CAAC,CAAC;IAC5G,CAAC;IACD,IAAI,KAA0C,CAAC;IAC/C,IAAI,CAAC;QACJ,KAAK,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,iEAAiE,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9G,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,IAAI,0BAA0B,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACrH,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,OAAO,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,aAAa,CAAC,UAA6B;IACnD,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC;QACjC,IAAI,SAAS,CAAC,IAAI,KAAK,gBAAgB;YAAE,OAAO,IAAI,CAAC;QACrD,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK;YAAE,OAAO,SAAS,CAAC,KAAK,CAAC;IAC5E,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * What kind of machine a node runs on, and the stored form of that fact the control network
3
+ * replicates.
4
+ *
5
+ * Two separate vocabularies on purpose. {@link NodeClass} is what an embedder sets and what
6
+ * every reader in this repository reasons about. {@link PublishedProfile} is the older pair of
7
+ * codes the `CadrePeer.Profile` column holds, kept because the control store is the one place
8
+ * backwards compatibility applies (`docs/cadre/control-schema.md` → "Schema versions and
9
+ * migrations"): a column rename cannot be migrated, and a party's machines update one at a
10
+ * time, so an older build's `KnownProfile` check would refuse a value replicated from an
11
+ * updated sibling. This module is the only place the two meet — nothing else writes or
12
+ * compares the stored codes.
13
+ */
14
+ /**
15
+ * What kind of machine a node runs on.
16
+ *
17
+ * `'device'` is a phone, laptop or browser running an app: intermittently connected, asleep or
18
+ * closed much of the time. `'server'` is an always-on node — a cadre-host child, a cadre-cli
19
+ * drone, a provider container. Both transact and both store; the class says how reachable the
20
+ * machine is, which is what the defaults derived from it (relay server, hosting unclaimed
21
+ * strands, the FRET profile db-p2p builds the node with) actually turn on.
22
+ *
23
+ * See `docs/cadre/node.md` → "Node classes".
24
+ */
25
+ export type NodeClass = 'device' | 'server';
26
+ /**
27
+ * The stored form of `CadrePeer.Profile`. Kept as-is for control-store compatibility; it
28
+ * encodes only whether the machine is always on.
29
+ */
30
+ export type PublishedProfile = 'transaction' | 'storage';
31
+ /** The stored form a machine publishes for whether it is always on. */
32
+ export declare function encodeAlwaysOn(alwaysOn: boolean): PublishedProfile;
33
+ /** Whether the machine that published `stored` is always on; null on a row it has not published. */
34
+ export declare function decodeAlwaysOn(stored: PublishedProfile | null): boolean | null;
35
+ /** Whether `value` is a stored `CadrePeer.Profile` the schema's `KnownProfile` check admits. */
36
+ export declare function isPublishedProfile(value: unknown): value is PublishedProfile;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * What kind of machine a node runs on, and the stored form of that fact the control network
3
+ * replicates.
4
+ *
5
+ * Two separate vocabularies on purpose. {@link NodeClass} is what an embedder sets and what
6
+ * every reader in this repository reasons about. {@link PublishedProfile} is the older pair of
7
+ * codes the `CadrePeer.Profile` column holds, kept because the control store is the one place
8
+ * backwards compatibility applies (`docs/cadre/control-schema.md` → "Schema versions and
9
+ * migrations"): a column rename cannot be migrated, and a party's machines update one at a
10
+ * time, so an older build's `KnownProfile` check would refuse a value replicated from an
11
+ * updated sibling. This module is the only place the two meet — nothing else writes or
12
+ * compares the stored codes.
13
+ */
14
+ /** The stored form a machine publishes for whether it is always on. */
15
+ export function encodeAlwaysOn(alwaysOn) {
16
+ return alwaysOn ? 'storage' : 'transaction';
17
+ }
18
+ /** Whether the machine that published `stored` is always on; null on a row it has not published. */
19
+ export function decodeAlwaysOn(stored) {
20
+ return stored === null ? null : stored === 'storage';
21
+ }
22
+ /** Whether `value` is a stored `CadrePeer.Profile` the schema's `KnownProfile` check admits. */
23
+ export function isPublishedProfile(value) {
24
+ return value === 'transaction' || value === 'storage';
25
+ }
26
+ //# sourceMappingURL=node-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-class.js","sourceRoot":"","sources":["../src/node-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH,uEAAuE;AACvE,MAAM,UAAU,cAAc,CAAC,QAAiB;IAC/C,OAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;AAC7C,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC7D,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;AACtD,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAChD,OAAO,KAAK,KAAK,aAAa,IAAI,KAAK,KAAK,SAAS,CAAC;AACvD,CAAC"}
@@ -7,21 +7,68 @@
7
7
  * built. A subpath module (`@serfab/cadre-core/node-default-transports`), like `push-node`,
8
8
  * because it names `@libp2p/tcp`: some bundlers (the NativeScript reference app's webpack) take
9
9
  * its Node implementation rather than its browser stub, and that needs `net`, `os` and `path`.
10
+ *
11
+ * It is also the only module in this repo that can give a Node host WebRTC, which is why
12
+ * `relay-addrs.ts` accepts a `/webrtc` listen entry only from a node that passed this function.
13
+ * See {@link loadNodeWebrtcTransport} for why that transport is loaded on demand and not
14
+ * imported here.
10
15
  */
11
16
  import type { Libp2pTransports } from '@optimystic/db-p2p';
12
17
  import type { ListenTransportOptions } from './relay-addrs.js';
18
+ import type { StunServer } from './relay-stun.js';
19
+ /** One entry of a libp2p transport list — what `tcp()`, `webSockets()` or `webRTC()` returns. */
20
+ type TransportFactory = Libp2pTransports[number];
21
+ /**
22
+ * Builds `@libp2p/webrtc`'s Node transport over a set of STUN servers: what
23
+ * {@link loadNodeWebrtcTransport} resolves to, and what {@link nodeDefaultTransports} takes so
24
+ * that it stays synchronous.
25
+ */
26
+ export type NodeWebrtcTransport = (iceServers: readonly StunServer[]) => TransportFactory;
13
27
  /**
14
- * TCP, WebSocket exactly when the node's listen entries switch it on, and the circuit-relay
15
- * transport.
28
+ * Load `@libp2p/webrtc`'s Node transport factory. Call it once, at start, on the branch that
29
+ * asked for WebRTC, and hand the result to {@link nodeDefaultTransports}.
30
+ *
31
+ * A RUN-TIME import, deliberately — the one in this package. `@libp2p/webrtc`'s Node build
32
+ * reaches `node-datachannel`, which loads a native addon as its module is evaluated and throws
33
+ * when the running platform has no prebuilt binary for it. A node that did not ask for WebRTC
34
+ * must neither pay that load nor fail on it, and a static import would do both. The throw, when
35
+ * it comes, names `node-datachannel`, the platform and the architecture, which is what an
36
+ * operator on an unsupported platform needs to read.
37
+ *
38
+ * The STUN servers are supplied per call rather than baked in, because the resolved set depends
39
+ * on the node's relays (`relay-stun.ts` → `resolveStunServers`) and one process may build
40
+ * several nodes. No TURN server is configured anywhere: a WebRTC path that ICE cannot find stays
41
+ * on the circuit relay. See `docs/network/relay.md` → "Direct connections over WebRTC".
42
+ *
43
+ * NOTE: the load is conditional but the INSTALL is not. `@libp2p/webrtc` is a plain dependency
44
+ * of this package, so its 55-package closure — the `node-datachannel` prebuilt binary (about
45
+ * 19 MiB on Alpine x64) plus `react-native-webrtc`, `@peculiar/x509` and the rest — ships in
46
+ * every cadre-cli image whether any node turns WebRTC on; measured at about 33 MiB over
47
+ * cadre-cli's production closure without it. Fine while that is a third of a node image; if it
48
+ * ever has to come off the images that do not use it, move the dependency and this loader into
49
+ * a package of their own that a host installs on purpose.
50
+ */
51
+ export declare function loadNodeWebrtcTransport(): Promise<NodeWebrtcTransport>;
52
+ /**
53
+ * TCP, WebSocket exactly when the node's listen entries switch it on, WebRTC when they switch
54
+ * that on and `webrtc` was loaded, and the circuit-relay transport.
16
55
  *
17
56
  * Passing an explicit list makes db-p2p ignore `wsPort` for transports, which is why WebSocket is
18
57
  * decided here from the same switch. Its other use of `wsPort`, a default WebSocket listen
19
58
  * address, never applies: a node with configured relays always has explicit listen entries.
20
59
  *
60
+ * `webrtc` is a parameter rather than a static import so the native addon behind it is loaded
61
+ * only by a host that asked for WebRTC ({@link loadNodeWebrtcTransport}). Omitting it while a
62
+ * listen entry names `/webrtc` THROWS: that pairing is the silent-listener defect
63
+ * `resolveTransportOptions` exists to prevent (`relay-addrs.ts`), and libp2p would just drop the
64
+ * address. The usual caller is `cadre-cli`, which loads the factory and sets the listen entry
65
+ * from one setting.
66
+ *
21
67
  * NOTE: mirrors `createLibp2pNode`'s default list in
22
68
  * `../optimystic/packages/db-p2p/src/libp2p-node.ts` (cadre never sets its `disableTcp`). That file
23
69
  * is the source of truth; if its defaults change, this list has to follow. If db-p2p ever takes an
24
70
  * option to build its default list with relay discovery off, use that and drop this module and
25
71
  * `NetworkConfig.defaultTransports`.
26
72
  */
27
- export declare function nodeDefaultTransports({ wsPort }: ListenTransportOptions): Libp2pTransports;
73
+ export declare function nodeDefaultTransports({ wsPort, webrtcIceServers }: ListenTransportOptions, webrtc?: NodeWebrtcTransport): Libp2pTransports;
74
+ export {};
@@ -7,28 +7,73 @@
7
7
  * built. A subpath module (`@serfab/cadre-core/node-default-transports`), like `push-node`,
8
8
  * because it names `@libp2p/tcp`: some bundlers (the NativeScript reference app's webpack) take
9
9
  * its Node implementation rather than its browser stub, and that needs `net`, `os` and `path`.
10
+ *
11
+ * It is also the only module in this repo that can give a Node host WebRTC, which is why
12
+ * `relay-addrs.ts` accepts a `/webrtc` listen entry only from a node that passed this function.
13
+ * See {@link loadNodeWebrtcTransport} for why that transport is loaded on demand and not
14
+ * imported here.
10
15
  */
11
16
  import { tcp } from '@libp2p/tcp';
12
17
  import { webSockets } from '@libp2p/websockets';
13
18
  import { circuitRelayTransport } from '@libp2p/circuit-relay-v2';
14
19
  /**
15
- * TCP, WebSocket exactly when the node's listen entries switch it on, and the circuit-relay
16
- * transport.
20
+ * Load `@libp2p/webrtc`'s Node transport factory. Call it once, at start, on the branch that
21
+ * asked for WebRTC, and hand the result to {@link nodeDefaultTransports}.
22
+ *
23
+ * A RUN-TIME import, deliberately — the one in this package. `@libp2p/webrtc`'s Node build
24
+ * reaches `node-datachannel`, which loads a native addon as its module is evaluated and throws
25
+ * when the running platform has no prebuilt binary for it. A node that did not ask for WebRTC
26
+ * must neither pay that load nor fail on it, and a static import would do both. The throw, when
27
+ * it comes, names `node-datachannel`, the platform and the architecture, which is what an
28
+ * operator on an unsupported platform needs to read.
29
+ *
30
+ * The STUN servers are supplied per call rather than baked in, because the resolved set depends
31
+ * on the node's relays (`relay-stun.ts` → `resolveStunServers`) and one process may build
32
+ * several nodes. No TURN server is configured anywhere: a WebRTC path that ICE cannot find stays
33
+ * on the circuit relay. See `docs/network/relay.md` → "Direct connections over WebRTC".
34
+ *
35
+ * NOTE: the load is conditional but the INSTALL is not. `@libp2p/webrtc` is a plain dependency
36
+ * of this package, so its 55-package closure — the `node-datachannel` prebuilt binary (about
37
+ * 19 MiB on Alpine x64) plus `react-native-webrtc`, `@peculiar/x509` and the rest — ships in
38
+ * every cadre-cli image whether any node turns WebRTC on; measured at about 33 MiB over
39
+ * cadre-cli's production closure without it. Fine while that is a third of a node image; if it
40
+ * ever has to come off the images that do not use it, move the dependency and this loader into
41
+ * a package of their own that a host installs on purpose.
42
+ */
43
+ export async function loadNodeWebrtcTransport() {
44
+ const { webRTC } = await import('@libp2p/webrtc');
45
+ return (iceServers) => webRTC({ rtcConfiguration: { iceServers: [...iceServers] } });
46
+ }
47
+ /**
48
+ * TCP, WebSocket exactly when the node's listen entries switch it on, WebRTC when they switch
49
+ * that on and `webrtc` was loaded, and the circuit-relay transport.
17
50
  *
18
51
  * Passing an explicit list makes db-p2p ignore `wsPort` for transports, which is why WebSocket is
19
52
  * decided here from the same switch. Its other use of `wsPort`, a default WebSocket listen
20
53
  * address, never applies: a node with configured relays always has explicit listen entries.
21
54
  *
55
+ * `webrtc` is a parameter rather than a static import so the native addon behind it is loaded
56
+ * only by a host that asked for WebRTC ({@link loadNodeWebrtcTransport}). Omitting it while a
57
+ * listen entry names `/webrtc` THROWS: that pairing is the silent-listener defect
58
+ * `resolveTransportOptions` exists to prevent (`relay-addrs.ts`), and libp2p would just drop the
59
+ * address. The usual caller is `cadre-cli`, which loads the factory and sets the listen entry
60
+ * from one setting.
61
+ *
22
62
  * NOTE: mirrors `createLibp2pNode`'s default list in
23
63
  * `../optimystic/packages/db-p2p/src/libp2p-node.ts` (cadre never sets its `disableTcp`). That file
24
64
  * is the source of truth; if its defaults change, this list has to follow. If db-p2p ever takes an
25
65
  * option to build its default list with relay discovery off, use that and drop this module and
26
66
  * `NetworkConfig.defaultTransports`.
27
67
  */
28
- export function nodeDefaultTransports({ wsPort }) {
68
+ export function nodeDefaultTransports({ wsPort, webrtcIceServers }, webrtc) {
69
+ if (webrtcIceServers !== undefined && webrtc === undefined) {
70
+ throw new Error('A /webrtc listen entry was resolved but no WebRTC transport was loaded. Pass the result of '
71
+ + 'loadNodeWebrtcTransport() to nodeDefaultTransports, or drop the /webrtc listen entry.');
72
+ }
29
73
  return [
30
74
  tcp(),
31
75
  ...(wsPort === undefined ? [] : [webSockets()]),
76
+ ...(webrtcIceServers === undefined || webrtc === undefined ? [] : [webrtc(webrtcIceServers)]),
32
77
  circuitRelayTransport()
33
78
  ];
34
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"node-default-transports.js","sourceRoot":"","sources":["../src/node-default-transports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAIjE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,EAAE,MAAM,EAA0B;IACtE,OAAO;QACL,GAAG,EAAE;QACL,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;QAC/C,qBAAqB,EAAE;KACxB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"node-default-transports.js","sourceRoot":"","sources":["../src/node-default-transports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAejE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAClD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;AACvF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,qBAAqB,CACnC,EAAE,MAAM,EAAE,gBAAgB,EAA0B,EACpD,MAA4B;IAE5B,IAAI,gBAAgB,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CACb,6FAA6F;cAC3F,uFAAuF,CAC1F,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,EAAE;QACL,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;QAC/C,GAAG,CAAC,gBAAgB,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC7F,qBAAqB,EAAE;KACxB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * The separately-settable decisions that make up a node's behaviour, and the {@link NodeClass}
3
+ * presets that supply the ones an embedder does not set.
4
+ *
5
+ * A node class says what kind of machine this is; it does not say what the machine should do.
6
+ * Four decisions follow from it by default, and each is worth setting on its own in a real
7
+ * deployment: whether the machine is always on, how much overlay work it takes, whether it
8
+ * forwards other subscribers' change notifications, and whether it holds and signs the data of
9
+ * the strands it runs. Bundling them into the class meant every consumer mapped the class
10
+ * itself, in its own place, with its own reasoning.
11
+ *
12
+ * Inside cadre-core this module is the only place a node class is turned into behaviour: a
13
+ * reader that wants behaviour reads the resolved {@link NodeRoles} instead of comparing
14
+ * `nodeClass` to a literal. The one site still deriving behaviour from the class itself is
15
+ * `arachnode-stub.ts`, a stub with no callers whose storage rings are unimplemented —
16
+ * `backlog/later/5-ring-zulu-storage-rings` owns it. (`provider/client.ts` also names the two
17
+ * values, to narrow an untrusted field of an HTTP response; that is parsing, not behaviour.)
18
+ *
19
+ * Outside cadre-core, cadre-host's orchestrator reads the class to decide what to PROVISION for
20
+ * a child — push credentials and a file store — before any node exists, which is its own
21
+ * decision and not a node role. Anything that configures a node, the integration-test harness
22
+ * included, reads {@link NODE_ROLE_PRESETS} rather than mapping the class again.
23
+ *
24
+ * See `docs/cadre/node.md` → "Node classes".
25
+ */
26
+ import type { NodeClass } from './node-class.js';
27
+ /** How much overlay work a node takes: FRET's resource tier. */
28
+ export type OverlayTier = 'edge' | 'core';
29
+ /** Whether a node may carry other subscribers' change notifications, or only receive its own. */
30
+ export type ReactivityRole = 'forwarder' | 'subscriber';
31
+ /**
32
+ * What one node does, with every decision settled. Resolved once per node by
33
+ * {@link resolveNodeRoles} from the node's class and the embedder's overrides, and read from
34
+ * there by everything that configures the node.
35
+ */
36
+ export interface NodeRoles {
37
+ /**
38
+ * Is this machine always on?
39
+ *
40
+ * Published to the party as this machine's `CadrePeer.Profile` (`node-class.ts` →
41
+ * `encodeAlwaysOn`), which is how a sibling knows to dial this machine first and how a seed
42
+ * marks a preferred peer. Also the default for running a circuit-relay server
43
+ * (`network.enableRelay`), for keeping a storage replica of every admitted strand
44
+ * (`CadreNodeConfig.hostUnclaimedStrands`) and for joining Arachnode's Ring Zulu.
45
+ *
46
+ * Setting this alone does not make a machine reachable — it states that it is, so set it to
47
+ * match the deployment.
48
+ */
49
+ alwaysOn: boolean;
50
+ /**
51
+ * FRET's resource tier for this node's libp2p nodes — the control node and every strand
52
+ * node, both built with it. `'core'` raises the rate limits, snapshot sizes and dial and
53
+ * inbound concurrency a machine with the capacity for them should use; `'edge'` is the
54
+ * settings a phone or a browser tab should run at.
55
+ */
56
+ overlayTier: OverlayTier;
57
+ /**
58
+ * This node's part in change notifications: the Optimystic cohort-topic node profile every
59
+ * strand node with reactivity enabled is built with.
60
+ *
61
+ * `'forwarder'` may serve notifications on behalf of other subscribers (cohort-topic's core
62
+ * profile, willing to forward every tier). `'subscriber'` receives only its own (the edge
63
+ * profile, which forwards the tiers that carry transactions and chain serving and is
64
+ * permanently unwilling to forward reactivity pushes).
65
+ *
66
+ * No effect on a strand with reactivity off, and none on the control node, which never
67
+ * enables it. See `docs/strands/app-schema.md` → "Change notifications".
68
+ */
69
+ reactivity: ReactivityRole;
70
+ /**
71
+ * Does this node hold and sign blocks for the strands it runs?
72
+ *
73
+ * Strands only: the control network always replicates to every party member, which is what
74
+ * lets any machine read the whole control database. `false` builds each strand node as an
75
+ * Optimystic **client** (`NodeOptions.servesBlocks: false`): it runs the strand — reads,
76
+ * writes, membership, change notifications — but stores none of its blocks, asks the
77
+ * embedder's storage provider for no per-strand store, and is in no cohort, so its reads
78
+ * and writes go to the strand's serving machines and a sleeping phone is never on the path
79
+ * of another machine's save. The shape a very large strand needs. Read in one place,
80
+ * `StrandInstanceManager.buildStrandRuntime`; what follows from it is in `docs/cadre/node.md`
81
+ * → "Node classes". Contradicts `hostUnclaimedStrands: true` ({@link resolveHostUnclaimedStrands}).
82
+ */
83
+ strandCohortMember: boolean;
84
+ }
85
+ /**
86
+ * Whether a node runs the admitted strands no app has claimed as storage replicas
87
+ * (`CadreNodeConfig.hostUnclaimedStrands`): the explicit setting, else `alwaysOn` on a node that
88
+ * holds strand blocks and `false` on one that does not.
89
+ *
90
+ * A replica's whole job is to store and serve a strand, so a node with `strandCohortMember:
91
+ * false` cannot be one. The default therefore comes out `false` on such a node whatever
92
+ * `alwaysOn` says — an always-on dashboard node that holds no blocks is a plausible deployment
93
+ * and must not be refused for a setting it never made — and an EXPLICIT `true` beside
94
+ * `strandCohortMember: false` throws naming both, because the embedder asked for two things that
95
+ * cannot both hold.
96
+ */
97
+ export declare function resolveHostUnclaimedStrands(explicit: boolean | undefined, roles: NodeRoles): boolean;
98
+ /**
99
+ * What each node class means, in roles. These are defaults an embedder overrides one at a time,
100
+ * not a classification of the machine: a `device` that happens to be always on says so with
101
+ * `roles: { alwaysOn: true }` and keeps every other device default.
102
+ *
103
+ * `reactivity` is `'forwarder'` for both classes because that is what every node does today
104
+ * (cohort-topic's own default is its core profile). Whether a phone should forward is an open
105
+ * question — `feat-decide-phone-reactivity-role-by-simulation` — and this setting is what lets
106
+ * it be answered by configuring a simulation rather than by changing code.
107
+ */
108
+ export declare const NODE_ROLE_PRESETS: Readonly<Record<NodeClass, Readonly<NodeRoles>>>;
109
+ /**
110
+ * The roles a node built with `nodeClass` runs, with `overrides` applied over its preset.
111
+ *
112
+ * A role the caller leaves out (absent, or present as `undefined`) takes the preset's value.
113
+ * A role the caller MISNAMES, or sets to anything outside its own set, THROWS rather than
114
+ * falling back to the preset: these values reach here from a config file or an environment
115
+ * variable by way of a JavaScript embedder, where a typo resolving silently to the preset would
116
+ * leave a node quietly doing the opposite of what was asked for.
117
+ */
118
+ export declare function resolveNodeRoles(nodeClass: NodeClass, overrides?: Partial<NodeRoles>): NodeRoles;
@@ -0,0 +1,142 @@
1
+ /**
2
+ * The separately-settable decisions that make up a node's behaviour, and the {@link NodeClass}
3
+ * presets that supply the ones an embedder does not set.
4
+ *
5
+ * A node class says what kind of machine this is; it does not say what the machine should do.
6
+ * Four decisions follow from it by default, and each is worth setting on its own in a real
7
+ * deployment: whether the machine is always on, how much overlay work it takes, whether it
8
+ * forwards other subscribers' change notifications, and whether it holds and signs the data of
9
+ * the strands it runs. Bundling them into the class meant every consumer mapped the class
10
+ * itself, in its own place, with its own reasoning.
11
+ *
12
+ * Inside cadre-core this module is the only place a node class is turned into behaviour: a
13
+ * reader that wants behaviour reads the resolved {@link NodeRoles} instead of comparing
14
+ * `nodeClass` to a literal. The one site still deriving behaviour from the class itself is
15
+ * `arachnode-stub.ts`, a stub with no callers whose storage rings are unimplemented —
16
+ * `backlog/later/5-ring-zulu-storage-rings` owns it. (`provider/client.ts` also names the two
17
+ * values, to narrow an untrusted field of an HTTP response; that is parsing, not behaviour.)
18
+ *
19
+ * Outside cadre-core, cadre-host's orchestrator reads the class to decide what to PROVISION for
20
+ * a child — push credentials and a file store — before any node exists, which is its own
21
+ * decision and not a node role. Anything that configures a node, the integration-test harness
22
+ * included, reads {@link NODE_ROLE_PRESETS} rather than mapping the class again.
23
+ *
24
+ * See `docs/cadre/node.md` → "Node classes".
25
+ */
26
+ /**
27
+ * Whether a node runs the admitted strands no app has claimed as storage replicas
28
+ * (`CadreNodeConfig.hostUnclaimedStrands`): the explicit setting, else `alwaysOn` on a node that
29
+ * holds strand blocks and `false` on one that does not.
30
+ *
31
+ * A replica's whole job is to store and serve a strand, so a node with `strandCohortMember:
32
+ * false` cannot be one. The default therefore comes out `false` on such a node whatever
33
+ * `alwaysOn` says — an always-on dashboard node that holds no blocks is a plausible deployment
34
+ * and must not be refused for a setting it never made — and an EXPLICIT `true` beside
35
+ * `strandCohortMember: false` throws naming both, because the embedder asked for two things that
36
+ * cannot both hold.
37
+ */
38
+ export function resolveHostUnclaimedStrands(explicit, roles) {
39
+ if (explicit === undefined) {
40
+ return roles.alwaysOn && roles.strandCohortMember;
41
+ }
42
+ if (explicit && !roles.strandCohortMember) {
43
+ throw new Error('hostUnclaimedStrands: true contradicts roles.strandCohortMember: false — a storage replica stores and '
44
+ + 'serves a strand\'s blocks, which a node that holds none cannot do. Drop one of the two.');
45
+ }
46
+ return explicit;
47
+ }
48
+ /**
49
+ * What each node class means, in roles. These are defaults an embedder overrides one at a time,
50
+ * not a classification of the machine: a `device` that happens to be always on says so with
51
+ * `roles: { alwaysOn: true }` and keeps every other device default.
52
+ *
53
+ * `reactivity` is `'forwarder'` for both classes because that is what every node does today
54
+ * (cohort-topic's own default is its core profile). Whether a phone should forward is an open
55
+ * question — `feat-decide-phone-reactivity-role-by-simulation` — and this setting is what lets
56
+ * it be answered by configuring a simulation rather than by changing code.
57
+ */
58
+ export const NODE_ROLE_PRESETS = {
59
+ device: { alwaysOn: false, overlayTier: 'edge', reactivity: 'forwarder', strandCohortMember: true },
60
+ server: { alwaysOn: true, overlayTier: 'core', reactivity: 'forwarder', strandCohortMember: true }
61
+ };
62
+ const OVERLAY_TIERS = ['edge', 'core'];
63
+ const REACTIVITY_ROLES = ['forwarder', 'subscriber'];
64
+ /**
65
+ * Every role name, as a record so a role added to {@link NodeRoles} without a line here is a
66
+ * type error rather than a key {@link refuseUnknownRoles} then rejects as a typo.
67
+ */
68
+ const ROLE_NAMES = {
69
+ alwaysOn: true,
70
+ overlayTier: true,
71
+ reactivity: true,
72
+ strandCohortMember: true
73
+ };
74
+ /**
75
+ * The roles a node built with `nodeClass` runs, with `overrides` applied over its preset.
76
+ *
77
+ * A role the caller leaves out (absent, or present as `undefined`) takes the preset's value.
78
+ * A role the caller MISNAMES, or sets to anything outside its own set, THROWS rather than
79
+ * falling back to the preset: these values reach here from a config file or an environment
80
+ * variable by way of a JavaScript embedder, where a typo resolving silently to the preset would
81
+ * leave a node quietly doing the opposite of what was asked for.
82
+ */
83
+ export function resolveNodeRoles(nodeClass, overrides) {
84
+ const preset = NODE_ROLE_PRESETS[nodeClass];
85
+ if (preset === undefined) {
86
+ throw new Error(`Unknown nodeClass ${describeValue(nodeClass)}: expected 'device' or 'server'.`);
87
+ }
88
+ const given = overrides ?? {};
89
+ refuseUnknownRoles(given);
90
+ return {
91
+ alwaysOn: given.alwaysOn === undefined
92
+ ? preset.alwaysOn
93
+ : checkedBoolean('alwaysOn', given.alwaysOn),
94
+ overlayTier: given.overlayTier === undefined
95
+ ? preset.overlayTier
96
+ : checkedOneOf('overlayTier', given.overlayTier, OVERLAY_TIERS),
97
+ reactivity: given.reactivity === undefined
98
+ ? preset.reactivity
99
+ : checkedOneOf('reactivity', given.reactivity, REACTIVITY_ROLES),
100
+ strandCohortMember: given.strandCohortMember === undefined
101
+ ? preset.strandCohortMember
102
+ : checkedBoolean('strandCohortMember', given.strandCohortMember)
103
+ };
104
+ }
105
+ /**
106
+ * Throw on a key of `given` that names no role. A misspelled role would otherwise resolve to the
107
+ * preset in silence — the same failure a bad role VALUE is rejected for, and the likelier of the
108
+ * two, since a key has no small set of right answers to land in by accident. TypeScript refuses
109
+ * one in an object literal, so this is for the JavaScript embedder and the config file behind it.
110
+ */
111
+ function refuseUnknownRoles(given) {
112
+ // A lookup rather than `Object.hasOwn` (an ES2022 builtin this package's ES2020 emit target
113
+ // does not down-level) and rather than `in` (which would accept `toString` as a role).
114
+ const unknown = Object.keys(given).filter(key => ROLE_NAMES[key] !== true);
115
+ if (unknown.length > 0) {
116
+ throw new Error(`Unknown roles ${unknown.map(key => `'${key}'`).join(', ')}: expected one of ${Object.keys(ROLE_NAMES).map(role => `'${role}'`).join(', ')}.`);
117
+ }
118
+ }
119
+ /** `value` as a boolean role, else a throw naming the role. `unknown` because a JavaScript caller's value is. */
120
+ function checkedBoolean(role, value) {
121
+ if (typeof value === 'boolean') {
122
+ return value;
123
+ }
124
+ throw badRoleValue(role, value, ['true', 'false']);
125
+ }
126
+ /** `value` as one of `allowed`, else a throw naming the role and what it admits. */
127
+ function checkedOneOf(role, value, allowed) {
128
+ if (typeof value === 'string' && allowed.includes(value)) {
129
+ // The `includes` is the proof of this narrowing; TypeScript cannot carry it off the
130
+ // widening to `readonly string[]`, so the assertion restates what the branch established.
131
+ return value;
132
+ }
133
+ throw badRoleValue(role, value, allowed);
134
+ }
135
+ function badRoleValue(role, value, allowed) {
136
+ return new Error(`Invalid roles.${role} ${describeValue(value)}: expected one of ${allowed.map(one => `'${one}'`).join(', ')}.`);
137
+ }
138
+ /** A bad value named for an error message, without letting a huge or cyclic one into it. */
139
+ function describeValue(value) {
140
+ return typeof value === 'string' ? `'${value}'` : `of type ${typeof value}`;
141
+ }
142
+ //# sourceMappingURL=node-roles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-roles.js","sourceRoot":"","sources":["../src/node-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAiEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAA6B,EAAE,KAAgB;IAC1F,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,kBAAkB,CAAC;IACnD,CAAC;IACD,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACd,wGAAwG;cACtG,yFAAyF,CAC3F,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC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AAC,CAAC,CAAC;AACpD,CAAC;AAED,oFAAoF;AACpF,SAAS,YAAY,CAAmB,IAAY,EAAE,KAAc,EAAE,OAAqB;IAC1F,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAK,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjF,oFAAoF;QACpF,0FAA0F;QAC1F,OAAO,KAAU,CAAC;IACnB,CAAC;IACD,MAAM,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,KAAc,EAAE,OAA0B;IAC7E,OAAO,IAAI,KAAK,CACf,iBAAiB,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,qBAAqB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9G,CAAC;AACH,CAAC;AAED,4FAA4F;AAC5F,SAAS,aAAa,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,WAAW,OAAO,KAAK,EAAE,CAAC;AAC7E,CAAC"}
@@ -5,8 +5,9 @@
5
5
  * transports through {@link withoutRelayDiscovery}, so libp2p's relay discovery cannot hand those
6
6
  * slots to some other relay-capable peer before the per-relay supervisors fill them (see
7
7
  * `relay-reservation.ts`, "WHY LIBP2P'S RELAY DISCOVERY IS SWITCHED OFF"). Every other node gets
8
- * the embedder's list as it was, or no option at all, and `@optimystic/db-p2p` builds its own
9
- * default list.
8
+ * the embedder's list as it was, or — when its listen entries name a transport db-p2p's own
9
+ * default list does not carry — the injected default list unwrapped, or no option at all, and
10
+ * `@optimystic/db-p2p` builds its own default list.
10
11
  *
11
12
  * The wrapper needs a list to wrap. React Native and browser embedders always supply one
12
13
  * (`network.transports`); a Node host supplies the default list through
@@ -19,6 +20,9 @@ import type { NetworkConfig } from './types.js';
19
20
  /**
20
21
  * The `transports` option to spread into a node's `createLibp2pNode` options.
21
22
  *
23
+ * Only the supervised case wraps the list: with no cadre-generated `/p2p-circuit` entry there is
24
+ * no slot for libp2p's relay discovery to take, so discovery stays as db-p2p leaves it.
25
+ *
22
26
  * @param listenTransports what the node's resolved listen entries imply (`resolveTransportOptions`
23
27
  * in `relay-addrs.ts`), handed to `network.defaultTransports`.
24
28
  * @param relaySlotsSupervised whether cadre generated this node's bare `/p2p-circuit` entries for