@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,827 +0,0 @@
|
|
|
1
|
-
//! Worker provider spawn environment contracts.
|
|
2
|
-
//!
|
|
3
|
-
//! #229 B-layer root cause: spawned legacy-runtime workers must inherit the parent `team-agent`
|
|
4
|
-
//! process environment (proxy/CA/PATH/etc.) just like a user typing the provider command (here
|
|
5
|
-
//! `copilot`) in the same terminal, then overlay the Team Agent identity env. The contract is
|
|
6
|
-
//! path-generic and covers the three worker spawn surfaces: quick-start/launch, restart, and add-agent.
|
|
7
|
-
|
|
8
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
9
|
-
|
|
10
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
11
|
-
mod hermetic_guard;
|
|
12
|
-
#[allow(dead_code)]
|
|
13
|
-
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
14
|
-
|
|
15
|
-
use std::collections::BTreeMap;
|
|
16
|
-
use std::path::{Path, PathBuf};
|
|
17
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
18
|
-
use std::sync::Mutex;
|
|
19
|
-
|
|
20
|
-
use serde_json::json;
|
|
21
|
-
use serial_test::serial;
|
|
22
|
-
use team_agent::lifecycle::{
|
|
23
|
-
add_agent_with_transport, fork_agent_with_transport, launch_with_transport,
|
|
24
|
-
restart_with_transport, LifecycleError,
|
|
25
|
-
};
|
|
26
|
-
use team_agent::model::ids::AgentId;
|
|
27
|
-
use team_agent::transport::{
|
|
28
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
29
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, SessionName, SetEnvOutcome,
|
|
30
|
-
SpawnResult, SubmitVerification, Target, Transport, TransportError, TurnVerification,
|
|
31
|
-
WindowName,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const RUNTIME_TEAM_KEY: &str = "teamdir";
|
|
35
|
-
|
|
36
|
-
#[test]
|
|
37
|
-
#[serial(env)]
|
|
38
|
-
fn worker_spawn_inherits_parent_process_env_for_proxy_and_ca() {
|
|
39
|
-
let _guard = EnvGuard::set([
|
|
40
|
-
("TA_SPAWN_ENV_CANARY", "FOO"),
|
|
41
|
-
("HTTP_PROXY", "http://canary-proxy:1"),
|
|
42
|
-
("NODE_EXTRA_CA_CERTS", "/canary/ca.pem"),
|
|
43
|
-
("TMUX", "/tmp/tmux-canary/default,1"),
|
|
44
|
-
("TMUX_PANE", "%canary"),
|
|
45
|
-
]);
|
|
46
|
-
|
|
47
|
-
let launch_team = compiled_team_dir("launch", &[("worker_a", "Launch Worker")]);
|
|
48
|
-
let launch_transport = RecordingTransport::new().with_session_present(false);
|
|
49
|
-
launch_with_transport(
|
|
50
|
-
&launch_team.join("team.spec.yaml"),
|
|
51
|
-
false,
|
|
52
|
-
true,
|
|
53
|
-
true,
|
|
54
|
-
&launch_transport,
|
|
55
|
-
)
|
|
56
|
-
.expect("launch fixture should spawn worker");
|
|
57
|
-
let launch_spawn = launch_transport.single_spawn();
|
|
58
|
-
|
|
59
|
-
let restart_team = compiled_team_dir("restart", &[("worker_a", "Restart Worker")]);
|
|
60
|
-
seed_restart_state(&restart_team, "worker_a");
|
|
61
|
-
let restart_transport = RecordingTransport::new().with_session_present(false);
|
|
62
|
-
restart_with_transport(&restart_team, true, None, &restart_transport)
|
|
63
|
-
.expect("restart fixture should spawn worker");
|
|
64
|
-
let restart_spawn = restart_transport.single_spawn();
|
|
65
|
-
|
|
66
|
-
let add_team = compiled_team_dir("add-agent", &[("worker_a", "Existing Worker")]);
|
|
67
|
-
seed_running_add_agent_state(&add_team, "worker_a");
|
|
68
|
-
let role_file = add_team.parent().unwrap().join("worker_b.md");
|
|
69
|
-
std::fs::write(&role_file, role_doc("worker_b", "Added Worker")).unwrap();
|
|
70
|
-
let add_transport = RecordingTransport::new().with_session_present(true);
|
|
71
|
-
add_agent_with_transport(
|
|
72
|
-
&add_team,
|
|
73
|
-
&AgentId::new("worker_b"),
|
|
74
|
-
&role_file,
|
|
75
|
-
false,
|
|
76
|
-
None,
|
|
77
|
-
&add_transport,
|
|
78
|
-
)
|
|
79
|
-
.expect("add-agent fixture should spawn worker");
|
|
80
|
-
let add_spawn = add_transport.single_spawn();
|
|
81
|
-
|
|
82
|
-
let failures = [
|
|
83
|
-
("quick-start launch", launch_spawn, "worker_a"),
|
|
84
|
-
("restart", restart_spawn, "worker_a"),
|
|
85
|
-
("add-agent", add_spawn, "worker_b"),
|
|
86
|
-
]
|
|
87
|
-
.into_iter()
|
|
88
|
-
.flat_map(|(surface, spawn, agent_id)| spawn_env_contract_failures(surface, &spawn, agent_id))
|
|
89
|
-
.collect::<Vec<_>>();
|
|
90
|
-
|
|
91
|
-
assert!(
|
|
92
|
-
failures.is_empty(),
|
|
93
|
-
"worker spawn env contract failed:\n{}",
|
|
94
|
-
failures.join("\n")
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
#[test]
|
|
99
|
-
fn tmux_control_filter_uses_env_keys_not_substring_in_inherited_values() {
|
|
100
|
-
let mut env = BTreeMap::from([
|
|
101
|
-
("TA_SPAWN_ENV_CANARY".to_string(), "FOO".to_string()),
|
|
102
|
-
(
|
|
103
|
-
"HTTP_PROXY".to_string(),
|
|
104
|
-
"http://canary-proxy:1".to_string(),
|
|
105
|
-
),
|
|
106
|
-
(
|
|
107
|
-
"NODE_EXTRA_CA_CERTS".to_string(),
|
|
108
|
-
"/canary/ca.pem".to_string(),
|
|
109
|
-
),
|
|
110
|
-
("TEAM_AGENT_WORKSPACE".to_string(), "/ws".to_string()),
|
|
111
|
-
(
|
|
112
|
-
"TEAM_AGENT_OWNER_TEAM_ID".to_string(),
|
|
113
|
-
"teamdir".to_string(),
|
|
114
|
-
),
|
|
115
|
-
("TEAM_AGENT_AGENT_ID".to_string(), "worker_a".to_string()),
|
|
116
|
-
(
|
|
117
|
-
"HARNESS_PROBE".to_string(),
|
|
118
|
-
"printf 'LS_USR_BIN_TMUX=%s\\n'\n".to_string(),
|
|
119
|
-
),
|
|
120
|
-
]);
|
|
121
|
-
let spawn = RecordedSpawn {
|
|
122
|
-
argv: vec!["copilot".to_string()],
|
|
123
|
-
env: env.clone(),
|
|
124
|
-
env_unset: Vec::new(),
|
|
125
|
-
session: SessionName::new("s"),
|
|
126
|
-
window: WindowName::new("w"),
|
|
127
|
-
pane_id: PaneId::new("%1"),
|
|
128
|
-
};
|
|
129
|
-
assert!(
|
|
130
|
-
spawn_env_contract_failures("harness-value", &spawn, "worker_a").is_empty(),
|
|
131
|
-
"inherited values may contain the letters TMUX= without leaking TMUX/TMUX_PANE keys"
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
env.insert(
|
|
135
|
-
"TMUX".to_string(),
|
|
136
|
-
"/tmp/tmux-canary/default,1".to_string(),
|
|
137
|
-
);
|
|
138
|
-
let leaked = RecordedSpawn {
|
|
139
|
-
env,
|
|
140
|
-
..spawn
|
|
141
|
-
};
|
|
142
|
-
let failures = spawn_env_contract_failures("key-leak", &leaked, "worker_a");
|
|
143
|
-
assert!(
|
|
144
|
-
failures.iter().any(|row| row.contains("present_keys=") && row.contains("TMUX")),
|
|
145
|
-
"actual TMUX key must still fail closed; failures={failures:?}"
|
|
146
|
-
);
|
|
147
|
-
assert!(
|
|
148
|
-
failures.iter().all(|row| !row.contains("command_line=")),
|
|
149
|
-
"failures must not dump command_line; failures={failures:?}"
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#[test]
|
|
154
|
-
#[serial(env)]
|
|
155
|
-
fn worker_spawn_scrubs_cross_provider_process_identity_but_keeps_config_env() {
|
|
156
|
-
let _home = hermetic_guard::HermeticTestEnv::enter("worker-spawn-fork");
|
|
157
|
-
let _guard = EnvGuard::set([
|
|
158
|
-
("CLAUDECODE", "1"),
|
|
159
|
-
("CLAUDE_CODE_SESSION_ID", "leader-session"),
|
|
160
|
-
("CLAUDE_CODE_SENTINEL", "foreign"),
|
|
161
|
-
("CLAUDE_EFFORT", "high"),
|
|
162
|
-
("CODEX_THREAD_ID", "thread-from-parent"),
|
|
163
|
-
("OPENAI_API_KEY", "sk-test-config"),
|
|
164
|
-
("CODEX_HOME", "/tmp/codex-home-config"),
|
|
165
|
-
("TA_SPAWN_ENV_CANARY", "KEEP"),
|
|
166
|
-
("HTTP_PROXY", "http://canary-proxy:1"),
|
|
167
|
-
("NODE_EXTRA_CA_CERTS", "/canary/ca.pem"),
|
|
168
|
-
]);
|
|
169
|
-
|
|
170
|
-
// The identity scrub is provider-agnostic; a Copilot worker exercises every spawn surface.
|
|
171
|
-
let launch_team = compiled_team_dir("cross-launch", &[("worker_a", "Launch Worker")]);
|
|
172
|
-
let launch_transport = RecordingTransport::new().with_session_present(false);
|
|
173
|
-
launch_with_transport(
|
|
174
|
-
&launch_team.join("team.spec.yaml"),
|
|
175
|
-
false,
|
|
176
|
-
true,
|
|
177
|
-
true,
|
|
178
|
-
&launch_transport,
|
|
179
|
-
)
|
|
180
|
-
.expect("launch fixture should spawn worker");
|
|
181
|
-
|
|
182
|
-
let restart_team = compiled_team_dir("cross-restart", &[("worker_a", "Restart Worker")]);
|
|
183
|
-
seed_restart_state(&restart_team, "worker_a");
|
|
184
|
-
let restart_transport = RecordingTransport::new().with_session_present(false);
|
|
185
|
-
restart_with_transport(&restart_team, true, None, &restart_transport)
|
|
186
|
-
.expect("restart fixture should spawn worker");
|
|
187
|
-
|
|
188
|
-
let add_team = compiled_team_dir("cross-add", &[("worker_a", "Existing Worker")]);
|
|
189
|
-
seed_running_add_agent_state(&add_team, "worker_a");
|
|
190
|
-
let role_file = add_team.parent().unwrap().join("worker_b.md");
|
|
191
|
-
std::fs::write(&role_file, role_doc("worker_b", "Added Worker")).unwrap();
|
|
192
|
-
let add_transport = RecordingTransport::new().with_session_present(true);
|
|
193
|
-
add_agent_with_transport(
|
|
194
|
-
&add_team,
|
|
195
|
-
&AgentId::new("worker_b"),
|
|
196
|
-
&role_file,
|
|
197
|
-
false,
|
|
198
|
-
None,
|
|
199
|
-
&add_transport,
|
|
200
|
-
)
|
|
201
|
-
.expect("add-agent fixture should spawn worker");
|
|
202
|
-
|
|
203
|
-
let failures = [
|
|
204
|
-
("quick-start launch", launch_transport.single_spawn()),
|
|
205
|
-
("restart", restart_transport.single_spawn()),
|
|
206
|
-
("add-agent", add_transport.single_spawn()),
|
|
207
|
-
]
|
|
208
|
-
.into_iter()
|
|
209
|
-
.flat_map(|(surface, spawn)| cross_provider_identity_failures(surface, &spawn))
|
|
210
|
-
.collect::<Vec<_>>();
|
|
211
|
-
|
|
212
|
-
assert!(
|
|
213
|
-
failures.is_empty(),
|
|
214
|
-
"cross-provider worker env isolation contract failed:\n{}",
|
|
215
|
-
failures.join("\n")
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
#[test]
|
|
220
|
-
#[serial(env)]
|
|
221
|
-
fn worker_spawn_legacy_fork_reports_unverified_not_unsupported() {
|
|
222
|
-
// 已废除的行为:旧的 legacy fork 入口把 in-window fork 当成已验证能力(或报「不支持」),此断言证明它确实没了。
|
|
223
|
-
// 本轮裁定:即便是声明了 fork 能力的 copilot 源席,legacy 入口也必须明确报「未验证」,不是「不支持」,且不 spawn。
|
|
224
|
-
let _home = hermetic_guard::HermeticTestEnv::enter("legacy-fork-unverified");
|
|
225
|
-
let team = compiled_team_dir("legacy-fork-tombstone", &[("worker_a", "Fork Source")]);
|
|
226
|
-
seed_forkable_source_state(&team, "worker_a");
|
|
227
|
-
let transport = RecordingTransport::new().with_session_present(true);
|
|
228
|
-
let err = fork_agent_with_transport(
|
|
229
|
-
&team,
|
|
230
|
-
&AgentId::new("worker_a"),
|
|
231
|
-
&AgentId::new("worker_a"),
|
|
232
|
-
None,
|
|
233
|
-
false,
|
|
234
|
-
None,
|
|
235
|
-
&transport,
|
|
236
|
-
)
|
|
237
|
-
.expect_err("the legacy fork entry must refuse as unverified");
|
|
238
|
-
assert!(
|
|
239
|
-
matches!(
|
|
240
|
-
&err,
|
|
241
|
-
LifecycleError::Provider(message) if message == "copilot native session fork is unverified (未验证); no legacy fork or fresh replacement was performed"
|
|
242
|
-
),
|
|
243
|
-
"the legacy fork entry must report 未验证 for the copilot source; err={err}"
|
|
244
|
-
);
|
|
245
|
-
let text = err.to_string();
|
|
246
|
-
assert!(
|
|
247
|
-
!text.contains("不支持") && !text.contains("does not support"),
|
|
248
|
-
"the ruling is unverified, not unsupported; err={text}"
|
|
249
|
-
);
|
|
250
|
-
assert!(
|
|
251
|
-
transport.spawns.lock().unwrap().is_empty(),
|
|
252
|
-
"the refused legacy fork must not spawn a pane"
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
#[test]
|
|
257
|
-
#[serial(env)]
|
|
258
|
-
fn worker_spawn_stays_out_of_coordinator_tick_and_daemon_preserves_parent_env() {
|
|
259
|
-
let tick = std::fs::read_to_string(concat!(
|
|
260
|
-
env!("CARGO_MANIFEST_DIR"),
|
|
261
|
-
"/src/coordinator/tick.rs"
|
|
262
|
-
))
|
|
263
|
-
.unwrap();
|
|
264
|
-
assert!(
|
|
265
|
-
!tick.contains("transport.spawn_first") && !tick.contains("transport.spawn_into"),
|
|
266
|
-
"coordinator tick must never spawn worker panes; worker spawn belongs to user-invoked lifecycle paths so it inherits the user's shell env"
|
|
267
|
-
);
|
|
268
|
-
|
|
269
|
-
let health = std::fs::read_to_string(concat!(
|
|
270
|
-
env!("CARGO_MANIFEST_DIR"),
|
|
271
|
-
"/src/coordinator/health.rs"
|
|
272
|
-
))
|
|
273
|
-
.unwrap();
|
|
274
|
-
let start = health
|
|
275
|
-
.find("pub fn start_coordinator")
|
|
276
|
-
.map(|idx| &health[idx..])
|
|
277
|
-
.unwrap_or(&health);
|
|
278
|
-
let start = start
|
|
279
|
-
.find("pub fn stop_coordinator")
|
|
280
|
-
.map(|idx| &start[..idx])
|
|
281
|
-
.unwrap_or(start);
|
|
282
|
-
assert!(
|
|
283
|
-
!start.contains(".env_clear(") && !start.contains(".env("),
|
|
284
|
-
"start_coordinator must inherit the parent environment and must not clear/override daemon env; source={start}"
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
fn spawn_env_has_tmux_control_assignment(spawn: &RecordedSpawn) -> bool {
|
|
289
|
-
spawn.env.contains_key("TMUX")
|
|
290
|
-
|| spawn.env.contains_key("TMUX_PANE")
|
|
291
|
-
|| spawn.argv.iter().any(|part| {
|
|
292
|
-
part.split_whitespace().any(|tok| {
|
|
293
|
-
tok == "TMUX" || tok.starts_with("TMUX=") || tok.starts_with("TMUX_PANE=")
|
|
294
|
-
})
|
|
295
|
-
})
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
fn spawn_env_contract_failures(
|
|
299
|
-
surface: &str,
|
|
300
|
-
spawn: &RecordedSpawn,
|
|
301
|
-
agent_id: &str,
|
|
302
|
-
) -> Vec<String> {
|
|
303
|
-
let mut failures = Vec::new();
|
|
304
|
-
for (key, expected) in [
|
|
305
|
-
("TA_SPAWN_ENV_CANARY", Some("FOO")),
|
|
306
|
-
("HTTP_PROXY", Some("http://canary-proxy:1")),
|
|
307
|
-
("NODE_EXTRA_CA_CERTS", Some("/canary/ca.pem")),
|
|
308
|
-
("TEAM_AGENT_OWNER_TEAM_ID", Some("teamdir")),
|
|
309
|
-
] {
|
|
310
|
-
match (spawn.env.get(key).map(String::as_str), expected) {
|
|
311
|
-
(Some(actual), Some(wanted)) if actual == wanted => {}
|
|
312
|
-
(Some(_), Some(wanted)) => failures.push(format!(
|
|
313
|
-
"{surface}: `{key}` present but not `{wanted}`"
|
|
314
|
-
)),
|
|
315
|
-
_ => failures.push(format!(
|
|
316
|
-
"{surface}: missing `{key}` overlay/inherit"
|
|
317
|
-
)),
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
if spawn
|
|
321
|
-
.env
|
|
322
|
-
.get("TEAM_AGENT_WORKSPACE")
|
|
323
|
-
.is_none_or(|value| value.is_empty())
|
|
324
|
-
{
|
|
325
|
-
failures.push(format!("{surface}: missing `TEAM_AGENT_WORKSPACE` overlay"));
|
|
326
|
-
}
|
|
327
|
-
if spawn.env.get("TEAM_AGENT_AGENT_ID").map(String::as_str) != Some(agent_id) {
|
|
328
|
-
failures.push(format!(
|
|
329
|
-
"{surface}: missing `TEAM_AGENT_AGENT_ID={agent_id}` overlay"
|
|
330
|
-
));
|
|
331
|
-
}
|
|
332
|
-
if spawn_env_has_tmux_control_assignment(spawn) {
|
|
333
|
-
let present: Vec<&str> = ["TMUX", "TMUX_PANE"]
|
|
334
|
-
.into_iter()
|
|
335
|
-
.filter(|key| spawn.env.contains_key(*key))
|
|
336
|
-
.collect();
|
|
337
|
-
failures.push(format!(
|
|
338
|
-
"{surface}: worker spawn must filter tmux control env from inherited parent env; present_keys={present:?}"
|
|
339
|
-
));
|
|
340
|
-
}
|
|
341
|
-
if !spawn.argv.iter().any(|part| part == "copilot") {
|
|
342
|
-
failures.push(format!(
|
|
343
|
-
"{surface}: provider executable must remain the command name `copilot`"
|
|
344
|
-
));
|
|
345
|
-
}
|
|
346
|
-
if spawn.argv.iter().any(|part| part.ends_with("/copilot")) {
|
|
347
|
-
failures.push(format!(
|
|
348
|
-
"{surface}: provider executable must not be hard-coded as an absolute copilot path"
|
|
349
|
-
));
|
|
350
|
-
}
|
|
351
|
-
failures
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
fn cross_provider_identity_failures(surface: &str, spawn: &RecordedSpawn) -> Vec<String> {
|
|
355
|
-
let mut failures = Vec::new();
|
|
356
|
-
let identity_keys = [
|
|
357
|
-
"CLAUDECODE",
|
|
358
|
-
"CLAUDE_CODE_SESSION_ID",
|
|
359
|
-
"CLAUDE_CODE_SENTINEL",
|
|
360
|
-
"CLAUDE_EFFORT",
|
|
361
|
-
"CODEX_THREAD_ID",
|
|
362
|
-
];
|
|
363
|
-
let present_identity = identity_keys
|
|
364
|
-
.iter()
|
|
365
|
-
.copied()
|
|
366
|
-
.filter(|key| spawn.env.contains_key(*key))
|
|
367
|
-
.collect::<Vec<_>>();
|
|
368
|
-
if !present_identity.is_empty() {
|
|
369
|
-
failures.push(format!(
|
|
370
|
-
"{surface}: worker env map must scrub process/session identity keys; present={present_identity:?}"
|
|
371
|
-
));
|
|
372
|
-
}
|
|
373
|
-
let missing_unsets = identity_keys
|
|
374
|
-
.iter()
|
|
375
|
-
.copied()
|
|
376
|
-
.filter(|key| !spawn.env_unset.iter().any(|candidate| candidate == key))
|
|
377
|
-
.collect::<Vec<_>>();
|
|
378
|
-
if !missing_unsets.is_empty() {
|
|
379
|
-
failures.push(format!(
|
|
380
|
-
"{surface}: worker env_unset must clear stale tmux/server identity keys; missing={missing_unsets:?}; env_unset={:?}",
|
|
381
|
-
spawn.env_unset
|
|
382
|
-
));
|
|
383
|
-
}
|
|
384
|
-
for (key, value) in [
|
|
385
|
-
("OPENAI_API_KEY", "sk-test-config"),
|
|
386
|
-
("CODEX_HOME", "/tmp/codex-home-config"),
|
|
387
|
-
("TA_SPAWN_ENV_CANARY", "KEEP"),
|
|
388
|
-
("HTTP_PROXY", "http://canary-proxy:1"),
|
|
389
|
-
("NODE_EXTRA_CA_CERTS", "/canary/ca.pem"),
|
|
390
|
-
] {
|
|
391
|
-
if spawn.env.get(key).map(String::as_str) != Some(value) {
|
|
392
|
-
failures.push(format!(
|
|
393
|
-
"{surface}: worker env must preserve config/generic key `{key}` with the expected test value; present={}",
|
|
394
|
-
spawn.env.contains_key(key)
|
|
395
|
-
));
|
|
396
|
-
}
|
|
397
|
-
if spawn.env_unset.iter().any(|candidate| candidate == key) {
|
|
398
|
-
failures.push(format!(
|
|
399
|
-
"{surface}: worker env_unset must not remove config/generic key `{key}`; env_unset={:?}",
|
|
400
|
-
spawn.env_unset
|
|
401
|
-
));
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
failures
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
fn compiled_team_dir(label: &str, agents: &[(&str, &str)]) -> PathBuf {
|
|
408
|
-
compiled_team_dir_for_provider(label, agents, "copilot")
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
fn compiled_team_dir_for_provider(label: &str, agents: &[(&str, &str)], provider: &str) -> PathBuf {
|
|
412
|
-
let team = tmp_dir(label).join("teamdir");
|
|
413
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
414
|
-
std::fs::write(
|
|
415
|
-
team.join("TEAM.md"),
|
|
416
|
-
format!(
|
|
417
|
-
"---\nname: envteam\nobjective: Worker spawn env contract.\nprovider: {provider}\n---\n\nTeam.\n"
|
|
418
|
-
),
|
|
419
|
-
)
|
|
420
|
-
.unwrap();
|
|
421
|
-
for (name, role) in agents {
|
|
422
|
-
std::fs::write(
|
|
423
|
-
team.join("agents").join(format!("{name}.md")),
|
|
424
|
-
role_doc_for_provider(name, role, provider),
|
|
425
|
-
)
|
|
426
|
-
.unwrap();
|
|
427
|
-
}
|
|
428
|
-
let spec = team_agent::compiler::compile_team(&team).unwrap();
|
|
429
|
-
std::fs::write(
|
|
430
|
-
team.join("team.spec.yaml"),
|
|
431
|
-
team_agent::model::yaml::dumps(&spec),
|
|
432
|
-
)
|
|
433
|
-
.unwrap();
|
|
434
|
-
team
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
fn role_doc(name: &str, role: &str) -> String {
|
|
438
|
-
role_doc_for_provider(name, role, "copilot")
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
fn role_doc_for_provider(name: &str, role: &str, provider: &str) -> String {
|
|
442
|
-
format!(
|
|
443
|
-
"---\nname: {name}\nrole: {role}\nprovider: {provider}\nmodel: {provider}-test-model\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\n{role}.\n"
|
|
444
|
-
)
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
fn seed_restart_state(team: &Path, agent_id: &str) {
|
|
448
|
-
seed_restart_state_as(team, agent_id, "copilot");
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
fn seed_restart_state_as(team: &Path, agent_id: &str, provider: &str) {
|
|
452
|
-
team_agent::state::persist::save_runtime_state(
|
|
453
|
-
team,
|
|
454
|
-
&json!({
|
|
455
|
-
"active_team_key": RUNTIME_TEAM_KEY,
|
|
456
|
-
"team_dir": team.to_string_lossy().to_string(),
|
|
457
|
-
"spec_path": team.join("team.spec.yaml").to_string_lossy().to_string(),
|
|
458
|
-
"session_name": "team-envteam",
|
|
459
|
-
"agents": {
|
|
460
|
-
agent_id: {
|
|
461
|
-
"status": "running",
|
|
462
|
-
"provider": provider,
|
|
463
|
-
"role": "Restart Worker",
|
|
464
|
-
"tools": ["mcp_team"],
|
|
465
|
-
"window": agent_id,
|
|
466
|
-
"owner_team_id": RUNTIME_TEAM_KEY,
|
|
467
|
-
"session_id": "sess-worker-a",
|
|
468
|
-
"first_send_at": "2026-06-05T09:00:00+00:00"
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}),
|
|
472
|
-
)
|
|
473
|
-
.unwrap();
|
|
474
|
-
seed_healthy_coordinator(team);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
fn seed_running_add_agent_state(team: &Path, agent_id: &str) {
|
|
478
|
-
seed_running_add_agent_state_as(team, agent_id, "copilot");
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
fn seed_running_add_agent_state_as(team: &Path, agent_id: &str, provider: &str) {
|
|
482
|
-
let workspace = team_agent::model::paths::team_workspace(team).unwrap();
|
|
483
|
-
team_agent::state::persist::save_runtime_state(
|
|
484
|
-
&workspace,
|
|
485
|
-
&json!({
|
|
486
|
-
"active_team_key": RUNTIME_TEAM_KEY,
|
|
487
|
-
"team_dir": team.to_string_lossy().to_string(),
|
|
488
|
-
"spec_path": team.join("team.spec.yaml").to_string_lossy().to_string(),
|
|
489
|
-
"session_name": "team-envteam",
|
|
490
|
-
"agents": {
|
|
491
|
-
agent_id: {
|
|
492
|
-
"status": "running",
|
|
493
|
-
"provider": provider,
|
|
494
|
-
"role": "Existing Worker",
|
|
495
|
-
"tools": ["mcp_team"],
|
|
496
|
-
"window": agent_id,
|
|
497
|
-
"owner_team_id": RUNTIME_TEAM_KEY
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}),
|
|
501
|
-
)
|
|
502
|
-
.unwrap();
|
|
503
|
-
seed_healthy_coordinator(&workspace);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
fn seed_forkable_source_state(team: &Path, agent_id: &str) {
|
|
507
|
-
let workspace = team_agent::model::paths::team_workspace(team).unwrap();
|
|
508
|
-
team_agent::state::persist::save_runtime_state(
|
|
509
|
-
&workspace,
|
|
510
|
-
&json!({
|
|
511
|
-
"active_team_key": RUNTIME_TEAM_KEY,
|
|
512
|
-
"team_dir": team.to_string_lossy().to_string(),
|
|
513
|
-
"spec_path": team.join("team.spec.yaml").to_string_lossy().to_string(),
|
|
514
|
-
"session_name": "team-envteam",
|
|
515
|
-
"agents": {
|
|
516
|
-
agent_id: {
|
|
517
|
-
"status": "running",
|
|
518
|
-
"provider": "copilot",
|
|
519
|
-
"auth_mode": "subscription",
|
|
520
|
-
"role": "Fork Source",
|
|
521
|
-
"window": agent_id,
|
|
522
|
-
"owner_team_id": RUNTIME_TEAM_KEY,
|
|
523
|
-
"session_id": "sess-worker-a",
|
|
524
|
-
"captured_at": "2026-07-16T00:00:00+00:00",
|
|
525
|
-
"captured_via": "session.captured",
|
|
526
|
-
"tools": ["mcp_team"]
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}),
|
|
530
|
-
)
|
|
531
|
-
.unwrap();
|
|
532
|
-
seed_healthy_coordinator(&workspace);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
fn seed_healthy_coordinator(workspace: &Path) {
|
|
536
|
-
let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
|
|
537
|
-
std::fs::create_dir_all(team_agent::model::paths::runtime_dir(workspace.as_path())).unwrap();
|
|
538
|
-
let _ = team_agent::message_store::MessageStore::open(workspace.as_path()).unwrap();
|
|
539
|
-
let pid = team_agent::coordinator::Pid::new(std::process::id());
|
|
540
|
-
team_agent::coordinator::write_coordinator_metadata(
|
|
541
|
-
&workspace,
|
|
542
|
-
pid,
|
|
543
|
-
team_agent::coordinator::MetadataSource::Boot,
|
|
544
|
-
)
|
|
545
|
-
.unwrap();
|
|
546
|
-
std::fs::write(
|
|
547
|
-
team_agent::coordinator::coordinator_pid_path(&workspace),
|
|
548
|
-
pid.to_string(),
|
|
549
|
-
)
|
|
550
|
-
.unwrap();
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
fn tmp_dir(tag: &str) -> PathBuf {
|
|
554
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
555
|
-
let dir = std::env::temp_dir().join(format!(
|
|
556
|
-
"ta-rs-worker-spawn-env-{tag}-{}-{}",
|
|
557
|
-
std::process::id(),
|
|
558
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
559
|
-
));
|
|
560
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
561
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
562
|
-
std::fs::canonicalize(dir).unwrap()
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
struct EnvGuard {
|
|
566
|
-
previous: Vec<(&'static str, Option<String>)>,
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
impl EnvGuard {
|
|
570
|
-
fn set<const N: usize>(values: [(&'static str, &'static str); N]) -> Self {
|
|
571
|
-
let previous = values
|
|
572
|
-
.iter()
|
|
573
|
-
.map(|(key, _)| (*key, std::env::var(key).ok()))
|
|
574
|
-
.collect::<Vec<_>>();
|
|
575
|
-
for (key, value) in values {
|
|
576
|
-
unsafe {
|
|
577
|
-
std::env::set_var(key, value);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
Self { previous }
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
impl Drop for EnvGuard {
|
|
585
|
-
fn drop(&mut self) {
|
|
586
|
-
for (key, value) in self.previous.drain(..).rev() {
|
|
587
|
-
unsafe {
|
|
588
|
-
if let Some(value) = value {
|
|
589
|
-
std::env::set_var(key, value);
|
|
590
|
-
} else {
|
|
591
|
-
std::env::remove_var(key);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
#[derive(Debug, Clone)]
|
|
599
|
-
struct RecordedSpawn {
|
|
600
|
-
argv: Vec<String>,
|
|
601
|
-
env: BTreeMap<String, String>,
|
|
602
|
-
env_unset: Vec<String>,
|
|
603
|
-
session: SessionName,
|
|
604
|
-
window: WindowName,
|
|
605
|
-
pane_id: PaneId,
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
impl RecordedSpawn {
|
|
609
|
-
fn command_line(&self) -> String {
|
|
610
|
-
let mut parts = self
|
|
611
|
-
.env
|
|
612
|
-
.iter()
|
|
613
|
-
.map(|(key, value)| format!("{key}={value}"))
|
|
614
|
-
.collect::<Vec<_>>();
|
|
615
|
-
parts.extend(self.argv.iter().cloned());
|
|
616
|
-
parts.join(" ")
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
#[derive(Debug, Default)]
|
|
621
|
-
struct RecordingTransport {
|
|
622
|
-
spawns: Mutex<Vec<RecordedSpawn>>,
|
|
623
|
-
session_present: bool,
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
impl RecordingTransport {
|
|
627
|
-
fn new() -> Self {
|
|
628
|
-
Self::default()
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
fn with_session_present(mut self, present: bool) -> Self {
|
|
632
|
-
self.session_present = present;
|
|
633
|
-
self
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
#[allow(dead_code)]
|
|
637
|
-
fn single_spawn_command_line(&self) -> String {
|
|
638
|
-
self.single_spawn().command_line()
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
fn single_spawn(&self) -> RecordedSpawn {
|
|
642
|
-
let spawns = self.spawns.lock().unwrap();
|
|
643
|
-
assert_eq!(
|
|
644
|
-
spawns.len(),
|
|
645
|
-
1,
|
|
646
|
-
"fixture should record exactly one worker spawn; spawns={spawns:?}"
|
|
647
|
-
);
|
|
648
|
-
spawns[0].clone()
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
fn spawn_result(
|
|
652
|
-
&self,
|
|
653
|
-
session: &SessionName,
|
|
654
|
-
window: &WindowName,
|
|
655
|
-
argv: &[String],
|
|
656
|
-
_cwd: &Path,
|
|
657
|
-
env: &BTreeMap<String, String>,
|
|
658
|
-
env_unset: &[String],
|
|
659
|
-
) -> SpawnResult {
|
|
660
|
-
let mut spawns = self.spawns.lock().unwrap();
|
|
661
|
-
let pane_id = PaneId::new(format!("%{}", spawns.len() + 1));
|
|
662
|
-
spawns.push(RecordedSpawn {
|
|
663
|
-
argv: argv.to_vec(),
|
|
664
|
-
env: env.clone(),
|
|
665
|
-
env_unset: env_unset.to_vec(),
|
|
666
|
-
session: session.clone(),
|
|
667
|
-
window: window.clone(),
|
|
668
|
-
pane_id: pane_id.clone(),
|
|
669
|
-
});
|
|
670
|
-
SpawnResult {
|
|
671
|
-
pane_id,
|
|
672
|
-
session: session.clone(),
|
|
673
|
-
window: window.clone(),
|
|
674
|
-
child_pid: None,
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
impl Transport for RecordingTransport {
|
|
680
|
-
fn kind(&self) -> BackendKind {
|
|
681
|
-
BackendKind::Tmux
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
fn spawn_first(
|
|
685
|
-
&self,
|
|
686
|
-
session: &SessionName,
|
|
687
|
-
window: &WindowName,
|
|
688
|
-
argv: &[String],
|
|
689
|
-
cwd: &Path,
|
|
690
|
-
env: &BTreeMap<String, String>,
|
|
691
|
-
) -> Result<SpawnResult, TransportError> {
|
|
692
|
-
Ok(self.spawn_result(session, window, argv, cwd, env, &[]))
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
fn spawn_into(
|
|
696
|
-
&self,
|
|
697
|
-
session: &SessionName,
|
|
698
|
-
window: &WindowName,
|
|
699
|
-
argv: &[String],
|
|
700
|
-
cwd: &Path,
|
|
701
|
-
env: &BTreeMap<String, String>,
|
|
702
|
-
) -> Result<SpawnResult, TransportError> {
|
|
703
|
-
Ok(self.spawn_result(session, window, argv, cwd, env, &[]))
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
fn spawn_first_with_env_unset(
|
|
707
|
-
&self,
|
|
708
|
-
session: &SessionName,
|
|
709
|
-
window: &WindowName,
|
|
710
|
-
argv: &[String],
|
|
711
|
-
cwd: &Path,
|
|
712
|
-
env: &BTreeMap<String, String>,
|
|
713
|
-
env_unset: &[String],
|
|
714
|
-
) -> Result<SpawnResult, TransportError> {
|
|
715
|
-
Ok(self.spawn_result(session, window, argv, cwd, env, env_unset))
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
fn spawn_into_with_env_unset(
|
|
719
|
-
&self,
|
|
720
|
-
session: &SessionName,
|
|
721
|
-
window: &WindowName,
|
|
722
|
-
argv: &[String],
|
|
723
|
-
cwd: &Path,
|
|
724
|
-
env: &BTreeMap<String, String>,
|
|
725
|
-
env_unset: &[String],
|
|
726
|
-
) -> Result<SpawnResult, TransportError> {
|
|
727
|
-
Ok(self.spawn_result(session, window, argv, cwd, env, env_unset))
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
fn inject(
|
|
731
|
-
&self,
|
|
732
|
-
_target: &Target,
|
|
733
|
-
_payload: &InjectPayload,
|
|
734
|
-
_submit: Key,
|
|
735
|
-
_bracketed: bool,
|
|
736
|
-
) -> Result<InjectReport, TransportError> {
|
|
737
|
-
Ok(InjectReport {
|
|
738
|
-
stage_reached: InjectStage::Submit,
|
|
739
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
740
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
741
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
742
|
-
attempts: 1,
|
|
743
|
-
submit_diagnostics: None,
|
|
744
|
-
})
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
748
|
-
Ok(())
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
fn capture(
|
|
752
|
-
&self,
|
|
753
|
-
_target: &Target,
|
|
754
|
-
range: CaptureRange,
|
|
755
|
-
) -> Result<CapturedText, TransportError> {
|
|
756
|
-
// The Copilot ready screen lets the startup-prompt handler return at once.
|
|
757
|
-
Ok(CapturedText {
|
|
758
|
-
text: team_agent::provider::COPILOT_READY_MARKER.to_string(),
|
|
759
|
-
range,
|
|
760
|
-
})
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
fn query(&self, _target: &Target, field: PaneField) -> Result<Option<String>, TransportError> {
|
|
764
|
-
match field {
|
|
765
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
766
|
-
_ => Ok(None),
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
fn liveness(
|
|
771
|
-
&self,
|
|
772
|
-
_pane: &PaneId,
|
|
773
|
-
) -> Result<team_agent::transport::PaneLiveness, TransportError> {
|
|
774
|
-
Ok(team_agent::transport::PaneLiveness::Live)
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
778
|
-
Ok(self
|
|
779
|
-
.spawns
|
|
780
|
-
.lock()
|
|
781
|
-
.unwrap()
|
|
782
|
-
.iter()
|
|
783
|
-
.map(|spawn| PaneInfo {
|
|
784
|
-
pane_id: spawn.pane_id.clone(),
|
|
785
|
-
session: spawn.session.clone(),
|
|
786
|
-
window_index: None,
|
|
787
|
-
window_name: Some(spawn.window.clone()),
|
|
788
|
-
pane_index: None,
|
|
789
|
-
tty: None,
|
|
790
|
-
current_command: Some("copilot".to_string()),
|
|
791
|
-
current_path: None,
|
|
792
|
-
active: false,
|
|
793
|
-
pane_pid: None,
|
|
794
|
-
leader_env: BTreeMap::new(),
|
|
795
|
-
})
|
|
796
|
-
.collect())
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
800
|
-
Ok(self.session_present || !self.spawns.lock().unwrap().is_empty())
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
804
|
-
Ok(Vec::new())
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
fn set_session_env(
|
|
808
|
-
&self,
|
|
809
|
-
_session: &SessionName,
|
|
810
|
-
_key: &str,
|
|
811
|
-
_value: &str,
|
|
812
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
813
|
-
Ok(SetEnvOutcome::Applied)
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
|
|
817
|
-
Ok(())
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
|
|
821
|
-
Ok(())
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
825
|
-
Ok(AttachOutcome::Attached)
|
|
826
|
-
}
|
|
827
|
-
}
|