@almadar/evaluator 2.40.0 → 2.42.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/{index-BIg56YY8.d.ts → index-DY9A18IY.d.ts} +86 -84
- package/dist/index.d.ts +41 -11
- package/dist/index.js +563 -874
- package/dist/index.js.map +1 -1
- package/dist/operators/index.d.ts +1 -1
- package/dist/operators/index.js +15 -8
- package/dist/operators/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -29,11 +29,10 @@ function createChildContext(parent, locals) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
var CLIENT_ONLY_BINDING_ROOTS = /* @__PURE__ */ new Set(["trait"]);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const withoutPrefix = binding.slice(1);
|
|
32
|
+
var PARSED_PATH_CACHE = /* @__PURE__ */ new Map();
|
|
33
|
+
function parseBindingPath(withoutPrefix) {
|
|
34
|
+
const cached = PARSED_PATH_CACHE.get(withoutPrefix);
|
|
35
|
+
if (cached) return cached;
|
|
37
36
|
const parts = withoutPrefix.split(".").flatMap((seg) => {
|
|
38
37
|
const m = seg.match(/^([\w]+)((?:\[\d+\])+)$/);
|
|
39
38
|
if (!m) return [seg];
|
|
@@ -41,8 +40,15 @@ function resolveBinding(binding, ctx) {
|
|
|
41
40
|
const indices = Array.from(m[2].matchAll(/\[(\d+)\]/g)).map((x) => x[1]);
|
|
42
41
|
return [head, ...indices];
|
|
43
42
|
});
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
const parsed = { root: parts[0], path: parts.slice(1) };
|
|
44
|
+
PARSED_PATH_CACHE.set(withoutPrefix, parsed);
|
|
45
|
+
return parsed;
|
|
46
|
+
}
|
|
47
|
+
function resolveBinding(binding, ctx) {
|
|
48
|
+
if (!binding.startsWith("@")) {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
const { root, path } = parseBindingPath(binding.slice(1));
|
|
46
52
|
if (CLIENT_ONLY_BINDING_ROOTS.has(root)) {
|
|
47
53
|
return void 0;
|
|
48
54
|
}
|
|
@@ -301,6 +307,7 @@ function evalWhen(args, evaluate2, ctx) {
|
|
|
301
307
|
if (Boolean(condition)) {
|
|
302
308
|
evaluate2(args[1], ctx);
|
|
303
309
|
}
|
|
310
|
+
return void 0;
|
|
304
311
|
}
|
|
305
312
|
function evalFn(args, _evaluate, _ctx) {
|
|
306
313
|
const params = args[0];
|
|
@@ -619,7 +626,7 @@ function evalDeref(args, evaluate2, ctx) {
|
|
|
619
626
|
if (id && ctx.effectHandlers?.fetch) {
|
|
620
627
|
return ctx.effectHandlers.fetch(entityType, id);
|
|
621
628
|
}
|
|
622
|
-
return ctx.entity
|
|
629
|
+
return ctx.entity[entityType] ?? [];
|
|
623
630
|
}
|
|
624
631
|
function evalSwap(args, evaluate2, ctx) {
|
|
625
632
|
const entityType = args[0];
|
|
@@ -1181,6 +1188,11 @@ function evalArrayMap(args, evaluate2, ctx) {
|
|
|
1181
1188
|
return (arr ?? []).map((item, i) => evalWithItem(mapExpr, evaluate2, ctx, item, i));
|
|
1182
1189
|
}
|
|
1183
1190
|
function evalArrayReduce(args, evaluate2, ctx) {
|
|
1191
|
+
if (isSExpr(args[1]) && getOperator(args[1]) === "fn" && !(isSExpr(args[2]) && getOperator(args[2]) === "fn")) {
|
|
1192
|
+
throw new Error(
|
|
1193
|
+
"(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)"
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1184
1196
|
const arr = evaluate2(args[0], ctx);
|
|
1185
1197
|
const init = evaluate2(args[1], ctx);
|
|
1186
1198
|
const reducerExpr = args[2];
|
|
@@ -4150,18 +4162,491 @@ function evalPathReachable(args, evaluate2, ctx) {
|
|
|
4150
4162
|
}
|
|
4151
4163
|
|
|
4152
4164
|
// SExpressionEvaluator.ts
|
|
4153
|
-
var jitCache = /* @__PURE__ */ new Map();
|
|
4154
|
-
var MAX_JIT_CACHE_SIZE = 1e3;
|
|
4155
4165
|
var UNKNOWN_OPERATOR = /* @__PURE__ */ Symbol("unknown-operator");
|
|
4166
|
+
var OPERATOR_TABLE = {
|
|
4167
|
+
"+": evalAdd,
|
|
4168
|
+
"-": evalSubtract,
|
|
4169
|
+
"*": evalMultiply,
|
|
4170
|
+
"/": evalDivide,
|
|
4171
|
+
"%": evalModulo,
|
|
4172
|
+
"abs": evalAbs,
|
|
4173
|
+
"min": evalMin,
|
|
4174
|
+
"max": evalMax,
|
|
4175
|
+
"floor": evalFloor,
|
|
4176
|
+
"ceil": evalCeil,
|
|
4177
|
+
"round": evalRound,
|
|
4178
|
+
"clamp": evalClamp,
|
|
4179
|
+
"=": evalEqual,
|
|
4180
|
+
"==": evalEqual,
|
|
4181
|
+
"!=": evalNotEqual,
|
|
4182
|
+
"<": evalLessThan,
|
|
4183
|
+
">": evalGreaterThan,
|
|
4184
|
+
"<=": evalLessThanOrEqual,
|
|
4185
|
+
">=": evalGreaterThanOrEqual,
|
|
4186
|
+
"matches": evalMatches,
|
|
4187
|
+
"and": evalAnd,
|
|
4188
|
+
"or": evalOr,
|
|
4189
|
+
"not": evalNot,
|
|
4190
|
+
"if": evalIf,
|
|
4191
|
+
"let": evalLet,
|
|
4192
|
+
"do": evalDo,
|
|
4193
|
+
"when": evalWhen,
|
|
4194
|
+
"fn": evalFn,
|
|
4195
|
+
"lambda": evalFn,
|
|
4196
|
+
"map": evalMap,
|
|
4197
|
+
"filter": evalFilter,
|
|
4198
|
+
"find": evalFind,
|
|
4199
|
+
"count": evalCount,
|
|
4200
|
+
"sum": evalSum,
|
|
4201
|
+
"first": evalFirst,
|
|
4202
|
+
"last": evalLast,
|
|
4203
|
+
"nth": evalNth,
|
|
4204
|
+
"concat": evalConcat,
|
|
4205
|
+
"includes": evalIncludes,
|
|
4206
|
+
"empty": evalEmpty,
|
|
4207
|
+
"list": evalList,
|
|
4208
|
+
"set": (args, evaluate2, ctx) => {
|
|
4209
|
+
evalSet(args, evaluate2, ctx);
|
|
4210
|
+
return void 0;
|
|
4211
|
+
},
|
|
4212
|
+
"set-dynamic": (args, evaluate2, ctx) => {
|
|
4213
|
+
evalSetDynamic(args, evaluate2, ctx);
|
|
4214
|
+
return void 0;
|
|
4215
|
+
},
|
|
4216
|
+
"increment": (args, evaluate2, ctx) => {
|
|
4217
|
+
evalIncrement(args, evaluate2, ctx);
|
|
4218
|
+
return void 0;
|
|
4219
|
+
},
|
|
4220
|
+
"decrement": (args, evaluate2, ctx) => {
|
|
4221
|
+
evalDecrement(args, evaluate2, ctx);
|
|
4222
|
+
return void 0;
|
|
4223
|
+
},
|
|
4224
|
+
"emit": (args, evaluate2, ctx) => {
|
|
4225
|
+
evalEmit(args, evaluate2, ctx);
|
|
4226
|
+
return void 0;
|
|
4227
|
+
},
|
|
4228
|
+
"persist": (args, evaluate2, ctx) => {
|
|
4229
|
+
evalPersist(args, evaluate2, ctx);
|
|
4230
|
+
return void 0;
|
|
4231
|
+
},
|
|
4232
|
+
"navigate": (args, evaluate2, ctx) => {
|
|
4233
|
+
evalNavigate(args, evaluate2, ctx);
|
|
4234
|
+
return void 0;
|
|
4235
|
+
},
|
|
4236
|
+
"notify": (args, evaluate2, ctx) => {
|
|
4237
|
+
evalNotify(args, evaluate2, ctx);
|
|
4238
|
+
return void 0;
|
|
4239
|
+
},
|
|
4240
|
+
"spawn": (args, evaluate2, ctx) => {
|
|
4241
|
+
evalSpawn(args, evaluate2, ctx);
|
|
4242
|
+
return void 0;
|
|
4243
|
+
},
|
|
4244
|
+
"despawn": (args, evaluate2, ctx) => {
|
|
4245
|
+
evalDespawn(args, evaluate2, ctx);
|
|
4246
|
+
return void 0;
|
|
4247
|
+
},
|
|
4248
|
+
"call-service": (args, evaluate2, ctx) => {
|
|
4249
|
+
evalCallService(args, evaluate2, ctx);
|
|
4250
|
+
return void 0;
|
|
4251
|
+
},
|
|
4252
|
+
"render-ui": (args, evaluate2, ctx) => {
|
|
4253
|
+
evalRenderUI(args, evaluate2, ctx);
|
|
4254
|
+
return void 0;
|
|
4255
|
+
},
|
|
4256
|
+
"ref": evalRef,
|
|
4257
|
+
"deref": evalDeref,
|
|
4258
|
+
"swap!": evalSwap,
|
|
4259
|
+
"watch": (args, evaluate2, ctx) => {
|
|
4260
|
+
evalWatch(args, evaluate2, ctx);
|
|
4261
|
+
return void 0;
|
|
4262
|
+
},
|
|
4263
|
+
"atomic": evalAtomic,
|
|
4264
|
+
"math/abs": evalMathAbs,
|
|
4265
|
+
"math/min": evalMathMin,
|
|
4266
|
+
"math/max": evalMathMax,
|
|
4267
|
+
"math/clamp": evalMathClamp,
|
|
4268
|
+
"math/floor": evalMathFloor,
|
|
4269
|
+
"math/ceil": evalMathCeil,
|
|
4270
|
+
"math/round": evalMathRound,
|
|
4271
|
+
"math/pow": evalMathPow,
|
|
4272
|
+
"math/sqrt": evalMathSqrt,
|
|
4273
|
+
"math/mod": evalMathMod,
|
|
4274
|
+
"math/sign": evalMathSign,
|
|
4275
|
+
"math/lerp": evalMathLerp,
|
|
4276
|
+
"math/map": evalMathMap,
|
|
4277
|
+
"math/random": () => evalMathRandom(),
|
|
4278
|
+
"math/randomInt": evalMathRandomInt,
|
|
4279
|
+
"math/default": evalMathDefault,
|
|
4280
|
+
"math/sin": evalMathSin,
|
|
4281
|
+
"math/cos": evalMathCos,
|
|
4282
|
+
"math/tan": evalMathTan,
|
|
4283
|
+
"math/atan2": evalMathAtan2,
|
|
4284
|
+
"math/asin": evalMathAsin,
|
|
4285
|
+
"math/acos": evalMathAcos,
|
|
4286
|
+
"math/atan": evalMathAtan,
|
|
4287
|
+
"math/hypot": evalMathHypot,
|
|
4288
|
+
"math/deg-rad": evalMathDegRad,
|
|
4289
|
+
"math/rad-deg": evalMathRadDeg,
|
|
4290
|
+
"math/wrap": evalMathWrap,
|
|
4291
|
+
"math/approach": evalMathApproach,
|
|
4292
|
+
"vec/add": evalVecAdd,
|
|
4293
|
+
"vec/sub": evalVecSub,
|
|
4294
|
+
"vec/scale": evalVecScale,
|
|
4295
|
+
"vec/dot": evalVecDot,
|
|
4296
|
+
"vec/cross": evalVecCross,
|
|
4297
|
+
"vec/length": evalVecLength,
|
|
4298
|
+
"vec/length-sq": evalVecLengthSq,
|
|
4299
|
+
"vec/normalize": evalVecNormalize,
|
|
4300
|
+
"vec/distance": evalVecDistance,
|
|
4301
|
+
"vec/distance-sq": evalVecDistanceSq,
|
|
4302
|
+
"vec/lerp": evalVecLerp,
|
|
4303
|
+
"vec/angle": evalVecAngle,
|
|
4304
|
+
"vec/rotate": evalVecRotate,
|
|
4305
|
+
"vec/clamp-length": evalVecClampLength,
|
|
4306
|
+
"geo/aabb-overlap": evalGeoAabbOverlap,
|
|
4307
|
+
"geo/circle-overlap": evalGeoCircleOverlap,
|
|
4308
|
+
"geo/rect-circle-overlap": evalGeoRectCircleOverlap,
|
|
4309
|
+
"geo/point-in-rect": evalGeoPointInRect,
|
|
4310
|
+
"geo/point-in-circle": evalGeoPointInCircle,
|
|
4311
|
+
"geo/reflect": evalGeoReflect,
|
|
4312
|
+
"geo/segment-intersect": evalGeoSegmentIntersect,
|
|
4313
|
+
"grid/to-world": evalGridToWorld,
|
|
4314
|
+
"grid/from-world": evalGridFromWorld,
|
|
4315
|
+
"grid/iso-to-screen": evalGridIsoToScreen,
|
|
4316
|
+
"grid/screen-to-iso": evalGridScreenToIso,
|
|
4317
|
+
"grid/distance": evalGridDistance,
|
|
4318
|
+
"grid/manhattan-distance": evalGridManhattanDistance,
|
|
4319
|
+
"grid/neighbors": evalGridNeighbors,
|
|
4320
|
+
"grid/cells-in-radius": evalGridCellsInRadius,
|
|
4321
|
+
"grid/line": evalGridLine,
|
|
4322
|
+
"grid/in-bounds": evalGridInBounds,
|
|
4323
|
+
"anim/frame-at": evalAnimFrameAt,
|
|
4324
|
+
"anim/sheet-rect": evalAnimSheetRect,
|
|
4325
|
+
"anim/direction-from-delta": evalAnimDirectionFromDelta,
|
|
4326
|
+
"ease/apply": evalEaseApply,
|
|
4327
|
+
"ease/smoothstep": evalEaseSmoothstep,
|
|
4328
|
+
"noise/perlin": evalNoisePerlin,
|
|
4329
|
+
"noise/simplex": evalNoiseSimplex,
|
|
4330
|
+
"noise/fbm": evalNoiseFbm,
|
|
4331
|
+
"path/astar": evalPathAstar,
|
|
4332
|
+
"path/reachable": evalPathReachable,
|
|
4333
|
+
"str/len": evalStrLen,
|
|
4334
|
+
"str/concat": evalStrConcat,
|
|
4335
|
+
"str/upper": evalStrUpper,
|
|
4336
|
+
"str/lower": evalStrLower,
|
|
4337
|
+
"str/trim": evalStrTrim,
|
|
4338
|
+
"str/trimStart": evalStrTrimStart,
|
|
4339
|
+
"str/trimEnd": evalStrTrimEnd,
|
|
4340
|
+
"str/split": evalStrSplit,
|
|
4341
|
+
"str/join": evalStrJoin,
|
|
4342
|
+
"str/slice": evalStrSlice,
|
|
4343
|
+
"str/replace": evalStrReplace,
|
|
4344
|
+
"str/replaceAll": evalStrReplaceAll,
|
|
4345
|
+
"str/includes": evalStrIncludes,
|
|
4346
|
+
"str/startsWith": evalStrStartsWith,
|
|
4347
|
+
"str/endsWith": evalStrEndsWith,
|
|
4348
|
+
"str/padStart": evalStrPadStart,
|
|
4349
|
+
"str/padEnd": evalStrPadEnd,
|
|
4350
|
+
"str/repeat": evalStrRepeat,
|
|
4351
|
+
"str/reverse": evalStrReverse,
|
|
4352
|
+
"str/capitalize": evalStrCapitalize,
|
|
4353
|
+
"str/titleCase": evalStrTitleCase,
|
|
4354
|
+
"str/camelCase": evalStrCamelCase,
|
|
4355
|
+
"str/kebabCase": evalStrKebabCase,
|
|
4356
|
+
"str/snakeCase": evalStrSnakeCase,
|
|
4357
|
+
"str/default": evalStrDefault,
|
|
4358
|
+
"str/template": evalStrTemplate,
|
|
4359
|
+
"str/truncate": evalStrTruncate,
|
|
4360
|
+
"to-string": (args, evaluate2, ctx) => String(evaluate2(args[0], ctx)),
|
|
4361
|
+
"array/len": evalArrayLen,
|
|
4362
|
+
"array/range": evalArrayRange,
|
|
4363
|
+
"array/empty?": evalArrayEmpty,
|
|
4364
|
+
"array/first": evalArrayFirst,
|
|
4365
|
+
"array/last": evalArrayLast,
|
|
4366
|
+
"array/nth": evalArrayNth,
|
|
4367
|
+
"array/slice": evalArraySlice,
|
|
4368
|
+
"array/concat": evalArrayConcat,
|
|
4369
|
+
"array/append": evalArrayAppend,
|
|
4370
|
+
"array/prepend": evalArrayPrepend,
|
|
4371
|
+
"array/insert": evalArrayInsert,
|
|
4372
|
+
"array/remove": evalArrayRemove,
|
|
4373
|
+
"array/removeItem": evalArrayRemoveItem,
|
|
4374
|
+
"array/reverse": evalArrayReverse,
|
|
4375
|
+
"array/sort": evalArraySort,
|
|
4376
|
+
"array/shuffle": evalArrayShuffle,
|
|
4377
|
+
"array/unique": evalArrayUnique,
|
|
4378
|
+
"array/flatten": evalArrayFlatten,
|
|
4379
|
+
"array/zip": evalArrayZip,
|
|
4380
|
+
"array/includes": evalArrayIncludes,
|
|
4381
|
+
"array/indexOf": evalArrayIndexOf,
|
|
4382
|
+
"array/find": evalArrayFind,
|
|
4383
|
+
"array/findIndex": evalArrayFindIndex,
|
|
4384
|
+
"array/filter": evalArrayFilter,
|
|
4385
|
+
"array/reject": evalArrayReject,
|
|
4386
|
+
"array/map": evalArrayMap,
|
|
4387
|
+
"array/reduce": evalArrayReduce,
|
|
4388
|
+
"array/every": evalArrayEvery,
|
|
4389
|
+
"array/some": evalArraySome,
|
|
4390
|
+
"array/count": evalArrayCount,
|
|
4391
|
+
"array/sum": evalArraySum,
|
|
4392
|
+
"array/avg": evalArrayAvg,
|
|
4393
|
+
"array/min": evalArrayMin,
|
|
4394
|
+
"array/max": evalArrayMax,
|
|
4395
|
+
"array/groupBy": evalArrayGroupBy,
|
|
4396
|
+
"array/partition": evalArrayPartition,
|
|
4397
|
+
"array/take": evalArrayTake,
|
|
4398
|
+
"array/drop": evalArrayDrop,
|
|
4399
|
+
"array/takeLast": evalArrayTakeLast,
|
|
4400
|
+
"array/dropLast": evalArrayDropLast,
|
|
4401
|
+
"array/cosine": evalArrayCosine,
|
|
4402
|
+
"array/nearest": evalArrayNearest,
|
|
4403
|
+
"object/keys": evalObjectKeys,
|
|
4404
|
+
"object/values": evalObjectValues,
|
|
4405
|
+
"object/entries": evalObjectEntries,
|
|
4406
|
+
"object/fromEntries": evalObjectFromEntries,
|
|
4407
|
+
"object/get": evalObjectGet,
|
|
4408
|
+
"object/set": evalObjectSet,
|
|
4409
|
+
"object/has": evalObjectHas,
|
|
4410
|
+
"object/merge": evalObjectMerge,
|
|
4411
|
+
"object/deepMerge": evalObjectDeepMerge,
|
|
4412
|
+
"object/pick": evalObjectPick,
|
|
4413
|
+
"object/omit": evalObjectOmit,
|
|
4414
|
+
"object/mapValues": evalObjectMapValues,
|
|
4415
|
+
"object/mapKeys": evalObjectMapKeys,
|
|
4416
|
+
"object/filter": evalObjectFilter,
|
|
4417
|
+
"object/empty?": evalObjectEmpty,
|
|
4418
|
+
"object/equals": evalObjectEquals,
|
|
4419
|
+
"object/clone": evalObjectClone,
|
|
4420
|
+
"object/deepClone": evalObjectDeepClone,
|
|
4421
|
+
"path": evalPath,
|
|
4422
|
+
"validate/required": evalValidateRequired,
|
|
4423
|
+
"validate/string": evalValidateString,
|
|
4424
|
+
"validate/number": evalValidateNumber,
|
|
4425
|
+
"validate/boolean": evalValidateBoolean,
|
|
4426
|
+
"validate/array": evalValidateArray,
|
|
4427
|
+
"validate/object": evalValidateObject,
|
|
4428
|
+
"validate/email": evalValidateEmail,
|
|
4429
|
+
"validate/url": evalValidateUrl,
|
|
4430
|
+
"validate/uuid": evalValidateUuid,
|
|
4431
|
+
"validate/phone": evalValidatePhone,
|
|
4432
|
+
"validate/creditCard": evalValidateCreditCard,
|
|
4433
|
+
"validate/date": evalValidateDate,
|
|
4434
|
+
"validate/minLength": evalValidateMinLength,
|
|
4435
|
+
"validate/maxLength": evalValidateMaxLength,
|
|
4436
|
+
"validate/length": evalValidateLength,
|
|
4437
|
+
"validate/min": evalValidateMin,
|
|
4438
|
+
"validate/max": evalValidateMax,
|
|
4439
|
+
"validate/range": evalValidateRange,
|
|
4440
|
+
"validate/pattern": evalValidatePattern,
|
|
4441
|
+
"validate/oneOf": evalValidateOneOf,
|
|
4442
|
+
"validate/noneOf": evalValidateNoneOf,
|
|
4443
|
+
"validate/equals": evalValidateEquals,
|
|
4444
|
+
"validate/check": evalValidateCheck,
|
|
4445
|
+
"time/now": () => evalTimeNow(),
|
|
4446
|
+
"time/today": () => evalTimeToday(),
|
|
4447
|
+
"time/parse": evalTimeParse,
|
|
4448
|
+
"time/format": evalTimeFormat,
|
|
4449
|
+
"time/year": evalTimeYear,
|
|
4450
|
+
"time/month": evalTimeMonth,
|
|
4451
|
+
"time/day": evalTimeDay,
|
|
4452
|
+
"time/weekday": evalTimeWeekday,
|
|
4453
|
+
"time/hour": evalTimeHour,
|
|
4454
|
+
"time/minute": evalTimeMinute,
|
|
4455
|
+
"time/second": evalTimeSecond,
|
|
4456
|
+
"time/add": evalTimeAdd,
|
|
4457
|
+
"time/subtract": evalTimeSubtract,
|
|
4458
|
+
"time/diff": evalTimeDiff,
|
|
4459
|
+
"time/startOf": evalTimeStartOf,
|
|
4460
|
+
"time/endOf": evalTimeEndOf,
|
|
4461
|
+
"time/isBefore": evalTimeIsBefore,
|
|
4462
|
+
"time/isAfter": evalTimeIsAfter,
|
|
4463
|
+
"time/isBetween": evalTimeIsBetween,
|
|
4464
|
+
"time/isSame": evalTimeIsSame,
|
|
4465
|
+
"time/isPast": evalTimeIsPast,
|
|
4466
|
+
"time/isFuture": evalTimeIsFuture,
|
|
4467
|
+
"time/isToday": evalTimeIsToday,
|
|
4468
|
+
"time/relative": evalTimeRelative,
|
|
4469
|
+
"time/duration": evalTimeDuration,
|
|
4470
|
+
"format/number": evalFormatNumber,
|
|
4471
|
+
"format/currency": evalFormatCurrency,
|
|
4472
|
+
"format/percent": evalFormatPercent,
|
|
4473
|
+
"format/bytes": evalFormatBytes,
|
|
4474
|
+
"format/ordinal": evalFormatOrdinal,
|
|
4475
|
+
"format/plural": evalFormatPlural,
|
|
4476
|
+
"format/list": evalFormatList,
|
|
4477
|
+
"format/phone": evalFormatPhone,
|
|
4478
|
+
"format/creditCard": evalFormatCreditCard,
|
|
4479
|
+
"async/delay": evalAsyncDelay,
|
|
4480
|
+
"async/interval": evalAsyncInterval,
|
|
4481
|
+
"async/timeout": evalAsyncTimeout,
|
|
4482
|
+
"async/debounce": (args, evaluate2, ctx) => {
|
|
4483
|
+
evalAsyncDebounce(args, evaluate2, ctx);
|
|
4484
|
+
return void 0;
|
|
4485
|
+
},
|
|
4486
|
+
"async/throttle": (args, evaluate2, ctx) => {
|
|
4487
|
+
evalAsyncThrottle(args, evaluate2, ctx);
|
|
4488
|
+
return void 0;
|
|
4489
|
+
},
|
|
4490
|
+
"async/retry": evalAsyncRetry,
|
|
4491
|
+
"async/race": evalAsyncRace,
|
|
4492
|
+
"async/all": evalAsyncAll,
|
|
4493
|
+
"async/sequence": evalAsyncSequence,
|
|
4494
|
+
"prob/seed": (args, evaluate2, ctx) => {
|
|
4495
|
+
evalProbSeed(args, evaluate2, ctx);
|
|
4496
|
+
return void 0;
|
|
4497
|
+
},
|
|
4498
|
+
"prob/flip": evalProbFlip,
|
|
4499
|
+
"prob/gaussian": evalProbGaussian,
|
|
4500
|
+
"prob/uniform": evalProbUniform,
|
|
4501
|
+
"prob/beta": evalProbBeta,
|
|
4502
|
+
"prob/categorical": evalProbCategorical,
|
|
4503
|
+
"prob/poisson": evalProbPoisson,
|
|
4504
|
+
"prob/condition": (args, evaluate2, ctx) => {
|
|
4505
|
+
evalProbCondition(args, evaluate2, ctx);
|
|
4506
|
+
return void 0;
|
|
4507
|
+
},
|
|
4508
|
+
"prob/sample": evalProbSample,
|
|
4509
|
+
"prob/posterior": evalProbPosterior,
|
|
4510
|
+
"prob/infer": evalProbInfer,
|
|
4511
|
+
"prob/expected-value": evalProbExpectedValue,
|
|
4512
|
+
"prob/variance": evalProbVariance,
|
|
4513
|
+
"prob/histogram": evalProbHistogram,
|
|
4514
|
+
"prob/percentile": evalProbPercentile,
|
|
4515
|
+
"prob/credible-interval": evalProbCredibleInterval,
|
|
4516
|
+
"os/watch-files": (args, evaluate2, ctx) => {
|
|
4517
|
+
evalOsWatchFiles(args, evaluate2, ctx);
|
|
4518
|
+
return void 0;
|
|
4519
|
+
},
|
|
4520
|
+
"os/watch-process": (args, evaluate2, ctx) => {
|
|
4521
|
+
evalOsWatchProcess(args, evaluate2, ctx);
|
|
4522
|
+
return void 0;
|
|
4523
|
+
},
|
|
4524
|
+
"os/watch-port": (args, evaluate2, ctx) => {
|
|
4525
|
+
evalOsWatchPort(args, evaluate2, ctx);
|
|
4526
|
+
return void 0;
|
|
4527
|
+
},
|
|
4528
|
+
"os/watch-http": (args, evaluate2, ctx) => {
|
|
4529
|
+
evalOsWatchHttp(args, evaluate2, ctx);
|
|
4530
|
+
return void 0;
|
|
4531
|
+
},
|
|
4532
|
+
"os/watch-cron": (args, evaluate2, ctx) => {
|
|
4533
|
+
evalOsWatchCron(args, evaluate2, ctx);
|
|
4534
|
+
return void 0;
|
|
4535
|
+
},
|
|
4536
|
+
"os/watch-signal": (args, evaluate2, ctx) => {
|
|
4537
|
+
evalOsWatchSignal(args, evaluate2, ctx);
|
|
4538
|
+
return void 0;
|
|
4539
|
+
},
|
|
4540
|
+
"os/watch-env": (args, evaluate2, ctx) => {
|
|
4541
|
+
evalOsWatchEnv(args, evaluate2, ctx);
|
|
4542
|
+
return void 0;
|
|
4543
|
+
},
|
|
4544
|
+
"os/debounce": (args, evaluate2, ctx) => {
|
|
4545
|
+
evalOsDebounce(args, evaluate2, ctx);
|
|
4546
|
+
return void 0;
|
|
4547
|
+
},
|
|
4548
|
+
"llm/generate": evalLlmGenerate,
|
|
4549
|
+
"llm/call-tools": evalLlmCallTools,
|
|
4550
|
+
"llm/embed": evalLlmEmbed,
|
|
4551
|
+
"llm/token-count": evalLlmTokenCount,
|
|
4552
|
+
"llm/switch": evalLlmSwitch,
|
|
4553
|
+
"llm/compact": evalLlmCompact,
|
|
4554
|
+
"workspace/read-orbital": evalWorkspaceReadOrbital,
|
|
4555
|
+
"workspace/write-orbital": evalWorkspaceWriteOrbital,
|
|
4556
|
+
"workspace/read-file": evalWorkspaceReadFile,
|
|
4557
|
+
"workspace/write-file": evalWorkspaceWriteFile,
|
|
4558
|
+
"workspace/exists": evalWorkspaceExists,
|
|
4559
|
+
"workspace/list-orbitals": evalWorkspaceListOrbitals,
|
|
4560
|
+
"workspace/read-schema": evalWorkspaceReadSchema,
|
|
4561
|
+
"workspace/write-schema": evalWorkspaceWriteSchema,
|
|
4562
|
+
"workspace/read-plan": evalWorkspaceReadPlan,
|
|
4563
|
+
"workspace/write-plan": evalWorkspaceWritePlan,
|
|
4564
|
+
"workspace/archive-orbital": evalWorkspaceArchiveOrbital,
|
|
4565
|
+
"session/read-spec": evalSessionReadSpec,
|
|
4566
|
+
"session/write-spec": evalSessionWriteSpec,
|
|
4567
|
+
"session/read-memory": evalSessionReadMemory,
|
|
4568
|
+
"session/write-memory": evalSessionWriteMemory,
|
|
4569
|
+
"session/read-history": evalSessionReadHistory,
|
|
4570
|
+
"session/append-history": evalSessionAppendHistory,
|
|
4571
|
+
"session/read-errors": evalSessionReadErrors,
|
|
4572
|
+
"session/write-errors": evalSessionWriteErrors,
|
|
4573
|
+
"session/read-analysis": evalSessionReadAnalysis,
|
|
4574
|
+
"memory/recall": evalMemoryRecall,
|
|
4575
|
+
"memory/store": evalMemoryStore,
|
|
4576
|
+
"memory/list": evalMemoryList,
|
|
4577
|
+
"trace/emit": evalTraceEmit,
|
|
4578
|
+
"trace/log": evalTraceLog,
|
|
4579
|
+
"integration/http": evalIntegrationHttp,
|
|
4580
|
+
"integration/github-get-repo": evalIntegrationGithubGetRepo,
|
|
4581
|
+
"integration/github-create-issue": evalIntegrationGithubCreateIssue,
|
|
4582
|
+
"contract/validate-input": evalContractValidateInput,
|
|
4583
|
+
"contract/validate-output": evalContractValidateOutput,
|
|
4584
|
+
"contract/clamp-output": evalContractClampOutput,
|
|
4585
|
+
"contract/violations": evalContractViolations,
|
|
4586
|
+
"contract/entity-to-tensor": evalContractEntityToTensor,
|
|
4587
|
+
"contract/tensor-to-payload": evalContractTensorToPayload,
|
|
4588
|
+
"graph/from-entities": evalGraphFromEntities,
|
|
4589
|
+
"graph/from-adjacency": evalGraphFromAdjacency,
|
|
4590
|
+
"graph/from-edge-list": evalGraphFromEdgeList,
|
|
4591
|
+
"graph/add-self-loops": evalGraphAddSelfLoops,
|
|
4592
|
+
"graph/to-undirected": evalGraphToUndirected,
|
|
4593
|
+
"graph/subgraph": evalGraphSubgraph,
|
|
4594
|
+
"graph/k-hop": evalGraphKHop,
|
|
4595
|
+
"graph/node-features": evalGraphNodeFeatures,
|
|
4596
|
+
"graph/edge-index": evalGraphEdgeIndex,
|
|
4597
|
+
"graph/edge-features": evalGraphEdgeFeatures,
|
|
4598
|
+
"graph/num-nodes": evalGraphNumNodes,
|
|
4599
|
+
"graph/num-edges": evalGraphNumEdges,
|
|
4600
|
+
"graph/degree": evalGraphDegree,
|
|
4601
|
+
"graph/batch": evalGraphBatch,
|
|
4602
|
+
"data/dataset": evalDataDataset,
|
|
4603
|
+
"data/dataloader": evalDataDataloader,
|
|
4604
|
+
"data/split": evalDataSplit,
|
|
4605
|
+
"data/normalize": evalDataNormalize,
|
|
4606
|
+
"data/augment": evalDataAugment,
|
|
4607
|
+
"data/tokenize": evalDataTokenize,
|
|
4608
|
+
"data/pad": evalDataPad
|
|
4609
|
+
};
|
|
4156
4610
|
var SExpressionEvaluator = class {
|
|
4611
|
+
constructor() {
|
|
4612
|
+
/**
|
|
4613
|
+
* Tier-up compilation cache, keyed by node IDENTITY: schema trees are
|
|
4614
|
+
* long-lived parsed objects, so a WeakMap costs no key serialization and
|
|
4615
|
+
* is collected with the schema. First sight of a node interprets it and
|
|
4616
|
+
* marks it seen; the second sight compiles it — one-off dynamically built
|
|
4617
|
+
* expressions never pay compile cost.
|
|
4618
|
+
*/
|
|
4619
|
+
this.compileCache = /* @__PURE__ */ new WeakMap();
|
|
4620
|
+
/** Single bound interpreter handed to operator impls — was allocated per dispatch. */
|
|
4621
|
+
this.boundInterpret = (expr, c) => this.interpret(expr, c);
|
|
4622
|
+
}
|
|
4157
4623
|
/**
|
|
4158
4624
|
* Evaluate an S-expression in the given context.
|
|
4625
|
+
* Hot trees promote to compiled closures on second use; everything else
|
|
4626
|
+
* runs through the interpreter.
|
|
4159
4627
|
*
|
|
4160
4628
|
* @param expr - S-expression to evaluate
|
|
4161
4629
|
* @param ctx - Evaluation context with bindings and effect handlers
|
|
4162
4630
|
* @returns Result of evaluation
|
|
4163
4631
|
*/
|
|
4164
4632
|
evaluate(expr, ctx) {
|
|
4633
|
+
if (typeof expr === "object" && expr !== null) {
|
|
4634
|
+
const entry = this.compileCache.get(expr);
|
|
4635
|
+
if (typeof entry === "function") return entry(ctx);
|
|
4636
|
+
if (entry === true) {
|
|
4637
|
+
const fn = this.compileNode(expr, /* @__PURE__ */ new Map(), void 0);
|
|
4638
|
+
this.compileCache.set(expr, fn);
|
|
4639
|
+
return fn(ctx);
|
|
4640
|
+
}
|
|
4641
|
+
this.compileCache.set(expr, true);
|
|
4642
|
+
}
|
|
4643
|
+
return this.interpret(expr, ctx);
|
|
4644
|
+
}
|
|
4645
|
+
/**
|
|
4646
|
+
* The tree-walking interpreter of record — first-use path and the
|
|
4647
|
+
* compiler's fallback for foreign subtrees.
|
|
4648
|
+
*/
|
|
4649
|
+
interpret(expr, ctx) {
|
|
4165
4650
|
if (!isSExpr(expr)) {
|
|
4166
4651
|
if (isBinding(expr)) {
|
|
4167
4652
|
return resolveBinding(expr, ctx);
|
|
@@ -4186,6 +4671,57 @@ var SExpressionEvaluator = class {
|
|
|
4186
4671
|
}
|
|
4187
4672
|
return result;
|
|
4188
4673
|
}
|
|
4674
|
+
/**
|
|
4675
|
+
* Compile one tree into composed closures. Every node of the tree is
|
|
4676
|
+
* registered in `into` so the impls' `evaluate` callback (childDispatch)
|
|
4677
|
+
* resolves in-tree children by identity and falls back to interpretation
|
|
4678
|
+
* only for foreign subtrees. Arity is asserted HERE, once — a tree that
|
|
4679
|
+
* compiles never re-validates.
|
|
4680
|
+
*/
|
|
4681
|
+
compileNode(expr, into, childDispatch) {
|
|
4682
|
+
const dispatch = childDispatch ?? ((e, c) => {
|
|
4683
|
+
const f = into.get(e);
|
|
4684
|
+
return f !== void 0 ? f(c) : this.interpret(e, c);
|
|
4685
|
+
});
|
|
4686
|
+
let fn;
|
|
4687
|
+
if (!isSExpr(expr)) {
|
|
4688
|
+
if (isBinding(expr)) {
|
|
4689
|
+
fn = (ctx) => resolveBinding(expr, ctx);
|
|
4690
|
+
} else if (this.isPlainObject(expr)) {
|
|
4691
|
+
const entries = Object.entries(expr).map(
|
|
4692
|
+
([k, v]) => [k, this.compileNode(v, into, dispatch)]
|
|
4693
|
+
);
|
|
4694
|
+
fn = (ctx) => {
|
|
4695
|
+
const out = {};
|
|
4696
|
+
for (const [k, f] of entries) out[k] = f(ctx);
|
|
4697
|
+
return out;
|
|
4698
|
+
};
|
|
4699
|
+
} else if (Array.isArray(expr)) {
|
|
4700
|
+
const items = expr.map((item) => this.compileNode(item, into, dispatch));
|
|
4701
|
+
fn = (ctx) => items.map((f) => f(ctx));
|
|
4702
|
+
} else {
|
|
4703
|
+
fn = () => expr;
|
|
4704
|
+
}
|
|
4705
|
+
} else {
|
|
4706
|
+
const op = getOperator(expr);
|
|
4707
|
+
const args = getArgs(expr);
|
|
4708
|
+
assertOperatorArity(op, args.length);
|
|
4709
|
+
const impl = OPERATOR_TABLE[op];
|
|
4710
|
+
for (const item of expr) {
|
|
4711
|
+
if (!into.has(item)) this.compileNode(item, into, dispatch);
|
|
4712
|
+
}
|
|
4713
|
+
if (impl === void 0) {
|
|
4714
|
+
fn = (ctx) => expr.map((item) => {
|
|
4715
|
+
const f = into.get(item);
|
|
4716
|
+
return f !== void 0 ? f(ctx) : this.interpret(item, ctx);
|
|
4717
|
+
});
|
|
4718
|
+
} else {
|
|
4719
|
+
fn = (ctx) => impl(args, dispatch, ctx);
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
into.set(expr, fn);
|
|
4723
|
+
return fn;
|
|
4724
|
+
}
|
|
4189
4725
|
isPlainObject(value) {
|
|
4190
4726
|
return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && Object.getPrototypeOf(value) === Object.prototype;
|
|
4191
4727
|
}
|
|
@@ -4222,886 +4758,39 @@ var SExpressionEvaluator = class {
|
|
|
4222
4758
|
}
|
|
4223
4759
|
/**
|
|
4224
4760
|
* Compile an S-expression to a function for faster repeated evaluation.
|
|
4225
|
-
*
|
|
4761
|
+
* Same machinery as the automatic tier-up in `evaluate`; explicit callers
|
|
4762
|
+
* promote immediately instead of on second use.
|
|
4226
4763
|
*
|
|
4227
4764
|
* @param expr - S-expression to compile
|
|
4228
4765
|
* @returns Function that evaluates the expression given a context
|
|
4229
4766
|
*/
|
|
4230
4767
|
compile(expr) {
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
if (jitCache.size >= MAX_JIT_CACHE_SIZE) {
|
|
4238
|
-
const firstKey = jitCache.keys().next().value;
|
|
4239
|
-
if (firstKey) {
|
|
4240
|
-
jitCache.delete(firstKey);
|
|
4241
|
-
}
|
|
4768
|
+
if (typeof expr === "object" && expr !== null) {
|
|
4769
|
+
const entry = this.compileCache.get(expr);
|
|
4770
|
+
if (typeof entry === "function") return entry;
|
|
4771
|
+
const fn = this.compileNode(expr, /* @__PURE__ */ new Map(), void 0);
|
|
4772
|
+
this.compileCache.set(expr, fn);
|
|
4773
|
+
return fn;
|
|
4242
4774
|
}
|
|
4243
|
-
|
|
4244
|
-
return fn;
|
|
4775
|
+
return this.compileNode(expr, /* @__PURE__ */ new Map(), void 0);
|
|
4245
4776
|
}
|
|
4246
4777
|
/**
|
|
4247
|
-
* Clear the
|
|
4778
|
+
* Clear the compilation cache.
|
|
4248
4779
|
*/
|
|
4249
4780
|
clearCache() {
|
|
4250
|
-
|
|
4781
|
+
this.compileCache = /* @__PURE__ */ new WeakMap();
|
|
4251
4782
|
}
|
|
4783
|
+
/**
|
|
4784
|
+
* Dispatch to the appropriate operator implementation.
|
|
4785
|
+
*/
|
|
4252
4786
|
/**
|
|
4253
4787
|
* Dispatch to the appropriate operator implementation.
|
|
4254
4788
|
*/
|
|
4255
4789
|
dispatchOperator(op, args, ctx) {
|
|
4256
4790
|
assertOperatorArity(op, args.length);
|
|
4257
|
-
const
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
case "+":
|
|
4261
|
-
return evalAdd(args, evaluate2, ctx);
|
|
4262
|
-
case "-":
|
|
4263
|
-
return evalSubtract(args, evaluate2, ctx);
|
|
4264
|
-
case "*":
|
|
4265
|
-
return evalMultiply(args, evaluate2, ctx);
|
|
4266
|
-
case "/":
|
|
4267
|
-
return evalDivide(args, evaluate2, ctx);
|
|
4268
|
-
case "%":
|
|
4269
|
-
return evalModulo(args, evaluate2, ctx);
|
|
4270
|
-
case "abs":
|
|
4271
|
-
return evalAbs(args, evaluate2, ctx);
|
|
4272
|
-
case "min":
|
|
4273
|
-
return evalMin(args, evaluate2, ctx);
|
|
4274
|
-
case "max":
|
|
4275
|
-
return evalMax(args, evaluate2, ctx);
|
|
4276
|
-
case "floor":
|
|
4277
|
-
return evalFloor(args, evaluate2, ctx);
|
|
4278
|
-
case "ceil":
|
|
4279
|
-
return evalCeil(args, evaluate2, ctx);
|
|
4280
|
-
case "round":
|
|
4281
|
-
return evalRound(args, evaluate2, ctx);
|
|
4282
|
-
case "clamp":
|
|
4283
|
-
return evalClamp(args, evaluate2, ctx);
|
|
4284
|
-
// Comparison
|
|
4285
|
-
case "=":
|
|
4286
|
-
case "==":
|
|
4287
|
-
return evalEqual(args, evaluate2, ctx);
|
|
4288
|
-
case "!=":
|
|
4289
|
-
return evalNotEqual(args, evaluate2, ctx);
|
|
4290
|
-
case "<":
|
|
4291
|
-
return evalLessThan(args, evaluate2, ctx);
|
|
4292
|
-
case ">":
|
|
4293
|
-
return evalGreaterThan(args, evaluate2, ctx);
|
|
4294
|
-
case "<=":
|
|
4295
|
-
return evalLessThanOrEqual(args, evaluate2, ctx);
|
|
4296
|
-
case ">=":
|
|
4297
|
-
return evalGreaterThanOrEqual(args, evaluate2, ctx);
|
|
4298
|
-
case "matches":
|
|
4299
|
-
return evalMatches(args, evaluate2, ctx);
|
|
4300
|
-
// Logic
|
|
4301
|
-
case "and":
|
|
4302
|
-
return evalAnd(args, evaluate2, ctx);
|
|
4303
|
-
case "or":
|
|
4304
|
-
return evalOr(args, evaluate2, ctx);
|
|
4305
|
-
case "not":
|
|
4306
|
-
return evalNot(args, evaluate2, ctx);
|
|
4307
|
-
case "if":
|
|
4308
|
-
return evalIf(args, evaluate2, ctx);
|
|
4309
|
-
// Control
|
|
4310
|
-
case "let":
|
|
4311
|
-
return evalLet(args, evaluate2, ctx);
|
|
4312
|
-
case "do":
|
|
4313
|
-
return evalDo(args, evaluate2, ctx);
|
|
4314
|
-
case "when":
|
|
4315
|
-
return evalWhen(args, evaluate2, ctx);
|
|
4316
|
-
case "fn":
|
|
4317
|
-
case "lambda":
|
|
4318
|
-
return evalFn(args);
|
|
4319
|
-
// Collections
|
|
4320
|
-
case "map":
|
|
4321
|
-
return evalMap(args, evaluate2, ctx);
|
|
4322
|
-
case "filter":
|
|
4323
|
-
return evalFilter(args, evaluate2, ctx);
|
|
4324
|
-
case "find":
|
|
4325
|
-
return evalFind(args, evaluate2, ctx);
|
|
4326
|
-
case "count":
|
|
4327
|
-
return evalCount(args, evaluate2, ctx);
|
|
4328
|
-
case "sum":
|
|
4329
|
-
return evalSum(args, evaluate2, ctx);
|
|
4330
|
-
case "first":
|
|
4331
|
-
return evalFirst(args, evaluate2, ctx);
|
|
4332
|
-
case "last":
|
|
4333
|
-
return evalLast(args, evaluate2, ctx);
|
|
4334
|
-
case "nth":
|
|
4335
|
-
return evalNth(args, evaluate2, ctx);
|
|
4336
|
-
case "concat":
|
|
4337
|
-
return evalConcat(args, evaluate2, ctx);
|
|
4338
|
-
case "includes":
|
|
4339
|
-
return evalIncludes(args, evaluate2, ctx);
|
|
4340
|
-
case "empty":
|
|
4341
|
-
return evalEmpty(args, evaluate2, ctx);
|
|
4342
|
-
case "list":
|
|
4343
|
-
return evalList(args, evaluate2, ctx);
|
|
4344
|
-
// Effects
|
|
4345
|
-
case "set":
|
|
4346
|
-
evalSet(args, evaluate2, ctx);
|
|
4347
|
-
return void 0;
|
|
4348
|
-
case "set-dynamic":
|
|
4349
|
-
evalSetDynamic(args, evaluate2, ctx);
|
|
4350
|
-
return void 0;
|
|
4351
|
-
case "increment":
|
|
4352
|
-
evalIncrement(args, evaluate2, ctx);
|
|
4353
|
-
return void 0;
|
|
4354
|
-
case "decrement":
|
|
4355
|
-
evalDecrement(args, evaluate2, ctx);
|
|
4356
|
-
return void 0;
|
|
4357
|
-
case "emit":
|
|
4358
|
-
evalEmit(args, evaluate2, ctx);
|
|
4359
|
-
return void 0;
|
|
4360
|
-
case "persist":
|
|
4361
|
-
evalPersist(args, evaluate2, ctx);
|
|
4362
|
-
return void 0;
|
|
4363
|
-
case "navigate":
|
|
4364
|
-
evalNavigate(args, evaluate2, ctx);
|
|
4365
|
-
return void 0;
|
|
4366
|
-
case "notify":
|
|
4367
|
-
evalNotify(args, evaluate2, ctx);
|
|
4368
|
-
return void 0;
|
|
4369
|
-
case "spawn":
|
|
4370
|
-
evalSpawn(args, evaluate2, ctx);
|
|
4371
|
-
return void 0;
|
|
4372
|
-
case "despawn":
|
|
4373
|
-
evalDespawn(args, evaluate2, ctx);
|
|
4374
|
-
return void 0;
|
|
4375
|
-
case "call-service":
|
|
4376
|
-
evalCallService(args, evaluate2, ctx);
|
|
4377
|
-
return void 0;
|
|
4378
|
-
case "render-ui":
|
|
4379
|
-
evalRenderUI(args, evaluate2, ctx);
|
|
4380
|
-
return void 0;
|
|
4381
|
-
// Resource operators
|
|
4382
|
-
case "ref":
|
|
4383
|
-
return evalRef(args, evaluate2, ctx);
|
|
4384
|
-
case "deref":
|
|
4385
|
-
return evalDeref(args, evaluate2, ctx);
|
|
4386
|
-
case "swap!":
|
|
4387
|
-
return evalSwap(args, evaluate2, ctx);
|
|
4388
|
-
case "watch":
|
|
4389
|
-
evalWatch(args, evaluate2, ctx);
|
|
4390
|
-
return void 0;
|
|
4391
|
-
case "atomic":
|
|
4392
|
-
return evalAtomic(args, evaluate2, ctx);
|
|
4393
|
-
// ===============================
|
|
4394
|
-
// Standard Library: math/*
|
|
4395
|
-
// ===============================
|
|
4396
|
-
case "math/abs":
|
|
4397
|
-
return evalMathAbs(args, evaluate2, ctx);
|
|
4398
|
-
case "math/min":
|
|
4399
|
-
return evalMathMin(args, evaluate2, ctx);
|
|
4400
|
-
case "math/max":
|
|
4401
|
-
return evalMathMax(args, evaluate2, ctx);
|
|
4402
|
-
case "math/clamp":
|
|
4403
|
-
return evalMathClamp(args, evaluate2, ctx);
|
|
4404
|
-
case "math/floor":
|
|
4405
|
-
return evalMathFloor(args, evaluate2, ctx);
|
|
4406
|
-
case "math/ceil":
|
|
4407
|
-
return evalMathCeil(args, evaluate2, ctx);
|
|
4408
|
-
case "math/round":
|
|
4409
|
-
return evalMathRound(args, evaluate2, ctx);
|
|
4410
|
-
case "math/pow":
|
|
4411
|
-
return evalMathPow(args, evaluate2, ctx);
|
|
4412
|
-
case "math/sqrt":
|
|
4413
|
-
return evalMathSqrt(args, evaluate2, ctx);
|
|
4414
|
-
case "math/mod":
|
|
4415
|
-
return evalMathMod(args, evaluate2, ctx);
|
|
4416
|
-
case "math/sign":
|
|
4417
|
-
return evalMathSign(args, evaluate2, ctx);
|
|
4418
|
-
case "math/lerp":
|
|
4419
|
-
return evalMathLerp(args, evaluate2, ctx);
|
|
4420
|
-
case "math/map":
|
|
4421
|
-
return evalMathMap(args, evaluate2, ctx);
|
|
4422
|
-
case "math/random":
|
|
4423
|
-
return evalMathRandom();
|
|
4424
|
-
case "math/randomInt":
|
|
4425
|
-
return evalMathRandomInt(args, evaluate2, ctx);
|
|
4426
|
-
case "math/default":
|
|
4427
|
-
return evalMathDefault(args, evaluate2, ctx);
|
|
4428
|
-
case "math/sin":
|
|
4429
|
-
return evalMathSin(args, evaluate2, ctx);
|
|
4430
|
-
case "math/cos":
|
|
4431
|
-
return evalMathCos(args, evaluate2, ctx);
|
|
4432
|
-
case "math/tan":
|
|
4433
|
-
return evalMathTan(args, evaluate2, ctx);
|
|
4434
|
-
case "math/atan2":
|
|
4435
|
-
return evalMathAtan2(args, evaluate2, ctx);
|
|
4436
|
-
case "math/asin":
|
|
4437
|
-
return evalMathAsin(args, evaluate2, ctx);
|
|
4438
|
-
case "math/acos":
|
|
4439
|
-
return evalMathAcos(args, evaluate2, ctx);
|
|
4440
|
-
case "math/atan":
|
|
4441
|
-
return evalMathAtan(args, evaluate2, ctx);
|
|
4442
|
-
case "math/hypot":
|
|
4443
|
-
return evalMathHypot(args, evaluate2, ctx);
|
|
4444
|
-
case "math/deg-rad":
|
|
4445
|
-
return evalMathDegRad(args, evaluate2, ctx);
|
|
4446
|
-
case "math/rad-deg":
|
|
4447
|
-
return evalMathRadDeg(args, evaluate2, ctx);
|
|
4448
|
-
case "math/wrap":
|
|
4449
|
-
return evalMathWrap(args, evaluate2, ctx);
|
|
4450
|
-
case "math/approach":
|
|
4451
|
-
return evalMathApproach(args, evaluate2, ctx);
|
|
4452
|
-
// ===============================
|
|
4453
|
-
// Standard Library: vec/*
|
|
4454
|
-
// ===============================
|
|
4455
|
-
case "vec/add":
|
|
4456
|
-
return evalVecAdd(args, evaluate2, ctx);
|
|
4457
|
-
case "vec/sub":
|
|
4458
|
-
return evalVecSub(args, evaluate2, ctx);
|
|
4459
|
-
case "vec/scale":
|
|
4460
|
-
return evalVecScale(args, evaluate2, ctx);
|
|
4461
|
-
case "vec/dot":
|
|
4462
|
-
return evalVecDot(args, evaluate2, ctx);
|
|
4463
|
-
case "vec/cross":
|
|
4464
|
-
return evalVecCross(args, evaluate2, ctx);
|
|
4465
|
-
case "vec/length":
|
|
4466
|
-
return evalVecLength(args, evaluate2, ctx);
|
|
4467
|
-
case "vec/length-sq":
|
|
4468
|
-
return evalVecLengthSq(args, evaluate2, ctx);
|
|
4469
|
-
case "vec/normalize":
|
|
4470
|
-
return evalVecNormalize(args, evaluate2, ctx);
|
|
4471
|
-
case "vec/distance":
|
|
4472
|
-
return evalVecDistance(args, evaluate2, ctx);
|
|
4473
|
-
case "vec/distance-sq":
|
|
4474
|
-
return evalVecDistanceSq(args, evaluate2, ctx);
|
|
4475
|
-
case "vec/lerp":
|
|
4476
|
-
return evalVecLerp(args, evaluate2, ctx);
|
|
4477
|
-
case "vec/angle":
|
|
4478
|
-
return evalVecAngle(args, evaluate2, ctx);
|
|
4479
|
-
case "vec/rotate":
|
|
4480
|
-
return evalVecRotate(args, evaluate2, ctx);
|
|
4481
|
-
case "vec/clamp-length":
|
|
4482
|
-
return evalVecClampLength(args, evaluate2, ctx);
|
|
4483
|
-
// ===============================
|
|
4484
|
-
// Standard Library: geo/*
|
|
4485
|
-
// ===============================
|
|
4486
|
-
case "geo/aabb-overlap":
|
|
4487
|
-
return evalGeoAabbOverlap(args, evaluate2, ctx);
|
|
4488
|
-
case "geo/circle-overlap":
|
|
4489
|
-
return evalGeoCircleOverlap(args, evaluate2, ctx);
|
|
4490
|
-
case "geo/rect-circle-overlap":
|
|
4491
|
-
return evalGeoRectCircleOverlap(args, evaluate2, ctx);
|
|
4492
|
-
case "geo/point-in-rect":
|
|
4493
|
-
return evalGeoPointInRect(args, evaluate2, ctx);
|
|
4494
|
-
case "geo/point-in-circle":
|
|
4495
|
-
return evalGeoPointInCircle(args, evaluate2, ctx);
|
|
4496
|
-
case "geo/reflect":
|
|
4497
|
-
return evalGeoReflect(args, evaluate2, ctx);
|
|
4498
|
-
case "geo/segment-intersect":
|
|
4499
|
-
return evalGeoSegmentIntersect(args, evaluate2, ctx);
|
|
4500
|
-
// ===============================
|
|
4501
|
-
// Standard Library: grid/*
|
|
4502
|
-
// ===============================
|
|
4503
|
-
case "grid/to-world":
|
|
4504
|
-
return evalGridToWorld(args, evaluate2, ctx);
|
|
4505
|
-
case "grid/from-world":
|
|
4506
|
-
return evalGridFromWorld(args, evaluate2, ctx);
|
|
4507
|
-
case "grid/iso-to-screen":
|
|
4508
|
-
return evalGridIsoToScreen(args, evaluate2, ctx);
|
|
4509
|
-
case "grid/screen-to-iso":
|
|
4510
|
-
return evalGridScreenToIso(args, evaluate2, ctx);
|
|
4511
|
-
case "grid/distance":
|
|
4512
|
-
return evalGridDistance(args, evaluate2, ctx);
|
|
4513
|
-
case "grid/manhattan-distance":
|
|
4514
|
-
return evalGridManhattanDistance(args, evaluate2, ctx);
|
|
4515
|
-
case "grid/neighbors":
|
|
4516
|
-
return evalGridNeighbors(args, evaluate2, ctx);
|
|
4517
|
-
case "grid/cells-in-radius":
|
|
4518
|
-
return evalGridCellsInRadius(args, evaluate2, ctx);
|
|
4519
|
-
case "grid/line":
|
|
4520
|
-
return evalGridLine(args, evaluate2, ctx);
|
|
4521
|
-
case "grid/in-bounds":
|
|
4522
|
-
return evalGridInBounds(args, evaluate2, ctx);
|
|
4523
|
-
// ===============================
|
|
4524
|
-
// Standard Library: anim/*
|
|
4525
|
-
// ===============================
|
|
4526
|
-
case "anim/frame-at":
|
|
4527
|
-
return evalAnimFrameAt(args, evaluate2, ctx);
|
|
4528
|
-
case "anim/sheet-rect":
|
|
4529
|
-
return evalAnimSheetRect(args, evaluate2, ctx);
|
|
4530
|
-
case "anim/direction-from-delta":
|
|
4531
|
-
return evalAnimDirectionFromDelta(args, evaluate2, ctx);
|
|
4532
|
-
// ===============================
|
|
4533
|
-
// Standard Library: ease/*
|
|
4534
|
-
// ===============================
|
|
4535
|
-
case "ease/apply":
|
|
4536
|
-
return evalEaseApply(args, evaluate2, ctx);
|
|
4537
|
-
case "ease/smoothstep":
|
|
4538
|
-
return evalEaseSmoothstep(args, evaluate2, ctx);
|
|
4539
|
-
// ===============================
|
|
4540
|
-
// Standard Library: noise/*
|
|
4541
|
-
// ===============================
|
|
4542
|
-
case "noise/perlin":
|
|
4543
|
-
return evalNoisePerlin(args, evaluate2, ctx);
|
|
4544
|
-
case "noise/simplex":
|
|
4545
|
-
return evalNoiseSimplex(args, evaluate2, ctx);
|
|
4546
|
-
case "noise/fbm":
|
|
4547
|
-
return evalNoiseFbm(args, evaluate2, ctx);
|
|
4548
|
-
// ===============================
|
|
4549
|
-
// Standard Library: path/*
|
|
4550
|
-
// ===============================
|
|
4551
|
-
case "path/astar":
|
|
4552
|
-
return evalPathAstar(args, evaluate2, ctx);
|
|
4553
|
-
case "path/reachable":
|
|
4554
|
-
return evalPathReachable(args, evaluate2, ctx);
|
|
4555
|
-
// ===============================
|
|
4556
|
-
// Standard Library: str/*
|
|
4557
|
-
// ===============================
|
|
4558
|
-
case "str/len":
|
|
4559
|
-
return evalStrLen(args, evaluate2, ctx);
|
|
4560
|
-
case "str/concat":
|
|
4561
|
-
return evalStrConcat(args, evaluate2, ctx);
|
|
4562
|
-
case "str/upper":
|
|
4563
|
-
return evalStrUpper(args, evaluate2, ctx);
|
|
4564
|
-
case "str/lower":
|
|
4565
|
-
return evalStrLower(args, evaluate2, ctx);
|
|
4566
|
-
case "str/trim":
|
|
4567
|
-
return evalStrTrim(args, evaluate2, ctx);
|
|
4568
|
-
case "str/trimStart":
|
|
4569
|
-
return evalStrTrimStart(args, evaluate2, ctx);
|
|
4570
|
-
case "str/trimEnd":
|
|
4571
|
-
return evalStrTrimEnd(args, evaluate2, ctx);
|
|
4572
|
-
case "str/split":
|
|
4573
|
-
return evalStrSplit(args, evaluate2, ctx);
|
|
4574
|
-
case "str/join":
|
|
4575
|
-
return evalStrJoin(args, evaluate2, ctx);
|
|
4576
|
-
case "str/slice":
|
|
4577
|
-
return evalStrSlice(args, evaluate2, ctx);
|
|
4578
|
-
case "str/replace":
|
|
4579
|
-
return evalStrReplace(args, evaluate2, ctx);
|
|
4580
|
-
case "str/replaceAll":
|
|
4581
|
-
return evalStrReplaceAll(args, evaluate2, ctx);
|
|
4582
|
-
case "str/includes":
|
|
4583
|
-
return evalStrIncludes(args, evaluate2, ctx);
|
|
4584
|
-
case "str/startsWith":
|
|
4585
|
-
return evalStrStartsWith(args, evaluate2, ctx);
|
|
4586
|
-
case "str/endsWith":
|
|
4587
|
-
return evalStrEndsWith(args, evaluate2, ctx);
|
|
4588
|
-
case "str/padStart":
|
|
4589
|
-
return evalStrPadStart(args, evaluate2, ctx);
|
|
4590
|
-
case "str/padEnd":
|
|
4591
|
-
return evalStrPadEnd(args, evaluate2, ctx);
|
|
4592
|
-
case "str/repeat":
|
|
4593
|
-
return evalStrRepeat(args, evaluate2, ctx);
|
|
4594
|
-
case "str/reverse":
|
|
4595
|
-
return evalStrReverse(args, evaluate2, ctx);
|
|
4596
|
-
case "str/capitalize":
|
|
4597
|
-
return evalStrCapitalize(args, evaluate2, ctx);
|
|
4598
|
-
case "str/titleCase":
|
|
4599
|
-
return evalStrTitleCase(args, evaluate2, ctx);
|
|
4600
|
-
case "str/camelCase":
|
|
4601
|
-
return evalStrCamelCase(args, evaluate2, ctx);
|
|
4602
|
-
case "str/kebabCase":
|
|
4603
|
-
return evalStrKebabCase(args, evaluate2, ctx);
|
|
4604
|
-
case "str/snakeCase":
|
|
4605
|
-
return evalStrSnakeCase(args, evaluate2, ctx);
|
|
4606
|
-
case "str/default":
|
|
4607
|
-
return evalStrDefault(args, evaluate2, ctx);
|
|
4608
|
-
case "str/template":
|
|
4609
|
-
return evalStrTemplate(args, evaluate2, ctx);
|
|
4610
|
-
case "str/truncate":
|
|
4611
|
-
return evalStrTruncate(args, evaluate2, ctx);
|
|
4612
|
-
case "to-string":
|
|
4613
|
-
return String(evaluate2(args[0], ctx));
|
|
4614
|
-
// ===============================
|
|
4615
|
-
// Standard Library: array/*
|
|
4616
|
-
// ===============================
|
|
4617
|
-
case "array/len":
|
|
4618
|
-
return evalArrayLen(args, evaluate2, ctx);
|
|
4619
|
-
case "array/range":
|
|
4620
|
-
return evalArrayRange(args, evaluate2, ctx);
|
|
4621
|
-
case "array/empty?":
|
|
4622
|
-
return evalArrayEmpty(args, evaluate2, ctx);
|
|
4623
|
-
case "array/first":
|
|
4624
|
-
return evalArrayFirst(args, evaluate2, ctx);
|
|
4625
|
-
case "array/last":
|
|
4626
|
-
return evalArrayLast(args, evaluate2, ctx);
|
|
4627
|
-
case "array/nth":
|
|
4628
|
-
return evalArrayNth(args, evaluate2, ctx);
|
|
4629
|
-
case "array/slice":
|
|
4630
|
-
return evalArraySlice(args, evaluate2, ctx);
|
|
4631
|
-
case "array/concat":
|
|
4632
|
-
return evalArrayConcat(args, evaluate2, ctx);
|
|
4633
|
-
case "array/append":
|
|
4634
|
-
return evalArrayAppend(args, evaluate2, ctx);
|
|
4635
|
-
case "array/prepend":
|
|
4636
|
-
return evalArrayPrepend(args, evaluate2, ctx);
|
|
4637
|
-
case "array/insert":
|
|
4638
|
-
return evalArrayInsert(args, evaluate2, ctx);
|
|
4639
|
-
case "array/remove":
|
|
4640
|
-
return evalArrayRemove(args, evaluate2, ctx);
|
|
4641
|
-
case "array/removeItem":
|
|
4642
|
-
return evalArrayRemoveItem(args, evaluate2, ctx);
|
|
4643
|
-
case "array/reverse":
|
|
4644
|
-
return evalArrayReverse(args, evaluate2, ctx);
|
|
4645
|
-
case "array/sort":
|
|
4646
|
-
return evalArraySort(args, evaluate2, ctx);
|
|
4647
|
-
case "array/shuffle":
|
|
4648
|
-
return evalArrayShuffle(args, evaluate2, ctx);
|
|
4649
|
-
case "array/unique":
|
|
4650
|
-
return evalArrayUnique(args, evaluate2, ctx);
|
|
4651
|
-
case "array/flatten":
|
|
4652
|
-
return evalArrayFlatten(args, evaluate2, ctx);
|
|
4653
|
-
case "array/zip":
|
|
4654
|
-
return evalArrayZip(args, evaluate2, ctx);
|
|
4655
|
-
case "array/includes":
|
|
4656
|
-
return evalArrayIncludes(args, evaluate2, ctx);
|
|
4657
|
-
case "array/indexOf":
|
|
4658
|
-
return evalArrayIndexOf(args, evaluate2, ctx);
|
|
4659
|
-
case "array/find":
|
|
4660
|
-
return evalArrayFind(args, evaluate2, ctx);
|
|
4661
|
-
case "array/findIndex":
|
|
4662
|
-
return evalArrayFindIndex(args, evaluate2, ctx);
|
|
4663
|
-
case "array/filter":
|
|
4664
|
-
return evalArrayFilter(args, evaluate2, ctx);
|
|
4665
|
-
case "array/reject":
|
|
4666
|
-
return evalArrayReject(args, evaluate2, ctx);
|
|
4667
|
-
case "array/map":
|
|
4668
|
-
return evalArrayMap(args, evaluate2, ctx);
|
|
4669
|
-
case "array/reduce":
|
|
4670
|
-
return evalArrayReduce(args, evaluate2, ctx);
|
|
4671
|
-
case "array/every":
|
|
4672
|
-
return evalArrayEvery(args, evaluate2, ctx);
|
|
4673
|
-
case "array/some":
|
|
4674
|
-
return evalArraySome(args, evaluate2, ctx);
|
|
4675
|
-
case "array/count":
|
|
4676
|
-
return evalArrayCount(args, evaluate2, ctx);
|
|
4677
|
-
case "array/sum":
|
|
4678
|
-
return evalArraySum(args, evaluate2, ctx);
|
|
4679
|
-
case "array/avg":
|
|
4680
|
-
return evalArrayAvg(args, evaluate2, ctx);
|
|
4681
|
-
case "array/min":
|
|
4682
|
-
return evalArrayMin(args, evaluate2, ctx);
|
|
4683
|
-
case "array/max":
|
|
4684
|
-
return evalArrayMax(args, evaluate2, ctx);
|
|
4685
|
-
case "array/groupBy":
|
|
4686
|
-
return evalArrayGroupBy(args, evaluate2, ctx);
|
|
4687
|
-
case "array/partition":
|
|
4688
|
-
return evalArrayPartition(args, evaluate2, ctx);
|
|
4689
|
-
case "array/take":
|
|
4690
|
-
return evalArrayTake(args, evaluate2, ctx);
|
|
4691
|
-
case "array/drop":
|
|
4692
|
-
return evalArrayDrop(args, evaluate2, ctx);
|
|
4693
|
-
case "array/takeLast":
|
|
4694
|
-
return evalArrayTakeLast(args, evaluate2, ctx);
|
|
4695
|
-
case "array/dropLast":
|
|
4696
|
-
return evalArrayDropLast(args, evaluate2, ctx);
|
|
4697
|
-
case "array/cosine":
|
|
4698
|
-
return evalArrayCosine(args, evaluate2, ctx);
|
|
4699
|
-
case "array/nearest":
|
|
4700
|
-
return evalArrayNearest(args, evaluate2, ctx);
|
|
4701
|
-
// ===============================
|
|
4702
|
-
// Standard Library: object/*
|
|
4703
|
-
// ===============================
|
|
4704
|
-
case "object/keys":
|
|
4705
|
-
return evalObjectKeys(args, evaluate2, ctx);
|
|
4706
|
-
case "object/values":
|
|
4707
|
-
return evalObjectValues(args, evaluate2, ctx);
|
|
4708
|
-
case "object/entries":
|
|
4709
|
-
return evalObjectEntries(args, evaluate2, ctx);
|
|
4710
|
-
case "object/fromEntries":
|
|
4711
|
-
return evalObjectFromEntries(args, evaluate2, ctx);
|
|
4712
|
-
case "object/get":
|
|
4713
|
-
return evalObjectGet(args, evaluate2, ctx);
|
|
4714
|
-
case "object/set":
|
|
4715
|
-
return evalObjectSet(args, evaluate2, ctx);
|
|
4716
|
-
case "object/has":
|
|
4717
|
-
return evalObjectHas(args, evaluate2, ctx);
|
|
4718
|
-
case "object/merge":
|
|
4719
|
-
return evalObjectMerge(args, evaluate2, ctx);
|
|
4720
|
-
case "object/deepMerge":
|
|
4721
|
-
return evalObjectDeepMerge(args, evaluate2, ctx);
|
|
4722
|
-
case "object/pick":
|
|
4723
|
-
return evalObjectPick(args, evaluate2, ctx);
|
|
4724
|
-
case "object/omit":
|
|
4725
|
-
return evalObjectOmit(args, evaluate2, ctx);
|
|
4726
|
-
case "object/mapValues":
|
|
4727
|
-
return evalObjectMapValues(args, evaluate2, ctx);
|
|
4728
|
-
case "object/mapKeys":
|
|
4729
|
-
return evalObjectMapKeys(args, evaluate2, ctx);
|
|
4730
|
-
case "object/filter":
|
|
4731
|
-
return evalObjectFilter(args, evaluate2, ctx);
|
|
4732
|
-
case "object/empty?":
|
|
4733
|
-
return evalObjectEmpty(args, evaluate2, ctx);
|
|
4734
|
-
case "object/equals":
|
|
4735
|
-
return evalObjectEquals(args, evaluate2, ctx);
|
|
4736
|
-
case "object/clone":
|
|
4737
|
-
return evalObjectClone(args, evaluate2, ctx);
|
|
4738
|
-
case "object/deepClone":
|
|
4739
|
-
return evalObjectDeepClone(args, evaluate2, ctx);
|
|
4740
|
-
// Path operator (for dynamic field access)
|
|
4741
|
-
case "path":
|
|
4742
|
-
return evalPath(args, evaluate2, ctx);
|
|
4743
|
-
// ===============================
|
|
4744
|
-
// Standard Library: validate/*
|
|
4745
|
-
// ===============================
|
|
4746
|
-
case "validate/required":
|
|
4747
|
-
return evalValidateRequired(args, evaluate2, ctx);
|
|
4748
|
-
case "validate/string":
|
|
4749
|
-
return evalValidateString(args, evaluate2, ctx);
|
|
4750
|
-
case "validate/number":
|
|
4751
|
-
return evalValidateNumber(args, evaluate2, ctx);
|
|
4752
|
-
case "validate/boolean":
|
|
4753
|
-
return evalValidateBoolean(args, evaluate2, ctx);
|
|
4754
|
-
case "validate/array":
|
|
4755
|
-
return evalValidateArray(args, evaluate2, ctx);
|
|
4756
|
-
case "validate/object":
|
|
4757
|
-
return evalValidateObject(args, evaluate2, ctx);
|
|
4758
|
-
case "validate/email":
|
|
4759
|
-
return evalValidateEmail(args, evaluate2, ctx);
|
|
4760
|
-
case "validate/url":
|
|
4761
|
-
return evalValidateUrl(args, evaluate2, ctx);
|
|
4762
|
-
case "validate/uuid":
|
|
4763
|
-
return evalValidateUuid(args, evaluate2, ctx);
|
|
4764
|
-
case "validate/phone":
|
|
4765
|
-
return evalValidatePhone(args, evaluate2, ctx);
|
|
4766
|
-
case "validate/creditCard":
|
|
4767
|
-
return evalValidateCreditCard(args, evaluate2, ctx);
|
|
4768
|
-
case "validate/date":
|
|
4769
|
-
return evalValidateDate(args, evaluate2, ctx);
|
|
4770
|
-
case "validate/minLength":
|
|
4771
|
-
return evalValidateMinLength(args, evaluate2, ctx);
|
|
4772
|
-
case "validate/maxLength":
|
|
4773
|
-
return evalValidateMaxLength(args, evaluate2, ctx);
|
|
4774
|
-
case "validate/length":
|
|
4775
|
-
return evalValidateLength(args, evaluate2, ctx);
|
|
4776
|
-
case "validate/min":
|
|
4777
|
-
return evalValidateMin(args, evaluate2, ctx);
|
|
4778
|
-
case "validate/max":
|
|
4779
|
-
return evalValidateMax(args, evaluate2, ctx);
|
|
4780
|
-
case "validate/range":
|
|
4781
|
-
return evalValidateRange(args, evaluate2, ctx);
|
|
4782
|
-
case "validate/pattern":
|
|
4783
|
-
return evalValidatePattern(args, evaluate2, ctx);
|
|
4784
|
-
case "validate/oneOf":
|
|
4785
|
-
return evalValidateOneOf(args, evaluate2, ctx);
|
|
4786
|
-
case "validate/noneOf":
|
|
4787
|
-
return evalValidateNoneOf(args, evaluate2, ctx);
|
|
4788
|
-
case "validate/equals":
|
|
4789
|
-
return evalValidateEquals(args, evaluate2, ctx);
|
|
4790
|
-
case "validate/check":
|
|
4791
|
-
return evalValidateCheck(args, evaluate2, ctx);
|
|
4792
|
-
// ===============================
|
|
4793
|
-
// Standard Library: time/*
|
|
4794
|
-
// ===============================
|
|
4795
|
-
case "time/now":
|
|
4796
|
-
return evalTimeNow();
|
|
4797
|
-
case "time/today":
|
|
4798
|
-
return evalTimeToday();
|
|
4799
|
-
case "time/parse":
|
|
4800
|
-
return evalTimeParse(args, evaluate2, ctx);
|
|
4801
|
-
case "time/format":
|
|
4802
|
-
return evalTimeFormat(args, evaluate2, ctx);
|
|
4803
|
-
case "time/year":
|
|
4804
|
-
return evalTimeYear(args, evaluate2, ctx);
|
|
4805
|
-
case "time/month":
|
|
4806
|
-
return evalTimeMonth(args, evaluate2, ctx);
|
|
4807
|
-
case "time/day":
|
|
4808
|
-
return evalTimeDay(args, evaluate2, ctx);
|
|
4809
|
-
case "time/weekday":
|
|
4810
|
-
return evalTimeWeekday(args, evaluate2, ctx);
|
|
4811
|
-
case "time/hour":
|
|
4812
|
-
return evalTimeHour(args, evaluate2, ctx);
|
|
4813
|
-
case "time/minute":
|
|
4814
|
-
return evalTimeMinute(args, evaluate2, ctx);
|
|
4815
|
-
case "time/second":
|
|
4816
|
-
return evalTimeSecond(args, evaluate2, ctx);
|
|
4817
|
-
case "time/add":
|
|
4818
|
-
return evalTimeAdd(args, evaluate2, ctx);
|
|
4819
|
-
case "time/subtract":
|
|
4820
|
-
return evalTimeSubtract(args, evaluate2, ctx);
|
|
4821
|
-
case "time/diff":
|
|
4822
|
-
return evalTimeDiff(args, evaluate2, ctx);
|
|
4823
|
-
case "time/startOf":
|
|
4824
|
-
return evalTimeStartOf(args, evaluate2, ctx);
|
|
4825
|
-
case "time/endOf":
|
|
4826
|
-
return evalTimeEndOf(args, evaluate2, ctx);
|
|
4827
|
-
case "time/isBefore":
|
|
4828
|
-
return evalTimeIsBefore(args, evaluate2, ctx);
|
|
4829
|
-
case "time/isAfter":
|
|
4830
|
-
return evalTimeIsAfter(args, evaluate2, ctx);
|
|
4831
|
-
case "time/isBetween":
|
|
4832
|
-
return evalTimeIsBetween(args, evaluate2, ctx);
|
|
4833
|
-
case "time/isSame":
|
|
4834
|
-
return evalTimeIsSame(args, evaluate2, ctx);
|
|
4835
|
-
case "time/isPast":
|
|
4836
|
-
return evalTimeIsPast(args, evaluate2, ctx);
|
|
4837
|
-
case "time/isFuture":
|
|
4838
|
-
return evalTimeIsFuture(args, evaluate2, ctx);
|
|
4839
|
-
case "time/isToday":
|
|
4840
|
-
return evalTimeIsToday(args, evaluate2, ctx);
|
|
4841
|
-
case "time/relative":
|
|
4842
|
-
return evalTimeRelative(args, evaluate2, ctx);
|
|
4843
|
-
case "time/duration":
|
|
4844
|
-
return evalTimeDuration(args, evaluate2, ctx);
|
|
4845
|
-
// ===============================
|
|
4846
|
-
// Standard Library: format/*
|
|
4847
|
-
// ===============================
|
|
4848
|
-
case "format/number":
|
|
4849
|
-
return evalFormatNumber(args, evaluate2, ctx);
|
|
4850
|
-
case "format/currency":
|
|
4851
|
-
return evalFormatCurrency(args, evaluate2, ctx);
|
|
4852
|
-
case "format/percent":
|
|
4853
|
-
return evalFormatPercent(args, evaluate2, ctx);
|
|
4854
|
-
case "format/bytes":
|
|
4855
|
-
return evalFormatBytes(args, evaluate2, ctx);
|
|
4856
|
-
case "format/ordinal":
|
|
4857
|
-
return evalFormatOrdinal(args, evaluate2, ctx);
|
|
4858
|
-
case "format/plural":
|
|
4859
|
-
return evalFormatPlural(args, evaluate2, ctx);
|
|
4860
|
-
case "format/list":
|
|
4861
|
-
return evalFormatList(args, evaluate2, ctx);
|
|
4862
|
-
case "format/phone":
|
|
4863
|
-
return evalFormatPhone(args, evaluate2, ctx);
|
|
4864
|
-
case "format/creditCard":
|
|
4865
|
-
return evalFormatCreditCard(args, evaluate2, ctx);
|
|
4866
|
-
// ===============================
|
|
4867
|
-
// Standard Library: async/*
|
|
4868
|
-
// ===============================
|
|
4869
|
-
case "async/delay":
|
|
4870
|
-
return evalAsyncDelay(args, evaluate2, ctx);
|
|
4871
|
-
case "async/interval":
|
|
4872
|
-
return evalAsyncInterval(args, evaluate2, ctx);
|
|
4873
|
-
case "async/timeout":
|
|
4874
|
-
return evalAsyncTimeout(args, evaluate2, ctx);
|
|
4875
|
-
case "async/debounce":
|
|
4876
|
-
evalAsyncDebounce(args, evaluate2, ctx);
|
|
4877
|
-
return void 0;
|
|
4878
|
-
case "async/throttle":
|
|
4879
|
-
evalAsyncThrottle(args, evaluate2, ctx);
|
|
4880
|
-
return void 0;
|
|
4881
|
-
case "async/retry":
|
|
4882
|
-
return evalAsyncRetry(args, evaluate2, ctx);
|
|
4883
|
-
case "async/race":
|
|
4884
|
-
return evalAsyncRace(args, evaluate2, ctx);
|
|
4885
|
-
case "async/all":
|
|
4886
|
-
return evalAsyncAll(args, evaluate2, ctx);
|
|
4887
|
-
case "async/sequence":
|
|
4888
|
-
return evalAsyncSequence(args, evaluate2, ctx);
|
|
4889
|
-
// ===============================
|
|
4890
|
-
// Standard Library: prob/*
|
|
4891
|
-
// ===============================
|
|
4892
|
-
case "prob/seed":
|
|
4893
|
-
evalProbSeed(args, evaluate2, ctx);
|
|
4894
|
-
return void 0;
|
|
4895
|
-
case "prob/flip":
|
|
4896
|
-
return evalProbFlip(args, evaluate2, ctx);
|
|
4897
|
-
case "prob/gaussian":
|
|
4898
|
-
return evalProbGaussian(args, evaluate2, ctx);
|
|
4899
|
-
case "prob/uniform":
|
|
4900
|
-
return evalProbUniform(args, evaluate2, ctx);
|
|
4901
|
-
case "prob/beta":
|
|
4902
|
-
return evalProbBeta(args, evaluate2, ctx);
|
|
4903
|
-
case "prob/categorical":
|
|
4904
|
-
return evalProbCategorical(args, evaluate2, ctx);
|
|
4905
|
-
case "prob/poisson":
|
|
4906
|
-
return evalProbPoisson(args, evaluate2, ctx);
|
|
4907
|
-
case "prob/condition":
|
|
4908
|
-
evalProbCondition(args, evaluate2, ctx);
|
|
4909
|
-
return void 0;
|
|
4910
|
-
case "prob/sample":
|
|
4911
|
-
return evalProbSample(args, evaluate2, ctx);
|
|
4912
|
-
case "prob/posterior":
|
|
4913
|
-
return evalProbPosterior(args, evaluate2, ctx);
|
|
4914
|
-
case "prob/infer":
|
|
4915
|
-
return evalProbInfer(args, evaluate2, ctx);
|
|
4916
|
-
case "prob/expected-value":
|
|
4917
|
-
return evalProbExpectedValue(args, evaluate2, ctx);
|
|
4918
|
-
case "prob/variance":
|
|
4919
|
-
return evalProbVariance(args, evaluate2, ctx);
|
|
4920
|
-
case "prob/histogram":
|
|
4921
|
-
return evalProbHistogram(args, evaluate2, ctx);
|
|
4922
|
-
case "prob/percentile":
|
|
4923
|
-
return evalProbPercentile(args, evaluate2, ctx);
|
|
4924
|
-
case "prob/credible-interval":
|
|
4925
|
-
return evalProbCredibleInterval(args, evaluate2, ctx);
|
|
4926
|
-
// ===============================
|
|
4927
|
-
// Standard Library: os/*
|
|
4928
|
-
// ===============================
|
|
4929
|
-
case "os/watch-files":
|
|
4930
|
-
evalOsWatchFiles(args, evaluate2, ctx);
|
|
4931
|
-
return void 0;
|
|
4932
|
-
case "os/watch-process":
|
|
4933
|
-
evalOsWatchProcess(args, evaluate2, ctx);
|
|
4934
|
-
return void 0;
|
|
4935
|
-
case "os/watch-port":
|
|
4936
|
-
evalOsWatchPort(args, evaluate2, ctx);
|
|
4937
|
-
return void 0;
|
|
4938
|
-
case "os/watch-http":
|
|
4939
|
-
evalOsWatchHttp(args, evaluate2, ctx);
|
|
4940
|
-
return void 0;
|
|
4941
|
-
case "os/watch-cron":
|
|
4942
|
-
evalOsWatchCron(args, evaluate2, ctx);
|
|
4943
|
-
return void 0;
|
|
4944
|
-
case "os/watch-signal":
|
|
4945
|
-
evalOsWatchSignal(args, evaluate2, ctx);
|
|
4946
|
-
return void 0;
|
|
4947
|
-
case "os/watch-env":
|
|
4948
|
-
evalOsWatchEnv(args, evaluate2, ctx);
|
|
4949
|
-
return void 0;
|
|
4950
|
-
case "os/debounce":
|
|
4951
|
-
evalOsDebounce(args, evaluate2, ctx);
|
|
4952
|
-
return void 0;
|
|
4953
|
-
// ===============================
|
|
4954
|
-
// Standard Library: llm/*
|
|
4955
|
-
// ===============================
|
|
4956
|
-
case "llm/generate":
|
|
4957
|
-
return evalLlmGenerate(args, evaluate2, ctx);
|
|
4958
|
-
case "llm/call-tools":
|
|
4959
|
-
return evalLlmCallTools(args, evaluate2, ctx);
|
|
4960
|
-
case "llm/embed":
|
|
4961
|
-
return evalLlmEmbed(args, evaluate2, ctx);
|
|
4962
|
-
case "llm/token-count":
|
|
4963
|
-
return evalLlmTokenCount(args, evaluate2, ctx);
|
|
4964
|
-
case "llm/switch":
|
|
4965
|
-
return evalLlmSwitch(args, evaluate2, ctx);
|
|
4966
|
-
case "llm/compact":
|
|
4967
|
-
return evalLlmCompact(args, evaluate2, ctx);
|
|
4968
|
-
// ===============================
|
|
4969
|
-
// Standard Library: workspace/*
|
|
4970
|
-
// ===============================
|
|
4971
|
-
case "workspace/read-orbital":
|
|
4972
|
-
return evalWorkspaceReadOrbital(args, evaluate2, ctx);
|
|
4973
|
-
case "workspace/write-orbital":
|
|
4974
|
-
return evalWorkspaceWriteOrbital(args, evaluate2, ctx);
|
|
4975
|
-
case "workspace/read-file":
|
|
4976
|
-
return evalWorkspaceReadFile(args, evaluate2, ctx);
|
|
4977
|
-
case "workspace/write-file":
|
|
4978
|
-
return evalWorkspaceWriteFile(args, evaluate2, ctx);
|
|
4979
|
-
case "workspace/exists":
|
|
4980
|
-
return evalWorkspaceExists(args, evaluate2, ctx);
|
|
4981
|
-
case "workspace/list-orbitals":
|
|
4982
|
-
return evalWorkspaceListOrbitals(args, evaluate2, ctx);
|
|
4983
|
-
case "workspace/read-schema":
|
|
4984
|
-
return evalWorkspaceReadSchema(args, evaluate2, ctx);
|
|
4985
|
-
case "workspace/write-schema":
|
|
4986
|
-
return evalWorkspaceWriteSchema(args, evaluate2, ctx);
|
|
4987
|
-
case "workspace/read-plan":
|
|
4988
|
-
return evalWorkspaceReadPlan(args, evaluate2, ctx);
|
|
4989
|
-
case "workspace/write-plan":
|
|
4990
|
-
return evalWorkspaceWritePlan(args, evaluate2, ctx);
|
|
4991
|
-
case "workspace/archive-orbital":
|
|
4992
|
-
return evalWorkspaceArchiveOrbital(args, evaluate2, ctx);
|
|
4993
|
-
// ===============================
|
|
4994
|
-
// Standard Library: session/*
|
|
4995
|
-
// ===============================
|
|
4996
|
-
case "session/read-spec":
|
|
4997
|
-
return evalSessionReadSpec(args, evaluate2, ctx);
|
|
4998
|
-
case "session/write-spec":
|
|
4999
|
-
return evalSessionWriteSpec(args, evaluate2, ctx);
|
|
5000
|
-
case "session/read-memory":
|
|
5001
|
-
return evalSessionReadMemory(args, evaluate2, ctx);
|
|
5002
|
-
case "session/write-memory":
|
|
5003
|
-
return evalSessionWriteMemory(args, evaluate2, ctx);
|
|
5004
|
-
case "session/read-history":
|
|
5005
|
-
return evalSessionReadHistory(args, evaluate2, ctx);
|
|
5006
|
-
case "session/append-history":
|
|
5007
|
-
return evalSessionAppendHistory(args, evaluate2, ctx);
|
|
5008
|
-
case "session/read-errors":
|
|
5009
|
-
return evalSessionReadErrors(args, evaluate2, ctx);
|
|
5010
|
-
case "session/write-errors":
|
|
5011
|
-
return evalSessionWriteErrors(args, evaluate2, ctx);
|
|
5012
|
-
case "session/read-analysis":
|
|
5013
|
-
return evalSessionReadAnalysis(args, evaluate2, ctx);
|
|
5014
|
-
// ===============================
|
|
5015
|
-
// Standard Library: memory/*
|
|
5016
|
-
// ===============================
|
|
5017
|
-
case "memory/recall":
|
|
5018
|
-
return evalMemoryRecall(args, evaluate2, ctx);
|
|
5019
|
-
case "memory/store":
|
|
5020
|
-
return evalMemoryStore(args, evaluate2, ctx);
|
|
5021
|
-
case "memory/list":
|
|
5022
|
-
return evalMemoryList(args, evaluate2, ctx);
|
|
5023
|
-
// ===============================
|
|
5024
|
-
// Standard Library: trace/*
|
|
5025
|
-
// ===============================
|
|
5026
|
-
case "trace/emit":
|
|
5027
|
-
return evalTraceEmit(args, evaluate2, ctx);
|
|
5028
|
-
case "trace/log":
|
|
5029
|
-
return evalTraceLog(args, evaluate2, ctx);
|
|
5030
|
-
// ===============================
|
|
5031
|
-
// Standard Library: integration/*
|
|
5032
|
-
// ===============================
|
|
5033
|
-
case "integration/http":
|
|
5034
|
-
return evalIntegrationHttp(args, evaluate2, ctx);
|
|
5035
|
-
case "integration/github-get-repo":
|
|
5036
|
-
return evalIntegrationGithubGetRepo(args, evaluate2, ctx);
|
|
5037
|
-
case "integration/github-create-issue":
|
|
5038
|
-
return evalIntegrationGithubCreateIssue(args, evaluate2, ctx);
|
|
5039
|
-
// ===============================
|
|
5040
|
-
// Standard Library: contract/*
|
|
5041
|
-
// ===============================
|
|
5042
|
-
case "contract/validate-input":
|
|
5043
|
-
return evalContractValidateInput(args, evaluate2, ctx);
|
|
5044
|
-
case "contract/validate-output":
|
|
5045
|
-
return evalContractValidateOutput(args, evaluate2, ctx);
|
|
5046
|
-
case "contract/clamp-output":
|
|
5047
|
-
return evalContractClampOutput(args, evaluate2, ctx);
|
|
5048
|
-
case "contract/violations":
|
|
5049
|
-
return evalContractViolations(args, evaluate2, ctx);
|
|
5050
|
-
case "contract/entity-to-tensor":
|
|
5051
|
-
return evalContractEntityToTensor(args, evaluate2, ctx);
|
|
5052
|
-
case "contract/tensor-to-payload":
|
|
5053
|
-
return evalContractTensorToPayload(args, evaluate2, ctx);
|
|
5054
|
-
// ===============================
|
|
5055
|
-
// Standard Library: graph/*
|
|
5056
|
-
// ===============================
|
|
5057
|
-
case "graph/from-entities":
|
|
5058
|
-
return evalGraphFromEntities(args, evaluate2, ctx);
|
|
5059
|
-
case "graph/from-adjacency":
|
|
5060
|
-
return evalGraphFromAdjacency(args, evaluate2, ctx);
|
|
5061
|
-
case "graph/from-edge-list":
|
|
5062
|
-
return evalGraphFromEdgeList(args, evaluate2, ctx);
|
|
5063
|
-
case "graph/add-self-loops":
|
|
5064
|
-
return evalGraphAddSelfLoops(args, evaluate2, ctx);
|
|
5065
|
-
case "graph/to-undirected":
|
|
5066
|
-
return evalGraphToUndirected(args, evaluate2, ctx);
|
|
5067
|
-
case "graph/subgraph":
|
|
5068
|
-
return evalGraphSubgraph(args, evaluate2, ctx);
|
|
5069
|
-
case "graph/k-hop":
|
|
5070
|
-
return evalGraphKHop(args, evaluate2, ctx);
|
|
5071
|
-
case "graph/node-features":
|
|
5072
|
-
return evalGraphNodeFeatures(args, evaluate2, ctx);
|
|
5073
|
-
case "graph/edge-index":
|
|
5074
|
-
return evalGraphEdgeIndex(args, evaluate2, ctx);
|
|
5075
|
-
case "graph/edge-features":
|
|
5076
|
-
return evalGraphEdgeFeatures(args, evaluate2, ctx);
|
|
5077
|
-
case "graph/num-nodes":
|
|
5078
|
-
return evalGraphNumNodes(args, evaluate2, ctx);
|
|
5079
|
-
case "graph/num-edges":
|
|
5080
|
-
return evalGraphNumEdges(args, evaluate2, ctx);
|
|
5081
|
-
case "graph/degree":
|
|
5082
|
-
return evalGraphDegree(args, evaluate2, ctx);
|
|
5083
|
-
case "graph/batch":
|
|
5084
|
-
return evalGraphBatch(args, evaluate2, ctx);
|
|
5085
|
-
// ===============================
|
|
5086
|
-
// Standard Library: data/*
|
|
5087
|
-
// ===============================
|
|
5088
|
-
case "data/dataset":
|
|
5089
|
-
return evalDataDataset(args, evaluate2, ctx);
|
|
5090
|
-
case "data/dataloader":
|
|
5091
|
-
return evalDataDataloader(args, evaluate2, ctx);
|
|
5092
|
-
case "data/split":
|
|
5093
|
-
return evalDataSplit(args, evaluate2, ctx);
|
|
5094
|
-
case "data/normalize":
|
|
5095
|
-
return evalDataNormalize(args, evaluate2, ctx);
|
|
5096
|
-
case "data/augment":
|
|
5097
|
-
return evalDataAugment(args, evaluate2, ctx);
|
|
5098
|
-
case "data/tokenize":
|
|
5099
|
-
return evalDataTokenize(args, evaluate2, ctx);
|
|
5100
|
-
case "data/pad":
|
|
5101
|
-
return evalDataPad(args, evaluate2, ctx);
|
|
5102
|
-
default:
|
|
5103
|
-
return UNKNOWN_OPERATOR;
|
|
5104
|
-
}
|
|
4791
|
+
const impl = OPERATOR_TABLE[op];
|
|
4792
|
+
if (impl === void 0) return UNKNOWN_OPERATOR;
|
|
4793
|
+
return impl(args, this.boundInterpret, ctx);
|
|
5105
4794
|
}
|
|
5106
4795
|
};
|
|
5107
4796
|
var evaluator = new SExpressionEvaluator();
|