@minca/core 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (668) hide show
  1. package/README.md +243 -2
  2. package/dist/calls/calls.d.ts +140 -0
  3. package/dist/calls/calls.d.ts.map +1 -0
  4. package/dist/calls/calls.js +861 -0
  5. package/dist/calls/calls.js.map +1 -0
  6. package/dist/calls/index.d.ts +4 -0
  7. package/dist/calls/index.d.ts.map +1 -0
  8. package/dist/calls/index.js +3 -0
  9. package/dist/calls/index.js.map +1 -0
  10. package/dist/doors/doors.d.ts +140 -0
  11. package/dist/doors/doors.d.ts.map +1 -0
  12. package/dist/doors/doors.js +226 -0
  13. package/dist/doors/doors.js.map +1 -0
  14. package/dist/doors/index.d.ts +9 -0
  15. package/dist/doors/index.d.ts.map +1 -0
  16. package/dist/doors/index.js +7 -0
  17. package/dist/doors/index.js.map +1 -0
  18. package/dist/elements/auth-styles.d.ts +18 -0
  19. package/dist/elements/auth-styles.d.ts.map +1 -0
  20. package/dist/elements/auth-styles.js +172 -0
  21. package/dist/elements/auth-styles.js.map +1 -0
  22. package/dist/elements/dom.d.ts +29 -0
  23. package/dist/elements/dom.d.ts.map +1 -0
  24. package/dist/elements/dom.js +91 -0
  25. package/dist/elements/dom.js.map +1 -0
  26. package/dist/elements/index.d.ts +13 -0
  27. package/dist/elements/index.d.ts.map +1 -0
  28. package/dist/elements/index.js +11 -0
  29. package/dist/elements/index.js.map +1 -0
  30. package/dist/elements/minca-auth.d.ts +48 -0
  31. package/dist/elements/minca-auth.d.ts.map +1 -0
  32. package/dist/elements/minca-auth.js +605 -0
  33. package/dist/elements/minca-auth.js.map +1 -0
  34. package/dist/identity/abilities.d.ts +57 -0
  35. package/dist/identity/abilities.d.ts.map +1 -0
  36. package/dist/identity/abilities.js +144 -0
  37. package/dist/identity/abilities.js.map +1 -0
  38. package/dist/identity/account-store.d.ts +83 -0
  39. package/dist/identity/account-store.d.ts.map +1 -0
  40. package/dist/identity/account-store.js +234 -0
  41. package/dist/identity/account-store.js.map +1 -0
  42. package/dist/identity/account-vault.d.ts +152 -0
  43. package/dist/identity/account-vault.d.ts.map +1 -0
  44. package/dist/identity/account-vault.js +201 -0
  45. package/dist/identity/account-vault.js.map +1 -0
  46. package/dist/identity/channel.d.ts +70 -0
  47. package/dist/identity/channel.d.ts.map +1 -0
  48. package/dist/identity/channel.js +111 -0
  49. package/dist/identity/channel.js.map +1 -0
  50. package/dist/identity/contact-key.d.ts +55 -0
  51. package/dist/identity/contact-key.d.ts.map +1 -0
  52. package/dist/identity/contact-key.js +130 -0
  53. package/dist/identity/contact-key.js.map +1 -0
  54. package/dist/identity/crypto-p256.d.ts +4 -0
  55. package/dist/identity/crypto-p256.d.ts.map +1 -0
  56. package/dist/identity/crypto-p256.js +89 -0
  57. package/dist/identity/crypto-p256.js.map +1 -0
  58. package/dist/identity/device-key.d.ts +26 -0
  59. package/dist/identity/device-key.d.ts.map +1 -0
  60. package/dist/identity/device-key.js +48 -0
  61. package/dist/identity/device-key.js.map +1 -0
  62. package/dist/identity/did.d.ts +16 -0
  63. package/dist/identity/did.d.ts.map +1 -0
  64. package/dist/identity/did.js +33 -0
  65. package/dist/identity/did.js.map +1 -0
  66. package/dist/identity/envelope.d.ts +26 -0
  67. package/dist/identity/envelope.d.ts.map +1 -0
  68. package/dist/identity/envelope.js +77 -0
  69. package/dist/identity/envelope.js.map +1 -0
  70. package/dist/identity/hkdf.d.ts +5 -0
  71. package/dist/identity/hkdf.d.ts.map +1 -0
  72. package/dist/identity/hkdf.js +22 -0
  73. package/dist/identity/hkdf.js.map +1 -0
  74. package/dist/identity/hpke.d.ts +73 -0
  75. package/dist/identity/hpke.d.ts.map +1 -0
  76. package/dist/identity/hpke.js +197 -0
  77. package/dist/identity/hpke.js.map +1 -0
  78. package/dist/identity/idb.d.ts +19 -0
  79. package/dist/identity/idb.d.ts.map +1 -0
  80. package/dist/identity/idb.js +56 -0
  81. package/dist/identity/idb.js.map +1 -0
  82. package/dist/identity/identity-manager.d.ts +24 -0
  83. package/dist/identity/identity-manager.d.ts.map +1 -0
  84. package/dist/identity/identity-manager.js +34 -0
  85. package/dist/identity/identity-manager.js.map +1 -0
  86. package/dist/identity/pairing.d.ts +35 -0
  87. package/dist/identity/pairing.d.ts.map +1 -0
  88. package/dist/identity/pairing.js +60 -0
  89. package/dist/identity/pairing.js.map +1 -0
  90. package/dist/identity/policy.d.ts +57 -0
  91. package/dist/identity/policy.d.ts.map +1 -0
  92. package/dist/identity/policy.js +436 -0
  93. package/dist/identity/policy.js.map +1 -0
  94. package/dist/identity/recovery-code.d.ts +29 -0
  95. package/dist/identity/recovery-code.d.ts.map +1 -0
  96. package/dist/identity/recovery-code.js +95 -0
  97. package/dist/identity/recovery-code.js.map +1 -0
  98. package/dist/identity/root-signer.d.ts +45 -0
  99. package/dist/identity/root-signer.d.ts.map +1 -0
  100. package/dist/identity/root-signer.js +30 -0
  101. package/dist/identity/root-signer.js.map +1 -0
  102. package/dist/identity/ucan.d.ts +143 -0
  103. package/dist/identity/ucan.d.ts.map +1 -0
  104. package/dist/identity/ucan.js +245 -0
  105. package/dist/identity/ucan.js.map +1 -0
  106. package/dist/identity/webauthn.d.ts +50 -0
  107. package/dist/identity/webauthn.d.ts.map +1 -0
  108. package/dist/identity/webauthn.js +107 -0
  109. package/dist/identity/webauthn.js.map +1 -0
  110. package/dist/index.d.ts +145 -0
  111. package/dist/index.d.ts.map +1 -0
  112. package/dist/index.js +106 -0
  113. package/dist/index.js.map +1 -0
  114. package/dist/network/introductions.d.ts +41 -0
  115. package/dist/network/introductions.d.ts.map +1 -0
  116. package/dist/network/introductions.js +57 -0
  117. package/dist/network/introductions.js.map +1 -0
  118. package/dist/network/local-transport.d.ts +21 -0
  119. package/dist/network/local-transport.d.ts.map +1 -0
  120. package/dist/network/local-transport.js +55 -0
  121. package/dist/network/local-transport.js.map +1 -0
  122. package/dist/network/mailbox.d.ts +45 -0
  123. package/dist/network/mailbox.d.ts.map +1 -0
  124. package/dist/network/mailbox.js +135 -0
  125. package/dist/network/mailbox.js.map +1 -0
  126. package/dist/network/mesh.d.ts +74 -0
  127. package/dist/network/mesh.d.ts.map +1 -0
  128. package/dist/network/mesh.js +499 -0
  129. package/dist/network/mesh.js.map +1 -0
  130. package/dist/network/multi-signaling.d.ts +41 -0
  131. package/dist/network/multi-signaling.d.ts.map +1 -0
  132. package/dist/network/multi-signaling.js +209 -0
  133. package/dist/network/multi-signaling.js.map +1 -0
  134. package/dist/network/network-manager.d.ts +34 -0
  135. package/dist/network/network-manager.d.ts.map +1 -0
  136. package/dist/network/network-manager.js +66 -0
  137. package/dist/network/network-manager.js.map +1 -0
  138. package/dist/network/peer-auth.d.ts +112 -0
  139. package/dist/network/peer-auth.d.ts.map +1 -0
  140. package/dist/network/peer-auth.js +164 -0
  141. package/dist/network/peer-auth.js.map +1 -0
  142. package/dist/network/remote-transport.d.ts +45 -0
  143. package/dist/network/remote-transport.d.ts.map +1 -0
  144. package/dist/network/remote-transport.js +263 -0
  145. package/dist/network/remote-transport.js.map +1 -0
  146. package/dist/network/rtc-transport.d.ts +10 -0
  147. package/dist/network/rtc-transport.d.ts.map +1 -0
  148. package/dist/network/rtc-transport.js +107 -0
  149. package/dist/network/rtc-transport.js.map +1 -0
  150. package/dist/network/signaling.d.ts +95 -0
  151. package/dist/network/signaling.d.ts.map +1 -0
  152. package/dist/network/signaling.js +264 -0
  153. package/dist/network/signaling.js.map +1 -0
  154. package/dist/network/transport.d.ts +50 -0
  155. package/dist/network/transport.d.ts.map +1 -0
  156. package/dist/network/transport.js +13 -0
  157. package/dist/network/transport.js.map +1 -0
  158. package/dist/network/ws-transport.d.ts +49 -0
  159. package/dist/network/ws-transport.d.ts.map +1 -0
  160. package/dist/network/ws-transport.js +227 -0
  161. package/dist/network/ws-transport.js.map +1 -0
  162. package/dist/node/actions.d.ts +80 -0
  163. package/dist/node/actions.d.ts.map +1 -0
  164. package/dist/node/actions.js +828 -0
  165. package/dist/node/actions.js.map +1 -0
  166. package/dist/node/api.d.ts +133 -0
  167. package/dist/node/api.d.ts.map +1 -0
  168. package/dist/node/api.js +126 -0
  169. package/dist/node/api.js.map +1 -0
  170. package/dist/node/carrier.d.ts +210 -0
  171. package/dist/node/carrier.d.ts.map +1 -0
  172. package/dist/node/carrier.js +361 -0
  173. package/dist/node/carrier.js.map +1 -0
  174. package/dist/node/copy.d.ts +38 -0
  175. package/dist/node/copy.d.ts.map +1 -0
  176. package/dist/node/copy.js +63 -0
  177. package/dist/node/copy.js.map +1 -0
  178. package/dist/node/host.d.ts +146 -0
  179. package/dist/node/host.d.ts.map +1 -0
  180. package/dist/node/host.js +267 -0
  181. package/dist/node/host.js.map +1 -0
  182. package/dist/node/index.d.ts +27 -0
  183. package/dist/node/index.d.ts.map +1 -0
  184. package/dist/node/index.js +16 -0
  185. package/dist/node/index.js.map +1 -0
  186. package/dist/node/node.d.ts +6 -0
  187. package/dist/node/node.d.ts.map +1 -0
  188. package/dist/node/node.js +2212 -0
  189. package/dist/node/node.js.map +1 -0
  190. package/dist/node/remote.d.ts +25 -0
  191. package/dist/node/remote.d.ts.map +1 -0
  192. package/dist/node/remote.js +466 -0
  193. package/dist/node/remote.js.map +1 -0
  194. package/dist/node/space-runtime.d.ts +216 -0
  195. package/dist/node/space-runtime.d.ts.map +1 -0
  196. package/dist/node/space-runtime.js +4024 -0
  197. package/dist/node/space-runtime.js.map +1 -0
  198. package/dist/node/stores.d.ts +69 -0
  199. package/dist/node/stores.d.ts.map +1 -0
  200. package/dist/node/stores.js +55 -0
  201. package/dist/node/stores.js.map +1 -0
  202. package/dist/node/types.d.ts +931 -0
  203. package/dist/node/types.d.ts.map +1 -0
  204. package/dist/node/types.js +2 -0
  205. package/dist/node/types.js.map +1 -0
  206. package/dist/node/watch-notifications.d.ts +19 -0
  207. package/dist/node/watch-notifications.d.ts.map +1 -0
  208. package/dist/node/watch-notifications.js +125 -0
  209. package/dist/node/watch-notifications.js.map +1 -0
  210. package/dist/node/worker.d.ts +84 -0
  211. package/dist/node/worker.d.ts.map +1 -0
  212. package/dist/node/worker.js +293 -0
  213. package/dist/node/worker.js.map +1 -0
  214. package/dist/node/writer-keys.d.ts +38 -0
  215. package/dist/node/writer-keys.d.ts.map +1 -0
  216. package/dist/node/writer-keys.js +101 -0
  217. package/dist/node/writer-keys.js.map +1 -0
  218. package/dist/node/writers.d.ts +40 -0
  219. package/dist/node/writers.d.ts.map +1 -0
  220. package/dist/node/writers.js +90 -0
  221. package/dist/node/writers.js.map +1 -0
  222. package/dist/node-worker.d.ts +2 -0
  223. package/dist/node-worker.d.ts.map +1 -0
  224. package/dist/node-worker.js +16 -0
  225. package/dist/node-worker.js.map +1 -0
  226. package/dist/privacy/direct.d.ts +44 -0
  227. package/dist/privacy/direct.d.ts.map +1 -0
  228. package/dist/privacy/direct.js +96 -0
  229. package/dist/privacy/direct.js.map +1 -0
  230. package/dist/privacy/space-encryption.d.ts +50 -0
  231. package/dist/privacy/space-encryption.d.ts.map +1 -0
  232. package/dist/privacy/space-encryption.js +85 -0
  233. package/dist/privacy/space-encryption.js.map +1 -0
  234. package/dist/query/computed.d.ts +94 -0
  235. package/dist/query/computed.d.ts.map +1 -0
  236. package/dist/query/computed.js +334 -0
  237. package/dist/query/computed.js.map +1 -0
  238. package/dist/query/engine.d.ts +29 -0
  239. package/dist/query/engine.d.ts.map +1 -0
  240. package/dist/query/engine.js +122 -0
  241. package/dist/query/engine.js.map +1 -0
  242. package/dist/query/filter.d.ts +40 -0
  243. package/dist/query/filter.d.ts.map +1 -0
  244. package/dist/query/filter.js +264 -0
  245. package/dist/query/filter.js.map +1 -0
  246. package/dist/query/types.d.ts +225 -0
  247. package/dist/query/types.d.ts.map +1 -0
  248. package/dist/query/types.js +38 -0
  249. package/dist/query/types.js.map +1 -0
  250. package/dist/react/context.d.ts +81 -0
  251. package/dist/react/context.d.ts.map +1 -0
  252. package/dist/react/context.js +97 -0
  253. package/dist/react/context.js.map +1 -0
  254. package/dist/react/follow.d.ts +11 -0
  255. package/dist/react/follow.d.ts.map +1 -0
  256. package/dist/react/follow.js +7 -0
  257. package/dist/react/follow.js.map +1 -0
  258. package/dist/react/index.d.ts +44 -0
  259. package/dist/react/index.d.ts.map +1 -0
  260. package/dist/react/index.js +40 -0
  261. package/dist/react/index.js.map +1 -0
  262. package/dist/react/minca-auth.d.ts +17 -0
  263. package/dist/react/minca-auth.d.ts.map +1 -0
  264. package/dist/react/minca-auth.js +34 -0
  265. package/dist/react/minca-auth.js.map +1 -0
  266. package/dist/react/use-calls.d.ts +21 -0
  267. package/dist/react/use-calls.d.ts.map +1 -0
  268. package/dist/react/use-calls.js +39 -0
  269. package/dist/react/use-calls.js.map +1 -0
  270. package/dist/react/use-invite-link.d.ts +24 -0
  271. package/dist/react/use-invite-link.d.ts.map +1 -0
  272. package/dist/react/use-invite-link.js +55 -0
  273. package/dist/react/use-invite-link.js.map +1 -0
  274. package/dist/react/use-live.d.ts +16 -0
  275. package/dist/react/use-live.d.ts.map +1 -0
  276. package/dist/react/use-live.js +56 -0
  277. package/dist/react/use-live.js.map +1 -0
  278. package/dist/react/use-my-name.d.ts +12 -0
  279. package/dist/react/use-my-name.d.ts.map +1 -0
  280. package/dist/react/use-my-name.js +38 -0
  281. package/dist/react/use-my-name.js.map +1 -0
  282. package/dist/react/use-names.d.ts +7 -0
  283. package/dist/react/use-names.d.ts.map +1 -0
  284. package/dist/react/use-names.js +13 -0
  285. package/dist/react/use-names.js.map +1 -0
  286. package/dist/react/use-network.d.ts +9 -0
  287. package/dist/react/use-network.d.ts.map +1 -0
  288. package/dist/react/use-network.js +33 -0
  289. package/dist/react/use-network.js.map +1 -0
  290. package/dist/react/use-query.d.ts +14 -0
  291. package/dist/react/use-query.d.ts.map +1 -0
  292. package/dist/react/use-query.js +26 -0
  293. package/dist/react/use-query.js.map +1 -0
  294. package/dist/react/use-space.d.ts +29 -0
  295. package/dist/react/use-space.d.ts.map +1 -0
  296. package/dist/react/use-space.js +57 -0
  297. package/dist/react/use-space.js.map +1 -0
  298. package/dist/react/use-spaces.d.ts +29 -0
  299. package/dist/react/use-spaces.d.ts.map +1 -0
  300. package/dist/react/use-spaces.js +78 -0
  301. package/dist/react/use-spaces.js.map +1 -0
  302. package/dist/records/cel-types.d.ts +50 -0
  303. package/dist/records/cel-types.d.ts.map +1 -0
  304. package/dist/records/cel-types.js +433 -0
  305. package/dist/records/cel-types.js.map +1 -0
  306. package/dist/records/cel.d.ts +129 -0
  307. package/dist/records/cel.d.ts.map +1 -0
  308. package/dist/records/cel.js +1492 -0
  309. package/dist/records/cel.js.map +1 -0
  310. package/dist/records/contract-builder.d.ts +323 -0
  311. package/dist/records/contract-builder.d.ts.map +1 -0
  312. package/dist/records/contract-builder.js +388 -0
  313. package/dist/records/contract-builder.js.map +1 -0
  314. package/dist/records/contracts.d.ts +119 -0
  315. package/dist/records/contracts.d.ts.map +1 -0
  316. package/dist/records/contracts.js +299 -0
  317. package/dist/records/contracts.js.map +1 -0
  318. package/dist/records/describe.d.ts +39 -0
  319. package/dist/records/describe.d.ts.map +1 -0
  320. package/dist/records/describe.js +91 -0
  321. package/dist/records/describe.js.map +1 -0
  322. package/dist/records/fork.d.ts +43 -0
  323. package/dist/records/fork.d.ts.map +1 -0
  324. package/dist/records/fork.js +80 -0
  325. package/dist/records/fork.js.map +1 -0
  326. package/dist/records/key.d.ts +29 -0
  327. package/dist/records/key.d.ts.map +1 -0
  328. package/dist/records/key.js +75 -0
  329. package/dist/records/key.js.map +1 -0
  330. package/dist/records/links.d.ts +14 -0
  331. package/dist/records/links.d.ts.map +1 -0
  332. package/dist/records/links.js +42 -0
  333. package/dist/records/links.js.map +1 -0
  334. package/dist/records/rules.d.ts +44 -0
  335. package/dist/records/rules.d.ts.map +1 -0
  336. package/dist/records/rules.js +102 -0
  337. package/dist/records/rules.js.map +1 -0
  338. package/dist/records/topics.d.ts +22 -0
  339. package/dist/records/topics.d.ts.map +1 -0
  340. package/dist/records/topics.js +100 -0
  341. package/dist/records/topics.js.map +1 -0
  342. package/dist/records/version.d.ts +58 -0
  343. package/dist/records/version.d.ts.map +1 -0
  344. package/dist/records/version.js +121 -0
  345. package/dist/records/version.js.map +1 -0
  346. package/dist/records/warrant.d.ts +34 -0
  347. package/dist/records/warrant.d.ts.map +1 -0
  348. package/dist/records/warrant.js +40 -0
  349. package/dist/records/warrant.js.map +1 -0
  350. package/dist/schema/collection-def.d.ts +140 -0
  351. package/dist/schema/collection-def.d.ts.map +1 -0
  352. package/dist/schema/collection-def.js +304 -0
  353. package/dist/schema/collection-def.js.map +1 -0
  354. package/dist/schema/quick-add.d.ts +16 -0
  355. package/dist/schema/quick-add.d.ts.map +1 -0
  356. package/dist/schema/quick-add.js +75 -0
  357. package/dist/schema/quick-add.js.map +1 -0
  358. package/dist/schema/schema-engine.d.ts +13 -0
  359. package/dist/schema/schema-engine.d.ts.map +1 -0
  360. package/dist/schema/schema-engine.js +15 -0
  361. package/dist/schema/schema-engine.js.map +1 -0
  362. package/dist/schema/signer.d.ts +12 -0
  363. package/dist/schema/signer.d.ts.map +1 -0
  364. package/dist/schema/signer.js +27 -0
  365. package/dist/schema/signer.js.map +1 -0
  366. package/dist/schema/version.d.ts +70 -0
  367. package/dist/schema/version.d.ts.map +1 -0
  368. package/dist/schema/version.js +100 -0
  369. package/dist/schema/version.js.map +1 -0
  370. package/dist/schemas/automations.d.ts +385 -0
  371. package/dist/schemas/automations.d.ts.map +1 -0
  372. package/dist/schemas/automations.js +581 -0
  373. package/dist/schemas/automations.js.map +1 -0
  374. package/dist/schemas/blueprints.d.ts +89 -0
  375. package/dist/schemas/blueprints.d.ts.map +1 -0
  376. package/dist/schemas/blueprints.js +273 -0
  377. package/dist/schemas/blueprints.js.map +1 -0
  378. package/dist/schemas/contacts.d.ts +206 -0
  379. package/dist/schemas/contacts.d.ts.map +1 -0
  380. package/dist/schemas/contacts.js +139 -0
  381. package/dist/schemas/contacts.js.map +1 -0
  382. package/dist/schemas/cron.d.ts +14 -0
  383. package/dist/schemas/cron.d.ts.map +1 -0
  384. package/dist/schemas/cron.js +76 -0
  385. package/dist/schemas/cron.js.map +1 -0
  386. package/dist/schemas/fragments.d.ts +418 -0
  387. package/dist/schemas/fragments.d.ts.map +1 -0
  388. package/dist/schemas/fragments.js +119 -0
  389. package/dist/schemas/fragments.js.map +1 -0
  390. package/dist/schemas/geo.d.ts +63 -0
  391. package/dist/schemas/geo.d.ts.map +1 -0
  392. package/dist/schemas/geo.js +131 -0
  393. package/dist/schemas/geo.js.map +1 -0
  394. package/dist/schemas/guides.d.ts +24 -0
  395. package/dist/schemas/guides.d.ts.map +1 -0
  396. package/dist/schemas/guides.js +32 -0
  397. package/dist/schemas/guides.js.map +1 -0
  398. package/dist/schemas/index.d.ts +77 -0
  399. package/dist/schemas/index.d.ts.map +1 -0
  400. package/dist/schemas/index.js +65 -0
  401. package/dist/schemas/index.js.map +1 -0
  402. package/dist/schemas/library/annotations.d.ts +830 -0
  403. package/dist/schemas/library/annotations.d.ts.map +1 -0
  404. package/dist/schemas/library/annotations.js +211 -0
  405. package/dist/schemas/library/annotations.js.map +1 -0
  406. package/dist/schemas/library/collections.d.ts +211 -0
  407. package/dist/schemas/library/collections.d.ts.map +1 -0
  408. package/dist/schemas/library/collections.js +57 -0
  409. package/dist/schemas/library/collections.js.map +1 -0
  410. package/dist/schemas/library/community.d.ts +1092 -0
  411. package/dist/schemas/library/community.d.ts.map +1 -0
  412. package/dist/schemas/library/community.js +315 -0
  413. package/dist/schemas/library/community.js.map +1 -0
  414. package/dist/schemas/library/life.d.ts +1308 -0
  415. package/dist/schemas/library/life.d.ts.map +1 -0
  416. package/dist/schemas/library/life.js +202 -0
  417. package/dist/schemas/library/life.js.map +1 -0
  418. package/dist/schemas/library/media.d.ts +1215 -0
  419. package/dist/schemas/library/media.d.ts.map +1 -0
  420. package/dist/schemas/library/media.js +146 -0
  421. package/dist/schemas/library/media.js.map +1 -0
  422. package/dist/schemas/library/money.d.ts +1125 -0
  423. package/dist/schemas/library/money.d.ts.map +1 -0
  424. package/dist/schemas/library/money.js +168 -0
  425. package/dist/schemas/library/money.js.map +1 -0
  426. package/dist/schemas/library/planning.d.ts +1115 -0
  427. package/dist/schemas/library/planning.d.ts.map +1 -0
  428. package/dist/schemas/library/planning.js +230 -0
  429. package/dist/schemas/library/planning.js.map +1 -0
  430. package/dist/schemas/library/publishing.d.ts +1327 -0
  431. package/dist/schemas/library/publishing.d.ts.map +1 -0
  432. package/dist/schemas/library/publishing.js +285 -0
  433. package/dist/schemas/library/publishing.js.map +1 -0
  434. package/dist/schemas/library/social.d.ts +883 -0
  435. package/dist/schemas/library/social.d.ts.map +1 -0
  436. package/dist/schemas/library/social.js +120 -0
  437. package/dist/schemas/library/social.js.map +1 -0
  438. package/dist/schemas/standard.d.ts +21 -0
  439. package/dist/schemas/standard.d.ts.map +1 -0
  440. package/dist/schemas/standard.js +37 -0
  441. package/dist/schemas/standard.js.map +1 -0
  442. package/dist/session/auth.d.ts +306 -0
  443. package/dist/session/auth.d.ts.map +1 -0
  444. package/dist/session/auth.js +1110 -0
  445. package/dist/session/auth.js.map +1 -0
  446. package/dist/session/channel-room.d.ts +26 -0
  447. package/dist/session/channel-room.d.ts.map +1 -0
  448. package/dist/session/channel-room.js +55 -0
  449. package/dist/session/channel-room.js.map +1 -0
  450. package/dist/session/connect-code.d.ts +113 -0
  451. package/dist/session/connect-code.d.ts.map +1 -0
  452. package/dist/session/connect-code.js +308 -0
  453. package/dist/session/connect-code.js.map +1 -0
  454. package/dist/session/connect.d.ts +343 -0
  455. package/dist/session/connect.d.ts.map +1 -0
  456. package/dist/session/connect.js +525 -0
  457. package/dist/session/connect.js.map +1 -0
  458. package/dist/session/connection.d.ts +84 -0
  459. package/dist/session/connection.d.ts.map +1 -0
  460. package/dist/session/connection.js +135 -0
  461. package/dist/session/connection.js.map +1 -0
  462. package/dist/session/credentials.d.ts +48 -0
  463. package/dist/session/credentials.d.ts.map +1 -0
  464. package/dist/session/credentials.js +81 -0
  465. package/dist/session/credentials.js.map +1 -0
  466. package/dist/session/hosting.d.ts +275 -0
  467. package/dist/session/hosting.d.ts.map +1 -0
  468. package/dist/session/hosting.js +291 -0
  469. package/dist/session/hosting.js.map +1 -0
  470. package/dist/session/index.d.ts +27 -0
  471. package/dist/session/index.d.ts.map +1 -0
  472. package/dist/session/index.js +19 -0
  473. package/dist/session/index.js.map +1 -0
  474. package/dist/session/pairing.d.ts +87 -0
  475. package/dist/session/pairing.d.ts.map +1 -0
  476. package/dist/session/pairing.js +239 -0
  477. package/dist/session/pairing.js.map +1 -0
  478. package/dist/session/password-strength.d.ts +22 -0
  479. package/dist/session/password-strength.d.ts.map +1 -0
  480. package/dist/session/password-strength.js +130 -0
  481. package/dist/session/password-strength.js.map +1 -0
  482. package/dist/session/places.d.ts +64 -0
  483. package/dist/session/places.d.ts.map +1 -0
  484. package/dist/session/places.js +107 -0
  485. package/dist/session/places.js.map +1 -0
  486. package/dist/session/stay-signed-in.d.ts +47 -0
  487. package/dist/session/stay-signed-in.d.ts.map +1 -0
  488. package/dist/session/stay-signed-in.js +139 -0
  489. package/dist/session/stay-signed-in.js.map +1 -0
  490. package/dist/space/account-registry.d.ts +68 -0
  491. package/dist/space/account-registry.d.ts.map +1 -0
  492. package/dist/space/account-registry.js +63 -0
  493. package/dist/space/account-registry.js.map +1 -0
  494. package/dist/space/constitution.d.ts +49 -0
  495. package/dist/space/constitution.d.ts.map +1 -0
  496. package/dist/space/constitution.js +205 -0
  497. package/dist/space/constitution.js.map +1 -0
  498. package/dist/space/grants.d.ts +66 -0
  499. package/dist/space/grants.d.ts.map +1 -0
  500. package/dist/space/grants.js +192 -0
  501. package/dist/space/grants.js.map +1 -0
  502. package/dist/space/index.d.ts +3 -0
  503. package/dist/space/index.d.ts.map +1 -0
  504. package/dist/space/index.js +3 -0
  505. package/dist/space/index.js.map +1 -0
  506. package/dist/space/names.d.ts +17 -0
  507. package/dist/space/names.d.ts.map +1 -0
  508. package/dist/space/names.js +23 -0
  509. package/dist/space/names.js.map +1 -0
  510. package/dist/space/own-automations.d.ts +200 -0
  511. package/dist/space/own-automations.d.ts.map +1 -0
  512. package/dist/space/own-automations.js +386 -0
  513. package/dist/space/own-automations.js.map +1 -0
  514. package/dist/space/pass.d.ts +67 -0
  515. package/dist/space/pass.d.ts.map +1 -0
  516. package/dist/space/pass.js +61 -0
  517. package/dist/space/pass.js.map +1 -0
  518. package/dist/space/presets.d.ts +63 -0
  519. package/dist/space/presets.d.ts.map +1 -0
  520. package/dist/space/presets.js +139 -0
  521. package/dist/space/presets.js.map +1 -0
  522. package/dist/space/roles.d.ts +436 -0
  523. package/dist/space/roles.d.ts.map +1 -0
  524. package/dist/space/roles.js +1460 -0
  525. package/dist/space/roles.js.map +1 -0
  526. package/dist/space/space-access.d.ts +96 -0
  527. package/dist/space/space-access.d.ts.map +1 -0
  528. package/dist/space/space-access.js +115 -0
  529. package/dist/space/space-access.js.map +1 -0
  530. package/dist/space/space-manager.d.ts +130 -0
  531. package/dist/space/space-manager.d.ts.map +1 -0
  532. package/dist/space/space-manager.js +299 -0
  533. package/dist/space/space-manager.js.map +1 -0
  534. package/dist/storage/blob/memory.d.ts +6 -0
  535. package/dist/storage/blob/memory.d.ts.map +1 -0
  536. package/dist/storage/blob/memory.js +20 -0
  537. package/dist/storage/blob/memory.js.map +1 -0
  538. package/dist/storage/blob/s3.d.ts +16 -0
  539. package/dist/storage/blob/s3.d.ts.map +1 -0
  540. package/dist/storage/blob/s3.js +89 -0
  541. package/dist/storage/blob/s3.js.map +1 -0
  542. package/dist/storage/blob-store.d.ts +25 -0
  543. package/dist/storage/blob-store.d.ts.map +1 -0
  544. package/dist/storage/blob-store.js +2 -0
  545. package/dist/storage/blob-store.js.map +1 -0
  546. package/dist/storage/directory-access.d.ts +60 -0
  547. package/dist/storage/directory-access.d.ts.map +1 -0
  548. package/dist/storage/directory-access.js +114 -0
  549. package/dist/storage/directory-access.js.map +1 -0
  550. package/dist/storage/encrypted-adapter.d.ts +50 -0
  551. package/dist/storage/encrypted-adapter.d.ts.map +1 -0
  552. package/dist/storage/encrypted-adapter.js +94 -0
  553. package/dist/storage/encrypted-adapter.js.map +1 -0
  554. package/dist/storage/folder-adapter.d.ts +86 -0
  555. package/dist/storage/folder-adapter.d.ts.map +1 -0
  556. package/dist/storage/folder-adapter.js +232 -0
  557. package/dist/storage/folder-adapter.js.map +1 -0
  558. package/dist/storage/folder-reconcile.d.ts +47 -0
  559. package/dist/storage/folder-reconcile.d.ts.map +1 -0
  560. package/dist/storage/folder-reconcile.js +67 -0
  561. package/dist/storage/folder-reconcile.js.map +1 -0
  562. package/dist/storage/index.d.ts +6 -0
  563. package/dist/storage/index.d.ts.map +1 -0
  564. package/dist/storage/index.js +5 -0
  565. package/dist/storage/index.js.map +1 -0
  566. package/dist/storage/indexeddb-adapter.d.ts +12 -0
  567. package/dist/storage/indexeddb-adapter.d.ts.map +1 -0
  568. package/dist/storage/indexeddb-adapter.js +157 -0
  569. package/dist/storage/indexeddb-adapter.js.map +1 -0
  570. package/dist/storage/mirror.d.ts +67 -0
  571. package/dist/storage/mirror.d.ts.map +1 -0
  572. package/dist/storage/mirror.js +168 -0
  573. package/dist/storage/mirror.js.map +1 -0
  574. package/dist/storage/segment.d.ts +19 -0
  575. package/dist/storage/segment.d.ts.map +1 -0
  576. package/dist/storage/segment.js +34 -0
  577. package/dist/storage/segment.js.map +1 -0
  578. package/dist/storage/storage-provider.d.ts +79 -0
  579. package/dist/storage/storage-provider.d.ts.map +1 -0
  580. package/dist/storage/storage-provider.js +475 -0
  581. package/dist/storage/storage-provider.js.map +1 -0
  582. package/dist/sync/negentropy.d.ts +61 -0
  583. package/dist/sync/negentropy.d.ts.map +1 -0
  584. package/dist/sync/negentropy.js +382 -0
  585. package/dist/sync/negentropy.js.map +1 -0
  586. package/dist/sync/sync-engine.d.ts +105 -0
  587. package/dist/sync/sync-engine.d.ts.map +1 -0
  588. package/dist/sync/sync-engine.js +575 -0
  589. package/dist/sync/sync-engine.js.map +1 -0
  590. package/dist/sync/sync-messages.d.ts +82 -0
  591. package/dist/sync/sync-messages.d.ts.map +1 -0
  592. package/dist/sync/sync-messages.js +12 -0
  593. package/dist/sync/sync-messages.js.map +1 -0
  594. package/dist/types.d.ts +293 -0
  595. package/dist/types.d.ts.map +1 -0
  596. package/dist/types.js +7 -0
  597. package/dist/types.js.map +1 -0
  598. package/dist/utils/backoff.d.ts +9 -0
  599. package/dist/utils/backoff.d.ts.map +1 -0
  600. package/dist/utils/backoff.js +25 -0
  601. package/dist/utils/backoff.js.map +1 -0
  602. package/dist/utils/encoding.d.ts +19 -0
  603. package/dist/utils/encoding.d.ts.map +1 -0
  604. package/dist/utils/encoding.js +60 -0
  605. package/dist/utils/encoding.js.map +1 -0
  606. package/dist/utils/errors.d.ts +34 -0
  607. package/dist/utils/errors.d.ts.map +1 -0
  608. package/dist/utils/errors.js +27 -0
  609. package/dist/utils/errors.js.map +1 -0
  610. package/dist/utils/events.d.ts +26 -0
  611. package/dist/utils/events.d.ts.map +1 -0
  612. package/dist/utils/events.js +50 -0
  613. package/dist/utils/events.js.map +1 -0
  614. package/dist/utils/guards.d.ts +45 -0
  615. package/dist/utils/guards.d.ts.map +1 -0
  616. package/dist/utils/guards.js +69 -0
  617. package/dist/utils/guards.js.map +1 -0
  618. package/dist/utils/hash.d.ts +23 -0
  619. package/dist/utils/hash.d.ts.map +1 -0
  620. package/dist/utils/hash.js +75 -0
  621. package/dist/utils/hash.js.map +1 -0
  622. package/dist/utils/index.d.ts +9 -0
  623. package/dist/utils/index.d.ts.map +1 -0
  624. package/dist/utils/index.js +9 -0
  625. package/dist/utils/index.js.map +1 -0
  626. package/dist/utils/port.d.ts +13 -0
  627. package/dist/utils/port.d.ts.map +1 -0
  628. package/dist/utils/port.js +2 -0
  629. package/dist/utils/port.js.map +1 -0
  630. package/dist/utils/serial.d.ts +14 -0
  631. package/dist/utils/serial.d.ts.map +1 -0
  632. package/dist/utils/serial.js +30 -0
  633. package/dist/utils/serial.js.map +1 -0
  634. package/dist/validation/capability-gate.d.ts +35 -0
  635. package/dist/validation/capability-gate.d.ts.map +1 -0
  636. package/dist/validation/capability-gate.js +56 -0
  637. package/dist/validation/capability-gate.js.map +1 -0
  638. package/dist/validation/check-version.d.ts +11 -0
  639. package/dist/validation/check-version.d.ts.map +1 -0
  640. package/dist/validation/check-version.js +24 -0
  641. package/dist/validation/check-version.js.map +1 -0
  642. package/dist/validation/crypto-gate.d.ts +12 -0
  643. package/dist/validation/crypto-gate.d.ts.map +1 -0
  644. package/dist/validation/crypto-gate.js +37 -0
  645. package/dist/validation/crypto-gate.js.map +1 -0
  646. package/docs/README.md +112 -0
  647. package/docs/actions.md +120 -0
  648. package/docs/agents.md +159 -0
  649. package/docs/automations.md +283 -0
  650. package/docs/blueprints-and-guides.md +339 -0
  651. package/docs/building-an-app.md +218 -0
  652. package/docs/calls.md +189 -0
  653. package/docs/collections.md +402 -0
  654. package/docs/computed.md +158 -0
  655. package/docs/contacts.md +138 -0
  656. package/docs/contracts.md +199 -0
  657. package/docs/direct-messages.md +117 -0
  658. package/docs/doors.md +151 -0
  659. package/docs/node.md +938 -0
  660. package/docs/proposing-collections.md +73 -0
  661. package/docs/query-format.md +188 -0
  662. package/docs/records-and-queries.md +181 -0
  663. package/docs/sign-in.md +331 -0
  664. package/docs/spaces.md +282 -0
  665. package/docs/standard-library.md +520 -0
  666. package/docs/storage.md +261 -0
  667. package/docs/warrants.md +79 -0
  668. package/package.json +106 -4
package/README.md CHANGED
@@ -1,3 +1,244 @@
1
- # Temporary Holding Version
1
+ # @minca/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A peer-to-peer data protocol for the browser. You own your identity as a
4
+ written-down code, keep your data in signed records that sync directly between
5
+ devices, and every app is a view onto that data rather than its owner.
6
+
7
+ > **Building an app?** Short guides — sign-in, collections and rules, automations,
8
+ > queries, blueprints, agents — are in [packages/core/docs](packages/core/docs/README.md),
9
+ > and ship in the package as `node_modules/@minca/core/docs/`, so a
10
+ > coding agent finds the ones that match the installed version.
11
+ >
12
+ > **Building a client, or an agent that needs the architecture?** The
13
+ > protocol is specified in [spec](spec/README.md): wire formats,
14
+ > what is signed, and what every peer must check. The tests are its
15
+ > executable half.
16
+
17
+ ## Architecture
18
+
19
+ ```
20
+ ┌──────────────────────────────────────────────────────────────┐
21
+ │ Applications │
22
+ ├──────────────┬───────────┬────────────┬──────────┬───────────┤
23
+ │ Accounts │ Spaces │ Validation │ Privacy │ Sync │
24
+ │ seed, vault, │ founders, │ crypto → │ envelope │ Negentropy│
25
+ │ root signer, │ roles × │ structural │ + HPKE, │ per │
26
+ │ UCAN, pairing│ grants │ → UCAN │ per space│ collection│
27
+ ├──────────────┴───────────┴────────────┴──────────┴───────────┤
28
+ │ Storage: signed versions + plain index over an adapter │
29
+ │ IndexedDB (per origin) · data folder (shared by origins) │
30
+ ├──────────────────────────────────────────────────────────────┤
31
+ │ Network: WebRTC data channels │
32
+ │ several relays at once · peers introduce peers │
33
+ ├──────────────────────────────────────────────────────────────┤
34
+ │ Web Crypto · WebAuthn · IndexedDB · File System Access · │
35
+ │ WebRTC · @noble/curves · @scure/base │
36
+ └──────────────────────────────────────────────────────────────┘
37
+ ```
38
+
39
+ ## Key Principles
40
+
41
+ - **No authority.** No server issues identities or holds the truth. Relays only
42
+ introduce peers; an always-on node adds availability, never authority.
43
+ - **Apps are views.** Data lives in spaces the user owns, as signed records any
44
+ app can read and verify.
45
+ - **Local-first.** Works offline, syncs when peers are reachable.
46
+ - **Few, boring dependencies.** Native browser APIs first. Where a problem is
47
+ hard and already solved — elliptic-curve arithmetic, for one — a very stable,
48
+ widely used library instead of our own. See [CLAUDE.md](CLAUDE.md#dependencies).
49
+ - **Isomorphic.** Runs in browsers, Node and Bun via `globalThis`.
50
+ - **Functional.** Plain functions and frozen data, no class hierarchies.
51
+ - **Standard Schema.** Bring your own validator (Zod, Valibot, ArkType, …).
52
+
53
+ ## Quick Start
54
+
55
+ ```typescript
56
+ import {
57
+ generateSeed,
58
+ seedToRecoveryCode,
59
+ createIdentityManager,
60
+ createLocalRootSigner,
61
+ publicKeyToDid,
62
+ P256_MULTICODEC,
63
+ createSigner,
64
+ createVersion,
65
+ createIndexedDBAdapter,
66
+ createStorageProvider,
67
+ createSpaceManager,
68
+ } from '@minca/core';
69
+
70
+ // 1. An account is a 16-byte seed. Show the code once; the user keeps it.
71
+ const seed = generateSeed();
72
+ console.log(seedToRecoveryCode(seed)); // 'K7N6-ERYP-68TZ-A7HN-VJW3-QWKN-CG'
73
+
74
+ const manager = createIdentityManager();
75
+ const me = await manager.fromSeed(seed); // same seed → same DID, anywhere
76
+ const provider = manager.getProvider();
77
+
78
+ // 2. The root key signs one thing: permission for a session key to write.
79
+ const root = createLocalRootSigner(me, provider);
80
+ const session = await provider.generateKeyPair();
81
+ const sessionDid = publicKeyToDid(await provider.exportPublicKey(session.publicKey), P256_MULTICODEC);
82
+ const note = await root.delegate({
83
+ audience: sessionDid,
84
+ command: '/', // everything the account may do
85
+ expiration: Math.floor(Date.now() / 1000) + 3600,
86
+ });
87
+
88
+ // 3. A space to put things in
89
+ const spaces = createSpaceManager(await createIndexedDBAdapter('my-app/registry'));
90
+ const { space } = await spaces.create({ name: 'Notes', visibility: 'public', creator: me.did });
91
+
92
+ // 4. A signed record, stored in that space's own store
93
+ const storage = createStorageProvider(await createIndexedDBAdapter(`my-app/space/${space.id}`));
94
+ const signed = await createSigner(provider).sign(
95
+ createVersion({
96
+ author: sessionDid,
97
+ collection: 'app.example.note',
98
+ space: space.id,
99
+ body: { text: 'Hello, decentralized world!' },
100
+ proof: note, // the note from the account to this key: one token
101
+ // This key's first version in this collection: its place in its line (spec 02 §4.10). A node keeps count for you.
102
+ log: { n: 0 },
103
+ }),
104
+ session.privateKey,
105
+ );
106
+ await storage.addVersion(signed);
107
+ ```
108
+
109
+ That is the protocol by hand. Most apps never do it: `createNode` wires an
110
+ identity, its spaces, validation, encryption and sync into one object, and its
111
+ API is plain data in and out:
112
+
113
+ ```typescript
114
+ import {
115
+ createNode,
116
+ createIdentityManager,
117
+ createLocalRootSigner,
118
+ indexedDBStores,
119
+ rolePresets,
120
+ } from '@minca/core';
121
+
122
+ const manager = createIdentityManager();
123
+ const me = await manager.fromRecoveryCode(code);
124
+
125
+ const node = await createNode({
126
+ signer: createLocalRootSigner(me, manager.getProvider()), // or anything that signs
127
+ stores: indexedDBStores('my-app'), // or folderStores(directory, …)
128
+ network: { relays: ['wss://relay.example'] },
129
+ });
130
+
131
+ const space = await node.spaces.create({ name: 'Groceries', visibility: 'private', ...rolePresets.team });
132
+ const milk = await node.records.put(space.id, 'app.todo.item', { text: 'milk', done: false });
133
+ await node.records.update(space.id, milk.key, { text: 'milk', done: true }); // same key, next version
134
+ node.subscribe((event) => {
135
+ if (event.type === 'records') redraw();
136
+ });
137
+
138
+ const invite = await node.spaces.invite(space.id); // a friend calls node.spaces.join(invite) — and joins as an Editor
139
+ const view = await node.spaces.invite(space.id, { write: false }); // they can read, not change
140
+ await node.spaces.closeInvite(space.id, invite); // nobody else joins with that link
141
+ ```
142
+
143
+ ## Where everything is described
144
+
145
+ | Topic | Library (how to call it) | Protocol (what peers agree on) |
146
+ | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
147
+ | The node: records and versions, live messages, holding spaces, actions | [node](packages/core/docs/node.md), [records and queries](packages/core/docs/records-and-queries.md), [actions](packages/core/docs/actions.md) | [02 Records](spec/02-records.md), [06 Nodes and sessions](spec/06-nodes-and-sessions.md) |
148
+ | Signing in, `<minca-auth>`, React hooks | [building an app](packages/core/docs/building-an-app.md), [sign-in](packages/core/docs/sign-in.md) | [01 Identity](spec/01-identity.md) |
149
+ | The account home, app grants, keepers, topic tags, notifications | [building an app](packages/core/docs/building-an-app.md), [node](packages/core/docs/node.md), [apps/home](apps/home/README.md) | [06 Nodes and sessions](spec/06-nodes-and-sessions.md), [03 Spaces](spec/03-spaces.md) |
150
+ | Identity: the seed, recovery code, wraps, passkeys, UCAN, root signers | [sign-in](packages/core/docs/sign-in.md), [node](packages/core/docs/node.md#root-signers-and-notes) | [01 Identity](spec/01-identity.md) |
151
+ | Spaces: the constitution, founders, roles and their grants, invites, successors, key changes, profiles, the account registry | [spaces](packages/core/docs/spaces.md) | [03 Spaces](spec/03-spaces.md) |
152
+ | Collections, schemas, rules, contracts and computed fields, links, queries, the standard library | [collections](packages/core/docs/collections.md), [contracts](packages/core/docs/contracts.md), [computed fields](packages/core/docs/computed.md), [query format](packages/core/docs/query-format.md), [standard library](packages/core/docs/standard-library.md), [blueprints and guides](packages/core/docs/blueprints-and-guides.md) | [02 Records](spec/02-records.md), [09 Contracts](spec/09-contracts.md) |
153
+ | Calls, contacts, doors, direct messages | [calls](packages/core/docs/calls.md), [contacts](packages/core/docs/contacts.md), [doors](packages/core/docs/doors.md), [direct messages](packages/core/docs/direct-messages.md) | [07 Doors](spec/07-doors.md), [04 Network](spec/04-network.md) |
154
+ | Network: the relay, TURN, meeting peers, introductions, pairing a phone | [node](packages/core/docs/node.md#the-network), [packages/relay](packages/relay/README.md) | [04 Network](spec/04-network.md) |
155
+ | Sync, storage adapters, data folders and locking them, mirrors | [storage](packages/core/docs/storage.md) | [05 Sync and storage](spec/05-sync-and-storage.md) |
156
+ | The CLI, the always-on node, hosting, agents and MCP | [packages/cli](packages/cli/README.md), [agents](packages/core/docs/agents.md) | [06 Nodes and sessions](spec/06-nodes-and-sessions.md) |
157
+ | The example app, Liquid and mini apps | [apps/example](apps/example/README.md) | — |
158
+ | Planned work | [docs](packages/core/docs/README.md#planned-in-the-library) | [spec](spec/README.md) |
159
+
160
+ ## Running it locally
161
+
162
+ ```bash
163
+ npm install # one install for the whole workspace: core, CLI, relay and the apps
164
+ npm run dev
165
+ ```
166
+
167
+ That starts everything, with coloured output per part, and Ctrl-C stops it all:
168
+
169
+ | Part | Where | What |
170
+ | ------ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
171
+ | app | http://localhost:5173 | The example app |
172
+ | home | http://localhost:5174 | The account home it connects to |
173
+ | node | port 8787 | An always-on node that is also the relay; a throwaway identity on first run (`packages/cli/.env.dev`, data in `.minca-dev/`) |
174
+ | host | http://localhost:8788 | `minca host`, what "Keep my spaces online" uses and what spaces chip in for; settings in `packages/cli/.env.host.dev` |
175
+ | stripe | — | Only when you add a Stripe test key: forwards Stripe's webhooks to the host |
176
+
177
+ `npm run signal` runs the relay alone. Trying it all out, payments included,
178
+ is in [apps/example](apps/example/README.md).
179
+
180
+ ## Repository layout
181
+
182
+ One npm workspace, installed once at the root (`npm install`):
183
+
184
+ | Folder | Package | |
185
+ | ---------------- | ----------------------------- | --------------------------------------------------------------------------- |
186
+ | `packages/core` | `@minca/core` (published) | The protocol library, and its tests |
187
+ | `packages/cli` | `@minca/cli` (published) | `minca`: the always-on node, hosting, agents, MCP |
188
+ | `packages/relay` | `@minca/relay` (private) | The signaling relay and its mailbox, run alone on Fly and inside every node |
189
+ | `apps/home` | — | The account home |
190
+ | `apps/example` | — | The website and the example app |
191
+ | `apps/extension` | — | The Chrome extension |
192
+ | `apps/shared` | `@minca/app-shared` (private) | Styles, relay settings and components the home and the website share |
193
+ | `spec` | — | The protocol specification |
194
+
195
+ Everything imports the protocol by name, `@minca/core`, and only
196
+ through what it exports. Inside the workspace, the `@minca/source`
197
+ export condition resolves those imports to `packages/core/src`, so the apps,
198
+ the CLI and the tests run on the source with no build step; published copies
199
+ use `dist`. The CLI bundles the protocol and the relay into one file, so
200
+ `npx @minca/cli` and the single-file binaries need nothing else.
201
+
202
+ ## Releasing
203
+
204
+ `@minca/core` (`packages/core/`) and `@minca/cli`
205
+ (`packages/cli/`) are released together, always with the same version:
206
+
207
+ ```bash
208
+ npm run release
209
+ ```
210
+
211
+ It checks you're logged in to npm first (and runs `npm login` if not),
212
+ typechecks and runs the tests, then [bumpp](https://github.com/antfu-collective/bumpp)
213
+ asks for the next version, writes it to both packages, and commits and tags
214
+ it (`v0.1.2`), locally. Both are published (each builds itself first: `dist/`
215
+ for the core, one bundled file for the CLI), and only then are the commit and
216
+ tag pushed.
217
+
218
+ If a release stops partway — npm login, a one-time password, the network —
219
+ fix it and run `npm run release` again. It sees the version isn't fully on npm
220
+ yet and publishes what's missing, instead of bumping again. `npm run release
221
+ -- --dry-run` does everything but publish and push. The script is
222
+ `scripts/release.mjs`; bumpp's settings are in `bump.config.ts`.
223
+
224
+ ## Tests
225
+
226
+ ```bash
227
+ npm test # every workspace: core's tests, then the CLI's
228
+ npm run typecheck
229
+ ```
230
+
231
+ Covers key derivation — checked against the public keys Web Crypto generates
232
+ for the same private scalars, and pinned to recorded DIDs so an accidental
233
+ change cannot slip through; recovery codes; account vaults, wraps and account
234
+ stores; data folders with several writers; spaces, invites and
235
+ encrypt-then-sign; delegations (UCAN 1.0 policies; one-link notes); phone
236
+ pairing; peer introductions; Negentropy, checked against the reference
237
+ implementation; the validation gates; and two peers reconciling, including the forged, stolen,
238
+ unauthorized and malformed versions their gatekeepers reject. Above those:
239
+ the node API — versioned records, links, queries, collection definitions,
240
+ profiles, the account registry, moving and merging accounts — and the CLI.
241
+
242
+ ## License
243
+
244
+ MIT
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Voice and video calls between the people in a space.
3
+ *
4
+ * Nothing here is new to the protocol. A call is live messages
5
+ * (`node.spaces.send`) in the space it belongs to, and a WebRTC connection of
6
+ * its own between each pair of people in it — the shape Matrix gives group
7
+ * calls (MSC3401, Element Call's full mesh):
8
+ *
9
+ * ```
10
+ * call.here { call, since, camera, muted } to the space, every few seconds while in it
11
+ * call.ring { call } to one account: ring its devices
12
+ * call.answered { call } / call.declined to the caller, and to your own other devices
13
+ * call.cancel { call } the caller gave up ringing
14
+ * call.signal { call, description | candidate } to one device: setting up the connection
15
+ * call.leave { call } to the space: gone now, not in 15 seconds
16
+ * ```
17
+ *
18
+ * The setup travels over the space's own peer connection, whose handshake
19
+ * proved who is at the other end — so the offer, and the fingerprint of the
20
+ * key the browser will insist on, really come from that person. A relay only
21
+ * ever introduced the two devices; it never sees a call.
22
+ *
23
+ * Only members of the space (anyone holding a role) are rung by, heard in or
24
+ * connected to a call; a view-only reader of a public space is not.
25
+ *
26
+ * A call belongs to the space, not to a screen: it keeps the space open
27
+ * (`spaces.hold`) for as long as it runs, so moving between spaces
28
+ * never interrupts it. One call at a time.
29
+ *
30
+ * Each connection is made with an audio and a video transceiver from the
31
+ * start. Turning the camera on or off, or sharing the screen, swaps the track
32
+ * a sender carries and never renegotiates — so neither side can offer at the
33
+ * same moment as the other, and the side with the lower session DID always
34
+ * makes the offer.
35
+ */
36
+ import type { P2PNode } from '../node/types.js';
37
+ export interface CallsOptions {
38
+ /** How a WebRTC connection is made. `new RTCPeerConnection` by default. */
39
+ readonly createConnection?: (config: RTCConfiguration) => RTCPeerConnection;
40
+ /** Camera and microphone. `navigator.mediaDevices.getUserMedia` by default. */
41
+ readonly getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
42
+ /** The screen, for sharing it. `navigator.mediaDevices.getDisplayMedia` by default. */
43
+ readonly getDisplayMedia?: (constraints: DisplayMediaStreamOptions) => Promise<MediaStream>;
44
+ /** How a set of tracks becomes something a `<video>` can show. `new MediaStream` by default. */
45
+ readonly createStream?: (tracks: ReadonlyArray<MediaStreamTrack>) => MediaStream | null;
46
+ /** Where the call you're in is remembered, to offer rejoining after a reload. `sessionStorage` by default; null for nowhere. */
47
+ readonly storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'> | null;
48
+ /** How often you say you're in a call. Default 5 s. */
49
+ readonly heartbeatMs?: number;
50
+ /** How long without hearing that someone is gone. Default 15 s. */
51
+ readonly goneMs?: number;
52
+ /** How long a ring rings before it's a missed call. Default 45 s. */
53
+ readonly ringMs?: number;
54
+ }
55
+ /** Someone else in the call you're in: one device of theirs */
56
+ export interface CallPeer {
57
+ /** Their device's session DID */
58
+ readonly peer: string;
59
+ /** Their account */
60
+ readonly account: string;
61
+ /** What they send: sound, and video when their camera is on. Null until it arrives. */
62
+ readonly stream: MediaStream | null;
63
+ readonly muted: boolean;
64
+ readonly camera: boolean;
65
+ readonly connection: 'connecting' | 'connected' | 'failed';
66
+ }
67
+ /** The call you're in */
68
+ export interface CurrentCall {
69
+ readonly id: string;
70
+ readonly space: string;
71
+ /** When you joined it, ms */
72
+ readonly joinedAt: number;
73
+ /** Your own camera and microphone, for showing yourself */
74
+ readonly local: MediaStream | null;
75
+ readonly muted: boolean;
76
+ readonly camera: boolean;
77
+ readonly sharing: boolean;
78
+ readonly people: ReadonlyArray<CallPeer>;
79
+ /** Who you're ringing, while it rings — and what came of it, for a moment after */
80
+ readonly outgoing: {
81
+ readonly to: string;
82
+ readonly since: number;
83
+ readonly state: 'ringing' | 'declined' | 'missed';
84
+ } | null;
85
+ /** Something went wrong that you should hear about: no microphone, say */
86
+ readonly problem: string | null;
87
+ }
88
+ /** Someone ringing you */
89
+ export interface IncomingCall {
90
+ readonly id: string;
91
+ readonly space: string;
92
+ /** The caller's account */
93
+ readonly from: string;
94
+ readonly since: number;
95
+ }
96
+ /** A call going on in a space you have open, that you're not in */
97
+ export interface CallAround {
98
+ readonly id: string;
99
+ readonly space: string;
100
+ /** Accounts in it, each once */
101
+ readonly people: ReadonlyArray<string>;
102
+ /** When the first of them joined, ms */
103
+ readonly since: number;
104
+ }
105
+ export interface CallsState {
106
+ readonly current: CurrentCall | null;
107
+ readonly ringing: ReadonlyArray<IncomingCall>;
108
+ readonly around: ReadonlyArray<CallAround>;
109
+ /** The call you were in before this page loaded, while it's still going on */
110
+ readonly rejoin: CallAround | null;
111
+ }
112
+ export interface CallOptions {
113
+ /** Start with the camera on. Default false: sound only. */
114
+ readonly video?: boolean;
115
+ }
116
+ export interface Calls {
117
+ /** What's going on now. The same object until something changes. */
118
+ getState(): CallsState;
119
+ subscribe(listener: () => void): () => void;
120
+ /** Joins the call going on in a space, or starts one. Leaves any other call first. */
121
+ start(space: string, options?: CallOptions & {
122
+ readonly call?: string;
123
+ }): Promise<void>;
124
+ /** Starts a call in a space, and rings one person there — all their devices, until one answers */
125
+ ring(space: string, account: string, options?: CallOptions): Promise<void>;
126
+ answer(id: string, options?: CallOptions): Promise<void>;
127
+ decline(id: string): Promise<void>;
128
+ leave(): Promise<void>;
129
+ setMuted(muted: boolean): void;
130
+ setCamera(on: boolean): Promise<void>;
131
+ /** Shows your screen in place of your camera, until you stop it (or the browser does) */
132
+ shareScreen(): Promise<void>;
133
+ stopSharing(): Promise<void>;
134
+ /** Stops offering `rejoin` */
135
+ forgetRejoin(): void;
136
+ /** Leaves any call and stops listening */
137
+ close(): Promise<void>;
138
+ }
139
+ export declare function createCalls(node: P2PNode, options?: CallsOptions): Calls;
140
+ //# sourceMappingURL=calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../src/calls/calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,kBAAkB,CAAC;AAK3D,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,iBAAiB,CAAC;IAC5E,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,sBAAsB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACtF,uFAAuF;IACvF,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,yBAAyB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5F,gGAAgG;IAChG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,WAAW,GAAG,IAAI,CAAC;I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