@team-agent/installer 0.5.128 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/schedule.rs +0 -175
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -156
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3024
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1527
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/direct_delivery.rs +0 -368
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/inbox_store.rs +0 -169
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -557
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -889
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3727
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -336
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -167
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/reminders.rs +0 -316
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -223
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -472
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -708
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -177
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -394
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,743 +0,0 @@
|
|
|
1
|
-
//! 测试默认零真-spawn、零真-tmux:lifecycle/CLI spawn 路径必经 *_with_transport 注入离线
|
|
2
|
-
//! mock;确需真 tmux 者必须 provider:fake + RAII kill_server 守卫 + #[ignore=real-machine].
|
|
3
|
-
|
|
4
|
-
use std::collections::{BTreeMap, VecDeque};
|
|
5
|
-
use std::path::Path;
|
|
6
|
-
use std::sync::{Arc, Mutex};
|
|
7
|
-
|
|
8
|
-
use super::{
|
|
9
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
10
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, PaneLiveness, SessionName,
|
|
11
|
-
SetEnvOutcome, SpawnResult, SubmitVerification, Target, Transport, TransportError,
|
|
12
|
-
TurnVerification, WindowName,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
16
|
-
pub struct SpawnRecord {
|
|
17
|
-
pub kind: String,
|
|
18
|
-
pub session: SessionName,
|
|
19
|
-
pub window: WindowName,
|
|
20
|
-
pub argv: Vec<String>,
|
|
21
|
-
pub cwd: std::path::PathBuf,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#[derive(Debug, Clone)]
|
|
25
|
-
struct OfflineState {
|
|
26
|
-
session_present: bool,
|
|
27
|
-
session_absent_after_spawn_first: bool,
|
|
28
|
-
targets: Vec<PaneInfo>,
|
|
29
|
-
target_snapshots: VecDeque<Vec<PaneInfo>>,
|
|
30
|
-
windows: Vec<WindowName>,
|
|
31
|
-
pane_presence: BTreeMap<String, bool>,
|
|
32
|
-
dead_panes: BTreeMap<String, bool>,
|
|
33
|
-
spawn_failures: BTreeMap<String, String>,
|
|
34
|
-
spawned_panes_addressable: bool,
|
|
35
|
-
liveness: BTreeMap<String, PaneLiveness>,
|
|
36
|
-
default_liveness: PaneLiveness,
|
|
37
|
-
calls: Vec<&'static str>,
|
|
38
|
-
spawns: Vec<SpawnRecord>,
|
|
39
|
-
pane_titles: Vec<(String, String, String, String)>,
|
|
40
|
-
window_options: Vec<(String, String)>,
|
|
41
|
-
inject_targets: Vec<Target>,
|
|
42
|
-
inject_payloads: Vec<String>,
|
|
43
|
-
tmux_endpoint: Option<String>,
|
|
44
|
-
/// U1-B contract: when set, `list_targets()` returns `TransportError::MuxUnavailable`
|
|
45
|
-
/// — used to model tmux server jitter (subprocess-fork-failed level). The whole
|
|
46
|
-
/// resolve must DEFER, not silently coerce to an empty vec.
|
|
47
|
-
list_targets_error: Option<String>,
|
|
48
|
-
/// U1-C / general: pre-staged `capture()` payload, keyed by target stringification.
|
|
49
|
-
/// `Target::Pane(p)` keys as `p.as_str()`; `Target::SessionWindow{session,window}`
|
|
50
|
-
/// keys as `format!("{session}:{window}")`. A miss returns empty text (current
|
|
51
|
-
/// default behaviour).
|
|
52
|
-
capture_text: BTreeMap<String, String>,
|
|
53
|
-
/// U1-C Tail-peek contract: every `capture()` call records its `CaptureRange`,
|
|
54
|
-
/// in order, so a test can prove the delivery peek site narrowed Full → Tail(80).
|
|
55
|
-
capture_ranges: Vec<CaptureRange>,
|
|
56
|
-
/// 0.4.x (CR C-3 / CR C-5): pre-staged `query(PaneField::PaneCurrentCommand)`
|
|
57
|
-
/// answer keyed by pane id. Used by leader provider health tests.
|
|
58
|
-
pane_current_commands: BTreeMap<String, String>,
|
|
59
|
-
session_owner: Option<super::SessionOwner>,
|
|
60
|
-
native_input_observation: Option<super::native_input::InputFrame>,
|
|
61
|
-
native_input_error: Option<String>,
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
impl Default for OfflineState {
|
|
65
|
-
fn default() -> Self {
|
|
66
|
-
Self {
|
|
67
|
-
session_present: false,
|
|
68
|
-
session_absent_after_spawn_first: false,
|
|
69
|
-
targets: Vec::new(),
|
|
70
|
-
target_snapshots: VecDeque::new(),
|
|
71
|
-
windows: Vec::new(),
|
|
72
|
-
pane_presence: BTreeMap::new(),
|
|
73
|
-
dead_panes: BTreeMap::new(),
|
|
74
|
-
spawn_failures: BTreeMap::new(),
|
|
75
|
-
spawned_panes_addressable: true,
|
|
76
|
-
liveness: BTreeMap::new(),
|
|
77
|
-
default_liveness: PaneLiveness::Unknown,
|
|
78
|
-
calls: Vec::new(),
|
|
79
|
-
spawns: Vec::new(),
|
|
80
|
-
pane_titles: Vec::new(),
|
|
81
|
-
window_options: Vec::new(),
|
|
82
|
-
inject_targets: Vec::new(),
|
|
83
|
-
inject_payloads: Vec::new(),
|
|
84
|
-
tmux_endpoint: None,
|
|
85
|
-
list_targets_error: None,
|
|
86
|
-
capture_text: BTreeMap::new(),
|
|
87
|
-
capture_ranges: Vec::new(),
|
|
88
|
-
pane_current_commands: BTreeMap::new(),
|
|
89
|
-
session_owner: None,
|
|
90
|
-
native_input_observation: None,
|
|
91
|
-
native_input_error: None,
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
#[derive(Debug, Clone, Default)]
|
|
97
|
-
pub struct OfflineTransport {
|
|
98
|
-
inner: Arc<Mutex<OfflineState>>,
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
impl OfflineTransport {
|
|
102
|
-
pub fn with_native_input_observation(self, frame: super::native_input::InputFrame) -> Self {
|
|
103
|
-
self.with_state(|state| state.native_input_observation = Some(frame));
|
|
104
|
-
self
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
pub fn with_native_input_error(self, reason: &str) -> Self {
|
|
108
|
-
self.with_state(|state| state.native_input_error = Some(reason.into()));
|
|
109
|
-
self
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
pub fn new() -> Self {
|
|
113
|
-
Self::default()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
pub fn with_session_present(self, present: bool) -> Self {
|
|
117
|
-
self.with_state(|state| state.session_present = present);
|
|
118
|
-
self
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
pub fn with_session_absent_after_spawn_first(self) -> Self {
|
|
122
|
-
self.with_state(|state| state.session_absent_after_spawn_first = true);
|
|
123
|
-
self
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
pub fn with_targets(self, targets: Vec<PaneInfo>) -> Self {
|
|
127
|
-
self.with_state(|state| {
|
|
128
|
-
state.targets = targets;
|
|
129
|
-
state.target_snapshots.clear();
|
|
130
|
-
});
|
|
131
|
-
self
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
pub fn with_target_snapshots(self, snapshots: Vec<Vec<PaneInfo>>) -> Self {
|
|
135
|
-
self.with_state(|state| state.target_snapshots = snapshots.into());
|
|
136
|
-
self
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
pub fn with_windows(self, windows: Vec<WindowName>) -> Self {
|
|
140
|
-
self.with_state(|state| state.windows = windows);
|
|
141
|
-
self
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
pub fn with_default_liveness(self, liveness: PaneLiveness) -> Self {
|
|
145
|
-
self.with_state(|state| state.default_liveness = liveness);
|
|
146
|
-
self
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
pub fn with_liveness(self, pane: impl Into<String>, liveness: PaneLiveness) -> Self {
|
|
150
|
-
self.with_state(|state| {
|
|
151
|
-
state.liveness.insert(pane.into(), liveness);
|
|
152
|
-
});
|
|
153
|
-
self
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
pub fn with_pane_presence(self, pane: impl Into<String>, present: bool) -> Self {
|
|
157
|
-
self.with_state(|state| {
|
|
158
|
-
state.pane_presence.insert(pane.into(), present);
|
|
159
|
-
});
|
|
160
|
-
self
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
pub fn with_pane_dead(self, pane: impl Into<String>, dead: bool) -> Self {
|
|
164
|
-
self.with_state(|state| {
|
|
165
|
-
state.dead_panes.insert(pane.into(), dead);
|
|
166
|
-
});
|
|
167
|
-
self
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
pub fn with_spawn_failure(self, window: impl Into<String>, error: impl Into<String>) -> Self {
|
|
171
|
-
self.with_state(|state| {
|
|
172
|
-
state.spawn_failures.insert(window.into(), error.into());
|
|
173
|
-
});
|
|
174
|
-
self
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
pub fn with_spawned_panes_addressable(self, present: bool) -> Self {
|
|
178
|
-
self.with_state(|state| state.spawned_panes_addressable = present);
|
|
179
|
-
self
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
pub fn with_tmux_endpoint(self, endpoint: impl Into<String>) -> Self {
|
|
183
|
-
self.with_state(|state| state.tmux_endpoint = Some(endpoint.into()));
|
|
184
|
-
self
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
pub fn with_session_owner(
|
|
188
|
-
self,
|
|
189
|
-
workspace: &Path,
|
|
190
|
-
team: impl Into<String>,
|
|
191
|
-
generation: impl Into<String>,
|
|
192
|
-
) -> Self {
|
|
193
|
-
let workspace = workspace
|
|
194
|
-
.canonicalize()
|
|
195
|
-
.unwrap_or_else(|_| workspace.to_path_buf())
|
|
196
|
-
.to_string_lossy()
|
|
197
|
-
.into_owned();
|
|
198
|
-
self.with_state(|state| {
|
|
199
|
-
state.session_owner = Some(super::SessionOwner {
|
|
200
|
-
workspace,
|
|
201
|
-
team: team.into(),
|
|
202
|
-
generation: generation.into(),
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
self
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/// U1-B: stage a `list_targets()` error to model tmux server jitter. While set,
|
|
209
|
-
/// every call returns `Err(TransportError::MuxUnavailable{detail})`. Pass an
|
|
210
|
-
/// empty string to clear via re-builder if needed.
|
|
211
|
-
pub fn with_list_targets_error(self, detail: impl Into<String>) -> Self {
|
|
212
|
-
self.with_state(|state| state.list_targets_error = Some(detail.into()));
|
|
213
|
-
self
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/// Pre-stage `capture()` output for a `Target::Pane(pane_id)` key.
|
|
217
|
-
pub fn with_capture_for_pane(
|
|
218
|
-
self,
|
|
219
|
-
pane_id: impl Into<String>,
|
|
220
|
-
text: impl Into<String>,
|
|
221
|
-
) -> Self {
|
|
222
|
-
self.with_state(|state| {
|
|
223
|
-
state.capture_text.insert(pane_id.into(), text.into());
|
|
224
|
-
});
|
|
225
|
-
self
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/// 0.4.x (CR C-3 / CR C-5): pre-stage a `pane_current_command` answer
|
|
229
|
-
/// for `query(PaneField::PaneCurrentCommand)`. Used by leader provider
|
|
230
|
-
/// health tests to simulate "pane is now in a shell" vs
|
|
231
|
-
/// "pane is running the provider".
|
|
232
|
-
pub fn with_pane_current_command(
|
|
233
|
-
self,
|
|
234
|
-
pane_id: impl Into<String>,
|
|
235
|
-
command: impl Into<String>,
|
|
236
|
-
) -> Self {
|
|
237
|
-
self.with_state(|state| {
|
|
238
|
-
state
|
|
239
|
-
.pane_current_commands
|
|
240
|
-
.insert(pane_id.into(), command.into());
|
|
241
|
-
});
|
|
242
|
-
self
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/// 0.4.x (CR C-3 / CR C-5): mutable setters for fluent test seeding
|
|
246
|
-
/// (alternative to builder chain when the transport already exists).
|
|
247
|
-
pub fn set_pane_addressable(&self, pane: &PaneId, addressable: bool) {
|
|
248
|
-
self.with_state(|state| {
|
|
249
|
-
state.liveness.insert(
|
|
250
|
-
pane.as_str().to_string(),
|
|
251
|
-
if addressable {
|
|
252
|
-
PaneLiveness::Live
|
|
253
|
-
} else {
|
|
254
|
-
PaneLiveness::Dead
|
|
255
|
-
},
|
|
256
|
-
);
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
pub fn set_pane_current_command(&self, pane: &PaneId, command: &str) {
|
|
261
|
-
self.with_state(|state| {
|
|
262
|
-
state
|
|
263
|
-
.pane_current_commands
|
|
264
|
-
.insert(pane.as_str().to_string(), command.to_string());
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
pub fn set_pane_capture(&self, pane: &PaneId, text: &str) {
|
|
269
|
-
self.with_state(|state| {
|
|
270
|
-
state
|
|
271
|
-
.capture_text
|
|
272
|
-
.insert(pane.as_str().to_string(), text.to_string());
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/// Pre-stage `capture()` output for a `Target::SessionWindow{session,window}` key.
|
|
277
|
-
pub fn with_capture_for_session_window(
|
|
278
|
-
self,
|
|
279
|
-
session: impl Into<String>,
|
|
280
|
-
window: impl Into<String>,
|
|
281
|
-
text: impl Into<String>,
|
|
282
|
-
) -> Self {
|
|
283
|
-
let key = format!("{}:{}", session.into(), window.into());
|
|
284
|
-
self.with_state(|state| {
|
|
285
|
-
state.capture_text.insert(key, text.into());
|
|
286
|
-
});
|
|
287
|
-
self
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
pub fn calls(&self) -> Vec<&'static str> {
|
|
291
|
-
self.with_state(|state| state.calls.clone())
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
pub fn spawn_records(&self) -> Vec<(String, Vec<String>)> {
|
|
295
|
-
self.with_state(|state| {
|
|
296
|
-
state
|
|
297
|
-
.spawns
|
|
298
|
-
.iter()
|
|
299
|
-
.map(|record| (record.kind.clone(), record.argv.clone()))
|
|
300
|
-
.collect()
|
|
301
|
-
})
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
pub fn spawn_window_records(&self) -> Vec<(String, String)> {
|
|
305
|
-
self.with_state(|state| {
|
|
306
|
-
state
|
|
307
|
-
.spawns
|
|
308
|
-
.iter()
|
|
309
|
-
.map(|record| (record.kind.clone(), record.window.as_str().to_string()))
|
|
310
|
-
.collect()
|
|
311
|
-
})
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
pub fn spawn_cwd_records(&self) -> Vec<std::path::PathBuf> {
|
|
315
|
-
self.with_state(|state| {
|
|
316
|
-
state
|
|
317
|
-
.spawns
|
|
318
|
-
.iter()
|
|
319
|
-
.map(|record| record.cwd.clone())
|
|
320
|
-
.collect()
|
|
321
|
-
})
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
pub fn pane_title_records(&self) -> Vec<(String, String, String, String)> {
|
|
325
|
-
self.with_state(|state| state.pane_titles.clone())
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
pub fn window_options(&self) -> Vec<(String, String)> {
|
|
329
|
-
self.with_state(|state| state.window_options.clone())
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
pub fn inject_targets(&self) -> Vec<Target> {
|
|
333
|
-
self.with_state(|state| state.inject_targets.clone())
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
pub fn inject_payloads(&self) -> Vec<String> {
|
|
337
|
-
self.with_state(|state| state.inject_payloads.clone())
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/// All `capture()` ranges observed, in call order. Used by U1-C Tail-peek
|
|
341
|
-
/// contracts to prove the delivery peek site requested Tail rather than Full.
|
|
342
|
-
pub fn capture_ranges(&self) -> Vec<CaptureRange> {
|
|
343
|
-
self.with_state(|state| state.capture_ranges.clone())
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
fn record(&self, call: &'static str) {
|
|
347
|
-
self.with_state(|state| state.calls.push(call));
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
fn with_state<T>(&self, f: impl FnOnce(&mut OfflineState) -> T) -> T {
|
|
351
|
-
match self.inner.lock() {
|
|
352
|
-
Ok(mut guard) => f(&mut guard),
|
|
353
|
-
Err(poisoned) => {
|
|
354
|
-
let mut guard = poisoned.into_inner();
|
|
355
|
-
f(&mut guard)
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
fn spawn_result(
|
|
361
|
-
&self,
|
|
362
|
-
kind: &'static str,
|
|
363
|
-
session: &SessionName,
|
|
364
|
-
window: &WindowName,
|
|
365
|
-
argv: &[String],
|
|
366
|
-
cwd: &Path,
|
|
367
|
-
) -> Result<SpawnResult, TransportError> {
|
|
368
|
-
let pane_index = self.with_state(|state| {
|
|
369
|
-
state.calls.push(kind);
|
|
370
|
-
state.spawns.push(SpawnRecord {
|
|
371
|
-
kind: kind.to_string(),
|
|
372
|
-
session: session.clone(),
|
|
373
|
-
window: window.clone(),
|
|
374
|
-
argv: argv.to_vec(),
|
|
375
|
-
cwd: cwd.to_path_buf(),
|
|
376
|
-
});
|
|
377
|
-
if let Some(error) = state.spawn_failures.get(window.as_str()) {
|
|
378
|
-
return Err(TransportError::Spawn {
|
|
379
|
-
backend: BackendKind::Tmux,
|
|
380
|
-
source: std::io::Error::other(error.clone()),
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
if kind == "spawn_first" && !state.session_absent_after_spawn_first {
|
|
384
|
-
state.session_present = true;
|
|
385
|
-
}
|
|
386
|
-
let mut pane_index = state.spawns.len().saturating_sub(1);
|
|
387
|
-
// Existing sessions reserve `%0` for the already-running pane.
|
|
388
|
-
if kind == "spawn_into" {
|
|
389
|
-
pane_index = pane_index.max(1);
|
|
390
|
-
}
|
|
391
|
-
while state.pane_presence.contains_key(&format!("%{pane_index}"))
|
|
392
|
-
|| state
|
|
393
|
-
.targets
|
|
394
|
-
.iter()
|
|
395
|
-
.chain(state.target_snapshots.iter().flatten())
|
|
396
|
-
.any(|target| target.pane_id.as_str() == format!("%{pane_index}"))
|
|
397
|
-
{
|
|
398
|
-
pane_index = pane_index.saturating_add(1);
|
|
399
|
-
}
|
|
400
|
-
state
|
|
401
|
-
.pane_presence
|
|
402
|
-
.insert(format!("%{pane_index}"), state.spawned_panes_addressable);
|
|
403
|
-
state.liveness.insert(
|
|
404
|
-
format!("%{pane_index}"),
|
|
405
|
-
if state.spawned_panes_addressable {
|
|
406
|
-
PaneLiveness::Live
|
|
407
|
-
} else {
|
|
408
|
-
PaneLiveness::Dead
|
|
409
|
-
},
|
|
410
|
-
);
|
|
411
|
-
if state.spawned_panes_addressable {
|
|
412
|
-
let pane_id = PaneId::new(format!("%{pane_index}"));
|
|
413
|
-
state.targets.retain(|target| target.pane_id != pane_id);
|
|
414
|
-
state.targets.push(PaneInfo {
|
|
415
|
-
pane_id,
|
|
416
|
-
session: session.clone(),
|
|
417
|
-
window_index: None,
|
|
418
|
-
window_name: Some(window.clone()),
|
|
419
|
-
pane_index: None,
|
|
420
|
-
tty: None,
|
|
421
|
-
current_command: None,
|
|
422
|
-
current_path: None,
|
|
423
|
-
active: false,
|
|
424
|
-
pane_pid: None,
|
|
425
|
-
leader_env: BTreeMap::new(),
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
Ok(pane_index)
|
|
429
|
-
})?;
|
|
430
|
-
Ok(SpawnResult {
|
|
431
|
-
pane_id: PaneId::new(format!("%{pane_index}")),
|
|
432
|
-
session: session.clone(),
|
|
433
|
-
window: window.clone(),
|
|
434
|
-
child_pid: None,
|
|
435
|
-
})
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
fn inject_report() -> InjectReport {
|
|
439
|
-
InjectReport {
|
|
440
|
-
stage_reached: InjectStage::Submit,
|
|
441
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
442
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
443
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
444
|
-
attempts: 1,
|
|
445
|
-
submit_diagnostics: None,
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
impl Transport for OfflineTransport {
|
|
451
|
-
fn observe_native_input(
|
|
452
|
-
&self,
|
|
453
|
-
_target: &Target,
|
|
454
|
-
_provider: crate::model::enums::Provider,
|
|
455
|
-
) -> Result<Option<super::native_input::InputFrame>, TransportError> {
|
|
456
|
-
self.with_state(|state| match &state.native_input_error {
|
|
457
|
-
Some(reason) => Err(TransportError::NativeInputNotReady { reason: reason.clone() }),
|
|
458
|
-
None => Ok(state.native_input_observation.clone()),
|
|
459
|
-
})
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
fn kind(&self) -> BackendKind {
|
|
463
|
-
BackendKind::Tmux
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
fn tmux_endpoint(&self) -> Option<String> {
|
|
467
|
-
self.with_state(|state| state.tmux_endpoint.clone())
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
fn spawn_first(
|
|
471
|
-
&self,
|
|
472
|
-
session: &SessionName,
|
|
473
|
-
window: &WindowName,
|
|
474
|
-
argv: &[String],
|
|
475
|
-
cwd: &Path,
|
|
476
|
-
_env: &BTreeMap<String, String>,
|
|
477
|
-
) -> Result<SpawnResult, TransportError> {
|
|
478
|
-
self.spawn_result("spawn_first", session, window, argv, cwd)
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
fn spawn_into(
|
|
482
|
-
&self,
|
|
483
|
-
session: &SessionName,
|
|
484
|
-
window: &WindowName,
|
|
485
|
-
argv: &[String],
|
|
486
|
-
cwd: &Path,
|
|
487
|
-
_env: &BTreeMap<String, String>,
|
|
488
|
-
) -> Result<SpawnResult, TransportError> {
|
|
489
|
-
self.spawn_result("spawn_into", session, window, argv, cwd)
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
fn spawn_split_with_env_unset(
|
|
493
|
-
&self,
|
|
494
|
-
session: &SessionName,
|
|
495
|
-
window: &WindowName,
|
|
496
|
-
argv: &[String],
|
|
497
|
-
cwd: &Path,
|
|
498
|
-
_env: &BTreeMap<String, String>,
|
|
499
|
-
_env_unset: &[String],
|
|
500
|
-
) -> Result<SpawnResult, TransportError> {
|
|
501
|
-
self.spawn_result("spawn_split", session, window, argv, cwd)
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
fn inject(
|
|
505
|
-
&self,
|
|
506
|
-
target: &Target,
|
|
507
|
-
payload: &InjectPayload,
|
|
508
|
-
_submit: Key,
|
|
509
|
-
_bracketed: bool,
|
|
510
|
-
) -> Result<InjectReport, TransportError> {
|
|
511
|
-
self.with_state(|state| {
|
|
512
|
-
state.calls.push("inject");
|
|
513
|
-
state.inject_targets.push(target.clone());
|
|
514
|
-
state.inject_payloads.push(match payload {
|
|
515
|
-
InjectPayload::Empty => String::new(),
|
|
516
|
-
InjectPayload::Text(text) | InjectPayload::TextSkipConsumptionPoll(text) => {
|
|
517
|
-
text.clone()
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
});
|
|
521
|
-
Ok(Self::inject_report())
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
525
|
-
self.record("send_keys");
|
|
526
|
-
Ok(())
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
fn capture(
|
|
530
|
-
&self,
|
|
531
|
-
target: &Target,
|
|
532
|
-
range: CaptureRange,
|
|
533
|
-
) -> Result<CapturedText, TransportError> {
|
|
534
|
-
let key = match target {
|
|
535
|
-
Target::Pane(p) => p.as_str().to_string(),
|
|
536
|
-
Target::SessionWindow { session, window } => {
|
|
537
|
-
format!("{}:{}", session.as_str(), window.as_str())
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
let text = self.with_state(|state| {
|
|
541
|
-
state.calls.push("capture");
|
|
542
|
-
state.capture_ranges.push(range);
|
|
543
|
-
state.capture_text.get(&key).cloned().unwrap_or_default()
|
|
544
|
-
});
|
|
545
|
-
Ok(CapturedText { text, range })
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
fn query(&self, target: &Target, field: PaneField) -> Result<Option<String>, TransportError> {
|
|
549
|
-
self.record("query");
|
|
550
|
-
if !matches!(field, PaneField::PaneCurrentCommand) {
|
|
551
|
-
return Ok(None);
|
|
552
|
-
}
|
|
553
|
-
let pane_id = match target {
|
|
554
|
-
Target::Pane(p) => p.as_str().to_string(),
|
|
555
|
-
Target::SessionWindow { .. } => return Ok(None),
|
|
556
|
-
};
|
|
557
|
-
Ok(self.with_state(|state| state.pane_current_commands.get(&pane_id).cloned()))
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
fn pane_is_dead(&self, pane: &PaneId) -> Result<Option<bool>, TransportError> {
|
|
561
|
-
Ok(self.with_state(|state| {
|
|
562
|
-
state.calls.push("pane_is_dead");
|
|
563
|
-
state.dead_panes.get(pane.as_str()).copied()
|
|
564
|
-
}))
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
fn liveness(&self, pane: &PaneId) -> Result<PaneLiveness, TransportError> {
|
|
568
|
-
Ok(self.with_state(|state| {
|
|
569
|
-
state.calls.push("liveness");
|
|
570
|
-
state
|
|
571
|
-
.liveness
|
|
572
|
-
.get(pane.as_str())
|
|
573
|
-
.copied()
|
|
574
|
-
.unwrap_or(state.default_liveness)
|
|
575
|
-
}))
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
fn has_pane(&self, pane: &PaneId) -> Result<Option<bool>, TransportError> {
|
|
579
|
-
Ok(self.with_state(|state| {
|
|
580
|
-
state.calls.push("has_pane");
|
|
581
|
-
state.pane_presence.get(pane.as_str()).copied()
|
|
582
|
-
}))
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
586
|
-
// U1-B: when `with_list_targets_error` is set, return a real Err so the
|
|
587
|
-
// caller sees server jitter rather than a coerced empty vec.
|
|
588
|
-
if let Some(detail) = self.with_state(|state| {
|
|
589
|
-
state.calls.push("list_targets");
|
|
590
|
-
state.list_targets_error.clone()
|
|
591
|
-
}) {
|
|
592
|
-
return Err(TransportError::MuxUnavailable {
|
|
593
|
-
backend: BackendKind::Tmux,
|
|
594
|
-
detail,
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
Ok(self.with_state(|state| {
|
|
598
|
-
let targets = state
|
|
599
|
-
.target_snapshots
|
|
600
|
-
.pop_front()
|
|
601
|
-
.unwrap_or_else(|| state.targets.clone());
|
|
602
|
-
for target in &targets {
|
|
603
|
-
state
|
|
604
|
-
.pane_presence
|
|
605
|
-
.entry(target.pane_id.as_str().to_string())
|
|
606
|
-
.or_insert(true);
|
|
607
|
-
}
|
|
608
|
-
targets
|
|
609
|
-
}))
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
613
|
-
Ok(self.with_state(|state| {
|
|
614
|
-
state.calls.push("has_session");
|
|
615
|
-
state.session_present
|
|
616
|
-
}))
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
fn session_owner(
|
|
620
|
-
&self,
|
|
621
|
-
_session: &SessionName,
|
|
622
|
-
) -> Result<Option<super::SessionOwner>, TransportError> {
|
|
623
|
-
Ok(self.with_state(|state| state.session_owner.clone()))
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
fn set_session_owner_with_generation(
|
|
627
|
-
&self,
|
|
628
|
-
_session: &SessionName,
|
|
629
|
-
workspace: &Path,
|
|
630
|
-
team: &str,
|
|
631
|
-
generation: &str,
|
|
632
|
-
) -> Result<(), TransportError> {
|
|
633
|
-
self.with_state(|state| {
|
|
634
|
-
state.calls.push("set_session_owner_with_generation");
|
|
635
|
-
state.session_owner = Some(super::SessionOwner {
|
|
636
|
-
workspace: workspace.canonicalize().unwrap_or_else(|_| workspace.to_path_buf())
|
|
637
|
-
.to_string_lossy().to_string(),
|
|
638
|
-
team: team.to_string(),
|
|
639
|
-
generation: generation.to_string(),
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
Ok(())
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
646
|
-
Ok(self.with_state(|state| {
|
|
647
|
-
state.calls.push("list_windows");
|
|
648
|
-
if state.windows.is_empty() {
|
|
649
|
-
state
|
|
650
|
-
.targets
|
|
651
|
-
.iter()
|
|
652
|
-
.filter_map(|pane| pane.window_name.clone())
|
|
653
|
-
.collect()
|
|
654
|
-
} else {
|
|
655
|
-
state.windows.clone()
|
|
656
|
-
}
|
|
657
|
-
}))
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
fn configure_adaptive_pane_title(
|
|
661
|
-
&self,
|
|
662
|
-
session: &SessionName,
|
|
663
|
-
window: &WindowName,
|
|
664
|
-
pane: &PaneId,
|
|
665
|
-
title: &str,
|
|
666
|
-
) -> Result<(), TransportError> {
|
|
667
|
-
self.with_state(|state| {
|
|
668
|
-
state.calls.push("configure_adaptive_pane_title");
|
|
669
|
-
state.pane_titles.push((
|
|
670
|
-
session.as_str().to_string(),
|
|
671
|
-
window.as_str().to_string(),
|
|
672
|
-
pane.as_str().to_string(),
|
|
673
|
-
title.to_string(),
|
|
674
|
-
));
|
|
675
|
-
});
|
|
676
|
-
Ok(())
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
fn set_session_env(
|
|
680
|
-
&self,
|
|
681
|
-
_session: &SessionName,
|
|
682
|
-
_key: &str,
|
|
683
|
-
_value: &str,
|
|
684
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
685
|
-
self.record("set_session_env");
|
|
686
|
-
Ok(SetEnvOutcome::Applied)
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
fn set_window_option(
|
|
690
|
-
&self,
|
|
691
|
-
_session: &SessionName,
|
|
692
|
-
_window: &WindowName,
|
|
693
|
-
option: &str,
|
|
694
|
-
value: &str,
|
|
695
|
-
) -> Result<(), TransportError> {
|
|
696
|
-
self.with_state(|state| {
|
|
697
|
-
state.calls.push("set_window_option");
|
|
698
|
-
state.window_options.push((option.to_string(), value.to_string()));
|
|
699
|
-
});
|
|
700
|
-
Ok(())
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
fn kill_session(&self, session: &SessionName) -> Result<(), TransportError> {
|
|
704
|
-
self.with_state(|state| {
|
|
705
|
-
state.calls.push("kill_session");
|
|
706
|
-
state.targets.retain(|target| target.session != *session);
|
|
707
|
-
state.windows.clear();
|
|
708
|
-
state.session_present = false;
|
|
709
|
-
});
|
|
710
|
-
Ok(())
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
fn kill_window(&self, target: &Target) -> Result<(), TransportError> {
|
|
714
|
-
self.with_state(|state| {
|
|
715
|
-
state.calls.push("kill_window");
|
|
716
|
-
if let Target::SessionWindow { session, window } = target {
|
|
717
|
-
state.targets.retain(|pane| {
|
|
718
|
-
pane.session != *session
|
|
719
|
-
|| pane.window_name.as_ref().is_none_or(|name| name != window)
|
|
720
|
-
});
|
|
721
|
-
state.windows.retain(|name| name != window);
|
|
722
|
-
}
|
|
723
|
-
});
|
|
724
|
-
Ok(())
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
fn kill_pane(&self, pane: &PaneId) -> Result<(), TransportError> {
|
|
728
|
-
self.with_state(|state| {
|
|
729
|
-
state.calls.push("kill_pane");
|
|
730
|
-
state.targets.retain(|target| target.pane_id != *pane);
|
|
731
|
-
state.pane_presence.insert(pane.as_str().to_string(), false);
|
|
732
|
-
state
|
|
733
|
-
.liveness
|
|
734
|
-
.insert(pane.as_str().to_string(), PaneLiveness::Dead);
|
|
735
|
-
});
|
|
736
|
-
Ok(())
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
740
|
-
self.record("attach_session");
|
|
741
|
-
Ok(AttachOutcome::Attached)
|
|
742
|
-
}
|
|
743
|
-
}
|