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,242 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from multi_agent_brief.audit.deterministic import SRC_REF_PATTERN
|
|
6
|
+
from multi_agent_brief.audit.interfaces import AuditAgentInterface
|
|
7
|
+
from multi_agent_brief.audit.rule_packs import tag_finding
|
|
8
|
+
from multi_agent_brief.core.claim_ledger import ClaimLedger
|
|
9
|
+
from multi_agent_brief.core.schemas import AuditFinding, AuditReport, PipelineContext
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
QUALITY_RULES: list[tuple[str, str, str, str]] = [
|
|
13
|
+
(
|
|
14
|
+
r"\bTBD\b|to be completed|待(?:完整文本)?(?:提取|补充)",
|
|
15
|
+
"placeholder_text",
|
|
16
|
+
"Draft contains placeholder text.",
|
|
17
|
+
"Replace placeholders with sourced content or remove the item.",
|
|
18
|
+
),
|
|
19
|
+
(
|
|
20
|
+
r"\b(?:Ledger|raw_text|Scout|Packet)\b|CAP类条目|T5级",
|
|
21
|
+
"internal_process_term",
|
|
22
|
+
"Draft contains internal workflow terminology.",
|
|
23
|
+
"Rewrite internal workflow language as reader-facing source context.",
|
|
24
|
+
),
|
|
25
|
+
(
|
|
26
|
+
r"Step\s*[0-9]",
|
|
27
|
+
"step_label_residue",
|
|
28
|
+
"Draft contains step labels that look like process residue.",
|
|
29
|
+
"Remove process labels before publication.",
|
|
30
|
+
),
|
|
31
|
+
(
|
|
32
|
+
r"(?:audit status|generated by|编制说明|审计状态|生成工具)\s*[::]",
|
|
33
|
+
"compilation_residue",
|
|
34
|
+
"Draft contains audit or generation metadata residue.",
|
|
35
|
+
"Remove generation metadata from the reader-facing brief.",
|
|
36
|
+
),
|
|
37
|
+
(
|
|
38
|
+
r"全面落地(?!.*\d{4}-\d{2}-\d{2})|最终规则明确(?!.*\d{4}-\d{2}-\d{2})|first invoked|首次动用",
|
|
39
|
+
"unsupported_certainty",
|
|
40
|
+
"Draft uses high-certainty policy wording without a date or sufficient support.",
|
|
41
|
+
"Add precise source/date support or weaken the claim.",
|
|
42
|
+
),
|
|
43
|
+
(
|
|
44
|
+
r"\b(buy|sell|strong buy|price target|trading signal)\b|买入评级|卖出评级|目标价|交易信号",
|
|
45
|
+
"investment_advice_language",
|
|
46
|
+
"Draft contains investment-advice style language.",
|
|
47
|
+
"Keep the brief analytical and non-advisory.",
|
|
48
|
+
),
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
NUMBER_PATTERN = re.compile(r"(?<!\[src:)(?<!\[)(?<!\w)(\$[\d,.]+|[\d.]+%(?!\w)|[\d.]+ ?(?:GW|GWh|MW|MWh|bps))")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _tag(finding_type: str, **kwargs) -> AuditFinding:
|
|
55
|
+
"""Create an AuditFinding with taxonomy tags from the rule pack."""
|
|
56
|
+
tax = tag_finding(finding_type)
|
|
57
|
+
return AuditFinding(
|
|
58
|
+
finding_type=finding_type,
|
|
59
|
+
blocking_level=tax["blocking_level"],
|
|
60
|
+
repair_owner=tax["repair_owner"],
|
|
61
|
+
**kwargs,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class QualityHarnessAuditAgent(AuditAgentInterface):
|
|
66
|
+
"""Generic quality harness ported from local workflow prototypes."""
|
|
67
|
+
|
|
68
|
+
name = "quality-harness-auditor"
|
|
69
|
+
|
|
70
|
+
def run_audit(
|
|
71
|
+
self,
|
|
72
|
+
markdown: str,
|
|
73
|
+
ledger: ClaimLedger,
|
|
74
|
+
context: PipelineContext | None = None,
|
|
75
|
+
) -> AuditReport:
|
|
76
|
+
findings: list[AuditFinding] = []
|
|
77
|
+
findings.extend(_empty_report_findings(markdown, ledger, context))
|
|
78
|
+
findings.extend(_regex_rule_findings(markdown))
|
|
79
|
+
findings.extend(_claim_gate_findings(markdown, ledger))
|
|
80
|
+
findings.extend(_source_density_findings(markdown))
|
|
81
|
+
findings.extend(_unit_guard_findings(markdown))
|
|
82
|
+
findings.extend(_repeat_summary_findings(markdown, ledger))
|
|
83
|
+
findings.extend(_stale_filler_findings(markdown))
|
|
84
|
+
return AuditReport(audit_status="pass", audit_score=100, findings=findings)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _empty_report_findings(
|
|
88
|
+
markdown: str,
|
|
89
|
+
ledger: ClaimLedger,
|
|
90
|
+
context: PipelineContext | None,
|
|
91
|
+
) -> list[AuditFinding]:
|
|
92
|
+
selection = context.metadata.get("selection", {}) if context else {}
|
|
93
|
+
quiet_week = bool(selection.get("quiet_week")) if selection else False
|
|
94
|
+
if len(ledger) > 0:
|
|
95
|
+
return []
|
|
96
|
+
if quiet_week and context and context.metadata.get("allow_empty_quiet_week") is True:
|
|
97
|
+
return []
|
|
98
|
+
if "No candidate claims were found." not in markdown and markdown.strip():
|
|
99
|
+
return []
|
|
100
|
+
return [
|
|
101
|
+
_tag(
|
|
102
|
+
"no_reportable_claims",
|
|
103
|
+
finding_id="EMPTY_001",
|
|
104
|
+
severity="high",
|
|
105
|
+
description="Pipeline produced a brief with zero reportable claims.",
|
|
106
|
+
recommendation="Add usable source inputs or explicitly mark this as an allowed empty quiet-week run.",
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _regex_rule_findings(markdown: str) -> list[AuditFinding]:
|
|
112
|
+
findings: list[AuditFinding] = []
|
|
113
|
+
for pattern, finding_type, description, recommendation in QUALITY_RULES:
|
|
114
|
+
for match in re.finditer(pattern, markdown, re.IGNORECASE | re.MULTILINE):
|
|
115
|
+
findings.append(
|
|
116
|
+
_tag(
|
|
117
|
+
finding_type,
|
|
118
|
+
finding_id=f"HARNESS_{len(findings)+1:03d}",
|
|
119
|
+
severity="high" if finding_type in {"placeholder_text", "investment_advice_language"} else "medium",
|
|
120
|
+
description=description,
|
|
121
|
+
recommendation=recommendation,
|
|
122
|
+
evidence=match.group(0),
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
return findings
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _claim_gate_findings(markdown: str, ledger: ClaimLedger) -> list[AuditFinding]:
|
|
129
|
+
findings: list[AuditFinding] = []
|
|
130
|
+
referenced_ids = {match.group(1) for match in SRC_REF_PATTERN.finditer(markdown)}
|
|
131
|
+
for claim_id in referenced_ids:
|
|
132
|
+
claim = ledger.get_claim(claim_id)
|
|
133
|
+
if claim is None:
|
|
134
|
+
continue
|
|
135
|
+
claim_type = claim.claim_type
|
|
136
|
+
source_tier = str(claim.metadata.get("source_tier", "") or "")
|
|
137
|
+
if claim_type == "needs_recrawl":
|
|
138
|
+
findings.append(
|
|
139
|
+
_tag(
|
|
140
|
+
"needs_recrawl_claim_used",
|
|
141
|
+
finding_id=f"RECRAWL_{len(findings)+1:03d}",
|
|
142
|
+
severity="high",
|
|
143
|
+
related_claim_id=claim_id,
|
|
144
|
+
description="A needs_recrawl claim is cited in the brief.",
|
|
145
|
+
recommendation="Remove the claim and recrawl the source before using it.",
|
|
146
|
+
evidence=claim.statement,
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
if source_tier == "T5":
|
|
150
|
+
findings.append(
|
|
151
|
+
_tag(
|
|
152
|
+
"low_confidence_source_used",
|
|
153
|
+
finding_id=f"TIER_{len(findings)+1:03d}",
|
|
154
|
+
severity="high",
|
|
155
|
+
related_claim_id=claim_id,
|
|
156
|
+
description="A T5 or low-confidence source is cited in the brief.",
|
|
157
|
+
recommendation="Replace it with a higher-tier source or remove the item.",
|
|
158
|
+
evidence=claim.statement,
|
|
159
|
+
)
|
|
160
|
+
)
|
|
161
|
+
return findings
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _source_density_findings(markdown: str) -> list[AuditFinding]:
|
|
165
|
+
numbers = NUMBER_PATTERN.findall(markdown)
|
|
166
|
+
refs = SRC_REF_PATTERN.findall(markdown)
|
|
167
|
+
if numbers and len(refs) < len(numbers) * 0.5:
|
|
168
|
+
return [
|
|
169
|
+
_tag(
|
|
170
|
+
"low_source_density",
|
|
171
|
+
finding_id="DENSITY_001",
|
|
172
|
+
severity="high",
|
|
173
|
+
description=f"Many number-like values lack source coverage: {len(numbers)} numbers, {len(refs)} source references.",
|
|
174
|
+
recommendation="Attach source references to key numbers or remove unsupported figures.",
|
|
175
|
+
evidence=", ".join(numbers[:10]),
|
|
176
|
+
)
|
|
177
|
+
]
|
|
178
|
+
return []
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _unit_guard_findings(markdown: str) -> list[AuditFinding]:
|
|
182
|
+
findings: list[AuditFinding] = []
|
|
183
|
+
for match in re.finditer(r"([0-9][0-9,]*(?:\.[0-9]+)?)\s*(?:千兆瓦时|GWh).{0,100}\[src:EIA_GEN_", markdown):
|
|
184
|
+
value = float(match.group(1).replace(",", ""))
|
|
185
|
+
if value > 1000:
|
|
186
|
+
findings.append(
|
|
187
|
+
_tag(
|
|
188
|
+
"possible_eia_unit_inflation",
|
|
189
|
+
finding_id=f"UNIT_{len(findings)+1:03d}",
|
|
190
|
+
severity="high",
|
|
191
|
+
description="EIA generation value may have been inflated from thousand MWh into GWh.",
|
|
192
|
+
recommendation="Check whether the source unit is thousand MWh; write the equivalent GWh correctly.",
|
|
193
|
+
evidence=match.group(0),
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
return findings
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _repeat_summary_findings(markdown: str, ledger: ClaimLedger) -> list[AuditFinding]:
|
|
200
|
+
summary = _section_between(markdown, "## Executive Summary", "\n## ")
|
|
201
|
+
if not summary:
|
|
202
|
+
return []
|
|
203
|
+
findings: list[AuditFinding] = []
|
|
204
|
+
for match in SRC_REF_PATTERN.finditer(summary):
|
|
205
|
+
claim = ledger.get_claim(match.group(1))
|
|
206
|
+
if claim and claim.metadata.get("repeat") is True:
|
|
207
|
+
findings.append(
|
|
208
|
+
_tag(
|
|
209
|
+
"repeat_claim_in_summary",
|
|
210
|
+
finding_id=f"REPEAT_{len(findings)+1:03d}",
|
|
211
|
+
severity="medium",
|
|
212
|
+
related_claim_id=claim.claim_id,
|
|
213
|
+
description="A repeated/background claim appears in the executive summary.",
|
|
214
|
+
recommendation="Keep executive summary focused on fresh report-window changes.",
|
|
215
|
+
evidence=claim.statement,
|
|
216
|
+
)
|
|
217
|
+
)
|
|
218
|
+
return findings
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def _stale_filler_findings(markdown: str) -> list[AuditFinding]:
|
|
222
|
+
hits = re.findall(r"本期无新增|暂无新增|无新增可核验|上期已覆盖|previously covered|no material update", markdown, re.IGNORECASE)
|
|
223
|
+
if len(hits) >= 3:
|
|
224
|
+
return [
|
|
225
|
+
_tag(
|
|
226
|
+
"stale_filler_language",
|
|
227
|
+
finding_id="FILLER_001",
|
|
228
|
+
severity="medium",
|
|
229
|
+
description=f"Brief contains {len(hits)} stale/no-update filler phrases.",
|
|
230
|
+
recommendation="Remove no-update filler sections unless they carry a specific decision impact.",
|
|
231
|
+
evidence=", ".join(hits[:10]),
|
|
232
|
+
)
|
|
233
|
+
]
|
|
234
|
+
return []
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def _section_between(content: str, start: str, end: str) -> str:
|
|
238
|
+
start_idx = content.find(start)
|
|
239
|
+
if start_idx < 0:
|
|
240
|
+
return ""
|
|
241
|
+
end_idx = content.find(end, start_idx + len(start))
|
|
242
|
+
return content[start_idx:end_idx if end_idx >= 0 else len(content)]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
|
|
5
|
+
from multi_agent_brief.audit.proposal_boundary import is_advisory_semantic_support_proposal
|
|
6
|
+
from multi_agent_brief.core.claim_ledger import ClaimLedger
|
|
7
|
+
from multi_agent_brief.core.schemas import AuditReport, PipelineContext
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AuditAgentInterface(ABC):
|
|
11
|
+
"""Backend interface used by the pipeline audit tool."""
|
|
12
|
+
|
|
13
|
+
name = "audit-agent"
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def run_audit(
|
|
17
|
+
self,
|
|
18
|
+
markdown: str,
|
|
19
|
+
ledger: ClaimLedger,
|
|
20
|
+
context: PipelineContext | None = None,
|
|
21
|
+
) -> AuditReport:
|
|
22
|
+
raise NotImplementedError
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CompositeAuditAgent(AuditAgentInterface):
|
|
26
|
+
"""Runs deterministic audit first, then optional semantic audit."""
|
|
27
|
+
|
|
28
|
+
name = "composite-auditor"
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
deterministic_agent: AuditAgentInterface,
|
|
33
|
+
additional_agents: list[AuditAgentInterface] | AuditAgentInterface | None = None,
|
|
34
|
+
semantic_agent: AuditAgentInterface | None = None,
|
|
35
|
+
) -> None:
|
|
36
|
+
if isinstance(additional_agents, AuditAgentInterface):
|
|
37
|
+
semantic_agent = additional_agents
|
|
38
|
+
additional_agents = None
|
|
39
|
+
self.deterministic_agent = deterministic_agent
|
|
40
|
+
self.additional_agents = additional_agents or []
|
|
41
|
+
self.semantic_agent = semantic_agent
|
|
42
|
+
|
|
43
|
+
def run_audit(
|
|
44
|
+
self,
|
|
45
|
+
markdown: str,
|
|
46
|
+
ledger: ClaimLedger,
|
|
47
|
+
context: PipelineContext | None = None,
|
|
48
|
+
) -> AuditReport:
|
|
49
|
+
report = self.deterministic_agent.run_audit(markdown, ledger, context)
|
|
50
|
+
report.metadata["deterministic_agent"] = self.deterministic_agent.name
|
|
51
|
+
|
|
52
|
+
additional_meta = []
|
|
53
|
+
for agent in self.additional_agents:
|
|
54
|
+
extra_report = agent.run_audit(markdown, ledger, context)
|
|
55
|
+
report.findings.extend(extra_report.findings)
|
|
56
|
+
additional_meta.append({"name": agent.name, "findings": len(extra_report.findings)})
|
|
57
|
+
report.metadata["additional_agents"] = additional_meta
|
|
58
|
+
|
|
59
|
+
if self.semantic_agent is None:
|
|
60
|
+
report.metadata["semantic_agent"] = "not_configured"
|
|
61
|
+
report.metadata["semantic_status"] = "not_configured"
|
|
62
|
+
return recompute_report_status(report)
|
|
63
|
+
|
|
64
|
+
semantic_report = self.semantic_agent.run_audit(markdown, ledger, context)
|
|
65
|
+
report.findings.extend(semantic_report.findings)
|
|
66
|
+
report.metadata["semantic_agent"] = self.semantic_agent.name
|
|
67
|
+
report.metadata["semantic_findings"] = len(semantic_report.findings)
|
|
68
|
+
# Propagate semantic_status from the semantic agent's report
|
|
69
|
+
report.metadata["semantic_status"] = semantic_report.metadata.get(
|
|
70
|
+
"semantic_status",
|
|
71
|
+
"pass" if semantic_report.audit_status == "pass" else semantic_report.audit_status,
|
|
72
|
+
)
|
|
73
|
+
return recompute_report_status(report)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def recompute_report_status(report: AuditReport) -> AuditReport:
|
|
77
|
+
# Advisory semantic-support proposals never affect audit status or score.
|
|
78
|
+
# They are model proposals, not authoritative audit findings; only a
|
|
79
|
+
# human-acceptance transaction can turn one into a workflow signal.
|
|
80
|
+
# Excluded by severity-aware rule: a proposal-typed finding that is NOT low
|
|
81
|
+
# severity is malformed/spoofed and fails closed (still scored).
|
|
82
|
+
scored = [
|
|
83
|
+
finding
|
|
84
|
+
for finding in report.findings
|
|
85
|
+
if not is_advisory_semantic_support_proposal(finding.finding_type, finding.severity)
|
|
86
|
+
]
|
|
87
|
+
high = sum(1 for finding in scored if finding.severity == "high")
|
|
88
|
+
medium = sum(1 for finding in scored if finding.severity == "medium")
|
|
89
|
+
if high:
|
|
90
|
+
report.audit_status = "fail"
|
|
91
|
+
elif medium:
|
|
92
|
+
report.audit_status = "warning"
|
|
93
|
+
else:
|
|
94
|
+
report.audit_status = "pass"
|
|
95
|
+
report.audit_score = max(0, 100 - high * 25 - medium * 10 - (len(scored) - high - medium) * 3)
|
|
96
|
+
return report
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"""Limitation Hygiene audit (v0.5.3 PR 4).
|
|
2
|
+
|
|
3
|
+
Compresses repeated disclaimers into a single Evidence Boundary section.
|
|
4
|
+
|
|
5
|
+
Rules:
|
|
6
|
+
1. Same limitation text repeated >2 times across claims → warning to consolidate.
|
|
7
|
+
2. Limitation without corresponding verification_path → warning/fail.
|
|
8
|
+
3. Boilerplate disclaimers ("not local data", "for reference only", etc.)
|
|
9
|
+
repeated >1 time → require consolidation into a single Evidence Boundary.
|
|
10
|
+
|
|
11
|
+
Output: limitation_hygiene_report.json
|
|
12
|
+
"""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from collections import Counter
|
|
16
|
+
from dataclasses import asdict, dataclass, field
|
|
17
|
+
from typing import Any
|
|
18
|
+
|
|
19
|
+
from multi_agent_brief.analysis_blocks.schemas import AnalysisBlock
|
|
20
|
+
from multi_agent_brief.core.claim_ledger import ClaimLedger
|
|
21
|
+
from multi_agent_brief.core.schemas import Claim
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Boilerplate phrases that add no information and should be consolidated.
|
|
25
|
+
# Each pattern must be specific enough to avoid false positives on legitimate
|
|
26
|
+
# limitations. Prefer multi-word phrases over single words / short substrings.
|
|
27
|
+
_BOILERPLATE_PATTERNS: list[str] = [
|
|
28
|
+
"not local data",
|
|
29
|
+
"for reference only",
|
|
30
|
+
"仅供参考",
|
|
31
|
+
"does not constitute",
|
|
32
|
+
"不构成投资建议",
|
|
33
|
+
"not investment advice",
|
|
34
|
+
"for informational purposes",
|
|
35
|
+
"仅供参考,不构成",
|
|
36
|
+
"may not be applicable",
|
|
37
|
+
"might not apply",
|
|
38
|
+
"needs verification",
|
|
39
|
+
"需要验证",
|
|
40
|
+
"subject to change",
|
|
41
|
+
"数据可能有误",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass
|
|
46
|
+
class LimitationFinding:
|
|
47
|
+
"""One limitation hygiene finding."""
|
|
48
|
+
|
|
49
|
+
finding_type: str
|
|
50
|
+
severity: str # "warning" or "fail"
|
|
51
|
+
block_id: str
|
|
52
|
+
description: str
|
|
53
|
+
recommendation: str
|
|
54
|
+
affected_claims: list[str] = field(default_factory=list)
|
|
55
|
+
repeated_text: str = ""
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass
|
|
59
|
+
class LimitationHygieneReport:
|
|
60
|
+
"""Summary report for limitation hygiene audit."""
|
|
61
|
+
|
|
62
|
+
findings: list[LimitationFinding] = field(default_factory=list)
|
|
63
|
+
total_limitations: int = 0
|
|
64
|
+
unique_limitations: int = 0
|
|
65
|
+
boilerplate_count: int = 0
|
|
66
|
+
consolidated_count: int = 0
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> dict[str, Any]:
|
|
69
|
+
data = asdict(self)
|
|
70
|
+
data["findings"] = [asdict(f) for f in self.findings]
|
|
71
|
+
return data
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def audit_limitation_hygiene(
|
|
75
|
+
blocks: list[AnalysisBlock],
|
|
76
|
+
ledger: ClaimLedger,
|
|
77
|
+
) -> LimitationHygieneReport:
|
|
78
|
+
"""Audit limitation hygiene across all analysis blocks."""
|
|
79
|
+
report = LimitationHygieneReport()
|
|
80
|
+
|
|
81
|
+
for block in blocks:
|
|
82
|
+
_check_repeated_limitations(block, ledger, report)
|
|
83
|
+
_check_boilerplate_limitations(block, ledger, report)
|
|
84
|
+
_check_limitation_verification(block, ledger, report)
|
|
85
|
+
|
|
86
|
+
return report
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _collect_limitations(
|
|
90
|
+
block: AnalysisBlock,
|
|
91
|
+
ledger: ClaimLedger,
|
|
92
|
+
) -> list[tuple[str, str]]:
|
|
93
|
+
"""Collect (normalized_text, claim_id) pairs from block limitations."""
|
|
94
|
+
pairs: list[tuple[str, str]] = []
|
|
95
|
+
for cid in block.limitation_claim_ids:
|
|
96
|
+
claim = ledger.get_claim(cid)
|
|
97
|
+
if not claim:
|
|
98
|
+
continue
|
|
99
|
+
for lim in claim.limitations:
|
|
100
|
+
normalized = " ".join(lim.lower().split())
|
|
101
|
+
pairs.append((normalized, cid))
|
|
102
|
+
return pairs
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _check_repeated_limitations(
|
|
106
|
+
block: AnalysisBlock,
|
|
107
|
+
ledger: ClaimLedger,
|
|
108
|
+
report: LimitationHygieneReport,
|
|
109
|
+
) -> None:
|
|
110
|
+
"""Rule 1: same limitation repeated >2 times → warning."""
|
|
111
|
+
pairs = _collect_limitations(block, ledger)
|
|
112
|
+
report.total_limitations += len(pairs)
|
|
113
|
+
|
|
114
|
+
counter: Counter[str] = Counter(text for text, _ in pairs)
|
|
115
|
+
report.unique_limitations += len(counter)
|
|
116
|
+
|
|
117
|
+
for text, count in counter.items():
|
|
118
|
+
if count > 2:
|
|
119
|
+
affected = [cid for t, cid in pairs if t == text]
|
|
120
|
+
report.findings.append(LimitationFinding(
|
|
121
|
+
finding_type="repeated_limitation",
|
|
122
|
+
severity="warning",
|
|
123
|
+
block_id=block.block_id,
|
|
124
|
+
description=(
|
|
125
|
+
f"Limitation repeated {count} times across claims "
|
|
126
|
+
f"{', '.join(affected[:3])}{'...' if len(affected) > 3 else ''}. "
|
|
127
|
+
"Consolidate into a single Evidence Boundary section."
|
|
128
|
+
),
|
|
129
|
+
recommendation="Merge duplicate limitations into one statement with a verification path.",
|
|
130
|
+
affected_claims=affected,
|
|
131
|
+
repeated_text=text,
|
|
132
|
+
))
|
|
133
|
+
report.consolidated_count += count - 1
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _check_boilerplate_limitations(
|
|
137
|
+
block: AnalysisBlock,
|
|
138
|
+
ledger: ClaimLedger,
|
|
139
|
+
report: LimitationHygieneReport,
|
|
140
|
+
) -> None:
|
|
141
|
+
"""Rule 3: boilerplate disclaimers repeated >1 time → consolidate."""
|
|
142
|
+
pairs = _collect_limitations(block, ledger)
|
|
143
|
+
|
|
144
|
+
boilerplate_hits: list[tuple[str, str]] = []
|
|
145
|
+
for text, cid in pairs:
|
|
146
|
+
if any(bp in text for bp in _BOILERPLATE_PATTERNS):
|
|
147
|
+
boilerplate_hits.append((text, cid))
|
|
148
|
+
|
|
149
|
+
report.boilerplate_count += len(boilerplate_hits)
|
|
150
|
+
|
|
151
|
+
if len(boilerplate_hits) > 1:
|
|
152
|
+
affected = list(set(cid for _, cid in boilerplate_hits))
|
|
153
|
+
report.findings.append(LimitationFinding(
|
|
154
|
+
finding_type="boilerplate_limitation",
|
|
155
|
+
severity="warning",
|
|
156
|
+
block_id=block.block_id,
|
|
157
|
+
description=(
|
|
158
|
+
f"{len(boilerplate_hits)} boilerplate disclaimers detected "
|
|
159
|
+
f"(e.g., 'for reference only', 'not local data'). "
|
|
160
|
+
"These add no information. Consolidate into one Evidence Boundary."
|
|
161
|
+
),
|
|
162
|
+
recommendation=(
|
|
163
|
+
"Replace repeated boilerplate with a single statement: "
|
|
164
|
+
"'Evidence boundary: [specific gap]. Verification path: [how to close gap].'"
|
|
165
|
+
),
|
|
166
|
+
affected_claims=affected,
|
|
167
|
+
))
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _check_limitation_verification(
|
|
171
|
+
block: AnalysisBlock,
|
|
172
|
+
ledger: ClaimLedger,
|
|
173
|
+
report: LimitationHygieneReport,
|
|
174
|
+
) -> None:
|
|
175
|
+
"""Rule 2: limitation without verification_path → warning."""
|
|
176
|
+
if not block.limitation_claim_ids:
|
|
177
|
+
return
|
|
178
|
+
if block.verification_path.strip():
|
|
179
|
+
return
|
|
180
|
+
|
|
181
|
+
# Check if any limitation claim has a non-boilerplate limitation
|
|
182
|
+
has_real_limitation = False
|
|
183
|
+
for cid in block.limitation_claim_ids:
|
|
184
|
+
claim = ledger.get_claim(cid)
|
|
185
|
+
if not claim:
|
|
186
|
+
continue
|
|
187
|
+
for lim in claim.limitations:
|
|
188
|
+
normalized = " ".join(lim.lower().split())
|
|
189
|
+
if not any(bp in normalized for bp in _BOILERPLATE_PATTERNS):
|
|
190
|
+
has_real_limitation = True
|
|
191
|
+
break
|
|
192
|
+
if has_real_limitation:
|
|
193
|
+
break
|
|
194
|
+
|
|
195
|
+
if has_real_limitation:
|
|
196
|
+
report.findings.append(LimitationFinding(
|
|
197
|
+
finding_type="missing_verification_path",
|
|
198
|
+
severity="warning",
|
|
199
|
+
block_id=block.block_id,
|
|
200
|
+
description=(
|
|
201
|
+
f"Block '{block.title}' has substantive limitations but no verification_path. "
|
|
202
|
+
"Limitations should describe what data to collect or how to verify."
|
|
203
|
+
),
|
|
204
|
+
recommendation="Add verification_path: describe the specific data source or check that would resolve the limitation.",
|
|
205
|
+
affected_claims=list(block.limitation_claim_ids),
|
|
206
|
+
))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def format_limitation_hygiene_report(report: LimitationHygieneReport) -> str:
|
|
210
|
+
"""Format report into readable text."""
|
|
211
|
+
lines = [
|
|
212
|
+
"Limitation Hygiene Report",
|
|
213
|
+
"=" * 25,
|
|
214
|
+
"",
|
|
215
|
+
f"Total limitations: {report.total_limitations}",
|
|
216
|
+
f"Unique limitations: {report.unique_limitations}",
|
|
217
|
+
f"Boilerplate disclaimers: {report.boilerplate_count}",
|
|
218
|
+
"",
|
|
219
|
+
]
|
|
220
|
+
|
|
221
|
+
if not report.findings:
|
|
222
|
+
lines.append("All limitation hygiene checks passed.")
|
|
223
|
+
return "\n".join(lines)
|
|
224
|
+
|
|
225
|
+
for f in report.findings:
|
|
226
|
+
icon = "❌" if f.severity == "fail" else "⚠️"
|
|
227
|
+
lines.append(f"{icon} [{f.severity.upper()}] {f.finding_type}")
|
|
228
|
+
lines.append(f" Block: {f.block_id}")
|
|
229
|
+
lines.append(f" {f.description}")
|
|
230
|
+
lines.append(f" → {f.recommendation}")
|
|
231
|
+
if f.repeated_text:
|
|
232
|
+
lines.append(f" Repeated: \"{f.repeated_text}\"")
|
|
233
|
+
lines.append("")
|
|
234
|
+
|
|
235
|
+
fails = sum(1 for f in report.findings if f.severity == "fail")
|
|
236
|
+
warns = sum(1 for f in report.findings if f.severity == "warning")
|
|
237
|
+
lines.append(f"Result: {fails} fail(s), {warns} warning(s)")
|
|
238
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Shared boundary rule for advisory semantic-support proposal findings.
|
|
2
|
+
|
|
3
|
+
This is a leaf module (it imports nothing from ``audit``) so every consumer —
|
|
4
|
+
the repair router, audit score/status recompute, and feedback ingest — can share
|
|
5
|
+
one definition of "this finding is an advisory proposal, keep it out of workflow
|
|
6
|
+
signals" without creating an import cycle with ``audit.semantic`` /
|
|
7
|
+
``audit.interfaces``.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
SEMANTIC_SUPPORT_PROPOSAL_FINDING_TYPE = "semantic_support_proposal"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def is_advisory_semantic_support_proposal(finding_type: Any, severity: Any) -> bool:
|
|
18
|
+
"""True only for adapter-produced advisory proposal findings.
|
|
19
|
+
|
|
20
|
+
The adapter always emits proposals at ``low`` severity. Consumers use this to
|
|
21
|
+
keep advisory proposals out of repair routes, audit score/status, and
|
|
22
|
+
feedback issues.
|
|
23
|
+
|
|
24
|
+
The severity check is deliberate: a finding whose ``finding_type`` is
|
|
25
|
+
``semantic_support_proposal`` but whose severity is NOT ``low`` is malformed
|
|
26
|
+
or spoofed. It is not treated as advisory and must fail closed — scored,
|
|
27
|
+
routed, and ingested like any other finding — rather than silently escaping
|
|
28
|
+
the workflow.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
str(finding_type or "").strip().lower() == SEMANTIC_SUPPORT_PROPOSAL_FINDING_TYPE
|
|
33
|
+
and str(severity or "").strip().lower() == "low"
|
|
34
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
REDACTION_PATTERNS: dict[str, re.Pattern[str]] = {
|
|
7
|
+
"email": re.compile(r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b"),
|
|
8
|
+
"api_key_hint": re.compile(r"(?i)\b(api[_-]?key|secret|token|webhook)\b\s*[:=]"),
|
|
9
|
+
"absolute_path": re.compile(r"(/Users/[^ \n]+|/Volumes/[^ \n]+|[A-Za-z]:\\[^ \n]+)"),
|
|
10
|
+
"private_ip": re.compile(r"\b(?:10|172\.(?:1[6-9]|2\d|3[01])|192\.168)\.\d{1,3}\.\d{1,3}\b"),
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def scan_redaction_risks(text: str) -> list[dict]:
|
|
15
|
+
findings: list[dict] = []
|
|
16
|
+
for risk_type, pattern in REDACTION_PATTERNS.items():
|
|
17
|
+
for match in pattern.finditer(text):
|
|
18
|
+
findings.append(
|
|
19
|
+
{
|
|
20
|
+
"type": risk_type,
|
|
21
|
+
"text": match.group(0)[:120],
|
|
22
|
+
"start": match.start(),
|
|
23
|
+
"severity": "high" if risk_type in {"api_key_hint", "absolute_path"} else "medium",
|
|
24
|
+
"recommendation": "Remove or replace before publishing.",
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
return findings
|