@dxos/client-services 0.5.9-main.21b00b3 → 0.5.9-main.2dbe289

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 (39) hide show
  1. package/dist/lib/browser/{chunk-6Y4QMNUK.mjs → chunk-QWL2M4EU.mjs} +589 -728
  2. package/dist/lib/browser/chunk-QWL2M4EU.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +9 -10
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/{chunk-FYT7BPEG.cjs → chunk-NPYJIVOX.cjs} +809 -944
  8. package/dist/lib/node/chunk-NPYJIVOX.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +42 -42
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +15 -16
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/identity/identity-service.d.ts +7 -14
  14. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity.d.ts +1 -4
  16. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/service-host.d.ts +1 -1
  18. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  19. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +3 -5
  20. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  21. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  22. package/dist/types/src/packlets/testing/test-builder.d.ts +6 -8
  23. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  24. package/dist/types/src/version.d.ts +1 -1
  25. package/package.json +36 -36
  26. package/src/packlets/identity/identity-service.test.ts +5 -35
  27. package/src/packlets/identity/identity-service.ts +8 -50
  28. package/src/packlets/identity/identity.ts +2 -25
  29. package/src/packlets/services/service-host.ts +40 -13
  30. package/src/packlets/spaces/data-space-manager.test.ts +1 -46
  31. package/src/packlets/spaces/data-space-manager.ts +25 -54
  32. package/src/packlets/spaces/data-space.ts +5 -9
  33. package/src/packlets/testing/test-builder.ts +6 -11
  34. package/src/version.ts +1 -1
  35. package/dist/lib/browser/chunk-6Y4QMNUK.mjs.map +0 -7
  36. package/dist/lib/node/chunk-FYT7BPEG.cjs.map +0 -7
  37. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
  38. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
  39. package/src/packlets/identity/default-space-state-machine.ts +0 -44
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_FYT7BPEG_exports = {};
30
- __export(chunk_FYT7BPEG_exports, {
29
+ var chunk_NPYJIVOX_exports = {};
30
+ __export(chunk_NPYJIVOX_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -67,7 +67,7 @@ __export(chunk_FYT7BPEG_exports, {
67
67
  subscribeToSpaces: () => subscribeToSpaces,
68
68
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
69
69
  });
70
- module.exports = __toCommonJS(chunk_FYT7BPEG_exports);
70
+ module.exports = __toCommonJS(chunk_NPYJIVOX_exports);
71
71
  var import_async = require("@dxos/async");
72
72
  var import_codec_protobuf = require("@dxos/codec-protobuf");
73
73
  var import_feed_store = require("@dxos/feed-store");
@@ -107,206 +107,200 @@ var import_invariant2 = require("@dxos/invariant");
107
107
  var import_keys3 = require("@dxos/keys");
108
108
  var import_log2 = require("@dxos/log");
109
109
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
110
- var import_timeframe = require("@dxos/timeframe");
111
110
  var import_tracing3 = require("@dxos/tracing");
112
111
  var import_util2 = require("@dxos/util");
113
- var import_credentials5 = require("@dxos/credentials");
114
- var import_keys4 = require("@dxos/keys");
115
- var import_log3 = require("@dxos/log");
116
112
  var import_platform = __toESM(require("platform"));
117
113
  var import_async7 = require("@dxos/async");
118
114
  var import_context3 = require("@dxos/context");
119
- var import_credentials6 = require("@dxos/credentials");
115
+ var import_credentials5 = require("@dxos/credentials");
120
116
  var import_invariant3 = require("@dxos/invariant");
121
- var import_keys5 = require("@dxos/keys");
122
- var import_log4 = require("@dxos/log");
117
+ var import_keys4 = require("@dxos/keys");
118
+ var import_log3 = require("@dxos/log");
123
119
  var import_protocols3 = require("@dxos/protocols");
124
120
  var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
125
- var import_credentials7 = require("@dxos/protocols/proto/dxos/halo/credentials");
121
+ var import_credentials6 = require("@dxos/protocols/proto/dxos/halo/credentials");
126
122
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
127
- var import_timeframe2 = require("@dxos/timeframe");
123
+ var import_timeframe = require("@dxos/timeframe");
128
124
  var import_tracing4 = require("@dxos/tracing");
129
125
  var import_util3 = require("@dxos/util");
130
126
  var import_codec_protobuf9 = require("@dxos/codec-protobuf");
131
- var import_context4 = require("@dxos/context");
132
- var import_credentials8 = require("@dxos/credentials");
127
+ var import_credentials7 = require("@dxos/credentials");
133
128
  var import_debug2 = require("@dxos/debug");
134
129
  var import_invariant4 = require("@dxos/invariant");
135
- var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
136
130
  var import_invariant5 = require("@dxos/invariant");
137
131
  var import_protocols4 = require("@dxos/protocols");
138
- var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
132
+ var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
139
133
  var import_async8 = require("@dxos/async");
140
134
  var import_client_protocol2 = require("@dxos/client-protocol");
141
- var import_context5 = require("@dxos/context");
135
+ var import_context4 = require("@dxos/context");
142
136
  var import_crypto = require("@dxos/crypto");
143
137
  var import_invariant6 = require("@dxos/invariant");
144
- var import_keys6 = require("@dxos/keys");
145
- var import_log5 = require("@dxos/log");
138
+ var import_keys5 = require("@dxos/keys");
139
+ var import_log4 = require("@dxos/log");
146
140
  var import_network_manager = require("@dxos/network-manager");
147
141
  var import_protocols5 = require("@dxos/protocols");
148
- var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
142
+ var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
149
143
  var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
150
144
  var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
151
145
  var import_util4 = require("@dxos/util");
152
146
  var import_async9 = require("@dxos/async");
153
- var import_context6 = require("@dxos/context");
147
+ var import_context5 = require("@dxos/context");
154
148
  var import_invariant7 = require("@dxos/invariant");
155
- var import_log6 = require("@dxos/log");
149
+ var import_log5 = require("@dxos/log");
156
150
  var import_protocols6 = require("@dxos/protocols");
157
151
  var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
158
152
  var import_teleport = require("@dxos/teleport");
159
- var import_context7 = require("@dxos/context");
160
- var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
153
+ var import_context6 = require("@dxos/context");
154
+ var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
161
155
  var import_async10 = require("@dxos/async");
162
- var import_context8 = require("@dxos/context");
156
+ var import_context7 = require("@dxos/context");
163
157
  var import_crypto2 = require("@dxos/crypto");
164
158
  var import_invariant8 = require("@dxos/invariant");
165
- var import_keys7 = require("@dxos/keys");
166
- var import_log7 = require("@dxos/log");
159
+ var import_keys6 = require("@dxos/keys");
160
+ var import_log6 = require("@dxos/log");
167
161
  var import_protocols7 = require("@dxos/protocols");
168
- var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
162
+ var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
169
163
  var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
170
164
  var import_teleport2 = require("@dxos/teleport");
171
165
  var import_invariant9 = require("@dxos/invariant");
172
- var import_keys8 = require("@dxos/keys");
173
- var import_log8 = require("@dxos/log");
166
+ var import_keys7 = require("@dxos/keys");
167
+ var import_log7 = require("@dxos/log");
174
168
  var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
175
169
  var import_util5 = require("@dxos/util");
176
170
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
177
- var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
178
- var import_credentials9 = require("@dxos/credentials");
171
+ var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
172
+ var import_credentials8 = require("@dxos/credentials");
179
173
  var import_feed_store3 = require("@dxos/feed-store");
180
174
  var import_invariant10 = require("@dxos/invariant");
181
- var import_log9 = require("@dxos/log");
175
+ var import_log8 = require("@dxos/log");
182
176
  var import_protocols8 = require("@dxos/protocols");
183
- var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
184
- var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
177
+ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
178
+ var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
185
179
  var import_async11 = require("@dxos/async");
186
180
  var import_client_protocol3 = require("@dxos/client-protocol");
187
- var import_context9 = require("@dxos/context");
188
- var import_credentials11 = require("@dxos/credentials");
181
+ var import_context8 = require("@dxos/context");
182
+ var import_credentials10 = require("@dxos/credentials");
189
183
  var import_echo_pipeline = require("@dxos/echo-pipeline");
190
184
  var import_invariant11 = require("@dxos/invariant");
191
- var import_keys9 = require("@dxos/keys");
192
- var import_log10 = require("@dxos/log");
193
- var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
194
- var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
185
+ var import_keys8 = require("@dxos/keys");
186
+ var import_log9 = require("@dxos/log");
187
+ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
188
+ var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
195
189
  var import_async12 = require("@dxos/async");
196
190
  var import_client_protocol4 = require("@dxos/client-protocol");
197
- var import_context10 = require("@dxos/context");
191
+ var import_context9 = require("@dxos/context");
198
192
  var import_debug3 = require("@dxos/debug");
199
193
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
200
194
  var import_echo_schema = require("@dxos/echo-schema");
201
195
  var import_invariant12 = require("@dxos/invariant");
202
- var import_keys10 = require("@dxos/keys");
203
- var import_log11 = require("@dxos/log");
196
+ var import_keys9 = require("@dxos/keys");
197
+ var import_log10 = require("@dxos/log");
204
198
  var import_protocols9 = require("@dxos/protocols");
205
- var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
206
- var import_credentials13 = require("@dxos/protocols/proto/dxos/halo/credentials");
207
- var import_timeframe3 = require("@dxos/timeframe");
199
+ var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
200
+ var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
201
+ var import_timeframe2 = require("@dxos/timeframe");
208
202
  var import_tracing5 = require("@dxos/tracing");
209
203
  var import_util6 = require("@dxos/util");
210
204
  var import_async13 = require("@dxos/async");
211
- var import_credentials14 = require("@dxos/credentials");
205
+ var import_credentials13 = require("@dxos/credentials");
212
206
  var import_async14 = require("@dxos/async");
213
- var import_context11 = require("@dxos/context");
207
+ var import_context10 = require("@dxos/context");
214
208
  var import_invariant13 = require("@dxos/invariant");
215
- var import_keys11 = require("@dxos/keys");
216
- var import_log12 = require("@dxos/log");
209
+ var import_keys10 = require("@dxos/keys");
210
+ var import_log11 = require("@dxos/log");
217
211
  var import_protocols10 = require("@dxos/protocols");
218
212
  var import_teleport3 = require("@dxos/teleport");
219
213
  var import_util7 = require("@dxos/util");
220
214
  var import_async15 = require("@dxos/async");
221
- var import_client_protocol5 = require("@dxos/client-protocol");
222
- var import_context12 = require("@dxos/context");
223
- var import_credentials15 = require("@dxos/credentials");
215
+ var import_context11 = require("@dxos/context");
216
+ var import_credentials14 = require("@dxos/credentials");
224
217
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
225
- var import_echo_protocol = require("@dxos/echo-protocol");
226
- var import_echo_schema2 = require("@dxos/echo-schema");
227
218
  var import_invariant14 = require("@dxos/invariant");
228
- var import_keys12 = require("@dxos/keys");
229
- var import_log13 = require("@dxos/log");
219
+ var import_keys11 = require("@dxos/keys");
220
+ var import_log12 = require("@dxos/log");
230
221
  var import_protocols11 = require("@dxos/protocols");
231
- var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
232
- var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
222
+ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
223
+ var import_credentials15 = require("@dxos/protocols/proto/dxos/halo/credentials");
233
224
  var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
234
225
  var import_tracing6 = require("@dxos/tracing");
235
226
  var import_util8 = require("@dxos/util");
236
- var import_credentials17 = require("@dxos/credentials");
227
+ var import_credentials16 = require("@dxos/credentials");
237
228
  var import_debug4 = require("@dxos/debug");
238
- var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
239
- var import_timeframe4 = require("@dxos/timeframe");
229
+ var import_credentials17 = require("@dxos/protocols/proto/dxos/halo/credentials");
230
+ var import_timeframe3 = require("@dxos/timeframe");
240
231
  var import_async16 = require("@dxos/async");
241
232
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
242
- var import_credentials19 = require("@dxos/credentials");
233
+ var import_credentials18 = require("@dxos/credentials");
243
234
  var import_debug5 = require("@dxos/debug");
244
235
  var import_feed_store4 = require("@dxos/feed-store");
245
236
  var import_invariant15 = require("@dxos/invariant");
246
- var import_log14 = require("@dxos/log");
237
+ var import_log13 = require("@dxos/log");
247
238
  var import_protocols12 = require("@dxos/protocols");
248
- var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
239
+ var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
249
240
  var import_tracing7 = require("@dxos/tracing");
250
241
  var import_async17 = require("@dxos/async");
251
- var import_context13 = require("@dxos/context");
252
- var import_credentials20 = require("@dxos/credentials");
242
+ var import_context12 = require("@dxos/context");
243
+ var import_credentials19 = require("@dxos/credentials");
253
244
  var import_debug6 = require("@dxos/debug");
254
245
  var import_echo_db = require("@dxos/echo-db");
255
246
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
256
247
  var import_feed_store5 = require("@dxos/feed-store");
257
248
  var import_invariant16 = require("@dxos/invariant");
258
249
  var import_keyring = require("@dxos/keyring");
259
- var import_keys13 = require("@dxos/keys");
260
- var import_log15 = require("@dxos/log");
250
+ var import_keys12 = require("@dxos/keys");
251
+ var import_log14 = require("@dxos/log");
261
252
  var import_protocols13 = require("@dxos/protocols");
262
- var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
253
+ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
263
254
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
264
255
  var import_tracing8 = require("@dxos/tracing");
265
256
  var import_util9 = require("@dxos/util");
266
257
  var import_invariant17 = require("@dxos/invariant");
267
258
  var import_lock_file = require("@dxos/lock-file");
268
- var import_log16 = require("@dxos/log");
259
+ var import_log15 = require("@dxos/log");
269
260
  var import_protocols14 = require("@dxos/protocols");
270
261
  var import_config = require("@dxos/protocols/proto/dxos/config");
271
262
  var import_random_access_storage = require("@dxos/random-access-storage");
272
- var import_client_protocol6 = require("@dxos/client-protocol");
263
+ var import_client_protocol5 = require("@dxos/client-protocol");
273
264
  var import_config2 = require("@dxos/protocols/proto/dxos/config");
274
265
  var import_util10 = require("@dxos/util");
275
266
  var import_node_path = __toESM(require("node:path"));
276
- var import_keys14 = require("@dxos/keys");
267
+ var import_keys13 = require("@dxos/keys");
277
268
  var import_kv_store = require("@dxos/kv-store");
278
269
  var import_async18 = require("@dxos/async");
279
- var import_client_protocol7 = require("@dxos/client-protocol");
280
- var import_context14 = require("@dxos/context");
270
+ var import_client_protocol6 = require("@dxos/client-protocol");
271
+ var import_context13 = require("@dxos/context");
272
+ var import_echo_protocol = require("@dxos/echo-protocol");
273
+ var import_echo_schema2 = require("@dxos/echo-schema");
281
274
  var import_invariant18 = require("@dxos/invariant");
282
- var import_keys15 = require("@dxos/keys");
283
- var import_log17 = require("@dxos/log");
275
+ var import_keys14 = require("@dxos/keys");
276
+ var import_log16 = require("@dxos/log");
284
277
  var import_messaging = require("@dxos/messaging");
285
278
  var import_network_manager2 = require("@dxos/network-manager");
286
279
  var import_protocols15 = require("@dxos/protocols");
287
- var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
280
+ var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
288
281
  var import_tracing9 = require("@dxos/tracing");
282
+ var import_util11 = require("@dxos/util");
289
283
  var import_websocket_rpc = require("@dxos/websocket-rpc");
290
284
  var import_async19 = require("@dxos/async");
291
285
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
292
286
  var import_invariant19 = require("@dxos/invariant");
293
- var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
287
+ var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
294
288
  var import_config3 = require("@dxos/config");
295
- var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
289
+ var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
296
290
  var import_tracing10 = require("@dxos/tracing");
297
- var import_util11 = require("@dxos/util");
298
- var import_keys16 = require("@dxos/keys");
299
291
  var import_util12 = require("@dxos/util");
292
+ var import_keys15 = require("@dxos/keys");
293
+ var import_util13 = require("@dxos/util");
300
294
  var import_async20 = require("@dxos/async");
301
295
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
302
- var import_keys17 = require("@dxos/keys");
303
- var import_log18 = require("@dxos/log");
304
- var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
305
- var import_util13 = require("@dxos/util");
296
+ var import_keys16 = require("@dxos/keys");
297
+ var import_log17 = require("@dxos/log");
298
+ var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
299
+ var import_util14 = require("@dxos/util");
306
300
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
307
301
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
308
- var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
309
- var import_util14 = require("@dxos/util");
302
+ var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
303
+ var import_util15 = require("@dxos/util");
310
304
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
311
305
  return new import_codec_protobuf.Stream(({ next }) => {
312
306
  const subscriptions = new import_async.EventSubscriptions();
@@ -617,7 +611,7 @@ var DevtoolsServiceImpl = class {
617
611
  });
618
612
  }
619
613
  };
620
- var DXOS_VERSION = "0.5.9-main.21b00b3";
614
+ var DXOS_VERSION = "0.5.9-main.2dbe289";
621
615
  var getPlatform = () => {
622
616
  if (process.browser) {
623
617
  if (typeof window !== "undefined") {
@@ -959,47 +953,6 @@ var TrustedKeySetAuthVerifier = class {
959
953
  return deviceSet.has(deviceKey);
960
954
  }
961
955
  };
962
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
963
- var DefaultSpaceStateMachine = class {
964
- constructor(_params) {
965
- this._params = _params;
966
- }
967
- get spaceId() {
968
- return this._spaceId;
969
- }
970
- async processCredential(credential) {
971
- const assertion = (0, import_credentials5.getCredentialAssertion)(credential);
972
- switch (assertion["@type"]) {
973
- case "dxos.halo.credentials.DefaultSpace": {
974
- if (!credential.subject.id.equals(this._params.identityKey)) {
975
- import_log3.log.warn("Invalid default space credential", {
976
- expectedIdentity: this._params.identityKey,
977
- credential
978
- }, {
979
- F: __dxlog_file3,
980
- L: 32,
981
- S: this,
982
- C: (f, a) => f(...a)
983
- });
984
- return;
985
- }
986
- if (!import_keys4.SpaceId.isValid(assertion.spaceId)) {
987
- import_log3.log.warn("Invalid default space id", {
988
- id: assertion.spaceId
989
- }, {
990
- F: __dxlog_file3,
991
- L: 36,
992
- S: this,
993
- C: (f, a) => f(...a)
994
- });
995
- return;
996
- }
997
- this._spaceId = assertion.spaceId;
998
- break;
999
- }
1000
- }
1001
- }
1002
- };
1003
956
  function _ts_decorate2(decorators, target, key, desc) {
1004
957
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1005
958
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -1010,7 +963,7 @@ function _ts_decorate2(decorators, target, key, desc) {
1010
963
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1011
964
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1012
965
  }
1013
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
966
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
1014
967
  var Identity = class {
1015
968
  constructor({ space, signer, identityKey, deviceKey, presence }) {
1016
969
  this.stateUpdate = new import_async6.Event();
@@ -1022,8 +975,8 @@ var Identity = class {
1022
975
  import_log2.log.trace("dxos.halo.device", {
1023
976
  deviceKey
1024
977
  }, {
1025
- F: __dxlog_file4,
1026
- L: 70,
978
+ F: __dxlog_file3,
979
+ L: 67,
1027
980
  S: this,
1028
981
  C: (f, a) => f(...a)
1029
982
  });
@@ -1036,10 +989,6 @@ var Identity = class {
1036
989
  identityKey: this.identityKey,
1037
990
  onUpdate: () => this.stateUpdate.emit()
1038
991
  });
1039
- this._defaultSpaceStateMachine = new DefaultSpaceStateMachine({
1040
- identityKey: this.identityKey,
1041
- onUpdate: () => this.stateUpdate.emit()
1042
- });
1043
992
  this.authVerifier = new TrustedKeySetAuthVerifier({
1044
993
  trustedKeysProvider: () => new import_util2.ComplexSet(import_keys3.PublicKey.hash, this.authorizedDeviceKeys.keys()),
1045
994
  update: this.stateUpdate,
@@ -1050,20 +999,14 @@ var Identity = class {
1050
999
  get authorizedDeviceKeys() {
1051
1000
  return this._deviceStateMachine.authorizedDeviceKeys;
1052
1001
  }
1053
- get defaultSpaceId() {
1054
- return this._defaultSpaceStateMachine.spaceId;
1055
- }
1056
1002
  async open(ctx) {
1057
- await this._presence?.open();
1058
1003
  await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
1059
1004
  await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
1060
- await this.space.spaceState.addCredentialProcessor(this._defaultSpaceStateMachine);
1061
1005
  await this.space.open(ctx);
1062
1006
  }
1063
1007
  async close(ctx) {
1064
- await this._presence?.close();
1008
+ await this._presence?.destroy();
1065
1009
  await this.authVerifier.close();
1066
- await this.space.spaceState.removeCredentialProcessor(this._defaultSpaceStateMachine);
1067
1010
  await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
1068
1011
  await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
1069
1012
  await this.space.close();
@@ -1101,8 +1044,8 @@ var Identity = class {
1101
1044
  */
1102
1045
  getIdentityCredentialSigner() {
1103
1046
  (0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
1104
- F: __dxlog_file4,
1105
- L: 159,
1047
+ F: __dxlog_file3,
1048
+ L: 145,
1106
1049
  S: this,
1107
1050
  A: [
1108
1051
  "this._deviceStateMachine.deviceCredentialChain",
@@ -1117,26 +1060,6 @@ var Identity = class {
1117
1060
  getDeviceCredentialSigner() {
1118
1061
  return (0, import_credentials3.createCredentialSignerWithKey)(this._signer, this.deviceKey);
1119
1062
  }
1120
- async updateDefaultSpace(spaceId) {
1121
- const credential = await this.getDeviceCredentialSigner().createCredential({
1122
- subject: this.identityKey,
1123
- assertion: {
1124
- "@type": "dxos.halo.credentials.DefaultSpace",
1125
- spaceId
1126
- }
1127
- });
1128
- const receipt = await this.controlPipeline.writer.write({
1129
- credential: {
1130
- credential
1131
- }
1132
- });
1133
- await this.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
1134
- [
1135
- receipt.feedKey,
1136
- receipt.seq
1137
- ]
1138
- ]));
1139
- }
1140
1063
  async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
1141
1064
  (0, import_log2.log)("Admitting device:", {
1142
1065
  identityKey: this.identityKey,
@@ -1145,8 +1068,8 @@ var Identity = class {
1145
1068
  controlFeedKey,
1146
1069
  dataFeedKey
1147
1070
  }, {
1148
- F: __dxlog_file4,
1149
- L: 184,
1071
+ F: __dxlog_file3,
1072
+ L: 161,
1150
1073
  S: this,
1151
1074
  C: (f, a) => f(...a)
1152
1075
  });
@@ -1206,7 +1129,7 @@ function _ts_decorate3(decorators, target, key, desc) {
1206
1129
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1207
1130
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1208
1131
  }
1209
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1132
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1210
1133
  var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
1211
1134
  var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
1212
1135
  var IdentityManager = class {
@@ -1226,20 +1149,20 @@ var IdentityManager = class {
1226
1149
  return this._identity;
1227
1150
  }
1228
1151
  async open(ctx) {
1229
- const traceId = import_keys5.PublicKey.random().toHex();
1230
- import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
1152
+ const traceId = import_keys4.PublicKey.random().toHex();
1153
+ import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
1231
1154
  id: traceId
1232
1155
  }), {
1233
- F: __dxlog_file5,
1156
+ F: __dxlog_file4,
1234
1157
  L: 104,
1235
1158
  S: this,
1236
1159
  C: (f, a) => f(...a)
1237
1160
  });
1238
1161
  const identityRecord = this._metadataStore.getIdentityRecord();
1239
- (0, import_log4.log)("identity record", {
1162
+ (0, import_log3.log)("identity record", {
1240
1163
  identityRecord
1241
1164
  }, {
1242
- F: __dxlog_file5,
1165
+ F: __dxlog_file4,
1243
1166
  L: 107,
1244
1167
  S: this,
1245
1168
  C: (f, a) => f(...a)
@@ -1248,21 +1171,21 @@ var IdentityManager = class {
1248
1171
  this._identity = await this._constructIdentity(identityRecord);
1249
1172
  await this._identity.open(ctx);
1250
1173
  await this._identity.ready();
1251
- import_log4.log.trace("dxos.halo.identity", {
1174
+ import_log3.log.trace("dxos.halo.identity", {
1252
1175
  identityKey: identityRecord.identityKey,
1253
1176
  displayName: this._identity.profileDocument?.displayName
1254
1177
  }, {
1255
- F: __dxlog_file5,
1178
+ F: __dxlog_file4,
1256
1179
  L: 112,
1257
1180
  S: this,
1258
1181
  C: (f, a) => f(...a)
1259
1182
  });
1260
1183
  this.stateUpdate.emit();
1261
1184
  }
1262
- import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
1185
+ import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
1263
1186
  id: traceId
1264
1187
  }), {
1265
- F: __dxlog_file5,
1188
+ F: __dxlog_file4,
1266
1189
  L: 119,
1267
1190
  S: this,
1268
1191
  C: (f, a) => f(...a)
@@ -1273,7 +1196,7 @@ var IdentityManager = class {
1273
1196
  }
1274
1197
  async createIdentity({ displayName, deviceProfile } = {}) {
1275
1198
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
1276
- F: __dxlog_file5,
1199
+ F: __dxlog_file4,
1277
1200
  L: 128,
1278
1201
  S: this,
1279
1202
  A: [
@@ -1281,8 +1204,8 @@ var IdentityManager = class {
1281
1204
  "'Identity already exists.'"
1282
1205
  ]
1283
1206
  });
1284
- (0, import_log4.log)("creating identity...", void 0, {
1285
- F: __dxlog_file5,
1207
+ (0, import_log3.log)("creating identity...", void 0, {
1208
+ F: __dxlog_file4,
1286
1209
  L: 129,
1287
1210
  S: this,
1288
1211
  C: (f, a) => f(...a)
@@ -1301,9 +1224,9 @@ var IdentityManager = class {
1301
1224
  const identity = await this._constructIdentity(identityRecord);
1302
1225
  await identity.open(new import_context3.Context());
1303
1226
  {
1304
- const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
1227
+ const generator = new import_credentials5.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
1305
1228
  (0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
1306
- F: __dxlog_file5,
1229
+ F: __dxlog_file4,
1307
1230
  L: 148,
1308
1231
  S: this,
1309
1232
  A: [
@@ -1312,7 +1235,7 @@ var IdentityManager = class {
1312
1235
  ]
1313
1236
  });
1314
1237
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
1315
- F: __dxlog_file5,
1238
+ F: __dxlog_file4,
1316
1239
  L: 149,
1317
1240
  S: this,
1318
1241
  A: [
@@ -1324,7 +1247,7 @@ var IdentityManager = class {
1324
1247
  // Space genesis.
1325
1248
  ...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
1326
1249
  // Feed admission.
1327
- await generator.createFeedAdmission(identityRecord.haloSpace.key, identityRecord.haloSpace.dataFeedKey, import_credentials7.AdmittedFeed.Designation.DATA)
1250
+ await generator.createFeedAdmission(identityRecord.haloSpace.key, identityRecord.haloSpace.dataFeedKey, import_credentials6.AdmittedFeed.Designation.DATA)
1328
1251
  ];
1329
1252
  if (displayName) {
1330
1253
  credentials.push(await generator.createProfileCredential({
@@ -1347,22 +1270,22 @@ var IdentityManager = class {
1347
1270
  await this._metadataStore.setIdentityRecord(identityRecord);
1348
1271
  this._identity = identity;
1349
1272
  await this._identity.ready();
1350
- import_log4.log.trace("dxos.halo.identity", {
1273
+ import_log3.log.trace("dxos.halo.identity", {
1351
1274
  identityKey: identityRecord.identityKey,
1352
1275
  displayName: this._identity.profileDocument?.displayName
1353
1276
  }, {
1354
- F: __dxlog_file5,
1277
+ F: __dxlog_file4,
1355
1278
  L: 191,
1356
1279
  S: this,
1357
1280
  C: (f, a) => f(...a)
1358
1281
  });
1359
1282
  this.stateUpdate.emit();
1360
- (0, import_log4.log)("created identity", {
1283
+ (0, import_log3.log)("created identity", {
1361
1284
  identityKey: identity.identityKey,
1362
1285
  deviceKey: identity.deviceKey,
1363
1286
  profile: identity.profileDocument
1364
1287
  }, {
1365
- F: __dxlog_file5,
1288
+ F: __dxlog_file4,
1366
1289
  L: 197,
1367
1290
  S: this,
1368
1291
  C: (f, a) => f(...a)
@@ -1373,14 +1296,14 @@ var IdentityManager = class {
1373
1296
  createDefaultDeviceProfile() {
1374
1297
  let type;
1375
1298
  if ((0, import_util3.isNode)()) {
1376
- type = import_credentials7.DeviceType.AGENT;
1299
+ type = import_credentials6.DeviceType.AGENT;
1377
1300
  } else {
1378
1301
  if (import_platform.default.name?.startsWith("iOS") || import_platform.default.name?.startsWith("Android")) {
1379
- type = import_credentials7.DeviceType.MOBILE;
1302
+ type = import_credentials6.DeviceType.MOBILE;
1380
1303
  } else if (globalThis.__args) {
1381
- type = import_credentials7.DeviceType.NATIVE;
1304
+ type = import_credentials6.DeviceType.NATIVE;
1382
1305
  } else {
1383
- type = import_credentials7.DeviceType.BROWSER;
1306
+ type = import_credentials6.DeviceType.BROWSER;
1384
1307
  }
1385
1308
  }
1386
1309
  return {
@@ -1396,16 +1319,16 @@ var IdentityManager = class {
1396
1319
  * Accept an existing identity. Expects its device key to be authorized (now or later).
1397
1320
  */
1398
1321
  async acceptIdentity(params) {
1399
- (0, import_log4.log)("accepting identity", {
1322
+ (0, import_log3.log)("accepting identity", {
1400
1323
  params
1401
1324
  }, {
1402
- F: __dxlog_file5,
1325
+ F: __dxlog_file4,
1403
1326
  L: 235,
1404
1327
  S: this,
1405
1328
  C: (f, a) => f(...a)
1406
1329
  });
1407
1330
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
1408
- F: __dxlog_file5,
1331
+ F: __dxlog_file4,
1409
1332
  L: 236,
1410
1333
  S: this,
1411
1334
  A: [
@@ -1429,11 +1352,11 @@ var IdentityManager = class {
1429
1352
  this._identity = identity;
1430
1353
  await this._metadataStore.setIdentityRecord(identityRecord);
1431
1354
  await this._identity.ready();
1432
- import_log4.log.trace("dxos.halo.identity", {
1355
+ import_log3.log.trace("dxos.halo.identity", {
1433
1356
  identityKey: identityRecord.identityKey,
1434
1357
  displayName: this._identity.profileDocument?.displayName
1435
1358
  }, {
1436
- F: __dxlog_file5,
1359
+ F: __dxlog_file4,
1437
1360
  L: 255,
1438
1361
  S: this,
1439
1362
  C: (f, a) => f(...a)
@@ -1443,11 +1366,11 @@ var IdentityManager = class {
1443
1366
  ...params.deviceProfile
1444
1367
  });
1445
1368
  this.stateUpdate.emit();
1446
- (0, import_log4.log)("accepted identity", {
1369
+ (0, import_log3.log)("accepted identity", {
1447
1370
  identityKey: identity.identityKey,
1448
1371
  deviceKey: identity.deviceKey
1449
1372
  }, {
1450
- F: __dxlog_file5,
1373
+ F: __dxlog_file4,
1451
1374
  L: 265,
1452
1375
  S: this,
1453
1376
  C: (f, a) => f(...a)
@@ -1459,7 +1382,7 @@ var IdentityManager = class {
1459
1382
  */
1460
1383
  async updateProfile(profile) {
1461
1384
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
1462
- F: __dxlog_file5,
1385
+ F: __dxlog_file4,
1463
1386
  L: 273,
1464
1387
  S: this,
1465
1388
  A: [
@@ -1479,7 +1402,7 @@ var IdentityManager = class {
1479
1402
  credential
1480
1403
  }
1481
1404
  });
1482
- await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe2.Timeframe([
1405
+ await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
1483
1406
  [
1484
1407
  receipt.feedKey,
1485
1408
  receipt.seq
@@ -1490,7 +1413,7 @@ var IdentityManager = class {
1490
1413
  }
1491
1414
  async updateDeviceProfile(profile) {
1492
1415
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
1493
- F: __dxlog_file5,
1416
+ F: __dxlog_file4,
1494
1417
  L: 290,
1495
1418
  S: this,
1496
1419
  A: [
@@ -1510,7 +1433,7 @@ var IdentityManager = class {
1510
1433
  credential
1511
1434
  }
1512
1435
  });
1513
- await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe2.Timeframe([
1436
+ await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
1514
1437
  [
1515
1438
  receipt.feedKey,
1516
1439
  receipt.seq
@@ -1526,7 +1449,7 @@ var IdentityManager = class {
1526
1449
  }
1527
1450
  async _constructIdentity(identityRecord) {
1528
1451
  (0, import_invariant3.invariant)(!this._identity, void 0, {
1529
- F: __dxlog_file5,
1452
+ F: __dxlog_file4,
1530
1453
  L: 316,
1531
1454
  S: this,
1532
1455
  A: [
@@ -1534,10 +1457,10 @@ var IdentityManager = class {
1534
1457
  ""
1535
1458
  ]
1536
1459
  });
1537
- (0, import_log4.log)("constructing identity", {
1460
+ (0, import_log3.log)("constructing identity", {
1538
1461
  identityRecord
1539
1462
  }, {
1540
- F: __dxlog_file5,
1463
+ F: __dxlog_file4,
1541
1464
  L: 317,
1542
1465
  S: this,
1543
1466
  C: (f, a) => f(...a)
@@ -1552,7 +1475,7 @@ var IdentityManager = class {
1552
1475
  gossip
1553
1476
  });
1554
1477
  (0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
1555
- F: __dxlog_file5,
1478
+ F: __dxlog_file4,
1556
1479
  L: 330,
1557
1480
  S: this,
1558
1481
  A: [
@@ -1564,7 +1487,7 @@ var IdentityManager = class {
1564
1487
  writable: true
1565
1488
  });
1566
1489
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
1567
- F: __dxlog_file5,
1490
+ F: __dxlog_file4,
1568
1491
  L: 334,
1569
1492
  S: this,
1570
1493
  A: [
@@ -1580,7 +1503,7 @@ var IdentityManager = class {
1580
1503
  spaceRecord: identityRecord.haloSpace,
1581
1504
  swarmIdentity: {
1582
1505
  peerKey: identityRecord.deviceKey,
1583
- credentialProvider: createAuthProvider((0, import_credentials6.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
1506
+ credentialProvider: createAuthProvider((0, import_credentials5.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
1584
1507
  credentialAuthenticator: (0, import_util3.deferFunction)(() => identity.authVerifier.verifier)
1585
1508
  },
1586
1509
  gossip,
@@ -1595,10 +1518,10 @@ var IdentityManager = class {
1595
1518
  identityKey: identityRecord.identityKey,
1596
1519
  deviceKey: identityRecord.deviceKey
1597
1520
  });
1598
- (0, import_log4.log)("done", {
1521
+ (0, import_log3.log)("done", {
1599
1522
  identityKey: identityRecord.identityKey
1600
1523
  }, {
1601
- F: __dxlog_file5,
1524
+ F: __dxlog_file4,
1602
1525
  L: 360,
1603
1526
  S: this,
1604
1527
  C: (f, a) => f(...a)
@@ -1622,8 +1545,8 @@ var IdentityManager = class {
1622
1545
  }));
1623
1546
  },
1624
1547
  onAuthFailure: () => {
1625
- import_log4.log.warn("auth failure", void 0, {
1626
- F: __dxlog_file5,
1548
+ import_log3.log.warn("auth failure", void 0, {
1549
+ F: __dxlog_file4,
1627
1550
  L: 385,
1628
1551
  S: this,
1629
1552
  C: (f, a) => f(...a)
@@ -1645,45 +1568,21 @@ _ts_decorate3([
1645
1568
  IdentityManager = _ts_decorate3([
1646
1569
  import_tracing4.trace.resource()
1647
1570
  ], IdentityManager);
1648
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1649
- var IdentityServiceImpl = class extends import_context4.Resource {
1650
- constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
1651
- super();
1571
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1572
+ var IdentityServiceImpl = class {
1573
+ constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
1574
+ this._createIdentity = _createIdentity;
1652
1575
  this._identityManager = _identityManager;
1653
1576
  this._keyring = _keyring;
1654
- this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
1655
- this._createIdentity = _createIdentity;
1656
1577
  this._onProfileUpdate = _onProfileUpdate;
1657
1578
  }
1658
- async _open() {
1659
- const identity = this._identityManager.identity;
1660
- if (identity && !identity.defaultSpaceId) {
1661
- await this._fixIdentityWithoutDefaultSpace(identity);
1662
- }
1663
- }
1664
1579
  async createIdentity(request) {
1665
1580
  await this._createIdentity({
1666
1581
  displayName: request.profile?.displayName,
1667
1582
  deviceProfile: request.deviceProfile
1668
1583
  });
1669
- const dataSpaceManager = this._dataSpaceManagerProvider();
1670
- await this._createDefaultSpace(dataSpaceManager);
1671
1584
  return this._getIdentity();
1672
1585
  }
1673
- async _createDefaultSpace(dataSpaceManager) {
1674
- const space = await dataSpaceManager.createDefaultSpace();
1675
- const identity = this._identityManager.identity;
1676
- (0, import_invariant4.invariant)(identity, void 0, {
1677
- F: __dxlog_file6,
1678
- L: 54,
1679
- S: this,
1680
- A: [
1681
- "identity",
1682
- ""
1683
- ]
1684
- });
1685
- await identity.updateDefaultSpace(space.id);
1686
- }
1687
1586
  async recoverIdentity(request) {
1688
1587
  return (0, import_debug2.todo)();
1689
1588
  }
@@ -1708,8 +1607,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1708
1607
  }
1709
1608
  async updateProfile(profile) {
1710
1609
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1711
- F: __dxlog_file6,
1712
- L: 84,
1610
+ F: __dxlog_file5,
1611
+ L: 61,
1713
1612
  S: this,
1714
1613
  A: [
1715
1614
  "this._identityManager.identity",
@@ -1722,15 +1621,15 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1722
1621
  }
1723
1622
  async signPresentation({ presentation, nonce }) {
1724
1623
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1725
- F: __dxlog_file6,
1726
- L: 91,
1624
+ F: __dxlog_file5,
1625
+ L: 68,
1727
1626
  S: this,
1728
1627
  A: [
1729
1628
  "this._identityManager.identity",
1730
1629
  "'Identity not initialized.'"
1731
1630
  ]
1732
1631
  });
1733
- return await (0, import_credentials8.signPresentation)({
1632
+ return await (0, import_credentials7.signPresentation)({
1734
1633
  presentation,
1735
1634
  signer: this._keyring,
1736
1635
  signerKey: this._identityManager.identity.deviceKey,
@@ -1738,26 +1637,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1738
1637
  nonce
1739
1638
  });
1740
1639
  }
1741
- async _fixIdentityWithoutDefaultSpace(identity) {
1742
- let hasDefaultSpace = false;
1743
- const dataSpaceManager = this._dataSpaceManagerProvider();
1744
- for (const space of dataSpaceManager.spaces.values()) {
1745
- if (space.state === import_services4.SpaceState.CLOSED) {
1746
- await space.open();
1747
- await space.initializeDataPipeline();
1748
- }
1749
- if (await dataSpaceManager.isDefaultSpace(space)) {
1750
- await identity.updateDefaultSpace(space.id);
1751
- hasDefaultSpace = true;
1752
- break;
1753
- }
1754
- }
1755
- if (!hasDefaultSpace) {
1756
- await this._createDefaultSpace(dataSpaceManager);
1757
- }
1758
- }
1759
1640
  };
1760
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1641
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1761
1642
  var DeviceInvitationProtocol = class {
1762
1643
  constructor(_keyring, _getIdentity, _acceptIdentity) {
1763
1644
  this._keyring = _keyring;
@@ -1772,7 +1653,7 @@ var DeviceInvitationProtocol = class {
1772
1653
  }
1773
1654
  getInvitationContext() {
1774
1655
  return {
1775
- kind: import_services5.Invitation.Kind.DEVICE
1656
+ kind: import_services4.Invitation.Kind.DEVICE
1776
1657
  };
1777
1658
  }
1778
1659
  async delegate() {
@@ -1783,7 +1664,7 @@ var DeviceInvitationProtocol = class {
1783
1664
  }
1784
1665
  async admit(_, request) {
1785
1666
  (0, import_invariant5.invariant)(request.device, void 0, {
1786
- F: __dxlog_file7,
1667
+ F: __dxlog_file6,
1787
1668
  L: 50,
1788
1669
  S: this,
1789
1670
  A: [
@@ -1829,7 +1710,7 @@ var DeviceInvitationProtocol = class {
1829
1710
  }
1830
1711
  async accept(response, request) {
1831
1712
  (0, import_invariant5.invariant)(response.device, void 0, {
1832
- F: __dxlog_file7,
1713
+ F: __dxlog_file6,
1833
1714
  L: 95,
1834
1715
  S: this,
1835
1716
  A: [
@@ -1839,7 +1720,7 @@ var DeviceInvitationProtocol = class {
1839
1720
  });
1840
1721
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
1841
1722
  (0, import_invariant5.invariant)(request.device, void 0, {
1842
- F: __dxlog_file7,
1723
+ F: __dxlog_file6,
1843
1724
  L: 98,
1844
1725
  S: this,
1845
1726
  A: [
@@ -1864,21 +1745,21 @@ var DeviceInvitationProtocol = class {
1864
1745
  }
1865
1746
  };
1866
1747
  var stateToString = (state) => {
1867
- return Object.entries(import_services7.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
1748
+ return Object.entries(import_services6.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
1868
1749
  };
1869
1750
  var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
1870
1751
  let guard;
1871
- return (0, import_context7.cancelWithContext)(ctx, (async () => {
1752
+ return (0, import_context6.cancelWithContext)(ctx, (async () => {
1872
1753
  guard = await mutex.acquire();
1873
1754
  if (ctx.disposed) {
1874
1755
  guard.release();
1875
1756
  guard = void 0;
1876
- throw new import_context7.ContextDisposedError();
1757
+ throw new import_context6.ContextDisposedError();
1877
1758
  }
1878
1759
  return guard;
1879
1760
  })());
1880
1761
  };
1881
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1762
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1882
1763
  var OPTIONS_TIMEOUT = 1e4;
1883
1764
  var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1884
1765
  constructor(_invitationFlowMutex, _callbacks) {
@@ -1892,7 +1773,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1892
1773
  });
1893
1774
  this._invitationFlowMutex = _invitationFlowMutex;
1894
1775
  this._callbacks = _callbacks;
1895
- this._ctx = new import_context6.Context();
1776
+ this._ctx = new import_context5.Context();
1896
1777
  this._remoteOptionsTrigger = new import_async9.Trigger();
1897
1778
  this._invitationFlowLock = null;
1898
1779
  }
@@ -1904,7 +1785,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1904
1785
  InvitationHostService: {
1905
1786
  options: async (options) => {
1906
1787
  (0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
1907
- F: __dxlog_file8,
1788
+ F: __dxlog_file7,
1908
1789
  L: 63,
1909
1790
  S: this,
1910
1791
  A: [
@@ -1930,33 +1811,33 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1930
1811
  async onOpen(context) {
1931
1812
  await super.onOpen(context);
1932
1813
  try {
1933
- (0, import_log6.log)("guest acquire lock", void 0, {
1934
- F: __dxlog_file8,
1814
+ (0, import_log5.log)("guest acquire lock", void 0, {
1815
+ F: __dxlog_file7,
1935
1816
  L: 84,
1936
1817
  S: this,
1937
1818
  C: (f, a) => f(...a)
1938
1819
  });
1939
1820
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
1940
- (0, import_log6.log)("guest lock acquired", void 0, {
1941
- F: __dxlog_file8,
1821
+ (0, import_log5.log)("guest lock acquired", void 0, {
1822
+ F: __dxlog_file7,
1942
1823
  L: 86,
1943
1824
  S: this,
1944
1825
  C: (f, a) => f(...a)
1945
1826
  });
1946
- await (0, import_context6.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
1827
+ await (0, import_context5.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
1947
1828
  role: import_invitations3.Options.Role.GUEST
1948
1829
  }));
1949
- (0, import_log6.log)("options sent", void 0, {
1950
- F: __dxlog_file8,
1830
+ (0, import_log5.log)("options sent", void 0, {
1831
+ F: __dxlog_file7,
1951
1832
  L: 88,
1952
1833
  S: this,
1953
1834
  C: (f, a) => f(...a)
1954
1835
  });
1955
- await (0, import_context6.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1836
+ await (0, import_context5.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1956
1837
  timeout: OPTIONS_TIMEOUT
1957
1838
  }));
1958
- (0, import_log6.log)("options received", void 0, {
1959
- F: __dxlog_file8,
1839
+ (0, import_log5.log)("options received", void 0, {
1840
+ F: __dxlog_file7,
1960
1841
  L: 90,
1961
1842
  S: this,
1962
1843
  C: (f, a) => f(...a)
@@ -1989,8 +1870,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1989
1870
  if (this._invitationFlowLock != null) {
1990
1871
  this._invitationFlowLock.release();
1991
1872
  this._invitationFlowLock = null;
1992
- (0, import_log6.log)("invitation flow lock released", void 0, {
1993
- F: __dxlog_file8,
1873
+ (0, import_log5.log)("invitation flow lock released", void 0, {
1874
+ F: __dxlog_file7,
1994
1875
  L: 123,
1995
1876
  S: this,
1996
1877
  C: (f, a) => f(...a)
@@ -1998,7 +1879,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1998
1879
  }
1999
1880
  }
2000
1881
  };
2001
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
1882
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
2002
1883
  var OPTIONS_TIMEOUT2 = 1e4;
2003
1884
  var MAX_OTP_ATTEMPTS = 3;
2004
1885
  var InvitationHostExtension = class extends import_teleport2.RpcExtension {
@@ -2013,7 +1894,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2013
1894
  });
2014
1895
  this._invitationFlowMutex = _invitationFlowMutex;
2015
1896
  this._callbacks = _callbacks;
2016
- this._ctx = new import_context8.Context();
1897
+ this._ctx = new import_context7.Context();
2017
1898
  this._remoteOptionsTrigger = new import_async10.Trigger();
2018
1899
  this._challenge = void 0;
2019
1900
  this.guestProfile = void 0;
@@ -2032,7 +1913,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2032
1913
  InvitationHostService: {
2033
1914
  options: async (options) => {
2034
1915
  (0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
2035
- F: __dxlog_file9,
1916
+ F: __dxlog_file8,
2036
1917
  L: 101,
2037
1918
  S: this,
2038
1919
  A: [
@@ -2045,23 +1926,23 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2045
1926
  },
2046
1927
  introduce: async (request) => {
2047
1928
  const { profile, invitationId } = request;
2048
- const traceId = import_keys7.PublicKey.random().toHex();
2049
- import_log7.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
1929
+ const traceId = import_keys6.PublicKey.random().toHex();
1930
+ import_log6.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
2050
1931
  id: traceId
2051
1932
  }), {
2052
- F: __dxlog_file9,
1933
+ F: __dxlog_file8,
2053
1934
  L: 110,
2054
1935
  S: this,
2055
1936
  C: (f, a) => f(...a)
2056
1937
  });
2057
1938
  const invitation = this._requireActiveInvitation();
2058
- this._assertInvitationState(import_services8.Invitation.State.CONNECTED);
1939
+ this._assertInvitationState(import_services7.Invitation.State.CONNECTED);
2059
1940
  if (invitationId !== invitation?.invitationId) {
2060
- import_log7.log.warn("incorrect invitationId", {
1941
+ import_log6.log.warn("incorrect invitationId", {
2061
1942
  expected: invitation.invitationId,
2062
1943
  actual: invitationId
2063
1944
  }, {
2064
- F: __dxlog_file9,
1945
+ F: __dxlog_file8,
2065
1946
  L: 116,
2066
1947
  S: this,
2067
1948
  C: (f, a) => f(...a)
@@ -2069,24 +1950,24 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2069
1950
  this._callbacks.onError(new Error("Incorrect invitationId."));
2070
1951
  (0, import_async10.scheduleTask)(this._ctx, () => this.close());
2071
1952
  return {
2072
- authMethod: import_services8.Invitation.AuthMethod.NONE
1953
+ authMethod: import_services7.Invitation.AuthMethod.NONE
2073
1954
  };
2074
1955
  }
2075
- (0, import_log7.log)("guest introduced themselves", {
1956
+ (0, import_log6.log)("guest introduced themselves", {
2076
1957
  guestProfile: profile
2077
1958
  }, {
2078
- F: __dxlog_file9,
1959
+ F: __dxlog_file8,
2079
1960
  L: 125,
2080
1961
  S: this,
2081
1962
  C: (f, a) => f(...a)
2082
1963
  });
2083
1964
  this.guestProfile = profile;
2084
- this._callbacks.onStateUpdate(import_services8.Invitation.State.READY_FOR_AUTHENTICATION);
2085
- this._challenge = invitation.authMethod === import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
2086
- import_log7.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
1965
+ this._callbacks.onStateUpdate(import_services7.Invitation.State.READY_FOR_AUTHENTICATION);
1966
+ this._challenge = invitation.authMethod === import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
1967
+ import_log6.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
2087
1968
  id: traceId
2088
1969
  }), {
2089
- F: __dxlog_file9,
1970
+ F: __dxlog_file8,
2090
1971
  L: 132,
2091
1972
  S: this,
2092
1973
  C: (f, a) => f(...a)
@@ -2097,34 +1978,34 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2097
1978
  };
2098
1979
  },
2099
1980
  authenticate: async ({ authCode: code, signedChallenge }) => {
2100
- const traceId = import_keys7.PublicKey.random().toHex();
2101
- import_log7.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
1981
+ const traceId = import_keys6.PublicKey.random().toHex();
1982
+ import_log6.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
2102
1983
  id: traceId
2103
1984
  }), {
2104
- F: __dxlog_file9,
1985
+ F: __dxlog_file8,
2105
1986
  L: 141,
2106
1987
  S: this,
2107
1988
  C: (f, a) => f(...a)
2108
1989
  });
2109
1990
  const invitation = this._requireActiveInvitation();
2110
- (0, import_log7.log)("received authentication request", {
1991
+ (0, import_log6.log)("received authentication request", {
2111
1992
  authCode: code
2112
1993
  }, {
2113
- F: __dxlog_file9,
1994
+ F: __dxlog_file8,
2114
1995
  L: 144,
2115
1996
  S: this,
2116
1997
  C: (f, a) => f(...a)
2117
1998
  });
2118
1999
  let status = import_invitations4.AuthenticationResponse.Status.OK;
2119
2000
  this._assertInvitationState([
2120
- import_services8.Invitation.State.AUTHENTICATING,
2121
- import_services8.Invitation.State.READY_FOR_AUTHENTICATION
2001
+ import_services7.Invitation.State.AUTHENTICATING,
2002
+ import_services7.Invitation.State.READY_FOR_AUTHENTICATION
2122
2003
  ]);
2123
- this._callbacks.onStateUpdate(import_services8.Invitation.State.AUTHENTICATING);
2004
+ this._callbacks.onStateUpdate(import_services7.Invitation.State.AUTHENTICATING);
2124
2005
  switch (invitation.authMethod) {
2125
- case import_services8.Invitation.AuthMethod.NONE: {
2126
- (0, import_log7.log)("authentication not required", void 0, {
2127
- F: __dxlog_file9,
2006
+ case import_services7.Invitation.AuthMethod.NONE: {
2007
+ (0, import_log6.log)("authentication not required", void 0, {
2008
+ F: __dxlog_file8,
2128
2009
  L: 152,
2129
2010
  S: this,
2130
2011
  C: (f, a) => f(...a)
@@ -2133,7 +2014,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2133
2014
  status: import_invitations4.AuthenticationResponse.Status.OK
2134
2015
  };
2135
2016
  }
2136
- case import_services8.Invitation.AuthMethod.SHARED_SECRET: {
2017
+ case import_services7.Invitation.AuthMethod.SHARED_SECRET: {
2137
2018
  if (invitation.authCode) {
2138
2019
  if (this.authenticationRetry++ > MAX_OTP_ATTEMPTS) {
2139
2020
  status = import_invitations4.AuthenticationResponse.Status.INVALID_OPT_ATTEMPTS;
@@ -2145,7 +2026,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2145
2026
  }
2146
2027
  break;
2147
2028
  }
2148
- case import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
2029
+ case import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
2149
2030
  if (!invitation.guestKeypair) {
2150
2031
  status = import_invitations4.AuthenticationResponse.Status.INTERNAL_ERROR;
2151
2032
  break;
@@ -2159,10 +2040,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2159
2040
  break;
2160
2041
  }
2161
2042
  default: {
2162
- import_log7.log.error("invalid authentication method", {
2043
+ import_log6.log.error("invalid authentication method", {
2163
2044
  authMethod: invitation.authMethod
2164
2045
  }, {
2165
- F: __dxlog_file9,
2046
+ F: __dxlog_file8,
2166
2047
  L: 190,
2167
2048
  S: this,
2168
2049
  C: (f, a) => f(...a)
@@ -2181,13 +2062,13 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2181
2062
  status
2182
2063
  };
2183
2064
  }
2184
- import_log7.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.end({
2065
+ import_log6.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.end({
2185
2066
  id: traceId,
2186
2067
  data: {
2187
2068
  status
2188
2069
  }
2189
2070
  }), {
2190
- F: __dxlog_file9,
2071
+ F: __dxlog_file8,
2191
2072
  L: 202,
2192
2073
  S: this,
2193
2074
  C: (f, a) => f(...a)
@@ -2197,11 +2078,11 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2197
2078
  };
2198
2079
  },
2199
2080
  admit: async (request) => {
2200
- const traceId = import_keys7.PublicKey.random().toHex();
2201
- import_log7.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
2081
+ const traceId = import_keys6.PublicKey.random().toHex();
2082
+ import_log6.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
2202
2083
  id: traceId
2203
2084
  }), {
2204
- F: __dxlog_file9,
2085
+ F: __dxlog_file8,
2205
2086
  L: 208,
2206
2087
  S: this,
2207
2088
  C: (f, a) => f(...a)
@@ -2209,16 +2090,16 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2209
2090
  const invitation = this._requireActiveInvitation();
2210
2091
  try {
2211
2092
  if (isAuthenticationRequired(invitation)) {
2212
- this._assertInvitationState(import_services8.Invitation.State.AUTHENTICATING);
2093
+ this._assertInvitationState(import_services7.Invitation.State.AUTHENTICATING);
2213
2094
  if (!this.authenticationPassed) {
2214
2095
  throw new Error("Not authenticated");
2215
2096
  }
2216
2097
  }
2217
2098
  const response = await this._callbacks.admit(request);
2218
- import_log7.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
2099
+ import_log6.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
2219
2100
  id: traceId
2220
2101
  }), {
2221
- F: __dxlog_file9,
2102
+ F: __dxlog_file8,
2222
2103
  L: 222,
2223
2104
  S: this,
2224
2105
  C: (f, a) => f(...a)
@@ -2235,35 +2116,35 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2235
2116
  async onOpen(context) {
2236
2117
  await super.onOpen(context);
2237
2118
  try {
2238
- (0, import_log7.log)("host acquire lock", void 0, {
2239
- F: __dxlog_file9,
2119
+ (0, import_log6.log)("host acquire lock", void 0, {
2120
+ F: __dxlog_file8,
2240
2121
  L: 237,
2241
2122
  S: this,
2242
2123
  C: (f, a) => f(...a)
2243
2124
  });
2244
2125
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
2245
- (0, import_log7.log)("host lock acquired", void 0, {
2246
- F: __dxlog_file9,
2126
+ (0, import_log6.log)("host lock acquired", void 0, {
2127
+ F: __dxlog_file8,
2247
2128
  L: 239,
2248
2129
  S: this,
2249
2130
  C: (f, a) => f(...a)
2250
2131
  });
2251
2132
  const lastState = this._requireActiveInvitation().state;
2252
- this._callbacks.onStateUpdate(import_services8.Invitation.State.CONNECTING);
2133
+ this._callbacks.onStateUpdate(import_services7.Invitation.State.CONNECTING);
2253
2134
  await this.rpc.InvitationHostService.options({
2254
2135
  role: import_invitations4.Options.Role.HOST
2255
2136
  });
2256
- (0, import_log7.log)("options sent", void 0, {
2257
- F: __dxlog_file9,
2137
+ (0, import_log6.log)("options sent", void 0, {
2138
+ F: __dxlog_file8,
2258
2139
  L: 243,
2259
2140
  S: this,
2260
2141
  C: (f, a) => f(...a)
2261
2142
  });
2262
- await (0, import_context8.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
2143
+ await (0, import_context7.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
2263
2144
  timeout: OPTIONS_TIMEOUT2
2264
2145
  }));
2265
- (0, import_log7.log)("options received", void 0, {
2266
- F: __dxlog_file9,
2146
+ (0, import_log6.log)("options received", void 0, {
2147
+ F: __dxlog_file8,
2267
2148
  L: 245,
2268
2149
  S: this,
2269
2150
  C: (f, a) => f(...a)
@@ -2276,7 +2157,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2276
2157
  remotePeerId: context.remotePeerId
2277
2158
  });
2278
2159
  }
2279
- this._callbacks.onStateUpdate(import_services8.Invitation.State.CONNECTED);
2160
+ this._callbacks.onStateUpdate(import_services7.Invitation.State.CONNECTED);
2280
2161
  this._callbacks.onOpen(this._ctx, context);
2281
2162
  } catch (err) {
2282
2163
  if (this._invitationFlowLock != null) {
@@ -2316,8 +2197,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2316
2197
  if (this._invitationFlowLock != null) {
2317
2198
  this._invitationFlowLock?.release();
2318
2199
  this._invitationFlowLock = null;
2319
- (0, import_log7.log)("invitation flow lock released", void 0, {
2320
- F: __dxlog_file9,
2200
+ (0, import_log6.log)("invitation flow lock released", void 0, {
2201
+ F: __dxlog_file8,
2321
2202
  L: 300,
2322
2203
  S: this,
2323
2204
  C: (f, a) => f(...a)
@@ -2325,16 +2206,16 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
2325
2206
  }
2326
2207
  }
2327
2208
  };
2328
- var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services8.Invitation.AuthMethod.NONE;
2329
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
2209
+ var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services7.Invitation.AuthMethod.NONE;
2210
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
2330
2211
  var InvitationTopology = class {
2331
2212
  constructor(_role) {
2332
2213
  this._role = _role;
2333
- this._seenPeers = new import_util5.ComplexSet(import_keys8.PublicKey.hash);
2214
+ this._seenPeers = new import_util5.ComplexSet(import_keys7.PublicKey.hash);
2334
2215
  }
2335
2216
  init(controller) {
2336
2217
  (0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
2337
- F: __dxlog_file10,
2218
+ F: __dxlog_file9,
2338
2219
  L: 42,
2339
2220
  S: this,
2340
2221
  A: [
@@ -2346,7 +2227,7 @@ var InvitationTopology = class {
2346
2227
  }
2347
2228
  update() {
2348
2229
  (0, import_invariant9.invariant)(this._controller, "Not initialized.", {
2349
- F: __dxlog_file10,
2230
+ F: __dxlog_file9,
2350
2231
  L: 47,
2351
2232
  S: this,
2352
2233
  A: [
@@ -2363,13 +2244,13 @@ var InvitationTopology = class {
2363
2244
  return;
2364
2245
  }
2365
2246
  const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
2366
- this._seenPeers = new import_util5.ComplexSet(import_keys8.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
2247
+ this._seenPeers = new import_util5.ComplexSet(import_keys7.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
2367
2248
  if (firstUnknownPeer != null) {
2368
- (0, import_log8.log)("invitation connect", {
2249
+ (0, import_log7.log)("invitation connect", {
2369
2250
  ownPeerId,
2370
2251
  remotePeerId: firstUnknownPeer
2371
2252
  }, {
2372
- F: __dxlog_file10,
2253
+ F: __dxlog_file9,
2373
2254
  L: 69,
2374
2255
  S: this,
2375
2256
  C: (f, a) => f(...a)
@@ -2380,7 +2261,7 @@ var InvitationTopology = class {
2380
2261
  }
2381
2262
  async onOffer(peer) {
2382
2263
  (0, import_invariant9.invariant)(this._controller, "Not initialized.", {
2383
- F: __dxlog_file10,
2264
+ F: __dxlog_file9,
2384
2265
  L: 76,
2385
2266
  S: this,
2386
2267
  A: [
@@ -2397,7 +2278,7 @@ var InvitationTopology = class {
2397
2278
  return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
2398
2279
  }
2399
2280
  };
2400
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2281
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2401
2282
  var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
2402
2283
  var InvitationsHandler = class {
2403
2284
  /**
@@ -2422,7 +2303,7 @@ var InvitationsHandler = class {
2422
2303
  try {
2423
2304
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
2424
2305
  (0, import_invariant6.invariant)(deviceKey, void 0, {
2425
- F: __dxlog_file11,
2306
+ F: __dxlog_file10,
2426
2307
  L: 90,
2427
2308
  S: this,
2428
2309
  A: [
@@ -2442,24 +2323,24 @@ var InvitationsHandler = class {
2442
2323
  let admitted = false;
2443
2324
  connectionCtx.onDispose(() => {
2444
2325
  if (!admitted) {
2445
- guardedState.error(extension, new import_context5.ContextDisposedError());
2326
+ guardedState.error(extension, new import_context4.ContextDisposedError());
2446
2327
  }
2447
2328
  });
2448
2329
  (0, import_async8.scheduleTask)(connectionCtx, async () => {
2449
- const traceId = import_keys6.PublicKey.random().toHex();
2330
+ const traceId = import_keys5.PublicKey.random().toHex();
2450
2331
  try {
2451
- import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
2332
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
2452
2333
  id: traceId
2453
2334
  }), {
2454
- F: __dxlog_file11,
2335
+ F: __dxlog_file10,
2455
2336
  L: 115,
2456
2337
  S: this,
2457
2338
  C: (f, a) => f(...a)
2458
2339
  });
2459
- (0, import_log5.log)("connected", {
2340
+ (0, import_log4.log)("connected", {
2460
2341
  ...protocol.toJSON()
2461
2342
  }, {
2462
- F: __dxlog_file11,
2343
+ F: __dxlog_file10,
2463
2344
  L: 116,
2464
2345
  S: this,
2465
2346
  C: (f, a) => f(...a)
@@ -2467,20 +2348,20 @@ var InvitationsHandler = class {
2467
2348
  const deviceKey = await extension.completedTrigger.wait({
2468
2349
  timeout: invitation.timeout
2469
2350
  });
2470
- (0, import_log5.log)("admitted guest", {
2351
+ (0, import_log4.log)("admitted guest", {
2471
2352
  guest: deviceKey,
2472
2353
  ...protocol.toJSON()
2473
2354
  }, {
2474
- F: __dxlog_file11,
2355
+ F: __dxlog_file10,
2475
2356
  L: 118,
2476
2357
  S: this,
2477
2358
  C: (f, a) => f(...a)
2478
2359
  });
2479
- guardedState.set(extension, import_services6.Invitation.State.SUCCESS);
2480
- import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
2360
+ guardedState.set(extension, import_services5.Invitation.State.SUCCESS);
2361
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
2481
2362
  id: traceId
2482
2363
  }), {
2483
- F: __dxlog_file11,
2364
+ F: __dxlog_file10,
2484
2365
  L: 120,
2485
2366
  S: this,
2486
2367
  C: (f, a) => f(...a)
@@ -2491,11 +2372,11 @@ var InvitationsHandler = class {
2491
2372
  }
2492
2373
  } catch (err) {
2493
2374
  if (err instanceof import_async8.TimeoutError) {
2494
- if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
2495
- (0, import_log5.log)("timeout", {
2375
+ if (guardedState.set(extension, import_services5.Invitation.State.TIMEOUT)) {
2376
+ (0, import_log4.log)("timeout", {
2496
2377
  ...protocol.toJSON()
2497
2378
  }, {
2498
- F: __dxlog_file11,
2379
+ F: __dxlog_file10,
2499
2380
  L: 129,
2500
2381
  S: this,
2501
2382
  C: (f, a) => f(...a)
@@ -2503,19 +2384,19 @@ var InvitationsHandler = class {
2503
2384
  }
2504
2385
  } else {
2505
2386
  if (guardedState.error(extension, err)) {
2506
- import_log5.log.error("failed", err, {
2507
- F: __dxlog_file11,
2387
+ import_log4.log.error("failed", err, {
2388
+ F: __dxlog_file10,
2508
2389
  L: 133,
2509
2390
  S: this,
2510
2391
  C: (f, a) => f(...a)
2511
2392
  });
2512
2393
  }
2513
2394
  }
2514
- import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.error({
2395
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.error({
2515
2396
  id: traceId,
2516
2397
  error: err
2517
2398
  }), {
2518
- F: __dxlog_file11,
2399
+ F: __dxlog_file10,
2519
2400
  L: 136,
2520
2401
  S: this,
2521
2402
  C: (f, a) => f(...a)
@@ -2526,10 +2407,10 @@ var InvitationsHandler = class {
2526
2407
  },
2527
2408
  onError: (err) => {
2528
2409
  if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
2529
- (0, import_log5.log)("invalid role", {
2410
+ (0, import_log4.log)("invalid role", {
2530
2411
  ...err.context
2531
2412
  }, {
2532
- F: __dxlog_file11,
2413
+ F: __dxlog_file10,
2533
2414
  L: 144,
2534
2415
  S: this,
2535
2416
  C: (f, a) => f(...a)
@@ -2537,11 +2418,11 @@ var InvitationsHandler = class {
2537
2418
  return;
2538
2419
  }
2539
2420
  if (err instanceof import_async8.TimeoutError) {
2540
- if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
2541
- (0, import_log5.log)("timeout", {
2421
+ if (guardedState.set(extension, import_services5.Invitation.State.TIMEOUT)) {
2422
+ (0, import_log4.log)("timeout", {
2542
2423
  err
2543
2424
  }, {
2544
- F: __dxlog_file11,
2425
+ F: __dxlog_file10,
2545
2426
  L: 149,
2546
2427
  S: this,
2547
2428
  C: (f, a) => f(...a)
@@ -2549,8 +2430,8 @@ var InvitationsHandler = class {
2549
2430
  }
2550
2431
  } else {
2551
2432
  if (guardedState.error(extension, err)) {
2552
- import_log5.log.error("failed", err, {
2553
- F: __dxlog_file11,
2433
+ import_log4.log.error("failed", err, {
2434
+ F: __dxlog_file10,
2554
2435
  L: 153,
2555
2436
  S: this,
2556
2437
  C: (f, a) => f(...a)
@@ -2563,8 +2444,8 @@ var InvitationsHandler = class {
2563
2444
  };
2564
2445
  if (invitation.lifetime && invitation.created) {
2565
2446
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
2566
- import_log5.log.warn("invitation has already expired", void 0, {
2567
- F: __dxlog_file11,
2447
+ import_log4.log.warn("invitation has already expired", void 0, {
2448
+ F: __dxlog_file10,
2568
2449
  L: 164,
2569
2450
  S: this,
2570
2451
  C: (f, a) => f(...a)
@@ -2572,7 +2453,7 @@ var InvitationsHandler = class {
2572
2453
  } else {
2573
2454
  (0, import_async8.scheduleTask)(ctx, async () => {
2574
2455
  await swarmConnection.close();
2575
- guardedState.set(null, import_services6.Invitation.State.EXPIRED);
2456
+ guardedState.set(null, import_services5.Invitation.State.EXPIRED);
2576
2457
  await ctx.dispose();
2577
2458
  }, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
2578
2459
  }
@@ -2580,14 +2461,14 @@ var InvitationsHandler = class {
2580
2461
  let swarmConnection;
2581
2462
  (0, import_async8.scheduleTask)(ctx, async () => {
2582
2463
  swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.Options.Role.HOST, createExtension);
2583
- guardedState.set(null, import_services6.Invitation.State.CONNECTING);
2464
+ guardedState.set(null, import_services5.Invitation.State.CONNECTING);
2584
2465
  });
2585
2466
  }
2586
2467
  acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
2587
2468
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
2588
2469
  if (deviceProfile) {
2589
- (0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2590
- F: __dxlog_file11,
2470
+ (0, import_invariant6.invariant)(invitation.kind === import_services5.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2471
+ F: __dxlog_file10,
2591
2472
  L: 197,
2592
2473
  S: this,
2593
2474
  A: [
@@ -2596,16 +2477,16 @@ var InvitationsHandler = class {
2596
2477
  ]
2597
2478
  });
2598
2479
  }
2599
- const triedPeersIds = new import_util4.ComplexSet(import_keys6.PublicKey.hash);
2480
+ const triedPeersIds = new import_util4.ComplexSet(import_keys5.PublicKey.hash);
2600
2481
  const guardedState = this._createGuardedState(ctx, invitation, stream);
2601
2482
  const shouldCancelInvitationFlow = (extension) => {
2602
2483
  const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
2603
- (0, import_log5.log)("should cancel invitation flow", {
2484
+ (0, import_log4.log)("should cancel invitation flow", {
2604
2485
  isLockedByAnotherConnection,
2605
- invitationType: import_services6.Invitation.Type.DELEGATED,
2486
+ invitationType: import_services5.Invitation.Type.DELEGATED,
2606
2487
  triedPeers: triedPeersIds.size
2607
2488
  }, {
2608
- F: __dxlog_file11,
2489
+ F: __dxlog_file10,
2609
2490
  L: 205,
2610
2491
  S: this,
2611
2492
  C: (f, a) => f(...a)
@@ -2613,7 +2494,7 @@ var InvitationsHandler = class {
2613
2494
  if (isLockedByAnotherConnection) {
2614
2495
  return false;
2615
2496
  }
2616
- return invitation.type !== import_services6.Invitation.Type.DELEGATED || triedPeersIds.size >= MAX_DELEGATED_INVITATION_HOST_TRIES;
2497
+ return invitation.type !== import_services5.Invitation.Type.DELEGATED || triedPeersIds.size >= MAX_DELEGATED_INVITATION_HOST_TRIES;
2617
2498
  };
2618
2499
  let admitted = false;
2619
2500
  const createExtension = () => {
@@ -2628,50 +2509,50 @@ var InvitationsHandler = class {
2628
2509
  return;
2629
2510
  }
2630
2511
  connectionCtx.onDispose(async () => {
2631
- (0, import_log5.log)("extension disposed", {
2512
+ (0, import_log4.log)("extension disposed", {
2632
2513
  admitted,
2633
2514
  currentState: guardedState.current.state
2634
2515
  }, {
2635
- F: __dxlog_file11,
2516
+ F: __dxlog_file10,
2636
2517
  L: 233,
2637
2518
  S: this,
2638
2519
  C: (f, a) => f(...a)
2639
2520
  });
2640
2521
  if (!admitted) {
2641
- guardedState.error(extension, new import_context5.ContextDisposedError());
2522
+ guardedState.error(extension, new import_context4.ContextDisposedError());
2642
2523
  if (shouldCancelInvitationFlow(extension)) {
2643
2524
  await ctx.dispose();
2644
2525
  }
2645
2526
  }
2646
2527
  });
2647
2528
  (0, import_async8.scheduleTask)(connectionCtx, async () => {
2648
- const traceId = import_keys6.PublicKey.random().toHex();
2529
+ const traceId = import_keys5.PublicKey.random().toHex();
2649
2530
  try {
2650
- import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
2531
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
2651
2532
  id: traceId
2652
2533
  }), {
2653
- F: __dxlog_file11,
2534
+ F: __dxlog_file10,
2654
2535
  L: 245,
2655
2536
  S: this,
2656
2537
  C: (f, a) => f(...a)
2657
2538
  });
2658
2539
  (0, import_async8.scheduleTask)(connectionCtx, () => {
2659
- guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
2540
+ guardedState.set(extension, import_services5.Invitation.State.TIMEOUT);
2660
2541
  extensionCtx.close();
2661
2542
  }, timeout);
2662
- (0, import_log5.log)("connected", {
2543
+ (0, import_log4.log)("connected", {
2663
2544
  ...protocol.toJSON()
2664
2545
  }, {
2665
- F: __dxlog_file11,
2546
+ F: __dxlog_file10,
2666
2547
  L: 256,
2667
2548
  S: this,
2668
2549
  C: (f, a) => f(...a)
2669
2550
  });
2670
- guardedState.set(extension, import_services6.Invitation.State.CONNECTED);
2671
- (0, import_log5.log)("introduce", {
2551
+ guardedState.set(extension, import_services5.Invitation.State.CONNECTED);
2552
+ (0, import_log4.log)("introduce", {
2672
2553
  ...protocol.toJSON()
2673
2554
  }, {
2674
- F: __dxlog_file11,
2555
+ F: __dxlog_file10,
2675
2556
  L: 260,
2676
2557
  S: this,
2677
2558
  C: (f, a) => f(...a)
@@ -2680,11 +2561,11 @@ var InvitationsHandler = class {
2680
2561
  invitationId: invitation.invitationId,
2681
2562
  ...protocol.createIntroduction()
2682
2563
  });
2683
- (0, import_log5.log)("introduce response", {
2564
+ (0, import_log4.log)("introduce response", {
2684
2565
  ...protocol.toJSON(),
2685
2566
  response: introductionResponse
2686
2567
  }, {
2687
- F: __dxlog_file11,
2568
+ F: __dxlog_file10,
2688
2569
  L: 265,
2689
2570
  S: this,
2690
2571
  C: (f, a) => f(...a)
@@ -2692,20 +2573,20 @@ var InvitationsHandler = class {
2692
2573
  invitation.authMethod = introductionResponse.authMethod;
2693
2574
  if (isAuthenticationRequired(invitation)) {
2694
2575
  switch (invitation.authMethod) {
2695
- case import_services6.Invitation.AuthMethod.SHARED_SECRET:
2576
+ case import_services5.Invitation.AuthMethod.SHARED_SECRET:
2696
2577
  await this._handleGuestOtpAuth(extension, (state) => guardedState.set(extension, state), otpEnteredTrigger, {
2697
2578
  timeout
2698
2579
  });
2699
2580
  break;
2700
- case import_services6.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
2581
+ case import_services5.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
2701
2582
  await this._handleGuestKpkAuth(extension, (state) => guardedState.set(extension, state), invitation, introductionResponse);
2702
2583
  break;
2703
2584
  }
2704
2585
  }
2705
- (0, import_log5.log)("request admission", {
2586
+ (0, import_log4.log)("request admission", {
2706
2587
  ...protocol.toJSON()
2707
2588
  }, {
2708
- F: __dxlog_file11,
2589
+ F: __dxlog_file10,
2709
2590
  L: 291,
2710
2591
  S: this,
2711
2592
  C: (f, a) => f(...a)
@@ -2714,10 +2595,10 @@ var InvitationsHandler = class {
2714
2595
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
2715
2596
  admitted = true;
2716
2597
  const result = await protocol.accept(admissionResponse, admissionRequest);
2717
- (0, import_log5.log)("admitted by host", {
2598
+ (0, import_log4.log)("admitted by host", {
2718
2599
  ...protocol.toJSON()
2719
2600
  }, {
2720
- F: __dxlog_file11,
2601
+ F: __dxlog_file10,
2721
2602
  L: 302,
2722
2603
  S: this,
2723
2604
  C: (f, a) => f(...a)
@@ -2725,30 +2606,30 @@ var InvitationsHandler = class {
2725
2606
  await guardedState.complete({
2726
2607
  ...guardedState.current,
2727
2608
  ...result,
2728
- state: import_services6.Invitation.State.SUCCESS
2609
+ state: import_services5.Invitation.State.SUCCESS
2729
2610
  });
2730
- import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
2611
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
2731
2612
  id: traceId
2732
2613
  }), {
2733
- F: __dxlog_file11,
2614
+ F: __dxlog_file10,
2734
2615
  L: 308,
2735
2616
  S: this,
2736
2617
  C: (f, a) => f(...a)
2737
2618
  });
2738
2619
  } catch (err) {
2739
2620
  if (err instanceof import_async8.TimeoutError) {
2740
- (0, import_log5.log)("timeout", {
2621
+ (0, import_log4.log)("timeout", {
2741
2622
  ...protocol.toJSON()
2742
2623
  }, {
2743
- F: __dxlog_file11,
2624
+ F: __dxlog_file10,
2744
2625
  L: 311,
2745
2626
  S: this,
2746
2627
  C: (f, a) => f(...a)
2747
2628
  });
2748
- guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
2629
+ guardedState.set(extension, import_services5.Invitation.State.TIMEOUT);
2749
2630
  } else {
2750
- (0, import_log5.log)("auth failed", err, {
2751
- F: __dxlog_file11,
2631
+ (0, import_log4.log)("auth failed", err, {
2632
+ F: __dxlog_file10,
2752
2633
  L: 314,
2753
2634
  S: this,
2754
2635
  C: (f, a) => f(...a)
@@ -2756,11 +2637,11 @@ var InvitationsHandler = class {
2756
2637
  guardedState.error(extension, err);
2757
2638
  }
2758
2639
  extensionCtx.close(err);
2759
- import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.error({
2640
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.error({
2760
2641
  id: traceId,
2761
2642
  error: err
2762
2643
  }), {
2763
- F: __dxlog_file11,
2644
+ F: __dxlog_file10,
2764
2645
  L: 318,
2765
2646
  S: this,
2766
2647
  C: (f, a) => f(...a)
@@ -2773,18 +2654,18 @@ var InvitationsHandler = class {
2773
2654
  return;
2774
2655
  }
2775
2656
  if (err instanceof import_async8.TimeoutError) {
2776
- (0, import_log5.log)("timeout", {
2657
+ (0, import_log4.log)("timeout", {
2777
2658
  ...protocol.toJSON()
2778
2659
  }, {
2779
- F: __dxlog_file11,
2660
+ F: __dxlog_file10,
2780
2661
  L: 327,
2781
2662
  S: this,
2782
2663
  C: (f, a) => f(...a)
2783
2664
  });
2784
- guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
2665
+ guardedState.set(extension, import_services5.Invitation.State.TIMEOUT);
2785
2666
  } else {
2786
- (0, import_log5.log)("auth failed", err, {
2787
- F: __dxlog_file11,
2667
+ (0, import_log4.log)("auth failed", err, {
2668
+ F: __dxlog_file10,
2788
2669
  L: 330,
2789
2670
  S: this,
2790
2671
  C: (f, a) => f(...a)
@@ -2802,7 +2683,7 @@ var InvitationsHandler = class {
2802
2683
  await ctx.dispose();
2803
2684
  } else {
2804
2685
  (0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
2805
- F: __dxlog_file11,
2686
+ F: __dxlog_file10,
2806
2687
  L: 345,
2807
2688
  S: this,
2808
2689
  A: [
@@ -2811,7 +2692,7 @@ var InvitationsHandler = class {
2811
2692
  ]
2812
2693
  });
2813
2694
  await this._joinSwarm(ctx, invitation, import_invitations2.Options.Role.GUEST, createExtension);
2814
- guardedState.set(null, import_services6.Invitation.State.CONNECTING);
2695
+ guardedState.set(null, import_services5.Invitation.State.CONNECTING);
2815
2696
  }
2816
2697
  });
2817
2698
  }
@@ -2819,14 +2700,14 @@ var InvitationsHandler = class {
2819
2700
  let label;
2820
2701
  if (role === import_invitations2.Options.Role.GUEST) {
2821
2702
  label = "invitation guest";
2822
- } else if (invitation.kind === import_services6.Invitation.Kind.DEVICE) {
2703
+ } else if (invitation.kind === import_services5.Invitation.Kind.DEVICE) {
2823
2704
  label = "invitation host for device";
2824
2705
  } else {
2825
2706
  label = `invitation host for space ${invitation.spaceKey?.truncate()}`;
2826
2707
  }
2827
2708
  const swarmConnection = await this._networkManager.joinSwarm({
2828
2709
  topic: invitation.swarmKey,
2829
- peerId: import_keys6.PublicKey.random(),
2710
+ peerId: import_keys5.PublicKey.random(),
2830
2711
  protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
2831
2712
  teleport.addExtension("dxos.halo.invitations", extensionFactory());
2832
2713
  }, this._defaultTeleportParams),
@@ -2881,10 +2762,10 @@ var InvitationsHandler = class {
2881
2762
  },
2882
2763
  error: (extension, error) => {
2883
2764
  if (isStateChangeAllowed(extension)) {
2884
- this._logStateUpdate(currentInvitation, extension, import_services6.Invitation.State.ERROR);
2765
+ this._logStateUpdate(currentInvitation, extension, import_services5.Invitation.State.ERROR);
2885
2766
  currentInvitation = {
2886
2767
  ...currentInvitation,
2887
- state: import_services6.Invitation.State.ERROR
2768
+ state: import_services5.Invitation.State.ERROR
2888
2769
  };
2889
2770
  stream.next(currentInvitation);
2890
2771
  stream.error(error);
@@ -2896,12 +2777,12 @@ var InvitationsHandler = class {
2896
2777
  };
2897
2778
  }
2898
2779
  _logStateUpdate(invitation, actor, newState) {
2899
- (0, import_log5.log)("invitation state update", {
2780
+ (0, import_log4.log)("invitation state update", {
2900
2781
  actor: actor?.constructor.name,
2901
2782
  newState: stateToString(newState),
2902
2783
  oldState: stateToString(invitation.state)
2903
2784
  }, {
2904
- F: __dxlog_file11,
2785
+ F: __dxlog_file10,
2905
2786
  L: 438,
2906
2787
  S: this,
2907
2788
  C: (f, a) => f(...a)
@@ -2909,30 +2790,30 @@ var InvitationsHandler = class {
2909
2790
  }
2910
2791
  _isNotTerminal(currentState) {
2911
2792
  return ![
2912
- import_services6.Invitation.State.SUCCESS,
2913
- import_services6.Invitation.State.ERROR,
2914
- import_services6.Invitation.State.CANCELLED,
2915
- import_services6.Invitation.State.TIMEOUT,
2916
- import_services6.Invitation.State.EXPIRED
2793
+ import_services5.Invitation.State.SUCCESS,
2794
+ import_services5.Invitation.State.ERROR,
2795
+ import_services5.Invitation.State.CANCELLED,
2796
+ import_services5.Invitation.State.TIMEOUT,
2797
+ import_services5.Invitation.State.EXPIRED
2917
2798
  ].includes(currentState);
2918
2799
  }
2919
2800
  async _handleGuestOtpAuth(extension, setState, authenticated, options) {
2920
2801
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2921
- (0, import_log5.log)("guest waiting for authentication code...", void 0, {
2922
- F: __dxlog_file11,
2802
+ (0, import_log4.log)("guest waiting for authentication code...", void 0, {
2803
+ F: __dxlog_file10,
2923
2804
  L: 462,
2924
2805
  S: this,
2925
2806
  C: (f, a) => f(...a)
2926
2807
  });
2927
- setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
2808
+ setState(import_services5.Invitation.State.READY_FOR_AUTHENTICATION);
2928
2809
  const authCode = await authenticated.wait(options);
2929
- (0, import_log5.log)("sending authentication request", void 0, {
2930
- F: __dxlog_file11,
2810
+ (0, import_log4.log)("sending authentication request", void 0, {
2811
+ F: __dxlog_file10,
2931
2812
  L: 466,
2932
2813
  S: this,
2933
2814
  C: (f, a) => f(...a)
2934
2815
  });
2935
- setState(import_services6.Invitation.State.AUTHENTICATING);
2816
+ setState(import_services5.Invitation.State.AUTHENTICATING);
2936
2817
  const response = await extension.rpc.InvitationHostService.authenticate({
2937
2818
  authCode
2938
2819
  });
@@ -2943,10 +2824,10 @@ var InvitationsHandler = class {
2943
2824
  if (attempt === MAX_OTP_ATTEMPTS) {
2944
2825
  throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
2945
2826
  } else {
2946
- (0, import_log5.log)("retrying invalid code", {
2827
+ (0, import_log4.log)("retrying invalid code", {
2947
2828
  attempt
2948
2829
  }, {
2949
- F: __dxlog_file11,
2830
+ F: __dxlog_file10,
2950
2831
  L: 477,
2951
2832
  S: this,
2952
2833
  C: (f, a) => f(...a)
@@ -2963,13 +2844,13 @@ var InvitationsHandler = class {
2963
2844
  if (introductionResponse.challenge == null) {
2964
2845
  throw new Error("challenge missing in the introduction");
2965
2846
  }
2966
- (0, import_log5.log)("sending authentication request", void 0, {
2967
- F: __dxlog_file11,
2847
+ (0, import_log4.log)("sending authentication request", void 0, {
2848
+ F: __dxlog_file10,
2968
2849
  L: 496,
2969
2850
  S: this,
2970
2851
  C: (f, a) => f(...a)
2971
2852
  });
2972
- setState(import_services6.Invitation.State.AUTHENTICATING);
2853
+ setState(import_services5.Invitation.State.AUTHENTICATING);
2973
2854
  const signature = (0, import_crypto.sign)(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
2974
2855
  const response = await extension.rpc.InvitationHostService.authenticate({
2975
2856
  signedChallenge: signature
@@ -2982,7 +2863,7 @@ var InvitationsHandler = class {
2982
2863
  var createAdmissionKeypair = () => {
2983
2864
  const keypair = (0, import_crypto.createKeyPair)();
2984
2865
  return {
2985
- publicKey: import_keys6.PublicKey.from(keypair.publicKey),
2866
+ publicKey: import_keys5.PublicKey.from(keypair.publicKey),
2986
2867
  privateKey: keypair.secretKey
2987
2868
  };
2988
2869
  };
@@ -3015,8 +2896,8 @@ var InvitationsServiceImpl = class {
3015
2896
  return new import_codec_protobuf10.Stream(({ next, ctx }) => {
3016
2897
  this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
3017
2898
  next({
3018
- action: import_services9.QueryInvitationsResponse.Action.ADDED,
3019
- type: import_services9.QueryInvitationsResponse.Type.CREATED,
2899
+ action: import_services8.QueryInvitationsResponse.Action.ADDED,
2900
+ type: import_services8.QueryInvitationsResponse.Type.CREATED,
3020
2901
  invitations: [
3021
2902
  invitation
3022
2903
  ]
@@ -3024,8 +2905,8 @@ var InvitationsServiceImpl = class {
3024
2905
  });
3025
2906
  this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
3026
2907
  next({
3027
- action: import_services9.QueryInvitationsResponse.Action.ADDED,
3028
- type: import_services9.QueryInvitationsResponse.Type.ACCEPTED,
2908
+ action: import_services8.QueryInvitationsResponse.Action.ADDED,
2909
+ type: import_services8.QueryInvitationsResponse.Type.ACCEPTED,
3029
2910
  invitations: [
3030
2911
  invitation
3031
2912
  ]
@@ -3033,8 +2914,8 @@ var InvitationsServiceImpl = class {
3033
2914
  });
3034
2915
  this._invitationsManager.removedCreated.on(ctx, (invitation) => {
3035
2916
  next({
3036
- action: import_services9.QueryInvitationsResponse.Action.REMOVED,
3037
- type: import_services9.QueryInvitationsResponse.Type.CREATED,
2917
+ action: import_services8.QueryInvitationsResponse.Action.REMOVED,
2918
+ type: import_services8.QueryInvitationsResponse.Type.CREATED,
3038
2919
  invitations: [
3039
2920
  invitation
3040
2921
  ]
@@ -3042,8 +2923,8 @@ var InvitationsServiceImpl = class {
3042
2923
  });
3043
2924
  this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
3044
2925
  next({
3045
- action: import_services9.QueryInvitationsResponse.Action.REMOVED,
3046
- type: import_services9.QueryInvitationsResponse.Type.ACCEPTED,
2926
+ action: import_services8.QueryInvitationsResponse.Action.REMOVED,
2927
+ type: import_services8.QueryInvitationsResponse.Type.ACCEPTED,
3047
2928
  invitations: [
3048
2929
  invitation
3049
2930
  ]
@@ -3051,35 +2932,35 @@ var InvitationsServiceImpl = class {
3051
2932
  });
3052
2933
  this._invitationsManager.saved.on(ctx, (invitation) => {
3053
2934
  next({
3054
- action: import_services9.QueryInvitationsResponse.Action.SAVED,
3055
- type: import_services9.QueryInvitationsResponse.Type.CREATED,
2935
+ action: import_services8.QueryInvitationsResponse.Action.SAVED,
2936
+ type: import_services8.QueryInvitationsResponse.Type.CREATED,
3056
2937
  invitations: [
3057
2938
  invitation
3058
2939
  ]
3059
2940
  });
3060
2941
  });
3061
2942
  next({
3062
- action: import_services9.QueryInvitationsResponse.Action.ADDED,
3063
- type: import_services9.QueryInvitationsResponse.Type.CREATED,
2943
+ action: import_services8.QueryInvitationsResponse.Action.ADDED,
2944
+ type: import_services8.QueryInvitationsResponse.Type.CREATED,
3064
2945
  invitations: this._invitationsManager.getCreatedInvitations(),
3065
2946
  existing: true
3066
2947
  });
3067
2948
  next({
3068
- action: import_services9.QueryInvitationsResponse.Action.ADDED,
3069
- type: import_services9.QueryInvitationsResponse.Type.ACCEPTED,
2949
+ action: import_services8.QueryInvitationsResponse.Action.ADDED,
2950
+ type: import_services8.QueryInvitationsResponse.Type.ACCEPTED,
3070
2951
  invitations: this._invitationsManager.getAcceptedInvitations(),
3071
2952
  existing: true
3072
2953
  });
3073
2954
  this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
3074
2955
  next({
3075
- action: import_services9.QueryInvitationsResponse.Action.LOAD_COMPLETE,
3076
- type: import_services9.QueryInvitationsResponse.Type.CREATED
2956
+ action: import_services8.QueryInvitationsResponse.Action.LOAD_COMPLETE,
2957
+ type: import_services8.QueryInvitationsResponse.Type.CREATED
3077
2958
  });
3078
2959
  });
3079
2960
  });
3080
2961
  }
3081
2962
  };
3082
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2963
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
3083
2964
  var SpaceInvitationProtocol = class {
3084
2965
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
3085
2966
  this._spaceManager = _spaceManager;
@@ -3108,13 +2989,13 @@ var SpaceInvitationProtocol = class {
3108
2989
  }
3109
2990
  getInvitationContext() {
3110
2991
  return {
3111
- kind: import_services10.Invitation.Kind.SPACE,
2992
+ kind: import_services9.Invitation.Kind.SPACE,
3112
2993
  spaceKey: this._spaceKey
3113
2994
  };
3114
2995
  }
3115
2996
  async admit(invitation, request, guestProfile) {
3116
2997
  (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3117
- F: __dxlog_file12,
2998
+ F: __dxlog_file11,
3118
2999
  L: 76,
3119
3000
  S: this,
3120
3001
  A: [
@@ -3124,7 +3005,7 @@ var SpaceInvitationProtocol = class {
3124
3005
  });
3125
3006
  const space = this._spaceManager.spaces.get(this._spaceKey);
3126
3007
  (0, import_invariant10.invariant)(space, void 0, {
3127
- F: __dxlog_file12,
3008
+ F: __dxlog_file11,
3128
3009
  L: 78,
3129
3010
  S: this,
3130
3011
  A: [
@@ -3133,7 +3014,7 @@ var SpaceInvitationProtocol = class {
3133
3014
  ]
3134
3015
  });
3135
3016
  (0, import_invariant10.invariant)(request.space, void 0, {
3136
- F: __dxlog_file12,
3017
+ F: __dxlog_file11,
3137
3018
  L: 80,
3138
3019
  S: this,
3139
3020
  A: [
@@ -3142,21 +3023,21 @@ var SpaceInvitationProtocol = class {
3142
3023
  ]
3143
3024
  });
3144
3025
  const { identityKey, deviceKey } = request.space;
3145
- if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
3026
+ if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials9.SpaceMember.Role.REMOVED) {
3146
3027
  throw new import_protocols8.AlreadyJoinedError();
3147
3028
  }
3148
- (0, import_log9.log)("writing guest credentials", {
3029
+ (0, import_log8.log)("writing guest credentials", {
3149
3030
  host: this._signingContext.deviceKey,
3150
3031
  guest: deviceKey
3151
3032
  }, {
3152
- F: __dxlog_file12,
3033
+ F: __dxlog_file11,
3153
3034
  L: 87,
3154
3035
  S: this,
3155
3036
  C: (f, a) => f(...a)
3156
3037
  });
3157
- const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
3038
+ const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, invitation.role ?? import_credentials9.SpaceMember.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
3158
3039
  (0, import_invariant10.invariant)(credentials[0].credential, void 0, {
3159
- F: __dxlog_file12,
3040
+ F: __dxlog_file11,
3160
3041
  L: 101,
3161
3042
  S: this,
3162
3043
  A: [
@@ -3165,8 +3046,8 @@ var SpaceInvitationProtocol = class {
3165
3046
  ]
3166
3047
  });
3167
3048
  const spaceMemberCredential = credentials[0].credential.credential;
3168
- (0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3169
- F: __dxlog_file12,
3049
+ (0, import_invariant10.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3050
+ F: __dxlog_file11,
3170
3051
  L: 103,
3171
3052
  S: this,
3172
3053
  A: [
@@ -3184,7 +3065,7 @@ var SpaceInvitationProtocol = class {
3184
3065
  }
3185
3066
  async delegate(invitation) {
3186
3067
  (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3187
- F: __dxlog_file12,
3068
+ F: __dxlog_file11,
3188
3069
  L: 116,
3189
3070
  S: this,
3190
3071
  A: [
@@ -3194,7 +3075,7 @@ var SpaceInvitationProtocol = class {
3194
3075
  });
3195
3076
  const space = this._spaceManager.spaces.get(this._spaceKey);
3196
3077
  (0, import_invariant10.invariant)(space, void 0, {
3197
- F: __dxlog_file12,
3078
+ F: __dxlog_file11,
3198
3079
  L: 118,
3199
3080
  S: this,
3200
3081
  A: [
@@ -3202,9 +3083,9 @@ var SpaceInvitationProtocol = class {
3202
3083
  ""
3203
3084
  ]
3204
3085
  });
3205
- if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
3086
+ if (invitation.authMethod === import_services9.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
3206
3087
  (0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
3207
- F: __dxlog_file12,
3088
+ F: __dxlog_file11,
3208
3089
  L: 120,
3209
3090
  S: this,
3210
3091
  A: [
@@ -3213,26 +3094,26 @@ var SpaceInvitationProtocol = class {
3213
3094
  ]
3214
3095
  });
3215
3096
  }
3216
- (0, import_log9.log)("writing delegate space invitation", {
3097
+ (0, import_log8.log)("writing delegate space invitation", {
3217
3098
  host: this._signingContext.deviceKey,
3218
3099
  id: invitation.invitationId
3219
3100
  }, {
3220
- F: __dxlog_file12,
3101
+ F: __dxlog_file11,
3221
3102
  L: 123,
3222
3103
  S: this,
3223
3104
  C: (f, a) => f(...a)
3224
3105
  });
3225
- const credential = await (0, import_credentials9.createDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, {
3106
+ const credential = await (0, import_credentials8.createDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, {
3226
3107
  invitationId: invitation.invitationId,
3227
3108
  authMethod: invitation.authMethod,
3228
3109
  swarmKey: invitation.swarmKey,
3229
- role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
3110
+ role: invitation.role ?? import_credentials9.SpaceMember.Role.ADMIN,
3230
3111
  expiresOn: invitation.lifetime ? new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime) : void 0,
3231
3112
  multiUse: invitation.multiUse ?? false,
3232
- guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
3113
+ guestKey: invitation.authMethod === import_services9.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
3233
3114
  });
3234
3115
  (0, import_invariant10.invariant)(credential.credential, void 0, {
3235
- F: __dxlog_file12,
3116
+ F: __dxlog_file11,
3236
3117
  L: 143,
3237
3118
  S: this,
3238
3119
  A: [
@@ -3247,7 +3128,7 @@ var SpaceInvitationProtocol = class {
3247
3128
  }
3248
3129
  async cancelDelegation(invitation) {
3249
3130
  (0, import_invariant10.invariant)(this._spaceKey, void 0, {
3250
- F: __dxlog_file12,
3131
+ F: __dxlog_file11,
3251
3132
  L: 149,
3252
3133
  S: this,
3253
3134
  A: [
@@ -3255,8 +3136,8 @@ var SpaceInvitationProtocol = class {
3255
3136
  ""
3256
3137
  ]
3257
3138
  });
3258
- (0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
3259
- F: __dxlog_file12,
3139
+ (0, import_invariant10.invariant)(invitation.type === import_services9.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
3140
+ F: __dxlog_file11,
3260
3141
  L: 150,
3261
3142
  S: this,
3262
3143
  A: [
@@ -3266,7 +3147,7 @@ var SpaceInvitationProtocol = class {
3266
3147
  });
3267
3148
  const space = this._spaceManager.spaces.get(this._spaceKey);
3268
3149
  (0, import_invariant10.invariant)(space, void 0, {
3269
- F: __dxlog_file12,
3150
+ F: __dxlog_file11,
3270
3151
  L: 152,
3271
3152
  S: this,
3272
3153
  A: [
@@ -3274,18 +3155,18 @@ var SpaceInvitationProtocol = class {
3274
3155
  ""
3275
3156
  ]
3276
3157
  });
3277
- (0, import_log9.log)("cancelling delegated space invitation", {
3158
+ (0, import_log8.log)("cancelling delegated space invitation", {
3278
3159
  host: this._signingContext.deviceKey,
3279
3160
  id: invitation.invitationId
3280
3161
  }, {
3281
- F: __dxlog_file12,
3162
+ F: __dxlog_file11,
3282
3163
  L: 154,
3283
3164
  S: this,
3284
3165
  C: (f, a) => f(...a)
3285
3166
  });
3286
- const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
3167
+ const credential = await (0, import_credentials8.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
3287
3168
  (0, import_invariant10.invariant)(credential.credential, void 0, {
3288
- F: __dxlog_file12,
3169
+ F: __dxlog_file11,
3289
3170
  L: 161,
3290
3171
  S: this,
3291
3172
  A: [
@@ -3324,7 +3205,7 @@ var SpaceInvitationProtocol = class {
3324
3205
  }
3325
3206
  async accept(response) {
3326
3207
  (0, import_invariant10.invariant)(response.space, void 0, {
3327
- F: __dxlog_file12,
3208
+ F: __dxlog_file11,
3328
3209
  L: 196,
3329
3210
  S: this,
3330
3211
  A: [
@@ -3333,9 +3214,9 @@ var SpaceInvitationProtocol = class {
3333
3214
  ]
3334
3215
  });
3335
3216
  const { credential, controlTimeframe, dataTimeframe } = response.space;
3336
- const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
3217
+ const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
3337
3218
  (0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
3338
- F: __dxlog_file12,
3219
+ F: __dxlog_file11,
3339
3220
  L: 199,
3340
3221
  S: this,
3341
3222
  A: [
@@ -3344,7 +3225,7 @@ var SpaceInvitationProtocol = class {
3344
3225
  ]
3345
3226
  });
3346
3227
  (0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
3347
- F: __dxlog_file12,
3228
+ F: __dxlog_file11,
3348
3229
  L: 200,
3349
3230
  S: this,
3350
3231
  A: [
@@ -3367,7 +3248,7 @@ var SpaceInvitationProtocol = class {
3367
3248
  };
3368
3249
  }
3369
3250
  };
3370
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3251
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3371
3252
  var InvitationsManager = class {
3372
3253
  constructor(_invitationsHandler, _getHandler, _metadataStore) {
3373
3254
  this._invitationsHandler = _invitationsHandler;
@@ -3409,8 +3290,8 @@ var InvitationsManager = class {
3409
3290
  try {
3410
3291
  await this._persistIfRequired(handler, stream, invitation);
3411
3292
  } catch (err) {
3412
- import_log10.log.catch(err, void 0, {
3413
- F: __dxlog_file13,
3293
+ import_log9.log.catch(err, void 0, {
3294
+ F: __dxlog_file12,
3414
3295
  L: 82,
3415
3296
  S: this,
3416
3297
  C: (f, a) => f(...a)
@@ -3433,7 +3314,7 @@ var InvitationsManager = class {
3433
3314
  const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
3434
3315
  const loadTasks = freshInvitations.map((persistentInvitation) => {
3435
3316
  (0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
3436
- F: __dxlog_file13,
3317
+ F: __dxlog_file12,
3437
3318
  L: 103,
3438
3319
  S: this,
3439
3320
  A: [
@@ -3451,8 +3332,8 @@ var InvitationsManager = class {
3451
3332
  invitations: cInvitations.map((invitation) => invitation.get())
3452
3333
  };
3453
3334
  } catch (err) {
3454
- import_log10.log.catch(err, void 0, {
3455
- F: __dxlog_file13,
3335
+ import_log9.log.catch(err, void 0, {
3336
+ F: __dxlog_file12,
3456
3337
  L: 110,
3457
3338
  S: this,
3458
3339
  C: (f, a) => f(...a)
@@ -3483,14 +3364,14 @@ var InvitationsManager = class {
3483
3364
  return invitation;
3484
3365
  }
3485
3366
  async authenticate({ invitationId, authCode }) {
3486
- (0, import_log10.log)("authenticating...", void 0, {
3487
- F: __dxlog_file13,
3367
+ (0, import_log9.log)("authenticating...", void 0, {
3368
+ F: __dxlog_file12,
3488
3369
  L: 140,
3489
3370
  S: this,
3490
3371
  C: (f, a) => f(...a)
3491
3372
  });
3492
3373
  (0, import_invariant11.invariant)(invitationId, void 0, {
3493
- F: __dxlog_file13,
3374
+ F: __dxlog_file12,
3494
3375
  L: 141,
3495
3376
  S: this,
3496
3377
  A: [
@@ -3500,10 +3381,10 @@ var InvitationsManager = class {
3500
3381
  });
3501
3382
  const observable = this._acceptInvitations.get(invitationId);
3502
3383
  if (!observable) {
3503
- import_log10.log.warn("invalid invitation", {
3384
+ import_log9.log.warn("invalid invitation", {
3504
3385
  invitationId
3505
3386
  }, {
3506
- F: __dxlog_file13,
3387
+ F: __dxlog_file12,
3507
3388
  L: 144,
3508
3389
  S: this,
3509
3390
  C: (f, a) => f(...a)
@@ -3513,16 +3394,16 @@ var InvitationsManager = class {
3513
3394
  }
3514
3395
  }
3515
3396
  async cancelInvitation({ invitationId }) {
3516
- (0, import_log10.log)("cancelInvitation...", {
3397
+ (0, import_log9.log)("cancelInvitation...", {
3517
3398
  invitationId
3518
3399
  }, {
3519
- F: __dxlog_file13,
3400
+ F: __dxlog_file12,
3520
3401
  L: 151,
3521
3402
  S: this,
3522
3403
  C: (f, a) => f(...a)
3523
3404
  });
3524
3405
  (0, import_invariant11.invariant)(invitationId, void 0, {
3525
- F: __dxlog_file13,
3406
+ F: __dxlog_file12,
3526
3407
  L: 152,
3527
3408
  S: this,
3528
3409
  A: [
@@ -3535,7 +3416,7 @@ var InvitationsManager = class {
3535
3416
  if (created.get().persistent) {
3536
3417
  await this._metadataStore.removeInvitation(invitationId);
3537
3418
  }
3538
- if (created.get().type === import_services11.Invitation.Type.DELEGATED) {
3419
+ if (created.get().type === import_services10.Invitation.Type.DELEGATED) {
3539
3420
  const handler = this._getHandler(created.get());
3540
3421
  await handler.cancelDelegation(created.get());
3541
3422
  }
@@ -3569,8 +3450,8 @@ var InvitationsManager = class {
3569
3450
  }
3570
3451
  }
3571
3452
  _createInvitation(protocol, options) {
3572
- const { invitationId = import_keys9.PublicKey.random().toHex(), type = import_services11.Invitation.Type.INTERACTIVE, authMethod = import_services11.Invitation.AuthMethod.SHARED_SECRET, state = import_services11.Invitation.State.INIT, timeout = import_client_protocol3.INVITATION_TIMEOUT, swarmKey = import_keys9.PublicKey.random(), persistent = options?.authMethod !== import_services11.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials12.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false } = options ?? {};
3573
- const authCode = options?.authCode ?? (authMethod === import_services11.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials11.generatePasscode)(import_client_protocol3.AUTHENTICATION_CODE_LENGTH) : void 0);
3453
+ const { invitationId = import_keys8.PublicKey.random().toHex(), type = import_services10.Invitation.Type.INTERACTIVE, authMethod = import_services10.Invitation.AuthMethod.SHARED_SECRET, state = import_services10.Invitation.State.INIT, timeout = import_client_protocol3.INVITATION_TIMEOUT, swarmKey = import_keys8.PublicKey.random(), persistent = options?.authMethod !== import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials11.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false } = options ?? {};
3454
+ const authCode = options?.authCode ?? (authMethod === import_services10.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials10.generatePasscode)(import_client_protocol3.AUTHENTICATION_CODE_LENGTH) : void 0);
3574
3455
  return {
3575
3456
  invitationId,
3576
3457
  type,
@@ -3579,8 +3460,8 @@ var InvitationsManager = class {
3579
3460
  swarmKey,
3580
3461
  authCode,
3581
3462
  timeout,
3582
- persistent: persistent && type !== import_services11.Invitation.Type.DELEGATED,
3583
- guestKeypair: guestKeypair ?? (authMethod === import_services11.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
3463
+ persistent: persistent && type !== import_services10.Invitation.Type.DELEGATED,
3464
+ guestKeypair: guestKeypair ?? (authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
3584
3465
  created,
3585
3466
  lifetime,
3586
3467
  role,
@@ -3591,17 +3472,17 @@ var InvitationsManager = class {
3591
3472
  }
3592
3473
  _createObservableInvitation(handler, invitation) {
3593
3474
  const stream = new import_async11.PushStream();
3594
- const ctx = new import_context9.Context({
3475
+ const ctx = new import_context8.Context({
3595
3476
  onError: (err) => {
3596
3477
  stream.error(err);
3597
3478
  void ctx.dispose();
3598
3479
  }
3599
3480
  });
3600
3481
  ctx.onDispose(() => {
3601
- (0, import_log10.log)("complete", {
3482
+ (0, import_log9.log)("complete", {
3602
3483
  ...handler.toJSON()
3603
3484
  }, {
3604
- F: __dxlog_file13,
3485
+ F: __dxlog_file12,
3605
3486
  L: 241,
3606
3487
  S: this,
3607
3488
  C: (f, a) => f(...a)
@@ -3614,7 +3495,7 @@ var InvitationsManager = class {
3614
3495
  onCancel: async () => {
3615
3496
  stream.next({
3616
3497
  ...invitation,
3617
- state: import_services11.Invitation.State.CANCELLED
3498
+ state: import_services10.Invitation.State.CANCELLED
3618
3499
  });
3619
3500
  await ctx.dispose();
3620
3501
  }
@@ -3628,41 +3509,41 @@ var InvitationsManager = class {
3628
3509
  _createObservableAcceptingInvitation(handler, initialState) {
3629
3510
  const otpEnteredTrigger = new import_async11.Trigger();
3630
3511
  const stream = new import_async11.PushStream();
3631
- const ctx = new import_context9.Context({
3512
+ const ctx = new import_context8.Context({
3632
3513
  onError: (err) => {
3633
3514
  if (err instanceof import_async11.TimeoutError) {
3634
- (0, import_log10.log)("timeout", {
3515
+ (0, import_log9.log)("timeout", {
3635
3516
  ...handler.toJSON()
3636
3517
  }, {
3637
- F: __dxlog_file13,
3518
+ F: __dxlog_file12,
3638
3519
  L: 261,
3639
3520
  S: this,
3640
3521
  C: (f, a) => f(...a)
3641
3522
  });
3642
3523
  stream.next({
3643
3524
  ...initialState,
3644
- state: import_services11.Invitation.State.TIMEOUT
3525
+ state: import_services10.Invitation.State.TIMEOUT
3645
3526
  });
3646
3527
  } else {
3647
- import_log10.log.warn("auth failed", err, {
3648
- F: __dxlog_file13,
3528
+ import_log9.log.warn("auth failed", err, {
3529
+ F: __dxlog_file12,
3649
3530
  L: 264,
3650
3531
  S: this,
3651
3532
  C: (f, a) => f(...a)
3652
3533
  });
3653
3534
  stream.next({
3654
3535
  ...initialState,
3655
- state: import_services11.Invitation.State.ERROR
3536
+ state: import_services10.Invitation.State.ERROR
3656
3537
  });
3657
3538
  }
3658
3539
  void ctx.dispose();
3659
3540
  }
3660
3541
  });
3661
3542
  ctx.onDispose(() => {
3662
- (0, import_log10.log)("complete", {
3543
+ (0, import_log9.log)("complete", {
3663
3544
  ...handler.toJSON()
3664
3545
  }, {
3665
- F: __dxlog_file13,
3546
+ F: __dxlog_file12,
3666
3547
  L: 271,
3667
3548
  S: this,
3668
3549
  C: (f, a) => f(...a)
@@ -3675,7 +3556,7 @@ var InvitationsManager = class {
3675
3556
  onCancel: async () => {
3676
3557
  stream.next({
3677
3558
  ...initialState,
3678
- state: import_services11.Invitation.State.CANCELLED
3559
+ state: import_services10.Invitation.State.CANCELLED
3679
3560
  });
3680
3561
  await ctx.dispose();
3681
3562
  },
@@ -3691,7 +3572,7 @@ var InvitationsManager = class {
3691
3572
  };
3692
3573
  }
3693
3574
  async _persistIfRequired(handler, changeStream, invitation) {
3694
- if (invitation.type === import_services11.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
3575
+ if (invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
3695
3576
  const delegationCredentialId = await handler.delegate(invitation);
3696
3577
  changeStream.next({
3697
3578
  ...invitation,
@@ -3706,8 +3587,8 @@ var InvitationsManager = class {
3706
3587
  try {
3707
3588
  await this._metadataStore.removeInvitation(invitation.invitationId);
3708
3589
  } catch (err) {
3709
- import_log10.log.catch(err, void 0, {
3710
- F: __dxlog_file13,
3590
+ import_log9.log.catch(err, void 0, {
3591
+ F: __dxlog_file12,
3711
3592
  L: 307,
3712
3593
  S: this,
3713
3594
  C: (f, a) => f(...a)
@@ -3729,7 +3610,7 @@ var AutomergeSpaceState = class {
3729
3610
  this._isProcessingRootDocs = false;
3730
3611
  }
3731
3612
  async processCredential(credential) {
3732
- if (!(0, import_credentials14.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
3613
+ if (!(0, import_credentials13.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
3733
3614
  return;
3734
3615
  }
3735
3616
  this.lastEpoch = credential;
@@ -3754,18 +3635,18 @@ var AutomergeSpaceState = class {
3754
3635
  await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
3755
3636
  }
3756
3637
  };
3757
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3638
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3758
3639
  var DEFAULT_RETRY_TIMEOUT = 1e3;
3759
3640
  var DEFAULT_SUCCESS_DELAY = 1e3;
3760
3641
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
3761
3642
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
3762
3643
  var NotarizationPlugin = class {
3763
3644
  constructor() {
3764
- this._ctx = new import_context11.Context();
3645
+ this._ctx = new import_context10.Context();
3765
3646
  this._extensionOpened = new import_async14.Event();
3766
3647
  this._extensions = /* @__PURE__ */ new Set();
3767
- this._processedCredentials = new import_util7.ComplexSet(import_keys11.PublicKey.hash);
3768
- this._processCredentialsTriggers = new import_util7.ComplexMap(import_keys11.PublicKey.hash);
3648
+ this._processedCredentials = new import_util7.ComplexSet(import_keys10.PublicKey.hash);
3649
+ this._processCredentialsTriggers = new import_util7.ComplexMap(import_keys10.PublicKey.hash);
3769
3650
  }
3770
3651
  get hasWriter() {
3771
3652
  return !!this._writer;
@@ -3779,16 +3660,16 @@ var NotarizationPlugin = class {
3779
3660
  * Request credentials to be notarized.
3780
3661
  */
3781
3662
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
3782
- (0, import_log12.log)("notarize", {
3663
+ (0, import_log11.log)("notarize", {
3783
3664
  credentials
3784
3665
  }, {
3785
- F: __dxlog_file14,
3666
+ F: __dxlog_file13,
3786
3667
  L: 90,
3787
3668
  S: this,
3788
3669
  C: (f, a) => f(...a)
3789
3670
  });
3790
3671
  (0, import_invariant13.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
3791
- F: __dxlog_file14,
3672
+ F: __dxlog_file13,
3792
3673
  L: 91,
3793
3674
  S: this,
3794
3675
  A: [
@@ -3799,10 +3680,10 @@ var NotarizationPlugin = class {
3799
3680
  const errors = new import_async14.Trigger();
3800
3681
  const ctx = this._ctx.derive({
3801
3682
  onError: (err) => {
3802
- import_log12.log.warn("Notarization error", {
3683
+ import_log11.log.warn("Notarization error", {
3803
3684
  err
3804
3685
  }, {
3805
- F: __dxlog_file14,
3686
+ F: __dxlog_file13,
3806
3687
  L: 99,
3807
3688
  S: this,
3808
3689
  C: (f, a) => f(...a)
@@ -3814,11 +3695,11 @@ var NotarizationPlugin = class {
3814
3695
  opCtx?.onDispose(() => ctx.dispose());
3815
3696
  if (timeout !== 0) {
3816
3697
  (0, import_async14.scheduleTask)(ctx, () => {
3817
- import_log12.log.warn("Notarization timeout", {
3698
+ import_log11.log.warn("Notarization timeout", {
3818
3699
  timeout,
3819
3700
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
3820
3701
  }, {
3821
- F: __dxlog_file14,
3702
+ F: __dxlog_file13,
3822
3703
  L: 111,
3823
3704
  S: this,
3824
3705
  C: (f, a) => f(...a)
@@ -3838,10 +3719,10 @@ var NotarizationPlugin = class {
3838
3719
  ...this._extensions
3839
3720
  ].find((peer2) => !peersTried.has(peer2));
3840
3721
  if (!peer) {
3841
- import_log12.log.info("Exhausted all peers to notarize with", {
3722
+ import_log11.log.info("Exhausted all peers to notarize with", {
3842
3723
  retryIn: retryTimeout
3843
3724
  }, {
3844
- F: __dxlog_file14,
3725
+ F: __dxlog_file13,
3845
3726
  L: 136,
3846
3727
  S: this,
3847
3728
  C: (f, a) => f(...a)
@@ -3851,11 +3732,11 @@ var NotarizationPlugin = class {
3851
3732
  return;
3852
3733
  }
3853
3734
  peersTried.add(peer);
3854
- (0, import_log12.log)("try notarizing", {
3735
+ (0, import_log11.log)("try notarizing", {
3855
3736
  peer: peer.localPeerId,
3856
3737
  credentialId: credentials.map((credential) => credential.id)
3857
3738
  }, {
3858
- F: __dxlog_file14,
3739
+ F: __dxlog_file13,
3859
3740
  L: 143,
3860
3741
  S: this,
3861
3742
  C: (f, a) => f(...a)
@@ -3863,8 +3744,8 @@ var NotarizationPlugin = class {
3863
3744
  await peer.rpc.NotarizationService.notarize({
3864
3745
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
3865
3746
  });
3866
- (0, import_log12.log)("success", void 0, {
3867
- F: __dxlog_file14,
3747
+ (0, import_log11.log)("success", void 0, {
3748
+ F: __dxlog_file13,
3868
3749
  L: 147,
3869
3750
  S: this,
3870
3751
  C: (f, a) => f(...a)
@@ -3872,8 +3753,8 @@ var NotarizationPlugin = class {
3872
3753
  await (0, import_async14.sleep)(successDelay);
3873
3754
  } catch (err) {
3874
3755
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
3875
- import_log12.log.info("error notarizing (recoverable)", err, {
3876
- F: __dxlog_file14,
3756
+ import_log11.log.info("error notarizing (recoverable)", err, {
3757
+ F: __dxlog_file13,
3877
3758
  L: 151,
3878
3759
  S: this,
3879
3760
  C: (f, a) => f(...a)
@@ -3886,12 +3767,12 @@ var NotarizationPlugin = class {
3886
3767
  this._extensionOpened.on(ctx, () => notarizeTask.schedule());
3887
3768
  try {
3888
3769
  await Promise.race([
3889
- (0, import_context11.rejectOnDispose)(ctx),
3770
+ (0, import_context10.rejectOnDispose)(ctx),
3890
3771
  allNotarized,
3891
3772
  errors.wait()
3892
3773
  ]);
3893
- (0, import_log12.log)("done", void 0, {
3894
- F: __dxlog_file14,
3774
+ (0, import_log11.log)("done", void 0, {
3775
+ F: __dxlog_file13,
3895
3776
  L: 162,
3896
3777
  S: this,
3897
3778
  C: (f, a) => f(...a)
@@ -3913,7 +3794,7 @@ var NotarizationPlugin = class {
3913
3794
  }
3914
3795
  setWriter(writer) {
3915
3796
  (0, import_invariant13.invariant)(!this._writer, "Writer already set.", {
3916
- F: __dxlog_file14,
3797
+ F: __dxlog_file13,
3917
3798
  L: 181,
3918
3799
  S: this,
3919
3800
  A: [
@@ -3938,7 +3819,7 @@ var NotarizationPlugin = class {
3938
3819
  }
3939
3820
  for (const credential of request.credentials ?? []) {
3940
3821
  (0, import_invariant13.invariant)(credential.id, "Credential must have an id", {
3941
- F: __dxlog_file14,
3822
+ F: __dxlog_file13,
3942
3823
  L: 200,
3943
3824
  S: this,
3944
3825
  A: [
@@ -3955,10 +3836,10 @@ var NotarizationPlugin = class {
3955
3836
  createExtension() {
3956
3837
  const extension = new NotarizationTeleportExtension({
3957
3838
  onOpen: async () => {
3958
- (0, import_log12.log)("extension opened", {
3839
+ (0, import_log11.log)("extension opened", {
3959
3840
  peer: extension.localPeerId
3960
3841
  }, {
3961
- F: __dxlog_file14,
3842
+ F: __dxlog_file13,
3962
3843
  L: 211,
3963
3844
  S: this,
3964
3845
  C: (f, a) => f(...a)
@@ -3967,10 +3848,10 @@ var NotarizationPlugin = class {
3967
3848
  this._extensionOpened.emit();
3968
3849
  },
3969
3850
  onClose: async () => {
3970
- (0, import_log12.log)("extension closed", {
3851
+ (0, import_log11.log)("extension closed", {
3971
3852
  peer: extension.localPeerId
3972
3853
  }, {
3973
- F: __dxlog_file14,
3854
+ F: __dxlog_file13,
3974
3855
  L: 216,
3975
3856
  S: this,
3976
3857
  C: (f, a) => f(...a)
@@ -4022,14 +3903,14 @@ function _ts_decorate4(decorators, target, key, desc) {
4022
3903
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4023
3904
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4024
3905
  }
4025
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
3906
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
4026
3907
  var DataSpace = class {
4027
3908
  constructor(params) {
4028
- this._ctx = new import_context10.Context();
3909
+ this._ctx = new import_context9.Context();
4029
3910
  this._notarizationPlugin = new NotarizationPlugin();
4030
3911
  this._cache = void 0;
4031
3912
  this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
4032
- this._state = import_services12.SpaceState.CLOSED;
3913
+ this._state = import_services11.SpaceState.CLOSED;
4033
3914
  this.error = void 0;
4034
3915
  this.stateUpdate = new import_async12.Event();
4035
3916
  this.metrics = {};
@@ -4044,16 +3925,16 @@ var DataSpace = class {
4044
3925
  this._callbacks = params.callbacks ?? {};
4045
3926
  this._echoHost = params.echoHost;
4046
3927
  this.authVerifier = new TrustedKeySetAuthVerifier({
4047
- trustedKeysProvider: () => new import_util6.ComplexSet(import_keys10.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials13.SpaceMember.Role.REMOVED).map((member) => member.key)),
3928
+ trustedKeysProvider: () => new import_util6.ComplexSet(import_keys9.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials12.SpaceMember.Role.REMOVED).map((member) => member.key)),
4048
3929
  update: this._inner.stateUpdate,
4049
3930
  authTimeout: import_client_protocol4.AUTH_TIMEOUT
4050
3931
  });
4051
3932
  this._cache = params.cache;
4052
3933
  this._state = params.initialState;
4053
- (0, import_log11.log)("new state", {
4054
- state: import_services12.SpaceState[this._state]
3934
+ (0, import_log10.log)("new state", {
3935
+ state: import_services11.SpaceState[this._state]
4055
3936
  }, {
4056
- F: __dxlog_file15,
3937
+ F: __dxlog_file14,
4057
3938
  L: 143,
4058
3939
  S: this,
4059
3940
  C: (f, a) => f(...a)
@@ -4094,23 +3975,20 @@ var DataSpace = class {
4094
3975
  };
4095
3976
  }
4096
3977
  async open() {
4097
- if (this._state === import_services12.SpaceState.CLOSED) {
4098
- await this._open();
4099
- }
3978
+ await this._open();
4100
3979
  }
4101
3980
  async _open() {
4102
- await this._presence.open();
4103
3981
  await this._gossip.open();
4104
3982
  await this._notarizationPlugin.open();
4105
3983
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
4106
3984
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
4107
- await this._inner.open(new import_context10.Context());
4108
- this._state = import_services12.SpaceState.CONTROL_ONLY;
4109
- (0, import_log11.log)("new state", {
4110
- state: import_services12.SpaceState[this._state]
3985
+ await this._inner.open(new import_context9.Context());
3986
+ this._state = import_services11.SpaceState.CONTROL_ONLY;
3987
+ (0, import_log10.log)("new state", {
3988
+ state: import_services11.SpaceState[this._state]
4111
3989
  }, {
4112
- F: __dxlog_file15,
4113
- L: 209,
3990
+ F: __dxlog_file14,
3991
+ L: 206,
4114
3992
  S: this,
4115
3993
  C: (f, a) => f(...a)
4116
3994
  });
@@ -4123,23 +4001,23 @@ var DataSpace = class {
4123
4001
  }
4124
4002
  async _close() {
4125
4003
  await this._callbacks.beforeClose?.();
4126
- this._state = import_services12.SpaceState.CLOSED;
4127
- (0, import_log11.log)("new state", {
4128
- state: import_services12.SpaceState[this._state]
4004
+ this._state = import_services11.SpaceState.CLOSED;
4005
+ (0, import_log10.log)("new state", {
4006
+ state: import_services11.SpaceState[this._state]
4129
4007
  }, {
4130
- F: __dxlog_file15,
4131
- L: 223,
4008
+ F: __dxlog_file14,
4009
+ L: 220,
4132
4010
  S: this,
4133
4011
  C: (f, a) => f(...a)
4134
4012
  });
4135
4013
  await this._ctx.dispose();
4136
- this._ctx = new import_context10.Context();
4014
+ this._ctx = new import_context9.Context();
4137
4015
  await this.authVerifier.close();
4138
4016
  await this._inner.close();
4139
4017
  await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
4140
4018
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
4141
4019
  await this._notarizationPlugin.close();
4142
- await this._presence.close();
4020
+ await this._presence.destroy();
4143
4021
  await this._gossip.close();
4144
4022
  }
4145
4023
  async postMessage(channel, message) {
@@ -4157,27 +4035,27 @@ var DataSpace = class {
4157
4035
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
4158
4036
  await this.initializeDataPipeline();
4159
4037
  } catch (err) {
4160
- if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
4161
- (0, import_log11.log)("data pipeline initialization cancelled", err, {
4162
- F: __dxlog_file15,
4163
- L: 256,
4038
+ if (err instanceof import_protocols9.CancelledError || err instanceof import_context9.ContextDisposedError) {
4039
+ (0, import_log10.log)("data pipeline initialization cancelled", err, {
4040
+ F: __dxlog_file14,
4041
+ L: 253,
4164
4042
  S: this,
4165
4043
  C: (f, a) => f(...a)
4166
4044
  });
4167
4045
  return;
4168
4046
  }
4169
- import_log11.log.error("Error initializing data pipeline", err, {
4170
- F: __dxlog_file15,
4171
- L: 260,
4047
+ import_log10.log.error("Error initializing data pipeline", err, {
4048
+ F: __dxlog_file14,
4049
+ L: 257,
4172
4050
  S: this,
4173
4051
  C: (f, a) => f(...a)
4174
4052
  });
4175
- this._state = import_services12.SpaceState.ERROR;
4176
- (0, import_log11.log)("new state", {
4177
- state: import_services12.SpaceState[this._state]
4053
+ this._state = import_services11.SpaceState.ERROR;
4054
+ (0, import_log10.log)("new state", {
4055
+ state: import_services11.SpaceState[this._state]
4178
4056
  }, {
4179
- F: __dxlog_file15,
4180
- L: 262,
4057
+ F: __dxlog_file14,
4058
+ L: 259,
4181
4059
  S: this,
4182
4060
  C: (f, a) => f(...a)
4183
4061
  });
@@ -4189,35 +4067,35 @@ var DataSpace = class {
4189
4067
  });
4190
4068
  }
4191
4069
  async initializeDataPipeline() {
4192
- if (this._state !== import_services12.SpaceState.CONTROL_ONLY) {
4070
+ if (this._state !== import_services11.SpaceState.CONTROL_ONLY) {
4193
4071
  throw new import_protocols9.SystemError("Invalid operation");
4194
4072
  }
4195
- this._state = import_services12.SpaceState.INITIALIZING;
4196
- (0, import_log11.log)("new state", {
4197
- state: import_services12.SpaceState[this._state]
4073
+ this._state = import_services11.SpaceState.INITIALIZING;
4074
+ (0, import_log10.log)("new state", {
4075
+ state: import_services11.SpaceState[this._state]
4198
4076
  }, {
4199
- F: __dxlog_file15,
4200
- L: 278,
4077
+ F: __dxlog_file14,
4078
+ L: 275,
4201
4079
  S: this,
4202
4080
  C: (f, a) => f(...a)
4203
4081
  });
4204
4082
  await this._initializeAndReadControlPipeline();
4205
4083
  await (0, import_async12.sleep)(1);
4206
4084
  this._automergeSpaceState.startProcessingRootDocs();
4207
- await (0, import_context10.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
4208
- (0, import_log11.log)("data pipeline ready", void 0, {
4209
- F: __dxlog_file15,
4210
- L: 290,
4085
+ await (0, import_context9.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
4086
+ (0, import_log10.log)("data pipeline ready", void 0, {
4087
+ F: __dxlog_file14,
4088
+ L: 287,
4211
4089
  S: this,
4212
4090
  C: (f, a) => f(...a)
4213
4091
  });
4214
4092
  await this._callbacks.beforeReady?.();
4215
- this._state = import_services12.SpaceState.READY;
4216
- (0, import_log11.log)("new state", {
4217
- state: import_services12.SpaceState[this._state]
4093
+ this._state = import_services11.SpaceState.READY;
4094
+ (0, import_log10.log)("new state", {
4095
+ state: import_services11.SpaceState[this._state]
4218
4096
  }, {
4219
- F: __dxlog_file15,
4220
- L: 294,
4097
+ F: __dxlog_file14,
4098
+ L: 291,
4221
4099
  S: this,
4222
4100
  C: (f, a) => f(...a)
4223
4101
  });
@@ -4231,9 +4109,9 @@ var DataSpace = class {
4231
4109
  });
4232
4110
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
4233
4111
  await this._createWritableFeeds();
4234
- (0, import_log11.log)("writable feeds created", void 0, {
4235
- F: __dxlog_file15,
4236
- L: 310,
4112
+ (0, import_log10.log)("writable feeds created", void 0, {
4113
+ F: __dxlog_file14,
4114
+ L: 307,
4237
4115
  S: this,
4238
4116
  C: (f, a) => f(...a)
4239
4117
  });
@@ -4260,7 +4138,7 @@ var DataSpace = class {
4260
4138
  spaceKey: this.key,
4261
4139
  deviceKey: this._signingContext.deviceKey,
4262
4140
  identityKey: this._signingContext.identityKey,
4263
- designation: import_credentials13.AdmittedFeed.Designation.CONTROL
4141
+ designation: import_credentials12.AdmittedFeed.Designation.CONTROL
4264
4142
  }
4265
4143
  }));
4266
4144
  }
@@ -4277,7 +4155,7 @@ var DataSpace = class {
4277
4155
  spaceKey: this.key,
4278
4156
  deviceKey: this._signingContext.deviceKey,
4279
4157
  identityKey: this._signingContext.identityKey,
4280
- designation: import_credentials13.AdmittedFeed.Designation.DATA
4158
+ designation: import_credentials12.AdmittedFeed.Designation.DATA
4281
4159
  }
4282
4160
  }));
4283
4161
  }
@@ -4291,12 +4169,12 @@ var DataSpace = class {
4291
4169
  }
4292
4170
  }
4293
4171
  _onNewAutomergeRoot(rootUrl) {
4294
- (0, import_log11.log)("loading automerge root doc for space", {
4172
+ (0, import_log10.log)("loading automerge root doc for space", {
4295
4173
  space: this.key,
4296
4174
  rootUrl
4297
4175
  }, {
4298
- F: __dxlog_file15,
4299
- L: 376,
4176
+ F: __dxlog_file14,
4177
+ L: 373,
4300
4178
  S: this,
4301
4179
  C: (f, a) => f(...a)
4302
4180
  });
@@ -4305,7 +4183,7 @@ var DataSpace = class {
4305
4183
  queueMicrotask(async () => {
4306
4184
  try {
4307
4185
  await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
4308
- await (0, import_context10.cancelWithContext)(this._ctx, handle.whenReady());
4186
+ await (0, import_context9.cancelWithContext)(this._ctx, handle.whenReady());
4309
4187
  });
4310
4188
  if (this._ctx.disposed) {
4311
4189
  return;
@@ -4321,27 +4199,27 @@ var DataSpace = class {
4321
4199
  if (!this._echoHost.roots.has(handle.documentId)) {
4322
4200
  await this._echoHost.openSpaceRoot(handle.url);
4323
4201
  } else {
4324
- import_log11.log.warn("echo database root already exists", {
4202
+ import_log10.log.warn("echo database root already exists", {
4325
4203
  space: this.key,
4326
4204
  rootUrl
4327
4205
  }, {
4328
- F: __dxlog_file15,
4329
- L: 403,
4206
+ F: __dxlog_file14,
4207
+ L: 400,
4330
4208
  S: this,
4331
4209
  C: (f, a) => f(...a)
4332
4210
  });
4333
4211
  }
4334
4212
  } catch (err) {
4335
- if (err instanceof import_context10.ContextDisposedError) {
4213
+ if (err instanceof import_context9.ContextDisposedError) {
4336
4214
  return;
4337
4215
  }
4338
- import_log11.log.warn("error loading automerge root doc", {
4216
+ import_log10.log.warn("error loading automerge root doc", {
4339
4217
  space: this.key,
4340
4218
  rootUrl,
4341
4219
  err
4342
4220
  }, {
4343
- F: __dxlog_file15,
4344
- L: 409,
4221
+ F: __dxlog_file14,
4222
+ L: 406,
4345
4223
  S: this,
4346
4224
  C: (f, a) => f(...a)
4347
4225
  });
@@ -4367,39 +4245,39 @@ var DataSpace = class {
4367
4245
  let epoch;
4368
4246
  switch (options?.migration) {
4369
4247
  case void 0:
4370
- case import_services12.CreateEpochRequest.Migration.NONE:
4248
+ case import_services11.CreateEpochRequest.Migration.NONE:
4371
4249
  {
4372
4250
  epoch = {
4373
4251
  previousId: this._automergeSpaceState.lastEpoch?.id,
4374
4252
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4375
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
4253
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
4376
4254
  automergeRoot: this._automergeSpaceState.lastEpoch?.subject.assertion?.automergeRoot
4377
4255
  };
4378
4256
  }
4379
4257
  break;
4380
- case import_services12.CreateEpochRequest.Migration.INIT_AUTOMERGE:
4258
+ case import_services11.CreateEpochRequest.Migration.INIT_AUTOMERGE:
4381
4259
  {
4382
4260
  const document = this._echoHost.automergeRepo.create();
4383
4261
  epoch = {
4384
4262
  previousId: this._automergeSpaceState.lastEpoch?.id,
4385
4263
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4386
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
4264
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
4387
4265
  automergeRoot: document.url
4388
4266
  };
4389
4267
  }
4390
4268
  break;
4391
- case import_services12.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
4269
+ case import_services11.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
4392
4270
  {
4393
4271
  const currentRootUrl = this._automergeSpaceState.rootUrl;
4394
4272
  const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
4395
- await (0, import_context10.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
4273
+ await (0, import_context9.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
4396
4274
  const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
4397
4275
  await this._echoHost.automergeRepo.flush([
4398
4276
  newRoot.documentId
4399
4277
  ]);
4400
4278
  (0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4401
- F: __dxlog_file15,
4402
- L: 460,
4279
+ F: __dxlog_file14,
4280
+ L: 457,
4403
4281
  S: this,
4404
4282
  A: [
4405
4283
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4409,28 +4287,28 @@ var DataSpace = class {
4409
4287
  epoch = {
4410
4288
  previousId: this._automergeSpaceState.lastEpoch?.id,
4411
4289
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4412
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
4290
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
4413
4291
  automergeRoot: newRoot.url
4414
4292
  };
4415
4293
  }
4416
4294
  break;
4417
- case import_services12.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
4295
+ case import_services11.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
4418
4296
  {
4419
- import_log11.log.info("Fragmenting", void 0, {
4420
- F: __dxlog_file15,
4421
- L: 472,
4297
+ import_log10.log.info("Fragmenting", void 0, {
4298
+ F: __dxlog_file14,
4299
+ L: 469,
4422
4300
  S: this,
4423
4301
  C: (f, a) => f(...a)
4424
4302
  });
4425
4303
  const currentRootUrl = this._automergeSpaceState.rootUrl;
4426
4304
  const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
4427
- await (0, import_context10.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
4305
+ await (0, import_context9.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
4428
4306
  const objects = Object.entries(rootHandle.docSync().objects);
4429
4307
  const properties = findPropertiesObject(rootHandle.docSync());
4430
4308
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4431
4309
  (0, import_invariant12.invariant)(properties, "Properties not found", {
4432
- F: __dxlog_file15,
4433
- L: 482,
4310
+ F: __dxlog_file14,
4311
+ L: 479,
4434
4312
  S: this,
4435
4313
  A: [
4436
4314
  "properties",
@@ -4445,8 +4323,8 @@ var DataSpace = class {
4445
4323
  };
4446
4324
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4447
4325
  (0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4448
- F: __dxlog_file15,
4449
- L: 487,
4326
+ F: __dxlog_file14,
4327
+ L: 484,
4450
4328
  S: this,
4451
4329
  A: [
4452
4330
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4469,16 +4347,16 @@ var DataSpace = class {
4469
4347
  epoch = {
4470
4348
  previousId: this._automergeSpaceState.lastEpoch?.id,
4471
4349
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4472
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
4350
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
4473
4351
  automergeRoot: newRoot.url
4474
4352
  };
4475
4353
  }
4476
4354
  break;
4477
- case import_services12.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
4355
+ case import_services11.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
4478
4356
  {
4479
4357
  (0, import_invariant12.invariant)(options.newAutomergeRoot, void 0, {
4480
- F: __dxlog_file15,
4481
- L: 517,
4358
+ F: __dxlog_file14,
4359
+ L: 514,
4482
4360
  S: this,
4483
4361
  A: [
4484
4362
  "options.newAutomergeRoot",
@@ -4488,7 +4366,7 @@ var DataSpace = class {
4488
4366
  epoch = {
4489
4367
  previousId: this._automergeSpaceState.lastEpoch?.id,
4490
4368
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4491
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
4369
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
4492
4370
  automergeRoot: options.newAutomergeRoot
4493
4371
  };
4494
4372
  }
@@ -4508,7 +4386,7 @@ var DataSpace = class {
4508
4386
  })
4509
4387
  }
4510
4388
  });
4511
- await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe3.Timeframe([
4389
+ await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe2.Timeframe([
4512
4390
  [
4513
4391
  receipt.feedKey,
4514
4392
  receipt.seq
@@ -4517,30 +4395,25 @@ var DataSpace = class {
4517
4395
  await this._echoHost.updateIndexes();
4518
4396
  }
4519
4397
  async activate() {
4520
- if (![
4521
- import_services12.SpaceState.CLOSED,
4522
- import_services12.SpaceState.INACTIVE
4523
- ].includes(this._state)) {
4398
+ if (this._state !== import_services11.SpaceState.INACTIVE) {
4524
4399
  return;
4525
4400
  }
4526
- await this._metadataStore.setSpaceState(this.key, import_services12.SpaceState.ACTIVE);
4401
+ await this._metadataStore.setSpaceState(this.key, import_services11.SpaceState.ACTIVE);
4527
4402
  await this._open();
4528
4403
  this.initializeDataPipelineAsync();
4529
4404
  }
4530
4405
  async deactivate() {
4531
- if (this._state === import_services12.SpaceState.INACTIVE) {
4406
+ if (this._state === import_services11.SpaceState.INACTIVE) {
4532
4407
  return;
4533
4408
  }
4534
- await this._metadataStore.setSpaceState(this.key, import_services12.SpaceState.INACTIVE);
4535
- if (this._state !== import_services12.SpaceState.CLOSED) {
4536
- await this._close();
4537
- }
4538
- this._state = import_services12.SpaceState.INACTIVE;
4539
- (0, import_log11.log)("new state", {
4540
- state: import_services12.SpaceState[this._state]
4409
+ await this._metadataStore.setSpaceState(this.key, import_services11.SpaceState.INACTIVE);
4410
+ await this._close();
4411
+ this._state = import_services11.SpaceState.INACTIVE;
4412
+ (0, import_log10.log)("new state", {
4413
+ state: import_services11.SpaceState[this._state]
4541
4414
  }, {
4542
- F: __dxlog_file15,
4543
- L: 571,
4415
+ F: __dxlog_file14,
4416
+ L: 567,
4544
4417
  S: this,
4545
4418
  C: (f, a) => f(...a)
4546
4419
  });
@@ -4558,7 +4431,7 @@ _ts_decorate4([
4558
4431
  ], DataSpace.prototype, "key", null);
4559
4432
  _ts_decorate4([
4560
4433
  import_tracing5.trace.info({
4561
- enum: import_services12.SpaceState
4434
+ enum: import_services11.SpaceState
4562
4435
  })
4563
4436
  ], DataSpace.prototype, "state", null);
4564
4437
  _ts_decorate4([
@@ -4609,7 +4482,7 @@ var findPropertiesObject = (spaceDoc) => {
4609
4482
  };
4610
4483
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4611
4484
  const credentials = [
4612
- await (0, import_credentials17.createCredential)({
4485
+ await (0, import_credentials16.createCredential)({
4613
4486
  signer: keyring,
4614
4487
  issuer: space.key,
4615
4488
  subject: space.key,
@@ -4618,14 +4491,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4618
4491
  spaceKey: space.key
4619
4492
  }
4620
4493
  }),
4621
- await (0, import_credentials17.createCredential)({
4494
+ await (0, import_credentials16.createCredential)({
4622
4495
  signer: keyring,
4623
4496
  issuer: space.key,
4624
4497
  subject: signingContext.identityKey,
4625
4498
  assertion: {
4626
4499
  "@type": "dxos.halo.credentials.SpaceMember",
4627
4500
  spaceKey: space.key,
4628
- role: import_credentials18.SpaceMember.Role.OWNER,
4501
+ role: import_credentials17.SpaceMember.Role.OWNER,
4629
4502
  profile: signingContext.getProfile(),
4630
4503
  genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
4631
4504
  }
@@ -4637,7 +4510,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4637
4510
  spaceKey: space.key,
4638
4511
  identityKey: signingContext.identityKey,
4639
4512
  deviceKey: signingContext.deviceKey,
4640
- designation: import_credentials18.AdmittedFeed.Designation.CONTROL
4513
+ designation: import_credentials17.AdmittedFeed.Designation.CONTROL
4641
4514
  }
4642
4515
  }),
4643
4516
  await signingContext.credentialSigner.createCredential({
@@ -4647,7 +4520,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4647
4520
  spaceKey: space.key,
4648
4521
  identityKey: signingContext.identityKey,
4649
4522
  deviceKey: signingContext.deviceKey,
4650
- designation: import_credentials18.AdmittedFeed.Designation.DATA
4523
+ designation: import_credentials17.AdmittedFeed.Designation.DATA
4651
4524
  }
4652
4525
  }),
4653
4526
  await signingContext.credentialSigner.createCredential({
@@ -4656,7 +4529,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4656
4529
  "@type": "dxos.halo.credentials.Epoch",
4657
4530
  number: 0,
4658
4531
  previousId: void 0,
4659
- timeframe: new import_timeframe4.Timeframe(),
4532
+ timeframe: new import_timeframe3.Timeframe(),
4660
4533
  snapshotCid: void 0,
4661
4534
  automergeRoot
4662
4535
  }
@@ -4681,12 +4554,11 @@ function _ts_decorate5(decorators, target, key, desc) {
4681
4554
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4682
4555
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4683
4556
  }
4684
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4557
+ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4685
4558
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
4686
4559
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
4687
- var DEFAULT_SPACE_KEY = "__DEFAULT__";
4688
4560
  var DataSpaceManager = class {
4689
- constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, _params) {
4561
+ constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, params) {
4690
4562
  this._spaceManager = _spaceManager;
4691
4563
  this._metadataStore = _metadataStore;
4692
4564
  this._keyring = _keyring;
@@ -4694,12 +4566,14 @@ var DataSpaceManager = class {
4694
4566
  this._feedStore = _feedStore;
4695
4567
  this._echoHost = _echoHost;
4696
4568
  this._invitationsManager = _invitationsManager;
4697
- this._params = _params;
4698
- this._ctx = new import_context12.Context();
4569
+ this._ctx = new import_context11.Context();
4699
4570
  this.updated = new import_async15.Event();
4700
- this._spaces = new import_util8.ComplexMap(import_keys12.PublicKey.hash);
4571
+ this._spaces = new import_util8.ComplexMap(import_keys11.PublicKey.hash);
4701
4572
  this._isOpen = false;
4702
- this._instanceId = import_keys12.PublicKey.random().toHex();
4573
+ this._instanceId = import_keys11.PublicKey.random().toHex();
4574
+ const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
4575
+ this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
4576
+ this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
4703
4577
  import_tracing6.trace.diagnostic({
4704
4578
  id: "spaces",
4705
4579
  name: "Spaces",
@@ -4711,7 +4585,7 @@ var DataSpaceManager = class {
4711
4585
  const properties = rootDoc && findPropertiesObject(rootDoc);
4712
4586
  return {
4713
4587
  key: space.key.toHex(),
4714
- state: import_services13.SpaceState[space.state],
4588
+ state: import_services12.SpaceState[space.state],
4715
4589
  name: properties?.[1].data.name ?? null,
4716
4590
  inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
4717
4591
  linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
@@ -4728,46 +4602,46 @@ var DataSpaceManager = class {
4728
4602
  return this._spaces;
4729
4603
  }
4730
4604
  async open() {
4731
- (0, import_log13.log)("open", void 0, {
4732
- F: __dxlog_file16,
4733
- L: 140,
4605
+ (0, import_log12.log)("open", void 0, {
4606
+ F: __dxlog_file15,
4607
+ L: 144,
4734
4608
  S: this,
4735
4609
  C: (f, a) => f(...a)
4736
4610
  });
4737
- import_log13.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
4611
+ import_log12.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
4738
4612
  id: this._instanceId
4739
4613
  }), {
4740
- F: __dxlog_file16,
4741
- L: 141,
4614
+ F: __dxlog_file15,
4615
+ L: 145,
4742
4616
  S: this,
4743
4617
  C: (f, a) => f(...a)
4744
4618
  });
4745
- (0, import_log13.log)("metadata loaded", {
4619
+ (0, import_log12.log)("metadata loaded", {
4746
4620
  spaces: this._metadataStore.spaces.length
4747
4621
  }, {
4748
- F: __dxlog_file16,
4749
- L: 142,
4622
+ F: __dxlog_file15,
4623
+ L: 146,
4750
4624
  S: this,
4751
4625
  C: (f, a) => f(...a)
4752
4626
  });
4753
4627
  await (0, import_util8.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
4754
4628
  try {
4755
- (0, import_log13.log)("load space", {
4629
+ (0, import_log12.log)("load space", {
4756
4630
  spaceMetadata
4757
4631
  }, {
4758
- F: __dxlog_file16,
4759
- L: 146,
4632
+ F: __dxlog_file15,
4633
+ L: 150,
4760
4634
  S: this,
4761
4635
  C: (f, a) => f(...a)
4762
4636
  });
4763
4637
  await this._constructSpace(spaceMetadata);
4764
4638
  } catch (err) {
4765
- import_log13.log.error("Error loading space", {
4639
+ import_log12.log.error("Error loading space", {
4766
4640
  spaceMetadata,
4767
4641
  err
4768
4642
  }, {
4769
- F: __dxlog_file16,
4770
- L: 149,
4643
+ F: __dxlog_file15,
4644
+ L: 153,
4771
4645
  S: this,
4772
4646
  C: (f, a) => f(...a)
4773
4647
  });
@@ -4775,19 +4649,24 @@ var DataSpaceManager = class {
4775
4649
  });
4776
4650
  this._isOpen = true;
4777
4651
  this.updated.emit();
4778
- import_log13.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
4652
+ for (const space of this._spaces.values()) {
4653
+ if (space.state !== import_services12.SpaceState.INACTIVE) {
4654
+ space.initializeDataPipelineAsync();
4655
+ }
4656
+ }
4657
+ import_log12.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
4779
4658
  id: this._instanceId
4780
4659
  }), {
4781
- F: __dxlog_file16,
4782
- L: 156,
4660
+ F: __dxlog_file15,
4661
+ L: 166,
4783
4662
  S: this,
4784
4663
  C: (f, a) => f(...a)
4785
4664
  });
4786
4665
  }
4787
4666
  async close() {
4788
- (0, import_log13.log)("close", void 0, {
4789
- F: __dxlog_file16,
4790
- L: 161,
4667
+ (0, import_log12.log)("close", void 0, {
4668
+ F: __dxlog_file15,
4669
+ L: 171,
4791
4670
  S: this,
4792
4671
  C: (f, a) => f(...a)
4793
4672
  });
@@ -4796,15 +4675,14 @@ var DataSpaceManager = class {
4796
4675
  for (const space of this._spaces.values()) {
4797
4676
  await space.close();
4798
4677
  }
4799
- this._spaces.clear();
4800
4678
  }
4801
4679
  /**
4802
4680
  * Creates a new space writing the genesis credentials to the control feed.
4803
4681
  */
4804
4682
  async createSpace() {
4805
4683
  (0, import_invariant14.invariant)(this._isOpen, "Not open.", {
4806
- F: __dxlog_file16,
4807
- L: 175,
4684
+ F: __dxlog_file15,
4685
+ L: 184,
4808
4686
  S: this,
4809
4687
  A: [
4810
4688
  "this._isOpen",
@@ -4819,25 +4697,24 @@ var DataSpaceManager = class {
4819
4697
  genesisFeedKey: controlFeedKey,
4820
4698
  controlFeedKey,
4821
4699
  dataFeedKey,
4822
- state: import_services13.SpaceState.ACTIVE
4700
+ state: import_services12.SpaceState.ACTIVE
4823
4701
  };
4824
- (0, import_log13.log)("creating space...", {
4702
+ (0, import_log12.log)("creating space...", {
4825
4703
  spaceKey
4826
4704
  }, {
4827
- F: __dxlog_file16,
4828
- L: 187,
4705
+ F: __dxlog_file15,
4706
+ L: 196,
4829
4707
  S: this,
4830
4708
  C: (f, a) => f(...a)
4831
4709
  });
4832
4710
  const root = await this._echoHost.createSpaceRoot(spaceKey);
4833
4711
  const space = await this._constructSpace(metadata);
4834
- await space.open();
4835
4712
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
4836
4713
  await this._metadataStore.addSpace(metadata);
4837
4714
  const memberCredential = credentials[1];
4838
- (0, import_invariant14.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4839
- F: __dxlog_file16,
4840
- L: 197,
4715
+ (0, import_invariant14.invariant)((0, import_credentials14.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4716
+ F: __dxlog_file15,
4717
+ L: 205,
4841
4718
  S: this,
4842
4719
  A: [
4843
4720
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4849,63 +4726,19 @@ var DataSpaceManager = class {
4849
4726
  this.updated.emit();
4850
4727
  return space;
4851
4728
  }
4852
- async isDefaultSpace(space) {
4853
- const rootDoc = await this._getSpaceRootDocument(space);
4854
- const [_, properties] = findPropertiesObject(rootDoc.docSync()) ?? [];
4855
- return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
4856
- }
4857
- async createDefaultSpace() {
4858
- const space = await this.createSpace();
4859
- const document = await this._getSpaceRootDocument(space);
4860
- const properties = {
4861
- system: {
4862
- type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
4863
- },
4864
- data: {
4865
- [DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
4866
- },
4867
- meta: {
4868
- keys: []
4869
- }
4870
- };
4871
- const propertiesId = import_keys12.PublicKey.random().toHex();
4872
- document.change((doc) => {
4873
- (0, import_util8.assignDeep)(doc, [
4874
- "objects",
4875
- propertiesId
4876
- ], properties);
4877
- });
4878
- await this._echoHost.flush();
4879
- return space;
4880
- }
4881
- async _getSpaceRootDocument(space) {
4882
- const automergeIndex = space.automergeSpaceState.rootUrl;
4883
- (0, import_invariant14.invariant)(automergeIndex, void 0, {
4884
- F: __dxlog_file16,
4885
- L: 240,
4886
- S: this,
4887
- A: [
4888
- "automergeIndex",
4889
- ""
4890
- ]
4891
- });
4892
- const document = this._echoHost.automergeRepo.find(automergeIndex);
4893
- await document.whenReady();
4894
- return document;
4895
- }
4896
4729
  // TODO(burdon): Rename join space.
4897
4730
  async acceptSpace(opts) {
4898
- (0, import_log13.log)("accept space", {
4731
+ (0, import_log12.log)("accept space", {
4899
4732
  opts
4900
4733
  }, {
4901
- F: __dxlog_file16,
4902
- L: 249,
4734
+ F: __dxlog_file15,
4735
+ L: 217,
4903
4736
  S: this,
4904
4737
  C: (f, a) => f(...a)
4905
4738
  });
4906
4739
  (0, import_invariant14.invariant)(this._isOpen, "Not open.", {
4907
- F: __dxlog_file16,
4908
- L: 250,
4740
+ F: __dxlog_file15,
4741
+ L: 218,
4909
4742
  S: this,
4910
4743
  A: [
4911
4744
  "this._isOpen",
@@ -4913,8 +4746,8 @@ var DataSpaceManager = class {
4913
4746
  ]
4914
4747
  });
4915
4748
  (0, import_invariant14.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
4916
- F: __dxlog_file16,
4917
- L: 251,
4749
+ F: __dxlog_file15,
4750
+ L: 219,
4918
4751
  S: this,
4919
4752
  A: [
4920
4753
  "!this._spaces.has(opts.spaceKey)",
@@ -4928,7 +4761,6 @@ var DataSpaceManager = class {
4928
4761
  dataTimeframe: opts.dataTimeframe
4929
4762
  };
4930
4763
  const space = await this._constructSpace(metadata);
4931
- await space.open();
4932
4764
  await this._metadataStore.addSpace(metadata);
4933
4765
  space.initializeDataPipelineAsync();
4934
4766
  this.updated.emit();
@@ -4940,17 +4772,17 @@ var DataSpaceManager = class {
4940
4772
  * TODO(dmaretskyi): Consider removing.
4941
4773
  */
4942
4774
  async waitUntilSpaceReady(spaceKey) {
4943
- await (0, import_context12.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
4775
+ await (0, import_context11.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
4944
4776
  const space = this._spaces.get(spaceKey);
4945
- return !!space && space.state === import_services13.SpaceState.READY;
4777
+ return !!space && space.state === import_services12.SpaceState.READY;
4946
4778
  }));
4947
4779
  }
4948
4780
  async _constructSpace(metadata) {
4949
- (0, import_log13.log)("construct space", {
4781
+ (0, import_log12.log)("construct space", {
4950
4782
  metadata
4951
4783
  }, {
4952
- F: __dxlog_file16,
4953
- L: 285,
4784
+ F: __dxlog_file15,
4785
+ L: 252,
4954
4786
  S: this,
4955
4787
  C: (f, a) => f(...a)
4956
4788
  });
@@ -4958,8 +4790,8 @@ var DataSpaceManager = class {
4958
4790
  localPeerId: this._signingContext.deviceKey
4959
4791
  });
4960
4792
  const presence = new import_teleport_extension_gossip2.Presence({
4961
- announceInterval: this._params?.spaceMemberPresenceAnnounceInterval ?? PRESENCE_ANNOUNCE_INTERVAL,
4962
- offlineTimeout: this._params?.spaceMemberPresenceOfflineTimeout ?? PRESENCE_OFFLINE_TIMEOUT,
4793
+ announceInterval: this._spaceMemberPresenceAnnounceInterval,
4794
+ offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
4963
4795
  identityKey: this._signingContext.identityKey,
4964
4796
  gossip
4965
4797
  });
@@ -4986,15 +4818,15 @@ var DataSpaceManager = class {
4986
4818
  session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
4987
4819
  },
4988
4820
  onAuthFailure: () => {
4989
- import_log13.log.warn("auth failure", void 0, {
4990
- F: __dxlog_file16,
4991
- L: 322,
4821
+ import_log12.log.warn("auth failure", void 0, {
4822
+ F: __dxlog_file15,
4823
+ L: 289,
4992
4824
  S: this,
4993
4825
  C: (f, a) => f(...a)
4994
4826
  });
4995
4827
  },
4996
4828
  onMemberRolesChanged: async (members) => {
4997
- if (dataSpace?.state === import_services13.SpaceState.READY) {
4829
+ if (dataSpace?.state === import_services12.SpaceState.READY) {
4998
4830
  this._handleMemberRoleChanges(presence, space.protocol, members);
4999
4831
  }
5000
4832
  },
@@ -5007,7 +4839,7 @@ var DataSpaceManager = class {
5007
4839
  dataFeed && await space.setDataFeed(dataFeed);
5008
4840
  const dataSpace = new DataSpace({
5009
4841
  inner: space,
5010
- initialState: metadata.state === import_services13.SpaceState.INACTIVE ? import_services13.SpaceState.INACTIVE : import_services13.SpaceState.CLOSED,
4842
+ initialState: metadata.state === import_services12.SpaceState.INACTIVE ? import_services12.SpaceState.INACTIVE : import_services12.SpaceState.CLOSED,
5011
4843
  metadataStore: this._metadataStore,
5012
4844
  gossip,
5013
4845
  presence,
@@ -5017,22 +4849,22 @@ var DataSpaceManager = class {
5017
4849
  signingContext: this._signingContext,
5018
4850
  callbacks: {
5019
4851
  beforeReady: async () => {
5020
- (0, import_log13.log)("before space ready", {
4852
+ (0, import_log12.log)("before space ready", {
5021
4853
  space: space.key
5022
4854
  }, {
5023
- F: __dxlog_file16,
5024
- L: 349,
4855
+ F: __dxlog_file15,
4856
+ L: 316,
5025
4857
  S: this,
5026
4858
  C: (f, a) => f(...a)
5027
4859
  });
5028
4860
  },
5029
4861
  afterReady: async () => {
5030
- (0, import_log13.log)("after space ready", {
4862
+ (0, import_log12.log)("after space ready", {
5031
4863
  space: space.key,
5032
4864
  open: this._isOpen
5033
4865
  }, {
5034
- F: __dxlog_file16,
5035
- L: 352,
4866
+ F: __dxlog_file15,
4867
+ L: 319,
5036
4868
  S: this,
5037
4869
  C: (f, a) => f(...a)
5038
4870
  });
@@ -5047,11 +4879,11 @@ var DataSpaceManager = class {
5047
4879
  }
5048
4880
  },
5049
4881
  beforeClose: async () => {
5050
- (0, import_log13.log)("before space close", {
4882
+ (0, import_log12.log)("before space close", {
5051
4883
  space: space.key
5052
4884
  }, {
5053
- F: __dxlog_file16,
5054
- L: 360,
4885
+ F: __dxlog_file15,
4886
+ L: 327,
5055
4887
  S: this,
5056
4888
  C: (f, a) => f(...a)
5057
4889
  });
@@ -5060,10 +4892,13 @@ var DataSpaceManager = class {
5060
4892
  cache: metadata.cache
5061
4893
  });
5062
4894
  presence.newPeer.on((peerState) => {
5063
- if (dataSpace.state === import_services13.SpaceState.READY) {
4895
+ if (dataSpace.state === import_services12.SpaceState.READY) {
5064
4896
  this._handleNewPeerConnected(space, peerState);
5065
4897
  }
5066
4898
  });
4899
+ if (metadata.state !== import_services12.SpaceState.INACTIVE) {
4900
+ await dataSpace.open();
4901
+ }
5067
4902
  if (metadata.controlTimeframe) {
5068
4903
  dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
5069
4904
  }
@@ -5079,20 +4914,20 @@ var DataSpaceManager = class {
5079
4914
  const peers = presence.getPeersByIdentityKey(member.key);
5080
4915
  const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
5081
4916
  const sessionsToClose = sessions.filter((s) => {
5082
- return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
4917
+ return (s && member.role === import_credentials15.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
5083
4918
  });
5084
4919
  sessionsToClose.forEach((session) => {
5085
- void session.close().catch(import_log13.log.error);
4920
+ void session.close().catch(import_log12.log.error);
5086
4921
  });
5087
4922
  closedSessions += sessionsToClose.length;
5088
4923
  }
5089
- (0, import_log13.log)("processed member role changes", {
4924
+ (0, import_log12.log)("processed member role changes", {
5090
4925
  roleChangeCount: memberInfo.length,
5091
4926
  peersOnline: presence.getPeersOnline().length,
5092
4927
  closedSessions
5093
4928
  }, {
5094
- F: __dxlog_file16,
5095
- L: 396,
4929
+ F: __dxlog_file15,
4930
+ L: 367,
5096
4931
  S: this,
5097
4932
  C: (f, a) => f(...a)
5098
4933
  });
@@ -5100,23 +4935,23 @@ var DataSpaceManager = class {
5100
4935
  }
5101
4936
  _handleNewPeerConnected(space, peerState) {
5102
4937
  const role = space.spaceState.getMemberRole(peerState.identityKey);
5103
- if (role === import_credentials16.SpaceMember.Role.REMOVED) {
4938
+ if (role === import_credentials15.SpaceMember.Role.REMOVED) {
5104
4939
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
5105
4940
  if (session != null) {
5106
- (0, import_log13.log)("closing a session with a removed peer", {
4941
+ (0, import_log12.log)("closing a session with a removed peer", {
5107
4942
  peerId: peerState.peerId
5108
4943
  }, {
5109
- F: __dxlog_file16,
5110
- L: 410,
4944
+ F: __dxlog_file15,
4945
+ L: 381,
5111
4946
  S: this,
5112
4947
  C: (f, a) => f(...a)
5113
4948
  });
5114
- void session.close().catch(import_log13.log.error);
4949
+ void session.close().catch(import_log12.log.error);
5115
4950
  }
5116
4951
  }
5117
4952
  }
5118
4953
  async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
5119
- if (dataSpace?.state !== import_services13.SpaceState.READY) {
4954
+ if (dataSpace?.state !== import_services12.SpaceState.READY) {
5120
4955
  return;
5121
4956
  }
5122
4957
  if (isActive) {
@@ -5133,8 +4968,8 @@ var DataSpaceManager = class {
5133
4968
  async _createDelegatedInvitations(space, invitations) {
5134
4969
  const tasks = invitations.map(([credentialId, invitation]) => {
5135
4970
  return this._invitationsManager.createInvitation({
5136
- type: import_services13.Invitation.Type.DELEGATED,
5137
- kind: import_services13.Invitation.Kind.SPACE,
4971
+ type: import_services12.Invitation.Type.DELEGATED,
4972
+ kind: import_services12.Invitation.Kind.SPACE,
5138
4973
  spaceKey: space.key,
5139
4974
  authMethod: invitation.authMethod,
5140
4975
  invitationId: invitation.invitationId,
@@ -5166,7 +5001,7 @@ _ts_decorate5([
5166
5001
  DataSpaceManager = _ts_decorate5([
5167
5002
  (0, import_async15.trackLeaks)("open", "close")
5168
5003
  ], DataSpaceManager);
5169
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5004
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5170
5005
  var SpacesServiceImpl = class {
5171
5006
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
5172
5007
  this._identityManager = _identityManager;
@@ -5185,10 +5020,10 @@ var SpacesServiceImpl = class {
5185
5020
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
5186
5021
  if (state) {
5187
5022
  switch (state) {
5188
- case import_services14.SpaceState.ACTIVE:
5023
+ case import_services13.SpaceState.ACTIVE:
5189
5024
  await space.activate();
5190
5025
  break;
5191
- case import_services14.SpaceState.INACTIVE:
5026
+ case import_services13.SpaceState.INACTIVE:
5192
5027
  await space.deactivate();
5193
5028
  break;
5194
5029
  default:
@@ -5208,9 +5043,9 @@ var SpacesServiceImpl = class {
5208
5043
  role: space.spaceState.getMemberRole(identity.identityKey)
5209
5044
  });
5210
5045
  }
5211
- const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
5046
+ const credentials = await (0, import_credentials18.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
5212
5047
  (0, import_invariant15.invariant)(credentials[0].credential, void 0, {
5213
- F: __dxlog_file17,
5048
+ F: __dxlog_file16,
5214
5049
  L: 97,
5215
5050
  S: this,
5216
5051
  A: [
@@ -5219,8 +5054,8 @@ var SpacesServiceImpl = class {
5219
5054
  ]
5220
5055
  });
5221
5056
  const spaceMemberCredential = credentials[0].credential.credential;
5222
- (0, import_invariant15.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5223
- F: __dxlog_file17,
5057
+ (0, import_invariant15.invariant)((0, import_credentials18.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5058
+ F: __dxlog_file16,
5224
5059
  L: 99,
5225
5060
  S: this,
5226
5061
  A: [
@@ -5235,10 +5070,10 @@ var SpacesServiceImpl = class {
5235
5070
  const scheduler = new import_async16.UpdateScheduler(ctx, async () => {
5236
5071
  const dataSpaceManager = await this._getDataSpaceManager();
5237
5072
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
5238
- (0, import_log14.log)("update", {
5073
+ (0, import_log13.log)("update", {
5239
5074
  spaces
5240
5075
  }, {
5241
- F: __dxlog_file17,
5076
+ F: __dxlog_file16,
5242
5077
  L: 110,
5243
5078
  S: this,
5244
5079
  C: (f, a) => f(...a)
@@ -5322,7 +5157,7 @@ var SpacesServiceImpl = class {
5322
5157
  });
5323
5158
  } else {
5324
5159
  (0, import_invariant15.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
5325
- F: __dxlog_file17,
5160
+ F: __dxlog_file16,
5326
5161
  L: 198,
5327
5162
  S: this,
5328
5163
  A: [
@@ -5331,7 +5166,7 @@ var SpacesServiceImpl = class {
5331
5166
  ]
5332
5167
  });
5333
5168
  (0, import_invariant15.invariant)(this._identityManager.identity, "Identity is not available", {
5334
- F: __dxlog_file17,
5169
+ F: __dxlog_file16,
5335
5170
  L: 199,
5336
5171
  S: this,
5337
5172
  A: [
@@ -5341,7 +5176,7 @@ var SpacesServiceImpl = class {
5341
5176
  });
5342
5177
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
5343
5178
  (0, import_invariant15.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
5344
- F: __dxlog_file17,
5179
+ F: __dxlog_file16,
5345
5180
  L: 201,
5346
5181
  S: this,
5347
5182
  A: [
@@ -5400,7 +5235,7 @@ var SpacesServiceImpl = class {
5400
5235
  profile: member.profile ?? {}
5401
5236
  },
5402
5237
  role: member.role,
5403
- presence: peers.length > 0 ? import_services14.SpaceMember.PresenceState.ONLINE : import_services14.SpaceMember.PresenceState.OFFLINE,
5238
+ presence: peers.length > 0 ? import_services13.SpaceMember.PresenceState.ONLINE : import_services13.SpaceMember.PresenceState.OFFLINE,
5404
5239
  peerStates: peers
5405
5240
  };
5406
5241
  }),
@@ -5438,8 +5273,8 @@ function _ts_decorate6(decorators, target, key, desc) {
5438
5273
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5439
5274
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5440
5275
  }
5441
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5442
- var ServiceContext = class extends import_context13.Resource {
5276
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5277
+ var ServiceContext = class extends import_context12.Resource {
5443
5278
  constructor(storage, level, networkManager, signalManager, _runtimeParams) {
5444
5279
  super();
5445
5280
  this.storage = storage;
@@ -5449,7 +5284,7 @@ var ServiceContext = class extends import_context13.Resource {
5449
5284
  this._runtimeParams = _runtimeParams;
5450
5285
  this.initialized = new import_async17.Trigger();
5451
5286
  this._handlerFactories = /* @__PURE__ */ new Map();
5452
- this._instanceId = import_keys13.PublicKey.random().toHex();
5287
+ this._instanceId = import_keys12.PublicKey.random().toHex();
5453
5288
  this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
5454
5289
  this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
5455
5290
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
@@ -5478,20 +5313,20 @@ var ServiceContext = class extends import_context13.Resource {
5478
5313
  });
5479
5314
  this.invitations = new InvitationsHandler(this.networkManager, _runtimeParams?.invitationConnectionDefaultParams);
5480
5315
  this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
5481
- this._handlerFactories.set(import_services15.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
5316
+ this._handlerFactories.set(import_services14.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
5482
5317
  }
5483
5318
  async _open(ctx) {
5484
5319
  await this._checkStorageVersion();
5485
- (0, import_log15.log)("opening...", void 0, {
5486
- F: __dxlog_file18,
5320
+ (0, import_log14.log)("opening...", void 0, {
5321
+ F: __dxlog_file17,
5487
5322
  L: 152,
5488
5323
  S: this,
5489
5324
  C: (f, a) => f(...a)
5490
5325
  });
5491
- import_log15.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
5326
+ import_log14.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
5492
5327
  id: this._instanceId
5493
5328
  }), {
5494
- F: __dxlog_file18,
5329
+ F: __dxlog_file17,
5495
5330
  L: 153,
5496
5331
  S: this,
5497
5332
  C: (f, a) => f(...a)
@@ -5506,32 +5341,32 @@ var ServiceContext = class extends import_context13.Resource {
5506
5341
  await this._initialize(ctx);
5507
5342
  }
5508
5343
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
5509
- (0, import_log15.log)("loaded persistent invitations", {
5344
+ (0, import_log14.log)("loaded persistent invitations", {
5510
5345
  count: loadedInvitations.invitations?.length
5511
5346
  }, {
5512
- F: __dxlog_file18,
5347
+ F: __dxlog_file17,
5513
5348
  L: 166,
5514
5349
  S: this,
5515
5350
  C: (f, a) => f(...a)
5516
5351
  });
5517
- import_log15.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
5352
+ import_log14.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
5518
5353
  id: this._instanceId
5519
5354
  }), {
5520
- F: __dxlog_file18,
5355
+ F: __dxlog_file17,
5521
5356
  L: 168,
5522
5357
  S: this,
5523
5358
  C: (f, a) => f(...a)
5524
5359
  });
5525
- (0, import_log15.log)("opened", void 0, {
5526
- F: __dxlog_file18,
5360
+ (0, import_log14.log)("opened", void 0, {
5361
+ F: __dxlog_file17,
5527
5362
  L: 169,
5528
5363
  S: this,
5529
5364
  C: (f, a) => f(...a)
5530
5365
  });
5531
5366
  }
5532
5367
  async _close(ctx) {
5533
- (0, import_log15.log)("closing...", void 0, {
5534
- F: __dxlog_file18,
5368
+ (0, import_log14.log)("closing...", void 0, {
5369
+ F: __dxlog_file17,
5535
5370
  L: 173,
5536
5371
  S: this,
5537
5372
  C: (f, a) => f(...a)
@@ -5547,8 +5382,8 @@ var ServiceContext = class extends import_context13.Resource {
5547
5382
  await this.echoHost.close(ctx);
5548
5383
  await this.networkManager.close();
5549
5384
  await this.signalManager.close();
5550
- (0, import_log15.log)("closed", void 0, {
5551
- F: __dxlog_file18,
5385
+ (0, import_log14.log)("closed", void 0, {
5386
+ F: __dxlog_file17,
5552
5387
  L: 185,
5553
5388
  S: this,
5554
5389
  C: (f, a) => f(...a)
@@ -5556,13 +5391,13 @@ var ServiceContext = class extends import_context13.Resource {
5556
5391
  }
5557
5392
  async createIdentity(params = {}) {
5558
5393
  const identity = await this.identityManager.createIdentity(params);
5559
- await this._initialize(new import_context13.Context());
5394
+ await this._initialize(new import_context12.Context());
5560
5395
  return identity;
5561
5396
  }
5562
5397
  getInvitationHandler(invitation) {
5563
5398
  const factory = this._handlerFactories.get(invitation.kind);
5564
5399
  (0, import_invariant16.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
5565
- F: __dxlog_file18,
5400
+ F: __dxlog_file17,
5566
5401
  L: 196,
5567
5402
  S: this,
5568
5403
  A: [
@@ -5582,7 +5417,7 @@ var ServiceContext = class extends import_context13.Resource {
5582
5417
  }
5583
5418
  async _acceptIdentity(params) {
5584
5419
  const identity = await this.identityManager.acceptIdentity(params);
5585
- await this._initialize(new import_context13.Context());
5420
+ await this._initialize(new import_context12.Context());
5586
5421
  return identity;
5587
5422
  }
5588
5423
  async _checkStorageVersion() {
@@ -5593,8 +5428,8 @@ var ServiceContext = class extends import_context13.Resource {
5593
5428
  }
5594
5429
  // Called when identity is created.
5595
5430
  async _initialize(ctx) {
5596
- (0, import_log15.log)("initializing spaces...", void 0, {
5597
- F: __dxlog_file18,
5431
+ (0, import_log14.log)("initializing spaces...", void 0, {
5432
+ F: __dxlog_file17,
5598
5433
  L: 227,
5599
5434
  S: this,
5600
5435
  C: (f, a) => f(...a)
@@ -5615,9 +5450,9 @@ var ServiceContext = class extends import_context13.Resource {
5615
5450
  };
5616
5451
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.echoHost, this.invitationsManager, this._runtimeParams);
5617
5452
  await this.dataSpaceManager.open();
5618
- this._handlerFactories.set(import_services15.Invitation.Kind.SPACE, (invitation) => {
5453
+ this._handlerFactories.set(import_services14.Invitation.Kind.SPACE, (invitation) => {
5619
5454
  (0, import_invariant16.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
5620
- F: __dxlog_file18,
5455
+ F: __dxlog_file17,
5621
5456
  L: 252,
5622
5457
  S: this,
5623
5458
  A: [
@@ -5630,7 +5465,7 @@ var ServiceContext = class extends import_context13.Resource {
5630
5465
  this.initialized.wake();
5631
5466
  this._deviceSpaceSync = {
5632
5467
  processCredential: async (credential) => {
5633
- const assertion = (0, import_credentials20.getCredentialAssertion)(credential);
5468
+ const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
5634
5469
  if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
5635
5470
  return;
5636
5471
  }
@@ -5638,10 +5473,10 @@ var ServiceContext = class extends import_context13.Resource {
5638
5473
  return;
5639
5474
  }
5640
5475
  if (!this.dataSpaceManager) {
5641
- (0, import_log15.log)("dataSpaceManager not initialized yet, ignoring space admission", {
5476
+ (0, import_log14.log)("dataSpaceManager not initialized yet, ignoring space admission", {
5642
5477
  details: assertion
5643
5478
  }, {
5644
- F: __dxlog_file18,
5479
+ F: __dxlog_file17,
5645
5480
  L: 268,
5646
5481
  S: this,
5647
5482
  C: (f, a) => f(...a)
@@ -5649,10 +5484,10 @@ var ServiceContext = class extends import_context13.Resource {
5649
5484
  return;
5650
5485
  }
5651
5486
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
5652
- (0, import_log15.log)("space already exists, ignoring space admission", {
5487
+ (0, import_log14.log)("space already exists, ignoring space admission", {
5653
5488
  details: assertion
5654
5489
  }, {
5655
- F: __dxlog_file18,
5490
+ F: __dxlog_file17,
5656
5491
  L: 272,
5657
5492
  S: this,
5658
5493
  C: (f, a) => f(...a)
@@ -5660,10 +5495,10 @@ var ServiceContext = class extends import_context13.Resource {
5660
5495
  return;
5661
5496
  }
5662
5497
  try {
5663
- (0, import_log15.log)("accepting space recorded in halo", {
5498
+ (0, import_log14.log)("accepting space recorded in halo", {
5664
5499
  details: assertion
5665
5500
  }, {
5666
- F: __dxlog_file18,
5501
+ F: __dxlog_file17,
5667
5502
  L: 277,
5668
5503
  S: this,
5669
5504
  C: (f, a) => f(...a)
@@ -5673,8 +5508,8 @@ var ServiceContext = class extends import_context13.Resource {
5673
5508
  genesisFeedKey: assertion.genesisFeedKey
5674
5509
  });
5675
5510
  } catch (err) {
5676
- import_log15.log.catch(err, void 0, {
5677
- F: __dxlog_file18,
5511
+ import_log14.log.catch(err, void 0, {
5512
+ F: __dxlog_file17,
5678
5513
  L: 283,
5679
5514
  S: this,
5680
5515
  C: (f, a) => f(...a)
@@ -5727,7 +5562,7 @@ function _ts_decorate7(decorators, target, key, desc) {
5727
5562
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5728
5563
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5729
5564
  }
5730
- var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
5565
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
5731
5566
  var Lock = class {
5732
5567
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
5733
5568
  this._lockPath = lockPath;
@@ -5738,16 +5573,16 @@ var Lock = class {
5738
5573
  return this._lockPath;
5739
5574
  }
5740
5575
  async acquire() {
5741
- (0, import_log16.log)("acquiring lock...", void 0, {
5742
- F: __dxlog_file19,
5576
+ (0, import_log15.log)("acquiring lock...", void 0, {
5577
+ F: __dxlog_file18,
5743
5578
  L: 32,
5744
5579
  S: this,
5745
5580
  C: (f, a) => f(...a)
5746
5581
  });
5747
5582
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
5748
5583
  await this._onAcquire?.();
5749
- (0, import_log16.log)("acquired lock", void 0, {
5750
- F: __dxlog_file19,
5584
+ (0, import_log15.log)("acquired lock", void 0, {
5585
+ F: __dxlog_file18,
5751
5586
  L: 37,
5752
5587
  S: this,
5753
5588
  C: (f, a) => f(...a)
@@ -5756,7 +5591,7 @@ var Lock = class {
5756
5591
  async release() {
5757
5592
  await this._onRelease?.();
5758
5593
  (0, import_invariant17.invariant)(this._fileHandle, "Lock is not acquired", {
5759
- F: __dxlog_file19,
5594
+ F: __dxlog_file18,
5760
5595
  L: 42,
5761
5596
  S: this,
5762
5597
  A: [
@@ -5768,11 +5603,11 @@ var Lock = class {
5768
5603
  }
5769
5604
  };
5770
5605
  _ts_decorate7([
5771
- import_log16.logInfo
5606
+ import_log15.logInfo
5772
5607
  ], Lock.prototype, "lockKey", null);
5773
5608
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
5774
5609
  var getRootPath = (config) => {
5775
- const { dataRoot = (0, import_util10.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
5610
+ const { dataRoot = (0, import_util10.isNode)() ? import_client_protocol5.DX_DATA : "dxos/storage" } = config ?? {};
5776
5611
  return `${dataRoot}/`;
5777
5612
  };
5778
5613
  var isPersistent = (config) => {
@@ -5823,12 +5658,12 @@ var toStorageType = (type) => {
5823
5658
  };
5824
5659
  var createLevel = async (config) => {
5825
5660
  const persistent = isPersistent(config);
5826
- const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys14.PublicKey.random().toHex()}`;
5661
+ const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys13.PublicKey.random().toHex()}`;
5827
5662
  const level = (0, import_kv_store.createLevel)(storagePath);
5828
5663
  await level.open();
5829
5664
  return level;
5830
5665
  };
5831
- var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
5666
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
5832
5667
  var DevicesServiceImpl = class {
5833
5668
  constructor(_identityManager) {
5834
5669
  this._identityManager = _identityManager;
@@ -5846,7 +5681,7 @@ var DevicesServiceImpl = class {
5846
5681
  });
5847
5682
  } else {
5848
5683
  (0, import_invariant19.invariant)(this._identityManager.identity?.presence, "presence not present", {
5849
- F: __dxlog_file20,
5684
+ F: __dxlog_file19,
5850
5685
  L: 32,
5851
5686
  S: this,
5852
5687
  A: [
@@ -5861,9 +5696,9 @@ var DevicesServiceImpl = class {
5861
5696
  const peerState = peers.find((peer) => peer.identityKey.equals(key));
5862
5697
  return {
5863
5698
  deviceKey: key,
5864
- kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services17.DeviceKind.CURRENT : import_services17.DeviceKind.TRUSTED,
5699
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services16.DeviceKind.CURRENT : import_services16.DeviceKind.TRUSTED,
5865
5700
  profile,
5866
- presence: isMe ? import_services17.Device.PresenceState.ONLINE : peerState ? import_services17.Device.PresenceState.ONLINE : import_services17.Device.PresenceState.OFFLINE
5701
+ presence: isMe ? import_services16.Device.PresenceState.ONLINE : peerState ? import_services16.Device.PresenceState.ONLINE : import_services16.Device.PresenceState.OFFLINE
5867
5702
  };
5868
5703
  })
5869
5704
  });
@@ -5912,7 +5747,7 @@ var DiagnosticsCollector = class {
5912
5747
  }
5913
5748
  static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
5914
5749
  const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
5915
- keys: options.humanize ? import_services18.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services18.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
5750
+ keys: options.humanize ? import_services17.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services17.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
5916
5751
  }, {
5917
5752
  timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
5918
5753
  });
@@ -5927,7 +5762,7 @@ var DiagnosticsCollector = class {
5927
5762
  client: clientDiagnostics,
5928
5763
  broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
5929
5764
  };
5930
- return JSON.parse(JSON.stringify(diagnostics, (0, import_util11.jsonKeyReplacer)(options)));
5765
+ return JSON.parse(JSON.stringify(diagnostics, (0, import_util12.jsonKeyReplacer)(options)));
5931
5766
  }
5932
5767
  };
5933
5768
  var findSystemServiceProvider = () => {
@@ -5937,35 +5772,35 @@ var findSystemServiceProvider = () => {
5937
5772
  };
5938
5773
  var findConfigs = () => {
5939
5774
  const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
5940
- return configs.map((r) => r.instance.deref()).filter(import_util11.nonNullable);
5775
+ return configs.map((r) => r.instance.deref()).filter(import_util12.nonNullable);
5941
5776
  };
5942
5777
  var LoggingServiceImpl = class {
5943
5778
  constructor() {
5944
5779
  this._logs = new import_async20.Event();
5945
5780
  this._started = Date.now();
5946
- this._sessionId = import_keys17.PublicKey.random().toHex();
5781
+ this._sessionId = import_keys16.PublicKey.random().toHex();
5947
5782
  this._logProcessor = (_config, entry2) => {
5948
5783
  this._logs.emit(entry2);
5949
5784
  };
5950
5785
  }
5951
5786
  async open() {
5952
- import_log18.log.runtimeConfig.processors.push(this._logProcessor);
5787
+ import_log17.log.runtimeConfig.processors.push(this._logProcessor);
5953
5788
  }
5954
5789
  async close() {
5955
- const index = import_log18.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
5956
- import_log18.log.runtimeConfig.processors.splice(index, 1);
5790
+ const index = import_log17.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
5791
+ import_log17.log.runtimeConfig.processors.splice(index, 1);
5957
5792
  }
5958
5793
  async controlMetrics({ reset, record }) {
5959
5794
  if (reset) {
5960
- import_util13.tracer.clear();
5795
+ import_util14.tracer.clear();
5961
5796
  }
5962
5797
  if (record === true) {
5963
- import_util13.tracer.start();
5798
+ import_util14.tracer.start();
5964
5799
  } else if (record === false) {
5965
- import_util13.tracer.stop();
5800
+ import_util14.tracer.stop();
5966
5801
  }
5967
5802
  return {
5968
- recording: import_util13.tracer.recording
5803
+ recording: import_util14.tracer.recording
5969
5804
  };
5970
5805
  }
5971
5806
  /**
@@ -5973,10 +5808,10 @@ var LoggingServiceImpl = class {
5973
5808
  */
5974
5809
  queryMetrics({ interval = 5e3 }) {
5975
5810
  const getNumericalValues = (key) => {
5976
- const events = import_util13.tracer.get(key) ?? [];
5811
+ const events = import_util14.tracer.get(key) ?? [];
5977
5812
  return {
5978
5813
  key,
5979
- stats: (0, import_util13.numericalValues)(events, "duration")
5814
+ stats: (0, import_util14.numericalValues)(events, "duration")
5980
5815
  };
5981
5816
  };
5982
5817
  return new import_codec_protobuf13.Stream(({ next }) => {
@@ -6014,7 +5849,7 @@ var LoggingServiceImpl = class {
6014
5849
  }
6015
5850
  const record = {
6016
5851
  ...entry2,
6017
- context: (0, import_util13.jsonify)((0, import_log18.getContextFromEntry)(entry2)),
5852
+ context: (0, import_util14.jsonify)((0, import_log17.getContextFromEntry)(entry2)),
6018
5853
  timestamp: /* @__PURE__ */ new Date(),
6019
5854
  meta: {
6020
5855
  // TODO(dmaretskyi): Fix proto.
@@ -6023,7 +5858,7 @@ var LoggingServiceImpl = class {
6023
5858
  scope: {
6024
5859
  hostSessionId: this._sessionId,
6025
5860
  uptimeSeconds: (Date.now() - this._started) / 1e3,
6026
- name: (0, import_util13.getDebugName)(entry2.meta?.S)
5861
+ name: (0, import_util14.getDebugName)(entry2.meta?.S)
6027
5862
  }
6028
5863
  }
6029
5864
  };
@@ -6040,16 +5875,16 @@ var LoggingServiceImpl = class {
6040
5875
  };
6041
5876
  var matchFilter = (filter, level, path2, options) => {
6042
5877
  switch (options) {
6043
- case import_services19.QueryLogsRequest.MatchingOptions.INCLUSIVE:
5878
+ case import_services18.QueryLogsRequest.MatchingOptions.INCLUSIVE:
6044
5879
  return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
6045
- case import_services19.QueryLogsRequest.MatchingOptions.EXPLICIT:
5880
+ case import_services18.QueryLogsRequest.MatchingOptions.EXPLICIT:
6046
5881
  return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
6047
5882
  }
6048
5883
  };
6049
5884
  var shouldLog = (entry2, request) => {
6050
- const options = request.options ?? import_services19.QueryLogsRequest.MatchingOptions.INCLUSIVE;
5885
+ const options = request.options ?? import_services18.QueryLogsRequest.MatchingOptions.INCLUSIVE;
6051
5886
  if (request.filters === void 0) {
6052
- return options === import_services19.QueryLogsRequest.MatchingOptions.INCLUSIVE;
5887
+ return options === import_services18.QueryLogsRequest.MatchingOptions.INCLUSIVE;
6053
5888
  } else {
6054
5889
  return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
6055
5890
  }
@@ -6104,9 +5939,9 @@ var SystemServiceImpl = class {
6104
5939
  const diagnostics = await this._getDiagnostics();
6105
5940
  return {
6106
5941
  timestamp: /* @__PURE__ */ new Date(),
6107
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util14.jsonKeyReplacer)({
6108
- truncate: keys === import_services20.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
6109
- humanize: keys === import_services20.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
5942
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util15.jsonKeyReplacer)({
5943
+ truncate: keys === import_services19.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
5944
+ humanize: keys === import_services19.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
6110
5945
  })))
6111
5946
  };
6112
5947
  }
@@ -6147,7 +5982,7 @@ function _ts_decorate8(decorators, target, key, desc) {
6147
5982
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6148
5983
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6149
5984
  }
6150
- var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
5985
+ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6151
5986
  var ClientServicesHost = class {
6152
5987
  constructor({
6153
5988
  config,
@@ -6167,7 +6002,7 @@ var ClientServicesHost = class {
6167
6002
  this._storage = storage;
6168
6003
  this._level = level;
6169
6004
  this._callbacks = callbacks;
6170
- this._runtimeParams = runtimeParams ?? {};
6005
+ this._runtimeParams = runtimeParams;
6171
6006
  if (config) {
6172
6007
  this.initialize({
6173
6008
  config,
@@ -6180,7 +6015,7 @@ var ClientServicesHost = class {
6180
6015
  lockKey,
6181
6016
  onAcquire: () => {
6182
6017
  if (!this._opening) {
6183
- void this.open(new import_context14.Context());
6018
+ void this.open(new import_context13.Context());
6184
6019
  }
6185
6020
  },
6186
6021
  onRelease: () => this.close()
@@ -6189,14 +6024,14 @@ var ClientServicesHost = class {
6189
6024
  this._systemService = new SystemServiceImpl({
6190
6025
  config: () => this._config,
6191
6026
  statusUpdate: this._statusUpdate,
6192
- getCurrentStatus: () => this.isOpen ? import_services16.SystemStatus.ACTIVE : import_services16.SystemStatus.INACTIVE,
6027
+ getCurrentStatus: () => this.isOpen ? import_services15.SystemStatus.ACTIVE : import_services15.SystemStatus.INACTIVE,
6193
6028
  getDiagnostics: () => {
6194
6029
  return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
6195
6030
  },
6196
6031
  onUpdateStatus: async (status) => {
6197
- if (!this.isOpen && status === import_services16.SystemStatus.ACTIVE) {
6032
+ if (!this.isOpen && status === import_services15.SystemStatus.ACTIVE) {
6198
6033
  await this._resourceLock?.acquire();
6199
- } else if (this.isOpen && status === import_services16.SystemStatus.INACTIVE) {
6034
+ } else if (this.isOpen && status === import_services15.SystemStatus.INACTIVE) {
6200
6035
  await this._resourceLock?.release();
6201
6036
  }
6202
6037
  },
@@ -6206,7 +6041,7 @@ var ClientServicesHost = class {
6206
6041
  });
6207
6042
  this.diagnosticsBroadcastHandler = createCollectDiagnosticsBroadcastHandler(this._systemService);
6208
6043
  this._loggingService = new LoggingServiceImpl();
6209
- this._serviceRegistry = new ServiceRegistry(import_client_protocol7.clientServiceBundle, {
6044
+ this._serviceRegistry = new ServiceRegistry(import_client_protocol6.clientServiceBundle, {
6210
6045
  SystemService: this._systemService,
6211
6046
  TracingService: this._tracingService
6212
6047
  });
@@ -6236,24 +6071,24 @@ var ClientServicesHost = class {
6236
6071
  */
6237
6072
  initialize({ config, ...options }) {
6238
6073
  (0, import_invariant18.invariant)(!this._open, "service host is open", {
6239
- F: __dxlog_file21,
6240
- L: 186,
6074
+ F: __dxlog_file20,
6075
+ L: 189,
6241
6076
  S: this,
6242
6077
  A: [
6243
6078
  "!this._open",
6244
6079
  "'service host is open'"
6245
6080
  ]
6246
6081
  });
6247
- (0, import_log17.log)("initializing...", void 0, {
6248
- F: __dxlog_file21,
6249
- L: 187,
6082
+ (0, import_log16.log)("initializing...", void 0, {
6083
+ F: __dxlog_file20,
6084
+ L: 190,
6250
6085
  S: this,
6251
6086
  C: (f, a) => f(...a)
6252
6087
  });
6253
6088
  if (config) {
6254
6089
  (0, import_invariant18.invariant)(!this._config, "config already set", {
6255
- F: __dxlog_file21,
6256
- L: 190,
6090
+ F: __dxlog_file20,
6091
+ L: 193,
6257
6092
  S: this,
6258
6093
  A: [
6259
6094
  "!this._config",
@@ -6266,9 +6101,9 @@ var ClientServicesHost = class {
6266
6101
  }
6267
6102
  }
6268
6103
  if (!options.signalManager) {
6269
- import_log17.log.warn("running signaling without telemetry metadata.", void 0, {
6270
- F: __dxlog_file21,
6271
- L: 198,
6104
+ import_log16.log.warn("running signaling without telemetry metadata.", void 0, {
6105
+ F: __dxlog_file20,
6106
+ L: 201,
6272
6107
  S: this,
6273
6108
  C: (f, a) => f(...a)
6274
6109
  });
@@ -6278,8 +6113,8 @@ var ClientServicesHost = class {
6278
6113
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
6279
6114
  this._signalManager = signalManager;
6280
6115
  (0, import_invariant18.invariant)(!this._networkManager, "network manager already set", {
6281
- F: __dxlog_file21,
6282
- L: 209,
6116
+ F: __dxlog_file20,
6117
+ L: 212,
6283
6118
  S: this,
6284
6119
  A: [
6285
6120
  "!this._networkManager",
@@ -6291,9 +6126,9 @@ var ClientServicesHost = class {
6291
6126
  transportFactory,
6292
6127
  signalManager
6293
6128
  });
6294
- (0, import_log17.log)("initialized", void 0, {
6295
- F: __dxlog_file21,
6296
- L: 216,
6129
+ (0, import_log16.log)("initialized", void 0, {
6130
+ F: __dxlog_file20,
6131
+ L: 219,
6297
6132
  S: this,
6298
6133
  C: (f, a) => f(...a)
6299
6134
  });
@@ -6302,18 +6137,18 @@ var ClientServicesHost = class {
6302
6137
  if (this._open) {
6303
6138
  return;
6304
6139
  }
6305
- const traceId = import_keys15.PublicKey.random().toHex();
6306
- import_log17.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
6140
+ const traceId = import_keys14.PublicKey.random().toHex();
6141
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
6307
6142
  id: traceId
6308
6143
  }), {
6309
- F: __dxlog_file21,
6310
- L: 227,
6144
+ F: __dxlog_file20,
6145
+ L: 230,
6311
6146
  S: this,
6312
6147
  C: (f, a) => f(...a)
6313
6148
  });
6314
6149
  (0, import_invariant18.invariant)(this._config, "config not set", {
6315
- F: __dxlog_file21,
6316
- L: 229,
6150
+ F: __dxlog_file20,
6151
+ L: 232,
6317
6152
  S: this,
6318
6153
  A: [
6319
6154
  "this._config",
@@ -6321,8 +6156,8 @@ var ClientServicesHost = class {
6321
6156
  ]
6322
6157
  });
6323
6158
  (0, import_invariant18.invariant)(this._storage, "storage not set", {
6324
- F: __dxlog_file21,
6325
- L: 230,
6159
+ F: __dxlog_file20,
6160
+ L: 233,
6326
6161
  S: this,
6327
6162
  A: [
6328
6163
  "this._storage",
@@ -6330,8 +6165,8 @@ var ClientServicesHost = class {
6330
6165
  ]
6331
6166
  });
6332
6167
  (0, import_invariant18.invariant)(this._signalManager, "signal manager not set", {
6333
- F: __dxlog_file21,
6334
- L: 231,
6168
+ F: __dxlog_file20,
6169
+ L: 234,
6335
6170
  S: this,
6336
6171
  A: [
6337
6172
  "this._signalManager",
@@ -6339,8 +6174,8 @@ var ClientServicesHost = class {
6339
6174
  ]
6340
6175
  });
6341
6176
  (0, import_invariant18.invariant)(this._networkManager, "network manager not set", {
6342
- F: __dxlog_file21,
6343
- L: 232,
6177
+ F: __dxlog_file20,
6178
+ L: 235,
6344
6179
  S: this,
6345
6180
  A: [
6346
6181
  "this._networkManager",
@@ -6348,11 +6183,11 @@ var ClientServicesHost = class {
6348
6183
  ]
6349
6184
  });
6350
6185
  this._opening = true;
6351
- (0, import_log17.log)("opening...", {
6186
+ (0, import_log16.log)("opening...", {
6352
6187
  lockKey: this._resourceLock?.lockKey
6353
6188
  }, {
6354
- F: __dxlog_file21,
6355
- L: 235,
6189
+ F: __dxlog_file20,
6190
+ L: 238,
6356
6191
  S: this,
6357
6192
  C: (f, a) => f(...a)
6358
6193
  });
@@ -6363,10 +6198,9 @@ var ClientServicesHost = class {
6363
6198
  await this._level.open();
6364
6199
  await this._loggingService.open();
6365
6200
  this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
6366
- const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
6367
6201
  this._serviceRegistry.setServices({
6368
6202
  SystemService: this._systemService,
6369
- IdentityService: identityService,
6203
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
6370
6204
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
6371
6205
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
6372
6206
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
@@ -6386,13 +6220,12 @@ var ClientServicesHost = class {
6386
6220
  })
6387
6221
  });
6388
6222
  await this._serviceContext.open(ctx);
6389
- await identityService.open();
6390
6223
  const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
6391
6224
  if (devtoolsProxy) {
6392
6225
  this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
6393
6226
  url: devtoolsProxy,
6394
6227
  requested: {},
6395
- exposed: import_client_protocol7.clientServiceBundle,
6228
+ exposed: import_client_protocol6.clientServiceBundle,
6396
6229
  handlers: this.services
6397
6230
  });
6398
6231
  void this._devtoolsProxy.open();
@@ -6402,18 +6235,18 @@ var ClientServicesHost = class {
6402
6235
  this._open = true;
6403
6236
  this._statusUpdate.emit();
6404
6237
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6405
- (0, import_log17.log)("opened", {
6238
+ (0, import_log16.log)("opened", {
6406
6239
  deviceKey
6407
6240
  }, {
6408
- F: __dxlog_file21,
6241
+ F: __dxlog_file20,
6409
6242
  L: 314,
6410
6243
  S: this,
6411
6244
  C: (f, a) => f(...a)
6412
6245
  });
6413
- import_log17.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
6246
+ import_log16.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
6414
6247
  id: traceId
6415
6248
  }), {
6416
- F: __dxlog_file21,
6249
+ F: __dxlog_file20,
6417
6250
  L: 315,
6418
6251
  S: this,
6419
6252
  C: (f, a) => f(...a)
@@ -6424,10 +6257,10 @@ var ClientServicesHost = class {
6424
6257
  return;
6425
6258
  }
6426
6259
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6427
- (0, import_log17.log)("closing...", {
6260
+ (0, import_log16.log)("closing...", {
6428
6261
  deviceKey
6429
6262
  }, {
6430
- F: __dxlog_file21,
6263
+ F: __dxlog_file20,
6431
6264
  L: 326,
6432
6265
  S: this,
6433
6266
  C: (f, a) => f(...a)
@@ -6442,43 +6275,43 @@ var ClientServicesHost = class {
6442
6275
  await this._level?.close();
6443
6276
  this._open = false;
6444
6277
  this._statusUpdate.emit();
6445
- (0, import_log17.log)("closed", {
6278
+ (0, import_log16.log)("closed", {
6446
6279
  deviceKey
6447
6280
  }, {
6448
- F: __dxlog_file21,
6281
+ F: __dxlog_file20,
6449
6282
  L: 335,
6450
6283
  S: this,
6451
6284
  C: (f, a) => f(...a)
6452
6285
  });
6453
6286
  }
6454
6287
  async reset() {
6455
- const traceId = import_keys15.PublicKey.random().toHex();
6456
- import_log17.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
6288
+ const traceId = import_keys14.PublicKey.random().toHex();
6289
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
6457
6290
  id: traceId
6458
6291
  }), {
6459
- F: __dxlog_file21,
6292
+ F: __dxlog_file20,
6460
6293
  L: 340,
6461
6294
  S: this,
6462
6295
  C: (f, a) => f(...a)
6463
6296
  });
6464
- import_log17.log.info("resetting...", void 0, {
6465
- F: __dxlog_file21,
6297
+ import_log16.log.info("resetting...", void 0, {
6298
+ F: __dxlog_file20,
6466
6299
  L: 342,
6467
6300
  S: this,
6468
6301
  C: (f, a) => f(...a)
6469
6302
  });
6470
6303
  await this._serviceContext?.close();
6471
6304
  await this._storage.reset();
6472
- import_log17.log.info("reset", void 0, {
6473
- F: __dxlog_file21,
6305
+ import_log16.log.info("reset", void 0, {
6306
+ F: __dxlog_file20,
6474
6307
  L: 345,
6475
6308
  S: this,
6476
6309
  C: (f, a) => f(...a)
6477
6310
  });
6478
- import_log17.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
6311
+ import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
6479
6312
  id: traceId
6480
6313
  }), {
6481
- F: __dxlog_file21,
6314
+ F: __dxlog_file20,
6482
6315
  L: 346,
6483
6316
  S: this,
6484
6317
  C: (f, a) => f(...a)
@@ -6488,6 +6321,38 @@ var ClientServicesHost = class {
6488
6321
  async _createIdentity(params) {
6489
6322
  const identity = await this._serviceContext.createIdentity(params);
6490
6323
  await this._serviceContext.initialized.wait();
6324
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
6325
+ const automergeIndex = space.automergeSpaceState.rootUrl;
6326
+ (0, import_invariant18.invariant)(automergeIndex, void 0, {
6327
+ F: __dxlog_file20,
6328
+ L: 358,
6329
+ S: this,
6330
+ A: [
6331
+ "automergeIndex",
6332
+ ""
6333
+ ]
6334
+ });
6335
+ const document = this._serviceContext.echoHost.automergeRepo.find(automergeIndex);
6336
+ await document.whenReady();
6337
+ const properties = {
6338
+ system: {
6339
+ type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol6.PropertiesType))
6340
+ },
6341
+ data: {
6342
+ [import_client_protocol6.defaultKey]: identity.identityKey.toHex()
6343
+ },
6344
+ meta: {
6345
+ keys: []
6346
+ }
6347
+ };
6348
+ const propertiesId = import_keys14.PublicKey.random().toHex();
6349
+ document.change((doc) => {
6350
+ (0, import_util11.assignDeep)(doc, [
6351
+ "objects",
6352
+ propertiesId
6353
+ ], properties);
6354
+ });
6355
+ await this._serviceContext.echoHost.flush();
6491
6356
  return identity;
6492
6357
  }
6493
6358
  };
@@ -6549,4 +6414,4 @@ ClientServicesHost = _ts_decorate8([
6549
6414
  subscribeToSpaces,
6550
6415
  subscribeToSwarmInfo
6551
6416
  });
6552
- //# sourceMappingURL=chunk-FYT7BPEG.cjs.map
6417
+ //# sourceMappingURL=chunk-NPYJIVOX.cjs.map