@minca/core 0.1.15 → 0.1.16

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