@dxos/shell 0.4.10-main.c42bfdb → 0.4.10-main.c75170d

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 (35) hide show
  1. package/dist/bundle/{index-Ba36DtoM.mjs → index-Cms4wG79.mjs} +38 -22
  2. package/dist/bundle/index-Cms4wG79.mjs.map +1 -0
  3. package/dist/bundle/{index-CnChDHv2.mjs → index-DACjPI-n.mjs} +595 -523
  4. package/dist/bundle/index-DACjPI-n.mjs.map +1 -0
  5. package/dist/bundle/shell.mjs +2 -3
  6. package/dist/bundle/shell.mjs.map +1 -1
  7. package/dist/bundle/shell.umd.js +22 -22
  8. package/dist/bundle/shell.umd.js.map +1 -1
  9. package/dist/bundle/style.css +1 -1
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/react.mjs +33 -31
  12. package/dist/lib/browser/react.mjs.map +3 -3
  13. package/dist/types/src/components/InvitationList/InvitationListItem.js +5 -5
  14. package/dist/types/src/components/InvitationList/InvitationListItem.js.map +1 -1
  15. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts.map +1 -1
  16. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js +5 -1
  17. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js.map +1 -1
  18. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
  19. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +3 -1
  20. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
  21. package/dist/types/src/steps/InvitationManager.d.ts +1 -1
  22. package/dist/types/src/steps/InvitationManager.d.ts.map +1 -1
  23. package/dist/types/src/steps/InvitationManager.js +3 -4
  24. package/dist/types/src/steps/InvitationManager.js.map +1 -1
  25. package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -1
  26. package/dist/types/src/stories/Invitations.e2e-stories.js +2 -2
  27. package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -1
  28. package/package.json +22 -21
  29. package/src/components/InvitationList/InvitationListItem.tsx +5 -5
  30. package/src/panels/IdentityPanel/useAgentHandlers.ts +5 -1
  31. package/src/panels/SpacePanel/steps/SpaceManager.tsx +3 -1
  32. package/src/steps/InvitationManager.tsx +4 -4
  33. package/src/stories/Invitations.e2e-stories.tsx +3 -3
  34. package/dist/bundle/index-Ba36DtoM.mjs.map +0 -1
  35. package/dist/bundle/index-CnChDHv2.mjs.map +0 -1
@@ -4,7 +4,7 @@ import * as $7SXl2$reactdom from "react-dom";
4
4
  import $7SXl2$reactdom__default, { flushSync } from "react-dom";
5
5
  import { CaretDown, CaretRight, Minus, Check, Database, Power, Plus, Copy, ImageSquare, Palette, Compass, Desktop, Robot, DeviceMobile, Devices, DotsThree, Intersect, X, Placeholder, Warning, PlugsConnected, Plugs, CopySimple, QrCode, Textbox, UserPlus, UsersThree, Planet } from "@phosphor-icons/react";
6
6
  import { SpaceMember as SpaceMember$1, useMembers, useSpaceInvitations, useSpace } from "@dxos/react-client/echo";
7
- import { useClient as useClient$1, useAgentHostingProviderClient, AlreadyJoinedError, useMulticastObservable, useConfig, ShellLayout as ShellLayout$1, ShellDisplay as ShellDisplay$1, ClientServicesProxy as ClientServicesProxy$1, Client, ClientContext as ClientContext$1, SystemStatus as SystemStatus$1, Config as Config$1 } from "@dxos/react-client";
7
+ import { useClient as useClient$1, useAgentHostingProviderClient, AlreadyJoinedError, useMulticastObservable as useMulticastObservable$1, useConfig, ShellLayout as ShellLayout$1, ShellDisplay as ShellDisplay$1, ClientServicesProxy as ClientServicesProxy$1, Client, ClientContext as ClientContext$1, SystemStatus as SystemStatus$1, Config as Config$1 } from "@dxos/react-client";
8
8
  import { DeviceKind as DeviceKind$1, Device as Device$1, DeviceType, useHaloInvitations, useDevices, useIdentity } from "@dxos/react-client/halo";
9
9
  import { InvitationEncoder, clientServiceBundle, DEFAULT_VAULT_URL, DEFAULT_INTERNAL_CHANNEL, PROXY_CONNECTION_TIMEOUT, DEFAULT_SHELL_CHANNEL, getProfilePath, DX_RUNTIME, shellServiceBundle, appServiceBundle, DEFAULT_CLIENT_CHANNEL } from "@dxos/client-protocol";
10
10
  import "@dxos/client";
@@ -13356,6 +13356,9 @@ var equalsSymbol = Symbol.for("dxos.common.equals"), __require$1 = /* @__PURE__
13356
13356
  toJSON() {
13357
13357
  return this.toHex();
13358
13358
  }
13359
+ toJSONL() {
13360
+ return this.truncate();
13361
+ }
13359
13362
  get length() {
13360
13363
  return this._value.length;
13361
13364
  }
@@ -13457,10 +13460,10 @@ var equalsSymbol = Symbol.for("dxos.common.equals"), __require$1 = /* @__PURE__
13457
13460
  }, randomBytes$1 = ($) => {
13458
13461
  const I = globalThis.crypto ?? __require$1("@dxos/node-std/crypto").webcrypto, U = new Uint8Array($);
13459
13462
  return I.getRandomValues(U), U;
13460
- }, __dxlog_file3$5 = "/home/runner/work/dxos/dxos/packages/common/util/src/callback.ts", Callback = class {
13463
+ }, __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/util/src/callback.ts", Callback = class {
13461
13464
  call(...$) {
13462
13465
  return invariant(this._callback, "Callback not set", {
13463
- F: __dxlog_file3$5,
13466
+ F: __dxlog_file3$4,
13464
13467
  L: 20,
13465
13468
  S: this,
13466
13469
  A: [
@@ -13475,7 +13478,7 @@ var equalsSymbol = Symbol.for("dxos.common.equals"), __require$1 = /* @__PURE__
13475
13478
  }
13476
13479
  set($) {
13477
13480
  invariant(!this._callback, "Callback already set", {
13478
- F: __dxlog_file3$5,
13481
+ F: __dxlog_file3$4,
13479
13482
  L: 29,
13480
13483
  S: this,
13481
13484
  A: [
@@ -14085,8 +14088,8 @@ var equalsSymbol = Symbol.for("dxos.common.equals"), __require$1 = /* @__PURE__
14085
14088
  };
14086
14089
  let G = setTimeout(q, U);
14087
14090
  return () => clearTimeout(G);
14088
- }, arrayToBuffer = ($) => export_Buffer.from($.buffer, $.byteOffset, $.byteLength), MAX_DEPTH = 5, jsonify = ($, I = 0, U = /* @__PURE__ */ new WeakSet()) => {
14089
- if (I > MAX_DEPTH)
14091
+ }, arrayToBuffer = ($) => export_Buffer.from($.buffer, $.byteOffset, $.byteLength), LOG_MAX_DEPTH = 7, jsonlogify = ($, I = 0, U = /* @__PURE__ */ new WeakSet()) => {
14092
+ if (I > LOG_MAX_DEPTH)
14090
14093
  return null;
14091
14094
  if (typeof $ == "function")
14092
14095
  return null;
@@ -14098,13 +14101,15 @@ var equalsSymbol = Symbol.for("dxos.common.equals"), __require$1 = /* @__PURE__
14098
14101
  if ($ instanceof Uint8Array)
14099
14102
  return arrayToBuffer($).toString("hex");
14100
14103
  if (Array.isArray($))
14101
- return $.map((q) => jsonify(q, I + 1, U));
14104
+ return $.map((q) => jsonlogify(q, I + 1, U));
14105
+ if (typeof $.toJSONL == "function")
14106
+ return $.toJSONL();
14102
14107
  if (typeof $.toJSON == "function")
14103
14108
  return $.toJSON();
14104
14109
  {
14105
14110
  const q = {};
14106
14111
  for (const G of Object.keys($))
14107
- q[G] = jsonify($[G], I + 1, U);
14112
+ q[G] = jsonlogify($[G], I + 1, U);
14108
14113
  return q;
14109
14114
  }
14110
14115
  } finally {
@@ -14399,6 +14404,8 @@ var logInfoProperties = Symbol("logInfoProperties"), logInfo = ($, I, U) => {
14399
14404
  const J = Y.value, Z = K;
14400
14405
  Y.value = function(...Q) {
14401
14406
  const ee = {
14407
+ F: "",
14408
+ L: 0,
14402
14409
  ...q ?? {},
14403
14410
  S: this
14404
14411
  }, te = Q.map((ne) => export_inspect(ne, !1, 1, !0)).join(", ");
@@ -14515,10 +14522,16 @@ var logInfoProperties = Symbol("logInfoProperties"), logInfo = ($, I, U) => {
14515
14522
  ]);
14516
14523
  const J = Y[I.level] ?? console.log;
14517
14524
  typeof ((ee = I.meta) == null ? void 0 : ee.C) == "function" ? I.meta.C(J, q) : J(...q);
14518
- }, BROWSER_PROCESSOR = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR, EAGAIN_MAX_DURATION = 1e3, createFileProcessor = ({ pathOrFd: $, levels: I, filters: U }) => {
14525
+ }, BROWSER_PROCESSOR = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR, getRelativeFilename2 = ($) => {
14526
+ const I = $.match(/.+\/(packages\/.+\/.+)/);
14527
+ if (I) {
14528
+ const [, U] = I;
14529
+ return U;
14530
+ }
14531
+ return $;
14532
+ }, EAGAIN_MAX_DURATION = 1e3, createFileProcessor = ({ pathOrFd: $, levels: I, filters: U }) => {
14519
14533
  let q;
14520
14534
  return (G, K) => {
14521
- var Z, Q;
14522
14535
  if (I.length > 0 && !I.includes(K.level) || !shouldLog(K, U))
14523
14536
  return;
14524
14537
  if (typeof $ == "number")
@@ -14533,24 +14546,26 @@ var logInfoProperties = Symbol("logInfoProperties"), logInfo = ($, I, U) => {
14533
14546
  const Y = {
14534
14547
  ...K,
14535
14548
  timestamp: Date.now(),
14536
- meta: {
14537
- file: (Z = K.meta) == null ? void 0 : Z.F,
14538
- line: (Q = K.meta) == null ? void 0 : Q.L
14539
- },
14540
- context: jsonify(getContextFromEntry(K))
14549
+ ...K.meta ? {
14550
+ meta: {
14551
+ file: getRelativeFilename2(K.meta.F),
14552
+ line: K.meta.L
14553
+ }
14554
+ } : {},
14555
+ context: jsonlogify(getContextFromEntry(K))
14541
14556
  };
14542
14557
  let J = 0;
14543
14558
  for (; ; )
14544
14559
  try {
14545
14560
  return appendFileSync(q, JSON.stringify(Y) + `
14546
14561
  `);
14547
- } catch (ee) {
14548
- if (ee.code !== "EAGAIN")
14549
- throw ee;
14562
+ } catch (Z) {
14563
+ if (Z.code !== "EAGAIN")
14564
+ throw Z;
14550
14565
  if (J === 0)
14551
14566
  J = performance.now();
14552
14567
  else if (performance.now() - J > EAGAIN_MAX_DURATION)
14553
- throw console.log(`could not write after ${EAGAIN_MAX_DURATION}ms of EAGAIN failures, giving up`), ee;
14568
+ throw console.log(`could not write after ${EAGAIN_MAX_DURATION}ms of EAGAIN failures, giving up`), Z;
14554
14569
  }
14555
14570
  };
14556
14571
  }, logFilePath, getLogFilePath = () => (logFilePath ?? (logFilePath = process.env.LOG_FILE ?? (process.env.HOME ? `${process.env.HOME}/.dxlog/${(/* @__PURE__ */ new Date()).toISOString()}.log` : void 0)), logFilePath);
@@ -17837,12 +17852,13 @@ var Message$1 = {
17837
17852
  className: q("scrollArea.viewport", "scroll-area", {}, $),
17838
17853
  ref: U
17839
17854
  });
17840
- }), ScrollAreaScrollbar = /* @__PURE__ */ forwardRef(({ classNames: $, ...I }, U) => {
17841
- const { tx: q } = useThemeContext();
17855
+ }), ScrollAreaScrollbar = /* @__PURE__ */ forwardRef(({ classNames: $, variant: I = "fine", ...U }, q) => {
17856
+ const { tx: G } = useThemeContext();
17842
17857
  return /* @__PURE__ */ React__default.createElement($57acba87d6e25586$export$9a4e88b92edfce6b, {
17843
- ...I,
17844
- className: q("scrollArea.scrollbar", "scroll-area__scrollbar", {}, $),
17845
- ref: U
17858
+ "data-variant": I,
17859
+ ...U,
17860
+ className: G("scrollArea.scrollbar", "scroll-area__scrollbar", {}, $),
17861
+ ref: q
17846
17862
  });
17847
17863
  }), ScrollAreaThumb = /* @__PURE__ */ forwardRef(({ classNames: $, ...I }, U) => {
17848
17864
  const { tx: q } = useThemeContext();
@@ -24213,6 +24229,10 @@ var shadeNumbers = (
24213
24229
  light: "#ffffff",
24214
24230
  dark: "#ffffff"
24215
24231
  },
24232
+ transparent: {
24233
+ light: "transparent",
24234
+ dark: "transparent"
24235
+ },
24216
24236
  unavailable: {
24217
24237
  light: physicalColors.neutral[100],
24218
24238
  dark: physicalColors.neutral[600]
@@ -24362,7 +24382,7 @@ var hueTheme = {
24362
24382
  text: ({ hue: $ }) => hueTokenThemes[$].text,
24363
24383
  textHover: ({ hue: $ }) => hueTokenThemes[$].textHover,
24364
24384
  fill: ({ hue: $ }) => hueTokenThemes[$].fill
24365
- }, bounceLayout = "fixed inset-0 z-0 overflow-auto overscroll-auto scroll-smooth", popperMotion = "will-change-[opacity,transform] data-[side=top]:animate-slideDownAndFade data-[side=right]:animate-slideLeftAndFade data-[side=bottom]:animate-slideUpAndFade data-[side=left]:animate-slideRightAndFade", dialogMotion = "will-change-[opacity,transform] animate-slideUpAndFade", separatorBorderColor = "separator-separator", inlineSeparator = "self-stretch border-ie", blockSeparator = "self-stretch border-be", ghostHighlighted = "data-[highlighted]:bg-primary-100 dark:data-[highlighted]:bg-primary-850 hover:data-[highlighted]:bg-primary-150 hover:dark:data-[highlighted]:bg-primary-800", fixedSurface = "base-surface md:fixed-surface backdrop-blur-md dark:backdrop-blur-lg", fixedBorder = "separator-separator", groupBorder = "separator-separator", modalSurface = "modal-surface", getLength = () => [
24385
+ }, bounceLayout = "fixed inset-0 z-0 overflow-auto overscroll-auto", popperMotion = "will-change-[opacity,transform] data-[side=top]:animate-slideDownAndFade data-[side=right]:animate-slideLeftAndFade data-[side=bottom]:animate-slideUpAndFade data-[side=left]:animate-slideRightAndFade", dialogMotion = "will-change-[opacity,transform] animate-slideUpAndFade", separatorBorderColor = "separator-separator", inlineSeparator = "self-stretch border-ie", blockSeparator = "self-stretch border-be", ghostHighlighted = "data-[highlighted]:bg-primary-100 dark:data-[highlighted]:bg-primary-850 hover:data-[highlighted]:bg-primary-150 hover:dark:data-[highlighted]:bg-primary-800", fixedSurface = "base-surface md:fixed-surface backdrop-blur-md dark:backdrop-blur-lg", fixedBorder = "separator-separator", groupBorder = "separator-separator", modalSurface = "modal-surface", getLength = () => [
24366
24386
  validators.isLength
24367
24387
  ], getLengthWithAuto = () => [
24368
24388
  "auto",
@@ -25209,16 +25229,16 @@ var hueTheme = {
25209
25229
  start: {
25210
25230
  width: "sm:data-[side=is]:is-[270px]",
25211
25231
  sidebar: "sm:data-[side=is]:-inline-start-[270px]",
25212
- content: "lg:data-[sidebar-inline-start-state=open]:pis-[270px]",
25232
+ content: "lg:data-[sidebar-inline-start-state=open]:pis-[270px] lg:data-[sidebar-inline-start-state=open]:scroll-ps-[270px]",
25213
25233
  notch: "max-is-[270px]"
25214
25234
  },
25215
25235
  // TODO(burdon): Maximal size for phone.
25216
25236
  end: {
25217
25237
  width: "sm:data-[side=ie]:is-[360px]",
25218
25238
  sidebar: "sm:data-[side=ie]:-inline-end-[360px]",
25219
- content: "lg:data-[sidebar-inline-end-state=open]:pie-[360px]"
25239
+ content: "lg:data-[sidebar-inline-end-state=open]:pie-[360px] lg:data-[sidebar-inline-end-state=open]:scroll-pe-[360px]"
25220
25240
  }
25221
- }, mainSidebar = ($, ...I) => mx("fixed block-start-0 block-end-0 is-[100vw] z-10 data-[side=ie]:z-20 overscroll-contain overflow-x-hidden overflow-y-auto", "transition-[inset-inline-start,inset-inline-end] duration-0 data-[resizing=false]:duration-200 ease-in-out", `data-[side=is]:-inline-start-[100vw] ${sidebarSlots.start.width} ${sidebarSlots.start.sidebar}`, `data-[side=ie]:-inline-end-[100vw] ${sidebarSlots.end.width} ${sidebarSlots.end.sidebar}`, "data-[side=is]:data-[state=open]:inline-start-0 data-[side=ie]:data-[state=open]:inline-end-0", "data-[side=is]:border-ie data-[side=ie]:border-is", fixedBorder, fixedSurface, ...I), mainContent = ({ bounce: $ }, ...I) => mx("transition-[padding-inline-start,padding-'inline-end'] duration-200 ease-in-out", `pis-0 ${sidebarSlots.start.content}`, `pie-0 ${sidebarSlots.end.content}`, $ && bounceLayout, ...I), mainOverlay = ($, ...I) => mx("fixed inset-0 z-[9] surface-scrim", "transition-opacity duration-200 ease-in-out", "opacity-0 data-[state=open]:opacity-100 lg:data-[state=open]:opacity-100", "hidden data-[state=open]:block lg:data-[state=open]:hidden", ...I), mainNotch = ($, ...I) => mx("fixed z-[11] block-end-0 inline-start-0 pbe-[env(safe-area-inset-bottom)] rounded-se-lg min-bs-[var(--rail-size)] is-fit separator-separator surface-base", "transition-[border-width] box-content border-bs border-ie data-[nav-sidebar-state=open]:border-bs-0 data-[nav-sidebar-state=open]:border-ie-0", "pli-1 grid grid-cols-[repeat(auto-fit,var(--rail-action))]", sidebarSlots.start.notch, ...I), mainTheme = {
25241
+ }, mainSidebar = ($, ...I) => mx("fixed block-start-0 block-end-0 is-[100vw] z-10 data-[side=ie]:z-20 overscroll-contain overflow-x-hidden overflow-y-auto", "transition-[inset-inline-start,inset-inline-end] duration-0 data-[resizing=false]:duration-200 ease-in-out", `data-[side=is]:-inline-start-[100vw] ${sidebarSlots.start.width} ${sidebarSlots.start.sidebar}`, `data-[side=ie]:-inline-end-[100vw] ${sidebarSlots.end.width} ${sidebarSlots.end.sidebar}`, "data-[side=is]:data-[state=open]:inline-start-0 data-[side=ie]:data-[state=open]:inline-end-0", "data-[side=is]:border-ie data-[side=ie]:border-is", fixedBorder, fixedSurface, ...I), mainContent = ({ bounce: $ }, ...I) => mx("transition-[padding-inline-start,padding-inline-end,scroll-padding-start,scroll-padding-end] duration-200 ease-in-out", `pis-0 scroll-ps-0 ${sidebarSlots.start.content}`, `pie-0 scroll-pe-0 ${sidebarSlots.end.content}`, $ && bounceLayout, ...I), mainOverlay = ($, ...I) => mx("fixed inset-0 z-[9] surface-scrim", "transition-opacity duration-200 ease-in-out", "opacity-0 data-[state=open]:opacity-100 lg:data-[state=open]:opacity-100", "hidden data-[state=open]:block lg:data-[state=open]:hidden", ...I), mainNotch = ($, ...I) => mx("fixed z-[11] block-end-0 inline-start-0 pbe-[env(safe-area-inset-bottom)] rounded-se-lg min-bs-[var(--rail-size)] is-fit separator-separator surface-base", "transition-[border-width] box-content border-bs border-ie data-[nav-sidebar-state=open]:border-bs-0 data-[nav-sidebar-state=open]:border-ie-0", "pli-1 grid grid-cols-[repeat(auto-fit,var(--rail-action))]", sidebarSlots.start.notch, ...I), mainTheme = {
25222
25242
  content: mainContent,
25223
25243
  sidebar: mainSidebar,
25224
25244
  overlay: mainOverlay,
@@ -25233,7 +25253,7 @@ var hueTheme = {
25233
25253
  content: popoverContent,
25234
25254
  viewport: popoverViewport,
25235
25255
  arrow: popoverArrow
25236
- }, scrollAreaRoot = ($, ...I) => mx("overflow-hidden", ...I), scrollAreaViewport = ($, ...I) => mx("is-full bs-full scroll-smooth", "[&>div]:table-fixed [&>div]:w-full", ...I), scrollAreaScrollbar = ($, ...I) => mx("flex select-none touch-none p-0.5 ease-out", "data-[orientation=vertical]:is-1.5 data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:bs-1.5", ...I), scrollAreaThumb = ($, ...I) => mx("bg-neutral-500/50 flex-1 rounded-lg relative", "before:content-[''] before:absolute before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:w-full before:h-full before:min-w-[6px] before:min-h-[6px]", ...I), scrollAreaCorner = ($, ...I) => mx(...I), scrollAreaTheme = {
25256
+ }, scrollAreaRoot = ($, ...I) => mx("overflow-hidden", ...I), scrollAreaViewport = ($, ...I) => mx("is-full bs-full [&>div]:table-fixed [&>div]:is-full", ...I), scrollAreaScrollbar = ($, ...I) => mx("flex select-none touch-none p-0.5 ease-out", "data-[orientation=vertical]:is-1.5 sm:data-[orientation=vertical]:data-[variant=coarse]:is-3", "data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:bs-1.5 sm:data-[orientation=horizontal]:data-[variant=coarse]:bs-3", "sm:data-[variant=coarse]:surface-separator rounded-full", "[&>div]:surface-unAccent sm:[&[data-variant=coarse]>div]:surface-attention", ...I), scrollAreaThumb = ($, ...I) => mx("flex-1 rounded-full relative", "before:content-[''] before:absolute before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:w-full before:h-full before:min-w-[6px] before:min-h-[6px]", ...I), scrollAreaCorner = ($, ...I) => mx(...I), scrollAreaTheme = {
25237
25257
  root: scrollAreaRoot,
25238
25258
  viewport: scrollAreaViewport,
25239
25259
  scrollbar: scrollAreaScrollbar,
@@ -69486,7 +69506,7 @@ function formatDistance($, I, U) {
69486
69506
  function formatDistanceToNow($, I) {
69487
69507
  return formatDistance($, Date.now(), I);
69488
69508
  }
69489
- var LogLevel;
69509
+ var RPC_TIMEOUT = 2e4, LogLevel;
69490
69510
  (function($) {
69491
69511
  $[$.TRACE = 5] = "TRACE", $[$.DEBUG = 10] = "DEBUG", $[$.INFO = 11] = "INFO", $[$.WARN = 12] = "WARN", $[$.ERROR = 13] = "ERROR";
69492
69512
  })(LogLevel || (LogLevel = {}));
@@ -69541,11 +69561,11 @@ var CreateEpochRequest;
69541
69561
  var Invitation;
69542
69562
  (function($) {
69543
69563
  (function(I) {
69544
- I[I.INTERACTIVE = 0] = "INTERACTIVE", I[I.OFFLINE = 1] = "OFFLINE", I[I.MULTIUSE = 2] = "MULTIUSE";
69564
+ I[I.INTERACTIVE = 0] = "INTERACTIVE", I[I.DELEGATED = 1] = "DELEGATED", I[I.MULTIUSE = 2] = "MULTIUSE";
69545
69565
  })($.Type || ($.Type = {})), function(I) {
69546
69566
  I[I.DEVICE = 0] = "DEVICE", I[I.SPACE = 1] = "SPACE";
69547
69567
  }($.Kind || ($.Kind = {})), function(I) {
69548
- I[I.NONE = 0] = "NONE", I[I.SHARED_SECRET = 1] = "SHARED_SECRET";
69568
+ I[I.NONE = 0] = "NONE", I[I.SHARED_SECRET = 1] = "SHARED_SECRET", I[I.KNOWN_PUBLIC_KEY = 2] = "KNOWN_PUBLIC_KEY";
69549
69569
  }($.AuthMethod || ($.AuthMethod = {})), function(I) {
69550
69570
  I[I.INIT = 0] = "INIT", I[I.CONNECTING = 1] = "CONNECTING", I[I.CONNECTED = 2] = "CONNECTED", I[I.READY_FOR_AUTHENTICATION = 3] = "READY_FOR_AUTHENTICATION", I[I.AUTHENTICATING = 4] = "AUTHENTICATING", I[I.SUCCESS = 5] = "SUCCESS", I[I.CANCELLED = 6] = "CANCELLED", I[I.TIMEOUT = 7] = "TIMEOUT", I[I.ERROR = 8] = "ERROR", I[I.EXPIRED = 9] = "EXPIRED";
69551
69571
  }($.State || ($.State = {}));
@@ -69628,37 +69648,33 @@ var __dxlog_file$7 = "/home/runner/work/dxos/dxos/packages/common/context/src/co
69628
69648
  }
69629
69649
  /**
69630
69650
  * Runs all dispose callbacks.
69631
- * Sync callbacks are run in the reverse order they were added.
69632
- * Async callbacks are run in parallel.
69651
+ * Callbacks are run in the reverse order they were added.
69633
69652
  * This function never throws.
69634
69653
  * It is safe to ignore the returned promise if the caller does not wish to wait for callbacks to complete.
69635
69654
  * Disposing context means that onDispose will throw an error and any errors raised will be logged and not propagated.
69636
69655
  */
69637
- dispose() {
69656
+ async dispose() {
69638
69657
  if (this._disposePromise)
69639
69658
  return this._disposePromise;
69640
69659
  this._isDisposed = !0;
69641
69660
  let I;
69642
- this._disposePromise = new Promise((G) => {
69643
- I = G;
69661
+ this._disposePromise = new Promise((q) => {
69662
+ I = q;
69644
69663
  });
69645
- const U = [], q = Array.from(this._disposeCallbacks).reverse();
69646
- for (const G of q)
69647
- U.push((async () => {
69648
- try {
69649
- await G();
69650
- } catch (K) {
69651
- log$2.catch(K, void 0, {
69652
- F: __dxlog_file$7,
69653
- L: 138,
69654
- S: this,
69655
- C: (Y, J) => Y(...J)
69656
- });
69657
- }
69658
- })());
69659
- return this._disposeCallbacks.length = 0, Promise.all(U).then(() => {
69660
- I();
69661
- }), this._disposePromise;
69664
+ const U = Array.from(this._disposeCallbacks).reverse();
69665
+ this._disposeCallbacks.length = 0;
69666
+ for (const q of U)
69667
+ try {
69668
+ await q();
69669
+ } catch (G) {
69670
+ log$2.catch(G, void 0, {
69671
+ F: __dxlog_file$7,
69672
+ L: 136,
69673
+ S: this,
69674
+ C: (K, Y) => K(...Y)
69675
+ });
69676
+ }
69677
+ I();
69662
69678
  }
69663
69679
  /**
69664
69680
  * Raise the error inside the context.
@@ -73331,7 +73347,7 @@ var DeferredTask = class {
73331
73347
  action: J
73332
73348
  }, {
73333
73349
  F: __dxlog_file$6,
73334
- L: 79,
73350
+ L: 81,
73335
73351
  S: void 0,
73336
73352
  C: (Z, Q) => Z(...Q)
73337
73353
  }), {
@@ -73413,7 +73429,7 @@ var DeferredTask = class {
73413
73429
  authCode: Y
73414
73430
  }, {
73415
73431
  F: __dxlog_file$6,
73416
- L: 163,
73432
+ L: 165,
73417
73433
  S: void 0,
73418
73434
  C: (J, Z) => J(...Z)
73419
73435
  }), I.observable.authenticate(Y)), [
@@ -73436,6 +73452,7 @@ var DeferredTask = class {
73436
73452
  connect: q,
73437
73453
  authenticate: G,
73438
73454
  id: Y == null ? void 0 : Y.invitationId,
73455
+ multiUse: Y == null ? void 0 : Y.multiUse,
73439
73456
  invitationCode: Y ? InvitationEncoder.encode(Y) : void 0,
73440
73457
  authCode: Y == null ? void 0 : Y.authCode,
73441
73458
  authMethod: Y == null ? void 0 : Y.authMethod,
@@ -73520,7 +73537,7 @@ const AuthCode = ($) => {
73520
73537
  reverseEffects: K,
73521
73538
  ...Y
73522
73539
  }) => {
73523
- const { t: J } = useTranslation("os"), { cancel: Z, status: Q, invitationCode: ee, authCode: te, type: ne } = I, re = !([Invitation.State.ERROR, Invitation.State.TIMEOUT, Invitation.State.CANCELLED].indexOf(Q) >= 0), ae = ne === Invitation.Type.MULTIUSE || [Invitation.State.INIT, Invitation.State.CONNECTING, Invitation.State.CONNECTED].indexOf(Q) >= 0, se = Q === Invitation.State.READY_FOR_AUTHENTICATION, fe = useCallback(() => q == null ? void 0 : q($), [$, q]), le = ee && G(ee), ce = $ == null ? void 0 : $.get().invitationId, ue = $ == null ? void 0 : $.get().lifetime, he = $ != null && $.expiry ? formatDistanceToNow($ == null ? void 0 : $.expiry, { addSuffix: !0 }) : void 0, ve = [
73540
+ const { t: J } = useTranslation("os"), { cancel: Z, status: Q, invitationCode: ee, authCode: te, multiUse: ne } = I, re = !([Invitation.State.ERROR, Invitation.State.TIMEOUT, Invitation.State.CANCELLED].indexOf(Q) >= 0), ae = ne || [Invitation.State.INIT, Invitation.State.CONNECTING, Invitation.State.CONNECTED].indexOf(Q) >= 0, se = Q === Invitation.State.READY_FOR_AUTHENTICATION, fe = useCallback(() => q == null ? void 0 : q($), [$, q]), le = ee && G(ee), ce = $ == null ? void 0 : $.get().invitationId, ue = $ == null ? void 0 : $.get().lifetime, he = $ != null && $.expiry ? formatDistanceToNow($ == null ? void 0 : $.expiry, { addSuffix: !0 }) : void 0, ve = [
73524
73541
  Invitation.State.INIT,
73525
73542
  Invitation.State.CONNECTING,
73526
73543
  Invitation.State.CONNECTED,
@@ -73541,9 +73558,9 @@ const AuthCode = ($) => {
73541
73558
  ...Y,
73542
73559
  classNames: ["flex gap-2 pis-3 pie-1 items-center relative", Y.classNames]
73543
73560
  },
73544
- /* @__PURE__ */ React__default.createElement(ListItem.Heading, { classNames: "sr-only" }, J(ne === Invitation.Type.MULTIUSE ? "invite many list item label" : "invite one list item label")),
73545
- ne === Invitation.Type.MULTIUSE && /* @__PURE__ */ React__default.createElement(AvatarStackEffect, { status: _e, animation: ve, reverseEffects: K }),
73546
- /* @__PURE__ */ React__default.createElement(Tooltip.Root, null, /* @__PURE__ */ React__default.createElement(Avatar.Root, { ...avatarProps, animation: ve, status: _e }, /* @__PURE__ */ React__default.createElement(Tooltip.Trigger, { asChild: !0 }, /* @__PURE__ */ React__default.createElement(Avatar.Frame, { tabIndex: 0, classNames: [focusRing, "relative rounded-full place-self-center"] }, /* @__PURE__ */ React__default.createElement(Avatar.Fallback, { text: hexToEmoji(ce) })))), /* @__PURE__ */ React__default.createElement(Tooltip.Portal, null, /* @__PURE__ */ React__default.createElement(Tooltip.Content, { side: "left", classNames: "z-[70]" }, J(ne === Invitation.Type.MULTIUSE ? "invite many qr label" : "invite one qr label"), /* @__PURE__ */ React__default.createElement(Tooltip.Arrow, null)))),
73561
+ /* @__PURE__ */ React__default.createElement(ListItem.Heading, { classNames: "sr-only" }, J(ne ? "invite many list item label" : "invite one list item label")),
73562
+ ne && /* @__PURE__ */ React__default.createElement(AvatarStackEffect, { status: _e, animation: ve, reverseEffects: K }),
73563
+ /* @__PURE__ */ React__default.createElement(Tooltip.Root, null, /* @__PURE__ */ React__default.createElement(Avatar.Root, { ...avatarProps, animation: ve, status: _e }, /* @__PURE__ */ React__default.createElement(Tooltip.Trigger, { asChild: !0 }, /* @__PURE__ */ React__default.createElement(Avatar.Frame, { tabIndex: 0, classNames: [focusRing, "relative rounded-full place-self-center"] }, /* @__PURE__ */ React__default.createElement(Avatar.Fallback, { text: hexToEmoji(ce) })))), /* @__PURE__ */ React__default.createElement(Tooltip.Portal, null, /* @__PURE__ */ React__default.createElement(Tooltip.Content, { side: "left", classNames: "z-[70]" }, J(ne ? "invite many qr label" : "invite one qr label"), /* @__PURE__ */ React__default.createElement(Tooltip.Arrow, null)))),
73547
73564
  ae && le ? /* @__PURE__ */ React__default.createElement(Tooltip.Root, null, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Tooltip.Trigger, { asChild: !0 }, /* @__PURE__ */ React__default.createElement(
73548
73565
  Button,
73549
73566
  {
@@ -79260,7 +79277,7 @@ dist$1.addValue = memory_1.addValue;
79260
79277
  var helpers_1 = helpers;
79261
79278
  dist$1.trimUndefined = helpers_1.trimUndefined;
79262
79279
  dist$1.trimUndefinedRecursively = helpers_1.trimUndefinedRecursively;
79263
- var __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/codec-protobuf/src/stream.ts", Stream$1 = class dr {
79280
+ var __dxlog_file3$3 = "/home/runner/work/dxos/dxos/packages/common/codec-protobuf/src/stream.ts", Stream$1 = class dr {
79264
79281
  constructor(I) {
79265
79282
  this._messageHandler = void 0, this._closeHandler = void 0, this._readyHandler = void 0, this._isClosed = !1, this._closeError = void 0, this._producerCleanup = void 0, this._isReady = !1, this._buffer = [], this._readyPromise = new Promise((U) => {
79266
79283
  this._resolveReadyPromise = U;
@@ -79279,7 +79296,7 @@ var __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/codec-protobu
79279
79296
  next: (q) => {
79280
79297
  if (this._isClosed) {
79281
79298
  log$2("Stream is closed, dropping message.", void 0, {
79282
- F: __dxlog_file3$4,
79299
+ F: __dxlog_file3$3,
79283
79300
  L: 207,
79284
79301
  S: this,
79285
79302
  C: (G, K) => G(...K)
@@ -79294,7 +79311,7 @@ var __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/codec-protobu
79294
79311
  }
79295
79312
  else
79296
79313
  invariant(this._buffer, void 0, {
79297
- F: __dxlog_file3$4,
79314
+ F: __dxlog_file3$3,
79298
79315
  L: 221,
79299
79316
  S: this,
79300
79317
  A: [
@@ -79396,7 +79413,7 @@ var __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/codec-protobu
79396
79413
  // TODO(burdon): Can this be cancelled?
79397
79414
  subscribe(I, U) {
79398
79415
  invariant(!this._messageHandler, "Stream is already subscribed to.", {
79399
- F: __dxlog_file3$4,
79416
+ F: __dxlog_file3$3,
79400
79417
  L: 262,
79401
79418
  S: this,
79402
79419
  A: [
@@ -79404,7 +79421,7 @@ var __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/codec-protobu
79404
79421
  "'Stream is already subscribed to.'"
79405
79422
  ]
79406
79423
  }), invariant(!this._closeHandler, "Stream is already subscribed to.", {
79407
- F: __dxlog_file3$4,
79424
+ F: __dxlog_file3$3,
79408
79425
  L: 263,
79409
79426
  S: this,
79410
79427
  A: [
@@ -79412,7 +79429,7 @@ var __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/codec-protobu
79412
79429
  "'Stream is already subscribed to.'"
79413
79430
  ]
79414
79431
  }), invariant(this._buffer, void 0, {
79415
- F: __dxlog_file3$4,
79432
+ F: __dxlog_file3$3,
79416
79433
  L: 264,
79417
79434
  S: this,
79418
79435
  A: [
@@ -79444,7 +79461,7 @@ var __dxlog_file3$4 = "/home/runner/work/dxos/dxos/packages/common/codec-protobu
79444
79461
  */
79445
79462
  onReady(I) {
79446
79463
  invariant(!this._readyHandler, "Stream already has a handler for the ready event.", {
79447
- F: __dxlog_file3$4,
79464
+ F: __dxlog_file3$3,
79448
79465
  L: 299,
79449
79466
  S: this,
79450
79467
  A: [
@@ -82099,7 +82116,7 @@ var SignalState;
82099
82116
  var ws = null;
82100
82117
  typeof WebSocket < "u" ? ws = WebSocket : typeof MozWebSocket < "u" ? ws = MozWebSocket : typeof commonjsGlobal < "u" ? ws = commonjsGlobal.WebSocket || commonjsGlobal.MozWebSocket : typeof window < "u" ? ws = window.WebSocket || window.MozWebSocket : typeof self < "u" && (ws = self.WebSocket || self.MozWebSocket);
82101
82118
  var browser$3 = ws;
82102
- const WebSocket2 = /* @__PURE__ */ getDefaultExportFromCjs(browser$3);
82119
+ const WebSocket3 = /* @__PURE__ */ getDefaultExportFromCjs(browser$3);
82103
82120
  var MessageTrace;
82104
82121
  (function($) {
82105
82122
  (function(I) {
@@ -82783,7 +82800,7 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
82783
82800
  L: 55,
82784
82801
  S: this,
82785
82802
  C: (q, G) => q(...G)
82786
- }), this._url = $, this._callbacks = I, this._socket = new WebSocket2(this._url), this._rpc = createProtoRpcPeer({
82803
+ }), this._url = $, this._callbacks = I, this._socket = new WebSocket3(this._url), this._rpc = createProtoRpcPeer({
82787
82804
  requested: {
82788
82805
  Signal: schema.getService("dxos.mesh.signal.Signal")
82789
82806
  },
@@ -82870,7 +82887,7 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
82870
82887
  var $, I, U, q;
82871
82888
  await (($ = this._keepaliveCtx) == null ? void 0 : $.dispose()), this._closed = !0;
82872
82889
  try {
82873
- await ((I = this._rpc) == null ? void 0 : I.close()), (((U = this._socket) == null ? void 0 : U.readyState) === WebSocket2.OPEN || ((q = this._socket) == null ? void 0 : q.readyState) === WebSocket2.CONNECTING) && this._socket.close(), await this._closeComplete.wait({
82890
+ await ((I = this._rpc) == null ? void 0 : I.close()), (((U = this._socket) == null ? void 0 : U.readyState) === WebSocket3.OPEN || ((q = this._socket) == null ? void 0 : q.readyState) === WebSocket3.CONNECTING) && this._socket.close(), await this._closeComplete.wait({
82874
82891
  timeout: 1e3
82875
82892
  });
82876
82893
  } catch (G) {
@@ -82980,10 +82997,9 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
82980
82997
  metadata: (G = (q = this._callbacks) == null ? void 0 : q.getMetadata) == null ? void 0 : G.call(q)
82981
82998
  });
82982
82999
  }
82983
- }, __dxlog_file3$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-client.ts", DEFAULT_RECONNECT_TIMEOUT = 100, MAX_RECONNECT_TIMEOUT = 5e3, ERROR_RECONCILE_DELAY = 1e3, RECONCILE_INTERVAL = 5e3, SignalClient = class {
83000
+ }, __dxlog_file3$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-client.ts", DEFAULT_RECONNECT_TIMEOUT = 100, MAX_RECONNECT_TIMEOUT = 5e3, ERROR_RECONCILE_DELAY = 1e3, RECONCILE_INTERVAL = 5e3, SignalClient = class {
82984
83001
  /**
82985
83002
  * @param _host Signal server websocket URL.
82986
- * @param _onMessage
82987
83003
  */
82988
83004
  constructor($, I, U, q) {
82989
83005
  if (this._host = $, this._onMessage = I, this._onSwarmEvent = U, this._getMetadata = q, this._state = SignalState.CLOSED, this._reconnectAfter = DEFAULT_RECONNECT_TIMEOUT, this._connectionStarted = /* @__PURE__ */ new Date(), this._lastStateChange = /* @__PURE__ */ new Date(), this._clientReady = new Trigger(), this.statusChanged = new Event$1(), this.commandTrace = new Event$1(), this._swarmStreams = new ComplexMap(({ topic: G, peerId: K }) => G.toHex() + K.toHex()), this._joinedTopics = new ComplexSet(({ topic: G, peerId: K }) => G.toHex() + K.toHex()), this._messageStreams = new ComplexMap((G) => G.toHex()), this._subscribedMessages = new ComplexSet(({ peerId: G }) => G.toHex()), this._reconciled = new Event$1(), this._instanceId = PublicKey.random().toHex(), this._performance = {
@@ -82995,12 +83011,12 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
82995
83011
  }, !this._host.startsWith("wss://") && !this._host.startsWith("ws://"))
82996
83012
  throw new Error(`Signal server requires a websocket URL. Provided: ${this._host}`);
82997
83013
  }
82998
- open() {
83014
+ async open() {
82999
83015
  log$2.trace("dxos.mesh.signal-client.open", trace$1.begin({
83000
83016
  id: this._instanceId
83001
83017
  }), {
83002
- F: __dxlog_file3$3,
83003
- L: 136,
83018
+ F: __dxlog_file3$2,
83019
+ L: 128,
83004
83020
  S: this,
83005
83021
  C: ($, I) => $(...I)
83006
83022
  }), ![
@@ -83010,8 +83026,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83010
83026
  onError: ($) => {
83011
83027
  var I;
83012
83028
  this._state === SignalState.CLOSED || (I = this._ctx) != null && I.disposed || (this._state === SignalState.CONNECTED && log$2.warn("SignalClient error:", $, {
83013
- F: __dxlog_file3$3,
83014
- L: 148,
83029
+ F: __dxlog_file3$2,
83030
+ L: 140,
83015
83031
  S: this,
83016
83032
  C: (U, q) => U(...q)
83017
83033
  }), this._scheduleReconcileAfterError());
@@ -83025,8 +83041,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83025
83041
  }), this._setState(SignalState.CONNECTING), this._createClient(), log$2.trace("dxos.mesh.signal-client.open", trace$1.end({
83026
83042
  id: this._instanceId
83027
83043
  }), {
83028
- F: __dxlog_file3$3,
83029
- L: 177,
83044
+ F: __dxlog_file3$2,
83045
+ L: 169,
83030
83046
  S: this,
83031
83047
  C: ($, I) => $(...I)
83032
83048
  }));
@@ -83034,15 +83050,15 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83034
83050
  async close() {
83035
83051
  var $, I;
83036
83052
  log$2("closing...", void 0, {
83037
- F: __dxlog_file3$3,
83038
- L: 181,
83053
+ F: __dxlog_file3$2,
83054
+ L: 173,
83039
83055
  S: this,
83040
83056
  C: (U, q) => U(...q)
83041
83057
  }), ![
83042
83058
  SignalState.CLOSED
83043
83059
  ].includes(this._state) && (await (($ = this._ctx) == null ? void 0 : $.dispose()), this._clientReady.reset(), await ((I = this._client) == null ? void 0 : I.close()), this._client = void 0, this._setState(SignalState.CLOSED), log$2("closed", void 0, {
83044
- F: __dxlog_file3$3,
83045
- L: 192,
83060
+ F: __dxlog_file3$2,
83061
+ L: 184,
83046
83062
  S: this,
83047
83063
  C: (U, q) => U(...q)
83048
83064
  }));
@@ -83063,8 +83079,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83063
83079
  topic: $,
83064
83080
  peerId: I
83065
83081
  }, {
83066
- F: __dxlog_file3$3,
83067
- L: 207,
83082
+ F: __dxlog_file3$2,
83083
+ L: 199,
83068
83084
  S: this,
83069
83085
  C: (U, q) => U(...q)
83070
83086
  }), this._performance.joinCounter++, this._joinedTopics.add({
@@ -83078,8 +83094,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83078
83094
  topic: $,
83079
83095
  peerId: I
83080
83096
  }, {
83081
- F: __dxlog_file3$3,
83082
- L: 215,
83097
+ F: __dxlog_file3$2,
83098
+ L: 207,
83083
83099
  S: this,
83084
83100
  C: (q, G) => q(...G)
83085
83101
  }), (U = this._swarmStreams.get({
@@ -83095,8 +83111,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83095
83111
  }
83096
83112
  async sendMessage($) {
83097
83113
  this._performance.sentMessages++, await this._clientReady.wait(), invariant(this._state === SignalState.CONNECTED, "Not connected to Signal Server", {
83098
- F: __dxlog_file3$3,
83099
- L: 225,
83114
+ F: __dxlog_file3$2,
83115
+ L: 216,
83100
83116
  S: this,
83101
83117
  A: [
83102
83118
  "this._state === SignalState.CONNECTED",
@@ -83108,8 +83124,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83108
83124
  log$2("subscribing to messages", {
83109
83125
  peerId: $
83110
83126
  }, {
83111
- F: __dxlog_file3$3,
83112
- L: 230,
83127
+ F: __dxlog_file3$2,
83128
+ L: 221,
83113
83129
  S: this,
83114
83130
  C: (I, U) => I(...U)
83115
83131
  }), this._subscribedMessages.add({
@@ -83121,8 +83137,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83121
83137
  log$2("unsubscribing from messages", {
83122
83138
  peerId: $
83123
83139
  }, {
83124
- F: __dxlog_file3$3,
83125
- L: 236,
83140
+ F: __dxlog_file3$2,
83141
+ L: 227,
83126
83142
  S: this,
83127
83143
  C: (U, q) => U(...q)
83128
83144
  }), this._subscribedMessages.delete({
@@ -83138,8 +83154,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83138
83154
  this._state = $, this._lastStateChange = /* @__PURE__ */ new Date(), log$2("signal state changed", {
83139
83155
  status: this.getStatus()
83140
83156
  }, {
83141
- F: __dxlog_file3$3,
83142
- L: 255,
83157
+ F: __dxlog_file3$2,
83158
+ L: 246,
83143
83159
  S: this,
83144
83160
  C: (I, U) => I(...U)
83145
83161
  }), this.statusChanged.emit(this.getStatus());
@@ -83149,13 +83165,13 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83149
83165
  host: this._host,
83150
83166
  state: this._state
83151
83167
  }, {
83152
- F: __dxlog_file3$3,
83153
- L: 260,
83168
+ F: __dxlog_file3$2,
83169
+ L: 251,
83154
83170
  S: this,
83155
83171
  C: ($, I) => $(...I)
83156
83172
  }), invariant(!this._client, "Client already created", {
83157
- F: __dxlog_file3$3,
83158
- L: 261,
83173
+ F: __dxlog_file3$2,
83174
+ L: 252,
83159
83175
  S: this,
83160
83176
  A: [
83161
83177
  "!this._client",
@@ -83163,8 +83179,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83163
83179
  ]
83164
83180
  }), this._connectionStarted = /* @__PURE__ */ new Date(), this._connectionCtx = this._ctx.derive(), this._connectionCtx.onDispose(async () => {
83165
83181
  log$2("connection context disposed", void 0, {
83166
- F: __dxlog_file3$3,
83167
- L: 268,
83182
+ F: __dxlog_file3$2,
83183
+ L: 259,
83168
83184
  S: this,
83169
83185
  C: ($, I) => $(...I)
83170
83186
  }), await Promise.all(Array.from(this._swarmStreams.values()).map(($) => $.close())), await Promise.all(Array.from(this._messageStreams.values()).map(($) => $.close())), this._swarmStreams.clear(), this._messageStreams.clear();
@@ -83175,8 +83191,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83175
83191
  callbacks: {
83176
83192
  onConnected: () => {
83177
83193
  log$2("socket connected", void 0, {
83178
- F: __dxlog_file3$3,
83179
- L: 280,
83194
+ F: __dxlog_file3$2,
83195
+ L: 271,
83180
83196
  S: this,
83181
83197
  C: ($, I) => $(...I)
83182
83198
  }), this._lastError = void 0, this._reconnectAfter = DEFAULT_RECONNECT_TIMEOUT, this._setState(SignalState.CONNECTED), this._clientReady.wake(), this._reconcileTask.schedule();
@@ -83185,8 +83201,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83185
83201
  if (log$2("socket disconnected", {
83186
83202
  state: this._state
83187
83203
  }, {
83188
- F: __dxlog_file3$3,
83189
- L: 289,
83204
+ F: __dxlog_file3$2,
83205
+ L: 280,
83190
83206
  S: this,
83191
83207
  C: ($, I) => $(...I)
83192
83208
  }), this._state === SignalState.ERROR) {
@@ -83200,8 +83216,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83200
83216
  error: $,
83201
83217
  state: this._state
83202
83218
  }, {
83203
- F: __dxlog_file3$3,
83204
- L: 304,
83219
+ F: __dxlog_file3$2,
83220
+ L: 295,
83205
83221
  S: this,
83206
83222
  C: (I, U) => I(...U)
83207
83223
  }), this._lastError = $, this._state !== SignalState.CONNECTED && this._state !== SignalState.CONNECTING && this._incrementReconnectTimeout(), this._setState(SignalState.ERROR), this._reconnectTask.schedule();
@@ -83221,14 +83237,14 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83221
83237
  if (log$2(`reconnecting in ${this._reconnectAfter}ms`, {
83222
83238
  state: this._state
83223
83239
  }, {
83224
- F: __dxlog_file3$3,
83225
- L: 332,
83240
+ F: __dxlog_file3$2,
83241
+ L: 323,
83226
83242
  S: this,
83227
83243
  C: (U, q) => U(...q)
83228
83244
  }), this._performance.reconnectCounter++, this._state === SignalState.RECONNECTING) {
83229
83245
  log$2.warn("Signal api already reconnecting.", void 0, {
83230
- F: __dxlog_file3$3,
83231
- L: 336,
83246
+ F: __dxlog_file3$2,
83247
+ L: 327,
83232
83248
  S: this,
83233
83249
  C: (U, q) => U(...q)
83234
83250
  });
@@ -83242,8 +83258,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83242
83258
  await asyncTimeout(cancelWithContext(this._connectionCtx, this._clientReady.wait()), 5e3);
83243
83259
  const $ = this._client;
83244
83260
  invariant(this._state === SignalState.CONNECTED, "Not connected to Signal Server", {
83245
- F: __dxlog_file3$3,
83246
- L: 361,
83261
+ F: __dxlog_file3$2,
83262
+ L: 352,
83247
83263
  S: this,
83248
83264
  A: [
83249
83265
  "this._state === SignalState.CONNECTED",
@@ -83275,8 +83291,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83275
83291
  log$2("swarm event", {
83276
83292
  swarmEvent: K
83277
83293
  }, {
83278
- F: __dxlog_file3$3,
83279
- L: 388,
83294
+ F: __dxlog_file3$2,
83295
+ L: 379,
83280
83296
  S: this,
83281
83297
  C: (Y, J) => Y(...J)
83282
83298
  }), await this._onSwarmEvent({
@@ -83294,8 +83310,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83294
83310
  await asyncTimeout(cancelWithContext(this._connectionCtx, this._clientReady.wait()), 5e3);
83295
83311
  const $ = this._client;
83296
83312
  invariant(this._state === SignalState.CONNECTED, "Not connected to Signal Server", {
83297
- F: __dxlog_file3$3,
83298
- L: 401,
83313
+ F: __dxlog_file3$2,
83314
+ L: 392,
83299
83315
  S: this,
83300
83316
  A: [
83301
83317
  "this._state === SignalState.CONNECTED",
@@ -83335,7 +83351,7 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83335
83351
  hosts: this._hosts
83336
83352
  }, {
83337
83353
  F: __dxlog_file5$2,
83338
- L: 49,
83354
+ L: 51,
83339
83355
  S: this,
83340
83356
  C: (U, q) => U(...q)
83341
83357
  });
@@ -83351,14 +83367,14 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83351
83367
  hosts: this._hosts
83352
83368
  }, {
83353
83369
  F: __dxlog_file5$2,
83354
- L: 73,
83370
+ L: 78,
83355
83371
  S: this,
83356
83372
  C: ($, I) => $(...I)
83357
83373
  }), log$2.trace("dxos.mesh.websocket-signal-manager.open", trace$1.begin({
83358
83374
  id: this._instanceId
83359
83375
  }), {
83360
83376
  F: __dxlog_file5$2,
83361
- L: 74,
83377
+ L: 79,
83362
83378
  S: this,
83363
83379
  C: ($, I) => $(...I)
83364
83380
  }), this._initContext(), [
@@ -83367,7 +83383,7 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83367
83383
  id: this._instanceId
83368
83384
  }), {
83369
83385
  F: __dxlog_file5$2,
83370
- L: 81,
83386
+ L: 87,
83371
83387
  S: this,
83372
83388
  C: ($, I) => $(...I)
83373
83389
  }));
@@ -83376,16 +83392,16 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83376
83392
  this._opened && (this._opened = !1, await this._ctx.dispose(), await Promise.all(Array.from(this._servers.values()).map(($) => $.close())));
83377
83393
  }
83378
83394
  async restartServer($) {
83379
- log$2("Restarting server", {
83395
+ log$2("restarting server", {
83380
83396
  serverName: $
83381
83397
  }, {
83382
83398
  F: __dxlog_file5$2,
83383
- L: 97,
83399
+ L: 103,
83384
83400
  S: this,
83385
83401
  C: (U, q) => U(...q)
83386
83402
  }), invariant(this._opened, "server already closed", {
83387
83403
  F: __dxlog_file5$2,
83388
- L: 98,
83404
+ L: 104,
83389
83405
  S: this,
83390
83406
  A: [
83391
83407
  "this._opened",
@@ -83395,7 +83411,7 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83395
83411
  const I = this._servers.get($);
83396
83412
  invariant(I, "server not found", {
83397
83413
  F: __dxlog_file5$2,
83398
- L: 101,
83414
+ L: 107,
83399
83415
  S: this,
83400
83416
  A: [
83401
83417
  "server",
@@ -83407,17 +83423,17 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83407
83423
  return Array.from(this._servers.values()).map(($) => $.getStatus());
83408
83424
  }
83409
83425
  async join({ topic: $, peerId: I }) {
83410
- log$2("Join", {
83426
+ log$2("join", {
83411
83427
  topic: $,
83412
83428
  peerId: I
83413
83429
  }, {
83414
83430
  F: __dxlog_file5$2,
83415
- L: 114,
83431
+ L: 120,
83416
83432
  S: this,
83417
83433
  C: (U, q) => U(...q)
83418
83434
  }), invariant(this._opened, "Closed", {
83419
83435
  F: __dxlog_file5$2,
83420
- L: 115,
83436
+ L: 121,
83421
83437
  S: this,
83422
83438
  A: [
83423
83439
  "this._opened",
@@ -83434,12 +83450,12 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83434
83450
  peerId: I
83435
83451
  }, {
83436
83452
  F: __dxlog_file5$2,
83437
- L: 121,
83453
+ L: 127,
83438
83454
  S: this,
83439
83455
  C: (U, q) => U(...q)
83440
83456
  }), invariant(this._opened, "Closed", {
83441
83457
  F: __dxlog_file5$2,
83442
- L: 122,
83458
+ L: 128,
83443
83459
  S: this,
83444
83460
  A: [
83445
83461
  "this._opened",
@@ -83451,14 +83467,16 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83451
83467
  }));
83452
83468
  }
83453
83469
  async sendMessage({ author: $, recipient: I, payload: U }) {
83454
- log$2(`Signal ${I.truncate()}`, void 0, {
83470
+ log$2("signal", {
83471
+ recipient: I
83472
+ }, {
83455
83473
  F: __dxlog_file5$2,
83456
- L: 136,
83474
+ L: 142,
83457
83475
  S: this,
83458
83476
  C: (q, G) => q(...G)
83459
83477
  }), invariant(this._opened, "Closed", {
83460
83478
  F: __dxlog_file5$2,
83461
- L: 137,
83479
+ L: 143,
83462
83480
  S: this,
83463
83481
  A: [
83464
83482
  "this._opened",
@@ -83474,21 +83492,21 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83474
83492
  err: K
83475
83493
  }, {
83476
83494
  F: __dxlog_file5$2,
83477
- L: 142,
83495
+ L: 148,
83478
83496
  S: this,
83479
83497
  C: (Y, J) => Y(...J)
83480
83498
  }) : K instanceof TimeoutError$1 || K.constructor.name === "TimeoutError" ? (log$2.info("WSS sendMessage timeout", {
83481
83499
  err: K
83482
83500
  }, {
83483
83501
  F: __dxlog_file5$2,
83484
- L: 144,
83502
+ L: 150,
83485
83503
  S: this,
83486
83504
  C: (Y, J) => Y(...J)
83487
83505
  }), this.checkServerFailure(G)) : (log$2.info(`error sending to ${G}`, {
83488
83506
  err: K
83489
83507
  }, {
83490
83508
  F: __dxlog_file5$2,
83491
- L: 147,
83509
+ L: 153,
83492
83510
  S: this,
83493
83511
  C: (Y, J) => Y(...J)
83494
83512
  }), this.checkServerFailure(G));
@@ -83498,9 +83516,9 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83498
83516
  async checkServerFailure($) {
83499
83517
  const I = this.failureCount.get($) ?? 0;
83500
83518
  if (I > MAX_SERVER_FAILURES) {
83501
- log$2.warn(`Too many failures sending to ${$} (${I} > ${MAX_SERVER_FAILURES}), restarting`, void 0, {
83519
+ log$2.warn(`too many failures sending to ${$} (${I} > ${MAX_SERVER_FAILURES}), restarting`, void 0, {
83502
83520
  F: __dxlog_file5$2,
83503
- L: 158,
83521
+ L: 164,
83504
83522
  S: this,
83505
83523
  C: (U, q) => U(...q)
83506
83524
  }), await this.restartServer($), this.failureCount.set($, 0);
@@ -83509,14 +83527,16 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83509
83527
  this.failureCount.set($, (this.failureCount.get($) ?? 0) + 1);
83510
83528
  }
83511
83529
  async subscribeMessages($) {
83512
- log$2(`Subscribed for message stream peerId=${$}`, void 0, {
83530
+ log$2("subscribed for message stream", {
83531
+ peerId: $
83532
+ }, {
83513
83533
  F: __dxlog_file5$2,
83514
- L: 167,
83534
+ L: 174,
83515
83535
  S: this,
83516
83536
  C: (I, U) => I(...U)
83517
83537
  }), invariant(this._opened, "Closed", {
83518
83538
  F: __dxlog_file5$2,
83519
- L: 168,
83539
+ L: 175,
83520
83540
  S: this,
83521
83541
  A: [
83522
83542
  "this._opened",
@@ -83525,14 +83545,16 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83525
83545
  }), await this._forEachServer(async (I) => I.subscribeMessages($));
83526
83546
  }
83527
83547
  async unsubscribeMessages($) {
83528
- log$2(`Subscribed for message stream peerId=${$}`, void 0, {
83548
+ log$2("subscribed for message stream", {
83549
+ peerId: $
83550
+ }, {
83529
83551
  F: __dxlog_file5$2,
83530
- L: 174,
83552
+ L: 181,
83531
83553
  S: this,
83532
83554
  C: (I, U) => I(...U)
83533
83555
  }), invariant(this._opened, "Closed", {
83534
83556
  F: __dxlog_file5$2,
83535
- L: 175,
83557
+ L: 182,
83536
83558
  S: this,
83537
83559
  A: [
83538
83560
  "this._opened",
@@ -83544,7 +83566,7 @@ var __dxlog_file5$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83544
83566
  this._ctx = new Context({
83545
83567
  onError: ($) => log$2.catch($, void 0, {
83546
83568
  F: __dxlog_file5$2,
83547
- L: 182,
83569
+ L: 189,
83548
83570
  S: this,
83549
83571
  C: (I, U) => I(...U)
83550
83572
  })
@@ -83569,14 +83591,14 @@ _ts_decorate$3([
83569
83591
  _ts_decorate$3([
83570
83592
  synchronized
83571
83593
  ], WebsocketSignalManager.prototype, "checkServerFailure", null);
83572
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/utils.ts", setIdentityTags = ({ identityService: $, devicesService: I, setTag: U }) => {
83594
+ var __dxlog_file6$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/utils.ts", setIdentityTags = ({ identityService: $, devicesService: I, setTag: U }) => {
83573
83595
  $.queryIdentity().subscribe((q) => {
83574
83596
  var G;
83575
83597
  if (!((G = q == null ? void 0 : q.identity) != null && G.identityKey)) {
83576
83598
  log$2("empty response from identity service", {
83577
83599
  idqr: q
83578
83600
  }, {
83579
- F: __dxlog_file6,
83601
+ F: __dxlog_file6$1,
83580
83602
  L: 21,
83581
83603
  S: void 0,
83582
83604
  C: (K, Y) => K(...Y)
@@ -83589,7 +83611,7 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/sr
83589
83611
  log$2("empty response from device service", {
83590
83612
  device: q
83591
83613
  }, {
83592
- F: __dxlog_file6,
83614
+ F: __dxlog_file6$1,
83593
83615
  L: 30,
83594
83616
  S: void 0,
83595
83617
  C: (K, Y) => K(...Y)
@@ -83597,7 +83619,7 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/sr
83597
83619
  return;
83598
83620
  }
83599
83621
  invariant(q, "empty response from device service", {
83600
- F: __dxlog_file6,
83622
+ F: __dxlog_file6$1,
83601
83623
  L: 33,
83602
83624
  S: void 0,
83603
83625
  A: [
@@ -83610,7 +83632,7 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/sr
83610
83632
  log$2("no current device", {
83611
83633
  device: q
83612
83634
  }, {
83613
- F: __dxlog_file6,
83635
+ F: __dxlog_file6$1,
83614
83636
  L: 37,
83615
83637
  S: void 0,
83616
83638
  C: (K, Y) => K(...Y)
@@ -84811,7 +84833,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84811
84833
  }, encodeFrame = ($) => {
84812
84834
  const I = export_Buffer.allocUnsafe(FRAME_LENGTH_SIZE + $.length);
84813
84835
  return I.writeUInt16BE($.length, 0), I.set($, FRAME_LENGTH_SIZE), I;
84814
- }, __dxlog_file3$2 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts", MAX_CHUNK_SIZE = 8192, Balancer = class {
84836
+ }, __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts", MAX_CHUNK_SIZE = 8192, Balancer = class {
84815
84837
  constructor($) {
84816
84838
  this._sysChannelId = $, this._lastCallerIndex = 0, this._channels = [], this._framer = new Framer(), this._sendBuffers = /* @__PURE__ */ new Map(), this._receiveBuffers = /* @__PURE__ */ new Map(), this._sending = !1, this.incomingData = new Event$1(), this.stream = this._framer.stream, this._channels.push($), this._framer.port.subscribe(this._processIncomingMessage.bind(this));
84817
84839
  }
@@ -84829,7 +84851,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84829
84851
  }
84830
84852
  pushData($, I, U) {
84831
84853
  this._enqueueChunk($, I, U), this._sendChunks().catch((q) => log$2.catch(q, void 0, {
84832
- F: __dxlog_file3$2,
84854
+ F: __dxlog_file3$1,
84833
84855
  L: 75,
84834
84856
  S: this,
84835
84857
  C: (G, K) => G(...K)
@@ -84837,7 +84859,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84837
84859
  }
84838
84860
  destroy() {
84839
84861
  this._sendBuffers.size !== 0 && log$2.info("destroying balancer with pending calls", void 0, {
84840
- F: __dxlog_file3$2,
84862
+ F: __dxlog_file3$1,
84841
84863
  L: 80,
84842
84864
  S: this,
84843
84865
  C: ($, I) => $(...I)
@@ -84904,12 +84926,12 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84904
84926
  let $;
84905
84927
  for ($ = this._getNextChunk(); $; ) {
84906
84928
  this._framer.writable || (log$2("PAUSE for drain", void 0, {
84907
- F: __dxlog_file3$2,
84929
+ F: __dxlog_file3$1,
84908
84930
  L: 179,
84909
84931
  S: this,
84910
84932
  C: (q, G) => q(...G)
84911
84933
  }), await this._framer.drain.waitForCount(1), log$2("RESUME for drain", void 0, {
84912
- F: __dxlog_file3$2,
84934
+ F: __dxlog_file3$1,
84913
84935
  L: 181,
84914
84936
  S: this,
84915
84937
  C: (q, G) => q(...G)
@@ -84920,7 +84942,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84920
84942
  log$2("Error sending chunk", {
84921
84943
  err: q
84922
84944
  }, {
84923
- F: __dxlog_file3$2,
84945
+ F: __dxlog_file3$1,
84924
84946
  L: 187,
84925
84947
  S: this,
84926
84948
  C: (G, K) => G(...K)
@@ -84929,7 +84951,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84929
84951
  $ = this._getNextChunk();
84930
84952
  }
84931
84953
  invariant(this._sendBuffers.size === 0, "sendBuffers not empty", {
84932
- F: __dxlog_file3$2,
84954
+ F: __dxlog_file3$1,
84933
84955
  L: 192,
84934
84956
  S: this,
84935
84957
  A: [
@@ -85702,13 +85724,13 @@ var Connection = class {
85702
85724
  stream: this._protocol.stream,
85703
85725
  sendSignal: async ($) => this._sendSignal($),
85704
85726
  sessionId: this.sessionId
85705
- }), this._transport.connected.once(async () => {
85727
+ }), await this._transport.open(), this._transport.connected.once(async () => {
85706
85728
  var $, I;
85707
85729
  this._changeState("CONNECTED"), await this.connectedTimeoutContext.dispose(), (I = ($ = this._callbacks) == null ? void 0 : $.onConnected) == null || I.call($), scheduleTaskInterval(this._ctx, async () => this._emitTransportStats(), TRANSPORT_STATS_INTERVAL);
85708
85730
  }), this._transport.closed.once(() => {
85709
85731
  this._transport = void 0, log$2("abort triggered by transport close", void 0, {
85710
85732
  F: __dxlog_file$2,
85711
- L: 216,
85733
+ L: 218,
85712
85734
  S: this,
85713
85735
  C: ($, I) => $(...I)
85714
85736
  }), this.abort().catch(($) => this.errors.raise($));
@@ -85717,35 +85739,35 @@ var Connection = class {
85717
85739
  err: $
85718
85740
  }, {
85719
85741
  F: __dxlog_file$2,
85720
- L: 221,
85742
+ L: 223,
85721
85743
  S: this,
85722
85744
  C: (I, U) => I(...U)
85723
85745
  }), this.closeReason || (this.closeReason = $ == null ? void 0 : $.message), $ instanceof ConnectionResetError ? (log$2.info("aborting due to transport ConnectionResetError", void 0, {
85724
85746
  F: __dxlog_file$2,
85725
- L: 228,
85747
+ L: 230,
85726
85748
  S: this,
85727
85749
  C: (I, U) => I(...U)
85728
85750
  }), this.abort().catch((I) => this.errors.raise(I))) : $ instanceof ConnectivityError ? (log$2.info("aborting due to transport ConnectivityError", void 0, {
85729
85751
  F: __dxlog_file$2,
85730
- L: 231,
85752
+ L: 233,
85731
85753
  S: this,
85732
85754
  C: (I, U) => I(...U)
85733
85755
  }), this.abort().catch((I) => this.errors.raise(I))) : $ instanceof UnknownProtocolError && log$2.warn("unsure what to do with UnknownProtocolError, will keep on truckin", {
85734
85756
  err: $
85735
85757
  }, {
85736
85758
  F: __dxlog_file$2,
85737
- L: 234,
85759
+ L: 236,
85738
85760
  S: this,
85739
85761
  C: (I, U) => I(...U)
85740
85762
  }), this._state !== "CLOSED" && this._state !== "CLOSING" && (await this.connectedTimeoutContext.dispose(), this.errors.raise($));
85741
85763
  });
85742
85764
  for (const $ of this._incomingSignalBuffer)
85743
- this._transport.signal($);
85765
+ this._transport.onSignal($);
85744
85766
  this._incomingSignalBuffer = [], log$2.trace("dxos.mesh.connection.open-connection", trace$1.end({
85745
85767
  id: this._instanceId
85746
85768
  }), {
85747
85769
  F: __dxlog_file$2,
85748
- L: 250,
85770
+ L: 252,
85749
85771
  S: this,
85750
85772
  C: ($, I) => $(...I)
85751
85773
  });
@@ -85756,13 +85778,13 @@ var Connection = class {
85756
85778
  err: $
85757
85779
  }, {
85758
85780
  F: __dxlog_file$2,
85759
- L: 257,
85781
+ L: 259,
85760
85782
  S: this,
85761
85783
  C: (G, K) => G(...K)
85762
85784
  }), this._state === "CLOSED" || this._state === "ABORTED") {
85763
85785
  log$2(`abort ignored: already ${this._state}`, this.closeReason, {
85764
85786
  F: __dxlog_file$2,
85765
- L: 259,
85787
+ L: 261,
85766
85788
  S: this,
85767
85789
  C: (G, K) => G(...K)
85768
85790
  });
@@ -85772,24 +85794,24 @@ var Connection = class {
85772
85794
  try {
85773
85795
  log$2("aborting protocol... ", void 0, {
85774
85796
  F: __dxlog_file$2,
85775
- L: 273,
85797
+ L: 275,
85776
85798
  S: this,
85777
85799
  C: (G, K) => G(...K)
85778
85800
  }), await this._protocol.abort();
85779
85801
  } catch (G) {
85780
85802
  log$2.catch(G, void 0, {
85781
85803
  F: __dxlog_file$2,
85782
- L: 276,
85804
+ L: 278,
85783
85805
  S: this,
85784
85806
  C: (K, Y) => K(...Y)
85785
85807
  });
85786
85808
  }
85787
85809
  try {
85788
- await ((I = this._transport) == null ? void 0 : I.destroy());
85810
+ await ((I = this._transport) == null ? void 0 : I.close());
85789
85811
  } catch (G) {
85790
85812
  log$2.catch(G, void 0, {
85791
85813
  F: __dxlog_file$2,
85792
- L: 283,
85814
+ L: 285,
85793
85815
  S: this,
85794
85816
  C: (K, Y) => K(...Y)
85795
85817
  });
@@ -85799,7 +85821,7 @@ var Connection = class {
85799
85821
  } catch (G) {
85800
85822
  log$2.catch(G, void 0, {
85801
85823
  F: __dxlog_file$2,
85802
- L: 289,
85824
+ L: 291,
85803
85825
  S: this,
85804
85826
  C: (K, Y) => K(...Y)
85805
85827
  });
@@ -85815,7 +85837,7 @@ var Connection = class {
85815
85837
  peerId: this.ownId
85816
85838
  }, {
85817
85839
  F: __dxlog_file$2,
85818
- L: 314,
85840
+ L: 316,
85819
85841
  S: this,
85820
85842
  C: (Y, J) => Y(...J)
85821
85843
  }), I === "CONNECTED") {
@@ -85824,17 +85846,17 @@ var Connection = class {
85824
85846
  } catch (Y) {
85825
85847
  log$2.catch(Y, void 0, {
85826
85848
  F: __dxlog_file$2,
85827
- L: 321,
85849
+ L: 323,
85828
85850
  S: this,
85829
85851
  C: (J, Z) => J(...Z)
85830
85852
  });
85831
85853
  }
85832
85854
  try {
85833
- await ((U = this._transport) == null ? void 0 : U.destroy());
85855
+ await ((U = this._transport) == null ? void 0 : U.close());
85834
85856
  } catch (Y) {
85835
85857
  log$2.catch(Y, void 0, {
85836
85858
  F: __dxlog_file$2,
85837
- L: 328,
85859
+ L: 330,
85838
85860
  S: this,
85839
85861
  C: (J, Z) => J(...Z)
85840
85862
  });
@@ -85842,7 +85864,7 @@ var Connection = class {
85842
85864
  } else {
85843
85865
  log$2.info(`graceful close requested when we were in ${I} state? aborting`, void 0, {
85844
85866
  F: __dxlog_file$2,
85845
- L: 331,
85867
+ L: 333,
85846
85868
  S: this,
85847
85869
  C: (Y, J) => Y(...J)
85848
85870
  });
@@ -85851,17 +85873,17 @@ var Connection = class {
85851
85873
  } catch (Y) {
85852
85874
  log$2.catch(Y, void 0, {
85853
85875
  F: __dxlog_file$2,
85854
- L: 335,
85876
+ L: 337,
85855
85877
  S: this,
85856
85878
  C: (J, Z) => J(...Z)
85857
85879
  });
85858
85880
  }
85859
85881
  try {
85860
- await ((q = this._transport) == null ? void 0 : q.destroy());
85882
+ await ((q = this._transport) == null ? void 0 : q.close());
85861
85883
  } catch (Y) {
85862
85884
  log$2.catch(Y, void 0, {
85863
85885
  F: __dxlog_file$2,
85864
- L: 340,
85886
+ L: 342,
85865
85887
  S: this,
85866
85888
  C: (J, Z) => J(...Z)
85867
85889
  });
@@ -85871,7 +85893,7 @@ var Connection = class {
85871
85893
  peerId: this.ownId
85872
85894
  }, {
85873
85895
  F: __dxlog_file$2,
85874
- L: 344,
85896
+ L: 346,
85875
85897
  S: this,
85876
85898
  C: (Y, J) => Y(...J)
85877
85899
  }), this._changeState("CLOSED"), (K = (G = this._callbacks) == null ? void 0 : G.onClosed) == null || K.call(G, $);
@@ -85905,7 +85927,7 @@ var Connection = class {
85905
85927
  err: I
85906
85928
  }, {
85907
85929
  F: __dxlog_file$2,
85908
- L: 382,
85930
+ L: 384,
85909
85931
  S: this,
85910
85932
  C: (U, q) => U(...q)
85911
85933
  }), await this.close(new ConnectivityError("signal message failed to deliver", I));
@@ -85918,7 +85940,7 @@ var Connection = class {
85918
85940
  var U, q;
85919
85941
  if (invariant($.sessionId, void 0, {
85920
85942
  F: __dxlog_file$2,
85921
- L: 391,
85943
+ L: 393,
85922
85944
  S: this,
85923
85945
  A: [
85924
85946
  "msg.sessionId",
@@ -85927,7 +85949,7 @@ var Connection = class {
85927
85949
  }), !$.sessionId.equals(this.sessionId)) {
85928
85950
  log$2("dropping signal for incorrect session id", void 0, {
85929
85951
  F: __dxlog_file$2,
85930
- L: 393,
85952
+ L: 395,
85931
85953
  S: this,
85932
85954
  C: (G, K) => G(...K)
85933
85955
  });
@@ -85935,7 +85957,7 @@ var Connection = class {
85935
85957
  }
85936
85958
  invariant($.data.signal || $.data.signalBatch, void 0, {
85937
85959
  F: __dxlog_file$2,
85938
- L: 396,
85960
+ L: 398,
85939
85961
  S: this,
85940
85962
  A: [
85941
85963
  "msg.data.signal || msg.data.signalBatch",
@@ -85943,7 +85965,7 @@ var Connection = class {
85943
85965
  ]
85944
85966
  }), invariant((U = $.author) == null ? void 0 : U.equals(this.remoteId), void 0, {
85945
85967
  F: __dxlog_file$2,
85946
- L: 397,
85968
+ L: 399,
85947
85969
  S: this,
85948
85970
  A: [
85949
85971
  "msg.author?.equals(this.remoteId)",
@@ -85951,7 +85973,7 @@ var Connection = class {
85951
85973
  ]
85952
85974
  }), invariant((q = $.recipient) == null ? void 0 : q.equals(this.ownId), void 0, {
85953
85975
  F: __dxlog_file$2,
85954
- L: 398,
85976
+ L: 400,
85955
85977
  S: this,
85956
85978
  A: [
85957
85979
  "msg.recipient?.equals(this.ownId)",
@@ -85971,12 +85993,12 @@ var Connection = class {
85971
85993
  msg: $.data
85972
85994
  }, {
85973
85995
  F: __dxlog_file$2,
85974
- L: 407,
85996
+ L: 409,
85975
85997
  S: this,
85976
85998
  C: (K, Y) => K(...Y)
85977
85999
  }), this._incomingSignalBuffer.push(G)) : (invariant(this._transport, "Connection not ready to accept signals.", {
85978
86000
  F: __dxlog_file$2,
85979
- L: 410,
86001
+ L: 412,
85980
86002
  S: this,
85981
86003
  A: [
85982
86004
  "this._transport",
@@ -85988,10 +86010,10 @@ var Connection = class {
85988
86010
  msg: $.data
85989
86011
  }, {
85990
86012
  F: __dxlog_file$2,
85991
- L: 411,
86013
+ L: 413,
85992
86014
  S: this,
85993
86015
  C: (K, Y) => K(...Y)
85994
- }), await this._transport.signal(G)));
86016
+ }), await this._transport.onSignal(G)));
85995
86017
  }
85996
86018
  initiate() {
85997
86019
  this._changeState("INITIAL");
@@ -86003,12 +86025,12 @@ var Connection = class {
86003
86025
  peerId: this.ownId
86004
86026
  }, {
86005
86027
  F: __dxlog_file$2,
86006
- L: 422,
86028
+ L: 424,
86007
86029
  S: this,
86008
86030
  C: (I, U) => I(...U)
86009
86031
  }), invariant($ !== this._state, "Already in this state.", {
86010
86032
  F: __dxlog_file$2,
86011
- L: 423,
86033
+ L: 425,
86012
86034
  S: this,
86013
86035
  A: [
86014
86036
  "state !== this._state",
@@ -86242,12 +86264,11 @@ function _ts_decorate2$1($, I, U, q) {
86242
86264
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
86243
86265
  return G > 3 && K && Object.defineProperty(I, U, K), K;
86244
86266
  }
86245
- var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts", ConnectionDisplacedError = class extends SystemError {
86267
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts", ConnectionDisplacedError = class extends SystemError {
86246
86268
  constructor() {
86247
86269
  super("Connection displaced by remote initiator.");
86248
86270
  }
86249
86271
  }, CONNECTION_COUNTS_STABLE_AFTER = 5e3, Peer = class {
86250
- // TODO(burdon): Convert to map?
86251
86272
  constructor($, I, U, q, G, K, Y, J) {
86252
86273
  this.id = $, this.topic = I, this.localPeerId = U, this._signalMessaging = q, this._protocolProvider = G, this._transportFactory = K, this._connectionLimiter = Y, this._callbacks = J, this._availableAfter = 0, this.availableToConnect = !0, this._ctx = new Context(), this.advertizing = !1, this.initiating = !1, this.connectionDisplaced = new Event$1();
86253
86274
  }
@@ -86263,8 +86284,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86263
86284
  ConnectionState.CONNECTING
86264
86285
  ].includes(this.connection.state))
86265
86286
  return log$2.info(`received offer when connection already in ${this.connection.state} state`, void 0, {
86266
- F: __dxlog_file3$1,
86267
- L: 115,
86287
+ F: __dxlog_file3,
86288
+ L: 114,
86268
86289
  S: this,
86269
86290
  C: (q, G) => q(...G)
86270
86291
  }), {
@@ -86278,8 +86299,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86278
86299
  remotePeerId: this.localPeerId,
86279
86300
  sessionId: (U = this.connection) == null ? void 0 : U.sessionId
86280
86301
  }, {
86281
- F: __dxlog_file3$1,
86282
- L: 124,
86302
+ F: __dxlog_file3,
86303
+ L: 123,
86283
86304
  S: this,
86284
86305
  C: (q, G) => q(...G)
86285
86306
  }), this.connection && await this.closeConnection(new ConnectionDisplacedError());
@@ -86289,8 +86310,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86289
86310
  };
86290
86311
  if (await this._callbacks.onOffer(I) && !this.connection) {
86291
86312
  invariant($.sessionId, void 0, {
86292
- F: __dxlog_file3$1,
86293
- L: 144,
86313
+ F: __dxlog_file3,
86314
+ L: 143,
86294
86315
  S: this,
86295
86316
  A: [
86296
86317
  "message.sessionId",
@@ -86307,8 +86328,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86307
86328
  remoteId: this.id,
86308
86329
  err: G
86309
86330
  }, {
86310
- F: __dxlog_file3$1,
86311
- L: 154,
86331
+ F: __dxlog_file3,
86332
+ L: 153,
86312
86333
  S: this,
86313
86334
  C: (K, Y) => K(...Y)
86314
86335
  }), await this.closeConnection(G);
@@ -86326,16 +86347,16 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86326
86347
  */
86327
86348
  async initiateConnection() {
86328
86349
  invariant(!this.initiating, "Initiation in progress.", {
86329
- F: __dxlog_file3$1,
86330
- L: 171,
86350
+ F: __dxlog_file3,
86351
+ L: 170,
86331
86352
  S: this,
86332
86353
  A: [
86333
86354
  "!this.initiating",
86334
86355
  "'Initiation in progress.'"
86335
86356
  ]
86336
86357
  }), invariant(!this.connection, "Already connected.", {
86337
- F: __dxlog_file3$1,
86338
- L: 172,
86358
+ F: __dxlog_file3,
86359
+ L: 171,
86339
86360
  S: this,
86340
86361
  A: [
86341
86362
  "!this.connection",
@@ -86349,8 +86370,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86349
86370
  peerId: this.id,
86350
86371
  sessionId: $
86351
86372
  }, {
86352
- F: __dxlog_file3$1,
86353
- L: 174,
86373
+ F: __dxlog_file3,
86374
+ L: 173,
86354
86375
  S: this,
86355
86376
  C: (q, G) => q(...G)
86356
86377
  });
@@ -86372,14 +86393,14 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86372
86393
  ownId: this.localPeerId,
86373
86394
  remoteId: this.id
86374
86395
  }, {
86375
- F: __dxlog_file3$1,
86376
- L: 191,
86396
+ F: __dxlog_file3,
86397
+ L: 190,
86377
86398
  S: this,
86378
86399
  C: (q, G) => q(...G)
86379
86400
  }), I.state !== ConnectionState.INITIAL) {
86380
86401
  log$2("ignoring response", void 0, {
86381
- F: __dxlog_file3$1,
86382
- L: 193,
86402
+ F: __dxlog_file3,
86403
+ L: 192,
86383
86404
  S: this,
86384
86405
  C: (q, G) => q(...G)
86385
86406
  });
@@ -86392,8 +86413,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86392
86413
  peerId: this.localPeerId,
86393
86414
  remoteId: this.id
86394
86415
  }, {
86395
- F: __dxlog_file3$1,
86396
- L: 197,
86416
+ F: __dxlog_file3,
86417
+ L: 196,
86397
86418
  S: this,
86398
86419
  C: (G, K) => G(...K)
86399
86420
  }), await I.abort(q), q;
@@ -86412,8 +86433,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86412
86433
  peerId: this.localPeerId,
86413
86434
  remoteId: this.id
86414
86435
  }, {
86415
- F: __dxlog_file3$1,
86416
- L: 210,
86436
+ F: __dxlog_file3,
86437
+ L: 209,
86417
86438
  S: this,
86418
86439
  C: (G, K) => G(...K)
86419
86440
  }), await I.abort(q), q;
@@ -86422,8 +86443,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86422
86443
  }
86423
86444
  try {
86424
86445
  log$2("opening connection as initiator", void 0, {
86425
- F: __dxlog_file3$1,
86426
- L: 223,
86446
+ F: __dxlog_file3,
86447
+ L: 222,
86427
86448
  S: this,
86428
86449
  C: (q, G) => q(...G)
86429
86450
  }), await I.openConnection(), this._callbacks.onAccepted();
@@ -86434,15 +86455,15 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86434
86455
  peerId: this.localPeerId,
86435
86456
  remoteId: this.id
86436
86457
  }, {
86437
- F: __dxlog_file3$1,
86438
- L: 227,
86458
+ F: __dxlog_file3,
86459
+ L: 226,
86439
86460
  S: this,
86440
86461
  C: (G, K) => G(...K)
86441
86462
  }), log$2.warn("closing connection due to unhandled error on openConnection", {
86442
86463
  err: q
86443
86464
  }, {
86444
- F: __dxlog_file3$1,
86445
- L: 234,
86465
+ F: __dxlog_file3,
86466
+ L: 233,
86446
86467
  S: this,
86447
86468
  C: (G, K) => G(...K)
86448
86469
  }), await this.closeConnection(q), q;
@@ -86463,13 +86484,13 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86463
86484
  initiator: $,
86464
86485
  sessionId: I
86465
86486
  }, {
86466
- F: __dxlog_file3$1,
86467
- L: 248,
86487
+ F: __dxlog_file3,
86488
+ L: 247,
86468
86489
  S: this,
86469
86490
  C: (G, K) => G(...K)
86470
86491
  }), invariant(!this.connection, "Already connected.", {
86471
- F: __dxlog_file3$1,
86472
- L: 255,
86492
+ F: __dxlog_file3,
86493
+ L: 254,
86473
86494
  S: this,
86474
86495
  A: [
86475
86496
  "!this.connection",
@@ -86500,8 +86521,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86500
86521
  sessionId: I,
86501
86522
  initiator: $
86502
86523
  }, {
86503
- F: __dxlog_file3$1,
86504
- L: 274,
86524
+ F: __dxlog_file3,
86525
+ L: 273,
86505
86526
  S: this,
86506
86527
  C: (G, K) => G(...K)
86507
86528
  });
@@ -86513,13 +86534,13 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86513
86534
  remoteId: this.id,
86514
86535
  initiator: $
86515
86536
  }, {
86516
- F: __dxlog_file3$1,
86517
- L: 283,
86537
+ F: __dxlog_file3,
86538
+ L: 282,
86518
86539
  S: this,
86519
86540
  C: (K, Y) => K(...Y)
86520
86541
  }), this._connectionLimiter.doneConnecting(I), invariant(this.connection === U, "Connection mismatch (race condition).", {
86521
- F: __dxlog_file3$1,
86522
- L: 288,
86542
+ F: __dxlog_file3,
86543
+ L: 287,
86523
86544
  S: this,
86524
86545
  A: [
86525
86546
  "this.connection === connection",
@@ -86532,8 +86553,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86532
86553
  sessionId: I,
86533
86554
  initiator: $
86534
86555
  }, {
86535
- F: __dxlog_file3$1,
86536
- L: 290,
86556
+ F: __dxlog_file3,
86557
+ L: 289,
86537
86558
  S: this,
86538
86559
  C: (K, Y) => K(...Y)
86539
86560
  }), G instanceof ConnectionDisplacedError ? this.connectionDisplaced.emit(this.connection) : (this._lastConnectionTime && this._lastConnectionTime + CONNECTION_COUNTS_STABLE_AFTER < Date.now() ? this._availableAfter = 0 : (this.availableToConnect = !1, this._availableAfter = increaseInterval(this._availableAfter)), this._callbacks.onDisconnected(), scheduleTask(this._connectionCtx, () => {
@@ -86550,8 +86571,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86550
86571
  initiator: $,
86551
86572
  err: G
86552
86573
  }, {
86553
- F: __dxlog_file3$1,
86554
- L: 330,
86574
+ F: __dxlog_file3,
86575
+ L: 329,
86555
86576
  S: this,
86556
86577
  C: (K, Y) => K(...Y)
86557
86578
  }), log$2.trace("dxos.mesh.connection.error", {
@@ -86562,8 +86583,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86562
86583
  initiator: $,
86563
86584
  err: G
86564
86585
  }, {
86565
- F: __dxlog_file3$1,
86566
- L: 337,
86586
+ F: __dxlog_file3,
86587
+ L: 336,
86567
86588
  S: this,
86568
86589
  C: (K, Y) => K(...Y)
86569
86590
  }), this.closeConnection(G);
@@ -86577,16 +86598,16 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86577
86598
  peerId: this.id,
86578
86599
  sessionId: I.sessionId
86579
86600
  }, {
86580
- F: __dxlog_file3$1,
86581
- L: 362,
86601
+ F: __dxlog_file3,
86602
+ L: 361,
86582
86603
  S: this,
86583
86604
  C: (U, q) => U(...q)
86584
86605
  }), await I.close($), log$2("closed", {
86585
86606
  peerId: this.id,
86586
86607
  sessionId: I.sessionId
86587
86608
  }, {
86588
- F: __dxlog_file3$1,
86589
- L: 368,
86609
+ F: __dxlog_file3,
86610
+ L: 367,
86590
86611
  S: this,
86591
86612
  C: (U, q) => U(...q)
86592
86613
  });
@@ -86596,8 +86617,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86596
86617
  log$2("dropping signal message for non-existent connection", {
86597
86618
  message: $
86598
86619
  }, {
86599
- F: __dxlog_file3$1,
86600
- L: 373,
86620
+ F: __dxlog_file3,
86621
+ L: 372,
86601
86622
  S: this,
86602
86623
  C: (I, U) => I(...U)
86603
86624
  });
@@ -86611,8 +86632,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86611
86632
  peerId: this.id,
86612
86633
  topic: this.topic
86613
86634
  }, {
86614
- F: __dxlog_file3$1,
86615
- L: 383,
86635
+ F: __dxlog_file3,
86636
+ L: 382,
86616
86637
  S: this,
86617
86638
  C: (U, q) => U(...q)
86618
86639
  }), await ((I = this == null ? void 0 : this.connection) == null ? void 0 : I.close($));
@@ -87040,88 +87061,88 @@ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-man
87040
87061
  }
87041
87062
  }), Qn, MemoryTransport = (Qn = class {
87042
87063
  constructor(I) {
87043
- this.options = I, this.closed = new Event$1(), this.connected = new Event$1(), this.errors = new ErrorStream(), this._instanceId = PublicKey.random(), this._remote = new Trigger(), this._outgoingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY), this._incomingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY), this._destroyed = !1, log$2("creating", void 0, {
87064
+ this._options = I, this._instanceId = PublicKey.random(), this._remote = new Trigger(), this._outgoingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY), this._incomingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY), this._closed = !1, this.closed = new Event$1(), this.connected = new Event$1(), this.errors = new ErrorStream(), invariant(!Qn._connections.has(this._instanceId), "Duplicate memory connection", {
87044
87065
  F: __dxlog_file11,
87045
87066
  L: 64,
87046
87067
  S: this,
87047
- C: (U, q) => U(...q)
87048
- }), invariant(!Qn._connections.has(this._instanceId), "Duplicate memory connection", {
87049
- F: __dxlog_file11,
87050
- L: 66,
87051
- S: this,
87052
87068
  A: [
87053
87069
  "!MemoryTransport._connections.has(this._instanceId)",
87054
87070
  "'Duplicate memory connection'"
87055
87071
  ]
87056
- }), Qn._connections.set(this._instanceId, this), this.options.initiator ? setTimeout(async () => {
87072
+ }), Qn._connections.set(this._instanceId, this);
87073
+ }
87074
+ get isOpen() {
87075
+ return !this._closed;
87076
+ }
87077
+ async open() {
87078
+ if (log$2("opening...", void 0, {
87079
+ F: __dxlog_file11,
87080
+ L: 74,
87081
+ S: this,
87082
+ C: (I, U) => I(...U)
87083
+ }), this._options.initiator) {
87057
87084
  log$2("sending signal", void 0, {
87058
87085
  F: __dxlog_file11,
87059
- L: 73,
87086
+ L: 78,
87060
87087
  S: this,
87061
- C: (U, q) => U(...q)
87062
- }), this.options.sendSignal({
87063
- payload: {
87064
- transportId: this._instanceId.toHex()
87065
- }
87066
- }).catch((U) => {
87067
- this._destroyed || this.errors.raise(U);
87088
+ C: (I, U) => I(...U)
87068
87089
  });
87069
- }) : this._remote.wait({
87070
- timeout: this.options.timeout ?? 1e3
87071
- }).then((U) => {
87072
- if (!this._destroyed) {
87073
- if (this._remoteInstanceId = U, this._remoteConnection = Qn._connections.get(this._remoteInstanceId), !this._remoteConnection) {
87074
- this._destroyed = !0, this.closed.emit();
87075
- return;
87076
- }
87077
- invariant(!this._remoteConnection._remoteConnection, `Remote already connected: ${this._remoteInstanceId}`, {
87078
- F: __dxlog_file11,
87079
- L: 99,
87080
- S: this,
87081
- A: [
87082
- "!this._remoteConnection._remoteConnection",
87083
- "`Remote already connected: ${this._remoteInstanceId}`"
87084
- ]
87085
- }), this._remoteConnection._remoteConnection = this, this._remoteConnection._remoteInstanceId = this._instanceId, log$2("connected", void 0, {
87086
- F: __dxlog_file11,
87087
- L: 103,
87088
- S: this,
87089
- C: (q, G) => q(...G)
87090
- }), this.options.stream.pipe(this._outgoingDelay).pipe(this._remoteConnection.options.stream).pipe(this._incomingDelay).pipe(this.options.stream), this.connected.emit(), this._remoteConnection.connected.emit();
87090
+ try {
87091
+ await this._options.sendSignal({
87092
+ payload: {
87093
+ transportId: this._instanceId.toHex()
87094
+ }
87095
+ });
87096
+ } catch (I) {
87097
+ this._closed || this.errors.raise(toError(I));
87091
87098
  }
87092
- }).catch((U) => {
87093
- this._destroyed || this.errors.raise(U);
87094
- });
87099
+ } else
87100
+ this._remote.wait({
87101
+ timeout: this._options.timeout ?? 1e3
87102
+ }).then((I) => {
87103
+ if (!this._closed) {
87104
+ if (this._remoteInstanceId = I, this._remoteConnection = Qn._connections.get(this._remoteInstanceId), !this._remoteConnection) {
87105
+ this._closed = !0, this.closed.emit();
87106
+ return;
87107
+ }
87108
+ invariant(!this._remoteConnection._remoteConnection, `Remote already connected: ${this._remoteInstanceId}`, {
87109
+ F: __dxlog_file11,
87110
+ L: 104,
87111
+ S: this,
87112
+ A: [
87113
+ "!this._remoteConnection._remoteConnection",
87114
+ "`Remote already connected: ${this._remoteInstanceId}`"
87115
+ ]
87116
+ }), this._remoteConnection._remoteConnection = this, this._remoteConnection._remoteInstanceId = this._instanceId, log$2("connected", void 0, {
87117
+ F: __dxlog_file11,
87118
+ L: 108,
87119
+ S: this,
87120
+ C: (U, q) => U(...q)
87121
+ }), this._options.stream.pipe(this._outgoingDelay).pipe(this._remoteConnection._options.stream).pipe(this._incomingDelay).pipe(this._options.stream), this.connected.emit(), this._remoteConnection.connected.emit();
87122
+ }
87123
+ }).catch((I) => {
87124
+ this._closed || this.errors.raise(I);
87125
+ });
87095
87126
  }
87096
- async destroy() {
87097
- log$2("closing", void 0, {
87098
- F: __dxlog_file11,
87099
- L: 124,
87100
- S: this,
87101
- C: (I, U) => I(...U)
87102
- }), this._destroyed = !0, Qn._connections.delete(this._instanceId), this._remoteConnection && (log$2("closing", void 0, {
87127
+ async close() {
87128
+ log$2("closing...", void 0, {
87103
87129
  F: __dxlog_file11,
87104
87130
  L: 129,
87105
87131
  S: this,
87106
87132
  C: (I, U) => I(...U)
87107
- }), this._remoteConnection._destroyed = !0, Qn._connections.delete(this._remoteInstanceId), this.options.stream.unpipe(this._incomingDelay), this._incomingDelay.unpipe(this._remoteConnection.options.stream), this._remoteConnection.options.stream.unpipe(this._outgoingDelay), this._outgoingDelay.unpipe(this.options.stream), this.options.stream.unpipe(this._outgoingDelay), this._remoteConnection.closed.emit(), this._remoteConnection._remoteConnection = void 0, this._remoteConnection = void 0, log$2("closed", void 0, {
87108
- F: __dxlog_file11,
87109
- L: 150,
87110
- S: this,
87111
- C: (I, U) => I(...U)
87112
- })), this.closed.emit(), log$2("closed", void 0, {
87133
+ }), this._closed = !0, Qn._connections.delete(this._instanceId), this._remoteConnection && (this._remoteConnection._closed = !0, Qn._connections.delete(this._remoteInstanceId), this._options.stream.unpipe(this._incomingDelay), this._incomingDelay.unpipe(this._remoteConnection._options.stream), this._remoteConnection._options.stream.unpipe(this._outgoingDelay), this._outgoingDelay.unpipe(this._options.stream), this._options.stream.unpipe(this._outgoingDelay), this._remoteConnection.closed.emit(), this._remoteConnection._remoteConnection = void 0, this._remoteConnection = void 0), this.closed.emit(), log$2("closed", void 0, {
87113
87134
  F: __dxlog_file11,
87114
- L: 154,
87135
+ L: 157,
87115
87136
  S: this,
87116
87137
  C: (I, U) => I(...U)
87117
87138
  });
87118
87139
  }
87119
- signal({ payload: I }) {
87140
+ async onSignal({ payload: I }) {
87120
87141
  if (log$2("received signal", {
87121
87142
  payload: I
87122
87143
  }, {
87123
87144
  F: __dxlog_file11,
87124
- L: 158,
87145
+ L: 161,
87125
87146
  S: this,
87126
87147
  C: (q, G) => q(...G)
87127
87148
  }), !(I != null && I.transportId))
@@ -87150,9 +87171,9 @@ _ts_decorate4$1([
87150
87171
  _ts_decorate4$1([
87151
87172
  logInfo
87152
87173
  ], MemoryTransport.prototype, "_remoteInstanceId", void 0);
87153
- var TransportKind;
87174
+ var toError = ($) => $ instanceof Error ? $ : new Error(String($)), TransportKind;
87154
87175
  (function($) {
87155
- $.SIMPLE_PEER = "SIMPLE_PEER", $.LIBDATACHANNEL = "LIBDATACHANNEL", $.SIMPLE_PEER_PROXY = "SIMPLE_PEER_PROXY", $.MEMORY = "MEMORY", $.TCP = "TCP";
87176
+ $.SIMPLE_PEER = "SIMPLE_PEER", $.SIMPLE_PEER_PROXY = "SIMPLE_PEER_PROXY", $.LIBDATACHANNEL = "LIBDATACHANNEL", $.MEMORY = "MEMORY", $.TCP = "TCP";
87156
87177
  })(TransportKind || (TransportKind = {}));
87157
87178
  var wrtc = null;
87158
87179
  try {
@@ -87170,115 +87191,146 @@ function _ts_decorate5$1($, I, U, q) {
87170
87191
  }
87171
87192
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/libdatachannel-transport.ts", DATACHANNEL_LABEL = "dxos.mesh.transport", MAX_BUFFERED_AMOUNT = 64 * 1024, MAX_MESSAGE_SIZE = 64 * 1024, or, LibDataChannelTransport = (or = class {
87172
87193
  constructor(I) {
87173
- this.params = I, this._closed = !1, this.closed = new Event$1(), this._connected = !1, this.connected = new Event$1(), this.errors = new ErrorStream(), this._readyForCandidates = new Trigger(), this._writeCallback = null, this._peer = (async () => {
87174
- const { RTCPeerConnection: U } = (await importESM("node-datachannel/polyfill")).default;
87175
- this._closed && this.errors.raise(new Error("connection already closed")), I.webrtcConfig ? I.webrtcConfig.iceServers = I.webrtcConfig.iceServers ?? [] : I.webrtcConfig = {
87176
- iceServers: []
87177
- };
87178
- const q = new U(I.webrtcConfig);
87179
- return or._instanceCount++, q.onicecandidateerror = (G) => {
87180
- log$2.error("peer.onicecandidateerror", {
87181
- event: G
87182
- }, {
87183
- F: __dxlog_file15,
87184
- L: 63,
87185
- S: this,
87186
- C: (K, Y) => K(...Y)
87187
- });
87188
- }, q.onconnectionstatechange = (G) => {
87189
- log$2.debug("peer.onconnectionstatechange", {
87190
- event: G,
87191
- peerConnectionState: q.connectionState,
87192
- transportConnectionState: this._connected
87193
- }, {
87194
- F: __dxlog_file15,
87195
- L: 67,
87196
- S: this,
87197
- C: (K, Y) => K(...Y)
87198
- });
87199
- }, q.onicecandidate = async (G) => {
87200
- if (log$2.debug("peer.onicecandidate", {
87201
- event: G
87202
- }, {
87203
- F: __dxlog_file15,
87204
- L: 76,
87205
- S: this,
87206
- C: (K, Y) => K(...Y)
87207
- }), G.candidate)
87208
- try {
87209
- await I.sendSignal({
87210
- payload: {
87211
- data: {
87212
- type: "candidate",
87213
- candidate: {
87214
- candidate: G.candidate.candidate,
87215
- // these fields never seem to be not null, but connecting to Chrome doesn't work if they are
87216
- sdpMLineIndex: G.candidate.sdpMLineIndex ?? 0,
87217
- sdpMid: G.candidate.sdpMid ?? 0
87218
- }
87194
+ this._options = I, this._closed = !1, this._connected = !1, this._writeCallback = null, this._readyForCandidates = new Trigger(), this.closed = new Event$1(), this.connected = new Event$1(), this.errors = new ErrorStream();
87195
+ }
87196
+ get isOpen() {
87197
+ return !!this._peer && !this._closed;
87198
+ }
87199
+ async open() {
87200
+ this._closed && this.errors.raise(new Error("connection already closed"));
87201
+ const { RTCPeerConnection: I } = (await importESM("node-datachannel/polyfill")).default;
87202
+ this._options.webrtcConfig ? this._options.webrtcConfig.iceServers = this._options.webrtcConfig.iceServers ?? [] : this._options.webrtcConfig = {
87203
+ iceServers: []
87204
+ }, this._peer = new I(this._options.webrtcConfig), this._peer.onicecandidateerror = (U) => {
87205
+ log$2.error("peer.onicecandidateerror", {
87206
+ event: U
87207
+ }, {
87208
+ F: __dxlog_file15,
87209
+ L: 77,
87210
+ S: this,
87211
+ C: (q, G) => q(...G)
87212
+ });
87213
+ }, this._peer.onconnectionstatechange = (U) => {
87214
+ var q;
87215
+ log$2.debug("peer.onconnectionstatechange", {
87216
+ event: U,
87217
+ peerConnectionState: (q = this._peer) == null ? void 0 : q.connectionState,
87218
+ transportConnectionState: this._connected
87219
+ }, {
87220
+ F: __dxlog_file15,
87221
+ L: 81,
87222
+ S: this,
87223
+ C: (G, K) => G(...K)
87224
+ });
87225
+ }, this._peer.onicecandidate = async (U) => {
87226
+ if (log$2.debug("peer.onicecandidate", {
87227
+ event: U
87228
+ }, {
87229
+ F: __dxlog_file15,
87230
+ L: 91,
87231
+ S: this,
87232
+ C: (q, G) => q(...G)
87233
+ }), U.candidate)
87234
+ try {
87235
+ await this._options.sendSignal({
87236
+ payload: {
87237
+ data: {
87238
+ type: "candidate",
87239
+ candidate: {
87240
+ candidate: U.candidate.candidate,
87241
+ // These fields never seem to be not null, but connecting to Chrome doesn't work if they are.
87242
+ sdpMLineIndex: U.candidate.sdpMLineIndex ?? 0,
87243
+ sdpMid: U.candidate.sdpMid ?? 0
87219
87244
  }
87220
87245
  }
87221
- });
87222
- } catch (K) {
87223
- log$2.info("signaling errror", {
87224
- err: K
87225
- }, {
87226
- F: __dxlog_file15,
87227
- L: 93,
87228
- S: this,
87229
- C: (Y, J) => Y(...J)
87230
- });
87231
- }
87232
- }, I.initiator ? (q.createOffer().then(async (G) => {
87233
- if (!this._closed)
87234
- return q.connectionState !== "connecting" && (log$2.error("i am initiator but peer not in state connecting", {
87235
- peer: q
87236
- }, {
87237
- F: __dxlog_file15,
87238
- L: 106,
87239
- S: this,
87240
- C: (K, Y) => K(...Y)
87241
- }), this.errors.raise(new Error("invalid state: peer is initiator, but other peer not in state connecting"))), log$2.debug(`im the initiator, creating offer, peer is in state ${q.connectionState}`, {
87242
- offer: G
87246
+ }
87247
+ });
87248
+ } catch (q) {
87249
+ log$2.info("signaling error", {
87250
+ err: q
87243
87251
  }, {
87244
87252
  F: __dxlog_file15,
87245
- L: 109,
87253
+ L: 108,
87246
87254
  S: this,
87247
- C: (K, Y) => K(...Y)
87248
- }), await q.setLocalDescription(G), await I.sendSignal({
87249
- payload: {
87250
- data: {
87251
- type: G.type,
87252
- sdp: G.sdp
87253
- }
87254
- }
87255
- }), G;
87256
- }).catch((G) => {
87257
- this.errors.raise(G);
87258
- }), this.handleChannel(q.createDataChannel(DATACHANNEL_LABEL)), log$2.debug("created data channel", void 0, {
87255
+ C: (G, K) => G(...K)
87256
+ });
87257
+ }
87258
+ }, this._options.initiator ? (invariant(this._peer, "not open", {
87259
+ F: __dxlog_file15,
87260
+ L: 114,
87261
+ S: this,
87262
+ A: [
87263
+ "this._peer",
87264
+ "'not open'"
87265
+ ]
87266
+ }), this._peer.createOffer().then(async (U) => {
87267
+ var q;
87268
+ this._closed || (((q = this._peer) == null ? void 0 : q.connectionState) !== "connecting" && (log$2.error("peer not connecting", {
87269
+ peer: this._peer
87270
+ }, {
87259
87271
  F: __dxlog_file15,
87260
- L: 118,
87272
+ L: 125,
87261
87273
  S: this,
87262
87274
  C: (G, K) => G(...K)
87263
- }), q.ondatachannel = (G) => {
87264
- this.errors.raise(new Error("got ondatachannel when i am the initiator?"));
87265
- }) : q.ondatachannel = (G) => {
87266
- log$2.debug("peer.ondatachannel (non-initiator)", {
87267
- event: G
87268
- }, {
87269
- F: __dxlog_file15,
87270
- L: 124,
87271
- S: this,
87272
- C: (K, Y) => K(...Y)
87273
- }), G.channel.label !== DATACHANNEL_LABEL && this.errors.raise(new Error(`unexpected channel label ${G.channel.label}`)), this.handleChannel(G.channel);
87274
- }, q;
87275
- })();
87275
+ }), this.errors.raise(new Error("invalid state: peer is initiator, but other peer not in state connecting"))), log$2.debug("creating offer", {
87276
+ peer: this._peer,
87277
+ offer: U
87278
+ }, {
87279
+ F: __dxlog_file15,
87280
+ L: 129,
87281
+ S: this,
87282
+ C: (G, K) => G(...K)
87283
+ }), await this._peer.setLocalDescription(U), await this._options.sendSignal({
87284
+ payload: {
87285
+ data: {
87286
+ type: U.type,
87287
+ sdp: U.sdp
87288
+ }
87289
+ }
87290
+ }));
87291
+ }).catch((U) => {
87292
+ this.errors.raise(U);
87293
+ }), this._handleChannel(this._peer.createDataChannel(DATACHANNEL_LABEL)), log$2.debug("created data channel", void 0, {
87294
+ F: __dxlog_file15,
87295
+ L: 139,
87296
+ S: this,
87297
+ C: (U, q) => U(...q)
87298
+ }), this._peer.ondatachannel = () => {
87299
+ this.errors.raise(new Error("unexpected ondatachannel event for initiator"));
87300
+ }) : this._peer.ondatachannel = (U) => {
87301
+ log$2.debug("peer.ondatachannel (non-initiator)", {
87302
+ event: U
87303
+ }, {
87304
+ F: __dxlog_file15,
87305
+ L: 145,
87306
+ S: this,
87307
+ C: (q, G) => q(...G)
87308
+ }), U.channel.label !== DATACHANNEL_LABEL && this.errors.raise(new Error(`unexpected channel label ${U.channel.label}`)), this._handleChannel(U.channel);
87309
+ }, or._instanceCount++;
87310
+ }
87311
+ async close() {
87312
+ await this._close(), --or._instanceCount === 0 && (await importESM("node-datachannel")).cleanup();
87276
87313
  }
87277
- handleChannel(I) {
87314
+ async _close() {
87315
+ var I;
87316
+ if (!this._closed) {
87317
+ await this._disconnectStreams();
87318
+ try {
87319
+ (I = this._peer) == null || I.close();
87320
+ } catch (U) {
87321
+ this.errors.raise(U);
87322
+ }
87323
+ this._peer = void 0, this._closed = !0, this.closed.emit();
87324
+ }
87325
+ }
87326
+ /**
87327
+ * Handle data channel events.
87328
+ */
87329
+ _handleChannel(I) {
87278
87330
  this._channel = I, this._channel.onopen = () => {
87279
- log$2.debug("dataChannel.onopen", void 0, {
87331
+ log$2.debug("channel.onopen", void 0, {
87280
87332
  F: __dxlog_file15,
87281
- L: 140,
87333
+ L: 190,
87282
87334
  S: this,
87283
87335
  C: (q, G) => q(...G)
87284
87336
  });
@@ -87292,146 +87344,131 @@ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-man
87292
87344
  } catch (Y) {
87293
87345
  this.errors.raise(Y), await this._close();
87294
87346
  }
87295
- this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT ? (this._writeCallback !== null && log$2.error("consumer trying to write before we're ready for more data", void 0, {
87347
+ this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT ? (this._writeCallback !== null && log$2.error("consumer trying to write before we are ready for more data", void 0, {
87296
87348
  F: __dxlog_file15,
87297
- L: 157,
87349
+ L: 207,
87298
87350
  S: this,
87299
87351
  C: (Y, J) => Y(...J)
87300
87352
  }), this._writeCallback = K) : K();
87301
87353
  }
87302
87354
  });
87303
- U.pipe(this.params.stream).pipe(U), this._stream = U, this._connected = !0, this.connected.emit();
87304
- }, this._channel.onerror = async (U) => {
87305
- this.errors.raise(new Error("channel error: " + U.toString())), await this._close();
87355
+ U.pipe(this._options.stream).pipe(U), this._stream = U, this._connected = !0, this.connected.emit();
87306
87356
  }, this._channel.onclose = async (U) => {
87307
- log$2.info("channel onclose", {
87357
+ log$2.info("channel.onclose", {
87308
87358
  err: U
87309
87359
  }, {
87310
87360
  F: __dxlog_file15,
87311
- L: 177,
87361
+ L: 223,
87312
87362
  S: this,
87313
87363
  C: (q, G) => q(...G)
87314
87364
  }), await this._close();
87315
- }, this._channel.onmessage = (U) => {
87316
- let q = U.data;
87317
- q instanceof ArrayBuffer && (q = export_Buffer.from(q)), this._stream.push(q);
87365
+ }, this._channel.onerror = async (U) => {
87366
+ this.errors.raise(new Error("channel error: " + U.toString())), await this._close();
87318
87367
  }, this._channel.onbufferedamountlow = () => {
87319
87368
  const U = this._writeCallback;
87320
87369
  this._writeCallback = null, U == null || U();
87370
+ }, this._channel.onmessage = (U) => {
87371
+ let q = U.data;
87372
+ q instanceof ArrayBuffer && (q = export_Buffer.from(q)), this._stream.push(q);
87321
87373
  };
87322
87374
  }
87323
- async _close() {
87324
- if (this._closed)
87325
- return;
87326
- await this._disconnectStreams();
87327
- const I = await this._peer;
87375
+ async onSignal(I) {
87376
+ invariant(this._peer, "not open", {
87377
+ F: __dxlog_file15,
87378
+ L: 249,
87379
+ S: this,
87380
+ A: [
87381
+ "this._peer",
87382
+ "'not open'"
87383
+ ]
87384
+ });
87328
87385
  try {
87329
- I.close();
87330
- } catch (U) {
87331
- this.errors.raise(U);
87332
- }
87333
- this._closed = !0, this.closed.emit();
87334
- }
87335
- signal(I) {
87336
- this._peer.then(async (U) => {
87337
- const q = I.payload.data;
87338
- switch (q.type) {
87386
+ const U = I.payload.data;
87387
+ switch (U.type) {
87339
87388
  case "offer": {
87340
- if ((await this._peer).connectionState !== "new") {
87389
+ if (this._peer.connectionState !== "new") {
87341
87390
  log$2.error("received offer but peer not in state new", {
87342
- peer: U
87391
+ peer: this._peer
87343
87392
  }, {
87344
87393
  F: __dxlog_file15,
87345
- L: 218,
87394
+ L: 256,
87346
87395
  S: this,
87347
- C: (G, K) => G(...K)
87396
+ C: (q, G) => q(...G)
87348
87397
  }), this.errors.raise(new Error("invalid signalling state: received offer when peer is not in state new"));
87349
87398
  break;
87350
87399
  }
87351
87400
  try {
87352
- await U.setRemoteDescription({
87353
- type: q.type,
87354
- sdp: q.sdp
87401
+ await this._peer.setRemoteDescription({
87402
+ type: U.type,
87403
+ sdp: U.sdp
87355
87404
  });
87356
- const G = await U.createAnswer();
87357
- await U.setLocalDescription(G), await this.params.sendSignal({
87405
+ const q = await this._peer.createAnswer();
87406
+ await this._peer.setLocalDescription(q), await this._options.sendSignal({
87358
87407
  payload: {
87359
87408
  data: {
87360
- type: G.type,
87361
- sdp: G.sdp
87409
+ type: q.type,
87410
+ sdp: q.sdp
87362
87411
  }
87363
87412
  }
87364
87413
  }), this._readyForCandidates.wake();
87365
- } catch (G) {
87366
- log$2.error("can't handle offer from signalling server", {
87367
- err: G
87414
+ } catch (q) {
87415
+ log$2.error("cannot handle offer from signalling server", {
87416
+ err: q
87368
87417
  }, {
87369
87418
  F: __dxlog_file15,
87370
- L: 229,
87419
+ L: 268,
87371
87420
  S: this,
87372
- C: (K, Y) => K(...Y)
87421
+ C: (G, K) => G(...K)
87373
87422
  }), this.errors.raise(new Error("error handling offer"));
87374
87423
  }
87375
87424
  break;
87376
87425
  }
87377
87426
  case "answer":
87378
87427
  try {
87379
- await U.setRemoteDescription({
87380
- type: q.type,
87381
- sdp: q.sdp
87428
+ await this._peer.setRemoteDescription({
87429
+ type: U.type,
87430
+ sdp: U.sdp
87382
87431
  }), this._readyForCandidates.wake();
87383
- } catch (G) {
87384
- log$2.error("can't handle answer from signalling server", {
87385
- err: G
87432
+ } catch (q) {
87433
+ log$2.error("cannot handle answer from signalling server", {
87434
+ err: q
87386
87435
  }, {
87387
87436
  F: __dxlog_file15,
87388
- L: 240,
87437
+ L: 279,
87389
87438
  S: this,
87390
- C: (K, Y) => K(...Y)
87439
+ C: (G, K) => G(...K)
87391
87440
  }), this.errors.raise(new Error("error handling answer"));
87392
87441
  }
87393
87442
  break;
87394
87443
  case "candidate":
87395
- await this._readyForCandidates.wait(), await U.addIceCandidate({
87396
- candidate: q.candidate.candidate
87444
+ await this._readyForCandidates.wait(), await this._peer.addIceCandidate({
87445
+ candidate: U.candidate.candidate
87397
87446
  });
87398
87447
  break;
87399
87448
  default:
87400
87449
  log$2.error("unhandled signal type", {
87401
- type: q.type,
87450
+ type: U.type,
87402
87451
  signal: I
87403
87452
  }, {
87404
87453
  F: __dxlog_file15,
87405
- L: 251,
87454
+ L: 290,
87406
87455
  S: this,
87407
- C: (G, K) => G(...K)
87408
- }), this.errors.raise(new Error(`unhandled signal type ${q.type}`));
87456
+ C: (q, G) => q(...G)
87457
+ }), this.errors.raise(new Error(`unhandled signal type ${U.type}`));
87409
87458
  }
87410
- }).catch((U) => {
87459
+ } catch (U) {
87411
87460
  log$2.catch(U, void 0, {
87412
87461
  F: __dxlog_file15,
87413
- L: 256,
87462
+ L: 294,
87414
87463
  S: this,
87415
87464
  C: (q, G) => q(...G)
87416
87465
  });
87417
- });
87466
+ }
87418
87467
  }
87419
87468
  async getDetails() {
87420
87469
  const I = await this._getStats(), U = I == null ? void 0 : I.remoteCandidate;
87421
87470
  return U ? U.candidateType === "relay" ? `${U.ip}:${U.port} relay for ${U.relatedAddress}:${U.relatedPort}` : `${U.ip}:${U.port} ${U.candidateType}` : "unavailable";
87422
87471
  }
87423
- async _getStats() {
87424
- return this._peer.then(async (I) => {
87425
- const U = await I.getStats(), q = Array.from(U.entries()), G = q.filter((Z) => Z[1].type === "transport")[0][1], K = q.filter((Z) => Z[0] === G.selectedCandidatePairId);
87426
- let Y, J;
87427
- return K.length > 0 && (Y = K[0][1], J = q.filter((Z) => Z[0] === Y.remoteCandidateId)[0][1]), {
87428
- transport: G,
87429
- selectedCandidatePair: Y,
87430
- remoteCandidate: J,
87431
- raw: Object.fromEntries(U)
87432
- };
87433
- });
87434
- }
87435
87472
  async getStats() {
87436
87473
  const I = await this._getStats();
87437
87474
  return I ? {
@@ -87448,12 +87485,28 @@ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-man
87448
87485
  rawStats: {}
87449
87486
  };
87450
87487
  }
87451
- async destroy() {
87452
- await this._close(), --or._instanceCount === 0 && (await importESM("node-datachannel")).cleanup();
87488
+ async _getStats() {
87489
+ invariant(this._peer, "not open", {
87490
+ F: __dxlog_file15,
87491
+ L: 334,
87492
+ S: this,
87493
+ A: [
87494
+ "this._peer",
87495
+ "'not open'"
87496
+ ]
87497
+ });
87498
+ const I = await this._peer.getStats(), U = Array.from(I.entries()), q = U.filter((J) => J[1].type === "transport")[0][1], G = U.filter((J) => J[0] === q.selectedCandidatePairId);
87499
+ let K, Y;
87500
+ return G.length > 0 && (K = G[0][1], Y = U.filter((J) => J[0] === K.remoteCandidateId)[0][1]), {
87501
+ transport: q,
87502
+ selectedCandidatePair: K,
87503
+ remoteCandidate: Y,
87504
+ raw: Object.fromEntries(I)
87505
+ };
87453
87506
  }
87454
87507
  async _disconnectStreams() {
87455
87508
  var I, U, q, G;
87456
- (G = (q = (U = (I = this.params.stream).unpipe) == null ? void 0 : U.call(I, this._stream)) == null ? void 0 : q.unpipe) == null || G.call(q, this.params.stream);
87509
+ (G = (q = (U = (I = this._options.stream).unpipe) == null ? void 0 : U.call(I, this._stream)) == null ? void 0 : q.unpipe) == null || G.call(q, this._options.stream);
87457
87510
  }
87458
87511
  }, or._instanceCount = 0, or);
87459
87512
  _ts_decorate5$1([
@@ -88710,12 +88763,14 @@ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services
88710
88763
  return this._client.rpc;
88711
88764
  }
88712
88765
  async open() {
88713
- const { WebsocketRpcClient: $ } = await import("./index-Ba36DtoM.mjs");
88766
+ const { WebsocketRpcClient: $ } = await import("./index-Cms4wG79.mjs");
88714
88767
  this._client = new $({
88715
88768
  url: getUnixSocket(this._profile, "ws+unix"),
88716
88769
  requested: clientServiceBundle,
88717
88770
  exposed: {},
88718
88771
  handlers: {}
88772
+ }), this._client.error.on((I) => {
88773
+ this.closed.emit(I);
88719
88774
  }), await this._client.open();
88720
88775
  }
88721
88776
  async close() {
@@ -88725,7 +88780,7 @@ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services
88725
88780
  } catch (I) {
88726
88781
  log$2.warn("Failed to close", I, {
88727
88782
  F: __dxlog_file,
88728
- L: 69,
88783
+ L: 72,
88729
88784
  S: this,
88730
88785
  C: (U, q) => U(...q)
88731
88786
  });
@@ -88830,7 +88885,7 @@ var IFrameManager = class {
88830
88885
  var I;
88831
88886
  (I = this._onMessage) == null || I.call(this, $);
88832
88887
  }
88833
- }, __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/shell-manager.ts", shellStyles = Object.entries({
88888
+ }, __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/shell-manager.ts", shellStyles = Object.entries({
88834
88889
  display: "none",
88835
88890
  position: "fixed",
88836
88891
  top: 0,
@@ -88850,13 +88905,15 @@ var IFrameManager = class {
88850
88905
  async setLayout($) {
88851
88906
  var I;
88852
88907
  log$2("set layout", $, {
88853
- F: __dxlog_file3,
88854
- L: 50,
88908
+ F: __dxlog_file4,
88909
+ L: 51,
88855
88910
  S: this,
88856
88911
  C: (U, q) => U(...q)
88857
88912
  }), this._display = ShellDisplay.FULLSCREEN, this.contextUpdate.emit({
88858
88913
  display: this._display
88859
- }), await ((I = this._shellRpc) == null ? void 0 : I.rpc.ShellService.setLayout($));
88914
+ }), await ((I = this._shellRpc) == null ? void 0 : I.rpc.ShellService.setLayout($, {
88915
+ timeout: RPC_TIMEOUT
88916
+ }));
88860
88917
  }
88861
88918
  async open() {
88862
88919
  if (this._shellRpc)
@@ -88878,8 +88935,8 @@ var IFrameManager = class {
88878
88935
  AppService: {
88879
88936
  setContext: async (q) => {
88880
88937
  log$2("set context", q, {
88881
- F: __dxlog_file3,
88882
- L: 97,
88938
+ F: __dxlog_file4,
88939
+ L: 98,
88883
88940
  S: this,
88884
88941
  C: (G, K) => G(...K)
88885
88942
  }), q.display && (this._display = q.display), this.contextUpdate.emit(q);
@@ -88971,13 +89028,13 @@ function _ts_decorate4($, I, U, q) {
88971
89028
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
88972
89029
  return G > 3 && K && Object.defineProperty(I, U, K), K;
88973
89030
  }
88974
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/service-proxy.ts", ClientServicesProxy = class {
89031
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/service-proxy.ts", ClientServicesProxy = class {
88975
89032
  constructor($, I = 3e4) {
88976
89033
  this._port = $, this._timeout = I, this.closed = new Event$1();
88977
89034
  }
88978
89035
  get proxy() {
88979
89036
  return invariant(this._proxy, "Client services not open", {
88980
- F: __dxlog_file4,
89037
+ F: __dxlog_file5,
88981
89038
  L: 30,
88982
89039
  S: this,
88983
89040
  A: [
@@ -88991,7 +89048,7 @@ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
88991
89048
  }
88992
89049
  get services() {
88993
89050
  return invariant(this._proxy, "Client services not open", {
88994
- F: __dxlog_file4,
89051
+ F: __dxlog_file5,
88995
89052
  L: 39,
88996
89053
  S: this,
88997
89054
  A: [
@@ -89028,7 +89085,7 @@ function _ts_decorate5($, I, U, q) {
89028
89085
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
89029
89086
  return G > 3 && K && Object.defineProperty(I, U, K), K;
89030
89087
  }
89031
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/iframe-service-proxy.ts", IFrameClientServicesProxy = class {
89088
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/iframe-service-proxy.ts", IFrameClientServicesProxy = class {
89032
89089
  constructor({ source: $ = DEFAULT_VAULT_URL, shell: I = DEFAULT_SHELL_CHANNEL, vault: U = DEFAULT_INTERNAL_CHANNEL, timeout: q = PROXY_CONNECTION_TIMEOUT, logFilter: G = "error,warn" } = {}) {
89033
89090
  this.closed = new Event$1(), this._instanceId = PublicKey.random().toHex(), this._source = $, this._shell = I, this._vault = U, this._logFilter = parseFilter(G), this._timeout = q;
89034
89091
  const K = new Trigger(), Y = new Trigger();
@@ -89067,42 +89124,44 @@ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89067
89124
  this._clientServicesProxy || (log$2.trace("dxos.sdk.iframe-clientTraceices-proxy", trace$1.begin({
89068
89125
  id: this._instanceId
89069
89126
  }), {
89070
- F: __dxlog_file5,
89071
- L: 141,
89127
+ F: __dxlog_file6,
89128
+ L: 142,
89072
89129
  S: this,
89073
89130
  C: (I, U) => I(...U)
89074
89131
  }), await this._iframeManager.open(), this._clientServicesProxy = new ClientServicesProxy(this._appPort), await this._clientServicesProxy.open(), this._loggingStream = this._clientServicesProxy.services.LoggingService.queryLogs({
89075
89132
  filters: this._logFilter
89133
+ }, {
89134
+ timeout: RPC_TIMEOUT
89076
89135
  }), this._loggingStream.subscribe((I) => {
89077
89136
  switch (I.level) {
89078
89137
  case LogLevel.DEBUG:
89079
89138
  log$2.debug(`[vault] ${I.message}`, I.context, {
89080
- F: __dxlog_file5,
89081
- L: 153,
89139
+ F: __dxlog_file6,
89140
+ L: 157,
89082
89141
  S: this,
89083
89142
  C: (U, q) => U(...q)
89084
89143
  });
89085
89144
  break;
89086
89145
  case LogLevel.INFO:
89087
89146
  log$2.info(`[vault] ${I.message}`, I.context, {
89088
- F: __dxlog_file5,
89089
- L: 156,
89147
+ F: __dxlog_file6,
89148
+ L: 160,
89090
89149
  S: this,
89091
89150
  C: (U, q) => U(...q)
89092
89151
  });
89093
89152
  break;
89094
89153
  case LogLevel.WARN:
89095
89154
  log$2.warn(`[vault] ${I.message}`, I.context, {
89096
- F: __dxlog_file5,
89097
- L: 159,
89155
+ F: __dxlog_file6,
89156
+ L: 163,
89098
89157
  S: this,
89099
89158
  C: (U, q) => U(...q)
89100
89159
  });
89101
89160
  break;
89102
89161
  case LogLevel.ERROR:
89103
89162
  log$2.error(`[vault] ${I.message}`, I.context, {
89104
- F: __dxlog_file5,
89105
- L: 162,
89163
+ F: __dxlog_file6,
89164
+ L: 166,
89106
89165
  S: this,
89107
89166
  C: (U, q) => U(...q)
89108
89167
  });
@@ -89115,8 +89174,8 @@ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89115
89174
  await (($ = this._shellManager) == null ? void 0 : $.close()), await this._iframeManager.close(), await ((I = this._loggingStream) == null ? void 0 : I.close()), await ((U = this._clientServicesProxy) == null ? void 0 : U.close()), this._clientServicesProxy = void 0, log$2.trace("dxos.sdk.iframe-clientTraceices-proxy", trace$1.end({
89116
89175
  id: this._instanceId
89117
89176
  }), {
89118
- F: __dxlog_file5,
89119
- L: 176,
89177
+ F: __dxlog_file6,
89178
+ L: 180,
89120
89179
  S: this,
89121
89180
  C: (q, G) => q(...G)
89122
89181
  });
@@ -89134,7 +89193,7 @@ function _ts_decorate6($, I, U, q) {
89134
89193
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
89135
89194
  return G > 3 && K && Object.defineProperty(I, U, K), K;
89136
89195
  }
89137
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/worker-client-services.ts", WorkerClientServices = class {
89196
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/worker-client-services.ts", WorkerClientServices = class {
89138
89197
  constructor({ config: $, createWorker: I, logFilter: U = "error,warn", observabilityGroup: q, signalTelemetryEnabled: G }) {
89139
89198
  this.closed = new Event$1(), this.joinedSpace = new Event$1(), this._isOpen = !1, this._config = $, this._createWorker = I, this._logFilter = parseFilter(U), this._observabilityGroup = q, this._signalTelemetryEnabled = G ?? !1;
89140
89199
  }
@@ -89151,8 +89210,8 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89151
89210
  if (this._isOpen)
89152
89211
  return;
89153
89212
  log$2("opening...", void 0, {
89154
- F: __dxlog_file7,
89155
- L: 87,
89213
+ F: __dxlog_file8,
89214
+ L: 88,
89156
89215
  S: this,
89157
89216
  C: (K, Y) => K(...Y)
89158
89217
  });
@@ -89177,13 +89236,15 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89177
89236
  port: G
89178
89237
  })), await this._services.open(), navigator.locks.request(LOCK_KEY, () => {
89179
89238
  log$2("terminated", void 0, {
89180
- F: __dxlog_file7,
89181
- L: 114,
89239
+ F: __dxlog_file8,
89240
+ L: 115,
89182
89241
  S: this,
89183
89242
  C: (K, Y) => K(...Y)
89184
89243
  }), this._isOpen && this.closed.emit(new Error("Shared worker terminated."));
89185
89244
  }), this._loggingStream = this._services.services.LoggingService.queryLogs({
89186
89245
  filters: this._logFilter
89246
+ }, {
89247
+ timeout: RPC_TIMEOUT
89187
89248
  }), this._loggingStream.subscribe((K) => {
89188
89249
  switch (K.level) {
89189
89250
  case LogLevel.DEBUG:
@@ -89200,8 +89261,8 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89200
89261
  break;
89201
89262
  }
89202
89263
  }), log$2("opened", void 0, {
89203
- F: __dxlog_file7,
89204
- L: 140,
89264
+ F: __dxlog_file8,
89265
+ L: 144,
89205
89266
  S: this,
89206
89267
  C: (K, Y) => K(...Y)
89207
89268
  }), this._isOpen = !0;
@@ -89209,13 +89270,13 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89209
89270
  async close() {
89210
89271
  var $;
89211
89272
  this._isOpen && (log$2("closing...", void 0, {
89212
- F: __dxlog_file7,
89213
- L: 150,
89273
+ F: __dxlog_file8,
89274
+ L: 154,
89214
89275
  S: this,
89215
89276
  C: (I, U) => I(...U)
89216
89277
  }), await (($ = this._loggingStream) == null ? void 0 : $.close()), await this._runtime.close(), await this._services.close(), log$2("closed", void 0, {
89217
- F: __dxlog_file7,
89218
- L: 155,
89278
+ F: __dxlog_file8,
89279
+ L: 159,
89219
89280
  S: this,
89220
89281
  C: (I, U) => I(...U)
89221
89282
  }), this._isOpen = !1);
@@ -90325,12 +90386,17 @@ Object.defineProperties(u.prototype, { $$typeof: { configurable: !0, value: h },
90325
90386
  var ClientContext = /* @__PURE__ */ createContext(void 0), useClient = () => {
90326
90387
  const { client: $ } = useContext(ClientContext) ?? raise$2(new Error("Missing ClientContext."));
90327
90388
  return $;
90389
+ }, useMulticastObservable = ($) => {
90390
+ const I = useMemo(() => (U) => {
90391
+ const q = $.subscribe(U);
90392
+ return () => q.unsubscribe();
90393
+ }, [
90394
+ $
90395
+ ]);
90396
+ return useSyncExternalStore(I, () => $.get());
90328
90397
  }, useNetworkStatus = () => {
90329
90398
  const $ = useClient();
90330
- return useSyncExternalStore((U) => {
90331
- const q = $.mesh.networkStatus.subscribe(U);
90332
- return () => q.unsubscribe();
90333
- }, () => $.mesh.networkStatus.get());
90399
+ return useMulticastObservable($.mesh.networkStatus);
90334
90400
  }, withSelector = { exports: {} }, withSelector_production_min = {};
90335
90401
  /**
90336
90402
  * @license React
@@ -93631,7 +93697,11 @@ const identityMachine = createMachine(
93631
93697
  }
93632
93698
  }, []);
93633
93699
  return { onAgentCreate: async () => {
93634
- I.forEach((ae) => ae.cancel()), $.halo.share({ type: Invitation.Type.MULTIUSE, authMethod: Invitation.AuthMethod.NONE }).subscribe(ee);
93700
+ I.forEach((ae) => ae.cancel()), $.halo.share({
93701
+ type: Invitation.Type.INTERACTIVE,
93702
+ authMethod: Invitation.AuthMethod.NONE,
93703
+ multiUse: !0
93704
+ }).subscribe(ee);
93635
93705
  }, onAgentDestroy: async () => {
93636
93706
  const re = $.halo.identity.get();
93637
93707
  invariant(re, "Identity not found");
@@ -94821,11 +94891,11 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
94821
94891
  active: I,
94822
94892
  send: U,
94823
94893
  status: q,
94824
- type: G,
94894
+ multiUse: G,
94825
94895
  authCode: K,
94826
94896
  id: Y = "0"
94827
94897
  }) => {
94828
- const { t: J } = useTranslation("os"), Z = useId("invitation-manager__qr-code"), Q = G === Invitation.Type.MULTIUSE ? 0 : invitationStatusValue.get(q) ?? 0, ee = Q === 3, te = hexToEmoji(Y), ne = useMemo(() => {
94898
+ const { t: J } = useTranslation("os"), Z = useId("invitation-manager__qr-code"), Q = G ? 0 : invitationStatusValue.get(q) ?? 0, ee = Q === 3, te = hexToEmoji(Y), ne = useMemo(() => {
94829
94899
  switch (!0) {
94830
94900
  case Q === 5:
94831
94901
  case Q < 0:
@@ -94836,7 +94906,7 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
94836
94906
  return "showing qr";
94837
94907
  }
94838
94908
  }, [Q]);
94839
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Viewport.Root, { activeView: ne, classNames: "grow plb-1" }, /* @__PURE__ */ React__default.createElement(Viewport.Views, null, /* @__PURE__ */ React__default.createElement(InvitationManagerView, { id: "showing qr", emoji: te }, /* @__PURE__ */ React__default.createElement("p", { className: "text-sm mlb-1 font-normal text-center" }, J(G === Invitation.Type.MULTIUSE ? "invite many qr label" : "invite one qr label")), /* @__PURE__ */ React__default.createElement("div", { role: "none", className: mx(descriptionText, "is-full max-is-[14rem] relative") }, /* @__PURE__ */ React__default.createElement(
94909
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Viewport.Root, { activeView: ne, classNames: "grow plb-1" }, /* @__PURE__ */ React__default.createElement(Viewport.Views, null, /* @__PURE__ */ React__default.createElement(InvitationManagerView, { id: "showing qr", emoji: te }, /* @__PURE__ */ React__default.createElement("p", { className: "text-sm mlb-1 font-normal text-center" }, J(G ? "invite many qr label" : "invite one qr label")), /* @__PURE__ */ React__default.createElement("div", { role: "none", className: mx(descriptionText, "is-full max-is-[14rem] relative") }, /* @__PURE__ */ React__default.createElement(
94840
94910
  QR,
94841
94911
  {
94842
94912
  rounding: 100,
@@ -95967,7 +96037,7 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
95967
96037
  Space: re.context.space.unredeemedCode
95968
96038
  }),
95969
96039
  [re]
95970
- ), ue = useMulticastObservable(Q.spaces), he = useMemo(
96040
+ ), ue = useMulticastObservable$1(Q.spaces), he = useMemo(
95971
96041
  () => ({
95972
96042
  Space: ue ? new Set(ue.map(({ key: Ce }) => Ce.toHex())) : void 0
95973
96043
  }),
@@ -96096,6 +96166,7 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
96096
96166
  const Z = (Q = I.share) == null ? void 0 : Q.call(I, {
96097
96167
  type: Invitation.Type.INTERACTIVE,
96098
96168
  authMethod: Invitation.AuthMethod.SHARED_SECRET,
96169
+ multiUse: !1,
96099
96170
  target: U
96100
96171
  });
96101
96172
  Z && ((ne = (te = (ee = G.values.runtime) == null ? void 0 : ee.app) == null ? void 0 : te.env) == null ? void 0 : ne.DX_ENVIRONMENT) !== "production" && Z.subscribe(Y);
@@ -96108,8 +96179,9 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
96108
96179
  onClick: useCallback(() => {
96109
96180
  var Q, ee, te, ne;
96110
96181
  const Z = (Q = I.share) == null ? void 0 : Q.call(I, {
96111
- type: Invitation.Type.MULTIUSE,
96182
+ type: Invitation.Type.INTERACTIVE,
96112
96183
  authMethod: Invitation.AuthMethod.NONE,
96184
+ multiUse: !0,
96113
96185
  target: U
96114
96186
  });
96115
96187
  Z && ((ne = (te = (ee = G.values.runtime) == null ? void 0 : ee.app) == null ? void 0 : te.env) == null ? void 0 : ne.DX_ENVIRONMENT) !== "production" && Z.subscribe(Y);
@@ -96543,11 +96615,11 @@ createContext({});
96543
96615
  export {
96544
96616
  Event$1 as E,
96545
96617
  Trigger as T,
96546
- WebSocket2 as W,
96618
+ WebSocket3 as W,
96547
96619
  logInfo as a,
96548
96620
  createProtoRpcPeer as c,
96549
96621
  export_Buffer as e,
96550
96622
  log$2 as l,
96551
96623
  runShell as r
96552
96624
  };
96553
- //# sourceMappingURL=index-CnChDHv2.mjs.map
96625
+ //# sourceMappingURL=index-DACjPI-n.mjs.map