@dxos/client-services 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0

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 (181) hide show
  1. package/dist/lib/browser/{chunk-HJH6BNTN.mjs → chunk-3LSLNVKQ.mjs} +2102 -1870
  2. package/dist/lib/browser/chunk-3LSLNVKQ.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-NQSC7HOE.mjs +22 -0
  4. package/dist/lib/browser/chunk-NQSC7HOE.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
  6. package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +451 -67
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
  11. package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  12. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  13. package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  14. package/dist/lib/browser/packlets/locks/browser.mjs +126 -0
  15. package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
  16. package/dist/lib/browser/packlets/locks/node.mjs +66 -0
  17. package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
  18. package/dist/lib/browser/testing/index.mjs +36 -17
  19. package/dist/lib/browser/testing/index.mjs.map +3 -3
  20. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
  21. package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-ONQM6RQH.mjs → chunk-5S7PIHLS.mjs} +1942 -1579
  23. package/dist/lib/node-esm/chunk-5S7PIHLS.mjs.map +7 -0
  24. package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs +22 -0
  25. package/dist/lib/node-esm/chunk-PKEGMOQ4.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +451 -67
  27. package/dist/lib/node-esm/index.mjs.map +4 -4
  28. package/dist/lib/node-esm/meta.json +1 -1
  29. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +93 -0
  30. package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
  31. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
  32. package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
  33. package/dist/lib/node-esm/packlets/locks/browser.mjs +126 -0
  34. package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
  35. package/dist/lib/node-esm/packlets/locks/node.mjs +66 -0
  36. package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
  37. package/dist/lib/node-esm/testing/index.mjs +36 -17
  38. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  39. package/dist/types/src/index.d.ts +1 -0
  40. package/dist/types/src/index.d.ts.map +1 -1
  41. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +3 -2
  42. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
  43. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  44. package/dist/types/src/packlets/devtools/devtools.d.ts +2 -2
  45. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  46. package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
  47. package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
  48. package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
  49. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  50. package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
  51. package/dist/types/src/packlets/identity/identity-manager.d.ts +6 -6
  52. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  53. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +7 -6
  54. package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
  55. package/dist/types/src/packlets/identity/identity-service.d.ts +1 -6
  56. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  57. package/dist/types/src/packlets/identity/identity.d.ts +8 -11
  58. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  59. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +4 -4
  60. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  61. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
  62. package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
  63. package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
  64. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +2 -3
  65. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
  66. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
  67. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  68. package/dist/types/src/packlets/invitations/invitations-manager.d.ts +3 -3
  69. package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
  70. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +2 -2
  71. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  72. package/dist/types/src/packlets/locks/index.d.ts +1 -1
  73. package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
  74. package/dist/types/src/packlets/logging/logging-service.d.ts +4 -0
  75. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  76. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  77. package/dist/types/src/packlets/services/client-rpc-server.d.ts +2 -2
  78. package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
  79. package/dist/types/src/packlets/services/feed-syncer.d.ts +59 -0
  80. package/dist/types/src/packlets/services/feed-syncer.d.ts.map +1 -0
  81. package/dist/types/src/packlets/services/feed-syncer.test.d.ts +2 -0
  82. package/dist/types/src/packlets/services/feed-syncer.test.d.ts.map +1 -0
  83. package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
  84. package/dist/types/src/packlets/services/service-context.d.ts +13 -8
  85. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  86. package/dist/types/src/packlets/services/service-host.d.ts +20 -6
  87. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  88. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +9 -1
  89. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
  90. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts +6 -0
  91. package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
  92. package/dist/types/src/packlets/space-export/space-archive.test.d.ts +2 -0
  93. package/dist/types/src/packlets/space-export/space-archive.test.d.ts.map +1 -0
  94. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +27 -15
  95. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  96. package/dist/types/src/packlets/spaces/data-space.d.ts +24 -8
  97. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  98. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
  99. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  100. package/dist/types/src/packlets/spaces/genesis.d.ts +2 -1
  101. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
  102. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -6
  103. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  104. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -2
  105. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  106. package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
  107. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  108. package/dist/types/src/packlets/testing/test-builder.d.ts +6 -5
  109. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  110. package/dist/types/src/packlets/worker/worker-runtime.d.ts +31 -4
  111. package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
  112. package/dist/types/src/packlets/worker/worker-session.d.ts +2 -2
  113. package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
  114. package/dist/types/src/version.d.ts +1 -1
  115. package/dist/types/src/version.d.ts.map +1 -1
  116. package/dist/types/tsconfig.tsbuildinfo +1 -1
  117. package/package.json +70 -48
  118. package/src/index.ts +1 -0
  119. package/src/packlets/agents/edge-agent-manager.ts +8 -5
  120. package/src/packlets/agents/edge-agent-service.ts +2 -1
  121. package/src/packlets/devices/devices-service.test.ts +0 -1
  122. package/src/packlets/devtools/devtools.ts +2 -3
  123. package/src/packlets/diagnostics/index.ts +1 -1
  124. package/src/packlets/identity/authenticator.ts +2 -2
  125. package/src/packlets/identity/contacts-service.ts +0 -1
  126. package/src/packlets/identity/identity-manager.test.ts +5 -5
  127. package/src/packlets/identity/identity-manager.ts +21 -18
  128. package/src/packlets/identity/identity-recovery-manager.ts +22 -18
  129. package/src/packlets/identity/identity-service.test.ts +6 -27
  130. package/src/packlets/identity/identity-service.ts +5 -76
  131. package/src/packlets/identity/identity.test.ts +2 -2
  132. package/src/packlets/identity/identity.ts +9 -32
  133. package/src/packlets/invitations/device-invitation-protocol.ts +5 -6
  134. package/src/packlets/invitations/edge-invitation-handler.ts +4 -3
  135. package/src/packlets/invitations/invitation-guest-extenstion.ts +6 -4
  136. package/src/packlets/invitations/invitation-host-extension.ts +6 -4
  137. package/src/packlets/invitations/invitation-protocol.ts +2 -3
  138. package/src/packlets/invitations/invitations-handler.test.ts +4 -5
  139. package/src/packlets/invitations/invitations-handler.ts +10 -10
  140. package/src/packlets/invitations/invitations-manager.ts +37 -14
  141. package/src/packlets/invitations/invitations-service.ts +4 -4
  142. package/src/packlets/invitations/space-invitation-protocol.test.ts +17 -16
  143. package/src/packlets/invitations/space-invitation-protocol.ts +10 -15
  144. package/src/packlets/locks/index.ts +1 -1
  145. package/src/packlets/logging/logging-service.ts +4 -0
  146. package/src/packlets/network/network-service.test.ts +0 -1
  147. package/src/packlets/network/network-service.ts +5 -4
  148. package/src/packlets/services/client-rpc-server.ts +4 -4
  149. package/src/packlets/services/feed-syncer.test.ts +340 -0
  150. package/src/packlets/services/feed-syncer.ts +337 -0
  151. package/src/packlets/services/platform.ts +7 -1
  152. package/src/packlets/services/service-context.test.ts +3 -2
  153. package/src/packlets/services/service-context.ts +129 -44
  154. package/src/packlets/services/service-host.test.ts +8 -8
  155. package/src/packlets/services/service-host.ts +63 -22
  156. package/src/packlets/services/service-registry.test.ts +0 -1
  157. package/src/packlets/space-export/space-archive-reader.ts +64 -3
  158. package/src/packlets/space-export/space-archive-writer.ts +39 -2
  159. package/src/packlets/space-export/space-archive.test.ts +287 -0
  160. package/src/packlets/spaces/data-space-manager.test.ts +79 -13
  161. package/src/packlets/spaces/data-space-manager.ts +97 -107
  162. package/src/packlets/spaces/data-space.ts +52 -29
  163. package/src/packlets/spaces/edge-feed-replicator.test.ts +1 -1
  164. package/src/packlets/spaces/edge-feed-replicator.ts +10 -9
  165. package/src/packlets/spaces/epoch-migrations.ts +5 -5
  166. package/src/packlets/spaces/genesis.ts +6 -1
  167. package/src/packlets/spaces/notarization-plugin.test.ts +2 -2
  168. package/src/packlets/spaces/notarization-plugin.ts +10 -9
  169. package/src/packlets/spaces/spaces-service.test.ts +9 -7
  170. package/src/packlets/spaces/spaces-service.ts +40 -16
  171. package/src/packlets/storage/storage.ts +4 -4
  172. package/src/packlets/testing/invitation-utils.ts +10 -6
  173. package/src/packlets/testing/test-builder.ts +36 -10
  174. package/src/packlets/worker/worker-runtime.ts +150 -13
  175. package/src/packlets/worker/worker-session.ts +8 -8
  176. package/src/version.ts +1 -1
  177. package/dist/lib/browser/chunk-HJH6BNTN.mjs.map +0 -7
  178. package/dist/lib/node-esm/chunk-ONQM6RQH.mjs.map +0 -7
  179. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
  180. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
  181. package/src/packlets/identity/default-space-state-machine.ts +0 -44
package/package.json CHANGED
@@ -1,13 +1,37 @@
1
1
  {
2
2
  "name": "@dxos/client-services",
3
- "version": "0.8.4-main.72ec0f3",
3
+ "version": "0.8.4-main.74a063c4e0",
4
4
  "description": "DXOS client services implementation",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
- "sideEffects": true,
13
+ "sideEffects": false,
10
14
  "type": "module",
15
+ "imports": {
16
+ "#locks-platform": {
17
+ "source": {
18
+ "browser": "./src/packlets/locks/browser.ts",
19
+ "default": "./src/packlets/locks/node.ts"
20
+ },
21
+ "types": "./dist/types/src/packlets/locks/node.d.ts",
22
+ "browser": "./dist/lib/browser/packlets/locks/browser.mjs",
23
+ "default": "./dist/lib/node-esm/packlets/locks/node.mjs"
24
+ },
25
+ "#diagnostics-broadcast": {
26
+ "source": {
27
+ "browser": "./src/packlets/diagnostics/browser-diagnostics-broadcast.ts",
28
+ "default": "./src/packlets/diagnostics/diagnostics-broadcast.ts"
29
+ },
30
+ "types": "./dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts",
31
+ "browser": "./dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs",
32
+ "default": "./dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs"
33
+ }
34
+ },
11
35
  "exports": {
12
36
  ".": {
13
37
  "source": "./src/index.ts",
@@ -22,12 +46,6 @@
22
46
  "node": "./dist/lib/node-esm/testing/index.mjs"
23
47
  }
24
48
  },
25
- "browser": {
26
- "jsondown": false,
27
- "./src/packlets/locks/node.ts": "./src/packlets/locks/browser.ts",
28
- "./src/packlets/diagnostics/diagnostics-broadcast.ts": "./src/packlets/diagnostics/browser-diagnostics-broadcast.ts",
29
- "./testing.js": "./dist/lib/browser/packlets/testing/index.mjs"
30
- },
31
49
  "types": "dist/types/src/index.d.ts",
32
50
  "typesVersions": {
33
51
  "*": {
@@ -37,58 +55,62 @@
37
55
  }
38
56
  },
39
57
  "files": [
40
- "testing.d.ts",
41
- "testing.js",
42
58
  "dist",
43
59
  "src"
44
60
  ],
45
61
  "dependencies": {
46
- "@automerge/automerge": "3.1.2",
47
- "@automerge/automerge-repo": "2.4.0",
62
+ "@automerge/automerge": "3.2.3",
63
+ "@automerge/automerge-repo": "2.5.1",
64
+ "@effect/experimental": "0.58.0",
65
+ "@effect/sql": "0.49.0",
66
+ "@effect/sql-sqlite-node": "0.50.1",
48
67
  "@obsidize/tar-browserify": "^5.2.0",
49
68
  "cbor-x": "^1.5.4",
69
+ "effect": "3.20.0",
50
70
  "platform": "^1.3.6",
51
- "@dxos/async": "0.8.4-main.72ec0f3",
52
- "@dxos/client-protocol": "0.8.4-main.72ec0f3",
53
- "@dxos/config": "0.8.4-main.72ec0f3",
54
- "@dxos/context": "0.8.4-main.72ec0f3",
55
- "@dxos/credentials": "0.8.4-main.72ec0f3",
56
- "@dxos/codec-protobuf": "0.8.4-main.72ec0f3",
57
- "@dxos/debug": "0.8.4-main.72ec0f3",
58
- "@dxos/crypto": "0.8.4-main.72ec0f3",
59
- "@dxos/echo": "0.8.4-main.72ec0f3",
60
- "@dxos/echo-db": "0.8.4-main.72ec0f3",
61
- "@dxos/echo-pipeline": "0.8.4-main.72ec0f3",
62
- "@dxos/echo-protocol": "0.8.4-main.72ec0f3",
63
- "@dxos/feed-store": "0.8.4-main.72ec0f3",
64
- "@dxos/edge-client": "0.8.4-main.72ec0f3",
65
- "@dxos/indexing": "0.8.4-main.72ec0f3",
66
- "@dxos/invariant": "0.8.4-main.72ec0f3",
67
- "@dxos/keyring": "0.8.4-main.72ec0f3",
68
- "@dxos/lock-file": "0.8.4-main.72ec0f3",
69
- "@dxos/messaging": "0.8.4-main.72ec0f3",
70
- "@dxos/keys": "0.8.4-main.72ec0f3",
71
- "@dxos/kv-store": "0.8.4-main.72ec0f3",
72
- "@dxos/network-manager": "0.8.4-main.72ec0f3",
73
- "@dxos/node-std": "0.8.4-main.72ec0f3",
74
- "@dxos/protocols": "0.8.4-main.72ec0f3",
75
- "@dxos/random-access-storage": "0.8.4-main.72ec0f3",
76
- "@dxos/rpc": "0.8.4-main.72ec0f3",
77
- "@dxos/log": "0.8.4-main.72ec0f3",
78
- "@dxos/teleport": "0.8.4-main.72ec0f3",
79
- "@dxos/teleport-extension-gossip": "0.8.4-main.72ec0f3",
80
- "@dxos/teleport-extension-object-sync": "0.8.4-main.72ec0f3",
81
- "@dxos/timeframe": "0.8.4-main.72ec0f3",
82
- "@dxos/tracing": "0.8.4-main.72ec0f3",
83
- "@dxos/websocket-rpc": "0.8.4-main.72ec0f3",
84
- "@dxos/util": "0.8.4-main.72ec0f3"
71
+ "@dxos/async": "0.8.4-main.74a063c4e0",
72
+ "@dxos/context": "0.8.4-main.74a063c4e0",
73
+ "@dxos/client-protocol": "0.8.4-main.74a063c4e0",
74
+ "@dxos/config": "0.8.4-main.74a063c4e0",
75
+ "@dxos/credentials": "0.8.4-main.74a063c4e0",
76
+ "@dxos/crypto": "0.8.4-main.74a063c4e0",
77
+ "@dxos/debug": "0.8.4-main.74a063c4e0",
78
+ "@dxos/echo-db": "0.8.4-main.74a063c4e0",
79
+ "@dxos/echo-pipeline": "0.8.4-main.74a063c4e0",
80
+ "@dxos/echo-protocol": "0.8.4-main.74a063c4e0",
81
+ "@dxos/effect": "0.8.4-main.74a063c4e0",
82
+ "@dxos/edge-client": "0.8.4-main.74a063c4e0",
83
+ "@dxos/feed-store": "0.8.4-main.74a063c4e0",
84
+ "@dxos/echo": "0.8.4-main.74a063c4e0",
85
+ "@dxos/invariant": "0.8.4-main.74a063c4e0",
86
+ "@dxos/codec-protobuf": "0.8.4-main.74a063c4e0",
87
+ "@dxos/keys": "0.8.4-main.74a063c4e0",
88
+ "@dxos/feed": "0.8.4-main.74a063c4e0",
89
+ "@dxos/kv-store": "0.8.4-main.74a063c4e0",
90
+ "@dxos/log": "0.8.4-main.74a063c4e0",
91
+ "@dxos/lock-file": "0.8.4-main.74a063c4e0",
92
+ "@dxos/network-manager": "0.8.4-main.74a063c4e0",
93
+ "@dxos/messaging": "0.8.4-main.74a063c4e0",
94
+ "@dxos/node-std": "0.8.4-main.74a063c4e0",
95
+ "@dxos/protocols": "0.8.4-main.74a063c4e0",
96
+ "@dxos/rpc": "0.8.4-main.74a063c4e0",
97
+ "@dxos/random-access-storage": "0.8.4-main.74a063c4e0",
98
+ "@dxos/sql-sqlite": "0.8.4-main.74a063c4e0",
99
+ "@dxos/teleport-extension-gossip": "0.8.4-main.74a063c4e0",
100
+ "@dxos/teleport-extension-object-sync": "0.8.4-main.74a063c4e0",
101
+ "@dxos/timeframe": "0.8.4-main.74a063c4e0",
102
+ "@dxos/tracing": "0.8.4-main.74a063c4e0",
103
+ "@dxos/teleport": "0.8.4-main.74a063c4e0",
104
+ "@dxos/util": "0.8.4-main.74a063c4e0",
105
+ "@dxos/websocket-rpc": "0.8.4-main.74a063c4e0",
106
+ "@dxos/keyring": "0.8.4-main.74a063c4e0"
85
107
  },
86
108
  "devDependencies": {
87
109
  "@types/platform": "^1.3.4",
88
110
  "@types/readable-stream": "^2.3.9",
89
111
  "get-port-please": "^3.1.1",
90
- "@dxos/signal": "0.8.4-main.72ec0f3",
91
- "@dxos/test-utils": "0.8.4-main.72ec0f3"
112
+ "@dxos/signal": "0.8.4-main.74a063c4e0",
113
+ "@dxos/test-utils": "0.8.4-main.74a063c4e0"
92
114
  },
93
115
  "publishConfig": {
94
116
  "access": "public"
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export * from './packlets/identity';
8
8
  export * from './packlets/invitations';
9
9
  export * from './packlets/locks';
10
10
  export * from './packlets/services';
11
+ export * from './packlets/space-export';
11
12
  export * from './packlets/spaces';
12
13
  export * from './packlets/storage';
13
14
  export * from './packlets/worker';
@@ -3,6 +3,7 @@
3
3
  //
4
4
 
5
5
  import { DeferredTask, Event, scheduleTask, synchronized } from '@dxos/async';
6
+ import { Context } from '@dxos/context';
6
7
  import { Resource } from '@dxos/context';
7
8
  import { type EdgeHttpClient } from '@dxos/edge-client';
8
9
  import { invariant } from '@dxos/invariant';
@@ -50,12 +51,12 @@ export class EdgeAgentManager extends Resource {
50
51
  }
51
52
 
52
53
  @synchronized
53
- public async createAgent(): Promise<void> {
54
+ public async createAgent(ctx: Context): Promise<void> {
54
55
  invariant(this.isOpen);
55
56
  invariant(this._edgeHttpClient);
56
57
  invariant(this._edgeFeatures?.agents);
57
58
 
58
- const response = await this._edgeHttpClient.createAgent({
59
+ const response = await this._edgeHttpClient.createAgent(ctx, {
59
60
  identityKey: this._identity.identityKey.toHex(),
60
61
  haloSpaceId: this._identity.haloSpaceId,
61
62
  haloSpaceKey: this._identity.haloSpaceKey.toHex(),
@@ -92,7 +93,7 @@ export class EdgeAgentManager extends Resource {
92
93
 
93
94
  this._lastKnownDeviceCount = this._identity.authorizedDeviceKeys.size;
94
95
  this._fetchAgentStatusTask = new DeferredTask(this._ctx, async () => {
95
- await this._fetchAgentStatus();
96
+ await this._fetchAgentStatus(this._ctx);
96
97
  });
97
98
  this._fetchAgentStatusTask.schedule();
98
99
 
@@ -117,11 +118,13 @@ export class EdgeAgentManager extends Resource {
117
118
  this._lastKnownDeviceCount = 0;
118
119
  }
119
120
 
120
- protected async _fetchAgentStatus(): Promise<void> {
121
+ protected async _fetchAgentStatus(ctx: Context): Promise<void> {
121
122
  invariant(this._edgeHttpClient);
122
123
  try {
123
124
  log('fetching agent status');
124
- const { agent } = await this._edgeHttpClient.getAgentStatus({ ownerIdentityKey: this._identity.identityKey });
125
+ const { agent } = await this._edgeHttpClient.getAgentStatus(ctx, {
126
+ ownerIdentityKey: this._identity.identityKey,
127
+ });
125
128
  const wasAgentCreatedDuringQuery = this._agentStatus === EdgeAgentStatus.ACTIVE;
126
129
  if (!wasAgentCreatedDuringQuery) {
127
130
  const deviceKey = agent.deviceKey ? PublicKey.fromHex(agent.deviceKey) : undefined;
@@ -3,6 +3,7 @@
3
3
  //
4
4
 
5
5
  import { Stream } from '@dxos/codec-protobuf/stream';
6
+ import { Context } from '@dxos/context';
6
7
  import { type EdgeConnection } from '@dxos/edge-client';
7
8
  import { EdgeAgentStatus } from '@dxos/protocols';
8
9
  import {
@@ -44,7 +45,7 @@ export class EdgeAgentServiceImpl implements EdgeAgentService {
44
45
  }
45
46
 
46
47
  async createAgent(): Promise<void> {
47
- return (await this._agentManagerProvider()).createAgent();
48
+ return (await this._agentManagerProvider()).createAgent(Context.default());
48
49
  }
49
50
 
50
51
  queryAgentStatus(): Stream<QueryAgentStatusResponse> {
@@ -11,7 +11,6 @@ import { type Device, type DevicesService } from '@dxos/protocols/proto/dxos/cli
11
11
 
12
12
  import { type ServiceContext } from '../services';
13
13
  import { createServiceContext } from '../testing';
14
-
15
14
  import { DevicesServiceImpl } from './devices-service';
16
15
 
17
16
  describe('DevicesService', () => {
@@ -42,7 +42,6 @@ import {
42
42
  } from '@dxos/protocols/proto/dxos/devtools/host';
43
43
 
44
44
  import { type ServiceContext } from '../services';
45
-
46
45
  import { subscribeToFeedBlocks, subscribeToFeeds } from './feeds';
47
46
  import { subscribeToKeyringKeys } from './keys';
48
47
  import { subscribeToMetadata } from './metadata';
@@ -53,7 +52,7 @@ export class DevtoolsHostEvents {
53
52
  readonly ready = new AsyncEvent();
54
53
  }
55
54
 
56
- export type DevtoolsServiceParams = {
55
+ export type DevtoolsServiceProps = {
57
56
  events: DevtoolsHostEvents;
58
57
  config: Config;
59
58
  context: ServiceContext;
@@ -63,7 +62,7 @@ export type DevtoolsServiceParams = {
63
62
  * @deprecated
64
63
  */
65
64
  export class DevtoolsServiceImpl implements DevtoolsHost {
66
- constructor(private readonly params: DevtoolsServiceParams) {}
65
+ constructor(private readonly params: DevtoolsServiceProps) {}
67
66
 
68
67
  events(_request: void): Stream<Event> {
69
68
  return new Stream<Event>(({ next }) => {
@@ -4,4 +4,4 @@
4
4
 
5
5
  export * from './diagnostics';
6
6
  export * from './diagnostics-collector';
7
- export * from './diagnostics-broadcast';
7
+ export * from '#diagnostics-broadcast';
@@ -27,7 +27,7 @@ export const createAuthProvider =
27
27
  return Credential.encode(credential);
28
28
  };
29
29
 
30
- export type TrustedKeySetAuthVerifierParams = {
30
+ export type TrustedKeySetAuthVerifierProps = {
31
31
  // TODO(dmaretskyi): Change to `isTrusted: (key) => bool`.
32
32
  trustedKeysProvider: () => ComplexSet<PublicKey>;
33
33
  update: Event<void>;
@@ -44,7 +44,7 @@ export type TrustedKeySetAuthVerifierParams = {
44
44
  export class TrustedKeySetAuthVerifier {
45
45
  private _ctx = new Context();
46
46
 
47
- constructor(private readonly _params: TrustedKeySetAuthVerifierParams) {}
47
+ constructor(private readonly _params: TrustedKeySetAuthVerifierProps) {}
48
48
 
49
49
  async close(): Promise<void> {
50
50
  await this._ctx.dispose();
@@ -11,7 +11,6 @@ import { type Contact, type ContactBook, type ContactsService } from '@dxos/prot
11
11
  import { ComplexMap, ComplexSet } from '@dxos/util';
12
12
 
13
13
  import { type DataSpaceManager } from '../spaces';
14
-
15
14
  import { type IdentityManager } from './identity-manager';
16
15
 
17
16
  export class ContactsServiceImpl implements ContactsService {
@@ -64,7 +64,7 @@ describe('identity/identity-manager', () => {
64
64
  test('creates identity', async () => {
65
65
  const { identityManager } = await setupPeer();
66
66
  await identityManager.open(new Context());
67
- onTestFinished(() => identityManager.close());
67
+ onTestFinished(() => identityManager.close(Context.default()));
68
68
 
69
69
  const identity = await identityManager.createIdentity();
70
70
  expect(identity).to.exist;
@@ -77,7 +77,7 @@ describe('identity/identity-manager', () => {
77
77
  await peer1.metadataStore.load();
78
78
  await peer1.identityManager.open(new Context());
79
79
  const identity1 = await peer1.identityManager.createIdentity();
80
- await peer1.identityManager.close();
80
+ await peer1.identityManager.close(Context.default());
81
81
  await peer1.feedStore.close();
82
82
  await peer1.metadataStore.close();
83
83
 
@@ -95,7 +95,7 @@ describe('identity/identity-manager', () => {
95
95
  test('update profile', async () => {
96
96
  const { identityManager } = await setupPeer();
97
97
  await identityManager.open(new Context());
98
- onTestFinished(() => identityManager.close());
98
+ onTestFinished(() => identityManager.close(Context.default()));
99
99
 
100
100
  const identity = await identityManager.createIdentity();
101
101
  expect(identity.profileDocument?.displayName).to.be.undefined;
@@ -112,7 +112,7 @@ describe('identity/identity-manager', () => {
112
112
  peerKey: identity1.deviceKey.toHex(),
113
113
  identityKey: identity1.identityKey.toHex(),
114
114
  });
115
- await identity1.joinNetwork();
115
+ await identity1.joinNetwork(Context.default());
116
116
 
117
117
  const peer2 = await setupPeer({ signalContext });
118
118
 
@@ -148,7 +148,7 @@ describe('identity/identity-manager', () => {
148
148
  peerKey: identity2.deviceKey.toHex(),
149
149
  identityKey: identity2.identityKey.toHex(),
150
150
  });
151
- await identity2.joinNetwork();
151
+ await identity2.joinNetwork(Context.default());
152
152
 
153
153
  // Identity2 is not yet ready at this point. Peer1 needs to admit peer2 device key and feed keys.
154
154
  await peer2.identityManager.acceptIdentity(identity2, identityRecord);
@@ -28,7 +28,7 @@ import {
28
28
  import { Gossip, Presence } from '@dxos/teleport-extension-gossip';
29
29
  import { Timeframe } from '@dxos/timeframe';
30
30
  import { trace as Trace } from '@dxos/tracing';
31
- import { deferFunction, isNode } from '@dxos/util';
31
+ import { deferFunction, isNode, isTauri } from '@dxos/util';
32
32
 
33
33
  import { createAuthProvider } from './authenticator';
34
34
  import { Identity } from './identity';
@@ -36,14 +36,14 @@ import { Identity } from './identity';
36
36
  const DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 10_000;
37
37
  const DEVICE_PRESENCE_OFFLINE_TIMEOUT = 20_000;
38
38
 
39
- interface ConstructSpaceParams {
39
+ interface ConstructSpaceProps {
40
40
  spaceRecord: SpaceMetadata;
41
41
  swarmIdentity: SwarmIdentity;
42
42
  identityKey: PublicKey;
43
43
  gossip: Gossip;
44
44
  }
45
45
 
46
- export type JoinIdentityParams = {
46
+ export type JoinIdentityProps = {
47
47
  identityKey: PublicKey;
48
48
  deviceKey: PublicKey;
49
49
  haloSpaceKey: PublicKey;
@@ -67,7 +67,7 @@ export type CreateIdentityOptions = {
67
67
  deviceProfile?: DeviceProfileDocument;
68
68
  };
69
69
 
70
- export type IdentityManagerParams = {
70
+ export type IdentityManagerProps = {
71
71
  metadataStore: MetadataStore;
72
72
  keyring: Keyring;
73
73
  feedStore: FeedStore<FeedMessage>;
@@ -95,7 +95,7 @@ export class IdentityManager {
95
95
  private _identity?: Identity;
96
96
 
97
97
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
98
- constructor(params: IdentityManagerParams) {
98
+ constructor(params: IdentityManagerProps) {
99
99
  this._metadataStore = params.metadataStore;
100
100
  this._keyring = params.keyring;
101
101
  this._feedStore = params.feedStore;
@@ -131,12 +131,11 @@ export class IdentityManager {
131
131
  log.trace('dxos.halo.identity-manager.open', trace.end({ id: traceId }));
132
132
  }
133
133
 
134
- async close(): Promise<void> {
135
- await this._identity?.close(new Context());
134
+ async close(ctx: Context): Promise<void> {
135
+ await this._identity?.close(ctx);
136
136
  }
137
137
 
138
- async createIdentity({ profile, deviceProfile }: CreateIdentityOptions = {}): Promise<Identity> {
139
- // TODO(nf): populate using context from ServiceContext?
138
+ async createIdentity({ profile, deviceProfile }: CreateIdentityOptions = {}, ctx?: Context): Promise<Identity> {
140
139
  invariant(!this._identity, 'Identity already exists.');
141
140
  log('creating identity...');
142
141
 
@@ -153,7 +152,7 @@ export class IdentityManager {
153
152
  };
154
153
 
155
154
  const identity = await this._constructIdentity(identityRecord);
156
- await identity.open(new Context());
155
+ await identity.open(ctx ?? Context.default());
157
156
 
158
157
  {
159
158
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
@@ -211,28 +210,32 @@ export class IdentityManager {
211
210
  return identity;
212
211
  }
213
212
 
214
- // TODO(nf): receive platform info rather than generating it here.
215
213
  createDefaultDeviceProfile(): DeviceProfileDocument {
214
+ // See TODOs in credentials.proto.
216
215
  let type: DeviceType;
217
- // TODO(nf): call Platform service instead?
218
216
  if (isNode()) {
219
217
  type = DeviceType.AGENT;
220
218
  } else {
221
219
  if (platform.name?.startsWith('iOS') || platform.name?.startsWith('Android')) {
222
220
  type = DeviceType.MOBILE;
223
- } else if ((globalThis as any).__args) {
221
+ } else if (isTauri() || !platform.name) {
222
+ // Tauri's __TAURI__ global isn't available in web workers. Fallback: WKWebView
223
+ // (Tauri on macOS) reports null for platform.name; all standard browsers don't.
224
224
  type = DeviceType.NATIVE;
225
225
  } else {
226
226
  type = DeviceType.BROWSER;
227
227
  }
228
228
  }
229
229
 
230
+ const os = platform.os?.family === 'OS X' ? 'macOS' : platform.os?.family;
231
+ const name = type === DeviceType.NATIVE || type === DeviceType.MOBILE ? 'App' : platform.name;
232
+
230
233
  return {
231
234
  type,
232
- platform: platform.name,
235
+ platform: name,
233
236
  platformVersion: platform.version,
234
237
  architecture: typeof platform.os?.architecture === 'number' ? String(platform.os.architecture) : undefined,
235
- os: platform.os?.family,
238
+ os,
236
239
  osVersion: platform.os?.version,
237
240
  };
238
241
  }
@@ -240,7 +243,7 @@ export class IdentityManager {
240
243
  /**
241
244
  * Prepare an identity object as the first step of acceptIdentity flow.
242
245
  */
243
- async prepareIdentity(params: JoinIdentityParams) {
246
+ async prepareIdentity(params: JoinIdentityProps, ctx?: Context) {
244
247
  log('accepting identity', { params });
245
248
  invariant(!this._identity, 'Identity already exists.');
246
249
 
@@ -256,7 +259,7 @@ export class IdentityManager {
256
259
  },
257
260
  };
258
261
  const identity = await this._constructIdentity(identityRecord);
259
- await identity.open(new Context());
262
+ await identity.open(ctx ?? Context.default());
260
263
  return { identity, identityRecord };
261
264
  }
262
265
 
@@ -395,7 +398,7 @@ export class IdentityManager {
395
398
  return identity;
396
399
  }
397
400
 
398
- private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceParams) {
401
+ private async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }: ConstructSpaceProps) {
399
402
  return this._spaceManager.constructSpace({
400
403
  metadata: {
401
404
  key: spaceRecord.key,
@@ -2,6 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { type Context } from '@dxos/context';
5
6
  import { generateSeedPhrase, keyPairFromSeedPhrase } from '@dxos/credentials';
6
7
  import { sign } from '@dxos/crypto';
7
8
  import { type EdgeHttpClient } from '@dxos/edge-client';
@@ -22,14 +23,14 @@ import {
22
23
  import { Timeframe } from '@dxos/timeframe';
23
24
 
24
25
  import { type Identity } from './identity';
25
- import { type JoinIdentityParams } from './identity-manager';
26
+ import { type JoinIdentityProps } from './identity-manager';
26
27
 
27
28
  export class EdgeIdentityRecoveryManager {
28
29
  constructor(
29
30
  private readonly _keyring: Keyring,
30
31
  private readonly _edgeClient: EdgeHttpClient | undefined,
31
32
  private readonly _identityProvider: () => Identity | undefined,
32
- private readonly _acceptRecoveredIdentity: (params: JoinIdentityParams) => Promise<Identity>,
33
+ private readonly _acceptRecoveredIdentity: (params: JoinIdentityProps) => Promise<Identity>,
33
34
  ) {}
34
35
 
35
36
  public async createRecoveryCredential({
@@ -72,7 +73,7 @@ export class EdgeIdentityRecoveryManager {
72
73
  return { recoveryCode };
73
74
  }
74
75
 
75
- public async requestRecoveryChallenge() {
76
+ public async requestRecoveryChallenge(ctx: Context) {
76
77
  invariant(this._edgeClient, 'Not connected to EDGE.');
77
78
 
78
79
  const deviceKey = await this._keyring.createKey();
@@ -83,7 +84,7 @@ export class EdgeIdentityRecoveryManager {
83
84
  };
84
85
 
85
86
  try {
86
- await this._edgeClient.recoverIdentity(request);
87
+ await this._edgeClient.recoverIdentity(ctx, request);
87
88
  throw new Error('No challenge received.');
88
89
  } catch (error: any) {
89
90
  if (!(error instanceof EdgeAuthChallengeError)) {
@@ -97,14 +98,17 @@ export class EdgeIdentityRecoveryManager {
97
98
  }
98
99
  }
99
100
 
100
- public async recoverIdentityWithExternalSignature({
101
- lookupKey,
102
- deviceKey,
103
- controlFeedKey,
104
- signature,
105
- clientDataJson,
106
- authenticatorData,
107
- }: RecoverIdentityRequest.ExternalSignature): Promise<void> {
101
+ public async recoverIdentityWithExternalSignature(
102
+ ctx: Context,
103
+ {
104
+ lookupKey,
105
+ deviceKey,
106
+ controlFeedKey,
107
+ signature,
108
+ clientDataJson,
109
+ authenticatorData,
110
+ }: RecoverIdentityRequest.ExternalSignature,
111
+ ): Promise<void> {
108
112
  invariant(this._edgeClient, 'Not connected to EDGE.');
109
113
 
110
114
  const request: EdgeRecoverIdentityRequest = {
@@ -121,7 +125,7 @@ export class EdgeIdentityRecoveryManager {
121
125
  : Buffer.from(signature).toString('base64'),
122
126
  };
123
127
 
124
- const response = await this._edgeClient.recoverIdentity(request);
128
+ const response = await this._edgeClient.recoverIdentity(ctx, request);
125
129
 
126
130
  await this._acceptRecoveredIdentity({
127
131
  authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
@@ -137,7 +141,7 @@ export class EdgeIdentityRecoveryManager {
137
141
  /**
138
142
  * Recovery identity using an opaque token sent to the user's email.
139
143
  */
140
- public async recoverIdentityWithToken({ token }: { token: string }): Promise<void> {
144
+ public async recoverIdentityWithToken(ctx: Context, { token }: { token: string }): Promise<void> {
141
145
  invariant(this._edgeClient, 'Not connected to EDGE.');
142
146
 
143
147
  const deviceKey = await this._keyring.createKey();
@@ -148,7 +152,7 @@ export class EdgeIdentityRecoveryManager {
148
152
  token,
149
153
  };
150
154
 
151
- const response = await this._edgeClient.recoverIdentity(request);
155
+ const response = await this._edgeClient.recoverIdentity(ctx, request);
152
156
 
153
157
  await this._acceptRecoveredIdentity({
154
158
  authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
@@ -161,7 +165,7 @@ export class EdgeIdentityRecoveryManager {
161
165
  });
162
166
  }
163
167
 
164
- public async recoverIdentity({ recoveryCode }: { recoveryCode: string }): Promise<void> {
168
+ public async recoverIdentity(ctx: Context, { recoveryCode }: { recoveryCode: string }): Promise<void> {
165
169
  invariant(this._edgeClient, 'Not connected to EDGE.');
166
170
 
167
171
  const recoveryKeypair = keyPairFromSeedPhrase(recoveryCode);
@@ -176,13 +180,13 @@ export class EdgeIdentityRecoveryManager {
176
180
 
177
181
  let response: RecoverIdentityResponseBody;
178
182
  try {
179
- response = await this._edgeClient.recoverIdentity(request);
183
+ response = await this._edgeClient.recoverIdentity(ctx, request);
180
184
  } catch (error: any) {
181
185
  if (!(error instanceof EdgeAuthChallengeError)) {
182
186
  throw error;
183
187
  }
184
188
  const signature = sign(Buffer.from(error.challenge, 'base64'), recoveryKeypair.secretKey);
185
- response = await this._edgeClient.recoverIdentity({
189
+ response = await this._edgeClient.recoverIdentity(ctx, {
186
190
  ...request,
187
191
  signature: Buffer.from(signature).toString('base64'),
188
192
  });
@@ -11,7 +11,6 @@ import { type Identity, type IdentityService } from '@dxos/protocols/proto/dxos/
11
11
 
12
12
  import { type ServiceContext } from '../services';
13
13
  import { createServiceContext } from '../testing';
14
-
15
14
  import { IdentityServiceImpl } from './identity-service';
16
15
 
17
16
  describe('IdentityService', () => {
@@ -48,6 +47,12 @@ describe('IdentityService', () => {
48
47
  await identityService.createIdentity({});
49
48
  await expect(identityService.createIdentity({})).rejects.toThrowError('Identity already exists');
50
49
  });
50
+
51
+ test('creates identity with no spaces', async () => {
52
+ await identityService.createIdentity({});
53
+ const dataSpaces = [...(serviceContext.dataSpaceManager?.spaces?.values() ?? [])];
54
+ expect(dataSpaces.length).to.eq(0);
55
+ });
51
56
  });
52
57
 
53
58
  describe.skip('recoverIdentity', () => {});
@@ -89,37 +94,11 @@ describe('IdentityService', () => {
89
94
  });
90
95
  });
91
96
 
92
- describe('open', () => {
93
- test('identity without default space fixed', async () => {
94
- const serviceContext = await createServiceContext();
95
- await serviceContext.open(new Context());
96
- const identity = await serviceContext.createIdentity();
97
- const identityService = createIdentityService(serviceContext);
98
- const getDataSpaces = () => [...(serviceContext.dataSpaceManager?.spaces?.values() ?? [])];
99
- expect(getDataSpaces().length).to.eq(0);
100
- expect(identity.defaultSpaceId).to.be.undefined;
101
- await identityService.open();
102
- expect(getDataSpaces()[0].id === identity.defaultSpaceId).to.be.true;
103
- });
104
-
105
- test('identity without default space credential fixed', async () => {
106
- const serviceContext = await createServiceContext();
107
- await serviceContext.open(new Context());
108
- const identity = await serviceContext.createIdentity();
109
- const space = await serviceContext.dataSpaceManager!.createDefaultSpace();
110
- const identityService = createIdentityService(serviceContext);
111
- expect(identity.defaultSpaceId).to.be.undefined;
112
- await identityService.open();
113
- expect(identity.defaultSpaceId === space.id).to.be.true;
114
- });
115
- });
116
-
117
97
  const createIdentityService = (serviceContext: ServiceContext) => {
118
98
  return new IdentityServiceImpl(
119
99
  serviceContext.identityManager,
120
100
  serviceContext.recoveryManager,
121
101
  serviceContext.keyring,
122
- () => serviceContext.dataSpaceManager!,
123
102
  (options) => serviceContext.createIdentity(options),
124
103
  );
125
104
  };