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