core-runtime-engine 11.5.1__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 (96) hide show
  1. core_runtime/__init__.py +10 -0
  2. core_runtime/__version__.py +17 -0
  3. core_runtime/cli/__init__.py +7 -0
  4. core_runtime/cli/__main__.py +22 -0
  5. core_runtime/cli/bump_version.py +176 -0
  6. core_runtime/cli/contract_preflight.py +69 -0
  7. core_runtime/cli/create_domain.py +66 -0
  8. core_runtime/cli/doctor.py +44 -0
  9. core_runtime/cli/inventory.py +85 -0
  10. core_runtime/cli/lint.py +8 -0
  11. core_runtime/cli/main.py +579 -0
  12. core_runtime/cli/release_check.py +65 -0
  13. core_runtime/cli/repair_artifact_paths.py +48 -0
  14. core_runtime/cli/sync_template.py +67 -0
  15. core_runtime/cli/validate.py +73 -0
  16. core_runtime/core/__init__.py +34 -0
  17. core_runtime/core/audit_event.py +760 -0
  18. core_runtime/core/audit_trail_index.py +100 -0
  19. core_runtime/core/canonicalization.py +55 -0
  20. core_runtime/core/contract_evaluator.py +945 -0
  21. core_runtime/core/contract_executability.py +307 -0
  22. core_runtime/core/contract_loader.py +57 -0
  23. core_runtime/core/contract_probes.py +630 -0
  24. core_runtime/core/contract_program.py +131 -0
  25. core_runtime/core/contract_program_registry.py +104 -0
  26. core_runtime/core/contract_program_v2.py +126 -0
  27. core_runtime/core/dsk_v3.py +142 -0
  28. core_runtime/core/explainability.py +2115 -0
  29. core_runtime/core/numeric_normalization.py +120 -0
  30. core_runtime/core/rule_anchor.py +1388 -0
  31. core_runtime/core/schema_fingerprint.py +69 -0
  32. core_runtime/core/sensor_evidence.py +548 -0
  33. core_runtime/data/contracts/CoreAnchor.sol +109 -0
  34. core_runtime/data/contracts/CoreRuleAnchor.abi.json +111 -0
  35. core_runtime/data/contracts/CoreRuleAnchor.bin +1 -0
  36. core_runtime/data/contracts/CoreRuleAnchor.build.json +20 -0
  37. core_runtime/data/contracts/CoreRuleAnchor.runtime.bin +1 -0
  38. core_runtime/data/contracts/CoreRuleAnchor.sol +74 -0
  39. core_runtime/data/package_data_manifest.v1.json +173 -0
  40. core_runtime/data/schemas/core/causal_trace.v1.json +141 -0
  41. core_runtime/data/schemas/core/context_gate.v1.json +38 -0
  42. core_runtime/data/schemas/core/context_threshold.v1.json +46 -0
  43. core_runtime/data/schemas/core/contract_program.v1.json +186 -0
  44. core_runtime/data/schemas/core/contract_program.v2.json +187 -0
  45. core_runtime/data/schemas/core/control_decision.v1.json +114 -0
  46. core_runtime/data/schemas/core/dsk.v3.json +105 -0
  47. core_runtime/data/schemas/core/effect_result.v1.json +39 -0
  48. core_runtime/data/schemas/core/entropy_signal.v1.json +108 -0
  49. core_runtime/data/schemas/core/execution_receipt.v1.json +93 -0
  50. core_runtime/data/schemas/core/frozen_release_manifest.v1.json +87 -0
  51. core_runtime/data/schemas/core/frozen_release_manifest.v2.json +72 -0
  52. core_runtime/data/schemas/core/frozen_release_manifest.v3.json +38 -0
  53. core_runtime/data/schemas/core/frozen_release_manifest.v4.json +72 -0
  54. core_runtime/data/schemas/core/frozen_release_manifest.v5.json +38 -0
  55. core_runtime/data/schemas/core/frozen_release_manifest.v6.json +116 -0
  56. core_runtime/data/schemas/core/frozen_release_manifest.v7.json +37 -0
  57. core_runtime/data/schemas/core/frozen_release_manifest.v8.json +114 -0
  58. core_runtime/data/schemas/core/frozen_rule_set.v1.json +282 -0
  59. core_runtime/data/schemas/core/memory_artifact.v1.json +120 -0
  60. core_runtime/data/schemas/core/memory_generation_result.v1.json +37 -0
  61. core_runtime/data/schemas/core/operational_learning_event.v1.json +63 -0
  62. core_runtime/data/schemas/core/pattern_candidate.v1.json +114 -0
  63. core_runtime/data/schemas/core/physical_safety_assurance_case.v1.json +676 -0
  64. core_runtime/data/schemas/core/policy_lifecycle.v1.json +99 -0
  65. core_runtime/data/schemas/core/retention_manifest.v1.json +53 -0
  66. core_runtime/data/schemas/core/reversibility_policy.v1.json +107 -0
  67. core_runtime/data/schemas/core/rule_anchor_batch.v1.json +93 -0
  68. core_runtime/data/schemas/core/rule_anchor_chain_evidence.v1.json +56 -0
  69. core_runtime/data/schemas/core/rule_approval.v1.json +49 -0
  70. core_runtime/data/schemas/core/rule_approval_request.v1.json +42 -0
  71. core_runtime/data/schemas/core/state_transition.v1.json +115 -0
  72. core_runtime/data/schemas/core/task_closeout.v1.json +47 -0
  73. core_runtime/data/schemas/core/template_promotion_candidate.v1.json +83 -0
  74. core_runtime/data/schemas/core/unsigned_rule_anchor_deployment.v1.json +106 -0
  75. core_runtime/data/schemas/core/unsigned_rule_anchor_transaction.v1.json +116 -0
  76. core_runtime/tooling/__init__.py +48 -0
  77. core_runtime/tooling/bump_version.py +900 -0
  78. core_runtime/tooling/contract_preflight.py +293 -0
  79. core_runtime/tooling/create_domain.py +254 -0
  80. core_runtime/tooling/diagnostics.py +129 -0
  81. core_runtime/tooling/doctor.py +482 -0
  82. core_runtime/tooling/file_inventory.py +182 -0
  83. core_runtime/tooling/json_checks.py +100 -0
  84. core_runtime/tooling/release_check.py +1017 -0
  85. core_runtime/tooling/repair_artifact_paths.py +458 -0
  86. core_runtime/tooling/report_writer.py +176 -0
  87. core_runtime/tooling/repository_inventory.py +399 -0
  88. core_runtime/tooling/safety_checks.py +172 -0
  89. core_runtime/tooling/sync_template.py +303 -0
  90. core_runtime/tooling/validation.py +507 -0
  91. core_runtime/tooling/version_inventory.py +256 -0
  92. core_runtime_engine-11.5.1.dist-info/METADATA +35 -0
  93. core_runtime_engine-11.5.1.dist-info/RECORD +96 -0
  94. core_runtime_engine-11.5.1.dist-info/WHEEL +5 -0
  95. core_runtime_engine-11.5.1.dist-info/entry_points.txt +2 -0
  96. core_runtime_engine-11.5.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,100 @@
1
+ """JSON parse checks - validate JSON files parse correctly."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+
8
+ from core_runtime.tooling.diagnostics import DiagnosticCollection
9
+
10
+
11
+ class JSONChecks:
12
+ """Check that JSON files parse correctly."""
13
+
14
+ def __init__(self, repo_root: Path):
15
+ self.repo_root = repo_root
16
+
17
+ def check_schemas(self, diagnostics: DiagnosticCollection) -> tuple[int, int]:
18
+ """Check all schema JSON files."""
19
+ schemas_dir = self.repo_root / "schemas"
20
+ if not schemas_dir.is_dir():
21
+ diagnostics.add_blocked(
22
+ code="core.json.schemas_dir_missing",
23
+ message="schemas/ directory not found",
24
+ path="schemas/",
25
+ )
26
+ return 0, 0
27
+
28
+ checked = 0
29
+ errors = 0
30
+ for json_file in schemas_dir.glob("*.json"):
31
+ checked += 1
32
+ if not self._check_json_file(json_file, diagnostics, "schemas"):
33
+ errors += 1
34
+ return checked, errors
35
+
36
+ def check_examples(self, diagnostics: DiagnosticCollection) -> tuple[int, int]:
37
+ """Check example JSON files."""
38
+ examples_dir = self.repo_root / "examples"
39
+ if not examples_dir.is_dir():
40
+ diagnostics.add_blocked(
41
+ code="core.json.examples_dir_missing",
42
+ message="examples/ directory not found",
43
+ path="examples/",
44
+ )
45
+ return 0, 0
46
+
47
+ checked = 0
48
+ errors = 0
49
+ # Limit to avoid very long runs; focus on key areas
50
+ for json_file in examples_dir.rglob("*.json"):
51
+ # Skip some large generated directories
52
+ rel = json_file.relative_to(self.repo_root)
53
+ if any(skip in str(rel) for skip in [".pycache", "core_protocol_model/candidate_outputs_v1", "core_protocol_model/model_artifacts_v1"]):
54
+ continue
55
+ checked += 1
56
+ if not self._check_json_file(json_file, diagnostics, "examples"):
57
+ errors += 1
58
+ return checked, errors
59
+
60
+ def _check_json_file(self, json_file: Path, diagnostics: DiagnosticCollection, category: str) -> bool:
61
+ """Check a single JSON file. Returns True if valid."""
62
+ try:
63
+ with json_file.open("r", encoding="utf-8") as f:
64
+ json.load(f)
65
+ return True
66
+ except json.JSONDecodeError as e:
67
+ rel = json_file.relative_to(self.repo_root)
68
+ diagnostics.add_error(
69
+ code="core.json.invalid",
70
+ message="Invalid JSON in {0}: {1}".format(rel, e.msg),
71
+ path=str(rel),
72
+ details="line {0}, column {1}: {2}".format(e.lineno, e.colno, e.msg),
73
+ )
74
+ return False
75
+ except OSError as e:
76
+ rel = json_file.relative_to(self.repo_root)
77
+ diagnostics.add_error(
78
+ code="core.json.unreadable",
79
+ message="Cannot read JSON file {0}: {1}".format(rel, e),
80
+ path=str(rel),
81
+ )
82
+ return False
83
+
84
+ def check_requirements_lock(self, diagnostics: DiagnosticCollection) -> bool:
85
+ """Check requirements.lock is valid JSON (if it is JSON)."""
86
+ lock_file = self.repo_root / "requirements.lock"
87
+ if not lock_file.exists():
88
+ return False
89
+ # requirements.lock is a pip lockfile (text), not JSON
90
+ # We just check it's readable
91
+ try:
92
+ lock_file.read_text(encoding="utf-8")
93
+ return True
94
+ except OSError as e:
95
+ diagnostics.add_error(
96
+ code="core.file.unreadable",
97
+ message="Cannot read requirements.lock: {0}".format(e),
98
+ path="requirements.lock",
99
+ )
100
+ return False