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,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
DEFAULT_FILENAME_TEMPLATE = "{project_name}_{report_date}"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class _SafeFormatDict(dict[str, str]):
|
|
10
|
+
def __missing__(self, key: str) -> str:
|
|
11
|
+
return ""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def render_output_stem(
|
|
15
|
+
template: str,
|
|
16
|
+
tokens: dict[str, str],
|
|
17
|
+
*,
|
|
18
|
+
default_stem: str = "brief",
|
|
19
|
+
) -> str:
|
|
20
|
+
"""Render and sanitize a configured output filename stem."""
|
|
21
|
+
chosen_template = template or DEFAULT_FILENAME_TEMPLATE
|
|
22
|
+
try:
|
|
23
|
+
raw = chosen_template.format_map(_SafeFormatDict(tokens))
|
|
24
|
+
except ValueError:
|
|
25
|
+
raw = tokens.get("project_name") or default_stem
|
|
26
|
+
return sanitize_filename_stem(raw, default_stem=default_stem)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def sanitize_filename_stem(raw: str, *, default_stem: str = "brief") -> str:
|
|
30
|
+
"""Return a filesystem-safe filename stem while preserving readable text."""
|
|
31
|
+
stem = raw.rsplit(".", 1)[0] if raw.lower().endswith((".md", ".docx")) else raw
|
|
32
|
+
stem = re.sub(r'[<>:"/\\|?*\x00-\x1f]', "_", stem)
|
|
33
|
+
stem = re.sub(r"\s+", "_", stem)
|
|
34
|
+
stem = re.sub(r"_+", "_", stem)
|
|
35
|
+
stem = stem.strip(" ._")
|
|
36
|
+
if not stem:
|
|
37
|
+
stem = default_stem
|
|
38
|
+
return stem[:120].rstrip(" ._") or default_stem
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class PdfOutputRequest:
|
|
8
|
+
markdown_path: str
|
|
9
|
+
output_path: str
|
|
10
|
+
stylesheet_path: str = ""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PdfOutputAdapter:
|
|
14
|
+
"""Migration-track interface for PDF generation."""
|
|
15
|
+
|
|
16
|
+
name = "pdf"
|
|
17
|
+
|
|
18
|
+
def render(self, request: PdfOutputRequest) -> str:
|
|
19
|
+
raise RuntimeError("PDF output is a migration-track interface and is not implemented in the MVP.")
|
|
20
|
+
|
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from dataclasses import asdict, dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
FindingKind = Literal[
|
|
10
|
+
"src_marker",
|
|
11
|
+
"bare_claim_id",
|
|
12
|
+
"source_id",
|
|
13
|
+
"process_wording",
|
|
14
|
+
"blank_citation_row",
|
|
15
|
+
"local_path",
|
|
16
|
+
"debug_residue",
|
|
17
|
+
"atom_id",
|
|
18
|
+
"span_id",
|
|
19
|
+
"policy_forbidden_phrase",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
COUNT_KEYS = {
|
|
23
|
+
"src_marker": "src_marker_count",
|
|
24
|
+
"bare_claim_id": "bare_claim_id_count",
|
|
25
|
+
"source_id": "source_id_count",
|
|
26
|
+
"process_wording": "process_wording_count",
|
|
27
|
+
"blank_citation_row": "blank_citation_row_count",
|
|
28
|
+
"local_path": "local_path_count",
|
|
29
|
+
"debug_residue": "debug_residue_count",
|
|
30
|
+
"atom_id": "atom_id_count",
|
|
31
|
+
"span_id": "span_id_count",
|
|
32
|
+
"policy_forbidden_phrase": "policy_forbidden_phrase_count",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_SRC_MARKER_RE = re.compile(r"\[(?:src|source):[^\]]+\]", re.IGNORECASE)
|
|
36
|
+
_CLAIM_ID_RE = re.compile(
|
|
37
|
+
r"(?<![A-Za-z0-9_])(?:\[(?:CLM-\d{3,}|CL-\d{3,})\]|CLM-\d{3,}|CL-\d{3,}|(?:[A-Z][A-Z0-9]*_)?CLAIM_[A-Z0-9][A-Z0-9_-]*)(?![A-Za-z0-9_])"
|
|
38
|
+
)
|
|
39
|
+
_SOURCE_ID_RE = re.compile(
|
|
40
|
+
r"(?<![A-Za-z0-9_])(?:[A-Z][A-Z0-9]*_)?(?:SRC|SOURCE)_[A-Z0-9][A-Z0-9_-]*(?![A-Za-z0-9_])"
|
|
41
|
+
)
|
|
42
|
+
_CONTEXTUAL_SRC_ID_RE = re.compile(
|
|
43
|
+
r"(?i)(?:source[_\s-]*id|source\s+ref(?:erence)?|来源\s*ID|源\s*ID)[::\s`'\"]*(SRC-\d{3,})"
|
|
44
|
+
)
|
|
45
|
+
_LOCAL_PATH_RE = re.compile(r"(?:/Users/[^\s)]+|/mnt/data/[^\s)]+|file://[^\s)]+|[A-Za-z]:\\[^\s)]+)")
|
|
46
|
+
_DEBUG_RE = re.compile(r"\b(?:DEBUG|TRACE)\b")
|
|
47
|
+
_ATOM_ID_RE = re.compile(r"(?<![A-Za-z0-9_])AC-\d{4}-\d{2}(?![A-Za-z0-9_])")
|
|
48
|
+
_SPAN_ID_RE = re.compile(r"(?<![A-Za-z0-9_])ESP-\d{3,4}-\d{2}(?![A-Za-z0-9_])")
|
|
49
|
+
_ATOM_ID_WORDING_RE = re.compile(r"\batom(?:\s+|-)+ids?\b", re.IGNORECASE)
|
|
50
|
+
_HEADING_RE = re.compile(r"^(#{1,6})\s+(.+?)\s*$")
|
|
51
|
+
_TABLE_SEPARATOR_RE = re.compile(r"^\s*\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)+\|?\s*$")
|
|
52
|
+
|
|
53
|
+
_PROCESS_WORDINGS = [
|
|
54
|
+
"Analyst subagent",
|
|
55
|
+
"Auditor subagent",
|
|
56
|
+
"Claim Ledger",
|
|
57
|
+
"source appendix generated from cited Claim Ledger",
|
|
58
|
+
"Human review required before distribution",
|
|
59
|
+
"audited_brief",
|
|
60
|
+
"artifact_registry",
|
|
61
|
+
"workflow_state",
|
|
62
|
+
"quality_gate_report",
|
|
63
|
+
"runtime_manifest",
|
|
64
|
+
"agent_handoff",
|
|
65
|
+
"claim_ledger.json",
|
|
66
|
+
"finalize_report.json",
|
|
67
|
+
"atomic_claim_graph",
|
|
68
|
+
"Atomic Claim Graph",
|
|
69
|
+
"atom_id",
|
|
70
|
+
"事实账本",
|
|
71
|
+
"声明账本",
|
|
72
|
+
"分析师子代理",
|
|
73
|
+
"审计师子代理",
|
|
74
|
+
"审计员子代理",
|
|
75
|
+
"运行交接单",
|
|
76
|
+
"运行清单",
|
|
77
|
+
"工作流状态",
|
|
78
|
+
"产物注册表",
|
|
79
|
+
"质量门禁",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
_CITATION_SECTION_TITLES = [
|
|
83
|
+
"citation index",
|
|
84
|
+
"source index",
|
|
85
|
+
"citation table",
|
|
86
|
+
"references",
|
|
87
|
+
"来源索引",
|
|
88
|
+
"引用索引",
|
|
89
|
+
"来源表",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
_BLANK_CELL_VALUES = {"", "-", "--", "—", "n/a", "na", "null", "none", "无", "未提供", "unknown"}
|
|
93
|
+
_CITATION_ID_HEADERS = {
|
|
94
|
+
"id",
|
|
95
|
+
"claimid",
|
|
96
|
+
"sourceid",
|
|
97
|
+
"source",
|
|
98
|
+
"sourceref",
|
|
99
|
+
"sourcereference",
|
|
100
|
+
"citationid",
|
|
101
|
+
"citation",
|
|
102
|
+
"referenceid",
|
|
103
|
+
"reference",
|
|
104
|
+
"refid",
|
|
105
|
+
"ref",
|
|
106
|
+
"编号",
|
|
107
|
+
"来源",
|
|
108
|
+
"来源编号",
|
|
109
|
+
"来源id",
|
|
110
|
+
"引用",
|
|
111
|
+
"引用编号",
|
|
112
|
+
"引用id",
|
|
113
|
+
"证据编号",
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@dataclass(frozen=True)
|
|
118
|
+
class ReaderResidueFinding:
|
|
119
|
+
kind: FindingKind
|
|
120
|
+
text: str
|
|
121
|
+
line: int | None
|
|
122
|
+
artifact: str
|
|
123
|
+
message: str
|
|
124
|
+
|
|
125
|
+
def to_dict(self) -> dict[str, object]:
|
|
126
|
+
return asdict(self)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@dataclass(frozen=True)
|
|
130
|
+
class ReaderFinalGateResult:
|
|
131
|
+
status: Literal["pass", "fail"]
|
|
132
|
+
findings: list[ReaderResidueFinding]
|
|
133
|
+
counts: dict[str, int]
|
|
134
|
+
|
|
135
|
+
def to_report_dict(self) -> dict[str, object]:
|
|
136
|
+
payload: dict[str, object] = {"status": self.status}
|
|
137
|
+
payload.update(self.counts)
|
|
138
|
+
payload["sample_findings"] = [
|
|
139
|
+
finding.to_dict() for finding in self.findings[:10]
|
|
140
|
+
]
|
|
141
|
+
return payload
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def detect_reader_residue(
|
|
145
|
+
markdown: str,
|
|
146
|
+
artifact: str,
|
|
147
|
+
*,
|
|
148
|
+
allow_compliance_footer: bool = False,
|
|
149
|
+
forbidden_phrases: tuple[str, ...] | list[str] = (),
|
|
150
|
+
) -> ReaderFinalGateResult:
|
|
151
|
+
findings: list[ReaderResidueFinding] = []
|
|
152
|
+
in_citation_section = False
|
|
153
|
+
citation_table_header: list[str] | None = None
|
|
154
|
+
source_table_header: list[str] | None = None
|
|
155
|
+
|
|
156
|
+
for line_number, line in enumerate(markdown.splitlines(), start=1):
|
|
157
|
+
heading = _HEADING_RE.match(line)
|
|
158
|
+
if heading:
|
|
159
|
+
title = heading.group(2).strip().lower()
|
|
160
|
+
in_citation_section = any(marker in title for marker in _CITATION_SECTION_TITLES)
|
|
161
|
+
citation_table_header = None
|
|
162
|
+
source_table_header = None
|
|
163
|
+
|
|
164
|
+
_collect_regex_findings(
|
|
165
|
+
findings,
|
|
166
|
+
kind="src_marker",
|
|
167
|
+
regex=_SRC_MARKER_RE,
|
|
168
|
+
line=line,
|
|
169
|
+
line_number=line_number,
|
|
170
|
+
artifact=artifact,
|
|
171
|
+
message="Reader-facing output contains an internal source marker.",
|
|
172
|
+
)
|
|
173
|
+
_collect_regex_findings(
|
|
174
|
+
findings,
|
|
175
|
+
kind="bare_claim_id",
|
|
176
|
+
regex=_CLAIM_ID_RE,
|
|
177
|
+
line=line,
|
|
178
|
+
line_number=line_number,
|
|
179
|
+
artifact=artifact,
|
|
180
|
+
message="Reader-facing output contains a raw internal claim ID.",
|
|
181
|
+
)
|
|
182
|
+
_collect_regex_findings(
|
|
183
|
+
findings,
|
|
184
|
+
kind="source_id",
|
|
185
|
+
regex=_SOURCE_ID_RE,
|
|
186
|
+
line=line,
|
|
187
|
+
line_number=line_number,
|
|
188
|
+
artifact=artifact,
|
|
189
|
+
message="Reader-facing output contains a raw internal source ID.",
|
|
190
|
+
)
|
|
191
|
+
_collect_regex_findings(
|
|
192
|
+
findings,
|
|
193
|
+
kind="source_id",
|
|
194
|
+
regex=_CONTEXTUAL_SRC_ID_RE,
|
|
195
|
+
line=line,
|
|
196
|
+
line_number=line_number,
|
|
197
|
+
artifact=artifact,
|
|
198
|
+
message="Reader-facing output contains an internal source ID.",
|
|
199
|
+
)
|
|
200
|
+
_collect_regex_findings(
|
|
201
|
+
findings,
|
|
202
|
+
kind="local_path",
|
|
203
|
+
regex=_LOCAL_PATH_RE,
|
|
204
|
+
line=line,
|
|
205
|
+
line_number=line_number,
|
|
206
|
+
artifact=artifact,
|
|
207
|
+
message="Reader-facing output contains a local or file URL path.",
|
|
208
|
+
)
|
|
209
|
+
_collect_regex_findings(
|
|
210
|
+
findings,
|
|
211
|
+
kind="debug_residue",
|
|
212
|
+
regex=_DEBUG_RE,
|
|
213
|
+
line=line,
|
|
214
|
+
line_number=line_number,
|
|
215
|
+
artifact=artifact,
|
|
216
|
+
message="Reader-facing output contains debug or trace residue.",
|
|
217
|
+
)
|
|
218
|
+
_collect_regex_findings(
|
|
219
|
+
findings,
|
|
220
|
+
kind="atom_id",
|
|
221
|
+
regex=_ATOM_ID_RE,
|
|
222
|
+
line=line,
|
|
223
|
+
line_number=line_number,
|
|
224
|
+
artifact=artifact,
|
|
225
|
+
message="Reader-facing output contains an Atomic Claim Graph atom ID.",
|
|
226
|
+
)
|
|
227
|
+
_collect_regex_findings(
|
|
228
|
+
findings,
|
|
229
|
+
kind="span_id",
|
|
230
|
+
regex=_SPAN_ID_RE,
|
|
231
|
+
line=line,
|
|
232
|
+
line_number=line_number,
|
|
233
|
+
artifact=artifact,
|
|
234
|
+
message="Reader-facing output contains an Evidence Span Registry span ID.",
|
|
235
|
+
)
|
|
236
|
+
_collect_process_wording_findings(
|
|
237
|
+
findings,
|
|
238
|
+
line=line,
|
|
239
|
+
line_number=line_number,
|
|
240
|
+
artifact=artifact,
|
|
241
|
+
allow_compliance_footer=allow_compliance_footer,
|
|
242
|
+
)
|
|
243
|
+
_collect_policy_forbidden_phrase_findings(
|
|
244
|
+
findings,
|
|
245
|
+
line=line,
|
|
246
|
+
line_number=line_number,
|
|
247
|
+
artifact=artifact,
|
|
248
|
+
forbidden_phrases=forbidden_phrases,
|
|
249
|
+
)
|
|
250
|
+
cells = _table_cells(line)
|
|
251
|
+
if cells is None:
|
|
252
|
+
source_table_header = None
|
|
253
|
+
elif not _TABLE_SEPARATOR_RE.match(line.strip()):
|
|
254
|
+
if not in_citation_section:
|
|
255
|
+
if source_table_header is None:
|
|
256
|
+
if _has_citation_id_header(cells):
|
|
257
|
+
source_table_header = cells
|
|
258
|
+
elif _has_blank_citation_id_cell(source_table_header, cells):
|
|
259
|
+
findings.append(
|
|
260
|
+
ReaderResidueFinding(
|
|
261
|
+
kind="blank_citation_row",
|
|
262
|
+
text=_shorten(line.strip()),
|
|
263
|
+
line=line_number,
|
|
264
|
+
artifact=artifact,
|
|
265
|
+
message="Reader-facing table contains a blank source/reference cell.",
|
|
266
|
+
)
|
|
267
|
+
)
|
|
268
|
+
if in_citation_section:
|
|
269
|
+
if citation_table_header is None:
|
|
270
|
+
citation_table_header = cells
|
|
271
|
+
elif _is_blank_citation_row_cells(cells):
|
|
272
|
+
findings.append(
|
|
273
|
+
ReaderResidueFinding(
|
|
274
|
+
kind="blank_citation_row",
|
|
275
|
+
text=_shorten(line.strip()),
|
|
276
|
+
line=line_number,
|
|
277
|
+
artifact=artifact,
|
|
278
|
+
message="Reader-facing source or citation section contains a blank table row.",
|
|
279
|
+
)
|
|
280
|
+
)
|
|
281
|
+
elif _has_blank_citation_id_cell(citation_table_header, cells):
|
|
282
|
+
findings.append(
|
|
283
|
+
ReaderResidueFinding(
|
|
284
|
+
kind="blank_citation_row",
|
|
285
|
+
text=_shorten(line.strip()),
|
|
286
|
+
line=line_number,
|
|
287
|
+
artifact=artifact,
|
|
288
|
+
message="Reader-facing source or citation section contains a blank ID/source/reference cell.",
|
|
289
|
+
)
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
counts = _empty_counts()
|
|
293
|
+
for finding in findings:
|
|
294
|
+
counts[COUNT_KEYS[finding.kind]] += 1
|
|
295
|
+
return ReaderFinalGateResult(
|
|
296
|
+
status="fail" if findings else "pass",
|
|
297
|
+
findings=findings,
|
|
298
|
+
counts=counts,
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def detect_reader_residue_in_docx(
|
|
303
|
+
path: Path,
|
|
304
|
+
*,
|
|
305
|
+
artifact: str | None = None,
|
|
306
|
+
allow_compliance_footer: bool = False,
|
|
307
|
+
forbidden_phrases: tuple[str, ...] | list[str] = (),
|
|
308
|
+
) -> ReaderFinalGateResult:
|
|
309
|
+
try:
|
|
310
|
+
from docx import Document # type: ignore
|
|
311
|
+
except ImportError:
|
|
312
|
+
return ReaderFinalGateResult(status="pass", findings=[], counts=_empty_counts())
|
|
313
|
+
|
|
314
|
+
document = Document(str(path))
|
|
315
|
+
text = "\n".join(_docx_text_parts(document))
|
|
316
|
+
return detect_reader_residue(
|
|
317
|
+
text,
|
|
318
|
+
artifact=artifact or str(path),
|
|
319
|
+
allow_compliance_footer=allow_compliance_footer,
|
|
320
|
+
forbidden_phrases=forbidden_phrases,
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def combine_reader_final_gate_results(
|
|
325
|
+
results: list[ReaderFinalGateResult],
|
|
326
|
+
) -> ReaderFinalGateResult:
|
|
327
|
+
findings: list[ReaderResidueFinding] = []
|
|
328
|
+
counts = _empty_counts()
|
|
329
|
+
for result in results:
|
|
330
|
+
findings.extend(result.findings)
|
|
331
|
+
for key, value in result.counts.items():
|
|
332
|
+
counts[key] = counts.get(key, 0) + value
|
|
333
|
+
return ReaderFinalGateResult(
|
|
334
|
+
status="fail" if findings else "pass",
|
|
335
|
+
findings=findings,
|
|
336
|
+
counts=counts,
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def _docx_text_parts(document: object) -> list[str]:
|
|
341
|
+
parts: list[str] = []
|
|
342
|
+
parts.extend(paragraph.text for paragraph in document.paragraphs)
|
|
343
|
+
parts.extend(_table_text_parts(document.tables))
|
|
344
|
+
for section in document.sections:
|
|
345
|
+
for container in (
|
|
346
|
+
section.header,
|
|
347
|
+
section.first_page_header,
|
|
348
|
+
section.even_page_header,
|
|
349
|
+
section.footer,
|
|
350
|
+
section.first_page_footer,
|
|
351
|
+
section.even_page_footer,
|
|
352
|
+
):
|
|
353
|
+
parts.extend(paragraph.text for paragraph in container.paragraphs)
|
|
354
|
+
parts.extend(_table_text_parts(container.tables))
|
|
355
|
+
return parts
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def _table_text_parts(tables: object) -> list[str]:
|
|
359
|
+
return [
|
|
360
|
+
cell.text
|
|
361
|
+
for table in tables
|
|
362
|
+
for row in table.rows
|
|
363
|
+
for cell in row.cells
|
|
364
|
+
]
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def _collect_regex_findings(
|
|
368
|
+
findings: list[ReaderResidueFinding],
|
|
369
|
+
*,
|
|
370
|
+
kind: FindingKind,
|
|
371
|
+
regex: re.Pattern[str],
|
|
372
|
+
line: str,
|
|
373
|
+
line_number: int,
|
|
374
|
+
artifact: str,
|
|
375
|
+
message: str,
|
|
376
|
+
) -> None:
|
|
377
|
+
for match in regex.finditer(line):
|
|
378
|
+
text = match.group(0)
|
|
379
|
+
findings.append(
|
|
380
|
+
ReaderResidueFinding(
|
|
381
|
+
kind=kind,
|
|
382
|
+
text=_shorten(text),
|
|
383
|
+
line=line_number,
|
|
384
|
+
artifact=artifact,
|
|
385
|
+
message=message,
|
|
386
|
+
)
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def _collect_process_wording_findings(
|
|
391
|
+
findings: list[ReaderResidueFinding],
|
|
392
|
+
*,
|
|
393
|
+
line: str,
|
|
394
|
+
line_number: int,
|
|
395
|
+
artifact: str,
|
|
396
|
+
allow_compliance_footer: bool,
|
|
397
|
+
) -> None:
|
|
398
|
+
line_lower = line.lower()
|
|
399
|
+
for wording in _PROCESS_WORDINGS:
|
|
400
|
+
if wording == "Human review required before distribution" and allow_compliance_footer:
|
|
401
|
+
continue
|
|
402
|
+
found = wording in line if _has_cjk(wording) else wording.lower() in line_lower
|
|
403
|
+
if not found:
|
|
404
|
+
continue
|
|
405
|
+
findings.append(
|
|
406
|
+
ReaderResidueFinding(
|
|
407
|
+
kind="process_wording",
|
|
408
|
+
text=_shorten(wording),
|
|
409
|
+
line=line_number,
|
|
410
|
+
artifact=artifact,
|
|
411
|
+
message="Reader-facing output contains internal workflow/process wording.",
|
|
412
|
+
)
|
|
413
|
+
)
|
|
414
|
+
for match in _ATOM_ID_WORDING_RE.finditer(line):
|
|
415
|
+
findings.append(
|
|
416
|
+
ReaderResidueFinding(
|
|
417
|
+
kind="process_wording",
|
|
418
|
+
text=_shorten(match.group(0)),
|
|
419
|
+
line=line_number,
|
|
420
|
+
artifact=artifact,
|
|
421
|
+
message="Reader-facing output contains internal workflow/process wording.",
|
|
422
|
+
)
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def _collect_policy_forbidden_phrase_findings(
|
|
427
|
+
findings: list[ReaderResidueFinding],
|
|
428
|
+
*,
|
|
429
|
+
line: str,
|
|
430
|
+
line_number: int,
|
|
431
|
+
artifact: str,
|
|
432
|
+
forbidden_phrases: tuple[str, ...] | list[str],
|
|
433
|
+
) -> None:
|
|
434
|
+
line_lower = line.lower()
|
|
435
|
+
seen_on_line: set[str] = set()
|
|
436
|
+
for phrase in forbidden_phrases:
|
|
437
|
+
if not isinstance(phrase, str):
|
|
438
|
+
continue
|
|
439
|
+
text = " ".join(phrase.split()).strip()
|
|
440
|
+
if not text:
|
|
441
|
+
continue
|
|
442
|
+
key = text.lower()
|
|
443
|
+
if key in seen_on_line:
|
|
444
|
+
continue
|
|
445
|
+
found = text in line if _has_cjk(text) else key in line_lower
|
|
446
|
+
if not found:
|
|
447
|
+
continue
|
|
448
|
+
seen_on_line.add(key)
|
|
449
|
+
findings.append(
|
|
450
|
+
ReaderResidueFinding(
|
|
451
|
+
kind="policy_forbidden_phrase",
|
|
452
|
+
text=_shorten(text),
|
|
453
|
+
line=line_number,
|
|
454
|
+
artifact=artifact,
|
|
455
|
+
message="Reader-facing output contains a PolicyProfile forbidden phrase.",
|
|
456
|
+
)
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def _is_blank_citation_row(line: str) -> bool:
|
|
461
|
+
cells = _table_cells(line)
|
|
462
|
+
return bool(cells and _is_blank_citation_row_cells(cells))
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def _table_cells(line: str) -> list[str] | None:
|
|
466
|
+
stripped = line.strip()
|
|
467
|
+
if not (stripped.startswith("|") and stripped.endswith("|")):
|
|
468
|
+
return None
|
|
469
|
+
cells = [cell.strip() for cell in stripped.strip("|").split("|")]
|
|
470
|
+
if len(cells) < 2:
|
|
471
|
+
return None
|
|
472
|
+
return cells
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
def _is_blank_citation_row_cells(cells: list[str]) -> bool:
|
|
476
|
+
return all(cell.strip().lower() in _BLANK_CELL_VALUES for cell in cells)
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
def _has_blank_citation_id_cell(header_cells: list[str], row_cells: list[str]) -> bool:
|
|
480
|
+
for index, header in enumerate(header_cells):
|
|
481
|
+
if index >= len(row_cells):
|
|
482
|
+
continue
|
|
483
|
+
if _is_citation_id_header(header) and row_cells[index].strip().lower() in _BLANK_CELL_VALUES:
|
|
484
|
+
return True
|
|
485
|
+
return False
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
def _has_citation_id_header(header_cells: list[str]) -> bool:
|
|
489
|
+
return any(_is_citation_id_header(header) for header in header_cells)
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
def _is_citation_id_header(header: str) -> bool:
|
|
493
|
+
normalized = re.sub(r"[^a-z0-9\u4e00-\u9fff]+", "", header.strip().lower())
|
|
494
|
+
return normalized in _CITATION_ID_HEADERS
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def _empty_counts() -> dict[str, int]:
|
|
498
|
+
return {count_key: 0 for count_key in COUNT_KEYS.values()}
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
def _shorten(value: str, limit: int = 120) -> str:
|
|
502
|
+
compact = " ".join(str(value).split())
|
|
503
|
+
if len(compact) <= limit:
|
|
504
|
+
return compact
|
|
505
|
+
return compact[: limit - 1].rstrip() + "…"
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
def _has_cjk(value: str) -> bool:
|
|
509
|
+
return any("\u4e00" <= char <= "\u9fff" for char in value)
|