@dxos/client-services 0.14.0 → 0.16.0

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 (57) hide show
  1. package/dist/lib/chunk-client-services-stack.mjs +799 -573
  2. package/dist/lib/chunk-client-services-stack.mjs.map +1 -1
  3. package/dist/lib/index.mjs +139 -131
  4. package/dist/lib/index.mjs.map +1 -1
  5. package/dist/lib/testing.mjs +1 -1
  6. package/dist/lib/testing.mjs.map +1 -1
  7. package/dist/types/src/Events.d.ts +2 -0
  8. package/dist/types/src/Events.d.ts.map +1 -1
  9. package/dist/types/src/internal/blobs/blob-replication.d.ts +28 -0
  10. package/dist/types/src/internal/blobs/blob-replication.d.ts.map +1 -0
  11. package/dist/types/src/internal/blobs/blob-store-service.d.ts +10 -0
  12. package/dist/types/src/internal/blobs/blob-store-service.d.ts.map +1 -0
  13. package/dist/types/src/internal/blobs/blob-store-service.test.d.ts +2 -0
  14. package/dist/types/src/internal/blobs/blob-store-service.test.d.ts.map +1 -0
  15. package/dist/types/src/internal/blobs/index.d.ts +4 -0
  16. package/dist/types/src/internal/blobs/index.d.ts.map +1 -0
  17. package/dist/types/src/internal/blobs/local-blob-store.d.ts +21 -0
  18. package/dist/types/src/internal/blobs/local-blob-store.d.ts.map +1 -0
  19. package/dist/types/src/internal/blobs/local-blob-store.test.d.ts +2 -0
  20. package/dist/types/src/internal/blobs/local-blob-store.test.d.ts.map +1 -0
  21. package/dist/types/src/internal/services/layer-specs.d.ts +6 -0
  22. package/dist/types/src/internal/services/layer-specs.d.ts.map +1 -1
  23. package/dist/types/src/internal/services/service-stack.d.ts.map +1 -1
  24. package/dist/types/src/internal/space-export/serialized-space-writer.d.ts +4 -1
  25. package/dist/types/src/internal/space-export/serialized-space-writer.d.ts.map +1 -1
  26. package/dist/types/src/internal/spaces/spaces-service.d.ts.map +1 -1
  27. package/dist/types/src/internal/storage/index.d.ts +1 -0
  28. package/dist/types/src/internal/storage/index.d.ts.map +1 -1
  29. package/dist/types/src/internal/storage/storage-watchdog.d.ts +17 -0
  30. package/dist/types/src/internal/storage/storage-watchdog.d.ts.map +1 -0
  31. package/dist/types/src/internal/storage/storage-watchdog.test.d.ts +2 -0
  32. package/dist/types/src/internal/storage/storage-watchdog.test.d.ts.map +1 -0
  33. package/dist/types/src/internal/worker/worker-runtime.d.ts.map +1 -1
  34. package/dist/types/src/migrations/blobs/index.d.ts +10 -0
  35. package/dist/types/src/migrations/blobs/index.d.ts.map +1 -0
  36. package/dist/types/src/version.d.ts +1 -1
  37. package/dist/types/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +43 -42
  39. package/src/Events.ts +3 -0
  40. package/src/internal/blobs/blob-replication.ts +80 -0
  41. package/src/internal/blobs/blob-store-service.test.ts +76 -0
  42. package/src/internal/blobs/blob-store-service.ts +45 -0
  43. package/src/internal/blobs/index.ts +7 -0
  44. package/src/internal/blobs/local-blob-store.test.ts +53 -0
  45. package/src/internal/blobs/local-blob-store.ts +89 -0
  46. package/src/internal/services/layer-specs.ts +55 -0
  47. package/src/internal/services/service-stack.ts +2 -0
  48. package/src/internal/space-export/serialized-space-writer.ts +16 -9
  49. package/src/internal/spaces/spaces-service.ts +44 -6
  50. package/src/internal/storage/index.ts +1 -0
  51. package/src/internal/storage/storage-watchdog.test.ts +46 -0
  52. package/src/internal/storage/storage-watchdog.ts +58 -0
  53. package/src/internal/worker/worker-runtime.ts +2 -0
  54. package/src/migrations/blobs/0001_init.sql +17 -0
  55. package/src/migrations/blobs/index.ts +18 -0
  56. package/src/migrations/migrations.test.ts +3 -0
  57. package/src/version.ts +1 -1
@@ -17,7 +17,7 @@ import { AdmissionKeypairSchema, InvitationSchema, Invitation_AuthMethod, Invita
17
17
  import { ControlPipelineSnapshotSchema, ControlPipelineSnapshot_ControlMessageSchema, EchoMetadataSchema, EdgeReplicationSetting, IdentityRecordSchema, LargeSpaceMetadataSchema, SpaceMetadataSchema } from "@dxos/protocols/buf/dxos/echo/metadata_pb";
18
18
  import { AdmissionRequestSchema, AdmissionResponseSchema, AuthenticationRequestSchema, AuthenticationResponseSchema, AuthenticationResponse_Status, DelegateSpaceInvitationSchema, DeviceAdmissionCredentialsSchema, DeviceAdmissionRequestSchema, IntroductionRequestSchema, IntroductionResponseSchema, InvitationOptionsSchema, InvitationOptions_Role, SpaceAdmissionCredentialsSchema, SpaceAdmissionRequestSchema } from "@dxos/protocols/buf/dxos/halo/invitations_pb";
19
19
  import { ContactAdmissionSchema, ContactBookSchema, ContactSchema, CreateEpochResponseSchema, DeviceKind, DeviceSchema, Device_PresenceState, EdgeStatus_ConnectionState, IdentitySchema, JoinSpaceResponseSchema, NetworkStatusSchema, PlatformSchema, Platform_PLATFORM_TYPE, QueryAgentStatusResponseSchema, QueryAgentStatusResponse_AgentStatus, QueryEdgeStatusResponseSchema, QueryInvitationsResponseSchema, QueryInvitationsResponse_Action, QueryInvitationsResponse_Type, QuerySpacesResponseSchema, SpaceMemberSchema, SpaceMember_PresenceState, SpaceSchema, Space_MetricsSchema, Space_PipelineStateSchema, SystemStatus } from "@dxos/protocols/buf/dxos/client/services_pb";
20
- import { ContactsService, DataService, DevicesService, DevtoolsHost, EdgeAgentService, FeedService, IdentityService, InboxService, InvitationsService, LoggingService, NetworkService, QueryService, SpacesService, SqlService, SystemService } from "@dxos/protocols/rpc";
20
+ import { BlobStoreService, ContactsService, DataService, DevicesService, DevtoolsHost, EdgeAgentService, FeedService, IdentityService, InboxService, InvitationsService, LoggingService, NetworkService, QueryService, SpacesService, SqlService, SystemService } from "@dxos/protocols/rpc";
21
21
  import { CREDENTIALS_DOCUMENT_TYPE, CredentialGenerator, DeviceStateMachine, INBOX_ENVELOPE_TTL_MS, INBOX_ENVELOPE_VERSION, ProfileStateMachine, SPACE_INVITATION_NOTICE_TTL_MS, SpaceStateMachine, createAdmissionCredentials, createCancelDelegatedSpaceInvitationCredential, createCredential, createCredentialSignerWithChain, createCredentialSignerWithKey, createDelegatedSpaceInvitationCredential, createDidFromIdentityKey, createInboxEnvelope, credentialIdOf, credentialOfPayload, credentialPayload, credentialsOfType, decodeInboxEnvelope, encodeInboxEnvelope, generatePasscode, generateSeedPhrase, getCredentialAssertion, keyPairFromSeedPhrase, orderCredentials, signPresentation, specificCredential, verifyCredential, verifyInboxEnvelope, verifySpaceInvitationNotice } from "@dxos/credentials";
22
22
  import { AdmittedFeedSchema, AdmittedFeed_Designation, AuthSchema, AuthorizedDeviceSchema, ChainSchema, CredentialSchema, DeviceProfileDocumentSchema, DeviceProfileSchema, DeviceType, EpochSchema, IdentityProfileSchema, IdentityRecoveryRevokedSchema, IdentityRecoverySchema, IdentityRecovery_Kind, MemberProfileSchema, MembershipPolicy, ProfileDocumentSchema, SpaceDeletedSchema, SpaceGenesisSchema, SpaceMemberSchema as SpaceMemberSchema$1, SpaceMember_Role } from "@dxos/protocols/buf/dxos/halo/credentials_pb";
23
23
  import { Callback, CallbackCollection, ComplexMap, ComplexSet, arrayToBuffer, arraysEqual, bufferToArray, createFilename, defaultMap, deferFunction, entry, forEachAsync, isNode, isNonNullable, isTauri, jsonKeyReplacer, numericalValues, rangeFromTo, tracer } from "@dxos/util";
@@ -64,6 +64,7 @@ import { LayerStack } from "@dxos/compute-runtime";
64
64
  import { ConfigSchema, Runtime_Client_QueryExecutor } from "@dxos/protocols/buf/dxos/config_pb";
65
65
  import * as LayerSpec from "@dxos/compute/LayerSpec";
66
66
  import { DatabaseRoot, EchoEdgeSubductionReplicatorLayer, EchoHostLayer, EchoHostService, EdgeAutomergeReplicatorService, MeshEchoReplicatorLayer, MeshEchoReplicatorService, findInlineObjectOfType, runSqliteHealthCheck } from "@dxos/echo-host";
67
+ import { createBlobReplicator, withReadThrough } from "@dxos/blob/hosted";
67
68
  import { LogEntrySchema, QueryLogsRequest_MatchingOptions } from "@dxos/protocols/buf/dxos/client/logging_pb";
68
69
  import { Type } from "@dxos/echo";
69
70
  import { save } from "@automerge/automerge";
@@ -71,6 +72,7 @@ import { NotarizeRequestSchema } from "@dxos/protocols/buf/dxos/mesh/teleport/no
71
72
  import * as Exit from "effect/Exit";
72
73
  import * as Scope from "effect/Scope";
73
74
  import * as ComputeSqlService from "@dxos/compute/SqlService";
75
+ import * as Duration from "effect/Duration";
74
76
  import * as Fiber from "effect/Fiber";
75
77
  import * as Schema from "effect/Schema";
76
78
  import { SyncClient, SyncSpaceDeletedError } from "@dxos/feed";
@@ -123,6 +125,7 @@ var Events_exports = /* @__PURE__ */ __exportAll({
123
125
  Reset: () => Reset,
124
126
  StackOpened: () => StackOpened,
125
127
  StorageReady: () => StorageReady,
128
+ StorageStuck: () => StorageStuck,
126
129
  WipingStorage: () => WipingStorage
127
130
  });
128
131
  /** The host is opening; nothing has been touched yet. */
@@ -152,10 +155,12 @@ var Closing = Hook.make()("client-services/Closing");
152
155
  var WipingStorage = Hook.make()("client-services/WipingStorage");
153
156
  /** Storage is wiped; the embedder typically reloads. */
154
157
  var Reset = Hook.make()("client-services/Reset");
158
+ /** Storage stopped answering, so nothing more will be saved; the embedder replaces the process. */
159
+ var StorageStuck = Hook.make()("client-services/StorageStuck");
155
160
  /** The local profile changed and should be broadcast to every open space. */
156
161
  var ProfileUpdated = Hook.make()("client-services/ProfileUpdated");
157
162
  //#endregion
158
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/decorate.js
163
+ //#region \0@oxc-project+runtime@0.154.0/helpers/esm/decorate.js
159
164
  function __decorate(decorators, target, key, desc) {
160
165
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
161
166
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -164,7 +169,7 @@ function __decorate(decorators, target, key, desc) {
164
169
  }
165
170
  //#endregion
166
171
  //#region src/internal/agents/edge-agent-manager.ts
167
- var __dxlog_file$56 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/agents/edge-agent-manager.ts";
172
+ var __dxlog_file$58 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/agents/edge-agent-manager.ts";
168
173
  var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
169
174
  var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
170
175
  var AGENT_FEED_ADDED_CHECK_INTERVAL_MS = 3e3;
@@ -201,21 +206,21 @@ var EdgeAgentManager = class extends Resource {
201
206
  async createAgent(ctx) {
202
207
  invariant(this.isOpen, void 0, {
203
208
  "~LogMeta": "~LogMeta",
204
- F: __dxlog_file$56,
209
+ F: __dxlog_file$58,
205
210
  L: 79,
206
211
  S: this,
207
212
  A: ["this.isOpen", ""]
208
213
  });
209
214
  invariant(this._edgeHttpClient, void 0, {
210
215
  "~LogMeta": "~LogMeta",
211
- F: __dxlog_file$56,
216
+ F: __dxlog_file$58,
212
217
  L: 80,
213
218
  S: this,
214
219
  A: ["this._edgeHttpClient", ""]
215
220
  });
216
221
  invariant(this._edgeFeatures?.agents, void 0, {
217
222
  "~LogMeta": "~LogMeta",
218
- F: __dxlog_file$56,
223
+ F: __dxlog_file$58,
219
224
  L: 81,
220
225
  S: this,
221
226
  A: ["this._edgeFeatures?.agents", ""]
@@ -229,7 +234,7 @@ var EdgeAgentManager = class extends Resource {
229
234
  if (await this.identity.authorizedDeviceKeys.has(deviceKey)) {
230
235
  log.info("agent was already added to HALO, ignoring response", { response }, {
231
236
  "~LogMeta": "~LogMeta",
232
- F: __dxlog_file$56,
237
+ F: __dxlog_file$58,
233
238
  L: 92,
234
239
  S: this
235
240
  });
@@ -243,7 +248,7 @@ var EdgeAgentManager = class extends Resource {
243
248
  }));
244
249
  log("agent created", response, {
245
250
  "~LogMeta": "~LogMeta",
246
- F: __dxlog_file$56,
251
+ F: __dxlog_file$58,
247
252
  L: 106,
248
253
  S: this
249
254
  });
@@ -253,7 +258,7 @@ var EdgeAgentManager = class extends Resource {
253
258
  const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
254
259
  log("edge agent manager open", { isEnabled }, {
255
260
  "~LogMeta": "~LogMeta",
256
- F: __dxlog_file$56,
261
+ F: __dxlog_file$58,
257
262
  L: 114,
258
263
  S: this
259
264
  });
@@ -282,7 +287,7 @@ var EdgeAgentManager = class extends Resource {
282
287
  async _fetchAgentStatus(ctx) {
283
288
  invariant(this._edgeHttpClient, void 0, {
284
289
  "~LogMeta": "~LogMeta",
285
- F: __dxlog_file$56,
290
+ F: __dxlog_file$58,
286
291
  L: 150,
287
292
  S: this,
288
293
  A: ["this._edgeHttpClient", ""]
@@ -290,7 +295,7 @@ var EdgeAgentManager = class extends Resource {
290
295
  try {
291
296
  log("fetching agent status", void 0, {
292
297
  "~LogMeta": "~LogMeta",
293
- F: __dxlog_file$56,
298
+ F: __dxlog_file$58,
294
299
  L: 152,
295
300
  S: this
296
301
  });
@@ -304,7 +309,7 @@ var EdgeAgentManager = class extends Resource {
304
309
  if (!err.isRetryable) {
305
310
  log.warn("non retryable error on agent status fetch attempt", { err }, {
306
311
  "~LogMeta": "~LogMeta",
307
- F: __dxlog_file$56,
312
+ F: __dxlog_file$58,
308
313
  L: 164,
309
314
  S: this
310
315
  });
@@ -317,7 +322,7 @@ var EdgeAgentManager = class extends Resource {
317
322
  retryAfterMs
318
323
  }, {
319
324
  "~LogMeta": "~LogMeta",
320
- F: __dxlog_file$56,
325
+ F: __dxlog_file$58,
321
326
  L: 169,
322
327
  S: this
323
328
  });
@@ -348,7 +353,7 @@ var EdgeAgentManager = class extends Resource {
348
353
  spaceId: space.id
349
354
  }, {
350
355
  "~LogMeta": "~LogMeta",
351
- F: __dxlog_file$56,
356
+ F: __dxlog_file$58,
352
357
  L: 196,
353
358
  S: this
354
359
  });
@@ -362,7 +367,7 @@ var EdgeAgentManager = class extends Resource {
362
367
  if (deviceKey) this._ensureAgentIsInSpaces(deviceKey);
363
368
  log.verbose("agent status update", { status }, {
364
369
  "~LogMeta": "~LogMeta",
365
- F: __dxlog_file$56,
370
+ F: __dxlog_file$58,
366
371
  L: 212,
367
372
  S: this
368
373
  });
@@ -401,7 +406,7 @@ var StackReadinessLayer = Layer.effect(StackReadinessService, Effect.gen(functio
401
406
  }));
402
407
  //#endregion
403
408
  //#region src/internal/agents/edge-agent-service.ts
404
- var __dxlog_file$55 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/agents/edge-agent-service.ts";
409
+ var __dxlog_file$57 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/agents/edge-agent-service.ts";
405
410
  var EdgeAgentServiceImpl = class {
406
411
  _agentManagerProvider;
407
412
  _edgeConnection;
@@ -413,7 +418,7 @@ var EdgeAgentServiceImpl = class {
413
418
  return EffectEx.streamFromEmitter((emit) => {
414
419
  const ctx = Context.default(void 0, {
415
420
  "~LogMeta": "~LogMeta",
416
- F: __dxlog_file$55,
421
+ F: __dxlog_file$57,
417
422
  L: 38
418
423
  });
419
424
  const update = () => {
@@ -428,7 +433,7 @@ var EdgeAgentServiceImpl = class {
428
433
  return Effect.tryPromise({
429
434
  try: async () => (await this._agentManagerProvider()).createAgent(Context.default(void 0, {
430
435
  "~LogMeta": "~LogMeta",
431
- F: __dxlog_file$55,
436
+ F: __dxlog_file$57,
432
437
  L: 52
433
438
  })),
434
439
  catch: toServiceError
@@ -438,7 +443,7 @@ var EdgeAgentServiceImpl = class {
438
443
  return EffectEx.streamFromEmitter((emit) => {
439
444
  const ctx = Context.default(void 0, {
440
445
  "~LogMeta": "~LogMeta",
441
- F: __dxlog_file$55,
446
+ F: __dxlog_file$57,
442
447
  L: 59
443
448
  });
444
449
  emit.single(buf.create(QueryAgentStatusResponseSchema, { status: QueryAgentStatusResponse_AgentStatus.UNKNOWN }));
@@ -477,7 +482,7 @@ var Auth_exports = /* @__PURE__ */ __exportAll({
477
482
  TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
478
483
  createAuthProvider: () => createAuthProvider
479
484
  });
480
- var __dxlog_file$54 = "/__w/dxos/dxos/packages/sdk/client-services/src/Auth.ts";
485
+ var __dxlog_file$56 = "/__w/dxos/dxos/packages/sdk/client-services/src/Auth.ts";
481
486
  var createAuthProvider = (signer) => async (nonce) => {
482
487
  const credential = await signer.createCredential({
483
488
  assertion: create(AuthSchema, {}),
@@ -494,7 +499,7 @@ var TrustedKeySetAuthVerifier = class {
494
499
  _params;
495
500
  _ctx = new Context(void 0, {
496
501
  "~LogMeta": "~LogMeta",
497
- F: __dxlog_file$54,
502
+ F: __dxlog_file$56,
498
503
  L: 51
499
504
  });
500
505
  constructor(_params) {
@@ -508,7 +513,7 @@ var TrustedKeySetAuthVerifier = class {
508
513
  const credential = fromBinary(CredentialSchema, auth);
509
514
  log("authenticating...", { credential }, {
510
515
  "~LogMeta": "~LogMeta",
511
- F: __dxlog_file$54,
516
+ F: __dxlog_file$56,
512
517
  L: 62,
513
518
  S: this
514
519
  });
@@ -516,7 +521,7 @@ var TrustedKeySetAuthVerifier = class {
516
521
  if (result.kind === "fail") {
517
522
  log("Invalid credential", { result }, {
518
523
  "~LogMeta": "~LogMeta",
519
- F: __dxlog_file$54,
524
+ F: __dxlog_file$56,
520
525
  L: 66,
521
526
  S: this
522
527
  });
@@ -529,7 +534,7 @@ var TrustedKeySetAuthVerifier = class {
529
534
  credential
530
535
  }, {
531
536
  "~LogMeta": "~LogMeta",
532
- F: __dxlog_file$54,
537
+ F: __dxlog_file$56,
533
538
  L: 74,
534
539
  S: this
535
540
  });
@@ -539,7 +544,7 @@ var TrustedKeySetAuthVerifier = class {
539
544
  if (this._isTrustedKey(issuer)) {
540
545
  log("key is trusted -- auth success", { key: issuer }, {
541
546
  "~LogMeta": "~LogMeta",
542
- F: __dxlog_file$54,
547
+ F: __dxlog_file$56,
543
548
  L: 80,
544
549
  S: this
545
550
  });
@@ -553,7 +558,7 @@ var TrustedKeySetAuthVerifier = class {
553
558
  if (this._isTrustedKey(issuer)) {
554
559
  log("auth success", { key: issuer }, {
555
560
  "~LogMeta": "~LogMeta",
556
- F: __dxlog_file$54,
561
+ F: __dxlog_file$56,
557
562
  L: 91,
558
563
  S: this
559
564
  });
@@ -563,7 +568,7 @@ var TrustedKeySetAuthVerifier = class {
563
568
  trusted: [...this._params.trustedKeysProvider()]
564
569
  }, {
565
570
  "~LogMeta": "~LogMeta",
566
- F: __dxlog_file$54,
571
+ F: __dxlog_file$56,
567
572
  L: 94,
568
573
  S: this
569
574
  });
@@ -587,7 +592,7 @@ var CredentialsDocument_exports = /* @__PURE__ */ __exportAll({
587
592
  CredentialsDocumentStore: () => CredentialsDocumentStore,
588
593
  openCredentialsDocument: () => openCredentialsDocument
589
594
  });
590
- var __dxlog_file$53 = "/__w/dxos/dxos/packages/sdk/client-services/src/CredentialsDocument.ts";
595
+ var __dxlog_file$55 = "/__w/dxos/dxos/packages/sdk/client-services/src/CredentialsDocument.ts";
591
596
  var CREDENTIALS_PATH = ["credentials"];
592
597
  /**
593
598
  * Read/write access to a space's credentials document, the successor to its control feed.
@@ -636,7 +641,7 @@ var CredentialsDocumentStore = class {
636
641
  const id = toPublicKey(credential.id)?.toHex();
637
642
  invariant(id, "Credential has no id.", {
638
643
  "~LogMeta": "~LogMeta",
639
- F: __dxlog_file$53,
644
+ F: __dxlog_file$55,
640
645
  L: 79,
641
646
  S: this,
642
647
  A: ["id", "'Credential has no id.'"]
@@ -656,7 +661,7 @@ var openCredentialsDocument = async (ctx, echoHost, spaceId) => {
656
661
  const lease = await echoHost.loadDoc(ctx, url);
657
662
  invariant(lease, "Credentials document must load.", {
658
663
  "~LogMeta": "~LogMeta",
659
- F: __dxlog_file$53,
664
+ F: __dxlog_file$55,
660
665
  L: 102,
661
666
  S: void 0,
662
667
  A: ["lease", "'Credentials document must load.'"]
@@ -684,7 +689,7 @@ var openCredentialsDocument = async (ctx, echoHost, spaceId) => {
684
689
  };
685
690
  //#endregion
686
691
  //#region src/internal/metadata/metadata-store.ts
687
- var __dxlog_file$52 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/metadata/metadata-store.ts";
692
+ var __dxlog_file$54 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/metadata/metadata-store.ts";
688
693
  var EXPIRED_INVITATION_CLEANUP_INTERVAL$1 = 36e5;
689
694
  /**
690
695
  * Effect service tag for {@link IMetadataStore}.
@@ -704,7 +709,7 @@ var MetadataStore = class {
704
709
  update = new Event();
705
710
  _invitationCleanupCtx = new Context(void 0, {
706
711
  "~LogMeta": "~LogMeta",
707
- F: __dxlog_file$52,
712
+ F: __dxlog_file$54,
708
713
  L: 101
709
714
  });
710
715
  /**
@@ -745,7 +750,7 @@ var MetadataStore = class {
745
750
  name: file.filename
746
751
  }, {
747
752
  "~LogMeta": "~LogMeta",
748
- F: __dxlog_file$52,
753
+ F: __dxlog_file$54,
749
754
  L: 144,
750
755
  S: this
751
756
  });
@@ -779,7 +784,7 @@ var MetadataStore = class {
779
784
  checksum
780
785
  }, {
781
786
  "~LogMeta": "~LogMeta",
782
- F: __dxlog_file$52,
787
+ F: __dxlog_file$54,
783
788
  L: 182,
784
789
  S: this
785
790
  });
@@ -806,7 +811,7 @@ var MetadataStore = class {
806
811
  } catch (err) {
807
812
  log.error("failed to load metadata", { err }, {
808
813
  "~LogMeta": "~LogMeta",
809
- F: __dxlog_file$52,
814
+ F: __dxlog_file$54,
810
815
  L: 217,
811
816
  S: this
812
817
  });
@@ -818,7 +823,7 @@ var MetadataStore = class {
818
823
  } catch (err) {
819
824
  log.error("failed to load space large metadata", { err }, {
820
825
  "~LogMeta": "~LogMeta",
821
- F: __dxlog_file$52,
826
+ F: __dxlog_file$54,
822
827
  L: 229,
823
828
  S: this
824
829
  });
@@ -847,7 +852,7 @@ var MetadataStore = class {
847
852
  } catch (err) {
848
853
  log.error("failed to load space large metadata", { err }, {
849
854
  "~LogMeta": "~LogMeta",
850
- F: __dxlog_file$52,
855
+ F: __dxlog_file$54,
851
856
  L: 271,
852
857
  S: this
853
858
  });
@@ -867,7 +872,7 @@ var MetadataStore = class {
867
872
  const space = this.spaces.find((space) => space.key && requirePublicKey(space.key).equals(spaceKey));
868
873
  invariant(space, "Space not found", {
869
874
  "~LogMeta": "~LogMeta",
870
- F: __dxlog_file$52,
875
+ F: __dxlog_file$54,
871
876
  L: 294,
872
877
  S: this,
873
878
  A: ["space", "'Space not found'"]
@@ -892,7 +897,7 @@ var MetadataStore = class {
892
897
  async clear() {
893
898
  log("clearing all metadata", void 0, {
894
899
  "~LogMeta": "~LogMeta",
895
- F: __dxlog_file$52,
900
+ F: __dxlog_file$54,
896
901
  L: 323,
897
902
  S: this
898
903
  });
@@ -905,7 +910,7 @@ var MetadataStore = class {
905
910
  async setIdentityRecord(record) {
906
911
  invariant(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
907
912
  "~LogMeta": "~LogMeta",
908
- F: __dxlog_file$52,
913
+ F: __dxlog_file$54,
909
914
  L: 333,
910
915
  S: this,
911
916
  A: ["!this._metadata.identity", "'Cannot overwrite existing identity in metadata'"]
@@ -940,14 +945,14 @@ var MetadataStore = class {
940
945
  async addSpace(record) {
941
946
  invariant(record.key, "Space metadata has no key.", {
942
947
  "~LogMeta": "~LogMeta",
943
- F: __dxlog_file$52,
948
+ F: __dxlog_file$54,
944
949
  L: 374,
945
950
  S: this,
946
951
  A: ["record.key", "'Space metadata has no key.'"]
947
952
  });
948
953
  invariant(!this.hasSpace(requirePublicKey(record.key)), "Cannot overwrite existing space in metadata", {
949
954
  "~LogMeta": "~LogMeta",
950
- F: __dxlog_file$52,
955
+ F: __dxlog_file$54,
951
956
  L: 375,
952
957
  S: this,
953
958
  A: ["!this.hasSpace(requirePublicKey(record.key))", "'Cannot overwrite existing space in metadata'"]
@@ -1010,12 +1015,12 @@ var isLegacyInvitationFormat$1 = (invitation) => {
1010
1015
  * Space metadata migrations, keyed `<id>_<name>` as `Migrator.fromRecord` expects. Ids must only ever increase,
1011
1016
  * and an applied migration must never be edited — nothing verifies its contents.
1012
1017
  */
1013
- var MIGRATIONS$1 = { "0001_init": SqlMigrations.apply("--\n-- Space metadata (small keyed blobs plus a per-space large record). Equivalent to the DDL this store created inline before migrations existed, so a database\n-- from an earlier release applies it as a no-op — `IF NOT EXISTS` is what makes that true.\n--\n-- Immutable: recorded in `metadata_migrations` and never re-run.\n--\nCREATE TABLE IF NOT EXISTS space_metadata (\n key TEXT PRIMARY KEY,\n value BLOB NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS space_large (\n space_key TEXT PRIMARY KEY,\n value BLOB NOT NULL\n);\n") };
1018
+ var MIGRATIONS$2 = { "0001_init": SqlMigrations.apply("--\n-- Space metadata (small keyed blobs plus a per-space large record). Equivalent to the DDL this store created inline before migrations existed, so a database\n-- from an earlier release applies it as a no-op — `IF NOT EXISTS` is what makes that true.\n--\n-- Immutable: recorded in `metadata_migrations` and never re-run.\n--\nCREATE TABLE IF NOT EXISTS space_metadata (\n key TEXT PRIMARY KEY,\n value BLOB NOT NULL\n);\n\nCREATE TABLE IF NOT EXISTS space_large (\n space_key TEXT PRIMARY KEY,\n value BLOB NOT NULL\n);\n") };
1014
1019
  /** Own history table per store, since many stores share the client database. */
1015
- var MIGRATIONS_TABLE$1 = "metadata_migrations";
1020
+ var MIGRATIONS_TABLE$2 = "metadata_migrations";
1016
1021
  //#endregion
1017
1022
  //#region src/internal/metadata/sqlite-metadata-store.ts
1018
- var __dxlog_file$51 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/metadata/sqlite-metadata-store.ts";
1023
+ var __dxlog_file$53 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/metadata/sqlite-metadata-store.ts";
1019
1024
  var EXPIRED_INVITATION_CLEANUP_INTERVAL = 36e5;
1020
1025
  var emptyEchoMetadata = () => create(EchoMetadataSchema, {
1021
1026
  version: STORAGE_VERSION,
@@ -1047,7 +1052,7 @@ var SqliteMetadataStore = class {
1047
1052
  update = new Event();
1048
1053
  #invitationCleanupCtx = new Context(void 0, {
1049
1054
  "~LogMeta": "~LogMeta",
1050
- F: __dxlog_file$51,
1055
+ F: __dxlog_file$53,
1051
1056
  L: 82
1052
1057
  });
1053
1058
  constructor({ runtime }) {
@@ -1057,8 +1062,8 @@ var SqliteMetadataStore = class {
1057
1062
  * Applies any migrations this database has not recorded yet.
1058
1063
  */
1059
1064
  migrate = Migrator.make({})({
1060
- loader: Migrator.fromRecord(MIGRATIONS$1),
1061
- table: MIGRATIONS_TABLE$1
1065
+ loader: Migrator.fromRecord(MIGRATIONS$2),
1066
+ table: MIGRATIONS_TABLE$2
1062
1067
  }).pipe(Effect.catchTag("MigrationError", (error) => Effect.die(error)), Effect.asVoid, Effect.withSpan("SqliteMetadataStore.migrate"));
1063
1068
  get metadata() {
1064
1069
  return this.#metadata;
@@ -1093,7 +1098,7 @@ var SqliteMetadataStore = class {
1093
1098
  } catch (err) {
1094
1099
  log.error("failed to load metadata from SQLite", { err }, {
1095
1100
  "~LogMeta": "~LogMeta",
1096
- F: __dxlog_file$51,
1101
+ F: __dxlog_file$53,
1097
1102
  L: 148,
1098
1103
  S: this
1099
1104
  });
@@ -1106,7 +1111,7 @@ var SqliteMetadataStore = class {
1106
1111
  } catch (err) {
1107
1112
  log.error("failed to load large space metadata", { err }, {
1108
1113
  "~LogMeta": "~LogMeta",
1109
- F: __dxlog_file$51,
1114
+ F: __dxlog_file$53,
1110
1115
  L: 162,
1111
1116
  S: this
1112
1117
  });
@@ -1129,7 +1134,7 @@ var SqliteMetadataStore = class {
1129
1134
  async setIdentityRecord(record) {
1130
1135
  invariant(!this.#metadata.identity, "Cannot overwrite existing identity in metadata", {
1131
1136
  "~LogMeta": "~LogMeta",
1132
- F: __dxlog_file$51,
1137
+ F: __dxlog_file$53,
1133
1138
  L: 200,
1134
1139
  S: this,
1135
1140
  A: ["!this.#metadata.identity", "'Cannot overwrite existing identity in metadata'"]
@@ -1152,14 +1157,14 @@ var SqliteMetadataStore = class {
1152
1157
  async addSpace(record) {
1153
1158
  invariant(record.key, "Space metadata has no key.", {
1154
1159
  "~LogMeta": "~LogMeta",
1155
- F: __dxlog_file$51,
1160
+ F: __dxlog_file$53,
1156
1161
  L: 223,
1157
1162
  S: this,
1158
1163
  A: ["record.key", "'Space metadata has no key.'"]
1159
1164
  });
1160
1165
  invariant(!this.hasSpace(requirePublicKey(record.key)), "Cannot overwrite existing space in metadata", {
1161
1166
  "~LogMeta": "~LogMeta",
1162
- F: __dxlog_file$51,
1167
+ F: __dxlog_file$53,
1163
1168
  L: 224,
1164
1169
  S: this,
1165
1170
  A: ["!this.hasSpace(requirePublicKey(record.key))", "'Cannot overwrite existing space in metadata'"]
@@ -1210,7 +1215,7 @@ var SqliteMetadataStore = class {
1210
1215
  async clear() {
1211
1216
  log("clearing all metadata", void 0, {
1212
1217
  "~LogMeta": "~LogMeta",
1213
- F: __dxlog_file$51,
1218
+ F: __dxlog_file$53,
1214
1219
  L: 282,
1215
1220
  S: this
1216
1221
  });
@@ -1229,7 +1234,7 @@ var SqliteMetadataStore = class {
1229
1234
  const space = this.spaces.find((space) => space.key && requirePublicKey(space.key).equals(spaceKey));
1230
1235
  invariant(space, "Space not found", {
1231
1236
  "~LogMeta": "~LogMeta",
1232
- F: __dxlog_file$51,
1237
+ F: __dxlog_file$53,
1233
1238
  L: 301,
1234
1239
  S: this,
1235
1240
  A: ["space", "'Space not found'"]
@@ -1271,7 +1276,7 @@ var SqliteMetadataStore = class {
1271
1276
  } catch (err) {
1272
1277
  log.error("failed to decode large space metadata", { err }, {
1273
1278
  "~LogMeta": "~LogMeta",
1274
- F: __dxlog_file$51,
1279
+ F: __dxlog_file$53,
1275
1280
  L: 352,
1276
1281
  S: this
1277
1282
  });
@@ -1333,19 +1338,19 @@ var SqliteMetadataStoreLayer = () => Layer.effect(IMetadataStoreService, Effect.
1333
1338
  }));
1334
1339
  //#endregion
1335
1340
  //#region src/internal/space/auth.ts
1336
- var __dxlog_file$50 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/auth.ts";
1341
+ var __dxlog_file$52 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/auth.ts";
1337
1342
  var AuthExtension = class extends RpcExtension {
1338
1343
  _authProps;
1339
1344
  _ctx = new Context({ onError: (err) => {
1340
1345
  log.catch(err, void 0, {
1341
1346
  "~LogMeta": "~LogMeta",
1342
- F: __dxlog_file$50,
1347
+ F: __dxlog_file$52,
1343
1348
  L: 34,
1344
1349
  S: this
1345
1350
  });
1346
1351
  } }, {
1347
1352
  "~LogMeta": "~LogMeta",
1348
- F: __dxlog_file$50,
1353
+ F: __dxlog_file$52,
1349
1354
  L: 32
1350
1355
  });
1351
1356
  constructor(_authProps) {
@@ -1365,7 +1370,7 @@ var AuthExtension = class extends RpcExtension {
1365
1370
  } catch (err) {
1366
1371
  log.error("failed to generate auth credentials", err, {
1367
1372
  "~LogMeta": "~LogMeta",
1368
- F: __dxlog_file$50,
1373
+ F: __dxlog_file$52,
1369
1374
  L: 61,
1370
1375
  S: this
1371
1376
  });
@@ -1381,7 +1386,7 @@ var AuthExtension = class extends RpcExtension {
1381
1386
  const { credential } = await this.rpc.AuthService.authenticate(create(AuthenticateRequestSchema, { challenge }));
1382
1387
  invariant(credential.length > 0, "invalid credential", {
1383
1388
  "~LogMeta": "~LogMeta",
1384
- F: __dxlog_file$50,
1389
+ F: __dxlog_file$52,
1385
1390
  L: 77,
1386
1391
  S: this,
1387
1392
  A: ["credential.length > 0", "'invalid credential'"]
@@ -1389,7 +1394,7 @@ var AuthExtension = class extends RpcExtension {
1389
1394
  const success = await this._authProps.verifier(challenge, credential);
1390
1395
  invariant(success, "credential not verified", {
1391
1396
  "~LogMeta": "~LogMeta",
1392
- F: __dxlog_file$50,
1397
+ F: __dxlog_file$52,
1393
1398
  L: 79,
1394
1399
  S: this,
1395
1400
  A: ["success", "'credential not verified'"]
@@ -1398,7 +1403,7 @@ var AuthExtension = class extends RpcExtension {
1398
1403
  } catch (err) {
1399
1404
  log("auth failed", err, {
1400
1405
  "~LogMeta": "~LogMeta",
1401
- F: __dxlog_file$50,
1406
+ F: __dxlog_file$52,
1402
1407
  L: 82,
1403
1408
  S: this
1404
1409
  });
@@ -1418,21 +1423,21 @@ var AuthExtension = class extends RpcExtension {
1418
1423
  };
1419
1424
  //#endregion
1420
1425
  //#region src/internal/pipeline/feeds.ts
1421
- var __dxlog_file$49 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/feeds.ts";
1426
+ var __dxlog_file$51 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/feeds.ts";
1422
1427
  /**
1423
1428
  * Maps the written arguments onto a different message type.
1424
1429
  */
1425
1430
  var createMappedFeedWriter = (mapper, writer) => {
1426
1431
  invariant(mapper, void 0, {
1427
1432
  "~LogMeta": "~LogMeta",
1428
- F: __dxlog_file$49,
1433
+ F: __dxlog_file$51,
1429
1434
  L: 16,
1430
1435
  S: void 0,
1431
1436
  A: ["mapper", ""]
1432
1437
  });
1433
1438
  invariant(writer, void 0, {
1434
1439
  "~LogMeta": "~LogMeta",
1435
- F: __dxlog_file$49,
1440
+ F: __dxlog_file$51,
1436
1441
  L: 17,
1437
1442
  S: void 0,
1438
1443
  A: ["writer", ""]
@@ -1441,7 +1446,7 @@ var createMappedFeedWriter = (mapper, writer) => {
1441
1446
  };
1442
1447
  //#endregion
1443
1448
  //#region src/internal/pipeline/message-selector.ts
1444
- var __dxlog_file$48 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/message-selector.ts";
1449
+ var __dxlog_file$50 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/message-selector.ts";
1445
1450
  /**
1446
1451
  * The MessageSelector makes sure that we read in a trusted order.
1447
1452
  * The first message we wish to process is the SpaceGenesis, which will admit a Feed.
@@ -1454,7 +1459,7 @@ var createMessageSelector = (timeframeClock) => {
1454
1459
  const { data: { timeframe } } = messages[i];
1455
1460
  invariant(timeframe, void 0, {
1456
1461
  "~LogMeta": "~LogMeta",
1457
- F: __dxlog_file$48,
1462
+ F: __dxlog_file$50,
1458
1463
  L: 26,
1459
1464
  S: void 0,
1460
1465
  A: ["timeframe", ""]
@@ -1463,7 +1468,7 @@ var createMessageSelector = (timeframeClock) => {
1463
1468
  }
1464
1469
  log("Skipping...", void 0, {
1465
1470
  "~LogMeta": "~LogMeta",
1466
- F: __dxlog_file$48,
1471
+ F: __dxlog_file$50,
1467
1472
  L: 34,
1468
1473
  S: void 0
1469
1474
  });
@@ -1471,7 +1476,7 @@ var createMessageSelector = (timeframeClock) => {
1471
1476
  };
1472
1477
  //#endregion
1473
1478
  //#region src/internal/pipeline/timeframe-clock.ts
1474
- var __dxlog_file$47 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/timeframe-clock.ts";
1479
+ var __dxlog_file$49 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/timeframe-clock.ts";
1475
1480
  var mapFeedIndexesToTimeframe = (indexes) => new Timeframe(indexes.map(({ feedKey, index }) => [feedKey, index]));
1476
1481
  var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
1477
1482
  feedKey,
@@ -1522,7 +1527,7 @@ var TimeframeClock = class {
1522
1527
  current: this._timeframe
1523
1528
  }, {
1524
1529
  "~LogMeta": "~LogMeta",
1525
- F: __dxlog_file$47,
1530
+ F: __dxlog_file$49,
1526
1531
  L: 70,
1527
1532
  S: this
1528
1533
  });
@@ -1533,7 +1538,7 @@ var TimeframeClock = class {
1533
1538
  deps: Timeframe.dependencies(target, this._timeframe)
1534
1539
  }, {
1535
1540
  "~LogMeta": "~LogMeta",
1536
- F: __dxlog_file$47,
1541
+ F: __dxlog_file$49,
1537
1542
  L: 72,
1538
1543
  S: this
1539
1544
  });
@@ -1544,7 +1549,7 @@ var TimeframeClock = class {
1544
1549
  __decorate([timed(5e3)], TimeframeClock.prototype, "waitUntilReached", null);
1545
1550
  //#endregion
1546
1551
  //#region src/internal/pipeline/pipeline.ts
1547
- var __dxlog_file$46 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/pipeline.ts";
1552
+ var __dxlog_file$48 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/pipeline/pipeline.ts";
1548
1553
  /**
1549
1554
  * External state accessor.
1550
1555
  */
@@ -1556,7 +1561,7 @@ var PipelineState = class {
1556
1561
  */
1557
1562
  _ctx = new Context(void 0, {
1558
1563
  "~LogMeta": "~LogMeta",
1559
- F: __dxlog_file$46,
1564
+ F: __dxlog_file$48,
1560
1565
  L: 44
1561
1566
  });
1562
1567
  get timeframeUpdate() {
@@ -1626,7 +1631,7 @@ var PipelineState = class {
1626
1631
  */
1627
1632
  async waitUntilReachedTargetTimeframe({ ctx = new Context(void 0, {
1628
1633
  "~LogMeta": "~LogMeta",
1629
- F: __dxlog_file$46,
1634
+ F: __dxlog_file$48,
1630
1635
  L: 134
1631
1636
  }), timeout, breakOnStall = true } = {}) {
1632
1637
  log("waitUntilReachedTargetTimeframe", {
@@ -1635,7 +1640,7 @@ var PipelineState = class {
1635
1640
  target: this.targetTimeframe
1636
1641
  }, {
1637
1642
  "~LogMeta": "~LogMeta",
1638
- F: __dxlog_file$46,
1643
+ F: __dxlog_file$48,
1639
1644
  L: 138,
1640
1645
  S: this
1641
1646
  });
@@ -1659,7 +1664,7 @@ var PipelineState = class {
1659
1664
  dependencies: Timeframe.dependencies(this.targetTimeframe, this.timeframe)
1660
1665
  }, {
1661
1666
  "~LogMeta": "~LogMeta",
1662
- F: __dxlog_file$46,
1667
+ F: __dxlog_file$48,
1663
1668
  L: 166,
1664
1669
  S: this
1665
1670
  });
@@ -1720,7 +1725,7 @@ var Pipeline = class {
1720
1725
  get writer() {
1721
1726
  invariant(this._writer, "Writer not set.", {
1722
1727
  "~LogMeta": "~LogMeta",
1723
- F: __dxlog_file$46,
1728
+ F: __dxlog_file$48,
1724
1729
  L: 254,
1725
1730
  S: this,
1726
1731
  A: ["this._writer", "'Writer not set.'"]
@@ -1744,14 +1749,14 @@ var Pipeline = class {
1744
1749
  setWriteFeed(feed) {
1745
1750
  invariant(!this._writer, "Writer already set.", {
1746
1751
  "~LogMeta": "~LogMeta",
1747
- F: __dxlog_file$46,
1752
+ F: __dxlog_file$48,
1748
1753
  L: 284,
1749
1754
  S: this,
1750
1755
  A: ["!this._writer", "'Writer already set.'"]
1751
1756
  });
1752
1757
  invariant(feed.properties.writable, "Feed must be writable.", {
1753
1758
  "~LogMeta": "~LogMeta",
1754
- F: __dxlog_file$46,
1759
+ F: __dxlog_file$48,
1755
1760
  L: 285,
1756
1761
  S: this,
1757
1762
  A: ["feed.properties.writable", "'Feed must be writable.'"]
@@ -1764,14 +1769,14 @@ var Pipeline = class {
1764
1769
  async start() {
1765
1770
  invariant(!this._isStarted, "Pipeline is already started.", {
1766
1771
  "~LogMeta": "~LogMeta",
1767
- F: __dxlog_file$46,
1772
+ F: __dxlog_file$48,
1768
1773
  L: 296,
1769
1774
  S: this,
1770
1775
  A: ["!this._isStarted", "'Pipeline is already started.'"]
1771
1776
  });
1772
1777
  log("starting...", void 0, {
1773
1778
  "~LogMeta": "~LogMeta",
1774
- F: __dxlog_file$46,
1779
+ F: __dxlog_file$48,
1775
1780
  L: 297,
1776
1781
  S: this
1777
1782
  });
@@ -1780,7 +1785,7 @@ var Pipeline = class {
1780
1785
  this._isStarted = true;
1781
1786
  log("started", void 0, {
1782
1787
  "~LogMeta": "~LogMeta",
1783
- F: __dxlog_file$46,
1788
+ F: __dxlog_file$48,
1784
1789
  L: 301,
1785
1790
  S: this
1786
1791
  });
@@ -1789,7 +1794,7 @@ var Pipeline = class {
1789
1794
  async stop() {
1790
1795
  log("stopping...", void 0, {
1791
1796
  "~LogMeta": "~LogMeta",
1792
- F: __dxlog_file$46,
1797
+ F: __dxlog_file$48,
1793
1798
  L: 312,
1794
1799
  S: this
1795
1800
  });
@@ -1801,7 +1806,7 @@ var Pipeline = class {
1801
1806
  await this._state._ctx.dispose();
1802
1807
  this._state._ctx = new Context(void 0, {
1803
1808
  "~LogMeta": "~LogMeta",
1804
- F: __dxlog_file$46,
1809
+ F: __dxlog_file$48,
1805
1810
  L: 321
1806
1811
  });
1807
1812
  this._state._reachedTargetPromise = void 0;
@@ -1809,7 +1814,7 @@ var Pipeline = class {
1809
1814
  this._isStarted = false;
1810
1815
  log("stopped", void 0, {
1811
1816
  "~LogMeta": "~LogMeta",
1812
- F: __dxlog_file$46,
1817
+ F: __dxlog_file$48,
1813
1818
  L: 325,
1814
1819
  S: this
1815
1820
  });
@@ -1821,7 +1826,7 @@ var Pipeline = class {
1821
1826
  async setCursor(timeframe) {
1822
1827
  invariant(!this._isStarted || this._isPaused, "Invalid state.", {
1823
1828
  "~LogMeta": "~LogMeta",
1824
- F: __dxlog_file$46,
1829
+ F: __dxlog_file$48,
1825
1830
  L: 334,
1826
1831
  S: this,
1827
1832
  A: ["!this._isStarted || this._isPaused", "'Invalid state.'"]
@@ -1846,7 +1851,7 @@ var Pipeline = class {
1846
1851
  async unpause() {
1847
1852
  invariant(this._isPaused, "Pipeline is not paused.", {
1848
1853
  "~LogMeta": "~LogMeta",
1849
- F: __dxlog_file$46,
1854
+ F: __dxlog_file$48,
1850
1855
  L: 363,
1851
1856
  S: this,
1852
1857
  A: ["this._isPaused", "'Pipeline is not paused.'"]
@@ -1862,7 +1867,7 @@ var Pipeline = class {
1862
1867
  async *consume() {
1863
1868
  invariant(!this._isBeingConsumed, "Pipeline is already being consumed.", {
1864
1869
  "~LogMeta": "~LogMeta",
1865
- F: __dxlog_file$46,
1870
+ F: __dxlog_file$48,
1866
1871
  L: 378,
1867
1872
  S: this,
1868
1873
  A: ["!this._isBeingConsumed", "'Pipeline is already being consumed.'"]
@@ -1870,7 +1875,7 @@ var Pipeline = class {
1870
1875
  this._isBeingConsumed = true;
1871
1876
  invariant(this._feedSetIterator, "Iterator not initialized.", {
1872
1877
  "~LogMeta": "~LogMeta",
1873
- F: __dxlog_file$46,
1878
+ F: __dxlog_file$48,
1874
1879
  L: 381,
1875
1880
  S: this,
1876
1881
  A: ["this._feedSetIterator", "'Iterator not initialized.'"]
@@ -1882,7 +1887,7 @@ var Pipeline = class {
1882
1887
  iteration += 1;
1883
1888
  log("consume iteration", { iteration }, {
1884
1889
  "~LogMeta": "~LogMeta",
1885
- F: __dxlog_file$46,
1890
+ F: __dxlog_file$48,
1886
1891
  L: 389,
1887
1892
  S: this
1888
1893
  });
@@ -1890,13 +1895,13 @@ var Pipeline = class {
1890
1895
  if (lastFeedSetIterator !== this._feedSetIterator) {
1891
1896
  log("consume: iterator changed while paused", { iteration }, {
1892
1897
  "~LogMeta": "~LogMeta",
1893
- F: __dxlog_file$46,
1898
+ F: __dxlog_file$48,
1894
1899
  L: 394,
1895
1900
  S: this
1896
1901
  });
1897
1902
  invariant(this._feedSetIterator, "Iterator not initialized.", {
1898
1903
  "~LogMeta": "~LogMeta",
1899
- F: __dxlog_file$46,
1904
+ F: __dxlog_file$48,
1900
1905
  L: 395,
1901
1906
  S: this,
1902
1907
  A: ["this._feedSetIterator", "'Iterator not initialized.'"]
@@ -1913,7 +1918,7 @@ var Pipeline = class {
1913
1918
  seq: block.seq
1914
1919
  }, {
1915
1920
  "~LogMeta": "~LogMeta",
1916
- F: __dxlog_file$46,
1921
+ F: __dxlog_file$48,
1917
1922
  L: 404,
1918
1923
  S: this
1919
1924
  });
@@ -1925,14 +1930,14 @@ var Pipeline = class {
1925
1930
  } else if (!this._isStopping) {
1926
1931
  log("consume: generator ended; waiting for iterator restart or swap", { iteration }, {
1927
1932
  "~LogMeta": "~LogMeta",
1928
- F: __dxlog_file$46,
1933
+ F: __dxlog_file$48,
1929
1934
  L: 415,
1930
1935
  S: this
1931
1936
  });
1932
1937
  if (lastFeedSetIterator === this._feedSetIterator) await Promise.race([lastFeedSetIterator.waitUntilRunning(), this._iteratorChanged.wait()]);
1933
1938
  invariant(this._feedSetIterator, "Iterator not initialized.", {
1934
1939
  "~LogMeta": "~LogMeta",
1935
- F: __dxlog_file$46,
1940
+ F: __dxlog_file$48,
1936
1941
  L: 419,
1937
1942
  S: this,
1938
1943
  A: ["this._feedSetIterator", "'Iterator not initialized.'"]
@@ -1941,7 +1946,7 @@ var Pipeline = class {
1941
1946
  iterable = lastFeedSetIterator[Symbol.asyncIterator]();
1942
1947
  log("consume: resuming with fresh generator", { iteration }, {
1943
1948
  "~LogMeta": "~LogMeta",
1944
- F: __dxlog_file$46,
1949
+ F: __dxlog_file$48,
1945
1950
  L: 422,
1946
1951
  S: this
1947
1952
  });
@@ -1949,7 +1954,7 @@ var Pipeline = class {
1949
1954
  }
1950
1955
  log("consume: stopped", { iteration }, {
1951
1956
  "~LogMeta": "~LogMeta",
1952
- F: __dxlog_file$46,
1957
+ F: __dxlog_file$48,
1953
1958
  L: 425,
1954
1959
  S: this
1955
1960
  });
@@ -1965,7 +1970,7 @@ var Pipeline = class {
1965
1970
  length: feed.length
1966
1971
  }, {
1967
1972
  "~LogMeta": "~LogMeta",
1968
- F: __dxlog_file$46,
1973
+ F: __dxlog_file$48,
1969
1974
  L: 439,
1970
1975
  S: this
1971
1976
  });
@@ -1975,7 +1980,7 @@ var Pipeline = class {
1975
1980
  }, (err, data) => {
1976
1981
  if (err) {} else log("downloaded", { data }, {
1977
1982
  "~LogMeta": "~LogMeta",
1978
- F: __dxlog_file$46,
1983
+ F: __dxlog_file$48,
1979
1984
  L: 444,
1980
1985
  S: this
1981
1986
  });
@@ -1998,7 +2003,7 @@ var Pipeline = class {
1998
2003
  targetTimeframe: this._state.targetTimeframe
1999
2004
  }, {
2000
2005
  "~LogMeta": "~LogMeta",
2001
- F: __dxlog_file$46,
2006
+ F: __dxlog_file$48,
2002
2007
  L: 465,
2003
2008
  S: this
2004
2009
  });
@@ -2021,13 +2026,13 @@ var valueEncoding = createCodecEncoding({
2021
2026
  });
2022
2027
  //#endregion
2023
2028
  //#region src/internal/space/control-pipeline.ts
2024
- var __dxlog_file$45 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/control-pipeline.ts";
2029
+ var __dxlog_file$47 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/control-pipeline.ts";
2025
2030
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
2026
2031
  var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
2027
2032
  var ControlPipeline = class ControlPipeline {
2028
2033
  _ctx = new Context(void 0, {
2029
2034
  "~LogMeta": "~LogMeta",
2030
- F: __dxlog_file$45,
2035
+ F: __dxlog_file$47,
2031
2036
  L: 54
2032
2037
  });
2033
2038
  _pipeline;
@@ -2054,7 +2059,7 @@ var ControlPipeline = class ControlPipeline {
2054
2059
  this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
2055
2060
  log("feed admitted", { key: info.key }, {
2056
2061
  "~LogMeta": "~LogMeta",
2057
- F: __dxlog_file$45,
2062
+ F: __dxlog_file$47,
2058
2063
  L: 83,
2059
2064
  S: this
2060
2065
  });
@@ -2066,7 +2071,7 @@ var ControlPipeline = class ControlPipeline {
2066
2071
  } catch (err) {
2067
2072
  log.catch(err, void 0, {
2068
2073
  "~LogMeta": "~LogMeta",
2069
- F: __dxlog_file$45,
2074
+ F: __dxlog_file$47,
2070
2075
  L: 97,
2071
2076
  S: this
2072
2077
  });
@@ -2105,14 +2110,14 @@ var ControlPipeline = class ControlPipeline {
2105
2110
  tf: snapshot?.timeframe
2106
2111
  }, {
2107
2112
  "~LogMeta": "~LogMeta",
2108
- F: __dxlog_file$45,
2113
+ F: __dxlog_file$47,
2109
2114
  L: 136,
2110
2115
  S: this
2111
2116
  });
2112
2117
  if (snapshot) await this._processSnapshot(snapshot);
2113
2118
  log("starting...", void 0, {
2114
2119
  "~LogMeta": "~LogMeta",
2115
- F: __dxlog_file$45,
2120
+ F: __dxlog_file$47,
2116
2121
  L: 141,
2117
2122
  S: this
2118
2123
  });
@@ -2122,7 +2127,7 @@ var ControlPipeline = class ControlPipeline {
2122
2127
  });
2123
2128
  log("started", void 0, {
2124
2129
  "~LogMeta": "~LogMeta",
2125
- F: __dxlog_file$45,
2130
+ F: __dxlog_file$47,
2126
2131
  L: 149,
2127
2132
  S: this
2128
2133
  });
@@ -2132,7 +2137,7 @@ var ControlPipeline = class ControlPipeline {
2132
2137
  for (const message of snapshot.messages ?? []) {
2133
2138
  invariant(message.credential, "Snapshot entry carries no credential.", {
2134
2139
  "~LogMeta": "~LogMeta",
2135
- F: __dxlog_file$45,
2140
+ F: __dxlog_file$47,
2136
2141
  L: 156,
2137
2142
  S: this,
2138
2143
  A: ["message.credential", "'Snapshot entry carries no credential.'"]
@@ -2142,7 +2147,7 @@ var ControlPipeline = class ControlPipeline {
2142
2147
  skipVerification: true
2143
2148
  })) log.warn("credential processing failed from snapshot", { message }, {
2144
2149
  "~LogMeta": "~LogMeta",
2145
- F: __dxlog_file$45,
2150
+ F: __dxlog_file$47,
2146
2151
  L: 163,
2147
2152
  S: this
2148
2153
  });
@@ -2163,7 +2168,7 @@ var ControlPipeline = class ControlPipeline {
2163
2168
  snapshot: getSnapshotLoggerContext(snapshot)
2164
2169
  }, {
2165
2170
  "~LogMeta": "~LogMeta",
2166
- F: __dxlog_file$45,
2171
+ F: __dxlog_file$47,
2167
2172
  L: 186,
2168
2173
  S: this
2169
2174
  });
@@ -2175,7 +2180,7 @@ var ControlPipeline = class ControlPipeline {
2175
2180
  } catch (err) {
2176
2181
  log.catch(err, void 0, {
2177
2182
  "~LogMeta": "~LogMeta",
2178
- F: __dxlog_file$45,
2183
+ F: __dxlog_file$47,
2179
2184
  L: 195,
2180
2185
  S: this
2181
2186
  });
@@ -2187,7 +2192,7 @@ var ControlPipeline = class ControlPipeline {
2187
2192
  seq: msg.seq
2188
2193
  }, {
2189
2194
  "~LogMeta": "~LogMeta",
2190
- F: __dxlog_file$45,
2195
+ F: __dxlog_file$47,
2191
2196
  L: 202,
2192
2197
  S: this
2193
2198
  });
@@ -2195,7 +2200,7 @@ var ControlPipeline = class ControlPipeline {
2195
2200
  const credential = msg.data.payload.payload.value.credential;
2196
2201
  invariant(credential, "Credentials message is empty.", {
2197
2202
  "~LogMeta": "~LogMeta",
2198
- F: __dxlog_file$45,
2203
+ F: __dxlog_file$47,
2199
2204
  L: 205,
2200
2205
  S: this,
2201
2206
  A: ["credential", "'Credentials message is empty.'"]
@@ -2205,7 +2210,7 @@ var ControlPipeline = class ControlPipeline {
2205
2210
  timer.end();
2206
2211
  if (!result) log.warn("processing failed", { msg }, {
2207
2212
  "~LogMeta": "~LogMeta",
2208
- F: __dxlog_file$45,
2213
+ F: __dxlog_file$47,
2209
2214
  L: 213,
2210
2215
  S: this
2211
2216
  });
@@ -2222,7 +2227,7 @@ var ControlPipeline = class ControlPipeline {
2222
2227
  async stop() {
2223
2228
  log("stopping...", void 0, {
2224
2229
  "~LogMeta": "~LogMeta",
2225
- F: __dxlog_file$45,
2230
+ F: __dxlog_file$47,
2226
2231
  L: 233,
2227
2232
  S: this
2228
2233
  });
@@ -2231,7 +2236,7 @@ var ControlPipeline = class ControlPipeline {
2231
2236
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
2232
2237
  log("stopped", void 0, {
2233
2238
  "~LogMeta": "~LogMeta",
2234
- F: __dxlog_file$45,
2239
+ F: __dxlog_file$47,
2235
2240
  L: 237,
2236
2241
  S: this
2237
2242
  });
@@ -2244,7 +2249,7 @@ var ControlPipeline = class ControlPipeline {
2244
2249
  } catch (err) {
2245
2250
  log(err, void 0, {
2246
2251
  "~LogMeta": "~LogMeta",
2247
- F: __dxlog_file$45,
2252
+ F: __dxlog_file$47,
2248
2253
  L: 246,
2249
2254
  S: this
2250
2255
  });
@@ -2269,7 +2274,7 @@ var getSnapshotLoggerContext = (snapshot) => {
2269
2274
  };
2270
2275
  //#endregion
2271
2276
  //#region src/internal/space/space.ts
2272
- var __dxlog_file$44 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/space.ts";
2277
+ var __dxlog_file$46 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/space.ts";
2273
2278
  var Space = class Space extends Resource {
2274
2279
  onCredentialProcessed = new Callback();
2275
2280
  /** Multi-subscriber counterpart to {@link onCredentialProcessed}, which holds a single handler. */
@@ -2287,7 +2292,7 @@ var Space = class Space extends Resource {
2287
2292
  super();
2288
2293
  invariant(params.spaceKey && params.feedProvider, void 0, {
2289
2294
  "~LogMeta": "~LogMeta",
2290
- F: __dxlog_file$44,
2295
+ F: __dxlog_file$46,
2291
2296
  L: 72,
2292
2297
  S: this,
2293
2298
  A: ["params.spaceKey && params.feedProvider", ""]
@@ -2313,7 +2318,7 @@ var Space = class Space extends Resource {
2313
2318
  this.credentialProcessed.emit(credential);
2314
2319
  log("onCredentialProcessed", { credential }, {
2315
2320
  "~LogMeta": "~LogMeta",
2316
- F: __dxlog_file$44,
2321
+ F: __dxlog_file$46,
2317
2322
  L: 100,
2318
2323
  S: this
2319
2324
  });
@@ -2322,7 +2327,7 @@ var Space = class Space extends Resource {
2322
2327
  this._controlPipeline.onDelegatedInvitation.set(async (invitation) => {
2323
2328
  log("onDelegatedInvitation", { invitation }, {
2324
2329
  "~LogMeta": "~LogMeta",
2325
- F: __dxlog_file$44,
2330
+ F: __dxlog_file$46,
2326
2331
  L: 104,
2327
2332
  S: this
2328
2333
  });
@@ -2331,7 +2336,7 @@ var Space = class Space extends Resource {
2331
2336
  this._controlPipeline.onDelegatedInvitationRemoved.set(async (invitation) => {
2332
2337
  log("onDelegatedInvitationRemoved", { invitation }, {
2333
2338
  "~LogMeta": "~LogMeta",
2334
- F: __dxlog_file$44,
2339
+ F: __dxlog_file$46,
2335
2340
  L: 108,
2336
2341
  S: this
2337
2342
  });
@@ -2340,7 +2345,7 @@ var Space = class Space extends Resource {
2340
2345
  this._controlPipeline.onMemberRoleChanged.set(async (changedMembers) => {
2341
2346
  log("onMemberRoleChanged", () => ({ changedMembers: changedMembers.map((m) => [m.key, m.role]) }), {
2342
2347
  "~LogMeta": "~LogMeta",
2343
- F: __dxlog_file$44,
2348
+ F: __dxlog_file$46,
2344
2349
  L: 112,
2345
2350
  S: this
2346
2351
  });
@@ -2379,7 +2384,7 @@ var Space = class Space extends Resource {
2379
2384
  async setControlFeed(feed) {
2380
2385
  invariant(!this._controlFeed, "Control feed already set.", {
2381
2386
  "~LogMeta": "~LogMeta",
2382
- F: __dxlog_file$44,
2387
+ F: __dxlog_file$46,
2383
2388
  L: 159,
2384
2389
  S: this,
2385
2390
  A: ["!this._controlFeed", "'Control feed already set.'"]
@@ -2391,7 +2396,7 @@ var Space = class Space extends Resource {
2391
2396
  async setDataFeed(feed) {
2392
2397
  invariant(!this._dataFeed, "Data feed already set.", {
2393
2398
  "~LogMeta": "~LogMeta",
2394
- F: __dxlog_file$44,
2399
+ F: __dxlog_file$46,
2395
2400
  L: 166,
2396
2401
  S: this,
2397
2402
  A: ["!this._dataFeed", "'Data feed already set.'"]
@@ -2408,14 +2413,14 @@ var Space = class Space extends Resource {
2408
2413
  async _open(ctx) {
2409
2414
  log("opening...", void 0, {
2410
2415
  "~LogMeta": "~LogMeta",
2411
- F: __dxlog_file$44,
2416
+ F: __dxlog_file$46,
2412
2417
  L: 180,
2413
2418
  S: this
2414
2419
  });
2415
2420
  await this._controlPipeline.start(ctx);
2416
2421
  log("opened", void 0, {
2417
2422
  "~LogMeta": "~LogMeta",
2418
- F: __dxlog_file$44,
2423
+ F: __dxlog_file$46,
2419
2424
  L: 185,
2420
2425
  S: this
2421
2426
  });
@@ -2423,7 +2428,7 @@ var Space = class Space extends Resource {
2423
2428
  async startProtocol(ctx) {
2424
2429
  invariant(this.isOpen, void 0, {
2425
2430
  "~LogMeta": "~LogMeta",
2426
- F: __dxlog_file$44,
2431
+ F: __dxlog_file$46,
2427
2432
  L: 190,
2428
2433
  S: this,
2429
2434
  A: ["this.isOpen", ""]
@@ -2434,7 +2439,7 @@ var Space = class Space extends Resource {
2434
2439
  async _close(ctx) {
2435
2440
  log("closing...", { key: this._key }, {
2436
2441
  "~LogMeta": "~LogMeta",
2437
- F: __dxlog_file$44,
2442
+ F: __dxlog_file$46,
2438
2443
  L: 197,
2439
2444
  S: this
2440
2445
  });
@@ -2442,7 +2447,7 @@ var Space = class Space extends Resource {
2442
2447
  await this._controlPipeline.stop();
2443
2448
  log("closed", void 0, {
2444
2449
  "~LogMeta": "~LogMeta",
2445
- F: __dxlog_file$44,
2450
+ F: __dxlog_file$46,
2446
2451
  L: 203,
2447
2452
  S: this
2448
2453
  });
@@ -2456,7 +2461,7 @@ __decorate([synchronized], Space.prototype, "_close", null);
2456
2461
  Space = __decorate([trackLeaks("open", "close")], Space);
2457
2462
  //#endregion
2458
2463
  //#region src/internal/space/admission-discovery-extension.ts
2459
- var __dxlog_file$43 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/admission-discovery-extension.ts";
2464
+ var __dxlog_file$45 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/admission-discovery-extension.ts";
2460
2465
  /**
2461
2466
  * Guest's side for a connection to a concrete peer in p2p network during invitation.
2462
2467
  */
@@ -2465,7 +2470,7 @@ var CredentialRetrieverExtension = class extends RpcExtension {
2465
2470
  _onResult;
2466
2471
  _ctx = new Context(void 0, {
2467
2472
  "~LogMeta": "~LogMeta",
2468
- F: __dxlog_file$43,
2473
+ F: __dxlog_file$45,
2469
2474
  L: 33
2470
2475
  });
2471
2476
  constructor(_request, _onResult) {
@@ -2483,7 +2488,7 @@ var CredentialRetrieverExtension = class extends RpcExtension {
2483
2488
  const result = await this.rpc.AdmissionDiscoveryService.getAdmissionCredential(this._request);
2484
2489
  invariant(result.admissionCredential, "Admission response carries no credential.", {
2485
2490
  "~LogMeta": "~LogMeta",
2486
- F: __dxlog_file$43,
2491
+ F: __dxlog_file$45,
2487
2492
  L: 57,
2488
2493
  S: this,
2489
2494
  A: ["result.admissionCredential", "'Admission response carries no credential.'"]
@@ -2520,7 +2525,7 @@ var CredentialServerExtension = class extends RpcExtension {
2520
2525
  };
2521
2526
  //#endregion
2522
2527
  //#region src/internal/space/space-protocol.ts
2523
- var __dxlog_file$42 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/space-protocol.ts";
2528
+ var __dxlog_file$44 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/space-protocol.ts";
2524
2529
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
2525
2530
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
2526
2531
  /**
@@ -2564,7 +2569,7 @@ var SpaceProtocol = class {
2564
2569
  async addHypercore(feed) {
2565
2570
  log("addHypercore", { key: feed.key }, {
2566
2571
  "~LogMeta": "~LogMeta",
2567
- F: __dxlog_file$42,
2572
+ F: __dxlog_file$44,
2568
2573
  L: 122,
2569
2574
  S: this
2570
2575
  });
@@ -2577,7 +2582,7 @@ var SpaceProtocol = class {
2577
2582
  const credentials = await this._swarmIdentity.credentialProvider(Buffer.from(""));
2578
2583
  log("starting...", void 0, {
2579
2584
  "~LogMeta": "~LogMeta",
2580
- F: __dxlog_file$42,
2585
+ F: __dxlog_file$44,
2581
2586
  L: 141,
2582
2587
  S: this
2583
2588
  });
@@ -2590,7 +2595,7 @@ var SpaceProtocol = class {
2590
2595
  });
2591
2596
  log("started", void 0, {
2592
2597
  "~LogMeta": "~LogMeta",
2593
- F: __dxlog_file$42,
2598
+ F: __dxlog_file$44,
2594
2599
  L: 150,
2595
2600
  S: this
2596
2601
  });
@@ -2602,14 +2607,14 @@ var SpaceProtocol = class {
2602
2607
  if (this._connection) {
2603
2608
  log("stopping...", void 0, {
2604
2609
  "~LogMeta": "~LogMeta",
2605
- F: __dxlog_file$42,
2610
+ F: __dxlog_file$44,
2606
2611
  L: 159,
2607
2612
  S: this
2608
2613
  });
2609
2614
  await this._connection.close(ctx);
2610
2615
  log("stopped", void 0, {
2611
2616
  "~LogMeta": "~LogMeta",
2612
- F: __dxlog_file$42,
2617
+ F: __dxlog_file$44,
2613
2618
  L: 161,
2614
2619
  S: this
2615
2620
  });
@@ -2678,7 +2683,7 @@ var SpaceProtocolSession = class {
2678
2683
  onAuthSuccess: () => {
2679
2684
  log("Peer authenticated", void 0, {
2680
2685
  "~LogMeta": "~LogMeta",
2681
- F: __dxlog_file$42,
2686
+ F: __dxlog_file$44,
2682
2687
  L: 270,
2683
2688
  S: this
2684
2689
  });
@@ -2695,7 +2700,7 @@ var SpaceProtocolSession = class {
2695
2700
  async close() {
2696
2701
  log("close", void 0, {
2697
2702
  "~LogMeta": "~LogMeta",
2698
- F: __dxlog_file$42,
2703
+ F: __dxlog_file$44,
2699
2704
  L: 288,
2700
2705
  S: this
2701
2706
  });
@@ -2709,7 +2714,7 @@ __decorate([logInfo], SpaceProtocolSession.prototype, "_wireProps", void 0);
2709
2714
  __decorate([logInfo], SpaceProtocolSession.prototype, "authStatus", null);
2710
2715
  //#endregion
2711
2716
  //#region src/internal/space/space-manager.ts
2712
- var __dxlog_file$41 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/space-manager.ts";
2717
+ var __dxlog_file$43 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space/space-manager.ts";
2713
2718
  /**
2714
2719
  * Effect service tag for {@link SpaceManager}.
2715
2720
  */
@@ -2736,7 +2741,7 @@ var SpaceManager = class SpaceManager {
2736
2741
  async constructSpace({ metadata, swarmIdentity, onAuthorizedConnection, onAuthFailure, onDelegatedInvitationStatusChange, onMemberRolesChanged, memberKey }) {
2737
2742
  log("constructing space...", { spaceKey: metadata.genesisFeedKey }, {
2738
2743
  "~LogMeta": "~LogMeta",
2739
- F: __dxlog_file$41,
2744
+ F: __dxlog_file$43,
2740
2745
  L: 110,
2741
2746
  S: this
2742
2747
  });
@@ -2768,7 +2773,7 @@ var SpaceManager = class SpaceManager {
2768
2773
  async requestSpaceAdmissionCredential(ctx, params) {
2769
2774
  log("requesting space admission credential...", { spaceKey: params.spaceKey }, {
2770
2775
  "~LogMeta": "~LogMeta",
2771
- F: __dxlog_file$41,
2776
+ F: __dxlog_file$43,
2772
2777
  L: 147,
2773
2778
  S: this
2774
2779
  });
@@ -2827,7 +2832,7 @@ var SpaceManagerLayer = (options = {}) => Layer.effect(SpaceManagerService, Effe
2827
2832
  }));
2828
2833
  //#endregion
2829
2834
  //#region src/internal/devtools/feeds.ts
2830
- var __dxlog_file$40 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/feeds.ts";
2835
+ var __dxlog_file$42 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/feeds.ts";
2831
2836
  /** Feed blocks come off the iterator in the protobuf.js shape, which crosses as the shared wire bytes. */
2832
2837
  /** The feed's blocks as the devtools RPC message; the iterator yields the domain block shape. */
2833
2838
  var toBufResponse$1 = (blocks) => buf.create(SubscribeToFeedBlocksResponseSchema, { blocks: blocks.map((block) => buf.create(SubscribeToFeedBlocksResponse_BlockSchema, {
@@ -2872,7 +2877,7 @@ var findFeedOwner = (spaceManager, feedKey) => {
2872
2877
  allSpaces: spaceManager.spaces.size
2873
2878
  }, {
2874
2879
  "~LogMeta": "~LogMeta",
2875
- F: __dxlog_file$40,
2880
+ F: __dxlog_file$42,
2876
2881
  L: 94,
2877
2882
  S: void 0
2878
2883
  });
@@ -2918,11 +2923,11 @@ var subscribeToFeedBlocks = ({ hypercoreStore }, { feedKey, maxBlocks = 10 }) =>
2918
2923
  };
2919
2924
  //#endregion
2920
2925
  //#region src/internal/devtools/keys.ts
2921
- var __dxlog_file$39 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/keys.ts";
2926
+ var __dxlog_file$41 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/keys.ts";
2922
2927
  var subscribeToKeyringKeys = ({ keyring }) => EffectEx.streamFromEmitter((emit) => {
2923
2928
  const ctx = Context.default(void 0, {
2924
2929
  "~LogMeta": "~LogMeta",
2925
- F: __dxlog_file$39,
2930
+ F: __dxlog_file$41,
2926
2931
  L: 20
2927
2932
  });
2928
2933
  const update = async () => {
@@ -2938,12 +2943,12 @@ var subscribeToKeyringKeys = ({ keyring }) => EffectEx.streamFromEmitter((emit)
2938
2943
  });
2939
2944
  //#endregion
2940
2945
  //#region src/internal/devtools/metadata.ts
2941
- var __dxlog_file$38 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/metadata.ts";
2946
+ var __dxlog_file$40 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/metadata.ts";
2942
2947
  var toBufResponse = (metadata) => buf.create(SubscribeToMetadataResponseSchema, { metadata });
2943
2948
  var subscribeToMetadata = ({ metadataStore }) => EffectEx.streamFromEmitter((emit) => {
2944
2949
  const ctx = Context.default(void 0, {
2945
2950
  "~LogMeta": "~LogMeta",
2946
- F: __dxlog_file$38,
2951
+ F: __dxlog_file$40,
2947
2952
  L: 28
2948
2953
  });
2949
2954
  metadataStore.update.on(ctx, (data) => emit.single(toBufResponse(data)));
@@ -2952,7 +2957,7 @@ var subscribeToMetadata = ({ metadataStore }) => EffectEx.streamFromEmitter((emi
2952
2957
  });
2953
2958
  //#endregion
2954
2959
  //#region src/internal/devtools/network.ts
2955
- var __dxlog_file$37 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/network.ts";
2960
+ var __dxlog_file$39 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/network.ts";
2956
2961
  var subscribeToNetworkStatus = ({ signalManager }) => EffectEx.streamFromEmitter((emit) => {
2957
2962
  const update = () => {
2958
2963
  try {
@@ -2969,7 +2974,7 @@ var subscribeToNetworkStatus = ({ signalManager }) => EffectEx.streamFromEmitter
2969
2974
  var subscribeToSignal = ({ signalManager, networkManager }) => EffectEx.streamFromEmitter((emit) => {
2970
2975
  const ctx = new Context(void 0, {
2971
2976
  "~LogMeta": "~LogMeta",
2972
- F: __dxlog_file$37,
2977
+ F: __dxlog_file$39,
2973
2978
  L: 51
2974
2979
  });
2975
2980
  let unsubscribe;
@@ -2997,7 +3002,7 @@ var subscribeToSignal = ({ signalManager, networkManager }) => EffectEx.streamFr
2997
3002
  else unsubscribe = unsub;
2998
3003
  }).catch((err) => log.catch(err, void 0, {
2999
3004
  "~LogMeta": "~LogMeta",
3000
- F: __dxlog_file$37,
3005
+ F: __dxlog_file$39,
3001
3006
  L: 89,
3002
3007
  S: void 0
3003
3008
  }));
@@ -3128,7 +3133,7 @@ var subscribeToSpaces = ({ spaceManager, metadataStore, dataSpaceManager, initia
3128
3133
  };
3129
3134
  //#endregion
3130
3135
  //#region src/internal/devtools/devtools.ts
3131
- var __dxlog_file$36 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/devtools.ts";
3136
+ var __dxlog_file$38 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devtools/devtools.ts";
3132
3137
  var DevtoolsHostEvents = class {
3133
3138
  ready = new Event();
3134
3139
  };
@@ -3161,7 +3166,7 @@ var DevtoolsServiceImpl = class {
3161
3166
  return EffectEx.streamFromEmitter((emit) => {
3162
3167
  const ctx = Context.default(void 0, {
3163
3168
  "~LogMeta": "~LogMeta",
3164
- F: __dxlog_file$36,
3169
+ F: __dxlog_file$38,
3165
3170
  L: 93
3166
3171
  });
3167
3172
  this.params.events.ready.on(ctx, () => {
@@ -3337,10 +3342,10 @@ var getPlatform = () => {
3337
3342
  };
3338
3343
  //#endregion
3339
3344
  //#region src/version.ts
3340
- var DXOS_VERSION = "0.14.0";
3345
+ var DXOS_VERSION = "0.16.0";
3341
3346
  //#endregion
3342
3347
  //#region src/internal/diagnostics/diagnostics.ts
3343
- var __dxlog_file$35 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/diagnostics/diagnostics.ts";
3348
+ var __dxlog_file$37 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/diagnostics/diagnostics.ts";
3344
3349
  var DEFAULT_TIMEOUT = 1e3;
3345
3350
  /**
3346
3351
  * {@link createDiagnostics} over the services registered with a stack's {@link RpcRouter.RpcRouter},
@@ -3366,7 +3371,7 @@ var createDiagnostics = async (clientServices, stack, config) => {
3366
3371
  (async () => {
3367
3372
  invariant(clientServices.LoggingService, "SystemService is not available.", {
3368
3373
  "~LogMeta": "~LogMeta",
3369
- F: __dxlog_file$35,
3374
+ F: __dxlog_file$37,
3370
3375
  L: 138,
3371
3376
  S: void 0,
3372
3377
  A: ["clientServices.LoggingService", "'SystemService is not available.'"]
@@ -3401,7 +3406,7 @@ var createDiagnostics = async (clientServices, stack, config) => {
3401
3406
  }
3402
3407
  })().catch((err) => log.warn("failed to collect identity diagnostics", { err }, {
3403
3408
  "~LogMeta": "~LogMeta",
3404
- F: __dxlog_file$35,
3409
+ F: __dxlog_file$37,
3405
3410
  L: 192,
3406
3411
  S: void 0
3407
3412
  }))
@@ -3457,7 +3462,7 @@ var getStorageDiagnostics = async () => {
3457
3462
  }));
3458
3463
  };
3459
3464
  //#endregion
3460
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/usingCtx.js
3465
+ //#region \0@oxc-project+runtime@0.154.0/helpers/esm/usingCtx.js
3461
3466
  function _usingCtx() {
3462
3467
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
3463
3468
  var n = Error();
@@ -3515,7 +3520,7 @@ function _usingCtx() {
3515
3520
  //#endregion
3516
3521
  //#region src/Replication.ts
3517
3522
  var Replication_exports = /* @__PURE__ */ __exportAll({ EdgeFeedReplicator: () => EdgeFeedReplicator });
3518
- var __dxlog_file$34 = "/__w/dxos/dxos/packages/sdk/client-services/src/Replication.ts";
3523
+ var __dxlog_file$36 = "/__w/dxos/dxos/packages/sdk/client-services/src/Replication.ts";
3519
3524
  var EdgeFeedReplicator = class extends Resource {
3520
3525
  _messenger;
3521
3526
  _spaceId;
@@ -3540,7 +3545,7 @@ var EdgeFeedReplicator = class extends Resource {
3540
3545
  async _open() {
3541
3546
  log("open", void 0, {
3542
3547
  "~LogMeta": "~LogMeta",
3543
- F: __dxlog_file$34,
3548
+ F: __dxlog_file$36,
3544
3549
  L: 60,
3545
3550
  S: this
3546
3551
  });
@@ -3555,7 +3560,7 @@ var EdgeFeedReplicator = class extends Resource {
3555
3560
  _spaceId: this._spaceId
3556
3561
  }, {
3557
3562
  "~LogMeta": "~LogMeta",
3558
- F: __dxlog_file$34,
3563
+ F: __dxlog_file$36,
3559
3564
  L: 77,
3560
3565
  S: this
3561
3566
  });
@@ -3568,7 +3573,7 @@ var EdgeFeedReplicator = class extends Resource {
3568
3573
  type: payload.type
3569
3574
  }, {
3570
3575
  "~LogMeta": "~LogMeta",
3571
- F: __dxlog_file$34,
3576
+ F: __dxlog_file$36,
3572
3577
  L: 82,
3573
3578
  S: this
3574
3579
  });
@@ -3585,7 +3590,7 @@ var EdgeFeedReplicator = class extends Resource {
3585
3590
  async _close() {
3586
3591
  log("close", void 0, {
3587
3592
  "~LogMeta": "~LogMeta",
3588
- F: __dxlog_file$34,
3593
+ F: __dxlog_file$36,
3589
3594
  L: 102,
3590
3595
  S: this
3591
3596
  });
@@ -3597,7 +3602,7 @@ var EdgeFeedReplicator = class extends Resource {
3597
3602
  this._connectionCtx = connectionCtx;
3598
3603
  log("connection context created", void 0, {
3599
3604
  "~LogMeta": "~LogMeta",
3600
- F: __dxlog_file$34,
3605
+ F: __dxlog_file$36,
3601
3606
  L: 110,
3602
3607
  S: this
3603
3608
  });
@@ -3608,7 +3613,7 @@ var EdgeFeedReplicator = class extends Resource {
3608
3613
  async _resetConnection() {
3609
3614
  log("resetConnection", void 0, {
3610
3615
  "~LogMeta": "~LogMeta",
3611
- F: __dxlog_file$34,
3616
+ F: __dxlog_file$36,
3612
3617
  L: 119,
3613
3618
  S: this
3614
3619
  });
@@ -3625,7 +3630,7 @@ var EdgeFeedReplicator = class extends Resource {
3625
3630
  hasConnectionCtx: !!this._connectionCtx
3626
3631
  }, {
3627
3632
  "~LogMeta": "~LogMeta",
3628
- F: __dxlog_file$34,
3633
+ F: __dxlog_file$36,
3629
3634
  L: 128,
3630
3635
  S: this
3631
3636
  });
@@ -3638,7 +3643,7 @@ var EdgeFeedReplicator = class extends Resource {
3638
3643
  async _replicateFeed(ctx, feed) {
3639
3644
  log("replicateFeed", { key: feed.key }, {
3640
3645
  "~LogMeta": "~LogMeta",
3641
- F: __dxlog_file$34,
3646
+ F: __dxlog_file$36,
3642
3647
  L: 141,
3643
3648
  S: this
3644
3649
  });
@@ -3654,7 +3659,7 @@ var EdgeFeedReplicator = class extends Resource {
3654
3659
  if (!this._connectionCtx) {
3655
3660
  log("message dropped because connection was disposed", void 0, {
3656
3661
  "~LogMeta": "~LogMeta",
3657
- F: __dxlog_file$34,
3662
+ F: __dxlog_file$36,
3658
3663
  L: 154,
3659
3664
  S: this
3660
3665
  });
@@ -3665,13 +3670,13 @@ var EdgeFeedReplicator = class extends Resource {
3665
3670
  blocks: message.blocks.map((b) => b.index)
3666
3671
  }, {
3667
3672
  "~LogMeta": "~LogMeta",
3668
- F: __dxlog_file$34,
3673
+ F: __dxlog_file$36,
3669
3674
  L: 159,
3670
3675
  S: this
3671
3676
  });
3672
3677
  invariant(message.feedKey, void 0, {
3673
3678
  "~LogMeta": "~LogMeta",
3674
- F: __dxlog_file$34,
3679
+ F: __dxlog_file$36,
3675
3680
  L: 165,
3676
3681
  S: this,
3677
3682
  A: ["message.feedKey", ""]
@@ -3679,7 +3684,7 @@ var EdgeFeedReplicator = class extends Resource {
3679
3684
  const payloadValue = bufferToArray(encode(message));
3680
3685
  log("send", { type: message.type }, {
3681
3686
  "~LogMeta": "~LogMeta",
3682
- F: __dxlog_file$34,
3687
+ F: __dxlog_file$36,
3683
3688
  L: 168,
3684
3689
  S: this
3685
3690
  });
@@ -3696,7 +3701,7 @@ var EdgeFeedReplicator = class extends Resource {
3696
3701
  if (!this._connectionCtx) {
3697
3702
  log.warn("received message after connection context was disposed", void 0, {
3698
3703
  "~LogMeta": "~LogMeta",
3699
- F: __dxlog_file$34,
3704
+ F: __dxlog_file$36,
3700
3705
  L: 184,
3701
3706
  S: this
3702
3707
  });
@@ -3711,7 +3716,7 @@ var EdgeFeedReplicator = class extends Resource {
3711
3716
  if (!feed) {
3712
3717
  log.warn("Feed not found", { feedKey }, {
3713
3718
  "~LogMeta": "~LogMeta",
3714
- F: __dxlog_file$34,
3719
+ F: __dxlog_file$36,
3715
3720
  L: 193,
3716
3721
  S: this
3717
3722
  });
@@ -3732,7 +3737,7 @@ var EdgeFeedReplicator = class extends Resource {
3732
3737
  if (firstMissing < message.length) {
3733
3738
  log("requesting missing blocks", logMeta, {
3734
3739
  "~LogMeta": "~LogMeta",
3735
- F: __dxlog_file$34,
3740
+ F: __dxlog_file$36,
3736
3741
  L: 209,
3737
3742
  S: this
3738
3743
  });
@@ -3748,7 +3753,7 @@ var EdgeFeedReplicator = class extends Resource {
3748
3753
  } else if (remoteLength < feed.length && feed.has(remoteLength, feed.length)) {
3749
3754
  log("pushing blocks to remote", logMeta, {
3750
3755
  "~LogMeta": "~LogMeta",
3751
- F: __dxlog_file$34,
3756
+ F: __dxlog_file$36,
3752
3757
  L: 217,
3753
3758
  S: this
3754
3759
  });
@@ -3766,7 +3771,7 @@ var EdgeFeedReplicator = class extends Resource {
3766
3771
  blocks: message.blocks.map((b) => b.index)
3767
3772
  }, {
3768
3773
  "~LogMeta": "~LogMeta",
3769
- F: __dxlog_file$34,
3774
+ F: __dxlog_file$36,
3770
3775
  L: 226,
3771
3776
  S: this
3772
3777
  });
@@ -3775,7 +3780,7 @@ var EdgeFeedReplicator = class extends Resource {
3775
3780
  if (!feed) {
3776
3781
  log.warn("Feed not found", { feedKey }, {
3777
3782
  "~LogMeta": "~LogMeta",
3778
- F: __dxlog_file$34,
3783
+ F: __dxlog_file$36,
3779
3784
  L: 231,
3780
3785
  S: this
3781
3786
  });
@@ -3789,7 +3794,7 @@ var EdgeFeedReplicator = class extends Resource {
3789
3794
  }
3790
3795
  default: log.warn("Unknown message", { ...message }, {
3791
3796
  "~LogMeta": "~LogMeta",
3792
- F: __dxlog_file$34,
3797
+ F: __dxlog_file$36,
3793
3798
  L: 244,
3794
3799
  S: this
3795
3800
  });
@@ -3803,7 +3808,7 @@ var EdgeFeedReplicator = class extends Resource {
3803
3808
  to
3804
3809
  }, {
3805
3810
  "~LogMeta": "~LogMeta",
3806
- F: __dxlog_file$34,
3811
+ F: __dxlog_file$36,
3807
3812
  L: 251,
3808
3813
  S: this
3809
3814
  });
@@ -3811,7 +3816,7 @@ var EdgeFeedReplicator = class extends Resource {
3811
3816
  const data = await feed.get(index, { valueEncoding: "binary" });
3812
3817
  invariant(data instanceof Uint8Array, void 0, {
3813
3818
  "~LogMeta": "~LogMeta",
3814
- F: __dxlog_file$34,
3819
+ F: __dxlog_file$36,
3815
3820
  L: 256,
3816
3821
  S: this,
3817
3822
  A: ["data instanceof Uint8Array", ""]
@@ -3837,7 +3842,7 @@ var EdgeFeedReplicator = class extends Resource {
3837
3842
  blocks: blocks.length
3838
3843
  }, {
3839
3844
  "~LogMeta": "~LogMeta",
3840
- F: __dxlog_file$34,
3845
+ F: __dxlog_file$36,
3841
3846
  L: 278,
3842
3847
  S: this
3843
3848
  });
@@ -3863,7 +3868,7 @@ var EdgeFeedReplicator = class extends Resource {
3863
3868
  to
3864
3869
  }, {
3865
3870
  "~LogMeta": "~LogMeta",
3866
- F: __dxlog_file$34,
3871
+ F: __dxlog_file$36,
3867
3872
  L: 304,
3868
3873
  S: this
3869
3874
  });
@@ -3885,7 +3890,7 @@ var EdgeFeedReplicator = class extends Resource {
3885
3890
  if (!this._remoteLength.has(feed.key)) {
3886
3891
  log("blocks not pushed because remote length is unknown", void 0, {
3887
3892
  "~LogMeta": "~LogMeta",
3888
- F: __dxlog_file$34,
3893
+ F: __dxlog_file$36,
3889
3894
  L: 314,
3890
3895
  S: this
3891
3896
  });
@@ -3907,7 +3912,7 @@ var EdgeFeedReplicator = class extends Resource {
3907
3912
  if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
3908
3913
  log("resetting on reconnect", void 0, {
3909
3914
  "~LogMeta": "~LogMeta",
3910
- F: __dxlog_file$34,
3915
+ F: __dxlog_file$36,
3911
3916
  L: 333,
3912
3917
  S: this
3913
3918
  });
@@ -3916,7 +3921,7 @@ var EdgeFeedReplicator = class extends Resource {
3916
3921
  }
3917
3922
  }, {
3918
3923
  "~LogMeta": "~LogMeta",
3919
- F: __dxlog_file$34,
3924
+ F: __dxlog_file$36,
3920
3925
  L: 326
3921
3926
  });
3922
3927
  return connectionCtx;
@@ -3941,7 +3946,7 @@ var bufferizeBlock = (block) => ({
3941
3946
  //#endregion
3942
3947
  //#region src/Identity.ts
3943
3948
  var Identity_exports = /* @__PURE__ */ __exportAll({ Identity: () => Identity });
3944
- var __dxlog_file$33 = "/__w/dxos/dxos/packages/sdk/client-services/src/Identity.ts";
3949
+ var __dxlog_file$35 = "/__w/dxos/dxos/packages/sdk/client-services/src/Identity.ts";
3945
3950
  /**
3946
3951
  * Agent identity manager, which includes the agent's Halo space.
3947
3952
  */
@@ -3967,7 +3972,7 @@ var Identity = class {
3967
3972
  this.deviceKey = params.deviceKey;
3968
3973
  log.trace("dxos.halo.device", { deviceKey: params.deviceKey }, {
3969
3974
  "~LogMeta": "~LogMeta",
3970
- F: __dxlog_file$33,
3975
+ F: __dxlog_file$35,
3971
3976
  L: 85,
3972
3977
  S: this
3973
3978
  });
@@ -4061,7 +4066,7 @@ var Identity = class {
4061
4066
  getIdentityCredentialSigner() {
4062
4067
  invariant(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
4063
4068
  "~LogMeta": "~LogMeta",
4064
- F: __dxlog_file$33,
4069
+ F: __dxlog_file$35,
4065
4070
  L: 203,
4066
4071
  S: this,
4067
4072
  A: ["this._deviceStateMachine.deviceCredentialChain", "'Device credential chain is not ready.'"]
@@ -4074,7 +4079,7 @@ var Identity = class {
4074
4079
  getInboxEnvelopeSigner() {
4075
4080
  invariant(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
4076
4081
  "~LogMeta": "~LogMeta",
4077
- F: __dxlog_file$33,
4082
+ F: __dxlog_file$35,
4078
4083
  L: 215,
4079
4084
  S: this,
4080
4085
  A: ["this._deviceStateMachine.deviceCredentialChain", "'Device credential chain is not ready.'"]
@@ -4104,7 +4109,7 @@ var Identity = class {
4104
4109
  dataFeedKey
4105
4110
  }, {
4106
4111
  "~LogMeta": "~LogMeta",
4107
- F: __dxlog_file$33,
4112
+ F: __dxlog_file$35,
4108
4113
  L: 235,
4109
4114
  S: this
4110
4115
  });
@@ -4147,7 +4152,7 @@ __decorate([trace.span({ op: "lifecycle" })], Identity.prototype, "open", null);
4147
4152
  __decorate([trace.span({ op: "lifecycle" })], Identity.prototype, "close", null);
4148
4153
  //#endregion
4149
4154
  //#region src/internal/identity/contacts-service.ts
4150
- var __dxlog_file$32 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/contacts-service.ts";
4155
+ var __dxlog_file$34 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/contacts-service.ts";
4151
4156
  var ContactsServiceImpl = class {
4152
4157
  _identityManager;
4153
4158
  _spaceManager;
@@ -4165,7 +4170,7 @@ var ContactsServiceImpl = class {
4165
4170
  return EffectEx.streamFromEmitter((emit) => {
4166
4171
  const ctx = Context.default(void 0, {
4167
4172
  "~LogMeta": "~LogMeta",
4168
- F: __dxlog_file$32,
4173
+ F: __dxlog_file$34,
4169
4174
  L: 43
4170
4175
  });
4171
4176
  const pushUpdateTask = new UpdateScheduler(ctx, async () => {
@@ -4221,7 +4226,7 @@ var ContactsServiceLayer = Layer.effect(ContactsService.Tag, Effect.gen(function
4221
4226
  }));
4222
4227
  //#endregion
4223
4228
  //#region src/internal/identity/identity-recovery-manager.ts
4224
- var __dxlog_file$31 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-recovery-manager.ts";
4229
+ var __dxlog_file$33 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-recovery-manager.ts";
4225
4230
  /**
4226
4231
  * Effect service tag for {@link EdgeIdentityRecoveryManager}.
4227
4232
  */
@@ -4246,7 +4251,7 @@ var EdgeIdentityRecoveryManager = class {
4246
4251
  const identity = this._identityProvider();
4247
4252
  invariant(identity, void 0, {
4248
4253
  "~LogMeta": "~LogMeta",
4249
- F: __dxlog_file$31,
4254
+ F: __dxlog_file$33,
4250
4255
  L: 80,
4251
4256
  S: this,
4252
4257
  A: ["identity", ""]
@@ -4306,7 +4311,7 @@ var EdgeIdentityRecoveryManager = class {
4306
4311
  const identity = this._identityProvider();
4307
4312
  invariant(identity, void 0, {
4308
4313
  "~LogMeta": "~LogMeta",
4309
- F: __dxlog_file$31,
4314
+ F: __dxlog_file$33,
4310
4315
  L: 141,
4311
4316
  S: this,
4312
4317
  A: ["identity", ""]
@@ -4336,7 +4341,7 @@ var EdgeIdentityRecoveryManager = class {
4336
4341
  const identity = this._identityProvider();
4337
4342
  invariant(identity, void 0, {
4338
4343
  "~LogMeta": "~LogMeta",
4339
- F: __dxlog_file$31,
4344
+ F: __dxlog_file$33,
4340
4345
  L: 173,
4341
4346
  S: this,
4342
4347
  A: ["identity", ""]
@@ -4360,7 +4365,7 @@ var EdgeIdentityRecoveryManager = class {
4360
4365
  async requestRecoveryChallenge(ctx) {
4361
4366
  invariant(this._edgeClient, "Not connected to EDGE.", {
4362
4367
  "~LogMeta": "~LogMeta",
4363
- F: __dxlog_file$31,
4368
+ F: __dxlog_file$33,
4364
4369
  L: 195,
4365
4370
  S: this,
4366
4371
  A: ["this._edgeClient", "'Not connected to EDGE.'"]
@@ -4386,7 +4391,7 @@ var EdgeIdentityRecoveryManager = class {
4386
4391
  async recoverIdentityWithExternalSignature(ctx, { lookupKey, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
4387
4392
  invariant(this._edgeClient, "Not connected to EDGE.", {
4388
4393
  "~LogMeta": "~LogMeta",
4389
- F: __dxlog_file$31,
4394
+ F: __dxlog_file$33,
4390
4395
  L: 230,
4391
4396
  S: this,
4392
4397
  A: ["this._edgeClient", "'Not connected to EDGE.'"]
@@ -4423,7 +4428,7 @@ var EdgeIdentityRecoveryManager = class {
4423
4428
  async recoverIdentityWithToken(ctx, fields) {
4424
4429
  invariant(this._edgeClient, "Not connected to EDGE.", {
4425
4430
  "~LogMeta": "~LogMeta",
4426
- F: __dxlog_file$31,
4431
+ F: __dxlog_file$33,
4427
4432
  L: 271,
4428
4433
  S: this,
4429
4434
  A: ["this._edgeClient", "'Not connected to EDGE.'"]
@@ -4452,7 +4457,7 @@ var EdgeIdentityRecoveryManager = class {
4452
4457
  async recoverIdentity(ctx, { recoveryCode }) {
4453
4458
  invariant(this._edgeClient, "Not connected to EDGE.", {
4454
4459
  "~LogMeta": "~LogMeta",
4455
- F: __dxlog_file$31,
4460
+ F: __dxlog_file$33,
4456
4461
  L: 301,
4457
4462
  S: this,
4458
4463
  A: ["this._edgeClient", "'Not connected to EDGE.'"]
@@ -4479,7 +4484,7 @@ var EdgeIdentityRecoveryManager = class {
4479
4484
  }
4480
4485
  log.info("recovering identity", response, {
4481
4486
  "~LogMeta": "~LogMeta",
4482
- F: __dxlog_file$31,
4487
+ F: __dxlog_file$33,
4483
4488
  L: 327,
4484
4489
  S: this
4485
4490
  });
@@ -4496,7 +4501,7 @@ var EdgeIdentityRecoveryManager = class {
4496
4501
  #acceptRecoveredIdentity(params) {
4497
4502
  invariant(this._acceptRecoveredIdentity, "acceptRecoveredIdentity not set", {
4498
4503
  "~LogMeta": "~LogMeta",
4499
- F: __dxlog_file$31,
4504
+ F: __dxlog_file$33,
4500
4505
  L: 341,
4501
4506
  S: this,
4502
4507
  A: ["this._acceptRecoveredIdentity", "'acceptRecoveredIdentity not set'"]
@@ -4517,7 +4522,7 @@ var EdgeIdentityRecoveryManagerLayer = () => Layer.effect(EdgeIdentityRecoveryMa
4517
4522
  }));
4518
4523
  //#endregion
4519
4524
  //#region src/internal/identity/identity-lifecycle.ts
4520
- var __dxlog_file$30 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-lifecycle.ts";
4525
+ var __dxlog_file$32 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-lifecycle.ts";
4521
4526
  var IdentityLifecycleLayer = Layer.effect(LifecycleService, Effect.gen(function* () {
4522
4527
  const identityManager = yield* ManagerService$2;
4523
4528
  const recoveryManager = yield* EdgeIdentityRecoveryManagerService;
@@ -4534,7 +4539,7 @@ var IdentityLifecycleLayer = Layer.effect(LifecycleService, Effect.gen(function*
4534
4539
  if (!identity) {
4535
4540
  log("no identity, skipping network join", void 0, {
4536
4541
  "~LogMeta": "~LogMeta",
4537
- F: __dxlog_file$30,
4542
+ F: __dxlog_file$32,
4538
4543
  L: 54,
4539
4544
  S: this
4540
4545
  });
@@ -4542,7 +4547,7 @@ var IdentityLifecycleLayer = Layer.effect(LifecycleService, Effect.gen(function*
4542
4547
  }
4543
4548
  log("joining network...", void 0, {
4544
4549
  "~LogMeta": "~LogMeta",
4545
- F: __dxlog_file$30,
4550
+ F: __dxlog_file$32,
4546
4551
  L: 57,
4547
4552
  S: this
4548
4553
  });
@@ -4561,7 +4566,7 @@ var createIdentityLifecycle = ({ identityManager, ctx: defaultCtx, runtime }) =>
4561
4566
  await emit(Hook.emit(IdentityAvailable, { identity }));
4562
4567
  log("identity created", { identityKey: identity.identityKey }, {
4563
4568
  "~LogMeta": "~LogMeta",
4564
- F: __dxlog_file$30,
4569
+ F: __dxlog_file$32,
4565
4570
  L: 83,
4566
4571
  S: void 0
4567
4572
  });
@@ -4579,7 +4584,7 @@ var createIdentityLifecycle = ({ identityManager, ctx: defaultCtx, runtime }) =>
4579
4584
  } catch (err) {
4580
4585
  await identity.close(ctx).catch((closeErr) => log.catch(closeErr, void 0, {
4581
4586
  "~LogMeta": "~LogMeta",
4582
- F: __dxlog_file$30,
4587
+ F: __dxlog_file$32,
4583
4588
  L: 95,
4584
4589
  S: void 0
4585
4590
  }));
@@ -4589,7 +4594,7 @@ var createIdentityLifecycle = ({ identityManager, ctx: defaultCtx, runtime }) =>
4589
4594
  await emit(Hook.emit(IdentityAvailable, { identity }));
4590
4595
  log("identity accepted", { identityKey: identity.identityKey }, {
4591
4596
  "~LogMeta": "~LogMeta",
4592
- F: __dxlog_file$30,
4597
+ F: __dxlog_file$32,
4593
4598
  L: 100,
4594
4599
  S: void 0
4595
4600
  });
@@ -4599,7 +4604,7 @@ var createIdentityLifecycle = ({ identityManager, ctx: defaultCtx, runtime }) =>
4599
4604
  };
4600
4605
  //#endregion
4601
4606
  //#region src/internal/identity/identity-manager.ts
4602
- var __dxlog_file$29 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-manager.ts";
4607
+ var __dxlog_file$31 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-manager.ts";
4603
4608
  var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
4604
4609
  var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
4605
4610
  /**
@@ -4633,7 +4638,7 @@ var IdentityManager = class {
4633
4638
  */
4634
4639
  _ctx = new Context(void 0, {
4635
4640
  "~LogMeta": "~LogMeta",
4636
- F: __dxlog_file$29,
4641
+ F: __dxlog_file$31,
4637
4642
  L: 160
4638
4643
  });
4639
4644
  constructor(params) {
@@ -4661,14 +4666,14 @@ var IdentityManager = class {
4661
4666
  async open(ctx) {
4662
4667
  log("opening identity manager", void 0, {
4663
4668
  "~LogMeta": "~LogMeta",
4664
- F: __dxlog_file$29,
4669
+ F: __dxlog_file$31,
4665
4670
  L: 192,
4666
4671
  S: this
4667
4672
  });
4668
4673
  const identityRecord = this._metadataStore.getIdentityRecord();
4669
4674
  log("identity record", { identityRecord }, {
4670
4675
  "~LogMeta": "~LogMeta",
4671
- F: __dxlog_file$29,
4676
+ F: __dxlog_file$31,
4672
4677
  L: 195,
4673
4678
  S: this
4674
4679
  });
@@ -4682,7 +4687,7 @@ var IdentityManager = class {
4682
4687
  displayName: this._identity.profileDocument?.displayName
4683
4688
  }, {
4684
4689
  "~LogMeta": "~LogMeta",
4685
- F: __dxlog_file$29,
4690
+ F: __dxlog_file$31,
4686
4691
  L: 201,
4687
4692
  S: this
4688
4693
  });
@@ -4690,7 +4695,7 @@ var IdentityManager = class {
4690
4695
  }
4691
4696
  log("opened identity manager", void 0, {
4692
4697
  "~LogMeta": "~LogMeta",
4693
- F: __dxlog_file$29,
4698
+ F: __dxlog_file$31,
4694
4699
  L: 208,
4695
4700
  S: this
4696
4701
  });
@@ -4709,7 +4714,7 @@ var IdentityManager = class {
4709
4714
  if (identity) {
4710
4715
  log("deleting identity", { identityKey: identity.identityKey }, {
4711
4716
  "~LogMeta": "~LogMeta",
4712
- F: __dxlog_file$29,
4717
+ F: __dxlog_file$31,
4713
4718
  L: 224,
4714
4719
  S: this
4715
4720
  });
@@ -4717,18 +4722,18 @@ var IdentityManager = class {
4717
4722
  await this._ctx.dispose();
4718
4723
  this._ctx = new Context(void 0, {
4719
4724
  "~LogMeta": "~LogMeta",
4720
- F: __dxlog_file$29,
4725
+ F: __dxlog_file$31,
4721
4726
  L: 228
4722
4727
  });
4723
4728
  await identity.close(ctx).catch((err) => log.warn("identity teardown failed; deleting anyway", { err }, {
4724
4729
  "~LogMeta": "~LogMeta",
4725
- F: __dxlog_file$29,
4730
+ F: __dxlog_file$31,
4726
4731
  L: 229,
4727
4732
  S: this
4728
4733
  }));
4729
4734
  } else log("no live identity to delete", void 0, {
4730
4735
  "~LogMeta": "~LogMeta",
4731
- F: __dxlog_file$29,
4736
+ F: __dxlog_file$31,
4732
4737
  L: 231,
4733
4738
  S: this
4734
4739
  });
@@ -4736,7 +4741,7 @@ var IdentityManager = class {
4736
4741
  this.stateUpdate.emit();
4737
4742
  log("deleted identity", void 0, {
4738
4743
  "~LogMeta": "~LogMeta",
4739
- F: __dxlog_file$29,
4744
+ F: __dxlog_file$31,
4740
4745
  L: 238,
4741
4746
  S: this
4742
4747
  });
@@ -4744,14 +4749,14 @@ var IdentityManager = class {
4744
4749
  async createIdentity({ profile, deviceProfile } = {}, ctx) {
4745
4750
  invariant(!this._identity, "Identity already exists.", {
4746
4751
  "~LogMeta": "~LogMeta",
4747
- F: __dxlog_file$29,
4752
+ F: __dxlog_file$31,
4748
4753
  L: 242,
4749
4754
  S: this,
4750
4755
  A: ["!this._identity", "'Identity already exists.'"]
4751
4756
  });
4752
4757
  log("creating identity...", void 0, {
4753
4758
  "~LogMeta": "~LogMeta",
4754
- F: __dxlog_file$29,
4759
+ F: __dxlog_file$31,
4755
4760
  L: 243,
4756
4761
  S: this
4757
4762
  });
@@ -4769,7 +4774,7 @@ var IdentityManager = class {
4769
4774
  const identity = await this._constructIdentity(identityRecord);
4770
4775
  await identity.open(ctx ?? Context.default(void 0, {
4771
4776
  "~LogMeta": "~LogMeta",
4772
- F: __dxlog_file$29,
4777
+ F: __dxlog_file$31,
4773
4778
  L: 258
4774
4779
  }));
4775
4780
  {
@@ -4778,7 +4783,7 @@ var IdentityManager = class {
4778
4783
  const haloSpace = identityRecord.haloSpace;
4779
4784
  invariant(haloSpace, "Halo space metadata is required.", {
4780
4785
  "~LogMeta": "~LogMeta",
4781
- F: __dxlog_file$29,
4786
+ F: __dxlog_file$31,
4782
4787
  L: 264,
4783
4788
  S: this,
4784
4789
  A: ["haloSpace", "'Halo space metadata is required.'"]
@@ -4802,7 +4807,7 @@ var IdentityManager = class {
4802
4807
  displayName: this._identity.profileDocument?.displayName
4803
4808
  }, {
4804
4809
  "~LogMeta": "~LogMeta",
4805
- F: __dxlog_file$29,
4810
+ F: __dxlog_file$31,
4806
4811
  L: 305,
4807
4812
  S: this
4808
4813
  });
@@ -4813,7 +4818,7 @@ var IdentityManager = class {
4813
4818
  profile: identity.profileDocument
4814
4819
  }, {
4815
4820
  "~LogMeta": "~LogMeta",
4816
- F: __dxlog_file$29,
4821
+ F: __dxlog_file$31,
4817
4822
  L: 311,
4818
4823
  S: this
4819
4824
  });
@@ -4843,13 +4848,13 @@ var IdentityManager = class {
4843
4848
  this._pendingHaloSpaceRootUrl = params.haloSpaceRootUrl;
4844
4849
  log("accepting identity", { params }, {
4845
4850
  "~LogMeta": "~LogMeta",
4846
- F: __dxlog_file$29,
4851
+ F: __dxlog_file$31,
4847
4852
  L: 355,
4848
4853
  S: this
4849
4854
  });
4850
4855
  invariant(!this._identity, "Identity already exists.", {
4851
4856
  "~LogMeta": "~LogMeta",
4852
- F: __dxlog_file$29,
4857
+ F: __dxlog_file$31,
4853
4858
  L: 356,
4854
4859
  S: this,
4855
4860
  A: ["!this._identity", "'Identity already exists.'"]
@@ -4868,7 +4873,7 @@ var IdentityManager = class {
4868
4873
  const identity = await this._constructIdentity(identityRecord);
4869
4874
  await identity.open(ctx ?? Context.default(void 0, {
4870
4875
  "~LogMeta": "~LogMeta",
4871
- F: __dxlog_file$29,
4876
+ F: __dxlog_file$31,
4872
4877
  L: 370
4873
4878
  }));
4874
4879
  return {
@@ -4888,7 +4893,7 @@ var IdentityManager = class {
4888
4893
  displayName: this._identity.profileDocument?.displayName
4889
4894
  }, {
4890
4895
  "~LogMeta": "~LogMeta",
4891
- F: __dxlog_file$29,
4896
+ F: __dxlog_file$31,
4892
4897
  L: 388,
4893
4898
  S: this
4894
4899
  });
@@ -4903,7 +4908,7 @@ var IdentityManager = class {
4903
4908
  deviceKey: identity.deviceKey
4904
4909
  }, {
4905
4910
  "~LogMeta": "~LogMeta",
4906
- F: __dxlog_file$29,
4911
+ F: __dxlog_file$31,
4907
4912
  L: 400,
4908
4913
  S: this
4909
4914
  });
@@ -4914,7 +4919,7 @@ var IdentityManager = class {
4914
4919
  async updateProfile(profile) {
4915
4920
  invariant(this._identity, "Identity not initialized.", {
4916
4921
  "~LogMeta": "~LogMeta",
4917
- F: __dxlog_file$29,
4922
+ F: __dxlog_file$31,
4918
4923
  L: 407,
4919
4924
  S: this,
4920
4925
  A: ["this._identity", "'Identity not initialized.'"]
@@ -4931,7 +4936,7 @@ var IdentityManager = class {
4931
4936
  async updateDeviceProfile(profile) {
4932
4937
  invariant(this._identity, "Identity not initialized.", {
4933
4938
  "~LogMeta": "~LogMeta",
4934
- F: __dxlog_file$29,
4939
+ F: __dxlog_file$31,
4935
4940
  L: 421,
4936
4941
  S: this,
4937
4942
  A: ["this._identity", "'Identity not initialized.'"]
@@ -4953,14 +4958,14 @@ var IdentityManager = class {
4953
4958
  async _constructIdentity(identityRecord) {
4954
4959
  invariant(!this._identity, void 0, {
4955
4960
  "~LogMeta": "~LogMeta",
4956
- F: __dxlog_file$29,
4961
+ F: __dxlog_file$31,
4957
4962
  L: 444,
4958
4963
  S: this,
4959
4964
  A: ["!this._identity", ""]
4960
4965
  });
4961
4966
  log("constructing identity", { identityRecord }, {
4962
4967
  "~LogMeta": "~LogMeta",
4963
- F: __dxlog_file$29,
4968
+ F: __dxlog_file$31,
4964
4969
  L: 445,
4965
4970
  S: this
4966
4971
  });
@@ -4969,7 +4974,7 @@ var IdentityManager = class {
4969
4974
  const haloSpace = identityRecord.haloSpace;
4970
4975
  invariant(haloSpace, "Halo space metadata is required.", {
4971
4976
  "~LogMeta": "~LogMeta",
4972
- F: __dxlog_file$29,
4977
+ F: __dxlog_file$31,
4973
4978
  L: 450,
4974
4979
  S: this,
4975
4980
  A: ["haloSpace", "'Halo space metadata is required.'"]
@@ -5012,7 +5017,7 @@ var IdentityManager = class {
5012
5017
  });
5013
5018
  log("done", { identityKey }, {
5014
5019
  "~LogMeta": "~LogMeta",
5015
- F: __dxlog_file$29,
5020
+ F: __dxlog_file$31,
5016
5021
  L: 496,
5017
5022
  S: this
5018
5023
  });
@@ -5044,7 +5049,7 @@ var IdentityManager = class {
5044
5049
  err
5045
5050
  }, {
5046
5051
  "~LogMeta": "~LogMeta",
5047
- F: __dxlog_file$29,
5052
+ F: __dxlog_file$31,
5048
5053
  L: 533,
5049
5054
  S: this
5050
5055
  });
@@ -5059,7 +5064,7 @@ var IdentityManager = class {
5059
5064
  refs
5060
5065
  }, {
5061
5066
  "~LogMeta": "~LogMeta",
5062
- F: __dxlog_file$29,
5067
+ F: __dxlog_file$31,
5063
5068
  L: 548,
5064
5069
  S: this
5065
5070
  });
@@ -5077,7 +5082,7 @@ var IdentityManager = class {
5077
5082
  err
5078
5083
  }, {
5079
5084
  "~LogMeta": "~LogMeta",
5080
- F: __dxlog_file$29,
5085
+ F: __dxlog_file$31,
5081
5086
  L: 567,
5082
5087
  S: this
5083
5088
  });
@@ -5096,7 +5101,7 @@ var IdentityManager = class {
5096
5101
  onAuthFailure: () => {
5097
5102
  log.warn("auth failure", void 0, {
5098
5103
  "~LogMeta": "~LogMeta",
5099
- F: __dxlog_file$29,
5104
+ F: __dxlog_file$31,
5100
5105
  L: 585,
5101
5106
  S: this
5102
5107
  });
@@ -5128,7 +5133,7 @@ var IdentityManagerLayer = (options = {}) => Layer.effect(ManagerService$2, Effe
5128
5133
  const ctx = yield* EffectEx.contextFromScope();
5129
5134
  yield* Effect.addFinalizer(() => Effect.promise(() => identityManager.close(Context.default(void 0, {
5130
5135
  "~LogMeta": "~LogMeta",
5131
- F: __dxlog_file$29,
5136
+ F: __dxlog_file$31,
5132
5137
  L: 627
5133
5138
  }))));
5134
5139
  yield* Hook.on(StorageReady, Effect.fn("IdentityManager.onStorageReady")(function* () {
@@ -5143,9 +5148,9 @@ var IdentityManagerLayer = (options = {}) => Layer.effect(ManagerService$2, Effe
5143
5148
  * Hypercore file-storage migrations, keyed `<id>_<name>` as `Migrator.fromRecord` expects. Ids must only ever increase,
5144
5149
  * and an applied migration must never be edited — nothing verifies its contents.
5145
5150
  */
5146
- var MIGRATIONS = { "0001_init": SqlMigrations.apply("--\n-- Hypercore file storage. Equivalent to the DDL this store created inline before migrations existed, so a database\n-- from an earlier release applies it as a no-op — `IF NOT EXISTS` is what makes that true.\n--\n-- Immutable: recorded in `hypercore_files_migrations` and never re-run.\n--\nCREATE TABLE IF NOT EXISTS hypercore_files (\n path TEXT PRIMARY KEY,\n data BLOB NOT NULL DEFAULT x''\n);\n") };
5151
+ var MIGRATIONS$1 = { "0001_init": SqlMigrations.apply("--\n-- Hypercore file storage. Equivalent to the DDL this store created inline before migrations existed, so a database\n-- from an earlier release applies it as a no-op — `IF NOT EXISTS` is what makes that true.\n--\n-- Immutable: recorded in `hypercore_files_migrations` and never re-run.\n--\nCREATE TABLE IF NOT EXISTS hypercore_files (\n path TEXT PRIMARY KEY,\n data BLOB NOT NULL DEFAULT x''\n);\n") };
5147
5152
  /** Own history table per store, since many stores share the client database. */
5148
- var MIGRATIONS_TABLE = "hypercore_files_migrations";
5153
+ var MIGRATIONS_TABLE$1 = "hypercore_files_migrations";
5149
5154
  //#endregion
5150
5155
  //#region src/SqliteStorage.ts
5151
5156
  var SqliteStorage_exports = /* @__PURE__ */ __exportAll({
@@ -5156,7 +5161,7 @@ var SqliteStorage_exports = /* @__PURE__ */ __exportAll({
5156
5161
  isClosedConnectionError: () => isClosedConnectionError,
5157
5162
  wipeSqliteStorage: () => wipeSqliteStorage
5158
5163
  });
5159
- var __dxlog_file$28 = "/__w/dxos/dxos/packages/sdk/client-services/src/SqliteStorage.ts";
5164
+ var __dxlog_file$30 = "/__w/dxos/dxos/packages/sdk/client-services/src/SqliteStorage.ts";
5160
5165
  /**
5161
5166
  * True when a rejected SQL op failed because its connection was already closed — the message
5162
5167
  * `The database connection is not open` (raised by `@effect/sql-sqlite-node`), which arrives
@@ -5387,8 +5392,8 @@ var SqliteStorage = class {
5387
5392
  * Applies any migrations this database has not recorded yet.
5388
5393
  */
5389
5394
  migrate = Migrator.make({})({
5390
- loader: Migrator.fromRecord(MIGRATIONS),
5391
- table: MIGRATIONS_TABLE
5395
+ loader: Migrator.fromRecord(MIGRATIONS$1),
5396
+ table: MIGRATIONS_TABLE$1
5392
5397
  }).pipe(Effect.catchTag("MigrationError", (error) => Effect.die(error)), Effect.asVoid, Effect.withSpan("SqliteStorage.migrate"));
5393
5398
  get size() {
5394
5399
  return this.#files.size;
@@ -5432,7 +5437,7 @@ var SqliteStorage = class {
5432
5437
  async reset() {
5433
5438
  log("SqliteStorage: clearing all hypercore files", void 0, {
5434
5439
  "~LogMeta": "~LogMeta",
5435
- F: __dxlog_file$28,
5440
+ F: __dxlog_file$30,
5436
5441
  L: 442,
5437
5442
  S: this
5438
5443
  });
@@ -5486,7 +5491,7 @@ var wipeSqliteStorage = Effect.gen(function* () {
5486
5491
  });
5487
5492
  //#endregion
5488
5493
  //#region src/internal/identity/identity-service.ts
5489
- var __dxlog_file$27 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-service.ts";
5494
+ var __dxlog_file$29 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/identity-service.ts";
5490
5495
  var IdentityServiceImpl = class extends Resource {
5491
5496
  _identityManager;
5492
5497
  _recoveryManager;
@@ -5510,7 +5515,7 @@ var IdentityServiceImpl = class extends Resource {
5510
5515
  try: async () => {
5511
5516
  const ctx = Context.default(void 0, {
5512
5517
  "~LogMeta": "~LogMeta",
5513
- F: __dxlog_file$27,
5518
+ F: __dxlog_file$29,
5514
5519
  L: 60
5515
5520
  });
5516
5521
  await this._createIdentity({
@@ -5538,7 +5543,7 @@ var IdentityServiceImpl = class extends Resource {
5538
5543
  try: async () => {
5539
5544
  invariant(this._identityManager.identity, "Identity not initialized.", {
5540
5545
  "~LogMeta": "~LogMeta",
5541
- F: __dxlog_file$27,
5546
+ F: __dxlog_file$29,
5542
5547
  L: 92,
5543
5548
  S: this,
5544
5549
  A: ["this._identityManager.identity", "'Identity not initialized.'"]
@@ -5566,7 +5571,7 @@ var IdentityServiceImpl = class extends Resource {
5566
5571
  return Effect.tryPromise({
5567
5572
  try: async () => this._recoveryManager.requestRecoveryChallenge(Context.default(void 0, {
5568
5573
  "~LogMeta": "~LogMeta",
5569
- F: __dxlog_file$27,
5574
+ F: __dxlog_file$29,
5570
5575
  L: 124
5571
5576
  })),
5572
5577
  catch: toServiceError
@@ -5577,7 +5582,7 @@ var IdentityServiceImpl = class extends Resource {
5577
5582
  try: async () => {
5578
5583
  const ctx = Context.default(void 0, {
5579
5584
  "~LogMeta": "~LogMeta",
5580
- F: __dxlog_file$27,
5585
+ F: __dxlog_file$29,
5581
5586
  L: 132
5582
5587
  });
5583
5588
  switch (request.request.case) {
@@ -5611,7 +5616,7 @@ var IdentityServiceImpl = class extends Resource {
5611
5616
  try: async () => {
5612
5617
  const ctx = Context.default(void 0, {
5613
5618
  "~LogMeta": "~LogMeta",
5614
- F: __dxlog_file$27,
5619
+ F: __dxlog_file$29,
5615
5620
  L: 166
5616
5621
  });
5617
5622
  await this._dataSpaceManager.deleteAllSpaces(ctx);
@@ -5627,7 +5632,7 @@ var IdentityServiceImpl = class extends Resource {
5627
5632
  const { presentation, nonce } = request;
5628
5633
  invariant(this._identityManager.identity, "Identity not initialized.", {
5629
5634
  "~LogMeta": "~LogMeta",
5630
- F: __dxlog_file$27,
5635
+ F: __dxlog_file$29,
5631
5636
  L: 185,
5632
5637
  S: this,
5633
5638
  A: ["this._identityManager.identity", "'Identity not initialized.'"]
@@ -5649,7 +5654,7 @@ var IdentityServiceImpl = class extends Resource {
5649
5654
  const identity = this._identityManager.identity;
5650
5655
  invariant(identity, "Identity not initialized.", {
5651
5656
  "~LogMeta": "~LogMeta",
5652
- F: __dxlog_file$27,
5657
+ F: __dxlog_file$29,
5653
5658
  L: 204,
5654
5659
  S: this,
5655
5660
  A: ["identity", "'Identity not initialized.'"]
@@ -5690,7 +5695,7 @@ var IdentityServiceLayer = Layer.effect(IdentityService.Tag, Effect.gen(function
5690
5695
  }));
5691
5696
  //#endregion
5692
5697
  //#region src/internal/identity/inbox-service.ts
5693
- var __dxlog_file$26 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/inbox-service.ts";
5698
+ var __dxlog_file$28 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/identity/inbox-service.ts";
5694
5699
  var InboxUnavailableError = class extends BaseError.extend("InboxUnavailableError", "The inbox is not available until the identity is ready and connected.") {};
5695
5700
  var DEFAULT_POLL_INTERVAL_MS = 3e5;
5696
5701
  /** Payload types this client surfaces; envelopes of any other type stay pending for a newer client. */
@@ -5763,7 +5768,7 @@ var InboxServiceImpl = class {
5763
5768
  const recipientDid = await createDidFromIdentityKey(request.recipientIdentityKey);
5764
5769
  await this._edgeClient.sendInboxMessage(Context.default(void 0, {
5765
5770
  "~LogMeta": "~LogMeta",
5766
- F: __dxlog_file$26,
5771
+ F: __dxlog_file$28,
5767
5772
  L: 173
5768
5773
  }), recipientDid, payload).catch((error) => {
5769
5774
  throw isAccountRequired(error) ? new InboxAccountRequiredError({ cause: error }) : error;
@@ -5791,7 +5796,7 @@ var InboxServiceImpl = class {
5791
5796
  if (!this._edgeClient) throw new InboxUnavailableError();
5792
5797
  await this._edgeClient.ackInbox(Context.default(void 0, {
5793
5798
  "~LogMeta": "~LogMeta",
5794
- F: __dxlog_file$26,
5799
+ F: __dxlog_file$28,
5795
5800
  L: 205
5796
5801
  }), edgeIds);
5797
5802
  edgeIds.forEach((id) => this.#acked.add(id));
@@ -5812,7 +5817,7 @@ var InboxServiceImpl = class {
5812
5817
  if (this.#subscribers > 1 || !this._edgeClient) return;
5813
5818
  const ctx = new Context(void 0, {
5814
5819
  "~LogMeta": "~LogMeta",
5815
- F: __dxlog_file$26,
5820
+ F: __dxlog_file$28,
5816
5821
  L: 229
5817
5822
  });
5818
5823
  const scheduler = new UpdateScheduler(ctx, () => this.#pull(ctx));
@@ -5859,7 +5864,7 @@ var InboxServiceImpl = class {
5859
5864
  }
5860
5865
  log("inbox pull failed", { error }, {
5861
5866
  "~LogMeta": "~LogMeta",
5862
- F: __dxlog_file$26,
5867
+ F: __dxlog_file$28,
5863
5868
  L: 286,
5864
5869
  S: this
5865
5870
  });
@@ -5878,7 +5883,7 @@ var InboxServiceImpl = class {
5878
5883
  reason: result.reason
5879
5884
  }, {
5880
5885
  "~LogMeta": "~LogMeta",
5881
- F: __dxlog_file$26,
5886
+ F: __dxlog_file$28,
5882
5887
  L: 300,
5883
5888
  S: this
5884
5889
  });
@@ -5900,7 +5905,7 @@ var InboxServiceImpl = class {
5900
5905
  this.#publish();
5901
5906
  if (rejected.length > 0) await edgeClient.ackInbox(ctx, rejected).catch((error) => log("inbox ack of rejected messages failed", { error }, {
5902
5907
  "~LogMeta": "~LogMeta",
5903
- F: __dxlog_file$26,
5908
+ F: __dxlog_file$28,
5904
5909
  L: 331,
5905
5910
  S: this
5906
5911
  }));
@@ -5971,7 +5976,7 @@ var InboxServiceLayer = ({ relay } = {}) => Layer.effect(InboxService.Tag, Effec
5971
5976
  }));
5972
5977
  //#endregion
5973
5978
  //#region src/internal/invitations/device-invitation-protocol.ts
5974
- var __dxlog_file$25 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/device-invitation-protocol.ts";
5979
+ var __dxlog_file$27 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/device-invitation-protocol.ts";
5975
5980
  var DeviceInvitationProtocol = class {
5976
5981
  _keyring;
5977
5982
  _getIdentity;
@@ -5997,7 +6002,7 @@ var DeviceInvitationProtocol = class {
5997
6002
  async admit(_, request) {
5998
6003
  invariant(request.kind.case === "device", void 0, {
5999
6004
  "~LogMeta": "~LogMeta",
6000
- F: __dxlog_file$25,
6005
+ F: __dxlog_file$27,
6001
6006
  L: 63,
6002
6007
  S: this,
6003
6008
  A: ["request.kind.case === 'device'", ""]
@@ -6006,7 +6011,7 @@ var DeviceInvitationProtocol = class {
6006
6011
  const credential = await identity.admitDevice(request.kind.value);
6007
6012
  invariant(getCredentialAssertion(credential).$typeName === "dxos.halo.credentials.AuthorizedDevice", "Invalid credential", {
6008
6013
  "~LogMeta": "~LogMeta",
6009
- F: __dxlog_file$25,
6014
+ F: __dxlog_file$27,
6010
6015
  L: 66,
6011
6016
  S: this,
6012
6017
  A: ["getCredentialAssertion(credential).$typeName === 'dxos.halo.credentials.AuthorizedDevice'", "'Invalid credential'"]
@@ -6048,7 +6053,7 @@ var DeviceInvitationProtocol = class {
6048
6053
  async accept(_ctx, response, request) {
6049
6054
  invariant(response.kind.case === "device", void 0, {
6050
6055
  "~LogMeta": "~LogMeta",
6051
- F: __dxlog_file$25,
6056
+ F: __dxlog_file$27,
6052
6057
  L: 121,
6053
6058
  S: this,
6054
6059
  A: ["response.kind.case === 'device'", ""]
@@ -6056,7 +6061,7 @@ var DeviceInvitationProtocol = class {
6056
6061
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe, haloSpaceRootUrl, credential } = response.kind.value;
6057
6062
  invariant(request.kind.case === "device", void 0, {
6058
6063
  "~LogMeta": "~LogMeta",
6059
- F: __dxlog_file$25,
6064
+ F: __dxlog_file$27,
6060
6065
  L: 125,
6061
6066
  S: this,
6062
6067
  A: ["request.kind.case === 'device'", ""]
@@ -6064,7 +6069,7 @@ var DeviceInvitationProtocol = class {
6064
6069
  const { deviceKey, controlFeedKey, dataFeedKey, profile } = request.kind.value;
6065
6070
  invariant(credential, "Admission carries no credential.", {
6066
6071
  "~LogMeta": "~LogMeta",
6067
- F: __dxlog_file$25,
6072
+ F: __dxlog_file$27,
6068
6073
  L: 131,
6069
6074
  S: this,
6070
6075
  A: ["credential", "'Admission carries no credential.'"]
@@ -6122,7 +6127,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
6122
6127
  var toSpaceMemberRole = (role) => role ?? SpaceMember_Role.ADMIN;
6123
6128
  //#endregion
6124
6129
  //#region src/internal/invitations/space-invitation-protocol.ts
6125
- var __dxlog_file$24 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/space-invitation-protocol.ts";
6130
+ var __dxlog_file$26 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/space-invitation-protocol.ts";
6126
6131
  var SpaceInvitationProtocol = class {
6127
6132
  _spaceManager;
6128
6133
  _signingContext;
@@ -6150,7 +6155,7 @@ var SpaceInvitationProtocol = class {
6150
6155
  getInvitationContext() {
6151
6156
  invariant(this._spaceKey, void 0, {
6152
6157
  "~LogMeta": "~LogMeta",
6153
- F: __dxlog_file$24,
6158
+ F: __dxlog_file$26,
6154
6159
  L: 84,
6155
6160
  S: this,
6156
6161
  A: ["this._spaceKey", ""]
@@ -6158,7 +6163,7 @@ var SpaceInvitationProtocol = class {
6158
6163
  const space = this._spaceManager.spaces.get(this._spaceKey);
6159
6164
  invariant(space, void 0, {
6160
6165
  "~LogMeta": "~LogMeta",
6161
- F: __dxlog_file$24,
6166
+ F: __dxlog_file$26,
6162
6167
  L: 86,
6163
6168
  S: this,
6164
6169
  A: ["space", ""]
@@ -6172,7 +6177,7 @@ var SpaceInvitationProtocol = class {
6172
6177
  async admit(invitation, request, guestProfile) {
6173
6178
  invariant(this._spaceKey && request.kind.case === "space", void 0, {
6174
6179
  "~LogMeta": "~LogMeta",
6175
- F: __dxlog_file$24,
6180
+ F: __dxlog_file$26,
6176
6181
  L: 99,
6177
6182
  S: this,
6178
6183
  A: ["this._spaceKey && request.kind.case === 'space'", ""]
@@ -6183,7 +6188,7 @@ var SpaceInvitationProtocol = class {
6183
6188
  guest: spaceRequest.deviceKey
6184
6189
  }, {
6185
6190
  "~LogMeta": "~LogMeta",
6186
- F: __dxlog_file$24,
6191
+ F: __dxlog_file$26,
6187
6192
  L: 101,
6188
6193
  S: this
6189
6194
  });
@@ -6206,7 +6211,7 @@ var SpaceInvitationProtocol = class {
6206
6211
  async delegate(invitation) {
6207
6212
  invariant(this._spaceKey, void 0, {
6208
6213
  "~LogMeta": "~LogMeta",
6209
- F: __dxlog_file$24,
6214
+ F: __dxlog_file$26,
6210
6215
  L: 125,
6211
6216
  S: this,
6212
6217
  A: ["this._spaceKey", ""]
@@ -6214,14 +6219,14 @@ var SpaceInvitationProtocol = class {
6214
6219
  const space = this._spaceManager.spaces.get(this._spaceKey);
6215
6220
  invariant(space, void 0, {
6216
6221
  "~LogMeta": "~LogMeta",
6217
- F: __dxlog_file$24,
6222
+ F: __dxlog_file$26,
6218
6223
  L: 127,
6219
6224
  S: this,
6220
6225
  A: ["space", ""]
6221
6226
  });
6222
6227
  if (invitation.authMethod === Invitation_AuthMethod.KNOWN_PUBLIC_KEY) invariant(invitation.guestKeypair?.publicKey, void 0, {
6223
6228
  "~LogMeta": "~LogMeta",
6224
- F: __dxlog_file$24,
6229
+ F: __dxlog_file$26,
6225
6230
  L: 129,
6226
6231
  S: this,
6227
6232
  A: ["invitation.guestKeypair?.publicKey", ""]
@@ -6231,14 +6236,14 @@ var SpaceInvitationProtocol = class {
6231
6236
  id: invitation.invitationId
6232
6237
  }, {
6233
6238
  "~LogMeta": "~LogMeta",
6234
- F: __dxlog_file$24,
6239
+ F: __dxlog_file$26,
6235
6240
  L: 132,
6236
6241
  S: this
6237
6242
  });
6238
6243
  const swarmKey = toPublicKey(invitation.swarmKey);
6239
6244
  invariant(swarmKey, "swarmKey missing in the invitation", {
6240
6245
  "~LogMeta": "~LogMeta",
6241
- F: __dxlog_file$24,
6246
+ F: __dxlog_file$26,
6242
6247
  L: 134,
6243
6248
  S: this,
6244
6249
  A: ["swarmKey", "'swarmKey missing in the invitation'"]
@@ -6259,14 +6264,14 @@ var SpaceInvitationProtocol = class {
6259
6264
  async cancelDelegation(invitation) {
6260
6265
  invariant(this._spaceKey, void 0, {
6261
6266
  "~LogMeta": "~LogMeta",
6262
- F: __dxlog_file$24,
6267
+ F: __dxlog_file$26,
6263
6268
  L: 158,
6264
6269
  S: this,
6265
6270
  A: ["this._spaceKey", ""]
6266
6271
  });
6267
6272
  invariant(invitation.type === Invitation_Type.DELEGATED && invitation.delegationCredentialId, void 0, {
6268
6273
  "~LogMeta": "~LogMeta",
6269
- F: __dxlog_file$24,
6274
+ F: __dxlog_file$26,
6270
6275
  L: 159,
6271
6276
  S: this,
6272
6277
  A: ["invitation.type === Invitation_Type.DELEGATED && invitation.delegationCredentialId", ""]
@@ -6274,7 +6279,7 @@ var SpaceInvitationProtocol = class {
6274
6279
  const delegationCredentialId = toPublicKey(invitation.delegationCredentialId);
6275
6280
  invariant(delegationCredentialId, void 0, {
6276
6281
  "~LogMeta": "~LogMeta",
6277
- F: __dxlog_file$24,
6282
+ F: __dxlog_file$26,
6278
6283
  L: 161,
6279
6284
  S: this,
6280
6285
  A: ["delegationCredentialId", ""]
@@ -6282,7 +6287,7 @@ var SpaceInvitationProtocol = class {
6282
6287
  const space = this._spaceManager.spaces.get(this._spaceKey);
6283
6288
  invariant(space, void 0, {
6284
6289
  "~LogMeta": "~LogMeta",
6285
- F: __dxlog_file$24,
6290
+ F: __dxlog_file$26,
6286
6291
  L: 163,
6287
6292
  S: this,
6288
6293
  A: ["space", ""]
@@ -6292,7 +6297,7 @@ var SpaceInvitationProtocol = class {
6292
6297
  id: invitation.invitationId
6293
6298
  }, {
6294
6299
  "~LogMeta": "~LogMeta",
6295
- F: __dxlog_file$24,
6300
+ F: __dxlog_file$26,
6296
6301
  L: 165,
6297
6302
  S: this
6298
6303
  });
@@ -6323,7 +6328,7 @@ var SpaceInvitationProtocol = class {
6323
6328
  async accept(ctx, response) {
6324
6329
  invariant(response.kind.case === "space", void 0, {
6325
6330
  "~LogMeta": "~LogMeta",
6326
- F: __dxlog_file$24,
6331
+ F: __dxlog_file$26,
6327
6332
  L: 208,
6328
6333
  S: this,
6329
6334
  A: ["response.kind.case === 'space'", ""]
@@ -6331,7 +6336,7 @@ var SpaceInvitationProtocol = class {
6331
6336
  const { credential, controlTimeframe, dataTimeframe } = response.kind.value;
6332
6337
  invariant(credential, "Admission carries no credential.", {
6333
6338
  "~LogMeta": "~LogMeta",
6334
- F: __dxlog_file$24,
6339
+ F: __dxlog_file$26,
6335
6340
  L: 210,
6336
6341
  S: this,
6337
6342
  A: ["credential", "'Admission carries no credential.'"]
@@ -6339,14 +6344,14 @@ var SpaceInvitationProtocol = class {
6339
6344
  const assertion = getCredentialAssertion(credential);
6340
6345
  invariant(assertion.$typeName === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
6341
6346
  "~LogMeta": "~LogMeta",
6342
- F: __dxlog_file$24,
6347
+ F: __dxlog_file$26,
6343
6348
  L: 212,
6344
6349
  S: this,
6345
6350
  A: ["assertion.$typeName === 'dxos.halo.credentials.SpaceMember'", "'Invalid credential'"]
6346
6351
  });
6347
6352
  invariant(requirePublicKey(credential.subject?.id).equals(this._signingContext.identityKey), void 0, {
6348
6353
  "~LogMeta": "~LogMeta",
6349
- F: __dxlog_file$24,
6354
+ F: __dxlog_file$26,
6350
6355
  L: 213,
6351
6356
  S: this,
6352
6357
  A: ["requirePublicKey(credential.subject?.id).equals(this._signingContext.identityKey)", ""]
@@ -6367,7 +6372,7 @@ var SpaceInvitationProtocol = class {
6367
6372
  };
6368
6373
  //#endregion
6369
6374
  //#region src/internal/invitations/invitation-factories.ts
6370
- var __dxlog_file$23 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-factories.ts";
6375
+ var __dxlog_file$25 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-factories.ts";
6371
6376
  /**
6372
6377
  * Wires the per-kind invitation protocol factories into the invitations manager. Sits above the
6373
6378
  * data space manager because the space protocol needs it, while the manager itself is below.
@@ -6385,7 +6390,7 @@ var InvitationFactoriesLayer = Layer.effectDiscard(Effect.gen(function* () {
6385
6390
  const factory = factories.get(invitation.kind);
6386
6391
  invariant(factory, `Unknown invitation kind: ${invitation.kind}`, {
6387
6392
  "~LogMeta": "~LogMeta",
6388
- F: __dxlog_file$23,
6393
+ F: __dxlog_file$25,
6389
6394
  L: 70,
6390
6395
  S: this,
6391
6396
  A: ["factory", "`Unknown invitation kind: ${invitation.kind}`"]
@@ -6395,7 +6400,7 @@ var InvitationFactoriesLayer = Layer.effectDiscard(Effect.gen(function* () {
6395
6400
  }));
6396
6401
  //#endregion
6397
6402
  //#region src/internal/invitations/edge-invitation-handler.ts
6398
- var __dxlog_file$22 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/edge-invitation-handler.ts";
6403
+ var __dxlog_file$24 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/edge-invitation-handler.ts";
6399
6404
  var EdgeInvitationHandler = class {
6400
6405
  _client;
6401
6406
  _callbacks;
@@ -6412,7 +6417,7 @@ var EdgeInvitationHandler = class {
6412
6417
  if (!this._client) {
6413
6418
  log("edge disabled", void 0, {
6414
6419
  "~LogMeta": "~LogMeta",
6415
- F: __dxlog_file$22,
6420
+ F: __dxlog_file$24,
6416
6421
  L: 77,
6417
6422
  S: this
6418
6423
  });
@@ -6423,7 +6428,7 @@ var EdgeInvitationHandler = class {
6423
6428
  if (!(invitation.authMethod !== Invitation_AuthMethod.SHARED_SECRET && invitation.type === Invitation_Type.DELEGATED && invitation.kind === Invitation_Kind.SPACE && spaceId != null && SpaceId.isValid(spaceId))) {
6424
6429
  log("invitation could not be handled by edge", { invitation }, {
6425
6430
  "~LogMeta": "~LogMeta",
6426
- F: __dxlog_file$22,
6431
+ F: __dxlog_file$24,
6427
6432
  L: 91,
6428
6433
  S: this
6429
6434
  });
@@ -6449,7 +6454,7 @@ var EdgeInvitationHandler = class {
6449
6454
  after: error.retryAfterMs ?? this._calculateNextRetryMs()
6450
6455
  }, {
6451
6456
  "~LogMeta": "~LogMeta",
6452
- F: __dxlog_file$22,
6457
+ F: __dxlog_file$24,
6453
6458
  L: 110,
6454
6459
  S: this
6455
6460
  });
@@ -6457,7 +6462,7 @@ var EdgeInvitationHandler = class {
6457
6462
  } else if (requestCount < 5) {
6458
6463
  log.info("failed to handle invitation with edge", { error }, {
6459
6464
  "~LogMeta": "~LogMeta",
6460
- F: __dxlog_file$22,
6465
+ F: __dxlog_file$24,
6461
6466
  L: 119,
6462
6467
  S: this
6463
6468
  });
@@ -6472,14 +6477,14 @@ var EdgeInvitationHandler = class {
6472
6477
  try {
6473
6478
  log("edge invitation flow", void 0, {
6474
6479
  "~LogMeta": "~LogMeta",
6475
- F: __dxlog_file$22,
6480
+ F: __dxlog_file$24,
6476
6481
  L: 136,
6477
6482
  S: this
6478
6483
  });
6479
6484
  this._flowLock = await tryAcquireBeforeContextDisposed(ctx, guardedState.mutex);
6480
6485
  log.verbose("edge invitation flow acquired the lock", void 0, {
6481
6486
  "~LogMeta": "~LogMeta",
6482
- F: __dxlog_file$22,
6487
+ F: __dxlog_file$24,
6483
6488
  L: 138,
6484
6489
  S: this
6485
6490
  });
@@ -6511,7 +6516,7 @@ var EdgeInvitationHandler = class {
6511
6516
  async _joinSpaceByInvitation(ctx, guardedState, spaceId, request) {
6512
6517
  invariant(this._client, void 0, {
6513
6518
  "~LogMeta": "~LogMeta",
6514
- F: __dxlog_file$22,
6519
+ F: __dxlog_file$24,
6515
6520
  L: 180,
6516
6521
  S: this,
6517
6522
  A: ["this._client", ""]
@@ -6541,7 +6546,7 @@ var EdgeInvitationHandler = class {
6541
6546
  __decorate([trace.span({ op: "invitation.edge" })], EdgeInvitationHandler.prototype, "_handleSpaceInvitationFlow", null);
6542
6547
  //#endregion
6543
6548
  //#region src/internal/invitations/invitation-guest-extenstion.ts
6544
- var __dxlog_file$21 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-guest-extenstion.ts";
6549
+ var __dxlog_file$23 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-guest-extenstion.ts";
6545
6550
  var OPTIONS_TIMEOUT$1 = 1e4;
6546
6551
  /**
6547
6552
  * Guest's side for a connection to a concrete peer in p2p network during invitation.
@@ -6551,7 +6556,7 @@ var InvitationGuestExtension = class extends RpcExtension {
6551
6556
  _callbacks;
6552
6557
  _ctx = new Context(void 0, {
6553
6558
  "~LogMeta": "~LogMeta",
6554
- F: __dxlog_file$21,
6559
+ F: __dxlog_file$23,
6555
6560
  L: 48
6556
6561
  });
6557
6562
  _remoteOptions;
@@ -6576,7 +6581,7 @@ var InvitationGuestExtension = class extends RpcExtension {
6576
6581
  options: async (options) => {
6577
6582
  invariant(!this._remoteOptions, "Remote options already set.", {
6578
6583
  "~LogMeta": "~LogMeta",
6579
- F: __dxlog_file$21,
6584
+ F: __dxlog_file$23,
6580
6585
  L: 78,
6581
6586
  S: this,
6582
6587
  A: ["!this._remoteOptions", "'Remote options already set.'"]
@@ -6601,28 +6606,28 @@ var InvitationGuestExtension = class extends RpcExtension {
6601
6606
  try {
6602
6607
  log.verbose("guest acquire lock", void 0, {
6603
6608
  "~LogMeta": "~LogMeta",
6604
- F: __dxlog_file$21,
6609
+ F: __dxlog_file$23,
6605
6610
  L: 100,
6606
6611
  S: this
6607
6612
  });
6608
6613
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
6609
6614
  log.verbose("guest lock acquired", void 0, {
6610
6615
  "~LogMeta": "~LogMeta",
6611
- F: __dxlog_file$21,
6616
+ F: __dxlog_file$23,
6612
6617
  L: 102,
6613
6618
  S: this
6614
6619
  });
6615
6620
  await cancelWithContext(this._ctx, this.rpc.InvitationHostService.options(create(InvitationOptionsSchema, { role: InvitationOptions_Role.GUEST })));
6616
6621
  log.verbose("options sent", void 0, {
6617
6622
  "~LogMeta": "~LogMeta",
6618
- F: __dxlog_file$21,
6623
+ F: __dxlog_file$23,
6619
6624
  L: 107,
6620
6625
  S: this
6621
6626
  });
6622
6627
  await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT$1 }));
6623
6628
  log.verbose("options received", void 0, {
6624
6629
  "~LogMeta": "~LogMeta",
6625
- F: __dxlog_file$21,
6630
+ F: __dxlog_file$23,
6626
6631
  L: 109,
6627
6632
  S: this
6628
6633
  });
@@ -6650,7 +6655,7 @@ var InvitationGuestExtension = class extends RpcExtension {
6650
6655
  this._invitationFlowLock = null;
6651
6656
  log.verbose("invitation flow lock released", void 0, {
6652
6657
  "~LogMeta": "~LogMeta",
6653
- F: __dxlog_file$21,
6658
+ F: __dxlog_file$23,
6654
6659
  L: 144,
6655
6660
  S: this
6656
6661
  });
@@ -6659,7 +6664,7 @@ var InvitationGuestExtension = class extends RpcExtension {
6659
6664
  };
6660
6665
  //#endregion
6661
6666
  //#region src/internal/invitations/invitation-host-extension.ts
6662
- var __dxlog_file$20 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-host-extension.ts";
6667
+ var __dxlog_file$22 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-host-extension.ts";
6663
6668
  var OPTIONS_TIMEOUT = 1e4;
6664
6669
  /**
6665
6670
  * Host's side for a connection to a concrete peer in p2p network during invitation.
@@ -6672,7 +6677,7 @@ var InvitationHostExtension = class extends RpcExtension {
6672
6677
  */
6673
6678
  _ctx = new Context(void 0, {
6674
6679
  "~LogMeta": "~LogMeta",
6675
- F: __dxlog_file$20,
6680
+ F: __dxlog_file$22,
6676
6681
  L: 67
6677
6682
  });
6678
6683
  _remoteOptions;
@@ -6717,7 +6722,7 @@ var InvitationHostExtension = class extends RpcExtension {
6717
6722
  options: async (options) => {
6718
6723
  invariant(!this._remoteOptions, "Remote options already set.", {
6719
6724
  "~LogMeta": "~LogMeta",
6720
- F: __dxlog_file$20,
6725
+ F: __dxlog_file$22,
6721
6726
  L: 126,
6722
6727
  S: this,
6723
6728
  A: ["!this._remoteOptions", "'Remote options already set.'"]
@@ -6731,7 +6736,7 @@ var InvitationHostExtension = class extends RpcExtension {
6731
6736
  const { profile, invitationId } = request;
6732
6737
  log("introducing host invitation", void 0, {
6733
6738
  "~LogMeta": "~LogMeta",
6734
- F: __dxlog_file$20,
6739
+ F: __dxlog_file$22,
6735
6740
  L: 137,
6736
6741
  S: this
6737
6742
  });
@@ -6743,7 +6748,7 @@ var InvitationHostExtension = class extends RpcExtension {
6743
6748
  actual: invitationId
6744
6749
  }, {
6745
6750
  "~LogMeta": "~LogMeta",
6746
- F: __dxlog_file$20,
6751
+ F: __dxlog_file$22,
6747
6752
  L: 142,
6748
6753
  S: this
6749
6754
  });
@@ -6753,7 +6758,7 @@ var InvitationHostExtension = class extends RpcExtension {
6753
6758
  }
6754
6759
  log.verbose("guest introduced themselves", { guestProfile: profile }, {
6755
6760
  "~LogMeta": "~LogMeta",
6756
- F: __dxlog_file$20,
6761
+ F: __dxlog_file$22,
6757
6762
  L: 149,
6758
6763
  S: this
6759
6764
  });
@@ -6762,7 +6767,7 @@ var InvitationHostExtension = class extends RpcExtension {
6762
6767
  this._challenge = invitation.authMethod === Invitation_AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
6763
6768
  log("introduced host invitation", void 0, {
6764
6769
  "~LogMeta": "~LogMeta",
6765
- F: __dxlog_file$20,
6770
+ F: __dxlog_file$22,
6766
6771
  L: 155,
6767
6772
  S: this
6768
6773
  });
@@ -6774,14 +6779,14 @@ var InvitationHostExtension = class extends RpcExtension {
6774
6779
  authenticate: async ({ authCode: code, signedChallenge }) => {
6775
6780
  log("authenticating host invitation", void 0, {
6776
6781
  "~LogMeta": "~LogMeta",
6777
- F: __dxlog_file$20,
6782
+ F: __dxlog_file$22,
6778
6783
  L: 163,
6779
6784
  S: this
6780
6785
  });
6781
6786
  const invitation = this._requireActiveInvitation();
6782
6787
  log.verbose("received authentication request", { authCode: code }, {
6783
6788
  "~LogMeta": "~LogMeta",
6784
- F: __dxlog_file$20,
6789
+ F: __dxlog_file$22,
6785
6790
  L: 166,
6786
6791
  S: this
6787
6792
  });
@@ -6792,7 +6797,7 @@ var InvitationHostExtension = class extends RpcExtension {
6792
6797
  case Invitation_AuthMethod.NONE:
6793
6798
  log("authentication not required", void 0, {
6794
6799
  "~LogMeta": "~LogMeta",
6795
- F: __dxlog_file$20,
6800
+ F: __dxlog_file$22,
6796
6801
  L: 174,
6797
6802
  S: this
6798
6803
  });
@@ -6817,7 +6822,7 @@ var InvitationHostExtension = class extends RpcExtension {
6817
6822
  default:
6818
6823
  log.error("invalid authentication method", { authMethod: invitation.authMethod }, {
6819
6824
  "~LogMeta": "~LogMeta",
6820
- F: __dxlog_file$20,
6825
+ F: __dxlog_file$22,
6821
6826
  L: 209,
6822
6827
  S: this
6823
6828
  });
@@ -6830,7 +6835,7 @@ var InvitationHostExtension = class extends RpcExtension {
6830
6835
  }
6831
6836
  log("authenticated host invitation", { status }, {
6832
6837
  "~LogMeta": "~LogMeta",
6833
- F: __dxlog_file$20,
6838
+ F: __dxlog_file$22,
6834
6839
  L: 221,
6835
6840
  S: this
6836
6841
  });
@@ -6839,7 +6844,7 @@ var InvitationHostExtension = class extends RpcExtension {
6839
6844
  admit: async (request) => {
6840
6845
  log("admitting guest", void 0, {
6841
6846
  "~LogMeta": "~LogMeta",
6842
- F: __dxlog_file$20,
6847
+ F: __dxlog_file$22,
6843
6848
  L: 226,
6844
6849
  S: this
6845
6850
  });
@@ -6852,7 +6857,7 @@ var InvitationHostExtension = class extends RpcExtension {
6852
6857
  const response = await this._callbacks.admit(request);
6853
6858
  log("admitted guest", void 0, {
6854
6859
  "~LogMeta": "~LogMeta",
6855
- F: __dxlog_file$20,
6860
+ F: __dxlog_file$22,
6856
6861
  L: 240,
6857
6862
  S: this
6858
6863
  });
@@ -6869,14 +6874,14 @@ var InvitationHostExtension = class extends RpcExtension {
6869
6874
  try {
6870
6875
  log.verbose("host acquire lock", void 0, {
6871
6876
  "~LogMeta": "~LogMeta",
6872
- F: __dxlog_file$20,
6877
+ F: __dxlog_file$22,
6873
6878
  L: 255,
6874
6879
  S: this
6875
6880
  });
6876
6881
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
6877
6882
  log.verbose("host lock acquired", void 0, {
6878
6883
  "~LogMeta": "~LogMeta",
6879
- F: __dxlog_file$20,
6884
+ F: __dxlog_file$22,
6880
6885
  L: 257,
6881
6886
  S: this
6882
6887
  });
@@ -6885,14 +6890,14 @@ var InvitationHostExtension = class extends RpcExtension {
6885
6890
  optionsAcknowledged.catch(() => {});
6886
6891
  log.verbose("options sent", void 0, {
6887
6892
  "~LogMeta": "~LogMeta",
6888
- F: __dxlog_file$20,
6893
+ F: __dxlog_file$22,
6889
6894
  L: 263,
6890
6895
  S: this
6891
6896
  });
6892
6897
  await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT }));
6893
6898
  log.verbose("options received", void 0, {
6894
6899
  "~LogMeta": "~LogMeta",
6895
- F: __dxlog_file$20,
6900
+ F: __dxlog_file$22,
6896
6901
  L: 265,
6897
6902
  S: this
6898
6903
  });
@@ -6938,7 +6943,7 @@ var InvitationHostExtension = class extends RpcExtension {
6938
6943
  this._invitationFlowLock = null;
6939
6944
  log.verbose("invitation flow lock released", void 0, {
6940
6945
  "~LogMeta": "~LogMeta",
6941
- F: __dxlog_file$20,
6946
+ F: __dxlog_file$22,
6942
6947
  L: 328,
6943
6948
  S: this
6944
6949
  });
@@ -6952,7 +6957,7 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
6952
6957
  * A utility object for serializing invitation state changes by multiple concurrent
6953
6958
  * invitation flow connections.
6954
6959
  */
6955
- var __dxlog_file$19 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-state.ts";
6960
+ var __dxlog_file$21 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-state.ts";
6956
6961
  var createGuardedInvitationState = (ctx, invitation, stream) => {
6957
6962
  const mutex = new Mutex();
6958
6963
  let lastActiveLockHolder = null;
@@ -7017,7 +7022,7 @@ var logStateUpdate = (invitation, actor, newState, error) => {
7017
7022
  };
7018
7023
  log.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
7019
7024
  "~LogMeta": "~LogMeta",
7020
- F: __dxlog_file$19,
7025
+ F: __dxlog_file$21,
7021
7026
  L: 96,
7022
7027
  S: void 0
7023
7028
  });
@@ -7033,7 +7038,7 @@ var isNonTerminalState = (currentState) => {
7033
7038
  };
7034
7039
  //#endregion
7035
7040
  //#region src/internal/invitations/invitation-topology.ts
7036
- var __dxlog_file$18 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-topology.ts";
7041
+ var __dxlog_file$20 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitation-topology.ts";
7037
7042
  /** Connections a host starts to one peer before it stops retrying that peer. */
7038
7043
  var MAX_DIALS_PER_PEER = 3;
7039
7044
  /**
@@ -7067,7 +7072,7 @@ var InvitationTopology = class {
7067
7072
  init(controller) {
7068
7073
  invariant(!this._controller, "Already initialized.", {
7069
7074
  "~LogMeta": "~LogMeta",
7070
- F: __dxlog_file$18,
7075
+ F: __dxlog_file$20,
7071
7076
  L: 45,
7072
7077
  S: this,
7073
7078
  A: ["!this._controller", "'Already initialized.'"]
@@ -7077,7 +7082,7 @@ var InvitationTopology = class {
7077
7082
  update() {
7078
7083
  invariant(this._controller, "Not initialized.", {
7079
7084
  "~LogMeta": "~LogMeta",
7080
- F: __dxlog_file$18,
7085
+ F: __dxlog_file$20,
7081
7086
  L: 50,
7082
7087
  S: this,
7083
7088
  A: ["this._controller", "'Not initialized.'"]
@@ -7105,7 +7110,7 @@ var InvitationTopology = class {
7105
7110
  dials
7106
7111
  }, {
7107
7112
  "~LogMeta": "~LogMeta",
7108
- F: __dxlog_file$18,
7113
+ F: __dxlog_file$20,
7109
7114
  L: 92,
7110
7115
  S: this
7111
7116
  });
@@ -7117,7 +7122,7 @@ var InvitationTopology = class {
7117
7122
  async onOffer(peer) {
7118
7123
  invariant(this._controller, "Not initialized.", {
7119
7124
  "~LogMeta": "~LogMeta",
7120
- F: __dxlog_file$18,
7125
+ F: __dxlog_file$20,
7121
7126
  L: 100,
7122
7127
  S: this,
7123
7128
  A: ["this._controller", "'Not initialized.'"]
@@ -7140,7 +7145,7 @@ var InvitationTopology = class {
7140
7145
  };
7141
7146
  //#endregion
7142
7147
  //#region src/internal/invitations/invitations-handler.ts
7143
- var __dxlog_file$17 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitations-handler.ts";
7148
+ var __dxlog_file$19 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitations-handler.ts";
7144
7149
  var metrics = trace.metrics;
7145
7150
  var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
7146
7151
  /**
@@ -7195,7 +7200,7 @@ var InvitationsHandler = class {
7195
7200
  type: invitation.type
7196
7201
  }, {
7197
7202
  "~LogMeta": "~LogMeta",
7198
- F: __dxlog_file$17,
7203
+ F: __dxlog_file$19,
7199
7204
  L: 120,
7200
7205
  S: this
7201
7206
  });
@@ -7239,14 +7244,14 @@ var InvitationsHandler = class {
7239
7244
  ...protocol.toJSON()
7240
7245
  }, {
7241
7246
  "~LogMeta": "~LogMeta",
7242
- F: __dxlog_file$17,
7247
+ F: __dxlog_file$19,
7243
7248
  L: 176,
7244
7249
  S: this
7245
7250
  });
7246
7251
  const deviceKey = admissionRequest.kind.value?.deviceKey;
7247
7252
  invariant(deviceKey, "Admission request carries no device key.", {
7248
7253
  "~LogMeta": "~LogMeta",
7249
- F: __dxlog_file$17,
7254
+ F: __dxlog_file$19,
7250
7255
  L: 181,
7251
7256
  S: this,
7252
7257
  A: ["deviceKey", "'Admission request carries no device key.'"]
@@ -7268,13 +7273,13 @@ var InvitationsHandler = class {
7268
7273
  try {
7269
7274
  log("opening host invitation handler", void 0, {
7270
7275
  "~LogMeta": "~LogMeta",
7271
- F: __dxlog_file$17,
7276
+ F: __dxlog_file$19,
7272
7277
  L: 205,
7273
7278
  S: this
7274
7279
  });
7275
7280
  log.verbose("connected", { ...protocol.toJSON() }, {
7276
7281
  "~LogMeta": "~LogMeta",
7277
- F: __dxlog_file$17,
7282
+ F: __dxlog_file$19,
7278
7283
  L: 206,
7279
7284
  S: this
7280
7285
  });
@@ -7284,7 +7289,7 @@ var InvitationsHandler = class {
7284
7289
  ...protocol.toJSON()
7285
7290
  }, {
7286
7291
  "~LogMeta": "~LogMeta",
7287
- F: __dxlog_file$17,
7292
+ F: __dxlog_file$19,
7288
7293
  L: 208,
7289
7294
  S: this
7290
7295
  });
@@ -7296,7 +7301,7 @@ var InvitationsHandler = class {
7296
7301
  trace.events.emit(ClientTraceEvents.invitationAdmit, invitationEventAttributes(guardedState.current));
7297
7302
  log("host invitation handler opened", void 0, {
7298
7303
  "~LogMeta": "~LogMeta",
7299
- F: __dxlog_file$17,
7304
+ F: __dxlog_file$19,
7300
7305
  L: 212,
7301
7306
  S: this
7302
7307
  });
@@ -7313,7 +7318,7 @@ var InvitationsHandler = class {
7313
7318
  } });
7314
7319
  log.verbose("timeout", { ...protocol.toJSON() }, {
7315
7320
  "~LogMeta": "~LogMeta",
7316
- F: __dxlog_file$17,
7321
+ F: __dxlog_file$19,
7317
7322
  L: 224,
7318
7323
  S: this
7319
7324
  });
@@ -7325,7 +7330,7 @@ var InvitationsHandler = class {
7325
7330
  } });
7326
7331
  log.error("failed", err, {
7327
7332
  "~LogMeta": "~LogMeta",
7328
- F: __dxlog_file$17,
7333
+ F: __dxlog_file$19,
7329
7334
  L: 229,
7330
7335
  S: this
7331
7336
  });
@@ -7339,7 +7344,7 @@ var InvitationsHandler = class {
7339
7344
  if (err instanceof InvalidInvitationExtensionRoleError) {
7340
7345
  log("invalid role", { ...err.context }, {
7341
7346
  "~LogMeta": "~LogMeta",
7342
- F: __dxlog_file$17,
7347
+ F: __dxlog_file$19,
7343
7348
  L: 240,
7344
7349
  S: this
7345
7350
  });
@@ -7354,7 +7359,7 @@ var InvitationsHandler = class {
7354
7359
  } });
7355
7360
  log.verbose("timeout", { err }, {
7356
7361
  "~LogMeta": "~LogMeta",
7357
- F: __dxlog_file$17,
7362
+ F: __dxlog_file$19,
7358
7363
  L: 247,
7359
7364
  S: this
7360
7365
  });
@@ -7366,7 +7371,7 @@ var InvitationsHandler = class {
7366
7371
  } });
7367
7372
  log.error("failed", err, {
7368
7373
  "~LogMeta": "~LogMeta",
7369
- F: __dxlog_file$17,
7374
+ F: __dxlog_file$19,
7370
7375
  L: 252,
7371
7376
  S: this
7372
7377
  });
@@ -7380,14 +7385,14 @@ var InvitationsHandler = class {
7380
7385
  if (expiresOn.getTime() < Date.now()) {
7381
7386
  log.warn("invitation has already expired", void 0, {
7382
7387
  "~LogMeta": "~LogMeta",
7383
- F: __dxlog_file$17,
7388
+ F: __dxlog_file$19,
7384
7389
  L: 264,
7385
7390
  S: this
7386
7391
  });
7387
7392
  guardedState.set(null, Invitation_State.EXPIRED);
7388
7393
  ctx.dispose().catch((err) => log.catch(err, void 0, {
7389
7394
  "~LogMeta": "~LogMeta",
7390
- F: __dxlog_file$17,
7395
+ F: __dxlog_file$19,
7391
7396
  L: 266,
7392
7397
  S: this
7393
7398
  }));
@@ -7417,7 +7422,7 @@ var InvitationsHandler = class {
7417
7422
  type: invitation.type
7418
7423
  }, {
7419
7424
  "~LogMeta": "~LogMeta",
7420
- F: __dxlog_file$17,
7425
+ F: __dxlog_file$19,
7421
7426
  L: 297,
7422
7427
  S: this
7423
7428
  });
@@ -7443,7 +7448,7 @@ var InvitationsHandler = class {
7443
7448
  });
7444
7449
  if (deviceProfile) invariant(invitation.kind === Invitation_Kind.DEVICE, "deviceProfile provided for non-device invitation", {
7445
7450
  "~LogMeta": "~LogMeta",
7446
- F: __dxlog_file$17,
7451
+ F: __dxlog_file$19,
7447
7452
  L: 338,
7448
7453
  S: this,
7449
7454
  A: ["invitation.kind === Invitation_Kind.DEVICE", "'deviceProfile provided for non-device invitation'"]
@@ -7463,7 +7468,7 @@ var InvitationsHandler = class {
7463
7468
  triedPeers: triedPeersIds.size
7464
7469
  }, {
7465
7470
  "~LogMeta": "~LogMeta",
7466
- F: __dxlog_file$17,
7471
+ F: __dxlog_file$19,
7467
7472
  L: 356,
7468
7473
  S: this
7469
7474
  });
@@ -7488,7 +7493,7 @@ var InvitationsHandler = class {
7488
7493
  currentState: guardedState.current.state
7489
7494
  }, {
7490
7495
  "~LogMeta": "~LogMeta",
7491
- F: __dxlog_file$17,
7496
+ F: __dxlog_file$19,
7492
7497
  L: 384,
7493
7498
  S: this
7494
7499
  });
@@ -7501,7 +7506,7 @@ var InvitationsHandler = class {
7501
7506
  try {
7502
7507
  log("opening guest invitation handler", void 0, {
7503
7508
  "~LogMeta": "~LogMeta",
7504
- F: __dxlog_file$17,
7509
+ F: __dxlog_file$19,
7505
7510
  L: 395,
7506
7511
  S: this
7507
7512
  });
@@ -7511,7 +7516,7 @@ var InvitationsHandler = class {
7511
7516
  }, timeout);
7512
7517
  log.verbose("dxos.sdk.invitations-handler.guest.connected", { ...protocol.toJSON() }, {
7513
7518
  "~LogMeta": "~LogMeta",
7514
- F: __dxlog_file$17,
7519
+ F: __dxlog_file$19,
7515
7520
  L: 406,
7516
7521
  S: this
7517
7522
  });
@@ -7521,7 +7526,7 @@ var InvitationsHandler = class {
7521
7526
  ...protocol.toJSON()
7522
7527
  }, {
7523
7528
  "~LogMeta": "~LogMeta",
7524
- F: __dxlog_file$17,
7529
+ F: __dxlog_file$19,
7525
7530
  L: 410,
7526
7531
  S: this
7527
7532
  });
@@ -7535,7 +7540,7 @@ var InvitationsHandler = class {
7535
7540
  authMethod: introductionResponse.authMethod
7536
7541
  }, {
7537
7542
  "~LogMeta": "~LogMeta",
7538
- F: __dxlog_file$17,
7543
+ F: __dxlog_file$19,
7539
7544
  L: 418,
7540
7545
  S: this
7541
7546
  });
@@ -7551,7 +7556,7 @@ var InvitationsHandler = class {
7551
7556
  ...protocol.toJSON()
7552
7557
  }, {
7553
7558
  "~LogMeta": "~LogMeta",
7554
- F: __dxlog_file$17,
7559
+ F: __dxlog_file$19,
7555
7560
  L: 448,
7556
7561
  S: this
7557
7562
  });
@@ -7564,7 +7569,7 @@ var InvitationsHandler = class {
7564
7569
  ...protocol.toJSON()
7565
7570
  }, {
7566
7571
  "~LogMeta": "~LogMeta",
7567
- F: __dxlog_file$17,
7572
+ F: __dxlog_file$19,
7568
7573
  L: 462,
7569
7574
  S: this
7570
7575
  });
@@ -7582,7 +7587,7 @@ var InvitationsHandler = class {
7582
7587
  if (firstAdmission) trace.events.emit(ClientTraceEvents.invitationAccept, invitationEventAttributes(guardedState.current));
7583
7588
  log("guest invitation handler opened", void 0, {
7584
7589
  "~LogMeta": "~LogMeta",
7585
- F: __dxlog_file$17,
7590
+ F: __dxlog_file$19,
7586
7591
  L: 477,
7587
7592
  S: this
7588
7593
  });
@@ -7590,7 +7595,7 @@ var InvitationsHandler = class {
7590
7595
  if (err instanceof TimeoutError) {
7591
7596
  log.verbose("timeout", { ...protocol.toJSON() }, {
7592
7597
  "~LogMeta": "~LogMeta",
7593
- F: __dxlog_file$17,
7598
+ F: __dxlog_file$19,
7594
7599
  L: 480,
7595
7600
  S: this
7596
7601
  });
@@ -7598,7 +7603,7 @@ var InvitationsHandler = class {
7598
7603
  } else {
7599
7604
  log.verbose("auth failed", err, {
7600
7605
  "~LogMeta": "~LogMeta",
7601
- F: __dxlog_file$17,
7606
+ F: __dxlog_file$19,
7602
7607
  L: 483,
7603
7608
  S: this
7604
7609
  });
@@ -7613,7 +7618,7 @@ var InvitationsHandler = class {
7613
7618
  if (err instanceof TimeoutError) {
7614
7619
  log.verbose("timeout", { ...protocol.toJSON() }, {
7615
7620
  "~LogMeta": "~LogMeta",
7616
- F: __dxlog_file$17,
7621
+ F: __dxlog_file$19,
7617
7622
  L: 495,
7618
7623
  S: this
7619
7624
  });
@@ -7621,7 +7626,7 @@ var InvitationsHandler = class {
7621
7626
  } else {
7622
7627
  log.verbose("auth failed", err, {
7623
7628
  "~LogMeta": "~LogMeta",
7624
- F: __dxlog_file$17,
7629
+ F: __dxlog_file$19,
7625
7630
  L: 498,
7626
7631
  S: this
7627
7632
  });
@@ -7635,7 +7640,7 @@ var InvitationsHandler = class {
7635
7640
  const result = await protocol.accept(edgeCtx, admissionResponse, admissionRequest);
7636
7641
  log.info("admitted by edge", { ...protocol.toJSON() }, {
7637
7642
  "~LogMeta": "~LogMeta",
7638
- F: __dxlog_file$17,
7643
+ F: __dxlog_file$19,
7639
7644
  L: 510,
7640
7645
  S: this
7641
7646
  });
@@ -7660,7 +7665,7 @@ var InvitationsHandler = class {
7660
7665
  } else {
7661
7666
  invariant(invitation.swarmKey, void 0, {
7662
7667
  "~LogMeta": "~LogMeta",
7663
- F: __dxlog_file$17,
7668
+ F: __dxlog_file$19,
7664
7669
  L: 529,
7665
7670
  S: this,
7666
7671
  A: ["invitation.swarmKey", ""]
@@ -7683,7 +7688,7 @@ var InvitationsHandler = class {
7683
7688
  const swarmKey = toPublicKey(invitation.swarmKey);
7684
7689
  invariant(swarmKey, "swarmKey missing in the invitation", {
7685
7690
  "~LogMeta": "~LogMeta",
7686
- F: __dxlog_file$17,
7691
+ F: __dxlog_file$19,
7687
7692
  L: 570,
7688
7693
  S: this,
7689
7694
  A: ["swarmKey", "'swarmKey missing in the invitation'"]
@@ -7703,7 +7708,7 @@ var InvitationsHandler = class {
7703
7708
  for (let attempt = 1; attempt <= 3; attempt++) {
7704
7709
  log("guest waiting for authentication code...", void 0, {
7705
7710
  "~LogMeta": "~LogMeta",
7706
- F: __dxlog_file$17,
7711
+ F: __dxlog_file$19,
7707
7712
  L: 590,
7708
7713
  S: this
7709
7714
  });
@@ -7711,7 +7716,7 @@ var InvitationsHandler = class {
7711
7716
  const authCode = await authenticated.wait(options);
7712
7717
  log("sending authentication request", void 0, {
7713
7718
  "~LogMeta": "~LogMeta",
7714
- F: __dxlog_file$17,
7719
+ F: __dxlog_file$19,
7715
7720
  L: 594,
7716
7721
  S: this
7717
7722
  });
@@ -7723,7 +7728,7 @@ var InvitationsHandler = class {
7723
7728
  else {
7724
7729
  log("retrying invalid code", { attempt }, {
7725
7730
  "~LogMeta": "~LogMeta",
7726
- F: __dxlog_file$17,
7731
+ F: __dxlog_file$19,
7727
7732
  L: 607,
7728
7733
  S: this
7729
7734
  });
@@ -7738,7 +7743,7 @@ var InvitationsHandler = class {
7738
7743
  if (introductionResponse.challenge == null) throw new Error("challenge missing in the introduction");
7739
7744
  log("sending authentication request", void 0, {
7740
7745
  "~LogMeta": "~LogMeta",
7741
- F: __dxlog_file$17,
7746
+ F: __dxlog_file$19,
7742
7747
  L: 627,
7743
7748
  S: this
7744
7749
  });
@@ -7769,7 +7774,7 @@ var InvitationsHandlerLayer = (options = {}) => Layer.effect(InvitationsHandlerS
7769
7774
  }));
7770
7775
  //#endregion
7771
7776
  //#region src/internal/invitations/invitations-service.ts
7772
- var __dxlog_file$16 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitations-service.ts";
7777
+ var __dxlog_file$18 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitations-service.ts";
7773
7778
  /**
7774
7779
  * Adapts invitation service observable to client/service stream.
7775
7780
  */
@@ -7785,7 +7790,7 @@ var InvitationsServiceImpl = class {
7785
7790
  return EffectEx.streamFromEmitter((emit) => {
7786
7791
  const ctx = Context.default(void 0, {
7787
7792
  "~LogMeta": "~LogMeta",
7788
- F: __dxlog_file$16,
7793
+ F: __dxlog_file$18,
7789
7794
  L: 41
7790
7795
  });
7791
7796
  this._invitationsManager.createInvitation(ctx, request).then((invitation) => {
@@ -7799,7 +7804,7 @@ var InvitationsServiceImpl = class {
7799
7804
  return EffectEx.streamFromEmitter((emit) => {
7800
7805
  const ctx = Context.default(void 0, {
7801
7806
  "~LogMeta": "~LogMeta",
7802
- F: __dxlog_file$16,
7807
+ F: __dxlog_file$18,
7803
7808
  L: 61
7804
7809
  });
7805
7810
  this._invitationsManager.acceptInvitation(ctx, { ...request }).subscribe((value) => void emit.single(value), (err) => void emit.fail(err), () => void emit.end());
@@ -7822,7 +7827,7 @@ var InvitationsServiceImpl = class {
7822
7827
  return EffectEx.streamFromEmitter((emit) => {
7823
7828
  const ctx = Context.default(void 0, {
7824
7829
  "~LogMeta": "~LogMeta",
7825
- F: __dxlog_file$16,
7830
+ F: __dxlog_file$18,
7826
7831
  L: 92
7827
7832
  });
7828
7833
  this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
@@ -7885,7 +7890,7 @@ var InvitationsServiceImpl = class {
7885
7890
  var InvitationsServiceLayer = Layer.effect(InvitationsService.Tag, Effect.map(ManagerService, (invitationsManager) => new InvitationsServiceImpl(invitationsManager)));
7886
7891
  //#endregion
7887
7892
  //#region src/internal/invitations/invitations-manager.ts
7888
- var __dxlog_file$15 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitations-manager.ts";
7893
+ var __dxlog_file$17 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/invitations/invitations-manager.ts";
7889
7894
  /**
7890
7895
  * Entry point for creating and accepting invitations, keeps track of existing invitation set and
7891
7896
  * emits events when the set changes.
@@ -7919,7 +7924,7 @@ var InvitationsManager = class {
7919
7924
  getInvitationHandler(invitation) {
7920
7925
  invariant(this._invitationHandlerFactory, "Invitation handler factory not set.", {
7921
7926
  "~LogMeta": "~LogMeta",
7922
- F: __dxlog_file$15,
7927
+ F: __dxlog_file$17,
7923
7928
  L: 80,
7924
7929
  S: this,
7925
7930
  A: ["this._invitationHandlerFactory", "'Invitation handler factory not set.'"]
@@ -7948,7 +7953,7 @@ var InvitationsManager = class {
7948
7953
  } catch (err) {
7949
7954
  log.catch(err, void 0, {
7950
7955
  "~LogMeta": "~LogMeta",
7951
- F: __dxlog_file$15,
7956
+ F: __dxlog_file$17,
7952
7957
  L: 123,
7953
7958
  S: this
7954
7959
  });
@@ -7964,7 +7969,7 @@ var InvitationsManager = class {
7964
7969
  const loadTasks = this._metadataStore.getInvitations().filter((invitation) => !hasInvitationExpired(invitation)).map((persistentInvitation) => {
7965
7970
  invariant(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
7966
7971
  "~LogMeta": "~LogMeta",
7967
- F: __dxlog_file$15,
7972
+ F: __dxlog_file$17,
7968
7973
  L: 144,
7969
7974
  S: this,
7970
7975
  A: ["!this._createInvitations.get(persistentInvitation.invitationId)", "'invitation already exists'"]
@@ -7978,7 +7983,7 @@ var InvitationsManager = class {
7978
7983
  } catch (err) {
7979
7984
  log.catch(err, void 0, {
7980
7985
  "~LogMeta": "~LogMeta",
7981
- F: __dxlog_file$15,
7986
+ F: __dxlog_file$17,
7982
7987
  L: 151,
7983
7988
  S: this
7984
7989
  });
@@ -8010,13 +8015,13 @@ var InvitationsManager = class {
8010
8015
  async authenticate({ invitationId, authCode }) {
8011
8016
  log("authenticating...", void 0, {
8012
8017
  "~LogMeta": "~LogMeta",
8013
- F: __dxlog_file$15,
8018
+ F: __dxlog_file$17,
8014
8019
  L: 203,
8015
8020
  S: this
8016
8021
  });
8017
8022
  invariant(invitationId, void 0, {
8018
8023
  "~LogMeta": "~LogMeta",
8019
- F: __dxlog_file$15,
8024
+ F: __dxlog_file$17,
8020
8025
  L: 204,
8021
8026
  S: this,
8022
8027
  A: ["invitationId", ""]
@@ -8024,7 +8029,7 @@ var InvitationsManager = class {
8024
8029
  const observable = this._acceptInvitations.get(invitationId);
8025
8030
  if (!observable) log.warn("invalid invitation", { invitationId }, {
8026
8031
  "~LogMeta": "~LogMeta",
8027
- F: __dxlog_file$15,
8032
+ F: __dxlog_file$17,
8028
8033
  L: 207,
8029
8034
  S: this
8030
8035
  });
@@ -8033,13 +8038,13 @@ var InvitationsManager = class {
8033
8038
  async cancelInvitation({ invitationId }) {
8034
8039
  log("cancelInvitation...", { invitationId }, {
8035
8040
  "~LogMeta": "~LogMeta",
8036
- F: __dxlog_file$15,
8041
+ F: __dxlog_file$17,
8037
8042
  L: 214,
8038
8043
  S: this
8039
8044
  });
8040
8045
  invariant(invitationId, void 0, {
8041
8046
  "~LogMeta": "~LogMeta",
8042
- F: __dxlog_file$15,
8047
+ F: __dxlog_file$17,
8043
8048
  L: 215,
8044
8049
  S: this,
8045
8050
  A: ["invitationId", ""]
@@ -8101,7 +8106,7 @@ var InvitationsManager = class {
8101
8106
  invitationCtx.onDispose(() => {
8102
8107
  log("complete", { ...handler.toJSON() }, {
8103
8108
  "~LogMeta": "~LogMeta",
8104
- F: __dxlog_file$15,
8109
+ F: __dxlog_file$17,
8105
8110
  L: 310,
8106
8111
  S: this
8107
8112
  });
@@ -8130,7 +8135,7 @@ var InvitationsManager = class {
8130
8135
  if (err instanceof TimeoutError) {
8131
8136
  log("timeout", { ...handler.toJSON() }, {
8132
8137
  "~LogMeta": "~LogMeta",
8133
- F: __dxlog_file$15,
8138
+ F: __dxlog_file$17,
8134
8139
  L: 340,
8135
8140
  S: this
8136
8141
  });
@@ -8141,7 +8146,7 @@ var InvitationsManager = class {
8141
8146
  } else {
8142
8147
  log.warn("auth failed", err, {
8143
8148
  "~LogMeta": "~LogMeta",
8144
- F: __dxlog_file$15,
8149
+ F: __dxlog_file$17,
8145
8150
  L: 343,
8146
8151
  S: this
8147
8152
  });
@@ -8155,7 +8160,7 @@ var InvitationsManager = class {
8155
8160
  ctx.onDispose(() => {
8156
8161
  log("complete", { ...handler.toJSON() }, {
8157
8162
  "~LogMeta": "~LogMeta",
8158
- F: __dxlog_file$15,
8163
+ F: __dxlog_file$17,
8159
8164
  L: 350,
8160
8165
  S: this
8161
8166
  });
@@ -8199,7 +8204,7 @@ var InvitationsManager = class {
8199
8204
  } catch (err) {
8200
8205
  log.catch(err, void 0, {
8201
8206
  "~LogMeta": "~LogMeta",
8202
- F: __dxlog_file$15,
8207
+ F: __dxlog_file$17,
8203
8208
  L: 386,
8204
8209
  S: this
8205
8210
  });
@@ -8226,7 +8231,7 @@ var InvitationsManagerLayer = () => Layer.effect(ManagerService, Effect.gen(func
8226
8231
  const loaded = yield* Effect.promise(() => invitationsManager.loadPersistentInvitations(ctx));
8227
8232
  log("loaded persistent invitations", { count: loaded.invitations.length }, {
8228
8233
  "~LogMeta": "~LogMeta",
8229
- F: __dxlog_file$15,
8234
+ F: __dxlog_file$17,
8230
8235
  L: 422,
8231
8236
  S: this
8232
8237
  });
@@ -8240,8 +8245,135 @@ var InvitationsManagerLayer = () => Layer.effect(ManagerService, Effect.gen(func
8240
8245
  */
8241
8246
  var TransportFactoryService = class extends EffectContext.Service()("@dxos/client-services/TransportFactory") {};
8242
8247
  //#endregion
8248
+ //#region src/migrations/blobs/index.ts
8249
+ /**
8250
+ * Local blob store migrations, keyed `<id>_<name>` as `Migrator.fromRecord` expects. Ids must only ever increase,
8251
+ * and an applied migration must never be edited — nothing verifies its contents.
8252
+ */
8253
+ var MIGRATIONS = { "0001_init": SqlMigrations.apply("--\n-- Device-local, content-addressed blob bytes, kept outside Automerge so large blobs do not bloat\n-- documents. `uploaded_at` is NULL while the hosted store does not yet hold the bytes; the partial\n-- index makes that upload ledger cheap to scan.\n--\n-- Immutable: recorded in `blobs_migrations` and never re-run.\n--\nCREATE TABLE IF NOT EXISTS blobs (\n hash TEXT PRIMARY KEY,\n type TEXT,\n size INTEGER NOT NULL,\n data BLOB NOT NULL,\n created_at INTEGER NOT NULL,\n uploaded_at INTEGER\n);\n\nCREATE INDEX IF NOT EXISTS blobs_pending ON blobs (created_at) WHERE uploaded_at IS NULL;\n") };
8254
+ //#endregion
8255
+ //#region src/internal/blobs/local-blob-store.ts
8256
+ /**
8257
+ * Applies any local blob store migrations this database has not recorded yet.
8258
+ */
8259
+ var migrateBlobStore = Migrator.make({})({
8260
+ loader: Migrator.fromRecord(MIGRATIONS),
8261
+ table: "blobs_migrations"
8262
+ }).pipe(Effect.catchTag("MigrationError", (error) => Effect.die(error)), Effect.asVoid, Effect.withSpan("BlobStore.migrate"));
8263
+ /**
8264
+ * The `blobs` table of the host's database: blob bytes on this device, outside Automerge, with the
8265
+ * ledger of those the hosted store does not hold yet. Knows nothing of replication.
8266
+ */
8267
+ var makeLocalBlobStore = Effect.gen(function* () {
8268
+ const sql = yield* SqlClient.SqlClient;
8269
+ return {
8270
+ put: (key, data, { contentType, uploaded = false } = {}) => {
8271
+ const now = Date.now();
8272
+ return EffectEx.runPromise(sql`
8273
+ INSERT INTO blobs (hash, type, size, data, created_at, uploaded_at)
8274
+ VALUES (${key}, ${contentType ?? null}, ${data.byteLength}, ${data}, ${now}, ${uploaded ? now : null})
8275
+ ON CONFLICT (hash) DO UPDATE SET
8276
+ type = COALESCE(blobs.type, excluded.type),
8277
+ uploaded_at = COALESCE(blobs.uploaded_at, excluded.uploaded_at)
8278
+ `.pipe(Effect.asVoid));
8279
+ },
8280
+ get: async (key) => {
8281
+ const [row] = await EffectEx.runPromise(sql`SELECT data, type FROM blobs WHERE hash = ${key}`);
8282
+ if (!row) return;
8283
+ return row.type === null ? { data: row.data } : {
8284
+ data: row.data,
8285
+ contentType: row.type
8286
+ };
8287
+ },
8288
+ has: async (key) => (await EffectEx.runPromise(sql`SELECT 1 AS found FROM blobs WHERE hash = ${key}`)).length > 0,
8289
+ listPending: async ({ limit }) => (await EffectEx.runPromise(sql`
8290
+ SELECT hash FROM blobs WHERE uploaded_at IS NULL ORDER BY created_at, rowid LIMIT ${limit}
8291
+ `)).map(({ hash }) => hash),
8292
+ markUploaded: (key) => EffectEx.runPromise(sql`UPDATE blobs SET uploaded_at = ${Date.now()} WHERE hash = ${key} AND uploaded_at IS NULL`.pipe(Effect.asVoid))
8293
+ };
8294
+ });
8295
+ var LocalBlobStoreService = class extends EffectContext.Service()("@dxos/client-services/LocalBlobStore") {};
8296
+ var LocalBlobStoreLayer = Layer.effect(LocalBlobStoreService, makeLocalBlobStore);
8297
+ //#endregion
8298
+ //#region src/internal/blobs/blob-replication.ts
8299
+ var __dxlog_file$16 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/blobs/blob-replication.ts";
8300
+ var BlobReplicationService = class extends EffectContext.Service()("@dxos/client-services/BlobReplication") {};
8301
+ /**
8302
+ * Replication for a stack with no EDGE endpoint: reads are served by the local store alone and writes
8303
+ * stay in its ledger, to be pushed by a later session that has one.
8304
+ */
8305
+ var BlobReplicationNoopLayer = Layer.effect(BlobReplicationService, Effect.gen(function* () {
8306
+ return {
8307
+ store: yield* LocalBlobStoreService,
8308
+ wake: () => {}
8309
+ };
8310
+ }));
8311
+ var edgeBlobTransport = (edge) => ({
8312
+ url: (key) => edge.getBlobUrl(key),
8313
+ put: (key, data, options) => edge.putBlob(Context.default(void 0, {
8314
+ "~LogMeta": "~LogMeta",
8315
+ F: __dxlog_file$16,
8316
+ L: 48
8317
+ }), key, data, options),
8318
+ get: (key) => edge.getBlob(Context.default(void 0, {
8319
+ "~LogMeta": "~LogMeta",
8320
+ F: __dxlog_file$16,
8321
+ L: 49
8322
+ }), key),
8323
+ has: (key) => edge.hasBlob(Context.default(void 0, {
8324
+ "~LogMeta": "~LogMeta",
8325
+ F: __dxlog_file$16,
8326
+ L: 50
8327
+ }), key)
8328
+ });
8329
+ var BlobReplicationLayer = Layer.effect(BlobReplicationService, Effect.gen(function* () {
8330
+ const local = yield* LocalBlobStoreService;
8331
+ const transport = edgeBlobTransport(yield* EdgeHttpClientService);
8332
+ let replicator;
8333
+ yield* Hook.on(NetworkReady, Effect.fn("BlobReplication.onNetworkReady")(function* () {
8334
+ replicator ??= createBlobReplicator({
8335
+ local,
8336
+ transport
8337
+ });
8338
+ replicator.wake();
8339
+ }));
8340
+ yield* Effect.addFinalizer(() => Effect.promise(async () => replicator?.close()));
8341
+ return {
8342
+ store: withReadThrough({
8343
+ local,
8344
+ transport
8345
+ }),
8346
+ wake: () => replicator?.wake()
8347
+ };
8348
+ }));
8349
+ //#endregion
8350
+ //#region src/internal/blobs/blob-store-service.ts
8351
+ /**
8352
+ * Serves `BlobStoreService` RPCs from the local blob store. A `put` is confirmed once the bytes are
8353
+ * stored locally; replication is only told about it afterwards.
8354
+ */
8355
+ var BlobStoreServiceLayer = Layer.effect(BlobStoreService.Tag, Effect.gen(function* () {
8356
+ const local = yield* LocalBlobStoreService;
8357
+ const replication = yield* BlobReplicationService;
8358
+ const store = replication.store;
8359
+ return {
8360
+ "BlobStoreService.put": ({ key, data, contentType }) => Effect.tryPromise({
8361
+ try: () => local.put(key, data, { contentType }),
8362
+ catch: toServiceError
8363
+ }).pipe(Effect.tap(() => Effect.sync(() => replication.wake()))),
8364
+ "BlobStoreService.get": ({ key }) => Effect.tryPromise({
8365
+ try: () => store.get(key),
8366
+ catch: toServiceError
8367
+ }).pipe(Effect.map((blob) => blob ? { blob } : {})),
8368
+ "BlobStoreService.has": ({ key }) => Effect.tryPromise({
8369
+ try: () => store.has(key),
8370
+ catch: toServiceError
8371
+ }).pipe(Effect.map((exists) => ({ exists })))
8372
+ };
8373
+ }));
8374
+ //#endregion
8243
8375
  //#region src/internal/devices/devices-service.ts
8244
- var __dxlog_file$14 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devices/devices-service.ts";
8376
+ var __dxlog_file$15 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/devices/devices-service.ts";
8245
8377
  var DevicesServiceImpl = class {
8246
8378
  _identityManager;
8247
8379
  _edgeConnection;
@@ -8263,7 +8395,7 @@ var DevicesServiceImpl = class {
8263
8395
  else {
8264
8396
  invariant(this._identityManager.identity?.presence, "presence not present", {
8265
8397
  "~LogMeta": "~LogMeta",
8266
- F: __dxlog_file$14,
8398
+ F: __dxlog_file$15,
8267
8399
  L: 49,
8268
8400
  S: this,
8269
8401
  A: ["this._identityManager.identity?.presence", "'presence not present'"]
@@ -8324,7 +8456,7 @@ var DevicesServiceLayer = Layer.effect(DevicesService.Tag, Effect.gen(function*
8324
8456
  }));
8325
8457
  //#endregion
8326
8458
  //#region src/internal/logging/logging-service.ts
8327
- var __dxlog_file$13 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/logging/logging-service.ts";
8459
+ var __dxlog_file$14 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/logging/logging-service.ts";
8328
8460
  /**
8329
8461
  * Logging service used to spy on logs of the host.
8330
8462
  *
@@ -8384,7 +8516,7 @@ var LoggingServiceImpl = class {
8384
8516
  return EffectEx.streamFromEmitter((emit) => {
8385
8517
  const ctx = Context.default(void 0, {
8386
8518
  "~LogMeta": "~LogMeta",
8387
- F: __dxlog_file$13,
8519
+ F: __dxlog_file$14,
8388
8520
  L: 104
8389
8521
  });
8390
8522
  const handler = (entry) => {
@@ -8453,7 +8585,7 @@ var LoggingServiceLayer = Layer.effect(LoggingService.Tag, Effect.gen(function*
8453
8585
  }));
8454
8586
  //#endregion
8455
8587
  //#region src/internal/network/network-service.ts
8456
- var __dxlog_file$12 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/network/network-service.ts";
8588
+ var __dxlog_file$13 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/network/network-service.ts";
8457
8589
  var NetworkServiceImpl = class {
8458
8590
  networkManager;
8459
8591
  signalManager;
@@ -8467,7 +8599,7 @@ var NetworkServiceImpl = class {
8467
8599
  return EffectEx.streamFromEmitter((emit) => {
8468
8600
  const ctx = Context.default(void 0, {
8469
8601
  "~LogMeta": "~LogMeta",
8470
- F: __dxlog_file$12,
8602
+ F: __dxlog_file$13,
8471
8603
  L: 37
8472
8604
  });
8473
8605
  const update = () => {
@@ -8499,7 +8631,7 @@ var NetworkServiceImpl = class {
8499
8631
  try: async () => {
8500
8632
  await this.signalManager.join(Context.default(void 0, {
8501
8633
  "~LogMeta": "~LogMeta",
8502
- F: __dxlog_file$12,
8634
+ F: __dxlog_file$13,
8503
8635
  L: 68
8504
8636
  }), request);
8505
8637
  },
@@ -8511,7 +8643,7 @@ var NetworkServiceImpl = class {
8511
8643
  try: async () => {
8512
8644
  await this.signalManager.leave(Context.default(void 0, {
8513
8645
  "~LogMeta": "~LogMeta",
8514
- F: __dxlog_file$12,
8646
+ F: __dxlog_file$13,
8515
8647
  L: 77
8516
8648
  }), request);
8517
8649
  },
@@ -8523,7 +8655,7 @@ var NetworkServiceImpl = class {
8523
8655
  try: async () => {
8524
8656
  return this.signalManager.query(Context.default(void 0, {
8525
8657
  "~LogMeta": "~LogMeta",
8526
- F: __dxlog_file$12,
8658
+ F: __dxlog_file$13,
8527
8659
  L: 86
8528
8660
  }), request);
8529
8661
  },
@@ -8534,7 +8666,7 @@ var NetworkServiceImpl = class {
8534
8666
  return EffectEx.streamFromEmitter((emit) => {
8535
8667
  const ctx = Context.default(void 0, {
8536
8668
  "~LogMeta": "~LogMeta",
8537
- F: __dxlog_file$12,
8669
+ F: __dxlog_file$13,
8538
8670
  L: 96
8539
8671
  });
8540
8672
  this.signalManager.swarmState?.on(ctx, (state) => {
@@ -8548,7 +8680,7 @@ var NetworkServiceImpl = class {
8548
8680
  try: async () => {
8549
8681
  await this.signalManager.sendMessage(Context.default(void 0, {
8550
8682
  "~LogMeta": "~LogMeta",
8551
- F: __dxlog_file$12,
8683
+ F: __dxlog_file$13,
8552
8684
  L: 110
8553
8685
  }), message);
8554
8686
  },
@@ -8560,7 +8692,7 @@ var NetworkServiceImpl = class {
8560
8692
  return EffectEx.streamFromEmitter((emit) => {
8561
8693
  const ctx = Context.default(void 0, {
8562
8694
  "~LogMeta": "~LogMeta",
8563
- F: __dxlog_file$12,
8695
+ F: __dxlog_file$13,
8564
8696
  L: 121
8565
8697
  });
8566
8698
  let unsubscribe;
@@ -8621,7 +8753,7 @@ var AutomergeSpaceState = class extends Resource {
8621
8753
  };
8622
8754
  //#endregion
8623
8755
  //#region src/internal/spaces/epoch-migrations.ts
8624
- var __dxlog_file$11 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/epoch-migrations.ts";
8756
+ var __dxlog_file$12 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/epoch-migrations.ts";
8625
8757
  var LOAD_DOC_TIMEOUT = 1e4;
8626
8758
  var runEpochMigration = async (ctx, context) => {
8627
8759
  switch (context.migration) {
@@ -8641,7 +8773,7 @@ var runEpochMigration = async (ctx, context) => {
8641
8773
  const rootLease = _usingCtx3.u(await context.echoHost.loadDoc(ctx, context.currentRoot, { timeout: LOAD_DOC_TIMEOUT }));
8642
8774
  invariant(rootLease, "Automerge root document must load for history prune migration.", {
8643
8775
  "~LogMeta": "~LogMeta",
8644
- F: __dxlog_file$11,
8776
+ F: __dxlog_file$12,
8645
8777
  L: 50,
8646
8778
  S: void 0,
8647
8779
  A: ["rootLease", "'Automerge root document must load for history prune migration.'"]
@@ -8659,7 +8791,7 @@ var runEpochMigration = async (ctx, context) => {
8659
8791
  case SpacesService.Migration.enums.REPLACE_AUTOMERGE_ROOT:
8660
8792
  invariant(context.newAutomergeRoot, void 0, {
8661
8793
  "~LogMeta": "~LogMeta",
8662
- F: __dxlog_file$11,
8794
+ F: __dxlog_file$12,
8663
8795
  L: 64,
8664
8796
  S: void 0,
8665
8797
  A: ["context.newAutomergeRoot", ""]
@@ -8671,7 +8803,7 @@ var runEpochMigration = async (ctx, context) => {
8671
8803
  };
8672
8804
  //#endregion
8673
8805
  //#region src/internal/spaces/notarization-plugin.ts
8674
- var __dxlog_file$10 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/notarization-plugin.ts";
8806
+ var __dxlog_file$11 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/notarization-plugin.ts";
8675
8807
  var DEFAULT_RETRY_TIMEOUT = 1e3;
8676
8808
  var DEFAULT_SUCCESS_DELAY = 1e3;
8677
8809
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -8702,7 +8834,7 @@ var NotarizationPlugin = class extends Resource {
8702
8834
  const client = this._edgeClient;
8703
8835
  invariant(client, void 0, {
8704
8836
  "~LogMeta": "~LogMeta",
8705
- F: __dxlog_file$10,
8837
+ F: __dxlog_file$11,
8706
8838
  L: 119,
8707
8839
  S: this,
8708
8840
  A: ["client", ""]
@@ -8732,13 +8864,13 @@ var NotarizationPlugin = class extends Resource {
8732
8864
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY, edgeRetryJitter }) {
8733
8865
  log("notarize", { credentials }, {
8734
8866
  "~LogMeta": "~LogMeta",
8735
- F: __dxlog_file$10,
8867
+ F: __dxlog_file$11,
8736
8868
  L: 161,
8737
8869
  S: this
8738
8870
  });
8739
8871
  invariant(credentials.every((credential) => credential.id), "Credentials must have an id", {
8740
8872
  "~LogMeta": "~LogMeta",
8741
- F: __dxlog_file$10,
8873
+ F: __dxlog_file$11,
8742
8874
  L: 162,
8743
8875
  S: this,
8744
8876
  A: ["credentials.every((credential) => credential.id)", "'Credentials must have an id'"]
@@ -8747,7 +8879,7 @@ var NotarizationPlugin = class extends Resource {
8747
8879
  const ctx = this._ctx.derive({ onError: (err) => {
8748
8880
  log.warn("Notarization error", { err }, {
8749
8881
  "~LogMeta": "~LogMeta",
8750
- F: __dxlog_file$10,
8882
+ F: __dxlog_file$11,
8751
8883
  L: 170,
8752
8884
  S: this
8753
8885
  });
@@ -8774,7 +8906,7 @@ var NotarizationPlugin = class extends Resource {
8774
8906
  ]);
8775
8907
  log("done", void 0, {
8776
8908
  "~LogMeta": "~LogMeta",
8777
- F: __dxlog_file$10,
8909
+ F: __dxlog_file$11,
8778
8910
  L: 197,
8779
8911
  S: this
8780
8912
  });
@@ -8791,7 +8923,7 @@ var NotarizationPlugin = class extends Resource {
8791
8923
  if (!peer) {
8792
8924
  log.info("Exhausted all peers to notarize with", { retryIn: retryTimeout }, {
8793
8925
  "~LogMeta": "~LogMeta",
8794
- F: __dxlog_file$10,
8926
+ F: __dxlog_file$11,
8795
8927
  L: 220,
8796
8928
  S: this
8797
8929
  });
@@ -8805,14 +8937,14 @@ var NotarizationPlugin = class extends Resource {
8805
8937
  credentialId: credentials.map((credential) => credential.id)
8806
8938
  }, {
8807
8939
  "~LogMeta": "~LogMeta",
8808
- F: __dxlog_file$10,
8940
+ F: __dxlog_file$11,
8809
8941
  L: 227,
8810
8942
  S: this
8811
8943
  });
8812
8944
  await peer.rpc.NotarizationService.notarize(create(NotarizeRequestSchema, { credentials: credentials.filter((credential) => !this._processedCredentials.has(requirePublicKey(credential.id))) }));
8813
8945
  log("success", void 0, {
8814
8946
  "~LogMeta": "~LogMeta",
8815
- F: __dxlog_file$10,
8947
+ F: __dxlog_file$11,
8816
8948
  L: 235,
8817
8949
  S: this
8818
8950
  });
@@ -8820,7 +8952,7 @@ var NotarizationPlugin = class extends Resource {
8820
8952
  } catch (err) {
8821
8953
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) log.info("error notarizing (recoverable)", err, {
8822
8954
  "~LogMeta": "~LogMeta",
8823
- F: __dxlog_file$10,
8955
+ F: __dxlog_file$11,
8824
8956
  L: 240,
8825
8957
  S: this
8826
8958
  });
@@ -8844,7 +8976,7 @@ var NotarizationPlugin = class extends Resource {
8844
8976
  } });
8845
8977
  log("edge notarization success", void 0, {
8846
8978
  "~LogMeta": "~LogMeta",
8847
- F: __dxlog_file$10,
8979
+ F: __dxlog_file$11,
8848
8980
  L: 269,
8849
8981
  S: this
8850
8982
  });
@@ -8866,7 +8998,7 @@ var NotarizationPlugin = class extends Resource {
8866
8998
  setWriter(writer) {
8867
8999
  invariant(!this._writer, "Writer already set.", {
8868
9000
  "~LogMeta": "~LogMeta",
8869
- F: __dxlog_file$10,
9001
+ F: __dxlog_file$11,
8870
9002
  L: 290,
8871
9003
  S: this,
8872
9004
  A: ["!this._writer", "'Writer already set.'"]
@@ -8898,7 +9030,7 @@ var NotarizationPlugin = class extends Resource {
8898
9030
  if (!credentials.length) {
8899
9031
  log("edge did not return credentials for notarization", void 0, {
8900
9032
  "~LogMeta": "~LogMeta",
8901
- F: __dxlog_file$10,
9033
+ F: __dxlog_file$11,
8902
9034
  L: 327,
8903
9035
  S: this
8904
9036
  });
@@ -8906,7 +9038,7 @@ var NotarizationPlugin = class extends Resource {
8906
9038
  }
8907
9039
  log("got edge credentials for notarization", { count: credentials.length }, {
8908
9040
  "~LogMeta": "~LogMeta",
8909
- F: __dxlog_file$10,
9041
+ F: __dxlog_file$11,
8910
9042
  L: 331,
8911
9043
  S: this
8912
9044
  });
@@ -8917,7 +9049,7 @@ var NotarizationPlugin = class extends Resource {
8917
9049
  await this._notarizeCredentials(writer, decodedCredentials);
8918
9050
  log.info("notarized edge credentials", { count: decodedCredentials.length }, {
8919
9051
  "~LogMeta": "~LogMeta",
8920
- F: __dxlog_file$10,
9052
+ F: __dxlog_file$11,
8921
9053
  L: 340,
8922
9054
  S: this
8923
9055
  });
@@ -8951,7 +9083,7 @@ var NotarizationPlugin = class extends Resource {
8951
9083
  onOpen: async () => {
8952
9084
  log("extension opened", { peer: extension.localPeerId }, {
8953
9085
  "~LogMeta": "~LogMeta",
8954
- F: __dxlog_file$10,
9086
+ F: __dxlog_file$11,
8955
9087
  L: 381,
8956
9088
  S: this
8957
9089
  });
@@ -8961,7 +9093,7 @@ var NotarizationPlugin = class extends Resource {
8961
9093
  onClose: async () => {
8962
9094
  log("extension closed", { peer: extension.localPeerId }, {
8963
9095
  "~LogMeta": "~LogMeta",
8964
- F: __dxlog_file$10,
9096
+ F: __dxlog_file$11,
8965
9097
  L: 386,
8966
9098
  S: this
8967
9099
  });
@@ -8978,7 +9110,7 @@ var NotarizationPlugin = class extends Resource {
8978
9110
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
8979
9111
  }, {
8980
9112
  "~LogMeta": "~LogMeta",
8981
- F: __dxlog_file$10,
9113
+ F: __dxlog_file$11,
8982
9114
  L: 398,
8983
9115
  S: this
8984
9116
  });
@@ -8991,13 +9123,13 @@ __decorate([logInfo], NotarizationPlugin.prototype, "_spaceId", void 0);
8991
9123
  var handleEdgeError = (error) => {
8992
9124
  if (!(error instanceof EdgeCallFailedError) || error.data) log.catch(error, void 0, {
8993
9125
  "~LogMeta": "~LogMeta",
8994
- F: __dxlog_file$10,
9126
+ F: __dxlog_file$11,
8995
9127
  L: 412,
8996
9128
  S: void 0
8997
9129
  });
8998
9130
  else log.info("Edge notarization failure", { message: error.message }, {
8999
9131
  "~LogMeta": "~LogMeta",
9000
- F: __dxlog_file$10,
9132
+ F: __dxlog_file$11,
9001
9133
  L: 414,
9002
9134
  S: void 0
9003
9135
  });
@@ -9028,14 +9160,14 @@ var NotarizationTeleportExtension = class extends RpcExtension {
9028
9160
  };
9029
9161
  //#endregion
9030
9162
  //#region src/internal/spaces/data-space.ts
9031
- var __dxlog_file$9 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/data-space.ts";
9163
+ var __dxlog_file$10 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/data-space.ts";
9032
9164
  var ROOT_DOC_LOAD_ATTEMPT_TIMEOUT = 2e4;
9033
9165
  var ROOT_DOC_LOAD_RETRY_INITIAL_DELAY = 1e3;
9034
9166
  var ROOT_DOC_LOAD_RETRY_MAX_DELAY = 3e4;
9035
9167
  var DataSpace = class DataSpace {
9036
9168
  _ctx = new Context(void 0, {
9037
9169
  "~LogMeta": "~LogMeta",
9038
- F: __dxlog_file$9,
9170
+ F: __dxlog_file$10,
9039
9171
  L: 104
9040
9172
  });
9041
9173
  _inner;
@@ -9094,7 +9226,7 @@ var DataSpace = class DataSpace {
9094
9226
  this._state = params.initialState;
9095
9227
  log("new state", { state: SpaceState[this._state] }, {
9096
9228
  "~LogMeta": "~LogMeta",
9097
- F: __dxlog_file$9,
9229
+ F: __dxlog_file$10,
9098
9230
  L: 181,
9099
9231
  S: this
9100
9232
  });
@@ -9153,7 +9285,7 @@ var DataSpace = class DataSpace {
9153
9285
  this._state = SpaceState.SPACE_CONTROL_ONLY;
9154
9286
  log("new state", { state: SpaceState[this._state] }, {
9155
9287
  "~LogMeta": "~LogMeta",
9156
- F: __dxlog_file$9,
9288
+ F: __dxlog_file$10,
9157
9289
  L: 259,
9158
9290
  S: this
9159
9291
  });
@@ -9171,14 +9303,14 @@ var DataSpace = class DataSpace {
9171
9303
  this._state = SpaceState.SPACE_CLOSED;
9172
9304
  log("new state", { state: SpaceState[this._state] }, {
9173
9305
  "~LogMeta": "~LogMeta",
9174
- F: __dxlog_file$9,
9306
+ F: __dxlog_file$10,
9175
9307
  L: 279,
9176
9308
  S: this
9177
9309
  });
9178
9310
  await this._ctx.dispose();
9179
9311
  this._ctx = new Context(void 0, {
9180
9312
  "~LogMeta": "~LogMeta",
9181
- F: __dxlog_file$9,
9313
+ F: __dxlog_file$10,
9182
9314
  L: 281
9183
9315
  });
9184
9316
  if (this._edgeFeedReplicator) this.inner.protocol.feedAdded.remove(this._onFeedAdded);
@@ -9212,7 +9344,7 @@ var DataSpace = class DataSpace {
9212
9344
  if (err instanceof CancelledError || err instanceof ContextDisposedError) {
9213
9345
  log("data pipeline initialization cancelled", err, {
9214
9346
  "~LogMeta": "~LogMeta",
9215
- F: __dxlog_file$9,
9347
+ F: __dxlog_file$10,
9216
9348
  L: 321,
9217
9349
  S: this
9218
9350
  });
@@ -9220,14 +9352,14 @@ var DataSpace = class DataSpace {
9220
9352
  }
9221
9353
  log.error("Error initializing data pipeline", err, {
9222
9354
  "~LogMeta": "~LogMeta",
9223
- F: __dxlog_file$9,
9355
+ F: __dxlog_file$10,
9224
9356
  L: 325,
9225
9357
  S: this
9226
9358
  });
9227
9359
  this._state = SpaceState.SPACE_ERROR;
9228
9360
  log("new state", { state: SpaceState[this._state] }, {
9229
9361
  "~LogMeta": "~LogMeta",
9230
- F: __dxlog_file$9,
9362
+ F: __dxlog_file$10,
9231
9363
  L: 327,
9232
9364
  S: this
9233
9365
  });
@@ -9243,13 +9375,13 @@ var DataSpace = class DataSpace {
9243
9375
  this._state = SpaceState.SPACE_INITIALIZING;
9244
9376
  log("new state", { state: SpaceState[this._state] }, {
9245
9377
  "~LogMeta": "~LogMeta",
9246
- F: __dxlog_file$9,
9378
+ F: __dxlog_file$10,
9247
9379
  L: 343,
9248
9380
  S: this
9249
9381
  });
9250
9382
  log("initializing control pipeline", void 0, {
9251
9383
  "~LogMeta": "~LogMeta",
9252
- F: __dxlog_file$9,
9384
+ F: __dxlog_file$10,
9253
9385
  L: 345,
9254
9386
  S: this
9255
9387
  });
@@ -9258,14 +9390,14 @@ var DataSpace = class DataSpace {
9258
9390
  const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState.SPACE_READY);
9259
9391
  log("initializing automerge root", void 0, {
9260
9392
  "~LogMeta": "~LogMeta",
9261
- F: __dxlog_file$9,
9393
+ F: __dxlog_file$10,
9262
9394
  L: 353,
9263
9395
  S: this
9264
9396
  });
9265
9397
  if (this._echoHost.spaces.some((s) => s.spaceId === this.id)) try {
9266
9398
  log("opening persisted space root", { spaceId: this.id }, {
9267
9399
  "~LogMeta": "~LogMeta",
9268
- F: __dxlog_file$9,
9400
+ F: __dxlog_file$10,
9269
9401
  L: 357,
9270
9402
  S: this
9271
9403
  });
@@ -9281,7 +9413,7 @@ var DataSpace = class DataSpace {
9281
9413
  err
9282
9414
  }, {
9283
9415
  "~LogMeta": "~LogMeta",
9284
- F: __dxlog_file$9,
9416
+ F: __dxlog_file$10,
9285
9417
  L: 367,
9286
9418
  S: this
9287
9419
  });
@@ -9289,14 +9421,14 @@ var DataSpace = class DataSpace {
9289
9421
  this._automergeSpaceState.startProcessingRootDocs();
9290
9422
  log("waiting for space to be ready", void 0, {
9291
9423
  "~LogMeta": "~LogMeta",
9292
- F: __dxlog_file$9,
9424
+ F: __dxlog_file$10,
9293
9425
  L: 374,
9294
9426
  S: this
9295
9427
  });
9296
9428
  await ready;
9297
9429
  log("space is ready", void 0, {
9298
9430
  "~LogMeta": "~LogMeta",
9299
- F: __dxlog_file$9,
9431
+ F: __dxlog_file$10,
9300
9432
  L: 376,
9301
9433
  S: this
9302
9434
  });
@@ -9304,7 +9436,7 @@ var DataSpace = class DataSpace {
9304
9436
  async *getAllDocuments() {
9305
9437
  invariant(this._databaseRoot, "Space is not ready", {
9306
9438
  "~LogMeta": "~LogMeta",
9307
- F: __dxlog_file$9,
9439
+ F: __dxlog_file$10,
9308
9440
  L: 380,
9309
9441
  S: this,
9310
9442
  A: ["this._databaseRoot", "'Space is not ready'"]
@@ -9329,7 +9461,7 @@ var DataSpace = class DataSpace {
9329
9461
  this._state = SpaceState.SPACE_READY;
9330
9462
  log("new state", { state: SpaceState[this._state] }, {
9331
9463
  "~LogMeta": "~LogMeta",
9332
- F: __dxlog_file$9,
9464
+ F: __dxlog_file$10,
9333
9465
  L: 403,
9334
9466
  S: this
9335
9467
  });
@@ -9346,7 +9478,7 @@ var DataSpace = class DataSpace {
9346
9478
  await this._createWritableFeeds();
9347
9479
  log("writable feeds created", void 0, {
9348
9480
  "~LogMeta": "~LogMeta",
9349
- F: __dxlog_file$9,
9481
+ F: __dxlog_file$10,
9350
9482
  L: 420,
9351
9483
  S: this
9352
9484
  });
@@ -9372,7 +9504,7 @@ var DataSpace = class DataSpace {
9372
9504
  err
9373
9505
  }, {
9374
9506
  "~LogMeta": "~LogMeta",
9375
- F: __dxlog_file$9,
9507
+ F: __dxlog_file$10,
9376
9508
  L: 454,
9377
9509
  S: this
9378
9510
  });
@@ -9413,7 +9545,7 @@ var DataSpace = class DataSpace {
9413
9545
  try {
9414
9546
  log("will notarize credentials for feed admission", { count: credentials.length }, {
9415
9547
  "~LogMeta": "~LogMeta",
9416
- F: __dxlog_file$9,
9548
+ F: __dxlog_file$10,
9417
9549
  L: 499,
9418
9550
  S: this
9419
9551
  });
@@ -9424,7 +9556,7 @@ var DataSpace = class DataSpace {
9424
9556
  });
9425
9557
  log("credentials notarized", void 0, {
9426
9558
  "~LogMeta": "~LogMeta",
9427
- F: __dxlog_file$9,
9559
+ F: __dxlog_file$10,
9428
9560
  L: 503,
9429
9561
  S: this
9430
9562
  });
@@ -9432,7 +9564,7 @@ var DataSpace = class DataSpace {
9432
9564
  if (err instanceof ContextDisposedError) return;
9433
9565
  log.error("error notarizing credentials for feed admission", err, {
9434
9566
  "~LogMeta": "~LogMeta",
9435
- F: __dxlog_file$9,
9567
+ F: __dxlog_file$10,
9436
9568
  L: 508,
9437
9569
  S: this
9438
9570
  });
@@ -9469,7 +9601,7 @@ var DataSpace = class DataSpace {
9469
9601
  delay
9470
9602
  }, {
9471
9603
  "~LogMeta": "~LogMeta",
9472
- F: __dxlog_file$9,
9604
+ F: __dxlog_file$10,
9473
9605
  L: 548,
9474
9606
  S: this
9475
9607
  });
@@ -9484,7 +9616,7 @@ var DataSpace = class DataSpace {
9484
9616
  rootUrl
9485
9617
  }, {
9486
9618
  "~LogMeta": "~LogMeta",
9487
- F: __dxlog_file$9,
9619
+ F: __dxlog_file$10,
9488
9620
  L: 563,
9489
9621
  S: this
9490
9622
  });
@@ -9501,7 +9633,7 @@ var DataSpace = class DataSpace {
9501
9633
  rootUrl
9502
9634
  }, {
9503
9635
  "~LogMeta": "~LogMeta",
9504
- F: __dxlog_file$9,
9636
+ F: __dxlog_file$10,
9505
9637
  L: 575,
9506
9638
  S: this
9507
9639
  });
@@ -9537,7 +9669,7 @@ var DataSpace = class DataSpace {
9537
9669
  err
9538
9670
  }, {
9539
9671
  "~LogMeta": "~LogMeta",
9540
- F: __dxlog_file$9,
9672
+ F: __dxlog_file$10,
9541
9673
  L: 615,
9542
9674
  S: this
9543
9675
  });
@@ -9597,7 +9729,7 @@ var DataSpace = class DataSpace {
9597
9729
  this._state = SpaceState.SPACE_INACTIVE;
9598
9730
  log("new state", { state: SpaceState[this._state] }, {
9599
9731
  "~LogMeta": "~LogMeta",
9600
- F: __dxlog_file$9,
9732
+ F: __dxlog_file$10,
9601
9733
  L: 692,
9602
9734
  S: this
9603
9735
  });
@@ -9616,7 +9748,7 @@ var DataSpace = class DataSpace {
9616
9748
  this._state = SpaceState.SPACE_DELETED;
9617
9749
  log("new state", { state: SpaceState[this._state] }, {
9618
9750
  "~LogMeta": "~LogMeta",
9619
- F: __dxlog_file$9,
9751
+ F: __dxlog_file$10,
9620
9752
  L: 710,
9621
9753
  S: this
9622
9754
  });
@@ -9709,7 +9841,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot, tags, m
9709
9841
  };
9710
9842
  //#endregion
9711
9843
  //#region src/internal/spaces/data-space-manager.ts
9712
- var __dxlog_file$8 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/data-space-manager.ts";
9844
+ var __dxlog_file$9 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/data-space-manager.ts";
9713
9845
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
9714
9846
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
9715
9847
  /**
@@ -9824,13 +9956,13 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9824
9956
  async _open(ctx) {
9825
9957
  log("open", void 0, {
9826
9958
  "~LogMeta": "~LogMeta",
9827
- F: __dxlog_file$8,
9959
+ F: __dxlog_file$9,
9828
9960
  L: 296,
9829
9961
  S: this
9830
9962
  });
9831
9963
  log("metadata loaded", { spaces: this._metadataStore.spaces.length }, {
9832
9964
  "~LogMeta": "~LogMeta",
9833
- F: __dxlog_file$8,
9965
+ F: __dxlog_file$9,
9834
9966
  L: 297,
9835
9967
  S: this
9836
9968
  });
@@ -9840,7 +9972,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9840
9972
  if (spaceMetadata.state === SpaceState.SPACE_DELETED || this.isSpaceDeleted(requirePublicKey(spaceMetadata.key))) {
9841
9973
  log("skipping deleted space", { spaceKey: spaceMetadata.key }, {
9842
9974
  "~LogMeta": "~LogMeta",
9843
- F: __dxlog_file$8,
9975
+ F: __dxlog_file$9,
9844
9976
  L: 307,
9845
9977
  S: this
9846
9978
  });
@@ -9848,7 +9980,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9848
9980
  }
9849
9981
  log("load space", { spaceMetadata }, {
9850
9982
  "~LogMeta": "~LogMeta",
9851
- F: __dxlog_file$8,
9983
+ F: __dxlog_file$9,
9852
9984
  L: 310,
9853
9985
  S: this
9854
9986
  });
@@ -9860,7 +9992,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9860
9992
  err
9861
9993
  }, {
9862
9994
  "~LogMeta": "~LogMeta",
9863
- F: __dxlog_file$8,
9995
+ F: __dxlog_file$9,
9864
9996
  L: 317,
9865
9997
  S: this
9866
9998
  });
@@ -9869,7 +10001,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9869
10001
  for (const space of spacesToActivate) {
9870
10002
  log("auto-activating space", { spaceKey: space.key }, {
9871
10003
  "~LogMeta": "~LogMeta",
9872
- F: __dxlog_file$8,
10004
+ F: __dxlog_file$9,
9873
10005
  L: 323,
9874
10006
  S: this
9875
10007
  });
@@ -9879,7 +10011,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9879
10011
  err
9880
10012
  }, {
9881
10013
  "~LogMeta": "~LogMeta",
9882
- F: __dxlog_file$8,
10014
+ F: __dxlog_file$9,
9883
10015
  L: 325,
9884
10016
  S: this
9885
10017
  });
@@ -9890,7 +10022,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9890
10022
  async _close(ctx) {
9891
10023
  log("close", void 0, {
9892
10024
  "~LogMeta": "~LogMeta",
9893
- F: __dxlog_file$8,
10025
+ F: __dxlog_file$9,
9894
10026
  L: 334,
9895
10027
  S: this
9896
10028
  });
@@ -9924,7 +10056,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9924
10056
  spaceKey
9925
10057
  }, {
9926
10058
  "~LogMeta": "~LogMeta",
9927
- F: __dxlog_file$8,
10059
+ F: __dxlog_file$9,
9928
10060
  L: 381,
9929
10061
  S: this
9930
10062
  });
@@ -9932,7 +10064,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9932
10064
  if (options.documents) {
9933
10065
  invariant(Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId)), "Invalid document IDs", {
9934
10066
  "~LogMeta": "~LogMeta",
9935
- F: __dxlog_file$8,
10067
+ F: __dxlog_file$9,
9936
10068
  L: 386,
9937
10069
  S: this,
9938
10070
  A: ["Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId))", "'Invalid document IDs'"]
@@ -9942,7 +10074,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9942
10074
  var _usingCtx3 = _usingCtx();
9943
10075
  log("creating document...", { documentId }, {
9944
10076
  "~LogMeta": "~LogMeta",
9945
- F: __dxlog_file$8,
10077
+ F: __dxlog_file$9,
9946
10078
  L: 393,
9947
10079
  S: this
9948
10080
  });
@@ -9964,7 +10096,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9964
10096
  }
9965
10097
  log("opening space...", { spaceKey }, {
9966
10098
  "~LogMeta": "~LogMeta",
9967
- F: __dxlog_file$8,
10099
+ F: __dxlog_file$9,
9968
10100
  L: 415,
9969
10101
  S: this
9970
10102
  });
@@ -9976,7 +10108,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9976
10108
  const rootDocLease = _usingCtx4.u(await this._echoHost.loadDoc(ctx, newRootDocId));
9977
10109
  invariant(rootDocLease, "Root document must be available after import.", {
9978
10110
  "~LogMeta": "~LogMeta",
9979
- F: __dxlog_file$8,
10111
+ F: __dxlog_file$9,
9980
10112
  L: 423,
9981
10113
  S: this,
9982
10114
  A: ["rootDocLease", "'Root document must be available after import.'"]
@@ -9992,7 +10124,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
9992
10124
  await this._echoHost.flush(ctx);
9993
10125
  log("constructing space...", { spaceKey }, {
9994
10126
  "~LogMeta": "~LogMeta",
9995
- F: __dxlog_file$8,
10127
+ F: __dxlog_file$9,
9996
10128
  L: 432,
9997
10129
  S: this
9998
10130
  });
@@ -10000,7 +10132,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10000
10132
  await space.open(ctx);
10001
10133
  log("adding space...", { spaceKey }, {
10002
10134
  "~LogMeta": "~LogMeta",
10003
- F: __dxlog_file$8,
10135
+ F: __dxlog_file$9,
10004
10136
  L: 437,
10005
10137
  S: this
10006
10138
  });
@@ -10009,7 +10141,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10009
10141
  const memberCredential = credentials[1];
10010
10142
  invariant(getCredentialAssertion(memberCredential).$typeName === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
10011
10143
  "~LogMeta": "~LogMeta",
10012
- F: __dxlog_file$8,
10144
+ F: __dxlog_file$9,
10013
10145
  L: 451,
10014
10146
  S: this,
10015
10147
  A: ["getCredentialAssertion(memberCredential).$typeName === 'dxos.halo.credentials.SpaceMember'", "'Invalid credential'"]
@@ -10021,7 +10153,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10021
10153
  spaceKey
10022
10154
  }, {
10023
10155
  "~LogMeta": "~LogMeta",
10024
- F: __dxlog_file$8,
10156
+ F: __dxlog_file$9,
10025
10157
  L: 459,
10026
10158
  S: this
10027
10159
  });
@@ -10036,27 +10168,27 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10036
10168
  async acceptSpace(ctx, opts) {
10037
10169
  log("accept space", { opts }, {
10038
10170
  "~LogMeta": "~LogMeta",
10039
- F: __dxlog_file$8,
10171
+ F: __dxlog_file$9,
10040
10172
  L: 474,
10041
10173
  S: this
10042
10174
  });
10043
10175
  invariant(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
10044
10176
  "~LogMeta": "~LogMeta",
10045
- F: __dxlog_file$8,
10177
+ F: __dxlog_file$9,
10046
10178
  L: 475,
10047
10179
  S: this,
10048
10180
  A: ["this._lifecycleState === LifecycleState.OPEN", "'Not open.'"]
10049
10181
  });
10050
10182
  invariant(!this._spaces.has(opts.spaceKey), "Space already exists.", {
10051
10183
  "~LogMeta": "~LogMeta",
10052
- F: __dxlog_file$8,
10184
+ F: __dxlog_file$9,
10053
10185
  L: 476,
10054
10186
  S: this,
10055
10187
  A: ["!this._spaces.has(opts.spaceKey)", "'Space already exists.'"]
10056
10188
  });
10057
10189
  invariant(!this.isSpaceDeleted(opts.spaceKey), "Cannot accept a deleted space.", {
10058
10190
  "~LogMeta": "~LogMeta",
10059
- F: __dxlog_file$8,
10191
+ F: __dxlog_file$9,
10060
10192
  L: 477,
10061
10193
  S: this,
10062
10194
  A: ["!this.isSpaceDeleted(opts.spaceKey)", "'Cannot accept a deleted space.'"]
@@ -10101,7 +10233,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10101
10233
  refs
10102
10234
  }, {
10103
10235
  "~LogMeta": "~LogMeta",
10104
- F: __dxlog_file$8,
10236
+ F: __dxlog_file$9,
10105
10237
  L: 540,
10106
10238
  S: this
10107
10239
  });
@@ -10112,7 +10244,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10112
10244
  err
10113
10245
  }, {
10114
10246
  "~LogMeta": "~LogMeta",
10115
- F: __dxlog_file$8,
10247
+ F: __dxlog_file$9,
10116
10248
  L: 542,
10117
10249
  S: this
10118
10250
  });
@@ -10126,7 +10258,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10126
10258
  refs
10127
10259
  }, {
10128
10260
  "~LogMeta": "~LogMeta",
10129
- F: __dxlog_file$8,
10261
+ F: __dxlog_file$9,
10130
10262
  L: 551,
10131
10263
  S: this
10132
10264
  });
@@ -10142,7 +10274,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10142
10274
  err
10143
10275
  }, {
10144
10276
  "~LogMeta": "~LogMeta",
10145
- F: __dxlog_file$8,
10277
+ F: __dxlog_file$9,
10146
10278
  L: 569,
10147
10279
  S: this
10148
10280
  });
@@ -10167,7 +10299,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10167
10299
  await this._edgeHttpClient.recordSpaceRoot(this._ctx, space.id, { rootDocumentUrl: refs.spaceRootDocUrl });
10168
10300
  log("reported the space root to edge", { spaceId: space.id }, {
10169
10301
  "~LogMeta": "~LogMeta",
10170
- F: __dxlog_file$8,
10302
+ F: __dxlog_file$9,
10171
10303
  L: 603,
10172
10304
  S: this
10173
10305
  });
@@ -10178,7 +10310,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10178
10310
  err
10179
10311
  }, {
10180
10312
  "~LogMeta": "~LogMeta",
10181
- F: __dxlog_file$8,
10313
+ F: __dxlog_file$9,
10182
10314
  L: 606,
10183
10315
  S: this
10184
10316
  });
@@ -10190,7 +10322,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10190
10322
  err
10191
10323
  }, {
10192
10324
  "~LogMeta": "~LogMeta",
10193
- F: __dxlog_file$8,
10325
+ F: __dxlog_file$9,
10194
10326
  L: 610,
10195
10327
  S: this
10196
10328
  });
@@ -10259,7 +10391,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10259
10391
  }));
10260
10392
  log("deleting all spaces", { count: spaces.length }, {
10261
10393
  "~LogMeta": "~LogMeta",
10262
- F: __dxlog_file$8,
10394
+ F: __dxlog_file$9,
10263
10395
  L: 703,
10264
10396
  S: this
10265
10397
  });
@@ -10289,7 +10421,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10289
10421
  err
10290
10422
  }, {
10291
10423
  "~LogMeta": "~LogMeta",
10292
- F: __dxlog_file$8,
10424
+ F: __dxlog_file$9,
10293
10425
  L: 741,
10294
10426
  S: this
10295
10427
  }));
@@ -10302,7 +10434,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10302
10434
  const space = this._spaceManager.spaces.get(options.spaceKey);
10303
10435
  invariant(space, void 0, {
10304
10436
  "~LogMeta": "~LogMeta",
10305
- F: __dxlog_file$8,
10437
+ F: __dxlog_file$9,
10306
10438
  L: 752,
10307
10439
  S: this,
10308
10440
  A: ["space", ""]
@@ -10324,7 +10456,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10324
10456
  const spaceMemberCredential = credentialOfPayload(credentials[0]);
10325
10457
  invariant(getCredentialAssertion(spaceMemberCredential).$typeName === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
10326
10458
  "~LogMeta": "~LogMeta",
10327
- F: __dxlog_file$8,
10459
+ F: __dxlog_file$9,
10328
10460
  L: 778,
10329
10461
  S: this,
10330
10462
  A: ["getCredentialAssertion(spaceMemberCredential).$typeName === 'dxos.halo.credentials.SpaceMember'", "'Invalid credential'"]
@@ -10360,7 +10492,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10360
10492
  const space = this._spaces.get(spaceKey);
10361
10493
  invariant(space, "Space not found.", {
10362
10494
  "~LogMeta": "~LogMeta",
10363
- F: __dxlog_file$8,
10495
+ F: __dxlog_file$9,
10364
10496
  L: 822,
10365
10497
  S: this,
10366
10498
  A: ["space", "'Space not found.'"]
@@ -10377,7 +10509,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10377
10509
  async _constructSpace(ctx, metadata) {
10378
10510
  log("construct space", { metadata }, {
10379
10511
  "~LogMeta": "~LogMeta",
10380
- F: __dxlog_file$8,
10512
+ F: __dxlog_file$9,
10381
10513
  L: 841,
10382
10514
  S: this
10383
10515
  });
@@ -10411,7 +10543,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10411
10543
  } catch (err) {
10412
10544
  log.warn("error on authorized connection", { err }, {
10413
10545
  "~LogMeta": "~LogMeta",
10414
- F: __dxlog_file$8,
10546
+ F: __dxlog_file$9,
10415
10547
  L: 884,
10416
10548
  S: this
10417
10549
  });
@@ -10421,7 +10553,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10421
10553
  onAuthFailure: () => {
10422
10554
  log.warn("auth failure", void 0, {
10423
10555
  "~LogMeta": "~LogMeta",
10424
- F: __dxlog_file$8,
10556
+ F: __dxlog_file$9,
10425
10557
  L: 889,
10426
10558
  S: this
10427
10559
  });
@@ -10450,7 +10582,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10450
10582
  beforeReady: async () => {
10451
10583
  log("before space ready", { space: space.key }, {
10452
10584
  "~LogMeta": "~LogMeta",
10453
- F: __dxlog_file$8,
10585
+ F: __dxlog_file$9,
10454
10586
  L: 916,
10455
10587
  S: this
10456
10588
  });
@@ -10461,7 +10593,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10461
10593
  open: this._lifecycleState === LifecycleState.OPEN
10462
10594
  }, {
10463
10595
  "~LogMeta": "~LogMeta",
10464
- F: __dxlog_file$8,
10596
+ F: __dxlog_file$9,
10465
10597
  L: 919,
10466
10598
  S: this
10467
10599
  });
@@ -10474,7 +10606,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10474
10606
  beforeClose: async () => {
10475
10607
  log("before space close", { space: space.key }, {
10476
10608
  "~LogMeta": "~LogMeta",
10477
- F: __dxlog_file$8,
10609
+ F: __dxlog_file$9,
10478
10610
  L: 927,
10479
10611
  S: this
10480
10612
  });
@@ -10491,7 +10623,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10491
10623
  if (!setting || setting === EdgeReplicationSetting.ENABLED) await this._echoEdgeReplicator?.connectToSpace(this._ctx, dataSpace.id);
10492
10624
  else if (this._echoEdgeReplicator) log("not connecting edge replicator because of EdgeReplicationSetting", { spaceId: dataSpace.id }, {
10493
10625
  "~LogMeta": "~LogMeta",
10494
- F: __dxlog_file$8,
10626
+ F: __dxlog_file$9,
10495
10627
  L: 942,
10496
10628
  S: this
10497
10629
  });
@@ -10535,7 +10667,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10535
10667
  if (!replicator) {
10536
10668
  log.warn("p2p automerge replication disabled", { space: space.key }, {
10537
10669
  "~LogMeta": "~LogMeta",
10538
- F: __dxlog_file$8,
10670
+ F: __dxlog_file$9,
10539
10671
  L: 1020,
10540
10672
  S: this
10541
10673
  });
@@ -10565,7 +10697,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10565
10697
  closedSessions
10566
10698
  }, {
10567
10699
  "~LogMeta": "~LogMeta",
10568
- F: __dxlog_file$8,
10700
+ F: __dxlog_file$9,
10569
10701
  L: 1049,
10570
10702
  S: this
10571
10703
  });
@@ -10580,7 +10712,7 @@ var DataSpaceManager = class DataSpaceManager extends Resource {
10580
10712
  if (session != null) {
10581
10713
  log("closing a session with a removed peer", { peerId }, {
10582
10714
  "~LogMeta": "~LogMeta",
10583
- F: __dxlog_file$8,
10715
+ F: __dxlog_file$9,
10584
10716
  L: 1070,
10585
10717
  S: this
10586
10718
  });
@@ -10669,7 +10801,7 @@ var DataSpaceManagerLayer = (options = {}) => Layer.effect(ManagerService$1, Eff
10669
10801
  const ctx = yield* EffectEx.contextFromScope();
10670
10802
  yield* Effect.addFinalizer(() => Effect.promise(() => dataSpaceManager.close(Context.default(void 0, {
10671
10803
  "~LogMeta": "~LogMeta",
10672
- F: __dxlog_file$8,
10804
+ F: __dxlog_file$9,
10673
10805
  L: 1178
10674
10806
  }))));
10675
10807
  yield* Hook.on(IdentityAvailable, Effect.fn("DataSpaceManager.onIdentityAvailable")(function* ({ identity }) {
@@ -10799,7 +10931,7 @@ var buildDatabaseDirectoryFromObjects = (objects) => {
10799
10931
  };
10800
10932
  //#endregion
10801
10933
  //#region src/internal/space-export/serialized-space-writer.ts
10802
- var __dxlog_file$7 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space-export/serialized-space-writer.ts";
10934
+ var __dxlog_file$8 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space-export/serialized-space-writer.ts";
10803
10935
  var SERIALIZED_SPACE_VERSION = 1;
10804
10936
  var FEED_TYPENAME = "org.dxos.type.feed";
10805
10937
  var ATTR_ID = "id";
@@ -10846,7 +10978,7 @@ var orderObjJsonFields = (obj) => {
10846
10978
  * importer in {@link readSerializedSpaceArchive}.
10847
10979
  */
10848
10980
  var writeSerializedSpaceArchive = async (options) => {
10849
- const { space, echoHost, exportedBy } = options;
10981
+ const { space, echoHost, exportedBy, feedIds } = options;
10850
10982
  const rootUrl = space.automergeSpaceState.lastEpoch?.assertion.automergeRoot;
10851
10983
  assertState(rootUrl, "Space does not have a root URL");
10852
10984
  const databaseRoot = space.databaseRoot;
@@ -10854,8 +10986,8 @@ var writeSerializedSpaceArchive = async (options) => {
10854
10986
  const rootDoc = databaseRoot.doc();
10855
10987
  invariant(rootDoc, "Space database root document is not loaded", {
10856
10988
  "~LogMeta": "~LogMeta",
10857
- F: __dxlog_file$7,
10858
- L: 114,
10989
+ F: __dxlog_file$8,
10990
+ L: 116,
10859
10991
  S: void 0,
10860
10992
  A: ["rootDoc", "'Space database root document is not loaded'"]
10861
10993
  });
@@ -10865,14 +10997,14 @@ var writeSerializedSpaceArchive = async (options) => {
10865
10997
  var _usingCtx$3 = _usingCtx();
10866
10998
  const lease = _usingCtx$3.u(await echoHost.loadDoc(Context.default(void 0, {
10867
10999
  "~LogMeta": "~LogMeta",
10868
- F: __dxlog_file$7,
10869
- L: 121
11000
+ F: __dxlog_file$8,
11001
+ L: 123
10870
11002
  }), linkedUrl));
10871
11003
  if (!lease) {
10872
11004
  log.warn("linked document handle not available; skipping", { url: linkedUrl }, {
10873
11005
  "~LogMeta": "~LogMeta",
10874
- F: __dxlog_file$7,
10875
- L: 123,
11006
+ F: __dxlog_file$8,
11007
+ L: 125,
10876
11008
  S: void 0
10877
11009
  });
10878
11010
  continue;
@@ -10883,6 +11015,10 @@ var writeSerializedSpaceArchive = async (options) => {
10883
11015
  } finally {
10884
11016
  _usingCtx$3.d();
10885
11017
  }
11018
+ if (feedIds) {
11019
+ const selected = new Set(feedIds);
11020
+ objects.splice(0, objects.length, ...objects.filter((obj) => selected.has(obj.id) && isFeedObject(obj)));
11021
+ }
10886
11022
  const feeds = await exportFeedData(space, echoHost, objects);
10887
11023
  const serialized = {
10888
11024
  version: SERIALIZED_SPACE_VERSION,
@@ -10933,13 +11069,15 @@ var objectStructureToObjJson = (objectId, structure) => {
10933
11069
  Object.assign(result, structure.data);
10934
11070
  return result;
10935
11071
  };
11072
+ var isFeedObject = (obj) => {
11073
+ const typeDxn = obj[ATTR_TYPE];
11074
+ return typeDxn != null && DXN.isDXN(typeDxn) && DXN.getName(typeDxn) === FEED_TYPENAME;
11075
+ };
10936
11076
  var exportFeedData = async (space, echoHost, objects) => {
10937
11077
  const feeds = [];
10938
11078
  const spaceId = space.id;
10939
11079
  for (const obj of objects) {
10940
- if (obj[ATTR_TYPE] == null) continue;
10941
- const typeDxn = obj[ATTR_TYPE];
10942
- if ((DXN.isDXN(typeDxn) ? DXN.getName(typeDxn) : void 0) !== FEED_TYPENAME) continue;
11080
+ if (!isFeedObject(obj)) continue;
10943
11081
  const namespace = obj.namespace === "trace" ? "trace" : "data";
10944
11082
  try {
10945
11083
  const messages = await collectFeedMessages(echoHost, spaceId, obj.id, namespace);
@@ -10954,8 +11092,8 @@ var exportFeedData = async (space, echoHost, objects) => {
10954
11092
  error: err
10955
11093
  }, {
10956
11094
  "~LogMeta": "~LogMeta",
10957
- F: __dxlog_file$7,
10958
- L: 235,
11095
+ F: __dxlog_file$8,
11096
+ L: 242,
10959
11097
  S: void 0
10960
11098
  });
10961
11099
  }
@@ -10985,8 +11123,8 @@ var collectFeedMessages = async (echoHost, spaceId, feedId, namespace) => {
10985
11123
  error: err
10986
11124
  }, {
10987
11125
  "~LogMeta": "~LogMeta",
10988
- F: __dxlog_file$7,
10989
- L: 276,
11126
+ F: __dxlog_file$8,
11127
+ L: 283,
10990
11128
  S: void 0
10991
11129
  });
10992
11130
  return [];
@@ -11004,7 +11142,7 @@ var collectFeedMessages = async (echoHost, spaceId, feedId, namespace) => {
11004
11142
  };
11005
11143
  //#endregion
11006
11144
  //#region src/internal/space-export/space-archive-reader.ts
11007
- var __dxlog_file$6 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space-export/space-archive-reader.ts";
11145
+ var __dxlog_file$7 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/space-export/space-archive-reader.ts";
11008
11146
  var extractSpaceArchive = async (archive) => {
11009
11147
  const { Archive } = await import("@obsidize/tar-browserify");
11010
11148
  const { entries } = await Archive.extract(archive.contents);
@@ -11016,7 +11154,7 @@ var extractSpaceArchive = async (archive) => {
11016
11154
  const documentId = entry.fileName.replace(`${SpaceArchiveFileStructure.documents}/`, "").replace(/\.bin$/, "");
11017
11155
  invariant(!documentId.includes("/"), void 0, {
11018
11156
  "~LogMeta": "~LogMeta",
11019
- F: __dxlog_file$6,
11157
+ F: __dxlog_file$7,
11020
11158
  L: 42,
11021
11159
  S: void 0,
11022
11160
  A: ["!documentId.includes('/')", ""]
@@ -11024,7 +11162,7 @@ var extractSpaceArchive = async (archive) => {
11024
11162
  if (!entry.content || entry.content.byteLength === 0) {
11025
11163
  log.warn("skipping empty document in space archive", { documentId }, {
11026
11164
  "~LogMeta": "~LogMeta",
11027
- F: __dxlog_file$6,
11165
+ F: __dxlog_file$7,
11028
11166
  L: 45,
11029
11167
  S: void 0
11030
11168
  });
@@ -11043,14 +11181,14 @@ var extractSpaceArchive = async (archive) => {
11043
11181
  const [feedId, fileName] = pathParts;
11044
11182
  invariant(feedId, "Feed ID is required", {
11045
11183
  "~LogMeta": "~LogMeta",
11046
- F: __dxlog_file$6,
11184
+ F: __dxlog_file$7,
11047
11185
  L: 66,
11048
11186
  S: void 0,
11049
11187
  A: ["feedId", "'Feed ID is required'"]
11050
11188
  });
11051
11189
  invariant(fileName, "File name is required", {
11052
11190
  "~LogMeta": "~LogMeta",
11053
- F: __dxlog_file$6,
11191
+ F: __dxlog_file$7,
11054
11192
  L: 67,
11055
11193
  S: void 0,
11056
11194
  A: ["fileName", "'File name is required'"]
@@ -11063,7 +11201,7 @@ var extractSpaceArchive = async (archive) => {
11063
11201
  const chunkIndex = parseInt(chunkIndexStr, 10);
11064
11202
  invariant(!isNaN(chunkIndex), `Invalid chunk index: ${chunkIndexStr}`, {
11065
11203
  "~LogMeta": "~LogMeta",
11066
- F: __dxlog_file$6,
11204
+ F: __dxlog_file$7,
11067
11205
  L: 75,
11068
11206
  S: void 0,
11069
11207
  A: ["!isNaN(chunkIndex)", "`Invalid chunk index: ${chunkIndexStr}`"]
@@ -11089,7 +11227,7 @@ var extractSpaceArchive = async (archive) => {
11089
11227
  feedCount: Object.keys(feeds).length
11090
11228
  }, {
11091
11229
  "~LogMeta": "~LogMeta",
11092
- F: __dxlog_file$6,
11230
+ F: __dxlog_file$7,
11093
11231
  L: 98,
11094
11232
  S: void 0
11095
11233
  });
@@ -11177,7 +11315,7 @@ var SpaceArchiveWriter = class extends Resource {
11177
11315
  };
11178
11316
  //#endregion
11179
11317
  //#region src/internal/spaces/spaces-service.ts
11180
- var __dxlog_file$5 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/spaces-service.ts";
11318
+ var __dxlog_file$6 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/spaces/spaces-service.ts";
11181
11319
  /** Reads the space as the buf message the service returns. */
11182
11320
  var SpacesServiceImpl = class {
11183
11321
  _identityManager;
@@ -11196,8 +11334,8 @@ var SpacesServiceImpl = class {
11196
11334
  this._requireIdentity();
11197
11335
  const ctx = new Context(void 0, {
11198
11336
  "~LogMeta": "~LogMeta",
11199
- F: __dxlog_file$5,
11200
- L: 92
11337
+ F: __dxlog_file$6,
11338
+ L: 93
11201
11339
  });
11202
11340
  const space = await (await this._getDataSpaceManager()).createSpace(ctx, {
11203
11341
  tags: request?.tags,
@@ -11214,8 +11352,8 @@ var SpacesServiceImpl = class {
11214
11352
  try: async () => {
11215
11353
  const ctx = Context.default(void 0, {
11216
11354
  "~LogMeta": "~LogMeta",
11217
- F: __dxlog_file$5,
11218
- L: 112
11355
+ F: __dxlog_file$6,
11356
+ L: 113
11219
11357
  });
11220
11358
  const dataSpaceManager = await this._getDataSpaceManager();
11221
11359
  const space = dataSpaceManager.spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
@@ -11260,8 +11398,8 @@ var SpacesServiceImpl = class {
11260
11398
  const spaceMemberCredential = credentialOfPayload(credentials[0]);
11261
11399
  invariant(getCredentialAssertion(spaceMemberCredential).$typeName === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
11262
11400
  "~LogMeta": "~LogMeta",
11263
- F: __dxlog_file$5,
11264
- L: 169,
11401
+ F: __dxlog_file$6,
11402
+ L: 170,
11265
11403
  S: this,
11266
11404
  A: ["getCredentialAssertion(spaceMemberCredential).$typeName === 'dxos.halo.credentials.SpaceMember'", "'Invalid credential'"]
11267
11405
  });
@@ -11274,16 +11412,16 @@ var SpacesServiceImpl = class {
11274
11412
  return EffectEx.streamFromEmitter((emit) => {
11275
11413
  const ctx = Context.default(void 0, {
11276
11414
  "~LogMeta": "~LogMeta",
11277
- F: __dxlog_file$5,
11278
- L: 181
11415
+ F: __dxlog_file$6,
11416
+ L: 182
11279
11417
  });
11280
11418
  const scheduler = new UpdateScheduler(ctx, async () => {
11281
11419
  const dataSpaceManager = await this._getDataSpaceManager();
11282
11420
  const spaces = await Promise.all(Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space)));
11283
11421
  log("update", () => ({ ids: spaces.map((space) => space.id) }), {
11284
11422
  "~LogMeta": "~LogMeta",
11285
- F: __dxlog_file$5,
11286
- L: 189,
11423
+ F: __dxlog_file$6,
11424
+ L: 190,
11287
11425
  S: this
11288
11426
  });
11289
11427
  await this._updateMetrics();
@@ -11324,8 +11462,8 @@ var SpacesServiceImpl = class {
11324
11462
  const space = (await this._getDataSpaceManager()).spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
11325
11463
  invariant(message, "Post carries no message.", {
11326
11464
  "~LogMeta": "~LogMeta",
11327
- F: __dxlog_file$5,
11328
- L: 254,
11465
+ F: __dxlog_file$6,
11466
+ L: 255,
11329
11467
  S: this,
11330
11468
  A: ["message", "'Post carries no message.'"]
11331
11469
  });
@@ -11353,8 +11491,8 @@ var SpacesServiceImpl = class {
11353
11491
  return EffectEx.streamFromEmitter((emit) => {
11354
11492
  const ctx = Context.default(void 0, {
11355
11493
  "~LogMeta": "~LogMeta",
11356
- F: __dxlog_file$5,
11357
- L: 288
11494
+ F: __dxlog_file$6,
11495
+ L: 289
11358
11496
  });
11359
11497
  const space = this._spaceManager.spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
11360
11498
  const processor = { processCredential: async (credential) => {
@@ -11378,15 +11516,15 @@ var SpacesServiceImpl = class {
11378
11516
  else {
11379
11517
  invariant(!credential.id, "Id on unsigned credentials is not allowed", {
11380
11518
  "~LogMeta": "~LogMeta",
11381
- F: __dxlog_file$5,
11382
- L: 320,
11519
+ F: __dxlog_file$6,
11520
+ L: 321,
11383
11521
  S: this,
11384
11522
  A: ["!credential.id", "'Id on unsigned credentials is not allowed'"]
11385
11523
  });
11386
11524
  invariant(this._identityManager.identity, "Identity is not available", {
11387
11525
  "~LogMeta": "~LogMeta",
11388
- F: __dxlog_file$5,
11389
- L: 321,
11526
+ F: __dxlog_file$6,
11527
+ L: 322,
11390
11528
  S: this,
11391
11529
  A: ["this._identityManager.identity", "'Identity is not available'"]
11392
11530
  });
@@ -11394,15 +11532,15 @@ var SpacesServiceImpl = class {
11394
11532
  const subject = credential.subject;
11395
11533
  invariant(subject?.assertion, "Credential has no assertion.", {
11396
11534
  "~LogMeta": "~LogMeta",
11397
- F: __dxlog_file$5,
11398
- L: 324,
11535
+ F: __dxlog_file$6,
11536
+ L: 325,
11399
11537
  S: this,
11400
11538
  A: ["subject?.assertion", "'Credential has no assertion.'"]
11401
11539
  });
11402
11540
  invariant(requirePublicKey(credential.issuer).equals(signer.getIssuer()), void 0, {
11403
11541
  "~LogMeta": "~LogMeta",
11404
- F: __dxlog_file$5,
11405
- L: 325,
11542
+ F: __dxlog_file$6,
11543
+ L: 326,
11406
11544
  S: this,
11407
11545
  A: ["requirePublicKey(credential.issuer).equals(signer.getIssuer())", ""]
11408
11546
  });
@@ -11450,8 +11588,8 @@ var SpacesServiceImpl = class {
11450
11588
  try: async () => {
11451
11589
  const ctx = Context.default(void 0, {
11452
11590
  "~LogMeta": "~LogMeta",
11453
- F: __dxlog_file$5,
11454
- L: 378
11591
+ F: __dxlog_file$6,
11592
+ L: 379
11455
11593
  });
11456
11594
  const credential = await (await this._getDataSpaceManager()).requestSpaceAdmissionCredential(ctx, spaceKey);
11457
11595
  return this._joinByAdmission(ctx, create(ContactAdmissionSchema, { credential }));
@@ -11466,9 +11604,10 @@ var SpacesServiceImpl = class {
11466
11604
  var _usingCtx$2 = _usingCtx();
11467
11605
  assertArgument(SpaceId.isValid(request.spaceId), "spaceId", "Invalid space ID");
11468
11606
  const space = (await this._getDataSpaceManager()).getSpaceById(request.spaceId) ?? raise(/* @__PURE__ */ new Error("Space not found"));
11469
- if ((request.format ?? SpacesService.SpaceArchiveFormat.enums.BINARY) === SpacesService.SpaceArchiveFormat.enums.JSON) return { archive: await writeSerializedSpaceArchive({
11607
+ if ((request.format ?? SpacesService.SpaceArchiveFormat.enums.BINARY) === SpacesService.SpaceArchiveFormat.enums.JSON || request.feedIds) return { archive: await writeSerializedSpaceArchive({
11470
11608
  space,
11471
- echoHost: this._echoHost
11609
+ echoHost: this._echoHost,
11610
+ ...request.feedIds ? { feedIds: request.feedIds } : {}
11472
11611
  }) };
11473
11612
  const writer = _usingCtx$2.a(await new SpaceArchiveWriter().open());
11474
11613
  await writer.begin({ spaceId: space.id });
@@ -11482,8 +11621,8 @@ var SpacesServiceImpl = class {
11482
11621
  documentId
11483
11622
  }, {
11484
11623
  "~LogMeta": "~LogMeta",
11485
- F: __dxlog_file$5,
11486
- L: 412,
11624
+ F: __dxlog_file$6,
11625
+ L: 418,
11487
11626
  S: this
11488
11627
  });
11489
11628
  continue;
@@ -11518,11 +11657,19 @@ var SpacesServiceImpl = class {
11518
11657
  try: async () => {
11519
11658
  const ctx = Context.default(void 0, {
11520
11659
  "~LogMeta": "~LogMeta",
11521
- F: __dxlog_file$5,
11522
- L: 444
11660
+ F: __dxlog_file$6,
11661
+ L: 450
11523
11662
  });
11524
11663
  const dataSpaceManager = await this._getDataSpaceManager();
11525
- if ((request.archive.format ?? detectSpaceArchiveFormat(request.archive)) === SpacesService.SpaceArchiveFormat.enums.JSON) {
11664
+ const format = request.archive.format ?? detectSpaceArchiveFormat(request.archive);
11665
+ if (request.targetSpaceId) {
11666
+ assertArgument(format === SpacesService.SpaceArchiveFormat.enums.JSON, "archive", "Only a JSON archive can be imported into an existing space");
11667
+ assertArgument(SpaceId.isValid(request.targetSpaceId), "targetSpaceId", "Invalid space ID");
11668
+ const target = dataSpaceManager.getSpaceById(request.targetSpaceId) ?? raise(/* @__PURE__ */ new Error("Target space not found"));
11669
+ await this._hydrateSpaceFromSerialized(target, readSerializedSpaceArchive(request.archive), { merge: true });
11670
+ return { newSpaceId: target.id };
11671
+ }
11672
+ if (format === SpacesService.SpaceArchiveFormat.enums.JSON) {
11526
11673
  const serialized = readSerializedSpaceArchive(request.archive);
11527
11674
  const space = await dataSpaceManager.createSpace(ctx, { tags: request.tags });
11528
11675
  await this._hydrateSpaceFromSerialized(space, serialized);
@@ -11532,8 +11679,8 @@ var SpacesServiceImpl = class {
11532
11679
  const extracted = await extractSpaceArchive(request.archive);
11533
11680
  invariant(extracted.metadata.echo?.currentRootUrl, "Space archive does not contain a root URL", {
11534
11681
  "~LogMeta": "~LogMeta",
11535
- F: __dxlog_file$5,
11536
- L: 457,
11682
+ F: __dxlog_file$6,
11683
+ L: 477,
11537
11684
  S: this,
11538
11685
  A: ["extracted.metadata.echo?.currentRootUrl", "'Space archive does not contain a root URL'"]
11539
11686
  });
@@ -11555,16 +11702,21 @@ var SpacesServiceImpl = class {
11555
11702
  * {@link EntityStructure} entries; feed messages are appended to the appropriate feed
11556
11703
  * via {@link EchoHost.feedService}.
11557
11704
  */
11558
- async "_hydrateSpaceFromSerialized"(space, serialized) {
11705
+ async "_hydrateSpaceFromSerialized"(space, serialized, { merge = false } = {}) {
11559
11706
  const databaseRoot = space.databaseRoot;
11560
11707
  assertState(databaseRoot, "Space database root is not ready");
11561
11708
  databaseRoot.change((doc) => {
11562
11709
  if (!doc.objects) doc.objects = {};
11563
- for (const obj of serialized.objects) doc.objects[obj.id] = objJsonToObjectStructure(obj);
11710
+ for (const obj of serialized.objects) {
11711
+ if (merge && (doc.objects[obj.id] || doc.links?.[obj.id])) continue;
11712
+ doc.objects[obj.id] = objJsonToObjectStructure(obj);
11713
+ }
11564
11714
  });
11565
11715
  for (const feed of serialized.feeds ?? []) {
11566
- if (feed.messages.length === 0) continue;
11567
11716
  const namespace = feed.namespace === "trace" ? FeedProtocol.WellKnownNamespaces.trace : FeedProtocol.WellKnownNamespaces.data;
11717
+ const held = merge ? new Set((await collectFeedMessages(this._echoHost, space.id, feed.feedObjectId, feed.namespace)).map((message) => message.id)) : /* @__PURE__ */ new Set();
11718
+ const messages = feed.messages.filter((message) => !held.has(message.id));
11719
+ if (messages.length === 0) continue;
11568
11720
  try {
11569
11721
  const feedService = this._echoHost.feedService;
11570
11722
  await EffectEx.runPromise(Effect.gen(function* () {
@@ -11572,17 +11724,18 @@ var SpacesServiceImpl = class {
11572
11724
  spaceId: space.id,
11573
11725
  feedId: feed.feedObjectId,
11574
11726
  subspaceTag: namespace,
11575
- objects: feed.messages.map((message) => JSON.stringify(message))
11727
+ objects: messages.map((message) => JSON.stringify(message))
11576
11728
  });
11577
11729
  }).pipe(Effect.scoped));
11578
11730
  } catch (err) {
11731
+ if (merge) throw err;
11579
11732
  log.warn("failed to import feed data", {
11580
11733
  feedObjectId: feed.feedObjectId,
11581
11734
  error: err
11582
11735
  }, {
11583
11736
  "~LogMeta": "~LogMeta",
11584
- F: __dxlog_file$5,
11585
- L: 515,
11737
+ F: __dxlog_file$6,
11738
+ L: 553,
11586
11739
  S: this
11587
11740
  });
11588
11741
  }
@@ -11591,24 +11744,24 @@ var SpacesServiceImpl = class {
11591
11744
  async "_joinByAdmission"(ctx, { credential }) {
11592
11745
  invariant(credential, "Admission carries no credential.", {
11593
11746
  "~LogMeta": "~LogMeta",
11594
- F: __dxlog_file$5,
11595
- L: 521,
11747
+ F: __dxlog_file$6,
11748
+ L: 559,
11596
11749
  S: this,
11597
11750
  A: ["credential", "'Admission carries no credential.'"]
11598
11751
  });
11599
11752
  const assertion = getCredentialAssertion(credential);
11600
11753
  invariant(assertion.$typeName === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
11601
11754
  "~LogMeta": "~LogMeta",
11602
- F: __dxlog_file$5,
11603
- L: 523,
11755
+ F: __dxlog_file$6,
11756
+ L: 561,
11604
11757
  S: this,
11605
11758
  A: ["assertion.$typeName === 'dxos.halo.credentials.SpaceMember'", "'Invalid credential'"]
11606
11759
  });
11607
11760
  const myIdentity = this._identityManager.identity;
11608
11761
  invariant(myIdentity && requirePublicKey(credential.subject?.id).equals(myIdentity.identityKey), void 0, {
11609
11762
  "~LogMeta": "~LogMeta",
11610
- F: __dxlog_file$5,
11611
- L: 525,
11763
+ F: __dxlog_file$6,
11764
+ L: 563,
11612
11765
  S: this,
11613
11766
  A: ["myIdentity && requirePublicKey(credential.subject?.id).equals(myIdentity.identityKey)", ""]
11614
11767
  });
@@ -11697,6 +11850,37 @@ var SqlServiceLayer = Layer.effect(SqlService.Tag, Effect.gen(function* () {
11697
11850
  };
11698
11851
  })).pipe(Layer.provide(ComputeSqlService.layerGuarded), Layer.orDie);
11699
11852
  //#endregion
11853
+ //#region src/internal/storage/storage-watchdog.ts
11854
+ var __dxlog_file$5 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/storage/storage-watchdog.ts";
11855
+ /**
11856
+ * Once the stack is open, asks for the SQLite connection on an interval. Every statement and index pass
11857
+ * goes through that one connection, so a probe that cannot get it means nothing more will be saved:
11858
+ * {@link Events.StorageStuck} is emitted once, for the embedder to replace the process.
11859
+ */
11860
+ var storageWatchdogLayer = ({ interval = Duration.seconds(30), stuckAfter = Duration.minutes(2) } = {}) => Layer.effectDiscard(Effect.gen(function* () {
11861
+ const sql = yield* SqlClient.SqlClient;
11862
+ const controller = yield* Hook.Controller;
11863
+ const scope = yield* Effect.scope;
11864
+ const watch = Effect.gen(function* () {
11865
+ while (true) {
11866
+ yield* Effect.sleep(interval);
11867
+ const startedAt = Date.now();
11868
+ const answered = yield* sql`SELECT 1`.pipe(Effect.timeoutOption(stuckAfter), Effect.catch(() => Effect.succeed(Option.some([]))));
11869
+ if (Option.isNone(answered)) {
11870
+ log.error("sqlite connection stuck, requesting a new process", { waitedMs: Date.now() - startedAt }, {
11871
+ "~LogMeta": "~LogMeta",
11872
+ F: __dxlog_file$5,
11873
+ L: 48,
11874
+ S: this
11875
+ });
11876
+ yield* Hook.emit(StorageStuck, void 0);
11877
+ return;
11878
+ }
11879
+ }
11880
+ }).pipe(Effect.provideService(Hook.Controller, controller));
11881
+ yield* Hook.on(StackOpened, () => Effect.asVoid(Effect.forkIn(watch, scope)));
11882
+ }));
11883
+ //#endregion
11700
11884
  //#region src/internal/system/system-service.ts
11701
11885
  var __dxlog_file$4 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/system/system-service.ts";
11702
11886
  /**
@@ -12692,7 +12876,8 @@ var storageMigrationLayer = Layer.effect(StorageMigrationService, Effect.gen(fun
12692
12876
  return Effect.all([
12693
12877
  new SqliteMetadataStore({ runtime }).migrate,
12694
12878
  new SqliteKeyring({ runtime }).migrate,
12695
- new SqliteStorage({ runtime }).migrate
12879
+ new SqliteStorage({ runtime }).migrate,
12880
+ migrateBlobStore
12696
12881
  ], { discard: true });
12697
12882
  }));
12698
12883
  /**
@@ -12708,7 +12893,7 @@ var storageLifecycleLayer = Layer.effectDiscard(Effect.gen(function* () {
12708
12893
  log("running storage migrations...", void 0, {
12709
12894
  "~LogMeta": "~LogMeta",
12710
12895
  F: __dxlog_file,
12711
- L: 148,
12896
+ L: 150,
12712
12897
  S: this
12713
12898
  });
12714
12899
  yield* Effect.promise(() => RuntimeProvider.runPromise(runtime)(migrate));
@@ -12717,14 +12902,14 @@ var storageLifecycleLayer = Layer.effectDiscard(Effect.gen(function* () {
12717
12902
  log("running sqlite health check...", void 0, {
12718
12903
  "~LogMeta": "~LogMeta",
12719
12904
  F: __dxlog_file,
12720
- L: 155,
12905
+ L: 157,
12721
12906
  S: this
12722
12907
  });
12723
12908
  yield* Effect.promise(() => runSqliteHealthCheck(runtime));
12724
12909
  log("storage ready", void 0, {
12725
12910
  "~LogMeta": "~LogMeta",
12726
12911
  F: __dxlog_file,
12727
- L: 157,
12912
+ L: 159,
12728
12913
  S: this
12729
12914
  });
12730
12915
  yield* Hook.emit(StorageReady, void 0);
@@ -12881,6 +13066,12 @@ var StorageMigrationSpec = LayerSpec.make({
12881
13066
  requires: [SqlClient.SqlClient],
12882
13067
  provides: [StorageMigrationService]
12883
13068
  }, () => storageMigrationLayer);
13069
+ var StorageWatchdogSpec = LayerSpec.make({
13070
+ affinity: "application",
13071
+ requires: [SqlClient.SqlClient, Hook.Controller],
13072
+ provides: [],
13073
+ eager: true
13074
+ }, () => storageWatchdogLayer());
12884
13075
  var StorageLifecycleSpec = LayerSpec.make({
12885
13076
  affinity: "application",
12886
13077
  requires: [
@@ -13283,6 +13474,36 @@ var SqlServiceRegistrationSpec = LayerSpec.make({
13283
13474
  provides: [],
13284
13475
  eager: true
13285
13476
  }, () => RegisterService(SqlService.Rpcs, SqlService.Tag));
13477
+ var LocalBlobStoreSpec = LayerSpec.make({
13478
+ affinity: "application",
13479
+ requires: [SqlClient.SqlClient],
13480
+ provides: [LocalBlobStoreService]
13481
+ }, () => LocalBlobStoreLayer);
13482
+ /** Replicates with the edge only when one is configured; without it, blobs live on this device alone. */
13483
+ var BlobReplicationSpec = (options) => options.edgeAvailable ? LayerSpec.make({
13484
+ affinity: "application",
13485
+ requires: [
13486
+ LocalBlobStoreService,
13487
+ EdgeHttpClientService,
13488
+ Hook.Controller
13489
+ ],
13490
+ provides: [BlobReplicationService]
13491
+ }, () => BlobReplicationLayer) : LayerSpec.make({
13492
+ affinity: "application",
13493
+ requires: [LocalBlobStoreService],
13494
+ provides: [BlobReplicationService]
13495
+ }, () => BlobReplicationNoopLayer);
13496
+ var BlobStoreServiceSpec = LayerSpec.make({
13497
+ affinity: "application",
13498
+ requires: [LocalBlobStoreService, BlobReplicationService],
13499
+ provides: [BlobStoreService.Tag]
13500
+ }, () => BlobStoreServiceLayer);
13501
+ var BlobStoreServiceRegistrationSpec = LayerSpec.make({
13502
+ affinity: "application",
13503
+ requires: [BlobStoreService.Tag, RpcRouter.RpcRouter],
13504
+ provides: [],
13505
+ eager: true
13506
+ }, () => RegisterService(BlobStoreService.Rpcs, BlobStoreService.Tag));
13286
13507
  var DevtoolsHostRegistrationSpec = LayerSpec.make({
13287
13508
  affinity: "application",
13288
13509
  requires: [DevtoolsHost.Tag, RpcRouter.RpcRouter],
@@ -13304,6 +13525,7 @@ var clientServiceSpecs = (options) => [
13304
13525
  HypercoreStoreSpec,
13305
13526
  StorageMigrationSpec,
13306
13527
  StorageLifecycleSpec,
13528
+ StorageWatchdogSpec,
13307
13529
  StackReadinessSpec,
13308
13530
  SwarmNetworkManagerSpec(options),
13309
13531
  NetworkLifecycleSpec(options),
@@ -13352,6 +13574,10 @@ var clientServiceSpecs = (options) => [
13352
13574
  LoggingServiceRegistrationSpec,
13353
13575
  SqlServiceSpec,
13354
13576
  SqlServiceRegistrationSpec,
13577
+ LocalBlobStoreSpec,
13578
+ BlobReplicationSpec(options),
13579
+ BlobStoreServiceSpec,
13580
+ BlobStoreServiceRegistrationSpec,
13355
13581
  DevtoolsHostSpec,
13356
13582
  DevtoolsHostRegistrationSpec
13357
13583
  ];
@@ -13430,6 +13656,6 @@ var layerBuildEagerSpecs = Layer.effectDiscard(Effect.gen(function* () {
13430
13656
  yield* (yield* LayerStack.Service).init().pipe(Effect.orDie);
13431
13657
  }));
13432
13658
  //#endregion
13433
- export { SigningContextProviderSpec as $, SqliteMetadataStoreLayer as $n, createAdmissionKeypair as $t, IdentityProviderSpec as A, DevtoolsServiceImpl as An, SpaceArchiveWriter as At, KeyringSpec as B, SpaceManagerLayer as Bn, DataSpaceManagerLayer as Bt, FeedServiceSpec as C, Replication_exports as Cn, ManagerService$2 as Cr, CrossDeviceSpaceSynchronizerLayer as Ct, HypercoreStoreSpec as D, DevtoolsHostEvents as Dn, SystemServiceLayer as Dt, HypercoreStorageDirectorySpec as E, PlatformInfo_exports as En, SystemServiceImpl as Et, InvitationFactoriesSpec as F, subscribeToSignal as Fn, buildDatabaseDirectoryFromObjects as Ft, MetadataStoreSpec as G, SpaceProtocol as Gn, TransportFactoryService as Gt, LoggingServiceSpec as H, AuthStatus as Hn, createSigningContextProvider as Ht, InvitationsHandlerSpec as I, subscribeToSwarmInfo as In, objJsonToObjectStructure as It, NetworkServiceSpec as J, CredentialServerExtension as Jn, InvitationsServiceImpl as Jt, NetworkLifecycleSpec as K, SpaceProtocolSession as Kn, InvitationsManager as Kt, InvitationsManagerSpec as L, subscribeToFeedBlocks as Ln, readSerializedSpaceArchive as Lt, IdentityServiceSpec as M, getNetworkPeers as Mn, objectStructureToObjJson as Mt, InboxServiceRegistrationSpec as N, subscribeToNetworkStatus as Nn, orderObjJsonFields as Nt, IdentityLifecycleSpec as O, DevtoolsHostLayer as On, SpacesServiceImpl as Ot, InboxServiceSpec as P, subscribeToNetworkTopics as Pn, writeSerializedSpaceArchive as Pt, SignalManagerSpec as Q, SqliteMetadataStore as Qn, InvitationsHandlerService as Qt, InvitationsServiceRegistrationSpec as R, subscribeToFeeds as Rn, detectSpaceArchiveFormat as Rt, FeedServiceRegistrationSpec as S, Identity_exports as Sn, LifecycleService as Sr, FeedSyncerService as St, HypercoreFactorySpec as T, createDiagnosticsFromRouter as Tn, __exportAll as Tr, createCrossDeviceSpaceSynchronizer as Tt, MeshReplicatorRegistrationSpec as U, MOCK_AUTH_PROVIDER as Un, remainingLifetimeSeconds as Ut, LoggingServiceRegistrationSpec as V, SpaceManagerService as Vn, SigningContextProviderLayer as Vt, MeshReplicatorSpec as W, MOCK_AUTH_VERIFIER as Wn, DataSpace as Wt, QueryServiceSpec as X, valueEncoding as Xn, InvitationsHandler as Xt, QueryServiceRegistrationSpec as Y, Space as Yn, InvitationsServiceLayer as Yt, RpcRouterSpec as Z, AuthExtension as Zn, InvitationsHandlerLayer as Zt, EdgeAgentServiceSpec as _, identityProviderFromManager as _n, Reset as _r, registerReplicator as _t, ContactsServiceSpec as a, tryAcquireBeforeContextDisposed as an, ManagerService as ar, SqliteStorageSpec as at, EdgeSubductionReplicatorRegistrationSpec as b, ContactsServiceImpl as bn, ManagerService$1 as br, FeedSyncer as bt, DataServiceSpec as c, InboxServiceLayer as cn, EdgeAgentServiceLayer as cr, StorageMigrationSpec as ct, DevicesServiceSpec as d, IdentityServiceLayer as dn, EdgeAgentManager as dr, SystemServiceSpec as dt, InvitationFactoriesLayer as en, IMetadataStoreService as er, SpaceManagerSpec as et, DevtoolsHostRegistrationSpec as f, SqliteStorage as fn, EdgeAgentManagerLayer as fr, TransportFactorySpec as ft, EdgeAgentServiceRegistrationSpec as g, IdentityManagerLayer as gn, Opening as gr, identityProviderLayer as gt, EdgeAgentManagerSpec as h, IdentityManager as hn, Events_exports as hr, echoHostLayer as ht, ContactsServiceRegistrationSpec as i, toSpaceMemberRole as in, Auth_exports as ir, SqlServiceSpec as it, IdentityServiceRegistrationSpec as j, subscribeToSpaces as jn, extractSpaceArchive as jt, IdentityManagerSpec as k, DevtoolsHostService as kn, SpacesServiceLayer as kt, DataSpaceManagerSpec as l, InboxUnavailableError as ln, Readiness_exports as lr, SwarmNetworkManagerSpec as lt, EchoHostSpec as m, wipeSqliteStorage as mn, Closing as mr, StorageMigrationService as mt, layerClientServices as n, computeExpirationTime as nn, hasInvitationExpired as nr, SpacesServiceSpec as nt, CrossDeviceSpaceSynchronizerSpec as o, DeviceInvitationProtocol as on, invitations_exports as or, StackReadinessSpec as ot, DevtoolsHostSpec as p, SqliteStorage_exports as pn, EdgeAgentManagerService as pr, clientServiceSpecs as pt, NetworkServiceRegistrationSpec as q, CredentialRetrieverExtension as qn, InvitationsManagerLayer as qt, runtimePropsFromConfig as r, stateToString as rn, CredentialsDocument_exports as rr, SqlServiceRegistrationSpec as rt, DataServiceRegistrationSpec as s, InboxServiceImpl as sn, EdgeAgentServiceImpl as sr, StorageLifecycleSpec as st, enableNetworking as t, SpaceInvitationProtocol as tn, MetadataStore as tr, SpacesServiceRegistrationSpec as tt, DevicesServiceRegistrationSpec as u, IdentityServiceImpl as un, StackReadinessService as ur, SystemServiceRegistrationSpec as ut, EdgeClientsSpec as v, IdentityLifecycleLayer as vn, StackOpened as vr, storageLifecycleLayer as vt, FeedSyncerSpec as w, createDiagnostics as wn, identity_exports as wr, CrossDeviceSpaceSynchronizerService as wt, EdgeSubductionReplicatorSpec as x, ContactsServiceLayer as xn, spaces_exports as xr, FeedSyncerLayer as xt, EdgeIdentityRecoverySpec as y, EdgeIdentityRecoveryManagerService as yn, WipingStorage as yr, storageMigrationLayer as yt, InvitationsServiceSpec as z, SpaceManager as zn, DataSpaceManager as zt };
13659
+ export { QueryServiceRegistrationSpec as $, SpaceProtocolSession as $n, InvitationsManager as $t, HypercoreStoreSpec as A, Replication_exports as An, LifecycleService as Ar, createCrossDeviceSpaceSynchronizer as At, InvitationsManagerSpec as B, subscribeToNetworkStatus as Bn, orderObjJsonFields as Bt, EdgeSubductionReplicatorRegistrationSpec as C, IdentityManagerLayer as Cn, Opening as Cr, storageLifecycleLayer as Ct, FeedSyncerSpec as D, ContactsServiceImpl as Dn, WipingStorage as Dr, FeedSyncerService as Dt, FeedServiceSpec as E, EdgeIdentityRecoveryManagerService as En, StorageStuck as Er, FeedSyncerLayer as Et, IdentityServiceSpec as F, DevtoolsHostLayer as Fn, SpacesServiceLayer as Ft, LoggingServiceRegistrationSpec as G, subscribeToFeeds as Gn, detectSpaceArchiveFormat as Gt, InvitationsServiceSpec as H, subscribeToSignal as Hn, buildDatabaseDirectoryFromObjects as Ht, InboxServiceRegistrationSpec as I, DevtoolsHostService as In, SpaceArchiveWriter as It, MeshReplicatorSpec as J, SpaceManagerService as Jn, SigningContextProviderLayer as Jt, LoggingServiceSpec as K, SpaceManager as Kn, DataSpaceManager as Kt, InboxServiceSpec as L, DevtoolsServiceImpl as Ln, extractSpaceArchive as Lt, IdentityManagerSpec as M, createDiagnosticsFromRouter as Mn, identity_exports as Mr, SystemServiceLayer as Mt, IdentityProviderSpec as N, PlatformInfo_exports as Nn, __exportAll as Nr, storageWatchdogLayer as Nt, HypercoreFactorySpec as O, ContactsServiceLayer as On, ManagerService$1 as Or, CrossDeviceSpaceSynchronizerLayer as Ot, IdentityServiceRegistrationSpec as P, DevtoolsHostEvents as Pn, SpacesServiceImpl as Pt, NetworkServiceSpec as Q, SpaceProtocol as Qn, TransportFactoryService as Qt, InvitationFactoriesSpec as R, subscribeToSpaces as Rn, collectFeedMessages as Rt, EdgeIdentityRecoverySpec as S, IdentityManager as Sn, Events_exports as Sr, registerReplicator as St, FeedServiceRegistrationSpec as T, IdentityLifecycleLayer as Tn, StackOpened as Tr, FeedSyncer as Tt, KeyringSpec as U, subscribeToSwarmInfo as Un, objJsonToObjectStructure as Ut, InvitationsServiceRegistrationSpec as V, subscribeToNetworkTopics as Vn, writeSerializedSpaceArchive as Vt, LocalBlobStoreSpec as W, subscribeToFeedBlocks as Wn, readSerializedSpaceArchive as Wt, NetworkLifecycleSpec as X, MOCK_AUTH_PROVIDER as Xn, remainingLifetimeSeconds as Xt, MetadataStoreSpec as Y, AuthStatus as Yn, createSigningContextProvider as Yt, NetworkServiceRegistrationSpec as Z, MOCK_AUTH_VERIFIER as Zn, DataSpace as Zt, EchoHostSpec as _, IdentityServiceImpl as _n, StackReadinessService as _r, TransportFactorySpec as _t, BlobStoreServiceRegistrationSpec as a, InvitationsHandlerService as an, SqliteMetadataStore as ar, SpacesServiceRegistrationSpec as at, EdgeAgentServiceSpec as b, SqliteStorage_exports as bn, EdgeAgentManagerService as br, echoHostLayer as bt, ContactsServiceSpec as c, SpaceInvitationProtocol as cn, MetadataStore as cr, SqlServiceSpec as ct, DataServiceSpec as d, toSpaceMemberRole as dn, Auth_exports as dr, StorageLifecycleSpec as dt, InvitationsManagerLayer as en, CredentialRetrieverExtension as er, QueryServiceSpec as et, DataSpaceManagerSpec as f, tryAcquireBeforeContextDisposed as fn, ManagerService as fr, StorageMigrationSpec as ft, DevtoolsHostSpec as g, InboxUnavailableError as gn, Readiness_exports as gr, SystemServiceSpec as gt, DevtoolsHostRegistrationSpec as h, InboxServiceLayer as hn, EdgeAgentServiceLayer as hr, SystemServiceRegistrationSpec as ht, BlobReplicationSpec as i, InvitationsHandlerLayer as in, AuthExtension as ir, SpaceManagerSpec as it, IdentityLifecycleSpec as j, createDiagnostics as jn, ManagerService$2 as jr, SystemServiceImpl as jt, HypercoreStorageDirectorySpec as k, Identity_exports as kn, spaces_exports as kr, CrossDeviceSpaceSynchronizerService as kt, CrossDeviceSpaceSynchronizerSpec as l, computeExpirationTime as ln, hasInvitationExpired as lr, SqliteStorageSpec as lt, DevicesServiceSpec as m, InboxServiceImpl as mn, EdgeAgentServiceImpl as mr, SwarmNetworkManagerSpec as mt, layerClientServices as n, InvitationsServiceLayer as nn, Space as nr, SignalManagerSpec as nt, BlobStoreServiceSpec as o, createAdmissionKeypair as on, SqliteMetadataStoreLayer as or, SpacesServiceSpec as ot, DevicesServiceRegistrationSpec as p, DeviceInvitationProtocol as pn, invitations_exports as pr, StorageWatchdogSpec as pt, MeshReplicatorRegistrationSpec as q, SpaceManagerLayer as qn, DataSpaceManagerLayer as qt, runtimePropsFromConfig as r, InvitationsHandler as rn, valueEncoding as rr, SigningContextProviderSpec as rt, ContactsServiceRegistrationSpec as s, InvitationFactoriesLayer as sn, IMetadataStoreService as sr, SqlServiceRegistrationSpec as st, enableNetworking as t, InvitationsServiceImpl as tn, CredentialServerExtension as tr, RpcRouterSpec as tt, DataServiceRegistrationSpec as u, stateToString as un, CredentialsDocument_exports as ur, StackReadinessSpec as ut, EdgeAgentManagerSpec as v, IdentityServiceLayer as vn, EdgeAgentManager as vr, clientServiceSpecs as vt, EdgeSubductionReplicatorSpec as w, identityProviderFromManager as wn, Reset as wr, storageMigrationLayer as wt, EdgeClientsSpec as x, wipeSqliteStorage as xn, Closing as xr, identityProviderLayer as xt, EdgeAgentServiceRegistrationSpec as y, SqliteStorage as yn, EdgeAgentManagerLayer as yr, StorageMigrationService as yt, InvitationsHandlerSpec as z, getNetworkPeers as zn, objectStructureToObjJson as zt };
13434
13660
 
13435
13661
  //# sourceMappingURL=chunk-client-services-stack.mjs.map