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.
Files changed (811) hide show
  1. loopx/__init__.py +5 -0
  2. loopx/agent_onboarding.py +654 -0
  3. loopx/agent_registry.py +112 -0
  4. loopx/ark_managed_agent_host.py +59 -0
  5. loopx/authority.py +805 -0
  6. loopx/benchmark.py +2875 -0
  7. loopx/benchmark_adapters/__init__.py +1 -0
  8. loopx/benchmark_adapters/agentissue.py +2644 -0
  9. loopx/benchmark_adapters/agents_last_exam.py +3998 -0
  10. loopx/benchmark_adapters/edgebench.py +322 -0
  11. loopx/benchmark_adapters/skillsbench.py +5978 -0
  12. loopx/benchmark_adapters/skillsbench_acp_failure_policy.py +143 -0
  13. loopx/benchmark_adapters/skillsbench_acp_process.py +31 -0
  14. loopx/benchmark_adapters/skillsbench_acp_relay.py +4832 -0
  15. loopx/benchmark_adapters/skillsbench_batch.py +124 -0
  16. loopx/benchmark_adapters/skillsbench_bridge_guard.py +209 -0
  17. loopx/benchmark_adapters/skillsbench_bridge_summary.py +203 -0
  18. loopx/benchmark_adapters/skillsbench_codex_goal_recovery.py +271 -0
  19. loopx/benchmark_adapters/skillsbench_codex_goal_trace.py +81 -0
  20. loopx/benchmark_adapters/skillsbench_codex_runtime.py +339 -0
  21. loopx/benchmark_adapters/skillsbench_dockerfile_runtime.py +467 -0
  22. loopx/benchmark_adapters/skillsbench_failure_signals.py +652 -0
  23. loopx/benchmark_adapters/skillsbench_proxy_runtime.py +327 -0
  24. loopx/benchmark_adapters/skillsbench_remote_bridge.py +402 -0
  25. loopx/benchmark_adapters/skillsbench_result_discovery.py +143 -0
  26. loopx/benchmark_adapters/skillsbench_runner_profile.py +436 -0
  27. loopx/benchmark_adapters/skillsbench_runner_source.py +99 -0
  28. loopx/benchmark_adapters/skillsbench_setup_preflight.py +771 -0
  29. loopx/benchmark_adapters/skillsbench_signals.py +15 -0
  30. loopx/benchmark_adapters/skillsbench_task_source.py +141 -0
  31. loopx/benchmark_adapters/skillsbench_turn_route.py +723 -0
  32. loopx/benchmark_adapters/skillsbench_turn_runtime.py +1069 -0
  33. loopx/benchmark_adapters/skillsbench_typed_repair.py +689 -0
  34. loopx/benchmark_adapters/skillsbench_uv_cache.py +111 -0
  35. loopx/benchmark_adapters/skillsbench_verifier_bootstrap.py +227 -0
  36. loopx/benchmark_adapters/skillsbench_verifier_cache.py +138 -0
  37. loopx/benchmark_adapters/terminal_bench.py +10078 -0
  38. loopx/benchmark_case_analysis.py +1276 -0
  39. loopx/benchmark_case_state.py +1079 -0
  40. loopx/benchmark_core/__init__.py +239 -0
  41. loopx/benchmark_core/adapter.py +84 -0
  42. loopx/benchmark_core/artifacts.py +517 -0
  43. loopx/benchmark_core/attempts.py +199 -0
  44. loopx/benchmark_core/container_exec.py +216 -0
  45. loopx/benchmark_core/io.py +68 -0
  46. loopx/benchmark_core/lifecycle.py +211 -0
  47. loopx/benchmark_core/loop_protocol.py +689 -0
  48. loopx/benchmark_core/observable_handles.py +348 -0
  49. loopx/benchmark_core/parity.py +256 -0
  50. loopx/benchmark_core/remote_closeout.py +482 -0
  51. loopx/benchmark_core/rounds.py +215 -0
  52. loopx/benchmark_core/route_profile.py +509 -0
  53. loopx/benchmark_core/run_permissions.py +206 -0
  54. loopx/benchmark_core/split_control.py +925 -0
  55. loopx/benchmark_core/turn_fidelity.py +326 -0
  56. loopx/benchmark_ledger.py +3793 -0
  57. loopx/benchmark_ledger_countability.py +372 -0
  58. loopx/benchmark_ledger_current.py +724 -0
  59. loopx/benchmark_trajectory.py +405 -0
  60. loopx/benchmarks/__init__.py +1 -0
  61. loopx/benchmarks/qualification/__init__.py +1 -0
  62. loopx/benchmarks/qualification/release_outcome_baseline.py +360 -0
  63. loopx/benchmarks/read_models/__init__.py +1 -0
  64. loopx/benchmarks/read_models/benchmark_attempt_accounting.py +53 -0
  65. loopx/benchmarks/read_models/benchmark_comparison.py +414 -0
  66. loopx/benchmarks/read_models/benchmark_event_timeline.py +113 -0
  67. loopx/benchmarks/read_models/benchmark_experiment_report.py +475 -0
  68. loopx/benchmarks/read_models/benchmark_learning_ledger.py +137 -0
  69. loopx/benchmarks/read_models/benchmark_lifecycle_contracts.py +228 -0
  70. loopx/benchmarks/read_models/benchmark_projection.py +723 -0
  71. loopx/benchmarks/read_models/benchmark_result.py +146 -0
  72. loopx/benchmarks/read_models/benchmark_run_execution_contract.py +116 -0
  73. loopx/benchmarks/read_models/benchmark_run_failure.py +157 -0
  74. loopx/benchmarks/read_models/benchmark_run_metrics.py +213 -0
  75. loopx/benchmarks/read_models/benchmark_run_post_execution.py +635 -0
  76. loopx/benchmarks/read_models/benchmark_run_pre_execution.py +541 -0
  77. loopx/benchmarks/read_models/benchmark_status_compaction.py +1255 -0
  78. loopx/benchmarks/read_models/benchmark_status_runner.py +780 -0
  79. loopx/benchmarks/read_models/goal_start_control_score.py +857 -0
  80. loopx/benchmarks/read_models/skillsbench_post_run_debug.py +746 -0
  81. loopx/benchmarks/read_models/skillsbench_verifier_attribution.py +269 -0
  82. loopx/bootstrap.py +1116 -0
  83. loopx/bootstrap_command_pack.py +2167 -0
  84. loopx/boundary_authority.py +199 -0
  85. loopx/canary/__init__.py +1 -0
  86. loopx/canary/maintainability_ratchet.py +800 -0
  87. loopx/canary/planner.py +1984 -0
  88. loopx/canary/premerge.py +1130 -0
  89. loopx/canary/qualification_profiles.py +309 -0
  90. loopx/canary/quality_surface_catalog.py +838 -0
  91. loopx/canary/release_profiles.py +51 -0
  92. loopx/canary/runner.py +1107 -0
  93. loopx/canary/smoke_health.py +581 -0
  94. loopx/canary/smoke_profiles.py +212 -0
  95. loopx/capabilities/__init__.py +0 -0
  96. loopx/capabilities/agent_turn_recall/__init__.py +17 -0
  97. loopx/capabilities/agent_turn_recall/cli.py +369 -0
  98. loopx/capabilities/agent_turn_recall/core.py +296 -0
  99. loopx/capabilities/auto_research/__init__.py +16 -0
  100. loopx/capabilities/auto_research/bootstrap_contract.py +157 -0
  101. loopx/capabilities/auto_research/cli.py +1468 -0
  102. loopx/capabilities/auto_research/core.py +11 -0
  103. loopx/capabilities/auto_research/defaults.py +79 -0
  104. loopx/capabilities/auto_research/demo_e2e.py +1848 -0
  105. loopx/capabilities/auto_research/demo_supervisor.py +186 -0
  106. loopx/capabilities/auto_research/evidence_packet.py +767 -0
  107. loopx/capabilities/auto_research/human_view.py +794 -0
  108. loopx/capabilities/auto_research/kernel.py +191 -0
  109. loopx/capabilities/auto_research/knn_demo_workspace.py +322 -0
  110. loopx/capabilities/auto_research/live_evidence.py +248 -0
  111. loopx/capabilities/auto_research/preset.py +176 -0
  112. loopx/capabilities/auto_research/research_state.py +1085 -0
  113. loopx/capabilities/auto_research/role_profiles.py +394 -0
  114. loopx/capabilities/auto_research/rollout_append.py +97 -0
  115. loopx/capabilities/auto_research/terminal_result_contract.py +422 -0
  116. loopx/capabilities/auto_research/terminal_result_projection.py +171 -0
  117. loopx/capabilities/auto_research/terminal_result_query.py +233 -0
  118. loopx/capabilities/auto_research/terminal_results.py +349 -0
  119. loopx/capabilities/auto_research/user_contract.py +190 -0
  120. loopx/capabilities/auto_research/worker_loop.py +163 -0
  121. loopx/capabilities/auto_research/worker_runtime.py +777 -0
  122. loopx/capabilities/auto_research/worker_skill/SKILL.md +343 -0
  123. loopx/capabilities/benchmark_toolkit/__init__.py +19 -0
  124. loopx/capabilities/benchmark_toolkit/integrity.py +387 -0
  125. loopx/capabilities/catalog.py +1875 -0
  126. loopx/capabilities/change_quality/__init__.py +19 -0
  127. loopx/capabilities/change_quality/cli.py +171 -0
  128. loopx/capabilities/change_quality/context.py +156 -0
  129. loopx/capabilities/change_quality/oracles.py +269 -0
  130. loopx/capabilities/change_quality/policy.py +34 -0
  131. loopx/capabilities/change_quality/receipt.py +482 -0
  132. loopx/capabilities/change_quality/result.py +493 -0
  133. loopx/capabilities/change_quality/scope.py +171 -0
  134. loopx/capabilities/change_quality/shadow.py +680 -0
  135. loopx/capabilities/content_ops/__init__.py +0 -0
  136. loopx/capabilities/content_ops/cli.py +649 -0
  137. loopx/capabilities/content_ops/connector_packets.py +164 -0
  138. loopx/capabilities/content_ops/item_lifecycle.py +1000 -0
  139. loopx/capabilities/content_ops/layout.py +451 -0
  140. loopx/capabilities/content_ops/markdown.py +456 -0
  141. loopx/capabilities/content_ops/schemas.py +51 -0
  142. loopx/capabilities/content_ops/social_browser_x.py +107 -0
  143. loopx/capabilities/content_ops/surface.py +1956 -0
  144. loopx/capabilities/content_ops/templates/layout-catalog-v0.json +72 -0
  145. loopx/capabilities/context_providers/__init__.py +36 -0
  146. loopx/capabilities/context_providers/base.py +189 -0
  147. loopx/capabilities/context_providers/factory.py +32 -0
  148. loopx/capabilities/context_providers/openviking.py +702 -0
  149. loopx/capabilities/context_providers/service_ownership.py +185 -0
  150. loopx/capabilities/decision_context/__init__.py +129 -0
  151. loopx/capabilities/decision_context/architecture.py +83 -0
  152. loopx/capabilities/decision_context/assembler.py +849 -0
  153. loopx/capabilities/decision_context/catalog_entry.py +195 -0
  154. loopx/capabilities/decision_context/cli.py +310 -0
  155. loopx/capabilities/decision_context/cursor_commit.py +535 -0
  156. loopx/capabilities/decision_context/outcome_feedback.py +352 -0
  157. loopx/capabilities/decision_context/packets.py +654 -0
  158. loopx/capabilities/decision_context/private_state.py +189 -0
  159. loopx/capabilities/decision_context/profile.py +453 -0
  160. loopx/capabilities/decision_context/providers.py +228 -0
  161. loopx/capabilities/decision_context/review_settlement.py +136 -0
  162. loopx/capabilities/decision_context/runtime.py +273 -0
  163. loopx/capabilities/decision_context/sources.py +415 -0
  164. loopx/capabilities/explore/__init__.py +1 -0
  165. loopx/capabilities/explore/activation.py +198 -0
  166. loopx/capabilities/explore/adaptive_replay_planner.py +221 -0
  167. loopx/capabilities/explore/child_replay_runtime.py +463 -0
  168. loopx/capabilities/explore/composition_frontier.py +291 -0
  169. loopx/capabilities/explore/counterfactual_runtime.py +578 -0
  170. loopx/capabilities/explore/episode_runtime.py +647 -0
  171. loopx/capabilities/explore/harness_checkpoint.py +171 -0
  172. loopx/capabilities/explore/harness_gate.py +115 -0
  173. loopx/capabilities/explore/harness_runtime.py +1124 -0
  174. loopx/capabilities/explore/replay_metrics.py +206 -0
  175. loopx/capabilities/explore/replay_runtime.py +1271 -0
  176. loopx/capabilities/explore/resource_portfolio.py +173 -0
  177. loopx/capabilities/explore/result_log.py +974 -0
  178. loopx/capabilities/explore/router_state.py +432 -0
  179. loopx/capabilities/explore/source_history_reconcile.py +255 -0
  180. loopx/capabilities/explore/speculative_scheduler.py +498 -0
  181. loopx/capabilities/explore/todo_branch_plan.py +650 -0
  182. loopx/capabilities/explore/todo_evidence.py +141 -0
  183. loopx/capabilities/explore/trace_runtime.py +284 -0
  184. loopx/capabilities/explore/worker_branch_plan.py +1257 -0
  185. loopx/capabilities/integration_branch/__init__.py +13 -0
  186. loopx/capabilities/integration_branch/cli.py +148 -0
  187. loopx/capabilities/integration_branch/core.py +916 -0
  188. loopx/capabilities/issue_fix/__init__.py +19 -0
  189. loopx/capabilities/issue_fix/acceptance_loop.py +1050 -0
  190. loopx/capabilities/issue_fix/candidate_evidence.py +503 -0
  191. loopx/capabilities/issue_fix/candidate_preflight.py +676 -0
  192. loopx/capabilities/issue_fix/cli.py +1822 -0
  193. loopx/capabilities/issue_fix/cli_input.py +87 -0
  194. loopx/capabilities/issue_fix/content_ops_cli.py +148 -0
  195. loopx/capabilities/issue_fix/discovered_issue_promotion.py +947 -0
  196. loopx/capabilities/issue_fix/explore_projection.py +710 -0
  197. loopx/capabilities/issue_fix/feasibility.py +542 -0
  198. loopx/capabilities/issue_fix/github_public.py +661 -0
  199. loopx/capabilities/issue_fix/intake_surface.py +832 -0
  200. loopx/capabilities/issue_fix/metadata_preview.py +218 -0
  201. loopx/capabilities/issue_fix/metrics_projection.py +1340 -0
  202. loopx/capabilities/issue_fix/metrics_supplement.py +634 -0
  203. loopx/capabilities/issue_fix/metrics_supplement_cli.py +127 -0
  204. loopx/capabilities/issue_fix/outcome_projection.py +1235 -0
  205. loopx/capabilities/issue_fix/periodic_report.py +189 -0
  206. loopx/capabilities/issue_fix/pr_description.py +418 -0
  207. loopx/capabilities/issue_fix/pr_gate_reconcile.py +496 -0
  208. loopx/capabilities/issue_fix/pr_gate_reconcile_cli.py +464 -0
  209. loopx/capabilities/issue_fix/pr_lifecycle.py +1327 -0
  210. loopx/capabilities/issue_fix/pr_lifecycle_rollout.py +85 -0
  211. loopx/capabilities/issue_fix/pr_monitor_materialization.py +257 -0
  212. loopx/capabilities/issue_fix/pr_review_ack.py +439 -0
  213. loopx/capabilities/issue_fix/provider_hooks.py +24 -0
  214. loopx/capabilities/issue_fix/repository_commit_evidence.py +186 -0
  215. loopx/capabilities/issue_fix/repository_context.py +457 -0
  216. loopx/capabilities/issue_fix/repository_memory.py +459 -0
  217. loopx/capabilities/issue_fix/repository_memory_provider.py +1454 -0
  218. loopx/capabilities/issue_fix/repository_snapshot.py +454 -0
  219. loopx/capabilities/issue_fix/reviewer_cli.py +917 -0
  220. loopx/capabilities/issue_fix/reviewer_notification.py +882 -0
  221. loopx/capabilities/issue_fix/reviewer_notification_drain.py +942 -0
  222. loopx/capabilities/issue_fix/reviewer_recommendation.py +1057 -0
  223. loopx/capabilities/issue_fix/reviewer_request.py +1282 -0
  224. loopx/capabilities/issue_fix/reward_memory.py +879 -0
  225. loopx/capabilities/issue_fix/workflow_plan.py +1286 -0
  226. loopx/capabilities/material_lifecycle/__init__.py +161 -0
  227. loopx/capabilities/material_lifecycle/_validation.py +183 -0
  228. loopx/capabilities/material_lifecycle/apply.py +672 -0
  229. loopx/capabilities/material_lifecycle/architecture.py +122 -0
  230. loopx/capabilities/material_lifecycle/cli.py +161 -0
  231. loopx/capabilities/material_lifecycle/decision_planning.py +470 -0
  232. loopx/capabilities/material_lifecycle/explore_execution.py +306 -0
  233. loopx/capabilities/material_lifecycle/intake.py +869 -0
  234. loopx/capabilities/material_lifecycle/inventory.py +147 -0
  235. loopx/capabilities/material_lifecycle/lifecycle.py +98 -0
  236. loopx/capabilities/material_lifecycle/preparation.py +147 -0
  237. loopx/capabilities/material_lifecycle/project_skill.py +83 -0
  238. loopx/capabilities/material_lifecycle/ranking.py +267 -0
  239. loopx/capabilities/material_lifecycle/readable_projection.py +500 -0
  240. loopx/capabilities/material_lifecycle/rebuild.py +480 -0
  241. loopx/capabilities/material_lifecycle/settlement.py +238 -0
  242. loopx/capabilities/periodic_report/__init__.py +71 -0
  243. loopx/capabilities/periodic_report/adapters.py +939 -0
  244. loopx/capabilities/periodic_report/archive.py +422 -0
  245. loopx/capabilities/periodic_report/bindings.py +705 -0
  246. loopx/capabilities/periodic_report/cli.py +277 -0
  247. loopx/capabilities/periodic_report/core.py +691 -0
  248. loopx/capabilities/periodic_report/extension_envelope.py +66 -0
  249. loopx/capabilities/periodic_report/presets.py +103 -0
  250. loopx/capabilities/periodic_report/profile.py +235 -0
  251. loopx/capabilities/periodic_report/project_progress.py +179 -0
  252. loopx/capabilities/periodic_report/triggers.py +452 -0
  253. loopx/capabilities/pr_review_queue/__init__.py +17 -0
  254. loopx/capabilities/pr_review_queue/core.py +506 -0
  255. loopx/capabilities/pr_review_queue/review_contract.py +506 -0
  256. loopx/capabilities/registry.py +192 -0
  257. loopx/capabilities/reward_memory/__init__.py +75 -0
  258. loopx/capabilities/reward_memory/application.py +819 -0
  259. loopx/capabilities/reward_memory/architecture.py +572 -0
  260. loopx/capabilities/reward_memory/candidate_review.py +511 -0
  261. loopx/capabilities/reward_memory/cli.py +469 -0
  262. loopx/capabilities/reward_memory/dogfood.py +574 -0
  263. loopx/capabilities/reward_memory/evaluation.py +296 -0
  264. loopx/capabilities/reward_memory/evaluation_fixtures.py +362 -0
  265. loopx/capabilities/reward_memory/experiment.py +567 -0
  266. loopx/capabilities/reward_memory/health.py +222 -0
  267. loopx/capabilities/reward_memory/ingestion.py +519 -0
  268. loopx/capabilities/reward_memory/registry.py +600 -0
  269. loopx/capabilities/reward_memory/runtime_hooks.py +312 -0
  270. loopx/capabilities/reward_memory/scoped_feedback.py +173 -0
  271. loopx/capabilities/semantic_preference/__init__.py +12 -0
  272. loopx/capabilities/semantic_preference/cli.py +189 -0
  273. loopx/capabilities/semantic_preference/contract.py +592 -0
  274. loopx/capabilities/semantic_preference/reward_memory.py +62 -0
  275. loopx/capabilities/value_connectors/__init__.py +1 -0
  276. loopx/capabilities/value_connectors/cli.py +401 -0
  277. loopx/capabilities/value_connectors/finance_extension_migration.py +108 -0
  278. loopx/capabilities/value_connectors/install_check.py +147 -0
  279. loopx/capabilities/value_connectors/planner.py +733 -0
  280. loopx/capabilities/value_connectors/source_map.py +446 -0
  281. loopx/claude_goal_baseline.py +138 -0
  282. loopx/claude_goal_mode/__init__.py +23 -0
  283. loopx/claude_goal_mode/hooks/goal_policy.py +212 -0
  284. loopx/claude_goal_mode/hooks/goal_state.py +139 -0
  285. loopx/claude_goal_mode/mcp/loopx_mcp.py +167 -0
  286. loopx/claude_goal_mode/scripts/connect.py +103 -0
  287. loopx/claude_goal_mode/scripts/goalmode_cmd.py +241 -0
  288. loopx/claude_goal_mode/scripts/install.py +328 -0
  289. loopx/claude_goal_mode/statusline/goal_status.py +97 -0
  290. loopx/cli.py +836 -0
  291. loopx/cli_commands/__init__.py +334 -0
  292. loopx/cli_commands/_host_thread.py +13 -0
  293. loopx/cli_commands/agentissue_runner_flow.py +447 -0
  294. loopx/cli_commands/agents_last_exam.py +160 -0
  295. loopx/cli_commands/agents_last_exam_baked_input.py +302 -0
  296. loopx/cli_commands/agents_last_exam_host_codex.py +374 -0
  297. loopx/cli_commands/agents_last_exam_launch_dry_run.py +372 -0
  298. loopx/cli_commands/agents_last_exam_local_plan.py +322 -0
  299. loopx/cli_commands/agents_last_exam_runner_source.py +352 -0
  300. loopx/cli_commands/agents_last_exam_task_material.py +335 -0
  301. loopx/cli_commands/agents_last_exam_validation_gate.py +236 -0
  302. loopx/cli_commands/benchmark_boundary.py +499 -0
  303. loopx/cli_commands/benchmark_dispatch.py +161 -0
  304. loopx/cli_commands/benchmark_release_outcome.py +123 -0
  305. loopx/cli_commands/benchmark_review_lifecycle.py +1275 -0
  306. loopx/cli_commands/benchmark_run_ledger.py +763 -0
  307. loopx/cli_commands/benchmark_run_ledger_case_analysis.py +249 -0
  308. loopx/cli_commands/benchmark_run_ledger_classification.py +45 -0
  309. loopx/cli_commands/benchmark_run_ledger_maintenance.py +486 -0
  310. loopx/cli_commands/benchmark_run_ledger_maintenance_registration.py +342 -0
  311. loopx/cli_commands/benchmark_run_ledger_maintenance_rendering.py +233 -0
  312. loopx/cli_commands/benchmark_run_ledger_parity.py +92 -0
  313. loopx/cli_commands/bootstrap_connect.py +238 -0
  314. loopx/cli_commands/canary.py +707 -0
  315. loopx/cli_commands/canary_release_qualification.py +79 -0
  316. loopx/cli_commands/capability.py +96 -0
  317. loopx/cli_commands/doctor.py +43 -0
  318. loopx/cli_commands/dreaming.py +143 -0
  319. loopx/cli_commands/edgebench.py +205 -0
  320. loopx/cli_commands/evidence_log.py +275 -0
  321. loopx/cli_commands/explore.py +989 -0
  322. loopx/cli_commands/explore_planning_commands.py +157 -0
  323. loopx/cli_commands/extension.py +271 -0
  324. loopx/cli_commands/first_run_report.py +73 -0
  325. loopx/cli_commands/goal_channel.py +656 -0
  326. loopx/cli_commands/handoff_mode.py +158 -0
  327. loopx/cli_commands/history.py +622 -0
  328. loopx/cli_commands/host_mode_plan.py +113 -0
  329. loopx/cli_commands/lark_inbox.py +431 -0
  330. loopx/cli_commands/lark_kanban.py +629 -0
  331. loopx/cli_commands/ml_experiment.py +321 -0
  332. loopx/cli_commands/multi_agent.py +211 -0
  333. loopx/cli_commands/opencode2_goal_worker.py +217 -0
  334. loopx/cli_commands/pr_review.py +167 -0
  335. loopx/cli_commands/presentation.py +218 -0
  336. loopx/cli_commands/preset.py +96 -0
  337. loopx/cli_commands/project.py +150 -0
  338. loopx/cli_commands/project_lifecycle.py +915 -0
  339. loopx/cli_commands/quota.py +859 -0
  340. loopx/cli_commands/quota_registration.py +241 -0
  341. loopx/cli_commands/quota_request.py +113 -0
  342. loopx/cli_commands/ready_score.py +110 -0
  343. loopx/cli_commands/registry_admin.py +975 -0
  344. loopx/cli_commands/registry_admin_configure.py +344 -0
  345. loopx/cli_commands/registry_admin_peer.py +84 -0
  346. loopx/cli_commands/registry_authority.py +218 -0
  347. loopx/cli_commands/review_batch.py +146 -0
  348. loopx/cli_commands/slash_commands.py +145 -0
  349. loopx/cli_commands/start_goal.py +251 -0
  350. loopx/cli_commands/starter.py +175 -0
  351. loopx/cli_commands/starter_bootstrap.py +179 -0
  352. loopx/cli_commands/starter_bootstrap_registration.py +198 -0
  353. loopx/cli_commands/starter_runtime_idle.py +107 -0
  354. loopx/cli_commands/starter_scheduler.py +207 -0
  355. loopx/cli_commands/starter_session_runtime.py +152 -0
  356. loopx/cli_commands/starter_visible_common.py +54 -0
  357. loopx/cli_commands/starter_visible_driver.py +161 -0
  358. loopx/cli_commands/starter_visible_pilot.py +278 -0
  359. loopx/cli_commands/status.py +867 -0
  360. loopx/cli_commands/status_registration.py +239 -0
  361. loopx/cli_commands/summary_all.py +222 -0
  362. loopx/cli_commands/support_control.py +809 -0
  363. loopx/cli_commands/support_control_registry.py +68 -0
  364. loopx/cli_commands/support_control_supervisor.py +289 -0
  365. loopx/cli_commands/task_lease.py +306 -0
  366. loopx/cli_commands/terminal_bench_adapter.py +717 -0
  367. loopx/cli_commands/terminal_bench_environment_result.py +1246 -0
  368. loopx/cli_commands/todo.py +940 -0
  369. loopx/cli_commands/todo_argument_validation.py +572 -0
  370. loopx/cli_commands/todo_event.py +114 -0
  371. loopx/cli_commands/turn.py +804 -0
  372. loopx/cli_commands/version.py +46 -0
  373. loopx/cli_commands/worker_bridge.py +659 -0
  374. loopx/cli_rollout.py +314 -0
  375. loopx/codex_cli_goal_tui.py +672 -0
  376. loopx/codex_cli_probe.py +1530 -0
  377. loopx/codex_cli_probe_markdown.py +935 -0
  378. loopx/codex_cli_runtime_probe.py +733 -0
  379. loopx/codex_cli_scheduler.py +564 -0
  380. loopx/codex_goal_baseline.py +620 -0
  381. loopx/configuration_catalog.py +617 -0
  382. loopx/configure_goal.py +1375 -0
  383. loopx/contract.py +996 -0
  384. loopx/control_plane/__init__.py +71 -0
  385. loopx/control_plane/agents/__init__.py +1 -0
  386. loopx/control_plane/agents/agent_lane_recommendation.py +516 -0
  387. loopx/control_plane/agents/agent_scope.py +1578 -0
  388. loopx/control_plane/agents/agent_scope_frontier.py +60 -0
  389. loopx/control_plane/agents/capability_gate.py +531 -0
  390. loopx/control_plane/agents/identity.py +140 -0
  391. loopx/control_plane/agents/legacy_migration.py +169 -0
  392. loopx/control_plane/agents/management_projection.py +658 -0
  393. loopx/control_plane/agents/material_frontier.py +608 -0
  394. loopx/control_plane/agents/material_handoff.py +156 -0
  395. loopx/control_plane/agents/multi_agent/__init__.py +1 -0
  396. loopx/control_plane/agents/multi_agent/codex_executable.py +207 -0
  397. loopx/control_plane/agents/multi_agent/collective_round_ledger.py +387 -0
  398. loopx/control_plane/agents/multi_agent/contract.py +474 -0
  399. loopx/control_plane/agents/multi_agent/recipe.py +110 -0
  400. loopx/control_plane/agents/multi_agent/role_successor.py +297 -0
  401. loopx/control_plane/agents/multi_agent/runtime_scripts.py +426 -0
  402. loopx/control_plane/agents/multi_agent/visible_launch_policy.py +149 -0
  403. loopx/control_plane/agents/multi_agent/visible_wake_scheduler.py +392 -0
  404. loopx/control_plane/agents/profile.py +216 -0
  405. loopx/control_plane/agents/runtime_model.py +73 -0
  406. loopx/control_plane/agents/subagent_activity.py +164 -0
  407. loopx/control_plane/agents/supervisor.py +544 -0
  408. loopx/control_plane/agents/supervisor_events.py +462 -0
  409. loopx/control_plane/agents/supervisor_inject.py +204 -0
  410. loopx/control_plane/agents/work_mode.py +56 -0
  411. loopx/control_plane/agents/workspace_guard.py +364 -0
  412. loopx/control_plane/effect_program.py +644 -0
  413. loopx/control_plane/goals/__init__.py +1 -0
  414. loopx/control_plane/goals/active_state_event_projection.py +103 -0
  415. loopx/control_plane/goals/active_state_metadata.py +47 -0
  416. loopx/control_plane/goals/active_state_sections.py +58 -0
  417. loopx/control_plane/goals/configure_goal_service.py +354 -0
  418. loopx/control_plane/goals/contract_health.py +132 -0
  419. loopx/control_plane/goals/dreaming.py +152 -0
  420. loopx/control_plane/goals/global_registry_health.py +199 -0
  421. loopx/control_plane/goals/global_registry_shadow.py +33 -0
  422. loopx/control_plane/goals/goal_channel.py +34 -0
  423. loopx/control_plane/goals/goal_channel_projection.py +560 -0
  424. loopx/control_plane/goals/goal_frontier/__init__.py +1917 -0
  425. loopx/control_plane/goals/goal_frontier/ack_policy.py +149 -0
  426. loopx/control_plane/goals/goal_frontier/outcome_continuity.py +437 -0
  427. loopx/control_plane/goals/goal_frontier/replan_rules.py +210 -0
  428. loopx/control_plane/goals/goal_frontier/semantic_history.py +314 -0
  429. loopx/control_plane/goals/goal_frontier/terminal.py +180 -0
  430. loopx/control_plane/goals/goal_vision.py +443 -0
  431. loopx/control_plane/goals/goal_vision_policy.py +36 -0
  432. loopx/control_plane/goals/goal_vision_state.py +62 -0
  433. loopx/control_plane/goals/goal_vision_wait.py +290 -0
  434. loopx/control_plane/goals/path_resolution.py +20 -0
  435. loopx/control_plane/goals/start_contract.py +206 -0
  436. loopx/control_plane/goals/vision_checkpoint.py +92 -0
  437. loopx/control_plane/handoff/__init__.py +1 -0
  438. loopx/control_plane/handoff/cross_runtime_impl_review.py +311 -0
  439. loopx/control_plane/handoff/delivery_contract.py +161 -0
  440. loopx/control_plane/handoff/handoff_runs.py +71 -0
  441. loopx/control_plane/handoff/project_handoff.py +155 -0
  442. loopx/control_plane/handoff/review_batch.py +463 -0
  443. loopx/control_plane/handoff/review_packet_context.py +216 -0
  444. loopx/control_plane/heartbeat/agent.py +173 -0
  445. loopx/control_plane/heartbeat/budget.py +66 -0
  446. loopx/control_plane/heartbeat/builder.py +501 -0
  447. loopx/control_plane/heartbeat/host.py +64 -0
  448. loopx/control_plane/heartbeat/rules.py +68 -0
  449. loopx/control_plane/heartbeat/task_body.py +759 -0
  450. loopx/control_plane/heartbeat/visible_goal.py +86 -0
  451. loopx/control_plane/projects/__init__.py +1 -0
  452. loopx/control_plane/projects/contract.py +25 -0
  453. loopx/control_plane/projects/registry.py +663 -0
  454. loopx/control_plane/quota/__init__.py +1 -0
  455. loopx/control_plane/quota/cli_projection.py +704 -0
  456. loopx/control_plane/quota/decision_summary.py +431 -0
  457. loopx/control_plane/quota/effect_program.py +152 -0
  458. loopx/control_plane/quota/error_codes.py +19 -0
  459. loopx/control_plane/quota/goal_boundary.py +464 -0
  460. loopx/control_plane/quota/heartbeat_receipt.py +277 -0
  461. loopx/control_plane/quota/heartbeat_recommendation.py +718 -0
  462. loopx/control_plane/quota/host_poll_receipts.py +162 -0
  463. loopx/control_plane/quota/live_decision.py +142 -0
  464. loopx/control_plane/quota/monitor_poll.py +786 -0
  465. loopx/control_plane/quota/policy_constants.py +40 -0
  466. loopx/control_plane/quota/projection_repair.py +262 -0
  467. loopx/control_plane/quota/recent_runs.py +210 -0
  468. loopx/control_plane/quota/scheduler_ack.py +490 -0
  469. loopx/control_plane/quota/selected_todo_projection.py +139 -0
  470. loopx/control_plane/quota/settlement.py +437 -0
  471. loopx/control_plane/quota/settlement_cli.py +246 -0
  472. loopx/control_plane/quota/settlement_validation.py +64 -0
  473. loopx/control_plane/quota/settlement_workspace_causality.py +180 -0
  474. loopx/control_plane/quota/should_run.py +249 -0
  475. loopx/control_plane/quota/should_run_packet.py +1165 -0
  476. loopx/control_plane/quota/should_run_prepare.py +675 -0
  477. loopx/control_plane/quota/slot_accounting.py +1123 -0
  478. loopx/control_plane/quota/spend_sources.py +11 -0
  479. loopx/control_plane/quota/stall_repair.py +397 -0
  480. loopx/control_plane/quota/states.py +29 -0
  481. loopx/control_plane/quota/task_orchestration.py +448 -0
  482. loopx/control_plane/quota/task_orchestration_admission.py +497 -0
  483. loopx/control_plane/quota/turn_envelope.py +889 -0
  484. loopx/control_plane/quota/usage_summary.py +140 -0
  485. loopx/control_plane/reward_memory.py +43 -0
  486. loopx/control_plane/runtime/__init__.py +2 -0
  487. loopx/control_plane/runtime/active_user_assisted_pilot.py +275 -0
  488. loopx/control_plane/runtime/agent_scoped_evidence_log.py +435 -0
  489. loopx/control_plane/runtime/decision_freshness.py +203 -0
  490. loopx/control_plane/runtime/event_ledger.py +197 -0
  491. loopx/control_plane/runtime/event_store_migration_bridge.py +196 -0
  492. loopx/control_plane/runtime/goal_project_route.py +70 -0
  493. loopx/control_plane/runtime/local_state_write_correctness.py +242 -0
  494. loopx/control_plane/runtime/promotion_readiness.py +152 -0
  495. loopx/control_plane/runtime/public_safety.py +120 -0
  496. loopx/control_plane/runtime/run_artifacts.py +78 -0
  497. loopx/control_plane/runtime/run_compaction.py +397 -0
  498. loopx/control_plane/runtime/run_context_retention.py +241 -0
  499. loopx/control_plane/runtime/run_history.py +132 -0
  500. loopx/control_plane/runtime/run_index_duplicates.py +205 -0
  501. loopx/control_plane/runtime/run_index_rebuild.py +263 -0
  502. loopx/control_plane/runtime/run_ingest_health.py +336 -0
  503. loopx/control_plane/runtime/runtime_projection_route.py +624 -0
  504. loopx/control_plane/runtime/runtime_projection_writer.py +98 -0
  505. loopx/control_plane/runtime/session_runtime.py +339 -0
  506. loopx/control_plane/runtime/shared_runtime_material_projection.py +332 -0
  507. loopx/control_plane/runtime/shared_runtime_refresh_projection.py +183 -0
  508. loopx/control_plane/runtime/stale_latest_run.py +90 -0
  509. loopx/control_plane/runtime/status_classifications.py +49 -0
  510. loopx/control_plane/runtime/status_projection_cache.py +235 -0
  511. loopx/control_plane/runtime/stride_observation.py +144 -0
  512. loopx/control_plane/runtime/time.py +39 -0
  513. loopx/control_plane/runtime/trajectory_hygiene.py +149 -0
  514. loopx/control_plane/runtime/validation_command.py +69 -0
  515. loopx/control_plane/scheduler/__init__.py +1 -0
  516. loopx/control_plane/scheduler/ack.py +329 -0
  517. loopx/control_plane/scheduler/arbitration.py +188 -0
  518. loopx/control_plane/scheduler/automation_liveness.py +183 -0
  519. loopx/control_plane/scheduler/execution_context.py +555 -0
  520. loopx/control_plane/scheduler/external_evidence_observation.py +428 -0
  521. loopx/control_plane/scheduler/monitor_display.py +143 -0
  522. loopx/control_plane/scheduler/monitor_poll_policy.py +161 -0
  523. loopx/control_plane/scheduler/monitor_poll_writeback.py +351 -0
  524. loopx/control_plane/scheduler/monitor_target.py +64 -0
  525. loopx/control_plane/scheduler/monitor_todo.py +146 -0
  526. loopx/control_plane/scheduler/monitor_wait.py +237 -0
  527. loopx/control_plane/scheduler/scheduler_hint.py +1284 -0
  528. loopx/control_plane/scheduler/state.py +354 -0
  529. loopx/control_plane/scheduler/state_transition_rules.py +179 -0
  530. loopx/control_plane/scheduler/time.py +10 -0
  531. loopx/control_plane/settlement_driver.py +293 -0
  532. loopx/control_plane/status/__init__.py +6 -0
  533. loopx/control_plane/status/active_state_projection.py +105 -0
  534. loopx/control_plane/status/agent_lane_projection.py +375 -0
  535. loopx/control_plane/status/attention_projection.py +74 -0
  536. loopx/control_plane/status/autonomous_replan_projection.py +103 -0
  537. loopx/control_plane/status/collection.py +140 -0
  538. loopx/control_plane/status/contract_projection.py +31 -0
  539. loopx/control_plane/status/dreaming_projection.py +52 -0
  540. loopx/control_plane/status/goal_attention_projection.py +157 -0
  541. loopx/control_plane/status/lifecycle_projection.py +110 -0
  542. loopx/control_plane/status/monitor_display_projection.py +69 -0
  543. loopx/control_plane/status/registry_health_projection.py +75 -0
  544. loopx/control_plane/status/run_projection.py +70 -0
  545. loopx/control_plane/status/runtime_summaries.py +161 -0
  546. loopx/control_plane/testing/__init__.py +1 -0
  547. loopx/control_plane/testing/actual_default_model_behavior_portfolio.py +1371 -0
  548. loopx/control_plane/testing/canary_harness.py +182 -0
  549. loopx/control_plane/testing/capability_monitor_repair_tool_behavior.py +674 -0
  550. loopx/control_plane/testing/cli_output_budget.py +807 -0
  551. loopx/control_plane/testing/cli_output_differential.py +250 -0
  552. loopx/control_plane/testing/cli_output_semantics.py +87 -0
  553. loopx/control_plane/testing/control_plane_composition_scenarios.py +225 -0
  554. loopx/control_plane/testing/decision_replay.py +268 -0
  555. loopx/control_plane/testing/doubao_model_behavior_actor.py +559 -0
  556. loopx/control_plane/testing/model_behavior_corpus.py +344 -0
  557. loopx/control_plane/testing/model_behavior_qualification.py +769 -0
  558. loopx/control_plane/testing/model_behavior_retained_cases.py +235 -0
  559. loopx/control_plane/testing/model_tool_behavior.py +536 -0
  560. loopx/control_plane/testing/onboarding_model_behavior_qualification.py +642 -0
  561. loopx/control_plane/testing/quota_fixtures.py +208 -0
  562. loopx/control_plane/testing/quota_should_run_parity.py +57 -0
  563. loopx/control_plane/testing/release_commit_qualification.py +671 -0
  564. loopx/control_plane/testing/replan_semantic_action_behavior.py +1302 -0
  565. loopx/control_plane/testing/scoped_gate_successor_tool_behavior.py +527 -0
  566. loopx/control_plane/testing/selected_todo_tool_behavior.py +1002 -0
  567. loopx/control_plane/testing/terminal_settlement_tool_behavior.py +656 -0
  568. loopx/control_plane/todos/__init__.py +1 -0
  569. loopx/control_plane/todos/active_state_editing.py +296 -0
  570. loopx/control_plane/todos/active_state_todo_parser.py +138 -0
  571. loopx/control_plane/todos/active_state_todos.py +175 -0
  572. loopx/control_plane/todos/addition.py +103 -0
  573. loopx/control_plane/todos/claim_visibility.py +253 -0
  574. loopx/control_plane/todos/completed_archive.py +139 -0
  575. loopx/control_plane/todos/completion_fence.py +49 -0
  576. loopx/control_plane/todos/completion_policy.py +153 -0
  577. loopx/control_plane/todos/completion_validation.py +248 -0
  578. loopx/control_plane/todos/completion_validation_accountability.py +27 -0
  579. loopx/control_plane/todos/completion_validation_projection.py +57 -0
  580. loopx/control_plane/todos/contract.py +1476 -0
  581. loopx/control_plane/todos/decision_scope.py +554 -0
  582. loopx/control_plane/todos/deferred_resume.py +546 -0
  583. loopx/control_plane/todos/durable_completion.py +201 -0
  584. loopx/control_plane/todos/event_writeback.py +484 -0
  585. loopx/control_plane/todos/frontier_deadline.py +132 -0
  586. loopx/control_plane/todos/handoff_gate.py +283 -0
  587. loopx/control_plane/todos/handoff_mode.py +444 -0
  588. loopx/control_plane/todos/handoff_note.py +202 -0
  589. loopx/control_plane/todos/line_update.py +361 -0
  590. loopx/control_plane/todos/list_projection.py +205 -0
  591. loopx/control_plane/todos/markdown.py +199 -0
  592. loopx/control_plane/todos/monitor_metadata.py +88 -0
  593. loopx/control_plane/todos/mutation_authority.py +299 -0
  594. loopx/control_plane/todos/projection.py +655 -0
  595. loopx/control_plane/todos/quota_summary.py +1138 -0
  596. loopx/control_plane/todos/route_continuation.py +267 -0
  597. loopx/control_plane/todos/succession_warning.py +174 -0
  598. loopx/control_plane/todos/summary_item.py +223 -0
  599. loopx/control_plane/todos/text.py +30 -0
  600. loopx/control_plane/todos/todo_index.py +226 -0
  601. loopx/control_plane/todos/todo_summary.py +1458 -0
  602. loopx/control_plane/todos/unblock_resume.py +326 -0
  603. loopx/control_plane/todos/user_gate.py +263 -0
  604. loopx/control_plane/todos/write_hint.py +63 -0
  605. loopx/control_plane/todos/write_policy.py +135 -0
  606. loopx/control_plane/turn_driver/__init__.py +85 -0
  607. loopx/control_plane/turn_driver/codex_cli.py +502 -0
  608. loopx/control_plane/turn_driver/driver.py +355 -0
  609. loopx/control_plane/turn_driver/executor.py +1468 -0
  610. loopx/control_plane/turn_driver/loop_controller.py +669 -0
  611. loopx/control_plane/turn_driver/settlement.py +318 -0
  612. loopx/control_plane/turn_driver/transaction.py +375 -0
  613. loopx/control_plane/work_items/__init__.py +1 -0
  614. loopx/control_plane/work_items/attention_fields.py +56 -0
  615. loopx/control_plane/work_items/attention_item.py +77 -0
  616. loopx/control_plane/work_items/attention_queue.py +322 -0
  617. loopx/control_plane/work_items/attention_routing.py +213 -0
  618. loopx/control_plane/work_items/autonomous_candidates.py +135 -0
  619. loopx/control_plane/work_items/autonomous_replan_ack.py +276 -0
  620. loopx/control_plane/work_items/autonomous_replan_obligation.py +786 -0
  621. loopx/control_plane/work_items/backlog_hygiene.py +59 -0
  622. loopx/control_plane/work_items/capability_monitor_fallback.py +221 -0
  623. loopx/control_plane/work_items/delivery_batch_scale.py +66 -0
  624. loopx/control_plane/work_items/delivery_outcome.py +152 -0
  625. loopx/control_plane/work_items/delivery_signals.py +113 -0
  626. loopx/control_plane/work_items/execution_obligation.py +235 -0
  627. loopx/control_plane/work_items/goal_route_hint.py +320 -0
  628. loopx/control_plane/work_items/interaction_contract.py +1540 -0
  629. loopx/control_plane/work_items/issue_meta_surface.py +159 -0
  630. loopx/control_plane/work_items/lifecycle.py +139 -0
  631. loopx/control_plane/work_items/operator_inbox.py +266 -0
  632. loopx/control_plane/work_items/outcome_followthrough.py +69 -0
  633. loopx/control_plane/work_items/primary_action.py +326 -0
  634. loopx/control_plane/work_items/progress_observation.py +630 -0
  635. loopx/control_plane/work_items/project_asset.py +675 -0
  636. loopx/control_plane/work_items/repair_delta.py +693 -0
  637. loopx/control_plane/work_items/runtime_capability_reentry.py +168 -0
  638. loopx/control_plane/work_items/semantic_replan_writeback.py +177 -0
  639. loopx/control_plane/work_items/status_contract.py +49 -0
  640. loopx/control_plane/work_items/task_graph.py +1046 -0
  641. loopx/control_plane/work_items/task_lease.py +1254 -0
  642. loopx/control_plane/work_items/task_lease_settlement.py +422 -0
  643. loopx/control_plane/work_items/work_lane.py +510 -0
  644. loopx/control_plane/work_items/work_lane_context.py +161 -0
  645. loopx/demo.py +247 -0
  646. loopx/diagnose.py +633 -0
  647. loopx/doctor.py +1251 -0
  648. loopx/domain_packs/__init__.py +1 -0
  649. loopx/domain_packs/issue_fix.py +571 -0
  650. loopx/domain_packs/ml_experiment.py +854 -0
  651. loopx/domain_state.py +137 -0
  652. loopx/dreaming.py +706 -0
  653. loopx/entrypoint.py +16 -0
  654. loopx/event_sourced_state.py +981 -0
  655. loopx/execution_profile.py +286 -0
  656. loopx/experiments/__init__.py +1 -0
  657. loopx/experiments/planner_worker/__init__.py +1 -0
  658. loopx/experiments/planner_worker/contract.py +523 -0
  659. loopx/experiments/planner_worker/runtime.py +391 -0
  660. loopx/experiments/planner_worker/traex.py +461 -0
  661. loopx/explore_graph.py +11 -0
  662. loopx/extensions/__init__.py +1 -0
  663. loopx/extensions/bundled.py +28 -0
  664. loopx/extensions/execution_envelope.py +126 -0
  665. loopx/extensions/lark/__init__.py +11 -0
  666. loopx/extensions/lark/event_collector.py +478 -0
  667. loopx/extensions/lark/event_collector_runtime.py +506 -0
  668. loopx/extensions/lark/event_inbox.py +454 -0
  669. loopx/extensions/lark/extension.toml +88 -0
  670. loopx/extensions/lark/goal_channel.py +44 -0
  671. loopx/extensions/lark/goal_channel_contracts.py +388 -0
  672. loopx/extensions/lark/goal_channel_lifecycle.py +218 -0
  673. loopx/extensions/lark/goal_channel_runtime.py +792 -0
  674. loopx/extensions/lark/goal_channel_setup.py +805 -0
  675. loopx/extensions/lark/goal_channel_targets.py +215 -0
  676. loopx/extensions/lark/goal_channel_transport.py +281 -0
  677. loopx/extensions/lark/inbox_reactions.py +650 -0
  678. loopx/extensions/lark/inbox_reply.py +430 -0
  679. loopx/extensions/lark/presentation/__init__.py +11 -0
  680. loopx/extensions/lark/presentation/explore_results.py +2276 -0
  681. loopx/extensions/lark/presentation/explore_singleflight.py +127 -0
  682. loopx/extensions/lark/presentation/explore_source_guard.py +121 -0
  683. loopx/extensions/lark/presentation/explore_stage_document.py +703 -0
  684. loopx/extensions/lark/presentation/explore_visual_integrity.py +122 -0
  685. loopx/extensions/lark/presentation/explore_visual_readback.py +452 -0
  686. loopx/extensions/lark/presentation/explore_visual_styles.py +156 -0
  687. loopx/extensions/lark/presentation/issue_fix_surface.py +612 -0
  688. loopx/extensions/lark/presentation/kanban.py +2791 -0
  689. loopx/extensions/lark/presentation/message_card.py +112 -0
  690. loopx/extensions/lark/presentation/periodic_report.py +261 -0
  691. loopx/extensions/lark/presentation/projection_rows.py +600 -0
  692. loopx/extensions/lark/presentation/record_io.py +95 -0
  693. loopx/extensions/lark/presentation/sync_receipt.py +145 -0
  694. loopx/extensions/lark/private_json.py +40 -0
  695. loopx/extensions/lark/provider.py +86 -0
  696. loopx/extensions/lark/reviewer_notification.py +604 -0
  697. loopx/extensions/manifest.py +385 -0
  698. loopx/extensions/openviking_periodic_report/__init__.py +17 -0
  699. loopx/extensions/openviking_periodic_report/activation.py +173 -0
  700. loopx/extensions/openviking_periodic_report/extension.toml +17 -0
  701. loopx/extensions/openviking_periodic_report/provider.py +355 -0
  702. loopx/extensions/openviking_periodic_report/sink.py +117 -0
  703. loopx/extensions/openviking_semantic_preference/__init__.py +5 -0
  704. loopx/extensions/openviking_semantic_preference/extension.toml +16 -0
  705. loopx/extensions/openviking_semantic_preference/history_export.py +484 -0
  706. loopx/extensions/openviking_semantic_preference/project_peer.py +68 -0
  707. loopx/extensions/openviking_semantic_preference/provider.py +312 -0
  708. loopx/extensions/presentation.py +979 -0
  709. loopx/extensions/process_runtime.py +204 -0
  710. loopx/extensions/readiness.py +168 -0
  711. loopx/extensions/runtime.py +931 -0
  712. loopx/extensions/scaffold.py +335 -0
  713. loopx/feedback.py +581 -0
  714. loopx/file_lock.py +382 -0
  715. loopx/global_registry.py +842 -0
  716. loopx/global_risks.py +970 -0
  717. loopx/global_todos.py +568 -0
  718. loopx/handoff_budget.py +28 -0
  719. loopx/heartbeat_prequota.py +80 -0
  720. loopx/heartbeat_prompt.py +159 -0
  721. loopx/help_surface.py +516 -0
  722. loopx/history.py +1507 -0
  723. loopx/host_loop_activation.py +1311 -0
  724. loopx/host_mode_planner.py +991 -0
  725. loopx/install_contract.py +1 -0
  726. loopx/interface_budget.py +196 -0
  727. loopx/long_task_cadence.py +208 -0
  728. loopx/materials.py +185 -0
  729. loopx/ml_experiment.py +3 -0
  730. loopx/onboarding.py +214 -0
  731. loopx/opencode2_goal_mode/README.md +81 -0
  732. loopx/opencode2_goal_mode/__init__.py +9 -0
  733. loopx/opencode2_goal_mode/opencode2-goal-worker.mjs +1018 -0
  734. loopx/opencode_goal_mode/README.md +99 -0
  735. loopx/opencode_goal_mode/__init__.py +13 -0
  736. loopx/opencode_goal_mode/goal-bridge-runtime.mjs +858 -0
  737. loopx/opencode_goal_mode/loopx-goal.js +8 -0
  738. loopx/operator_gate.py +420 -0
  739. loopx/orchestration.py +127 -0
  740. loopx/paths.py +59 -0
  741. loopx/pi_goal_mode/README.md +67 -0
  742. loopx/pi_goal_mode/__init__.py +13 -0
  743. loopx/pi_goal_mode/loopx-goal.ts +254 -0
  744. loopx/pi_goal_mode/pi-goal-loop-runtime.mjs +574 -0
  745. loopx/pr_review.py +1206 -0
  746. loopx/presentation/__init__.py +1 -0
  747. loopx/presentation/explore_views.py +1334 -0
  748. loopx/presentation/markdown.py +61 -0
  749. loopx/presentation/projection_source_reconcile.py +140 -0
  750. loopx/presentation/public_safety.py +42 -0
  751. loopx/presentation/renderers/__init__.py +17 -0
  752. loopx/presentation/renderers/goal_channel_html.py +269 -0
  753. loopx/presentation/renderers/periodic_report_html.py +786 -0
  754. loopx/presentation/renderers/periodic_report_markdown.py +184 -0
  755. loopx/presentation/renderers/quota_event_markdown.py +116 -0
  756. loopx/presentation/renderers/quota_markdown.py +1112 -0
  757. loopx/presentation/renderers/status_markdown.py +1570 -0
  758. loopx/presentation/renderers/trajectory_hygiene_markdown.py +39 -0
  759. loopx/presentation/renderers/turn_envelope_markdown.py +33 -0
  760. loopx/presentation/sinks/__init__.py +5 -0
  761. loopx/presentation/sinks/openviking_periodic_report.py +7 -0
  762. loopx/presentation/static_site.py +691 -0
  763. loopx/presets.py +369 -0
  764. loopx/project_alias.py +217 -0
  765. loopx/project_map.py +589 -0
  766. loopx/project_prompt.py +1153 -0
  767. loopx/project_skill_cli.py +125 -0
  768. loopx/project_skill_delivery.py +470 -0
  769. loopx/project_uninstall.py +462 -0
  770. loopx/promotion_gate.py +197 -0
  771. loopx/quota.py +1197 -0
  772. loopx/ready_score.py +413 -0
  773. loopx/registry.py +621 -0
  774. loopx/registry_writability.py +64 -0
  775. loopx/release_candidate.py +148 -0
  776. loopx/release_manifest.py +316 -0
  777. loopx/repository_identity.py +100 -0
  778. loopx/review_packet.py +1024 -0
  779. loopx/rollout_event_log.py +505 -0
  780. loopx/runtime.py +112 -0
  781. loopx/self_update.py +750 -0
  782. loopx/session_runtime.py +418 -0
  783. loopx/skill_install_readback.py +500 -0
  784. loopx/slash_command_install.py +1393 -0
  785. loopx/slash_commands.py +264 -0
  786. loopx/state_backup.py +573 -0
  787. loopx/state_migration.py +350 -0
  788. loopx/state_projection.py +809 -0
  789. loopx/state_refresh.py +1416 -0
  790. loopx/status.py +1383 -0
  791. loopx/status_server.py +935 -0
  792. loopx/summary_all.py +725 -0
  793. loopx/terminal_bench_agent.py +2056 -0
  794. loopx/thread_agent_binding.py +408 -0
  795. loopx/todo_followups.py +168 -0
  796. loopx/todo_suggestion_prompt.py +204 -0
  797. loopx/todos.py +2229 -0
  798. loopx/turn_identity.py +17 -0
  799. loopx/upgrade.py +1083 -0
  800. loopx/visible_governance.py +667 -0
  801. loopx/visible_multi_agent_launcher.py +1253 -0
  802. loopx/visible_multi_agent_tmux.py +429 -0
  803. loopx/worker_bridge.py +1574 -0
  804. loopx-0.4.8.dist-info/METADATA +708 -0
  805. loopx-0.4.8.dist-info/RECORD +811 -0
  806. loopx-0.4.8.dist-info/WHEEL +5 -0
  807. loopx-0.4.8.dist-info/entry_points.txt +5 -0
  808. loopx-0.4.8.dist-info/licenses/LICENSE +202 -0
  809. loopx-0.4.8.dist-info/licenses/LICENSE-MIT +21 -0
  810. loopx-0.4.8.dist-info/licenses/NOTICE +6 -0
  811. loopx-0.4.8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,794 @@
1
+ """Human-readable auto-research renderers.
2
+
3
+ The auto-research kernel and state readers emit machine payloads. This module
4
+ keeps the optional Markdown view separate so production logic does not depend
5
+ on legacy presentation helpers.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from .evidence_packet import AUTO_RESEARCH_ROLLOUT_APPEND_SCHEMA_VERSION
11
+ from .preset import build_auto_research_minimal_a2a_recipe
12
+ from .user_contract import AUTO_RESEARCH_USER_CONTRACT_SCHEMA_VERSION
13
+
14
+
15
+ AUTO_RESEARCH_DEMO_E2E_SCHEMA_VERSION = "auto_research_demo_e2e_result_v0"
16
+
17
+
18
+ def _render_failure(payload: dict[str, object]) -> str:
19
+ lines = ["# LoopX Auto Research", "", "- ok: `False`"]
20
+ if payload.get("error_code"):
21
+ lines.append(f"- error_code: `{payload.get('error_code')}`")
22
+ if payload.get("error"):
23
+ lines.append(f"- error: `{payload.get('error')}`")
24
+ return "\n".join(lines) + "\n"
25
+
26
+
27
+ def _join_or_none(values: object) -> str:
28
+ if isinstance(values, list) and values:
29
+ return ", ".join(str(item) for item in values)
30
+ return "none"
31
+
32
+
33
+ def _dict_value(payload: dict[str, object], key: str) -> dict[str, object]:
34
+ value = payload.get(key)
35
+ return value if isinstance(value, dict) else {}
36
+
37
+
38
+ def _string_value(payload: dict[str, object], key: str) -> str | None:
39
+ value = payload.get(key)
40
+ if isinstance(value, str) and value.strip():
41
+ return value
42
+ return None
43
+
44
+
45
+ def _metric_sequence(value: object) -> str:
46
+ if isinstance(value, list) and value:
47
+ return " -> ".join(str(item) for item in value)
48
+ return "none"
49
+
50
+
51
+ _ROLE_DESCRIPTIONS = {
52
+ "research_curator": "research-curator / 研究策展:界定问题、指标和证据边界",
53
+ "hypothesis_proposer": "hypothesis-proposer / 假设生成:提出下一轮可验证假设",
54
+ "research_executor": "research-executor / 研究执行:运行 dev/holdout 证据",
55
+ "evaluator_promoter": "evaluator-promoter / 评估推进:判断提升并触发后续 todo",
56
+ }
57
+
58
+ _AGENT_ROLE_IDS = {
59
+ "research-curator": "research_curator",
60
+ "hypothesis-proposer": "hypothesis_proposer",
61
+ "research-executor": "research_executor",
62
+ "evaluator-promoter": "evaluator_promoter",
63
+ }
64
+
65
+
66
+ def _role_description(agent_id: object, role_id: object) -> str:
67
+ role = str(role_id or "").strip()
68
+ agent = str(agent_id or "").strip()
69
+ if not role:
70
+ role = _AGENT_ROLE_IDS.get(agent, "")
71
+ label = _ROLE_DESCRIPTIONS.get(role)
72
+ if label:
73
+ return label
74
+ return agent or role or "unknown-role"
75
+
76
+
77
+ def _role_description_from_spec_line(raw: object) -> str:
78
+ parts = [part.strip() for part in str(raw).split(":")]
79
+ agent_id = parts[0] if parts else ""
80
+ role_id = parts[2] if len(parts) >= 3 else ""
81
+ return _role_description(agent_id, role_id)
82
+
83
+
84
+ def _render_research_roles(
85
+ *,
86
+ minimal_recipe: dict[str, object],
87
+ collective_rounds: dict[str, object],
88
+ ) -> list[str]:
89
+ kernel = _dict_value(collective_rounds, "kernel_ledger")
90
+ lanes = kernel.get("expected_lanes") if isinstance(kernel.get("expected_lanes"), list) else []
91
+ role_lines: list[str] = []
92
+ for lane in lanes:
93
+ if isinstance(lane, dict):
94
+ role_lines.append(
95
+ f"- {_role_description(lane.get('agent_id'), lane.get('role_id'))}"
96
+ )
97
+ if not role_lines:
98
+ for raw in minimal_recipe.get("preset_recipe_lines") or []:
99
+ role_lines.append(f"- {_role_description_from_spec_line(raw)}")
100
+ if not role_lines:
101
+ return []
102
+ return ["", "## Research Roles / 研究角色", "", *role_lines]
103
+
104
+
105
+ def _render_collective_round_summary(
106
+ *,
107
+ worker_loop: dict[str, object],
108
+ collective_rounds: dict[str, object],
109
+ ) -> list[str]:
110
+ if not collective_rounds:
111
+ return []
112
+ kernel = _dict_value(collective_rounds, "kernel_ledger")
113
+ outcomes = kernel.get("lane_outcomes") if isinstance(kernel.get("lane_outcomes"), list) else []
114
+ by_round: dict[int, list[dict[str, object]]] = {}
115
+ for outcome in outcomes:
116
+ if not isinstance(outcome, dict):
117
+ continue
118
+ try:
119
+ round_index = int(outcome.get("round") or 0)
120
+ except (TypeError, ValueError):
121
+ continue
122
+ if round_index > 0:
123
+ by_round.setdefault(round_index, []).append(outcome)
124
+
125
+ completed_turns = worker_loop.get("completed_turn_count")
126
+ expected_turns = kernel.get("lane_outcome_count")
127
+ participation_gap = (
128
+ collective_rounds.get("full_participation_requirement_gap")
129
+ if isinstance(collective_rounds.get("full_participation_requirement_gap"), dict)
130
+ else {}
131
+ )
132
+ lines = [
133
+ "",
134
+ "## Collective Rounds / 集体研究轮次",
135
+ "",
136
+ (
137
+ f"- verified: `{collective_rounds.get('multi_round_research_verified')}`; "
138
+ f"rounds: `{collective_rounds.get('collective_round_count')}`; "
139
+ f"full_participation_rounds: `{collective_rounds.get('full_participation_round_count')}`; "
140
+ f"basis: `{collective_rounds.get('full_participation_count_basis')}`; "
141
+ f"completed_turns: `{completed_turns}/{expected_turns}`"
142
+ ),
143
+ (
144
+ f"- claim_source: `{collective_rounds.get('claim_source') or collective_rounds.get('source')}`; "
145
+ f"visible_role_participation_verified: "
146
+ f"`{collective_rounds.get('visible_role_participation_verified')}`"
147
+ ),
148
+ f"- claim_boundary: {collective_rounds.get('claim_boundary')}",
149
+ (
150
+ f"- role_cycle_gap: `{participation_gap.get('shortfall_by_agent') or {}}` "
151
+ f"(required `{participation_gap.get('required_count')}`)"
152
+ ),
153
+ (
154
+ f"- dev_metric_sequence: `{_metric_sequence(collective_rounds.get('dev_metric_sequence'))}`; "
155
+ f"holdout_metric_sequence: `{_metric_sequence(collective_rounds.get('holdout_metric_sequence'))}`"
156
+ ),
157
+ (
158
+ f"- holdout_improvement_count: `{collective_rounds.get('holdout_improvement_count')}` "
159
+ f"(required `{collective_rounds.get('required_holdout_improvement_count')}`)"
160
+ ),
161
+ (
162
+ "- round_semantics: one round is one quota/frontier opportunity for each "
163
+ "research role; lanes without a selected todo are shown as no-op instead of hidden."
164
+ ),
165
+ "",
166
+ ]
167
+ for round_index in sorted(by_round):
168
+ executed: list[str] = []
169
+ noops: list[str] = []
170
+ for outcome in by_round[round_index]:
171
+ agent_id = str(outcome.get("agent_id") or "").strip()
172
+ action = str(outcome.get("selected_action") or "").strip()
173
+ if outcome.get("executed"):
174
+ metric = ""
175
+ if outcome.get("dev_metric") is not None:
176
+ metric = f" dev={outcome.get('dev_metric')}"
177
+ if outcome.get("holdout_metric") is not None:
178
+ metric = f" holdout={outcome.get('holdout_metric')}"
179
+ executed.append(f"{agent_id}:{action}{metric}")
180
+ else:
181
+ noops.append(agent_id)
182
+ executed_text = "; ".join(executed) if executed else "none"
183
+ noops_text = "; ".join(noops) if noops else "none"
184
+ lines.append(f"- Round {round_index}: executed `{executed_text}`; no_op `{noops_text}`")
185
+ return lines
186
+
187
+
188
+ def _render_operator_commands(payload: dict[str, object]) -> list[str]:
189
+ commands = _dict_value(payload, "commands")
190
+ user_contract = _dict_value(payload, "user_contract") or payload
191
+ one_click_start = _dict_value(user_contract, "one_click_start")
192
+ visible_launch = _dict_value(payload, "visible_launch")
193
+ launch_result = _dict_value(visible_launch, "launch_result")
194
+ default_start = (
195
+ _string_value(one_click_start, "command")
196
+ or _string_value(commands, "one_question_start_with_visible_wake")
197
+ or _string_value(commands, "one_question_start")
198
+ )
199
+ takeover_start = _string_value(one_click_start, "operator_takeover_command")
200
+ attach_semantics = _string_value(one_click_start, "attach_semantics")
201
+ attach_command = _string_value(launch_result, "attach_command")
202
+ stop_command = _string_value(launch_result, "stop_command")
203
+ lines = ["", "## Operator Commands", ""]
204
+ if default_start:
205
+ lines.append(f"- visible role start: `{default_start}`")
206
+ if takeover_start:
207
+ lines.append(f"- immediate takeover: `{takeover_start}`")
208
+ if attach_semantics:
209
+ lines.append(f"- attach_semantics: {attach_semantics}")
210
+ if attach_command:
211
+ lines.append(f"- tmux attach: `{attach_command}`")
212
+ if stop_command:
213
+ lines.append(f"- tmux stop: `{stop_command}`")
214
+ if len(lines) == 3:
215
+ return []
216
+ return lines
217
+
218
+
219
+ def _render_user_contract(payload: dict[str, object]) -> str:
220
+ brief = _dict_value(payload, "research_brief")
221
+ plan = payload.get("action_plan") if isinstance(payload.get("action_plan"), list) else []
222
+ evidence = _dict_value(payload, "evidence_refs")
223
+ one_click_start = _dict_value(payload, "one_click_start")
224
+ next_step = _dict_value(payload, "next_executable_step")
225
+ gate = _dict_value(payload, "gate")
226
+ preset_context = _dict_value(payload, "preset_context")
227
+ gates = gate.get("user_judgment_needed") if isinstance(gate.get("user_judgment_needed"), list) else []
228
+ lines = [
229
+ "# LoopX Auto Research",
230
+ "",
231
+ f"- schema: `{payload.get('schema_version')}`",
232
+ f"- question: {payload.get('open_question')}",
233
+ "",
234
+ "## Research Brief",
235
+ "",
236
+ f"- read: `{_join_or_none(brief.get('read'))}`",
237
+ f"- not_read: `{_join_or_none(brief.get('not_read'))}`",
238
+ f"- claim_boundary: {brief.get('claim_boundary')}",
239
+ "",
240
+ ]
241
+ if preset_context:
242
+ lines.extend(
243
+ [
244
+ "## Preset Context",
245
+ "",
246
+ f"- preset_id: `{preset_context.get('preset_id')}`",
247
+ f"- baseline_source: `{preset_context.get('baseline_source')}`",
248
+ f"- question_text_supplies_baseline: `{preset_context.get('question_text_supplies_baseline')}`",
249
+ f"- metric_name: `{preset_context.get('metric_name')}`",
250
+ f"- baseline_metric: `{preset_context.get('baseline_metric')}`",
251
+ f"- benchmark_contract_file: `{preset_context.get('benchmark_contract_file')}`",
252
+ f"- editable_scope: `{_join_or_none(preset_context.get('editable_scope'))}`",
253
+ f"- protected_scope: `{_join_or_none(preset_context.get('protected_scope'))}`",
254
+ f"- dev_eval_command: `{preset_context.get('dev_eval_command')}`",
255
+ f"- holdout_eval_command: `{preset_context.get('holdout_eval_command')}`",
256
+ f"- claim_boundary: {preset_context.get('claim_boundary')}",
257
+ "",
258
+ ]
259
+ )
260
+ lines.extend(["## Action Plan", ""])
261
+ if not plan:
262
+ lines.append("- none")
263
+ for item in plan:
264
+ if not isinstance(item, dict):
265
+ continue
266
+ lines.append(
267
+ f"- {item.get('priority')}: {item.get('todo')} "
268
+ f"(`{item.get('owner_layer')}`)"
269
+ )
270
+ lines.extend(
271
+ [
272
+ "",
273
+ "## Evidence Refs",
274
+ "",
275
+ f"- code: `{_join_or_none(evidence.get('code'))}`",
276
+ f"- docs: `{_join_or_none(evidence.get('docs'))}`",
277
+ f"- benchmarks: `{_join_or_none(evidence.get('benchmarks'))}`",
278
+ f"- issues: `{_join_or_none(evidence.get('issues'))}`",
279
+ f"- pull_requests: `{_join_or_none(evidence.get('pull_requests'))}`",
280
+ "",
281
+ "## One-Click Start",
282
+ "",
283
+ f"- command: `{one_click_start.get('command')}`",
284
+ f"- operator_takeover: `{one_click_start.get('operator_takeover_command')}`",
285
+ f"- preview: `{one_click_start.get('preview_command')}`",
286
+ f"- starts: `{one_click_start.get('starts')}`",
287
+ f"- coordination_model: `{one_click_start.get('coordination_model')}`",
288
+ "",
289
+ ]
290
+ )
291
+ lines.extend(_render_operator_commands(payload))
292
+ lines.extend(
293
+ [
294
+ "",
295
+ "## Next Executable Step",
296
+ "",
297
+ f"- can_run_automatically: `{next_step.get('can_run_automatically')}`",
298
+ f"- step: {next_step.get('step')}",
299
+ "",
300
+ "## Gate",
301
+ "",
302
+ ]
303
+ )
304
+ if not gates:
305
+ lines.append("- none")
306
+ for item in gates:
307
+ lines.append(f"- {item}")
308
+ lines.append(f"- default_without_user_gate: {gate.get('default_without_user_gate')}")
309
+ return "\n".join(lines) + "\n"
310
+
311
+
312
+ def render_auto_research_projection_markdown(payload: dict[str, object]) -> str:
313
+ if not payload.get("ok"):
314
+ return _render_failure(payload)
315
+ if "frontier" not in payload or "evidence_graph" not in payload:
316
+ return _render_generic(payload)
317
+ frontier = _dict_value(payload, "frontier")
318
+ graph = _dict_value(payload, "evidence_graph")
319
+ selected = _dict_value(frontier, "selected")
320
+ lines = [
321
+ "# LoopX Auto Research Frontier",
322
+ "",
323
+ f"- schema: `{payload.get('schema_version')}`",
324
+ f"- agent_id: `{frontier.get('agent_id')}`",
325
+ f"- selected: `{selected.get('hypothesis_id') if isinstance(selected, dict) else 'none'}`",
326
+ f"- hypotheses: `{graph.get('hypothesis_count')}`",
327
+ f"- evidence events: `{graph.get('evidence_event_count')}`",
328
+ f"- best dev metric: `{graph.get('best_dev_metric')}`",
329
+ f"- best holdout metric: `{graph.get('best_holdout_metric')}`",
330
+ f"- promotion candidates: `{len(frontier.get('promotion_candidates') or [])}`",
331
+ f"- retirement candidates: `{len(frontier.get('retirement_candidates') or [])}`",
332
+ ]
333
+ return "\n".join(lines) + "\n"
334
+
335
+
336
+ def _render_worker_turn(payload: dict[str, object]) -> str:
337
+ frontier_packet = _dict_value(payload, "frontier")
338
+ quota = _dict_value(frontier_packet, "quota")
339
+ frontier = _dict_value(frontier_packet, "frontier")
340
+ selected = _dict_value(frontier, "selected")
341
+ completion = _dict_value(payload, "completion")
342
+ append = _dict_value(payload, "append")
343
+ live_evidence = _dict_value(payload, "live_evidence")
344
+ artifact = _dict_value(payload, "artifact")
345
+ artifacts = _dict_value(payload, "artifacts")
346
+ lines = [
347
+ "# LoopX Auto Research Worker Turn",
348
+ "",
349
+ f"- schema: `{payload.get('schema_version')}`",
350
+ f"- mode: `{payload.get('mode')}`",
351
+ f"- goal_id: `{payload.get('goal_id')}`",
352
+ f"- agent_id: `{payload.get('agent_id')}`",
353
+ f"- quota_should_run: `{quota.get('should_run')}`",
354
+ f"- quota_state: `{quota.get('state')}`",
355
+ f"- user_action_required: `{quota.get('user_action_required')}`",
356
+ f"- selected_todo: `{payload.get('selected_todo_id') or selected.get('todo_id')}`",
357
+ f"- selected_action: `{payload.get('selected_action') or selected.get('allowed_action')}`",
358
+ f"- selected_title: {selected.get('title')}",
359
+ f"- blocker: `{payload.get('blocker')}`",
360
+ f"- blocker_detail: {payload.get('blocker_detail')}",
361
+ f"- executed: `{payload.get('executed')}`",
362
+ f"- would_execute: `{payload.get('would_execute')}`",
363
+ f"- completion_status: `{completion.get('status')}`",
364
+ f"- completion_executed: `{completion.get('executed')}`",
365
+ f"- artifact: `{artifact.get('filename') or artifacts.get('evidence_packet')}`",
366
+ f"- artifact_status: `{payload.get('artifact_status') or payload.get('packet_status')}`",
367
+ f"- dev_metric: `{payload.get('dev_metric')}`",
368
+ f"- holdout_metric: `{payload.get('holdout_metric')}`",
369
+ f"- appended_count: `{append.get('appended_count')}`",
370
+ f"- live_evidence_written: `{live_evidence.get('written')}`",
371
+ f"- public_boundary: raw_logs=`False`, private_artifacts=`False`, paths=`local-only`",
372
+ ]
373
+ return "\n".join(lines) + "\n"
374
+
375
+
376
+ def _render_worker_loop(payload: dict[str, object]) -> str:
377
+ turns = payload.get("turns") if isinstance(payload.get("turns"), list) else []
378
+ lines = [
379
+ "# LoopX Auto Research Worker Loop",
380
+ "",
381
+ f"- schema: `{payload.get('schema_version')}`",
382
+ f"- mode: `{payload.get('mode')}`",
383
+ f"- goal_id: `{payload.get('goal_id')}`",
384
+ f"- round_count: `{payload.get('round_count')}`",
385
+ f"- max_rounds: `{payload.get('max_rounds')}`",
386
+ f"- stop_reason: `{payload.get('stop_reason')}`",
387
+ f"- turn_count: `{payload.get('turn_count')}`",
388
+ f"- executed_turn_count: `{payload.get('executed_turn_count')}`",
389
+ f"- completed_turn_count: `{payload.get('completed_turn_count')}`",
390
+ f"- selected_actions: `{', '.join(str(action) for action in payload.get('selected_actions') or [])}`",
391
+ "",
392
+ "## Turns",
393
+ "",
394
+ ]
395
+ if not turns:
396
+ lines.append("- none")
397
+ for turn in turns:
398
+ if not isinstance(turn, dict):
399
+ continue
400
+ lines.append(
401
+ f"- round `{turn.get('round')}` agent `{turn.get('agent_id')}` "
402
+ f"role `{turn.get('role_id')}` "
403
+ f"mode `{turn.get('mode')}` action `{turn.get('selected_action')}` "
404
+ f"executed `{turn.get('executed')}` completion `{turn.get('completion_status')}` "
405
+ f"dev `{turn.get('dev_metric')}` holdout `{turn.get('holdout_metric')}`"
406
+ )
407
+ return "\n".join(lines) + "\n"
408
+
409
+
410
+ def _render_demo_e2e(payload: dict[str, object]) -> str:
411
+ worker_loop = _dict_value(payload, "worker_loop")
412
+ user_contract = _dict_value(payload, "user_contract")
413
+ language_payload = _dict_value(user_contract, "output_language")
414
+ tonight = _dict_value(payload, "tonight_experience")
415
+ supervisor = _dict_value(payload, "supervisor")
416
+ preset = _dict_value(supervisor, "preset")
417
+ minimal_recipe = _dict_value(preset, "minimal_a2a_recipe")
418
+ if not minimal_recipe:
419
+ minimal_recipe = build_auto_research_minimal_a2a_recipe(
420
+ open_question=user_contract.get("open_question"),
421
+ output_language=str(language_payload.get("resolved") or payload.get("output_language") or "en"),
422
+ )
423
+ route = _dict_value(payload, "route_contract")
424
+ preset_context = _dict_value(payload, "preset_context")
425
+ live = _dict_value(payload, "visible_worker_proof")
426
+ pane_status = _dict_value(payload, "visible_pane_a2a_status")
427
+ collective_rounds = _dict_value(payload, "collective_research_rounds")
428
+ readiness = _dict_value(payload, "visible_readiness")
429
+ contract_acceptance = _dict_value(payload, "contract_acceptance")
430
+ commands = _dict_value(payload, "commands")
431
+ improvement = _dict_value(readiness, "improvement_summary")
432
+ participation_gap = _dict_value(collective_rounds, "full_participation_requirement_gap")
433
+ role_cycle_shortfall = participation_gap.get("shortfall_by_agent") or {}
434
+ lines = [
435
+ "# LoopX Auto Research Minimal E2E Demo",
436
+ "",
437
+ f"- schema: `{payload.get('schema_version')}`",
438
+ f"- mode: `{payload.get('mode')}`",
439
+ f"- execution_kind: `{payload.get('execution_kind')}`",
440
+ f"- result_source: `{payload.get('result_source')}`",
441
+ f"- goal_id: `{payload.get('goal_id')}`",
442
+ f"- tracking_goal_id: `{payload.get('tracking_goal_id')}`",
443
+ f"- frontier_goal_id: `{route.get('frontier_goal_id')}`",
444
+ f"- preset_id: `{preset_context.get('preset_id')}`",
445
+ f"- preset_baseline_source: `{preset_context.get('baseline_source')}`",
446
+ f"- baseline_metric: `{preset_context.get('baseline_metric')}`",
447
+ f"- benchmark_contract_file: `{preset_context.get('benchmark_contract_file')}`",
448
+ f"- editable_scope: `{_join_or_none(preset_context.get('editable_scope'))}`",
449
+ f"- protected_scope: `{_join_or_none(preset_context.get('protected_scope'))}`",
450
+ f"- dev_eval_command: `{preset_context.get('dev_eval_command')}`",
451
+ f"- holdout_eval_command: `{preset_context.get('holdout_eval_command')}`",
452
+ f"- agent_id: `{payload.get('agent_id')}`",
453
+ f"- user_contract_accepted: `{contract_acceptance.get('accepted')}`",
454
+ f"- one_question_contract: `{commands.get('one_question_contract')}`",
455
+ f"- one_question_start: `{commands.get('one_question_start')}`",
456
+ f"- minimal_a2a_user_plus_preset_lines: `{minimal_recipe.get('user_plus_preset_line_count')}`",
457
+ f"- minimal_a2a_shared_kernel_counted: `{minimal_recipe.get('shared_kernel_counted_as_recipe_lines')}`",
458
+ f"- reasoning_effort: `{payload.get('reasoning_effort')}`",
459
+ f"- worker_loop_executed_turns: `{worker_loop.get('executed_turn_count')}`",
460
+ f"- worker_loop_completed_turns: `{worker_loop.get('completed_turn_count')}`",
461
+ f"- worker_loop_selected_actions: `{worker_loop.get('selected_actions')}`",
462
+ f"- worker_loop_stop_reason: `{worker_loop.get('stop_reason')}`",
463
+ f"- tonight_ready: `{tonight.get('ready')}`",
464
+ f"- tonight_coordination_pattern: `{tonight.get('coordination_pattern')}`",
465
+ f"- tonight_dev_metric: `{tonight.get('dev_metric')}`",
466
+ f"- tonight_holdout_metric: `{tonight.get('holdout_metric')}`",
467
+ f"- tonight_positive_result: `{tonight.get('positive_result')}`",
468
+ f"- visible_lanes_launched: `{live.get('visible_lanes_launched')}`",
469
+ f"- visible_lanes_accepted: `{live.get('visible_lanes_accepted')}`",
470
+ f"- visible_role_participation_verified: `{live.get('visible_role_participation_verified')}`",
471
+ f"- visible_role_participation_basis: `{live.get('visible_role_participation_basis')}`",
472
+ f"- visible_pane_status_checks: `{pane_status.get('status_check_count')}`",
473
+ f"- pane_status_counts_as_research_rounds: `{pane_status.get('counts_as_collective_research_round')}`",
474
+ f"- collective_research_claim_source: `{collective_rounds.get('claim_source') or collective_rounds.get('source')}`",
475
+ f"- collective_research_rounds: `{collective_rounds.get('collective_round_count')}`",
476
+ f"- collective_research_rounds_verified: `{collective_rounds.get('multi_round_research_verified')}`",
477
+ f"- collective_research_role_cycle_gap: `{role_cycle_shortfall}`",
478
+ f"- holdout_metric_sequence: `{collective_rounds.get('holdout_metric_sequence')}`",
479
+ f"- holdout_improvement_count: `{collective_rounds.get('holdout_improvement_count')}`",
480
+ f"- collective_a2a_rounds_verified: `{live.get('decentralized_a2a_rounds_verified')}`",
481
+ f"- visible_readiness_ready: `{readiness.get('ready')}`",
482
+ f"- visible_readiness_level: `{readiness.get('readiness_level')}`",
483
+ f"- visible_best_metric: `{improvement.get('best_metric')}`",
484
+ f"- visible_holdout_delta_over_dev: `{improvement.get('holdout_delta_over_dev')}`",
485
+ f"- supervisor_lanes: `{supervisor.get('lane_count')}`",
486
+ ]
487
+ if preset_context:
488
+ lines.extend(
489
+ [
490
+ "",
491
+ "## Preset Context",
492
+ "",
493
+ f"- preset_id: `{preset_context.get('preset_id')}`",
494
+ f"- baseline_source: `{preset_context.get('baseline_source')}`",
495
+ f"- question_text_supplies_baseline: `{preset_context.get('question_text_supplies_baseline')}`",
496
+ f"- metric_name: `{preset_context.get('metric_name')}`",
497
+ f"- baseline_metric: `{preset_context.get('baseline_metric')}`",
498
+ f"- protected_scope: `{_join_or_none(preset_context.get('protected_scope'))}`",
499
+ f"- claim_boundary: {preset_context.get('claim_boundary')}",
500
+ ]
501
+ )
502
+ lines.extend(
503
+ _render_research_roles(
504
+ minimal_recipe=minimal_recipe,
505
+ collective_rounds=collective_rounds,
506
+ )
507
+ )
508
+ lines.extend(
509
+ _render_collective_round_summary(
510
+ worker_loop=worker_loop,
511
+ collective_rounds=collective_rounds,
512
+ )
513
+ )
514
+ if minimal_recipe:
515
+ lines.extend(
516
+ [
517
+ "",
518
+ "## Minimal A2A Recipe",
519
+ "",
520
+ f"- user_plus_preset_lines: `{minimal_recipe.get('user_plus_preset_line_count')}`",
521
+ f"- user_lines: `{minimal_recipe.get('user_line_count')}`",
522
+ f"- preset_role_spec_lines: `{minimal_recipe.get('preset_role_spec_line_count')}`",
523
+ f"- shared_kernel_counted: `{minimal_recipe.get('shared_kernel_counted_as_recipe_lines')}`",
524
+ f"- coordination_model: `{minimal_recipe.get('coordination_model')}`",
525
+ ]
526
+ )
527
+ for line in minimal_recipe.get("preset_recipe_lines") or []:
528
+ lines.append(f"- preset_role: {_role_description_from_spec_line(line)}")
529
+ lines.extend(_render_operator_commands(payload))
530
+ return "\n".join(lines) + "\n"
531
+
532
+
533
+ def _render_rollout_append(payload: dict[str, object]) -> str:
534
+ lines = [
535
+ "# LoopX Auto Research Rollout Append",
536
+ "",
537
+ f"- schema: `{payload.get('schema_version')}`",
538
+ f"- goal_id: `{payload.get('goal_id')}`",
539
+ f"- dry_run: `{payload.get('dry_run')}`",
540
+ f"- events: `{payload.get('event_count')}`",
541
+ f"- appended: `{payload.get('appended_count')}`",
542
+ f"- would_append: `{payload.get('would_append_count')}`",
543
+ f"- skipped_existing: `{payload.get('skipped_existing_count')}`",
544
+ ]
545
+ return "\n".join(lines) + "\n"
546
+
547
+
548
+ def _render_live_evidence(payload: dict[str, object]) -> str:
549
+ visible = payload.get("visible_lanes") if isinstance(payload.get("visible_lanes"), dict) else {}
550
+ evidence = payload.get("lane_evidence") if isinstance(payload.get("lane_evidence"), dict) else {}
551
+ lines = [
552
+ "# LoopX Auto Research Live Evidence",
553
+ "",
554
+ f"- schema: `{payload.get('schema_version')}`",
555
+ f"- goal_id: `{payload.get('goal_id')}`",
556
+ f"- agent_id: `{payload.get('agent_id')}`",
557
+ f"- source: `{payload.get('source')}`",
558
+ f"- visible_lanes_accepted: `{visible.get('accepted')}`",
559
+ f"- lane_count: `{visible.get('lane_count')}`",
560
+ f"- evidence_events: `{evidence.get('evidence_event_count')}`",
561
+ f"- result_status: `{evidence.get('result_status')}`",
562
+ f"- protected_scope_clean: `{evidence.get('protected_scope_clean')}`",
563
+ ]
564
+ return "\n".join(lines) + "\n"
565
+
566
+
567
+ def _render_supervisor(payload: dict[str, object]) -> str:
568
+ lanes = payload.get("lanes") if isinstance(payload.get("lanes"), list) else []
569
+ preset = _dict_value(payload, "preset")
570
+ minimal_recipe = _dict_value(preset, "minimal_a2a_recipe")
571
+ route = _dict_value(payload, "goal_surface_route")
572
+ boundary = _dict_value(payload, "boundary")
573
+ coordination = _dict_value(payload, "coordination_model")
574
+ runner = _dict_value(payload, "runner_contract")
575
+ tmux_lifecycle = _dict_value(runner, "tmux_lifecycle")
576
+ one_click = _dict_value(payload, "one_click_demo")
577
+ cli_contract = _dict_value(payload, "cli_contract")
578
+ lines = [
579
+ "# LoopX Auto Research Demo Supervisor",
580
+ "",
581
+ f"- schema: `{payload.get('schema_version')}`",
582
+ f"- mode: `{payload.get('mode')}`",
583
+ f"- goal_id: `{payload.get('goal_id')}`",
584
+ f"- session_name: `{payload.get('session_name')}`",
585
+ f"- lane_count: `{len(lanes)}`",
586
+ f"- frontier_goal_id: `{route.get('frontier_goal_id')}`",
587
+ f"- leader_agent_required: `{coordination.get('leader_agent_required')}`",
588
+ f"- coordination_pattern: `{coordination.get('pattern')}`",
589
+ f"- starts_tmux: `{boundary.get('starts_tmux')}`",
590
+ f"- runs_codex: `{boundary.get('runs_codex')}`",
591
+ f"- attach: `{tmux_lifecycle.get('attach_command')}`",
592
+ "- start_script: `machine_json_only`",
593
+ "",
594
+ "## Role Profiles",
595
+ "",
596
+ ]
597
+ if not lanes:
598
+ lines.append("- none")
599
+ for lane in lanes:
600
+ if not isinstance(lane, dict):
601
+ continue
602
+ profile = _dict_value(lane, "role_profile")
603
+ lines.append(
604
+ f"- `{lane.get('lane_id')}` agent `{lane.get('agent_id')}` role `{lane.get('role_id')}`"
605
+ )
606
+ lines.append(
607
+ f" - required_worker_playbook: `{profile.get('required_skill')}`"
608
+ )
609
+ lines.append(f" - skill_distribution: `{profile.get('skill_distribution')}`")
610
+ lines.append(f" - worker_skill_source: `{profile.get('worker_skill_source')}`")
611
+ lines.extend(["", "## Lane Timeline", ""])
612
+ if not lanes:
613
+ lines.append("- none")
614
+ for lane in lanes:
615
+ if not isinstance(lane, dict):
616
+ continue
617
+ timeline = lane.get("lane_timeline") if isinstance(lane.get("lane_timeline"), list) else []
618
+ lines.append(f"- `{lane.get('lane_id')}`: `{' -> '.join(str(item) for item in timeline)}`")
619
+ lines.extend(
620
+ [
621
+ "",
622
+ "## Minimal A2A Recipe",
623
+ "",
624
+ "- canonical_recipe_ref: `preset.minimal_a2a_recipe`",
625
+ f"- user_plus_preset_lines: `{minimal_recipe.get('user_plus_preset_line_count')}`",
626
+ f"- user_lines: `{minimal_recipe.get('user_line_count')}`",
627
+ f"- preset_role_spec_lines: `{minimal_recipe.get('preset_role_spec_line_count')}`",
628
+ f"- shared_kernel_counted: `{minimal_recipe.get('shared_kernel_counted_as_recipe_lines')}`",
629
+ f"- coordination_model: `{minimal_recipe.get('coordination_model')}`",
630
+ "",
631
+ "",
632
+ "## One-Click Dry Run",
633
+ "",
634
+ f"- mode: `{one_click.get('mode')}`",
635
+ "- command: `loopx auto-research start \"<open question>\" --execute`",
636
+ "- operator_takeover: `loopx auto-research start \"<open question>\" --execute --attach`",
637
+ f"- machine_json_policy: `{cli_contract.get('machine_json_policy')}`",
638
+ f"- tmux attach: `{tmux_lifecycle.get('attach_command')}`",
639
+ f"- tmux stop: `{tmux_lifecycle.get('stop_command')}`",
640
+ ]
641
+ )
642
+ return "\n".join(lines) + "\n"
643
+
644
+
645
+ def _render_evidence_packet(payload: dict[str, object]) -> str:
646
+ hypothesis = _dict_value(payload, "hypothesis")
647
+ summary = _dict_value(payload, "evidence_summary")
648
+ lines = [
649
+ "# LoopX Auto Research Evidence Packet",
650
+ "",
651
+ f"- schema: `{payload.get('schema_version')}`",
652
+ f"- goal_id: `{payload.get('goal_id')}`",
653
+ f"- hypothesis: `{hypothesis.get('hypothesis_id')}`",
654
+ f"- todo: `{hypothesis.get('todo_id')}`",
655
+ f"- status: `{hypothesis.get('status')}`",
656
+ f"- evidence events: `{summary.get('evidence_event_count')}`",
657
+ f"- splits: `{', '.join(summary.get('splits', []))}`",
658
+ f"- negative evidence: `{summary.get('negative_evidence_count')}`",
659
+ f"- protected scope clean: `{summary.get('protected_scope_clean')}`",
660
+ ]
661
+ return "\n".join(lines) + "\n"
662
+
663
+
664
+ def _render_terminal_result(payload: dict[str, object]) -> str:
665
+ decision = _dict_value(payload, "decision")
666
+ review = _dict_value(payload, "review")
667
+ lines = [
668
+ "# LoopX Auto Research Terminal Result",
669
+ "",
670
+ f"- schema: `{payload.get('schema_version')}`",
671
+ f"- goal_id: `{payload.get('goal_id')}`",
672
+ f"- dry_run: `{payload.get('dry_run')}`",
673
+ f"- appended: `{payload.get('appended')}`",
674
+ f"- reused: `{payload.get('reused')}`",
675
+ ]
676
+ if decision:
677
+ lines.extend(
678
+ [
679
+ f"- hypothesis_id: `{decision.get('hypothesis_id')}`",
680
+ f"- outcome: `{decision.get('outcome')}`",
681
+ f"- reason: `{decision.get('reason')}`",
682
+ f"- evidence_graph_revision: `{decision.get('evidence_graph_revision')}`",
683
+ ]
684
+ )
685
+ if review:
686
+ lines.extend(
687
+ [
688
+ f"- hypothesis_id: `{review.get('hypothesis_id')}`",
689
+ f"- verdict: `{review.get('verdict')}`",
690
+ f"- independent: `{review.get('independent')}`",
691
+ f"- evidence_graph_revision: `{review.get('evidence_graph_revision')}`",
692
+ ]
693
+ )
694
+ return "\n".join(lines) + "\n"
695
+
696
+
697
+ def _render_terminal_result_query(payload: dict[str, object]) -> str:
698
+ lines = [
699
+ "# LoopX Auto Research Results",
700
+ "",
701
+ f"- schema: `{payload.get('schema_version')}`",
702
+ f"- goal_id: `{payload.get('goal_id')}`",
703
+ f"- evidence_graph_revision: `{payload.get('evidence_graph_revision')}`",
704
+ f"- result_count: `{payload.get('result_count')}`",
705
+ "",
706
+ "## Results",
707
+ "",
708
+ ]
709
+ results = payload.get("results") if isinstance(payload.get("results"), list) else []
710
+ if not results:
711
+ lines.append("- none")
712
+ for result in results:
713
+ if not isinstance(result, dict):
714
+ continue
715
+ decision = _dict_value(result, "terminal_decision")
716
+ review = _dict_value(result, "peer_review")
717
+ lines.extend(
718
+ [
719
+ f"- `{result.get('hypothesis_id')}`: {result.get('hypothesis')}",
720
+ f" - research_status: `{result.get('research_status')}`",
721
+ f" - decision_state: `{result.get('decision_state')}`",
722
+ f" - terminal_outcome: `{decision.get('outcome')}`",
723
+ f" - terminal_reason: `{decision.get('reason')}`",
724
+ f" - finding_status: `{result.get('finding_status')}`",
725
+ f" - review_state: `{review.get('state')}`",
726
+ f" - review_verdict: `{review.get('verdict')}`",
727
+ f" - independent_review: `{review.get('independent')}`",
728
+ ]
729
+ )
730
+ return "\n".join(lines) + "\n"
731
+
732
+
733
+ def _render_terminal_result_projection(payload: dict[str, object]) -> str:
734
+ projection = _dict_value(payload, "explore_projection")
735
+ counts = _dict_value(projection, "counts")
736
+ return "\n".join(
737
+ [
738
+ "# LoopX Auto Research Result Projection",
739
+ "",
740
+ f"- schema: `{payload.get('schema_version')}`",
741
+ f"- goal_id: `{payload.get('goal_id')}`",
742
+ f"- dry_run: `{payload.get('dry_run')}`",
743
+ f"- result_count: `{payload.get('result_count')}`",
744
+ f"- event_count: `{payload.get('event_count')}`",
745
+ f"- appended_count: `{payload.get('appended_count')}`",
746
+ f"- reused_count: `{payload.get('reused_count')}`",
747
+ f"- node_count: `{counts.get('node_count')}`",
748
+ f"- finding_count: `{counts.get('finding_count')}`",
749
+ ]
750
+ ) + "\n"
751
+
752
+
753
+ def _render_generic(payload: dict[str, object]) -> str:
754
+ lines = [
755
+ "# LoopX Auto Research",
756
+ "",
757
+ f"- ok: `{payload.get('ok')}`",
758
+ f"- schema: `{payload.get('schema_version')}`",
759
+ f"- mode: `{payload.get('mode')}`",
760
+ f"- goal_id: `{payload.get('goal_id')}`",
761
+ ]
762
+ return "\n".join(lines) + "\n"
763
+
764
+
765
+ def render_auto_research_markdown(payload: dict[str, object]) -> str:
766
+ if not payload.get("ok"):
767
+ return _render_failure(payload)
768
+ schema = payload.get("schema_version")
769
+ if schema == "auto_research_worker_turn_v0":
770
+ return _render_worker_turn(payload)
771
+ if schema == AUTO_RESEARCH_USER_CONTRACT_SCHEMA_VERSION:
772
+ return _render_user_contract(payload)
773
+ if schema == "auto_research_worker_loop_v0":
774
+ return _render_worker_loop(payload)
775
+ if schema == AUTO_RESEARCH_DEMO_E2E_SCHEMA_VERSION:
776
+ return _render_demo_e2e(payload)
777
+ if schema == "auto_research_demo_supervisor_plan_v0":
778
+ return _render_supervisor(payload)
779
+ if schema == AUTO_RESEARCH_ROLLOUT_APPEND_SCHEMA_VERSION:
780
+ return _render_rollout_append(payload)
781
+ if schema == "auto_research_live_codex_lane_e2e_evidence_v0":
782
+ return _render_live_evidence(payload)
783
+ if schema == "auto_research_evidence_packet_v0":
784
+ return _render_evidence_packet(payload)
785
+ if schema in {
786
+ "auto_research_terminal_decision_v0",
787
+ "auto_research_peer_review_v0",
788
+ }:
789
+ return _render_terminal_result(payload)
790
+ if schema == "auto_research_terminal_result_query_v0":
791
+ return _render_terminal_result_query(payload)
792
+ if schema == "auto_research_terminal_result_projection_v0":
793
+ return _render_terminal_result_projection(payload)
794
+ return render_auto_research_projection_markdown(payload)