@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,827 +0,0 @@
1
- #![allow(clippy::unwrap_used)]
2
- use super::*;
3
- use crate::model::spec;
4
- use std::fs;
5
- use std::path::PathBuf;
6
- use std::sync::atomic::{AtomicU32, Ordering};
7
-
8
- static COUNTER: AtomicU32 = AtomicU32::new(0);
9
-
10
- #[cfg(unix)]
11
- #[test]
12
- fn every_cursor_provider_name_compiles_to_the_contract_leaf() {
13
- for provider in ["cursor", "cursor_agent", "cursor-agent", "agent"] {
14
- let role = write_tmp(
15
- "cursor.md",
16
- &format!("---\nprovider: {provider}\nmodel: gpt-5.6-luna-xhigh\n---\nRole\n"),
17
- );
18
- let compiled = compile_role_agent(&role, &Value::Map(Vec::new()), "/workspace").unwrap();
19
- assert_eq!(
20
- compiled.agent.get("provider").and_then(Value::as_str),
21
- Some("cursor"),
22
- "{provider}"
23
- );
24
- fs::remove_dir_all(role.parent().unwrap()).unwrap();
25
- // The leaf's effort admission applies, not a legacy warning-and-ignore.
26
- let role = write_tmp(
27
- "cursor.md",
28
- &format!("---\nprovider: {provider}\nmodel: gpt-5.6-luna-xhigh\neffort: high\n---\nRole\n"),
29
- );
30
- let error = compile_role_agent(&role, &Value::Map(Vec::new()), "/workspace")
31
- .err()
32
- .expect("Cursor effort is a model ID, never a separate flag");
33
- assert!(error.to_string().contains("exact catalog model ID"), "{provider}: {error}");
34
- fs::remove_dir_all(role.parent().unwrap()).unwrap();
35
- }
36
- }
37
-
38
- #[cfg(unix)]
39
- #[test]
40
- fn every_codex_and_grok_provider_name_compiles_to_the_contract_leaf() {
41
- // No opt-in: each public name declares its leaf, and neither leaf inherits
42
- // the TEAM provider_effort default.
43
- let team_meta = Value::Map(vec![(
44
- "provider_effort".to_string(),
45
- Value::Str("high".to_string()),
46
- )]);
47
- for (provider, leaf) in [
48
- ("codex", "codex_tui"),
49
- ("codex_cli", "codex_tui"),
50
- ("codex-cli", "codex_tui"),
51
- ("grok", "grok_build"),
52
- ] {
53
- let role = write_tmp("leaf.md", &format!("---\nprovider: {provider}\n---\nRole\n"));
54
- let compiled = compile_role_agent(&role, &team_meta, "/workspace").unwrap();
55
- assert_eq!(
56
- compiled.agent.get("provider").and_then(Value::as_str),
57
- Some(leaf),
58
- "{provider}"
59
- );
60
- assert!(compiled.agent.get("effort").is_none(), "{provider}");
61
- fs::remove_dir_all(role.parent().unwrap()).unwrap();
62
- }
63
- }
64
-
65
- fn unique_base() -> PathBuf {
66
- let n = COUNTER.fetch_add(1, Ordering::Relaxed);
67
- std::env::temp_dir().join(format!("ta_rs_compile_{}_{}", std::process::id(), n))
68
- }
69
-
70
- /// Build `<tmp>/.team/current/{TEAM.md, agents/*, profiles/*}` and return the
71
- /// team dir. `team_workspace(team_dir)` → `<tmp>` (parent is `.team`).
72
- fn build_team(team_md: &str, roles: &[(&str, &str)], profiles: &[(&str, &str)]) -> PathBuf {
73
- let team = unique_base().join(".team").join("current");
74
- fs::create_dir_all(team.join("agents")).unwrap();
75
- fs::create_dir_all(team.join("profiles")).unwrap();
76
- fs::write(team.join("TEAM.md"), team_md).unwrap();
77
- for (name, text) in roles {
78
- fs::write(team.join("agents").join(name), text).unwrap();
79
- }
80
- for (name, text) in profiles {
81
- fs::write(team.join("profiles").join(name), text).unwrap();
82
- }
83
- team
84
- }
85
-
86
- fn write_tmp(name: &str, text: &str) -> PathBuf {
87
- let base = unique_base();
88
- fs::create_dir_all(&base).unwrap();
89
- let p = base.join(name);
90
- fs::write(&p, text).unwrap();
91
- p
92
- }
93
-
94
- /// `json.dumps(v, sort_keys=False, separators=(",",":"))` for a `yaml::Value`:
95
- /// preserves Map insertion order; string escaping matches Python json (ASCII
96
- /// content here). Locks both VALUE and KEY INSERTION ORDER of the spec dict.
97
- fn compact_json(v: &Value) -> String {
98
- match v {
99
- Value::Null => "null".to_string(),
100
- Value::Bool(b) => b.to_string(),
101
- Value::Int(i) => i.to_string(),
102
- Value::Float(f) => format!("{f}"),
103
- Value::Str(s) => serde_json::to_string(s).unwrap(),
104
- Value::List(items) => {
105
- let inner: Vec<String> = items.iter().map(compact_json).collect();
106
- format!("[{}]", inner.join(","))
107
- }
108
- Value::Map(pairs) => {
109
- let inner: Vec<String> = pairs
110
- .iter()
111
- .map(|(k, val)| {
112
- format!(
113
- "{}:{}",
114
- serde_json::to_string(k).unwrap(),
115
- compact_json(val)
116
- )
117
- })
118
- .collect();
119
- format!("{{{}}}", inner.join(","))
120
- }
121
- }
122
- }
123
-
124
- /// Render spec to compact JSON with the env-dependent workspace path templated
125
- /// to `__WS__` (appears as both `team.workspace` and each `working_directory`).
126
- fn templated_compact_json(spec: &Value) -> String {
127
- let ws = spec
128
- .get("team")
129
- .and_then(|t| t.get("workspace"))
130
- .and_then(Value::as_str)
131
- .expect("spec.team.workspace must be a string");
132
- compact_json(spec).replace(ws, "__WS__")
133
- }
134
-
135
- fn workspace_of(spec: &Value) -> String {
136
- spec.get("team")
137
- .and_then(|t| t.get("workspace"))
138
- .and_then(Value::as_str)
139
- .unwrap()
140
- .to_string()
141
- }
142
-
143
- // ───────────────────── fixtures (byte-identical to the Python probe) ─────────────────────
144
-
145
- const TEAM_BASE: &str = "\
146
- ---
147
- name: doc-team
148
- objective: Compile role docs.
149
- provider: codex
150
- model: gpt-5.5
151
- ---
152
-
153
- Document-driven team.
154
- ";
155
-
156
- const ROLE_NOPROFILE: &str = "\
157
- ---
158
- name: implementer
159
- role: Implementation Engineer
160
- provider: copilot
161
- model: gpt-5.5
162
- auth_mode: subscription
163
- dangerously_skip_permissions: false
164
- tools:
165
- - fs_read
166
- - fs_write
167
- - execute_bash
168
- - mcp_team
169
- ---
170
-
171
- Implement bounded tasks and report result_envelope_v1.
172
- ";
173
-
174
- // ───────────────────────────── read_front_matter ─────────────────────────────
175
-
176
- #[test]
177
- fn front_matter_cases() {
178
- struct Case {
179
- id: &'static str,
180
- file: &'static str,
181
- text: &'static str,
182
- meta: &'static [(&'static str, &'static str)],
183
- body: &'static str,
184
- }
185
- const CASES: &[Case] = &[
186
- // No leading "---\n" → ({}, text) verbatim (compiler.py:175-176).
187
- Case {
188
- id: "front_matter_no_marker_returns_empty_meta_and_full_text", file: "no_marker.md",
189
- text: "hello\nworld\n", meta: &[], body: "hello\nworld\n",
190
- },
191
- Case {
192
- id: "front_matter_basic_splits_meta_and_lstrips_body", file: "basic.md",
193
- text: "---\nname: x\nrole: R\n---\n\nbody line\n", meta: &[("name", "x"), ("role", "R")], body: "body line\n",
194
- },
195
- // Closing marker at the blank line → raw "" → {}; body "body\n".
196
- Case {
197
- id: "front_matter_empty_block_is_empty_map", file: "empty.md",
198
- text: "---\n\n---\nbody\n", meta: &[], body: "body\n",
199
- },
200
- // body.lstrip("\n") removes leading NEWLINES but keeps the 2-space indent.
201
- Case {
202
- id: "front_matter_body_lstrip_strips_only_newlines", file: "lstrip.md",
203
- text: "---\nname: x\n---\n\n\n indented body\n", meta: &[("name", "x")], body: " indented body\n",
204
- },
205
- Case {
206
- id: "front_matter_unterminated_falls_back_to_plain_text", file: "unterminated.md",
207
- text: "---\nname: x\n", meta: &[], body: "---\nname: x\n",
208
- },
209
- Case {
210
- id: "front_matter_non_object_falls_back_to_plain_text", file: "list.md",
211
- text: "---\n- a\n- b\n---\nbody\n", meta: &[], body: "---\n- a\n- b\n---\nbody\n",
212
- },
213
- ];
214
- for case in CASES {
215
- let p = write_tmp(case.file, case.text);
216
- let (meta, body) = read_front_matter(&p).unwrap_or_else(|err| panic!("{}: {err}", case.id));
217
- let expected_meta = Value::Map(case.meta.iter().map(|(key, value)| {
218
- ((*key).to_string(), Value::Str((*value).to_string()))
219
- }).collect());
220
- assert_eq!(meta, expected_meta, "{}: metadata", case.id);
221
- assert_eq!(body, case.body, "{}: body", case.id);
222
- }
223
- }
224
-
225
- // ───────────────────────────── compile_team: full dict parity ─────────────────────────────
226
-
227
- // Golden = Python `json.dumps(compile_team(team)["spec"], sort_keys=False,
228
- // separators=(",",":"))` with the workspace path templated to __WS__.
229
- // (team-agent-public v0.2.11, /tmp/probe_compiler.py.)
230
-
231
- const BASE_NOPROFILE_JSON: &str = r#"{"version":1,"team":{"name":"doc-team","mode":"supervisor_worker","objective":"Compile role docs.","workspace":"__WS__"},"leader":{"id":"leader","role":"leader","provider":"codex","model":"gpt-5.5","context_policy":{"keep_user_thread":true,"receive_worker_outputs":"business_messages_and_short_summaries","max_worker_result_tokens":2000}},"agents":[{"id":"implementer","role":"Implementation Engineer","provider":"copilot","model":"gpt-5.5","auth_mode":"subscription","working_directory":"__WS__","system_prompt":{"inline":"Implement bounded tasks and report result_envelope_v1.","file":null},"dangerously_skip_permissions":false,"communication_mode":"leader_centric","preferred_for":["implementer","Implementation Engineer"],"avoid_for":[],"output_contract":{"format":"result_envelope_v1","required_fields":["task_id","status","summary","artifacts"]}}],"routing":{"default_assignee":"implementer","rules":[{"id":"route-implementer","match":{"assignee":["implementer"]},"assign_to":"implementer","priority":10}]},"communication":{"protocol":"mcp_inbox","topology":"leader_centered","worker_to_worker":true,"ack_timeout_sec":60,"result_format":"result_envelope_v1","message_store":{"sqlite":".team/runtime/team.db","mirror_files":".team/messages"}},"runtime":{"backend":"tmux","session_name":"team-doc-team","auto_launch":true,"require_user_approval_before_launch":true,"max_active_agents":1,"startup_order":["implementer"],"fast":false,"tick_interval_sec":2,"push_min_interval_sec":60,"stuck_timeout_sec":300},"context":{"state_file":"team_state.md","artifact_dir":".team/artifacts","log_dir":".team/logs","summarization":{"worker_full_logs":"retain_outside_leader_context","state_update":"after_each_result"}},"tasks":[{"id":"task_initial","title":"Initial document-driven team task","type":"implementation","assignee":"implementer","deps":[],"acceptance":["Worker reports valid result_envelope_v1"],"status":"pending","requires_tools":["mcp_team"],"files":[],"risk":"low"}]}"#;
232
-
233
- #[test]
234
- fn compile_base_noprofile_matches_python_dict_order_and_values() {
235
- let team = build_team(TEAM_BASE, &[("implementer.md", ROLE_NOPROFILE)], &[]);
236
- let spec = compile_team(&team).unwrap();
237
- assert_eq!(templated_compact_json(&spec), BASE_NOPROFILE_JSON);
238
- }
239
-
240
- #[test]
241
- fn compile_base_returned_spec_passes_validate_spec() {
242
- // §6 contract: the compiled spec MUST pass model::spec::validate_spec.
243
- let team = build_team(TEAM_BASE, &[("implementer.md", ROLE_NOPROFILE)], &[]);
244
- let spec = compile_team(&team).unwrap();
245
- let ws = workspace_of(&spec);
246
- assert!(spec::validate_spec(&spec, Path::new(&ws)).is_ok());
247
- }
248
-
249
- #[test]
250
- fn compile_subscription_without_profile_is_thin_manifest() {
251
- // No profile field → agent has auth_mode=subscription and NO profile / credential_ref keys.
252
- let team = build_team(TEAM_BASE, &[("implementer.md", ROLE_NOPROFILE)], &[]);
253
- let spec = compile_team(&team).unwrap();
254
- let agent = &spec.get("agents").and_then(Value::as_list).unwrap()[0];
255
- assert_eq!(
256
- agent.get("auth_mode").and_then(Value::as_str),
257
- Some("subscription")
258
- );
259
- assert!(agent.get("profile").is_none(), "profile key must be absent");
260
- assert!(
261
- agent.get("credential_ref").is_none(),
262
- "credential_ref key must be absent"
263
- );
264
- }
265
-
266
- // Runtime front-matter defaults: TEAM.md runtime settings remain available,
267
- // but its default_model does not fill an omitted role model; leader.model is null.
268
- const RUNTIME_DEFAULTS_TEAM: &str = "\
269
- ---
270
- name: doc-team
271
- objective: Compile role docs.
272
- provider: codex
273
- default_model: gpt-5.4
274
- default_auth_mode: subscription
275
- dangerous_auto_approve: true
276
- fast: true
277
- tick_interval_sec: 1
278
- push_min_interval_sec: 3
279
- stuck_timeout_sec: 5
280
- worker_to_worker: true
281
- ---
282
-
283
- Document-driven team.
284
- ";
285
-
286
- const RUNTIME_DEFAULTS_ROLE: &str = "\
287
- ---
288
- name: implementer
289
- role: Implementation Engineer
290
- provider: copilot
291
- tools:
292
- - fs_read
293
- - mcp_team
294
- dangerously_skip_permissions: false
295
- ---
296
-
297
- Implement bounded tasks.
298
- ";
299
-
300
- const RUNTIME_DEFAULTS_JSON: &str = r#"{"version":1,"team":{"name":"doc-team","mode":"supervisor_worker","objective":"Compile role docs.","workspace":"__WS__"},"leader":{"id":"leader","role":"leader","provider":"codex","model":null,"context_policy":{"keep_user_thread":true,"receive_worker_outputs":"business_messages_and_short_summaries","max_worker_result_tokens":2000}},"agents":[{"id":"implementer","role":"Implementation Engineer","provider":"copilot","model":null,"auth_mode":"subscription","working_directory":"__WS__","system_prompt":{"inline":"Implement bounded tasks.","file":null},"dangerously_skip_permissions":false,"communication_mode":"leader_centric","preferred_for":["implementer","Implementation Engineer"],"avoid_for":[],"output_contract":{"format":"result_envelope_v1","required_fields":["task_id","status","summary","artifacts"]}}],"routing":{"default_assignee":"implementer","rules":[{"id":"route-implementer","match":{"assignee":["implementer"]},"assign_to":"implementer","priority":10}]},"communication":{"protocol":"mcp_inbox","topology":"leader_centered","worker_to_worker":true,"ack_timeout_sec":60,"result_format":"result_envelope_v1","message_store":{"sqlite":".team/runtime/team.db","mirror_files":".team/messages"}},"runtime":{"backend":"tmux","session_name":"team-doc-team","auto_launch":true,"require_user_approval_before_launch":true,"max_active_agents":1,"startup_order":["implementer"],"fast":true,"tick_interval_sec":1,"push_min_interval_sec":3,"stuck_timeout_sec":5},"context":{"state_file":"team_state.md","artifact_dir":".team/artifacts","log_dir":".team/logs","summarization":{"worker_full_logs":"retain_outside_leader_context","state_update":"after_each_result"}},"tasks":[{"id":"task_initial","title":"Initial document-driven team task","type":"implementation","assignee":"implementer","deps":[],"acceptance":["Worker reports valid result_envelope_v1"],"status":"pending","requires_tools":["mcp_team"],"files":[],"risk":"low"}]}"#;
301
-
302
- #[test]
303
- fn compile_runtime_front_matter_defaults_match_python() {
304
- let team = build_team(
305
- RUNTIME_DEFAULTS_TEAM,
306
- &[("implementer.md", RUNTIME_DEFAULTS_ROLE)],
307
- &[],
308
- );
309
- let spec = compile_team(&team).unwrap();
310
- assert_eq!(templated_compact_json(&spec), RUNTIME_DEFAULTS_JSON);
311
- }
312
-
313
- // TEAM provider_models do not fill a role whose model is omitted.
314
- const ALIAS_TEAM: &str = "\
315
- ---
316
- name: debate-team
317
- objective: Compile thin role docs.
318
- provider_models:
319
- claude: claude-sonnet-4-6
320
- default_auth_mode: subscription
321
- ---
322
-
323
- Team config.
324
- ";
325
-
326
- const ALIAS_ROLE: &str = "\
327
- ---
328
- name: editor
329
- role: Editor and Defender
330
- provider: claude_code
331
- tools:
332
- - mcp_team
333
- dangerously_skip_permissions: false
334
- ---
335
-
336
- Edit and defend the argument.
337
- ";
338
-
339
- const ALIAS_JSON: &str = r#"{"version":1,"team":{"name":"debate-team","mode":"supervisor_worker","objective":"Compile thin role docs.","workspace":"__WS__"},"leader":{"id":"leader","role":"leader","provider":"codex","model":null,"context_policy":{"keep_user_thread":true,"receive_worker_outputs":"business_messages_and_short_summaries","max_worker_result_tokens":2000}},"agents":[{"id":"editor","role":"Editor and Defender","provider":"claude_code","model":null,"auth_mode":"subscription","working_directory":"__WS__","system_prompt":{"inline":"Edit and defend the argument.","file":null},"dangerously_skip_permissions":false,"communication_mode":"leader_centric","preferred_for":["editor","Editor and Defender"],"avoid_for":[],"output_contract":{"format":"result_envelope_v1","required_fields":["task_id","status","summary","artifacts"]}}],"routing":{"default_assignee":"editor","rules":[{"id":"route-editor","match":{"assignee":["editor"]},"assign_to":"editor","priority":10}]},"communication":{"protocol":"mcp_inbox","topology":"leader_centered","worker_to_worker":true,"ack_timeout_sec":60,"result_format":"result_envelope_v1","message_store":{"sqlite":".team/runtime/team.db","mirror_files":".team/messages"}},"runtime":{"backend":"tmux","session_name":"team-debate-team","auto_launch":true,"require_user_approval_before_launch":true,"max_active_agents":1,"startup_order":["editor"],"fast":false,"tick_interval_sec":2,"push_min_interval_sec":60,"stuck_timeout_sec":300},"context":{"state_file":"team_state.md","artifact_dir":".team/artifacts","log_dir":".team/logs","summarization":{"worker_full_logs":"retain_outside_leader_context","state_update":"after_each_result"}},"tasks":[{"id":"task_initial","title":"Initial document-driven team task","type":"implementation","assignee":"editor","deps":[],"acceptance":["Worker reports valid result_envelope_v1"],"status":"pending","requires_tools":["mcp_team"],"files":[],"risk":"low"}]}"#;
340
-
341
- #[test]
342
- fn compile_provider_models_do_not_fill_claude_code_role_model() {
343
- let team = build_team(ALIAS_TEAM, &[("implementer.md", ALIAS_ROLE)], &[]);
344
- let spec = compile_team(&team).unwrap();
345
- assert_eq!(templated_compact_json(&spec), ALIAS_JSON);
346
- }
347
-
348
- // Omitted role model remains null; the provider supplies its native default.
349
- const BUILTIN_TEAM: &str = "\
350
- ---
351
- name: default-model-team
352
- objective: Compile role docs without model fields.
353
- ---
354
-
355
- Team config.
356
- ";
357
-
358
- const BUILTIN_ROLE: &str = "\
359
- ---
360
- name: implementer
361
- role: Implementation Engineer
362
- provider: copilot
363
- auth_mode: subscription
364
- dangerously_skip_permissions: false
365
- tools:
366
- - mcp_team
367
- ---
368
-
369
- Implement bounded tasks.
370
- ";
371
-
372
- const BUILTIN_JSON: &str = r#"{"version":1,"team":{"name":"default-model-team","mode":"supervisor_worker","objective":"Compile role docs without model fields.","workspace":"__WS__"},"leader":{"id":"leader","role":"leader","provider":"codex","model":null,"context_policy":{"keep_user_thread":true,"receive_worker_outputs":"business_messages_and_short_summaries","max_worker_result_tokens":2000}},"agents":[{"id":"implementer","role":"Implementation Engineer","provider":"copilot","model":null,"auth_mode":"subscription","working_directory":"__WS__","system_prompt":{"inline":"Implement bounded tasks.","file":null},"dangerously_skip_permissions":false,"communication_mode":"leader_centric","preferred_for":["implementer","Implementation Engineer"],"avoid_for":[],"output_contract":{"format":"result_envelope_v1","required_fields":["task_id","status","summary","artifacts"]}}],"routing":{"default_assignee":"implementer","rules":[{"id":"route-implementer","match":{"assignee":["implementer"]},"assign_to":"implementer","priority":10}]},"communication":{"protocol":"mcp_inbox","topology":"leader_centered","worker_to_worker":true,"ack_timeout_sec":60,"result_format":"result_envelope_v1","message_store":{"sqlite":".team/runtime/team.db","mirror_files":".team/messages"}},"runtime":{"backend":"tmux","session_name":"team-default-model-team","auto_launch":true,"require_user_approval_before_launch":true,"max_active_agents":1,"startup_order":["implementer"],"fast":false,"tick_interval_sec":2,"push_min_interval_sec":60,"stuck_timeout_sec":300},"context":{"state_file":"team_state.md","artifact_dir":".team/artifacts","log_dir":".team/logs","summarization":{"worker_full_logs":"retain_outside_leader_context","state_update":"after_each_result"}},"tasks":[{"id":"task_initial","title":"Initial document-driven team task","type":"implementation","assignee":"implementer","deps":[],"acceptance":["Worker reports valid result_envelope_v1"],"status":"pending","requires_tools":["mcp_team"],"files":[],"risk":"low"}]}"#;
373
-
374
- #[test]
375
- fn compile_subscription_without_model_keeps_provider_native_default() {
376
- let team = build_team(BUILTIN_TEAM, &[("implementer.md", BUILTIN_ROLE)], &[]);
377
- let spec = compile_team(&team).unwrap();
378
- assert_eq!(templated_compact_json(&spec), BUILTIN_JSON);
379
- }
380
-
381
- // Two role docs sorted by FILENAME (01-alpha before 02-bravo though names alpha/bravo):
382
- // startup_order, routing rules (one per agent), default_assignee = first agent,
383
- // max_active_agents = min(len, 2).
384
- const TWO_ROLE_A: &str = "\
385
- ---
386
- name: alpha
387
- role: Alpha Worker
388
- provider: copilot
389
- model: gpt-5.5
390
- auth_mode: subscription
391
- dangerously_skip_permissions: false
392
- tools:
393
- - mcp_team
394
- ---
395
-
396
- Alpha body.
397
- ";
398
-
399
- const TWO_ROLE_B: &str = "\
400
- ---
401
- name: bravo
402
- role: Bravo Worker
403
- provider: copilot
404
- model: gpt-5.5
405
- auth_mode: subscription
406
- dangerously_skip_permissions: false
407
- tools:
408
- - mcp_team
409
- ---
410
-
411
- Bravo body.
412
- ";
413
-
414
- const TWO_AGENTS_JSON: &str = r#"{"version":1,"team":{"name":"doc-team","mode":"supervisor_worker","objective":"Compile role docs.","workspace":"__WS__"},"leader":{"id":"leader","role":"leader","provider":"codex","model":"gpt-5.5","context_policy":{"keep_user_thread":true,"receive_worker_outputs":"business_messages_and_short_summaries","max_worker_result_tokens":2000}},"agents":[{"id":"alpha","role":"Alpha Worker","provider":"copilot","model":"gpt-5.5","auth_mode":"subscription","working_directory":"__WS__","system_prompt":{"inline":"Alpha body.","file":null},"dangerously_skip_permissions":false,"communication_mode":"leader_centric","preferred_for":["alpha","Alpha Worker"],"avoid_for":[],"output_contract":{"format":"result_envelope_v1","required_fields":["task_id","status","summary","artifacts"]}},{"id":"bravo","role":"Bravo Worker","provider":"copilot","model":"gpt-5.5","auth_mode":"subscription","working_directory":"__WS__","system_prompt":{"inline":"Bravo body.","file":null},"dangerously_skip_permissions":false,"communication_mode":"leader_centric","preferred_for":["bravo","Bravo Worker"],"avoid_for":[],"output_contract":{"format":"result_envelope_v1","required_fields":["task_id","status","summary","artifacts"]}}],"routing":{"default_assignee":"alpha","rules":[{"id":"route-alpha","match":{"assignee":["alpha"]},"assign_to":"alpha","priority":10},{"id":"route-bravo","match":{"assignee":["bravo"]},"assign_to":"bravo","priority":10}]},"communication":{"protocol":"mcp_inbox","topology":"leader_centered","worker_to_worker":true,"ack_timeout_sec":60,"result_format":"result_envelope_v1","message_store":{"sqlite":".team/runtime/team.db","mirror_files":".team/messages"}},"runtime":{"backend":"tmux","session_name":"team-doc-team","auto_launch":true,"require_user_approval_before_launch":true,"max_active_agents":2,"startup_order":["alpha","bravo"],"fast":false,"tick_interval_sec":2,"push_min_interval_sec":60,"stuck_timeout_sec":300},"context":{"state_file":"team_state.md","artifact_dir":".team/artifacts","log_dir":".team/logs","summarization":{"worker_full_logs":"retain_outside_leader_context","state_update":"after_each_result"}},"tasks":[{"id":"task_initial","title":"Initial document-driven team task","type":"implementation","assignee":"alpha","deps":[],"acceptance":["Worker reports valid result_envelope_v1"],"status":"pending","requires_tools":["mcp_team"],"files":[],"risk":"low"}]}"#;
415
-
416
- #[test]
417
- fn compile_two_agents_sorted_by_filename_with_routing_and_startup_order() {
418
- // filenames intentionally out of name order to prove sorted(glob) is by filename.
419
- let team = build_team(
420
- TEAM_BASE,
421
- &[("02-bravo.md", TWO_ROLE_B), ("01-alpha.md", TWO_ROLE_A)],
422
- &[],
423
- );
424
- let spec = compile_team(&team).unwrap();
425
- assert_eq!(templated_compact_json(&spec), TWO_AGENTS_JSON);
426
- }
427
-
428
- // ───────────────────────────── compile_team: error paths ─────────────────────────────
429
-
430
- const ROLE_MISSING_PROVIDER: &str = "\
431
- ---
432
- name: implementer
433
- role: Implementation Engineer
434
- model: team-agent/qwen3.8-27b
435
- auth_mode: subscription
436
- dangerously_skip_permissions: false
437
- tools:
438
- - mcp_team
439
- ---
440
-
441
- Implement bounded tasks.
442
- ";
443
-
444
- #[test]
445
- fn compile_missing_provider_defaults_to_pi() {
446
- let team = build_team(TEAM_BASE, &[("implementer.md", ROLE_MISSING_PROVIDER)], &[]);
447
- let spec = compile_team(&team).expect("an omitted provider defaults to Pi");
448
- let agent = agent0(&spec);
449
- assert_eq!(agent.get("provider"), Some(&Value::Str("pi".to_string())));
450
- assert_eq!(
451
- agent.get("model"),
452
- Some(&Value::Str("team-agent/qwen3.8-27b".to_string()))
453
- );
454
- }
455
-
456
- const ROLE_COMPATIBLE_NO_PROFILE: &str = "\
457
- ---
458
- name: implementer
459
- role: Implementation Engineer
460
- provider: codex
461
- model: gpt-5.5
462
- auth_mode: compatible_api
463
- dangerously_skip_permissions: false
464
- tools:
465
- - mcp_team
466
- ---
467
-
468
- Implement bounded tasks.
469
- ";
470
-
471
- #[test]
472
- fn compile_compatible_api_without_profile_errors() {
473
- let team = build_team(
474
- TEAM_BASE,
475
- &[("implementer.md", ROLE_COMPATIBLE_NO_PROFILE)],
476
- &[],
477
- );
478
- let err = compile_team(&team).unwrap_err();
479
- assert!(
480
- err.to_string().contains("profile is required"),
481
- "got: {err}"
482
- );
483
- }
484
-
485
- // ════════════════════════ FIX-LOOP (wave-1) RED tests ════════════════════════
486
- // The first-round fixtures under-specified the contract. These lock the CORRECT
487
- // Python v0.2.11 behavior; each FAILS against the current (too-narrow) impl.
488
- // Golden re-probed via /tmp/probe_fix.py against team-agent-public v0.2.11.
489
-
490
- const TM_CODEX: &str = "---\nname: T\nprovider: codex\n---\nx\n";
491
-
492
- fn role_nomodel(provider: &str) -> String {
493
- format!("---\nname: w\nrole: R\nprovider: {provider}\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nbody\n")
494
- }
495
-
496
- fn agent0(spec: &Value) -> &Value {
497
- match spec.get("agents") {
498
- Some(Value::List(items)) if !items.is_empty() => &items[0],
499
- _ => panic!("spec.agents missing/empty"),
500
- }
501
- }
502
-
503
- fn get_path<'a>(v: &'a Value, keys: &[&str]) -> Option<&'a Value> {
504
- let mut cur = v;
505
- for k in keys {
506
- cur = cur.get(k)?;
507
- }
508
- Some(cur)
509
- }
510
-
511
- fn str_path(spec: &Value, keys: &[&str]) -> String {
512
- get_path(spec, keys)
513
- .and_then(Value::as_str)
514
- .unwrap_or_else(|| panic!("missing string at {keys:?}"))
515
- .to_string()
516
- }
517
-
518
- enum AgentsDir<'a> {
519
- Missing,
520
- File,
521
- WithRole(&'a str),
522
- }
523
-
524
- /// Build `<base>/<parent>/<leaf>/` with optional TEAM.md and a controllable
525
- /// `agents` entry — lets tests pin `team_dir.parent.name` (A3) and the
526
- /// missing-TEAM.md / missing-agents / agents-is-a-file error paths (A11).
527
- fn build_layout(parent: &str, leaf: &str, team_md: Option<&str>, agents: AgentsDir<'_>) -> PathBuf {
528
- let team = unique_base().join(parent).join(leaf);
529
- fs::create_dir_all(&team).unwrap();
530
- if let Some(md) = team_md {
531
- fs::write(team.join("TEAM.md"), md).unwrap();
532
- }
533
- match agents {
534
- AgentsDir::Missing => {}
535
- AgentsDir::File => fs::write(team.join("agents"), "not a dir").unwrap(),
536
- AgentsDir::WithRole(role) => {
537
- fs::create_dir_all(team.join("agents")).unwrap();
538
- fs::write(team.join("agents").join("w.md"), role).unwrap();
539
- }
540
- }
541
- team
542
- }
543
-
544
- // ── A1 model resolution ──
545
-
546
- #[test]
547
- fn team_model_defaults_do_not_fill_role_model() {
548
- // TEAM default_model and provider_models are not implicit role settings.
549
- let tm = "---\nname: T\nprovider: codex\ndefault_model: team-y\nprovider_models:\n codex: pm-z\n---\nx\n";
550
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
551
- let spec = compile_team(&team).unwrap();
552
- assert_eq!(agent0(&spec).get("model"), Some(&Value::Null));
553
- }
554
-
555
- #[test]
556
- fn team_provider_model_aliases_do_not_fill_role_model() {
557
- // TEAM provider-model aliases do not affect an omitted role model.
558
- let tm = "---\nname: T\nprovider: codex\nprovider_models:\n claude_code: cc-v\n---\nx\n";
559
- let team = build_team(tm, &[("w.md", &role_nomodel("claude"))], &[]);
560
- let spec = compile_team(&team).unwrap();
561
- assert_eq!(agent0(&spec).get("model"), Some(&Value::Null));
562
- }
563
-
564
- #[test]
565
- fn claude_role_without_model_keeps_provider_native_default() {
566
- // A missing explicit model stays null for both Claude provider names.
567
- for prov in ["claude", "claude_code"] {
568
- let team = build_team(TM_CODEX, &[("w.md", &role_nomodel(prov))], &[]);
569
- let spec = compile_team(&team).unwrap();
570
- assert_eq!(
571
- agent0(&spec).get("model"),
572
- Some(&Value::Null),
573
- "provider {prov}"
574
- );
575
- }
576
- }
577
-
578
- #[test]
579
- fn fix_a1_model_null_when_provider_absent_from_table() {
580
- // gemini_cli / fake have NO builtin default → model MUST be emitted as null.
581
- for prov in ["gemini_cli", "fake"] {
582
- let team = build_team(TM_CODEX, &[("w.md", &role_nomodel(prov))], &[]);
583
- let spec = compile_team(&team).unwrap();
584
- assert_eq!(
585
- agent0(&spec).get("model"),
586
- Some(&Value::Null),
587
- "provider {prov} → null"
588
- );
589
- }
590
- }
591
-
592
- // ── A2 objective ──
593
-
594
- #[test]
595
- fn fix_a2_objective_falls_back_to_body() {
596
- let tm = "---\nname: T\nprovider: codex\n---\nThis is the body.\n";
597
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
598
- let spec = compile_team(&team).unwrap();
599
- assert_eq!(str_path(&spec, &["team", "objective"]), "This is the body.");
600
- }
601
-
602
- #[test]
603
- fn fix_a2_objective_default_when_no_objective_and_no_body() {
604
- let tm = "---\nname: T\nprovider: codex\n---\n";
605
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
606
- let spec = compile_team(&team).unwrap();
607
- assert_eq!(
608
- str_path(&spec, &["team", "objective"]),
609
- "Team Agent document-driven team."
610
- );
611
- }
612
-
613
- // ── A3 name ──
614
-
615
- #[test]
616
- fn fix_a3_name_falls_back_to_parent_dir_name() {
617
- // no `name` → team_dir.parent.name (NOT a hardcoded "team").
618
- let tm = "---\nprovider: codex\n---\nx\n";
619
- let team = build_layout(
620
- "my-parent-dir",
621
- "leafteam",
622
- Some(tm),
623
- AgentsDir::WithRole(&role_nomodel("codex")),
624
- );
625
- let spec = compile_team(&team).unwrap();
626
- assert_eq!(str_path(&spec, &["team", "name"]), "my-parent-dir");
627
- }
628
-
629
- // ── A4 leader.role ──
630
-
631
- #[test]
632
- fn fix_a4_leader_role_from_team_meta() {
633
- let tm = "---\nname: T\nprovider: codex\nleader_role: Captain\n---\nx\n";
634
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
635
- let spec = compile_team(&team).unwrap();
636
- assert_eq!(str_path(&spec, &["leader", "role"]), "Captain");
637
- }
638
-
639
- // ── A5 session_name + _slug ──
640
-
641
- #[test]
642
- fn fix_a5_session_name_slugifies_team_name() {
643
- // "My Team!" → _slug → "My-Team" → "team-My-Team".
644
- let tm = "---\nname: My Team!\nprovider: codex\n---\nx\n";
645
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
646
- let spec = compile_team(&team).unwrap();
647
- assert_eq!(
648
- str_path(&spec, &["runtime", "session_name"]),
649
- "team-My-Team"
650
- );
651
- }
652
-
653
- #[test]
654
- fn fix_a5_session_name_override_wins() {
655
- let tm = "---\nname: My Team!\nprovider: codex\nsession_name: custom-sess\n---\nx\n";
656
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
657
- let spec = compile_team(&team).unwrap();
658
- assert_eq!(str_path(&spec, &["runtime", "session_name"]), "custom-sess");
659
- }
660
-
661
- // ── A6 tools ──
662
-
663
- #[test]
664
- fn fix_a6_tools_are_transparent_compatibility_metadata() {
665
- let role = "---\nname: w\nrole: R\nprovider: codex\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - shell\n - provider_builtin\n---\nb\n";
666
- let team = build_team(TM_CODEX, &[("w.md", role)], &[]);
667
- let spec = compile_team(&team).expect("tools metadata must not gate compilation");
668
- assert!(agent0(&spec).get("tools").is_none());
669
- }
670
-
671
- #[test]
672
- fn fix_a6_missing_tools_is_allowed() {
673
- let role = "---\nname: w\nrole: R\nprovider: codex\nauth_mode: subscription\ndangerously_skip_permissions: false\n---\nb\n";
674
- let team = build_team(TM_CODEX, &[("w.md", role)], &[]);
675
- compile_team(&team).expect("omitted tools metadata must compile");
676
- }
677
-
678
- #[test]
679
- fn fix_a6_tools_non_list_is_transparent() {
680
- let role = "---\nname: w\nrole: R\nprovider: codex\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools: justastring\n---\nb\n";
681
- let team = build_team(TM_CODEX, &[("w.md", role)], &[]);
682
- compile_team(&team).expect("any YAML tools metadata must compile");
683
- }
684
-
685
- // ── A7 system_prompt inline ──
686
-
687
- #[test]
688
- fn fix_a7_empty_body_inline_falls_back_to_role() {
689
- let role = "---\nname: w\nrole: Reviewer Role\nprovider: codex\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n";
690
- let team = build_team(TM_CODEX, &[("w.md", role)], &[]);
691
- let spec = compile_team(&team).unwrap();
692
- assert_eq!(
693
- str_path(agent0(&spec), &["system_prompt", "inline"]),
694
- "Reviewer Role"
695
- );
696
- }
697
-
698
- // ── A8 auth_mode ──
699
-
700
- #[test]
701
- fn fix_a8_official_api_without_profile_errors() {
702
- // official_api (any non-subscription) without profile MUST NOT silently compile.
703
- let role = "---\nname: w\nrole: R\nprovider: codex\nauth_mode: official_api\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\nb\n";
704
- let team = build_team(TM_CODEX, &[("w.md", role)], &[]);
705
- let err = compile_team(&team).unwrap_err();
706
- assert!(
707
- err.to_string()
708
- .contains("profile is required when auth_mode is 'official_api'"),
709
- "got: {err}"
710
- );
711
- }
712
-
713
- #[test]
714
- fn fix_a8_compatible_api_error_names_the_auth_mode() {
715
- // Full message form (the old test only checked the "profile is required" prefix).
716
- let team = build_team(
717
- TEAM_BASE,
718
- &[("implementer.md", ROLE_COMPATIBLE_NO_PROFILE)],
719
- &[],
720
- );
721
- let err = compile_team(&team).unwrap_err();
722
- assert!(
723
- err.to_string()
724
- .contains("profile is required when auth_mode is 'compatible_api'"),
725
- "got: {err}"
726
- );
727
- }
728
-
729
- // ── A9 bool/int coercion (Python bool()/int() over the simple_yaml value) ──
730
-
731
- #[test]
732
- fn fix_a9_bool_coercion_yes_and_one_are_true() {
733
- for v in ["yes", "1"] {
734
- let tm = format!("---\nname: T\nprovider: codex\nworker_to_worker: {v}\n---\nx\n");
735
- let team = build_team(&tm, &[("w.md", &role_nomodel("codex"))], &[]);
736
- let spec = compile_team(&team).unwrap();
737
- assert_eq!(
738
- get_path(&spec, &["communication", "worker_to_worker"]),
739
- Some(&Value::Bool(true)),
740
- "value {v}"
741
- );
742
- }
743
- }
744
-
745
- #[test]
746
- fn fix_a9_bool_coercion_no_is_python_truthy() {
747
- // FLAG: Python bool("no") is TRUE (only 0/false/False are falsy). The contract
748
- // note said "no->false" but Python golden is no->true; we lock Python.
749
- let tm = "---\nname: T\nprovider: codex\nworker_to_worker: no\n---\nx\n";
750
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
751
- let spec = compile_team(&team).unwrap();
752
- assert_eq!(
753
- get_path(&spec, &["communication", "worker_to_worker"]),
754
- Some(&Value::Bool(true))
755
- );
756
- }
757
-
758
- #[test]
759
- fn fix_a9_int_coercion_of_quoted_string() {
760
- // tick_interval_sec: "5" (a YAML string) → int("5") = 5.
761
- let tm = "---\nname: T\nprovider: codex\ntick_interval_sec: \"5\"\n---\nx\n";
762
- let team = build_team(tm, &[("w.md", &role_nomodel("codex"))], &[]);
763
- let spec = compile_team(&team).unwrap();
764
- assert_eq!(
765
- get_path(&spec, &["runtime", "tick_interval_sec"]),
766
- Some(&Value::Int(5))
767
- );
768
- }
769
-
770
- // ── A10 CRLF normalization ──
771
-
772
- #[test]
773
- fn fix_a10_crlf_role_doc_front_matter_is_parsed() {
774
- // Windows-authored \r\n doc: read_text universal-newlines normalizes before
775
- // the "---\n" check, so the front matter parses (current keeps \r\n → no FM).
776
- let crlf_role = "---\r\nname: crlfworker\r\nrole: R\r\nprovider: codex\r\nauth_mode: subscription\r\ndangerously_skip_permissions: false\r\ntools:\r\n - mcp_team\r\n---\r\n\r\nbody\r\n";
777
- let team = build_team(TM_CODEX, &[("w.md", crlf_role)], &[]);
778
- let spec = compile_team(&team).expect("CRLF role doc must parse its front matter");
779
- assert_eq!(
780
- agent0(&spec).get("id").and_then(Value::as_str),
781
- Some("crlfworker")
782
- );
783
- assert_eq!(
784
- str_path(agent0(&spec), &["system_prompt", "inline"]),
785
- "body"
786
- );
787
- }
788
-
789
- // ── A11 error-message paths ──
790
-
791
- #[test]
792
- fn fix_a11_missing_team_md_message_includes_team_md_path() {
793
- let team = build_layout(
794
- "p",
795
- "teamdir",
796
- None,
797
- AgentsDir::WithRole(&role_nomodel("codex")),
798
- );
799
- let err = compile_team(&team).unwrap_err();
800
- assert!(
801
- err.to_string().contains("/TEAM.md: missing TEAM.md"),
802
- "got: {err}"
803
- );
804
- }
805
-
806
- #[test]
807
- fn fix_a11_missing_agents_dir_message_includes_agents_path() {
808
- let team = build_layout("p", "teamdir", Some(TM_CODEX), AgentsDir::Missing);
809
- let err = compile_team(&team).unwrap_err();
810
- assert!(
811
- err.to_string()
812
- .contains("/agents: missing agents directory"),
813
- "got: {err}"
814
- );
815
- }
816
-
817
- #[test]
818
- fn fix_a11_agents_is_a_file_reports_no_role_docs() {
819
- // Python uses exists() (not is_dir()): agents-as-a-file passes the existence
820
- // gate, then the empty glob → "no role docs found" (path = agents dir).
821
- let team = build_layout("p", "teamdir", Some(TM_CODEX), AgentsDir::File);
822
- let err = compile_team(&team).unwrap_err();
823
- assert!(
824
- err.to_string().contains("/agents: no role docs found"),
825
- "got: {err}"
826
- );
827
- }