@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,134 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! 0.3.28 layout step 8 — display overlay (3-pane tiling).
|
|
3
|
-
//!
|
|
4
|
-
//! Python truth source: 3-pane tiling exists ONLY in the display overlay
|
|
5
|
-
//! (`display/tiling.py:7` `DISPLAY_PANES_PER_WINDOW = 3`), which is
|
|
6
|
-
//! appended to the LEADER session (never the worker session). Math is
|
|
7
|
-
//! `i // 3` (tab index), `i % 3` (slot index), deterministic by job
|
|
8
|
-
//! index. Tab naming: `team-agent:<session_tag>:overview[-N]`.
|
|
9
|
-
//!
|
|
10
|
-
//! Step 8 ships the overlay computation helpers + the
|
|
11
|
-
//! `assert_overlay_call_site` warning that fires when `spawn_split` is
|
|
12
|
-
//! reached from a non-overlay path (Step 9 promotes to hard error).
|
|
13
|
-
|
|
14
|
-
use crate::transport::{SessionName, WindowName};
|
|
15
|
-
|
|
16
|
-
/// 3 panes per overlay window — Python parity.
|
|
17
|
-
pub const OVERLAY_PANES_PER_WINDOW: usize = 3;
|
|
18
|
-
|
|
19
|
-
///
|
|
20
|
-
/// Overlay window name for a 0-based group index. Index 0 → `overview`;
|
|
21
|
-
/// N ≥ 1 → `overview-{N+1}`. Names are scoped by `session_tag` so multiple
|
|
22
|
-
/// teams can coexist on one leader session.
|
|
23
|
-
pub fn overlay_window_name(session_tag: &str, group_index: usize) -> WindowName {
|
|
24
|
-
if group_index == 0 {
|
|
25
|
-
WindowName::new(format!("team-agent:{session_tag}:overview"))
|
|
26
|
-
} else {
|
|
27
|
-
WindowName::new(format!(
|
|
28
|
-
"team-agent:{session_tag}:overview-{}",
|
|
29
|
-
group_index + 1
|
|
30
|
-
))
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/// Plan output: where each agent_id job lands in the overlay.
|
|
35
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
36
|
-
pub struct OverlayPlacement {
|
|
37
|
-
pub agent_id: String,
|
|
38
|
-
pub group_index: usize,
|
|
39
|
-
pub slot_index: usize,
|
|
40
|
-
pub window: WindowName,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
///
|
|
44
|
-
/// Compute the overlay placements for a list of agent_ids. Deterministic by
|
|
45
|
-
/// input order: agent `i` → window `i / 3`, slot `i % 3`.
|
|
46
|
-
pub fn plan_overlay_placements(session_tag: &str, agents: &[&str]) -> Vec<OverlayPlacement> {
|
|
47
|
-
agents
|
|
48
|
-
.iter()
|
|
49
|
-
.enumerate()
|
|
50
|
-
.map(|(i, agent_id)| OverlayPlacement {
|
|
51
|
-
agent_id: agent_id.to_string(),
|
|
52
|
-
group_index: i / OVERLAY_PANES_PER_WINDOW,
|
|
53
|
-
slot_index: i % OVERLAY_PANES_PER_WINDOW,
|
|
54
|
-
window: overlay_window_name(session_tag, i / OVERLAY_PANES_PER_WINDOW),
|
|
55
|
-
})
|
|
56
|
-
.collect()
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
///
|
|
60
|
-
/// True when a window name belongs to a display overlay (matches
|
|
61
|
-
/// `team-agent:<...>:overview[-N]`).
|
|
62
|
-
fn is_overlay_window(name: &WindowName) -> bool {
|
|
63
|
-
let n = name.as_str();
|
|
64
|
-
if !n.starts_with("team-agent:") {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
n.contains(":overview")
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
///
|
|
71
|
-
/// 0.3.28 Step 8 invariant: `spawn_split` may ONLY be called from the
|
|
72
|
-
/// overlay module. This helper emits a warn-level event when called from
|
|
73
|
-
/// anywhere else (Step 9 promotes to a hard error / panic gate). The
|
|
74
|
-
/// `target_session` and `target_window` are passed so the operator sees
|
|
75
|
-
/// which spawn_split call drifted.
|
|
76
|
-
pub fn assert_overlay_call_site(target_session: &SessionName, target_window: &WindowName) {
|
|
77
|
-
if !is_overlay_window(target_window) {
|
|
78
|
-
eprintln!(
|
|
79
|
-
"team_agent::layout overlay_invariant_violation kind=SplitOutsideOverlay \
|
|
80
|
-
session=`{}` window=`{}` action=permitted_with_warning \
|
|
81
|
-
(post-Step-9 will hard-fail; splits must only occur in display overlay)",
|
|
82
|
-
target_session.as_str(),
|
|
83
|
-
target_window.as_str()
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
#[cfg(test)]
|
|
89
|
-
mod tests {
|
|
90
|
-
use super::*;
|
|
91
|
-
|
|
92
|
-
#[test]
|
|
93
|
-
fn overlay_window_name_first_group_is_overview() {
|
|
94
|
-
assert_eq!(
|
|
95
|
-
overlay_window_name("alpha", 0).as_str(),
|
|
96
|
-
"team-agent:alpha:overview"
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
#[test]
|
|
101
|
-
fn overlay_window_name_second_group_appends_two() {
|
|
102
|
-
assert_eq!(
|
|
103
|
-
overlay_window_name("alpha", 1).as_str(),
|
|
104
|
-
"team-agent:alpha:overview-2"
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
#[test]
|
|
109
|
-
fn plan_overlay_placements_three_per_window_deterministic() {
|
|
110
|
-
let agents = ["a", "b", "c", "d", "e", "f", "g"];
|
|
111
|
-
let plan = plan_overlay_placements("alpha", &agents);
|
|
112
|
-
assert_eq!(plan[0].group_index, 0);
|
|
113
|
-
assert_eq!(plan[0].slot_index, 0);
|
|
114
|
-
assert_eq!(plan[2].group_index, 0);
|
|
115
|
-
assert_eq!(plan[2].slot_index, 2);
|
|
116
|
-
assert_eq!(plan[3].group_index, 1);
|
|
117
|
-
assert_eq!(plan[3].slot_index, 0);
|
|
118
|
-
assert_eq!(plan[6].group_index, 2);
|
|
119
|
-
assert_eq!(plan[6].slot_index, 0);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
#[test]
|
|
123
|
-
fn is_overlay_window_matches_overview_namespace_only() {
|
|
124
|
-
assert!(is_overlay_window(&WindowName::new(
|
|
125
|
-
"team-agent:alpha:overview"
|
|
126
|
-
)));
|
|
127
|
-
assert!(is_overlay_window(&WindowName::new(
|
|
128
|
-
"team-agent:alpha:overview-2"
|
|
129
|
-
)));
|
|
130
|
-
assert!(!is_overlay_window(&WindowName::new("developer")));
|
|
131
|
-
assert!(!is_overlay_window(&WindowName::new("team-w1")));
|
|
132
|
-
assert!(!is_overlay_window(&WindowName::new("team-alpha:leader")));
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! 0.3.28 layout step 4 — typed worker placement target.
|
|
3
|
-
//!
|
|
4
|
-
//! Python parity (`runtime.py:1017-1020`): one window per agent in the
|
|
5
|
-
//! worker session, named `agent_id`. First worker creates the session
|
|
6
|
-
//! (`new-session`); subsequent workers each get a new window
|
|
7
|
-
//! (`new-window`). No splits, no 3-pane tiling at the execution layer.
|
|
8
|
-
//!
|
|
9
|
-
//! This module provides the typed `WorkerSpawnTarget` enum returned by
|
|
10
|
-
//! `next_worker_window` (in `layout::manager`). Step 4 lands the API +
|
|
11
|
-
//! contract tests; Step 4b deletes `adaptive_layout_plan` and migrates
|
|
12
|
-
//! all callsites.
|
|
13
|
-
|
|
14
|
-
use crate::transport::{SessionName, WindowName};
|
|
15
|
-
|
|
16
|
-
/// Action to take when spawning a worker into the layout.
|
|
17
|
-
///
|
|
18
|
-
/// `NewSession` is used for the first agent in a fresh team (the worker
|
|
19
|
-
/// session does not yet exist). `NewWindow` is used for every subsequent
|
|
20
|
-
/// agent. There is intentionally NO `SplitWindow` variant — splits exist
|
|
21
|
-
/// only in the display overlay (`layout::overlay`), never in the worker
|
|
22
|
-
/// execution layer.
|
|
23
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
24
|
-
pub enum WorkerSpawnAction {
|
|
25
|
-
/// `tmux new-session -d -s <session> -n <window> ...`
|
|
26
|
-
NewSession,
|
|
27
|
-
/// `tmux new-window -d -t <session> -n <window> ...`
|
|
28
|
-
NewWindow,
|
|
29
|
-
/// Window already exists; reuse (no spawn).
|
|
30
|
-
Noop,
|
|
31
|
-
/// Window already exists; caller asked to force replace —
|
|
32
|
-
/// `tmux kill-window -t <session>:<window>` then recreate.
|
|
33
|
-
ForceReplace,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/// A fully-resolved spawn target for a worker.
|
|
37
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
38
|
-
pub struct WorkerSpawnTarget {
|
|
39
|
-
pub session: SessionName,
|
|
40
|
-
pub window: WindowName,
|
|
41
|
-
pub action: WorkerSpawnAction,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
impl WorkerSpawnTarget {
|
|
45
|
-
pub fn new(session: SessionName, window: WindowName, action: WorkerSpawnAction) -> Self {
|
|
46
|
-
Self {
|
|
47
|
-
session,
|
|
48
|
-
window,
|
|
49
|
-
action,
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! 0.3.28 layout step 7 — leader pane recovery.
|
|
3
|
-
//!
|
|
4
|
-
//! Python truth source (`leader/__init__.py:885-887` +
|
|
5
|
-
//! `restart/orchestration.py:369-383`): leader recovery requires
|
|
6
|
-
//! `TMUX_PANE` env. Without it, runtime emits `leader_receiver.rebind_required`
|
|
7
|
-
//! and continues — NO proactive co-located leader spawn.
|
|
8
|
-
//!
|
|
9
|
-
//! Replaces the pre-0.3.28 `ensure_managed_leader_pane` path that masked
|
|
10
|
-
//! missing leader windows by silently spawning a new one (often into the
|
|
11
|
-
//! worker session — E57-3 root). After Step 2 the leader lives in its
|
|
12
|
-
//! own session, so the proper recovery path is:
|
|
13
|
-
//! 1. If `TMUX_PANE` is set → autobind to that pane.
|
|
14
|
-
//! 2. Else → emit `leader_receiver.rebind_required` and return
|
|
15
|
-
//! `NeedsUserAttach`; the user runs `team-agent attach-leader` or
|
|
16
|
-
//! `team-agent claim-leader` from their leader pane.
|
|
17
|
-
|
|
18
|
-
use crate::transport::PaneId;
|
|
19
|
-
|
|
20
|
-
/// Outcome of a leader recovery attempt.
|
|
21
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
22
|
-
pub enum RecoveryOutcome {
|
|
23
|
-
/// `TMUX_PANE` env is set; caller should `autobind_leader` against this
|
|
24
|
-
/// pane id.
|
|
25
|
-
AutobindToPane(PaneId),
|
|
26
|
-
/// No `TMUX_PANE` env; runtime emits `leader_receiver.rebind_required`
|
|
27
|
-
/// and continues without a leader pane. The user must run
|
|
28
|
-
/// `team-agent attach-leader` from their leader pane to recover.
|
|
29
|
-
NeedsUserAttach,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
///
|
|
33
|
-
/// Compute the recovery outcome from the current environment.
|
|
34
|
-
///
|
|
35
|
-
/// Reads `TMUX_PANE` from the supplied environment iterator (use
|
|
36
|
-
/// `std::env::vars()` in production; tests inject a synthetic map).
|
|
37
|
-
pub fn recover_leader_pane<I>(env: I) -> RecoveryOutcome
|
|
38
|
-
where
|
|
39
|
-
I: IntoIterator<Item = (String, String)>,
|
|
40
|
-
{
|
|
41
|
-
for (k, v) in env {
|
|
42
|
-
if k == "TMUX_PANE" && !v.is_empty() {
|
|
43
|
-
return RecoveryOutcome::AutobindToPane(PaneId::new(v));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
RecoveryOutcome::NeedsUserAttach
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
///
|
|
50
|
-
/// Emit the canonical `leader_receiver.rebind_required` event when the
|
|
51
|
-
/// runtime falls through to `NeedsUserAttach`. Logs to stderr so operators
|
|
52
|
-
/// see the cascade in event logs.
|
|
53
|
-
pub fn log_rebind_required(reason: &str) {
|
|
54
|
-
eprintln!(
|
|
55
|
-
"team_agent::layout leader_receiver.rebind_required reason={reason} \
|
|
56
|
-
action=`run team-agent attach-leader from your leader pane`"
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
#[cfg(test)]
|
|
61
|
-
mod tests {
|
|
62
|
-
use super::*;
|
|
63
|
-
|
|
64
|
-
#[test]
|
|
65
|
-
fn tmux_pane_present_returns_autobind() {
|
|
66
|
-
let env = vec![
|
|
67
|
-
("TMUX_PANE".to_string(), "%7".to_string()),
|
|
68
|
-
("PATH".to_string(), "/bin".to_string()),
|
|
69
|
-
];
|
|
70
|
-
let outcome = recover_leader_pane(env);
|
|
71
|
-
match outcome {
|
|
72
|
-
RecoveryOutcome::AutobindToPane(pane) => assert_eq!(pane.as_str(), "%7"),
|
|
73
|
-
other => panic!("expected AutobindToPane(%7), got {other:?}"),
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
#[test]
|
|
78
|
-
fn no_tmux_pane_returns_needs_user_attach() {
|
|
79
|
-
let env = vec![("PATH".to_string(), "/bin".to_string())];
|
|
80
|
-
assert_eq!(recover_leader_pane(env), RecoveryOutcome::NeedsUserAttach);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
#[test]
|
|
84
|
-
fn empty_tmux_pane_returns_needs_user_attach() {
|
|
85
|
-
let env = vec![("TMUX_PANE".to_string(), "".to_string())];
|
|
86
|
-
assert_eq!(recover_leader_pane(env), RecoveryOutcome::NeedsUserAttach);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
#[test]
|
|
90
|
-
fn recovery_never_spawns_co_located_leader_window() {
|
|
91
|
-
// Python invariant #12: recovery requires TMUX_PANE; without it
|
|
92
|
-
// runtime emits rebind_required and CONTINUES. No silent co-located
|
|
93
|
-
// spawn into the worker session (the E57-3 root cause).
|
|
94
|
-
let env = vec![("WORKER_SESSION_LIVE".to_string(), "1".to_string())];
|
|
95
|
-
match recover_leader_pane(env) {
|
|
96
|
-
RecoveryOutcome::NeedsUserAttach => {} // expected
|
|
97
|
-
RecoveryOutcome::AutobindToPane(_) => {
|
|
98
|
-
panic!(
|
|
99
|
-
"recovery must not autobind without TMUX_PANE — \
|
|
100
|
-
the worker session must NEVER carry a co-located leader \
|
|
101
|
-
window in managed mode (E57-3 root)"
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! unit-1 (Stage 1) — typed runtime session identity.
|
|
3
|
-
//!
|
|
4
|
-
//! Provides two compile-time-distinct newtypes plus a `RuntimeSessions`
|
|
5
|
-
//! reader that pulls them out of `state.json` in one shot.
|
|
6
|
-
//!
|
|
7
|
-
//! Why: every place that reads `state.session_name` or
|
|
8
|
-
//! `leader_receiver.session_name` today does an ad-hoc `starts_with("team-
|
|
9
|
-
//! agent-leader-")` check (or, in the false-positive cases, doesn't). The
|
|
10
|
-
//! 0.3.39 leader-mis-kill class of bugs traces back to a string crossing
|
|
11
|
-
//! a boundary as the wrong identity.
|
|
12
|
-
//!
|
|
13
|
-
//! By going through `WorkerSession::new` / `LeaderLauncherSession::new`, a
|
|
14
|
-
//! leader-prefixed name can never be presented as a worker session by
|
|
15
|
-
//! construction. `LeaderLauncherSession::new` enforces the inverse — only
|
|
16
|
-
//! a leader-prefixed name passes.
|
|
17
|
-
//!
|
|
18
|
-
//! This unit is PURELY ADDITIVE: no existing call site is rewired yet.
|
|
19
|
-
//! unit-3 (restart preflight guard) and unit-4 (managed leader persistence
|
|
20
|
-
//! fix) are the adoption sites; they will route their state reads through
|
|
21
|
-
//! `RuntimeSessions::from_state`.
|
|
22
|
-
|
|
23
|
-
use crate::layout::sessions::{is_leader_session, LEADER_SESSION_PREFIX};
|
|
24
|
-
use crate::transport::SessionName;
|
|
25
|
-
use serde_json::Value;
|
|
26
|
-
|
|
27
|
-
/// A tmux session name that is guaranteed NOT to be a leader launcher
|
|
28
|
-
/// session (does not start with `team-agent-leader-`).
|
|
29
|
-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
30
|
-
pub struct WorkerSession(SessionName);
|
|
31
|
-
|
|
32
|
-
/// A tmux session name that IS a leader launcher session (starts with
|
|
33
|
-
/// `team-agent-leader-`).
|
|
34
|
-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
35
|
-
pub struct LeaderLauncherSession(SessionName);
|
|
36
|
-
|
|
37
|
-
/// Why `WorkerSession::new` rejected a name.
|
|
38
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
39
|
-
enum WorkerSessionError {
|
|
40
|
-
/// The name is empty.
|
|
41
|
-
Empty,
|
|
42
|
-
/// The name carries the leader launcher prefix — must not be a worker
|
|
43
|
-
/// session by construction.
|
|
44
|
-
LeaderPrefixed { name: String },
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// Why `LeaderLauncherSession::new` rejected a name.
|
|
48
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
49
|
-
enum LeaderLauncherSessionError {
|
|
50
|
-
/// The name is empty.
|
|
51
|
-
Empty,
|
|
52
|
-
/// The name does not carry the required leader launcher prefix.
|
|
53
|
-
MissingLeaderPrefix { name: String },
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
impl WorkerSession {
|
|
57
|
-
pub fn new(name: impl Into<String>) -> Result<Self, WorkerSessionError> {
|
|
58
|
-
let raw: String = name.into();
|
|
59
|
-
if raw.is_empty() {
|
|
60
|
-
return Err(WorkerSessionError::Empty);
|
|
61
|
-
}
|
|
62
|
-
if raw.starts_with(LEADER_SESSION_PREFIX) {
|
|
63
|
-
return Err(WorkerSessionError::LeaderPrefixed { name: raw });
|
|
64
|
-
}
|
|
65
|
-
Ok(WorkerSession(SessionName::new(raw)))
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
pub fn as_str(&self) -> &str {
|
|
69
|
-
self.0.as_str()
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
pub fn into_session_name(self) -> SessionName {
|
|
73
|
-
self.0
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
pub fn session_name(&self) -> &SessionName {
|
|
77
|
-
&self.0
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
impl LeaderLauncherSession {
|
|
82
|
-
pub fn new(name: impl Into<String>) -> Result<Self, LeaderLauncherSessionError> {
|
|
83
|
-
let raw: String = name.into();
|
|
84
|
-
if raw.is_empty() {
|
|
85
|
-
return Err(LeaderLauncherSessionError::Empty);
|
|
86
|
-
}
|
|
87
|
-
if !raw.starts_with(LEADER_SESSION_PREFIX) {
|
|
88
|
-
return Err(LeaderLauncherSessionError::MissingLeaderPrefix { name: raw });
|
|
89
|
-
}
|
|
90
|
-
Ok(LeaderLauncherSession(SessionName::new(raw)))
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
pub fn as_str(&self) -> &str {
|
|
94
|
-
self.0.as_str()
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
pub fn into_session_name(self) -> SessionName {
|
|
98
|
-
self.0
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
pub fn session_name(&self) -> &SessionName {
|
|
102
|
-
&self.0
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/// What `RuntimeSessions::from_state` learned about the runtime topology.
|
|
107
|
-
///
|
|
108
|
-
/// Both fields are `Option` because state.json may be partial: a workspace
|
|
109
|
-
/// that has never seen a successful quick-start has no `session_name`, and
|
|
110
|
-
/// `leader_receiver` is absent until a leader binds.
|
|
111
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
112
|
-
pub struct RuntimeSessions {
|
|
113
|
-
/// The worker session derived from `state.session_name`, if present
|
|
114
|
-
/// AND well-formed (not leader-prefixed).
|
|
115
|
-
pub worker: Option<WorkerSession>,
|
|
116
|
-
/// The leader launcher session derived from
|
|
117
|
-
/// `state.leader_receiver.session_name`, if present AND leader-prefixed.
|
|
118
|
-
pub leader: Option<LeaderLauncherSession>,
|
|
119
|
-
/// State fields that exist but failed validation (e.g.
|
|
120
|
-
/// `state.session_name` is leader-prefixed = the 0.3.39 bug shape).
|
|
121
|
-
/// Callers (unit-3 preflight) use this to refuse cleanly rather than
|
|
122
|
-
/// proceed with a wrong-identity name.
|
|
123
|
-
pub anomalies: Vec<RuntimeSessionAnomaly>,
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
127
|
-
pub enum RuntimeSessionAnomaly {
|
|
128
|
-
/// `state.session_name` carried the leader launcher prefix — classic
|
|
129
|
-
/// 0.3.39 bug shape. cli/lifecycle MUST refuse before taking a kill
|
|
130
|
-
/// action against this string.
|
|
131
|
-
WorkerSessionNameIsLeaderPrefixed { value: String },
|
|
132
|
-
/// `leader_receiver.session_name` was present but not leader-prefixed.
|
|
133
|
-
LeaderReceiverSessionNameNotLeaderPrefixed { value: String },
|
|
134
|
-
/// `state.session_name == leader_receiver.session_name` — collision
|
|
135
|
-
/// that unit-4 explicitly fixes by stopping the persistence overwrite.
|
|
136
|
-
WorkerSessionEqualsLeaderSession { value: String },
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
impl RuntimeSessions {
|
|
140
|
-
///
|
|
141
|
-
/// Read state.json's session-identity fields and wrap them in typed
|
|
142
|
-
/// values. Never panics on bad state — anomalies are surfaced for
|
|
143
|
-
/// callers to act on.
|
|
144
|
-
pub fn from_state(state: &Value) -> Self {
|
|
145
|
-
let raw_worker = state
|
|
146
|
-
.get("session_name")
|
|
147
|
-
.and_then(Value::as_str)
|
|
148
|
-
.map(str::to_string);
|
|
149
|
-
let raw_leader = state
|
|
150
|
-
.get("leader_receiver")
|
|
151
|
-
.and_then(|r| r.get("session_name"))
|
|
152
|
-
.and_then(Value::as_str)
|
|
153
|
-
.map(str::to_string);
|
|
154
|
-
|
|
155
|
-
let mut anomalies = Vec::new();
|
|
156
|
-
|
|
157
|
-
let worker = match raw_worker.as_deref() {
|
|
158
|
-
None | Some("") => None,
|
|
159
|
-
Some(name) => match WorkerSession::new(name) {
|
|
160
|
-
Ok(w) => Some(w),
|
|
161
|
-
Err(WorkerSessionError::LeaderPrefixed { name }) => {
|
|
162
|
-
anomalies.push(RuntimeSessionAnomaly::WorkerSessionNameIsLeaderPrefixed {
|
|
163
|
-
value: name,
|
|
164
|
-
});
|
|
165
|
-
None
|
|
166
|
-
}
|
|
167
|
-
Err(WorkerSessionError::Empty) => None,
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
let leader = match raw_leader.as_deref() {
|
|
172
|
-
None | Some("") => None,
|
|
173
|
-
Some(name) => match LeaderLauncherSession::new(name) {
|
|
174
|
-
Ok(l) => Some(l),
|
|
175
|
-
Err(LeaderLauncherSessionError::MissingLeaderPrefix { name }) => {
|
|
176
|
-
anomalies.push(
|
|
177
|
-
RuntimeSessionAnomaly::LeaderReceiverSessionNameNotLeaderPrefixed {
|
|
178
|
-
value: name,
|
|
179
|
-
},
|
|
180
|
-
);
|
|
181
|
-
None
|
|
182
|
-
}
|
|
183
|
-
Err(LeaderLauncherSessionError::Empty) => None,
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
if let (Some(rw), Some(rl)) = (raw_worker.as_deref(), raw_leader.as_deref()) {
|
|
188
|
-
if !rw.is_empty() && rw == rl {
|
|
189
|
-
anomalies.push(RuntimeSessionAnomaly::WorkerSessionEqualsLeaderSession {
|
|
190
|
-
value: rw.to_string(),
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
Self {
|
|
196
|
-
worker,
|
|
197
|
-
leader,
|
|
198
|
-
anomalies,
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
///
|
|
203
|
-
/// True if any session-identity anomaly was detected in state.
|
|
204
|
-
pub fn has_anomalies(&self) -> bool {
|
|
205
|
-
!self.anomalies.is_empty()
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
///
|
|
209
|
-
/// True if a `state.session_name` looked like a leader launcher session
|
|
210
|
-
/// — the exact 0.3.39 shape unit-3 must refuse before any kill.
|
|
211
|
-
pub fn worker_session_name_is_leader_prefixed(&self) -> bool {
|
|
212
|
-
self.anomalies.iter().any(|a| {
|
|
213
|
-
matches!(
|
|
214
|
-
a,
|
|
215
|
-
RuntimeSessionAnomaly::WorkerSessionNameIsLeaderPrefixed { .. }
|
|
216
|
-
)
|
|
217
|
-
})
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
///
|
|
222
|
-
/// True when `name` is a leader launcher session (mirrors
|
|
223
|
-
/// `layout::sessions::is_leader_session` on a raw &str).
|
|
224
|
-
fn name_is_leader_launcher(name: &str) -> bool {
|
|
225
|
-
let session = SessionName::new(name);
|
|
226
|
-
is_leader_session(&session)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
#[cfg(test)]
|
|
230
|
-
mod tests {
|
|
231
|
-
use super::*;
|
|
232
|
-
use serde_json::json;
|
|
233
|
-
|
|
234
|
-
#[test]
|
|
235
|
-
fn worker_session_new_rejects_leader_prefixed() {
|
|
236
|
-
let err = WorkerSession::new("team-agent-leader-claude-x").unwrap_err();
|
|
237
|
-
assert!(matches!(err, WorkerSessionError::LeaderPrefixed { .. }));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
#[test]
|
|
241
|
-
fn worker_session_new_rejects_empty() {
|
|
242
|
-
assert!(matches!(
|
|
243
|
-
WorkerSession::new("").unwrap_err(),
|
|
244
|
-
WorkerSessionError::Empty
|
|
245
|
-
));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
#[test]
|
|
249
|
-
fn worker_session_new_accepts_team_prefixed() {
|
|
250
|
-
let w = WorkerSession::new("team-foo").unwrap();
|
|
251
|
-
assert_eq!(w.as_str(), "team-foo");
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
#[test]
|
|
255
|
-
fn leader_launcher_session_new_requires_leader_prefix() {
|
|
256
|
-
assert!(matches!(
|
|
257
|
-
LeaderLauncherSession::new("team-foo").unwrap_err(),
|
|
258
|
-
LeaderLauncherSessionError::MissingLeaderPrefix { .. }
|
|
259
|
-
));
|
|
260
|
-
let l = LeaderLauncherSession::new("team-agent-leader-codex-abc").unwrap();
|
|
261
|
-
assert_eq!(l.as_str(), "team-agent-leader-codex-abc");
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
#[test]
|
|
265
|
-
fn runtime_sessions_from_state_clean() {
|
|
266
|
-
let state = json!({
|
|
267
|
-
"session_name": "team-foo",
|
|
268
|
-
"leader_receiver": { "session_name": "team-agent-leader-codex-abc" },
|
|
269
|
-
});
|
|
270
|
-
let r = RuntimeSessions::from_state(&state);
|
|
271
|
-
assert_eq!(r.worker.unwrap().as_str(), "team-foo");
|
|
272
|
-
assert_eq!(r.leader.unwrap().as_str(), "team-agent-leader-codex-abc");
|
|
273
|
-
assert!(r.anomalies.is_empty());
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
#[test]
|
|
277
|
-
fn runtime_sessions_from_state_flags_leader_prefixed_worker_name() {
|
|
278
|
-
// The 0.3.39 bug shape.
|
|
279
|
-
let state = json!({ "session_name": "team-agent-leader-bad" });
|
|
280
|
-
let r = RuntimeSessions::from_state(&state);
|
|
281
|
-
assert!(r.worker.is_none());
|
|
282
|
-
assert!(r.worker_session_name_is_leader_prefixed());
|
|
283
|
-
assert!(r.has_anomalies());
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
#[test]
|
|
287
|
-
fn runtime_sessions_from_state_flags_worker_equals_leader() {
|
|
288
|
-
let state = json!({
|
|
289
|
-
"session_name": "team-agent-leader-x",
|
|
290
|
-
"leader_receiver": { "session_name": "team-agent-leader-x" },
|
|
291
|
-
});
|
|
292
|
-
let r = RuntimeSessions::from_state(&state);
|
|
293
|
-
// Both anomalies fire: leader-prefixed worker + worker==leader.
|
|
294
|
-
assert!(r.anomalies.iter().any(|a| matches!(
|
|
295
|
-
a,
|
|
296
|
-
RuntimeSessionAnomaly::WorkerSessionNameIsLeaderPrefixed { .. }
|
|
297
|
-
)));
|
|
298
|
-
assert!(r.anomalies.iter().any(|a| matches!(
|
|
299
|
-
a,
|
|
300
|
-
RuntimeSessionAnomaly::WorkerSessionEqualsLeaderSession { .. }
|
|
301
|
-
)));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
#[test]
|
|
305
|
-
fn runtime_sessions_from_state_empty_state_is_clean() {
|
|
306
|
-
let r = RuntimeSessions::from_state(&json!({}));
|
|
307
|
-
assert!(r.worker.is_none());
|
|
308
|
-
assert!(r.leader.is_none());
|
|
309
|
-
assert!(r.anomalies.is_empty());
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
#[test]
|
|
313
|
-
fn name_is_leader_launcher_matches_constant() {
|
|
314
|
-
assert!(name_is_leader_launcher("team-agent-leader-x"));
|
|
315
|
-
assert!(!name_is_leader_launcher("team-x"));
|
|
316
|
-
}
|
|
317
|
-
}
|