gentle-pi 1.2.0 → 2.0.0

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 (107) hide show
  1. package/README.md +40 -9
  2. package/assets/agents/review-readability.md +0 -1
  3. package/assets/agents/review-reliability.md +0 -1
  4. package/assets/agents/review-resilience.md +0 -1
  5. package/assets/agents/review-risk.md +0 -1
  6. package/contracts/review-integration/v1/fixtures/binding-revision-conflict.fixture.json +25 -0
  7. package/contracts/review-integration/v1/fixtures/capabilities-v1.2.fixture.json +263 -0
  8. package/contracts/review-integration/v1/fixtures/capabilities-v1.3.fixture.json +301 -0
  9. package/contracts/review-integration/v1/fixtures/capabilities-v1.4.fixture.json +312 -0
  10. package/contracts/review-integration/v1/fixtures/capabilities-v1.5.fixture.json +321 -0
  11. package/contracts/review-integration/v1/fixtures/consent.fixture.json +36 -0
  12. package/contracts/review-integration/v1/fixtures/final-verification-incident.fixture.json +1 -0
  13. package/contracts/review-integration/v1/fixtures/operation.fixture.json +4 -0
  14. package/contracts/review-integration/v1/fixtures/repair-preflight.fixture.json +54 -0
  15. package/contracts/review-integration/v1/fixtures/start-v2.fixture.json +97 -0
  16. package/contracts/review-integration/v1/fixtures/start.fixture.json +25 -1
  17. package/contracts/review-integration/v1/fixtures/status-ambiguous.fixture.json +4 -0
  18. package/contracts/review-integration/v1/fixtures/status-corrupted.fixture.json +4 -0
  19. package/contracts/review-integration/v1/fixtures/status-recover.fixture.json +4 -0
  20. package/contracts/review-integration/v1/fixtures/status-unrelated.fixture.json +4 -0
  21. package/contracts/review-integration/v1/fixtures/status-v2-ambiguous.fixture.json +110 -0
  22. package/contracts/review-integration/v1/fixtures/status-v2-corrupted.fixture.json +107 -0
  23. package/contracts/review-integration/v1/fixtures/status-v2-final-verification-retry.fixture.json +192 -0
  24. package/contracts/review-integration/v1/fixtures/status-v2-recover.fixture.json +130 -0
  25. package/contracts/review-integration/v1/fixtures/status-v2-repair.fixture.json +161 -0
  26. package/contracts/review-integration/v1/fixtures/status-v2-unrelated.fixture.json +103 -0
  27. package/contracts/review-integration/v1/fixtures/status-v2.fixture.json +193 -0
  28. package/contracts/review-integration/v1/fixtures/status.fixture.json +19 -5
  29. package/contracts/review-integration/v1/fixtures/verification-evidence.fixture.json +1 -0
  30. package/contracts/review-integration/v1/schemas/admitted-result.schema.json +35 -0
  31. package/contracts/review-integration/v1/schemas/artifact-subject.schema.json +33 -0
  32. package/contracts/review-integration/v1/schemas/authority-repair-assessment.schema.json +247 -0
  33. package/contracts/review-integration/v1/schemas/capabilities-v1.2.schema.json +249 -0
  34. package/contracts/review-integration/v1/schemas/capabilities-v1.3.schema.json +429 -0
  35. package/contracts/review-integration/v1/schemas/capabilities-v1.4.schema.json +432 -0
  36. package/contracts/review-integration/v1/schemas/capabilities-v1.5.schema.json +154 -0
  37. package/contracts/review-integration/v1/schemas/consent.schema.json +86 -0
  38. package/contracts/review-integration/v1/schemas/failure.schema.json +54 -8
  39. package/contracts/review-integration/v1/schemas/final-verification-incident.schema.json +51 -0
  40. package/contracts/review-integration/v1/schemas/operation.schema.json +204 -31
  41. package/contracts/review-integration/v1/schemas/repair.schema.json +251 -0
  42. package/contracts/review-integration/v1/schemas/result-artifact-v2.schema.json +38 -0
  43. package/contracts/review-integration/v1/schemas/start-v2.schema.json +216 -0
  44. package/contracts/review-integration/v1/schemas/start.schema.json +79 -3
  45. package/contracts/review-integration/v1/schemas/status-v2.schema.json +313 -0
  46. package/contracts/review-integration/v1/schemas/status.schema.json +37 -10
  47. package/contracts/review-integration/v1/schemas/targeted-validation-request.schema.json +46 -0
  48. package/contracts/review-integration/v1/schemas/verification-evidence.schema.json +64 -0
  49. package/contracts/review-integration/v2/fixtures/capabilities.fixture.json +111 -0
  50. package/contracts/review-integration/v2/fixtures/consent.fixture.json +36 -0
  51. package/contracts/review-integration/v2/fixtures/start.fixture.json +93 -0
  52. package/contracts/review-integration/v2/fixtures/status.fixture.json +113 -0
  53. package/contracts/review-integration/v2/schemas/admitted-result.schema.json +14 -0
  54. package/contracts/review-integration/v2/schemas/artifact-subject.schema.json +36 -0
  55. package/contracts/review-integration/v2/schemas/capabilities.schema.json +111 -0
  56. package/contracts/review-integration/v2/schemas/consent.schema.json +70 -0
  57. package/contracts/review-integration/v2/schemas/failure.schema.json +35 -0
  58. package/contracts/review-integration/v2/schemas/operation.schema.json +46 -0
  59. package/contracts/review-integration/v2/schemas/repair.schema.json +22 -0
  60. package/contracts/review-integration/v2/schemas/start.schema.json +106 -0
  61. package/contracts/review-integration/v2/schemas/status.schema.json +104 -0
  62. package/docs/native-authority-architecture.md +18 -3
  63. package/docs/review-integration.md +175 -27
  64. package/extensions/gentle-ai.ts +414 -19
  65. package/lib/gentle-ai-binary.ts +1 -1
  66. package/lib/native-review-cli.ts +679 -57
  67. package/lib/review-candidate-view.ts +131 -1
  68. package/lib/review-compact-contract.ts +12 -3
  69. package/lib/review-consent-latch.ts +51 -0
  70. package/lib/review-correction-lifecycle.ts +170 -0
  71. package/lib/review-integration-v2.ts +1563 -0
  72. package/package.json +15 -11
  73. package/runtime/gentle-ai-binary.mjs +1 -1
  74. package/runtime/native-review-cli.mjs +663 -41
  75. package/runtime/review-integration-v2.mjs +1564 -0
  76. package/scripts/build-git-commit-transaction-runner.mjs +1 -1
  77. package/scripts/gentle-ai-installer.mjs +16 -11
  78. package/scripts/install-gentle-ai.mjs +7 -3
  79. package/scripts/test-packed-runner.mjs +2 -2
  80. package/scripts/verify-package-files.mjs +216 -64
  81. package/skills/release/SKILL.md +38 -11
  82. package/tests/devbinary/native-review-parity.devtest.ts +348 -0
  83. package/tests/gentle-ai-binary.test.ts +8 -1
  84. package/tests/gentle-ai-installer.test.ts +24 -21
  85. package/tests/native-binary-gate.test.ts +145 -0
  86. package/tests/native-review-capability-contract.test.ts +87 -0
  87. package/tests/native-review-cli.test.ts +44 -1
  88. package/tests/native-review-parity-runtime.test.ts +70 -23
  89. package/tests/native-review-parity.test.ts +673 -0
  90. package/tests/native-risk-evidence-parity.test.ts +91 -0
  91. package/tests/package-manifest.test.ts +72 -7
  92. package/tests/review-actor-tool-deny.test.ts +20 -5
  93. package/tests/review-candidate-view.test.ts +331 -1
  94. package/tests/review-compact-contract.test.ts +5 -0
  95. package/tests/review-consent-latch.test.ts +67 -0
  96. package/tests/review-controller-native-recovery.test.ts +180 -5
  97. package/tests/review-controller-native-routing.test.ts +385 -12
  98. package/tests/review-controller-workspace-root.test.ts +26 -6
  99. package/tests/review-correction-lifecycle.test.ts +174 -0
  100. package/tests/review-integration-v2.test.ts +539 -0
  101. package/tests/runtime-harness.mjs +187 -0
  102. package/tests/support/native-binary-gate.ts +86 -0
  103. package/tests/verify-package-files.test.ts +119 -0
  104. package/lib/review-integration-v1.ts +0 -795
  105. package/runtime/review-integration-v1.mjs +0 -796
  106. package/tests/native-review-integration-v1.test.ts +0 -102
  107. package/tests/review-integration-v1.test.ts +0 -530
@@ -0,0 +1,313 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://gentle-ai.dev/contracts/review-integration/v1/schemas/status-v2.schema.json",
4
+ "title": "Gentle AI Review Integration Target Status v2",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema",
9
+ "contract",
10
+ "operation",
11
+ "applicability",
12
+ "receipt",
13
+ "action",
14
+ "replayability",
15
+ "target_identity",
16
+ "projection",
17
+ "repair",
18
+ "candidates"
19
+ ],
20
+ "properties": {
21
+ "schema": { "const": "gentle-ai.review-integration.status/v2" },
22
+ "contract": { "const": "gentle-ai.review-integration/v1" },
23
+ "operation": { "const": "review.status" },
24
+ "applicability": { "enum": ["current_target", "unrelated", "ambiguous", "corrupted"] },
25
+ "authority": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": ["version", "lineage_id", "state", "generation", "revision"],
29
+ "properties": {
30
+ "version": { "enum": ["compact-v2", "legacy-v1"] },
31
+ "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
32
+ "state": { "type": "string", "minLength": 1 },
33
+ "generation": { "type": "integer", "minimum": 1 },
34
+ "revision": { "$ref": "#/$defs/sha256" }
35
+ }
36
+ },
37
+ "receipt": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": ["status"],
41
+ "properties": {
42
+ "status": { "enum": ["expected_missing", "present", "publication_pending", "not_applicable"] },
43
+ "identity": { "$ref": "#/$defs/sha256" }
44
+ }
45
+ },
46
+ "action": { "enum": ["start", "finalize", "validate", "recover", "retry_final_verification", "maintainer_action", "select_lineage", "repair_authority", "reconcile_finalize", "stop"] },
47
+ "action_disposition": { "enum": ["scope_changed", "invalidated", "escalated", "final_verification_retry"] },
48
+ "replayability": { "enum": ["not_replayable", "exact_replay_safe", "status_required", "manual_action_required"] },
49
+ "frozen": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["tier", "original_changed_lines", "correction_budget"],
53
+ "properties": {
54
+ "tier": { "enum": ["low", "medium", "high"] },
55
+ "original_changed_lines": { "type": "integer", "minimum": 0 },
56
+ "correction_budget": { "type": "integer", "minimum": 0, "maximum": 200 }
57
+ }
58
+ },
59
+ "target_identity": { "$ref": "#/$defs/sha256" },
60
+ "authority_target_identity": { "$ref": "#/$defs/sha256" },
61
+ "projection": { "$ref": "projection.schema.json" },
62
+ "repair": { "$ref": "authority-repair-assessment.schema.json" },
63
+ "candidates": {
64
+ "type": "array",
65
+ "uniqueItems": true,
66
+ "items": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }
67
+ },
68
+ "reconciliation": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["required"],
72
+ "properties": { "required": { "const": true } }
73
+ },
74
+ "eligibility": { "$ref": "#/$defs/action_eligibility" },
75
+ "next_transition": { "$ref": "#/$defs/next_transition" },
76
+ "validation_request": { "$ref": "targeted-validation-request.schema.json" },
77
+ "final_verification_retry": {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "required": ["incident_schema", "incident_class", "validating_revision", "target_identity", "failed_evidence_hash", "finalize_request_digest"],
81
+ "properties": {
82
+ "incident_schema": { "const": "gentle-ai.review-final-verification-incident/v1" },
83
+ "incident_class": { "const": "procedural_tooling_failure" },
84
+ "validating_revision": { "$ref": "#/$defs/sha256" },
85
+ "target_identity": { "$ref": "#/$defs/sha256" },
86
+ "failed_evidence_hash": { "$ref": "#/$defs/sha256" },
87
+ "failed_evidence_record_digest": { "$ref": "#/$defs/sha256" },
88
+ "finalize_request_digest": { "$ref": "#/$defs/sha256" }
89
+ }
90
+ }
91
+ },
92
+ "$defs": {
93
+ "sha256": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
94
+ "next_transition": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": ["kind", "reason_code"],
98
+ "properties": {
99
+ "kind": { "enum": ["execute", "collect", "stop"] },
100
+ "reason_code": { "type": "string", "pattern": "^[a-z0-9_]+$" },
101
+ "execute": { "$ref": "#/$defs/transition_execution" },
102
+ "collect": { "$ref": "#/$defs/transition_collection" }
103
+ },
104
+ "allOf": [
105
+ { "if": { "properties": { "kind": { "const": "execute" } }, "required": ["kind"] }, "then": { "required": ["execute"], "not": { "required": ["collect"] } } },
106
+ { "if": { "properties": { "kind": { "const": "collect" } }, "required": ["kind"] }, "then": { "required": ["collect"], "not": { "required": ["execute"] } } },
107
+ { "if": { "properties": { "kind": { "const": "stop" } }, "required": ["kind"] }, "then": { "not": { "anyOf": [{ "required": ["execute"] }, { "required": ["collect"] }] } } }
108
+ ]
109
+ },
110
+ "transition_argument": {
111
+ "$comment": "One argument of a transition. \"token\", when present, is the exact argv token rendering this argument for a command this product runs, e.g. \"--lineage=review-abc\". It is required on an execute argument (see executable_transition_argument) and present on the arguments of a collect input whose capture_operation names an operation this product performs, because those arguments are literally that command's flags. It is absent on preconditions, on selector_arguments, and on the arguments of an \"external.*\" capture operation, which are assertions, a normalized echo, and values to hand elsewhere rather than argv.",
112
+ "type": "object", "additionalProperties": false, "required": ["name", "value"],
113
+ "properties": { "name": { "type": "string", "pattern": "^[a-z0-9_-]+$" }, "value": { "type": "string", "minLength": 1 }, "token": { "type": "string", "minLength": 1 } }
114
+ },
115
+ "executable_transition_argument": {
116
+ "$comment": "One argv entry of an execute transition. Unlike preconditions and selector_arguments -- which are assertions and a normalized echo the product never tokenizes -- an execute argument is always literally executed, so its exact runnable token is required rather than optional.",
117
+ "allOf": [{ "$ref": "#/$defs/transition_argument" }],
118
+ "type": "object", "required": ["name", "value", "token"]
119
+ },
120
+ "transition_binding": {
121
+ "type": "object", "additionalProperties": false, "required": ["target_identity"],
122
+ "properties": { "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "revision": { "$ref": "#/$defs/sha256" }, "target_identity": { "$ref": "#/$defs/sha256" }, "repository_context": { "type": "string", "pattern": "^rctx1_[0-9a-f]{64}$" } }
123
+ },
124
+ "transition_execution": {
125
+ "type": "object", "additionalProperties": false, "required": ["operation", "arguments", "preconditions", "binding"],
126
+ "properties": {
127
+ "operation": { "enum": ["review.start", "review.finalize", "review.recover", "review.repair", "review.validate"] },
128
+ "command": { "$comment": "The complete, literally runnable command line for this transition, e.g. \"gentle-ai review start --contract=... --target=...\". Operation alone is a dotted logical name; command is what a caller can paste. Argument words are the execute arguments' own tokens, in order, POSIX-shell-quoted only when a value would otherwise be word-split.", "type": "string", "minLength": 1, "pattern": "^gentle-ai review [a-z][a-z-]*" },
129
+ "arguments": { "type": "array", "items": { "$ref": "#/$defs/executable_transition_argument" } },
130
+ "selector_arguments": { "type": "array", "items": { "$ref": "#/$defs/transition_argument" } },
131
+ "preconditions": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/transition_argument" } },
132
+ "binding": { "$ref": "#/$defs/transition_binding" },
133
+ "artifacts": { "type": "array", "items": { "$ref": "#/$defs/transition_artifact" } }
134
+ }
135
+ },
136
+ "transition_artifact": {
137
+ "type": "object", "additionalProperties": false, "required": ["schema", "capability", "sha256", "lineage_id", "target_identity", "lens", "selected_order", "subject_hash", "admission_decision"],
138
+ "properties": {
139
+ "schema": { "const": "gentle-ai.review-result-artifact/v2" }, "capability": { "const": "review.native_result_artifact" }, "sha256": { "$ref": "#/$defs/sha256" },
140
+ "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "target_identity": { "$ref": "#/$defs/sha256" }, "lens": { "type": "string", "minLength": 1 }, "selected_order": { "type": "integer", "minimum": 0 },
141
+ "subject_hash": { "$ref": "#/$defs/sha256" }, "admission_decision": { "const": "completed" }
142
+ }
143
+ },
144
+ "transition_collection": {
145
+ "type": "object", "additionalProperties": false, "required": ["inputs"],
146
+ "properties": { "inputs": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/transition_input" } } }
147
+ },
148
+ "transition_input": {
149
+ "type": "object", "additionalProperties": false, "required": ["name", "schema", "capture_operation", "arguments"],
150
+ "properties": {
151
+ "name": { "type": "string", "pattern": "^[a-z0-9_]+$" }, "schema": { "type": "string", "minLength": 1 }, "capture_operation": { "type": "string", "minLength": 1 },
152
+ "arguments": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/transition_argument" } },
153
+ "artifact_subject": { "$ref": "artifact-subject.schema.json" },
154
+ "candidate_diff": { "$ref": "start-v2.schema.json#/$defs/frozen_candidate_diff" },
155
+ "changed_path_manifest": { "type": "array", "uniqueItems": true, "items": { "$ref": "start-v2.schema.json#/$defs/changed_path" } },
156
+ "validation_request": { "$ref": "targeted-validation-request.schema.json" }
157
+ },
158
+ "allOf": [
159
+ {
160
+ "if": { "properties": { "capture_operation": { "const": "external.run_targeted_validation" } }, "required": ["capture_operation"] },
161
+ "then": { "required": ["validation_request"], "properties": { "schema": { "const": "gentle-ai.review-targeted-validation-request/v1" } } },
162
+ "else": { "not": { "required": ["validation_request"] } }
163
+ },
164
+ {
165
+ "if": { "properties": { "capture_operation": { "const": "review.capture-result" } }, "required": ["capture_operation"] },
166
+ "then": { "required": ["artifact_subject", "candidate_diff", "changed_path_manifest"], "properties": { "schema": { "const": "https://gentle-ai.dev/schema/review/reviewer/v1" } } },
167
+ "else": {
168
+ "allOf": [
169
+ { "not": { "required": ["artifact_subject"] } },
170
+ { "not": { "required": ["candidate_diff"] } },
171
+ { "not": { "required": ["changed_path_manifest"] } }
172
+ ]
173
+ }
174
+ }
175
+ ]
176
+ },
177
+ "action_eligibility": {
178
+ "type": "object",
179
+ "additionalProperties": false,
180
+ "required": ["allowed_actions", "forbidden_actions"],
181
+ "properties": {
182
+ "allowed_actions": {
183
+ "type": "array",
184
+ "minItems": 1,
185
+ "maxItems": 1,
186
+ "items": {
187
+ "type": "object",
188
+ "additionalProperties": false,
189
+ "required": ["action", "reason_code", "required_inputs"],
190
+ "properties": {
191
+ "action": { "enum": ["stop", "review.start", "review.finalize", "review.validate", "review.recover", "review.repair", "review.retry_final_verification"] },
192
+ "reason_code": { "type": "string", "pattern": "^[a-z0-9_]+$" },
193
+ "required_inputs": { "type": "array", "items": { "type": "string", "pattern": "^[a-z0-9_]+$" } },
194
+ "disposition": { "enum": ["scope_changed", "invalidated", "escalated", "final_verification_retry"] },
195
+ "binding": {
196
+ "type": "object",
197
+ "additionalProperties": false,
198
+ "required": ["lineage_id", "revision", "target_identity"],
199
+ "properties": {
200
+ "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
201
+ "revision": { "$ref": "#/$defs/sha256" },
202
+ "target_identity": { "$ref": "#/$defs/sha256" }
203
+ }
204
+ }
205
+ },
206
+ "allOf": [
207
+ {
208
+ "if": { "properties": { "action": { "enum": ["review.recover", "review.retry_final_verification"] } }, "required": ["action"] },
209
+ "then": { "required": ["disposition", "binding"] },
210
+ "else": { "not": { "anyOf": [{ "required": ["disposition"] }, { "required": ["binding"] }] } }
211
+ }
212
+ ]
213
+ }
214
+ },
215
+ "forbidden_actions": {
216
+ "type": "array",
217
+ "items": {
218
+ "type": "object",
219
+ "additionalProperties": false,
220
+ "required": ["action", "reason_code"],
221
+ "properties": {
222
+ "action": { "enum": ["review.abandon", "review.finalize", "review.invalidate", "review.quarantine-legacy", "review.reclaim", "review.reconcile-authority", "review.reconcile-authority-batch", "review.recover", "review.repair", "review.retry_final_verification", "review.start", "review.validate"] },
223
+ "reason_code": { "type": "string", "pattern": "^[a-z0-9_]+$" }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ },
230
+ "allOf": [
231
+ {
232
+ "if": { "properties": { "action": { "const": "reconcile_finalize" } } },
233
+ "then": {
234
+ "required": ["reconciliation"],
235
+ "properties": {
236
+ "applicability": { "const": "current_target" },
237
+ "replayability": { "const": "status_required" }
238
+ }
239
+ },
240
+ "else": { "not": { "required": ["reconciliation"] } }
241
+ },
242
+ {
243
+ "if": { "properties": { "action": { "enum": ["recover", "retry_final_verification"] } }, "required": ["action"] },
244
+ "then": { "required": ["action_disposition"] },
245
+ "else": { "not": { "required": ["action_disposition"] } }
246
+ },
247
+ {
248
+ "if": { "properties": { "applicability": { "const": "current_target" } } },
249
+ "then": { "required": ["authority"] },
250
+ "else": { "not": { "anyOf": [{ "required": ["authority"] }, { "required": ["frozen"] }, { "required": ["authority_target_identity"] }] } }
251
+ },
252
+ {
253
+ "if": {
254
+ "required": ["authority"],
255
+ "properties": {
256
+ "applicability": { "const": "current_target" },
257
+ "authority": {
258
+ "required": ["version"],
259
+ "properties": { "version": { "const": "compact-v2" } }
260
+ }
261
+ }
262
+ },
263
+ "then": { "required": ["frozen"] }
264
+ },
265
+ {
266
+ "if": {
267
+ "required": ["authority"],
268
+ "properties": {
269
+ "applicability": { "const": "current_target" },
270
+ "authority": {
271
+ "required": ["version"],
272
+ "properties": { "version": { "const": "legacy-v1" } }
273
+ }
274
+ }
275
+ },
276
+ "then": {
277
+ "not": { "anyOf": [{ "required": ["frozen"] }, { "required": ["authority_target_identity"] }] },
278
+ "properties": {
279
+ "receipt": {
280
+ "properties": { "status": { "enum": ["expected_missing", "present"] } }
281
+ }
282
+ }
283
+ }
284
+ },
285
+ {
286
+ "if": { "required": ["validation_request"] },
287
+ "then": {
288
+ "properties": {
289
+ "applicability": { "const": "current_target" },
290
+ "authority": { "properties": { "state": { "const": "correction_required" } }, "required": ["state"] }
291
+ }
292
+ }
293
+ },
294
+ {
295
+ "if": { "properties": { "action": { "const": "retry_final_verification" } }, "required": ["action"] },
296
+ "then": {
297
+ "required": ["final_verification_retry"],
298
+ "properties": {
299
+ "applicability": { "const": "current_target" },
300
+ "authority": {
301
+ "required": ["version", "state"],
302
+ "properties": {
303
+ "version": { "const": "compact-v2" },
304
+ "state": { "const": "escalated" }
305
+ }
306
+ },
307
+ "action_disposition": { "const": "final_verification_retry" }
308
+ }
309
+ },
310
+ "else": { "not": { "required": ["final_verification_retry"] } }
311
+ }
312
+ ]
313
+ }
@@ -69,7 +69,8 @@
69
69
  "properties": { "required": { "const": true } }
70
70
  },
71
71
  "eligibility": { "$ref": "#/$defs/action_eligibility" },
72
- "next_transition": { "$ref": "#/$defs/next_transition" }
72
+ "next_transition": { "$ref": "#/$defs/next_transition" },
73
+ "validation_request": { "$ref": "targeted-validation-request.schema.json" }
73
74
  },
74
75
  "$defs": {
75
76
  "sha256": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
@@ -90,28 +91,37 @@
90
91
  ]
91
92
  },
92
93
  "transition_argument": {
94
+ "$comment": "One argument of a transition. \"token\", when present, is the exact argv token rendering this argument for a command this product runs, e.g. \"--lineage=review-abc\". It is required on an execute argument (see executable_transition_argument) and present on the arguments of a collect input whose capture_operation names an operation this product performs, because those arguments are literally that command's flags. It is absent on preconditions, on selector_arguments, and on the arguments of an \"external.*\" capture operation, which are assertions, a normalized echo, and values to hand elsewhere rather than argv.",
93
95
  "type": "object", "additionalProperties": false, "required": ["name", "value"],
94
- "properties": { "name": { "type": "string", "pattern": "^[a-z0-9_-]+$" }, "value": { "type": "string", "minLength": 1 } }
96
+ "properties": { "name": { "type": "string", "pattern": "^[a-z0-9_-]+$" }, "value": { "type": "string", "minLength": 1 }, "token": { "type": "string", "minLength": 1 } }
97
+ },
98
+ "executable_transition_argument": {
99
+ "$comment": "One argv entry of an execute transition. Unlike preconditions and selector_arguments -- which are assertions and a normalized echo the product never tokenizes -- an execute argument is always literally executed, so its exact runnable token is required rather than optional.",
100
+ "allOf": [{ "$ref": "#/$defs/transition_argument" }],
101
+ "type": "object", "required": ["name", "value", "token"]
95
102
  },
96
103
  "transition_binding": {
97
104
  "type": "object", "additionalProperties": false, "required": ["target_identity"],
98
- "properties": { "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "revision": { "$ref": "#/$defs/sha256" }, "target_identity": { "$ref": "#/$defs/sha256" } }
105
+ "properties": { "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "revision": { "$ref": "#/$defs/sha256" }, "target_identity": { "$ref": "#/$defs/sha256" }, "repository_context": { "type": "string", "pattern": "^rctx1_[0-9a-f]{64}$" } }
99
106
  },
100
107
  "transition_execution": {
101
108
  "type": "object", "additionalProperties": false, "required": ["operation", "arguments", "preconditions", "binding"],
102
109
  "properties": {
103
110
  "operation": { "enum": ["review.start", "review.finalize", "review.recover", "review.validate"] },
104
- "arguments": { "type": "array", "items": { "$ref": "#/$defs/transition_argument" } },
111
+ "command": { "$comment": "The complete, literally runnable command line for this transition, e.g. \"gentle-ai review start --contract=... --target=...\". Operation alone is a dotted logical name; command is what a caller can paste. Argument words are the execute arguments' own tokens, in order, POSIX-shell-quoted only when a value would otherwise be word-split.", "type": "string", "minLength": 1, "pattern": "^gentle-ai review [a-z][a-z-]*" },
112
+ "arguments": { "type": "array", "items": { "$ref": "#/$defs/executable_transition_argument" } },
113
+ "selector_arguments": { "type": "array", "items": { "$ref": "#/$defs/transition_argument" } },
105
114
  "preconditions": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/transition_argument" } },
106
115
  "binding": { "$ref": "#/$defs/transition_binding" },
107
116
  "artifacts": { "type": "array", "items": { "$ref": "#/$defs/transition_artifact" } }
108
117
  }
109
118
  },
110
119
  "transition_artifact": {
111
- "type": "object", "additionalProperties": false, "required": ["schema", "capability", "sha256", "lineage_id", "target_identity", "lens", "selected_order"],
120
+ "type": "object", "additionalProperties": false, "required": ["schema", "capability", "sha256", "lineage_id", "target_identity", "lens", "selected_order", "subject_hash", "admission_decision"],
112
121
  "properties": {
113
- "schema": { "const": "gentle-ai.review-result-artifact/v1" }, "capability": { "const": "review.native_result_artifact" }, "sha256": { "$ref": "#/$defs/sha256" },
114
- "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "target_identity": { "$ref": "#/$defs/sha256" }, "lens": { "type": "string", "minLength": 1 }, "selected_order": { "type": "integer", "minimum": 0 }
122
+ "schema": { "const": "gentle-ai.review-result-artifact/v2" }, "capability": { "const": "review.native_result_artifact" }, "sha256": { "$ref": "#/$defs/sha256" },
123
+ "lineage_id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "target_identity": { "$ref": "#/$defs/sha256" }, "lens": { "type": "string", "minLength": 1 }, "selected_order": { "type": "integer", "minimum": 0 },
124
+ "subject_hash": { "$ref": "#/$defs/sha256" }, "admission_decision": { "const": "completed" }
115
125
  }
116
126
  },
117
127
  "transition_collection": {
@@ -122,8 +132,16 @@
122
132
  "type": "object", "additionalProperties": false, "required": ["name", "schema", "capture_operation", "arguments"],
123
133
  "properties": {
124
134
  "name": { "type": "string", "pattern": "^[a-z0-9_]+$" }, "schema": { "type": "string", "minLength": 1 }, "capture_operation": { "type": "string", "minLength": 1 },
125
- "arguments": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/transition_argument" } }
126
- }
135
+ "arguments": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/transition_argument" } },
136
+ "validation_request": { "$ref": "targeted-validation-request.schema.json" }
137
+ },
138
+ "allOf": [
139
+ {
140
+ "if": { "properties": { "capture_operation": { "const": "external.run_targeted_validation" } }, "required": ["capture_operation"] },
141
+ "then": { "required": ["validation_request"], "properties": { "schema": { "const": "gentle-ai.review-targeted-validation-request/v1" } } },
142
+ "else": { "not": { "required": ["validation_request"] } }
143
+ }
144
+ ]
127
145
  },
128
146
  "action_eligibility": {
129
147
  "type": "object",
@@ -170,7 +188,7 @@
170
188
  "additionalProperties": false,
171
189
  "required": ["action", "reason_code"],
172
190
  "properties": {
173
- "action": { "enum": ["review.abandon", "review.finalize", "review.invalidate", "review.quarantine-legacy", "review.reclaim", "review.reconcile-authority", "review.recover", "review.start", "review.validate"] },
191
+ "action": { "enum": ["review.abandon", "review.finalize", "review.invalidate", "review.quarantine-legacy", "review.reclaim", "review.reconcile-authority", "review.reconcile-authority-batch", "review.recover", "review.start", "review.validate"] },
174
192
  "reason_code": { "type": "string", "pattern": "^[a-z0-9_]+$" }
175
193
  }
176
194
  }
@@ -232,6 +250,15 @@
232
250
  }
233
251
  }
234
252
  }
253
+ },
254
+ {
255
+ "if": { "required": ["validation_request"] },
256
+ "then": {
257
+ "properties": {
258
+ "applicability": { "const": "current_target" },
259
+ "authority": { "properties": { "state": { "const": "correction_required" } }, "required": ["state"] }
260
+ }
261
+ }
235
262
  }
236
263
  ]
237
264
  }
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://gentle-ai.dev/contracts/review-integration/v1/schemas/targeted-validation-request.schema.json",
4
+ "title": "Gentle AI provider-owned targeted validation request",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema",
9
+ "request_hash",
10
+ "lineage_id",
11
+ "expected_revision",
12
+ "target_identity",
13
+ "fix_finding_ids",
14
+ "projection",
15
+ "correction_candidate_tree",
16
+ "correction_target_identity",
17
+ "correction_paths",
18
+ "correction_paths_digest"
19
+ ],
20
+ "properties": {
21
+ "schema": {"const": "gentle-ai.review-targeted-validation-request/v1"},
22
+ "request_hash": {"$ref": "#/$defs/sha256"},
23
+ "lineage_id": {"type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"},
24
+ "expected_revision": {"$ref": "#/$defs/sha256"},
25
+ "target_identity": {"$ref": "#/$defs/sha256"},
26
+ "fix_finding_ids": {
27
+ "type": "array",
28
+ "minItems": 1,
29
+ "uniqueItems": true,
30
+ "items": {"type": "string", "minLength": 1}
31
+ },
32
+ "projection": {"enum": ["workspace", "staged"]},
33
+ "correction_candidate_tree": {"type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$"},
34
+ "correction_target_identity": {"$ref": "#/$defs/sha256"},
35
+ "correction_paths": {
36
+ "type": "array",
37
+ "minItems": 1,
38
+ "uniqueItems": true,
39
+ "items": {"type": "string", "minLength": 1}
40
+ },
41
+ "correction_paths_digest": {"$ref": "#/$defs/sha256"}
42
+ },
43
+ "$defs": {
44
+ "sha256": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}
45
+ }
46
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://gentle-ai.dev/contracts/review-integration/v1/schemas/verification-evidence.schema.json",
4
+ "title": "Gentle AI outcome-bearing verification evidence record",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema",
9
+ "version",
10
+ "lineage_id",
11
+ "authority_revision",
12
+ "target_identity",
13
+ "candidate_tree",
14
+ "paths_digest",
15
+ "paths",
16
+ "ledger_ids",
17
+ "raw_payload_sha256",
18
+ "raw_payload_bytes",
19
+ "outcome",
20
+ "record_digest"
21
+ ],
22
+ "properties": {
23
+ "schema": { "const": "gentle-ai.review-verification-evidence/v2" },
24
+ "version": { "const": 2 },
25
+ "lineage_id": {
26
+ "type": "string",
27
+ "maxLength": 128,
28
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
29
+ },
30
+ "authority_revision": { "$ref": "#/$defs/sha256" },
31
+ "target_identity": { "$ref": "#/$defs/sha256" },
32
+ "candidate_tree": {
33
+ "type": "string",
34
+ "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$"
35
+ },
36
+ "paths_digest": { "$ref": "#/$defs/sha256" },
37
+ "paths": {
38
+ "type": "array",
39
+ "uniqueItems": true,
40
+ "items": { "type": "string", "minLength": 1 }
41
+ },
42
+ "ledger_ids": {
43
+ "type": "array",
44
+ "uniqueItems": true,
45
+ "items": { "type": "string", "minLength": 1 }
46
+ },
47
+ "raw_payload_sha256": { "$ref": "#/$defs/sha256" },
48
+ "raw_payload_bytes": {
49
+ "type": "integer",
50
+ "minimum": 1,
51
+ "maximum": 4194304
52
+ },
53
+ "outcome": {
54
+ "enum": ["passed", "verification_failed", "procedural_tooling_failed"]
55
+ },
56
+ "record_digest": { "$ref": "#/$defs/sha256" }
57
+ },
58
+ "$defs": {
59
+ "sha256": {
60
+ "type": "string",
61
+ "pattern": "^sha256:[0-9a-f]{64}$"
62
+ }
63
+ }
64
+ }