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.
- core_runtime/__init__.py +10 -0
- core_runtime/__version__.py +17 -0
- core_runtime/cli/__init__.py +7 -0
- core_runtime/cli/__main__.py +22 -0
- core_runtime/cli/bump_version.py +176 -0
- core_runtime/cli/contract_preflight.py +69 -0
- core_runtime/cli/create_domain.py +66 -0
- core_runtime/cli/doctor.py +44 -0
- core_runtime/cli/inventory.py +85 -0
- core_runtime/cli/lint.py +8 -0
- core_runtime/cli/main.py +579 -0
- core_runtime/cli/release_check.py +65 -0
- core_runtime/cli/repair_artifact_paths.py +48 -0
- core_runtime/cli/sync_template.py +67 -0
- core_runtime/cli/validate.py +73 -0
- core_runtime/core/__init__.py +34 -0
- core_runtime/core/audit_event.py +760 -0
- core_runtime/core/audit_trail_index.py +100 -0
- core_runtime/core/canonicalization.py +55 -0
- core_runtime/core/contract_evaluator.py +945 -0
- core_runtime/core/contract_executability.py +307 -0
- core_runtime/core/contract_loader.py +57 -0
- core_runtime/core/contract_probes.py +630 -0
- core_runtime/core/contract_program.py +131 -0
- core_runtime/core/contract_program_registry.py +104 -0
- core_runtime/core/contract_program_v2.py +126 -0
- core_runtime/core/dsk_v3.py +142 -0
- core_runtime/core/explainability.py +2115 -0
- core_runtime/core/numeric_normalization.py +120 -0
- core_runtime/core/rule_anchor.py +1388 -0
- core_runtime/core/schema_fingerprint.py +69 -0
- core_runtime/core/sensor_evidence.py +548 -0
- core_runtime/data/contracts/CoreAnchor.sol +109 -0
- core_runtime/data/contracts/CoreRuleAnchor.abi.json +111 -0
- core_runtime/data/contracts/CoreRuleAnchor.bin +1 -0
- core_runtime/data/contracts/CoreRuleAnchor.build.json +20 -0
- core_runtime/data/contracts/CoreRuleAnchor.runtime.bin +1 -0
- core_runtime/data/contracts/CoreRuleAnchor.sol +74 -0
- core_runtime/data/package_data_manifest.v1.json +173 -0
- core_runtime/data/schemas/core/causal_trace.v1.json +141 -0
- core_runtime/data/schemas/core/context_gate.v1.json +38 -0
- core_runtime/data/schemas/core/context_threshold.v1.json +46 -0
- core_runtime/data/schemas/core/contract_program.v1.json +186 -0
- core_runtime/data/schemas/core/contract_program.v2.json +187 -0
- core_runtime/data/schemas/core/control_decision.v1.json +114 -0
- core_runtime/data/schemas/core/dsk.v3.json +105 -0
- core_runtime/data/schemas/core/effect_result.v1.json +39 -0
- core_runtime/data/schemas/core/entropy_signal.v1.json +108 -0
- core_runtime/data/schemas/core/execution_receipt.v1.json +93 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v1.json +87 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v2.json +72 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v3.json +38 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v4.json +72 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v5.json +38 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v6.json +116 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v7.json +37 -0
- core_runtime/data/schemas/core/frozen_release_manifest.v8.json +114 -0
- core_runtime/data/schemas/core/frozen_rule_set.v1.json +282 -0
- core_runtime/data/schemas/core/memory_artifact.v1.json +120 -0
- core_runtime/data/schemas/core/memory_generation_result.v1.json +37 -0
- core_runtime/data/schemas/core/operational_learning_event.v1.json +63 -0
- core_runtime/data/schemas/core/pattern_candidate.v1.json +114 -0
- core_runtime/data/schemas/core/physical_safety_assurance_case.v1.json +676 -0
- core_runtime/data/schemas/core/policy_lifecycle.v1.json +99 -0
- core_runtime/data/schemas/core/retention_manifest.v1.json +53 -0
- core_runtime/data/schemas/core/reversibility_policy.v1.json +107 -0
- core_runtime/data/schemas/core/rule_anchor_batch.v1.json +93 -0
- core_runtime/data/schemas/core/rule_anchor_chain_evidence.v1.json +56 -0
- core_runtime/data/schemas/core/rule_approval.v1.json +49 -0
- core_runtime/data/schemas/core/rule_approval_request.v1.json +42 -0
- core_runtime/data/schemas/core/state_transition.v1.json +115 -0
- core_runtime/data/schemas/core/task_closeout.v1.json +47 -0
- core_runtime/data/schemas/core/template_promotion_candidate.v1.json +83 -0
- core_runtime/data/schemas/core/unsigned_rule_anchor_deployment.v1.json +106 -0
- core_runtime/data/schemas/core/unsigned_rule_anchor_transaction.v1.json +116 -0
- core_runtime/tooling/__init__.py +48 -0
- core_runtime/tooling/bump_version.py +900 -0
- core_runtime/tooling/contract_preflight.py +293 -0
- core_runtime/tooling/create_domain.py +254 -0
- core_runtime/tooling/diagnostics.py +129 -0
- core_runtime/tooling/doctor.py +482 -0
- core_runtime/tooling/file_inventory.py +182 -0
- core_runtime/tooling/json_checks.py +100 -0
- core_runtime/tooling/release_check.py +1017 -0
- core_runtime/tooling/repair_artifact_paths.py +458 -0
- core_runtime/tooling/report_writer.py +176 -0
- core_runtime/tooling/repository_inventory.py +399 -0
- core_runtime/tooling/safety_checks.py +172 -0
- core_runtime/tooling/sync_template.py +303 -0
- core_runtime/tooling/validation.py +507 -0
- core_runtime/tooling/version_inventory.py +256 -0
- core_runtime_engine-11.5.1.dist-info/METADATA +35 -0
- core_runtime_engine-11.5.1.dist-info/RECORD +96 -0
- core_runtime_engine-11.5.1.dist-info/WHEEL +5 -0
- core_runtime_engine-11.5.1.dist-info/entry_points.txt +2 -0
- core_runtime_engine-11.5.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""CLI command for `core-runtime sync-template`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from core_runtime.tooling.diagnostics import DiagnosticCollection, ExitCode
|
|
9
|
+
from core_runtime.tooling.sync_template import SyncTemplateReport, TemplateSyncPlanner
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def cmd_sync_template(args: object) -> int:
|
|
13
|
+
"""Execute the dry-run template synchronization planner."""
|
|
14
|
+
fmt: str = getattr(args, "format", "json")
|
|
15
|
+
output = getattr(args, "output", None)
|
|
16
|
+
domain = getattr(args, "domain", None)
|
|
17
|
+
all_domains = bool(getattr(args, "all", False))
|
|
18
|
+
template = getattr(args, "template", "generic")
|
|
19
|
+
dry_run = bool(getattr(args, "dry_run", False))
|
|
20
|
+
repo_root = Path(__file__).resolve().parents[2]
|
|
21
|
+
planner = TemplateSyncPlanner(repo_root)
|
|
22
|
+
|
|
23
|
+
if not dry_run:
|
|
24
|
+
diagnostics = DiagnosticCollection()
|
|
25
|
+
diagnostics.add_blocked(
|
|
26
|
+
code="core.sync_template.dry_run_required",
|
|
27
|
+
message="sync-template is dry-run only in this slice",
|
|
28
|
+
path=domain or "sync-template",
|
|
29
|
+
expected="--dry-run",
|
|
30
|
+
actual="missing dry-run",
|
|
31
|
+
)
|
|
32
|
+
report = SyncTemplateReport(
|
|
33
|
+
tool="core-runtime sync-template",
|
|
34
|
+
command=planner._command(domain=domain, all_domains=all_domains),
|
|
35
|
+
status="blocked",
|
|
36
|
+
summary={"mode": "missing_dry_run", "item_count": 0},
|
|
37
|
+
selection={"domain": domain, "all": all_domains, "template": template, "mode": "missing_dry_run"},
|
|
38
|
+
diagnostics=diagnostics,
|
|
39
|
+
)
|
|
40
|
+
else:
|
|
41
|
+
report = planner.build_plan(domain=domain, all_domains=all_domains, template=template)
|
|
42
|
+
|
|
43
|
+
output_path = Path(output) if output else None
|
|
44
|
+
if fmt == "json":
|
|
45
|
+
payload = report.to_dict()
|
|
46
|
+
text = json.dumps(payload, indent=2, ensure_ascii=False)
|
|
47
|
+
if output_path:
|
|
48
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
49
|
+
output_path.write_text(text + "\n", encoding="utf-8")
|
|
50
|
+
else:
|
|
51
|
+
print(text)
|
|
52
|
+
else:
|
|
53
|
+
markdown = report.to_markdown()
|
|
54
|
+
if output_path:
|
|
55
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
56
|
+
output_path.write_text(markdown, encoding="utf-8")
|
|
57
|
+
else:
|
|
58
|
+
print(markdown)
|
|
59
|
+
|
|
60
|
+
status_to_exit = {
|
|
61
|
+
"pass": ExitCode.OK.value,
|
|
62
|
+
"warning": ExitCode.OK.value,
|
|
63
|
+
"error": ExitCode.ERROR.value,
|
|
64
|
+
"blocked": ExitCode.BLOCKED.value,
|
|
65
|
+
"internal_error": ExitCode.INTERNAL_ERROR.value,
|
|
66
|
+
}
|
|
67
|
+
return status_to_exit.get(report.status, ExitCode.INTERNAL_ERROR.value)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""CLI commands for read-only structural validation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from core_runtime.tooling.diagnostics import ExitCode
|
|
9
|
+
from core_runtime.tooling.validation import RepositoryValidation
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
_KIND_ALIASES = {
|
|
13
|
+
"schema": "schemas",
|
|
14
|
+
"schemas": "schemas",
|
|
15
|
+
"example": "examples",
|
|
16
|
+
"examples": "examples",
|
|
17
|
+
"manifest": "manifests",
|
|
18
|
+
"manifests": "manifests",
|
|
19
|
+
"contract": "contracts",
|
|
20
|
+
"contracts": "contracts",
|
|
21
|
+
"domain": "domain",
|
|
22
|
+
"domains": "domain",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _normalize_kind(kind: str | None) -> str | None:
|
|
27
|
+
if kind is None:
|
|
28
|
+
return None
|
|
29
|
+
return _KIND_ALIASES.get(kind.lower())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _emit_report(report, fmt: str, output) -> None:
|
|
33
|
+
payload = report.to_dict()
|
|
34
|
+
if fmt == "json":
|
|
35
|
+
text = json.dumps(payload, indent=2, ensure_ascii=False)
|
|
36
|
+
else:
|
|
37
|
+
text = report.to_markdown()
|
|
38
|
+
if output:
|
|
39
|
+
output_path = Path(output)
|
|
40
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
41
|
+
output_path.write_text(text + ("\n" if fmt == "json" else ""), encoding="utf-8")
|
|
42
|
+
else:
|
|
43
|
+
print(text)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def cmd_validate(args: object) -> int:
|
|
47
|
+
"""Run read-only structural validation."""
|
|
48
|
+
raw_kind = getattr(args, "kind", None)
|
|
49
|
+
name = getattr(args, "name", None)
|
|
50
|
+
fmt: str = getattr(args, "format", "json")
|
|
51
|
+
output = getattr(args, "output", None)
|
|
52
|
+
repo_root = Path(__file__).resolve().parents[2]
|
|
53
|
+
validator = RepositoryValidation(repo_root)
|
|
54
|
+
|
|
55
|
+
kind = _normalize_kind(raw_kind)
|
|
56
|
+
if raw_kind is not None and kind is None:
|
|
57
|
+
kind = str(raw_kind)
|
|
58
|
+
if kind is None:
|
|
59
|
+
kind = "schemas"
|
|
60
|
+
if kind == "domain" and not name and raw_kind not in (None, "domain", "domains"):
|
|
61
|
+
name = str(raw_kind)
|
|
62
|
+
kind = "domain"
|
|
63
|
+
|
|
64
|
+
report = validator.build_report(kind=kind, name=name)
|
|
65
|
+
_emit_report(report, fmt, output)
|
|
66
|
+
return {
|
|
67
|
+
"pass": ExitCode.OK.value,
|
|
68
|
+
"warning": ExitCode.OK.value,
|
|
69
|
+
"error": ExitCode.ERROR.value,
|
|
70
|
+
"blocked": ExitCode.BLOCKED.value,
|
|
71
|
+
"internal_error": ExitCode.INTERNAL_ERROR.value,
|
|
72
|
+
}.get(report.status, ExitCode.INTERNAL_ERROR.value)
|
|
73
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Core helpers kept by the v11 whitelist rebuild.
|
|
2
|
+
|
|
3
|
+
Only modules reached from the public surface live here. The historical
|
|
4
|
+
runtime (execution graphs, domain SDK, memory, experience) was archived
|
|
5
|
+
with the CPT legacy — see docs/CORE_REBUILD_FROM_ZERO.md.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from core_runtime.core.contract_loader import (
|
|
9
|
+
available_contracts,
|
|
10
|
+
contract_schema_path,
|
|
11
|
+
load_contract_schema,
|
|
12
|
+
)
|
|
13
|
+
from core_runtime.core.contract_evaluator import (
|
|
14
|
+
bind_artifact_fingerprint,
|
|
15
|
+
evaluate_contract_file,
|
|
16
|
+
evaluate_contract_payload,
|
|
17
|
+
executable_contract_versions,
|
|
18
|
+
)
|
|
19
|
+
from core_runtime.core.contract_program import execute_contract_program
|
|
20
|
+
from core_runtime.core.contract_program_v2 import evaluate_contract_v2
|
|
21
|
+
from core_runtime.core.dsk_v3 import evaluate_dsk_v3
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"available_contracts",
|
|
25
|
+
"bind_artifact_fingerprint",
|
|
26
|
+
"contract_schema_path",
|
|
27
|
+
"evaluate_contract_file",
|
|
28
|
+
"evaluate_contract_payload",
|
|
29
|
+
"evaluate_contract_v2",
|
|
30
|
+
"evaluate_dsk_v3",
|
|
31
|
+
"execute_contract_program",
|
|
32
|
+
"executable_contract_versions",
|
|
33
|
+
"load_contract_schema",
|
|
34
|
+
]
|