@almadar/evaluator 2.25.0 → 2.27.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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isSExpr, isBinding, getOperator, getArgs, OrbitalZodSchema, safeParseOrbitalSchema } from '@almadar/core';
1
+ import { isSExpr, isBinding, getOperator, getArgs, isFieldValue, isEventPayloadValue, isSessionHistoryEntry, isPlanSnapshot, OrbitalZodSchema, safeParseOrbitalSchema } from '@almadar/core';
2
2
  export { CORE_BINDINGS, ExpressionSchema, SExprSchema, collectBindings, getArgs, getOperator, isBinding, isSExpr, isSExprAtom, isSExprCall, isValidBinding, parseBinding, sexpr, walkSExpr } from '@almadar/core';
3
3
 
4
4
  // types/expression.ts
@@ -2563,37 +2563,6 @@ function evalLlmCompact(args, evaluate2, ctx) {
2563
2563
  const strategy = args.length > 0 ? evaluate2(args[0], ctx) : void 0;
2564
2564
  return ctx.llm.compact(strategy);
2565
2565
  }
2566
- function isFieldValue(value) {
2567
- if (value === null) return true;
2568
- const kind = typeof value;
2569
- if (kind === "string" || kind === "number" || kind === "boolean") return true;
2570
- if (value instanceof Date) return true;
2571
- if (Array.isArray(value)) return value.every((item) => isFieldValue(item));
2572
- if (kind === "object" && value !== null && typeof value === "object") {
2573
- return Object.values(value).every((item) => item === void 0 || isFieldValue(item));
2574
- }
2575
- return false;
2576
- }
2577
- function isEventPayloadValue(value) {
2578
- if (value === null || value === void 0) return true;
2579
- const kind = typeof value;
2580
- if (kind === "string" || kind === "number" || kind === "boolean") return true;
2581
- if (value instanceof Date) return true;
2582
- if (Array.isArray(value)) return value.every((item) => isEventPayloadValue(item));
2583
- if (kind === "object" && value !== null && typeof value === "object") {
2584
- return Object.values(value).every((item) => isEventPayloadValue(item));
2585
- }
2586
- return false;
2587
- }
2588
- function isSessionHistoryEntry(value) {
2589
- if (typeof value !== "object" || value === null) return false;
2590
- return "role" in value && typeof value.role === "string" && "content" in value && typeof value.content === "string" && "timestamp" in value && typeof value.timestamp === "number";
2591
- }
2592
- function isPlanSnapshot(value) {
2593
- if (typeof value !== "object" || value === null) return false;
2594
- const statuses = ["proposed", "confirmed", "built", "failed"];
2595
- return "schemaVersion" in value && value.schemaVersion === 1 && "status" in value && statuses.some((s) => s === value.status) && "builtAt" in value && typeof value.builtAt === "string" && "orbitals" in value && Array.isArray(value.orbitals) && "renames" in value && Array.isArray(value.renames) && "deletedOrbitals" in value && Array.isArray(value.deletedOrbitals);
2596
- }
2597
2566
  function isOrbital(value) {
2598
2567
  return OrbitalZodSchema.safeParse(value).success;
2599
2568
  }