@almadar/ui 6.10.0 → 6.12.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.
Files changed (35) hide show
  1. package/dist/{EntityBindingContext-Y4zXyNJZ.d.cts → EntityBindingContext-D5lRu6p1.d.cts} +11 -0
  2. package/dist/{EntityBindingContext-Y4zXyNJZ.d.ts → EntityBindingContext-D5lRu6p1.d.ts} +11 -0
  3. package/dist/{GameAudioProvider-Dk_Y3LN3.d.cts → GameAudioProvider-D8GynTNq.d.cts} +1 -1
  4. package/dist/{GameAudioProvider-Ctceau1s.d.ts → GameAudioProvider-Dozqx4sL.d.ts} +1 -1
  5. package/dist/avl/index.cjs +250 -106
  6. package/dist/avl/index.js +209 -65
  7. package/dist/{avl-schema-parser-DncJLEn9.d.ts → avl-schema-parser-DX-aVCCm.d.ts} +1 -1
  8. package/dist/{avl-schema-parser-FQ1474v8.d.cts → avl-schema-parser-PVu8rgsy.d.cts} +1 -1
  9. package/dist/{cn-C7fvp9gH.d.ts → cn-Do5gsPBm.d.cts} +2 -100
  10. package/dist/{cn-DnLYahyL.d.cts → cn-Do5gsPBm.d.ts} +2 -100
  11. package/dist/components/index.cjs +103 -68
  12. package/dist/components/index.d.cts +44 -20
  13. package/dist/components/index.d.ts +44 -20
  14. package/dist/components/index.js +64 -29
  15. package/dist/lib/drawable/three/index.d.cts +3 -4
  16. package/dist/lib/drawable/three/index.d.ts +3 -4
  17. package/dist/lib/index.cjs +7 -23
  18. package/dist/lib/index.d.cts +6 -28
  19. package/dist/lib/index.d.ts +6 -28
  20. package/dist/lib/index.js +5 -23
  21. package/dist/{paintDispatch-B5ObLnUv.d.ts → paintDispatch-CK5uwYEq.d.cts} +50 -3
  22. package/dist/{paintDispatch-D3R8NNmV.d.cts → paintDispatch-CK5uwYEq.d.ts} +50 -3
  23. package/dist/providers/index.cjs +129 -78
  24. package/dist/providers/index.d.cts +5 -3
  25. package/dist/providers/index.d.ts +5 -3
  26. package/dist/providers/index.js +90 -39
  27. package/dist/runtime/index.cjs +249 -105
  28. package/dist/runtime/index.d.cts +27 -5
  29. package/dist/runtime/index.d.ts +27 -5
  30. package/dist/runtime/index.js +208 -64
  31. package/dist/verificationRegistry-BLsjb1oU.d.cts +110 -0
  32. package/dist/verificationRegistry-D8bHWD8Q.d.ts +110 -0
  33. package/package.json +7 -7
  34. package/dist/types-B3nHgnMG.d.cts +0 -51
  35. package/dist/types-B3nHgnMG.d.ts +0 -51
@@ -19,6 +19,7 @@ var ELK = require('elkjs/lib/elk.bundled.js');
19
19
  var SyntaxHighlighter = require('react-syntax-highlighter/dist/esm/prism-light.js');
20
20
  var dark = require('react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js');
21
21
  var syntax = require('@almadar/syntax');
22
+ var i18n = require('@almadar/core/i18n');
22
23
  var langJson = require('react-syntax-highlighter/dist/esm/languages/prism/json.js');
23
24
  var langJavascript = require('react-syntax-highlighter/dist/esm/languages/prism/javascript.js');
24
25
  var langTypescript = require('react-syntax-highlighter/dist/esm/languages/prism/typescript.js');
@@ -7730,8 +7731,9 @@ function getTransitions() {
7730
7731
  return [...getState().transitions];
7731
7732
  }
7732
7733
  function recordServerResponse(orbitalName, event, response) {
7734
+ const { effectResults, ...responseFields } = response;
7733
7735
  const serverResponse = {
7734
- ...response,
7736
+ ...responseFields,
7735
7737
  orbitalName,
7736
7738
  timestamp: Date.now()
7737
7739
  };
@@ -7741,7 +7743,7 @@ function recordServerResponse(orbitalName, event, response) {
7741
7743
  from: "server",
7742
7744
  to: "server",
7743
7745
  event,
7744
- effects: [],
7746
+ effects: effectResults ?? [],
7745
7747
  serverResponse,
7746
7748
  timestamp: Date.now()
7747
7749
  };
@@ -18353,6 +18355,15 @@ function buildLineProps(errorLines, extraClassName) {
18353
18355
  };
18354
18356
  };
18355
18357
  }
18358
+ function translateProgram(source, language, lang) {
18359
+ if (lang === "en") return source;
18360
+ if (language === "lolo") return syntax.translateLolo(source, lang);
18361
+ if (language === "orb") {
18362
+ const translated = syntax.translateOrb(source, lang);
18363
+ return typeof translated === "string" ? translated : source;
18364
+ }
18365
+ return source;
18366
+ }
18356
18367
  var dynamicallyLoaded, codeLanguageLoader, orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log6, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, HIGHLIGHT_CAPACITY_BYTES, MONO_FONT_FAMILY, VIEWER_LINE_NUMBER_STYLE, CodeBlock;
18357
18368
  var init_CodeBlock = __esm({
18358
18369
  "components/core/molecules/markdown/CodeBlock.tsx"() {
@@ -18618,6 +18629,7 @@ var init_CodeBlock = __esm({
18618
18629
  showLineNumbers = false,
18619
18630
  wordWrap = false,
18620
18631
  files,
18632
+ naturalLanguages,
18621
18633
  actions,
18622
18634
  isLoading = false,
18623
18635
  error,
@@ -18664,7 +18676,48 @@ var init_CodeBlock = __esm({
18664
18676
  "replace"
18665
18677
  ]
18666
18678
  }) => {
18667
- const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
18679
+ const englishCode = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
18680
+ const naturalTabs = !editable && naturalLanguages && naturalLanguages.length > 1 ? naturalLanguages : void 0;
18681
+ const [naturalLanguage, setNaturalLanguage] = React87.useState(() => naturalTabs?.[0] ?? "en");
18682
+ const activeNaturalLanguage = naturalTabs?.includes(naturalLanguage) === true ? naturalLanguage : naturalTabs?.[0] ?? "en";
18683
+ const translationCache = React87.useMemo(() => /* @__PURE__ */ new Map(), [englishCode, files]);
18684
+ const translateFor = React87.useCallback(
18685
+ (source, sourceLanguage, cacheKey) => {
18686
+ if (activeNaturalLanguage === "en") return source;
18687
+ const key = `${cacheKey}|${sourceLanguage}|${activeNaturalLanguage}`;
18688
+ const hit = translationCache.get(key);
18689
+ if (hit !== void 0) return hit;
18690
+ const translated = translateProgram(source, sourceLanguage, activeNaturalLanguage);
18691
+ translationCache.set(key, translated);
18692
+ return translated;
18693
+ },
18694
+ [translationCache, activeNaturalLanguage]
18695
+ );
18696
+ const code = translateFor(englishCode, language, "code");
18697
+ const naturalTabItems = naturalTabs?.map((lang) => ({
18698
+ id: `lang-${lang}`,
18699
+ label: i18n.coreTables[lang].meta.name,
18700
+ content: null
18701
+ }));
18702
+ const naturalTabStrip = naturalTabs && naturalTabItems ? /* @__PURE__ */ jsxRuntime.jsx(
18703
+ Box,
18704
+ {
18705
+ className: "border-b border-border",
18706
+ dir: i18n.coreTables[activeNaturalLanguage].meta.rtl ? "rtl" : "ltr",
18707
+ "data-testid": "codeblock-language-tabs",
18708
+ children: /* @__PURE__ */ jsxRuntime.jsx(
18709
+ Tabs,
18710
+ {
18711
+ tabs: naturalTabItems,
18712
+ activeTab: `lang-${activeNaturalLanguage}`,
18713
+ onTabChange: (id) => {
18714
+ const next = naturalTabs.find((lang) => `lang-${lang}` === id);
18715
+ if (next) setNaturalLanguage(next);
18716
+ }
18717
+ }
18718
+ )
18719
+ }
18720
+ ) : null;
18668
18721
  const activeStyle = resolveHighlightStyle(language);
18669
18722
  const overCapacity = code.length > HIGHLIGHT_CAPACITY_BYTES;
18670
18723
  const plainCodeColor = plainCodeColorOf(activeStyle);
@@ -18677,8 +18730,8 @@ var init_CodeBlock = __esm({
18677
18730
  const [wrap, setWrap] = React87.useState(wordWrap);
18678
18731
  const [activeFileIndex, setActiveFileIndex] = React87.useState(0);
18679
18732
  const activeFile = files?.[activeFileIndex];
18680
- const activeCode = activeFile?.code ?? code;
18681
18733
  const activeLanguage = activeFile?.language ?? language;
18734
+ const activeCode = activeFile ? translateFor(activeFile.code, activeLanguage, `file-${activeFileIndex}`) : code;
18682
18735
  const languageReady = useLanguageReady(activeLanguage);
18683
18736
  const viewerStyle = resolveHighlightStyle(activeLanguage);
18684
18737
  const viewerPlainCodeColor = plainCodeColorOf(viewerStyle);
@@ -19163,6 +19216,7 @@ var init_CodeBlock = __esm({
19163
19216
  content: null
19164
19217
  }));
19165
19218
  return /* @__PURE__ */ jsxRuntime.jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
19219
+ naturalTabStrip,
19166
19220
  tabItems && tabItems.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
19167
19221
  Tabs,
19168
19222
  {
@@ -19224,7 +19278,7 @@ var init_CodeBlock = __esm({
19224
19278
  ]
19225
19279
  }
19226
19280
  ),
19227
- /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffRowElements }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-mono text-xs", children: viewerHighlightedElement }) })
19281
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, dir: "ltr", children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffRowElements }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-mono text-xs", children: viewerHighlightedElement }) })
19228
19282
  ] }) });
19229
19283
  }
19230
19284
  const hasHeader = showLanguageBadge || effectiveCopy;
@@ -19251,6 +19305,7 @@ var init_CodeBlock = __esm({
19251
19305
  ]
19252
19306
  }
19253
19307
  ),
19308
+ naturalTabStrip,
19254
19309
  editable ? (
19255
19310
  /* GAP-77 / GAP-82 / GAP-83: editable mode = transparent textarea on
19256
19311
  top of a Prism-highlighted SyntaxHighlighter overlay.
@@ -19402,6 +19457,7 @@ var init_CodeBlock = __esm({
19402
19457
  {
19403
19458
  ref: scrollRef,
19404
19459
  onCopy: handleSelectionCopy,
19460
+ dir: "ltr",
19405
19461
  style: {
19406
19462
  flex: 1,
19407
19463
  minHeight: 0,
@@ -19420,7 +19476,7 @@ var init_CodeBlock = __esm({
19420
19476
  )
19421
19477
  ] });
19422
19478
  },
19423
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.motions === next.motions && prev.operators === next.operators
19479
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.naturalLanguages === next.naturalLanguages && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error && prev.editorId === next.editorId && prev.onEditorFocus === next.onEditorFocus && prev.onEditorBlur === next.onEditorBlur && prev.onMotion === next.onMotion && prev.onOperate === next.onOperate && prev.onInsertText === next.onInsertText && prev.onSetMode === next.onSetMode && prev.motions === next.motions && prev.operators === next.operators
19424
19480
  );
19425
19481
  CodeBlock.displayName = "CodeBlock";
19426
19482
  }
@@ -23065,26 +23121,6 @@ var init_ButtonGroup = __esm({
23065
23121
  ButtonGroup.displayName = "ButtonGroup";
23066
23122
  }
23067
23123
  });
23068
- function getNestedValue(obj, path) {
23069
- if (obj === null || obj === void 0 || !path) {
23070
- return void 0;
23071
- }
23072
- if (!path.includes(".")) {
23073
- return obj[path];
23074
- }
23075
- const parts = path.split(".");
23076
- let value = obj;
23077
- for (const part of parts) {
23078
- if (value === null || value === void 0) {
23079
- return void 0;
23080
- }
23081
- if (typeof value !== "object" || Array.isArray(value)) {
23082
- return void 0;
23083
- }
23084
- value = value[part];
23085
- }
23086
- return value;
23087
- }
23088
23124
  function resolveImageUrl(value) {
23089
23125
  if (typeof value === "string") {
23090
23126
  return value;
@@ -23145,11 +23181,11 @@ function getWeekDays(start) {
23145
23181
  return days;
23146
23182
  }
23147
23183
  function eventStartDate(event, startField) {
23148
- const raw = getNestedValue(event, startField);
23184
+ const raw = core.getNestedValue(event, startField);
23149
23185
  return new Date(raw ?? "");
23150
23186
  }
23151
23187
  function eventEndDate(event, endField) {
23152
- const raw = getNestedValue(event, endField);
23188
+ const raw = core.getNestedValue(event, endField);
23153
23189
  if (raw === void 0 || raw === null || raw === "") return null;
23154
23190
  const end = new Date(raw);
23155
23191
  return Number.isNaN(end.getTime()) ? null : end;
@@ -23284,8 +23320,8 @@ function CalendarGrid({
23284
23320
  }, [longPressEvent, longPressPayload, eventBus]);
23285
23321
  const renderChip = children ?? renderItem;
23286
23322
  const renderEvent = (event) => {
23287
- const color = getNestedValue(event, colorField);
23288
- const label = String(getNestedValue(event, titleField) ?? "");
23323
+ const color = core.getNestedValue(event, colorField);
23324
+ const label = String(core.getNestedValue(event, titleField) ?? "");
23289
23325
  const eventIndex = evs.indexOf(event);
23290
23326
  return /* @__PURE__ */ jsxRuntime.jsx(
23291
23327
  Box,
@@ -23406,7 +23442,7 @@ function CalendarGrid({
23406
23442
  children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", children: [
23407
23443
  slotEvents.map(renderEvent),
23408
23444
  continuingEvents.map((event) => {
23409
- const color = getNestedValue(event, colorField);
23445
+ const color = core.getNestedValue(event, colorField);
23410
23446
  return /* @__PURE__ */ jsxRuntime.jsx(
23411
23447
  Box,
23412
23448
  {
@@ -23724,7 +23760,7 @@ var init_CardGrid = __esm({
23724
23760
  e.stopPropagation();
23725
23761
  if (action.navigatesTo) {
23726
23762
  const url = action.navigatesTo.replace(/\{\{row\.(\w+(?:\.\w+)*)\}\}/g, (_, field) => {
23727
- const value = getNestedValue(itemData, field);
23763
+ const value = core.getNestedValue(itemData, field);
23728
23764
  return value !== void 0 && value !== null ? String(value) : "";
23729
23765
  });
23730
23766
  eventBus.emit("UI:NAVIGATE", { url, row: itemData });
@@ -23757,8 +23793,8 @@ var init_CardGrid = __esm({
23757
23793
  return normalizedData.map((item, index) => {
23758
23794
  const itemData = item;
23759
23795
  const id = itemData.id || String(index);
23760
- const titleValue = titleField ? getNestedValue(itemData, titleField) : void 0;
23761
- const statusValue = statusField ? getNestedValue(itemData, statusField) : void 0;
23796
+ const titleValue = titleField ? core.getNestedValue(itemData, titleField) : void 0;
23797
+ const statusValue = statusField ? core.getNestedValue(itemData, statusField) : void 0;
23762
23798
  return /* @__PURE__ */ jsxRuntime.jsxs(
23763
23799
  Box,
23764
23800
  {
@@ -23773,7 +23809,7 @@ var init_CardGrid = __esm({
23773
23809
  actionPayload: { row: itemData },
23774
23810
  children: [
23775
23811
  imageField && (() => {
23776
- const imgUrl = resolveImageUrl(getNestedValue(itemData, imageField));
23812
+ const imgUrl = resolveImageUrl(core.getNestedValue(itemData, imageField));
23777
23813
  if (!imgUrl) return null;
23778
23814
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
23779
23815
  "img",
@@ -23805,7 +23841,7 @@ var init_CardGrid = __esm({
23805
23841
  )) })
23806
23842
  ] }) }),
23807
23843
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "xs", children: bodyFields.map((field) => {
23808
- const value = getNestedValue(itemData, field);
23844
+ const value = core.getNestedValue(itemData, field);
23809
23845
  if (value === void 0 || value === null || value === "") return null;
23810
23846
  const fieldValue = value;
23811
23847
  const boolVal = asBooleanValue(fieldValue);
@@ -27952,7 +27988,7 @@ function DataGrid({
27952
27988
  )
27953
27989
  );
27954
27990
  }
27955
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
27991
+ const titleValue = core.getNestedValue(itemData, titleField?.name ?? "");
27956
27992
  return wrapDnd(
27957
27993
  /* @__PURE__ */ jsxRuntime.jsxs(
27958
27994
  Box,
@@ -27971,7 +28007,7 @@ function DataGrid({
27971
28007
  ),
27972
28008
  children: [
27973
28009
  imageField && (() => {
27974
- const imgUrl = resolveImageUrl(getNestedValue(itemData, imageField));
28010
+ const imgUrl = resolveImageUrl(core.getNestedValue(itemData, imageField));
27975
28011
  if (!imgUrl) return null;
27976
28012
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
27977
28013
  "img",
@@ -28008,7 +28044,7 @@ function DataGrid({
28008
28044
  )
28009
28045
  ] }),
28010
28046
  badgeFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
28011
- const val = getNestedValue(itemData, field.name);
28047
+ const val = core.getNestedValue(itemData, field.name);
28012
28048
  if (val === void 0 || val === null || val === "") return null;
28013
28049
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
28014
28050
  field.icon && renderIconInput(field.icon, { size: "xs" }),
@@ -28049,12 +28085,12 @@ function DataGrid({
28049
28085
  ] }) }),
28050
28086
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 pt-2 pb-4 flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", children: [
28051
28087
  bodyFields.filter((f3) => f3.variant === "caption" && f3.format !== "boolean").map((field) => {
28052
- const value = getNestedValue(itemData, field.name);
28088
+ const value = core.getNestedValue(itemData, field.name);
28053
28089
  if (value === void 0 || value === null || value === "") return null;
28054
28090
  return /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", color: "secondary", className: "line-clamp-2", children: formatValue(value, field.format) }, field.name);
28055
28091
  }),
28056
28092
  /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "md", className: "flex-wrap gap-y-1", children: bodyFields.filter((f3) => f3.variant !== "caption" || f3.format === "boolean").map((field) => {
28057
- const value = getNestedValue(itemData, field.name);
28093
+ const value = core.getNestedValue(itemData, field.name);
28058
28094
  if (value === void 0 || value === null || value === "") return null;
28059
28095
  if (field.format === "boolean") {
28060
28096
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
@@ -28172,7 +28208,7 @@ function formatValue2(value, format, boolLabels) {
28172
28208
  function groupData(items, field) {
28173
28209
  const groups = /* @__PURE__ */ new Map();
28174
28210
  for (const item of items) {
28175
- const key = String(getNestedValue(item, field) ?? "");
28211
+ const key = String(core.getNestedValue(item, field) ?? "");
28176
28212
  const group = groups.get(key);
28177
28213
  if (group) group.push(item);
28178
28214
  else groups.set(key, [item]);
@@ -28365,7 +28401,7 @@ function DataList({
28365
28401
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
28366
28402
  const senderLabel = (itemData, raw) => {
28367
28403
  if (!senderLabelField) return raw;
28368
- const v = getNestedValue(itemData, senderLabelField);
28404
+ const v = core.getNestedValue(itemData, senderLabelField);
28369
28405
  return v === void 0 || v === null || v === "" ? raw : String(v);
28370
28406
  };
28371
28407
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
@@ -28373,11 +28409,11 @@ function DataList({
28373
28409
  group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
28374
28410
  group.items.map((itemData, index) => {
28375
28411
  const id = itemData.id || `${gi}-${index}`;
28376
- const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
28412
+ const sender = senderField ? String(core.getNestedValue(itemData, senderField) ?? "") : "";
28377
28413
  const isSent = Boolean(currentUser && sender === currentUser);
28378
- const content = getNestedValue(itemData, contentField);
28414
+ const content = core.getNestedValue(itemData, contentField);
28379
28415
  const timestampField = fieldDefs.find((f3) => f3.format === "date");
28380
- const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
28416
+ const timestamp = timestampField ? core.getNestedValue(itemData, timestampField.name) : null;
28381
28417
  const metaFields = fieldDefs.filter(
28382
28418
  (f3) => f3.name !== contentField && f3.name !== timestampField?.name
28383
28419
  );
@@ -28403,7 +28439,7 @@ function DataList({
28403
28439
  !isSent && senderField && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: senderLabel(itemData, sender) }),
28404
28440
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
28405
28441
  metaFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1 flex-wrap", children: metaFields.map((f3) => {
28406
- const v = getNestedValue(itemData, f3.name);
28442
+ const v = core.getNestedValue(itemData, f3.name);
28407
28443
  if (v === void 0 || v === null || v === "") return null;
28408
28444
  return f3.variant === "badge" ? (
28409
28445
  // `format` applies here too — a boolean field badged
@@ -28491,7 +28527,7 @@ function DataList({
28491
28527
  );
28492
28528
  }
28493
28529
  const id = itemData.id || String(index);
28494
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
28530
+ const titleValue = core.getNestedValue(itemData, titleField?.name ?? "");
28495
28531
  return wrapDnd(
28496
28532
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-entity-row": true, "data-entity-id": id, onClick: rowClickEvent ? handleRowClick(itemData) : void 0, className: cn(rowClickEvent && "cursor-pointer"), children: [
28497
28533
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -28520,7 +28556,7 @@ function DataList({
28520
28556
  }
28521
28557
  ),
28522
28558
  badgeFields.map((field) => {
28523
- const val = getNestedValue(itemData, field.name);
28559
+ const val = core.getNestedValue(itemData, field.name);
28524
28560
  if (val === void 0 || val === null) return null;
28525
28561
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
28526
28562
  field.icon && renderIconInput2(field.icon, { size: "xs" }),
@@ -28529,7 +28565,7 @@ function DataList({
28529
28565
  })
28530
28566
  ] }),
28531
28567
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "md", className: cn("flex-wrap", isCompact ? "mt-0.5" : "mt-1.5"), children: bodyFields.map((field) => {
28532
- const value = getNestedValue(itemData, field.name);
28568
+ const value = core.getNestedValue(itemData, field.name);
28533
28569
  if (value === void 0 || value === null || value === "") return null;
28534
28570
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
28535
28571
  field.icon && renderIconInput2(field.icon, { size: "xs", className: "text-muted-foreground" }),
@@ -28549,7 +28585,7 @@ function DataList({
28549
28585
  ] }, field.name);
28550
28586
  }) }),
28551
28587
  progressFields.map((field) => {
28552
- const value = getNestedValue(itemData, field.name);
28588
+ const value = core.getNestedValue(itemData, field.name);
28553
28589
  if (typeof value !== "number") return null;
28554
28590
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "mt-2 max-w-xs", children: [
28555
28591
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
@@ -34828,7 +34864,7 @@ function statusVariant4(value) {
34828
34864
  function groupData2(items, field) {
34829
34865
  const groups = /* @__PURE__ */ new Map();
34830
34866
  for (const item of items) {
34831
- const key = String(getNestedValue(item, field) ?? "");
34867
+ const key = String(core.getNestedValue(item, field) ?? "");
34832
34868
  const group = groups.get(key);
34833
34869
  if (group) group.push(item);
34834
34870
  else groups.set(key, [item]);
@@ -34944,7 +34980,7 @@ function TableView({
34944
34980
  const colFloors = React87__namespace.default.useMemo(
34945
34981
  () => colDefs.map((col) => {
34946
34982
  const longest = data.reduce((widest, row) => {
34947
- const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
34983
+ const cell = formatCell(asFieldValue(core.getNestedValue(row, col.field ?? col.key)), col.format);
34948
34984
  return Math.max(widest, cell.length);
34949
34985
  }, columnLabel(col).length);
34950
34986
  const chrome = col.format === "badge" ? BADGE_CHROME_CH : 0;
@@ -35036,7 +35072,7 @@ function TableView({
35036
35072
  }
35037
35073
  ) }),
35038
35074
  hasRenderProp ? /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 min-w-0", children: children(row, index) }) : colDefs.map((col) => {
35039
- const raw = asFieldValue(getNestedValue(row, col.field ?? col.key));
35075
+ const raw = asFieldValue(core.getNestedValue(row, col.field ?? col.key));
35040
35076
  const cellBase = cn(
35041
35077
  "flex items-center min-w-0",
35042
35078
  alignClass[col.align ?? "left"],
@@ -38965,7 +39001,7 @@ function DocumentDetails({
38965
39001
  };
38966
39002
  const renderValue = (field) => {
38967
39003
  const name = fieldName(field);
38968
- const raw = getNestedValue(entity ?? {}, name);
39004
+ const raw = core.getNestedValue(entity ?? {}, name);
38969
39005
  const kind = fieldKind(field, raw);
38970
39006
  const label = field.label ?? field.header ?? humanizeFieldName(name);
38971
39007
  if (kind === "image") {
@@ -41672,11 +41708,11 @@ var init_WizardContainer = __esm({
41672
41708
  });
41673
41709
  function calculateComplexity(schema) {
41674
41710
  if (!schema) return 1;
41675
- const entities = schema.dataEntities?.length || 0;
41711
+ const entities = schema.dataEntities || 0;
41676
41712
  const pages = schema.ui?.pages?.length || 0;
41677
- const traits2 = schema.traits?.length || 0;
41713
+ const traits2 = schema.traits || 0;
41678
41714
  const sections = schema.ui?.pages?.reduce(
41679
- (acc, page) => acc + (page.sections?.length || 0),
41715
+ (acc, page) => acc + (page.sections || 0),
41680
41716
  0
41681
41717
  ) || 0;
41682
41718
  return entities * 3 + pages * 2 + traits2 * 2 + sections * 1;
@@ -43994,7 +44030,7 @@ function DataTable({
43994
44030
  }
43995
44031
  ) }),
43996
44032
  normalizedColumns.map((col) => {
43997
- const cellValue = getNestedValue(
44033
+ const cellValue = core.getNestedValue(
43998
44034
  row,
43999
44035
  String(col.key)
44000
44036
  );
@@ -44437,7 +44473,7 @@ var init_DetailPanel = __esm({
44437
44473
  ...section,
44438
44474
  fields: section.fields.map((field) => {
44439
44475
  if (typeof field === "string") {
44440
- const value = getNestedValue(normalizedData, field);
44476
+ const value = core.getNestedValue(normalizedData, field);
44441
44477
  return {
44442
44478
  label: labelFor(field),
44443
44479
  value: formatFieldValue2(value, field)
@@ -44477,7 +44513,7 @@ var init_DetailPanel = __esm({
44477
44513
  if (otherFields.length > 0) {
44478
44514
  const overviewFields = [];
44479
44515
  otherFields.forEach((field) => {
44480
- const value = getNestedValue(normalizedData, field);
44516
+ const value = core.getNestedValue(normalizedData, field);
44481
44517
  if (value !== void 0 && value !== null) {
44482
44518
  overviewFields.push({
44483
44519
  label: labelFor(field),
@@ -44492,7 +44528,7 @@ var init_DetailPanel = __esm({
44492
44528
  if (progressFields.length > 0 || metricFields.length > 0) {
44493
44529
  const metricsFields = [];
44494
44530
  [...progressFields, ...metricFields].forEach((field) => {
44495
- const value = getNestedValue(normalizedData, field);
44531
+ const value = core.getNestedValue(normalizedData, field);
44496
44532
  if (value !== void 0 && value !== null) {
44497
44533
  metricsFields.push({
44498
44534
  label: labelFor(field),
@@ -44507,7 +44543,7 @@ var init_DetailPanel = __esm({
44507
44543
  if (dateFields.length > 0) {
44508
44544
  const timelineFields = [];
44509
44545
  dateFields.forEach((field) => {
44510
- const value = getNestedValue(normalizedData, field);
44546
+ const value = core.getNestedValue(normalizedData, field);
44511
44547
  if (value !== void 0 && value !== null) {
44512
44548
  timelineFields.push({
44513
44549
  label: labelFor(field),
@@ -44522,7 +44558,7 @@ var init_DetailPanel = __esm({
44522
44558
  if (descriptionFields.length > 0) {
44523
44559
  const descFields = [];
44524
44560
  descriptionFields.forEach((field) => {
44525
- const value = getNestedValue(normalizedData, field);
44561
+ const value = core.getNestedValue(normalizedData, field);
44526
44562
  if (value !== void 0 && value !== null) {
44527
44563
  descFields.push({
44528
44564
  label: labelFor(field),
@@ -44579,7 +44615,7 @@ var init_DetailPanel = __esm({
44579
44615
  for (const section of sections) {
44580
44616
  for (const field of section.fields) {
44581
44617
  if (typeof field === "string") {
44582
- const value = normalizedData ? getNestedValue(normalizedData, field) : void 0;
44618
+ const value = normalizedData ? core.getNestedValue(normalizedData, field) : void 0;
44583
44619
  allFields.push({
44584
44620
  label: labelFor(field),
44585
44621
  value: renderRichFieldValue(value, field, fieldTypeMap[field], metaFor(field))
@@ -44598,7 +44634,7 @@ var init_DetailPanel = __esm({
44598
44634
  normalizedData && effectiveFieldNames && effectiveFieldNames.filter(
44599
44635
  (f3) => f3.toLowerCase().includes("status") || f3.toLowerCase().includes("priority")
44600
44636
  ).map((field) => {
44601
- const value = getNestedValue(normalizedData, field);
44637
+ const value = core.getNestedValue(normalizedData, field);
44602
44638
  if (!value) return null;
44603
44639
  return /* @__PURE__ */ jsxRuntime.jsx(
44604
44640
  Badge,
@@ -44729,7 +44765,7 @@ var init_DetailPanel = __esm({
44729
44765
  normalizedData && effectiveFieldNames && effectiveFieldNames.filter(
44730
44766
  (f3) => f3.toLowerCase().includes("progress") || f3.toLowerCase().includes("percent")
44731
44767
  ).map((field) => {
44732
- const value = getNestedValue(normalizedData, field);
44768
+ const value = core.getNestedValue(normalizedData, field);
44733
44769
  if (value === void 0 || value === null || typeof value !== "number")
44734
44770
  return null;
44735
44771
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", className: "w-full", children: [
@@ -46551,14 +46587,14 @@ var init_List = __esm({
46551
46587
  };
46552
46588
  if (effectiveFieldNames && effectiveFieldNames.length > 0) {
46553
46589
  const firstField = effectiveFieldNames[0];
46554
- if (!normalizedItem.title && getNestedValue(item, firstField)) {
46590
+ if (!normalizedItem.title && core.getNestedValue(item, firstField)) {
46555
46591
  normalizedItem.title = String(
46556
- getNestedValue(item, firstField)
46592
+ core.getNestedValue(item, firstField)
46557
46593
  );
46558
46594
  }
46559
46595
  normalizedItem._fields = effectiveFieldNames.reduce(
46560
46596
  (acc, field) => {
46561
- const value = getNestedValue(item, field);
46597
+ const value = core.getNestedValue(item, field);
46562
46598
  if (value !== void 0 && value !== null) {
46563
46599
  acc[field] = value;
46564
46600
  }
@@ -52451,15 +52487,19 @@ function runTickFrame(entityId, orderedWriters, store) {
52451
52487
  }
52452
52488
  var log3 = logger.createLogger("almadar:ui:effects:client-handlers");
52453
52489
  function createClientEffectHandlers(options) {
52454
- const { eventBus, slotSetter, navigate, navigateBack, notify, callService, liveEntity } = options;
52490
+ const { eventBus, slotSetter, navigate, navigateBack, notify, callService, liveEntity, persistDelegated } = options;
52455
52491
  return {
52456
52492
  emit: (event, payload, source) => {
52457
52493
  const prefixedEvent = event.startsWith("UI:") ? event : `UI:${event}`;
52458
52494
  eventBus.emit(prefixedEvent, payload, source);
52459
52495
  },
52460
52496
  persist: async () => {
52461
- log3.warn("persist is server-side only, ignored on client");
52497
+ log3.debug("persist is server-side only, ignored on client");
52462
52498
  },
52499
+ // Bridge mode: the server runs every persist and the response
52500
+ // carries its outcome — tell the executor so the placeholder above is
52501
+ // never read as a denial (see `EffectHandlers.persistDelegated`).
52502
+ ...persistDelegated === true ? { persistDelegated: true } : {},
52463
52503
  // @almadar/runtime EffectHandlers.set types value:unknown — should be FieldValue (upstream fix queued)
52464
52504
  set: ((_entityId, field, value) => {
52465
52505
  if (!liveEntity) {
@@ -52728,7 +52768,6 @@ var SYNC_TICK_OPERATORS = /* @__PURE__ */ new Set([
52728
52768
  "do",
52729
52769
  "when"
52730
52770
  ]);
52731
- var LIFECYCLE_EVENTS = ["INIT", "LOAD", "$MOUNT"];
52732
52771
  function toTraitDefinition(binding) {
52733
52772
  return {
52734
52773
  name: binding.trait.name,
@@ -52768,17 +52807,14 @@ function classifySharedTick(tick) {
52768
52807
  if (renders) return "renderer";
52769
52808
  return "neither";
52770
52809
  }
52771
- function buildTraitRenderConfig(binding, traitConfigsByName, payload) {
52810
+ function buildTraitRenderConfig(binding, traitConfigsByName) {
52772
52811
  const declaredDefaults = runtime.collectDeclaredConfigDefaults(binding.trait);
52773
52812
  const resolvedDefaults = traitConfigsByName?.[binding.trait.name];
52774
52813
  const callSiteConfig = getBindingConfig(binding);
52775
- const callSiteOverrides = callSiteConfig ? runtime.resolveCallSitePayloadCaptures(
52776
- Object.fromEntries(
52777
- Object.entries(callSiteConfig).filter(
52778
- ([, v]) => !containsConfigForward(v)
52779
- )
52780
- ),
52781
- payload
52814
+ const callSiteOverrides = callSiteConfig ? Object.fromEntries(
52815
+ Object.entries(callSiteConfig).filter(
52816
+ ([, v]) => !containsConfigForward(v)
52817
+ )
52782
52818
  ) : void 0;
52783
52819
  if (declaredDefaults || resolvedDefaults || callSiteOverrides) {
52784
52820
  return {
@@ -52849,12 +52885,40 @@ function evalFieldDefault(value) {
52849
52885
  return value;
52850
52886
  }
52851
52887
  }
52888
+ function isPersistTraceAction(value) {
52889
+ return value === "create" || value === "update" || value === "delete" || value === "batch";
52890
+ }
52891
+ function overlayServerEffectResults(effectTraces, serverResults) {
52892
+ if (serverResults.length === 0) return effectTraces;
52893
+ const queues = /* @__PURE__ */ new Map();
52894
+ for (const result of serverResults) {
52895
+ const queue = queues.get(result.effect);
52896
+ if (queue) queue.push(result);
52897
+ else queues.set(result.effect, [result]);
52898
+ }
52899
+ return effectTraces.map((trace) => {
52900
+ const match = queues.get(trace.type)?.shift();
52901
+ if (!match) return trace;
52902
+ const resultId = match.data && typeof match.data === "object" && !Array.isArray(match.data) ? match.data.id : void 0;
52903
+ const outcome = match.success ? "success" : match.denied ? "denied" : "failed";
52904
+ return {
52905
+ ...trace,
52906
+ ...match.entityType !== void 0 ? { entityName: match.entityType } : {},
52907
+ ...match.action !== void 0 && isPersistTraceAction(match.action) ? { action: match.action } : {},
52908
+ ...resultId !== void 0 ? { resultId } : {},
52909
+ outcome,
52910
+ status: match.success ? "executed" : "failed",
52911
+ ...match.error !== void 0 ? { error: match.error } : {}
52912
+ };
52913
+ });
52914
+ }
52852
52915
  function useTraitStateMachine(traitBindings, uiSlots, options) {
52853
52916
  sharedEntityLog.debug("useTraitStateMachine start", { traitBindingsCount: traitBindings.length, traitNames: traitBindings.map((b) => b.trait.name) });
52854
52917
  const eventBus = useEventBus();
52855
52918
  const { entities } = providers.useEntitySchema();
52856
52919
  const traitConfigsByName = options?.traitConfigsByName;
52857
52920
  const orbitalsByTrait = options?.orbitalsByTrait;
52921
+ const callsiteCaptureChildrenByTrait = options?.callsiteCaptureChildrenByTrait;
52858
52922
  const sharedEntityStore = useSharedEntityStore();
52859
52923
  const sharedGroups = React87.useMemo(() => {
52860
52924
  const groups = /* @__PURE__ */ new Map();
@@ -53112,7 +53176,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53112
53176
  };
53113
53177
  }, [traitBindings]);
53114
53178
  const executeTransitionEffects = React87.useCallback(async (params) => {
53115
- const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log11 } = params;
53179
+ const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log11, callsitePayload } = params;
53116
53180
  const traitName = binding.trait.name;
53117
53181
  const linkedEntity = binding.linkedEntity || "";
53118
53182
  const entityId = payload?.entityId;
@@ -53134,7 +53198,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53134
53198
  const effects = syncOnly ? params.effects.filter(
53135
53199
  (e) => Array.isArray(e) && SYNC_TICK_OPERATORS.has(String(e[0]))
53136
53200
  ) : params.effects;
53137
- if (effects.length === 0) return [];
53201
+ if (effects.length === 0) return { emitted: [], serverEffectResults: [] };
53138
53202
  const pendingSlots = /* @__PURE__ */ new Map();
53139
53203
  ({
53140
53204
  traitDefinition: binding.trait
@@ -53171,10 +53235,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53171
53235
  // the trait's one live store — the same object bound below. This is
53172
53236
  // what makes a [runtime] entity's set (from ticks AND events) reach
53173
53237
  // the render-ui + next tick + guards.
53174
- liveEntity
53238
+ liveEntity,
53239
+ // No local persistence adapter (bridge mode, or a syncOnly tick):
53240
+ // nothing persists client-side, the server owns the write and
53241
+ // reports it — never read the placeholder as a denial.
53242
+ persistDelegated: (syncOnly ? void 0 : optionsRef.current?.persistence) === void 0
53175
53243
  });
53176
53244
  const persistence = syncOnly ? void 0 : optionsRef.current?.persistence;
53177
53245
  let handlers = clientHandlers;
53246
+ const serverEffectResults = [];
53178
53247
  if (persistence) {
53179
53248
  const sharedBindings = {
53180
53249
  // Seed `@entity` from the trait's scalar field state (a real
@@ -53186,16 +53255,16 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53186
53255
  payload: payload || {},
53187
53256
  state: previousState
53188
53257
  };
53258
+ if (callsitePayload) {
53259
+ sharedBindings.callsitePayload = callsitePayload;
53260
+ }
53189
53261
  const sharedDeclared = runtime.collectDeclaredConfigDefaults(binding.trait);
53190
53262
  const sharedResolved = traitConfigsByName?.[traitName];
53191
53263
  const sharedCallSiteRaw = getBindingConfig(binding);
53192
- const sharedCallSite = sharedCallSiteRaw ? runtime.resolveCallSitePayloadCaptures(
53193
- Object.fromEntries(
53194
- Object.entries(sharedCallSiteRaw).filter(
53195
- ([, v]) => !containsConfigForward(v)
53196
- )
53197
- ),
53198
- payload || {}
53264
+ const sharedCallSite = sharedCallSiteRaw ? Object.fromEntries(
53265
+ Object.entries(sharedCallSiteRaw).filter(
53266
+ ([, v]) => !containsConfigForward(v)
53267
+ )
53199
53268
  ) : void 0;
53200
53269
  if (sharedDeclared || sharedResolved || sharedCallSite) {
53201
53270
  sharedBindings.config = {
@@ -53219,7 +53288,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53219
53288
  },
53220
53289
  source: { trait: traitName },
53221
53290
  // @almadar/runtime callService types params:unknown/Promise<unknown> — should be ServiceParams/EventPayload (upstream fix queued)
53222
- callService: optionsRef.current?.callService
53291
+ callService: optionsRef.current?.callService,
53292
+ effectResults: serverEffectResults
53223
53293
  });
53224
53294
  handlers = {
53225
53295
  ...serverHandlers,
@@ -53254,7 +53324,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53254
53324
  payload: payload || {},
53255
53325
  state: previousState
53256
53326
  };
53257
- const renderConfig = buildTraitRenderConfig(binding, traitConfigsByName, payload || {});
53327
+ if (callsitePayload) {
53328
+ bindingCtx.callsitePayload = callsitePayload;
53329
+ }
53330
+ const renderConfig = buildTraitRenderConfig(binding, traitConfigsByName);
53258
53331
  if (renderConfig !== void 0) {
53259
53332
  bindingCtx.config = renderConfig;
53260
53333
  }
@@ -53345,8 +53418,42 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53345
53418
  effectCount: effects.length
53346
53419
  });
53347
53420
  }
53348
- return emittedDuringExec;
53421
+ return { emitted: emittedDuringExec, serverEffectResults };
53349
53422
  }, [eventBus, flushSlot, sharedEntityStore, publishBindingSnapshot, orbitalsByTrait]);
53423
+ const reRenderCallsiteCaptureChildren = React87.useCallback(async (traitName, callsitePayload, entityByTrait, log11, visited = /* @__PURE__ */ new Set()) => {
53424
+ const children = callsiteCaptureChildrenByTrait?.get(traitName);
53425
+ if (!children || children.size === 0) return;
53426
+ const mgr = managerRef.current;
53427
+ const bindingMap = new Map(traitBindingsRef.current.map((b) => [b.trait.name, b]));
53428
+ for (const childName of children) {
53429
+ if (visited.has(childName)) continue;
53430
+ visited.add(childName);
53431
+ const childBinding = bindingMap.get(childName);
53432
+ if (!childBinding) continue;
53433
+ const lifecycleEvent = runtime.LIFECYCLE_EVENTS.find((evt) => mgr.canHandleEvent(childName, evt));
53434
+ if (lifecycleEvent === void 0) continue;
53435
+ const [entry] = mgr.sendEvent(lifecycleEvent, {}, void 0, entityByTrait, void 0, childName);
53436
+ if (!entry || !entry.result.executed) continue;
53437
+ log11.debug("callsite-capture-child:rerender", {
53438
+ referrer: traitName,
53439
+ child: childName,
53440
+ lifecycleEvent,
53441
+ callsitePayload: JSON.stringify(callsitePayload)
53442
+ });
53443
+ await executeTransitionEffects({
53444
+ binding: childBinding,
53445
+ effects: entry.result.effects,
53446
+ previousState: entry.result.previousState,
53447
+ newState: entry.result.newState,
53448
+ payload: {},
53449
+ flushEvent: lifecycleEvent,
53450
+ syncOnly: false,
53451
+ log: log11,
53452
+ callsitePayload
53453
+ });
53454
+ await reRenderCallsiteCaptureChildren(childName, callsitePayload, entityByTrait, log11, visited);
53455
+ }
53456
+ }, [callsiteCaptureChildrenByTrait, executeTransitionEffects]);
53350
53457
  const runTickEffects = React87.useCallback((tick, binding) => {
53351
53458
  const traitName = binding.trait.name;
53352
53459
  const currentState = traitStatesRef.current.get(traitName)?.currentState ?? "";
@@ -53484,6 +53591,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53484
53591
  executedTraits: results.map((r) => r.traitName).join(",")
53485
53592
  });
53486
53593
  const emittedByTrait = /* @__PURE__ */ new Map();
53594
+ const serverEffectResultsByTrait = /* @__PURE__ */ new Map();
53487
53595
  bridgeEchoPendingRef.current.clear();
53488
53596
  for (const { traitName, result } of results) {
53489
53597
  const binding = bindingMap.get(traitName);
@@ -53528,7 +53636,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53528
53636
  effects: JSON.stringify(result.effects)
53529
53637
  }));
53530
53638
  const _perfT2 = ui.perfStart("processEvent:executeAll");
53531
- const emittedDuringExec = await executeTransitionEffects({
53639
+ const { emitted: emittedDuringExec, serverEffectResults: transitionServerEffectResults } = await executeTransitionEffects({
53532
53640
  binding,
53533
53641
  // upstream gap: /runtime TransitionResult.effects is unknown[] — they are SExpr at runtime (see Almadar_UI_Gaps.md)
53534
53642
  effects: result.effects,
@@ -53541,12 +53649,14 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53541
53649
  });
53542
53650
  ui.perfEnd("processEvent:executeAll", _perfT2);
53543
53651
  emittedByTrait.set(traitName, emittedDuringExec);
53652
+ serverEffectResultsByTrait.set(traitName, transitionServerEffectResults);
53544
53653
  for (const emittedKey of emittedDuringExec) {
53545
53654
  bridgeEchoPendingRef.current.set(
53546
53655
  emittedKey,
53547
53656
  (bridgeEchoPendingRef.current.get(emittedKey) ?? 0) + 1
53548
53657
  );
53549
53658
  }
53659
+ await reRenderCallsiteCaptureChildren(traitName, payload ?? {}, entityByTrait, stateLog);
53550
53660
  } else if (!result.executed) {
53551
53661
  if (result.guardResult === false) {
53552
53662
  stateLog.debug("guard-blocked-transition", {
@@ -53575,7 +53685,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53575
53685
  for (const { traitName, result } of results) {
53576
53686
  if (result.executed) {
53577
53687
  updateTraitState(traitName, result.newState);
53578
- const effectTraces = result.effects.map(
53688
+ const reconstructedEffectTraces = result.effects.map(
53579
53689
  (e) => {
53580
53690
  if (Array.isArray(e)) {
53581
53691
  const head = String(e[0] ?? "unknown");
@@ -53594,6 +53704,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53594
53704
  };
53595
53705
  }
53596
53706
  );
53707
+ const effectTraces = overlayServerEffectResults(
53708
+ reconstructedEffectTraces,
53709
+ serverEffectResultsByTrait.get(traitName) ?? []
53710
+ );
53597
53711
  const emittedEvents = emittedByTrait.get(traitName) ?? [];
53598
53712
  recordTransition({
53599
53713
  traitName,
@@ -53640,7 +53754,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53640
53754
  }
53641
53755
  ui.perfEnd("processEvent:total", _perfT0);
53642
53756
  ui.perfEnd(`event:${normalizedEvent}`, _perfT0);
53643
- }, [entities, eventBus, sharedEntityStore]);
53757
+ }, [entities, eventBus, sharedEntityStore, reRenderCallsiteCaptureChildren]);
53644
53758
  const drainEventQueue = React87.useCallback(async () => {
53645
53759
  if (processingRef.current) return;
53646
53760
  processingRef.current = true;
@@ -53695,7 +53809,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53695
53809
  if (!orbitalName) continue;
53696
53810
  for (const transition of binding.trait.transitions) {
53697
53811
  const eventKey = transition.event;
53698
- if (LIFECYCLE_EVENTS.includes(eventKey)) {
53812
+ if (runtime.LIFECYCLE_EVENTS.includes(eventKey)) {
53699
53813
  continue;
53700
53814
  }
53701
53815
  const selfBusKey = `UI:${orbitalName}.${traitName}.${eventKey}`;
@@ -53725,7 +53839,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53725
53839
  for (const binding of traitBindings) {
53726
53840
  for (const transition of binding.trait.transitions) {
53727
53841
  const eventKey = transition.event;
53728
- if (LIFECYCLE_EVENTS.includes(eventKey)) continue;
53842
+ if (runtime.LIFECYCLE_EVENTS.includes(eventKey)) continue;
53729
53843
  if (bareCascadeKeys.has(eventKey)) continue;
53730
53844
  bareCascadeKeys.add(eventKey);
53731
53845
  const bareKey = `UI:${eventKey}`;
@@ -53789,7 +53903,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53789
53903
  const eventsToFire = /* @__PURE__ */ new Set();
53790
53904
  for (const binding of traitBindings) {
53791
53905
  const traitName = binding.trait.name;
53792
- const lifecycleEvent = LIFECYCLE_EVENTS.find(
53906
+ const lifecycleEvent = runtime.LIFECYCLE_EVENTS.find(
53793
53907
  (evt) => mgr.canHandleEvent(traitName, evt)
53794
53908
  );
53795
53909
  if (lifecycleEvent !== void 0) {
@@ -53815,7 +53929,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
53815
53929
  getConfig: (traitName) => {
53816
53930
  const binding = traitBindingsRef.current.find((b) => b.trait.name === traitName);
53817
53931
  if (binding === void 0) return void 0;
53818
- return buildTraitRenderConfig(binding, traitConfigsByName, {});
53932
+ return buildTraitRenderConfig(binding, traitConfigsByName);
53819
53933
  },
53820
53934
  getState: (traitName) => traitStatesRef.current.get(traitName)?.currentState ?? "",
53821
53935
  subscribe: (traitName, callback) => {
@@ -53967,6 +54081,23 @@ function normalizeChild(child) {
53967
54081
  props: { ...rest, ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {} }
53968
54082
  };
53969
54083
  }
54084
+ function effectResultsToTraces(results) {
54085
+ if (!results) return [];
54086
+ return results.map((r) => {
54087
+ const resultId = r.data !== void 0 && r.data !== null && "id" in r.data && typeof r.data.id === "string" ? r.data.id : void 0;
54088
+ const outcome = r.denied ? "denied" : r.success ? "success" : "failed";
54089
+ return {
54090
+ type: r.effect,
54091
+ ...r.entityType !== void 0 ? { entityName: r.entityType } : {},
54092
+ ...r.action !== void 0 && (r.action === "create" || r.action === "update" || r.action === "delete" || r.action === "batch") ? { action: r.action } : {},
54093
+ ...resultId !== void 0 ? { resultId } : {},
54094
+ outcome,
54095
+ args: [],
54096
+ status: outcome === "success" ? "executed" : "failed",
54097
+ error: r.error
54098
+ };
54099
+ });
54100
+ }
53970
54101
  function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraits, onNavigateBack) {
53971
54102
  for (const eff of effects) {
53972
54103
  if (eff.type === "render-ui" && eff.slot && eff.pattern) {
@@ -54048,7 +54179,7 @@ function NavStackRefBridge({ apiRef }) {
54048
54179
  }, [api, apiRef]);
54049
54180
  return null;
54050
54181
  }
54051
- function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, serverActiveTraits, children }) {
54182
+ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
54052
54183
  const bridge = providers.useServerBridge();
54053
54184
  const activeTraitNames = React87.useMemo(
54054
54185
  () => new Set(traits2.map((b) => b.trait.name).filter((n) => !!n)),
@@ -54077,12 +54208,12 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
54077
54208
  continue;
54078
54209
  }
54079
54210
  void bridge.sendEvent(name, event, withActiveTraits(payload)).then(({ effects, meta }) => {
54080
- recordServerResponse(name, event, meta);
54211
+ recordServerResponse(name, event, { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
54081
54212
  applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNames, onNavigateBack);
54082
54213
  });
54083
54214
  }
54084
54215
  }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits]);
54085
- const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, navigateBack: onNavigateBack, traitConfigsByName, orbitalsByTrait, embeddedTraits, initPayload: routeParams } : { navigate: onNavigate, navigateBack: onNavigateBack, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, initPayload: routeParams };
54216
+ const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, navigateBack: onNavigateBack, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams } : { navigate: onNavigate, navigateBack: onNavigateBack, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams };
54086
54217
  const { sendEvent, entityBindingSource } = useTraitStateMachine(traits2, uiSlots, opts);
54087
54218
  const initSentRef = React87.useRef(false);
54088
54219
  const prevTraitsRef = React87.useRef(void 0);
@@ -54124,7 +54255,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
54124
54255
  (async () => {
54125
54256
  for (const name of orbitalNames) {
54126
54257
  const { effects, meta } = await bridge.sendEvent(name, "INIT", withActiveTraits({ ...routeParams ?? {} }));
54127
- recordServerResponse(name, "INIT", meta);
54258
+ recordServerResponse(name, "INIT", { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
54128
54259
  const effectTraces = [
54129
54260
  { type: "fetch", args: [], status: "executed" },
54130
54261
  ...effects.map((eff) => ({
@@ -54257,6 +54388,18 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
54257
54388
  () => core.buildResolvedTraitConfigs(schema),
54258
54389
  [schema]
54259
54390
  );
54391
+ const callsiteCaptureChildrenByTrait = React87.useMemo(() => {
54392
+ const merged = /* @__PURE__ */ new Map();
54393
+ const orbitals = schema?.orbitals;
54394
+ if (orbitals) {
54395
+ for (const orbital of orbitals) {
54396
+ for (const [referrer, children] of core.collectCallsiteCaptureChildren(orbital)) {
54397
+ merged.set(referrer, children);
54398
+ }
54399
+ }
54400
+ }
54401
+ return merged;
54402
+ }, [schema]);
54260
54403
  const embeddedTraits = React87.useMemo(() => {
54261
54404
  const set = ui.collectEmbeddedTraits(schema);
54262
54405
  xOrbitalLog.info("SchemaRunner:embeddedTraits", {
@@ -54293,6 +54436,7 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
54293
54436
  traitConfigsByName,
54294
54437
  orbitalsByTrait,
54295
54438
  embeddedTraits,
54439
+ callsiteCaptureChildrenByTrait,
54296
54440
  serverActiveTraits,
54297
54441
  onNavigate,
54298
54442
  onNavigateBack,