@almadar/evaluator 2.39.0 → 2.41.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 { UserContext, TraitConfig, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, IntegrationContext, SExpr } from '@almadar/core';
1
+ import { UserContext, TraitConfig, NavItem, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, IntegrationContext, SExpr } from '@almadar/core';
2
2
 
3
3
  /**
4
4
  * Evaluation Context
@@ -35,6 +35,23 @@ interface EvaluationContext {
35
35
  * trait ref; the atom's render-ui reads `@config.icon`, `@config.title`, etc.
36
36
  */
37
37
  config?: TraitConfig;
38
+ /**
39
+ * The host orbital's pages as a `NavItem[]` for the `@pages` render sigil
40
+ * (`href = page.path`, `label = page.name`). Seeded into the render binding
41
+ * context only — never present on a guard context (`createMinimalContext`),
42
+ * so the sigil is render-resolved exactly like the compiler's
43
+ * `OirBindingRoot::Pages`. Mirrors `@currentTheme` / the compiler's
44
+ * post-pass substitution in `resolve_to_oir`.
45
+ */
46
+ pages?: NavItem[];
47
+ /**
48
+ * The `data-theme` selector-key string for the `@currentTheme` render sigil,
49
+ * derived from the host orbital's `Orbital.theme` (a `ThemeRef` name).
50
+ * Render-resolved only (never on a guard context). The knob that consumes
51
+ * it stays `string` — the renderer applies the theme via the `data-theme`
52
+ * attribute + CSS `[data-theme="..."]` blocks.
53
+ */
54
+ currentTheme?: string;
38
55
  /**
39
56
  * When true, log warnings when bindings resolve to undefined. (RCG-01)
40
57
  * Helps detect typos and missing entity fields early.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SExpr, ListenPayloadEvaluator } from '@almadar/core';
2
2
  export { CORE_BINDINGS, CoreBinding, Expression, ExpressionSchema, ParsedBinding, SExpr, SExprAtom, SExprSchema, UserContext, collectBindings, getArgs, getOperator, isBinding, isSExpr, isSExprAtom, isSExprCall, isValidBinding, parseBinding, sexpr, walkSExpr } from '@almadar/core';
3
- import { E as EvaluationContext } from './index-dAA7DJ-s.js';
4
- export { c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalAtomic, h as evalCallService, i as evalCeil, j as evalClamp, k as evalConcat, l as evalCount, m as evalDecrement, n as evalDeref, o as evalDespawn, p as evalDivide, q as evalDo, r as evalEmit, s as evalEmpty, t as evalEqual, u as evalFilter, v as evalFind, w as evalFirst, x as evalFloor, y as evalFn, z as evalGreaterThan, A as evalGreaterThanOrEqual, B as evalIf, C as evalIncludes, D as evalIncrement, F as evalLast, G as evalLessThan, H as evalLessThanOrEqual, I as evalLet, J as evalList, K as evalMap, L as evalMatches, M as evalMax, N as evalMin, O as evalModulo, P as evalMultiply, Q as evalNavigate, R as evalNot, S as evalNotEqual, T as evalNotify, U as evalNth, V as evalOr, W as evalPersist, X as evalRef, Y as evalRenderUI, Z as evalRound, _ as evalSet, $ as evalSetDynamic, a0 as evalSpawn, a1 as evalSubtract, a2 as evalSum, a3 as evalSwap, a4 as evalWatch, a5 as evalWhen, a6 as resolveBinding } from './index-dAA7DJ-s.js';
3
+ import { E as EvaluationContext } from './index-BIg56YY8.js';
4
+ export { c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalAtomic, h as evalCallService, i as evalCeil, j as evalClamp, k as evalConcat, l as evalCount, m as evalDecrement, n as evalDeref, o as evalDespawn, p as evalDivide, q as evalDo, r as evalEmit, s as evalEmpty, t as evalEqual, u as evalFilter, v as evalFind, w as evalFirst, x as evalFloor, y as evalFn, z as evalGreaterThan, A as evalGreaterThanOrEqual, B as evalIf, C as evalIncludes, D as evalIncrement, F as evalLast, G as evalLessThan, H as evalLessThanOrEqual, I as evalLet, J as evalList, K as evalMap, L as evalMatches, M as evalMax, N as evalMin, O as evalModulo, P as evalMultiply, Q as evalNavigate, R as evalNot, S as evalNotEqual, T as evalNotify, U as evalNth, V as evalOr, W as evalPersist, X as evalRef, Y as evalRenderUI, Z as evalRound, _ as evalSet, $ as evalSetDynamic, a0 as evalSpawn, a1 as evalSubtract, a2 as evalSum, a3 as evalSwap, a4 as evalWatch, a5 as evalWhen, a6 as resolveBinding } from './index-BIg56YY8.js';
5
5
 
6
6
  /**
7
7
  * S-Expression Evaluator
package/dist/index.js CHANGED
@@ -69,6 +69,10 @@ function resolveBinding(binding, ctx) {
69
69
  case "config":
70
70
  value = ctx.config;
71
71
  break;
72
+ case "pages":
73
+ return ctx.pages;
74
+ case "currentTheme":
75
+ return ctx.currentTheme;
72
76
  default:
73
77
  value = ctx.singletons.get(root);
74
78
  break;
@@ -1177,6 +1181,11 @@ function evalArrayMap(args, evaluate2, ctx) {
1177
1181
  return (arr ?? []).map((item, i) => evalWithItem(mapExpr, evaluate2, ctx, item, i));
1178
1182
  }
1179
1183
  function evalArrayReduce(args, evaluate2, ctx) {
1184
+ if (isSExpr(args[1]) && getOperator(args[1]) === "fn" && !(isSExpr(args[2]) && getOperator(args[2]) === "fn")) {
1185
+ throw new Error(
1186
+ "(array/reduce \u2026): the reducer lambda goes at argument 3 \u2014 (array/reduce arr init (fn (acc x) \u2026)) \u2014 same order the compiled path enforces (SEXPR_LAMBDA_ARG_POSITION)"
1187
+ );
1188
+ }
1180
1189
  const arr = evaluate2(args[0], ctx);
1181
1190
  const init = evaluate2(args[1], ctx);
1182
1191
  const reducerExpr = args[2];