@manifesto-ai/core 0.2.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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +434 -0
  3. package/dist/dag/graph.d.ts +62 -0
  4. package/dist/dag/graph.d.ts.map +1 -0
  5. package/dist/dag/graph.js +244 -0
  6. package/dist/dag/graph.js.map +1 -0
  7. package/dist/dag/index.d.ts +4 -0
  8. package/dist/dag/index.d.ts.map +1 -0
  9. package/dist/dag/index.js +4 -0
  10. package/dist/dag/index.js.map +1 -0
  11. package/dist/dag/propagation.d.ts +58 -0
  12. package/dist/dag/propagation.d.ts.map +1 -0
  13. package/dist/dag/propagation.js +224 -0
  14. package/dist/dag/propagation.js.map +1 -0
  15. package/dist/dag/topological.d.ts +33 -0
  16. package/dist/dag/topological.d.ts.map +1 -0
  17. package/dist/dag/topological.js +173 -0
  18. package/dist/dag/topological.js.map +1 -0
  19. package/dist/domain/define.d.ts +82 -0
  20. package/dist/domain/define.d.ts.map +1 -0
  21. package/dist/domain/define.js +91 -0
  22. package/dist/domain/define.js.map +1 -0
  23. package/dist/domain/index.d.ts +4 -0
  24. package/dist/domain/index.d.ts.map +1 -0
  25. package/dist/domain/index.js +4 -0
  26. package/dist/domain/index.js.map +1 -0
  27. package/dist/domain/types.d.ts +203 -0
  28. package/dist/domain/types.d.ts.map +1 -0
  29. package/dist/domain/types.js +2 -0
  30. package/dist/domain/types.js.map +1 -0
  31. package/dist/domain/validate.d.ts +17 -0
  32. package/dist/domain/validate.d.ts.map +1 -0
  33. package/dist/domain/validate.js +204 -0
  34. package/dist/domain/validate.js.map +1 -0
  35. package/dist/effect/index.d.ts +4 -0
  36. package/dist/effect/index.d.ts.map +1 -0
  37. package/dist/effect/index.js +4 -0
  38. package/dist/effect/index.js.map +1 -0
  39. package/dist/effect/result.d.ts +100 -0
  40. package/dist/effect/result.d.ts.map +1 -0
  41. package/dist/effect/result.js +163 -0
  42. package/dist/effect/result.js.map +1 -0
  43. package/dist/effect/runner.d.ts +98 -0
  44. package/dist/effect/runner.d.ts.map +1 -0
  45. package/dist/effect/runner.js +321 -0
  46. package/dist/effect/runner.js.map +1 -0
  47. package/dist/effect/types.d.ts +169 -0
  48. package/dist/effect/types.d.ts.map +1 -0
  49. package/dist/effect/types.js +28 -0
  50. package/dist/effect/types.js.map +1 -0
  51. package/dist/expression/analyzer.d.ts +42 -0
  52. package/dist/expression/analyzer.d.ts.map +1 -0
  53. package/dist/expression/analyzer.js +166 -0
  54. package/dist/expression/analyzer.js.map +1 -0
  55. package/dist/expression/evaluator.d.ts +16 -0
  56. package/dist/expression/evaluator.d.ts.map +1 -0
  57. package/dist/expression/evaluator.js +382 -0
  58. package/dist/expression/evaluator.js.map +1 -0
  59. package/dist/expression/index.d.ts +5 -0
  60. package/dist/expression/index.d.ts.map +1 -0
  61. package/dist/expression/index.js +5 -0
  62. package/dist/expression/index.js.map +1 -0
  63. package/dist/expression/parser.d.ts +37 -0
  64. package/dist/expression/parser.d.ts.map +1 -0
  65. package/dist/expression/parser.js +201 -0
  66. package/dist/expression/parser.js.map +1 -0
  67. package/dist/expression/types.d.ts +123 -0
  68. package/dist/expression/types.d.ts.map +1 -0
  69. package/dist/expression/types.js +10 -0
  70. package/dist/expression/types.js.map +1 -0
  71. package/dist/index.d.ts +17 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +51 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/policy/field-policy.d.ts +63 -0
  76. package/dist/policy/field-policy.d.ts.map +1 -0
  77. package/dist/policy/field-policy.js +138 -0
  78. package/dist/policy/field-policy.js.map +1 -0
  79. package/dist/policy/index.d.ts +3 -0
  80. package/dist/policy/index.d.ts.map +1 -0
  81. package/dist/policy/index.js +3 -0
  82. package/dist/policy/index.js.map +1 -0
  83. package/dist/policy/precondition.d.ts +58 -0
  84. package/dist/policy/precondition.d.ts.map +1 -0
  85. package/dist/policy/precondition.js +115 -0
  86. package/dist/policy/precondition.js.map +1 -0
  87. package/dist/runtime/index.d.ts +4 -0
  88. package/dist/runtime/index.d.ts.map +1 -0
  89. package/dist/runtime/index.js +4 -0
  90. package/dist/runtime/index.js.map +1 -0
  91. package/dist/runtime/runtime.d.ts +94 -0
  92. package/dist/runtime/runtime.d.ts.map +1 -0
  93. package/dist/runtime/runtime.js +294 -0
  94. package/dist/runtime/runtime.js.map +1 -0
  95. package/dist/runtime/snapshot.d.ts +39 -0
  96. package/dist/runtime/snapshot.d.ts.map +1 -0
  97. package/dist/runtime/snapshot.js +264 -0
  98. package/dist/runtime/snapshot.js.map +1 -0
  99. package/dist/runtime/subscription.d.ts +82 -0
  100. package/dist/runtime/subscription.d.ts.map +1 -0
  101. package/dist/runtime/subscription.js +222 -0
  102. package/dist/runtime/subscription.js.map +1 -0
  103. package/dist/schema/index.d.ts +3 -0
  104. package/dist/schema/index.d.ts.map +1 -0
  105. package/dist/schema/index.js +3 -0
  106. package/dist/schema/index.js.map +1 -0
  107. package/dist/schema/integration.d.ts +89 -0
  108. package/dist/schema/integration.d.ts.map +1 -0
  109. package/dist/schema/integration.js +171 -0
  110. package/dist/schema/integration.js.map +1 -0
  111. package/dist/schema/validation.d.ts +51 -0
  112. package/dist/schema/validation.d.ts.map +1 -0
  113. package/dist/schema/validation.js +212 -0
  114. package/dist/schema/validation.js.map +1 -0
  115. package/package.json +58 -0
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Expression 유효성 검사
3
+ */
4
+ export function isValidExpression(expr) {
5
+ if (expr === null)
6
+ return true;
7
+ if (typeof expr === 'string')
8
+ return true;
9
+ if (typeof expr === 'number')
10
+ return true;
11
+ if (typeof expr === 'boolean')
12
+ return true;
13
+ if (!Array.isArray(expr))
14
+ return false;
15
+ if (expr.length === 0)
16
+ return false;
17
+ const [op] = expr;
18
+ if (typeof op !== 'string')
19
+ return false;
20
+ return isValidOperator(op);
21
+ }
22
+ /**
23
+ * 유효한 연산자인지 확인
24
+ */
25
+ function isValidOperator(op) {
26
+ const validOperators = new Set([
27
+ // Value access
28
+ 'get',
29
+ // Comparison
30
+ '==',
31
+ '!=',
32
+ '>',
33
+ '>=',
34
+ '<',
35
+ '<=',
36
+ // Logical
37
+ '!',
38
+ 'all',
39
+ 'any',
40
+ // Arithmetic
41
+ '+',
42
+ '-',
43
+ '*',
44
+ '/',
45
+ '%',
46
+ // Conditional
47
+ 'case',
48
+ 'match',
49
+ 'coalesce',
50
+ // String
51
+ 'concat',
52
+ 'upper',
53
+ 'lower',
54
+ 'trim',
55
+ 'slice',
56
+ 'split',
57
+ 'join',
58
+ 'matches',
59
+ 'replace',
60
+ // Array
61
+ 'length',
62
+ 'at',
63
+ 'first',
64
+ 'last',
65
+ 'includes',
66
+ 'indexOf',
67
+ 'map',
68
+ 'filter',
69
+ 'every',
70
+ 'some',
71
+ 'reduce',
72
+ 'flatten',
73
+ 'unique',
74
+ 'sort',
75
+ 'reverse',
76
+ // Number
77
+ 'sum',
78
+ 'min',
79
+ 'max',
80
+ 'avg',
81
+ 'count',
82
+ 'round',
83
+ 'floor',
84
+ 'ceil',
85
+ 'abs',
86
+ 'clamp',
87
+ // Object
88
+ 'has',
89
+ 'keys',
90
+ 'values',
91
+ 'entries',
92
+ 'pick',
93
+ 'omit',
94
+ // Type
95
+ 'isNull',
96
+ 'isNumber',
97
+ 'isString',
98
+ 'isArray',
99
+ 'isObject',
100
+ 'toNumber',
101
+ 'toString',
102
+ // Date
103
+ 'now',
104
+ 'date',
105
+ 'year',
106
+ 'month',
107
+ 'day',
108
+ 'diff',
109
+ ]);
110
+ return validOperators.has(op);
111
+ }
112
+ /**
113
+ * Get 표현식인지 확인
114
+ */
115
+ export function isGetExpr(expr) {
116
+ return Array.isArray(expr) && expr.length === 2 && expr[0] === 'get';
117
+ }
118
+ /**
119
+ * Expression에서 모든 get 경로 추출
120
+ */
121
+ export function extractPaths(expr) {
122
+ const paths = [];
123
+ function traverse(e) {
124
+ if (e === null || typeof e !== 'object')
125
+ return;
126
+ if (!Array.isArray(e))
127
+ return;
128
+ const [op, ...args] = e;
129
+ if (op === 'get' && typeof args[0] === 'string') {
130
+ paths.push(args[0]);
131
+ return;
132
+ }
133
+ for (const arg of args) {
134
+ if (isValidExpression(arg)) {
135
+ traverse(arg);
136
+ }
137
+ }
138
+ }
139
+ traverse(expr);
140
+ return paths;
141
+ }
142
+ /**
143
+ * Expression을 JSON 문자열로 변환
144
+ */
145
+ export function stringifyExpression(expr) {
146
+ return JSON.stringify(expr);
147
+ }
148
+ /**
149
+ * JSON 문자열을 Expression으로 파싱
150
+ */
151
+ export function parseExpression(json) {
152
+ try {
153
+ const parsed = JSON.parse(json);
154
+ if (isValidExpression(parsed)) {
155
+ return { ok: true, expression: parsed };
156
+ }
157
+ return { ok: false, error: 'Invalid expression structure' };
158
+ }
159
+ catch (e) {
160
+ return { ok: false, error: `JSON parse error: ${String(e)}` };
161
+ }
162
+ }
163
+ /**
164
+ * Expression을 사람이 읽을 수 있는 형태로 변환
165
+ */
166
+ export function expressionToString(expr) {
167
+ if (expr === null)
168
+ return 'null';
169
+ if (typeof expr === 'string')
170
+ return `"${expr}"`;
171
+ if (typeof expr === 'number')
172
+ return String(expr);
173
+ if (typeof expr === 'boolean')
174
+ return String(expr);
175
+ const [op, ...args] = expr;
176
+ switch (op) {
177
+ case 'get':
178
+ return `$${args[0]}`;
179
+ case '==':
180
+ case '!=':
181
+ case '>':
182
+ case '>=':
183
+ case '<':
184
+ case '<=':
185
+ case '+':
186
+ case '-':
187
+ case '*':
188
+ case '/':
189
+ case '%':
190
+ return `(${expressionToString(args[0])} ${op} ${expressionToString(args[1])})`;
191
+ case '!':
192
+ return `!${expressionToString(args[0])}`;
193
+ case 'all':
194
+ return `(${args.map((a) => expressionToString(a)).join(' && ')})`;
195
+ case 'any':
196
+ return `(${args.map((a) => expressionToString(a)).join(' || ')})`;
197
+ default:
198
+ return `${op}(${args.map((a) => (isValidExpression(a) ? expressionToString(a) : String(a))).join(', ')})`;
199
+ }
200
+ }
201
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/expression/parser.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/B,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,OAAO,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAE3C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEpC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAClB,IAAI,OAAO,EAAE,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAEzC,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,EAAU;IACjC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;QAC7B,eAAe;QACf,KAAK;QACL,aAAa;QACb,IAAI;QACJ,IAAI;QACJ,GAAG;QACH,IAAI;QACJ,GAAG;QACH,IAAI;QACJ,UAAU;QACV,GAAG;QACH,KAAK;QACL,KAAK;QACL,aAAa;QACb,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,cAAc;QACd,MAAM;QACN,OAAO;QACP,UAAU;QACV,SAAS;QACT,QAAQ;QACR,OAAO;QACP,OAAO;QACP,MAAM;QACN,OAAO;QACP,OAAO;QACP,MAAM;QACN,SAAS;QACT,SAAS;QACT,QAAQ;QACR,QAAQ;QACR,IAAI;QACJ,OAAO;QAC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,CAAC,GAAG,CAAC;IAC9G,CAAC;AACH,CAAC"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Expression DSL Types
3
+ *
4
+ * MapGL-like 선언적 표현식 언어
5
+ * - JSON-serializable (코드가 아닌 데이터)
6
+ * - Side-effect 없음 (순수 함수)
7
+ * - 정적 분석 가능 (의존성 추출, AI 파싱)
8
+ */
9
+ import type { SemanticPath } from '../domain/types.js';
10
+ /** 리터럴 값 */
11
+ export type LiteralExpr = string | number | boolean | null;
12
+ /** 경로로 값 읽기 */
13
+ export type GetExpr = ['get', SemanticPath];
14
+ /** 비교 연산자 */
15
+ export type EqExpr = ['==', Expression, Expression];
16
+ export type NeqExpr = ['!=', Expression, Expression];
17
+ export type GtExpr = ['>', Expression, Expression];
18
+ export type GteExpr = ['>=', Expression, Expression];
19
+ export type LtExpr = ['<', Expression, Expression];
20
+ export type LteExpr = ['<=', Expression, Expression];
21
+ export type ComparisonExpr = EqExpr | NeqExpr | GtExpr | GteExpr | LtExpr | LteExpr;
22
+ /** 논리 연산자 */
23
+ export type NotExpr = ['!', Expression];
24
+ export type AllExpr = ['all', ...Expression[]];
25
+ export type AnyExpr = ['any', ...Expression[]];
26
+ export type LogicalExpr = NotExpr | AllExpr | AnyExpr;
27
+ /** 산술 연산자 */
28
+ export type AddExpr = ['+', Expression, Expression];
29
+ export type SubExpr = ['-', Expression, Expression];
30
+ export type MulExpr = ['*', Expression, Expression];
31
+ export type DivExpr = ['/', Expression, Expression];
32
+ export type ModExpr = ['%', Expression, Expression];
33
+ export type ArithmeticExpr = AddExpr | SubExpr | MulExpr | DivExpr | ModExpr;
34
+ /** Case clause: [condition, result] */
35
+ export type CaseClause = [Expression, Expression];
36
+ /** Match clause: [pattern, result] */
37
+ export type MatchClause = [Expression, Expression];
38
+ /** case: if-else chain */
39
+ export type CaseExpr = ['case', ...CaseClause[], Expression];
40
+ /** match: pattern match */
41
+ export type MatchExpr = ['match', Expression, ...MatchClause[], Expression];
42
+ /** coalesce: first non-null */
43
+ export type CoalesceExpr = ['coalesce', ...Expression[]];
44
+ export type ConditionalExpr = CaseExpr | MatchExpr | CoalesceExpr;
45
+ export type ConcatExpr = ['concat', ...Expression[]];
46
+ export type UpperExpr = ['upper', Expression];
47
+ export type LowerExpr = ['lower', Expression];
48
+ export type TrimExpr = ['trim', Expression];
49
+ export type SliceExpr = ['slice', Expression, number, number?];
50
+ export type SplitExpr = ['split', Expression, string];
51
+ export type JoinExpr = ['join', Expression, string];
52
+ export type MatchesExpr = ['matches', Expression, string];
53
+ export type ReplaceExpr = ['replace', Expression, string, string];
54
+ export type StringFn = ConcatExpr | UpperExpr | LowerExpr | TrimExpr | SliceExpr | SplitExpr | JoinExpr | MatchesExpr | ReplaceExpr;
55
+ export type LengthExpr = ['length', Expression];
56
+ export type AtExpr = ['at', Expression, number];
57
+ export type FirstExpr = ['first', Expression];
58
+ export type LastExpr = ['last', Expression];
59
+ export type IncludesExpr = ['includes', Expression, Expression];
60
+ export type IndexOfExpr = ['indexOf', Expression, Expression];
61
+ export type MapExpr = ['map', Expression, Expression];
62
+ export type FilterExpr = ['filter', Expression, Expression];
63
+ export type EveryExpr = ['every', Expression, Expression];
64
+ export type SomeExpr = ['some', Expression, Expression];
65
+ export type ReduceExpr = ['reduce', Expression, Expression, Expression];
66
+ export type FlattenExpr = ['flatten', Expression];
67
+ export type UniqueExpr = ['unique', Expression];
68
+ export type SortExpr = ['sort', Expression, Expression?];
69
+ export type ReverseExpr = ['reverse', Expression];
70
+ export type ArrayFn = LengthExpr | AtExpr | FirstExpr | LastExpr | IncludesExpr | IndexOfExpr | MapExpr | FilterExpr | EveryExpr | SomeExpr | ReduceExpr | FlattenExpr | UniqueExpr | SortExpr | ReverseExpr;
71
+ export type SumExpr = ['sum', Expression];
72
+ export type MinExpr = ['min', Expression];
73
+ export type MaxExpr = ['max', Expression];
74
+ export type AvgExpr = ['avg', Expression];
75
+ export type CountExpr = ['count', Expression];
76
+ export type RoundExpr = ['round', Expression, number?];
77
+ export type FloorExpr = ['floor', Expression];
78
+ export type CeilExpr = ['ceil', Expression];
79
+ export type AbsExpr = ['abs', Expression];
80
+ export type ClampExpr = ['clamp', Expression, number, number];
81
+ export type NumberFn = SumExpr | MinExpr | MaxExpr | AvgExpr | CountExpr | RoundExpr | FloorExpr | CeilExpr | AbsExpr | ClampExpr;
82
+ export type HasExpr = ['has', Expression, string];
83
+ export type KeysExpr = ['keys', Expression];
84
+ export type ValuesExpr = ['values', Expression];
85
+ export type EntriesExpr = ['entries', Expression];
86
+ export type PickExpr = ['pick', Expression, ...string[]];
87
+ export type OmitExpr = ['omit', Expression, ...string[]];
88
+ export type ObjectFn = HasExpr | KeysExpr | ValuesExpr | EntriesExpr | PickExpr | OmitExpr;
89
+ export type IsNullExpr = ['isNull', Expression];
90
+ export type IsNumberExpr = ['isNumber', Expression];
91
+ export type IsStringExpr = ['isString', Expression];
92
+ export type IsArrayExpr = ['isArray', Expression];
93
+ export type IsObjectExpr = ['isObject', Expression];
94
+ export type ToNumberExpr = ['toNumber', Expression];
95
+ export type ToStringExpr = ['toString', Expression];
96
+ export type TypeFn = IsNullExpr | IsNumberExpr | IsStringExpr | IsArrayExpr | IsObjectExpr | ToNumberExpr | ToStringExpr;
97
+ export type NowExpr = ['now'];
98
+ export type DateExpr = ['date', Expression];
99
+ export type YearExpr = ['year', Expression];
100
+ export type MonthExpr = ['month', Expression];
101
+ export type DayExpr = ['day', Expression];
102
+ export type DiffExpr = ['diff', Expression, Expression, string];
103
+ export type DateFn = NowExpr | DateExpr | YearExpr | MonthExpr | DayExpr | DiffExpr;
104
+ export type OperatorExpr = ComparisonExpr | LogicalExpr | ArithmeticExpr;
105
+ export type FunctionExpr = ConditionalExpr | StringFn | ArrayFn | NumberFn | ObjectFn | TypeFn | DateFn;
106
+ /**
107
+ * Expression: MapGL-like 선언적 표현식
108
+ */
109
+ export type Expression = LiteralExpr | GetExpr | OperatorExpr | FunctionExpr;
110
+ /**
111
+ * EvaluationContext: Expression 평가에 필요한 컨텍스트
112
+ */
113
+ export type EvaluationContext = {
114
+ /** 모든 경로의 값을 조회하는 함수 */
115
+ get: (path: SemanticPath) => unknown;
116
+ /** 현재 컨텍스트 값 (map/filter 내부에서 사용) */
117
+ current?: unknown;
118
+ /** 현재 인덱스 (map/filter 내부에서 사용) */
119
+ index?: number;
120
+ /** 누적값 (reduce에서 사용) */
121
+ accumulator?: unknown;
122
+ };
123
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/expression/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMvD,YAAY;AACZ,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAM3D,eAAe;AACf,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAM5C,aAAa;AACb,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACrD,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACrD,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpF,aAAa;AACb,MAAM,MAAM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,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,YAAY,GAAG,YAAY,CAAC;AAM7E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,wBAAwB;IACxB,GAAG,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;IAErC,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Expression DSL Types
3
+ *
4
+ * MapGL-like 선언적 표현식 언어
5
+ * - JSON-serializable (코드가 아닌 데이터)
6
+ * - Side-effect 없음 (순수 함수)
7
+ * - 정적 분석 가능 (의존성 추출, AI 파싱)
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/expression/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @manifesto-ai/core
3
+ *
4
+ * AI Native Semantic Layer for SaaS Business Logic
5
+ *
6
+ * Manifesto는 SaaS 비즈니스 로직을 의미론적 주소 공간(Semantic Path Space)으로 선언하여,
7
+ * AI Agent가 UI를 이해하고 안전하게 조작할 수 있게 하는 AI Native Semantic Layer입니다.
8
+ */
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';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,gBAAg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,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EAEb,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,mBAAmB,EACnB,mBAAmB,EAEnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAEL,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EAEvB,mBAAmB,EACnB,eAAe,EACf,8BAA8B,EAC9B,6BAA6B,EAC7B,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEL,cAAc,EACd,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EAEZ,0BAA0B,EAC1B,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @manifesto-ai/core
3
+ *
4
+ * AI Native Semantic Layer for SaaS Business Logic
5
+ *
6
+ * Manifesto는 SaaS 비즈니스 로직을 의미론적 주소 공간(Semantic Path Space)으로 선언하여,
7
+ * AI Agent가 UI를 이해하고 안전하게 조작할 수 있게 하는 AI Native Semantic Layer입니다.
8
+ */
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';
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,QAAQ,EACR,cAAc,EAId,EAAE,EACF,GAAG,EACH,WAAW,EACX,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,EACH,MAAM,EACN,OAAO,EACP,OAAO,EACP,GAAG,EACH,GAAG,EACH,WAAW,EACX,QAAQ;AACR,SAAS;AACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,WAAW,EACX,SAAS,GAIV,MAAM,mBAAmB,CAAC;AAE3B,gBAAgB;AAChB,OAAO;AAOL,QAAQ;AACR,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,QAAQ;AACR,cAAc;AACd,iCAAiC,EACjC,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB;AAEhB,cAAc;AACd,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,yBAAyB,GAG1B,MAAM,gBAAgB,CAAC;AAExB,sBAAsB;AACtB,OAAO,EAGL,cAAc,EACd,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EAOb,mBAAmB,EACnB,mBAAmB,EAQnB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,iBAAiB;AACjB,OAAO;AACL,eAAe;AACf,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B;AAG/B,eAAe;AACf,mBAAmB,EACnB,eAAe,EACf,8BAA8B,EAC9B,6BAA6B,EAC7B,kBAAkB,GAInB,MAAM,mBAAmB,CAAC;AAE3B,kBAAkB;AAClB,OAAO;AACL,cAAc;AACd,cAAc,EACd,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,YAAY;AACZ,aAAa;AACb,0BAA0B,EAC1B,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,gCAAgC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { SemanticPath, ConditionRef, FieldPolicy } from '../domain/types.js';
2
+ import type { EvaluationContext } from '../expression/types.js';
3
+ /**
4
+ * FieldPolicyEvaluation: 필드 정책 평가 결과
5
+ */
6
+ export type FieldPolicyEvaluation = {
7
+ /** 이 필드가 현재 의미있는지 (표시할지) */
8
+ relevant: boolean;
9
+ relevantReason?: string;
10
+ relevantConditions?: ConditionEvaluationDetail[];
11
+ /** 이 필드가 현재 수정 가능한지 */
12
+ editable: boolean;
13
+ editableReason?: string;
14
+ editableConditions?: ConditionEvaluationDetail[];
15
+ /** 이 필드가 현재 필수인지 */
16
+ required: boolean;
17
+ requiredReason?: string;
18
+ requiredConditions?: ConditionEvaluationDetail[];
19
+ };
20
+ /**
21
+ * ConditionEvaluationDetail: 조건 평가 상세
22
+ */
23
+ export type ConditionEvaluationDetail = {
24
+ condition: ConditionRef;
25
+ actualValue: unknown;
26
+ satisfied: boolean;
27
+ };
28
+ /**
29
+ * 필드 정책 평가
30
+ */
31
+ export declare function evaluateFieldPolicy(policy: FieldPolicy | undefined, ctx: EvaluationContext): FieldPolicyEvaluation;
32
+ /**
33
+ * UI 표현을 위한 필드 상태
34
+ */
35
+ export type FieldUIState = {
36
+ /** 보여야 하는지 */
37
+ visible: boolean;
38
+ /** 활성화 상태인지 */
39
+ enabled: boolean;
40
+ /** 필수 표시를 보여야 하는지 */
41
+ showRequired: boolean;
42
+ /** 비활성화 이유 (있으면) */
43
+ disabledReason?: string;
44
+ /** 숨김 이유 (있으면) */
45
+ hiddenReason?: string;
46
+ };
47
+ /**
48
+ * 필드 정책을 UI 상태로 변환
49
+ */
50
+ export declare function policyToUIState(evaluation: FieldPolicyEvaluation): FieldUIState;
51
+ /**
52
+ * 필드 정책의 의존성 추출
53
+ */
54
+ export declare function extractFieldPolicyDependencies(policy: FieldPolicy): SemanticPath[];
55
+ /**
56
+ * 다중 필드 정책 평가 (배치)
57
+ */
58
+ export declare function evaluateMultipleFieldPolicies(policies: Record<SemanticPath, FieldPolicy | undefined>, ctx: EvaluationContext): Record<SemanticPath, FieldPolicyEvaluation>;
59
+ /**
60
+ * AI용 필드 정책 설명 생성
61
+ */
62
+ export declare function explainFieldPolicy(path: SemanticPath, evaluation: FieldPolicyEvaluation): string;
63
+ //# sourceMappingURL=field-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-policy.d.ts","sourceRoot":"","sources":["../../src/policy/field-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YA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AAW,GAAG,YAAY,EAAE,CAgBlF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,WAAW,GAAG,SAAS,CAAC,EACvD,GAAG,EAAE,iBAAiB,GACrB,MAAM,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAQ7C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,UAAU,EAAE,qBAAqB,GAChC,MAAM,CA4CR"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * 필드 정책 평가
3
+ */
4
+ export function evaluateFieldPolicy(policy, ctx) {
5
+ if (!policy) {
6
+ return {
7
+ relevant: true,
8
+ editable: true,
9
+ required: false,
10
+ };
11
+ }
12
+ const relevantResult = evaluateConditionList(policy.relevantWhen, ctx, true);
13
+ const editableResult = evaluateConditionList(policy.editableWhen, ctx, true);
14
+ const requiredResult = evaluateConditionList(policy.requiredWhen, ctx, false);
15
+ return {
16
+ relevant: relevantResult.satisfied,
17
+ relevantReason: relevantResult.reason,
18
+ relevantConditions: relevantResult.details,
19
+ editable: editableResult.satisfied,
20
+ editableReason: editableResult.reason,
21
+ editableConditions: editableResult.details,
22
+ required: requiredResult.satisfied,
23
+ requiredReason: requiredResult.reason,
24
+ requiredConditions: requiredResult.details,
25
+ };
26
+ }
27
+ /**
28
+ * 조건 목록 평가
29
+ */
30
+ function evaluateConditionList(conditions, ctx, defaultValue) {
31
+ if (!conditions || conditions.length === 0) {
32
+ return { satisfied: defaultValue, details: [] };
33
+ }
34
+ const details = [];
35
+ let firstUnsatisfiedReason;
36
+ for (const condition of conditions) {
37
+ const actualValue = ctx.get(condition.path);
38
+ const actualBoolean = Boolean(actualValue);
39
+ const expectedBoolean = condition.expect !== 'false';
40
+ const satisfied = actualBoolean === expectedBoolean;
41
+ details.push({
42
+ condition,
43
+ actualValue,
44
+ satisfied,
45
+ });
46
+ if (!satisfied && !firstUnsatisfiedReason) {
47
+ firstUnsatisfiedReason = condition.reason;
48
+ }
49
+ }
50
+ const allSatisfied = details.every((d) => d.satisfied);
51
+ return {
52
+ satisfied: allSatisfied,
53
+ reason: allSatisfied ? undefined : firstUnsatisfiedReason,
54
+ details,
55
+ };
56
+ }
57
+ /**
58
+ * 필드 정책을 UI 상태로 변환
59
+ */
60
+ export function policyToUIState(evaluation) {
61
+ return {
62
+ visible: evaluation.relevant,
63
+ enabled: evaluation.relevant && evaluation.editable,
64
+ showRequired: evaluation.relevant && evaluation.required,
65
+ disabledReason: evaluation.editable ? undefined : evaluation.editableReason,
66
+ hiddenReason: evaluation.relevant ? undefined : evaluation.relevantReason,
67
+ };
68
+ }
69
+ /**
70
+ * 필드 정책의 의존성 추출
71
+ */
72
+ export function extractFieldPolicyDependencies(policy) {
73
+ const deps = new Set();
74
+ for (const cond of policy.relevantWhen ?? []) {
75
+ deps.add(cond.path);
76
+ }
77
+ for (const cond of policy.editableWhen ?? []) {
78
+ deps.add(cond.path);
79
+ }
80
+ for (const cond of policy.requiredWhen ?? []) {
81
+ deps.add(cond.path);
82
+ }
83
+ return [...deps];
84
+ }
85
+ /**
86
+ * 다중 필드 정책 평가 (배치)
87
+ */
88
+ export function evaluateMultipleFieldPolicies(policies, ctx) {
89
+ const results = {};
90
+ for (const [path, policy] of Object.entries(policies)) {
91
+ results[path] = evaluateFieldPolicy(policy, ctx);
92
+ }
93
+ return results;
94
+ }
95
+ /**
96
+ * AI용 필드 정책 설명 생성
97
+ */
98
+ export function explainFieldPolicy(path, evaluation) {
99
+ const lines = [];
100
+ lines.push(`Field: ${path}`);
101
+ lines.push('');
102
+ // Relevance
103
+ lines.push(`Relevant: ${evaluation.relevant ? 'Yes' : 'No'}`);
104
+ if (!evaluation.relevant) {
105
+ lines.push(` Reason: ${evaluation.relevantReason ?? 'Condition not met'}`);
106
+ if (evaluation.relevantConditions) {
107
+ for (const detail of evaluation.relevantConditions) {
108
+ if (!detail.satisfied) {
109
+ lines.push(` - ${detail.condition.path}: expected ${detail.condition.expect ?? 'true'}, got ${Boolean(detail.actualValue)}`);
110
+ }
111
+ }
112
+ }
113
+ }
114
+ // Editable
115
+ lines.push(`Editable: ${evaluation.editable ? 'Yes' : 'No'}`);
116
+ if (!evaluation.editable) {
117
+ lines.push(` Reason: ${evaluation.editableReason ?? 'Condition not met'}`);
118
+ if (evaluation.editableConditions) {
119
+ for (const detail of evaluation.editableConditions) {
120
+ if (!detail.satisfied) {
121
+ lines.push(` - ${detail.condition.path}: expected ${detail.condition.expect ?? 'true'}, got ${Boolean(detail.actualValue)}`);
122
+ }
123
+ }
124
+ }
125
+ }
126
+ // Required
127
+ lines.push(`Required: ${evaluation.required ? 'Yes' : 'No'}`);
128
+ if (evaluation.required && evaluation.requiredConditions) {
129
+ lines.push(' Because:');
130
+ for (const detail of evaluation.requiredConditions) {
131
+ if (detail.satisfied) {
132
+ lines.push(` - ${detail.condition.path} = ${JSON.stringify(detail.actualValue)}`);
133
+ }
134
+ }
135
+ }
136
+ return lines.join('\n');
137
+ }
138
+ //# sourceMappingURL=field-policy.js.map