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,630 @@
|
|
|
1
|
+
"""Deterministic positive and semantic-negative probes for CORE contracts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import copy
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from typing import Any, Callable
|
|
8
|
+
|
|
9
|
+
from core_runtime.core.contract_evaluator import bind_artifact_fingerprint
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Mutator = Callable[[dict[str, Any]], None]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class ContractProbe:
|
|
17
|
+
schema_version: str
|
|
18
|
+
accepted: dict[str, Any]
|
|
19
|
+
mutate: Mutator
|
|
20
|
+
expected_error: str
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _fp(label: str) -> str:
|
|
24
|
+
import hashlib
|
|
25
|
+
|
|
26
|
+
return f"sha256:{hashlib.sha256(label.encode('utf-8')).hexdigest()}"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def build_physical_safety_case(
|
|
30
|
+
*,
|
|
31
|
+
method: str = "simulation",
|
|
32
|
+
requested_level: str | None = None,
|
|
33
|
+
) -> dict[str, Any]:
|
|
34
|
+
"""Build a complete one-hazard safety case for executable probes."""
|
|
35
|
+
|
|
36
|
+
if requested_level is None:
|
|
37
|
+
if method == "independent_assessment":
|
|
38
|
+
requested_level = "independent_evidence_ready"
|
|
39
|
+
elif method == "simulation":
|
|
40
|
+
requested_level = "simulation_only"
|
|
41
|
+
else:
|
|
42
|
+
requested_level = "evidence_ready"
|
|
43
|
+
|
|
44
|
+
method_reference = {
|
|
45
|
+
"simulation": "simulation",
|
|
46
|
+
"bench": "laboratory",
|
|
47
|
+
"hardware_in_loop": "hardware_in_loop",
|
|
48
|
+
"field_observation": "field_observation",
|
|
49
|
+
"independent_assessment": "independent_assessment",
|
|
50
|
+
}[method]
|
|
51
|
+
test_source_kind = "independent_assessor" if method == "independent_assessment" else "human_directed_software"
|
|
52
|
+
evidence_labels = (
|
|
53
|
+
"extreme-low",
|
|
54
|
+
"extreme-high",
|
|
55
|
+
"controller",
|
|
56
|
+
"isolation",
|
|
57
|
+
"test-suite",
|
|
58
|
+
"plain-language",
|
|
59
|
+
"limitations",
|
|
60
|
+
"contestability",
|
|
61
|
+
"local-stop",
|
|
62
|
+
"secure-boot",
|
|
63
|
+
"signed-update",
|
|
64
|
+
"credentials",
|
|
65
|
+
"sbom",
|
|
66
|
+
"vulnerability-process",
|
|
67
|
+
"ledger",
|
|
68
|
+
)
|
|
69
|
+
evidence: list[dict[str, Any]] = []
|
|
70
|
+
for label in evidence_labels:
|
|
71
|
+
source_kind = test_source_kind if label == "test-suite" else "human_directed_software"
|
|
72
|
+
reference_class = method_reference if label == "test-suite" else "laboratory"
|
|
73
|
+
evidence.append(
|
|
74
|
+
{
|
|
75
|
+
"evidence_id": f"evidence:{label}",
|
|
76
|
+
"kind": label,
|
|
77
|
+
"fingerprint": _fp(f"physical-safety:{method}:{label}"),
|
|
78
|
+
"source_kind": source_kind,
|
|
79
|
+
"source_ref": f"source:{label}",
|
|
80
|
+
"reference_class": reference_class,
|
|
81
|
+
"captured_at": "2026-07-13T10:00:00+00:00",
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
scenarios = (
|
|
86
|
+
"llm_prompt_injection",
|
|
87
|
+
"network_compromise",
|
|
88
|
+
"general_compute_compromise",
|
|
89
|
+
"sensor_fault",
|
|
90
|
+
"communication_loss",
|
|
91
|
+
"power_loss",
|
|
92
|
+
"update_tamper",
|
|
93
|
+
"replay_attack",
|
|
94
|
+
"emergency_stop",
|
|
95
|
+
"out_of_distribution_input",
|
|
96
|
+
)
|
|
97
|
+
tests = [
|
|
98
|
+
{
|
|
99
|
+
"test_id": f"test:{scenario.replace('_', '-')}",
|
|
100
|
+
"hazard_refs": ["hazard:unintended-motion"],
|
|
101
|
+
"scenario": scenario,
|
|
102
|
+
"method": method,
|
|
103
|
+
"result": "passed",
|
|
104
|
+
"expected_safe_state": "Hazardous energy is isolated and motion is stopped.",
|
|
105
|
+
"observed_safe_state": "Hazardous energy is isolated and motion is stopped.",
|
|
106
|
+
"hazardous_actuation_observed": False,
|
|
107
|
+
"evidence_refs": ["evidence:test-suite"],
|
|
108
|
+
}
|
|
109
|
+
for scenario in scenarios
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
reference_classes = [method_reference]
|
|
113
|
+
if "simulation" not in reference_classes:
|
|
114
|
+
reference_classes.append("simulation")
|
|
115
|
+
payload: dict[str, Any] = {
|
|
116
|
+
"schema_version": "core.physical_safety_assurance_case.v1",
|
|
117
|
+
"type": "physical_safety_assurance_case",
|
|
118
|
+
"case_id": "safety-case:domestic-actuator-v1",
|
|
119
|
+
"system": {
|
|
120
|
+
"system_id": "system:domestic-actuator",
|
|
121
|
+
"system_version": "1.0.0",
|
|
122
|
+
"release_fingerprint": _fp("release:domestic-actuator:1.0.0"),
|
|
123
|
+
"deployment_fingerprint": _fp("deployment:lab-bench:001"),
|
|
124
|
+
"physical_actuation": True,
|
|
125
|
+
},
|
|
126
|
+
"claim": {
|
|
127
|
+
"claim_status": "observed",
|
|
128
|
+
"truth_claim": False,
|
|
129
|
+
"zero_risk_claim": False,
|
|
130
|
+
"scope": "This case covers the declared actuator, release, deployment, hazards, and evidence envelope only.",
|
|
131
|
+
"assumptions": [
|
|
132
|
+
"The recorded hardware identifiers match the evaluated deployment.",
|
|
133
|
+
"Evidence fingerprints resolve to immutable local artifacts.",
|
|
134
|
+
],
|
|
135
|
+
"limitations": [
|
|
136
|
+
"Unobserved extremes and changed components remain unknown.",
|
|
137
|
+
"Passing this gate does not authorize deployment.",
|
|
138
|
+
],
|
|
139
|
+
"reference_classes": reference_classes,
|
|
140
|
+
},
|
|
141
|
+
"observed_envelope": {
|
|
142
|
+
"aggregation": "mixed",
|
|
143
|
+
"sample_count": 100,
|
|
144
|
+
"average_only": False,
|
|
145
|
+
"known_extremes": [
|
|
146
|
+
{
|
|
147
|
+
"extreme_id": "extreme:minimum-load",
|
|
148
|
+
"direction": "lower",
|
|
149
|
+
"value": 0,
|
|
150
|
+
"unit": "percent_load",
|
|
151
|
+
"source_ref": "source:lab-bench",
|
|
152
|
+
"evidence_ref": "evidence:extreme-low",
|
|
153
|
+
"observed_at": "2026-07-13T09:00:00+00:00",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"extreme_id": "extreme:adversarial-maximum",
|
|
157
|
+
"direction": "adversarial",
|
|
158
|
+
"value": 100,
|
|
159
|
+
"unit": "percent_load",
|
|
160
|
+
"source_ref": "source:adversarial-bench",
|
|
161
|
+
"evidence_ref": "evidence:extreme-high",
|
|
162
|
+
"observed_at": "2026-07-13T09:30:00+00:00",
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
"out_of_distribution_policy": "fail_closed",
|
|
166
|
+
"unknown_extremes_acknowledged": True,
|
|
167
|
+
"records_are_observed_bounds_only": True,
|
|
168
|
+
},
|
|
169
|
+
"authority_boundary": {
|
|
170
|
+
"llm_role": "advisory_only",
|
|
171
|
+
"direct_llm_actuation": False,
|
|
172
|
+
"general_compute_direct_actuation": False,
|
|
173
|
+
"core_role": "deterministic_validation_only",
|
|
174
|
+
"core_authorizes_deployment": False,
|
|
175
|
+
"responsible_party_ref": "responsible-party:system-owner",
|
|
176
|
+
},
|
|
177
|
+
"hazards": [
|
|
178
|
+
{
|
|
179
|
+
"hazard_id": "hazard:unintended-motion",
|
|
180
|
+
"severity": "catastrophic",
|
|
181
|
+
"hazardous_action": "Unexpected movement while a person is inside the reachable work envelope.",
|
|
182
|
+
"safe_state": "Hazardous energy is isolated and motion is stopped.",
|
|
183
|
+
"barrier_refs": ["barrier:safety-controller", "barrier:energy-isolation"],
|
|
184
|
+
"test_refs": [item["test_id"] for item in tests],
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"barriers": [
|
|
188
|
+
{
|
|
189
|
+
"barrier_id": "barrier:safety-controller",
|
|
190
|
+
"kind": "isolated_safety_controller",
|
|
191
|
+
"enforcement_domain": "isolated_controller",
|
|
192
|
+
"independent_from": ["barrier:energy-isolation"],
|
|
193
|
+
"fail_closed": True,
|
|
194
|
+
"llm_controlled": False,
|
|
195
|
+
"bypassable_by_general_compute": False,
|
|
196
|
+
"evidence_refs": ["evidence:controller"],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"barrier_id": "barrier:energy-isolation",
|
|
200
|
+
"kind": "physical_energy_isolation",
|
|
201
|
+
"enforcement_domain": "electrical_hardware",
|
|
202
|
+
"independent_from": ["barrier:safety-controller"],
|
|
203
|
+
"fail_closed": True,
|
|
204
|
+
"llm_controlled": False,
|
|
205
|
+
"bypassable_by_general_compute": False,
|
|
206
|
+
"evidence_refs": ["evidence:isolation"],
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
"verification_tests": tests,
|
|
210
|
+
"epistemic_dignity": {
|
|
211
|
+
"plain_language_disclosure_ref": "evidence:plain-language",
|
|
212
|
+
"evidence_limitations_ref": "evidence:limitations",
|
|
213
|
+
"contestability_ref": "evidence:contestability",
|
|
214
|
+
"local_stop_ref": "evidence:local-stop",
|
|
215
|
+
"technical_expertise_required_to_stop": False,
|
|
216
|
+
"uncertainty_disclosed": True,
|
|
217
|
+
"challenge_response_policy": "answer_with_evidence_or_explicit_unknown",
|
|
218
|
+
"automated_moral_authority": False,
|
|
219
|
+
},
|
|
220
|
+
"lifecycle": {
|
|
221
|
+
"secure_boot_evidence_ref": "evidence:secure-boot",
|
|
222
|
+
"signed_update_evidence_ref": "evidence:signed-update",
|
|
223
|
+
"unique_credentials_evidence_ref": "evidence:credentials",
|
|
224
|
+
"sbom_evidence_ref": "evidence:sbom",
|
|
225
|
+
"vulnerability_process_evidence_ref": "evidence:vulnerability-process",
|
|
226
|
+
"safety_policy_fingerprint": _fp("policy:physical-safety:v1"),
|
|
227
|
+
"change_invalidates_assurance": True,
|
|
228
|
+
},
|
|
229
|
+
"evidence": evidence,
|
|
230
|
+
"traceability": {
|
|
231
|
+
"immutable_event_ledger_ref": "evidence:ledger",
|
|
232
|
+
"recorded_event_types": [
|
|
233
|
+
"safety_policy_changed",
|
|
234
|
+
"hazardous_command_rejected",
|
|
235
|
+
"safety_interlock_activated",
|
|
236
|
+
"unexpected_physical_outcome",
|
|
237
|
+
"assurance_invalidated",
|
|
238
|
+
"emergency_stop_activated",
|
|
239
|
+
"security_boundary_breached",
|
|
240
|
+
],
|
|
241
|
+
"ordinary_telemetry_excluded": True,
|
|
242
|
+
},
|
|
243
|
+
"requested_assurance_level": requested_level,
|
|
244
|
+
"evaluated_at": "2026-07-13T12:00:00+00:00",
|
|
245
|
+
"fingerprint": _fp("placeholder"),
|
|
246
|
+
}
|
|
247
|
+
return bind_artifact_fingerprint(payload)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def accepted_contract_payloads() -> dict[str, dict[str, Any]]:
|
|
251
|
+
"""Return one semantically coherent artifact per executable contract."""
|
|
252
|
+
|
|
253
|
+
payloads: dict[str, dict[str, Any]] = {
|
|
254
|
+
"core.contract_program.v1": {
|
|
255
|
+
"schema_version": "core.contract_program.v1",
|
|
256
|
+
"type": "contract_program",
|
|
257
|
+
"program_id": "program:bounded-classification",
|
|
258
|
+
"program_version": "1.0.0",
|
|
259
|
+
"authority": "validation_only",
|
|
260
|
+
"effect_policy": {
|
|
261
|
+
"external_effects": False,
|
|
262
|
+
"network_access": False,
|
|
263
|
+
"filesystem_access": False,
|
|
264
|
+
"state_apply": False,
|
|
265
|
+
},
|
|
266
|
+
"capabilities": ["read_input", "assert", "derive", "stage_transition", "emit_result"],
|
|
267
|
+
"limits": {"max_steps": 6, "max_items": 4, "max_emits": 1},
|
|
268
|
+
"instructions": [
|
|
269
|
+
{"opcode": "load", "key": "classification", "output": "classification_value"},
|
|
270
|
+
{"opcode": "assert", "key": "approved", "equals": True},
|
|
271
|
+
{"opcode": "derive", "operation": "copy", "input_keys": ["classification_value"], "output": "result_value"},
|
|
272
|
+
{"opcode": "transition", "transition_id": "transition:reviewed", "before_ref": "state:pending", "after_ref": "state:reviewed", "reversibility_class": "reversible"},
|
|
273
|
+
{"opcode": "emit", "code": "classification_recorded", "value_key": "result_value"},
|
|
274
|
+
{"opcode": "halt", "status": "passed"},
|
|
275
|
+
],
|
|
276
|
+
"source_refs": ["source:program:bounded-classification"],
|
|
277
|
+
"declared_loss": ["The program emits only declared outputs and does not preserve unreferenced input context."],
|
|
278
|
+
"fingerprint": _fp("placeholder"),
|
|
279
|
+
},
|
|
280
|
+
"core.causal_trace.v1": {
|
|
281
|
+
"schema_version": "core.causal_trace.v1",
|
|
282
|
+
"type": "causal_trace",
|
|
283
|
+
"trace_id": "trace:001",
|
|
284
|
+
"root_ref": "decision:001",
|
|
285
|
+
"nodes": [
|
|
286
|
+
{"node_id": "node:decision", "kind": "decision", "ref": "decision:001"},
|
|
287
|
+
{"node_id": "node:receipt", "kind": "receipt", "ref": "receipt:001"},
|
|
288
|
+
],
|
|
289
|
+
"edges": [{"from_ref": "decision:001", "to_ref": "receipt:001", "relation": "produces"}],
|
|
290
|
+
"source_refs": ["source:intent:001"],
|
|
291
|
+
"evidence_refs": ["evidence:decision:001"],
|
|
292
|
+
"created_at": "2026-07-13T00:00:00+00:00",
|
|
293
|
+
"fingerprint": _fp("placeholder"),
|
|
294
|
+
},
|
|
295
|
+
"core.context_gate.v1": {
|
|
296
|
+
"schema_version": "core.context_gate.v1",
|
|
297
|
+
"status": "passed",
|
|
298
|
+
"source_type": "workflow",
|
|
299
|
+
"source_id": "workflow:001",
|
|
300
|
+
"mode": "dry-run",
|
|
301
|
+
"reason": "threshold_exceeded",
|
|
302
|
+
"proposed_action": "compress",
|
|
303
|
+
},
|
|
304
|
+
"core.context_threshold.v1": {
|
|
305
|
+
"schema_version": "core.context_threshold.v1",
|
|
306
|
+
"status": "passed",
|
|
307
|
+
"source_type": "workflow",
|
|
308
|
+
"source_id": "workflow:001",
|
|
309
|
+
"should_compress_now": True,
|
|
310
|
+
"reason": "usage_at_or_above_threshold",
|
|
311
|
+
"current_usage_percent": 85,
|
|
312
|
+
"previous_usage_percent": 75,
|
|
313
|
+
"ema_usage_percent": 80,
|
|
314
|
+
"compression_threshold_percent": 80,
|
|
315
|
+
"recommended_action": "compress",
|
|
316
|
+
},
|
|
317
|
+
"core.control_decision.v1": {
|
|
318
|
+
"schema_version": "core.control_decision.v1",
|
|
319
|
+
"type": "control_decision",
|
|
320
|
+
"decision_id": "decision:001",
|
|
321
|
+
"intent_ref": "intent:001",
|
|
322
|
+
"target_ref": "target:001",
|
|
323
|
+
"decision": "require_confirmation",
|
|
324
|
+
"reason": "irreversible_action",
|
|
325
|
+
"policy_refs": ["policy:001"],
|
|
326
|
+
"entropy_signal_refs": [],
|
|
327
|
+
"reversibility_class": "irreversible",
|
|
328
|
+
"evidence_required": ["responsible_approval"],
|
|
329
|
+
"source_refs": ["source:intent:001"],
|
|
330
|
+
"evidence_refs": ["evidence:approval:001"],
|
|
331
|
+
"created_at": "2026-07-13T00:00:00+00:00",
|
|
332
|
+
"fingerprint": _fp("placeholder"),
|
|
333
|
+
},
|
|
334
|
+
"core.effect_result.v1": {
|
|
335
|
+
"schema_version": "core.effect_result.v1",
|
|
336
|
+
"status": "dry_run",
|
|
337
|
+
"effect_type": "notification",
|
|
338
|
+
"dry_run": True,
|
|
339
|
+
"reason": "operator_preview",
|
|
340
|
+
"provider": "local",
|
|
341
|
+
"target_ref": "operator:001",
|
|
342
|
+
},
|
|
343
|
+
"core.entropy_signal.v1": {
|
|
344
|
+
"schema_version": "core.entropy_signal.v1",
|
|
345
|
+
"type": "entropy_signal",
|
|
346
|
+
"signal_id": "signal:001",
|
|
347
|
+
"source_type": "workflow",
|
|
348
|
+
"source_id": "workflow:001",
|
|
349
|
+
"signal_type": "missing_evidence",
|
|
350
|
+
"severity": "high",
|
|
351
|
+
"confidence": 0.9,
|
|
352
|
+
"measurement": {"missing_count": 1},
|
|
353
|
+
"suggested_response": "manual_review",
|
|
354
|
+
"source_refs": ["source:workflow:001"],
|
|
355
|
+
"evidence_refs": ["evidence:gap:001"],
|
|
356
|
+
"timestamp": "2026-07-13T00:00:00+00:00",
|
|
357
|
+
"fingerprint": _fp("placeholder"),
|
|
358
|
+
},
|
|
359
|
+
"core.execution_receipt.v1": {
|
|
360
|
+
"schema_version": "core.execution_receipt.v1",
|
|
361
|
+
"type": "execution_receipt",
|
|
362
|
+
"receipt_id": "receipt:001",
|
|
363
|
+
"executor_ref": "executor:bounded:001",
|
|
364
|
+
"decision_ref": "decision:001",
|
|
365
|
+
"command_ref": "command:001",
|
|
366
|
+
"status": "succeeded",
|
|
367
|
+
"state_transition_refs": ["transition:001"],
|
|
368
|
+
"evidence_refs": ["evidence:receipt:001"],
|
|
369
|
+
"source_refs": ["source:command:001"],
|
|
370
|
+
"created_at": "2026-07-13T00:00:00+00:00",
|
|
371
|
+
"fingerprint": _fp("placeholder"),
|
|
372
|
+
},
|
|
373
|
+
"core.memory_artifact.v1": {
|
|
374
|
+
"schema_version": "core.memory_artifact.v1",
|
|
375
|
+
"memory_id": "memory:001",
|
|
376
|
+
"source_refs": ["source:run:001"],
|
|
377
|
+
"authority": "reference_only",
|
|
378
|
+
"summary": "Bounded run summary.",
|
|
379
|
+
"stable_facts": ["A fixture passed its declared validator."],
|
|
380
|
+
"decisions": [],
|
|
381
|
+
"invariants": ["No execution authority is stored in memory."],
|
|
382
|
+
"open_risks": ["Unobserved cases remain unknown."],
|
|
383
|
+
"next_actions": ["Review the bounded evidence."],
|
|
384
|
+
"retention": {"retention_class": "keep", "reason": "Supports replay."},
|
|
385
|
+
"created_at": "2026-07-13T00:00:00+00:00",
|
|
386
|
+
},
|
|
387
|
+
"core.memory_generation_result.v1": {
|
|
388
|
+
"schema_version": "core.memory_generation_result.v1",
|
|
389
|
+
"status": "passed",
|
|
390
|
+
"source_type": "run",
|
|
391
|
+
"source_id": "run:001",
|
|
392
|
+
"reused": False,
|
|
393
|
+
"memory_id": "memory:001",
|
|
394
|
+
"memory_ref": "artifact:memory:001",
|
|
395
|
+
"reason": "generated",
|
|
396
|
+
},
|
|
397
|
+
"core.operational_learning_event.v1": {
|
|
398
|
+
"schema_version": "core.operational_learning_event.v1",
|
|
399
|
+
"event_id": "learning:001",
|
|
400
|
+
"event_type": "candidate_observed",
|
|
401
|
+
"source_type": "run",
|
|
402
|
+
"source_id": "run:001",
|
|
403
|
+
"status": "candidate",
|
|
404
|
+
"timestamp": "2026-07-13T00:00:00+00:00",
|
|
405
|
+
"payload": {"candidate_ref": "pattern:001", "authority": "advisory_only"},
|
|
406
|
+
"source_refs": ["source:run:001"],
|
|
407
|
+
},
|
|
408
|
+
"core.pattern_candidate.v1": {
|
|
409
|
+
"schema_version": "core.pattern_candidate.v1",
|
|
410
|
+
"type": "pattern_candidate",
|
|
411
|
+
"pattern_id": "pattern:001",
|
|
412
|
+
"source_type": "run",
|
|
413
|
+
"source_id": "run:001",
|
|
414
|
+
"classification": "candidate_for_template",
|
|
415
|
+
"confidence": 0.9,
|
|
416
|
+
"occurrences": 3,
|
|
417
|
+
"normalized_signature": {"operation": "bounded_read"},
|
|
418
|
+
"source_refs": ["source:run:001"],
|
|
419
|
+
"example_refs": ["example:001", "example:002"],
|
|
420
|
+
"suggested_action": "request_responsible_review",
|
|
421
|
+
"observed_at": "2026-07-13T00:00:00+00:00",
|
|
422
|
+
"evidence_refs": ["evidence:pattern:001"],
|
|
423
|
+
},
|
|
424
|
+
"core.policy_lifecycle.v1": {
|
|
425
|
+
"schema_version": "core.policy_lifecycle.v1",
|
|
426
|
+
"type": "policy_lifecycle",
|
|
427
|
+
"policy_id": "policy:001",
|
|
428
|
+
"policy_version": "1.0.0",
|
|
429
|
+
"status": "active",
|
|
430
|
+
"effective_from": "2026-07-13T00:00:00+00:00",
|
|
431
|
+
"effective_to": None,
|
|
432
|
+
"supersedes": None,
|
|
433
|
+
"scope": {"system": "system:001"},
|
|
434
|
+
"change_reason": "initial_release",
|
|
435
|
+
"approval_refs": ["approval:001"],
|
|
436
|
+
"fingerprint": _fp("placeholder"),
|
|
437
|
+
},
|
|
438
|
+
"core.retention_manifest.v1": {
|
|
439
|
+
"schema_version": "core.retention_manifest.v1",
|
|
440
|
+
"entries": [
|
|
441
|
+
{
|
|
442
|
+
"source_type": "run",
|
|
443
|
+
"source_id": "run:001",
|
|
444
|
+
"artifact_ref": "artifact:evidence:001",
|
|
445
|
+
"retention_class": "keep",
|
|
446
|
+
"reason": "Supports replay and accountability.",
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
},
|
|
450
|
+
"core.reversibility_policy.v1": {
|
|
451
|
+
"schema_version": "core.reversibility_policy.v1",
|
|
452
|
+
"type": "reversibility_policy",
|
|
453
|
+
"policy_id": "policy:reversibility:001",
|
|
454
|
+
"action_family": "physical_actuation",
|
|
455
|
+
"reversibility_class": "irreversible",
|
|
456
|
+
"compensation_required": False,
|
|
457
|
+
"human_approval_required": True,
|
|
458
|
+
"stop_conditions": ["uncertainty_detected"],
|
|
459
|
+
"evidence_required": ["responsible_approval", "safety_interlock"],
|
|
460
|
+
"notes": ["Approval does not override a CORE rejection."],
|
|
461
|
+
"source_refs": ["source:policy:001"],
|
|
462
|
+
"evidence_refs": ["evidence:policy:001"],
|
|
463
|
+
"created_at": "2026-07-13T00:00:00+00:00",
|
|
464
|
+
"fingerprint": _fp("placeholder"),
|
|
465
|
+
},
|
|
466
|
+
"core.state_transition.v1": {
|
|
467
|
+
"schema_version": "core.state_transition.v1",
|
|
468
|
+
"type": "state_transition",
|
|
469
|
+
"transition_id": "transition:001",
|
|
470
|
+
"source_type": "system",
|
|
471
|
+
"source_id": "system:001",
|
|
472
|
+
"before_ref": "state:armed",
|
|
473
|
+
"after_ref": "state:safe",
|
|
474
|
+
"cause_refs": ["cause:emergency-stop"],
|
|
475
|
+
"effect_refs": ["effect:energy-isolated"],
|
|
476
|
+
"actor_kind": "human_operator",
|
|
477
|
+
"timestamp": "2026-07-13T00:00:00+00:00",
|
|
478
|
+
"reversibility_class": "irreversible",
|
|
479
|
+
"source_refs": ["source:operator:001"],
|
|
480
|
+
"evidence_refs": ["evidence:transition:001"],
|
|
481
|
+
"fingerprint": _fp("placeholder"),
|
|
482
|
+
},
|
|
483
|
+
"core.task_closeout.v1": {
|
|
484
|
+
"schema_version": "core.task_closeout.v1",
|
|
485
|
+
"status": "passed",
|
|
486
|
+
"source_type": "task",
|
|
487
|
+
"source_id": "task:001",
|
|
488
|
+
"summary": "Task completed with bounded evidence.",
|
|
489
|
+
"report_ref": "report:task:001",
|
|
490
|
+
"next_context_action": "none",
|
|
491
|
+
},
|
|
492
|
+
"core.template_promotion_candidate.v1": {
|
|
493
|
+
"schema_version": "core.template_promotion_candidate.v1",
|
|
494
|
+
"type": "template_promotion_candidate",
|
|
495
|
+
"template_candidate_id": "template:001",
|
|
496
|
+
"source_pattern_id": "pattern:001",
|
|
497
|
+
"required_inputs": ["bounded_source"],
|
|
498
|
+
"output_contract": "core.contract_evaluation.v1",
|
|
499
|
+
"expected_evidence": ["accepted_probe", "semantic_negative_probe"],
|
|
500
|
+
"risk_tier": "high",
|
|
501
|
+
"stop_conditions": ["missing_evidence", "scope_expansion"],
|
|
502
|
+
"human_approval_required": True,
|
|
503
|
+
"source_refs": ["source:pattern:001"],
|
|
504
|
+
},
|
|
505
|
+
"core.physical_safety_assurance_case.v1": build_physical_safety_case(),
|
|
506
|
+
}
|
|
507
|
+
for version in (
|
|
508
|
+
"core.causal_trace.v1",
|
|
509
|
+
"core.contract_program.v1",
|
|
510
|
+
"core.control_decision.v1",
|
|
511
|
+
"core.entropy_signal.v1",
|
|
512
|
+
"core.execution_receipt.v1",
|
|
513
|
+
"core.policy_lifecycle.v1",
|
|
514
|
+
"core.reversibility_policy.v1",
|
|
515
|
+
"core.state_transition.v1",
|
|
516
|
+
):
|
|
517
|
+
payloads[version] = bind_artifact_fingerprint(payloads[version])
|
|
518
|
+
return payloads
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
def _rebind(payload: dict[str, Any]) -> None:
|
|
522
|
+
if "fingerprint" in payload:
|
|
523
|
+
payload["fingerprint"] = bind_artifact_fingerprint(payload)["fingerprint"]
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
def executable_contract_probes() -> tuple[ContractProbe, ...]:
|
|
527
|
+
"""Return schema-valid mutations that must fail semantic evaluation."""
|
|
528
|
+
|
|
529
|
+
accepted = accepted_contract_payloads()
|
|
530
|
+
|
|
531
|
+
def causal(payload: dict[str, Any]) -> None:
|
|
532
|
+
payload["edges"][0]["to_ref"] = "receipt:missing"
|
|
533
|
+
_rebind(payload)
|
|
534
|
+
|
|
535
|
+
def program(payload: dict[str, Any]) -> None:
|
|
536
|
+
payload["limits"]["max_steps"] = 1
|
|
537
|
+
_rebind(payload)
|
|
538
|
+
|
|
539
|
+
def context_gate(payload: dict[str, Any]) -> None:
|
|
540
|
+
payload["mode"] = "apply"
|
|
541
|
+
payload["status"] = "applied"
|
|
542
|
+
|
|
543
|
+
def context_threshold(payload: dict[str, Any]) -> None:
|
|
544
|
+
payload["should_compress_now"] = False
|
|
545
|
+
|
|
546
|
+
def control(payload: dict[str, Any]) -> None:
|
|
547
|
+
payload["decision"] = "allow"
|
|
548
|
+
_rebind(payload)
|
|
549
|
+
|
|
550
|
+
def effect(payload: dict[str, Any]) -> None:
|
|
551
|
+
payload["status"] = "applied"
|
|
552
|
+
|
|
553
|
+
def entropy(payload: dict[str, Any]) -> None:
|
|
554
|
+
payload["measurement"] = {}
|
|
555
|
+
_rebind(payload)
|
|
556
|
+
|
|
557
|
+
def receipt(payload: dict[str, Any]) -> None:
|
|
558
|
+
payload["status"] = "simulated"
|
|
559
|
+
_rebind(payload)
|
|
560
|
+
|
|
561
|
+
def memory(payload: dict[str, Any]) -> None:
|
|
562
|
+
payload["retention"]["retention_class"] = "forget"
|
|
563
|
+
|
|
564
|
+
def memory_result(payload: dict[str, Any]) -> None:
|
|
565
|
+
payload["reused"] = True
|
|
566
|
+
payload.pop("memory_ref")
|
|
567
|
+
|
|
568
|
+
def learning(payload: dict[str, Any]) -> None:
|
|
569
|
+
payload["payload"]["auto_execute"] = True
|
|
570
|
+
|
|
571
|
+
def pattern(payload: dict[str, Any]) -> None:
|
|
572
|
+
payload["classification"] = "too_ambiguous"
|
|
573
|
+
payload["suggested_action"] = "auto_promote_template"
|
|
574
|
+
|
|
575
|
+
def policy(payload: dict[str, Any]) -> None:
|
|
576
|
+
payload["effective_to"] = "2026-07-12T00:00:00+00:00"
|
|
577
|
+
_rebind(payload)
|
|
578
|
+
|
|
579
|
+
def retention(payload: dict[str, Any]) -> None:
|
|
580
|
+
payload["entries"].append(copy.deepcopy(payload["entries"][0]))
|
|
581
|
+
|
|
582
|
+
def reversibility(payload: dict[str, Any]) -> None:
|
|
583
|
+
payload["human_approval_required"] = False
|
|
584
|
+
_rebind(payload)
|
|
585
|
+
|
|
586
|
+
def transition(payload: dict[str, Any]) -> None:
|
|
587
|
+
payload["after_ref"] = payload["before_ref"]
|
|
588
|
+
_rebind(payload)
|
|
589
|
+
|
|
590
|
+
def closeout(payload: dict[str, Any]) -> None:
|
|
591
|
+
payload.pop("report_ref")
|
|
592
|
+
|
|
593
|
+
def promotion(payload: dict[str, Any]) -> None:
|
|
594
|
+
payload["human_approval_required"] = False
|
|
595
|
+
|
|
596
|
+
def safety(payload: dict[str, Any]) -> None:
|
|
597
|
+
removed = payload["verification_tests"].pop()
|
|
598
|
+
payload["hazards"][0]["test_refs"].remove(removed["test_id"])
|
|
599
|
+
_rebind(payload)
|
|
600
|
+
|
|
601
|
+
specs: tuple[tuple[str, Mutator, str], ...] = (
|
|
602
|
+
("core.causal_trace.v1", causal, "dangling_edge_ref"),
|
|
603
|
+
("core.contract_program.v1", program, "program_step_limit_exceeded"),
|
|
604
|
+
("core.context_gate.v1", context_gate, "apply_result_required"),
|
|
605
|
+
("core.context_threshold.v1", context_threshold, "threshold_decision_mismatch"),
|
|
606
|
+
("core.control_decision.v1", control, "unsafe_allow_decision"),
|
|
607
|
+
("core.effect_result.v1", effect, "effect_status_dry_run_mismatch"),
|
|
608
|
+
("core.entropy_signal.v1", entropy, "measurement_required"),
|
|
609
|
+
("core.execution_receipt.v1", receipt, "simulated_transition_forbidden"),
|
|
610
|
+
("core.memory_artifact.v1", memory, "unsafe_memory_forgetting"),
|
|
611
|
+
("core.memory_generation_result.v1", memory_result, "reused_memory_reference_required"),
|
|
612
|
+
("core.operational_learning_event.v1", learning, "learning_event_authority_escalation"),
|
|
613
|
+
("core.pattern_candidate.v1", pattern, "ambiguous_pattern_cannot_promote"),
|
|
614
|
+
("core.physical_safety_assurance_case.v1", safety, "required_scenario_missing"),
|
|
615
|
+
("core.policy_lifecycle.v1", policy, "invalid_effective_interval"),
|
|
616
|
+
("core.retention_manifest.v1", retention, "duplicate_artifact_ref"),
|
|
617
|
+
("core.reversibility_policy.v1", reversibility, "responsible_approval_required"),
|
|
618
|
+
("core.state_transition.v1", transition, "state_transition_noop"),
|
|
619
|
+
("core.task_closeout.v1", closeout, "closeout_evidence_required"),
|
|
620
|
+
("core.template_promotion_candidate.v1", promotion, "promotion_approval_required"),
|
|
621
|
+
)
|
|
622
|
+
return tuple(
|
|
623
|
+
ContractProbe(
|
|
624
|
+
schema_version=version,
|
|
625
|
+
accepted=copy.deepcopy(accepted[version]),
|
|
626
|
+
mutate=mutator,
|
|
627
|
+
expected_error=expected_error,
|
|
628
|
+
)
|
|
629
|
+
for version, mutator, expected_error in specs
|
|
630
|
+
)
|