@almadar/ui 6.52.0 → 6.53.1

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 (64) hide show
  1. package/dist/{EntityBindingContext-BbxrwSb9.d.ts → AwaitingSkeletonContext-Bh399p1x.d.ts} +17 -2
  2. package/dist/{Canvas3DHost-CWO0tswb.d.ts → Canvas3DHost-B-y2TNij.d.ts} +1 -1
  3. package/dist/{GameAudioProvider-_hPzjqp-.d.ts → GameAudioProvider-DyBvYP2c.d.ts} +1 -1
  4. package/dist/Typography-7QEWUTW3.js +5 -0
  5. package/dist/{UISlotRenderer-CR7SCAMR.js → UISlotRenderer-P7A4SZSK.js} +10 -10
  6. package/dist/avl/index.cjs +40157 -39958
  7. package/dist/avl/index.d.ts +5 -2
  8. package/dist/avl/index.js +34 -21
  9. package/dist/{chunk-XUSSAWKL.js → chunk-2LFBQ4IS.js} +1 -1
  10. package/dist/{chunk-QWDKMVLX.js → chunk-53VTY5CC.js} +141 -82
  11. package/dist/{chunk-MSBMVG3B.js → chunk-6O37FCX4.js} +1 -0
  12. package/dist/{chunk-WB2A6V3I.js → chunk-7KSLPY56.js} +49 -1
  13. package/dist/{chunk-BHZG4PDZ.js → chunk-7LM6I3NA.js} +629 -626
  14. package/dist/{chunk-NCNP2RKZ.js → chunk-E37BYSXY.js} +2 -2
  15. package/dist/{chunk-5GCI6C7J.js → chunk-FUQASYEW.js} +2 -2
  16. package/dist/{chunk-CLSLVFSP.js → chunk-HB4C27KU.js} +2 -2
  17. package/dist/{chunk-EERAGPBW.js → chunk-HUG25TT3.js} +32341 -33067
  18. package/dist/{chunk-TWHYH25Q.js → chunk-JRW33U35.js} +80 -80
  19. package/dist/{chunk-G4GMXYMY.js → chunk-KQXXO42S.js} +93 -171
  20. package/dist/chunk-OKWD7LPO.js +80 -0
  21. package/dist/{chunk-YHY5K2Y7.js → chunk-PEST66PN.js} +6 -0
  22. package/dist/{chunk-V5AGW2JN.js → chunk-QVXLKFUQ.js} +1 -1
  23. package/dist/chunk-UOTYAPV5.js +284 -0
  24. package/dist/{chunk-2QB2PXOO.js → chunk-VHTJRS2N.js} +3 -5
  25. package/dist/components/index.cjs +42813 -42691
  26. package/dist/components/index.d.ts +182 -319
  27. package/dist/components/index.js +621 -13
  28. package/dist/context/index.cjs +8 -3
  29. package/dist/context/index.js +3 -3
  30. package/dist/hooks/index.cjs +56 -4
  31. package/dist/hooks/index.js +7 -7
  32. package/dist/lib/drawable/three/index.cjs +49 -1
  33. package/dist/lib/drawable/three/index.d.ts +5 -5
  34. package/dist/lib/drawable/three/index.js +7 -7
  35. package/dist/lib/index.cjs +50 -1
  36. package/dist/lib/index.d.ts +2 -2
  37. package/dist/lib/index.js +6 -5
  38. package/dist/locales/index.cjs +147 -3
  39. package/dist/locales/index.js +99 -3
  40. package/dist/{paintDispatch-DHo3WhaU.d.ts → paintDispatch-_6EhJCiL.d.ts} +3 -3
  41. package/dist/providers/index.cjs +35850 -35687
  42. package/dist/providers/index.d.ts +33 -8
  43. package/dist/providers/index.js +37 -13
  44. package/dist/renderer/index.cjs +6 -0
  45. package/dist/renderer/index.d.ts +1 -1
  46. package/dist/renderer/index.js +1 -1
  47. package/dist/runtime/index.cjs +42533 -42343
  48. package/dist/runtime/index.d.ts +4 -2
  49. package/dist/runtime/index.js +12 -12
  50. package/dist/ssr/index.cjs +377 -137
  51. package/dist/ssr/index.d.cts +5 -1
  52. package/dist/ssr/index.d.ts +5 -1
  53. package/dist/ssr/index.js +313 -73
  54. package/dist/{verificationRegistry-BYD3cVhS.d.ts → verificationRegistry-CD7Xb40L.d.ts} +1 -1
  55. package/locales/ar.json +49 -1
  56. package/locales/en.json +49 -1
  57. package/locales/sl.json +49 -1
  58. package/package.json +6 -6
  59. package/tailwind-preset.cjs +23 -0
  60. package/themes/_base.css +28 -8
  61. package/themes/_contract.md +5 -0
  62. package/dist/Typography-7FRZOS2H.js +0 -5
  63. package/dist/{avl-3d-context-DLteNEwu.d.ts → avl-3d-context-MAt_NuU9.d.ts} +3 -3
  64. package/dist/{chunk-IN3BVW2Z.js → chunk-64WACXM7.js} +14 -14
@@ -1,7 +1,7 @@
1
1
  import { OperatorCategory } from '@almadar/std';
2
2
  import * as React$1 from 'react';
3
3
  import React__default from 'react';
4
- import { FieldType, EntityPersistence, SExpr, EvalTrace, A11yProps, EventEmit, Expression, UISlot, OrbitalSchema, EntityData, EditFocus, EventPayload, DomainQuestion, DomainQuestionAnswer, ThemeDefinition, CircuitStepResult, GuardEvaluation, EffectTrace } from '@almadar/core';
4
+ import { FieldType, EntityPersistence, SExpr, EvalTrace, A11yProps, EventEmit, Expression, UISlot, OrbitalSchema, EntityData, EditFocus, EventPayload, AriaRole, DomainQuestion, DomainQuestionAnswer, ThemeDefinition, CircuitStepResult, GuardEvaluation, EffectTrace } from '@almadar/core';
5
5
  import { A as AvlNodeData, F as FileTreeItem } from '../FileTree-DUi7e7Z8.js';
6
6
  export { a as AvlEdgeData, b as AvlStateMachine, c as AvlStateMachineProps, B as BehaviorView, M as ModuleCard, s as schemaToFlowGraph } from '../FileTree-DUi7e7Z8.js';
7
7
  import { T as TraitLevelData, d as TraitTransitionInfo, c as TransitionLevelData } from '../avl-schema-parser-C0wnAp5x.js';
@@ -1213,7 +1213,10 @@ interface UseCanvasDraggableArgs {
1213
1213
  }
1214
1214
  interface UseCanvasDraggableResult {
1215
1215
  setNodeRef: (node: HTMLElement | null) => void;
1216
- attributes: ReturnType<typeof useDraggable>['attributes'];
1216
+ /** dnd-kit's attributes, with `role` narrowed to a declared ARIA role so they spread onto a core `Box`. */
1217
+ attributes: Omit<ReturnType<typeof useDraggable>['attributes'], 'role'> & {
1218
+ role?: AriaRole;
1219
+ };
1217
1220
  listeners: ReturnType<typeof useDraggable>['listeners'];
1218
1221
  isDragging: boolean;
1219
1222
  /** Spread on the tile — live transform + grab cursor + touch-action. */
package/dist/avl/index.js CHANGED
@@ -1,28 +1,29 @@
1
- import { BrowserPlayground, collectEmbeddedTraits } from '../chunk-QWDKMVLX.js';
2
- import { zoomReducer, initialZoomState, getBreadcrumbs } from '../chunk-5GCI6C7J.js';
3
- import { useTranslate as useTranslate$1 } from '../chunk-NCNP2RKZ.js';
4
- import '../chunk-DQTV6QVS.js';
5
- import '../chunk-2QB2PXOO.js';
1
+ import { zoomReducer, initialZoomState, getBreadcrumbs } from '../chunk-FUQASYEW.js';
2
+ import { JsonTreeEditor } from '../chunk-UOTYAPV5.js';
3
+ import { useTranslate as useTranslate$1 } from '../chunk-E37BYSXY.js';
6
4
  import { spacingTokenOf, positionOf, withPosition, snapToSpacingStep, defaultSpacingStepPx, spacingOf, withSizing, withSpacing, layoutOf, withLayout, sizingOf, DESIGN_COLOR_TOKENS, DESIGN_RADIUS_TOKENS, DESIGN_SPACING_SCALE, sizeLimitOf, withSizeLimit, isArbitraryClass, tokenOfDesignClass } from '../chunk-ERXIHZW3.js';
7
- import { Popover, Button, Icon, Select, Badge, IconButton, AvlStateMachine, Input, AvlFieldType, AvlEffect, AvlState, AvlPage, AvlEntity, useContainerWidth, useAlmadarDndSensors, almadarDndCollisionDetection, TagInput, Checkbox, Switch, CodeBlock, FileTree, Card, JsonTreeEditor, Accordion, RangeSlider, computeTraitLayout, edgePath, FormField, Radio, useCompactLayout, ButtonGroup, roundedEdgePath } from '../chunk-EERAGPBW.js';
8
- export { AvlEffect, AvlEntity, AvlFieldType, AvlPage, AvlState, AvlStateMachine, BehaviorView, FIELD_TYPE_SHAPES, MiniStateMachine, ModuleCard, computeTraitLayout, edgePath } from '../chunk-EERAGPBW.js';
9
- import { avlSeries, STATE_COLORS, Box, HStack, VStack, avlTint, CONNECTION_COLORS, parseTraitLevel, OPERATOR_CATEGORY_COLORS, AVL_INK, AVL_FONT, parseApplicationLevel, parseOrbitalLevel, getStateRole, effectCategoryOf, EFFECT_CATEGORY_COLORS, pressableProps, traitTransitionRenderUi, traitEventWires, effectZoneOf, avlBlend } from '../chunk-BHZG4PDZ.js';
10
- export { CONNECTION_COLORS, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, STATE_COLORS, effectCategoryOf, getStateRole, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, traitLevelFromTrait } from '../chunk-BHZG4PDZ.js';
11
- import { Typography, INLINE_TEXT_ATTR } from '../chunk-CLSLVFSP.js';
12
- import { usePrefersReducedMotion, useMediaQuery } from '../chunk-TWHYH25Q.js';
5
+ import { BrowserPlayground, collectEmbeddedTraits } from '../chunk-53VTY5CC.js';
6
+ import '../chunk-DQTV6QVS.js';
7
+ import '../chunk-VHTJRS2N.js';
8
+ import { Popover, Button, Icon, Select, Badge, IconButton, AvlStateMachine, Input, AvlFieldType, AvlEffect, AvlState, AvlPage, AvlEntity, useContainerWidth, useAlmadarDndSensors, almadarDndCollisionDetection, TagInput, Checkbox, Switch, CodeBlock, FileTree, Card, Accordion, RangeSlider, computeTraitLayout, edgePath, FormField, Radio, useCompactLayout, ButtonGroup, roundedEdgePath } from '../chunk-HUG25TT3.js';
9
+ export { AvlEffect, AvlEntity, AvlFieldType, AvlPage, AvlState, AvlStateMachine, BehaviorView, FIELD_TYPE_SHAPES, MiniStateMachine, ModuleCard, computeTraitLayout, edgePath } from '../chunk-HUG25TT3.js';
10
+ import '../chunk-PQKU62LK.js';
11
+ import { avlSeries, STATE_COLORS, Box, HStack, VStack, avlTint, CONNECTION_COLORS, parseTraitLevel, OPERATOR_CATEGORY_COLORS, AVL_INK, AVL_FONT, parseApplicationLevel, parseOrbitalLevel, getStateRole, effectCategoryOf, EFFECT_CATEGORY_COLORS, pressableProps, traitTransitionRenderUi, traitEventWires, effectZoneOf, avlBlend } from '../chunk-7LM6I3NA.js';
12
+ export { CONNECTION_COLORS, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, STATE_COLORS, effectCategoryOf, getStateRole, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, traitLevelFromTrait } from '../chunk-7LM6I3NA.js';
13
+ import { Typography, INLINE_TEXT_ATTR } from '../chunk-HB4C27KU.js';
14
+ import { usePrefersReducedMotion, useMediaQuery } from '../chunk-JRW33U35.js';
13
15
  import '../chunk-XJTHMW4G.js';
14
16
  import { useEventBus } from '../chunk-6EV3OEBQ.js';
15
- import { profilerOnRender, perfStart, perfEnd } from '../chunk-G4GMXYMY.js';
17
+ import '../chunk-PEST66PN.js';
18
+ import { profilerOnRender, perfStart, perfEnd } from '../chunk-KQXXO42S.js';
16
19
  import { isEditableTarget } from '../chunk-O7OLVVBR.js';
17
- import { domPassthrough, cn } from '../chunk-IN3BVW2Z.js';
18
- import '../chunk-V5AGW2JN.js';
19
- import '../chunk-WB2A6V3I.js';
20
- import '../chunk-PQKU62LK.js';
21
- import '../chunk-YHY5K2Y7.js';
20
+ import { domPassthrough, cn } from '../chunk-64WACXM7.js';
21
+ import '../chunk-QVXLKFUQ.js';
22
+ import '../chunk-7KSLPY56.js';
22
23
  import '../chunk-QPXIAUJD.js';
23
24
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
24
25
  import React19, { createContext, useContext, useState, useRef, useCallback, useMemo, useEffect, useLayoutEffect, Profiler, useReducer } from 'react';
25
- import { FieldTypeSchema, EFFECT_OPERATORS, isInlineTrait, isPageReference, navigatePatternPath, formatSExpr, answerToMutations, isBinding } from '@almadar/core';
26
+ import { FieldTypeSchema, EFFECT_OPERATORS, isInlineTrait, isPageReference, navigatePatternPath, isAriaRole, formatSExpr, answerToMutations, isBinding } from '@almadar/core';
26
27
  import { operatorVisualForm, getStdOperatorMeta } from '@almadar/std/registry';
27
28
  import { useTranslate } from '@almadar/ui/hooks';
28
29
  import { MarkerType, Handle, Position, useReactFlow, NodeResizeControl, ResizeControlVariant, getBezierPath, EdgeLabelRenderer, BaseEdge, ReactFlow, Controls, Background, BackgroundVariant, ReactFlowProvider, useNodesState, useEdgesState, useNodesInitialized } from '@xyflow/react';
@@ -3475,13 +3476,18 @@ function stateOptionsFor(schema, orbitalName, entityName, transitions, view, moc
3475
3476
  const key = `${s.entry.traitName}|${s.entry.transition.to}`;
3476
3477
  stateUses.set(key, (stateUses.get(key) ?? 0) + 1);
3477
3478
  }
3479
+ const armsSeen = /* @__PURE__ */ new Map();
3478
3480
  return screens.map(({ entry, enteredBy }) => {
3479
3481
  const t = entry.transition;
3480
3482
  const from = String(t.from);
3481
3483
  const state = view === "screens" ? (stateUses.get(`${entry.traitName}|${t.to}`) ?? 0) > 1 ? `${t.to} \xB7 ${t.event}` : t.to : `${t.event}: ${from} \u2192 ${t.to}`;
3482
- const label = manyTraits ? `${entry.traitName} \xB7 ${state}` : state;
3484
+ const baseId = `${entry.traitName}:${t.event}:${from}:${t.to}`;
3485
+ const arm = (armsSeen.get(baseId) ?? 0) + 1;
3486
+ armsSeen.set(baseId, arm);
3487
+ const named = manyTraits ? `${entry.traitName} \xB7 ${state}` : state;
3488
+ const label = arm > 1 ? `${named} (guard ${arm})` : named;
3483
3489
  return {
3484
- id: `${entry.traitName}:${t.event}:${from}:${t.to}`,
3490
+ id: arm > 1 ? `${baseId}#${arm}` : baseId,
3485
3491
  label,
3486
3492
  hint: view === "screens" ? enteredBy.join(" \xB7 ") : entry.traitName,
3487
3493
  data: {
@@ -4516,7 +4522,14 @@ function useCanvasDraggable({
4516
4522
  opacity: isDragging ? 0.5 : 1,
4517
4523
  touchAction: "none"
4518
4524
  };
4519
- return { setNodeRef, attributes, listeners, isDragging, style };
4525
+ const { role, ...ariaAttributes } = attributes;
4526
+ return {
4527
+ setNodeRef,
4528
+ attributes: { ...ariaAttributes, ...isAriaRole(role) ? { role } : {} },
4529
+ listeners,
4530
+ isDragging,
4531
+ style
4532
+ };
4520
4533
  }
4521
4534
  var DEFAULT_ACCEPTS = ["pattern", "behavior"];
4522
4535
  function useCanvasDroppable({
@@ -1,4 +1,4 @@
1
- import { beginPending, endPending } from './chunk-TWHYH25Q.js';
1
+ import { beginPending, endPending } from './chunk-JRW33U35.js';
2
2
  import { useEventBus } from './chunk-6EV3OEBQ.js';
3
3
  import { useState, useCallback, useEffect, useMemo, useRef } from 'react';
4
4
  import { createLogger } from '@almadar/logger';
@@ -1,18 +1,18 @@
1
1
  import { runTickFrame } from './chunk-DQTV6QVS.js';
2
- import { ALL_SLOTS } from './chunk-2QB2PXOO.js';
3
- import { UISlotRenderer } from './chunk-EERAGPBW.js';
4
- import { Box } from './chunk-BHZG4PDZ.js';
5
- import { Typography } from './chunk-CLSLVFSP.js';
6
- import { beginPending, endPending } from './chunk-TWHYH25Q.js';
2
+ import { ALL_SLOTS } from './chunk-VHTJRS2N.js';
3
+ import { UISlotRenderer } from './chunk-HUG25TT3.js';
4
+ import { Box } from './chunk-7LM6I3NA.js';
5
+ import { Typography } from './chunk-HB4C27KU.js';
6
+ import { beginPending, endPending } from './chunk-JRW33U35.js';
7
7
  import { useEventBus } from './chunk-6EV3OEBQ.js';
8
- import { registerTrait, unregisterTrait, perfTimeAsync } from './chunk-G4GMXYMY.js';
8
+ import { isNotificationSlot } from './chunk-PEST66PN.js';
9
+ import { registerTrait, unregisterTrait, perfTimeAsync } from './chunk-KQXXO42S.js';
9
10
  import { bindTraitStateGetter, registerTraitSnapshot, recordTransition, recordingTransport, recordServerResponse } from './chunk-O7OLVVBR.js';
10
- import { isNotificationSlot } from './chunk-YHY5K2Y7.js';
11
11
  import React, { useState, useMemo, useEffect, useRef, useCallback, useSyncExternalStore } from 'react';
12
12
  import { schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, applyListenPayloadMapping, buildResolvedTraitConfigs, collectCallsiteCaptureChildren, walkSExpr, isRenderBindingMarker, containsEntityBinding, isSExpr, isEventPayloadValue, RENDER_BINDING_MARKER } from '@almadar/core';
13
13
  import { createLogger } from '@almadar/logger';
14
- import { LIFECYCLE_EVENTS, InMemoryPersistence, createInProcessTransport, buildTraitIndex, createMemoryCircuitStore, createIndexStageRunner, evaluateOrbitalEvent, createClientKernel, collectListenerTargets, createTickScheduler, isValidCronExpression, parseDurationString, UNMOUNT_EVENT, createClientEffectHandlers, EffectExecutor, isSExpression, collectDeclaredConfigDefaults, createContextFromBindings, normalizeCallSiteConfigToValues } from '@almadar/runtime';
15
- import { useUser, useArbitraryClassStyles, getAllPages, matchPathAmong, CurrentPagePathProvider, NavStackProvider, OrbitalProvider, useNavStack, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, ServerBridgeProvider, useServerBridge, EntityBindingContext } from '@almadar/ui/providers';
14
+ import { collectListenerTargets, LIFECYCLE_EVENTS, InMemoryPersistence, createInProcessTransport, buildTraitIndex, createMemoryCircuitStore, createIndexStageRunner, evaluateOrbitalEvent, createClientKernel, createTickScheduler, isValidCronExpression, parseDurationString, UNMOUNT_EVENT, createClientEffectHandlers, EffectExecutor, isSExpression, collectDeclaredConfigDefaults, createContextFromBindings, normalizeCallSiteConfigToValues } from '@almadar/runtime';
15
+ import { useUser, useArbitraryClassStyles, getAllPages, matchPathAmong, CurrentPagePathProvider, NavStackProvider, OrbitalProvider, useNavStack, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, ServerBridgeProvider, useServerBridge, EntityBindingContext, AwaitingSkeletonContext } from '@almadar/ui/providers';
16
16
  import { evaluateListenPayloadExpr, evaluate, createMinimalContext, evaluateGuard, executeEffects } from '@almadar/evaluator';
17
17
  import { getPatternDefinition } from '@almadar/core/patterns';
18
18
  import { isKnownStdOperator } from '@almadar/std/registry';
@@ -270,6 +270,18 @@ function useCircuitKernel(traitBindings, options) {
270
270
  [baseTransport]
271
271
  );
272
272
  const orbitalName = options.orbitals[0]?.name ?? "";
273
+ const topology = useMemo(() => {
274
+ let resolve = () => void 0;
275
+ const promise = new Promise((r) => {
276
+ resolve = r;
277
+ });
278
+ return { promise, resolve };
279
+ }, [effectiveTransport]);
280
+ const awaitTopology = options.awaitTopology === true;
281
+ const confirmedCarries = options.carriesCircuitState ?? false;
282
+ useEffect(() => {
283
+ if (!awaitTopology) topology.resolve({ carriesCircuitState: confirmedCarries });
284
+ }, [awaitTopology, confirmedCarries, topology]);
273
285
  const rawKernel = useMemo(() => createClientKernel({
274
286
  orbitalName,
275
287
  traitIndex,
@@ -282,7 +294,8 @@ function useCircuitKernel(traitBindings, options) {
282
294
  ...options.contextExtensions !== void 0 ? { contextExtensions: options.contextExtensions } : {},
283
295
  ...options.debug !== void 0 ? { debug: options.debug } : {},
284
296
  ...options.logContext !== void 0 ? { logContext: options.logContext } : {},
285
- carriesCircuitState: options.carriesCircuitState ?? false,
297
+ carriesCircuitState: false,
298
+ topology: topology.promise,
286
299
  ...effectiveTransport !== void 0 ? { transport: effectiveTransport } : {}
287
300
  }), [
288
301
  orbitalName,
@@ -296,50 +309,16 @@ function useCircuitKernel(traitBindings, options) {
296
309
  options.contextExtensions,
297
310
  options.debug,
298
311
  options.logContext,
299
- options.carriesCircuitState,
312
+ topology,
300
313
  effectiveTransport
301
314
  ]);
302
- const rawKernelRef = useRef(rawKernel);
303
- rawKernelRef.current = rawKernel;
304
- const awaitTopology = options.awaitTopology === true;
305
- const holdRef = useRef(awaitTopology);
306
- holdRef.current = awaitTopology;
307
- const heldRef = useRef([]);
308
- useEffect(() => {
309
- if (awaitTopology) return;
310
- const held = heldRef.current;
311
- heldRef.current = [];
312
- for (const release of held) release();
313
- }, [awaitTopology, rawKernel]);
314
315
  const kernel = useMemo(() => ({
315
316
  store: rawKernel.store,
316
- dispatch: (request) => {
317
- const stamped = request.clientId !== void 0 ? request : { ...request, clientId: getTabClientId() };
318
- if (!holdRef.current) return rawKernel.dispatch(stamped);
319
- return new Promise((resolve, reject) => {
320
- heldRef.current.push(() => {
321
- rawKernelRef.current.dispatch(stamped).then(resolve, reject);
322
- });
323
- });
324
- }
317
+ dispatch: (request, hooks) => rawKernel.dispatch(request.clientId !== void 0 ? request : { ...request, clientId: getTabClientId() }, hooks),
318
+ dispatchMount: (seeds, hooks, base = {}) => rawKernel.dispatchMount(seeds, hooks, base.clientId !== void 0 ? base : { ...base, clientId: getTabClientId() }),
319
+ dispatchProgress: (request) => rawKernel.dispatchProgress(request.clientId !== void 0 ? request : { ...request, clientId: getTabClientId() })
325
320
  }), [rawKernel]);
326
- const kernelRef = useRef(kernel);
327
- kernelRef.current = kernel;
328
- useEffect(() => {
329
- if (!effectiveTransport?.subscribe) return;
330
- return effectiveTransport.subscribe((emitted) => {
331
- const targets = collectListenerTargets(traitIndex, emitted.source, emitted.event, emitted.payload);
332
- for (const target of targets) {
333
- void kernelRef.current.dispatch({
334
- event: target.triggers,
335
- ...target.payload !== void 0 ? { payload: target.payload } : {},
336
- ...target.entityId !== void 0 ? { entityId: target.entityId } : {},
337
- targetTrait: target.listenerTrait
338
- });
339
- }
340
- }, { clientId: getTabClientId() });
341
- }, [effectiveTransport, traitIndex]);
342
- return { kernel, store, traitIndex };
321
+ return { kernel, store, traitIndex, transport: effectiveTransport };
343
322
  }
344
323
  var log2 = createLogger("almadar:ui:circuit:bus-ingress");
345
324
  function useBusIngress(traitBindings, traitIndex, settle, eventBus) {
@@ -519,7 +498,7 @@ function resolveLambdaBindings(body, params, item, index) {
519
498
  return body;
520
499
  }
521
500
  var LazySlotContentRenderer = React.lazy(
522
- () => import('./UISlotRenderer-CR7SCAMR.js').then((m) => ({ default: m.SlotContentRenderer }))
501
+ () => import('./UISlotRenderer-P7A4SZSK.js').then((m) => ({ default: m.SlotContentRenderer }))
523
502
  );
524
503
  function deferLambdaEntityExprs(value) {
525
504
  if (typeof value === "string") {
@@ -1131,6 +1110,25 @@ function sameFields(a, b) {
1131
1110
  }
1132
1111
  return true;
1133
1112
  }
1113
+ function useAwaitingSkeletonSource(store, traitIndex, embeddedTraits) {
1114
+ return useMemo(() => {
1115
+ const activeRenders = () => {
1116
+ const renders = [];
1117
+ for (const awaiting of store.awaiting.list()) {
1118
+ const transitions = traitIndex.byName.get(awaiting.trait)?.irTrait.stateMachine?.transitions ?? [];
1119
+ const taken = transitions.find((t) => t.event === awaiting.event && t.from === awaiting.from);
1120
+ if (taken?.awaitRender) renders.push(...taken.awaitRender);
1121
+ }
1122
+ return renders;
1123
+ };
1124
+ return {
1125
+ forSlot: (slot) => activeRenders().find((r) => r.slot === slot && !(embeddedTraits?.has(r.trait) ?? false))?.skeleton,
1126
+ forTrait: (traitName) => activeRenders().find((r) => r.trait === traitName)?.skeleton,
1127
+ subscribe: (callback) => store.awaiting.subscribeAll(callback),
1128
+ getVersion: () => store.awaiting.getVersion()
1129
+ };
1130
+ }, [store, traitIndex, embeddedTraits]);
1131
+ }
1134
1132
 
1135
1133
  // hooks/useTraitStateMachine.ts
1136
1134
  var stateLog = createLogger("almadar:ui:state-transitions");
@@ -1149,7 +1147,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1149
1147
  const { user: contextViewer } = useUser();
1150
1148
  const userContext = options.user ?? contextViewer ?? void 0;
1151
1149
  const observer = useMemo(() => createCircuitVerificationObserver(), []);
1152
- const { kernel, store, traitIndex } = useCircuitKernel(traitBindings, {
1150
+ const { kernel, store, traitIndex, transport } = useCircuitKernel(traitBindings, {
1153
1151
  orbitals: options.orbitals,
1154
1152
  ...options.traitConfigsByName !== void 0 ? { traitConfigsByName: options.traitConfigsByName } : {},
1155
1153
  ...options.transport !== void 0 ? { transport: options.transport } : {},
@@ -1179,6 +1177,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1179
1177
  ...userContext !== void 0 ? { user: userContext } : {}
1180
1178
  });
1181
1179
  const entityBindingSource = useEntityBindingSource(store, traitIndex);
1180
+ const awaitingSkeletonSource = useAwaitingSkeletonSource(store, traitIndex, options.embeddedTraits);
1182
1181
  const activeTraitNamesRef = useRef(/* @__PURE__ */ new Set());
1183
1182
  useEffect(() => {
1184
1183
  activeTraitNamesRef.current = new Set(traitIndex.byName.keys());
@@ -1226,6 +1225,35 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1226
1225
  for (const unreg of snapshotUnregs) unreg();
1227
1226
  };
1228
1227
  }, [traitBindings, store, traitIndex]);
1228
+ const afterSettle = useCallback(async (traitName, eventKey, payload, transitioned, repaints, composedBefore) => {
1229
+ if (transitioned) {
1230
+ const entityByTrait = {};
1231
+ for (const [name, entry] of traitIndex.byName) {
1232
+ const row = store.frames.get(entry.frameKey);
1233
+ if (row !== void 0) entityByTrait[name] = row;
1234
+ }
1235
+ const repainted = new Set(repaints.map((e) => e.traitName));
1236
+ const serverComposed = new Set([...store.callsitePayloads].filter(([child, composed]) => composedBefore.get(child) !== composed).map(([child]) => child));
1237
+ await reRenderCallsiteCaptureChildren(traitName, payload ?? {}, entityByTrait, repainted, serverComposed);
1238
+ }
1239
+ options.onEventProcessed?.(eventKey, payload);
1240
+ }, [traitIndex, store, reRenderCallsiteCaptureChildren, options.onEventProcessed]);
1241
+ const settleOutcome = useCallback(async (traitName, eventKey, payload, outcome, composedBefore) => {
1242
+ recordDispatchVerdict(traitIndex.byName.get(traitName)?.orbitalName ?? traitName, eventKey, { response: outcome.response });
1243
+ const settledEffects = outcome.localPainted && outcome.serverEffects !== void 0 ? outcome.serverEffects : outcome.response;
1244
+ slotFlush.applyClientEffects(
1245
+ settledEffects.clientEffects ?? [],
1246
+ settledEffects.clientEffectsByTrait,
1247
+ options.navigate,
1248
+ options.navigateBack,
1249
+ activeTraitNamesRef.current
1250
+ );
1251
+ for (const emitted of outcome.response.emittedEvents) {
1252
+ eventBus.emit(`UI:${emitted.event}`, emitted.payload, { ...emitted.source ?? {}, dispatched: true });
1253
+ }
1254
+ stateLog.debug("dispatch:settled", { traitName, eventKey, mode: outcome.mode, transitioned: outcome.response.transitioned });
1255
+ await afterSettle(traitName, eventKey, payload, outcome.response.transitioned, outcome.response.clientEffectsByTrait ?? [], composedBefore);
1256
+ }, [slotFlush, traitIndex, eventBus, options.navigate, options.navigateBack, afterSettle]);
1229
1257
  const dispatchAndSettle = useCallback(async (traitName, eventKey, payload, tick) => {
1230
1258
  const entityId = typeof payload?.entityId === "string" ? payload.entityId : void 0;
1231
1259
  const orbitalName = traitIndex.byName.get(traitName)?.orbitalName ?? traitName;
@@ -1256,34 +1284,63 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1256
1284
  recordDispatchVerdict(orbitalName, eventKey, { error: err instanceof Error ? err : String(err) });
1257
1285
  throw err;
1258
1286
  }
1259
- recordDispatchVerdict(orbitalName, eventKey, { response: outcome.response });
1260
1287
  if (outcome.localPainted && !outcome.response.success && beforeLocalPaint !== void 0) {
1261
1288
  slotFlush.rollback(beforeLocalPaint);
1262
1289
  }
1263
- const settledEffects = outcome.localPainted && outcome.serverEffects !== void 0 ? outcome.serverEffects : outcome.response;
1264
- slotFlush.applyClientEffects(
1265
- settledEffects.clientEffects ?? [],
1266
- settledEffects.clientEffectsByTrait,
1267
- options.navigate,
1268
- options.navigateBack,
1269
- activeTraitNamesRef.current
1270
- );
1271
- for (const emitted of outcome.response.emittedEvents) {
1272
- eventBus.emit(`UI:${emitted.event}`, emitted.payload, { ...emitted.source ?? {}, dispatched: true });
1273
- }
1274
- stateLog.debug("dispatch:settled", { traitName, eventKey, mode: outcome.mode, transitioned: outcome.response.transitioned });
1275
- if (outcome.response.transitioned) {
1276
- const entityByTrait = {};
1277
- for (const [name, entry] of traitIndex.byName) {
1278
- const row = store.frames.get(entry.frameKey);
1279
- if (row !== void 0) entityByTrait[name] = row;
1290
+ await settleOutcome(traitName, eventKey, payload, outcome, composedBefore);
1291
+ }, [kernel, slotFlush, traitIndex, store, options.navigate, options.navigateBack, settleOutcome]);
1292
+ const progressAndSettle = useCallback(async (traitName, eventKey, payload) => {
1293
+ const entityId = typeof payload?.entityId === "string" ? payload.entityId : void 0;
1294
+ const composedBefore = new Map(store.callsitePayloads);
1295
+ const outcome = await kernel.dispatchProgress({
1296
+ event: eventKey,
1297
+ ...payload !== void 0 ? { payload } : {},
1298
+ ...entityId !== void 0 ? { entityId } : {},
1299
+ targetTrait: traitName
1300
+ });
1301
+ await settleOutcome(traitName, eventKey, payload, outcome, composedBefore);
1302
+ }, [kernel, store, settleOutcome]);
1303
+ useEffect(() => {
1304
+ if (!transport?.subscribe) return;
1305
+ return transport.subscribe((emitted, target) => {
1306
+ for (const t of collectListenerTargets(traitIndex, emitted.source, emitted.event, emitted.payload)) {
1307
+ void (target === "origin" ? progressAndSettle(t.listenerTrait, t.triggers, t.payload) : dispatchAndSettle(t.listenerTrait, t.triggers, t.payload));
1280
1308
  }
1281
- const repainted = new Set((outcome.response.clientEffectsByTrait ?? []).map((e) => e.traitName));
1282
- const serverComposed = new Set([...store.callsitePayloads].filter(([child, composed]) => composedBefore.get(child) !== composed).map(([child]) => child));
1283
- await reRenderCallsiteCaptureChildren(traitName, payload ?? {}, entityByTrait, repainted, serverComposed);
1309
+ }, { clientId: getTabClientId() });
1310
+ }, [transport, traitIndex, progressAndSettle, dispatchAndSettle]);
1311
+ const mountAndSettle = useCallback(async (seeds, payload) => {
1312
+ const composedBefore = new Map(store.callsitePayloads);
1313
+ let beforeLocalPaint;
1314
+ let outcome;
1315
+ try {
1316
+ outcome = await kernel.dispatchMount(seeds, {
1317
+ onLocal: (_trait, local) => {
1318
+ if (beforeLocalPaint === void 0) beforeLocalPaint = slotFlush.checkpoint();
1319
+ slotFlush.applyClientEffects(local.clientEffects ?? [], local.clientEffectsByTrait, options.navigate, options.navigateBack, activeTraitNamesRef.current);
1320
+ }
1321
+ }, { payload });
1322
+ } catch (err) {
1323
+ if (beforeLocalPaint !== void 0) slotFlush.rollback(beforeLocalPaint);
1324
+ for (const seed of seeds) {
1325
+ recordDispatchVerdict(traitIndex.byName.get(seed.trait)?.orbitalName ?? seed.trait, seed.event, { error: err instanceof Error ? err : String(err) });
1326
+ }
1327
+ throw err;
1284
1328
  }
1285
- options.onEventProcessed?.(eventKey, payload);
1286
- }, [kernel, slotFlush, traitIndex, store, eventBus, reRenderCallsiteCaptureChildren, options.navigate, options.navigateBack, options.onEventProcessed]);
1329
+ if (!outcome.success && beforeLocalPaint !== void 0) slotFlush.rollback(beforeLocalPaint);
1330
+ slotFlush.applyClientEffects(outcome.serverEffects.clientEffects ?? [], outcome.serverEffects.clientEffectsByTrait, options.navigate, options.navigateBack, activeTraitNamesRef.current);
1331
+ const emitted = [...outcome.seeds.flatMap((seed) => seed.local.emittedEvents), ...outcome.emittedEvents];
1332
+ for (const e of emitted) {
1333
+ eventBus.emit(`UI:${e.event}`, e.payload, { ...e.source ?? {}, dispatched: true });
1334
+ }
1335
+ const serverRepaints = outcome.serverEffects.clientEffectsByTrait ?? [];
1336
+ for (const seed of outcome.seeds) {
1337
+ recordDispatchVerdict(traitIndex.byName.get(seed.trait)?.orbitalName ?? seed.trait, seed.event, {
1338
+ response: { ...seed.local, success: outcome.success, ...outcome.error !== void 0 ? { error: outcome.error } : {} }
1339
+ });
1340
+ stateLog.debug("mount:settled", { traitName: seed.trait, eventKey: seed.event, mode: seed.mode, transitioned: seed.local.transitioned });
1341
+ await afterSettle(seed.trait, seed.event, payload, seed.local.transitioned, [...seed.local.clientEffectsByTrait ?? [], ...serverRepaints], composedBefore);
1342
+ }
1343
+ }, [kernel, slotFlush, traitIndex, store, eventBus, options.navigate, options.navigateBack, afterSettle]);
1287
1344
  useBusIngress(traitBindings, traitIndex, dispatchAndSettle, eventBus);
1288
1345
  const sendEvent = useCallback((eventKey, payload) => {
1289
1346
  const normalized = normalizeEventKey(eventKey);
@@ -1324,17 +1381,19 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1324
1381
  if (mount.initialized.has(traitName)) continue;
1325
1382
  mount.initialized.add(traitName);
1326
1383
  const lifecycleEvent = LIFECYCLE_EVENTS.find((evt) => store.manager.canHandleEvent(traitName, evt));
1327
- if (lifecycleEvent !== void 0) entering.push({ traitName, lifecycleEvent });
1384
+ if (lifecycleEvent !== void 0) entering.push({ trait: traitName, event: lifecycleEvent });
1328
1385
  }
1329
- store.mount.mounting(entering.map((e) => e.traitName));
1330
- for (const { traitName, lifecycleEvent } of entering) {
1331
- void dispatchAndSettle(traitName, lifecycleEvent, { ...options.initPayload ?? {} });
1386
+ store.mount.mounting(entering.map((e) => e.trait));
1387
+ if (entering.length > 0) {
1388
+ void mountAndSettle(entering, { ...options.initPayload ?? {} }).catch((err) => {
1389
+ stateLog.warn("mount:failed", { traits: entering.map((e) => e.trait), error: String(err) });
1390
+ });
1332
1391
  }
1333
1392
  mountedRef.current = mount;
1334
- }, [traitBindings, store, dispatchAndSettle, mountKey]);
1393
+ }, [traitBindings, store, mountAndSettle, mountKey]);
1335
1394
  useSyncExternalStore(store.subscribe, store.getVersion, store.getVersion);
1336
1395
  const traitStates = useMemo(() => store.manager.getAllStates(), [store, store.getVersion()]);
1337
- return { traitStates, sendEvent, getTraitState, canHandleEvent, entityBindingSource };
1396
+ return { traitStates, sendEvent, getTraitState, canHandleEvent, entityBindingSource, awaitingSkeletonSource };
1338
1397
  }
1339
1398
 
1340
1399
  // runtime/fitContent.ts
@@ -1405,7 +1464,7 @@ function TraitInitializer({ traits, routeParams, mountKey, orbitals, onNavigate,
1405
1464
  }, localFallbackTimeoutMs ?? 5e3);
1406
1465
  return () => clearTimeout(timer);
1407
1466
  }, [hasBridge, bridge.connected, onLocalFallback, localFallbackTimeoutMs]);
1408
- const { entityBindingSource } = useTraitStateMachine(traits, uiSlots, {
1467
+ const { entityBindingSource, awaitingSkeletonSource } = useTraitStateMachine(traits, uiSlots, {
1409
1468
  orbitals,
1410
1469
  ...onNavigate !== void 0 ? { navigate: onNavigate } : {},
1411
1470
  ...onNavigateBack !== void 0 ? { navigateBack: onNavigateBack } : {},
@@ -1416,7 +1475,7 @@ function TraitInitializer({ traits, routeParams, mountKey, orbitals, onNavigate,
1416
1475
  ...mountKey !== void 0 ? { mountKey } : {},
1417
1476
  ...hasBridge ? { transport: bridge.transport, carriesCircuitState: bridge.carriesCircuitState, awaitTopology: !bridge.topologyKnown } : { persistence }
1418
1477
  });
1419
- return /* @__PURE__ */ jsx(EntityBindingContext.Provider, { value: entityBindingSource, children });
1478
+ return /* @__PURE__ */ jsx(EntityBindingContext.Provider, { value: entityBindingSource, children: /* @__PURE__ */ jsx(AwaitingSkeletonContext.Provider, { value: awaitingSkeletonSource, children }) });
1420
1479
  }
1421
1480
  var CONTENT_STAGE_WIDTH = 480;
1422
1481
  function FitToBox({ children, mode = "box" }) {
@@ -267,6 +267,7 @@ function emitMotion(m, vars) {
267
267
  if (m.entry?.default !== void 0) vars["--motion-enter-default"] = enterKeyframe(m.entry.default);
268
268
  if (m.entry?.stagger !== void 0) vars["--motion-enter-stagger"] = m.entry.stagger;
269
269
  if (m.busyDelay !== void 0) vars["--motion-busy-delay"] = m.busyDelay;
270
+ if (m.awaitingSkeleton !== void 0) vars["--awaiting-skeleton-display"] = m.awaitingSkeleton ? "block" : "none";
270
271
  }
271
272
  function enterKeyframe(enter) {
272
273
  return enter === "none" ? "none" : `almadar-enter-${enter}`;
@@ -115,6 +115,7 @@ var en_default = {
115
115
  "aria.removeFilter": "Remove filter",
116
116
  "aria.closeDrawer": "Close drawer",
117
117
  "aria.closePanel": "Close panel",
118
+ "aria.dockPanel": "Side panel",
118
119
  "aria.previousImage": "Previous image",
119
120
  "aria.nextImage": "Next image",
120
121
  "aria.dismiss": "Dismiss",
@@ -136,6 +137,7 @@ var en_default = {
136
137
  "aria.openMenu": "Open menu",
137
138
  "aria.closeMenu": "Close menu",
138
139
  "aria.openSidebar": "Open sidebar",
140
+ "aria.openRow": "Open item {{position}}",
139
141
  "sidebar.expand": "Expand sidebar",
140
142
  "sidebar.collapse": "Collapse sidebar",
141
143
  "sidebar.close": "Close sidebar",
@@ -1181,7 +1183,53 @@ var en_default = {
1181
1183
  "aria.walkTraitDone": "completed",
1182
1184
  "aria.walkTraitPending": "pending",
1183
1185
  "aria.walkGraph": "State graph for {{trait}}: {{from}} to {{to}}",
1184
- "aria.loading": "Loading"
1186
+ "aria.loading": "Loading",
1187
+ "agentActivity.toolCall": "Called {{tool}}",
1188
+ "agentActivity.toolResult": "{{tool}} returned",
1189
+ "agentActivity.toolRows": "{{count}} rows",
1190
+ "agentActivity.thinking": "Thinking\u2026",
1191
+ "agentActivity.analyzed": "Analyzed your request \u2014 {{organism}}",
1192
+ "agentActivity.renamed": "Rename {{from}} \u2192 {{to}}",
1193
+ "agentActivity.deleted": "Remove {{orbitalName}}",
1194
+ "agentActivity.roster": "Planning {{count}} orbitals",
1195
+ "agentActivity.orbitalStarted": "Working on {{orbitalName}}\u2026",
1196
+ "agentActivity.orbitalStartedSettled": "Started {{orbitalName}}",
1197
+ "agentActivity.orbitalDone": "{{orbitalName}} ready",
1198
+ "agentActivity.orbitalCounts": "{{traitCount}} traits, {{transitionCount}} transitions",
1199
+ "agentActivity.change.orbital-added": "Added {{orbitalName}}",
1200
+ "agentActivity.change.orbital-removed": "Removed {{orbitalName}}",
1201
+ "agentActivity.change.entity-fields-changed": "Changed the data fields of {{orbitalName}}",
1202
+ "agentActivity.change.trait-added": "Added a behavior to {{orbitalName}}",
1203
+ "agentActivity.change.trait-removed": "Removed a behavior from {{orbitalName}}",
1204
+ "agentActivity.change.state-machine-changed": "Changed the flow of {{orbitalName}}",
1205
+ "agentActivity.change.guard-changed": "Changed a rule in {{orbitalName}}",
1206
+ "agentActivity.change.effect-changed": "Changed what {{orbitalName}} does",
1207
+ "agentActivity.change.render-ui-changed": "Changed the design of {{orbitalName}}",
1208
+ "agentActivity.change.event-wiring-changed": "Changed the connections of {{orbitalName}}",
1209
+ "agentActivity.change.page-changed": "Changed the pages of {{orbitalName}}",
1210
+ "agentActivity.change.behavior-composed": "Composed a behavior into {{orbitalName}}",
1211
+ "agentActivity.done": "Done \u2014 {{count}} orbitals ready",
1212
+ "agentActivity.cancelled": "Cancelled",
1213
+ "agentActivity.jump": "Show",
1214
+ "agentActivity.emptyTitle": "No activity yet",
1215
+ "agentActivity.emptyDescription": "Send a message and the agent's work shows up here.",
1216
+ "agentActivity.fileOperation": "{{operation}}",
1217
+ "agentActivity.schemaDiff": "Edited {{filePath}}",
1218
+ "agentActivity.coordinatorDecision": "Chose {{organism}}",
1219
+ "agentActivity.change.trait-config-changed": "Changed the settings of {{orbitalName}}",
1220
+ "agentActivity.change.theme-changed": "Changed the theme of {{orbitalName}}",
1221
+ "agentActivity.llmResponse": "Raw LLM response",
1222
+ "agentActivity.llmDuration": "{{seconds}}s",
1223
+ "agentActivity.llmTokens": "{{prompt}} in / {{completion}} out tokens",
1224
+ "agentActivity.llmResponseLabel": "Response",
1225
+ "agentActivity.llmSystemPrompt": "System prompt",
1226
+ "agentActivity.llmUserPrompt": "User prompt",
1227
+ "agentActivity.llmToolCalls": "Tool calls",
1228
+ "agentActivity.showRawLlm": "Raw LLM",
1229
+ "agentActivity.earlierConversations": "Earlier conversations ({{count}})",
1230
+ "agentActivity.earlierActivity": "Earlier activity",
1231
+ "tabs.scrollStart": "Scroll tabs back",
1232
+ "tabs.scrollEnd": "Scroll tabs forward"
1185
1233
  };
1186
1234
 
1187
1235
  export { en_default };