@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,294 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! 0.3.28 layout step 1 — session name constructors + topology invariant guard.
|
|
3
|
-
//!
|
|
4
|
-
//! Python 0.2.11 truth source (recap):
|
|
5
|
-
//! * Leader runs in a SEPARATE tmux session named
|
|
6
|
-
//! `team-agent-leader-<provider>-<folder>-<sha1[:8]>` (the existing
|
|
7
|
-
//! `crate::leader::start::leader_session_name`).
|
|
8
|
-
//! * Worker session is `runtime.session_name` or `team-<team.name>` (the
|
|
9
|
-
//! existing `lifecycle::launch::spec_session_name`).
|
|
10
|
-
//! * These two names MUST be disjoint by prefix
|
|
11
|
-
//! (`team-agent-leader-` vs `team-...`).
|
|
12
|
-
//!
|
|
13
|
-
//! This module re-exports those name constructors under a single namespace
|
|
14
|
-
//! and adds the topology invariant guard. No behaviour change in Step 1;
|
|
15
|
-
//! the guard runs as `tracing::warn!` so any drift is logged but not fatal.
|
|
16
|
-
|
|
17
|
-
use std::path::Path;
|
|
18
|
-
|
|
19
|
-
use crate::model::enums::Provider;
|
|
20
|
-
use crate::model::yaml::Value as YamlValue;
|
|
21
|
-
use crate::transport::SessionName;
|
|
22
|
-
use serde_json::Value as JsonValue;
|
|
23
|
-
|
|
24
|
-
/// `team-agent-leader-` — disjoint prefix for the leader session.
|
|
25
|
-
/// Re-exported from `leader::start::LEADER_SESSION_PREFIX` so layout-layer
|
|
26
|
-
/// code does not have to depend on the leader module's internals.
|
|
27
|
-
pub const LEADER_SESSION_PREFIX: &str = crate::leader::start::LEADER_SESSION_PREFIX;
|
|
28
|
-
|
|
29
|
-
///
|
|
30
|
-
/// Leader's dedicated tmux session name.
|
|
31
|
-
///
|
|
32
|
-
/// Format: `team-agent-leader-<provider_wire>-<folder>-<sha1(workspace)[:8]>`.
|
|
33
|
-
///
|
|
34
|
-
/// Re-exports `crate::leader::start::leader_session_name` so the rest of the
|
|
35
|
-
/// runtime can derive this name without touching the leader module. The
|
|
36
|
-
/// single underlying impl lives in `leader/start.rs` for now to minimise the
|
|
37
|
-
/// Step-1 diff; Step 2 will move it.
|
|
38
|
-
pub fn leader_session_name(provider: Provider, workspace: &Path) -> SessionName {
|
|
39
|
-
crate::leader::start::leader_session_name(provider, workspace)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
///
|
|
43
|
-
/// Worker tmux session name derived from the team spec.
|
|
44
|
-
///
|
|
45
|
-
/// Format: `spec.runtime.session_name` if set, else `team-<team.name>`
|
|
46
|
-
/// (default `team-agent`). This is a thin re-export of the existing
|
|
47
|
-
/// `lifecycle::launch::worker_session_name_pub` — exposed here so layout-
|
|
48
|
-
/// layer code has one place to ask. The spec is a `model::yaml::Value`
|
|
49
|
-
/// (the team spec parser's native type).
|
|
50
|
-
pub fn worker_session_name(spec: &YamlValue) -> SessionName {
|
|
51
|
-
crate::lifecycle::launch::worker_session_name_pub(spec)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
///
|
|
55
|
-
/// True when `name` starts with the leader session prefix.
|
|
56
|
-
pub fn is_leader_session(name: &SessionName) -> bool {
|
|
57
|
-
name.as_str().starts_with(LEADER_SESSION_PREFIX)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
///
|
|
61
|
-
/// True when `name` equals the worker session name derived from `spec`.
|
|
62
|
-
fn is_worker_session(name: &SessionName, spec: &YamlValue) -> bool {
|
|
63
|
-
worker_session_name(spec).as_str() == name.as_str()
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/// A detected topology invariant violation, surfaced as a warn-level log line
|
|
67
|
-
/// during the incremental migration (Steps 1–9). Hard error in Step 10.
|
|
68
|
-
#[derive(Debug, Clone)]
|
|
69
|
-
pub struct TopologyViolation {
|
|
70
|
-
pub kind: TopologyViolationKind,
|
|
71
|
-
pub detail: String,
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
75
|
-
pub enum TopologyViolationKind {
|
|
76
|
-
/// Worker session name shares the leader-session prefix.
|
|
77
|
-
WorkerSessionNamedAsLeader,
|
|
78
|
-
/// A worker window inside the worker session is named `leader`.
|
|
79
|
-
WorkerWindowNamedLeader,
|
|
80
|
-
/// Two agents share the same `pane_id` in state.
|
|
81
|
-
AgentPaneIdCollision,
|
|
82
|
-
/// `leader_receiver.pane_id` matches an active agent's `pane_id`.
|
|
83
|
-
LeaderPaneIdCollidesWithAgent,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
///
|
|
87
|
-
/// Assert the runtime-state topology invariants (Step 1 — `warn!` only).
|
|
88
|
-
///
|
|
89
|
-
/// Checks:
|
|
90
|
-
/// 1. The worker session name does NOT start with the leader prefix.
|
|
91
|
-
/// 2. No agent window in worker session is literally named `leader`.
|
|
92
|
-
/// 3. No two agents share the same `pane_id`.
|
|
93
|
-
/// 4. `state.leader_receiver.pane_id` is not equal to any agent's
|
|
94
|
-
/// `pane_id` (E51 family — co-located lease corruption).
|
|
95
|
-
///
|
|
96
|
-
/// Returns the list of violations without panicking. Callers may choose to
|
|
97
|
-
/// emit `tracing::warn!` for each (the default in Steps 1–9) or escalate.
|
|
98
|
-
pub fn assert_topology_invariants(state: &JsonValue, spec: &YamlValue) -> Vec<TopologyViolation> {
|
|
99
|
-
let mut out = Vec::new();
|
|
100
|
-
let worker_session = worker_session_name(spec);
|
|
101
|
-
if worker_session.as_str().starts_with(LEADER_SESSION_PREFIX) {
|
|
102
|
-
out.push(TopologyViolation {
|
|
103
|
-
kind: TopologyViolationKind::WorkerSessionNamedAsLeader,
|
|
104
|
-
detail: format!(
|
|
105
|
-
"worker session name `{}` starts with leader prefix `{LEADER_SESSION_PREFIX}` — \
|
|
106
|
-
leader and worker sessions must be disjoint",
|
|
107
|
-
worker_session.as_str()
|
|
108
|
-
),
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
let agents = state.get("agents").and_then(JsonValue::as_object);
|
|
112
|
-
if let Some(agents) = agents {
|
|
113
|
-
for (agent_id, agent) in agents {
|
|
114
|
-
let window = agent
|
|
115
|
-
.get("window")
|
|
116
|
-
.and_then(JsonValue::as_str)
|
|
117
|
-
.unwrap_or("");
|
|
118
|
-
if window.eq_ignore_ascii_case("leader") {
|
|
119
|
-
out.push(TopologyViolation {
|
|
120
|
-
kind: TopologyViolationKind::WorkerWindowNamedLeader,
|
|
121
|
-
detail: format!(
|
|
122
|
-
"agent `{agent_id}` lives in window `leader` of worker session \
|
|
123
|
-
`{}` — workers must use `agent_id` window names",
|
|
124
|
-
worker_session.as_str()
|
|
125
|
-
),
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// Pane-id collision among agents.
|
|
130
|
-
let mut by_pane: std::collections::HashMap<String, Vec<String>> =
|
|
131
|
-
std::collections::HashMap::new();
|
|
132
|
-
for (agent_id, agent) in agents {
|
|
133
|
-
if let Some(pane) = agent
|
|
134
|
-
.get("pane_id")
|
|
135
|
-
.and_then(JsonValue::as_str)
|
|
136
|
-
.filter(|s| !s.is_empty())
|
|
137
|
-
{
|
|
138
|
-
by_pane
|
|
139
|
-
.entry(pane.to_string())
|
|
140
|
-
.or_default()
|
|
141
|
-
.push(agent_id.to_string());
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
for (pane, ids) in by_pane.iter() {
|
|
145
|
-
if ids.len() > 1 {
|
|
146
|
-
out.push(TopologyViolation {
|
|
147
|
-
kind: TopologyViolationKind::AgentPaneIdCollision,
|
|
148
|
-
detail: format!(
|
|
149
|
-
"pane_id `{pane}` shared by agents {ids:?} — at most one agent may bind a pane_id"
|
|
150
|
-
),
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// leader_receiver.pane_id ∉ any agent.pane_id.
|
|
155
|
-
let leader_pane = state
|
|
156
|
-
.get("leader_receiver")
|
|
157
|
-
.and_then(|lr| lr.get("pane_id"))
|
|
158
|
-
.and_then(JsonValue::as_str)
|
|
159
|
-
.filter(|s| !s.is_empty());
|
|
160
|
-
if let Some(leader_pane) = leader_pane {
|
|
161
|
-
for (agent_id, agent) in agents {
|
|
162
|
-
if agent
|
|
163
|
-
.get("pane_id")
|
|
164
|
-
.and_then(JsonValue::as_str)
|
|
165
|
-
.is_some_and(|p| p == leader_pane)
|
|
166
|
-
{
|
|
167
|
-
out.push(TopologyViolation {
|
|
168
|
-
kind: TopologyViolationKind::LeaderPaneIdCollidesWithAgent,
|
|
169
|
-
detail: format!(
|
|
170
|
-
"leader_receiver.pane_id `{leader_pane}` is also bound to \
|
|
171
|
-
agent `{agent_id}` — legacy bare-pane advisory only; validate \
|
|
172
|
-
endpoint/session/window/pane_pid tuple before using this as an \
|
|
173
|
-
identity blocker"
|
|
174
|
-
),
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
out
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
///
|
|
184
|
-
/// Logs each violation in `violations` to stderr under the
|
|
185
|
-
/// `team_agent::layout` tag. No-op when the list is empty. This is the
|
|
186
|
-
/// Step-1 surface — `eprintln!` matches the codebase's existing logging
|
|
187
|
-
/// convention (see `lifecycle::launch::eprintln!` calls). Hard error path
|
|
188
|
-
/// is deferred to Step 10.
|
|
189
|
-
pub fn log_topology_violations(violations: &[TopologyViolation]) {
|
|
190
|
-
for v in violations {
|
|
191
|
-
eprintln!(
|
|
192
|
-
"team_agent::layout topology_invariant_violation kind={:?} detail={}",
|
|
193
|
-
v.kind, v.detail
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
#[cfg(test)]
|
|
199
|
-
mod tests {
|
|
200
|
-
use super::*;
|
|
201
|
-
use serde_json::json;
|
|
202
|
-
|
|
203
|
-
fn spec_for(team: &str) -> YamlValue {
|
|
204
|
-
YamlValue::Map(vec![(
|
|
205
|
-
"team".to_string(),
|
|
206
|
-
YamlValue::Map(vec![("name".to_string(), YamlValue::Str(team.to_string()))]),
|
|
207
|
-
)])
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
#[test]
|
|
211
|
-
fn leader_and_worker_session_names_are_disjoint_by_prefix() {
|
|
212
|
-
let leader = leader_session_name(Provider::Claude, Path::new("/tmp/proj"));
|
|
213
|
-
let worker = worker_session_name(&spec_for("alpha"));
|
|
214
|
-
assert!(
|
|
215
|
-
leader.as_str().starts_with(LEADER_SESSION_PREFIX),
|
|
216
|
-
"leader name `{}` must start with `{LEADER_SESSION_PREFIX}`",
|
|
217
|
-
leader.as_str()
|
|
218
|
-
);
|
|
219
|
-
assert!(
|
|
220
|
-
!worker.as_str().starts_with(LEADER_SESSION_PREFIX),
|
|
221
|
-
"worker name `{}` must NOT start with `{LEADER_SESSION_PREFIX}`",
|
|
222
|
-
worker.as_str()
|
|
223
|
-
);
|
|
224
|
-
assert_ne!(leader.as_str(), worker.as_str());
|
|
225
|
-
assert!(is_leader_session(&leader));
|
|
226
|
-
assert!(!is_leader_session(&worker));
|
|
227
|
-
assert!(is_worker_session(&worker, &spec_for("alpha")));
|
|
228
|
-
assert!(!is_worker_session(&leader, &spec_for("alpha")));
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
#[test]
|
|
232
|
-
fn assert_topology_clean_state_returns_empty() {
|
|
233
|
-
let state = json!({
|
|
234
|
-
"agents": {
|
|
235
|
-
"developer": { "pane_id": "%1", "window": "developer" },
|
|
236
|
-
"tester": { "pane_id": "%2", "window": "tester" }
|
|
237
|
-
},
|
|
238
|
-
"leader_receiver": { "pane_id": "%0" }
|
|
239
|
-
});
|
|
240
|
-
let v = assert_topology_invariants(&state, &spec_for("alpha"));
|
|
241
|
-
assert!(
|
|
242
|
-
v.is_empty(),
|
|
243
|
-
"clean state should produce no violations; got {v:?}"
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
#[test]
|
|
248
|
-
fn assert_topology_flags_pane_id_collision() {
|
|
249
|
-
let state = json!({
|
|
250
|
-
"agents": {
|
|
251
|
-
"developer": { "pane_id": "%1", "window": "developer" },
|
|
252
|
-
"tester": { "pane_id": "%1", "window": "tester" }
|
|
253
|
-
},
|
|
254
|
-
"leader_receiver": { "pane_id": "%0" }
|
|
255
|
-
});
|
|
256
|
-
let v = assert_topology_invariants(&state, &spec_for("alpha"));
|
|
257
|
-
assert!(
|
|
258
|
-
v.iter()
|
|
259
|
-
.any(|x| matches!(x.kind, TopologyViolationKind::AgentPaneIdCollision)),
|
|
260
|
-
"must flag AgentPaneIdCollision; got {v:?}"
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
#[test]
|
|
265
|
-
fn assert_topology_flags_leader_pane_overlap_with_agent() {
|
|
266
|
-
let state = json!({
|
|
267
|
-
"agents": {
|
|
268
|
-
"developer": { "pane_id": "%0", "window": "developer" }
|
|
269
|
-
},
|
|
270
|
-
"leader_receiver": { "pane_id": "%0" }
|
|
271
|
-
});
|
|
272
|
-
let v = assert_topology_invariants(&state, &spec_for("alpha"));
|
|
273
|
-
assert!(
|
|
274
|
-
v.iter()
|
|
275
|
-
.any(|x| matches!(x.kind, TopologyViolationKind::LeaderPaneIdCollidesWithAgent)),
|
|
276
|
-
"must flag LeaderPaneIdCollidesWithAgent; got {v:?}"
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
#[test]
|
|
281
|
-
fn assert_topology_flags_worker_window_named_leader() {
|
|
282
|
-
let state = json!({
|
|
283
|
-
"agents": {
|
|
284
|
-
"stray": { "pane_id": "%5", "window": "leader" }
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
let v = assert_topology_invariants(&state, &spec_for("alpha"));
|
|
288
|
-
assert!(
|
|
289
|
-
v.iter()
|
|
290
|
-
.any(|x| matches!(x.kind, TopologyViolationKind::WorkerWindowNamedLeader)),
|
|
291
|
-
"must flag WorkerWindowNamedLeader; got {v:?}"
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! unit-9 (Stage 4) — tmux endpoint selection policy, separated from the
|
|
3
|
-
//! concrete `TmuxBackend` execution layer.
|
|
4
|
-
//!
|
|
5
|
-
//! Today the endpoint-selection rule lives inside `crate::tmux_backend`
|
|
6
|
-
//! (private fn `runtime_tmux_endpoint_from_state` + helpers) intertwined
|
|
7
|
-
//! with the concrete command-execution backend. The policy is independently
|
|
8
|
-
//! testable — given a `state.json` value, pick which endpoint string to
|
|
9
|
-
//! bind a tmux client to — but you can't reach it without spinning up the
|
|
10
|
-
//! whole backend.
|
|
11
|
-
//!
|
|
12
|
-
//! This module exposes the policy as a small, pure, layout-layer concern.
|
|
13
|
-
//! Concrete `TmuxBackend` stays in `tmux_backend.rs` for command execution.
|
|
14
|
-
//! Callers that only want to KNOW the endpoint (cli printers, diagnostics,
|
|
15
|
-
//! event-log fields) can ask this module instead of constructing a backend.
|
|
16
|
-
//!
|
|
17
|
-
//! Migration: additive. The existing `tmux_backend` API is unchanged; the
|
|
18
|
-
//! policy here mirrors it byte-for-byte (verified by `endpoint_priority_matches_backend`
|
|
19
|
-
//! contract tests).
|
|
20
|
-
|
|
21
|
-
use serde_json::Value;
|
|
22
|
-
use std::path::Path;
|
|
23
|
-
|
|
24
|
-
/// Which state field (or fallback) supplied the chosen endpoint.
|
|
25
|
-
///
|
|
26
|
-
/// Mirrors `crate::tmux_backend::RuntimeTmuxEndpointSource` 1:1 — this
|
|
27
|
-
/// public surface lets layout-layer callers reason about the source
|
|
28
|
-
/// without depending on a `pub(crate)` enum.
|
|
29
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
30
|
-
pub enum TmuxEndpointSource {
|
|
31
|
-
/// `state.tmux_endpoint` (highest priority).
|
|
32
|
-
StateTmuxEndpoint,
|
|
33
|
-
/// `state.tmux_socket` (fallback when `tmux_endpoint` is absent).
|
|
34
|
-
StateTmuxSocket,
|
|
35
|
-
/// Derived from the workspace path (lowest priority, used when state
|
|
36
|
-
/// has no endpoint info at all — typical for never-quick-started ws).
|
|
37
|
-
WorkspaceFallback,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
impl TmuxEndpointSource {
|
|
41
|
-
pub fn as_str(self) -> &'static str {
|
|
42
|
-
match self {
|
|
43
|
-
Self::StateTmuxEndpoint => "state.tmux_endpoint",
|
|
44
|
-
Self::StateTmuxSocket => "state.tmux_socket",
|
|
45
|
-
Self::WorkspaceFallback => "workspace_fallback",
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/// Selected endpoint description: the string to pass to tmux + which state
|
|
51
|
-
/// field it came from. The endpoint may be either a short socket name
|
|
52
|
-
/// (`-L <name>`) or a path (`-S <path>`); callers map that to flags.
|
|
53
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
54
|
-
pub struct TmuxEndpointSelection {
|
|
55
|
-
pub endpoint: String,
|
|
56
|
-
pub source: TmuxEndpointSource,
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
///
|
|
60
|
-
/// Pure policy: pick the tmux endpoint to use given a (maybe-present)
|
|
61
|
-
/// `state.json` Value.
|
|
62
|
-
///
|
|
63
|
-
/// Priority — keep in sync with `crate::tmux_backend::
|
|
64
|
-
/// runtime_tmux_endpoint_from_state`:
|
|
65
|
-
/// 1. `state.tmux_endpoint` (non-empty string)
|
|
66
|
-
/// 2. `state.tmux_socket` (non-empty string)
|
|
67
|
-
/// 3. workspace fallback (caller supplies the derived value)
|
|
68
|
-
///
|
|
69
|
-
/// Returns `None` when state has neither field; callers fall back to a
|
|
70
|
-
/// workspace-derived value via [`select_endpoint_for_workspace`].
|
|
71
|
-
pub fn select_endpoint_from_state(state: Option<&Value>) -> Option<TmuxEndpointSelection> {
|
|
72
|
-
let state = state?;
|
|
73
|
-
if let Some(endpoint) = state
|
|
74
|
-
.get("tmux_endpoint")
|
|
75
|
-
.and_then(Value::as_str)
|
|
76
|
-
.filter(|s| !s.is_empty())
|
|
77
|
-
{
|
|
78
|
-
return Some(TmuxEndpointSelection {
|
|
79
|
-
endpoint: endpoint.to_string(),
|
|
80
|
-
source: TmuxEndpointSource::StateTmuxEndpoint,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
if let Some(socket) = state
|
|
84
|
-
.get("tmux_socket")
|
|
85
|
-
.and_then(Value::as_str)
|
|
86
|
-
.filter(|s| !s.is_empty())
|
|
87
|
-
{
|
|
88
|
-
return Some(TmuxEndpointSelection {
|
|
89
|
-
endpoint: socket.to_string(),
|
|
90
|
-
source: TmuxEndpointSource::StateTmuxSocket,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
None
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
///
|
|
97
|
-
/// State-first endpoint selection with workspace fallback. Equivalent to
|
|
98
|
-
/// what `tmux_backend_for_runtime_state_or_workspace` does internally,
|
|
99
|
-
/// minus the backend construction.
|
|
100
|
-
pub fn select_endpoint_for_workspace(
|
|
101
|
-
workspace: &Path,
|
|
102
|
-
state: Option<&Value>,
|
|
103
|
-
) -> TmuxEndpointSelection {
|
|
104
|
-
if let Some(sel) = select_endpoint_from_state(state) {
|
|
105
|
-
return sel;
|
|
106
|
-
}
|
|
107
|
-
TmuxEndpointSelection {
|
|
108
|
-
endpoint: crate::tmux_backend::socket_name_for_workspace(workspace),
|
|
109
|
-
source: TmuxEndpointSource::WorkspaceFallback,
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
#[cfg(test)]
|
|
114
|
-
mod tests {
|
|
115
|
-
use super::*;
|
|
116
|
-
use serde_json::json;
|
|
117
|
-
use std::path::PathBuf;
|
|
118
|
-
|
|
119
|
-
#[test]
|
|
120
|
-
fn state_tmux_endpoint_wins_over_socket() {
|
|
121
|
-
let state = json!({
|
|
122
|
-
"tmux_endpoint": "/private/tmp/tmux-501/abc",
|
|
123
|
-
"tmux_socket": "abc",
|
|
124
|
-
});
|
|
125
|
-
let sel = select_endpoint_from_state(Some(&state)).unwrap();
|
|
126
|
-
assert_eq!(sel.endpoint, "/private/tmp/tmux-501/abc");
|
|
127
|
-
assert_eq!(sel.source, TmuxEndpointSource::StateTmuxEndpoint);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
#[test]
|
|
131
|
-
fn state_tmux_socket_used_when_endpoint_absent() {
|
|
132
|
-
let state = json!({ "tmux_socket": "ta-abc" });
|
|
133
|
-
let sel = select_endpoint_from_state(Some(&state)).unwrap();
|
|
134
|
-
assert_eq!(sel.endpoint, "ta-abc");
|
|
135
|
-
assert_eq!(sel.source, TmuxEndpointSource::StateTmuxSocket);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
#[test]
|
|
139
|
-
fn empty_strings_are_ignored() {
|
|
140
|
-
let state = json!({ "tmux_endpoint": "", "tmux_socket": "" });
|
|
141
|
-
assert!(select_endpoint_from_state(Some(&state)).is_none());
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
#[test]
|
|
145
|
-
fn none_state_returns_none() {
|
|
146
|
-
assert!(select_endpoint_from_state(None).is_none());
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
#[test]
|
|
150
|
-
fn workspace_fallback_kicks_in_with_no_state_endpoint() {
|
|
151
|
-
let ws = PathBuf::from("/tmp/ta-unit9-fallback");
|
|
152
|
-
let sel = select_endpoint_for_workspace(&ws, None);
|
|
153
|
-
assert_eq!(sel.source, TmuxEndpointSource::WorkspaceFallback);
|
|
154
|
-
assert!(!sel.endpoint.is_empty());
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
#[test]
|
|
158
|
-
fn workspace_fallback_skipped_when_state_carries_endpoint() {
|
|
159
|
-
let ws = PathBuf::from("/tmp/ta-unit9-prefer-state");
|
|
160
|
-
let state = json!({ "tmux_endpoint": "state-endpoint-x" });
|
|
161
|
-
let sel = select_endpoint_for_workspace(&ws, Some(&state));
|
|
162
|
-
assert_eq!(sel.endpoint, "state-endpoint-x");
|
|
163
|
-
assert_eq!(sel.source, TmuxEndpointSource::StateTmuxEndpoint);
|
|
164
|
-
}
|
|
165
|
-
}
|