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,66 @@
|
|
|
1
|
+
"""Runtime-state contract loading helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from multi_agent_brief.orchestrator.runtime_state._io import _load_yaml
|
|
9
|
+
from multi_agent_brief.orchestrator.runtime_state.errors import RuntimeStateError
|
|
10
|
+
from multi_agent_brief.orchestrator_contract import CONTRACT_REFERENCES
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _contract_file(repo_workdir: Path, rel_path: str) -> Path:
|
|
14
|
+
path = repo_workdir / rel_path
|
|
15
|
+
if not path.exists():
|
|
16
|
+
raise RuntimeStateError(
|
|
17
|
+
f"Contract file not found: {path}",
|
|
18
|
+
details={"contract": rel_path, "repo_workdir": str(repo_workdir)},
|
|
19
|
+
)
|
|
20
|
+
return path
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def load_stage_specs(repo_workdir: str | Path) -> list[dict[str, Any]]:
|
|
24
|
+
repo = Path(repo_workdir).expanduser().resolve()
|
|
25
|
+
data = _load_yaml(_contract_file(repo, CONTRACT_REFERENCES["stage_specs"]))
|
|
26
|
+
stages = ((data.get("workflow") or {}).get("stages") or [])
|
|
27
|
+
if not isinstance(stages, list):
|
|
28
|
+
raise RuntimeStateError("stage_specs.yaml workflow.stages must be a list")
|
|
29
|
+
return [stage for stage in stages if isinstance(stage, dict)]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def load_artifact_contracts(repo_workdir: str | Path) -> list[dict[str, Any]]:
|
|
33
|
+
repo = Path(repo_workdir).expanduser().resolve()
|
|
34
|
+
data = _load_yaml(_contract_file(repo, CONTRACT_REFERENCES["artifact_contracts"]))
|
|
35
|
+
artifacts = data.get("artifacts") or []
|
|
36
|
+
if not isinstance(artifacts, list):
|
|
37
|
+
raise RuntimeStateError("artifact_contracts.yaml artifacts must be a list")
|
|
38
|
+
return [artifact for artifact in artifacts if isinstance(artifact, dict)]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def load_default_policy_pack(repo_workdir: str | Path) -> dict[str, Any]:
|
|
42
|
+
repo = Path(repo_workdir).expanduser().resolve()
|
|
43
|
+
data = _load_yaml(_contract_file(repo, CONTRACT_REFERENCES["default_policy_pack"]))
|
|
44
|
+
if not isinstance(data, dict):
|
|
45
|
+
raise RuntimeStateError("policy_packs/default.yaml must contain an object")
|
|
46
|
+
return data
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _stage_ids(stages: list[dict[str, Any]]) -> list[str]:
|
|
50
|
+
return [str(stage["stage_id"]) for stage in stages if stage.get("stage_id")]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _artifact_ids(artifacts: list[dict[str, Any]]) -> set[str]:
|
|
54
|
+
return {
|
|
55
|
+
str(artifact["artifact_id"])
|
|
56
|
+
for artifact in artifacts
|
|
57
|
+
if artifact.get("artifact_id")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _artifact_map(artifacts: list[dict[str, Any]]) -> dict[str, dict[str, Any]]:
|
|
62
|
+
return {
|
|
63
|
+
str(artifact["artifact_id"]): artifact
|
|
64
|
+
for artifact in artifacts
|
|
65
|
+
if artifact.get("artifact_id")
|
|
66
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"""Decision recording for runtime workflow state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from multi_agent_brief.orchestrator_contract import DECISION_VOCABULARY, resolve_repo_workdir
|
|
9
|
+
from multi_agent_brief.orchestrator.runtime_state._io import _write_json_atomic
|
|
10
|
+
from multi_agent_brief.orchestrator.runtime_state._transactions import _load_manifest_and_workflow
|
|
11
|
+
from multi_agent_brief.orchestrator.runtime_state.contracts_loader import (
|
|
12
|
+
load_artifact_contracts,
|
|
13
|
+
load_stage_specs,
|
|
14
|
+
)
|
|
15
|
+
from multi_agent_brief.orchestrator.runtime_state.errors import (
|
|
16
|
+
E_COMPLETION_TRANSACTION_REQUIRED,
|
|
17
|
+
E_ILLEGAL_TRANSITION,
|
|
18
|
+
RuntimeStateError,
|
|
19
|
+
)
|
|
20
|
+
from multi_agent_brief.orchestrator.runtime_state.event_log import (
|
|
21
|
+
_read_event_log_records,
|
|
22
|
+
append_event,
|
|
23
|
+
)
|
|
24
|
+
from multi_agent_brief.orchestrator.runtime_state.identity import utc_now
|
|
25
|
+
from multi_agent_brief.orchestrator.runtime_state.lifecycle import (
|
|
26
|
+
initialize_runtime_state,
|
|
27
|
+
show_runtime_state,
|
|
28
|
+
)
|
|
29
|
+
from multi_agent_brief.orchestrator.runtime_state.paths import (
|
|
30
|
+
_require_workspace,
|
|
31
|
+
runtime_state_paths,
|
|
32
|
+
)
|
|
33
|
+
from multi_agent_brief.orchestrator.runtime_state.repair import _delegate_repair_transaction_required_error
|
|
34
|
+
from multi_agent_brief.orchestrator.runtime_state.trajectory import (
|
|
35
|
+
TRAJECTORY_DECISION_NARROWING_STATUS,
|
|
36
|
+
TRAJECTORY_NARROWED_DECISIONS,
|
|
37
|
+
_trajectory_decision_narrowing,
|
|
38
|
+
_trajectory_narrowing_changed,
|
|
39
|
+
_workflow_with_trajectory_decision_narrowing,
|
|
40
|
+
)
|
|
41
|
+
from multi_agent_brief.orchestrator.runtime_state.workflow import (
|
|
42
|
+
STAGE_BLOCKED,
|
|
43
|
+
STAGE_COMPLETE,
|
|
44
|
+
STAGE_READY,
|
|
45
|
+
_allowed_decisions_for_stage,
|
|
46
|
+
_next_stage_id,
|
|
47
|
+
_status_entry,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def record_decision(
|
|
52
|
+
*,
|
|
53
|
+
workspace: str | Path,
|
|
54
|
+
stage_id: str,
|
|
55
|
+
decision: str,
|
|
56
|
+
reason: str,
|
|
57
|
+
repo_workdir: str | Path | None = None,
|
|
58
|
+
actor: str = "orchestrator",
|
|
59
|
+
) -> dict[str, Any]:
|
|
60
|
+
ws = _require_workspace(workspace)
|
|
61
|
+
paths = runtime_state_paths(ws)
|
|
62
|
+
if not paths["runtime_manifest"].exists() or not paths["workflow_state"].exists():
|
|
63
|
+
initialize_runtime_state(workspace=ws, repo_workdir=repo_workdir, actor=actor)
|
|
64
|
+
|
|
65
|
+
ws, paths, manifest, workflow = _load_manifest_and_workflow(ws)
|
|
66
|
+
workflow_before_decision = dict(workflow)
|
|
67
|
+
repo = resolve_repo_workdir(repo_workdir, workspace=ws)
|
|
68
|
+
stages = load_stage_specs(repo)
|
|
69
|
+
artifacts = load_artifact_contracts(repo)
|
|
70
|
+
stage_by_id = {str(stage.get("stage_id")): stage for stage in stages}
|
|
71
|
+
if stage_id not in stage_by_id:
|
|
72
|
+
raise RuntimeStateError(
|
|
73
|
+
f"Unknown stage: {stage_id}",
|
|
74
|
+
details={"stage_id": stage_id, "known_stages": list(stage_by_id)},
|
|
75
|
+
)
|
|
76
|
+
if decision not in DECISION_VOCABULARY:
|
|
77
|
+
raise RuntimeStateError(
|
|
78
|
+
f"Unknown Orchestrator decision: {decision}",
|
|
79
|
+
details={
|
|
80
|
+
"decision": decision,
|
|
81
|
+
"allowed_decisions": list(DECISION_VOCABULARY),
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
stage_allowed = [
|
|
85
|
+
str(item) for item in (stage_by_id[stage_id].get("allowed_decisions") or [])
|
|
86
|
+
]
|
|
87
|
+
if decision not in stage_allowed:
|
|
88
|
+
raise RuntimeStateError(
|
|
89
|
+
f"Decision '{decision}' is not allowed for stage '{stage_id}'.",
|
|
90
|
+
details={
|
|
91
|
+
"stage_id": stage_id,
|
|
92
|
+
"decision": decision,
|
|
93
|
+
"stage_allowed_decisions": stage_allowed,
|
|
94
|
+
},
|
|
95
|
+
)
|
|
96
|
+
current_stage_before = workflow.get("current_stage")
|
|
97
|
+
if current_stage_before is None:
|
|
98
|
+
raise RuntimeStateError(
|
|
99
|
+
"Cannot record a decision because the workflow has no current stage.",
|
|
100
|
+
details={"stage_id": stage_id, "decision": decision},
|
|
101
|
+
)
|
|
102
|
+
if stage_id != current_stage_before:
|
|
103
|
+
raise RuntimeStateError(
|
|
104
|
+
f"Decision stage '{stage_id}' does not match current stage '{current_stage_before}'.",
|
|
105
|
+
details={
|
|
106
|
+
"stage_id": stage_id,
|
|
107
|
+
"current_stage": current_stage_before,
|
|
108
|
+
"decision": decision,
|
|
109
|
+
},
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
run_id = str(manifest["run_id"])
|
|
113
|
+
event_records = _read_event_log_records(paths["event_log"])
|
|
114
|
+
existing_narrowing = _trajectory_decision_narrowing(
|
|
115
|
+
workspace=ws,
|
|
116
|
+
workflow=workflow,
|
|
117
|
+
event_records=event_records,
|
|
118
|
+
run_id=run_id,
|
|
119
|
+
)
|
|
120
|
+
if existing_narrowing and decision not in TRAJECTORY_NARROWED_DECISIONS:
|
|
121
|
+
raise RuntimeStateError(
|
|
122
|
+
f"Decision '{decision}' is blocked because trajectory regulation narrowed current-stage decisions.",
|
|
123
|
+
details={
|
|
124
|
+
"stage_id": stage_id,
|
|
125
|
+
"decision": decision,
|
|
126
|
+
"allowed_decisions": list(TRAJECTORY_NARROWED_DECISIONS),
|
|
127
|
+
"trajectory_regulation": existing_narrowing,
|
|
128
|
+
},
|
|
129
|
+
error_code=E_ILLEGAL_TRANSITION,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if decision == "delegate_repair":
|
|
133
|
+
raise _delegate_repair_transaction_required_error(
|
|
134
|
+
workspace=ws,
|
|
135
|
+
stage_id=stage_id,
|
|
136
|
+
decision=decision,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
if decision in {"continue", "finalize"}:
|
|
140
|
+
command = "finalize-complete" if decision == "finalize" else "stage-complete"
|
|
141
|
+
raise RuntimeStateError(
|
|
142
|
+
(
|
|
143
|
+
f"Decision '{decision}' must be recorded with `multi-agent-brief state {command}`. "
|
|
144
|
+
"`state decide` is reserved for retry_stage, delegate_repair, request_human_review, and block_run."
|
|
145
|
+
),
|
|
146
|
+
details={
|
|
147
|
+
"stage_id": stage_id,
|
|
148
|
+
"decision": decision,
|
|
149
|
+
"required_command": command,
|
|
150
|
+
},
|
|
151
|
+
error_code=E_COMPLETION_TRANSACTION_REQUIRED,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
now = utc_now()
|
|
155
|
+
statuses = dict(workflow.get("stage_statuses") or {})
|
|
156
|
+
blocked = False
|
|
157
|
+
blocking_reason = ""
|
|
158
|
+
current_stage: str | None = stage_id
|
|
159
|
+
|
|
160
|
+
if decision in {"continue", "finalize"}:
|
|
161
|
+
statuses[stage_id] = _status_entry(STAGE_COMPLETE, reason, now)
|
|
162
|
+
next_stage = _next_stage_id(stages, stage_id)
|
|
163
|
+
if next_stage and decision != "finalize":
|
|
164
|
+
statuses[next_stage] = _status_entry(STAGE_READY, "", now)
|
|
165
|
+
current_stage = next_stage
|
|
166
|
+
else:
|
|
167
|
+
current_stage = None
|
|
168
|
+
elif decision == "retry_stage":
|
|
169
|
+
statuses[stage_id] = _status_entry(STAGE_READY, reason, now)
|
|
170
|
+
elif decision in {"request_human_review", "block_run"}:
|
|
171
|
+
statuses[stage_id] = _status_entry(STAGE_BLOCKED, reason, now)
|
|
172
|
+
blocked = True
|
|
173
|
+
blocking_reason = reason
|
|
174
|
+
|
|
175
|
+
workflow["updated_at"] = now
|
|
176
|
+
workflow["current_stage"] = current_stage
|
|
177
|
+
workflow["blocked"] = blocked
|
|
178
|
+
workflow["blocking_reason"] = blocking_reason
|
|
179
|
+
workflow["stage_statuses"] = statuses
|
|
180
|
+
workflow["last_decision"] = {
|
|
181
|
+
"stage_id": stage_id,
|
|
182
|
+
"decision": decision,
|
|
183
|
+
"reason": reason,
|
|
184
|
+
"created_at": now,
|
|
185
|
+
}
|
|
186
|
+
decision_metadata = {"next_stage": current_stage}
|
|
187
|
+
post_decision_events = [
|
|
188
|
+
*event_records,
|
|
189
|
+
{
|
|
190
|
+
"run_id": run_id,
|
|
191
|
+
"event_type": "decision_recorded",
|
|
192
|
+
"stage_id": stage_id,
|
|
193
|
+
"decision": decision,
|
|
194
|
+
"reason": reason,
|
|
195
|
+
"metadata": decision_metadata,
|
|
196
|
+
},
|
|
197
|
+
]
|
|
198
|
+
workflow = _workflow_with_trajectory_decision_narrowing(
|
|
199
|
+
workspace=ws,
|
|
200
|
+
workflow=workflow,
|
|
201
|
+
stages=stages,
|
|
202
|
+
event_records=post_decision_events,
|
|
203
|
+
run_id=run_id,
|
|
204
|
+
)
|
|
205
|
+
trajectory_narrowing_changed = _trajectory_narrowing_changed(
|
|
206
|
+
workflow_before_decision,
|
|
207
|
+
workflow,
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
append_event(
|
|
211
|
+
workspace=ws,
|
|
212
|
+
run_id=run_id,
|
|
213
|
+
event_type="decision_recorded",
|
|
214
|
+
actor=actor,
|
|
215
|
+
stage_id=stage_id,
|
|
216
|
+
decision=decision,
|
|
217
|
+
reason=reason,
|
|
218
|
+
metadata=decision_metadata,
|
|
219
|
+
)
|
|
220
|
+
narrowing = workflow.get("trajectory_regulation")
|
|
221
|
+
if (
|
|
222
|
+
trajectory_narrowing_changed
|
|
223
|
+
and isinstance(narrowing, dict)
|
|
224
|
+
and narrowing.get("status") == TRAJECTORY_DECISION_NARROWING_STATUS
|
|
225
|
+
):
|
|
226
|
+
append_event(
|
|
227
|
+
workspace=ws,
|
|
228
|
+
run_id=run_id,
|
|
229
|
+
event_type="trajectory_decision_narrowed",
|
|
230
|
+
actor=actor,
|
|
231
|
+
stage_id=str(narrowing.get("stage_id") or stage_id),
|
|
232
|
+
reason=", ".join(str(item) for item in narrowing.get("reasons") or []),
|
|
233
|
+
metadata={
|
|
234
|
+
"allowed_decisions": list(narrowing.get("allowed_decisions") or []),
|
|
235
|
+
"recommended_actions": list(narrowing.get("recommended_actions") or []),
|
|
236
|
+
},
|
|
237
|
+
)
|
|
238
|
+
_write_json_atomic(paths["workflow_state"], workflow)
|
|
239
|
+
return show_runtime_state(workspace=ws)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Runtime-state errors and error-code constants."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
E_STAGE_ALREADY_COMPLETED = "E_STAGE_ALREADY_COMPLETED"
|
|
9
|
+
E_STAGE_MISMATCH = "E_STAGE_MISMATCH"
|
|
10
|
+
E_REQUIRED_ARTIFACT_MISSING = "E_REQUIRED_ARTIFACT_MISSING"
|
|
11
|
+
E_ARTIFACT_INVALID = "E_ARTIFACT_INVALID"
|
|
12
|
+
E_CLAIM_DRAFT_CONTRACT_INVALID = "E_CLAIM_DRAFT_CONTRACT_INVALID"
|
|
13
|
+
E_ILLEGAL_TRANSITION = "E_ILLEGAL_TRANSITION"
|
|
14
|
+
E_MANIFEST_EXTENSION_LOST = "E_MANIFEST_EXTENSION_LOST"
|
|
15
|
+
E_TRANSACTION_PARTIAL_WRITE = "E_TRANSACTION_PARTIAL_WRITE"
|
|
16
|
+
E_TRANSACTION_INTEGRITY = "E_TRANSACTION_INTEGRITY"
|
|
17
|
+
E_RUNTIME_STATE_NOT_INITIALIZED = "E_RUNTIME_STATE_NOT_INITIALIZED"
|
|
18
|
+
E_RUN_ARCHIVE_FAILED = "E_RUN_ARCHIVE_FAILED"
|
|
19
|
+
E_FACT_LAYER_IMPORT_INVALID = "E_FACT_LAYER_IMPORT_INVALID"
|
|
20
|
+
E_QUALITY_GATE_REQUIRED = "E_QUALITY_GATE_REQUIRED"
|
|
21
|
+
E_READER_FINAL_GATE_FAILED = "E_READER_FINAL_GATE_FAILED"
|
|
22
|
+
E_COMPLETION_TRANSACTION_REQUIRED = "E_COMPLETION_TRANSACTION_REQUIRED"
|
|
23
|
+
E_REPAIR_TRANSACTION_REQUIRED = "E_REPAIR_TRANSACTION_REQUIRED"
|
|
24
|
+
E_REPAIR_IMPORTED_FACT_LAYER_FORBIDDEN = "E_REPAIR_IMPORTED_FACT_LAYER_FORBIDDEN"
|
|
25
|
+
E_REPAIR_NO_LEGAL_ROUTE = "E_REPAIR_NO_LEGAL_ROUTE"
|
|
26
|
+
E_FROZEN_GATE_REPORT_ALREADY_EXISTS = "E_FROZEN_GATE_REPORT_ALREADY_EXISTS"
|
|
27
|
+
E_ACTIVE_REPAIR_OPEN = "E_ACTIVE_REPAIR_OPEN"
|
|
28
|
+
E_ASSESSMENT_TARGET_COMPLETE = "E_ASSESSMENT_TARGET_COMPLETE"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RuntimeStateError(Exception):
|
|
32
|
+
"""Raised when runtime state cannot be read or written safely."""
|
|
33
|
+
|
|
34
|
+
def __init__(
|
|
35
|
+
self,
|
|
36
|
+
message: str,
|
|
37
|
+
*,
|
|
38
|
+
details: dict[str, Any] | None = None,
|
|
39
|
+
error_code: str | None = None,
|
|
40
|
+
) -> None:
|
|
41
|
+
super().__init__(message)
|
|
42
|
+
self.details = details or {}
|
|
43
|
+
self.error_code = error_code
|
|
44
|
+
|
|
45
|
+
def to_dict(self) -> dict[str, Any]:
|
|
46
|
+
payload = {
|
|
47
|
+
"ok": False,
|
|
48
|
+
"error": str(self),
|
|
49
|
+
"details": self.details,
|
|
50
|
+
}
|
|
51
|
+
if self.error_code:
|
|
52
|
+
payload["error_code"] = self.error_code
|
|
53
|
+
return payload
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _wrap_archive_error(exc: Any) -> RuntimeStateError:
|
|
57
|
+
return RuntimeStateError(
|
|
58
|
+
str(exc),
|
|
59
|
+
details=getattr(exc, "details", {}),
|
|
60
|
+
error_code=getattr(exc, "error_code", None) or E_RUN_ARCHIVE_FAILED,
|
|
61
|
+
)
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"""Event-log helpers for Orchestrator runtime state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import uuid
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from multi_agent_brief.orchestrator.run_integrity import (
|
|
11
|
+
workflow_with_persistable_run_integrity as _workflow_with_persistable_run_integrity,
|
|
12
|
+
)
|
|
13
|
+
from multi_agent_brief.orchestrator.runtime_state._io import (
|
|
14
|
+
_append_jsonl,
|
|
15
|
+
_read_json_if_exists,
|
|
16
|
+
)
|
|
17
|
+
from multi_agent_brief.orchestrator.runtime_state.errors import (
|
|
18
|
+
E_RUNTIME_STATE_NOT_INITIALIZED,
|
|
19
|
+
E_TRANSACTION_INTEGRITY,
|
|
20
|
+
RuntimeStateError,
|
|
21
|
+
)
|
|
22
|
+
from multi_agent_brief.orchestrator.runtime_state.identity import _validate_runtime_run_id, utc_now
|
|
23
|
+
from multi_agent_brief.orchestrator.runtime_state.manifest import RUNTIME_MANIFEST_SCHEMA
|
|
24
|
+
from multi_agent_brief.orchestrator.runtime_state.paths import (
|
|
25
|
+
_require_workspace,
|
|
26
|
+
_workspace_relative,
|
|
27
|
+
runtime_state_paths,
|
|
28
|
+
)
|
|
29
|
+
from multi_agent_brief.orchestrator.runtime_state.workflow import WORKFLOW_STATE_SCHEMA
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
EVENT_LOG_SCHEMA = "multi-agent-brief-event-log/v1"
|
|
33
|
+
|
|
34
|
+
EVENT_TYPES = {
|
|
35
|
+
"run_initialized",
|
|
36
|
+
"handoff_written",
|
|
37
|
+
"artifact_observed",
|
|
38
|
+
"artifact_validated",
|
|
39
|
+
"stage_status_changed",
|
|
40
|
+
"stage_satisfied_by_topology",
|
|
41
|
+
"decision_recorded",
|
|
42
|
+
"feedback_issue_created",
|
|
43
|
+
"feedback_issue_planned",
|
|
44
|
+
"feedback_issue_resolved",
|
|
45
|
+
"repair_plan_created",
|
|
46
|
+
"repair_plan_completed",
|
|
47
|
+
"repair_started",
|
|
48
|
+
"repair_completed",
|
|
49
|
+
"quality_gate_checked",
|
|
50
|
+
"quality_gate_blocked",
|
|
51
|
+
"quality_gate_passed",
|
|
52
|
+
"provenance_graph_built",
|
|
53
|
+
"provenance_graph_validated",
|
|
54
|
+
"provenance_graph_invalid",
|
|
55
|
+
"audience_profile_snapshot_created",
|
|
56
|
+
"control_switchboard_built",
|
|
57
|
+
"control_switchboard_warning",
|
|
58
|
+
"control_selection_recorded",
|
|
59
|
+
"control_selection_validated",
|
|
60
|
+
"improvement_proposed",
|
|
61
|
+
"improvement_approved",
|
|
62
|
+
"improvement_rejected",
|
|
63
|
+
"improvement_reverted",
|
|
64
|
+
"improvement_memory_snapshot_created",
|
|
65
|
+
"delivery_attempted",
|
|
66
|
+
"delivery_draft_created",
|
|
67
|
+
"delivery_succeeded",
|
|
68
|
+
"delivery_failed",
|
|
69
|
+
"human_approval_ledger_initialized",
|
|
70
|
+
"human_approval_recorded",
|
|
71
|
+
"release_readiness_checked",
|
|
72
|
+
"fact_layer_imported",
|
|
73
|
+
"claim_ledger_frozen",
|
|
74
|
+
"claim_ledger_metadata_enriched",
|
|
75
|
+
"trajectory_decision_narrowed",
|
|
76
|
+
"run_archived",
|
|
77
|
+
"run_blocked",
|
|
78
|
+
"run_integrity_contaminated",
|
|
79
|
+
"run_reset",
|
|
80
|
+
"semantic_assessment_checked_inputs_bound",
|
|
81
|
+
"semantic_support_finding_adjudicated",
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
ACTORS = {"cli", "orchestrator", "runtime", "system"}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _read_event_log_records(path: Path) -> list[dict[str, Any]]:
|
|
88
|
+
if not path.exists():
|
|
89
|
+
return []
|
|
90
|
+
try:
|
|
91
|
+
raw = path.read_bytes()
|
|
92
|
+
except OSError as exc:
|
|
93
|
+
raise RuntimeStateError(
|
|
94
|
+
f"Failed to read event log: {path}",
|
|
95
|
+
details={"path": str(path), "reason": str(exc)},
|
|
96
|
+
) from exc
|
|
97
|
+
if raw and not raw.endswith(b"\n"):
|
|
98
|
+
raise RuntimeStateError(
|
|
99
|
+
f"Event log is not newline-terminated: {path}",
|
|
100
|
+
details={"path": str(path)},
|
|
101
|
+
error_code=E_TRANSACTION_INTEGRITY,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
try:
|
|
105
|
+
decoded = raw.decode("utf-8")
|
|
106
|
+
except UnicodeDecodeError as exc:
|
|
107
|
+
raise RuntimeStateError(
|
|
108
|
+
f"Event log is not valid UTF-8: {path}",
|
|
109
|
+
details={"path": str(path), "reason": str(exc)},
|
|
110
|
+
error_code=E_TRANSACTION_INTEGRITY,
|
|
111
|
+
) from exc
|
|
112
|
+
|
|
113
|
+
records: list[dict[str, Any]] = []
|
|
114
|
+
for lineno, line in enumerate(decoded.splitlines(), start=1):
|
|
115
|
+
if not line.strip():
|
|
116
|
+
continue
|
|
117
|
+
try:
|
|
118
|
+
payload = json.loads(line)
|
|
119
|
+
except json.JSONDecodeError as exc:
|
|
120
|
+
raise RuntimeStateError(
|
|
121
|
+
f"Invalid JSON event log line {lineno}: {path}",
|
|
122
|
+
details={"path": str(path), "line": lineno, "reason": str(exc)},
|
|
123
|
+
error_code=E_TRANSACTION_INTEGRITY,
|
|
124
|
+
) from exc
|
|
125
|
+
if not isinstance(payload, dict):
|
|
126
|
+
raise RuntimeStateError(
|
|
127
|
+
f"Event log line {lineno} must contain an object: {path}",
|
|
128
|
+
details={"path": str(path), "line": lineno},
|
|
129
|
+
error_code=E_TRANSACTION_INTEGRITY,
|
|
130
|
+
)
|
|
131
|
+
schema_version = payload.get("schema_version")
|
|
132
|
+
if schema_version != EVENT_LOG_SCHEMA:
|
|
133
|
+
raise RuntimeStateError(
|
|
134
|
+
f"Unsupported event log schema on line {lineno}: {schema_version}",
|
|
135
|
+
details={"path": str(path), "line": lineno, "schema_version": schema_version},
|
|
136
|
+
error_code=E_TRANSACTION_INTEGRITY,
|
|
137
|
+
)
|
|
138
|
+
event_type = payload.get("event_type")
|
|
139
|
+
if event_type not in EVENT_TYPES:
|
|
140
|
+
raise RuntimeStateError(
|
|
141
|
+
f"Unknown event type on event log line {lineno}: {event_type}",
|
|
142
|
+
details={"path": str(path), "line": lineno, "event_type": event_type},
|
|
143
|
+
error_code=E_TRANSACTION_INTEGRITY,
|
|
144
|
+
)
|
|
145
|
+
actor = payload.get("actor")
|
|
146
|
+
if actor not in ACTORS:
|
|
147
|
+
raise RuntimeStateError(
|
|
148
|
+
f"Unknown event actor on event log line {lineno}: {actor}",
|
|
149
|
+
details={"path": str(path), "line": lineno, "actor": actor},
|
|
150
|
+
error_code=E_TRANSACTION_INTEGRITY,
|
|
151
|
+
)
|
|
152
|
+
records.append(payload)
|
|
153
|
+
return records
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def read_event_log_records_strict(path: str | Path) -> list[dict[str, Any]]:
|
|
157
|
+
"""Read event log records with the runtime transaction-integrity checks."""
|
|
158
|
+
|
|
159
|
+
return _read_event_log_records(Path(path))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def append_event(
|
|
163
|
+
*,
|
|
164
|
+
workspace: str | Path,
|
|
165
|
+
run_id: str,
|
|
166
|
+
event_type: str,
|
|
167
|
+
actor: str,
|
|
168
|
+
stage_id: str | None = None,
|
|
169
|
+
artifact_id: str | None = None,
|
|
170
|
+
decision: str | None = None,
|
|
171
|
+
reason: str = "",
|
|
172
|
+
metadata: dict[str, Any] | None = None,
|
|
173
|
+
) -> dict[str, Any]:
|
|
174
|
+
if event_type not in EVENT_TYPES:
|
|
175
|
+
raise RuntimeStateError(
|
|
176
|
+
f"Unknown event type: {event_type}",
|
|
177
|
+
details={"event_type": event_type},
|
|
178
|
+
)
|
|
179
|
+
if actor not in ACTORS:
|
|
180
|
+
raise RuntimeStateError(
|
|
181
|
+
f"Unknown event actor: {actor}",
|
|
182
|
+
details={"actor": actor},
|
|
183
|
+
)
|
|
184
|
+
safe_run_id = _validate_runtime_run_id(run_id)
|
|
185
|
+
ws = Path(workspace).expanduser().resolve()
|
|
186
|
+
event = {
|
|
187
|
+
"schema_version": EVENT_LOG_SCHEMA,
|
|
188
|
+
"event_id": uuid.uuid4().hex,
|
|
189
|
+
"run_id": safe_run_id,
|
|
190
|
+
"created_at": utc_now(),
|
|
191
|
+
"event_type": event_type,
|
|
192
|
+
"actor": actor,
|
|
193
|
+
"stage_id": stage_id,
|
|
194
|
+
"artifact_id": artifact_id,
|
|
195
|
+
"decision": decision,
|
|
196
|
+
"reason": reason,
|
|
197
|
+
"metadata": metadata or {},
|
|
198
|
+
}
|
|
199
|
+
_append_jsonl(runtime_state_paths(ws)["event_log"], event)
|
|
200
|
+
return event
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _load_handoff_runtime_state(workspace: str | Path) -> tuple[Path, dict[str, Path], dict[str, Any]]:
|
|
204
|
+
ws = _require_workspace(workspace)
|
|
205
|
+
paths = runtime_state_paths(ws)
|
|
206
|
+
manifest = _read_json_if_exists(paths["runtime_manifest"])
|
|
207
|
+
workflow = _read_json_if_exists(paths["workflow_state"])
|
|
208
|
+
if manifest is None or workflow is None:
|
|
209
|
+
raise RuntimeStateError(
|
|
210
|
+
"Runtime state is not initialized. Run `multi-agent-brief state init --workspace <workspace>` first.",
|
|
211
|
+
details={"workspace": str(ws)},
|
|
212
|
+
error_code=E_RUNTIME_STATE_NOT_INITIALIZED,
|
|
213
|
+
)
|
|
214
|
+
if manifest.get("schema_version") != RUNTIME_MANIFEST_SCHEMA:
|
|
215
|
+
raise RuntimeStateError(
|
|
216
|
+
"runtime_manifest.json has an unsupported schema.",
|
|
217
|
+
details={"path": str(paths["runtime_manifest"]), "schema_version": manifest.get("schema_version")},
|
|
218
|
+
)
|
|
219
|
+
manifest["run_id"] = _validate_runtime_run_id(
|
|
220
|
+
manifest.get("run_id"),
|
|
221
|
+
path=paths["runtime_manifest"],
|
|
222
|
+
)
|
|
223
|
+
if workflow.get("schema_version") != WORKFLOW_STATE_SCHEMA:
|
|
224
|
+
raise RuntimeStateError(
|
|
225
|
+
"workflow_state.json has an unsupported schema.",
|
|
226
|
+
details={"path": str(paths["workflow_state"]), "schema_version": workflow.get("schema_version")},
|
|
227
|
+
)
|
|
228
|
+
_workflow_with_persistable_run_integrity(workflow, path=paths["workflow_state"])
|
|
229
|
+
if workflow.get("run_id") is not None:
|
|
230
|
+
_validate_runtime_run_id(
|
|
231
|
+
workflow.get("run_id"),
|
|
232
|
+
path=paths["workflow_state"],
|
|
233
|
+
)
|
|
234
|
+
return ws, paths, manifest
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def record_handoff_written(
|
|
238
|
+
*,
|
|
239
|
+
workspace: str | Path,
|
|
240
|
+
handoff_markdown: str | Path,
|
|
241
|
+
handoff_json: str | Path,
|
|
242
|
+
actor: str = "cli",
|
|
243
|
+
) -> dict[str, Any]:
|
|
244
|
+
ws, _paths, manifest = _load_handoff_runtime_state(workspace)
|
|
245
|
+
run_id = str(manifest["run_id"])
|
|
246
|
+
return append_event(
|
|
247
|
+
workspace=ws,
|
|
248
|
+
run_id=run_id,
|
|
249
|
+
event_type="handoff_written",
|
|
250
|
+
actor=actor,
|
|
251
|
+
reason="Runtime handoff artifacts written.",
|
|
252
|
+
metadata={
|
|
253
|
+
"handoff_markdown": _workspace_relative(ws, Path(handoff_markdown)),
|
|
254
|
+
"handoff_json": _workspace_relative(ws, Path(handoff_json)),
|
|
255
|
+
},
|
|
256
|
+
)
|