@orygn/opa-mcp 0.1.11 → 0.1.12

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 (53) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/README.md +18 -17
  3. package/dist/constants.d.ts +1 -1
  4. package/dist/constants.js +1 -1
  5. package/dist/lib/rego-ast-types.d.ts +81 -0
  6. package/dist/lib/rego-ast-types.d.ts.map +1 -0
  7. package/dist/lib/rego-ast-types.js +9 -0
  8. package/dist/lib/rego-ast-types.js.map +1 -0
  9. package/dist/lib/rego-ast-walker.d.ts +21 -0
  10. package/dist/lib/rego-ast-walker.d.ts.map +1 -0
  11. package/dist/lib/rego-ast-walker.js +491 -0
  12. package/dist/lib/rego-ast-walker.js.map +1 -0
  13. package/dist/lib/rego-counterexample.d.ts +32 -0
  14. package/dist/lib/rego-counterexample.d.ts.map +1 -0
  15. package/dist/lib/rego-counterexample.js +75 -0
  16. package/dist/lib/rego-counterexample.js.map +1 -0
  17. package/dist/lib/rego-ir.d.ts +117 -0
  18. package/dist/lib/rego-ir.d.ts.map +1 -0
  19. package/dist/lib/rego-ir.js +7 -0
  20. package/dist/lib/rego-ir.js.map +1 -0
  21. package/dist/lib/rego-property-parser.d.ts +34 -0
  22. package/dist/lib/rego-property-parser.d.ts.map +1 -0
  23. package/dist/lib/rego-property-parser.js +60 -0
  24. package/dist/lib/rego-property-parser.js.map +1 -0
  25. package/dist/lib/rego-smt-encoder.d.ts +57 -0
  26. package/dist/lib/rego-smt-encoder.d.ts.map +1 -0
  27. package/dist/lib/rego-smt-encoder.js +499 -0
  28. package/dist/lib/rego-smt-encoder.js.map +1 -0
  29. package/dist/lib/rego-type-inferencer.d.ts +26 -0
  30. package/dist/lib/rego-type-inferencer.d.ts.map +1 -0
  31. package/dist/lib/rego-type-inferencer.js +138 -0
  32. package/dist/lib/rego-type-inferencer.js.map +1 -0
  33. package/dist/lib/rego-verify-engine.d.ts +37 -0
  34. package/dist/lib/rego-verify-engine.d.ts.map +1 -0
  35. package/dist/lib/rego-verify-engine.js +236 -0
  36. package/dist/lib/rego-verify-engine.js.map +1 -0
  37. package/dist/lib/rego-z3.d.ts +13 -0
  38. package/dist/lib/rego-z3.d.ts.map +1 -0
  39. package/dist/lib/rego-z3.js +29 -0
  40. package/dist/lib/rego-z3.js.map +1 -0
  41. package/dist/tools/helpers/index.d.ts.map +1 -1
  42. package/dist/tools/helpers/index.js +2 -0
  43. package/dist/tools/helpers/index.js.map +1 -1
  44. package/dist/tools/helpers/verify.d.ts +4 -0
  45. package/dist/tools/helpers/verify.d.ts.map +1 -0
  46. package/dist/tools/helpers/verify.js +75 -0
  47. package/dist/tools/helpers/verify.js.map +1 -0
  48. package/dist/tools/index.d.ts +3 -2
  49. package/dist/tools/index.d.ts.map +1 -1
  50. package/dist/tools/index.js.map +1 -1
  51. package/dist/types.d.ts +1 -1
  52. package/dist/types.d.ts.map +1 -1
  53. package/package.json +7 -5
@@ -0,0 +1,138 @@
1
+ export function inferTypes(clauses, inputPaths) {
2
+ // Pass 1: collect every local-variable assignment as a raw VerifyValue.
3
+ // This covers both direct (x := input.age) and chained (x := y; y := input.age)
4
+ // assignments. resolveToInputPath follows chains transitively.
5
+ const localAssignments = new Map(); // local_var_name → assigned VerifyValue
6
+ for (const ruleClauses of clauses) {
7
+ for (const clause of ruleClauses) {
8
+ for (const expr of clause.expressions) {
9
+ if (expr.kind === 'assign') {
10
+ localAssignments.set(expr.local, expr.value);
11
+ }
12
+ }
13
+ }
14
+ }
15
+ // Initialize evidence sets from all known paths.
16
+ const evidence = new Map();
17
+ for (const path of inputPaths.keys()) {
18
+ evidence.set(path, new Set());
19
+ }
20
+ // Pass 2: collect sort evidence from all expressions, resolving locals via the
21
+ // assignment map (transitively, so x := y; y := input.age propagates correctly).
22
+ for (const ruleClauses of clauses) {
23
+ for (const clause of ruleClauses) {
24
+ for (const expr of clause.expressions) {
25
+ collectEvidence(expr, evidence, localAssignments);
26
+ }
27
+ }
28
+ }
29
+ const sorts = new Map();
30
+ const conflicts = [];
31
+ for (const [path, ev] of evidence) {
32
+ if (ev.size === 0) {
33
+ sorts.set(path, 'string');
34
+ }
35
+ else if (ev.size === 1) {
36
+ const only = [...ev][0];
37
+ sorts.set(path, only);
38
+ }
39
+ else {
40
+ conflicts.push({
41
+ path,
42
+ reason: `Path '${path}' used as both ${[...ev].join(' and ')}; using uninterpreted sort (equality only).`,
43
+ });
44
+ sorts.set(path, 'uninterpreted');
45
+ }
46
+ }
47
+ return { sorts, conflicts };
48
+ }
49
+ function collectEvidence(expr, evidence, localAssignments) {
50
+ switch (expr.kind) {
51
+ case 'eq':
52
+ case 'neq':
53
+ addLiteralEvidence(expr.left, expr.right, evidence, localAssignments);
54
+ addLiteralEvidence(expr.right, expr.left, evidence, localAssignments);
55
+ break;
56
+ case 'assign':
57
+ // The local variable itself is not an input path; evidence flows via localAssignments.
58
+ break;
59
+ case 'gt':
60
+ case 'gte':
61
+ case 'lt':
62
+ case 'lte':
63
+ addSortEvidence(expr.left, 'int', evidence, localAssignments);
64
+ addSortEvidence(expr.right, 'int', evidence, localAssignments);
65
+ break;
66
+ case 'startswith':
67
+ case 'endswith':
68
+ addSortEvidence(expr.str, 'string', evidence, localAssignments);
69
+ break;
70
+ case 'contains':
71
+ addSortEvidence(expr.str, 'string', evidence, localAssignments);
72
+ break;
73
+ case 'regex_match':
74
+ addSortEvidence(expr.str, 'string', evidence, localAssignments);
75
+ break;
76
+ case 'bool_check':
77
+ addSortEvidence(expr.ref, 'bool', evidence, localAssignments);
78
+ break;
79
+ default:
80
+ break;
81
+ }
82
+ }
83
+ /**
84
+ * Follow an assignment chain from a VerifyValue back to an input path.
85
+ *
86
+ * Handles transitive local-variable chains:
87
+ * x := y; y := input.age → resolveToInputPath(x) = 'input.age'
88
+ *
89
+ * Returns undefined when the chain terminates at a literal, an unaliased
90
+ * local, a data ref, or a cycle.
91
+ */
92
+ function resolveToInputPath(value, localAssignments) {
93
+ const visited = new Set();
94
+ let current = value;
95
+ while (true) {
96
+ if (current.kind === 'input_ref')
97
+ return current.path;
98
+ if (current.kind !== 'local_var')
99
+ return undefined; // literal or unsupported
100
+ if (visited.has(current.name))
101
+ return undefined; // cycle guard
102
+ visited.add(current.name);
103
+ const next = localAssignments.get(current.name);
104
+ if (next === undefined)
105
+ return undefined; // unassigned local
106
+ current = next;
107
+ }
108
+ }
109
+ function addLiteralEvidence(subject, comparand, evidence, localAssignments) {
110
+ const path = resolveToInputPath(subject, localAssignments);
111
+ if (path === undefined)
112
+ return;
113
+ switch (comparand.kind) {
114
+ case 'literal_string':
115
+ addPathEvidence(path, 'string', evidence);
116
+ break;
117
+ case 'literal_number':
118
+ addPathEvidence(path, 'int', evidence);
119
+ break;
120
+ case 'literal_bool':
121
+ addPathEvidence(path, 'bool', evidence);
122
+ break;
123
+ default:
124
+ break;
125
+ }
126
+ }
127
+ function addSortEvidence(value, sort, evidence, localAssignments) {
128
+ const path = resolveToInputPath(value, localAssignments);
129
+ if (path === undefined)
130
+ return;
131
+ addPathEvidence(path, sort, evidence);
132
+ }
133
+ function addPathEvidence(path, sort, evidence) {
134
+ const ev = evidence.get(path);
135
+ if (ev !== undefined)
136
+ ev.add(sort);
137
+ }
138
+ //# sourceMappingURL=rego-type-inferencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rego-type-inferencer.js","sourceRoot":"","sources":["../../src/lib/rego-type-inferencer.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,UAAU,CACxB,OAA6B,EAC7B,UAAiC;IAEjC,wEAAwE;IACxE,gFAAgF;IAChF,+DAA+D;IAC/D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAuB,CAAC,CAAC,wCAAwC;IACjG,KAAK,MAAM,WAAW,IAAI,OAAO,EAAE,CAAC;QAClC,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;YACjC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBAC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AAE,QAAQ,CAAC,CAAC;YAC1C,MAAM;QACR,KAAK,gBAAgB;YACnB,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YACvC,MAAM;QACR,KAAK,cAAc;YACjB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YACxC,MAAM;QACR;YACE,MAAM;IACV,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CACtB,KAAkB,EAClB,IAAkB,EAClB,QAAwC,EACxC,gBAA0C;IAE1C,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACzD,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO;IAC/B,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,eAAe,CACtB,IAAY,EACZ,IAAkB,EAClB,QAAwC;IAExC,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,EAAE,KAAK,SAAS;QAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * rego_verify engine - orchestrates the full verification pipeline:
3
+ *
4
+ * Rego source
5
+ * → opa parse (JSON AST)
6
+ * → walkModule (IR)
7
+ * → inferTypes (Z3 sorts)
8
+ * → createInputVars (Z3 constants)
9
+ * → encodeRule (Z3 Bool formula)
10
+ * → negate / check property
11
+ * → solver.check() → sat | unsat | unknown
12
+ * → extractCounterexample (on sat)
13
+ * → VerifyResult
14
+ */
15
+ import type { OpaModule } from './rego-ast-types.js';
16
+ import { type CounterexampleInput } from './rego-counterexample.js';
17
+ import { type VerifyProperty } from './rego-property-parser.js';
18
+ export type VerifyVerdict = 'proven' | 'counterexample' | 'inconclusive' | 'unsatisfiable';
19
+ export interface VerifyResult {
20
+ verdict: VerifyVerdict;
21
+ property: string;
22
+ rule: string;
23
+ counterexample?: CounterexampleInput;
24
+ counterexampleFormatted?: string;
25
+ unsupportedConstructs: Array<{
26
+ constructType: string;
27
+ description: string;
28
+ }>;
29
+ warnings: string[];
30
+ message: string;
31
+ }
32
+ /**
33
+ * Run formal verification on a pre-parsed OPA module.
34
+ * The caller must pass the JSON-parsed result of `opa parse --format=json`.
35
+ */
36
+ export declare function runVerify(ast: OpaModule, property: VerifyProperty, signal?: AbortSignal): Promise<VerifyResult>;
37
+ //# sourceMappingURL=rego-verify-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rego-verify-engine.d.ts","sourceRoot":"","sources":["../../src/lib/rego-verify-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAUlF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,gBAAgB,GAAG,cAAc,GAAG,eAAe,CAAC;AAE3F,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,qBAAqB,EAAE,KAAK,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAKD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,cAAc,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,CAuKvB"}
@@ -0,0 +1,236 @@
1
+ import { walkModule } from './rego-ast-walker.js';
2
+ import { inferTypes } from './rego-type-inferencer.js';
3
+ import { createInputVars, encodeRule } from './rego-smt-encoder.js';
4
+ import { extractCounterexample, formatCounterexample, } from './rego-counterexample.js';
5
+ import { describeProperty } from './rego-property-parser.js';
6
+ import { getZ3 } from './rego-z3.js';
7
+ // Monotonically increasing counter used to generate a unique prefix for all
8
+ // Z3 constant names within each runVerify call. This prevents sort conflicts
9
+ // when the same input path is inferred with different sorts across calls
10
+ // (e.g. two policies using input.x as string vs int) within the shared Z3
11
+ // singleton context.
12
+ let _verifyCallCounter = 0;
13
+ /** Timeout for Z3 solver in milliseconds. */
14
+ const SOLVER_TIMEOUT_MS = 10_000;
15
+ /**
16
+ * Run formal verification on a pre-parsed OPA module.
17
+ * The caller must pass the JSON-parsed result of `opa parse --format=json`.
18
+ */
19
+ export async function runVerify(ast, property, signal) {
20
+ const walked = walkModule(ast);
21
+ const warnings = [];
22
+ const targetClauses = walked.rules.get(property.ruleName);
23
+ // Collect only the construct types that actually appear in the target rule's
24
+ // clause expressions. This prevents unsupported constructs from OTHER rules
25
+ // in the same module (e.g. a "deny" rule with NAF) from being reported when
26
+ // verifying an unrelated "allow" rule that is fully encodable.
27
+ const unsupportedTypesInTarget = new Set();
28
+ for (const clause of targetClauses ?? []) {
29
+ for (const expr of clause.expressions) {
30
+ if (expr.kind === 'unsupported')
31
+ unsupportedTypesInTarget.add(expr.constructType);
32
+ }
33
+ }
34
+ const unsupportedInRule = walked.unsupported.filter((u) => unsupportedTypesInTarget.has(u.constructType));
35
+ if (targetClauses === undefined || targetClauses.length === 0) {
36
+ // A default-only rule (e.g. "default allow = false") has no clauses but a known
37
+ // constant value -- derive the correct verdict without running Z3.
38
+ const defaultValue = walked.defaults.get(property.ruleName);
39
+ if (typeof defaultValue === 'boolean') {
40
+ return solveDefaultOnlyRule(property, defaultValue, unsupportedInRule, warnings);
41
+ }
42
+ return inconclusive(property, `Rule "${property.ruleName}" not found in the provided policy.`, unsupportedInRule, warnings);
43
+ }
44
+ // Any clause with an unsupported expression makes verification incomplete.
45
+ const hasUnsupportedInClauses = targetClauses.some((c) => c.expressions.some((e) => e.kind === 'unsupported'));
46
+ if (hasUnsupportedInClauses) {
47
+ return inconclusive(property, `Rule "${property.ruleName}" contains constructs that cannot be encoded in Z3 (e.g. negation-as-failure, comprehensions, built-ins beyond string/comparison ops). Verification is inconclusive.`, unsupportedInRule, warnings);
48
+ }
49
+ // Type inference + Z3 setup
50
+ const typeResult = inferTypes([...walked.rules.values()], walked.inputPaths);
51
+ for (const conflict of typeResult.conflicts) {
52
+ warnings.push(conflict.reason);
53
+ }
54
+ signal?.throwIfAborted();
55
+ const Z3 = await getZ3();
56
+ signal?.throwIfAborted();
57
+ const callId = `v${_verifyCallCounter++}`;
58
+ const inputVars = createInputVars(Z3, walked.inputPaths, typeResult.sorts, callId);
59
+ const ctx = { Z3, inputVars, sorts: typeResult.sorts, callId };
60
+ const encoded = encodeRule(targetClauses, ctx);
61
+ warnings.push(...encoded.warnings);
62
+ // Z3's high-level Solver and Model objects use FinalizationRegistry internally
63
+ // (solver_dec_ref / model_dec_ref) so they are cleaned up when GC'd.
64
+ // We avoid holding a reference to the Model beyond extractCounterexample so
65
+ // it becomes eligible for GC as soon as the call returns, reducing WASM heap
66
+ // pressure under high call volume.
67
+ const solver = new Z3.Solver();
68
+ // Set timeout to prevent hanging on complex policies
69
+ solver.set('timeout', SOLVER_TIMEOUT_MS);
70
+ switch (property.kind) {
71
+ case 'always_true':
72
+ // Prove rule is always true: check if NOT(rule) is satisfiable.
73
+ // SAT → counterexample (input where rule is false)
74
+ // UNSAT → proven always true
75
+ solver.add(Z3.Not(encoded.formula));
76
+ break;
77
+ case 'never_true':
78
+ // Prove rule is never true: check if rule IS satisfiable.
79
+ // SAT → counterexample (input where rule fires, violating "never")
80
+ // UNSAT → proven never true
81
+ solver.add(encoded.formula);
82
+ break;
83
+ case 'satisfiable':
84
+ // Check if any input satisfies the rule.
85
+ // SAT → witness found (not a bug, just a satisfying input)
86
+ // UNSAT → rule is vacuously false / dead code
87
+ solver.add(encoded.formula);
88
+ break;
89
+ }
90
+ signal?.throwIfAborted();
91
+ const solverResult = await solver.check();
92
+ if (solverResult === 'unknown') {
93
+ return inconclusive(property, `Z3 solver returned "unknown" (timeout or resource limit reached after ${SOLVER_TIMEOUT_MS}ms). The policy may be too complex for automated verification.`, unsupportedInRule, warnings);
94
+ }
95
+ if (solverResult === 'unsat') {
96
+ if (property.kind === 'satisfiable') {
97
+ // No satisfying input exists -- rule is dead code or has contradictory conditions.
98
+ return {
99
+ verdict: 'unsatisfiable',
100
+ property: describeProperty(property),
101
+ rule: property.ruleName,
102
+ unsupportedConstructs: unsupportedInRule,
103
+ warnings,
104
+ message: `UNSATISFIABLE: No input can make "${property.ruleName}" true. The rule may be dead code or have contradictory conditions.`,
105
+ };
106
+ }
107
+ // For always_true / never_true: UNSAT on the negation = property proven
108
+ return {
109
+ verdict: 'proven',
110
+ property: describeProperty(property),
111
+ rule: property.ruleName,
112
+ unsupportedConstructs: unsupportedInRule,
113
+ warnings,
114
+ message: `PROVEN: ${describeProperty(property)}.`,
115
+ };
116
+ }
117
+ // SAT: pass solver.model() inline so the Model object is not kept alive
118
+ // beyond extractCounterexample -- it becomes GC-eligible immediately after.
119
+ const ce = extractCounterexample(solver.model(), inputVars, typeResult.sorts);
120
+ const ceFormatted = formatCounterexample(ce);
121
+ if (property.kind === 'satisfiable') {
122
+ return {
123
+ verdict: 'proven',
124
+ property: describeProperty(property),
125
+ rule: property.ruleName,
126
+ counterexample: ce,
127
+ counterexampleFormatted: ceFormatted,
128
+ unsupportedConstructs: unsupportedInRule,
129
+ warnings,
130
+ message: `SATISFIABLE: Found an input that makes "${property.ruleName}" true.\n\nWitness input:\n${ceFormatted}`,
131
+ };
132
+ }
133
+ // always_true / never_true: SAT means we found a violation
134
+ const ceLabel = property.kind === 'always_true'
135
+ ? 'input where rule is FALSE'
136
+ : 'input where rule is TRUE (violates "never")';
137
+ return {
138
+ verdict: 'counterexample',
139
+ property: describeProperty(property),
140
+ rule: property.ruleName,
141
+ counterexample: ce,
142
+ counterexampleFormatted: ceFormatted,
143
+ unsupportedConstructs: unsupportedInRule,
144
+ warnings,
145
+ message: `COUNTEREXAMPLE: Property does NOT hold. Found ${ceLabel}:\n\n${ceFormatted}`,
146
+ };
147
+ }
148
+ function inconclusive(property, reason, unsupportedConstructs, warnings) {
149
+ return {
150
+ verdict: 'inconclusive',
151
+ property: describeProperty(property),
152
+ rule: property.ruleName,
153
+ unsupportedConstructs,
154
+ warnings,
155
+ message: `INCONCLUSIVE: ${reason}`,
156
+ };
157
+ }
158
+ /**
159
+ * Return the correct verdict for a rule that has no non-default clauses
160
+ * (e.g. "default allow = false"). The rule always evaluates to its constant
161
+ * default value, so no Z3 solving is needed.
162
+ */
163
+ function solveDefaultOnlyRule(property, defaultValue, unsupportedConstructs, warnings) {
164
+ // An empty input object is a valid witness/counterexample since the rule
165
+ // fires (or doesn't) unconditionally regardless of input.
166
+ const emptyWitness = {};
167
+ const emptyFormatted = formatCounterexample(emptyWitness);
168
+ const prop = describeProperty(property);
169
+ const name = property.ruleName;
170
+ switch (property.kind) {
171
+ case 'always_true':
172
+ if (defaultValue) {
173
+ return {
174
+ verdict: 'proven',
175
+ property: prop,
176
+ rule: name,
177
+ unsupportedConstructs,
178
+ warnings,
179
+ message: `PROVEN: ${prop}. Rule "${name}" is defined only as "default = true" and is always true.`,
180
+ };
181
+ }
182
+ return {
183
+ verdict: 'counterexample',
184
+ property: prop,
185
+ rule: name,
186
+ counterexample: emptyWitness,
187
+ counterexampleFormatted: emptyFormatted,
188
+ unsupportedConstructs,
189
+ warnings,
190
+ message: `COUNTEREXAMPLE: Rule "${name}" is defined only as "default = false" and is never true. Any input is a counterexample to "always true".`,
191
+ };
192
+ case 'never_true':
193
+ if (!defaultValue) {
194
+ return {
195
+ verdict: 'proven',
196
+ property: prop,
197
+ rule: name,
198
+ unsupportedConstructs,
199
+ warnings,
200
+ message: `PROVEN: ${prop}. Rule "${name}" is defined only as "default = false" and is never true.`,
201
+ };
202
+ }
203
+ return {
204
+ verdict: 'counterexample',
205
+ property: prop,
206
+ rule: name,
207
+ counterexample: emptyWitness,
208
+ counterexampleFormatted: emptyFormatted,
209
+ unsupportedConstructs,
210
+ warnings,
211
+ message: `COUNTEREXAMPLE: Rule "${name}" is defined only as "default = true" and is always true. Any input is a counterexample to "never true".`,
212
+ };
213
+ case 'satisfiable':
214
+ if (defaultValue) {
215
+ return {
216
+ verdict: 'proven',
217
+ property: prop,
218
+ rule: name,
219
+ counterexample: emptyWitness,
220
+ counterexampleFormatted: emptyFormatted,
221
+ unsupportedConstructs,
222
+ warnings,
223
+ message: `SATISFIABLE: Rule "${name}" is defined only as "default = true" -- any input satisfies it.`,
224
+ };
225
+ }
226
+ return {
227
+ verdict: 'unsatisfiable',
228
+ property: prop,
229
+ rule: name,
230
+ unsupportedConstructs,
231
+ warnings,
232
+ message: `UNSATISFIABLE: Rule "${name}" is defined only as "default = false" -- no input can make it true.`,
233
+ };
234
+ }
235
+ }
236
+ //# sourceMappingURL=rego-verify-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rego-verify-engine.js","sourceRoot":"","sources":["../../src/lib/rego-verify-engine.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAuB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,4EAA4E;AAC5E,6EAA6E;AAC7E,yEAAyE;AACz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BACvC,qBAAqB;gBACrB,QAAQ;gBACR,OAAO,EAAE,yBAAyB,IAAI,2GAA2G;aAClJ,CAAC;QAEJ,KAAK,YAAY;YACf,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO;oBACL,OAAO,EAAE,QAAQ;oBACjB,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,IAAI;oBACV,qBAAqB;oBACrB,QAAQ;oBACR,OAAO,EAAE,WAAW,IAAI,WAAW,IAAI,2DAA2D;iBACnG,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,gBAAgB;gBACzB,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,IAAI;gBACV,cAAc,EAAE,YAAY;gBAC5B,uBAAuB,EAAE,cAAc;gBACvC,qBAAqB;gBACrB,QAAQ;gBACR,OAAO,EAAE,yBAAyB,IAAI,0GAA0G;aACjJ,CAAC;QAEJ,KAAK,aAAa;YAChB,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO;oBACL,OAAO,EAAE,QAAQ;oBACjB,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,IAAI;oBACV,cAAc,EAAE,YAAY;oBAC5B,uBAAuB,EAAE,cAAc;oBACvC,qBAAqB;oBACrB,QAAQ;oBACR,OAAO,EAAE,sBAAsB,IAAI,kEAAkE;iBACtG,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,eAAe;gBACxB,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,IAAI;gBACV,qBAAqB;gBACrB,QAAQ;gBACR,OAAO,EAAE,wBAAwB,IAAI,sEAAsE;aAC5G,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { init as Z3Init } from 'z3-solver';
2
+ export type Z3Context = ReturnType<Awaited<ReturnType<typeof Z3Init>>['Context']>;
3
+ /**
4
+ * Return the shared Z3 Context, initializing WASM on first call.
5
+ * Safe to call from concurrent async paths.
6
+ */
7
+ export declare function getZ3(): Promise<Z3Context>;
8
+ /**
9
+ * Reset the singleton - intended for test teardown only.
10
+ * Do NOT call in production paths; re-init is expensive.
11
+ */
12
+ export declare function resetZ3ForTesting(): void;
13
+ //# sourceMappingURL=rego-z3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rego-z3.d.ts","sourceRoot":"","sources":["../../src/lib/rego-z3.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,WAAW,CAAC;AAKhD,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAKlF;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,CAKhD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Z3 singleton initialization.
3
+ *
4
+ * The z3-solver WASM module takes ~500ms to load and must only be
5
+ * initialized once per process. Concurrent calls safely await the
6
+ * same promise. Each verification call creates its own fresh Solver
7
+ * from the shared Context, so contexts never accumulate stale state.
8
+ */
9
+ import { init } from 'z3-solver';
10
+ // Module-level singleton
11
+ let z3InitPromise = null;
12
+ /**
13
+ * Return the shared Z3 Context, initializing WASM on first call.
14
+ * Safe to call from concurrent async paths.
15
+ */
16
+ export async function getZ3() {
17
+ if (z3InitPromise === null) {
18
+ z3InitPromise = init().then(({ Context }) => Context('main'));
19
+ }
20
+ return z3InitPromise;
21
+ }
22
+ /**
23
+ * Reset the singleton - intended for test teardown only.
24
+ * Do NOT call in production paths; re-init is expensive.
25
+ */
26
+ export function resetZ3ForTesting() {
27
+ z3InitPromise = null;
28
+ }
29
+ //# sourceMappingURL=rego-z3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rego-z3.js","sourceRoot":"","sources":["../../src/lib/rego-z3.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,yBAAyB;AACzB,IAAI,aAAa,GAA4B,IAAI,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3B,aAAa,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,aAAmC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAY9C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAW3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAa9C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAY3E"}
@@ -8,6 +8,7 @@ import { registerRegoInferInputSchema } from './infer-input-schema.js';
8
8
  import { registerRegoPolicyDiff } from './policy-diff.js';
9
9
  import { registerRegoSecurityAudit } from './security-audit.js';
10
10
  import { registerRegoSuggestFix } from './suggest-fix.js';
11
+ import { registerRegoVerify } from './verify.js';
11
12
  export function registerHelperTools(server, config) {
12
13
  registerRegoExplainDecision(server, config);
13
14
  registerRegoGenerateTestSkeleton(server, config);
@@ -19,5 +20,6 @@ export function registerHelperTools(server, config) {
19
20
  registerRegoFix(server, config);
20
21
  registerRegoFormatWrite(server, config);
21
22
  registerRegoPolicyDiff(server, config);
23
+ registerRegoVerify(server, config);
22
24
  }
23
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/helpers/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAc;IACnE,2BAA2B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,gCAAgC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,0BAA0B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,yBAA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,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,4BAA4B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { Config } from '../../config.js';
3
+ export declare function registerRegoVerify(server: McpServer, config: Config): void;
4
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/verify.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAqB9C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA8D1E"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * `rego_verify` -- formal SMT-based policy verification.
3
+ *
4
+ * Uses Microsoft Z3 (via WASM) to mathematically prove or disprove
5
+ * a property about a Rego rule for ALL possible inputs. Returns a
6
+ * concrete counterexample when the property fails.
7
+ */
8
+ import { z } from 'zod';
9
+ import { OpaCli } from '../../lib/opa-cli.js';
10
+ import { err, ok } from '../../lib/errors.js';
11
+ import { mapSubprocessFailure, tryParseJson, withToolEnvelope } from '../../lib/tool-helpers.js';
12
+ import { parseProperty } from '../../lib/rego-property-parser.js';
13
+ import { runVerify } from '../../lib/rego-verify-engine.js';
14
+ const RegoVerifyInput = {
15
+ source: z.string().min(1).describe('Rego source to verify.'),
16
+ rule: z.string().min(1).describe('Name of the rule to verify (e.g. "allow", "deny").'),
17
+ kind: z
18
+ .enum(['always_true', 'never_true', 'satisfiable'])
19
+ .describe('Property to prove:\n' +
20
+ ' always_true - rule is true for every possible input (finds inputs that violate this)\n' +
21
+ ' never_true - rule is never true for any input (finds inputs that trigger it)\n' +
22
+ ' satisfiable - at least one input exists where rule is true (returns a witness)'),
23
+ };
24
+ export function registerRegoVerify(server, config) {
25
+ const opa = new OpaCli(config);
26
+ server.registerTool('rego_verify', {
27
+ title: 'Formally verify a Rego policy rule',
28
+ description: 'Formally verify a property about a Rego rule using SMT solving (Microsoft Z3). ' +
29
+ 'Unlike testing, this checks ALL possible inputs and either proves the property holds or ' +
30
+ 'returns a concrete counterexample input that falsifies it. ' +
31
+ 'Supports equality, comparison, startswith, endswith, contains, regex.match, and multi-clause rules. ' +
32
+ 'Reports INCONCLUSIVE for negation-as-failure (not), comprehensions, and other unsupported constructs.',
33
+ inputSchema: RegoVerifyInput,
34
+ annotations: {
35
+ readOnlyHint: true,
36
+ destructiveHint: false,
37
+ idempotentHint: true,
38
+ openWorldHint: false,
39
+ },
40
+ }, async ({ source, rule, kind }, { signal }) => {
41
+ return withToolEnvelope(config, async () => {
42
+ // Parse property spec
43
+ const { property, errors: propErrors } = parseProperty({ rule, kind });
44
+ if (propErrors.length > 0) {
45
+ return err('INVALID_INPUT', 'Invalid property specification.', {
46
+ details: { errors: propErrors },
47
+ });
48
+ }
49
+ // Parse the Rego source via OPA
50
+ const parseResult = await opa.parse({ source }, signal);
51
+ const subprocessFailure = mapSubprocessFailure(parseResult, 'opa');
52
+ if (subprocessFailure)
53
+ return subprocessFailure;
54
+ if (parseResult.exitCode !== 0) {
55
+ return err('INVALID_REGO', 'opa parse rejected the policy source.', {
56
+ hint: 'Fix syntax errors before verifying.',
57
+ details: { stderr: parseResult.stderr.trim() },
58
+ });
59
+ }
60
+ const ast = tryParseJson(parseResult.stdout);
61
+ if (ast === undefined) {
62
+ return err('UNKNOWN_ERROR', 'opa parse produced no parseable JSON AST.');
63
+ }
64
+ // Run the verification pipeline
65
+ const result = await runVerify(ast, property, signal);
66
+ const warnings = [...result.warnings];
67
+ if (result.unsupportedConstructs.length > 0) {
68
+ warnings.push(`${result.unsupportedConstructs.length} unsupported construct(s) were skipped: ` +
69
+ result.unsupportedConstructs.map((u) => u.constructType).join(', '));
70
+ }
71
+ return ok(result, warnings.length > 0 ? warnings : undefined);
72
+ });
73
+ });
74
+ }
75
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../src/tools/helpers/verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAqB,MAAM,iCAAiC,CAAC;AAG/E,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAC5D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oDAAoD,CAAC;IACtF,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;SAClD,QAAQ,CACP,sBAAsB;QACpB,2FAA2F;QAC3F,oFAAoF;QACpF,mFAAmF,CACtF;CACJ,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,MAAc;IAClE,MAA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,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;iBAC/C,CAAC,CAAC;YACL,CAAC;YAED,MAAM,GAAG,GAAG,YAAY,CAAY,WAAW,CAAC,MAAM,CAAC,CAAC;YACxD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,OAAO,GAAG,CAAC,eAAe,EAAE,2CAA2C,CAAC,CAAC;YAC3E,CAAC;YAED,gCAAgC;YAChC,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,QAAS,EAAE,MAAM,CAAC,CAAC;YAEvD,MAAM,QAAQ,GAAa,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;YAChD,IAAI,MAAM,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5C,QAAQ,CAAC,IAAI,CACX,GAAG,MAAM,CAAC,qBAAqB,CAAC,MAAM,0CAA0C;oBAC9E,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACtE,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,CAAe,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * here in order; ordering doesn't affect behavior but keeps the
6
6
  * declaration site tidy.
7
7
  *
8
- * Tools (48 total):
8
+ * Tools (49 total):
9
9
  * Category A -- Authoring: rego_format, rego_check,
10
10
  * rego_check_schema, rego_lint,
11
11
  * rego_parse_ast, rego_inspect,
@@ -30,7 +30,8 @@
30
30
  * rego_security_audit,
31
31
  * rego_infer_input_schema,
32
32
  * rego_fix, rego_format_write,
33
- * rego_migrate_v1, rego_policy_diff
33
+ * rego_migrate_v1, rego_policy_diff,
34
+ * rego_verify
34
35
  * Category F -- Conftest: conftest_test, conftest_verify,
35
36
  * conftest_pull, conftest_push
36
37
  * Category G -- Meta: mcp_server_info
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAS3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAQrE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAS3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAQrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAA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