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,46 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://core-runtime-engine.local/schemas/core/context_threshold.v1.json",
4
+ "title": "ContextThreshold.v1",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": ["schema_version", "status", "source_type", "source_id", "should_compress_now", "reason"],
8
+ "properties": {
9
+ "schema_version": {
10
+ "type": "string",
11
+ "const": "core.context_threshold.v1"
12
+ },
13
+ "status": {
14
+ "type": "string"
15
+ },
16
+ "source_type": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "source_id": {
21
+ "type": "string",
22
+ "minLength": 1
23
+ },
24
+ "should_compress_now": {
25
+ "type": "boolean"
26
+ },
27
+ "reason": {
28
+ "type": "string"
29
+ },
30
+ "current_usage_percent": {
31
+ "type": "number"
32
+ },
33
+ "previous_usage_percent": {
34
+ "type": "number"
35
+ },
36
+ "ema_usage_percent": {
37
+ "type": "number"
38
+ },
39
+ "compression_threshold_percent": {
40
+ "type": "number"
41
+ },
42
+ "recommended_action": {
43
+ "type": "string"
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,186 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://core-runtime-engine.local/schemas/core/contract_program.v1.json",
4
+ "title": "ContractProgram.v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "type",
10
+ "program_id",
11
+ "program_version",
12
+ "authority",
13
+ "effect_policy",
14
+ "capabilities",
15
+ "limits",
16
+ "instructions",
17
+ "source_refs",
18
+ "declared_loss",
19
+ "fingerprint"
20
+ ],
21
+ "properties": {
22
+ "schema_version": {"type": "string", "const": "core.contract_program.v1"},
23
+ "type": {"type": "string", "const": "contract_program"},
24
+ "program_id": {"type": "string", "minLength": 1, "maxLength": 128},
25
+ "program_version": {"type": "string", "minLength": 1, "maxLength": 64},
26
+ "authority": {"type": "string", "const": "validation_only"},
27
+ "effect_policy": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "required": ["external_effects", "network_access", "filesystem_access", "state_apply"],
31
+ "properties": {
32
+ "external_effects": {"type": "boolean"},
33
+ "network_access": {"type": "boolean"},
34
+ "filesystem_access": {"type": "boolean"},
35
+ "state_apply": {"type": "boolean"}
36
+ }
37
+ },
38
+ "capabilities": {
39
+ "type": "array",
40
+ "minItems": 1,
41
+ "uniqueItems": true,
42
+ "items": {
43
+ "type": "string",
44
+ "enum": ["read_input", "assert", "derive", "stage_transition", "emit_result"]
45
+ }
46
+ },
47
+ "limits": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": ["max_steps", "max_items", "max_emits"],
51
+ "properties": {
52
+ "max_steps": {"type": "integer", "minimum": 1, "maximum": 128},
53
+ "max_items": {"type": "integer", "minimum": 0, "maximum": 10000},
54
+ "max_emits": {"type": "integer", "minimum": 0, "maximum": 128}
55
+ }
56
+ },
57
+ "instructions": {
58
+ "type": "array",
59
+ "minItems": 1,
60
+ "maxItems": 128,
61
+ "items": {"$ref": "#/$defs/instruction"}
62
+ },
63
+ "source_refs": {"$ref": "#/$defs/refs"},
64
+ "declared_loss": {
65
+ "type": "array",
66
+ "minItems": 1,
67
+ "uniqueItems": true,
68
+ "items": {"type": "string", "minLength": 1, "maxLength": 256}
69
+ },
70
+ "fingerprint": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"}
71
+ },
72
+ "$defs": {
73
+ "ref": {"type": "string", "minLength": 1, "maxLength": 256, "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},
74
+ "refs": {
75
+ "type": "array",
76
+ "minItems": 1,
77
+ "uniqueItems": true,
78
+ "items": {"$ref": "#/$defs/ref"}
79
+ },
80
+ "key": {"type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z][A-Za-z0-9_]{0,127}$"},
81
+ "scalar": {"type": ["string", "number", "integer", "boolean", "null"]},
82
+ "load_instruction": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["opcode", "key", "output"],
86
+ "properties": {
87
+ "opcode": {"const": "load"},
88
+ "key": {"$ref": "#/$defs/key"},
89
+ "output": {"$ref": "#/$defs/key"}
90
+ }
91
+ },
92
+ "assert_instruction": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": ["opcode", "key", "equals"],
96
+ "properties": {
97
+ "opcode": {"const": "assert"},
98
+ "key": {"$ref": "#/$defs/key"},
99
+ "equals": {"$ref": "#/$defs/scalar"}
100
+ }
101
+ },
102
+ "derive_instruction": {
103
+ "oneOf": [
104
+ {
105
+ "type": "object",
106
+ "additionalProperties": false,
107
+ "required": ["opcode", "operation", "input_keys", "output"],
108
+ "properties": {
109
+ "opcode": {"const": "derive"},
110
+ "operation": {"type": "string", "enum": ["copy", "count"]},
111
+ "input_keys": {
112
+ "type": "array",
113
+ "minItems": 1,
114
+ "maxItems": 128,
115
+ "uniqueItems": true,
116
+ "items": {"$ref": "#/$defs/key"}
117
+ },
118
+ "output": {"$ref": "#/$defs/key"}
119
+ }
120
+ },
121
+ {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "required": ["opcode", "operation", "registry_key", "input_keys", "output"],
125
+ "properties": {
126
+ "opcode": {"const": "derive"},
127
+ "operation": {"const": "registry"},
128
+ "registry_key": {
129
+ "type": "string",
130
+ "enum": ["rank.quantity.v1", "member.scale_adapter.v1", "regex.grammar_context.v1"]
131
+ },
132
+ "input_keys": {
133
+ "type": "array",
134
+ "minItems": 1,
135
+ "maxItems": 128,
136
+ "uniqueItems": true,
137
+ "items": {"$ref": "#/$defs/key"}
138
+ },
139
+ "output": {"$ref": "#/$defs/key"}
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ "transition_instruction": {
145
+ "type": "object",
146
+ "additionalProperties": false,
147
+ "required": ["opcode", "transition_id", "before_ref", "after_ref", "reversibility_class"],
148
+ "properties": {
149
+ "opcode": {"const": "transition"},
150
+ "transition_id": {"$ref": "#/$defs/ref"},
151
+ "before_ref": {"$ref": "#/$defs/ref"},
152
+ "after_ref": {"$ref": "#/$defs/ref"},
153
+ "reversibility_class": {"type": "string", "enum": ["reversible", "compensable", "irreversible", "unknown"]}
154
+ }
155
+ },
156
+ "emit_instruction": {
157
+ "type": "object",
158
+ "additionalProperties": false,
159
+ "required": ["opcode", "code", "value_key"],
160
+ "properties": {
161
+ "opcode": {"const": "emit"},
162
+ "code": {"type": "string", "minLength": 1, "maxLength": 128},
163
+ "value_key": {"$ref": "#/$defs/key"}
164
+ }
165
+ },
166
+ "halt_instruction": {
167
+ "type": "object",
168
+ "additionalProperties": false,
169
+ "required": ["opcode", "status"],
170
+ "properties": {
171
+ "opcode": {"const": "halt"},
172
+ "status": {"type": "string", "enum": ["passed", "blocked", "insufficient_data"]}
173
+ }
174
+ },
175
+ "instruction": {
176
+ "oneOf": [
177
+ {"$ref": "#/$defs/load_instruction"},
178
+ {"$ref": "#/$defs/assert_instruction"},
179
+ {"$ref": "#/$defs/derive_instruction"},
180
+ {"$ref": "#/$defs/transition_instruction"},
181
+ {"$ref": "#/$defs/emit_instruction"},
182
+ {"$ref": "#/$defs/halt_instruction"}
183
+ ]
184
+ }
185
+ }
186
+ }
@@ -0,0 +1,187 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://core-runtime-engine.local/schemas/core/contract_program.v2.json",
4
+ "title": "ContractProgram.v2",
5
+ "description": "Contract-Oriented Reproducible Evaluation: 6 eslabones, 9 verdicts, DSK v3 declarations.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "contract_id",
11
+ "eslabones"
12
+ ],
13
+ "properties": {
14
+ "schema_version": {
15
+ "type": "string",
16
+ "const": "core.contract_program.v2"
17
+ },
18
+ "contract_id": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "maxLength": 256
22
+ },
23
+ "eslabones": {
24
+ "type": "array",
25
+ "minItems": 6,
26
+ "maxItems": 6,
27
+ "items": {
28
+ "$ref": "#/$defs/eslabon"
29
+ }
30
+ }
31
+ },
32
+ "$defs": {
33
+ "eslabon_name": {
34
+ "type": "string",
35
+ "enum": [
36
+ "PERFIL",
37
+ "VOCABULARIO",
38
+ "QUERYSPEC",
39
+ "RESULTADO",
40
+ "VISTA",
41
+ "EVIDENCIA"
42
+ ]
43
+ },
44
+ "authority_ceiling": {
45
+ "type": "string",
46
+ "enum": [
47
+ "reference_only",
48
+ "advisory_only",
49
+ "domain_authoritative",
50
+ "externally_validated"
51
+ ]
52
+ },
53
+ "declared_loss": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "required": [
57
+ "properties",
58
+ "evidence_refs"
59
+ ],
60
+ "properties": {
61
+ "properties": {
62
+ "type": "array",
63
+ "minItems": 1,
64
+ "uniqueItems": true,
65
+ "items": {
66
+ "type": "string",
67
+ "minLength": 1,
68
+ "maxLength": 256
69
+ }
70
+ },
71
+ "evidence_refs": {
72
+ "type": "array",
73
+ "minItems": 1,
74
+ "uniqueItems": true,
75
+ "items": {
76
+ "type": "string",
77
+ "minLength": 1,
78
+ "maxLength": 256
79
+ }
80
+ }
81
+ }
82
+ },
83
+ "temporal_invariant": {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "required": [
87
+ "captured_at",
88
+ "valid_until"
89
+ ],
90
+ "properties": {
91
+ "captured_at": {
92
+ "type": "string",
93
+ "minLength": 1,
94
+ "maxLength": 64
95
+ },
96
+ "valid_until": {
97
+ "type": "string",
98
+ "minLength": 1,
99
+ "maxLength": 64
100
+ }
101
+ }
102
+ },
103
+ "translation_map": {
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "required": [
107
+ "source_field",
108
+ "target_field"
109
+ ],
110
+ "properties": {
111
+ "source_field": {
112
+ "type": "string",
113
+ "minLength": 1,
114
+ "maxLength": 128
115
+ },
116
+ "target_field": {
117
+ "type": "string",
118
+ "minLength": 1,
119
+ "maxLength": 128
120
+ }
121
+ }
122
+ },
123
+ "paraphrase_intent": {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "confirmed_by"
128
+ ],
129
+ "properties": {
130
+ "confirmed_by": {
131
+ "type": "string",
132
+ "enum": [
133
+ "operator",
134
+ "agent"
135
+ ]
136
+ }
137
+ }
138
+ },
139
+ "dsk_declaration": {
140
+ "type": "object",
141
+ "additionalProperties": false,
142
+ "required": [
143
+ "composition_rule",
144
+ "declared_loss",
145
+ "authority_ceiling"
146
+ ],
147
+ "properties": {
148
+ "composition_rule": {
149
+ "type": "string",
150
+ "minLength": 1,
151
+ "maxLength": 256
152
+ },
153
+ "declared_loss": {
154
+ "$ref": "#/$defs/declared_loss"
155
+ },
156
+ "authority_ceiling": {
157
+ "$ref": "#/$defs/authority_ceiling"
158
+ },
159
+ "temporal_invariant": {
160
+ "$ref": "#/$defs/temporal_invariant"
161
+ },
162
+ "translation_map": {
163
+ "$ref": "#/$defs/translation_map"
164
+ },
165
+ "paraphrase_intent": {
166
+ "$ref": "#/$defs/paraphrase_intent"
167
+ }
168
+ }
169
+ },
170
+ "eslabon": {
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "required": [
174
+ "name",
175
+ "dsk_declaration"
176
+ ],
177
+ "properties": {
178
+ "name": {
179
+ "$ref": "#/$defs/eslabon_name"
180
+ },
181
+ "dsk_declaration": {
182
+ "$ref": "#/$defs/dsk_declaration"
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://core-runtime-engine.local/schemas/core/control_decision.v1.json",
4
+ "title": "ControlDecision.v1",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": [
8
+ "schema_version",
9
+ "type",
10
+ "decision_id",
11
+ "intent_ref",
12
+ "target_ref",
13
+ "decision",
14
+ "reason",
15
+ "policy_refs",
16
+ "entropy_signal_refs",
17
+ "reversibility_class",
18
+ "evidence_required",
19
+ "created_at",
20
+ "fingerprint"
21
+ ],
22
+ "properties": {
23
+ "schema_version": {
24
+ "type": "string",
25
+ "const": "core.control_decision.v1"
26
+ },
27
+ "type": {
28
+ "type": "string",
29
+ "const": "control_decision"
30
+ },
31
+ "decision_id": {
32
+ "type": "string",
33
+ "minLength": 1
34
+ },
35
+ "intent_ref": {
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "pattern": "^(?!/).+"
39
+ },
40
+ "target_ref": {
41
+ "type": "string",
42
+ "minLength": 1,
43
+ "pattern": "^(?!/).+"
44
+ },
45
+ "decision": {
46
+ "type": "string",
47
+ "enum": ["allow", "simulate_only", "require_confirmation", "block"]
48
+ },
49
+ "reason": {
50
+ "type": "string",
51
+ "minLength": 1
52
+ },
53
+ "policy_refs": {
54
+ "type": "array",
55
+ "minItems": 1,
56
+ "items": {
57
+ "type": "string",
58
+ "minLength": 1,
59
+ "pattern": "^(?!/).+"
60
+ }
61
+ },
62
+ "entropy_signal_refs": {
63
+ "type": "array",
64
+ "minItems": 0,
65
+ "items": {
66
+ "type": "string",
67
+ "minLength": 1,
68
+ "pattern": "^(?!/).+"
69
+ }
70
+ },
71
+ "reversibility_class": {
72
+ "type": "string",
73
+ "enum": ["reversible", "compensable", "irreversible", "unknown"]
74
+ },
75
+ "evidence_required": {
76
+ "type": "array",
77
+ "minItems": 1,
78
+ "items": {
79
+ "type": "string",
80
+ "minLength": 1
81
+ }
82
+ },
83
+ "source_refs": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string",
87
+ "minLength": 1,
88
+ "pattern": "^(?!/).+"
89
+ }
90
+ },
91
+ "evidence_refs": {
92
+ "type": "array",
93
+ "items": {
94
+ "type": "string",
95
+ "minLength": 1,
96
+ "pattern": "^(?!/).+"
97
+ }
98
+ },
99
+ "created_at": {
100
+ "type": "string",
101
+ "minLength": 1
102
+ },
103
+ "fingerprint": {
104
+ "type": "string",
105
+ "minLength": 1
106
+ },
107
+ "warnings": {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "string"
111
+ }
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://core-runtime-engine.local/schemas/core/dsk.v3.json",
4
+ "title": "Deterministic Scale Kernel v3",
5
+ "description": "One explicit, typed and reproducible scale crossing.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "dsk_id", "crossing", "authority", "captured_at"],
9
+ "properties": {
10
+ "schema_version": {"type": "string", "const": "core.dsk.v3"},
11
+ "dsk_id": {"type": "string", "minLength": 1, "maxLength": 256},
12
+ "crossing": {"$ref": "#/$defs/crossing"},
13
+ "authority": {"$ref": "#/$defs/authority"},
14
+ "captured_at": {"type": "string", "minLength": 1, "maxLength": 64},
15
+ "policies": {"$ref": "#/$defs/policies"}
16
+ },
17
+ "$defs": {
18
+ "quantity": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": ["resource", "unit"],
22
+ "properties": {
23
+ "resource": {"type": "string", "minLength": 1, "maxLength": 128},
24
+ "unit": {"type": "string", "minLength": 1, "maxLength": 128},
25
+ "value": {"type": "number"}
26
+ }
27
+ },
28
+ "conversion": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["source_unit", "target_unit", "numerator", "denominator"],
32
+ "properties": {
33
+ "source_unit": {"type": "string", "minLength": 1, "maxLength": 128},
34
+ "target_unit": {"type": "string", "minLength": 1, "maxLength": 128},
35
+ "numerator": {"type": "integer", "minimum": 1},
36
+ "denominator": {"type": "integer", "minimum": 1}
37
+ }
38
+ },
39
+ "crossing": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["source", "target", "conversion", "composition_rule", "declared_loss", "evidence_refs"],
43
+ "properties": {
44
+ "source": {"$ref": "#/$defs/quantity"},
45
+ "target": {"$ref": "#/$defs/quantity"},
46
+ "conversion": {"$ref": "#/$defs/conversion"},
47
+ "composition_rule": {"type": "string", "minLength": 1, "maxLength": 256},
48
+ "declared_loss": {
49
+ "type": "array",
50
+ "minItems": 1,
51
+ "uniqueItems": true,
52
+ "items": {"type": "string", "minLength": 1, "maxLength": 256}
53
+ },
54
+ "evidence_refs": {
55
+ "type": "array",
56
+ "minItems": 1,
57
+ "uniqueItems": true,
58
+ "items": {"type": "string", "minLength": 1, "maxLength": 256}
59
+ }
60
+ }
61
+ },
62
+ "authority": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": ["ceiling", "source"],
66
+ "properties": {
67
+ "ceiling": {
68
+ "type": "string",
69
+ "enum": ["reference_only", "advisory_only", "domain_authoritative", "externally_validated"]
70
+ },
71
+ "source": {"type": "string", "enum": ["source_declaration", "external_validator"]}
72
+ }
73
+ },
74
+ "policies": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "properties": {
78
+ "discrete_multiple": {
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": ["multiple"],
82
+ "properties": {
83
+ "multiple": {"type": "integer", "minimum": 1}
84
+ }
85
+ },
86
+ "resolution": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": ["max_decimal_places"],
90
+ "properties": {
91
+ "max_decimal_places": {"type": "integer", "minimum": 0, "maximum": 18}
92
+ }
93
+ },
94
+ "threshold": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": ["minimum_value"],
98
+ "properties": {
99
+ "minimum_value": {"type": "number"}
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://core-runtime-engine.local/schemas/core/effect_result.v1.json",
4
+ "title": "EffectResult.v1",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": ["schema_version", "status", "effect_type", "dry_run", "reason"],
8
+ "properties": {
9
+ "schema_version": {
10
+ "type": "string",
11
+ "const": "core.effect_result.v1"
12
+ },
13
+ "status": {
14
+ "type": "string",
15
+ "enum": ["dry_run", "sent", "skipped", "applied", "failed"]
16
+ },
17
+ "effect_type": {
18
+ "type": "string",
19
+ "minLength": 1
20
+ },
21
+ "dry_run": {
22
+ "type": "boolean"
23
+ },
24
+ "reason": {
25
+ "type": "string"
26
+ },
27
+ "provider": {
28
+ "type": "string"
29
+ },
30
+ "target_ref": {
31
+ "type": "string"
32
+ },
33
+ "payload": {},
34
+ "response": {},
35
+ "error": {
36
+ "type": "string"
37
+ }
38
+ }
39
+ }