@dxos/shell 0.4.10-main.06ef97a → 0.4.10-main.109a137

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-BiLYqmR3.mjs → index-B5NRHaY9.mjs} +38 -22
  2. package/dist/bundle/index-B5NRHaY9.mjs.map +1 -0
  3. package/dist/bundle/{index-CVZAWw41.mjs → index-CB-lG23j.mjs} +557 -493
  4. package/dist/bundle/index-CB-lG23j.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 +25 -25
  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 -22
  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-BiLYqmR3.mjs.map +0 -1
  35. package/dist/bundle/index-CVZAWw41.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 SystemStatus;
69509
+ var RPC_TIMEOUT = 2e4, SystemStatus;
69490
69510
  (function($) {
69491
69511
  $[$.ACTIVE = 0] = "ACTIVE", $[$.INACTIVE = 1] = "INACTIVE";
69492
69512
  })(SystemStatus || (SystemStatus = {}));
@@ -69531,11 +69551,11 @@ var CreateEpochRequest;
69531
69551
  var Invitation;
69532
69552
  (function($) {
69533
69553
  (function(I) {
69534
- I[I.INTERACTIVE = 0] = "INTERACTIVE", I[I.OFFLINE = 1] = "OFFLINE", I[I.MULTIUSE = 2] = "MULTIUSE";
69554
+ I[I.INTERACTIVE = 0] = "INTERACTIVE", I[I.DELEGATED = 1] = "DELEGATED", I[I.MULTIUSE = 2] = "MULTIUSE";
69535
69555
  })($.Type || ($.Type = {})), function(I) {
69536
69556
  I[I.DEVICE = 0] = "DEVICE", I[I.SPACE = 1] = "SPACE";
69537
69557
  }($.Kind || ($.Kind = {})), function(I) {
69538
- I[I.NONE = 0] = "NONE", I[I.SHARED_SECRET = 1] = "SHARED_SECRET";
69558
+ I[I.NONE = 0] = "NONE", I[I.SHARED_SECRET = 1] = "SHARED_SECRET", I[I.KNOWN_PUBLIC_KEY = 2] = "KNOWN_PUBLIC_KEY";
69539
69559
  }($.AuthMethod || ($.AuthMethod = {})), function(I) {
69540
69560
  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";
69541
69561
  }($.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,7 +82997,7 @@ 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
83003
  * @param _onMessage
@@ -82999,7 +83016,7 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
82999
83016
  log$2.trace("dxos.mesh.signal-client.open", trace$1.begin({
83000
83017
  id: this._instanceId
83001
83018
  }), {
83002
- F: __dxlog_file3$3,
83019
+ F: __dxlog_file3$2,
83003
83020
  L: 136,
83004
83021
  S: this,
83005
83022
  C: ($, I) => $(...I)
@@ -83010,7 +83027,7 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83010
83027
  onError: ($) => {
83011
83028
  var I;
83012
83029
  this._state === SignalState.CLOSED || (I = this._ctx) != null && I.disposed || (this._state === SignalState.CONNECTED && log$2.warn("SignalClient error:", $, {
83013
- F: __dxlog_file3$3,
83030
+ F: __dxlog_file3$2,
83014
83031
  L: 148,
83015
83032
  S: this,
83016
83033
  C: (U, q) => U(...q)
@@ -83025,7 +83042,7 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83025
83042
  }), this._setState(SignalState.CONNECTING), this._createClient(), log$2.trace("dxos.mesh.signal-client.open", trace$1.end({
83026
83043
  id: this._instanceId
83027
83044
  }), {
83028
- F: __dxlog_file3$3,
83045
+ F: __dxlog_file3$2,
83029
83046
  L: 177,
83030
83047
  S: this,
83031
83048
  C: ($, I) => $(...I)
@@ -83034,14 +83051,14 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83034
83051
  async close() {
83035
83052
  var $, I;
83036
83053
  log$2("closing...", void 0, {
83037
- F: __dxlog_file3$3,
83054
+ F: __dxlog_file3$2,
83038
83055
  L: 181,
83039
83056
  S: this,
83040
83057
  C: (U, q) => U(...q)
83041
83058
  }), ![
83042
83059
  SignalState.CLOSED
83043
83060
  ].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,
83061
+ F: __dxlog_file3$2,
83045
83062
  L: 192,
83046
83063
  S: this,
83047
83064
  C: (U, q) => U(...q)
@@ -83063,7 +83080,7 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83063
83080
  topic: $,
83064
83081
  peerId: I
83065
83082
  }, {
83066
- F: __dxlog_file3$3,
83083
+ F: __dxlog_file3$2,
83067
83084
  L: 207,
83068
83085
  S: this,
83069
83086
  C: (U, q) => U(...q)
@@ -83078,7 +83095,7 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83078
83095
  topic: $,
83079
83096
  peerId: I
83080
83097
  }, {
83081
- F: __dxlog_file3$3,
83098
+ F: __dxlog_file3$2,
83082
83099
  L: 215,
83083
83100
  S: this,
83084
83101
  C: (q, G) => q(...G)
@@ -83095,8 +83112,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83095
83112
  }
83096
83113
  async sendMessage($) {
83097
83114
  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,
83115
+ F: __dxlog_file3$2,
83116
+ L: 224,
83100
83117
  S: this,
83101
83118
  A: [
83102
83119
  "this._state === SignalState.CONNECTED",
@@ -83108,8 +83125,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83108
83125
  log$2("subscribing to messages", {
83109
83126
  peerId: $
83110
83127
  }, {
83111
- F: __dxlog_file3$3,
83112
- L: 230,
83128
+ F: __dxlog_file3$2,
83129
+ L: 229,
83113
83130
  S: this,
83114
83131
  C: (I, U) => I(...U)
83115
83132
  }), this._subscribedMessages.add({
@@ -83121,8 +83138,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83121
83138
  log$2("unsubscribing from messages", {
83122
83139
  peerId: $
83123
83140
  }, {
83124
- F: __dxlog_file3$3,
83125
- L: 236,
83141
+ F: __dxlog_file3$2,
83142
+ L: 235,
83126
83143
  S: this,
83127
83144
  C: (U, q) => U(...q)
83128
83145
  }), this._subscribedMessages.delete({
@@ -83138,8 +83155,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83138
83155
  this._state = $, this._lastStateChange = /* @__PURE__ */ new Date(), log$2("signal state changed", {
83139
83156
  status: this.getStatus()
83140
83157
  }, {
83141
- F: __dxlog_file3$3,
83142
- L: 255,
83158
+ F: __dxlog_file3$2,
83159
+ L: 254,
83143
83160
  S: this,
83144
83161
  C: (I, U) => I(...U)
83145
83162
  }), this.statusChanged.emit(this.getStatus());
@@ -83149,13 +83166,13 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83149
83166
  host: this._host,
83150
83167
  state: this._state
83151
83168
  }, {
83152
- F: __dxlog_file3$3,
83153
- L: 260,
83169
+ F: __dxlog_file3$2,
83170
+ L: 259,
83154
83171
  S: this,
83155
83172
  C: ($, I) => $(...I)
83156
83173
  }), invariant(!this._client, "Client already created", {
83157
- F: __dxlog_file3$3,
83158
- L: 261,
83174
+ F: __dxlog_file3$2,
83175
+ L: 260,
83159
83176
  S: this,
83160
83177
  A: [
83161
83178
  "!this._client",
@@ -83163,8 +83180,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83163
83180
  ]
83164
83181
  }), this._connectionStarted = /* @__PURE__ */ new Date(), this._connectionCtx = this._ctx.derive(), this._connectionCtx.onDispose(async () => {
83165
83182
  log$2("connection context disposed", void 0, {
83166
- F: __dxlog_file3$3,
83167
- L: 268,
83183
+ F: __dxlog_file3$2,
83184
+ L: 267,
83168
83185
  S: this,
83169
83186
  C: ($, I) => $(...I)
83170
83187
  }), 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 +83192,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83175
83192
  callbacks: {
83176
83193
  onConnected: () => {
83177
83194
  log$2("socket connected", void 0, {
83178
- F: __dxlog_file3$3,
83179
- L: 280,
83195
+ F: __dxlog_file3$2,
83196
+ L: 279,
83180
83197
  S: this,
83181
83198
  C: ($, I) => $(...I)
83182
83199
  }), this._lastError = void 0, this._reconnectAfter = DEFAULT_RECONNECT_TIMEOUT, this._setState(SignalState.CONNECTED), this._clientReady.wake(), this._reconcileTask.schedule();
@@ -83185,8 +83202,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83185
83202
  if (log$2("socket disconnected", {
83186
83203
  state: this._state
83187
83204
  }, {
83188
- F: __dxlog_file3$3,
83189
- L: 289,
83205
+ F: __dxlog_file3$2,
83206
+ L: 288,
83190
83207
  S: this,
83191
83208
  C: ($, I) => $(...I)
83192
83209
  }), this._state === SignalState.ERROR) {
@@ -83200,8 +83217,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83200
83217
  error: $,
83201
83218
  state: this._state
83202
83219
  }, {
83203
- F: __dxlog_file3$3,
83204
- L: 304,
83220
+ F: __dxlog_file3$2,
83221
+ L: 303,
83205
83222
  S: this,
83206
83223
  C: (I, U) => I(...U)
83207
83224
  }), this._lastError = $, this._state !== SignalState.CONNECTED && this._state !== SignalState.CONNECTING && this._incrementReconnectTimeout(), this._setState(SignalState.ERROR), this._reconnectTask.schedule();
@@ -83221,14 +83238,14 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83221
83238
  if (log$2(`reconnecting in ${this._reconnectAfter}ms`, {
83222
83239
  state: this._state
83223
83240
  }, {
83224
- F: __dxlog_file3$3,
83225
- L: 332,
83241
+ F: __dxlog_file3$2,
83242
+ L: 331,
83226
83243
  S: this,
83227
83244
  C: (U, q) => U(...q)
83228
83245
  }), this._performance.reconnectCounter++, this._state === SignalState.RECONNECTING) {
83229
83246
  log$2.warn("Signal api already reconnecting.", void 0, {
83230
- F: __dxlog_file3$3,
83231
- L: 336,
83247
+ F: __dxlog_file3$2,
83248
+ L: 335,
83232
83249
  S: this,
83233
83250
  C: (U, q) => U(...q)
83234
83251
  });
@@ -83242,8 +83259,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83242
83259
  await asyncTimeout(cancelWithContext(this._connectionCtx, this._clientReady.wait()), 5e3);
83243
83260
  const $ = this._client;
83244
83261
  invariant(this._state === SignalState.CONNECTED, "Not connected to Signal Server", {
83245
- F: __dxlog_file3$3,
83246
- L: 361,
83262
+ F: __dxlog_file3$2,
83263
+ L: 360,
83247
83264
  S: this,
83248
83265
  A: [
83249
83266
  "this._state === SignalState.CONNECTED",
@@ -83275,8 +83292,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83275
83292
  log$2("swarm event", {
83276
83293
  swarmEvent: K
83277
83294
  }, {
83278
- F: __dxlog_file3$3,
83279
- L: 388,
83295
+ F: __dxlog_file3$2,
83296
+ L: 387,
83280
83297
  S: this,
83281
83298
  C: (Y, J) => Y(...J)
83282
83299
  }), await this._onSwarmEvent({
@@ -83294,8 +83311,8 @@ var __dxlog_file2$3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/
83294
83311
  await asyncTimeout(cancelWithContext(this._connectionCtx, this._clientReady.wait()), 5e3);
83295
83312
  const $ = this._client;
83296
83313
  invariant(this._state === SignalState.CONNECTED, "Not connected to Signal Server", {
83297
- F: __dxlog_file3$3,
83298
- L: 401,
83314
+ F: __dxlog_file3$2,
83315
+ L: 400,
83299
83316
  S: this,
83300
83317
  A: [
83301
83318
  "this._state === SignalState.CONNECTED",
@@ -83569,14 +83586,14 @@ _ts_decorate$3([
83569
83586
  _ts_decorate$3([
83570
83587
  synchronized
83571
83588
  ], 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 }) => {
83589
+ 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
83590
  $.queryIdentity().subscribe((q) => {
83574
83591
  var G;
83575
83592
  if (!((G = q == null ? void 0 : q.identity) != null && G.identityKey)) {
83576
83593
  log$2("empty response from identity service", {
83577
83594
  idqr: q
83578
83595
  }, {
83579
- F: __dxlog_file6,
83596
+ F: __dxlog_file6$1,
83580
83597
  L: 21,
83581
83598
  S: void 0,
83582
83599
  C: (K, Y) => K(...Y)
@@ -83589,7 +83606,7 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/sr
83589
83606
  log$2("empty response from device service", {
83590
83607
  device: q
83591
83608
  }, {
83592
- F: __dxlog_file6,
83609
+ F: __dxlog_file6$1,
83593
83610
  L: 30,
83594
83611
  S: void 0,
83595
83612
  C: (K, Y) => K(...Y)
@@ -83597,7 +83614,7 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/sr
83597
83614
  return;
83598
83615
  }
83599
83616
  invariant(q, "empty response from device service", {
83600
- F: __dxlog_file6,
83617
+ F: __dxlog_file6$1,
83601
83618
  L: 33,
83602
83619
  S: void 0,
83603
83620
  A: [
@@ -83610,7 +83627,7 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/sr
83610
83627
  log$2("no current device", {
83611
83628
  device: q
83612
83629
  }, {
83613
- F: __dxlog_file6,
83630
+ F: __dxlog_file6$1,
83614
83631
  L: 37,
83615
83632
  S: void 0,
83616
83633
  C: (K, Y) => K(...Y)
@@ -84811,7 +84828,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84811
84828
  }, encodeFrame = ($) => {
84812
84829
  const I = export_Buffer.allocUnsafe(FRAME_LENGTH_SIZE + $.length);
84813
84830
  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 {
84831
+ }, __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts", MAX_CHUNK_SIZE = 8192, Balancer = class {
84815
84832
  constructor($) {
84816
84833
  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
84834
  }
@@ -84829,7 +84846,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84829
84846
  }
84830
84847
  pushData($, I, U) {
84831
84848
  this._enqueueChunk($, I, U), this._sendChunks().catch((q) => log$2.catch(q, void 0, {
84832
- F: __dxlog_file3$2,
84849
+ F: __dxlog_file3$1,
84833
84850
  L: 75,
84834
84851
  S: this,
84835
84852
  C: (G, K) => G(...K)
@@ -84837,7 +84854,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84837
84854
  }
84838
84855
  destroy() {
84839
84856
  this._sendBuffers.size !== 0 && log$2.info("destroying balancer with pending calls", void 0, {
84840
- F: __dxlog_file3$2,
84857
+ F: __dxlog_file3$1,
84841
84858
  L: 80,
84842
84859
  S: this,
84843
84860
  C: ($, I) => $(...I)
@@ -84904,12 +84921,12 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84904
84921
  let $;
84905
84922
  for ($ = this._getNextChunk(); $; ) {
84906
84923
  this._framer.writable || (log$2("PAUSE for drain", void 0, {
84907
- F: __dxlog_file3$2,
84924
+ F: __dxlog_file3$1,
84908
84925
  L: 179,
84909
84926
  S: this,
84910
84927
  C: (q, G) => q(...G)
84911
84928
  }), await this._framer.drain.waitForCount(1), log$2("RESUME for drain", void 0, {
84912
- F: __dxlog_file3$2,
84929
+ F: __dxlog_file3$1,
84913
84930
  L: 181,
84914
84931
  S: this,
84915
84932
  C: (q, G) => q(...G)
@@ -84920,7 +84937,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84920
84937
  log$2("Error sending chunk", {
84921
84938
  err: q
84922
84939
  }, {
84923
- F: __dxlog_file3$2,
84940
+ F: __dxlog_file3$1,
84924
84941
  L: 187,
84925
84942
  S: this,
84926
84943
  C: (G, K) => G(...K)
@@ -84929,7 +84946,7 @@ var N1 = Math.pow(2, 7), N2 = Math.pow(2, 14), N3 = Math.pow(2, 21), N4 = Math.p
84929
84946
  $ = this._getNextChunk();
84930
84947
  }
84931
84948
  invariant(this._sendBuffers.size === 0, "sendBuffers not empty", {
84932
- F: __dxlog_file3$2,
84949
+ F: __dxlog_file3$1,
84933
84950
  L: 192,
84934
84951
  S: this,
84935
84952
  A: [
@@ -85702,13 +85719,13 @@ var Connection = class {
85702
85719
  stream: this._protocol.stream,
85703
85720
  sendSignal: async ($) => this._sendSignal($),
85704
85721
  sessionId: this.sessionId
85705
- }), this._transport.connected.once(async () => {
85722
+ }), await this._transport.open(), this._transport.connected.once(async () => {
85706
85723
  var $, I;
85707
85724
  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
85725
  }), this._transport.closed.once(() => {
85709
85726
  this._transport = void 0, log$2("abort triggered by transport close", void 0, {
85710
85727
  F: __dxlog_file$2,
85711
- L: 216,
85728
+ L: 218,
85712
85729
  S: this,
85713
85730
  C: ($, I) => $(...I)
85714
85731
  }), this.abort().catch(($) => this.errors.raise($));
@@ -85717,35 +85734,35 @@ var Connection = class {
85717
85734
  err: $
85718
85735
  }, {
85719
85736
  F: __dxlog_file$2,
85720
- L: 221,
85737
+ L: 223,
85721
85738
  S: this,
85722
85739
  C: (I, U) => I(...U)
85723
85740
  }), this.closeReason || (this.closeReason = $ == null ? void 0 : $.message), $ instanceof ConnectionResetError ? (log$2.info("aborting due to transport ConnectionResetError", void 0, {
85724
85741
  F: __dxlog_file$2,
85725
- L: 228,
85742
+ L: 230,
85726
85743
  S: this,
85727
85744
  C: (I, U) => I(...U)
85728
85745
  }), this.abort().catch((I) => this.errors.raise(I))) : $ instanceof ConnectivityError ? (log$2.info("aborting due to transport ConnectivityError", void 0, {
85729
85746
  F: __dxlog_file$2,
85730
- L: 231,
85747
+ L: 233,
85731
85748
  S: this,
85732
85749
  C: (I, U) => I(...U)
85733
85750
  }), this.abort().catch((I) => this.errors.raise(I))) : $ instanceof UnknownProtocolError && log$2.warn("unsure what to do with UnknownProtocolError, will keep on truckin", {
85734
85751
  err: $
85735
85752
  }, {
85736
85753
  F: __dxlog_file$2,
85737
- L: 234,
85754
+ L: 236,
85738
85755
  S: this,
85739
85756
  C: (I, U) => I(...U)
85740
85757
  }), this._state !== "CLOSED" && this._state !== "CLOSING" && (await this.connectedTimeoutContext.dispose(), this.errors.raise($));
85741
85758
  });
85742
85759
  for (const $ of this._incomingSignalBuffer)
85743
- this._transport.signal($);
85760
+ this._transport.onSignal($);
85744
85761
  this._incomingSignalBuffer = [], log$2.trace("dxos.mesh.connection.open-connection", trace$1.end({
85745
85762
  id: this._instanceId
85746
85763
  }), {
85747
85764
  F: __dxlog_file$2,
85748
- L: 250,
85765
+ L: 252,
85749
85766
  S: this,
85750
85767
  C: ($, I) => $(...I)
85751
85768
  });
@@ -85756,13 +85773,13 @@ var Connection = class {
85756
85773
  err: $
85757
85774
  }, {
85758
85775
  F: __dxlog_file$2,
85759
- L: 257,
85776
+ L: 259,
85760
85777
  S: this,
85761
85778
  C: (G, K) => G(...K)
85762
85779
  }), this._state === "CLOSED" || this._state === "ABORTED") {
85763
85780
  log$2(`abort ignored: already ${this._state}`, this.closeReason, {
85764
85781
  F: __dxlog_file$2,
85765
- L: 259,
85782
+ L: 261,
85766
85783
  S: this,
85767
85784
  C: (G, K) => G(...K)
85768
85785
  });
@@ -85772,24 +85789,24 @@ var Connection = class {
85772
85789
  try {
85773
85790
  log$2("aborting protocol... ", void 0, {
85774
85791
  F: __dxlog_file$2,
85775
- L: 273,
85792
+ L: 275,
85776
85793
  S: this,
85777
85794
  C: (G, K) => G(...K)
85778
85795
  }), await this._protocol.abort();
85779
85796
  } catch (G) {
85780
85797
  log$2.catch(G, void 0, {
85781
85798
  F: __dxlog_file$2,
85782
- L: 276,
85799
+ L: 278,
85783
85800
  S: this,
85784
85801
  C: (K, Y) => K(...Y)
85785
85802
  });
85786
85803
  }
85787
85804
  try {
85788
- await ((I = this._transport) == null ? void 0 : I.destroy());
85805
+ await ((I = this._transport) == null ? void 0 : I.close());
85789
85806
  } catch (G) {
85790
85807
  log$2.catch(G, void 0, {
85791
85808
  F: __dxlog_file$2,
85792
- L: 283,
85809
+ L: 285,
85793
85810
  S: this,
85794
85811
  C: (K, Y) => K(...Y)
85795
85812
  });
@@ -85799,7 +85816,7 @@ var Connection = class {
85799
85816
  } catch (G) {
85800
85817
  log$2.catch(G, void 0, {
85801
85818
  F: __dxlog_file$2,
85802
- L: 289,
85819
+ L: 291,
85803
85820
  S: this,
85804
85821
  C: (K, Y) => K(...Y)
85805
85822
  });
@@ -85815,7 +85832,7 @@ var Connection = class {
85815
85832
  peerId: this.ownId
85816
85833
  }, {
85817
85834
  F: __dxlog_file$2,
85818
- L: 314,
85835
+ L: 316,
85819
85836
  S: this,
85820
85837
  C: (Y, J) => Y(...J)
85821
85838
  }), I === "CONNECTED") {
@@ -85824,17 +85841,17 @@ var Connection = class {
85824
85841
  } catch (Y) {
85825
85842
  log$2.catch(Y, void 0, {
85826
85843
  F: __dxlog_file$2,
85827
- L: 321,
85844
+ L: 323,
85828
85845
  S: this,
85829
85846
  C: (J, Z) => J(...Z)
85830
85847
  });
85831
85848
  }
85832
85849
  try {
85833
- await ((U = this._transport) == null ? void 0 : U.destroy());
85850
+ await ((U = this._transport) == null ? void 0 : U.close());
85834
85851
  } catch (Y) {
85835
85852
  log$2.catch(Y, void 0, {
85836
85853
  F: __dxlog_file$2,
85837
- L: 328,
85854
+ L: 330,
85838
85855
  S: this,
85839
85856
  C: (J, Z) => J(...Z)
85840
85857
  });
@@ -85842,7 +85859,7 @@ var Connection = class {
85842
85859
  } else {
85843
85860
  log$2.info(`graceful close requested when we were in ${I} state? aborting`, void 0, {
85844
85861
  F: __dxlog_file$2,
85845
- L: 331,
85862
+ L: 333,
85846
85863
  S: this,
85847
85864
  C: (Y, J) => Y(...J)
85848
85865
  });
@@ -85851,17 +85868,17 @@ var Connection = class {
85851
85868
  } catch (Y) {
85852
85869
  log$2.catch(Y, void 0, {
85853
85870
  F: __dxlog_file$2,
85854
- L: 335,
85871
+ L: 337,
85855
85872
  S: this,
85856
85873
  C: (J, Z) => J(...Z)
85857
85874
  });
85858
85875
  }
85859
85876
  try {
85860
- await ((q = this._transport) == null ? void 0 : q.destroy());
85877
+ await ((q = this._transport) == null ? void 0 : q.close());
85861
85878
  } catch (Y) {
85862
85879
  log$2.catch(Y, void 0, {
85863
85880
  F: __dxlog_file$2,
85864
- L: 340,
85881
+ L: 342,
85865
85882
  S: this,
85866
85883
  C: (J, Z) => J(...Z)
85867
85884
  });
@@ -85871,7 +85888,7 @@ var Connection = class {
85871
85888
  peerId: this.ownId
85872
85889
  }, {
85873
85890
  F: __dxlog_file$2,
85874
- L: 344,
85891
+ L: 346,
85875
85892
  S: this,
85876
85893
  C: (Y, J) => Y(...J)
85877
85894
  }), this._changeState("CLOSED"), (K = (G = this._callbacks) == null ? void 0 : G.onClosed) == null || K.call(G, $);
@@ -85905,7 +85922,7 @@ var Connection = class {
85905
85922
  err: I
85906
85923
  }, {
85907
85924
  F: __dxlog_file$2,
85908
- L: 382,
85925
+ L: 384,
85909
85926
  S: this,
85910
85927
  C: (U, q) => U(...q)
85911
85928
  }), await this.close(new ConnectivityError("signal message failed to deliver", I));
@@ -85918,7 +85935,7 @@ var Connection = class {
85918
85935
  var U, q;
85919
85936
  if (invariant($.sessionId, void 0, {
85920
85937
  F: __dxlog_file$2,
85921
- L: 391,
85938
+ L: 393,
85922
85939
  S: this,
85923
85940
  A: [
85924
85941
  "msg.sessionId",
@@ -85927,7 +85944,7 @@ var Connection = class {
85927
85944
  }), !$.sessionId.equals(this.sessionId)) {
85928
85945
  log$2("dropping signal for incorrect session id", void 0, {
85929
85946
  F: __dxlog_file$2,
85930
- L: 393,
85947
+ L: 395,
85931
85948
  S: this,
85932
85949
  C: (G, K) => G(...K)
85933
85950
  });
@@ -85935,7 +85952,7 @@ var Connection = class {
85935
85952
  }
85936
85953
  invariant($.data.signal || $.data.signalBatch, void 0, {
85937
85954
  F: __dxlog_file$2,
85938
- L: 396,
85955
+ L: 398,
85939
85956
  S: this,
85940
85957
  A: [
85941
85958
  "msg.data.signal || msg.data.signalBatch",
@@ -85943,7 +85960,7 @@ var Connection = class {
85943
85960
  ]
85944
85961
  }), invariant((U = $.author) == null ? void 0 : U.equals(this.remoteId), void 0, {
85945
85962
  F: __dxlog_file$2,
85946
- L: 397,
85963
+ L: 399,
85947
85964
  S: this,
85948
85965
  A: [
85949
85966
  "msg.author?.equals(this.remoteId)",
@@ -85951,7 +85968,7 @@ var Connection = class {
85951
85968
  ]
85952
85969
  }), invariant((q = $.recipient) == null ? void 0 : q.equals(this.ownId), void 0, {
85953
85970
  F: __dxlog_file$2,
85954
- L: 398,
85971
+ L: 400,
85955
85972
  S: this,
85956
85973
  A: [
85957
85974
  "msg.recipient?.equals(this.ownId)",
@@ -85971,12 +85988,12 @@ var Connection = class {
85971
85988
  msg: $.data
85972
85989
  }, {
85973
85990
  F: __dxlog_file$2,
85974
- L: 407,
85991
+ L: 409,
85975
85992
  S: this,
85976
85993
  C: (K, Y) => K(...Y)
85977
85994
  }), this._incomingSignalBuffer.push(G)) : (invariant(this._transport, "Connection not ready to accept signals.", {
85978
85995
  F: __dxlog_file$2,
85979
- L: 410,
85996
+ L: 412,
85980
85997
  S: this,
85981
85998
  A: [
85982
85999
  "this._transport",
@@ -85988,10 +86005,10 @@ var Connection = class {
85988
86005
  msg: $.data
85989
86006
  }, {
85990
86007
  F: __dxlog_file$2,
85991
- L: 411,
86008
+ L: 413,
85992
86009
  S: this,
85993
86010
  C: (K, Y) => K(...Y)
85994
- }), await this._transport.signal(G)));
86011
+ }), await this._transport.onSignal(G)));
85995
86012
  }
85996
86013
  initiate() {
85997
86014
  this._changeState("INITIAL");
@@ -86003,12 +86020,12 @@ var Connection = class {
86003
86020
  peerId: this.ownId
86004
86021
  }, {
86005
86022
  F: __dxlog_file$2,
86006
- L: 422,
86023
+ L: 424,
86007
86024
  S: this,
86008
86025
  C: (I, U) => I(...U)
86009
86026
  }), invariant($ !== this._state, "Already in this state.", {
86010
86027
  F: __dxlog_file$2,
86011
- L: 423,
86028
+ L: 425,
86012
86029
  S: this,
86013
86030
  A: [
86014
86031
  "state !== this._state",
@@ -86242,12 +86259,11 @@ function _ts_decorate2$1($, I, U, q) {
86242
86259
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
86243
86260
  return G > 3 && K && Object.defineProperty(I, U, K), K;
86244
86261
  }
86245
- var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts", ConnectionDisplacedError = class extends SystemError {
86262
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts", ConnectionDisplacedError = class extends SystemError {
86246
86263
  constructor() {
86247
86264
  super("Connection displaced by remote initiator.");
86248
86265
  }
86249
86266
  }, CONNECTION_COUNTS_STABLE_AFTER = 5e3, Peer = class {
86250
- // TODO(burdon): Convert to map?
86251
86267
  constructor($, I, U, q, G, K, Y, J) {
86252
86268
  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
86269
  }
@@ -86263,8 +86279,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86263
86279
  ConnectionState.CONNECTING
86264
86280
  ].includes(this.connection.state))
86265
86281
  return log$2.info(`received offer when connection already in ${this.connection.state} state`, void 0, {
86266
- F: __dxlog_file3$1,
86267
- L: 115,
86282
+ F: __dxlog_file3,
86283
+ L: 114,
86268
86284
  S: this,
86269
86285
  C: (q, G) => q(...G)
86270
86286
  }), {
@@ -86278,8 +86294,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86278
86294
  remotePeerId: this.localPeerId,
86279
86295
  sessionId: (U = this.connection) == null ? void 0 : U.sessionId
86280
86296
  }, {
86281
- F: __dxlog_file3$1,
86282
- L: 124,
86297
+ F: __dxlog_file3,
86298
+ L: 123,
86283
86299
  S: this,
86284
86300
  C: (q, G) => q(...G)
86285
86301
  }), this.connection && await this.closeConnection(new ConnectionDisplacedError());
@@ -86289,8 +86305,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86289
86305
  };
86290
86306
  if (await this._callbacks.onOffer(I) && !this.connection) {
86291
86307
  invariant($.sessionId, void 0, {
86292
- F: __dxlog_file3$1,
86293
- L: 144,
86308
+ F: __dxlog_file3,
86309
+ L: 143,
86294
86310
  S: this,
86295
86311
  A: [
86296
86312
  "message.sessionId",
@@ -86307,8 +86323,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86307
86323
  remoteId: this.id,
86308
86324
  err: G
86309
86325
  }, {
86310
- F: __dxlog_file3$1,
86311
- L: 154,
86326
+ F: __dxlog_file3,
86327
+ L: 153,
86312
86328
  S: this,
86313
86329
  C: (K, Y) => K(...Y)
86314
86330
  }), await this.closeConnection(G);
@@ -86326,16 +86342,16 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86326
86342
  */
86327
86343
  async initiateConnection() {
86328
86344
  invariant(!this.initiating, "Initiation in progress.", {
86329
- F: __dxlog_file3$1,
86330
- L: 171,
86345
+ F: __dxlog_file3,
86346
+ L: 170,
86331
86347
  S: this,
86332
86348
  A: [
86333
86349
  "!this.initiating",
86334
86350
  "'Initiation in progress.'"
86335
86351
  ]
86336
86352
  }), invariant(!this.connection, "Already connected.", {
86337
- F: __dxlog_file3$1,
86338
- L: 172,
86353
+ F: __dxlog_file3,
86354
+ L: 171,
86339
86355
  S: this,
86340
86356
  A: [
86341
86357
  "!this.connection",
@@ -86349,8 +86365,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86349
86365
  peerId: this.id,
86350
86366
  sessionId: $
86351
86367
  }, {
86352
- F: __dxlog_file3$1,
86353
- L: 174,
86368
+ F: __dxlog_file3,
86369
+ L: 173,
86354
86370
  S: this,
86355
86371
  C: (q, G) => q(...G)
86356
86372
  });
@@ -86372,14 +86388,14 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86372
86388
  ownId: this.localPeerId,
86373
86389
  remoteId: this.id
86374
86390
  }, {
86375
- F: __dxlog_file3$1,
86376
- L: 191,
86391
+ F: __dxlog_file3,
86392
+ L: 190,
86377
86393
  S: this,
86378
86394
  C: (q, G) => q(...G)
86379
86395
  }), I.state !== ConnectionState.INITIAL) {
86380
86396
  log$2("ignoring response", void 0, {
86381
- F: __dxlog_file3$1,
86382
- L: 193,
86397
+ F: __dxlog_file3,
86398
+ L: 192,
86383
86399
  S: this,
86384
86400
  C: (q, G) => q(...G)
86385
86401
  });
@@ -86392,8 +86408,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86392
86408
  peerId: this.localPeerId,
86393
86409
  remoteId: this.id
86394
86410
  }, {
86395
- F: __dxlog_file3$1,
86396
- L: 197,
86411
+ F: __dxlog_file3,
86412
+ L: 196,
86397
86413
  S: this,
86398
86414
  C: (G, K) => G(...K)
86399
86415
  }), await I.abort(q), q;
@@ -86412,8 +86428,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86412
86428
  peerId: this.localPeerId,
86413
86429
  remoteId: this.id
86414
86430
  }, {
86415
- F: __dxlog_file3$1,
86416
- L: 210,
86431
+ F: __dxlog_file3,
86432
+ L: 209,
86417
86433
  S: this,
86418
86434
  C: (G, K) => G(...K)
86419
86435
  }), await I.abort(q), q;
@@ -86422,8 +86438,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86422
86438
  }
86423
86439
  try {
86424
86440
  log$2("opening connection as initiator", void 0, {
86425
- F: __dxlog_file3$1,
86426
- L: 223,
86441
+ F: __dxlog_file3,
86442
+ L: 222,
86427
86443
  S: this,
86428
86444
  C: (q, G) => q(...G)
86429
86445
  }), await I.openConnection(), this._callbacks.onAccepted();
@@ -86434,15 +86450,15 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86434
86450
  peerId: this.localPeerId,
86435
86451
  remoteId: this.id
86436
86452
  }, {
86437
- F: __dxlog_file3$1,
86438
- L: 227,
86453
+ F: __dxlog_file3,
86454
+ L: 226,
86439
86455
  S: this,
86440
86456
  C: (G, K) => G(...K)
86441
86457
  }), log$2.warn("closing connection due to unhandled error on openConnection", {
86442
86458
  err: q
86443
86459
  }, {
86444
- F: __dxlog_file3$1,
86445
- L: 234,
86460
+ F: __dxlog_file3,
86461
+ L: 233,
86446
86462
  S: this,
86447
86463
  C: (G, K) => G(...K)
86448
86464
  }), await this.closeConnection(q), q;
@@ -86463,13 +86479,13 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86463
86479
  initiator: $,
86464
86480
  sessionId: I
86465
86481
  }, {
86466
- F: __dxlog_file3$1,
86467
- L: 248,
86482
+ F: __dxlog_file3,
86483
+ L: 247,
86468
86484
  S: this,
86469
86485
  C: (G, K) => G(...K)
86470
86486
  }), invariant(!this.connection, "Already connected.", {
86471
- F: __dxlog_file3$1,
86472
- L: 255,
86487
+ F: __dxlog_file3,
86488
+ L: 254,
86473
86489
  S: this,
86474
86490
  A: [
86475
86491
  "!this.connection",
@@ -86500,8 +86516,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86500
86516
  sessionId: I,
86501
86517
  initiator: $
86502
86518
  }, {
86503
- F: __dxlog_file3$1,
86504
- L: 274,
86519
+ F: __dxlog_file3,
86520
+ L: 273,
86505
86521
  S: this,
86506
86522
  C: (G, K) => G(...K)
86507
86523
  });
@@ -86513,13 +86529,13 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86513
86529
  remoteId: this.id,
86514
86530
  initiator: $
86515
86531
  }, {
86516
- F: __dxlog_file3$1,
86517
- L: 283,
86532
+ F: __dxlog_file3,
86533
+ L: 282,
86518
86534
  S: this,
86519
86535
  C: (K, Y) => K(...Y)
86520
86536
  }), this._connectionLimiter.doneConnecting(I), invariant(this.connection === U, "Connection mismatch (race condition).", {
86521
- F: __dxlog_file3$1,
86522
- L: 288,
86537
+ F: __dxlog_file3,
86538
+ L: 287,
86523
86539
  S: this,
86524
86540
  A: [
86525
86541
  "this.connection === connection",
@@ -86532,8 +86548,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86532
86548
  sessionId: I,
86533
86549
  initiator: $
86534
86550
  }, {
86535
- F: __dxlog_file3$1,
86536
- L: 290,
86551
+ F: __dxlog_file3,
86552
+ L: 289,
86537
86553
  S: this,
86538
86554
  C: (K, Y) => K(...Y)
86539
86555
  }), 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 +86566,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86550
86566
  initiator: $,
86551
86567
  err: G
86552
86568
  }, {
86553
- F: __dxlog_file3$1,
86554
- L: 330,
86569
+ F: __dxlog_file3,
86570
+ L: 329,
86555
86571
  S: this,
86556
86572
  C: (K, Y) => K(...Y)
86557
86573
  }), log$2.trace("dxos.mesh.connection.error", {
@@ -86562,8 +86578,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86562
86578
  initiator: $,
86563
86579
  err: G
86564
86580
  }, {
86565
- F: __dxlog_file3$1,
86566
- L: 337,
86581
+ F: __dxlog_file3,
86582
+ L: 336,
86567
86583
  S: this,
86568
86584
  C: (K, Y) => K(...Y)
86569
86585
  }), this.closeConnection(G);
@@ -86577,16 +86593,16 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86577
86593
  peerId: this.id,
86578
86594
  sessionId: I.sessionId
86579
86595
  }, {
86580
- F: __dxlog_file3$1,
86581
- L: 362,
86596
+ F: __dxlog_file3,
86597
+ L: 361,
86582
86598
  S: this,
86583
86599
  C: (U, q) => U(...q)
86584
86600
  }), await I.close($), log$2("closed", {
86585
86601
  peerId: this.id,
86586
86602
  sessionId: I.sessionId
86587
86603
  }, {
86588
- F: __dxlog_file3$1,
86589
- L: 368,
86604
+ F: __dxlog_file3,
86605
+ L: 367,
86590
86606
  S: this,
86591
86607
  C: (U, q) => U(...q)
86592
86608
  });
@@ -86596,8 +86612,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86596
86612
  log$2("dropping signal message for non-existent connection", {
86597
86613
  message: $
86598
86614
  }, {
86599
- F: __dxlog_file3$1,
86600
- L: 373,
86615
+ F: __dxlog_file3,
86616
+ L: 372,
86601
86617
  S: this,
86602
86618
  C: (I, U) => I(...U)
86603
86619
  });
@@ -86611,8 +86627,8 @@ var __dxlog_file3$1 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-ma
86611
86627
  peerId: this.id,
86612
86628
  topic: this.topic
86613
86629
  }, {
86614
- F: __dxlog_file3$1,
86615
- L: 383,
86630
+ F: __dxlog_file3,
86631
+ L: 382,
86616
86632
  S: this,
86617
86633
  C: (U, q) => U(...q)
86618
86634
  }), await ((I = this == null ? void 0 : this.connection) == null ? void 0 : I.close($));
@@ -87040,88 +87056,88 @@ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-man
87040
87056
  }
87041
87057
  }), Qn, MemoryTransport = (Qn = class {
87042
87058
  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, {
87059
+ 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
87060
  F: __dxlog_file11,
87045
87061
  L: 64,
87046
87062
  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
87063
  A: [
87053
87064
  "!MemoryTransport._connections.has(this._instanceId)",
87054
87065
  "'Duplicate memory connection'"
87055
87066
  ]
87056
- }), Qn._connections.set(this._instanceId, this), this.options.initiator ? setTimeout(async () => {
87067
+ }), Qn._connections.set(this._instanceId, this);
87068
+ }
87069
+ get isOpen() {
87070
+ return !this._closed;
87071
+ }
87072
+ async open() {
87073
+ if (log$2("opening...", void 0, {
87074
+ F: __dxlog_file11,
87075
+ L: 74,
87076
+ S: this,
87077
+ C: (I, U) => I(...U)
87078
+ }), this._options.initiator) {
87057
87079
  log$2("sending signal", void 0, {
87058
87080
  F: __dxlog_file11,
87059
- L: 73,
87081
+ L: 78,
87060
87082
  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);
87083
+ C: (I, U) => I(...U)
87068
87084
  });
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();
87085
+ try {
87086
+ await this._options.sendSignal({
87087
+ payload: {
87088
+ transportId: this._instanceId.toHex()
87089
+ }
87090
+ });
87091
+ } catch (I) {
87092
+ this._closed || this.errors.raise(toError(I));
87091
87093
  }
87092
- }).catch((U) => {
87093
- this._destroyed || this.errors.raise(U);
87094
- });
87094
+ } else
87095
+ this._remote.wait({
87096
+ timeout: this._options.timeout ?? 1e3
87097
+ }).then((I) => {
87098
+ if (!this._closed) {
87099
+ if (this._remoteInstanceId = I, this._remoteConnection = Qn._connections.get(this._remoteInstanceId), !this._remoteConnection) {
87100
+ this._closed = !0, this.closed.emit();
87101
+ return;
87102
+ }
87103
+ invariant(!this._remoteConnection._remoteConnection, `Remote already connected: ${this._remoteInstanceId}`, {
87104
+ F: __dxlog_file11,
87105
+ L: 104,
87106
+ S: this,
87107
+ A: [
87108
+ "!this._remoteConnection._remoteConnection",
87109
+ "`Remote already connected: ${this._remoteInstanceId}`"
87110
+ ]
87111
+ }), this._remoteConnection._remoteConnection = this, this._remoteConnection._remoteInstanceId = this._instanceId, log$2("connected", void 0, {
87112
+ F: __dxlog_file11,
87113
+ L: 108,
87114
+ S: this,
87115
+ C: (U, q) => U(...q)
87116
+ }), 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();
87117
+ }
87118
+ }).catch((I) => {
87119
+ this._closed || this.errors.raise(I);
87120
+ });
87095
87121
  }
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, {
87122
+ async close() {
87123
+ log$2("closing...", void 0, {
87103
87124
  F: __dxlog_file11,
87104
87125
  L: 129,
87105
87126
  S: this,
87106
87127
  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, {
87128
+ }), 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
87129
  F: __dxlog_file11,
87114
- L: 154,
87130
+ L: 157,
87115
87131
  S: this,
87116
87132
  C: (I, U) => I(...U)
87117
87133
  });
87118
87134
  }
87119
- signal({ payload: I }) {
87135
+ async onSignal({ payload: I }) {
87120
87136
  if (log$2("received signal", {
87121
87137
  payload: I
87122
87138
  }, {
87123
87139
  F: __dxlog_file11,
87124
- L: 158,
87140
+ L: 161,
87125
87141
  S: this,
87126
87142
  C: (q, G) => q(...G)
87127
87143
  }), !(I != null && I.transportId))
@@ -87150,9 +87166,9 @@ _ts_decorate4$1([
87150
87166
  _ts_decorate4$1([
87151
87167
  logInfo
87152
87168
  ], MemoryTransport.prototype, "_remoteInstanceId", void 0);
87153
- var TransportKind;
87169
+ var toError = ($) => $ instanceof Error ? $ : new Error(String($)), TransportKind;
87154
87170
  (function($) {
87155
- $.SIMPLE_PEER = "SIMPLE_PEER", $.LIBDATACHANNEL = "LIBDATACHANNEL", $.SIMPLE_PEER_PROXY = "SIMPLE_PEER_PROXY", $.MEMORY = "MEMORY", $.TCP = "TCP";
87171
+ $.SIMPLE_PEER = "SIMPLE_PEER", $.SIMPLE_PEER_PROXY = "SIMPLE_PEER_PROXY", $.LIBDATACHANNEL = "LIBDATACHANNEL", $.MEMORY = "MEMORY", $.TCP = "TCP";
87156
87172
  })(TransportKind || (TransportKind = {}));
87157
87173
  var wrtc = null;
87158
87174
  try {
@@ -87170,115 +87186,146 @@ function _ts_decorate5$1($, I, U, q) {
87170
87186
  }
87171
87187
  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
87188
  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
- }
87189
+ 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();
87190
+ }
87191
+ get isOpen() {
87192
+ return !!this._peer && !this._closed;
87193
+ }
87194
+ async open() {
87195
+ this._closed && this.errors.raise(new Error("connection already closed"));
87196
+ const { RTCPeerConnection: I } = (await importESM("node-datachannel/polyfill")).default;
87197
+ this._options.webrtcConfig ? this._options.webrtcConfig.iceServers = this._options.webrtcConfig.iceServers ?? [] : this._options.webrtcConfig = {
87198
+ iceServers: []
87199
+ }, this._peer = new I(this._options.webrtcConfig), this._peer.onicecandidateerror = (U) => {
87200
+ log$2.error("peer.onicecandidateerror", {
87201
+ event: U
87202
+ }, {
87203
+ F: __dxlog_file15,
87204
+ L: 77,
87205
+ S: this,
87206
+ C: (q, G) => q(...G)
87207
+ });
87208
+ }, this._peer.onconnectionstatechange = (U) => {
87209
+ var q;
87210
+ log$2.debug("peer.onconnectionstatechange", {
87211
+ event: U,
87212
+ peerConnectionState: (q = this._peer) == null ? void 0 : q.connectionState,
87213
+ transportConnectionState: this._connected
87214
+ }, {
87215
+ F: __dxlog_file15,
87216
+ L: 81,
87217
+ S: this,
87218
+ C: (G, K) => G(...K)
87219
+ });
87220
+ }, this._peer.onicecandidate = async (U) => {
87221
+ if (log$2.debug("peer.onicecandidate", {
87222
+ event: U
87223
+ }, {
87224
+ F: __dxlog_file15,
87225
+ L: 91,
87226
+ S: this,
87227
+ C: (q, G) => q(...G)
87228
+ }), U.candidate)
87229
+ try {
87230
+ await this._options.sendSignal({
87231
+ payload: {
87232
+ data: {
87233
+ type: "candidate",
87234
+ candidate: {
87235
+ candidate: U.candidate.candidate,
87236
+ // These fields never seem to be not null, but connecting to Chrome doesn't work if they are.
87237
+ sdpMLineIndex: U.candidate.sdpMLineIndex ?? 0,
87238
+ sdpMid: U.candidate.sdpMid ?? 0
87219
87239
  }
87220
87240
  }
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
87241
+ }
87242
+ });
87243
+ } catch (q) {
87244
+ log$2.info("signaling error", {
87245
+ err: q
87243
87246
  }, {
87244
87247
  F: __dxlog_file15,
87245
- L: 109,
87248
+ L: 108,
87246
87249
  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, {
87250
+ C: (G, K) => G(...K)
87251
+ });
87252
+ }
87253
+ }, this._options.initiator ? (invariant(this._peer, "not open", {
87254
+ F: __dxlog_file15,
87255
+ L: 114,
87256
+ S: this,
87257
+ A: [
87258
+ "this._peer",
87259
+ "'not open'"
87260
+ ]
87261
+ }), this._peer.createOffer().then(async (U) => {
87262
+ var q;
87263
+ this._closed || (((q = this._peer) == null ? void 0 : q.connectionState) !== "connecting" && (log$2.error("peer not connecting", {
87264
+ peer: this._peer
87265
+ }, {
87259
87266
  F: __dxlog_file15,
87260
- L: 118,
87267
+ L: 125,
87261
87268
  S: this,
87262
87269
  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
- })();
87270
+ }), this.errors.raise(new Error("invalid state: peer is initiator, but other peer not in state connecting"))), log$2.debug("creating offer", {
87271
+ peer: this._peer,
87272
+ offer: U
87273
+ }, {
87274
+ F: __dxlog_file15,
87275
+ L: 129,
87276
+ S: this,
87277
+ C: (G, K) => G(...K)
87278
+ }), await this._peer.setLocalDescription(U), await this._options.sendSignal({
87279
+ payload: {
87280
+ data: {
87281
+ type: U.type,
87282
+ sdp: U.sdp
87283
+ }
87284
+ }
87285
+ }));
87286
+ }).catch((U) => {
87287
+ this.errors.raise(U);
87288
+ }), this._handleChannel(this._peer.createDataChannel(DATACHANNEL_LABEL)), log$2.debug("created data channel", void 0, {
87289
+ F: __dxlog_file15,
87290
+ L: 139,
87291
+ S: this,
87292
+ C: (U, q) => U(...q)
87293
+ }), this._peer.ondatachannel = () => {
87294
+ this.errors.raise(new Error("unexpected ondatachannel event for initiator"));
87295
+ }) : this._peer.ondatachannel = (U) => {
87296
+ log$2.debug("peer.ondatachannel (non-initiator)", {
87297
+ event: U
87298
+ }, {
87299
+ F: __dxlog_file15,
87300
+ L: 145,
87301
+ S: this,
87302
+ C: (q, G) => q(...G)
87303
+ }), U.channel.label !== DATACHANNEL_LABEL && this.errors.raise(new Error(`unexpected channel label ${U.channel.label}`)), this._handleChannel(U.channel);
87304
+ }, or._instanceCount++;
87305
+ }
87306
+ async close() {
87307
+ await this._close(), --or._instanceCount === 0 && (await importESM("node-datachannel")).cleanup();
87308
+ }
87309
+ async _close() {
87310
+ var I;
87311
+ if (!this._closed) {
87312
+ await this._disconnectStreams();
87313
+ try {
87314
+ (I = this._peer) == null || I.close();
87315
+ } catch (U) {
87316
+ this.errors.raise(U);
87317
+ }
87318
+ this._peer = void 0, this._closed = !0, this.closed.emit();
87319
+ }
87276
87320
  }
87277
- handleChannel(I) {
87321
+ /**
87322
+ * Handle data channel events.
87323
+ */
87324
+ _handleChannel(I) {
87278
87325
  this._channel = I, this._channel.onopen = () => {
87279
- log$2.debug("dataChannel.onopen", void 0, {
87326
+ log$2.debug("channel.onopen", void 0, {
87280
87327
  F: __dxlog_file15,
87281
- L: 140,
87328
+ L: 190,
87282
87329
  S: this,
87283
87330
  C: (q, G) => q(...G)
87284
87331
  });
@@ -87292,146 +87339,131 @@ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-man
87292
87339
  } catch (Y) {
87293
87340
  this.errors.raise(Y), await this._close();
87294
87341
  }
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, {
87342
+ 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
87343
  F: __dxlog_file15,
87297
- L: 157,
87344
+ L: 207,
87298
87345
  S: this,
87299
87346
  C: (Y, J) => Y(...J)
87300
87347
  }), this._writeCallback = K) : K();
87301
87348
  }
87302
87349
  });
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();
87350
+ U.pipe(this._options.stream).pipe(U), this._stream = U, this._connected = !0, this.connected.emit();
87306
87351
  }, this._channel.onclose = async (U) => {
87307
- log$2.info("channel onclose", {
87352
+ log$2.info("channel.onclose", {
87308
87353
  err: U
87309
87354
  }, {
87310
87355
  F: __dxlog_file15,
87311
- L: 177,
87356
+ L: 223,
87312
87357
  S: this,
87313
87358
  C: (q, G) => q(...G)
87314
87359
  }), 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);
87360
+ }, this._channel.onerror = async (U) => {
87361
+ this.errors.raise(new Error("channel error: " + U.toString())), await this._close();
87318
87362
  }, this._channel.onbufferedamountlow = () => {
87319
87363
  const U = this._writeCallback;
87320
87364
  this._writeCallback = null, U == null || U();
87365
+ }, this._channel.onmessage = (U) => {
87366
+ let q = U.data;
87367
+ q instanceof ArrayBuffer && (q = export_Buffer.from(q)), this._stream.push(q);
87321
87368
  };
87322
87369
  }
87323
- async _close() {
87324
- if (this._closed)
87325
- return;
87326
- await this._disconnectStreams();
87327
- const I = await this._peer;
87370
+ async onSignal(I) {
87371
+ invariant(this._peer, "not open", {
87372
+ F: __dxlog_file15,
87373
+ L: 249,
87374
+ S: this,
87375
+ A: [
87376
+ "this._peer",
87377
+ "'not open'"
87378
+ ]
87379
+ });
87328
87380
  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) {
87381
+ const U = I.payload.data;
87382
+ switch (U.type) {
87339
87383
  case "offer": {
87340
- if ((await this._peer).connectionState !== "new") {
87384
+ if (this._peer.connectionState !== "new") {
87341
87385
  log$2.error("received offer but peer not in state new", {
87342
- peer: U
87386
+ peer: this._peer
87343
87387
  }, {
87344
87388
  F: __dxlog_file15,
87345
- L: 218,
87389
+ L: 256,
87346
87390
  S: this,
87347
- C: (G, K) => G(...K)
87391
+ C: (q, G) => q(...G)
87348
87392
  }), this.errors.raise(new Error("invalid signalling state: received offer when peer is not in state new"));
87349
87393
  break;
87350
87394
  }
87351
87395
  try {
87352
- await U.setRemoteDescription({
87353
- type: q.type,
87354
- sdp: q.sdp
87396
+ await this._peer.setRemoteDescription({
87397
+ type: U.type,
87398
+ sdp: U.sdp
87355
87399
  });
87356
- const G = await U.createAnswer();
87357
- await U.setLocalDescription(G), await this.params.sendSignal({
87400
+ const q = await this._peer.createAnswer();
87401
+ await this._peer.setLocalDescription(q), await this._options.sendSignal({
87358
87402
  payload: {
87359
87403
  data: {
87360
- type: G.type,
87361
- sdp: G.sdp
87404
+ type: q.type,
87405
+ sdp: q.sdp
87362
87406
  }
87363
87407
  }
87364
87408
  }), this._readyForCandidates.wake();
87365
- } catch (G) {
87366
- log$2.error("can't handle offer from signalling server", {
87367
- err: G
87409
+ } catch (q) {
87410
+ log$2.error("cannot handle offer from signalling server", {
87411
+ err: q
87368
87412
  }, {
87369
87413
  F: __dxlog_file15,
87370
- L: 229,
87414
+ L: 268,
87371
87415
  S: this,
87372
- C: (K, Y) => K(...Y)
87416
+ C: (G, K) => G(...K)
87373
87417
  }), this.errors.raise(new Error("error handling offer"));
87374
87418
  }
87375
87419
  break;
87376
87420
  }
87377
87421
  case "answer":
87378
87422
  try {
87379
- await U.setRemoteDescription({
87380
- type: q.type,
87381
- sdp: q.sdp
87423
+ await this._peer.setRemoteDescription({
87424
+ type: U.type,
87425
+ sdp: U.sdp
87382
87426
  }), this._readyForCandidates.wake();
87383
- } catch (G) {
87384
- log$2.error("can't handle answer from signalling server", {
87385
- err: G
87427
+ } catch (q) {
87428
+ log$2.error("cannot handle answer from signalling server", {
87429
+ err: q
87386
87430
  }, {
87387
87431
  F: __dxlog_file15,
87388
- L: 240,
87432
+ L: 279,
87389
87433
  S: this,
87390
- C: (K, Y) => K(...Y)
87434
+ C: (G, K) => G(...K)
87391
87435
  }), this.errors.raise(new Error("error handling answer"));
87392
87436
  }
87393
87437
  break;
87394
87438
  case "candidate":
87395
- await this._readyForCandidates.wait(), await U.addIceCandidate({
87396
- candidate: q.candidate.candidate
87439
+ await this._readyForCandidates.wait(), await this._peer.addIceCandidate({
87440
+ candidate: U.candidate.candidate
87397
87441
  });
87398
87442
  break;
87399
87443
  default:
87400
87444
  log$2.error("unhandled signal type", {
87401
- type: q.type,
87445
+ type: U.type,
87402
87446
  signal: I
87403
87447
  }, {
87404
87448
  F: __dxlog_file15,
87405
- L: 251,
87449
+ L: 290,
87406
87450
  S: this,
87407
- C: (G, K) => G(...K)
87408
- }), this.errors.raise(new Error(`unhandled signal type ${q.type}`));
87451
+ C: (q, G) => q(...G)
87452
+ }), this.errors.raise(new Error(`unhandled signal type ${U.type}`));
87409
87453
  }
87410
- }).catch((U) => {
87454
+ } catch (U) {
87411
87455
  log$2.catch(U, void 0, {
87412
87456
  F: __dxlog_file15,
87413
- L: 256,
87457
+ L: 294,
87414
87458
  S: this,
87415
87459
  C: (q, G) => q(...G)
87416
87460
  });
87417
- });
87461
+ }
87418
87462
  }
87419
87463
  async getDetails() {
87420
87464
  const I = await this._getStats(), U = I == null ? void 0 : I.remoteCandidate;
87421
87465
  return U ? U.candidateType === "relay" ? `${U.ip}:${U.port} relay for ${U.relatedAddress}:${U.relatedPort}` : `${U.ip}:${U.port} ${U.candidateType}` : "unavailable";
87422
87466
  }
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
87467
  async getStats() {
87436
87468
  const I = await this._getStats();
87437
87469
  return I ? {
@@ -87448,12 +87480,28 @@ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-man
87448
87480
  rawStats: {}
87449
87481
  };
87450
87482
  }
87451
- async destroy() {
87452
- await this._close(), --or._instanceCount === 0 && (await importESM("node-datachannel")).cleanup();
87483
+ async _getStats() {
87484
+ invariant(this._peer, "not open", {
87485
+ F: __dxlog_file15,
87486
+ L: 334,
87487
+ S: this,
87488
+ A: [
87489
+ "this._peer",
87490
+ "'not open'"
87491
+ ]
87492
+ });
87493
+ 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);
87494
+ let K, Y;
87495
+ return G.length > 0 && (K = G[0][1], Y = U.filter((J) => J[0] === K.remoteCandidateId)[0][1]), {
87496
+ transport: q,
87497
+ selectedCandidatePair: K,
87498
+ remoteCandidate: Y,
87499
+ raw: Object.fromEntries(I)
87500
+ };
87453
87501
  }
87454
87502
  async _disconnectStreams() {
87455
87503
  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);
87504
+ (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
87505
  }
87458
87506
  }, or._instanceCount = 0, or);
87459
87507
  _ts_decorate5$1([
@@ -88710,12 +88758,14 @@ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services
88710
88758
  return this._client.rpc;
88711
88759
  }
88712
88760
  async open() {
88713
- const { WebsocketRpcClient: $ } = await import("./index-BiLYqmR3.mjs");
88761
+ const { WebsocketRpcClient: $ } = await import("./index-B5NRHaY9.mjs");
88714
88762
  this._client = new $({
88715
88763
  url: getUnixSocket(this._profile, "ws+unix"),
88716
88764
  requested: clientServiceBundle,
88717
88765
  exposed: {},
88718
88766
  handlers: {}
88767
+ }), this._client.error.on((I) => {
88768
+ this.closed.emit(I);
88719
88769
  }), await this._client.open();
88720
88770
  }
88721
88771
  async close() {
@@ -88725,7 +88775,7 @@ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services
88725
88775
  } catch (I) {
88726
88776
  log$2.warn("Failed to close", I, {
88727
88777
  F: __dxlog_file,
88728
- L: 69,
88778
+ L: 72,
88729
88779
  S: this,
88730
88780
  C: (U, q) => U(...q)
88731
88781
  });
@@ -88830,7 +88880,7 @@ var IFrameManager = class {
88830
88880
  var I;
88831
88881
  (I = this._onMessage) == null || I.call(this, $);
88832
88882
  }
88833
- }, __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/shell-manager.ts", shellStyles = Object.entries({
88883
+ }, __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/shell-manager.ts", shellStyles = Object.entries({
88834
88884
  display: "none",
88835
88885
  position: "fixed",
88836
88886
  top: 0,
@@ -88850,13 +88900,15 @@ var IFrameManager = class {
88850
88900
  async setLayout($) {
88851
88901
  var I;
88852
88902
  log$2("set layout", $, {
88853
- F: __dxlog_file3,
88854
- L: 50,
88903
+ F: __dxlog_file4,
88904
+ L: 51,
88855
88905
  S: this,
88856
88906
  C: (U, q) => U(...q)
88857
88907
  }), this._display = ShellDisplay.FULLSCREEN, this.contextUpdate.emit({
88858
88908
  display: this._display
88859
- }), await ((I = this._shellRpc) == null ? void 0 : I.rpc.ShellService.setLayout($));
88909
+ }), await ((I = this._shellRpc) == null ? void 0 : I.rpc.ShellService.setLayout($, {
88910
+ timeout: RPC_TIMEOUT
88911
+ }));
88860
88912
  }
88861
88913
  async open() {
88862
88914
  if (this._shellRpc)
@@ -88878,8 +88930,8 @@ var IFrameManager = class {
88878
88930
  AppService: {
88879
88931
  setContext: async (q) => {
88880
88932
  log$2("set context", q, {
88881
- F: __dxlog_file3,
88882
- L: 97,
88933
+ F: __dxlog_file4,
88934
+ L: 98,
88883
88935
  S: this,
88884
88936
  C: (G, K) => G(...K)
88885
88937
  }), q.display && (this._display = q.display), this.contextUpdate.emit(q);
@@ -88971,13 +89023,13 @@ function _ts_decorate4($, I, U, q) {
88971
89023
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
88972
89024
  return G > 3 && K && Object.defineProperty(I, U, K), K;
88973
89025
  }
88974
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/service-proxy.ts", ClientServicesProxy = class {
89026
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/service-proxy.ts", ClientServicesProxy = class {
88975
89027
  constructor($, I = 3e4) {
88976
89028
  this._port = $, this._timeout = I, this.closed = new Event$1();
88977
89029
  }
88978
89030
  get proxy() {
88979
89031
  return invariant(this._proxy, "Client services not open", {
88980
- F: __dxlog_file4,
89032
+ F: __dxlog_file5,
88981
89033
  L: 30,
88982
89034
  S: this,
88983
89035
  A: [
@@ -88991,7 +89043,7 @@ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
88991
89043
  }
88992
89044
  get services() {
88993
89045
  return invariant(this._proxy, "Client services not open", {
88994
- F: __dxlog_file4,
89046
+ F: __dxlog_file5,
88995
89047
  L: 39,
88996
89048
  S: this,
88997
89049
  A: [
@@ -89028,7 +89080,7 @@ function _ts_decorate5($, I, U, q) {
89028
89080
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
89029
89081
  return G > 3 && K && Object.defineProperty(I, U, K), K;
89030
89082
  }
89031
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/iframe-service-proxy.ts", IFrameClientServicesProxy = class {
89083
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/iframe-service-proxy.ts", IFrameClientServicesProxy = class {
89032
89084
  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
89085
  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
89086
  const K = new Trigger(), Y = new Trigger();
@@ -89067,42 +89119,44 @@ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89067
89119
  this._clientServicesProxy || (log$2.trace("dxos.sdk.iframe-clientTraceices-proxy", trace$1.begin({
89068
89120
  id: this._instanceId
89069
89121
  }), {
89070
- F: __dxlog_file5,
89071
- L: 141,
89122
+ F: __dxlog_file6,
89123
+ L: 142,
89072
89124
  S: this,
89073
89125
  C: (I, U) => I(...U)
89074
89126
  }), await this._iframeManager.open(), this._clientServicesProxy = new ClientServicesProxy(this._appPort), await this._clientServicesProxy.open(), this._loggingStream = this._clientServicesProxy.services.LoggingService.queryLogs({
89075
89127
  filters: this._logFilter
89128
+ }, {
89129
+ timeout: RPC_TIMEOUT
89076
89130
  }), this._loggingStream.subscribe((I) => {
89077
89131
  switch (I.level) {
89078
89132
  case LogLevel.DEBUG:
89079
89133
  log$2.debug(`[vault] ${I.message}`, I.context, {
89080
- F: __dxlog_file5,
89081
- L: 153,
89134
+ F: __dxlog_file6,
89135
+ L: 157,
89082
89136
  S: this,
89083
89137
  C: (U, q) => U(...q)
89084
89138
  });
89085
89139
  break;
89086
89140
  case LogLevel.INFO:
89087
89141
  log$2.info(`[vault] ${I.message}`, I.context, {
89088
- F: __dxlog_file5,
89089
- L: 156,
89142
+ F: __dxlog_file6,
89143
+ L: 160,
89090
89144
  S: this,
89091
89145
  C: (U, q) => U(...q)
89092
89146
  });
89093
89147
  break;
89094
89148
  case LogLevel.WARN:
89095
89149
  log$2.warn(`[vault] ${I.message}`, I.context, {
89096
- F: __dxlog_file5,
89097
- L: 159,
89150
+ F: __dxlog_file6,
89151
+ L: 163,
89098
89152
  S: this,
89099
89153
  C: (U, q) => U(...q)
89100
89154
  });
89101
89155
  break;
89102
89156
  case LogLevel.ERROR:
89103
89157
  log$2.error(`[vault] ${I.message}`, I.context, {
89104
- F: __dxlog_file5,
89105
- L: 162,
89158
+ F: __dxlog_file6,
89159
+ L: 166,
89106
89160
  S: this,
89107
89161
  C: (U, q) => U(...q)
89108
89162
  });
@@ -89115,8 +89169,8 @@ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89115
89169
  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
89170
  id: this._instanceId
89117
89171
  }), {
89118
- F: __dxlog_file5,
89119
- L: 176,
89172
+ F: __dxlog_file6,
89173
+ L: 180,
89120
89174
  S: this,
89121
89175
  C: (q, G) => q(...G)
89122
89176
  });
@@ -89134,7 +89188,7 @@ function _ts_decorate6($, I, U, q) {
89134
89188
  (Y = $[J]) && (K = (G < 3 ? Y(K) : G > 3 ? Y(I, U, K) : Y(I, U)) || K);
89135
89189
  return G > 3 && K && Object.defineProperty(I, U, K), K;
89136
89190
  }
89137
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/worker-client-services.ts", WorkerClientServices = class {
89191
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/services/worker-client-services.ts", WorkerClientServices = class {
89138
89192
  constructor({ config: $, createWorker: I, logFilter: U = "error,warn", observabilityGroup: q, signalTelemetryEnabled: G }) {
89139
89193
  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
89194
  }
@@ -89151,8 +89205,8 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89151
89205
  if (this._isOpen)
89152
89206
  return;
89153
89207
  log$2("opening...", void 0, {
89154
- F: __dxlog_file7,
89155
- L: 87,
89208
+ F: __dxlog_file8,
89209
+ L: 88,
89156
89210
  S: this,
89157
89211
  C: (K, Y) => K(...Y)
89158
89212
  });
@@ -89177,13 +89231,15 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89177
89231
  port: G
89178
89232
  })), await this._services.open(), navigator.locks.request(LOCK_KEY, () => {
89179
89233
  log$2("terminated", void 0, {
89180
- F: __dxlog_file7,
89181
- L: 114,
89234
+ F: __dxlog_file8,
89235
+ L: 115,
89182
89236
  S: this,
89183
89237
  C: (K, Y) => K(...Y)
89184
89238
  }), this._isOpen && this.closed.emit(new Error("Shared worker terminated."));
89185
89239
  }), this._loggingStream = this._services.services.LoggingService.queryLogs({
89186
89240
  filters: this._logFilter
89241
+ }, {
89242
+ timeout: RPC_TIMEOUT
89187
89243
  }), this._loggingStream.subscribe((K) => {
89188
89244
  switch (K.level) {
89189
89245
  case LogLevel.DEBUG:
@@ -89200,8 +89256,8 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89200
89256
  break;
89201
89257
  }
89202
89258
  }), log$2("opened", void 0, {
89203
- F: __dxlog_file7,
89204
- L: 140,
89259
+ F: __dxlog_file8,
89260
+ L: 144,
89205
89261
  S: this,
89206
89262
  C: (K, Y) => K(...Y)
89207
89263
  }), this._isOpen = !0;
@@ -89209,13 +89265,13 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client/src/service
89209
89265
  async close() {
89210
89266
  var $;
89211
89267
  this._isOpen && (log$2("closing...", void 0, {
89212
- F: __dxlog_file7,
89213
- L: 150,
89268
+ F: __dxlog_file8,
89269
+ L: 154,
89214
89270
  S: this,
89215
89271
  C: (I, U) => I(...U)
89216
89272
  }), 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,
89273
+ F: __dxlog_file8,
89274
+ L: 159,
89219
89275
  S: this,
89220
89276
  C: (I, U) => I(...U)
89221
89277
  }), this._isOpen = !1);
@@ -89591,11 +89647,8 @@ function requireUseSyncExternalStoreShim_development() {
89591
89647
  useSyncExternalStoreShim_development.useSyncExternalStore = ce, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
89592
89648
  }()), useSyncExternalStoreShim_development;
89593
89649
  }
89594
- var hasRequiredShim;
89595
- function requireShim() {
89596
- return hasRequiredShim || (hasRequiredShim = 1, process.env.NODE_ENV === "production" ? shim.exports = requireUseSyncExternalStoreShim_production_min() : shim.exports = requireUseSyncExternalStoreShim_development()), shim.exports;
89597
- }
89598
- var shimExports = requireShim(), jsxDevRuntime = { exports: {} }, reactJsxDevRuntime_production_min = {};
89650
+ process.env.NODE_ENV === "production" ? shim.exports = requireUseSyncExternalStoreShim_production_min() : shim.exports = requireUseSyncExternalStoreShim_development();
89651
+ var shimExports = shim.exports, jsxDevRuntime = { exports: {} }, reactJsxDevRuntime_production_min = {};
89599
89652
  /**
89600
89653
  * @license React
89601
89654
  * react-jsx-dev-runtime.production.min.js
@@ -90325,12 +90378,17 @@ Object.defineProperties(u.prototype, { $$typeof: { configurable: !0, value: h },
90325
90378
  var ClientContext = /* @__PURE__ */ createContext(void 0), useClient = () => {
90326
90379
  const { client: $ } = useContext(ClientContext) ?? raise$2(new Error("Missing ClientContext."));
90327
90380
  return $;
90381
+ }, useMulticastObservable = ($) => {
90382
+ const I = useMemo(() => (U) => {
90383
+ const q = $.subscribe(U);
90384
+ return () => q.unsubscribe();
90385
+ }, [
90386
+ $
90387
+ ]);
90388
+ return useSyncExternalStore(I, () => $.get());
90328
90389
  }, useNetworkStatus = () => {
90329
90390
  const $ = useClient();
90330
- return useSyncExternalStore((U) => {
90331
- const q = $.mesh.networkStatus.subscribe(U);
90332
- return () => q.unsubscribe();
90333
- }, () => $.mesh.networkStatus.get());
90391
+ return useMulticastObservable($.mesh.networkStatus);
90334
90392
  }, withSelector = { exports: {} }, withSelector_production_min = {};
90335
90393
  /**
90336
90394
  * @license React
@@ -90346,7 +90404,7 @@ function requireWithSelector_production_min() {
90346
90404
  if (hasRequiredWithSelector_production_min)
90347
90405
  return withSelector_production_min;
90348
90406
  hasRequiredWithSelector_production_min = 1;
90349
- var $ = React__default, I = requireShim();
90407
+ var $ = React__default, I = shimExports;
90350
90408
  function U(Q, ee) {
90351
90409
  return Q === ee && (Q !== 0 || 1 / Q === 1 / ee) || Q !== Q && ee !== ee;
90352
90410
  }
@@ -90400,7 +90458,7 @@ var hasRequiredWithSelector_development;
90400
90458
  function requireWithSelector_development() {
90401
90459
  return hasRequiredWithSelector_development || (hasRequiredWithSelector_development = 1, process.env.NODE_ENV !== "production" && function() {
90402
90460
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
90403
- var $ = React__default, I = requireShim();
90461
+ var $ = React__default, I = shimExports;
90404
90462
  function U(ee, te) {
90405
90463
  return ee === te && (ee !== 0 || 1 / ee === 1 / te) || ee !== ee && te !== te;
90406
90464
  }
@@ -93631,7 +93689,11 @@ const identityMachine = createMachine(
93631
93689
  }
93632
93690
  }, []);
93633
93691
  return { onAgentCreate: async () => {
93634
- I.forEach((ae) => ae.cancel()), $.halo.share({ type: Invitation.Type.MULTIUSE, authMethod: Invitation.AuthMethod.NONE }).subscribe(ee);
93692
+ I.forEach((ae) => ae.cancel()), $.halo.share({
93693
+ type: Invitation.Type.INTERACTIVE,
93694
+ authMethod: Invitation.AuthMethod.NONE,
93695
+ multiUse: !0
93696
+ }).subscribe(ee);
93635
93697
  }, onAgentDestroy: async () => {
93636
93698
  const re = $.halo.identity.get();
93637
93699
  invariant(re, "Identity not found");
@@ -94821,11 +94883,11 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
94821
94883
  active: I,
94822
94884
  send: U,
94823
94885
  status: q,
94824
- type: G,
94886
+ multiUse: G,
94825
94887
  authCode: K,
94826
94888
  id: Y = "0"
94827
94889
  }) => {
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(() => {
94890
+ 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
94891
  switch (!0) {
94830
94892
  case Q === 5:
94831
94893
  case Q < 0:
@@ -94836,7 +94898,7 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
94836
94898
  return "showing qr";
94837
94899
  }
94838
94900
  }, [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(
94901
+ 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
94902
  QR,
94841
94903
  {
94842
94904
  rounding: 100,
@@ -95967,7 +96029,7 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
95967
96029
  Space: re.context.space.unredeemedCode
95968
96030
  }),
95969
96031
  [re]
95970
- ), ue = useMulticastObservable(Q.spaces), he = useMemo(
96032
+ ), ue = useMulticastObservable$1(Q.spaces), he = useMemo(
95971
96033
  () => ({
95972
96034
  Space: ue ? new Set(ue.map(({ key: Ce }) => Ce.toHex())) : void 0
95973
96035
  }),
@@ -96096,6 +96158,7 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
96096
96158
  const Z = (Q = I.share) == null ? void 0 : Q.call(I, {
96097
96159
  type: Invitation.Type.INTERACTIVE,
96098
96160
  authMethod: Invitation.AuthMethod.SHARED_SECRET,
96161
+ multiUse: !1,
96099
96162
  target: U
96100
96163
  });
96101
96164
  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 +96171,9 @@ const invitationStatusValue = /* @__PURE__ */ new Map([
96108
96171
  onClick: useCallback(() => {
96109
96172
  var Q, ee, te, ne;
96110
96173
  const Z = (Q = I.share) == null ? void 0 : Q.call(I, {
96111
- type: Invitation.Type.MULTIUSE,
96174
+ type: Invitation.Type.INTERACTIVE,
96112
96175
  authMethod: Invitation.AuthMethod.NONE,
96176
+ multiUse: !0,
96113
96177
  target: U
96114
96178
  });
96115
96179
  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 +96607,11 @@ createContext({});
96543
96607
  export {
96544
96608
  Event$1 as E,
96545
96609
  Trigger as T,
96546
- WebSocket2 as W,
96610
+ WebSocket3 as W,
96547
96611
  logInfo as a,
96548
96612
  createProtoRpcPeer as c,
96549
96613
  export_Buffer as e,
96550
96614
  log$2 as l,
96551
96615
  runShell as r
96552
96616
  };
96553
- //# sourceMappingURL=index-CVZAWw41.mjs.map
96617
+ //# sourceMappingURL=index-CB-lG23j.mjs.map