@team-agent/installer 0.5.128 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/schedule.rs +0 -175
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -156
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3024
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1527
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/direct_delivery.rs +0 -368
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/inbox_store.rs +0 -169
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -557
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -889
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3727
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -336
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -167
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/reminders.rs +0 -316
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -223
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -472
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -708
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -177
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -394
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,1021 +0,0 @@
|
|
|
1
|
-
//! 0.3.6-B: copilot acceptance bug batch (B-2 / B-4 / B-5 / B-7) contracts.
|
|
2
|
-
//!
|
|
3
|
-
//! Basis: `.team/artifacts/copilot-acceptance-locate.md` (architect; the report's
|
|
4
|
-
//! mechanism theory was DISPROVEN — contracts follow the located root cause, not the
|
|
5
|
-
//! report's suggested fix) + the B-4 cr verdict (6 reverse cases).
|
|
6
|
-
//!
|
|
7
|
-
//! B-2: quick-start attach_commands — socket probe silent-empty must emit an
|
|
8
|
-
//! event/hint; the Ready report must carry non-empty attach_commands.
|
|
9
|
-
//! B-4: tick monitor-step failure must NOT block the deliver_pending trunk (the trunk
|
|
10
|
-
//! does not depend on classify); classify.unsupported flood must dedup; --force-paste
|
|
11
|
-
//! must never enter argv (REJECT grep guard).
|
|
12
|
-
//! B-5: status must consume the existing coordinator_health + pending count and surface
|
|
13
|
-
//! a runtime block + hint when coordinator is down AND there is accepted backlog
|
|
14
|
-
//! (N38, no auto-recovery).
|
|
15
|
-
//! B-7: TEAM_AGENT_LEADER_PANE_ID pointing at a dead/absent pane must fail-fast on the
|
|
16
|
-
//! active (quick-start) path with a clear error; unset must pass through.
|
|
17
|
-
|
|
18
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
19
|
-
|
|
20
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
21
|
-
mod hermetic_guard;
|
|
22
|
-
#[allow(dead_code)]
|
|
23
|
-
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
24
|
-
|
|
25
|
-
use std::collections::BTreeMap;
|
|
26
|
-
use std::path::{Path, PathBuf};
|
|
27
|
-
use std::process::Command;
|
|
28
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
29
|
-
use std::sync::Mutex;
|
|
30
|
-
|
|
31
|
-
use serde_json::{json, Value};
|
|
32
|
-
use serial_test::serial;
|
|
33
|
-
use team_agent::coordinator::{Coordinator, ProviderRegistry, WorkspacePath};
|
|
34
|
-
use team_agent::lifecycle::QuickStartReport;
|
|
35
|
-
use team_agent::message_store::MessageStore;
|
|
36
|
-
use team_agent::model::enums::Provider;
|
|
37
|
-
use team_agent::provider::{get_adapter, ProviderAdapter};
|
|
38
|
-
use team_agent::state::persist::save_runtime_state;
|
|
39
|
-
use team_agent::transport::{
|
|
40
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
41
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, PaneLiveness, SessionName,
|
|
42
|
-
SetEnvOutcome, SpawnResult, SubmitVerification, Target, Transport, TransportError,
|
|
43
|
-
TurnVerification, WindowName,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const ANCESTRY_KEY: &str = "TEAM_AGENT_TEST_PROCESS_ANCESTRY_ARGV_JSON";
|
|
47
|
-
const NEUTRAL_ANCESTRY: &str = "[\"/bin/zsh\"]";
|
|
48
|
-
|
|
49
|
-
// ───────────────────────────── B-4 · monitor step isolation ─────────────────────────
|
|
50
|
-
|
|
51
|
-
/// B-4 main reverse (cr `monitor_step_failure_does_not_block_deliver_pending`): a
|
|
52
|
-
/// monitor step (here: the runtime-approval pane capture, made to hard-fail) must NOT
|
|
53
|
-
/// abort the tick before deliver_pending. The tick must (1) not enter backoff, (2) log
|
|
54
|
-
/// a step-failure event, (3) still run deliver_pending, (4) push the accepted message
|
|
55
|
-
/// to delivered. Today the `?` on the monitor step aborts before delivery → RED.
|
|
56
|
-
#[test]
|
|
57
|
-
#[serial(env)]
|
|
58
|
-
fn b4_monitor_step_failure_does_not_block_deliver_pending() {
|
|
59
|
-
let _g = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
|
|
60
|
-
let ws = tmp_ws("b4-monitor");
|
|
61
|
-
seed_copilot_team_state(&ws, "cp1", true);
|
|
62
|
-
let mut state = team_agent::state::persist::load_runtime_state(&ws).unwrap();
|
|
63
|
-
#[cfg(unix)]
|
|
64
|
-
let targets = vec![crate::mcp_server::readiness::test_ready_worker(
|
|
65
|
-
&ws, &mut state, "team-b4", "cp1", "%41",
|
|
66
|
-
)];
|
|
67
|
-
#[cfg(not(unix))]
|
|
68
|
-
let targets = Vec::new();
|
|
69
|
-
save_runtime_state(&ws, &state).unwrap();
|
|
70
|
-
let store = MessageStore::open(&ws).unwrap();
|
|
71
|
-
store
|
|
72
|
-
.create_message(
|
|
73
|
-
Some("task_mcp"),
|
|
74
|
-
"leader",
|
|
75
|
-
"cp1",
|
|
76
|
-
"do the thing",
|
|
77
|
-
None,
|
|
78
|
-
false,
|
|
79
|
-
Some("team-b4"),
|
|
80
|
-
)
|
|
81
|
-
.unwrap();
|
|
82
|
-
|
|
83
|
-
let coord = Coordinator::new(
|
|
84
|
-
WorkspacePath::new(ws.clone()),
|
|
85
|
-
Box::new(RealRegistry),
|
|
86
|
-
Box::new(MonitorFailTransport {
|
|
87
|
-
targets,
|
|
88
|
-
..MonitorFailTransport::new()
|
|
89
|
-
}),
|
|
90
|
-
);
|
|
91
|
-
let report = coord.tick();
|
|
92
|
-
|
|
93
|
-
let mut failures = Vec::new();
|
|
94
|
-
match &report {
|
|
95
|
-
Err(e) => failures.push(format!(
|
|
96
|
-
"B-4: a monitor-step failure must not propagate as a tick Err (it must degrade \
|
|
97
|
-
+ continue, bug-084 philosophy); got Err({e})"
|
|
98
|
-
)),
|
|
99
|
-
Ok(report) => {
|
|
100
|
-
if report.delivered.is_empty() {
|
|
101
|
-
failures.push(
|
|
102
|
-
"B-4: deliver_pending must still run after a monitor-step failure — the \
|
|
103
|
-
delivery trunk does not depend on the monitor face (N36 three-way availability); 0 delivered"
|
|
104
|
-
.to_string(),
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
let events = events_text(&ws);
|
|
110
|
-
if !(events.contains("_failed") && events.contains("tick")) {
|
|
111
|
-
failures.push(format!(
|
|
112
|
-
"B-4: the degraded monitor step must log a coordinator.tick.<step>_failed event \
|
|
113
|
-
(observable, not silent); events tail={}",
|
|
114
|
-
events.lines().rev().take(3).collect::<Vec<_>>().join(" | ")
|
|
115
|
-
));
|
|
116
|
-
}
|
|
117
|
-
let status: Option<String> = MessageStore::open(&ws)
|
|
118
|
-
.unwrap()
|
|
119
|
-
.inbox("cp1", 10, None)
|
|
120
|
-
.ok()
|
|
121
|
-
.and_then(|rows| {
|
|
122
|
-
rows.first()
|
|
123
|
-
.and_then(|r| r.get("status").and_then(Value::as_str).map(String::from))
|
|
124
|
-
});
|
|
125
|
-
if status.as_deref() == Some("accepted") {
|
|
126
|
-
failures.push(
|
|
127
|
-
"B-4: the accepted message must leave the 'accepted' state after the tick".to_string(),
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
assert!(
|
|
131
|
-
failures.is_empty(),
|
|
132
|
-
"B-4 monitor isolation contract failed:\n{}",
|
|
133
|
-
failures.join("\n")
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/// B-4 reverse (cr `force_paste_flag_not_in_argv`): the --force-paste flag (REJECTed —
|
|
138
|
-
/// a back-door on a gate that does not exist) must never be introduced into the
|
|
139
|
-
/// delivery / provider command code. Source grep guard across the crate.
|
|
140
|
-
#[test]
|
|
141
|
-
fn b4_force_paste_flag_rejected_not_in_source() {
|
|
142
|
-
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src");
|
|
143
|
-
let hits = grep_tree(&root, "force-paste") + grep_tree(&root, "force_paste");
|
|
144
|
-
assert_eq!(
|
|
145
|
-
hits, 0,
|
|
146
|
-
"B-4: --force-paste / force_paste must not appear in product code (cr REJECT: the \
|
|
147
|
-
delivery trunk does not consult classify, so this flag is a back-door on a non-existent \
|
|
148
|
-
gate — N35/MUST-17); found {hits} occurrence(s)"
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// ───────────────────────────── B-2 · attach_commands ─────────────────────────────
|
|
153
|
-
|
|
154
|
-
/// B-2 (locate root cause): a successful quick-start Ready report must carry non-empty
|
|
155
|
-
/// attach_commands, and a socket-probe that finds no socket on disk must surface an
|
|
156
|
-
/// event/hint (not a silent empty set). Driven through quick-start with a recording
|
|
157
|
-
/// transport that provides a window.
|
|
158
|
-
#[test]
|
|
159
|
-
#[serial(env)]
|
|
160
|
-
fn b2_quick_start_ready_has_attach_commands_and_socket_miss_is_observable() {
|
|
161
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("acceptance-b-b2-quick-start");
|
|
162
|
-
let _g = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
|
|
163
|
-
let ws = tmp_ws("b2-attach");
|
|
164
|
-
let team_dir = write_min_team(&ws, "b2team");
|
|
165
|
-
seed_healthy_coordinator(&ws);
|
|
166
|
-
let report = team_agent::lifecycle::quick_start_with_transport_in_workspace(
|
|
167
|
-
&ws,
|
|
168
|
-
&team_dir,
|
|
169
|
-
None,
|
|
170
|
-
true,
|
|
171
|
-
Some("b2team"),
|
|
172
|
-
&WindowedTransport::new("b2team", &["worker_a"]),
|
|
173
|
-
)
|
|
174
|
-
.expect("quick-start should run");
|
|
175
|
-
|
|
176
|
-
let mut failures = Vec::new();
|
|
177
|
-
match &report {
|
|
178
|
-
QuickStartReport::Ready {
|
|
179
|
-
attach_commands,
|
|
180
|
-
next_actions,
|
|
181
|
-
..
|
|
182
|
-
} => assert_attach_commands_or_socket_hint(
|
|
183
|
-
"Ready",
|
|
184
|
-
attach_commands,
|
|
185
|
-
next_actions,
|
|
186
|
-
&mut failures,
|
|
187
|
-
),
|
|
188
|
-
other => failures.push(format!("B-2 fixture expected Ready report; got {other:?}")),
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
let existing = team_agent::lifecycle::quick_start_with_transport_in_workspace(
|
|
192
|
-
&ws,
|
|
193
|
-
&team_dir,
|
|
194
|
-
None,
|
|
195
|
-
true,
|
|
196
|
-
Some("b2team"),
|
|
197
|
-
&WindowedTransport::new("b2team", &["worker_a"]),
|
|
198
|
-
)
|
|
199
|
-
.expect("second quick-start should return ExistingRuntime");
|
|
200
|
-
match &existing {
|
|
201
|
-
QuickStartReport::ExistingRuntime {
|
|
202
|
-
attach_commands,
|
|
203
|
-
next_actions,
|
|
204
|
-
..
|
|
205
|
-
} => assert_attach_commands_or_socket_hint(
|
|
206
|
-
"ExistingRuntime",
|
|
207
|
-
attach_commands,
|
|
208
|
-
next_actions,
|
|
209
|
-
&mut failures,
|
|
210
|
-
),
|
|
211
|
-
other => failures.push(format!(
|
|
212
|
-
"B-2 duplicate quick-start expected ExistingRuntime report; got {other:?}"
|
|
213
|
-
)),
|
|
214
|
-
}
|
|
215
|
-
assert!(
|
|
216
|
-
failures.is_empty(),
|
|
217
|
-
"B-2 attach_commands contract failed:\n{}",
|
|
218
|
-
failures.join("\n")
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// ───────────────────────────── B-5 · status runtime block ─────────────────────────
|
|
223
|
-
|
|
224
|
-
/// B-5 (N38): when there is NO coordinator pid AND accepted backlog exists, status must
|
|
225
|
-
/// surface a runtime block (coordinator.ok==false) and a hint mentioning the coordinator
|
|
226
|
-
/// + restart. Driven through the public status entry.
|
|
227
|
-
#[test]
|
|
228
|
-
#[serial(env)]
|
|
229
|
-
fn b5_status_surfaces_runtime_hint_on_stale_coordinator_with_backlog() {
|
|
230
|
-
let _g = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
|
|
231
|
-
let ws = tmp_ws("b5-stale");
|
|
232
|
-
save_runtime_state(
|
|
233
|
-
&ws,
|
|
234
|
-
&json!({"session_name": "team-b5", "active_team_key": "team-b5", "agents": {
|
|
235
|
-
"w1": {"status": "running", "provider": "codex", "agent_id": "w1", "window": "w1"}
|
|
236
|
-
}}),
|
|
237
|
-
)
|
|
238
|
-
.unwrap();
|
|
239
|
-
// NO coordinator pid file written (stale/dead). Two accepted messages backlog.
|
|
240
|
-
let store = MessageStore::open(&ws).unwrap();
|
|
241
|
-
store
|
|
242
|
-
.create_message(Some("t1"), "leader", "w1", "m1", None, false, None)
|
|
243
|
-
.unwrap();
|
|
244
|
-
store
|
|
245
|
-
.create_message(Some("t1"), "leader", "w1", "m2", None, false, None)
|
|
246
|
-
.unwrap();
|
|
247
|
-
|
|
248
|
-
let status = team_agent::cli::status_port::status(&ws, false, false).expect("status");
|
|
249
|
-
let text = status.to_string();
|
|
250
|
-
let mut failures = Vec::new();
|
|
251
|
-
|
|
252
|
-
let runtime_ok = status
|
|
253
|
-
.pointer("/runtime/coordinator/ok")
|
|
254
|
-
.and_then(Value::as_bool);
|
|
255
|
-
if runtime_ok != Some(false) {
|
|
256
|
-
failures.push(format!(
|
|
257
|
-
"B-5: status must carry a runtime block with coordinator.ok==false when the \
|
|
258
|
-
coordinator is not running (consume coordinator_health); got runtime/coordinator/ok={runtime_ok:?}"
|
|
259
|
-
));
|
|
260
|
-
}
|
|
261
|
-
let has_hint = text.contains("undelivered")
|
|
262
|
-
|| (text.to_lowercase().contains("coordinator") && text.contains("restart"));
|
|
263
|
-
if !has_hint {
|
|
264
|
-
failures.push(format!(
|
|
265
|
-
"B-5: status must add a hint naming the coordinator + restart when it is down \
|
|
266
|
-
AND there is accepted backlog (N38 explicable, no auto-recovery); status={text}"
|
|
267
|
-
));
|
|
268
|
-
}
|
|
269
|
-
assert!(
|
|
270
|
-
failures.is_empty(),
|
|
271
|
-
"B-5 status runtime-hint contract failed:\n{}",
|
|
272
|
-
failures.join("\n")
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/// B-5 anti-nag: a HEALTHY coordinator with backlog must NOT show the down-hint.
|
|
277
|
-
#[test]
|
|
278
|
-
#[serial(env)]
|
|
279
|
-
fn b5_status_no_hint_when_coordinator_healthy() {
|
|
280
|
-
let _g = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
|
|
281
|
-
let ws = tmp_ws("b5-healthy");
|
|
282
|
-
let live_session = LiveTmuxSession::start(&ws, "team-b5h");
|
|
283
|
-
let socket = live_session.socket.display().to_string();
|
|
284
|
-
save_runtime_state(
|
|
285
|
-
&ws,
|
|
286
|
-
&json!({"session_name": "team-b5h", "active_team_key": "team-b5h", "agents": {
|
|
287
|
-
"w1": {"status": "running", "provider": "codex", "agent_id": "w1", "window": "w1"}
|
|
288
|
-
}, "tmux_endpoint": socket, "tmux_socket": socket}),
|
|
289
|
-
)
|
|
290
|
-
.unwrap();
|
|
291
|
-
seed_healthy_coordinator(&ws);
|
|
292
|
-
let store = MessageStore::open(&ws).unwrap();
|
|
293
|
-
store
|
|
294
|
-
.create_message(Some("t1"), "leader", "w1", "m1", None, false, None)
|
|
295
|
-
.unwrap();
|
|
296
|
-
|
|
297
|
-
let status = team_agent::cli::status_port::status(&ws, false, false).expect("status");
|
|
298
|
-
let text = status.to_string().to_lowercase();
|
|
299
|
-
assert!(
|
|
300
|
-
!(text.contains("coordinator not running") || text.contains("run team-agent restart")),
|
|
301
|
-
"B-5 anti-nag: a healthy coordinator must not show the down-hint (no nag); status={text}"
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// ───────────────────────────── B-7 · leader pane env fail-fast ─────────────────────
|
|
306
|
-
|
|
307
|
-
/// B-7 (N38 fail-fast): a TEAM_AGENT_LEADER_PANE_ID pointing at a dead/absent pane must
|
|
308
|
-
/// make the active quick-start path fail with a clear error (naming the pane + an
|
|
309
|
-
/// action), not bind silently. Unset must pass through.
|
|
310
|
-
#[test]
|
|
311
|
-
#[serial(env)]
|
|
312
|
-
fn b7_dead_leader_pane_env_fails_fast_on_quick_start() {
|
|
313
|
-
let ws = tmp_ws("b7-deadpane");
|
|
314
|
-
let team_dir = write_min_team(&ws, "b7team");
|
|
315
|
-
seed_healthy_coordinator(&ws);
|
|
316
|
-
let _g = EnvGuard::set(&[
|
|
317
|
-
(ANCESTRY_KEY, NEUTRAL_ANCESTRY),
|
|
318
|
-
("TEAM_AGENT_LEADER_PANE_ID", "%9999"),
|
|
319
|
-
]);
|
|
320
|
-
|
|
321
|
-
let result = team_agent::lifecycle::quick_start_with_transport_in_workspace(
|
|
322
|
-
&ws,
|
|
323
|
-
&team_dir,
|
|
324
|
-
None,
|
|
325
|
-
true,
|
|
326
|
-
Some("b7team"),
|
|
327
|
-
&DeadPaneTransport,
|
|
328
|
-
);
|
|
329
|
-
|
|
330
|
-
let text = format!("{result:?}");
|
|
331
|
-
let mut failures = Vec::new();
|
|
332
|
-
if result.is_ok() {
|
|
333
|
-
failures.push(format!(
|
|
334
|
-
"B-7: a TEAM_AGENT_LEADER_PANE_ID pointing at a dead/absent pane (%9999) must \
|
|
335
|
-
make quick-start fail-fast, not bind silently; got Ok: {text}"
|
|
336
|
-
));
|
|
337
|
-
} else if !(text.contains("%9999") && (text.to_lowercase().contains("pane"))) {
|
|
338
|
-
failures.push(format!(
|
|
339
|
-
"B-7: the fail-fast error must name the offending pane id and be about the \
|
|
340
|
-
leader pane (N38 three-line: error/action/log); got {text}"
|
|
341
|
-
));
|
|
342
|
-
}
|
|
343
|
-
assert!(
|
|
344
|
-
failures.is_empty(),
|
|
345
|
-
"B-7 dead-pane fail-fast contract failed:\n{}",
|
|
346
|
-
failures.join("\n")
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/// B-7 (no false-positive): with the env UNSET, quick-start must proceed normally.
|
|
351
|
-
#[test]
|
|
352
|
-
#[serial(env)]
|
|
353
|
-
fn b7_unset_leader_pane_env_passes_through() {
|
|
354
|
-
let ws = tmp_ws("b7-unset");
|
|
355
|
-
let team_dir = write_min_team(&ws, "b7uteam");
|
|
356
|
-
seed_healthy_coordinator(&ws);
|
|
357
|
-
let _g = EnvGuard::set(&[(ANCESTRY_KEY, NEUTRAL_ANCESTRY)]);
|
|
358
|
-
std::env::remove_var("TEAM_AGENT_LEADER_PANE_ID");
|
|
359
|
-
|
|
360
|
-
let result = team_agent::lifecycle::quick_start_with_transport_in_workspace(
|
|
361
|
-
&ws,
|
|
362
|
-
&team_dir,
|
|
363
|
-
None,
|
|
364
|
-
true,
|
|
365
|
-
Some("b7uteam"),
|
|
366
|
-
&WindowedTransport::new("b7uteam", &["worker_a"]),
|
|
367
|
-
);
|
|
368
|
-
assert!(
|
|
369
|
-
result.is_ok(),
|
|
370
|
-
"B-7: an unset TEAM_AGENT_LEADER_PANE_ID must not trip the fail-fast (no false \
|
|
371
|
-
positive); got {result:?}"
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// ───────────────────────────────────── fixtures ─────────────────────────────────────
|
|
376
|
-
|
|
377
|
-
fn seed_copilot_team_state(ws: &Path, agent: &str, accepted_msg: bool) {
|
|
378
|
-
let _ = accepted_msg;
|
|
379
|
-
save_runtime_state(
|
|
380
|
-
ws,
|
|
381
|
-
&json!({
|
|
382
|
-
"session_name": "team-b4",
|
|
383
|
-
"active_team_key": "team-b4",
|
|
384
|
-
"agents": {
|
|
385
|
-
agent: {
|
|
386
|
-
"status": "running", "provider": "copilot", "agent_id": agent,
|
|
387
|
-
"window": agent, "pane_id": "%41",
|
|
388
|
-
"session_id": "11111111-2222-4333-8444-555555555555",
|
|
389
|
-
"spawn_cwd": ws.to_string_lossy(),
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
}),
|
|
393
|
-
)
|
|
394
|
-
.unwrap();
|
|
395
|
-
let _ = MessageStore::open(ws).unwrap();
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
fn write_min_team(ws: &Path, name: &str) -> PathBuf {
|
|
399
|
-
let team = ws.join(name);
|
|
400
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
401
|
-
std::fs::write(
|
|
402
|
-
team.join("TEAM.md"),
|
|
403
|
-
format!("---\nname: {name}\nobjective: B-batch fixture.\nprovider: codex\n---\n\nTeam.\n"),
|
|
404
|
-
)
|
|
405
|
-
.unwrap();
|
|
406
|
-
std::fs::write(
|
|
407
|
-
team.join("agents/worker_a.md"),
|
|
408
|
-
"---\nname: worker_a\nrole: Worker\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n",
|
|
409
|
-
)
|
|
410
|
-
.unwrap();
|
|
411
|
-
team
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
fn seed_healthy_coordinator(workspace: &Path) {
|
|
415
|
-
let workspace = team_agent::coordinator::WorkspacePath::new(workspace.to_path_buf());
|
|
416
|
-
let pid = team_agent::coordinator::Pid::new(std::process::id());
|
|
417
|
-
std::fs::create_dir_all(
|
|
418
|
-
team_agent::coordinator::coordinator_pid_path(&workspace)
|
|
419
|
-
.parent()
|
|
420
|
-
.unwrap(),
|
|
421
|
-
)
|
|
422
|
-
.unwrap();
|
|
423
|
-
team_agent::coordinator::write_coordinator_metadata(
|
|
424
|
-
&workspace,
|
|
425
|
-
pid,
|
|
426
|
-
team_agent::coordinator::MetadataSource::Boot,
|
|
427
|
-
)
|
|
428
|
-
.expect("write coordinator metadata");
|
|
429
|
-
std::fs::write(
|
|
430
|
-
team_agent::coordinator::coordinator_pid_path(&workspace),
|
|
431
|
-
pid.to_string(),
|
|
432
|
-
)
|
|
433
|
-
.unwrap();
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
fn events_text(ws: &Path) -> String {
|
|
437
|
-
std::fs::read_to_string(ws.join(".team/logs/events.jsonl")).unwrap_or_default()
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
fn grep_tree(root: &Path, needle: &str) -> usize {
|
|
441
|
-
let mut count = 0;
|
|
442
|
-
let entries = std::fs::read_dir(root).into_iter().flatten().flatten();
|
|
443
|
-
for entry in entries {
|
|
444
|
-
let path = entry.path();
|
|
445
|
-
if path.is_dir() {
|
|
446
|
-
if path.file_name().and_then(|name| name.to_str()) == Some("tests") {
|
|
447
|
-
continue;
|
|
448
|
-
}
|
|
449
|
-
count += grep_tree(&path, needle);
|
|
450
|
-
} else if path.extension().and_then(|s| s.to_str()) == Some("rs") {
|
|
451
|
-
if path.file_name().and_then(|name| name.to_str()) == Some("tests.rs") {
|
|
452
|
-
continue;
|
|
453
|
-
}
|
|
454
|
-
count += std::fs::read_to_string(&path)
|
|
455
|
-
.unwrap_or_default()
|
|
456
|
-
.matches(needle)
|
|
457
|
-
.count();
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
count
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
struct RealRegistry;
|
|
464
|
-
impl ProviderRegistry for RealRegistry {
|
|
465
|
-
fn adapter_for(&self, provider: Provider) -> Box<dyn ProviderAdapter> {
|
|
466
|
-
get_adapter(provider)
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
struct EnvGuard {
|
|
471
|
-
previous: Vec<(&'static str, Option<String>)>,
|
|
472
|
-
}
|
|
473
|
-
impl EnvGuard {
|
|
474
|
-
fn set(values: &[(&'static str, &'static str)]) -> Self {
|
|
475
|
-
let previous = values
|
|
476
|
-
.iter()
|
|
477
|
-
.map(|(k, _)| (*k, std::env::var(k).ok()))
|
|
478
|
-
.collect();
|
|
479
|
-
for (k, v) in values {
|
|
480
|
-
std::env::set_var(k, v);
|
|
481
|
-
}
|
|
482
|
-
Self { previous }
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
impl Drop for EnvGuard {
|
|
486
|
-
fn drop(&mut self) {
|
|
487
|
-
for (k, v) in self.previous.drain(..).rev() {
|
|
488
|
-
match v {
|
|
489
|
-
Some(v) => std::env::set_var(k, v),
|
|
490
|
-
None => std::env::remove_var(k),
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
fn tmp_ws(tag: &str) -> PathBuf {
|
|
497
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
498
|
-
let dir = std::env::temp_dir().join(format!(
|
|
499
|
-
"ta-rs-036b-{tag}-{}-{}",
|
|
500
|
-
std::process::id(),
|
|
501
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
502
|
-
));
|
|
503
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
504
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
505
|
-
std::fs::canonicalize(dir).unwrap()
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
struct LiveTmuxSession {
|
|
509
|
-
socket: PathBuf,
|
|
510
|
-
session: String,
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
impl LiveTmuxSession {
|
|
514
|
-
fn start(_workspace: &Path, session: &str) -> Self {
|
|
515
|
-
// 0.5.43 debt-sweep (§4.2): use the short_tmux_socket helper.
|
|
516
|
-
// The pre-0.5.43 code inherited $TMPDIR which on macOS is
|
|
517
|
-
// /var/folders/... > 104 bytes, tripping AF_UNIX sun_path
|
|
518
|
-
// and causing the Gate2 flake family.
|
|
519
|
-
let socket = hermetic_guard::short_tmux_socket("b5-live-session");
|
|
520
|
-
let socket_str = socket.to_str().expect("socket path utf8");
|
|
521
|
-
let out = Command::new("tmux")
|
|
522
|
-
.args([
|
|
523
|
-
"-S",
|
|
524
|
-
socket_str,
|
|
525
|
-
"new-session",
|
|
526
|
-
"-d",
|
|
527
|
-
"-s",
|
|
528
|
-
session,
|
|
529
|
-
"-n",
|
|
530
|
-
"leader",
|
|
531
|
-
"sleep 60",
|
|
532
|
-
])
|
|
533
|
-
.output()
|
|
534
|
-
.unwrap_or_else(|e| panic!("tmux new-session {session}: {e}"));
|
|
535
|
-
assert!(
|
|
536
|
-
out.status.success(),
|
|
537
|
-
"tmux new-session failed; stdout={} stderr={}",
|
|
538
|
-
String::from_utf8_lossy(&out.stdout),
|
|
539
|
-
String::from_utf8_lossy(&out.stderr)
|
|
540
|
-
);
|
|
541
|
-
Self {
|
|
542
|
-
socket,
|
|
543
|
-
session: session.to_string(),
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
impl Drop for LiveTmuxSession {
|
|
549
|
-
fn drop(&mut self) {
|
|
550
|
-
if let Some(socket) = self.socket.to_str() {
|
|
551
|
-
let _ = Command::new("tmux")
|
|
552
|
-
.args(["-S", socket, "kill-session", "-t", &self.session])
|
|
553
|
-
.status();
|
|
554
|
-
let _ = std::fs::remove_file(socket);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
fn assert_attach_commands_or_socket_hint(
|
|
560
|
-
branch: &str,
|
|
561
|
-
attach_commands: &[String],
|
|
562
|
-
next_actions: &[String],
|
|
563
|
-
failures: &mut Vec<String>,
|
|
564
|
-
) {
|
|
565
|
-
if attach_commands.is_empty() {
|
|
566
|
-
if !has_socket_missing_hint(next_actions) {
|
|
567
|
-
failures.push(format!(
|
|
568
|
-
"B-2: {branch} with no attach_commands must explain the missing tmux socket \
|
|
569
|
-
and give an attach/restart action; next_actions={next_actions:?}"
|
|
570
|
-
));
|
|
571
|
-
}
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
for command in attach_commands {
|
|
576
|
-
let Some(socket_path) = attach_socket_path(command) else {
|
|
577
|
-
failures.push(format!(
|
|
578
|
-
"B-2: {branch} attach command must include `tmux -S <socket>`; command={command:?}"
|
|
579
|
-
));
|
|
580
|
-
continue;
|
|
581
|
-
};
|
|
582
|
-
if !socket_path.exists() {
|
|
583
|
-
if !has_socket_missing_hint(next_actions) {
|
|
584
|
-
failures.push(format!(
|
|
585
|
-
"B-2: {branch} attach command points at a socket missing on disk, so the report \
|
|
586
|
-
must also explain the socket miss; command={command:?} socket_path={} next_actions={next_actions:?}",
|
|
587
|
-
socket_path.display()
|
|
588
|
-
));
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
fn has_socket_missing_hint(next_actions: &[String]) -> bool {
|
|
595
|
-
let hints = next_actions.join("\n").to_lowercase();
|
|
596
|
-
hints.contains("socket")
|
|
597
|
-
&& (hints.contains("not found") || hints.contains("missing"))
|
|
598
|
-
&& (hints.contains("attach") || hints.contains("restart"))
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
fn attach_socket_path(command: &str) -> Option<PathBuf> {
|
|
602
|
-
let mut parts = command.split_whitespace();
|
|
603
|
-
while let Some(part) = parts.next() {
|
|
604
|
-
if part == "-S" {
|
|
605
|
-
return parts.next().map(PathBuf::from);
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
None
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// ─────────────────────────────── transports ───────────────────────────────
|
|
612
|
-
|
|
613
|
-
/// A transport whose pane capture HARD-FAILS — used to drive a monitor-step failure
|
|
614
|
-
/// (B-4). Sessions/windows present so the tick proceeds to the monitor steps.
|
|
615
|
-
struct MonitorFailTransport {
|
|
616
|
-
session: Mutex<bool>,
|
|
617
|
-
targets: Vec<PaneInfo>,
|
|
618
|
-
}
|
|
619
|
-
impl MonitorFailTransport {
|
|
620
|
-
fn new() -> Self {
|
|
621
|
-
Self {
|
|
622
|
-
session: Mutex::new(true),
|
|
623
|
-
targets: Vec::new(),
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
/// A quiet transport (sessions present, capture returns an idle screen) for the dedup
|
|
629
|
-
/// tests where we only care about the classify event count.
|
|
630
|
-
struct QuietTransport;
|
|
631
|
-
|
|
632
|
-
/// Provides named windows + sessions so attach_commands can be built (B-2).
|
|
633
|
-
struct WindowedTransport {
|
|
634
|
-
session: SessionName,
|
|
635
|
-
windows: Vec<WindowName>,
|
|
636
|
-
present: Mutex<bool>,
|
|
637
|
-
}
|
|
638
|
-
impl WindowedTransport {
|
|
639
|
-
fn new(team: &str, windows: &[&str]) -> Self {
|
|
640
|
-
Self {
|
|
641
|
-
session: SessionName::new(format!("team-{team}")),
|
|
642
|
-
windows: windows.iter().map(|w| WindowName::new(*w)).collect(),
|
|
643
|
-
present: Mutex::new(false),
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
/// Reports the leader pane (%9999) as DEAD (B-7).
|
|
649
|
-
struct DeadPaneTransport;
|
|
650
|
-
|
|
651
|
-
impl Transport for MonitorFailTransport {
|
|
652
|
-
fn kind(&self) -> BackendKind {
|
|
653
|
-
BackendKind::Tmux
|
|
654
|
-
}
|
|
655
|
-
fn spawn_first(
|
|
656
|
-
&self,
|
|
657
|
-
s: &SessionName,
|
|
658
|
-
w: &WindowName,
|
|
659
|
-
_a: &[String],
|
|
660
|
-
_c: &Path,
|
|
661
|
-
_e: &BTreeMap<String, String>,
|
|
662
|
-
) -> Result<SpawnResult, TransportError> {
|
|
663
|
-
*self.session.lock().unwrap() = true;
|
|
664
|
-
Ok(SpawnResult {
|
|
665
|
-
pane_id: PaneId::new("%1"),
|
|
666
|
-
session: s.clone(),
|
|
667
|
-
window: w.clone(),
|
|
668
|
-
child_pid: None,
|
|
669
|
-
})
|
|
670
|
-
}
|
|
671
|
-
fn spawn_into(
|
|
672
|
-
&self,
|
|
673
|
-
s: &SessionName,
|
|
674
|
-
w: &WindowName,
|
|
675
|
-
a: &[String],
|
|
676
|
-
c: &Path,
|
|
677
|
-
e: &BTreeMap<String, String>,
|
|
678
|
-
) -> Result<SpawnResult, TransportError> {
|
|
679
|
-
self.spawn_first(s, w, a, c, e)
|
|
680
|
-
}
|
|
681
|
-
fn capture(&self, _t: &Target, _r: CaptureRange) -> Result<CapturedText, TransportError> {
|
|
682
|
-
Err(TransportError::Subprocess {
|
|
683
|
-
argv: vec!["tmux".to_string(), "capture-pane".to_string()],
|
|
684
|
-
code: Some(1),
|
|
685
|
-
stderr: "injected monitor-step capture failure".to_string(),
|
|
686
|
-
})
|
|
687
|
-
}
|
|
688
|
-
fn liveness(&self, _p: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
689
|
-
Ok(PaneLiveness::Live)
|
|
690
|
-
}
|
|
691
|
-
fn has_session(&self, _s: &SessionName) -> Result<bool, TransportError> {
|
|
692
|
-
Ok(*self.session.lock().unwrap())
|
|
693
|
-
}
|
|
694
|
-
fn send_keys(&self, _t: &Target, _k: &[Key]) -> Result<(), TransportError> {
|
|
695
|
-
Ok(())
|
|
696
|
-
}
|
|
697
|
-
fn query(&self, _t: &Target, f: PaneField) -> Result<Option<String>, TransportError> {
|
|
698
|
-
match f {
|
|
699
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
700
|
-
_ => Ok(None),
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
704
|
-
Ok(self.targets.clone())
|
|
705
|
-
}
|
|
706
|
-
fn list_windows(&self, _s: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
707
|
-
Ok(vec![WindowName::new("cp1")])
|
|
708
|
-
}
|
|
709
|
-
fn set_session_env(
|
|
710
|
-
&self,
|
|
711
|
-
_s: &SessionName,
|
|
712
|
-
_k: &str,
|
|
713
|
-
_v: &str,
|
|
714
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
715
|
-
Ok(SetEnvOutcome::Applied)
|
|
716
|
-
}
|
|
717
|
-
fn kill_session(&self, _s: &SessionName) -> Result<(), TransportError> {
|
|
718
|
-
Ok(())
|
|
719
|
-
}
|
|
720
|
-
fn kill_window(&self, _t: &Target) -> Result<(), TransportError> {
|
|
721
|
-
Ok(())
|
|
722
|
-
}
|
|
723
|
-
fn attach_session(&self, _s: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
724
|
-
Ok(AttachOutcome::Attached)
|
|
725
|
-
}
|
|
726
|
-
fn inject(
|
|
727
|
-
&self,
|
|
728
|
-
_t: &Target,
|
|
729
|
-
_p: &InjectPayload,
|
|
730
|
-
_s: Key,
|
|
731
|
-
_b: bool,
|
|
732
|
-
) -> Result<InjectReport, TransportError> {
|
|
733
|
-
Ok(InjectReport {
|
|
734
|
-
stage_reached: InjectStage::Submit,
|
|
735
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
736
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
737
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
738
|
-
attempts: 1,
|
|
739
|
-
submit_diagnostics: None,
|
|
740
|
-
})
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
impl Transport for QuietTransport {
|
|
745
|
-
fn spawn_first(
|
|
746
|
-
&self,
|
|
747
|
-
s: &SessionName,
|
|
748
|
-
w: &WindowName,
|
|
749
|
-
_a: &[String],
|
|
750
|
-
_c: &Path,
|
|
751
|
-
_e: &BTreeMap<String, String>,
|
|
752
|
-
) -> Result<SpawnResult, TransportError> {
|
|
753
|
-
Ok(SpawnResult {
|
|
754
|
-
pane_id: PaneId::new("%1"),
|
|
755
|
-
session: s.clone(),
|
|
756
|
-
window: w.clone(),
|
|
757
|
-
child_pid: None,
|
|
758
|
-
})
|
|
759
|
-
}
|
|
760
|
-
fn spawn_into(
|
|
761
|
-
&self,
|
|
762
|
-
s: &SessionName,
|
|
763
|
-
w: &WindowName,
|
|
764
|
-
a: &[String],
|
|
765
|
-
c: &Path,
|
|
766
|
-
e: &BTreeMap<String, String>,
|
|
767
|
-
) -> Result<SpawnResult, TransportError> {
|
|
768
|
-
self.spawn_first(s, w, a, c, e)
|
|
769
|
-
}
|
|
770
|
-
fn capture(&self, _t: &Target, r: CaptureRange) -> Result<CapturedText, TransportError> {
|
|
771
|
-
Ok(CapturedText {
|
|
772
|
-
text: "Copilot\n> ".to_string(),
|
|
773
|
-
range: r,
|
|
774
|
-
})
|
|
775
|
-
}
|
|
776
|
-
fn liveness(&self, _p: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
777
|
-
Ok(PaneLiveness::Live)
|
|
778
|
-
}
|
|
779
|
-
fn has_session(&self, _s: &SessionName) -> Result<bool, TransportError> {
|
|
780
|
-
Ok(true)
|
|
781
|
-
}
|
|
782
|
-
fn list_windows(&self, _s: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
783
|
-
Ok(vec![WindowName::new("cp1")])
|
|
784
|
-
}
|
|
785
|
-
fn kind(&self) -> BackendKind {
|
|
786
|
-
BackendKind::Tmux
|
|
787
|
-
}
|
|
788
|
-
fn send_keys(&self, _t: &Target, _k: &[Key]) -> Result<(), TransportError> {
|
|
789
|
-
Ok(())
|
|
790
|
-
}
|
|
791
|
-
fn query(&self, _t: &Target, f: PaneField) -> Result<Option<String>, TransportError> {
|
|
792
|
-
match f {
|
|
793
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
794
|
-
_ => Ok(None),
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
798
|
-
Ok(Vec::new())
|
|
799
|
-
}
|
|
800
|
-
fn set_session_env(
|
|
801
|
-
&self,
|
|
802
|
-
_s: &SessionName,
|
|
803
|
-
_k: &str,
|
|
804
|
-
_v: &str,
|
|
805
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
806
|
-
Ok(SetEnvOutcome::Applied)
|
|
807
|
-
}
|
|
808
|
-
fn kill_session(&self, _s: &SessionName) -> Result<(), TransportError> {
|
|
809
|
-
Ok(())
|
|
810
|
-
}
|
|
811
|
-
fn kill_window(&self, _t: &Target) -> Result<(), TransportError> {
|
|
812
|
-
Ok(())
|
|
813
|
-
}
|
|
814
|
-
fn attach_session(&self, _s: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
815
|
-
Ok(AttachOutcome::Attached)
|
|
816
|
-
}
|
|
817
|
-
fn inject(
|
|
818
|
-
&self,
|
|
819
|
-
_t: &Target,
|
|
820
|
-
_p: &InjectPayload,
|
|
821
|
-
_s: Key,
|
|
822
|
-
_b: bool,
|
|
823
|
-
) -> Result<InjectReport, TransportError> {
|
|
824
|
-
Ok(InjectReport {
|
|
825
|
-
stage_reached: InjectStage::Submit,
|
|
826
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
827
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
828
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
829
|
-
attempts: 1,
|
|
830
|
-
submit_diagnostics: None,
|
|
831
|
-
})
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
impl Transport for WindowedTransport {
|
|
836
|
-
fn spawn_first(
|
|
837
|
-
&self,
|
|
838
|
-
_s: &SessionName,
|
|
839
|
-
w: &WindowName,
|
|
840
|
-
_a: &[String],
|
|
841
|
-
_c: &Path,
|
|
842
|
-
_e: &BTreeMap<String, String>,
|
|
843
|
-
) -> Result<SpawnResult, TransportError> {
|
|
844
|
-
*self.present.lock().unwrap() = true;
|
|
845
|
-
Ok(SpawnResult {
|
|
846
|
-
pane_id: PaneId::new("%1"),
|
|
847
|
-
session: self.session.clone(),
|
|
848
|
-
window: w.clone(),
|
|
849
|
-
child_pid: None,
|
|
850
|
-
})
|
|
851
|
-
}
|
|
852
|
-
fn spawn_into(
|
|
853
|
-
&self,
|
|
854
|
-
s: &SessionName,
|
|
855
|
-
w: &WindowName,
|
|
856
|
-
a: &[String],
|
|
857
|
-
c: &Path,
|
|
858
|
-
e: &BTreeMap<String, String>,
|
|
859
|
-
) -> Result<SpawnResult, TransportError> {
|
|
860
|
-
self.spawn_first(s, w, a, c, e)
|
|
861
|
-
}
|
|
862
|
-
fn capture(&self, _t: &Target, r: CaptureRange) -> Result<CapturedText, TransportError> {
|
|
863
|
-
Ok(CapturedText {
|
|
864
|
-
text: "OpenAI Codex\ncodex>".to_string(),
|
|
865
|
-
range: r,
|
|
866
|
-
})
|
|
867
|
-
}
|
|
868
|
-
fn liveness(&self, _p: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
869
|
-
Ok(PaneLiveness::Live)
|
|
870
|
-
}
|
|
871
|
-
fn has_session(&self, _s: &SessionName) -> Result<bool, TransportError> {
|
|
872
|
-
Ok(*self.present.lock().unwrap())
|
|
873
|
-
}
|
|
874
|
-
fn list_windows(&self, _s: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
875
|
-
Ok(self.windows.clone())
|
|
876
|
-
}
|
|
877
|
-
fn kind(&self) -> BackendKind {
|
|
878
|
-
BackendKind::Tmux
|
|
879
|
-
}
|
|
880
|
-
fn send_keys(&self, _t: &Target, _k: &[Key]) -> Result<(), TransportError> {
|
|
881
|
-
Ok(())
|
|
882
|
-
}
|
|
883
|
-
fn query(&self, _t: &Target, f: PaneField) -> Result<Option<String>, TransportError> {
|
|
884
|
-
match f {
|
|
885
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
886
|
-
_ => Ok(None),
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
890
|
-
Ok(Vec::new())
|
|
891
|
-
}
|
|
892
|
-
fn set_session_env(
|
|
893
|
-
&self,
|
|
894
|
-
_s: &SessionName,
|
|
895
|
-
_k: &str,
|
|
896
|
-
_v: &str,
|
|
897
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
898
|
-
Ok(SetEnvOutcome::Applied)
|
|
899
|
-
}
|
|
900
|
-
fn kill_session(&self, _s: &SessionName) -> Result<(), TransportError> {
|
|
901
|
-
Ok(())
|
|
902
|
-
}
|
|
903
|
-
fn kill_window(&self, _t: &Target) -> Result<(), TransportError> {
|
|
904
|
-
Ok(())
|
|
905
|
-
}
|
|
906
|
-
fn attach_session(&self, _s: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
907
|
-
Ok(AttachOutcome::Attached)
|
|
908
|
-
}
|
|
909
|
-
fn inject(
|
|
910
|
-
&self,
|
|
911
|
-
_t: &Target,
|
|
912
|
-
_p: &InjectPayload,
|
|
913
|
-
_s: Key,
|
|
914
|
-
_b: bool,
|
|
915
|
-
) -> Result<InjectReport, TransportError> {
|
|
916
|
-
Ok(InjectReport {
|
|
917
|
-
stage_reached: InjectStage::Submit,
|
|
918
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
919
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
920
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
921
|
-
attempts: 1,
|
|
922
|
-
submit_diagnostics: None,
|
|
923
|
-
})
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
impl Transport for DeadPaneTransport {
|
|
928
|
-
fn spawn_first(
|
|
929
|
-
&self,
|
|
930
|
-
s: &SessionName,
|
|
931
|
-
w: &WindowName,
|
|
932
|
-
_a: &[String],
|
|
933
|
-
_c: &Path,
|
|
934
|
-
_e: &BTreeMap<String, String>,
|
|
935
|
-
) -> Result<SpawnResult, TransportError> {
|
|
936
|
-
Ok(SpawnResult {
|
|
937
|
-
pane_id: PaneId::new("%1"),
|
|
938
|
-
session: s.clone(),
|
|
939
|
-
window: w.clone(),
|
|
940
|
-
child_pid: None,
|
|
941
|
-
})
|
|
942
|
-
}
|
|
943
|
-
fn spawn_into(
|
|
944
|
-
&self,
|
|
945
|
-
s: &SessionName,
|
|
946
|
-
w: &WindowName,
|
|
947
|
-
a: &[String],
|
|
948
|
-
c: &Path,
|
|
949
|
-
e: &BTreeMap<String, String>,
|
|
950
|
-
) -> Result<SpawnResult, TransportError> {
|
|
951
|
-
self.spawn_first(s, w, a, c, e)
|
|
952
|
-
}
|
|
953
|
-
fn capture(&self, _t: &Target, r: CaptureRange) -> Result<CapturedText, TransportError> {
|
|
954
|
-
Ok(CapturedText {
|
|
955
|
-
text: String::new(),
|
|
956
|
-
range: r,
|
|
957
|
-
})
|
|
958
|
-
}
|
|
959
|
-
fn liveness(&self, pane: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
960
|
-
// %9999 (the leader pane env) is dead; everything else live.
|
|
961
|
-
if pane.as_str() == "%9999" {
|
|
962
|
-
Ok(PaneLiveness::Dead)
|
|
963
|
-
} else {
|
|
964
|
-
Ok(PaneLiveness::Live)
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
fn has_session(&self, _s: &SessionName) -> Result<bool, TransportError> {
|
|
968
|
-
Ok(true)
|
|
969
|
-
}
|
|
970
|
-
fn list_windows(&self, _s: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
971
|
-
Ok(vec![WindowName::new("worker_a")])
|
|
972
|
-
}
|
|
973
|
-
fn kind(&self) -> BackendKind {
|
|
974
|
-
BackendKind::Tmux
|
|
975
|
-
}
|
|
976
|
-
fn send_keys(&self, _t: &Target, _k: &[Key]) -> Result<(), TransportError> {
|
|
977
|
-
Ok(())
|
|
978
|
-
}
|
|
979
|
-
fn query(&self, _t: &Target, f: PaneField) -> Result<Option<String>, TransportError> {
|
|
980
|
-
match f {
|
|
981
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
982
|
-
_ => Ok(None),
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
986
|
-
Ok(Vec::new())
|
|
987
|
-
}
|
|
988
|
-
fn set_session_env(
|
|
989
|
-
&self,
|
|
990
|
-
_s: &SessionName,
|
|
991
|
-
_k: &str,
|
|
992
|
-
_v: &str,
|
|
993
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
994
|
-
Ok(SetEnvOutcome::Applied)
|
|
995
|
-
}
|
|
996
|
-
fn kill_session(&self, _s: &SessionName) -> Result<(), TransportError> {
|
|
997
|
-
Ok(())
|
|
998
|
-
}
|
|
999
|
-
fn kill_window(&self, _t: &Target) -> Result<(), TransportError> {
|
|
1000
|
-
Ok(())
|
|
1001
|
-
}
|
|
1002
|
-
fn attach_session(&self, _s: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
1003
|
-
Ok(AttachOutcome::Attached)
|
|
1004
|
-
}
|
|
1005
|
-
fn inject(
|
|
1006
|
-
&self,
|
|
1007
|
-
_t: &Target,
|
|
1008
|
-
_p: &InjectPayload,
|
|
1009
|
-
_s: Key,
|
|
1010
|
-
_b: bool,
|
|
1011
|
-
) -> Result<InjectReport, TransportError> {
|
|
1012
|
-
Ok(InjectReport {
|
|
1013
|
-
stage_reached: InjectStage::Submit,
|
|
1014
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
1015
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
1016
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
1017
|
-
attempts: 1,
|
|
1018
|
-
submit_diagnostics: None,
|
|
1019
|
-
})
|
|
1020
|
-
}
|
|
1021
|
-
}
|