@almadar/runtime 6.59.0 → 6.60.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.
@@ -1,5 +1,5 @@
1
1
  import { Router } from 'express';
2
- import { I as IEventBus, R as RuntimeEvent, a as EventListener, U as Unsubscribe, T as TraitDefinition, b as RuntimeConfig, c as TransitionObserver, d as TraitState, C as ConfigContext, e as TransitionResult, f as EvaluationContextExtensions, E as EffectHandlers } from './types-TwQ8Dybu.js';
2
+ import { I as IEventBus, R as RuntimeEvent, a as EventListener, U as Unsubscribe, T as TraitDefinition, b as RuntimeConfig, c as TransitionObserver, d as TraitState, C as ConfigContext, e as TransitionResult, f as EvaluationContextExtensions, E as EffectHandlers } from './types-BaD_ox7e.js';
3
3
  import { EventPayload, EventId, EntityRow, UserContext, Orbital, ServiceCallResult, TraitConfig, DeclaredTraitConfig, Entity, OrbitalSchema, Trait, PatternConfig, ResolvedPatternProps, SExpr, BusEventSource, RawUserClaims, OrbitalDefinition, TraitTick } from '@almadar/core';
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
1
  import 'express';
2
- export { F as ClientEffectTuple, G as ClientNavigateBackTuple, H as ClientNavigateTuple, J as ClientNotifyTuple, K as ClientRenderUITuple, M as EffectResult, e as InMemoryPersistence, N as LiveBroadcastItem, Q as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, T as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, V as RuntimeTraitTick, p as collectDeclaredConfigDefaults, W as createOrbitalServerRuntime } from './OrbitalServerRuntime-PI9Ioxdp.js';
3
- import './types-TwQ8Dybu.js';
2
+ export { F as ClientEffectTuple, G as ClientNavigateBackTuple, H as ClientNavigateTuple, J as ClientNotifyTuple, K as ClientRenderUITuple, M as EffectResult, e as InMemoryPersistence, N as LiveBroadcastItem, Q as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, T as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, V as RuntimeTraitTick, p as collectDeclaredConfigDefaults, W as createOrbitalServerRuntime } from './OrbitalServerRuntime-Cvw0CUfG.js';
3
+ import './types-BaD_ox7e.js';
4
4
  import '@almadar/core';
@@ -1,5 +1,5 @@
1
- import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-WSNZNXZE.js';
2
- export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-WSNZNXZE.js';
1
+ import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-5IFHQDW2.js';
2
+ export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-5IFHQDW2.js';
3
3
  import { isValidCronExpression } from './chunk-OU3ITB5S.js';
4
4
  import { createContextFromBindings, resolveCallSitePayloadCaptures, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
5
5
  import './chunk-T4VDAB4C.js';
@@ -1542,6 +1542,7 @@ var OrbitalServerRuntime = class {
1542
1542
  data: resultData,
1543
1543
  success: true
1544
1544
  });
1545
+ return resultData;
1545
1546
  } catch (err) {
1546
1547
  effectLog.error("persist:store-mutate-error", {
1547
1548
  action,
@@ -1556,6 +1557,7 @@ var OrbitalServerRuntime = class {
1556
1557
  error: err instanceof Error ? err.message : String(err)
1557
1558
  });
1558
1559
  }
1560
+ return void 0;
1559
1561
  },
1560
1562
  callService: async (service, action, params) => {
1561
1563
  try {
@@ -1,4 +1,4 @@
1
- import { I as IEventBus } from './types-TwQ8Dybu.js';
1
+ import { I as IEventBus } from './types-BaD_ox7e.js';
2
2
  import { EventPayload } from '@almadar/core';
3
3
 
4
4
  /**
@@ -1363,15 +1363,16 @@ var EffectExecutor = class _EffectExecutor {
1363
1363
  } else {
1364
1364
  const entityType = args[1];
1365
1365
  const data = args[2];
1366
- await this.handlers.persist(action, entityType, data);
1367
- const dataId = typeof data === "string" ? data : data && typeof data === "object" ? data.id : void 0;
1366
+ const persisted = await this.handlers.persist(action, entityType, data);
1367
+ const successPayload = persisted ?? data;
1368
+ const dataId = typeof successPayload === "string" ? successPayload : successPayload && typeof successPayload === "object" ? successPayload.id : void 0;
1368
1369
  persistLog.debug("persist:success", {
1369
1370
  action,
1370
1371
  entityType,
1371
1372
  dataId,
1372
1373
  willEmit: emitCfg?.success
1373
1374
  });
1374
- this.emitSuccess(emitCfg, "success", data, true);
1375
+ this.emitSuccess(emitCfg, "success", successPayload, true);
1375
1376
  persistLog.debug("persist:emit-fired", { action, eventName: emitCfg?.success });
1376
1377
  }
1377
1378
  } catch (err) {
@@ -1974,8 +1975,7 @@ var EffectExecutor = class _EffectExecutor {
1974
1975
  }
1975
1976
  };
1976
1977
  function createTestExecutor(overrides = {}) {
1977
- const noopAsync = async () => {
1978
- };
1978
+ const noopAsync = async () => void 0;
1979
1979
  const noop = () => {
1980
1980
  };
1981
1981
  return new EffectExecutor({
@@ -3616,6 +3616,23 @@ function traitEmbedNamesOf(trait) {
3616
3616
  for (const field of Object.values(trait.config ?? {})) walk(field.default);
3617
3617
  return [...found];
3618
3618
  }
3619
+ function resolveForwardedSiblingConfig(trait, parent) {
3620
+ const declared = trait.config;
3621
+ const parentDeclared = parent?.config;
3622
+ if (!declared || !parentDeclared) return trait;
3623
+ let next;
3624
+ for (const [key, field] of Object.entries(declared)) {
3625
+ const forward = field.default;
3626
+ if (typeof forward !== "string" || !forward.startsWith("@config.")) continue;
3627
+ const knob = forward.slice("@config.".length);
3628
+ if (knob.length === 0 || knob.includes(".")) continue;
3629
+ const value = parentDeclared[knob]?.default;
3630
+ if (value === void 0 || value === forward) continue;
3631
+ next ??= { ...declared };
3632
+ next[key] = { ...field, default: value };
3633
+ }
3634
+ return next ? { ...trait, config: next } : trait;
3635
+ }
3619
3636
  function applyLinkedEntityRename(trait, linkedEntity) {
3620
3637
  const atomLinked = trait.linkedEntity;
3621
3638
  if (!linkedEntity || !atomLinked || linkedEntity === atomLinked) return trait;
@@ -4148,7 +4165,11 @@ var ReferenceResolver = class {
4148
4165
  }
4149
4166
  atomTrait = nested.data.trait;
4150
4167
  }
4151
- let copy = applyLinkedEntityRename(atomTrait, linkedEntity);
4168
+ const embedder = resolved.find((r) => r.trait.name === parent)?.trait ?? pulled.find((r) => r.trait.name === parent)?.trait;
4169
+ let copy = resolveForwardedSiblingConfig(
4170
+ applyLinkedEntityRename(atomTrait, linkedEntity),
4171
+ embedder
4172
+ );
4152
4173
  if (finalName !== sibling) {
4153
4174
  copy = { ...copy, name: finalName };
4154
4175
  noteRewrite(parent, sibling, finalName);
@@ -134,6 +134,9 @@ function push(entry) {
134
134
  scheduleNotify();
135
135
  }
136
136
  function isEnabled() {
137
+ return isLogLevelEnabled("DEBUG", PERF_NAMESPACE) || globalThis.__ALMADAR_PERF__ === true;
138
+ }
139
+ function isVerbose() {
137
140
  return isLogLevelEnabled("DEBUG", PERF_NAMESPACE);
138
141
  }
139
142
  function now() {
@@ -161,7 +164,8 @@ function perfEnd(name, startToken, detail) {
161
164
  }
162
165
  }
163
166
  push({ name, durationMs, ts: endTs, detail });
164
- log.debug(name, () => ({ durationMs, ...detail ?? {} }));
167
+ aggregate(name, durationMs);
168
+ if (isVerbose()) log.debug(name, () => ({ durationMs, ...detail ?? {} }));
165
169
  }
166
170
  function perfTime(name, fn, detail) {
167
171
  const t = perfStart(name);
@@ -171,6 +175,46 @@ function perfTime(name, fn, detail) {
171
175
  perfEnd(name, t, detail);
172
176
  }
173
177
  }
178
+ async function perfTimeAsync(name, fn) {
179
+ const t = perfStart(name);
180
+ try {
181
+ return await fn();
182
+ } finally {
183
+ perfEnd(name, t);
184
+ }
185
+ }
186
+ function perfGauge(name, value) {
187
+ if (!isEnabled()) return;
188
+ aggregate(name, value);
189
+ }
190
+ var buckets = /* @__PURE__ */ new Map();
191
+ var dumpTimer = null;
192
+ function aggregate(name, ms) {
193
+ const b = buckets.get(name);
194
+ if (b) {
195
+ b.count++;
196
+ b.totalMs += ms;
197
+ if (ms > b.maxMs) b.maxMs = ms;
198
+ } else {
199
+ buckets.set(name, { count: 1, totalMs: ms, maxMs: ms });
200
+ }
201
+ if (dumpTimer === null) {
202
+ dumpTimer = setInterval(dumpSummary, 5e3);
203
+ if (typeof dumpTimer === "object" && "unref" in dumpTimer) dumpTimer.unref();
204
+ }
205
+ }
206
+ function dumpSummary() {
207
+ if (buckets.size === 0) return;
208
+ const rows = [...buckets.entries()].map(([name, b]) => ({
209
+ name,
210
+ count: b.count,
211
+ totalMs: Math.round(b.totalMs),
212
+ avgMs: Math.round(b.totalMs / b.count * 100) / 100,
213
+ maxMs: Math.round(b.maxMs * 10) / 10
214
+ })).sort((a, b) => b.totalMs - a.totalMs);
215
+ log.warn("[PROFILE] summary", { phases: JSON.stringify(rows) });
216
+ buckets.clear();
217
+ }
174
218
  function getPerfSnapshot() {
175
219
  if (ring.length < RING_SIZE) return ring.slice();
176
220
  return [...ring.slice(writeIdx), ...ring.slice(0, writeIdx)];
@@ -424,4 +468,4 @@ function bindTraitStateGetter(getter) {
424
468
  api.getTraitState = getter;
425
469
  }
426
470
 
427
- export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfStart, perfStore, perfTime, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent };
471
+ export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfGauge, perfStart, perfStore, perfTime, perfTimeAsync, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent };
@@ -1,4 +1,4 @@
1
- import { E as EffectHandlers } from './types-TwQ8Dybu.js';
1
+ import { E as EffectHandlers } from './types-BaD_ox7e.js';
2
2
  import { EventPayload } from '@almadar/core';
3
3
 
4
4
  /**
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { g as RuntimePatternValue, B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, h as EffectContext, i as ExecutionEnvironment, j as EffectResult, S as ServiceCallContext, T as TraitDefinition } from './types-TwQ8Dybu.js';
2
- export { k as BrowserFileMeta, l as BrowserFilePickerOptions, m as BrowserGeolocationOptions, n as BrowserGeolocationPosition, C as ConfigContext, o as Effect, a as EventListener, H as HANDLER_MANIFEST, I as IEventBus, b as RuntimeConfig, R as RuntimeEvent, d as TraitState, c as TransitionObserver, e as TransitionResult, U as Unsubscribe } from './types-TwQ8Dybu.js';
3
- import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-PI9Ioxdp.js';
4
- export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-PI9Ioxdp.js';
1
+ import { g as RuntimePatternValue, B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, h as EffectContext, i as ExecutionEnvironment, j as EffectResult, S as ServiceCallContext, T as TraitDefinition } from './types-BaD_ox7e.js';
2
+ export { k as BrowserFileMeta, l as BrowserFilePickerOptions, m as BrowserGeolocationOptions, n as BrowserGeolocationPosition, C as ConfigContext, o as Effect, a as EventListener, H as HANDLER_MANIFEST, I as IEventBus, b as RuntimeConfig, R as RuntimeEvent, d as TraitState, c as TransitionObserver, e as TransitionResult, U as Unsubscribe } from './types-BaD_ox7e.js';
3
+ import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-Cvw0CUfG.js';
4
+ export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-Cvw0CUfG.js';
5
5
  import { EvaluationContext, SExpressionEvaluator } from '@almadar/evaluator';
6
6
  export { EvaluationContext, createMinimalContext } from '@almadar/evaluator';
7
- import { RenderBindingMarker, SExpr, TraitConfigObject, EventPayload, PatternConfig, EntityId, EntityField, EntityRow, EntityPersistence, ServiceParams, EntityAccessPolicies, PayloadField, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
7
+ import { RenderBindingMarker, SExpr, RuntimeValue, TraitConfigObject, EventPayload, PatternConfig, EntityId, EntityField, EntityRow, EntityPersistence, ServiceParams, EntityAccessPolicies, PayloadField, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
8
8
  export { EntityField, normalizeCallSiteConfigToValues } from '@almadar/core';
9
9
  export { AccessBindings, applyRowAccess, checkMutationAccess } from './entityAccess.js';
10
10
  export { ServerBridgeConfig, ServerBridgeState } from './ServerBridge.js';
11
11
  export { OsHandlerContext, OsHandlerResult } from './createOsHandlers.js';
12
- export { MultiSourceSlotManager, PERF_NAMESPACE, PerfDetail, PerfDetailValue, PerfEntry, PreparedPreviewSchema, RendererContractViolationError, ResolvedPageTraits, SlotContent, SlotContentValidationError, SlotManager, SlotSource, VerificationBus, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, collectEmbeddedTraits, collectTraitRefsFromResolvedTrait, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfStart, perfStore, perfTime, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from './ui/index.js';
12
+ export { MultiSourceSlotManager, PERF_NAMESPACE, PerfDetail, PerfDetailValue, PerfEntry, PreparedPreviewSchema, RendererContractViolationError, ResolvedPageTraits, SlotContent, SlotContentValidationError, SlotManager, SlotSource, VerificationBus, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, collectEmbeddedTraits, collectTraitRefsFromResolvedTrait, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfGauge, perfStart, perfStore, perfTime, perfTimeAsync, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from './ui/index.js';
13
13
  import 'express';
14
14
  import '@almadar/core/patterns';
15
15
 
@@ -289,7 +289,7 @@ declare function interpolateProps(props: PatternProps, ctx: EvaluationContext):
289
289
  /**
290
290
  * Interpolate a single value.
291
291
  */
292
- declare function interpolateValue(value: unknown, ctx: EvaluationContext): unknown;
292
+ declare function interpolateValue(value: RuntimeValue, ctx: EvaluationContext): RuntimeValue;
293
293
  /**
294
294
  * Value a deferred render-ui prop tree can carry: interpolated runtime
295
295
  * values, raw pass-through S-expressions (`fn` lambdas), render-time
@@ -419,15 +419,15 @@ declare class EffectExecutor {
419
419
  /**
420
420
  * Execute a single effect.
421
421
  */
422
- execute(effect: unknown): Promise<void>;
422
+ execute(effect: RuntimeValue): Promise<void>;
423
423
  /**
424
424
  * Execute multiple effects in sequence.
425
425
  */
426
- executeAll(effects: unknown[]): Promise<void>;
426
+ executeAll(effects: RuntimeValue[]): Promise<void>;
427
427
  /**
428
428
  * Execute multiple effects in parallel.
429
429
  */
430
- executeParallel(effects: unknown[]): Promise<void>;
430
+ executeParallel(effects: RuntimeValue[]): Promise<void>;
431
431
  /**
432
432
  * Execute effects and return detailed results for each.
433
433
  * Enables compensating transitions by reporting which effects failed.
@@ -435,7 +435,7 @@ declare class EffectExecutor {
435
435
  * Unlike `executeAll`, this method does NOT throw on effect errors.
436
436
  * Instead, it captures errors in the returned `EffectResult[]` array.
437
437
  */
438
- executeWithResults(effects: unknown[]): Promise<EffectResult[]>;
438
+ executeWithResults(effects: RuntimeValue[]): Promise<EffectResult[]>;
439
439
  private extractEmitConfig;
440
440
  /** Build the source metadata stamp for an emit fired from this trait. */
441
441
  private sourceStamp;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { EffectExecutor } from './chunk-WSNZNXZE.js';
2
- export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-WSNZNXZE.js';
1
+ import { EffectExecutor } from './chunk-5IFHQDW2.js';
2
+ export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-5IFHQDW2.js';
3
3
  export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './chunk-OU3ITB5S.js';
4
4
  import { createContextFromBindings, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
5
5
  export { CALLSITE_PAYLOAD_PREFIX, applyRowAccess, checkMutationAccess, containsBindings, createContextFromBindings, createMinimalContext, deferEntityBindings, extractBindings, interpolateProps, interpolateValue, resolveCallSitePayloadCaptures } from './chunk-ZJ62H3ES.js';
6
6
  import './chunk-T4VDAB4C.js';
7
- export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfStart, perfStore, perfTime, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from './chunk-FOFLEZRJ.js';
7
+ export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfGauge, perfStart, perfStore, perfTime, perfTimeAsync, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from './chunk-F5W3YZGJ.js';
8
8
  export { collectEmbeddedTraits, collectTraitRefsFromResolvedTrait } from './chunk-SCRAHWOC.js';
9
9
  import { __export } from './chunk-MLKGABMK.js';
10
10
  import { createLogger } from '@almadar/logger';
@@ -416,6 +416,7 @@ function createServerEffectHandlers(opts) {
416
416
  data: resultData,
417
417
  success: true
418
418
  });
419
+ return resultData;
419
420
  } catch (err) {
420
421
  effectLog.error("persist:store-mutate-error", {
421
422
  action,
@@ -430,6 +431,7 @@ function createServerEffectHandlers(opts) {
430
431
  error: err instanceof Error ? err.message : String(err)
431
432
  });
432
433
  }
434
+ return void 0;
433
435
  },
434
436
  callService: async (service, action, params) => {
435
437
  try {
@@ -1,5 +1,5 @@
1
1
  import * as _almadar_core from '@almadar/core';
2
- import { TraitId, EventId, SExpr, TraitEventListener, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, IntegrationContext, TraitConfig, EventPayload, BusEvent, EntityRow, FieldValue, ServiceParams, FetchResult, PatternConfig, ResolvedPatternProps, Orbital, ServiceCallResult, BusEventSource, BusEventListener, Unsubscribe as Unsubscribe$1, UserContext, NavItem } from '@almadar/core';
2
+ import { TraitId, EventId, SExpr, TraitEventListener, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, IntegrationContext, TraitConfig, EventPayload, BusEvent, EntityRow, FieldValue, ServiceParams, FetchResult, PatternConfig, ResolvedPatternProps, Orbital, ServiceCallResult, BusEventSource, BusEventListener, Unsubscribe as Unsubscribe$1, UserContext, NavItem, RuntimeValue } from '@almadar/core';
3
3
 
4
4
  /** Alias for ResolvedPatternProps to avoid breaking internal consumers */
5
5
  type PatternProps = ResolvedPatternProps;
@@ -149,8 +149,19 @@ interface EffectHandlers {
149
149
  * `fetch` success envelopes, cascade re-emits).
150
150
  */
151
151
  emit: (event: string, payload?: EventPayload, source?: RuntimeEvent['source'], fromPersistSuccess?: boolean) => void;
152
- /** Persist data (create/update/delete/batch) */
153
- persist: (action: 'create' | 'update' | 'delete' | 'batch', entityType: string, data?: EntityRow) => Promise<void>;
152
+ /**
153
+ * Persist data (create/update/delete/batch).
154
+ *
155
+ * Returns the persisted ROW — for a create that is the submitted data
156
+ * plus the store-minted `id`, which the caller's `emit:{success}`
157
+ * envelope carries. Without it a `*_CREATED` listener sees no id (the
158
+ * compiled path emits the created row), so anything routing on the new
159
+ * row's identity — navigating to the page just created — worked in one
160
+ * execution path only. Implementations that have no row to hand back
161
+ * (batch, a denied write, a no-op stub) return undefined and the
162
+ * envelope falls back to the submitted data.
163
+ */
164
+ persist: (action: 'create' | 'update' | 'delete' | 'batch', entityType: string, data?: EntityRow) => Promise<EntityRow | undefined>;
154
165
  /** Set a field value on an entity */
155
166
  set: (entityId: string, field: string, value: FieldValue) => void;
156
167
  /** Call an external service. `context` carries the caller's identity
@@ -371,7 +382,7 @@ interface BindingContext {
371
382
  * a `let` body's effects resolve their value expressions against the
372
383
  * `let`-bound locals.
373
384
  */
374
- locals?: Map<string, unknown>;
385
+ locals?: Map<string, RuntimeValue>;
375
386
  /** Additional custom bindings */
376
387
  [key: string]: unknown;
377
388
  }
@@ -339,6 +339,10 @@ declare function perfStart(name: string): number;
339
339
  declare function perfEnd(name: string, startToken: number, detail?: PerfDetail): void;
340
340
  /** Synchronous wrapper that times a fn end-to-end. */
341
341
  declare function perfTime<T>(name: string, fn: () => T, detail?: PerfDetail): T;
342
+ /** Async wrapper — the tick/effect paths are async end-to-end. */
343
+ declare function perfTimeAsync<T>(name: string, fn: () => Promise<T> | T): Promise<T>;
344
+ /** Record a non-duration scalar (queue depth, entries/pass) into the summary. */
345
+ declare function perfGauge(name: string, value: number): void;
342
346
  declare function getSnapshot(): readonly PerfEntry[];
343
347
  declare function subscribe(fn: () => void): () => void;
344
348
  /** Push a pre-computed entry (e.g. React.Profiler callback). */
@@ -416,4 +420,4 @@ declare function bindEventBus(eventBus: VerificationBus): void;
416
420
  */
417
421
  declare function bindTraitStateGetter(getter: (traitName: string) => string | undefined): void;
418
422
 
419
- export { type MultiSourceSlotManager, PERF_NAMESPACE, type PerfDetail, type PerfDetailValue, type PerfEntry, type PreparedPreviewSchema, RendererContractViolationError, type ResolvedPageTraits, type SlotContent, type SlotContentValidationError, type SlotManager, type SlotSource, type VerificationBus, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, collectEmbeddedTraits, collectTraitRefsFromResolvedTrait, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfStart, perfStore, perfTime, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent };
423
+ export { type MultiSourceSlotManager, PERF_NAMESPACE, type PerfDetail, type PerfDetailValue, type PerfEntry, type PreparedPreviewSchema, RendererContractViolationError, type ResolvedPageTraits, type SlotContent, type SlotContentValidationError, type SlotManager, type SlotSource, type VerificationBus, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, collectEmbeddedTraits, collectTraitRefsFromResolvedTrait, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfGauge, perfStart, perfStore, perfTime, perfTimeAsync, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent };
package/dist/ui/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfStart, perfStore, perfTime, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from '../chunk-FOFLEZRJ.js';
1
+ export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfGauge, perfStart, perfStore, perfTime, perfTimeAsync, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from '../chunk-F5W3YZGJ.js';
2
2
  export { collectEmbeddedTraits, collectTraitRefsFromResolvedTrait } from '../chunk-SCRAHWOC.js';
3
3
  import '../chunk-MLKGABMK.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/runtime",
3
- "version": "6.59.0",
3
+ "version": "6.60.0",
4
4
  "description": "Interpreted runtime for Almadar orbital applications (OrbitalServerRuntime)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -57,11 +57,11 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@almadar/core": "^10.68.0",
61
- "@almadar/evaluator": "^2.41.0",
60
+ "@almadar/core": "^10.69.0",
61
+ "@almadar/evaluator": "^2.42.0",
62
62
  "@almadar/logger": "^1.11.0",
63
- "@almadar/server": "^2.37.0",
64
- "@almadar/std": "^16.184.0"
63
+ "@almadar/server": "^2.38.0",
64
+ "@almadar/std": "^16.185.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "express": "^5.0.0"