@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.
@@ -3348,24 +3348,24 @@ function captureSubscriberTag(listener) {
3348
3348
  }
3349
3349
  return "unknown";
3350
3350
  }
3351
- function EventBusProvider({ children, debug: debug2 = false }) {
3351
+ function EventBusProvider({ children }) {
3352
3352
  const listenersRef = React147.useRef(/* @__PURE__ */ new Map());
3353
3353
  const anyListenersRef = React147.useRef(/* @__PURE__ */ new Set());
3354
3354
  const deprecationWarningShown = React147.useRef(false);
3355
3355
  const getSelectedEntity = React147.useCallback(() => {
3356
3356
  if (!deprecationWarningShown.current) {
3357
- console.warn(
3358
- "[EventBus] getSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3359
- );
3357
+ busLog.warn("deprecated:getSelectedEntity", {
3358
+ migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3359
+ });
3360
3360
  deprecationWarningShown.current = true;
3361
3361
  }
3362
3362
  return null;
3363
3363
  }, []);
3364
3364
  const clearSelectedEntity = React147.useCallback(() => {
3365
3365
  if (!deprecationWarningShown.current) {
3366
- console.warn(
3367
- "[EventBus] clearSelectedEntity is deprecated. Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3368
- );
3366
+ busLog.warn("deprecated:clearSelectedEntity", {
3367
+ migration: "Use SelectionProvider and useSelection hook instead. See SelectionProvider.tsx for migration guide."
3368
+ });
3369
3369
  deprecationWarningShown.current = true;
3370
3370
  }
3371
3371
  }, []);
@@ -3379,12 +3379,8 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3379
3379
  const listeners6 = listenersRef.current.get(type);
3380
3380
  const listenerCount = (listeners6?.size ?? 0) + anyListenersRef.current.size;
3381
3381
  busLog.debug("emit", { type, payloadKeys: payload ? Object.keys(payload).length : 0, listenerCount });
3382
- if (debug2) {
3383
- if (listenerCount > 0) {
3384
- console.log(`[EventBus] Emit: ${type} \u2192 ${listenerCount} listener(s)`, payload);
3385
- } else {
3386
- console.warn(`[EventBus] Emit: ${type} (NO LISTENERS - event may be lost!)`, payload);
3387
- }
3382
+ if (listenerCount === 0) {
3383
+ busLog.warn("emit:no-listeners", { type });
3388
3384
  }
3389
3385
  if (listeners6) {
3390
3386
  const listenersCopy = Array.from(listeners6);
@@ -3399,7 +3395,7 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3399
3395
  try {
3400
3396
  listener(event);
3401
3397
  } catch (error) {
3402
- console.error(`[EventBus] Error in listener for '${type}':`, error);
3398
+ busLog.error("listener-threw", { type, error: error instanceof Error ? error : String(error) });
3403
3399
  }
3404
3400
  }
3405
3401
  }
@@ -3415,10 +3411,10 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3415
3411
  try {
3416
3412
  listener(event);
3417
3413
  } catch (error) {
3418
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
3414
+ busLog.error("onAny-listener-threw", { type, error: error instanceof Error ? error : String(error) });
3419
3415
  }
3420
3416
  }
3421
- }, [debug2]);
3417
+ }, []);
3422
3418
  const on = React147.useCallback((type, listener) => {
3423
3419
  if (!listenersRef.current.has(type)) {
3424
3420
  listenersRef.current.set(type, /* @__PURE__ */ new Set());
@@ -3427,19 +3423,14 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3427
3423
  listeners6.add(listener);
3428
3424
  if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
3429
3425
  subLog.debug("subscribe", { type, totalListeners: listeners6.size, tag: listenerTags.get(listener) });
3430
- if (debug2) {
3431
- console.log(`[EventBus] Subscribed to '${type}', total: ${listeners6.size}`);
3432
- }
3433
3426
  return () => {
3434
3427
  listeners6.delete(listener);
3435
- if (debug2) {
3436
- console.log(`[EventBus] Unsubscribed from '${type}', remaining: ${listeners6.size}`);
3437
- }
3428
+ subLog.debug("unsubscribe", { type, remaining: listeners6.size });
3438
3429
  if (listeners6.size === 0) {
3439
3430
  listenersRef.current.delete(type);
3440
3431
  }
3441
3432
  };
3442
- }, [debug2]);
3433
+ }, []);
3443
3434
  const once = React147.useCallback((type, listener) => {
3444
3435
  const wrappedListener = (event) => {
3445
3436
  listenersRef.current.get(type)?.delete(wrappedListener);
@@ -3455,16 +3446,11 @@ function EventBusProvider({ children, debug: debug2 = false }) {
3455
3446
  anyListenersRef.current.add(listener);
3456
3447
  if (!listenerTags.has(listener)) listenerTags.set(listener, captureSubscriberTag(listener));
3457
3448
  subLog.debug("subscribe:any", { totalAnyListeners: anyListenersRef.current.size, tag: listenerTags.get(listener) });
3458
- if (debug2) {
3459
- console.log(`[EventBus] onAny subscribed, total: ${anyListenersRef.current.size}`);
3460
- }
3461
3449
  return () => {
3462
3450
  anyListenersRef.current.delete(listener);
3463
- if (debug2) {
3464
- console.log(`[EventBus] onAny unsubscribed, remaining: ${anyListenersRef.current.size}`);
3465
- }
3451
+ subLog.debug("unsubscribe:any", { remaining: anyListenersRef.current.size });
3466
3452
  };
3467
- }, [debug2]);
3453
+ }, []);
3468
3454
  const contextValue = React147.useMemo(
3469
3455
  () => ({
3470
3456
  emit,
@@ -3624,7 +3610,7 @@ var init_useEventBus = __esm({
3624
3610
  try {
3625
3611
  handler(event);
3626
3612
  } catch (error) {
3627
- console.error(`[EventBus] Error in listener for '${type}':`, error);
3613
+ log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
3628
3614
  }
3629
3615
  });
3630
3616
  }
@@ -3632,7 +3618,7 @@ var init_useEventBus = __esm({
3632
3618
  try {
3633
3619
  handler(event);
3634
3620
  } catch (error) {
3635
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
3621
+ log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
3636
3622
  }
3637
3623
  });
3638
3624
  },
@@ -4944,7 +4930,7 @@ var init_ModuleCard = __esm({
4944
4930
  exports.ModuleCard.displayName = "ModuleCard";
4945
4931
  }
4946
4932
  });
4947
- var SWIM_GUTTER, CENTER_W; exports.BehaviorView = void 0;
4933
+ var log2, SWIM_GUTTER, CENTER_W; exports.BehaviorView = void 0;
4948
4934
  var init_BehaviorView = __esm({
4949
4935
  "components/molecules/avl/BehaviorView.tsx"() {
4950
4936
  "use client";
@@ -4953,6 +4939,7 @@ var init_BehaviorView = __esm({
4953
4939
  init_AvlSwimLane();
4954
4940
  init_types();
4955
4941
  init_avl_elk_layout();
4942
+ log2 = logger.createLogger("almadar:ui:avl:behavior-view");
4956
4943
  SWIM_GUTTER = 120;
4957
4944
  CENTER_W = 360;
4958
4945
  exports.BehaviorView = ({ data }) => {
@@ -4962,7 +4949,7 @@ var init_BehaviorView = __esm({
4962
4949
  const dataKey = React147.useMemo(() => JSON.stringify(traitData), [traitData]);
4963
4950
  React147.useEffect(() => {
4964
4951
  if (!traitData) return;
4965
- computeTraitLayout(traitData).then(setLayout).catch(console.error);
4952
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log2.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
4966
4953
  }, [dataKey]);
4967
4954
  if (!traitData) {
4968
4955
  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" });
@@ -5088,10 +5075,11 @@ function useTheme() {
5088
5075
  }
5089
5076
  return context;
5090
5077
  }
5091
- var BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
5078
+ var log3, BUILT_IN_THEMES, ThemeContext, THEME_STORAGE_KEY, MODE_STORAGE_KEY, ThemeProvider;
5092
5079
  var init_ThemeContext = __esm({
5093
5080
  "context/ThemeContext.tsx"() {
5094
5081
  "use client";
5082
+ log3 = logger.createLogger("almadar:ui:theme");
5095
5083
  BUILT_IN_THEMES = [
5096
5084
  {
5097
5085
  name: "wireframe",
@@ -5271,9 +5259,10 @@ var init_ThemeContext = __esm({
5271
5259
  localStorage.setItem(THEME_STORAGE_KEY, newTheme);
5272
5260
  }
5273
5261
  } else {
5274
- console.warn(
5275
- `Theme "${newTheme}" not found. Available: ${availableThemes.map((t) => t.name).join(", ")}`
5276
- );
5262
+ log3.warn("Theme not found", {
5263
+ theme: newTheme,
5264
+ available: availableThemes.map((t) => t.name)
5265
+ });
5277
5266
  }
5278
5267
  },
5279
5268
  [availableThemes]
@@ -5409,7 +5398,7 @@ function useUISlotManager() {
5409
5398
  try {
5410
5399
  callback(slot, content);
5411
5400
  } catch (error) {
5412
- console.error("[UISlots] Subscriber error:", error);
5401
+ log5.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
5413
5402
  }
5414
5403
  });
5415
5404
  }, []);
@@ -5421,7 +5410,7 @@ function useUISlotManager() {
5421
5410
  try {
5422
5411
  callback(content);
5423
5412
  } catch (error) {
5424
- console.error(`[UISlots] Trait subscriber error (${traitName}):`, error);
5413
+ log5.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
5425
5414
  }
5426
5415
  });
5427
5416
  },
@@ -5472,9 +5461,12 @@ function useUISlotManager() {
5472
5461
  const slotSources = prev[config.target] ?? {};
5473
5462
  const existing = slotSources[sourceKey];
5474
5463
  if (existing && existing.priority > content.priority) {
5475
- console.warn(
5476
- `[UISlots] Slot "${config.target}" source "${sourceKey}" already has higher priority content (${existing.priority} > ${content.priority})`
5477
- );
5464
+ log5.warn("Slot already has higher priority content", {
5465
+ slot: config.target,
5466
+ sourceKey,
5467
+ existingPriority: existing.priority,
5468
+ newPriority: content.priority
5469
+ });
5478
5470
  return prev;
5479
5471
  }
5480
5472
  const nextSources = {
@@ -5486,7 +5478,7 @@ function useUISlotManager() {
5486
5478
  indexTraitRender(content.sourceTrait, content);
5487
5479
  notifyTraitSubscribers(content.sourceTrait, content);
5488
5480
  }
5489
- slotLog.info("slot:written", {
5481
+ log5.info("slot:written", {
5490
5482
  slot: config.target,
5491
5483
  sourceKey,
5492
5484
  sourceTrait: content.sourceTrait,
@@ -5531,7 +5523,7 @@ function useUISlotManager() {
5531
5523
  setSources((prev) => {
5532
5524
  const slotSources = prev[slot];
5533
5525
  if (!slotSources || !(sourceKey in slotSources)) {
5534
- slotLog.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
5526
+ log5.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
5535
5527
  return prev;
5536
5528
  }
5537
5529
  const content = slotSources[sourceKey];
@@ -5547,7 +5539,7 @@ function useUISlotManager() {
5547
5539
  }
5548
5540
  const nextSources = { ...slotSources };
5549
5541
  delete nextSources[sourceKey];
5550
- slotLog.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
5542
+ log5.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
5551
5543
  notifySubscribers(slot, aggregateSlot(nextSources));
5552
5544
  return { ...prev, [slot]: nextSources };
5553
5545
  });
@@ -5666,11 +5658,11 @@ function useUISlotManager() {
5666
5658
  updateTraitContent
5667
5659
  };
5668
5660
  }
5669
- var slotLog, DEFAULT_SOURCE_KEY, MULTI_SOURCE_STACK_TRAIT, ALL_SLOTS, DEFAULT_SLOTS, DEFAULT_SOURCES, idCounter;
5661
+ var log5, DEFAULT_SOURCE_KEY, MULTI_SOURCE_STACK_TRAIT, ALL_SLOTS, DEFAULT_SLOTS, DEFAULT_SOURCES, idCounter;
5670
5662
  var init_useUISlots = __esm({
5671
5663
  "hooks/useUISlots.ts"() {
5672
5664
  "use client";
5673
- slotLog = logger.createLogger("almadar:ui:useUISlots");
5665
+ log5 = logger.createLogger("almadar:ui:ui-slots");
5674
5666
  DEFAULT_SOURCE_KEY = "__default__";
5675
5667
  MULTI_SOURCE_STACK_TRAIT = "__multi_source_stack__";
5676
5668
  ALL_SLOTS = [
@@ -6574,10 +6566,10 @@ function refId(obj) {
6574
6566
  refIds.set(obj, id);
6575
6567
  return id;
6576
6568
  }
6577
- var slotLog2, refIds, nextRefId;
6569
+ var slotLog, refIds, nextRefId;
6578
6570
  var init_slot_types = __esm({
6579
6571
  "runtime/ui/slot-types.ts"() {
6580
- slotLog2 = logger.createLogger("almadar:ui:slot-render");
6572
+ slotLog = logger.createLogger("almadar:ui:slot-render");
6581
6573
  refIds = /* @__PURE__ */ new WeakMap();
6582
6574
  nextRefId = 1;
6583
6575
  }
@@ -12222,6 +12214,7 @@ function getAllPages(schema) {
12222
12214
  var init_navigation = __esm({
12223
12215
  "renderer/navigation.tsx"() {
12224
12216
  "use client";
12217
+ logger.createLogger("almadar:ui:navigation");
12225
12218
  React147.createContext(null);
12226
12219
  }
12227
12220
  });
@@ -14699,7 +14692,7 @@ function recordTransition(trace) {
14699
14692
  ...trace,
14700
14693
  id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
14701
14694
  };
14702
- log2.info("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
14695
+ log7.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
14703
14696
  getState().transitions.push(entry);
14704
14697
  if (getState().transitions.length > MAX_TRANSITIONS) {
14705
14698
  getState().transitions.shift();
@@ -14798,7 +14791,7 @@ function getTraitSnapshots() {
14798
14791
  try {
14799
14792
  snapshots.push(getter());
14800
14793
  } catch (err) {
14801
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
14794
+ log7.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
14802
14795
  }
14803
14796
  }
14804
14797
  return snapshots;
@@ -14846,12 +14839,12 @@ function waitForTransition(event, timeoutMs = 1e4) {
14846
14839
  }
14847
14840
  function bindEventBus(eventBus) {
14848
14841
  if (typeof window === "undefined") return;
14849
- log2.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
14842
+ log7.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
14850
14843
  exposeOnWindow();
14851
14844
  if (window.__orbitalVerification) {
14852
14845
  window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
14853
14846
  const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
14854
- log2.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
14847
+ log7.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
14855
14848
  eventBus.emit(prefixed, payload);
14856
14849
  };
14857
14850
  const eventLog = [];
@@ -14914,10 +14907,10 @@ function updateAssetStatus(url, status) {
14914
14907
  window.__orbitalVerification.assetStatus[url] = status;
14915
14908
  }
14916
14909
  }
14917
- var log2, MAX_TRANSITIONS;
14910
+ var log7, MAX_TRANSITIONS;
14918
14911
  var init_verificationRegistry = __esm({
14919
14912
  "lib/verificationRegistry.ts"() {
14920
- log2 = logger.createLogger("almadar:bridge");
14913
+ log7 = logger.createLogger("almadar:bridge");
14921
14914
  MAX_TRANSITIONS = 500;
14922
14915
  exposeOnWindow();
14923
14916
  }
@@ -16478,7 +16471,7 @@ function computeFoldRegions(code) {
16478
16471
  }
16479
16472
  return regions.sort((a, b) => a.start - b.start);
16480
16473
  }
16481
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16474
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log8, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16482
16475
  var init_CodeBlock = __esm({
16483
16476
  "components/molecules/markdown/CodeBlock.tsx"() {
16484
16477
  init_Box();
@@ -16555,6 +16548,7 @@ var init_CodeBlock = __esm({
16555
16548
  "lolo-op-async": { color: syntax.ORB_COLORS.dark.async }
16556
16549
  };
16557
16550
  loloStyle = { ...dark__default.default, ...loloStyleOverrides };
16551
+ log8 = logger.createLogger("almadar:ui:markdown-code");
16558
16552
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
16559
16553
  HIDDEN_LINE_NUMBERS = { display: "none" };
16560
16554
  CodeBlock = React147__namespace.default.memo(
@@ -16753,7 +16747,7 @@ var init_CodeBlock = __esm({
16753
16747
  eventBus.emit("UI:COPY_CODE", { language, success: true });
16754
16748
  setTimeout(() => setCopied(false), 2e3);
16755
16749
  } catch (err) {
16756
- console.error("Failed to copy code:", err);
16750
+ log8.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
16757
16751
  eventBus.emit("UI:COPY_CODE", { language, success: false });
16758
16752
  }
16759
16753
  };
@@ -20315,13 +20309,14 @@ function useSafeEventBus2() {
20315
20309
  } };
20316
20310
  }
20317
20311
  }
20318
- var ButtonGroup;
20312
+ var log9, ButtonGroup;
20319
20313
  var init_ButtonGroup = __esm({
20320
20314
  "components/molecules/ButtonGroup.tsx"() {
20321
20315
  "use client";
20322
20316
  init_cn();
20323
20317
  init_atoms();
20324
20318
  init_useEventBus();
20319
+ log9 = logger.createLogger("almadar:ui:button-group");
20325
20320
  ButtonGroup = ({
20326
20321
  children,
20327
20322
  primary,
@@ -20394,7 +20389,7 @@ var init_ButtonGroup = __esm({
20394
20389
  {
20395
20390
  variant: "ghost",
20396
20391
  onClick: () => {
20397
- console.log(`Filter clicked: ${filter.field}`);
20392
+ log9.debug("Filter clicked", { field: filter.field });
20398
20393
  },
20399
20394
  children: filter.label
20400
20395
  },
@@ -26411,31 +26406,56 @@ var init_InputGroup = __esm({
26411
26406
  InputGroup.displayName = "InputGroup";
26412
26407
  }
26413
26408
  });
26414
-
26415
- // lib/debug.ts
26409
+ function gateEnabled(level, ns = NAMESPACE) {
26410
+ return logger.isLogLevelEnabled(level, ns);
26411
+ }
26416
26412
  function isDebugEnabled() {
26417
- if (DEBUG_ENABLED) return true;
26418
- return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
26413
+ return gateEnabled("DEBUG");
26419
26414
  }
26420
26415
  function debug(...args) {
26421
- if (isDebugEnabled()) {
26422
- console.log("[DEBUG]", ...args);
26416
+ if (!gateEnabled("DEBUG")) return;
26417
+ const [first, ...rest] = args;
26418
+ const message = typeof first === "string" ? first : "<debug>";
26419
+ if (rest.length === 0 && typeof first === "string") {
26420
+ log10.debug(message);
26421
+ } else {
26422
+ log10.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
26423
26423
  }
26424
26424
  }
26425
26425
  function debugGroup(label) {
26426
- if (isDebugEnabled()) {
26427
- console.group(`[DEBUG] ${label}`);
26428
- }
26426
+ if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
26429
26427
  }
26430
26428
  function debugGroupEnd() {
26431
- if (isDebugEnabled()) {
26432
- console.groupEnd();
26429
+ if (gateEnabled("DEBUG")) console.groupEnd();
26430
+ }
26431
+ function formatArgs(values) {
26432
+ if (values.length === 1) return toLogMetaValue(values[0]);
26433
+ return values.map(toLogMetaValue);
26434
+ }
26435
+ function toLogMetaValue(v) {
26436
+ if (v === null || v === void 0) return v;
26437
+ if (v instanceof Error) return v;
26438
+ const t = typeof v;
26439
+ if (t === "string" || t === "number" || t === "boolean") return v;
26440
+ if (Array.isArray(v)) return v.map(toLogMetaValue);
26441
+ if (t === "object") {
26442
+ const out = {};
26443
+ for (const [k, val] of Object.entries(v)) {
26444
+ out[k] = toLogMetaValue(val);
26445
+ }
26446
+ return out;
26433
26447
  }
26448
+ return String(v);
26434
26449
  }
26435
- var DEBUG_ENABLED;
26450
+ var NAMESPACE, log10;
26436
26451
  var init_debug = __esm({
26437
26452
  "lib/debug.ts"() {
26438
- DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
26453
+ NAMESPACE = "almadar:ui:debug";
26454
+ log10 = logger.createLogger(NAMESPACE);
26455
+ logger.createLogger("almadar:ui:debug:input");
26456
+ logger.createLogger("almadar:ui:debug:collision");
26457
+ logger.createLogger("almadar:ui:debug:physics");
26458
+ logger.createLogger("almadar:ui:debug:game-state");
26439
26459
  }
26440
26460
  });
26441
26461
  var isRelationsDebugEnabled, RelationSelect;
@@ -42408,7 +42428,7 @@ function getAllEvents(traits2) {
42408
42428
  }
42409
42429
  function EventDispatcherTab({ traits: traits2, schema }) {
42410
42430
  const eventBus = useEventBus();
42411
- const [log4, setLog] = React147__namespace.useState([]);
42431
+ const [log18, setLog] = React147__namespace.useState([]);
42412
42432
  const prevStatesRef = React147__namespace.useRef(/* @__PURE__ */ new Map());
42413
42433
  React147__namespace.useEffect(() => {
42414
42434
  for (const trait of traits2) {
@@ -42472,9 +42492,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
42472
42492
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
42473
42493
  /* @__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)) })
42474
42494
  ] }),
42475
- log4.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42495
+ log18.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
42476
42496
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
42477
- /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log4.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42497
+ /* @__PURE__ */ jsxRuntime.jsx(Stack, { gap: "xs", children: log18.map((entry, i) => /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
42478
42498
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-purple-400", children: entry.traitName }),
42479
42499
  " ",
42480
42500
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -46844,10 +46864,11 @@ var init_Canvas3DErrorBoundary = __esm({
46844
46864
  "components/organisms/game/three/components/Canvas3DErrorBoundary.css"() {
46845
46865
  }
46846
46866
  });
46847
- var Canvas3DErrorBoundary;
46867
+ var log11, Canvas3DErrorBoundary;
46848
46868
  var init_Canvas3DErrorBoundary2 = __esm({
46849
46869
  "components/organisms/game/three/components/Canvas3DErrorBoundary.tsx"() {
46850
46870
  init_Canvas3DErrorBoundary();
46871
+ log11 = logger.createLogger("almadar:ui:game:canvas3d:error-boundary");
46851
46872
  Canvas3DErrorBoundary = class extends React147.Component {
46852
46873
  constructor(props) {
46853
46874
  super(props);
@@ -46875,8 +46896,8 @@ var init_Canvas3DErrorBoundary2 = __esm({
46875
46896
  componentDidCatch(error, errorInfo) {
46876
46897
  this.setState({ errorInfo });
46877
46898
  this.props.onError?.(error, errorInfo);
46878
- console.error("[Canvas3DErrorBoundary] Error caught:", error);
46879
- console.error("[Canvas3DErrorBoundary] Component stack:", errorInfo.componentStack);
46899
+ log11.error("Error caught", { error });
46900
+ log11.error("Component stack", { componentStack: errorInfo.componentStack ?? "<none>" });
46880
46901
  }
46881
46902
  render() {
46882
46903
  if (this.state.hasError) {
@@ -46939,7 +46960,7 @@ function useGLTFModel(url, resourceBasePath) {
46939
46960
  setState({ model: null, isLoading: false, error: null });
46940
46961
  return;
46941
46962
  }
46942
- console.log("[ModelLoader] Loading:", url);
46963
+ log12.debug("Loading", { url });
46943
46964
  setState((prev) => ({ ...prev, isLoading: true, error: null }));
46944
46965
  const assetRoot = resourceBasePath || detectAssetRoot(url);
46945
46966
  const loader = new GLTFLoader.GLTFLoader();
@@ -46947,7 +46968,7 @@ function useGLTFModel(url, resourceBasePath) {
46947
46968
  loader.load(
46948
46969
  url,
46949
46970
  (gltf) => {
46950
- console.log("[ModelLoader] Loaded:", url);
46971
+ log12.debug("Loaded", { url });
46951
46972
  setState({
46952
46973
  model: gltf.scene,
46953
46974
  isLoading: false,
@@ -46956,8 +46977,7 @@ function useGLTFModel(url, resourceBasePath) {
46956
46977
  },
46957
46978
  void 0,
46958
46979
  (err) => {
46959
- const errorMsg = err instanceof Error ? err.message : String(err);
46960
- console.warn("[ModelLoader] Failed:", url, errorMsg);
46980
+ log12.warn("Failed", { url, error: err instanceof Error ? err : String(err) });
46961
46981
  setState({
46962
46982
  model: null,
46963
46983
  isLoading: false,
@@ -47073,9 +47093,11 @@ function ModelLoader({
47073
47093
  }
47074
47094
  );
47075
47095
  }
47096
+ var log12;
47076
47097
  var init_ModelLoader = __esm({
47077
47098
  "components/organisms/game/three/components/ModelLoader.tsx"() {
47078
47099
  "use client";
47100
+ log12 = logger.createLogger("almadar:ui:game:model-loader");
47079
47101
  }
47080
47102
  });
47081
47103
  function PhysicsObject3D({
@@ -47166,13 +47188,13 @@ function PhysicsObject3D({
47166
47188
  }
47167
47189
  function usePhysics3DController(entityId) {
47168
47190
  const applyForce = (fx, fy, fz) => {
47169
- console.log(`Apply force to ${entityId}:`, { fx, fy, fz });
47191
+ log13.debug("apply force", { entityId, fx, fy, fz });
47170
47192
  };
47171
47193
  const setVelocity = (vx, vy, vz) => {
47172
- console.log(`Set velocity for ${entityId}:`, { vx, vy, vz });
47194
+ log13.debug("set velocity", { entityId, vx, vy, vz });
47173
47195
  };
47174
47196
  const setPosition = (x, y, z) => {
47175
- console.log(`Set position for ${entityId}:`, { x, y, z });
47197
+ log13.debug("set position", { entityId, x, y, z });
47176
47198
  };
47177
47199
  const jump = (force = 10) => {
47178
47200
  applyForce(0, force, 0);
@@ -47184,10 +47206,12 @@ function usePhysics3DController(entityId) {
47184
47206
  jump
47185
47207
  };
47186
47208
  }
47209
+ var log13;
47187
47210
  var init_PhysicsObject3D = __esm({
47188
47211
  "components/organisms/game/three/components/PhysicsObject3D.tsx"() {
47189
47212
  "use client";
47190
47213
  init_ModelLoader();
47214
+ log13 = logger.createLogger("almadar:ui:game:physics");
47191
47215
  }
47192
47216
  });
47193
47217
  function detectAssetRoot2(modelUrl) {
@@ -48773,14 +48797,16 @@ function preloadFeatures(urls) {
48773
48797
  const loader = new GLTFLoader.GLTFLoader();
48774
48798
  loader.setResourcePath(detectAssetRoot3(url));
48775
48799
  loader.load(url, () => {
48776
- console.log("[FeatureRenderer3D] Preloaded:", url);
48800
+ log14.debug("Preloaded", { url });
48777
48801
  });
48778
48802
  }
48779
48803
  });
48780
48804
  }
48805
+ var log14;
48781
48806
  var init_FeatureRenderer3D = __esm({
48782
48807
  "components/organisms/game/three/renderers/FeatureRenderer3D.tsx"() {
48783
48808
  "use client";
48809
+ log14 = logger.createLogger("almadar:ui:game:feature-renderer");
48784
48810
  }
48785
48811
  });
48786
48812
 
@@ -52867,7 +52893,7 @@ function MaybeTraitScope({
52867
52893
  const schemaCtx = useEntitySchemaOptional();
52868
52894
  const orbital = sourceTrait !== void 0 && schemaCtx !== null ? schemaCtx.orbitalsByTrait.get(sourceTrait) : void 0;
52869
52895
  const wrap = sourceTrait !== void 0 && orbital !== void 0;
52870
- scopeWrapLog.info("decide", {
52896
+ scopeWrapLog.debug("decide", {
52871
52897
  sourceTrait,
52872
52898
  schemaCtxPresent: schemaCtx !== null,
52873
52899
  orbitalsByTraitSize: schemaCtx?.orbitalsByTrait.size ?? 0,
@@ -53262,7 +53288,7 @@ function SlotContentRenderer({
53262
53288
  }) {
53263
53289
  const entityProp = content.props.entity;
53264
53290
  if (content.pattern === "form-section") {
53265
- slotLog2.debug("SlotContentRenderer:form-section-render", {
53291
+ slotLog.debug("SlotContentRenderer:form-section-render", {
53266
53292
  contentId: content.id,
53267
53293
  sourceTrait: content.sourceTrait,
53268
53294
  entityRefId: refId(entityProp),
@@ -56308,6 +56334,7 @@ init_EventBusProvider();
56308
56334
 
56309
56335
  // providers/SelectionProvider.tsx
56310
56336
  init_useEventBus();
56337
+ var log4 = logger.createLogger("almadar:ui:selection");
56311
56338
  var SelectionContext = React147.createContext(null);
56312
56339
  var defaultCompareEntities = (a, b) => {
56313
56340
  if (a === b) return true;
@@ -56330,7 +56357,10 @@ function SelectionProvider({
56330
56357
  (entity) => {
56331
56358
  setSelectedState(entity);
56332
56359
  if (debug2) {
56333
- console.log("[SelectionProvider] Selection set:", entity);
56360
+ log4.debug("Selection set", () => ({
56361
+ hasEntity: entity !== null && entity !== void 0,
56362
+ entityId: entity && typeof entity === "object" ? String(entity.id ?? "") : ""
56363
+ }));
56334
56364
  }
56335
56365
  },
56336
56366
  [debug2]
@@ -56338,7 +56368,7 @@ function SelectionProvider({
56338
56368
  const clearSelection = React147.useCallback(() => {
56339
56369
  setSelectedState(null);
56340
56370
  if (debug2) {
56341
- console.log("[SelectionProvider] Selection cleared");
56371
+ log4.debug("Selection cleared");
56342
56372
  }
56343
56373
  }, [debug2]);
56344
56374
  const isSelected = React147.useCallback(
@@ -56353,14 +56383,17 @@ function SelectionProvider({
56353
56383
  if (row) {
56354
56384
  setSelected(row);
56355
56385
  if (debug2) {
56356
- console.log(`[SelectionProvider] ${event.type} received:`, row);
56386
+ log4.debug("event received", () => ({
56387
+ type: event.type,
56388
+ rowId: row && typeof row === "object" ? String(row.id ?? "") : ""
56389
+ }));
56357
56390
  }
56358
56391
  }
56359
56392
  };
56360
56393
  const handleDeselect = (event) => {
56361
56394
  clearSelection();
56362
56395
  if (debug2) {
56363
- console.log(`[SelectionProvider] ${event.type} received - clearing selection`);
56396
+ log4.debug("event received - clearing selection", { type: event.type });
56364
56397
  }
56365
56398
  };
56366
56399
  const unsubView = eventBus.on("UI:VIEW", handleSelect);
@@ -56391,7 +56424,7 @@ init_UISlotRenderer();
56391
56424
  // providers/VerificationProvider.tsx
56392
56425
  init_useEventBus();
56393
56426
  init_verificationRegistry();
56394
- var log3 = logger.createLogger("almadar:verify");
56427
+ var log15 = logger.createLogger("almadar:verify");
56395
56428
  var DISPATCH_SUFFIX = ":DISPATCH";
56396
56429
  var SUCCESS_SUFFIX = ":SUCCESS";
56397
56430
  var ERROR_SUFFIX = ":ERROR";
@@ -56437,7 +56470,7 @@ function VerificationProvider({
56437
56470
  const verificationProviderLifecycleListener = (evt) => {
56438
56471
  const parsed = parseLifecycleEvent(evt.type);
56439
56472
  if (!parsed) return;
56440
- log3.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
56473
+ log15.debug("lifecycle:event", { kind: parsed.kind, traitName: parsed.traitName, event: parsed.event, type: evt.type });
56441
56474
  const payload = evt.payload ?? {};
56442
56475
  if (parsed.kind === "dispatch") {
56443
56476
  const key = `${parsed.traitName}:${String(payload["event"] ?? "")}`;
@@ -56492,7 +56525,7 @@ function VerificationProvider({
56492
56525
  },
56493
56526
  timestamp: Date.now()
56494
56527
  });
56495
- log3.info("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
56528
+ log15.debug("transition:success", { trait: parsed.traitName, event: parsed.event, from: pending?.from, to: newState, effectCount: effects.length });
56496
56529
  } else if (parsed.kind === "error" && parsed.event) {
56497
56530
  const key = `${parsed.traitName}:${parsed.event}`;
56498
56531
  const pending = pendingRef.current.get(key);
@@ -56522,7 +56555,7 @@ function VerificationProvider({
56522
56555
  },
56523
56556
  timestamp: Date.now()
56524
56557
  });
56525
- log3.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
56558
+ log15.warn("transition:error", { trait: parsed.traitName, event: parsed.event, from: fromState, error: errorMsg });
56526
56559
  }
56527
56560
  };
56528
56561
  Object.defineProperty(verificationProviderLifecycleListener, "name", {
@@ -56675,7 +56708,11 @@ function useResolvedSchema(schema, pageName) {
56675
56708
  };
56676
56709
  }
56677
56710
  const page = core.getPage(ir, pageName);
56678
- console.log("[useResolvedSchema] Resolved page:", page?.name, "| path:", page?.path, "| traits:", page?.traits.length);
56711
+ resolvedSchemaLog.debug("Resolved page", () => ({
56712
+ name: page?.name,
56713
+ path: page?.path,
56714
+ traits: page?.traits.length
56715
+ }));
56679
56716
  const traits2 = page?.traits || [];
56680
56717
  const entities = /* @__PURE__ */ new Map();
56681
56718
  if (page) {
@@ -56878,8 +56915,7 @@ function convertFnFormLambdasInProps(props) {
56878
56915
  // hooks/index.ts
56879
56916
  init_useEventBus();
56880
56917
  var ALMADAR_DND_MIME = "application/x-almadar-dnd";
56881
-
56882
- // runtime/createClientEffectHandlers.ts
56918
+ var log16 = logger.createLogger("almadar:ui:effects:client-handlers");
56883
56919
  function createClientEffectHandlers(options) {
56884
56920
  const { eventBus, slotSetter, navigate, notify, callService } = options;
56885
56921
  return {
@@ -56888,10 +56924,10 @@ function createClientEffectHandlers(options) {
56888
56924
  eventBus.emit(prefixedEvent, payload);
56889
56925
  },
56890
56926
  persist: async () => {
56891
- console.warn("[ClientEffectHandlers] persist is server-side only, ignored on client");
56927
+ log16.warn("persist is server-side only, ignored on client");
56892
56928
  },
56893
56929
  set: () => {
56894
- console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
56930
+ log16.warn("set is server-side only, ignored on client");
56895
56931
  },
56896
56932
  callService: async (service, action, params) => {
56897
56933
  if (callService) return callService(service, action, params);
@@ -56920,10 +56956,10 @@ function createClientEffectHandlers(options) {
56920
56956
  slotSetter.addPattern(slot, pattern, props);
56921
56957
  },
56922
56958
  navigate: navigate ?? ((path) => {
56923
- console.warn("[ClientEffectHandlers] No navigate handler, ignoring:", path);
56959
+ log16.warn("No navigate handler, ignoring", { path });
56924
56960
  }),
56925
56961
  notify: notify ?? ((msg, type) => {
56926
- console.log(`[ClientEffectHandlers] notify (${type}):`, msg);
56962
+ log16.debug("notify", { type, message: msg });
56927
56963
  })
56928
56964
  };
56929
56965
  }
@@ -56990,7 +57026,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
56990
57026
  const slots = uiSlotsRef.current;
56991
57027
  const embedded = embeddedTraitsRef.current;
56992
57028
  if (patterns.length === 0) {
56993
- flushLog.info("clear", { traitName, slot });
57029
+ flushLog.debug("clear", { traitName, slot });
56994
57030
  slots.clearBySource(slot, traitName);
56995
57031
  return;
56996
57032
  }
@@ -57005,7 +57041,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57005
57041
  const props = convertFnFormLambdasInProps(rawProps);
57006
57042
  const isEmbedded = embedded?.has(traitName) ?? false;
57007
57043
  if (isEmbedded) {
57008
- flushLog.info("embed-route", {
57044
+ flushLog.debug("embed-route", {
57009
57045
  traitName,
57010
57046
  slot,
57011
57047
  patternType: typeof patternType === "string" ? patternType : void 0,
@@ -57019,12 +57055,12 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57019
57055
  });
57020
57056
  return;
57021
57057
  }
57022
- flushLog.info("slot-render", {
57058
+ flushLog.debug("slot-render", () => ({
57023
57059
  traitName,
57024
57060
  slot,
57025
57061
  patternType: typeof patternType === "string" ? patternType : void 0,
57026
57062
  embedded: Array.from(embedded ?? [])
57027
- });
57063
+ }));
57028
57064
  slots.render({
57029
57065
  target: slot,
57030
57066
  pattern: patternType,
@@ -57118,10 +57154,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57118
57154
  });
57119
57155
  snapshotUnregs.push(unreg);
57120
57156
  }
57121
- console.log(
57122
- "[TraitStateMachine] Reset states for page navigation:",
57123
- Array.from(newManager.getAllStates().keys()).join(", ")
57124
- );
57157
+ stateLog.debug("reset-states-for-nav", () => ({
57158
+ traits: Array.from(newManager.getAllStates().keys()).join(", ")
57159
+ }));
57125
57160
  return () => {
57126
57161
  for (const unreg of snapshotUnregs) unreg();
57127
57162
  };
@@ -57208,13 +57243,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57208
57243
  const normalizedEvent = normalizeEventKey(eventKey);
57209
57244
  const bindings = traitBindingsRef.current;
57210
57245
  const currentManager = managerRef.current;
57211
- console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
57212
- crossTraitLog.debug("processEvent:enter", {
57246
+ crossTraitLog.debug("processEvent:enter", () => ({
57213
57247
  event: normalizedEvent,
57248
+ payload: JSON.stringify(payload ?? null),
57214
57249
  traitCount: bindings.length,
57215
57250
  traitNames: bindings.map((b) => b.trait.name).join(","),
57216
57251
  orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
57217
- });
57252
+ }));
57218
57253
  const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
57219
57254
  const entityByTrait = {};
57220
57255
  for (const [name, fields] of traitFieldStatesRef.current) {
@@ -57269,18 +57304,13 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57269
57304
  }
57270
57305
  }
57271
57306
  if (result.executed && result.effects.length > 0) {
57272
- console.log(
57273
- "[TraitStateMachine] Executing",
57274
- result.effects.length,
57275
- "effects for",
57307
+ stateLog.debug("executing-effects", () => ({
57308
+ effectCount: result.effects.length,
57276
57309
  traitName,
57277
- "| linkedEntity:",
57278
- binding.linkedEntity,
57279
- "| transition:",
57280
- `${result.previousState} -> ${result.newState}`,
57281
- "| effects:",
57282
- JSON.stringify(result.effects)
57283
- );
57310
+ linkedEntity: binding.linkedEntity,
57311
+ transition: `${result.previousState} -> ${result.newState}`,
57312
+ effects: JSON.stringify(result.effects)
57313
+ }));
57284
57314
  const linkedEntity = binding.linkedEntity || "";
57285
57315
  const entityId = payload?.entityId;
57286
57316
  const pendingSlots = /* @__PURE__ */ new Map();
@@ -57400,7 +57430,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57400
57430
  const executor = new runtime.EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
57401
57431
  try {
57402
57432
  await executor.executeAll(result.effects);
57403
- stateLog.info("transition:render-ui-dispatched", {
57433
+ stateLog.debug("transition:render-ui-dispatched", () => ({
57404
57434
  traitName,
57405
57435
  fromState: result.previousState,
57406
57436
  toState: result.newState,
@@ -57409,7 +57439,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57409
57439
  patternTypes: Array.from(pendingSlots.entries()).map(
57410
57440
  ([slot, patterns]) => `${slot}:[${patterns.map((p2) => p2.pattern?.type ?? "null").join(",")}]`
57411
57441
  ).join(";")
57412
- });
57442
+ }));
57413
57443
  void slotSource;
57414
57444
  for (const [slot, patterns] of pendingSlots) {
57415
57445
  flushSlot(traitName, slot, patterns);
@@ -57426,30 +57456,25 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57426
57456
  }
57427
57457
  } else if (!result.executed) {
57428
57458
  if (result.guardResult === false) {
57429
- console.log(
57430
- "[TraitStateMachine] Guard blocked transition:",
57459
+ stateLog.debug("guard-blocked-transition", {
57431
57460
  traitName,
57432
- result.previousState,
57433
- "->",
57434
- result.transition?.to
57435
- );
57461
+ from: result.previousState,
57462
+ to: result.transition?.to
57463
+ });
57436
57464
  } else if (!result.transition) {
57437
57465
  if (core.isCircuitEvent(normalizedEvent)) {
57438
- console.warn(
57439
- `[CLOSED CIRCUIT VIOLATION] Trait "${traitName}" in state "${traitState.currentState}" received event "${normalizedEvent}" but has no transition to handle it.
57440
- This is likely a schema issue. To fix, add a transition:
57441
- { from: "${traitState.currentState}", to: "<target_state>", event: "${normalizedEvent}", effects: [...] }
57442
- Or ensure the previous action (that opened this UI) properly transitions back before emitting this event.`
57443
- );
57466
+ stateLog.warn("closed-circuit-violation", {
57467
+ traitName,
57468
+ currentState: traitState.currentState,
57469
+ event: normalizedEvent,
57470
+ 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.`
57471
+ });
57444
57472
  } else {
57445
- console.log(
57446
- "[TraitStateMachine] No transition for",
57473
+ stateLog.debug("no-transition", {
57447
57474
  traitName,
57448
- "from state:",
57449
- traitState.currentState,
57450
- "on event:",
57451
- normalizedEvent
57452
- );
57475
+ from: traitState.currentState,
57476
+ event: normalizedEvent
57477
+ });
57453
57478
  }
57454
57479
  }
57455
57480
  }
@@ -57557,7 +57582,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57557
57582
  allEvents.add(transition.event);
57558
57583
  }
57559
57584
  }
57560
- console.log("[TraitStateMachine] Subscribing to events:", Array.from(allEvents));
57585
+ stateLog.debug("subscribing-to-events", () => ({ events: Array.from(allEvents) }));
57561
57586
  const unsubscribes = [];
57562
57587
  const subscribedBusKeys = /* @__PURE__ */ new Set();
57563
57588
  for (const binding of traitBindings) {
@@ -57578,7 +57603,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57578
57603
  crossTraitLog.debug("self:fire-skipped-bridge-echo", { traitName, busKey: selfBusKey, eventKey });
57579
57604
  return;
57580
57605
  }
57581
- crossTraitLog.info("self:fire", { traitName, busKey: selfBusKey, eventKey });
57606
+ crossTraitLog.debug("self:fire", { traitName, busKey: selfBusKey, eventKey });
57582
57607
  enqueueAndDrain(eventKey, event.payload);
57583
57608
  });
57584
57609
  unsubscribes.push(() => {
@@ -57604,7 +57629,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
57604
57629
  const busKey = `UI:${sourceOrbital}.${sourceTrait}.${listen.event}`;
57605
57630
  crossTraitLog.debug("listen:subscribed", { busKey, targetTrait: binding.trait.name, sourceOrbital, sourceTrait, listenEvent: listen.event, triggers: listen.triggers });
57606
57631
  const unsub = eventBus.on(busKey, (event) => {
57607
- crossTraitLog.info("listen:fired", { busKey, targetTrait: binding.trait.name, triggers: listen.triggers });
57632
+ crossTraitLog.debug("listen:fired", { busKey, targetTrait: binding.trait.name, triggers: listen.triggers });
57608
57633
  enqueueAndDrain(listen.triggers, event.payload);
57609
57634
  });
57610
57635
  unsubscribes.push(() => {
@@ -57635,6 +57660,7 @@ init_EntitySchemaContext();
57635
57660
  // runtime/ServerBridge.tsx
57636
57661
  init_useEventBus();
57637
57662
  var xOrbitalLog = logger.createLogger("almadar:runtime:cross-orbital");
57663
+ var serverBridgeLog = logger.createLogger("almadar:ui:server-bridge");
57638
57664
  function createHttpTransport(serverUrl) {
57639
57665
  return {
57640
57666
  register: async (schema) => {
@@ -57647,7 +57673,7 @@ function createHttpTransport(serverUrl) {
57647
57673
  const result = await res.json();
57648
57674
  return !!result.success;
57649
57675
  } catch (err) {
57650
- console.error("[ServerBridge] Registration failed:", err);
57676
+ serverBridgeLog.error("Registration failed", { error: err instanceof Error ? err : String(err) });
57651
57677
  return false;
57652
57678
  }
57653
57679
  },
@@ -57910,7 +57936,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
57910
57936
  };
57911
57937
  const props = convertFnFormLambdasInProps(rawProps);
57912
57938
  if (isEmbedded) {
57913
- xOrbitalLog2.info("slot:embed-routed", {
57939
+ xOrbitalLog2.debug("slot:embed-routed", {
57914
57940
  sourceTrait,
57915
57941
  slot: eff.slot,
57916
57942
  patternType: typeof patternType === "string" ? patternType : void 0
@@ -57922,7 +57948,7 @@ function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
57922
57948
  animation: "fade"
57923
57949
  });
57924
57950
  } else {
57925
- xOrbitalLog2.info("slot-write", {
57951
+ xOrbitalLog2.debug("slot-write", {
57926
57952
  slot: eff.slot,
57927
57953
  sourceTrait,
57928
57954
  patternType: typeof patternType === "string" ? patternType : void 0
@@ -57945,12 +57971,12 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
57945
57971
  const onEventProcessed = React147.useCallback(async (event, payload, dispatchedOrbitals) => {
57946
57972
  if (!bridge.connected || !orbitalNames?.length) return;
57947
57973
  const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
57948
- xOrbitalLog2.info("TraitInitializer:fanout", {
57974
+ xOrbitalLog2.debug("TraitInitializer:fanout", () => ({
57949
57975
  event,
57950
57976
  sentTo: targets,
57951
57977
  skipped: orbitalNames.filter((n) => !targets.includes(n)),
57952
57978
  dispatchedOrbitalsSize: dispatchedOrbitals?.size ?? 0
57953
- });
57979
+ }));
57954
57980
  for (const name of targets) {
57955
57981
  const { effects, meta } = await bridge.sendEvent(name, event, payload);
57956
57982
  recordServerResponse(name, event, meta);
@@ -57963,7 +57989,7 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
57963
57989
  React147.useEffect(() => {
57964
57990
  const traitNames = traits2.map((b) => b.trait?.name ?? "").filter(Boolean).sort().join(",");
57965
57991
  if (prevTraitNamesRef.current && prevTraitNamesRef.current !== traitNames) {
57966
- navLog.info("page:trait-set-changed", {
57992
+ navLog.debug("page:trait-set-changed", {
57967
57993
  from: prevTraitNamesRef.current,
57968
57994
  to: traitNames,
57969
57995
  action: "clearAll-slots"
@@ -58230,11 +58256,11 @@ function OrbPreview({
58230
58256
  }, [initialPageName, currentPage]);
58231
58257
  const handleNavigate = React147.useCallback((path) => {
58232
58258
  const match = pages.find(({ page }) => page.path === path);
58233
- navLog.info("handleNavigate", {
58259
+ navLog.debug("handleNavigate", () => ({
58234
58260
  path,
58235
58261
  matched: match?.page.name ?? null,
58236
58262
  availablePaths: pages.map((p2) => p2.page.path)
58237
- });
58263
+ }));
58238
58264
  if (match) {
58239
58265
  setCurrentPage(match.page.name);
58240
58266
  if (typeof window !== "undefined") {
@@ -58256,19 +58282,19 @@ function OrbPreview({
58256
58282
  const el = containerRef.current;
58257
58283
  if (!el) return;
58258
58284
  if (pages.length <= 1) {
58259
- navLog.info("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
58285
+ navLog.debug("interceptor:skipped", { reason: "single-page schema", pageCount: pages.length });
58260
58286
  return;
58261
58287
  }
58262
58288
  const handler = (e) => {
58263
58289
  const anchor = e.target.closest("a");
58264
58290
  if (!anchor) return;
58265
58291
  const href = anchor.getAttribute("href") ?? anchor.getAttribute("to") ?? "";
58266
- navLog.info("click:intercepted", {
58292
+ navLog.debug("click:intercepted", {
58267
58293
  href,
58268
58294
  anchorText: anchor.textContent?.trim().slice(0, 40)
58269
58295
  });
58270
58296
  if (!href || href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("#")) {
58271
- navLog.info("click:skipped", { href, reason: "external/empty/hash" });
58297
+ navLog.debug("click:skipped", { href, reason: "external/empty/hash" });
58272
58298
  return;
58273
58299
  }
58274
58300
  e.preventDefault();
@@ -59728,11 +59754,11 @@ function FlowCanvasInner({
59728
59754
  const EDGE_TYPES_LOCAL = React147.useMemo(() => ({
59729
59755
  eventFlow: EventFlowEdge
59730
59756
  }), []);
59731
- flowCanvasLog.info("node-type-registry:render", {
59757
+ flowCanvasLog.debug("node-type-registry:render", () => ({
59732
59758
  registered: Object.keys(NODE_TYPES2),
59733
59759
  preview: typeof OrbPreviewNode,
59734
59760
  previewIsValid: typeof OrbPreviewNode === "function" || typeof OrbPreviewNode === "object" && OrbPreviewNode !== null
59735
- });
59761
+ }));
59736
59762
  const parsedSchema = React147.useMemo(() => {
59737
59763
  if (typeof schemaProp === "string") return JSON.parse(schemaProp);
59738
59764
  return schemaProp;
@@ -60151,6 +60177,7 @@ init_AvlTransitionLane();
60151
60177
  init_AvlSwimLane();
60152
60178
  init_types();
60153
60179
  init_avl_elk_layout();
60180
+ var log17 = logger.createLogger("almadar:ui:avl:trait-scene");
60154
60181
  var SWIM_GUTTER2 = 120;
60155
60182
  var CENTER_W2 = 360;
60156
60183
  var AvlTraitScene = ({
@@ -60161,7 +60188,9 @@ var AvlTraitScene = ({
60161
60188
  const [layout, setLayout] = React147.useState(null);
60162
60189
  const dataKey = React147.useMemo(() => JSON.stringify(data), [data]);
60163
60190
  React147.useEffect(() => {
60164
- computeTraitLayout(data).then(setLayout).catch(console.error);
60191
+ computeTraitLayout(data).then(setLayout).catch((error) => {
60192
+ log17.error("computeTraitLayout failed", { error: error instanceof Error ? error : String(error) });
60193
+ });
60165
60194
  }, [dataKey]);
60166
60195
  if (!layout) {
60167
60196
  return /* @__PURE__ */ jsxRuntime.jsx("g", { children: /* @__PURE__ */ jsxRuntime.jsx("text", { x: 300, y: 200, textAnchor: "middle", fill: color, fontSize: 12, opacity: 0.5, children: "Computing layout..." }) });