@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
@@ -18,6 +18,7 @@ var reactRouterDom = require('react-router-dom');
18
18
  var SyntaxHighlighter = require('react-syntax-highlighter/dist/esm/prism-light.js');
19
19
  var dark = require('react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js');
20
20
  var syntax = require('@almadar/syntax');
21
+ var i18n = require('@almadar/core/i18n');
21
22
  var langJson = require('react-syntax-highlighter/dist/esm/languages/prism/json.js');
22
23
  var langJavascript = require('react-syntax-highlighter/dist/esm/languages/prism/javascript.js');
23
24
  var langTypescript = require('react-syntax-highlighter/dist/esm/languages/prism/typescript.js');
@@ -10909,8 +10910,9 @@ function getTransitions2() {
10909
10910
  return [...getState().transitions];
10910
10911
  }
10911
10912
  function recordServerResponse(orbitalName, event, response) {
10913
+ const { effectResults, ...responseFields } = response;
10912
10914
  const serverResponse = {
10913
- ...response,
10915
+ ...responseFields,
10914
10916
  orbitalName,
10915
10917
  timestamp: Date.now()
10916
10918
  };
@@ -10920,7 +10922,7 @@ function recordServerResponse(orbitalName, event, response) {
10920
10922
  from: "server",
10921
10923
  to: "server",
10922
10924
  event,
10923
- effects: [],
10925
+ effects: effectResults ?? [],
10924
10926
  serverResponse,
10925
10927
  timestamp: Date.now()
10926
10928
  };
@@ -20825,6 +20827,15 @@ function buildLineProps(errorLines, extraClassName) {
20825
20827
  };
20826
20828
  };
20827
20829
  }
20830
+ function translateProgram(source, language, lang) {
20831
+ if (lang === "en") return source;
20832
+ if (language === "lolo") return syntax.translateLolo(source, lang);
20833
+ if (language === "orb") {
20834
+ const translated = syntax.translateOrb(source, lang);
20835
+ return typeof translated === "string" ? translated : source;
20836
+ }
20837
+ return source;
20838
+ }
20828
20839
  var dynamicallyLoaded, codeLanguageLoader, orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log4, 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;
20829
20840
  var init_CodeBlock = __esm({
20830
20841
  "components/core/molecules/markdown/CodeBlock.tsx"() {
@@ -21090,6 +21101,7 @@ var init_CodeBlock = __esm({
21090
21101
  showLineNumbers = false,
21091
21102
  wordWrap = false,
21092
21103
  files,
21104
+ naturalLanguages,
21093
21105
  actions,
21094
21106
  isLoading = false,
21095
21107
  error,
@@ -21136,7 +21148,48 @@ var init_CodeBlock = __esm({
21136
21148
  "replace"
21137
21149
  ]
21138
21150
  }) => {
21139
- const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
21151
+ const englishCode = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
21152
+ const naturalTabs = !editable && naturalLanguages && naturalLanguages.length > 1 ? naturalLanguages : void 0;
21153
+ const [naturalLanguage, setNaturalLanguage] = React96.useState(() => naturalTabs?.[0] ?? "en");
21154
+ const activeNaturalLanguage = naturalTabs?.includes(naturalLanguage) === true ? naturalLanguage : naturalTabs?.[0] ?? "en";
21155
+ const translationCache = React96.useMemo(() => /* @__PURE__ */ new Map(), [englishCode, files]);
21156
+ const translateFor = React96.useCallback(
21157
+ (source, sourceLanguage, cacheKey) => {
21158
+ if (activeNaturalLanguage === "en") return source;
21159
+ const key = `${cacheKey}|${sourceLanguage}|${activeNaturalLanguage}`;
21160
+ const hit = translationCache.get(key);
21161
+ if (hit !== void 0) return hit;
21162
+ const translated = translateProgram(source, sourceLanguage, activeNaturalLanguage);
21163
+ translationCache.set(key, translated);
21164
+ return translated;
21165
+ },
21166
+ [translationCache, activeNaturalLanguage]
21167
+ );
21168
+ const code = translateFor(englishCode, language, "code");
21169
+ const naturalTabItems = naturalTabs?.map((lang) => ({
21170
+ id: `lang-${lang}`,
21171
+ label: i18n.coreTables[lang].meta.name,
21172
+ content: null
21173
+ }));
21174
+ const naturalTabStrip = naturalTabs && naturalTabItems ? /* @__PURE__ */ jsxRuntime.jsx(
21175
+ Box,
21176
+ {
21177
+ className: "border-b border-border",
21178
+ dir: i18n.coreTables[activeNaturalLanguage].meta.rtl ? "rtl" : "ltr",
21179
+ "data-testid": "codeblock-language-tabs",
21180
+ children: /* @__PURE__ */ jsxRuntime.jsx(
21181
+ Tabs,
21182
+ {
21183
+ tabs: naturalTabItems,
21184
+ activeTab: `lang-${activeNaturalLanguage}`,
21185
+ onTabChange: (id) => {
21186
+ const next = naturalTabs.find((lang) => `lang-${lang}` === id);
21187
+ if (next) setNaturalLanguage(next);
21188
+ }
21189
+ }
21190
+ )
21191
+ }
21192
+ ) : null;
21140
21193
  const activeStyle = resolveHighlightStyle(language);
21141
21194
  const overCapacity = code.length > HIGHLIGHT_CAPACITY_BYTES;
21142
21195
  const plainCodeColor = plainCodeColorOf(activeStyle);
@@ -21149,8 +21202,8 @@ var init_CodeBlock = __esm({
21149
21202
  const [wrap, setWrap] = React96.useState(wordWrap);
21150
21203
  const [activeFileIndex, setActiveFileIndex] = React96.useState(0);
21151
21204
  const activeFile = files?.[activeFileIndex];
21152
- const activeCode = activeFile?.code ?? code;
21153
21205
  const activeLanguage = activeFile?.language ?? language;
21206
+ const activeCode = activeFile ? translateFor(activeFile.code, activeLanguage, `file-${activeFileIndex}`) : code;
21154
21207
  const languageReady = useLanguageReady(activeLanguage);
21155
21208
  const viewerStyle = resolveHighlightStyle(activeLanguage);
21156
21209
  const viewerPlainCodeColor = plainCodeColorOf(viewerStyle);
@@ -21635,6 +21688,7 @@ var init_CodeBlock = __esm({
21635
21688
  content: null
21636
21689
  }));
21637
21690
  return /* @__PURE__ */ jsxRuntime.jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
21691
+ naturalTabStrip,
21638
21692
  tabItems && tabItems.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
21639
21693
  Tabs,
21640
21694
  {
@@ -21696,7 +21750,7 @@ var init_CodeBlock = __esm({
21696
21750
  ]
21697
21751
  }
21698
21752
  ),
21699
- /* @__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 }) })
21753
+ /* @__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 }) })
21700
21754
  ] }) });
21701
21755
  }
21702
21756
  const hasHeader = showLanguageBadge || effectiveCopy;
@@ -21723,6 +21777,7 @@ var init_CodeBlock = __esm({
21723
21777
  ]
21724
21778
  }
21725
21779
  ),
21780
+ naturalTabStrip,
21726
21781
  editable ? (
21727
21782
  /* GAP-77 / GAP-82 / GAP-83: editable mode = transparent textarea on
21728
21783
  top of a Prism-highlighted SyntaxHighlighter overlay.
@@ -21874,6 +21929,7 @@ var init_CodeBlock = __esm({
21874
21929
  {
21875
21930
  ref: scrollRef,
21876
21931
  onCopy: handleSelectionCopy,
21932
+ dir: "ltr",
21877
21933
  style: {
21878
21934
  flex: 1,
21879
21935
  minHeight: 0,
@@ -21892,7 +21948,7 @@ var init_CodeBlock = __esm({
21892
21948
  )
21893
21949
  ] });
21894
21950
  },
21895
- (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
21951
+ (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
21896
21952
  );
21897
21953
  CodeBlock.displayName = "CodeBlock";
21898
21954
  }
@@ -25587,26 +25643,6 @@ var init_ButtonGroup = __esm({
25587
25643
  ButtonGroup.displayName = "ButtonGroup";
25588
25644
  }
25589
25645
  });
25590
- function getNestedValue(obj, path) {
25591
- if (obj === null || obj === void 0 || !path) {
25592
- return void 0;
25593
- }
25594
- if (!path.includes(".")) {
25595
- return obj[path];
25596
- }
25597
- const parts = path.split(".");
25598
- let value = obj;
25599
- for (const part of parts) {
25600
- if (value === null || value === void 0) {
25601
- return void 0;
25602
- }
25603
- if (typeof value !== "object" || Array.isArray(value)) {
25604
- return void 0;
25605
- }
25606
- value = value[part];
25607
- }
25608
- return value;
25609
- }
25610
25646
  function resolveImageUrl(value) {
25611
25647
  if (typeof value === "string") {
25612
25648
  return value;
@@ -25734,11 +25770,11 @@ function getWeekDays(start) {
25734
25770
  return days;
25735
25771
  }
25736
25772
  function eventStartDate(event, startField) {
25737
- const raw = getNestedValue(event, startField);
25773
+ const raw = core.getNestedValue(event, startField);
25738
25774
  return new Date(raw ?? "");
25739
25775
  }
25740
25776
  function eventEndDate(event, endField) {
25741
- const raw = getNestedValue(event, endField);
25777
+ const raw = core.getNestedValue(event, endField);
25742
25778
  if (raw === void 0 || raw === null || raw === "") return null;
25743
25779
  const end = new Date(raw);
25744
25780
  return Number.isNaN(end.getTime()) ? null : end;
@@ -25873,8 +25909,8 @@ function CalendarGrid({
25873
25909
  }, [longPressEvent, longPressPayload, eventBus]);
25874
25910
  const renderChip = children ?? renderItem;
25875
25911
  const renderEvent = (event) => {
25876
- const color = getNestedValue(event, colorField);
25877
- const label = String(getNestedValue(event, titleField) ?? "");
25912
+ const color = core.getNestedValue(event, colorField);
25913
+ const label = String(core.getNestedValue(event, titleField) ?? "");
25878
25914
  const eventIndex = evs.indexOf(event);
25879
25915
  return /* @__PURE__ */ jsxRuntime.jsx(
25880
25916
  Box,
@@ -25995,7 +26031,7 @@ function CalendarGrid({
25995
26031
  children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", children: [
25996
26032
  slotEvents.map(renderEvent),
25997
26033
  continuingEvents.map((event) => {
25998
- const color = getNestedValue(event, colorField);
26034
+ const color = core.getNestedValue(event, colorField);
25999
26035
  return /* @__PURE__ */ jsxRuntime.jsx(
26000
26036
  Box,
26001
26037
  {
@@ -26313,7 +26349,7 @@ var init_CardGrid = __esm({
26313
26349
  e.stopPropagation();
26314
26350
  if (action.navigatesTo) {
26315
26351
  const url = action.navigatesTo.replace(/\{\{row\.(\w+(?:\.\w+)*)\}\}/g, (_, field) => {
26316
- const value = getNestedValue(itemData, field);
26352
+ const value = core.getNestedValue(itemData, field);
26317
26353
  return value !== void 0 && value !== null ? String(value) : "";
26318
26354
  });
26319
26355
  eventBus.emit("UI:NAVIGATE", { url, row: itemData });
@@ -26346,8 +26382,8 @@ var init_CardGrid = __esm({
26346
26382
  return normalizedData.map((item, index) => {
26347
26383
  const itemData = item;
26348
26384
  const id = itemData.id || String(index);
26349
- const titleValue = titleField ? getNestedValue(itemData, titleField) : void 0;
26350
- const statusValue = statusField ? getNestedValue(itemData, statusField) : void 0;
26385
+ const titleValue = titleField ? core.getNestedValue(itemData, titleField) : void 0;
26386
+ const statusValue = statusField ? core.getNestedValue(itemData, statusField) : void 0;
26351
26387
  return /* @__PURE__ */ jsxRuntime.jsxs(
26352
26388
  Box,
26353
26389
  {
@@ -26362,7 +26398,7 @@ var init_CardGrid = __esm({
26362
26398
  actionPayload: { row: itemData },
26363
26399
  children: [
26364
26400
  imageField && (() => {
26365
- const imgUrl = resolveImageUrl(getNestedValue(itemData, imageField));
26401
+ const imgUrl = resolveImageUrl(core.getNestedValue(itemData, imageField));
26366
26402
  if (!imgUrl) return null;
26367
26403
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
26368
26404
  "img",
@@ -26394,7 +26430,7 @@ var init_CardGrid = __esm({
26394
26430
  )) })
26395
26431
  ] }) }),
26396
26432
  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) => {
26397
- const value = getNestedValue(itemData, field);
26433
+ const value = core.getNestedValue(itemData, field);
26398
26434
  if (value === void 0 || value === null || value === "") return null;
26399
26435
  const fieldValue = value;
26400
26436
  const boolVal = asBooleanValue(fieldValue);
@@ -30555,7 +30591,7 @@ function DataGrid({
30555
30591
  )
30556
30592
  );
30557
30593
  }
30558
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
30594
+ const titleValue = core.getNestedValue(itemData, titleField?.name ?? "");
30559
30595
  return wrapDnd(
30560
30596
  /* @__PURE__ */ jsxRuntime.jsxs(
30561
30597
  Box,
@@ -30574,7 +30610,7 @@ function DataGrid({
30574
30610
  ),
30575
30611
  children: [
30576
30612
  imageField && (() => {
30577
- const imgUrl = resolveImageUrl(getNestedValue(itemData, imageField));
30613
+ const imgUrl = resolveImageUrl(core.getNestedValue(itemData, imageField));
30578
30614
  if (!imgUrl) return null;
30579
30615
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
30580
30616
  "img",
@@ -30611,7 +30647,7 @@ function DataGrid({
30611
30647
  )
30612
30648
  ] }),
30613
30649
  badgeFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
30614
- const val = getNestedValue(itemData, field.name);
30650
+ const val = core.getNestedValue(itemData, field.name);
30615
30651
  if (val === void 0 || val === null || val === "") return null;
30616
30652
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
30617
30653
  field.icon && renderIconInput(field.icon, { size: "xs" }),
@@ -30652,12 +30688,12 @@ function DataGrid({
30652
30688
  ] }) }),
30653
30689
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 pt-2 pb-4 flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", children: [
30654
30690
  bodyFields.filter((f3) => f3.variant === "caption" && f3.format !== "boolean").map((field) => {
30655
- const value = getNestedValue(itemData, field.name);
30691
+ const value = core.getNestedValue(itemData, field.name);
30656
30692
  if (value === void 0 || value === null || value === "") return null;
30657
30693
  return /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", color: "secondary", className: "line-clamp-2", children: formatValue(value, field.format) }, field.name);
30658
30694
  }),
30659
30695
  /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "md", className: "flex-wrap gap-y-1", children: bodyFields.filter((f3) => f3.variant !== "caption" || f3.format === "boolean").map((field) => {
30660
- const value = getNestedValue(itemData, field.name);
30696
+ const value = core.getNestedValue(itemData, field.name);
30661
30697
  if (value === void 0 || value === null || value === "") return null;
30662
30698
  if (field.format === "boolean") {
30663
30699
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
@@ -30775,7 +30811,7 @@ function formatValue2(value, format, boolLabels) {
30775
30811
  function groupData(items, field) {
30776
30812
  const groups = /* @__PURE__ */ new Map();
30777
30813
  for (const item of items) {
30778
- const key = String(getNestedValue(item, field) ?? "");
30814
+ const key = String(core.getNestedValue(item, field) ?? "");
30779
30815
  const group = groups.get(key);
30780
30816
  if (group) group.push(item);
30781
30817
  else groups.set(key, [item]);
@@ -30968,7 +31004,7 @@ function DataList({
30968
31004
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
30969
31005
  const senderLabel = (itemData, raw) => {
30970
31006
  if (!senderLabelField) return raw;
30971
- const v = getNestedValue(itemData, senderLabelField);
31007
+ const v = core.getNestedValue(itemData, senderLabelField);
30972
31008
  return v === void 0 || v === null || v === "" ? raw : String(v);
30973
31009
  };
30974
31010
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", className: cn("py-2", className), children: [
@@ -30976,11 +31012,11 @@ function DataList({
30976
31012
  group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
30977
31013
  group.items.map((itemData, index) => {
30978
31014
  const id = itemData.id || `${gi}-${index}`;
30979
- const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
31015
+ const sender = senderField ? String(core.getNestedValue(itemData, senderField) ?? "") : "";
30980
31016
  const isSent = Boolean(currentUser && sender === currentUser);
30981
- const content = getNestedValue(itemData, contentField);
31017
+ const content = core.getNestedValue(itemData, contentField);
30982
31018
  const timestampField = fieldDefs.find((f3) => f3.format === "date");
30983
- const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
31019
+ const timestamp = timestampField ? core.getNestedValue(itemData, timestampField.name) : null;
30984
31020
  const metaFields = fieldDefs.filter(
30985
31021
  (f3) => f3.name !== contentField && f3.name !== timestampField?.name
30986
31022
  );
@@ -31006,7 +31042,7 @@ function DataList({
31006
31042
  !isSent && senderField && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "font-semibold mb-0.5", children: senderLabel(itemData, sender) }),
31007
31043
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", className: cn(isSent && "text-primary-foreground"), children: content !== void 0 && content !== null ? String(content) : "" }),
31008
31044
  metaFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1 flex-wrap", children: metaFields.map((f3) => {
31009
- const v = getNestedValue(itemData, f3.name);
31045
+ const v = core.getNestedValue(itemData, f3.name);
31010
31046
  if (v === void 0 || v === null || v === "") return null;
31011
31047
  return f3.variant === "badge" ? (
31012
31048
  // `format` applies here too — a boolean field badged
@@ -31094,7 +31130,7 @@ function DataList({
31094
31130
  );
31095
31131
  }
31096
31132
  const id = itemData.id || String(index);
31097
- const titleValue = getNestedValue(itemData, titleField?.name ?? "");
31133
+ const titleValue = core.getNestedValue(itemData, titleField?.name ?? "");
31098
31134
  return wrapDnd(
31099
31135
  /* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-entity-row": true, "data-entity-id": id, onClick: rowClickEvent ? handleRowClick(itemData) : void 0, className: cn(rowClickEvent && "cursor-pointer"), children: [
31100
31136
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -31123,7 +31159,7 @@ function DataList({
31123
31159
  }
31124
31160
  ),
31125
31161
  badgeFields.map((field) => {
31126
- const val = getNestedValue(itemData, field.name);
31162
+ const val = core.getNestedValue(itemData, field.name);
31127
31163
  if (val === void 0 || val === null) return null;
31128
31164
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
31129
31165
  field.icon && renderIconInput2(field.icon, { size: "xs" }),
@@ -31132,7 +31168,7 @@ function DataList({
31132
31168
  })
31133
31169
  ] }),
31134
31170
  bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "md", className: cn("flex-wrap", isCompact ? "mt-0.5" : "mt-1.5"), children: bodyFields.map((field) => {
31135
- const value = getNestedValue(itemData, field.name);
31171
+ const value = core.getNestedValue(itemData, field.name);
31136
31172
  if (value === void 0 || value === null || value === "") return null;
31137
31173
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center", children: [
31138
31174
  field.icon && renderIconInput2(field.icon, { size: "xs", className: "text-muted-foreground" }),
@@ -31152,7 +31188,7 @@ function DataList({
31152
31188
  ] }, field.name);
31153
31189
  }) }),
31154
31190
  progressFields.map((field) => {
31155
- const value = getNestedValue(itemData, field.name);
31191
+ const value = core.getNestedValue(itemData, field.name);
31156
31192
  if (typeof value !== "number") return null;
31157
31193
  return /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "mt-2 max-w-xs", children: [
31158
31194
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "items-center mb-1", children: [
@@ -37601,7 +37637,7 @@ function statusVariant4(value) {
37601
37637
  function groupData2(items, field) {
37602
37638
  const groups = /* @__PURE__ */ new Map();
37603
37639
  for (const item of items) {
37604
- const key = String(getNestedValue(item, field) ?? "");
37640
+ const key = String(core.getNestedValue(item, field) ?? "");
37605
37641
  const group = groups.get(key);
37606
37642
  if (group) group.push(item);
37607
37643
  else groups.set(key, [item]);
@@ -37717,7 +37753,7 @@ function TableView({
37717
37753
  const colFloors = React96__namespace.default.useMemo(
37718
37754
  () => colDefs.map((col) => {
37719
37755
  const longest = data.reduce((widest, row) => {
37720
- const cell = formatCell(asFieldValue(getNestedValue(row, col.field ?? col.key)), col.format);
37756
+ const cell = formatCell(asFieldValue(core.getNestedValue(row, col.field ?? col.key)), col.format);
37721
37757
  return Math.max(widest, cell.length);
37722
37758
  }, columnLabel(col).length);
37723
37759
  const chrome = col.format === "badge" ? BADGE_CHROME_CH : 0;
@@ -37809,7 +37845,7 @@ function TableView({
37809
37845
  }
37810
37846
  ) }),
37811
37847
  hasRenderProp ? /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 min-w-0", children: children(row, index) }) : colDefs.map((col) => {
37812
- const raw = asFieldValue(getNestedValue(row, col.field ?? col.key));
37848
+ const raw = asFieldValue(core.getNestedValue(row, col.field ?? col.key));
37813
37849
  const cellBase = cn(
37814
37850
  "flex items-center min-w-0",
37815
37851
  alignClass[col.align ?? "left"],
@@ -41876,7 +41912,7 @@ function DocumentDetails({
41876
41912
  };
41877
41913
  const renderValue = (field) => {
41878
41914
  const name = fieldName(field);
41879
- const raw = getNestedValue(entity ?? {}, name);
41915
+ const raw = core.getNestedValue(entity ?? {}, name);
41880
41916
  const kind = fieldKind(field, raw);
41881
41917
  const label = field.label ?? field.header ?? humanizeFieldName(name);
41882
41918
  if (kind === "image") {
@@ -44174,11 +44210,11 @@ var init_WizardContainer = __esm({
44174
44210
  });
44175
44211
  function calculateComplexity(schema) {
44176
44212
  if (!schema) return 1;
44177
- const entities = schema.dataEntities?.length || 0;
44213
+ const entities = schema.dataEntities || 0;
44178
44214
  const pages = schema.ui?.pages?.length || 0;
44179
- const traits2 = schema.traits?.length || 0;
44215
+ const traits2 = schema.traits || 0;
44180
44216
  const sections = schema.ui?.pages?.reduce(
44181
- (acc, page) => acc + (page.sections?.length || 0),
44217
+ (acc, page) => acc + (page.sections || 0),
44182
44218
  0
44183
44219
  ) || 0;
44184
44220
  return entities * 3 + pages * 2 + traits2 * 2 + sections * 1;
@@ -46496,7 +46532,7 @@ function DataTable({
46496
46532
  }
46497
46533
  ) }),
46498
46534
  normalizedColumns.map((col) => {
46499
- const cellValue = getNestedValue(
46535
+ const cellValue = core.getNestedValue(
46500
46536
  row,
46501
46537
  String(col.key)
46502
46538
  );
@@ -46939,7 +46975,7 @@ var init_DetailPanel = __esm({
46939
46975
  ...section,
46940
46976
  fields: section.fields.map((field) => {
46941
46977
  if (typeof field === "string") {
46942
- const value = getNestedValue(normalizedData, field);
46978
+ const value = core.getNestedValue(normalizedData, field);
46943
46979
  return {
46944
46980
  label: labelFor(field),
46945
46981
  value: formatFieldValue2(value, field)
@@ -46979,7 +47015,7 @@ var init_DetailPanel = __esm({
46979
47015
  if (otherFields.length > 0) {
46980
47016
  const overviewFields = [];
46981
47017
  otherFields.forEach((field) => {
46982
- const value = getNestedValue(normalizedData, field);
47018
+ const value = core.getNestedValue(normalizedData, field);
46983
47019
  if (value !== void 0 && value !== null) {
46984
47020
  overviewFields.push({
46985
47021
  label: labelFor(field),
@@ -46994,7 +47030,7 @@ var init_DetailPanel = __esm({
46994
47030
  if (progressFields.length > 0 || metricFields.length > 0) {
46995
47031
  const metricsFields = [];
46996
47032
  [...progressFields, ...metricFields].forEach((field) => {
46997
- const value = getNestedValue(normalizedData, field);
47033
+ const value = core.getNestedValue(normalizedData, field);
46998
47034
  if (value !== void 0 && value !== null) {
46999
47035
  metricsFields.push({
47000
47036
  label: labelFor(field),
@@ -47009,7 +47045,7 @@ var init_DetailPanel = __esm({
47009
47045
  if (dateFields.length > 0) {
47010
47046
  const timelineFields = [];
47011
47047
  dateFields.forEach((field) => {
47012
- const value = getNestedValue(normalizedData, field);
47048
+ const value = core.getNestedValue(normalizedData, field);
47013
47049
  if (value !== void 0 && value !== null) {
47014
47050
  timelineFields.push({
47015
47051
  label: labelFor(field),
@@ -47024,7 +47060,7 @@ var init_DetailPanel = __esm({
47024
47060
  if (descriptionFields.length > 0) {
47025
47061
  const descFields = [];
47026
47062
  descriptionFields.forEach((field) => {
47027
- const value = getNestedValue(normalizedData, field);
47063
+ const value = core.getNestedValue(normalizedData, field);
47028
47064
  if (value !== void 0 && value !== null) {
47029
47065
  descFields.push({
47030
47066
  label: labelFor(field),
@@ -47081,7 +47117,7 @@ var init_DetailPanel = __esm({
47081
47117
  for (const section of sections) {
47082
47118
  for (const field of section.fields) {
47083
47119
  if (typeof field === "string") {
47084
- const value = normalizedData ? getNestedValue(normalizedData, field) : void 0;
47120
+ const value = normalizedData ? core.getNestedValue(normalizedData, field) : void 0;
47085
47121
  allFields.push({
47086
47122
  label: labelFor(field),
47087
47123
  value: renderRichFieldValue(value, field, fieldTypeMap[field], metaFor(field))
@@ -47100,7 +47136,7 @@ var init_DetailPanel = __esm({
47100
47136
  normalizedData && effectiveFieldNames && effectiveFieldNames.filter(
47101
47137
  (f3) => f3.toLowerCase().includes("status") || f3.toLowerCase().includes("priority")
47102
47138
  ).map((field) => {
47103
- const value = getNestedValue(normalizedData, field);
47139
+ const value = core.getNestedValue(normalizedData, field);
47104
47140
  if (!value) return null;
47105
47141
  return /* @__PURE__ */ jsxRuntime.jsx(
47106
47142
  Badge,
@@ -47231,7 +47267,7 @@ var init_DetailPanel = __esm({
47231
47267
  normalizedData && effectiveFieldNames && effectiveFieldNames.filter(
47232
47268
  (f3) => f3.toLowerCase().includes("progress") || f3.toLowerCase().includes("percent")
47233
47269
  ).map((field) => {
47234
- const value = getNestedValue(normalizedData, field);
47270
+ const value = core.getNestedValue(normalizedData, field);
47235
47271
  if (value === void 0 || value === null || typeof value !== "number")
47236
47272
  return null;
47237
47273
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", className: "w-full", children: [
@@ -49053,14 +49089,14 @@ var init_List = __esm({
49053
49089
  };
49054
49090
  if (effectiveFieldNames && effectiveFieldNames.length > 0) {
49055
49091
  const firstField = effectiveFieldNames[0];
49056
- if (!normalizedItem.title && getNestedValue(item, firstField)) {
49092
+ if (!normalizedItem.title && core.getNestedValue(item, firstField)) {
49057
49093
  normalizedItem.title = String(
49058
- getNestedValue(item, firstField)
49094
+ core.getNestedValue(item, firstField)
49059
49095
  );
49060
49096
  }
49061
49097
  normalizedItem._fields = effectiveFieldNames.reduce(
49062
49098
  (acc, field) => {
49063
- const value = getNestedValue(item, field);
49099
+ const value = core.getNestedValue(item, field);
49064
49100
  if (value !== void 0 && value !== null) {
49065
49101
  acc[field] = value;
49066
49102
  }
@@ -58499,15 +58535,19 @@ function runTickFrame(entityId, orderedWriters, store) {
58499
58535
  }
58500
58536
  var log9 = logger.createLogger("almadar:ui:effects:client-handlers");
58501
58537
  function createClientEffectHandlers(options) {
58502
- const { eventBus, slotSetter, navigate, navigateBack, notify, callService, liveEntity } = options;
58538
+ const { eventBus, slotSetter, navigate, navigateBack, notify, callService, liveEntity, persistDelegated } = options;
58503
58539
  return {
58504
58540
  emit: (event, payload, source) => {
58505
58541
  const prefixedEvent = event.startsWith("UI:") ? event : `UI:${event}`;
58506
58542
  eventBus.emit(prefixedEvent, payload, source);
58507
58543
  },
58508
58544
  persist: async () => {
58509
- log9.warn("persist is server-side only, ignored on client");
58545
+ log9.debug("persist is server-side only, ignored on client");
58510
58546
  },
58547
+ // Bridge mode: the server runs every persist and the response
58548
+ // carries its outcome — tell the executor so the placeholder above is
58549
+ // never read as a denial (see `EffectHandlers.persistDelegated`).
58550
+ ...persistDelegated === true ? { persistDelegated: true } : {},
58511
58551
  // @almadar/runtime EffectHandlers.set types value:unknown — should be FieldValue (upstream fix queued)
58512
58552
  set: ((_entityId, field, value) => {
58513
58553
  if (!liveEntity) {
@@ -58604,7 +58644,6 @@ var SYNC_TICK_OPERATORS = /* @__PURE__ */ new Set([
58604
58644
  "do",
58605
58645
  "when"
58606
58646
  ]);
58607
- var LIFECYCLE_EVENTS = ["INIT", "LOAD", "$MOUNT"];
58608
58647
  function toTraitDefinition(binding) {
58609
58648
  return {
58610
58649
  name: binding.trait.name,
@@ -58644,17 +58683,14 @@ function classifySharedTick(tick) {
58644
58683
  if (renders) return "renderer";
58645
58684
  return "neither";
58646
58685
  }
58647
- function buildTraitRenderConfig(binding, traitConfigsByName, payload) {
58686
+ function buildTraitRenderConfig(binding, traitConfigsByName) {
58648
58687
  const declaredDefaults = runtime.collectDeclaredConfigDefaults(binding.trait);
58649
58688
  const resolvedDefaults = traitConfigsByName?.[binding.trait.name];
58650
58689
  const callSiteConfig = getBindingConfig(binding);
58651
- const callSiteOverrides = callSiteConfig ? runtime.resolveCallSitePayloadCaptures(
58652
- Object.fromEntries(
58653
- Object.entries(callSiteConfig).filter(
58654
- ([, v]) => !containsConfigForward(v)
58655
- )
58656
- ),
58657
- payload
58690
+ const callSiteOverrides = callSiteConfig ? Object.fromEntries(
58691
+ Object.entries(callSiteConfig).filter(
58692
+ ([, v]) => !containsConfigForward(v)
58693
+ )
58658
58694
  ) : void 0;
58659
58695
  if (declaredDefaults || resolvedDefaults || callSiteOverrides) {
58660
58696
  return {
@@ -58725,12 +58761,40 @@ function evalFieldDefault(value) {
58725
58761
  return value;
58726
58762
  }
58727
58763
  }
58764
+ function isPersistTraceAction(value) {
58765
+ return value === "create" || value === "update" || value === "delete" || value === "batch";
58766
+ }
58767
+ function overlayServerEffectResults(effectTraces, serverResults) {
58768
+ if (serverResults.length === 0) return effectTraces;
58769
+ const queues = /* @__PURE__ */ new Map();
58770
+ for (const result of serverResults) {
58771
+ const queue = queues.get(result.effect);
58772
+ if (queue) queue.push(result);
58773
+ else queues.set(result.effect, [result]);
58774
+ }
58775
+ return effectTraces.map((trace) => {
58776
+ const match = queues.get(trace.type)?.shift();
58777
+ if (!match) return trace;
58778
+ const resultId = match.data && typeof match.data === "object" && !Array.isArray(match.data) ? match.data.id : void 0;
58779
+ const outcome = match.success ? "success" : match.denied ? "denied" : "failed";
58780
+ return {
58781
+ ...trace,
58782
+ ...match.entityType !== void 0 ? { entityName: match.entityType } : {},
58783
+ ...match.action !== void 0 && isPersistTraceAction(match.action) ? { action: match.action } : {},
58784
+ ...resultId !== void 0 ? { resultId } : {},
58785
+ outcome,
58786
+ status: match.success ? "executed" : "failed",
58787
+ ...match.error !== void 0 ? { error: match.error } : {}
58788
+ };
58789
+ });
58790
+ }
58728
58791
  function useTraitStateMachine(traitBindings, uiSlots, options) {
58729
58792
  sharedEntityLog.debug("useTraitStateMachine start", { traitBindingsCount: traitBindings.length, traitNames: traitBindings.map((b) => b.trait.name) });
58730
58793
  const eventBus = useEventBus();
58731
58794
  const { entities } = providers.useEntitySchema();
58732
58795
  const traitConfigsByName = options?.traitConfigsByName;
58733
58796
  const orbitalsByTrait = options?.orbitalsByTrait;
58797
+ const callsiteCaptureChildrenByTrait = options?.callsiteCaptureChildrenByTrait;
58734
58798
  const sharedEntityStore = useSharedEntityStore();
58735
58799
  const sharedGroups = React96.useMemo(() => {
58736
58800
  const groups = /* @__PURE__ */ new Map();
@@ -58988,7 +59052,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
58988
59052
  };
58989
59053
  }, [traitBindings]);
58990
59054
  const executeTransitionEffects = React96.useCallback(async (params) => {
58991
- const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log12 } = params;
59055
+ const { binding, previousState, newState, payload, flushEvent, syncOnly, log: log12, callsitePayload } = params;
58992
59056
  const traitName = binding.trait.name;
58993
59057
  const linkedEntity = binding.linkedEntity || "";
58994
59058
  const entityId = payload?.entityId;
@@ -59010,7 +59074,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59010
59074
  const effects = syncOnly ? params.effects.filter(
59011
59075
  (e) => Array.isArray(e) && SYNC_TICK_OPERATORS.has(String(e[0]))
59012
59076
  ) : params.effects;
59013
- if (effects.length === 0) return [];
59077
+ if (effects.length === 0) return { emitted: [], serverEffectResults: [] };
59014
59078
  const pendingSlots = /* @__PURE__ */ new Map();
59015
59079
  ({
59016
59080
  traitDefinition: binding.trait
@@ -59047,10 +59111,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59047
59111
  // the trait's one live store — the same object bound below. This is
59048
59112
  // what makes a [runtime] entity's set (from ticks AND events) reach
59049
59113
  // the render-ui + next tick + guards.
59050
- liveEntity
59114
+ liveEntity,
59115
+ // No local persistence adapter (bridge mode, or a syncOnly tick):
59116
+ // nothing persists client-side, the server owns the write and
59117
+ // reports it — never read the placeholder as a denial.
59118
+ persistDelegated: (syncOnly ? void 0 : optionsRef.current?.persistence) === void 0
59051
59119
  });
59052
59120
  const persistence = syncOnly ? void 0 : optionsRef.current?.persistence;
59053
59121
  let handlers = clientHandlers;
59122
+ const serverEffectResults = [];
59054
59123
  if (persistence) {
59055
59124
  const sharedBindings = {
59056
59125
  // Seed `@entity` from the trait's scalar field state (a real
@@ -59062,16 +59131,16 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59062
59131
  payload: payload || {},
59063
59132
  state: previousState
59064
59133
  };
59134
+ if (callsitePayload) {
59135
+ sharedBindings.callsitePayload = callsitePayload;
59136
+ }
59065
59137
  const sharedDeclared = runtime.collectDeclaredConfigDefaults(binding.trait);
59066
59138
  const sharedResolved = traitConfigsByName?.[traitName];
59067
59139
  const sharedCallSiteRaw = getBindingConfig(binding);
59068
- const sharedCallSite = sharedCallSiteRaw ? runtime.resolveCallSitePayloadCaptures(
59069
- Object.fromEntries(
59070
- Object.entries(sharedCallSiteRaw).filter(
59071
- ([, v]) => !containsConfigForward(v)
59072
- )
59073
- ),
59074
- payload || {}
59140
+ const sharedCallSite = sharedCallSiteRaw ? Object.fromEntries(
59141
+ Object.entries(sharedCallSiteRaw).filter(
59142
+ ([, v]) => !containsConfigForward(v)
59143
+ )
59075
59144
  ) : void 0;
59076
59145
  if (sharedDeclared || sharedResolved || sharedCallSite) {
59077
59146
  sharedBindings.config = {
@@ -59095,7 +59164,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59095
59164
  },
59096
59165
  source: { trait: traitName },
59097
59166
  // @almadar/runtime callService types params:unknown/Promise<unknown> — should be ServiceParams/EventPayload (upstream fix queued)
59098
- callService: optionsRef.current?.callService
59167
+ callService: optionsRef.current?.callService,
59168
+ effectResults: serverEffectResults
59099
59169
  });
59100
59170
  handlers = {
59101
59171
  ...serverHandlers,
@@ -59130,7 +59200,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59130
59200
  payload: payload || {},
59131
59201
  state: previousState
59132
59202
  };
59133
- const renderConfig = buildTraitRenderConfig(binding, traitConfigsByName, payload || {});
59203
+ if (callsitePayload) {
59204
+ bindingCtx.callsitePayload = callsitePayload;
59205
+ }
59206
+ const renderConfig = buildTraitRenderConfig(binding, traitConfigsByName);
59134
59207
  if (renderConfig !== void 0) {
59135
59208
  bindingCtx.config = renderConfig;
59136
59209
  }
@@ -59221,8 +59294,42 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59221
59294
  effectCount: effects.length
59222
59295
  });
59223
59296
  }
59224
- return emittedDuringExec;
59297
+ return { emitted: emittedDuringExec, serverEffectResults };
59225
59298
  }, [eventBus, flushSlot, sharedEntityStore, publishBindingSnapshot, orbitalsByTrait]);
59299
+ const reRenderCallsiteCaptureChildren = React96.useCallback(async (traitName, callsitePayload, entityByTrait, log12, visited = /* @__PURE__ */ new Set()) => {
59300
+ const children = callsiteCaptureChildrenByTrait?.get(traitName);
59301
+ if (!children || children.size === 0) return;
59302
+ const mgr = managerRef.current;
59303
+ const bindingMap = new Map(traitBindingsRef.current.map((b) => [b.trait.name, b]));
59304
+ for (const childName of children) {
59305
+ if (visited.has(childName)) continue;
59306
+ visited.add(childName);
59307
+ const childBinding = bindingMap.get(childName);
59308
+ if (!childBinding) continue;
59309
+ const lifecycleEvent = runtime.LIFECYCLE_EVENTS.find((evt) => mgr.canHandleEvent(childName, evt));
59310
+ if (lifecycleEvent === void 0) continue;
59311
+ const [entry] = mgr.sendEvent(lifecycleEvent, {}, void 0, entityByTrait, void 0, childName);
59312
+ if (!entry || !entry.result.executed) continue;
59313
+ log12.debug("callsite-capture-child:rerender", {
59314
+ referrer: traitName,
59315
+ child: childName,
59316
+ lifecycleEvent,
59317
+ callsitePayload: JSON.stringify(callsitePayload)
59318
+ });
59319
+ await executeTransitionEffects({
59320
+ binding: childBinding,
59321
+ effects: entry.result.effects,
59322
+ previousState: entry.result.previousState,
59323
+ newState: entry.result.newState,
59324
+ payload: {},
59325
+ flushEvent: lifecycleEvent,
59326
+ syncOnly: false,
59327
+ log: log12,
59328
+ callsitePayload
59329
+ });
59330
+ await reRenderCallsiteCaptureChildren(childName, callsitePayload, entityByTrait, log12, visited);
59331
+ }
59332
+ }, [callsiteCaptureChildrenByTrait, executeTransitionEffects]);
59226
59333
  const runTickEffects = React96.useCallback((tick, binding) => {
59227
59334
  const traitName = binding.trait.name;
59228
59335
  const currentState = traitStatesRef.current.get(traitName)?.currentState ?? "";
@@ -59360,6 +59467,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59360
59467
  executedTraits: results.map((r2) => r2.traitName).join(",")
59361
59468
  });
59362
59469
  const emittedByTrait = /* @__PURE__ */ new Map();
59470
+ const serverEffectResultsByTrait = /* @__PURE__ */ new Map();
59363
59471
  bridgeEchoPendingRef.current.clear();
59364
59472
  for (const { traitName, result } of results) {
59365
59473
  const binding = bindingMap.get(traitName);
@@ -59404,7 +59512,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59404
59512
  effects: JSON.stringify(result.effects)
59405
59513
  }));
59406
59514
  const _perfT2 = ui.perfStart("processEvent:executeAll");
59407
- const emittedDuringExec = await executeTransitionEffects({
59515
+ const { emitted: emittedDuringExec, serverEffectResults: transitionServerEffectResults } = await executeTransitionEffects({
59408
59516
  binding,
59409
59517
  // upstream gap: /runtime TransitionResult.effects is unknown[] — they are SExpr at runtime (see Almadar_UI_Gaps.md)
59410
59518
  effects: result.effects,
@@ -59417,12 +59525,14 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59417
59525
  });
59418
59526
  ui.perfEnd("processEvent:executeAll", _perfT2);
59419
59527
  emittedByTrait.set(traitName, emittedDuringExec);
59528
+ serverEffectResultsByTrait.set(traitName, transitionServerEffectResults);
59420
59529
  for (const emittedKey of emittedDuringExec) {
59421
59530
  bridgeEchoPendingRef.current.set(
59422
59531
  emittedKey,
59423
59532
  (bridgeEchoPendingRef.current.get(emittedKey) ?? 0) + 1
59424
59533
  );
59425
59534
  }
59535
+ await reRenderCallsiteCaptureChildren(traitName, payload ?? {}, entityByTrait, stateLog);
59426
59536
  } else if (!result.executed) {
59427
59537
  if (result.guardResult === false) {
59428
59538
  stateLog.debug("guard-blocked-transition", {
@@ -59451,7 +59561,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59451
59561
  for (const { traitName, result } of results) {
59452
59562
  if (result.executed) {
59453
59563
  updateTraitState(traitName, result.newState);
59454
- const effectTraces = result.effects.map(
59564
+ const reconstructedEffectTraces = result.effects.map(
59455
59565
  (e) => {
59456
59566
  if (Array.isArray(e)) {
59457
59567
  const head = String(e[0] ?? "unknown");
@@ -59470,6 +59580,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59470
59580
  };
59471
59581
  }
59472
59582
  );
59583
+ const effectTraces = overlayServerEffectResults(
59584
+ reconstructedEffectTraces,
59585
+ serverEffectResultsByTrait.get(traitName) ?? []
59586
+ );
59473
59587
  const emittedEvents = emittedByTrait.get(traitName) ?? [];
59474
59588
  recordTransition({
59475
59589
  traitName,
@@ -59516,7 +59630,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59516
59630
  }
59517
59631
  ui.perfEnd("processEvent:total", _perfT0);
59518
59632
  ui.perfEnd(`event:${normalizedEvent}`, _perfT0);
59519
- }, [entities, eventBus, sharedEntityStore]);
59633
+ }, [entities, eventBus, sharedEntityStore, reRenderCallsiteCaptureChildren]);
59520
59634
  const drainEventQueue = React96.useCallback(async () => {
59521
59635
  if (processingRef.current) return;
59522
59636
  processingRef.current = true;
@@ -59571,7 +59685,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59571
59685
  if (!orbitalName) continue;
59572
59686
  for (const transition of binding.trait.transitions) {
59573
59687
  const eventKey = transition.event;
59574
- if (LIFECYCLE_EVENTS.includes(eventKey)) {
59688
+ if (runtime.LIFECYCLE_EVENTS.includes(eventKey)) {
59575
59689
  continue;
59576
59690
  }
59577
59691
  const selfBusKey = `UI:${orbitalName}.${traitName}.${eventKey}`;
@@ -59601,7 +59715,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59601
59715
  for (const binding of traitBindings) {
59602
59716
  for (const transition of binding.trait.transitions) {
59603
59717
  const eventKey = transition.event;
59604
- if (LIFECYCLE_EVENTS.includes(eventKey)) continue;
59718
+ if (runtime.LIFECYCLE_EVENTS.includes(eventKey)) continue;
59605
59719
  if (bareCascadeKeys.has(eventKey)) continue;
59606
59720
  bareCascadeKeys.add(eventKey);
59607
59721
  const bareKey = `UI:${eventKey}`;
@@ -59665,7 +59779,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59665
59779
  const eventsToFire = /* @__PURE__ */ new Set();
59666
59780
  for (const binding of traitBindings) {
59667
59781
  const traitName = binding.trait.name;
59668
- const lifecycleEvent = LIFECYCLE_EVENTS.find(
59782
+ const lifecycleEvent = runtime.LIFECYCLE_EVENTS.find(
59669
59783
  (evt) => mgr.canHandleEvent(traitName, evt)
59670
59784
  );
59671
59785
  if (lifecycleEvent !== void 0) {
@@ -59691,7 +59805,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
59691
59805
  getConfig: (traitName) => {
59692
59806
  const binding = traitBindingsRef.current.find((b) => b.trait.name === traitName);
59693
59807
  if (binding === void 0) return void 0;
59694
- return buildTraitRenderConfig(binding, traitConfigsByName, {});
59808
+ return buildTraitRenderConfig(binding, traitConfigsByName);
59695
59809
  },
59696
59810
  getState: (traitName) => traitStatesRef.current.get(traitName)?.currentState ?? "",
59697
59811
  subscribe: (traitName, callback) => {
@@ -59740,6 +59854,23 @@ function normalizeChild(child) {
59740
59854
  props: { ...rest, ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {} }
59741
59855
  };
59742
59856
  }
59857
+ function effectResultsToTraces(results) {
59858
+ if (!results) return [];
59859
+ return results.map((r2) => {
59860
+ const resultId = r2.data !== void 0 && r2.data !== null && "id" in r2.data && typeof r2.data.id === "string" ? r2.data.id : void 0;
59861
+ const outcome = r2.denied ? "denied" : r2.success ? "success" : "failed";
59862
+ return {
59863
+ type: r2.effect,
59864
+ ...r2.entityType !== void 0 ? { entityName: r2.entityType } : {},
59865
+ ...r2.action !== void 0 && (r2.action === "create" || r2.action === "update" || r2.action === "delete" || r2.action === "batch") ? { action: r2.action } : {},
59866
+ ...resultId !== void 0 ? { resultId } : {},
59867
+ outcome,
59868
+ args: [],
59869
+ status: outcome === "success" ? "executed" : "failed",
59870
+ error: r2.error
59871
+ };
59872
+ });
59873
+ }
59743
59874
  function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraits, onNavigateBack) {
59744
59875
  for (const eff of effects) {
59745
59876
  if (eff.type === "render-ui" && eff.slot && eff.pattern) {
@@ -59821,7 +59952,7 @@ function NavStackRefBridge({ apiRef }) {
59821
59952
  }, [api, apiRef]);
59822
59953
  return null;
59823
59954
  }
59824
- function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, serverActiveTraits, children }) {
59955
+ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
59825
59956
  const bridge = providers.useServerBridge();
59826
59957
  const activeTraitNames = React96.useMemo(
59827
59958
  () => new Set(traits2.map((b) => b.trait.name).filter((n) => !!n)),
@@ -59850,12 +59981,12 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
59850
59981
  continue;
59851
59982
  }
59852
59983
  void bridge.sendEvent(name, event, withActiveTraits(payload)).then(({ effects, meta }) => {
59853
- recordServerResponse(name, event, meta);
59984
+ recordServerResponse(name, event, { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
59854
59985
  applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNames, onNavigateBack);
59855
59986
  });
59856
59987
  }
59857
59988
  }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits]);
59858
- const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, navigateBack: onNavigateBack, traitConfigsByName, orbitalsByTrait, embeddedTraits, initPayload: routeParams } : { navigate: onNavigate, navigateBack: onNavigateBack, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, initPayload: routeParams };
59989
+ 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 };
59859
59990
  const { sendEvent, entityBindingSource } = useTraitStateMachine(traits2, uiSlots, opts);
59860
59991
  const initSentRef = React96.useRef(false);
59861
59992
  const prevTraitsRef = React96.useRef(void 0);
@@ -59897,7 +60028,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
59897
60028
  (async () => {
59898
60029
  for (const name of orbitalNames) {
59899
60030
  const { effects, meta } = await bridge.sendEvent(name, "INIT", withActiveTraits({ ...routeParams ?? {} }));
59900
- recordServerResponse(name, "INIT", meta);
60031
+ recordServerResponse(name, "INIT", { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
59901
60032
  const effectTraces = [
59902
60033
  { type: "fetch", args: [], status: "executed" },
59903
60034
  ...effects.map((eff) => ({
@@ -60030,6 +60161,18 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
60030
60161
  () => core.buildResolvedTraitConfigs(schema),
60031
60162
  [schema]
60032
60163
  );
60164
+ const callsiteCaptureChildrenByTrait = React96.useMemo(() => {
60165
+ const merged = /* @__PURE__ */ new Map();
60166
+ const orbitals = schema?.orbitals;
60167
+ if (orbitals) {
60168
+ for (const orbital of orbitals) {
60169
+ for (const [referrer, children] of core.collectCallsiteCaptureChildren(orbital)) {
60170
+ merged.set(referrer, children);
60171
+ }
60172
+ }
60173
+ }
60174
+ return merged;
60175
+ }, [schema]);
60033
60176
  const embeddedTraits = React96.useMemo(() => {
60034
60177
  const set = ui.collectEmbeddedTraits(schema);
60035
60178
  xOrbitalLog.info("SchemaRunner:embeddedTraits", {
@@ -60066,6 +60209,7 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
60066
60209
  traitConfigsByName,
60067
60210
  orbitalsByTrait,
60068
60211
  embeddedTraits,
60212
+ callsiteCaptureChildrenByTrait,
60069
60213
  serverActiveTraits,
60070
60214
  onNavigate,
60071
60215
  onNavigateBack,
@@ -60741,7 +60885,7 @@ function generateMockPayload(payloadSchema, schema, linkedEntity, mockData) {
60741
60885
  cur[parts[parts.length - 1]] = value;
60742
60886
  };
60743
60887
  for (const field of payloadSchema) {
60744
- let value = valueForType(field.type, field.entityType);
60888
+ let value = valueForType(field.type, field.entity);
60745
60889
  if (linkedFirstRow !== void 0 && field.name.includes(".") && (typeof value === "string" || typeof value === "number" || typeof value === "boolean")) {
60746
60890
  const tail = field.name.split(".").pop();
60747
60891
  const fromRow = linkedFirstRow[tail];