arxo-codegen 0.4.0__py3-none-any.whl

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 (152) hide show
  1. arxo_codegen/__init__.py +5 -0
  2. arxo_codegen/__main__.py +7 -0
  3. arxo_codegen/active-outcomes.json +6837 -0
  4. arxo_codegen/check.py +158 -0
  5. arxo_codegen/check_active_canaries.py +262 -0
  6. arxo_codegen/check_api.py +76 -0
  7. arxo_codegen/check_conformance.py +414 -0
  8. arxo_codegen/check_matrix.py +131 -0
  9. arxo_codegen/check_packages.py +281 -0
  10. arxo_codegen/check_semantic_probes.py +293 -0
  11. arxo_codegen/check_xlsx.py +320 -0
  12. arxo_codegen/consumer_runner.py +316 -0
  13. arxo_codegen/core_support.py +203 -0
  14. arxo_codegen/coverage.py +341 -0
  15. arxo_codegen/deliver.py +180 -0
  16. arxo_codegen/examples/xlsx/pricing.lawir.json +409 -0
  17. arxo_codegen/examples/xlsx/pricing.xlsx.json +52 -0
  18. arxo_codegen/excel_plan.py +602 -0
  19. arxo_codegen/harness/verify/ci/gates/backends/check_backends.py +1248 -0
  20. arxo_codegen/harness/verify/ci/gates/backends/l1_fixtures.py +463 -0
  21. arxo_codegen/inert-nodes.json +62 -0
  22. arxo_codegen/inert.py +91 -0
  23. arxo_codegen/inputs.py +59 -0
  24. arxo_codegen/package.py +565 -0
  25. arxo_codegen/plan.py +4053 -0
  26. arxo_codegen/recertify_registry.py +100 -0
  27. arxo_codegen/runtime-cert.json +5259 -0
  28. arxo_codegen/runtime_cert.py +233 -0
  29. arxo_codegen/survey.py +272 -0
  30. arxo_codegen/target_runner.py +101 -0
  31. arxo_codegen/targets/bsl/cert.bsl +113 -0
  32. arxo_codegen/targets/bsl/emit.py +356 -0
  33. arxo_codegen/targets/bsl/json.bsl +243 -0
  34. arxo_codegen/targets/bsl/runner.bsl +210 -0
  35. arxo_codegen/targets/bsl/runtime.bsl +858 -0
  36. arxo_codegen/targets/cs/Cert.cs +90 -0
  37. arxo_codegen/targets/cs/Runner.cs +154 -0
  38. arxo_codegen/targets/cs/Runtime.cs +243 -0
  39. arxo_codegen/targets/cs/emit.py +223 -0
  40. arxo_codegen/targets/dart/cert.dart +99 -0
  41. arxo_codegen/targets/dart/emit.py +206 -0
  42. arxo_codegen/targets/dart/json.dart +166 -0
  43. arxo_codegen/targets/dart/runner.dart +154 -0
  44. arxo_codegen/targets/dart/runtime.dart +293 -0
  45. arxo_codegen/targets/erl/cert.erl +64 -0
  46. arxo_codegen/targets/erl/emit.py +216 -0
  47. arxo_codegen/targets/erl/rt.erl +238 -0
  48. arxo_codegen/targets/erl/runner.erl +130 -0
  49. arxo_codegen/targets/ex/cert.exs +62 -0
  50. arxo_codegen/targets/ex/emit.py +204 -0
  51. arxo_codegen/targets/ex/runner.exs +124 -0
  52. arxo_codegen/targets/ex/runtime.ex +227 -0
  53. arxo_codegen/targets/go/apiBase.go +483 -0
  54. arxo_codegen/targets/go/apicheck.go +97 -0
  55. arxo_codegen/targets/go/cert.go +218 -0
  56. arxo_codegen/targets/go/emit.py +1806 -0
  57. arxo_codegen/targets/go/evaluate.go +1826 -0
  58. arxo_codegen/targets/go/runner.go +38 -0
  59. arxo_codegen/targets/go/runtime.go +2612 -0
  60. arxo_codegen/targets/java/Cert.java +91 -0
  61. arxo_codegen/targets/java/Json.java +148 -0
  62. arxo_codegen/targets/java/Runner.java +151 -0
  63. arxo_codegen/targets/java/Runtime.java +243 -0
  64. arxo_codegen/targets/java/emit.py +198 -0
  65. arxo_codegen/targets/kt/Cert.kt +67 -0
  66. arxo_codegen/targets/kt/Json.kt +103 -0
  67. arxo_codegen/targets/kt/Runner.kt +126 -0
  68. arxo_codegen/targets/kt/Runtime.kt +196 -0
  69. arxo_codegen/targets/kt/emit.py +195 -0
  70. arxo_codegen/targets/lua/cert.lua +82 -0
  71. arxo_codegen/targets/lua/emit.py +250 -0
  72. arxo_codegen/targets/lua/json.lua +133 -0
  73. arxo_codegen/targets/lua/runner.lua +167 -0
  74. arxo_codegen/targets/lua/runtime.lua +541 -0
  75. arxo_codegen/targets/php/cert.php +84 -0
  76. arxo_codegen/targets/php/emit.py +229 -0
  77. arxo_codegen/targets/php/json.php +144 -0
  78. arxo_codegen/targets/php/runner.php +189 -0
  79. arxo_codegen/targets/php/runtime.php +660 -0
  80. arxo_codegen/targets/py/api_base.py +334 -0
  81. arxo_codegen/targets/py/apicheck.py +51 -0
  82. arxo_codegen/targets/py/cert.py +140 -0
  83. arxo_codegen/targets/py/emit.py +1140 -0
  84. arxo_codegen/targets/py/evaluate.py +980 -0
  85. arxo_codegen/targets/py/runner.py +38 -0
  86. arxo_codegen/targets/py/runtime.py +1634 -0
  87. arxo_codegen/targets/rb/cert.rb +73 -0
  88. arxo_codegen/targets/rb/emit.py +203 -0
  89. arxo_codegen/targets/rb/runner.rb +130 -0
  90. arxo_codegen/targets/rb/runtime.rb +255 -0
  91. arxo_codegen/targets/rs/Cargo.lock +142 -0
  92. arxo_codegen/targets/rs/Cargo.toml +16 -0
  93. arxo_codegen/targets/rs/cert.rs +106 -0
  94. arxo_codegen/targets/rs/emit.py +233 -0
  95. arxo_codegen/targets/rs/prefetch.rs +1 -0
  96. arxo_codegen/targets/rs/runner.rs +181 -0
  97. arxo_codegen/targets/rs/runtime.rs +448 -0
  98. arxo_codegen/targets/scala/Cert.scala +77 -0
  99. arxo_codegen/targets/scala/Json.scala +140 -0
  100. arxo_codegen/targets/scala/Runner.scala +121 -0
  101. arxo_codegen/targets/scala/Runtime.scala +269 -0
  102. arxo_codegen/targets/scala/emit.py +193 -0
  103. arxo_codegen/targets/swift/cert.swift +105 -0
  104. arxo_codegen/targets/swift/emit.py +231 -0
  105. arxo_codegen/targets/swift/json.swift +208 -0
  106. arxo_codegen/targets/swift/runner.swift +133 -0
  107. arxo_codegen/targets/swift/runtime.swift +528 -0
  108. arxo_codegen/targets/ts/apiBase.ts +250 -0
  109. arxo_codegen/targets/ts/apicheck.ts +37 -0
  110. arxo_codegen/targets/ts/cert.ts +96 -0
  111. arxo_codegen/targets/ts/emit.py +1214 -0
  112. arxo_codegen/targets/ts/evaluate.ts +894 -0
  113. arxo_codegen/targets/ts/package-lock.json +45 -0
  114. arxo_codegen/targets/ts/package.json +9 -0
  115. arxo_codegen/targets/ts/runner.ts +31 -0
  116. arxo_codegen/targets/ts/runtime.ts +1369 -0
  117. arxo_codegen/targets/xlsx/README.ru.md +176 -0
  118. arxo_codegen/targets/xlsx/emit.py +198 -0
  119. arxo_codegen/temporal.py +59 -0
  120. arxo_codegen/test_alias_types.py +171 -0
  121. arxo_codegen/test_api_contract.py +89 -0
  122. arxo_codegen/test_calendar_policy.py +48 -0
  123. arxo_codegen/test_check.py +49 -0
  124. arxo_codegen/test_check_active_canaries.py +96 -0
  125. arxo_codegen/test_check_conformance.py +132 -0
  126. arxo_codegen/test_check_semantic_probes.py +85 -0
  127. arxo_codegen/test_check_xlsx.py +52 -0
  128. arxo_codegen/test_consumer_runner.py +175 -0
  129. arxo_codegen/test_core_support.py +80 -0
  130. arxo_codegen/test_e0212_decision_time.py +63 -0
  131. arxo_codegen/test_head_aggregate.py +71 -0
  132. arxo_codegen/test_inert.py +143 -0
  133. arxo_codegen/test_instant_types.py +113 -0
  134. arxo_codegen/test_key_conflict_scope.py +92 -0
  135. arxo_codegen/test_key_conflict_targets.py +17 -0
  136. arxo_codegen/test_package_layout.py +163 -0
  137. arxo_codegen/test_plan_language_version.py +44 -0
  138. arxo_codegen/test_positions_refusal.py +43 -0
  139. arxo_codegen/test_recertify_registry.py +77 -0
  140. arxo_codegen/test_ruby_target.py +41 -0
  141. arxo_codegen/test_runtime_cert.py +83 -0
  142. arxo_codegen/test_secondary_key_conflict_scope.py +17 -0
  143. arxo_codegen/test_stage_r.py +108 -0
  144. arxo_codegen/test_standalone_inputs.py +71 -0
  145. arxo_codegen/test_support.py +150 -0
  146. arxo_codegen/test_survey_inputs.py +115 -0
  147. arxo_codegen-0.4.0.dist-info/LICENSE +202 -0
  148. arxo_codegen-0.4.0.dist-info/METADATA +1673 -0
  149. arxo_codegen-0.4.0.dist-info/RECORD +152 -0
  150. arxo_codegen-0.4.0.dist-info/WHEEL +5 -0
  151. arxo_codegen-0.4.0.dist-info/entry_points.txt +13 -0
  152. arxo_codegen-0.4.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,180 @@
1
+ #!/usr/bin/env python3
2
+ """Поставка порождённого модуля: пакет печатается в каталог с рантаймом,
3
+ раннером, планом и паспортом — то, что можно отдать потребителю без движка.
4
+
5
+ python3 engines/backends/deliver.py <ir.json> --target ts --out DIR
6
+ python3 engines/backends/deliver.py <ir.json> --target ts --target go --out DIR
7
+
8
+ Состав каталога цели задаёт дескриптор цели (`targets/<цель>/emit.py`:
9
+ `MODEL`, `layout`, `build`, `run`, `available`): модель, рантайм, раннер и
10
+ файлы сборки языка, плюс `plan.json` и паспорт `law-backend.json`:
11
+ формат `law.backend-delivery/1`, версия плана, цель, паспорт пакета из
12
+ CLIR, семантический хэш §209 самого CLIR (в снимках поле `semanticHash`
13
+ бывает нулевым, поэтому считается здесь) и SHA-256 каждого файла. Паспорт
14
+ связывает модуль с каноном: тот же хэш стоит у пакета в реестре и профилях.
15
+
16
+ Отказ плана — отказ поставки с названной причиной и кодом 2: печатать
17
+ «меньше пакета» нельзя, это был бы другой ответ.
18
+ """
19
+ from __future__ import annotations
20
+
21
+ import argparse
22
+ import hashlib
23
+ import importlib.util
24
+ import json
25
+ import sys
26
+ from pathlib import Path
27
+
28
+ HERE = Path(__file__).resolve().parent
29
+ ROOT = HERE.parents[1]
30
+ sys.path.insert(0, str(HERE))
31
+ import plan as P # noqa: E402
32
+ from core_support import CoreKitError # noqa: E402
33
+
34
+ FORMAT = "law.backend-delivery/1"
35
+
36
+
37
+ def targets(protocol: str | None = None) -> list[str]:
38
+ """Цели — каталоги `targets/<цель>/` с эмиттером, в устойчивом порядке."""
39
+ names = sorted(p.name for p in (HERE / "targets").iterdir() if (p / "emit.py").exists())
40
+ return [n for n in names if protocol is None or getattr(emitter(n), "PROTOCOL", "runner") == protocol]
41
+
42
+
43
+ def emitter(lang: str):
44
+ path = HERE / "targets" / lang / "emit.py"
45
+ if not path.exists():
46
+ raise SystemExit(f"deliver: цели {lang} нет в {HERE / 'targets'}")
47
+ spec = importlib.util.spec_from_file_location(f"emit_{lang}", path)
48
+ mod = importlib.util.module_from_spec(spec)
49
+ spec.loader.exec_module(mod)
50
+ return mod
51
+
52
+
53
+ def semantic_hash(ir: dict) -> str:
54
+ from core_support import semantic_hash as sh
55
+ return sh(ir)
56
+
57
+
58
+ def missing_capabilities(pl: dict, em) -> list[str]:
59
+ """Возможности плана (DECISION-0237), которых цель не объявляет в
60
+ дескрипторе `CAPABILITIES`; цель без объявления печатает только L0."""
61
+ return sorted(set(pl.get("capabilities") or ()) - set(getattr(em, "CAPABILITIES", ())))
62
+
63
+
64
+ def emit_project(pl: dict, lang: str, out: Path, main: str = "runner", options: dict | None = None) -> list[Path]:
65
+ """Файлы одной цели в каталог; возвращает список записанных путей.
66
+ Возможности плана сверяются с дескриптором ДО записи первого файла:
67
+ цель, не умеющая поражаемый слой, отказывает названной причиной, а не
68
+ печатает модель, молча читающую L1-план как L0."""
69
+ em = emitter(lang)
70
+ missing = missing_capabilities(pl, em)
71
+ if missing:
72
+ raise P.Refused(f"цель {lang} не поддерживает возможности плана: {', '.join(missing)}")
73
+ # Workbook targets have a bounded input contract and no JSON runner.
74
+ # Prepare everything before touching the destination, including refusals.
75
+ if getattr(em, "PROTOCOL", "runner") == "workbook":
76
+ if main != "runner":
77
+ raise P.Refused(f"цель {lang}: протокол workbook, нет раннера {main}")
78
+ artifacts = em.artifacts(pl, options)
79
+ out = Path(out)
80
+ out.mkdir(parents=True, exist_ok=True)
81
+ written = []
82
+ for name, data in artifacts.items():
83
+ path = out / name
84
+ path.write_bytes(data)
85
+ written.append(path)
86
+ return written
87
+ out = Path(out)
88
+ out.mkdir(parents=True, exist_ok=True)
89
+ written = em.layout(out, main)
90
+ if main == "runner":
91
+ model = out / em.MODEL
92
+ model.parent.mkdir(parents=True, exist_ok=True)
93
+ model.write_text(em.emit(pl), encoding="utf-8")
94
+ written.append(model)
95
+ # Поверхность API (DECISION-0234): именованные функции над моделью.
96
+ # Печатает только цель с `API`/`emit_api`; остальные отдают модуль
97
+ # без обёртки — это не «меньше ответа», обёртка семантики не несёт.
98
+ if getattr(em, "API", None) and hasattr(em, "emit_api"):
99
+ api = out / em.API
100
+ api.write_text(em.emit_api(pl), encoding="utf-8")
101
+ written.append(api)
102
+ return written
103
+
104
+
105
+ def deliver(ir: dict, lang: str, out: Path, world: list | None = None, options: dict | None = None,
106
+ resources: dict | None = None) -> dict:
107
+ """Поставка одной цели с паспортом; план строится один раз на вызов.
108
+ `world` — CLIR зависимостей (DECISION-0236): без него пакет с импортом
109
+ отказывает планом."""
110
+ pl = P.build_plan(ir, world, resources=resources)
111
+ out = Path(out)
112
+ digest = semantic_hash(ir)
113
+ if getattr(emitter(lang), "PROTOCOL", "runner") == "workbook":
114
+ if options is not None and not isinstance(options, dict):
115
+ raise P.Refused("конфигурация workbook должна быть объектом")
116
+ options = dict(options or {}, semanticHash=digest)
117
+ files = emit_project(pl, lang, out, options=options)
118
+ (out / "plan.json").write_text(json.dumps(pl, ensure_ascii=False, indent=1) + "\n", encoding="utf-8")
119
+ files.append(out / "plan.json")
120
+ passport = {
121
+ "format": FORMAT,
122
+ "planVersion": pl["planVersion"],
123
+ "target": lang,
124
+ "package": ir.get("package"),
125
+ "semanticHash": digest,
126
+ "world": pl.get("world", []),
127
+ "profile": getattr(emitter(lang), "PROFILE", "core-executable"),
128
+ "files": {f.relative_to(out).as_posix(): "sha256:" + hashlib.sha256(f.read_bytes()).hexdigest()
129
+ for f in sorted(files)},
130
+ }
131
+ (out / "law-backend.json").write_text(json.dumps(passport, ensure_ascii=False, indent=1) + "\n",
132
+ encoding="utf-8")
133
+ return passport
134
+
135
+
136
+ def main() -> int:
137
+ ap = argparse.ArgumentParser()
138
+ ap.add_argument("ir", type=Path, help="CLIR пакета (*.lawir.json)")
139
+ ap.add_argument("--target", action="append", choices=targets(), required=True)
140
+ ap.add_argument("--out", type=Path, required=True, help="каталог поставки; цели в подкаталогах")
141
+ ap.add_argument("--dep", type=Path, action="append", default=[],
142
+ help="CLIR зависимости (можно повторять)")
143
+ ap.add_argument("--corpus-root", type=Path,
144
+ help="явный корень corpus/clir и packs для переходного адаптера law-dsl")
145
+ ap.add_argument("--resources", type=Path,
146
+ help="JSON: URI → {path, sha256}; пути относительно JSON")
147
+ ap.add_argument("--core-kit", type=Path, help="проверенный комплект поддержки ядра")
148
+ ap.add_argument("--xlsx-config", type=Path, help="границы и начальные данные Excel (excel-calculator/0.1)")
149
+ args = ap.parse_args()
150
+ if args.core_kit:
151
+ import os
152
+ os.environ["LAW_CODEGEN_CORE_KIT"] = str(args.core_kit.resolve())
153
+ if args.xlsx_config and "xlsx" not in args.target:
154
+ ap.error("--xlsx-config требует --target xlsx")
155
+ ir = json.loads(args.ir.read_text(encoding="utf-8"))
156
+ try:
157
+ extra = [json.loads(p.read_text(encoding="utf-8")) for p in args.dep]
158
+ from inputs import dependency_index, load_resources, corpus_resources
159
+ index = P.world_index(args.corpus_root) if args.corpus_root else {}
160
+ # Validate explicit dependencies even when the root has no imports.
161
+ dependency_index(extra)
162
+ world = P.resolve_world(ir, index, extra) if ir.get("imports") else []
163
+ resources = load_resources(args.resources) if args.resources else (corpus_resources([ir, *world], args.corpus_root) if args.corpus_root else {})
164
+ config = json.loads(args.xlsx_config.read_text(encoding="utf-8")) if args.xlsx_config else None
165
+ for lang in args.target:
166
+ passport = deliver(ir, lang, args.out / lang, world, config if lang == "xlsx" else None,
167
+ resources=resources)
168
+ print(f"deliver: {lang} → {args.out / lang} ({passport['package'].get('name')}, "
169
+ f"{passport['semanticHash'][:19]}…)")
170
+ except P.Refused as exc:
171
+ print(f"deliver: отказ плана — {exc}", file=sys.stderr)
172
+ return 2
173
+ except CoreKitError as exc:
174
+ print(f"deliver: ошибка комплекта ядра — {exc}", file=sys.stderr)
175
+ return 1
176
+ return 0
177
+
178
+
179
+ if __name__ == "__main__":
180
+ raise SystemExit(main())
@@ -0,0 +1,409 @@
1
+ {
2
+ "schemaVersion": "law.core.ir/0.2",
3
+ "semanticVersion": "0.1.1",
4
+ "features": [
5
+ "core-executable"
6
+ ],
7
+ "imports": [],
8
+ "metadata": {},
9
+ "strata": [],
10
+ "package": {
11
+ "name": "example.excel",
12
+ "namespace": "urn:law:example:excel",
13
+ "version": "0.1.0"
14
+ },
15
+ "nodes": [
16
+ {
17
+ "id": "urn:law:example:excel#quote",
18
+ "kind": "symbol_decl",
19
+ "symbolKind": "relation",
20
+ "name": "quote",
21
+ "package": "urn:law:example:excel",
22
+ "relationKind": "institutional",
23
+ "keys": [],
24
+ "parameters": [
25
+ {
26
+ "id": "urn:law:example:excel#quote/arg/0",
27
+ "name": "arg0",
28
+ "type": {
29
+ "name": "urn:law:std#Text"
30
+ }
31
+ },
32
+ {
33
+ "id": "urn:law:example:excel#quote/arg/1",
34
+ "name": "arg1",
35
+ "type": {
36
+ "name": "urn:law:std#Text"
37
+ }
38
+ },
39
+ {
40
+ "id": "urn:law:example:excel#quote/arg/2",
41
+ "name": "arg2",
42
+ "type": {
43
+ "name": "urn:law:std#Money"
44
+ }
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "id": "urn:law:example:excel#rate",
50
+ "kind": "symbol_decl",
51
+ "symbolKind": "relation",
52
+ "name": "rate",
53
+ "package": "urn:law:example:excel",
54
+ "relationKind": "institutional",
55
+ "keys": [],
56
+ "parameters": [
57
+ {
58
+ "id": "urn:law:example:excel#rate/arg/0",
59
+ "name": "arg0",
60
+ "type": {
61
+ "name": "urn:law:std#Text"
62
+ }
63
+ },
64
+ {
65
+ "id": "urn:law:example:excel#rate/arg/1",
66
+ "name": "arg1",
67
+ "type": {
68
+ "name": "urn:law:std#Decimal"
69
+ }
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "id": "urn:law:example:excel#premium",
75
+ "kind": "symbol_decl",
76
+ "symbolKind": "relation",
77
+ "name": "premium",
78
+ "package": "urn:law:example:excel",
79
+ "relationKind": "institutional",
80
+ "keys": [
81
+ [
82
+ 0
83
+ ]
84
+ ],
85
+ "parameters": [
86
+ {
87
+ "id": "urn:law:example:excel#premium/arg/0",
88
+ "name": "arg0",
89
+ "type": {
90
+ "name": "urn:law:std#Text"
91
+ }
92
+ },
93
+ {
94
+ "id": "urn:law:example:excel#premium/arg/1",
95
+ "name": "arg1",
96
+ "type": {
97
+ "name": "urn:law:std#Money"
98
+ }
99
+ }
100
+ ]
101
+ },
102
+ {
103
+ "id": "urn:law:example:excel#Rate0",
104
+ "kind": "assertion",
105
+ "package": "urn:law:example:excel",
106
+ "literal": {
107
+ "kind": "literal",
108
+ "predicate": "urn:law:example:excel#rate",
109
+ "polarity": "positive",
110
+ "args": [
111
+ {
112
+ "kind": "value",
113
+ "type": {
114
+ "name": "urn:law:std#Text"
115
+ },
116
+ "value": "A"
117
+ },
118
+ {
119
+ "kind": "value",
120
+ "type": {
121
+ "name": "urn:law:std#Decimal"
122
+ },
123
+ "value": "1.10"
124
+ }
125
+ ]
126
+ },
127
+ "origin": "source_asserted",
128
+ "evidence": []
129
+ },
130
+ {
131
+ "id": "urn:law:example:excel#Rate1",
132
+ "kind": "assertion",
133
+ "package": "urn:law:example:excel",
134
+ "literal": {
135
+ "kind": "literal",
136
+ "predicate": "urn:law:example:excel#rate",
137
+ "polarity": "positive",
138
+ "args": [
139
+ {
140
+ "kind": "value",
141
+ "type": {
142
+ "name": "urn:law:std#Text"
143
+ },
144
+ "value": "B"
145
+ },
146
+ {
147
+ "kind": "value",
148
+ "type": {
149
+ "name": "urn:law:std#Decimal"
150
+ },
151
+ "value": "1.25"
152
+ }
153
+ ]
154
+ },
155
+ "origin": "source_asserted",
156
+ "evidence": []
157
+ },
158
+ {
159
+ "id": "urn:law:example:excel#Price",
160
+ "kind": "rule",
161
+ "package": "urn:law:example:excel",
162
+ "strength": "strict",
163
+ "head": {
164
+ "kind": "literal",
165
+ "predicate": "urn:law:example:excel#premium",
166
+ "polarity": "positive",
167
+ "args": [
168
+ {
169
+ "kind": "var",
170
+ "var": "I"
171
+ },
172
+ {
173
+ "kind": "call",
174
+ "function": "urn:law:std#round",
175
+ "args": [
176
+ {
177
+ "kind": "binary",
178
+ "op": "mul",
179
+ "left": {
180
+ "kind": "var",
181
+ "var": "B"
182
+ },
183
+ "right": {
184
+ "kind": "var",
185
+ "var": "K"
186
+ }
187
+ },
188
+ {
189
+ "kind": "value",
190
+ "type": {
191
+ "name": "urn:law:std#Integer"
192
+ },
193
+ "value": 2
194
+ },
195
+ {
196
+ "kind": "value",
197
+ "type": {
198
+ "name": "urn:law:std#Text"
199
+ },
200
+ "value": "HALF_UP"
201
+ }
202
+ ]
203
+ }
204
+ ]
205
+ },
206
+ "body": {
207
+ "kind": "and",
208
+ "items": [
209
+ {
210
+ "kind": "status",
211
+ "status": "established",
212
+ "formula": {
213
+ "kind": "literal",
214
+ "predicate": "urn:law:example:excel#quote",
215
+ "polarity": "positive",
216
+ "args": [
217
+ {
218
+ "kind": "var",
219
+ "var": "I"
220
+ },
221
+ {
222
+ "kind": "var",
223
+ "var": "C"
224
+ },
225
+ {
226
+ "kind": "var",
227
+ "var": "B"
228
+ }
229
+ ]
230
+ }
231
+ },
232
+ {
233
+ "kind": "status",
234
+ "status": "established",
235
+ "formula": {
236
+ "kind": "literal",
237
+ "predicate": "urn:law:example:excel#rate",
238
+ "polarity": "positive",
239
+ "args": [
240
+ {
241
+ "kind": "var",
242
+ "var": "C"
243
+ },
244
+ {
245
+ "kind": "var",
246
+ "var": "K"
247
+ }
248
+ ]
249
+ }
250
+ },
251
+ {
252
+ "kind": "comparison",
253
+ "op": "ge",
254
+ "left": {
255
+ "kind": "var",
256
+ "var": "B"
257
+ },
258
+ "right": {
259
+ "kind": "value",
260
+ "type": {
261
+ "name": "urn:law:std#Money"
262
+ },
263
+ "value": "0",
264
+ "currency": "KZT"
265
+ }
266
+ }
267
+ ]
268
+ },
269
+ "variables": [],
270
+ "scope": {
271
+ "kind": "boolean",
272
+ "value": true
273
+ },
274
+ "interpretations": [],
275
+ "effective": {
276
+ "axis": "legal_time",
277
+ "start": "2026-01-01",
278
+ "end": "2027-01-01",
279
+ "startInclusive": true,
280
+ "endInclusive": false
281
+ }
282
+ },
283
+ {
284
+ "id": "urn:law:example:excel#PriceAgain",
285
+ "kind": "rule",
286
+ "package": "urn:law:example:excel",
287
+ "strength": "strict",
288
+ "head": {
289
+ "kind": "literal",
290
+ "predicate": "urn:law:example:excel#premium",
291
+ "polarity": "positive",
292
+ "args": [
293
+ {
294
+ "kind": "var",
295
+ "var": "I"
296
+ },
297
+ {
298
+ "kind": "call",
299
+ "function": "urn:law:std#round",
300
+ "args": [
301
+ {
302
+ "kind": "binary",
303
+ "op": "mul",
304
+ "left": {
305
+ "kind": "var",
306
+ "var": "B"
307
+ },
308
+ "right": {
309
+ "kind": "var",
310
+ "var": "K"
311
+ }
312
+ },
313
+ {
314
+ "kind": "value",
315
+ "type": {
316
+ "name": "urn:law:std#Integer"
317
+ },
318
+ "value": 2
319
+ },
320
+ {
321
+ "kind": "value",
322
+ "type": {
323
+ "name": "urn:law:std#Text"
324
+ },
325
+ "value": "HALF_UP"
326
+ }
327
+ ]
328
+ }
329
+ ]
330
+ },
331
+ "body": {
332
+ "kind": "and",
333
+ "items": [
334
+ {
335
+ "kind": "status",
336
+ "status": "established",
337
+ "formula": {
338
+ "kind": "literal",
339
+ "predicate": "urn:law:example:excel#quote",
340
+ "polarity": "positive",
341
+ "args": [
342
+ {
343
+ "kind": "var",
344
+ "var": "I"
345
+ },
346
+ {
347
+ "kind": "var",
348
+ "var": "C"
349
+ },
350
+ {
351
+ "kind": "var",
352
+ "var": "B"
353
+ }
354
+ ]
355
+ }
356
+ },
357
+ {
358
+ "kind": "status",
359
+ "status": "established",
360
+ "formula": {
361
+ "kind": "literal",
362
+ "predicate": "urn:law:example:excel#rate",
363
+ "polarity": "positive",
364
+ "args": [
365
+ {
366
+ "kind": "var",
367
+ "var": "C"
368
+ },
369
+ {
370
+ "kind": "var",
371
+ "var": "K"
372
+ }
373
+ ]
374
+ }
375
+ },
376
+ {
377
+ "kind": "comparison",
378
+ "op": "ge",
379
+ "left": {
380
+ "kind": "var",
381
+ "var": "B"
382
+ },
383
+ "right": {
384
+ "kind": "value",
385
+ "type": {
386
+ "name": "urn:law:std#Money"
387
+ },
388
+ "value": "0",
389
+ "currency": "KZT"
390
+ }
391
+ }
392
+ ]
393
+ },
394
+ "variables": [],
395
+ "scope": {
396
+ "kind": "boolean",
397
+ "value": true
398
+ },
399
+ "interpretations": [],
400
+ "effective": {
401
+ "axis": "legal_time",
402
+ "start": "2026-01-01",
403
+ "end": "2027-01-01",
404
+ "startInclusive": true,
405
+ "endInclusive": false
406
+ }
407
+ }
408
+ ]
409
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "profile": "excel-calculator/0.1",
3
+ "currency": "KZT",
4
+ "legalTime": "2026-09-15",
5
+ "tables": {
6
+ "urn:law:example:excel#quote": {
7
+ "rows": 2,
8
+ "values": [
9
+ [
10
+ "POLICY-1",
11
+ "A",
12
+ "100.05"
13
+ ]
14
+ ],
15
+ "scales": [
16
+ 0,
17
+ 0,
18
+ 2
19
+ ],
20
+ "label": "Данные расчёта",
21
+ "columns": [
22
+ "Полис",
23
+ "Категория",
24
+ "Базовая сумма, KZT"
25
+ ]
26
+ },
27
+ "urn:law:example:excel#rate": {
28
+ "rows": 0,
29
+ "scales": [
30
+ 0,
31
+ 2
32
+ ],
33
+ "label": "Коэффициенты примера",
34
+ "columns": [
35
+ "Категория",
36
+ "Коэффициент"
37
+ ]
38
+ },
39
+ "urn:law:example:excel#premium": {
40
+ "rows": 0,
41
+ "scales": [
42
+ 0,
43
+ 2
44
+ ],
45
+ "label": "Расчётная сумма",
46
+ "columns": [
47
+ "Полис",
48
+ "Сумма, KZT"
49
+ ]
50
+ }
51
+ }
52
+ }