@team-agent/installer 0.5.128 → 0.6.1

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 (436) hide show
  1. package/README.md +4 -4
  2. package/README.zh.md +1 -1
  3. package/package.json +4 -8
  4. package/skills/team-agent/SKILL.md +37 -20
  5. package/skills/team-agent/command-coverage.json +169 -183
  6. package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
  7. package/skills/team-agent/references/recovery-runbook.md +1 -1
  8. package/skills/team-agent/references/team-agent-operator.md +64 -30
  9. package/templates/team_state.md +1 -1
  10. package/Cargo.lock +0 -1063
  11. package/Cargo.toml +0 -36
  12. package/crates/team-agent/Cargo.toml +0 -69
  13. package/crates/team-agent/src/app_server_test_support.rs +0 -258
  14. package/crates/team-agent/src/cli/adapters.rs +0 -1288
  15. package/crates/team-agent/src/cli/arguments.rs +0 -405
  16. package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
  17. package/crates/team-agent/src/cli/diagnose.rs +0 -1721
  18. package/crates/team-agent/src/cli/emit.rs +0 -2930
  19. package/crates/team-agent/src/cli/grok_slot.rs +0 -384
  20. package/crates/team-agent/src/cli/helpers.rs +0 -91
  21. package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
  22. package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
  23. package/crates/team-agent/src/cli/intent/tests.rs +0 -689
  24. package/crates/team-agent/src/cli/intent.rs +0 -664
  25. package/crates/team-agent/src/cli/leader.rs +0 -300
  26. package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
  27. package/crates/team-agent/src/cli/leaders.rs +0 -418
  28. package/crates/team-agent/src/cli/mod.rs +0 -6545
  29. package/crates/team-agent/src/cli/models.rs +0 -1206
  30. package/crates/team-agent/src/cli/named_address.rs +0 -1651
  31. package/crates/team-agent/src/cli/profile.rs +0 -342
  32. package/crates/team-agent/src/cli/route.rs +0 -212
  33. package/crates/team-agent/src/cli/schedule.rs +0 -175
  34. package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
  35. package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
  36. package/crates/team-agent/src/cli/send/persist.rs +0 -156
  37. package/crates/team-agent/src/cli/send/presentation.rs +0 -370
  38. package/crates/team-agent/src/cli/send/resolve.rs +0 -573
  39. package/crates/team-agent/src/cli/send.rs +0 -199
  40. package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
  41. package/crates/team-agent/src/cli/spec.rs +0 -165
  42. package/crates/team-agent/src/cli/status.rs +0 -280
  43. package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
  44. package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
  45. package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
  46. package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
  47. package/crates/team-agent/src/cli/status_port/format.rs +0 -146
  48. package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
  49. package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
  50. package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
  51. package/crates/team-agent/src/cli/status_port/store.rs +0 -416
  52. package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
  53. package/crates/team-agent/src/cli/status_port.rs +0 -92
  54. package/crates/team-agent/src/cli/tests/base.rs +0 -885
  55. package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
  56. package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
  57. package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
  58. package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
  59. package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
  60. package/crates/team-agent/src/cli/tests/mod.rs +0 -137
  61. package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
  62. package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
  63. package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
  64. package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
  65. package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
  66. package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
  67. package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
  68. package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
  69. package/crates/team-agent/src/cli/triage.rs +0 -234
  70. package/crates/team-agent/src/cli/types.rs +0 -591
  71. package/crates/team-agent/src/codex_app_server.rs +0 -546
  72. package/crates/team-agent/src/communication_mode/mod.rs +0 -56
  73. package/crates/team-agent/src/compiler/tests.rs +0 -827
  74. package/crates/team-agent/src/compiler.rs +0 -890
  75. package/crates/team-agent/src/conpty/backend.rs +0 -829
  76. package/crates/team-agent/src/conpty/mod.rs +0 -33
  77. package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
  78. package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
  79. package/crates/team-agent/src/contract_runtime/config.rs +0 -364
  80. package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
  81. package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
  82. package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
  83. package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
  84. package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
  85. package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
  86. package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
  87. package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
  88. package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
  89. package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
  90. package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
  91. package/crates/team-agent/src/coordinator/backoff.rs +0 -741
  92. package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
  93. package/crates/team-agent/src/coordinator/health.rs +0 -1185
  94. package/crates/team-agent/src/coordinator/mod.rs +0 -119
  95. package/crates/team-agent/src/coordinator/orphan.rs +0 -110
  96. package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
  97. package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
  98. package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
  99. package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
  100. package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
  101. package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
  102. package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
  103. package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
  104. package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
  105. package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
  106. package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
  107. package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
  108. package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
  109. package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
  110. package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
  111. package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
  112. package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
  113. package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
  114. package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
  115. package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
  116. package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
  117. package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
  118. package/crates/team-agent/src/coordinator/tick.rs +0 -3024
  119. package/crates/team-agent/src/coordinator/types.rs +0 -540
  120. package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
  121. package/crates/team-agent/src/db/message_store.rs +0 -1527
  122. package/crates/team-agent/src/db/migration.rs +0 -984
  123. package/crates/team-agent/src/db/mod.rs +0 -26
  124. package/crates/team-agent/src/db/schema.rs +0 -663
  125. package/crates/team-agent/src/diagnose/comms.rs +0 -242
  126. package/crates/team-agent/src/diagnose/mod.rs +0 -44
  127. package/crates/team-agent/src/diagnose/orphans.rs +0 -889
  128. package/crates/team-agent/src/direct_delivery.rs +0 -368
  129. package/crates/team-agent/src/event_log.rs +0 -502
  130. package/crates/team-agent/src/fake_worker.rs +0 -303
  131. package/crates/team-agent/src/inbox_store.rs +0 -169
  132. package/crates/team-agent/src/kill_audit.rs +0 -106
  133. package/crates/team-agent/src/layout/manager.rs +0 -248
  134. package/crates/team-agent/src/layout/mod.rs +0 -36
  135. package/crates/team-agent/src/layout/overlay.rs +0 -134
  136. package/crates/team-agent/src/layout/placement.rs +0 -52
  137. package/crates/team-agent/src/layout/recovery.rs +0 -106
  138. package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
  139. package/crates/team-agent/src/layout/sessions.rs +0 -294
  140. package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
  141. package/crates/team-agent/src/layout/worker_env.rs +0 -721
  142. package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
  143. package/crates/team-agent/src/leader/helpers.rs +0 -178
  144. package/crates/team-agent/src/leader/incident.rs +0 -6
  145. package/crates/team-agent/src/leader/lease.rs +0 -3356
  146. package/crates/team-agent/src/leader/mod.rs +0 -104
  147. package/crates/team-agent/src/leader/owner_bind.rs +0 -400
  148. package/crates/team-agent/src/leader/prompt.rs +0 -905
  149. package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
  150. package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
  151. package/crates/team-agent/src/leader/rediscover.rs +0 -1192
  152. package/crates/team-agent/src/leader/registry.rs +0 -888
  153. package/crates/team-agent/src/leader/start.rs +0 -4501
  154. package/crates/team-agent/src/leader/takeover.rs +0 -65
  155. package/crates/team-agent/src/leader/tests/basics.rs +0 -337
  156. package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
  157. package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
  158. package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
  159. package/crates/team-agent/src/leader/tests/identity.rs +0 -465
  160. package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
  161. package/crates/team-agent/src/leader/tests/idle.rs +0 -113
  162. package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
  163. package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
  164. package/crates/team-agent/src/leader/tests/mod.rs +0 -106
  165. package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
  166. package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
  167. package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
  168. package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
  169. package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
  170. package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
  171. package/crates/team-agent/src/leader/types.rs +0 -534
  172. package/crates/team-agent/src/lib.rs +0 -147
  173. package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
  174. package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
  175. package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
  176. package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
  177. package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
  178. package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
  179. package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
  180. package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
  181. package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
  182. package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
  183. package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
  184. package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
  185. package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
  186. package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
  187. package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
  188. package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
  189. package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
  190. package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
  191. package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
  192. package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
  193. package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
  194. package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
  195. package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
  196. package/crates/team-agent/src/lifecycle/launch.rs +0 -557
  197. package/crates/team-agent/src/lifecycle/lock.rs +0 -350
  198. package/crates/team-agent/src/lifecycle/mod.rs +0 -79
  199. package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
  200. package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
  201. package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
  202. package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
  203. package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
  204. package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
  205. package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
  206. package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
  207. package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
  208. package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
  209. package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
  210. package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
  211. package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
  212. package/crates/team-agent/src/lifecycle/restart.rs +0 -227
  213. package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
  214. package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
  215. package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
  216. package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
  217. package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
  218. package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
  219. package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
  220. package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
  221. package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
  222. package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
  223. package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
  224. package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
  225. package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
  226. package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
  227. package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
  228. package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
  229. package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
  230. package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
  231. package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
  232. package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
  233. package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
  234. package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
  235. package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
  236. package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
  237. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
  238. package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
  239. package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
  240. package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
  241. package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
  242. package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
  243. package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
  244. package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
  245. package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
  246. package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
  247. package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
  248. package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
  249. package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
  250. package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
  251. package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
  252. package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
  253. package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
  254. package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
  255. package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
  256. package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
  257. package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
  258. package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
  259. package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
  260. package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
  261. package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
  262. package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
  263. package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
  264. package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
  265. package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
  266. package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
  267. package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
  268. package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
  269. package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
  270. package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
  271. package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
  272. package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
  273. package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
  274. package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
  275. package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
  276. package/crates/team-agent/src/lifecycle/tests.rs +0 -105
  277. package/crates/team-agent/src/lifecycle/types.rs +0 -877
  278. package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
  279. package/crates/team-agent/src/main.rs +0 -52
  280. package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
  281. package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
  282. package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
  283. package/crates/team-agent/src/mcp_server/mod.rs +0 -119
  284. package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
  285. package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
  286. package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
  287. package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
  288. package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
  289. package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
  290. package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
  291. package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
  292. package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
  293. package/crates/team-agent/src/mcp_server/tests.rs +0 -43
  294. package/crates/team-agent/src/mcp_server/tools.rs +0 -889
  295. package/crates/team-agent/src/mcp_server/types.rs +0 -396
  296. package/crates/team-agent/src/mcp_server/wire.rs +0 -867
  297. package/crates/team-agent/src/messaging/activity.rs +0 -461
  298. package/crates/team-agent/src/messaging/address.rs +0 -87
  299. package/crates/team-agent/src/messaging/delivery.rs +0 -3727
  300. package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
  301. package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
  302. package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
  303. package/crates/team-agent/src/messaging/helpers.rs +0 -336
  304. package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
  305. package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
  306. package/crates/team-agent/src/messaging/mod.rs +0 -167
  307. package/crates/team-agent/src/messaging/persist.rs +0 -377
  308. package/crates/team-agent/src/messaging/presentation.rs +0 -417
  309. package/crates/team-agent/src/messaging/reminders.rs +0 -316
  310. package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
  311. package/crates/team-agent/src/messaging/results.rs +0 -1415
  312. package/crates/team-agent/src/messaging/scheduler.rs +0 -223
  313. package/crates/team-agent/src/messaging/selftest.rs +0 -315
  314. package/crates/team-agent/src/messaging/send.rs +0 -981
  315. package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
  316. package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
  317. package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
  318. package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
  319. package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
  320. package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
  321. package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
  322. package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
  323. package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
  324. package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
  325. package/crates/team-agent/src/messaging/trust.rs +0 -215
  326. package/crates/team-agent/src/messaging/types.rs +0 -472
  327. package/crates/team-agent/src/messaging/wait.rs +0 -366
  328. package/crates/team-agent/src/messaging/watchers.rs +0 -916
  329. package/crates/team-agent/src/model/enums.rs +0 -356
  330. package/crates/team-agent/src/model/errors.rs +0 -18
  331. package/crates/team-agent/src/model/ids.rs +0 -165
  332. package/crates/team-agent/src/model/mod.rs +0 -29
  333. package/crates/team-agent/src/model/name_similarity.rs +0 -252
  334. package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
  335. package/crates/team-agent/src/model/paths.rs +0 -257
  336. package/crates/team-agent/src/model/routing.rs +0 -387
  337. package/crates/team-agent/src/model/spec.rs +0 -1184
  338. package/crates/team-agent/src/model/task_graph.rs +0 -321
  339. package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
  340. package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
  341. package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
  342. package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
  343. package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
  344. package/crates/team-agent/src/model/yaml/tests.rs +0 -188
  345. package/crates/team-agent/src/model/yaml.rs +0 -802
  346. package/crates/team-agent/src/os_probe.rs +0 -280
  347. package/crates/team-agent/src/packaging/install.rs +0 -219
  348. package/crates/team-agent/src/packaging/migrate.rs +0 -38
  349. package/crates/team-agent/src/packaging/mod.rs +0 -91
  350. package/crates/team-agent/src/packaging/repair.rs +0 -33
  351. package/crates/team-agent/src/packaging/tests.rs +0 -822
  352. package/crates/team-agent/src/packaging/types.rs +0 -417
  353. package/crates/team-agent/src/platform/argv.rs +0 -331
  354. package/crates/team-agent/src/platform/errors.rs +0 -104
  355. package/crates/team-agent/src/platform/file_lock.rs +0 -279
  356. package/crates/team-agent/src/platform/mod.rs +0 -5
  357. package/crates/team-agent/src/platform/process.rs +0 -545
  358. package/crates/team-agent/src/provider/adapter.rs +0 -1150
  359. package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
  360. package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
  361. package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
  362. package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
  363. package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
  364. package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
  365. package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
  366. package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
  367. package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
  368. package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
  369. package/crates/team-agent/src/provider/argv_route.rs +0 -405
  370. package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
  371. package/crates/team-agent/src/provider/classify.rs +0 -708
  372. package/crates/team-agent/src/provider/command_helpers.rs +0 -45
  373. package/crates/team-agent/src/provider/faults.rs +0 -165
  374. package/crates/team-agent/src/provider/helpers.rs +0 -52
  375. package/crates/team-agent/src/provider/mod.rs +0 -78
  376. package/crates/team-agent/src/provider/model_catalog.rs +0 -910
  377. package/crates/team-agent/src/provider/session/capture.rs +0 -2731
  378. package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
  379. package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
  380. package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
  381. package/crates/team-agent/src/provider/session/mod.rs +0 -36
  382. package/crates/team-agent/src/provider/session/resume.rs +0 -269
  383. package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
  384. package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
  385. package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
  386. package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
  387. package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
  388. package/crates/team-agent/src/provider/session_scan.rs +0 -71
  389. package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
  390. package/crates/team-agent/src/provider/submit_now.rs +0 -71
  391. package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
  392. package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
  393. package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
  394. package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
  395. package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
  396. package/crates/team-agent/src/provider/tests/classify.rs +0 -148
  397. package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
  398. package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
  399. package/crates/team-agent/src/provider/tests/faults.rs +0 -200
  400. package/crates/team-agent/src/provider/tests/idle.rs +0 -177
  401. package/crates/team-agent/src/provider/tests/wire.rs +0 -213
  402. package/crates/team-agent/src/provider/tests.rs +0 -32
  403. package/crates/team-agent/src/provider/types.rs +0 -529
  404. package/crates/team-agent/src/provider/wire.rs +0 -394
  405. package/crates/team-agent/src/redaction.rs +0 -259
  406. package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
  407. package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
  408. package/crates/team-agent/src/state/identity.rs +0 -914
  409. package/crates/team-agent/src/state/identity_keys.rs +0 -132
  410. package/crates/team-agent/src/state/mod.rs +0 -74
  411. package/crates/team-agent/src/state/owner_gate.rs +0 -482
  412. package/crates/team-agent/src/state/ownership.rs +0 -563
  413. package/crates/team-agent/src/state/paths.rs +0 -395
  414. package/crates/team-agent/src/state/persist.rs +0 -3811
  415. package/crates/team-agent/src/state/projection.rs +0 -1508
  416. package/crates/team-agent/src/state/repository/intent.rs +0 -14
  417. package/crates/team-agent/src/state/repository/tests.rs +0 -184
  418. package/crates/team-agent/src/state/repository.rs +0 -866
  419. package/crates/team-agent/src/state/selector.rs +0 -160
  420. package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
  421. package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
  422. package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
  423. package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
  424. package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
  425. package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
  426. package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
  427. package/crates/team-agent/src/tmux_backend.rs +0 -4492
  428. package/crates/team-agent/src/topology.rs +0 -537
  429. package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
  430. package/crates/team-agent/src/transport/native_input.rs +0 -491
  431. package/crates/team-agent/src/transport/test_support.rs +0 -743
  432. package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
  433. package/crates/team-agent/src/transport/tests/mod.rs +0 -194
  434. package/crates/team-agent/src/transport/tests/wire.rs +0 -574
  435. package/crates/team-agent/src/transport.rs +0 -1655
  436. package/crates/team-agent/src/transport_factory.rs +0 -819
@@ -1,786 +0,0 @@
1
- //! Real-machine command-file defects, clusters 1-6.
2
- //!
3
- //! These are canonical Team Agent CLI flows from
4
- //! `.team/test-designs/realmachine-product-defects.md`. The harness command files are the contract;
5
- //! if they fail on a real machine, the Rust framework changes rather than weakening the commands.
6
-
7
- #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
8
-
9
- #[path = "../../../tests/support/hermetic.rs"]
10
- mod hermetic_guard;
11
- #[allow(dead_code)]
12
- fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
13
-
14
- use std::collections::{BTreeMap, HashSet};
15
- use std::path::{Path, PathBuf};
16
- use std::process::{Command, Output};
17
- use std::sync::atomic::{AtomicU64, Ordering};
18
- use std::sync::Mutex;
19
-
20
- use serde_json::{json, Value};
21
- use team_agent::lifecycle::{quick_start_with_transport, QuickStartReport};
22
- use team_agent::transport::{
23
- AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
24
- InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, SessionName, SetEnvOutcome,
25
- SpawnResult, SubmitVerification, Target, Transport, TransportError, TurnVerification,
26
- WindowName,
27
- };
28
-
29
- fn bin() -> &'static str {
30
- crate::lifecycle::tests::test_binary_path()
31
- }
32
-
33
- fn tmp_dir(tag: &str) -> PathBuf {
34
- static N: AtomicU64 = AtomicU64::new(0);
35
- let dir = std::env::temp_dir().join(format!(
36
- "ta-rs-rm-c1-c6-{tag}-{}-{}",
37
- std::process::id(),
38
- N.fetch_add(1, Ordering::Relaxed)
39
- ));
40
- let _ = std::fs::remove_dir_all(&dir);
41
- std::fs::create_dir_all(&dir).unwrap();
42
- std::fs::canonicalize(dir).unwrap()
43
- }
44
-
45
- fn run(args: &[&str], cwd: &Path) -> Output {
46
- Command::new(bin())
47
- .args(args)
48
- .current_dir(cwd)
49
- .output()
50
- .unwrap()
51
- }
52
-
53
- fn stdout_json(out: &Output) -> Value {
54
- serde_json::from_slice(&out.stdout).unwrap_or_else(|_| {
55
- panic!(
56
- "stdout must be JSON; code={:?} stdout={} stderr={}",
57
- out.status.code(),
58
- String::from_utf8_lossy(&out.stdout),
59
- String::from_utf8_lossy(&out.stderr)
60
- )
61
- })
62
- }
63
-
64
- // OLD seed: flat top-level `agents` / `tasks` (Python parity, pre-Bug-1/2).
65
- // NEW seed (Bug 1/2 — team-in-team state scope, see
66
- // tests/team_in_team_state_scope_red.rs): send_message projects the raw state
67
- // through `project_top_level_view(active_team_key)` which sources agents/tasks
68
- // from `teams[<key>].*`. Without the nested copy a single-team send refuses
69
- // `target_not_in_team` BEFORE persistence (no DB schema is ever created → the
70
- // downstream `select count(*) from messages` query in c4 fails with "no such
71
- // table"). The seed is widened to carry BOTH the flat keys (so c1/c2/c5/c6
72
- // helpers that read flat state directly stay working) AND the nested team-scoped
73
- // copy (so the send/persist path resolves `worker_a` as in-team). The behavior
74
- // under test (caller --message-id + dedup) is unchanged; this is fixture-only
75
- // sync to the new state shape.
76
- fn seed_runtime_state(workspace: &Path) {
77
- team_agent::state::persist::save_runtime_state(
78
- workspace,
79
- &json!({
80
- "leader": {"id": "leader"},
81
- "agents": {
82
- "worker_a": {
83
- "provider": "fake",
84
- "role": "Worker A",
85
- "status": "running"
86
- }
87
- },
88
- "tasks": [],
89
- "active_team_key": "current",
90
- "teams": {"current": {
91
- "leader": {"id": "leader"},
92
- "agents": {
93
- "worker_a": {
94
- "provider": "fake",
95
- "role": "Worker A",
96
- "status": "running"
97
- }
98
- },
99
- "tasks": []
100
- }}
101
- }),
102
- )
103
- .unwrap();
104
- }
105
-
106
- #[test]
107
- #[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
108
- fn c1_lifecycle_commands_resolve_active_teamdir_from_root_workspace_selector() {
109
- let fixture = seed_c1_active_team_fixture("c1-lifecycle");
110
- let mut failures = Vec::new();
111
- let role_file = fixture.root.join(".team").join("roles").join("worker_b.md");
112
-
113
- let cases: Vec<(&str, Vec<String>, &[&str])> = vec![
114
- (
115
- "CR-007/021/052 restart",
116
- vec![
117
- "restart".into(),
118
- "--workspace".into(),
119
- fixture.root_str(),
120
- "--json".into(),
121
- ],
122
- &["missing spec for restart", "team.spec.yaml"],
123
- ),
124
- (
125
- "CR-031/055 stop-agent",
126
- vec![
127
- "stop-agent".into(),
128
- "worker_a".into(),
129
- "--workspace".into(),
130
- fixture.root_str(),
131
- "--json".into(),
132
- ],
133
- &["missing spec:", "team.spec.yaml"],
134
- ),
135
- (
136
- "CR-033 reset-agent",
137
- vec![
138
- "reset-agent".into(),
139
- "worker_a".into(),
140
- "--discard-session".into(),
141
- "--workspace".into(),
142
- fixture.root_str(),
143
- "--json".into(),
144
- ],
145
- &["missing spec:", "team.spec.yaml"],
146
- ),
147
- (
148
- "CR-030 add-agent",
149
- vec![
150
- "add-agent".into(),
151
- "worker_b".into(),
152
- "--role-file".into(),
153
- role_file.to_string_lossy().to_string(),
154
- "--workspace".into(),
155
- fixture.root_str(),
156
- "--json".into(),
157
- ],
158
- &["missing TEAM.md", "spec compile failed"],
159
- ),
160
- (
161
- "CR-030 remove-agent",
162
- vec![
163
- "remove-agent".into(),
164
- "worker_a".into(),
165
- "--from-spec".into(),
166
- "--confirm".into(),
167
- "--force".into(),
168
- "--workspace".into(),
169
- fixture.root_str(),
170
- "--json".into(),
171
- ],
172
- &["missing spec:", "team.spec.yaml"],
173
- ),
174
- ];
175
-
176
- for (label, args, forbidden) in cases {
177
- let refs = args.iter().map(String::as_str).collect::<Vec<_>>();
178
- let out = run(&refs, &fixture.root);
179
- let stdout = String::from_utf8_lossy(&out.stdout);
180
- let stderr = String::from_utf8_lossy(&out.stderr);
181
- let combined = format!("{stdout}\n{stderr}");
182
- if out.status.code() != Some(0) || forbidden.iter().any(|needle| combined.contains(needle))
183
- {
184
- failures.push(format!(
185
- "{label}: expected resolve_active_team(root)->teamdir/spec_path, got code={:?} stdout={stdout:?} stderr={stderr:?}",
186
- out.status.code()
187
- ));
188
- }
189
- }
190
- assert!(
191
- failures.is_empty(),
192
- "Cluster 1 resolve_active_team contract: after `quick-start teamdir`, lifecycle commands using --workspace <root> must select state.spec_path/team_dir, not root TEAM.md/team.spec.yaml:\n{}",
193
- failures.join("\n")
194
- );
195
- }
196
-
197
- #[test]
198
- #[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
199
- fn c1_runtime_commands_resolve_active_team_for_status_send_and_collect() {
200
- let fixture = seed_c1_active_team_fixture("c1-runtime");
201
- let mut failures = Vec::new();
202
-
203
- let status = run(
204
- &[
205
- "status",
206
- "--workspace",
207
- fixture.teamdir.to_str().unwrap(),
208
- "--json",
209
- ],
210
- &fixture.root,
211
- );
212
- let status_json = stdout_json(&status);
213
- if status.status.code() != Some(0)
214
- || status_json
215
- .get("agents")
216
- .and_then(Value::as_object)
217
- .is_none_or(|agents| !agents.contains_key("worker_a"))
218
- {
219
- failures.push(format!(
220
- "status should resolve --workspace <teamdir> to the active run workspace/team projection; code={:?} json={status_json}",
221
- status.status.code()
222
- ));
223
- }
224
-
225
- let send = run(
226
- &[
227
- "send",
228
- "worker_a",
229
- "selector ping",
230
- "--workspace",
231
- fixture.teamdir.to_str().unwrap(),
232
- "--json",
233
- ],
234
- &fixture.root,
235
- );
236
- let send_json = stdout_json(&send);
237
- if send.status.code() != Some(0)
238
- || send_json["ok"] != json!(true)
239
- || send_json["reason"] == json!("target_not_in_team")
240
- {
241
- failures.push(format!(
242
- "send should resolve --workspace <teamdir> to the active run workspace and route against worker_a; code={:?} json={send_json}",
243
- send.status.code()
244
- ));
245
- }
246
-
247
- let collect = run(
248
- &[
249
- "collect",
250
- "--workspace",
251
- fixture.teamdir.to_str().unwrap(),
252
- "--json",
253
- ],
254
- &fixture.root,
255
- );
256
- let collect_stdout = String::from_utf8_lossy(&collect.stdout);
257
- let collect_stderr = String::from_utf8_lossy(&collect.stderr);
258
- if collect.status.code() != Some(0)
259
- || collect_stdout.contains("Cannot read")
260
- || collect_stdout.contains("/team.spec.yaml")
261
- {
262
- failures.push(format!(
263
- "collect should reuse resolve_active_team root->teamdir spec selection; code={:?} stdout={collect_stdout:?} stderr={collect_stderr:?}",
264
- collect.status.code()
265
- ));
266
- }
267
-
268
- assert!(
269
- failures.is_empty(),
270
- "Cluster 1 resolve_active_team contract: status/send/collect using --workspace <teamdir> must operate on the active run workspace projection/spec, not an empty teamdir-local runtime:\n{}",
271
- failures.join("\n")
272
- );
273
- }
274
-
275
- #[test]
276
- #[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
277
- fn c2_quick_start_help_is_zero_token_help_only_and_does_not_compile_workspace() {
278
- let cwd = tmp_dir("c2-quick-help");
279
- let out = run(&["quick-start", "--help"], &cwd);
280
- let stdout = String::from_utf8_lossy(&out.stdout);
281
- let stderr = String::from_utf8_lossy(&out.stderr);
282
- let combined = format!("{stdout}\n{stderr}");
283
-
284
- let mut failures = Vec::new();
285
- if out.status.code() != Some(0) {
286
- failures.push(format!(
287
- "help exited {:?}, expected 0; stdout={stdout:?} stderr={stderr:?}",
288
- out.status.code()
289
- ));
290
- }
291
- if !(combined.contains("usage") && combined.contains("quick-start")) {
292
- failures.push(format!(
293
- "help output did not include quick-start usage text; got {combined:?}"
294
- ));
295
- }
296
- if combined.contains("spec compile failed") || combined.contains("missing TEAM.md") {
297
- failures.push(format!(
298
- "help path compiled/validated the current workspace; got {combined:?}"
299
- ));
300
- }
301
- if cwd.join("team.spec.yaml").exists() || cwd.join(".team").exists() {
302
- failures.push(format!(
303
- "help path created artifacts: team.spec.yaml={} .team={}",
304
- cwd.join("team.spec.yaml").exists(),
305
- cwd.join(".team").exists()
306
- ));
307
- }
308
- assert!(
309
- failures.is_empty(),
310
- "CR-047: `team-agent quick-start --help` must be local help-only, zero-token, zero-pollution:\n{}",
311
- failures.join("\n")
312
- );
313
- }
314
-
315
- #[test]
316
- #[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
317
- fn c3_repeated_quick_start_uses_requested_team_identity_for_session_names() {
318
- let root = tmp_dir("c3-multiteam");
319
- seed_healthy_coordinator(&root);
320
- let teamdir = write_fake_team_dir(&root, "command-harness-template");
321
- let transport = SessionRecordingTransport::default();
322
-
323
- let first = quick_start_with_transport(
324
- &teamdir,
325
- Some("command-harness-parent"),
326
- true,
327
- Some("parent"),
328
- &transport,
329
- );
330
- let second = quick_start_with_transport(
331
- &teamdir,
332
- Some("command-harness-child"),
333
- true,
334
- Some("child"),
335
- &transport,
336
- );
337
-
338
- assert!(
339
- first.is_ok(),
340
- "CR-040/042 fixture sanity: first quick-start should succeed; got {first:?}"
341
- );
342
- assert!(
343
- second.is_ok(),
344
- "CR-040/042: second quick-start from the same template with --name/--team-id child must not collide on the template-derived tmux session; got {second:?}"
345
- );
346
- let sessions = transport.spawned_sessions();
347
- assert_eq!(
348
- sessions.len(),
349
- 2,
350
- "two requested teams should produce two spawned sessions"
351
- );
352
- assert_ne!(
353
- sessions[0], sessions[1],
354
- "CR-040/042: session names must derive from requested team identity, not reused template name"
355
- );
356
- assert!(
357
- sessions.iter().any(|s| s.contains("parent"))
358
- && sessions.iter().any(|s| s.contains("child")),
359
- "session names should carry requested team ids/names; got {sessions:?}"
360
- );
361
- let report = second.unwrap();
362
- match report {
363
- QuickStartReport::Ready { session_name, .. } => assert!(
364
- session_name.as_str().contains("child"),
365
- "reported child session should carry requested child identity; got {session_name}"
366
- ),
367
- other => panic!("second quick-start should reach Ready; got {other:?}"),
368
- }
369
- }
370
-
371
- #[test]
372
- #[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
373
- fn c4_send_generates_distinct_ids_for_repeated_payloads() {
374
- let ws = tmp_dir("c4-message-id");
375
- seed_runtime_state(&ws);
376
-
377
- let first = run(
378
- &[
379
- "send",
380
- "worker_a",
381
- "duplicate once",
382
- "--workspace",
383
- ws.to_str().unwrap(),
384
- "--json",
385
- ],
386
- &ws,
387
- );
388
- let second = run(
389
- &[
390
- "send",
391
- "worker_a",
392
- "duplicate once",
393
- "--workspace",
394
- ws.to_str().unwrap(),
395
- "--json",
396
- ],
397
- &ws,
398
- );
399
- let first_json = stdout_json(&first);
400
- let second_json = stdout_json(&second);
401
-
402
- let mut failures = Vec::new();
403
- let first_id = first_json.get("message_id").and_then(Value::as_str);
404
- let second_id = second_json.get("message_id").and_then(Value::as_str);
405
- if first_json["ok"] != json!(true)
406
- || second_json["ok"] != json!(true)
407
- || first_id.is_none()
408
- || second_id.is_none()
409
- || first_id == second_id
410
- {
411
- failures.push(format!(
412
- "canonical sends must generate distinct correlation ids; first={} second={}",
413
- first_json, second_json
414
- ));
415
- }
416
- let db = ws.join(".team").join("runtime").join("team.db");
417
- let conn = rusqlite::Connection::open(db).unwrap();
418
- let total: i64 = conn
419
- .query_row("select count(*) from messages", [], |row| row.get(0))
420
- .unwrap();
421
- let content_rows: i64 = conn
422
- .query_row(
423
- "select count(*) from messages where content = 'duplicate once'",
424
- [],
425
- |row| row.get(0),
426
- )
427
- .unwrap();
428
- if total != 2 || content_rows != 2 {
429
- failures.push(format!(
430
- "message store should contain both generated-id rows with unchanged content; total={total} content_rows={content_rows}"
431
- ));
432
- }
433
- assert!(
434
- failures.is_empty(),
435
- "CR-015/054: caller-supplied --message-id must be metadata and duplicate key:\n{}",
436
- failures.join("\n")
437
- );
438
- }
439
-
440
- #[test]
441
- #[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
442
- fn c5_send_without_target_reports_routing_ambiguous_not_target_not_in_team() {
443
- let ws = tmp_dir("c5-no-target");
444
- seed_runtime_state(&ws);
445
-
446
- let out = run(
447
- &[
448
- "send",
449
- "fix the build",
450
- "--workspace",
451
- ws.to_str().unwrap(),
452
- "--json",
453
- ],
454
- &ws,
455
- );
456
- let value = stdout_json(&out);
457
- assert_eq!(
458
- value["reason"],
459
- json!("routing_ambiguous"),
460
- "CR-061/N27: no-target send should reject as routing_ambiguous unless a default route exists; got {value}"
461
- );
462
- assert_eq!(
463
- value["content"],
464
- json!("fix the build"),
465
- "CR-061: the prompt text is content, not an agent target; got {value}"
466
- );
467
- assert!(
468
- value.get("agent_id").is_none() || value["agent_id"].is_null(),
469
- "CR-061: no-target send must not report the prompt text as agent_id; got {value}"
470
- );
471
- }
472
-
473
- #[test]
474
- #[ignore = "real-machine: command-file gate uses real team-agent binary/lifecycle"]
475
- fn c6_invalid_workspace_status_returns_shaped_error_without_polluting_invalid_path() {
476
- let root = tmp_dir("c6-invalid-root");
477
- let invalid = root.join("no").join("such").join("team");
478
- assert!(!invalid.exists(), "fixture path starts nonexistent");
479
-
480
- let out = run(
481
- &["status", "--workspace", invalid.to_str().unwrap(), "--json"],
482
- &root,
483
- );
484
- let value = stdout_json(&out);
485
- let mut failures = Vec::new();
486
- if out.status.code() == Some(0) {
487
- failures.push(format!(
488
- "invalid workspace returned exit 0 / successful empty status: {value}"
489
- ));
490
- }
491
- if value["ok"] != json!(false) {
492
- failures.push(format!(
493
- "invalid workspace must return ok=false; got {value}"
494
- ));
495
- }
496
- if !value["error"]
497
- .as_str()
498
- .is_some_and(|error| error.contains("workspace") && !error.starts_with("io:"))
499
- {
500
- failures.push(format!(
501
- "error should clearly name invalid workspace, not an opaque IO/logging failure; got {value}"
502
- ));
503
- }
504
- if let Some(log) = value.get("log").and_then(Value::as_str) {
505
- if Path::new(log).starts_with(&invalid) {
506
- failures.push(format!(
507
- "error log must not be written or pointed inside invalid workspace; log={log}"
508
- ));
509
- }
510
- } else {
511
- failures.push(format!("invalid workspace response should include shaped error log outside invalid path; got {value}"));
512
- }
513
- if invalid.join(".team").exists() {
514
- failures.push(format!(
515
- "status created .team runtime/log state under invalid path: {}",
516
- invalid.join(".team").display()
517
- ));
518
- }
519
- assert!(
520
- failures.is_empty(),
521
- "CR-064/N20: invalid workspace must fail clearly without state/log pollution:\n{}",
522
- failures.join("\n")
523
- );
524
- }
525
-
526
- fn write_fake_team_dir(root: &Path, team_name: &str) -> PathBuf {
527
- let teamdir = root.join("teamdir");
528
- std::fs::create_dir_all(teamdir.join("agents")).unwrap();
529
- std::fs::write(
530
- teamdir.join("TEAM.md"),
531
- format!(
532
- "---\nname: {team_name}\nobjective: Multi-team session derivation.\nprovider: fake\n---\n\nTeam.\n"
533
- ),
534
- )
535
- .unwrap();
536
- std::fs::write(
537
- teamdir.join("agents").join("worker_a.md"),
538
- "---\nname: worker_a\nrole: Worker A\nprovider: fake\ntools:\n - mcp_team\n---\n\nWorker.\n",
539
- )
540
- .unwrap();
541
- teamdir
542
- }
543
-
544
- #[derive(Debug)]
545
- struct C1Fixture {
546
- root: PathBuf,
547
- teamdir: PathBuf,
548
- }
549
-
550
- impl C1Fixture {
551
- fn root_str(&self) -> String {
552
- self.root.to_string_lossy().to_string()
553
- }
554
- }
555
-
556
- fn seed_c1_active_team_fixture(tag: &str) -> C1Fixture {
557
- let root = tmp_dir(tag);
558
- let teamdir = write_fake_team_dir(&root, "command-harness-template");
559
- let spec = team_agent::compiler::compile_team(&teamdir).unwrap();
560
- let spec_path = teamdir.join("team.spec.yaml");
561
- std::fs::write(&spec_path, team_agent::model::yaml::dumps(&spec)).unwrap();
562
- let roles_dir = root.join(".team").join("roles");
563
- std::fs::create_dir_all(&roles_dir).unwrap();
564
- std::fs::write(
565
- roles_dir.join("worker_b.md"),
566
- "---\nname: worker_b\nrole: Worker B\nprovider: fake\ntools:\n - mcp_team\n---\n\nWorker B.\n",
567
- )
568
- .unwrap();
569
- let now = "2026-05-27T10:00:00+00:00";
570
- team_agent::state::persist::save_runtime_state(
571
- &root,
572
- &json!({
573
- "active_team_key": "command-harness-template",
574
- "spec_path": spec_path.to_string_lossy().to_string(),
575
- "team_dir": teamdir.to_string_lossy().to_string(),
576
- "session_name": "team-command-harness-template",
577
- "leader": {"id": "leader"},
578
- "agents": {
579
- "worker_a": {
580
- "provider": "fake",
581
- "role": "Worker A",
582
- "status": "running",
583
- "session_id": "sess-worker-a",
584
- "first_send_at": now,
585
- "pane_id": "%1",
586
- "window": "worker_a"
587
- }
588
- },
589
- "tasks": [
590
- {
591
- "id": "task_initial",
592
- "title": "Initial task",
593
- "type": "implementation",
594
- "assignee": "worker_a",
595
- "status": "running"
596
- }
597
- ],
598
- "teams": {
599
- "command-harness-template": {
600
- "status": "running",
601
- "spec_path": spec_path.to_string_lossy().to_string(),
602
- "team_dir": teamdir.to_string_lossy().to_string(),
603
- "session_name": "team-command-harness-template",
604
- "leader": {"id": "leader"},
605
- "agents": {
606
- "worker_a": {
607
- "provider": "fake",
608
- "role": "Worker A",
609
- "status": "running",
610
- "session_id": "sess-worker-a",
611
- "first_send_at": now,
612
- "pane_id": "%1",
613
- "window": "worker_a"
614
- }
615
- },
616
- "tasks": [
617
- {
618
- "id": "task_initial",
619
- "title": "Initial task",
620
- "type": "implementation",
621
- "assignee": "worker_a",
622
- "status": "running"
623
- }
624
- ]
625
- }
626
- }
627
- }),
628
- )
629
- .unwrap();
630
- seed_healthy_coordinator(&root);
631
- C1Fixture { root, teamdir }
632
- }
633
-
634
- fn seed_healthy_coordinator(workspace: &Path) {
635
- let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
636
- std::fs::create_dir_all(team_agent::model::paths::runtime_dir(workspace.as_path())).unwrap();
637
- let _ = team_agent::message_store::MessageStore::open(workspace.as_path()).unwrap();
638
- let pid = team_agent::coordinator::Pid::new(std::process::id());
639
- team_agent::coordinator::write_coordinator_metadata(
640
- &workspace,
641
- pid,
642
- team_agent::coordinator::MetadataSource::Boot,
643
- )
644
- .unwrap();
645
- std::fs::write(
646
- team_agent::coordinator::coordinator_pid_path(&workspace),
647
- pid.to_string(),
648
- )
649
- .unwrap();
650
- }
651
-
652
- #[derive(Debug, Default)]
653
- struct SessionRecordingTransport {
654
- sessions: Mutex<HashSet<String>>,
655
- spawned: Mutex<Vec<String>>,
656
- }
657
-
658
- impl SessionRecordingTransport {
659
- fn spawned_sessions(&self) -> Vec<String> {
660
- self.spawned.lock().unwrap().clone()
661
- }
662
-
663
- fn spawn_result(
664
- &self,
665
- session: &SessionName,
666
- window: &WindowName,
667
- kind: &'static str,
668
- ) -> SpawnResult {
669
- self.sessions
670
- .lock()
671
- .unwrap()
672
- .insert(session.as_str().to_string());
673
- let mut spawned = self.spawned.lock().unwrap();
674
- spawned.push(session.as_str().to_string());
675
- SpawnResult {
676
- pane_id: PaneId::new(format!("%{}-{kind}", spawned.len())),
677
- session: session.clone(),
678
- window: window.clone(),
679
- child_pid: None,
680
- }
681
- }
682
- }
683
-
684
- impl Transport for SessionRecordingTransport {
685
- fn kind(&self) -> BackendKind {
686
- BackendKind::Tmux
687
- }
688
-
689
- fn spawn_first(
690
- &self,
691
- session: &SessionName,
692
- window: &WindowName,
693
- _argv: &[String],
694
- _cwd: &Path,
695
- _env: &BTreeMap<String, String>,
696
- ) -> Result<SpawnResult, TransportError> {
697
- Ok(self.spawn_result(session, window, "first"))
698
- }
699
-
700
- fn spawn_into(
701
- &self,
702
- session: &SessionName,
703
- window: &WindowName,
704
- _argv: &[String],
705
- _cwd: &Path,
706
- _env: &BTreeMap<String, String>,
707
- ) -> Result<SpawnResult, TransportError> {
708
- Ok(self.spawn_result(session, window, "into"))
709
- }
710
-
711
- fn inject(
712
- &self,
713
- _target: &Target,
714
- _payload: &InjectPayload,
715
- _submit: Key,
716
- _bracketed: bool,
717
- ) -> Result<InjectReport, TransportError> {
718
- Ok(InjectReport {
719
- stage_reached: InjectStage::Submit,
720
- inject_verification: InjectVerification::CaptureContainsToken,
721
- submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
722
- turn_verification: TurnVerification::NotYetObserved,
723
- attempts: 1,
724
- submit_diagnostics: None,
725
- })
726
- }
727
-
728
- fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
729
- Ok(())
730
- }
731
-
732
- fn capture(
733
- &self,
734
- _target: &Target,
735
- range: CaptureRange,
736
- ) -> Result<CapturedText, TransportError> {
737
- Ok(CapturedText {
738
- text: String::new(),
739
- range,
740
- })
741
- }
742
-
743
- fn query(&self, _target: &Target, _field: PaneField) -> Result<Option<String>, TransportError> {
744
- Ok(None)
745
- }
746
-
747
- fn liveness(
748
- &self,
749
- _pane: &PaneId,
750
- ) -> Result<team_agent::transport::PaneLiveness, TransportError> {
751
- Ok(team_agent::transport::PaneLiveness::Live)
752
- }
753
-
754
- fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
755
- Ok(Vec::new())
756
- }
757
-
758
- fn has_session(&self, session: &SessionName) -> Result<bool, TransportError> {
759
- Ok(self.sessions.lock().unwrap().contains(session.as_str()))
760
- }
761
-
762
- fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
763
- Ok(Vec::new())
764
- }
765
-
766
- fn set_session_env(
767
- &self,
768
- _session: &SessionName,
769
- _key: &str,
770
- _value: &str,
771
- ) -> Result<SetEnvOutcome, TransportError> {
772
- Ok(SetEnvOutcome::Applied)
773
- }
774
-
775
- fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
776
- Ok(())
777
- }
778
-
779
- fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
780
- Ok(())
781
- }
782
-
783
- fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
784
- Ok(AttachOutcome::Attached)
785
- }
786
- }