@team-agent/installer 0.5.127 → 0.6.0

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 (421) hide show
  1. package/README.md +15 -4
  2. package/README.zh.md +1 -1
  3. package/package.json +4 -8
  4. package/skills/team-agent/SKILL.md +41 -26
  5. package/skills/team-agent/command-coverage.json +170 -184
  6. package/skills/team-agent/docs/reference/team-agent-operator.md +66 -32
  7. package/skills/team-agent/references/recovery-runbook.md +1 -1
  8. package/skills/team-agent/references/team-agent-operator.md +66 -32
  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 -1298
  15. package/crates/team-agent/src/cli/arguments.rs +0 -401
  16. package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
  17. package/crates/team-agent/src/cli/diagnose.rs +0 -1675
  18. package/crates/team-agent/src/cli/emit.rs +0 -2898
  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 -1189
  22. package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -821
  23. package/crates/team-agent/src/cli/intent/tests.rs +0 -691
  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 -6528
  29. package/crates/team-agent/src/cli/models.rs +0 -449
  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/send/coordinator.rs +0 -164
  34. package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
  35. package/crates/team-agent/src/cli/send/persist.rs +0 -192
  36. package/crates/team-agent/src/cli/send/presentation.rs +0 -370
  37. package/crates/team-agent/src/cli/send/resolve.rs +0 -573
  38. package/crates/team-agent/src/cli/send.rs +0 -201
  39. package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
  40. package/crates/team-agent/src/cli/spec.rs +0 -159
  41. package/crates/team-agent/src/cli/status.rs +0 -280
  42. package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
  43. package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
  44. package/crates/team-agent/src/cli/status_port/brief.rs +0 -2043
  45. package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
  46. package/crates/team-agent/src/cli/status_port/format.rs +0 -146
  47. package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
  48. package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
  49. package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
  50. package/crates/team-agent/src/cli/status_port/store.rs +0 -416
  51. package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
  52. package/crates/team-agent/src/cli/status_port.rs +0 -92
  53. package/crates/team-agent/src/cli/tests/base.rs +0 -885
  54. package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
  55. package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
  56. package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -372
  57. package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
  58. package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
  59. package/crates/team-agent/src/cli/tests/mod.rs +0 -137
  60. package/crates/team-agent/src/cli/tests/named_address.rs +0 -760
  61. package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
  62. package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -481
  63. package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
  64. package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
  65. package/crates/team-agent/src/cli/tests/status_send.rs +0 -1091
  66. package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
  67. package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
  68. package/crates/team-agent/src/cli/triage.rs +0 -234
  69. package/crates/team-agent/src/cli/types.rs +0 -591
  70. package/crates/team-agent/src/codex_app_server.rs +0 -546
  71. package/crates/team-agent/src/communication_mode/mod.rs +0 -56
  72. package/crates/team-agent/src/compiler/tests.rs +0 -842
  73. package/crates/team-agent/src/compiler.rs +0 -691
  74. package/crates/team-agent/src/conpty/backend.rs +0 -829
  75. package/crates/team-agent/src/conpty/mod.rs +0 -33
  76. package/crates/team-agent/src/contract_runtime/backend.rs +0 -1610
  77. package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
  78. package/crates/team-agent/src/contract_runtime/config.rs +0 -354
  79. package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -56
  80. package/crates/team-agent/src/contract_runtime/discovery.rs +0 -438
  81. package/crates/team-agent/src/contract_runtime/fork.rs +0 -368
  82. package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
  83. package/crates/team-agent/src/contract_runtime/framework.rs +0 -350
  84. package/crates/team-agent/src/contract_runtime/mcp.rs +0 -399
  85. package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
  86. package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
  87. package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
  88. package/crates/team-agent/src/contract_runtime/registry.rs +0 -589
  89. package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
  90. package/crates/team-agent/src/coordinator/backoff.rs +0 -741
  91. package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
  92. package/crates/team-agent/src/coordinator/health.rs +0 -1185
  93. package/crates/team-agent/src/coordinator/mod.rs +0 -119
  94. package/crates/team-agent/src/coordinator/orphan.rs +0 -110
  95. package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
  96. package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
  97. package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
  98. package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
  99. package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
  100. package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
  101. package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
  102. package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
  103. package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
  104. package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
  105. package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
  106. package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -338
  107. package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
  108. package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
  109. package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
  110. package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -461
  111. package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
  112. package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
  113. package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
  114. package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
  115. package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
  116. package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
  117. package/crates/team-agent/src/coordinator/tick.rs +0 -3112
  118. package/crates/team-agent/src/coordinator/types.rs +0 -540
  119. package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
  120. package/crates/team-agent/src/db/message_store.rs +0 -1585
  121. package/crates/team-agent/src/db/migration.rs +0 -984
  122. package/crates/team-agent/src/db/mod.rs +0 -26
  123. package/crates/team-agent/src/db/schema.rs +0 -663
  124. package/crates/team-agent/src/diagnose/comms.rs +0 -242
  125. package/crates/team-agent/src/diagnose/mod.rs +0 -44
  126. package/crates/team-agent/src/diagnose/orphans.rs +0 -889
  127. package/crates/team-agent/src/event_log.rs +0 -502
  128. package/crates/team-agent/src/fake_worker.rs +0 -303
  129. package/crates/team-agent/src/kill_audit.rs +0 -106
  130. package/crates/team-agent/src/layout/manager.rs +0 -248
  131. package/crates/team-agent/src/layout/mod.rs +0 -36
  132. package/crates/team-agent/src/layout/overlay.rs +0 -134
  133. package/crates/team-agent/src/layout/placement.rs +0 -52
  134. package/crates/team-agent/src/layout/recovery.rs +0 -106
  135. package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
  136. package/crates/team-agent/src/layout/sessions.rs +0 -294
  137. package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
  138. package/crates/team-agent/src/layout/worker_env.rs +0 -721
  139. package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
  140. package/crates/team-agent/src/leader/helpers.rs +0 -178
  141. package/crates/team-agent/src/leader/incident.rs +0 -6
  142. package/crates/team-agent/src/leader/lease.rs +0 -3356
  143. package/crates/team-agent/src/leader/mod.rs +0 -104
  144. package/crates/team-agent/src/leader/owner_bind.rs +0 -400
  145. package/crates/team-agent/src/leader/prompt.rs +0 -905
  146. package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
  147. package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
  148. package/crates/team-agent/src/leader/rediscover.rs +0 -1192
  149. package/crates/team-agent/src/leader/registry.rs +0 -883
  150. package/crates/team-agent/src/leader/start.rs +0 -4500
  151. package/crates/team-agent/src/leader/takeover.rs +0 -65
  152. package/crates/team-agent/src/leader/tests/basics.rs +0 -337
  153. package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
  154. package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
  155. package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
  156. package/crates/team-agent/src/leader/tests/identity.rs +0 -465
  157. package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
  158. package/crates/team-agent/src/leader/tests/idle.rs +0 -113
  159. package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
  160. package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
  161. package/crates/team-agent/src/leader/tests/mod.rs +0 -106
  162. package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -267
  163. package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
  164. package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
  165. package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
  166. package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
  167. package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
  168. package/crates/team-agent/src/leader/types.rs +0 -534
  169. package/crates/team-agent/src/lib.rs +0 -145
  170. package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
  171. package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -848
  172. package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -393
  173. package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
  174. package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -178
  175. package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -82
  176. package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -63
  177. package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
  178. package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
  179. package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
  180. package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -152
  181. package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
  182. package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -629
  183. package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -226
  184. package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
  185. package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5176
  186. package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
  187. package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
  188. package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
  189. package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -450
  190. package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
  191. package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
  192. package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
  193. package/crates/team-agent/src/lifecycle/launch.rs +0 -534
  194. package/crates/team-agent/src/lifecycle/lock.rs +0 -350
  195. package/crates/team-agent/src/lifecycle/mod.rs +0 -79
  196. package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
  197. package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -757
  198. package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
  199. package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2198
  200. package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2052
  201. package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
  202. package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
  203. package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
  204. package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
  205. package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
  206. package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
  207. package/crates/team-agent/src/lifecycle/restart.rs +0 -223
  208. package/crates/team-agent/src/lifecycle/role_config.rs +0 -1205
  209. package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
  210. package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
  211. package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
  212. package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
  213. package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
  214. package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -135
  215. package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1415
  216. package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
  217. package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -396
  218. package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -418
  219. package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2039
  220. package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1298
  221. package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
  222. package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
  223. package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
  224. package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -71
  225. package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
  226. package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
  227. package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -472
  228. package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
  229. package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
  230. package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
  231. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3981
  232. package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
  233. package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
  234. package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
  235. package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
  236. package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
  237. package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
  238. package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -152
  239. package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -182
  240. package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -374
  241. package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -546
  242. package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -31
  243. package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -528
  244. package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -134
  245. package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -333
  246. package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
  247. package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
  248. package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
  249. package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
  250. package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
  251. package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
  252. package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
  253. package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
  254. package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
  255. package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
  256. package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
  257. package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
  258. package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -90
  259. package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
  260. package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
  261. package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
  262. package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
  263. package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
  264. package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
  265. package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
  266. package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -996
  267. package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -827
  268. package/crates/team-agent/src/lifecycle/tests.rs +0 -102
  269. package/crates/team-agent/src/lifecycle/types.rs +0 -861
  270. package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -370
  271. package/crates/team-agent/src/main.rs +0 -52
  272. package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
  273. package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
  274. package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
  275. package/crates/team-agent/src/mcp_server/mod.rs +0 -119
  276. package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
  277. package/crates/team-agent/src/mcp_server/readiness.rs +0 -546
  278. package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -369
  279. package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
  280. package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
  281. package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -168
  282. package/crates/team-agent/src/mcp_server/tests/send.rs +0 -388
  283. package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -343
  284. package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
  285. package/crates/team-agent/src/mcp_server/tests.rs +0 -43
  286. package/crates/team-agent/src/mcp_server/tools.rs +0 -1015
  287. package/crates/team-agent/src/mcp_server/types.rs +0 -396
  288. package/crates/team-agent/src/mcp_server/wire.rs +0 -867
  289. package/crates/team-agent/src/messaging/activity.rs +0 -461
  290. package/crates/team-agent/src/messaging/address.rs +0 -87
  291. package/crates/team-agent/src/messaging/delivery.rs +0 -3785
  292. package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
  293. package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
  294. package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
  295. package/crates/team-agent/src/messaging/helpers.rs +0 -354
  296. package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
  297. package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
  298. package/crates/team-agent/src/messaging/mod.rs +0 -166
  299. package/crates/team-agent/src/messaging/persist.rs +0 -377
  300. package/crates/team-agent/src/messaging/presentation.rs +0 -417
  301. package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
  302. package/crates/team-agent/src/messaging/results.rs +0 -1415
  303. package/crates/team-agent/src/messaging/scheduler.rs +0 -217
  304. package/crates/team-agent/src/messaging/selftest.rs +0 -315
  305. package/crates/team-agent/src/messaging/send.rs +0 -981
  306. package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
  307. package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -551
  308. package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
  309. package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
  310. package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
  311. package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
  312. package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
  313. package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3655
  314. package/crates/team-agent/src/messaging/tests/spine.rs +0 -837
  315. package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
  316. package/crates/team-agent/src/messaging/trust.rs +0 -215
  317. package/crates/team-agent/src/messaging/types.rs +0 -471
  318. package/crates/team-agent/src/messaging/wait.rs +0 -366
  319. package/crates/team-agent/src/messaging/watchers.rs +0 -916
  320. package/crates/team-agent/src/model/enums.rs +0 -356
  321. package/crates/team-agent/src/model/errors.rs +0 -18
  322. package/crates/team-agent/src/model/ids.rs +0 -165
  323. package/crates/team-agent/src/model/mod.rs +0 -29
  324. package/crates/team-agent/src/model/name_similarity.rs +0 -252
  325. package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
  326. package/crates/team-agent/src/model/paths.rs +0 -257
  327. package/crates/team-agent/src/model/routing.rs +0 -387
  328. package/crates/team-agent/src/model/spec.rs +0 -1184
  329. package/crates/team-agent/src/model/task_graph.rs +0 -321
  330. package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
  331. package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
  332. package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
  333. package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
  334. package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
  335. package/crates/team-agent/src/model/yaml/tests.rs +0 -188
  336. package/crates/team-agent/src/model/yaml.rs +0 -802
  337. package/crates/team-agent/src/os_probe.rs +0 -280
  338. package/crates/team-agent/src/packaging/install.rs +0 -219
  339. package/crates/team-agent/src/packaging/migrate.rs +0 -38
  340. package/crates/team-agent/src/packaging/mod.rs +0 -91
  341. package/crates/team-agent/src/packaging/repair.rs +0 -33
  342. package/crates/team-agent/src/packaging/tests.rs +0 -822
  343. package/crates/team-agent/src/packaging/types.rs +0 -417
  344. package/crates/team-agent/src/platform/argv.rs +0 -331
  345. package/crates/team-agent/src/platform/errors.rs +0 -104
  346. package/crates/team-agent/src/platform/file_lock.rs +0 -279
  347. package/crates/team-agent/src/platform/mod.rs +0 -5
  348. package/crates/team-agent/src/platform/process.rs +0 -545
  349. package/crates/team-agent/src/provider/adapter.rs +0 -898
  350. package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
  351. package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
  352. package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
  353. package/crates/team-agent/src/provider/adapters/mod.rs +0 -28
  354. package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
  355. package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
  356. package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
  357. package/crates/team-agent/src/provider/argv_route.rs +0 -405
  358. package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
  359. package/crates/team-agent/src/provider/classify.rs +0 -773
  360. package/crates/team-agent/src/provider/command_helpers.rs +0 -45
  361. package/crates/team-agent/src/provider/faults.rs +0 -165
  362. package/crates/team-agent/src/provider/helpers.rs +0 -52
  363. package/crates/team-agent/src/provider/mod.rs +0 -78
  364. package/crates/team-agent/src/provider/model_catalog.rs +0 -722
  365. package/crates/team-agent/src/provider/session/capture.rs +0 -2631
  366. package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -168
  367. package/crates/team-agent/src/provider/session/context_fork.rs +0 -264
  368. package/crates/team-agent/src/provider/session/mod.rs +0 -36
  369. package/crates/team-agent/src/provider/session/resume.rs +0 -269
  370. package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
  371. package/crates/team-agent/src/provider/session_scan/common.rs +0 -618
  372. package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
  373. package/crates/team-agent/src/provider/session_scan/pi.rs +0 -152
  374. package/crates/team-agent/src/provider/session_scan.rs +0 -61
  375. package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
  376. package/crates/team-agent/src/provider/submit_now.rs +0 -71
  377. package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
  378. package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
  379. package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
  380. package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
  381. package/crates/team-agent/src/provider/tests/adapter.rs +0 -354
  382. package/crates/team-agent/src/provider/tests/classify.rs +0 -201
  383. package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -26
  384. package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
  385. package/crates/team-agent/src/provider/tests/faults.rs +0 -200
  386. package/crates/team-agent/src/provider/tests/idle.rs +0 -140
  387. package/crates/team-agent/src/provider/tests/wire.rs +0 -213
  388. package/crates/team-agent/src/provider/tests.rs +0 -32
  389. package/crates/team-agent/src/provider/types.rs +0 -529
  390. package/crates/team-agent/src/provider/wire.rs +0 -406
  391. package/crates/team-agent/src/redaction.rs +0 -259
  392. package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
  393. package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
  394. package/crates/team-agent/src/state/identity.rs +0 -914
  395. package/crates/team-agent/src/state/identity_keys.rs +0 -132
  396. package/crates/team-agent/src/state/mod.rs +0 -74
  397. package/crates/team-agent/src/state/owner_gate.rs +0 -482
  398. package/crates/team-agent/src/state/ownership.rs +0 -563
  399. package/crates/team-agent/src/state/paths.rs +0 -395
  400. package/crates/team-agent/src/state/persist.rs +0 -3811
  401. package/crates/team-agent/src/state/projection.rs +0 -1508
  402. package/crates/team-agent/src/state/repository/intent.rs +0 -14
  403. package/crates/team-agent/src/state/repository/tests.rs +0 -184
  404. package/crates/team-agent/src/state/repository.rs +0 -866
  405. package/crates/team-agent/src/state/selector.rs +0 -160
  406. package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
  407. package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
  408. package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
  409. package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
  410. package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
  411. package/crates/team-agent/src/tmux_backend/tests.rs +0 -4254
  412. package/crates/team-agent/src/tmux_backend.rs +0 -4527
  413. package/crates/team-agent/src/topology.rs +0 -537
  414. package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
  415. package/crates/team-agent/src/transport/native_input.rs +0 -491
  416. package/crates/team-agent/src/transport/test_support.rs +0 -743
  417. package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
  418. package/crates/team-agent/src/transport/tests/mod.rs +0 -194
  419. package/crates/team-agent/src/transport/tests/wire.rs +0 -574
  420. package/crates/team-agent/src/transport.rs +0 -1655
  421. package/crates/team-agent/src/transport_factory.rs +0 -819
@@ -1,356 +0,0 @@
1
- //!
2
- //! §19 散字符串态 → 穷尽 enum。每个 variant 与 Python 字符串**一一对应**(`#[serde]`
3
- //! rename 到精确字符串),保证 spec/state/event 序列化字节不漂移(§7)。
4
- //!
5
- //! 值全部取自真相源 v0.2.11:`spec.py:13/116/156/172/174/176/229/255`、
6
- //! `profiles/constants.py:6`、`task_graph.py:5-16`、`permissions.py:5-14/44-50`、
7
- //! `display/backend.py:7-9`、`compiler.py:80`。
8
-
9
- use serde::{Deserialize, Serialize};
10
-
11
- /// provider(`SUPPORTED_PROVIDERS` `spec.py:13`)。**血泪 §3/陷阱 #4**:`claude` vs
12
- /// `claude_code` 不能漏归一(原 Python 漏 → take-over 全死)。Rust 穷尽 match 防漏。
13
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
14
- #[serde(rename_all = "snake_case")]
15
- pub enum Provider {
16
- Claude,
17
- ClaudeCode,
18
- Codex,
19
- /// GitHub Copilot CLI(0.3.x 新增)。一期 subscription-only(已登录态),无 fork
20
- /// 能力(caps.fork=false → CapabilityUnsupported),system prompt 走 per-worker
21
- /// AGENTS.md + `COPILOT_CUSTOM_INSTRUCTIONS_DIRS` env(B2 灵魂件降级,§C2)。
22
- Copilot,
23
- GeminiCli,
24
- /// Grok CLI (0.5.67 provider-adapter). Append system prompt via `--rules`,
25
- /// bypass `--always-approve`, session `--session-id`.
26
- Grok,
27
- /// Pi coding agent CLI. Models are selected from its live catalog.
28
- Pi,
29
- Fake,
30
- }
31
-
32
- /// 0.4.x Provider effort MVP: reasoning effort level passed to the provider.
33
- /// Configuration sources (resolution order):
34
- /// 1. role doc front matter `effort: low|medium|high|xhigh|max|ultra`
35
- /// 2. TEAM.md front matter `provider_effort: low|medium|high|xhigh|max|ultra` (except Pi)
36
- /// 3. provider default (framework passes no flag)
37
- ///
38
- /// Provider support:
39
- /// - claude / claude_code: low|medium|high|xhigh|max → `--effort <level>`
40
- /// - codex: low|medium|high|xhigh|max|ultra → `-c model_reasoning_effort=<level>`
41
- /// Ultra adds Codex client delegation to max reasoning; it is not an API effort.
42
- /// - pi: low|medium|high|xhigh|max → `--thinking <level>`
43
- /// - grok: low|medium|high|xhigh → `--effort <level>`; max/ultra rejected
44
- /// - copilot / gemini_cli / fake: low..xhigh ignored with warning; max/ultra rejected
45
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
46
- pub enum ProviderEffort {
47
- #[serde(rename = "low")]
48
- Low,
49
- #[serde(rename = "medium")]
50
- Medium,
51
- #[serde(rename = "high")]
52
- High,
53
- #[serde(rename = "xhigh")]
54
- XHigh,
55
- #[serde(rename = "max")]
56
- Max,
57
- #[serde(rename = "ultra")]
58
- Ultra,
59
- }
60
-
61
- impl ProviderEffort {
62
- /// Parse from a wire string. Returns None on unknown literal.
63
- pub fn parse(value: &str) -> Option<Self> {
64
- match value.trim() {
65
- "low" => Some(Self::Low),
66
- "medium" => Some(Self::Medium),
67
- "high" => Some(Self::High),
68
- "xhigh" => Some(Self::XHigh),
69
- "max" => Some(Self::Max),
70
- "ultra" => Some(Self::Ultra),
71
- _ => None,
72
- }
73
- }
74
-
75
- /// Wire string used by both CLI argv and state serialization.
76
- pub fn as_str(self) -> &'static str {
77
- match self {
78
- Self::Low => "low",
79
- Self::Medium => "medium",
80
- Self::High => "high",
81
- Self::XHigh => "xhigh",
82
- Self::Max => "max",
83
- Self::Ultra => "ultra",
84
- }
85
- }
86
-
87
- /// Native command support: Codex through ultra, Claude/Pi through max,
88
- /// Grok through xhigh. Use resolve_for_provider for admission/ignore policy.
89
- pub fn is_supported_by(self, provider: Provider) -> bool {
90
- match provider {
91
- Provider::Codex => true,
92
- Provider::Claude | Provider::ClaudeCode | Provider::Pi => self != Self::Ultra,
93
- Provider::Grok => !matches!(self, Self::Max | Self::Ultra),
94
- Provider::Copilot | Provider::GeminiCli | Provider::Fake => {
95
- false
96
- }
97
- }
98
- }
99
-
100
- /// One admission policy for compiler, direct specs and runtime commands.
101
- /// Ok(None) preserves the legacy warning-and-ignore providers.
102
- pub fn resolve_for_provider(self, provider: Provider) -> Result<Option<Self>, &'static str> {
103
- if self.is_supported_by(provider) {
104
- Ok(Some(self))
105
- } else if self == Self::Ultra {
106
- Err("effort 'ultra' is only supported by codex")
107
- } else if self == Self::Max {
108
- Err("effort 'max' is only supported by claude/claude_code/codex/pi")
109
- } else {
110
- Ok(None)
111
- }
112
- }
113
- }
114
-
115
- /// auth 模式(`AUTH_MODES` `profiles/constants.py:6`)。
116
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
117
- #[serde(rename_all = "snake_case")]
118
- pub enum AuthMode {
119
- Subscription,
120
- OfficialApi,
121
- CompatibleApi,
122
- }
123
-
124
- /// task 状态(`TASK_STATUSES` `task_graph.py:5-16`)。
125
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
126
- #[serde(rename_all = "snake_case")]
127
- pub enum TaskStatus {
128
- Pending,
129
- Ready,
130
- Running,
131
- Blocked,
132
- NeedsRetry,
133
- Done,
134
- Failed,
135
- Cancelled,
136
- }
137
-
138
- impl TaskStatus {
139
- /// `TERMINAL_TASK_STATUSES = {done, failed, cancelled}`(`task_graph.py:16`)。
140
- pub fn is_terminal(self) -> bool {
141
- matches!(self, Self::Done | Self::Failed | Self::Cancelled)
142
- }
143
- }
144
-
145
- /// result-envelope 顶层 status(`spec.py:156`)。**与 `TaskStatus` 不同集合**(success≠done)。
146
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
147
- #[serde(rename_all = "snake_case")]
148
- pub enum ResultStatus {
149
- Success,
150
- Blocked,
151
- Failed,
152
- Partial,
153
- }
154
-
155
- /// envelope `changes[].kind`(`spec.py:172`)。
156
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
157
- #[serde(rename_all = "snake_case")]
158
- pub enum ChangeKind {
159
- Created,
160
- Modified,
161
- Deleted,
162
- Observed,
163
- }
164
-
165
- /// envelope `tests[].status`(`spec.py:174`)。
166
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
167
- #[serde(rename_all = "snake_case")]
168
- pub enum TestStatus {
169
- Passed,
170
- Failed,
171
- NotRun,
172
- Skipped,
173
- }
174
-
175
- /// `risks[].severity` + task.risk(`spec.py:176`)。
176
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
177
- #[serde(rename_all = "snake_case")]
178
- pub enum RiskSeverity {
179
- Low,
180
- Medium,
181
- High,
182
- }
183
-
184
- /// team mode(`spec.py:116`)。
185
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
186
- #[serde(rename_all = "snake_case")]
187
- pub enum TeamMode {
188
- SupervisorWorker,
189
- SwarmLimited,
190
- }
191
-
192
- /// comm protocol(`spec.py:229`)。
193
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
194
- #[serde(rename_all = "snake_case")]
195
- pub enum CommProtocol {
196
- McpInbox,
197
- FileBus,
198
- }
199
-
200
- /// terminal/session backend(`spec.py:255`)。§8:Windows 无原生 tmux → 能力门在 step 9,
201
- /// enum 在此定义(Windows 原生经 WezTerm 后端,见 transport-backend-design.md)。
202
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
203
- #[serde(rename_all = "snake_case")]
204
- pub enum Backend {
205
- Tmux,
206
- Pty,
207
- }
208
-
209
- /// tmux pane 存活态(`state.py:336-341`)。**`Unknown` 既不可当 dead 也不可当 live**
210
- /// (owner-gate `state.py:382` 用 `!= LIVE`)—— 穷尽 match,不 fallthrough(§11)。
211
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
212
- #[serde(rename_all = "snake_case")]
213
- pub enum PaneLiveness {
214
- Live,
215
- Dead,
216
- Unknown,
217
- }
218
-
219
- /// context 策略 `receive_worker_outputs`。**已知三方 drift**(陷阱 #5):JSON schema 限
220
- /// `{summary_only,structured_only,full_on_request}`,但 compiler 发
221
- /// `business_messages_and_short_summaries`,且 `spec.py` 不校验该值。
222
- /// → 保留 passthrough(`Other`),序列化回原字节,**不拒未知值**(§7)。
223
- #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
224
- #[serde(from = "String", into = "String")]
225
- pub enum ReceiveWorkerOutputs {
226
- SummaryOnly,
227
- StructuredOnly,
228
- FullOnRequest,
229
- /// passthrough:未知值原样保留(含 compiler 的 drift 默认值)。
230
- Other(String),
231
- }
232
-
233
- impl From<String> for ReceiveWorkerOutputs {
234
- fn from(s: String) -> Self {
235
- match s.as_str() {
236
- "summary_only" => Self::SummaryOnly,
237
- "structured_only" => Self::StructuredOnly,
238
- "full_on_request" => Self::FullOnRequest,
239
- _ => Self::Other(s),
240
- }
241
- }
242
- }
243
-
244
- impl From<ReceiveWorkerOutputs> for String {
245
- fn from(v: ReceiveWorkerOutputs) -> Self {
246
- match v {
247
- ReceiveWorkerOutputs::SummaryOnly => "summary_only".to_string(),
248
- ReceiveWorkerOutputs::StructuredOnly => "structured_only".to_string(),
249
- ReceiveWorkerOutputs::FullOnRequest => "full_on_request".to_string(),
250
- ReceiveWorkerOutputs::Other(s) => s,
251
- }
252
- }
253
- }
254
-
255
- #[cfg(test)]
256
- mod tests {
257
- #![allow(clippy::unwrap_used)]
258
- use super::*;
259
-
260
- /// 序列化字节 == Python 精确字符串(挑 rename 不平凡的 variant 逐一钉)。
261
- #[test]
262
- fn enums_serialize_to_exact_python_strings() {
263
- let cases: &[(String, &str)] = &[
264
- (
265
- serde_json::to_string(&Provider::ClaudeCode).unwrap(),
266
- "\"claude_code\"",
267
- ),
268
- (
269
- serde_json::to_string(&Provider::GeminiCli).unwrap(),
270
- "\"gemini_cli\"",
271
- ),
272
- (
273
- serde_json::to_string(&AuthMode::CompatibleApi).unwrap(),
274
- "\"compatible_api\"",
275
- ),
276
- (
277
- serde_json::to_string(&TaskStatus::NeedsRetry).unwrap(),
278
- "\"needs_retry\"",
279
- ),
280
- (
281
- serde_json::to_string(&TestStatus::NotRun).unwrap(),
282
- "\"not_run\"",
283
- ),
284
- (
285
- serde_json::to_string(&TeamMode::SupervisorWorker).unwrap(),
286
- "\"supervisor_worker\"",
287
- ),
288
- (
289
- serde_json::to_string(&CommProtocol::McpInbox).unwrap(),
290
- "\"mcp_inbox\"",
291
- ),
292
- (
293
- serde_json::to_string(&PaneLiveness::Unknown).unwrap(),
294
- "\"unknown\"",
295
- ),
296
- (serde_json::to_string(&Backend::Pty).unwrap(), "\"pty\""),
297
- ];
298
- for (got, want) in cases {
299
- assert_eq!(got, want);
300
- }
301
- }
302
-
303
- #[test]
304
- fn provider_all_five_round_trip() {
305
- for s in ["claude", "claude_code", "codex", "gemini_cli", "fake"] {
306
- let json = format!("\"{s}\"");
307
- let p: Provider = serde_json::from_str(&json).unwrap();
308
- assert_eq!(serde_json::to_string(&p).unwrap(), json);
309
- }
310
- }
311
-
312
- #[test]
313
- fn unknown_provider_string_is_rejected() {
314
- // 与 receive_worker_outputs 不同:Provider 是封闭集,未知值必须 Err(不 passthrough)。
315
- // NOTE: "copilot" 已 0.3.5 加入(design + cr verdict 全 APPROVE),改用一个
316
- // 仍未注册的串验"封闭集"语义。
317
- assert!(serde_json::from_str::<Provider>("\"gibberish\"").is_err());
318
- }
319
-
320
- #[test]
321
- fn task_status_terminal_set() {
322
- for s in [TaskStatus::Done, TaskStatus::Failed, TaskStatus::Cancelled] {
323
- assert!(s.is_terminal());
324
- }
325
- for s in [
326
- TaskStatus::Pending,
327
- TaskStatus::Ready,
328
- TaskStatus::Running,
329
- TaskStatus::Blocked,
330
- TaskStatus::NeedsRetry,
331
- ] {
332
- assert!(!s.is_terminal());
333
- }
334
- }
335
-
336
- #[test]
337
- fn receive_worker_outputs_passthrough_preserves_drift_value() {
338
- // compiler 发的 drift 值必须原样保留(byte 不丢),不被拒。
339
- let drift = "\"business_messages_and_short_summaries\"";
340
- let v: ReceiveWorkerOutputs = serde_json::from_str(drift).unwrap();
341
- assert_eq!(
342
- v,
343
- ReceiveWorkerOutputs::Other("business_messages_and_short_summaries".to_string())
344
- );
345
- assert_eq!(serde_json::to_string(&v).unwrap(), drift);
346
- // 已知值仍映射到 variant。
347
- assert_eq!(
348
- serde_json::from_str::<ReceiveWorkerOutputs>("\"structured_only\"").unwrap(),
349
- ReceiveWorkerOutputs::StructuredOnly
350
- );
351
- assert_eq!(
352
- serde_json::to_string(&ReceiveWorkerOutputs::SummaryOnly).unwrap(),
353
- "\"summary_only\""
354
- );
355
- }
356
- }
@@ -1,18 +0,0 @@
1
- //!
2
- //! 用户面错误。
3
- //!
4
- //! 陷阱 #6(02-model 卡):Python `errors.py` 用自定义 `RuntimeError` **遮蔽**内建
5
- //! `RuntimeError`。Rust 无此坑,但**必须保留两类区分**:`Validation`(spec/envelope/输入)
6
- //! vs `Runtime`(运行期/team 解析),别合并成一个。§12:lib 层用 `thiserror`。
7
-
8
- use thiserror::Error;
9
-
10
- #[derive(Debug, Error, Clone, PartialEq, Eq)]
11
- pub enum ModelError {
12
- /// spec / result-envelope / 输入校验失败 —— 对应 Python `ValidationError`。
13
- #[error("validation error: {0}")]
14
- Validation(String),
15
- /// 运行期 / team 解析 / 身份派生失败 —— 对应 Python(自定义)`RuntimeError`。
16
- #[error("runtime error: {0}")]
17
- Runtime(String),
18
- }
@@ -1,165 +0,0 @@
1
- //!
2
- //! §3 id newtypes —— Python 把 agent/task/team id 全用裸 `str` 混传(route/owner-gate/
3
- //! tasks 串台)。newtype 让"混传"编不过。serde `transparent` 保证序列化字节 == 裸字符串。
4
-
5
- use serde::{Deserialize, Serialize};
6
- use sha2::{Digest, Sha256};
7
-
8
- use crate::model::errors::ModelError;
9
-
10
- /// 透明 String newtype:序列化/反序列化与裸字符串字节一致。
11
- macro_rules! string_newtype {
12
- ($(#[$doc:meta])* $name:ident) => {
13
- $(#[$doc])*
14
- #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
15
- #[serde(transparent)]
16
- pub struct $name(pub String);
17
-
18
- impl $name {
19
- pub fn new(s: impl Into<String>) -> Self {
20
- Self(s.into())
21
- }
22
- pub fn as_str(&self) -> &str {
23
- &self.0
24
- }
25
- }
26
- impl std::fmt::Display for $name {
27
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28
- f.write_str(&self.0)
29
- }
30
- }
31
- impl From<&str> for $name {
32
- fn from(s: &str) -> Self {
33
- Self(s.to_string())
34
- }
35
- }
36
- };
37
- }
38
-
39
- string_newtype!(
40
- /// agent id。leader 默认 `"leader"` 但 spec 可改 —— 不硬编码。
41
- AgentId
42
- );
43
- string_newtype!(
44
- /// task id。deps/assignee/cycle 按 str 比对,易与 AgentId 串台 → newtype 防混。
45
- TaskId
46
- );
47
- string_newtype!(
48
- /// multi-team 指针 key(`team_state_key()`)。
49
- TeamKey
50
- );
51
-
52
- /// owner epoch(§3)。first-time bind 写 0(`state.py:454,461`)。
53
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
54
- #[serde(transparent)]
55
- pub struct OwnerEpoch(pub u64);
56
-
57
- impl OwnerEpoch {
58
- /// first-time leader bind 的 epoch。
59
- pub const FIRST: OwnerEpoch = OwnerEpoch(0);
60
- }
61
-
62
- /// leader 身份/owner epoch 一等公民。公式锁死(`state.py:34-38`),跨 Python/Rust
63
- /// 影子交叉验证靠它,**一字节不能改**(§7)。
64
- #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
65
- #[serde(transparent)]
66
- pub struct LeaderSessionUuid(String);
67
-
68
- impl LeaderSessionUuid {
69
- const SEP: char = '\0';
70
-
71
- /// `sha256(NUL.join([fp, ws, user, team]).encode("utf-8")).hexdigest()[:32]`。
72
- /// 任一输入含 NUL → `Err`(Python `state.py:36-37` raise ValueError)。
73
- pub fn derive(
74
- machine_fingerprint: &str,
75
- workspace_abspath: &str,
76
- os_user: &str,
77
- team_id: &str,
78
- ) -> Result<Self, ModelError> {
79
- let parts = [machine_fingerprint, workspace_abspath, os_user, team_id];
80
- if parts.iter().any(|p| p.contains(Self::SEP)) {
81
- return Err(ModelError::Validation(
82
- "leader_session_uuid inputs must not contain NUL".to_string(),
83
- ));
84
- }
85
- let joined = parts.join("\0");
86
- let digest = Sha256::digest(joined.as_bytes());
87
- let hex: String = digest.iter().map(|b| format!("{b:02x}")).collect();
88
- // hexdigest()[:32] —— sha256 恒 64 hex,take(32) 无 panic 风险。
89
- Ok(LeaderSessionUuid(hex.chars().take(32).collect()))
90
- }
91
-
92
- pub fn as_str(&self) -> &str {
93
- &self.0
94
- }
95
- }
96
-
97
- impl std::fmt::Display for LeaderSessionUuid {
98
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
99
- f.write_str(&self.0)
100
- }
101
- }
102
-
103
- #[cfg(test)]
104
- mod tests {
105
- #![allow(clippy::unwrap_used)]
106
- use super::*;
107
-
108
- // golden 值由 Python 真相源 `derive_leader_session_uuid` 算出(team-agent-public@439bef8)。
109
- // 这是 §4.2「行为 diff 双跑」对该函数的字节锁。
110
- #[test]
111
- fn leader_session_uuid_matches_python_golden() {
112
- assert_eq!(
113
- LeaderSessionUuid::derive("fp-abc", "/ws/proj", "alice", "team-1")
114
- .unwrap()
115
- .as_str(),
116
- "5742d595dbb2f5a16608f68c3050127b"
117
- );
118
- assert_eq!(
119
- LeaderSessionUuid::derive("", "", "", "").unwrap().as_str(),
120
- "709e80c88487a2411e1ee4dfb9f22a86"
121
- );
122
- assert_eq!(
123
- LeaderSessionUuid::derive("m", "/Users/alauda/x", "root", "default")
124
- .unwrap()
125
- .as_str(),
126
- "92c5e32dc5710ea095f956bfb594bc6b"
127
- );
128
- }
129
-
130
- #[test]
131
- fn leader_session_uuid_rejects_nul_in_any_part() {
132
- assert!(LeaderSessionUuid::derive("a\0b", "w", "u", "t").is_err());
133
- assert!(LeaderSessionUuid::derive("w", "x", "u\0", "t").is_err());
134
- }
135
-
136
- #[test]
137
- fn leader_session_uuid_is_32_lowercase_hex() {
138
- let u = LeaderSessionUuid::derive("x", "y", "z", "w").unwrap();
139
- assert_eq!(u.as_str().len(), 32);
140
- assert!(u.as_str().chars().all(|c| c.is_ascii_hexdigit()));
141
- }
142
-
143
- #[test]
144
- fn id_newtypes_serialize_as_bare_string() {
145
- assert_eq!(
146
- serde_json::to_string(&AgentId::new("leader")).unwrap(),
147
- "\"leader\""
148
- );
149
- assert_eq!(
150
- serde_json::from_str::<TaskId>("\"t1\"").unwrap(),
151
- TaskId::new("t1")
152
- );
153
- assert_eq!(TeamKey::from("default").as_str(), "default");
154
- }
155
-
156
- #[test]
157
- fn owner_epoch_first_is_zero_and_serializes_as_int() {
158
- assert_eq!(OwnerEpoch::FIRST.0, 0);
159
- assert_eq!(serde_json::to_string(&OwnerEpoch(3)).unwrap(), "3");
160
- assert_eq!(
161
- serde_json::from_str::<OwnerEpoch>("0").unwrap(),
162
- OwnerEpoch::FIRST
163
- );
164
- }
165
- }
@@ -1,29 +0,0 @@
1
- //!
2
- //! step 2 · model — typed bedrock (REWRITE_PROMPT.md §6 step 2).
3
- //!
4
- //! 纯数据 + 纯函数核心:Python 的散字符串 / `dict[str,Any]` 在此变 §3 id-newtype +
5
- //! §19 穷尽 enum。真相源 `team-agent-public` @ v0.2.11 (439bef8);序列化与 Python
6
- //! **字节级一致**(§7),靠 golden 值 / fixture 双跑锁死。
7
- //!
8
- //! §10 + 02-model 卡 §152:纯层没有 panic 的理由 —— 整个 `model` deny
9
- //! unwrap/expect/panic;所有校验/解析返 `Result`,所有 `Option` 穷尽 match。
10
- //! (clippy tool-lint;`cargo build`/`test` 下被忽略,`cargo clippy` 下强制。)
11
- #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
12
-
13
- pub mod enums;
14
- pub mod errors;
15
- pub mod ids;
16
- // 0.5.45 naming-addressing (design §3.2/§4.1): shared pure name
17
- // similarity ranking helper. crate-private consumer set = cli/emit.rs
18
- // (subcommand hint), cli/named_address.rs (typo candidates),
19
- // cli/send.rs (positional adapter), mcp_server/tools.rs (owner-scoped
20
- // peer suggestions). Never a routing authority — advisory only.
21
- pub(crate) mod name_similarity;
22
- pub mod pane_authority_refusal;
23
- pub mod paths;
24
- pub mod routing;
25
- pub mod spec;
26
- pub mod task_graph;
27
- pub mod yaml;
28
-
29
- pub use errors::ModelError;