@riddledc/riddle-proof 0.8.4 → 0.8.5

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.
@@ -2465,7 +2465,7 @@ ${implementRes.stderr || ""}`;
2465
2465
  state = readState(config.statePath);
2466
2466
  }
2467
2467
  const checkpointName = "verify_capture_retry";
2468
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2468
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2469
2469
  recordAttempt("verify", "checkpoint", summary, {
2470
2470
  autoApproved: verifyRes.autoApproved || false,
2471
2471
  checkpoint: checkpointName,
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-IP64JLLR.js";
5
+ } from "../chunk-BDFSMWTI.js";
6
6
  import "../chunk-YZUVEJ5B.js";
7
7
  import "../chunk-FMOYUYH2.js";
8
8
  import "../chunk-RV6LK7HU.js";
@@ -2495,7 +2495,7 @@ ${implementRes.stderr || ""}`;
2495
2495
  state = readState(config.statePath);
2496
2496
  }
2497
2497
  const checkpointName = "verify_capture_retry";
2498
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2498
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2499
2499
  recordAttempt("verify", "checkpoint", summary, {
2500
2500
  autoApproved: verifyRes.autoApproved || false,
2501
2501
  checkpoint: checkpointName,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  proof_run_engine_exports
3
- } from "../chunk-P22V26PS.js";
3
+ } from "../chunk-GMZ57RRY.js";
4
4
  import {
5
5
  runner_exports
6
6
  } from "../chunk-UIJ7X63P.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-IP64JLLR.js";
9
+ } from "../chunk-BDFSMWTI.js";
10
10
  import "../chunk-YZUVEJ5B.js";
11
11
  import "../chunk-FMOYUYH2.js";
12
12
  import {
@@ -2465,7 +2465,7 @@ ${implementRes.stderr || ""}`;
2465
2465
  state = readState(config.statePath);
2466
2466
  }
2467
2467
  const checkpointName = "verify_capture_retry";
2468
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2468
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2469
2469
  recordAttempt("verify", "checkpoint", summary, {
2470
2470
  autoApproved: verifyRes.autoApproved || false,
2471
2471
  checkpoint: checkpointName,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createRiddleProofEngine,
3
3
  executeWorkflow
4
- } from "../chunk-P22V26PS.js";
4
+ } from "../chunk-GMZ57RRY.js";
5
5
  import "../chunk-RV6LK7HU.js";
6
6
  import "../chunk-MLKGABMK.js";
7
7
  export {
@@ -1447,7 +1447,7 @@ ${implementRes.stderr || ""}`;
1447
1447
  state = readState(config.statePath);
1448
1448
  }
1449
1449
  const checkpointName = "verify_capture_retry";
1450
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
1450
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
1451
1451
  recordAttempt("verify", "checkpoint", summary, {
1452
1452
  autoApproved: verifyRes.autoApproved || false,
1453
1453
  checkpoint: checkpointName,
@@ -22,7 +22,7 @@ import {
22
22
  createDisabledRiddleProofAgentAdapter,
23
23
  readRiddleProofRunStatus,
24
24
  runRiddleProofEngineHarness
25
- } from "./chunk-IP64JLLR.js";
25
+ } from "./chunk-BDFSMWTI.js";
26
26
  import {
27
27
  createCheckpointResponseTemplate
28
28
  } from "./chunk-4FOHZ7JG.js";
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import "../chunk-LZFCIHDT.js";
1
+ import "../chunk-OD5UNE57.js";
2
2
  import "../chunk-PEWAIEER.js";
3
3
  import "../chunk-TWTEUS7R.js";
4
- import "../chunk-IP64JLLR.js";
4
+ import "../chunk-BDFSMWTI.js";
5
5
  import "../chunk-YZUVEJ5B.js";
6
6
  import "../chunk-FMOYUYH2.js";
7
7
  import "../chunk-RV6LK7HU.js";
package/dist/cli.cjs CHANGED
@@ -2465,7 +2465,7 @@ ${implementRes.stderr || ""}`;
2465
2465
  state = readState(config.statePath);
2466
2466
  }
2467
2467
  const checkpointName = "verify_capture_retry";
2468
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2468
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2469
2469
  recordAttempt("verify", "checkpoint", summary, {
2470
2470
  autoApproved: verifyRes.autoApproved || false,
2471
2471
  checkpoint: checkpointName,
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-LZFCIHDT.js";
2
+ import "./chunk-OD5UNE57.js";
3
3
  import "./chunk-PEWAIEER.js";
4
4
  import "./chunk-TWTEUS7R.js";
5
- import "./chunk-IP64JLLR.js";
5
+ import "./chunk-BDFSMWTI.js";
6
6
  import "./chunk-YZUVEJ5B.js";
7
7
  import "./chunk-FMOYUYH2.js";
8
8
  import "./chunk-RV6LK7HU.js";
@@ -2465,7 +2465,7 @@ ${implementRes.stderr || ""}`;
2465
2465
  state = readState(config.statePath);
2466
2466
  }
2467
2467
  const checkpointName = "verify_capture_retry";
2468
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2468
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2469
2469
  recordAttempt("verify", "checkpoint", summary, {
2470
2470
  autoApproved: verifyRes.autoApproved || false,
2471
2471
  checkpoint: checkpointName,
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "./chunk-IP64JLLR.js";
5
+ } from "./chunk-BDFSMWTI.js";
6
6
  import "./chunk-YZUVEJ5B.js";
7
7
  import "./chunk-FMOYUYH2.js";
8
8
  import "./chunk-RV6LK7HU.js";
package/dist/index.cjs CHANGED
@@ -2465,7 +2465,7 @@ ${implementRes.stderr || ""}`;
2465
2465
  state = readState(config.statePath);
2466
2466
  }
2467
2467
  const checkpointName = "verify_capture_retry";
2468
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2468
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2469
2469
  recordAttempt("verify", "checkpoint", summary, {
2470
2470
  autoApproved: verifyRes.autoApproved || false,
2471
2471
  checkpoint: checkpointName,
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ import {
95
95
  createDisabledRiddleProofAgentAdapter,
96
96
  readRiddleProofRunStatus,
97
97
  runRiddleProofEngineHarness
98
- } from "./chunk-IP64JLLR.js";
98
+ } from "./chunk-BDFSMWTI.js";
99
99
  import {
100
100
  RIDDLE_PROOF_RUN_STATE_VERSION,
101
101
  appendRunEvent,
@@ -2463,7 +2463,7 @@ ${implementRes.stderr || ""}`;
2463
2463
  state = readState(config.statePath);
2464
2464
  }
2465
2465
  const checkpointName = "verify_capture_retry";
2466
- const summary = "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2466
+ const summary = stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2467
2467
  recordAttempt("verify", "checkpoint", summary, {
2468
2468
  autoApproved: verifyRes.autoApproved || false,
2469
2469
  checkpoint: checkpointName,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createRiddleProofEngine,
3
3
  executeWorkflow
4
- } from "./chunk-P22V26PS.js";
4
+ } from "./chunk-GMZ57RRY.js";
5
5
  import "./chunk-RV6LK7HU.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -2442,7 +2442,7 @@ def evaluate_capture_quality(payload, expected_path, verification_mode='proof'):
2442
2442
  }
2443
2443
 
2444
2444
 
2445
- def build_capture_retry_decision(after_observation, required_baseline_present, proof_evidence_blocker=''):
2445
+ def build_capture_retry_decision(after_observation, required_baseline_present, proof_evidence_blocker='', route_expectation=None):
2446
2446
  reasons = []
2447
2447
  if not required_baseline_present:
2448
2448
  reasons.append('Recon baseline is missing, so verify should return to recon instead of guessing a new reference context.')
@@ -2455,6 +2455,7 @@ def build_capture_retry_decision(after_observation, required_baseline_present, p
2455
2455
  }
2456
2456
 
2457
2457
  details = after_observation.get('details') if isinstance(after_observation.get('details'), dict) else {}
2458
+ route_expectation = route_expectation if isinstance(route_expectation, dict) else {}
2458
2459
  route_mismatch = None
2459
2460
  reason_text = str(after_observation.get('reason') or '')
2460
2461
  if 'wrong route' in reason_text:
@@ -2466,6 +2467,11 @@ def build_capture_retry_decision(after_observation, required_baseline_present, p
2466
2467
  'expected_path': expected,
2467
2468
  'observed_after_path': observed,
2468
2469
  }
2470
+ error_messages = [
2471
+ str(item).strip()
2472
+ for item in (details.get('capture_error_messages') or [])
2473
+ if str(item).strip()
2474
+ ]
2469
2475
 
2470
2476
  if proof_evidence_blocker:
2471
2477
  reasons.append(proof_evidence_blocker)
@@ -2493,6 +2499,9 @@ def build_capture_retry_decision(after_observation, required_baseline_present, p
2493
2499
  (route_mismatch.get('observed_after_path') or '(unknown)') +
2494
2500
  '.'
2495
2501
  )
2502
+ if error_messages:
2503
+ reasons.append('Capture script error: ' + error_messages[0][:500])
2504
+ summary += ' Capture script error: ' + error_messages[0][:300]
2496
2505
  return {
2497
2506
  'decision': decision,
2498
2507
  'summary': summary,
@@ -2504,12 +2513,14 @@ def build_capture_retry_decision(after_observation, required_baseline_present, p
2504
2513
 
2505
2514
  reason = after_observation.get('reason') or 'after capture is not usable yet'
2506
2515
  reasons.append('The after evidence is not usable yet: ' + reason)
2507
- recommended_stage = 'recon' if 'wrong route' in reason else 'author'
2508
- error_messages = [
2509
- str(item).strip()
2510
- for item in (details.get('capture_error_messages') or [])
2511
- if str(item).strip()
2512
- ]
2516
+ route_expectation_source = str(route_expectation.get('source') or '')
2517
+ authored_terminal_route = bool(
2518
+ route_mismatch
2519
+ and route_expectation.get('mode') in INTERACTION_MODES
2520
+ and route_expectation.get('terminal_path')
2521
+ and route_expectation_source != 'recon_start_path'
2522
+ )
2523
+ recommended_stage = 'recon' if 'wrong route' in reason and not authored_terminal_route else 'author'
2513
2524
  mismatch = None
2514
2525
  if recommended_stage == 'recon':
2515
2526
  expected = details.get('expected_path') or ''
@@ -2526,7 +2537,17 @@ def build_capture_retry_decision(after_observation, required_baseline_present, p
2526
2537
  summary = 'Verify capture route mismatch needs recon to refresh the reference path.'
2527
2538
  reasons.append('The capture appears to be on the wrong route or baseline context, so recon should refresh the reference path.')
2528
2539
  else:
2529
- if error_messages:
2540
+ if route_mismatch:
2541
+ expected = route_mismatch.get('expected_path') or ''
2542
+ observed = route_mismatch.get('observed_after_path') or ''
2543
+ mismatch = route_mismatch
2544
+ reasons.append('Route mismatch: expected after capture path ' + (expected or '(unknown)') + ', observed ' + (observed or '(unknown)') + '.')
2545
+ reasons.append('The terminal route came from the authored interaction proof packet, so the capture plan should be revised instead of refreshing recon.')
2546
+ summary = 'Verify capture route mismatch after authored interaction: expected ' + (expected or '(unknown)') + ', got ' + (observed or '(unknown)') + '.'
2547
+ if error_messages:
2548
+ reasons.append('Capture script error: ' + error_messages[0][:500])
2549
+ summary += ' Capture script error: ' + error_messages[0][:300]
2550
+ elif error_messages:
2530
2551
  reasons.append('Capture script error: ' + error_messages[0][:500])
2531
2552
  summary = 'Verify capture script failed: ' + error_messages[0][:300]
2532
2553
  else:
@@ -3298,7 +3319,7 @@ if has_good_evidence:
3298
3319
  summary_lines.append('Proof assessment: awaiting supervising agent judgment')
3299
3320
  summary_lines.append('Proof next stage: supervising agent decides after reviewing the evidence packet')
3300
3321
  else:
3301
- capture_retry = visual_delta_recovery or build_capture_retry_decision(after_observation, required_baseline_present, proof_evidence_blocker)
3322
+ capture_retry = visual_delta_recovery or build_capture_retry_decision(after_observation, required_baseline_present, proof_evidence_blocker, s.get('route_expectation') or {})
3302
3323
  next_stage_options = ['author', 'verify', 'recon'] if no_implementation_mode else ['author', 'verify', 'implement', 'recon']
3303
3324
  s['verify_status'] = 'capture_incomplete'
3304
3325
  s['merge_recommendation'] = 'do-not-merge'
@@ -290,6 +290,41 @@ class FakeRiddle:
290
290
  'totalPixels': 972000,
291
291
  },
292
292
  }
293
+ if 'pricingQueryHashDropsTerminal' in script:
294
+ message = (
295
+ 'page.waitForURL: Timeout 15000ms exceeded.\n'
296
+ '=========================== logs ===========================\n'
297
+ 'waiting for navigation until "load"\n'
298
+ ' navigated to "https://riddledc.com/pricing/"'
299
+ )
300
+ page_state = {
301
+ 'bodyTextLength': 260,
302
+ 'visibleTextSample': 'Pricing One rate Browser Compute Example Costs',
303
+ 'interactiveElements': 8,
304
+ 'visibleInteractiveElements': 8,
305
+ 'pathname': '/pricing/',
306
+ 'search': '',
307
+ 'hash': '',
308
+ 'title': 'Pricing',
309
+ 'buttons': [],
310
+ 'headings': ['Pricing', 'Browser Compute'],
311
+ 'links': [{'text': 'Pricing', 'href': '/pricing/?rp_probe=1#pricing-probe'}],
312
+ 'canvasCount': 0,
313
+ 'largeVisibleElements': [{'tag': 'main', 'text': 'Pricing'}],
314
+ }
315
+ return {
316
+ 'ok': True,
317
+ 'screenshots': [{'url': 'https://cdn.example.com/pricing-no-query-hash.png'}],
318
+ 'outputs': [{'name': 'after-pricing-query-hash.png', 'url': 'https://cdn.example.com/pricing-no-query-hash.png'}],
319
+ 'result': {'pageState': page_state},
320
+ 'console': [
321
+ 'RIDDLE_PROOF_STATE:' + json.dumps(page_state),
322
+ 'Uncaught exception: ' + message,
323
+ ],
324
+ '_artifact_json': {
325
+ 'proof.json': {'script_error': message},
326
+ },
327
+ }
293
328
  if 'clickedProofNavigation' in script:
294
329
  page_state = {
295
330
  'bodyTextLength': 180,
@@ -2495,6 +2530,65 @@ def run_verify_interaction_hash_terminal_route_from_proof_evidence():
2495
2530
  shutil.rmtree(tempdir, ignore_errors=True)
2496
2531
 
2497
2532
 
2533
+ def run_verify_interaction_authored_query_hash_mismatch_returns_author():
2534
+ tempdir = Path(tempfile.mkdtemp(prefix='riddle-proof-interaction-query-hash-mismatch-'))
2535
+ state_path = tempdir / 'state.json'
2536
+ try:
2537
+ state = base_state(tempdir, reference='before')
2538
+ state.update({
2539
+ 'recon_status': 'ready_for_proof_plan',
2540
+ 'author_status': 'ready',
2541
+ 'proof_plan_status': 'ready',
2542
+ 'implementation_status': 'changes_detected',
2543
+ 'implementation_mode': 'none',
2544
+ 'require_diff': False,
2545
+ 'allow_code_changes': False,
2546
+ 'verification_mode': 'interaction',
2547
+ 'server_path': '/',
2548
+ 'before_cdn': 'https://cdn.example.com/before-home.png',
2549
+ 'proof_plan': 'Start at /, click Pricing, and verify /pricing/?rp_probe=1#pricing-probe.',
2550
+ 'capture_script': "pricingQueryHashDropsTerminal(); await page.waitForURL('/pricing/?rp_probe=1#pricing-probe');",
2551
+ 'supervisor_author_packet': {
2552
+ 'proof_plan': 'Click Pricing and prove the terminal query/hash route.',
2553
+ 'capture_script': "pricingQueryHashDropsTerminal(); await page.waitForURL('/pricing/?rp_probe=1#pricing-probe');",
2554
+ 'refined_inputs': {
2555
+ 'server_path': '/',
2556
+ 'expected_terminal_path': '/pricing/?rp_probe=1#pricing-probe',
2557
+ },
2558
+ },
2559
+ 'recon_results': {
2560
+ 'baselines': {'before': {'path': '/', 'url': 'https://cdn.example.com/before-home.png'}},
2561
+ },
2562
+ })
2563
+ write_state(state_path, state)
2564
+ os.environ['RIDDLE_PROOF_STATE_FILE'] = str(state_path)
2565
+
2566
+ fake = FakeRiddle()
2567
+ load_util_with_fake(fake)
2568
+ load_module('verify_interaction_authored_query_hash_mismatch', VERIFY_PATH)
2569
+ after_verify = json.loads(state_path.read_text())
2570
+
2571
+ request = after_verify['verify_decision_request']
2572
+ capture_quality = request['capture_quality']
2573
+ assert after_verify['verify_status'] == 'capture_incomplete'
2574
+ assert after_verify['route_expectation']['expected_query'] == 'rp_probe=1'
2575
+ assert after_verify['route_expectation']['expected_hash'] == '#pricing-probe'
2576
+ assert request['recommended_stage'] == 'author'
2577
+ assert request['continue_with_stage'] == 'author'
2578
+ assert capture_quality['recommended_stage'] == 'author'
2579
+ assert capture_quality['mismatch']['expected_path'] == '/pricing?rp_probe=1#pricing-probe'
2580
+ assert capture_quality['mismatch']['observed_after_path'] == '/pricing/'
2581
+ assert 'page.waitForURL: Timeout 15000ms exceeded' in capture_quality['summary']
2582
+ assert any('capture plan should be revised' in reason for reason in capture_quality['reasons'])
2583
+ return {
2584
+ 'ok': True,
2585
+ 'summary': capture_quality['summary'],
2586
+ 'recommended_stage': request['recommended_stage'],
2587
+ }
2588
+ finally:
2589
+ shutil.rmtree(tempdir, ignore_errors=True)
2590
+
2591
+
2498
2592
  def run_verify_capture_retry_surfaces_script_timeout():
2499
2593
  tempdir = Path(tempfile.mkdtemp(prefix='riddle-proof-capture-timeout-'))
2500
2594
  state_path = tempdir / 'state.json'
@@ -2914,6 +3008,7 @@ if __name__ == '__main__':
2914
3008
  'verify_interaction_terminal_route_from_proof_evidence': run_verify_interaction_terminal_route_from_proof_evidence(),
2915
3009
  'verify_interaction_reverse_terminal_route_from_proof_evidence': run_verify_interaction_reverse_terminal_route_from_proof_evidence(),
2916
3010
  'verify_interaction_hash_terminal_route_from_proof_evidence': run_verify_interaction_hash_terminal_route_from_proof_evidence(),
3011
+ 'verify_interaction_authored_query_hash_mismatch_returns_author': run_verify_interaction_authored_query_hash_mismatch_returns_author(),
2917
3012
  'verify_capture_retry_surfaces_script_timeout': run_verify_capture_retry_surfaces_script_timeout(),
2918
3013
  'missing_baseline_guard': run_verify_missing_baseline(),
2919
3014
  'ship_supervisor_gate': run_ship_missing_supervisor_gate(),
File without changes