@riddledc/riddle-proof 0.8.62 → 0.8.64

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.
@@ -5107,6 +5107,9 @@ function shouldIterate(assessment) {
5107
5107
  const nextStage = assessment.continue_with_stage || assessment.recommended_stage;
5108
5108
  return nextStage === "implement" || nextStage === "author";
5109
5109
  }
5110
+ function hasTrustedReadySource(assessment) {
5111
+ return assessment.source === "supervising_agent" || assessment.source === "supervisor";
5112
+ }
5110
5113
  async function notifyIfConfigured(input) {
5111
5114
  if (!input.notification) return input.result;
5112
5115
  try {
@@ -5442,6 +5445,7 @@ async function runRiddleProof(input) {
5442
5445
  decision: assessment.decision,
5443
5446
  recommended_stage: assessment.recommended_stage,
5444
5447
  continue_with_stage: assessment.continue_with_stage,
5448
+ source: assessment.source,
5445
5449
  reasons: assessment.reasons
5446
5450
  }
5447
5451
  });
@@ -5453,7 +5457,27 @@ async function runRiddleProof(input) {
5453
5457
  evidence_bundle: evidenceBundle
5454
5458
  });
5455
5459
  }
5456
- if (assessment.decision === "ready_to_ship") break;
5460
+ if (assessment.decision === "ready_to_ship") {
5461
+ if (!hasTrustedReadySource(assessment)) {
5462
+ return blockRun({
5463
+ state,
5464
+ stage: "verify",
5465
+ blocker: adapterBlocker(
5466
+ "proof_assessment_untrusted_source",
5467
+ "A ready_to_ship proof assessment must come from a supervising source.",
5468
+ "judge_completed",
5469
+ {
5470
+ decision: assessment.decision,
5471
+ source: assessment.source || null,
5472
+ trusted_sources: ["supervising_agent", "supervisor"]
5473
+ }
5474
+ ),
5475
+ evidence_bundle: evidenceBundle,
5476
+ raw: { assessment }
5477
+ });
5478
+ }
5479
+ break;
5480
+ }
5457
5481
  if (attempt + 1 < maxIterations && shouldIterate(assessment)) {
5458
5482
  evidenceContext = evidenceBundle;
5459
5483
  appendRunEvent(state, {
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-VYJD6XYF.js";
4
4
  import {
5
5
  runner_exports
6
- } from "../chunk-HRY2IHXM.js";
6
+ } from "../chunk-LD2YTPD7.js";
7
7
  import {
8
8
  engine_harness_exports
9
9
  } from "../chunk-P4BHU5NM.js";
@@ -633,6 +633,9 @@ function shouldIterate(assessment) {
633
633
  const nextStage = assessment.continue_with_stage || assessment.recommended_stage;
634
634
  return nextStage === "implement" || nextStage === "author";
635
635
  }
636
+ function hasTrustedReadySource(assessment) {
637
+ return assessment.source === "supervising_agent" || assessment.source === "supervisor";
638
+ }
636
639
  async function notifyIfConfigured(input) {
637
640
  if (!input.notification) return input.result;
638
641
  try {
@@ -968,6 +971,7 @@ async function runRiddleProof(input) {
968
971
  decision: assessment.decision,
969
972
  recommended_stage: assessment.recommended_stage,
970
973
  continue_with_stage: assessment.continue_with_stage,
974
+ source: assessment.source,
971
975
  reasons: assessment.reasons
972
976
  }
973
977
  });
@@ -979,7 +983,27 @@ async function runRiddleProof(input) {
979
983
  evidence_bundle: evidenceBundle
980
984
  });
981
985
  }
982
- if (assessment.decision === "ready_to_ship") break;
986
+ if (assessment.decision === "ready_to_ship") {
987
+ if (!hasTrustedReadySource(assessment)) {
988
+ return blockRun({
989
+ state,
990
+ stage: "verify",
991
+ blocker: adapterBlocker(
992
+ "proof_assessment_untrusted_source",
993
+ "A ready_to_ship proof assessment must come from a supervising source.",
994
+ "judge_completed",
995
+ {
996
+ decision: assessment.decision,
997
+ source: assessment.source || null,
998
+ trusted_sources: ["supervising_agent", "supervisor"]
999
+ }
1000
+ ),
1001
+ evidence_bundle: evidenceBundle,
1002
+ raw: { assessment }
1003
+ });
1004
+ }
1005
+ break;
1006
+ }
983
1007
  if (attempt + 1 < maxIterations && shouldIterate(assessment)) {
984
1008
  evidenceContext = evidenceBundle;
985
1009
  appendRunEvent(state, {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "../chunk-HRY2IHXM.js";
3
+ } from "../chunk-LD2YTPD7.js";
4
4
  import "../chunk-NMQIWBSB.js";
5
5
  import "../chunk-2OTPBHSM.js";
6
6
  import "../chunk-EKZXU6MU.js";
@@ -61,6 +61,9 @@ function shouldIterate(assessment) {
61
61
  const nextStage = assessment.continue_with_stage || assessment.recommended_stage;
62
62
  return nextStage === "implement" || nextStage === "author";
63
63
  }
64
+ function hasTrustedReadySource(assessment) {
65
+ return assessment.source === "supervising_agent" || assessment.source === "supervisor";
66
+ }
64
67
  async function notifyIfConfigured(input) {
65
68
  if (!input.notification) return input.result;
66
69
  try {
@@ -396,6 +399,7 @@ async function runRiddleProof(input) {
396
399
  decision: assessment.decision,
397
400
  recommended_stage: assessment.recommended_stage,
398
401
  continue_with_stage: assessment.continue_with_stage,
402
+ source: assessment.source,
399
403
  reasons: assessment.reasons
400
404
  }
401
405
  });
@@ -407,7 +411,27 @@ async function runRiddleProof(input) {
407
411
  evidence_bundle: evidenceBundle
408
412
  });
409
413
  }
410
- if (assessment.decision === "ready_to_ship") break;
414
+ if (assessment.decision === "ready_to_ship") {
415
+ if (!hasTrustedReadySource(assessment)) {
416
+ return blockRun({
417
+ state,
418
+ stage: "verify",
419
+ blocker: adapterBlocker(
420
+ "proof_assessment_untrusted_source",
421
+ "A ready_to_ship proof assessment must come from a supervising source.",
422
+ "judge_completed",
423
+ {
424
+ decision: assessment.decision,
425
+ source: assessment.source || null,
426
+ trusted_sources: ["supervising_agent", "supervisor"]
427
+ }
428
+ ),
429
+ evidence_bundle: evidenceBundle,
430
+ raw: { assessment }
431
+ });
432
+ }
433
+ break;
434
+ }
411
435
  if (attempt + 1 < maxIterations && shouldIterate(assessment)) {
412
436
  evidenceContext = evidenceBundle;
413
437
  appendRunEvent(state, {
package/dist/index.cjs CHANGED
@@ -5402,6 +5402,9 @@ function shouldIterate(assessment) {
5402
5402
  const nextStage = assessment.continue_with_stage || assessment.recommended_stage;
5403
5403
  return nextStage === "implement" || nextStage === "author";
5404
5404
  }
5405
+ function hasTrustedReadySource(assessment) {
5406
+ return assessment.source === "supervising_agent" || assessment.source === "supervisor";
5407
+ }
5405
5408
  async function notifyIfConfigured(input) {
5406
5409
  if (!input.notification) return input.result;
5407
5410
  try {
@@ -5737,6 +5740,7 @@ async function runRiddleProof(input) {
5737
5740
  decision: assessment.decision,
5738
5741
  recommended_stage: assessment.recommended_stage,
5739
5742
  continue_with_stage: assessment.continue_with_stage,
5743
+ source: assessment.source,
5740
5744
  reasons: assessment.reasons
5741
5745
  }
5742
5746
  });
@@ -5748,7 +5752,27 @@ async function runRiddleProof(input) {
5748
5752
  evidence_bundle: evidenceBundle
5749
5753
  });
5750
5754
  }
5751
- if (assessment.decision === "ready_to_ship") break;
5755
+ if (assessment.decision === "ready_to_ship") {
5756
+ if (!hasTrustedReadySource(assessment)) {
5757
+ return blockRun({
5758
+ state,
5759
+ stage: "verify",
5760
+ blocker: adapterBlocker(
5761
+ "proof_assessment_untrusted_source",
5762
+ "A ready_to_ship proof assessment must come from a supervising source.",
5763
+ "judge_completed",
5764
+ {
5765
+ decision: assessment.decision,
5766
+ source: assessment.source || null,
5767
+ trusted_sources: ["supervising_agent", "supervisor"]
5768
+ }
5769
+ ),
5770
+ evidence_bundle: evidenceBundle,
5771
+ raw: { assessment }
5772
+ });
5773
+ }
5774
+ break;
5775
+ }
5752
5776
  if (attempt + 1 < maxIterations && shouldIterate(assessment)) {
5753
5777
  evidenceContext = evidenceBundle;
5754
5778
  appendRunEvent(state, {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-HRY2IHXM.js";
3
+ } from "./chunk-LD2YTPD7.js";
4
4
  import "./chunk-6F4PWJZI.js";
5
5
  import {
6
6
  RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
package/dist/runner.cjs CHANGED
@@ -633,6 +633,9 @@ function shouldIterate(assessment) {
633
633
  const nextStage = assessment.continue_with_stage || assessment.recommended_stage;
634
634
  return nextStage === "implement" || nextStage === "author";
635
635
  }
636
+ function hasTrustedReadySource(assessment) {
637
+ return assessment.source === "supervising_agent" || assessment.source === "supervisor";
638
+ }
636
639
  async function notifyIfConfigured(input) {
637
640
  if (!input.notification) return input.result;
638
641
  try {
@@ -968,6 +971,7 @@ async function runRiddleProof(input) {
968
971
  decision: assessment.decision,
969
972
  recommended_stage: assessment.recommended_stage,
970
973
  continue_with_stage: assessment.continue_with_stage,
974
+ source: assessment.source,
971
975
  reasons: assessment.reasons
972
976
  }
973
977
  });
@@ -979,7 +983,27 @@ async function runRiddleProof(input) {
979
983
  evidence_bundle: evidenceBundle
980
984
  });
981
985
  }
982
- if (assessment.decision === "ready_to_ship") break;
986
+ if (assessment.decision === "ready_to_ship") {
987
+ if (!hasTrustedReadySource(assessment)) {
988
+ return blockRun({
989
+ state,
990
+ stage: "verify",
991
+ blocker: adapterBlocker(
992
+ "proof_assessment_untrusted_source",
993
+ "A ready_to_ship proof assessment must come from a supervising source.",
994
+ "judge_completed",
995
+ {
996
+ decision: assessment.decision,
997
+ source: assessment.source || null,
998
+ trusted_sources: ["supervising_agent", "supervisor"]
999
+ }
1000
+ ),
1001
+ evidence_bundle: evidenceBundle,
1002
+ raw: { assessment }
1003
+ });
1004
+ }
1005
+ break;
1006
+ }
983
1007
  if (attempt + 1 < maxIterations && shouldIterate(assessment)) {
984
1008
  evidenceContext = evidenceBundle;
985
1009
  appendRunEvent(state, {
package/dist/runner.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-HRY2IHXM.js";
3
+ } from "./chunk-LD2YTPD7.js";
4
4
  import "./chunk-NMQIWBSB.js";
5
5
  import "./chunk-2OTPBHSM.js";
6
6
  import "./chunk-EKZXU6MU.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.8.62",
3
+ "version": "0.8.64",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -676,6 +676,64 @@ def first_url_from_command_output(*parts):
676
676
  return ''
677
677
 
678
678
 
679
+ def dict_value(value):
680
+ return value if isinstance(value, dict) else {}
681
+
682
+
683
+ def proof_provenance_facts(state):
684
+ assessment = dict_value(state.get('proof_assessment'))
685
+ bundle = dict_value(state.get('evidence_bundle'))
686
+ bundle_session = dict_value(bundle.get('proof_session'))
687
+ proof_session = dict_value(state.get('proof_session')) or bundle_session
688
+ publication = dict_value(state.get('proof_artifact_publication'))
689
+ checkpoint_packet = dict_value(state.get('checkpoint_packet'))
690
+ checkpoint_summary = dict_value(state.get('checkpoint_summary'))
691
+ return {
692
+ 'version': 'riddle-proof.provenance.v1',
693
+ 'run_id': str(state.get('run_id') or ''),
694
+ 'checkpoint_packet_id': str(
695
+ checkpoint_packet.get('packet_id')
696
+ or checkpoint_summary.get('latest_packet_id')
697
+ or ''
698
+ ),
699
+ 'checkpoint_response_packet_id': str(
700
+ checkpoint_summary.get('latest_response_packet_id')
701
+ or ''
702
+ ),
703
+ 'evidence_bundle_id': str(
704
+ bundle.get('evidence_bundle_id')
705
+ or bundle.get('bundle_id')
706
+ or bundle.get('id')
707
+ or ''
708
+ ),
709
+ 'proof_session_id': str(
710
+ proof_session.get('session_id')
711
+ or bundle_session.get('session_id')
712
+ or ''
713
+ ),
714
+ 'proof_session_fingerprint': str(
715
+ state.get('proof_session_fingerprint')
716
+ or proof_session.get('fingerprint')
717
+ or bundle_session.get('fingerprint')
718
+ or ''
719
+ ),
720
+ 'proof_assessment_id': str(
721
+ assessment.get('assessment_id')
722
+ or assessment.get('id')
723
+ or ''
724
+ ),
725
+ 'proof_assessment_source': str(
726
+ assessment.get('source')
727
+ or state.get('proof_assessment_source')
728
+ or ''
729
+ ),
730
+ 'proof_assessment_decision': str(assessment.get('decision') or ''),
731
+ 'artifact_publication_commit': str(publication.get('commit') or ''),
732
+ 'artifact_manifest_url': str(publication.get('manifest_url') or ''),
733
+ 'artifact_source_fingerprint': str(publication.get('source_fingerprint') or ''),
734
+ }
735
+
736
+
679
737
  def build_ship_report(state, marked_ready=None):
680
738
  branch = state.get('target_branch') or state.get('branch') or ''
681
739
  if marked_ready is None:
@@ -685,6 +743,7 @@ def build_ship_report(state, marked_ready=None):
685
743
  after_artifact_url = first_public_artifact_url(state, 'after', 'image') or state.get('after_cdn', '')
686
744
  artifact_publication = state.get('proof_artifact_publication') or {}
687
745
  ship_gate = ship_gate_report_facts(state)
746
+ proof_provenance = proof_provenance_facts(state)
688
747
  return {
689
748
  'pr_url': state.get('pr_url', ''),
690
749
  'pr_branch': branch,
@@ -703,6 +762,7 @@ def build_ship_report(state, marked_ready=None):
703
762
  'proof_artifacts_manifest_url': artifact_publication.get('manifest_url', '') if isinstance(artifact_publication, dict) else '',
704
763
  'proof_artifact_publication': artifact_publication if isinstance(artifact_publication, dict) else {},
705
764
  'ship_gate': ship_gate,
765
+ 'proof_provenance': proof_provenance,
706
766
  }
707
767
 
708
768
 
@@ -138,12 +138,27 @@ def main():
138
138
  "proof_summary": "All assertions passed.",
139
139
  "proof_assessment_source": "supervising_agent",
140
140
  "proof_assessment": {
141
+ "assessment_id": "assessment_ship_artifact_test",
141
142
  "source": "supervising_agent",
142
143
  "decision": "ready_to_ship",
143
144
  "summary": "Evidence is strong enough to ship.",
144
145
  },
146
+ "checkpoint_summary": {
147
+ "latest_packet_id": "rppkt_ship_artifact_test",
148
+ "latest_response_packet_id": "rppkt_ship_artifact_test",
149
+ },
150
+ "proof_session": {
151
+ "session_id": "session_ship_artifact_test",
152
+ "fingerprint": "fingerprint_ship_artifact_test",
153
+ },
154
+ "proof_session_fingerprint": "fingerprint_ship_artifact_test",
145
155
  "evidence_bundle": {
156
+ "id": "bundle_ship_artifact_test",
146
157
  "verification_mode": "proof",
158
+ "proof_session": {
159
+ "session_id": "session_ship_artifact_test",
160
+ "fingerprint": "fingerprint_ship_artifact_test",
161
+ },
147
162
  "after": {
148
163
  "observation": {"valid": True, "reason": "ok", "telemetry_ready": True},
149
164
  "supporting_artifacts": {
@@ -204,6 +219,46 @@ def main():
204
219
  "ship gate should expose proof decision"
205
220
  )
206
221
  assert gate_evidence.get("hard_blockers") == [], "ship gate should expose hard blockers"
222
+ provenance = ship_report.get("proof_provenance") or {}
223
+ assert provenance.get("version") == "riddle-proof.provenance.v1", (
224
+ "ship report should expose proof provenance version"
225
+ )
226
+ assert provenance.get("run_id") == "rp_ship_artifact_test", (
227
+ "ship report provenance should expose the run id"
228
+ )
229
+ assert provenance.get("checkpoint_packet_id") == "rppkt_ship_artifact_test", (
230
+ "ship report provenance should expose the checkpoint packet id"
231
+ )
232
+ assert provenance.get("checkpoint_response_packet_id") == "rppkt_ship_artifact_test", (
233
+ "ship report provenance should expose the checkpoint response packet id"
234
+ )
235
+ assert provenance.get("evidence_bundle_id") == "bundle_ship_artifact_test", (
236
+ "ship report provenance should expose the evidence bundle id"
237
+ )
238
+ assert provenance.get("proof_session_id") == "session_ship_artifact_test", (
239
+ "ship report provenance should expose the proof session id"
240
+ )
241
+ assert provenance.get("proof_session_fingerprint") == "fingerprint_ship_artifact_test", (
242
+ "ship report provenance should expose the proof session fingerprint"
243
+ )
244
+ assert provenance.get("proof_assessment_id") == "assessment_ship_artifact_test", (
245
+ "ship report provenance should expose the proof assessment id"
246
+ )
247
+ assert provenance.get("proof_assessment_source") == "supervising_agent", (
248
+ "ship report provenance should expose the proof assessment source"
249
+ )
250
+ assert provenance.get("proof_assessment_decision") == "ready_to_ship", (
251
+ "ship report provenance should expose the proof assessment decision"
252
+ )
253
+ assert provenance.get("artifact_publication_commit") == publication.get("commit"), (
254
+ "ship report provenance should expose the artifact publication commit"
255
+ )
256
+ assert provenance.get("artifact_manifest_url") == ship_report.get("proof_artifacts_manifest_url"), (
257
+ "ship report provenance should expose the artifact manifest URL"
258
+ )
259
+ assert provenance.get("artifact_source_fingerprint") == publication.get("source_fingerprint"), (
260
+ "ship report provenance should expose the artifact source fingerprint"
261
+ )
207
262
 
208
263
  comment = comment_body_path.read_text(encoding="utf-8")
209
264
  assert "file://" not in comment, "PR proof comment must not expose local file URLs"