@manifesto-ai/core 2.6.1 → 2.7.1

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.d.ts CHANGED
@@ -1479,6 +1479,7 @@ declare function toCanonical(obj: unknown): string;
1479
1479
  * - Non-finite numbers: null
1480
1480
  */
1481
1481
  declare function toJcs(value: unknown): string;
1482
+ declare function compareUnicodeCodePoints(a: string, b: string): number;
1482
1483
  /**
1483
1484
  * Parse canonical JSON string
1484
1485
  */
@@ -1784,4 +1785,4 @@ interface ManifestoCore {
1784
1785
  */
1785
1786
  declare function createCore(): ManifestoCore;
1786
1787
 
1787
- export { AbsExpr, ActionSpec, AddExpr, AndExpr, AppendExpr, AtExpr, CallFlow, CeilExpr, CoalesceExpr, ComputeResult, ComputeStatus, ComputedFieldSpec, ComputedSpec, ConcatExpr, CoreErrorCode, type DependencyGraph, DivExpr, DomainSchema, EffectFlow, EndsWithExpr, EntriesExpr, EnumFieldType, EqExpr, ErrorValue, type EvalContext, EveryExpr, ExplainResult, ExprKind, type ExprNode, ExprNodeSchema, type ExprResult, FailFlow, FieldExpr, FieldSpec, FieldType, FilterExpr, FindExpr, FirstExpr, FlatExpr, FloorExpr, FlowKind, type FlowNode, FlowNodeSchema, FlowPosition, type FlowResult, type FlowState, type FlowStatus, FromEntriesExpr, GetExpr, GtExpr, GteExpr, HaltFlow, HasKeyExpr, HostContext, IfExpr, IfFlow, IncludesExpr, IndexOfExpr, Intent, IsNullExpr, KeysExpr, LastExpr, LenExpr, LitExpr, LtExpr, LteExpr, type ManifestoCore, MapExpr, MaxArrayExpr, MaxExpr, MergeExpr, type MergePatch, MinArrayExpr, MinExpr, ModExpr, MulExpr, NegExpr, NeqExpr, NotExpr, ObjectExpr, OmitExpr, OrExpr, Patch, PatchFlow, PatchOp, PatchPath, PatchSegment, PickExpr, PowExpr, PrimitiveFieldType, ReplaceExpr, Requirement, Result, ReverseExpr, RoundExpr, type SchemaHashInput, type SchemaHashMode, SchemaMeta, SemanticPath, SeqFlow, type SetPatch, SliceExpr, Snapshot, SnapshotMeta, SomeExpr, SplitExpr, SqrtExpr, StartsWithExpr, StateSpec, StrIncludesExpr, StrLenExpr, SubExpr, SubstringExpr, SumArrayExpr, SystemDelta, SystemState, ToBooleanExpr, ToLowerCaseExpr, ToNumberExpr, ToStringExpr, ToUpperCaseExpr, type TraceContext, TraceGraph, TraceNode, TraceNodeKind, TraceTermination, TrimExpr, TypeDefinition, TypeSpec, TypeofExpr, UniqueExpr, type UnsetPatch, ValidationError, ValidationResult, ValuesExpr, apply, applySystemDelta, buildDependencyGraph, canonicalEqual, compute, computeSync, createContext, createCore, createError, createFlowState, createInitialSystemState, createIntent, createSnapshot, createTraceContext, createTraceNode, detectCycles, err, evaluateComputed, evaluateExpr, evaluateFlow, evaluateFlowSync, evaluateSingleComputed, explain, extractDefaults, fromCanonical, generateRequirementId, generateRequirementIdSync, generateTraceId, getByPatchPath, getByPath, getTransitiveDeps, hasPath, hashSchema, hashSchemaEffective, hashSchemaEffectiveSync, hashSchemaSync, indexSegment, invalidResult, isErr, isErrorValue, isOk, isSafePatchPath, joinPath, lastSegment, mergeAtPatchPath, mergeAtPath, mergePatch, ok, parentPath, parsePath, patchPathToDisplayString, propSegment, semanticPathToPatchPath, setByPatchPath, setByPath, setPatch, sha256, sha256Sync, sortKeys, toCanonical, toJcs, topologicalSort, unsetByPatchPath, unsetByPath, unsetPatch, validResult, validate, withCollectionContext, withNodePath, withSnapshot };
1788
+ export { AbsExpr, ActionSpec, AddExpr, AndExpr, AppendExpr, AtExpr, CallFlow, CeilExpr, CoalesceExpr, ComputeResult, ComputeStatus, ComputedFieldSpec, ComputedSpec, ConcatExpr, CoreErrorCode, type DependencyGraph, DivExpr, DomainSchema, EffectFlow, EndsWithExpr, EntriesExpr, EnumFieldType, EqExpr, ErrorValue, type EvalContext, EveryExpr, ExplainResult, ExprKind, type ExprNode, ExprNodeSchema, type ExprResult, FailFlow, FieldExpr, FieldSpec, FieldType, FilterExpr, FindExpr, FirstExpr, FlatExpr, FloorExpr, FlowKind, type FlowNode, FlowNodeSchema, FlowPosition, type FlowResult, type FlowState, type FlowStatus, FromEntriesExpr, GetExpr, GtExpr, GteExpr, HaltFlow, HasKeyExpr, HostContext, IfExpr, IfFlow, IncludesExpr, IndexOfExpr, Intent, IsNullExpr, KeysExpr, LastExpr, LenExpr, LitExpr, LtExpr, LteExpr, type ManifestoCore, MapExpr, MaxArrayExpr, MaxExpr, MergeExpr, type MergePatch, MinArrayExpr, MinExpr, ModExpr, MulExpr, NegExpr, NeqExpr, NotExpr, ObjectExpr, OmitExpr, OrExpr, Patch, PatchFlow, PatchOp, PatchPath, PatchSegment, PickExpr, PowExpr, PrimitiveFieldType, ReplaceExpr, Requirement, Result, ReverseExpr, RoundExpr, type SchemaHashInput, type SchemaHashMode, SchemaMeta, SemanticPath, SeqFlow, type SetPatch, SliceExpr, Snapshot, SnapshotMeta, SomeExpr, SplitExpr, SqrtExpr, StartsWithExpr, StateSpec, StrIncludesExpr, StrLenExpr, SubExpr, SubstringExpr, SumArrayExpr, SystemDelta, SystemState, ToBooleanExpr, ToLowerCaseExpr, ToNumberExpr, ToStringExpr, ToUpperCaseExpr, type TraceContext, TraceGraph, TraceNode, TraceNodeKind, TraceTermination, TrimExpr, TypeDefinition, TypeSpec, TypeofExpr, UniqueExpr, type UnsetPatch, ValidationError, ValidationResult, ValuesExpr, apply, applySystemDelta, buildDependencyGraph, canonicalEqual, compareUnicodeCodePoints, compute, computeSync, createContext, createCore, createError, createFlowState, createInitialSystemState, createIntent, createSnapshot, createTraceContext, createTraceNode, detectCycles, err, evaluateComputed, evaluateExpr, evaluateFlow, evaluateFlowSync, evaluateSingleComputed, explain, extractDefaults, fromCanonical, generateRequirementId, generateRequirementIdSync, generateTraceId, getByPatchPath, getByPath, getTransitiveDeps, hasPath, hashSchema, hashSchemaEffective, hashSchemaEffectiveSync, hashSchemaSync, indexSegment, invalidResult, isErr, isErrorValue, isOk, isSafePatchPath, joinPath, lastSegment, mergeAtPatchPath, mergeAtPath, mergePatch, ok, parentPath, parsePath, patchPathToDisplayString, propSegment, semanticPathToPatchPath, setByPatchPath, setByPath, setPatch, sha256, sha256Sync, sortKeys, toCanonical, toJcs, topologicalSort, unsetByPatchPath, unsetByPath, unsetPatch, validResult, validate, withCollectionContext, withNodePath, withSnapshot };
package/dist/index.js CHANGED
@@ -14891,7 +14891,8 @@ function evaluateAppend(array2, items, ctx) {
14891
14891
  }
14892
14892
  function evaluateObject(fields, ctx) {
14893
14893
  const result = {};
14894
- for (const [key, valueExpr] of Object.entries(fields)) {
14894
+ for (const key of Object.keys(fields).sort(compareUnicodeCodePoints)) {
14895
+ const valueExpr = fields[key];
14895
14896
  const valueResult = evaluateExpr(valueExpr, ctx);
14896
14897
  if (!valueResult.ok) return valueResult;
14897
14898
  result[key] = valueResult.value;
@@ -14910,21 +14911,25 @@ function evaluateKeys(obj, ctx) {
14910
14911
  if (!result.ok) return result;
14911
14912
  const value = result.value;
14912
14913
  if (typeof value !== "object" || value === null) return ok([]);
14913
- return ok(Object.keys(value));
14914
+ return ok(Object.keys(value).sort(compareUnicodeCodePoints));
14914
14915
  }
14915
14916
  function evaluateValues(obj, ctx) {
14916
14917
  const result = evaluateExpr(obj, ctx);
14917
14918
  if (!result.ok) return result;
14918
14919
  const value = result.value;
14919
14920
  if (typeof value !== "object" || value === null) return ok([]);
14920
- return ok(Object.values(value));
14921
+ return ok(
14922
+ Object.keys(value).sort(compareUnicodeCodePoints).map((key) => value[key])
14923
+ );
14921
14924
  }
14922
14925
  function evaluateEntries(obj, ctx) {
14923
14926
  const result = evaluateExpr(obj, ctx);
14924
14927
  if (!result.ok) return result;
14925
14928
  const value = result.value;
14926
14929
  if (typeof value !== "object" || value === null) return ok([]);
14927
- return ok(Object.entries(value));
14930
+ return ok(
14931
+ Object.keys(value).sort(compareUnicodeCodePoints).map((key) => [key, value[key]])
14932
+ );
14928
14933
  }
14929
14934
  function evaluateMerge(objects, ctx) {
14930
14935
  const merged = {};
@@ -17988,6 +17993,24 @@ function validateStateDefaults(state, basePath) {
17988
17993
  path
17989
17994
  });
17990
17995
  }
17996
+ if (spec.default !== void 0) {
17997
+ if (spec.default === null && spec.required !== false) {
17998
+ errors.push({
17999
+ code: "V-009",
18000
+ message: `Default value 'null' is not compatible with required field type '${typeof spec.type === "string" ? spec.type : "enum"}'`,
18001
+ path
18002
+ });
18003
+ } else if (spec.default !== null) {
18004
+ const typeCheck = validateValueAgainstFieldSpec(spec.default, spec);
18005
+ if (!typeCheck.ok) {
18006
+ errors.push({
18007
+ code: "V-009",
18008
+ message: `Default value type mismatch: ${typeCheck.message}`,
18009
+ path
18010
+ });
18011
+ }
18012
+ }
18013
+ }
17991
18014
  if (spec.type === "object" && spec.fields) {
17992
18015
  for (const [name, field] of Object.entries(spec.fields)) {
17993
18016
  visit(field, `${path}.${name}`);
@@ -18387,6 +18410,7 @@ export {
18387
18410
  applySystemDelta,
18388
18411
  buildDependencyGraph,
18389
18412
  canonicalEqual,
18413
+ compareUnicodeCodePoints,
18390
18414
  compute,
18391
18415
  computeSync,
18392
18416
  createContext,