@manifesto-ai/core 0.3.0 → 1.3.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.
Files changed (279) hide show
  1. package/README.md +148 -498
  2. package/dist/__tests__/apply.test.d.ts +2 -0
  3. package/dist/__tests__/apply.test.d.ts.map +1 -0
  4. package/dist/__tests__/apply.test.js +144 -0
  5. package/dist/__tests__/apply.test.js.map +1 -0
  6. package/dist/__tests__/jcs.test.d.ts +2 -0
  7. package/dist/__tests__/jcs.test.d.ts.map +1 -0
  8. package/dist/__tests__/jcs.test.js +45 -0
  9. package/dist/__tests__/jcs.test.js.map +1 -0
  10. package/dist/core/apply.d.ts +17 -0
  11. package/dist/core/apply.d.ts.map +1 -0
  12. package/dist/core/apply.js +130 -0
  13. package/dist/core/apply.js.map +1 -0
  14. package/dist/core/compute.d.ts +17 -0
  15. package/dist/core/compute.d.ts.map +1 -0
  16. package/dist/core/compute.js +287 -0
  17. package/dist/core/compute.js.map +1 -0
  18. package/dist/core/compute.test.d.ts +2 -0
  19. package/dist/core/compute.test.d.ts.map +1 -0
  20. package/dist/core/compute.test.js +633 -0
  21. package/dist/core/compute.test.js.map +1 -0
  22. package/dist/core/explain.d.ts +14 -0
  23. package/dist/core/explain.d.ts.map +1 -0
  24. package/dist/core/explain.js +78 -0
  25. package/dist/core/explain.js.map +1 -0
  26. package/dist/core/index.d.ts +5 -0
  27. package/dist/core/index.d.ts.map +1 -0
  28. package/dist/core/index.js +5 -0
  29. package/dist/core/index.js.map +1 -0
  30. package/dist/core/validate.d.ts +16 -0
  31. package/dist/core/validate.d.ts.map +1 -0
  32. package/dist/core/validate.js +361 -0
  33. package/dist/core/validate.js.map +1 -0
  34. package/dist/core/validate.test.d.ts +2 -0
  35. package/dist/core/validate.test.d.ts.map +1 -0
  36. package/dist/core/validate.test.js +638 -0
  37. package/dist/core/validate.test.js.map +1 -0
  38. package/dist/core/validation-utils.d.ts +20 -0
  39. package/dist/core/validation-utils.d.ts.map +1 -0
  40. package/dist/core/validation-utils.js +289 -0
  41. package/dist/core/validation-utils.js.map +1 -0
  42. package/dist/errors.d.ts +30 -0
  43. package/dist/errors.d.ts.map +1 -0
  44. package/dist/errors.js +51 -0
  45. package/dist/errors.js.map +1 -0
  46. package/dist/evaluator/computed.d.ts +14 -0
  47. package/dist/evaluator/computed.d.ts.map +1 -0
  48. package/dist/evaluator/computed.js +60 -0
  49. package/dist/evaluator/computed.js.map +1 -0
  50. package/dist/evaluator/context.d.ts +59 -0
  51. package/dist/evaluator/context.d.ts.map +1 -0
  52. package/dist/evaluator/context.js +41 -0
  53. package/dist/evaluator/context.js.map +1 -0
  54. package/dist/evaluator/dag.d.ts +30 -0
  55. package/dist/evaluator/dag.d.ts.map +1 -0
  56. package/dist/evaluator/dag.js +121 -0
  57. package/dist/evaluator/dag.js.map +1 -0
  58. package/dist/evaluator/expr.d.ts +11 -0
  59. package/dist/evaluator/expr.d.ts.map +1 -0
  60. package/dist/evaluator/expr.js +649 -0
  61. package/dist/evaluator/expr.js.map +1 -0
  62. package/dist/evaluator/expr.test.d.ts +2 -0
  63. package/dist/evaluator/expr.test.d.ts.map +1 -0
  64. package/dist/evaluator/expr.test.js +449 -0
  65. package/dist/evaluator/expr.test.js.map +1 -0
  66. package/dist/evaluator/flow.d.ts +35 -0
  67. package/dist/evaluator/flow.d.ts.map +1 -0
  68. package/dist/evaluator/flow.js +387 -0
  69. package/dist/evaluator/flow.js.map +1 -0
  70. package/dist/evaluator/flow.test.d.ts +2 -0
  71. package/dist/evaluator/flow.test.d.ts.map +1 -0
  72. package/dist/evaluator/flow.test.js +499 -0
  73. package/dist/evaluator/flow.test.js.map +1 -0
  74. package/dist/evaluator/index.d.ts +6 -0
  75. package/dist/evaluator/index.d.ts.map +1 -0
  76. package/dist/evaluator/index.js +6 -0
  77. package/dist/evaluator/index.js.map +1 -0
  78. package/dist/factories.d.ts +22 -0
  79. package/dist/factories.d.ts.map +1 -0
  80. package/dist/factories.js +44 -0
  81. package/dist/factories.js.map +1 -0
  82. package/dist/index.d.ts +47 -11
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +30 -45
  85. package/dist/index.js.map +1 -1
  86. package/dist/index.test.d.ts +2 -0
  87. package/dist/index.test.d.ts.map +1 -0
  88. package/dist/index.test.js +13 -0
  89. package/dist/index.test.js.map +1 -0
  90. package/dist/schema/action.d.ts +14 -0
  91. package/dist/schema/action.d.ts.map +1 -0
  92. package/dist/schema/action.js +30 -0
  93. package/dist/schema/action.js.map +1 -0
  94. package/dist/schema/common.d.ts +37 -0
  95. package/dist/schema/common.d.ts.map +1 -0
  96. package/dist/schema/common.js +20 -0
  97. package/dist/schema/common.js.map +1 -0
  98. package/dist/schema/computed.d.ts +23 -0
  99. package/dist/schema/computed.d.ts.map +1 -0
  100. package/dist/schema/computed.js +34 -0
  101. package/dist/schema/computed.js.map +1 -0
  102. package/dist/schema/domain.d.ts +50 -0
  103. package/dist/schema/domain.d.ts.map +1 -0
  104. package/dist/schema/domain.js +60 -0
  105. package/dist/schema/domain.js.map +1 -0
  106. package/dist/schema/expr.d.ts +303 -0
  107. package/dist/schema/expr.d.ts.map +1 -0
  108. package/dist/schema/expr.js +283 -0
  109. package/dist/schema/expr.js.map +1 -0
  110. package/dist/schema/field.d.ts +48 -0
  111. package/dist/schema/field.d.ts.map +1 -0
  112. package/dist/schema/field.js +31 -0
  113. package/dist/schema/field.js.map +1 -0
  114. package/dist/schema/flow.d.ts +103 -0
  115. package/dist/schema/flow.d.ts.map +1 -0
  116. package/dist/schema/flow.js +82 -0
  117. package/dist/schema/flow.js.map +1 -0
  118. package/dist/schema/host-context.d.ts +12 -0
  119. package/dist/schema/host-context.d.ts.map +1 -0
  120. package/dist/schema/host-context.js +23 -0
  121. package/dist/schema/host-context.js.map +1 -0
  122. package/dist/schema/index.d.ts +13 -2
  123. package/dist/schema/index.d.ts.map +1 -1
  124. package/dist/schema/index.js +25 -2
  125. package/dist/schema/index.js.map +1 -1
  126. package/dist/schema/patch.d.ts +59 -0
  127. package/dist/schema/patch.d.ts.map +1 -0
  128. package/dist/schema/patch.js +60 -0
  129. package/dist/schema/patch.js.map +1 -0
  130. package/dist/schema/result.d.ts +142 -0
  131. package/dist/schema/result.d.ts.map +1 -0
  132. package/dist/schema/result.js +94 -0
  133. package/dist/schema/result.js.map +1 -0
  134. package/dist/schema/snapshot.d.ts +153 -0
  135. package/dist/schema/snapshot.d.ts.map +1 -0
  136. package/dist/schema/snapshot.js +160 -0
  137. package/dist/schema/snapshot.js.map +1 -0
  138. package/dist/schema/trace.d.ts +98 -0
  139. package/dist/schema/trace.d.ts.map +1 -0
  140. package/dist/schema/trace.js +90 -0
  141. package/dist/schema/trace.js.map +1 -0
  142. package/dist/schema/type-spec.d.ts +34 -0
  143. package/dist/schema/type-spec.d.ts.map +1 -0
  144. package/dist/schema/type-spec.js +40 -0
  145. package/dist/schema/type-spec.js.map +1 -0
  146. package/dist/utils/canonical.d.ts +37 -0
  147. package/dist/utils/canonical.d.ts.map +1 -0
  148. package/dist/utils/canonical.js +122 -0
  149. package/dist/utils/canonical.js.map +1 -0
  150. package/dist/utils/canonical.test.d.ts +2 -0
  151. package/dist/utils/canonical.test.d.ts.map +1 -0
  152. package/dist/utils/canonical.test.js +183 -0
  153. package/dist/utils/canonical.test.js.map +1 -0
  154. package/dist/utils/hash.d.ts +28 -0
  155. package/dist/utils/hash.d.ts.map +1 -0
  156. package/dist/utils/hash.js +152 -0
  157. package/dist/utils/hash.js.map +1 -0
  158. package/dist/utils/hash.test.d.ts +2 -0
  159. package/dist/utils/hash.test.d.ts.map +1 -0
  160. package/dist/utils/hash.test.js +170 -0
  161. package/dist/utils/hash.test.js.map +1 -0
  162. package/dist/utils/index.d.ts +4 -0
  163. package/dist/utils/index.d.ts.map +1 -0
  164. package/dist/utils/index.js +4 -0
  165. package/dist/utils/index.js.map +1 -0
  166. package/dist/utils/path.d.ts +40 -0
  167. package/dist/utils/path.d.ts.map +1 -0
  168. package/dist/utils/path.js +132 -0
  169. package/dist/utils/path.js.map +1 -0
  170. package/dist/utils/path.test.d.ts +2 -0
  171. package/dist/utils/path.test.d.ts.map +1 -0
  172. package/dist/utils/path.test.js +191 -0
  173. package/dist/utils/path.test.js.map +1 -0
  174. package/package.json +28 -41
  175. package/LICENSE +0 -21
  176. package/dist/dag/graph.d.ts +0 -62
  177. package/dist/dag/graph.d.ts.map +0 -1
  178. package/dist/dag/graph.js +0 -244
  179. package/dist/dag/graph.js.map +0 -1
  180. package/dist/dag/index.d.ts +0 -4
  181. package/dist/dag/index.d.ts.map +0 -1
  182. package/dist/dag/index.js +0 -4
  183. package/dist/dag/index.js.map +0 -1
  184. package/dist/dag/propagation.d.ts +0 -58
  185. package/dist/dag/propagation.d.ts.map +0 -1
  186. package/dist/dag/propagation.js +0 -224
  187. package/dist/dag/propagation.js.map +0 -1
  188. package/dist/dag/topological.d.ts +0 -33
  189. package/dist/dag/topological.d.ts.map +0 -1
  190. package/dist/dag/topological.js +0 -173
  191. package/dist/dag/topological.js.map +0 -1
  192. package/dist/domain/define.d.ts +0 -82
  193. package/dist/domain/define.d.ts.map +0 -1
  194. package/dist/domain/define.js +0 -105
  195. package/dist/domain/define.js.map +0 -1
  196. package/dist/domain/index.d.ts +0 -4
  197. package/dist/domain/index.d.ts.map +0 -1
  198. package/dist/domain/index.js +0 -4
  199. package/dist/domain/index.js.map +0 -1
  200. package/dist/domain/types.d.ts +0 -203
  201. package/dist/domain/types.d.ts.map +0 -1
  202. package/dist/domain/types.js +0 -2
  203. package/dist/domain/types.js.map +0 -1
  204. package/dist/domain/validate.d.ts +0 -17
  205. package/dist/domain/validate.d.ts.map +0 -1
  206. package/dist/domain/validate.js +0 -204
  207. package/dist/domain/validate.js.map +0 -1
  208. package/dist/effect/index.d.ts +0 -4
  209. package/dist/effect/index.d.ts.map +0 -1
  210. package/dist/effect/index.js +0 -4
  211. package/dist/effect/index.js.map +0 -1
  212. package/dist/effect/result.d.ts +0 -100
  213. package/dist/effect/result.d.ts.map +0 -1
  214. package/dist/effect/result.js +0 -163
  215. package/dist/effect/result.js.map +0 -1
  216. package/dist/effect/runner.d.ts +0 -98
  217. package/dist/effect/runner.d.ts.map +0 -1
  218. package/dist/effect/runner.js +0 -321
  219. package/dist/effect/runner.js.map +0 -1
  220. package/dist/effect/types.d.ts +0 -169
  221. package/dist/effect/types.d.ts.map +0 -1
  222. package/dist/effect/types.js +0 -28
  223. package/dist/effect/types.js.map +0 -1
  224. package/dist/expression/analyzer.d.ts +0 -42
  225. package/dist/expression/analyzer.d.ts.map +0 -1
  226. package/dist/expression/analyzer.js +0 -166
  227. package/dist/expression/analyzer.js.map +0 -1
  228. package/dist/expression/evaluator.d.ts +0 -16
  229. package/dist/expression/evaluator.d.ts.map +0 -1
  230. package/dist/expression/evaluator.js +0 -382
  231. package/dist/expression/evaluator.js.map +0 -1
  232. package/dist/expression/index.d.ts +0 -5
  233. package/dist/expression/index.d.ts.map +0 -1
  234. package/dist/expression/index.js +0 -5
  235. package/dist/expression/index.js.map +0 -1
  236. package/dist/expression/parser.d.ts +0 -37
  237. package/dist/expression/parser.d.ts.map +0 -1
  238. package/dist/expression/parser.js +0 -201
  239. package/dist/expression/parser.js.map +0 -1
  240. package/dist/expression/types.d.ts +0 -123
  241. package/dist/expression/types.d.ts.map +0 -1
  242. package/dist/expression/types.js +0 -10
  243. package/dist/expression/types.js.map +0 -1
  244. package/dist/policy/field-policy.d.ts +0 -63
  245. package/dist/policy/field-policy.d.ts.map +0 -1
  246. package/dist/policy/field-policy.js +0 -138
  247. package/dist/policy/field-policy.js.map +0 -1
  248. package/dist/policy/index.d.ts +0 -3
  249. package/dist/policy/index.d.ts.map +0 -1
  250. package/dist/policy/index.js +0 -3
  251. package/dist/policy/index.js.map +0 -1
  252. package/dist/policy/precondition.d.ts +0 -58
  253. package/dist/policy/precondition.d.ts.map +0 -1
  254. package/dist/policy/precondition.js +0 -115
  255. package/dist/policy/precondition.js.map +0 -1
  256. package/dist/runtime/index.d.ts +0 -4
  257. package/dist/runtime/index.d.ts.map +0 -1
  258. package/dist/runtime/index.js +0 -4
  259. package/dist/runtime/index.js.map +0 -1
  260. package/dist/runtime/runtime.d.ts +0 -94
  261. package/dist/runtime/runtime.d.ts.map +0 -1
  262. package/dist/runtime/runtime.js +0 -294
  263. package/dist/runtime/runtime.js.map +0 -1
  264. package/dist/runtime/snapshot.d.ts +0 -39
  265. package/dist/runtime/snapshot.d.ts.map +0 -1
  266. package/dist/runtime/snapshot.js +0 -264
  267. package/dist/runtime/snapshot.js.map +0 -1
  268. package/dist/runtime/subscription.d.ts +0 -82
  269. package/dist/runtime/subscription.d.ts.map +0 -1
  270. package/dist/runtime/subscription.js +0 -222
  271. package/dist/runtime/subscription.js.map +0 -1
  272. package/dist/schema/integration.d.ts +0 -89
  273. package/dist/schema/integration.d.ts.map +0 -1
  274. package/dist/schema/integration.js +0 -171
  275. package/dist/schema/integration.js.map +0 -1
  276. package/dist/schema/validation.d.ts +0 -51
  277. package/dist/schema/validation.d.ts.map +0 -1
  278. package/dist/schema/validation.js +0 -212
  279. package/dist/schema/validation.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,17 +1,53 @@
1
1
  /**
2
2
  * @manifesto-ai/core
3
3
  *
4
- * AI Native Semantic Layer for SaaS Business Logic
4
+ * Manifesto Core - A Pure Semantic Calculator for Domain State
5
5
  *
6
- * Manifesto는 SaaS 비즈니스 로직을 의미론적 주소 공간(Semantic Path Space)으로 선언하여,
7
- * AI Agent가 UI를 이해하고 안전하게 조작할 수 있게 하는 AI Native Semantic Layer입니다.
6
+ * Core computes. Host executes. These concerns never mix.
8
7
  */
9
- export { type SemanticPath, type SemanticMeta, type ConditionRef, type FieldPolicy, type SourceDefinition, type DerivedDefinition, type AsyncDefinition, type ActionDefinition, type ActionSemanticMeta, type PathDefinitions, type DomainMeta, type ManifestoDomain, type ValidationIssue, type ValidationResult, defineDomain, defineSource, defineDerived, defineAsync, defineAction, fieldPolicy, condition, validateDomain, } from './domain/index.js';
10
- export { type Expression, type EvaluationContext, type LiteralExpr, type GetExpr, type ComparisonExpr, type LogicalExpr, type ArithmeticExpr, type ConditionalExpr, type StringFn, type ArrayFn, type NumberFn, type ObjectFn, type TypeFn, type DateFn, isValidExpression, isGetExpr, extractPaths, stringifyExpression, parseExpression, expressionToString, evaluate, type EvalResult, analyzeExpression, isPureExpression, isConstantExpression, areExpressionsEqual, optimizeExpression, substitutePathWithValue, type DependencyAnalysis, } from './expression/index.js';
11
- export { type Effect, type SetValueEffect, type SetStateEffect, type ApiCallEffect, type NavigateEffect, type DelayEffect, type SequenceEffect, type ParallelEffect, type ConditionalEffect, type CatchEffect, type EmitEventEffect, type EffectTag, isEffect, isEffectOfType, type Result, type EffectError, ok, err, effectError, isOk, isErr, unwrap, unwrapOr, unwrapErr, map, mapErr, flatMap, flatten, all, any, fromPromise, tryCatch, runEffect, setValue, setState, apiCall, navigate, delay, sequence, parallel, conditional, catchEffect, emitEvent, type EffectHandler, type EffectRunnerConfig, type EffectResult, } from './effect/index.js';
12
- export { type DependencyGraph, type DagNode, type SourceNode, type DerivedNode, type AsyncNode, buildDependencyGraph, getDirectDependencies, getDirectDependents, getAllDependencies, getAllDependents, hasCycle, findPath, topologicalSortWithCycleDetection, getLevelOrder, reverseTopologicalSort, partialTopologicalSort, getAffectedOrder, type TopologicalSortResult, propagate, propagateAsyncResult, analyzeImpact, createDebouncedPropagator, type PropagationResult, type SnapshotLike, } from './dag/index.js';
13
- export { type DomainSnapshot, createSnapshot, cloneSnapshot, getValueByPath, setValueByPath, diffSnapshots, type SnapshotListener, type PathListener, type EventListener, type DomainEvent, type Unsubscribe, SubscriptionManager, createBatchNotifier, type DomainRuntime, type PreconditionStatus, type ResolvedFieldPolicy, type ExplanationTree, type ValidationError, type CreateRuntimeOptions, createRuntime, } from './runtime/index.js';
14
- export { evaluatePrecondition, evaluateAllPreconditions, checkActionAvailability, extractPreconditionDependencies, analyzePreconditionRequirements, type PreconditionEvaluationResult, type ActionAvailability, evaluateFieldPolicy, policyToUIState, extractFieldPolicyDependencies, evaluateMultipleFieldPolicies, explainFieldPolicy, type FieldPolicyEvaluation, type ConditionEvaluationDetail, type FieldUIState, } from './policy/index.js';
15
- export { schemaToSource, CommonSchemas, SchemaUtils, getSchemaDefault, getSchemaMetadata, toJsonSchema, zodErrorToValidationResult, validateValue, validatePartial, validateDomainData, validateFields, validateAsync, mergeValidationResults, groupValidationByPath, filterBySeverity, getErrors, getWarnings, getSuggestions, } from './schema/index.js';
16
- export { z } from 'zod';
8
+ import type { DomainSchema } from "./schema/domain.js";
9
+ import type { Snapshot } from "./schema/snapshot.js";
10
+ import type { Intent, Patch } from "./schema/patch.js";
11
+ import type { SemanticPath } from "./schema/common.js";
12
+ import type { ComputeResult, ValidationResult, ExplainResult } from "./schema/result.js";
13
+ import type { HostContext } from "./schema/host-context.js";
14
+ import { compute } from "./core/compute.js";
15
+ import { apply } from "./core/apply.js";
16
+ import { validate } from "./core/validate.js";
17
+ import { explain } from "./core/explain.js";
18
+ /**
19
+ * ManifestoCore interface
20
+ */
21
+ export interface ManifestoCore {
22
+ /**
23
+ * Compute the result of dispatching an intent.
24
+ *
25
+ * This is the ONLY entry point for computation.
26
+ * Each call is independent - there is no suspended context.
27
+ */
28
+ compute(schema: DomainSchema, snapshot: Snapshot, intent: Intent, context: HostContext): Promise<ComputeResult>;
29
+ /**
30
+ * Apply patches to a snapshot.
31
+ * Returns new snapshot with recomputed values.
32
+ */
33
+ apply(schema: DomainSchema, snapshot: Snapshot, patches: readonly Patch[], context: HostContext): Snapshot;
34
+ /**
35
+ * Validate a schema.
36
+ */
37
+ validate(schema: unknown): ValidationResult;
38
+ /**
39
+ * Explain why a value is what it is.
40
+ */
41
+ explain(schema: DomainSchema, snapshot: Snapshot, path: SemanticPath): ExplainResult;
42
+ }
43
+ /**
44
+ * Create a ManifestoCore instance
45
+ */
46
+ export declare function createCore(): ManifestoCore;
47
+ export * from "./schema/index.js";
48
+ export * from "./utils/index.js";
49
+ export * from "./evaluator/index.js";
50
+ export * from "./errors.js";
51
+ export * from "./factories.js";
52
+ export { compute, apply, validate, explain };
17
53
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EAErB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EAET,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,MAAM,EAEX,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAElB,QAAQ,EACR,KAAK,UAAU,EAEf,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,kBAAkB,GACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,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AAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,OAAO,CACL,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,aAAa,CAAC,CAAC;IAE1B;;;OAGG;IACH,KAAK,CACH,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,WAAW,GACnB,QAAQ,CAAC;IAEZ;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,CAAC;IAE5C;;OAEG;IACH,OAAO,CACL,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,YAAY,GACjB,aAAa,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,aAAa,CAO1C;AAKD,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,51 +1,36 @@
1
1
  /**
2
2
  * @manifesto-ai/core
3
3
  *
4
- * AI Native Semantic Layer for SaaS Business Logic
4
+ * Manifesto Core - A Pure Semantic Calculator for Domain State
5
5
  *
6
- * Manifesto는 SaaS 비즈니스 로직을 의미론적 주소 공간(Semantic Path Space)으로 선언하여,
7
- * AI Agent가 UI를 이해하고 안전하게 조작할 수 있게 하는 AI Native Semantic Layer입니다.
6
+ * Core computes. Host executes. These concerns never mix.
8
7
  */
9
- // Domain - 도메인 정의 및 타입
10
- export {
11
- // Helpers
12
- defineDomain, defineSource, defineDerived, defineAsync, defineAction, fieldPolicy, condition,
13
- // Validation
14
- validateDomain, } from './domain/index.js';
15
- // Expression - DSL 표현식
16
- export {
17
- // Parser
18
- isValidExpression, isGetExpr, extractPaths, stringifyExpression, parseExpression, expressionToString,
19
- // Evaluator
20
- evaluate,
21
- // Analyzer
22
- analyzeExpression, isPureExpression, isConstantExpression, areExpressionsEqual, optimizeExpression, substitutePathWithValue, } from './expression/index.js';
23
- // Effect - 부수효과 시스템
24
- export { isEffect, isEffectOfType, ok, err, effectError, isOk, isErr, unwrap, unwrapOr, unwrapErr, map, mapErr, flatMap, flatten, all, any, fromPromise, tryCatch,
25
- // Runner
26
- runEffect, setValue, setState, apiCall, navigate, delay, sequence, parallel, conditional, catchEffect, emitEvent, } from './effect/index.js';
27
- // DAG - 의존성 그래프
28
- export {
29
- // Graph
30
- buildDependencyGraph, getDirectDependencies, getDirectDependents, getAllDependencies, getAllDependents, hasCycle, findPath,
31
- // Topological
32
- topologicalSortWithCycleDetection, getLevelOrder, reverseTopologicalSort, partialTopologicalSort, getAffectedOrder,
33
- // Propagation
34
- propagate, propagateAsyncResult, analyzeImpact, createDebouncedPropagator, } from './dag/index.js';
35
- // Runtime - 도메인 실행 엔진
36
- export { createSnapshot, cloneSnapshot, getValueByPath, setValueByPath, diffSnapshots, SubscriptionManager, createBatchNotifier, createRuntime, } from './runtime/index.js';
37
- // Policy - 정책 평가
38
- export {
39
- // Precondition
40
- evaluatePrecondition, evaluateAllPreconditions, checkActionAvailability, extractPreconditionDependencies, analyzePreconditionRequirements,
41
- // Field Policy
42
- evaluateFieldPolicy, policyToUIState, extractFieldPolicyDependencies, evaluateMultipleFieldPolicies, explainFieldPolicy, } from './policy/index.js';
43
- // Schema - Zod 통합
44
- export {
45
- // Integration
46
- schemaToSource, CommonSchemas, SchemaUtils, getSchemaDefault, getSchemaMetadata, toJsonSchema,
47
- // Validation
48
- zodErrorToValidationResult, validateValue, validatePartial, validateDomainData, validateFields, validateAsync, mergeValidationResults, groupValidationByPath, filterBySeverity, getErrors, getWarnings, getSuggestions, } from './schema/index.js';
49
- // Re-export Zod for convenience
50
- export { z } from 'zod';
8
+ import { compute } from "./core/compute.js";
9
+ import { apply } from "./core/apply.js";
10
+ import { validate } from "./core/validate.js";
11
+ import { explain } from "./core/explain.js";
12
+ /**
13
+ * Create a ManifestoCore instance
14
+ */
15
+ export function createCore() {
16
+ return {
17
+ compute,
18
+ apply,
19
+ validate,
20
+ explain,
21
+ };
22
+ }
23
+ // ============ Re-exports ============
24
+ // Schema types
25
+ export * from "./schema/index.js";
26
+ // Utilities
27
+ export * from "./utils/index.js";
28
+ // Evaluators (for advanced usage)
29
+ export * from "./evaluator/index.js";
30
+ // Errors
31
+ export * from "./errors.js";
32
+ // Factories
33
+ export * from "./factories.js";
34
+ // Core functions (for direct usage)
35
+ export { compute, apply, validate, explain };
51
36
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uBAAuB;AACvB,OAAO;AAgBL,UAAU;AACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS;AACT,aAAa;AACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,uBAAuB;AACvB,OAAO;AAgBL,SAAS;AACT,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,kBAAkB;AAClB,YAAY;AACZ,QAAQ;AAER,WAAW;AACX,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GAExB,MAAM,uBAAuB,CAAC;AAE/B,oBAAoB;AACpB,OAAO,EAcL,QAA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AAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,gCAAgC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AA6C5C;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,OAAO;QACP,KAAK;QACL,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC;AAED,uCAAuC;AAEvC,eAAe;AACf,cAAc,mBAAmB,CAAC;AAElC,YAAY;AACZ,cAAc,kBAAkB,CAAC;AAEjC,kCAAkC;AAClC,cAAc,sBAAsB,CAAC;AAErC,SAAS;AACT,cAAc,aAAa,CAAC;AAE5B,YAAY;AACZ,cAAc,gBAAgB,CAAC;AAE/B,oCAAoC;AACpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { createCore } from "./index.js";
3
+ describe("core", () => {
4
+ it("should create a ManifestoCore instance", () => {
5
+ const core = createCore();
6
+ expect(core).toBeDefined();
7
+ expect(core.compute).toBeInstanceOf(Function);
8
+ expect(core.apply).toBeInstanceOf(Function);
9
+ expect(core.validate).toBeInstanceOf(Function);
10
+ expect(core.explain).toBeInstanceOf(Function);
11
+ });
12
+ });
13
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import { FieldSpec } from "./field.js";
3
+ /**
4
+ * ActionSpec - Maps intents to flows
5
+ * An action defines what happens when a particular intent is dispatched.
6
+ */
7
+ export declare const ActionSpec: z.ZodObject<{
8
+ flow: z.ZodType<import("./flow.js").FlowNode, unknown, z.core.$ZodTypeInternals<import("./flow.js").FlowNode, unknown>>;
9
+ input: z.ZodOptional<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
10
+ available: z.ZodOptional<z.ZodType<import("./expr.js").ExprNode, unknown, z.core.$ZodTypeInternals<import("./expr.js").ExprNode, unknown>>>;
11
+ description: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type ActionSpec = z.infer<typeof ActionSpec>;
14
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schema/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;iBAuBrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ import { FieldSpec } from "./field.js";
3
+ import { ExprNodeSchema } from "./expr.js";
4
+ import { FlowNodeSchema } from "./flow.js";
5
+ /**
6
+ * ActionSpec - Maps intents to flows
7
+ * An action defines what happens when a particular intent is dispatched.
8
+ */
9
+ export const ActionSpec = z.object({
10
+ /**
11
+ * The flow to execute when this action is invoked
12
+ */
13
+ flow: FlowNodeSchema,
14
+ /**
15
+ * Input schema for validation.
16
+ * If defined, Core MUST validate input against this schema.
17
+ */
18
+ input: FieldSpec.optional(),
19
+ /**
20
+ * Availability condition.
21
+ * If defined, Core MUST check it before executing the flow.
22
+ * Expression MUST return boolean.
23
+ */
24
+ available: ExprNodeSchema.optional(),
25
+ /**
26
+ * Human-readable description
27
+ */
28
+ description: z.string().optional(),
29
+ });
30
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/schema/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC;;OAEG;IACH,IAAI,EAAE,cAAc;IAEpB;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC,QAAQ,EAAE;IAE3B;;;;OAIG;IACH,SAAS,EAAE,cAAc,CAAC,QAAQ,EAAE;IAEpC;;OAEG;IACH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Dot-separated path for accessing values (e.g., "user.profile.name")
4
+ */
5
+ export declare const SemanticPath: z.ZodString;
6
+ export type SemanticPath = z.infer<typeof SemanticPath>;
7
+ /**
8
+ * Result type for functions that can fail without throwing
9
+ */
10
+ export declare const Result: <T extends z.ZodTypeAny, E extends z.ZodTypeAny>(valueSchema: T, errorSchema: E) => z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ ok: z.ZodLiteral<true>;
12
+ value: T;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ ok: z.ZodLiteral<false>;
15
+ error: E;
16
+ }, z.core.$strip>], "ok">;
17
+ export type Result<T, E> = {
18
+ ok: true;
19
+ value: T;
20
+ } | {
21
+ ok: false;
22
+ error: E;
23
+ };
24
+ /**
25
+ * Helper functions for Result type
26
+ */
27
+ export declare const ok: <T>(value: T) => Result<T, never>;
28
+ export declare const err: <E>(error: E) => Result<never, E>;
29
+ export declare const isOk: <T, E>(result: Result<T, E>) => result is {
30
+ ok: true;
31
+ value: T;
32
+ };
33
+ export declare const isErr: <T, E>(result: Result<T, E>) => result is {
34
+ ok: false;
35
+ error: E;
36
+ };
37
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[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
+ */
5
+ export const SemanticPath = z.string().min(1);
6
+ /**
7
+ * Result type for functions that can fail without throwing
8
+ */
9
+ export const Result = (valueSchema, errorSchema) => z.discriminatedUnion("ok", [
10
+ z.object({ ok: z.literal(true), value: valueSchema }),
11
+ z.object({ ok: z.literal(false), error: errorSchema }),
12
+ ]);
13
+ /**
14
+ * Helper functions for Result type
15
+ */
16
+ export const ok = (value) => ({ ok: true, value });
17
+ export const err = (error) => ({ ok: false, error });
18
+ export const isOk = (result) => result.ok;
19
+ export const isErr = (result) => !result.ok;
20
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAG9C;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,WAAc,EACd,WAAc,EACd,EAAE,CACF,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE;IACzB,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACrD,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;CACvD,CAAC,CAAC;AAML;;GAEG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAI,KAAQ,EAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,GAAG,GAAG,CAAI,KAAQ,EAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,IAAI,GAAG,CAAO,MAAoB,EAAoC,EAAE,CACnF,MAAM,CAAC,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,KAAK,GAAG,CAAO,MAAoB,EAAqC,EAAE,CACrF,CAAC,MAAM,CAAC,EAAE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * ComputedFieldSpec - Definition of a single computed field
4
+ */
5
+ export declare const ComputedFieldSpec: z.ZodObject<{
6
+ deps: z.ZodArray<z.ZodString>;
7
+ expr: z.ZodType<import("./expr.js").ExprNode, unknown, z.core.$ZodTypeInternals<import("./expr.js").ExprNode, unknown>>;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ export type ComputedFieldSpec = z.infer<typeof ComputedFieldSpec>;
11
+ /**
12
+ * ComputedSpec - Collection of computed field definitions
13
+ * Computed values form a Directed Acyclic Graph (DAG).
14
+ */
15
+ export declare const ComputedSpec: z.ZodObject<{
16
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
17
+ deps: z.ZodArray<z.ZodString>;
18
+ expr: z.ZodType<import("./expr.js").ExprNode, unknown, z.core.$ZodTypeInternals<import("./expr.js").ExprNode, unknown>>;
19
+ description: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>;
21
+ }, z.core.$strip>;
22
+ export type ComputedSpec = z.infer<typeof ComputedSpec>;
23
+ //# sourceMappingURL=computed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../src/schema/computed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;iBAiB5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;iBAMvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ import { SemanticPath } from "./common.js";
3
+ import { ExprNodeSchema } from "./expr.js";
4
+ /**
5
+ * ComputedFieldSpec - Definition of a single computed field
6
+ */
7
+ export const ComputedFieldSpec = z.object({
8
+ /**
9
+ * Paths this computed value depends on.
10
+ * Must accurately reflect all paths referenced in expr.
11
+ */
12
+ deps: z.array(SemanticPath),
13
+ /**
14
+ * Expression to compute the value.
15
+ * Must be pure and total (always produce a value, never throw).
16
+ */
17
+ expr: ExprNodeSchema,
18
+ /**
19
+ * Human-readable description
20
+ */
21
+ description: z.string().optional(),
22
+ });
23
+ /**
24
+ * ComputedSpec - Collection of computed field definitions
25
+ * Computed values form a Directed Acyclic Graph (DAG).
26
+ */
27
+ export const ComputedSpec = z.object({
28
+ /**
29
+ * Computed field definitions keyed by their semantic path.
30
+ * Paths typically start with "computed." prefix.
31
+ */
32
+ fields: z.record(SemanticPath, ComputedFieldSpec),
33
+ });
34
+ //# sourceMappingURL=computed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computed.js","sourceRoot":"","sources":["../../src/schema/computed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC;;;OAGG;IACH,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;IAE3B;;;OAGG;IACH,IAAI,EAAE,cAAc;IAEpB;;OAEG;IACH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC;;;OAGG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAAC;CAClD,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Schema metadata
4
+ */
5
+ export declare const SchemaMeta: z.ZodObject<{
6
+ name: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodOptional<z.ZodString>;
8
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
+ }, z.core.$strip>;
10
+ export type SchemaMeta = z.infer<typeof SchemaMeta>;
11
+ /**
12
+ * DomainSchema - Complete schema definition
13
+ *
14
+ * Defines:
15
+ * - What the domain looks like (StateSpec)
16
+ * - What can be derived (ComputedSpec)
17
+ * - How state transitions occur (Actions → FlowSpec)
18
+ */
19
+ export declare const DomainSchema: z.ZodObject<{
20
+ id: z.ZodString;
21
+ version: z.ZodString;
22
+ hash: z.ZodString;
23
+ types: z.ZodRecord<z.ZodString, z.ZodObject<{
24
+ name: z.ZodString;
25
+ definition: z.ZodType<import("./type-spec.js").TypeDefinition, unknown, z.core.$ZodTypeInternals<import("./type-spec.js").TypeDefinition, unknown>>;
26
+ }, z.core.$strip>>;
27
+ state: z.ZodObject<{
28
+ fields: z.ZodRecord<z.ZodString, z.ZodType<import("./field.js").FieldSpec, unknown, z.core.$ZodTypeInternals<import("./field.js").FieldSpec, unknown>>>;
29
+ }, z.core.$strip>;
30
+ computed: z.ZodObject<{
31
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
32
+ deps: z.ZodArray<z.ZodString>;
33
+ expr: z.ZodType<import("./expr.js").ExprNode, unknown, z.core.$ZodTypeInternals<import("./expr.js").ExprNode, unknown>>;
34
+ description: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>>;
36
+ }, z.core.$strip>;
37
+ actions: z.ZodRecord<z.ZodString, z.ZodObject<{
38
+ flow: z.ZodType<import("./flow.js").FlowNode, unknown, z.core.$ZodTypeInternals<import("./flow.js").FlowNode, unknown>>;
39
+ input: z.ZodOptional<z.ZodType<import("./field.js").FieldSpec, unknown, z.core.$ZodTypeInternals<import("./field.js").FieldSpec, unknown>>>;
40
+ available: z.ZodOptional<z.ZodType<import("./expr.js").ExprNode, unknown, z.core.$ZodTypeInternals<import("./expr.js").ExprNode, unknown>>>;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strip>>;
43
+ meta: z.ZodOptional<z.ZodObject<{
44
+ name: z.ZodOptional<z.ZodString>;
45
+ description: z.ZodOptional<z.ZodString>;
46
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
+ }, z.core.$strip>>;
48
+ }, z.core.$strip>;
49
+ export type DomainSchema = z.infer<typeof DomainSchema>;
50
+ //# sourceMappingURL=domain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/schema/domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,UAAU;;;;iBAIrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4CvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ import { StateSpec } from "./field.js";
3
+ import { ComputedSpec } from "./computed.js";
4
+ import { ActionSpec } from "./action.js";
5
+ import { TypeSpec } from "./type-spec.js";
6
+ /**
7
+ * Schema metadata
8
+ */
9
+ export const SchemaMeta = z.object({
10
+ name: z.string().optional(),
11
+ description: z.string().optional(),
12
+ authors: z.array(z.string()).optional(),
13
+ });
14
+ /**
15
+ * DomainSchema - Complete schema definition
16
+ *
17
+ * Defines:
18
+ * - What the domain looks like (StateSpec)
19
+ * - What can be derived (ComputedSpec)
20
+ * - How state transitions occur (Actions → FlowSpec)
21
+ */
22
+ export const DomainSchema = z.object({
23
+ /**
24
+ * Unique identifier for this schema.
25
+ * MUST be a valid URI or UUID.
26
+ */
27
+ id: z.string(),
28
+ /**
29
+ * Semantic version.
30
+ * MUST follow Semantic Versioning 2.0.
31
+ */
32
+ version: z.string(),
33
+ /**
34
+ * Content hash for integrity verification.
35
+ * MUST be computed using the Canonical Form algorithm.
36
+ */
37
+ hash: z.string(),
38
+ /**
39
+ * Named type declarations (compiler v0.3.3).
40
+ * Pure metadata; Core does not interpret these.
41
+ */
42
+ types: z.record(z.string(), TypeSpec),
43
+ /**
44
+ * State structure definition
45
+ */
46
+ state: StateSpec,
47
+ /**
48
+ * Computed values (DAG)
49
+ */
50
+ computed: ComputedSpec,
51
+ /**
52
+ * Intent-to-Flow mappings
53
+ */
54
+ actions: z.record(z.string(), ActionSpec),
55
+ /**
56
+ * Schema metadata
57
+ */
58
+ meta: SchemaMeta.optional(),
59
+ });
60
+ //# sourceMappingURL=domain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.js","sourceRoot":"","sources":["../../src/schema/domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,C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