@almadar/ui 6.27.0 → 6.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode } from 'react';
3
- import { ResolvedEntity, EventPayload, EntityRow, OrbitalSchema, BusEventSource, SExpr, ResolvedTrait, ResolvedTraitBinding, TraitConfig } from '@almadar/core';
3
+ import { ResolvedEntity, EventPayload, EntityRow, UserContext, OrbitalSchema, BusEventSource, SExpr, ResolvedTrait, ResolvedTraitBinding, TraitConfig } from '@almadar/core';
4
4
  import { AnyPatternConfig } from '@almadar/core/patterns';
5
5
  import { ServerEffectResult, TransitionResult } from '@almadar/runtime';
6
6
 
@@ -102,6 +102,17 @@ interface OrbitalEventResponse {
102
102
  source?: BusEventSource;
103
103
  }>;
104
104
  data?: Record<string, EntityRow[]>;
105
+ /**
106
+ * The entity row each trait's effects left behind THIS request, keyed by
107
+ * trait name (Fix C, the stateless entity round-trip). The stateless
108
+ * deployment holds no server-side memory across requests — a `set`-only
109
+ * field a trait wrote here would otherwise vanish on the client's next
110
+ * request, since `entityByTrait` in the REQUEST only ever reflects the
111
+ * client's own prior local writes. Undefined on a server that doesn't
112
+ * send it (older servers, the stateful path) — the client simply keeps
113
+ * behaving as it always has.
114
+ */
115
+ entityByTrait?: Record<string, EntityRow>;
105
116
  clientEffects?: ClientEffectTuple[];
106
117
  /**
107
118
  * Same effects as `clientEffects`, paired with the trait that produced
@@ -151,6 +162,8 @@ interface ServerResponseMeta {
151
162
  dataEntities: Record<string, number>;
152
163
  /** Raw entity data from server response (for EntityStore advancement) */
153
164
  data?: Record<string, EntityRow[]>;
165
+ /** See `OrbitalEventResponse.entityByTrait`'s doc. */
166
+ entityByTrait?: Record<string, EntityRow>;
154
167
  emittedEvents: string[];
155
168
  /** Server-side effect outcomes — see `OrbitalEventResponse.effectResults`. */
156
169
  effectResults?: ServerEffectResult[];
@@ -169,7 +182,18 @@ interface ServerBridgeContextValue {
169
182
  result: TransitionResult;
170
183
  }>,
171
184
  /** Part G: the client's own current entity snapshot per trait. */
172
- entityByTrait?: Readonly<Record<string, EntityRow>>) => Promise<SendEventResult>;
185
+ entityByTrait?: Readonly<Record<string, EntityRow>>,
186
+ /**
187
+ * The current viewer (persona), for `@user.X` guard/effect bindings.
188
+ * The persona-switcher's picked viewer never used to reach server-side
189
+ * effects on the stateless path — it only ever drove client-side guard
190
+ * evaluation — so a `fetch`/`persist` comparing against `@user.id`
191
+ * (e.g. a chat channel's `member == @user.id` scope filter, a profile
192
+ * page's self-lookup) always compared against `undefined` (confirmed
193
+ * 2026-09-17). `undefined` here sends the request unauthenticated,
194
+ * exactly as before this field existed.
195
+ */
196
+ user?: UserContext) => Promise<SendEventResult>;
173
197
  }
174
198
  /**
175
199
  * Transport adapter for ServerBridgeProvider. Decouples the bridge's
@@ -213,7 +237,9 @@ interface ServerBridgeTransport {
213
237
  * misrouted to the standalone `std-project-manager` orbital of the
214
238
  * same name). An unmodified server ignores the extra field.
215
239
  */
216
- behaviorHint?: string) => Promise<OrbitalEventResponse>;
240
+ behaviorHint?: string,
241
+ /** See `ServerBridgeContextValue.sendEvent`'s `user` param. */
242
+ user?: UserContext) => Promise<OrbitalEventResponse>;
217
243
  }
218
244
  /**
219
245
  * Supplies the bearer token the hosting server authenticates with. Resolved
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode } from 'react';
3
- import { ResolvedEntity, EventPayload, EntityRow, OrbitalSchema, BusEventSource, SExpr, ResolvedTrait, ResolvedTraitBinding, TraitConfig } from '@almadar/core';
3
+ import { ResolvedEntity, EventPayload, EntityRow, UserContext, OrbitalSchema, BusEventSource, SExpr, ResolvedTrait, ResolvedTraitBinding, TraitConfig } from '@almadar/core';
4
4
  import { AnyPatternConfig } from '@almadar/core/patterns';
5
5
  import { ServerEffectResult, TransitionResult } from '@almadar/runtime';
6
6
 
@@ -102,6 +102,17 @@ interface OrbitalEventResponse {
102
102
  source?: BusEventSource;
103
103
  }>;
104
104
  data?: Record<string, EntityRow[]>;
105
+ /**
106
+ * The entity row each trait's effects left behind THIS request, keyed by
107
+ * trait name (Fix C, the stateless entity round-trip). The stateless
108
+ * deployment holds no server-side memory across requests — a `set`-only
109
+ * field a trait wrote here would otherwise vanish on the client's next
110
+ * request, since `entityByTrait` in the REQUEST only ever reflects the
111
+ * client's own prior local writes. Undefined on a server that doesn't
112
+ * send it (older servers, the stateful path) — the client simply keeps
113
+ * behaving as it always has.
114
+ */
115
+ entityByTrait?: Record<string, EntityRow>;
105
116
  clientEffects?: ClientEffectTuple[];
106
117
  /**
107
118
  * Same effects as `clientEffects`, paired with the trait that produced
@@ -151,6 +162,8 @@ interface ServerResponseMeta {
151
162
  dataEntities: Record<string, number>;
152
163
  /** Raw entity data from server response (for EntityStore advancement) */
153
164
  data?: Record<string, EntityRow[]>;
165
+ /** See `OrbitalEventResponse.entityByTrait`'s doc. */
166
+ entityByTrait?: Record<string, EntityRow>;
154
167
  emittedEvents: string[];
155
168
  /** Server-side effect outcomes — see `OrbitalEventResponse.effectResults`. */
156
169
  effectResults?: ServerEffectResult[];
@@ -169,7 +182,18 @@ interface ServerBridgeContextValue {
169
182
  result: TransitionResult;
170
183
  }>,
171
184
  /** Part G: the client's own current entity snapshot per trait. */
172
- entityByTrait?: Readonly<Record<string, EntityRow>>) => Promise<SendEventResult>;
185
+ entityByTrait?: Readonly<Record<string, EntityRow>>,
186
+ /**
187
+ * The current viewer (persona), for `@user.X` guard/effect bindings.
188
+ * The persona-switcher's picked viewer never used to reach server-side
189
+ * effects on the stateless path — it only ever drove client-side guard
190
+ * evaluation — so a `fetch`/`persist` comparing against `@user.id`
191
+ * (e.g. a chat channel's `member == @user.id` scope filter, a profile
192
+ * page's self-lookup) always compared against `undefined` (confirmed
193
+ * 2026-09-17). `undefined` here sends the request unauthenticated,
194
+ * exactly as before this field existed.
195
+ */
196
+ user?: UserContext) => Promise<SendEventResult>;
173
197
  }
174
198
  /**
175
199
  * Transport adapter for ServerBridgeProvider. Decouples the bridge's
@@ -213,7 +237,9 @@ interface ServerBridgeTransport {
213
237
  * misrouted to the standalone `std-project-manager` orbital of the
214
238
  * same name). An unmodified server ignores the extra field.
215
239
  */
216
- behaviorHint?: string) => Promise<OrbitalEventResponse>;
240
+ behaviorHint?: string,
241
+ /** See `ServerBridgeContextValue.sendEvent`'s `user` param. */
242
+ user?: UserContext) => Promise<OrbitalEventResponse>;
217
243
  }
218
244
  /**
219
245
  * Supplies the bearer token the hosting server authenticates with. Resolved
@@ -6158,6 +6158,13 @@ var init_slot_types = __esm({
6158
6158
  nextRefId = 1;
6159
6159
  }
6160
6160
  });
6161
+ var SlotContainedContext;
6162
+ var init_slotContained = __esm({
6163
+ "lib/slotContained.ts"() {
6164
+ "use client";
6165
+ SlotContainedContext = React96.createContext(false);
6166
+ }
6167
+ });
6161
6168
  function buildForkPaths(x, y, branches, scale) {
6162
6169
  const inLength = 30 * scale;
6163
6170
  const outLength = 30 * scale;
@@ -38470,7 +38477,6 @@ function TableView({
38470
38477
  columns,
38471
38478
  fields,
38472
38479
  itemActions,
38473
- maxInlineActions,
38474
38480
  itemClickEvent = "",
38475
38481
  selectable = false,
38476
38482
  selectEvent,
@@ -38504,8 +38510,7 @@ function TableView({
38504
38510
  const [localSelected, setLocalSelected] = React96__namespace.default.useState(/* @__PURE__ */ new Set());
38505
38511
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
38506
38512
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
38507
- const inlineActions = maxInlineActions != null ? actionDefs.slice(0, maxInlineActions) : [];
38508
- const overflowActions = maxInlineActions != null ? actionDefs.slice(maxInlineActions) : actionDefs;
38513
+ const overflowActions = actionDefs;
38509
38514
  const fireAction = (action, row) => eventBus.emit(`UI:${action.event}`, {
38510
38515
  id: row.id,
38511
38516
  row
@@ -38687,7 +38692,7 @@ function TableView({
38687
38692
  }
38688
38693
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-foreground", children: formatCell(raw, col.format, relationsData?.[col.field ?? col.key]) }) }, col.key);
38689
38694
  }),
38690
- hasActions && /* @__PURE__ */ jsxRuntime.jsxs(
38695
+ hasActions && /* @__PURE__ */ jsxRuntime.jsx(
38691
38696
  HStack,
38692
38697
  {
38693
38698
  gap: "xs",
@@ -38701,38 +38706,20 @@ function TableView({
38701
38706
  "border-l border-[var(--color-border)]",
38702
38707
  lk.striped && index % 2 === 1 ? "bg-[var(--color-surface-subtle)]" : "bg-[var(--color-card)] group-hover:bg-[var(--color-surface-subtle)]"
38703
38708
  ),
38704
- children: [
38705
- inlineActions.map((action) => /* @__PURE__ */ jsxRuntime.jsxs(
38706
- Button,
38707
- {
38708
- variant: action.variant ?? "ghost",
38709
- size: "sm",
38710
- onClick: () => fireAction(action, row),
38711
- "data-testid": `action-${action.event}`,
38712
- "data-row-id": String(row.id),
38713
- className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
38714
- children: [
38715
- action.icon && renderIconInput3(action.icon, { size: "xs", className: "mr-1" }),
38716
- action.label
38717
- ]
38718
- },
38719
- action.event
38720
- )),
38721
- overflowActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
38722
- Menu,
38723
- {
38724
- position: "bottom-end",
38725
- trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", "data-row-id": String(row.id), children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
38726
- items: overflowActions.map((action) => ({
38727
- label: action.label,
38728
- icon: action.icon,
38729
- event: action.event,
38730
- variant: action.variant === "danger" ? "danger" : "default",
38731
- onClick: () => fireAction(action, row)
38732
- }))
38733
- }
38734
- )
38735
- ]
38709
+ children: overflowActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
38710
+ Menu,
38711
+ {
38712
+ position: "bottom-end",
38713
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", "data-row-id": String(row.id), children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
38714
+ items: overflowActions.map((action) => ({
38715
+ label: action.label,
38716
+ icon: action.icon,
38717
+ event: action.event,
38718
+ variant: action.variant === "danger" ? "danger" : "default",
38719
+ onClick: () => fireAction(action, row)
38720
+ }))
38721
+ }
38722
+ )
38736
38723
  }
38737
38724
  )
38738
38725
  ]
@@ -47749,6 +47736,7 @@ var init_DetailPanel = __esm({
47749
47736
  init_EmptyState();
47750
47737
  init_cn();
47751
47738
  init_portalRoot();
47739
+ init_slotContained();
47752
47740
  init_format();
47753
47741
  init_getNestedValue();
47754
47742
  init_relationLabel();
@@ -47780,6 +47768,7 @@ var init_DetailPanel = __esm({
47780
47768
  }) => {
47781
47769
  const eventBus = useEventBus();
47782
47770
  const { t } = hooks.useTranslate();
47771
+ const contained = React96.useContext(SlotContainedContext);
47783
47772
  const [titleDraft, setTitleDraft] = React96__namespace.default.useState(null);
47784
47773
  const isFieldDefArray = (arr) => {
47785
47774
  if (!arr || arr.length === 0) return false;
@@ -48167,8 +48156,9 @@ var init_DetailPanel = __esm({
48167
48156
  if (!slideOver) {
48168
48157
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className, children: content });
48169
48158
  }
48170
- const panel = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("fixed inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
48171
- return typeof document === "undefined" ? panel : reactDom.createPortal(panel, getOrCreatePortalRoot());
48159
+ const panel = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn(contained ? "absolute" : "fixed", "inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
48160
+ if (contained || typeof document === "undefined") return panel;
48161
+ return reactDom.createPortal(panel, getOrCreatePortalRoot());
48172
48162
  };
48173
48163
  DetailPanel.displayName = "DetailPanel";
48174
48164
  }
@@ -54665,6 +54655,7 @@ var init_component_registry_generated = __esm({
54665
54655
  // components/core/organisms/UISlotRenderer.tsx
54666
54656
  var UISlotRenderer_exports = {};
54667
54657
  __export(UISlotRenderer_exports, {
54658
+ SlotContainedContext: () => SlotContainedContext,
54668
54659
  SlotContentRenderer: () => SlotContentRenderer,
54669
54660
  SuspenseConfigProvider: () => SuspenseConfigProvider,
54670
54661
  UISlotComponent: () => UISlotComponent,
@@ -54837,6 +54828,25 @@ function renderContainedPortal(t, slot, content, onDismiss) {
54837
54828
  }
54838
54829
  );
54839
54830
  case "drawer":
54831
+ if (content.pattern === "detail-panel" && content.props.slideOver === true) {
54832
+ return /* @__PURE__ */ jsxRuntime.jsx(
54833
+ Box,
54834
+ {
54835
+ id: slotId,
54836
+ className: "absolute inset-0 z-50 overflow-hidden",
54837
+ style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
54838
+ onClick: onDismiss,
54839
+ children: /* @__PURE__ */ jsxRuntime.jsx(
54840
+ Box,
54841
+ {
54842
+ className: "absolute inset-y-0 right-0 pointer-events-auto",
54843
+ onClick: (e) => e.stopPropagation(),
54844
+ children: slotContent
54845
+ }
54846
+ )
54847
+ }
54848
+ );
54849
+ }
54840
54850
  return /* @__PURE__ */ jsxRuntime.jsx(
54841
54851
  Box,
54842
54852
  {
@@ -55688,7 +55698,7 @@ function UISlotRenderer({
55688
55698
  }
55689
55699
  return wrapped;
55690
55700
  }
55691
- var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SlotContainedContext, SLOT_SKELETON_MAP, CONTENT_NODE_SLOTS, PATTERNS_WITH_CHILDREN, traitRefPresenceCache;
55701
+ var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SLOT_SKELETON_MAP, CONTENT_NODE_SLOTS, PATTERNS_WITH_CHILDREN, traitRefPresenceCache;
55692
55702
  var init_UISlotRenderer = __esm({
55693
55703
  "components/core/organisms/UISlotRenderer.tsx"() {
55694
55704
  "use client";
@@ -55703,6 +55713,7 @@ var init_UISlotRenderer = __esm({
55703
55713
  init_cn();
55704
55714
  init_format();
55705
55715
  init_portalRoot();
55716
+ init_slotContained();
55706
55717
  init_ErrorBoundary();
55707
55718
  init_Skeleton();
55708
55719
  init_renderer();
@@ -55712,7 +55723,6 @@ var init_UISlotRenderer = __esm({
55712
55723
  scopeWrapLog = logger.createLogger("almadar:ui:scope-wrap");
55713
55724
  TRAIT_BINDING_RE = /^@trait\.([A-Z][A-Za-z0-9]*)$/;
55714
55725
  SuspenseConfigContext = React96.createContext({ enabled: false });
55715
- SlotContainedContext = React96.createContext(false);
55716
55726
  SuspenseConfigProvider.displayName = "SuspenseConfigProvider";
55717
55727
  SLOT_SKELETON_MAP = {
55718
55728
  main: "table",
@@ -60554,6 +60564,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
60554
60564
  const normalizedEvent = normalizeEventKey(eventKey);
60555
60565
  return managerRef.current.canHandleEvent(traitName, normalizedEvent);
60556
60566
  }, []);
60567
+ const commitServerEntity = React96.useCallback((traitName, entity) => {
60568
+ traitFieldStatesRef.current.set(traitName, entity);
60569
+ }, []);
60557
60570
  React96.useEffect(() => {
60558
60571
  const allEvents = /* @__PURE__ */ new Set();
60559
60572
  for (const binding of traitBindings) {
@@ -60717,7 +60730,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
60717
60730
  sendEvent,
60718
60731
  getTraitState,
60719
60732
  canHandleEvent,
60720
- entityBindingSource
60733
+ entityBindingSource,
60734
+ commitServerEntity
60721
60735
  };
60722
60736
  }
60723
60737
 
@@ -60835,7 +60849,7 @@ function NavStackRefBridge({ apiRef }) {
60835
60849
  }, [api, apiRef]);
60836
60850
  return null;
60837
60851
  }
60838
- function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
60852
+ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, user, children }) {
60839
60853
  const bridge = providers.useServerBridge();
60840
60854
  const activeTraitNames = React96.useMemo(
60841
60855
  () => new Set(traits2.map((b) => b.trait.name).filter((n) => !!n)),
@@ -60853,6 +60867,8 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
60853
60867
  [serverActiveTraits]
60854
60868
  );
60855
60869
  const uiSlots = context.useUISlots();
60870
+ const commitServerEntityRef = React96.useRef(() => {
60871
+ });
60856
60872
  const onEventProcessed = React96.useCallback((event, payload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted, results, entityByTrait) => {
60857
60873
  if (!bridge.connected || !orbitalNames?.length) return;
60858
60874
  const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
@@ -60867,14 +60883,20 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
60867
60883
  void bridge.sendEvent(name, event, withActiveTraits(payload), tick, sourceTrait);
60868
60884
  continue;
60869
60885
  }
60870
- void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted, results, entityByTrait).then(({ effects, meta }) => {
60886
+ void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted, results, entityByTrait, user ?? void 0).then(({ effects, meta }) => {
60871
60887
  recordServerResponse(name, event, { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
60888
+ if (meta.entityByTrait) {
60889
+ for (const [traitName, entity] of Object.entries(meta.entityByTrait)) {
60890
+ commitServerEntityRef.current(traitName, entity);
60891
+ }
60892
+ }
60872
60893
  applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNamesRef.current, onNavigateBack);
60873
60894
  });
60874
60895
  }
60875
- }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits]);
60896
+ }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits, user]);
60876
60897
  const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, navigateBack: onNavigateBack, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams } : { navigate: onNavigate, navigateBack: onNavigateBack, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams };
60877
- const { sendEvent, entityBindingSource } = useTraitStateMachine(traits2, uiSlots, opts);
60898
+ const { sendEvent, entityBindingSource, commitServerEntity } = useTraitStateMachine(traits2, uiSlots, opts);
60899
+ commitServerEntityRef.current = commitServerEntity;
60878
60900
  const initSentRef = React96.useRef(false);
60879
60901
  const prevTraitsRef = React96.useRef(void 0);
60880
60902
  const paramsKey = JSON.stringify(routeParams ?? {});
@@ -60914,8 +60936,23 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
60914
60936
  initSentRef.current = true;
60915
60937
  (async () => {
60916
60938
  for (const name of orbitalNames) {
60917
- const { effects, meta } = await bridge.sendEvent(name, "INIT", withActiveTraits({ ...routeParams ?? {} }));
60939
+ const { effects, meta } = await bridge.sendEvent(
60940
+ name,
60941
+ "INIT",
60942
+ withActiveTraits({ ...routeParams ?? {} }),
60943
+ void 0,
60944
+ void 0,
60945
+ void 0,
60946
+ void 0,
60947
+ void 0,
60948
+ user ?? void 0
60949
+ );
60918
60950
  recordServerResponse(name, "INIT", { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
60951
+ if (meta.entityByTrait) {
60952
+ for (const [traitName, entity] of Object.entries(meta.entityByTrait)) {
60953
+ commitServerEntityRef.current(traitName, entity);
60954
+ }
60955
+ }
60919
60956
  const effectTraces = [
60920
60957
  { type: "fetch", args: [], status: "executed" },
60921
60958
  ...effects.map((eff) => ({
@@ -60935,7 +60972,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
60935
60972
  applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNamesRef.current, onNavigateBack);
60936
60973
  }
60937
60974
  })();
60938
- }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits, routeParams]);
60975
+ }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits, routeParams, user]);
60939
60976
  return /* @__PURE__ */ jsxRuntime.jsx(providers.EntityBindingContext.Provider, { value: entityBindingSource, children });
60940
60977
  }
60941
60978
  function FitToBox({ children }) {
@@ -60962,7 +60999,7 @@ function FitToBox({ children }) {
60962
60999
  }, []);
60963
61000
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: outerRef, className: "relative h-full w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: innerRef, style: { transform: `scale(${scale})`, transformOrigin: "top left", width: "fit-content" }, children }) });
60964
61001
  }
60965
- function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence }) {
61002
+ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, user }) {
60966
61003
  const { traits: traits2, allEntities, allTraits, ir } = useResolvedSchema(schema, pageName);
60967
61004
  const allPageTraits = React96.useMemo(() => {
60968
61005
  let base;
@@ -61127,6 +61164,7 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
61127
61164
  onLocalFallback,
61128
61165
  localFallbackTimeoutMs,
61129
61166
  persistence,
61167
+ user,
61130
61168
  children: /* @__PURE__ */ jsxRuntime.jsx(providers.OrbitalThemeProvider, { theme: activeOrbitalTheme, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "h-full min-h-full overflow-auto p-4", children: /* @__PURE__ */ jsxRuntime.jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) }) })
61131
61169
  }
61132
61170
  )
@@ -61333,7 +61371,8 @@ function OrbPreview({
61333
61371
  onNavigateBack: handleNavigateBack,
61334
61372
  onLocalFallback: handleLocalFallback,
61335
61373
  localFallbackTimeoutMs,
61336
- persistence
61374
+ persistence,
61375
+ user
61337
61376
  }
61338
61377
  ) }) : /* @__PURE__ */ jsxRuntime.jsx(
61339
61378
  SchemaRunner,
@@ -61349,7 +61388,8 @@ function OrbPreview({
61349
61388
  onNavigateBack: handleNavigateBack,
61350
61389
  onLocalFallback: handleLocalFallback,
61351
61390
  localFallbackTimeoutMs,
61352
- persistence
61391
+ persistence,
61392
+ user
61353
61393
  }
61354
61394
  ) }) })
61355
61395
  ]