consequa-x 1.1.1__tar.gz → 2.0.0__tar.gz
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.
- consequa_x-2.0.0/CHANGELOG.md +298 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/MANIFEST.in +2 -0
- {consequa_x-1.1.1/src/consequa_x.egg-info → consequa_x-2.0.0}/PKG-INFO +85 -43
- consequa_x-2.0.0/README.md +208 -0
- consequa_x-2.0.0/docs/application-integration.md +130 -0
- consequa_x-2.0.0/docs/design-2.0.md +109 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/design.md +2 -2
- consequa_x-2.0.0/docs/framework-integration.md +125 -0
- consequa_x-2.0.0/docs/migrating-to-2.0.md +100 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/offline-reports.md +16 -5
- consequa_x-2.0.0/docs/product-roadmap.md +107 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/quickstart.md +33 -14
- consequa_x-2.0.0/docs/release-notes.md +90 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/research-roadmap.md +6 -0
- consequa_x-2.0.0/docs/stable-api.md +110 -0
- consequa_x-2.0.0/examples/agent_loop_sqlite.py +204 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/examples/artifact_delivery.py +33 -33
- {consequa_x-1.1.1 → consequa_x-2.0.0}/pyproject.toml +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/analyze_matched_local_study.py +7 -7
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/audit_interaction_sampling.py +10 -10
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/audit_refund_interactions.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/audit_release_artifacts.py +3 -2
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/build_public_docs.py +14 -13
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/build_site_demo.py +10 -9
- consequa_x-2.0.0/scripts/check_installed_release.py +568 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/export_render_site.py +4 -2
- consequa_x-2.0.0/scripts/refresh_sample_report.py +61 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/run_matched_trace_judge.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/run_tau_benchmark_validation.py +18 -18
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/run_upstream_car_study.py +5 -3
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/summarize_matched_execution.py +2 -2
- consequa_x-2.0.0/src/consequa_x/__init__.py +54 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/attribution.py +3 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/decision_replay.py +6 -5
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/evaluation.py +8 -8
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/interaction_sampling.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/payments.py +5 -4
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/policy_experiment.py +5 -5
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/policy_runner.py +17 -15
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/runner.py +25 -20
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/targets.py +1 -1
- consequa_x-2.0.0/src/consequa_x/capture.py +547 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/cli.py +209 -6
- consequa_x-2.0.0/src/consequa_x/compare.py +106 -0
- consequa_x-2.0.0/src/consequa_x/errors.py +35 -0
- consequa_x-2.0.0/src/consequa_x/explanation.py +222 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/graph.py +26 -15
- consequa_x-2.0.0/src/consequa_x/guard.py +79 -0
- consequa_x-2.0.0/src/consequa_x/mcp_capture.py +53 -0
- consequa_x-2.0.0/src/consequa_x/migrate.py +180 -0
- consequa_x-2.0.0/src/consequa_x/models.py +733 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/policies.py +6 -12
- consequa_x-2.0.0/src/consequa_x/readback.py +102 -0
- consequa_x-2.0.0/src/consequa_x/record_verifier.py +260 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/report.py +123 -50
- consequa_x-2.0.0/src/consequa_x/research.py +22 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/schema.py +8 -5
- consequa_x-1.1.1/src/consequa_x/schemas/trace-v0.1.json → consequa_x-2.0.0/src/consequa_x/schemas/trace-v1.0.json +617 -543
- consequa_x-2.0.0/src/consequa_x/store.py +57 -0
- consequa_x-2.0.0/src/consequa_x/summary.py +142 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/verification.py +95 -18
- {consequa_x-1.1.1 → consequa_x-2.0.0/src/consequa_x.egg-info}/PKG-INFO +85 -43
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x.egg-info/SOURCES.txt +37 -2
- consequa_x-2.0.0/tests/fixtures/v0.1/README.md +13 -0
- consequa_x-2.0.0/tests/fixtures/v0.1/record-timeout-after-commit.json +234 -0
- consequa_x-2.0.0/tests/fixtures/v0.1/refund-another-actor.json +267 -0
- consequa_x-2.0.0/tests/fixtures/v0.1/refund-stale-readback.json +273 -0
- consequa_x-2.0.0/tests/fixtures/v0.1/refund-timeout-after-commit.explanation.json +455 -0
- consequa_x-2.0.0/tests/fixtures/v0.1/refund-timeout-after-commit.json +273 -0
- consequa_x-2.0.0/tests/test_agent_loop_example.py +61 -0
- consequa_x-2.0.0/tests/test_async_capture.py +98 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_calibration.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_calibration_mechanisms.py +1 -1
- consequa_x-2.0.0/tests/test_capture.py +263 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_cli.py +1 -1
- consequa_x-2.0.0/tests/test_compare_verify_redact.py +95 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_decision_coalition.py +6 -3
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_decision_contrastive.py +3 -2
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_decision_replay.py +7 -5
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_decision_shapley.py +2 -1
- consequa_x-2.0.0/tests/test_docs_examples.py +20 -0
- consequa_x-2.0.0/tests/test_errors.py +87 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_graph.py +13 -9
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_graph_identity.py +6 -6
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_installed_release_check.py +28 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_integration.py +28 -28
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_interval_replay.py +3 -3
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_matched_baseline_audit.py +4 -4
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_matched_local_study.py +6 -6
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_matched_trace_judge.py +8 -7
- consequa_x-2.0.0/tests/test_mcp_capture.py +73 -0
- consequa_x-2.0.0/tests/test_migrate.py +118 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_model_eval_integration.py +4 -4
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_models.py +90 -50
- consequa_x-2.0.0/tests/test_multi_action.py +165 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_ollama.py +2 -2
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_payments.py +5 -4
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_policies.py +4 -4
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_policy_experiment.py +3 -3
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_policy_experiment_integration.py +5 -5
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_policy_runner.py +11 -10
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_public_integration.py +76 -88
- consequa_x-2.0.0/tests/test_readback_guard.py +96 -0
- consequa_x-2.0.0/tests/test_record_verifier.py +186 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_refund_interactions.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_release_inventory.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_render_site_export.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_replay_targets.py +4 -3
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_report.py +45 -41
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_report_cli.py +3 -3
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_research_integration.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_schema.py +14 -13
- consequa_x-2.0.0/tests/test_summary_store.py +105 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_task_templates.py +1 -1
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_tau_benchmark_validation.py +5 -5
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_verification.py +7 -4
- consequa_x-1.1.1/CHANGELOG.md +0 -142
- consequa_x-1.1.1/README.md +0 -166
- consequa_x-1.1.1/docs/application-integration.md +0 -125
- consequa_x-1.1.1/docs/release-notes.md +0 -41
- consequa_x-1.1.1/docs/stable-api.md +0 -92
- consequa_x-1.1.1/scripts/check_installed_release.py +0 -356
- consequa_x-1.1.1/src/consequa_x/__init__.py +0 -25
- consequa_x-1.1.1/src/consequa_x/explanation.py +0 -216
- consequa_x-1.1.1/src/consequa_x/models.py +0 -532
- {consequa_x-1.1.1 → consequa_x-2.0.0}/CONTRIBUTING.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/LICENSE +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/SECURITY.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/attribution-calibration.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/build-contract.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/car-reproduction-plan.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/completion-plan.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/decision-contrastive.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/decision-replay.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/decision-shapley.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/graph-witnesses.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/interaction-sampling.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/interval-followup-plan.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/launch-readiness.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/local-pypi-setup.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/matched-trace-judge.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/policy-evaluation.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/policy-replay.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/refund-interactions.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/release-readiness.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/studies/matched-local-2026-10-18.json +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/studies/refund-family-candidates-v1.json +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/study-manifests.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/study-plan.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/tau-benchmark-validation.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/upstream-car-comparison.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/v1.1-release.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/docs/variable-length-game-plan.md +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/examples/decision_shapley_fixture.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/examples/report_quickstart.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/requirements-dev.lock +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/audit_interval_comparison.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/audit_review_revision.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/build_matched_study_figures.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/configure_pypi_auth.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/draw_paper_diagrams.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/finalize_interval_artifacts.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/finalize_matched_local_study.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/finalize_refund_artifacts.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/plot_interval_comparison.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/plot_paper_results.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/publish_alpha.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/publish_release.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/run_interaction_sampling.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/run_matched_local_study.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/scripts/summarize_interaction_sampling.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/setup.cfg +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/__main__.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/adapters/__init__.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/adapters/ollama.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/__init__.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/assessment_metrics.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/calibration.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/calibration_export.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/calibration_mechanisms.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/decision_coalition.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/decision_contrastive.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/decision_shapley.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/interaction_export.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/interaction_mechanisms.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/interval_comparison.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/intervals.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/study.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/benchmark/templates.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x/py.typed +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x.egg-info/dependency_links.txt +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x.egg-info/entry_points.txt +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x.egg-info/requires.txt +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/src/consequa_x.egg-info/top_level.txt +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_assessment_metrics.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_attribution.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_calibration_cli.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_decision_contrastive_cli.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_decision_shapley_cli.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_interaction_sampling.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_interaction_sampling_cli.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_interaction_workers.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_interval_comparison.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_intervals.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_matched_execution_summary.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_matched_figure_builder.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_matched_study_finalizer.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_policy_evaluation.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_prompt_profile_cli.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_refund_interactions_cli.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_release_helpers.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_site_demo.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_snapshot_integrity.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_stable_release.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_study.py +0 -0
- {consequa_x-1.1.1 → consequa_x-2.0.0}/tests/test_upstream_car_study.py +0 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Changes
|
|
2
|
+
|
|
3
|
+
## 2.0.0 - 19 October 2026 (breaking)
|
|
4
|
+
|
|
5
|
+
See [the 2.0 design](docs/design-2.0.md) and the
|
|
6
|
+
[migration guide](docs/migrating-to-2.0.md). Deferred to 2.1: verifier
|
|
7
|
+
composition, optional framework integrations and OpenTelemetry export.
|
|
8
|
+
|
|
9
|
+
- Typed exceptions: every intentional error derives from `ConsequaError` and
|
|
10
|
+
still from `ValueError` or `TypeError`. `ValidationError` (invalid records,
|
|
11
|
+
traces and settings; malformed JSON is now one too), `SchemaVersionError`,
|
|
12
|
+
`ConsequaTypeError`, `ContractError` (a verifier cannot evaluate the
|
|
13
|
+
contract), `ReceiptError` (a verifier or matcher result crosses its identity
|
|
14
|
+
boundary, or recorded evidence cannot support the interpretation) and
|
|
15
|
+
`RecorderError`. `InsufficientEvidenceError` and `PolicyError` join the
|
|
16
|
+
hierarchy.
|
|
17
|
+
- Captured payloads are deeply read-only. Event data, arguments, contract
|
|
18
|
+
expectations, results, readback records, scopes and evidence details are
|
|
19
|
+
`FrozenDict` and `FrozenList` values: they compare equal to and serialize
|
|
20
|
+
like ordinary dicts and lists, but any change raises `ConsequaTypeError`.
|
|
21
|
+
`copy.deepcopy` returns the same read-only value; `thaw()` returns an
|
|
22
|
+
editable copy, and `to_dict()` still exports ordinary dicts and lists.
|
|
23
|
+
- Trace schema `1.0`. A trace holds one or more `actions`, each with its own
|
|
24
|
+
contract; `responses`, `assessments` (zero or more per action) and
|
|
25
|
+
`verifications` each name their `action_id`. A required `time_base`
|
|
26
|
+
(`unix_ms` or `relative_ms`) says what the integer millisecond times count
|
|
27
|
+
from. `trace_id` is no longer repeated on actions and events. All records
|
|
28
|
+
are keyword-only. Schema `0.1` input is refused with a `SchemaVersionError`
|
|
29
|
+
that names the migration route; the packaged schema is `trace-v1.0.json`.
|
|
30
|
+
New helpers: `Trace.get_action`, `single_action`, `responses_for`,
|
|
31
|
+
`assessments_for`, `verifications_for`, `latest_assessment`,
|
|
32
|
+
`latest_verification`.
|
|
33
|
+
- `TraceRecorder.register` can be called for several actions and returns an
|
|
34
|
+
`ActionCapture` whose `attempt`, `call`, `dispatch`, `response`,
|
|
35
|
+
`assessment` and `verify` record for that action. The recorder-level methods
|
|
36
|
+
still work while exactly one action is registered. Assessments are optional
|
|
37
|
+
and may be repeated. The default clock is wall-clock `unix_ms`; a custom
|
|
38
|
+
clock records `relative_ms` unless told otherwise. `capture_tool` and
|
|
39
|
+
`call_mcp_tool` accept an `ActionCapture`.
|
|
40
|
+
- `explain()` returns a `TraceExplanation` with one `ActionExplanation` per
|
|
41
|
+
action (`for_action`, `single_action`). An action without verification is
|
|
42
|
+
reported as `NO_VERIFICATION` instead of raising. The evidence graph has a
|
|
43
|
+
contract node per action, and offline reports show every action, with an
|
|
44
|
+
Action column for responses and verifications and the time base in the
|
|
45
|
+
footer.
|
|
46
|
+
- Verifiers own domain interpretation. `VerificationResult` gains
|
|
47
|
+
`target_effect_ids` (`None` when the verifier did no target matching,
|
|
48
|
+
otherwise this action's effects that match the full target) and `findings`
|
|
49
|
+
(`Finding(code, effect_ids, detail)`). `RefundVerifier` records refund
|
|
50
|
+
matches and the `EXCESS_EFFECTS`, `DUPLICATE_EFFECT`, `PARAMETER_MISMATCH`,
|
|
51
|
+
`PARTIAL_EFFECT` and `REVERSED_EFFECT` findings; `RecordVerifier` records
|
|
52
|
+
record matches and `EXCESS_EFFECTS`, `DUPLICATE_EFFECT`,
|
|
53
|
+
`PARAMETER_MISMATCH` and `REMOVED_EFFECT`. `TargetMatcher`,
|
|
54
|
+
`RecordTargetMatcher`, `RecordVerifier.target_matcher()` and
|
|
55
|
+
`explain(..., target_matcher=...)` are removed; a custom verifier sets
|
|
56
|
+
`target_effect_ids` instead.
|
|
57
|
+
- `explain()` is domain-independent: it reads receipts, responses and
|
|
58
|
+
assessments and never reinterprets evidence details. Diagnoses are
|
|
59
|
+
structured `Diagnosis(code, evidence, message)` records; `codes` gives the
|
|
60
|
+
codes and `diagnosis` a display label. `UNASSESSABLE_ASSESSMENT` now applies
|
|
61
|
+
to every predicate whenever the outcome is known but alignment cannot be
|
|
62
|
+
judged (1.x omitted it for refunds). `CORE_DIAGNOSES` lists the codes
|
|
63
|
+
`explain()` produces.
|
|
64
|
+
- Offline reports show each action's assessment alignment and diagnosis
|
|
65
|
+
codes, computed from the recorded receipts. Codes from custom verifiers are
|
|
66
|
+
counted rather than printed.
|
|
67
|
+
- Migration: `migrate_trace()` and `consequa-x migrate OLD --output NEW`
|
|
68
|
+
convert schema `0.1` traces. Target matches and findings are added only when
|
|
69
|
+
the 2.0 verifier (the refund verifier by default; pass others with
|
|
70
|
+
`verifiers=`) reproduces the recorded receipt exactly; no recorded conclusion
|
|
71
|
+
is changed. `consequa-x validate` checks trace files. Migrated traces of the
|
|
72
|
+
1.x demo reproduce their 1.x explanations; fixtures written by the released
|
|
73
|
+
1.2.0 package are in `tests/fixtures/v0.1`.
|
|
74
|
+
- `summarize(traces)` and `consequa-x summarize PATH... [--format text|markdown|json]`
|
|
75
|
+
count verified state, origin, alignment, tool responses and diagnoses over
|
|
76
|
+
every action, with stated denominators; `unknown` and `unverified` stay
|
|
77
|
+
separate from failures, and actions with divergences or violations are
|
|
78
|
+
listed. Folders (non-trace JSON is skipped and counted) and `.jsonl` stores
|
|
79
|
+
are accepted; invalid inputs are listed by path and error type only and make
|
|
80
|
+
the command exit 2.
|
|
81
|
+
- `poll_readback(capture, read, until_ms=, interval_ms=)` waits until the
|
|
82
|
+
contract horizon, then reads back and verifies repeatedly (every observation
|
|
83
|
+
and receipt is recorded) until the outcome is `satisfied` or `violated` or the
|
|
84
|
+
time limit passes; an unresolved `unknown` is returned as is.
|
|
85
|
+
- Async agents: `capture_tool` wraps `async def` tools, `ActionCapture.acall`
|
|
86
|
+
(and `TraceRecorder.acall`) awaits a tool as one recorded attempt,
|
|
87
|
+
`averify`/`ActionCapture.averify` accept verifiers whose `verify` is a
|
|
88
|
+
coroutine (receipts are checked exactly as `verify` checks them), and
|
|
89
|
+
`apoll_readback` polls with awaited reads and `asyncio.sleep`.
|
|
90
|
+
- `retry_advice(receipt or trace)` turns verified evidence into
|
|
91
|
+
`DO_NOT_RETRY` (the outcome already holds, whoever produced it), `WAIT`
|
|
92
|
+
(missing or unknown readback), `ESCALATE` (relevant effects that do not
|
|
93
|
+
satisfy the contract) or `RETRY_PERMITTED` (a complete readback shows no
|
|
94
|
+
relevant effect; retry with an idempotency key, since an in-flight attempt can
|
|
95
|
+
still commit), each with a reason.
|
|
96
|
+
- `compare(left, right)` and `consequa-x compare A B [--fail-on-difference]`
|
|
97
|
+
compare two traces action by action: contract, tool responses, latest
|
|
98
|
+
assessment, verified state and origin, alignment and diagnosis codes, plus
|
|
99
|
+
actions present in only one trace.
|
|
100
|
+
- `consequa-x verify TRACE --readback OBS.json [--scope-field F] --output NEW`
|
|
101
|
+
verifies a captured readback file with the built-in refund or record
|
|
102
|
+
verifier and saves the trace with the new receipt, without Python code.
|
|
103
|
+
- `render_report(..., include_details=True, redact=("card_number", ...))` and
|
|
104
|
+
`consequa-x report --include-details --redact KEY` replace the values of the
|
|
105
|
+
named JSON keys everywhere in the included trace. Values under other keys are
|
|
106
|
+
kept; this is omission by name, not anonymization.
|
|
107
|
+
- `TraceStore(path)`: an append-only JSON Lines file of validated traces with
|
|
108
|
+
unique trace IDs; reading reports the line number of an invalid entry.
|
|
109
|
+
- Research interfaces (`EffectEstimate`, `Intervention`, `leave_one_out`,
|
|
110
|
+
`recency_attribution`, the policy types) are imported from
|
|
111
|
+
`consequa_x.research` instead of the top-level namespace.
|
|
112
|
+
- Research code (benchmark, replay, policies, studies and their audit
|
|
113
|
+
scripts) produces and reads schema `1.0` traces. Retained 1.x study outputs
|
|
114
|
+
under `output/` are unchanged.
|
|
115
|
+
|
|
116
|
+
## 1.2.0 - 19 October 2026
|
|
117
|
+
|
|
118
|
+
Additive only: the 1.x API and trace schema `0.1` are unchanged.
|
|
119
|
+
|
|
120
|
+
- Added `TraceRecorder` (`consequa_x.capture`), which records one action as it
|
|
121
|
+
happens (context, decision, registration with its outcome contract,
|
|
122
|
+
dispatches, tool responses, the agent's assessment, readbacks and
|
|
123
|
+
verification) and returns an ordinary validated `Trace`. Events are linked
|
|
124
|
+
as in the package fixtures, so graphs, reports and `explain()` work unchanged.
|
|
125
|
+
- Added tool-call capture: `TraceRecorder.attempt()` (context manager),
|
|
126
|
+
`TraceRecorder.call()` and the `capture_tool` decorator record the dispatch
|
|
127
|
+
and the response (success, `timeout` for `TimeoutError`, or `error`) around
|
|
128
|
+
a synchronous tool, keep JSON results, keep only exception type names, and
|
|
129
|
+
re-raise. A recorded timeout says nothing about whether the effect happened.
|
|
130
|
+
- Added `RecordVerifier` and `RecordTargetMatcher` for a generic `record_present`
|
|
131
|
+
predicate: records with given field values, an exact or minimum count,
|
|
132
|
+
a commit deadline and a persistence window, with configurable field names.
|
|
133
|
+
Unavailable, out-of-scope, incomplete, stale or malformed readback stays
|
|
134
|
+
`unknown`, and origin stays a separate conclusion, as for refunds.
|
|
135
|
+
- Added `examples/agent_loop_sqlite.py`: a stdlib-only, offline tool-calling
|
|
136
|
+
loop that writes to a real SQLite database, is captured with `TraceRecorder`,
|
|
137
|
+
and is verified through a separate read-only connection with `RecordVerifier`.
|
|
138
|
+
Modes: `timeout_after_commit`, `other_actor` and `stale_readback`.
|
|
139
|
+
It is also in the website's quickstart download.
|
|
140
|
+
- README section on capturing a real agent's tool call.
|
|
141
|
+
- Added `TraceRecorder.now()`, the recorder clock for readback times.
|
|
142
|
+
- Added `consequa_x.mcp_capture.call_mcp_tool`, which records an awaited MCP
|
|
143
|
+
tool call from any session exposing `call_tool(name, arguments)` without an
|
|
144
|
+
MCP dependency. Tool content is not copied into the trace.
|
|
145
|
+
- Added a framework integration guide (`docs/framework-integration.md`).
|
|
146
|
+
- The website's workflow cards, documentation and quickstart show the capture
|
|
147
|
+
API. `scripts/check_installed_release.py` now also exercises the recorder,
|
|
148
|
+
tool capture and record verifier from the installed wheel.
|
|
149
|
+
- Published to PyPI with registry hashes verified; see the
|
|
150
|
+
[release record](output/release-1.2.0-2026-10-19/README.md). Installed checks
|
|
151
|
+
passed on Windows Python 3.11.9 and 3.12.10, on one Alpine Linux 3.24.2 QEMU
|
|
152
|
+
guest with Python 3.14.8 and from a fresh PyPI install. macOS has never been
|
|
153
|
+
tested.
|
|
154
|
+
|
|
155
|
+
## 1.1.1 - 18 October 2026
|
|
156
|
+
|
|
157
|
+
- Documentation and metadata release. Runtime code and schema `0.1` are
|
|
158
|
+
identical to 1.1.0 apart from the version number.
|
|
159
|
+
- Rewrote the package description for PyPI with absolute links that work outside
|
|
160
|
+
the repository. Project URLs now point to the public source repository and to
|
|
161
|
+
<https://consequa-x.onrender.com>.
|
|
162
|
+
- The source repository is public. Its issue forms and security policy replace
|
|
163
|
+
the separate community repository, whose quickstart and release notes moved to
|
|
164
|
+
`docs/quickstart.md` and `docs/release-notes.md`.
|
|
165
|
+
- The website inspector and live demo replay recorded output from real package
|
|
166
|
+
runs, generated by `scripts/build_site_demo.py` and pinned by
|
|
167
|
+
`tests/test_site_demo.py`. The site deploys from this repository.
|
|
168
|
+
- The snapshot-integrity test now verifies every committed manifest format and
|
|
169
|
+
ignores uncommitted study outputs.
|
|
170
|
+
- Published to PyPI with registry hashes verified; see the
|
|
171
|
+
[release record](output/release-1.1.1-2026-10-18/README.md). Installed checks
|
|
172
|
+
passed on Windows Python 3.11.9 and 3.12.10 and from a fresh PyPI install.
|
|
173
|
+
Linux and macOS were not rerun for 1.1.1; macOS has never been tested.
|
|
174
|
+
|
|
175
|
+
## 1.1.0 - 17 October 2026
|
|
176
|
+
|
|
177
|
+
- Added `render_report(trace, include_details=False)` and
|
|
178
|
+
`consequa-x report trace.json --output report.html`, with a self-contained
|
|
179
|
+
chronology, contract, responses, assessment, readback, verification/origin and
|
|
180
|
+
SVG evidence graph plus complete accessible graph tables.
|
|
181
|
+
- Default reports omit arbitrary captured values throughout the file. Explicit
|
|
182
|
+
details mode includes the full trace as escaped inert JSON. No report executes
|
|
183
|
+
actions, verifiers, target matchers or replay; alignment remains unassessable
|
|
184
|
+
in the report. The original trace remains separate evidence.
|
|
185
|
+
- Preserved source and existing output files with exclusive creation. Invalid
|
|
186
|
+
schema data is refused before an output directory is created, with captured
|
|
187
|
+
values omitted from report-command decoding errors.
|
|
188
|
+
- Added a synthetic artifact-delivery visual quickstart and public documentation,
|
|
189
|
+
support and security routes, while retaining the private research repository.
|
|
190
|
+
- Added installed-package release checks and browser/report security gates.
|
|
191
|
+
Release receipts bind the final artifact, actual platform checks and
|
|
192
|
+
publication state; public release notes report the tested environments.
|
|
193
|
+
- Preserved the dependency-free version-1 core and portable wire schema `0.1`.
|
|
194
|
+
GitHub Actions stays disabled.
|
|
195
|
+
|
|
196
|
+
## Post-release research update - 16 October 2026
|
|
197
|
+
|
|
198
|
+
The predeclared physical-interaction study finished collection on 15 October
|
|
199
|
+
2026 at frozen runtime source `0bd744df4fc8784e4cf1a1e2eb62f892c6f3c8c9`.
|
|
200
|
+
It retained all 2,048 trials and 655,360 planned branch slots, with 628,535 actual
|
|
201
|
+
scripted policy calls, no model calls and no additional comparison calls.
|
|
202
|
+
The [protocol](output/interaction-sampling-2026-10-15/protocol.json),
|
|
203
|
+
[complete summary](output/interaction-sampling-2026-10-15/summary.json) and
|
|
204
|
+
[execution receipt](output/interaction-sampling-2026-10-15-execution.json) retain
|
|
205
|
+
the collection identity separately from the public stable release. The
|
|
206
|
+
[independent audit](output/interaction-sampling-audits-2026-10-15/independent.json)
|
|
207
|
+
passed 44,698,925 assertions, covering every planned trial/branch and 4,210
|
|
208
|
+
preselected complete traces. The
|
|
209
|
+
[derived findings](output/interaction-sampling-findings-2026-10-15/FINDINGS.md)
|
|
210
|
+
retain coverage, width, detection and refusal denominators. The defined
|
|
211
|
+
framework and protocol/software paper scope is complete on 16 October 2026:
|
|
212
|
+
the [illustrated eight-page IEEE PDF](output/pdf/Consequa-X_IEEE_Paper.pdf) compiled and all
|
|
213
|
+
rendered pages passed visual review. The [QA receipt](output/pdf/qa.json) binds
|
|
214
|
+
it to the frozen [editable source](paper/consequa-x-ieee.tex) and four vector
|
|
215
|
+
figures. Actual venue selection, final human
|
|
216
|
+
review, reviewer access and submission remain maintainer steps. These results
|
|
217
|
+
do not establish held-out model performance, a new estimator or baseline
|
|
218
|
+
superiority.
|
|
219
|
+
|
|
220
|
+
## 1.0.0 - 15 October 2026
|
|
221
|
+
|
|
222
|
+
Runtime source is frozen at `0bd744df4fc8784e4cf1a1e2eb62f892c6f3c8c9`.
|
|
223
|
+
The [stable release is public on PyPI](https://pypi.org/project/consequa-x/1.0.0/),
|
|
224
|
+
built from `85ce6c316838c995782aadc8c10770acc708339b` with all 36 runtime files
|
|
225
|
+
matching that freeze. Both downloads were independently hash/size checked;
|
|
226
|
+
[publication](output/release-1.0.0-2026-10-15/publication.json) and
|
|
227
|
+
[fresh registry-install](output/release-1.0.0-2026-10-15/registry-install.json)
|
|
228
|
+
receipts record the achieved release. PR #8 merged as `708d064`; GitHub remains
|
|
229
|
+
private. Published artifacts retain their original reviewed bytes and dated
|
|
230
|
+
build-time documentation.
|
|
231
|
+
|
|
232
|
+
- Defined the version 1 stable evidence-core API while retaining wire schema
|
|
233
|
+
`0.1`. Benchmark procedures, exact policy prompts and study commands remain
|
|
234
|
+
explicitly scoped research interfaces.
|
|
235
|
+
- Added explicit application verifiers to `verify(..., verifier=...)`, with
|
|
236
|
+
receipt checks for contract, observation identity, source, watermark and
|
|
237
|
+
capture time. Adapter semantics and source authentication remain application
|
|
238
|
+
responsibilities.
|
|
239
|
+
- Added `TargetMatcher` and `explain(..., target_matcher=...)`. Non-refund
|
|
240
|
+
predicates remain domain-neutral and unassessable without declared target
|
|
241
|
+
semantics; unknown receipts never execute the matcher. Invalid adapter methods
|
|
242
|
+
and inputs have controlled type errors, and invalid target returns or known
|
|
243
|
+
refund details have controlled value errors.
|
|
244
|
+
- Exported `Evidence`, `ToolResponse`, `ResponseStatus` and `TargetMatcher` from
|
|
245
|
+
the package root. Added the standalone artifact-delivery application example
|
|
246
|
+
and source-archive integration documentation.
|
|
247
|
+
- Preserved successive and duplicate effect records as separate graph witnesses,
|
|
248
|
+
with identity edges and observation-specific verification/origin links.
|
|
249
|
+
Conflicting later payloads or provenance cannot overwrite an earlier witness.
|
|
250
|
+
Source-owned reserved fields remain available verbatim; attribution candidates
|
|
251
|
+
must identify captured events.
|
|
252
|
+
- Made demonstration, fixture-experiment and explanation output paths preserve
|
|
253
|
+
existing evidence. Run directories must be new or empty; explanation output
|
|
254
|
+
must be a new file distinct from the input trace.
|
|
255
|
+
- Added `calibrate-interactions`, reproducible repeated physical refund sampling,
|
|
256
|
+
same-draw uncertainty comparisons, bounded parallel execution, complete
|
|
257
|
+
refusal/cost records and an independently implemented audit. The retained
|
|
258
|
+
2,048-trial collection completed after the distribution-build checkpoint;
|
|
259
|
+
its later research status is recorded above without changing released bytes.
|
|
260
|
+
|
|
261
|
+
The full frozen-source suite passed 1,480 tests and 240 subtests. Twenty
|
|
262
|
+
additional stable-publisher tests passed; final installed-wheel Windows Python
|
|
263
|
+
3.11.9 conformance passed 200 tests and 165 subtests. Independent Windows Python
|
|
264
|
+
3.12.14 wheel, source-archive and registry installations each passed 12 trace
|
|
265
|
+
round-trips and four artifact-adapter checks. All eight local release gates,
|
|
266
|
+
public artifact hash/size verification and the fresh registry installation are
|
|
267
|
+
complete. No GitHub Actions were used. These software checks do not establish
|
|
268
|
+
held-out model performance or attribution superiority.
|
|
269
|
+
|
|
270
|
+
## 0.1.0a2 — 14 October 2026
|
|
271
|
+
|
|
272
|
+
- Default decision-contrastive uncertainty now uses exact binomial intervals.
|
|
273
|
+
Signed Shapley pair means use Hoeffding bounds; independent endpoint
|
|
274
|
+
differences use two exact binomial marginals with a split failure allowance.
|
|
275
|
+
Original bootstrap/normal modes remain explicit comparators.
|
|
276
|
+
- Added `compare-intervals`, with a pre-call protocol, complete same-draw
|
|
277
|
+
retention, exact finite distribution calculations, width/power metrics and
|
|
278
|
+
independent numerical/artifact audits. Original calibration data is preserved.
|
|
279
|
+
- Added an explicit on-reach positional game for normally terminated later
|
|
280
|
+
decisions. The strict game remains the default, and incompatible operations,
|
|
281
|
+
unknown evidence, provider failures and budget refusals remain explicit.
|
|
282
|
+
- Added `refund-interactions` to enumerate physical selection/retry interactions,
|
|
283
|
+
idempotency and evidence/budget controls through actual payment readback.
|
|
284
|
+
- Interval rescoring now reconstructs Shapley pair vectors from replay evidence
|
|
285
|
+
and validates stored coverage, points and endpoint diagnostics.
|
|
286
|
+
- Cached static record annotations while retaining validation of every value;
|
|
287
|
+
added a working paper, reproducible evidence links and release preparation.
|
|
288
|
+
|
|
289
|
+
This is an engineering alpha. Sampling assumptions, individual-interval scope
|
|
290
|
+
and intervention games remain explicit. Synthetic validation does not establish
|
|
291
|
+
live-model calibration, cross-task generalization or attribution superiority.
|
|
292
|
+
GitHub Actions remains disabled; checks and builds run locally.
|
|
293
|
+
|
|
294
|
+
## 0.1.0a1
|
|
295
|
+
|
|
296
|
+
Initial Python alpha with portable evidence records, independent refund
|
|
297
|
+
verification, evidence graphs, local policy adapters and bounded replay
|
|
298
|
+
experiments. No registry publication is implied by the source version.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: consequa-x
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Evidence-aware explanation of consequential agent actions
|
|
5
5
|
Author: Devrajsinh Jhala
|
|
6
6
|
License-Expression: MIT
|
|
@@ -76,66 +76,103 @@ evaluation only; never pass it to an explainer.
|
|
|
76
76
|
|
|
77
77
|
## Use it in Python
|
|
78
78
|
|
|
79
|
-
Register
|
|
80
|
-
|
|
79
|
+
Register each consequential action with its intended outcome before running it,
|
|
80
|
+
let the recorder capture what happens, read the outcome back from a trusted
|
|
81
|
+
read-only source, then verify and explain:
|
|
81
82
|
|
|
82
83
|
```python
|
|
83
84
|
from consequa_x import (
|
|
84
|
-
|
|
85
|
-
Trace, explain, render_report, verify,
|
|
85
|
+
Observation, OutcomeContract, RecordVerifier, TraceRecorder, explain, render_report,
|
|
86
86
|
)
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
88
|
+
verifier = RecordVerifier(scope_fields=("order_id",))
|
|
89
|
+
rec = TraceRecorder("run-17", actor="support-agent", time_base="relative_ms")
|
|
90
|
+
refund = rec.register(
|
|
91
|
+
"refund-o-17", "issue_refund", {"order_id": "o-17"}, at_ms=0,
|
|
92
|
+
contract=OutcomeContract(contract_id="refund-o-17", predicate="record_present",
|
|
93
|
+
expected={"order_id": "o-17", "amount_minor": 5000},
|
|
94
|
+
deadline_ms=200, stability_ms=50))
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
with refund.attempt(at_ms=5) as attempt: # your tool call goes here
|
|
98
|
+
attempt.at_ms = 30
|
|
99
|
+
raise TimeoutError # ...and it timed out
|
|
100
|
+
except TimeoutError:
|
|
101
|
+
refund.assessment("failure", at_ms=31) # what the agent reported
|
|
102
|
+
|
|
103
|
+
# Captured independently, after the horizon, from a read-only replica of the orders table.
|
|
104
|
+
readback = Observation(
|
|
105
|
+
observation_id="read-1", source="orders-replica", observed_at_ms=300, as_of_ms=300,
|
|
106
|
+
scope={"order_id": "o-17"},
|
|
107
|
+
records=({"effect_id": "rf-1", "order_id": "o-17", "amount_minor": 5000,
|
|
108
|
+
"committed_at_ms": 20, "action_id": "refund-o-17",
|
|
109
|
+
"attempt_id": "refund-o-17:attempt-1", "actor": "support-agent"},))
|
|
110
|
+
receipt = refund.verify(readback, verifier=verifier)
|
|
111
|
+
|
|
112
|
+
result = explain(rec.trace()).for_action("refund-o-17")
|
|
113
|
+
assert receipt.status.value == "satisfied" # the refund really happened
|
|
114
|
+
assert receipt.origin.value == "confirmed" # and this action produced it
|
|
115
|
+
assert result.assessment_alignment == "contradicted" # the agent said failure
|
|
116
|
+
print(result.codes) # ('ASSESSMENT_DIVERGENCE', 'ACKNOWLEDGEMENT_EFFECT_DIVERGENCE')
|
|
117
|
+
html = render_report(rec.trace()) # offline, minimal disclosure
|
|
108
118
|
```
|
|
109
119
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
a
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
A run can register several actions; each `register` returns that action's
|
|
121
|
+
`ActionCapture`, and its attempts, assessments and verifications stay separate.
|
|
122
|
+
`capture_tool` decorates a tool (synchronous or `async def`) so every call is
|
|
123
|
+
recorded. `poll_readback` re-reads a lagging source until the outcome is known,
|
|
124
|
+
and `retry_advice` turns the receipt into a retry decision.
|
|
125
|
+
|
|
126
|
+
The built-in verifiers are `RecordVerifier` (rows, orders, tickets, files:
|
|
127
|
+
`record_present`) and `RefundVerifier` (`refund_processed`). Both check values,
|
|
128
|
+
count, commit deadline and persistence; unavailable, incomplete, wrongly scoped or
|
|
129
|
+
stale readback produces `unknown`. Effect origin is a separate conclusion:
|
|
130
|
+
`confirmed`, `other_actor` or `unknown`. Verifiers also record which effects match
|
|
131
|
+
the target and domain findings (excess, duplicate, mismatched, reversed or
|
|
132
|
+
removed effects); `explain` reads those receipts without any domain logic of its
|
|
133
|
+
own.
|
|
134
|
+
|
|
135
|
+
The [agent-loop example](https://github.com/Devrajsinh-Jhala/consequa-x/blob/main/examples/agent_loop_sqlite.py)
|
|
136
|
+
runs this end to end against a real SQLite database, offline, in three modes: a
|
|
137
|
+
timeout after the refund committed, a refund made by someone else, and a readback
|
|
138
|
+
too stale to decide. The
|
|
139
|
+
[framework guide](https://github.com/Devrajsinh-Jhala/consequa-x/blob/main/docs/framework-integration.md)
|
|
140
|
+
shows where the calls go in OpenAI Agents SDK, LangChain, Claude Agent SDK and MCP
|
|
141
|
+
tool loops.
|
|
142
|
+
|
|
143
|
+
Traces round-trip through a portable, versioned JSON schema (`1.0`):
|
|
116
144
|
`Trace.from_json(trace.to_json())` rejects unknown fields, broken identity links
|
|
117
|
-
and dependency cycles
|
|
118
|
-
JSON Schema.
|
|
145
|
+
and dependency cycles, and every captured payload is read-only.
|
|
119
146
|
|
|
120
147
|
## Bring your own domain
|
|
121
148
|
|
|
122
|
-
|
|
123
|
-
|
|
149
|
+
Write a read-only `Verifier` for your predicate. It returns a
|
|
150
|
+
`VerificationResult` with the state, origin and the effects it saw; to let the
|
|
151
|
+
agent's report be judged, it also records `target_effect_ids` (this action's
|
|
152
|
+
effects that match the full target):
|
|
124
153
|
|
|
125
154
|
```python
|
|
126
155
|
receipt = verify(action, observation, verifier=MyVerifier())
|
|
127
|
-
explanation = explain(trace, target_matcher=MyTargetMatcher())
|
|
128
156
|
```
|
|
129
157
|
|
|
130
158
|
Your application owns source trust, scope, completeness, timing and provenance;
|
|
131
|
-
Consequa-X checks that receipts bind to the supplied contract and
|
|
132
|
-
and keeps the evidence structured. The
|
|
159
|
+
Consequa-X checks that receipts bind to the supplied action, contract and
|
|
160
|
+
observation, and keeps the evidence structured. The
|
|
133
161
|
[artifact-delivery example](https://github.com/Devrajsinh-Jhala/consequa-x/blob/main/examples/artifact_delivery.py)
|
|
134
|
-
implements
|
|
162
|
+
implements a verifier with public APIs only, and the
|
|
135
163
|
[integration guide](https://github.com/Devrajsinh-Jhala/consequa-x/blob/main/docs/application-integration.md)
|
|
136
164
|
describes the boundary in detail. The
|
|
137
165
|
[stable API](https://github.com/Devrajsinh-Jhala/consequa-x/blob/main/docs/stable-api.md)
|
|
138
|
-
page lists what version
|
|
166
|
+
page lists what version 2 guarantees.
|
|
167
|
+
|
|
168
|
+
## Upgrading from 1.x
|
|
169
|
+
|
|
170
|
+
Version 2.0 changes the trace schema to `1.0` (several actions per trace, a
|
|
171
|
+
declared time base, keyword-only and read-only records) and moves domain
|
|
172
|
+
interpretation into verifiers. Convert saved 1.x traces with
|
|
173
|
+
`consequa-x migrate OLD.json --output NEW.json` or `migrate_trace()`. The
|
|
174
|
+
[migration guide](https://github.com/Devrajsinh-Jhala/consequa-x/blob/main/docs/migrating-to-2.0.md)
|
|
175
|
+
lists every change and its replacement.
|
|
139
176
|
|
|
140
177
|
## Command line
|
|
141
178
|
|
|
@@ -143,12 +180,17 @@ page lists what version 1 guarantees.
|
|
|
143
180
|
| --- | --- |
|
|
144
181
|
| `consequa-x demo --output DIR` | Write the twelve synthetic refund scenarios: traces, explanations, schema and manifest |
|
|
145
182
|
| `consequa-x explain TRACE [--output FILE]` | Explain an existing trace without replay; prints JSON or writes a new file |
|
|
146
|
-
| `consequa-x report TRACE --output FILE` | Render a self-contained HTML report;
|
|
183
|
+
| `consequa-x report TRACE --output FILE` | Render a self-contained HTML report; `--include-details` embeds the full capture, `--redact KEY` blanks named keys in it |
|
|
184
|
+
| `consequa-x summarize PATH... [--format markdown]` | Count outcomes, alignment and divergences across trace files, folders and `.jsonl` stores |
|
|
185
|
+
| `consequa-x compare A B` | Compare two traces action by action |
|
|
186
|
+
| `consequa-x verify TRACE --readback OBS --output NEW` | Verify a captured readback file with a built-in verifier |
|
|
187
|
+
| `consequa-x validate TRACE...` / `consequa-x migrate OLD --output NEW` | Check traces; convert schema `0.1` traces |
|
|
147
188
|
| `consequa-x experiment …` and research commands | Paired replay, decision attribution and calibration studies (see Research) |
|
|
148
189
|
|
|
149
190
|
## What it does not do
|
|
150
191
|
|
|
151
192
|
- It does not watch or control a live agent; your application captures the records.
|
|
193
|
+
`retry_advice` is advice derived from captured evidence, not a guarantee.
|
|
152
194
|
- It does not authenticate a readback source or prove that provider metadata is true.
|
|
153
195
|
- An evidence-graph link records provenance, not causal necessity.
|
|
154
196
|
- Default reports omit captured strings and identifiers, but keep times, counts
|
|
@@ -157,8 +199,8 @@ page lists what version 1 guarantees.
|
|
|
157
199
|
|
|
158
200
|
## Research
|
|
159
201
|
|
|
160
|
-
The repository also contains declared research interfaces,
|
|
161
|
-
|
|
202
|
+
The repository also contains declared research interfaces, imported from
|
|
203
|
+
`consequa_x.research`: isolated replay, contrastive and Shapley-style decision attribution,
|
|
162
204
|
calibration studies, an optional local Ollama adapter, and the retained evidence
|
|
163
205
|
for each study. Results so far are synthetic or exploratory local-model studies
|
|
164
206
|
and are reported with their denominators and limits. Start with the
|