@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.
- package/README.md +15 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +41 -26
- package/skills/team-agent/command-coverage.json +170 -184
- package/skills/team-agent/docs/reference/team-agent-operator.md +66 -32
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +66 -32
- 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 -1298
- package/crates/team-agent/src/cli/arguments.rs +0 -401
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1675
- package/crates/team-agent/src/cli/emit.rs +0 -2898
- 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 -1189
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -821
- package/crates/team-agent/src/cli/intent/tests.rs +0 -691
- 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 -6528
- package/crates/team-agent/src/cli/models.rs +0 -449
- 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/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 -192
- 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 -201
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -159
- 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 -2043
- 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 -372
- 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 -760
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -481
- 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 -1091
- 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 -842
- package/crates/team-agent/src/compiler.rs +0 -691
- 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 -1610
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -354
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -56
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -438
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -368
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -350
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -399
- 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 -589
- 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 -338
- 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 -461
- 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 -3112
- 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 -1585
- 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/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- 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 -883
- package/crates/team-agent/src/leader/start.rs +0 -4500
- 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 -267
- 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 -145
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -848
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -393
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -178
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -82
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -63
- 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 -152
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -629
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -226
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5176
- 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 -450
- 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 -534
- 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 -757
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2198
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2052
- 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 -223
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1205
- 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_profile_launch_red.rs +0 -135
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1415
- 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 -396
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -418
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2039
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1298
- 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 -71
- 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 -472
- 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 -3981
- 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 -152
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -182
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -374
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -546
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -31
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -528
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -134
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -333
- 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 -90
- 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 -996
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -827
- package/crates/team-agent/src/lifecycle/tests.rs +0 -102
- package/crates/team-agent/src/lifecycle/types.rs +0 -861
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -370
- 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 -546
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -369
- 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 -168
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -388
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -343
- 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 -1015
- 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 -3785
- 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 -354
- 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 -166
- 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/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 -217
- 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 -551
- 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 -3655
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -837
- 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 -471
- 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 -898
- 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 -28
- 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 -773
- 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 -722
- package/crates/team-agent/src/provider/session/capture.rs +0 -2631
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -168
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -264
- 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/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -618
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -152
- package/crates/team-agent/src/provider/session_scan.rs +0 -61
- 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 -354
- package/crates/team-agent/src/provider/tests/classify.rs +0 -201
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -26
- 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 -140
- 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 -406
- 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/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 -4254
- package/crates/team-agent/src/tmux_backend.rs +0 -4527
- 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,824 +0,0 @@
|
|
|
1
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
2
|
-
mod hermetic_guard;
|
|
3
|
-
|
|
4
|
-
use super::agent_ops::lanea_team_ws;
|
|
5
|
-
use super::lane_ops::{
|
|
6
|
-
assert_legacy_fork_unverified, fork_ws, LaneHomeGuard, LaneTransport, COPILOT_ROLE_ALPHA,
|
|
7
|
-
};
|
|
8
|
-
use super::launch_spawn::{quick_start_team_dir, seed_healthy_coordinator, QS_VALID_ROLE};
|
|
9
|
-
use super::*;
|
|
10
|
-
use crate::lifecycle::lock::{
|
|
11
|
-
acquire_agent_lifecycle_lock_for_test, override_agent_lifecycle_lock_deadlines_for_test,
|
|
12
|
-
LifecycleLockRequest,
|
|
13
|
-
};
|
|
14
|
-
use crate::transport::test_support::OfflineTransport;
|
|
15
|
-
use crate::transport::{
|
|
16
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
17
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, PaneLiveness, SessionName,
|
|
18
|
-
SetEnvOutcome, SpawnResult, SubmitVerification, Target, Transport, TransportError,
|
|
19
|
-
TurnVerification, WindowName,
|
|
20
|
-
};
|
|
21
|
-
use serde_json::json;
|
|
22
|
-
use std::collections::BTreeSet;
|
|
23
|
-
use std::time::Duration;
|
|
24
|
-
|
|
25
|
-
fn enter_hermetic(tag: &str) -> hermetic_guard::HermeticTestEnv {
|
|
26
|
-
let env = hermetic_guard::HermeticTestEnv::enter(tag);
|
|
27
|
-
env.scrub_tmux();
|
|
28
|
-
env.assert_no_real_tmux();
|
|
29
|
-
env
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
#[test]
|
|
33
|
-
#[serial_test::serial(env)]
|
|
34
|
-
fn concurrent_reset_discard_session_serializes() {
|
|
35
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("phase-b-concurrent-reset");
|
|
36
|
-
let ids = (1..=6).map(|n| format!("w{n}")).collect::<Vec<_>>();
|
|
37
|
-
let role_docs = ids
|
|
38
|
-
.iter()
|
|
39
|
-
.map(|id| (format!("{id}.md"), role_doc(id)))
|
|
40
|
-
.collect::<Vec<_>>();
|
|
41
|
-
let role_refs = role_docs
|
|
42
|
-
.iter()
|
|
43
|
-
.map(|(file, doc)| (file.as_str(), doc.as_str()))
|
|
44
|
-
.collect::<Vec<_>>();
|
|
45
|
-
let team = team_dir_with_roles(&role_refs);
|
|
46
|
-
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
47
|
-
seed_healthy_coordinator(&workspace);
|
|
48
|
-
|
|
49
|
-
let launch_transport = copilot_ready_transport();
|
|
50
|
-
let quick_start = quick_start_with_transport_in_workspace(
|
|
51
|
-
&workspace,
|
|
52
|
-
&team,
|
|
53
|
-
None,
|
|
54
|
-
true,
|
|
55
|
-
None,
|
|
56
|
-
&launch_transport,
|
|
57
|
-
)
|
|
58
|
-
.expect("quick-start fixture");
|
|
59
|
-
assert!(
|
|
60
|
-
matches!(quick_start, QuickStartReport::Ready { .. }),
|
|
61
|
-
"fixture must launch: {quick_start:?}"
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
let reset_transport = copilot_ready_transport()
|
|
65
|
-
.with_session_present(true)
|
|
66
|
-
.with_windows(ids.iter().map(|id| WindowName::new(id.as_str())).collect());
|
|
67
|
-
let outcomes = ids
|
|
68
|
-
.iter()
|
|
69
|
-
.map(|id| {
|
|
70
|
-
crate::lifecycle::reset_agent_with_transport(
|
|
71
|
-
&workspace,
|
|
72
|
-
&aid(id),
|
|
73
|
-
true,
|
|
74
|
-
false,
|
|
75
|
-
Some("teamdir"),
|
|
76
|
-
&reset_transport,
|
|
77
|
-
)
|
|
78
|
-
})
|
|
79
|
-
.collect::<Vec<_>>();
|
|
80
|
-
for (id, outcome) in ids.iter().zip(outcomes.iter()) {
|
|
81
|
-
assert!(
|
|
82
|
-
matches!(outcome, Ok(ResetAgentOutcome::Reset { .. })),
|
|
83
|
-
"reset-agent --discard-session must complete for {id}: {outcome:?}"
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let state = crate::state::projection::select_runtime_state(&workspace, Some("teamdir"))
|
|
88
|
-
.expect("team state");
|
|
89
|
-
let agents = state
|
|
90
|
-
.get("agents")
|
|
91
|
-
.and_then(serde_json::Value::as_object)
|
|
92
|
-
.expect("agents map");
|
|
93
|
-
assert_eq!(agents.len(), ids.len(), "one roster row per worker");
|
|
94
|
-
let mut windows = BTreeSet::new();
|
|
95
|
-
let mut panes = BTreeSet::new();
|
|
96
|
-
for id in &ids {
|
|
97
|
-
let agent = agents.get(id).unwrap_or_else(|| panic!("missing {id}"));
|
|
98
|
-
assert_eq!(
|
|
99
|
-
agent.get("status").and_then(|v| v.as_str()),
|
|
100
|
-
Some("running")
|
|
101
|
-
);
|
|
102
|
-
let window = agent
|
|
103
|
-
.get("window")
|
|
104
|
-
.and_then(|v| v.as_str())
|
|
105
|
-
.unwrap_or_else(|| panic!("{id} missing window"));
|
|
106
|
-
assert!(
|
|
107
|
-
windows.insert(window.to_string()),
|
|
108
|
-
"duplicate window {window}"
|
|
109
|
-
);
|
|
110
|
-
let pane = agent
|
|
111
|
-
.get("pane_id")
|
|
112
|
-
.and_then(|v| v.as_str())
|
|
113
|
-
.unwrap_or_else(|| panic!("{id} missing pane_id"));
|
|
114
|
-
assert!(panes.insert(pane.to_string()), "duplicate pane_id {pane}");
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
let reset_events = read_events(&workspace)
|
|
118
|
-
.into_iter()
|
|
119
|
-
.filter(|event| {
|
|
120
|
-
event.get("event").and_then(serde_json::Value::as_str) == Some("reset_agent.complete")
|
|
121
|
-
})
|
|
122
|
-
.collect::<Vec<_>>();
|
|
123
|
-
assert_eq!(
|
|
124
|
-
reset_events.len(),
|
|
125
|
-
ids.len(),
|
|
126
|
-
"each reset must emit reset_agent.complete"
|
|
127
|
-
);
|
|
128
|
-
let completed = reset_events
|
|
129
|
-
.iter()
|
|
130
|
-
.filter_map(|event| event.get("agent_id").and_then(serde_json::Value::as_str))
|
|
131
|
-
.collect::<BTreeSet<_>>();
|
|
132
|
-
let expected = ids.iter().map(String::as_str).collect::<BTreeSet<_>>();
|
|
133
|
-
assert_eq!(
|
|
134
|
-
completed, expected,
|
|
135
|
-
"complete events must cover all workers"
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
#[test]
|
|
140
|
-
#[serial_test::serial(env)]
|
|
141
|
-
fn add_fork_remove_share_lifecycle_lock_behavior() {
|
|
142
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("phase-b-fork");
|
|
143
|
-
let _home = LaneHomeGuard::enter("phase-b-fork");
|
|
144
|
-
let (add_team, add_workspace, add_role, add_transport) = add_fixture();
|
|
145
|
-
let add_agent = aid("w2");
|
|
146
|
-
let add_state_before =
|
|
147
|
-
crate::state::projection::select_runtime_state(&add_workspace, Some("teamdir")).unwrap();
|
|
148
|
-
let add_spec_before = std::fs::read_to_string(crate::model::paths::runtime_spec_path(
|
|
149
|
-
&add_workspace,
|
|
150
|
-
"teamdir",
|
|
151
|
-
))
|
|
152
|
-
.unwrap();
|
|
153
|
-
let held = hold_lifecycle_lock(&add_workspace, "add-agent", Some(&add_agent));
|
|
154
|
-
let override_guard = override_agent_lifecycle_lock_deadlines_for_test(
|
|
155
|
-
Duration::from_millis(120),
|
|
156
|
-
Duration::from_secs(5),
|
|
157
|
-
);
|
|
158
|
-
assert_lock_timeout(
|
|
159
|
-
crate::lifecycle::add_agent_with_transport(
|
|
160
|
-
&add_team,
|
|
161
|
-
&add_agent,
|
|
162
|
-
&add_role,
|
|
163
|
-
false,
|
|
164
|
-
None,
|
|
165
|
-
&add_transport,
|
|
166
|
-
),
|
|
167
|
-
"add-agent",
|
|
168
|
-
);
|
|
169
|
-
assert!(
|
|
170
|
-
add_transport.spawn_records().is_empty(),
|
|
171
|
-
"blocked add-agent must not spawn a window"
|
|
172
|
-
);
|
|
173
|
-
assert_eq!(
|
|
174
|
-
crate::state::projection::select_runtime_state(&add_workspace, Some("teamdir")).unwrap(),
|
|
175
|
-
add_state_before,
|
|
176
|
-
"blocked add-agent must not add a state row"
|
|
177
|
-
);
|
|
178
|
-
assert_eq!(
|
|
179
|
-
std::fs::read_to_string(crate::model::paths::runtime_spec_path(
|
|
180
|
-
&add_workspace,
|
|
181
|
-
"teamdir",
|
|
182
|
-
))
|
|
183
|
-
.unwrap(),
|
|
184
|
-
add_spec_before,
|
|
185
|
-
"blocked add-agent must not mutate spec"
|
|
186
|
-
);
|
|
187
|
-
drop(override_guard);
|
|
188
|
-
drop(held);
|
|
189
|
-
crate::lifecycle::add_agent_with_transport(
|
|
190
|
-
&add_team,
|
|
191
|
-
&add_agent,
|
|
192
|
-
&add_role,
|
|
193
|
-
false,
|
|
194
|
-
None,
|
|
195
|
-
&add_transport,
|
|
196
|
-
)
|
|
197
|
-
.expect("add-agent succeeds after lock release");
|
|
198
|
-
assert!(
|
|
199
|
-
crate::state::projection::select_runtime_state(&add_workspace, Some("teamdir"))
|
|
200
|
-
.unwrap()
|
|
201
|
-
.pointer("/agents/w2")
|
|
202
|
-
.is_some(),
|
|
203
|
-
"released add-agent must add the worker"
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
let fork_workspace = fork_ws(COPILOT_ROLE_ALPHA);
|
|
207
|
-
let fork_transport = LaneTransport::new("team-laneateam", &[]);
|
|
208
|
-
let fork_spec_before = std::fs::read_to_string(fork_workspace.join("team.spec.yaml")).unwrap();
|
|
209
|
-
let fork_state_before = crate::state::persist::load_runtime_state(&fork_workspace).unwrap();
|
|
210
|
-
let fork_agent = aid("newfork");
|
|
211
|
-
let held = hold_lifecycle_lock(&fork_workspace, "fork-agent", Some(&fork_agent));
|
|
212
|
-
let override_guard = override_agent_lifecycle_lock_deadlines_for_test(
|
|
213
|
-
Duration::from_millis(120),
|
|
214
|
-
Duration::from_secs(5),
|
|
215
|
-
);
|
|
216
|
-
// The legacy fork entry takes the lifecycle lock before reading the source row.
|
|
217
|
-
assert_lock_timeout(
|
|
218
|
-
crate::lifecycle::fork_agent_with_transport(
|
|
219
|
-
&fork_workspace,
|
|
220
|
-
&aid("alpha"),
|
|
221
|
-
&fork_agent,
|
|
222
|
-
None,
|
|
223
|
-
false,
|
|
224
|
-
None,
|
|
225
|
-
&fork_transport,
|
|
226
|
-
),
|
|
227
|
-
"fork-agent",
|
|
228
|
-
);
|
|
229
|
-
assert!(
|
|
230
|
-
fork_transport.spawns().is_empty(),
|
|
231
|
-
"blocked fork-agent must not spawn a window"
|
|
232
|
-
);
|
|
233
|
-
assert_eq!(
|
|
234
|
-
crate::state::persist::load_runtime_state(&fork_workspace).unwrap(),
|
|
235
|
-
fork_state_before,
|
|
236
|
-
"blocked fork-agent must not add a state row"
|
|
237
|
-
);
|
|
238
|
-
assert_eq!(
|
|
239
|
-
std::fs::read_to_string(fork_workspace.join("team.spec.yaml")).unwrap(),
|
|
240
|
-
fork_spec_before,
|
|
241
|
-
"blocked fork-agent must not mutate spec"
|
|
242
|
-
);
|
|
243
|
-
drop(override_guard);
|
|
244
|
-
drop(held);
|
|
245
|
-
let fork_after = crate::lifecycle::fork_agent_with_transport(
|
|
246
|
-
&fork_workspace,
|
|
247
|
-
&aid("alpha"),
|
|
248
|
-
&fork_agent,
|
|
249
|
-
None,
|
|
250
|
-
false,
|
|
251
|
-
None,
|
|
252
|
-
&fork_transport,
|
|
253
|
-
);
|
|
254
|
-
assert_legacy_fork_unverified(&fork_after, "copilot");
|
|
255
|
-
assert!(
|
|
256
|
-
fork_transport.spawns().is_empty(),
|
|
257
|
-
"released legacy fork-agent stays refused and must not spawn a window"
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
let remove_workspace = lanea_team_ws("stopped");
|
|
261
|
-
let remove_transport = LaneTransport::new("team-laneateam", &[]);
|
|
262
|
-
let remove_spec_before =
|
|
263
|
-
std::fs::read_to_string(remove_workspace.join("team.spec.yaml")).unwrap();
|
|
264
|
-
let remove_state_before = crate::state::persist::load_runtime_state(&remove_workspace).unwrap();
|
|
265
|
-
let remove_agent = aid("alpha");
|
|
266
|
-
let held = hold_lifecycle_lock(&remove_workspace, "remove-agent", Some(&remove_agent));
|
|
267
|
-
let override_guard = override_agent_lifecycle_lock_deadlines_for_test(
|
|
268
|
-
Duration::from_millis(120),
|
|
269
|
-
Duration::from_secs(5),
|
|
270
|
-
);
|
|
271
|
-
assert_lock_timeout(
|
|
272
|
-
crate::lifecycle::remove_agent_with_transport(
|
|
273
|
-
&remove_workspace,
|
|
274
|
-
&remove_agent,
|
|
275
|
-
true,
|
|
276
|
-
true,
|
|
277
|
-
None,
|
|
278
|
-
&remove_transport,
|
|
279
|
-
),
|
|
280
|
-
"remove-agent",
|
|
281
|
-
);
|
|
282
|
-
assert!(
|
|
283
|
-
remove_transport.killed().is_empty() && remove_transport.spawns().is_empty(),
|
|
284
|
-
"blocked remove-agent must not touch tmux"
|
|
285
|
-
);
|
|
286
|
-
assert_eq!(
|
|
287
|
-
crate::state::persist::load_runtime_state(&remove_workspace).unwrap(),
|
|
288
|
-
remove_state_before,
|
|
289
|
-
"blocked remove-agent must not remove a state row"
|
|
290
|
-
);
|
|
291
|
-
assert_eq!(
|
|
292
|
-
std::fs::read_to_string(remove_workspace.join("team.spec.yaml")).unwrap(),
|
|
293
|
-
remove_spec_before,
|
|
294
|
-
"blocked remove-agent must not mutate spec"
|
|
295
|
-
);
|
|
296
|
-
drop(override_guard);
|
|
297
|
-
drop(held);
|
|
298
|
-
assert!(
|
|
299
|
-
matches!(
|
|
300
|
-
crate::lifecycle::remove_agent_with_transport(
|
|
301
|
-
&remove_workspace,
|
|
302
|
-
&remove_agent,
|
|
303
|
-
true,
|
|
304
|
-
true,
|
|
305
|
-
None,
|
|
306
|
-
&remove_transport,
|
|
307
|
-
),
|
|
308
|
-
Ok(RemoveAgentOutcome::Removed { .. })
|
|
309
|
-
),
|
|
310
|
-
"remove-agent succeeds after lock release"
|
|
311
|
-
);
|
|
312
|
-
assert!(
|
|
313
|
-
crate::state::persist::load_runtime_state(&remove_workspace)
|
|
314
|
-
.unwrap()
|
|
315
|
-
.pointer("/agents/alpha")
|
|
316
|
-
.is_none(),
|
|
317
|
-
"released remove-agent must remove alpha"
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
#[test]
|
|
322
|
-
#[serial_test::serial(env)]
|
|
323
|
-
fn breal_spawn_ownership_mismatch_fails_without_state_pollution() {
|
|
324
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("phase-b-spawn-ownership");
|
|
325
|
-
let (workspace, _team) = breal_workspace();
|
|
326
|
-
let transport = BRealTransport::misowned();
|
|
327
|
-
|
|
328
|
-
let result = crate::lifecycle::reset_agent_with_transport(
|
|
329
|
-
&workspace,
|
|
330
|
-
&aid("w1"),
|
|
331
|
-
true,
|
|
332
|
-
false,
|
|
333
|
-
Some("teamdir"),
|
|
334
|
-
&transport,
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
assert!(
|
|
338
|
-
matches!(result, Err(LifecycleError::RequirementUnmet(_))),
|
|
339
|
-
"reset must fail closed when spawn returns another worker's live pane: {result:?}"
|
|
340
|
-
);
|
|
341
|
-
let err = result.unwrap_err().to_string();
|
|
342
|
-
assert!(
|
|
343
|
-
err.contains("spawned pane not owned") && err.contains("requested=team-phaseb:w1"),
|
|
344
|
-
"error must name requested/observed ownership; got {err}"
|
|
345
|
-
);
|
|
346
|
-
let state = crate::state::projection::select_runtime_state(&workspace, Some("teamdir"))
|
|
347
|
-
.expect("team state after failed reset");
|
|
348
|
-
let w1 = state.pointer("/agents/w1").expect("w1 state");
|
|
349
|
-
assert_ne!(
|
|
350
|
-
w1.get("pane_id").and_then(serde_json::Value::as_str),
|
|
351
|
-
Some("%5"),
|
|
352
|
-
"failed reset must not write w2's pane into w1 state"
|
|
353
|
-
);
|
|
354
|
-
let started_true = read_events(&workspace).into_iter().any(|event| {
|
|
355
|
-
event.get("event").and_then(serde_json::Value::as_str) == Some("reset_agent.complete")
|
|
356
|
-
&& event.get("agent_id").and_then(serde_json::Value::as_str) == Some("w1")
|
|
357
|
-
&& event.get("started").and_then(serde_json::Value::as_bool) == Some(true)
|
|
358
|
-
});
|
|
359
|
-
assert!(
|
|
360
|
-
!started_true,
|
|
361
|
-
"failed reset must not emit reset_agent.complete started=true"
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
#[test]
|
|
366
|
-
#[serial_test::serial(env)]
|
|
367
|
-
fn breal_provider_missing_window_disappeared_fails_closed() {
|
|
368
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("phase-b-missing-window");
|
|
369
|
-
let (workspace, _team) = breal_workspace();
|
|
370
|
-
let transport = BRealTransport::dead_after_spawn();
|
|
371
|
-
|
|
372
|
-
let result = crate::lifecycle::reset_agent_with_transport(
|
|
373
|
-
&workspace,
|
|
374
|
-
&aid("w1"),
|
|
375
|
-
true,
|
|
376
|
-
false,
|
|
377
|
-
Some("teamdir"),
|
|
378
|
-
&transport,
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
assert!(
|
|
382
|
-
matches!(result, Err(LifecycleError::RequirementUnmet(_))),
|
|
383
|
-
"reset must return Err when provider exits and requested window disappears: {result:?}"
|
|
384
|
-
);
|
|
385
|
-
let err = result.unwrap_err().to_string();
|
|
386
|
-
assert!(
|
|
387
|
-
err.contains("window disappeared") || err.contains("spawned pane not owned"),
|
|
388
|
-
"error must name window disappearance / ownership failure; got {err}"
|
|
389
|
-
);
|
|
390
|
-
let state = crate::state::projection::select_runtime_state(&workspace, Some("teamdir"))
|
|
391
|
-
.expect("team state after failed reset");
|
|
392
|
-
let w1 = state.pointer("/agents/w1").expect("w1 state");
|
|
393
|
-
assert_ne!(
|
|
394
|
-
w1.get("status").and_then(serde_json::Value::as_str),
|
|
395
|
-
Some("running"),
|
|
396
|
-
"failed reset must not mark w1 running"
|
|
397
|
-
);
|
|
398
|
-
assert_ne!(
|
|
399
|
-
w1.get("pane_id").and_then(serde_json::Value::as_str),
|
|
400
|
-
Some("%9"),
|
|
401
|
-
"failed reset must not persist disappeared pane"
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
#[test]
|
|
406
|
-
#[serial_test::serial(env)]
|
|
407
|
-
fn breal_reset_rehydrates_role_context_from_compiled_spec() {
|
|
408
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("phase-b-reset-context");
|
|
409
|
-
let (workspace, _team) = breal_workspace();
|
|
410
|
-
strip_runtime_command_context(&workspace);
|
|
411
|
-
let transport = BRealTransport::owned();
|
|
412
|
-
|
|
413
|
-
crate::lifecycle::reset_agent_with_transport(
|
|
414
|
-
&workspace,
|
|
415
|
-
&aid("w1"),
|
|
416
|
-
true,
|
|
417
|
-
false,
|
|
418
|
-
Some("teamdir"),
|
|
419
|
-
&transport,
|
|
420
|
-
)
|
|
421
|
-
.expect("reset should use spec-rehydrated role context");
|
|
422
|
-
|
|
423
|
-
let prompt = transport
|
|
424
|
-
.spawn_instructions()
|
|
425
|
-
.pop()
|
|
426
|
-
.expect("reset must spawn w1");
|
|
427
|
-
assert!(
|
|
428
|
-
prompt.contains("role `Phase B Real Worker One`"),
|
|
429
|
-
"spawned worker instructions must carry role from compiled spec/role doc, got:\n{prompt}"
|
|
430
|
-
);
|
|
431
|
-
assert!(
|
|
432
|
-
!prompt.contains("role `developer`"),
|
|
433
|
-
"spawned worker instructions must not fall back to generic developer, got:\n{prompt}"
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
#[test]
|
|
438
|
-
#[serial_test::serial(env)]
|
|
439
|
-
fn breal_restart_rehydrates_role_context_from_compiled_spec() {
|
|
440
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("phase-b-restart-role-context");
|
|
441
|
-
let (workspace, _team) = breal_one_worker_workspace();
|
|
442
|
-
strip_runtime_command_context(&workspace);
|
|
443
|
-
let transport = BRealTransport::owned();
|
|
444
|
-
|
|
445
|
-
crate::lifecycle::restart_with_transport(&workspace, true, Some("teamdir"), &transport)
|
|
446
|
-
.expect("restart should use spec-rehydrated role context");
|
|
447
|
-
|
|
448
|
-
let prompt = transport
|
|
449
|
-
.spawn_instructions()
|
|
450
|
-
.pop()
|
|
451
|
-
.expect("restart must spawn w1");
|
|
452
|
-
assert!(
|
|
453
|
-
prompt.contains("role `Phase B Real Worker One`"),
|
|
454
|
-
"restart worker instructions must carry role from compiled spec/role doc, got:\n{prompt}"
|
|
455
|
-
);
|
|
456
|
-
assert!(
|
|
457
|
-
!prompt.contains("role `developer`"),
|
|
458
|
-
"restart worker instructions must not fall back to generic developer, got:\n{prompt}"
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
fn team_dir_with_roles(role_docs: &[(&str, &str)]) -> PathBuf {
|
|
463
|
-
let team = temp_ws().join("teamdir");
|
|
464
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
465
|
-
std::fs::write(
|
|
466
|
-
team.join("TEAM.md"),
|
|
467
|
-
"---\nname: teamdir\nobjective: Phase B.\nprovider: codex\nsession_name: team-phaseb\n---\n\nPhase B team.\n",
|
|
468
|
-
)
|
|
469
|
-
.unwrap();
|
|
470
|
-
for (file, role_doc) in role_docs {
|
|
471
|
-
std::fs::write(team.join("agents").join(file), role_doc).unwrap();
|
|
472
|
-
}
|
|
473
|
-
team
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
fn breal_workspace() -> (PathBuf, PathBuf) {
|
|
477
|
-
let w1 = "---\nname: w1\nrole: Phase B Real Worker One\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker one body.\n";
|
|
478
|
-
let w2 = "---\nname: w2\nrole: Phase B Real Worker Two\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker two body.\n";
|
|
479
|
-
let team = team_dir_with_roles(&[("w1.md", w1), ("w2.md", w2)]);
|
|
480
|
-
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
481
|
-
seed_healthy_coordinator(&workspace);
|
|
482
|
-
let launch_transport = copilot_ready_transport();
|
|
483
|
-
quick_start_with_transport_in_workspace(
|
|
484
|
-
&workspace,
|
|
485
|
-
&team,
|
|
486
|
-
None,
|
|
487
|
-
true,
|
|
488
|
-
None,
|
|
489
|
-
&launch_transport,
|
|
490
|
-
)
|
|
491
|
-
.expect("quick-start breal fixture");
|
|
492
|
-
(workspace, team)
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
fn breal_one_worker_workspace() -> (PathBuf, PathBuf) {
|
|
496
|
-
let w1 = "---\nname: w1\nrole: Phase B Real Worker One\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker one body.\n";
|
|
497
|
-
let team = team_dir_with_roles(&[("w1.md", w1)]);
|
|
498
|
-
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
499
|
-
seed_healthy_coordinator(&workspace);
|
|
500
|
-
let launch_transport = copilot_ready_transport();
|
|
501
|
-
quick_start_with_transport_in_workspace(
|
|
502
|
-
&workspace,
|
|
503
|
-
&team,
|
|
504
|
-
None,
|
|
505
|
-
true,
|
|
506
|
-
None,
|
|
507
|
-
&launch_transport,
|
|
508
|
-
)
|
|
509
|
-
.expect("quick-start breal one-worker fixture");
|
|
510
|
-
(workspace, team)
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
fn strip_runtime_command_context(workspace: &std::path::Path) {
|
|
514
|
-
let mut state = crate::state::projection::select_runtime_state(workspace, Some("teamdir"))
|
|
515
|
-
.expect("team state");
|
|
516
|
-
if let Some(agent) = state
|
|
517
|
-
.pointer_mut("/agents/w1")
|
|
518
|
-
.and_then(serde_json::Value::as_object_mut)
|
|
519
|
-
{
|
|
520
|
-
for field in [
|
|
521
|
-
"role",
|
|
522
|
-
"tools",
|
|
523
|
-
"system_prompt",
|
|
524
|
-
"output_contract",
|
|
525
|
-
"model",
|
|
526
|
-
"effort",
|
|
527
|
-
"permission_mode",
|
|
528
|
-
] {
|
|
529
|
-
agent.remove(field);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
crate::state::projection::save_team_scoped_state(workspace, &state)
|
|
533
|
-
.expect("save stripped team state");
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
fn role_doc(id: &str) -> String {
|
|
537
|
-
format!(
|
|
538
|
-
"---\nname: {id}\nrole: {id} Worker\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\n{id} worker.\n"
|
|
539
|
-
)
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
fn add_fixture() -> (PathBuf, PathBuf, PathBuf, OfflineTransport) {
|
|
543
|
-
let team = quick_start_team_dir(QS_VALID_ROLE);
|
|
544
|
-
let workspace = team.parent().expect("team workspace").to_path_buf();
|
|
545
|
-
seed_healthy_coordinator(&workspace);
|
|
546
|
-
let launch_transport = copilot_ready_transport();
|
|
547
|
-
quick_start_with_transport_in_workspace(
|
|
548
|
-
&workspace,
|
|
549
|
-
&team,
|
|
550
|
-
Some("teamdir"),
|
|
551
|
-
true,
|
|
552
|
-
None,
|
|
553
|
-
&launch_transport,
|
|
554
|
-
)
|
|
555
|
-
.expect("quick-start add fixture");
|
|
556
|
-
let role = workspace.join("w2-role.md");
|
|
557
|
-
std::fs::write(&role, role_doc("w2")).unwrap();
|
|
558
|
-
(
|
|
559
|
-
team,
|
|
560
|
-
workspace,
|
|
561
|
-
role,
|
|
562
|
-
copilot_ready_transport().with_session_present(true),
|
|
563
|
-
)
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
/// Every pane shows the Copilot ready screen, so a Copilot worker's startup-prompt handler returns
|
|
567
|
-
/// at once instead of polling an empty pane; `fake` workers never capture.
|
|
568
|
-
fn copilot_ready_transport() -> OfflineTransport {
|
|
569
|
-
let mut transport = OfflineTransport::new();
|
|
570
|
-
for pane in 0..32 {
|
|
571
|
-
transport = transport
|
|
572
|
-
.with_capture_for_pane(format!("%{pane}"), crate::provider::COPILOT_READY_MARKER);
|
|
573
|
-
}
|
|
574
|
-
transport
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
fn hold_lifecycle_lock(
|
|
578
|
-
workspace: &std::path::Path,
|
|
579
|
-
operation: &'static str,
|
|
580
|
-
agent_id: Option<&AgentId>,
|
|
581
|
-
) -> crate::lifecycle::lock::LifecycleLockGuard {
|
|
582
|
-
acquire_agent_lifecycle_lock_for_test(
|
|
583
|
-
LifecycleLockRequest {
|
|
584
|
-
workspace,
|
|
585
|
-
operation,
|
|
586
|
-
team: None,
|
|
587
|
-
agent_id,
|
|
588
|
-
},
|
|
589
|
-
Duration::from_millis(200),
|
|
590
|
-
Duration::from_secs(5),
|
|
591
|
-
)
|
|
592
|
-
.expect("hold lifecycle lock")
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
fn assert_lock_timeout<T: std::fmt::Debug>(
|
|
596
|
-
result: Result<T, LifecycleError>,
|
|
597
|
-
expected_operation: &str,
|
|
598
|
-
) {
|
|
599
|
-
assert!(
|
|
600
|
-
matches!(
|
|
601
|
-
result,
|
|
602
|
-
Err(LifecycleError::LifecycleLockTimeout { ref operation, .. })
|
|
603
|
-
if operation == expected_operation
|
|
604
|
-
),
|
|
605
|
-
"expected {expected_operation} lifecycle lock timeout, got {result:?}"
|
|
606
|
-
);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
fn read_events(workspace: &std::path::Path) -> Vec<serde_json::Value> {
|
|
610
|
-
let path = crate::model::paths::logs_dir(workspace).join("events.jsonl");
|
|
611
|
-
std::fs::read_to_string(path)
|
|
612
|
-
.unwrap_or_default()
|
|
613
|
-
.lines()
|
|
614
|
-
.filter_map(|line| serde_json::from_str(line).ok())
|
|
615
|
-
.collect()
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
#[derive(Clone, Copy)]
|
|
619
|
-
enum BRealMode {
|
|
620
|
-
Misowned,
|
|
621
|
-
DeadAfterSpawn,
|
|
622
|
-
Owned,
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
struct BRealTransport {
|
|
626
|
-
mode: BRealMode,
|
|
627
|
-
spawns: std::sync::Mutex<Vec<Vec<String>>>,
|
|
628
|
-
// Copilot carries the compiled role prompt in the per-worker AGENTS.md named by
|
|
629
|
-
// COPILOT_CUSTOM_INSTRUCTIONS_DIRS, not in argv; snapshot it at spawn time.
|
|
630
|
-
instructions: std::sync::Mutex<Vec<String>>,
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
impl BRealTransport {
|
|
634
|
-
fn new(mode: BRealMode) -> Self {
|
|
635
|
-
Self {
|
|
636
|
-
mode,
|
|
637
|
-
spawns: std::sync::Mutex::new(Vec::new()),
|
|
638
|
-
instructions: std::sync::Mutex::new(Vec::new()),
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
fn misowned() -> Self {
|
|
643
|
-
Self::new(BRealMode::Misowned)
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
fn dead_after_spawn() -> Self {
|
|
647
|
-
Self::new(BRealMode::DeadAfterSpawn)
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
fn owned() -> Self {
|
|
651
|
-
Self::new(BRealMode::Owned)
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
fn spawn_instructions(&self) -> Vec<String> {
|
|
655
|
-
self.instructions.lock().unwrap().clone()
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
fn spawn_result(
|
|
659
|
-
&self,
|
|
660
|
-
session: &SessionName,
|
|
661
|
-
window: &WindowName,
|
|
662
|
-
argv: &[String],
|
|
663
|
-
env: &std::collections::BTreeMap<String, String>,
|
|
664
|
-
) -> SpawnResult {
|
|
665
|
-
self.spawns.lock().unwrap().push(argv.to_vec());
|
|
666
|
-
self.instructions.lock().unwrap().push(
|
|
667
|
-
env.get("COPILOT_CUSTOM_INSTRUCTIONS_DIRS")
|
|
668
|
-
.and_then(|dir| {
|
|
669
|
-
std::fs::read_to_string(std::path::Path::new(dir).join("AGENTS.md")).ok()
|
|
670
|
-
})
|
|
671
|
-
.unwrap_or_default(),
|
|
672
|
-
);
|
|
673
|
-
let pane = match self.mode {
|
|
674
|
-
BRealMode::Misowned => "%5",
|
|
675
|
-
BRealMode::DeadAfterSpawn => "%9",
|
|
676
|
-
BRealMode::Owned => "%10",
|
|
677
|
-
};
|
|
678
|
-
SpawnResult {
|
|
679
|
-
pane_id: PaneId::new(pane),
|
|
680
|
-
session: session.clone(),
|
|
681
|
-
window: window.clone(),
|
|
682
|
-
child_pid: None,
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
impl Transport for BRealTransport {
|
|
688
|
-
fn kind(&self) -> BackendKind {
|
|
689
|
-
BackendKind::Tmux
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
fn spawn_first(
|
|
693
|
-
&self,
|
|
694
|
-
session: &SessionName,
|
|
695
|
-
window: &WindowName,
|
|
696
|
-
argv: &[String],
|
|
697
|
-
_cwd: &std::path::Path,
|
|
698
|
-
env: &std::collections::BTreeMap<String, String>,
|
|
699
|
-
) -> Result<SpawnResult, TransportError> {
|
|
700
|
-
Ok(self.spawn_result(session, window, argv, env))
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
fn spawn_into(
|
|
704
|
-
&self,
|
|
705
|
-
session: &SessionName,
|
|
706
|
-
window: &WindowName,
|
|
707
|
-
argv: &[String],
|
|
708
|
-
_cwd: &std::path::Path,
|
|
709
|
-
env: &std::collections::BTreeMap<String, String>,
|
|
710
|
-
) -> Result<SpawnResult, TransportError> {
|
|
711
|
-
Ok(self.spawn_result(session, window, argv, env))
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
fn inject(
|
|
715
|
-
&self,
|
|
716
|
-
_target: &Target,
|
|
717
|
-
_payload: &InjectPayload,
|
|
718
|
-
_submit: Key,
|
|
719
|
-
_bracketed: bool,
|
|
720
|
-
) -> Result<InjectReport, TransportError> {
|
|
721
|
-
Ok(InjectReport {
|
|
722
|
-
stage_reached: InjectStage::Submit,
|
|
723
|
-
inject_verification: InjectVerification::NoToken,
|
|
724
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
725
|
-
turn_verification: TurnVerification::NotRequired,
|
|
726
|
-
attempts: 1,
|
|
727
|
-
submit_diagnostics: None,
|
|
728
|
-
})
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
732
|
-
Ok(())
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
fn capture(
|
|
736
|
-
&self,
|
|
737
|
-
_target: &Target,
|
|
738
|
-
range: CaptureRange,
|
|
739
|
-
) -> Result<CapturedText, TransportError> {
|
|
740
|
-
Ok(CapturedText {
|
|
741
|
-
text: crate::provider::COPILOT_READY_MARKER.to_string(),
|
|
742
|
-
range,
|
|
743
|
-
})
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
fn query(&self, _target: &Target, _field: PaneField) -> Result<Option<String>, TransportError> {
|
|
747
|
-
Ok(Some("node".to_string()))
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
fn liveness(&self, pane: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
751
|
-
if matches!(self.mode, BRealMode::DeadAfterSpawn) && pane.as_str() == "%9" {
|
|
752
|
-
Ok(PaneLiveness::Dead)
|
|
753
|
-
} else {
|
|
754
|
-
Ok(PaneLiveness::Live)
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
fn has_pane(&self, pane: &PaneId) -> Result<Option<bool>, TransportError> {
|
|
759
|
-
Ok(Some(!matches!(
|
|
760
|
-
(self.mode, pane.as_str()),
|
|
761
|
-
(BRealMode::DeadAfterSpawn, "%9")
|
|
762
|
-
)))
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
766
|
-
let mut targets = Vec::new();
|
|
767
|
-
if matches!(self.mode, BRealMode::Misowned) {
|
|
768
|
-
targets.push(pane_info("team-phaseb", "w2", "%5", 502));
|
|
769
|
-
}
|
|
770
|
-
if matches!(self.mode, BRealMode::Owned) && !self.spawns.lock().unwrap().is_empty() {
|
|
771
|
-
targets.push(pane_info("team-phaseb", "w1", "%10", 501));
|
|
772
|
-
}
|
|
773
|
-
Ok(targets)
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
777
|
-
Ok(true)
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
781
|
-
Ok(vec![WindowName::new("w1"), WindowName::new("w2")])
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
fn set_session_env(
|
|
785
|
-
&self,
|
|
786
|
-
_session: &SessionName,
|
|
787
|
-
_key: &str,
|
|
788
|
-
_value: &str,
|
|
789
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
790
|
-
Ok(SetEnvOutcome::Applied)
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
|
|
794
|
-
Ok(())
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
|
|
798
|
-
Ok(())
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
fn kill_pane(&self, _pane: &PaneId) -> Result<(), TransportError> {
|
|
802
|
-
Ok(())
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
806
|
-
Ok(AttachOutcome::Attached)
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
fn pane_info(session: &str, window: &str, pane: &str, pid: u32) -> PaneInfo {
|
|
811
|
-
PaneInfo {
|
|
812
|
-
pane_id: PaneId::new(pane),
|
|
813
|
-
session: SessionName::new(session),
|
|
814
|
-
window_index: None,
|
|
815
|
-
window_name: Some(WindowName::new(window)),
|
|
816
|
-
pane_index: None,
|
|
817
|
-
tty: None,
|
|
818
|
-
current_command: Some("node".to_string()),
|
|
819
|
-
current_path: None,
|
|
820
|
-
active: false,
|
|
821
|
-
pane_pid: Some(pid),
|
|
822
|
-
leader_env: std::collections::BTreeMap::new(),
|
|
823
|
-
}
|
|
824
|
-
}
|