@almadar/runtime 6.33.0 → 6.35.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-Cep380it.d.ts → OrbitalServerRuntime-BY-qzEQ_.d.ts} +59 -7
- package/dist/OrbitalServerRuntime.d.ts +2 -2
- package/dist/OrbitalServerRuntime.js +66 -24
- package/dist/ServerBridge.d.ts +1 -1
- package/dist/{chunk-JZDLN2FS.js → chunk-VCEF5JOX.js} +354 -61
- package/dist/createOsHandlers.d.ts +1 -1
- package/dist/{external-loader-OPXVTNC4.js → external-loader-FNK5AU6U.js} +27 -1
- package/dist/index.d.ts +11 -7
- package/dist/index.js +44 -4
- package/dist/{types-ConZnrpe.d.ts → types-C8RsO0xa.d.ts} +13 -3
- package/package.json +4 -4
|
@@ -50,6 +50,22 @@ var LoaderCache = class {
|
|
|
50
50
|
return this.cache.size;
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
var BROWSE_FORM_HELP = "Accepted forms \u2014 loader: std/behaviors/<name> (e.g. std/behaviors/std-stats) | almadar-behaviors/<name> (e.g. almadar-behaviors/rpg-hero); browse: @std/<topic>/<kind>/<name>.lolo (e.g. @std/ui/core/atoms/std-stats.lolo) | @behaviors/<topic>/<kind>/<name>.lolo (e.g. @behaviors/app/molecules/app-crud-manager.lolo)";
|
|
54
|
+
var BROWSE_PREFIX_TO_PACKAGE = [
|
|
55
|
+
["@std/", "std/behaviors/"],
|
|
56
|
+
["@behaviors/", "almadar-behaviors/"]
|
|
57
|
+
];
|
|
58
|
+
function mapBrowseSpecifier(importPath) {
|
|
59
|
+
for (const [prefix, pkg] of BROWSE_PREFIX_TO_PACKAGE) {
|
|
60
|
+
if (!importPath.startsWith(prefix)) continue;
|
|
61
|
+
const rest = importPath.slice(prefix.length);
|
|
62
|
+
const basename2 = rest.slice(rest.lastIndexOf("/") + 1);
|
|
63
|
+
const name = basename2.endsWith(".lolo") ? basename2.slice(0, -".lolo".length) : basename2;
|
|
64
|
+
if (name.length === 0) return { kind: "malformed" };
|
|
65
|
+
return { kind: "mapped", canonical: `${pkg}${name}` };
|
|
66
|
+
}
|
|
67
|
+
return { kind: "not-browse-form" };
|
|
68
|
+
}
|
|
53
69
|
var ExternalOrbitalLoader = class {
|
|
54
70
|
options;
|
|
55
71
|
cache;
|
|
@@ -147,6 +163,16 @@ var ExternalOrbitalLoader = class {
|
|
|
147
163
|
* Resolve an import path to an absolute filesystem path.
|
|
148
164
|
*/
|
|
149
165
|
resolvePath(importPath, fromPath) {
|
|
166
|
+
const mapped = mapBrowseSpecifier(importPath);
|
|
167
|
+
if (mapped.kind === "malformed") {
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
error: `Unresolvable primitive import "${importPath}". ${BROWSE_FORM_HELP}`
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (mapped.kind === "mapped") {
|
|
174
|
+
importPath = mapped.canonical;
|
|
175
|
+
}
|
|
150
176
|
if (importPath.startsWith("std/")) {
|
|
151
177
|
return this.resolveStdPath(importPath);
|
|
152
178
|
}
|
|
@@ -438,4 +464,4 @@ function autoDetectBehaviorsLibPaths(stdLibPath) {
|
|
|
438
464
|
return found;
|
|
439
465
|
}
|
|
440
466
|
|
|
441
|
-
export { ExternalOrbitalLoader, ImportChain, LoaderCache, createLoader, parseImportPath };
|
|
467
|
+
export { ExternalOrbitalLoader, ImportChain, LoaderCache, createLoader, mapBrowseSpecifier, parseImportPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, g as EffectContext, h as ExecutionEnvironment, i as EffectResult, T as TraitDefinition } from './types-
|
|
2
|
-
export { j as BrowserFileMeta, k as BrowserFilePickerOptions, l as BrowserGeolocationOptions, m as BrowserGeolocationPosition, C as ConfigContext, n 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 { B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, g as EffectContext, h as ExecutionEnvironment, i as EffectResult, T as TraitDefinition } from './types-C8RsO0xa.js';
|
|
2
|
+
export { j as BrowserFileMeta, k as BrowserFilePickerOptions, l as BrowserGeolocationOptions, m as BrowserGeolocationPosition, C as ConfigContext, n 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-C8RsO0xa.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-BY-qzEQ_.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-BY-qzEQ_.js';
|
|
5
5
|
import { EvaluationContext, SExpressionEvaluator } from '@almadar/evaluator';
|
|
6
6
|
export { EvaluationContext, createMinimalContext } from '@almadar/evaluator';
|
|
7
|
-
import { TraitConfigObject, EventPayload, PatternConfig, EntityField, EntityRow, ServiceParams, PayloadField, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
|
|
7
|
+
import { TraitConfigObject, EventPayload, PatternConfig, EntityId, EntityField, EntityRow, ServiceParams, PayloadField, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
|
|
8
8
|
export { EntityField, normalizeCallSiteConfigToValues } from '@almadar/core';
|
|
9
9
|
export { ServerBridgeConfig, ServerBridgeState } from './ServerBridge.js';
|
|
10
10
|
export { OsHandlerContext, OsHandlerResult } from './createOsHandlers.js';
|
|
@@ -540,6 +540,8 @@ type NamedEntityField = EntityField & {
|
|
|
540
540
|
};
|
|
541
541
|
interface EntitySchema {
|
|
542
542
|
name: string;
|
|
543
|
+
/** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */
|
|
544
|
+
id?: EntityId;
|
|
543
545
|
fields: NamedEntityField[];
|
|
544
546
|
/** Pre-authored instance data from the schema (used instead of generated mocks) */
|
|
545
547
|
seedData?: EntityRow[];
|
|
@@ -559,6 +561,8 @@ declare class MockPersistenceAdapter implements PersistenceAdapter {
|
|
|
559
561
|
private stores;
|
|
560
562
|
private schemas;
|
|
561
563
|
private idCounters;
|
|
564
|
+
/** entityId -> normalized store name, so relation lookups can prefer the id sibling over `relation.entity` name-matching. */
|
|
565
|
+
private storeNameById;
|
|
562
566
|
private config;
|
|
563
567
|
constructor(config?: MockPersistenceConfig);
|
|
564
568
|
/** Re-anchor the PRNG to the configured seed. Called before every
|
|
@@ -961,8 +965,8 @@ declare function detectLayoutStrategy(orbitals: OrbitalDefinition[], eventWiring
|
|
|
961
965
|
interface ComposeBehaviorsInput {
|
|
962
966
|
/** Application name */
|
|
963
967
|
appName: string;
|
|
964
|
-
/** Orbital definitions to compose */
|
|
965
|
-
orbitals: OrbitalDefinition[];
|
|
968
|
+
/** Orbital definitions (or schemas) to compose */
|
|
969
|
+
orbitals: (OrbitalDefinition | OrbitalSchema)[];
|
|
966
970
|
/** Layout strategy override, or 'auto' to detect */
|
|
967
971
|
layoutStrategy?: LayoutStrategy | 'auto';
|
|
968
972
|
/** Cross-orbital event wiring */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EffectExecutor, createContextFromBindings } from './chunk-
|
|
2
|
-
export { CALLSITE_PAYLOAD_PREFIX, EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, resolveCallSitePayloadCaptures, validateEventPayload, validatePayloadShapes } from './chunk-
|
|
1
|
+
import { EffectExecutor, createContextFromBindings } from './chunk-VCEF5JOX.js';
|
|
2
|
+
export { CALLSITE_PAYLOAD_PREFIX, EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createMinimalContext, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, resolveCallSitePayloadCaptures, validateEventPayload, validatePayloadShapes } from './chunk-VCEF5JOX.js';
|
|
3
3
|
export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './chunk-OU3ITB5S.js';
|
|
4
4
|
import './chunk-OQJIK6PZ.js';
|
|
5
5
|
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-O5VGKPTG.js';
|
|
@@ -719,6 +719,41 @@ function detectLayoutStrategy(orbitals, eventWiring) {
|
|
|
719
719
|
}
|
|
720
720
|
|
|
721
721
|
// src/composition/compose-behaviors.ts
|
|
722
|
+
function isSchema(input) {
|
|
723
|
+
return "orbitals" in input && Array.isArray(input.orbitals);
|
|
724
|
+
}
|
|
725
|
+
function asDefinitions(inputs) {
|
|
726
|
+
return inputs.flatMap(
|
|
727
|
+
(input) => isSchema(input) ? input.orbitals : [input]
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
function mergeLedgers(inputs) {
|
|
731
|
+
const merged = /* @__PURE__ */ new Map();
|
|
732
|
+
let sawLedger = false;
|
|
733
|
+
for (const input of inputs) {
|
|
734
|
+
if (!isSchema(input) || input.ledger === void 0) continue;
|
|
735
|
+
sawLedger = true;
|
|
736
|
+
for (const [id, entry] of Object.entries(input.ledger.entries)) {
|
|
737
|
+
if (!merged.has(id)) merged.set(id, entry);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
if (!sawLedger) return void 0;
|
|
741
|
+
const entries = {};
|
|
742
|
+
for (const [id, entry] of [...merged.entries()].sort(
|
|
743
|
+
([a], [b]) => a < b ? -1 : a > b ? 1 : 0
|
|
744
|
+
)) {
|
|
745
|
+
entries[id] = entry;
|
|
746
|
+
}
|
|
747
|
+
return { schemaVersion: 1, entries };
|
|
748
|
+
}
|
|
749
|
+
function mergeSchemaVersions(inputs) {
|
|
750
|
+
let max;
|
|
751
|
+
for (const input of inputs) {
|
|
752
|
+
if (!isSchema(input) || input.schemaVersion === void 0) continue;
|
|
753
|
+
max = max === void 0 ? input.schemaVersion : Math.max(max, input.schemaVersion);
|
|
754
|
+
}
|
|
755
|
+
return max;
|
|
756
|
+
}
|
|
722
757
|
function toKebabCase(name) {
|
|
723
758
|
return name.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
724
759
|
}
|
|
@@ -769,10 +804,11 @@ function getEntityName(orbital) {
|
|
|
769
804
|
function composeBehaviors(input) {
|
|
770
805
|
const {
|
|
771
806
|
appName,
|
|
772
|
-
orbitals:
|
|
807
|
+
orbitals: rawInputs,
|
|
773
808
|
layoutStrategy: strategyInput,
|
|
774
809
|
eventWiring
|
|
775
810
|
} = input;
|
|
811
|
+
const rawOrbitals = asDefinitions(rawInputs);
|
|
776
812
|
const wiredOrbitals = eventWiring && eventWiring.length > 0 ? applyEventWiring(rawOrbitals, eventWiring) : rawOrbitals;
|
|
777
813
|
const strategy = !strategyInput || strategyInput === "auto" ? detectLayoutStrategy(wiredOrbitals, eventWiring) : strategyInput;
|
|
778
814
|
const pages = generatePages(wiredOrbitals, strategy);
|
|
@@ -786,10 +822,14 @@ function composeBehaviors(input) {
|
|
|
786
822
|
pages: page ? [page] : []
|
|
787
823
|
};
|
|
788
824
|
});
|
|
825
|
+
const ledger = mergeLedgers(rawInputs);
|
|
826
|
+
const schemaVersion = mergeSchemaVersions(rawInputs);
|
|
789
827
|
const schema = {
|
|
790
828
|
name: appName,
|
|
791
829
|
version: "1.0.0",
|
|
792
|
-
orbitals: orbitalsWithPages
|
|
830
|
+
orbitals: orbitalsWithPages,
|
|
831
|
+
...schemaVersion !== void 0 ? { schemaVersion } : {},
|
|
832
|
+
...ledger !== void 0 ? { ledger } : {}
|
|
793
833
|
};
|
|
794
834
|
return {
|
|
795
835
|
schema,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _almadar_core from '@almadar/core';
|
|
2
|
-
import { SExpr, EventPayload, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, IntegrationContext, TraitConfig, BusEvent, EntityRow, FieldValue, ServiceParams, FetchResult, PatternConfig, ResolvedPatternProps, Orbital, ServiceCallResult, BusEventSource, BusEventListener, Unsubscribe as Unsubscribe$1 } from '@almadar/core';
|
|
2
|
+
import { TraitId, EventId, SExpr, EventPayload, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, IntegrationContext, TraitConfig, BusEvent, EntityRow, FieldValue, ServiceParams, FetchResult, PatternConfig, ResolvedPatternProps, Orbital, ServiceCallResult, BusEventSource, BusEventListener, Unsubscribe as Unsubscribe$1 } from '@almadar/core';
|
|
3
3
|
|
|
4
4
|
/** Alias for ResolvedPatternProps to avoid breaking internal consumers */
|
|
5
5
|
type PatternProps = ResolvedPatternProps;
|
|
@@ -17,8 +17,9 @@ type Unsubscribe = Unsubscribe$1;
|
|
|
17
17
|
* Event bus interface for pub/sub communication
|
|
18
18
|
*/
|
|
19
19
|
interface IEventBus {
|
|
20
|
-
/** Emit an event
|
|
21
|
-
|
|
20
|
+
/** Emit an event. `routingKey` (V4) keys delivery by event-id when the
|
|
21
|
+
* schema carries ids; absent → keyed by `type` (name, legacy). */
|
|
22
|
+
emit(type: string, payload?: EventPayload, source?: BusEventSource, routingKey?: string): void;
|
|
22
23
|
/** Subscribe to an event */
|
|
23
24
|
on(type: string, listener: EventListener): Unsubscribe;
|
|
24
25
|
/** Subscribe to ALL events (wildcard listener) */
|
|
@@ -70,6 +71,9 @@ interface TransitionResult {
|
|
|
70
71
|
* Minimal trait definition for state machine processing
|
|
71
72
|
*/
|
|
72
73
|
interface TraitDefinition {
|
|
74
|
+
/** V4 dual-carry id sibling of `name` — the stable state-machine lookup
|
|
75
|
+
* key when present (ledger-backed). Absent → keyed by name (legacy). */
|
|
76
|
+
id?: TraitId;
|
|
73
77
|
name: string;
|
|
74
78
|
states: Array<{
|
|
75
79
|
name: string;
|
|
@@ -79,6 +83,8 @@ interface TraitDefinition {
|
|
|
79
83
|
from: string | string[];
|
|
80
84
|
to: string;
|
|
81
85
|
event: string;
|
|
86
|
+
/** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */
|
|
87
|
+
eventId?: EventId;
|
|
82
88
|
guard?: unknown;
|
|
83
89
|
effects?: SExpr[];
|
|
84
90
|
/** Compensating transition when effects fail (RCG-04) */
|
|
@@ -90,7 +96,11 @@ interface TraitDefinition {
|
|
|
90
96
|
/** Cross-trait event listeners (optional) */
|
|
91
97
|
listens?: Array<{
|
|
92
98
|
event: string;
|
|
99
|
+
/** V4 dual-carry id sibling of `event` — optional until the Phase-7 flip. */
|
|
100
|
+
eventId?: EventId;
|
|
93
101
|
triggers: string;
|
|
102
|
+
/** V4 dual-carry id sibling of `triggers` — optional until the Phase-7 flip. */
|
|
103
|
+
triggersId?: EventId;
|
|
94
104
|
payloadMapping?: EventPayload;
|
|
95
105
|
}>;
|
|
96
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/runtime",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.35.0",
|
|
4
4
|
"description": "Interpreted runtime for Almadar orbital applications (OrbitalServerRuntime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@almadar/core": "^10.
|
|
56
|
-
"@almadar/evaluator": "^2.
|
|
55
|
+
"@almadar/core": "^10.32.0",
|
|
56
|
+
"@almadar/evaluator": "^2.32.0",
|
|
57
57
|
"@almadar/logger": "^1.9.0",
|
|
58
58
|
"@almadar/server": "^2.25.0",
|
|
59
|
-
"@almadar/std": "^16.
|
|
59
|
+
"@almadar/std": "^16.142.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"express": "^5.0.0"
|