loopx 0.4.8__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.
- loopx/__init__.py +5 -0
- loopx/agent_onboarding.py +654 -0
- loopx/agent_registry.py +112 -0
- loopx/ark_managed_agent_host.py +59 -0
- loopx/authority.py +805 -0
- loopx/benchmark.py +2875 -0
- loopx/benchmark_adapters/__init__.py +1 -0
- loopx/benchmark_adapters/agentissue.py +2644 -0
- loopx/benchmark_adapters/agents_last_exam.py +3998 -0
- loopx/benchmark_adapters/edgebench.py +322 -0
- loopx/benchmark_adapters/skillsbench.py +5978 -0
- loopx/benchmark_adapters/skillsbench_acp_failure_policy.py +143 -0
- loopx/benchmark_adapters/skillsbench_acp_process.py +31 -0
- loopx/benchmark_adapters/skillsbench_acp_relay.py +4832 -0
- loopx/benchmark_adapters/skillsbench_batch.py +124 -0
- loopx/benchmark_adapters/skillsbench_bridge_guard.py +209 -0
- loopx/benchmark_adapters/skillsbench_bridge_summary.py +203 -0
- loopx/benchmark_adapters/skillsbench_codex_goal_recovery.py +271 -0
- loopx/benchmark_adapters/skillsbench_codex_goal_trace.py +81 -0
- loopx/benchmark_adapters/skillsbench_codex_runtime.py +339 -0
- loopx/benchmark_adapters/skillsbench_dockerfile_runtime.py +467 -0
- loopx/benchmark_adapters/skillsbench_failure_signals.py +652 -0
- loopx/benchmark_adapters/skillsbench_proxy_runtime.py +327 -0
- loopx/benchmark_adapters/skillsbench_remote_bridge.py +402 -0
- loopx/benchmark_adapters/skillsbench_result_discovery.py +143 -0
- loopx/benchmark_adapters/skillsbench_runner_profile.py +436 -0
- loopx/benchmark_adapters/skillsbench_runner_source.py +99 -0
- loopx/benchmark_adapters/skillsbench_setup_preflight.py +771 -0
- loopx/benchmark_adapters/skillsbench_signals.py +15 -0
- loopx/benchmark_adapters/skillsbench_task_source.py +141 -0
- loopx/benchmark_adapters/skillsbench_turn_route.py +723 -0
- loopx/benchmark_adapters/skillsbench_turn_runtime.py +1069 -0
- loopx/benchmark_adapters/skillsbench_typed_repair.py +689 -0
- loopx/benchmark_adapters/skillsbench_uv_cache.py +111 -0
- loopx/benchmark_adapters/skillsbench_verifier_bootstrap.py +227 -0
- loopx/benchmark_adapters/skillsbench_verifier_cache.py +138 -0
- loopx/benchmark_adapters/terminal_bench.py +10078 -0
- loopx/benchmark_case_analysis.py +1276 -0
- loopx/benchmark_case_state.py +1079 -0
- loopx/benchmark_core/__init__.py +239 -0
- loopx/benchmark_core/adapter.py +84 -0
- loopx/benchmark_core/artifacts.py +517 -0
- loopx/benchmark_core/attempts.py +199 -0
- loopx/benchmark_core/container_exec.py +216 -0
- loopx/benchmark_core/io.py +68 -0
- loopx/benchmark_core/lifecycle.py +211 -0
- loopx/benchmark_core/loop_protocol.py +689 -0
- loopx/benchmark_core/observable_handles.py +348 -0
- loopx/benchmark_core/parity.py +256 -0
- loopx/benchmark_core/remote_closeout.py +482 -0
- loopx/benchmark_core/rounds.py +215 -0
- loopx/benchmark_core/route_profile.py +509 -0
- loopx/benchmark_core/run_permissions.py +206 -0
- loopx/benchmark_core/split_control.py +925 -0
- loopx/benchmark_core/turn_fidelity.py +326 -0
- loopx/benchmark_ledger.py +3793 -0
- loopx/benchmark_ledger_countability.py +372 -0
- loopx/benchmark_ledger_current.py +724 -0
- loopx/benchmark_trajectory.py +405 -0
- loopx/benchmarks/__init__.py +1 -0
- loopx/benchmarks/qualification/__init__.py +1 -0
- loopx/benchmarks/qualification/release_outcome_baseline.py +360 -0
- loopx/benchmarks/read_models/__init__.py +1 -0
- loopx/benchmarks/read_models/benchmark_attempt_accounting.py +53 -0
- loopx/benchmarks/read_models/benchmark_comparison.py +414 -0
- loopx/benchmarks/read_models/benchmark_event_timeline.py +113 -0
- loopx/benchmarks/read_models/benchmark_experiment_report.py +475 -0
- loopx/benchmarks/read_models/benchmark_learning_ledger.py +137 -0
- loopx/benchmarks/read_models/benchmark_lifecycle_contracts.py +228 -0
- loopx/benchmarks/read_models/benchmark_projection.py +723 -0
- loopx/benchmarks/read_models/benchmark_result.py +146 -0
- loopx/benchmarks/read_models/benchmark_run_execution_contract.py +116 -0
- loopx/benchmarks/read_models/benchmark_run_failure.py +157 -0
- loopx/benchmarks/read_models/benchmark_run_metrics.py +213 -0
- loopx/benchmarks/read_models/benchmark_run_post_execution.py +635 -0
- loopx/benchmarks/read_models/benchmark_run_pre_execution.py +541 -0
- loopx/benchmarks/read_models/benchmark_status_compaction.py +1255 -0
- loopx/benchmarks/read_models/benchmark_status_runner.py +780 -0
- loopx/benchmarks/read_models/goal_start_control_score.py +857 -0
- loopx/benchmarks/read_models/skillsbench_post_run_debug.py +746 -0
- loopx/benchmarks/read_models/skillsbench_verifier_attribution.py +269 -0
- loopx/bootstrap.py +1116 -0
- loopx/bootstrap_command_pack.py +2167 -0
- loopx/boundary_authority.py +199 -0
- loopx/canary/__init__.py +1 -0
- loopx/canary/maintainability_ratchet.py +800 -0
- loopx/canary/planner.py +1984 -0
- loopx/canary/premerge.py +1130 -0
- loopx/canary/qualification_profiles.py +309 -0
- loopx/canary/quality_surface_catalog.py +838 -0
- loopx/canary/release_profiles.py +51 -0
- loopx/canary/runner.py +1107 -0
- loopx/canary/smoke_health.py +581 -0
- loopx/canary/smoke_profiles.py +212 -0
- loopx/capabilities/__init__.py +0 -0
- loopx/capabilities/agent_turn_recall/__init__.py +17 -0
- loopx/capabilities/agent_turn_recall/cli.py +369 -0
- loopx/capabilities/agent_turn_recall/core.py +296 -0
- loopx/capabilities/auto_research/__init__.py +16 -0
- loopx/capabilities/auto_research/bootstrap_contract.py +157 -0
- loopx/capabilities/auto_research/cli.py +1468 -0
- loopx/capabilities/auto_research/core.py +11 -0
- loopx/capabilities/auto_research/defaults.py +79 -0
- loopx/capabilities/auto_research/demo_e2e.py +1848 -0
- loopx/capabilities/auto_research/demo_supervisor.py +186 -0
- loopx/capabilities/auto_research/evidence_packet.py +767 -0
- loopx/capabilities/auto_research/human_view.py +794 -0
- loopx/capabilities/auto_research/kernel.py +191 -0
- loopx/capabilities/auto_research/knn_demo_workspace.py +322 -0
- loopx/capabilities/auto_research/live_evidence.py +248 -0
- loopx/capabilities/auto_research/preset.py +176 -0
- loopx/capabilities/auto_research/research_state.py +1085 -0
- loopx/capabilities/auto_research/role_profiles.py +394 -0
- loopx/capabilities/auto_research/rollout_append.py +97 -0
- loopx/capabilities/auto_research/terminal_result_contract.py +422 -0
- loopx/capabilities/auto_research/terminal_result_projection.py +171 -0
- loopx/capabilities/auto_research/terminal_result_query.py +233 -0
- loopx/capabilities/auto_research/terminal_results.py +349 -0
- loopx/capabilities/auto_research/user_contract.py +190 -0
- loopx/capabilities/auto_research/worker_loop.py +163 -0
- loopx/capabilities/auto_research/worker_runtime.py +777 -0
- loopx/capabilities/auto_research/worker_skill/SKILL.md +343 -0
- loopx/capabilities/benchmark_toolkit/__init__.py +19 -0
- loopx/capabilities/benchmark_toolkit/integrity.py +387 -0
- loopx/capabilities/catalog.py +1875 -0
- loopx/capabilities/change_quality/__init__.py +19 -0
- loopx/capabilities/change_quality/cli.py +171 -0
- loopx/capabilities/change_quality/context.py +156 -0
- loopx/capabilities/change_quality/oracles.py +269 -0
- loopx/capabilities/change_quality/policy.py +34 -0
- loopx/capabilities/change_quality/receipt.py +482 -0
- loopx/capabilities/change_quality/result.py +493 -0
- loopx/capabilities/change_quality/scope.py +171 -0
- loopx/capabilities/change_quality/shadow.py +680 -0
- loopx/capabilities/content_ops/__init__.py +0 -0
- loopx/capabilities/content_ops/cli.py +649 -0
- loopx/capabilities/content_ops/connector_packets.py +164 -0
- loopx/capabilities/content_ops/item_lifecycle.py +1000 -0
- loopx/capabilities/content_ops/layout.py +451 -0
- loopx/capabilities/content_ops/markdown.py +456 -0
- loopx/capabilities/content_ops/schemas.py +51 -0
- loopx/capabilities/content_ops/social_browser_x.py +107 -0
- loopx/capabilities/content_ops/surface.py +1956 -0
- loopx/capabilities/content_ops/templates/layout-catalog-v0.json +72 -0
- loopx/capabilities/context_providers/__init__.py +36 -0
- loopx/capabilities/context_providers/base.py +189 -0
- loopx/capabilities/context_providers/factory.py +32 -0
- loopx/capabilities/context_providers/openviking.py +702 -0
- loopx/capabilities/context_providers/service_ownership.py +185 -0
- loopx/capabilities/decision_context/__init__.py +129 -0
- loopx/capabilities/decision_context/architecture.py +83 -0
- loopx/capabilities/decision_context/assembler.py +849 -0
- loopx/capabilities/decision_context/catalog_entry.py +195 -0
- loopx/capabilities/decision_context/cli.py +310 -0
- loopx/capabilities/decision_context/cursor_commit.py +535 -0
- loopx/capabilities/decision_context/outcome_feedback.py +352 -0
- loopx/capabilities/decision_context/packets.py +654 -0
- loopx/capabilities/decision_context/private_state.py +189 -0
- loopx/capabilities/decision_context/profile.py +453 -0
- loopx/capabilities/decision_context/providers.py +228 -0
- loopx/capabilities/decision_context/review_settlement.py +136 -0
- loopx/capabilities/decision_context/runtime.py +273 -0
- loopx/capabilities/decision_context/sources.py +415 -0
- loopx/capabilities/explore/__init__.py +1 -0
- loopx/capabilities/explore/activation.py +198 -0
- loopx/capabilities/explore/adaptive_replay_planner.py +221 -0
- loopx/capabilities/explore/child_replay_runtime.py +463 -0
- loopx/capabilities/explore/composition_frontier.py +291 -0
- loopx/capabilities/explore/counterfactual_runtime.py +578 -0
- loopx/capabilities/explore/episode_runtime.py +647 -0
- loopx/capabilities/explore/harness_checkpoint.py +171 -0
- loopx/capabilities/explore/harness_gate.py +115 -0
- loopx/capabilities/explore/harness_runtime.py +1124 -0
- loopx/capabilities/explore/replay_metrics.py +206 -0
- loopx/capabilities/explore/replay_runtime.py +1271 -0
- loopx/capabilities/explore/resource_portfolio.py +173 -0
- loopx/capabilities/explore/result_log.py +974 -0
- loopx/capabilities/explore/router_state.py +432 -0
- loopx/capabilities/explore/source_history_reconcile.py +255 -0
- loopx/capabilities/explore/speculative_scheduler.py +498 -0
- loopx/capabilities/explore/todo_branch_plan.py +650 -0
- loopx/capabilities/explore/todo_evidence.py +141 -0
- loopx/capabilities/explore/trace_runtime.py +284 -0
- loopx/capabilities/explore/worker_branch_plan.py +1257 -0
- loopx/capabilities/integration_branch/__init__.py +13 -0
- loopx/capabilities/integration_branch/cli.py +148 -0
- loopx/capabilities/integration_branch/core.py +916 -0
- loopx/capabilities/issue_fix/__init__.py +19 -0
- loopx/capabilities/issue_fix/acceptance_loop.py +1050 -0
- loopx/capabilities/issue_fix/candidate_evidence.py +503 -0
- loopx/capabilities/issue_fix/candidate_preflight.py +676 -0
- loopx/capabilities/issue_fix/cli.py +1822 -0
- loopx/capabilities/issue_fix/cli_input.py +87 -0
- loopx/capabilities/issue_fix/content_ops_cli.py +148 -0
- loopx/capabilities/issue_fix/discovered_issue_promotion.py +947 -0
- loopx/capabilities/issue_fix/explore_projection.py +710 -0
- loopx/capabilities/issue_fix/feasibility.py +542 -0
- loopx/capabilities/issue_fix/github_public.py +661 -0
- loopx/capabilities/issue_fix/intake_surface.py +832 -0
- loopx/capabilities/issue_fix/metadata_preview.py +218 -0
- loopx/capabilities/issue_fix/metrics_projection.py +1340 -0
- loopx/capabilities/issue_fix/metrics_supplement.py +634 -0
- loopx/capabilities/issue_fix/metrics_supplement_cli.py +127 -0
- loopx/capabilities/issue_fix/outcome_projection.py +1235 -0
- loopx/capabilities/issue_fix/periodic_report.py +189 -0
- loopx/capabilities/issue_fix/pr_description.py +418 -0
- loopx/capabilities/issue_fix/pr_gate_reconcile.py +496 -0
- loopx/capabilities/issue_fix/pr_gate_reconcile_cli.py +464 -0
- loopx/capabilities/issue_fix/pr_lifecycle.py +1327 -0
- loopx/capabilities/issue_fix/pr_lifecycle_rollout.py +85 -0
- loopx/capabilities/issue_fix/pr_monitor_materialization.py +257 -0
- loopx/capabilities/issue_fix/pr_review_ack.py +439 -0
- loopx/capabilities/issue_fix/provider_hooks.py +24 -0
- loopx/capabilities/issue_fix/repository_commit_evidence.py +186 -0
- loopx/capabilities/issue_fix/repository_context.py +457 -0
- loopx/capabilities/issue_fix/repository_memory.py +459 -0
- loopx/capabilities/issue_fix/repository_memory_provider.py +1454 -0
- loopx/capabilities/issue_fix/repository_snapshot.py +454 -0
- loopx/capabilities/issue_fix/reviewer_cli.py +917 -0
- loopx/capabilities/issue_fix/reviewer_notification.py +882 -0
- loopx/capabilities/issue_fix/reviewer_notification_drain.py +942 -0
- loopx/capabilities/issue_fix/reviewer_recommendation.py +1057 -0
- loopx/capabilities/issue_fix/reviewer_request.py +1282 -0
- loopx/capabilities/issue_fix/reward_memory.py +879 -0
- loopx/capabilities/issue_fix/workflow_plan.py +1286 -0
- loopx/capabilities/material_lifecycle/__init__.py +161 -0
- loopx/capabilities/material_lifecycle/_validation.py +183 -0
- loopx/capabilities/material_lifecycle/apply.py +672 -0
- loopx/capabilities/material_lifecycle/architecture.py +122 -0
- loopx/capabilities/material_lifecycle/cli.py +161 -0
- loopx/capabilities/material_lifecycle/decision_planning.py +470 -0
- loopx/capabilities/material_lifecycle/explore_execution.py +306 -0
- loopx/capabilities/material_lifecycle/intake.py +869 -0
- loopx/capabilities/material_lifecycle/inventory.py +147 -0
- loopx/capabilities/material_lifecycle/lifecycle.py +98 -0
- loopx/capabilities/material_lifecycle/preparation.py +147 -0
- loopx/capabilities/material_lifecycle/project_skill.py +83 -0
- loopx/capabilities/material_lifecycle/ranking.py +267 -0
- loopx/capabilities/material_lifecycle/readable_projection.py +500 -0
- loopx/capabilities/material_lifecycle/rebuild.py +480 -0
- loopx/capabilities/material_lifecycle/settlement.py +238 -0
- loopx/capabilities/periodic_report/__init__.py +71 -0
- loopx/capabilities/periodic_report/adapters.py +939 -0
- loopx/capabilities/periodic_report/archive.py +422 -0
- loopx/capabilities/periodic_report/bindings.py +705 -0
- loopx/capabilities/periodic_report/cli.py +277 -0
- loopx/capabilities/periodic_report/core.py +691 -0
- loopx/capabilities/periodic_report/extension_envelope.py +66 -0
- loopx/capabilities/periodic_report/presets.py +103 -0
- loopx/capabilities/periodic_report/profile.py +235 -0
- loopx/capabilities/periodic_report/project_progress.py +179 -0
- loopx/capabilities/periodic_report/triggers.py +452 -0
- loopx/capabilities/pr_review_queue/__init__.py +17 -0
- loopx/capabilities/pr_review_queue/core.py +506 -0
- loopx/capabilities/pr_review_queue/review_contract.py +506 -0
- loopx/capabilities/registry.py +192 -0
- loopx/capabilities/reward_memory/__init__.py +75 -0
- loopx/capabilities/reward_memory/application.py +819 -0
- loopx/capabilities/reward_memory/architecture.py +572 -0
- loopx/capabilities/reward_memory/candidate_review.py +511 -0
- loopx/capabilities/reward_memory/cli.py +469 -0
- loopx/capabilities/reward_memory/dogfood.py +574 -0
- loopx/capabilities/reward_memory/evaluation.py +296 -0
- loopx/capabilities/reward_memory/evaluation_fixtures.py +362 -0
- loopx/capabilities/reward_memory/experiment.py +567 -0
- loopx/capabilities/reward_memory/health.py +222 -0
- loopx/capabilities/reward_memory/ingestion.py +519 -0
- loopx/capabilities/reward_memory/registry.py +600 -0
- loopx/capabilities/reward_memory/runtime_hooks.py +312 -0
- loopx/capabilities/reward_memory/scoped_feedback.py +173 -0
- loopx/capabilities/semantic_preference/__init__.py +12 -0
- loopx/capabilities/semantic_preference/cli.py +189 -0
- loopx/capabilities/semantic_preference/contract.py +592 -0
- loopx/capabilities/semantic_preference/reward_memory.py +62 -0
- loopx/capabilities/value_connectors/__init__.py +1 -0
- loopx/capabilities/value_connectors/cli.py +401 -0
- loopx/capabilities/value_connectors/finance_extension_migration.py +108 -0
- loopx/capabilities/value_connectors/install_check.py +147 -0
- loopx/capabilities/value_connectors/planner.py +733 -0
- loopx/capabilities/value_connectors/source_map.py +446 -0
- loopx/claude_goal_baseline.py +138 -0
- loopx/claude_goal_mode/__init__.py +23 -0
- loopx/claude_goal_mode/hooks/goal_policy.py +212 -0
- loopx/claude_goal_mode/hooks/goal_state.py +139 -0
- loopx/claude_goal_mode/mcp/loopx_mcp.py +167 -0
- loopx/claude_goal_mode/scripts/connect.py +103 -0
- loopx/claude_goal_mode/scripts/goalmode_cmd.py +241 -0
- loopx/claude_goal_mode/scripts/install.py +328 -0
- loopx/claude_goal_mode/statusline/goal_status.py +97 -0
- loopx/cli.py +836 -0
- loopx/cli_commands/__init__.py +334 -0
- loopx/cli_commands/_host_thread.py +13 -0
- loopx/cli_commands/agentissue_runner_flow.py +447 -0
- loopx/cli_commands/agents_last_exam.py +160 -0
- loopx/cli_commands/agents_last_exam_baked_input.py +302 -0
- loopx/cli_commands/agents_last_exam_host_codex.py +374 -0
- loopx/cli_commands/agents_last_exam_launch_dry_run.py +372 -0
- loopx/cli_commands/agents_last_exam_local_plan.py +322 -0
- loopx/cli_commands/agents_last_exam_runner_source.py +352 -0
- loopx/cli_commands/agents_last_exam_task_material.py +335 -0
- loopx/cli_commands/agents_last_exam_validation_gate.py +236 -0
- loopx/cli_commands/benchmark_boundary.py +499 -0
- loopx/cli_commands/benchmark_dispatch.py +161 -0
- loopx/cli_commands/benchmark_release_outcome.py +123 -0
- loopx/cli_commands/benchmark_review_lifecycle.py +1275 -0
- loopx/cli_commands/benchmark_run_ledger.py +763 -0
- loopx/cli_commands/benchmark_run_ledger_case_analysis.py +249 -0
- loopx/cli_commands/benchmark_run_ledger_classification.py +45 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance.py +486 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance_registration.py +342 -0
- loopx/cli_commands/benchmark_run_ledger_maintenance_rendering.py +233 -0
- loopx/cli_commands/benchmark_run_ledger_parity.py +92 -0
- loopx/cli_commands/bootstrap_connect.py +238 -0
- loopx/cli_commands/canary.py +707 -0
- loopx/cli_commands/canary_release_qualification.py +79 -0
- loopx/cli_commands/capability.py +96 -0
- loopx/cli_commands/doctor.py +43 -0
- loopx/cli_commands/dreaming.py +143 -0
- loopx/cli_commands/edgebench.py +205 -0
- loopx/cli_commands/evidence_log.py +275 -0
- loopx/cli_commands/explore.py +989 -0
- loopx/cli_commands/explore_planning_commands.py +157 -0
- loopx/cli_commands/extension.py +271 -0
- loopx/cli_commands/first_run_report.py +73 -0
- loopx/cli_commands/goal_channel.py +656 -0
- loopx/cli_commands/handoff_mode.py +158 -0
- loopx/cli_commands/history.py +622 -0
- loopx/cli_commands/host_mode_plan.py +113 -0
- loopx/cli_commands/lark_inbox.py +431 -0
- loopx/cli_commands/lark_kanban.py +629 -0
- loopx/cli_commands/ml_experiment.py +321 -0
- loopx/cli_commands/multi_agent.py +211 -0
- loopx/cli_commands/opencode2_goal_worker.py +217 -0
- loopx/cli_commands/pr_review.py +167 -0
- loopx/cli_commands/presentation.py +218 -0
- loopx/cli_commands/preset.py +96 -0
- loopx/cli_commands/project.py +150 -0
- loopx/cli_commands/project_lifecycle.py +915 -0
- loopx/cli_commands/quota.py +859 -0
- loopx/cli_commands/quota_registration.py +241 -0
- loopx/cli_commands/quota_request.py +113 -0
- loopx/cli_commands/ready_score.py +110 -0
- loopx/cli_commands/registry_admin.py +975 -0
- loopx/cli_commands/registry_admin_configure.py +344 -0
- loopx/cli_commands/registry_admin_peer.py +84 -0
- loopx/cli_commands/registry_authority.py +218 -0
- loopx/cli_commands/review_batch.py +146 -0
- loopx/cli_commands/slash_commands.py +145 -0
- loopx/cli_commands/start_goal.py +251 -0
- loopx/cli_commands/starter.py +175 -0
- loopx/cli_commands/starter_bootstrap.py +179 -0
- loopx/cli_commands/starter_bootstrap_registration.py +198 -0
- loopx/cli_commands/starter_runtime_idle.py +107 -0
- loopx/cli_commands/starter_scheduler.py +207 -0
- loopx/cli_commands/starter_session_runtime.py +152 -0
- loopx/cli_commands/starter_visible_common.py +54 -0
- loopx/cli_commands/starter_visible_driver.py +161 -0
- loopx/cli_commands/starter_visible_pilot.py +278 -0
- loopx/cli_commands/status.py +867 -0
- loopx/cli_commands/status_registration.py +239 -0
- loopx/cli_commands/summary_all.py +222 -0
- loopx/cli_commands/support_control.py +809 -0
- loopx/cli_commands/support_control_registry.py +68 -0
- loopx/cli_commands/support_control_supervisor.py +289 -0
- loopx/cli_commands/task_lease.py +306 -0
- loopx/cli_commands/terminal_bench_adapter.py +717 -0
- loopx/cli_commands/terminal_bench_environment_result.py +1246 -0
- loopx/cli_commands/todo.py +940 -0
- loopx/cli_commands/todo_argument_validation.py +572 -0
- loopx/cli_commands/todo_event.py +114 -0
- loopx/cli_commands/turn.py +804 -0
- loopx/cli_commands/version.py +46 -0
- loopx/cli_commands/worker_bridge.py +659 -0
- loopx/cli_rollout.py +314 -0
- loopx/codex_cli_goal_tui.py +672 -0
- loopx/codex_cli_probe.py +1530 -0
- loopx/codex_cli_probe_markdown.py +935 -0
- loopx/codex_cli_runtime_probe.py +733 -0
- loopx/codex_cli_scheduler.py +564 -0
- loopx/codex_goal_baseline.py +620 -0
- loopx/configuration_catalog.py +617 -0
- loopx/configure_goal.py +1375 -0
- loopx/contract.py +996 -0
- loopx/control_plane/__init__.py +71 -0
- loopx/control_plane/agents/__init__.py +1 -0
- loopx/control_plane/agents/agent_lane_recommendation.py +516 -0
- loopx/control_plane/agents/agent_scope.py +1578 -0
- loopx/control_plane/agents/agent_scope_frontier.py +60 -0
- loopx/control_plane/agents/capability_gate.py +531 -0
- loopx/control_plane/agents/identity.py +140 -0
- loopx/control_plane/agents/legacy_migration.py +169 -0
- loopx/control_plane/agents/management_projection.py +658 -0
- loopx/control_plane/agents/material_frontier.py +608 -0
- loopx/control_plane/agents/material_handoff.py +156 -0
- loopx/control_plane/agents/multi_agent/__init__.py +1 -0
- loopx/control_plane/agents/multi_agent/codex_executable.py +207 -0
- loopx/control_plane/agents/multi_agent/collective_round_ledger.py +387 -0
- loopx/control_plane/agents/multi_agent/contract.py +474 -0
- loopx/control_plane/agents/multi_agent/recipe.py +110 -0
- loopx/control_plane/agents/multi_agent/role_successor.py +297 -0
- loopx/control_plane/agents/multi_agent/runtime_scripts.py +426 -0
- loopx/control_plane/agents/multi_agent/visible_launch_policy.py +149 -0
- loopx/control_plane/agents/multi_agent/visible_wake_scheduler.py +392 -0
- loopx/control_plane/agents/profile.py +216 -0
- loopx/control_plane/agents/runtime_model.py +73 -0
- loopx/control_plane/agents/subagent_activity.py +164 -0
- loopx/control_plane/agents/supervisor.py +544 -0
- loopx/control_plane/agents/supervisor_events.py +462 -0
- loopx/control_plane/agents/supervisor_inject.py +204 -0
- loopx/control_plane/agents/work_mode.py +56 -0
- loopx/control_plane/agents/workspace_guard.py +364 -0
- loopx/control_plane/effect_program.py +644 -0
- loopx/control_plane/goals/__init__.py +1 -0
- loopx/control_plane/goals/active_state_event_projection.py +103 -0
- loopx/control_plane/goals/active_state_metadata.py +47 -0
- loopx/control_plane/goals/active_state_sections.py +58 -0
- loopx/control_plane/goals/configure_goal_service.py +354 -0
- loopx/control_plane/goals/contract_health.py +132 -0
- loopx/control_plane/goals/dreaming.py +152 -0
- loopx/control_plane/goals/global_registry_health.py +199 -0
- loopx/control_plane/goals/global_registry_shadow.py +33 -0
- loopx/control_plane/goals/goal_channel.py +34 -0
- loopx/control_plane/goals/goal_channel_projection.py +560 -0
- loopx/control_plane/goals/goal_frontier/__init__.py +1917 -0
- loopx/control_plane/goals/goal_frontier/ack_policy.py +149 -0
- loopx/control_plane/goals/goal_frontier/outcome_continuity.py +437 -0
- loopx/control_plane/goals/goal_frontier/replan_rules.py +210 -0
- loopx/control_plane/goals/goal_frontier/semantic_history.py +314 -0
- loopx/control_plane/goals/goal_frontier/terminal.py +180 -0
- loopx/control_plane/goals/goal_vision.py +443 -0
- loopx/control_plane/goals/goal_vision_policy.py +36 -0
- loopx/control_plane/goals/goal_vision_state.py +62 -0
- loopx/control_plane/goals/goal_vision_wait.py +290 -0
- loopx/control_plane/goals/path_resolution.py +20 -0
- loopx/control_plane/goals/start_contract.py +206 -0
- loopx/control_plane/goals/vision_checkpoint.py +92 -0
- loopx/control_plane/handoff/__init__.py +1 -0
- loopx/control_plane/handoff/cross_runtime_impl_review.py +311 -0
- loopx/control_plane/handoff/delivery_contract.py +161 -0
- loopx/control_plane/handoff/handoff_runs.py +71 -0
- loopx/control_plane/handoff/project_handoff.py +155 -0
- loopx/control_plane/handoff/review_batch.py +463 -0
- loopx/control_plane/handoff/review_packet_context.py +216 -0
- loopx/control_plane/heartbeat/agent.py +173 -0
- loopx/control_plane/heartbeat/budget.py +66 -0
- loopx/control_plane/heartbeat/builder.py +501 -0
- loopx/control_plane/heartbeat/host.py +64 -0
- loopx/control_plane/heartbeat/rules.py +68 -0
- loopx/control_plane/heartbeat/task_body.py +759 -0
- loopx/control_plane/heartbeat/visible_goal.py +86 -0
- loopx/control_plane/projects/__init__.py +1 -0
- loopx/control_plane/projects/contract.py +25 -0
- loopx/control_plane/projects/registry.py +663 -0
- loopx/control_plane/quota/__init__.py +1 -0
- loopx/control_plane/quota/cli_projection.py +704 -0
- loopx/control_plane/quota/decision_summary.py +431 -0
- loopx/control_plane/quota/effect_program.py +152 -0
- loopx/control_plane/quota/error_codes.py +19 -0
- loopx/control_plane/quota/goal_boundary.py +464 -0
- loopx/control_plane/quota/heartbeat_receipt.py +277 -0
- loopx/control_plane/quota/heartbeat_recommendation.py +718 -0
- loopx/control_plane/quota/host_poll_receipts.py +162 -0
- loopx/control_plane/quota/live_decision.py +142 -0
- loopx/control_plane/quota/monitor_poll.py +786 -0
- loopx/control_plane/quota/policy_constants.py +40 -0
- loopx/control_plane/quota/projection_repair.py +262 -0
- loopx/control_plane/quota/recent_runs.py +210 -0
- loopx/control_plane/quota/scheduler_ack.py +490 -0
- loopx/control_plane/quota/selected_todo_projection.py +139 -0
- loopx/control_plane/quota/settlement.py +437 -0
- loopx/control_plane/quota/settlement_cli.py +246 -0
- loopx/control_plane/quota/settlement_validation.py +64 -0
- loopx/control_plane/quota/settlement_workspace_causality.py +180 -0
- loopx/control_plane/quota/should_run.py +249 -0
- loopx/control_plane/quota/should_run_packet.py +1165 -0
- loopx/control_plane/quota/should_run_prepare.py +675 -0
- loopx/control_plane/quota/slot_accounting.py +1123 -0
- loopx/control_plane/quota/spend_sources.py +11 -0
- loopx/control_plane/quota/stall_repair.py +397 -0
- loopx/control_plane/quota/states.py +29 -0
- loopx/control_plane/quota/task_orchestration.py +448 -0
- loopx/control_plane/quota/task_orchestration_admission.py +497 -0
- loopx/control_plane/quota/turn_envelope.py +889 -0
- loopx/control_plane/quota/usage_summary.py +140 -0
- loopx/control_plane/reward_memory.py +43 -0
- loopx/control_plane/runtime/__init__.py +2 -0
- loopx/control_plane/runtime/active_user_assisted_pilot.py +275 -0
- loopx/control_plane/runtime/agent_scoped_evidence_log.py +435 -0
- loopx/control_plane/runtime/decision_freshness.py +203 -0
- loopx/control_plane/runtime/event_ledger.py +197 -0
- loopx/control_plane/runtime/event_store_migration_bridge.py +196 -0
- loopx/control_plane/runtime/goal_project_route.py +70 -0
- loopx/control_plane/runtime/local_state_write_correctness.py +242 -0
- loopx/control_plane/runtime/promotion_readiness.py +152 -0
- loopx/control_plane/runtime/public_safety.py +120 -0
- loopx/control_plane/runtime/run_artifacts.py +78 -0
- loopx/control_plane/runtime/run_compaction.py +397 -0
- loopx/control_plane/runtime/run_context_retention.py +241 -0
- loopx/control_plane/runtime/run_history.py +132 -0
- loopx/control_plane/runtime/run_index_duplicates.py +205 -0
- loopx/control_plane/runtime/run_index_rebuild.py +263 -0
- loopx/control_plane/runtime/run_ingest_health.py +336 -0
- loopx/control_plane/runtime/runtime_projection_route.py +624 -0
- loopx/control_plane/runtime/runtime_projection_writer.py +98 -0
- loopx/control_plane/runtime/session_runtime.py +339 -0
- loopx/control_plane/runtime/shared_runtime_material_projection.py +332 -0
- loopx/control_plane/runtime/shared_runtime_refresh_projection.py +183 -0
- loopx/control_plane/runtime/stale_latest_run.py +90 -0
- loopx/control_plane/runtime/status_classifications.py +49 -0
- loopx/control_plane/runtime/status_projection_cache.py +235 -0
- loopx/control_plane/runtime/stride_observation.py +144 -0
- loopx/control_plane/runtime/time.py +39 -0
- loopx/control_plane/runtime/trajectory_hygiene.py +149 -0
- loopx/control_plane/runtime/validation_command.py +69 -0
- loopx/control_plane/scheduler/__init__.py +1 -0
- loopx/control_plane/scheduler/ack.py +329 -0
- loopx/control_plane/scheduler/arbitration.py +188 -0
- loopx/control_plane/scheduler/automation_liveness.py +183 -0
- loopx/control_plane/scheduler/execution_context.py +555 -0
- loopx/control_plane/scheduler/external_evidence_observation.py +428 -0
- loopx/control_plane/scheduler/monitor_display.py +143 -0
- loopx/control_plane/scheduler/monitor_poll_policy.py +161 -0
- loopx/control_plane/scheduler/monitor_poll_writeback.py +351 -0
- loopx/control_plane/scheduler/monitor_target.py +64 -0
- loopx/control_plane/scheduler/monitor_todo.py +146 -0
- loopx/control_plane/scheduler/monitor_wait.py +237 -0
- loopx/control_plane/scheduler/scheduler_hint.py +1284 -0
- loopx/control_plane/scheduler/state.py +354 -0
- loopx/control_plane/scheduler/state_transition_rules.py +179 -0
- loopx/control_plane/scheduler/time.py +10 -0
- loopx/control_plane/settlement_driver.py +293 -0
- loopx/control_plane/status/__init__.py +6 -0
- loopx/control_plane/status/active_state_projection.py +105 -0
- loopx/control_plane/status/agent_lane_projection.py +375 -0
- loopx/control_plane/status/attention_projection.py +74 -0
- loopx/control_plane/status/autonomous_replan_projection.py +103 -0
- loopx/control_plane/status/collection.py +140 -0
- loopx/control_plane/status/contract_projection.py +31 -0
- loopx/control_plane/status/dreaming_projection.py +52 -0
- loopx/control_plane/status/goal_attention_projection.py +157 -0
- loopx/control_plane/status/lifecycle_projection.py +110 -0
- loopx/control_plane/status/monitor_display_projection.py +69 -0
- loopx/control_plane/status/registry_health_projection.py +75 -0
- loopx/control_plane/status/run_projection.py +70 -0
- loopx/control_plane/status/runtime_summaries.py +161 -0
- loopx/control_plane/testing/__init__.py +1 -0
- loopx/control_plane/testing/actual_default_model_behavior_portfolio.py +1371 -0
- loopx/control_plane/testing/canary_harness.py +182 -0
- loopx/control_plane/testing/capability_monitor_repair_tool_behavior.py +674 -0
- loopx/control_plane/testing/cli_output_budget.py +807 -0
- loopx/control_plane/testing/cli_output_differential.py +250 -0
- loopx/control_plane/testing/cli_output_semantics.py +87 -0
- loopx/control_plane/testing/control_plane_composition_scenarios.py +225 -0
- loopx/control_plane/testing/decision_replay.py +268 -0
- loopx/control_plane/testing/doubao_model_behavior_actor.py +559 -0
- loopx/control_plane/testing/model_behavior_corpus.py +344 -0
- loopx/control_plane/testing/model_behavior_qualification.py +769 -0
- loopx/control_plane/testing/model_behavior_retained_cases.py +235 -0
- loopx/control_plane/testing/model_tool_behavior.py +536 -0
- loopx/control_plane/testing/onboarding_model_behavior_qualification.py +642 -0
- loopx/control_plane/testing/quota_fixtures.py +208 -0
- loopx/control_plane/testing/quota_should_run_parity.py +57 -0
- loopx/control_plane/testing/release_commit_qualification.py +671 -0
- loopx/control_plane/testing/replan_semantic_action_behavior.py +1302 -0
- loopx/control_plane/testing/scoped_gate_successor_tool_behavior.py +527 -0
- loopx/control_plane/testing/selected_todo_tool_behavior.py +1002 -0
- loopx/control_plane/testing/terminal_settlement_tool_behavior.py +656 -0
- loopx/control_plane/todos/__init__.py +1 -0
- loopx/control_plane/todos/active_state_editing.py +296 -0
- loopx/control_plane/todos/active_state_todo_parser.py +138 -0
- loopx/control_plane/todos/active_state_todos.py +175 -0
- loopx/control_plane/todos/addition.py +103 -0
- loopx/control_plane/todos/claim_visibility.py +253 -0
- loopx/control_plane/todos/completed_archive.py +139 -0
- loopx/control_plane/todos/completion_fence.py +49 -0
- loopx/control_plane/todos/completion_policy.py +153 -0
- loopx/control_plane/todos/completion_validation.py +248 -0
- loopx/control_plane/todos/completion_validation_accountability.py +27 -0
- loopx/control_plane/todos/completion_validation_projection.py +57 -0
- loopx/control_plane/todos/contract.py +1476 -0
- loopx/control_plane/todos/decision_scope.py +554 -0
- loopx/control_plane/todos/deferred_resume.py +546 -0
- loopx/control_plane/todos/durable_completion.py +201 -0
- loopx/control_plane/todos/event_writeback.py +484 -0
- loopx/control_plane/todos/frontier_deadline.py +132 -0
- loopx/control_plane/todos/handoff_gate.py +283 -0
- loopx/control_plane/todos/handoff_mode.py +444 -0
- loopx/control_plane/todos/handoff_note.py +202 -0
- loopx/control_plane/todos/line_update.py +361 -0
- loopx/control_plane/todos/list_projection.py +205 -0
- loopx/control_plane/todos/markdown.py +199 -0
- loopx/control_plane/todos/monitor_metadata.py +88 -0
- loopx/control_plane/todos/mutation_authority.py +299 -0
- loopx/control_plane/todos/projection.py +655 -0
- loopx/control_plane/todos/quota_summary.py +1138 -0
- loopx/control_plane/todos/route_continuation.py +267 -0
- loopx/control_plane/todos/succession_warning.py +174 -0
- loopx/control_plane/todos/summary_item.py +223 -0
- loopx/control_plane/todos/text.py +30 -0
- loopx/control_plane/todos/todo_index.py +226 -0
- loopx/control_plane/todos/todo_summary.py +1458 -0
- loopx/control_plane/todos/unblock_resume.py +326 -0
- loopx/control_plane/todos/user_gate.py +263 -0
- loopx/control_plane/todos/write_hint.py +63 -0
- loopx/control_plane/todos/write_policy.py +135 -0
- loopx/control_plane/turn_driver/__init__.py +85 -0
- loopx/control_plane/turn_driver/codex_cli.py +502 -0
- loopx/control_plane/turn_driver/driver.py +355 -0
- loopx/control_plane/turn_driver/executor.py +1468 -0
- loopx/control_plane/turn_driver/loop_controller.py +669 -0
- loopx/control_plane/turn_driver/settlement.py +318 -0
- loopx/control_plane/turn_driver/transaction.py +375 -0
- loopx/control_plane/work_items/__init__.py +1 -0
- loopx/control_plane/work_items/attention_fields.py +56 -0
- loopx/control_plane/work_items/attention_item.py +77 -0
- loopx/control_plane/work_items/attention_queue.py +322 -0
- loopx/control_plane/work_items/attention_routing.py +213 -0
- loopx/control_plane/work_items/autonomous_candidates.py +135 -0
- loopx/control_plane/work_items/autonomous_replan_ack.py +276 -0
- loopx/control_plane/work_items/autonomous_replan_obligation.py +786 -0
- loopx/control_plane/work_items/backlog_hygiene.py +59 -0
- loopx/control_plane/work_items/capability_monitor_fallback.py +221 -0
- loopx/control_plane/work_items/delivery_batch_scale.py +66 -0
- loopx/control_plane/work_items/delivery_outcome.py +152 -0
- loopx/control_plane/work_items/delivery_signals.py +113 -0
- loopx/control_plane/work_items/execution_obligation.py +235 -0
- loopx/control_plane/work_items/goal_route_hint.py +320 -0
- loopx/control_plane/work_items/interaction_contract.py +1540 -0
- loopx/control_plane/work_items/issue_meta_surface.py +159 -0
- loopx/control_plane/work_items/lifecycle.py +139 -0
- loopx/control_plane/work_items/operator_inbox.py +266 -0
- loopx/control_plane/work_items/outcome_followthrough.py +69 -0
- loopx/control_plane/work_items/primary_action.py +326 -0
- loopx/control_plane/work_items/progress_observation.py +630 -0
- loopx/control_plane/work_items/project_asset.py +675 -0
- loopx/control_plane/work_items/repair_delta.py +693 -0
- loopx/control_plane/work_items/runtime_capability_reentry.py +168 -0
- loopx/control_plane/work_items/semantic_replan_writeback.py +177 -0
- loopx/control_plane/work_items/status_contract.py +49 -0
- loopx/control_plane/work_items/task_graph.py +1046 -0
- loopx/control_plane/work_items/task_lease.py +1254 -0
- loopx/control_plane/work_items/task_lease_settlement.py +422 -0
- loopx/control_plane/work_items/work_lane.py +510 -0
- loopx/control_plane/work_items/work_lane_context.py +161 -0
- loopx/demo.py +247 -0
- loopx/diagnose.py +633 -0
- loopx/doctor.py +1251 -0
- loopx/domain_packs/__init__.py +1 -0
- loopx/domain_packs/issue_fix.py +571 -0
- loopx/domain_packs/ml_experiment.py +854 -0
- loopx/domain_state.py +137 -0
- loopx/dreaming.py +706 -0
- loopx/entrypoint.py +16 -0
- loopx/event_sourced_state.py +981 -0
- loopx/execution_profile.py +286 -0
- loopx/experiments/__init__.py +1 -0
- loopx/experiments/planner_worker/__init__.py +1 -0
- loopx/experiments/planner_worker/contract.py +523 -0
- loopx/experiments/planner_worker/runtime.py +391 -0
- loopx/experiments/planner_worker/traex.py +461 -0
- loopx/explore_graph.py +11 -0
- loopx/extensions/__init__.py +1 -0
- loopx/extensions/bundled.py +28 -0
- loopx/extensions/execution_envelope.py +126 -0
- loopx/extensions/lark/__init__.py +11 -0
- loopx/extensions/lark/event_collector.py +478 -0
- loopx/extensions/lark/event_collector_runtime.py +506 -0
- loopx/extensions/lark/event_inbox.py +454 -0
- loopx/extensions/lark/extension.toml +88 -0
- loopx/extensions/lark/goal_channel.py +44 -0
- loopx/extensions/lark/goal_channel_contracts.py +388 -0
- loopx/extensions/lark/goal_channel_lifecycle.py +218 -0
- loopx/extensions/lark/goal_channel_runtime.py +792 -0
- loopx/extensions/lark/goal_channel_setup.py +805 -0
- loopx/extensions/lark/goal_channel_targets.py +215 -0
- loopx/extensions/lark/goal_channel_transport.py +281 -0
- loopx/extensions/lark/inbox_reactions.py +650 -0
- loopx/extensions/lark/inbox_reply.py +430 -0
- loopx/extensions/lark/presentation/__init__.py +11 -0
- loopx/extensions/lark/presentation/explore_results.py +2276 -0
- loopx/extensions/lark/presentation/explore_singleflight.py +127 -0
- loopx/extensions/lark/presentation/explore_source_guard.py +121 -0
- loopx/extensions/lark/presentation/explore_stage_document.py +703 -0
- loopx/extensions/lark/presentation/explore_visual_integrity.py +122 -0
- loopx/extensions/lark/presentation/explore_visual_readback.py +452 -0
- loopx/extensions/lark/presentation/explore_visual_styles.py +156 -0
- loopx/extensions/lark/presentation/issue_fix_surface.py +612 -0
- loopx/extensions/lark/presentation/kanban.py +2791 -0
- loopx/extensions/lark/presentation/message_card.py +112 -0
- loopx/extensions/lark/presentation/periodic_report.py +261 -0
- loopx/extensions/lark/presentation/projection_rows.py +600 -0
- loopx/extensions/lark/presentation/record_io.py +95 -0
- loopx/extensions/lark/presentation/sync_receipt.py +145 -0
- loopx/extensions/lark/private_json.py +40 -0
- loopx/extensions/lark/provider.py +86 -0
- loopx/extensions/lark/reviewer_notification.py +604 -0
- loopx/extensions/manifest.py +385 -0
- loopx/extensions/openviking_periodic_report/__init__.py +17 -0
- loopx/extensions/openviking_periodic_report/activation.py +173 -0
- loopx/extensions/openviking_periodic_report/extension.toml +17 -0
- loopx/extensions/openviking_periodic_report/provider.py +355 -0
- loopx/extensions/openviking_periodic_report/sink.py +117 -0
- loopx/extensions/openviking_semantic_preference/__init__.py +5 -0
- loopx/extensions/openviking_semantic_preference/extension.toml +16 -0
- loopx/extensions/openviking_semantic_preference/history_export.py +484 -0
- loopx/extensions/openviking_semantic_preference/project_peer.py +68 -0
- loopx/extensions/openviking_semantic_preference/provider.py +312 -0
- loopx/extensions/presentation.py +979 -0
- loopx/extensions/process_runtime.py +204 -0
- loopx/extensions/readiness.py +168 -0
- loopx/extensions/runtime.py +931 -0
- loopx/extensions/scaffold.py +335 -0
- loopx/feedback.py +581 -0
- loopx/file_lock.py +382 -0
- loopx/global_registry.py +842 -0
- loopx/global_risks.py +970 -0
- loopx/global_todos.py +568 -0
- loopx/handoff_budget.py +28 -0
- loopx/heartbeat_prequota.py +80 -0
- loopx/heartbeat_prompt.py +159 -0
- loopx/help_surface.py +516 -0
- loopx/history.py +1507 -0
- loopx/host_loop_activation.py +1311 -0
- loopx/host_mode_planner.py +991 -0
- loopx/install_contract.py +1 -0
- loopx/interface_budget.py +196 -0
- loopx/long_task_cadence.py +208 -0
- loopx/materials.py +185 -0
- loopx/ml_experiment.py +3 -0
- loopx/onboarding.py +214 -0
- loopx/opencode2_goal_mode/README.md +81 -0
- loopx/opencode2_goal_mode/__init__.py +9 -0
- loopx/opencode2_goal_mode/opencode2-goal-worker.mjs +1018 -0
- loopx/opencode_goal_mode/README.md +99 -0
- loopx/opencode_goal_mode/__init__.py +13 -0
- loopx/opencode_goal_mode/goal-bridge-runtime.mjs +858 -0
- loopx/opencode_goal_mode/loopx-goal.js +8 -0
- loopx/operator_gate.py +420 -0
- loopx/orchestration.py +127 -0
- loopx/paths.py +59 -0
- loopx/pi_goal_mode/README.md +67 -0
- loopx/pi_goal_mode/__init__.py +13 -0
- loopx/pi_goal_mode/loopx-goal.ts +254 -0
- loopx/pi_goal_mode/pi-goal-loop-runtime.mjs +574 -0
- loopx/pr_review.py +1206 -0
- loopx/presentation/__init__.py +1 -0
- loopx/presentation/explore_views.py +1334 -0
- loopx/presentation/markdown.py +61 -0
- loopx/presentation/projection_source_reconcile.py +140 -0
- loopx/presentation/public_safety.py +42 -0
- loopx/presentation/renderers/__init__.py +17 -0
- loopx/presentation/renderers/goal_channel_html.py +269 -0
- loopx/presentation/renderers/periodic_report_html.py +786 -0
- loopx/presentation/renderers/periodic_report_markdown.py +184 -0
- loopx/presentation/renderers/quota_event_markdown.py +116 -0
- loopx/presentation/renderers/quota_markdown.py +1112 -0
- loopx/presentation/renderers/status_markdown.py +1570 -0
- loopx/presentation/renderers/trajectory_hygiene_markdown.py +39 -0
- loopx/presentation/renderers/turn_envelope_markdown.py +33 -0
- loopx/presentation/sinks/__init__.py +5 -0
- loopx/presentation/sinks/openviking_periodic_report.py +7 -0
- loopx/presentation/static_site.py +691 -0
- loopx/presets.py +369 -0
- loopx/project_alias.py +217 -0
- loopx/project_map.py +589 -0
- loopx/project_prompt.py +1153 -0
- loopx/project_skill_cli.py +125 -0
- loopx/project_skill_delivery.py +470 -0
- loopx/project_uninstall.py +462 -0
- loopx/promotion_gate.py +197 -0
- loopx/quota.py +1197 -0
- loopx/ready_score.py +413 -0
- loopx/registry.py +621 -0
- loopx/registry_writability.py +64 -0
- loopx/release_candidate.py +148 -0
- loopx/release_manifest.py +316 -0
- loopx/repository_identity.py +100 -0
- loopx/review_packet.py +1024 -0
- loopx/rollout_event_log.py +505 -0
- loopx/runtime.py +112 -0
- loopx/self_update.py +750 -0
- loopx/session_runtime.py +418 -0
- loopx/skill_install_readback.py +500 -0
- loopx/slash_command_install.py +1393 -0
- loopx/slash_commands.py +264 -0
- loopx/state_backup.py +573 -0
- loopx/state_migration.py +350 -0
- loopx/state_projection.py +809 -0
- loopx/state_refresh.py +1416 -0
- loopx/status.py +1383 -0
- loopx/status_server.py +935 -0
- loopx/summary_all.py +725 -0
- loopx/terminal_bench_agent.py +2056 -0
- loopx/thread_agent_binding.py +408 -0
- loopx/todo_followups.py +168 -0
- loopx/todo_suggestion_prompt.py +204 -0
- loopx/todos.py +2229 -0
- loopx/turn_identity.py +17 -0
- loopx/upgrade.py +1083 -0
- loopx/visible_governance.py +667 -0
- loopx/visible_multi_agent_launcher.py +1253 -0
- loopx/visible_multi_agent_tmux.py +429 -0
- loopx/worker_bridge.py +1574 -0
- loopx-0.4.8.dist-info/METADATA +708 -0
- loopx-0.4.8.dist-info/RECORD +811 -0
- loopx-0.4.8.dist-info/WHEEL +5 -0
- loopx-0.4.8.dist-info/entry_points.txt +5 -0
- loopx-0.4.8.dist-info/licenses/LICENSE +202 -0
- loopx-0.4.8.dist-info/licenses/LICENSE-MIT +21 -0
- loopx-0.4.8.dist-info/licenses/NOTICE +6 -0
- loopx-0.4.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1570 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Collection
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from ...control_plane import control_plane_policy_summary
|
|
7
|
+
from ...control_plane.runtime.event_ledger import EVENT_LEDGER_CLASSES
|
|
8
|
+
from ...execution_profile import execution_profile_summary
|
|
9
|
+
from ...long_task_cadence import long_task_cadence_hint_summary
|
|
10
|
+
from ...orchestration import orchestration_policy_summary
|
|
11
|
+
from ..markdown import as_dict, as_list, markdown_scalar
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def goals_by_id(payload: dict[str, Any]) -> dict[str, dict[str, Any]]:
|
|
15
|
+
run_history = as_dict(payload.get("run_history"))
|
|
16
|
+
goals = as_list(run_history.get("goals"))
|
|
17
|
+
result: dict[str, dict[str, Any]] = {}
|
|
18
|
+
for goal in goals:
|
|
19
|
+
if not isinstance(goal, dict):
|
|
20
|
+
continue
|
|
21
|
+
goal_id = str(goal.get("id") or "")
|
|
22
|
+
if goal_id:
|
|
23
|
+
result[goal_id] = goal
|
|
24
|
+
return result
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def authority_registry_markdown_summary(goal: dict[str, Any] | None) -> str | None:
|
|
28
|
+
registry = as_dict(as_dict(goal).get("authority_registry"))
|
|
29
|
+
if not registry.get("declared"):
|
|
30
|
+
return None
|
|
31
|
+
materials = int(registry.get("project_material_count") or 0)
|
|
32
|
+
topics = int(registry.get("topic_authority_count") or 0)
|
|
33
|
+
if materials <= 0 and topics <= 0:
|
|
34
|
+
return None
|
|
35
|
+
return (
|
|
36
|
+
f"entries={int(registry.get('default_entries_present') or 0)}/"
|
|
37
|
+
f"{int(registry.get('default_entry_count') or 0)} "
|
|
38
|
+
f"topics={topics} "
|
|
39
|
+
f"materials={materials} "
|
|
40
|
+
f"repositories={int(registry.get('project_material_repository_count') or 0)} "
|
|
41
|
+
f"owner_review_required={int(registry.get('project_material_owner_review_required_count') or 0)} "
|
|
42
|
+
f"stale={int(registry.get('project_material_stale_count') or 0)} "
|
|
43
|
+
f"current_authority={int(registry.get('project_material_current_authority_count') or 0)} "
|
|
44
|
+
f"risk={markdown_scalar(registry.get('conflict_risk') or 'unknown')}"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def append_status_overview_markdown(
|
|
49
|
+
lines: list[str],
|
|
50
|
+
payload: dict[str, Any],
|
|
51
|
+
) -> None:
|
|
52
|
+
lines.extend(
|
|
53
|
+
[
|
|
54
|
+
"# LoopX Status",
|
|
55
|
+
"",
|
|
56
|
+
f"- ok: `{payload.get('ok')}`",
|
|
57
|
+
f"- registry: `{payload.get('registry')}`",
|
|
58
|
+
f"- runtime_root: `{payload.get('runtime_root')}`",
|
|
59
|
+
f"- goals: `{payload.get('goal_count')}`",
|
|
60
|
+
f"- runs: `{payload.get('run_count')}`",
|
|
61
|
+
]
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
status_contract = as_dict(payload.get("status_contract"))
|
|
65
|
+
if status_contract:
|
|
66
|
+
lines.append(
|
|
67
|
+
"- status_contract: "
|
|
68
|
+
f"schema_version={status_contract.get('schema_version')}, "
|
|
69
|
+
f"minimum_dashboard_schema_version={status_contract.get('minimum_dashboard_schema_version')}, "
|
|
70
|
+
f"producer={status_contract.get('producer')}"
|
|
71
|
+
)
|
|
72
|
+
if payload.get("goal_filter"):
|
|
73
|
+
lines.append(f"- goal_filter: `{payload.get('goal_filter')}`")
|
|
74
|
+
|
|
75
|
+
contract = as_dict(payload.get("contract"))
|
|
76
|
+
summary = as_dict(contract.get("summary"))
|
|
77
|
+
lines.append(
|
|
78
|
+
"- contract: "
|
|
79
|
+
f"ok={contract.get('ok')}, "
|
|
80
|
+
f"errors={summary.get('errors')}, "
|
|
81
|
+
f"warnings={summary.get('warnings')}, "
|
|
82
|
+
f"checks={summary.get('checks')}"
|
|
83
|
+
)
|
|
84
|
+
contract_errors = as_list(payload.get("contract_errors"))
|
|
85
|
+
contract_warnings = as_list(payload.get("contract_warnings"))
|
|
86
|
+
if contract_errors or contract_warnings:
|
|
87
|
+
lines.extend(["", "## Status Contract Signals"])
|
|
88
|
+
for item in contract_errors:
|
|
89
|
+
lines.append(f"- error: {item}")
|
|
90
|
+
if payload.get("contract_errors_truncated"):
|
|
91
|
+
lines.append(
|
|
92
|
+
f"- contract_errors_truncated: total={payload.get('contract_errors_total_count')}"
|
|
93
|
+
)
|
|
94
|
+
for item in contract_warnings:
|
|
95
|
+
lines.append(f"- warning: {item}")
|
|
96
|
+
if payload.get("contract_warnings_truncated"):
|
|
97
|
+
lines.append(
|
|
98
|
+
f"- contract_warnings_truncated: total={payload.get('contract_warnings_total_count')}"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def append_status_contract_detail_sections_markdown(
|
|
103
|
+
lines: list[str],
|
|
104
|
+
contract: dict[str, Any],
|
|
105
|
+
) -> None:
|
|
106
|
+
for title, key in (("Errors", "errors"), ("Warnings", "warnings"), ("Checks", "checks")):
|
|
107
|
+
entries = contract.get(key) if isinstance(contract.get(key), list) else []
|
|
108
|
+
if entries:
|
|
109
|
+
lines.extend(["", f"## {title}"])
|
|
110
|
+
lines.extend(f"- {entry}" for entry in entries)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def append_global_registry_summary_markdown(
|
|
114
|
+
lines: list[str],
|
|
115
|
+
global_registry: dict[str, Any],
|
|
116
|
+
) -> None:
|
|
117
|
+
global_summary = as_dict(global_registry.get("summary"))
|
|
118
|
+
lines.extend(
|
|
119
|
+
[
|
|
120
|
+
"- global_registry: "
|
|
121
|
+
f"available={global_registry.get('available')}, "
|
|
122
|
+
f"ok={global_registry.get('ok')}, "
|
|
123
|
+
f"findings={global_summary.get('findings')}, "
|
|
124
|
+
f"high={global_summary.get('high')}, "
|
|
125
|
+
f"action={global_summary.get('action')}, "
|
|
126
|
+
f"info={global_summary.get('info')}",
|
|
127
|
+
]
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def append_runtime_projection_routes_markdown(
|
|
132
|
+
lines: list[str],
|
|
133
|
+
diagnostics: dict[str, Any],
|
|
134
|
+
) -> None:
|
|
135
|
+
healthy = diagnostics.get("healthy")
|
|
136
|
+
if healthy is None:
|
|
137
|
+
return
|
|
138
|
+
suffix = "" if healthy else ", details=loopx doctor"
|
|
139
|
+
lines.append(f"- runtime_projection_routes: healthy={healthy}{suffix}")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def append_global_registry_findings_markdown(
|
|
143
|
+
lines: list[str],
|
|
144
|
+
global_registry: dict[str, Any],
|
|
145
|
+
) -> None:
|
|
146
|
+
findings = as_list(global_registry.get("findings"))
|
|
147
|
+
if not findings:
|
|
148
|
+
return
|
|
149
|
+
lines.extend(["", "## Global Registry Findings"])
|
|
150
|
+
for finding in findings:
|
|
151
|
+
if not isinstance(finding, dict):
|
|
152
|
+
continue
|
|
153
|
+
lines.append(
|
|
154
|
+
"- "
|
|
155
|
+
f"{finding.get('severity')} "
|
|
156
|
+
f"{finding.get('kind')} "
|
|
157
|
+
f"goal={finding.get('goal_id') or finding.get('goal_ids') or 'global'}: "
|
|
158
|
+
f"{finding.get('message')}"
|
|
159
|
+
)
|
|
160
|
+
if finding.get("recommended_action"):
|
|
161
|
+
lines.append(f" - action: {finding.get('recommended_action')}")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def append_human_reward_markdown(lines: list[str], goal_id: Any, reward: dict[str, Any]) -> None:
|
|
165
|
+
headline_parts = []
|
|
166
|
+
for field in ("recorded_at", "decision", "reward"):
|
|
167
|
+
value = reward.get(field)
|
|
168
|
+
if value:
|
|
169
|
+
headline_parts.append(f"{field}={markdown_scalar(value)}")
|
|
170
|
+
if not headline_parts:
|
|
171
|
+
headline_parts.append("recorded=True")
|
|
172
|
+
lines.append(f" - human_reward: {' '.join(headline_parts)}")
|
|
173
|
+
reason = reward.get("reason_summary")
|
|
174
|
+
if reason:
|
|
175
|
+
lines.append(f" - reason_summary: {markdown_scalar(reason)}")
|
|
176
|
+
follow_up = reward.get("follow_up")
|
|
177
|
+
if follow_up:
|
|
178
|
+
lines.append(f" - follow_up: {markdown_scalar(follow_up)}")
|
|
179
|
+
lesson = as_dict(reward.get("lesson"))
|
|
180
|
+
if lesson:
|
|
181
|
+
lines.append(
|
|
182
|
+
" - lesson: "
|
|
183
|
+
f"kind={markdown_scalar(lesson.get('kind') or '')} "
|
|
184
|
+
f"summary={markdown_scalar(lesson.get('summary') or '')}"
|
|
185
|
+
)
|
|
186
|
+
for field in ("avoid", "prefer"):
|
|
187
|
+
values = as_list(lesson.get(field))
|
|
188
|
+
if values:
|
|
189
|
+
lines.append(
|
|
190
|
+
f" - lesson_{field}: "
|
|
191
|
+
+ ", ".join(markdown_scalar(value) for value in values[:5])
|
|
192
|
+
)
|
|
193
|
+
if goal_id:
|
|
194
|
+
lines.append(
|
|
195
|
+
" - project_agent_visibility: "
|
|
196
|
+
f"`loopx history --goal-id {markdown_scalar(goal_id)} --limit 3`"
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def append_operator_gate_resume_contract_markdown(lines: list[str], contract: dict[str, Any]) -> None:
|
|
201
|
+
headline_parts = []
|
|
202
|
+
for field in ("version", "gate_id", "operator_decision"):
|
|
203
|
+
value = contract.get(field)
|
|
204
|
+
if value:
|
|
205
|
+
headline_parts.append(f"{field}={markdown_scalar(value)}")
|
|
206
|
+
if not headline_parts:
|
|
207
|
+
headline_parts.append("recorded=True")
|
|
208
|
+
lines.append(f" - operator_gate_resume_contract: {' '.join(headline_parts)}")
|
|
209
|
+
for field in (
|
|
210
|
+
"latest_state_ref",
|
|
211
|
+
"freshness_check",
|
|
212
|
+
"precondition_check",
|
|
213
|
+
"migration_or_rebase_result",
|
|
214
|
+
"validation_after_resume",
|
|
215
|
+
):
|
|
216
|
+
value = contract.get(field)
|
|
217
|
+
if value:
|
|
218
|
+
lines.append(f" - {field}: {markdown_scalar(value)}")
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def append_run_history_markdown(lines: list[str], run_history: dict[str, Any]) -> None:
|
|
222
|
+
run_goals = run_history.get("goals") if isinstance(run_history.get("goals"), list) else []
|
|
223
|
+
lines.extend(
|
|
224
|
+
[
|
|
225
|
+
"",
|
|
226
|
+
"## Run History",
|
|
227
|
+
"- summary: "
|
|
228
|
+
f"goals={run_history.get('goal_count')}, "
|
|
229
|
+
f"runs={run_history.get('run_count')}",
|
|
230
|
+
]
|
|
231
|
+
)
|
|
232
|
+
if not run_goals:
|
|
233
|
+
lines.append("- none")
|
|
234
|
+
for goal in run_goals:
|
|
235
|
+
if not isinstance(goal, dict):
|
|
236
|
+
continue
|
|
237
|
+
lines.append(
|
|
238
|
+
"- "
|
|
239
|
+
f"`{goal.get('id')}`: "
|
|
240
|
+
f"status={goal.get('status')} "
|
|
241
|
+
f"phase={goal.get('lifecycle_phase')} "
|
|
242
|
+
f"adapter={goal.get('adapter_kind')}:{goal.get('adapter_status')} "
|
|
243
|
+
f"records={goal.get('raw_index_records')} "
|
|
244
|
+
f"unique_runs={goal.get('unique_runs')}"
|
|
245
|
+
)
|
|
246
|
+
quota = goal.get("quota") if isinstance(goal.get("quota"), dict) else {}
|
|
247
|
+
if quota:
|
|
248
|
+
lines.append(
|
|
249
|
+
" - quota: "
|
|
250
|
+
f"compute={quota.get('compute')} "
|
|
251
|
+
f"state={quota.get('state')} "
|
|
252
|
+
f"slots={quota.get('spent_slots')}/{quota.get('allowed_slots')}"
|
|
253
|
+
)
|
|
254
|
+
latest_runs = goal.get("latest_runs") if isinstance(goal.get("latest_runs"), list) else []
|
|
255
|
+
if latest_runs:
|
|
256
|
+
latest = latest_runs[0]
|
|
257
|
+
if isinstance(latest, dict):
|
|
258
|
+
reward = latest.get("human_reward") if isinstance(latest.get("human_reward"), dict) else {}
|
|
259
|
+
reward_text = (
|
|
260
|
+
f" reward={reward.get('decision')}:{reward.get('reward')}"
|
|
261
|
+
if reward
|
|
262
|
+
else ""
|
|
263
|
+
)
|
|
264
|
+
operator_gate = (
|
|
265
|
+
latest.get("operator_gate")
|
|
266
|
+
if isinstance(latest.get("operator_gate"), dict)
|
|
267
|
+
else {}
|
|
268
|
+
)
|
|
269
|
+
operator_gate_text = (
|
|
270
|
+
f" operator_gate={operator_gate.get('gate')}:{operator_gate.get('decision')}"
|
|
271
|
+
if operator_gate
|
|
272
|
+
else ""
|
|
273
|
+
)
|
|
274
|
+
readiness = (
|
|
275
|
+
latest.get("controller_readiness")
|
|
276
|
+
if isinstance(latest.get("controller_readiness"), dict)
|
|
277
|
+
else {}
|
|
278
|
+
)
|
|
279
|
+
readiness_text = (
|
|
280
|
+
f" readiness={readiness.get('classification')}"
|
|
281
|
+
if readiness
|
|
282
|
+
else ""
|
|
283
|
+
)
|
|
284
|
+
lines.append(
|
|
285
|
+
" - latest: "
|
|
286
|
+
f"{latest.get('generated_at')} "
|
|
287
|
+
f"classification={latest.get('classification')} "
|
|
288
|
+
f"phase={latest.get('lifecycle_phase')} "
|
|
289
|
+
f"artifacts={latest.get('json_exists')}/{latest.get('markdown_exists')}"
|
|
290
|
+
f"{reward_text}"
|
|
291
|
+
f"{operator_gate_text}"
|
|
292
|
+
f"{readiness_text}"
|
|
293
|
+
)
|
|
294
|
+
if reward:
|
|
295
|
+
append_human_reward_markdown(lines, goal.get("id"), reward)
|
|
296
|
+
resume_contract = (
|
|
297
|
+
latest.get("operator_gate_resume_contract")
|
|
298
|
+
if isinstance(latest.get("operator_gate_resume_contract"), dict)
|
|
299
|
+
else {}
|
|
300
|
+
)
|
|
301
|
+
if resume_contract:
|
|
302
|
+
append_operator_gate_resume_contract_markdown(lines, resume_contract)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def event_class_count_text(counts: dict[str, Any], event_classes: Collection[str]) -> str:
|
|
306
|
+
return " ".join(
|
|
307
|
+
f"{event_class}={counts.get(event_class, 0)}"
|
|
308
|
+
for event_class in event_classes
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def append_event_ledger_summary_markdown(
|
|
313
|
+
lines: list[str],
|
|
314
|
+
event_ledger: dict[str, Any],
|
|
315
|
+
*,
|
|
316
|
+
event_classes: Collection[str],
|
|
317
|
+
) -> None:
|
|
318
|
+
event_totals = (
|
|
319
|
+
event_ledger.get("totals")
|
|
320
|
+
if isinstance(event_ledger.get("totals"), dict)
|
|
321
|
+
else {}
|
|
322
|
+
)
|
|
323
|
+
if not event_ledger.get("available") or not event_totals:
|
|
324
|
+
return
|
|
325
|
+
|
|
326
|
+
by_class_24h = (
|
|
327
|
+
event_totals.get("by_class_24h")
|
|
328
|
+
if isinstance(event_totals.get("by_class_24h"), dict)
|
|
329
|
+
else {}
|
|
330
|
+
)
|
|
331
|
+
by_class_7d = (
|
|
332
|
+
event_totals.get("by_class_7d")
|
|
333
|
+
if isinstance(event_totals.get("by_class_7d"), dict)
|
|
334
|
+
else {}
|
|
335
|
+
)
|
|
336
|
+
lines.extend(
|
|
337
|
+
[
|
|
338
|
+
"",
|
|
339
|
+
"## Event Ledger Summary",
|
|
340
|
+
"- summary: "
|
|
341
|
+
f"source={markdown_scalar(event_ledger.get('source') or '')} "
|
|
342
|
+
f"samples={event_ledger.get('sample_run_count')} "
|
|
343
|
+
f"events_24h={event_totals.get('events_24h')} "
|
|
344
|
+
f"events_7d={event_totals.get('events_7d')} "
|
|
345
|
+
f"benchmark_runs_24h={event_totals.get('benchmark_runs_24h', 0)} "
|
|
346
|
+
f"benchmark_runs_7d={event_totals.get('benchmark_runs_7d', 0)} "
|
|
347
|
+
f"classes_24h={event_class_count_text(by_class_24h, event_classes)} "
|
|
348
|
+
f"classes_7d={event_class_count_text(by_class_7d, event_classes)}",
|
|
349
|
+
]
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
event_goals = (
|
|
353
|
+
event_ledger.get("goals")
|
|
354
|
+
if isinstance(event_ledger.get("goals"), list)
|
|
355
|
+
else []
|
|
356
|
+
)
|
|
357
|
+
for goal in event_goals[:3]:
|
|
358
|
+
if not isinstance(goal, dict):
|
|
359
|
+
continue
|
|
360
|
+
goal_by_class_24h = (
|
|
361
|
+
goal.get("by_class_24h")
|
|
362
|
+
if isinstance(goal.get("by_class_24h"), dict)
|
|
363
|
+
else {}
|
|
364
|
+
)
|
|
365
|
+
lines.append(
|
|
366
|
+
"- "
|
|
367
|
+
f"`{markdown_scalar(goal.get('goal_id') or '')}`: "
|
|
368
|
+
f"events_24h={goal.get('events_24h')} "
|
|
369
|
+
f"events_7d={goal.get('events_7d')} "
|
|
370
|
+
f"benchmark_runs_24h={goal.get('benchmark_runs_24h', 0)} "
|
|
371
|
+
f"benchmark_runs_7d={goal.get('benchmark_runs_7d', 0)} "
|
|
372
|
+
f"latest={markdown_scalar(goal.get('latest_event_class') or '')} "
|
|
373
|
+
f"classes_24h={event_class_count_text(goal_by_class_24h, event_classes)}"
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def append_promotion_readiness_summary_markdown(
|
|
378
|
+
lines: list[str],
|
|
379
|
+
promotion_readiness: dict[str, Any],
|
|
380
|
+
) -> None:
|
|
381
|
+
if not promotion_readiness:
|
|
382
|
+
return
|
|
383
|
+
lines.extend(
|
|
384
|
+
[
|
|
385
|
+
"",
|
|
386
|
+
"## Promotion Readiness Summary",
|
|
387
|
+
"- summary: "
|
|
388
|
+
f"source={markdown_scalar(promotion_readiness.get('source') or '')} "
|
|
389
|
+
f"available={promotion_readiness.get('available')} "
|
|
390
|
+
f"samples={promotion_readiness.get('sample_run_count')} "
|
|
391
|
+
f"freshness={markdown_scalar(promotion_readiness.get('freshness_status') or '')} "
|
|
392
|
+
f"age_hours={promotion_readiness.get('age_hours')} "
|
|
393
|
+
f"requires_readiness_run={promotion_readiness.get('requires_readiness_run')} "
|
|
394
|
+
f"window_hours={promotion_readiness.get('freshness_window_hours')}",
|
|
395
|
+
"- latest: "
|
|
396
|
+
f"goal={markdown_scalar(promotion_readiness.get('goal_id') or '')} "
|
|
397
|
+
f"generated_at={markdown_scalar(promotion_readiness.get('generated_at') or '')} "
|
|
398
|
+
f"classification={markdown_scalar(promotion_readiness.get('classification') or '')} "
|
|
399
|
+
f"outcome={markdown_scalar(promotion_readiness.get('delivery_outcome') or '')} "
|
|
400
|
+
f"artifacts={promotion_readiness.get('json_exists')}/{promotion_readiness.get('markdown_exists')}",
|
|
401
|
+
]
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def append_promotion_gate_markdown(
|
|
406
|
+
lines: list[str],
|
|
407
|
+
promotion_gate: dict[str, Any],
|
|
408
|
+
) -> None:
|
|
409
|
+
if not promotion_gate:
|
|
410
|
+
return
|
|
411
|
+
promotion_gate_readiness = (
|
|
412
|
+
promotion_gate.get("readiness")
|
|
413
|
+
if isinstance(promotion_gate.get("readiness"), dict)
|
|
414
|
+
else {}
|
|
415
|
+
)
|
|
416
|
+
lines.extend(
|
|
417
|
+
[
|
|
418
|
+
"",
|
|
419
|
+
"## Promotion Gate",
|
|
420
|
+
"- gate: "
|
|
421
|
+
f"state={markdown_scalar(promotion_gate.get('gate_state') or '')} "
|
|
422
|
+
f"can_promote={promotion_gate.get('can_promote')} "
|
|
423
|
+
f"should_warn={promotion_gate.get('should_warn')} "
|
|
424
|
+
f"non_blocking={promotion_gate.get('non_blocking')} "
|
|
425
|
+
f"freshness={markdown_scalar(promotion_gate_readiness.get('freshness_status') or '')} "
|
|
426
|
+
f"requires_readiness_run={promotion_gate_readiness.get('requires_readiness_run')}",
|
|
427
|
+
"- latest: "
|
|
428
|
+
f"generated_at={markdown_scalar(promotion_gate_readiness.get('generated_at') or '')} "
|
|
429
|
+
f"age_hours={promotion_gate_readiness.get('age_hours')} "
|
|
430
|
+
f"action={markdown_scalar(promotion_gate.get('recommended_action') or '')}",
|
|
431
|
+
]
|
|
432
|
+
)
|
|
433
|
+
if promotion_gate.get("warning_message"):
|
|
434
|
+
lines.append(
|
|
435
|
+
"- warning: "
|
|
436
|
+
f"{markdown_scalar(promotion_gate.get('warning_message') or '')}"
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def append_decision_freshness_summary_markdown(
|
|
441
|
+
lines: list[str],
|
|
442
|
+
decision_freshness: dict[str, Any],
|
|
443
|
+
) -> None:
|
|
444
|
+
decision_summary = (
|
|
445
|
+
decision_freshness.get("summary")
|
|
446
|
+
if isinstance(decision_freshness.get("summary"), dict)
|
|
447
|
+
else {}
|
|
448
|
+
)
|
|
449
|
+
if not decision_freshness.get("available") or not decision_summary:
|
|
450
|
+
return
|
|
451
|
+
|
|
452
|
+
lines.extend(
|
|
453
|
+
[
|
|
454
|
+
"",
|
|
455
|
+
"## Decision Freshness Summary",
|
|
456
|
+
"- summary: "
|
|
457
|
+
f"source={markdown_scalar(decision_freshness.get('source') or '')} "
|
|
458
|
+
f"samples={decision_freshness.get('sample_run_count')} "
|
|
459
|
+
f"window_days={decision_freshness.get('window_days')} "
|
|
460
|
+
f"decisions={decision_summary.get('decision_count')} "
|
|
461
|
+
f"stale={decision_summary.get('stale_count')} "
|
|
462
|
+
f"rebase_required={decision_summary.get('rebase_required_count')} "
|
|
463
|
+
f"fresh={decision_summary.get('fresh_count')}",
|
|
464
|
+
]
|
|
465
|
+
)
|
|
466
|
+
decision_items = (
|
|
467
|
+
decision_freshness.get("items")
|
|
468
|
+
if isinstance(decision_freshness.get("items"), list)
|
|
469
|
+
else []
|
|
470
|
+
)
|
|
471
|
+
for item in decision_items[:3]:
|
|
472
|
+
if not isinstance(item, dict):
|
|
473
|
+
continue
|
|
474
|
+
lines.append(
|
|
475
|
+
"- "
|
|
476
|
+
f"`{markdown_scalar(item.get('goal_id') or '')}`: "
|
|
477
|
+
f"kind={markdown_scalar(item.get('decision_kind') or '')} "
|
|
478
|
+
f"state={markdown_scalar(item.get('freshness_state') or '')} "
|
|
479
|
+
f"age_days={item.get('age_days')} "
|
|
480
|
+
f"newer_7d={item.get('newer_event_count_7d')} "
|
|
481
|
+
f"decision_at={markdown_scalar(item.get('decision_at') or '')}"
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
def append_usage_summary_markdown(lines: list[str], usage: dict[str, Any]) -> None:
|
|
486
|
+
usage_totals = usage.get("totals") if isinstance(usage.get("totals"), dict) else {}
|
|
487
|
+
if not usage.get("available") or not usage_totals:
|
|
488
|
+
return
|
|
489
|
+
|
|
490
|
+
lines.extend(
|
|
491
|
+
[
|
|
492
|
+
"",
|
|
493
|
+
"## Usage Summary",
|
|
494
|
+
"- summary: "
|
|
495
|
+
f"source={markdown_scalar(usage.get('source') or '')} "
|
|
496
|
+
f"samples={usage.get('sample_run_count')} "
|
|
497
|
+
f"runs_24h={usage_totals.get('runs_24h')} "
|
|
498
|
+
f"runs_7d={usage_totals.get('runs_7d')} "
|
|
499
|
+
f"quota_slots_24h={usage_totals.get('quota_spend_slots_24h')} "
|
|
500
|
+
f"quota_slots_7d={usage_totals.get('quota_spend_slots_7d')} "
|
|
501
|
+
f"automation_24h={usage_totals.get('automation_run_count_24h')} "
|
|
502
|
+
f"automation_7d={usage_totals.get('automation_run_count_7d')} "
|
|
503
|
+
f"progress_signals_24h={usage_totals.get('progress_signal_run_count_24h')} "
|
|
504
|
+
f"progress_signals_7d={usage_totals.get('progress_signal_run_count_7d')}",
|
|
505
|
+
]
|
|
506
|
+
)
|
|
507
|
+
usage_goals = usage.get("goals") if isinstance(usage.get("goals"), list) else []
|
|
508
|
+
for goal in usage_goals[:3]:
|
|
509
|
+
if not isinstance(goal, dict):
|
|
510
|
+
continue
|
|
511
|
+
lines.append(
|
|
512
|
+
"- "
|
|
513
|
+
f"`{markdown_scalar(goal.get('goal_id') or '')}`: "
|
|
514
|
+
f"runs_24h={goal.get('runs_24h')} "
|
|
515
|
+
f"runs_7d={goal.get('runs_7d')} "
|
|
516
|
+
f"quota_slots_24h={goal.get('quota_spend_slots_24h')} "
|
|
517
|
+
f"automation_24h={goal.get('automation_run_count_24h')} "
|
|
518
|
+
f"progress_signals_24h={goal.get('progress_signal_run_count_24h')} "
|
|
519
|
+
f"share_24h={goal.get('project_share_24h')}"
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
def append_project_asset_warning_markdown(
|
|
524
|
+
lines: list[str],
|
|
525
|
+
project_asset: dict[str, Any],
|
|
526
|
+
item: dict[str, Any],
|
|
527
|
+
) -> None:
|
|
528
|
+
projection_warning = (
|
|
529
|
+
project_asset.get("stale_latest_run_warning")
|
|
530
|
+
if isinstance(project_asset.get("stale_latest_run_warning"), dict)
|
|
531
|
+
else {}
|
|
532
|
+
)
|
|
533
|
+
if projection_warning:
|
|
534
|
+
lines.append(
|
|
535
|
+
" - stale_latest_run_warning: "
|
|
536
|
+
f"requires_refresh_state={projection_warning.get('requires_refresh_state')} "
|
|
537
|
+
f"active_state_updated_at={markdown_scalar(projection_warning.get('active_state_updated_at') or '')} "
|
|
538
|
+
f"latest_run_generated_at={markdown_scalar(projection_warning.get('latest_run_generated_at') or '')} "
|
|
539
|
+
f"reason={markdown_scalar(projection_warning.get('reason') or '')}"
|
|
540
|
+
)
|
|
541
|
+
next_action_warning = (
|
|
542
|
+
project_asset.get("next_action_projection_warning")
|
|
543
|
+
if isinstance(project_asset.get("next_action_projection_warning"), dict)
|
|
544
|
+
else item.get("next_action_projection_warning")
|
|
545
|
+
if isinstance(item.get("next_action_projection_warning"), dict)
|
|
546
|
+
else {}
|
|
547
|
+
)
|
|
548
|
+
if next_action_warning:
|
|
549
|
+
lines.append(
|
|
550
|
+
" - next_action_projection_warning: "
|
|
551
|
+
f"requires_state_writeback={next_action_warning.get('requires_state_writeback')} "
|
|
552
|
+
f"severity={markdown_scalar(next_action_warning.get('severity') or '')} "
|
|
553
|
+
f"reason={markdown_scalar(next_action_warning.get('reason') or '')}"
|
|
554
|
+
)
|
|
555
|
+
backlog_warning = (
|
|
556
|
+
project_asset.get("backlog_hygiene_warning")
|
|
557
|
+
if isinstance(project_asset.get("backlog_hygiene_warning"), dict)
|
|
558
|
+
else {}
|
|
559
|
+
)
|
|
560
|
+
if backlog_warning:
|
|
561
|
+
lines.append(
|
|
562
|
+
" - backlog_hygiene_warning: "
|
|
563
|
+
f"requires_agent_todo={backlog_warning.get('requires_agent_todo')} "
|
|
564
|
+
f"evidence_count={backlog_warning.get('evidence_count')} "
|
|
565
|
+
f"source_sections={markdown_scalar(','.join(backlog_warning.get('source_sections') or []))}"
|
|
566
|
+
)
|
|
567
|
+
projection_gap = (
|
|
568
|
+
project_asset.get("state_projection_gap")
|
|
569
|
+
if isinstance(project_asset.get("state_projection_gap"), dict)
|
|
570
|
+
else {}
|
|
571
|
+
)
|
|
572
|
+
if projection_gap:
|
|
573
|
+
lines.append(
|
|
574
|
+
" - state_projection_gap: "
|
|
575
|
+
f"requires_todo_expansion={projection_gap.get('requires_todo_expansion')} "
|
|
576
|
+
f"user_open={projection_gap.get('user_open_count')} "
|
|
577
|
+
f"agent_open={projection_gap.get('agent_open_count')} "
|
|
578
|
+
f"target_roles={markdown_scalar(','.join(projection_gap.get('target_roles') or []))}"
|
|
579
|
+
)
|
|
580
|
+
todo_projection_gap = (
|
|
581
|
+
project_asset.get("todo_projection_gap")
|
|
582
|
+
if isinstance(project_asset.get("todo_projection_gap"), dict)
|
|
583
|
+
else {}
|
|
584
|
+
)
|
|
585
|
+
if todo_projection_gap:
|
|
586
|
+
lines.append(
|
|
587
|
+
" - todo_projection_gap: "
|
|
588
|
+
f"missing_roles={markdown_scalar(','.join(todo_projection_gap.get('missing_roles') or []))} "
|
|
589
|
+
f"source={markdown_scalar(todo_projection_gap.get('source') or '')}"
|
|
590
|
+
)
|
|
591
|
+
archive_warning = (
|
|
592
|
+
project_asset.get("completed_todo_archive_warning")
|
|
593
|
+
if isinstance(project_asset.get("completed_todo_archive_warning"), dict)
|
|
594
|
+
else {}
|
|
595
|
+
)
|
|
596
|
+
if archive_warning:
|
|
597
|
+
lines.append(
|
|
598
|
+
" - completed_todo_archive_warning: "
|
|
599
|
+
f"requires_archive={archive_warning.get('requires_archive')} "
|
|
600
|
+
f"active_done={archive_warning.get('active_done_count')} "
|
|
601
|
+
f"max_active_done={archive_warning.get('max_active_done_count')} "
|
|
602
|
+
f"default_archive_keep={archive_warning.get('default_archive_keep_count')} "
|
|
603
|
+
f"archive_section={markdown_scalar(archive_warning.get('archive_section') or '')} "
|
|
604
|
+
f"archive_command={markdown_scalar(archive_warning.get('archive_command_template') or '')}"
|
|
605
|
+
)
|
|
606
|
+
replan_obligation = (
|
|
607
|
+
project_asset.get("autonomous_replan_obligation")
|
|
608
|
+
if isinstance(project_asset.get("autonomous_replan_obligation"), dict)
|
|
609
|
+
else {}
|
|
610
|
+
)
|
|
611
|
+
if replan_obligation:
|
|
612
|
+
trigger_kinds = [
|
|
613
|
+
str(trigger.get("kind") or "")
|
|
614
|
+
for trigger in replan_obligation.get("triggers") or []
|
|
615
|
+
if isinstance(trigger, dict) and trigger.get("kind")
|
|
616
|
+
]
|
|
617
|
+
lines.append(
|
|
618
|
+
" - autonomous_replan_obligation: "
|
|
619
|
+
f"required={replan_obligation.get('required')} "
|
|
620
|
+
f"trigger_count={replan_obligation.get('trigger_count')} "
|
|
621
|
+
f"triggers={markdown_scalar(','.join(trigger_kinds))}"
|
|
622
|
+
)
|
|
623
|
+
interface_budget_cadence = (
|
|
624
|
+
project_asset.get("interface_budget_cadence")
|
|
625
|
+
if isinstance(project_asset.get("interface_budget_cadence"), dict)
|
|
626
|
+
else {}
|
|
627
|
+
)
|
|
628
|
+
if interface_budget_cadence:
|
|
629
|
+
lines.append(
|
|
630
|
+
" - interface_budget_cadence: "
|
|
631
|
+
f"overdue={interface_budget_cadence.get('overdue')} "
|
|
632
|
+
f"within_budget={interface_budget_cadence.get('within_budget')} "
|
|
633
|
+
f"checked_at={markdown_scalar(interface_budget_cadence.get('checked_at') or '')} "
|
|
634
|
+
f"next_check_due_at={markdown_scalar(interface_budget_cadence.get('next_check_due_at') or '')} "
|
|
635
|
+
f"tightest={markdown_scalar(interface_budget_cadence.get('tightest_surface') or '')}/"
|
|
636
|
+
f"{markdown_scalar(interface_budget_cadence.get('tightest_metric') or '')} "
|
|
637
|
+
f"headroom={interface_budget_cadence.get('headroom_remaining')} "
|
|
638
|
+
f"recommendation={markdown_scalar(interface_budget_cadence.get('recommendation') or '')}"
|
|
639
|
+
)
|
|
640
|
+
latest_validation = (
|
|
641
|
+
project_asset.get("latest_validation")
|
|
642
|
+
if isinstance(project_asset.get("latest_validation"), dict)
|
|
643
|
+
else {}
|
|
644
|
+
)
|
|
645
|
+
if latest_validation:
|
|
646
|
+
lines.append(
|
|
647
|
+
" - latest_validation: "
|
|
648
|
+
f"classification={markdown_scalar(latest_validation.get('classification') or '')} "
|
|
649
|
+
f"at={markdown_scalar(latest_validation.get('generated_at') or '')}"
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
def append_project_asset_session_runtime_markdown(
|
|
654
|
+
lines: list[str],
|
|
655
|
+
project_asset: dict[str, Any],
|
|
656
|
+
) -> None:
|
|
657
|
+
session_projection = (
|
|
658
|
+
project_asset.get("session_runtime_projection")
|
|
659
|
+
if isinstance(project_asset.get("session_runtime_projection"), dict)
|
|
660
|
+
else {}
|
|
661
|
+
)
|
|
662
|
+
if not session_projection:
|
|
663
|
+
return
|
|
664
|
+
first_screen = (
|
|
665
|
+
session_projection.get("first_screen")
|
|
666
|
+
if isinstance(session_projection.get("first_screen"), dict)
|
|
667
|
+
else {}
|
|
668
|
+
)
|
|
669
|
+
boundary = (
|
|
670
|
+
session_projection.get("boundary")
|
|
671
|
+
if isinstance(session_projection.get("boundary"), dict)
|
|
672
|
+
else {}
|
|
673
|
+
)
|
|
674
|
+
source = (
|
|
675
|
+
session_projection.get("source")
|
|
676
|
+
if isinstance(session_projection.get("source"), dict)
|
|
677
|
+
else {}
|
|
678
|
+
)
|
|
679
|
+
lines.append(
|
|
680
|
+
" - session_runtime_projection: "
|
|
681
|
+
f"waiting_on={markdown_scalar(first_screen.get('waiting_on') or '')} "
|
|
682
|
+
f"agent_can_continue={first_screen.get('agent_can_continue')} "
|
|
683
|
+
f"user_action_required={first_screen.get('user_action_required')} "
|
|
684
|
+
f"gate={markdown_scalar(first_screen.get('gate_state') or '')} "
|
|
685
|
+
f"raw_material_detected={boundary.get('raw_material_detected')} "
|
|
686
|
+
f"runtime_writeback_allowed={boundary.get('runtime_writeback_allowed')} "
|
|
687
|
+
f"host={markdown_scalar(source.get('host_kind') or '')}"
|
|
688
|
+
)
|
|
689
|
+
if first_screen.get("first_user_todo"):
|
|
690
|
+
lines.append(
|
|
691
|
+
" - session_runtime_user_todo: "
|
|
692
|
+
f"{markdown_scalar(first_screen.get('first_user_todo') or '')}"
|
|
693
|
+
)
|
|
694
|
+
if first_screen.get("first_agent_todo"):
|
|
695
|
+
lines.append(
|
|
696
|
+
" - session_runtime_agent_todo: "
|
|
697
|
+
f"{markdown_scalar(first_screen.get('first_agent_todo') or '')}"
|
|
698
|
+
)
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
def append_handoff_readiness_markdown(
|
|
702
|
+
lines: list[str],
|
|
703
|
+
handoff_readiness: dict[str, Any],
|
|
704
|
+
) -> None:
|
|
705
|
+
if not handoff_readiness:
|
|
706
|
+
return
|
|
707
|
+
lines.append(
|
|
708
|
+
" - handoff_readiness: "
|
|
709
|
+
f"ready={handoff_readiness.get('ready')} "
|
|
710
|
+
f"codex_ready={handoff_readiness.get('codex_ready')} "
|
|
711
|
+
f"source={markdown_scalar(handoff_readiness.get('source') or '')} "
|
|
712
|
+
f"quota_state={markdown_scalar(handoff_readiness.get('quota_state') or '')}"
|
|
713
|
+
)
|
|
714
|
+
interface_budget = (
|
|
715
|
+
handoff_readiness.get("handoff_interface_budget")
|
|
716
|
+
if isinstance(handoff_readiness.get("handoff_interface_budget"), dict)
|
|
717
|
+
else {}
|
|
718
|
+
)
|
|
719
|
+
if interface_budget:
|
|
720
|
+
lines.append(
|
|
721
|
+
" - handoff_interface_budget: "
|
|
722
|
+
f"mode={markdown_scalar(interface_budget.get('mode') or '')} "
|
|
723
|
+
f"max_lines={interface_budget.get('max_lines')} "
|
|
724
|
+
f"max_chars={interface_budget.get('max_chars')}"
|
|
725
|
+
)
|
|
726
|
+
checks = (
|
|
727
|
+
handoff_readiness.get("checks")
|
|
728
|
+
if isinstance(handoff_readiness.get("checks"), dict)
|
|
729
|
+
else {}
|
|
730
|
+
)
|
|
731
|
+
passed = [key for key, value in checks.items() if value]
|
|
732
|
+
failed = [key for key, value in checks.items() if not value]
|
|
733
|
+
if checks:
|
|
734
|
+
lines.append(
|
|
735
|
+
" - handoff_checks: "
|
|
736
|
+
f"pass={','.join(passed) if passed else '-'} "
|
|
737
|
+
f"fail={','.join(failed) if failed else '-'}"
|
|
738
|
+
)
|
|
739
|
+
lines.append(
|
|
740
|
+
" - handoff_state: "
|
|
741
|
+
f"status={markdown_scalar(handoff_readiness.get('handoff_status') or '')} "
|
|
742
|
+
f"post_handoff_run_seen={handoff_readiness.get('post_handoff_run_seen')} "
|
|
743
|
+
f"ready_at={markdown_scalar(handoff_readiness.get('handoff_ready_at') or '')}"
|
|
744
|
+
)
|
|
745
|
+
latest_handoff_run = (
|
|
746
|
+
handoff_readiness.get("post_handoff_latest_run")
|
|
747
|
+
if isinstance(handoff_readiness.get("post_handoff_latest_run"), dict)
|
|
748
|
+
else {}
|
|
749
|
+
)
|
|
750
|
+
if latest_handoff_run:
|
|
751
|
+
outcome_suffix = ""
|
|
752
|
+
if latest_handoff_run.get("delivery_outcome"):
|
|
753
|
+
outcome_suffix = (
|
|
754
|
+
" "
|
|
755
|
+
f"outcome={markdown_scalar(latest_handoff_run.get('delivery_outcome') or '')}"
|
|
756
|
+
)
|
|
757
|
+
turn_kind_suffix = ""
|
|
758
|
+
if latest_handoff_run.get("delivery_turn_kind"):
|
|
759
|
+
turn_kind_suffix = (
|
|
760
|
+
" "
|
|
761
|
+
f"turn_kind={markdown_scalar(latest_handoff_run.get('delivery_turn_kind') or '')}"
|
|
762
|
+
)
|
|
763
|
+
lines.append(
|
|
764
|
+
" - post_handoff_run: "
|
|
765
|
+
f"classification={markdown_scalar(latest_handoff_run.get('classification') or '')} "
|
|
766
|
+
f"at={markdown_scalar(latest_handoff_run.get('generated_at') or '')} "
|
|
767
|
+
f"scale={markdown_scalar(latest_handoff_run.get('delivery_batch_scale') or '')}"
|
|
768
|
+
f"{outcome_suffix}"
|
|
769
|
+
f"{turn_kind_suffix}"
|
|
770
|
+
)
|
|
771
|
+
recent_handoff_runs = (
|
|
772
|
+
handoff_readiness.get("post_handoff_recent_runs")
|
|
773
|
+
if isinstance(handoff_readiness.get("post_handoff_recent_runs"), list)
|
|
774
|
+
else []
|
|
775
|
+
)
|
|
776
|
+
recent_scales = [
|
|
777
|
+
markdown_scalar(str(run.get("delivery_batch_scale") or ""))
|
|
778
|
+
for run in recent_handoff_runs
|
|
779
|
+
if isinstance(run, dict)
|
|
780
|
+
]
|
|
781
|
+
if recent_scales:
|
|
782
|
+
recent_outcomes = [
|
|
783
|
+
markdown_scalar(str(run.get("delivery_outcome") or ""))
|
|
784
|
+
for run in recent_handoff_runs
|
|
785
|
+
if isinstance(run, dict) and run.get("delivery_outcome")
|
|
786
|
+
]
|
|
787
|
+
outcome_text = f" outcome={','.join(recent_outcomes)}" if recent_outcomes else ""
|
|
788
|
+
recent_turn_kinds = [
|
|
789
|
+
markdown_scalar(str(run.get("delivery_turn_kind") or ""))
|
|
790
|
+
for run in recent_handoff_runs
|
|
791
|
+
if isinstance(run, dict) and run.get("delivery_turn_kind")
|
|
792
|
+
]
|
|
793
|
+
turn_kind_text = f" turn_kind={','.join(recent_turn_kinds)}" if recent_turn_kinds else ""
|
|
794
|
+
gap_text = (
|
|
795
|
+
f" outcome_gap_streak={handoff_readiness.get('post_handoff_outcome_gap_streak')}"
|
|
796
|
+
if "post_handoff_outcome_gap_streak" in handoff_readiness
|
|
797
|
+
else ""
|
|
798
|
+
)
|
|
799
|
+
lines.append(
|
|
800
|
+
" - post_handoff_recent_scales: "
|
|
801
|
+
f"{','.join(recent_scales)} "
|
|
802
|
+
f"small_streak={handoff_readiness.get('post_handoff_small_scale_streak', 0)}"
|
|
803
|
+
f"{outcome_text}"
|
|
804
|
+
f"{turn_kind_text}"
|
|
805
|
+
f"{gap_text}"
|
|
806
|
+
)
|
|
807
|
+
if handoff_readiness.get("next_probe"):
|
|
808
|
+
handoff_probe = markdown_scalar(handoff_readiness.get("next_probe") or "")
|
|
809
|
+
lines.append(f" - handoff_probe: `{handoff_probe}`")
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
def append_project_asset_todo_quota_markdown(
|
|
813
|
+
lines: list[str],
|
|
814
|
+
project_asset: dict[str, Any],
|
|
815
|
+
*,
|
|
816
|
+
goal_todo_scope_suffix: str = "",
|
|
817
|
+
) -> None:
|
|
818
|
+
asset_user_todos = (
|
|
819
|
+
project_asset.get("user_todos")
|
|
820
|
+
if isinstance(project_asset.get("user_todos"), dict)
|
|
821
|
+
else {}
|
|
822
|
+
)
|
|
823
|
+
asset_agent_todos = (
|
|
824
|
+
project_asset.get("agent_todos")
|
|
825
|
+
if isinstance(project_asset.get("agent_todos"), dict)
|
|
826
|
+
else {}
|
|
827
|
+
)
|
|
828
|
+
if asset_user_todos or asset_agent_todos:
|
|
829
|
+
todo_parts = []
|
|
830
|
+
if asset_user_todos:
|
|
831
|
+
todo_parts.append(f"user_open={asset_user_todos.get('open')}")
|
|
832
|
+
if asset_user_todos.get("claimed_open_count"):
|
|
833
|
+
todo_parts.append(f"user_claimed={asset_user_todos.get('claimed_open_count')}")
|
|
834
|
+
if asset_agent_todos:
|
|
835
|
+
todo_parts.append(f"agent_open={asset_agent_todos.get('open')}")
|
|
836
|
+
if asset_agent_todos.get("claimed_open_count"):
|
|
837
|
+
todo_parts.append(f"agent_claimed={asset_agent_todos.get('claimed_open_count')}")
|
|
838
|
+
lines.append(f" - asset_todos: {' '.join(todo_parts)}")
|
|
839
|
+
if asset_user_todos.get("next"):
|
|
840
|
+
claimed = asset_user_todos.get("next_claimed_by")
|
|
841
|
+
claim_suffix = f" claimed_by={markdown_scalar(claimed)}" if claimed else ""
|
|
842
|
+
lines.append(
|
|
843
|
+
f" - asset_user_todo: "
|
|
844
|
+
f"{markdown_scalar(asset_user_todos.get('next') or '')}"
|
|
845
|
+
f"{claim_suffix}"
|
|
846
|
+
)
|
|
847
|
+
for todo in (asset_user_todos.get("items") or [])[1:3]:
|
|
848
|
+
if isinstance(todo, dict) and todo.get("text"):
|
|
849
|
+
index = todo.get("index")
|
|
850
|
+
suffix = f"[{index}]" if index is not None else ""
|
|
851
|
+
claimed = todo.get("claimed_by")
|
|
852
|
+
claim_suffix = f" claimed_by={markdown_scalar(claimed)}" if claimed else ""
|
|
853
|
+
lines.append(
|
|
854
|
+
f" - asset_user_todo{suffix}: "
|
|
855
|
+
f"{markdown_scalar(todo.get('text') or '')}"
|
|
856
|
+
f"{claim_suffix}"
|
|
857
|
+
)
|
|
858
|
+
if asset_agent_todos.get("next"):
|
|
859
|
+
claimed = asset_agent_todos.get("next_claimed_by")
|
|
860
|
+
claim_suffix = f" claimed_by={markdown_scalar(claimed)}" if claimed else ""
|
|
861
|
+
lines.append(
|
|
862
|
+
f" - asset_agent_todo: "
|
|
863
|
+
f"{markdown_scalar(asset_agent_todos.get('next') or '')}"
|
|
864
|
+
f"{claim_suffix}{goal_todo_scope_suffix}"
|
|
865
|
+
)
|
|
866
|
+
for todo in (asset_agent_todos.get("items") or [])[1:3]:
|
|
867
|
+
if isinstance(todo, dict) and todo.get("text"):
|
|
868
|
+
index = todo.get("index")
|
|
869
|
+
suffix = f"[{index}]" if index is not None else ""
|
|
870
|
+
claimed = todo.get("claimed_by")
|
|
871
|
+
claim_suffix = f" claimed_by={markdown_scalar(claimed)}" if claimed else ""
|
|
872
|
+
lines.append(
|
|
873
|
+
f" - asset_agent_todo{suffix}: "
|
|
874
|
+
f"{markdown_scalar(todo.get('text') or '')}"
|
|
875
|
+
f"{claim_suffix}{goal_todo_scope_suffix}"
|
|
876
|
+
)
|
|
877
|
+
asset_quota = (
|
|
878
|
+
project_asset.get("quota")
|
|
879
|
+
if isinstance(project_asset.get("quota"), dict)
|
|
880
|
+
else {}
|
|
881
|
+
)
|
|
882
|
+
if asset_quota:
|
|
883
|
+
lines.append(
|
|
884
|
+
" - asset_quota: "
|
|
885
|
+
f"compute={asset_quota.get('compute')} "
|
|
886
|
+
f"state={asset_quota.get('state')} "
|
|
887
|
+
f"slots={asset_quota.get('spent_slots')}/{asset_quota.get('allowed_slots')}"
|
|
888
|
+
)
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
def append_attention_queue_summary_markdown(
|
|
892
|
+
lines: list[str],
|
|
893
|
+
queue: dict[str, Any],
|
|
894
|
+
) -> None:
|
|
895
|
+
lines.extend(
|
|
896
|
+
[
|
|
897
|
+
"",
|
|
898
|
+
"## Attention Queue",
|
|
899
|
+
"- summary: "
|
|
900
|
+
f"items={queue.get('item_count')}, "
|
|
901
|
+
f"needs_user_or_controller={queue.get('needs_user_or_controller')}, "
|
|
902
|
+
f"needs_controller={queue.get('needs_controller')}, "
|
|
903
|
+
f"needs_codex={queue.get('needs_codex')}, "
|
|
904
|
+
f"watching_external_evidence={queue.get('watching_external_evidence')}, "
|
|
905
|
+
f"watching_monitor={queue.get('watching_monitor')}",
|
|
906
|
+
]
|
|
907
|
+
)
|
|
908
|
+
backlog = (
|
|
909
|
+
queue.get("autonomous_backlog_candidates")
|
|
910
|
+
if isinstance(queue.get("autonomous_backlog_candidates"), dict)
|
|
911
|
+
else {}
|
|
912
|
+
)
|
|
913
|
+
append_attention_queue_candidate_group_markdown(
|
|
914
|
+
lines,
|
|
915
|
+
backlog,
|
|
916
|
+
group_name="autonomous_backlog_candidates",
|
|
917
|
+
item_name="autonomous_candidate",
|
|
918
|
+
)
|
|
919
|
+
monitor_candidates = (
|
|
920
|
+
queue.get("autonomous_monitor_candidates")
|
|
921
|
+
if isinstance(queue.get("autonomous_monitor_candidates"), dict)
|
|
922
|
+
else {}
|
|
923
|
+
)
|
|
924
|
+
append_attention_queue_candidate_group_markdown(
|
|
925
|
+
lines,
|
|
926
|
+
monitor_candidates,
|
|
927
|
+
group_name="autonomous_monitor_candidates",
|
|
928
|
+
item_name="autonomous_monitor_candidate",
|
|
929
|
+
)
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
def render_status_markdown(
|
|
933
|
+
payload: dict[str, Any],
|
|
934
|
+
*,
|
|
935
|
+
event_classes: Collection[str] = EVENT_LEDGER_CLASSES,
|
|
936
|
+
) -> str:
|
|
937
|
+
lines: list[str] = []
|
|
938
|
+
append_status_overview_markdown(lines, payload)
|
|
939
|
+
contract = payload.get("contract") if isinstance(payload.get("contract"), dict) else {}
|
|
940
|
+
|
|
941
|
+
global_registry = (
|
|
942
|
+
payload.get("global_registry")
|
|
943
|
+
if isinstance(payload.get("global_registry"), dict)
|
|
944
|
+
else {}
|
|
945
|
+
)
|
|
946
|
+
append_global_registry_summary_markdown(lines, global_registry)
|
|
947
|
+
runtime_projection_routes = (
|
|
948
|
+
payload.get("runtime_projection_routes")
|
|
949
|
+
if isinstance(payload.get("runtime_projection_routes"), dict)
|
|
950
|
+
else {}
|
|
951
|
+
)
|
|
952
|
+
append_runtime_projection_routes_markdown(lines, runtime_projection_routes)
|
|
953
|
+
|
|
954
|
+
event_ledger = (
|
|
955
|
+
payload.get("event_ledger_summary")
|
|
956
|
+
if isinstance(payload.get("event_ledger_summary"), dict)
|
|
957
|
+
else {}
|
|
958
|
+
)
|
|
959
|
+
append_event_ledger_summary_markdown(
|
|
960
|
+
lines,
|
|
961
|
+
event_ledger,
|
|
962
|
+
event_classes=event_classes,
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
promotion_readiness = (
|
|
966
|
+
payload.get("promotion_readiness_summary")
|
|
967
|
+
if isinstance(payload.get("promotion_readiness_summary"), dict)
|
|
968
|
+
else {}
|
|
969
|
+
)
|
|
970
|
+
append_promotion_readiness_summary_markdown(lines, promotion_readiness)
|
|
971
|
+
|
|
972
|
+
promotion_gate = (
|
|
973
|
+
payload.get("promotion_gate")
|
|
974
|
+
if isinstance(payload.get("promotion_gate"), dict)
|
|
975
|
+
else {}
|
|
976
|
+
)
|
|
977
|
+
append_promotion_gate_markdown(lines, promotion_gate)
|
|
978
|
+
|
|
979
|
+
decision_freshness = (
|
|
980
|
+
payload.get("decision_freshness_summary")
|
|
981
|
+
if isinstance(payload.get("decision_freshness_summary"), dict)
|
|
982
|
+
else {}
|
|
983
|
+
)
|
|
984
|
+
append_decision_freshness_summary_markdown(lines, decision_freshness)
|
|
985
|
+
|
|
986
|
+
usage = payload.get("usage_summary") if isinstance(payload.get("usage_summary"), dict) else {}
|
|
987
|
+
append_usage_summary_markdown(lines, usage)
|
|
988
|
+
|
|
989
|
+
queue = payload.get("attention_queue") if isinstance(payload.get("attention_queue"), dict) else {}
|
|
990
|
+
append_attention_queue_summary_markdown(lines, queue)
|
|
991
|
+
items = queue.get("items") if isinstance(queue.get("items"), list) else []
|
|
992
|
+
goals = goals_by_id(payload)
|
|
993
|
+
if not items:
|
|
994
|
+
lines.append("- none")
|
|
995
|
+
for item in items:
|
|
996
|
+
if not isinstance(item, dict):
|
|
997
|
+
continue
|
|
998
|
+
authority_summary = authority_registry_markdown_summary(
|
|
999
|
+
goals.get(str(item.get("goal_id") or ""))
|
|
1000
|
+
)
|
|
1001
|
+
append_attention_queue_item_header_markdown(
|
|
1002
|
+
lines,
|
|
1003
|
+
item,
|
|
1004
|
+
authority_summary=authority_summary,
|
|
1005
|
+
)
|
|
1006
|
+
goal_todo_scope_suffix = attention_queue_goal_todo_scope_suffix(item)
|
|
1007
|
+
append_attention_queue_project_asset_markdown(
|
|
1008
|
+
lines,
|
|
1009
|
+
item,
|
|
1010
|
+
goal_todo_scope_suffix=goal_todo_scope_suffix,
|
|
1011
|
+
)
|
|
1012
|
+
append_attention_queue_item_operational_markdown(
|
|
1013
|
+
lines,
|
|
1014
|
+
item,
|
|
1015
|
+
goal_todo_scope_suffix=goal_todo_scope_suffix,
|
|
1016
|
+
)
|
|
1017
|
+
|
|
1018
|
+
run_history = payload.get("run_history") if isinstance(payload.get("run_history"), dict) else {}
|
|
1019
|
+
append_run_history_markdown(lines, run_history)
|
|
1020
|
+
|
|
1021
|
+
append_status_contract_detail_sections_markdown(lines, contract)
|
|
1022
|
+
|
|
1023
|
+
append_global_registry_findings_markdown(lines, global_registry)
|
|
1024
|
+
|
|
1025
|
+
return "\n".join(lines)
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
def append_attention_queue_candidate_group_markdown(
|
|
1029
|
+
lines: list[str],
|
|
1030
|
+
candidates: dict[str, Any],
|
|
1031
|
+
*,
|
|
1032
|
+
group_name: str,
|
|
1033
|
+
item_name: str,
|
|
1034
|
+
) -> None:
|
|
1035
|
+
if not candidates:
|
|
1036
|
+
return
|
|
1037
|
+
lines.append(
|
|
1038
|
+
f"- {group_name}: "
|
|
1039
|
+
f"open={candidates.get('open_count')} "
|
|
1040
|
+
f"task_class={markdown_scalar(candidates.get('task_class') or '')} "
|
|
1041
|
+
f"source={markdown_scalar(candidates.get('source') or '')}"
|
|
1042
|
+
)
|
|
1043
|
+
for candidate in candidates.get("items") or []:
|
|
1044
|
+
if not isinstance(candidate, dict):
|
|
1045
|
+
continue
|
|
1046
|
+
priority_text = ""
|
|
1047
|
+
if candidate.get("priority"):
|
|
1048
|
+
priority_text = f" priority={markdown_scalar(candidate.get('priority') or '')}"
|
|
1049
|
+
lines.append(
|
|
1050
|
+
f" - {item_name}: "
|
|
1051
|
+
f"goal={markdown_scalar(candidate.get('goal_id') or '')}"
|
|
1052
|
+
f"{priority_text} "
|
|
1053
|
+
f"text={markdown_scalar(candidate.get('text') or '')}"
|
|
1054
|
+
)
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
def append_attention_queue_item_header_markdown(
|
|
1058
|
+
lines: list[str],
|
|
1059
|
+
item: dict[str, Any],
|
|
1060
|
+
*,
|
|
1061
|
+
authority_summary: str | None = None,
|
|
1062
|
+
) -> None:
|
|
1063
|
+
action = markdown_scalar(item.get("recommended_action") or "")
|
|
1064
|
+
lines.append(
|
|
1065
|
+
"- "
|
|
1066
|
+
f"`{item.get('goal_id')}`: "
|
|
1067
|
+
f"status={item.get('status')} "
|
|
1068
|
+
f"phase={item.get('lifecycle_phase')} "
|
|
1069
|
+
f"waiting_on={item.get('waiting_on')} "
|
|
1070
|
+
f"severity={item.get('severity')} "
|
|
1071
|
+
f"source={item.get('source')}"
|
|
1072
|
+
)
|
|
1073
|
+
if action:
|
|
1074
|
+
lines.append(f" - action: {action}")
|
|
1075
|
+
active_state_action = markdown_scalar(item.get("active_state_next_action") or "")
|
|
1076
|
+
if active_state_action:
|
|
1077
|
+
lines.append(f" - active_state_next_action: {active_state_action}")
|
|
1078
|
+
latest_run_action = markdown_scalar(item.get("latest_run_recommended_action") or "")
|
|
1079
|
+
if latest_run_action:
|
|
1080
|
+
lines.append(f" - latest_run_recommended_action: {latest_run_action}")
|
|
1081
|
+
if authority_summary:
|
|
1082
|
+
lines.append(f" - authority_material: {authority_summary}")
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
def _attention_queue_item_project_asset(item: dict[str, Any]) -> dict[str, Any]:
|
|
1086
|
+
return item.get("project_asset") if isinstance(item.get("project_asset"), dict) else {}
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
def _attention_queue_item_agent_lane_next_action(
|
|
1090
|
+
item: dict[str, Any],
|
|
1091
|
+
project_asset: dict[str, Any],
|
|
1092
|
+
) -> dict[str, Any]:
|
|
1093
|
+
if isinstance(project_asset.get("agent_lane_next_action"), dict):
|
|
1094
|
+
return project_asset["agent_lane_next_action"]
|
|
1095
|
+
if isinstance(item.get("agent_lane_next_action"), dict):
|
|
1096
|
+
return item["agent_lane_next_action"]
|
|
1097
|
+
return {}
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
def _attention_queue_item_agent_lane_frontier_hint(
|
|
1101
|
+
item: dict[str, Any],
|
|
1102
|
+
project_asset: dict[str, Any],
|
|
1103
|
+
) -> dict[str, Any]:
|
|
1104
|
+
if isinstance(project_asset.get("agent_lane_frontier_hint"), dict):
|
|
1105
|
+
return project_asset["agent_lane_frontier_hint"]
|
|
1106
|
+
if isinstance(item.get("agent_lane_frontier_hint"), dict):
|
|
1107
|
+
return item["agent_lane_frontier_hint"]
|
|
1108
|
+
return {}
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
def attention_queue_goal_todo_scope_suffix(item: dict[str, Any]) -> str:
|
|
1112
|
+
project_asset = _attention_queue_item_project_asset(item)
|
|
1113
|
+
return (
|
|
1114
|
+
" scope=goal_all_agents"
|
|
1115
|
+
if _attention_queue_item_agent_lane_next_action(item, project_asset)
|
|
1116
|
+
else ""
|
|
1117
|
+
)
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
def _attention_queue_item_goal_frontier(
|
|
1121
|
+
item: dict[str, Any],
|
|
1122
|
+
project_asset: dict[str, Any],
|
|
1123
|
+
) -> dict[str, Any]:
|
|
1124
|
+
if isinstance(project_asset.get("goal_frontier_projection"), dict):
|
|
1125
|
+
return project_asset["goal_frontier_projection"]
|
|
1126
|
+
if isinstance(item.get("goal_frontier_projection"), dict):
|
|
1127
|
+
return item["goal_frontier_projection"]
|
|
1128
|
+
return {}
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
def _append_project_asset_agent_lane_markdown(
|
|
1132
|
+
lines: list[str],
|
|
1133
|
+
item: dict[str, Any],
|
|
1134
|
+
project_asset: dict[str, Any],
|
|
1135
|
+
*,
|
|
1136
|
+
agent_lane_next_action: dict[str, Any],
|
|
1137
|
+
agent_lane_frontier_hint: dict[str, Any],
|
|
1138
|
+
) -> None:
|
|
1139
|
+
if agent_lane_next_action:
|
|
1140
|
+
agent = markdown_scalar(agent_lane_next_action.get("agent_id") or "")
|
|
1141
|
+
todo_id = markdown_scalar(agent_lane_next_action.get("todo_id") or "")
|
|
1142
|
+
selected_by = markdown_scalar(agent_lane_next_action.get("selected_by") or "")
|
|
1143
|
+
confidence = markdown_scalar(agent_lane_next_action.get("confidence") or "")
|
|
1144
|
+
action = markdown_scalar(agent_lane_next_action.get("text") or "")
|
|
1145
|
+
lines.append(
|
|
1146
|
+
" - current_agent_todo: "
|
|
1147
|
+
f"agent={agent} todo_id={todo_id} selected_by={selected_by} "
|
|
1148
|
+
f"confidence={confidence} source=agent_lane_next_action action={action}"
|
|
1149
|
+
)
|
|
1150
|
+
if agent_lane_frontier_hint:
|
|
1151
|
+
lines.append(
|
|
1152
|
+
" - agent_lane_frontier_hint: "
|
|
1153
|
+
f"agent={markdown_scalar(agent_lane_frontier_hint.get('agent_id') or '')} "
|
|
1154
|
+
f"decision={markdown_scalar(agent_lane_frontier_hint.get('decision') or '')} "
|
|
1155
|
+
f"source={markdown_scalar(agent_lane_frontier_hint.get('source') or '')} "
|
|
1156
|
+
f"reason_code={markdown_scalar(agent_lane_frontier_hint.get('reason_code') or '')} "
|
|
1157
|
+
f"target_todo_id={markdown_scalar(agent_lane_frontier_hint.get('target_todo_id') or '')}"
|
|
1158
|
+
)
|
|
1159
|
+
|
|
1160
|
+
goal_frontier = _attention_queue_item_goal_frontier(item, project_asset)
|
|
1161
|
+
if not goal_frontier:
|
|
1162
|
+
return
|
|
1163
|
+
remaining = (
|
|
1164
|
+
goal_frontier.get("remaining_advancement_frontier")
|
|
1165
|
+
if isinstance(goal_frontier.get("remaining_advancement_frontier"), dict)
|
|
1166
|
+
else {}
|
|
1167
|
+
)
|
|
1168
|
+
deferred_successors = (
|
|
1169
|
+
goal_frontier.get("deferred_successors")
|
|
1170
|
+
if isinstance(goal_frontier.get("deferred_successors"), dict)
|
|
1171
|
+
else {}
|
|
1172
|
+
)
|
|
1173
|
+
acceptance_gaps = (
|
|
1174
|
+
goal_frontier.get("acceptance_gaps")
|
|
1175
|
+
if isinstance(goal_frontier.get("acceptance_gaps"), list)
|
|
1176
|
+
else []
|
|
1177
|
+
)
|
|
1178
|
+
lines.append(
|
|
1179
|
+
" - goal_frontier_projection: "
|
|
1180
|
+
f"replan_required={goal_frontier.get('replan_required')} "
|
|
1181
|
+
f"current_agent_advancement={remaining.get('current_agent_claimed_advancement_count')} "
|
|
1182
|
+
f"unclaimed_advancement={remaining.get('unclaimed_advancement_count')} "
|
|
1183
|
+
f"other_agent_advancement={remaining.get('other_agent_claimed_advancement_count')} "
|
|
1184
|
+
f"deferred_ready={deferred_successors.get('ready_count')} "
|
|
1185
|
+
f"acceptance_gaps={len(acceptance_gaps)}"
|
|
1186
|
+
)
|
|
1187
|
+
vision_audit = as_dict(goal_frontier.get("vision_continuation_audit"))
|
|
1188
|
+
if vision_audit:
|
|
1189
|
+
lines.append(
|
|
1190
|
+
" - vision_continuation_audit: "
|
|
1191
|
+
f"required={vision_audit.get('required')} "
|
|
1192
|
+
f"decision={markdown_scalar(vision_audit.get('decision') or '')} "
|
|
1193
|
+
f"trigger_count={vision_audit.get('trigger_count')}"
|
|
1194
|
+
)
|
|
1195
|
+
vision_gap_judge = as_dict(vision_audit.get("vision_gap_judge"))
|
|
1196
|
+
if vision_gap_judge:
|
|
1197
|
+
lines.append(
|
|
1198
|
+
" - vision_gap_judge: "
|
|
1199
|
+
f"done={vision_gap_judge.get('done')} "
|
|
1200
|
+
f"decision={markdown_scalar(vision_gap_judge.get('decision') or '')}"
|
|
1201
|
+
)
|
|
1202
|
+
vision_wait_state = as_dict(goal_frontier.get("vision_wait_state"))
|
|
1203
|
+
if vision_wait_state:
|
|
1204
|
+
lines.append(
|
|
1205
|
+
" - vision_wait_state: "
|
|
1206
|
+
f"state={markdown_scalar(vision_wait_state.get('state') or '')} "
|
|
1207
|
+
f"todo_id={markdown_scalar(vision_wait_state.get('selected_todo_id') or '')} "
|
|
1208
|
+
f"resume_when={markdown_scalar(vision_wait_state.get('resume_when') or '')} "
|
|
1209
|
+
f"automatic_resume={vision_wait_state.get('automatic_resume')}"
|
|
1210
|
+
)
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
def _append_project_asset_runtime_policy_markdown(
|
|
1214
|
+
lines: list[str],
|
|
1215
|
+
project_asset: dict[str, Any],
|
|
1216
|
+
) -> None:
|
|
1217
|
+
dreaming_lane_badge = (
|
|
1218
|
+
project_asset.get("dreaming_lane_badge")
|
|
1219
|
+
if isinstance(project_asset.get("dreaming_lane_badge"), dict)
|
|
1220
|
+
else {}
|
|
1221
|
+
)
|
|
1222
|
+
if dreaming_lane_badge:
|
|
1223
|
+
lines.append(
|
|
1224
|
+
" - dreaming_lane_badge: "
|
|
1225
|
+
f"lane={markdown_scalar(dreaming_lane_badge.get('lane') or '')} "
|
|
1226
|
+
f"status={markdown_scalar(dreaming_lane_badge.get('status') or '')} "
|
|
1227
|
+
f"proposal_id={markdown_scalar(dreaming_lane_badge.get('proposal_id') or '')} "
|
|
1228
|
+
f"advisory={dreaming_lane_badge.get('advisory')} "
|
|
1229
|
+
f"interrupts_delivery={dreaming_lane_badge.get('interrupts_delivery')} "
|
|
1230
|
+
f"execution_allowed={dreaming_lane_badge.get('execution_allowed')}"
|
|
1231
|
+
)
|
|
1232
|
+
|
|
1233
|
+
asset_execution_profile = (
|
|
1234
|
+
project_asset.get("execution_profile")
|
|
1235
|
+
if isinstance(project_asset.get("execution_profile"), dict)
|
|
1236
|
+
else None
|
|
1237
|
+
)
|
|
1238
|
+
if asset_execution_profile:
|
|
1239
|
+
lines.append(
|
|
1240
|
+
" - execution_profile: "
|
|
1241
|
+
f"{markdown_scalar(execution_profile_summary(asset_execution_profile))}"
|
|
1242
|
+
)
|
|
1243
|
+
long_task_cadence_hint = (
|
|
1244
|
+
project_asset.get("long_task_cadence_hint")
|
|
1245
|
+
if isinstance(project_asset.get("long_task_cadence_hint"), dict)
|
|
1246
|
+
else None
|
|
1247
|
+
)
|
|
1248
|
+
if long_task_cadence_hint:
|
|
1249
|
+
lines.append(
|
|
1250
|
+
" - long_task_cadence_hint: "
|
|
1251
|
+
f"{markdown_scalar(long_task_cadence_hint_summary(long_task_cadence_hint))}"
|
|
1252
|
+
)
|
|
1253
|
+
asset_orchestration = (
|
|
1254
|
+
project_asset.get("orchestration")
|
|
1255
|
+
if isinstance(project_asset.get("orchestration"), dict)
|
|
1256
|
+
else None
|
|
1257
|
+
)
|
|
1258
|
+
if asset_orchestration:
|
|
1259
|
+
lines.append(
|
|
1260
|
+
" - orchestration: "
|
|
1261
|
+
f"{markdown_scalar(orchestration_policy_summary(asset_orchestration))}"
|
|
1262
|
+
)
|
|
1263
|
+
|
|
1264
|
+
subagent_activity = (
|
|
1265
|
+
project_asset.get("subagent_activity")
|
|
1266
|
+
if isinstance(project_asset.get("subagent_activity"), dict)
|
|
1267
|
+
else {}
|
|
1268
|
+
)
|
|
1269
|
+
if not subagent_activity:
|
|
1270
|
+
return
|
|
1271
|
+
lines.append(
|
|
1272
|
+
" - subagent_activity: "
|
|
1273
|
+
f"children={subagent_activity.get('child_count')} "
|
|
1274
|
+
f"visible={subagent_activity.get('visible_child_count')} "
|
|
1275
|
+
f"active={subagent_activity.get('active_count')} "
|
|
1276
|
+
f"completed={subagent_activity.get('completed_count')} "
|
|
1277
|
+
f"quota_slots={subagent_activity.get('quota_spend_slots')}"
|
|
1278
|
+
)
|
|
1279
|
+
for child in (subagent_activity.get("items") or [])[:3]:
|
|
1280
|
+
if not isinstance(child, dict):
|
|
1281
|
+
continue
|
|
1282
|
+
role = markdown_scalar(child.get("agent_role") or "subagent")
|
|
1283
|
+
state = markdown_scalar(child.get("state") or "unknown")
|
|
1284
|
+
run_id = markdown_scalar(child.get("run_id") or "")
|
|
1285
|
+
parent_run_id = markdown_scalar(child.get("parent_run_id") or "")
|
|
1286
|
+
lines.append(
|
|
1287
|
+
f" - child_run: role={role} state={state} "
|
|
1288
|
+
f"run_id={run_id} parent_run_id={parent_run_id}"
|
|
1289
|
+
)
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
def append_attention_queue_project_asset_markdown(
|
|
1293
|
+
lines: list[str],
|
|
1294
|
+
item: dict[str, Any],
|
|
1295
|
+
*,
|
|
1296
|
+
goal_todo_scope_suffix: str = "",
|
|
1297
|
+
) -> None:
|
|
1298
|
+
project_asset = _attention_queue_item_project_asset(item)
|
|
1299
|
+
agent_lane_next_action = _attention_queue_item_agent_lane_next_action(item, project_asset)
|
|
1300
|
+
agent_lane_frontier_hint = _attention_queue_item_agent_lane_frontier_hint(
|
|
1301
|
+
item,
|
|
1302
|
+
project_asset,
|
|
1303
|
+
)
|
|
1304
|
+
lines.append(
|
|
1305
|
+
" - project_asset_source: "
|
|
1306
|
+
+ (
|
|
1307
|
+
"project_asset"
|
|
1308
|
+
if project_asset
|
|
1309
|
+
else "legacy/raw fallback; owner/gate/stop are not project_asset-backed"
|
|
1310
|
+
)
|
|
1311
|
+
)
|
|
1312
|
+
if not project_asset:
|
|
1313
|
+
return
|
|
1314
|
+
|
|
1315
|
+
lines.append(
|
|
1316
|
+
" - project_asset: "
|
|
1317
|
+
f"owner={markdown_scalar(project_asset.get('owner') or '')} "
|
|
1318
|
+
f"gate={markdown_scalar(project_asset.get('gate') or '')} "
|
|
1319
|
+
f"stop={markdown_scalar(project_asset.get('stop_condition') or '')}"
|
|
1320
|
+
)
|
|
1321
|
+
asset_next_action = markdown_scalar(project_asset.get("next_action") or "")
|
|
1322
|
+
if asset_next_action:
|
|
1323
|
+
lines.append(f" - asset_next_action: {asset_next_action}")
|
|
1324
|
+
asset_active_next_action = markdown_scalar(project_asset.get("active_state_next_action") or "")
|
|
1325
|
+
if asset_active_next_action:
|
|
1326
|
+
lines.append(f" - asset_active_state_next_action: {asset_active_next_action}")
|
|
1327
|
+
asset_latest_run_action = markdown_scalar(project_asset.get("latest_run_recommended_action") or "")
|
|
1328
|
+
if asset_latest_run_action:
|
|
1329
|
+
lines.append(f" - asset_latest_run_recommended_action: {asset_latest_run_action}")
|
|
1330
|
+
|
|
1331
|
+
agent_lane_recommendation = (
|
|
1332
|
+
project_asset.get("agent_lane_recommendation")
|
|
1333
|
+
if isinstance(project_asset.get("agent_lane_recommendation"), dict)
|
|
1334
|
+
else {}
|
|
1335
|
+
)
|
|
1336
|
+
if agent_lane_recommendation:
|
|
1337
|
+
lane = markdown_scalar(agent_lane_recommendation.get("agent_lane") or "")
|
|
1338
|
+
agent = markdown_scalar(agent_lane_recommendation.get("agent_id") or "")
|
|
1339
|
+
recommendation = markdown_scalar(agent_lane_recommendation.get("recommended_action") or "")
|
|
1340
|
+
lines.append(
|
|
1341
|
+
" - agent_lane_recommendation: "
|
|
1342
|
+
f"agent={agent} lane={lane} action={recommendation}"
|
|
1343
|
+
)
|
|
1344
|
+
|
|
1345
|
+
agent_member = (
|
|
1346
|
+
project_asset.get("agent_member")
|
|
1347
|
+
if isinstance(project_asset.get("agent_member"), dict)
|
|
1348
|
+
else item.get("agent_member")
|
|
1349
|
+
if isinstance(item.get("agent_member"), dict)
|
|
1350
|
+
else {}
|
|
1351
|
+
)
|
|
1352
|
+
if agent_member:
|
|
1353
|
+
current_claims = ",".join(
|
|
1354
|
+
markdown_scalar(claim)
|
|
1355
|
+
for claim in (agent_member.get("current_claims") or [])
|
|
1356
|
+
if str(claim or "").strip()
|
|
1357
|
+
)
|
|
1358
|
+
member_fields = [
|
|
1359
|
+
f"agent={markdown_scalar(agent_member.get('agent_id') or '')}",
|
|
1360
|
+
f"agent_model={markdown_scalar(agent_member.get('agent_model') or '')}",
|
|
1361
|
+
]
|
|
1362
|
+
if agent_member.get("profile_role"):
|
|
1363
|
+
member_fields.append(f"profile_role={markdown_scalar(agent_member['profile_role'])}")
|
|
1364
|
+
if agent_member.get("scope_summary"):
|
|
1365
|
+
member_fields.append(f"scope={markdown_scalar(agent_member['scope_summary'])}")
|
|
1366
|
+
if agent_member.get("vision_requirement"):
|
|
1367
|
+
member_fields.append(
|
|
1368
|
+
f"vision_requirement={markdown_scalar(agent_member['vision_requirement'])}"
|
|
1369
|
+
)
|
|
1370
|
+
member_fields.extend(
|
|
1371
|
+
[
|
|
1372
|
+
f"claims={markdown_scalar(current_claims)}",
|
|
1373
|
+
f"handoff_assignment={markdown_scalar(agent_member.get('handoff_assignment_status') or '')}",
|
|
1374
|
+
f"source={markdown_scalar(agent_member.get('profile_source') or '')}",
|
|
1375
|
+
"authority=advisory_projection",
|
|
1376
|
+
]
|
|
1377
|
+
)
|
|
1378
|
+
lines.append(" - agent_member: " + " ".join(member_fields))
|
|
1379
|
+
|
|
1380
|
+
agent_interaction = (
|
|
1381
|
+
project_asset.get("agent_interaction_summary")
|
|
1382
|
+
if isinstance(project_asset.get("agent_interaction_summary"), dict)
|
|
1383
|
+
else item.get("agent_interaction_summary")
|
|
1384
|
+
if isinstance(item.get("agent_interaction_summary"), dict)
|
|
1385
|
+
else {}
|
|
1386
|
+
)
|
|
1387
|
+
if agent_interaction:
|
|
1388
|
+
user_open_count = agent_interaction.get("user_open_count")
|
|
1389
|
+
open_count_part = (
|
|
1390
|
+
f"open_count={user_open_count} "
|
|
1391
|
+
if user_open_count is not None
|
|
1392
|
+
else ""
|
|
1393
|
+
)
|
|
1394
|
+
lines.append(
|
|
1395
|
+
" - current_agent_interaction: "
|
|
1396
|
+
f"agent={markdown_scalar(agent_interaction.get('agent_id') or '')} "
|
|
1397
|
+
f"mode={markdown_scalar(agent_interaction.get('mode') or '')} "
|
|
1398
|
+
f"action_required={agent_interaction.get('user_action_required')} "
|
|
1399
|
+
f"{open_count_part}"
|
|
1400
|
+
f"notify={markdown_scalar(agent_interaction.get('user_notify') or '')} "
|
|
1401
|
+
f"must_attempt={agent_interaction.get('agent_must_attempt')} "
|
|
1402
|
+
f"delivery_allowed={agent_interaction.get('delivery_allowed')} "
|
|
1403
|
+
f"quiet_noop_allowed={agent_interaction.get('quiet_noop_allowed')} "
|
|
1404
|
+
f"spend_after_validation={agent_interaction.get('spend_after_validation')}"
|
|
1405
|
+
)
|
|
1406
|
+
|
|
1407
|
+
agent_reward_memory = (
|
|
1408
|
+
project_asset.get("agent_reward_memory")
|
|
1409
|
+
if isinstance(project_asset.get("agent_reward_memory"), dict)
|
|
1410
|
+
else item.get("agent_reward_memory")
|
|
1411
|
+
if isinstance(item.get("agent_reward_memory"), dict)
|
|
1412
|
+
else {}
|
|
1413
|
+
)
|
|
1414
|
+
if agent_reward_memory:
|
|
1415
|
+
config_runtime_route = (
|
|
1416
|
+
agent_reward_memory.get("config_runtime_route")
|
|
1417
|
+
if isinstance(agent_reward_memory.get("config_runtime_route"), dict)
|
|
1418
|
+
else {}
|
|
1419
|
+
)
|
|
1420
|
+
lines.append(
|
|
1421
|
+
" - agent_reward_memory: "
|
|
1422
|
+
f"agent={markdown_scalar(agent_reward_memory.get('agent_id') or '')} "
|
|
1423
|
+
f"status={markdown_scalar(agent_reward_memory.get('experiment_status') or '')} "
|
|
1424
|
+
f"automatic_ingest={agent_reward_memory.get('automatic_ingest')} "
|
|
1425
|
+
f"automatic_recall={agent_reward_memory.get('automatic_recall')} "
|
|
1426
|
+
f"runtime_scope={markdown_scalar(config_runtime_route.get('runtime_scope') or '')} "
|
|
1427
|
+
f"exact_readback={config_runtime_route.get('exact_readback_verified')}"
|
|
1428
|
+
)
|
|
1429
|
+
|
|
1430
|
+
_append_project_asset_agent_lane_markdown(
|
|
1431
|
+
lines,
|
|
1432
|
+
item,
|
|
1433
|
+
project_asset,
|
|
1434
|
+
agent_lane_next_action=agent_lane_next_action,
|
|
1435
|
+
agent_lane_frontier_hint=agent_lane_frontier_hint,
|
|
1436
|
+
)
|
|
1437
|
+
_append_project_asset_runtime_policy_markdown(lines, project_asset)
|
|
1438
|
+
|
|
1439
|
+
append_project_asset_todo_quota_markdown(
|
|
1440
|
+
lines,
|
|
1441
|
+
project_asset,
|
|
1442
|
+
goal_todo_scope_suffix=goal_todo_scope_suffix,
|
|
1443
|
+
)
|
|
1444
|
+
append_project_asset_warning_markdown(lines, project_asset, item)
|
|
1445
|
+
append_project_asset_session_runtime_markdown(lines, project_asset)
|
|
1446
|
+
handoff_readiness = (
|
|
1447
|
+
item.get("handoff_readiness")
|
|
1448
|
+
if isinstance(item.get("handoff_readiness"), dict)
|
|
1449
|
+
else {}
|
|
1450
|
+
)
|
|
1451
|
+
append_handoff_readiness_markdown(lines, handoff_readiness)
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
def append_attention_queue_item_operational_markdown(
|
|
1455
|
+
lines: list[str],
|
|
1456
|
+
item: dict[str, Any],
|
|
1457
|
+
*,
|
|
1458
|
+
goal_todo_scope_suffix: str = "",
|
|
1459
|
+
) -> None:
|
|
1460
|
+
user_todos = item.get("user_todos") if isinstance(item.get("user_todos"), dict) else {}
|
|
1461
|
+
if user_todos:
|
|
1462
|
+
todo_parts = [
|
|
1463
|
+
f"open={user_todos.get('open_count')}",
|
|
1464
|
+
f"done={user_todos.get('done_count')}",
|
|
1465
|
+
f"total={user_todos.get('total_count')}",
|
|
1466
|
+
]
|
|
1467
|
+
if user_todos.get("claimed_open_count"):
|
|
1468
|
+
todo_parts.insert(1, f"claimed={user_todos.get('claimed_open_count')}")
|
|
1469
|
+
todo_parts.insert(2, f"unclaimed={user_todos.get('unclaimed_open_count', 0)}")
|
|
1470
|
+
lines.append(f" - user_todos: {' '.join(todo_parts)}")
|
|
1471
|
+
for todo in user_todos.get("items") or []:
|
|
1472
|
+
if not isinstance(todo, dict) or todo.get("done"):
|
|
1473
|
+
continue
|
|
1474
|
+
claimed = todo.get("claimed_by")
|
|
1475
|
+
claim_suffix = f" claimed_by={markdown_scalar(claimed)}" if claimed else ""
|
|
1476
|
+
lines.append(f" - next_user_todo: {markdown_scalar(todo.get('text') or '')}{claim_suffix}")
|
|
1477
|
+
for material in todo.get("review_materials") or []:
|
|
1478
|
+
if not isinstance(material, dict):
|
|
1479
|
+
continue
|
|
1480
|
+
lines.append(
|
|
1481
|
+
" - review_material: "
|
|
1482
|
+
f"{markdown_scalar(material.get('label') or material.get('path') or '')} "
|
|
1483
|
+
f"exists={material.get('exists')}"
|
|
1484
|
+
)
|
|
1485
|
+
break
|
|
1486
|
+
|
|
1487
|
+
agent_todos = item.get("agent_todos") if isinstance(item.get("agent_todos"), dict) else {}
|
|
1488
|
+
if agent_todos:
|
|
1489
|
+
todo_parts = [
|
|
1490
|
+
f"open={agent_todos.get('open_count')}",
|
|
1491
|
+
f"done={agent_todos.get('done_count')}",
|
|
1492
|
+
f"total={agent_todos.get('total_count')}",
|
|
1493
|
+
]
|
|
1494
|
+
if agent_todos.get("claimed_open_count"):
|
|
1495
|
+
todo_parts.insert(1, f"claimed={agent_todos.get('claimed_open_count')}")
|
|
1496
|
+
todo_parts.insert(2, f"unclaimed={agent_todos.get('unclaimed_open_count', 0)}")
|
|
1497
|
+
lines.append(f" - agent_todos: {' '.join(todo_parts)}")
|
|
1498
|
+
for todo in agent_todos.get("items") or []:
|
|
1499
|
+
if not isinstance(todo, dict) or todo.get("done"):
|
|
1500
|
+
continue
|
|
1501
|
+
claimed = todo.get("claimed_by")
|
|
1502
|
+
claim_suffix = f" claimed_by={markdown_scalar(claimed)}" if claimed else ""
|
|
1503
|
+
lines.append(
|
|
1504
|
+
f" - next_agent_todo: "
|
|
1505
|
+
f"{markdown_scalar(todo.get('text') or '')}"
|
|
1506
|
+
f"{claim_suffix}{goal_todo_scope_suffix}"
|
|
1507
|
+
)
|
|
1508
|
+
break
|
|
1509
|
+
|
|
1510
|
+
dependency_blockers = (
|
|
1511
|
+
item.get("dependency_blockers")
|
|
1512
|
+
if isinstance(item.get("dependency_blockers"), dict)
|
|
1513
|
+
else {}
|
|
1514
|
+
)
|
|
1515
|
+
if dependency_blockers:
|
|
1516
|
+
lines.append(
|
|
1517
|
+
" - dependency_blockers: "
|
|
1518
|
+
f"open={dependency_blockers.get('open_count')} "
|
|
1519
|
+
f"source={markdown_scalar(dependency_blockers.get('source') or '')}"
|
|
1520
|
+
)
|
|
1521
|
+
for blocker in dependency_blockers.get("items") or []:
|
|
1522
|
+
if not isinstance(blocker, dict):
|
|
1523
|
+
continue
|
|
1524
|
+
lines.append(
|
|
1525
|
+
" - dependency_user_todo: "
|
|
1526
|
+
f"goal={markdown_scalar(blocker.get('goal_id') or '')} "
|
|
1527
|
+
f"waiting_on={markdown_scalar(blocker.get('waiting_on') or '')} "
|
|
1528
|
+
f"text={markdown_scalar(blocker.get('text') or '')}"
|
|
1529
|
+
)
|
|
1530
|
+
|
|
1531
|
+
quota = item.get("quota") if isinstance(item.get("quota"), dict) else {}
|
|
1532
|
+
if quota:
|
|
1533
|
+
lines.append(
|
|
1534
|
+
" - quota: "
|
|
1535
|
+
f"compute={quota.get('compute')} "
|
|
1536
|
+
f"state={quota.get('state')} "
|
|
1537
|
+
f"slots={quota.get('spent_slots')}/{quota.get('allowed_slots')} "
|
|
1538
|
+
f"reason={quota.get('reason')}"
|
|
1539
|
+
)
|
|
1540
|
+
|
|
1541
|
+
control_plane = item.get("control_plane") if isinstance(item.get("control_plane"), dict) else None
|
|
1542
|
+
if control_plane:
|
|
1543
|
+
lines.append(f" - control_plane: {control_plane_policy_summary(control_plane)}")
|
|
1544
|
+
|
|
1545
|
+
operator_question = item.get("operator_question")
|
|
1546
|
+
agent_command = item.get("agent_command")
|
|
1547
|
+
if operator_question:
|
|
1548
|
+
lines.append(f" - operator_question: {operator_question}")
|
|
1549
|
+
if agent_command:
|
|
1550
|
+
goal_id = item.get("goal_id")
|
|
1551
|
+
lines.append(
|
|
1552
|
+
" - operator_gate_dry_run: "
|
|
1553
|
+
f"`loopx operator-gate --goal-id {goal_id} --decision approve "
|
|
1554
|
+
'--reason-summary "<public-safe reason>" --dry-run`'
|
|
1555
|
+
)
|
|
1556
|
+
if agent_command:
|
|
1557
|
+
lines.append(f" - agent_command: `{agent_command}`")
|
|
1558
|
+
|
|
1559
|
+
gates = item.get("missing_gates") if isinstance(item.get("missing_gates"), list) else []
|
|
1560
|
+
gate_text = ", ".join(str(gate) for gate in gates if gate)
|
|
1561
|
+
controller_stage = item.get("controller_stage")
|
|
1562
|
+
next_condition = item.get("next_handoff_condition")
|
|
1563
|
+
if controller_stage or gate_text:
|
|
1564
|
+
lines.append(
|
|
1565
|
+
" - gates: "
|
|
1566
|
+
f"stage={controller_stage or 'none'} "
|
|
1567
|
+
f"missing={gate_text or 'none'}"
|
|
1568
|
+
)
|
|
1569
|
+
if next_condition:
|
|
1570
|
+
lines.append(f" - next_handoff_condition: {next_condition}")
|