@minca/core 0.1.15 → 0.1.17

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 (443) hide show
  1. package/README.md +10 -10
  2. package/dist/elements/auth-styles.d.ts +1 -1
  3. package/dist/elements/auth-styles.d.ts.map +1 -1
  4. package/dist/elements/auth-styles.js +35 -9
  5. package/dist/elements/auth-styles.js.map +1 -1
  6. package/dist/elements/minca-auth.d.ts.map +1 -1
  7. package/dist/elements/minca-auth.js +169 -72
  8. package/dist/elements/minca-auth.js.map +1 -1
  9. package/dist/identity/abilities.d.ts +2 -0
  10. package/dist/identity/abilities.d.ts.map +1 -1
  11. package/dist/identity/abilities.js +2 -0
  12. package/dist/identity/abilities.js.map +1 -1
  13. package/dist/identity/account-vault.d.ts +15 -71
  14. package/dist/identity/account-vault.d.ts.map +1 -1
  15. package/dist/identity/account-vault.js +45 -104
  16. package/dist/identity/account-vault.js.map +1 -1
  17. package/dist/identity/channel.d.ts +3 -9
  18. package/dist/identity/channel.d.ts.map +1 -1
  19. package/dist/identity/channel.js +42 -42
  20. package/dist/identity/channel.js.map +1 -1
  21. package/dist/identity/contact-key.d.ts +14 -29
  22. package/dist/identity/contact-key.d.ts.map +1 -1
  23. package/dist/identity/contact-key.js +31 -51
  24. package/dist/identity/contact-key.js.map +1 -1
  25. package/dist/identity/crypto-p256.d.ts.map +1 -1
  26. package/dist/identity/crypto-p256.js +39 -53
  27. package/dist/identity/crypto-p256.js.map +1 -1
  28. package/dist/identity/hpke.d.ts.map +1 -1
  29. package/dist/identity/hpke.js +19 -19
  30. package/dist/identity/hpke.js.map +1 -1
  31. package/dist/identity/identity-manager.d.ts.map +1 -1
  32. package/dist/identity/identity-manager.js +1 -2
  33. package/dist/identity/identity-manager.js.map +1 -1
  34. package/dist/identity/policy.d.ts.map +1 -1
  35. package/dist/identity/policy.js +35 -61
  36. package/dist/identity/policy.js.map +1 -1
  37. package/dist/identity/recovery-code.d.ts +2 -8
  38. package/dist/identity/recovery-code.d.ts.map +1 -1
  39. package/dist/identity/recovery-code.js +4 -11
  40. package/dist/identity/recovery-code.js.map +1 -1
  41. package/dist/identity/root-signer.d.ts +1 -6
  42. package/dist/identity/root-signer.d.ts.map +1 -1
  43. package/dist/identity/root-signer.js +12 -15
  44. package/dist/identity/root-signer.js.map +1 -1
  45. package/dist/identity/ucan.d.ts.map +1 -1
  46. package/dist/identity/ucan.js +48 -39
  47. package/dist/identity/ucan.js.map +1 -1
  48. package/dist/identity/webauthn.d.ts +6 -11
  49. package/dist/identity/webauthn.d.ts.map +1 -1
  50. package/dist/identity/webauthn.js +18 -30
  51. package/dist/identity/webauthn.js.map +1 -1
  52. package/dist/inbox/inbox.d.ts.map +1 -1
  53. package/dist/inbox/inbox.js +40 -30
  54. package/dist/inbox/inbox.js.map +1 -1
  55. package/dist/inbox/index.d.ts +2 -0
  56. package/dist/inbox/index.d.ts.map +1 -1
  57. package/dist/inbox/index.js +1 -0
  58. package/dist/inbox/index.js.map +1 -1
  59. package/dist/inbox/names.d.ts +54 -0
  60. package/dist/inbox/names.d.ts.map +1 -0
  61. package/dist/inbox/names.js +299 -0
  62. package/dist/inbox/names.js.map +1 -0
  63. package/dist/index.d.ts +3 -6
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +9 -12
  66. package/dist/index.js.map +1 -1
  67. package/dist/network/mesh.d.ts +7 -20
  68. package/dist/network/mesh.d.ts.map +1 -1
  69. package/dist/network/mesh.js +267 -245
  70. package/dist/network/mesh.js.map +1 -1
  71. package/dist/network/relay-link.d.ts +31 -0
  72. package/dist/network/relay-link.d.ts.map +1 -0
  73. package/dist/network/relay-link.js +62 -0
  74. package/dist/network/relay-link.js.map +1 -0
  75. package/dist/network/relay-minca.d.ts.map +1 -1
  76. package/dist/network/relay-minca.js +11 -49
  77. package/dist/network/relay-minca.js.map +1 -1
  78. package/dist/network/relay-nostr.d.ts.map +1 -1
  79. package/dist/network/relay-nostr.js +23 -63
  80. package/dist/network/relay-nostr.js.map +1 -1
  81. package/dist/network/relay-socket.d.ts +1 -1
  82. package/dist/network/relay-socket.d.ts.map +1 -1
  83. package/dist/network/relay-socket.js +3 -1
  84. package/dist/network/relay-socket.js.map +1 -1
  85. package/dist/network/ws-transport.d.ts.map +1 -1
  86. package/dist/network/ws-transport.js +3 -0
  87. package/dist/network/ws-transport.js.map +1 -1
  88. package/dist/node/actions.d.ts +2 -0
  89. package/dist/node/actions.d.ts.map +1 -1
  90. package/dist/node/actions.js +89 -58
  91. package/dist/node/actions.js.map +1 -1
  92. package/dist/node/api.d.ts +7 -0
  93. package/dist/node/api.d.ts.map +1 -1
  94. package/dist/node/api.js +7 -0
  95. package/dist/node/api.js.map +1 -1
  96. package/dist/node/carrier.d.ts +5 -0
  97. package/dist/node/carrier.d.ts.map +1 -1
  98. package/dist/node/carrier.js +94 -73
  99. package/dist/node/carrier.js.map +1 -1
  100. package/dist/node/copy.d.ts +8 -7
  101. package/dist/node/copy.d.ts.map +1 -1
  102. package/dist/node/copy.js +54 -56
  103. package/dist/node/copy.js.map +1 -1
  104. package/dist/node/host.d.ts +39 -65
  105. package/dist/node/host.d.ts.map +1 -1
  106. package/dist/node/host.js +362 -379
  107. package/dist/node/host.js.map +1 -1
  108. package/dist/node/index.d.ts +2 -2
  109. package/dist/node/index.d.ts.map +1 -1
  110. package/dist/node/index.js +1 -1
  111. package/dist/node/index.js.map +1 -1
  112. package/dist/node/node-carriers.d.ts +35 -0
  113. package/dist/node/node-carriers.d.ts.map +1 -0
  114. package/dist/node/node-carriers.js +567 -0
  115. package/dist/node/node-carriers.js.map +1 -0
  116. package/dist/node/node-contacts.d.ts +11 -0
  117. package/dist/node/node-contacts.d.ts.map +1 -0
  118. package/dist/node/node-contacts.js +808 -0
  119. package/dist/node/node-contacts.js.map +1 -0
  120. package/dist/node/node-context.d.ts +76 -0
  121. package/dist/node/node-context.d.ts.map +1 -0
  122. package/dist/node/node-context.js +54 -0
  123. package/dist/node/node-context.js.map +1 -0
  124. package/dist/node/node-hosting.d.ts +20 -0
  125. package/dist/node/node-hosting.d.ts.map +1 -0
  126. package/dist/node/node-hosting.js +456 -0
  127. package/dist/node/node-hosting.js.map +1 -0
  128. package/dist/node/node-records.d.ts +18 -0
  129. package/dist/node/node-records.d.ts.map +1 -0
  130. package/dist/node/node-records.js +262 -0
  131. package/dist/node/node-records.js.map +1 -0
  132. package/dist/node/node.d.ts.map +1 -1
  133. package/dist/node/node.js +199 -1990
  134. package/dist/node/node.js.map +1 -1
  135. package/dist/node/remote.d.ts +5 -6
  136. package/dist/node/remote.d.ts.map +1 -1
  137. package/dist/node/remote.js +272 -260
  138. package/dist/node/remote.js.map +1 -1
  139. package/dist/node/space-catalog.d.ts +40 -0
  140. package/dist/node/space-catalog.d.ts.map +1 -0
  141. package/dist/node/space-catalog.js +158 -0
  142. package/dist/node/space-catalog.js.map +1 -0
  143. package/dist/node/space-checks.d.ts +25 -0
  144. package/dist/node/space-checks.d.ts.map +1 -0
  145. package/dist/node/space-checks.js +343 -0
  146. package/dist/node/space-checks.js.map +1 -0
  147. package/dist/node/space-history.d.ts +37 -0
  148. package/dist/node/space-history.d.ts.map +1 -0
  149. package/dist/node/space-history.js +350 -0
  150. package/dist/node/space-history.js.map +1 -0
  151. package/dist/node/space-holding.d.ts +53 -0
  152. package/dist/node/space-holding.d.ts.map +1 -0
  153. package/dist/node/space-holding.js +339 -0
  154. package/dist/node/space-holding.js.map +1 -0
  155. package/dist/node/space-index.d.ts +41 -0
  156. package/dist/node/space-index.d.ts.map +1 -0
  157. package/dist/node/space-index.js +217 -0
  158. package/dist/node/space-index.js.map +1 -0
  159. package/dist/node/space-keys.d.ts +34 -0
  160. package/dist/node/space-keys.d.ts.map +1 -0
  161. package/dist/node/space-keys.js +309 -0
  162. package/dist/node/space-keys.js.map +1 -0
  163. package/dist/node/space-lines.d.ts +33 -0
  164. package/dist/node/space-lines.d.ts.map +1 -0
  165. package/dist/node/space-lines.js +145 -0
  166. package/dist/node/space-lines.js.map +1 -0
  167. package/dist/node/space-membership.d.ts +69 -0
  168. package/dist/node/space-membership.d.ts.map +1 -0
  169. package/dist/node/space-membership.js +242 -0
  170. package/dist/node/space-membership.js.map +1 -0
  171. package/dist/node/space-mirrors.d.ts +43 -0
  172. package/dist/node/space-mirrors.d.ts.map +1 -0
  173. package/dist/node/space-mirrors.js +125 -0
  174. package/dist/node/space-mirrors.js.map +1 -0
  175. package/dist/node/space-peers.d.ts +104 -0
  176. package/dist/node/space-peers.d.ts.map +1 -0
  177. package/dist/node/space-peers.js +629 -0
  178. package/dist/node/space-peers.js.map +1 -0
  179. package/dist/node/space-profiles.d.ts +18 -0
  180. package/dist/node/space-profiles.d.ts.map +1 -0
  181. package/dist/node/space-profiles.js +105 -0
  182. package/dist/node/space-profiles.js.map +1 -0
  183. package/dist/node/space-rules.d.ts +29 -0
  184. package/dist/node/space-rules.d.ts.map +1 -0
  185. package/dist/node/space-rules.js +144 -0
  186. package/dist/node/space-rules.js.map +1 -0
  187. package/dist/node/space-runtime.d.ts +107 -140
  188. package/dist/node/space-runtime.d.ts.map +1 -1
  189. package/dist/node/space-runtime.js +331 -3985
  190. package/dist/node/space-runtime.js.map +1 -1
  191. package/dist/node/space-standing.d.ts +20 -0
  192. package/dist/node/space-standing.d.ts.map +1 -0
  193. package/dist/node/space-standing.js +317 -0
  194. package/dist/node/space-standing.js.map +1 -0
  195. package/dist/node/space-versions.d.ts +104 -0
  196. package/dist/node/space-versions.d.ts.map +1 -0
  197. package/dist/node/space-versions.js +153 -0
  198. package/dist/node/space-versions.js.map +1 -0
  199. package/dist/node/space-warrants.d.ts +25 -0
  200. package/dist/node/space-warrants.d.ts.map +1 -0
  201. package/dist/node/space-warrants.js +214 -0
  202. package/dist/node/space-warrants.js.map +1 -0
  203. package/dist/node/space-writing.d.ts +74 -0
  204. package/dist/node/space-writing.d.ts.map +1 -0
  205. package/dist/node/space-writing.js +442 -0
  206. package/dist/node/space-writing.js.map +1 -0
  207. package/dist/node/stores.d.ts +19 -50
  208. package/dist/node/stores.d.ts.map +1 -1
  209. package/dist/node/stores.js +14 -33
  210. package/dist/node/stores.js.map +1 -1
  211. package/dist/node/types.d.ts +243 -306
  212. package/dist/node/types.d.ts.map +1 -1
  213. package/dist/node/usage.d.ts +2 -24
  214. package/dist/node/usage.d.ts.map +1 -1
  215. package/dist/node/usage.js +118 -102
  216. package/dist/node/usage.js.map +1 -1
  217. package/dist/node/watch-notifications.d.ts.map +1 -1
  218. package/dist/node/watch-notifications.js +32 -29
  219. package/dist/node/watch-notifications.js.map +1 -1
  220. package/dist/node/worker.d.ts +5 -6
  221. package/dist/node/worker.d.ts.map +1 -1
  222. package/dist/node/worker.js +80 -72
  223. package/dist/node/worker.js.map +1 -1
  224. package/dist/node/writer-keys.d.ts +5 -6
  225. package/dist/node/writer-keys.d.ts.map +1 -1
  226. package/dist/node/writer-keys.js +66 -57
  227. package/dist/node/writer-keys.js.map +1 -1
  228. package/dist/node/writers.d.ts +12 -19
  229. package/dist/node/writers.d.ts.map +1 -1
  230. package/dist/node/writers.js +7 -15
  231. package/dist/node/writers.js.map +1 -1
  232. package/dist/privacy/direct.d.ts.map +1 -1
  233. package/dist/privacy/direct.js +31 -27
  234. package/dist/privacy/direct.js.map +1 -1
  235. package/dist/privacy/space-encryption.d.ts.map +1 -1
  236. package/dist/privacy/space-encryption.js +5 -9
  237. package/dist/privacy/space-encryption.js.map +1 -1
  238. package/dist/query/computed.d.ts.map +1 -1
  239. package/dist/query/computed.js +78 -77
  240. package/dist/query/computed.js.map +1 -1
  241. package/dist/query/engine.d.ts +3 -4
  242. package/dist/query/engine.d.ts.map +1 -1
  243. package/dist/query/engine.js +93 -86
  244. package/dist/query/engine.js.map +1 -1
  245. package/dist/query/filter.d.ts +8 -10
  246. package/dist/query/filter.d.ts.map +1 -1
  247. package/dist/query/filter.js +144 -161
  248. package/dist/query/filter.js.map +1 -1
  249. package/dist/records/cel-types.d.ts.map +1 -1
  250. package/dist/records/cel-types.js +13 -27
  251. package/dist/records/cel-types.js.map +1 -1
  252. package/dist/records/cel.d.ts.map +1 -1
  253. package/dist/records/cel.js +177 -242
  254. package/dist/records/cel.js.map +1 -1
  255. package/dist/records/rules.d.ts.map +1 -1
  256. package/dist/records/rules.js +46 -50
  257. package/dist/records/rules.js.map +1 -1
  258. package/dist/records/topics.d.ts.map +1 -1
  259. package/dist/records/topics.js +18 -22
  260. package/dist/records/topics.js.map +1 -1
  261. package/dist/schemas/automations.d.ts +8 -15
  262. package/dist/schemas/automations.d.ts.map +1 -1
  263. package/dist/schemas/automations.js +203 -165
  264. package/dist/schemas/automations.js.map +1 -1
  265. package/dist/schemas/blueprints.d.ts.map +1 -1
  266. package/dist/schemas/blueprints.js +14 -13
  267. package/dist/schemas/blueprints.js.map +1 -1
  268. package/dist/schemas/connectors.d.ts.map +1 -1
  269. package/dist/schemas/connectors.js +16 -11
  270. package/dist/schemas/connectors.js.map +1 -1
  271. package/dist/schemas/contacts.d.ts +57 -0
  272. package/dist/schemas/contacts.d.ts.map +1 -1
  273. package/dist/schemas/contacts.js +32 -0
  274. package/dist/schemas/contacts.js.map +1 -1
  275. package/dist/schemas/cron.d.ts.map +1 -1
  276. package/dist/schemas/cron.js +27 -28
  277. package/dist/schemas/cron.js.map +1 -1
  278. package/dist/schemas/defined.d.ts +6 -0
  279. package/dist/schemas/defined.d.ts.map +1 -0
  280. package/dist/schemas/defined.js +7 -0
  281. package/dist/schemas/defined.js.map +1 -0
  282. package/dist/schemas/guides.d.ts +3 -1
  283. package/dist/schemas/guides.d.ts.map +1 -1
  284. package/dist/schemas/guides.js +13 -12
  285. package/dist/schemas/guides.js.map +1 -1
  286. package/dist/schemas/index.d.ts +2 -2
  287. package/dist/schemas/index.d.ts.map +1 -1
  288. package/dist/schemas/index.js +18 -14
  289. package/dist/schemas/index.js.map +1 -1
  290. package/dist/schemas/library/social.d.ts +258 -0
  291. package/dist/schemas/library/social.d.ts.map +1 -1
  292. package/dist/schemas/library/social.js +28 -1
  293. package/dist/schemas/library/social.js.map +1 -1
  294. package/dist/session/account-hint.d.ts.map +1 -1
  295. package/dist/session/account-hint.js +8 -5
  296. package/dist/session/account-hint.js.map +1 -1
  297. package/dist/session/auth.d.ts +36 -2
  298. package/dist/session/auth.d.ts.map +1 -1
  299. package/dist/session/auth.js +95 -2
  300. package/dist/session/auth.js.map +1 -1
  301. package/dist/session/connect.d.ts +1 -0
  302. package/dist/session/connect.d.ts.map +1 -1
  303. package/dist/session/connect.js +3 -1
  304. package/dist/session/connect.js.map +1 -1
  305. package/dist/session/credentials.d.ts +8 -26
  306. package/dist/session/credentials.d.ts.map +1 -1
  307. package/dist/session/credentials.js +14 -32
  308. package/dist/session/credentials.js.map +1 -1
  309. package/dist/session/hosting.d.ts.map +1 -1
  310. package/dist/session/hosting.js +8 -2
  311. package/dist/session/hosting.js.map +1 -1
  312. package/dist/session/index.d.ts +1 -0
  313. package/dist/session/index.d.ts.map +1 -1
  314. package/dist/session/index.js +1 -0
  315. package/dist/session/index.js.map +1 -1
  316. package/dist/session/pairing.d.ts.map +1 -1
  317. package/dist/session/pairing.js +92 -88
  318. package/dist/session/pairing.js.map +1 -1
  319. package/dist/session/password-strength.d.ts.map +1 -1
  320. package/dist/session/password-strength.js +37 -37
  321. package/dist/session/password-strength.js.map +1 -1
  322. package/dist/session/places.d.ts.map +1 -1
  323. package/dist/session/places.js +18 -13
  324. package/dist/session/places.js.map +1 -1
  325. package/dist/session/popup.d.ts +13 -0
  326. package/dist/session/popup.d.ts.map +1 -0
  327. package/dist/session/popup.js +23 -0
  328. package/dist/session/popup.js.map +1 -0
  329. package/dist/space/constitution.d.ts.map +1 -1
  330. package/dist/space/constitution.js +22 -29
  331. package/dist/space/constitution.js.map +1 -1
  332. package/dist/space/grants.d.ts.map +1 -1
  333. package/dist/space/grants.js +37 -39
  334. package/dist/space/grants.js.map +1 -1
  335. package/dist/space/invite-link.d.ts.map +1 -1
  336. package/dist/space/invite-link.js +33 -33
  337. package/dist/space/invite-link.js.map +1 -1
  338. package/dist/space/own-automations.d.ts +13 -24
  339. package/dist/space/own-automations.d.ts.map +1 -1
  340. package/dist/space/own-automations.js +47 -37
  341. package/dist/space/own-automations.js.map +1 -1
  342. package/dist/space/presets.d.ts +2 -2
  343. package/dist/space/presets.d.ts.map +1 -1
  344. package/dist/space/presets.js +3 -2
  345. package/dist/space/presets.js.map +1 -1
  346. package/dist/space/roles.d.ts +56 -80
  347. package/dist/space/roles.d.ts.map +1 -1
  348. package/dist/space/roles.js +448 -441
  349. package/dist/space/roles.js.map +1 -1
  350. package/dist/space/space-access.d.ts +3 -4
  351. package/dist/space/space-access.d.ts.map +1 -1
  352. package/dist/space/space-access.js +3 -8
  353. package/dist/space/space-access.js.map +1 -1
  354. package/dist/storage/blob/directory.d.ts.map +1 -1
  355. package/dist/storage/blob/directory.js +39 -32
  356. package/dist/storage/blob/directory.js.map +1 -1
  357. package/dist/storage/blob/s3.d.ts.map +1 -1
  358. package/dist/storage/blob/s3.js +21 -19
  359. package/dist/storage/blob/s3.js.map +1 -1
  360. package/dist/storage/blob-store.d.ts +0 -9
  361. package/dist/storage/blob-store.d.ts.map +1 -1
  362. package/dist/storage/directory-access.d.ts +8 -32
  363. package/dist/storage/directory-access.d.ts.map +1 -1
  364. package/dist/storage/directory-access.js +11 -36
  365. package/dist/storage/directory-access.js.map +1 -1
  366. package/dist/storage/encrypted-adapter.d.ts +12 -32
  367. package/dist/storage/encrypted-adapter.d.ts.map +1 -1
  368. package/dist/storage/encrypted-adapter.js +31 -54
  369. package/dist/storage/encrypted-adapter.js.map +1 -1
  370. package/dist/storage/folder-adapter.d.ts +12 -26
  371. package/dist/storage/folder-adapter.d.ts.map +1 -1
  372. package/dist/storage/folder-adapter.js +37 -54
  373. package/dist/storage/folder-adapter.js.map +1 -1
  374. package/dist/storage/folder-reconcile.d.ts +12 -26
  375. package/dist/storage/folder-reconcile.d.ts.map +1 -1
  376. package/dist/storage/folder-reconcile.js +39 -48
  377. package/dist/storage/folder-reconcile.js.map +1 -1
  378. package/dist/storage/indexeddb-adapter.d.ts +2 -6
  379. package/dist/storage/indexeddb-adapter.d.ts.map +1 -1
  380. package/dist/storage/indexeddb-adapter.js +60 -114
  381. package/dist/storage/indexeddb-adapter.js.map +1 -1
  382. package/dist/storage/mirror.d.ts +0 -29
  383. package/dist/storage/mirror.d.ts.map +1 -1
  384. package/dist/storage/mirror.js +153 -110
  385. package/dist/storage/mirror.js.map +1 -1
  386. package/dist/storage/segment.d.ts.map +1 -1
  387. package/dist/storage/segment.js +3 -7
  388. package/dist/storage/segment.js.map +1 -1
  389. package/dist/storage/storage-provider.d.ts +6 -11
  390. package/dist/storage/storage-provider.d.ts.map +1 -1
  391. package/dist/storage/storage-provider.js +112 -116
  392. package/dist/storage/storage-provider.js.map +1 -1
  393. package/dist/sync/sync-engine.d.ts +10 -44
  394. package/dist/sync/sync-engine.d.ts.map +1 -1
  395. package/dist/sync/sync-engine.js +245 -247
  396. package/dist/sync/sync-engine.js.map +1 -1
  397. package/dist/sync/sync-messages.d.ts +1 -1
  398. package/dist/sync/sync-messages.d.ts.map +1 -1
  399. package/dist/sync/sync-messages.js +1 -1
  400. package/dist/sync/sync-messages.js.map +1 -1
  401. package/dist/utils/guards.d.ts +1 -0
  402. package/dist/utils/guards.d.ts.map +1 -1
  403. package/dist/utils/guards.js +1 -0
  404. package/dist/utils/guards.js.map +1 -1
  405. package/dist/utils/hmac.d.ts +5 -0
  406. package/dist/utils/hmac.d.ts.map +1 -0
  407. package/dist/utils/hmac.js +20 -0
  408. package/dist/utils/hmac.js.map +1 -0
  409. package/dist/utils/map.d.ts +10 -0
  410. package/dist/utils/map.d.ts.map +1 -0
  411. package/dist/utils/map.js +30 -0
  412. package/dist/utils/map.js.map +1 -0
  413. package/dist/utils/serial.d.ts +2 -0
  414. package/dist/utils/serial.d.ts.map +1 -1
  415. package/dist/utils/serial.js +9 -0
  416. package/dist/utils/serial.js.map +1 -1
  417. package/dist/validation/capability-gate.d.ts +7 -15
  418. package/dist/validation/capability-gate.d.ts.map +1 -1
  419. package/dist/validation/capability-gate.js +32 -36
  420. package/dist/validation/capability-gate.js.map +1 -1
  421. package/dist/validation/crypto-gate.d.ts.map +1 -1
  422. package/dist/validation/crypto-gate.js +12 -21
  423. package/dist/validation/crypto-gate.js.map +1 -1
  424. package/docs/README.md +1 -0
  425. package/docs/actions.md +32 -25
  426. package/docs/agents.md +28 -16
  427. package/docs/automations.md +1 -1
  428. package/docs/blueprints-and-guides.md +37 -5
  429. package/docs/building-an-app.md +7 -4
  430. package/docs/collections.md +3 -3
  431. package/docs/contacts.md +34 -1
  432. package/docs/contracts.md +1 -1
  433. package/docs/direct-messages.md +6 -2
  434. package/docs/inbox.md +5 -11
  435. package/docs/node.md +54 -22
  436. package/docs/records-and-queries.md +1 -1
  437. package/docs/sign-in.md +54 -26
  438. package/docs/spaces.md +9 -8
  439. package/docs/standard-library.md +37 -14
  440. package/docs/storage.md +5 -6
  441. package/docs/usernames.md +161 -0
  442. package/docs/warrants.md +1 -1
  443. package/package.json +1 -2
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module node/types
3
- * The shape of a node. Everything a method returns is JSON-serialisable on
4
- * purpose: the same calls cross a port, and are actions for a CLI, MCP and WebMCP.
3
+ * The shape of a node. Everything a method returns is JSON-serialisable: the
4
+ * same calls cross a port, and are actions for a CLI, MCP and WebMCP.
5
5
  */
6
6
  import type { MailboxClient } from '../network/relays.js';
7
7
  import type { BodyOf, CollectionRef, IncludeMap, Query, ResultFor } from '../query/types.js';
@@ -21,67 +21,76 @@ import type { StoreFactory } from './stores.js';
21
21
  import type { JsonSchema, SchemaIssue } from '../schema/collection-def.js';
22
22
  import type { Keeper } from '../space/roles.js';
23
23
  import type { Automation } from '../schemas/automations.js';
24
+ import type { FundOffer, FundPayment, HostConnectorOffer, HostStatus, HostedBot, OverSpace, PayAnswer } from '../session/hosting.js';
24
25
  export interface NodeNetworkConfig {
25
26
  /** Relays for WebRTC, browsers only. Each space meets in the room named after its id. */
26
27
  readonly relays?: ReadonlyArray<string>;
27
- /** Always-on nodes to hold a socket to, `wss://host/peer`, pinned by `#<DID>` (spec 04 §5.2). The space id is appended. */
28
+ /** Always-on nodes to hold a socket to, `wss://host/peer#<DID>` (spec 04 §5.2); the space id is appended */
28
29
  readonly nodes?: ReadonlyArray<string>;
29
- /** Hosts to look for the account registry at, `https://host`: how a new device with only the recovery code finds its spaces */
30
+ /** Hosts to look for the account registry at, so a new device with only the recovery code finds its spaces */
30
31
  readonly hosts?: ReadonlyArray<string>;
31
32
  readonly iceServers?: ReadonlyArray<RTCIceServer>;
32
- /** How WebRTC connections are made; a node in a worker passes `remoteTransport`, so the page makes them */
33
+ /** How WebRTC connections are made; a node in a worker passes `remoteTransport` */
33
34
  readonly createTransport?: (iceServers: () => ReadonlyArray<RTCIceServer>) => SignalledTransport;
34
- /** Extra transports per space, given this node's session DID — how a node serving sockets, or a test, plugs in */
35
+ /** Extra transports per space, given this node's session DID: for a node serving sockets, or a test */
35
36
  readonly transports?: (spaceId: string, sessionDid: string) => ReadonlyArray<PeerTransport>;
37
+ /**
38
+ * Whether this node may connect to an address it found rather than was
39
+ * given: a host or node a record or an invite names, a relay a space or an
40
+ * invite names, a place a short link names, a host it asks to describe
41
+ * itself. Asked before each; `relays`, `nodes` and `hosts` here are taken as
42
+ * given. Default: anywhere. For a node a server runs for someone else, such
43
+ * as the MCP service's: what it reads is theirs to write, and must not make
44
+ * the server connect inside its own network.
45
+ */
46
+ readonly reach?: (address: string) => Promise<boolean>;
36
47
  }
37
48
  export interface NodeConfig {
38
- /** Who this node acts for. The root key only ever signs session delegations. */
49
+ /** Who this node acts for. The root key only signs session delegations. */
39
50
  readonly signer: RootSigner;
40
- /** The account key (`deriveAccountKey(seed)`): with it, the node follows the account registry, so spaces are joined and left on every device */
51
+ /** The account key (`deriveAccountKey(seed)`): the node then follows the account registry */
41
52
  readonly accountKey?: Uint8Array;
42
- /** The account's contact key (`deriveContactKeyBytes(seed)`), for a node allowed to open contact requests and knocks */
53
+ /** The account's contact key (`deriveContactKeyBytes(seed)`), to open contact requests and knocks */
43
54
  readonly contactKey?: Uint8Array;
44
55
  /** The account's contacts space, for a node given it without the account key */
45
56
  readonly contactsSpace?: string;
46
- /** How the inbox and short links reach mailboxes. Default: a WebSocket to each (`createMailboxClient`). */
57
+ /**
58
+ * The account's name as a grant gives it: what knocks and a new inbox say
59
+ * until the account's profile reaches this node from its registry
60
+ */
61
+ readonly accountName?: string;
62
+ /** How the inbox and short links reach mailboxes. Default: `createMailboxClient` */
47
63
  readonly mailbox?: MailboxClient;
48
64
  /** Where the registry and each space's store live */
49
65
  readonly stores: StoreFactory;
50
66
  readonly provider?: CryptoProvider;
51
- /** Collections this node knows the shape of, where a space does not describe them: checked on write, flagged (`conforms`) on read, never refused on arrival */
67
+ /** Collection shapes to use where a space has none: checked on write, flagged (`conforms`) on read, never refused */
52
68
  readonly collections?: ReadonlyArray<CollectionDef>;
53
69
  /** Omit to stay offline */
54
70
  readonly network?: NodeNetworkConfig;
55
- /** How long each session delegation lasts. Renewed before it runs out. Default 3600. */
71
+ /** Seconds each session delegation lasts; renewed before it runs out. Default 3600. */
56
72
  readonly sessionTtlSeconds?: number;
57
- /** The key this node signs with, when the signer already named it (an app an account home delegated to). Default: one claimed from `writerKey`, else a fresh one */
73
+ /** The key to sign with, when the signer already named it. Default: one claimed from `writerKey`, else a fresh one */
58
74
  readonly sessionKey?: CryptoKeyPair;
59
- /**
60
- * Where to keep a signing key across runs, so this device keeps one log in
61
- * each space (`browserWriterKeys`; the CLI keeps them on disk). Ignored with
62
- * `sessionKey`. Without it, or when no key can be claimed, the node makes a
63
- * key for this run alone.
64
- */
75
+ /** Where to keep a signing key across runs (`browserWriterKeys`). Without one, each run makes a new key. */
65
76
  readonly writerKey?: WriterKeySource;
66
- /** How often to look for writes another process made to a folder store. 0 disables. Default 2000. */
77
+ /** How often to look for another process's writes to a folder store, ms. 0 disables. Default 2000. */
67
78
  readonly watchIntervalMs?: number;
68
79
  /**
69
- * Fetch and keep every file the records it keeps name, of any size: what a
70
- * node keeping spaces for others does. Without it, files others wrote are
71
- * fetched unread up to 5 MiB, and past 256 MiB in a space those used
72
- * longest ago are dropped (spec 05 §16.6).
80
+ * Fetch and keep every file of any size, as a keeper does. Default: others'
81
+ * files up to 5 MiB, dropping the least used past 256 MiB a space (spec 05 §16.6).
73
82
  */
74
83
  readonly fetchFiles?: 'all';
75
84
  /** Hold only the collections this node uses, once a space names a keeper to hold the rest */
76
85
  readonly cache?: CacheConfig;
77
86
  }
78
- /** How a node holds part of a space: its own choice, which nothing else depends on */
87
+ /** How a node holds part of a space: its own choice */
79
88
  export interface CacheConfig {
80
89
  /** Collections this app uses: held from the start, and dropped last */
81
90
  readonly collections?: ReadonlyArray<string>;
82
- /** Drop a collection no query has touched for this many days, unless it holds writes of this node's still waiting. Default 30. */
91
+ /** Drop a collection no query touched for this many days, unless it holds unsent writes. Default 30. */
83
92
  readonly unusedAfterDays?: number;
84
- /** How many keepers a write must reach before it can be dropped; only ever raises the space's own `copies` (default 2) */
93
+ /** How many keepers a write must reach before it can be dropped; only raises the space's `copies` (default 2) */
85
94
  readonly copies?: number;
86
95
  }
87
96
  /** A space, as the node describes it. Never carries the key. */
@@ -89,37 +98,33 @@ export interface SpaceSummary {
89
98
  readonly id: string;
90
99
  readonly name: string;
91
100
  readonly visibility: SpaceVisibility;
92
- /** Its founders, as its constitution names them: none under `top: "none"`. Some may have stepped down since (`access`) */
101
+ /** Its founders, as its constitution names them; some may have stepped down since (`access`) */
93
102
  readonly founders: ReadonlyArray<string>;
94
- /** The space it succeeds, as its constitution says. Whether that space names it back is `spaces.successors` there */
103
+ /** The space it succeeds, as its constitution says */
95
104
  readonly succeeds?: string;
96
105
  readonly createdAt: string;
97
- /** Whether this node can read the space: always for public ones, only with the key for private */
106
+ /** Whether this node can read the space: public, or private with the key */
98
107
  readonly readable: boolean;
99
- /** Whether this account holds a role here, and so may write, as far as this node last heard */
108
+ /** Whether this account holds a role here, and so may write */
100
109
  readonly writable: boolean;
101
110
  /** What this account is here: `founder`, a role it holds by name, or null when it holds none */
102
111
  readonly role: string | null;
103
- /** Whether an invite is waiting to be used — its record has not reached this device yet */
112
+ /** Whether an invite is waiting to be used: its record has not arrived yet */
104
113
  readonly joining: boolean;
105
114
  }
106
115
  export interface NewSpace {
107
116
  readonly name: string;
108
117
  /** `private` encrypts every body with the space key */
109
118
  readonly visibility: SpaceVisibility;
110
- /** The roles it is founded with, and their grants (`rolePresets` has some). Default: none, the creator, its founder, alone */
119
+ /** The roles it is founded with (`rolePresets` has some). Default: none */
111
120
  readonly roles?: ReadonlyArray<SpaceRole>;
112
- /**
113
- * `founders` (the default): you, and any `cofounders`, hold every command
114
- * and no one else can remove you. `none`: no one is above the roles, and
115
- * you hold only `creatorRoles`
116
- */
121
+ /** `founders` (default): you and any `cofounders` hold every command. `none`: you hold only `creatorRoles` */
117
122
  readonly top?: 'founders' | 'none';
118
123
  /** Under `top: founders`, accounts that found it with you */
119
124
  readonly cofounders?: ReadonlyArray<string>;
120
125
  /** Roles the constitution gives you. Under `top: none` you need one */
121
126
  readonly creatorRoles?: ReadonlyArray<string>;
122
- /** The space this one succeeds. Name it there too, with `spaces.succeed`, so members can tell it from a copy */
127
+ /** The space this one succeeds; name it there too, with `spaces.succeed` */
123
128
  readonly succeeds?: string;
124
129
  }
125
130
  export interface InvitePreview {
@@ -127,30 +132,26 @@ export interface InvitePreview {
127
132
  readonly invitedBy: string;
128
133
  /** Whether the invite carries the key to a private space */
129
134
  readonly carriesKey: boolean;
130
- /** Whether the invite lets you join with a role — false for a view-only one */
135
+ /** Whether the invite gives a role: false for a view-only one */
131
136
  readonly carriesWrite: boolean;
132
- /** The role it is for, as the link says. The space's own invite record is what counts. */
137
+ /** The role it is for, as the link says; the space's invite record is what counts */
133
138
  readonly role: string | null;
134
- /** For a short link: when its inviter stops sharing it, ms. Nothing a peer enforces */
139
+ /** For a short link: when its inviter stops sharing it, ms */
135
140
  readonly until?: number;
136
141
  }
137
142
  export interface InviteOptions {
138
- /** The role whoever uses it will hold. Default: the lowest below yours, or view-only when there is none */
143
+ /** The role it gives. Default: the lowest below yours, or view-only */
139
144
  readonly role?: string;
140
- /** False for a view-only invite: the key to read a private space, and no role */
145
+ /** False for a view-only invite: the key, and no role */
141
146
  readonly write?: boolean;
142
- /**
143
- * A short link (spec 03 §7.7): about 85 characters, the rest of the invite
144
- * kept sealed in mailboxes. Falls back to the long form when no mailbox
145
- * takes it, or the space is too large for one.
146
- */
147
+ /** A short link, the rest sealed in mailboxes (spec 03 §7.7); the long form when no mailbox takes it */
147
148
  readonly short?: boolean;
148
- /** For a short link: when to stop sharing it, ms. Closing the invite is what ends it */
149
+ /** For a short link: when to stop sharing it, ms. Closing the invite is what ends it. */
149
150
  readonly until?: number;
150
151
  }
151
152
  /** Who holds what in a space, now */
152
153
  export interface SpaceAccess {
153
- /** The space's roles, by name, each with its current definitions: more than one are rivals, holding what they share */
154
+ /** The space's roles, each with its current definitions (rivals hold what they share) */
154
155
  readonly roles: ReadonlyArray<SpaceRoleView>;
155
156
  /** Everyone with a place: the founders, and every account assigned a role */
156
157
  readonly members: ReadonlyArray<{
@@ -164,54 +165,39 @@ export interface SpaceAccess {
164
165
  readonly role: string;
165
166
  readonly open: boolean;
166
167
  }>;
167
- /** Whether this account is a founder of the space, and has not stepped down: it holds every command */
168
+ /** Whether this account is a founder that has not stepped down */
168
169
  readonly founder: boolean;
169
170
  /** `founders` or `none`, as the constitution says */
170
171
  readonly top: 'founders' | 'none';
171
- /**
172
- * No founder is left, and no member may change roles: nobody can run the
173
- * space any more, so a successor is the way on (`spaces.succeed`)
174
- */
172
+ /** No founder is left and no member may change roles: only a successor helps (`spaces.succeed`) */
175
173
  readonly headless: boolean;
176
- /**
177
- * Spaces named as this one's successors, each with the accounts that named
178
- * it. In no order: which to follow is each member's choice, and an app
179
- * must not pick one for them
180
- */
174
+ /** Spaces named as successors, and who named each. In no order: which to follow is each member's choice. */
181
175
  readonly successors: ReadonlyArray<{
182
176
  readonly space: string;
183
177
  readonly by: ReadonlyArray<string>;
184
178
  }>;
185
179
  /** The roles assigned to this account, by name */
186
180
  readonly mine: ReadonlyArray<string>;
187
- /** The latest access changes held — what a record written now names as `seen` */
181
+ /** The latest access changes held: what a record written now names as `seen` */
188
182
  readonly heads: ReadonlyArray<string>;
189
- /** A private space's key: how often it changed, and whether this device holds the current one. Null when public */
183
+ /** A private space's key: how often it changed, and whether this device holds the current one */
190
184
  readonly key: {
191
185
  readonly changes: number;
192
186
  readonly held: boolean;
193
187
  } | null;
194
- /** Where the space's members meet: the relays it names, or until it names some, the ones its invite did */
188
+ /** Where members meet: the relays it names, else the ones its invite did */
195
189
  readonly relays: ReadonlyArray<string>;
196
- /** The nodes that keep the space whole: a host, an extension. Empty until someone who manages it names some. */
190
+ /** The nodes that keep the space whole: a host, an extension */
197
191
  readonly keepers: ReadonlyArray<Keeper>;
198
- /** How many keepers a write should reach before a node holding part of the space lets go of it; null for the default */
192
+ /** How many keepers a write should reach before it may be dropped; null for the default */
199
193
  readonly copies: number | null;
200
- /**
201
- * Keys proven to have signed two versions at one place in their line for a
202
- * collection here: stolen, or copied where they shouldn't be. What they
203
- * signed in that collection from `from` on no longer counts (spec 02 §4.10).
204
- */
194
+ /** Keys proven to have forked their line in a collection; what they signed from `from` on no longer counts (spec 02 §4.10) */
205
195
  readonly forks: ReadonlyArray<{
206
196
  readonly writer: string;
207
197
  readonly collection: string;
208
198
  readonly from: number;
209
199
  }>;
210
- /**
211
- * Accounts proven, by a warrant every peer checked, to have signed something
212
- * the protocol refuses and no honest writer could have (spec 03 §6.6). For
213
- * whoever manages the space to see; nothing is done about it by itself.
214
- */
200
+ /** Accounts a checked warrant proves signed what no honest writer could (spec 03 §6.6), for managers to see */
215
201
  readonly flagged: ReadonlyArray<FlaggedAccount>;
216
202
  }
217
203
  /** A role as the history has it now */
@@ -239,47 +225,39 @@ export interface FlaggedAccount {
239
225
  /** The id of the offending version */
240
226
  readonly offence: string;
241
227
  }
242
- /** A record, opened and checked — its current version, unless listed as history */
228
+ /** A record, opened and checked: its current version, unless listed as history */
243
229
  export interface NodeRecord<T = unknown> {
244
- /** The record's identity. Stays the same across edits; links point here. */
230
+ /** The record's identity, the same across edits; links point here */
245
231
  readonly key: string;
246
- /** This version's id — a content hash, different for every edit */
232
+ /** This version's id: a content hash */
247
233
  readonly version: string;
248
234
  /** 0 for the first version, one more for each edit */
249
235
  readonly seq: number;
250
236
  readonly space: string;
251
237
  readonly collection: string;
252
- /** The key that signed this version — usually a session key */
238
+ /** The key that signed this version, usually a session key */
253
239
  readonly author: string;
254
240
  /** The identity that key was acting for, when its delegation checks out */
255
241
  readonly root: string | null;
256
242
  /** The identity that created the record, when its first version is held */
257
243
  readonly createdBy: string | null;
258
- /** When the record was created, as its creator's clock said — for display; it decides nothing */
244
+ /** When it was created, by its creator's clock: for display only */
259
245
  readonly createdAt: string;
260
- /** When this version was written, likewise for display only */
246
+ /** When this version was written: for display only */
261
247
  readonly updatedAt: string;
262
248
  /** The content, or null when it is encrypted and this node has no key */
263
249
  readonly body: T | null;
264
- /** What this record points at — empty when it points at nothing, or cannot be opened */
250
+ /** What this record points at; empty when it can't be opened */
265
251
  readonly links: ReadonlyArray<Link>;
266
252
  readonly encrypted: boolean;
267
253
  /** Signature, delegation and shape all check out */
268
254
  readonly verified: boolean;
269
- /**
270
- * True when the note this version was signed under grants writing records
271
- * and no more: it could not have defined a collection here. An app that
272
- * runs what a record holds, as code, trusts only versions without it.
273
- */
255
+ /** Signed under a note that grants writing records and no more: an app running records as code trusts only versions without it */
274
256
  readonly recordsOnly?: true;
275
257
  readonly reason?: string;
276
- /** Present, and true, when this version deletes the record (listed only with `includeDeleted`) */
258
+ /** This version deletes the record (listed only with `includeDeleted`) */
277
259
  readonly deleted?: true;
278
- /**
279
- * Whether the body fits its collection's schema; null when there is none or
280
- * it could not be opened. A misfit is still kept and synced: refusing it
281
- * would leave peers that saw different definitions disagreeing forever.
282
- */
260
+ /** Whether the body fits its collection's schema; null when there is none or it can't be opened. A misfit still syncs. */
283
261
  readonly conforms: boolean | null;
284
262
  readonly issues?: ReadonlyArray<SchemaIssue>;
285
263
  }
@@ -291,19 +269,19 @@ export interface NodeCollection {
291
269
  /** Null when records exist but the space has no definition for them */
292
270
  readonly schema: JsonSchema | null;
293
271
  readonly version: number | null;
294
- /** Whether edits keep old versions: `all` for an audit trail, `latest` (the default) for current state only */
272
+ /** Whether edits keep old versions: `all`, or `latest` (the default) */
295
273
  readonly history: 'latest' | 'all';
296
- /** The link roles its records carry, and what each may point at — how the space's things connect */
274
+ /** The link roles its records carry, and what each may point at */
297
275
  readonly links: Readonly<Record<string, LinkDeclaration>>;
298
- /** The identity that first defined it — it, and anyone who can manage the space, may change it */
276
+ /** The identity that first defined it */
299
277
  readonly definedBy: string | null;
300
- /** What must be unique, which fields are fixed — for records created from now on */
278
+ /** What must be unique, which fields are fixed */
301
279
  readonly rules: CollectionRules;
302
280
  /** What a version must be to count, judged by readers; absent when it has none */
303
281
  readonly contract?: CollectionContract;
304
282
  /** Values derived from what links to its records; absent when it has none */
305
283
  readonly computed?: ComputedFields;
306
- /** Fields whose values are topics, tagged on the outside of each record so keepers can match them unread */
284
+ /** Fields whose values are tagged on each record's outside, so keepers can match them unread */
307
285
  readonly topics: ReadonlyArray<string>;
308
286
  readonly records: number;
309
287
  }
@@ -311,31 +289,24 @@ export interface DefineCollection {
311
289
  readonly name: string;
312
290
  readonly title?: string;
313
291
  readonly description?: string;
314
- /** JSON Schema in the supported subset, or a validator that describes itself as one (Standard JSON Schema) */
292
+ /** JSON Schema in the supported subset, or a Standard JSON Schema validator */
315
293
  readonly schema: JsonSchema | StandardJSONSchemaV1;
316
294
  /** Default: one past the current version, or 1 */
317
295
  readonly version?: number;
318
- /** Keep every version of every record in it (`all`), or only the current one (`latest`, the default) */
296
+ /** Keep every version (`all`), or only the current one (`latest`, the default) */
319
297
  readonly history?: 'latest' | 'all';
320
298
  /** The link roles its records may carry, and what each may point at */
321
299
  readonly links?: Readonly<Record<string, LinkDeclaration>>;
322
- /** What must be unique, which fields are fixed, whether records are written once: what every peer checks */
300
+ /** What must be unique, which fields are fixed, whether records are written once: every peer checks */
323
301
  readonly rules?: CollectionRules;
324
- /** Fields whose values are topics — `channel`, `mentions` — so a keeper can match them without reading (`StoredCollection.topics`) */
302
+ /** Fields whose values are topics, like `channel`, so a keeper can match them unread */
325
303
  readonly topics?: ReadonlyArray<string>;
326
- /**
327
- * What a version must be to count, judged by readers: `check`, conditions in CEL or built
328
- * in TypeScript, and `line`, one line per account at `lineKey(account, name)`
329
- * (packages/core/docs/contracts.md)
330
- */
304
+ /** What a version must be to count, judged by readers: `check` conditions and a `line` (packages/core/docs/contracts.md) */
331
305
  readonly contract?: CollectionContract | {
332
306
  readonly check?: ReadonlyArray<Contract> | ((scope: never) => Readonly<Record<string, unknown>>);
333
307
  readonly line?: Line;
334
308
  };
335
- /**
336
- * Values every app derives the same way from what links to its records, in CEL or built in
337
- * TypeScript (packages/core/docs/computed.md)
338
- */
309
+ /** Values derived from what links to its records (packages/core/docs/computed.md) */
339
310
  readonly computed?: ComputedFields | ((scope: never) => ComputedResult);
340
311
  }
341
312
  export interface NodeCollections {
@@ -345,7 +316,7 @@ export interface NodeCollections {
345
316
  define(spaceId: string, definition: DefineCollection): Promise<NodeCollection>;
346
317
  /** Takes a definition out of the space; refused while the collection still has records */
347
318
  delete(spaceId: string, name: string): Promise<void>;
348
- /** The topic tag a record with this value carries on its outside, keyed in a private space so only members can work it out */
319
+ /** The topic tag a record with this value carries; keyed in a private space, so only members can work it out */
349
320
  tag(spaceId: string, collection: string, field: string, value: string | number | boolean): Promise<string>;
350
321
  }
351
322
  /** A version under its collection's contract: `passes` null when it has none, or this node can't judge it */
@@ -356,7 +327,7 @@ export interface RecordContracts {
356
327
  readonly reason?: string;
357
328
  /** A version it cites, or the one before it, hasn't arrived yet */
358
329
  readonly pending?: true;
359
- /** Its collection declares something this library doesn't know: counted by no one here, and failed by no one */
330
+ /** Its collection declares something this library doesn't know, so it is neither counted nor failed */
360
331
  readonly unjudged?: true;
361
332
  }
362
333
  export interface ListOptions {
@@ -379,32 +350,28 @@ export interface SpaceStatus {
379
350
  readonly connection: ConnectionState;
380
351
  /** Peers currently connected in this space */
381
352
  readonly peers: ReadonlyArray<string>;
382
- /** Of `peers`, this account's own other devices and apps — the ones following the account registry too */
353
+ /** Of `peers`, this account's own other devices and apps */
383
354
  readonly own: ReadonlyArray<string>;
384
- /** Of `peers`, carriers the account uses: nodes that keep its spaces online without reading them */
355
+ /** Of `peers`, carriers the account uses */
385
356
  readonly carriers: ReadonlyArray<string>;
386
- /** The account each peer showed it acts for, by the peer's session DID — only peers that showed one */
357
+ /** The account each peer showed it acts for, by session DID */
387
358
  readonly accounts: Readonly<Record<string, string>>;
388
- /** A fingerprint of every version this node keeps here — equal on two nodes means identical data */
359
+ /** A fingerprint of every version kept here: equal on two nodes means identical data */
389
360
  readonly fingerprint: string;
390
361
  /** Records peers sent that failed validation */
391
362
  readonly rejected: number;
392
- /** What this node holds of the space: `all`, or the collections it uses (besides the space's own) */
363
+ /** What this node holds of the space: `all`, or the collections it uses */
393
364
  readonly holds: 'all' | ReadonlyArray<string>;
394
- /** Writes of this node's that haven't reached enough keepers yet, so are kept whatever else is dropped */
365
+ /** Writes of this node's that haven't reached enough keepers yet */
395
366
  readonly pending: number;
396
367
  }
397
368
  /** A live message as it arrives: what was sent, and who sent it */
398
369
  export interface LiveMessage {
399
- /** The account behind the sender, proven by its session's note; null for a peer that showed none */
370
+ /** The sender's account, proven by its note; null for a peer that showed none */
400
371
  readonly from: string | null;
401
- /** The sending device: its session DID, which is also where a reply to that device goes */
372
+ /** The sending device's session DID, where a reply to it goes */
402
373
  readonly peer: string;
403
- /**
404
- * Whether the sender's note writes records in some space but can't define
405
- * collections in this one, judged on the whole note so a key for another
406
- * space is caught too. False for a note that only reads, which writes nothing.
407
- */
374
+ /** Whether the sender's note writes records but can't define collections here (false for a read-only note) */
408
375
  readonly recordsOnly: boolean;
409
376
  readonly message: unknown;
410
377
  }
@@ -437,7 +404,7 @@ export type NodeEvent =
437
404
  readonly type: 'message';
438
405
  readonly space: string;
439
406
  } & LiveMessage)
440
- /** The note this node writes under was revoked in a space — an app disconnected from its account home, say */
407
+ /** The note this node writes under was revoked in a space */
441
408
  | {
442
409
  readonly type: 'revoked';
443
410
  readonly space: string;
@@ -450,16 +417,16 @@ export type NodeEvent =
450
417
  export interface NodeNetwork {
451
418
  /** Where each relay and connection stands. No relays when none are configured. */
452
419
  status(): MeshStatus;
453
- /** Tries every relay that is waiting to reconnect, now, rather than at its next turn */
420
+ /** Tries every relay waiting to reconnect, now */
454
421
  reconnect(): void;
455
422
  }
456
423
  /** Who someone is in a space: the name they gave there, by their identity */
457
424
  export interface SpaceProfile {
458
- /** Their identity — what `root` and `createdBy` on a record name */
425
+ /** Their identity, as `root` and `createdBy` on a record name it */
459
426
  readonly did: string;
460
427
  readonly name: string;
461
428
  readonly updatedAt: string;
462
- /** The public half of their contact key, which a contact request to them is sealed with (`contacts.ask`) */
429
+ /** Their contact key's public half, which a contact request is sealed to */
463
430
  readonly contactKey?: string;
464
431
  /** Their picture, a file in this space: read it with `records.readFile` */
465
432
  readonly avatar?: FileRef;
@@ -468,85 +435,74 @@ export interface NodeSpaces {
468
435
  list(): Promise<ReadonlyArray<SpaceSummary>>;
469
436
  get(spaceId: string): Promise<SpaceSummary | null>;
470
437
  create(params: NewSpace): Promise<SpaceSummary>;
471
- /** An invite string, shown once. For a private space it carries the key, so treat it as a secret */
438
+ /** An invite string. For a private space it carries the key: treat it as a secret */
472
439
  invite(spaceId: string, options?: InviteOptions): Promise<string>;
473
440
  /** What an invite or link is for; a short link is fetched from its mailboxes first */
474
441
  preview(invite: string): Promise<InvitePreview>;
475
- /** Joins a space from an invite. `memberKey`, for a node without the account key, lets a new key of the space reach it */
442
+ /** Joins a space from an invite. `memberKey` lets a node without the account key receive new space keys */
476
443
  join(invite: string, options?: {
477
444
  readonly memberKey?: Uint8Array;
478
445
  }): Promise<SpaceSummary>;
479
- /** Gives up the account's place in a space (its own removal record), then forgets it on this node with its key */
446
+ /** Gives up the account's place in a space, then forgets it and its key here */
480
447
  leave(spaceId: string): Promise<void>;
481
448
  /** Roles, members and invites, as the space's access history says now */
482
449
  access(spaceId: string): Promise<SpaceAccess>;
483
450
  /** Whether this account, or `account`, may invoke a command with these arguments in a space now (spec 03 §2) */
484
451
  may(spaceId: string, cmd: string, args?: Readonly<Record<string, unknown>>, account?: string): Promise<boolean>;
485
- /**
486
- * Whether this account, or `account`, holds every grant a role gives, each as
487
- * wide or wider: what it may hand to a bot or an agent without handing on
488
- * more than it holds. Compares the policies' words, so it may say no where
489
- * they would allow, never yes where they wouldn't.
490
- */
452
+ /** Whether this account, or `account`, holds every grant of a role at least as wide; may say no wrongly, never yes */
491
453
  holdsRole(spaceId: string, role: string, account?: string): Promise<boolean>;
492
- /** Writes a role's definition, replacing the ones this node holds: its grants and the roles it nests. Needs `/role/define` */
454
+ /** Writes a role's definition, replacing the ones held. Needs `/role/define` */
493
455
  defineRole(spaceId: string, role: SpaceRole): Promise<void>;
494
456
  /** Assigns a role to an account. Needs `/role/assign` */
495
457
  assign(spaceId: string, did: string, role: string): Promise<void>;
496
- /** Takes a role from an account; your own, to leave it, needs nothing. Otherwise `/role/unassign` */
458
+ /** Takes a role from an account. Needs `/role/unassign`, unless it is your own */
497
459
  unassign(spaceId: string, did: string, role: string): Promise<void>;
498
- /** Removes an account and every role it holds; yourself, to leave, needs nothing. Otherwise `/member/remove` */
460
+ /** Removes an account and its roles. Needs `/member/remove`, unless it is you */
499
461
  removeMember(spaceId: string, did: string): Promise<void>;
500
- /**
501
- * Stops being a founder and stays, with the roles you hold: given `keep`,
502
- * you take that role first. To go altogether, `leave`. Only a founder steps
503
- * down, and only itself
504
- */
462
+ /** Stops being a founder but stays, taking role `keep` first when given */
505
463
  stepDown(spaceId: string, options?: {
506
464
  readonly keep?: string;
507
465
  }): Promise<void>;
508
- /**
509
- * Names a space that succeeds this one (its constitution's `succeeds`
510
- * naming this one). It changes nothing here. Needs `/space/succeed`, or,
511
- * where no member holds it, a place here
512
- */
466
+ /** Names a space that succeeds this one. Needs `/space/succeed`, or a place here when no one holds it */
513
467
  succeed(spaceId: string, successor: string): Promise<void>;
514
- /** Closes an invite — by the link itself, or by its key from `access().invites`. Who joined with it before stays. */
468
+ /** Closes an invite, by link or by its key from `access().invites`. Who joined with it stays. */
515
469
  closeInvite(spaceId: string, keyOrLink: string): Promise<void>;
516
- /** Gives a private space a new key, as happens when someone is removed: for a lost device. Needs `/key/change` */
470
+ /** Gives a private space a new key, for a lost device. Needs `/key/change` */
517
471
  changeKey(spaceId: string): Promise<void>;
518
- /** Names the relays (wss://, at most 8) the space's members meet on, whatever relays their apps use. Needs `/space/relays` */
472
+ /** Names the relays (wss://, at most 8) the space's members meet on. Needs `/space/relays` */
519
473
  setRelays(spaceId: string, relays: ReadonlyArray<string>): Promise<void>;
520
474
  /** Names the nodes that keep the space whole (at most 16), and how many a write should reach. Needs `/space/keepers` */
521
475
  setKeepers(spaceId: string, keepers: ReadonlyArray<Keeper>, copies?: number | null): Promise<void>;
522
476
  /**
523
- * Revokes one of this account's keys (a session's, an app's, by DID): nothing it writes counts from then on, except what was seen.
524
- * With `waitMs`, waits up to that long for a peer to take the revoke in: true when one did, or with no wait.
477
+ * Revokes one of this account's keys, by DID: nothing it writes counts from then on.
478
+ * With `waitMs`, waits that long for a peer to take it in: true when one did, or with no wait.
525
479
  */
526
480
  revoke(spaceId: string, key: string, options?: RevokeOptions): Promise<boolean>;
527
481
  /** Keeps a space syncing until the function it returns is called; it stops once nothing holds it */
528
482
  hold(spaceId: string): Promise<() => Promise<void>>;
529
- /** A live message to the peers connected now, kept nowhere, at most 64 KB; `to` an account or a session DID. Arrives as a `message` event */
483
+ /** A live message (at most 64 KB) to peers connected now, `to` an account or a session DID; kept nowhere */
530
484
  send(spaceId: string, message: unknown, to?: string): Promise<void>;
531
485
  status(spaceId: string): Promise<SpaceStatus>;
532
- /**
533
- * Waits up to `waitMs` (default 3 s) for one of the account's carriers that
534
- * is connected now to hold everything this node does of a space, so an
535
- * invite to it works with every device of the account away. False at once
536
- * when no carrier is connected, and false when it didn't catch up in time.
537
- */
486
+ /** Waits up to `waitMs` (default 3 s) for a connected carrier to hold all this node does of a space */
538
487
  carried(spaceId: string, options?: {
539
488
  readonly waitMs?: number;
540
489
  }): Promise<boolean>;
490
+ /** Waits up to `waitMs` (at most a minute) for one peer, by its key, to hold all this node does of a space; for a node about to close */
491
+ reached(spaceId: string, peer: string, waitMs: number): Promise<boolean>;
492
+ /**
493
+ * Waits up to `waitMs` (at most a minute) for this node's writes in a space
494
+ * to be kept elsewhere: by the space's keepers, every write from `since`
495
+ * (ms) on, all by default (`'keepers'`); or, in a space that names none,
496
+ * where every member's node is a copy, by a peer connected now that holds
497
+ * all this node does (`'peer'`). Null when nobody had, in time.
498
+ */
499
+ kept(spaceId: string, waitMs: number, since?: number): Promise<'keepers' | 'peer' | null>;
541
500
  /** How a node serving this space checks connecting peers and signs its welcome; null for a space it does not hold */
542
501
  authenticator(spaceId: string): Promise<ServerAuth | null>;
543
- /** The name each person gave in this space, by identity; yours is published from the account's name */
502
+ /** The name each person gave in this space; yours is published from the account's name */
544
503
  profiles(spaceId: string): Promise<ReadonlyArray<SpaceProfile>>;
545
504
  }
546
- /**
547
- * A file a body refers to, as `records.addFile` gives it: what names it on a
548
- * version (`hash`, `size`), what opens it (`key`, `salt`), and what it is.
549
- */
505
+ /** A file a body refers to, as `records.addFile` gives it */
550
506
  export interface FileRef {
551
507
  readonly hash: string;
552
508
  readonly size: number;
@@ -560,63 +516,43 @@ export interface NodeRecords {
560
516
  list<T = unknown>(spaceId: string, options?: ListOptions): Promise<ReadonlyArray<NodeRecord<T>>>;
561
517
  /** A record's current version, or null when there is none or it was deleted */
562
518
  get<T = unknown>(spaceId: string, key: string): Promise<NodeRecord<T> | null>;
563
- /**
564
- * How a record's newest version that stands fares under its collection's
565
- * contract, or the version named. A version that fails is kept and synced
566
- * by every peer, but `get`, `list` and queries count only versions that
567
- * pass (packages/core/docs/contracts.md).
568
- */
519
+ /** How a record's newest standing version, or the one named, fares under its collection's contract */
569
520
  contracts(spaceId: string, key: string, version?: string): Promise<RecordContracts | null>;
570
- /**
571
- * The key `name` has in an account's namespace (this one's unless another
572
- * is named): where `put(…, { key: name })` writes. Keys belong to the
573
- * account that creates them (packages/core/docs/records-and-queries.md#keys).
574
- */
521
+ /** The key `name` has in an account's namespace (this one's by default): where `put(…, { key: name })` writes */
575
522
  keyFor(spaceId: string, name: string, account?: string): Promise<string>;
576
- /**
577
- * The key a record with this body and links has under its collection's
578
- * `onePer`, written by `account` (this one unless named): null when the
579
- * collection has no `onePer`, or the body lacks a part it names.
580
- */
523
+ /** The key a record with this body has under its collection's `onePer`; null when there is none */
581
524
  onePerKey(spaceId: string, collection: string, body: unknown, options?: {
582
525
  links?: ReadonlyArray<Link>;
583
526
  account?: string;
584
527
  }): Promise<string | null>;
585
- /**
586
- * Creates a record, under a fresh key of this account's, or the name given
587
- * as `key` in its namespace. Writing a deleted key brings it back
588
- */
528
+ /** Creates a record under a fresh key, or `key` in this account's namespace. Writing a deleted key brings it back. */
589
529
  put<T = unknown>(spaceId: string, collection: string, body: T, options?: {
590
530
  key?: string;
591
531
  links?: ReadonlyArray<Link>;
592
532
  }): Promise<NodeRecord<T>>;
593
- /** The same, given the collection's definition: the body is checked against its type as you write it */
533
+ /** The same, typed by the collection's definition */
594
534
  put<C extends {
595
535
  readonly name: string;
596
536
  }>(spaceId: string, collection: C, body: BodyOf<C>, options?: {
597
537
  key?: string;
598
538
  links?: ReadonlyArray<Link>;
599
539
  }): Promise<NodeRecord<BodyOf<C>>>;
600
- /** Writes the record's next version. Same key; `seq` one higher. Links carry over unless given. */
540
+ /** Writes the record's next version; links carry over unless given */
601
541
  update<T = unknown>(spaceId: string, key: string, body: T, options?: {
602
542
  links?: ReadonlyArray<Link>;
603
543
  }): Promise<NodeRecord<T>>;
604
- /** The records whose current version points at this one — optionally in one role, or one collection */
544
+ /** The records whose current version points at this one, optionally by role or collection */
605
545
  linked<T = unknown>(spaceId: string, key: string, options?: {
606
546
  rel?: string;
607
547
  collection?: string;
608
548
  }): Promise<ReadonlyArray<NodeRecord<T>>>;
609
549
  /** Deletes a record everywhere, by writing a version marked deleted */
610
550
  delete(spaceId: string, key: string): Promise<void>;
611
- /** The versions of a record kept here, newest first: current and first, and every other with `history: 'all'` */
551
+ /** The versions of a record kept here, newest first */
612
552
  history<T = unknown>(spaceId: string, key: string): Promise<ReadonlyArray<NodeRecord<T>>>;
613
- /** Whether this account may `create` in a collection (`target` its name), or `edit` / `delete` a record (`target` its key) */
553
+ /** Whether this account may `create` in a collection, or `edit` / `delete` a record; `target` names it */
614
554
  can(spaceId: string, action: 'create' | 'edit' | 'delete', target: string): Promise<boolean>;
615
- /**
616
- * Seals a file under a key of its own, keeps it, and gives back the
617
- * reference to put in a body: a version whose body holds it names the file
618
- * on its outside, so peers fetch and keep it (spec 05 §16.6).
619
- */
555
+ /** Seals and keeps a file, giving the reference to put in a body (spec 05 §16.6) */
620
556
  addFile(spaceId: string, bytes: Uint8Array, about: {
621
557
  mime: string;
622
558
  name?: string;
@@ -633,7 +569,7 @@ export interface NodeRecords {
633
569
  }
634
570
  export interface AccountProfileView {
635
571
  readonly name: string;
636
- /** The account's picture, a file in its registry; each space holds its own copy (`SpaceProfile.avatar`) */
572
+ /** The account's picture, a file in its registry */
637
573
  readonly avatar?: FileRef;
638
574
  /** When it was set, on whichever device set it */
639
575
  readonly updatedAt: string;
@@ -650,11 +586,7 @@ export interface CarrierSummary {
650
586
  /** Nodes that keep the account's spaces online without reading them (`space/pass.ts`). Needs the account key */
651
587
  export interface NodeCarriers {
652
588
  list(): Promise<ReadonlyArray<CarrierSummary>>;
653
- /**
654
- * Starts using a carrier: a carry space with a pass for every space, kept
655
- * current by every device. Its invite is the carrier's. The same carrier
656
- * again, by DID, gets the carry space it has.
657
- */
589
+ /** Starts using a carrier: a carry space with a pass for every space, and the invite to give it */
658
590
  add(carrier: {
659
591
  readonly did: string;
660
592
  readonly name: string;
@@ -662,20 +594,9 @@ export interface NodeCarriers {
662
594
  readonly space: string;
663
595
  readonly invite: string;
664
596
  }>;
665
- /**
666
- * Waits up to `waitMs` for the carrier to hold what this node wrote for it:
667
- * level with it in its carry space, then in the account registry. A node
668
- * about to close — the home's window, once it has answered — waits for this,
669
- * or nobody may hand the carrier its passes until the home opens again.
670
- */
597
+ /** Waits up to `waitMs` for the carrier to hold what this node wrote for it; for a node about to close */
671
598
  reached(space: string, waitMs: number): Promise<boolean>;
672
- /**
673
- * Waits up to `waitMs` for every carrier's carry space to hold the passes
674
- * and wakes as they are now, written here, and says whether it does. They
675
- * are written in the background: adding a carrier or an automation doesn't
676
- * wait, so a node about to close waits on this. It covers a refill already
677
- * started, or asked for, and is true at once when there is none.
678
- */
599
+ /** Waits up to `waitMs` for the passes and wakes written in the background to be done; for a node about to close */
679
600
  settled(waitMs: number): Promise<boolean>;
680
601
  /** Stops using a carrier: its passes go, and it is told to forget what it held */
681
602
  remove(space: string): Promise<void>;
@@ -685,11 +606,7 @@ export interface OwnAutomationView extends Automation {
685
606
  /** Its record key in the registry */
686
607
  readonly id: string;
687
608
  }
688
- /**
689
- * "Let me know when…": the account's own automations, across its spaces,
690
- * noticed by its carriers, which get each value as a topic tag. Needs the
691
- * account key.
692
- */
609
+ /** "Let me know when…": the account's own automations, noticed by its carriers. Needs the account key. */
693
610
  export interface NodeAutomations {
694
611
  list(): Promise<ReadonlyArray<OwnAutomationView>>;
695
612
  /** Starts one: `when.query` is a collection and a `where` over each new record, `$me` the account */
@@ -718,66 +635,55 @@ export interface HostingView {
718
635
  /** The subscription — the key the account made for this host */
719
636
  readonly subscription: string;
720
637
  readonly since: string;
721
- /** How the subscription stands, as the host signed it: now when `live`, else the last it said */
722
- readonly status: import('../session/hosting.js').HostStatus | null;
638
+ /** How the subscription stands, as the host signed it: now when `live`, else last heard */
639
+ readonly status: HostStatus | null;
723
640
  /** Whether `status` is what the host said just now */
724
641
  readonly live: boolean;
725
642
  /** Why it could not be reached */
726
643
  readonly error?: string;
727
- /** How the account's balance there is added to, from its description; null when it takes no payments or can't be reached */
728
- readonly fund: import('../session/hosting.js').FundOffer | null;
644
+ /** How the account's balance there is added to; null when it takes no payments or can't be reached */
645
+ readonly fund: FundOffer | null;
729
646
  /** Whether it sends reminders by email (`remind`) */
730
647
  readonly reminds: boolean;
731
648
  }
732
- /**
733
- * Hosts: carriers the account pays for, online when every device is off. A
734
- * device never handles a payment (spec/06-nodes-and-sessions.md, Hosts).
735
- */
649
+ /** Hosts: carriers the account pays for (spec/06-nodes-and-sessions.md, Hosts) */
736
650
  export interface NodeHosting {
737
- /** The hosts the account uses, each asked how it stands. Hands a host the spaces if it was paid since. */
651
+ /** The hosts the account uses, each asked how it stands; a host paid since gets the spaces */
738
652
  list(): Promise<ReadonlyArray<HostingView>>;
739
653
  /** Starts using a host: a subscription key every device signs as, and the spaces once it is paid */
740
654
  use(url: string): Promise<HostingView>;
741
- /** Adds to the account's balance at a host: a `checkout` page to open (`noopener`), or a `request` for a wallet */
742
- pay(url: string, payment: import('../session/hosting.js').FundPayment): Promise<import('../session/hosting.js').PayAnswer>;
743
- /** Asks a host for reminders by email before paid time runs out; it mails a link to confirm first */
655
+ /** Adds to the account's balance at a host: a `checkout` page to open, or a `request` for a wallet */
656
+ pay(url: string, payment: FundPayment): Promise<PayAnswer>;
657
+ /** Asks a host for reminders by email before paid time runs out */
744
658
  remind(url: string, email: string): Promise<void>;
745
- /** Stops using a host: it forgets the spaces, and the subscription is let go. Cancel a card that renews first (`manage`). */
659
+ /** Stops using a host: it forgets the spaces. Cancel a renewing card first (`manage`). */
746
660
  stop(url: string): Promise<void>;
747
- /** The hosts a space pays (`std.host`), each asked how its subscription stands; hands one the pass once paid */
661
+ /** The hosts a space pays (`std.host`), each asked how it stands; one paid gets the pass */
748
662
  space(spaceId: string): Promise<ReadonlyArray<SpaceHostingView>>;
749
- /**
750
- * The account's hosts that last said a space is over their free line
751
- * (spec 08 §1.1), from the statuses they signed: what a member is told
752
- * before those hosts stop carrying it for members. Asks no host.
753
- */
663
+ /** The account's hosts that last said a space is over their free line (spec 08 §1.1). Asks no host. */
754
664
  over(spaceId: string): Promise<ReadonlyArray<{
755
665
  readonly url: string;
756
666
  readonly name: string;
757
- readonly over: import('../session/hosting.js').OverSpace;
667
+ readonly over: OverSpace;
758
668
  }>>;
759
- /** Starts adding to a space's fund at one of the hosts it names: an amount, once or monthly. Anyone in it may. */
760
- payForSpace(spaceId: string, url: string, payment: import('../session/hosting.js').FundPayment): Promise<import('../session/hosting.js').PayAnswer>;
669
+ /** Adds to a space's fund at a host it names, once or monthly. Anyone in it may. */
670
+ payForSpace(spaceId: string, url: string, payment: FundPayment): Promise<PayAnswer>;
761
671
  /** Asks a host a space names for reminders by email before the space's paid time runs out */
762
672
  remindForSpace(spaceId: string, url: string, email: string): Promise<void>;
763
- /**
764
- * Stops a space using a host: its `std.host` record goes, and with `manage`
765
- * its bots are removed and a private space gets a new key. Nothing is asked
766
- * of the host.
767
- */
673
+ /** Stops a space using a host: its `std.host` record goes, and with `manage` its bots and key */
768
674
  stopForSpace(spaceId: string, url: string): Promise<{
769
675
  /** The bots removed from the space, by DID */
770
676
  readonly bots: ReadonlyArray<string>;
771
677
  /** Whether the space's key changes because of it */
772
678
  readonly newKey: boolean;
773
679
  }>;
774
- /** Asks a host the space names to run a bot there, joining with an invite for `role`; removing the bot stops it */
680
+ /** Asks a host the space names to run a bot there with `role`; removing the bot stops it */
775
681
  startBot(spaceId: string, url: string, bot: {
776
682
  readonly name: string;
777
683
  readonly role?: string;
778
684
  }): Promise<{
779
685
  readonly bot: string;
780
- readonly status: import('../session/hosting.js').HostStatus;
686
+ readonly status: HostStatus;
781
687
  }>;
782
688
  }
783
689
  /** A host a space pays for itself, as `hosting.space` sees it */
@@ -788,33 +694,30 @@ export interface SpaceHostingView {
788
694
  /** The host's key; null when it could not be reached */
789
695
  readonly host: string | null;
790
696
  /** How the space's subscription stands there, signed by the host; null when it could not be asked */
791
- readonly status: import('../session/hosting.js').HostStatus | null;
697
+ readonly status: HostStatus | null;
792
698
  /** Whether it keeps spaces for nothing: every subscription counts as paid there */
793
699
  readonly free: boolean;
794
- /** How the space's fund is added to there, by anyone in it; null on a free host, and on one that takes no communities */
795
- readonly fund: import('../session/hosting.js').FundOffer | null;
700
+ /** How the space's fund is added to there; null on a free host, or one that takes no communities */
701
+ readonly fund: FundOffer | null;
796
702
  /** Whether it sends reminders by email (`remindForSpace`) */
797
703
  readonly reminds: boolean;
798
704
  /** Whether it runs bots for the spaces it carries (`startBot`) */
799
705
  readonly runsBots: boolean;
800
- /** The bots it runs in this space, and whether each is running, as its signed status says */
801
- readonly bots: ReadonlyArray<import('../session/hosting.js').HostedBot>;
706
+ /** The bots it runs in this space, as its signed status says */
707
+ readonly bots: ReadonlyArray<HostedBot>;
802
708
  /** The services its bots can be connected to (spec 08 §3.1) */
803
- readonly connectors: ReadonlyArray<import('../session/hosting.js').HostConnectorOffer>;
709
+ readonly connectors: ReadonlyArray<HostConnectorOffer>;
804
710
  /** Why it could not be asked, when it couldn't */
805
711
  readonly error?: string;
806
712
  }
807
713
  export interface NodeAccount {
808
- /** The account's profile as its devices last set it. Null without an account key, or before any is set. */
714
+ /** The account's profile; null without an account key, or before one is set */
809
715
  profile(): Promise<AccountProfileView | null>;
810
- /** Renames the account on every device and app that opens it. Needs an account key. */
716
+ /** Renames the account everywhere. Needs an account key. */
811
717
  setName(name: string): Promise<AccountProfileView>;
812
718
  /**
813
- * Sets the account's picture on every device, and in every space it opens:
814
- * an image, already as small as it should be (the app resizes it). `null`
815
- * takes it away. `name` is the account's name as the app knows it, kept
816
- * with the picture when the registry has none yet (an app just connected,
817
- * before the registry has synced). Needs an account key.
719
+ * Sets the account's picture everywhere, already resized; `null` removes it.
720
+ * `name` is kept with it when the registry has no name yet. Needs an account key.
818
721
  */
819
722
  setAvatar(image: {
820
723
  bytes: Uint8Array;
@@ -827,27 +730,43 @@ export interface NodeAccount {
827
730
  bytes: Uint8Array;
828
731
  mime: string;
829
732
  } | null>;
830
- /** Revokes one of this account's keys, by DID, in the account registry. Needs an account key. `waitMs` as for a space's */
733
+ /** Revokes one of this account's keys in the account registry. Needs an account key. */
831
734
  revoke(key: string, options?: RevokeOptions): Promise<boolean>;
832
735
  }
833
736
  /** Someone in the account's contact list */
834
737
  export interface ContactView {
835
738
  /** Their account */
836
739
  readonly did: string;
837
- /** What you call them — yours to change; they never see it */
740
+ /** What you call them; they never see it */
838
741
  readonly name: string;
839
- /** The id of your space for two, where records wait and live messages reach them. Null when there is none. */
742
+ /** Your space for two with them, or null */
840
743
  readonly space: string | null;
841
744
  readonly note?: string;
842
745
  /** Their knocks are hidden, in every space and in your inbox */
843
746
  readonly blocked: boolean;
747
+ /** Their username, when you found them by it */
748
+ readonly username?: string;
844
749
  readonly updatedAt: string;
845
750
  }
751
+ /** An invite to a space a contact left for you in your space for two */
752
+ export interface SpaceInviteView {
753
+ /** Who left it */
754
+ readonly from: string;
755
+ /** The space it invites you to, and what it is called */
756
+ readonly space: string;
757
+ readonly name: string;
758
+ /** What `spaces.join` takes */
759
+ readonly invite: string;
760
+ /** The space for two it was left in, and its record there: what `join` takes */
761
+ readonly pairSpace: string;
762
+ readonly key: string;
763
+ readonly createdAt: string;
764
+ }
846
765
  /** A knock left for this account in a space both belong to, opened */
847
766
  export interface ContactRequest {
848
767
  /** The space it was left in */
849
768
  readonly space: string;
850
- /** Its record there — what `accept` takes */
769
+ /** Its record there: what `accept` takes */
851
770
  readonly key: string;
852
771
  /** The account asking */
853
772
  readonly from: string;
@@ -858,9 +777,9 @@ export interface ContactRequest {
858
777
  readonly pairSpace: string;
859
778
  readonly createdAt: string;
860
779
  }
861
- /** The account's contacts: each a private space for two, listed in the account's contacts space. Knowing a DID reaches nothing */
780
+ /** The account's contacts: each a private space for two, listed in the contacts space */
862
781
  export interface NodeContacts {
863
- /** The contacts space's id — null for a node not given it */
782
+ /** The contacts space's id, or null for a node not given it */
864
783
  space(): Promise<string | null>;
865
784
  /** Everyone in the list, blocked people too, by name */
866
785
  list(): Promise<ReadonlyArray<ContactView>>;
@@ -877,11 +796,8 @@ export interface NodeContacts {
877
796
  /** Leaves your space for two, and hides their knocks from now on */
878
797
  block(did: string): Promise<void>;
879
798
  /**
880
- * Asks someone in a space you share to add you: a space for two, and a
881
- * knock carrying its invite, sealed to their contact key and left there as
882
- * a `std.contact-request`. `carried` is whether a carrier held the space for two before
883
- * it went out (`spaces.carried`): when false, they can join only while one
884
- * of your devices is online.
799
+ * Asks someone in a shared space to add you: a space for two, its invite sealed
800
+ * to them as a `std.contact-request`. `carried`: whether a carrier held it first.
885
801
  */
886
802
  ask(spaceId: string, did: string, options?: {
887
803
  readonly note?: string;
@@ -890,12 +806,27 @@ export interface NodeContacts {
890
806
  readonly request: string;
891
807
  readonly carried: boolean;
892
808
  }>;
893
- /** Knocks left for this account in a space, opened — not from people blocked, and not ones already accepted */
809
+ /** Knocks left for this account in a space, except blocked and accepted ones */
894
810
  requests(spaceId: string): Promise<ReadonlyArray<ContactRequest>>;
895
811
  /** Joins the space for two a knock invites you to, and puts whoever asked on your list */
896
812
  accept(spaceId: string, requestKey: string): Promise<ContactView>;
897
- /** Accounts in your space for two besides the two of you: whoever the invite was passed on to */
813
+ /** Accounts in your space for two besides the two of you */
898
814
  others(did: string): Promise<ReadonlyArray<string>>;
815
+ /**
816
+ * Invites a contact into one of your spaces: an invite for `role` (as
817
+ * `spaces.invite` makes one), left in your space for two with them. Only a
818
+ * contact who has joined that space can be invited.
819
+ */
820
+ invite(did: string, spaceId: string, options?: {
821
+ readonly role?: string;
822
+ }): Promise<void>;
823
+ /**
824
+ * Invites your contacts left for you, to spaces you don't hold yet, newest
825
+ * first. Also closes invites of yours a contact has used, and deletes them.
826
+ */
827
+ invites(): Promise<ReadonlyArray<SpaceInviteView>>;
828
+ /** Joins the space an invite from a contact is for; its maker closes the invite once they see you there */
829
+ join(pairSpace: string, key: string): Promise<SpaceSummary>;
899
830
  }
900
831
  /** A direct message, opened (`node.direct`) */
901
832
  export interface DirectMessage {
@@ -905,7 +836,7 @@ export interface DirectMessage {
905
836
  readonly from: string;
906
837
  /** Who it is for, sorted, not counting `from` */
907
838
  readonly to: ReadonlyArray<string>;
908
- /** Null when this node can't open it: its member key here isn't the one it was sealed to */
839
+ /** Null when this node can't open it */
909
840
  readonly text: string | null;
910
841
  readonly createdAt: string;
911
842
  /** Written under a note that grants records only here, as `NodeRecord.recordsOnly` */
@@ -913,9 +844,9 @@ export interface DirectMessage {
913
844
  }
914
845
  /** Direct messages: text sealed to some members' member keys, in a private space (`docs/direct-messages.md`) */
915
846
  export interface NodeDirect {
916
- /** Who in the space can be written to: members who have published a member key, not you */
847
+ /** Members who published a member key, besides you */
917
848
  reachable(spaceId: string): Promise<ReadonlyArray<string>>;
918
- /** Seals text for these members and you, and writes it. Defines `std.direct` first when the space lacks it and you may. */
849
+ /** Seals text for these members and you, and writes it, defining `std.direct` when needed */
919
850
  send(spaceId: string, to: ReadonlyArray<string>, text: string): Promise<DirectMessage>;
920
851
  /** Every direct message in the space written by or to this account, oldest first */
921
852
  list(spaceId: string): Promise<ReadonlyArray<DirectMessage>>;
@@ -928,19 +859,22 @@ export interface InboxView {
928
859
  readonly name?: string;
929
860
  /** The inbox key's public half: knocks are sealed to it */
930
861
  readonly key: string;
931
- /** Its signing key's public half: it signs the code, and its hash is the mailbox topic */
862
+ /** Its signing key's public half, which signs the code */
932
863
  readonly sign: string;
933
864
  /** Mailboxes that hold its knocks */
934
865
  readonly places: ReadonlyArray<string>;
935
- /** The inbox code to hand out: put it in a link (`#inbox=…`) or a QR code */
866
+ /** The inbox code to hand out, in a link (`#inbox=…`) or a QR code */
936
867
  readonly code: string;
868
+ /** The username that leads to it, and when it lapses unless claimed again (ms) */
869
+ readonly username?: string;
870
+ readonly usernameUntil?: number;
937
871
  readonly updatedAt: string;
938
872
  }
939
873
  /** Someone knocking on your inbox, checked and opened */
940
874
  export interface KnockView {
941
875
  /** The knock's id, the same on every relay: what `accept` takes */
942
876
  readonly id: string;
943
- /** Their account — proven by their signature and note, not by what they say */
877
+ /** Their account, proven by signature and note */
944
878
  readonly from: string;
945
879
  /** The name they give; nothing vouches for it */
946
880
  readonly name: string;
@@ -956,25 +890,35 @@ export interface SentKnockView {
956
890
  readonly space: string;
957
891
  /** The name their inbox code gave */
958
892
  readonly name: string;
893
+ /** The username you knocked on, when it was one */
894
+ readonly username?: string;
959
895
  readonly at: string;
960
896
  }
961
- /** The inbox: how people you share no space with ask to become your contact, without your DID becoming an address (`spec/07-inbox.md`) */
897
+ /** The inbox: how people you share no space with ask to become your contact (`spec/07-inbox.md`) */
962
898
  export interface NodeInbox {
963
899
  /** Your inbox, or null until it is opened */
964
900
  get(): Promise<InboxView | null>;
965
- /** Opens your inbox, or changes where its knocks wait (1–3 mailboxes) and the name its code gives (default: the account's). Its code stays the same inbox. */
901
+ /** Opens your inbox, or changes its mailboxes (1–3) and the name its code gives */
966
902
  open(options?: {
967
903
  readonly places?: ReadonlyArray<string>;
968
904
  readonly name?: string;
969
905
  }): Promise<InboxView>;
970
- /** Replaces your inbox with a new one: codes for the old one lead nowhere, and nothing ties the two together */
906
+ /** Replaces your inbox: codes for the old one lead nowhere */
971
907
  rotate(): Promise<InboxView>;
972
- /** Clears every knock waiting in your inbox — one someone flooded — and keeps it open */
908
+ /** Clears every knock waiting in your inbox, and keeps it open */
973
909
  clear(): Promise<void>;
974
910
  /**
975
- * Knocks on someone's inbox (a code or a link): a space for two, its invite
976
- * left in their mailboxes until they join or two weeks pass. `carried` as
977
- * for `contacts.ask`.
911
+ * Claims a username (`leif@minca.social`) for your inbox on its domain's
912
+ * name service, opening the inbox first if need be. The name follows the
913
+ * inbox: replacing it, or changing its name or mailboxes, points the name at
914
+ * the new code, and it is renewed before it lapses.
915
+ */
916
+ claim(username: string): Promise<InboxView>;
917
+ /** Gives your username up: it leads nowhere, and anyone may claim it */
918
+ release(): Promise<InboxView>;
919
+ /**
920
+ * Knocks on someone's inbox, by its code, a link, or a username, with a
921
+ * space for two; `carried` as for `contacts.ask`
978
922
  */
979
923
  knock(code: string, options?: {
980
924
  readonly note?: string;
@@ -982,13 +926,13 @@ export interface NodeInbox {
982
926
  readonly space: string;
983
927
  readonly carried: boolean;
984
928
  }>;
985
- /** Knocks waiting in your inbox, checked; also turns knocks of yours that someone joined into contacts */
929
+ /** Knocks waiting in your inbox; also turns your knocks someone joined into contacts */
986
930
  knocks(): Promise<ReadonlyArray<KnockView>>;
987
931
  /** Knocks you left that nobody has joined yet */
988
932
  sent(): Promise<ReadonlyArray<SentKnockView>>;
989
933
  /** Joins the space for two a knock invites you to, and puts whoever knocked on your list */
990
934
  accept(id: string): Promise<ContactView>;
991
- /** Lets a knock go without blocking whoever knocked: cleared from the mailboxes, on every device */
935
+ /** Lets a knock go without blocking whoever knocked */
992
936
  dismiss(id: string): Promise<void>;
993
937
  }
994
938
  export interface P2PNode {
@@ -1015,13 +959,12 @@ export interface P2PNode {
1015
959
  readonly inbox: NodeInbox;
1016
960
  /** The delegation the session key currently writes under (root → session) */
1017
961
  delegation(): Delegation;
1018
- /** ICE servers for the app's own WebRTC, like a call's: the configured ones, and a relay's TURN servers */
962
+ /** ICE servers for the app's own WebRTC: the configured ones, and a relay's TURN servers */
1019
963
  iceServers(): Promise<ReadonlyArray<RTCIceServer>>;
1020
964
  /** Relays and connections, for showing why a peer is or is not there */
1021
965
  readonly network: NodeNetwork;
1022
966
  /**
1023
- * The same node acting as an agent: signed "via agent", only in the spaces
1024
- * its note names, refusing what needs a person (`node/api.ts`).
967
+ * The same node acting as an agent, only in the spaces its note names (`node/api.ts`).
1025
968
  * @throws When the note is not an agent's, has run out, or is not made out to `keys`
1026
969
  */
1027
970
  asAgent(agent: {
@@ -1030,19 +973,13 @@ export interface P2PNode {
1030
973
  }): Promise<P2PNode>;
1031
974
  subscribe(listener: (event: NodeEvent) => void): () => void;
1032
975
  /**
1033
- * Revokes a key of this account, each revoke with a cutoff at what the key
1034
- * wrote: in `spaces`, or by default everywhere the account writes — every
1035
- * space it lists, its carry spaces, its contacts space and its registry.
1036
- * True once a peer has taken each in, or at once without `waitMs`.
976
+ * Revokes a key of this account in `spaces`, or everywhere the account writes.
977
+ * True once a peer took each in, or at once without `waitMs`.
1037
978
  */
1038
979
  revokeKey(key: string, options?: RevokeOptions & {
1039
980
  readonly spaces?: ReadonlyArray<string>;
1040
981
  }): Promise<boolean>;
1041
- /**
1042
- * Revokes this node's own session key everywhere (`revokeKey`); a lasting
1043
- * key is forgotten at once, so the next session signs with a new one. For
1044
- * signing out.
1045
- */
982
+ /** Revokes this node's own key everywhere and forgets a lasting one: for signing out */
1046
983
  revokeSelf(options?: RevokeOptions): Promise<void>;
1047
984
  close(): Promise<void>;
1048
985
  }