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,426 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ SCOPED_LOOPX_WRAPPER_PY = r"""
5
+ import os
6
+ from pathlib import Path
7
+
8
+ project = Path(os.environ["LOOPX_PROJECT"])
9
+ real = os.environ["LOOPX_REAL_CLI"]
10
+ registry = os.environ["LOOPX_REGISTRY"]
11
+ runtime = os.environ["LOOPX_RUNTIME_ROOT"]
12
+ bin_dir = project / ".local" / "bin"
13
+ bin_dir.mkdir(parents=True, exist_ok=True)
14
+
15
+ json_target = bin_dir / "loopx-json"
16
+ json_target.write_text(
17
+ "#!/usr/bin/env python3\n"
18
+ "import os, stat, sys\n"
19
+ f"real = {real!r}\n"
20
+ f"registry = {registry!r}\n"
21
+ f"runtime = {runtime!r}\n"
22
+ "explicit = os.environ.get('LOOPX_MACHINE_JSON') == '1' or os.environ.get('LOOPX_ALLOW_TTY_JSON') == '1' or os.environ.get('LOOPX_ALLOW_VISIBLE_JSON') == '1'\n"
23
+ "stdout_mode = os.fstat(sys.stdout.fileno()).st_mode\n"
24
+ "stdout_is_file = stat.S_ISREG(stdout_mode)\n"
25
+ "if not explicit and not stdout_is_file:\n"
26
+ " print('\\n[LoopX machine JSON hidden]\\nraw JSON is not printed in visible panes.\\n')\n"
27
+ " print('Use $LOOPX_PANE_LOOPX for human-readable output, or redirect machine JSON:')\n"
28
+ " print(' mkdir -p \"$LOOPX_PANE_ARTIFACT_DIR\"')\n"
29
+ " print(' $LOOPX_PANE_LOOPX_JSON <command> > \"$LOOPX_PANE_ARTIFACT_DIR/<name>.public.json\"')\n"
30
+ " print('$LOOPX_PANE_LOOPX_JSON is a command path, not an output file.')\n"
31
+ " print('It injects --format json unless you pass an explicit --format.')\n"
32
+ " print('Internal launcher pipes must set LOOPX_MACHINE_JSON=1 explicitly.')\n"
33
+ " raise SystemExit(2)\n"
34
+ "args = sys.argv[1:]\n"
35
+ "has_format = any(arg == '--format' or arg.startswith('--format=') for arg in args)\n"
36
+ "if not has_format:\n"
37
+ " args = ['--format', 'json'] + args\n"
38
+ "os.execv(real, [real, '--registry', registry, '--runtime-root', runtime] + args)\n",
39
+ encoding="utf-8",
40
+ )
41
+ json_target.chmod(0o700)
42
+
43
+ human_target = bin_dir / "loopx"
44
+ human_target.write_text(
45
+ "#!/usr/bin/env python3\n"
46
+ "import os, sys\n"
47
+ f"real = {real!r}\n"
48
+ f"registry = {registry!r}\n"
49
+ f"runtime = {runtime!r}\n"
50
+ "args = sys.argv[1:]\n"
51
+ "force = os.environ.get('LOOPX_VISIBLE_FORCE_MARKDOWN', '1') != '0'\n"
52
+ "machine_json = os.environ.get('LOOPX_MACHINE_JSON') == '1'\n"
53
+ "changed = False\n"
54
+ "if force and not machine_json:\n"
55
+ " rewritten = []\n"
56
+ " index = 0\n"
57
+ " while index < len(args):\n"
58
+ " arg = args[index]\n"
59
+ " if arg == '--format' and index + 1 < len(args):\n"
60
+ " rewritten.append(arg)\n"
61
+ " value = args[index + 1]\n"
62
+ " if value == 'json':\n"
63
+ " value = 'markdown'\n"
64
+ " changed = True\n"
65
+ " rewritten.append(value)\n"
66
+ " index += 2\n"
67
+ " continue\n"
68
+ " if arg == '--format=json':\n"
69
+ " arg = '--format=markdown'\n"
70
+ " changed = True\n"
71
+ " rewritten.append(arg)\n"
72
+ " index += 1\n"
73
+ " args = rewritten\n"
74
+ "if changed:\n"
75
+ " print('\\n[LoopX human view]\\nformat=markdown; machine_json_command=$LOOPX_PANE_LOOPX_JSON artifact_dir=$LOOPX_PANE_ARTIFACT_DIR\\n', flush=True)\n"
76
+ "os.execv(real, [real, '--registry', registry, '--runtime-root', runtime] + args)\n",
77
+ encoding="utf-8",
78
+ )
79
+ human_target.chmod(0o700)
80
+
81
+ prompt_target = bin_dir / "loopx-build-codex-bootstrap-prompt"
82
+ prompt_target.write_text(
83
+ "#!/usr/bin/env python3\n"
84
+ "import json, os, sys\n"
85
+ "from pathlib import Path\n"
86
+ "def load_json_path(value):\n"
87
+ " if not value:\n"
88
+ " return {}\n"
89
+ " try:\n"
90
+ " return json.loads(Path(value).read_text(encoding='utf-8'))\n"
91
+ " except Exception:\n"
92
+ " return {}\n"
93
+ "def compact(value, *, default=''):\n"
94
+ " text = ' '.join(str(value or '').split())\n"
95
+ " return text[:240] if text else default\n"
96
+ "def compact_list(value):\n"
97
+ " if isinstance(value, list):\n"
98
+ " return ', '.join(compact(item) for item in value if compact(item))\n"
99
+ " return compact(value)\n"
100
+ "def latest_selected_round(summary):\n"
101
+ " rounds = summary.get('rounds') if isinstance(summary, dict) else []\n"
102
+ " if not isinstance(rounds, list):\n"
103
+ " return {}\n"
104
+ " for item in reversed(rounds):\n"
105
+ " if isinstance(item, dict) and (item.get('selected_todo_id') or item.get('selected_action')):\n"
106
+ " return item\n"
107
+ " return {}\n"
108
+ "artifact = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(os.environ.get('LOOPX_CODEX_TUI_PROMPT_ARTIFACT', ''))\n"
109
+ "visible_artifact = Path(sys.argv[2]) if len(sys.argv) > 2 and sys.argv[2] else None\n"
110
+ "if not str(artifact):\n"
111
+ " raise SystemExit(2)\n"
112
+ "base = artifact.read_text(encoding='utf-8') if artifact.exists() else ''\n"
113
+ "profile = load_json_path(os.environ.get('LOOPX_ROLE_PROFILE_ARTIFACT'))\n"
114
+ "summary = load_json_path(os.environ.get('LOOPX_PANE_TICK_SUMMARY'))\n"
115
+ "round_item = latest_selected_round(summary)\n"
116
+ "language = compact(profile.get('output_language') or os.environ.get('LOOPX_AUTO_RESEARCH_OUTPUT_LANGUAGE'))\n"
117
+ "open_question = compact(profile.get('open_question'))\n"
118
+ "preset_context = profile.get('preset_context') if isinstance(profile.get('preset_context'), dict) else {}\n"
119
+ "benchmark_contract = compact(preset_context.get('benchmark_contract_file'))\n"
120
+ "editable_scope = compact_list(preset_context.get('editable_scope'))\n"
121
+ "protected_scope = compact_list(preset_context.get('protected_scope'))\n"
122
+ "dev_eval_command = compact(preset_context.get('dev_eval_command'))\n"
123
+ "holdout_eval_command = compact(preset_context.get('holdout_eval_command'))\n"
124
+ "language_note = ''\n"
125
+ "if language == 'zh':\n"
126
+ " language_note = 'use Chinese for human-readable progress; keep machine keys unchanged'\n"
127
+ "elif language:\n"
128
+ " language_note = 'use this language for human-readable progress; keep machine keys unchanged'\n"
129
+ "lines = ['', '## LoopX Agent Bootstrap Context']\n"
130
+ "lines.append('- audience: role-local Codex agent; keep user-facing summaries compact.')\n"
131
+ "lines.append(f\"- agent_id: {compact(profile.get('agent_id') or os.environ.get('LOOPX_AGENT_ID'), default='unknown')}\")\n"
132
+ "lines.append(f\"- role_id: {compact(profile.get('role_id') or os.environ.get('LOOPX_ROLE_ID'), default='unknown')}\")\n"
133
+ "if open_question:\n"
134
+ " lines.append(f'- open_question: {open_question}')\n"
135
+ "if preset_context:\n"
136
+ " lines.append(f\"- preset_context: preset={compact(preset_context.get('preset_id'), default='none')} metric={compact(preset_context.get('metric_name'), default='none')} baseline={compact(preset_context.get('baseline_metric'), default='none')}\")\n"
137
+ " claim_boundary = compact(preset_context.get('claim_boundary'))\n"
138
+ " if claim_boundary:\n"
139
+ " lines.append(f'- claim_boundary: {claim_boundary}')\n"
140
+ " if benchmark_contract or editable_scope or protected_scope or dev_eval_command or holdout_eval_command:\n"
141
+ " lines.extend(['', '### Benchmark Workspace'])\n"
142
+ " if benchmark_contract:\n"
143
+ " lines.append(f'- benchmark_contract: {benchmark_contract}')\n"
144
+ " if editable_scope:\n"
145
+ " lines.append(f'- editable_scope: {editable_scope}')\n"
146
+ " if protected_scope:\n"
147
+ " lines.append(f'- protected_scope: {protected_scope}')\n"
148
+ " if dev_eval_command:\n"
149
+ " lines.append(f'- dev_eval_command: `{dev_eval_command}`')\n"
150
+ " if holdout_eval_command:\n"
151
+ " lines.append(f'- holdout_eval_command: `{holdout_eval_command}`')\n"
152
+ "responsibility = compact(profile.get('responsibility') or profile.get('agent_scope'))\n"
153
+ "if responsibility:\n"
154
+ " lines.append(f'- responsibility: {responsibility}')\n"
155
+ "if language_note:\n"
156
+ " lines.append(f'- human_output_language: {language}; {language_note}.')\n"
157
+ "visible_first_steps = profile.get('visible_first_steps') if isinstance(profile.get('visible_first_steps'), list) else []\n"
158
+ "visible_first_steps = [compact(item) for item in visible_first_steps if compact(item)]\n"
159
+ "if visible_first_steps:\n"
160
+ " lines.extend(['', '### Role First Move'])\n"
161
+ " for item in visible_first_steps[:6]:\n"
162
+ " lines.append(f'- {item}')\n"
163
+ "continuation_policy = profile.get('continuation_policy') if isinstance(profile.get('continuation_policy'), dict) else {}\n"
164
+ "continuation_line = ''\n"
165
+ "if continuation_policy:\n"
166
+ " required_holdouts = compact(continuation_policy.get('required_holdout_improvement_count'), default='')\n"
167
+ " successor_source = compact(continuation_policy.get('successor_source'), default='role_profile.successor_todos')\n"
168
+ " if required_holdouts:\n"
169
+ " continuation_line = f'target_holdout_improvements={required_holdouts}; if unmet, use {successor_source} before no-follow-up'\n"
170
+ " else:\n"
171
+ " continuation_line = f'if acceptance target is unmet, use {successor_source} before no-follow-up'\n"
172
+ "if continuation_line:\n"
173
+ " lines.extend(['', '### Continuation Target', f'- {continuation_line}'])\n"
174
+ "lines.extend(['', '### Current Frontier'])\n"
175
+ "if round_item:\n"
176
+ " lines.append(f\"- selected_todo_id: {compact(round_item.get('selected_todo_id'), default='unknown')}\")\n"
177
+ " lines.append(f\"- selected_action: {compact(round_item.get('selected_action'), default='unknown')}\")\n"
178
+ " lines.append(f\"- worker_status: {compact(round_item.get('worker_status'), default='unknown')}\")\n"
179
+ "else:\n"
180
+ " lines.append('- selected_frontier: not read yet; this Codex TUI owns the first pane-local tick.')\n"
181
+ "lines.extend(['', '### Safety Contract'])\n"
182
+ "lines.append('- protected_scope_rule: do not edit protected evaluator/data, credentials, private material, or raw logs.')\n"
183
+ "lines.append('- claim_allowed_rule: false until role-authored public-safe evidence validates; do not promote from dev-only evidence.')\n"
184
+ "lines.append('- successor_rule: create only role-declared successor todos through normal LoopX todo commands.')\n"
185
+ "lines.extend(['', '### Visible Research Rule'])\n"
186
+ "lines.append('- tick_rule: pane-local tick reads quota/frontier/status only; it must not manufacture research conclusions.')\n"
187
+ "lines.append('- evidence_rule: write only lane-authored public-safe evidence or successor todos after doing visible role work.')\n"
188
+ "full_prompt = base.rstrip() + '\\n\\n' + '\\n'.join(lines).strip() + '\\n'\n"
189
+ "artifact.write_text(full_prompt, encoding='utf-8')\n"
190
+ "selected_todo = compact(round_item.get('selected_todo_id'), default='none') if round_item else 'none'\n"
191
+ "selected_action = compact(round_item.get('selected_action'), default='none') if round_item else 'none'\n"
192
+ "frontier_text_zh = f'{selected_todo} / {selected_action}' if round_item else 'tick 后读取;若仍为空,用 todo list/status 查本角色 open todo'\n"
193
+ "frontier_text_en = f'{selected_todo} / {selected_action}' if round_item else 'read after tick; if still empty, use todo list/status to find this role open todo'\n"
194
+ "benchmark_lines_zh = []\n"
195
+ "benchmark_lines_en = []\n"
196
+ "if benchmark_contract:\n"
197
+ " benchmark_lines_zh.append(f'- benchmark 合同: {benchmark_contract}')\n"
198
+ " benchmark_lines_en.append(f'- benchmark contract: {benchmark_contract}')\n"
199
+ "if editable_scope:\n"
200
+ " benchmark_lines_zh.append(f'- 可改文件: {editable_scope}')\n"
201
+ " benchmark_lines_en.append(f'- editable files: {editable_scope}')\n"
202
+ "if protected_scope:\n"
203
+ " benchmark_lines_zh.append(f'- 保护文件: {protected_scope}')\n"
204
+ " benchmark_lines_en.append(f'- protected files: {protected_scope}')\n"
205
+ "if dev_eval_command:\n"
206
+ " benchmark_lines_zh.append(f'- dev 验证: `{dev_eval_command}`')\n"
207
+ " benchmark_lines_en.append(f'- dev eval: `{dev_eval_command}`')\n"
208
+ "if holdout_eval_command:\n"
209
+ " benchmark_lines_zh.append(f'- held-out 验证: `{holdout_eval_command}`')\n"
210
+ " benchmark_lines_en.append(f'- held-out eval: `{holdout_eval_command}`')\n"
211
+ "continuation_lines_zh = []\n"
212
+ "continuation_lines_en = []\n"
213
+ "if continuation_line:\n"
214
+ " continuation_lines_zh.append(f'- 续轮规则: {continuation_line}')\n"
215
+ " continuation_lines_en.append(f'- continuation rule: {continuation_line}')\n"
216
+ "if visible_artifact:\n"
217
+ " first_step_lines_zh = [f'- 首轮动作: {item}' for item in visible_first_steps[:6]]\n"
218
+ " first_step_lines_en = [f'- first move: {item}' for item in visible_first_steps[:6]]\n"
219
+ " if language == 'zh':\n"
220
+ " visible_lines = [\n"
221
+ " '请用中文继续这个 LoopX auto-research pane。',\n"
222
+ " f'- 角色: {compact(profile.get(\"role_id\") or os.environ.get(\"LOOPX_ROLE_ID\"), default=\"unknown\")}',\n"
223
+ " f'- 研究问题: {open_question or \"未提供\"}',\n"
224
+ " f'- Preset: {compact(preset_context.get(\"preset_id\"), default=\"none\")} / metric={compact(preset_context.get(\"metric_name\"), default=\"none\")} / baseline={compact(preset_context.get(\"baseline_metric\"), default=\"none\")}',\n"
225
+ " f'- 当前 frontier: {frontier_text_zh}',\n"
226
+ " *benchmark_lines_zh,\n"
227
+ " *first_step_lines_zh,\n"
228
+ " *continuation_lines_zh,\n"
229
+ " '- 先运行 `$LOOPX_PANE_A2A_TICK` 一次读取本 pane 的 quota/frontier;tick 是 guard/status,不会替你生成研究结论。',\n"
230
+ " '- 若 tick 没有选中 todo,不要关闭 todo 或自行记录 gap;先用 `$LOOPX_PANE_LOOPX todo list --goal-id \"$LOOPX_GOAL_ID\"` 确认本角色是否在等待 resume gate。只有发现未 gate 的本角色 open todo 时,才继续执行上面的首轮动作;不要一上来 diagnose。',\n"
231
+ " '- tick 只读取 LoopX state;不要把 tick 产物当作研究证明。',\n"
232
+ " '- 如果 tick 显示 no_worker_command_configured 或 manual_research_required,请按本角色亲自研究并写 public-safe evidence/todo,不要把 tick 完成当作研究完成。',\n"
233
+ " '- 如果你完成了当前 selected todo 的真实动作,请用 LoopX todo/evidence 命令写回并完成该 todo;下游 resume gate 依赖 todo_done 状态进入下一轮。',\n"
234
+ " '- 完成真实研究动作后用 3-5 行中文说明:产出了什么证据、下一步能否自动做、是否需要用户 gate。',\n"
235
+ " '- 需要细节时再读取 $LOOPX_CODEX_FULL_BOOTSTRAP_ARTIFACT 和 $LOOPX_PANE_TICK_SUMMARY;不要把完整 bootstrap 合约当作用户首屏复述。',\n"
236
+ " ]\n"
237
+ " else:\n"
238
+ " visible_lines = [\n"
239
+ " 'Continue this LoopX auto-research pane.',\n"
240
+ " f'- role: {compact(profile.get(\"role_id\") or os.environ.get(\"LOOPX_ROLE_ID\"), default=\"unknown\")}',\n"
241
+ " f'- open question: {open_question or \"not provided\"}',\n"
242
+ " f'- preset: {compact(preset_context.get(\"preset_id\"), default=\"none\")} / metric={compact(preset_context.get(\"metric_name\"), default=\"none\")} / baseline={compact(preset_context.get(\"baseline_metric\"), default=\"none\")}',\n"
243
+ " f'- current frontier: {frontier_text_en}',\n"
244
+ " *benchmark_lines_en,\n"
245
+ " *first_step_lines_en,\n"
246
+ " *continuation_lines_en,\n"
247
+ " '- Run `$LOOPX_PANE_A2A_TICK` once to read this pane quota/frontier; the tick is guard/status and does not generate research conclusions for you.',\n"
248
+ " '- If the tick has no selected todo, do not close a todo or record a gap by yourself; first use `$LOOPX_PANE_LOOPX todo list --goal-id \"$LOOPX_GOAL_ID\"` to check whether this role is waiting on a resume gate. Continue with the first move above only when you find an ungated open todo for this role, and do not start with diagnose.',\n"
249
+ " '- The tick only reads LoopX state; do not treat tick output as research proof.',\n"
250
+ " '- If the tick reports no_worker_command_configured or manual_research_required, perform this role research yourself and write public-safe evidence/todos; do not treat tick completion as research completion.',\n"
251
+ " '- If you complete the real work for the current selected todo, write back through LoopX todo/evidence commands and complete that todo; downstream resume gates rely on todo_done to enter the next round.',\n"
252
+ " '- After real research work, reply with a compact 3-5 line progress/status summary: evidence produced, what can run next, and whether a user gate is needed.',\n"
253
+ " '- Read $LOOPX_CODEX_FULL_BOOTSTRAP_ARTIFACT and $LOOPX_PANE_TICK_SUMMARY only when details are needed; do not replay the full bootstrap contract as the first screen.',\n"
254
+ " ]\n"
255
+ " visible_artifact.write_text('\\n'.join(visible_lines).strip() + '\\n', encoding='utf-8')\n",
256
+ encoding="utf-8",
257
+ )
258
+ prompt_target.chmod(0o700)
259
+
260
+ tick_target = bin_dir / "loopx-pane-a2a-tick"
261
+ tick_target.write_text(
262
+ "#!/usr/bin/env python3\n"
263
+ "import json, os, shlex, subprocess, sys\n"
264
+ "from pathlib import Path\n"
265
+ "loopx = os.environ.get('LOOPX_PANE_LOOPX') or str(Path(os.environ.get('LOOPX_PROJECT', '.')) / '.local' / 'bin' / 'loopx')\n"
266
+ "goal = os.environ.get('LOOPX_GOAL_ID', '').strip()\n"
267
+ "agent = os.environ.get('LOOPX_AGENT_ID', '').strip()\n"
268
+ "role = os.environ.get('LOOPX_ROLE_ID', '').strip() or os.environ.get('LOOPX_LANE_ID', '').strip() or agent\n"
269
+ "artifact_dir = Path(os.environ.get('LOOPX_PANE_ARTIFACT_DIR') or Path(os.environ.get('LOOPX_PROJECT', '.')) / '.local' / 'pane-artifacts' / (role or agent or 'lane'))\n"
270
+ "artifact_dir.mkdir(parents=True, exist_ok=True)\n"
271
+ "status_artifact = artifact_dir / 'pane-a2a-status.public.json'\n"
272
+ "check_records = []\n"
273
+ "def write_status_summary(*, ok, status, worker_label=None, worker_configured=False):\n"
274
+ " payload = {\n"
275
+ " 'ok': bool(ok),\n"
276
+ " 'schema_version': 'pane_local_a2a_status_check_v0',\n"
277
+ " 'source': 'pane_local_a2a_status_check',\n"
278
+ " 'goal_id': goal,\n"
279
+ " 'agent_id': agent,\n"
280
+ " 'role_id': role,\n"
281
+ " 'coordination_model': 'decentralized_state_a2a',\n"
282
+ " 'workflow_driver': False,\n"
283
+ " 'status': status,\n"
284
+ " 'status_check_count': len(check_records),\n"
285
+ " 'worker_label': worker_label,\n"
286
+ " 'worker_configured': bool(worker_configured),\n"
287
+ " 'counts_as_research_round': False,\n"
288
+ " 'checks': check_records,\n"
289
+ " 'public_boundary': {\n"
290
+ " 'raw_logs_recorded': False,\n"
291
+ " 'private_artifacts_recorded': False,\n"
292
+ " 'absolute_paths_recorded': False,\n"
293
+ " 'credentials_recorded': False,\n"
294
+ " 'local_workspace_path_redacted': True,\n"
295
+ " },\n"
296
+ " }\n"
297
+ " status_artifact.write_text(json.dumps(payload, indent=2, sort_keys=True) + '\\n', encoding='utf-8')\n"
298
+ "if not goal or not agent:\n"
299
+ " print('\\n[LoopX pane A2A]\\nmissing LOOPX_GOAL_ID or LOOPX_AGENT_ID; cannot read role-local frontier.\\n', flush=True)\n"
300
+ " write_status_summary(ok=False, status='missing_goal_or_agent')\n"
301
+ " raise SystemExit(2)\n"
302
+ "def run(args):\n"
303
+ " print('\\n[LoopX pane A2A] ' + ' '.join(shlex.quote(str(arg)) for arg in args), flush=True)\n"
304
+ " return subprocess.call([str(arg) for arg in args])\n"
305
+ "def parse_worker_payload(text):\n"
306
+ " if not text:\n"
307
+ " return {}\n"
308
+ " try:\n"
309
+ " payload = json.loads(text)\n"
310
+ " return payload if isinstance(payload, dict) else {}\n"
311
+ " except Exception:\n"
312
+ " pass\n"
313
+ " start = text.find('{')\n"
314
+ " end = text.rfind('}')\n"
315
+ " if start >= 0 and end > start:\n"
316
+ " try:\n"
317
+ " payload = json.loads(text[start:end + 1])\n"
318
+ " return payload if isinstance(payload, dict) else {}\n"
319
+ " except Exception:\n"
320
+ " return {}\n"
321
+ " return {}\n"
322
+ "def attach_worker_payload(check_record, payload):\n"
323
+ " if not payload:\n"
324
+ " return\n"
325
+ " evaluation = payload.get('evaluation_summary') if isinstance(payload.get('evaluation_summary'), dict) else {}\n"
326
+ " live = payload.get('live_evidence') if isinstance(payload.get('live_evidence'), dict) else {}\n"
327
+ " for key in ('selected_todo_id', 'selected_action', 'role_id', 'dev_metric', 'holdout_metric'):\n"
328
+ " if payload.get(key) is not None:\n"
329
+ " check_record[key] = payload.get(key)\n"
330
+ " append = payload.get('append') if isinstance(payload.get('append'), dict) else {}\n"
331
+ " if append.get('appended_count') is not None:\n"
332
+ " check_record['appended_count'] = append.get('appended_count')\n"
333
+ " if payload.get('successor_todos'):\n"
334
+ " check_record['successor_todo_declared'] = True\n"
335
+ " if evaluation.get('claim_allowed') is not None:\n"
336
+ " check_record['claim_allowed'] = bool(evaluation.get('claim_allowed'))\n"
337
+ " if evaluation.get('holdout_improvement_count') is not None:\n"
338
+ " check_record['holdout_improvement_count'] = evaluation.get('holdout_improvement_count')\n"
339
+ " if live.get('written') is not None:\n"
340
+ " check_record['live_evidence_written'] = bool(live.get('written'))\n"
341
+ "print(f'\\n[LoopX pane A2A] role={role} agent={agent}\\n', flush=True)\n"
342
+ "turn = os.environ.get('LOOPX_PANE_WORKER_TURN', '').strip()\n"
343
+ "loop = os.environ.get('LOOPX_PANE_WORKER_LOOP', '').strip()\n"
344
+ "command = turn or loop\n"
345
+ "if not command:\n"
346
+ " status = run([loopx, '--format', 'markdown', 'quota', 'should-run', '--goal-id', goal, '--agent-id', agent])\n"
347
+ " frontier_status = None\n"
348
+ " if status == 0:\n"
349
+ " frontier_status = run([loopx, '--format', 'markdown', 'auto-research', 'frontier', '--goal-id', goal, '--agent-id', agent])\n"
350
+ " check_records.append({'check_index': 1, 'quota_status': status, 'frontier_status': frontier_status, 'worker_configured': False, 'worker_executed': False, 'worker_status': None})\n"
351
+ " ok = status == 0 and frontier_status == 0\n"
352
+ " write_status_summary(ok=ok, status='no_worker_command_configured' if ok else 'frontier_failed' if status == 0 else 'quota_failed')\n"
353
+ " if status != 0:\n"
354
+ " raise SystemExit(status)\n"
355
+ " if frontier_status != 0:\n"
356
+ " raise SystemExit(frontier_status)\n"
357
+ " print('\\n[LoopX pane A2A]\\nNo automated worker-turn is configured. Use the quota/frontier above and your role profile to do real visible research, then write public-safe evidence/todos with $LOOPX_PANE_LOOPX. Do not treat this tick as research completion.\\n', flush=True)\n"
358
+ " raise SystemExit(0)\n"
359
+ "label = 'worker-turn' if turn else 'worker-loop'\n"
360
+ "status = run([loopx, '--format', 'markdown', 'quota', 'should-run', '--goal-id', goal, '--agent-id', agent])\n"
361
+ "check_record = {'check_index': 1, 'quota_status': status, 'worker_label': label, 'worker_configured': True, 'worker_executed': False, 'worker_status': None}\n"
362
+ "check_records.append(check_record)\n"
363
+ "if status != 0:\n"
364
+ " write_status_summary(ok=False, status='quota_failed', worker_label=label, worker_configured=True)\n"
365
+ " raise SystemExit(status)\n"
366
+ "print(f'\\n[LoopX pane A2A {label}]\\n{command}\\n', flush=True)\n"
367
+ "worker_env = os.environ.copy()\n"
368
+ "worker_env['LOOPX_MACHINE_JSON'] = '1'\n"
369
+ "worker = subprocess.run(command, shell=True, executable=os.environ.get('SHELL') or '/bin/bash', capture_output=True, text=True, env=worker_env)\n"
370
+ "if worker.stdout:\n"
371
+ " print(worker.stdout, end='' if worker.stdout.endswith('\\n') else '\\n', flush=True)\n"
372
+ "if worker.stderr:\n"
373
+ " print(worker.stderr, end='' if worker.stderr.endswith('\\n') else '\\n', file=sys.stderr, flush=True)\n"
374
+ "result = worker.returncode\n"
375
+ "check_record['worker_executed'] = True\n"
376
+ "check_record['worker_status'] = result\n"
377
+ "attach_worker_payload(check_record, parse_worker_payload(worker.stdout))\n"
378
+ "write_status_summary(ok=result == 0, status='completed' if result == 0 else 'worker_failed', worker_label=label, worker_configured=True)\n"
379
+ "if result != 0:\n"
380
+ " raise SystemExit(result)\n"
381
+ "raise SystemExit(0)\n",
382
+ encoding="utf-8",
383
+ )
384
+ tick_target.chmod(0o700)
385
+ """
386
+
387
+
388
+ CODEX_TUI_EXEC_PY = r"""
389
+ import json
390
+ import os
391
+ import subprocess
392
+ from pathlib import Path
393
+
394
+ codex = os.environ["LOOPX_CODEX_BIN"]
395
+ project = os.environ["LOOPX_PROJECT"]
396
+ reasoning_effort = os.environ["LOOPX_CODEX_REASONING_EFFORT"]
397
+
398
+ args = [codex]
399
+ if os.environ.get("LOOPX_CODEX_TRUST_WORKSPACE") == "1":
400
+ candidates = [project, os.path.realpath(project)]
401
+ git_root = subprocess.run(
402
+ ["git", "-C", project, "rev-parse", "--show-toplevel"],
403
+ check=False,
404
+ capture_output=True,
405
+ text=True,
406
+ ).stdout.strip()
407
+ if git_root:
408
+ candidates.extend([git_root, os.path.realpath(git_root)])
409
+ seen = set()
410
+ for path in candidates:
411
+ if not path or path in seen:
412
+ continue
413
+ seen.add(path)
414
+ args.extend(["-c", f"projects.{json.dumps(path)}.trust_level=\"trusted\""])
415
+
416
+ args.extend(["-c", f"model_reasoning_effort={reasoning_effort}", "-C", project])
417
+ prompt_path = os.environ.get("LOOPX_CODEX_TUI_PROMPT_ARTIFACT")
418
+ if prompt_path and os.environ.get("LOOPX_CODEX_INITIAL_PROMPT_ENABLED", "1") != "0":
419
+ try:
420
+ prompt = Path(prompt_path).read_text(encoding="utf-8").strip()
421
+ except Exception:
422
+ prompt = ""
423
+ if prompt:
424
+ args.append(prompt)
425
+ os.execvp(codex, args)
426
+ """
@@ -0,0 +1,149 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from collections.abc import Callable, Iterable
5
+ from dataclasses import dataclass
6
+ from pathlib import Path
7
+ from typing import Optional, Tuple
8
+
9
+ from loopx.visible_multi_agent_launcher import wake_visible_multi_agent_panes
10
+
11
+
12
+ @dataclass(frozen=True)
13
+ class VisibleLaunchPolicy:
14
+ """Generic visible-launch decisions shared by product presets."""
15
+
16
+ launch_visible: bool
17
+ wake_visible_after_launch: bool
18
+ attach: bool
19
+
20
+
21
+ VisibleLauncherCallback = Callable[[dict[str, object], Path, Optional[str], Path], dict[str, object]]
22
+ VisibleLaunchExecutor = Callable[..., dict[str, object]]
23
+ VisibleWorkspacePolicy = Callable[[Path], Tuple[Optional[str], bool, bool]]
24
+
25
+
26
+ def resolve_visible_launch_policy(
27
+ args: argparse.Namespace,
28
+ *,
29
+ launch_visible: bool,
30
+ default_wake_allowed: bool,
31
+ default_attach_allowed: bool,
32
+ attach_wake_conflict_message: str | None = None,
33
+ ) -> VisibleLaunchPolicy:
34
+ """Resolve attach/wake policy without product-specific runner logic."""
35
+
36
+ no_attach = bool(getattr(args, "no_attach", False))
37
+ attach_requested = bool(getattr(args, "attach", False))
38
+ if no_attach and attach_requested:
39
+ raise ValueError("--attach cannot be combined with --no-attach")
40
+
41
+ wake_setting = getattr(args, "wake_visible_after_launch", None)
42
+ if wake_setting is True and attach_requested:
43
+ raise ValueError(
44
+ attach_wake_conflict_message
45
+ or "--attach cannot be combined with --wake-visible-after-launch"
46
+ )
47
+
48
+ wake = False
49
+ if launch_visible:
50
+ if wake_setting is True:
51
+ wake = True
52
+ elif default_wake_allowed:
53
+ wake = bool(wake_setting is not False and not attach_requested)
54
+
55
+ attach = bool(
56
+ attach_requested
57
+ or (
58
+ launch_visible
59
+ and default_attach_allowed
60
+ and not no_attach
61
+ and not wake
62
+ )
63
+ )
64
+ return VisibleLaunchPolicy(
65
+ launch_visible=bool(launch_visible),
66
+ wake_visible_after_launch=wake,
67
+ attach=attach,
68
+ )
69
+
70
+
71
+ def resolve_codex_trust_workspace(
72
+ args: argparse.Namespace,
73
+ *,
74
+ launch_visible: bool,
75
+ default: bool,
76
+ ) -> bool:
77
+ """Resolve the optional Codex workspace trust default for visible launches."""
78
+
79
+ if not launch_visible:
80
+ return False
81
+ trust_setting = getattr(args, "codex_trust_workspace", None)
82
+ if trust_setting is None:
83
+ return bool(default)
84
+ return bool(trust_setting)
85
+
86
+
87
+ def make_visible_launcher_callback(
88
+ *,
89
+ launch_visible: bool,
90
+ launch_executor: VisibleLaunchExecutor,
91
+ launcher: str,
92
+ tmux_bin: str,
93
+ cli_bin: str,
94
+ codex_bin: str,
95
+ attach: bool,
96
+ replace_existing: bool,
97
+ workspace_policy: VisibleWorkspacePolicy,
98
+ auto_wake: bool = False,
99
+ auto_wake_interval_seconds: float = 45.0,
100
+ ) -> VisibleLauncherCallback | None:
101
+ """Create the generic callback shape expected by visible demo runners."""
102
+
103
+ if not launch_visible:
104
+ return None
105
+
106
+ def visible_launcher(
107
+ payload: dict[str, object],
108
+ registry_path: Path,
109
+ runtime_root_arg: str | None,
110
+ default_workspace: Path,
111
+ ) -> dict[str, object]:
112
+ workspace, create_workspace, codex_trust_workspace = workspace_policy(
113
+ default_workspace
114
+ )
115
+ return launch_executor(
116
+ payload,
117
+ registry_path=registry_path,
118
+ runtime_root_arg=runtime_root_arg,
119
+ launcher=launcher,
120
+ tmux_bin=tmux_bin,
121
+ cli_bin=cli_bin,
122
+ codex_bin=codex_bin,
123
+ attach=attach,
124
+ replace_existing=replace_existing,
125
+ workspace=workspace,
126
+ create_workspace=create_workspace,
127
+ codex_trust_workspace=codex_trust_workspace,
128
+ auto_wake=auto_wake,
129
+ auto_wake_interval_seconds=auto_wake_interval_seconds,
130
+ )
131
+
132
+ return visible_launcher
133
+
134
+
135
+ def make_visible_wake_callback(
136
+ *,
137
+ tmux_bin: str,
138
+ ) -> Callable[[str, list[str]], dict[str, object]]:
139
+ """Return a pane-local A2A wake callback for visible launcher integrations."""
140
+
141
+ def visible_wake(session: str, lanes: Iterable[str]) -> dict[str, object]:
142
+ return wake_visible_multi_agent_panes(
143
+ session_name=session,
144
+ tmux_bin=tmux_bin,
145
+ lanes=lanes,
146
+ execute=True,
147
+ )
148
+
149
+ return visible_wake