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,282 @@
|
|
|
1
|
+
"""OpenCLI source provider for user-authorized local/browser session signals."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
from hashlib import sha1
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from multi_agent_brief.sources.base import SourceItem, SourceProvider, SourceQuery
|
|
11
|
+
|
|
12
|
+
OPENCLI_DEFAULT_TIMEOUT = 60
|
|
13
|
+
|
|
14
|
+
READ_ONLY_COMMANDS: dict[str, set[str]] = {
|
|
15
|
+
"bilibili": {
|
|
16
|
+
"dynamic", "feed-detail", "following", "me", "ranking", "search",
|
|
17
|
+
"subtitle", "summary", "video", "comments", "user-videos",
|
|
18
|
+
},
|
|
19
|
+
"youtube": {
|
|
20
|
+
"channel", "comments", "feed", "history", "playlist", "search",
|
|
21
|
+
"subscriptions", "transcript", "video", "watch-later",
|
|
22
|
+
},
|
|
23
|
+
"zhihu": {
|
|
24
|
+
"answer-comments", "answer-detail", "collection", "collections",
|
|
25
|
+
"download", "hot", "question", "recommend", "search",
|
|
26
|
+
},
|
|
27
|
+
"xiaohongshu": {
|
|
28
|
+
"search", "note", "comments", "notifications", "feed", "user",
|
|
29
|
+
"creator-notes", "creator-note-detail", "creator-notes-summary",
|
|
30
|
+
"creator-profile", "creator-stats",
|
|
31
|
+
},
|
|
32
|
+
"reddit": {
|
|
33
|
+
"hot", "frontpage", "popular", "search", "subreddit", "read",
|
|
34
|
+
"user", "user-posts", "user-comments", "saved", "upvoted",
|
|
35
|
+
},
|
|
36
|
+
"twitter": {
|
|
37
|
+
"trending", "search", "timeline", "tweets", "lists", "list-tweets",
|
|
38
|
+
"bookmarks", "profile", "thread", "following", "followers",
|
|
39
|
+
"notifications", "likes", "article",
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
WRITE_LIKE_COMMANDS = {
|
|
44
|
+
"answer", "comment", "favorite", "follow", "like", "post", "publish",
|
|
45
|
+
"reply", "subscribe", "unfollow", "unlike", "unsubscribe", "delete",
|
|
46
|
+
"block", "unblock", "save", "upvote",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class OpenCliProvider(SourceProvider):
|
|
51
|
+
"""Collect source items by running configured read-only OpenCLI adapters.
|
|
52
|
+
|
|
53
|
+
Example ``sources.yaml``:
|
|
54
|
+
|
|
55
|
+
.. code-block:: yaml
|
|
56
|
+
|
|
57
|
+
source_strategy:
|
|
58
|
+
enabled_providers: [manual, opencli]
|
|
59
|
+
opencli:
|
|
60
|
+
enabled: true
|
|
61
|
+
commands:
|
|
62
|
+
- name: zhihu-hot
|
|
63
|
+
site: zhihu
|
|
64
|
+
command: hot
|
|
65
|
+
args: ["--limit", "5"]
|
|
66
|
+
- name: youtube-search
|
|
67
|
+
site: youtube
|
|
68
|
+
command: search
|
|
69
|
+
query_from_keywords: true
|
|
70
|
+
args: ["--limit", "5"]
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
name = "opencli"
|
|
74
|
+
source_type = "cli"
|
|
75
|
+
|
|
76
|
+
def validate_config(self, config: dict[str, Any]) -> list[str]:
|
|
77
|
+
if not config.get("enabled"):
|
|
78
|
+
return []
|
|
79
|
+
|
|
80
|
+
errors: list[str] = []
|
|
81
|
+
if not shutil.which("opencli"):
|
|
82
|
+
errors.append("opencli: command 'opencli' not found in PATH")
|
|
83
|
+
|
|
84
|
+
commands = config.get("commands", [])
|
|
85
|
+
if not commands:
|
|
86
|
+
errors.append("opencli: enabled but no commands configured")
|
|
87
|
+
return errors
|
|
88
|
+
|
|
89
|
+
for index, command_config in enumerate(commands):
|
|
90
|
+
label = command_config.get("name", f"commands[{index}]")
|
|
91
|
+
site = str(command_config.get("site", "")).strip()
|
|
92
|
+
command = str(command_config.get("command", "")).strip()
|
|
93
|
+
|
|
94
|
+
if not site:
|
|
95
|
+
errors.append(f"opencli.{label}: missing 'site'")
|
|
96
|
+
if not command:
|
|
97
|
+
errors.append(f"opencli.{label}: missing 'command'")
|
|
98
|
+
if command and not self._is_read_only(site, command, config):
|
|
99
|
+
errors.append(
|
|
100
|
+
f"opencli.{label}: command '{site} {command}' is not in the read-only allowlist"
|
|
101
|
+
)
|
|
102
|
+
return errors
|
|
103
|
+
|
|
104
|
+
def collect(self, query: SourceQuery, config: dict[str, Any]) -> list[SourceItem]:
|
|
105
|
+
if not config.get("enabled"):
|
|
106
|
+
return []
|
|
107
|
+
|
|
108
|
+
items: list[SourceItem] = []
|
|
109
|
+
for command_config in config.get("commands", []):
|
|
110
|
+
if command_config.get("enabled", True) is False:
|
|
111
|
+
continue
|
|
112
|
+
try:
|
|
113
|
+
items.extend(self._run_command(command_config, query, config))
|
|
114
|
+
except Exception:
|
|
115
|
+
continue
|
|
116
|
+
return items
|
|
117
|
+
|
|
118
|
+
def _is_read_only(self, site: str, command: str, config: dict[str, Any]) -> bool:
|
|
119
|
+
if command in WRITE_LIKE_COMMANDS:
|
|
120
|
+
return False
|
|
121
|
+
extra = config.get("allowed_commands", {})
|
|
122
|
+
if isinstance(extra, dict):
|
|
123
|
+
configured = set(str(c) for c in extra.get(site, []))
|
|
124
|
+
if command in configured:
|
|
125
|
+
return True
|
|
126
|
+
return command in READ_ONLY_COMMANDS.get(site, set())
|
|
127
|
+
|
|
128
|
+
def _run_command(
|
|
129
|
+
self,
|
|
130
|
+
command_config: dict[str, Any],
|
|
131
|
+
query: SourceQuery,
|
|
132
|
+
config: dict[str, Any],
|
|
133
|
+
) -> list[SourceItem]:
|
|
134
|
+
site = str(command_config.get("site", "")).strip()
|
|
135
|
+
command = str(command_config.get("command", "")).strip()
|
|
136
|
+
name = str(command_config.get("name") or f"{site}-{command}")
|
|
137
|
+
timeout = int(command_config.get("timeout", config.get("timeout", OPENCLI_DEFAULT_TIMEOUT)))
|
|
138
|
+
|
|
139
|
+
if not site or not command or not self._is_read_only(site, command, config):
|
|
140
|
+
return []
|
|
141
|
+
|
|
142
|
+
args = [str(arg) for arg in command_config.get("args", [])]
|
|
143
|
+
if command_config.get("query_from_keywords") and query.keywords:
|
|
144
|
+
args.insert(0, " ".join(query.keywords))
|
|
145
|
+
|
|
146
|
+
if "-f" not in args and "--format" not in args:
|
|
147
|
+
args.extend(["-f", "json"])
|
|
148
|
+
|
|
149
|
+
cmd = ["opencli", site, command, *args]
|
|
150
|
+
result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
|
|
151
|
+
|
|
152
|
+
if result.returncode != 0:
|
|
153
|
+
return [self._error_item(name, site, command, result.returncode, result.stderr or result.stdout)]
|
|
154
|
+
|
|
155
|
+
stdout = (result.stdout or "").strip()
|
|
156
|
+
if not stdout:
|
|
157
|
+
return []
|
|
158
|
+
|
|
159
|
+
data = self._parse_json_prefix(stdout)
|
|
160
|
+
if data is None:
|
|
161
|
+
return [self._text_item(name, site, command, stdout, command_config)]
|
|
162
|
+
|
|
163
|
+
records = data if isinstance(data, list) else [data]
|
|
164
|
+
items: list[SourceItem] = []
|
|
165
|
+
for index, record in enumerate(records):
|
|
166
|
+
if isinstance(record, dict):
|
|
167
|
+
items.append(self._dict_item(name, site, command, index, record, command_config))
|
|
168
|
+
else:
|
|
169
|
+
items.append(self._text_item(name, site, command, str(record), command_config, index=index))
|
|
170
|
+
return items
|
|
171
|
+
|
|
172
|
+
def _parse_json_prefix(self, stdout: str) -> Any | None:
|
|
173
|
+
text = stdout.strip()
|
|
174
|
+
try:
|
|
175
|
+
value, _ = json.JSONDecoder().raw_decode(text)
|
|
176
|
+
return value
|
|
177
|
+
except json.JSONDecodeError:
|
|
178
|
+
return None
|
|
179
|
+
|
|
180
|
+
def _dict_item(
|
|
181
|
+
self,
|
|
182
|
+
name: str,
|
|
183
|
+
site: str,
|
|
184
|
+
command: str,
|
|
185
|
+
index: int,
|
|
186
|
+
record: dict[str, Any],
|
|
187
|
+
command_config: dict[str, Any],
|
|
188
|
+
) -> SourceItem:
|
|
189
|
+
title = str(record.get("title") or record.get("name") or record.get("question") or f"{name} item {index + 1}")[:200]
|
|
190
|
+
content = str(
|
|
191
|
+
record.get("content")
|
|
192
|
+
or record.get("body")
|
|
193
|
+
or record.get("text")
|
|
194
|
+
or record.get("summary")
|
|
195
|
+
or json.dumps(record, ensure_ascii=False)
|
|
196
|
+
)[:8000]
|
|
197
|
+
url = str(record.get("url") or record.get("link") or "")
|
|
198
|
+
published_at = str(record.get("published_at") or record.get("date") or record.get("publishedAt") or "")
|
|
199
|
+
dedupe_key = f"opencli_{site}_{command}_{sha1((url or title + content).encode()).hexdigest()[:12]}"
|
|
200
|
+
|
|
201
|
+
return SourceItem(
|
|
202
|
+
source_id=f"opencli_{sha1((dedupe_key + str(index)).encode()).hexdigest()[:12]}",
|
|
203
|
+
source_name=f"OpenCLI: {name}",
|
|
204
|
+
source_type="cli",
|
|
205
|
+
title=title,
|
|
206
|
+
content=content,
|
|
207
|
+
url=url,
|
|
208
|
+
published_at=published_at,
|
|
209
|
+
reliability=str(command_config.get("reliability", "medium")),
|
|
210
|
+
dedupe_key=dedupe_key,
|
|
211
|
+
metadata={
|
|
212
|
+
"backend": "opencli",
|
|
213
|
+
"site": site,
|
|
214
|
+
"command": command,
|
|
215
|
+
"adapter": name,
|
|
216
|
+
"index": index,
|
|
217
|
+
"access_level": command_config.get("access_level", "user_authorized"),
|
|
218
|
+
"source_family": command_config.get("source_family", "private_signal"),
|
|
219
|
+
"evidence_quality": command_config.get("evidence_quality", "browser_or_adapter_output"),
|
|
220
|
+
},
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
def _text_item(
|
|
224
|
+
self,
|
|
225
|
+
name: str,
|
|
226
|
+
site: str,
|
|
227
|
+
command: str,
|
|
228
|
+
text: str,
|
|
229
|
+
command_config: dict[str, Any],
|
|
230
|
+
*,
|
|
231
|
+
index: int = 0,
|
|
232
|
+
) -> SourceItem:
|
|
233
|
+
title = f"OpenCLI {site} {command}: {name}"
|
|
234
|
+
content = text[:8000]
|
|
235
|
+
dedupe_key = f"opencli_{site}_{command}_{sha1(content.encode()).hexdigest()[:12]}"
|
|
236
|
+
return SourceItem(
|
|
237
|
+
source_id=f"opencli_{sha1((dedupe_key + str(index)).encode()).hexdigest()[:12]}",
|
|
238
|
+
source_name=f"OpenCLI: {name}",
|
|
239
|
+
source_type="cli",
|
|
240
|
+
title=title,
|
|
241
|
+
content=content,
|
|
242
|
+
reliability=str(command_config.get("reliability", "medium")),
|
|
243
|
+
dedupe_key=dedupe_key,
|
|
244
|
+
metadata={
|
|
245
|
+
"backend": "opencli",
|
|
246
|
+
"site": site,
|
|
247
|
+
"command": command,
|
|
248
|
+
"adapter": name,
|
|
249
|
+
"index": index,
|
|
250
|
+
"access_level": command_config.get("access_level", "user_authorized"),
|
|
251
|
+
"source_family": command_config.get("source_family", "private_signal"),
|
|
252
|
+
"evidence_quality": "text",
|
|
253
|
+
},
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
def _error_item(
|
|
257
|
+
self,
|
|
258
|
+
name: str,
|
|
259
|
+
site: str,
|
|
260
|
+
command: str,
|
|
261
|
+
returncode: int,
|
|
262
|
+
output: str,
|
|
263
|
+
) -> SourceItem:
|
|
264
|
+
error_text = output.strip()[:500]
|
|
265
|
+
dedupe_key = f"opencli_{site}_{command}_error_{sha1(error_text.encode()).hexdigest()[:12]}"
|
|
266
|
+
return SourceItem(
|
|
267
|
+
source_id=f"opencli_{sha1(dedupe_key.encode()).hexdigest()[:12]}",
|
|
268
|
+
source_name=f"OpenCLI: {name}",
|
|
269
|
+
source_type="cli",
|
|
270
|
+
title=f"[OpenCLI Error] {name} (exit {returncode})",
|
|
271
|
+
content=f"OpenCLI command failed with code {returncode}: {error_text}",
|
|
272
|
+
reliability="low",
|
|
273
|
+
dedupe_key=dedupe_key,
|
|
274
|
+
metadata={
|
|
275
|
+
"backend": "opencli",
|
|
276
|
+
"site": site,
|
|
277
|
+
"command": command,
|
|
278
|
+
"adapter": name,
|
|
279
|
+
"exit_code": returncode,
|
|
280
|
+
"error_type": "OpenCliExecutionError",
|
|
281
|
+
},
|
|
282
|
+
)
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"""Source Planner: decides what to search based on context.
|
|
2
|
+
|
|
3
|
+
Two planning modes:
|
|
4
|
+
- Static: industry_packs.py — fallback for CI/testing with known industries
|
|
5
|
+
- Runtime: LLM-generated SearchPlan — production path for any industry
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from multi_agent_brief.sources.industry_packs import get_industry_pack
|
|
14
|
+
|
|
15
|
+
# ── Runtime Search Plan schema ──────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class RuntimeSearchPlan:
|
|
20
|
+
"""LLM-generated search plan for a single prepare run.
|
|
21
|
+
|
|
22
|
+
The plan is produced by a subagent (not the Python layer) and validated
|
|
23
|
+
deterministically before execution. Each task becomes a separate search
|
|
24
|
+
API call.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
company: str = ""
|
|
28
|
+
industry: str = "" # free-text, not a slug
|
|
29
|
+
objective: str = ""
|
|
30
|
+
focus_areas: list[str] = field(default_factory=list)
|
|
31
|
+
report_date: str = ""
|
|
32
|
+
recency_days: int = 7
|
|
33
|
+
tasks: list[dict[str, Any]] = field(default_factory=list)
|
|
34
|
+
|
|
35
|
+
def to_search_task_dicts(self) -> list[dict[str, str]]:
|
|
36
|
+
"""Convert plan into the format expected by web_search.search_tasks."""
|
|
37
|
+
results: list[dict[str, str]] = []
|
|
38
|
+
for t in self.tasks:
|
|
39
|
+
q = t.get("query", "").strip()
|
|
40
|
+
if not q:
|
|
41
|
+
continue
|
|
42
|
+
entry: dict[str, str] = {"query": q}
|
|
43
|
+
domains = t.get("domains")
|
|
44
|
+
if domains:
|
|
45
|
+
entry["domains"] = (
|
|
46
|
+
",".join(domains) if isinstance(domains, list) else str(domains)
|
|
47
|
+
)
|
|
48
|
+
results.append(entry)
|
|
49
|
+
return results
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def validate_runtime_search_plan(plan: RuntimeSearchPlan) -> list[str]:
|
|
53
|
+
"""Deterministic validator for LLM-generated SearchPlan.
|
|
54
|
+
|
|
55
|
+
Returns a list of human-readable error messages. Empty list = valid.
|
|
56
|
+
"""
|
|
57
|
+
errors: list[str] = []
|
|
58
|
+
|
|
59
|
+
# Minimum 3 tasks for a meaningful search
|
|
60
|
+
if len(plan.tasks) < 3:
|
|
61
|
+
errors.append(
|
|
62
|
+
f"SearchPlan has {len(plan.tasks)} task(s) — at least 3 are required "
|
|
63
|
+
f"for meaningful source coverage."
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Every task must have a non-empty query
|
|
67
|
+
for i, t in enumerate(plan.tasks):
|
|
68
|
+
q = t.get("query", "").strip()
|
|
69
|
+
if not q:
|
|
70
|
+
errors.append(f"SearchPlan task {i} has an empty query.")
|
|
71
|
+
|
|
72
|
+
# No duplicate queries (after normalization)
|
|
73
|
+
seen: set[str] = set()
|
|
74
|
+
for i, t in enumerate(plan.tasks):
|
|
75
|
+
q = t.get("query", "").strip().lower()
|
|
76
|
+
if q and q in seen:
|
|
77
|
+
errors.append(f"SearchPlan task {i} duplicates query '{t.get('query', '')}'.")
|
|
78
|
+
if q:
|
|
79
|
+
seen.add(q)
|
|
80
|
+
|
|
81
|
+
# Coverage: at least one task should cover company + industry + policy
|
|
82
|
+
all_queries = " ".join(t.get("query", "") for t in plan.tasks).lower()
|
|
83
|
+
if plan.company and plan.company.lower() not in all_queries:
|
|
84
|
+
errors.append(
|
|
85
|
+
f"SearchPlan has no query mentioning company '{plan.company}'."
|
|
86
|
+
)
|
|
87
|
+
if plan.industry and plan.industry.lower() not in all_queries:
|
|
88
|
+
errors.append(
|
|
89
|
+
f"SearchPlan has no query mentioning industry '{plan.industry}'."
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Recency sanity
|
|
93
|
+
if plan.recency_days < 1 or plan.recency_days > 90:
|
|
94
|
+
errors.append(
|
|
95
|
+
f"SearchPlan recency_days={plan.recency_days} is out of range [1, 90]."
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return errors
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# ── Legacy SourcePlan (static industry packs) ───────────────────────────────
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass
|
|
105
|
+
class SearchTask:
|
|
106
|
+
"""A single search task produced by the planner."""
|
|
107
|
+
|
|
108
|
+
task_id: str
|
|
109
|
+
query: str
|
|
110
|
+
source_domains: list[str] = field(default_factory=list)
|
|
111
|
+
topic: str = "general"
|
|
112
|
+
priority: str = "medium" # high | medium | low
|
|
113
|
+
max_results: int = 10
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@dataclass
|
|
117
|
+
class SourcePlan:
|
|
118
|
+
"""Plan for what sources to collect (static industry-pack based)."""
|
|
119
|
+
|
|
120
|
+
industry: str
|
|
121
|
+
role: str
|
|
122
|
+
report_date: str
|
|
123
|
+
recency_days: int = 7
|
|
124
|
+
search_tasks: list[SearchTask] = field(default_factory=list)
|
|
125
|
+
enabled_providers: list[str] = field(default_factory=list)
|
|
126
|
+
rss_feeds: list[dict[str, Any]] = field(default_factory=list)
|
|
127
|
+
metadata: dict[str, Any] = field(default_factory=dict)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def create_source_plan(
|
|
131
|
+
*,
|
|
132
|
+
industry: str = "",
|
|
133
|
+
role: str = "",
|
|
134
|
+
report_date: str = "",
|
|
135
|
+
recency_days: int = 7,
|
|
136
|
+
enabled_providers: list[str] | None = None,
|
|
137
|
+
extra_keywords: list[str] | None = None,
|
|
138
|
+
) -> SourcePlan:
|
|
139
|
+
"""Create a source plan based on industry and role context.
|
|
140
|
+
|
|
141
|
+
This is deterministic in the MVP — no LLM calls.
|
|
142
|
+
"""
|
|
143
|
+
providers = enabled_providers or ["manual"]
|
|
144
|
+
plan = SourcePlan(
|
|
145
|
+
industry=industry,
|
|
146
|
+
role=role,
|
|
147
|
+
report_date=report_date,
|
|
148
|
+
recency_days=recency_days,
|
|
149
|
+
enabled_providers=providers,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
# Load industry pack if available
|
|
153
|
+
pack = get_industry_pack(industry) if industry else None
|
|
154
|
+
if pack:
|
|
155
|
+
plan.rss_feeds = list(pack.get("rss_feeds", []))
|
|
156
|
+
for i, task_def in enumerate(pack.get("search_tasks", [])):
|
|
157
|
+
plan.search_tasks.append(
|
|
158
|
+
SearchTask(
|
|
159
|
+
task_id=f"{industry}_{i:03d}",
|
|
160
|
+
query=task_def.get("query", ""),
|
|
161
|
+
source_domains=task_def.get("domains", []),
|
|
162
|
+
topic=task_def.get("topic", "general"),
|
|
163
|
+
priority=task_def.get("priority", "medium"),
|
|
164
|
+
)
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
# Add extra keywords as additional search tasks
|
|
168
|
+
if extra_keywords:
|
|
169
|
+
plan.search_tasks.append(
|
|
170
|
+
SearchTask(
|
|
171
|
+
task_id=f"extra_{len(plan.search_tasks):03d}",
|
|
172
|
+
query=" ".join(extra_keywords),
|
|
173
|
+
topic="general",
|
|
174
|
+
priority="medium",
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
return plan
|