@almadar/runtime 6.58.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.
- package/dist/{OrbitalServerRuntime-Dn9dIwJk.d.ts → OrbitalServerRuntime-Cvw0CUfG.d.ts} +32 -1
- package/dist/OrbitalServerRuntime.d.ts +2 -2
- package/dist/OrbitalServerRuntime.js +46 -2
- package/dist/ServerBridge.d.ts +1 -1
- package/dist/{chunk-MMVKKLAP.js → chunk-5IFHQDW2.js} +29 -8
- package/dist/{chunk-FOFLEZRJ.js → chunk-F5W3YZGJ.js} +46 -2
- package/dist/createOsHandlers.d.ts +1 -1
- package/dist/index.d.ts +18 -13
- package/dist/index.js +5 -3
- package/dist/{types-TwQ8Dybu.d.ts → types-BaD_ox7e.d.ts} +15 -4
- package/dist/ui/index.d.ts +5 -1
- package/dist/ui/index.js +1 -1
- package/package.json +5 -5
|
@@ -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-
|
|
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
|
/**
|
|
@@ -974,6 +974,16 @@ interface OrbitalEventRequest {
|
|
|
974
974
|
user?: RawUserClaims;
|
|
975
975
|
/** Per-tab client identity (UUID) — excludes this request's origin from live-broadcast delivery. */
|
|
976
976
|
clientId?: string;
|
|
977
|
+
/**
|
|
978
|
+
* Broadcast-class marker (T6, docs/Almadar_Tick_Loop.md §3a): the name of
|
|
979
|
+
* the tick that emitted this event. Tick-stamped dispatches are
|
|
980
|
+
* latest-state broadcasts — the client fires them without awaiting the
|
|
981
|
+
* response, and the server relays them to OTHER tabs coalesced
|
|
982
|
+
* (newest-per-key) at a snapshot rate instead of 1:1.
|
|
983
|
+
*/
|
|
984
|
+
tick?: string;
|
|
985
|
+
/** Emitting trait for a tick-stamped dispatch — builds the relay's BusEventSource (sourceless emits are dropped client-side). */
|
|
986
|
+
sourceTrait?: string;
|
|
977
987
|
}
|
|
978
988
|
/**
|
|
979
989
|
* One persist-envelope success emit, handed to the live-broadcast sink
|
|
@@ -1072,6 +1082,12 @@ interface LoaderConfig {
|
|
|
1072
1082
|
interface OrbitalServerRuntimeConfig {
|
|
1073
1083
|
/** Enable debug logging */
|
|
1074
1084
|
debug?: boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* Snapshot cadence (ms) for relaying tick-stamped broadcasts to other
|
|
1087
|
+
* clients — newest-per-(client, orbital, event) wins between flushes
|
|
1088
|
+
* (T6, docs/Almadar_Tick_Loop.md §3a). Default 50 (≈20Hz).
|
|
1089
|
+
*/
|
|
1090
|
+
tickRelayIntervalMs?: number;
|
|
1075
1091
|
/** Custom effect handlers (for integrating with your data layer) */
|
|
1076
1092
|
effectHandlers?: Partial<EffectHandlers>;
|
|
1077
1093
|
/** Persistence adapter for entity data */
|
|
@@ -1162,6 +1178,14 @@ declare class OrbitalServerRuntime {
|
|
|
1162
1178
|
private appThemeKey;
|
|
1163
1179
|
/** Wired by the hosting server (e.g. the playground SSE endpoint) via `setLiveBroadcastSink`. */
|
|
1164
1180
|
private liveBroadcastSink;
|
|
1181
|
+
/**
|
|
1182
|
+
* Tick-broadcast relay (T6): newest pending item per
|
|
1183
|
+
* (originClientId, orbital, event), flushed to the live-broadcast sink on
|
|
1184
|
+
* the `tickRelayIntervalMs` cadence — other tabs get the latest position
|
|
1185
|
+
* at snapshot rate, never 1:1 with emissions.
|
|
1186
|
+
*/
|
|
1187
|
+
private readonly tickRelayPending;
|
|
1188
|
+
private tickRelayTimer;
|
|
1165
1189
|
/**
|
|
1166
1190
|
* Trait name -> resolved `TraitConfig`, computed once per `register()` via
|
|
1167
1191
|
* `buildResolvedTraitConfigs` (`@almadar/core`). An embedded sub-trait's
|
|
@@ -1382,6 +1406,13 @@ declare class OrbitalServerRuntime {
|
|
|
1382
1406
|
setDefaultUser(user: UserContext | undefined): void;
|
|
1383
1407
|
/** The viewer a dev host is currently presenting the app as. */
|
|
1384
1408
|
getDefaultUser(): UserContext | undefined;
|
|
1409
|
+
/**
|
|
1410
|
+
* Queue a tick-stamped dispatch for coalesced snapshot relay (T6). Newest
|
|
1411
|
+
* per (originClientId, orbital, event) wins between flushes — the standard
|
|
1412
|
+
* netcode position-broadcast discipline.
|
|
1413
|
+
*/
|
|
1414
|
+
private queueTickRelay;
|
|
1415
|
+
private flushTickRelay;
|
|
1385
1416
|
/**
|
|
1386
1417
|
* The registered app's declared persona roster: the live rows of its
|
|
1387
1418
|
* `[identity]` entity, mapped onto viewers (`Almadar_LOLO_Identity.md` §4.3).
|
|
@@ -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-
|
|
3
|
-
import './types-
|
|
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-
|
|
2
|
-
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-
|
|
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';
|
|
@@ -137,6 +137,14 @@ var OrbitalServerRuntime = class {
|
|
|
137
137
|
appThemeKey;
|
|
138
138
|
/** Wired by the hosting server (e.g. the playground SSE endpoint) via `setLiveBroadcastSink`. */
|
|
139
139
|
liveBroadcastSink = null;
|
|
140
|
+
/**
|
|
141
|
+
* Tick-broadcast relay (T6): newest pending item per
|
|
142
|
+
* (originClientId, orbital, event), flushed to the live-broadcast sink on
|
|
143
|
+
* the `tickRelayIntervalMs` cadence — other tabs get the latest position
|
|
144
|
+
* at snapshot rate, never 1:1 with emissions.
|
|
145
|
+
*/
|
|
146
|
+
tickRelayPending = /* @__PURE__ */ new Map();
|
|
147
|
+
tickRelayTimer = null;
|
|
140
148
|
/**
|
|
141
149
|
* Trait name -> resolved `TraitConfig`, computed once per `register()` via
|
|
142
150
|
* `buildResolvedTraitConfigs` (`@almadar/core`). An embedded sub-trait's
|
|
@@ -1047,6 +1055,37 @@ var OrbitalServerRuntime = class {
|
|
|
1047
1055
|
getDefaultUser() {
|
|
1048
1056
|
return this.config.defaultUser;
|
|
1049
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Queue a tick-stamped dispatch for coalesced snapshot relay (T6). Newest
|
|
1060
|
+
* per (originClientId, orbital, event) wins between flushes — the standard
|
|
1061
|
+
* netcode position-broadcast discipline.
|
|
1062
|
+
*/
|
|
1063
|
+
queueTickRelay(orbitalName, request) {
|
|
1064
|
+
const key = `${request.clientId ?? ""}:${orbitalName}:${request.event}`;
|
|
1065
|
+
this.tickRelayPending.set(key, {
|
|
1066
|
+
event: request.event,
|
|
1067
|
+
payload: request.payload,
|
|
1068
|
+
source: { orbital: orbitalName, trait: request.sourceTrait, tick: request.tick },
|
|
1069
|
+
originClientId: request.clientId
|
|
1070
|
+
});
|
|
1071
|
+
if (this.tickRelayTimer === null) {
|
|
1072
|
+
const timer = setInterval(() => this.flushTickRelay(), this.config.tickRelayIntervalMs ?? 50);
|
|
1073
|
+
if (typeof timer === "object" && typeof timer.unref === "function") timer.unref();
|
|
1074
|
+
this.tickRelayTimer = timer;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
flushTickRelay() {
|
|
1078
|
+
if (this.tickRelayPending.size === 0) {
|
|
1079
|
+
if (this.tickRelayTimer !== null) {
|
|
1080
|
+
clearInterval(this.tickRelayTimer);
|
|
1081
|
+
this.tickRelayTimer = null;
|
|
1082
|
+
}
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
const items = Array.from(this.tickRelayPending.values());
|
|
1086
|
+
this.tickRelayPending.clear();
|
|
1087
|
+
for (const item of items) this.liveBroadcastSink?.(item);
|
|
1088
|
+
}
|
|
1050
1089
|
/**
|
|
1051
1090
|
* The registered app's declared persona roster: the live rows of its
|
|
1052
1091
|
* `[identity]` entity, mapped onto viewers (`Almadar_LOLO_Identity.md` §4.3).
|
|
@@ -1252,6 +1291,9 @@ var OrbitalServerRuntime = class {
|
|
|
1252
1291
|
if (effectResults.length > 0) {
|
|
1253
1292
|
response.effectResults = effectResults;
|
|
1254
1293
|
}
|
|
1294
|
+
if (request.tick !== void 0 && this.liveBroadcastSink !== null) {
|
|
1295
|
+
this.queueTickRelay(orbitalName, request);
|
|
1296
|
+
}
|
|
1255
1297
|
return response;
|
|
1256
1298
|
} catch (error) {
|
|
1257
1299
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1500,6 +1542,7 @@ var OrbitalServerRuntime = class {
|
|
|
1500
1542
|
data: resultData,
|
|
1501
1543
|
success: true
|
|
1502
1544
|
});
|
|
1545
|
+
return resultData;
|
|
1503
1546
|
} catch (err) {
|
|
1504
1547
|
effectLog.error("persist:store-mutate-error", {
|
|
1505
1548
|
action,
|
|
@@ -1514,6 +1557,7 @@ var OrbitalServerRuntime = class {
|
|
|
1514
1557
|
error: err instanceof Error ? err.message : String(err)
|
|
1515
1558
|
});
|
|
1516
1559
|
}
|
|
1560
|
+
return void 0;
|
|
1517
1561
|
},
|
|
1518
1562
|
callService: async (service, action, params) => {
|
|
1519
1563
|
try {
|
package/dist/ServerBridge.d.ts
CHANGED
|
@@ -234,9 +234,9 @@ var TickScheduler = class {
|
|
|
234
234
|
}
|
|
235
235
|
tick.accumulatedMs += timestamp - tick.lastTimestamp;
|
|
236
236
|
tick.lastTimestamp = timestamp;
|
|
237
|
-
|
|
238
|
-
tick.accumulatedMs -= tick.intervalMs;
|
|
237
|
+
if (tick.accumulatedMs >= tick.intervalMs) {
|
|
239
238
|
tick.onDue();
|
|
239
|
+
tick.accumulatedMs = tick.accumulatedMs % tick.intervalMs;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -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
|
|
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",
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
|
@@ -146,8 +146,13 @@ declare function createUnifiedLoader(options: UnifiedLoaderOptions): UnifiedLoad
|
|
|
146
146
|
* isn't available, e.g. Node/SSR) that walks every registered tick each pass
|
|
147
147
|
* and fires whichever one(s) have crossed their own interval — so ticks due
|
|
148
148
|
* in the same pass commit together instead of on independent, uncoordinated
|
|
149
|
-
* timers.
|
|
150
|
-
* (
|
|
149
|
+
* timers. Each interval tick fires AT MOST ONCE per pass: missed beats are
|
|
150
|
+
* dropped (the phase remainder is kept, so healthy cadence is unchanged),
|
|
151
|
+
* because bursting catch-up firings after a slow pass multiplies the work
|
|
152
|
+
* that made the pass slow — an unbounded accumulator is a spiral-of-death
|
|
153
|
+
* amplifier that pegs the main thread and starves input. Framework-light:
|
|
154
|
+
* no React, usable from `OrbitalServerRuntime` (this package) and from
|
|
155
|
+
* `@almadar/ui`'s `useTraitStateMachine` alike.
|
|
151
156
|
*
|
|
152
157
|
* @packageDocumentation
|
|
153
158
|
*/
|
|
@@ -284,7 +289,7 @@ declare function interpolateProps(props: PatternProps, ctx: EvaluationContext):
|
|
|
284
289
|
/**
|
|
285
290
|
* Interpolate a single value.
|
|
286
291
|
*/
|
|
287
|
-
declare function interpolateValue(value:
|
|
292
|
+
declare function interpolateValue(value: RuntimeValue, ctx: EvaluationContext): RuntimeValue;
|
|
288
293
|
/**
|
|
289
294
|
* Value a deferred render-ui prop tree can carry: interpolated runtime
|
|
290
295
|
* values, raw pass-through S-expressions (`fn` lambdas), render-time
|
|
@@ -414,15 +419,15 @@ declare class EffectExecutor {
|
|
|
414
419
|
/**
|
|
415
420
|
* Execute a single effect.
|
|
416
421
|
*/
|
|
417
|
-
execute(effect:
|
|
422
|
+
execute(effect: RuntimeValue): Promise<void>;
|
|
418
423
|
/**
|
|
419
424
|
* Execute multiple effects in sequence.
|
|
420
425
|
*/
|
|
421
|
-
executeAll(effects:
|
|
426
|
+
executeAll(effects: RuntimeValue[]): Promise<void>;
|
|
422
427
|
/**
|
|
423
428
|
* Execute multiple effects in parallel.
|
|
424
429
|
*/
|
|
425
|
-
executeParallel(effects:
|
|
430
|
+
executeParallel(effects: RuntimeValue[]): Promise<void>;
|
|
426
431
|
/**
|
|
427
432
|
* Execute effects and return detailed results for each.
|
|
428
433
|
* Enables compensating transitions by reporting which effects failed.
|
|
@@ -430,7 +435,7 @@ declare class EffectExecutor {
|
|
|
430
435
|
* Unlike `executeAll`, this method does NOT throw on effect errors.
|
|
431
436
|
* Instead, it captures errors in the returned `EffectResult[]` array.
|
|
432
437
|
*/
|
|
433
|
-
executeWithResults(effects:
|
|
438
|
+
executeWithResults(effects: RuntimeValue[]): Promise<EffectResult[]>;
|
|
434
439
|
private extractEmitConfig;
|
|
435
440
|
/** Build the source metadata stamp for an emit fired from this trait. */
|
|
436
441
|
private sourceStamp;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { EffectExecutor } from './chunk-
|
|
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-
|
|
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-
|
|
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
|
-
/**
|
|
153
|
-
|
|
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,
|
|
385
|
+
locals?: Map<string, RuntimeValue>;
|
|
375
386
|
/** Additional custom bindings */
|
|
376
387
|
[key: string]: unknown;
|
|
377
388
|
}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -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-
|
|
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.
|
|
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.
|
|
61
|
-
"@almadar/evaluator": "^2.
|
|
60
|
+
"@almadar/core": "^10.69.0",
|
|
61
|
+
"@almadar/evaluator": "^2.42.0",
|
|
62
62
|
"@almadar/logger": "^1.11.0",
|
|
63
|
-
"@almadar/server": "^2.
|
|
64
|
-
"@almadar/std": "^16.
|
|
63
|
+
"@almadar/server": "^2.38.0",
|
|
64
|
+
"@almadar/std": "^16.185.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"express": "^5.0.0"
|