@team-agent/installer 0.5.128 → 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.
- package/README.md +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/schedule.rs +0 -175
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -156
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3024
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1527
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/direct_delivery.rs +0 -368
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/inbox_store.rs +0 -169
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -557
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -889
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3727
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -336
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -167
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/reminders.rs +0 -316
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -223
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -472
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -708
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -177
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -394
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,679 +0,0 @@
|
|
|
1
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
2
|
-
|
|
3
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
4
|
-
mod hermetic_guard;
|
|
5
|
-
#[allow(dead_code)]
|
|
6
|
-
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
7
|
-
|
|
8
|
-
use std::collections::{BTreeMap, VecDeque};
|
|
9
|
-
use std::path::{Path, PathBuf};
|
|
10
|
-
use std::process::Command;
|
|
11
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
12
|
-
use std::sync::{Arc, Mutex};
|
|
13
|
-
|
|
14
|
-
use serde_json::{json, Value};
|
|
15
|
-
use serial_test::{file_serial, serial};
|
|
16
|
-
use team_agent::lifecycle::{launch_with_transport, restart_with_transport};
|
|
17
|
-
use team_agent::state::persist::{load_runtime_state, save_runtime_state};
|
|
18
|
-
use team_agent::tmux_backend::TmuxBackend;
|
|
19
|
-
use team_agent::transport::{
|
|
20
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
21
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, PaneLiveness, SessionName,
|
|
22
|
-
SetEnvOutcome, SpawnResult, SubmitVerification, Target, Transport, TransportError,
|
|
23
|
-
TurnVerification, WindowName,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
#[test]
|
|
27
|
-
#[ignore = "real-machine: restart/session liveness lifecycle gate"]
|
|
28
|
-
#[serial(env)]
|
|
29
|
-
fn restart_rechecks_session_liveness_before_spawning_second_worker() {
|
|
30
|
-
let fixture = RestartFixture::new("restart-liveness-recording", &["alpha", "bravo"]);
|
|
31
|
-
fixture.seed_resumable_state_with_stale_receiver();
|
|
32
|
-
let _home = HomeGuard::set(&fixture.home());
|
|
33
|
-
let transport = RestartLivenessTransport::new();
|
|
34
|
-
|
|
35
|
-
let result = restart_with_transport(&fixture.team, false, None, &transport);
|
|
36
|
-
let records = transport.spawn_records();
|
|
37
|
-
|
|
38
|
-
assert_eq!(
|
|
39
|
-
records.len(),
|
|
40
|
-
1,
|
|
41
|
-
"after alpha spawn_first reports success but the recreated session disappears, restart must stop before spawning bravo; result={result:?} records={records:?}"
|
|
42
|
-
);
|
|
43
|
-
assert_eq!(
|
|
44
|
-
records[0].kind, "spawn_first",
|
|
45
|
-
"alpha must be the only spawn and must recreate the session; records={records:?}"
|
|
46
|
-
);
|
|
47
|
-
assert!(
|
|
48
|
-
records.iter().all(|record| record.kind != "spawn_into"),
|
|
49
|
-
"restart must not call spawn_into/new-window for bravo against a dead session; result={result:?} records={records:?}"
|
|
50
|
-
);
|
|
51
|
-
let text = format!("{result:?}");
|
|
52
|
-
assert!(
|
|
53
|
-
text.contains("session_disappeared_after_spawn") || text.contains("provider_resume_exited"),
|
|
54
|
-
"restart must fail with an explicit first-agent/session liveness error, not a later tmux no-server error; result={result:?} records={records:?}"
|
|
55
|
-
);
|
|
56
|
-
assert!(
|
|
57
|
-
text.contains("alpha"),
|
|
58
|
-
"restart error must name the first resumed agent whose session disappeared; result={result:?}"
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
#[test]
|
|
63
|
-
#[ignore = "real-machine: restart/session liveness lifecycle gate"]
|
|
64
|
-
#[serial(env)]
|
|
65
|
-
fn restart_partial_failure_clears_stale_receiver_and_does_not_claim_running_without_pane() {
|
|
66
|
-
let fixture = RestartFixture::new("restart-liveness-state", &["alpha", "bravo"]);
|
|
67
|
-
fixture.seed_resumable_state_with_stale_receiver();
|
|
68
|
-
let _home = HomeGuard::set(&fixture.home());
|
|
69
|
-
let transport = RestartLivenessTransport::new();
|
|
70
|
-
|
|
71
|
-
let _ = restart_with_transport(&fixture.team, false, None, &transport);
|
|
72
|
-
let state = load_runtime_state(&fixture.team).unwrap();
|
|
73
|
-
|
|
74
|
-
assert!(
|
|
75
|
-
state.pointer("/leader_receiver/status").and_then(Value::as_str) != Some("attached"),
|
|
76
|
-
"after restart kills the session and rebuild fails, state must not leave leader_receiver.status=attached to a dead pane; state={state}"
|
|
77
|
-
);
|
|
78
|
-
for agent in ["alpha", "bravo"] {
|
|
79
|
-
let row = state
|
|
80
|
-
.pointer(&format!("/agents/{agent}"))
|
|
81
|
-
.unwrap_or_else(|| panic!("agent row exists for {agent}; state={state}"));
|
|
82
|
-
let has_session = row.get("session_id").and_then(Value::as_str).is_some();
|
|
83
|
-
let running_without_pane = row.get("status").and_then(Value::as_str) == Some("running")
|
|
84
|
-
&& row.get("pane_id").and_then(Value::as_str).is_none();
|
|
85
|
-
assert!(
|
|
86
|
-
!(has_session && running_without_pane),
|
|
87
|
-
"restart must not treat session_id without a live pane binding as successful restart; agent={agent} row={row} state={state}"
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
#[test]
|
|
93
|
-
#[ignore = "real-machine: launch pane identity lifecycle gate"]
|
|
94
|
-
fn launch_persists_real_pane_id_even_when_pane_pid_is_unavailable() {
|
|
95
|
-
let fixture = RestartFixture::new("restart-liveness-pane-id", &["alpha"]);
|
|
96
|
-
let transport = LaunchPaneIdTransport::new();
|
|
97
|
-
|
|
98
|
-
launch_with_transport(
|
|
99
|
-
&fixture.team.join("team.spec.yaml"),
|
|
100
|
-
false,
|
|
101
|
-
true,
|
|
102
|
-
true,
|
|
103
|
-
&transport,
|
|
104
|
-
)
|
|
105
|
-
.expect("launch should reach fake transport spawn");
|
|
106
|
-
|
|
107
|
-
let state = load_runtime_state(&fixture.root).unwrap();
|
|
108
|
-
assert_eq!(
|
|
109
|
-
state.pointer("/agents/alpha/pane_id").and_then(Value::as_str),
|
|
110
|
-
Some("%0"),
|
|
111
|
-
"launch must persist the real %pane_id returned by spawn even when pane_pid/list_targets is unavailable; state={state}"
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
#[test]
|
|
116
|
-
#[ignore = "real-machine: needs real tmux/binary; fake copilot exits first resumed worker to reproduce no-server restart"]
|
|
117
|
-
#[file_serial(tmux)]
|
|
118
|
-
fn real_tmux_restart_names_first_resume_agent_when_first_resume_exits_before_second_spawn() {
|
|
119
|
-
let fixture = RestartFixture::new("restart-liveness-real-tmux", &["alpha", "bravo"]);
|
|
120
|
-
fixture.seed_resumable_state_with_stale_receiver();
|
|
121
|
-
let _cleanup = TmuxCleanup::new(&fixture.team);
|
|
122
|
-
let fake_bin = fixture.install_fake_copilot_that_exits_alpha_resume();
|
|
123
|
-
|
|
124
|
-
let output = Command::new(crate::lifecycle::tests::test_binary_path())
|
|
125
|
-
.args([
|
|
126
|
-
"restart",
|
|
127
|
-
"--workspace",
|
|
128
|
-
fixture.team.to_str().unwrap(),
|
|
129
|
-
"--json",
|
|
130
|
-
])
|
|
131
|
-
.env(
|
|
132
|
-
"PATH",
|
|
133
|
-
format!(
|
|
134
|
-
"{}:{}",
|
|
135
|
-
fake_bin.display(),
|
|
136
|
-
std::env::var("PATH").unwrap_or_default()
|
|
137
|
-
),
|
|
138
|
-
)
|
|
139
|
-
.env("HOME", fixture.home())
|
|
140
|
-
.env("COPILOT_FAKE_LOG", fixture.root.join("fake-copilot.log"))
|
|
141
|
-
.output()
|
|
142
|
-
.expect("run team-agent restart");
|
|
143
|
-
let stdout = String::from_utf8_lossy(&output.stdout);
|
|
144
|
-
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
145
|
-
let combined = format!("{stdout}\n{stderr}");
|
|
146
|
-
|
|
147
|
-
assert!(
|
|
148
|
-
!output.status.success(),
|
|
149
|
-
"fixture expects first resumed copilot process to exit and restart to fail honestly; stdout={stdout} stderr={stderr}"
|
|
150
|
-
);
|
|
151
|
-
assert!(
|
|
152
|
-
combined.contains("alpha")
|
|
153
|
-
&& (combined.contains("session_disappeared_after_spawn")
|
|
154
|
-
|| combined.contains("provider_resume_exited")),
|
|
155
|
-
"real tmux restart must name first resumed agent/session disappearance, not only a later transport failure; stdout={stdout} stderr={stderr}"
|
|
156
|
-
);
|
|
157
|
-
assert!(
|
|
158
|
-
!(combined.contains("bravo") && combined.contains("no server running")),
|
|
159
|
-
"restart must not continue to bravo new-window against a dead server; stdout={stdout} stderr={stderr}"
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
#[derive(Clone, Debug)]
|
|
164
|
-
#[allow(dead_code)]
|
|
165
|
-
struct SpawnRecord {
|
|
166
|
-
kind: String,
|
|
167
|
-
window: String,
|
|
168
|
-
argv: Vec<String>,
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
#[derive(Clone, Default)]
|
|
172
|
-
struct RestartLivenessTransport {
|
|
173
|
-
inner: Arc<Mutex<RestartTransportState>>,
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
#[derive(Default)]
|
|
177
|
-
struct RestartTransportState {
|
|
178
|
-
has_session_answers: VecDeque<bool>,
|
|
179
|
-
spawns: Vec<SpawnRecord>,
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
impl RestartLivenessTransport {
|
|
183
|
-
fn new() -> Self {
|
|
184
|
-
let mut has_session_answers = VecDeque::new();
|
|
185
|
-
has_session_answers.push_back(true);
|
|
186
|
-
Self {
|
|
187
|
-
inner: Arc::new(Mutex::new(RestartTransportState {
|
|
188
|
-
has_session_answers,
|
|
189
|
-
spawns: Vec::new(),
|
|
190
|
-
})),
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
fn spawn_records(&self) -> Vec<SpawnRecord> {
|
|
195
|
-
self.inner.lock().unwrap().spawns.clone()
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
fn record_spawn(
|
|
199
|
-
&self,
|
|
200
|
-
kind: &str,
|
|
201
|
-
session: &SessionName,
|
|
202
|
-
window: &WindowName,
|
|
203
|
-
argv: &[String],
|
|
204
|
-
) -> Result<SpawnResult, TransportError> {
|
|
205
|
-
let mut inner = self.inner.lock().unwrap();
|
|
206
|
-
inner.spawns.push(SpawnRecord {
|
|
207
|
-
kind: kind.to_string(),
|
|
208
|
-
window: window.as_str().to_string(),
|
|
209
|
-
argv: argv.to_vec(),
|
|
210
|
-
});
|
|
211
|
-
if kind == "spawn_into" {
|
|
212
|
-
return Err(TransportError::MuxUnavailable {
|
|
213
|
-
backend: BackendKind::Tmux,
|
|
214
|
-
detail: format!(
|
|
215
|
-
"session disappeared after alpha resume; attempted new-window for {}",
|
|
216
|
-
window.as_str()
|
|
217
|
-
),
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
Ok(SpawnResult {
|
|
221
|
-
pane_id: PaneId::new("%0"),
|
|
222
|
-
session: session.clone(),
|
|
223
|
-
window: window.clone(),
|
|
224
|
-
child_pid: None,
|
|
225
|
-
})
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
impl Transport for RestartLivenessTransport {
|
|
230
|
-
fn kind(&self) -> BackendKind {
|
|
231
|
-
BackendKind::Tmux
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
fn spawn_first(
|
|
235
|
-
&self,
|
|
236
|
-
session: &SessionName,
|
|
237
|
-
window: &WindowName,
|
|
238
|
-
argv: &[String],
|
|
239
|
-
_cwd: &Path,
|
|
240
|
-
_env: &BTreeMap<String, String>,
|
|
241
|
-
) -> Result<SpawnResult, TransportError> {
|
|
242
|
-
self.record_spawn("spawn_first", session, window, argv)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
fn spawn_into(
|
|
246
|
-
&self,
|
|
247
|
-
session: &SessionName,
|
|
248
|
-
window: &WindowName,
|
|
249
|
-
argv: &[String],
|
|
250
|
-
_cwd: &Path,
|
|
251
|
-
_env: &BTreeMap<String, String>,
|
|
252
|
-
) -> Result<SpawnResult, TransportError> {
|
|
253
|
-
self.record_spawn("spawn_into", session, window, argv)
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
257
|
-
Ok(self
|
|
258
|
-
.inner
|
|
259
|
-
.lock()
|
|
260
|
-
.unwrap()
|
|
261
|
-
.has_session_answers
|
|
262
|
-
.pop_front()
|
|
263
|
-
.unwrap_or(false))
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
|
|
267
|
-
Ok(())
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
271
|
-
Ok(Vec::new())
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
275
|
-
Ok(Vec::new())
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
fn query(&self, _target: &Target, field: PaneField) -> Result<Option<String>, TransportError> {
|
|
279
|
-
Ok(match field {
|
|
280
|
-
PaneField::PaneId => Some("%0".to_string()),
|
|
281
|
-
PaneField::SessionName => Some("team-ctxteam".to_string()),
|
|
282
|
-
_ => None,
|
|
283
|
-
})
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
fn liveness(&self, _pane: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
287
|
-
Ok(PaneLiveness::Live)
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
fn inject(
|
|
291
|
-
&self,
|
|
292
|
-
_target: &Target,
|
|
293
|
-
_payload: &InjectPayload,
|
|
294
|
-
_submit: Key,
|
|
295
|
-
_bracketed: bool,
|
|
296
|
-
) -> Result<InjectReport, TransportError> {
|
|
297
|
-
Ok(inject_report())
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
301
|
-
Ok(())
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
fn capture(
|
|
305
|
-
&self,
|
|
306
|
-
_target: &Target,
|
|
307
|
-
range: CaptureRange,
|
|
308
|
-
) -> Result<CapturedText, TransportError> {
|
|
309
|
-
Ok(CapturedText {
|
|
310
|
-
text: String::new(),
|
|
311
|
-
range,
|
|
312
|
-
})
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
fn set_session_env(
|
|
316
|
-
&self,
|
|
317
|
-
_session: &SessionName,
|
|
318
|
-
_key: &str,
|
|
319
|
-
_value: &str,
|
|
320
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
321
|
-
Ok(SetEnvOutcome::Applied)
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
|
|
325
|
-
Ok(())
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
329
|
-
Ok(AttachOutcome::Attached)
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
#[derive(Clone, Default)]
|
|
334
|
-
struct LaunchPaneIdTransport {
|
|
335
|
-
spawns: Arc<Mutex<Vec<SpawnRecord>>>,
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
impl LaunchPaneIdTransport {
|
|
339
|
-
fn new() -> Self {
|
|
340
|
-
Self::default()
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
impl Transport for LaunchPaneIdTransport {
|
|
345
|
-
fn kind(&self) -> BackendKind {
|
|
346
|
-
BackendKind::Tmux
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
fn spawn_first(
|
|
350
|
-
&self,
|
|
351
|
-
session: &SessionName,
|
|
352
|
-
window: &WindowName,
|
|
353
|
-
argv: &[String],
|
|
354
|
-
_cwd: &Path,
|
|
355
|
-
_env: &BTreeMap<String, String>,
|
|
356
|
-
) -> Result<SpawnResult, TransportError> {
|
|
357
|
-
self.spawns.lock().unwrap().push(SpawnRecord {
|
|
358
|
-
kind: "spawn_first".to_string(),
|
|
359
|
-
window: window.as_str().to_string(),
|
|
360
|
-
argv: argv.to_vec(),
|
|
361
|
-
});
|
|
362
|
-
Ok(SpawnResult {
|
|
363
|
-
pane_id: PaneId::new("%0"),
|
|
364
|
-
session: session.clone(),
|
|
365
|
-
window: window.clone(),
|
|
366
|
-
child_pid: None,
|
|
367
|
-
})
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
fn spawn_into(
|
|
371
|
-
&self,
|
|
372
|
-
session: &SessionName,
|
|
373
|
-
window: &WindowName,
|
|
374
|
-
argv: &[String],
|
|
375
|
-
_cwd: &Path,
|
|
376
|
-
_env: &BTreeMap<String, String>,
|
|
377
|
-
) -> Result<SpawnResult, TransportError> {
|
|
378
|
-
self.spawns.lock().unwrap().push(SpawnRecord {
|
|
379
|
-
kind: "spawn_into".to_string(),
|
|
380
|
-
window: window.as_str().to_string(),
|
|
381
|
-
argv: argv.to_vec(),
|
|
382
|
-
});
|
|
383
|
-
Ok(SpawnResult {
|
|
384
|
-
pane_id: PaneId::new("%1"),
|
|
385
|
-
session: session.clone(),
|
|
386
|
-
window: window.clone(),
|
|
387
|
-
child_pid: None,
|
|
388
|
-
})
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
392
|
-
Ok(false)
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
396
|
-
Ok(Vec::new())
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
fn list_windows(&self, session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
400
|
-
let _ = session;
|
|
401
|
-
Ok(self
|
|
402
|
-
.spawns
|
|
403
|
-
.lock()
|
|
404
|
-
.unwrap()
|
|
405
|
-
.iter()
|
|
406
|
-
.map(|record| WindowName::new(record.window.as_str()))
|
|
407
|
-
.collect())
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
fn query(&self, _target: &Target, field: PaneField) -> Result<Option<String>, TransportError> {
|
|
411
|
-
Ok(match field {
|
|
412
|
-
PaneField::PaneId => Some("%0".to_string()),
|
|
413
|
-
PaneField::SessionName => Some("team-ctxteam".to_string()),
|
|
414
|
-
_ => None,
|
|
415
|
-
})
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
fn liveness(&self, _pane: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
419
|
-
Ok(PaneLiveness::Live)
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
fn inject(
|
|
423
|
-
&self,
|
|
424
|
-
_target: &Target,
|
|
425
|
-
_payload: &InjectPayload,
|
|
426
|
-
_submit: Key,
|
|
427
|
-
_bracketed: bool,
|
|
428
|
-
) -> Result<InjectReport, TransportError> {
|
|
429
|
-
Ok(inject_report())
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
433
|
-
Ok(())
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
fn capture(
|
|
437
|
-
&self,
|
|
438
|
-
_target: &Target,
|
|
439
|
-
range: CaptureRange,
|
|
440
|
-
) -> Result<CapturedText, TransportError> {
|
|
441
|
-
Ok(CapturedText {
|
|
442
|
-
text: String::new(),
|
|
443
|
-
range,
|
|
444
|
-
})
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
fn set_session_env(
|
|
448
|
-
&self,
|
|
449
|
-
_session: &SessionName,
|
|
450
|
-
_key: &str,
|
|
451
|
-
_value: &str,
|
|
452
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
453
|
-
Ok(SetEnvOutcome::Applied)
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
|
|
457
|
-
Ok(())
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
|
|
461
|
-
Ok(())
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
465
|
-
Ok(AttachOutcome::Attached)
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
fn inject_report() -> InjectReport {
|
|
470
|
-
InjectReport {
|
|
471
|
-
stage_reached: InjectStage::Submit,
|
|
472
|
-
inject_verification: InjectVerification::NoToken,
|
|
473
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
474
|
-
turn_verification: TurnVerification::NotRequired,
|
|
475
|
-
attempts: 1,
|
|
476
|
-
submit_diagnostics: None,
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
struct RestartFixture {
|
|
481
|
-
root: PathBuf,
|
|
482
|
-
team: PathBuf,
|
|
483
|
-
agents: Vec<String>,
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
impl RestartFixture {
|
|
487
|
-
fn new(tag: &str, agents: &[&str]) -> Self {
|
|
488
|
-
let root = tmp_dir(tag);
|
|
489
|
-
let team = root.join("teamdir");
|
|
490
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
491
|
-
std::fs::write(
|
|
492
|
-
team.join("TEAM.md"),
|
|
493
|
-
"---\nname: ctxteam\nobjective: Restart liveness contract.\nprovider: codex\n---\n\nTeam.\n",
|
|
494
|
-
)
|
|
495
|
-
.unwrap();
|
|
496
|
-
for agent in agents {
|
|
497
|
-
std::fs::write(
|
|
498
|
-
team.join("agents").join(format!("{agent}.md")),
|
|
499
|
-
format!(
|
|
500
|
-
"---\nname: {agent}\nrole: Worker {agent}\nprovider: copilot\nmodel: gpt-5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
501
|
-
),
|
|
502
|
-
)
|
|
503
|
-
.unwrap();
|
|
504
|
-
}
|
|
505
|
-
let spec = team_agent::compiler::compile_team(&team).unwrap();
|
|
506
|
-
std::fs::write(
|
|
507
|
-
team.join("team.spec.yaml"),
|
|
508
|
-
team_agent::model::yaml::dumps(&spec),
|
|
509
|
-
)
|
|
510
|
-
.unwrap();
|
|
511
|
-
Self {
|
|
512
|
-
root,
|
|
513
|
-
team,
|
|
514
|
-
agents: agents.iter().map(|agent| (*agent).to_string()).collect(),
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
fn seed_resumable_state_with_stale_receiver(&self) {
|
|
519
|
-
let agents = self
|
|
520
|
-
.agents
|
|
521
|
-
.iter()
|
|
522
|
-
.map(|agent| {
|
|
523
|
-
(
|
|
524
|
-
agent.clone(),
|
|
525
|
-
json!({
|
|
526
|
-
"status": "running",
|
|
527
|
-
"provider": "copilot",
|
|
528
|
-
"role": format!("Worker {agent}"),
|
|
529
|
-
"tools": ["mcp_team"],
|
|
530
|
-
"window": agent,
|
|
531
|
-
"owner_team_id": "ctxteam",
|
|
532
|
-
"session_id": format!("session-{agent}"),
|
|
533
|
-
"rollout_path": self.root.join(format!("{agent}.jsonl")).to_string_lossy().to_string(),
|
|
534
|
-
"spawn_cwd": self.team.to_string_lossy().to_string(),
|
|
535
|
-
"spawned_at": "2026-06-08T00:00:00+00:00",
|
|
536
|
-
"first_send_at": "2026-06-08T00:01:00+00:00"
|
|
537
|
-
}),
|
|
538
|
-
)
|
|
539
|
-
})
|
|
540
|
-
.collect::<serde_json::Map<_, _>>();
|
|
541
|
-
for agent in &self.agents {
|
|
542
|
-
std::fs::write(self.root.join(format!("{agent}.jsonl")), "{}\n").unwrap();
|
|
543
|
-
}
|
|
544
|
-
save_runtime_state(
|
|
545
|
-
&self.team,
|
|
546
|
-
&json!({
|
|
547
|
-
"active_team_key": "ctxteam",
|
|
548
|
-
"team_dir": self.team.to_string_lossy().to_string(),
|
|
549
|
-
"spec_path": self.team.join("team.spec.yaml").to_string_lossy().to_string(),
|
|
550
|
-
"session_name": "team-ctxteam",
|
|
551
|
-
"leader_receiver": {
|
|
552
|
-
"mode": "direct_tmux",
|
|
553
|
-
"status": "attached",
|
|
554
|
-
"pane_id": "%leader",
|
|
555
|
-
"provider": "claude",
|
|
556
|
-
"owner_epoch": 7
|
|
557
|
-
},
|
|
558
|
-
"agents": agents
|
|
559
|
-
}),
|
|
560
|
-
)
|
|
561
|
-
.unwrap();
|
|
562
|
-
self.seed_copilot_session_store();
|
|
563
|
-
seed_healthy_coordinator(&self.team);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
/// Fixture HOME: copilot resume backing is the `sessions` row in
|
|
567
|
-
/// `$HOME/.copilot/session-store.db`.
|
|
568
|
-
fn home(&self) -> PathBuf {
|
|
569
|
-
self.root.join("home")
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
fn seed_copilot_session_store(&self) {
|
|
573
|
-
let db = self.home().join(".copilot").join("session-store.db");
|
|
574
|
-
std::fs::create_dir_all(db.parent().unwrap()).unwrap();
|
|
575
|
-
let conn = rusqlite::Connection::open(db).unwrap();
|
|
576
|
-
conn.execute_batch(
|
|
577
|
-
"create table if not exists sessions (id text primary key, cwd text, created_at text);",
|
|
578
|
-
)
|
|
579
|
-
.unwrap();
|
|
580
|
-
for agent in &self.agents {
|
|
581
|
-
conn.execute(
|
|
582
|
-
"insert or replace into sessions(id, cwd, created_at) values (?1, ?2, '2026-06-08T00:00:00Z')",
|
|
583
|
-
rusqlite::params![format!("session-{agent}"), self.team.to_string_lossy()],
|
|
584
|
-
)
|
|
585
|
-
.unwrap();
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
fn install_fake_copilot_that_exits_alpha_resume(&self) -> PathBuf {
|
|
590
|
-
let bin = self.root.join("fake-bin");
|
|
591
|
-
std::fs::create_dir_all(&bin).unwrap();
|
|
592
|
-
let script = bin.join("copilot");
|
|
593
|
-
std::fs::write(
|
|
594
|
-
&script,
|
|
595
|
-
r#"#!/bin/sh
|
|
596
|
-
echo "$@" >> "${COPILOT_FAKE_LOG:-/tmp/team-agent-fake-copilot.log}"
|
|
597
|
-
case "$*" in
|
|
598
|
-
"mcp list") exit 0 ;;
|
|
599
|
-
*session-alpha*) exit 0 ;;
|
|
600
|
-
*) sleep 30 ;;
|
|
601
|
-
esac
|
|
602
|
-
"#,
|
|
603
|
-
)
|
|
604
|
-
.unwrap();
|
|
605
|
-
#[cfg(unix)]
|
|
606
|
-
{
|
|
607
|
-
use std::os::unix::fs::PermissionsExt;
|
|
608
|
-
std::fs::set_permissions(&script, std::fs::Permissions::from_mode(0o755)).unwrap();
|
|
609
|
-
}
|
|
610
|
-
bin
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
struct HomeGuard(Option<std::ffi::OsString>);
|
|
615
|
-
|
|
616
|
-
impl HomeGuard {
|
|
617
|
-
fn set(home: &Path) -> Self {
|
|
618
|
-
let previous = std::env::var_os("HOME");
|
|
619
|
-
std::env::set_var("HOME", home);
|
|
620
|
-
Self(previous)
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
impl Drop for HomeGuard {
|
|
625
|
-
fn drop(&mut self) {
|
|
626
|
-
match self.0.take() {
|
|
627
|
-
Some(previous) => std::env::set_var("HOME", previous),
|
|
628
|
-
None => std::env::remove_var("HOME"),
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
struct TmuxCleanup {
|
|
634
|
-
workspace: PathBuf,
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
impl TmuxCleanup {
|
|
638
|
-
fn new(workspace: &Path) -> Self {
|
|
639
|
-
Self {
|
|
640
|
-
workspace: workspace.to_path_buf(),
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
impl Drop for TmuxCleanup {
|
|
646
|
-
fn drop(&mut self) {
|
|
647
|
-
TmuxBackend::for_workspace(&self.workspace).kill_server();
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
fn seed_healthy_coordinator(workspace: &Path) {
|
|
652
|
-
let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
|
|
653
|
-
std::fs::create_dir_all(team_agent::model::paths::runtime_dir(workspace.as_path())).unwrap();
|
|
654
|
-
let _ = team_agent::message_store::MessageStore::open(workspace.as_path()).unwrap();
|
|
655
|
-
let pid = team_agent::coordinator::Pid::new(std::process::id());
|
|
656
|
-
team_agent::coordinator::write_coordinator_metadata(
|
|
657
|
-
&workspace,
|
|
658
|
-
pid,
|
|
659
|
-
team_agent::coordinator::MetadataSource::Boot,
|
|
660
|
-
)
|
|
661
|
-
.unwrap();
|
|
662
|
-
std::fs::write(
|
|
663
|
-
team_agent::coordinator::coordinator_pid_path(&workspace),
|
|
664
|
-
pid.to_string(),
|
|
665
|
-
)
|
|
666
|
-
.unwrap();
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
fn tmp_dir(tag: &str) -> PathBuf {
|
|
670
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
671
|
-
let dir = std::env::temp_dir().join(format!(
|
|
672
|
-
"ta-rs-{tag}-{}-{}",
|
|
673
|
-
std::process::id(),
|
|
674
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
675
|
-
));
|
|
676
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
677
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
678
|
-
std::fs::canonicalize(dir).unwrap()
|
|
679
|
-
}
|