@riddledc/riddle-proof 0.5.0 → 0.5.2

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 (35) hide show
  1. package/README.md +6 -6
  2. package/dist/chunk-3MHFLQKG.js +853 -0
  3. package/dist/{chunk-LVP22WE4.js → chunk-5GZZZ6JA.js} +5 -1
  4. package/dist/engine-harness.cjs +2505 -22
  5. package/dist/engine-harness.js +1 -1
  6. package/dist/index.cjs +2512 -29
  7. package/dist/index.js +2 -2
  8. package/dist/openclaw.cjs +1 -1
  9. package/dist/openclaw.js +1 -1
  10. package/dist/proof-run-core.cjs +909 -0
  11. package/dist/proof-run-core.d.cts +280 -0
  12. package/dist/proof-run-core.d.ts +280 -0
  13. package/dist/proof-run-core.js +48 -0
  14. package/dist/proof-run-engine.cjs +2499 -0
  15. package/dist/proof-run-engine.d.cts +677 -0
  16. package/dist/proof-run-engine.d.ts +677 -0
  17. package/dist/proof-run-engine.js +1649 -0
  18. package/lib/workspace-core.mjs +391 -0
  19. package/package.json +15 -3
  20. package/runtime/lib/author.py +343 -0
  21. package/runtime/lib/implement.py +63 -0
  22. package/runtime/lib/preflight.py +246 -0
  23. package/runtime/lib/recon.py +1048 -0
  24. package/runtime/lib/riddle_core_call.mjs +151 -0
  25. package/runtime/lib/setup.py +387 -0
  26. package/runtime/lib/ship.py +834 -0
  27. package/runtime/lib/util.py +673 -0
  28. package/runtime/lib/verify.py +1223 -0
  29. package/runtime/pipelines/riddle-proof-author.lobster +28 -0
  30. package/runtime/pipelines/riddle-proof-implement.lobster +26 -0
  31. package/runtime/pipelines/riddle-proof-recon.lobster +79 -0
  32. package/runtime/pipelines/riddle-proof-setup.lobster +141 -0
  33. package/runtime/pipelines/riddle-proof-ship.lobster +36 -0
  34. package/runtime/pipelines/riddle-proof-verify.lobster +74 -0
  35. package/runtime/tests/recon_verify_smoke.py +1198 -0
@@ -0,0 +1,28 @@
1
+ name: riddle-proof-author
2
+ # Riddle Proof — Author
3
+ # Consumes recon observation state and turns it into a reusable proof packet.
4
+ # Produces proof_plan, capture_script, and any refined capture inputs.
5
+ # Requires RIDDLE_PROOF_DIR env var set to the runtime directory.
6
+
7
+ steps:
8
+
9
+ - id: check_state
10
+ command: |
11
+ python3 << 'PYEOF'
12
+ import json, os
13
+ state_file = os.environ.get('RIDDLE_PROOF_STATE_FILE', '/tmp/riddle-proof-state.json')
14
+ s = json.load(open(state_file))
15
+ if not s.get('workspace_ready'):
16
+ raise SystemExit('Workspace not ready. Run riddle-proof-setup first.')
17
+ if s.get('recon_status') not in ('ready_for_proof_plan', 'completed'):
18
+ raise SystemExit('Recon has not produced a usable observation packet yet. Run recon first.')
19
+ print('AUTHOR')
20
+ print('Proof goal: ' + s.get('change_request', ''))
21
+ print('Recon summary: ' + (s.get('recon_summary') or '(not run)'))
22
+ print('Current proof plan status: ' + (s.get('proof_plan_status') or '(unknown)'))
23
+ PYEOF
24
+
25
+ - id: run_author
26
+ command: |
27
+ RP="${RIDDLE_PROOF_DIR:-/root/.openclaw/extensions/openclaw-riddle-proof/node_modules/@riddledc/riddle-proof/runtime}"
28
+ python3 "${RP}/lib/author.py"
@@ -0,0 +1,26 @@
1
+ name: riddle-proof-implement
2
+ # Riddle Proof — Implement
3
+ # Confirms that real code work exists after recon and before verify.
4
+ # Run after making the code changes on the after worktree.
5
+ # Requires RIDDLE_PROOF_DIR env var set to the runtime directory.
6
+
7
+ steps:
8
+
9
+ - id: check_state
10
+ command: |
11
+ python3 << 'PYEOF'
12
+ import json, os
13
+ state_file = os.environ.get('RIDDLE_PROOF_STATE_FILE', '/tmp/riddle-proof-state.json')
14
+ s = json.load(open(state_file))
15
+ if not s.get('workspace_ready'):
16
+ raise SystemExit('Workspace not ready. Run riddle-proof-setup first.')
17
+ print('IMPLEMENT')
18
+ print('Proof goal: ' + s.get('change_request', ''))
19
+ print('After worktree: ' + s.get('after_worktree', '') + (' (exists)' if os.path.exists(s.get('after_worktree', '')) else ' (MISSING)'))
20
+ print('Recon summary: ' + (s.get('recon_summary') or '(not run)'))
21
+ PYEOF
22
+
23
+ - id: run_implement
24
+ command: |
25
+ RP="${RIDDLE_PROOF_DIR:-/root/.openclaw/extensions/openclaw-riddle-proof/node_modules/@riddledc/riddle-proof/runtime}"
26
+ python3 "${RP}/lib/implement.py"
@@ -0,0 +1,79 @@
1
+ name: riddle-proof-recon
2
+ # Riddle Proof — Recon
3
+ # Recon now owns baseline discovery.
4
+ # Flow: hypothesize -> capture -> observe -> checkpoint for supervising-agent judgment -> bounded retry.
5
+ # Run after setup, before implementation and verify.
6
+ # Requires RIDDLE_PROOF_DIR env var set to the runtime directory.
7
+
8
+ steps:
9
+
10
+ - id: check_state
11
+ command: |
12
+ python3 << 'PYEOF'
13
+ import json, os
14
+ state_file = os.environ.get('RIDDLE_PROOF_STATE_FILE', '/tmp/riddle-proof-state.json')
15
+ s = json.load(open(state_file))
16
+ if not s.get('workspace_ready'):
17
+ raise SystemExit('Workspace not ready. Run riddle-proof-setup first.')
18
+ ref = s.get('requested_reference') or s.get('reference', 'both')
19
+ print('RECON — ' + s.get('mode', 'server').upper() + ' / reference=' + ref)
20
+ print('Proof goal: ' + s.get('change_request', ''))
21
+ print('Success criteria: ' + (s.get('success_criteria') or '(none provided)'))
22
+ print('Verification mode: ' + s.get('verification_mode', 'proof'))
23
+ print('Proof plan status: ' + s.get('proof_plan_status', 'pending_recon'))
24
+ print('Server path hint: ' + (s.get('server_path') or '(derive during recon)'))
25
+ if ref in ('before', 'both'):
26
+ wt = s.get('before_worktree', '')
27
+ print('Before worktree: ' + wt + (' (exists)' if os.path.exists(wt) else ' (MISSING)'))
28
+ print('After worktree: ' + s.get('after_worktree', ''))
29
+ PYEOF
30
+
31
+ - id: run_recon
32
+ command: |
33
+ RP="${RIDDLE_PROOF_DIR:-/root/.openclaw/extensions/openclaw-riddle-proof/node_modules/@riddledc/riddle-proof/runtime}"
34
+ python3 "${RP}/lib/recon.py"
35
+
36
+ - id: summarize_recon
37
+ command: |
38
+ python3 << 'PYEOF'
39
+ import json, os
40
+ state_file = os.environ.get('RIDDLE_PROOF_STATE_FILE', '/tmp/riddle-proof-state.json')
41
+ s = json.load(open(state_file))
42
+ r = s.get('recon_results', {})
43
+ baselines = r.get('baselines', {})
44
+ hypothesis = r.get('hypothesis', {})
45
+ print('='*50)
46
+ print('RECON REVIEW')
47
+ print('='*50)
48
+ print('Summary: ' + (s.get('recon_summary') or '(none)'))
49
+ print('Recon status: ' + (s.get('recon_status') or '(unknown)'))
50
+ print('Hypothesis path: ' + (hypothesis.get('target_path') or '(none)'))
51
+ print('Hypothesis source: ' + (hypothesis.get('path_source') or '(none)'))
52
+ for line in r.get('route_hints', [])[:8]:
53
+ print('Route hint: ' + line)
54
+ for line in r.get('keyword_hits', [])[:10]:
55
+ print('Keyword hit: ' + line)
56
+ if baselines.get('before'):
57
+ print('Before baseline: ' + baselines['before'].get('url', '(none)'))
58
+ if baselines.get('prod'):
59
+ print('Prod baseline: ' + baselines['prod'].get('url', '(none)'))
60
+ latest = (r.get('attempt_history') or [])[-1:]
61
+ if latest:
62
+ print('Latest attempt result: ' + latest[0].get('result', '(unknown)'))
63
+ if s.get('recon_assessment_request') or s.get('recon_decision_request'):
64
+ req = s.get('recon_assessment_request') or s.get('recon_decision_request', {})
65
+ print('Recon attempts remaining: ' + str(req.get('attempts_remaining', '(unknown)')))
66
+
67
+ print()
68
+ print('PROOF GOAL: ' + s.get('change_request', ''))
69
+ print('SUCCESS CRITERIA: ' + (s.get('success_criteria') or '(none provided)'))
70
+ print()
71
+ print('REVIEW CHECKLIST:')
72
+ print(' 1. Did recon capture the correct before / prod baseline context?')
73
+ print(' 2. If recon is blocked, what next path or wait selector should the supervising agent try next?')
74
+ print(' 3. Once recon is ready, what exact interaction or state should verify reproduce on the after build?')
75
+ print(' 4. What final capture_script should verify run on the recon-established path?')
76
+ print(' 5. What code work needs to happen before verify?')
77
+ print()
78
+ print('Recon should finish with observed baselines and a concrete proof-plan request.')
79
+ PYEOF
@@ -0,0 +1,141 @@
1
+ name: riddle-proof-setup
2
+ # Riddle Proof — Setup
3
+ # Creates worktrees, installs deps, validates args.
4
+ # Run once before recon/verify/ship.
5
+ # Requires RIDDLE_PROOF_DIR env var set to the runtime directory.
6
+
7
+ args:
8
+ repo:
9
+ default: ""
10
+ branch:
11
+ default: ""
12
+ change_request:
13
+ default: ""
14
+ commit_message:
15
+ default: ""
16
+ prod_url:
17
+ default: ""
18
+ capture_script:
19
+ default: ""
20
+ description: "Optional during setup. Add it before recon/verify once the proof target is clear."
21
+ success_criteria:
22
+ default: ""
23
+ description: "Plain-English definition of what counts as fixed"
24
+ assertions_json:
25
+ default: ""
26
+ description: "Optional JSON object/array of checks to satisfy"
27
+ verification_mode:
28
+ default: "proof"
29
+ description: "proof, visual, interaction, render, data, or custom label"
30
+ reference:
31
+ default: "both"
32
+ description: "What to compare against: prod, before, or both"
33
+ base_branch:
34
+ default: "main"
35
+ description: "Target branch for PR base"
36
+ before_ref:
37
+ default: ""
38
+ description: "Detached baseline ref for before preview; defaults to origin/<base_branch>"
39
+ allow_static_preview_fallback:
40
+ default: "false"
41
+ description: "Allow server mode to fall back to static preview; keep false for routed/interactive apps"
42
+ context:
43
+ default: ""
44
+ reviewer:
45
+ default: "davisdiehl"
46
+ mode:
47
+ default: "server"
48
+ description: "static or server"
49
+ build_command:
50
+ default: "npm run build"
51
+ build_output:
52
+ default: "build"
53
+ description: "Build output directory (static mode only)"
54
+ server_image:
55
+ default: "node:20-slim"
56
+ server_command:
57
+ default: "npm start"
58
+ server_port:
59
+ default: "3000"
60
+ server_path:
61
+ default: ""
62
+ use_auth:
63
+ default: ""
64
+ description: "Set to 'true' to auto-fetch Cognito auth tokens"
65
+ auth_localStorage_json:
66
+ default: ""
67
+ description: "JSON object of localStorage entries to inject before page load"
68
+ auth_cookies_json:
69
+ default: ""
70
+ description: "JSON object or array of cookies to inject before page load"
71
+ auth_headers_json:
72
+ default: ""
73
+ description: "JSON object of request headers to use during proof capture"
74
+ color_scheme:
75
+ default: ""
76
+ description: "Browser color scheme: 'dark' or 'light' (applied before page load)"
77
+ wait_for_selector:
78
+ default: ""
79
+ description: "CSS selector to wait for before capturing screenshot"
80
+ discord_channel:
81
+ default: ""
82
+ discord_thread_id:
83
+ default: ""
84
+ discord_message_id:
85
+ default: ""
86
+ discord_source_url:
87
+ default: ""
88
+
89
+ steps:
90
+
91
+ - id: preflight
92
+ command: |
93
+ python3 << 'PYEOF'
94
+ import json, os
95
+ raw_server_path = """${server_path}""".strip()
96
+ args = {
97
+ 'mode': """${mode}""".strip() or 'server',
98
+ 'reference': """${reference}""".strip() or 'both',
99
+ 'repo': """${repo}""".strip(),
100
+ 'branch': """${branch}""".strip(),
101
+ 'change_request': """${change_request}""".strip(),
102
+ 'commit_message': """${commit_message}""".strip(),
103
+ 'prod_url': """${prod_url}""".strip(),
104
+ 'capture_script': """${capture_script}""".strip(),
105
+ 'success_criteria': """${success_criteria}""".strip(),
106
+ 'assertions_json': """${assertions_json}""".strip(),
107
+ 'verification_mode': """${verification_mode}""".strip() or 'proof',
108
+ 'context': """${context}""".strip(),
109
+ 'reviewer': """${reviewer}""".strip() or 'davisdiehl',
110
+ 'base_branch': """${base_branch}""".strip() or 'main',
111
+ 'before_ref': """${before_ref}""".strip(),
112
+ 'allow_static_preview_fallback': """${allow_static_preview_fallback}""".strip(),
113
+ 'build_command': """${build_command}""".strip() or 'npm run build',
114
+ 'build_output': """${build_output}""".strip() or 'build',
115
+ 'server_image': """${server_image}""".strip() or 'node:20-slim',
116
+ 'server_command': """${server_command}""".strip() or 'npm start',
117
+ 'server_port': """${server_port}""".strip() or '3000',
118
+ 'server_path': raw_server_path,
119
+ 'server_path_source': 'user' if raw_server_path else '',
120
+ 'use_auth': """${use_auth}""".strip(),
121
+ 'auth_localStorage_json': """${auth_localStorage_json}""".strip(),
122
+ 'auth_cookies_json': """${auth_cookies_json}""".strip(),
123
+ 'auth_headers_json': """${auth_headers_json}""".strip(),
124
+ 'color_scheme': """${color_scheme}""".strip(),
125
+ 'wait_for_selector': """${wait_for_selector}""".strip(),
126
+ 'discord_channel': """${discord_channel}""".strip(),
127
+ 'discord_thread_id': """${discord_thread_id}""".strip(),
128
+ 'discord_message_id': """${discord_message_id}""".strip(),
129
+ 'discord_source_url': """${discord_source_url}""".strip(),
130
+ }
131
+ args_file = os.environ.get('RIDDLE_PROOF_ARGS_FILE', '/tmp/riddle-proof-args.json')
132
+ with open(args_file, 'w') as f:
133
+ json.dump(args, f, indent=2)
134
+ PYEOF
135
+ RP="${RIDDLE_PROOF_DIR:-/root/.openclaw/extensions/openclaw-riddle-proof/node_modules/@riddledc/riddle-proof/runtime}"
136
+ python3 "${RP}/lib/preflight.py"
137
+
138
+ - id: setup
139
+ command: |
140
+ RP="${RIDDLE_PROOF_DIR:-/root/.openclaw/extensions/openclaw-riddle-proof/node_modules/@riddledc/riddle-proof/runtime}"
141
+ python3 "${RP}/lib/setup.py"
@@ -0,0 +1,36 @@
1
+ name: riddle-proof-ship
2
+ # Riddle Proof — Ship
3
+ # Commits, creates PR, posts proof artifacts, waits for CI, marks ready.
4
+ # Cleans up worktrees and preview sites.
5
+ # Requires RIDDLE_PROOF_DIR env var set to the runtime directory.
6
+
7
+ steps:
8
+
9
+ - id: check_state
10
+ command: |
11
+ python3 << 'PYEOF'
12
+ import json, os
13
+ state_file = os.environ.get('RIDDLE_PROOF_STATE_FILE', '/tmp/riddle-proof-state.json')
14
+ s = json.load(open(state_file))
15
+ if not s.get('after_cdn'):
16
+ raise SystemExit('No after evidence. Run verify first.')
17
+ print('SHIP')
18
+ print(' Proof goal: ' + s.get('change_request', ''))
19
+ print(' Commit: ' + s.get('commit_message', ''))
20
+ print(' Before: ' + s.get('before_cdn', '(none)'))
21
+ print(' After: ' + s.get('after_cdn', ''))
22
+ print(' Assertion status: ' + s.get('assertion_status', 'unknown'))
23
+ mr = s.get('merge_recommendation', '')
24
+ if mr:
25
+ print(' Merge recommendation: ' + mr)
26
+ pr = s.get('pr_url', '')
27
+ if pr:
28
+ print(' PR: ' + pr + ' (will update)')
29
+ else:
30
+ print(' PR: will create draft')
31
+ PYEOF
32
+
33
+ - id: ship
34
+ command: |
35
+ RP="${RIDDLE_PROOF_DIR:-/root/.openclaw/extensions/openclaw-riddle-proof/node_modules/@riddledc/riddle-proof/runtime}"
36
+ python3 "${RP}/lib/ship.py"
@@ -0,0 +1,74 @@
1
+ name: riddle-proof-verify
2
+ # Riddle Proof — Verify
3
+ # Reuses recon-established baselines and captures the after-proof.
4
+ # Run after recon and after code changes are on the branch.
5
+ # Re-run as many times as needed until the proof is strong.
6
+ # Requires RIDDLE_PROOF_DIR env var set to the runtime directory.
7
+
8
+ steps:
9
+
10
+ - id: check_state
11
+ command: |
12
+ python3 << 'PYEOF'
13
+ import json, os
14
+ state_file = os.environ.get('RIDDLE_PROOF_STATE_FILE', '/tmp/riddle-proof-state.json')
15
+ s = json.load(open(state_file))
16
+ if not s.get('workspace_ready'):
17
+ raise SystemExit('Workspace not ready. Run riddle-proof-setup first.')
18
+ if s.get('implementation_status') not in ('changes_detected', 'completed'):
19
+ raise SystemExit('Implementation not recorded. Run riddle-proof-implement after making code changes.')
20
+ print('VERIFY — ' + s.get('mode', 'server').upper())
21
+ print('Proof goal: ' + s.get('change_request', ''))
22
+ print('Success criteria: ' + (s.get('success_criteria') or '(none provided)'))
23
+ print('Verification mode: ' + s.get('verification_mode', 'proof'))
24
+ print('Reference: ' + (s.get('requested_reference') or s.get('reference', 'both')))
25
+ print('Proof plan status: ' + s.get('proof_plan_status', 'unknown'))
26
+ print('Before baseline: ' + s.get('before_cdn', '(missing)'))
27
+ if s.get('prod_cdn'):
28
+ print('Prod baseline: ' + s.get('prod_cdn'))
29
+ after_dir = s.get('after_worktree', '')
30
+ print('After worktree: ' + after_dir + (' (exists)' if os.path.exists(after_dir) else ' (MISSING)'))
31
+ PYEOF
32
+
33
+ - id: run_verify
34
+ command: |
35
+ RP="${RIDDLE_PROOF_DIR:-/root/.openclaw/extensions/openclaw-riddle-proof/node_modules/@riddledc/riddle-proof/runtime}"
36
+ python3 "${RP}/lib/verify.py"
37
+
38
+ - id: present_evidence
39
+ command: |
40
+ python3 << 'PYEOF'
41
+ import json, os
42
+ state_file = os.environ.get('RIDDLE_PROOF_STATE_FILE', '/tmp/riddle-proof-state.json')
43
+ s = json.load(open(state_file))
44
+ print('='*50)
45
+ print('RIDDLE PROOF — EVIDENCE')
46
+ print('='*50)
47
+ print('PROOF GOAL: ' + s.get('change_request', ''))
48
+ print('SUCCESS CRITERIA: ' + (s.get('success_criteria') or '(none provided)'))
49
+ print('MODE: ' + s.get('verification_mode', 'proof'))
50
+ print()
51
+ print('BEFORE (RECON): ' + s.get('before_cdn', '(none)'))
52
+ if s.get('prod_cdn'):
53
+ print('PROD (RECON): ' + s.get('prod_cdn'))
54
+ print('AFTER: ' + s.get('after_cdn', '(none)'))
55
+ print()
56
+ print('PROOF SUMMARY:')
57
+ print(s.get('proof_summary', '(not generated)'))
58
+ print()
59
+ print('VERIFY STATUS: ' + s.get('verify_status', 'unknown'))
60
+ print('ASSERTION STATUS: ' + s.get('assertion_status', 'unknown'))
61
+ mr = s.get('merge_recommendation', '')
62
+ if mr:
63
+ print('MERGE RECOMMENDATION: ' + mr)
64
+ pa = s.get('proof_assessment') or {}
65
+ if pa.get('decision'):
66
+ print('PROOF ASSESSMENT: ' + pa.get('decision'))
67
+ next_stage = (s.get('verify_decision_request') or {}).get('continue_with_stage') or (s.get('verify_decision_request') or {}).get('recommended_stage')
68
+ if next_stage:
69
+ print('NEXT INTERNAL STAGE: ' + str(next_stage))
70
+ print()
71
+ print('Review the full proof bundle.')
72
+ print(' - Use continue_from_checkpoint when the internal next stage looks right.')
73
+ print(' - Only escalate to the human if the workflow is not converging.')
74
+ PYEOF