@almadar/runtime 6.25.0 → 6.28.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,4 +1,4 @@
1
- import { I as IEventBus } from './types-BA7GoDni.js';
1
+ import { I as IEventBus } from './types-CguyGOms.js';
2
2
  import { EventPayload } from '@almadar/core';
3
3
 
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { parseCron, cronMinuteKey, cronMatches } from './chunk-U4PL237A.js';
2
2
  import { createLogger, setNamespaceLevel } from '@almadar/logger';
3
- import { resolveBinding, evaluate, createMinimalContext, evaluateGuard } from '@almadar/evaluator';
3
+ import { resolveBinding, evaluate, createMinimalContext, evaluateGuard, SExpressionEvaluator } from '@almadar/evaluator';
4
4
  export { createMinimalContext } from '@almadar/evaluator';
5
5
  import { isKnownStdOperator } from '@almadar/std/registry';
6
6
  import { isCallSiteConfigDeclaration, OrbitalSchemaSchema, isInlineTrait, isEntityCall, isEntityReference, parseEntityRef, parseImportedTraitRef, isPageReference, isPageReferenceString, isPageReferenceObject, parsePageRef } from '@almadar/core';
@@ -1029,6 +1029,7 @@ var EffectExecutor = class _EffectExecutor {
1029
1029
  debug;
1030
1030
  strictBindings;
1031
1031
  contextExtensions;
1032
+ evaluator;
1032
1033
  constructor(options) {
1033
1034
  this.handlers = options.handlers;
1034
1035
  this.bindings = options.bindings;
@@ -1036,6 +1037,15 @@ var EffectExecutor = class _EffectExecutor {
1036
1037
  this.debug = options.debug ?? false;
1037
1038
  this.strictBindings = options.strictBindings ?? false;
1038
1039
  this.contextExtensions = options.contextExtensions;
1040
+ this.evaluator = options.evaluator;
1041
+ }
1042
+ _evaluator;
1043
+ getEvaluator() {
1044
+ if (this.evaluator) return this.evaluator;
1045
+ if (!this._evaluator) {
1046
+ this._evaluator = new SExpressionEvaluator();
1047
+ }
1048
+ return this._evaluator;
1039
1049
  }
1040
1050
  // ==========================================================================
1041
1051
  // Handler Manifest Validation (RCG-03)
@@ -1132,7 +1142,19 @@ var EffectExecutor = class _EffectExecutor {
1132
1142
  resolvedArgs = args;
1133
1143
  } else if (isSetPathForm) {
1134
1144
  const ctx = createContextFromBindings(this.bindings, this.strictBindings, this.contextExtensions);
1135
- resolvedArgs = [args[0], ...args.slice(1).map((a) => interpolateValue(a, ctx))];
1145
+ const resolvedRest = [];
1146
+ for (const a of args.slice(1)) {
1147
+ if (Array.isArray(a) && a.length > 0 && typeof a[0] === "string") {
1148
+ let result = this.getEvaluator().evaluate(a, ctx);
1149
+ if (result instanceof Promise) {
1150
+ result = await result;
1151
+ }
1152
+ resolvedRest.push(result);
1153
+ } else {
1154
+ resolvedRest.push(interpolateValue(a, ctx));
1155
+ }
1156
+ }
1157
+ resolvedArgs = [args[0], ...resolvedRest];
1136
1158
  } else if (isFetchLike) {
1137
1159
  const ctx = createContextFromBindings(this.bindings, this.strictBindings, this.contextExtensions);
1138
1160
  const opts = args[1];
@@ -1800,8 +1822,82 @@ var EffectExecutor = class _EffectExecutor {
1800
1822
  }
1801
1823
  break;
1802
1824
  }
1825
+ // === Agent substrate operators (server-side, effect-position) ===
1826
+ case "compose/compose-all": {
1827
+ if (this.handlers.substrateComposeAll) {
1828
+ const config = args[0];
1829
+ await this.handlers.substrateComposeAll(config);
1830
+ } else {
1831
+ this.logUnsupported("compose/compose-all");
1832
+ }
1833
+ break;
1834
+ }
1835
+ case "compose/compose-children": {
1836
+ if (this.handlers.substrateComposeChildren) {
1837
+ const parentName = args[0];
1838
+ const children = args[1];
1839
+ await this.handlers.substrateComposeChildren(parentName, children);
1840
+ } else {
1841
+ this.logUnsupported("compose/compose-children");
1842
+ }
1843
+ break;
1844
+ }
1845
+ case "behavior/instantiate": {
1846
+ if (this.handlers.substrateInstantiate) {
1847
+ const parentName = args[0];
1848
+ const behavior = args[1];
1849
+ const params = args.length > 2 ? args[2] : void 0;
1850
+ await this.handlers.substrateInstantiate(parentName, behavior, params);
1851
+ } else {
1852
+ this.logUnsupported("behavior/instantiate");
1853
+ }
1854
+ break;
1855
+ }
1856
+ case "behavior/call": {
1857
+ if (this.handlers.substrateCall) {
1858
+ const behavior = args[0];
1859
+ const method = args[1];
1860
+ const params = args.length > 2 ? args[2] : void 0;
1861
+ await this.handlers.substrateCall(behavior, method, params);
1862
+ } else {
1863
+ this.logUnsupported("behavior/call");
1864
+ }
1865
+ break;
1866
+ }
1867
+ case "validate/validate": {
1868
+ if (this.handlers.substrateValidate) {
1869
+ const orbitalName = args[0];
1870
+ await this.handlers.substrateValidate(orbitalName);
1871
+ } else {
1872
+ this.logUnsupported("validate/validate");
1873
+ }
1874
+ break;
1875
+ }
1876
+ case "lolo/emit-body": {
1877
+ if (this.handlers.substrateEmitBody) {
1878
+ const orbitalName = args[0];
1879
+ const loloSource = args[1];
1880
+ await this.handlers.substrateEmitBody(orbitalName, loloSource);
1881
+ } else {
1882
+ this.logUnsupported("lolo/emit-body");
1883
+ }
1884
+ break;
1885
+ }
1803
1886
  default: {
1804
- if (this.debug) {
1887
+ if (operator.includes("/")) {
1888
+ const ctx = createContextFromBindings(
1889
+ this.bindings,
1890
+ this.strictBindings,
1891
+ this.contextExtensions
1892
+ );
1893
+ const result = this.getEvaluator().evaluate(
1894
+ [operator, ...args],
1895
+ ctx
1896
+ );
1897
+ if (result instanceof Promise) {
1898
+ await result;
1899
+ }
1900
+ } else if (this.debug) {
1805
1901
  effectLog.warn("unknown-operator", { operator });
1806
1902
  }
1807
1903
  }
@@ -2750,7 +2846,7 @@ async function getExternalLoaderModule() {
2750
2846
  return null;
2751
2847
  }
2752
2848
  try {
2753
- externalLoaderModule = await import('./external-loader-IN246DQM.js');
2849
+ externalLoaderModule = await import('./external-loader-YF6A3256.js');
2754
2850
  return externalLoaderModule;
2755
2851
  } catch {
2756
2852
  return null;
@@ -3191,7 +3287,7 @@ var ReferenceResolver = class {
3191
3287
  if (this.loader || this.loaderInitialized) return;
3192
3288
  this.loaderInitialized = true;
3193
3289
  try {
3194
- const { ExternalOrbitalLoader } = await import('./external-loader-IN246DQM.js');
3290
+ const { ExternalOrbitalLoader } = await import('./external-loader-YF6A3256.js');
3195
3291
  this.loader = new ExternalOrbitalLoader(this.options);
3196
3292
  } catch {
3197
3293
  }
@@ -3901,5 +3997,5 @@ var InMemoryPersistence = class {
3901
3997
  };
3902
3998
 
3903
3999
  export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, containsBindings, createContextFromBindings, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes };
3904
- //# sourceMappingURL=chunk-NTKEAKYI.js.map
3905
- //# sourceMappingURL=chunk-NTKEAKYI.js.map
4000
+ //# sourceMappingURL=chunk-FWBY567U.js.map
4001
+ //# sourceMappingURL=chunk-FWBY567U.js.map