@almadar/ui 4.44.0 → 4.45.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.
@@ -217,7 +217,7 @@ var init_useEventBus = __esm({
217
217
  try {
218
218
  handler(event);
219
219
  } catch (error) {
220
- console.error(`[EventBus] Error in listener for '${type}':`, error);
220
+ log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
221
221
  }
222
222
  });
223
223
  }
@@ -225,7 +225,7 @@ var init_useEventBus = __esm({
225
225
  try {
226
226
  handler(event);
227
227
  } catch (error) {
228
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
228
+ log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
229
229
  }
230
230
  });
231
231
  },
@@ -4228,6 +4228,7 @@ var BUILT_IN_THEMES, ThemeContext;
4228
4228
  var init_ThemeContext = __esm({
4229
4229
  "context/ThemeContext.tsx"() {
4230
4230
  "use client";
4231
+ logger.createLogger("almadar:ui:theme");
4231
4232
  BUILT_IN_THEMES = [
4232
4233
  {
4233
4234
  name: "wireframe",
@@ -7729,6 +7730,7 @@ function getAllPages(schema) {
7729
7730
  var init_navigation = __esm({
7730
7731
  "renderer/navigation.tsx"() {
7731
7732
  "use client";
7733
+ logger.createLogger("almadar:ui:navigation");
7732
7734
  React135.createContext(null);
7733
7735
  }
7734
7736
  });
@@ -10206,7 +10208,7 @@ function recordTransition(trace) {
10206
10208
  ...trace,
10207
10209
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
10208
10210
  };
10209
- log2.info("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10211
+ log5.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
10210
10212
  getState().transitions.push(entry);
10211
10213
  if (getState().transitions.length > MAX_TRANSITIONS) {
10212
10214
  getState().transitions.shift();
@@ -10305,7 +10307,7 @@ function getTraitSnapshots() {
10305
10307
  try {
10306
10308
  snapshots.push(getter());
10307
10309
  } catch (err) {
10308
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10310
+ log5.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
10309
10311
  }
10310
10312
  }
10311
10313
  return snapshots;
@@ -10389,10 +10391,10 @@ function updateAssetStatus(url, status) {
10389
10391
  window.__orbitalVerification.assetStatus[url] = status;
10390
10392
  }
10391
10393
  }
10392
- var log2, MAX_TRANSITIONS;
10394
+ var log5, MAX_TRANSITIONS;
10393
10395
  var init_verificationRegistry = __esm({
10394
10396
  "lib/verificationRegistry.ts"() {
10395
- log2 = logger.createLogger("almadar:bridge");
10397
+ log5 = logger.createLogger("almadar:bridge");
10396
10398
  MAX_TRANSITIONS = 500;
10397
10399
  exposeOnWindow();
10398
10400
  }
@@ -12420,7 +12422,7 @@ var init_avl_elk_layout = __esm({
12420
12422
  elk = new ELK__default.default();
12421
12423
  }
12422
12424
  });
12423
- var SWIM_GUTTER, CENTER_W, BehaviorView;
12425
+ var log6, SWIM_GUTTER, CENTER_W, BehaviorView;
12424
12426
  var init_BehaviorView = __esm({
12425
12427
  "components/molecules/avl/BehaviorView.tsx"() {
12426
12428
  "use client";
@@ -12429,6 +12431,7 @@ var init_BehaviorView = __esm({
12429
12431
  init_AvlSwimLane();
12430
12432
  init_types();
12431
12433
  init_avl_elk_layout();
12434
+ log6 = logger.createLogger("almadar:ui:avl:behavior-view");
12432
12435
  SWIM_GUTTER = 120;
12433
12436
  CENTER_W = 360;
12434
12437
  BehaviorView = ({ data }) => {
@@ -12438,7 +12441,7 @@ var init_BehaviorView = __esm({
12438
12441
  const dataKey = React135.useMemo(() => JSON.stringify(traitData), [traitData]);
12439
12442
  React135.useEffect(() => {
12440
12443
  if (!traitData) return;
12441
- computeTraitLayout(traitData).then(setLayout).catch(console.error);
12444
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log6.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
12442
12445
  }, [dataKey]);
12443
12446
  if (!traitData) {
12444
12447
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-[var(--color-border)] bg-[var(--color-card)] p-4 text-center text-[var(--color-muted-foreground)] text-sm", children: "No trait data" });
@@ -12783,7 +12786,7 @@ function computeFoldRegions(code) {
12783
12786
  }
12784
12787
  return regions.sort((a, b) => a.start - b.start);
12785
12788
  }
12786
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12789
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12787
12790
  var init_CodeBlock = __esm({
12788
12791
  "components/molecules/markdown/CodeBlock.tsx"() {
12789
12792
  init_Box();
@@ -12860,6 +12863,7 @@ var init_CodeBlock = __esm({
12860
12863
  "lolo-op-async": { color: syntax.ORB_COLORS.dark.async }
12861
12864
  };
12862
12865
  loloStyle = { ...dark__default.default, ...loloStyleOverrides };
12866
+ log7 = logger.createLogger("almadar:ui:markdown-code");
12863
12867
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12864
12868
  HIDDEN_LINE_NUMBERS = { display: "none" };
12865
12869
  CodeBlock = React135__namespace.default.memo(
@@ -13058,7 +13062,7 @@ var init_CodeBlock = __esm({
13058
13062
  eventBus.emit("UI:COPY_CODE", { language, success: true });
13059
13063
  setTimeout(() => setCopied(false), 2e3);
13060
13064
  } catch (err) {
13061
- console.error("Failed to copy code:", err);
13065
+ log7.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
13062
13066
  eventBus.emit("UI:COPY_CODE", { language, success: false });
13063
13067
  }
13064
13068
  };
@@ -16570,13 +16574,14 @@ function useSafeEventBus2() {
16570
16574
  } };
16571
16575
  }
16572
16576
  }
16573
- var ButtonGroup;
16577
+ var log8, ButtonGroup;
16574
16578
  var init_ButtonGroup = __esm({
16575
16579
  "components/molecules/ButtonGroup.tsx"() {
16576
16580
  "use client";
16577
16581
  init_cn();
16578
16582
  init_atoms();
16579
16583
  init_useEventBus();
16584
+ log8 = logger.createLogger("almadar:ui:button-group");
16580
16585
  ButtonGroup = ({
16581
16586
  children,
16582
16587
  primary,
@@ -16649,7 +16654,7 @@ var init_ButtonGroup = __esm({
16649
16654
  {
16650
16655
  variant: "ghost",
16651
16656
  onClick: () => {
16652
- console.log(`Filter clicked: ${filter.field}`);
16657
+ log8.debug("Filter clicked", { field: filter.field });
16653
16658
  },
16654
16659
  children: filter.label
16655
16660
  },
@@ -22521,31 +22526,56 @@ var init_InputGroup = __esm({
22521
22526
  InputGroup.displayName = "InputGroup";
22522
22527
  }
22523
22528
  });
22524
-
22525
- // lib/debug.ts
22529
+ function gateEnabled(level, ns = NAMESPACE) {
22530
+ return logger.isLogLevelEnabled(level, ns);
22531
+ }
22526
22532
  function isDebugEnabled() {
22527
- if (DEBUG_ENABLED) return true;
22528
- return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
22533
+ return gateEnabled("DEBUG");
22529
22534
  }
22530
22535
  function debug(...args) {
22531
- if (isDebugEnabled()) {
22532
- console.log("[DEBUG]", ...args);
22536
+ if (!gateEnabled("DEBUG")) return;
22537
+ const [first, ...rest] = args;
22538
+ const message = typeof first === "string" ? first : "<debug>";
22539
+ if (rest.length === 0 && typeof first === "string") {
22540
+ log9.debug(message);
22541
+ } else {
22542
+ log9.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
22533
22543
  }
22534
22544
  }
22535
22545
  function debugGroup(label) {
22536
- if (isDebugEnabled()) {
22537
- console.group(`[DEBUG] ${label}`);
22538
- }
22546
+ if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
22539
22547
  }
22540
22548
  function debugGroupEnd() {
22541
- if (isDebugEnabled()) {
22542
- console.groupEnd();
22549
+ if (gateEnabled("DEBUG")) console.groupEnd();
22550
+ }
22551
+ function formatArgs(values) {
22552
+ if (values.length === 1) return toLogMetaValue(values[0]);
22553
+ return values.map(toLogMetaValue);
22554
+ }
22555
+ function toLogMetaValue(v) {
22556
+ if (v === null || v === void 0) return v;
22557
+ if (v instanceof Error) return v;
22558
+ const t = typeof v;
22559
+ if (t === "string" || t === "number" || t === "boolean") return v;
22560
+ if (Array.isArray(v)) return v.map(toLogMetaValue);
22561
+ if (t === "object") {
22562
+ const out = {};
22563
+ for (const [k, val] of Object.entries(v)) {
22564
+ out[k] = toLogMetaValue(val);
22565
+ }
22566
+ return out;
22543
22567
  }
22568
+ return String(v);
22544
22569
  }
22545
- var DEBUG_ENABLED;
22570
+ var NAMESPACE, log9;
22546
22571
  var init_debug = __esm({
22547
22572
  "lib/debug.ts"() {
22548
- DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
22573
+ NAMESPACE = "almadar:ui:debug";
22574
+ log9 = logger.createLogger(NAMESPACE);
22575
+ logger.createLogger("almadar:ui:debug:input");
22576
+ logger.createLogger("almadar:ui:debug:collision");
22577
+ logger.createLogger("almadar:ui:debug:physics");
22578
+ logger.createLogger("almadar:ui:debug:game-state");
22549
22579
  }
22550
22580
  });
22551
22581
  var isRelationsDebugEnabled, RelationSelect;
@@ -38783,7 +38813,7 @@ function getAllEvents(traits2) {
38783
38813
  }
38784
38814
  function EventDispatcherTab({ traits: traits2, schema }) {
38785
38815
  const eventBus = useEventBus();
38786
- const [log3, setLog] = React135__namespace.useState([]);
38816
+ const [log11, setLog] = React135__namespace.useState([]);
38787
38817
  const prevStatesRef = React135__namespace.useRef(/* @__PURE__ */ new Map());
38788
38818
  React135__namespace.useEffect(() => {
38789
38819
  for (const trait of traits2) {
@@ -38847,9 +38877,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
38847
38877
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
38848
38878
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
38849
38879
  ] }),
38850
- log3.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
38880
+ log11.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
38851
38881
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
38852
- /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log3.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38882
+ /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log11.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38853
38883
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
38854
38884
  " ",
38855
38885
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -43776,7 +43806,7 @@ function MaybeTraitScope({
43776
43806
  const schemaCtx = useEntitySchemaOptional();
43777
43807
  const orbital = sourceTrait !== void 0 && schemaCtx !== null ? schemaCtx.orbitalsByTrait.get(sourceTrait) : void 0;
43778
43808
  const wrap = sourceTrait !== void 0 && orbital !== void 0;
43779
- scopeWrapLog.info("decide", {
43809
+ scopeWrapLog.debug("decide", {
43780
43810
  sourceTrait,
43781
43811
  schemaCtxPresent: schemaCtx !== null,
43782
43812
  orbitalsByTraitSize: schemaCtx?.orbitalsByTrait.size ?? 0,
@@ -44397,8 +44427,7 @@ var init_UISlotRenderer = __esm({
44397
44427
 
44398
44428
  // hooks/index.ts
44399
44429
  init_useEventBus();
44400
-
44401
- // runtime/createClientEffectHandlers.ts
44430
+ var log2 = logger.createLogger("almadar:ui:effects:client-handlers");
44402
44431
  function createClientEffectHandlers(options) {
44403
44432
  const { eventBus, slotSetter, navigate, notify, callService } = options;
44404
44433
  return {
@@ -44407,10 +44436,10 @@ function createClientEffectHandlers(options) {
44407
44436
  eventBus.emit(prefixedEvent, payload);
44408
44437
  },
44409
44438
  persist: async () => {
44410
- console.warn("[ClientEffectHandlers] persist is server-side only, ignored on client");
44439
+ log2.warn("persist is server-side only, ignored on client");
44411
44440
  },
44412
44441
  set: () => {
44413
- console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
44442
+ log2.warn("set is server-side only, ignored on client");
44414
44443
  },
44415
44444
  callService: async (service, action, params) => {
44416
44445
  if (callService) return callService(service, action, params);
@@ -44439,10 +44468,10 @@ function createClientEffectHandlers(options) {
44439
44468
  slotSetter.addPattern(slot, pattern, props);
44440
44469
  },
44441
44470
  navigate: navigate ?? ((path) => {
44442
- console.warn("[ClientEffectHandlers] No navigate handler, ignoring:", path);
44471
+ log2.warn("No navigate handler, ignoring", { path });
44443
44472
  }),
44444
44473
  notify: notify ?? ((msg, type) => {
44445
- console.log(`[ClientEffectHandlers] notify (${type}):`, msg);
44474
+ log2.debug("notify", { type, message: msg });
44446
44475
  })
44447
44476
  };
44448
44477
  }
@@ -44617,7 +44646,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44617
44646
  const slots = uiSlotsRef.current;
44618
44647
  const embedded = embeddedTraitsRef.current;
44619
44648
  if (patterns.length === 0) {
44620
- flushLog.info("clear", { traitName, slot });
44649
+ flushLog.debug("clear", { traitName, slot });
44621
44650
  slots.clearBySource(slot, traitName);
44622
44651
  return;
44623
44652
  }
@@ -44632,7 +44661,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44632
44661
  const props = convertFnFormLambdasInProps(rawProps);
44633
44662
  const isEmbedded = embedded?.has(traitName) ?? false;
44634
44663
  if (isEmbedded) {
44635
- flushLog.info("embed-route", {
44664
+ flushLog.debug("embed-route", {
44636
44665
  traitName,
44637
44666
  slot,
44638
44667
  patternType: typeof patternType === "string" ? patternType : void 0,
@@ -44646,12 +44675,12 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44646
44675
  });
44647
44676
  return;
44648
44677
  }
44649
- flushLog.info("slot-render", {
44678
+ flushLog.debug("slot-render", () => ({
44650
44679
  traitName,
44651
44680
  slot,
44652
44681
  patternType: typeof patternType === "string" ? patternType : void 0,
44653
44682
  embedded: Array.from(embedded ?? [])
44654
- });
44683
+ }));
44655
44684
  slots.render({
44656
44685
  target: slot,
44657
44686
  pattern: patternType,
@@ -44745,10 +44774,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44745
44774
  });
44746
44775
  snapshotUnregs.push(unreg);
44747
44776
  }
44748
- console.log(
44749
- "[TraitStateMachine] Reset states for page navigation:",
44750
- Array.from(newManager.getAllStates().keys()).join(", ")
44751
- );
44777
+ stateLog.debug("reset-states-for-nav", () => ({
44778
+ traits: Array.from(newManager.getAllStates().keys()).join(", ")
44779
+ }));
44752
44780
  return () => {
44753
44781
  for (const unreg of snapshotUnregs) unreg();
44754
44782
  };
@@ -44835,13 +44863,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44835
44863
  const normalizedEvent = normalizeEventKey(eventKey);
44836
44864
  const bindings = traitBindingsRef.current;
44837
44865
  const currentManager = managerRef.current;
44838
- console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
44839
- crossTraitLog.debug("processEvent:enter", {
44866
+ crossTraitLog.debug("processEvent:enter", () => ({
44840
44867
  event: normalizedEvent,
44868
+ payload: JSON.stringify(payload ?? null),
44841
44869
  traitCount: bindings.length,
44842
44870
  traitNames: bindings.map((b) => b.trait.name).join(","),
44843
44871
  orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
44844
- });
44872
+ }));
44845
44873
  const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
44846
44874
  const entityByTrait = {};
44847
44875
  for (const [name, fields] of traitFieldStatesRef.current) {
@@ -44896,18 +44924,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
44896
44924
  }
44897
44925
  }
44898
44926
  if (result.executed && result.effects.length > 0) {
44899
- console.log(
44900
- "[TraitStateMachine] Executing",
44901
- result.effects.length,
44902
- "effects for",
44927
+ stateLog.debug("executing-effects", () => ({
44928
+ effectCount: result.effects.length,
44903
44929
  traitName,
44904
- "| linkedEntity:",
44905
- binding.linkedEntity,
44906
- "| transition:",
44907
- `${result.previousState} -> ${result.newState}`,
44908
- "| effects:",
44909
- JSON.stringify(result.effects)
44910
- );
44930
+ linkedEntity: binding.linkedEntity,
44931
+ transition: `${result.previousState} -> ${result.newState}`,
44932
+ effects: JSON.stringify(result.effects)
44933
+ }));
44911
44934
  const linkedEntity = binding.linkedEntity || "";
44912
44935
  const entityId = payload?.entityId;
44913
44936
  const pendingSlots = /* @__PURE__ */ new Map();
@@ -45027,7 +45050,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45027
45050
  const executor = new runtime.EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
45028
45051
  try {
45029
45052
  await executor.executeAll(result.effects);
45030
- stateLog.info("transition:render-ui-dispatched", {
45053
+ stateLog.debug("transition:render-ui-dispatched", () => ({
45031
45054
  traitName,
45032
45055
  fromState: result.previousState,
45033
45056
  toState: result.newState,
@@ -45036,7 +45059,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45036
45059
  patternTypes: Array.from(pendingSlots.entries()).map(
45037
45060
  ([slot, patterns]) => `${slot}:[${patterns.map((p2) => p2.pattern?.type ?? "null").join(",")}]`
45038
45061
  ).join(";")
45039
- });
45062
+ }));
45040
45063
  void slotSource;
45041
45064
  for (const [slot, patterns] of pendingSlots) {
45042
45065
  flushSlot(traitName, slot, patterns);
@@ -45053,30 +45076,25 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45053
45076
  }
45054
45077
  } else if (!result.executed) {
45055
45078
  if (result.guardResult === false) {
45056
- console.log(
45057
- "[TraitStateMachine] Guard blocked transition:",
45079
+ stateLog.debug("guard-blocked-transition", {
45058
45080
  traitName,
45059
- result.previousState,
45060
- "->",
45061
- result.transition?.to
45062
- );
45081
+ from: result.previousState,
45082
+ to: result.transition?.to
45083
+ });
45063
45084
  } else if (!result.transition) {
45064
45085
  if (core.isCircuitEvent(normalizedEvent)) {
45065
- console.warn(
45066
- `[CLOSED CIRCUIT VIOLATION] Trait "${traitName}" in state "${traitState.currentState}" received event "${normalizedEvent}" but has no transition to handle it.
45067
- This is likely a schema issue. To fix, add a transition:
45068
- { from: "${traitState.currentState}", to: "<target_state>", event: "${normalizedEvent}", effects: [...] }
45069
- Or ensure the previous action (that opened this UI) properly transitions back before emitting this event.`
45070
- );
45086
+ stateLog.warn("closed-circuit-violation", {
45087
+ traitName,
45088
+ currentState: traitState.currentState,
45089
+ event: normalizedEvent,
45090
+ remediation: `Add transition { from: "${traitState.currentState}", to: "<target_state>", event: "${normalizedEvent}", effects: [...] } \u2014 or ensure the previous action (that opened this UI) transitions back before emitting.`
45091
+ });
45071
45092
  } else {
45072
- console.log(
45073
- "[TraitStateMachine] No transition for",
45093
+ stateLog.debug("no-transition", {
45074
45094
  traitName,
45075
- "from state:",
45076
- traitState.currentState,
45077
- "on event:",
45078
- normalizedEvent
45079
- );
45095
+ from: traitState.currentState,
45096
+ event: normalizedEvent
45097
+ });
45080
45098
  }
45081
45099
  }
45082
45100
  }
@@ -45184,7 +45202,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45184
45202
  allEvents.add(transition.event);
45185
45203
  }
45186
45204
  }
45187
- console.log("[TraitStateMachine] Subscribing to events:", Array.from(allEvents));
45205
+ stateLog.debug("subscribing-to-events", () => ({ events: Array.from(allEvents) }));
45188
45206
  const unsubscribes = [];
45189
45207
  const subscribedBusKeys = /* @__PURE__ */ new Set();
45190
45208
  for (const binding of traitBindings) {
@@ -45205,7 +45223,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45205
45223
  crossTraitLog.debug("self:fire-skipped-bridge-echo", { traitName, busKey: selfBusKey, eventKey });
45206
45224
  return;
45207
45225
  }
45208
- crossTraitLog.info("self:fire", { traitName, busKey: selfBusKey, eventKey });
45226
+ crossTraitLog.debug("self:fire", { traitName, busKey: selfBusKey, eventKey });
45209
45227
  enqueueAndDrain(eventKey, event.payload);
45210
45228
  });
45211
45229
  unsubscribes.push(() => {
@@ -45231,7 +45249,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
45231
45249
  const busKey = `UI:${sourceOrbital}.${sourceTrait}.${listen.event}`;
45232
45250
  crossTraitLog.debug("listen:subscribed", { busKey, targetTrait: binding.trait.name, sourceOrbital, sourceTrait, listenEvent: listen.event, triggers: listen.triggers });
45233
45251
  const unsub = eventBus.on(busKey, (event) => {
45234
- crossTraitLog.info("listen:fired", { busKey, targetTrait: binding.trait.name, triggers: listen.triggers });
45252
+ crossTraitLog.debug("listen:fired", { busKey, targetTrait: binding.trait.name, triggers: listen.triggers });
45235
45253
  enqueueAndDrain(listen.triggers, event.payload);
45236
45254
  });
45237
45255
  unsubscribes.push(() => {
@@ -45319,7 +45337,11 @@ function useResolvedSchema(schema, pageName) {
45319
45337
  };
45320
45338
  }
45321
45339
  const page = core.getPage(ir, pageName);
45322
- console.log("[useResolvedSchema] Resolved page:", page?.name, "| path:", page?.path, "| traits:", page?.traits.length);
45340
+ resolvedSchemaLog.debug("Resolved page", () => ({
45341
+ name: page?.name,
45342
+ path: page?.path,
45343
+ traits: page?.traits.length
45344
+ }));
45323
45345
  const traits2 = page?.traits || [];
45324
45346
  const entities = /* @__PURE__ */ new Map();
45325
45347
  if (page) {
@@ -45346,6 +45368,7 @@ function clearSchemaCache() {
45346
45368
 
45347
45369
  // runtime/index.ts
45348
45370
  init_EntitySchemaContext();
45371
+ var log10 = logger.createLogger("almadar:ui:trait-provider");
45349
45372
  var TraitContext = React135.createContext(null);
45350
45373
  function TraitProvider({
45351
45374
  traits: traitBindings,
@@ -45362,7 +45385,11 @@ function TraitProvider({
45362
45385
  currentState: stateName,
45363
45386
  availableEvents: trait.transitions.filter((t) => t.from === stateName).map((t) => t.event),
45364
45387
  dispatch: (eventKey, payload) => {
45365
- console.log(`[TraitProvider] Dispatch to ${trait.name}: ${eventKey}`, payload);
45388
+ log10.debug("Dispatch", () => ({
45389
+ trait: trait.name,
45390
+ event: eventKey,
45391
+ payloadKeys: payload ? Object.keys(payload) : []
45392
+ }));
45366
45393
  },
45367
45394
  canDispatch: (eventKey) => {
45368
45395
  return trait.transitions.some(
@@ -45490,6 +45517,7 @@ init_EntitySchemaContext();
45490
45517
  // runtime/ServerBridge.tsx
45491
45518
  init_useEventBus();
45492
45519
  var xOrbitalLog = logger.createLogger("almadar:runtime:cross-orbital");
45520
+ var serverBridgeLog = logger.createLogger("almadar:ui:server-bridge");
45493
45521
  function createHttpTransport(serverUrl) {
45494
45522
  return {
45495
45523
  register: async (schema) => {
@@ -45502,7 +45530,7 @@ function createHttpTransport(serverUrl) {
45502
45530
  const result = await res.json();
45503
45531
  return !!result.success;
45504
45532
  } catch (err) {
45505
- console.error("[ServerBridge] Registration failed:", err);
45533
+ serverBridgeLog.error("Registration failed", { error: err instanceof Error ? err : String(err) });
45506
45534
  return false;
45507
45535
  }
45508
45536
  },
@@ -45765,7 +45793,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
45765
45793
  };
45766
45794
  const props = convertFnFormLambdasInProps(rawProps);
45767
45795
  if (isEmbedded) {
45768
- xOrbitalLog2.info("slot:embed-routed", {
45796
+ xOrbitalLog2.debug("slot:embed-routed", {
45769
45797
  sourceTrait,
45770
45798
  slot: eff.slot,
45771
45799
  patternType: typeof patternType === "string" ? patternType : void 0
@@ -45777,7 +45805,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
45777
45805
  animation: "fade"
45778
45806
  });
45779
45807
  } else {
45780
- xOrbitalLog2.info("slot-write", {
45808
+ xOrbitalLog2.debug("slot-write", {
45781
45809
  slot: eff.slot,
45782
45810
  sourceTrait,
45783
45811
  patternType: typeof patternType === "string" ? patternType : void 0
@@ -45800,12 +45828,12 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
45800
45828
  const onEventProcessed = React135.useCallback(async (event, payload, dispatchedOrbitals) => {
45801
45829
  if (!bridge.connected || !orbitalNames?.length) return;
45802
45830
  const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
45803
- xOrbitalLog2.info("TraitInitializer:fanout", {
45831
+ xOrbitalLog2.debug("TraitInitializer:fanout", () => ({
45804
45832
  event,
45805
45833
  sentTo: targets,
45806
45834
  skipped: orbitalNames.filter((n) => !targets.includes(n)),
45807
45835
  dispatchedOrbitalsSize: dispatchedOrbitals?.size ?? 0
45808
- });
45836
+ }));
45809
45837
  for (const name of targets) {
45810
45838
  const { effects, meta } = await bridge.sendEvent(name, event, payload);
45811
45839
  recordServerResponse(name, event, meta);
@@ -45818,7 +45846,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
45818
45846
  React135.useEffect(() => {
45819
45847
  const traitNames = traits2.map((b) => b.trait?.name ?? "").filter(Boolean).sort().join(",");
45820
45848
  if (prevTraitNamesRef.current && prevTraitNamesRef.current !== traitNames) {
45821
- navLog.info("page:trait-set-changed", {
45849
+ navLog.debug("page:trait-set-changed", {
45822
45850
  from: prevTraitNamesRef.current,
45823
45851
  to: traitNames,
45824
45852
  action: "clearAll-slots"
@@ -46085,11 +46113,11 @@ function OrbPreview({
46085
46113
  }, [initialPageName, currentPage]);
46086
46114
  const handleNavigate = React135.useCallback((path) => {
46087
46115
  const match = pages.find(({ page }) => page.path === path);
46088
- navLog.info("handleNavigate", {
46116
+ navLog.debug("handleNavigate", () => ({
46089
46117
  path,
46090
46118
  matched: match?.page.name ?? null,
46091
46119
  availablePaths: pages.map((p2) => p2.page.path)
46092
- });
46120
+ }));
46093
46121
  if (match) {
46094
46122
  setCurrentPage(match.page.name);
46095
46123
  if (typeof window !== "undefined") {
@@ -46111,19 +46139,19 @@ function OrbPreview({
46111
46139
  const el = containerRef.current;
46112
46140
  if (!el) return;
46113
46141
  if (pages.length <= 1) {
46114
- navLog.info("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
46142
+ navLog.debug("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
46115
46143
  return;
46116
46144
  }
46117
46145
  const handler = (e) => {
46118
46146
  const anchor = e.target.closest("a");
46119
46147
  if (!anchor) return;
46120
46148
  const href = anchor.getAttribute("href") ?? anchor.getAttribute("to") ?? "";
46121
- navLog.info("click:intercepted", {
46149
+ navLog.debug("click:intercepted", {
46122
46150
  href,
46123
46151
  anchorText: anchor.textContent?.trim().slice(0, 40)
46124
46152
  });
46125
46153
  if (!href || href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) {
46126
- navLog.info("click:skipped", { href, reason: "external/empty/hash" });
46154
+ navLog.debug("click:skipped", { href, reason: "external/empty/hash" });
46127
46155
  return;
46128
46156
  }
46129
46157
  e.preventDefault();