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.
Files changed (424) hide show
  1. briefloop-0.11.12.dist-info/METADATA +473 -0
  2. briefloop-0.11.12.dist-info/RECORD +424 -0
  3. briefloop-0.11.12.dist-info/WHEEL +5 -0
  4. briefloop-0.11.12.dist-info/entry_points.txt +3 -0
  5. briefloop-0.11.12.dist-info/licenses/LICENSE +22 -0
  6. briefloop-0.11.12.dist-info/top_level.txt +1 -0
  7. multi_agent_brief/__init__.py +36 -0
  8. multi_agent_brief/analysis_blocks/__init__.py +11 -0
  9. multi_agent_brief/analysis_blocks/builder.py +206 -0
  10. multi_agent_brief/analysis_blocks/renderer.py +237 -0
  11. multi_agent_brief/analysis_blocks/schemas.py +52 -0
  12. multi_agent_brief/analysis_modules/__init__.py +8 -0
  13. multi_agent_brief/analysis_modules/base.py +87 -0
  14. multi_agent_brief/analysis_modules/market_competitor/__init__.py +68 -0
  15. multi_agent_brief/analysis_modules/market_competitor/auditor.py +290 -0
  16. multi_agent_brief/analysis_modules/market_competitor/config.py +187 -0
  17. multi_agent_brief/analysis_modules/market_competitor/event_builder.py +226 -0
  18. multi_agent_brief/analysis_modules/market_competitor/renderer.py +199 -0
  19. multi_agent_brief/analysis_modules/market_competitor/schemas.py +518 -0
  20. multi_agent_brief/analysis_modules/policy_regulatory/__init__.py +7 -0
  21. multi_agent_brief/analysis_modules/policy_regulatory/audit.py +195 -0
  22. multi_agent_brief/analysis_modules/policy_regulatory/module.py +387 -0
  23. multi_agent_brief/analysis_modules/policy_regulatory/schemas.py +129 -0
  24. multi_agent_brief/analysis_modules/registry.py +73 -0
  25. multi_agent_brief/audience/__init__.py +19 -0
  26. multi_agent_brief/audience/profiles.py +246 -0
  27. multi_agent_brief/audience_memory/__init__.py +23 -0
  28. multi_agent_brief/audience_memory/profile.py +358 -0
  29. multi_agent_brief/audit/__init__.py +36 -0
  30. multi_agent_brief/audit/case_applicability.py +181 -0
  31. multi_agent_brief/audit/deterministic.py +471 -0
  32. multi_agent_brief/audit/editorial_governance.py +404 -0
  33. multi_agent_brief/audit/final_quality.py +764 -0
  34. multi_agent_brief/audit/harness.py +242 -0
  35. multi_agent_brief/audit/interfaces.py +96 -0
  36. multi_agent_brief/audit/limitation_hygiene.py +238 -0
  37. multi_agent_brief/audit/proposal_boundary.py +34 -0
  38. multi_agent_brief/audit/redaction.py +27 -0
  39. multi_agent_brief/audit/rule_packs.py +96 -0
  40. multi_agent_brief/audit/semantic.py +435 -0
  41. multi_agent_brief/capabilities/__init__.py +22 -0
  42. multi_agent_brief/capabilities/catalog.py +215 -0
  43. multi_agent_brief/capabilities/detect.py +199 -0
  44. multi_agent_brief/capabilities/models.py +60 -0
  45. multi_agent_brief/capabilities/recommend.py +206 -0
  46. multi_agent_brief/cli/__init__.py +2 -0
  47. multi_agent_brief/cli/analysis_commands.py +140 -0
  48. multi_agent_brief/cli/approval_commands.py +107 -0
  49. multi_agent_brief/cli/audit_commands.py +59 -0
  50. multi_agent_brief/cli/capability_commands.py +548 -0
  51. multi_agent_brief/cli/claude_commands.py +159 -0
  52. multi_agent_brief/cli/competitors_commands.py +182 -0
  53. multi_agent_brief/cli/controls_commands.py +137 -0
  54. multi_agent_brief/cli/deliver_commands.py +942 -0
  55. multi_agent_brief/cli/eval_cases_commands.py +99 -0
  56. multi_agent_brief/cli/experiments_commands.py +395 -0
  57. multi_agent_brief/cli/feedback_commands.py +192 -0
  58. multi_agent_brief/cli/finalize_commands.py +153 -0
  59. multi_agent_brief/cli/gates_commands.py +174 -0
  60. multi_agent_brief/cli/hermes_commands.py +356 -0
  61. multi_agent_brief/cli/improve_commands.py +224 -0
  62. multi_agent_brief/cli/init_commands.py +564 -0
  63. multi_agent_brief/cli/init_wizard.py +1473 -0
  64. multi_agent_brief/cli/input_commands.py +237 -0
  65. multi_agent_brief/cli/main.py +288 -0
  66. multi_agent_brief/cli/onboard_commands.py +193 -0
  67. multi_agent_brief/cli/product_commands.py +1449 -0
  68. multi_agent_brief/cli/provenance_commands.py +100 -0
  69. multi_agent_brief/cli/release_commands.py +68 -0
  70. multi_agent_brief/cli/repair_commands.py +169 -0
  71. multi_agent_brief/cli/run_commands.py +292 -0
  72. multi_agent_brief/cli/runtime_commands.py +81 -0
  73. multi_agent_brief/cli/secrets_commands.py +232 -0
  74. multi_agent_brief/cli/semantic_support_commands.py +80 -0
  75. multi_agent_brief/cli/sources_commands.py +647 -0
  76. multi_agent_brief/cli/start_commands.py +8 -0
  77. multi_agent_brief/cli/state_commands.py +446 -0
  78. multi_agent_brief/cli/status_commands.py +26 -0
  79. multi_agent_brief/cli/workbuddy_commands.py +103 -0
  80. multi_agent_brief/configs/artifact_contracts.yaml +514 -0
  81. multi_agent_brief/configs/orchestrator_contract.yaml +181 -0
  82. multi_agent_brief/configs/policy_packs/default.yaml +65 -0
  83. multi_agent_brief/configs/policy_profiles/evidence_extract_default.yaml +58 -0
  84. multi_agent_brief/configs/policy_profiles/finance_default.yaml +44 -0
  85. multi_agent_brief/configs/policy_profiles/internet_default.yaml +44 -0
  86. multi_agent_brief/configs/policy_profiles/manufacturing_default.yaml +33 -0
  87. multi_agent_brief/configs/policy_profiles/solar_manufacturing_default.yaml +64 -0
  88. multi_agent_brief/configs/report_packs/evidence_extract.yaml +48 -0
  89. multi_agent_brief/configs/report_packs/management_monthly.yaml +36 -0
  90. multi_agent_brief/configs/report_packs/market_weekly.yaml +36 -0
  91. multi_agent_brief/configs/report_packs/solar_industry_periodic.yaml +50 -0
  92. multi_agent_brief/configs/report_templates/evidence_extract.yaml +55 -0
  93. multi_agent_brief/configs/report_templates/management_monthly.yaml +48 -0
  94. multi_agent_brief/configs/report_templates/market_weekly.yaml +49 -0
  95. multi_agent_brief/configs/report_templates/solar_industry_periodic.yaml +75 -0
  96. multi_agent_brief/configs/stage_specs.yaml +180 -0
  97. multi_agent_brief/contracts/__init__.py +41 -0
  98. multi_agent_brief/contracts/base.py +99 -0
  99. multi_agent_brief/contracts/errors.py +41 -0
  100. multi_agent_brief/contracts/migrations/__init__.py +5 -0
  101. multi_agent_brief/contracts/migrations/claim_v1_to_v2.py +33 -0
  102. multi_agent_brief/contracts/registry.py +159 -0
  103. multi_agent_brief/contracts/role_topology.py +25 -0
  104. multi_agent_brief/contracts/schemas/__init__.py +35 -0
  105. multi_agent_brief/contracts/schemas/analysis_pack.py +135 -0
  106. multi_agent_brief/contracts/schemas/atomic_claim_graph.py +304 -0
  107. multi_agent_brief/contracts/schemas/audit_report.py +80 -0
  108. multi_agent_brief/contracts/schemas/candidate_item.py +51 -0
  109. multi_agent_brief/contracts/schemas/claim.py +197 -0
  110. multi_agent_brief/contracts/schemas/claim_draft.py +386 -0
  111. multi_agent_brief/contracts/schemas/claim_support_matrix.py +334 -0
  112. multi_agent_brief/contracts/schemas/evidence_span_registry.py +270 -0
  113. multi_agent_brief/contracts/schemas/policy_profile.py +247 -0
  114. multi_agent_brief/contracts/schemas/report_spec.py +257 -0
  115. multi_agent_brief/contracts/schemas/semantic_assessment_report.py +480 -0
  116. multi_agent_brief/contracts/schemas/source_evidence_pack_manifest.py +233 -0
  117. multi_agent_brief/contracts/schemas/source_item.py +96 -0
  118. multi_agent_brief/contracts/semantic_assessment_status.py +12 -0
  119. multi_agent_brief/contracts/source_metadata.py +252 -0
  120. multi_agent_brief/contracts/target_contract.py +460 -0
  121. multi_agent_brief/contracts/validator.py +225 -0
  122. multi_agent_brief/controls/__init__.py +23 -0
  123. multi_agent_brief/controls/contract.py +106 -0
  124. multi_agent_brief/controls/switchboard.py +1076 -0
  125. multi_agent_brief/core/__init__.py +2 -0
  126. multi_agent_brief/core/citations.py +14 -0
  127. multi_agent_brief/core/claim_ledger.py +94 -0
  128. multi_agent_brief/core/config.py +191 -0
  129. multi_agent_brief/core/env.py +69 -0
  130. multi_agent_brief/core/previous.py +83 -0
  131. multi_agent_brief/core/schemas.py +181 -0
  132. multi_agent_brief/core/selection.py +189 -0
  133. multi_agent_brief/delivery/__init__.py +6 -0
  134. multi_agent_brief/delivery/base.py +36 -0
  135. multi_agent_brief/delivery/feishu.py +204 -0
  136. multi_agent_brief/delivery/gws.py +237 -0
  137. multi_agent_brief/evaluation_cases/__init__.py +15 -0
  138. multi_agent_brief/evaluation_cases/contract.py +429 -0
  139. multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/config.yaml +18 -0
  140. multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/improvement/ledger.jsonl +2 -0
  141. multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/sources.yaml +2 -0
  142. multi_agent_brief/evaluation_cases/fixtures/cases/approved_guidance_materialized/workspace/user.md +4 -0
  143. multi_agent_brief/evaluation_cases/fixtures/cases/company_event_missing_latest_official_check/workspace/config.yaml +13 -0
  144. multi_agent_brief/evaluation_cases/fixtures/cases/company_event_missing_latest_official_check/workspace/sources.yaml +9 -0
  145. multi_agent_brief/evaluation_cases/fixtures/cases/company_event_missing_latest_official_check/workspace/user.md +4 -0
  146. multi_agent_brief/evaluation_cases/fixtures/cases/control_switchboard_selection_is_not_execution/workspace/config.yaml +12 -0
  147. multi_agent_brief/evaluation_cases/fixtures/cases/control_switchboard_selection_is_not_execution/workspace/sources.yaml +6 -0
  148. multi_agent_brief/evaluation_cases/fixtures/cases/control_switchboard_selection_is_not_execution/workspace/user.md +4 -0
  149. multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/config.yaml +6 -0
  150. multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/input/human_feedback.md +1 -0
  151. multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/sources.yaml +2 -0
  152. multi_agent_brief/evaluation_cases/fixtures/cases/feedback_triage_required/workspace/user.md +3 -0
  153. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/config.yaml +8 -0
  154. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/brief.md +14 -0
  155. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/audit_report.json +1 -0
  156. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/audited_brief.md +5 -0
  157. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/candidate_claims.json +1 -0
  158. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/claim_ledger.json +1 -0
  159. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/output/intermediate/screened_candidates.json +1 -0
  160. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/sources.yaml +2 -0
  161. multi_agent_brief/evaluation_cases/fixtures/cases/final_abstract_quality_warning_surface/workspace/user.md +3 -0
  162. multi_agent_brief/evaluation_cases/fixtures/cases/formal_release_missing_human_approval/workspace/config.yaml +13 -0
  163. multi_agent_brief/evaluation_cases/fixtures/cases/formal_release_missing_human_approval/workspace/sources.yaml +9 -0
  164. multi_agent_brief/evaluation_cases/fixtures/cases/formal_release_missing_human_approval/workspace/user.md +4 -0
  165. multi_agent_brief/evaluation_cases/fixtures/cases/guidance_manifestation_not_observable/workspace/config.yaml +4 -0
  166. multi_agent_brief/evaluation_cases/fixtures/cases/guidance_manifestation_not_observable/workspace/sources.yaml +2 -0
  167. multi_agent_brief/evaluation_cases/fixtures/cases/guidance_manifestation_not_observable/workspace/user.md +3 -0
  168. multi_agent_brief/evaluation_cases/fixtures/cases/media_only_legal_policy_blocks_research_review/workspace/config.yaml +13 -0
  169. multi_agent_brief/evaluation_cases/fixtures/cases/media_only_legal_policy_blocks_research_review/workspace/sources.yaml +9 -0
  170. multi_agent_brief/evaluation_cases/fixtures/cases/media_only_legal_policy_blocks_research_review/workspace/user.md +4 -0
  171. multi_agent_brief/evaluation_cases/fixtures/cases/mixed_metric_scope_support_blocker/workspace/config.yaml +13 -0
  172. multi_agent_brief/evaluation_cases/fixtures/cases/mixed_metric_scope_support_blocker/workspace/sources.yaml +9 -0
  173. multi_agent_brief/evaluation_cases/fixtures/cases/mixed_metric_scope_support_blocker/workspace/user.md +5 -0
  174. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/config.yaml +6 -0
  175. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/audited_brief.md +3 -0
  176. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/candidate_claims.json +1 -0
  177. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/claim_ledger.json +1 -0
  178. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/feedback_issues.json +25 -0
  179. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/repair_plan.json +27 -0
  180. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/output/intermediate/screened_candidates.json +1 -0
  181. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/sources.yaml +2 -0
  182. multi_agent_brief/evaluation_cases/fixtures/cases/planned_blocking_issue_cannot_continue/workspace/user.md +3 -0
  183. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/config.yaml +8 -0
  184. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/audit_report.json +1 -0
  185. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/audited_brief.md +3 -0
  186. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/candidate_claims.json +1 -0
  187. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/claim_ledger.json +11 -0
  188. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/quality_gate_report.json +22 -0
  189. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/output/intermediate/screened_candidates.json +1 -0
  190. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/sources.yaml +2 -0
  191. multi_agent_brief/evaluation_cases/fixtures/cases/provenance_projection_minimal/workspace/user.md +3 -0
  192. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/config.yaml +13 -0
  193. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/audit_report.json +1 -0
  194. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/audited_brief.md +5 -0
  195. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/candidate_claims.json +1 -0
  196. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/claim_ledger.json +40 -0
  197. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/output/intermediate/screened_candidates.json +1 -0
  198. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/sources.yaml +3 -0
  199. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_source_appendix/workspace/user.md +3 -0
  200. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/config.yaml +8 -0
  201. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/brief.md +3 -0
  202. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/audit_report.json +1 -0
  203. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/audited_brief.md +3 -0
  204. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/candidate_claims.json +1 -0
  205. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/claim_ledger.json +13 -0
  206. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/output/intermediate/screened_candidates.json +1 -0
  207. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/sources.yaml +2 -0
  208. multi_agent_brief/evaluation_cases/fixtures/cases/reader_facing_target_relevance/workspace/user.md +3 -0
  209. multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/config.yaml +13 -0
  210. multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/output/intermediate/release_readiness_report.json +31 -0
  211. multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/sources.yaml +9 -0
  212. multi_agent_brief/evaluation_cases/fixtures/cases/release_readiness_forged_event_blocker/workspace/user.md +4 -0
  213. multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/config.yaml +18 -0
  214. multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/improvement/ledger.jsonl +3 -0
  215. multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/improvement/memory.md +3 -0
  216. multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/output/intermediate/improvement_memory_snapshot.md +3 -0
  217. multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/sources.yaml +2 -0
  218. multi_agent_brief/evaluation_cases/fixtures/cases/reverted_entry_removed_from_next_snapshot/workspace/user.md +4 -0
  219. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/config.yaml +12 -0
  220. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/input/sources/source-001.txt +1 -0
  221. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/brief.md +37 -0
  222. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/delivery/brief.md +37 -0
  223. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/atomic_claim_graph.json +17 -0
  224. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/audit_report.json +5 -0
  225. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/audited_brief.md +37 -0
  226. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/claim_ledger.json +20 -0
  227. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/evidence_span_registry.json +20 -0
  228. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/finalize_report.json +40 -0
  229. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/gates/auditor_quality_gate_report.json +42 -0
  230. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/gates/finalize_quality_gate_report.json +42 -0
  231. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/intermediate/screened_candidates.json +33 -0
  232. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/source_appendix.md +12 -0
  233. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/output/source_appendix_trace.md +10 -0
  234. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/report_spec.yaml +24 -0
  235. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/sources.yaml +4 -0
  236. multi_agent_brief/evaluation_cases/fixtures/cases/same_evidence_reader_quality_regression/workspace/user.md +3 -0
  237. multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/config.yaml +13 -0
  238. multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/input/sources/README.md +4 -0
  239. multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/output/intermediate/source_evidence_pack_manifest.json +26 -0
  240. multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/sources.yaml +9 -0
  241. multi_agent_brief/evaluation_cases/fixtures/cases/source_evidence_pack_blocks_non_evidence_file/workspace/user.md +4 -0
  242. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/config.yaml +9 -0
  243. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/audit_report.json +1 -0
  244. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/audited_brief.md +3 -0
  245. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/candidate_claims.json +1 -0
  246. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/claim_ledger.json +13 -0
  247. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/output/intermediate/screened_candidates.json +1 -0
  248. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/sources.yaml +2 -0
  249. multi_agent_brief/evaluation_cases/fixtures/cases/stale_current_claim/workspace/user.md +3 -0
  250. multi_agent_brief/evaluation_cases/fixtures/cases/third_party_price_snapshot_formal_block/workspace/config.yaml +13 -0
  251. multi_agent_brief/evaluation_cases/fixtures/cases/third_party_price_snapshot_formal_block/workspace/sources.yaml +9 -0
  252. multi_agent_brief/evaluation_cases/fixtures/cases/third_party_price_snapshot_formal_block/workspace/user.md +4 -0
  253. multi_agent_brief/evaluation_cases/fixtures/cases/trajectory_retry_budget_exhausted/workspace/config.yaml +4 -0
  254. multi_agent_brief/evaluation_cases/fixtures/cases/trajectory_retry_budget_exhausted/workspace/sources.yaml +2 -0
  255. multi_agent_brief/evaluation_cases/fixtures/cases/trajectory_retry_budget_exhausted/workspace/user.md +3 -0
  256. multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/config.yaml +18 -0
  257. multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/improvement/ledger.jsonl +1 -0
  258. multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/sources.yaml +2 -0
  259. multi_agent_brief/evaluation_cases/fixtures/cases/unapproved_entry_not_materialized/workspace/user.md +4 -0
  260. multi_agent_brief/evaluation_cases/fixtures/cases/unauthorized_institution_branding_blocks_release/workspace/config.yaml +18 -0
  261. multi_agent_brief/evaluation_cases/fixtures/cases/unauthorized_institution_branding_blocks_release/workspace/sources.yaml +9 -0
  262. multi_agent_brief/evaluation_cases/fixtures/cases/unauthorized_institution_branding_blocks_release/workspace/user.md +5 -0
  263. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/config.yaml +8 -0
  264. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/audit_report.json +1 -0
  265. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/audited_brief.md +8 -0
  266. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/candidate_claims.json +1 -0
  267. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/claim_ledger.json +1 -0
  268. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/output/intermediate/screened_candidates.json +1 -0
  269. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/sources.yaml +2 -0
  270. multi_agent_brief/evaluation_cases/fixtures/cases/unsupported_material_fact/workspace/user.md +3 -0
  271. multi_agent_brief/evaluation_cases/fixtures/manifest.yaml +861 -0
  272. multi_agent_brief/evaluation_cases/fixtures.py +20 -0
  273. multi_agent_brief/evaluation_cases/runner.py +1603 -0
  274. multi_agent_brief/experiments/__init__.py +45 -0
  275. multi_agent_brief/experiments/experiment_080.py +5835 -0
  276. multi_agent_brief/experiments/schemas.py +63 -0
  277. multi_agent_brief/experiments/target_contract.py +10 -0
  278. multi_agent_brief/feedback/__init__.py +17 -0
  279. multi_agent_brief/feedback/feedback_contract.py +482 -0
  280. multi_agent_brief/feedback/feedback_state.py +898 -0
  281. multi_agent_brief/hermes/__init__.py +25 -0
  282. multi_agent_brief/hermes/adapter.py +832 -0
  283. multi_agent_brief/improvement/__init__.py +83 -0
  284. multi_agent_brief/improvement/contract.py +1114 -0
  285. multi_agent_brief/improvement/memory.py +451 -0
  286. multi_agent_brief/improvement/product_definition.py +228 -0
  287. multi_agent_brief/improvement/state.py +961 -0
  288. multi_agent_brief/inputs/__init__.py +2 -0
  289. multi_agent_brief/inputs/classifier.py +322 -0
  290. multi_agent_brief/inputs/contracts.py +59 -0
  291. multi_agent_brief/inputs/extractor.py +310 -0
  292. multi_agent_brief/install/__init__.py +2 -0
  293. multi_agent_brief/install/writer.py +97 -0
  294. multi_agent_brief/onboarding/__init__.py +11 -0
  295. multi_agent_brief/onboarding/io.py +103 -0
  296. multi_agent_brief/onboarding/mapper.py +484 -0
  297. multi_agent_brief/onboarding/schema.py +46 -0
  298. multi_agent_brief/orchestrator/__init__.py +2 -0
  299. multi_agent_brief/orchestrator/fact_layer_import.py +352 -0
  300. multi_agent_brief/orchestrator/handoff.py +2209 -0
  301. multi_agent_brief/orchestrator/role_topology.py +42 -0
  302. multi_agent_brief/orchestrator/run_archive.py +888 -0
  303. multi_agent_brief/orchestrator/run_integrity.py +346 -0
  304. multi_agent_brief/orchestrator/runtime_state/__init__.py +70 -0
  305. multi_agent_brief/orchestrator/runtime_state/_io.py +167 -0
  306. multi_agent_brief/orchestrator/runtime_state/_transactions.py +298 -0
  307. multi_agent_brief/orchestrator/runtime_state/artifact_registry.py +1825 -0
  308. multi_agent_brief/orchestrator/runtime_state/atomic_claim_graph.py +96 -0
  309. multi_agent_brief/orchestrator/runtime_state/claim_ledger_freeze.py +510 -0
  310. multi_agent_brief/orchestrator/runtime_state/claim_metadata_enrichment.py +836 -0
  311. multi_agent_brief/orchestrator/runtime_state/claim_support_matrix.py +582 -0
  312. multi_agent_brief/orchestrator/runtime_state/completion_gates.py +672 -0
  313. multi_agent_brief/orchestrator/runtime_state/contracts_loader.py +66 -0
  314. multi_agent_brief/orchestrator/runtime_state/decisions.py +239 -0
  315. multi_agent_brief/orchestrator/runtime_state/errors.py +61 -0
  316. multi_agent_brief/orchestrator/runtime_state/event_log.py +256 -0
  317. multi_agent_brief/orchestrator/runtime_state/evidence_span_registry.py +233 -0
  318. multi_agent_brief/orchestrator/runtime_state/fact_layer.py +755 -0
  319. multi_agent_brief/orchestrator/runtime_state/identity.py +90 -0
  320. multi_agent_brief/orchestrator/runtime_state/lifecycle.py +675 -0
  321. multi_agent_brief/orchestrator/runtime_state/manifest.py +82 -0
  322. multi_agent_brief/orchestrator/runtime_state/operations.py +224 -0
  323. multi_agent_brief/orchestrator/runtime_state/paths.py +38 -0
  324. multi_agent_brief/orchestrator/runtime_state/repair.py +984 -0
  325. multi_agent_brief/orchestrator/runtime_state/safety_surfaces.py +147 -0
  326. multi_agent_brief/orchestrator/runtime_state/semantic_assessment_report.py +692 -0
  327. multi_agent_brief/orchestrator/runtime_state/semantic_support_acceptance.py +683 -0
  328. multi_agent_brief/orchestrator/runtime_state/source_evidence_pack.py +131 -0
  329. multi_agent_brief/orchestrator/runtime_state/stage_completion.py +1320 -0
  330. multi_agent_brief/orchestrator/runtime_state/trajectory.py +200 -0
  331. multi_agent_brief/orchestrator/runtime_state/workflow.py +350 -0
  332. multi_agent_brief/orchestrator/source_evidence.py +43 -0
  333. multi_agent_brief/orchestrator/timing.py +410 -0
  334. multi_agent_brief/orchestrator_contract.py +96 -0
  335. multi_agent_brief/outputs/__init__.py +2 -0
  336. multi_agent_brief/outputs/atomic_reader_projection.py +288 -0
  337. multi_agent_brief/outputs/docx.py +32 -0
  338. multi_agent_brief/outputs/finalize.py +1036 -0
  339. multi_agent_brief/outputs/ib_docx.py +983 -0
  340. multi_agent_brief/outputs/naming.py +38 -0
  341. multi_agent_brief/outputs/pdf.py +20 -0
  342. multi_agent_brief/outputs/reader_final_gate.py +509 -0
  343. multi_agent_brief/outputs/reader_projection.py +397 -0
  344. multi_agent_brief/outputs/source_appendix.py +753 -0
  345. multi_agent_brief/outputs/templates/__init__.py +112 -0
  346. multi_agent_brief/product/__init__.py +49 -0
  347. multi_agent_brief/product/bundle_projection.py +686 -0
  348. multi_agent_brief/product/citation_profile.py +145 -0
  349. multi_agent_brief/product/guidance_manifestation.py +421 -0
  350. multi_agent_brief/product/materiality_selection.py +472 -0
  351. multi_agent_brief/product/policy_gate_adapter.py +116 -0
  352. multi_agent_brief/product/policy_profile.py +39 -0
  353. multi_agent_brief/product/policy_projection.py +161 -0
  354. multi_agent_brief/product/policy_registry.py +83 -0
  355. multi_agent_brief/product/policy_resolver.py +225 -0
  356. multi_agent_brief/product/quality_closeout.py +188 -0
  357. multi_agent_brief/product/quality_panel.py +2217 -0
  358. multi_agent_brief/product/release_approval.py +1034 -0
  359. multi_agent_brief/product/report_pack.py +130 -0
  360. multi_agent_brief/product/report_pack_aliases.py +68 -0
  361. multi_agent_brief/product/report_registry.py +101 -0
  362. multi_agent_brief/product/report_spec.py +181 -0
  363. multi_agent_brief/product/support_wording.py +525 -0
  364. multi_agent_brief/product/template_conformance.py +516 -0
  365. multi_agent_brief/product/template_projection.py +123 -0
  366. multi_agent_brief/product/template_registry.py +244 -0
  367. multi_agent_brief/product/template_render_plan.py +315 -0
  368. multi_agent_brief/product/template_renderer.py +224 -0
  369. multi_agent_brief/product/trajectory_regulation.py +441 -0
  370. multi_agent_brief/provenance/__init__.py +5 -0
  371. multi_agent_brief/provenance/builder.py +841 -0
  372. multi_agent_brief/provenance/contract.py +21 -0
  373. multi_agent_brief/provenance/io.py +144 -0
  374. multi_agent_brief/provenance/model.py +110 -0
  375. multi_agent_brief/provenance/references.py +43 -0
  376. multi_agent_brief/provenance/validator.py +135 -0
  377. multi_agent_brief/quality_gates/__init__.py +19 -0
  378. multi_agent_brief/quality_gates/contract.py +581 -0
  379. multi_agent_brief/quality_gates/state.py +2498 -0
  380. multi_agent_brief/repair/__init__.py +5 -0
  381. multi_agent_brief/repair/router.py +842 -0
  382. multi_agent_brief/runtime_assets.py +431 -0
  383. multi_agent_brief/sources/__init__.py +16 -0
  384. multi_agent_brief/sources/api_filings.py +236 -0
  385. multi_agent_brief/sources/api_news.py +174 -0
  386. multi_agent_brief/sources/base.py +142 -0
  387. multi_agent_brief/sources/cached_package.py +119 -0
  388. multi_agent_brief/sources/cli_provider.py +263 -0
  389. multi_agent_brief/sources/coverage.py +336 -0
  390. multi_agent_brief/sources/decider.py +756 -0
  391. multi_agent_brief/sources/doctor.py +373 -0
  392. multi_agent_brief/sources/evidence_pack.py +364 -0
  393. multi_agent_brief/sources/feishu_provider.py +326 -0
  394. multi_agent_brief/sources/filing_resolver.py +400 -0
  395. multi_agent_brief/sources/industry_packs.py +130 -0
  396. multi_agent_brief/sources/join.py +206 -0
  397. multi_agent_brief/sources/local_signal.py +81 -0
  398. multi_agent_brief/sources/local_signal_planner.py +636 -0
  399. multi_agent_brief/sources/manual.py +259 -0
  400. multi_agent_brief/sources/mcp_provider.py +309 -0
  401. multi_agent_brief/sources/mineru_provider.py +601 -0
  402. multi_agent_brief/sources/normalizer.py +95 -0
  403. multi_agent_brief/sources/opencli_provider.py +282 -0
  404. multi_agent_brief/sources/planner.py +178 -0
  405. multi_agent_brief/sources/registry.py +367 -0
  406. multi_agent_brief/sources/rss.py +190 -0
  407. multi_agent_brief/sources/search_backends/__init__.py +31 -0
  408. multi_agent_brief/sources/search_backends/base.py +51 -0
  409. multi_agent_brief/sources/search_backends/brave.py +192 -0
  410. multi_agent_brief/sources/search_backends/capabilities.py +94 -0
  411. multi_agent_brief/sources/search_backends/exa.py +180 -0
  412. multi_agent_brief/sources/search_backends/firecrawl.py +164 -0
  413. multi_agent_brief/sources/search_backends/serper.py +241 -0
  414. multi_agent_brief/sources/search_backends/tavily.py +124 -0
  415. multi_agent_brief/sources/sourcehub.py +505 -0
  416. multi_agent_brief/sources/web_search.py +267 -0
  417. multi_agent_brief/status.py +966 -0
  418. multi_agent_brief/tools/__init__.py +3 -0
  419. multi_agent_brief/tools/draft_cleanup.py +198 -0
  420. multi_agent_brief/workbuddy/__init__.py +1 -0
  421. multi_agent_brief/workbuddy/diagnose.py +569 -0
  422. multi_agent_brief/workbuddy/skill_pack.py +309 -0
  423. multi_agent_brief/workspace/__init__.py +1 -0
  424. multi_agent_brief/workspace/init_profile.py +45 -0
@@ -0,0 +1,564 @@
1
+ """init — workspace creation command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ from pathlib import Path
7
+
8
+
9
+ def register(subparsers: argparse._SubParsersAction) -> None:
10
+ """Register the init subparser."""
11
+ init_parser = subparsers.add_parser(
12
+ "init",
13
+ help="Create a brief workspace from onboarding.json."
14
+ " Run 'briefloop onboard' first for conversational setup.",
15
+ )
16
+ init_parser.add_argument(
17
+ "target",
18
+ nargs="?",
19
+ default="brief-workspace",
20
+ help="Target workspace directory.",
21
+ )
22
+ init_parser.add_argument(
23
+ "--demo",
24
+ action="store_true",
25
+ help="Create the existing synthetic demo workspace.",
26
+ )
27
+ init_parser.add_argument(
28
+ "--force", action="store_true", help="Overwrite existing init files."
29
+ )
30
+ init_parser.add_argument(
31
+ "--language",
32
+ choices=["en-US", "zh-CN", "bilingual"],
33
+ help="Wizard/interface language.",
34
+ )
35
+ init_parser.add_argument(
36
+ "--output-language",
37
+ choices=["en-US", "zh-CN", "bilingual"],
38
+ help="Generated brief language.",
39
+ )
40
+ init_parser.add_argument(
41
+ "--company", help="Company or organization name."
42
+ )
43
+ init_parser.add_argument(
44
+ "--role", help="User role, e.g. strategy_office."
45
+ )
46
+ init_parser.add_argument(
47
+ "--industry", help="Industry slug, e.g. manufacturing."
48
+ )
49
+ init_parser.add_argument("--title", help="Brief title.")
50
+ init_parser.add_argument("--audience", help="Target reader group.")
51
+ init_parser.add_argument(
52
+ "--focus-areas", help="Comma-separated focus areas."
53
+ )
54
+ init_parser.add_argument(
55
+ "--cadence",
56
+ choices=["weekly", "biweekly", "monthly", "ad_hoc"],
57
+ help="Reporting cadence.",
58
+ )
59
+ init_parser.add_argument(
60
+ "--selector-max-items",
61
+ type=int,
62
+ help="Maximum selected items per brief.",
63
+ )
64
+ init_parser.add_argument(
65
+ "--rag",
66
+ choices=["on", "off"],
67
+ help="Enable or disable retrieval settings.",
68
+ )
69
+ init_parser.add_argument(
70
+ "--retrieval-provider",
71
+ choices=["ollama", "gemini"],
72
+ help="Retrieval provider.",
73
+ )
74
+ init_parser.add_argument(
75
+ "--output-formats", help="Comma-separated output formats."
76
+ )
77
+ init_parser.add_argument(
78
+ "--source-profile",
79
+ choices=[
80
+ "conservative",
81
+ "research",
82
+ "aggressive_signal",
83
+ "custom",
84
+ "llm_decide",
85
+ ],
86
+ help="Source collection profile.",
87
+ )
88
+ init_parser.add_argument(
89
+ "--tavily",
90
+ action="store_true",
91
+ help="Legacy alias: enable Tavily live web search backend.",
92
+ )
93
+ init_parser.add_argument(
94
+ "--web-search-mode",
95
+ choices=["disabled", "runtime_tool", "external_api", "configure_later"],
96
+ help="How web search is provided.",
97
+ )
98
+ init_parser.add_argument(
99
+ "--search-backend",
100
+ choices=["tavily", "exa", "brave", "firecrawl", "serper"],
101
+ help="Search backend for --web-search-mode external_api.",
102
+ )
103
+ init_parser.add_argument(
104
+ "--initial-news-backfill",
105
+ action="store_true",
106
+ help=(
107
+ "Configure first-run seven-day news discovery"
108
+ " (20 relevant news items per day)."
109
+ ),
110
+ )
111
+ init_parser.add_argument(
112
+ "--initial-news-backfill-days",
113
+ type=int,
114
+ help="Number of past days for initial news discovery. Default: 7.",
115
+ )
116
+ init_parser.add_argument(
117
+ "--initial-news-backfill-daily-max-results",
118
+ type=int,
119
+ help="Maximum news results per day for initial discovery. Default: 20.",
120
+ )
121
+ init_parser.add_argument(
122
+ "--preferred-news-domains",
123
+ help=(
124
+ "Comma-separated preferred news domains for source discovery"
125
+ " (for example: reuters.com,bloomberg.com)."
126
+ ),
127
+ )
128
+ init_parser.add_argument(
129
+ "--excluded-news-domains",
130
+ help=(
131
+ "Comma-separated news domains to exclude from discovered candidates."
132
+ ),
133
+ )
134
+ init_parser.add_argument(
135
+ "--from-onboarding",
136
+ help="Path to onboarding.json for conversational init.",
137
+ )
138
+
139
+
140
+ def handle(args: argparse.Namespace) -> int:
141
+ """init — create a brief workspace."""
142
+ return _init_workspace(args)
143
+
144
+
145
+ def print_tavily_guidance() -> None:
146
+ """Print setup guidance for Tavily live search."""
147
+ print()
148
+ print(
149
+ "Tavily live search is enabled. To use it, set the TAVILY_API_KEY"
150
+ )
151
+ print("environment variable before running the pipeline.")
152
+ print()
153
+ print(
154
+ " Do not paste API keys into chat, config files, README, or GitHub."
155
+ )
156
+ print(" Keys should be stored in environment variables only.")
157
+ print()
158
+ print(
159
+ " Check configuration: briefloop doctor"
160
+ " --config <workspace>/config.yaml"
161
+ )
162
+
163
+
164
+ def print_search_backend_guidance(profile) -> None:
165
+ """Print safe, backend-agnostic web-search setup guidance."""
166
+ backend = getattr(profile, "search_backend", "") or (
167
+ "tavily" if getattr(profile, "tavily_enabled", False) else ""
168
+ )
169
+ mode = getattr(profile, "web_search_mode", "disabled")
170
+ backend_env = {
171
+ "tavily": "TAVILY_API_KEY",
172
+ "exa": "EXA_API_KEY",
173
+ "brave": "BRAVE_SEARCH_API_KEY",
174
+ "firecrawl": "FIRECRAWL_API_KEY",
175
+ "serper": "SERPER_API_KEY",
176
+ }
177
+ if mode == "runtime_tool":
178
+ print()
179
+ print(
180
+ "Runtime web search is enabled. Make sure your execution runtime"
181
+ " provides a web-search tool."
182
+ )
183
+ print(
184
+ " Check configuration: briefloop doctor"
185
+ " --config <workspace>/config.yaml"
186
+ )
187
+ return
188
+ if mode == "configure_later":
189
+ print()
190
+ print("Web search is marked for later configuration.")
191
+ print(
192
+ " Supported backends: tavily, exa, brave, firecrawl, serper"
193
+ )
194
+ print(
195
+ " Set one API key in .env or export it in your shell, then set"
196
+ " web_search.backend in sources.yaml."
197
+ )
198
+ print(
199
+ " Do not paste API keys into chat, config files, README, or"
200
+ " GitHub."
201
+ )
202
+ return
203
+ if mode == "external_api" and backend:
204
+ env_var = backend_env.get(backend, "the backend API key env var")
205
+ print()
206
+ print(
207
+ f"Web search backend '{backend}' is enabled. Set {env_var} in"
208
+ " .env or your shell before running the pipeline."
209
+ )
210
+ print(
211
+ " Supported backends: tavily, exa, brave, firecrawl, serper"
212
+ )
213
+ print(
214
+ " Do not paste API keys into chat, config files, README, or"
215
+ " GitHub."
216
+ )
217
+ print(
218
+ " Check configuration: briefloop doctor"
219
+ " --config <workspace>/config.yaml"
220
+ )
221
+
222
+
223
+ def print_context_reference_guidance(target: Path, language: str = "en-US") -> None:
224
+ """Tell users where prior briefs and example reports belong."""
225
+ context_dir = (target / "input" / "context").as_posix()
226
+ if language == "zh-CN":
227
+ print()
228
+ print(
229
+ "提示:请在"
230
+ f" {context_dir} 里加入你的简报示例 Markdown 文件"
231
+ "(例如往期周报)。"
232
+ )
233
+ print(" 它只作为结构、口吻和版式参考,不进入 Claim Ledger。")
234
+ return
235
+ if language == "bilingual":
236
+ print_context_reference_guidance(target, "zh-CN")
237
+ print_context_reference_guidance(target, "en-US")
238
+ return
239
+ print()
240
+ print(
241
+ "Tip: add example brief Markdown files, such as prior weekly reports,"
242
+ f" to {context_dir}."
243
+ )
244
+ print(" They are style/context references only and do not enter the Claim Ledger.")
245
+
246
+
247
+ def _apply_cli_overrides(profile, args: argparse.Namespace) -> None:
248
+ """Apply explicit CLI args onto a profile built from onboarding.
249
+
250
+ Only overrides fields where the CLI arg is non-None / truthy.
251
+ """
252
+ from multi_agent_brief.cli.init_wizard import (
253
+ normalize_language,
254
+ parse_list_arg,
255
+ parse_int,
256
+ apply_rag_args,
257
+ )
258
+
259
+ if getattr(args, "language", None):
260
+ lang = normalize_language(args.language)
261
+ profile.interface_language = lang
262
+ profile.output_language = lang
263
+ if getattr(args, "output_language", None):
264
+ profile.output_language = normalize_language(args.output_language)
265
+ if getattr(args, "company", None):
266
+ profile.company = args.company
267
+ if getattr(args, "role", None):
268
+ profile.role = args.role
269
+ if getattr(args, "industry", None):
270
+ profile.industry = args.industry
271
+ if getattr(args, "title", None):
272
+ profile.brief_title = args.title
273
+ if getattr(args, "audience", None):
274
+ profile.audience = args.audience
275
+ focus = parse_list_arg(getattr(args, "focus_areas", None))
276
+ if focus:
277
+ profile.focus_areas = focus
278
+ if getattr(args, "cadence", None):
279
+ profile.cadence = args.cadence
280
+ if getattr(args, "selector_max_items", None) is not None:
281
+ profile.selector_max_items = args.selector_max_items
282
+ apply_rag_args(
283
+ profile,
284
+ getattr(args, "rag", None),
285
+ getattr(args, "retrieval_provider", None),
286
+ )
287
+ formats = parse_list_arg(getattr(args, "output_formats", None))
288
+ if formats:
289
+ profile.output_formats = formats
290
+ if getattr(args, "source_profile", None):
291
+ profile.source_profile = args.source_profile
292
+ if getattr(args, "web_search_mode", None):
293
+ profile.web_search_mode = args.web_search_mode
294
+ profile.web_search_enabled = args.web_search_mode != "disabled"
295
+ if getattr(args, "search_backend", None):
296
+ profile.search_backend = args.search_backend
297
+ profile.web_search_mode = "external_api"
298
+ profile.web_search_enabled = True
299
+ profile.tavily_enabled = args.search_backend == "tavily"
300
+ if getattr(args, "tavily", False):
301
+ profile.tavily_enabled = True
302
+ profile.web_search_enabled = True
303
+ profile.web_search_mode = "external_api"
304
+ profile.search_backend = "tavily"
305
+ if getattr(args, "initial_news_backfill", False):
306
+ profile.initial_news_backfill_enabled = True
307
+ if getattr(args, "initial_news_backfill_days", None):
308
+ profile.initial_news_backfill_days = parse_int(
309
+ str(args.initial_news_backfill_days),
310
+ profile.initial_news_backfill_days,
311
+ )
312
+ if getattr(args, "initial_news_backfill_daily_max_results", None):
313
+ profile.initial_news_backfill_daily_max_results = parse_int(
314
+ str(args.initial_news_backfill_daily_max_results),
315
+ profile.initial_news_backfill_daily_max_results,
316
+ )
317
+ preferred_domains = parse_list_arg(getattr(args, "preferred_news_domains", None))
318
+ if preferred_domains:
319
+ profile.preferred_news_domains = preferred_domains
320
+ excluded_domains = parse_list_arg(getattr(args, "excluded_news_domains", None))
321
+ if excluded_domains:
322
+ profile.excluded_news_domains = excluded_domains
323
+
324
+
325
+ def _profile_option_errors(profile) -> list[str]:
326
+ """Return errors for option combinations that cannot produce runnable config."""
327
+ errors: list[str] = []
328
+ selector_max_items = getattr(profile, "selector_max_items", None)
329
+ if not isinstance(selector_max_items, int) or selector_max_items < 20:
330
+ errors.append(
331
+ "--selector-max-items must be at least 20 because generated workspaces "
332
+ "set brief_quality.min_items to 20."
333
+ )
334
+ if (
335
+ getattr(profile, "initial_news_backfill_enabled", False)
336
+ and getattr(profile, "source_profile", "") != "llm_decide"
337
+ ):
338
+ errors.append(
339
+ "--initial-news-backfill requires --source-profile llm_decide "
340
+ "because it runs through sources decide and source_discovery."
341
+ )
342
+ return errors
343
+
344
+
345
+ def _print_profile_option_errors(errors: list[str]) -> None:
346
+ print("[error] Incompatible init options.")
347
+ for error in errors:
348
+ print(f" {error}")
349
+
350
+
351
+ def _init_workspace(args: argparse.Namespace) -> int:
352
+ """Create a brief workspace from onboarding or CLI args."""
353
+ from multi_agent_brief.cli.init_wizard import (
354
+ InitOnboardingRequired,
355
+ _is_interactive,
356
+ build_profile_from_args,
357
+ create_demo_workspace,
358
+ create_workspace,
359
+ has_direct_init_args,
360
+ missing_required_direct_init_args,
361
+ )
362
+ from multi_agent_brief.onboarding.io import load_onboarding_result
363
+ from multi_agent_brief.onboarding.mapper import map_onboarding_to_profile
364
+
365
+ # Priority: explicit CLI target > onboarding.target > default "brief-workspace"
366
+ if args.demo:
367
+ target = Path(args.target)
368
+ create_demo_workspace(target, force=args.force)
369
+ print(f"Created demo workspace: {target}")
370
+ print_context_reference_guidance(target, "en-US")
371
+ print(
372
+ "Demo only — sample data for feature exploration, not a real"
373
+ " brief workspace."
374
+ )
375
+ print("For a real brief workspace:")
376
+ print(" briefloop onboard")
377
+ print(
378
+ " briefloop init <workspace> --from-onboarding"
379
+ " onboarding.json"
380
+ )
381
+ return 0
382
+
383
+ from_onboarding = getattr(args, "from_onboarding", None)
384
+ if from_onboarding:
385
+ onboarding = load_onboarding_result(from_onboarding)
386
+ profile = map_onboarding_to_profile(onboarding)
387
+
388
+ # Validate required fields — agent must not pass empty/sentinel values
389
+ missing_onboarding: list[str] = []
390
+ if not profile.company:
391
+ missing_onboarding.append("company_or_org")
392
+ if not profile.industry_text:
393
+ missing_onboarding.append("industry_or_theme")
394
+ if not profile.task_objective and not profile.brief_title:
395
+ missing_onboarding.append("task_objective")
396
+ if missing_onboarding:
397
+ print(
398
+ "[error] Onboarding data is incomplete. Required fields are"
399
+ " missing or empty:"
400
+ )
401
+ for f in missing_onboarding:
402
+ print(f" - {f}")
403
+ print(
404
+ " Supported field names: company_or_org,"
405
+ " industry_or_theme, task_objective,"
406
+ )
407
+ print(
408
+ " audience_plain, language_plain, cadence_plain,"
409
+ " source_style_plain,"
410
+ )
411
+ print(
412
+ " output_style_plain, must_watch, forbidden_sources,"
413
+ " tavily_enabled"
414
+ )
415
+ print(
416
+ " Aliases accepted: company, industry, title,"
417
+ " audience, language, cadence, etc."
418
+ )
419
+ print(" Run conversational onboarding:")
420
+ print(" briefloop onboard")
421
+ print(" Then create the workspace:")
422
+ print(
423
+ " briefloop init <workspace>"
424
+ " --from-onboarding onboarding.json"
425
+ )
426
+ return 1
427
+
428
+ # Apply any explicit CLI overrides on top of onboarding values
429
+ _apply_cli_overrides(profile, args)
430
+ # CLI target overrides onboarding.target
431
+ cli_target = args.target
432
+ default_target = "brief-workspace"
433
+ if cli_target and cli_target != default_target:
434
+ target = Path(cli_target)
435
+ elif onboarding.target and onboarding.target != "brief-workspace":
436
+ target = Path(onboarding.target)
437
+ else:
438
+ target = Path(default_target)
439
+ else:
440
+ missing = missing_required_direct_init_args(args)
441
+ if missing and has_direct_init_args(args):
442
+ print("[error] Direct init with CLI args is incomplete.")
443
+ print(" Run conversational onboarding:")
444
+ print(" briefloop onboard")
445
+ print(" Then create the workspace:")
446
+ print(
447
+ " briefloop init <workspace>"
448
+ " --from-onboarding onboarding.json"
449
+ )
450
+ print(
451
+ " Developer-only direct init must provide all"
452
+ " business fields:"
453
+ )
454
+ print(f" missing: {', '.join(missing)}")
455
+ return 1
456
+ if not _is_interactive() and missing:
457
+ print(
458
+ "[error] Non-interactive init cannot create a workspace from"
459
+ " defaults."
460
+ )
461
+ print(" Run conversational onboarding:")
462
+ print(" briefloop onboard")
463
+ print(" Then create the workspace:")
464
+ print(
465
+ " briefloop init <workspace>"
466
+ " --from-onboarding onboarding.json"
467
+ )
468
+ print(
469
+ " Developer-only direct init must provide all"
470
+ " business fields:"
471
+ )
472
+ print(f" missing: {', '.join(missing)}")
473
+ return 1
474
+ target = Path(args.target)
475
+ try:
476
+ profile = build_profile_from_args(args)
477
+ except InitOnboardingRequired as exc:
478
+ print(f"[error] {exc}")
479
+ print(" Run conversational onboarding:")
480
+ print(" briefloop onboard")
481
+ print(
482
+ " Then: briefloop init <workspace>"
483
+ " --from-onboarding onboarding.json"
484
+ )
485
+ return 1
486
+
487
+ option_errors = _profile_option_errors(profile)
488
+ if option_errors:
489
+ _print_profile_option_errors(option_errors)
490
+ return 1
491
+
492
+ create_workspace(target, profile, force=args.force)
493
+ print(f"Created brief workspace: {target}")
494
+ print_context_reference_guidance(target, profile.interface_language)
495
+ print(f"Next: briefloop run --workspace {target}")
496
+ print(
497
+ "Hermes prompt: briefloop hermes prompt"
498
+ f" --config {target}/config.yaml"
499
+ )
500
+
501
+ # Print web-search setup guidance if enabled
502
+ if getattr(profile, "web_search_enabled", False) or getattr(
503
+ profile, "tavily_enabled", False
504
+ ):
505
+ print_search_backend_guidance(profile)
506
+
507
+ # Auto-recommend capabilities based on profile
508
+ _print_capability_recommendations(target, profile)
509
+
510
+ return 0
511
+
512
+
513
+ def _print_capability_recommendations(target: Path, profile) -> None:
514
+ """Recommend capabilities based on workspace profile and print suggestions."""
515
+ from multi_agent_brief.capabilities.recommend import (
516
+ recommend_from_text,
517
+ recommend_from_input_dir,
518
+ )
519
+
520
+ # Build text from profile
521
+ text_parts = []
522
+ if getattr(profile, "company", None):
523
+ text_parts.append(profile.company)
524
+ if getattr(profile, "industry_text", None):
525
+ text_parts.append(profile.industry_text)
526
+ if getattr(profile, "brief_title", None):
527
+ text_parts.append(profile.brief_title)
528
+ if getattr(profile, "task_objective", None):
529
+ text_parts.append(profile.task_objective)
530
+ focus = getattr(profile, "focus_areas", None)
531
+ if focus:
532
+ text_parts.extend(focus if isinstance(focus, list) else [focus])
533
+
534
+ combined_text = " ".join(text_parts)
535
+ if not combined_text:
536
+ return
537
+
538
+ # Get enabled providers from the workspace we just created
539
+ enabled_providers = set()
540
+ sources_path = target / "sources.yaml"
541
+ if sources_path.exists():
542
+ try:
543
+ from multi_agent_brief.sources.registry import load_sources_config
544
+
545
+ sc = load_sources_config(sources_path)
546
+ enabled_providers = set(sc.enabled_providers)
547
+ except Exception:
548
+ pass
549
+
550
+ # Run text + input recommendations
551
+ recs = recommend_from_text(combined_text, enabled_providers)
552
+ recs += recommend_from_input_dir(target / "input", enabled_providers)
553
+
554
+ if not recs:
555
+ return
556
+
557
+ print()
558
+ print("Recommended capabilities for your workspace:")
559
+ for rec in recs:
560
+ print(f" → {rec.capability_id}: {rec.reason}")
561
+ print()
562
+ print("To enable recommended features:")
563
+ print(f" briefloop setup {target}")
564
+ print()