@almadar/ui 4.44.1 → 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.
@@ -4,7 +4,7 @@ import React131__default, { useContext, useMemo, useRef, useEffect, useCallback,
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { EventBusContext, useTraitScope, TraitScopeProvider } from '@almadar/ui/providers';
7
- import { createLogger } from '@almadar/logger';
7
+ import { createLogger, isLogLevelEnabled } from '@almadar/logger';
8
8
  import * as LucideIcons from 'lucide-react';
9
9
  import { Loader2, X, AlertTriangle, Info, AlertCircle, CheckCircle, List, Printer, ChevronRight, ChevronLeft, XCircle, Wrench, RotateCcw, Send, Code, FileText, WrapText, Check, Copy, Trash2, Menu as Menu$1, Search, Bell, ChevronDown, LogOut, ChevronUp, MoreHorizontal, Bug, ZoomOut, ZoomIn, Download, Pause, Play, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ArrowRight, ArrowLeft, Eraser, SkipForward, TrendingUp, TrendingDown, Minus, ArrowUp, ArrowDown, MoreVertical, Circle, Clock, CheckCircle2, HelpCircle, FileQuestion, Inbox, Plus, Filter, Star, FileWarning, Camera, RefreshCw, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, MessageSquare, Flag, GitBranch, Trash, GitCommit, AlignLeft, Columns, Tag, User, DollarSign, Sun, Moon, Zap, Sword, Move, Heart, Shield, Coffee, Users } from 'lucide-react';
10
10
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
@@ -1030,7 +1030,7 @@ var init_useEventBus = __esm({
1030
1030
  try {
1031
1031
  handler(event);
1032
1032
  } catch (error) {
1033
- console.error(`[EventBus] Error in listener for '${type}':`, error);
1033
+ log.error("Error in listener", { type, error: error instanceof Error ? error : String(error) });
1034
1034
  }
1035
1035
  });
1036
1036
  }
@@ -1038,7 +1038,7 @@ var init_useEventBus = __esm({
1038
1038
  try {
1039
1039
  handler(event);
1040
1040
  } catch (error) {
1041
- console.error(`[EventBus] Error in onAny listener for '${type}':`, error);
1041
+ log.error("Error in onAny listener", { type, error: error instanceof Error ? error : String(error) });
1042
1042
  }
1043
1043
  });
1044
1044
  },
@@ -3091,6 +3091,7 @@ var BUILT_IN_THEMES, ThemeContext;
3091
3091
  var init_ThemeContext = __esm({
3092
3092
  "context/ThemeContext.tsx"() {
3093
3093
  "use client";
3094
+ createLogger("almadar:ui:theme");
3094
3095
  BUILT_IN_THEMES = [
3095
3096
  {
3096
3097
  name: "wireframe",
@@ -8905,7 +8906,7 @@ function getTraitSnapshots() {
8905
8906
  try {
8906
8907
  snapshots.push(getter());
8907
8908
  } catch (err) {
8908
- log2.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
8909
+ log3.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
8909
8910
  }
8910
8911
  }
8911
8912
  return snapshots;
@@ -8968,10 +8969,10 @@ function updateAssetStatus(url, status) {
8968
8969
  window.__orbitalVerification.assetStatus[url] = status;
8969
8970
  }
8970
8971
  }
8971
- var log2;
8972
+ var log3;
8972
8973
  var init_verificationRegistry = __esm({
8973
8974
  "lib/verificationRegistry.ts"() {
8974
- log2 = createLogger("almadar:bridge");
8975
+ log3 = createLogger("almadar:bridge");
8975
8976
  exposeOnWindow();
8976
8977
  }
8977
8978
  });
@@ -10999,7 +11000,7 @@ var init_avl_elk_layout = __esm({
10999
11000
  elk = new ELK();
11000
11001
  }
11001
11002
  });
11002
- var SWIM_GUTTER, CENTER_W, BehaviorView;
11003
+ var log4, SWIM_GUTTER, CENTER_W, BehaviorView;
11003
11004
  var init_BehaviorView = __esm({
11004
11005
  "components/molecules/avl/BehaviorView.tsx"() {
11005
11006
  "use client";
@@ -11008,6 +11009,7 @@ var init_BehaviorView = __esm({
11008
11009
  init_AvlSwimLane();
11009
11010
  init_types();
11010
11011
  init_avl_elk_layout();
11012
+ log4 = createLogger("almadar:ui:avl:behavior-view");
11011
11013
  SWIM_GUTTER = 120;
11012
11014
  CENTER_W = 360;
11013
11015
  BehaviorView = ({ data }) => {
@@ -11017,7 +11019,7 @@ var init_BehaviorView = __esm({
11017
11019
  const dataKey = useMemo(() => JSON.stringify(traitData), [traitData]);
11018
11020
  useEffect(() => {
11019
11021
  if (!traitData) return;
11020
- computeTraitLayout(traitData).then(setLayout).catch(console.error);
11022
+ computeTraitLayout(traitData).then(setLayout).catch((err) => log4.error("compute-trait-layout-failed", { error: err instanceof Error ? err : String(err) }));
11021
11023
  }, [dataKey]);
11022
11024
  if (!traitData) {
11023
11025
  return /* @__PURE__ */ 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" });
@@ -11362,7 +11364,7 @@ function computeFoldRegions(code) {
11362
11364
  }
11363
11365
  return regions.sort((a, b) => a.start - b.start);
11364
11366
  }
11365
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
11367
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
11366
11368
  var init_CodeBlock = __esm({
11367
11369
  "components/molecules/markdown/CodeBlock.tsx"() {
11368
11370
  init_Box();
@@ -11439,6 +11441,7 @@ var init_CodeBlock = __esm({
11439
11441
  "lolo-op-async": { color: ORB_COLORS.dark.async }
11440
11442
  };
11441
11443
  loloStyle = { ...dark, ...loloStyleOverrides };
11444
+ log5 = createLogger("almadar:ui:markdown-code");
11442
11445
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
11443
11446
  HIDDEN_LINE_NUMBERS = { display: "none" };
11444
11447
  CodeBlock = React131__default.memo(
@@ -11637,7 +11640,7 @@ var init_CodeBlock = __esm({
11637
11640
  eventBus.emit("UI:COPY_CODE", { language, success: true });
11638
11641
  setTimeout(() => setCopied(false), 2e3);
11639
11642
  } catch (err) {
11640
- console.error("Failed to copy code:", err);
11643
+ log5.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
11641
11644
  eventBus.emit("UI:COPY_CODE", { language, success: false });
11642
11645
  }
11643
11646
  };
@@ -15199,13 +15202,14 @@ function useSafeEventBus2() {
15199
15202
  } };
15200
15203
  }
15201
15204
  }
15202
- var ButtonGroup;
15205
+ var log6, ButtonGroup;
15203
15206
  var init_ButtonGroup = __esm({
15204
15207
  "components/molecules/ButtonGroup.tsx"() {
15205
15208
  "use client";
15206
15209
  init_cn();
15207
15210
  init_atoms();
15208
15211
  init_useEventBus();
15212
+ log6 = createLogger("almadar:ui:button-group");
15209
15213
  ButtonGroup = ({
15210
15214
  children,
15211
15215
  primary,
@@ -15278,7 +15282,7 @@ var init_ButtonGroup = __esm({
15278
15282
  {
15279
15283
  variant: "ghost",
15280
15284
  onClick: () => {
15281
- console.log(`Filter clicked: ${filter.field}`);
15285
+ log6.debug("Filter clicked", { field: filter.field });
15282
15286
  },
15283
15287
  children: filter.label
15284
15288
  },
@@ -21534,31 +21538,56 @@ var init_InputGroup = __esm({
21534
21538
  InputGroup.displayName = "InputGroup";
21535
21539
  }
21536
21540
  });
21537
-
21538
- // lib/debug.ts
21541
+ function gateEnabled(level, ns = NAMESPACE) {
21542
+ return isLogLevelEnabled(level, ns);
21543
+ }
21539
21544
  function isDebugEnabled() {
21540
- if (DEBUG_ENABLED) return true;
21541
- return typeof window !== "undefined" && window.__ALMADAR_DEBUG_VERIFY__ === true;
21545
+ return gateEnabled("DEBUG");
21542
21546
  }
21543
21547
  function debug(...args) {
21544
- if (isDebugEnabled()) {
21545
- console.log("[DEBUG]", ...args);
21548
+ if (!gateEnabled("DEBUG")) return;
21549
+ const [first, ...rest] = args;
21550
+ const message = typeof first === "string" ? first : "<debug>";
21551
+ if (rest.length === 0 && typeof first === "string") {
21552
+ log7.debug(message);
21553
+ } else {
21554
+ log7.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
21546
21555
  }
21547
21556
  }
21548
21557
  function debugGroup(label) {
21549
- if (isDebugEnabled()) {
21550
- console.group(`[DEBUG] ${label}`);
21551
- }
21558
+ if (gateEnabled("DEBUG")) console.group(`[${NAMESPACE}] ${label}`);
21552
21559
  }
21553
21560
  function debugGroupEnd() {
21554
- if (isDebugEnabled()) {
21555
- console.groupEnd();
21561
+ if (gateEnabled("DEBUG")) console.groupEnd();
21562
+ }
21563
+ function formatArgs(values) {
21564
+ if (values.length === 1) return toLogMetaValue(values[0]);
21565
+ return values.map(toLogMetaValue);
21566
+ }
21567
+ function toLogMetaValue(v) {
21568
+ if (v === null || v === void 0) return v;
21569
+ if (v instanceof Error) return v;
21570
+ const t = typeof v;
21571
+ if (t === "string" || t === "number" || t === "boolean") return v;
21572
+ if (Array.isArray(v)) return v.map(toLogMetaValue);
21573
+ if (t === "object") {
21574
+ const out = {};
21575
+ for (const [k, val] of Object.entries(v)) {
21576
+ out[k] = toLogMetaValue(val);
21577
+ }
21578
+ return out;
21556
21579
  }
21580
+ return String(v);
21557
21581
  }
21558
- var DEBUG_ENABLED;
21582
+ var NAMESPACE, log7;
21559
21583
  var init_debug = __esm({
21560
21584
  "lib/debug.ts"() {
21561
- DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
21585
+ NAMESPACE = "almadar:ui:debug";
21586
+ log7 = createLogger(NAMESPACE);
21587
+ createLogger("almadar:ui:debug:input");
21588
+ createLogger("almadar:ui:debug:collision");
21589
+ createLogger("almadar:ui:debug:physics");
21590
+ createLogger("almadar:ui:debug:game-state");
21562
21591
  }
21563
21592
  });
21564
21593
  var isRelationsDebugEnabled, RelationSelect;
@@ -38530,7 +38559,7 @@ function getAllEvents(traits2) {
38530
38559
  }
38531
38560
  function EventDispatcherTab({ traits: traits2, schema }) {
38532
38561
  const eventBus = useEventBus();
38533
- const [log3, setLog] = React131.useState([]);
38562
+ const [log18, setLog] = React131.useState([]);
38534
38563
  const prevStatesRef = React131.useRef(/* @__PURE__ */ new Map());
38535
38564
  React131.useEffect(() => {
38536
38565
  for (const trait of traits2) {
@@ -38594,9 +38623,9 @@ function EventDispatcherTab({ traits: traits2, schema }) {
38594
38623
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Other Events (not available from current state)" }),
38595
38624
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: unavailableEvents.map((event) => /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", className: "opacity-50", children: event }, event)) })
38596
38625
  ] }),
38597
- log3.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
38626
+ log18.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
38598
38627
  /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "text-gray-500 mb-1", children: "Recent Transitions" }),
38599
- /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log3.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38628
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", children: log18.map((entry, i) => /* @__PURE__ */ jsxs(Typography, { variant: "small", className: "font-mono text-xs", children: [
38600
38629
  /* @__PURE__ */ jsx("span", { className: "text-purple-400", children: entry.traitName }),
38601
38630
  " ",
38602
38631
  /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: entry.from }),
@@ -45896,6 +45925,7 @@ init_AboutPageTemplate();
45896
45925
 
45897
45926
  // components/index.ts
45898
45927
  init_cn();
45928
+ var log8 = createLogger("almadar:ui:orbital-history");
45899
45929
  function useOrbitalHistory(options) {
45900
45930
  const { appId, authToken, userId, onHistoryChange, onRevertSuccess } = options;
45901
45931
  const getHeaders = useCallback(() => {
@@ -45957,7 +45987,7 @@ function useOrbitalHistory(options) {
45957
45987
  setCurrentVersion(mergedTimeline[0].version);
45958
45988
  }
45959
45989
  } catch (err) {
45960
- console.error("[useOrbitalHistory] Failed to load history:", err);
45990
+ log8.error("Failed to load history", { error: err instanceof Error ? err : String(err) });
45961
45991
  setError(err instanceof Error ? err.message : "Failed to load history");
45962
45992
  } finally {
45963
45993
  setIsLoading(false);
@@ -45990,7 +46020,7 @@ function useOrbitalHistory(options) {
45990
46020
  error: data.error || "Unknown error during revert"
45991
46021
  };
45992
46022
  } catch (err) {
45993
- console.error("[useOrbitalHistory] Failed to revert:", err);
46023
+ log8.error("Failed to revert", { error: err instanceof Error ? err : String(err) });
45994
46024
  return {
45995
46025
  success: false,
45996
46026
  error: err instanceof Error ? err.message : "Failed to revert"
@@ -46014,6 +46044,7 @@ function useOrbitalHistory(options) {
46014
46044
  refresh
46015
46045
  };
46016
46046
  }
46047
+ var log9 = createLogger("almadar:ui:filesystem");
46017
46048
  function useFileSystem() {
46018
46049
  const [status, setStatus] = useState("idle");
46019
46050
  const [error, setError] = useState(null);
@@ -46028,7 +46059,7 @@ function useFileSystem() {
46028
46059
  setError(null);
46029
46060
  setIsLoading(true);
46030
46061
  try {
46031
- console.log("[useFileSystem] Booting WebContainer...");
46062
+ log9.debug("Booting WebContainer");
46032
46063
  await new Promise((resolve) => setTimeout(resolve, 100));
46033
46064
  setStatus("ready");
46034
46065
  } catch (err) {
@@ -46091,7 +46122,7 @@ function useFileSystem() {
46091
46122
  setFiles(newTree);
46092
46123
  setStatus("running");
46093
46124
  } catch (err) {
46094
- console.error("[useFileSystem] Failed to mount files:", err);
46125
+ log9.error("Failed to mount files", { error: err instanceof Error ? err : String(err) });
46095
46126
  } finally {
46096
46127
  setIsLoading(false);
46097
46128
  }
@@ -46132,7 +46163,7 @@ function useFileSystem() {
46132
46163
  const path = contentArg !== void 0 ? pathOrContent : selectedPath;
46133
46164
  const content = contentArg !== void 0 ? contentArg : pathOrContent;
46134
46165
  if (!path) {
46135
- console.warn("[useFileSystem] updateContent called without path and no file selected");
46166
+ log9.warn("updateContent called without path and no file selected");
46136
46167
  return;
46137
46168
  }
46138
46169
  setFileContents((prev) => {
@@ -46148,14 +46179,14 @@ function useFileSystem() {
46148
46179
  setSelectedFile((prev) => prev ? { ...prev, content, isDirty: true } : null);
46149
46180
  }, []);
46150
46181
  const refreshTree = useCallback(async () => {
46151
- console.log("[useFileSystem] Refreshing tree");
46182
+ log9.debug("Refreshing tree");
46152
46183
  }, []);
46153
46184
  const runCommand = useCallback(async (command) => {
46154
- console.log("[useFileSystem] Running command:", command);
46185
+ log9.debug("Running command", { command });
46155
46186
  return { exitCode: 0, output: "" };
46156
46187
  }, []);
46157
46188
  const startDevServer = useCallback(async () => {
46158
- console.log("[useFileSystem] Starting dev server");
46189
+ log9.debug("Starting dev server");
46159
46190
  setPreviewUrl("http://localhost:5173");
46160
46191
  }, []);
46161
46192
  return {
@@ -46178,6 +46209,7 @@ function useFileSystem() {
46178
46209
  startDevServer
46179
46210
  };
46180
46211
  }
46212
+ var log10 = createLogger("almadar:ui:extensions");
46181
46213
  var defaultManifest = {
46182
46214
  languages: {
46183
46215
  typescript: { extensions: [".ts", ".tsx"], icon: "ts", color: "#3178c6" },
@@ -46196,7 +46228,7 @@ function useExtensions(options) {
46196
46228
  const [isLoading, setIsLoading] = useState(false);
46197
46229
  const [error, setError] = useState(null);
46198
46230
  const loadExtension = useCallback(async (extensionId) => {
46199
- console.log("[useExtensions] Loading extension:", extensionId);
46231
+ log10.debug("Loading extension", { extensionId });
46200
46232
  }, []);
46201
46233
  const loadExtensions = useCallback(async () => {
46202
46234
  setIsLoading(true);
@@ -46268,6 +46300,7 @@ function useExtensions(options) {
46268
46300
  getExtensionForFile
46269
46301
  };
46270
46302
  }
46303
+ var log11 = createLogger("almadar:ui:file-editor");
46271
46304
  function useFileEditor(options) {
46272
46305
  const { extensions, fileSystem, onSchemaUpdate } = options;
46273
46306
  const [openFiles, setOpenFiles] = useState([]);
@@ -46292,7 +46325,7 @@ function useFileEditor(options) {
46292
46325
  setOpenFiles((prev) => [...prev, newFile]);
46293
46326
  setActiveFilePath(path);
46294
46327
  } catch (err) {
46295
- console.error("[useFileEditor] Failed to open file:", err);
46328
+ log11.error("Failed to open file", { error: err instanceof Error ? err : String(err) });
46296
46329
  }
46297
46330
  }, [openFiles, fileSystem, extensions]);
46298
46331
  const closeFile = useCallback((path) => {
@@ -46353,7 +46386,7 @@ function useFileEditor(options) {
46353
46386
  }
46354
46387
  }
46355
46388
  } catch (err) {
46356
- console.error("[useFileEditor] Failed to save file:", err);
46389
+ log11.error("Failed to save file", { error: err instanceof Error ? err : String(err) });
46357
46390
  } finally {
46358
46391
  setIsSaving(false);
46359
46392
  }
@@ -46382,6 +46415,7 @@ function useFileEditor(options) {
46382
46415
  saveAllFiles
46383
46416
  };
46384
46417
  }
46418
+ var log12 = createLogger("almadar:ui:compile");
46385
46419
  function useCompile() {
46386
46420
  const [isCompiling, setIsCompiling] = useState(false);
46387
46421
  const [stage, setStage] = useState("idle");
@@ -46392,7 +46426,7 @@ function useCompile() {
46392
46426
  setStage("compiling");
46393
46427
  setError(null);
46394
46428
  try {
46395
- console.log("[useCompile] Compiling schema:", schema.name);
46429
+ log12.debug("Compiling schema", { name: schema.name });
46396
46430
  const result = {
46397
46431
  success: true,
46398
46432
  files: []
@@ -46418,6 +46452,7 @@ function useCompile() {
46418
46452
  compileSchema
46419
46453
  };
46420
46454
  }
46455
+ var log13 = createLogger("almadar:ui:preview");
46421
46456
  function usePreview(options) {
46422
46457
  const [previewUrl, setPreviewUrl] = useState(null);
46423
46458
  const [isLoading, setIsLoading] = useState(!!options?.appId);
@@ -46451,17 +46486,17 @@ function usePreview(options) {
46451
46486
  setIsLoading(false);
46452
46487
  return;
46453
46488
  }
46454
- console.log("[usePreview] Setting up preview for app:", appId);
46489
+ log13.debug("Setting up preview for app", { appId });
46455
46490
  setPreviewUrl(`/api/orbitals/${appId}`);
46456
46491
  setIsLoading(false);
46457
46492
  }, [options?.appId]);
46458
46493
  const startPreview = useCallback(async () => {
46459
- console.log("[usePreview] startPreview called");
46494
+ log13.debug("startPreview called");
46460
46495
  }, []);
46461
46496
  const stopPreview = useCallback(async () => {
46462
46497
  setIsLoading(true);
46463
46498
  try {
46464
- console.log("[usePreview] Stopping preview server...");
46499
+ log13.debug("Stopping preview server");
46465
46500
  setPreviewUrl(null);
46466
46501
  setApp(null);
46467
46502
  } finally {
@@ -46470,15 +46505,15 @@ function usePreview(options) {
46470
46505
  }, []);
46471
46506
  const refresh = useCallback(async () => {
46472
46507
  if (!previewUrl) return;
46473
- console.log("[usePreview] Refreshing preview...");
46508
+ log13.debug("Refreshing preview");
46474
46509
  setPreviewUrl(`${previewUrl.split("?")[0]}?t=${Date.now()}`);
46475
46510
  }, [previewUrl]);
46476
46511
  const handleRefresh = useCallback(async () => {
46477
- console.log("[usePreview] Handle refresh...");
46512
+ log13.debug("Handle refresh");
46478
46513
  await refresh();
46479
46514
  }, [refresh]);
46480
46515
  const handleReset = useCallback(async () => {
46481
- console.log("[usePreview] Resetting preview...");
46516
+ log13.debug("Resetting preview");
46482
46517
  setError(null);
46483
46518
  setLoadError(null);
46484
46519
  setErrorToast(null);
@@ -46512,6 +46547,7 @@ function usePreview(options) {
46512
46547
  dismissErrorToast
46513
46548
  };
46514
46549
  }
46550
+ var log14 = createLogger("almadar:ui:agent-chat");
46515
46551
  function useAgentChat(options) {
46516
46552
  const [messages, setMessages] = useState([]);
46517
46553
  const [status, setStatus] = useState("idle");
@@ -46534,7 +46570,7 @@ function useAgentChat(options) {
46534
46570
  timestamp: Date.now()
46535
46571
  };
46536
46572
  setMessages((prev) => [...prev, userMessage]);
46537
- console.log("[useAgentChat] Sending message:", content);
46573
+ log14.debug("Sending message", { content });
46538
46574
  const assistantMessage = {
46539
46575
  id: (Date.now() + 1).toString(),
46540
46576
  role: "assistant",
@@ -46557,7 +46593,7 @@ function useAgentChat(options) {
46557
46593
  setError(null);
46558
46594
  const skillName = Array.isArray(skill) ? skill[0] : skill;
46559
46595
  try {
46560
- console.log("[useAgentChat] Starting generation:", skillName, prompt, genOptions);
46596
+ log14.debug("Starting generation", () => ({ skillName, prompt, genOptions: JSON.stringify(genOptions) }));
46561
46597
  await new Promise((resolve) => setTimeout(resolve, 100));
46562
46598
  setStatus("complete");
46563
46599
  options?.onComplete?.();
@@ -46569,10 +46605,10 @@ function useAgentChat(options) {
46569
46605
  }
46570
46606
  }, [options]);
46571
46607
  const continueConversation = useCallback(async (message) => {
46572
- console.log("[useAgentChat] Continue conversation", message);
46608
+ log14.debug("Continue conversation", { message: Array.isArray(message) ? message : [message] });
46573
46609
  }, []);
46574
46610
  const resumeWithDecision = useCallback(async (decisions) => {
46575
- console.log("[useAgentChat] Resume with decision:", decisions);
46611
+ log14.debug("Resume with decision", () => ({ decisions: JSON.stringify(decisions), count: decisions.length }));
46576
46612
  setInterrupt(null);
46577
46613
  }, []);
46578
46614
  const cancel = useCallback(() => {
@@ -46609,6 +46645,7 @@ function useAgentChat(options) {
46609
46645
  clearHistory
46610
46646
  };
46611
46647
  }
46648
+ var log15 = createLogger("almadar:ui:validation");
46612
46649
  function useValidation() {
46613
46650
  const [result, setResult] = useState(null);
46614
46651
  const [isValidating, setIsValidating] = useState(false);
@@ -46622,7 +46659,7 @@ function useValidation() {
46622
46659
  setStage("validating");
46623
46660
  setProgressMessage("Validating schema...");
46624
46661
  try {
46625
- console.log("[useValidation] Validating app:", appId);
46662
+ log15.debug("Validating app", { appId });
46626
46663
  const validationResult = {
46627
46664
  valid: true,
46628
46665
  errors: [],
@@ -46675,6 +46712,7 @@ function useValidation() {
46675
46712
  reset
46676
46713
  };
46677
46714
  }
46715
+ var log16 = createLogger("almadar:ui:deep-agent");
46678
46716
  function useDeepAgentGeneration() {
46679
46717
  const [requests, setRequests] = useState([]);
46680
46718
  const [currentRequest, setCurrentRequest] = useState(null);
@@ -46698,7 +46736,7 @@ function useDeepAgentGeneration() {
46698
46736
  setCurrentRequest(request);
46699
46737
  setRequests((prev) => [...prev, request]);
46700
46738
  try {
46701
- console.log("[useDeepAgentGeneration] Generating from prompt:", prompt);
46739
+ log16.debug("Generating from prompt", { prompt });
46702
46740
  await new Promise((resolve) => setTimeout(resolve, 100));
46703
46741
  request.status = "completed";
46704
46742
  setCurrentRequest(request);
@@ -46718,7 +46756,7 @@ function useDeepAgentGeneration() {
46718
46756
  }
46719
46757
  }, []);
46720
46758
  const startGeneration = useCallback(async (skill, prompt, _options) => {
46721
- console.log("[useDeepAgentGeneration] Starting generation with skill:", skill);
46759
+ log16.debug("Starting generation with skill", { skill });
46722
46760
  await generate(prompt);
46723
46761
  }, [generate]);
46724
46762
  const cancelGeneration = useCallback(() => {
@@ -46740,7 +46778,7 @@ function useDeepAgentGeneration() {
46740
46778
  setIsComplete(false);
46741
46779
  }, []);
46742
46780
  const submitInterruptDecisions = useCallback((decisions) => {
46743
- console.log("[useDeepAgentGeneration] Submitting interrupt decisions:", decisions);
46781
+ log16.debug("Submitting interrupt decisions", () => ({ decisions: JSON.stringify(decisions), count: decisions.length }));
46744
46782
  setInterrupt(null);
46745
46783
  }, []);
46746
46784
  return {
@@ -46762,7 +46800,7 @@ function useDeepAgentGeneration() {
46762
46800
 
46763
46801
  // hooks/index.ts
46764
46802
  init_useEventBus();
46765
- var slotLog2 = createLogger("almadar:ui:useUISlots");
46803
+ var log17 = createLogger("almadar:ui:ui-slots");
46766
46804
  var DEFAULT_SOURCE_KEY = "__default__";
46767
46805
  var MULTI_SOURCE_STACK_TRAIT = "__multi_source_stack__";
46768
46806
  var ALL_SLOTS2 = [
@@ -46844,7 +46882,7 @@ function useUISlotManager() {
46844
46882
  try {
46845
46883
  callback(slot, content);
46846
46884
  } catch (error) {
46847
- console.error("[UISlots] Subscriber error:", error);
46885
+ log17.error("Subscriber error", { error: error instanceof Error ? error : String(error) });
46848
46886
  }
46849
46887
  });
46850
46888
  }, []);
@@ -46856,7 +46894,7 @@ function useUISlotManager() {
46856
46894
  try {
46857
46895
  callback(content);
46858
46896
  } catch (error) {
46859
- console.error(`[UISlots] Trait subscriber error (${traitName}):`, error);
46897
+ log17.error("Trait subscriber error", { traitName, error: error instanceof Error ? error : String(error) });
46860
46898
  }
46861
46899
  });
46862
46900
  },
@@ -46907,9 +46945,12 @@ function useUISlotManager() {
46907
46945
  const slotSources = prev[config.target] ?? {};
46908
46946
  const existing = slotSources[sourceKey];
46909
46947
  if (existing && existing.priority > content.priority) {
46910
- console.warn(
46911
- `[UISlots] Slot "${config.target}" source "${sourceKey}" already has higher priority content (${existing.priority} > ${content.priority})`
46912
- );
46948
+ log17.warn("Slot already has higher priority content", {
46949
+ slot: config.target,
46950
+ sourceKey,
46951
+ existingPriority: existing.priority,
46952
+ newPriority: content.priority
46953
+ });
46913
46954
  return prev;
46914
46955
  }
46915
46956
  const nextSources = {
@@ -46921,7 +46962,7 @@ function useUISlotManager() {
46921
46962
  indexTraitRender(content.sourceTrait, content);
46922
46963
  notifyTraitSubscribers(content.sourceTrait, content);
46923
46964
  }
46924
- slotLog2.info("slot:written", {
46965
+ log17.info("slot:written", {
46925
46966
  slot: config.target,
46926
46967
  sourceKey,
46927
46968
  sourceTrait: content.sourceTrait,
@@ -46966,7 +47007,7 @@ function useUISlotManager() {
46966
47007
  setSources((prev) => {
46967
47008
  const slotSources = prev[slot];
46968
47009
  if (!slotSources || !(sourceKey in slotSources)) {
46969
- slotLog2.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
47010
+ log17.debug("slot:clear-noop", { slot, sourceTrait, reason: !slotSources ? "no-slot" : "no-source" });
46970
47011
  return prev;
46971
47012
  }
46972
47013
  const content = slotSources[sourceKey];
@@ -46982,7 +47023,7 @@ function useUISlotManager() {
46982
47023
  }
46983
47024
  const nextSources = { ...slotSources };
46984
47025
  delete nextSources[sourceKey];
46985
- slotLog2.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
47026
+ log17.info("slot:cleared", { slot, sourceTrait, lastPatternType: content.pattern });
46986
47027
  notifySubscribers(slot, aggregateSlot(nextSources));
46987
47028
  return { ...prev, [slot]: nextSources };
46988
47029
  });