briefloop 0.11.12__py3-none-any.whl
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.
- briefloop-0.11.12.dist-info/METADATA +473 -0
- briefloop-0.11.12.dist-info/RECORD +424 -0
- briefloop-0.11.12.dist-info/WHEEL +5 -0
- briefloop-0.11.12.dist-info/entry_points.txt +3 -0
- briefloop-0.11.12.dist-info/licenses/LICENSE +22 -0
- briefloop-0.11.12.dist-info/top_level.txt +1 -0
- multi_agent_brief/__init__.py +36 -0
- multi_agent_brief/analysis_blocks/__init__.py +11 -0
- multi_agent_brief/analysis_blocks/builder.py +206 -0
- multi_agent_brief/analysis_blocks/renderer.py +237 -0
- multi_agent_brief/analysis_blocks/schemas.py +52 -0
- multi_agent_brief/analysis_modules/__init__.py +8 -0
- multi_agent_brief/analysis_modules/base.py +87 -0
- multi_agent_brief/analysis_modules/market_competitor/__init__.py +68 -0
- multi_agent_brief/analysis_modules/market_competitor/auditor.py +290 -0
- multi_agent_brief/analysis_modules/market_competitor/config.py +187 -0
- multi_agent_brief/analysis_modules/market_competitor/event_builder.py +226 -0
- multi_agent_brief/analysis_modules/market_competitor/renderer.py +199 -0
- multi_agent_brief/analysis_modules/market_competitor/schemas.py +518 -0
- multi_agent_brief/analysis_modules/policy_regulatory/__init__.py +7 -0
- multi_agent_brief/analysis_modules/policy_regulatory/audit.py +195 -0
- multi_agent_brief/analysis_modules/policy_regulatory/module.py +387 -0
- multi_agent_brief/analysis_modules/policy_regulatory/schemas.py +129 -0
- multi_agent_brief/analysis_modules/registry.py +73 -0
- multi_agent_brief/audience/__init__.py +19 -0
- multi_agent_brief/audience/profiles.py +246 -0
- multi_agent_brief/audience_memory/__init__.py +23 -0
- multi_agent_brief/audience_memory/profile.py +358 -0
- multi_agent_brief/audit/__init__.py +36 -0
- multi_agent_brief/audit/case_applicability.py +181 -0
- multi_agent_brief/audit/deterministic.py +471 -0
- multi_agent_brief/audit/editorial_governance.py +404 -0
- multi_agent_brief/audit/final_quality.py +764 -0
- multi_agent_brief/audit/harness.py +242 -0
- multi_agent_brief/audit/interfaces.py +96 -0
- multi_agent_brief/audit/limitation_hygiene.py +238 -0
- multi_agent_brief/audit/proposal_boundary.py +34 -0
- multi_agent_brief/audit/redaction.py +27 -0
- multi_agent_brief/audit/rule_packs.py +96 -0
- multi_agent_brief/audit/semantic.py +435 -0
- multi_agent_brief/capabilities/__init__.py +22 -0
- multi_agent_brief/capabilities/catalog.py +215 -0
- multi_agent_brief/capabilities/detect.py +199 -0
- multi_agent_brief/capabilities/models.py +60 -0
- multi_agent_brief/capabilities/recommend.py +206 -0
- multi_agent_brief/cli/__init__.py +2 -0
- multi_agent_brief/cli/analysis_commands.py +140 -0
- multi_agent_brief/cli/approval_commands.py +107 -0
- multi_agent_brief/cli/audit_commands.py +59 -0
- multi_agent_brief/cli/capability_commands.py +548 -0
- multi_agent_brief/cli/claude_commands.py +159 -0
- multi_agent_brief/cli/competitors_commands.py +182 -0
- multi_agent_brief/cli/controls_commands.py +137 -0
- multi_agent_brief/cli/deliver_commands.py +942 -0
- multi_agent_brief/cli/eval_cases_commands.py +99 -0
- multi_agent_brief/cli/experiments_commands.py +395 -0
- multi_agent_brief/cli/feedback_commands.py +192 -0
- multi_agent_brief/cli/finalize_commands.py +153 -0
- multi_agent_brief/cli/gates_commands.py +174 -0
- multi_agent_brief/cli/hermes_commands.py +356 -0
- multi_agent_brief/cli/improve_commands.py +224 -0
- multi_agent_brief/cli/init_commands.py +564 -0
- multi_agent_brief/cli/init_wizard.py +1473 -0
- multi_agent_brief/cli/input_commands.py +237 -0
- multi_agent_brief/cli/main.py +288 -0
- multi_agent_brief/cli/onboard_commands.py +193 -0
- multi_agent_brief/cli/product_commands.py +1449 -0
- multi_agent_brief/cli/provenance_commands.py +100 -0
- multi_agent_brief/cli/release_commands.py +68 -0
- multi_agent_brief/cli/repair_commands.py +169 -0
- multi_agent_brief/cli/run_commands.py +292 -0
- multi_agent_brief/cli/runtime_commands.py +81 -0
- multi_agent_brief/cli/secrets_commands.py +232 -0
- multi_agent_brief/cli/semantic_support_commands.py +80 -0
- multi_agent_brief/cli/sources_commands.py +647 -0
- multi_agent_brief/cli/start_commands.py +8 -0
- multi_agent_brief/cli/state_commands.py +446 -0
- multi_agent_brief/cli/status_commands.py +26 -0
- multi_agent_brief/cli/workbuddy_commands.py +103 -0
- multi_agent_brief/configs/artifact_contracts.yaml +514 -0
- multi_agent_brief/configs/orchestrator_contract.yaml +181 -0
- multi_agent_brief/configs/policy_packs/default.yaml +65 -0
- multi_agent_brief/configs/policy_profiles/evidence_extract_default.yaml +58 -0
- multi_agent_brief/configs/policy_profiles/finance_default.yaml +44 -0
- multi_agent_brief/configs/policy_profiles/internet_default.yaml +44 -0
- multi_agent_brief/configs/policy_profiles/manufacturing_default.yaml +33 -0
- multi_agent_brief/configs/policy_profiles/solar_manufacturing_default.yaml +64 -0
- multi_agent_brief/configs/report_packs/evidence_extract.yaml +48 -0
- multi_agent_brief/configs/report_packs/management_monthly.yaml +36 -0
- multi_agent_brief/configs/report_packs/market_weekly.yaml +36 -0
- multi_agent_brief/configs/report_packs/solar_industry_periodic.yaml +50 -0
- multi_agent_brief/configs/report_templates/evidence_extract.yaml +55 -0
- multi_agent_brief/configs/report_templates/management_monthly.yaml +48 -0
- multi_agent_brief/configs/report_templates/market_weekly.yaml +49 -0
- multi_agent_brief/configs/report_templates/solar_industry_periodic.yaml +75 -0
- multi_agent_brief/configs/stage_specs.yaml +180 -0
- multi_agent_brief/contracts/__init__.py +41 -0
- multi_agent_brief/contracts/base.py +99 -0
- multi_agent_brief/contracts/errors.py +41 -0
- multi_agent_brief/contracts/migrations/__init__.py +5 -0
- multi_agent_brief/contracts/migrations/claim_v1_to_v2.py +33 -0
- multi_agent_brief/contracts/registry.py +159 -0
- multi_agent_brief/contracts/role_topology.py +25 -0
- multi_agent_brief/contracts/schemas/__init__.py +35 -0
- multi_agent_brief/contracts/schemas/analysis_pack.py +135 -0
- multi_agent_brief/contracts/schemas/atomic_claim_graph.py +304 -0
- multi_agent_brief/contracts/schemas/audit_report.py +80 -0
- multi_agent_brief/contracts/schemas/candidate_item.py +51 -0
- multi_agent_brief/contracts/schemas/claim.py +197 -0
- multi_agent_brief/contracts/schemas/claim_draft.py +386 -0
- multi_agent_brief/contracts/schemas/claim_support_matrix.py +334 -0
- multi_agent_brief/contracts/schemas/evidence_span_registry.py +270 -0
- multi_agent_brief/contracts/schemas/policy_profile.py +247 -0
- multi_agent_brief/contracts/schemas/report_spec.py +257 -0
- multi_agent_brief/contracts/schemas/semantic_assessment_report.py +480 -0
- multi_agent_brief/contracts/schemas/source_evidence_pack_manifest.py +233 -0
- multi_agent_brief/contracts/schemas/source_item.py +96 -0
- multi_agent_brief/contracts/semantic_assessment_status.py +12 -0
- multi_agent_brief/contracts/source_metadata.py +252 -0
- multi_agent_brief/contracts/target_contract.py +460 -0
- multi_agent_brief/contracts/validator.py +225 -0
- multi_agent_brief/controls/__init__.py +23 -0
- multi_agent_brief/controls/contract.py +106 -0
- multi_agent_brief/controls/switchboard.py +1076 -0
- multi_agent_brief/core/__init__.py +2 -0
- multi_agent_brief/core/citations.py +14 -0
- multi_agent_brief/core/claim_ledger.py +94 -0
- multi_agent_brief/core/config.py +191 -0
- multi_agent_brief/core/env.py +69 -0
- multi_agent_brief/core/previous.py +83 -0
- multi_agent_brief/core/schemas.py +181 -0
- multi_agent_brief/core/selection.py +189 -0
- multi_agent_brief/delivery/__init__.py +6 -0
- multi_agent_brief/delivery/base.py +36 -0
- multi_agent_brief/delivery/feishu.py +204 -0
- multi_agent_brief/delivery/gws.py +237 -0
- multi_agent_brief/evaluation_cases/__init__.py +15 -0
- multi_agent_brief/evaluation_cases/contract.py +429 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/config.yaml +18 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/improvement/ledger.jsonl +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/company_event_missing_latest_official_check/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/company_event_missing_latest_official_check/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/company_event_missing_latest_official_check/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/control_switchboard_selection_is_not_execution/workspace/config.yaml +12 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/control_switchboard_selection_is_not_execution/workspace/sources.yaml +6 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/control_switchboard_selection_is_not_execution/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/config.yaml +6 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/input/human_feedback.md +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/config.yaml +8 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/brief.md +14 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/audit_report.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/audited_brief.md +5 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/candidate_claims.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/claim_ledger.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/screened_candidates.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/formal_release_missing_human_approval/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/formal_release_missing_human_approval/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/formal_release_missing_human_approval/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/guidance_manifestation_not_observable/workspace/config.yaml +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/guidance_manifestation_not_observable/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/guidance_manifestation_not_observable/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/media_only_legal_policy_blocks_research_review/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/media_only_legal_policy_blocks_research_review/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/media_only_legal_policy_blocks_research_review/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/mixed_metric_scope_support_blocker/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/mixed_metric_scope_support_blocker/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/mixed_metric_scope_support_blocker/workspace/user.md +5 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/config.yaml +6 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/audited_brief.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/candidate_claims.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/claim_ledger.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/feedback_issues.json +25 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/repair_plan.json +27 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/screened_candidates.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/config.yaml +8 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/audit_report.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/audited_brief.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/candidate_claims.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/claim_ledger.json +11 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/quality_gate_report.json +22 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/screened_candidates.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/audit_report.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/audited_brief.md +5 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/candidate_claims.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/claim_ledger.json +40 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/screened_candidates.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/sources.yaml +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/config.yaml +8 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/brief.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/audit_report.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/audited_brief.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/candidate_claims.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/claim_ledger.json +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/screened_candidates.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/output/intermediate/release_readiness_report.json +31 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/config.yaml +18 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/improvement/ledger.jsonl +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/improvement/memory.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/output/intermediate/improvement_memory_snapshot.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/config.yaml +12 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/input/sources/source-001.txt +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/brief.md +37 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/delivery/brief.md +37 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/atomic_claim_graph.json +17 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/audit_report.json +5 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/audited_brief.md +37 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/claim_ledger.json +20 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/evidence_span_registry.json +20 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/finalize_report.json +40 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/gates/auditor_quality_gate_report.json +42 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/gates/finalize_quality_gate_report.json +42 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/screened_candidates.json +33 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/source_appendix.md +12 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/source_appendix_trace.md +10 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/report_spec.yaml +24 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/sources.yaml +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/input/sources/README.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/output/intermediate/source_evidence_pack_manifest.json +26 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/config.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/audit_report.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/audited_brief.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/candidate_claims.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/claim_ledger.json +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/screened_candidates.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/third_party_price_snapshot_formal_block/workspace/config.yaml +13 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/third_party_price_snapshot_formal_block/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/third_party_price_snapshot_formal_block/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/trajectory_retry_budget_exhausted/workspace/config.yaml +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/trajectory_retry_budget_exhausted/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/trajectory_retry_budget_exhausted/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/config.yaml +18 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/improvement/ledger.jsonl +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/user.md +4 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unauthorized_institution_branding_blocks_release/workspace/config.yaml +18 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unauthorized_institution_branding_blocks_release/workspace/sources.yaml +9 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unauthorized_institution_branding_blocks_release/workspace/user.md +5 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/config.yaml +8 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/audit_report.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/audited_brief.md +8 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/candidate_claims.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/claim_ledger.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/screened_candidates.json +1 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/sources.yaml +2 -0
- multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/user.md +3 -0
- multi_agent_brief/evaluation_cases/fixtures/manifest.yaml +861 -0
- multi_agent_brief/evaluation_cases/fixtures.py +20 -0
- multi_agent_brief/evaluation_cases/runner.py +1603 -0
- multi_agent_brief/experiments/__init__.py +45 -0
- multi_agent_brief/experiments/experiment_080.py +5835 -0
- multi_agent_brief/experiments/schemas.py +63 -0
- multi_agent_brief/experiments/target_contract.py +10 -0
- multi_agent_brief/feedback/__init__.py +17 -0
- multi_agent_brief/feedback/feedback_contract.py +482 -0
- multi_agent_brief/feedback/feedback_state.py +898 -0
- multi_agent_brief/hermes/__init__.py +25 -0
- multi_agent_brief/hermes/adapter.py +832 -0
- multi_agent_brief/improvement/__init__.py +83 -0
- multi_agent_brief/improvement/contract.py +1114 -0
- multi_agent_brief/improvement/memory.py +451 -0
- multi_agent_brief/improvement/product_definition.py +228 -0
- multi_agent_brief/improvement/state.py +961 -0
- multi_agent_brief/inputs/__init__.py +2 -0
- multi_agent_brief/inputs/classifier.py +322 -0
- multi_agent_brief/inputs/contracts.py +59 -0
- multi_agent_brief/inputs/extractor.py +310 -0
- multi_agent_brief/install/__init__.py +2 -0
- multi_agent_brief/install/writer.py +97 -0
- multi_agent_brief/onboarding/__init__.py +11 -0
- multi_agent_brief/onboarding/io.py +103 -0
- multi_agent_brief/onboarding/mapper.py +484 -0
- multi_agent_brief/onboarding/schema.py +46 -0
- multi_agent_brief/orchestrator/__init__.py +2 -0
- multi_agent_brief/orchestrator/fact_layer_import.py +352 -0
- multi_agent_brief/orchestrator/handoff.py +2209 -0
- multi_agent_brief/orchestrator/role_topology.py +42 -0
- multi_agent_brief/orchestrator/run_archive.py +888 -0
- multi_agent_brief/orchestrator/run_integrity.py +346 -0
- multi_agent_brief/orchestrator/runtime_state/__init__.py +70 -0
- multi_agent_brief/orchestrator/runtime_state/_io.py +167 -0
- multi_agent_brief/orchestrator/runtime_state/_transactions.py +298 -0
- multi_agent_brief/orchestrator/runtime_state/artifact_registry.py +1825 -0
- multi_agent_brief/orchestrator/runtime_state/atomic_claim_graph.py +96 -0
- multi_agent_brief/orchestrator/runtime_state/claim_ledger_freeze.py +510 -0
- multi_agent_brief/orchestrator/runtime_state/claim_metadata_enrichment.py +836 -0
- multi_agent_brief/orchestrator/runtime_state/claim_support_matrix.py +582 -0
- multi_agent_brief/orchestrator/runtime_state/completion_gates.py +672 -0
- multi_agent_brief/orchestrator/runtime_state/contracts_loader.py +66 -0
- multi_agent_brief/orchestrator/runtime_state/decisions.py +239 -0
- multi_agent_brief/orchestrator/runtime_state/errors.py +61 -0
- multi_agent_brief/orchestrator/runtime_state/event_log.py +256 -0
- multi_agent_brief/orchestrator/runtime_state/evidence_span_registry.py +233 -0
- multi_agent_brief/orchestrator/runtime_state/fact_layer.py +755 -0
- multi_agent_brief/orchestrator/runtime_state/identity.py +90 -0
- multi_agent_brief/orchestrator/runtime_state/lifecycle.py +675 -0
- multi_agent_brief/orchestrator/runtime_state/manifest.py +82 -0
- multi_agent_brief/orchestrator/runtime_state/operations.py +224 -0
- multi_agent_brief/orchestrator/runtime_state/paths.py +38 -0
- multi_agent_brief/orchestrator/runtime_state/repair.py +984 -0
- multi_agent_brief/orchestrator/runtime_state/safety_surfaces.py +147 -0
- multi_agent_brief/orchestrator/runtime_state/semantic_assessment_report.py +692 -0
- multi_agent_brief/orchestrator/runtime_state/semantic_support_acceptance.py +683 -0
- multi_agent_brief/orchestrator/runtime_state/source_evidence_pack.py +131 -0
- multi_agent_brief/orchestrator/runtime_state/stage_completion.py +1320 -0
- multi_agent_brief/orchestrator/runtime_state/trajectory.py +200 -0
- multi_agent_brief/orchestrator/runtime_state/workflow.py +350 -0
- multi_agent_brief/orchestrator/source_evidence.py +43 -0
- multi_agent_brief/orchestrator/timing.py +410 -0
- multi_agent_brief/orchestrator_contract.py +96 -0
- multi_agent_brief/outputs/__init__.py +2 -0
- multi_agent_brief/outputs/atomic_reader_projection.py +288 -0
- multi_agent_brief/outputs/docx.py +32 -0
- multi_agent_brief/outputs/finalize.py +1036 -0
- multi_agent_brief/outputs/ib_docx.py +983 -0
- multi_agent_brief/outputs/naming.py +38 -0
- multi_agent_brief/outputs/pdf.py +20 -0
- multi_agent_brief/outputs/reader_final_gate.py +509 -0
- multi_agent_brief/outputs/reader_projection.py +397 -0
- multi_agent_brief/outputs/source_appendix.py +753 -0
- multi_agent_brief/outputs/templates/__init__.py +112 -0
- multi_agent_brief/product/__init__.py +49 -0
- multi_agent_brief/product/bundle_projection.py +686 -0
- multi_agent_brief/product/citation_profile.py +145 -0
- multi_agent_brief/product/guidance_manifestation.py +421 -0
- multi_agent_brief/product/materiality_selection.py +472 -0
- multi_agent_brief/product/policy_gate_adapter.py +116 -0
- multi_agent_brief/product/policy_profile.py +39 -0
- multi_agent_brief/product/policy_projection.py +161 -0
- multi_agent_brief/product/policy_registry.py +83 -0
- multi_agent_brief/product/policy_resolver.py +225 -0
- multi_agent_brief/product/quality_closeout.py +188 -0
- multi_agent_brief/product/quality_panel.py +2217 -0
- multi_agent_brief/product/release_approval.py +1034 -0
- multi_agent_brief/product/report_pack.py +130 -0
- multi_agent_brief/product/report_pack_aliases.py +68 -0
- multi_agent_brief/product/report_registry.py +101 -0
- multi_agent_brief/product/report_spec.py +181 -0
- multi_agent_brief/product/support_wording.py +525 -0
- multi_agent_brief/product/template_conformance.py +516 -0
- multi_agent_brief/product/template_projection.py +123 -0
- multi_agent_brief/product/template_registry.py +244 -0
- multi_agent_brief/product/template_render_plan.py +315 -0
- multi_agent_brief/product/template_renderer.py +224 -0
- multi_agent_brief/product/trajectory_regulation.py +441 -0
- multi_agent_brief/provenance/__init__.py +5 -0
- multi_agent_brief/provenance/builder.py +841 -0
- multi_agent_brief/provenance/contract.py +21 -0
- multi_agent_brief/provenance/io.py +144 -0
- multi_agent_brief/provenance/model.py +110 -0
- multi_agent_brief/provenance/references.py +43 -0
- multi_agent_brief/provenance/validator.py +135 -0
- multi_agent_brief/quality_gates/__init__.py +19 -0
- multi_agent_brief/quality_gates/contract.py +581 -0
- multi_agent_brief/quality_gates/state.py +2498 -0
- multi_agent_brief/repair/__init__.py +5 -0
- multi_agent_brief/repair/router.py +842 -0
- multi_agent_brief/runtime_assets.py +431 -0
- multi_agent_brief/sources/__init__.py +16 -0
- multi_agent_brief/sources/api_filings.py +236 -0
- multi_agent_brief/sources/api_news.py +174 -0
- multi_agent_brief/sources/base.py +142 -0
- multi_agent_brief/sources/cached_package.py +119 -0
- multi_agent_brief/sources/cli_provider.py +263 -0
- multi_agent_brief/sources/coverage.py +336 -0
- multi_agent_brief/sources/decider.py +756 -0
- multi_agent_brief/sources/doctor.py +373 -0
- multi_agent_brief/sources/evidence_pack.py +364 -0
- multi_agent_brief/sources/feishu_provider.py +326 -0
- multi_agent_brief/sources/filing_resolver.py +400 -0
- multi_agent_brief/sources/industry_packs.py +130 -0
- multi_agent_brief/sources/join.py +206 -0
- multi_agent_brief/sources/local_signal.py +81 -0
- multi_agent_brief/sources/local_signal_planner.py +636 -0
- multi_agent_brief/sources/manual.py +259 -0
- multi_agent_brief/sources/mcp_provider.py +309 -0
- multi_agent_brief/sources/mineru_provider.py +601 -0
- multi_agent_brief/sources/normalizer.py +95 -0
- multi_agent_brief/sources/opencli_provider.py +282 -0
- multi_agent_brief/sources/planner.py +178 -0
- multi_agent_brief/sources/registry.py +367 -0
- multi_agent_brief/sources/rss.py +190 -0
- multi_agent_brief/sources/search_backends/__init__.py +31 -0
- multi_agent_brief/sources/search_backends/base.py +51 -0
- multi_agent_brief/sources/search_backends/brave.py +192 -0
- multi_agent_brief/sources/search_backends/capabilities.py +94 -0
- multi_agent_brief/sources/search_backends/exa.py +180 -0
- multi_agent_brief/sources/search_backends/firecrawl.py +164 -0
- multi_agent_brief/sources/search_backends/serper.py +241 -0
- multi_agent_brief/sources/search_backends/tavily.py +124 -0
- multi_agent_brief/sources/sourcehub.py +505 -0
- multi_agent_brief/sources/web_search.py +267 -0
- multi_agent_brief/status.py +966 -0
- multi_agent_brief/tools/__init__.py +3 -0
- multi_agent_brief/tools/draft_cleanup.py +198 -0
- multi_agent_brief/workbuddy/__init__.py +1 -0
- multi_agent_brief/workbuddy/diagnose.py +569 -0
- multi_agent_brief/workbuddy/skill_pack.py +309 -0
- multi_agent_brief/workspace/__init__.py +1 -0
- multi_agent_brief/workspace/init_profile.py +45 -0
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
"""Contract for experimental Semantic Assessment Report artifacts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from typing import Any, ClassVar
|
|
7
|
+
|
|
8
|
+
from multi_agent_brief.contracts.base import Contract, SchemaRegistry
|
|
9
|
+
from multi_agent_brief.contracts.errors import FieldViolation
|
|
10
|
+
from multi_agent_brief.contracts.schemas.claim_support_matrix import VALID_SUPPORT_LABELS
|
|
11
|
+
|
|
12
|
+
SEMANTIC_ASSESSMENT_REPORT_SCHEMA_VERSION = "mabw.semantic_assessment_report.v1"
|
|
13
|
+
SEMANTIC_ASSESSMENT_ROW_ID_RE = re.compile(r"^SAR-\d{4}$")
|
|
14
|
+
CLAIM_ID_RE = re.compile(r"^CL-(\d{4})$")
|
|
15
|
+
ATOM_ID_RE = re.compile(r"^AC-(\d{4})-\d{2}$")
|
|
16
|
+
EVIDENCE_SPAN_ID_RE = re.compile(r"^ESP-\d{3,4}-\d{2}$")
|
|
17
|
+
SHA256_RE = re.compile(r"^[0-9a-f]{64}$")
|
|
18
|
+
CHECKED_INPUT_KEYS = {
|
|
19
|
+
"audited_brief",
|
|
20
|
+
"claim_ledger",
|
|
21
|
+
"atomic_claim_graph",
|
|
22
|
+
"evidence_span_registry",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
VALID_ASSESSMENT_METHODS = {
|
|
26
|
+
"human",
|
|
27
|
+
"llm_assisted_human",
|
|
28
|
+
"llm_only",
|
|
29
|
+
"deterministic_policy",
|
|
30
|
+
"imported",
|
|
31
|
+
"unknown",
|
|
32
|
+
}
|
|
33
|
+
VALID_UNCERTAINTY_LEVELS = {"low", "medium", "high", "unknown"}
|
|
34
|
+
VALID_DISAGREEMENT_LEVELS = {"none", "low", "medium", "high", "unknown"}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@SchemaRegistry.register
|
|
38
|
+
class SemanticAssessmentReportContract(Contract):
|
|
39
|
+
"""Validate semantic support assessment proposal reports.
|
|
40
|
+
|
|
41
|
+
This contract validates report shape, IDs, assessor metadata, and support
|
|
42
|
+
label vocabulary only. It does not judge truth, mutate the Claim-Support
|
|
43
|
+
Matrix, create adjudication queue items, or grant release authority.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
schema_id: ClassVar[str] = "semantic_assessment_report"
|
|
47
|
+
schema_version: ClassVar[str] = "v1"
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def json_schema(cls) -> dict[str, Any]:
|
|
51
|
+
return {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"required": ["schema_version", "assessors", "rows"],
|
|
54
|
+
"properties": {
|
|
55
|
+
"schema_version": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"enum": [SEMANTIC_ASSESSMENT_REPORT_SCHEMA_VERSION],
|
|
58
|
+
},
|
|
59
|
+
"assessors": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"minItems": 1,
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"required": ["assessor_id", "assessment_method"],
|
|
65
|
+
"properties": {
|
|
66
|
+
"assessor_id": {"type": "string"},
|
|
67
|
+
"assessment_method": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"enum": sorted(VALID_ASSESSMENT_METHODS),
|
|
70
|
+
},
|
|
71
|
+
"label": {"type": "string"},
|
|
72
|
+
"metadata": {"type": "object"},
|
|
73
|
+
},
|
|
74
|
+
"additionalProperties": True,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
"rows": {
|
|
78
|
+
"type": "array",
|
|
79
|
+
"minItems": 1,
|
|
80
|
+
"items": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"required": [
|
|
83
|
+
"row_id",
|
|
84
|
+
"claim_id",
|
|
85
|
+
"atom_id",
|
|
86
|
+
"proposed_support_label",
|
|
87
|
+
"confidence",
|
|
88
|
+
"uncertainty",
|
|
89
|
+
"disagreement",
|
|
90
|
+
"requires_human_adjudication",
|
|
91
|
+
"assessment_method",
|
|
92
|
+
"assessor_id",
|
|
93
|
+
"rationale",
|
|
94
|
+
],
|
|
95
|
+
"anyOf": [
|
|
96
|
+
{"required": ["evidence_span_id"]},
|
|
97
|
+
{"required": ["candidate_evidence_span_ids"]},
|
|
98
|
+
],
|
|
99
|
+
"properties": {
|
|
100
|
+
"row_id": {"type": "string", "pattern": SEMANTIC_ASSESSMENT_ROW_ID_RE.pattern},
|
|
101
|
+
"claim_id": {"type": "string", "pattern": CLAIM_ID_RE.pattern},
|
|
102
|
+
"atom_id": {"type": "string", "pattern": ATOM_ID_RE.pattern},
|
|
103
|
+
"evidence_span_id": {"type": "string", "pattern": EVIDENCE_SPAN_ID_RE.pattern},
|
|
104
|
+
"candidate_evidence_span_ids": {
|
|
105
|
+
"type": "array",
|
|
106
|
+
"minItems": 1,
|
|
107
|
+
"items": {"type": "string", "pattern": EVIDENCE_SPAN_ID_RE.pattern},
|
|
108
|
+
},
|
|
109
|
+
"proposed_support_label": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"enum": sorted(VALID_SUPPORT_LABELS),
|
|
112
|
+
},
|
|
113
|
+
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
|
114
|
+
"uncertainty": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"enum": sorted(VALID_UNCERTAINTY_LEVELS),
|
|
117
|
+
},
|
|
118
|
+
"disagreement": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"enum": sorted(VALID_DISAGREEMENT_LEVELS),
|
|
121
|
+
},
|
|
122
|
+
"requires_human_adjudication": {"type": "boolean"},
|
|
123
|
+
"assessment_method": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"enum": sorted(VALID_ASSESSMENT_METHODS),
|
|
126
|
+
},
|
|
127
|
+
"assessor_id": {"type": "string"},
|
|
128
|
+
"rationale": {"type": "string"},
|
|
129
|
+
"metadata": {"type": "object"},
|
|
130
|
+
},
|
|
131
|
+
"additionalProperties": True,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
"metadata": {"type": "object"},
|
|
135
|
+
"checked_inputs": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"required": sorted(CHECKED_INPUT_KEYS),
|
|
138
|
+
"properties": {
|
|
139
|
+
key: {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"required": ["path", "sha256", "size_bytes"],
|
|
142
|
+
"properties": {
|
|
143
|
+
"path": {"type": "string"},
|
|
144
|
+
"sha256": {"type": "string", "pattern": SHA256_RE.pattern},
|
|
145
|
+
"size_bytes": {"type": "integer", "minimum": 0},
|
|
146
|
+
},
|
|
147
|
+
"additionalProperties": False,
|
|
148
|
+
}
|
|
149
|
+
for key in sorted(CHECKED_INPUT_KEYS)
|
|
150
|
+
},
|
|
151
|
+
"additionalProperties": False,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
"additionalProperties": True,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@classmethod
|
|
158
|
+
def validate(cls, data: dict[str, Any]) -> list[FieldViolation]:
|
|
159
|
+
if not isinstance(data, dict):
|
|
160
|
+
return [FieldViolation(field="<root>", error="must be an object")]
|
|
161
|
+
|
|
162
|
+
violations: list[FieldViolation] = []
|
|
163
|
+
schema_version = data.get("schema_version")
|
|
164
|
+
if not _non_empty_string(schema_version):
|
|
165
|
+
violations.append(FieldViolation(field="schema_version", error="required field is missing"))
|
|
166
|
+
elif schema_version != SEMANTIC_ASSESSMENT_REPORT_SCHEMA_VERSION:
|
|
167
|
+
violations.append(
|
|
168
|
+
FieldViolation(
|
|
169
|
+
field="schema_version",
|
|
170
|
+
error=f"must be {SEMANTIC_ASSESSMENT_REPORT_SCHEMA_VERSION}",
|
|
171
|
+
)
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
metadata = data.get("metadata")
|
|
175
|
+
if metadata is not None and not isinstance(metadata, dict):
|
|
176
|
+
violations.append(FieldViolation(field="metadata", error="must be an object"))
|
|
177
|
+
|
|
178
|
+
violations.extend(_validate_checked_inputs(data.get("checked_inputs")))
|
|
179
|
+
|
|
180
|
+
declared_assessor_ids: set[str] = set()
|
|
181
|
+
declared_assessor_methods: dict[str, str] = {}
|
|
182
|
+
assessors = data.get("assessors")
|
|
183
|
+
if not isinstance(assessors, list):
|
|
184
|
+
violations.append(FieldViolation(field="assessors", error="must be a non-empty list"))
|
|
185
|
+
elif not assessors:
|
|
186
|
+
violations.append(FieldViolation(field="assessors", error="must be a non-empty list"))
|
|
187
|
+
else:
|
|
188
|
+
for idx, assessor in enumerate(assessors):
|
|
189
|
+
violations.extend(
|
|
190
|
+
_validate_assessor_entry(
|
|
191
|
+
assessor,
|
|
192
|
+
idx=idx,
|
|
193
|
+
seen_assessor_ids=declared_assessor_ids,
|
|
194
|
+
declared_assessor_methods=declared_assessor_methods,
|
|
195
|
+
)
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
rows = data.get("rows")
|
|
199
|
+
if not isinstance(rows, list):
|
|
200
|
+
violations.append(FieldViolation(field="rows", error="must be a non-empty list"))
|
|
201
|
+
return violations
|
|
202
|
+
if not rows:
|
|
203
|
+
violations.append(FieldViolation(field="rows", error="must be a non-empty list"))
|
|
204
|
+
|
|
205
|
+
seen_row_ids: set[str] = set()
|
|
206
|
+
for idx, row in enumerate(rows):
|
|
207
|
+
violations.extend(
|
|
208
|
+
_validate_row_entry(
|
|
209
|
+
row,
|
|
210
|
+
idx=idx,
|
|
211
|
+
seen_row_ids=seen_row_ids,
|
|
212
|
+
declared_assessor_ids=declared_assessor_ids,
|
|
213
|
+
declared_assessor_methods=declared_assessor_methods,
|
|
214
|
+
)
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
return violations
|
|
218
|
+
|
|
219
|
+
@classmethod
|
|
220
|
+
def migrate(cls, data: dict[str, Any], from_version: str) -> dict[str, Any]:
|
|
221
|
+
return dict(data)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def _validate_checked_inputs(value: Any) -> list[FieldViolation]:
|
|
225
|
+
if value is None:
|
|
226
|
+
return []
|
|
227
|
+
if not isinstance(value, dict):
|
|
228
|
+
return [FieldViolation(field="checked_inputs", error="must be an object")]
|
|
229
|
+
violations: list[FieldViolation] = []
|
|
230
|
+
keys = set(value)
|
|
231
|
+
for key in sorted(CHECKED_INPUT_KEYS - keys):
|
|
232
|
+
violations.append(FieldViolation(field=f"checked_inputs.{key}", error="required field is missing"))
|
|
233
|
+
for key in sorted(keys - CHECKED_INPUT_KEYS):
|
|
234
|
+
violations.append(FieldViolation(field=f"checked_inputs.{key}", error="unsupported checked input"))
|
|
235
|
+
for key in sorted(CHECKED_INPUT_KEYS & keys):
|
|
236
|
+
entry = value.get(key)
|
|
237
|
+
prefix = f"checked_inputs.{key}"
|
|
238
|
+
if not isinstance(entry, dict):
|
|
239
|
+
violations.append(FieldViolation(field=prefix, error="must be an object"))
|
|
240
|
+
continue
|
|
241
|
+
path = entry.get("path")
|
|
242
|
+
if not _non_empty_string(path):
|
|
243
|
+
violations.append(FieldViolation(field=f"{prefix}.path", error="must be a non-empty string"))
|
|
244
|
+
sha256 = entry.get("sha256")
|
|
245
|
+
if not _non_empty_string(sha256) or not SHA256_RE.match(str(sha256).strip()):
|
|
246
|
+
violations.append(FieldViolation(field=f"{prefix}.sha256", error="must be 64 lowercase hex characters"))
|
|
247
|
+
size_bytes = entry.get("size_bytes")
|
|
248
|
+
if not isinstance(size_bytes, int) or isinstance(size_bytes, bool) or size_bytes < 0:
|
|
249
|
+
violations.append(FieldViolation(field=f"{prefix}.size_bytes", error="must be a non-negative integer"))
|
|
250
|
+
return violations
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def _validate_assessor_entry(
|
|
254
|
+
assessor: Any,
|
|
255
|
+
*,
|
|
256
|
+
idx: int,
|
|
257
|
+
seen_assessor_ids: set[str],
|
|
258
|
+
declared_assessor_methods: dict[str, str],
|
|
259
|
+
) -> list[FieldViolation]:
|
|
260
|
+
prefix = f"assessors[{idx}]"
|
|
261
|
+
violations: list[FieldViolation] = []
|
|
262
|
+
if not isinstance(assessor, dict):
|
|
263
|
+
return [FieldViolation(field=prefix, error="must be an object")]
|
|
264
|
+
|
|
265
|
+
assessor_id = assessor.get("assessor_id")
|
|
266
|
+
if not _non_empty_string(assessor_id):
|
|
267
|
+
violations.append(FieldViolation(field=f"{prefix}.assessor_id", error="must be a non-empty string"))
|
|
268
|
+
else:
|
|
269
|
+
normalized = str(assessor_id).strip()
|
|
270
|
+
if normalized in seen_assessor_ids:
|
|
271
|
+
violations.append(FieldViolation(field=f"{prefix}.assessor_id", error=f"duplicate assessor_id:{normalized}"))
|
|
272
|
+
seen_assessor_ids.add(normalized)
|
|
273
|
+
|
|
274
|
+
assessment_method = assessor.get("assessment_method")
|
|
275
|
+
_validate_enum_field(
|
|
276
|
+
assessor,
|
|
277
|
+
field="assessment_method",
|
|
278
|
+
prefix=prefix,
|
|
279
|
+
allowed=VALID_ASSESSMENT_METHODS,
|
|
280
|
+
violations=violations,
|
|
281
|
+
)
|
|
282
|
+
if _non_empty_string(assessor_id) and isinstance(assessment_method, str):
|
|
283
|
+
normalized_assessor_id = str(assessor_id).strip()
|
|
284
|
+
normalized_method = assessment_method.strip()
|
|
285
|
+
if normalized_method in VALID_ASSESSMENT_METHODS and normalized_assessor_id not in declared_assessor_methods:
|
|
286
|
+
declared_assessor_methods[normalized_assessor_id] = normalized_method
|
|
287
|
+
|
|
288
|
+
metadata = assessor.get("metadata")
|
|
289
|
+
if metadata is not None and not isinstance(metadata, dict):
|
|
290
|
+
violations.append(FieldViolation(field=f"{prefix}.metadata", error="must be an object"))
|
|
291
|
+
|
|
292
|
+
return violations
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def _validate_row_entry(
|
|
296
|
+
row: Any,
|
|
297
|
+
*,
|
|
298
|
+
idx: int,
|
|
299
|
+
seen_row_ids: set[str],
|
|
300
|
+
declared_assessor_ids: set[str],
|
|
301
|
+
declared_assessor_methods: dict[str, str],
|
|
302
|
+
) -> list[FieldViolation]:
|
|
303
|
+
prefix = f"rows[{idx}]"
|
|
304
|
+
violations: list[FieldViolation] = []
|
|
305
|
+
if not isinstance(row, dict):
|
|
306
|
+
return [FieldViolation(field=prefix, error="must be an object")]
|
|
307
|
+
|
|
308
|
+
row_id = row.get("row_id")
|
|
309
|
+
if not _non_empty_string(row_id) or not SEMANTIC_ASSESSMENT_ROW_ID_RE.match(str(row_id).strip()):
|
|
310
|
+
violations.append(FieldViolation(field=f"{prefix}.row_id", error="must match SAR-####"))
|
|
311
|
+
else:
|
|
312
|
+
normalized_row_id = str(row_id).strip()
|
|
313
|
+
if normalized_row_id in seen_row_ids:
|
|
314
|
+
violations.append(FieldViolation(field=f"{prefix}.row_id", error=f"duplicate row_id:{normalized_row_id}"))
|
|
315
|
+
seen_row_ids.add(normalized_row_id)
|
|
316
|
+
|
|
317
|
+
atom_id = row.get("atom_id")
|
|
318
|
+
atom_match = ATOM_ID_RE.match(atom_id.strip()) if _non_empty_string(atom_id) else None
|
|
319
|
+
if not atom_match:
|
|
320
|
+
violations.append(FieldViolation(field=f"{prefix}.atom_id", error="must match AC-####-##"))
|
|
321
|
+
|
|
322
|
+
claim_id = row.get("claim_id")
|
|
323
|
+
claim_match = CLAIM_ID_RE.match(claim_id.strip()) if _non_empty_string(claim_id) else None
|
|
324
|
+
if not claim_match:
|
|
325
|
+
violations.append(FieldViolation(field=f"{prefix}.claim_id", error="must match CL-####"))
|
|
326
|
+
elif atom_match and atom_match.group(1) != claim_match.group(1):
|
|
327
|
+
violations.append(
|
|
328
|
+
FieldViolation(
|
|
329
|
+
field=f"{prefix}.atom_id",
|
|
330
|
+
error=f"must use AC-{claim_match.group(1)}-## for matching claim_id",
|
|
331
|
+
)
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
violations.extend(_validate_evidence_span_binding(row, prefix=prefix))
|
|
335
|
+
|
|
336
|
+
_validate_enum_field(
|
|
337
|
+
row,
|
|
338
|
+
field="proposed_support_label",
|
|
339
|
+
prefix=prefix,
|
|
340
|
+
allowed=VALID_SUPPORT_LABELS,
|
|
341
|
+
violations=violations,
|
|
342
|
+
)
|
|
343
|
+
_validate_number_field(row, field="confidence", prefix=prefix, violations=violations)
|
|
344
|
+
_validate_enum_field(
|
|
345
|
+
row,
|
|
346
|
+
field="uncertainty",
|
|
347
|
+
prefix=prefix,
|
|
348
|
+
allowed=VALID_UNCERTAINTY_LEVELS,
|
|
349
|
+
violations=violations,
|
|
350
|
+
)
|
|
351
|
+
_validate_enum_field(
|
|
352
|
+
row,
|
|
353
|
+
field="disagreement",
|
|
354
|
+
prefix=prefix,
|
|
355
|
+
allowed=VALID_DISAGREEMENT_LEVELS,
|
|
356
|
+
violations=violations,
|
|
357
|
+
)
|
|
358
|
+
_validate_enum_field(
|
|
359
|
+
row,
|
|
360
|
+
field="assessment_method",
|
|
361
|
+
prefix=prefix,
|
|
362
|
+
allowed=VALID_ASSESSMENT_METHODS,
|
|
363
|
+
violations=violations,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
assessor_id = row.get("assessor_id")
|
|
367
|
+
normalized_assessor_id = ""
|
|
368
|
+
if not _non_empty_string(assessor_id):
|
|
369
|
+
violations.append(FieldViolation(field=f"{prefix}.assessor_id", error="must be a non-empty string"))
|
|
370
|
+
else:
|
|
371
|
+
normalized_assessor_id = str(assessor_id).strip()
|
|
372
|
+
if normalized_assessor_id not in declared_assessor_ids:
|
|
373
|
+
violations.append(
|
|
374
|
+
FieldViolation(
|
|
375
|
+
field=f"{prefix}.assessor_id",
|
|
376
|
+
error=f"unknown assessor_id:{normalized_assessor_id}",
|
|
377
|
+
)
|
|
378
|
+
)
|
|
379
|
+
row_method = row.get("assessment_method")
|
|
380
|
+
declared_method = declared_assessor_methods.get(normalized_assessor_id)
|
|
381
|
+
if isinstance(row_method, str) and declared_method and row_method.strip() != declared_method:
|
|
382
|
+
violations.append(
|
|
383
|
+
FieldViolation(
|
|
384
|
+
field=f"{prefix}.assessment_method",
|
|
385
|
+
error=f"must match assessor_id:{normalized_assessor_id} assessment_method:{declared_method}",
|
|
386
|
+
)
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
if not isinstance(row.get("requires_human_adjudication"), bool):
|
|
390
|
+
violations.append(FieldViolation(field=f"{prefix}.requires_human_adjudication", error="must be a boolean flag"))
|
|
391
|
+
if not _non_empty_string(row.get("rationale")):
|
|
392
|
+
violations.append(FieldViolation(field=f"{prefix}.rationale", error="must be a non-empty string"))
|
|
393
|
+
|
|
394
|
+
metadata = row.get("metadata")
|
|
395
|
+
if metadata is not None and not isinstance(metadata, dict):
|
|
396
|
+
violations.append(FieldViolation(field=f"{prefix}.metadata", error="must be an object"))
|
|
397
|
+
|
|
398
|
+
return violations
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def _validate_evidence_span_binding(row: dict[str, Any], *, prefix: str) -> list[FieldViolation]:
|
|
402
|
+
violations: list[FieldViolation] = []
|
|
403
|
+
has_single = "evidence_span_id" in row and row.get("evidence_span_id") is not None
|
|
404
|
+
has_candidates = "candidate_evidence_span_ids" in row
|
|
405
|
+
|
|
406
|
+
if not has_single and not has_candidates:
|
|
407
|
+
return [
|
|
408
|
+
FieldViolation(
|
|
409
|
+
field=f"{prefix}.evidence_span_binding",
|
|
410
|
+
error="requires evidence_span_id or candidate_evidence_span_ids",
|
|
411
|
+
)
|
|
412
|
+
]
|
|
413
|
+
|
|
414
|
+
if "evidence_span_id" in row:
|
|
415
|
+
value = row.get("evidence_span_id")
|
|
416
|
+
if value is not None:
|
|
417
|
+
if not _non_empty_string(value):
|
|
418
|
+
violations.append(FieldViolation(field=f"{prefix}.evidence_span_id", error="must be a non-empty string"))
|
|
419
|
+
elif not EVIDENCE_SPAN_ID_RE.match(str(value).strip()):
|
|
420
|
+
violations.append(FieldViolation(field=f"{prefix}.evidence_span_id", error="must match ESP-###-##"))
|
|
421
|
+
|
|
422
|
+
if has_candidates:
|
|
423
|
+
candidates = row.get("candidate_evidence_span_ids")
|
|
424
|
+
if not isinstance(candidates, list) or not candidates:
|
|
425
|
+
violations.append(
|
|
426
|
+
FieldViolation(field=f"{prefix}.candidate_evidence_span_ids", error="must be a non-empty list")
|
|
427
|
+
)
|
|
428
|
+
else:
|
|
429
|
+
seen_candidates: set[str] = set()
|
|
430
|
+
for idx, candidate in enumerate(candidates):
|
|
431
|
+
field = f"{prefix}.candidate_evidence_span_ids[{idx}]"
|
|
432
|
+
if not _non_empty_string(candidate):
|
|
433
|
+
violations.append(FieldViolation(field=field, error="must be a non-empty string"))
|
|
434
|
+
continue
|
|
435
|
+
normalized = str(candidate).strip()
|
|
436
|
+
if not EVIDENCE_SPAN_ID_RE.match(normalized):
|
|
437
|
+
violations.append(FieldViolation(field=field, error="must match ESP-###-##"))
|
|
438
|
+
if normalized in seen_candidates:
|
|
439
|
+
violations.append(FieldViolation(field=field, error=f"duplicate evidence_span_id:{normalized}"))
|
|
440
|
+
seen_candidates.add(normalized)
|
|
441
|
+
|
|
442
|
+
return violations
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def _validate_number_field(
|
|
446
|
+
row: dict[str, Any],
|
|
447
|
+
*,
|
|
448
|
+
field: str,
|
|
449
|
+
prefix: str,
|
|
450
|
+
violations: list[FieldViolation],
|
|
451
|
+
) -> None:
|
|
452
|
+
value = row.get(field)
|
|
453
|
+
if not isinstance(value, (int, float)) or isinstance(value, bool):
|
|
454
|
+
violations.append(FieldViolation(field=f"{prefix}.{field}", error="must be a number from 0 to 1"))
|
|
455
|
+
elif value < 0 or value > 1:
|
|
456
|
+
violations.append(FieldViolation(field=f"{prefix}.{field}", error="must be between 0 and 1"))
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
def _validate_enum_field(
|
|
460
|
+
row: dict[str, Any],
|
|
461
|
+
*,
|
|
462
|
+
field: str,
|
|
463
|
+
prefix: str,
|
|
464
|
+
allowed: set[str],
|
|
465
|
+
violations: list[FieldViolation],
|
|
466
|
+
) -> None:
|
|
467
|
+
value = row.get(field)
|
|
468
|
+
if not _non_empty_string(value):
|
|
469
|
+
violations.append(FieldViolation(field=f"{prefix}.{field}", error="must be a non-empty string"))
|
|
470
|
+
elif value not in allowed:
|
|
471
|
+
violations.append(
|
|
472
|
+
FieldViolation(
|
|
473
|
+
field=f"{prefix}.{field}",
|
|
474
|
+
error=f"invalid {field} '{value}', must be one of {sorted(allowed)}",
|
|
475
|
+
)
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
def _non_empty_string(value: Any) -> bool:
|
|
480
|
+
return isinstance(value, str) and bool(value.strip())
|