@almadar/evaluator 2.5.1 → 2.5.3

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.
@@ -80,6 +80,8 @@ interface EvaluationContext {
80
80
  callService?: (service: string, method: string, params?: Record<string, unknown>) => Promise<unknown>;
81
81
  /** Render UI to a slot */
82
82
  renderUI?: (slot: string, pattern: unknown, props?: Record<string, unknown>, priority?: number) => void;
83
+ /** Register an OS trigger (server-side only) */
84
+ registerOsTrigger?: (type: string, config: Record<string, unknown>) => void;
83
85
  }
84
86
  /**
85
87
  * Create a minimal evaluation context for testing/guards.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SExpr } from '@almadar/core';
2
2
  export { CORE_BINDINGS, CoreBinding, Expression, ExpressionSchema, ParsedBinding, SExpr, SExprAtom, SExprSchema, collectBindings, getArgs, getOperator, isBinding, isSExpr, isSExprAtom, isSExprCall, isValidBinding, parseBinding, sexpr, walkSExpr } from '@almadar/core';
3
- import { E as EvaluationContext } from './index-C-vYm4zW.js';
4
- export { c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalCallService, h as evalCeil, i as evalClamp, j as evalConcat, k as evalCount, l as evalDecrement, m as evalDespawn, n as evalDivide, o as evalDo, p as evalEmit, q as evalEmpty, r as evalEqual, s as evalFilter, t as evalFind, u as evalFirst, v as evalFloor, w as evalFn, x as evalGreaterThan, y as evalGreaterThanOrEqual, z as evalIf, A as evalIncludes, B as evalIncrement, C as evalLast, D as evalLessThan, F as evalLessThanOrEqual, G as evalLet, H as evalMap, I as evalMatches, J as evalMax, K as evalMin, L as evalModulo, M as evalMultiply, N as evalNavigate, O as evalNot, P as evalNotEqual, Q as evalNotify, R as evalNth, S as evalOr, T as evalPersist, U as evalRenderUI, V as evalRound, W as evalSet, X as evalSetDynamic, Y as evalSpawn, Z as evalSubtract, _ as evalSum, $ as evalWhen, a0 as resolveBinding } from './index-C-vYm4zW.js';
3
+ import { E as EvaluationContext } from './index-Cwku8aP4.js';
4
+ export { c as createChildContext, a as createEffectContext, b as createMinimalContext, e as evalAbs, d as evalAdd, f as evalAnd, g as evalCallService, h as evalCeil, i as evalClamp, j as evalConcat, k as evalCount, l as evalDecrement, m as evalDespawn, n as evalDivide, o as evalDo, p as evalEmit, q as evalEmpty, r as evalEqual, s as evalFilter, t as evalFind, u as evalFirst, v as evalFloor, w as evalFn, x as evalGreaterThan, y as evalGreaterThanOrEqual, z as evalIf, A as evalIncludes, B as evalIncrement, C as evalLast, D as evalLessThan, F as evalLessThanOrEqual, G as evalLet, H as evalMap, I as evalMatches, J as evalMax, K as evalMin, L as evalModulo, M as evalMultiply, N as evalNavigate, O as evalNot, P as evalNotEqual, Q as evalNotify, R as evalNth, S as evalOr, T as evalPersist, U as evalRenderUI, V as evalRound, W as evalSet, X as evalSetDynamic, Y as evalSpawn, Z as evalSubtract, _ as evalSum, $ as evalWhen, a0 as resolveBinding } from './index-Cwku8aP4.js';
5
5
 
6
6
  /**
7
7
  * S-Expression Evaluator
package/dist/index.js CHANGED
@@ -2343,6 +2343,48 @@ function evalProbCredibleInterval(args, evaluate2, ctx) {
2343
2343
  return [sorted[loIdx], sorted[hiIdx]];
2344
2344
  }
2345
2345
 
2346
+ // std/os.ts
2347
+ function registerTrigger(ctx, type, config) {
2348
+ ctx.registerOsTrigger?.(type, config);
2349
+ }
2350
+ function evalOsWatchFiles(args, evaluate2, ctx) {
2351
+ const glob = evaluate2(args[0], ctx);
2352
+ const options = args[1] ? evaluate2(args[1], ctx) : {};
2353
+ registerTrigger(ctx, "watch-files", { glob, ...options });
2354
+ }
2355
+ function evalOsWatchProcess(args, evaluate2, ctx) {
2356
+ const name = evaluate2(args[0], ctx);
2357
+ const subcommand = args[1] ? evaluate2(args[1], ctx) : void 0;
2358
+ registerTrigger(ctx, "watch-process", { name, subcommand });
2359
+ }
2360
+ function evalOsWatchPort(args, evaluate2, ctx) {
2361
+ const port = evaluate2(args[0], ctx);
2362
+ const protocol = args[1] ? evaluate2(args[1], ctx) : "tcp";
2363
+ registerTrigger(ctx, "watch-port", { port, protocol });
2364
+ }
2365
+ function evalOsWatchHttp(args, evaluate2, ctx) {
2366
+ const urlPattern = evaluate2(args[0], ctx);
2367
+ const method = args[1] ? evaluate2(args[1], ctx) : void 0;
2368
+ registerTrigger(ctx, "watch-http", { urlPattern, method });
2369
+ }
2370
+ function evalOsWatchCron(args, evaluate2, ctx) {
2371
+ const expression = evaluate2(args[0], ctx);
2372
+ registerTrigger(ctx, "watch-cron", { expression });
2373
+ }
2374
+ function evalOsWatchSignal(args, evaluate2, ctx) {
2375
+ const signal = evaluate2(args[0], ctx);
2376
+ registerTrigger(ctx, "watch-signal", { signal });
2377
+ }
2378
+ function evalOsWatchEnv(args, evaluate2, ctx) {
2379
+ const variable = evaluate2(args[0], ctx);
2380
+ registerTrigger(ctx, "watch-env", { variable });
2381
+ }
2382
+ function evalOsDebounce(args, evaluate2, ctx) {
2383
+ const ms = evaluate2(args[0], ctx);
2384
+ const eventType = evaluate2(args[1], ctx);
2385
+ registerTrigger(ctx, "debounce", { ms, eventType });
2386
+ }
2387
+
2346
2388
  // SExpressionEvaluator.ts
2347
2389
  var jitCache = /* @__PURE__ */ new Map();
2348
2390
  var MAX_JIT_CACHE_SIZE = 1e3;
@@ -2950,6 +2992,33 @@ var SExpressionEvaluator = class {
2950
2992
  return evalProbPercentile(args, evaluate2, ctx);
2951
2993
  case "prob/credible-interval":
2952
2994
  return evalProbCredibleInterval(args, evaluate2, ctx);
2995
+ // ===============================
2996
+ // Standard Library: os/*
2997
+ // ===============================
2998
+ case "os/watch-files":
2999
+ evalOsWatchFiles(args, evaluate2, ctx);
3000
+ return void 0;
3001
+ case "os/watch-process":
3002
+ evalOsWatchProcess(args, evaluate2, ctx);
3003
+ return void 0;
3004
+ case "os/watch-port":
3005
+ evalOsWatchPort(args, evaluate2, ctx);
3006
+ return void 0;
3007
+ case "os/watch-http":
3008
+ evalOsWatchHttp(args, evaluate2, ctx);
3009
+ return void 0;
3010
+ case "os/watch-cron":
3011
+ evalOsWatchCron(args, evaluate2, ctx);
3012
+ return void 0;
3013
+ case "os/watch-signal":
3014
+ evalOsWatchSignal(args, evaluate2, ctx);
3015
+ return void 0;
3016
+ case "os/watch-env":
3017
+ evalOsWatchEnv(args, evaluate2, ctx);
3018
+ return void 0;
3019
+ case "os/debounce":
3020
+ evalOsDebounce(args, evaluate2, ctx);
3021
+ return void 0;
2953
3022
  default:
2954
3023
  console.warn(`Unknown operator: ${op}`);
2955
3024
  return void 0;