@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,546 +0,0 @@
|
|
|
1
|
-
use std::os::unix::fs::PermissionsExt;
|
|
2
|
-
use std::path::{Path, PathBuf};
|
|
3
|
-
use std::sync::atomic::{AtomicU32, Ordering};
|
|
4
|
-
|
|
5
|
-
use crate::lifecycle::launch::pi_mcp::{
|
|
6
|
-
PiExecutableChain, PiMaterializeRequest, PiSessionScope,
|
|
7
|
-
PiWrapperRequest, materialize_pi_plan,
|
|
8
|
-
parse_pi_list_models_table, pi_seat_paths, resolve_pi_executable_chain,
|
|
9
|
-
validate_pi_executable_chain, validate_pi_wrapper_source, write_pi_wrapper,
|
|
10
|
-
write_pi_wrapper_with_publish,
|
|
11
|
-
};
|
|
12
|
-
use crate::model::enums::ProviderEffort;
|
|
13
|
-
use crate::provider::McpConfig;
|
|
14
|
-
|
|
15
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
16
|
-
mod hermetic_guard;
|
|
17
|
-
use hermetic_guard::HermeticTestEnv;
|
|
18
|
-
|
|
19
|
-
const CATALOG_DIGEST: &str = "726cedb6c3f6fe80a0d7b98918d8ed5063695e01f510a48f46c4bad5daab49fe";
|
|
20
|
-
static NEXT_ROOT: AtomicU32 = AtomicU32::new(0);
|
|
21
|
-
const PI_WRAPPER_CHILD: &str = "TEAM_AGENT_TEST_PI_WRAPPER_CHILD";
|
|
22
|
-
const PI_WRAPPER_AMBIENT_CHILD: &str = "TEAM_AGENT_TEST_PI_WRAPPER_AMBIENT_CHILD";
|
|
23
|
-
const PI_SYMLINK_CHILD: &str = "TEAM_AGENT_TEST_PI_SYMLINK_CHILD";
|
|
24
|
-
const PI_WRAPPER_PARENT_PID: &str = "TEAM_AGENT_TEST_PI_WRAPPER_PARENT_PID";
|
|
25
|
-
const PI_WRAPPER_TEST: &str = concat!(
|
|
26
|
-
"lifecycle::tests::pi_executable_mcp_red::",
|
|
27
|
-
"pi_wrapper_is_atomic_per_seat_and_embeds_exact_candidate"
|
|
28
|
-
);
|
|
29
|
-
const PI_WRAPPER_AMBIENT_TEST: &str = concat!(
|
|
30
|
-
"lifecycle::tests::pi_executable_mcp_red::",
|
|
31
|
-
"pi_wrapper_runtime_registration_does_not_copy_ambient_config"
|
|
32
|
-
);
|
|
33
|
-
const PI_SYMLINK_TEST: &str = concat!(
|
|
34
|
-
"lifecycle::tests::pi_executable_mcp_red::",
|
|
35
|
-
"pi_standard_npm_symlink_is_a_verified_launch_entry"
|
|
36
|
-
);
|
|
37
|
-
const PI_MATERIALIZER_CHILD: &str = "TEAM_AGENT_TEST_PI_MATERIALIZER_CHILD";
|
|
38
|
-
const PI_MATERIALIZER_TEST: &str = concat!(
|
|
39
|
-
"lifecycle::tests::pi_executable_mcp_red::",
|
|
40
|
-
"pi_leader_materializer_uses_the_recorded_scope"
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
fn run_process_isolated(marker: &str, test_name: &str, body: impl FnOnce()) {
|
|
44
|
-
if std::env::var_os(marker).is_some() {
|
|
45
|
-
body();
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let output =
|
|
50
|
-
std::process::Command::new(std::env::current_exe().expect("current lib-test executable"))
|
|
51
|
-
.args(["--exact", test_name, "--nocapture", "--test-threads=1"])
|
|
52
|
-
.env(marker, "1")
|
|
53
|
-
.env(PI_WRAPPER_PARENT_PID, std::process::id().to_string())
|
|
54
|
-
.output()
|
|
55
|
-
.expect("run Pi wrapper send_message fixture in isolated child test process");
|
|
56
|
-
assert!(
|
|
57
|
-
output.status.success(),
|
|
58
|
-
"isolated Pi wrapper child failed: test={test_name} status={:?}\nstdout:\n{}\nstderr:\n{}",
|
|
59
|
-
output.status.code(),
|
|
60
|
-
String::from_utf8_lossy(&output.stdout),
|
|
61
|
-
String::from_utf8_lossy(&output.stderr),
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
fn assert_isolated_child() {
|
|
66
|
-
let parent_pid = std::env::var(PI_WRAPPER_PARENT_PID)
|
|
67
|
-
.expect("isolated child receives the parent test process id");
|
|
68
|
-
assert_ne!(
|
|
69
|
-
std::process::id().to_string(),
|
|
70
|
-
parent_pid,
|
|
71
|
-
"Pi wrapper send_message fixture must not run in the parent lib-test process"
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
fn temp_root(label: &str) -> PathBuf {
|
|
76
|
-
let seq = NEXT_ROOT.fetch_add(1, Ordering::Relaxed);
|
|
77
|
-
let root = std::env::temp_dir().join(format!(
|
|
78
|
-
"team-agent-pi-{label}-{}-{seq}",
|
|
79
|
-
std::process::id()
|
|
80
|
-
));
|
|
81
|
-
std::fs::create_dir_all(&root).expect("create fixture root");
|
|
82
|
-
root
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
fn mcp_config(candidate: &Path, workspace: &Path, agent_id: &str) -> McpConfig {
|
|
86
|
-
McpConfig {
|
|
87
|
-
raw: serde_json::json!({
|
|
88
|
-
"team_orchestrator": {
|
|
89
|
-
"command": candidate,
|
|
90
|
-
"args": ["mcp-server"],
|
|
91
|
-
"env": {
|
|
92
|
-
"TEAM_AGENT_WORKSPACE": workspace,
|
|
93
|
-
"TEAM_AGENT_ID": agent_id,
|
|
94
|
-
"TEAM_AGENT_AGENT_ID": agent_id,
|
|
95
|
-
"TEAM_AGENT_OWNER_TEAM_ID": "team-a",
|
|
96
|
-
"TEAM_AGENT_AUTH_MODE": "subscription"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}),
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
#[test]
|
|
104
|
-
fn pi_executable_chain_accepts_any_first_path_entry_and_freezes_catalog() {
|
|
105
|
-
let chain = PiExecutableChain {
|
|
106
|
-
path_entry: PathBuf::from("/Users/fixture/.local/bin/pi"),
|
|
107
|
-
pi_version: "0.84.3".to_string(),
|
|
108
|
-
catalog_sha256: CATALOG_DIGEST.to_string(),
|
|
109
|
-
};
|
|
110
|
-
validate_pi_executable_chain(&chain).expect("the PATH wrapper entry is valid");
|
|
111
|
-
|
|
112
|
-
// A plain binary or compiled wrapper first on PATH is what bare `pi` runs.
|
|
113
|
-
let mut direct_binary = chain.clone();
|
|
114
|
-
direct_binary.path_entry = PathBuf::from("/opt/homebrew/bin/pi");
|
|
115
|
-
validate_pi_executable_chain(&direct_binary)
|
|
116
|
-
.expect("a direct binary first on PATH is the native launch entry");
|
|
117
|
-
|
|
118
|
-
let mut newer = chain.clone();
|
|
119
|
-
newer.pi_version = "0.84.4".to_string();
|
|
120
|
-
validate_pi_executable_chain(&newer)
|
|
121
|
-
.expect("an arbitrary newer Pi version with the same public protocol is valid");
|
|
122
|
-
|
|
123
|
-
for bad in ["", "pi", "/opt/homebrew/bin/pi-native"] {
|
|
124
|
-
let mut wrong = chain.clone();
|
|
125
|
-
wrong.path_entry = PathBuf::from(bad);
|
|
126
|
-
assert!(validate_pi_executable_chain(&wrong).is_err(), "{bad:?}");
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
let mut wrong_catalog = chain.clone();
|
|
130
|
-
wrong_catalog.catalog_sha256 = "00".repeat(32);
|
|
131
|
-
assert!(validate_pi_executable_chain(&wrong_catalog).is_err());
|
|
132
|
-
|
|
133
|
-
assert!(parse_pi_list_models_table(b"provider model\nopenai-codex gpt-5.6-luna\n").is_ok());
|
|
134
|
-
assert!(parse_pi_list_models_table(b"provider model\n").is_err());
|
|
135
|
-
assert!(parse_pi_list_models_table(b"provider model\nmalformed\n").is_err());
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
#[test]
|
|
139
|
-
fn pi_standard_npm_symlink_is_a_verified_launch_entry() {
|
|
140
|
-
run_process_isolated(PI_SYMLINK_CHILD, PI_SYMLINK_TEST, || {
|
|
141
|
-
assert_isolated_child();
|
|
142
|
-
let root = temp_root("npm-symlink");
|
|
143
|
-
let bin = root.join("bin");
|
|
144
|
-
let later_bin = root.join("later-bin");
|
|
145
|
-
std::fs::create_dir_all(&bin).expect("create bin");
|
|
146
|
-
std::fs::create_dir_all(&later_bin).expect("create later bin");
|
|
147
|
-
let real = root.join("cli.js");
|
|
148
|
-
let script = "#!/bin/sh\ncase \"$1\" in\n --version) printf '0.84.4\\n' ;;\n --list-models) printf 'provider model\\nteam-agent qwen3.8-27b\\n' ;;\n list) exit 64 ;;\n *) exit 64 ;;\nesac\n";
|
|
149
|
-
std::fs::write(&real, &script).expect("write protocol-capable Pi entry");
|
|
150
|
-
std::fs::set_permissions(&real, std::fs::Permissions::from_mode(0o755))
|
|
151
|
-
.expect("make Pi entry executable");
|
|
152
|
-
std::os::unix::fs::symlink(&real, bin.join("pi")).expect("create npm-style symlink");
|
|
153
|
-
std::fs::write(later_bin.join("pi"), script).expect("write later Pi wrapper");
|
|
154
|
-
std::fs::set_permissions(later_bin.join("pi"), std::fs::Permissions::from_mode(0o755))
|
|
155
|
-
.expect("make later Pi wrapper executable");
|
|
156
|
-
unsafe {
|
|
157
|
-
std::env::set_var(
|
|
158
|
-
"PATH",
|
|
159
|
-
std::env::join_paths([&bin, &later_bin]).expect("join fixture PATH"),
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
let (chain, models) = resolve_pi_executable_chain()
|
|
164
|
-
.expect("the first PATH Pi entry must define direct Pi behavior");
|
|
165
|
-
assert_eq!(chain.path_entry, bin.join("pi"), "the npm symlink is kept as found");
|
|
166
|
-
assert_eq!(models, ["team-agent/qwen3.8-27b"]);
|
|
167
|
-
|
|
168
|
-
// A user wrapper prepended to PATH is the entry, and every probe runs it.
|
|
169
|
-
let wrappers = root.join("wrappers");
|
|
170
|
-
std::fs::create_dir_all(&wrappers).expect("create wrapper dir");
|
|
171
|
-
let marker = root.join("wrapper-invocations");
|
|
172
|
-
std::fs::write(
|
|
173
|
-
wrappers.join("pi"),
|
|
174
|
-
format!(
|
|
175
|
-
"#!/bin/sh\nprintf '%s\\n' \"$*\" >> '{}'\nexec '{}' \"$@\"\n",
|
|
176
|
-
marker.display(),
|
|
177
|
-
bin.join("pi").display()
|
|
178
|
-
),
|
|
179
|
-
)
|
|
180
|
-
.expect("write user Pi wrapper");
|
|
181
|
-
std::fs::set_permissions(wrappers.join("pi"), std::fs::Permissions::from_mode(0o755))
|
|
182
|
-
.expect("make user Pi wrapper executable");
|
|
183
|
-
unsafe {
|
|
184
|
-
std::env::set_var(
|
|
185
|
-
"PATH",
|
|
186
|
-
std::env::join_paths([&wrappers, &bin, &later_bin]).expect("join wrapper PATH"),
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
let (chain, models) =
|
|
190
|
-
resolve_pi_executable_chain().expect("a user wrapper first on PATH is accepted");
|
|
191
|
-
assert_eq!(chain.path_entry, wrappers.join("pi"));
|
|
192
|
-
assert_eq!(models, ["team-agent/qwen3.8-27b"]);
|
|
193
|
-
assert_eq!(
|
|
194
|
-
std::fs::read_to_string(&marker).expect("the wrapper genuinely ran"),
|
|
195
|
-
"--version\n--list-models\n"
|
|
196
|
-
);
|
|
197
|
-
std::fs::remove_dir_all(root).expect("remove symlink fixture");
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
#[test]
|
|
202
|
-
fn pi_wrapper_is_atomic_per_seat_and_embeds_exact_candidate() {
|
|
203
|
-
run_process_isolated(PI_WRAPPER_CHILD, PI_WRAPPER_TEST, || {
|
|
204
|
-
let hermetic = HermeticTestEnv::enter("pi-wrapper-send");
|
|
205
|
-
assert_isolated_child();
|
|
206
|
-
pi_wrapper_is_atomic_body(&hermetic);
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
fn pi_wrapper_is_atomic_body(hermetic: &HermeticTestEnv) {
|
|
211
|
-
let root = hermetic.workspace("wrapper");
|
|
212
|
-
let workspace = root.join("workspace");
|
|
213
|
-
let candidate = root.join("candidate/team-agent");
|
|
214
|
-
std::fs::create_dir_all(candidate.parent().expect("candidate parent"))
|
|
215
|
-
.expect("create candidate parent");
|
|
216
|
-
std::fs::write(&candidate, b"candidate").expect("write candidate fixture");
|
|
217
|
-
let destination = workspace.join(".team/runtime/pi/team-a/worker-a/team-mcp.ts");
|
|
218
|
-
|
|
219
|
-
let written = write_pi_wrapper(PiWrapperRequest {
|
|
220
|
-
destination: &destination,
|
|
221
|
-
candidate_executable: &candidate,
|
|
222
|
-
mcp_config: &mcp_config(&candidate, &workspace, "worker-a"),
|
|
223
|
-
team_id: "team-a",
|
|
224
|
-
agent_id: "worker-a",
|
|
225
|
-
workspace: &workspace,
|
|
226
|
-
include_tools: &["send_message", "report_result"],
|
|
227
|
-
})
|
|
228
|
-
.expect("atomic wrapper write");
|
|
229
|
-
assert_eq!(written, destination);
|
|
230
|
-
assert_eq!(
|
|
231
|
-
std::fs::metadata(&written)
|
|
232
|
-
.expect("wrapper metadata")
|
|
233
|
-
.permissions()
|
|
234
|
-
.mode()
|
|
235
|
-
& 0o777,
|
|
236
|
-
0o600
|
|
237
|
-
);
|
|
238
|
-
|
|
239
|
-
let source = std::fs::read_to_string(&written).expect("read wrapper");
|
|
240
|
-
assert!(source.contains(candidate.to_string_lossy().as_ref()));
|
|
241
|
-
assert!(source.contains("TEAM_AGENT_ID") && source.contains("worker-a"));
|
|
242
|
-
assert!(source.contains("TEAM_AGENT_OWNER_TEAM_ID") && source.contains("team-a"));
|
|
243
|
-
assert!(source.contains("pi.registerMcpServer(alias"));
|
|
244
|
-
assert!(source.contains("pi.unregisterMcpServer(alias"));
|
|
245
|
-
assert!(source.contains("toolExposure"));
|
|
246
|
-
assert!(source.contains("session_start") && source.contains("session_shutdown"));
|
|
247
|
-
assert!(!source.contains("pi-mcp-adapter"));
|
|
248
|
-
assert!(!source.contains("MCP_RUNTIME_REGISTER_EVENT"));
|
|
249
|
-
assert!(source.contains("includeTools"));
|
|
250
|
-
assert!(source.contains("send_message") && source.contains("report_result"));
|
|
251
|
-
assert!(!source.contains("createMcpAdapter"));
|
|
252
|
-
assert!(!source.contains("directTools"));
|
|
253
|
-
assert!(!source.contains("toolPrefix"));
|
|
254
|
-
assert!(!source.contains("\"lifecycle\""));
|
|
255
|
-
assert!(!source.contains("command: \"team-agent\""));
|
|
256
|
-
assert!(!source.contains("--mcp-config"));
|
|
257
|
-
|
|
258
|
-
let other_destination = workspace.join(".team/runtime/pi/team-a/worker-b/team-mcp.ts");
|
|
259
|
-
write_pi_wrapper(PiWrapperRequest {
|
|
260
|
-
destination: &other_destination,
|
|
261
|
-
candidate_executable: &candidate,
|
|
262
|
-
mcp_config: &mcp_config(&candidate, &workspace, "worker-b"),
|
|
263
|
-
team_id: "team-a",
|
|
264
|
-
agent_id: "worker-b",
|
|
265
|
-
workspace: &workspace,
|
|
266
|
-
include_tools: &["send_message", "report_result"],
|
|
267
|
-
})
|
|
268
|
-
.expect("write second seat wrapper");
|
|
269
|
-
let other_source = std::fs::read_to_string(&other_destination).expect("read second wrapper");
|
|
270
|
-
assert!(source.contains("worker-a") && !source.contains("worker-b"));
|
|
271
|
-
assert!(other_source.contains("worker-b") && !other_source.contains("worker-a"));
|
|
272
|
-
assert_ne!(written, other_destination);
|
|
273
|
-
|
|
274
|
-
let entries = std::fs::read_dir(destination.parent().expect("wrapper parent"))
|
|
275
|
-
.expect("list wrapper parent")
|
|
276
|
-
.map(|entry| entry.expect("entry").file_name())
|
|
277
|
-
.collect::<Vec<_>>();
|
|
278
|
-
assert_eq!(
|
|
279
|
-
entries,
|
|
280
|
-
[std::ffi::OsString::from("team-mcp.ts")],
|
|
281
|
-
"atomic write must not leave a temporary or backup sibling"
|
|
282
|
-
);
|
|
283
|
-
std::fs::remove_dir_all(root).expect("remove wrapper fixture");
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
#[test]
|
|
287
|
-
fn pi_leader_wrapper_materializes_from_empty_unicode_wsl_workspace() {
|
|
288
|
-
let root = temp_root("empty-unicode-leader");
|
|
289
|
-
let workspace = root.join("mnt/f/测试基础设施");
|
|
290
|
-
let candidate = root.join("candidate/team-agent");
|
|
291
|
-
std::fs::create_dir_all(&workspace).expect("create empty Unicode workspace");
|
|
292
|
-
std::fs::create_dir_all(candidate.parent().expect("candidate parent"))
|
|
293
|
-
.expect("create candidate parent");
|
|
294
|
-
std::fs::write(&candidate, b"candidate").expect("write candidate fixture");
|
|
295
|
-
assert!(
|
|
296
|
-
!workspace.join(".team").exists(),
|
|
297
|
-
"fixture must begin without a .team directory"
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
let paths = pi_seat_paths(&workspace, "current", "leader");
|
|
301
|
-
let written = write_pi_wrapper(PiWrapperRequest {
|
|
302
|
-
destination: &paths.wrapper,
|
|
303
|
-
candidate_executable: &candidate,
|
|
304
|
-
mcp_config: &mcp_config(&candidate, &workspace, "leader"),
|
|
305
|
-
team_id: "current",
|
|
306
|
-
agent_id: "leader",
|
|
307
|
-
workspace: &workspace,
|
|
308
|
-
include_tools: &["send_message", "report_result", "get_team_status"],
|
|
309
|
-
})
|
|
310
|
-
.expect("materialize Pi leader wrapper from an empty Unicode workspace");
|
|
311
|
-
|
|
312
|
-
assert_eq!(written, paths.wrapper);
|
|
313
|
-
assert!(written.is_file(), "published leader wrapper must exist");
|
|
314
|
-
assert!(
|
|
315
|
-
paths.runtime_root.is_dir(),
|
|
316
|
-
"leader runtime root must be created recursively"
|
|
317
|
-
);
|
|
318
|
-
let source = std::fs::read_to_string(&written).expect("read complete leader wrapper");
|
|
319
|
-
validate_pi_wrapper_source(&source, &candidate)
|
|
320
|
-
.expect("published leader wrapper must be complete and valid");
|
|
321
|
-
assert!(source.contains("TEAM_AGENT_ID") && source.contains("leader"));
|
|
322
|
-
assert!(source.contains("TEAM_AGENT_OWNER_TEAM_ID") && source.contains("current"));
|
|
323
|
-
std::fs::remove_dir_all(root).expect("remove Unicode leader fixture");
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
#[test]
|
|
327
|
-
fn pi_wrapper_permissions_are_finalized_before_atomic_publish() {
|
|
328
|
-
let source = include_str!("../launch/pi_mcp.rs");
|
|
329
|
-
let write_start = source
|
|
330
|
-
.find("pub(crate) fn write_pi_wrapper")
|
|
331
|
-
.expect("write_pi_wrapper source");
|
|
332
|
-
let write_source = &source[write_start..];
|
|
333
|
-
let permissions = write_source
|
|
334
|
-
.find("file.set_permissions")
|
|
335
|
-
.expect("wrapper permissions must use the open temp-file handle");
|
|
336
|
-
let publish = write_source
|
|
337
|
-
.find("publish(&temp, request.destination)")
|
|
338
|
-
.expect("atomic wrapper publish");
|
|
339
|
-
|
|
340
|
-
assert!(
|
|
341
|
-
permissions < publish,
|
|
342
|
-
"DrvFS may not resolve the destination immediately after rename; finalize mode through the open temp-file handle before publishing"
|
|
343
|
-
);
|
|
344
|
-
assert!(
|
|
345
|
-
!write_source.contains("std::fs::set_permissions(request.destination"),
|
|
346
|
-
"atomic publish must not require a second destination-path lookup"
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
#[test]
|
|
351
|
-
fn pi_wrapper_publish_needs_no_final_path_metadata_lookup() {
|
|
352
|
-
let root = temp_root("publish-path-enoent");
|
|
353
|
-
let workspace = root.join("mnt/f/测试基础设施");
|
|
354
|
-
let candidate = root.join("candidate/team-agent");
|
|
355
|
-
std::fs::create_dir_all(&workspace).expect("create Unicode workspace");
|
|
356
|
-
std::fs::create_dir_all(candidate.parent().expect("candidate parent"))
|
|
357
|
-
.expect("create candidate parent");
|
|
358
|
-
std::fs::write(&candidate, b"candidate").expect("write candidate fixture");
|
|
359
|
-
|
|
360
|
-
let paths = pi_seat_paths(&workspace, "current", "leader");
|
|
361
|
-
let published_parent = paths.runtime_root.clone();
|
|
362
|
-
let hidden_parent = published_parent.with_file_name("leader-after-rename");
|
|
363
|
-
write_pi_wrapper_with_publish(
|
|
364
|
-
PiWrapperRequest {
|
|
365
|
-
destination: &paths.wrapper,
|
|
366
|
-
candidate_executable: &candidate,
|
|
367
|
-
mcp_config: &mcp_config(&candidate, &workspace, "leader"),
|
|
368
|
-
team_id: "current",
|
|
369
|
-
agent_id: "leader",
|
|
370
|
-
workspace: &workspace,
|
|
371
|
-
include_tools: &["send_message", "report_result", "get_team_status"],
|
|
372
|
-
},
|
|
373
|
-
|temp, destination| {
|
|
374
|
-
std::fs::rename(temp, destination)?;
|
|
375
|
-
std::fs::rename(&published_parent, &hidden_parent)?;
|
|
376
|
-
assert_eq!(
|
|
377
|
-
std::fs::metadata(destination)
|
|
378
|
-
.expect_err("simulate DrvFS final-path metadata ENOENT after rename")
|
|
379
|
-
.kind(),
|
|
380
|
-
std::io::ErrorKind::NotFound
|
|
381
|
-
);
|
|
382
|
-
Ok(())
|
|
383
|
-
},
|
|
384
|
-
)
|
|
385
|
-
.expect("successful publish must not perform final-path metadata operations");
|
|
386
|
-
|
|
387
|
-
let published = hidden_parent.join("team-mcp.ts");
|
|
388
|
-
assert!(published.is_file(), "rename published a complete wrapper");
|
|
389
|
-
assert_eq!(
|
|
390
|
-
std::fs::metadata(&published)
|
|
391
|
-
.expect("published wrapper metadata through converged path")
|
|
392
|
-
.permissions()
|
|
393
|
-
.mode()
|
|
394
|
-
& 0o777,
|
|
395
|
-
0o600
|
|
396
|
-
);
|
|
397
|
-
std::fs::remove_dir_all(root).expect("remove publish-path fixture");
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
#[test]
|
|
401
|
-
fn pi_wrapper_runtime_registration_does_not_copy_ambient_config() {
|
|
402
|
-
run_process_isolated(PI_WRAPPER_AMBIENT_CHILD, PI_WRAPPER_AMBIENT_TEST, || {
|
|
403
|
-
let hermetic = HermeticTestEnv::enter("pi-wrapper-negative-send");
|
|
404
|
-
assert_isolated_child();
|
|
405
|
-
pi_wrapper_import_failure_body(&hermetic);
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
fn pi_wrapper_import_failure_body(hermetic: &HermeticTestEnv) {
|
|
410
|
-
let root = hermetic.workspace("wrapper-negative");
|
|
411
|
-
let workspace = root.join("workspace");
|
|
412
|
-
let candidate = root.join("candidate/team-agent");
|
|
413
|
-
std::fs::create_dir_all(candidate.parent().expect("candidate parent"))
|
|
414
|
-
.expect("create candidate parent");
|
|
415
|
-
std::fs::write(&candidate, b"candidate").expect("write candidate fixture");
|
|
416
|
-
std::fs::create_dir_all(&workspace).expect("create workspace");
|
|
417
|
-
std::fs::write(
|
|
418
|
-
workspace.join(".mcp.json"),
|
|
419
|
-
r#"{"mcpServers":{"team_orchestrator":{"command":"/tmp/ambient-evil"}}}"#,
|
|
420
|
-
)
|
|
421
|
-
.expect("write malicious ambient config");
|
|
422
|
-
|
|
423
|
-
let destination = workspace.join(".team/runtime/pi/team-a/worker-a/team-mcp.ts");
|
|
424
|
-
write_pi_wrapper(PiWrapperRequest {
|
|
425
|
-
destination: &destination,
|
|
426
|
-
candidate_executable: &candidate,
|
|
427
|
-
mcp_config: &mcp_config(&candidate, &workspace, "worker-a"),
|
|
428
|
-
team_id: "team-a",
|
|
429
|
-
agent_id: "worker-a",
|
|
430
|
-
workspace: &workspace,
|
|
431
|
-
include_tools: &["send_message", "report_result"],
|
|
432
|
-
})
|
|
433
|
-
.expect("runtime wrapper leaves ambient config to direct Pi");
|
|
434
|
-
let source = std::fs::read_to_string(&destination).expect("wrapper source");
|
|
435
|
-
assert!(!source.contains("ambient-evil"));
|
|
436
|
-
validate_pi_wrapper_source(&source, &candidate)
|
|
437
|
-
.expect("runtime registration and exact candidate");
|
|
438
|
-
assert!(source.contains("pi.registerMcpServer(alias"));
|
|
439
|
-
assert!(!source.contains("createMcpAdapter"));
|
|
440
|
-
assert!(!source.contains("pi-mcp-adapter"));
|
|
441
|
-
assert!(!source.contains("--mcp-config"));
|
|
442
|
-
|
|
443
|
-
let other_candidate = root.join("candidate/other-team-agent");
|
|
444
|
-
validate_pi_wrapper_source(&source, &other_candidate)
|
|
445
|
-
.expect_err("wrapper bound to a different candidate must refuse");
|
|
446
|
-
|
|
447
|
-
std::fs::remove_dir_all(root).expect("remove wrapper fixture");
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
#[test]
|
|
451
|
-
fn pi_leader_materializer_uses_the_recorded_scope() {
|
|
452
|
-
run_process_isolated(PI_MATERIALIZER_CHILD, PI_MATERIALIZER_TEST, || {
|
|
453
|
-
let hermetic = HermeticTestEnv::enter("pi-materializer-scope");
|
|
454
|
-
assert_isolated_child();
|
|
455
|
-
pi_leader_materializer_body(&hermetic);
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
fn pi_leader_materializer_body(hermetic: &HermeticTestEnv) {
|
|
460
|
-
let fixture_root = hermetic.root().join("materializer-fixture");
|
|
461
|
-
let bin = fixture_root.join("bin");
|
|
462
|
-
let candidate = fixture_root.join("candidate/team-agent");
|
|
463
|
-
let real = fixture_root.join("pi-real");
|
|
464
|
-
std::fs::create_dir_all(&bin).expect("create Pi fixture bin");
|
|
465
|
-
std::fs::create_dir_all(candidate.parent().expect("candidate parent"))
|
|
466
|
-
.expect("create candidate parent");
|
|
467
|
-
std::fs::write(&candidate, b"candidate").expect("write candidate fixture");
|
|
468
|
-
let pi_script = "#!/bin/sh\ncase \"${1-}\" in\n --version) printf '0.84.4\\n' ;;\n --list-models) printf 'provider model\\nteam-agent qwen3.8-27b\\n' ;;\n list) exit 64 ;;\n *) exit 0 ;;\nesac\n";
|
|
469
|
-
std::fs::write(&real, pi_script).expect("write Pi real fixture");
|
|
470
|
-
std::fs::set_permissions(&real, std::fs::Permissions::from_mode(0o755))
|
|
471
|
-
.expect("make Pi real fixture executable");
|
|
472
|
-
std::os::unix::fs::symlink(&real, bin.join("pi")).expect("create Pi PATH symlink");
|
|
473
|
-
let _path = hermetic.with_env(
|
|
474
|
-
"PATH",
|
|
475
|
-
std::env::join_paths([&bin])
|
|
476
|
-
.expect("join Pi fixture PATH")
|
|
477
|
-
.to_str()
|
|
478
|
-
.expect("Pi fixture PATH is UTF-8"),
|
|
479
|
-
);
|
|
480
|
-
|
|
481
|
-
let native_workspace = hermetic.workspace("native");
|
|
482
|
-
let native_paths = pi_seat_paths(&native_workspace, "team-a", "leader");
|
|
483
|
-
let native_config = mcp_config(&candidate, &native_workspace, "leader");
|
|
484
|
-
let native = materialize_pi_plan(PiMaterializeRequest {
|
|
485
|
-
workspace: &native_workspace,
|
|
486
|
-
team_id: "team-a",
|
|
487
|
-
agent_id: "leader",
|
|
488
|
-
model: None,
|
|
489
|
-
effort: None,
|
|
490
|
-
system_prompt: "native leader fixture",
|
|
491
|
-
team_mcp_tools: &["send_message"],
|
|
492
|
-
mcp_config: &native_config,
|
|
493
|
-
session_scope: PiSessionScope::NativeDefault,
|
|
494
|
-
})
|
|
495
|
-
.expect("NativeDefault materializer");
|
|
496
|
-
assert!(
|
|
497
|
-
native.provider_projects_root.is_none(),
|
|
498
|
-
"NativeDefault must not expose a provider capture root: {native:?}"
|
|
499
|
-
);
|
|
500
|
-
assert!(
|
|
501
|
-
!native_paths.sessions.exists(),
|
|
502
|
-
"NativeDefault must not create the Team Agent seat session root"
|
|
503
|
-
);
|
|
504
|
-
assert_eq!(native.argv.first().map(String::as_str), Some("pi"));
|
|
505
|
-
for forbidden in ["--session-dir", "--cwd", "--workspace", "--session"] {
|
|
506
|
-
assert!(
|
|
507
|
-
!native.argv.iter().any(|arg| arg == forbidden),
|
|
508
|
-
"NativeDefault fresh argv must omit {forbidden}: {:?}",
|
|
509
|
-
native.argv
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
let isolated_workspace = hermetic.workspace("isolated");
|
|
514
|
-
let isolated_paths = pi_seat_paths(&isolated_workspace, "team-a", "leader");
|
|
515
|
-
let isolated_config = mcp_config(&candidate, &isolated_workspace, "leader");
|
|
516
|
-
let isolated = materialize_pi_plan(PiMaterializeRequest {
|
|
517
|
-
workspace: &isolated_workspace,
|
|
518
|
-
team_id: "team-a",
|
|
519
|
-
agent_id: "leader",
|
|
520
|
-
model: Some("team-agent/qwen3.8-27b"),
|
|
521
|
-
effort: Some(ProviderEffort::Medium),
|
|
522
|
-
system_prompt: "isolated leader fixture",
|
|
523
|
-
team_mcp_tools: &["send_message"],
|
|
524
|
-
mcp_config: &isolated_config,
|
|
525
|
-
session_scope: PiSessionScope::Isolated,
|
|
526
|
-
})
|
|
527
|
-
.expect("Isolated materializer");
|
|
528
|
-
assert_eq!(
|
|
529
|
-
isolated.provider_projects_root.as_deref(),
|
|
530
|
-
Some(isolated_paths.sessions.as_path())
|
|
531
|
-
);
|
|
532
|
-
assert_eq!(isolated.argv.first().map(String::as_str), Some("pi"));
|
|
533
|
-
assert_session_pair(&isolated.argv, &isolated_paths.sessions);
|
|
534
|
-
assert!(!isolated.argv.iter().any(|arg| arg == "--cwd"));
|
|
535
|
-
assert!(!isolated.argv.iter().any(|arg| arg == "--workspace"));
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
fn assert_session_pair(argv: &[String], session_root: &Path) {
|
|
539
|
-
let expected = session_root.to_string_lossy();
|
|
540
|
-
assert!(
|
|
541
|
-
argv.windows(2)
|
|
542
|
-
.any(|pair| pair[0] == "--session-dir" && pair[1].as_str() == expected.as_ref()),
|
|
543
|
-
"argv must contain exact --session-dir pair for {}: {argv:?}",
|
|
544
|
-
session_root.display()
|
|
545
|
-
);
|
|
546
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
use std::path::Path;
|
|
2
|
-
|
|
3
|
-
use crate::lifecycle::launch::pi_mcp::{pi_cleanup_plan, pi_seat_paths, PiCleanupAction};
|
|
4
|
-
|
|
5
|
-
#[test]
|
|
6
|
-
fn pi_stop_retains_backing_and_never_scans_by_process_name() {
|
|
7
|
-
let paths = pi_seat_paths(Path::new("/workspace"), "team-a", "worker-a");
|
|
8
|
-
let stop = pi_cleanup_plan(PiCleanupAction::Stop, &paths);
|
|
9
|
-
assert!(
|
|
10
|
-
stop.delete_paths.is_empty(),
|
|
11
|
-
"stop must retain both the Team-owned wrapper and session backing"
|
|
12
|
-
);
|
|
13
|
-
assert!(stop.retain_paths.contains(&paths.wrapper));
|
|
14
|
-
assert!(stop.retain_paths.contains(&paths.sessions));
|
|
15
|
-
assert_eq!(
|
|
16
|
-
stop.process_name_scan, None,
|
|
17
|
-
"Pi cleanup may use exact recorded pane/child receipts, never a process-name scan"
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
let remove = pi_cleanup_plan(PiCleanupAction::Remove, &paths);
|
|
21
|
-
assert_eq!(remove.delete_paths, [paths.wrapper.clone()]);
|
|
22
|
-
assert!(remove.retain_paths.contains(&paths.sessions));
|
|
23
|
-
assert_eq!(remove.process_name_scan, None);
|
|
24
|
-
assert!(
|
|
25
|
-
remove
|
|
26
|
-
.delete_paths
|
|
27
|
-
.iter()
|
|
28
|
-
.all(|path| path.starts_with(&paths.runtime_root)),
|
|
29
|
-
"remove may delete only exact Team-owned seat paths"
|
|
30
|
-
);
|
|
31
|
-
}
|